| author | ymh <ymh.work@gmail.com> |
| Tue, 03 Sep 2024 11:09:40 +0200 | |
| changeset 1558 | 761ba7426984 |
| parent 1514 | 5869151a1f2f |
| child 1571 | 4a1e6952afe5 |
| permissions | -rw-r--r-- |
|
1558
761ba7426984
upgrade metadataplayer and add a sitemap
ymh <ymh.work@gmail.com>
parents:
1514
diff
changeset
|
1 |
/*! For license information please see live-polemic.js.LICENSE.txt */ |
|
761ba7426984
upgrade metadataplayer and add a sitemap
ymh <ymh.work@gmail.com>
parents:
1514
diff
changeset
|
2 |
(()=>{var __webpack_modules__={"./node_modules/@videojs/vhs-utils/es/byte-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENDIANNESS: () => (/* binding */ ENDIANNESS),\n/* harmony export */ IS_BIG_ENDIAN: () => (/* binding */ IS_BIG_ENDIAN),\n/* harmony export */ IS_LITTLE_ENDIAN: () => (/* binding */ IS_LITTLE_ENDIAN),\n/* harmony export */ bytesMatch: () => (/* binding */ bytesMatch),\n/* harmony export */ bytesToNumber: () => (/* binding */ bytesToNumber),\n/* harmony export */ bytesToString: () => (/* binding */ bytesToString),\n/* harmony export */ concatTypedArrays: () => (/* binding */ concatTypedArrays),\n/* harmony export */ countBits: () => (/* binding */ countBits),\n/* harmony export */ countBytes: () => (/* binding */ countBytes),\n/* harmony export */ isArrayBufferView: () => (/* binding */ isArrayBufferView),\n/* harmony export */ isTypedArray: () => (/* binding */ isTypedArray),\n/* harmony export */ numberToBytes: () => (/* binding */ numberToBytes),\n/* harmony export */ padStart: () => (/* binding */ padStart),\n/* harmony export */ reverseBytes: () => (/* binding */ reverseBytes),\n/* harmony export */ sliceBytes: () => (/* binding */ sliceBytes),\n/* harmony export */ stringToBytes: () => (/* binding */ stringToBytes),\n/* harmony export */ toBinaryString: () => (/* binding */ toBinaryString),\n/* harmony export */ toHexString: () => (/* binding */ toHexString),\n/* harmony export */ toUint8: () => (/* binding */ toUint8)\n/* harmony export */ });\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__);\n // const log2 = Math.log2 ? Math.log2 : (x) => (Math.log(x) / Math.log(2));\n\nvar repeat = function repeat(str, len) {\n var acc = '';\n\n while (len--) {\n acc += str;\n }\n\n return acc;\n}; // count the number of bits it would take to represent a number\n// we used to do this with log2 but BigInt does not support builtin math\n// Math.ceil(log2(x));\n\n\nvar countBits = function countBits(x) {\n return x.toString(2).length;\n}; // count the number of whole bytes it would take to represent a number\n\nvar countBytes = function countBytes(x) {\n return Math.ceil(countBits(x) / 8);\n};\nvar padStart = function padStart(b, len, str) {\n if (str === void 0) {\n str = ' ';\n }\n\n return (repeat(str, len) + b.toString()).slice(-len);\n};\nvar isArrayBufferView = function isArrayBufferView(obj) {\n if (ArrayBuffer.isView === 'function') {\n return ArrayBuffer.isView(obj);\n }\n\n return obj && obj.buffer instanceof ArrayBuffer;\n};\nvar isTypedArray = function isTypedArray(obj) {\n return isArrayBufferView(obj);\n};\nvar toUint8 = function toUint8(bytes) {\n if (bytes instanceof Uint8Array) {\n return bytes;\n }\n\n if (!Array.isArray(bytes) && !isTypedArray(bytes) && !(bytes instanceof ArrayBuffer)) {\n // any non-number or NaN leads to empty uint8array\n // eslint-disable-next-line\n if (typeof bytes !== 'number' || typeof bytes === 'number' && bytes !== bytes) {\n bytes = 0;\n } else {\n bytes = [bytes];\n }\n }\n\n return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0);\n};\nvar toHexString = function toHexString(bytes) {\n bytes = toUint8(bytes);\n var str = '';\n\n for (var i = 0; i < bytes.length; i++) {\n str += padStart(bytes[i].toString(16), 2, '0');\n }\n\n return str;\n};\nvar toBinaryString = function toBinaryString(bytes) {\n bytes = toUint8(bytes);\n var str = '';\n\n for (var i = 0; i < bytes.length; i++) {\n str += padStart(bytes[i].toString(2), 8, '0');\n }\n\n return str;\n};\nvar BigInt = (global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt) || Number;\nvar BYTE_TABLE = [BigInt('0x1'), BigInt('0x100'), BigInt('0x10000'), BigInt('0x1000000'), BigInt('0x100000000'), BigInt('0x10000000000'), BigInt('0x1000000000000'), BigInt('0x100000000000000'), BigInt('0x10000000000000000')];\nvar ENDIANNESS = function () {\n var a = new Uint16Array([0xFFCC]);\n var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);\n\n if (b[0] === 0xFF) {\n return 'big';\n }\n\n if (b[0] === 0xCC) {\n return 'little';\n }\n\n return 'unknown';\n}();\nvar IS_BIG_ENDIAN = ENDIANNESS === 'big';\nvar IS_LITTLE_ENDIAN = ENDIANNESS === 'little';\nvar bytesToNumber = function bytesToNumber(bytes, _temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$signed = _ref.signed,\n signed = _ref$signed === void 0 ? false : _ref$signed,\n _ref$le = _ref.le,\n le = _ref$le === void 0 ? false : _ref$le;\n\n bytes = toUint8(bytes);\n var fn = le ? 'reduce' : 'reduceRight';\n var obj = bytes[fn] ? bytes[fn] : Array.prototype[fn];\n var number = obj.call(bytes, function (total, byte, i) {\n var exponent = le ? i : Math.abs(i + 1 - bytes.length);\n return total + BigInt(byte) * BYTE_TABLE[exponent];\n }, BigInt(0));\n\n if (signed) {\n var max = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1);\n number = BigInt(number);\n\n if (number > max) {\n number -= max;\n number -= max;\n number -= BigInt(2);\n }\n }\n\n return Number(number);\n};\nvar numberToBytes = function numberToBytes(number, _temp2) {\n var _ref2 = _temp2 === void 0 ? {} : _temp2,\n _ref2$le = _ref2.le,\n le = _ref2$le === void 0 ? false : _ref2$le;\n\n // eslint-disable-next-line\n if (typeof number !== 'bigint' && typeof number !== 'number' || typeof number === 'number' && number !== number) {\n number = 0;\n }\n\n number = BigInt(number);\n var byteCount = countBytes(number);\n var bytes = new Uint8Array(new ArrayBuffer(byteCount));\n\n for (var i = 0; i < byteCount; i++) {\n var byteIndex = le ? i : Math.abs(i + 1 - bytes.length);\n bytes[byteIndex] = Number(number / BYTE_TABLE[i] & BigInt(0xFF));\n\n if (number < 0) {\n bytes[byteIndex] = Math.abs(~bytes[byteIndex]);\n bytes[byteIndex] -= i === 0 ? 1 : 2;\n }\n }\n\n return bytes;\n};\nvar bytesToString = function bytesToString(bytes) {\n if (!bytes) {\n return '';\n } // TODO: should toUint8 handle cases where we only have 8 bytes\n // but report more since this is a Uint16+ Array?\n\n\n bytes = Array.prototype.slice.call(bytes);\n var string = String.fromCharCode.apply(null, toUint8(bytes));\n\n try {\n return decodeURIComponent(escape(string));\n } catch (e) {// if decodeURIComponent/escape fails, we are dealing with partial\n // or full non string data. Just return the potentially garbled string.\n }\n\n return string;\n};\nvar stringToBytes = function stringToBytes(string, stringIsBytes) {\n if (typeof string !== 'string' && string && typeof string.toString === 'function') {\n string = string.toString();\n }\n\n if (typeof string !== 'string') {\n return new Uint8Array();\n } // If the string already is bytes, we don't have to do this\n // otherwise we do this so that we split multi length characters\n // into individual bytes\n\n\n if (!stringIsBytes) {\n string = unescape(encodeURIComponent(string));\n }\n\n var view = new Uint8Array(string.length);\n\n for (var i = 0; i < string.length; i++) {\n view[i] = string.charCodeAt(i);\n }\n\n return view;\n};\nvar concatTypedArrays = function concatTypedArrays() {\n for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) {\n buffers[_key] = arguments[_key];\n }\n\n buffers = buffers.filter(function (b) {\n return b && (b.byteLength || b.length) && typeof b !== 'string';\n });\n\n if (buffers.length <= 1) {\n // for 0 length we will return empty uint8\n // for 1 length we return the first uint8\n return toUint8(buffers[0]);\n }\n\n var totalLen = buffers.reduce(function (total, buf, i) {\n return total + (buf.byteLength || buf.length);\n }, 0);\n var tempBuffer = new Uint8Array(totalLen);\n var offset = 0;\n buffers.forEach(function (buf) {\n buf = toUint8(buf);\n tempBuffer.set(buf, offset);\n offset += buf.byteLength;\n });\n return tempBuffer;\n};\n/**\n * Check if the bytes \"b\" are contained within bytes \"a\".\n *\n * @param {Uint8Array|Array} a\n * Bytes to check in\n *\n * @param {Uint8Array|Array} b\n * Bytes to check for\n *\n * @param {Object} options\n * options\n *\n * @param {Array|Uint8Array} [offset=0]\n * offset to use when looking at bytes in a\n *\n * @param {Array|Uint8Array} [mask=[]]\n * mask to use on bytes before comparison.\n *\n * @return {boolean}\n * If all bytes in b are inside of a, taking into account\n * bit masks.\n */\n\nvar bytesMatch = function bytesMatch(a, b, _temp3) {\n var _ref3 = _temp3 === void 0 ? {} : _temp3,\n _ref3$offset = _ref3.offset,\n offset = _ref3$offset === void 0 ? 0 : _ref3$offset,\n _ref3$mask = _ref3.mask,\n mask = _ref3$mask === void 0 ? [] : _ref3$mask;\n\n a = toUint8(a);\n b = toUint8(b); // ie 11 does not support uint8 every\n\n var fn = b.every ? b.every : Array.prototype.every;\n return b.length && a.length - offset >= b.length && // ie 11 doesn't support every on uin8\n fn.call(b, function (bByte, i) {\n var aByte = mask[i] ? mask[i] & a[offset + i] : a[offset + i];\n return bByte === aByte;\n });\n};\nvar sliceBytes = function sliceBytes(src, start, end) {\n if (Uint8Array.prototype.slice) {\n return Uint8Array.prototype.slice.call(src, start, end);\n }\n\n return new Uint8Array(Array.prototype.slice.call(src, start, end));\n};\nvar reverseBytes = function reverseBytes(src) {\n if (src.reverse) {\n return src.reverse();\n }\n\n return Array.prototype.reverse.call(src);\n};\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/byte-helpers.js?")},"./node_modules/@videojs/vhs-utils/es/codec-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getAv1Codec: () => (/* binding */ getAv1Codec),\n/* harmony export */ getAvcCodec: () => (/* binding */ getAvcCodec),\n/* harmony export */ getHvcCodec: () => (/* binding */ getHvcCodec)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers.js */ \"./node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n // https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-syntax\n// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/codecs_parameter#AV1\n\nvar getAv1Codec = function getAv1Codec(bytes) {\n var codec = '';\n var profile = bytes[1] >>> 3;\n var level = bytes[1] & 0x1F;\n var tier = bytes[2] >>> 7;\n var highBitDepth = (bytes[2] & 0x40) >> 6;\n var twelveBit = (bytes[2] & 0x20) >> 5;\n var monochrome = (bytes[2] & 0x10) >> 4;\n var chromaSubsamplingX = (bytes[2] & 0x08) >> 3;\n var chromaSubsamplingY = (bytes[2] & 0x04) >> 2;\n var chromaSamplePosition = bytes[2] & 0x03;\n codec += profile + \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(level, 2, '0');\n\n if (tier === 0) {\n codec += 'M';\n } else if (tier === 1) {\n codec += 'H';\n }\n\n var bitDepth;\n\n if (profile === 2 && highBitDepth) {\n bitDepth = twelveBit ? 12 : 10;\n } else {\n bitDepth = highBitDepth ? 10 : 8;\n }\n\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(bitDepth, 2, '0'); // TODO: can we parse color range??\n\n codec += \".\" + monochrome;\n codec += \".\" + chromaSubsamplingX + chromaSubsamplingY + chromaSamplePosition;\n return codec;\n};\nvar getAvcCodec = function getAvcCodec(bytes) {\n var profileId = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toHexString)(bytes[1]);\n var constraintFlags = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toHexString)(bytes[2] & 0xFC);\n var levelId = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toHexString)(bytes[3]);\n return \"\" + profileId + constraintFlags + levelId;\n};\nvar getHvcCodec = function getHvcCodec(bytes) {\n var codec = '';\n var profileSpace = bytes[1] >> 6;\n var profileId = bytes[1] & 0x1F;\n var tierFlag = (bytes[1] & 0x20) >> 5;\n var profileCompat = bytes.subarray(2, 6);\n var constraintIds = bytes.subarray(6, 12);\n var levelId = bytes[12];\n\n if (profileSpace === 1) {\n codec += 'A';\n } else if (profileSpace === 2) {\n codec += 'B';\n } else if (profileSpace === 3) {\n codec += 'C';\n }\n\n codec += profileId + \".\"; // ffmpeg does this in big endian\n\n var profileCompatVal = parseInt((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toBinaryString)(profileCompat).split('').reverse().join(''), 2); // apple does this in little endian...\n\n if (profileCompatVal > 255) {\n profileCompatVal = parseInt((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toBinaryString)(profileCompat), 2);\n }\n\n codec += profileCompatVal.toString(16) + \".\";\n\n if (tierFlag === 0) {\n codec += 'L';\n } else {\n codec += 'H';\n }\n\n codec += levelId;\n var constraints = '';\n\n for (var i = 0; i < constraintIds.length; i++) {\n var v = constraintIds[i];\n\n if (v) {\n if (constraints) {\n constraints += '.';\n }\n\n constraints += v.toString(16);\n }\n }\n\n if (constraints) {\n codec += \".\" + constraints;\n }\n\n return codec;\n};\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/codec-helpers.js?")},"./node_modules/@videojs/vhs-utils/es/codecs.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_AUDIO_CODEC: () => (/* binding */ DEFAULT_AUDIO_CODEC),\n/* harmony export */ DEFAULT_VIDEO_CODEC: () => (/* binding */ DEFAULT_VIDEO_CODEC),\n/* harmony export */ browserSupportsCodec: () => (/* binding */ browserSupportsCodec),\n/* harmony export */ codecsFromDefault: () => (/* binding */ codecsFromDefault),\n/* harmony export */ getMimeForCodec: () => (/* binding */ getMimeForCodec),\n/* harmony export */ isAudioCodec: () => (/* binding */ isAudioCodec),\n/* harmony export */ isTextCodec: () => (/* binding */ isTextCodec),\n/* harmony export */ isVideoCodec: () => (/* binding */ isVideoCodec),\n/* harmony export */ mapLegacyAvcCodecs: () => (/* binding */ mapLegacyAvcCodecs),\n/* harmony export */ muxerSupportsCodec: () => (/* binding */ muxerSupportsCodec),\n/* harmony export */ parseCodecs: () => (/* binding */ parseCodecs),\n/* harmony export */ translateLegacyCodec: () => (/* binding */ translateLegacyCodec),\n/* harmony export */ translateLegacyCodecs: () => (/* binding */ translateLegacyCodecs)\n/* harmony export */ });\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__);\n\nvar regexs = {\n // to determine mime types\n mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,\n webm: /^(vp0?[89]|av0?1|opus|vorbis)/,\n ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/,\n // to determine if a codec is audio or video\n video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,\n audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,\n text: /^(stpp.ttml.im1t)/,\n // mux.js support regex\n muxerVideo: /^(avc0?1)/,\n muxerAudio: /^(mp4a)/,\n // match nothing as muxer does not support text right now.\n // there cannot never be a character before the start of a string\n // so this matches nothing.\n muxerText: /a^/\n};\nvar mediaTypes = ['video', 'audio', 'text'];\nvar upperMediaTypes = ['Video', 'Audio', 'Text'];\n/**\n * Replace the old apple-style `avc1.<dd>.<dd>` codec string with the standard\n * `avc1.<hhhhhh>`\n *\n * @param {string} codec\n * Codec string to translate\n * @return {string}\n * The translated codec string\n */\n\nvar translateLegacyCodec = function translateLegacyCodec(codec) {\n if (!codec) {\n return codec;\n }\n\n return codec.replace(/avc1\\.(\\d+)\\.(\\d+)/i, function (orig, profile, avcLevel) {\n var profileHex = ('00' + Number(profile).toString(16)).slice(-2);\n var avcLevelHex = ('00' + Number(avcLevel).toString(16)).slice(-2);\n return 'avc1.' + profileHex + '00' + avcLevelHex;\n });\n};\n/**\n * Replace the old apple-style `avc1.<dd>.<dd>` codec strings with the standard\n * `avc1.<hhhhhh>`\n *\n * @param {string[]} codecs\n * An array of codec strings to translate\n * @return {string[]}\n * The translated array of codec strings\n */\n\nvar translateLegacyCodecs = function translateLegacyCodecs(codecs) {\n return codecs.map(translateLegacyCodec);\n};\n/**\n * Replace codecs in the codec string with the old apple-style `avc1.<dd>.<dd>` to the\n * standard `avc1.<hhhhhh>`.\n *\n * @param {string} codecString\n * The codec string\n * @return {string}\n * The codec string with old apple-style codecs replaced\n *\n * @private\n */\n\nvar mapLegacyAvcCodecs = function mapLegacyAvcCodecs(codecString) {\n return codecString.replace(/avc1\\.(\\d+)\\.(\\d+)/i, function (match) {\n return translateLegacyCodecs([match])[0];\n });\n};\n/**\n * @typedef {Object} ParsedCodecInfo\n * @property {number} codecCount\n * Number of codecs parsed\n * @property {string} [videoCodec]\n * Parsed video codec (if found)\n * @property {string} [videoObjectTypeIndicator]\n * Video object type indicator (if found)\n * @property {string|null} audioProfile\n * Audio profile\n */\n\n/**\n * Parses a codec string to retrieve the number of codecs specified, the video codec and\n * object type indicator, and the audio profile.\n *\n * @param {string} [codecString]\n * The codec string to parse\n * @return {ParsedCodecInfo}\n * Parsed codec info\n */\n\nvar parseCodecs = function parseCodecs(codecString) {\n if (codecString === void 0) {\n codecString = '';\n }\n\n var codecs = codecString.split(',');\n var result = [];\n codecs.forEach(function (codec) {\n codec = codec.trim();\n var codecType;\n mediaTypes.forEach(function (name) {\n var match = regexs[name].exec(codec.toLowerCase());\n\n if (!match || match.length <= 1) {\n return;\n }\n\n codecType = name; // maintain codec case\n\n var type = codec.substring(0, match[1].length);\n var details = codec.replace(type, '');\n result.push({\n type: type,\n details: details,\n mediaType: name\n });\n });\n\n if (!codecType) {\n result.push({\n type: codec,\n details: '',\n mediaType: 'unknown'\n });\n }\n });\n return result;\n};\n/**\n * Returns a ParsedCodecInfo object for the default alternate audio playlist if there is\n * a default alternate audio playlist for the provided audio group.\n *\n * @param {Object} master\n * The master playlist\n * @param {string} audioGroupId\n * ID of the audio group for which to find the default codec info\n * @return {ParsedCodecInfo}\n * Parsed codec info\n */\n\nvar codecsFromDefault = function codecsFromDefault(master, audioGroupId) {\n if (!master.mediaGroups.AUDIO || !audioGroupId) {\n return null;\n }\n\n var audioGroup = master.mediaGroups.AUDIO[audioGroupId];\n\n if (!audioGroup) {\n return null;\n }\n\n for (var name in audioGroup) {\n var audioType = audioGroup[name];\n\n if (audioType.default && audioType.playlists) {\n // codec should be the same for all playlists within the audio type\n return parseCodecs(audioType.playlists[0].attributes.CODECS);\n }\n }\n\n return null;\n};\nvar isVideoCodec = function isVideoCodec(codec) {\n if (codec === void 0) {\n codec = '';\n }\n\n return regexs.video.test(codec.trim().toLowerCase());\n};\nvar isAudioCodec = function isAudioCodec(codec) {\n if (codec === void 0) {\n codec = '';\n }\n\n return regexs.audio.test(codec.trim().toLowerCase());\n};\nvar isTextCodec = function isTextCodec(codec) {\n if (codec === void 0) {\n codec = '';\n }\n\n return regexs.text.test(codec.trim().toLowerCase());\n};\nvar getMimeForCodec = function getMimeForCodec(codecString) {\n if (!codecString || typeof codecString !== 'string') {\n return;\n }\n\n var codecs = codecString.toLowerCase().split(',').map(function (c) {\n return translateLegacyCodec(c.trim());\n }); // default to video type\n\n var type = 'video'; // only change to audio type if the only codec we have is\n // audio\n\n if (codecs.length === 1 && isAudioCodec(codecs[0])) {\n type = 'audio';\n } else if (codecs.length === 1 && isTextCodec(codecs[0])) {\n // text uses application/<container> for now\n type = 'application';\n } // default the container to mp4\n\n\n var container = 'mp4'; // every codec must be able to go into the container\n // for that container to be the correct one\n\n if (codecs.every(function (c) {\n return regexs.mp4.test(c);\n })) {\n container = 'mp4';\n } else if (codecs.every(function (c) {\n return regexs.webm.test(c);\n })) {\n container = 'webm';\n } else if (codecs.every(function (c) {\n return regexs.ogg.test(c);\n })) {\n container = 'ogg';\n }\n\n return type + \"/\" + container + \";codecs=\\\"\" + codecString + \"\\\"\";\n};\nvar browserSupportsCodec = function browserSupportsCodec(codecString) {\n if (codecString === void 0) {\n codecString = '';\n }\n\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource).isTypeSupported && global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource.isTypeSupported(getMimeForCodec(codecString)) || false;\n};\nvar muxerSupportsCodec = function muxerSupportsCodec(codecString) {\n if (codecString === void 0) {\n codecString = '';\n }\n\n return codecString.toLowerCase().split(',').every(function (codec) {\n codec = codec.trim(); // any match is supported.\n\n for (var i = 0; i < upperMediaTypes.length; i++) {\n var type = upperMediaTypes[i];\n\n if (regexs[\"muxer\" + type].test(codec)) {\n return true;\n }\n }\n\n return false;\n });\n};\nvar DEFAULT_AUDIO_CODEC = 'mp4a.40.2';\nvar DEFAULT_VIDEO_CODEC = 'avc1.4d400d';\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/codecs.js?")},"./node_modules/@videojs/vhs-utils/es/containers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ detectContainerForBytes: () => (/* binding */ detectContainerForBytes),\n/* harmony export */ isLikely: () => (/* binding */ isLikely),\n/* harmony export */ isLikelyFmp4MediaSegment: () => (/* binding */ isLikelyFmp4MediaSegment)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers.js */ \"./node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n/* harmony import */ var _mp4_helpers_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mp4-helpers.js */ \"./node_modules/@videojs/vhs-utils/es/mp4-helpers.js\");\n/* harmony import */ var _ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ebml-helpers.js */ \"./node_modules/@videojs/vhs-utils/es/ebml-helpers.js\");\n/* harmony import */ var _id3_helpers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./id3-helpers.js */ \"./node_modules/@videojs/vhs-utils/es/id3-helpers.js\");\n/* harmony import */ var _nal_helpers_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nal-helpers.js */ \"./node_modules/@videojs/vhs-utils/es/nal-helpers.js\");\n\n\n\n\n\nvar CONSTANTS = {\n // \"webm\" string literal in hex\n 'webm': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x77, 0x65, 0x62, 0x6d]),\n // \"matroska\" string literal in hex\n 'matroska': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61]),\n // \"fLaC\" string literal in hex\n 'flac': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x66, 0x4c, 0x61, 0x43]),\n // \"OggS\" string literal in hex\n 'ogg': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x4f, 0x67, 0x67, 0x53]),\n // ac-3 sync byte, also works for ec-3 as that is simply a codec\n // of ac-3\n 'ac3': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x0b, 0x77]),\n // \"RIFF\" string literal in hex used for wav and avi\n 'riff': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x52, 0x49, 0x46, 0x46]),\n // \"AVI\" string literal in hex\n 'avi': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x41, 0x56, 0x49]),\n // \"WAVE\" string literal in hex\n 'wav': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x57, 0x41, 0x56, 0x45]),\n // \"ftyp3g\" string literal in hex\n '3gp': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x66, 0x74, 0x79, 0x70, 0x33, 0x67]),\n // \"ftyp\" string literal in hex\n 'mp4': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x66, 0x74, 0x79, 0x70]),\n // \"styp\" string literal in hex\n 'fmp4': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x73, 0x74, 0x79, 0x70]),\n // \"ftypqt\" string literal in hex\n 'mov': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x66, 0x74, 0x79, 0x70, 0x71, 0x74]),\n // moov string literal in hex\n 'moov': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x6D, 0x6F, 0x6F, 0x76]),\n // moof string literal in hex\n 'moof': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x6D, 0x6F, 0x6F, 0x66])\n};\nvar _isLikely = {\n aac: function aac(bytes) {\n var offset = (0,_id3_helpers_js__WEBPACK_IMPORTED_MODULE_3__.getId3Offset)(bytes);\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, [0xFF, 0x10], {\n offset: offset,\n mask: [0xFF, 0x16]\n });\n },\n mp3: function mp3(bytes) {\n var offset = (0,_id3_helpers_js__WEBPACK_IMPORTED_MODULE_3__.getId3Offset)(bytes);\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, [0xFF, 0x02], {\n offset: offset,\n mask: [0xFF, 0x06]\n });\n },\n webm: function webm(bytes) {\n var docType = (0,_ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.findEbml)(bytes, [_ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.EBML_TAGS.EBML, _ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.EBML_TAGS.DocType])[0]; // check if DocType EBML tag is webm\n\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(docType, CONSTANTS.webm);\n },\n mkv: function mkv(bytes) {\n var docType = (0,_ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.findEbml)(bytes, [_ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.EBML_TAGS.EBML, _ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.EBML_TAGS.DocType])[0]; // check if DocType EBML tag is matroska\n\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(docType, CONSTANTS.matroska);\n },\n mp4: function mp4(bytes) {\n // if this file is another base media file format, it is not mp4\n if (_isLikely['3gp'](bytes) || _isLikely.mov(bytes)) {\n return false;\n } // if this file starts with a ftyp or styp box its mp4\n\n\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.mp4, {\n offset: 4\n }) || (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.fmp4, {\n offset: 4\n })) {\n return true;\n } // if this file starts with a moof/moov box its mp4\n\n\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.moof, {\n offset: 4\n }) || (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.moov, {\n offset: 4\n })) {\n return true;\n }\n },\n mov: function mov(bytes) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.mov, {\n offset: 4\n });\n },\n '3gp': function gp(bytes) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS['3gp'], {\n offset: 4\n });\n },\n ac3: function ac3(bytes) {\n var offset = (0,_id3_helpers_js__WEBPACK_IMPORTED_MODULE_3__.getId3Offset)(bytes);\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.ac3, {\n offset: offset\n });\n },\n ts: function ts(bytes) {\n if (bytes.length < 189 && bytes.length >= 1) {\n return bytes[0] === 0x47;\n }\n\n var i = 0; // check the first 376 bytes for two matching sync bytes\n\n while (i + 188 < bytes.length && i < 188) {\n if (bytes[i] === 0x47 && bytes[i + 188] === 0x47) {\n return true;\n }\n\n i += 1;\n }\n\n return false;\n },\n flac: function flac(bytes) {\n var offset = (0,_id3_helpers_js__WEBPACK_IMPORTED_MODULE_3__.getId3Offset)(bytes);\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.flac, {\n offset: offset\n });\n },\n ogg: function ogg(bytes) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.ogg);\n },\n avi: function avi(bytes) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.riff) && (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.avi, {\n offset: 8\n });\n },\n wav: function wav(bytes) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.riff) && (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.wav, {\n offset: 8\n });\n },\n 'h264': function h264(bytes) {\n // find seq_parameter_set_rbsp\n return (0,_nal_helpers_js__WEBPACK_IMPORTED_MODULE_4__.findH264Nal)(bytes, 7, 3).length;\n },\n 'h265': function h265(bytes) {\n // find video_parameter_set_rbsp or seq_parameter_set_rbsp\n return (0,_nal_helpers_js__WEBPACK_IMPORTED_MODULE_4__.findH265Nal)(bytes, [32, 33], 3).length;\n }\n}; // get all the isLikely functions\n// but make sure 'ts' is above h264 and h265\n// but below everything else as it is the least specific\n\nvar isLikelyTypes = Object.keys(_isLikely) // remove ts, h264, h265\n.filter(function (t) {\n return t !== 'ts' && t !== 'h264' && t !== 'h265';\n}) // add it back to the bottom\n.concat(['ts', 'h264', 'h265']); // make sure we are dealing with uint8 data.\n\nisLikelyTypes.forEach(function (type) {\n var isLikelyFn = _isLikely[type];\n\n _isLikely[type] = function (bytes) {\n return isLikelyFn((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes));\n };\n}); // export after wrapping\n\nvar isLikely = _isLikely; // A useful list of file signatures can be found here\n// https://en.wikipedia.org/wiki/List_of_file_signatures\n\nvar detectContainerForBytes = function detectContainerForBytes(bytes) {\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n\n for (var i = 0; i < isLikelyTypes.length; i++) {\n var type = isLikelyTypes[i];\n\n if (isLikely[type](bytes)) {\n return type;\n }\n }\n\n return '';\n}; // fmp4 is not a container\n\nvar isLikelyFmp4MediaSegment = function isLikelyFmp4MediaSegment(bytes) {\n return (0,_mp4_helpers_js__WEBPACK_IMPORTED_MODULE_1__.findBox)(bytes, ['moof']).length > 0;\n};\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/containers.js?")},"./node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ decodeB64ToUint8Array)\n/* harmony export */ });\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__);\n\n\nvar atob = function atob(s) {\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default().atob) ? global_window__WEBPACK_IMPORTED_MODULE_0___default().atob(s) : Buffer.from(s, 'base64').toString('binary');\n};\n\nfunction decodeB64ToUint8Array(b64Text) {\n var decodedString = atob(b64Text);\n var array = new Uint8Array(decodedString.length);\n\n for (var i = 0; i < decodedString.length; i++) {\n array[i] = decodedString.charCodeAt(i);\n }\n\n return array;\n}\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js?")},"./node_modules/@videojs/vhs-utils/es/ebml-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EBML_TAGS: () => (/* binding */ EBML_TAGS),\n/* harmony export */ decodeBlock: () => (/* binding */ decodeBlock),\n/* harmony export */ findEbml: () => (/* binding */ findEbml),\n/* harmony export */ parseData: () => (/* binding */ parseData),\n/* harmony export */ parseTracks: () => (/* binding */ parseTracks)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers */ \"./node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n/* harmony import */ var _codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./codec-helpers.js */ \"./node_modules/@videojs/vhs-utils/es/codec-helpers.js\");\n\n // relevant specs for this parser:\n// https://matroska-org.github.io/libebml/specs.html\n// https://www.matroska.org/technical/elements.html\n// https://www.webmproject.org/docs/container/\n\nvar EBML_TAGS = {\n EBML: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x1A, 0x45, 0xDF, 0xA3]),\n DocType: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x42, 0x82]),\n Segment: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x18, 0x53, 0x80, 0x67]),\n SegmentInfo: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x15, 0x49, 0xA9, 0x66]),\n Tracks: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x16, 0x54, 0xAE, 0x6B]),\n Track: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xAE]),\n TrackNumber: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xd7]),\n DefaultDuration: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x23, 0xe3, 0x83]),\n TrackEntry: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xAE]),\n TrackType: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x83]),\n FlagDefault: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x88]),\n CodecID: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x86]),\n CodecPrivate: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x63, 0xA2]),\n VideoTrack: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xe0]),\n AudioTrack: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xe1]),\n // Not used yet, but will be used for live webm/mkv\n // see https://www.matroska.org/technical/basics.html#block-structure\n // see https://www.matroska.org/technical/basics.html#simpleblock-structure\n Cluster: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x1F, 0x43, 0xB6, 0x75]),\n Timestamp: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xE7]),\n TimestampScale: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x2A, 0xD7, 0xB1]),\n BlockGroup: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xA0]),\n BlockDuration: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x9B]),\n Block: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xA1]),\n SimpleBlock: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xA3])\n};\n/**\n * This is a simple table to determine the length\n * of things in ebml. The length is one based (starts at 1,\n * rather than zero) and for every zero bit before a one bit\n * we add one to length. We also need this table because in some\n * case we have to xor all the length bits from another value.\n */\n\nvar LENGTH_TABLE = [128, 64, 32, 16, 8, 4, 2, 1];\n\nvar getLength = function getLength(byte) {\n var len = 1;\n\n for (var i = 0; i < LENGTH_TABLE.length; i++) {\n if (byte & LENGTH_TABLE[i]) {\n break;\n }\n\n len++;\n }\n\n return len;\n}; // length in ebml is stored in the first 4 to 8 bits\n// of the first byte. 4 for the id length and 8 for the\n// data size length. Length is measured by converting the number to binary\n// then 1 + the number of zeros before a 1 is encountered starting\n// from the left.\n\n\nvar getvint = function getvint(bytes, offset, removeLength, signed) {\n if (removeLength === void 0) {\n removeLength = true;\n }\n\n if (signed === void 0) {\n signed = false;\n }\n\n var length = getLength(bytes[offset]);\n var valueBytes = bytes.subarray(offset, offset + length); // NOTE that we do **not** subarray here because we need to copy these bytes\n // as they will be modified below to remove the dataSizeLen bits and we do not\n // want to modify the original data. normally we could just call slice on\n // uint8array but ie 11 does not support that...\n\n if (removeLength) {\n valueBytes = Array.prototype.slice.call(bytes, offset, offset + length);\n valueBytes[0] ^= LENGTH_TABLE[length - 1];\n }\n\n return {\n length: length,\n value: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(valueBytes, {\n signed: signed\n }),\n bytes: valueBytes\n };\n};\n\nvar normalizePath = function normalizePath(path) {\n if (typeof path === 'string') {\n return path.match(/.{1,2}/g).map(function (p) {\n return normalizePath(p);\n });\n }\n\n if (typeof path === 'number') {\n return (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.numberToBytes)(path);\n }\n\n return path;\n};\n\nvar normalizePaths = function normalizePaths(paths) {\n if (!Array.isArray(paths)) {\n return [normalizePath(paths)];\n }\n\n return paths.map(function (p) {\n return normalizePath(p);\n });\n};\n\nvar getInfinityDataSize = function getInfinityDataSize(id, bytes, offset) {\n if (offset >= bytes.length) {\n return bytes.length;\n }\n\n var innerid = getvint(bytes, offset, false);\n\n if ((0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(id.bytes, innerid.bytes)) {\n return offset;\n }\n\n var dataHeader = getvint(bytes, offset + innerid.length);\n return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length);\n};\n/**\n * Notes on the EBLM format.\n *\n * EBLM uses \"vints\" tags. Every vint tag contains\n * two parts\n *\n * 1. The length from the first byte. You get this by\n * converting the byte to binary and counting the zeros\n * before a 1. Then you add 1 to that. Examples\n * 00011111 = length 4 because there are 3 zeros before a 1.\n * 00100000 = length 3 because there are 2 zeros before a 1.\n * 00000011 = length 7 because there are 6 zeros before a 1.\n *\n * 2. The bits used for length are removed from the first byte\n * Then all the bytes are merged into a value. NOTE: this\n * is not the case for id ebml tags as there id includes\n * length bits.\n *\n */\n\n\nvar findEbml = function findEbml(bytes, paths) {\n paths = normalizePaths(paths);\n bytes = (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var results = [];\n\n if (!paths.length) {\n return results;\n }\n\n var i = 0;\n\n while (i < bytes.length) {\n var id = getvint(bytes, i, false);\n var dataHeader = getvint(bytes, i + id.length);\n var dataStart = i + id.length + dataHeader.length; // dataSize is unknown or this is a live stream\n\n if (dataHeader.value === 0x7f) {\n dataHeader.value = getInfinityDataSize(id, bytes, dataStart);\n\n if (dataHeader.value !== bytes.length) {\n dataHeader.value -= dataStart;\n }\n }\n\n var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value;\n var data = bytes.subarray(dataStart, dataEnd);\n\n if ((0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(paths[0], id.bytes)) {\n if (paths.length === 1) {\n // this is the end of the paths and we've found the tag we were\n // looking for\n results.push(data);\n } else {\n // recursively search for the next tag inside of the data\n // of this one\n results = results.concat(findEbml(data, paths.slice(1)));\n }\n }\n\n var totalLength = id.length + dataHeader.length + data.length; // move past this tag entirely, we are not looking for it\n\n i += totalLength;\n }\n\n return results;\n}; // see https://www.matroska.org/technical/basics.html#block-structure\n\nvar decodeBlock = function decodeBlock(block, type, timestampScale, clusterTimestamp) {\n var duration;\n\n if (type === 'group') {\n duration = findEbml(block, [EBML_TAGS.BlockDuration])[0];\n\n if (duration) {\n duration = (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(duration);\n duration = 1 / timestampScale * duration * timestampScale / 1000;\n }\n\n block = findEbml(block, [EBML_TAGS.Block])[0];\n type = 'block'; // treat data as a block after this point\n }\n\n var dv = new DataView(block.buffer, block.byteOffset, block.byteLength);\n var trackNumber = getvint(block, 0);\n var timestamp = dv.getInt16(trackNumber.length, false);\n var flags = block[trackNumber.length + 2];\n var data = block.subarray(trackNumber.length + 3); // pts/dts in seconds\n\n var ptsdts = 1 / timestampScale * (clusterTimestamp + timestamp) * timestampScale / 1000; // return the frame\n\n var parsed = {\n duration: duration,\n trackNumber: trackNumber.value,\n keyframe: type === 'simple' && flags >> 7 === 1,\n invisible: (flags & 0x08) >> 3 === 1,\n lacing: (flags & 0x06) >> 1,\n discardable: type === 'simple' && (flags & 0x01) === 1,\n frames: [],\n pts: ptsdts,\n dts: ptsdts,\n timestamp: timestamp\n };\n\n if (!parsed.lacing) {\n parsed.frames.push(data);\n return parsed;\n }\n\n var numberOfFrames = data[0] + 1;\n var frameSizes = [];\n var offset = 1; // Fixed\n\n if (parsed.lacing === 2) {\n var sizeOfFrame = (data.length - offset) / numberOfFrames;\n\n for (var i = 0; i < numberOfFrames; i++) {\n frameSizes.push(sizeOfFrame);\n }\n } // xiph\n\n\n if (parsed.lacing === 1) {\n for (var _i = 0; _i < numberOfFrames - 1; _i++) {\n var size = 0;\n\n do {\n size += data[offset];\n offset++;\n } while (data[offset - 1] === 0xFF);\n\n frameSizes.push(size);\n }\n } // ebml\n\n\n if (parsed.lacing === 3) {\n // first vint is unsinged\n // after that vints are singed and\n // based on a compounding size\n var _size = 0;\n\n for (var _i2 = 0; _i2 < numberOfFrames - 1; _i2++) {\n var vint = _i2 === 0 ? getvint(data, offset) : getvint(data, offset, true, true);\n _size += vint.value;\n frameSizes.push(_size);\n offset += vint.length;\n }\n }\n\n frameSizes.forEach(function (size) {\n parsed.frames.push(data.subarray(offset, offset + size));\n offset += size;\n });\n return parsed;\n}; // VP9 Codec Feature Metadata (CodecPrivate)\n// https://www.webmproject.org/docs/container/\n\nvar parseVp9Private = function parseVp9Private(bytes) {\n var i = 0;\n var params = {};\n\n while (i < bytes.length) {\n var id = bytes[i] & 0x7f;\n var len = bytes[i + 1];\n var val = void 0;\n\n if (len === 1) {\n val = bytes[i + 2];\n } else {\n val = bytes.subarray(i + 2, i + 2 + len);\n }\n\n if (id === 1) {\n params.profile = val;\n } else if (id === 2) {\n params.level = val;\n } else if (id === 3) {\n params.bitDepth = val;\n } else if (id === 4) {\n params.chromaSubsampling = val;\n } else {\n params[id] = val;\n }\n\n i += 2 + len;\n }\n\n return params;\n};\n\nvar parseTracks = function parseTracks(bytes) {\n bytes = (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var decodedTracks = [];\n var tracks = findEbml(bytes, [EBML_TAGS.Segment, EBML_TAGS.Tracks, EBML_TAGS.Track]);\n\n if (!tracks.length) {\n tracks = findEbml(bytes, [EBML_TAGS.Tracks, EBML_TAGS.Track]);\n }\n\n if (!tracks.length) {\n tracks = findEbml(bytes, [EBML_TAGS.Track]);\n }\n\n if (!tracks.length) {\n return decodedTracks;\n }\n\n tracks.forEach(function (track) {\n var trackType = findEbml(track, EBML_TAGS.TrackType)[0];\n\n if (!trackType || !trackType.length) {\n return;\n } // 1 is video, 2 is audio, 17 is subtitle\n // other values are unimportant in this context\n\n\n if (trackType[0] === 1) {\n trackType = 'video';\n } else if (trackType[0] === 2) {\n trackType = 'audio';\n } else if (trackType[0] === 17) {\n trackType = 'subtitle';\n } else {\n return;\n } // todo parse language\n\n\n var decodedTrack = {\n rawCodec: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToString)(findEbml(track, [EBML_TAGS.CodecID])[0]),\n type: trackType,\n codecPrivate: findEbml(track, [EBML_TAGS.CodecPrivate])[0],\n number: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(findEbml(track, [EBML_TAGS.TrackNumber])[0]),\n defaultDuration: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(findEbml(track, [EBML_TAGS.DefaultDuration])[0]),\n default: findEbml(track, [EBML_TAGS.FlagDefault])[0],\n rawData: track\n };\n var codec = '';\n\n if (/V_MPEG4\\/ISO\\/AVC/.test(decodedTrack.rawCodec)) {\n codec = \"avc1.\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getAvcCodec)(decodedTrack.codecPrivate);\n } else if (/V_MPEGH\\/ISO\\/HEVC/.test(decodedTrack.rawCodec)) {\n codec = \"hev1.\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getHvcCodec)(decodedTrack.codecPrivate);\n } else if (/V_MPEG4\\/ISO\\/ASP/.test(decodedTrack.rawCodec)) {\n if (decodedTrack.codecPrivate) {\n codec = 'mp4v.20.' + decodedTrack.codecPrivate[4].toString();\n } else {\n codec = 'mp4v.20.9';\n }\n } else if (/^V_THEORA/.test(decodedTrack.rawCodec)) {\n codec = 'theora';\n } else if (/^V_VP8/.test(decodedTrack.rawCodec)) {\n codec = 'vp8';\n } else if (/^V_VP9/.test(decodedTrack.rawCodec)) {\n if (decodedTrack.codecPrivate) {\n var _parseVp9Private = parseVp9Private(decodedTrack.codecPrivate),\n profile = _parseVp9Private.profile,\n level = _parseVp9Private.level,\n bitDepth = _parseVp9Private.bitDepth,\n chromaSubsampling = _parseVp9Private.chromaSubsampling;\n\n codec = 'vp09.';\n codec += (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(profile, 2, '0') + \".\";\n codec += (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(level, 2, '0') + \".\";\n codec += (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(bitDepth, 2, '0') + \".\";\n codec += \"\" + (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(chromaSubsampling, 2, '0'); // Video -> Colour -> Ebml name\n\n var matrixCoefficients = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xB1]])[0] || [];\n var videoFullRangeFlag = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xB9]])[0] || [];\n var transferCharacteristics = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xBA]])[0] || [];\n var colourPrimaries = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xBB]])[0] || []; // if we find any optional codec parameter specify them all.\n\n if (matrixCoefficients.length || videoFullRangeFlag.length || transferCharacteristics.length || colourPrimaries.length) {\n codec += \".\" + (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(colourPrimaries[0], 2, '0');\n codec += \".\" + (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(transferCharacteristics[0], 2, '0');\n codec += \".\" + (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(matrixCoefficients[0], 2, '0');\n codec += \".\" + (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(videoFullRangeFlag[0], 2, '0');\n }\n } else {\n codec = 'vp9';\n }\n } else if (/^V_AV1/.test(decodedTrack.rawCodec)) {\n codec = \"av01.\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getAv1Codec)(decodedTrack.codecPrivate);\n } else if (/A_ALAC/.test(decodedTrack.rawCodec)) {\n codec = 'alac';\n } else if (/A_MPEG\\/L2/.test(decodedTrack.rawCodec)) {\n codec = 'mp2';\n } else if (/A_MPEG\\/L3/.test(decodedTrack.rawCodec)) {\n codec = 'mp3';\n } else if (/^A_AAC/.test(decodedTrack.rawCodec)) {\n if (decodedTrack.codecPrivate) {\n codec = 'mp4a.40.' + (decodedTrack.codecPrivate[0] >>> 3).toString();\n } else {\n codec = 'mp4a.40.2';\n }\n } else if (/^A_AC3/.test(decodedTrack.rawCodec)) {\n codec = 'ac-3';\n } else if (/^A_PCM/.test(decodedTrack.rawCodec)) {\n codec = 'pcm';\n } else if (/^A_MS\\/ACM/.test(decodedTrack.rawCodec)) {\n codec = 'speex';\n } else if (/^A_EAC3/.test(decodedTrack.rawCodec)) {\n codec = 'ec-3';\n } else if (/^A_VORBIS/.test(decodedTrack.rawCodec)) {\n codec = 'vorbis';\n } else if (/^A_FLAC/.test(decodedTrack.rawCodec)) {\n codec = 'flac';\n } else if (/^A_OPUS/.test(decodedTrack.rawCodec)) {\n codec = 'opus';\n }\n\n decodedTrack.codec = codec;\n decodedTracks.push(decodedTrack);\n });\n return decodedTracks.sort(function (a, b) {\n return a.number - b.number;\n });\n};\nvar parseData = function parseData(data, tracks) {\n var allBlocks = [];\n var segment = findEbml(data, [EBML_TAGS.Segment])[0];\n var timestampScale = findEbml(segment, [EBML_TAGS.SegmentInfo, EBML_TAGS.TimestampScale])[0]; // in nanoseconds, defaults to 1ms\n\n if (timestampScale && timestampScale.length) {\n timestampScale = (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(timestampScale);\n } else {\n timestampScale = 1000000;\n }\n\n var clusters = findEbml(segment, [EBML_TAGS.Cluster]);\n\n if (!tracks) {\n tracks = parseTracks(segment);\n }\n\n clusters.forEach(function (cluster, ci) {\n var simpleBlocks = findEbml(cluster, [EBML_TAGS.SimpleBlock]).map(function (b) {\n return {\n type: 'simple',\n data: b\n };\n });\n var blockGroups = findEbml(cluster, [EBML_TAGS.BlockGroup]).map(function (b) {\n return {\n type: 'group',\n data: b\n };\n });\n var timestamp = findEbml(cluster, [EBML_TAGS.Timestamp])[0] || 0;\n\n if (timestamp && timestamp.length) {\n timestamp = (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(timestamp);\n } // get all blocks then sort them into the correct order\n\n\n var blocks = simpleBlocks.concat(blockGroups).sort(function (a, b) {\n return a.data.byteOffset - b.data.byteOffset;\n });\n blocks.forEach(function (block, bi) {\n var decoded = decodeBlock(block.data, block.type, timestampScale, timestamp);\n allBlocks.push(decoded);\n });\n });\n return {\n tracks: tracks,\n blocks: allBlocks\n };\n};\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/ebml-helpers.js?")},"./node_modules/@videojs/vhs-utils/es/id3-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getId3Offset: () => (/* binding */ getId3Offset),\n/* harmony export */ getId3Size: () => (/* binding */ getId3Size)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers.js */ "./node_modules/@videojs/vhs-utils/es/byte-helpers.js");\n\nvar ID3 = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x49, 0x44, 0x33]);\nvar getId3Size = function getId3Size(bytes, offset) {\n if (offset === void 0) {\n offset = 0;\n }\n\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var flags = bytes[offset + 5];\n var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9];\n var footerPresent = (flags & 16) >> 4;\n\n if (footerPresent) {\n return returnSize + 20;\n }\n\n return returnSize + 10;\n};\nvar getId3Offset = function getId3Offset(bytes, offset) {\n if (offset === void 0) {\n offset = 0;\n }\n\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n\n if (bytes.length - offset < 10 || !(0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, ID3, {\n offset: offset\n })) {\n return offset;\n }\n\n offset += getId3Size(bytes, offset); // recursive check for id3 tags as some files\n // have multiple ID3 tag sections even though\n // they should not.\n\n return getId3Offset(bytes, offset);\n};\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/id3-helpers.js?')},"./node_modules/@videojs/vhs-utils/es/media-groups.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ forEachMediaGroup: () => (/* binding */ forEachMediaGroup)\n/* harmony export */ });\n/**\n * Loops through all supported media groups in master and calls the provided\n * callback for each group\n *\n * @param {Object} master\n * The parsed master manifest object\n * @param {string[]} groups\n * The media groups to call the callback for\n * @param {Function} callback\n * Callback to call for each media group\n */\nvar forEachMediaGroup = function forEachMediaGroup(master, groups, callback) {\n groups.forEach(function (mediaType) {\n for (var groupKey in master.mediaGroups[mediaType]) {\n for (var labelKey in master.mediaGroups[mediaType][groupKey]) {\n var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];\n callback(mediaProperties, mediaType, groupKey, labelKey);\n }\n }\n });\n};\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/media-groups.js?")},"./node_modules/@videojs/vhs-utils/es/media-types.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ simpleTypeFromSourceType: () => (/* binding */ simpleTypeFromSourceType)\n/* harmony export */ });\nvar MPEGURL_REGEX = /^(audio|video|application)\\/(x-|vnd\\.apple\\.)?mpegurl/i;\nvar DASH_REGEX = /^application\\/dash\\+xml/i;\n/**\n * Returns a string that describes the type of source based on a video source object's\n * media type.\n *\n * @see {@link https://dev.w3.org/html5/pf-summary/video.html#dom-source-type|Source Type}\n *\n * @param {string} type\n * Video source object media type\n * @return {('hls'|'dash'|'vhs-json'|null)}\n * VHS source type string\n */\n\nvar simpleTypeFromSourceType = function simpleTypeFromSourceType(type) {\n if (MPEGURL_REGEX.test(type)) {\n return 'hls';\n }\n\n if (DASH_REGEX.test(type)) {\n return 'dash';\n } // Denotes the special case of a manifest object passed to http-streaming instead of a\n // source URL.\n //\n // See https://en.wikipedia.org/wiki/Media_type for details on specifying media types.\n //\n // In this case, vnd stands for vendor, video.js for the organization, VHS for this\n // project, and the +json suffix identifies the structure of the media type.\n\n\n if (type === 'application/vnd.videojs.vhs+json') {\n return 'vhs-json';\n }\n\n return null;\n};\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/media-types.js?")},"./node_modules/@videojs/vhs-utils/es/mp4-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addSampleDescription: () => (/* binding */ addSampleDescription),\n/* harmony export */ buildFrameTable: () => (/* binding */ buildFrameTable),\n/* harmony export */ findBox: () => (/* binding */ findBox),\n/* harmony export */ findNamedBox: () => (/* binding */ findNamedBox),\n/* harmony export */ parseDescriptors: () => (/* binding */ parseDescriptors),\n/* harmony export */ parseMediaInfo: () => (/* binding */ parseMediaInfo),\n/* harmony export */ parseTracks: () => (/* binding */ parseTracks)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers.js */ \"./node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n/* harmony import */ var _codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./codec-helpers.js */ \"./node_modules/@videojs/vhs-utils/es/codec-helpers.js\");\n/* harmony import */ var _opus_helpers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./opus-helpers.js */ \"./node_modules/@videojs/vhs-utils/es/opus-helpers.js\");\n\n\n\n\nvar normalizePath = function normalizePath(path) {\n if (typeof path === 'string') {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.stringToBytes)(path);\n }\n\n if (typeof path === 'number') {\n return path;\n }\n\n return path;\n};\n\nvar normalizePaths = function normalizePaths(paths) {\n if (!Array.isArray(paths)) {\n return [normalizePath(paths)];\n }\n\n return paths.map(function (p) {\n return normalizePath(p);\n });\n};\n\nvar DESCRIPTORS;\nvar parseDescriptors = function parseDescriptors(bytes) {\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var results = [];\n var i = 0;\n\n while (bytes.length > i) {\n var tag = bytes[i];\n var size = 0;\n var headerSize = 0; // tag\n\n headerSize++;\n var byte = bytes[headerSize]; // first byte\n\n headerSize++;\n\n while (byte & 0x80) {\n size = (byte & 0x7F) << 7;\n byte = bytes[headerSize];\n headerSize++;\n }\n\n size += byte & 0x7F;\n\n for (var z = 0; z < DESCRIPTORS.length; z++) {\n var _DESCRIPTORS$z = DESCRIPTORS[z],\n id = _DESCRIPTORS$z.id,\n parser = _DESCRIPTORS$z.parser;\n\n if (tag === id) {\n results.push(parser(bytes.subarray(headerSize, headerSize + size)));\n break;\n }\n }\n\n i += size + headerSize;\n }\n\n return results;\n};\nDESCRIPTORS = [{\n id: 0x03,\n parser: function parser(bytes) {\n var desc = {\n tag: 0x03,\n id: bytes[0] << 8 | bytes[1],\n flags: bytes[2],\n size: 3,\n dependsOnEsId: 0,\n ocrEsId: 0,\n descriptors: [],\n url: ''\n }; // depends on es id\n\n if (desc.flags & 0x80) {\n desc.dependsOnEsId = bytes[desc.size] << 8 | bytes[desc.size + 1];\n desc.size += 2;\n } // url\n\n\n if (desc.flags & 0x40) {\n var len = bytes[desc.size];\n desc.url = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToString)(bytes.subarray(desc.size + 1, desc.size + 1 + len));\n desc.size += len;\n } // ocr es id\n\n\n if (desc.flags & 0x20) {\n desc.ocrEsId = bytes[desc.size] << 8 | bytes[desc.size + 1];\n desc.size += 2;\n }\n\n desc.descriptors = parseDescriptors(bytes.subarray(desc.size)) || [];\n return desc;\n }\n}, {\n id: 0x04,\n parser: function parser(bytes) {\n // DecoderConfigDescriptor\n var desc = {\n tag: 0x04,\n oti: bytes[0],\n streamType: bytes[1],\n bufferSize: bytes[2] << 16 | bytes[3] << 8 | bytes[4],\n maxBitrate: bytes[5] << 24 | bytes[6] << 16 | bytes[7] << 8 | bytes[8],\n avgBitrate: bytes[9] << 24 | bytes[10] << 16 | bytes[11] << 8 | bytes[12],\n descriptors: parseDescriptors(bytes.subarray(13))\n };\n return desc;\n }\n}, {\n id: 0x05,\n parser: function parser(bytes) {\n // DecoderSpecificInfo\n return {\n tag: 0x05,\n bytes: bytes\n };\n }\n}, {\n id: 0x06,\n parser: function parser(bytes) {\n // SLConfigDescriptor\n return {\n tag: 0x06,\n bytes: bytes\n };\n }\n}];\n/**\n * find any number of boxes by name given a path to it in an iso bmff\n * such as mp4.\n *\n * @param {TypedArray} bytes\n * bytes for the iso bmff to search for boxes in\n *\n * @param {Uint8Array[]|string[]|string|Uint8Array} name\n * An array of paths or a single path representing the name\n * of boxes to search through in bytes. Paths may be\n * uint8 (character codes) or strings.\n *\n * @param {boolean} [complete=false]\n * Should we search only for complete boxes on the final path.\n * This is very useful when you do not want to get back partial boxes\n * in the case of streaming files.\n *\n * @return {Uint8Array[]}\n * An array of the end paths that we found.\n */\n\nvar findBox = function findBox(bytes, paths, complete) {\n if (complete === void 0) {\n complete = false;\n }\n\n paths = normalizePaths(paths);\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var results = [];\n\n if (!paths.length) {\n // short-circuit the search for empty paths\n return results;\n }\n\n var i = 0;\n\n while (i < bytes.length) {\n var size = (bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]) >>> 0;\n var type = bytes.subarray(i + 4, i + 8); // invalid box format.\n\n if (size === 0) {\n break;\n }\n\n var end = i + size;\n\n if (end > bytes.length) {\n // this box is bigger than the number of bytes we have\n // and complete is set, we cannot find any more boxes.\n if (complete) {\n break;\n }\n\n end = bytes.length;\n }\n\n var data = bytes.subarray(i + 8, end);\n\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(type, paths[0])) {\n if (paths.length === 1) {\n // this is the end of the path and we've found the box we were\n // looking for\n results.push(data);\n } else {\n // recursively search for the next box along the path\n results.push.apply(results, findBox(data, paths.slice(1), complete));\n }\n }\n\n i = end;\n } // we've finished searching all of bytes\n\n\n return results;\n};\n/**\n * Search for a single matching box by name in an iso bmff format like\n * mp4. This function is useful for finding codec boxes which\n * can be placed arbitrarily in sample descriptions depending\n * on the version of the file or file type.\n *\n * @param {TypedArray} bytes\n * bytes for the iso bmff to search for boxes in\n *\n * @param {string|Uint8Array} name\n * The name of the box to find.\n *\n * @return {Uint8Array[]}\n * a subarray of bytes representing the name boxed we found.\n */\n\nvar findNamedBox = function findNamedBox(bytes, name) {\n name = normalizePath(name);\n\n if (!name.length) {\n // short-circuit the search for empty paths\n return bytes.subarray(bytes.length);\n }\n\n var i = 0;\n\n while (i < bytes.length) {\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes.subarray(i, i + name.length), name)) {\n var size = (bytes[i - 4] << 24 | bytes[i - 3] << 16 | bytes[i - 2] << 8 | bytes[i - 1]) >>> 0;\n var end = size > 1 ? i + size : bytes.byteLength;\n return bytes.subarray(i + 4, end);\n }\n\n i++;\n } // we've finished searching all of bytes\n\n\n return bytes.subarray(bytes.length);\n};\n\nvar parseSamples = function parseSamples(data, entrySize, parseEntry) {\n if (entrySize === void 0) {\n entrySize = 4;\n }\n\n if (parseEntry === void 0) {\n parseEntry = function parseEntry(d) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(d);\n };\n }\n\n var entries = [];\n\n if (!data || !data.length) {\n return entries;\n }\n\n var entryCount = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(data.subarray(4, 8));\n\n for (var i = 8; entryCount; i += entrySize, entryCount--) {\n entries.push(parseEntry(data.subarray(i, i + entrySize)));\n }\n\n return entries;\n};\n\nvar buildFrameTable = function buildFrameTable(stbl, timescale) {\n var keySamples = parseSamples(findBox(stbl, ['stss'])[0]);\n var chunkOffsets = parseSamples(findBox(stbl, ['stco'])[0]);\n var timeToSamples = parseSamples(findBox(stbl, ['stts'])[0], 8, function (entry) {\n return {\n sampleCount: (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(entry.subarray(0, 4)),\n sampleDelta: (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(entry.subarray(4, 8))\n };\n });\n var samplesToChunks = parseSamples(findBox(stbl, ['stsc'])[0], 12, function (entry) {\n return {\n firstChunk: (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(entry.subarray(0, 4)),\n samplesPerChunk: (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(entry.subarray(4, 8)),\n sampleDescriptionIndex: (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(entry.subarray(8, 12))\n };\n });\n var stsz = findBox(stbl, ['stsz'])[0]; // stsz starts with a 4 byte sampleSize which we don't need\n\n var sampleSizes = parseSamples(stsz && stsz.length && stsz.subarray(4) || null);\n var frames = [];\n\n for (var chunkIndex = 0; chunkIndex < chunkOffsets.length; chunkIndex++) {\n var samplesInChunk = void 0;\n\n for (var i = 0; i < samplesToChunks.length; i++) {\n var sampleToChunk = samplesToChunks[i];\n var isThisOne = chunkIndex + 1 >= sampleToChunk.firstChunk && (i + 1 >= samplesToChunks.length || chunkIndex + 1 < samplesToChunks[i + 1].firstChunk);\n\n if (isThisOne) {\n samplesInChunk = sampleToChunk.samplesPerChunk;\n break;\n }\n }\n\n var chunkOffset = chunkOffsets[chunkIndex];\n\n for (var _i = 0; _i < samplesInChunk; _i++) {\n var frameEnd = sampleSizes[frames.length]; // if we don't have key samples every frame is a keyframe\n\n var keyframe = !keySamples.length;\n\n if (keySamples.length && keySamples.indexOf(frames.length + 1) !== -1) {\n keyframe = true;\n }\n\n var frame = {\n keyframe: keyframe,\n start: chunkOffset,\n end: chunkOffset + frameEnd\n };\n\n for (var k = 0; k < timeToSamples.length; k++) {\n var _timeToSamples$k = timeToSamples[k],\n sampleCount = _timeToSamples$k.sampleCount,\n sampleDelta = _timeToSamples$k.sampleDelta;\n\n if (frames.length <= sampleCount) {\n // ms to ns\n var lastTimestamp = frames.length ? frames[frames.length - 1].timestamp : 0;\n frame.timestamp = lastTimestamp + sampleDelta / timescale * 1000;\n frame.duration = sampleDelta;\n break;\n }\n }\n\n frames.push(frame);\n chunkOffset += frameEnd;\n }\n }\n\n return frames;\n};\nvar addSampleDescription = function addSampleDescription(track, bytes) {\n var codec = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToString)(bytes.subarray(0, 4));\n\n if (track.type === 'video') {\n track.info = track.info || {};\n track.info.width = bytes[28] << 8 | bytes[29];\n track.info.height = bytes[30] << 8 | bytes[31];\n } else if (track.type === 'audio') {\n track.info = track.info || {};\n track.info.channels = bytes[20] << 8 | bytes[21];\n track.info.bitDepth = bytes[22] << 8 | bytes[23];\n track.info.sampleRate = bytes[28] << 8 | bytes[29];\n }\n\n if (codec === 'avc1') {\n var avcC = findNamedBox(bytes, 'avcC'); // AVCDecoderConfigurationRecord\n\n codec += \".\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getAvcCodec)(avcC);\n track.info.avcC = avcC; // TODO: do we need to parse all this?\n\n /* {\n configurationVersion: avcC[0],\n profile: avcC[1],\n profileCompatibility: avcC[2],\n level: avcC[3],\n lengthSizeMinusOne: avcC[4] & 0x3\n };\n let spsNalUnitCount = avcC[5] & 0x1F;\n const spsNalUnits = track.info.avc.spsNalUnits = [];\n // past spsNalUnitCount\n let offset = 6;\n while (spsNalUnitCount--) {\n const nalLen = avcC[offset] << 8 | avcC[offset + 1];\n spsNalUnits.push(avcC.subarray(offset + 2, offset + 2 + nalLen));\n offset += nalLen + 2;\n }\n let ppsNalUnitCount = avcC[offset];\n const ppsNalUnits = track.info.avc.ppsNalUnits = [];\n // past ppsNalUnitCount\n offset += 1;\n while (ppsNalUnitCount--) {\n const nalLen = avcC[offset] << 8 | avcC[offset + 1];\n ppsNalUnits.push(avcC.subarray(offset + 2, offset + 2 + nalLen));\n offset += nalLen + 2;\n }*/\n // HEVCDecoderConfigurationRecord\n } else if (codec === 'hvc1' || codec === 'hev1') {\n codec += \".\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getHvcCodec)(findNamedBox(bytes, 'hvcC'));\n } else if (codec === 'mp4a' || codec === 'mp4v') {\n var esds = findNamedBox(bytes, 'esds');\n var esDescriptor = parseDescriptors(esds.subarray(4))[0];\n var decoderConfig = esDescriptor && esDescriptor.descriptors.filter(function (_ref) {\n var tag = _ref.tag;\n return tag === 0x04;\n })[0];\n\n if (decoderConfig) {\n // most codecs do not have a further '.'\n // such as 0xa5 for ac-3 and 0xa6 for e-ac-3\n codec += '.' + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toHexString)(decoderConfig.oti);\n\n if (decoderConfig.oti === 0x40) {\n codec += '.' + (decoderConfig.descriptors[0].bytes[0] >> 3).toString();\n } else if (decoderConfig.oti === 0x20) {\n codec += '.' + decoderConfig.descriptors[0].bytes[4].toString();\n } else if (decoderConfig.oti === 0xdd) {\n codec = 'vorbis';\n }\n } else if (track.type === 'audio') {\n codec += '.40.2';\n } else {\n codec += '.20.9';\n }\n } else if (codec === 'av01') {\n // AV1DecoderConfigurationRecord\n codec += \".\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getAv1Codec)(findNamedBox(bytes, 'av1C'));\n } else if (codec === 'vp09') {\n // VPCodecConfigurationRecord\n var vpcC = findNamedBox(bytes, 'vpcC'); // https://www.webmproject.org/vp9/mp4/\n\n var profile = vpcC[0];\n var level = vpcC[1];\n var bitDepth = vpcC[2] >> 4;\n var chromaSubsampling = (vpcC[2] & 0x0F) >> 1;\n var videoFullRangeFlag = (vpcC[2] & 0x0F) >> 3;\n var colourPrimaries = vpcC[3];\n var transferCharacteristics = vpcC[4];\n var matrixCoefficients = vpcC[5];\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(profile, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(level, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(bitDepth, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(chromaSubsampling, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(colourPrimaries, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(transferCharacteristics, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(matrixCoefficients, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(videoFullRangeFlag, 2, '0');\n } else if (codec === 'theo') {\n codec = 'theora';\n } else if (codec === 'spex') {\n codec = 'speex';\n } else if (codec === '.mp3') {\n codec = 'mp4a.40.34';\n } else if (codec === 'msVo') {\n codec = 'vorbis';\n } else if (codec === 'Opus') {\n codec = 'opus';\n var dOps = findNamedBox(bytes, 'dOps');\n track.info.opus = (0,_opus_helpers_js__WEBPACK_IMPORTED_MODULE_2__.parseOpusHead)(dOps); // TODO: should this go into the webm code??\n // Firefox requires a codecDelay for opus playback\n // see https://bugzilla.mozilla.org/show_bug.cgi?id=1276238\n\n track.info.codecDelay = 6500000;\n } else {\n codec = codec.toLowerCase();\n }\n /* eslint-enable */\n // flac, ac-3, ec-3, opus\n\n\n track.codec = codec;\n};\nvar parseTracks = function parseTracks(bytes, frameTable) {\n if (frameTable === void 0) {\n frameTable = true;\n }\n\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var traks = findBox(bytes, ['moov', 'trak'], true);\n var tracks = [];\n traks.forEach(function (trak) {\n var track = {\n bytes: trak\n };\n var mdia = findBox(trak, ['mdia'])[0];\n var hdlr = findBox(mdia, ['hdlr'])[0];\n var trakType = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToString)(hdlr.subarray(8, 12));\n\n if (trakType === 'soun') {\n track.type = 'audio';\n } else if (trakType === 'vide') {\n track.type = 'video';\n } else {\n track.type = trakType;\n }\n\n var tkhd = findBox(trak, ['tkhd'])[0];\n\n if (tkhd) {\n var view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength);\n var tkhdVersion = view.getUint8(0);\n track.number = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20);\n }\n\n var mdhd = findBox(mdia, ['mdhd'])[0];\n\n if (mdhd) {\n // mdhd is a FullBox, meaning it will have its own version as the first byte\n var version = mdhd[0];\n var index = version === 0 ? 12 : 20;\n track.timescale = (mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]) >>> 0;\n }\n\n var stbl = findBox(mdia, ['minf', 'stbl'])[0];\n var stsd = findBox(stbl, ['stsd'])[0];\n var descriptionCount = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(stsd.subarray(4, 8));\n var offset = 8; // add codec and codec info\n\n while (descriptionCount--) {\n var len = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(stsd.subarray(offset, offset + 4));\n var sampleDescriptor = stsd.subarray(offset + 4, offset + 4 + len);\n addSampleDescription(track, sampleDescriptor);\n offset += 4 + len;\n }\n\n if (frameTable) {\n track.frameTable = buildFrameTable(stbl, track.timescale);\n } // codec has no sub parameters\n\n\n tracks.push(track);\n });\n return tracks;\n};\nvar parseMediaInfo = function parseMediaInfo(bytes) {\n var mvhd = findBox(bytes, ['moov', 'mvhd'], true)[0];\n\n if (!mvhd || !mvhd.length) {\n return;\n }\n\n var info = {}; // ms to ns\n // mvhd v1 has 8 byte duration and other fields too\n\n if (mvhd[0] === 1) {\n info.timestampScale = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(mvhd.subarray(20, 24));\n info.duration = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(mvhd.subarray(24, 32));\n } else {\n info.timestampScale = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(mvhd.subarray(12, 16));\n info.duration = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(mvhd.subarray(16, 20));\n }\n\n info.bytes = mvhd;\n return info;\n};\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/mp4-helpers.js?")},"./node_modules/@videojs/vhs-utils/es/nal-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EMULATION_PREVENTION: () => (/* binding */ EMULATION_PREVENTION),\n/* harmony export */ NAL_TYPE_ONE: () => (/* binding */ NAL_TYPE_ONE),\n/* harmony export */ NAL_TYPE_TWO: () => (/* binding */ NAL_TYPE_TWO),\n/* harmony export */ discardEmulationPreventionBytes: () => (/* binding */ discardEmulationPreventionBytes),\n/* harmony export */ findH264Nal: () => (/* binding */ findH264Nal),\n/* harmony export */ findH265Nal: () => (/* binding */ findH265Nal),\n/* harmony export */ findNal: () => (/* binding */ findNal)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers.js */ \"./node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n\nvar NAL_TYPE_ONE = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x00, 0x00, 0x00, 0x01]);\nvar NAL_TYPE_TWO = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x00, 0x00, 0x01]);\nvar EMULATION_PREVENTION = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x00, 0x00, 0x03]);\n/**\n * Expunge any \"Emulation Prevention\" bytes from a \"Raw Byte\n * Sequence Payload\"\n *\n * @param data {Uint8Array} the bytes of a RBSP from a NAL\n * unit\n * @return {Uint8Array} the RBSP without any Emulation\n * Prevention Bytes\n */\n\nvar discardEmulationPreventionBytes = function discardEmulationPreventionBytes(bytes) {\n var positions = [];\n var i = 1; // Find all `Emulation Prevention Bytes`\n\n while (i < bytes.length - 2) {\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes.subarray(i, i + 3), EMULATION_PREVENTION)) {\n positions.push(i + 2);\n i++;\n }\n\n i++;\n } // If no Emulation Prevention Bytes were found just return the original\n // array\n\n\n if (positions.length === 0) {\n return bytes;\n } // Create a new array to hold the NAL unit data\n\n\n var newLength = bytes.length - positions.length;\n var newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === positions[0]) {\n // Skip this byte\n sourceIndex++; // Remove this position index\n\n positions.shift();\n }\n\n newData[i] = bytes[sourceIndex];\n }\n\n return newData;\n};\nvar findNal = function findNal(bytes, dataType, types, nalLimit) {\n if (nalLimit === void 0) {\n nalLimit = Infinity;\n }\n\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n types = [].concat(types);\n var i = 0;\n var nalStart;\n var nalsFound = 0; // keep searching until:\n // we reach the end of bytes\n // we reach the maximum number of nals they want to seach\n // NOTE: that we disregard nalLimit when we have found the start\n // of the nal we want so that we can find the end of the nal we want.\n\n while (i < bytes.length && (nalsFound < nalLimit || nalStart)) {\n var nalOffset = void 0;\n\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes.subarray(i), NAL_TYPE_ONE)) {\n nalOffset = 4;\n } else if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes.subarray(i), NAL_TYPE_TWO)) {\n nalOffset = 3;\n } // we are unsynced,\n // find the next nal unit\n\n\n if (!nalOffset) {\n i++;\n continue;\n }\n\n nalsFound++;\n\n if (nalStart) {\n return discardEmulationPreventionBytes(bytes.subarray(nalStart, i));\n }\n\n var nalType = void 0;\n\n if (dataType === 'h264') {\n nalType = bytes[i + nalOffset] & 0x1f;\n } else if (dataType === 'h265') {\n nalType = bytes[i + nalOffset] >> 1 & 0x3f;\n }\n\n if (types.indexOf(nalType) !== -1) {\n nalStart = i + nalOffset;\n } // nal header is 1 length for h264, and 2 for h265\n\n\n i += nalOffset + (dataType === 'h264' ? 1 : 2);\n }\n\n return bytes.subarray(0, 0);\n};\nvar findH264Nal = function findH264Nal(bytes, type, nalLimit) {\n return findNal(bytes, 'h264', type, nalLimit);\n};\nvar findH265Nal = function findH265Nal(bytes, type, nalLimit) {\n return findNal(bytes, 'h265', type, nalLimit);\n};\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/nal-helpers.js?")},"./node_modules/@videojs/vhs-utils/es/opus-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OPUS_HEAD: () => (/* binding */ OPUS_HEAD),\n/* harmony export */ parseOpusHead: () => (/* binding */ parseOpusHead),\n/* harmony export */ setOpusHead: () => (/* binding */ setOpusHead)\n/* harmony export */ });\nvar OPUS_HEAD = new Uint8Array([// O, p, u, s\n0x4f, 0x70, 0x75, 0x73, // H, e, a, d\n0x48, 0x65, 0x61, 0x64]); // https://wiki.xiph.org/OggOpus\n// https://vfrmaniac.fushizen.eu/contents/opus_in_isobmff.html\n// https://opus-codec.org/docs/opusfile_api-0.7/structOpusHead.html\n\nvar parseOpusHead = function parseOpusHead(bytes) {\n var view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n var version = view.getUint8(0); // version 0, from mp4, does not use littleEndian.\n\n var littleEndian = version !== 0;\n var config = {\n version: version,\n channels: view.getUint8(1),\n preSkip: view.getUint16(2, littleEndian),\n sampleRate: view.getUint32(4, littleEndian),\n outputGain: view.getUint16(8, littleEndian),\n channelMappingFamily: view.getUint8(10)\n };\n\n if (config.channelMappingFamily > 0 && bytes.length > 10) {\n config.streamCount = view.getUint8(11);\n config.twoChannelStreamCount = view.getUint8(12);\n config.channelMapping = [];\n\n for (var c = 0; c < config.channels; c++) {\n config.channelMapping.push(view.getUint8(13 + c));\n }\n }\n\n return config;\n};\nvar setOpusHead = function setOpusHead(config) {\n var size = config.channelMappingFamily <= 0 ? 11 : 12 + config.channels;\n var view = new DataView(new ArrayBuffer(size));\n var littleEndian = config.version !== 0;\n view.setUint8(0, config.version);\n view.setUint8(1, config.channels);\n view.setUint16(2, config.preSkip, littleEndian);\n view.setUint32(4, config.sampleRate, littleEndian);\n view.setUint16(8, config.outputGain, littleEndian);\n view.setUint8(10, config.channelMappingFamily);\n\n if (config.channelMappingFamily > 0) {\n view.setUint8(11, config.streamCount);\n config.channelMapping.foreach(function (cm, i) {\n view.setUint8(12 + i, cm);\n });\n }\n\n return new Uint8Array(view.buffer);\n};\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/opus-helpers.js?")},"./node_modules/@videojs/vhs-utils/es/resolve-url.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var url_toolkit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! url-toolkit */ \"./node_modules/url-toolkit/src/url-toolkit.js\");\n/* harmony import */ var url_toolkit__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(url_toolkit__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_1__);\n\n\nvar DEFAULT_LOCATION = 'http://example.com';\n\nvar resolveUrl = function resolveUrl(baseUrl, relativeUrl) {\n // return early if we don't need to resolve\n if (/^[a-z]+:/i.test(relativeUrl)) {\n return relativeUrl;\n } // if baseUrl is a data URI, ignore it and resolve everything relative to window.location\n\n\n if (/^data:/.test(baseUrl)) {\n baseUrl = (global_window__WEBPACK_IMPORTED_MODULE_1___default().location) && (global_window__WEBPACK_IMPORTED_MODULE_1___default().location).href || '';\n } // IE11 supports URL but not the URL constructor\n // feature detect the behavior we want\n\n\n var nativeURL = typeof (global_window__WEBPACK_IMPORTED_MODULE_1___default().URL) === 'function';\n var protocolLess = /^\\/\\//.test(baseUrl); // remove location if window.location isn't available (i.e. we're in node)\n // and if baseUrl isn't an absolute url\n\n var removeLocation = !(global_window__WEBPACK_IMPORTED_MODULE_1___default().location) && !/\\/\\//i.test(baseUrl); // if the base URL is relative then combine with the current location\n\n if (nativeURL) {\n baseUrl = new (global_window__WEBPACK_IMPORTED_MODULE_1___default().URL)(baseUrl, (global_window__WEBPACK_IMPORTED_MODULE_1___default().location) || DEFAULT_LOCATION);\n } else if (!/\\/\\//i.test(baseUrl)) {\n baseUrl = url_toolkit__WEBPACK_IMPORTED_MODULE_0___default().buildAbsoluteURL((global_window__WEBPACK_IMPORTED_MODULE_1___default().location) && (global_window__WEBPACK_IMPORTED_MODULE_1___default().location).href || '', baseUrl);\n }\n\n if (nativeURL) {\n var newUrl = new URL(relativeUrl, baseUrl); // if we're a protocol-less url, remove the protocol\n // and if we're location-less, remove the location\n // otherwise, return the url unmodified\n\n if (removeLocation) {\n return newUrl.href.slice(DEFAULT_LOCATION.length);\n } else if (protocolLess) {\n return newUrl.href.slice(newUrl.protocol.length);\n }\n\n return newUrl.href;\n }\n\n return url_toolkit__WEBPACK_IMPORTED_MODULE_0___default().buildAbsoluteURL(baseUrl, relativeUrl);\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (resolveUrl);\n\n//# sourceURL=webpack://web/./node_modules/@videojs/vhs-utils/es/resolve-url.js?")},"./node_modules/@videojs/xhr/lib/http-handler.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval("\n\nvar window = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n\nvar httpResponseHandler = function httpResponseHandler(callback, decodeResponseBody) {\n if (decodeResponseBody === void 0) {\n decodeResponseBody = false;\n }\n\n return function (err, response, responseBody) {\n // if the XHR failed, return that error\n if (err) {\n callback(err);\n return;\n } // if the HTTP status code is 4xx or 5xx, the request also failed\n\n\n if (response.statusCode >= 400 && response.statusCode <= 599) {\n var cause = responseBody;\n\n if (decodeResponseBody) {\n if (window.TextDecoder) {\n var charset = getCharset(response.headers && response.headers['content-type']);\n\n try {\n cause = new TextDecoder(charset).decode(responseBody);\n } catch (e) {}\n } else {\n cause = String.fromCharCode.apply(null, new Uint8Array(responseBody));\n }\n }\n\n callback({\n cause: cause\n });\n return;\n } // otherwise, request succeeded\n\n\n callback(null, responseBody);\n };\n};\n\nfunction getCharset(contentTypeHeader) {\n if (contentTypeHeader === void 0) {\n contentTypeHeader = '';\n }\n\n return contentTypeHeader.toLowerCase().split(';').reduce(function (charset, contentType) {\n var _contentType$split = contentType.split('='),\n type = _contentType$split[0],\n value = _contentType$split[1];\n\n if (type.trim() === 'charset') {\n return value.trim();\n }\n\n return charset;\n }, 'utf-8');\n}\n\nmodule.exports = httpResponseHandler;\n\n//# sourceURL=webpack://web/./node_modules/@videojs/xhr/lib/http-handler.js?")},"./node_modules/@videojs/xhr/lib/index.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\n\nvar window = __webpack_require__(/*! global/window */ "./node_modules/global/window.js");\n\nvar _extends = __webpack_require__(/*! @babel/runtime/helpers/extends */ "./node_modules/@babel/runtime/helpers/extends.js");\n\nvar isFunction = __webpack_require__(/*! is-function */ "./node_modules/is-function/index.js");\n\ncreateXHR.httpHandler = __webpack_require__(/*! ./http-handler.js */ "./node_modules/@videojs/xhr/lib/http-handler.js");\n/**\n * @license\n * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>\n * Copyright (c) 2014 David Björklund\n * Available under the MIT license\n * <https://github.com/kesla/parse-headers/blob/master/LICENCE>\n */\n\nvar parseHeaders = function parseHeaders(headers) {\n var result = {};\n\n if (!headers) {\n return result;\n }\n\n headers.trim().split(\'\\n\').forEach(function (row) {\n var index = row.indexOf(\':\');\n var key = row.slice(0, index).trim().toLowerCase();\n var value = row.slice(index + 1).trim();\n\n if (typeof result[key] === \'undefined\') {\n result[key] = value;\n } else if (Array.isArray(result[key])) {\n result[key].push(value);\n } else {\n result[key] = [result[key], value];\n }\n });\n return result;\n};\n\nmodule.exports = createXHR; // Allow use of default import syntax in TypeScript\n\nmodule.exports["default"] = createXHR;\ncreateXHR.XMLHttpRequest = window.XMLHttpRequest || noop;\ncreateXHR.XDomainRequest = "withCredentials" in new createXHR.XMLHttpRequest() ? createXHR.XMLHttpRequest : window.XDomainRequest;\nforEachArray(["get", "put", "post", "patch", "head", "delete"], function (method) {\n createXHR[method === "delete" ? "del" : method] = function (uri, options, callback) {\n options = initParams(uri, options, callback);\n options.method = method.toUpperCase();\n return _createXHR(options);\n };\n});\n\nfunction forEachArray(array, iterator) {\n for (var i = 0; i < array.length; i++) {\n iterator(array[i]);\n }\n}\n\nfunction isEmpty(obj) {\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) return false;\n }\n\n return true;\n}\n\nfunction initParams(uri, options, callback) {\n var params = uri;\n\n if (isFunction(options)) {\n callback = options;\n\n if (typeof uri === "string") {\n params = {\n uri: uri\n };\n }\n } else {\n params = _extends({}, options, {\n uri: uri\n });\n }\n\n params.callback = callback;\n return params;\n}\n\nfunction createXHR(uri, options, callback) {\n options = initParams(uri, options, callback);\n return _createXHR(options);\n}\n\nfunction _createXHR(options) {\n if (typeof options.callback === "undefined") {\n throw new Error("callback argument missing");\n }\n\n var called = false;\n\n var callback = function cbOnce(err, response, body) {\n if (!called) {\n called = true;\n options.callback(err, response, body);\n }\n };\n\n function readystatechange() {\n if (xhr.readyState === 4) {\n setTimeout(loadFunc, 0);\n }\n }\n\n function getBody() {\n // Chrome with requestType=blob throws errors arround when even testing access to responseText\n var body = undefined;\n\n if (xhr.response) {\n body = xhr.response;\n } else {\n body = xhr.responseText || getXml(xhr);\n }\n\n if (isJson) {\n try {\n body = JSON.parse(body);\n } catch (e) {}\n }\n\n return body;\n }\n\n function errorFunc(evt) {\n clearTimeout(timeoutTimer);\n\n if (!(evt instanceof Error)) {\n evt = new Error("" + (evt || "Unknown XMLHttpRequest Error"));\n }\n\n evt.statusCode = 0;\n return callback(evt, failureResponse);\n } // will load the data & process the response in a special response object\n\n\n function loadFunc() {\n if (aborted) return;\n var status;\n clearTimeout(timeoutTimer);\n\n if (options.useXDR && xhr.status === undefined) {\n //IE8 CORS GET successful response doesn\'t have a status field, but body is fine\n status = 200;\n } else {\n status = xhr.status === 1223 ? 204 : xhr.status;\n }\n\n var response = failureResponse;\n var err = null;\n\n if (status !== 0) {\n response = {\n body: getBody(),\n statusCode: status,\n method: method,\n headers: {},\n url: uri,\n rawRequest: xhr\n };\n\n if (xhr.getAllResponseHeaders) {\n //remember xhr can in fact be XDR for CORS in IE\n response.headers = parseHeaders(xhr.getAllResponseHeaders());\n }\n } else {\n err = new Error("Internal XMLHttpRequest Error");\n }\n\n return callback(err, response, response.body);\n }\n\n var xhr = options.xhr || null;\n\n if (!xhr) {\n if (options.cors || options.useXDR) {\n xhr = new createXHR.XDomainRequest();\n } else {\n xhr = new createXHR.XMLHttpRequest();\n }\n }\n\n var key;\n var aborted;\n var uri = xhr.url = options.uri || options.url;\n var method = xhr.method = options.method || "GET";\n var body = options.body || options.data;\n var headers = xhr.headers = options.headers || {};\n var sync = !!options.sync;\n var isJson = false;\n var timeoutTimer;\n var failureResponse = {\n body: undefined,\n headers: {},\n statusCode: 0,\n method: method,\n url: uri,\n rawRequest: xhr\n };\n\n if ("json" in options && options.json !== false) {\n isJson = true;\n headers["accept"] || headers["Accept"] || (headers["Accept"] = "application/json"); //Don\'t override existing accept header declared by user\n\n if (method !== "GET" && method !== "HEAD") {\n headers["content-type"] || headers["Content-Type"] || (headers["Content-Type"] = "application/json"); //Don\'t override existing accept header declared by user\n\n body = JSON.stringify(options.json === true ? body : options.json);\n }\n }\n\n xhr.onreadystatechange = readystatechange;\n xhr.onload = loadFunc;\n xhr.onerror = errorFunc; // IE9 must have onprogress be set to a unique function.\n\n xhr.onprogress = function () {// IE must die\n };\n\n xhr.onabort = function () {\n aborted = true;\n };\n\n xhr.ontimeout = errorFunc;\n xhr.open(method, uri, !sync, options.username, options.password); //has to be after open\n\n if (!sync) {\n xhr.withCredentials = !!options.withCredentials;\n } // Cannot set timeout with sync request\n // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly\n // both npm\'s request and jquery 1.x use this kind of timeout, so this is being consistent\n\n\n if (!sync && options.timeout > 0) {\n timeoutTimer = setTimeout(function () {\n if (aborted) return;\n aborted = true; //IE9 may still call readystatechange\n\n xhr.abort("timeout");\n var e = new Error("XMLHttpRequest timeout");\n e.code = "ETIMEDOUT";\n errorFunc(e);\n }, options.timeout);\n }\n\n if (xhr.setRequestHeader) {\n for (key in headers) {\n if (headers.hasOwnProperty(key)) {\n xhr.setRequestHeader(key, headers[key]);\n }\n }\n } else if (options.headers && !isEmpty(options.headers)) {\n throw new Error("Headers cannot be set on an XDomainRequest object");\n }\n\n if ("responseType" in options) {\n xhr.responseType = options.responseType;\n }\n\n if ("beforeSend" in options && typeof options.beforeSend === "function") {\n options.beforeSend(xhr);\n } // Microsoft Edge browser sends "undefined" when send is called with undefined value.\n // XMLHttpRequest spec says to pass null as body to indicate no body\n // See https://github.com/naugtur/xhr/issues/100.\n\n\n xhr.send(body || null);\n return xhr;\n}\n\nfunction getXml(xhr) {\n // xhr.responseXML will throw Exception "InvalidStateError" or "DOMException"\n // See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseXML.\n try {\n if (xhr.responseType === "document") {\n return xhr.responseXML;\n }\n\n var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === "parsererror";\n\n if (xhr.responseType === "" && !firefoxBugTakenEffect) {\n return xhr.responseXML;\n }\n } catch (e) {}\n\n return null;\n}\n\nfunction noop() {}\n\n//# sourceURL=webpack://web/./node_modules/@videojs/xhr/lib/index.js?')},"./node_modules/@xmldom/xmldom/lib/conventions.js":(__unused_webpack_module,exports)=>{"use strict";eval("\n\n/**\n * Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes.\n *\n * Works with anything that has a `length` property and index access properties, including NodeList.\n *\n * @template {unknown} T\n * @param {Array<T> | ({length:number, [number]: T})} list\n * @param {function (item: T, index: number, list:Array<T> | ({length:number, [number]: T})):boolean} predicate\n * @param {Partial<Pick<ArrayConstructor['prototype'], 'find'>>?} ac `Array.prototype` by default,\n * \t\t\t\tallows injecting a custom implementation in tests\n * @returns {T | undefined}\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find\n * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find\n */\nfunction find(list, predicate, ac) {\n\tif (ac === undefined) {\n\t\tac = Array.prototype;\n\t}\n\tif (list && typeof ac.find === 'function') {\n\t\treturn ac.find.call(list, predicate);\n\t}\n\tfor (var i = 0; i < list.length; i++) {\n\t\tif (Object.prototype.hasOwnProperty.call(list, i)) {\n\t\t\tvar item = list[i];\n\t\t\tif (predicate.call(undefined, item, i, list)) {\n\t\t\t\treturn item;\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * \"Shallow freezes\" an object to render it immutable.\n * Uses `Object.freeze` if available,\n * otherwise the immutability is only in the type.\n *\n * Is used to create \"enum like\" objects.\n *\n * @template T\n * @param {T} object the object to freeze\n * @param {Pick<ObjectConstructor, 'freeze'> = Object} oc `Object` by default,\n * \t\t\t\tallows to inject custom object constructor for tests\n * @returns {Readonly<T>}\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze\n */\nfunction freeze(object, oc) {\n\tif (oc === undefined) {\n\t\toc = Object\n\t}\n\treturn oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object\n}\n\n/**\n * Since we can not rely on `Object.assign` we provide a simplified version\n * that is sufficient for our needs.\n *\n * @param {Object} target\n * @param {Object | null | undefined} source\n *\n * @returns {Object} target\n * @throws TypeError if target is not an object\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign\n */\nfunction assign(target, source) {\n\tif (target === null || typeof target !== 'object') {\n\t\tthrow new TypeError('target is not an object')\n\t}\n\tfor (var key in source) {\n\t\tif (Object.prototype.hasOwnProperty.call(source, key)) {\n\t\t\ttarget[key] = source[key]\n\t\t}\n\t}\n\treturn target\n}\n\n/**\n * All mime types that are allowed as input to `DOMParser.parseFromString`\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN\n * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec\n * @see DOMParser.prototype.parseFromString\n */\nvar MIME_TYPE = freeze({\n\t/**\n\t * `text/html`, the only mime type that triggers treating an XML document as HTML.\n\t *\n\t * @see DOMParser.SupportedType.isHTML\n\t * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration\n\t * @see https://en.wikipedia.org/wiki/HTML Wikipedia\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN\n\t * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec\n\t */\n\tHTML: 'text/html',\n\n\t/**\n\t * Helper method to check a mime type if it indicates an HTML document\n\t *\n\t * @param {string} [value]\n\t * @returns {boolean}\n\t *\n\t * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration\n\t * @see https://en.wikipedia.org/wiki/HTML Wikipedia\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN\n\t * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring \t */\n\tisHTML: function (value) {\n\t\treturn value === MIME_TYPE.HTML\n\t},\n\n\t/**\n\t * `application/xml`, the standard mime type for XML documents.\n\t *\n\t * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration\n\t * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303\n\t * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia\n\t */\n\tXML_APPLICATION: 'application/xml',\n\n\t/**\n\t * `text/html`, an alias for `application/xml`.\n\t *\n\t * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303\n\t * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration\n\t * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia\n\t */\n\tXML_TEXT: 'text/xml',\n\n\t/**\n\t * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,\n\t * but is parsed as an XML document.\n\t *\n\t * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec\n\t * @see https://en.wikipedia.org/wiki/XHTML Wikipedia\n\t */\n\tXML_XHTML_APPLICATION: 'application/xhtml+xml',\n\n\t/**\n\t * `image/svg+xml`,\n\t *\n\t * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration\n\t * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1\n\t * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia\n\t */\n\tXML_SVG_IMAGE: 'image/svg+xml',\n})\n\n/**\n * Namespaces that are used in this code base.\n *\n * @see http://www.w3.org/TR/REC-xml-names\n */\nvar NAMESPACE = freeze({\n\t/**\n\t * The XHTML namespace.\n\t *\n\t * @see http://www.w3.org/1999/xhtml\n\t */\n\tHTML: 'http://www.w3.org/1999/xhtml',\n\n\t/**\n\t * Checks if `uri` equals `NAMESPACE.HTML`.\n\t *\n\t * @param {string} [uri]\n\t *\n\t * @see NAMESPACE.HTML\n\t */\n\tisHTML: function (uri) {\n\t\treturn uri === NAMESPACE.HTML\n\t},\n\n\t/**\n\t * The SVG namespace.\n\t *\n\t * @see http://www.w3.org/2000/svg\n\t */\n\tSVG: 'http://www.w3.org/2000/svg',\n\n\t/**\n\t * The `xml:` namespace.\n\t *\n\t * @see http://www.w3.org/XML/1998/namespace\n\t */\n\tXML: 'http://www.w3.org/XML/1998/namespace',\n\n\t/**\n\t * The `xmlns:` namespace\n\t *\n\t * @see https://www.w3.org/2000/xmlns/\n\t */\n\tXMLNS: 'http://www.w3.org/2000/xmlns/',\n})\n\nexports.assign = assign;\nexports.find = find;\nexports.freeze = freeze;\nexports.MIME_TYPE = MIME_TYPE;\nexports.NAMESPACE = NAMESPACE;\n\n\n//# sourceURL=webpack://web/./node_modules/@xmldom/xmldom/lib/conventions.js?")},"./node_modules/@xmldom/xmldom/lib/dom-parser.js":(__unused_webpack_module,exports,__webpack_require__)=>{eval("var conventions = __webpack_require__(/*! ./conventions */ \"./node_modules/@xmldom/xmldom/lib/conventions.js\");\nvar dom = __webpack_require__(/*! ./dom */ \"./node_modules/@xmldom/xmldom/lib/dom.js\")\nvar entities = __webpack_require__(/*! ./entities */ \"./node_modules/@xmldom/xmldom/lib/entities.js\");\nvar sax = __webpack_require__(/*! ./sax */ \"./node_modules/@xmldom/xmldom/lib/sax.js\");\n\nvar DOMImplementation = dom.DOMImplementation;\n\nvar NAMESPACE = conventions.NAMESPACE;\n\nvar ParseError = sax.ParseError;\nvar XMLReader = sax.XMLReader;\n\n/**\n * Normalizes line ending according to https://www.w3.org/TR/xml11/#sec-line-ends:\n *\n * > XML parsed entities are often stored in computer files which,\n * > for editing convenience, are organized into lines.\n * > These lines are typically separated by some combination\n * > of the characters CARRIAGE RETURN (#xD) and LINE FEED (#xA).\n * >\n * > To simplify the tasks of applications, the XML processor must behave\n * > as if it normalized all line breaks in external parsed entities (including the document entity)\n * > on input, before parsing, by translating all of the following to a single #xA character:\n * >\n * > 1. the two-character sequence #xD #xA\n * > 2. the two-character sequence #xD #x85\n * > 3. the single character #x85\n * > 4. the single character #x2028\n * > 5. any #xD character that is not immediately followed by #xA or #x85.\n *\n * @param {string} input\n * @returns {string}\n */\nfunction normalizeLineEndings(input) {\n\treturn input\n\t\t.replace(/\\r[\\n\\u0085]/g, '\\n')\n\t\t.replace(/[\\r\\u0085\\u2028]/g, '\\n')\n}\n\n/**\n * @typedef Locator\n * @property {number} [columnNumber]\n * @property {number} [lineNumber]\n */\n\n/**\n * @typedef DOMParserOptions\n * @property {DOMHandler} [domBuilder]\n * @property {Function} [errorHandler]\n * @property {(string) => string} [normalizeLineEndings] used to replace line endings before parsing\n * \t\t\t\t\t\tdefaults to `normalizeLineEndings`\n * @property {Locator} [locator]\n * @property {Record<string, string>} [xmlns]\n *\n * @see normalizeLineEndings\n */\n\n/**\n * The DOMParser interface provides the ability to parse XML or HTML source code\n * from a string into a DOM `Document`.\n *\n * _xmldom is different from the spec in that it allows an `options` parameter,\n * to override the default behavior._\n *\n * @param {DOMParserOptions} [options]\n * @constructor\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser\n * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization\n */\nfunction DOMParser(options){\n\tthis.options = options ||{locator:{}};\n}\n\nDOMParser.prototype.parseFromString = function(source,mimeType){\n\tvar options = this.options;\n\tvar sax = new XMLReader();\n\tvar domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler\n\tvar errorHandler = options.errorHandler;\n\tvar locator = options.locator;\n\tvar defaultNSMap = options.xmlns||{};\n\tvar isHTML = /\\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1;\n \tvar entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;\n\tif(locator){\n\t\tdomBuilder.setDocumentLocator(locator)\n\t}\n\n\tsax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator);\n\tsax.domBuilder = options.domBuilder || domBuilder;\n\tif(isHTML){\n\t\tdefaultNSMap[''] = NAMESPACE.HTML;\n\t}\n\tdefaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;\n\tvar normalize = options.normalizeLineEndings || normalizeLineEndings;\n\tif (source && typeof source === 'string') {\n\t\tsax.parse(\n\t\t\tnormalize(source),\n\t\t\tdefaultNSMap,\n\t\t\tentityMap\n\t\t)\n\t} else {\n\t\tsax.errorHandler.error('invalid doc source')\n\t}\n\treturn domBuilder.doc;\n}\nfunction buildErrorHandler(errorImpl,domBuilder,locator){\n\tif(!errorImpl){\n\t\tif(domBuilder instanceof DOMHandler){\n\t\t\treturn domBuilder;\n\t\t}\n\t\terrorImpl = domBuilder ;\n\t}\n\tvar errorHandler = {}\n\tvar isCallback = errorImpl instanceof Function;\n\tlocator = locator||{}\n\tfunction build(key){\n\t\tvar fn = errorImpl[key];\n\t\tif(!fn && isCallback){\n\t\t\tfn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl;\n\t\t}\n\t\terrorHandler[key] = fn && function(msg){\n\t\t\tfn('[xmldom '+key+']\\t'+msg+_locator(locator));\n\t\t}||function(){};\n\t}\n\tbuild('warning');\n\tbuild('error');\n\tbuild('fatalError');\n\treturn errorHandler;\n}\n\n//console.log('#\\n\\n\\n\\n\\n\\n\\n####')\n/**\n * +ContentHandler+ErrorHandler\n * +LexicalHandler+EntityResolver2\n * -DeclHandler-DTDHandler\n *\n * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler\n * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2\n * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html\n */\nfunction DOMHandler() {\n this.cdata = false;\n}\nfunction position(locator,node){\n\tnode.lineNumber = locator.lineNumber;\n\tnode.columnNumber = locator.columnNumber;\n}\n/**\n * @see org.xml.sax.ContentHandler#startDocument\n * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html\n */\nDOMHandler.prototype = {\n\tstartDocument : function() {\n \tthis.doc = new DOMImplementation().createDocument(null, null, null);\n \tif (this.locator) {\n \tthis.doc.documentURI = this.locator.systemId;\n \t}\n\t},\n\tstartElement:function(namespaceURI, localName, qName, attrs) {\n\t\tvar doc = this.doc;\n\t var el = doc.createElementNS(namespaceURI, qName||localName);\n\t var len = attrs.length;\n\t appendElement(this, el);\n\t this.currentElement = el;\n\n\t\tthis.locator && position(this.locator,el)\n\t for (var i = 0 ; i < len; i++) {\n\t var namespaceURI = attrs.getURI(i);\n\t var value = attrs.getValue(i);\n\t var qName = attrs.getQName(i);\n\t\t\tvar attr = doc.createAttributeNS(namespaceURI, qName);\n\t\t\tthis.locator &&position(attrs.getLocator(i),attr);\n\t\t\tattr.value = attr.nodeValue = value;\n\t\t\tel.setAttributeNode(attr)\n\t }\n\t},\n\tendElement:function(namespaceURI, localName, qName) {\n\t\tvar current = this.currentElement\n\t\tvar tagName = current.tagName;\n\t\tthis.currentElement = current.parentNode;\n\t},\n\tstartPrefixMapping:function(prefix, uri) {\n\t},\n\tendPrefixMapping:function(prefix) {\n\t},\n\tprocessingInstruction:function(target, data) {\n\t var ins = this.doc.createProcessingInstruction(target, data);\n\t this.locator && position(this.locator,ins)\n\t appendElement(this, ins);\n\t},\n\tignorableWhitespace:function(ch, start, length) {\n\t},\n\tcharacters:function(chars, start, length) {\n\t\tchars = _toString.apply(this,arguments)\n\t\t//console.log(chars)\n\t\tif(chars){\n\t\t\tif (this.cdata) {\n\t\t\t\tvar charNode = this.doc.createCDATASection(chars);\n\t\t\t} else {\n\t\t\t\tvar charNode = this.doc.createTextNode(chars);\n\t\t\t}\n\t\t\tif(this.currentElement){\n\t\t\t\tthis.currentElement.appendChild(charNode);\n\t\t\t}else if(/^\\s*$/.test(chars)){\n\t\t\t\tthis.doc.appendChild(charNode);\n\t\t\t\t//process xml\n\t\t\t}\n\t\t\tthis.locator && position(this.locator,charNode)\n\t\t}\n\t},\n\tskippedEntity:function(name) {\n\t},\n\tendDocument:function() {\n\t\tthis.doc.normalize();\n\t},\n\tsetDocumentLocator:function (locator) {\n\t if(this.locator = locator){// && !('lineNumber' in locator)){\n\t \tlocator.lineNumber = 0;\n\t }\n\t},\n\t//LexicalHandler\n\tcomment:function(chars, start, length) {\n\t\tchars = _toString.apply(this,arguments)\n\t var comm = this.doc.createComment(chars);\n\t this.locator && position(this.locator,comm)\n\t appendElement(this, comm);\n\t},\n\n\tstartCDATA:function() {\n\t //used in characters() methods\n\t this.cdata = true;\n\t},\n\tendCDATA:function() {\n\t this.cdata = false;\n\t},\n\n\tstartDTD:function(name, publicId, systemId) {\n\t\tvar impl = this.doc.implementation;\n\t if (impl && impl.createDocumentType) {\n\t var dt = impl.createDocumentType(name, publicId, systemId);\n\t this.locator && position(this.locator,dt)\n\t appendElement(this, dt);\n\t\t\t\t\tthis.doc.doctype = dt;\n\t }\n\t},\n\t/**\n\t * @see org.xml.sax.ErrorHandler\n\t * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html\n\t */\n\twarning:function(error) {\n\t\tconsole.warn('[xmldom warning]\\t'+error,_locator(this.locator));\n\t},\n\terror:function(error) {\n\t\tconsole.error('[xmldom error]\\t'+error,_locator(this.locator));\n\t},\n\tfatalError:function(error) {\n\t\tthrow new ParseError(error, this.locator);\n\t}\n}\nfunction _locator(l){\n\tif(l){\n\t\treturn '\\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']'\n\t}\n}\nfunction _toString(chars,start,length){\n\tif(typeof chars == 'string'){\n\t\treturn chars.substr(start,length)\n\t}else{//java sax connect width xmldom on rhino(what about: \"? && !(chars instanceof String)\")\n\t\tif(chars.length >= start+length || start){\n\t\t\treturn new java.lang.String(chars,start,length)+'';\n\t\t}\n\t\treturn chars;\n\t}\n}\n\n/*\n * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html\n * used method of org.xml.sax.ext.LexicalHandler:\n * #comment(chars, start, length)\n * #startCDATA()\n * #endCDATA()\n * #startDTD(name, publicId, systemId)\n *\n *\n * IGNORED method of org.xml.sax.ext.LexicalHandler:\n * #endDTD()\n * #startEntity(name)\n * #endEntity(name)\n *\n *\n * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html\n * IGNORED method of org.xml.sax.ext.DeclHandler\n * \t#attributeDecl(eName, aName, type, mode, value)\n * #elementDecl(name, model)\n * #externalEntityDecl(name, publicId, systemId)\n * #internalEntityDecl(name, value)\n * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html\n * IGNORED method of org.xml.sax.EntityResolver2\n * #resolveEntity(String name,String publicId,String baseURI,String systemId)\n * #resolveEntity(publicId, systemId)\n * #getExternalSubset(name, baseURI)\n * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html\n * IGNORED method of org.xml.sax.DTDHandler\n * #notationDecl(name, publicId, systemId) {};\n * #unparsedEntityDecl(name, publicId, systemId, notationName) {};\n */\n\"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl\".replace(/\\w+/g,function(key){\n\tDOMHandler.prototype[key] = function(){return null}\n})\n\n/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */\nfunction appendElement (hander,node) {\n if (!hander.currentElement) {\n hander.doc.appendChild(node);\n } else {\n hander.currentElement.appendChild(node);\n }\n}//appendChild and setAttributeNS are preformance key\n\nexports.__DOMHandler = DOMHandler;\nexports.normalizeLineEndings = normalizeLineEndings;\nexports.DOMParser = DOMParser;\n\n\n//# sourceURL=webpack://web/./node_modules/@xmldom/xmldom/lib/dom-parser.js?")},"./node_modules/@xmldom/xmldom/lib/dom.js":(__unused_webpack_module,exports,__webpack_require__)=>{eval("var conventions = __webpack_require__(/*! ./conventions */ \"./node_modules/@xmldom/xmldom/lib/conventions.js\");\n\nvar find = conventions.find;\nvar NAMESPACE = conventions.NAMESPACE;\n\n/**\n * A prerequisite for `[].filter`, to drop elements that are empty\n * @param {string} input\n * @returns {boolean}\n */\nfunction notEmptyString (input) {\n\treturn input !== ''\n}\n/**\n * @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace\n * @see https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * @param {string} input\n * @returns {string[]} (can be empty)\n */\nfunction splitOnASCIIWhitespace(input) {\n\t// U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, U+0020 SPACE\n\treturn input ? input.split(/[\\t\\n\\f\\r ]+/).filter(notEmptyString) : []\n}\n\n/**\n * Adds element as a key to current if it is not already present.\n *\n * @param {Record<string, boolean | undefined>} current\n * @param {string} element\n * @returns {Record<string, boolean | undefined>}\n */\nfunction orderedSetReducer (current, element) {\n\tif (!current.hasOwnProperty(element)) {\n\t\tcurrent[element] = true;\n\t}\n\treturn current;\n}\n\n/**\n * @see https://infra.spec.whatwg.org/#ordered-set\n * @param {string} input\n * @returns {string[]}\n */\nfunction toOrderedSet(input) {\n\tif (!input) return [];\n\tvar list = splitOnASCIIWhitespace(input);\n\treturn Object.keys(list.reduce(orderedSetReducer, {}))\n}\n\n/**\n * Uses `list.indexOf` to implement something like `Array.prototype.includes`,\n * which we can not rely on being available.\n *\n * @param {any[]} list\n * @returns {function(any): boolean}\n */\nfunction arrayIncludes (list) {\n\treturn function(element) {\n\t\treturn list && list.indexOf(element) !== -1;\n\t}\n}\n\nfunction copy(src,dest){\n\tfor(var p in src){\n\t\tif (Object.prototype.hasOwnProperty.call(src, p)) {\n\t\t\tdest[p] = src[p];\n\t\t}\n\t}\n}\n\n/**\n^\\w+\\.prototype\\.([_\\w]+)\\s*=\\s*((?:.*\\{\\s*?[\\r\\n][\\s\\S]*?^})|\\S.*?(?=[;\\r\\n]));?\n^\\w+\\.prototype\\.([_\\w]+)\\s*=\\s*(\\S.*?(?=[;\\r\\n]));?\n */\nfunction _extends(Class,Super){\n\tvar pt = Class.prototype;\n\tif(!(pt instanceof Super)){\n\t\tfunction t(){};\n\t\tt.prototype = Super.prototype;\n\t\tt = new t();\n\t\tcopy(pt,t);\n\t\tClass.prototype = pt = t;\n\t}\n\tif(pt.constructor != Class){\n\t\tif(typeof Class != 'function'){\n\t\t\tconsole.error(\"unknown Class:\"+Class)\n\t\t}\n\t\tpt.constructor = Class\n\t}\n}\n\n// Node Types\nvar NodeType = {}\nvar ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;\nvar ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;\nvar TEXT_NODE = NodeType.TEXT_NODE = 3;\nvar CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;\nvar ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;\nvar ENTITY_NODE = NodeType.ENTITY_NODE = 6;\nvar PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;\nvar COMMENT_NODE = NodeType.COMMENT_NODE = 8;\nvar DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;\nvar DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;\nvar DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;\nvar NOTATION_NODE = NodeType.NOTATION_NODE = 12;\n\n// ExceptionCode\nvar ExceptionCode = {}\nvar ExceptionMessage = {};\nvar INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = ((ExceptionMessage[1]=\"Index size error\"),1);\nvar DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = ((ExceptionMessage[2]=\"DOMString size error\"),2);\nvar HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = ((ExceptionMessage[3]=\"Hierarchy request error\"),3);\nvar WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = ((ExceptionMessage[4]=\"Wrong document\"),4);\nvar INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = ((ExceptionMessage[5]=\"Invalid character\"),5);\nvar NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = ((ExceptionMessage[6]=\"No data allowed\"),6);\nvar NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = ((ExceptionMessage[7]=\"No modification allowed\"),7);\nvar NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = ((ExceptionMessage[8]=\"Not found\"),8);\nvar NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = ((ExceptionMessage[9]=\"Not supported\"),9);\nvar INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = ((ExceptionMessage[10]=\"Attribute in use\"),10);\n//level2\nvar INVALID_STATE_ERR \t= ExceptionCode.INVALID_STATE_ERR \t= ((ExceptionMessage[11]=\"Invalid state\"),11);\nvar SYNTAX_ERR \t= ExceptionCode.SYNTAX_ERR \t= ((ExceptionMessage[12]=\"Syntax error\"),12);\nvar INVALID_MODIFICATION_ERR \t= ExceptionCode.INVALID_MODIFICATION_ERR \t= ((ExceptionMessage[13]=\"Invalid modification\"),13);\nvar NAMESPACE_ERR \t= ExceptionCode.NAMESPACE_ERR \t= ((ExceptionMessage[14]=\"Invalid namespace\"),14);\nvar INVALID_ACCESS_ERR \t= ExceptionCode.INVALID_ACCESS_ERR \t= ((ExceptionMessage[15]=\"Invalid access\"),15);\n\n/**\n * DOM Level 2\n * Object DOMException\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html\n * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html\n */\nfunction DOMException(code, message) {\n\tif(message instanceof Error){\n\t\tvar error = message;\n\t}else{\n\t\terror = this;\n\t\tError.call(this, ExceptionMessage[code]);\n\t\tthis.message = ExceptionMessage[code];\n\t\tif(Error.captureStackTrace) Error.captureStackTrace(this, DOMException);\n\t}\n\terror.code = code;\n\tif(message) this.message = this.message + \": \" + message;\n\treturn error;\n};\nDOMException.prototype = Error.prototype;\ncopy(ExceptionCode,DOMException)\n\n/**\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177\n * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.\n * The items in the NodeList are accessible via an integral index, starting from 0.\n */\nfunction NodeList() {\n};\nNodeList.prototype = {\n\t/**\n\t * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.\n\t * @standard level1\n\t */\n\tlength:0,\n\t/**\n\t * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.\n\t * @standard level1\n\t * @param index unsigned long\n\t * Index into the collection.\n\t * @return Node\n\t * \tThe node at the indexth position in the NodeList, or null if that is not a valid index.\n\t */\n\titem: function(index) {\n\t\treturn index >= 0 && index < this.length ? this[index] : null;\n\t},\n\ttoString:function(isHTML,nodeFilter){\n\t\tfor(var buf = [], i = 0;i<this.length;i++){\n\t\t\tserializeToString(this[i],buf,isHTML,nodeFilter);\n\t\t}\n\t\treturn buf.join('');\n\t},\n\t/**\n\t * @private\n\t * @param {function (Node):boolean} predicate\n\t * @returns {Node[]}\n\t */\n\tfilter: function (predicate) {\n\t\treturn Array.prototype.filter.call(this, predicate);\n\t},\n\t/**\n\t * @private\n\t * @param {Node} item\n\t * @returns {number}\n\t */\n\tindexOf: function (item) {\n\t\treturn Array.prototype.indexOf.call(this, item);\n\t},\n};\n\nfunction LiveNodeList(node,refresh){\n\tthis._node = node;\n\tthis._refresh = refresh\n\t_updateLiveList(this);\n}\nfunction _updateLiveList(list){\n\tvar inc = list._node._inc || list._node.ownerDocument._inc;\n\tif (list._inc !== inc) {\n\t\tvar ls = list._refresh(list._node);\n\t\t__set__(list,'length',ls.length);\n\t\tif (!list.$$length || ls.length < list.$$length) {\n\t\t\tfor (var i = ls.length; i in list; i++) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(list, i)) {\n\t\t\t\t\tdelete list[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tcopy(ls,list);\n\t\tlist._inc = inc;\n\t}\n}\nLiveNodeList.prototype.item = function(i){\n\t_updateLiveList(this);\n\treturn this[i] || null;\n}\n\n_extends(LiveNodeList,NodeList);\n\n/**\n * Objects implementing the NamedNodeMap interface are used\n * to represent collections of nodes that can be accessed by name.\n * Note that NamedNodeMap does not inherit from NodeList;\n * NamedNodeMaps are not maintained in any particular order.\n * Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index,\n * but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,\n * and does not imply that the DOM specifies an order to these Nodes.\n * NamedNodeMap objects in the DOM are live.\n * used for attributes or DocumentType entities\n */\nfunction NamedNodeMap() {\n};\n\nfunction _findNodeIndex(list,node){\n\tvar i = list.length;\n\twhile(i--){\n\t\tif(list[i] === node){return i}\n\t}\n}\n\nfunction _addNamedNode(el,list,newAttr,oldAttr){\n\tif(oldAttr){\n\t\tlist[_findNodeIndex(list,oldAttr)] = newAttr;\n\t}else{\n\t\tlist[list.length++] = newAttr;\n\t}\n\tif(el){\n\t\tnewAttr.ownerElement = el;\n\t\tvar doc = el.ownerDocument;\n\t\tif(doc){\n\t\t\toldAttr && _onRemoveAttribute(doc,el,oldAttr);\n\t\t\t_onAddAttribute(doc,el,newAttr);\n\t\t}\n\t}\n}\nfunction _removeNamedNode(el,list,attr){\n\t//console.log('remove attr:'+attr)\n\tvar i = _findNodeIndex(list,attr);\n\tif(i>=0){\n\t\tvar lastIndex = list.length-1\n\t\twhile(i<lastIndex){\n\t\t\tlist[i] = list[++i]\n\t\t}\n\t\tlist.length = lastIndex;\n\t\tif(el){\n\t\t\tvar doc = el.ownerDocument;\n\t\t\tif(doc){\n\t\t\t\t_onRemoveAttribute(doc,el,attr);\n\t\t\t\tattr.ownerElement = null;\n\t\t\t}\n\t\t}\n\t}else{\n\t\tthrow new DOMException(NOT_FOUND_ERR,new Error(el.tagName+'@'+attr))\n\t}\n}\nNamedNodeMap.prototype = {\n\tlength:0,\n\titem:NodeList.prototype.item,\n\tgetNamedItem: function(key) {\n//\t\tif(key.indexOf(':')>0 || key == 'xmlns'){\n//\t\t\treturn null;\n//\t\t}\n\t\t//console.log()\n\t\tvar i = this.length;\n\t\twhile(i--){\n\t\t\tvar attr = this[i];\n\t\t\t//console.log(attr.nodeName,key)\n\t\t\tif(attr.nodeName == key){\n\t\t\t\treturn attr;\n\t\t\t}\n\t\t}\n\t},\n\tsetNamedItem: function(attr) {\n\t\tvar el = attr.ownerElement;\n\t\tif(el && el!=this._ownerElement){\n\t\t\tthrow new DOMException(INUSE_ATTRIBUTE_ERR);\n\t\t}\n\t\tvar oldAttr = this.getNamedItem(attr.nodeName);\n\t\t_addNamedNode(this._ownerElement,this,attr,oldAttr);\n\t\treturn oldAttr;\n\t},\n\t/* returns Node */\n\tsetNamedItemNS: function(attr) {// raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR\n\t\tvar el = attr.ownerElement, oldAttr;\n\t\tif(el && el!=this._ownerElement){\n\t\t\tthrow new DOMException(INUSE_ATTRIBUTE_ERR);\n\t\t}\n\t\toldAttr = this.getNamedItemNS(attr.namespaceURI,attr.localName);\n\t\t_addNamedNode(this._ownerElement,this,attr,oldAttr);\n\t\treturn oldAttr;\n\t},\n\n\t/* returns Node */\n\tremoveNamedItem: function(key) {\n\t\tvar attr = this.getNamedItem(key);\n\t\t_removeNamedNode(this._ownerElement,this,attr);\n\t\treturn attr;\n\n\n\t},// raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR\n\n\t//for level2\n\tremoveNamedItemNS:function(namespaceURI,localName){\n\t\tvar attr = this.getNamedItemNS(namespaceURI,localName);\n\t\t_removeNamedNode(this._ownerElement,this,attr);\n\t\treturn attr;\n\t},\n\tgetNamedItemNS: function(namespaceURI, localName) {\n\t\tvar i = this.length;\n\t\twhile(i--){\n\t\t\tvar node = this[i];\n\t\t\tif(node.localName == localName && node.namespaceURI == namespaceURI){\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n};\n\n/**\n * The DOMImplementation interface represents an object providing methods\n * which are not dependent on any particular document.\n * Such an object is returned by the `Document.implementation` property.\n *\n * __The individual methods describe the differences compared to the specs.__\n *\n * @constructor\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN\n * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial)\n * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core\n * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core\n * @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard\n */\nfunction DOMImplementation() {\n}\n\nDOMImplementation.prototype = {\n\t/**\n\t * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.\n\t * The different implementations fairly diverged in what kind of features were reported.\n\t * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.\n\t *\n\t * @deprecated It is deprecated and modern browsers return true in all cases.\n\t *\n\t * @param {string} feature\n\t * @param {string} [version]\n\t * @returns {boolean} always true\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN\n\t * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard\n\t */\n\thasFeature: function(feature, version) {\n\t\t\treturn true;\n\t},\n\t/**\n\t * Creates an XML Document object of the specified type with its document element.\n\t *\n\t * __It behaves slightly different from the description in the living standard__:\n\t * - There is no interface/class `XMLDocument`, it returns a `Document` instance.\n\t * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.\n\t * - this implementation is not validating names or qualified names\n\t * (when parsing XML strings, the SAX parser takes care of that)\n\t *\n\t * @param {string|null} namespaceURI\n\t * @param {string} qualifiedName\n\t * @param {DocumentType=null} doctype\n\t * @returns {Document}\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core\n\t *\n\t * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract\n\t * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names\n\t * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names\n\t */\n\tcreateDocument: function(namespaceURI, qualifiedName, doctype){\n\t\tvar doc = new Document();\n\t\tdoc.implementation = this;\n\t\tdoc.childNodes = new NodeList();\n\t\tdoc.doctype = doctype || null;\n\t\tif (doctype){\n\t\t\tdoc.appendChild(doctype);\n\t\t}\n\t\tif (qualifiedName){\n\t\t\tvar root = doc.createElementNS(namespaceURI, qualifiedName);\n\t\t\tdoc.appendChild(root);\n\t\t}\n\t\treturn doc;\n\t},\n\t/**\n\t * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.\n\t *\n\t * __This behavior is slightly different from the in the specs__:\n\t * - this implementation is not validating names or qualified names\n\t * (when parsing XML strings, the SAX parser takes care of that)\n\t *\n\t * @param {string} qualifiedName\n\t * @param {string} [publicId]\n\t * @param {string} [systemId]\n\t * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation\n\t * \t\t\t\t or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN\n\t * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core\n\t * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard\n\t *\n\t * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract\n\t * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names\n\t * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names\n\t */\n\tcreateDocumentType: function(qualifiedName, publicId, systemId){\n\t\tvar node = new DocumentType();\n\t\tnode.name = qualifiedName;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.publicId = publicId || '';\n\t\tnode.systemId = systemId || '';\n\n\t\treturn node;\n\t}\n};\n\n\n/**\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247\n */\n\nfunction Node() {\n};\n\nNode.prototype = {\n\tfirstChild : null,\n\tlastChild : null,\n\tpreviousSibling : null,\n\tnextSibling : null,\n\tattributes : null,\n\tparentNode : null,\n\tchildNodes : null,\n\townerDocument : null,\n\tnodeValue : null,\n\tnamespaceURI : null,\n\tprefix : null,\n\tlocalName : null,\n\t// Modified in DOM Level 2:\n\tinsertBefore:function(newChild, refChild){//raises\n\t\treturn _insertBefore(this,newChild,refChild);\n\t},\n\treplaceChild:function(newChild, oldChild){//raises\n\t\t_insertBefore(this, newChild,oldChild, assertPreReplacementValidityInDocument);\n\t\tif(oldChild){\n\t\t\tthis.removeChild(oldChild);\n\t\t}\n\t},\n\tremoveChild:function(oldChild){\n\t\treturn _removeChild(this,oldChild);\n\t},\n\tappendChild:function(newChild){\n\t\treturn this.insertBefore(newChild,null);\n\t},\n\thasChildNodes:function(){\n\t\treturn this.firstChild != null;\n\t},\n\tcloneNode:function(deep){\n\t\treturn cloneNode(this.ownerDocument||this,this,deep);\n\t},\n\t// Modified in DOM Level 2:\n\tnormalize:function(){\n\t\tvar child = this.firstChild;\n\t\twhile(child){\n\t\t\tvar next = child.nextSibling;\n\t\t\tif(next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE){\n\t\t\t\tthis.removeChild(next);\n\t\t\t\tchild.appendData(next.data);\n\t\t\t}else{\n\t\t\t\tchild.normalize();\n\t\t\t\tchild = next;\n\t\t\t}\n\t\t}\n\t},\n \t// Introduced in DOM Level 2:\n\tisSupported:function(feature, version){\n\t\treturn this.ownerDocument.implementation.hasFeature(feature,version);\n\t},\n // Introduced in DOM Level 2:\n hasAttributes:function(){\n \treturn this.attributes.length>0;\n },\n\t/**\n\t * Look up the prefix associated to the given namespace URI, starting from this node.\n\t * **The default namespace declarations are ignored by this method.**\n\t * See Namespace Prefix Lookup for details on the algorithm used by this method.\n\t *\n\t * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._\n\t *\n\t * @param {string | null} namespaceURI\n\t * @returns {string | null}\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix\n\t * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo\n\t * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix\n\t * @see https://github.com/xmldom/xmldom/issues/322\n\t */\n lookupPrefix:function(namespaceURI){\n \tvar el = this;\n \twhile(el){\n \t\tvar map = el._nsMap;\n \t\t//console.dir(map)\n \t\tif(map){\n \t\t\tfor(var n in map){\n\t\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {\n\t\t\t\t\t\t\treturn n;\n\t\t\t\t\t\t}\n \t\t\t}\n \t\t}\n \t\tel = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;\n \t}\n \treturn null;\n },\n // Introduced in DOM Level 3:\n lookupNamespaceURI:function(prefix){\n \tvar el = this;\n \twhile(el){\n \t\tvar map = el._nsMap;\n \t\t//console.dir(map)\n \t\tif(map){\n \t\t\tif(Object.prototype.hasOwnProperty.call(map, prefix)){\n \t\t\t\treturn map[prefix] ;\n \t\t\t}\n \t\t}\n \t\tel = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode;\n \t}\n \treturn null;\n },\n // Introduced in DOM Level 3:\n isDefaultNamespace:function(namespaceURI){\n \tvar prefix = this.lookupPrefix(namespaceURI);\n \treturn prefix == null;\n }\n};\n\n\nfunction _xmlEncoder(c){\n\treturn c == '<' && '<' ||\n c == '>' && '>' ||\n c == '&' && '&' ||\n c == '\"' && '"' ||\n '&#'+c.charCodeAt()+';'\n}\n\n\ncopy(NodeType,Node);\ncopy(NodeType,Node.prototype);\n\n/**\n * @param callback return true for continue,false for break\n * @return boolean true: break visit;\n */\nfunction _visitNode(node,callback){\n\tif(callback(node)){\n\t\treturn true;\n\t}\n\tif(node = node.firstChild){\n\t\tdo{\n\t\t\tif(_visitNode(node,callback)){return true}\n }while(node=node.nextSibling)\n }\n}\n\n\n\nfunction Document(){\n\tthis.ownerDocument = this;\n}\n\nfunction _onAddAttribute(doc,el,newAttr){\n\tdoc && doc._inc++;\n\tvar ns = newAttr.namespaceURI ;\n\tif(ns === NAMESPACE.XMLNS){\n\t\t//update namespace\n\t\tel._nsMap[newAttr.prefix?newAttr.localName:''] = newAttr.value\n\t}\n}\n\nfunction _onRemoveAttribute(doc,el,newAttr,remove){\n\tdoc && doc._inc++;\n\tvar ns = newAttr.namespaceURI ;\n\tif(ns === NAMESPACE.XMLNS){\n\t\t//update namespace\n\t\tdelete el._nsMap[newAttr.prefix?newAttr.localName:'']\n\t}\n}\n\n/**\n * Updates `el.childNodes`, updating the indexed items and it's `length`.\n * Passing `newChild` means it will be appended.\n * Otherwise it's assumed that an item has been removed,\n * and `el.firstNode` and it's `.nextSibling` are used\n * to walk the current list of child nodes.\n *\n * @param {Document} doc\n * @param {Node} el\n * @param {Node} [newChild]\n * @private\n */\nfunction _onUpdateChild (doc, el, newChild) {\n\tif(doc && doc._inc){\n\t\tdoc._inc++;\n\t\t//update childNodes\n\t\tvar cs = el.childNodes;\n\t\tif (newChild) {\n\t\t\tcs[cs.length++] = newChild;\n\t\t} else {\n\t\t\tvar child = el.firstChild;\n\t\t\tvar i = 0;\n\t\t\twhile (child) {\n\t\t\t\tcs[i++] = child;\n\t\t\t\tchild = child.nextSibling;\n\t\t\t}\n\t\t\tcs.length = i;\n\t\t\tdelete cs[cs.length];\n\t\t}\n\t}\n}\n\n/**\n * Removes the connections between `parentNode` and `child`\n * and any existing `child.previousSibling` or `child.nextSibling`.\n *\n * @see https://github.com/xmldom/xmldom/issues/135\n * @see https://github.com/xmldom/xmldom/issues/145\n *\n * @param {Node} parentNode\n * @param {Node} child\n * @returns {Node} the child that was removed.\n * @private\n */\nfunction _removeChild (parentNode, child) {\n\tvar previous = child.previousSibling;\n\tvar next = child.nextSibling;\n\tif (previous) {\n\t\tprevious.nextSibling = next;\n\t} else {\n\t\tparentNode.firstChild = next;\n\t}\n\tif (next) {\n\t\tnext.previousSibling = previous;\n\t} else {\n\t\tparentNode.lastChild = previous;\n\t}\n\tchild.parentNode = null;\n\tchild.previousSibling = null;\n\tchild.nextSibling = null;\n\t_onUpdateChild(parentNode.ownerDocument, parentNode);\n\treturn child;\n}\n\n/**\n * Returns `true` if `node` can be a parent for insertion.\n * @param {Node} node\n * @returns {boolean}\n */\nfunction hasValidParentNodeType(node) {\n\treturn (\n\t\tnode &&\n\t\t(node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE)\n\t);\n}\n\n/**\n * Returns `true` if `node` can be inserted according to it's `nodeType`.\n * @param {Node} node\n * @returns {boolean}\n */\nfunction hasInsertableNodeType(node) {\n\treturn (\n\t\tnode &&\n\t\t(isElementNode(node) ||\n\t\t\tisTextNode(node) ||\n\t\t\tisDocTypeNode(node) ||\n\t\t\tnode.nodeType === Node.DOCUMENT_FRAGMENT_NODE ||\n\t\t\tnode.nodeType === Node.COMMENT_NODE ||\n\t\t\tnode.nodeType === Node.PROCESSING_INSTRUCTION_NODE)\n\t);\n}\n\n/**\n * Returns true if `node` is a DOCTYPE node\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isDocTypeNode(node) {\n\treturn node && node.nodeType === Node.DOCUMENT_TYPE_NODE;\n}\n\n/**\n * Returns true if the node is an element\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isElementNode(node) {\n\treturn node && node.nodeType === Node.ELEMENT_NODE;\n}\n/**\n * Returns true if `node` is a text node\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isTextNode(node) {\n\treturn node && node.nodeType === Node.TEXT_NODE;\n}\n\n/**\n * Check if en element node can be inserted before `child`, or at the end if child is falsy,\n * according to the presence and position of a doctype node on the same level.\n *\n * @param {Document} doc The document node\n * @param {Node} child the node that would become the nextSibling if the element would be inserted\n * @returns {boolean} `true` if an element can be inserted before child\n * @private\n * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction isElementInsertionPossible(doc, child) {\n\tvar parentChildNodes = doc.childNodes || [];\n\tif (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) {\n\t\treturn false;\n\t}\n\tvar docTypeNode = find(parentChildNodes, isDocTypeNode);\n\treturn !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));\n}\n\n/**\n * Check if en element node can be inserted before `child`, or at the end if child is falsy,\n * according to the presence and position of a doctype node on the same level.\n *\n * @param {Node} doc The document node\n * @param {Node} child the node that would become the nextSibling if the element would be inserted\n * @returns {boolean} `true` if an element can be inserted before child\n * @private\n * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction isElementReplacementPossible(doc, child) {\n\tvar parentChildNodes = doc.childNodes || [];\n\n\tfunction hasElementChildThatIsNotChild(node) {\n\t\treturn isElementNode(node) && node !== child;\n\t}\n\n\tif (find(parentChildNodes, hasElementChildThatIsNotChild)) {\n\t\treturn false;\n\t}\n\tvar docTypeNode = find(parentChildNodes, isDocTypeNode);\n\treturn !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));\n}\n\n/**\n * @private\n * Steps 1-5 of the checks before inserting and before replacing a child are the same.\n *\n * @param {Node} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node=} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreInsertionValidity1to5(parent, node, child) {\n\t// 1. If `parent` is not a Document, DocumentFragment, or Element node, then throw a \"HierarchyRequestError\" DOMException.\n\tif (!hasValidParentNodeType(parent)) {\n\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Unexpected parent node type ' + parent.nodeType);\n\t}\n\t// 2. If `node` is a host-including inclusive ancestor of `parent`, then throw a \"HierarchyRequestError\" DOMException.\n\t// not implemented!\n\t// 3. If `child` is non-null and its parent is not `parent`, then throw a \"NotFoundError\" DOMException.\n\tif (child && child.parentNode !== parent) {\n\t\tthrow new DOMException(NOT_FOUND_ERR, 'child not in parent');\n\t}\n\tif (\n\t\t// 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a \"HierarchyRequestError\" DOMException.\n\t\t!hasInsertableNodeType(node) ||\n\t\t// 5. If either `node` is a Text node and `parent` is a document,\n\t\t// the sax parser currently adds top level text nodes, this will be fixed in 0.9.0\n\t\t// || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE)\n\t\t// or `node` is a doctype and `parent` is not a document, then throw a \"HierarchyRequestError\" DOMException.\n\t\t(isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE)\n\t) {\n\t\tthrow new DOMException(\n\t\t\tHIERARCHY_REQUEST_ERR,\n\t\t\t'Unexpected node type ' + node.nodeType + ' for parent node type ' + parent.nodeType\n\t\t);\n\t}\n}\n\n/**\n * @private\n * Step 6 of the checks before inserting and before replacing a child are different.\n *\n * @param {Document} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node | undefined} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreInsertionValidityInDocument(parent, node, child) {\n\tvar parentChildNodes = parent.childNodes || [];\n\tvar nodeChildNodes = node.childNodes || [];\n\n\t// DocumentFragment\n\tif (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n\t\tvar nodeChildElements = nodeChildNodes.filter(isElementNode);\n\t\t// If node has more than one element child or has a Text node child.\n\t\tif (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');\n\t\t}\n\t\t// Otherwise, if `node` has one element child and either `parent` has an element child,\n\t\t// `child` is a doctype, or `child` is non-null and a doctype is following `child`.\n\t\tif (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');\n\t\t}\n\t}\n\t// Element\n\tif (isElementNode(node)) {\n\t\t// `parent` has an element child, `child` is a doctype,\n\t\t// or `child` is non-null and a doctype is following `child`.\n\t\tif (!isElementInsertionPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');\n\t\t}\n\t}\n\t// DocumentType\n\tif (isDocTypeNode(node)) {\n\t\t// `parent` has a doctype child,\n\t\tif (find(parentChildNodes, isDocTypeNode)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');\n\t\t}\n\t\tvar parentElementChild = find(parentChildNodes, isElementNode);\n\t\t// `child` is non-null and an element is preceding `child`,\n\t\tif (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');\n\t\t}\n\t\t// or `child` is null and `parent` has an element child.\n\t\tif (!child && parentElementChild) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can not be appended since element is present');\n\t\t}\n\t}\n}\n\n/**\n * @private\n * Step 6 of the checks before inserting and before replacing a child are different.\n *\n * @param {Document} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node | undefined} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreReplacementValidityInDocument(parent, node, child) {\n\tvar parentChildNodes = parent.childNodes || [];\n\tvar nodeChildNodes = node.childNodes || [];\n\n\t// DocumentFragment\n\tif (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n\t\tvar nodeChildElements = nodeChildNodes.filter(isElementNode);\n\t\t// If `node` has more than one element child or has a Text node child.\n\t\tif (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');\n\t\t}\n\t\t// Otherwise, if `node` has one element child and either `parent` has an element child that is not `child` or a doctype is following `child`.\n\t\tif (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');\n\t\t}\n\t}\n\t// Element\n\tif (isElementNode(node)) {\n\t\t// `parent` has an element child that is not `child` or a doctype is following `child`.\n\t\tif (!isElementReplacementPossible(parent, child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');\n\t\t}\n\t}\n\t// DocumentType\n\tif (isDocTypeNode(node)) {\n\t\tfunction hasDoctypeChildThatIsNotChild(node) {\n\t\t\treturn isDocTypeNode(node) && node !== child;\n\t\t}\n\n\t\t// `parent` has a doctype child that is not `child`,\n\t\tif (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');\n\t\t}\n\t\tvar parentElementChild = find(parentChildNodes, isElementNode);\n\t\t// or an element is preceding `child`.\n\t\tif (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {\n\t\t\tthrow new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');\n\t\t}\n\t}\n}\n\n/**\n * @private\n * @param {Node} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node=} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction _insertBefore(parent, node, child, _inDocumentAssertion) {\n\t// To ensure pre-insertion validity of a node into a parent before a child, run these steps:\n\tassertPreInsertionValidity1to5(parent, node, child);\n\n\t// If parent is a document, and any of the statements below, switched on the interface node implements,\n\t// are true, then throw a \"HierarchyRequestError\" DOMException.\n\tif (parent.nodeType === Node.DOCUMENT_NODE) {\n\t\t(_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);\n\t}\n\n\tvar cp = node.parentNode;\n\tif(cp){\n\t\tcp.removeChild(node);//remove and update\n\t}\n\tif(node.nodeType === DOCUMENT_FRAGMENT_NODE){\n\t\tvar newFirst = node.firstChild;\n\t\tif (newFirst == null) {\n\t\t\treturn node;\n\t\t}\n\t\tvar newLast = node.lastChild;\n\t}else{\n\t\tnewFirst = newLast = node;\n\t}\n\tvar pre = child ? child.previousSibling : parent.lastChild;\n\n\tnewFirst.previousSibling = pre;\n\tnewLast.nextSibling = child;\n\n\n\tif(pre){\n\t\tpre.nextSibling = newFirst;\n\t}else{\n\t\tparent.firstChild = newFirst;\n\t}\n\tif(child == null){\n\t\tparent.lastChild = newLast;\n\t}else{\n\t\tchild.previousSibling = newLast;\n\t}\n\tdo{\n\t\tnewFirst.parentNode = parent;\n\t}while(newFirst !== newLast && (newFirst= newFirst.nextSibling))\n\t_onUpdateChild(parent.ownerDocument||parent, parent);\n\t//console.log(parent.lastChild.nextSibling == null)\n\tif (node.nodeType == DOCUMENT_FRAGMENT_NODE) {\n\t\tnode.firstChild = node.lastChild = null;\n\t}\n\treturn node;\n}\n\n/**\n * Appends `newChild` to `parentNode`.\n * If `newChild` is already connected to a `parentNode` it is first removed from it.\n *\n * @see https://github.com/xmldom/xmldom/issues/135\n * @see https://github.com/xmldom/xmldom/issues/145\n * @param {Node} parentNode\n * @param {Node} newChild\n * @returns {Node}\n * @private\n */\nfunction _appendSingleChild (parentNode, newChild) {\n\tif (newChild.parentNode) {\n\t\tnewChild.parentNode.removeChild(newChild);\n\t}\n\tnewChild.parentNode = parentNode;\n\tnewChild.previousSibling = parentNode.lastChild;\n\tnewChild.nextSibling = null;\n\tif (newChild.previousSibling) {\n\t\tnewChild.previousSibling.nextSibling = newChild;\n\t} else {\n\t\tparentNode.firstChild = newChild;\n\t}\n\tparentNode.lastChild = newChild;\n\t_onUpdateChild(parentNode.ownerDocument, parentNode, newChild);\n\treturn newChild;\n}\n\nDocument.prototype = {\n\t//implementation : null,\n\tnodeName : '#document',\n\tnodeType : DOCUMENT_NODE,\n\t/**\n\t * The DocumentType node of the document.\n\t *\n\t * @readonly\n\t * @type DocumentType\n\t */\n\tdoctype : null,\n\tdocumentElement : null,\n\t_inc : 1,\n\n\tinsertBefore : function(newChild, refChild){//raises\n\t\tif(newChild.nodeType == DOCUMENT_FRAGMENT_NODE){\n\t\t\tvar child = newChild.firstChild;\n\t\t\twhile(child){\n\t\t\t\tvar next = child.nextSibling;\n\t\t\t\tthis.insertBefore(child,refChild);\n\t\t\t\tchild = next;\n\t\t\t}\n\t\t\treturn newChild;\n\t\t}\n\t\t_insertBefore(this, newChild, refChild);\n\t\tnewChild.ownerDocument = this;\n\t\tif (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {\n\t\t\tthis.documentElement = newChild;\n\t\t}\n\n\t\treturn newChild;\n\t},\n\tremoveChild : function(oldChild){\n\t\tif(this.documentElement == oldChild){\n\t\t\tthis.documentElement = null;\n\t\t}\n\t\treturn _removeChild(this,oldChild);\n\t},\n\treplaceChild: function (newChild, oldChild) {\n\t\t//raises\n\t\t_insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);\n\t\tnewChild.ownerDocument = this;\n\t\tif (oldChild) {\n\t\t\tthis.removeChild(oldChild);\n\t\t}\n\t\tif (isElementNode(newChild)) {\n\t\t\tthis.documentElement = newChild;\n\t\t}\n\t},\n\t// Introduced in DOM Level 2:\n\timportNode : function(importedNode,deep){\n\t\treturn importNode(this,importedNode,deep);\n\t},\n\t// Introduced in DOM Level 2:\n\tgetElementById :\tfunction(id){\n\t\tvar rtv = null;\n\t\t_visitNode(this.documentElement,function(node){\n\t\t\tif(node.nodeType == ELEMENT_NODE){\n\t\t\t\tif(node.getAttribute('id') == id){\n\t\t\t\t\trtv = node;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\treturn rtv;\n\t},\n\n\t/**\n\t * The `getElementsByClassName` method of `Document` interface returns an array-like object\n\t * of all child elements which have **all** of the given class name(s).\n\t *\n\t * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.\n\t *\n\t *\n\t * Warning: This is a live LiveNodeList.\n\t * Changes in the DOM will reflect in the array as the changes occur.\n\t * If an element selected by this array no longer qualifies for the selector,\n\t * it will automatically be removed. Be aware of this for iteration purposes.\n\t *\n\t * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName\n\t * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname\n\t */\n\tgetElementsByClassName: function(classNames) {\n\t\tvar classNamesSet = toOrderedSet(classNames)\n\t\treturn new LiveNodeList(this, function(base) {\n\t\t\tvar ls = [];\n\t\t\tif (classNamesSet.length > 0) {\n\t\t\t\t_visitNode(base.documentElement, function(node) {\n\t\t\t\t\tif(node !== base && node.nodeType === ELEMENT_NODE) {\n\t\t\t\t\t\tvar nodeClassNames = node.getAttribute('class')\n\t\t\t\t\t\t// can be null if the attribute does not exist\n\t\t\t\t\t\tif (nodeClassNames) {\n\t\t\t\t\t\t\t// before splitting and iterating just compare them for the most common case\n\t\t\t\t\t\t\tvar matches = classNames === nodeClassNames;\n\t\t\t\t\t\t\tif (!matches) {\n\t\t\t\t\t\t\t\tvar nodeClassNamesSet = toOrderedSet(nodeClassNames)\n\t\t\t\t\t\t\t\tmatches = classNamesSet.every(arrayIncludes(nodeClassNamesSet))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif(matches) {\n\t\t\t\t\t\t\t\tls.push(node);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn ls;\n\t\t});\n\t},\n\n\t//document factory method:\n\tcreateElement :\tfunction(tagName){\n\t\tvar node = new Element();\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = tagName;\n\t\tnode.tagName = tagName;\n\t\tnode.localName = tagName;\n\t\tnode.childNodes = new NodeList();\n\t\tvar attrs\t= node.attributes = new NamedNodeMap();\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\tcreateDocumentFragment :\tfunction(){\n\t\tvar node = new DocumentFragment();\n\t\tnode.ownerDocument = this;\n\t\tnode.childNodes = new NodeList();\n\t\treturn node;\n\t},\n\tcreateTextNode :\tfunction(data){\n\t\tvar node = new Text();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data)\n\t\treturn node;\n\t},\n\tcreateComment :\tfunction(data){\n\t\tvar node = new Comment();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data)\n\t\treturn node;\n\t},\n\tcreateCDATASection :\tfunction(data){\n\t\tvar node = new CDATASection();\n\t\tnode.ownerDocument = this;\n\t\tnode.appendData(data)\n\t\treturn node;\n\t},\n\tcreateProcessingInstruction :\tfunction(target,data){\n\t\tvar node = new ProcessingInstruction();\n\t\tnode.ownerDocument = this;\n\t\tnode.tagName = node.nodeName = node.target = target;\n\t\tnode.nodeValue = node.data = data;\n\t\treturn node;\n\t},\n\tcreateAttribute :\tfunction(name){\n\t\tvar node = new Attr();\n\t\tnode.ownerDocument\t= this;\n\t\tnode.name = name;\n\t\tnode.nodeName\t= name;\n\t\tnode.localName = name;\n\t\tnode.specified = true;\n\t\treturn node;\n\t},\n\tcreateEntityReference :\tfunction(name){\n\t\tvar node = new EntityReference();\n\t\tnode.ownerDocument\t= this;\n\t\tnode.nodeName\t= name;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\tcreateElementNS :\tfunction(namespaceURI,qualifiedName){\n\t\tvar node = new Element();\n\t\tvar pl = qualifiedName.split(':');\n\t\tvar attrs\t= node.attributes = new NamedNodeMap();\n\t\tnode.childNodes = new NodeList();\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.tagName = qualifiedName;\n\t\tnode.namespaceURI = namespaceURI;\n\t\tif(pl.length == 2){\n\t\t\tnode.prefix = pl[0];\n\t\t\tnode.localName = pl[1];\n\t\t}else{\n\t\t\t//el.prefix = null;\n\t\t\tnode.localName = qualifiedName;\n\t\t}\n\t\tattrs._ownerElement = node;\n\t\treturn node;\n\t},\n\t// Introduced in DOM Level 2:\n\tcreateAttributeNS :\tfunction(namespaceURI,qualifiedName){\n\t\tvar node = new Attr();\n\t\tvar pl = qualifiedName.split(':');\n\t\tnode.ownerDocument = this;\n\t\tnode.nodeName = qualifiedName;\n\t\tnode.name = qualifiedName;\n\t\tnode.namespaceURI = namespaceURI;\n\t\tnode.specified = true;\n\t\tif(pl.length == 2){\n\t\t\tnode.prefix = pl[0];\n\t\t\tnode.localName = pl[1];\n\t\t}else{\n\t\t\t//el.prefix = null;\n\t\t\tnode.localName = qualifiedName;\n\t\t}\n\t\treturn node;\n\t}\n};\n_extends(Document,Node);\n\n\nfunction Element() {\n\tthis._nsMap = {};\n};\nElement.prototype = {\n\tnodeType : ELEMENT_NODE,\n\thasAttribute : function(name){\n\t\treturn this.getAttributeNode(name)!=null;\n\t},\n\tgetAttribute : function(name){\n\t\tvar attr = this.getAttributeNode(name);\n\t\treturn attr && attr.value || '';\n\t},\n\tgetAttributeNode : function(name){\n\t\treturn this.attributes.getNamedItem(name);\n\t},\n\tsetAttribute : function(name, value){\n\t\tvar attr = this.ownerDocument.createAttribute(name);\n\t\tattr.value = attr.nodeValue = \"\" + value;\n\t\tthis.setAttributeNode(attr)\n\t},\n\tremoveAttribute : function(name){\n\t\tvar attr = this.getAttributeNode(name)\n\t\tattr && this.removeAttributeNode(attr);\n\t},\n\n\t//four real opeartion method\n\tappendChild:function(newChild){\n\t\tif(newChild.nodeType === DOCUMENT_FRAGMENT_NODE){\n\t\t\treturn this.insertBefore(newChild,null);\n\t\t}else{\n\t\t\treturn _appendSingleChild(this,newChild);\n\t\t}\n\t},\n\tsetAttributeNode : function(newAttr){\n\t\treturn this.attributes.setNamedItem(newAttr);\n\t},\n\tsetAttributeNodeNS : function(newAttr){\n\t\treturn this.attributes.setNamedItemNS(newAttr);\n\t},\n\tremoveAttributeNode : function(oldAttr){\n\t\t//console.log(this == oldAttr.ownerElement)\n\t\treturn this.attributes.removeNamedItem(oldAttr.nodeName);\n\t},\n\t//get real attribute name,and remove it by removeAttributeNode\n\tremoveAttributeNS : function(namespaceURI, localName){\n\t\tvar old = this.getAttributeNodeNS(namespaceURI, localName);\n\t\told && this.removeAttributeNode(old);\n\t},\n\n\thasAttributeNS : function(namespaceURI, localName){\n\t\treturn this.getAttributeNodeNS(namespaceURI, localName)!=null;\n\t},\n\tgetAttributeNS : function(namespaceURI, localName){\n\t\tvar attr = this.getAttributeNodeNS(namespaceURI, localName);\n\t\treturn attr && attr.value || '';\n\t},\n\tsetAttributeNS : function(namespaceURI, qualifiedName, value){\n\t\tvar attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);\n\t\tattr.value = attr.nodeValue = \"\" + value;\n\t\tthis.setAttributeNode(attr)\n\t},\n\tgetAttributeNodeNS : function(namespaceURI, localName){\n\t\treturn this.attributes.getNamedItemNS(namespaceURI, localName);\n\t},\n\n\tgetElementsByTagName : function(tagName){\n\t\treturn new LiveNodeList(this,function(base){\n\t\t\tvar ls = [];\n\t\t\t_visitNode(base,function(node){\n\t\t\t\tif(node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)){\n\t\t\t\t\tls.push(node);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn ls;\n\t\t});\n\t},\n\tgetElementsByTagNameNS : function(namespaceURI, localName){\n\t\treturn new LiveNodeList(this,function(base){\n\t\t\tvar ls = [];\n\t\t\t_visitNode(base,function(node){\n\t\t\t\tif(node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)){\n\t\t\t\t\tls.push(node);\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn ls;\n\n\t\t});\n\t}\n};\nDocument.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;\nDocument.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;\n\n\n_extends(Element,Node);\nfunction Attr() {\n};\nAttr.prototype.nodeType = ATTRIBUTE_NODE;\n_extends(Attr,Node);\n\n\nfunction CharacterData() {\n};\nCharacterData.prototype = {\n\tdata : '',\n\tsubstringData : function(offset, count) {\n\t\treturn this.data.substring(offset, offset+count);\n\t},\n\tappendData: function(text) {\n\t\ttext = this.data+text;\n\t\tthis.nodeValue = this.data = text;\n\t\tthis.length = text.length;\n\t},\n\tinsertData: function(offset,text) {\n\t\tthis.replaceData(offset,0,text);\n\n\t},\n\tappendChild:function(newChild){\n\t\tthrow new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR])\n\t},\n\tdeleteData: function(offset, count) {\n\t\tthis.replaceData(offset,count,\"\");\n\t},\n\treplaceData: function(offset, count, text) {\n\t\tvar start = this.data.substring(0,offset);\n\t\tvar end = this.data.substring(offset+count);\n\t\ttext = start + text + end;\n\t\tthis.nodeValue = this.data = text;\n\t\tthis.length = text.length;\n\t}\n}\n_extends(CharacterData,Node);\nfunction Text() {\n};\nText.prototype = {\n\tnodeName : \"#text\",\n\tnodeType : TEXT_NODE,\n\tsplitText : function(offset) {\n\t\tvar text = this.data;\n\t\tvar newText = text.substring(offset);\n\t\ttext = text.substring(0, offset);\n\t\tthis.data = this.nodeValue = text;\n\t\tthis.length = text.length;\n\t\tvar newNode = this.ownerDocument.createTextNode(newText);\n\t\tif(this.parentNode){\n\t\t\tthis.parentNode.insertBefore(newNode, this.nextSibling);\n\t\t}\n\t\treturn newNode;\n\t}\n}\n_extends(Text,CharacterData);\nfunction Comment() {\n};\nComment.prototype = {\n\tnodeName : \"#comment\",\n\tnodeType : COMMENT_NODE\n}\n_extends(Comment,CharacterData);\n\nfunction CDATASection() {\n};\nCDATASection.prototype = {\n\tnodeName : \"#cdata-section\",\n\tnodeType : CDATA_SECTION_NODE\n}\n_extends(CDATASection,CharacterData);\n\n\nfunction DocumentType() {\n};\nDocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;\n_extends(DocumentType,Node);\n\nfunction Notation() {\n};\nNotation.prototype.nodeType = NOTATION_NODE;\n_extends(Notation,Node);\n\nfunction Entity() {\n};\nEntity.prototype.nodeType = ENTITY_NODE;\n_extends(Entity,Node);\n\nfunction EntityReference() {\n};\nEntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;\n_extends(EntityReference,Node);\n\nfunction DocumentFragment() {\n};\nDocumentFragment.prototype.nodeName =\t\"#document-fragment\";\nDocumentFragment.prototype.nodeType =\tDOCUMENT_FRAGMENT_NODE;\n_extends(DocumentFragment,Node);\n\n\nfunction ProcessingInstruction() {\n}\nProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;\n_extends(ProcessingInstruction,Node);\nfunction XMLSerializer(){}\nXMLSerializer.prototype.serializeToString = function(node,isHtml,nodeFilter){\n\treturn nodeSerializeToString.call(node,isHtml,nodeFilter);\n}\nNode.prototype.toString = nodeSerializeToString;\nfunction nodeSerializeToString(isHtml,nodeFilter){\n\tvar buf = [];\n\tvar refNode = this.nodeType == 9 && this.documentElement || this;\n\tvar prefix = refNode.prefix;\n\tvar uri = refNode.namespaceURI;\n\n\tif(uri && prefix == null){\n\t\t//console.log(prefix)\n\t\tvar prefix = refNode.lookupPrefix(uri);\n\t\tif(prefix == null){\n\t\t\t//isHTML = true;\n\t\t\tvar visibleNamespaces=[\n\t\t\t{namespace:uri,prefix:null}\n\t\t\t//{namespace:uri,prefix:''}\n\t\t\t]\n\t\t}\n\t}\n\tserializeToString(this,buf,isHtml,nodeFilter,visibleNamespaces);\n\t//console.log('###',this.nodeType,uri,prefix,buf.join(''))\n\treturn buf.join('');\n}\n\nfunction needNamespaceDefine(node, isHTML, visibleNamespaces) {\n\tvar prefix = node.prefix || '';\n\tvar uri = node.namespaceURI;\n\t// According to [Namespaces in XML 1.0](https://www.w3.org/TR/REC-xml-names/#ns-using) ,\n\t// and more specifically https://www.w3.org/TR/REC-xml-names/#nsc-NoPrefixUndecl :\n\t// > In a namespace declaration for a prefix [...], the attribute value MUST NOT be empty.\n\t// in a similar manner [Namespaces in XML 1.1](https://www.w3.org/TR/xml-names11/#ns-using)\n\t// and more specifically https://www.w3.org/TR/xml-names11/#nsc-NSDeclared :\n\t// > [...] Furthermore, the attribute value [...] must not be an empty string.\n\t// so serializing empty namespace value like xmlns:ds=\"\" would produce an invalid XML document.\n\tif (!uri) {\n\t\treturn false;\n\t}\n\tif (prefix === \"xml\" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {\n\t\treturn false;\n\t}\n\n\tvar i = visibleNamespaces.length\n\twhile (i--) {\n\t\tvar ns = visibleNamespaces[i];\n\t\t// get namespace prefix\n\t\tif (ns.prefix === prefix) {\n\t\t\treturn ns.namespace !== uri;\n\t\t}\n\t}\n\treturn true;\n}\n/**\n * Well-formed constraint: No < in Attribute Values\n * > The replacement text of any entity referred to directly or indirectly\n * > in an attribute value must not contain a <.\n * @see https://www.w3.org/TR/xml11/#CleanAttrVals\n * @see https://www.w3.org/TR/xml11/#NT-AttValue\n *\n * Literal whitespace other than space that appear in attribute values\n * are serialized as their entity references, so they will be preserved.\n * (In contrast to whitespace literals in the input which are normalized to spaces)\n * @see https://www.w3.org/TR/xml11/#AVNormalize\n * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes\n */\nfunction addSerializedAttribute(buf, qualifiedName, value) {\n\tbuf.push(' ', qualifiedName, '=\"', value.replace(/[<>&\"\\t\\n\\r]/g, _xmlEncoder), '\"')\n}\n\nfunction serializeToString(node,buf,isHTML,nodeFilter,visibleNamespaces){\n\tif (!visibleNamespaces) {\n\t\tvisibleNamespaces = [];\n\t}\n\n\tif(nodeFilter){\n\t\tnode = nodeFilter(node);\n\t\tif(node){\n\t\t\tif(typeof node == 'string'){\n\t\t\t\tbuf.push(node);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}else{\n\t\t\treturn;\n\t\t}\n\t\t//buf.sort.apply(attrs, attributeSorter);\n\t}\n\n\tswitch(node.nodeType){\n\tcase ELEMENT_NODE:\n\t\tvar attrs = node.attributes;\n\t\tvar len = attrs.length;\n\t\tvar child = node.firstChild;\n\t\tvar nodeName = node.tagName;\n\n\t\tisHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML\n\n\t\tvar prefixedNodeName = nodeName\n\t\tif (!isHTML && !node.prefix && node.namespaceURI) {\n\t\t\tvar defaultNS\n\t\t\t// lookup current default ns from `xmlns` attribute\n\t\t\tfor (var ai = 0; ai < attrs.length; ai++) {\n\t\t\t\tif (attrs.item(ai).name === 'xmlns') {\n\t\t\t\t\tdefaultNS = attrs.item(ai).value\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!defaultNS) {\n\t\t\t\t// lookup current default ns in visibleNamespaces\n\t\t\t\tfor (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n\t\t\t\t\tvar namespace = visibleNamespaces[nsi]\n\t\t\t\t\tif (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {\n\t\t\t\t\t\tdefaultNS = namespace.namespace\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (defaultNS !== node.namespaceURI) {\n\t\t\t\tfor (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n\t\t\t\t\tvar namespace = visibleNamespaces[nsi]\n\t\t\t\t\tif (namespace.namespace === node.namespaceURI) {\n\t\t\t\t\t\tif (namespace.prefix) {\n\t\t\t\t\t\t\tprefixedNodeName = namespace.prefix + ':' + nodeName\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tbuf.push('<', prefixedNodeName);\n\n\t\tfor(var i=0;i<len;i++){\n\t\t\t// add namespaces for attributes\n\t\t\tvar attr = attrs.item(i);\n\t\t\tif (attr.prefix == 'xmlns') {\n\t\t\t\tvisibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });\n\t\t\t}else if(attr.nodeName == 'xmlns'){\n\t\t\t\tvisibleNamespaces.push({ prefix: '', namespace: attr.value });\n\t\t\t}\n\t\t}\n\n\t\tfor(var i=0;i<len;i++){\n\t\t\tvar attr = attrs.item(i);\n\t\t\tif (needNamespaceDefine(attr,isHTML, visibleNamespaces)) {\n\t\t\t\tvar prefix = attr.prefix||'';\n\t\t\t\tvar uri = attr.namespaceURI;\n\t\t\t\taddSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : \"xmlns\", uri);\n\t\t\t\tvisibleNamespaces.push({ prefix: prefix, namespace:uri });\n\t\t\t}\n\t\t\tserializeToString(attr,buf,isHTML,nodeFilter,visibleNamespaces);\n\t\t}\n\n\t\t// add namespace for current node\n\t\tif (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {\n\t\t\tvar prefix = node.prefix||'';\n\t\t\tvar uri = node.namespaceURI;\n\t\t\taddSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : \"xmlns\", uri);\n\t\t\tvisibleNamespaces.push({ prefix: prefix, namespace:uri });\n\t\t}\n\n\t\tif(child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)){\n\t\t\tbuf.push('>');\n\t\t\t//if is cdata child node\n\t\t\tif(isHTML && /^script$/i.test(nodeName)){\n\t\t\t\twhile(child){\n\t\t\t\t\tif(child.data){\n\t\t\t\t\t\tbuf.push(child.data);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n\t\t\t\t\t}\n\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t}\n\t\t\t}else\n\t\t\t{\n\t\t\t\twhile(child){\n\t\t\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n\t\t\t\t\tchild = child.nextSibling;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuf.push('</',prefixedNodeName,'>');\n\t\t}else{\n\t\t\tbuf.push('/>');\n\t\t}\n\t\t// remove added visible namespaces\n\t\t//visibleNamespaces.length = startVisibleNamespaces;\n\t\treturn;\n\tcase DOCUMENT_NODE:\n\tcase DOCUMENT_FRAGMENT_NODE:\n\t\tvar child = node.firstChild;\n\t\twhile(child){\n\t\t\tserializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n\t\t\tchild = child.nextSibling;\n\t\t}\n\t\treturn;\n\tcase ATTRIBUTE_NODE:\n\t\treturn addSerializedAttribute(buf, node.name, node.value);\n\tcase TEXT_NODE:\n\t\t/**\n\t\t * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,\n\t\t * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.\n\t\t * If they are needed elsewhere, they must be escaped using either numeric character references or the strings\n\t\t * `&` and `<` respectively.\n\t\t * The right angle bracket (>) may be represented using the string \" > \", and must, for compatibility,\n\t\t * be escaped using either `>` or a character reference when it appears in the string `]]>` in content,\n\t\t * when that string is not marking the end of a CDATA section.\n\t\t *\n\t\t * In the content of elements, character data is any string of characters\n\t\t * which does not contain the start-delimiter of any markup\n\t\t * and does not include the CDATA-section-close delimiter, `]]>`.\n\t\t *\n\t\t * @see https://www.w3.org/TR/xml/#NT-CharData\n\t\t * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node\n\t\t */\n\t\treturn buf.push(node.data\n\t\t\t.replace(/[<&>]/g,_xmlEncoder)\n\t\t);\n\tcase CDATA_SECTION_NODE:\n\t\treturn buf.push( '<![CDATA[',node.data,']]>');\n\tcase COMMENT_NODE:\n\t\treturn buf.push( \"\x3c!--\",node.data,\"--\x3e\");\n\tcase DOCUMENT_TYPE_NODE:\n\t\tvar pubid = node.publicId;\n\t\tvar sysid = node.systemId;\n\t\tbuf.push('<!DOCTYPE ',node.name);\n\t\tif(pubid){\n\t\t\tbuf.push(' PUBLIC ', pubid);\n\t\t\tif (sysid && sysid!='.') {\n\t\t\t\tbuf.push(' ', sysid);\n\t\t\t}\n\t\t\tbuf.push('>');\n\t\t}else if(sysid && sysid!='.'){\n\t\t\tbuf.push(' SYSTEM ', sysid, '>');\n\t\t}else{\n\t\t\tvar sub = node.internalSubset;\n\t\t\tif(sub){\n\t\t\t\tbuf.push(\" [\",sub,\"]\");\n\t\t\t}\n\t\t\tbuf.push(\">\");\n\t\t}\n\t\treturn;\n\tcase PROCESSING_INSTRUCTION_NODE:\n\t\treturn buf.push( \"<?\",node.target,\" \",node.data,\"?>\");\n\tcase ENTITY_REFERENCE_NODE:\n\t\treturn buf.push( '&',node.nodeName,';');\n\t//case ENTITY_NODE:\n\t//case NOTATION_NODE:\n\tdefault:\n\t\tbuf.push('??',node.nodeName);\n\t}\n}\nfunction importNode(doc,node,deep){\n\tvar node2;\n\tswitch (node.nodeType) {\n\tcase ELEMENT_NODE:\n\t\tnode2 = node.cloneNode(false);\n\t\tnode2.ownerDocument = doc;\n\t\t//var attrs = node2.attributes;\n\t\t//var len = attrs.length;\n\t\t//for(var i=0;i<len;i++){\n\t\t\t//node2.setAttributeNodeNS(importNode(doc,attrs.item(i),deep));\n\t\t//}\n\tcase DOCUMENT_FRAGMENT_NODE:\n\t\tbreak;\n\tcase ATTRIBUTE_NODE:\n\t\tdeep = true;\n\t\tbreak;\n\t//case ENTITY_REFERENCE_NODE:\n\t//case PROCESSING_INSTRUCTION_NODE:\n\t////case TEXT_NODE:\n\t//case CDATA_SECTION_NODE:\n\t//case COMMENT_NODE:\n\t//\tdeep = false;\n\t//\tbreak;\n\t//case DOCUMENT_NODE:\n\t//case DOCUMENT_TYPE_NODE:\n\t//cannot be imported.\n\t//case ENTITY_NODE:\n\t//case NOTATION_NODE:\n\t//can not hit in level3\n\t//default:throw e;\n\t}\n\tif(!node2){\n\t\tnode2 = node.cloneNode(false);//false\n\t}\n\tnode2.ownerDocument = doc;\n\tnode2.parentNode = null;\n\tif(deep){\n\t\tvar child = node.firstChild;\n\t\twhile(child){\n\t\t\tnode2.appendChild(importNode(doc,child,deep));\n\t\t\tchild = child.nextSibling;\n\t\t}\n\t}\n\treturn node2;\n}\n//\n//var _relationMap = {firstChild:1,lastChild:1,previousSibling:1,nextSibling:1,\n//\t\t\t\t\tattributes:1,childNodes:1,parentNode:1,documentElement:1,doctype,};\nfunction cloneNode(doc,node,deep){\n\tvar node2 = new node.constructor();\n\tfor (var n in node) {\n\t\tif (Object.prototype.hasOwnProperty.call(node, n)) {\n\t\t\tvar v = node[n];\n\t\t\tif (typeof v != \"object\") {\n\t\t\t\tif (v != node2[n]) {\n\t\t\t\t\tnode2[n] = v;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(node.childNodes){\n\t\tnode2.childNodes = new NodeList();\n\t}\n\tnode2.ownerDocument = doc;\n\tswitch (node2.nodeType) {\n\tcase ELEMENT_NODE:\n\t\tvar attrs\t= node.attributes;\n\t\tvar attrs2\t= node2.attributes = new NamedNodeMap();\n\t\tvar len = attrs.length\n\t\tattrs2._ownerElement = node2;\n\t\tfor(var i=0;i<len;i++){\n\t\t\tnode2.setAttributeNode(cloneNode(doc,attrs.item(i),true));\n\t\t}\n\t\tbreak;;\n\tcase ATTRIBUTE_NODE:\n\t\tdeep = true;\n\t}\n\tif(deep){\n\t\tvar child = node.firstChild;\n\t\twhile(child){\n\t\t\tnode2.appendChild(cloneNode(doc,child,deep));\n\t\t\tchild = child.nextSibling;\n\t\t}\n\t}\n\treturn node2;\n}\n\nfunction __set__(object,key,value){\n\tobject[key] = value\n}\n//do dynamic\ntry{\n\tif(Object.defineProperty){\n\t\tObject.defineProperty(LiveNodeList.prototype,'length',{\n\t\t\tget:function(){\n\t\t\t\t_updateLiveList(this);\n\t\t\t\treturn this.$$length;\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(Node.prototype,'textContent',{\n\t\t\tget:function(){\n\t\t\t\treturn getTextContent(this);\n\t\t\t},\n\n\t\t\tset:function(data){\n\t\t\t\tswitch(this.nodeType){\n\t\t\t\tcase ELEMENT_NODE:\n\t\t\t\tcase DOCUMENT_FRAGMENT_NODE:\n\t\t\t\t\twhile(this.firstChild){\n\t\t\t\t\t\tthis.removeChild(this.firstChild);\n\t\t\t\t\t}\n\t\t\t\t\tif(data || String(data)){\n\t\t\t\t\t\tthis.appendChild(this.ownerDocument.createTextNode(data));\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\tdefault:\n\t\t\t\t\tthis.data = data;\n\t\t\t\t\tthis.value = data;\n\t\t\t\t\tthis.nodeValue = data;\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\tfunction getTextContent(node){\n\t\t\tswitch(node.nodeType){\n\t\t\tcase ELEMENT_NODE:\n\t\t\tcase DOCUMENT_FRAGMENT_NODE:\n\t\t\t\tvar buf = [];\n\t\t\t\tnode = node.firstChild;\n\t\t\t\twhile(node){\n\t\t\t\t\tif(node.nodeType!==7 && node.nodeType !==8){\n\t\t\t\t\t\tbuf.push(getTextContent(node));\n\t\t\t\t\t}\n\t\t\t\t\tnode = node.nextSibling;\n\t\t\t\t}\n\t\t\t\treturn buf.join('');\n\t\t\tdefault:\n\t\t\t\treturn node.nodeValue;\n\t\t\t}\n\t\t}\n\n\t\t__set__ = function(object,key,value){\n\t\t\t//console.log(value)\n\t\t\tobject['$$'+key] = value\n\t\t}\n\t}\n}catch(e){//ie8\n}\n\n//if(typeof require == 'function'){\n\texports.DocumentType = DocumentType;\n\texports.DOMException = DOMException;\n\texports.DOMImplementation = DOMImplementation;\n\texports.Element = Element;\n\texports.Node = Node;\n\texports.NodeList = NodeList;\n\texports.XMLSerializer = XMLSerializer;\n//}\n\n\n//# sourceURL=webpack://web/./node_modules/@xmldom/xmldom/lib/dom.js?")},"./node_modules/@xmldom/xmldom/lib/entities.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\n\nvar freeze = (__webpack_require__(/*! ./conventions */ \"./node_modules/@xmldom/xmldom/lib/conventions.js\").freeze);\n\n/**\n * The entities that are predefined in every XML document.\n *\n * @see https://www.w3.org/TR/2006/REC-xml11-20060816/#sec-predefined-ent W3C XML 1.1\n * @see https://www.w3.org/TR/2008/REC-xml-20081126/#sec-predefined-ent W3C XML 1.0\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Predefined_entities_in_XML Wikipedia\n */\nexports.XML_ENTITIES = freeze({\n\tamp: '&',\n\tapos: \"'\",\n\tgt: '>',\n\tlt: '<',\n\tquot: '\"',\n});\n\n/**\n * A map of all entities that are detected in an HTML document.\n * They contain all entries from `XML_ENTITIES`.\n *\n * @see XML_ENTITIES\n * @see DOMParser.parseFromString\n * @see DOMImplementation.prototype.createHTMLDocument\n * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec\n * @see https://html.spec.whatwg.org/entities.json JSON\n * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names\n * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)\n */\nexports.HTML_ENTITIES = freeze({\n\tAacute: '\\u00C1',\n\taacute: '\\u00E1',\n\tAbreve: '\\u0102',\n\tabreve: '\\u0103',\n\tac: '\\u223E',\n\tacd: '\\u223F',\n\tacE: '\\u223E\\u0333',\n\tAcirc: '\\u00C2',\n\tacirc: '\\u00E2',\n\tacute: '\\u00B4',\n\tAcy: '\\u0410',\n\tacy: '\\u0430',\n\tAElig: '\\u00C6',\n\taelig: '\\u00E6',\n\taf: '\\u2061',\n\tAfr: '\\uD835\\uDD04',\n\tafr: '\\uD835\\uDD1E',\n\tAgrave: '\\u00C0',\n\tagrave: '\\u00E0',\n\talefsym: '\\u2135',\n\taleph: '\\u2135',\n\tAlpha: '\\u0391',\n\talpha: '\\u03B1',\n\tAmacr: '\\u0100',\n\tamacr: '\\u0101',\n\tamalg: '\\u2A3F',\n\tAMP: '\\u0026',\n\tamp: '\\u0026',\n\tAnd: '\\u2A53',\n\tand: '\\u2227',\n\tandand: '\\u2A55',\n\tandd: '\\u2A5C',\n\tandslope: '\\u2A58',\n\tandv: '\\u2A5A',\n\tang: '\\u2220',\n\tange: '\\u29A4',\n\tangle: '\\u2220',\n\tangmsd: '\\u2221',\n\tangmsdaa: '\\u29A8',\n\tangmsdab: '\\u29A9',\n\tangmsdac: '\\u29AA',\n\tangmsdad: '\\u29AB',\n\tangmsdae: '\\u29AC',\n\tangmsdaf: '\\u29AD',\n\tangmsdag: '\\u29AE',\n\tangmsdah: '\\u29AF',\n\tangrt: '\\u221F',\n\tangrtvb: '\\u22BE',\n\tangrtvbd: '\\u299D',\n\tangsph: '\\u2222',\n\tangst: '\\u00C5',\n\tangzarr: '\\u237C',\n\tAogon: '\\u0104',\n\taogon: '\\u0105',\n\tAopf: '\\uD835\\uDD38',\n\taopf: '\\uD835\\uDD52',\n\tap: '\\u2248',\n\tapacir: '\\u2A6F',\n\tapE: '\\u2A70',\n\tape: '\\u224A',\n\tapid: '\\u224B',\n\tapos: '\\u0027',\n\tApplyFunction: '\\u2061',\n\tapprox: '\\u2248',\n\tapproxeq: '\\u224A',\n\tAring: '\\u00C5',\n\taring: '\\u00E5',\n\tAscr: '\\uD835\\uDC9C',\n\tascr: '\\uD835\\uDCB6',\n\tAssign: '\\u2254',\n\tast: '\\u002A',\n\tasymp: '\\u2248',\n\tasympeq: '\\u224D',\n\tAtilde: '\\u00C3',\n\tatilde: '\\u00E3',\n\tAuml: '\\u00C4',\n\tauml: '\\u00E4',\n\tawconint: '\\u2233',\n\tawint: '\\u2A11',\n\tbackcong: '\\u224C',\n\tbackepsilon: '\\u03F6',\n\tbackprime: '\\u2035',\n\tbacksim: '\\u223D',\n\tbacksimeq: '\\u22CD',\n\tBackslash: '\\u2216',\n\tBarv: '\\u2AE7',\n\tbarvee: '\\u22BD',\n\tBarwed: '\\u2306',\n\tbarwed: '\\u2305',\n\tbarwedge: '\\u2305',\n\tbbrk: '\\u23B5',\n\tbbrktbrk: '\\u23B6',\n\tbcong: '\\u224C',\n\tBcy: '\\u0411',\n\tbcy: '\\u0431',\n\tbdquo: '\\u201E',\n\tbecaus: '\\u2235',\n\tBecause: '\\u2235',\n\tbecause: '\\u2235',\n\tbemptyv: '\\u29B0',\n\tbepsi: '\\u03F6',\n\tbernou: '\\u212C',\n\tBernoullis: '\\u212C',\n\tBeta: '\\u0392',\n\tbeta: '\\u03B2',\n\tbeth: '\\u2136',\n\tbetween: '\\u226C',\n\tBfr: '\\uD835\\uDD05',\n\tbfr: '\\uD835\\uDD1F',\n\tbigcap: '\\u22C2',\n\tbigcirc: '\\u25EF',\n\tbigcup: '\\u22C3',\n\tbigodot: '\\u2A00',\n\tbigoplus: '\\u2A01',\n\tbigotimes: '\\u2A02',\n\tbigsqcup: '\\u2A06',\n\tbigstar: '\\u2605',\n\tbigtriangledown: '\\u25BD',\n\tbigtriangleup: '\\u25B3',\n\tbiguplus: '\\u2A04',\n\tbigvee: '\\u22C1',\n\tbigwedge: '\\u22C0',\n\tbkarow: '\\u290D',\n\tblacklozenge: '\\u29EB',\n\tblacksquare: '\\u25AA',\n\tblacktriangle: '\\u25B4',\n\tblacktriangledown: '\\u25BE',\n\tblacktriangleleft: '\\u25C2',\n\tblacktriangleright: '\\u25B8',\n\tblank: '\\u2423',\n\tblk12: '\\u2592',\n\tblk14: '\\u2591',\n\tblk34: '\\u2593',\n\tblock: '\\u2588',\n\tbne: '\\u003D\\u20E5',\n\tbnequiv: '\\u2261\\u20E5',\n\tbNot: '\\u2AED',\n\tbnot: '\\u2310',\n\tBopf: '\\uD835\\uDD39',\n\tbopf: '\\uD835\\uDD53',\n\tbot: '\\u22A5',\n\tbottom: '\\u22A5',\n\tbowtie: '\\u22C8',\n\tboxbox: '\\u29C9',\n\tboxDL: '\\u2557',\n\tboxDl: '\\u2556',\n\tboxdL: '\\u2555',\n\tboxdl: '\\u2510',\n\tboxDR: '\\u2554',\n\tboxDr: '\\u2553',\n\tboxdR: '\\u2552',\n\tboxdr: '\\u250C',\n\tboxH: '\\u2550',\n\tboxh: '\\u2500',\n\tboxHD: '\\u2566',\n\tboxHd: '\\u2564',\n\tboxhD: '\\u2565',\n\tboxhd: '\\u252C',\n\tboxHU: '\\u2569',\n\tboxHu: '\\u2567',\n\tboxhU: '\\u2568',\n\tboxhu: '\\u2534',\n\tboxminus: '\\u229F',\n\tboxplus: '\\u229E',\n\tboxtimes: '\\u22A0',\n\tboxUL: '\\u255D',\n\tboxUl: '\\u255C',\n\tboxuL: '\\u255B',\n\tboxul: '\\u2518',\n\tboxUR: '\\u255A',\n\tboxUr: '\\u2559',\n\tboxuR: '\\u2558',\n\tboxur: '\\u2514',\n\tboxV: '\\u2551',\n\tboxv: '\\u2502',\n\tboxVH: '\\u256C',\n\tboxVh: '\\u256B',\n\tboxvH: '\\u256A',\n\tboxvh: '\\u253C',\n\tboxVL: '\\u2563',\n\tboxVl: '\\u2562',\n\tboxvL: '\\u2561',\n\tboxvl: '\\u2524',\n\tboxVR: '\\u2560',\n\tboxVr: '\\u255F',\n\tboxvR: '\\u255E',\n\tboxvr: '\\u251C',\n\tbprime: '\\u2035',\n\tBreve: '\\u02D8',\n\tbreve: '\\u02D8',\n\tbrvbar: '\\u00A6',\n\tBscr: '\\u212C',\n\tbscr: '\\uD835\\uDCB7',\n\tbsemi: '\\u204F',\n\tbsim: '\\u223D',\n\tbsime: '\\u22CD',\n\tbsol: '\\u005C',\n\tbsolb: '\\u29C5',\n\tbsolhsub: '\\u27C8',\n\tbull: '\\u2022',\n\tbullet: '\\u2022',\n\tbump: '\\u224E',\n\tbumpE: '\\u2AAE',\n\tbumpe: '\\u224F',\n\tBumpeq: '\\u224E',\n\tbumpeq: '\\u224F',\n\tCacute: '\\u0106',\n\tcacute: '\\u0107',\n\tCap: '\\u22D2',\n\tcap: '\\u2229',\n\tcapand: '\\u2A44',\n\tcapbrcup: '\\u2A49',\n\tcapcap: '\\u2A4B',\n\tcapcup: '\\u2A47',\n\tcapdot: '\\u2A40',\n\tCapitalDifferentialD: '\\u2145',\n\tcaps: '\\u2229\\uFE00',\n\tcaret: '\\u2041',\n\tcaron: '\\u02C7',\n\tCayleys: '\\u212D',\n\tccaps: '\\u2A4D',\n\tCcaron: '\\u010C',\n\tccaron: '\\u010D',\n\tCcedil: '\\u00C7',\n\tccedil: '\\u00E7',\n\tCcirc: '\\u0108',\n\tccirc: '\\u0109',\n\tCconint: '\\u2230',\n\tccups: '\\u2A4C',\n\tccupssm: '\\u2A50',\n\tCdot: '\\u010A',\n\tcdot: '\\u010B',\n\tcedil: '\\u00B8',\n\tCedilla: '\\u00B8',\n\tcemptyv: '\\u29B2',\n\tcent: '\\u00A2',\n\tCenterDot: '\\u00B7',\n\tcenterdot: '\\u00B7',\n\tCfr: '\\u212D',\n\tcfr: '\\uD835\\uDD20',\n\tCHcy: '\\u0427',\n\tchcy: '\\u0447',\n\tcheck: '\\u2713',\n\tcheckmark: '\\u2713',\n\tChi: '\\u03A7',\n\tchi: '\\u03C7',\n\tcir: '\\u25CB',\n\tcirc: '\\u02C6',\n\tcirceq: '\\u2257',\n\tcirclearrowleft: '\\u21BA',\n\tcirclearrowright: '\\u21BB',\n\tcircledast: '\\u229B',\n\tcircledcirc: '\\u229A',\n\tcircleddash: '\\u229D',\n\tCircleDot: '\\u2299',\n\tcircledR: '\\u00AE',\n\tcircledS: '\\u24C8',\n\tCircleMinus: '\\u2296',\n\tCirclePlus: '\\u2295',\n\tCircleTimes: '\\u2297',\n\tcirE: '\\u29C3',\n\tcire: '\\u2257',\n\tcirfnint: '\\u2A10',\n\tcirmid: '\\u2AEF',\n\tcirscir: '\\u29C2',\n\tClockwiseContourIntegral: '\\u2232',\n\tCloseCurlyDoubleQuote: '\\u201D',\n\tCloseCurlyQuote: '\\u2019',\n\tclubs: '\\u2663',\n\tclubsuit: '\\u2663',\n\tColon: '\\u2237',\n\tcolon: '\\u003A',\n\tColone: '\\u2A74',\n\tcolone: '\\u2254',\n\tcoloneq: '\\u2254',\n\tcomma: '\\u002C',\n\tcommat: '\\u0040',\n\tcomp: '\\u2201',\n\tcompfn: '\\u2218',\n\tcomplement: '\\u2201',\n\tcomplexes: '\\u2102',\n\tcong: '\\u2245',\n\tcongdot: '\\u2A6D',\n\tCongruent: '\\u2261',\n\tConint: '\\u222F',\n\tconint: '\\u222E',\n\tContourIntegral: '\\u222E',\n\tCopf: '\\u2102',\n\tcopf: '\\uD835\\uDD54',\n\tcoprod: '\\u2210',\n\tCoproduct: '\\u2210',\n\tCOPY: '\\u00A9',\n\tcopy: '\\u00A9',\n\tcopysr: '\\u2117',\n\tCounterClockwiseContourIntegral: '\\u2233',\n\tcrarr: '\\u21B5',\n\tCross: '\\u2A2F',\n\tcross: '\\u2717',\n\tCscr: '\\uD835\\uDC9E',\n\tcscr: '\\uD835\\uDCB8',\n\tcsub: '\\u2ACF',\n\tcsube: '\\u2AD1',\n\tcsup: '\\u2AD0',\n\tcsupe: '\\u2AD2',\n\tctdot: '\\u22EF',\n\tcudarrl: '\\u2938',\n\tcudarrr: '\\u2935',\n\tcuepr: '\\u22DE',\n\tcuesc: '\\u22DF',\n\tcularr: '\\u21B6',\n\tcularrp: '\\u293D',\n\tCup: '\\u22D3',\n\tcup: '\\u222A',\n\tcupbrcap: '\\u2A48',\n\tCupCap: '\\u224D',\n\tcupcap: '\\u2A46',\n\tcupcup: '\\u2A4A',\n\tcupdot: '\\u228D',\n\tcupor: '\\u2A45',\n\tcups: '\\u222A\\uFE00',\n\tcurarr: '\\u21B7',\n\tcurarrm: '\\u293C',\n\tcurlyeqprec: '\\u22DE',\n\tcurlyeqsucc: '\\u22DF',\n\tcurlyvee: '\\u22CE',\n\tcurlywedge: '\\u22CF',\n\tcurren: '\\u00A4',\n\tcurvearrowleft: '\\u21B6',\n\tcurvearrowright: '\\u21B7',\n\tcuvee: '\\u22CE',\n\tcuwed: '\\u22CF',\n\tcwconint: '\\u2232',\n\tcwint: '\\u2231',\n\tcylcty: '\\u232D',\n\tDagger: '\\u2021',\n\tdagger: '\\u2020',\n\tdaleth: '\\u2138',\n\tDarr: '\\u21A1',\n\tdArr: '\\u21D3',\n\tdarr: '\\u2193',\n\tdash: '\\u2010',\n\tDashv: '\\u2AE4',\n\tdashv: '\\u22A3',\n\tdbkarow: '\\u290F',\n\tdblac: '\\u02DD',\n\tDcaron: '\\u010E',\n\tdcaron: '\\u010F',\n\tDcy: '\\u0414',\n\tdcy: '\\u0434',\n\tDD: '\\u2145',\n\tdd: '\\u2146',\n\tddagger: '\\u2021',\n\tddarr: '\\u21CA',\n\tDDotrahd: '\\u2911',\n\tddotseq: '\\u2A77',\n\tdeg: '\\u00B0',\n\tDel: '\\u2207',\n\tDelta: '\\u0394',\n\tdelta: '\\u03B4',\n\tdemptyv: '\\u29B1',\n\tdfisht: '\\u297F',\n\tDfr: '\\uD835\\uDD07',\n\tdfr: '\\uD835\\uDD21',\n\tdHar: '\\u2965',\n\tdharl: '\\u21C3',\n\tdharr: '\\u21C2',\n\tDiacriticalAcute: '\\u00B4',\n\tDiacriticalDot: '\\u02D9',\n\tDiacriticalDoubleAcute: '\\u02DD',\n\tDiacriticalGrave: '\\u0060',\n\tDiacriticalTilde: '\\u02DC',\n\tdiam: '\\u22C4',\n\tDiamond: '\\u22C4',\n\tdiamond: '\\u22C4',\n\tdiamondsuit: '\\u2666',\n\tdiams: '\\u2666',\n\tdie: '\\u00A8',\n\tDifferentialD: '\\u2146',\n\tdigamma: '\\u03DD',\n\tdisin: '\\u22F2',\n\tdiv: '\\u00F7',\n\tdivide: '\\u00F7',\n\tdivideontimes: '\\u22C7',\n\tdivonx: '\\u22C7',\n\tDJcy: '\\u0402',\n\tdjcy: '\\u0452',\n\tdlcorn: '\\u231E',\n\tdlcrop: '\\u230D',\n\tdollar: '\\u0024',\n\tDopf: '\\uD835\\uDD3B',\n\tdopf: '\\uD835\\uDD55',\n\tDot: '\\u00A8',\n\tdot: '\\u02D9',\n\tDotDot: '\\u20DC',\n\tdoteq: '\\u2250',\n\tdoteqdot: '\\u2251',\n\tDotEqual: '\\u2250',\n\tdotminus: '\\u2238',\n\tdotplus: '\\u2214',\n\tdotsquare: '\\u22A1',\n\tdoublebarwedge: '\\u2306',\n\tDoubleContourIntegral: '\\u222F',\n\tDoubleDot: '\\u00A8',\n\tDoubleDownArrow: '\\u21D3',\n\tDoubleLeftArrow: '\\u21D0',\n\tDoubleLeftRightArrow: '\\u21D4',\n\tDoubleLeftTee: '\\u2AE4',\n\tDoubleLongLeftArrow: '\\u27F8',\n\tDoubleLongLeftRightArrow: '\\u27FA',\n\tDoubleLongRightArrow: '\\u27F9',\n\tDoubleRightArrow: '\\u21D2',\n\tDoubleRightTee: '\\u22A8',\n\tDoubleUpArrow: '\\u21D1',\n\tDoubleUpDownArrow: '\\u21D5',\n\tDoubleVerticalBar: '\\u2225',\n\tDownArrow: '\\u2193',\n\tDownarrow: '\\u21D3',\n\tdownarrow: '\\u2193',\n\tDownArrowBar: '\\u2913',\n\tDownArrowUpArrow: '\\u21F5',\n\tDownBreve: '\\u0311',\n\tdowndownarrows: '\\u21CA',\n\tdownharpoonleft: '\\u21C3',\n\tdownharpoonright: '\\u21C2',\n\tDownLeftRightVector: '\\u2950',\n\tDownLeftTeeVector: '\\u295E',\n\tDownLeftVector: '\\u21BD',\n\tDownLeftVectorBar: '\\u2956',\n\tDownRightTeeVector: '\\u295F',\n\tDownRightVector: '\\u21C1',\n\tDownRightVectorBar: '\\u2957',\n\tDownTee: '\\u22A4',\n\tDownTeeArrow: '\\u21A7',\n\tdrbkarow: '\\u2910',\n\tdrcorn: '\\u231F',\n\tdrcrop: '\\u230C',\n\tDscr: '\\uD835\\uDC9F',\n\tdscr: '\\uD835\\uDCB9',\n\tDScy: '\\u0405',\n\tdscy: '\\u0455',\n\tdsol: '\\u29F6',\n\tDstrok: '\\u0110',\n\tdstrok: '\\u0111',\n\tdtdot: '\\u22F1',\n\tdtri: '\\u25BF',\n\tdtrif: '\\u25BE',\n\tduarr: '\\u21F5',\n\tduhar: '\\u296F',\n\tdwangle: '\\u29A6',\n\tDZcy: '\\u040F',\n\tdzcy: '\\u045F',\n\tdzigrarr: '\\u27FF',\n\tEacute: '\\u00C9',\n\teacute: '\\u00E9',\n\teaster: '\\u2A6E',\n\tEcaron: '\\u011A',\n\tecaron: '\\u011B',\n\tecir: '\\u2256',\n\tEcirc: '\\u00CA',\n\tecirc: '\\u00EA',\n\tecolon: '\\u2255',\n\tEcy: '\\u042D',\n\tecy: '\\u044D',\n\teDDot: '\\u2A77',\n\tEdot: '\\u0116',\n\teDot: '\\u2251',\n\tedot: '\\u0117',\n\tee: '\\u2147',\n\tefDot: '\\u2252',\n\tEfr: '\\uD835\\uDD08',\n\tefr: '\\uD835\\uDD22',\n\teg: '\\u2A9A',\n\tEgrave: '\\u00C8',\n\tegrave: '\\u00E8',\n\tegs: '\\u2A96',\n\tegsdot: '\\u2A98',\n\tel: '\\u2A99',\n\tElement: '\\u2208',\n\telinters: '\\u23E7',\n\tell: '\\u2113',\n\tels: '\\u2A95',\n\telsdot: '\\u2A97',\n\tEmacr: '\\u0112',\n\temacr: '\\u0113',\n\tempty: '\\u2205',\n\temptyset: '\\u2205',\n\tEmptySmallSquare: '\\u25FB',\n\temptyv: '\\u2205',\n\tEmptyVerySmallSquare: '\\u25AB',\n\temsp: '\\u2003',\n\temsp13: '\\u2004',\n\temsp14: '\\u2005',\n\tENG: '\\u014A',\n\teng: '\\u014B',\n\tensp: '\\u2002',\n\tEogon: '\\u0118',\n\teogon: '\\u0119',\n\tEopf: '\\uD835\\uDD3C',\n\teopf: '\\uD835\\uDD56',\n\tepar: '\\u22D5',\n\teparsl: '\\u29E3',\n\teplus: '\\u2A71',\n\tepsi: '\\u03B5',\n\tEpsilon: '\\u0395',\n\tepsilon: '\\u03B5',\n\tepsiv: '\\u03F5',\n\teqcirc: '\\u2256',\n\teqcolon: '\\u2255',\n\teqsim: '\\u2242',\n\teqslantgtr: '\\u2A96',\n\teqslantless: '\\u2A95',\n\tEqual: '\\u2A75',\n\tequals: '\\u003D',\n\tEqualTilde: '\\u2242',\n\tequest: '\\u225F',\n\tEquilibrium: '\\u21CC',\n\tequiv: '\\u2261',\n\tequivDD: '\\u2A78',\n\teqvparsl: '\\u29E5',\n\terarr: '\\u2971',\n\terDot: '\\u2253',\n\tEscr: '\\u2130',\n\tescr: '\\u212F',\n\tesdot: '\\u2250',\n\tEsim: '\\u2A73',\n\tesim: '\\u2242',\n\tEta: '\\u0397',\n\teta: '\\u03B7',\n\tETH: '\\u00D0',\n\teth: '\\u00F0',\n\tEuml: '\\u00CB',\n\teuml: '\\u00EB',\n\teuro: '\\u20AC',\n\texcl: '\\u0021',\n\texist: '\\u2203',\n\tExists: '\\u2203',\n\texpectation: '\\u2130',\n\tExponentialE: '\\u2147',\n\texponentiale: '\\u2147',\n\tfallingdotseq: '\\u2252',\n\tFcy: '\\u0424',\n\tfcy: '\\u0444',\n\tfemale: '\\u2640',\n\tffilig: '\\uFB03',\n\tfflig: '\\uFB00',\n\tffllig: '\\uFB04',\n\tFfr: '\\uD835\\uDD09',\n\tffr: '\\uD835\\uDD23',\n\tfilig: '\\uFB01',\n\tFilledSmallSquare: '\\u25FC',\n\tFilledVerySmallSquare: '\\u25AA',\n\tfjlig: '\\u0066\\u006A',\n\tflat: '\\u266D',\n\tfllig: '\\uFB02',\n\tfltns: '\\u25B1',\n\tfnof: '\\u0192',\n\tFopf: '\\uD835\\uDD3D',\n\tfopf: '\\uD835\\uDD57',\n\tForAll: '\\u2200',\n\tforall: '\\u2200',\n\tfork: '\\u22D4',\n\tforkv: '\\u2AD9',\n\tFouriertrf: '\\u2131',\n\tfpartint: '\\u2A0D',\n\tfrac12: '\\u00BD',\n\tfrac13: '\\u2153',\n\tfrac14: '\\u00BC',\n\tfrac15: '\\u2155',\n\tfrac16: '\\u2159',\n\tfrac18: '\\u215B',\n\tfrac23: '\\u2154',\n\tfrac25: '\\u2156',\n\tfrac34: '\\u00BE',\n\tfrac35: '\\u2157',\n\tfrac38: '\\u215C',\n\tfrac45: '\\u2158',\n\tfrac56: '\\u215A',\n\tfrac58: '\\u215D',\n\tfrac78: '\\u215E',\n\tfrasl: '\\u2044',\n\tfrown: '\\u2322',\n\tFscr: '\\u2131',\n\tfscr: '\\uD835\\uDCBB',\n\tgacute: '\\u01F5',\n\tGamma: '\\u0393',\n\tgamma: '\\u03B3',\n\tGammad: '\\u03DC',\n\tgammad: '\\u03DD',\n\tgap: '\\u2A86',\n\tGbreve: '\\u011E',\n\tgbreve: '\\u011F',\n\tGcedil: '\\u0122',\n\tGcirc: '\\u011C',\n\tgcirc: '\\u011D',\n\tGcy: '\\u0413',\n\tgcy: '\\u0433',\n\tGdot: '\\u0120',\n\tgdot: '\\u0121',\n\tgE: '\\u2267',\n\tge: '\\u2265',\n\tgEl: '\\u2A8C',\n\tgel: '\\u22DB',\n\tgeq: '\\u2265',\n\tgeqq: '\\u2267',\n\tgeqslant: '\\u2A7E',\n\tges: '\\u2A7E',\n\tgescc: '\\u2AA9',\n\tgesdot: '\\u2A80',\n\tgesdoto: '\\u2A82',\n\tgesdotol: '\\u2A84',\n\tgesl: '\\u22DB\\uFE00',\n\tgesles: '\\u2A94',\n\tGfr: '\\uD835\\uDD0A',\n\tgfr: '\\uD835\\uDD24',\n\tGg: '\\u22D9',\n\tgg: '\\u226B',\n\tggg: '\\u22D9',\n\tgimel: '\\u2137',\n\tGJcy: '\\u0403',\n\tgjcy: '\\u0453',\n\tgl: '\\u2277',\n\tgla: '\\u2AA5',\n\tglE: '\\u2A92',\n\tglj: '\\u2AA4',\n\tgnap: '\\u2A8A',\n\tgnapprox: '\\u2A8A',\n\tgnE: '\\u2269',\n\tgne: '\\u2A88',\n\tgneq: '\\u2A88',\n\tgneqq: '\\u2269',\n\tgnsim: '\\u22E7',\n\tGopf: '\\uD835\\uDD3E',\n\tgopf: '\\uD835\\uDD58',\n\tgrave: '\\u0060',\n\tGreaterEqual: '\\u2265',\n\tGreaterEqualLess: '\\u22DB',\n\tGreaterFullEqual: '\\u2267',\n\tGreaterGreater: '\\u2AA2',\n\tGreaterLess: '\\u2277',\n\tGreaterSlantEqual: '\\u2A7E',\n\tGreaterTilde: '\\u2273',\n\tGscr: '\\uD835\\uDCA2',\n\tgscr: '\\u210A',\n\tgsim: '\\u2273',\n\tgsime: '\\u2A8E',\n\tgsiml: '\\u2A90',\n\tGt: '\\u226B',\n\tGT: '\\u003E',\n\tgt: '\\u003E',\n\tgtcc: '\\u2AA7',\n\tgtcir: '\\u2A7A',\n\tgtdot: '\\u22D7',\n\tgtlPar: '\\u2995',\n\tgtquest: '\\u2A7C',\n\tgtrapprox: '\\u2A86',\n\tgtrarr: '\\u2978',\n\tgtrdot: '\\u22D7',\n\tgtreqless: '\\u22DB',\n\tgtreqqless: '\\u2A8C',\n\tgtrless: '\\u2277',\n\tgtrsim: '\\u2273',\n\tgvertneqq: '\\u2269\\uFE00',\n\tgvnE: '\\u2269\\uFE00',\n\tHacek: '\\u02C7',\n\thairsp: '\\u200A',\n\thalf: '\\u00BD',\n\thamilt: '\\u210B',\n\tHARDcy: '\\u042A',\n\thardcy: '\\u044A',\n\thArr: '\\u21D4',\n\tharr: '\\u2194',\n\tharrcir: '\\u2948',\n\tharrw: '\\u21AD',\n\tHat: '\\u005E',\n\thbar: '\\u210F',\n\tHcirc: '\\u0124',\n\thcirc: '\\u0125',\n\thearts: '\\u2665',\n\theartsuit: '\\u2665',\n\thellip: '\\u2026',\n\thercon: '\\u22B9',\n\tHfr: '\\u210C',\n\thfr: '\\uD835\\uDD25',\n\tHilbertSpace: '\\u210B',\n\thksearow: '\\u2925',\n\thkswarow: '\\u2926',\n\thoarr: '\\u21FF',\n\thomtht: '\\u223B',\n\thookleftarrow: '\\u21A9',\n\thookrightarrow: '\\u21AA',\n\tHopf: '\\u210D',\n\thopf: '\\uD835\\uDD59',\n\thorbar: '\\u2015',\n\tHorizontalLine: '\\u2500',\n\tHscr: '\\u210B',\n\thscr: '\\uD835\\uDCBD',\n\thslash: '\\u210F',\n\tHstrok: '\\u0126',\n\thstrok: '\\u0127',\n\tHumpDownHump: '\\u224E',\n\tHumpEqual: '\\u224F',\n\thybull: '\\u2043',\n\thyphen: '\\u2010',\n\tIacute: '\\u00CD',\n\tiacute: '\\u00ED',\n\tic: '\\u2063',\n\tIcirc: '\\u00CE',\n\ticirc: '\\u00EE',\n\tIcy: '\\u0418',\n\ticy: '\\u0438',\n\tIdot: '\\u0130',\n\tIEcy: '\\u0415',\n\tiecy: '\\u0435',\n\tiexcl: '\\u00A1',\n\tiff: '\\u21D4',\n\tIfr: '\\u2111',\n\tifr: '\\uD835\\uDD26',\n\tIgrave: '\\u00CC',\n\tigrave: '\\u00EC',\n\tii: '\\u2148',\n\tiiiint: '\\u2A0C',\n\tiiint: '\\u222D',\n\tiinfin: '\\u29DC',\n\tiiota: '\\u2129',\n\tIJlig: '\\u0132',\n\tijlig: '\\u0133',\n\tIm: '\\u2111',\n\tImacr: '\\u012A',\n\timacr: '\\u012B',\n\timage: '\\u2111',\n\tImaginaryI: '\\u2148',\n\timagline: '\\u2110',\n\timagpart: '\\u2111',\n\timath: '\\u0131',\n\timof: '\\u22B7',\n\timped: '\\u01B5',\n\tImplies: '\\u21D2',\n\tin: '\\u2208',\n\tincare: '\\u2105',\n\tinfin: '\\u221E',\n\tinfintie: '\\u29DD',\n\tinodot: '\\u0131',\n\tInt: '\\u222C',\n\tint: '\\u222B',\n\tintcal: '\\u22BA',\n\tintegers: '\\u2124',\n\tIntegral: '\\u222B',\n\tintercal: '\\u22BA',\n\tIntersection: '\\u22C2',\n\tintlarhk: '\\u2A17',\n\tintprod: '\\u2A3C',\n\tInvisibleComma: '\\u2063',\n\tInvisibleTimes: '\\u2062',\n\tIOcy: '\\u0401',\n\tiocy: '\\u0451',\n\tIogon: '\\u012E',\n\tiogon: '\\u012F',\n\tIopf: '\\uD835\\uDD40',\n\tiopf: '\\uD835\\uDD5A',\n\tIota: '\\u0399',\n\tiota: '\\u03B9',\n\tiprod: '\\u2A3C',\n\tiquest: '\\u00BF',\n\tIscr: '\\u2110',\n\tiscr: '\\uD835\\uDCBE',\n\tisin: '\\u2208',\n\tisindot: '\\u22F5',\n\tisinE: '\\u22F9',\n\tisins: '\\u22F4',\n\tisinsv: '\\u22F3',\n\tisinv: '\\u2208',\n\tit: '\\u2062',\n\tItilde: '\\u0128',\n\titilde: '\\u0129',\n\tIukcy: '\\u0406',\n\tiukcy: '\\u0456',\n\tIuml: '\\u00CF',\n\tiuml: '\\u00EF',\n\tJcirc: '\\u0134',\n\tjcirc: '\\u0135',\n\tJcy: '\\u0419',\n\tjcy: '\\u0439',\n\tJfr: '\\uD835\\uDD0D',\n\tjfr: '\\uD835\\uDD27',\n\tjmath: '\\u0237',\n\tJopf: '\\uD835\\uDD41',\n\tjopf: '\\uD835\\uDD5B',\n\tJscr: '\\uD835\\uDCA5',\n\tjscr: '\\uD835\\uDCBF',\n\tJsercy: '\\u0408',\n\tjsercy: '\\u0458',\n\tJukcy: '\\u0404',\n\tjukcy: '\\u0454',\n\tKappa: '\\u039A',\n\tkappa: '\\u03BA',\n\tkappav: '\\u03F0',\n\tKcedil: '\\u0136',\n\tkcedil: '\\u0137',\n\tKcy: '\\u041A',\n\tkcy: '\\u043A',\n\tKfr: '\\uD835\\uDD0E',\n\tkfr: '\\uD835\\uDD28',\n\tkgreen: '\\u0138',\n\tKHcy: '\\u0425',\n\tkhcy: '\\u0445',\n\tKJcy: '\\u040C',\n\tkjcy: '\\u045C',\n\tKopf: '\\uD835\\uDD42',\n\tkopf: '\\uD835\\uDD5C',\n\tKscr: '\\uD835\\uDCA6',\n\tkscr: '\\uD835\\uDCC0',\n\tlAarr: '\\u21DA',\n\tLacute: '\\u0139',\n\tlacute: '\\u013A',\n\tlaemptyv: '\\u29B4',\n\tlagran: '\\u2112',\n\tLambda: '\\u039B',\n\tlambda: '\\u03BB',\n\tLang: '\\u27EA',\n\tlang: '\\u27E8',\n\tlangd: '\\u2991',\n\tlangle: '\\u27E8',\n\tlap: '\\u2A85',\n\tLaplacetrf: '\\u2112',\n\tlaquo: '\\u00AB',\n\tLarr: '\\u219E',\n\tlArr: '\\u21D0',\n\tlarr: '\\u2190',\n\tlarrb: '\\u21E4',\n\tlarrbfs: '\\u291F',\n\tlarrfs: '\\u291D',\n\tlarrhk: '\\u21A9',\n\tlarrlp: '\\u21AB',\n\tlarrpl: '\\u2939',\n\tlarrsim: '\\u2973',\n\tlarrtl: '\\u21A2',\n\tlat: '\\u2AAB',\n\tlAtail: '\\u291B',\n\tlatail: '\\u2919',\n\tlate: '\\u2AAD',\n\tlates: '\\u2AAD\\uFE00',\n\tlBarr: '\\u290E',\n\tlbarr: '\\u290C',\n\tlbbrk: '\\u2772',\n\tlbrace: '\\u007B',\n\tlbrack: '\\u005B',\n\tlbrke: '\\u298B',\n\tlbrksld: '\\u298F',\n\tlbrkslu: '\\u298D',\n\tLcaron: '\\u013D',\n\tlcaron: '\\u013E',\n\tLcedil: '\\u013B',\n\tlcedil: '\\u013C',\n\tlceil: '\\u2308',\n\tlcub: '\\u007B',\n\tLcy: '\\u041B',\n\tlcy: '\\u043B',\n\tldca: '\\u2936',\n\tldquo: '\\u201C',\n\tldquor: '\\u201E',\n\tldrdhar: '\\u2967',\n\tldrushar: '\\u294B',\n\tldsh: '\\u21B2',\n\tlE: '\\u2266',\n\tle: '\\u2264',\n\tLeftAngleBracket: '\\u27E8',\n\tLeftArrow: '\\u2190',\n\tLeftarrow: '\\u21D0',\n\tleftarrow: '\\u2190',\n\tLeftArrowBar: '\\u21E4',\n\tLeftArrowRightArrow: '\\u21C6',\n\tleftarrowtail: '\\u21A2',\n\tLeftCeiling: '\\u2308',\n\tLeftDoubleBracket: '\\u27E6',\n\tLeftDownTeeVector: '\\u2961',\n\tLeftDownVector: '\\u21C3',\n\tLeftDownVectorBar: '\\u2959',\n\tLeftFloor: '\\u230A',\n\tleftharpoondown: '\\u21BD',\n\tleftharpoonup: '\\u21BC',\n\tleftleftarrows: '\\u21C7',\n\tLeftRightArrow: '\\u2194',\n\tLeftrightarrow: '\\u21D4',\n\tleftrightarrow: '\\u2194',\n\tleftrightarrows: '\\u21C6',\n\tleftrightharpoons: '\\u21CB',\n\tleftrightsquigarrow: '\\u21AD',\n\tLeftRightVector: '\\u294E',\n\tLeftTee: '\\u22A3',\n\tLeftTeeArrow: '\\u21A4',\n\tLeftTeeVector: '\\u295A',\n\tleftthreetimes: '\\u22CB',\n\tLeftTriangle: '\\u22B2',\n\tLeftTriangleBar: '\\u29CF',\n\tLeftTriangleEqual: '\\u22B4',\n\tLeftUpDownVector: '\\u2951',\n\tLeftUpTeeVector: '\\u2960',\n\tLeftUpVector: '\\u21BF',\n\tLeftUpVectorBar: '\\u2958',\n\tLeftVector: '\\u21BC',\n\tLeftVectorBar: '\\u2952',\n\tlEg: '\\u2A8B',\n\tleg: '\\u22DA',\n\tleq: '\\u2264',\n\tleqq: '\\u2266',\n\tleqslant: '\\u2A7D',\n\tles: '\\u2A7D',\n\tlescc: '\\u2AA8',\n\tlesdot: '\\u2A7F',\n\tlesdoto: '\\u2A81',\n\tlesdotor: '\\u2A83',\n\tlesg: '\\u22DA\\uFE00',\n\tlesges: '\\u2A93',\n\tlessapprox: '\\u2A85',\n\tlessdot: '\\u22D6',\n\tlesseqgtr: '\\u22DA',\n\tlesseqqgtr: '\\u2A8B',\n\tLessEqualGreater: '\\u22DA',\n\tLessFullEqual: '\\u2266',\n\tLessGreater: '\\u2276',\n\tlessgtr: '\\u2276',\n\tLessLess: '\\u2AA1',\n\tlesssim: '\\u2272',\n\tLessSlantEqual: '\\u2A7D',\n\tLessTilde: '\\u2272',\n\tlfisht: '\\u297C',\n\tlfloor: '\\u230A',\n\tLfr: '\\uD835\\uDD0F',\n\tlfr: '\\uD835\\uDD29',\n\tlg: '\\u2276',\n\tlgE: '\\u2A91',\n\tlHar: '\\u2962',\n\tlhard: '\\u21BD',\n\tlharu: '\\u21BC',\n\tlharul: '\\u296A',\n\tlhblk: '\\u2584',\n\tLJcy: '\\u0409',\n\tljcy: '\\u0459',\n\tLl: '\\u22D8',\n\tll: '\\u226A',\n\tllarr: '\\u21C7',\n\tllcorner: '\\u231E',\n\tLleftarrow: '\\u21DA',\n\tllhard: '\\u296B',\n\tlltri: '\\u25FA',\n\tLmidot: '\\u013F',\n\tlmidot: '\\u0140',\n\tlmoust: '\\u23B0',\n\tlmoustache: '\\u23B0',\n\tlnap: '\\u2A89',\n\tlnapprox: '\\u2A89',\n\tlnE: '\\u2268',\n\tlne: '\\u2A87',\n\tlneq: '\\u2A87',\n\tlneqq: '\\u2268',\n\tlnsim: '\\u22E6',\n\tloang: '\\u27EC',\n\tloarr: '\\u21FD',\n\tlobrk: '\\u27E6',\n\tLongLeftArrow: '\\u27F5',\n\tLongleftarrow: '\\u27F8',\n\tlongleftarrow: '\\u27F5',\n\tLongLeftRightArrow: '\\u27F7',\n\tLongleftrightarrow: '\\u27FA',\n\tlongleftrightarrow: '\\u27F7',\n\tlongmapsto: '\\u27FC',\n\tLongRightArrow: '\\u27F6',\n\tLongrightarrow: '\\u27F9',\n\tlongrightarrow: '\\u27F6',\n\tlooparrowleft: '\\u21AB',\n\tlooparrowright: '\\u21AC',\n\tlopar: '\\u2985',\n\tLopf: '\\uD835\\uDD43',\n\tlopf: '\\uD835\\uDD5D',\n\tloplus: '\\u2A2D',\n\tlotimes: '\\u2A34',\n\tlowast: '\\u2217',\n\tlowbar: '\\u005F',\n\tLowerLeftArrow: '\\u2199',\n\tLowerRightArrow: '\\u2198',\n\tloz: '\\u25CA',\n\tlozenge: '\\u25CA',\n\tlozf: '\\u29EB',\n\tlpar: '\\u0028',\n\tlparlt: '\\u2993',\n\tlrarr: '\\u21C6',\n\tlrcorner: '\\u231F',\n\tlrhar: '\\u21CB',\n\tlrhard: '\\u296D',\n\tlrm: '\\u200E',\n\tlrtri: '\\u22BF',\n\tlsaquo: '\\u2039',\n\tLscr: '\\u2112',\n\tlscr: '\\uD835\\uDCC1',\n\tLsh: '\\u21B0',\n\tlsh: '\\u21B0',\n\tlsim: '\\u2272',\n\tlsime: '\\u2A8D',\n\tlsimg: '\\u2A8F',\n\tlsqb: '\\u005B',\n\tlsquo: '\\u2018',\n\tlsquor: '\\u201A',\n\tLstrok: '\\u0141',\n\tlstrok: '\\u0142',\n\tLt: '\\u226A',\n\tLT: '\\u003C',\n\tlt: '\\u003C',\n\tltcc: '\\u2AA6',\n\tltcir: '\\u2A79',\n\tltdot: '\\u22D6',\n\tlthree: '\\u22CB',\n\tltimes: '\\u22C9',\n\tltlarr: '\\u2976',\n\tltquest: '\\u2A7B',\n\tltri: '\\u25C3',\n\tltrie: '\\u22B4',\n\tltrif: '\\u25C2',\n\tltrPar: '\\u2996',\n\tlurdshar: '\\u294A',\n\tluruhar: '\\u2966',\n\tlvertneqq: '\\u2268\\uFE00',\n\tlvnE: '\\u2268\\uFE00',\n\tmacr: '\\u00AF',\n\tmale: '\\u2642',\n\tmalt: '\\u2720',\n\tmaltese: '\\u2720',\n\tMap: '\\u2905',\n\tmap: '\\u21A6',\n\tmapsto: '\\u21A6',\n\tmapstodown: '\\u21A7',\n\tmapstoleft: '\\u21A4',\n\tmapstoup: '\\u21A5',\n\tmarker: '\\u25AE',\n\tmcomma: '\\u2A29',\n\tMcy: '\\u041C',\n\tmcy: '\\u043C',\n\tmdash: '\\u2014',\n\tmDDot: '\\u223A',\n\tmeasuredangle: '\\u2221',\n\tMediumSpace: '\\u205F',\n\tMellintrf: '\\u2133',\n\tMfr: '\\uD835\\uDD10',\n\tmfr: '\\uD835\\uDD2A',\n\tmho: '\\u2127',\n\tmicro: '\\u00B5',\n\tmid: '\\u2223',\n\tmidast: '\\u002A',\n\tmidcir: '\\u2AF0',\n\tmiddot: '\\u00B7',\n\tminus: '\\u2212',\n\tminusb: '\\u229F',\n\tminusd: '\\u2238',\n\tminusdu: '\\u2A2A',\n\tMinusPlus: '\\u2213',\n\tmlcp: '\\u2ADB',\n\tmldr: '\\u2026',\n\tmnplus: '\\u2213',\n\tmodels: '\\u22A7',\n\tMopf: '\\uD835\\uDD44',\n\tmopf: '\\uD835\\uDD5E',\n\tmp: '\\u2213',\n\tMscr: '\\u2133',\n\tmscr: '\\uD835\\uDCC2',\n\tmstpos: '\\u223E',\n\tMu: '\\u039C',\n\tmu: '\\u03BC',\n\tmultimap: '\\u22B8',\n\tmumap: '\\u22B8',\n\tnabla: '\\u2207',\n\tNacute: '\\u0143',\n\tnacute: '\\u0144',\n\tnang: '\\u2220\\u20D2',\n\tnap: '\\u2249',\n\tnapE: '\\u2A70\\u0338',\n\tnapid: '\\u224B\\u0338',\n\tnapos: '\\u0149',\n\tnapprox: '\\u2249',\n\tnatur: '\\u266E',\n\tnatural: '\\u266E',\n\tnaturals: '\\u2115',\n\tnbsp: '\\u00A0',\n\tnbump: '\\u224E\\u0338',\n\tnbumpe: '\\u224F\\u0338',\n\tncap: '\\u2A43',\n\tNcaron: '\\u0147',\n\tncaron: '\\u0148',\n\tNcedil: '\\u0145',\n\tncedil: '\\u0146',\n\tncong: '\\u2247',\n\tncongdot: '\\u2A6D\\u0338',\n\tncup: '\\u2A42',\n\tNcy: '\\u041D',\n\tncy: '\\u043D',\n\tndash: '\\u2013',\n\tne: '\\u2260',\n\tnearhk: '\\u2924',\n\tneArr: '\\u21D7',\n\tnearr: '\\u2197',\n\tnearrow: '\\u2197',\n\tnedot: '\\u2250\\u0338',\n\tNegativeMediumSpace: '\\u200B',\n\tNegativeThickSpace: '\\u200B',\n\tNegativeThinSpace: '\\u200B',\n\tNegativeVeryThinSpace: '\\u200B',\n\tnequiv: '\\u2262',\n\tnesear: '\\u2928',\n\tnesim: '\\u2242\\u0338',\n\tNestedGreaterGreater: '\\u226B',\n\tNestedLessLess: '\\u226A',\n\tNewLine: '\\u000A',\n\tnexist: '\\u2204',\n\tnexists: '\\u2204',\n\tNfr: '\\uD835\\uDD11',\n\tnfr: '\\uD835\\uDD2B',\n\tngE: '\\u2267\\u0338',\n\tnge: '\\u2271',\n\tngeq: '\\u2271',\n\tngeqq: '\\u2267\\u0338',\n\tngeqslant: '\\u2A7E\\u0338',\n\tnges: '\\u2A7E\\u0338',\n\tnGg: '\\u22D9\\u0338',\n\tngsim: '\\u2275',\n\tnGt: '\\u226B\\u20D2',\n\tngt: '\\u226F',\n\tngtr: '\\u226F',\n\tnGtv: '\\u226B\\u0338',\n\tnhArr: '\\u21CE',\n\tnharr: '\\u21AE',\n\tnhpar: '\\u2AF2',\n\tni: '\\u220B',\n\tnis: '\\u22FC',\n\tnisd: '\\u22FA',\n\tniv: '\\u220B',\n\tNJcy: '\\u040A',\n\tnjcy: '\\u045A',\n\tnlArr: '\\u21CD',\n\tnlarr: '\\u219A',\n\tnldr: '\\u2025',\n\tnlE: '\\u2266\\u0338',\n\tnle: '\\u2270',\n\tnLeftarrow: '\\u21CD',\n\tnleftarrow: '\\u219A',\n\tnLeftrightarrow: '\\u21CE',\n\tnleftrightarrow: '\\u21AE',\n\tnleq: '\\u2270',\n\tnleqq: '\\u2266\\u0338',\n\tnleqslant: '\\u2A7D\\u0338',\n\tnles: '\\u2A7D\\u0338',\n\tnless: '\\u226E',\n\tnLl: '\\u22D8\\u0338',\n\tnlsim: '\\u2274',\n\tnLt: '\\u226A\\u20D2',\n\tnlt: '\\u226E',\n\tnltri: '\\u22EA',\n\tnltrie: '\\u22EC',\n\tnLtv: '\\u226A\\u0338',\n\tnmid: '\\u2224',\n\tNoBreak: '\\u2060',\n\tNonBreakingSpace: '\\u00A0',\n\tNopf: '\\u2115',\n\tnopf: '\\uD835\\uDD5F',\n\tNot: '\\u2AEC',\n\tnot: '\\u00AC',\n\tNotCongruent: '\\u2262',\n\tNotCupCap: '\\u226D',\n\tNotDoubleVerticalBar: '\\u2226',\n\tNotElement: '\\u2209',\n\tNotEqual: '\\u2260',\n\tNotEqualTilde: '\\u2242\\u0338',\n\tNotExists: '\\u2204',\n\tNotGreater: '\\u226F',\n\tNotGreaterEqual: '\\u2271',\n\tNotGreaterFullEqual: '\\u2267\\u0338',\n\tNotGreaterGreater: '\\u226B\\u0338',\n\tNotGreaterLess: '\\u2279',\n\tNotGreaterSlantEqual: '\\u2A7E\\u0338',\n\tNotGreaterTilde: '\\u2275',\n\tNotHumpDownHump: '\\u224E\\u0338',\n\tNotHumpEqual: '\\u224F\\u0338',\n\tnotin: '\\u2209',\n\tnotindot: '\\u22F5\\u0338',\n\tnotinE: '\\u22F9\\u0338',\n\tnotinva: '\\u2209',\n\tnotinvb: '\\u22F7',\n\tnotinvc: '\\u22F6',\n\tNotLeftTriangle: '\\u22EA',\n\tNotLeftTriangleBar: '\\u29CF\\u0338',\n\tNotLeftTriangleEqual: '\\u22EC',\n\tNotLess: '\\u226E',\n\tNotLessEqual: '\\u2270',\n\tNotLessGreater: '\\u2278',\n\tNotLessLess: '\\u226A\\u0338',\n\tNotLessSlantEqual: '\\u2A7D\\u0338',\n\tNotLessTilde: '\\u2274',\n\tNotNestedGreaterGreater: '\\u2AA2\\u0338',\n\tNotNestedLessLess: '\\u2AA1\\u0338',\n\tnotni: '\\u220C',\n\tnotniva: '\\u220C',\n\tnotnivb: '\\u22FE',\n\tnotnivc: '\\u22FD',\n\tNotPrecedes: '\\u2280',\n\tNotPrecedesEqual: '\\u2AAF\\u0338',\n\tNotPrecedesSlantEqual: '\\u22E0',\n\tNotReverseElement: '\\u220C',\n\tNotRightTriangle: '\\u22EB',\n\tNotRightTriangleBar: '\\u29D0\\u0338',\n\tNotRightTriangleEqual: '\\u22ED',\n\tNotSquareSubset: '\\u228F\\u0338',\n\tNotSquareSubsetEqual: '\\u22E2',\n\tNotSquareSuperset: '\\u2290\\u0338',\n\tNotSquareSupersetEqual: '\\u22E3',\n\tNotSubset: '\\u2282\\u20D2',\n\tNotSubsetEqual: '\\u2288',\n\tNotSucceeds: '\\u2281',\n\tNotSucceedsEqual: '\\u2AB0\\u0338',\n\tNotSucceedsSlantEqual: '\\u22E1',\n\tNotSucceedsTilde: '\\u227F\\u0338',\n\tNotSuperset: '\\u2283\\u20D2',\n\tNotSupersetEqual: '\\u2289',\n\tNotTilde: '\\u2241',\n\tNotTildeEqual: '\\u2244',\n\tNotTildeFullEqual: '\\u2247',\n\tNotTildeTilde: '\\u2249',\n\tNotVerticalBar: '\\u2224',\n\tnpar: '\\u2226',\n\tnparallel: '\\u2226',\n\tnparsl: '\\u2AFD\\u20E5',\n\tnpart: '\\u2202\\u0338',\n\tnpolint: '\\u2A14',\n\tnpr: '\\u2280',\n\tnprcue: '\\u22E0',\n\tnpre: '\\u2AAF\\u0338',\n\tnprec: '\\u2280',\n\tnpreceq: '\\u2AAF\\u0338',\n\tnrArr: '\\u21CF',\n\tnrarr: '\\u219B',\n\tnrarrc: '\\u2933\\u0338',\n\tnrarrw: '\\u219D\\u0338',\n\tnRightarrow: '\\u21CF',\n\tnrightarrow: '\\u219B',\n\tnrtri: '\\u22EB',\n\tnrtrie: '\\u22ED',\n\tnsc: '\\u2281',\n\tnsccue: '\\u22E1',\n\tnsce: '\\u2AB0\\u0338',\n\tNscr: '\\uD835\\uDCA9',\n\tnscr: '\\uD835\\uDCC3',\n\tnshortmid: '\\u2224',\n\tnshortparallel: '\\u2226',\n\tnsim: '\\u2241',\n\tnsime: '\\u2244',\n\tnsimeq: '\\u2244',\n\tnsmid: '\\u2224',\n\tnspar: '\\u2226',\n\tnsqsube: '\\u22E2',\n\tnsqsupe: '\\u22E3',\n\tnsub: '\\u2284',\n\tnsubE: '\\u2AC5\\u0338',\n\tnsube: '\\u2288',\n\tnsubset: '\\u2282\\u20D2',\n\tnsubseteq: '\\u2288',\n\tnsubseteqq: '\\u2AC5\\u0338',\n\tnsucc: '\\u2281',\n\tnsucceq: '\\u2AB0\\u0338',\n\tnsup: '\\u2285',\n\tnsupE: '\\u2AC6\\u0338',\n\tnsupe: '\\u2289',\n\tnsupset: '\\u2283\\u20D2',\n\tnsupseteq: '\\u2289',\n\tnsupseteqq: '\\u2AC6\\u0338',\n\tntgl: '\\u2279',\n\tNtilde: '\\u00D1',\n\tntilde: '\\u00F1',\n\tntlg: '\\u2278',\n\tntriangleleft: '\\u22EA',\n\tntrianglelefteq: '\\u22EC',\n\tntriangleright: '\\u22EB',\n\tntrianglerighteq: '\\u22ED',\n\tNu: '\\u039D',\n\tnu: '\\u03BD',\n\tnum: '\\u0023',\n\tnumero: '\\u2116',\n\tnumsp: '\\u2007',\n\tnvap: '\\u224D\\u20D2',\n\tnVDash: '\\u22AF',\n\tnVdash: '\\u22AE',\n\tnvDash: '\\u22AD',\n\tnvdash: '\\u22AC',\n\tnvge: '\\u2265\\u20D2',\n\tnvgt: '\\u003E\\u20D2',\n\tnvHarr: '\\u2904',\n\tnvinfin: '\\u29DE',\n\tnvlArr: '\\u2902',\n\tnvle: '\\u2264\\u20D2',\n\tnvlt: '\\u003C\\u20D2',\n\tnvltrie: '\\u22B4\\u20D2',\n\tnvrArr: '\\u2903',\n\tnvrtrie: '\\u22B5\\u20D2',\n\tnvsim: '\\u223C\\u20D2',\n\tnwarhk: '\\u2923',\n\tnwArr: '\\u21D6',\n\tnwarr: '\\u2196',\n\tnwarrow: '\\u2196',\n\tnwnear: '\\u2927',\n\tOacute: '\\u00D3',\n\toacute: '\\u00F3',\n\toast: '\\u229B',\n\tocir: '\\u229A',\n\tOcirc: '\\u00D4',\n\tocirc: '\\u00F4',\n\tOcy: '\\u041E',\n\tocy: '\\u043E',\n\todash: '\\u229D',\n\tOdblac: '\\u0150',\n\todblac: '\\u0151',\n\todiv: '\\u2A38',\n\todot: '\\u2299',\n\todsold: '\\u29BC',\n\tOElig: '\\u0152',\n\toelig: '\\u0153',\n\tofcir: '\\u29BF',\n\tOfr: '\\uD835\\uDD12',\n\tofr: '\\uD835\\uDD2C',\n\togon: '\\u02DB',\n\tOgrave: '\\u00D2',\n\tograve: '\\u00F2',\n\togt: '\\u29C1',\n\tohbar: '\\u29B5',\n\tohm: '\\u03A9',\n\toint: '\\u222E',\n\tolarr: '\\u21BA',\n\tolcir: '\\u29BE',\n\tolcross: '\\u29BB',\n\toline: '\\u203E',\n\tolt: '\\u29C0',\n\tOmacr: '\\u014C',\n\tomacr: '\\u014D',\n\tOmega: '\\u03A9',\n\tomega: '\\u03C9',\n\tOmicron: '\\u039F',\n\tomicron: '\\u03BF',\n\tomid: '\\u29B6',\n\tominus: '\\u2296',\n\tOopf: '\\uD835\\uDD46',\n\toopf: '\\uD835\\uDD60',\n\topar: '\\u29B7',\n\tOpenCurlyDoubleQuote: '\\u201C',\n\tOpenCurlyQuote: '\\u2018',\n\toperp: '\\u29B9',\n\toplus: '\\u2295',\n\tOr: '\\u2A54',\n\tor: '\\u2228',\n\torarr: '\\u21BB',\n\tord: '\\u2A5D',\n\torder: '\\u2134',\n\torderof: '\\u2134',\n\tordf: '\\u00AA',\n\tordm: '\\u00BA',\n\torigof: '\\u22B6',\n\toror: '\\u2A56',\n\torslope: '\\u2A57',\n\torv: '\\u2A5B',\n\toS: '\\u24C8',\n\tOscr: '\\uD835\\uDCAA',\n\toscr: '\\u2134',\n\tOslash: '\\u00D8',\n\toslash: '\\u00F8',\n\tosol: '\\u2298',\n\tOtilde: '\\u00D5',\n\totilde: '\\u00F5',\n\tOtimes: '\\u2A37',\n\totimes: '\\u2297',\n\totimesas: '\\u2A36',\n\tOuml: '\\u00D6',\n\touml: '\\u00F6',\n\tovbar: '\\u233D',\n\tOverBar: '\\u203E',\n\tOverBrace: '\\u23DE',\n\tOverBracket: '\\u23B4',\n\tOverParenthesis: '\\u23DC',\n\tpar: '\\u2225',\n\tpara: '\\u00B6',\n\tparallel: '\\u2225',\n\tparsim: '\\u2AF3',\n\tparsl: '\\u2AFD',\n\tpart: '\\u2202',\n\tPartialD: '\\u2202',\n\tPcy: '\\u041F',\n\tpcy: '\\u043F',\n\tpercnt: '\\u0025',\n\tperiod: '\\u002E',\n\tpermil: '\\u2030',\n\tperp: '\\u22A5',\n\tpertenk: '\\u2031',\n\tPfr: '\\uD835\\uDD13',\n\tpfr: '\\uD835\\uDD2D',\n\tPhi: '\\u03A6',\n\tphi: '\\u03C6',\n\tphiv: '\\u03D5',\n\tphmmat: '\\u2133',\n\tphone: '\\u260E',\n\tPi: '\\u03A0',\n\tpi: '\\u03C0',\n\tpitchfork: '\\u22D4',\n\tpiv: '\\u03D6',\n\tplanck: '\\u210F',\n\tplanckh: '\\u210E',\n\tplankv: '\\u210F',\n\tplus: '\\u002B',\n\tplusacir: '\\u2A23',\n\tplusb: '\\u229E',\n\tpluscir: '\\u2A22',\n\tplusdo: '\\u2214',\n\tplusdu: '\\u2A25',\n\tpluse: '\\u2A72',\n\tPlusMinus: '\\u00B1',\n\tplusmn: '\\u00B1',\n\tplussim: '\\u2A26',\n\tplustwo: '\\u2A27',\n\tpm: '\\u00B1',\n\tPoincareplane: '\\u210C',\n\tpointint: '\\u2A15',\n\tPopf: '\\u2119',\n\tpopf: '\\uD835\\uDD61',\n\tpound: '\\u00A3',\n\tPr: '\\u2ABB',\n\tpr: '\\u227A',\n\tprap: '\\u2AB7',\n\tprcue: '\\u227C',\n\tprE: '\\u2AB3',\n\tpre: '\\u2AAF',\n\tprec: '\\u227A',\n\tprecapprox: '\\u2AB7',\n\tpreccurlyeq: '\\u227C',\n\tPrecedes: '\\u227A',\n\tPrecedesEqual: '\\u2AAF',\n\tPrecedesSlantEqual: '\\u227C',\n\tPrecedesTilde: '\\u227E',\n\tpreceq: '\\u2AAF',\n\tprecnapprox: '\\u2AB9',\n\tprecneqq: '\\u2AB5',\n\tprecnsim: '\\u22E8',\n\tprecsim: '\\u227E',\n\tPrime: '\\u2033',\n\tprime: '\\u2032',\n\tprimes: '\\u2119',\n\tprnap: '\\u2AB9',\n\tprnE: '\\u2AB5',\n\tprnsim: '\\u22E8',\n\tprod: '\\u220F',\n\tProduct: '\\u220F',\n\tprofalar: '\\u232E',\n\tprofline: '\\u2312',\n\tprofsurf: '\\u2313',\n\tprop: '\\u221D',\n\tProportion: '\\u2237',\n\tProportional: '\\u221D',\n\tpropto: '\\u221D',\n\tprsim: '\\u227E',\n\tprurel: '\\u22B0',\n\tPscr: '\\uD835\\uDCAB',\n\tpscr: '\\uD835\\uDCC5',\n\tPsi: '\\u03A8',\n\tpsi: '\\u03C8',\n\tpuncsp: '\\u2008',\n\tQfr: '\\uD835\\uDD14',\n\tqfr: '\\uD835\\uDD2E',\n\tqint: '\\u2A0C',\n\tQopf: '\\u211A',\n\tqopf: '\\uD835\\uDD62',\n\tqprime: '\\u2057',\n\tQscr: '\\uD835\\uDCAC',\n\tqscr: '\\uD835\\uDCC6',\n\tquaternions: '\\u210D',\n\tquatint: '\\u2A16',\n\tquest: '\\u003F',\n\tquesteq: '\\u225F',\n\tQUOT: '\\u0022',\n\tquot: '\\u0022',\n\trAarr: '\\u21DB',\n\trace: '\\u223D\\u0331',\n\tRacute: '\\u0154',\n\tracute: '\\u0155',\n\tradic: '\\u221A',\n\traemptyv: '\\u29B3',\n\tRang: '\\u27EB',\n\trang: '\\u27E9',\n\trangd: '\\u2992',\n\trange: '\\u29A5',\n\trangle: '\\u27E9',\n\traquo: '\\u00BB',\n\tRarr: '\\u21A0',\n\trArr: '\\u21D2',\n\trarr: '\\u2192',\n\trarrap: '\\u2975',\n\trarrb: '\\u21E5',\n\trarrbfs: '\\u2920',\n\trarrc: '\\u2933',\n\trarrfs: '\\u291E',\n\trarrhk: '\\u21AA',\n\trarrlp: '\\u21AC',\n\trarrpl: '\\u2945',\n\trarrsim: '\\u2974',\n\tRarrtl: '\\u2916',\n\trarrtl: '\\u21A3',\n\trarrw: '\\u219D',\n\trAtail: '\\u291C',\n\tratail: '\\u291A',\n\tratio: '\\u2236',\n\trationals: '\\u211A',\n\tRBarr: '\\u2910',\n\trBarr: '\\u290F',\n\trbarr: '\\u290D',\n\trbbrk: '\\u2773',\n\trbrace: '\\u007D',\n\trbrack: '\\u005D',\n\trbrke: '\\u298C',\n\trbrksld: '\\u298E',\n\trbrkslu: '\\u2990',\n\tRcaron: '\\u0158',\n\trcaron: '\\u0159',\n\tRcedil: '\\u0156',\n\trcedil: '\\u0157',\n\trceil: '\\u2309',\n\trcub: '\\u007D',\n\tRcy: '\\u0420',\n\trcy: '\\u0440',\n\trdca: '\\u2937',\n\trdldhar: '\\u2969',\n\trdquo: '\\u201D',\n\trdquor: '\\u201D',\n\trdsh: '\\u21B3',\n\tRe: '\\u211C',\n\treal: '\\u211C',\n\trealine: '\\u211B',\n\trealpart: '\\u211C',\n\treals: '\\u211D',\n\trect: '\\u25AD',\n\tREG: '\\u00AE',\n\treg: '\\u00AE',\n\tReverseElement: '\\u220B',\n\tReverseEquilibrium: '\\u21CB',\n\tReverseUpEquilibrium: '\\u296F',\n\trfisht: '\\u297D',\n\trfloor: '\\u230B',\n\tRfr: '\\u211C',\n\trfr: '\\uD835\\uDD2F',\n\trHar: '\\u2964',\n\trhard: '\\u21C1',\n\trharu: '\\u21C0',\n\trharul: '\\u296C',\n\tRho: '\\u03A1',\n\trho: '\\u03C1',\n\trhov: '\\u03F1',\n\tRightAngleBracket: '\\u27E9',\n\tRightArrow: '\\u2192',\n\tRightarrow: '\\u21D2',\n\trightarrow: '\\u2192',\n\tRightArrowBar: '\\u21E5',\n\tRightArrowLeftArrow: '\\u21C4',\n\trightarrowtail: '\\u21A3',\n\tRightCeiling: '\\u2309',\n\tRightDoubleBracket: '\\u27E7',\n\tRightDownTeeVector: '\\u295D',\n\tRightDownVector: '\\u21C2',\n\tRightDownVectorBar: '\\u2955',\n\tRightFloor: '\\u230B',\n\trightharpoondown: '\\u21C1',\n\trightharpoonup: '\\u21C0',\n\trightleftarrows: '\\u21C4',\n\trightleftharpoons: '\\u21CC',\n\trightrightarrows: '\\u21C9',\n\trightsquigarrow: '\\u219D',\n\tRightTee: '\\u22A2',\n\tRightTeeArrow: '\\u21A6',\n\tRightTeeVector: '\\u295B',\n\trightthreetimes: '\\u22CC',\n\tRightTriangle: '\\u22B3',\n\tRightTriangleBar: '\\u29D0',\n\tRightTriangleEqual: '\\u22B5',\n\tRightUpDownVector: '\\u294F',\n\tRightUpTeeVector: '\\u295C',\n\tRightUpVector: '\\u21BE',\n\tRightUpVectorBar: '\\u2954',\n\tRightVector: '\\u21C0',\n\tRightVectorBar: '\\u2953',\n\tring: '\\u02DA',\n\trisingdotseq: '\\u2253',\n\trlarr: '\\u21C4',\n\trlhar: '\\u21CC',\n\trlm: '\\u200F',\n\trmoust: '\\u23B1',\n\trmoustache: '\\u23B1',\n\trnmid: '\\u2AEE',\n\troang: '\\u27ED',\n\troarr: '\\u21FE',\n\trobrk: '\\u27E7',\n\tropar: '\\u2986',\n\tRopf: '\\u211D',\n\tropf: '\\uD835\\uDD63',\n\troplus: '\\u2A2E',\n\trotimes: '\\u2A35',\n\tRoundImplies: '\\u2970',\n\trpar: '\\u0029',\n\trpargt: '\\u2994',\n\trppolint: '\\u2A12',\n\trrarr: '\\u21C9',\n\tRrightarrow: '\\u21DB',\n\trsaquo: '\\u203A',\n\tRscr: '\\u211B',\n\trscr: '\\uD835\\uDCC7',\n\tRsh: '\\u21B1',\n\trsh: '\\u21B1',\n\trsqb: '\\u005D',\n\trsquo: '\\u2019',\n\trsquor: '\\u2019',\n\trthree: '\\u22CC',\n\trtimes: '\\u22CA',\n\trtri: '\\u25B9',\n\trtrie: '\\u22B5',\n\trtrif: '\\u25B8',\n\trtriltri: '\\u29CE',\n\tRuleDelayed: '\\u29F4',\n\truluhar: '\\u2968',\n\trx: '\\u211E',\n\tSacute: '\\u015A',\n\tsacute: '\\u015B',\n\tsbquo: '\\u201A',\n\tSc: '\\u2ABC',\n\tsc: '\\u227B',\n\tscap: '\\u2AB8',\n\tScaron: '\\u0160',\n\tscaron: '\\u0161',\n\tsccue: '\\u227D',\n\tscE: '\\u2AB4',\n\tsce: '\\u2AB0',\n\tScedil: '\\u015E',\n\tscedil: '\\u015F',\n\tScirc: '\\u015C',\n\tscirc: '\\u015D',\n\tscnap: '\\u2ABA',\n\tscnE: '\\u2AB6',\n\tscnsim: '\\u22E9',\n\tscpolint: '\\u2A13',\n\tscsim: '\\u227F',\n\tScy: '\\u0421',\n\tscy: '\\u0441',\n\tsdot: '\\u22C5',\n\tsdotb: '\\u22A1',\n\tsdote: '\\u2A66',\n\tsearhk: '\\u2925',\n\tseArr: '\\u21D8',\n\tsearr: '\\u2198',\n\tsearrow: '\\u2198',\n\tsect: '\\u00A7',\n\tsemi: '\\u003B',\n\tseswar: '\\u2929',\n\tsetminus: '\\u2216',\n\tsetmn: '\\u2216',\n\tsext: '\\u2736',\n\tSfr: '\\uD835\\uDD16',\n\tsfr: '\\uD835\\uDD30',\n\tsfrown: '\\u2322',\n\tsharp: '\\u266F',\n\tSHCHcy: '\\u0429',\n\tshchcy: '\\u0449',\n\tSHcy: '\\u0428',\n\tshcy: '\\u0448',\n\tShortDownArrow: '\\u2193',\n\tShortLeftArrow: '\\u2190',\n\tshortmid: '\\u2223',\n\tshortparallel: '\\u2225',\n\tShortRightArrow: '\\u2192',\n\tShortUpArrow: '\\u2191',\n\tshy: '\\u00AD',\n\tSigma: '\\u03A3',\n\tsigma: '\\u03C3',\n\tsigmaf: '\\u03C2',\n\tsigmav: '\\u03C2',\n\tsim: '\\u223C',\n\tsimdot: '\\u2A6A',\n\tsime: '\\u2243',\n\tsimeq: '\\u2243',\n\tsimg: '\\u2A9E',\n\tsimgE: '\\u2AA0',\n\tsiml: '\\u2A9D',\n\tsimlE: '\\u2A9F',\n\tsimne: '\\u2246',\n\tsimplus: '\\u2A24',\n\tsimrarr: '\\u2972',\n\tslarr: '\\u2190',\n\tSmallCircle: '\\u2218',\n\tsmallsetminus: '\\u2216',\n\tsmashp: '\\u2A33',\n\tsmeparsl: '\\u29E4',\n\tsmid: '\\u2223',\n\tsmile: '\\u2323',\n\tsmt: '\\u2AAA',\n\tsmte: '\\u2AAC',\n\tsmtes: '\\u2AAC\\uFE00',\n\tSOFTcy: '\\u042C',\n\tsoftcy: '\\u044C',\n\tsol: '\\u002F',\n\tsolb: '\\u29C4',\n\tsolbar: '\\u233F',\n\tSopf: '\\uD835\\uDD4A',\n\tsopf: '\\uD835\\uDD64',\n\tspades: '\\u2660',\n\tspadesuit: '\\u2660',\n\tspar: '\\u2225',\n\tsqcap: '\\u2293',\n\tsqcaps: '\\u2293\\uFE00',\n\tsqcup: '\\u2294',\n\tsqcups: '\\u2294\\uFE00',\n\tSqrt: '\\u221A',\n\tsqsub: '\\u228F',\n\tsqsube: '\\u2291',\n\tsqsubset: '\\u228F',\n\tsqsubseteq: '\\u2291',\n\tsqsup: '\\u2290',\n\tsqsupe: '\\u2292',\n\tsqsupset: '\\u2290',\n\tsqsupseteq: '\\u2292',\n\tsqu: '\\u25A1',\n\tSquare: '\\u25A1',\n\tsquare: '\\u25A1',\n\tSquareIntersection: '\\u2293',\n\tSquareSubset: '\\u228F',\n\tSquareSubsetEqual: '\\u2291',\n\tSquareSuperset: '\\u2290',\n\tSquareSupersetEqual: '\\u2292',\n\tSquareUnion: '\\u2294',\n\tsquarf: '\\u25AA',\n\tsquf: '\\u25AA',\n\tsrarr: '\\u2192',\n\tSscr: '\\uD835\\uDCAE',\n\tsscr: '\\uD835\\uDCC8',\n\tssetmn: '\\u2216',\n\tssmile: '\\u2323',\n\tsstarf: '\\u22C6',\n\tStar: '\\u22C6',\n\tstar: '\\u2606',\n\tstarf: '\\u2605',\n\tstraightepsilon: '\\u03F5',\n\tstraightphi: '\\u03D5',\n\tstrns: '\\u00AF',\n\tSub: '\\u22D0',\n\tsub: '\\u2282',\n\tsubdot: '\\u2ABD',\n\tsubE: '\\u2AC5',\n\tsube: '\\u2286',\n\tsubedot: '\\u2AC3',\n\tsubmult: '\\u2AC1',\n\tsubnE: '\\u2ACB',\n\tsubne: '\\u228A',\n\tsubplus: '\\u2ABF',\n\tsubrarr: '\\u2979',\n\tSubset: '\\u22D0',\n\tsubset: '\\u2282',\n\tsubseteq: '\\u2286',\n\tsubseteqq: '\\u2AC5',\n\tSubsetEqual: '\\u2286',\n\tsubsetneq: '\\u228A',\n\tsubsetneqq: '\\u2ACB',\n\tsubsim: '\\u2AC7',\n\tsubsub: '\\u2AD5',\n\tsubsup: '\\u2AD3',\n\tsucc: '\\u227B',\n\tsuccapprox: '\\u2AB8',\n\tsucccurlyeq: '\\u227D',\n\tSucceeds: '\\u227B',\n\tSucceedsEqual: '\\u2AB0',\n\tSucceedsSlantEqual: '\\u227D',\n\tSucceedsTilde: '\\u227F',\n\tsucceq: '\\u2AB0',\n\tsuccnapprox: '\\u2ABA',\n\tsuccneqq: '\\u2AB6',\n\tsuccnsim: '\\u22E9',\n\tsuccsim: '\\u227F',\n\tSuchThat: '\\u220B',\n\tSum: '\\u2211',\n\tsum: '\\u2211',\n\tsung: '\\u266A',\n\tSup: '\\u22D1',\n\tsup: '\\u2283',\n\tsup1: '\\u00B9',\n\tsup2: '\\u00B2',\n\tsup3: '\\u00B3',\n\tsupdot: '\\u2ABE',\n\tsupdsub: '\\u2AD8',\n\tsupE: '\\u2AC6',\n\tsupe: '\\u2287',\n\tsupedot: '\\u2AC4',\n\tSuperset: '\\u2283',\n\tSupersetEqual: '\\u2287',\n\tsuphsol: '\\u27C9',\n\tsuphsub: '\\u2AD7',\n\tsuplarr: '\\u297B',\n\tsupmult: '\\u2AC2',\n\tsupnE: '\\u2ACC',\n\tsupne: '\\u228B',\n\tsupplus: '\\u2AC0',\n\tSupset: '\\u22D1',\n\tsupset: '\\u2283',\n\tsupseteq: '\\u2287',\n\tsupseteqq: '\\u2AC6',\n\tsupsetneq: '\\u228B',\n\tsupsetneqq: '\\u2ACC',\n\tsupsim: '\\u2AC8',\n\tsupsub: '\\u2AD4',\n\tsupsup: '\\u2AD6',\n\tswarhk: '\\u2926',\n\tswArr: '\\u21D9',\n\tswarr: '\\u2199',\n\tswarrow: '\\u2199',\n\tswnwar: '\\u292A',\n\tszlig: '\\u00DF',\n\tTab: '\\u0009',\n\ttarget: '\\u2316',\n\tTau: '\\u03A4',\n\ttau: '\\u03C4',\n\ttbrk: '\\u23B4',\n\tTcaron: '\\u0164',\n\ttcaron: '\\u0165',\n\tTcedil: '\\u0162',\n\ttcedil: '\\u0163',\n\tTcy: '\\u0422',\n\ttcy: '\\u0442',\n\ttdot: '\\u20DB',\n\ttelrec: '\\u2315',\n\tTfr: '\\uD835\\uDD17',\n\ttfr: '\\uD835\\uDD31',\n\tthere4: '\\u2234',\n\tTherefore: '\\u2234',\n\ttherefore: '\\u2234',\n\tTheta: '\\u0398',\n\ttheta: '\\u03B8',\n\tthetasym: '\\u03D1',\n\tthetav: '\\u03D1',\n\tthickapprox: '\\u2248',\n\tthicksim: '\\u223C',\n\tThickSpace: '\\u205F\\u200A',\n\tthinsp: '\\u2009',\n\tThinSpace: '\\u2009',\n\tthkap: '\\u2248',\n\tthksim: '\\u223C',\n\tTHORN: '\\u00DE',\n\tthorn: '\\u00FE',\n\tTilde: '\\u223C',\n\ttilde: '\\u02DC',\n\tTildeEqual: '\\u2243',\n\tTildeFullEqual: '\\u2245',\n\tTildeTilde: '\\u2248',\n\ttimes: '\\u00D7',\n\ttimesb: '\\u22A0',\n\ttimesbar: '\\u2A31',\n\ttimesd: '\\u2A30',\n\ttint: '\\u222D',\n\ttoea: '\\u2928',\n\ttop: '\\u22A4',\n\ttopbot: '\\u2336',\n\ttopcir: '\\u2AF1',\n\tTopf: '\\uD835\\uDD4B',\n\ttopf: '\\uD835\\uDD65',\n\ttopfork: '\\u2ADA',\n\ttosa: '\\u2929',\n\ttprime: '\\u2034',\n\tTRADE: '\\u2122',\n\ttrade: '\\u2122',\n\ttriangle: '\\u25B5',\n\ttriangledown: '\\u25BF',\n\ttriangleleft: '\\u25C3',\n\ttrianglelefteq: '\\u22B4',\n\ttriangleq: '\\u225C',\n\ttriangleright: '\\u25B9',\n\ttrianglerighteq: '\\u22B5',\n\ttridot: '\\u25EC',\n\ttrie: '\\u225C',\n\ttriminus: '\\u2A3A',\n\tTripleDot: '\\u20DB',\n\ttriplus: '\\u2A39',\n\ttrisb: '\\u29CD',\n\ttritime: '\\u2A3B',\n\ttrpezium: '\\u23E2',\n\tTscr: '\\uD835\\uDCAF',\n\ttscr: '\\uD835\\uDCC9',\n\tTScy: '\\u0426',\n\ttscy: '\\u0446',\n\tTSHcy: '\\u040B',\n\ttshcy: '\\u045B',\n\tTstrok: '\\u0166',\n\ttstrok: '\\u0167',\n\ttwixt: '\\u226C',\n\ttwoheadleftarrow: '\\u219E',\n\ttwoheadrightarrow: '\\u21A0',\n\tUacute: '\\u00DA',\n\tuacute: '\\u00FA',\n\tUarr: '\\u219F',\n\tuArr: '\\u21D1',\n\tuarr: '\\u2191',\n\tUarrocir: '\\u2949',\n\tUbrcy: '\\u040E',\n\tubrcy: '\\u045E',\n\tUbreve: '\\u016C',\n\tubreve: '\\u016D',\n\tUcirc: '\\u00DB',\n\tucirc: '\\u00FB',\n\tUcy: '\\u0423',\n\tucy: '\\u0443',\n\tudarr: '\\u21C5',\n\tUdblac: '\\u0170',\n\tudblac: '\\u0171',\n\tudhar: '\\u296E',\n\tufisht: '\\u297E',\n\tUfr: '\\uD835\\uDD18',\n\tufr: '\\uD835\\uDD32',\n\tUgrave: '\\u00D9',\n\tugrave: '\\u00F9',\n\tuHar: '\\u2963',\n\tuharl: '\\u21BF',\n\tuharr: '\\u21BE',\n\tuhblk: '\\u2580',\n\tulcorn: '\\u231C',\n\tulcorner: '\\u231C',\n\tulcrop: '\\u230F',\n\tultri: '\\u25F8',\n\tUmacr: '\\u016A',\n\tumacr: '\\u016B',\n\tuml: '\\u00A8',\n\tUnderBar: '\\u005F',\n\tUnderBrace: '\\u23DF',\n\tUnderBracket: '\\u23B5',\n\tUnderParenthesis: '\\u23DD',\n\tUnion: '\\u22C3',\n\tUnionPlus: '\\u228E',\n\tUogon: '\\u0172',\n\tuogon: '\\u0173',\n\tUopf: '\\uD835\\uDD4C',\n\tuopf: '\\uD835\\uDD66',\n\tUpArrow: '\\u2191',\n\tUparrow: '\\u21D1',\n\tuparrow: '\\u2191',\n\tUpArrowBar: '\\u2912',\n\tUpArrowDownArrow: '\\u21C5',\n\tUpDownArrow: '\\u2195',\n\tUpdownarrow: '\\u21D5',\n\tupdownarrow: '\\u2195',\n\tUpEquilibrium: '\\u296E',\n\tupharpoonleft: '\\u21BF',\n\tupharpoonright: '\\u21BE',\n\tuplus: '\\u228E',\n\tUpperLeftArrow: '\\u2196',\n\tUpperRightArrow: '\\u2197',\n\tUpsi: '\\u03D2',\n\tupsi: '\\u03C5',\n\tupsih: '\\u03D2',\n\tUpsilon: '\\u03A5',\n\tupsilon: '\\u03C5',\n\tUpTee: '\\u22A5',\n\tUpTeeArrow: '\\u21A5',\n\tupuparrows: '\\u21C8',\n\turcorn: '\\u231D',\n\turcorner: '\\u231D',\n\turcrop: '\\u230E',\n\tUring: '\\u016E',\n\turing: '\\u016F',\n\turtri: '\\u25F9',\n\tUscr: '\\uD835\\uDCB0',\n\tuscr: '\\uD835\\uDCCA',\n\tutdot: '\\u22F0',\n\tUtilde: '\\u0168',\n\tutilde: '\\u0169',\n\tutri: '\\u25B5',\n\tutrif: '\\u25B4',\n\tuuarr: '\\u21C8',\n\tUuml: '\\u00DC',\n\tuuml: '\\u00FC',\n\tuwangle: '\\u29A7',\n\tvangrt: '\\u299C',\n\tvarepsilon: '\\u03F5',\n\tvarkappa: '\\u03F0',\n\tvarnothing: '\\u2205',\n\tvarphi: '\\u03D5',\n\tvarpi: '\\u03D6',\n\tvarpropto: '\\u221D',\n\tvArr: '\\u21D5',\n\tvarr: '\\u2195',\n\tvarrho: '\\u03F1',\n\tvarsigma: '\\u03C2',\n\tvarsubsetneq: '\\u228A\\uFE00',\n\tvarsubsetneqq: '\\u2ACB\\uFE00',\n\tvarsupsetneq: '\\u228B\\uFE00',\n\tvarsupsetneqq: '\\u2ACC\\uFE00',\n\tvartheta: '\\u03D1',\n\tvartriangleleft: '\\u22B2',\n\tvartriangleright: '\\u22B3',\n\tVbar: '\\u2AEB',\n\tvBar: '\\u2AE8',\n\tvBarv: '\\u2AE9',\n\tVcy: '\\u0412',\n\tvcy: '\\u0432',\n\tVDash: '\\u22AB',\n\tVdash: '\\u22A9',\n\tvDash: '\\u22A8',\n\tvdash: '\\u22A2',\n\tVdashl: '\\u2AE6',\n\tVee: '\\u22C1',\n\tvee: '\\u2228',\n\tveebar: '\\u22BB',\n\tveeeq: '\\u225A',\n\tvellip: '\\u22EE',\n\tVerbar: '\\u2016',\n\tverbar: '\\u007C',\n\tVert: '\\u2016',\n\tvert: '\\u007C',\n\tVerticalBar: '\\u2223',\n\tVerticalLine: '\\u007C',\n\tVerticalSeparator: '\\u2758',\n\tVerticalTilde: '\\u2240',\n\tVeryThinSpace: '\\u200A',\n\tVfr: '\\uD835\\uDD19',\n\tvfr: '\\uD835\\uDD33',\n\tvltri: '\\u22B2',\n\tvnsub: '\\u2282\\u20D2',\n\tvnsup: '\\u2283\\u20D2',\n\tVopf: '\\uD835\\uDD4D',\n\tvopf: '\\uD835\\uDD67',\n\tvprop: '\\u221D',\n\tvrtri: '\\u22B3',\n\tVscr: '\\uD835\\uDCB1',\n\tvscr: '\\uD835\\uDCCB',\n\tvsubnE: '\\u2ACB\\uFE00',\n\tvsubne: '\\u228A\\uFE00',\n\tvsupnE: '\\u2ACC\\uFE00',\n\tvsupne: '\\u228B\\uFE00',\n\tVvdash: '\\u22AA',\n\tvzigzag: '\\u299A',\n\tWcirc: '\\u0174',\n\twcirc: '\\u0175',\n\twedbar: '\\u2A5F',\n\tWedge: '\\u22C0',\n\twedge: '\\u2227',\n\twedgeq: '\\u2259',\n\tweierp: '\\u2118',\n\tWfr: '\\uD835\\uDD1A',\n\twfr: '\\uD835\\uDD34',\n\tWopf: '\\uD835\\uDD4E',\n\twopf: '\\uD835\\uDD68',\n\twp: '\\u2118',\n\twr: '\\u2240',\n\twreath: '\\u2240',\n\tWscr: '\\uD835\\uDCB2',\n\twscr: '\\uD835\\uDCCC',\n\txcap: '\\u22C2',\n\txcirc: '\\u25EF',\n\txcup: '\\u22C3',\n\txdtri: '\\u25BD',\n\tXfr: '\\uD835\\uDD1B',\n\txfr: '\\uD835\\uDD35',\n\txhArr: '\\u27FA',\n\txharr: '\\u27F7',\n\tXi: '\\u039E',\n\txi: '\\u03BE',\n\txlArr: '\\u27F8',\n\txlarr: '\\u27F5',\n\txmap: '\\u27FC',\n\txnis: '\\u22FB',\n\txodot: '\\u2A00',\n\tXopf: '\\uD835\\uDD4F',\n\txopf: '\\uD835\\uDD69',\n\txoplus: '\\u2A01',\n\txotime: '\\u2A02',\n\txrArr: '\\u27F9',\n\txrarr: '\\u27F6',\n\tXscr: '\\uD835\\uDCB3',\n\txscr: '\\uD835\\uDCCD',\n\txsqcup: '\\u2A06',\n\txuplus: '\\u2A04',\n\txutri: '\\u25B3',\n\txvee: '\\u22C1',\n\txwedge: '\\u22C0',\n\tYacute: '\\u00DD',\n\tyacute: '\\u00FD',\n\tYAcy: '\\u042F',\n\tyacy: '\\u044F',\n\tYcirc: '\\u0176',\n\tycirc: '\\u0177',\n\tYcy: '\\u042B',\n\tycy: '\\u044B',\n\tyen: '\\u00A5',\n\tYfr: '\\uD835\\uDD1C',\n\tyfr: '\\uD835\\uDD36',\n\tYIcy: '\\u0407',\n\tyicy: '\\u0457',\n\tYopf: '\\uD835\\uDD50',\n\tyopf: '\\uD835\\uDD6A',\n\tYscr: '\\uD835\\uDCB4',\n\tyscr: '\\uD835\\uDCCE',\n\tYUcy: '\\u042E',\n\tyucy: '\\u044E',\n\tYuml: '\\u0178',\n\tyuml: '\\u00FF',\n\tZacute: '\\u0179',\n\tzacute: '\\u017A',\n\tZcaron: '\\u017D',\n\tzcaron: '\\u017E',\n\tZcy: '\\u0417',\n\tzcy: '\\u0437',\n\tZdot: '\\u017B',\n\tzdot: '\\u017C',\n\tzeetrf: '\\u2128',\n\tZeroWidthSpace: '\\u200B',\n\tZeta: '\\u0396',\n\tzeta: '\\u03B6',\n\tZfr: '\\u2128',\n\tzfr: '\\uD835\\uDD37',\n\tZHcy: '\\u0416',\n\tzhcy: '\\u0436',\n\tzigrarr: '\\u21DD',\n\tZopf: '\\u2124',\n\tzopf: '\\uD835\\uDD6B',\n\tZscr: '\\uD835\\uDCB5',\n\tzscr: '\\uD835\\uDCCF',\n\tzwj: '\\u200D',\n\tzwnj: '\\u200C',\n});\n\n/**\n * @deprecated use `HTML_ENTITIES` instead\n * @see HTML_ENTITIES\n */\nexports.entityMap = exports.HTML_ENTITIES;\n\n\n//# sourceURL=webpack://web/./node_modules/@xmldom/xmldom/lib/entities.js?")},"./node_modules/@xmldom/xmldom/lib/index.js":(__unused_webpack_module,exports,__webpack_require__)=>{eval('var dom = __webpack_require__(/*! ./dom */ "./node_modules/@xmldom/xmldom/lib/dom.js")\nexports.DOMImplementation = dom.DOMImplementation\nexports.XMLSerializer = dom.XMLSerializer\nexports.DOMParser = __webpack_require__(/*! ./dom-parser */ "./node_modules/@xmldom/xmldom/lib/dom-parser.js").DOMParser\n\n\n//# sourceURL=webpack://web/./node_modules/@xmldom/xmldom/lib/index.js?')},"./node_modules/@xmldom/xmldom/lib/sax.js":(__unused_webpack_module,exports,__webpack_require__)=>{eval("var NAMESPACE = (__webpack_require__(/*! ./conventions */ \"./node_modules/@xmldom/xmldom/lib/conventions.js\").NAMESPACE);\n\n//[4] \tNameStartChar\t ::= \t\":\" | [A-Z] | \"_\" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n//[4a] \tNameChar\t ::= \tNameStartChar | \"-\" | \".\" | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]\n//[5] \tName\t ::= \tNameStartChar (NameChar)*\nvar nameStartChar = /[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]///\\u10000-\\uEFFFF\nvar nameChar = new RegExp(\"[\\\\-\\\\.0-9\"+nameStartChar.source.slice(1,-1)+\"\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040]\");\nvar tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\\:'+nameStartChar.source+nameChar.source+'*)?$');\n//var tagNamePattern = /^[a-zA-Z_][\\w\\-\\.]*(?:\\:[a-zA-Z_][\\w\\-\\.]*)?$/\n//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')\n\n//S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n//S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\nvar S_TAG = 0;//tag name offerring\nvar S_ATTR = 1;//attr name offerring\nvar S_ATTR_SPACE=2;//attr name end and space offer\nvar S_EQ = 3;//=space?\nvar S_ATTR_NOQUOT_VALUE = 4;//attr value(no quot value only)\nvar S_ATTR_END = 5;//attr value end and no space(quot end)\nvar S_TAG_SPACE = 6;//(attr value end || tag end ) && (space offer)\nvar S_TAG_CLOSE = 7;//closed el<el />\n\n/**\n * Creates an error that will not be caught by XMLReader aka the SAX parser.\n *\n * @param {string} message\n * @param {any?} locator Optional, can provide details about the location in the source\n * @constructor\n */\nfunction ParseError(message, locator) {\n\tthis.message = message\n\tthis.locator = locator\n\tif(Error.captureStackTrace) Error.captureStackTrace(this, ParseError);\n}\nParseError.prototype = new Error();\nParseError.prototype.name = ParseError.name\n\nfunction XMLReader(){\n\n}\n\nXMLReader.prototype = {\n\tparse:function(source,defaultNSMap,entityMap){\n\t\tvar domBuilder = this.domBuilder;\n\t\tdomBuilder.startDocument();\n\t\t_copy(defaultNSMap ,defaultNSMap = {})\n\t\tparse(source,defaultNSMap,entityMap,\n\t\t\t\tdomBuilder,this.errorHandler);\n\t\tdomBuilder.endDocument();\n\t}\n}\nfunction parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){\n\tfunction fixedFromCharCode(code) {\n\t\t// String.prototype.fromCharCode does not supports\n\t\t// > 2 bytes unicode chars directly\n\t\tif (code > 0xffff) {\n\t\t\tcode -= 0x10000;\n\t\t\tvar surrogate1 = 0xd800 + (code >> 10)\n\t\t\t\t, surrogate2 = 0xdc00 + (code & 0x3ff);\n\n\t\t\treturn String.fromCharCode(surrogate1, surrogate2);\n\t\t} else {\n\t\t\treturn String.fromCharCode(code);\n\t\t}\n\t}\n\tfunction entityReplacer(a){\n\t\tvar k = a.slice(1,-1);\n\t\tif (Object.hasOwnProperty.call(entityMap, k)) {\n\t\t\treturn entityMap[k];\n\t\t}else if(k.charAt(0) === '#'){\n\t\t\treturn fixedFromCharCode(parseInt(k.substr(1).replace('x','0x')))\n\t\t}else{\n\t\t\terrorHandler.error('entity not found:'+a);\n\t\t\treturn a;\n\t\t}\n\t}\n\tfunction appendText(end){//has some bugs\n\t\tif(end>start){\n\t\t\tvar xt = source.substring(start,end).replace(/&#?\\w+;/g,entityReplacer);\n\t\t\tlocator&&position(start);\n\t\t\tdomBuilder.characters(xt,0,end-start);\n\t\t\tstart = end\n\t\t}\n\t}\n\tfunction position(p,m){\n\t\twhile(p>=lineEnd && (m = linePattern.exec(source))){\n\t\t\tlineStart = m.index;\n\t\t\tlineEnd = lineStart + m[0].length;\n\t\t\tlocator.lineNumber++;\n\t\t\t//console.log('line++:',locator,startPos,endPos)\n\t\t}\n\t\tlocator.columnNumber = p-lineStart+1;\n\t}\n\tvar lineStart = 0;\n\tvar lineEnd = 0;\n\tvar linePattern = /.*(?:\\r\\n?|\\n)|.*$/g\n\tvar locator = domBuilder.locator;\n\n\tvar parseStack = [{currentNSMap:defaultNSMapCopy}]\n\tvar closeMap = {};\n\tvar start = 0;\n\twhile(true){\n\t\ttry{\n\t\t\tvar tagStart = source.indexOf('<',start);\n\t\t\tif(tagStart<0){\n\t\t\t\tif(!source.substr(start).match(/^\\s*$/)){\n\t\t\t\t\tvar doc = domBuilder.doc;\n\t \t\t\tvar text = doc.createTextNode(source.substr(start));\n\t \t\t\tdoc.appendChild(text);\n\t \t\t\tdomBuilder.currentElement = text;\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(tagStart>start){\n\t\t\t\tappendText(tagStart);\n\t\t\t}\n\t\t\tswitch(source.charAt(tagStart+1)){\n\t\t\tcase '/':\n\t\t\t\tvar end = source.indexOf('>',tagStart+3);\n\t\t\t\tvar tagName = source.substring(tagStart + 2, end).replace(/[ \\t\\n\\r]+$/g, '');\n\t\t\t\tvar config = parseStack.pop();\n\t\t\t\tif(end<0){\n\n\t \t\ttagName = source.substring(tagStart+2).replace(/[\\s<].*/,'');\n\t \t\terrorHandler.error(\"end tag name: \"+tagName+' is not complete:'+config.tagName);\n\t \t\tend = tagStart+1+tagName.length;\n\t \t}else if(tagName.match(/\\s</)){\n\t \t\ttagName = tagName.replace(/[\\s<].*/,'');\n\t \t\terrorHandler.error(\"end tag name: \"+tagName+' maybe not complete');\n\t \t\tend = tagStart+1+tagName.length;\n\t\t\t\t}\n\t\t\t\tvar localNSMap = config.localNSMap;\n\t\t\t\tvar endMatch = config.tagName == tagName;\n\t\t\t\tvar endIgnoreCaseMach = endMatch || config.tagName&&config.tagName.toLowerCase() == tagName.toLowerCase()\n\t\t if(endIgnoreCaseMach){\n\t\t \tdomBuilder.endElement(config.uri,config.localName,tagName);\n\t\t\t\t\tif(localNSMap){\n\t\t\t\t\t\tfor (var prefix in localNSMap) {\n\t\t\t\t\t\t\tif (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {\n\t\t\t\t\t\t\t\tdomBuilder.endPrefixMapping(prefix);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(!endMatch){\n\t\t \terrorHandler.fatalError(\"end tag name: \"+tagName+' is not match the current start tagName:'+config.tagName ); // No known test case\n\t\t\t\t\t}\n\t\t }else{\n\t\t \tparseStack.push(config)\n\t\t }\n\n\t\t\t\tend++;\n\t\t\t\tbreak;\n\t\t\t\t// end elment\n\t\t\tcase '?':// <?...?>\n\t\t\t\tlocator&&position(tagStart);\n\t\t\t\tend = parseInstruction(source,tagStart,domBuilder);\n\t\t\t\tbreak;\n\t\t\tcase '!':// <!doctype,<![CDATA,\x3c!--\n\t\t\t\tlocator&&position(tagStart);\n\t\t\t\tend = parseDCC(source,tagStart,domBuilder,errorHandler);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tlocator&&position(tagStart);\n\t\t\t\tvar el = new ElementAttributes();\n\t\t\t\tvar currentNSMap = parseStack[parseStack.length-1].currentNSMap;\n\t\t\t\t//elStartEnd\n\t\t\t\tvar end = parseElementStartPart(source,tagStart,el,currentNSMap,entityReplacer,errorHandler);\n\t\t\t\tvar len = el.length;\n\n\n\t\t\t\tif(!el.closed && fixSelfClosed(source,end,el.tagName,closeMap)){\n\t\t\t\t\tel.closed = true;\n\t\t\t\t\tif(!entityMap.nbsp){\n\t\t\t\t\t\terrorHandler.warning('unclosed xml attribute');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(locator && len){\n\t\t\t\t\tvar locator2 = copyLocator(locator,{});\n\t\t\t\t\t//try{//attribute position fixed\n\t\t\t\t\tfor(var i = 0;i<len;i++){\n\t\t\t\t\t\tvar a = el[i];\n\t\t\t\t\t\tposition(a.offset);\n\t\t\t\t\t\ta.locator = copyLocator(locator,{});\n\t\t\t\t\t}\n\t\t\t\t\tdomBuilder.locator = locator2\n\t\t\t\t\tif(appendElement(el,domBuilder,currentNSMap)){\n\t\t\t\t\t\tparseStack.push(el)\n\t\t\t\t\t}\n\t\t\t\t\tdomBuilder.locator = locator;\n\t\t\t\t}else{\n\t\t\t\t\tif(appendElement(el,domBuilder,currentNSMap)){\n\t\t\t\t\t\tparseStack.push(el)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (NAMESPACE.isHTML(el.uri) && !el.closed) {\n\t\t\t\t\tend = parseHtmlSpecialContent(source,end,el.tagName,entityReplacer,domBuilder)\n\t\t\t\t} else {\n\t\t\t\t\tend++;\n\t\t\t\t}\n\t\t\t}\n\t\t}catch(e){\n\t\t\tif (e instanceof ParseError) {\n\t\t\t\tthrow e;\n\t\t\t}\n\t\t\terrorHandler.error('element parse error: '+e)\n\t\t\tend = -1;\n\t\t}\n\t\tif(end>start){\n\t\t\tstart = end;\n\t\t}else{\n\t\t\t//TODO: 这里有可能sax回退,有位置错误风险\n\t\t\tappendText(Math.max(tagStart,start)+1);\n\t\t}\n\t}\n}\nfunction copyLocator(f,t){\n\tt.lineNumber = f.lineNumber;\n\tt.columnNumber = f.columnNumber;\n\treturn t;\n}\n\n/**\n * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);\n * @return end of the elementStartPart(end of elementEndPart for selfClosed el)\n */\nfunction parseElementStartPart(source,start,el,currentNSMap,entityReplacer,errorHandler){\n\n\t/**\n\t * @param {string} qname\n\t * @param {string} value\n\t * @param {number} startIndex\n\t */\n\tfunction addAttribute(qname, value, startIndex) {\n\t\tif (el.attributeNames.hasOwnProperty(qname)) {\n\t\t\terrorHandler.fatalError('Attribute ' + qname + ' redefined')\n\t\t}\n\t\tel.addValue(\n\t\t\tqname,\n\t\t\t// @see https://www.w3.org/TR/xml/#AVNormalize\n\t\t\t// since the xmldom sax parser does not \"interpret\" DTD the following is not implemented:\n\t\t\t// - recursive replacement of (DTD) entity references\n\t\t\t// - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA\n\t\t\tvalue.replace(/[\\t\\n\\r]/g, ' ').replace(/&#?\\w+;/g, entityReplacer),\n\t\t\tstartIndex\n\t\t)\n\t}\n\tvar attrName;\n\tvar value;\n\tvar p = ++start;\n\tvar s = S_TAG;//status\n\twhile(true){\n\t\tvar c = source.charAt(p);\n\t\tswitch(c){\n\t\tcase '=':\n\t\t\tif(s === S_ATTR){//attrName\n\t\t\t\tattrName = source.slice(start,p);\n\t\t\t\ts = S_EQ;\n\t\t\t}else if(s === S_ATTR_SPACE){\n\t\t\t\ts = S_EQ;\n\t\t\t}else{\n\t\t\t\t//fatalError: equal must after attrName or space after attrName\n\t\t\t\tthrow new Error('attribute equal must after attrName'); // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase '\\'':\n\t\tcase '\"':\n\t\t\tif(s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE\n\t\t\t\t){//equal\n\t\t\t\tif(s === S_ATTR){\n\t\t\t\t\terrorHandler.warning('attribute value must after \"=\"')\n\t\t\t\t\tattrName = source.slice(start,p)\n\t\t\t\t}\n\t\t\t\tstart = p+1;\n\t\t\t\tp = source.indexOf(c,start)\n\t\t\t\tif(p>0){\n\t\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\t\taddAttribute(attrName, value, start-1);\n\t\t\t\t\ts = S_ATTR_END;\n\t\t\t\t}else{\n\t\t\t\t\t//fatalError: no end quot match\n\t\t\t\t\tthrow new Error('attribute value no end \\''+c+'\\' match');\n\t\t\t\t}\n\t\t\t}else if(s == S_ATTR_NOQUOT_VALUE){\n\t\t\t\tvalue = source.slice(start, p);\n\t\t\t\taddAttribute(attrName, value, start);\n\t\t\t\terrorHandler.warning('attribute \"'+attrName+'\" missed start quot('+c+')!!');\n\t\t\t\tstart = p+1;\n\t\t\t\ts = S_ATTR_END\n\t\t\t}else{\n\t\t\t\t//fatalError: no equal before\n\t\t\t\tthrow new Error('attribute value must after \"=\"'); // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase '/':\n\t\t\tswitch(s){\n\t\t\tcase S_TAG:\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\tcase S_ATTR_END:\n\t\t\tcase S_TAG_SPACE:\n\t\t\tcase S_TAG_CLOSE:\n\t\t\t\ts =S_TAG_CLOSE;\n\t\t\t\tel.closed = true;\n\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\tcase S_ATTR:\n\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\tel.closed = true;\n\t\t\t\tbreak;\n\t\t\t//case S_EQ:\n\t\t\tdefault:\n\t\t\t\tthrow new Error(\"attribute invalid close char('/')\") // No known test case\n\t\t\t}\n\t\t\tbreak;\n\t\tcase ''://end document\n\t\t\terrorHandler.error('unexpected end of input');\n\t\t\tif(s == S_TAG){\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\t}\n\t\t\treturn p;\n\t\tcase '>':\n\t\t\tswitch(s){\n\t\t\tcase S_TAG:\n\t\t\t\tel.setTagName(source.slice(start,p));\n\t\t\tcase S_ATTR_END:\n\t\t\tcase S_TAG_SPACE:\n\t\t\tcase S_TAG_CLOSE:\n\t\t\t\tbreak;//normal\n\t\t\tcase S_ATTR_NOQUOT_VALUE://Compatible state\n\t\t\tcase S_ATTR:\n\t\t\t\tvalue = source.slice(start,p);\n\t\t\t\tif(value.slice(-1) === '/'){\n\t\t\t\t\tel.closed = true;\n\t\t\t\t\tvalue = value.slice(0,-1)\n\t\t\t\t}\n\t\t\tcase S_ATTR_SPACE:\n\t\t\t\tif(s === S_ATTR_SPACE){\n\t\t\t\t\tvalue = attrName;\n\t\t\t\t}\n\t\t\t\tif(s == S_ATTR_NOQUOT_VALUE){\n\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed quot(\")!');\n\t\t\t\t\taddAttribute(attrName, value, start)\n\t\t\t\t}else{\n\t\t\t\t\tif(!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){\n\t\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed value!! \"'+value+'\" instead!!')\n\t\t\t\t\t}\n\t\t\t\t\taddAttribute(value, value, start)\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase S_EQ:\n\t\t\t\tthrow new Error('attribute value missed!!');\n\t\t\t}\n//\t\t\tconsole.log(tagName,tagNamePattern,tagNamePattern.test(tagName))\n\t\t\treturn p;\n\t\t/*xml space '\\x20' | #x9 | #xD | #xA; */\n\t\tcase '\\u0080':\n\t\t\tc = ' ';\n\t\tdefault:\n\t\t\tif(c<= ' '){//space\n\t\t\t\tswitch(s){\n\t\t\t\tcase S_TAG:\n\t\t\t\t\tel.setTagName(source.slice(start,p));//tagName\n\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR:\n\t\t\t\t\tattrName = source.slice(start,p)\n\t\t\t\t\ts = S_ATTR_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR_NOQUOT_VALUE:\n\t\t\t\t\tvar value = source.slice(start, p);\n\t\t\t\t\terrorHandler.warning('attribute \"'+value+'\" missed quot(\")!!');\n\t\t\t\t\taddAttribute(attrName, value, start)\n\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\ts = S_TAG_SPACE;\n\t\t\t\t\tbreak;\n\t\t\t\t//case S_TAG_SPACE:\n\t\t\t\t//case S_EQ:\n\t\t\t\t//case S_ATTR_SPACE:\n\t\t\t\t//\tvoid();break;\n\t\t\t\t//case S_TAG_CLOSE:\n\t\t\t\t\t//ignore warning\n\t\t\t\t}\n\t\t\t}else{//not space\n//S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n//S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\n\t\t\t\tswitch(s){\n\t\t\t\t//case S_TAG:void();break;\n\t\t\t\t//case S_ATTR:void();break;\n\t\t\t\t//case S_ATTR_NOQUOT_VALUE:void();break;\n\t\t\t\tcase S_ATTR_SPACE:\n\t\t\t\t\tvar tagName = el.tagName;\n\t\t\t\t\tif (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {\n\t\t\t\t\t\terrorHandler.warning('attribute \"'+attrName+'\" missed value!! \"'+attrName+'\" instead2!!')\n\t\t\t\t\t}\n\t\t\t\t\taddAttribute(attrName, attrName, start);\n\t\t\t\t\tstart = p;\n\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_ATTR_END:\n\t\t\t\t\terrorHandler.warning('attribute space is required\"'+attrName+'\"!!')\n\t\t\t\tcase S_TAG_SPACE:\n\t\t\t\t\ts = S_ATTR;\n\t\t\t\t\tstart = p;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_EQ:\n\t\t\t\t\ts = S_ATTR_NOQUOT_VALUE;\n\t\t\t\t\tstart = p;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S_TAG_CLOSE:\n\t\t\t\t\tthrow new Error(\"elements closed character '/' and '>' must be connected to\");\n\t\t\t\t}\n\t\t\t}\n\t\t}//end outer switch\n\t\t//console.log('p++',p)\n\t\tp++;\n\t}\n}\n/**\n * @return true if has new namespace define\n */\nfunction appendElement(el,domBuilder,currentNSMap){\n\tvar tagName = el.tagName;\n\tvar localNSMap = null;\n\t//var currentNSMap = parseStack[parseStack.length-1].currentNSMap;\n\tvar i = el.length;\n\twhile(i--){\n\t\tvar a = el[i];\n\t\tvar qName = a.qName;\n\t\tvar value = a.value;\n\t\tvar nsp = qName.indexOf(':');\n\t\tif(nsp>0){\n\t\t\tvar prefix = a.prefix = qName.slice(0,nsp);\n\t\t\tvar localName = qName.slice(nsp+1);\n\t\t\tvar nsPrefix = prefix === 'xmlns' && localName\n\t\t}else{\n\t\t\tlocalName = qName;\n\t\t\tprefix = null\n\t\t\tnsPrefix = qName === 'xmlns' && ''\n\t\t}\n\t\t//can not set prefix,because prefix !== ''\n\t\ta.localName = localName ;\n\t\t//prefix == null for no ns prefix attribute\n\t\tif(nsPrefix !== false){//hack!!\n\t\t\tif(localNSMap == null){\n\t\t\t\tlocalNSMap = {}\n\t\t\t\t//console.log(currentNSMap,0)\n\t\t\t\t_copy(currentNSMap,currentNSMap={})\n\t\t\t\t//console.log(currentNSMap,1)\n\t\t\t}\n\t\t\tcurrentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;\n\t\t\ta.uri = NAMESPACE.XMLNS\n\t\t\tdomBuilder.startPrefixMapping(nsPrefix, value)\n\t\t}\n\t}\n\tvar i = el.length;\n\twhile(i--){\n\t\ta = el[i];\n\t\tvar prefix = a.prefix;\n\t\tif(prefix){//no prefix attribute has no namespace\n\t\t\tif(prefix === 'xml'){\n\t\t\t\ta.uri = NAMESPACE.XML;\n\t\t\t}if(prefix !== 'xmlns'){\n\t\t\t\ta.uri = currentNSMap[prefix || '']\n\n\t\t\t\t//{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}\n\t\t\t}\n\t\t}\n\t}\n\tvar nsp = tagName.indexOf(':');\n\tif(nsp>0){\n\t\tprefix = el.prefix = tagName.slice(0,nsp);\n\t\tlocalName = el.localName = tagName.slice(nsp+1);\n\t}else{\n\t\tprefix = null;//important!!\n\t\tlocalName = el.localName = tagName;\n\t}\n\t//no prefix element has default namespace\n\tvar ns = el.uri = currentNSMap[prefix || ''];\n\tdomBuilder.startElement(ns,localName,tagName,el);\n\t//endPrefixMapping and startPrefixMapping have not any help for dom builder\n\t//localNSMap = null\n\tif(el.closed){\n\t\tdomBuilder.endElement(ns,localName,tagName);\n\t\tif(localNSMap){\n\t\t\tfor (prefix in localNSMap) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {\n\t\t\t\t\tdomBuilder.endPrefixMapping(prefix);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}else{\n\t\tel.currentNSMap = currentNSMap;\n\t\tel.localNSMap = localNSMap;\n\t\t//parseStack.push(el);\n\t\treturn true;\n\t}\n}\nfunction parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){\n\tif(/^(?:script|textarea)$/i.test(tagName)){\n\t\tvar elEndStart = source.indexOf('</'+tagName+'>',elStartEnd);\n\t\tvar text = source.substring(elStartEnd+1,elEndStart);\n\t\tif(/[&<]/.test(text)){\n\t\t\tif(/^script$/i.test(tagName)){\n\t\t\t\t//if(!/\\]\\]>/.test(text)){\n\t\t\t\t\t//lexHandler.startCDATA();\n\t\t\t\t\tdomBuilder.characters(text,0,text.length);\n\t\t\t\t\t//lexHandler.endCDATA();\n\t\t\t\t\treturn elEndStart;\n\t\t\t\t//}\n\t\t\t}//}else{//text area\n\t\t\t\ttext = text.replace(/&#?\\w+;/g,entityReplacer);\n\t\t\t\tdomBuilder.characters(text,0,text.length);\n\t\t\t\treturn elEndStart;\n\t\t\t//}\n\n\t\t}\n\t}\n\treturn elStartEnd+1;\n}\nfunction fixSelfClosed(source,elStartEnd,tagName,closeMap){\n\t//if(tagName in closeMap){\n\tvar pos = closeMap[tagName];\n\tif(pos == null){\n\t\t//console.log(tagName)\n\t\tpos = source.lastIndexOf('</'+tagName+'>')\n\t\tif(pos<elStartEnd){//忘记闭合\n\t\t\tpos = source.lastIndexOf('</'+tagName)\n\t\t}\n\t\tcloseMap[tagName] =pos\n\t}\n\treturn pos<elStartEnd;\n\t//}\n}\n\nfunction _copy (source, target) {\n\tfor (var n in source) {\n\t\tif (Object.prototype.hasOwnProperty.call(source, n)) {\n\t\t\ttarget[n] = source[n];\n\t\t}\n\t}\n}\n\nfunction parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'\n\tvar next= source.charAt(start+2)\n\tswitch(next){\n\tcase '-':\n\t\tif(source.charAt(start + 3) === '-'){\n\t\t\tvar end = source.indexOf('--\x3e',start+4);\n\t\t\t//append comment source.substring(4,end)//\x3c!--\n\t\t\tif(end>start){\n\t\t\t\tdomBuilder.comment(source,start+4,end-start-4);\n\t\t\t\treturn end+3;\n\t\t\t}else{\n\t\t\t\terrorHandler.error(\"Unclosed comment\");\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}else{\n\t\t\t//error\n\t\t\treturn -1;\n\t\t}\n\tdefault:\n\t\tif(source.substr(start+3,6) == 'CDATA['){\n\t\t\tvar end = source.indexOf(']]>',start+9);\n\t\t\tdomBuilder.startCDATA();\n\t\t\tdomBuilder.characters(source,start+9,end-start-9);\n\t\t\tdomBuilder.endCDATA()\n\t\t\treturn end+3;\n\t\t}\n\t\t//<!DOCTYPE\n\t\t//startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)\n\t\tvar matchs = split(source,start);\n\t\tvar len = matchs.length;\n\t\tif(len>1 && /!doctype/i.test(matchs[0][0])){\n\t\t\tvar name = matchs[1][0];\n\t\t\tvar pubid = false;\n\t\t\tvar sysid = false;\n\t\t\tif(len>3){\n\t\t\t\tif(/^public$/i.test(matchs[2][0])){\n\t\t\t\t\tpubid = matchs[3][0];\n\t\t\t\t\tsysid = len>4 && matchs[4][0];\n\t\t\t\t}else if(/^system$/i.test(matchs[2][0])){\n\t\t\t\t\tsysid = matchs[3][0];\n\t\t\t\t}\n\t\t\t}\n\t\t\tvar lastMatch = matchs[len-1]\n\t\t\tdomBuilder.startDTD(name, pubid, sysid);\n\t\t\tdomBuilder.endDTD();\n\n\t\t\treturn lastMatch.index+lastMatch[0].length\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n\nfunction parseInstruction(source,start,domBuilder){\n\tvar end = source.indexOf('?>',start);\n\tif(end){\n\t\tvar match = source.substring(start,end).match(/^<\\?(\\S*)\\s*([\\s\\S]*?)\\s*$/);\n\t\tif(match){\n\t\t\tvar len = match[0].length;\n\t\t\tdomBuilder.processingInstruction(match[1], match[2]) ;\n\t\t\treturn end+2;\n\t\t}else{//error\n\t\t\treturn -1;\n\t\t}\n\t}\n\treturn -1;\n}\n\nfunction ElementAttributes(){\n\tthis.attributeNames = {}\n}\nElementAttributes.prototype = {\n\tsetTagName:function(tagName){\n\t\tif(!tagNamePattern.test(tagName)){\n\t\t\tthrow new Error('invalid tagName:'+tagName)\n\t\t}\n\t\tthis.tagName = tagName\n\t},\n\taddValue:function(qName, value, offset) {\n\t\tif(!tagNamePattern.test(qName)){\n\t\t\tthrow new Error('invalid attribute:'+qName)\n\t\t}\n\t\tthis.attributeNames[qName] = this.length;\n\t\tthis[this.length++] = {qName:qName,value:value,offset:offset}\n\t},\n\tlength:0,\n\tgetLocalName:function(i){return this[i].localName},\n\tgetLocator:function(i){return this[i].locator},\n\tgetQName:function(i){return this[i].qName},\n\tgetURI:function(i){return this[i].uri},\n\tgetValue:function(i){return this[i].value}\n//\t,getIndex:function(uri, localName)){\n//\t\tif(localName){\n//\n//\t\t}else{\n//\t\t\tvar qName = uri\n//\t\t}\n//\t},\n//\tgetValue:function(){return this.getValue(this.getIndex.apply(this,arguments))},\n//\tgetType:function(uri,localName){}\n//\tgetType:function(i){},\n}\n\n\n\nfunction split(source,start){\n\tvar match;\n\tvar buf = [];\n\tvar reg = /'[^']+'|\"[^\"]+\"|[^\\s<>\\/=]+=?|(\\/?\\s*>|<)/g;\n\treg.lastIndex = start;\n\treg.exec(source);//skip <\n\twhile(match = reg.exec(source)){\n\t\tbuf.push(match);\n\t\tif(match[1])return buf;\n\t}\n}\n\nexports.XMLReader = XMLReader;\nexports.ParseError = ParseError;\n\n\n//# sourceURL=webpack://web/./node_modules/@xmldom/xmldom/lib/sax.js?")},"./node_modules/core-js/modules/_a-function.js":module=>{eval("module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_a-function.js?")},"./node_modules/core-js/modules/_add-to-unscopables.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// 22.1.3.31 Array.prototype[@@unscopables]\nvar UNSCOPABLES = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")(\'unscopables\');\nvar ArrayProto = Array.prototype;\nif (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js")(ArrayProto, UNSCOPABLES, {});\nmodule.exports = function (key) {\n ArrayProto[UNSCOPABLES][key] = true;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_add-to-unscopables.js?')},"./node_modules/core-js/modules/_advance-string-index.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar at = __webpack_require__(/*! ./_string-at */ "./node_modules/core-js/modules/_string-at.js")(true);\n\n // `AdvanceStringIndex` abstract operation\n// https://tc39.github.io/ecma262/#sec-advancestringindex\nmodule.exports = function (S, index, unicode) {\n return index + (unicode ? at(S, index).length : 1);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_advance-string-index.js?')},"./node_modules/core-js/modules/_an-object.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var isObject = __webpack_require__(/*! ./_is-object */ \"./node_modules/core-js/modules/_is-object.js\");\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_an-object.js?")},"./node_modules/core-js/modules/_array-includes.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js");\nvar toLength = __webpack_require__(/*! ./_to-length */ "./node_modules/core-js/modules/_to-length.js");\nvar toAbsoluteIndex = __webpack_require__(/*! ./_to-absolute-index */ "./node_modules/core-js/modules/_to-absolute-index.js");\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_array-includes.js?')},"./node_modules/core-js/modules/_array-methods.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// 0 -> Array#forEach\n// 1 -> Array#map\n// 2 -> Array#filter\n// 3 -> Array#some\n// 4 -> Array#every\n// 5 -> Array#find\n// 6 -> Array#findIndex\nvar ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js");\nvar IObject = __webpack_require__(/*! ./_iobject */ "./node_modules/core-js/modules/_iobject.js");\nvar toObject = __webpack_require__(/*! ./_to-object */ "./node_modules/core-js/modules/_to-object.js");\nvar toLength = __webpack_require__(/*! ./_to-length */ "./node_modules/core-js/modules/_to-length.js");\nvar asc = __webpack_require__(/*! ./_array-species-create */ "./node_modules/core-js/modules/_array-species-create.js");\nmodule.exports = function (TYPE, $create) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n var create = $create || asc;\n return function ($this, callbackfn, that) {\n var O = toObject($this);\n var self = IObject(O);\n var f = ctx(callbackfn, that, 3);\n var length = toLength(self.length);\n var index = 0;\n var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n var val, res;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n val = self[index];\n res = f(val, index, O);\n if (TYPE) {\n if (IS_MAP) result[index] = res; // map\n else if (res) switch (TYPE) {\n case 3: return true; // some\n case 5: return val; // find\n case 6: return index; // findIndex\n case 2: result.push(val); // filter\n } else if (IS_EVERY) return false; // every\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;\n };\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_array-methods.js?')},"./node_modules/core-js/modules/_array-reduce.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var aFunction = __webpack_require__(/*! ./_a-function */ "./node_modules/core-js/modules/_a-function.js");\nvar toObject = __webpack_require__(/*! ./_to-object */ "./node_modules/core-js/modules/_to-object.js");\nvar IObject = __webpack_require__(/*! ./_iobject */ "./node_modules/core-js/modules/_iobject.js");\nvar toLength = __webpack_require__(/*! ./_to-length */ "./node_modules/core-js/modules/_to-length.js");\n\nmodule.exports = function (that, callbackfn, aLen, memo, isRight) {\n aFunction(callbackfn);\n var O = toObject(that);\n var self = IObject(O);\n var length = toLength(O.length);\n var index = isRight ? length - 1 : 0;\n var i = isRight ? -1 : 1;\n if (aLen < 2) for (;;) {\n if (index in self) {\n memo = self[index];\n index += i;\n break;\n }\n index += i;\n if (isRight ? index < 0 : length <= index) {\n throw TypeError(\'Reduce of empty array with no initial value\');\n }\n }\n for (;isRight ? index >= 0 : length > index; index += i) if (index in self) {\n memo = callbackfn(memo, self[index], index, O);\n }\n return memo;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_array-reduce.js?')},"./node_modules/core-js/modules/_array-species-constructor.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");\nvar isArray = __webpack_require__(/*! ./_is-array */ "./node_modules/core-js/modules/_is-array.js");\nvar SPECIES = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")(\'species\');\n\nmodule.exports = function (original) {\n var C;\n if (isArray(original)) {\n C = original.constructor;\n // cross-realm fallback\n if (typeof C == \'function\' && (C === Array || isArray(C.prototype))) C = undefined;\n if (isObject(C)) {\n C = C[SPECIES];\n if (C === null) C = undefined;\n }\n } return C === undefined ? Array : C;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_array-species-constructor.js?')},"./node_modules/core-js/modules/_array-species-create.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// 9.4.2.3 ArraySpeciesCreate(originalArray, length)\nvar speciesConstructor = __webpack_require__(/*! ./_array-species-constructor */ "./node_modules/core-js/modules/_array-species-constructor.js");\n\nmodule.exports = function (original, length) {\n return new (speciesConstructor(original))(length);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_array-species-create.js?')},"./node_modules/core-js/modules/_classof.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("// getting tag from 19.1.3.6 Object.prototype.toString()\nvar cof = __webpack_require__(/*! ./_cof */ \"./node_modules/core-js/modules/_cof.js\");\nvar TAG = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/modules/_wks.js\")('toStringTag');\n// ES3 wrong here\nvar ARG = cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (e) { /* empty */ }\n};\n\nmodule.exports = function (it) {\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? cof(O)\n // ES3 arguments fallback\n : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_classof.js?")},"./node_modules/core-js/modules/_cof.js":module=>{eval("var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_cof.js?")},"./node_modules/core-js/modules/_core.js":module=>{eval("var core = module.exports = { version: '2.6.12' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_core.js?")},"./node_modules/core-js/modules/_create-property.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar $defineProperty = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js");\nvar createDesc = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js");\n\nmodule.exports = function (object, index, value) {\n if (index in object) $defineProperty.f(object, index, createDesc(0, value));\n else object[index] = value;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_create-property.js?')},"./node_modules/core-js/modules/_ctx.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// optional / simple context binding\nvar aFunction = __webpack_require__(/*! ./_a-function */ "./node_modules/core-js/modules/_a-function.js");\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_ctx.js?')},"./node_modules/core-js/modules/_defined.js":module=>{eval('// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError("Can\'t call method on " + it);\n return it;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_defined.js?')},"./node_modules/core-js/modules/_descriptors.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("// Thank's IE8 for his funny defineProperty\nmodule.exports = !__webpack_require__(/*! ./_fails */ \"./node_modules/core-js/modules/_fails.js\")(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_descriptors.js?")},"./node_modules/core-js/modules/_dom-create.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");\nvar document = (__webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js").document);\n// typeof document.createElement is \'object\' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_dom-create.js?')},"./node_modules/core-js/modules/_enum-bug-keys.js":module=>{eval("// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_enum-bug-keys.js?")},"./node_modules/core-js/modules/_enum-keys.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// all enumerable object keys, includes symbols\nvar getKeys = __webpack_require__(/*! ./_object-keys */ "./node_modules/core-js/modules/_object-keys.js");\nvar gOPS = __webpack_require__(/*! ./_object-gops */ "./node_modules/core-js/modules/_object-gops.js");\nvar pIE = __webpack_require__(/*! ./_object-pie */ "./node_modules/core-js/modules/_object-pie.js");\nmodule.exports = function (it) {\n var result = getKeys(it);\n var getSymbols = gOPS.f;\n if (getSymbols) {\n var symbols = getSymbols(it);\n var isEnum = pIE.f;\n var i = 0;\n var key;\n while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);\n } return result;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_enum-keys.js?')},"./node_modules/core-js/modules/_export.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");\nvar core = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js");\nvar hide = __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js");\nvar redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js");\nvar ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js");\nvar PROTOTYPE = \'prototype\';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n var key, own, out, exp;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n // export native or passed\n out = (own ? target : source)[key];\n // bind timers to global for call from export context\n exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == \'function\' ? ctx(Function.call, out) : out;\n // extend global\n if (target) redefine(target, key, out, type & $export.U);\n // export\n if (exports[key] != out) hide(exports, key, exp);\n if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n }\n};\nglobal.core = core;\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_export.js?')},"./node_modules/core-js/modules/_fails.js":module=>{eval("module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_fails.js?")},"./node_modules/core-js/modules/_fix-re-wks.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval("\n__webpack_require__(/*! ./es6.regexp.exec */ \"./node_modules/core-js/modules/es6.regexp.exec.js\");\nvar redefine = __webpack_require__(/*! ./_redefine */ \"./node_modules/core-js/modules/_redefine.js\");\nvar hide = __webpack_require__(/*! ./_hide */ \"./node_modules/core-js/modules/_hide.js\");\nvar fails = __webpack_require__(/*! ./_fails */ \"./node_modules/core-js/modules/_fails.js\");\nvar defined = __webpack_require__(/*! ./_defined */ \"./node_modules/core-js/modules/_defined.js\");\nvar wks = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/modules/_wks.js\");\nvar regexpExec = __webpack_require__(/*! ./_regexp-exec */ \"./node_modules/core-js/modules/_regexp-exec.js\");\n\nvar SPECIES = wks('species');\n\nvar REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {\n // #replace needs built-in support for named groups.\n // #match works fine because it just return the exec results, even if it has\n // a \"grops\" property.\n var re = /./;\n re.exec = function () {\n var result = [];\n result.groups = { a: '7' };\n return result;\n };\n return ''.replace(re, '$<a>') !== '7';\n});\n\nvar SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () {\n // Chrome 51 has a buggy \"split\" implementation when RegExp#exec !== nativeExec\n var re = /(?:)/;\n var originalExec = re.exec;\n re.exec = function () { return originalExec.apply(this, arguments); };\n var result = 'ab'.split(re);\n return result.length === 2 && result[0] === 'a' && result[1] === 'b';\n})();\n\nmodule.exports = function (KEY, length, exec) {\n var SYMBOL = wks(KEY);\n\n var DELEGATES_TO_SYMBOL = !fails(function () {\n // String methods call symbol-named RegEp methods\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n });\n\n var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !fails(function () {\n // Symbol-named RegExp methods call .exec\n var execCalled = false;\n var re = /a/;\n re.exec = function () { execCalled = true; return null; };\n if (KEY === 'split') {\n // RegExp[@@split] doesn't call the regex's exec method, but first creates\n // a new one. We need to return the patched regex when creating the new one.\n re.constructor = {};\n re.constructor[SPECIES] = function () { return re; };\n }\n re[SYMBOL]('');\n return !execCalled;\n }) : undefined;\n\n if (\n !DELEGATES_TO_SYMBOL ||\n !DELEGATES_TO_EXEC ||\n (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||\n (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)\n ) {\n var nativeRegExpMethod = /./[SYMBOL];\n var fns = exec(\n defined,\n SYMBOL,\n ''[KEY],\n function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) {\n if (regexp.exec === regexpExec) {\n if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n // The native String method already delegates to @@method (this\n // polyfilled function), leasing to infinite recursion.\n // We avoid it by directly calling the native @@method method.\n return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };\n }\n return { done: true, value: nativeMethod.call(str, regexp, arg2) };\n }\n return { done: false };\n }\n );\n var strfn = fns[0];\n var rxfn = fns[1];\n\n redefine(String.prototype, KEY, strfn);\n hide(RegExp.prototype, SYMBOL, length == 2\n // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n ? function (string, arg) { return rxfn.call(string, this, arg); }\n // 21.2.5.6 RegExp.prototype[@@match](string)\n // 21.2.5.9 RegExp.prototype[@@search](string)\n : function (string) { return rxfn.call(string, this); }\n );\n }\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_fix-re-wks.js?")},"./node_modules/core-js/modules/_flags.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval("\n// 21.2.5.3 get RegExp.prototype.flags\nvar anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/modules/_an-object.js\");\nmodule.exports = function () {\n var that = anObject(this);\n var result = '';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.unicode) result += 'u';\n if (that.sticky) result += 'y';\n return result;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_flags.js?")},"./node_modules/core-js/modules/_function-to-string.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("module.exports = __webpack_require__(/*! ./_shared */ \"./node_modules/core-js/modules/_shared.js\")('native-function-to-string', Function.toString);\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_function-to-string.js?")},"./node_modules/core-js/modules/_global.js":module=>{eval("// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_global.js?")},"./node_modules/core-js/modules/_has.js":module=>{eval("var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_has.js?")},"./node_modules/core-js/modules/_hide.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var dP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js");\nvar createDesc = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js");\nmodule.exports = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_hide.js?')},"./node_modules/core-js/modules/_html.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var document = (__webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js").document);\nmodule.exports = document && document.documentElement;\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_html.js?')},"./node_modules/core-js/modules/_ie8-dom-define.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('module.exports = !__webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") && !__webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js")(function () {\n return Object.defineProperty(__webpack_require__(/*! ./_dom-create */ "./node_modules/core-js/modules/_dom-create.js")(\'div\'), \'a\', { get: function () { return 7; } }).a != 7;\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_ie8-dom-define.js?')},"./node_modules/core-js/modules/_inherit-if-required.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");\nvar setPrototypeOf = (__webpack_require__(/*! ./_set-proto */ "./node_modules/core-js/modules/_set-proto.js").set);\nmodule.exports = function (that, target, C) {\n var S = target.constructor;\n var P;\n if (S !== C && typeof S == \'function\' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {\n setPrototypeOf(that, P);\n } return that;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_inherit-if-required.js?')},"./node_modules/core-js/modules/_iobject.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = __webpack_require__(/*! ./_cof */ \"./node_modules/core-js/modules/_cof.js\");\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_iobject.js?")},"./node_modules/core-js/modules/_is-array-iter.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// check on default Array iterator\nvar Iterators = __webpack_require__(/*! ./_iterators */ "./node_modules/core-js/modules/_iterators.js");\nvar ITERATOR = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")(\'iterator\');\nvar ArrayProto = Array.prototype;\n\nmodule.exports = function (it) {\n return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_is-array-iter.js?')},"./node_modules/core-js/modules/_is-array.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("// 7.2.2 IsArray(argument)\nvar cof = __webpack_require__(/*! ./_cof */ \"./node_modules/core-js/modules/_cof.js\");\nmodule.exports = Array.isArray || function isArray(arg) {\n return cof(arg) == 'Array';\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_is-array.js?")},"./node_modules/core-js/modules/_is-object.js":module=>{eval("module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_is-object.js?")},"./node_modules/core-js/modules/_is-regexp.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// 7.2.8 IsRegExp(argument)\nvar isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");\nvar cof = __webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js");\nvar MATCH = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")(\'match\');\nmodule.exports = function (it) {\n var isRegExp;\n return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == \'RegExp\');\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_is-regexp.js?')},"./node_modules/core-js/modules/_iter-call.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("// call something on iterator step with safe closing on error\nvar anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/modules/_an-object.js\");\nmodule.exports = function (iterator, fn, value, entries) {\n try {\n return entries ? fn(anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (e) {\n var ret = iterator['return'];\n if (ret !== undefined) anObject(ret.call(iterator));\n throw e;\n }\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_iter-call.js?")},"./node_modules/core-js/modules/_iter-create.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar create = __webpack_require__(/*! ./_object-create */ "./node_modules/core-js/modules/_object-create.js");\nvar descriptor = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js");\nvar setToStringTag = __webpack_require__(/*! ./_set-to-string-tag */ "./node_modules/core-js/modules/_set-to-string-tag.js");\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\n__webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js")(IteratorPrototype, __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")(\'iterator\'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n setToStringTag(Constructor, NAME + \' Iterator\');\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_iter-create.js?')},"./node_modules/core-js/modules/_iter-define.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval("\nvar LIBRARY = __webpack_require__(/*! ./_library */ \"./node_modules/core-js/modules/_library.js\");\nvar $export = __webpack_require__(/*! ./_export */ \"./node_modules/core-js/modules/_export.js\");\nvar redefine = __webpack_require__(/*! ./_redefine */ \"./node_modules/core-js/modules/_redefine.js\");\nvar hide = __webpack_require__(/*! ./_hide */ \"./node_modules/core-js/modules/_hide.js\");\nvar Iterators = __webpack_require__(/*! ./_iterators */ \"./node_modules/core-js/modules/_iterators.js\");\nvar $iterCreate = __webpack_require__(/*! ./_iter-create */ \"./node_modules/core-js/modules/_iter-create.js\");\nvar setToStringTag = __webpack_require__(/*! ./_set-to-string-tag */ \"./node_modules/core-js/modules/_set-to-string-tag.js\");\nvar getPrototypeOf = __webpack_require__(/*! ./_object-gpo */ \"./node_modules/core-js/modules/_object-gpo.js\");\nvar ITERATOR = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/modules/_wks.js\")('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_iter-define.js?")},"./node_modules/core-js/modules/_iter-detect.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var ITERATOR = __webpack_require__(/*! ./_wks */ \"./node_modules/core-js/modules/_wks.js\")('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var riter = [7][ITERATOR]();\n riter['return'] = function () { SAFE_CLOSING = true; };\n // eslint-disable-next-line no-throw-literal\n Array.from(riter, function () { throw 2; });\n} catch (e) { /* empty */ }\n\nmodule.exports = function (exec, skipClosing) {\n if (!skipClosing && !SAFE_CLOSING) return false;\n var safe = false;\n try {\n var arr = [7];\n var iter = arr[ITERATOR]();\n iter.next = function () { return { done: safe = true }; };\n arr[ITERATOR] = function () { return iter; };\n exec(arr);\n } catch (e) { /* empty */ }\n return safe;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_iter-detect.js?")},"./node_modules/core-js/modules/_iter-step.js":module=>{eval("module.exports = function (done, value) {\n return { value: value, done: !!done };\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_iter-step.js?")},"./node_modules/core-js/modules/_iterators.js":module=>{eval("module.exports = {};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_iterators.js?")},"./node_modules/core-js/modules/_library.js":module=>{eval("module.exports = false;\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_library.js?")},"./node_modules/core-js/modules/_meta.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var META = __webpack_require__(/*! ./_uid */ \"./node_modules/core-js/modules/_uid.js\")('meta');\nvar isObject = __webpack_require__(/*! ./_is-object */ \"./node_modules/core-js/modules/_is-object.js\");\nvar has = __webpack_require__(/*! ./_has */ \"./node_modules/core-js/modules/_has.js\");\nvar setDesc = (__webpack_require__(/*! ./_object-dp */ \"./node_modules/core-js/modules/_object-dp.js\").f);\nvar id = 0;\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\nvar FREEZE = !__webpack_require__(/*! ./_fails */ \"./node_modules/core-js/modules/_fails.js\")(function () {\n return isExtensible(Object.preventExtensions({}));\n});\nvar setMeta = function (it) {\n setDesc(it, META, { value: {\n i: 'O' + ++id, // object ID\n w: {} // weak collections IDs\n } });\n};\nvar fastKey = function (it, create) {\n // return primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMeta(it);\n // return object ID\n } return it[META].i;\n};\nvar getWeak = function (it, create) {\n if (!has(it, META)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMeta(it);\n // return hash weak collections IDs\n } return it[META].w;\n};\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);\n return it;\n};\nvar meta = module.exports = {\n KEY: META,\n NEED: false,\n fastKey: fastKey,\n getWeak: getWeak,\n onFreeze: onFreeze\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_meta.js?")},"./node_modules/core-js/modules/_object-create.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/modules/_an-object.js\");\nvar dPs = __webpack_require__(/*! ./_object-dps */ \"./node_modules/core-js/modules/_object-dps.js\");\nvar enumBugKeys = __webpack_require__(/*! ./_enum-bug-keys */ \"./node_modules/core-js/modules/_enum-bug-keys.js\");\nvar IE_PROTO = __webpack_require__(/*! ./_shared-key */ \"./node_modules/core-js/modules/_shared-key.js\")('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = __webpack_require__(/*! ./_dom-create */ \"./node_modules/core-js/modules/_dom-create.js\")('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n (__webpack_require__(/*! ./_html */ \"./node_modules/core-js/modules/_html.js\").appendChild)(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-create.js?")},"./node_modules/core-js/modules/_object-dp.js":(__unused_webpack_module,exports,__webpack_require__)=>{eval("var anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/modules/_an-object.js\");\nvar IE8_DOM_DEFINE = __webpack_require__(/*! ./_ie8-dom-define */ \"./node_modules/core-js/modules/_ie8-dom-define.js\");\nvar toPrimitive = __webpack_require__(/*! ./_to-primitive */ \"./node_modules/core-js/modules/_to-primitive.js\");\nvar dP = Object.defineProperty;\n\nexports.f = __webpack_require__(/*! ./_descriptors */ \"./node_modules/core-js/modules/_descriptors.js\") ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-dp.js?")},"./node_modules/core-js/modules/_object-dps.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var dP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js");\nvar anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");\nvar getKeys = __webpack_require__(/*! ./_object-keys */ "./node_modules/core-js/modules/_object-keys.js");\n\nmodule.exports = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-dps.js?')},"./node_modules/core-js/modules/_object-gopd.js":(__unused_webpack_module,exports,__webpack_require__)=>{eval('var pIE = __webpack_require__(/*! ./_object-pie */ "./node_modules/core-js/modules/_object-pie.js");\nvar createDesc = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js");\nvar toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js");\nvar toPrimitive = __webpack_require__(/*! ./_to-primitive */ "./node_modules/core-js/modules/_to-primitive.js");\nvar has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js");\nvar IE8_DOM_DEFINE = __webpack_require__(/*! ./_ie8-dom-define */ "./node_modules/core-js/modules/_ie8-dom-define.js");\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nexports.f = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? gOPD : function getOwnPropertyDescriptor(O, P) {\n O = toIObject(O);\n P = toPrimitive(P, true);\n if (IE8_DOM_DEFINE) try {\n return gOPD(O, P);\n } catch (e) { /* empty */ }\n if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-gopd.js?')},"./node_modules/core-js/modules/_object-gopn-ext.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window\nvar toIObject = __webpack_require__(/*! ./_to-iobject */ \"./node_modules/core-js/modules/_to-iobject.js\");\nvar gOPN = (__webpack_require__(/*! ./_object-gopn */ \"./node_modules/core-js/modules/_object-gopn.js\").f);\nvar toString = {}.toString;\n\nvar windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames\n ? Object.getOwnPropertyNames(window) : [];\n\nvar getWindowNames = function (it) {\n try {\n return gOPN(it);\n } catch (e) {\n return windowNames.slice();\n }\n};\n\nmodule.exports.f = function getOwnPropertyNames(it) {\n return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-gopn-ext.js?")},"./node_modules/core-js/modules/_object-gopn.js":(__unused_webpack_module,exports,__webpack_require__)=>{eval("// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)\nvar $keys = __webpack_require__(/*! ./_object-keys-internal */ \"./node_modules/core-js/modules/_object-keys-internal.js\");\nvar hiddenKeys = (__webpack_require__(/*! ./_enum-bug-keys */ \"./node_modules/core-js/modules/_enum-bug-keys.js\").concat)('length', 'prototype');\n\nexports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {\n return $keys(O, hiddenKeys);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-gopn.js?")},"./node_modules/core-js/modules/_object-gops.js":(__unused_webpack_module,exports)=>{eval("exports.f = Object.getOwnPropertySymbols;\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-gops.js?")},"./node_modules/core-js/modules/_object-gpo.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js");\nvar toObject = __webpack_require__(/*! ./_to-object */ "./node_modules/core-js/modules/_to-object.js");\nvar IE_PROTO = __webpack_require__(/*! ./_shared-key */ "./node_modules/core-js/modules/_shared-key.js")(\'IE_PROTO\');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == \'function\' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-gpo.js?')},"./node_modules/core-js/modules/_object-keys-internal.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js");\nvar toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js");\nvar arrayIndexOf = __webpack_require__(/*! ./_array-includes */ "./node_modules/core-js/modules/_array-includes.js")(false);\nvar IE_PROTO = __webpack_require__(/*! ./_shared-key */ "./node_modules/core-js/modules/_shared-key.js")(\'IE_PROTO\');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don\'t enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-keys-internal.js?')},"./node_modules/core-js/modules/_object-keys.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = __webpack_require__(/*! ./_object-keys-internal */ "./node_modules/core-js/modules/_object-keys-internal.js");\nvar enumBugKeys = __webpack_require__(/*! ./_enum-bug-keys */ "./node_modules/core-js/modules/_enum-bug-keys.js");\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-keys.js?')},"./node_modules/core-js/modules/_object-pie.js":(__unused_webpack_module,exports)=>{eval("exports.f = {}.propertyIsEnumerable;\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-pie.js?")},"./node_modules/core-js/modules/_object-sap.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// most Object methods by ES6 should accept primitives\nvar $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\nvar core = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js");\nvar fails = __webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js");\nmodule.exports = function (KEY, exec) {\n var fn = (core.Object || {})[KEY] || Object[KEY];\n var exp = {};\n exp[KEY] = exec(fn);\n $export($export.S + $export.F * fails(function () { fn(1); }), \'Object\', exp);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_object-sap.js?')},"./node_modules/core-js/modules/_own-keys.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// all object keys, includes non-enumerable and symbols\nvar gOPN = __webpack_require__(/*! ./_object-gopn */ "./node_modules/core-js/modules/_object-gopn.js");\nvar gOPS = __webpack_require__(/*! ./_object-gops */ "./node_modules/core-js/modules/_object-gops.js");\nvar anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");\nvar Reflect = (__webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js").Reflect);\nmodule.exports = Reflect && Reflect.ownKeys || function ownKeys(it) {\n var keys = gOPN.f(anObject(it));\n var getSymbols = gOPS.f;\n return getSymbols ? keys.concat(getSymbols(it)) : keys;\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_own-keys.js?')},"./node_modules/core-js/modules/_property-desc.js":module=>{eval("module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_property-desc.js?")},"./node_modules/core-js/modules/_redefine.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var global = __webpack_require__(/*! ./_global */ \"./node_modules/core-js/modules/_global.js\");\nvar hide = __webpack_require__(/*! ./_hide */ \"./node_modules/core-js/modules/_hide.js\");\nvar has = __webpack_require__(/*! ./_has */ \"./node_modules/core-js/modules/_has.js\");\nvar SRC = __webpack_require__(/*! ./_uid */ \"./node_modules/core-js/modules/_uid.js\")('src');\nvar $toString = __webpack_require__(/*! ./_function-to-string */ \"./node_modules/core-js/modules/_function-to-string.js\");\nvar TO_STRING = 'toString';\nvar TPL = ('' + $toString).split(TO_STRING);\n\n(__webpack_require__(/*! ./_core */ \"./node_modules/core-js/modules/_core.js\").inspectSource) = function (it) {\n return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) has(val, 'name') || hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_redefine.js?")},"./node_modules/core-js/modules/_regexp-exec-abstract.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval("\n\nvar classof = __webpack_require__(/*! ./_classof */ \"./node_modules/core-js/modules/_classof.js\");\nvar builtinExec = RegExp.prototype.exec;\n\n // `RegExpExec` abstract operation\n// https://tc39.github.io/ecma262/#sec-regexpexec\nmodule.exports = function (R, S) {\n var exec = R.exec;\n if (typeof exec === 'function') {\n var result = exec.call(R, S);\n if (typeof result !== 'object') {\n throw new TypeError('RegExp exec method returned something other than an Object or null');\n }\n return result;\n }\n if (classof(R) !== 'RegExp') {\n throw new TypeError('RegExp#exec called on incompatible receiver');\n }\n return builtinExec.call(R, S);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_regexp-exec-abstract.js?")},"./node_modules/core-js/modules/_regexp-exec.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval("\n\nvar regexpFlags = __webpack_require__(/*! ./_flags */ \"./node_modules/core-js/modules/_flags.js\");\n\nvar nativeExec = RegExp.prototype.exec;\n// This always refers to the native implementation, because the\n// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,\n// which loads this file before patching the method.\nvar nativeReplace = String.prototype.replace;\n\nvar patchedExec = nativeExec;\n\nvar LAST_INDEX = 'lastIndex';\n\nvar UPDATES_LAST_INDEX_WRONG = (function () {\n var re1 = /a/,\n re2 = /b*/g;\n nativeExec.call(re1, 'a');\n nativeExec.call(re2, 'a');\n return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0;\n})();\n\n// nonparticipating capturing group, copied from es5-shim's String#split patch.\nvar NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;\n\nvar PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;\n\nif (PATCH) {\n patchedExec = function exec(str) {\n var re = this;\n var lastIndex, reCopy, match, i;\n\n if (NPCG_INCLUDED) {\n reCopy = new RegExp('^' + re.source + '$(?!\\\\s)', regexpFlags.call(re));\n }\n if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX];\n\n match = nativeExec.call(re, str);\n\n if (UPDATES_LAST_INDEX_WRONG && match) {\n re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex;\n }\n if (NPCG_INCLUDED && match && match.length > 1) {\n // Fix browsers whose `exec` methods don't consistently return `undefined`\n // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/\n // eslint-disable-next-line no-loop-func\n nativeReplace.call(match[0], reCopy, function () {\n for (i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undefined) match[i] = undefined;\n }\n });\n }\n\n return match;\n };\n}\n\nmodule.exports = patchedExec;\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_regexp-exec.js?")},"./node_modules/core-js/modules/_set-proto.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// Works with __proto__ only. Old v8 can\'t work with null proto objects.\n/* eslint-disable no-proto */\nvar isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");\nvar anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");\nvar check = function (O, proto) {\n anObject(O);\n if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can\'t set as prototype!");\n};\nmodule.exports = {\n set: Object.setPrototypeOf || (\'__proto__\' in {} ? // eslint-disable-line\n function (test, buggy, set) {\n try {\n set = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js")(Function.call, (__webpack_require__(/*! ./_object-gopd */ "./node_modules/core-js/modules/_object-gopd.js").f)(Object.prototype, \'__proto__\').set, 2);\n set(test, []);\n buggy = !(test instanceof Array);\n } catch (e) { buggy = true; }\n return function setPrototypeOf(O, proto) {\n check(O, proto);\n if (buggy) O.__proto__ = proto;\n else set(O, proto);\n return O;\n };\n }({}, false) : undefined),\n check: check\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_set-proto.js?')},"./node_modules/core-js/modules/_set-species.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");\nvar dP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js");\nvar DESCRIPTORS = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js");\nvar SPECIES = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")(\'species\');\n\nmodule.exports = function (KEY) {\n var C = global[KEY];\n if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {\n configurable: true,\n get: function () { return this; }\n });\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_set-species.js?')},"./node_modules/core-js/modules/_set-to-string-tag.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var def = (__webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js").f);\nvar has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js");\nvar TAG = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")(\'toStringTag\');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_set-to-string-tag.js?')},"./node_modules/core-js/modules/_shared-key.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var shared = __webpack_require__(/*! ./_shared */ "./node_modules/core-js/modules/_shared.js")(\'keys\');\nvar uid = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js");\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_shared-key.js?')},"./node_modules/core-js/modules/_shared.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var core = __webpack_require__(/*! ./_core */ \"./node_modules/core-js/modules/_core.js\");\nvar global = __webpack_require__(/*! ./_global */ \"./node_modules/core-js/modules/_global.js\");\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: __webpack_require__(/*! ./_library */ \"./node_modules/core-js/modules/_library.js\") ? 'pure' : 'global',\n copyright: '© 2020 Denis Pushkarev (zloirock.ru)'\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_shared.js?")},"./node_modules/core-js/modules/_species-constructor.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// 7.3.20 SpeciesConstructor(O, defaultConstructor)\nvar anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");\nvar aFunction = __webpack_require__(/*! ./_a-function */ "./node_modules/core-js/modules/_a-function.js");\nvar SPECIES = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")(\'species\');\nmodule.exports = function (O, D) {\n var C = anObject(O).constructor;\n var S;\n return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_species-constructor.js?')},"./node_modules/core-js/modules/_strict-method.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar fails = __webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js");\n\nmodule.exports = function (method, arg) {\n return !!method && fails(function () {\n // eslint-disable-next-line no-useless-call\n arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);\n });\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_strict-method.js?')},"./node_modules/core-js/modules/_string-at.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var toInteger = __webpack_require__(/*! ./_to-integer */ "./node_modules/core-js/modules/_to-integer.js");\nvar defined = __webpack_require__(/*! ./_defined */ "./node_modules/core-js/modules/_defined.js");\n// true -> String#at\n// false -> String#codePointAt\nmodule.exports = function (TO_STRING) {\n return function (that, pos) {\n var s = String(defined(that));\n var i = toInteger(pos);\n var l = s.length;\n var a, b;\n if (i < 0 || i >= l) return TO_STRING ? \'\' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_string-at.js?')},"./node_modules/core-js/modules/_to-absolute-index.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var toInteger = __webpack_require__(/*! ./_to-integer */ "./node_modules/core-js/modules/_to-integer.js");\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_to-absolute-index.js?')},"./node_modules/core-js/modules/_to-integer.js":module=>{eval("// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_to-integer.js?")},"./node_modules/core-js/modules/_to-iobject.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = __webpack_require__(/*! ./_iobject */ "./node_modules/core-js/modules/_iobject.js");\nvar defined = __webpack_require__(/*! ./_defined */ "./node_modules/core-js/modules/_defined.js");\nmodule.exports = function (it) {\n return IObject(defined(it));\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_to-iobject.js?')},"./node_modules/core-js/modules/_to-length.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// 7.1.15 ToLength\nvar toInteger = __webpack_require__(/*! ./_to-integer */ "./node_modules/core-js/modules/_to-integer.js");\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_to-length.js?')},"./node_modules/core-js/modules/_to-object.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('// 7.1.13 ToObject(argument)\nvar defined = __webpack_require__(/*! ./_defined */ "./node_modules/core-js/modules/_defined.js");\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_to-object.js?')},"./node_modules/core-js/modules/_to-primitive.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = __webpack_require__(/*! ./_is-object */ \"./node_modules/core-js/modules/_is-object.js\");\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_to-primitive.js?")},"./node_modules/core-js/modules/_uid.js":module=>{eval("var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_uid.js?")},"./node_modules/core-js/modules/_wks-define.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");\nvar core = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js");\nvar LIBRARY = __webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js");\nvar wksExt = __webpack_require__(/*! ./_wks-ext */ "./node_modules/core-js/modules/_wks-ext.js");\nvar defineProperty = (__webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js").f);\nmodule.exports = function (name) {\n var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});\n if (name.charAt(0) != \'_\' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_wks-define.js?')},"./node_modules/core-js/modules/_wks-ext.js":(__unused_webpack_module,exports,__webpack_require__)=>{eval('exports.f = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js");\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_wks-ext.js?')},"./node_modules/core-js/modules/_wks.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var store = __webpack_require__(/*! ./_shared */ \"./node_modules/core-js/modules/_shared.js\")('wks');\nvar uid = __webpack_require__(/*! ./_uid */ \"./node_modules/core-js/modules/_uid.js\");\nvar Symbol = (__webpack_require__(/*! ./_global */ \"./node_modules/core-js/modules/_global.js\").Symbol);\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/_wks.js?")},"./node_modules/core-js/modules/core.get-iterator-method.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var classof = __webpack_require__(/*! ./_classof */ "./node_modules/core-js/modules/_classof.js");\nvar ITERATOR = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")(\'iterator\');\nvar Iterators = __webpack_require__(/*! ./_iterators */ "./node_modules/core-js/modules/_iterators.js");\nmodule.exports = (__webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js").getIteratorMethod) = function (it) {\n if (it != undefined) return it[ITERATOR]\n || it[\'@@iterator\']\n || Iterators[classof(it)];\n};\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/core.get-iterator-method.js?')},"./node_modules/core-js/modules/es6.array.filter.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\nvar $filter = __webpack_require__(/*! ./_array-methods */ "./node_modules/core-js/modules/_array-methods.js")(2);\n\n$export($export.P + $export.F * !__webpack_require__(/*! ./_strict-method */ "./node_modules/core-js/modules/_strict-method.js")([].filter, true), \'Array\', {\n // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])\n filter: function filter(callbackfn /* , thisArg */) {\n return $filter(this, callbackfn, arguments[1]);\n }\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.array.filter.js?')},"./node_modules/core-js/modules/es6.array.for-each.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\nvar $forEach = __webpack_require__(/*! ./_array-methods */ "./node_modules/core-js/modules/_array-methods.js")(0);\nvar STRICT = __webpack_require__(/*! ./_strict-method */ "./node_modules/core-js/modules/_strict-method.js")([].forEach, true);\n\n$export($export.P + $export.F * !STRICT, \'Array\', {\n // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])\n forEach: function forEach(callbackfn /* , thisArg */) {\n return $forEach(this, callbackfn, arguments[1]);\n }\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.array.for-each.js?')},"./node_modules/core-js/modules/es6.array.from.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js");\nvar $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\nvar toObject = __webpack_require__(/*! ./_to-object */ "./node_modules/core-js/modules/_to-object.js");\nvar call = __webpack_require__(/*! ./_iter-call */ "./node_modules/core-js/modules/_iter-call.js");\nvar isArrayIter = __webpack_require__(/*! ./_is-array-iter */ "./node_modules/core-js/modules/_is-array-iter.js");\nvar toLength = __webpack_require__(/*! ./_to-length */ "./node_modules/core-js/modules/_to-length.js");\nvar createProperty = __webpack_require__(/*! ./_create-property */ "./node_modules/core-js/modules/_create-property.js");\nvar getIterFn = __webpack_require__(/*! ./core.get-iterator-method */ "./node_modules/core-js/modules/core.get-iterator-method.js");\n\n$export($export.S + $export.F * !__webpack_require__(/*! ./_iter-detect */ "./node_modules/core-js/modules/_iter-detect.js")(function (iter) { Array.from(iter); }), \'Array\', {\n // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)\n from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {\n var O = toObject(arrayLike);\n var C = typeof this == \'function\' ? this : Array;\n var aLen = arguments.length;\n var mapfn = aLen > 1 ? arguments[1] : undefined;\n var mapping = mapfn !== undefined;\n var index = 0;\n var iterFn = getIterFn(O);\n var length, result, step, iterator;\n if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);\n // if object isn\'t iterable or it\'s array with default iterator - use simple case\n if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {\n for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {\n createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);\n }\n } else {\n length = toLength(O.length);\n for (result = new C(length); length > index; index++) {\n createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);\n }\n }\n result.length = index;\n return result;\n }\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.array.from.js?')},"./node_modules/core-js/modules/es6.array.index-of.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\nvar $indexOf = __webpack_require__(/*! ./_array-includes */ "./node_modules/core-js/modules/_array-includes.js")(false);\nvar $native = [].indexOf;\nvar NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;\n\n$export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(/*! ./_strict-method */ "./node_modules/core-js/modules/_strict-method.js")($native)), \'Array\', {\n // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])\n indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {\n return NEGATIVE_ZERO\n // convert -0 to +0\n ? $native.apply(this, arguments) || 0\n : $indexOf(this, searchElement, arguments[1]);\n }\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.array.index-of.js?')},"./node_modules/core-js/modules/es6.array.is-array.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval('// 22.1.2.2 / 15.4.3.2 Array.isArray(arg)\nvar $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\n\n$export($export.S, \'Array\', { isArray: __webpack_require__(/*! ./_is-array */ "./node_modules/core-js/modules/_is-array.js") });\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.array.is-array.js?')},"./node_modules/core-js/modules/es6.array.iterator.js":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval("\nvar addToUnscopables = __webpack_require__(/*! ./_add-to-unscopables */ \"./node_modules/core-js/modules/_add-to-unscopables.js\");\nvar step = __webpack_require__(/*! ./_iter-step */ \"./node_modules/core-js/modules/_iter-step.js\");\nvar Iterators = __webpack_require__(/*! ./_iterators */ \"./node_modules/core-js/modules/_iterators.js\");\nvar toIObject = __webpack_require__(/*! ./_to-iobject */ \"./node_modules/core-js/modules/_to-iobject.js\");\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = __webpack_require__(/*! ./_iter-define */ \"./node_modules/core-js/modules/_iter-define.js\")(Array, 'Array', function (iterated, kind) {\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var kind = this._k;\n var index = this._i++;\n if (!O || index >= O.length) {\n this._t = undefined;\n return step(1);\n }\n if (kind == 'keys') return step(0, index);\n if (kind == 'values') return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.array.iterator.js?")},"./node_modules/core-js/modules/es6.array.reduce.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\nvar $reduce = __webpack_require__(/*! ./_array-reduce */ "./node_modules/core-js/modules/_array-reduce.js");\n\n$export($export.P + $export.F * !__webpack_require__(/*! ./_strict-method */ "./node_modules/core-js/modules/_strict-method.js")([].reduce, true), \'Array\', {\n // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])\n reduce: function reduce(callbackfn /* , initialValue */) {\n return $reduce(this, callbackfn, arguments.length, arguments[1], false);\n }\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.array.reduce.js?')},"./node_modules/core-js/modules/es6.array.sort.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\nvar aFunction = __webpack_require__(/*! ./_a-function */ "./node_modules/core-js/modules/_a-function.js");\nvar toObject = __webpack_require__(/*! ./_to-object */ "./node_modules/core-js/modules/_to-object.js");\nvar fails = __webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js");\nvar $sort = [].sort;\nvar test = [1, 2, 3];\n\n$export($export.P + $export.F * (fails(function () {\n // IE8-\n test.sort(undefined);\n}) || !fails(function () {\n // V8 bug\n test.sort(null);\n // Old WebKit\n}) || !__webpack_require__(/*! ./_strict-method */ "./node_modules/core-js/modules/_strict-method.js")($sort)), \'Array\', {\n // 22.1.3.25 Array.prototype.sort(comparefn)\n sort: function sort(comparefn) {\n return comparefn === undefined\n ? $sort.call(toObject(this))\n : $sort.call(toObject(this), aFunction(comparefn));\n }\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.array.sort.js?')},"./node_modules/core-js/modules/es6.date.to-string.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval("var DateProto = Date.prototype;\nvar INVALID_DATE = 'Invalid Date';\nvar TO_STRING = 'toString';\nvar $toString = DateProto[TO_STRING];\nvar getTime = DateProto.getTime;\nif (new Date(NaN) + '' != INVALID_DATE) {\n __webpack_require__(/*! ./_redefine */ \"./node_modules/core-js/modules/_redefine.js\")(DateProto, TO_STRING, function toString() {\n var value = getTime.call(this);\n // eslint-disable-next-line no-self-compare\n return value === value ? $toString.call(this) : INVALID_DATE;\n });\n}\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.date.to-string.js?")},"./node_modules/core-js/modules/es6.object.define-properties.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval('var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\n// 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)\n$export($export.S + $export.F * !__webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js"), \'Object\', { defineProperties: __webpack_require__(/*! ./_object-dps */ "./node_modules/core-js/modules/_object-dps.js") });\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.object.define-properties.js?')},"./node_modules/core-js/modules/es6.object.define-property.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval('var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\n// 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)\n$export($export.S + $export.F * !__webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js"), \'Object\', { defineProperty: (__webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js").f) });\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.object.define-property.js?')},"./node_modules/core-js/modules/es6.object.keys.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval('// 19.1.2.14 Object.keys(O)\nvar toObject = __webpack_require__(/*! ./_to-object */ "./node_modules/core-js/modules/_to-object.js");\nvar $keys = __webpack_require__(/*! ./_object-keys */ "./node_modules/core-js/modules/_object-keys.js");\n\n__webpack_require__(/*! ./_object-sap */ "./node_modules/core-js/modules/_object-sap.js")(\'keys\', function () {\n return function keys(it) {\n return $keys(toObject(it));\n };\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.object.keys.js?')},"./node_modules/core-js/modules/es6.object.to-string.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval("\n// 19.1.3.6 Object.prototype.toString()\nvar classof = __webpack_require__(/*! ./_classof */ \"./node_modules/core-js/modules/_classof.js\");\nvar test = {};\ntest[__webpack_require__(/*! ./_wks */ \"./node_modules/core-js/modules/_wks.js\")('toStringTag')] = 'z';\nif (test + '' != '[object z]') {\n __webpack_require__(/*! ./_redefine */ \"./node_modules/core-js/modules/_redefine.js\")(Object.prototype, 'toString', function toString() {\n return '[object ' + classof(this) + ']';\n }, true);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.object.to-string.js?")},"./node_modules/core-js/modules/es6.regexp.constructor.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval('var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");\nvar inheritIfRequired = __webpack_require__(/*! ./_inherit-if-required */ "./node_modules/core-js/modules/_inherit-if-required.js");\nvar dP = (__webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js").f);\nvar gOPN = (__webpack_require__(/*! ./_object-gopn */ "./node_modules/core-js/modules/_object-gopn.js").f);\nvar isRegExp = __webpack_require__(/*! ./_is-regexp */ "./node_modules/core-js/modules/_is-regexp.js");\nvar $flags = __webpack_require__(/*! ./_flags */ "./node_modules/core-js/modules/_flags.js");\nvar $RegExp = global.RegExp;\nvar Base = $RegExp;\nvar proto = $RegExp.prototype;\nvar re1 = /a/g;\nvar re2 = /a/g;\n// "new" creates a new object, old webkit buggy here\nvar CORRECT_NEW = new $RegExp(re1) !== re1;\n\nif (__webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") && (!CORRECT_NEW || __webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js")(function () {\n re2[__webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")(\'match\')] = false;\n // RegExp constructor can alter flags and IsRegExp works correct with @@match\n return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, \'i\') != \'/a/i\';\n}))) {\n $RegExp = function RegExp(p, f) {\n var tiRE = this instanceof $RegExp;\n var piRE = isRegExp(p);\n var fiU = f === undefined;\n return !tiRE && piRE && p.constructor === $RegExp && fiU ? p\n : inheritIfRequired(CORRECT_NEW\n ? new Base(piRE && !fiU ? p.source : p, f)\n : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f)\n , tiRE ? this : proto, $RegExp);\n };\n var proxy = function (key) {\n key in $RegExp || dP($RegExp, key, {\n configurable: true,\n get: function () { return Base[key]; },\n set: function (it) { Base[key] = it; }\n });\n };\n for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]);\n proto.constructor = $RegExp;\n $RegExp.prototype = proto;\n __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js")(global, \'RegExp\', $RegExp);\n}\n\n__webpack_require__(/*! ./_set-species */ "./node_modules/core-js/modules/_set-species.js")(\'RegExp\');\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.regexp.constructor.js?')},"./node_modules/core-js/modules/es6.regexp.exec.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar regexpExec = __webpack_require__(/*! ./_regexp-exec */ "./node_modules/core-js/modules/_regexp-exec.js");\n__webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js")({\n target: \'RegExp\',\n proto: true,\n forced: regexpExec !== /./.exec\n}, {\n exec: regexpExec\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.regexp.exec.js?')},"./node_modules/core-js/modules/es6.regexp.flags.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval('// 21.2.5.3 get RegExp.prototype.flags()\nif (__webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") && /./g.flags != \'g\') (__webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js").f)(RegExp.prototype, \'flags\', {\n configurable: true,\n get: __webpack_require__(/*! ./_flags */ "./node_modules/core-js/modules/_flags.js")\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.regexp.flags.js?')},"./node_modules/core-js/modules/es6.regexp.match.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\n\nvar anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");\nvar toLength = __webpack_require__(/*! ./_to-length */ "./node_modules/core-js/modules/_to-length.js");\nvar advanceStringIndex = __webpack_require__(/*! ./_advance-string-index */ "./node_modules/core-js/modules/_advance-string-index.js");\nvar regExpExec = __webpack_require__(/*! ./_regexp-exec-abstract */ "./node_modules/core-js/modules/_regexp-exec-abstract.js");\n\n// @@match logic\n__webpack_require__(/*! ./_fix-re-wks */ "./node_modules/core-js/modules/_fix-re-wks.js")(\'match\', 1, function (defined, MATCH, $match, maybeCallNative) {\n return [\n // `String.prototype.match` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.match\n function match(regexp) {\n var O = defined(this);\n var fn = regexp == undefined ? undefined : regexp[MATCH];\n return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));\n },\n // `RegExp.prototype[@@match]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match\n function (regexp) {\n var res = maybeCallNative($match, regexp, this);\n if (res.done) return res.value;\n var rx = anObject(regexp);\n var S = String(this);\n if (!rx.global) return regExpExec(rx, S);\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n var A = [];\n var n = 0;\n var result;\n while ((result = regExpExec(rx, S)) !== null) {\n var matchStr = String(result[0]);\n A[n] = matchStr;\n if (matchStr === \'\') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n n++;\n }\n return n === 0 ? null : A;\n }\n ];\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.regexp.match.js?')},"./node_modules/core-js/modules/es6.regexp.replace.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval("\n\nvar anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/modules/_an-object.js\");\nvar toObject = __webpack_require__(/*! ./_to-object */ \"./node_modules/core-js/modules/_to-object.js\");\nvar toLength = __webpack_require__(/*! ./_to-length */ \"./node_modules/core-js/modules/_to-length.js\");\nvar toInteger = __webpack_require__(/*! ./_to-integer */ \"./node_modules/core-js/modules/_to-integer.js\");\nvar advanceStringIndex = __webpack_require__(/*! ./_advance-string-index */ \"./node_modules/core-js/modules/_advance-string-index.js\");\nvar regExpExec = __webpack_require__(/*! ./_regexp-exec-abstract */ \"./node_modules/core-js/modules/_regexp-exec-abstract.js\");\nvar max = Math.max;\nvar min = Math.min;\nvar floor = Math.floor;\nvar SUBSTITUTION_SYMBOLS = /\\$([$&`']|\\d\\d?|<[^>]*>)/g;\nvar SUBSTITUTION_SYMBOLS_NO_NAMED = /\\$([$&`']|\\d\\d?)/g;\n\nvar maybeToString = function (it) {\n return it === undefined ? it : String(it);\n};\n\n// @@replace logic\n__webpack_require__(/*! ./_fix-re-wks */ \"./node_modules/core-js/modules/_fix-re-wks.js\")('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) {\n return [\n // `String.prototype.replace` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.replace\n function replace(searchValue, replaceValue) {\n var O = defined(this);\n var fn = searchValue == undefined ? undefined : searchValue[REPLACE];\n return fn !== undefined\n ? fn.call(searchValue, O, replaceValue)\n : $replace.call(String(O), searchValue, replaceValue);\n },\n // `RegExp.prototype[@@replace]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace\n function (regexp, replaceValue) {\n var res = maybeCallNative($replace, regexp, this, replaceValue);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n var functionalReplace = typeof replaceValue === 'function';\n if (!functionalReplace) replaceValue = String(replaceValue);\n var global = rx.global;\n if (global) {\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n }\n var results = [];\n while (true) {\n var result = regExpExec(rx, S);\n if (result === null) break;\n results.push(result);\n if (!global) break;\n var matchStr = String(result[0]);\n if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);\n }\n var accumulatedResult = '';\n var nextSourcePosition = 0;\n for (var i = 0; i < results.length; i++) {\n result = results[i];\n var matched = String(result[0]);\n var position = max(min(toInteger(result.index), S.length), 0);\n var captures = [];\n // NOTE: This is equivalent to\n // captures = result.slice(1).map(maybeToString)\n // but for some reason `nativeSlice.call(result, 1, result.length)` (called in\n // the slice polyfill when slicing native arrays) \"doesn't work\" in safari 9 and\n // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.\n for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));\n var namedCaptures = result.groups;\n if (functionalReplace) {\n var replacerArgs = [matched].concat(captures, position, S);\n if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);\n var replacement = String(replaceValue.apply(undefined, replacerArgs));\n } else {\n replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);\n }\n if (position >= nextSourcePosition) {\n accumulatedResult += S.slice(nextSourcePosition, position) + replacement;\n nextSourcePosition = position + matched.length;\n }\n }\n return accumulatedResult + S.slice(nextSourcePosition);\n }\n ];\n\n // https://tc39.github.io/ecma262/#sec-getsubstitution\n function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {\n var tailPos = position + matched.length;\n var m = captures.length;\n var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;\n if (namedCaptures !== undefined) {\n namedCaptures = toObject(namedCaptures);\n symbols = SUBSTITUTION_SYMBOLS;\n }\n return $replace.call(replacement, symbols, function (match, ch) {\n var capture;\n switch (ch.charAt(0)) {\n case '$': return '$';\n case '&': return matched;\n case '`': return str.slice(0, position);\n case \"'\": return str.slice(tailPos);\n case '<':\n capture = namedCaptures[ch.slice(1, -1)];\n break;\n default: // \\d\\d?\n var n = +ch;\n if (n === 0) return match;\n if (n > m) {\n var f = floor(n / 10);\n if (f === 0) return match;\n if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);\n return match;\n }\n capture = captures[n - 1];\n }\n return capture === undefined ? '' : capture;\n });\n }\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.regexp.replace.js?")},"./node_modules/core-js/modules/es6.regexp.split.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval("\n\nvar isRegExp = __webpack_require__(/*! ./_is-regexp */ \"./node_modules/core-js/modules/_is-regexp.js\");\nvar anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/modules/_an-object.js\");\nvar speciesConstructor = __webpack_require__(/*! ./_species-constructor */ \"./node_modules/core-js/modules/_species-constructor.js\");\nvar advanceStringIndex = __webpack_require__(/*! ./_advance-string-index */ \"./node_modules/core-js/modules/_advance-string-index.js\");\nvar toLength = __webpack_require__(/*! ./_to-length */ \"./node_modules/core-js/modules/_to-length.js\");\nvar callRegExpExec = __webpack_require__(/*! ./_regexp-exec-abstract */ \"./node_modules/core-js/modules/_regexp-exec-abstract.js\");\nvar regexpExec = __webpack_require__(/*! ./_regexp-exec */ \"./node_modules/core-js/modules/_regexp-exec.js\");\nvar fails = __webpack_require__(/*! ./_fails */ \"./node_modules/core-js/modules/_fails.js\");\nvar $min = Math.min;\nvar $push = [].push;\nvar $SPLIT = 'split';\nvar LENGTH = 'length';\nvar LAST_INDEX = 'lastIndex';\nvar MAX_UINT32 = 0xffffffff;\n\n// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError\nvar SUPPORTS_Y = !fails(function () { RegExp(MAX_UINT32, 'y'); });\n\n// @@split logic\n__webpack_require__(/*! ./_fix-re-wks */ \"./node_modules/core-js/modules/_fix-re-wks.js\")('split', 2, function (defined, SPLIT, $split, maybeCallNative) {\n var internalSplit;\n if (\n 'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||\n 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||\n 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||\n '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||\n '.'[$SPLIT](/()()/)[LENGTH] > 1 ||\n ''[$SPLIT](/.?/)[LENGTH]\n ) {\n // based on es5-shim implementation, need to rework it\n internalSplit = function (separator, limit) {\n var string = String(this);\n if (separator === undefined && limit === 0) return [];\n // If `separator` is not a regex, use native split\n if (!isRegExp(separator)) return $split.call(string, separator, limit);\n var output = [];\n var flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.unicode ? 'u' : '') +\n (separator.sticky ? 'y' : '');\n var lastLastIndex = 0;\n var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0;\n // Make `global` and avoid `lastIndex` issues by working with a copy\n var separatorCopy = new RegExp(separator.source, flags + 'g');\n var match, lastIndex, lastLength;\n while (match = regexpExec.call(separatorCopy, string)) {\n lastIndex = separatorCopy[LAST_INDEX];\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));\n lastLength = match[0][LENGTH];\n lastLastIndex = lastIndex;\n if (output[LENGTH] >= splitLimit) break;\n }\n if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop\n }\n if (lastLastIndex === string[LENGTH]) {\n if (lastLength || !separatorCopy.test('')) output.push('');\n } else output.push(string.slice(lastLastIndex));\n return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;\n };\n // Chakra, V8\n } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {\n internalSplit = function (separator, limit) {\n return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit);\n };\n } else {\n internalSplit = $split;\n }\n\n return [\n // `String.prototype.split` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.split\n function split(separator, limit) {\n var O = defined(this);\n var splitter = separator == undefined ? undefined : separator[SPLIT];\n return splitter !== undefined\n ? splitter.call(separator, O, limit)\n : internalSplit.call(String(O), separator, limit);\n },\n // `RegExp.prototype[@@split]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split\n //\n // NOTE: This cannot be properly polyfilled in engines that don't support\n // the 'y' flag.\n function (regexp, limit) {\n var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split);\n if (res.done) return res.value;\n\n var rx = anObject(regexp);\n var S = String(this);\n var C = speciesConstructor(rx, RegExp);\n\n var unicodeMatching = rx.unicode;\n var flags = (rx.ignoreCase ? 'i' : '') +\n (rx.multiline ? 'm' : '') +\n (rx.unicode ? 'u' : '') +\n (SUPPORTS_Y ? 'y' : 'g');\n\n // ^(? + rx + ) is needed, in combination with some S slicing, to\n // simulate the 'y' flag.\n var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];\n var p = 0;\n var q = 0;\n var A = [];\n while (q < S.length) {\n splitter.lastIndex = SUPPORTS_Y ? q : 0;\n var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));\n var e;\n if (\n z === null ||\n (e = $min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p\n ) {\n q = advanceStringIndex(S, q, unicodeMatching);\n } else {\n A.push(S.slice(p, q));\n if (A.length === lim) return A;\n for (var i = 1; i <= z.length - 1; i++) {\n A.push(z[i]);\n if (A.length === lim) return A;\n }\n q = p = e;\n }\n }\n A.push(S.slice(p));\n return A;\n }\n ];\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.regexp.split.js?")},"./node_modules/core-js/modules/es6.regexp.to-string.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval("\n__webpack_require__(/*! ./es6.regexp.flags */ \"./node_modules/core-js/modules/es6.regexp.flags.js\");\nvar anObject = __webpack_require__(/*! ./_an-object */ \"./node_modules/core-js/modules/_an-object.js\");\nvar $flags = __webpack_require__(/*! ./_flags */ \"./node_modules/core-js/modules/_flags.js\");\nvar DESCRIPTORS = __webpack_require__(/*! ./_descriptors */ \"./node_modules/core-js/modules/_descriptors.js\");\nvar TO_STRING = 'toString';\nvar $toString = /./[TO_STRING];\n\nvar define = function (fn) {\n __webpack_require__(/*! ./_redefine */ \"./node_modules/core-js/modules/_redefine.js\")(RegExp.prototype, TO_STRING, fn, true);\n};\n\n// 21.2.5.14 RegExp.prototype.toString()\nif (__webpack_require__(/*! ./_fails */ \"./node_modules/core-js/modules/_fails.js\")(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) {\n define(function toString() {\n var R = anObject(this);\n return '/'.concat(R.source, '/',\n 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);\n });\n// FF44- RegExp#toString has a wrong name\n} else if ($toString.name != TO_STRING) {\n define(function toString() {\n return $toString.call(this);\n });\n}\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.regexp.to-string.js?")},"./node_modules/core-js/modules/es6.string.iterator.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\nvar $at = __webpack_require__(/*! ./_string-at */ "./node_modules/core-js/modules/_string-at.js")(true);\n\n// 21.1.3.27 String.prototype[@@iterator]()\n__webpack_require__(/*! ./_iter-define */ "./node_modules/core-js/modules/_iter-define.js")(String, \'String\', function (iterated) {\n this._t = String(iterated); // target\n this._i = 0; // next index\n// 21.1.5.2.1 %StringIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var index = this._i;\n var point;\n if (index >= O.length) return { value: undefined, done: true };\n point = $at(O, index);\n this._i += point.length;\n return { value: point, done: false };\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.string.iterator.js?')},"./node_modules/core-js/modules/es6.symbol.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('\n// ECMAScript 6 symbols shim\nvar global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");\nvar has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js");\nvar DESCRIPTORS = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js");\nvar $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\nvar redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js");\nvar META = (__webpack_require__(/*! ./_meta */ "./node_modules/core-js/modules/_meta.js").KEY);\nvar $fails = __webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js");\nvar shared = __webpack_require__(/*! ./_shared */ "./node_modules/core-js/modules/_shared.js");\nvar setToStringTag = __webpack_require__(/*! ./_set-to-string-tag */ "./node_modules/core-js/modules/_set-to-string-tag.js");\nvar uid = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js");\nvar wks = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js");\nvar wksExt = __webpack_require__(/*! ./_wks-ext */ "./node_modules/core-js/modules/_wks-ext.js");\nvar wksDefine = __webpack_require__(/*! ./_wks-define */ "./node_modules/core-js/modules/_wks-define.js");\nvar enumKeys = __webpack_require__(/*! ./_enum-keys */ "./node_modules/core-js/modules/_enum-keys.js");\nvar isArray = __webpack_require__(/*! ./_is-array */ "./node_modules/core-js/modules/_is-array.js");\nvar anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");\nvar isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");\nvar toObject = __webpack_require__(/*! ./_to-object */ "./node_modules/core-js/modules/_to-object.js");\nvar toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js");\nvar toPrimitive = __webpack_require__(/*! ./_to-primitive */ "./node_modules/core-js/modules/_to-primitive.js");\nvar createDesc = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js");\nvar _create = __webpack_require__(/*! ./_object-create */ "./node_modules/core-js/modules/_object-create.js");\nvar gOPNExt = __webpack_require__(/*! ./_object-gopn-ext */ "./node_modules/core-js/modules/_object-gopn-ext.js");\nvar $GOPD = __webpack_require__(/*! ./_object-gopd */ "./node_modules/core-js/modules/_object-gopd.js");\nvar $GOPS = __webpack_require__(/*! ./_object-gops */ "./node_modules/core-js/modules/_object-gops.js");\nvar $DP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js");\nvar $keys = __webpack_require__(/*! ./_object-keys */ "./node_modules/core-js/modules/_object-keys.js");\nvar gOPD = $GOPD.f;\nvar dP = $DP.f;\nvar gOPN = gOPNExt.f;\nvar $Symbol = global.Symbol;\nvar $JSON = global.JSON;\nvar _stringify = $JSON && $JSON.stringify;\nvar PROTOTYPE = \'prototype\';\nvar HIDDEN = wks(\'_hidden\');\nvar TO_PRIMITIVE = wks(\'toPrimitive\');\nvar isEnum = {}.propertyIsEnumerable;\nvar SymbolRegistry = shared(\'symbol-registry\');\nvar AllSymbols = shared(\'symbols\');\nvar OPSymbols = shared(\'op-symbols\');\nvar ObjectProto = Object[PROTOTYPE];\nvar USE_NATIVE = typeof $Symbol == \'function\' && !!$GOPS.f;\nvar QObject = global.QObject;\n// Don\'t use setters in Qt Script, https://github.com/zloirock/core-js/issues/173\nvar setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;\n\n// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687\nvar setSymbolDesc = DESCRIPTORS && $fails(function () {\n return _create(dP({}, \'a\', {\n get: function () { return dP(this, \'a\', { value: 7 }).a; }\n })).a != 7;\n}) ? function (it, key, D) {\n var protoDesc = gOPD(ObjectProto, key);\n if (protoDesc) delete ObjectProto[key];\n dP(it, key, D);\n if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);\n} : dP;\n\nvar wrap = function (tag) {\n var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);\n sym._k = tag;\n return sym;\n};\n\nvar isSymbol = USE_NATIVE && typeof $Symbol.iterator == \'symbol\' ? function (it) {\n return typeof it == \'symbol\';\n} : function (it) {\n return it instanceof $Symbol;\n};\n\nvar $defineProperty = function defineProperty(it, key, D) {\n if (it === ObjectProto) $defineProperty(OPSymbols, key, D);\n anObject(it);\n key = toPrimitive(key, true);\n anObject(D);\n if (has(AllSymbols, key)) {\n if (!D.enumerable) {\n if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));\n it[HIDDEN][key] = true;\n } else {\n if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;\n D = _create(D, { enumerable: createDesc(0, false) });\n } return setSymbolDesc(it, key, D);\n } return dP(it, key, D);\n};\nvar $defineProperties = function defineProperties(it, P) {\n anObject(it);\n var keys = enumKeys(P = toIObject(P));\n var i = 0;\n var l = keys.length;\n var key;\n while (l > i) $defineProperty(it, key = keys[i++], P[key]);\n return it;\n};\nvar $create = function create(it, P) {\n return P === undefined ? _create(it) : $defineProperties(_create(it), P);\n};\nvar $propertyIsEnumerable = function propertyIsEnumerable(key) {\n var E = isEnum.call(this, key = toPrimitive(key, true));\n if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;\n return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;\n};\nvar $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {\n it = toIObject(it);\n key = toPrimitive(key, true);\n if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;\n var D = gOPD(it, key);\n if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;\n return D;\n};\nvar $getOwnPropertyNames = function getOwnPropertyNames(it) {\n var names = gOPN(toIObject(it));\n var result = [];\n var i = 0;\n var key;\n while (names.length > i) {\n if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);\n } return result;\n};\nvar $getOwnPropertySymbols = function getOwnPropertySymbols(it) {\n var IS_OP = it === ObjectProto;\n var names = gOPN(IS_OP ? OPSymbols : toIObject(it));\n var result = [];\n var i = 0;\n var key;\n while (names.length > i) {\n if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);\n } return result;\n};\n\n// 19.4.1.1 Symbol([description])\nif (!USE_NATIVE) {\n $Symbol = function Symbol() {\n if (this instanceof $Symbol) throw TypeError(\'Symbol is not a constructor!\');\n var tag = uid(arguments.length > 0 ? arguments[0] : undefined);\n var $set = function (value) {\n if (this === ObjectProto) $set.call(OPSymbols, value);\n if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;\n setSymbolDesc(this, tag, createDesc(1, value));\n };\n if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });\n return wrap(tag);\n };\n redefine($Symbol[PROTOTYPE], \'toString\', function toString() {\n return this._k;\n });\n\n $GOPD.f = $getOwnPropertyDescriptor;\n $DP.f = $defineProperty;\n (__webpack_require__(/*! ./_object-gopn */ "./node_modules/core-js/modules/_object-gopn.js").f) = gOPNExt.f = $getOwnPropertyNames;\n (__webpack_require__(/*! ./_object-pie */ "./node_modules/core-js/modules/_object-pie.js").f) = $propertyIsEnumerable;\n $GOPS.f = $getOwnPropertySymbols;\n\n if (DESCRIPTORS && !__webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js")) {\n redefine(ObjectProto, \'propertyIsEnumerable\', $propertyIsEnumerable, true);\n }\n\n wksExt.f = function (name) {\n return wrap(wks(name));\n };\n}\n\n$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });\n\nfor (var es6Symbols = (\n // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14\n \'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables\'\n).split(\',\'), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);\n\nfor (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);\n\n$export($export.S + $export.F * !USE_NATIVE, \'Symbol\', {\n // 19.4.2.1 Symbol.for(key)\n \'for\': function (key) {\n return has(SymbolRegistry, key += \'\')\n ? SymbolRegistry[key]\n : SymbolRegistry[key] = $Symbol(key);\n },\n // 19.4.2.5 Symbol.keyFor(sym)\n keyFor: function keyFor(sym) {\n if (!isSymbol(sym)) throw TypeError(sym + \' is not a symbol!\');\n for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;\n },\n useSetter: function () { setter = true; },\n useSimple: function () { setter = false; }\n});\n\n$export($export.S + $export.F * !USE_NATIVE, \'Object\', {\n // 19.1.2.2 Object.create(O [, Properties])\n create: $create,\n // 19.1.2.4 Object.defineProperty(O, P, Attributes)\n defineProperty: $defineProperty,\n // 19.1.2.3 Object.defineProperties(O, Properties)\n defineProperties: $defineProperties,\n // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)\n getOwnPropertyDescriptor: $getOwnPropertyDescriptor,\n // 19.1.2.7 Object.getOwnPropertyNames(O)\n getOwnPropertyNames: $getOwnPropertyNames,\n // 19.1.2.8 Object.getOwnPropertySymbols(O)\n getOwnPropertySymbols: $getOwnPropertySymbols\n});\n\n// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives\n// https://bugs.chromium.org/p/v8/issues/detail?id=3443\nvar FAILS_ON_PRIMITIVES = $fails(function () { $GOPS.f(1); });\n\n$export($export.S + $export.F * FAILS_ON_PRIMITIVES, \'Object\', {\n getOwnPropertySymbols: function getOwnPropertySymbols(it) {\n return $GOPS.f(toObject(it));\n }\n});\n\n// 24.3.2 JSON.stringify(value [, replacer [, space]])\n$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {\n var S = $Symbol();\n // MS Edge converts symbol values to JSON as {}\n // WebKit converts symbol values to JSON as null\n // V8 throws on boxed symbols\n return _stringify([S]) != \'[null]\' || _stringify({ a: S }) != \'{}\' || _stringify(Object(S)) != \'{}\';\n})), \'JSON\', {\n stringify: function stringify(it) {\n var args = [it];\n var i = 1;\n var replacer, $replacer;\n while (arguments.length > i) args.push(arguments[i++]);\n $replacer = replacer = args[1];\n if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined\n if (!isArray(replacer)) replacer = function (key, value) {\n if (typeof $replacer == \'function\') value = $replacer.call(this, key, value);\n if (!isSymbol(value)) return value;\n };\n args[1] = replacer;\n return _stringify.apply($JSON, args);\n }\n});\n\n// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)\n$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js")($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);\n// 19.4.3.5 Symbol.prototype[@@toStringTag]\nsetToStringTag($Symbol, \'Symbol\');\n// 20.2.1.9 Math[@@toStringTag]\nsetToStringTag(Math, \'Math\', true);\n// 24.3.3 JSON[@@toStringTag]\nsetToStringTag(global.JSON, \'JSON\', true);\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es6.symbol.js?')},"./node_modules/core-js/modules/es7.object.get-own-property-descriptors.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval('// https://github.com/tc39/proposal-object-getownpropertydescriptors\nvar $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");\nvar ownKeys = __webpack_require__(/*! ./_own-keys */ "./node_modules/core-js/modules/_own-keys.js");\nvar toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js");\nvar gOPD = __webpack_require__(/*! ./_object-gopd */ "./node_modules/core-js/modules/_object-gopd.js");\nvar createProperty = __webpack_require__(/*! ./_create-property */ "./node_modules/core-js/modules/_create-property.js");\n\n$export($export.S, \'Object\', {\n getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {\n var O = toIObject(object);\n var getDesc = gOPD.f;\n var keys = ownKeys(O);\n var result = {};\n var i = 0;\n var key, desc;\n while (keys.length > i) {\n desc = getDesc(O, key = keys[i++]);\n if (desc !== undefined) createProperty(result, key, desc);\n }\n return result;\n }\n});\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/es7.object.get-own-property-descriptors.js?')},"./node_modules/core-js/modules/web.dom.iterable.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval('var $iterators = __webpack_require__(/*! ./es6.array.iterator */ "./node_modules/core-js/modules/es6.array.iterator.js");\nvar getKeys = __webpack_require__(/*! ./_object-keys */ "./node_modules/core-js/modules/_object-keys.js");\nvar redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js");\nvar global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");\nvar hide = __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js");\nvar Iterators = __webpack_require__(/*! ./_iterators */ "./node_modules/core-js/modules/_iterators.js");\nvar wks = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js");\nvar ITERATOR = wks(\'iterator\');\nvar TO_STRING_TAG = wks(\'toStringTag\');\nvar ArrayValues = Iterators.Array;\n\nvar DOMIterables = {\n CSSRuleList: true, // TODO: Not spec compliant, should be false.\n CSSStyleDeclaration: false,\n CSSValueList: false,\n ClientRectList: false,\n DOMRectList: false,\n DOMStringList: false,\n DOMTokenList: true,\n DataTransferItemList: false,\n FileList: false,\n HTMLAllCollection: false,\n HTMLCollection: false,\n HTMLFormElement: false,\n HTMLSelectElement: false,\n MediaList: true, // TODO: Not spec compliant, should be false.\n MimeTypeArray: false,\n NamedNodeMap: false,\n NodeList: true,\n PaintRequestList: false,\n Plugin: false,\n PluginArray: false,\n SVGLengthList: false,\n SVGNumberList: false,\n SVGPathSegList: false,\n SVGPointList: false,\n SVGStringList: false,\n SVGTransformList: false,\n SourceBufferList: false,\n StyleSheetList: true, // TODO: Not spec compliant, should be false.\n TextTrackCueList: false,\n TextTrackList: false,\n TouchList: false\n};\n\nfor (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {\n var NAME = collections[i];\n var explicit = DOMIterables[NAME];\n var Collection = global[NAME];\n var proto = Collection && Collection.prototype;\n var key;\n if (proto) {\n if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);\n if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = ArrayValues;\n if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);\n }\n}\n\n\n//# sourceURL=webpack://web/./node_modules/core-js/modules/web.dom.iterable.js?')},"./node_modules/dashjs/dist/dash.all.min.js":module=>{eval('/*! For license information please see dash.all.min.js.LICENSE.txt */\n!function(e,t){ true?module.exports=t():0}(self,(function(){return function(){var e={4593:function(e,t){var n,r,i,o,u,l=function(e){for(var t=[],n=0;n<e.length;++n){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?(t.push(192|r>>6),t.push(128|63&r)):r<65536?(t.push(224|r>>12),t.push(128|63&r>>6),t.push(128|63&r)):(t.push(240|r>>18),t.push(128|63&r>>12),t.push(128|63&r>>6),t.push(128|63&r))}return t},c=function(e){for(var t=[],n=0;n<e.length;){var r=e[n++];r<128||(r<224?(r=(31&r)<<6,r|=63&e[n++]):r<240?(r=(15&r)<<12,r|=(63&e[n++])<<6,r|=63&e[n++]):(r=(7&r)<<18,r|=(63&e[n++])<<12,r|=(63&e[n++])<<6,r|=63&e[n++])),t.push(String.fromCharCode(r))}return t.join("")},f={};n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=function(e){for(var t=0,r=[],i=0|e.length/3;0<i--;){var a=(e[t]<<16)+(e[t+1]<<8)+e[t+2];t+=3,r.push(n.charAt(63&a>>18)),r.push(n.charAt(63&a>>12)),r.push(n.charAt(63&a>>6)),r.push(n.charAt(63&a))}return 2==e.length-t?(a=(e[t]<<16)+(e[t+1]<<8),r.push(n.charAt(63&a>>18)),r.push(n.charAt(63&a>>12)),r.push(n.charAt(63&a>>6)),r.push("=")):1==e.length-t&&(a=e[t]<<16,r.push(n.charAt(63&a>>18)),r.push(n.charAt(63&a>>12)),r.push("==")),r.join("")},i=function(){for(var e=[],t=0;t<n.length;++t)e[n.charCodeAt(t)]=t;return e["=".charCodeAt(0)]=0,e}(),o=function(e){for(var t=0,n=[],r=0|e.length/4;0<r--;){var a=(i[e.charCodeAt(t)]<<18)+(i[e.charCodeAt(t+1)]<<12)+(i[e.charCodeAt(t+2)]<<6)+i[e.charCodeAt(t+3)];n.push(255&a>>16),n.push(255&a>>8),n.push(255&a),t+=4}return n&&("="==e.charAt(t-2)?(n.pop(),n.pop()):"="==e.charAt(t-1)&&n.pop()),n},u={encode:function(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t},decode:function(e){for(var t=0;t<s.length;++t)a[t]=String.fromCharCode(a[t]);return a.join("")}},f.decodeArray=function(e){var t=o(e);return new Uint8Array(t)},f.encodeASCII=function(e){var t=u.encode(e);return r(t)},f.decodeASCII=function(e){var t=o(e);return u.decode(t)},f.encode=function(e){var t=l(e);return r(t)},f.decode=function(e){var t=o(e);return c(t)},t.decode=f.decode,t.decodeArray=f.decodeArray,t.encode=f.encode,t.encodeASCII=f.encodeASCII},452:function(e,t){!function(e){"use strict";var t={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},n=function(e){var n=e;return t.hasOwnProperty(e)&&(n=t[e]),String.fromCharCode(n)},r=15,i=32,a={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},o={17:2,18:4,21:6,22:8,23:10,19:13,20:15},s={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},u={25:2,26:4,29:6,30:8,31:10,27:13,28:15},l=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],c={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(e){this.time=e},log:function(e,t){var n=this.verboseFilter[e];this.verboseLevel>=n&&console.log(this.time+" ["+e+"] "+t)}},f=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].toString(16));return t},d=function(e,t,n,r,i){this.foreground=e||"white",this.underline=t||!1,this.italics=n||!1,this.background=r||"black",this.flash=i||!1};d.prototype={reset:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},setStyles:function(e){for(var t=["foreground","underline","italics","background","flash"],n=0;n<t.length;n++){var r=t[n];e.hasOwnProperty(r)&&(this[r]=e[r])}},isDefault:function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},equals:function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},copy:function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},toString:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}};var g=function(e,t,n,r,i,a){this.uchar=e||" ",this.penState=new d(t,n,r,i,a)};g.prototype={reset:function(){this.uchar=" ",this.penState.reset()},setChar:function(e,t){this.uchar=e,this.penState.copy(t)},setPenState:function(e){this.penState.copy(e)},equals:function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},copy:function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},isEmpty:function(){return" "===this.uchar&&this.penState.isDefault()}};var h=function(){this.chars=[];for(var e=0;e<i;e++)this.chars.push(new g);this.pos=0,this.currPenState=new d};h.prototype={equals:function(e){for(var t=!0,n=0;n<i;n++)if(!this.chars[n].equals(e.chars[n])){t=!1;break}return t},copy:function(e){for(var t=0;t<i;t++)this.chars[t].copy(e.chars[t])},isEmpty:function(){for(var e=!0,t=0;t<i;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},setCursor:function(e){this.pos!==e&&(this.pos=e),this.pos<0?(c.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>i&&(c.log("ERROR","Too large cursor position "+this.pos),this.pos=i)},moveCursor:function(e){var t=this.pos+e;if(e>1)for(var n=this.pos+1;n<t+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(t)},backSpace:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},insertChar:function(e){e>=144&&this.backSpace();var t=n(e);this.pos>=i?c.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},clearFromPos:function(e){var t;for(t=e;t<i;t++)this.chars[t].reset()},clear:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},clearToEndOfRow:function(){this.clearFromPos(this.pos)},getTextString:function(){for(var e=[],t=!0,n=0;n<i;n++){var r=this.chars[n].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")},setPenStyles:function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}};var p=function(){this.rows=[];for(var e=0;e<r;e++)this.rows.push(new h);this.currRow=14,this.nrRollUpRows=null,this.reset()};p.prototype={reset:function(){for(var e=0;e<r;e++)this.rows[e].clear();this.currRow=14},equals:function(e){for(var t=!0,n=0;n<r;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t},copy:function(e){for(var t=0;t<r;t++)this.rows[t].copy(e.rows[t])},isEmpty:function(){for(var e=!0,t=0;t<r;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},backSpace:function(){this.rows[this.currRow].backSpace()},clearToEndOfRow:function(){this.rows[this.currRow].clearToEndOfRow()},insertChar:function(e){this.rows[this.currRow].insertChar(e)},setPen:function(e){this.rows[this.currRow].setPenStyles(e)},moveCursor:function(e){this.rows[this.currRow].moveCursor(e)},setCursor:function(e){c.log("INFO","setCursor: "+e),this.rows[this.currRow].setCursor(e)},setPAC:function(e){c.log("INFO","pacData = "+JSON.stringify(e));var t=e.row-1;this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.currRow=t;var n=this.rows[this.currRow];if(null!==e.indent){var r=e.indent,i=Math.max(r-1,0);n.setCursor(e.indent),e.color=n.chars[i].penState.foreground}var a={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(a)},setBkgData:function(e){c.log("INFO","bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},setRollUpRows:function(e){this.nrRollUpRows=e},rollUp:function(){if(null!==this.nrRollUpRows){c.log("TEXT",this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),c.log("INFO","Rolling up")}else c.log("DEBUG","roll_up but nrRollUpRows not set yet")},getDisplayText:function(e){e=e||!1;for(var t=[],n="",i=-1,a=0;a<r;a++){var o=this.rows[a].getTextString();o&&(i=a+1,e?t.push("Row "+i+\': "\'+o+\'"\'):t.push(o.trim()))}return t.length>0&&(n=e?"["+t.join(" | ")+"]":t.join("\\n")),n},getTextAndFormat:function(){return this.rows}};var m=function(e,t){this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new p,this.nonDisplayedMemory=new p,this.lastOutputScreen=new p,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null};m.prototype={modes:["MODE_ROLL-UP","MODE_POP-ON","MODE_PAINT-ON","MODE_TEXT"],reset:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},getHandler:function(){return this.outputFilter},setHandler:function(e){this.outputFilter=e},setPAC:function(e){this.writeScreen.setPAC(e)},setBkgData:function(e){this.writeScreen.setBkgData(e)},setMode:function(e){e!==this.mode&&(this.mode=e,c.log("INFO","MODE="+e),"MODE_POP-ON"==this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},insertChars:function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";c.log("INFO",n+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(c.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},cc_RCL:function(){c.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},cc_BS:function(){c.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},cc_AOF:function(){},cc_AON:function(){},cc_DER:function(){c.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},cc_RU:function(e){c.log("INFO","RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},cc_FON:function(){c.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},cc_RDC:function(){c.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},cc_TR:function(){c.log("INFO","TR"),this.setMode("MODE_TEXT")},cc_RTD:function(){c.log("INFO","RTD"),this.setMode("MODE_TEXT")},cc_EDM:function(){c.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate()},cc_CR:function(){c.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate()},cc_ENM:function(){c.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},cc_EOC:function(){if(c.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,c.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate()},cc_TO:function(e){c.log("INFO","TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},cc_MIDROW:function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var n=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][n]}c.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},outputDataUpdate:function(){var e=c.time;null!==e&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(e,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},cueSplitAtTime:function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}};var y=function(e,t,n){this.field=e||1,this.outputs=[t,n],this.channels=[new m(1,t),new m(2,n)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}};y.prototype={getHandler:function(e){return this.channels[e].getHandler()},setHandler:function(e,t){this.channels[e].setHandler(t)},addData:function(e,t){var n,r,i,a=!1;this.lastTime=e,c.setTime(e);for(var o=0;o<t.length;o+=2)r=127&t[o],i=127&t[o+1],r>=16&&r<=31&&r===this.lastCmdA&&i===this.lastCmdB?(this.lastCmdA=null,this.lastCmdB=null,c.log("DEBUG","Repeated command ("+f([r,i])+") is dropped")):0!==r||0!==i?(c.log("DATA","["+f([t[o],t[o+1]])+"] -> ("+f([r,i])+")"),(n=this.parseCmd(r,i))||(n=this.parseMidrow(r,i)),n||(n=this.parsePAC(r,i)),n||(n=this.parseBackgroundAttributes(r,i)),n||(a=this.parseChars(r,i))&&(this.currChNr&&this.currChNr>=0?this.channels[this.currChNr-1].insertChars(a):c.log("WARNING","No channel found yet. TEXT-MODE?")),n?this.dataCounters.cmd+=2:a?this.dataCounters.char+=2:(this.dataCounters.other+=2,c.log("WARNING","Couldn\'t parse cleaned data "+f([r,i])+" orig: "+f([t[o],t[o+1]])))):this.dataCounters.padding+=2},parseCmd:function(e,t){var n;if(!((20===e||21===e||28===e||29===e)&&32<=t&&t<=47||(23===e||31===e)&&33<=t&&t<=35))return!1;n=20===e||21===e||23===e?1:2;var r=this.channels[n-1];return 20===e||21===e||28===e||29===e?32===t?r.cc_RCL():33===t?r.cc_BS():34===t?r.cc_AOF():35===t?r.cc_AON():36===t?r.cc_DER():37===t?r.cc_RU(2):38===t?r.cc_RU(3):39===t?r.cc_RU(4):40===t?r.cc_FON():41===t?r.cc_RDC():42===t?r.cc_TR():43===t?r.cc_RTD():44===t?r.cc_EDM():45===t?r.cc_CR():46===t?r.cc_ENM():47===t&&r.cc_EOC():r.cc_TO(t-32),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},parseMidrow:function(e,t){var n=null;if((17===e||25===e)&&32<=t&&t<=47){if((n=17===e?1:2)!==this.currChNr)return c.log("ERROR","Mismatch channel in midrow parsing"),!1;var r=this.channels[n-1];return r.insertChars([32]),r.cc_MIDROW(t),c.log("DEBUG","MIDROW ("+f([e,t])+")"),this.lastCmdA=e,this.lastCmdB=t,!0}return!1},parsePAC:function(e,t){var n,r;if(!((17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127||(16===e||24===e)&&64<=t&&t<=95))return!1;n=e<=23?1:2,r=64<=t&&t<=95?1===n?a[e]:s[e]:1===n?o[e]:u[e];var i=this.interpretPAC(r,t);return this.channels[n-1].setPAC(i),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},interpretPAC:function(e,t){var n,r={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-64,r.underline=1==(1&n),n<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((n-16)/2),r},parseChars:function(e,t){var r=null,i=null,a=null;if(e>=25?(r=2,a=e-8):(r=1,a=e),17<=a&&a<=19){var o;o=17===a?t+80:18===a?t+112:t+144,c.log("INFO","Special char \'"+n(o)+"\' in channel "+r),i=[o],this.lastCmdA=e,this.lastCmdB=t}else 32<=e&&e<=127&&(i=0===t?[e]:[e,t],this.lastCmdA=null,this.lastCmdB=null);if(i){var s=f(i);c.log("DEBUG","Char codes = "+s.join(","))}return i},parseBackgroundAttributes:function(e,t){var n,r,i;return((16===e||24===e)&&32<=t&&t<=47||(23===e||31===e)&&45<=t&&t<=47)&&(n={},16===e||24===e?(r=Math.floor((t-32)/2),n.background=l[r],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0)),i=e<24?1:2,this.channels[i-1].setBkgData(n),this.lastCmdA=e,this.lastCmdB=t,!0)},reset:function(){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].reset();this.lastCmdA=null,this.lastCmdB=null},cueSplitAtTime:function(e){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].cueSplitAtTime(e)}},e.logger=c,e.PenState=d,e.CaptionScreen=p,e.Cea608Parser=y,e.findCea608Nalus=function(e,t,n){for(var r=0,i=t,a=[],o=function(e,t,n,r){if(4!==e||t<8)return null;var i=n.getUint8(r),a=n.getUint16(r+1),o=n.getUint32(r+3),s=n.getUint8(r+7);return 181==i&&49==a&&1195456820==o&&3==s};i<t+n;){if(r=e.getUint32(i),6==(31&e.getUint8(i+4)))for(var s=i+5,u=-1;s<i+4+r-1;){u=0;for(var l=255;255===l;)u+=l=e.getUint8(s),s++;var c=0;for(l=255;255===l;)c+=l=e.getUint8(s),s++;o(u,c,e,s)&&a.push([s,c]),s+=c}i+=r+4}return a},e.extractCea608DataFromRange=function(e,t){var n=t[0],r=[[],[]];n+=8;var i=31&e.getUint8(n);n+=2;for(var a=0;a<i;a++){var o=e.getUint8(n),s=4&o,u=3&o;n++;var l=e.getUint8(n);n++;var c=e.getUint8(n);n++,s&&(127&l)+(127&c)!=0&&(0===u?(r[0].push(l),r[0].push(c)):1===u&&(r[1].push(l),r[1].push(c)))}return r}}(t)},8416:function(e,t,n){"use strict";var r=n(7688),i=n(5448),a=n(6398),o=n(2032),s=(n(5530),"undefined"!=typeof window&&window||n.g),u=s.dashjs;u||(u=s.dashjs={}),u.MediaPlayer=r.Z,u.FactoryMaker=i.Z,u.Debug=a.Z,u.Version=(0,o.e)()},6398:function(e,t,n){"use strict";var r=n(5595),i=n(8512),a=n(5448),o=1,s=2,u=3,l=4,c=5;function f(e){e=e||{};var t,n,a,f,d=this.context,g=(0,r.Z)(d).getInstance(),h=e.settings,p=[];function m(e){return e&&e.bind?e.bind(window.console):window.console.log.bind(window.console)}function y(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];S.apply(void 0,[o,this].concat(t))}function E(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];S.apply(void 0,[s,this].concat(t))}function v(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];S.apply(void 0,[u,this].concat(t))}function _(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];S.apply(void 0,[l,this].concat(t))}function T(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];S.apply(void 0,[c,this].concat(t))}function S(e,t){var r="",o=null;n&&(o=(new Date).getTime(),r+="["+(o-f)+"]"),a&&t&&t.getClassName&&(r+="["+t.getClassName()+"]",t.getType&&(r+="["+t.getType()+"]")),r.length>0&&(r+=" ");for(var s=arguments.length,u=new Array(s>2?s-2:0),l=2;l<s;l++)u[l-2]=arguments[l];Array.apply(null,u).forEach((function(e){r+=e+" "})),p[e]&&h&&h.get().debug.logLevel>=e&&p[e](r),h&&h.get().debug.dispatchEvent&&g.trigger(i.Z.LOG,{message:r,level:e})}return t={getLogger:function(e){return{fatal:y.bind(e),error:E.bind(e),warn:v.bind(e),info:_.bind(e),debug:T.bind(e)}},setLogTimestampVisible:function(e){n=e},setCalleeNameVisible:function(e){a=e}},n=!0,a=!0,f=(new Date).getTime(),"undefined"!=typeof window&&window.console&&(p[o]=m(window.console.error),p[s]=m(window.console.error),p[u]=m(window.console.warn),p[l]=m(window.console.info),p[c]=m(window.console.debug)),t}f.__dashjs_factory_name="Debug";var d=a.Z.getSingletonFactory(f);d.LOG_LEVEL_NONE=0,d.LOG_LEVEL_FATAL=o,d.LOG_LEVEL_ERROR=s,d.LOG_LEVEL_WARNING=u,d.LOG_LEVEL_INFO=l,d.LOG_LEVEL_DEBUG=c,a.Z.updateSingletonFactory(f.__dashjs_factory_name,d),t.Z=d},5595:function(e,t,n){"use strict";var r=n(5448),i=n(8825);function a(){var e={};function t(t,n,r){var i=-1;return e[t]?(e[t].some((function(e,t){if(e&&e.callback===n&&(!r||r===e.scope))return i=t,!0})),i):i}var n={on:function(n,r,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!n)throw new Error("event type cannot be null or undefined");if(!r||"function"!=typeof r)throw new Error("listener must be a function: "+r);var o=a.priority||0;if(!(t(n,r,i)>=0)){e[n]=e[n]||[];var s={callback:r,scope:i,priority:o};i&&i.getStreamId&&(s.streamId=i.getStreamId()),i&&i.getType&&(s.mediaType=i.getType()),a&&a.mode&&(s.mode=a.mode);var u=e[n].some((function(t,r){if(t&&o>t.priority)return e[n].splice(r,0,s),!0}));u||e[n].push(s)}},off:function(n,r,i){if(n&&r&&e[n]){var a=t(n,r,i);a<0||(e[n][a]=null)}},trigger:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t&&e[t]){if((n=n||{}).hasOwnProperty("type"))throw new Error("\'type\' is a reserved word for event dispatching");n.type=t,r.streamId&&(n.streamId=r.streamId),r.mediaType&&(n.mediaType=r.mediaType),e[t].filter((function(e){return!(!e||r.streamId&&e.streamId&&e.streamId!==r.streamId||r.mediaType&&e.mediaType&&e.mediaType!==r.mediaType||r.mode&&e.mode&&e.mode!==r.mode||!e.mode&&r.mode&&r.mode===i.Z.EVENT_MODE_ON_RECEIVE)})).forEach((function(e){return e&&e.callback.call(e.scope,n)}))}},reset:function(){e={}}};return n}a.__dashjs_factory_name="EventBus";var o=r.Z.getSingletonFactory(a);o.EVENT_PRIORITY_LOW=0,o.EVENT_PRIORITY_HIGH=5e3,r.Z.updateSingletonFactory(a.__dashjs_factory_name,o),t.Z=o},5448:function(e,t){"use strict";var n=function(){var e,t=[],n={},r={};function i(e,n){for(var r in t){var i=t[r];if(i.context===e&&i.name===n)return i.instance}return null}function a(e,t){return t[e]}function o(e,t,n){e in n&&(n[e]=t)}function s(t,n,r){var i,a=t.__dashjs_factory_name,o=n[a];if(o){var s=o.instance;if(!o.override)return s.apply({context:n,factory:e},r);for(var u in i=t.apply({context:n},r),s=s.apply({context:n,factory:e,parent:i},r))i.hasOwnProperty(u)&&(i[u]=s[u])}else i=t.apply({context:n},r);return i.getClassName=function(){return a},i}return e={extend:function(e,t,n,r){!r[e]&&t&&(r[e]={instance:t,override:n})},getSingletonInstance:i,setSingletonInstance:function(e,n,r){for(var i in t){var a=t[i];if(a.context===e&&a.name===n)return void(t[i].instance=r)}t.push({name:n,context:e,instance:r})},deleteSingletonInstances:function(e){t=t.filter((function(t){return t.context!==e}))},getSingletonFactory:function(e){var r=a(e.__dashjs_factory_name,n);return r||(r=function(n){var r;return void 0===n&&(n={}),{getInstance:function(){return r||(r=i(n,e.__dashjs_factory_name)),r||(r=s(e,n,arguments),t.push({name:e.__dashjs_factory_name,context:n,instance:r})),r}}},n[e.__dashjs_factory_name]=r),r},getSingletonFactoryByName:function(e){return a(e,n)},updateSingletonFactory:function(e,t){o(e,t,n)},getClassFactory:function(e){var t=a(e.__dashjs_factory_name,r);return t||(t=function(t){return void 0===t&&(t={}),{create:function(){return s(e,t,arguments)}}},r[e.__dashjs_factory_name]=t),t},getClassFactoryByName:function(e){return a(e,r)},updateClassFactory:function(e,t){o(e,t,r)}},e}();t.Z=n},1264:function(e,t,n){"use strict";var r=n(5448),i=n(703),a=n(6398),o=n(3393),s=n(7855),u=n(5595),l=n(8512);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(){var e,t,n=this.context,r=(0,u.Z)(n).getInstance(),d={"streaming.delay.liveDelay":l.Z.SETTING_UPDATED_LIVE_DELAY,"streaming.delay.liveDelayFragmentCount":l.Z.SETTING_UPDATED_LIVE_DELAY_FRAGMENT_COUNT,"streaming.liveCatchup.enabled":l.Z.SETTING_UPDATED_CATCHUP_ENABLED,"streaming.liveCatchup.playbackRate.min":l.Z.SETTING_UPDATED_PLAYBACK_RATE_MIN,"streaming.liveCatchup.playbackRate.max":l.Z.SETTING_UPDATED_PLAYBACK_RATE_MAX},g={debug:{logLevel:a.Z.LOG_LEVEL_WARNING,dispatchEvent:!1},streaming:{abandonLoadTimeout:1e4,wallclockTimeUpdateInterval:100,manifestUpdateRetryInterval:100,cacheInitSegments:!1,applyServiceDescription:!0,applyProducerReferenceTime:!0,applyContentSteering:!0,eventControllerRefreshDelay:100,enableManifestDurationMismatchFix:!0,parseInbandPrft:!1,enableManifestTimescaleMismatchFix:!1,capabilities:{filterUnsupportedEssentialProperties:!0,useMediaCapabilitiesApi:!1},timeShiftBuffer:{calcFromSegmentTimeline:!1,fallbackToSegmentTimeline:!0},metrics:{maxListDepth:100},delay:{liveDelayFragmentCount:NaN,liveDelay:NaN,useSuggestedPresentationDelay:!0},protection:{keepProtectionMediaKeys:!1,ignoreEmeEncryptedEvent:!1,detectPlayreadyMessageFormat:!0},buffer:{enableSeekDecorrelationFix:!1,fastSwitchEnabled:!0,flushBufferAtTrackSwitch:!1,reuseExistingSourceBuffers:!0,bufferPruningInterval:10,bufferToKeep:20,bufferTimeAtTopQuality:30,bufferTimeAtTopQualityLongForm:60,initialBufferLevel:NaN,stableBufferTime:12,longFormContentDurationThreshold:600,stallThreshold:.3,useAppendWindow:!0,setStallState:!0,avoidCurrentTimeRangePruning:!1,useChangeTypeForTrackSwitch:!0,mediaSourceDurationInfinity:!0,resetSourceBuffersForTrackSwitch:!1},gaps:{jumpGaps:!0,jumpLargeGaps:!0,smallGapLimit:1.5,threshold:.3,enableSeekFix:!0,enableStallFix:!1,stallSeek:.1},utcSynchronization:{enabled:!0,useManifestDateHeaderTimeSource:!0,backgroundAttempts:2,timeBetweenSyncAttempts:30,maximumTimeBetweenSyncAttempts:600,minimumTimeBetweenSyncAttempts:2,timeBetweenSyncAttemptsAdjustmentFactor:2,maximumAllowedDrift:100,enableBackgroundSyncAfterSegmentDownloadError:!0,defaultTimingSource:{scheme:"urn:mpeg:dash:utc:http-xsdate:2014",value:"https://time.akamai.com/?iso&ms"}},scheduling:{defaultTimeout:500,lowLatencyTimeout:0,scheduleWhilePaused:!0},text:{defaultEnabled:!0,extendSegmentedCues:!0,webvtt:{customRenderingEnabled:!1}},liveCatchup:{maxDrift:NaN,playbackRate:{min:NaN,max:NaN},playbackBufferMin:.5,enabled:null,mode:o.Z.LIVE_CATCHUP_MODE_DEFAULT},lastBitrateCachingInfo:{enabled:!0,ttl:36e4},lastMediaSettingsCachingInfo:{enabled:!0,ttl:36e4},saveLastMediaSettingsForCurrentStreamingSession:!0,cacheLoadThresholds:{video:50,audio:5},trackSwitchMode:{audio:o.Z.TRACK_SWITCH_MODE_ALWAYS_REPLACE,video:o.Z.TRACK_SWITCH_MODE_NEVER_REPLACE},selectionModeForInitialTrack:o.Z.TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY,fragmentRequestTimeout:2e4,fragmentRequestProgressTimeout:-1,manifestRequestTimeout:1e4,retryIntervals:(e={},f(e,s.w.MPD_TYPE,500),f(e,s.w.XLINK_EXPANSION_TYPE,500),f(e,s.w.MEDIA_SEGMENT_TYPE,1e3),f(e,s.w.INIT_SEGMENT_TYPE,1e3),f(e,s.w.BITSTREAM_SWITCHING_SEGMENT_TYPE,1e3),f(e,s.w.INDEX_SEGMENT_TYPE,1e3),f(e,s.w.MSS_FRAGMENT_INFO_SEGMENT_TYPE,1e3),f(e,s.w.LICENSE,1e3),f(e,s.w.OTHER_TYPE,1e3),f(e,"lowLatencyReductionFactor",10),e),retryAttempts:(t={},f(t,s.w.MPD_TYPE,3),f(t,s.w.XLINK_EXPANSION_TYPE,1),f(t,s.w.MEDIA_SEGMENT_TYPE,3),f(t,s.w.INIT_SEGMENT_TYPE,3),f(t,s.w.BITSTREAM_SWITCHING_SEGMENT_TYPE,3),f(t,s.w.INDEX_SEGMENT_TYPE,3),f(t,s.w.MSS_FRAGMENT_INFO_SEGMENT_TYPE,3),f(t,s.w.LICENSE,3),f(t,s.w.OTHER_TYPE,3),f(t,"lowLatencyMultiplyFactor",5),t),abr:{movingAverageMethod:o.Z.MOVING_AVERAGE_SLIDING_WINDOW,ABRStrategy:o.Z.ABR_STRATEGY_DYNAMIC,additionalAbrRules:{insufficientBufferRule:!0,switchHistoryRule:!0,droppedFramesRule:!0,abandonRequestsRule:!0},abrRulesParameters:{abandonRequestsRule:{graceTimeThreshold:500,abandonMultiplier:1.8,minLengthToAverage:5}},bandwidthSafetyFactor:.9,useDefaultABRRules:!0,useDeadTimeLatency:!0,limitBitrateByPortal:!1,usePixelRatioInLimitBitrateByPortal:!1,maxBitrate:{audio:-1,video:-1},minBitrate:{audio:-1,video:-1},maxRepresentationRatio:{audio:1,video:1},initialBitrate:{audio:-1,video:-1},initialRepresentationRatio:{audio:-1,video:-1},autoSwitchBitrate:{audio:!0,video:!0},fetchThroughputCalculationMode:o.Z.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING},cmcd:{enabled:!1,sid:null,cid:null,rtp:null,rtpSafetyFactor:5,mode:o.Z.CMCD_MODE_QUERY,enabledKeys:["br","d","ot","tb","bl","dl","mtp","nor","nrr","su","bs","rtp","cid","pr","sf","sid","st","v"]},cmsd:{enabled:!1,abr:{applyMb:!1,etpWeightRatio:0}}},errors:{recoverAttempts:{mediaErrorDecode:5}}},h=i.Z.clone(g);function p(e,t,n){for(var a in e)e.hasOwnProperty(a)&&(t.hasOwnProperty(a)?"object"!==c(e[a])||e[a]instanceof Array||null===e[a]?(t[a]=i.Z.clone(e[a]),d[n+a]&&r.trigger(d[n+a])):p(e[a],t[a],n.slice()+a+"."):console.error("Settings parameter "+n+a+" is not supported"))}return{get:function(){return h},update:function(e){"object"===c(e)&&p(e,h,"")},reset:function(){h=i.Z.clone(g)}}}d.__dashjs_factory_name="Settings";var g=r.Z.getSingletonFactory(d);t.Z=g},703:function(e,t,n){"use strict";var r=n(3875),i=n.n(r),a=n(1067);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"mixin",value:function(t,n,r){var i,a={};if(t)for(var s in n)n.hasOwnProperty(s)&&(i=n[s],s in t&&(t[s]===i||s in a&&a[s]===i)||("object"===o(t[s])&&null!==t[s]?t[s]=e.mixin(t[s],i,r):t[s]=r(i)));return t}},{key:"clone",value:function(t){if(!t||"object"!==o(t))return t;var n;if(t instanceof Array){n=[];for(var r=0,i=t.length;r<i;++r)r in t&&n.push(e.clone(t[r]))}else n={};return e.mixin(n,t,e.clone)}},{key:"addAditionalQueryParameterToUrl",value:function(e,t){try{if(!t||0===t.length)return e;var n=new URL(e);return t.forEach((function(e){e.key&&e.value&&n.searchParams.set(e.key,e.value)})),n.href}catch(t){return e}}},{key:"parseHttpHeaders",value:function(e){var t={};if(!e)return t;for(var n=e.trim().split("\\r\\n"),r=0,i=n.length;r<i;r++){var a=n[r],o=a.indexOf(": ");o>0&&(t[a.substring(0,o)]=a.substring(o+2))}return t}},{key:"generateUuid",value:function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?n:3&n|8).toString(16)}))}},{key:"generateHashCode",value:function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}},{key:"getRelativeUrl",value:function(e,t){try{var n=new URL(e),r=new URL(t);if(n.protocol=r.protocol,n.origin!==r.origin)return t;var a=i().relative(n.pathname.substr(0,n.pathname.lastIndexOf("/")),r.pathname.substr(0,r.pathname.lastIndexOf("/"))),o=0===a.length?1:0;return a+=r.pathname.substr(r.pathname.lastIndexOf("/")+o,r.pathname.length-1),r.pathname.length<a.length?r.pathname:a}catch(e){return t}}},{key:"parseUserAgent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;try{var t=null===e&&"undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"";return(0,a.UAParser)(t)}catch(e){return{}}}},{key:"stringHasProtocol",value:function(e){return/(http(s?)):\\/\\//i.test(e)}}],null&&0,n&&s(t,n),e}();t.Z=u},2032:function(e,t,n){"use strict";function r(){return"4.7.3"}n.d(t,{e:function(){return r}})},2230:function(e,t){"use strict";function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r;return t=e,(r=[{key:"extend",value:function(e,t){if(e){var n=!!t&&t.override,r=!!t&&t.publicOnly;for(var i in e)!e.hasOwnProperty(i)||this[i]&&!n||r&&-1===e[i].indexOf("public_")||(this[i]=e[i])}}}])&&n(t.prototype,r),e}();t.Z=r},4351:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}function a(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}var s=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(s,e);var t,n,r=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=o(t);if(n){var i=o(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return a(this,e)});function s(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(e=r.call(this)).ATTEMPT_BACKGROUND_SYNC="attemptBackgroundSync",e.BUFFERING_COMPLETED="bufferingCompleted",e.BUFFER_CLEARED="bufferCleared",e.BYTES_APPENDED_END_FRAGMENT="bytesAppendedEndFragment",e.BUFFER_REPLACEMENT_STARTED="bufferReplacementStarted",e.CHECK_FOR_EXISTENCE_COMPLETED="checkForExistenceCompleted",e.CMSD_STATIC_HEADER="cmsdStaticHeader",e.CURRENT_TRACK_CHANGED="currentTrackChanged",e.DATA_UPDATE_COMPLETED="dataUpdateCompleted",e.INBAND_EVENTS="inbandEvents",e.INITIAL_STREAM_SWITCH="initialStreamSwitch",e.INIT_FRAGMENT_LOADED="initFragmentLoaded",e.INIT_FRAGMENT_NEEDED="initFragmentNeeded",e.INTERNAL_MANIFEST_LOADED="internalManifestLoaded",e.ORIGINAL_MANIFEST_LOADED="originalManifestLoaded",e.LOADING_COMPLETED="loadingCompleted",e.LOADING_PROGRESS="loadingProgress",e.LOADING_DATA_PROGRESS="loadingDataProgress",e.LOADING_ABANDONED="loadingAborted",e.MANIFEST_UPDATED="manifestUpdated",e.MEDIA_FRAGMENT_LOADED="mediaFragmentLoaded",e.MEDIA_FRAGMENT_NEEDED="mediaFragmentNeeded",e.QUOTA_EXCEEDED="quotaExceeded",e.SEGMENT_LOCATION_BLACKLIST_ADD="segmentLocationBlacklistAdd",e.SEGMENT_LOCATION_BLACKLIST_CHANGED="segmentLocationBlacklistChanged",e.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD="serviceLocationBlacklistAdd",e.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED="serviceLocationBlacklistChanged",e.SERVICE_LOCATION_LOCATION_BLACKLIST_ADD="serviceLocationLocationBlacklistAdd",e.SERVICE_LOCATION_LOCATION_BLACKLIST_CHANGED="serviceLocationLocationBlacklistChanged",e.SET_FRAGMENTED_TEXT_AFTER_DISABLED="setFragmentedTextAfterDisabled",e.SET_NON_FRAGMENTED_TEXT="setNonFragmentedText",e.SOURCE_BUFFER_ERROR="sourceBufferError",e.STREAMS_COMPOSED="streamsComposed",e.STREAM_BUFFERING_COMPLETED="streamBufferingCompleted",e.STREAM_REQUESTING_COMPLETED="streamRequestingCompleted",e.TEXT_TRACKS_QUEUE_INITIALIZED="textTracksQueueInitialized",e.TIME_SYNCHRONIZATION_COMPLETED="timeSynchronizationComplete",e.UPDATE_TIME_SYNC_OFFSET="updateTimeSyncOffset",e.URL_RESOLUTION_FAILED="urlResolutionFailed",e.VIDEO_CHUNK_RECEIVED="videoChunkReceived",e.WALLCLOCK_TIME_UPDATED="wallclockTimeUpdated",e.XLINK_ELEMENT_LOADED="xlinkElementLoaded",e.XLINK_READY="xlinkReady",e.SEEK_TARGET="seekTarget",e.SETTING_UPDATED_LIVE_DELAY="settingUpdatedLiveDelay",e.SETTING_UPDATED_LIVE_DELAY_FRAGMENT_COUNT="settingUpdatedLiveDelayFragmentCount",e.SETTING_UPDATED_CATCHUP_ENABLED="settingUpdatedCatchupEnabled",e.SETTING_UPDATED_PLAYBACK_RATE_MIN="settingUpdatedPlaybackRateMin",e.SETTING_UPDATED_PLAYBACK_RATE_MAX="settingUpdatedPlaybackRateMax",e}return s}(n(8342).Z);t.Z=s},8512:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){return a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},a(e,t)}function o(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}var u=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(u,e);var t,n,r=(t=u,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=s(t);if(n){var i=s(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return o(this,e)});function u(){return i(this,u),r.apply(this,arguments)}return u}(n(4351).Z),l=new u;t.Z=l},8342:function(e,t){"use strict";function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r;return t=e,(r=[{key:"extend",value:function(e,t){if(e){var n=!!t&&t.override,r=!!t&&t.publicOnly;for(var i in e)!e.hasOwnProperty(i)||this[i]&&!n||r&&-1===e[i].indexOf("public_")||(this[i]=e[i])}}}])&&n(t.prototype,r),e}();t.Z=r},9326:function(e,t,n){"use strict";var r=n(3186),i=n(7855),a=n(5448),o=n(8825),s=n(7387),u=n(1553);function l(e){var t,n,a,l,c,f=(e=e||{}).eventBus,d=e.debug,g=e.urlUtils,h=e.type,p=e.streamInfo,m=e.segmentsController,y=e.timelineConverter,E=e.baseURLController;function v(){return h}function _(){a=null}function T(e,t,n){var r,i,a=E.resolve(n.path),o={};return a&&t!==a.url&&g.isRelative(t)?(r=a.url,i=a.serviceLocation,o=a.queryParams,t&&(r=g.resolve(t,r))):r=t,!g.isRelative(r)&&(e.url=r,e.serviceLocation=i,e.queryParams=o,!0)}function S(e,t){if(null==t)return null;var n=new r.Z,a=t.representation,o=a.adaptation.period.mpd.manifest.Period_asArray[a.adaptation.period.index].AdaptationSet_asArray[a.adaptation.index].Representation_asArray[a.index].bandwidth,u=t.media;return u=(0,s.vi)(u,"Number",t.replacementNumber),u=(0,s.vi)(u,"Time",t.replacementTime),u=(0,s.vi)(u,"Bandwidth",o),u=(0,s.Aj)(u,a.id),u=(0,s.eR)(u),n.mediaType=v(),n.type=i.w.MEDIA_SEGMENT_TYPE,n.range=t.mediaRange,n.startTime=t.presentationStartTime,n.mediaStartTime=t.mediaStartTime,n.duration=t.duration,n.timescale=a.timescale,n.availabilityStartTime=t.availabilityStartTime,n.availabilityEndTime=t.availabilityEndTime,n.availabilityTimeComplete=a.availabilityTimeComplete,n.wallStartTime=t.wallStartTime,n.quality=a.index,n.index=t.index,n.mediaInfo=e,n.adaptationIndex=a.adaptation.index,n.representationId=a.id,T(n,u,a)?n:void 0}function b(e,t,r){var i=null;if(!t||!t.segmentInfoType)return i;var o=m.getSegmentByTime(t,r);return o&&(a=o,n.debug("Index for time "+r+" is "+o.index),i=S(e,o)),i}function A(e,t,r){var i=null,o=m.getSegmentByIndex(t,r,a?a.mediaStartTime:-1);if(o)i=S(e,o),a=o;else{if(l&&!c)return n.debug(v()+" No segment found at index: "+r+". Wait for next loop"),null;c=!0}return i}function I(){n.debug("Dynamic stream complete"),c=!0}return t={getCurrentIndex:function(){return a?a.index:-1},getInitRequest:function(e,t){return t?function(e,t,n){var a=new r.Z,o=t.adaptation.period,u=o.start;if(a.mediaType=n,a.type=i.w.INIT_SEGMENT_TYPE,a.range=t.range,a.availabilityStartTime=y.calcAvailabilityStartTimeFromPresentationTime(u,t,l),a.availabilityEndTime=y.calcAvailabilityEndTimeFromPresentationTime(u+o.duration,t,l),a.quality=t.index,a.mediaInfo=e,a.representationId=t.id,T(a,t.initialization,t))return a.url=(0,s.vi)(a.url,"Bandwidth",t.bandwidth),a}(e,t,v()):null},getNextSegmentRequest:function(e,t){return t&&t.segmentInfoType?A(e,t,a?a.index+1:0):null},getNextSegmentRequestIdempotent:function(e,t){var n=a?a.index+1:0,r=m.getSegmentByIndex(t,n,a?a.mediaStartTime:-1);return r?S(e,r):null},getSegmentRequestForTime:b,getStreamId:function(){return p.id},getStreamInfo:function(){return p},getType:v,getValidTimeAheadOfTargetTime:function(e,t,n,r){try{if(isNaN(e)||!t||!n)return NaN;if(e<0&&(e=0),isNaN(r)&&(r=.5),b(t,n,e))return e;if(n.adaptation.period.start+n.adaptation.period.duration<e)return NaN;for(var i=isFinite(n.adaptation.period.duration)?n.adaptation.period.start+n.adaptation.period.duration:e+30,a=Math.min(e+r,i),o=NaN,s=null;a<=i;){var u=null;if(a<=i&&(u=b(t,n,a)),u){o=a,s=u;break}a+=r}if(s){var l=s.startTime+s.duration;return e>s.startTime&&l-e>r?e:!isNaN(s.startTime)&&e<s.startTime&&o>s.startTime?s.startTime+.001:Math.min(l-r,o)}return o}catch(e){return NaN}},initialize:function(e){l=e,c=!1,m.initialize(e)},isLastSegmentRequested:function(e,t){if(!e||!a)return!1;if(c)return!0;if(!isFinite(e.adaptation.period.duration))return!1;if(a.presentationStartTime+a.duration>t)return!1;if(e.mediaFinishedInformation&&!isNaN(e.mediaFinishedInformation.numberOfSegments)&&!isNaN(a.index)&&a.index>=e.mediaFinishedInformation.numberOfSegments-1){if(!l||e.segmentInfoType===u.Z.SEGMENT_TEMPLATE)return!0;if(l&&e.segmentInfoType===u.Z.SEGMENT_LIST&&e.adaptation.period.nextPeriodId)return!0}return!!(l&&e.adaptation.period.nextPeriodId&&e.segmentInfoType===u.Z.SEGMENT_TIMELINE&&e.mediaFinishedInformation&&!isNaN(e.mediaFinishedInformation.mediaTimeOfLastSignaledSegment)&&a&&!isNaN(a.mediaStartTime)&&!isNaN(a.duration)&&a.mediaStartTime+a.duration>=e.mediaFinishedInformation.mediaTimeOfLastSignaledSegment-.05)},repeatSegmentRequest:function(e,t){return t&&t.segmentInfoType?A(e,t,a?a.index:0):null},reset:function(){_(),f.off(o.Z.DYNAMIC_TO_STATIC,I,t)}},n=d.getLogger(t),_(),f.on(o.Z.DYNAMIC_TO_STATIC,I,t),t}l.__dashjs_factory_name="DashHandler",t.Z=a.Z.getClassFactory(l)},1553:function(e,t){"use strict";function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.init()}var t,r;return t=e,(r=[{key:"init",value:function(){this.BASE_URL="BaseURL",this.SEGMENT_BASE="SegmentBase",this.SEGMENT_TEMPLATE="SegmentTemplate",this.SEGMENT_LIST="SegmentList",this.SEGMENT_URL="SegmentURL",this.SEGMENT_TIMELINE="SegmentTimeline",this.SEGMENT_PROFILES="segmentProfiles",this.ADAPTATION_SET="AdaptationSet",this.REPRESENTATION="Representation",this.REPRESENTATION_INDEX="RepresentationIndex",this.SUB_REPRESENTATION="SubRepresentation",this.INITIALIZATION="Initialization",this.INITIALIZATION_MINUS="initialization",this.MPD="MPD",this.PERIOD="Period",this.ASSET_IDENTIFIER="AssetIdentifier",this.EVENT_STREAM="EventStream",this.ID="id",this.PROFILES="profiles",this.SERVICE_LOCATION="serviceLocation",this.RANGE="range",this.INDEX="index",this.MEDIA="media",this.BYTE_RANGE="byteRange",this.INDEX_RANGE="indexRange",this.MEDIA_RANGE="mediaRange",this.VALUE="value",this.CONTENT_TYPE="contentType",this.MIME_TYPE="mimeType",this.BITSTREAM_SWITCHING="BitstreamSwitching",this.BITSTREAM_SWITCHING_MINUS="bitstreamSwitching",this.CODECS="codecs",this.DEPENDENCY_ID="dependencyId",this.MEDIA_STREAM_STRUCTURE_ID="mediaStreamStructureId",this.METRICS="Metrics",this.METRICS_MINUS="metrics",this.REPORTING="Reporting",this.WIDTH="width",this.HEIGHT="height",this.SAR="sar",this.FRAMERATE="frameRate",this.AUDIO_SAMPLING_RATE="audioSamplingRate",this.MAXIMUM_SAP_PERIOD="maximumSAPPeriod",this.START_WITH_SAP="startWithSAP",this.MAX_PLAYOUT_RATE="maxPlayoutRate",this.CODING_DEPENDENCY="codingDependency",this.SCAN_TYPE="scanType",this.FRAME_PACKING="FramePacking",this.AUDIO_CHANNEL_CONFIGURATION="AudioChannelConfiguration",this.CONTENT_PROTECTION="ContentProtection",this.ESSENTIAL_PROPERTY="EssentialProperty",this.SUPPLEMENTAL_PROPERTY="SupplementalProperty",this.SUPPLEMENTAL_PROPERTY_ASARRAY="SupplementalProperty_asArray",this.INBAND_EVENT_STREAM="InbandEventStream",this.PRODUCER_REFERENCE_TIME="ProducerReferenceTime",this.INBAND="inband",this.TYPE="type",this.ACCESSIBILITY="Accessibility",this.ROLE="Role",this.RATING="Rating",this.CONTENT_COMPONENT="ContentComponent",this.SUBSET="Subset",this.LANG="lang",this.VIEWPOINT="Viewpoint",this.VIEWPOINT_ASARRAY="Viewpoint_asArray",this.ROLE_ASARRAY="Role_asArray",this.REPRESENTATION_ASARRAY="Representation_asArray",this.PRODUCERREFERENCETIME_ASARRAY="ProducerReferenceTime_asArray",this.ACCESSIBILITY_ASARRAY="Accessibility_asArray",this.AUDIOCHANNELCONFIGURATION_ASARRAY="AudioChannelConfiguration_asArray",this.CONTENTPROTECTION_ASARRAY="ContentProtection_asArray",this.MAIN="main",this.DYNAMIC="dynamic",this.STATIC="static",this.MEDIA_PRESENTATION_DURATION="mediaPresentationDuration",this.MINIMUM_UPDATE_PERIOD="minimumUpdatePeriod",this.CODEC_PRIVATE_DATA="codecPrivateData",this.BANDWITH="bandwidth",this.SOURCE_URL="sourceURL",this.TIMESCALE="timescale",this.DURATION="duration",this.START_NUMBER="startNumber",this.PRESENTATION_TIME_OFFSET="presentationTimeOffset",this.AVAILABILITY_START_TIME="availabilityStartTime",this.AVAILABILITY_END_TIME="availabilityEndTime",this.TIMESHIFT_BUFFER_DEPTH="timeShiftBufferDepth",this.MAX_SEGMENT_DURATION="maxSegmentDuration",this.PRESENTATION_TIME="presentationTime",this.MIN_BUFFER_TIME="minBufferTime",this.MAX_SUBSEGMENT_DURATION="maxSubsegmentDuration",this.START="start",this.AVAILABILITY_TIME_OFFSET="availabilityTimeOffset",this.AVAILABILITY_TIME_COMPLETE="availabilityTimeComplete",this.CENC_DEFAULT_KID="cenc:default_KID",this.DVB_PRIORITY="dvb:priority",this.DVB_WEIGHT="dvb:weight",this.SUGGESTED_PRESENTATION_DELAY="suggestedPresentationDelay",this.SERVICE_DESCRIPTION="ServiceDescription",this.SERVICE_DESCRIPTION_SCOPE="Scope",this.SERVICE_DESCRIPTION_LATENCY="Latency",this.SERVICE_DESCRIPTION_PLAYBACK_RATE="PlaybackRate",this.SERVICE_DESCRIPTION_OPERATING_QUALITY="OperatingQuality",this.SERVICE_DESCRIPTION_OPERATING_BANDWIDTH="OperatingBandwidth",this.PATCH_LOCATION="PatchLocation",this.PATCH_LOCATION_AS_ARRAY="PatchLocation_asArray",this.LOCATION="Location",this.LOCATION_AS_ARRAY="Location_asArray",this.PUBLISH_TIME="publishTime",this.ORIGINAL_PUBLISH_TIME="originalPublishTime",this.ORIGINAL_MPD_ID="mpdId",this.WALL_CLOCK_TIME="wallClockTime",this.PRESENTATION_TIME="presentationTime",this.LABEL="Label",this.GROUP_LABEL="GroupLabel",this.CONTENT_STEERING="ContentSteering",this.CONTENT_STEERING_AS_ARRAY="ContentSteering_asArray",this.DEFAULT_SERVICE_LOCATION="defaultServiceLocation",this.QUERY_BEFORE_START="queryBeforeStart",this.CLIENT_REQUIREMENT="clientRequirement",this.TTL="ttl",this.CONTENT_STEERING_RESPONSE={VERSION:"VERSION",TTL:"TTL",RELOAD_URI:"RELOAD-URI",PATHWAY_PRIORITY:"PATHWAY-PRIORITY",PATHWAY_CLONES:"PATHWAY-CLONES",BASE_ID:"BASE-ID",ID:"ID",URI_REPLACEMENT:"URI-REPLACEMENT",HOST:"HOST",PARAMS:"PARAMS"},this.PRODUCER_REFERENCE_TIME_TYPE={ENCODER:"encoder",CAPTURED:"captured",APPLICATION:"application"},this.SEGMENT_ALIGNMENT="segmentAlignment",this.SUB_SEGMENT_ALIGNMENT="subsegmentAlignment"}}])&&n(t.prototype,r),e}());t.Z=r},7802:function(e,t,n){"use strict";var r=n(5448),i=n(1724),a=n(3636),o=n(1736),s=n(5246);function u(e){e=e||{};var t,n,r=this.context,u=e.dashConstants,l=e.type,c=e.segmentBaseController;function f(e){return e?e.segments?n[u.SEGMENT_BASE]:n[e.segmentInfoType]:null}return t={initialize:function(t){n[u.SEGMENT_TIMELINE]=(0,i.Z)(r).create(e,t),n[u.SEGMENT_TEMPLATE]=(0,a.Z)(r).create(e,t),n[u.SEGMENT_LIST]=(0,o.Z)(r).create(e,t),n[u.SEGMENT_BASE]=(0,s.Z)(r).create(e,t)},updateInitData:function(e,t){return t?Promise.resolve():c.getSegmentBaseInitSegment({representation:e,mediaType:l})},updateSegmentData:function(e,t){return t?Promise.resolve():c.getSegmentList({mimeType:e.mimeType,representation:e,mediaType:l})},getSegmentByIndex:function(e,t,n){var r=f(e);return r?r.getSegmentByIndex(e,t,n):null},getSegmentByTime:function(e,t){var n=f(e);return n?n.getSegmentByTime(e,t):null},getMediaFinishedInformation:function(e){var t=f(e);return t?t.getMediaFinishedInformation(e):{numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN}}},n={},t}u.__dashjs_factory_name="SegmentsController";var l=r.Z.getClassFactory(u);t.Z=l},1736:function(e,t,n){"use strict";var r=n(5448),i=n(3393),a=n(7387);function o(e,t){var n=(e=e||{}).timelineConverter;function r(){if(!n||!n.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(i.Z.MISSING_CONFIG_ERROR)}function o(e,i){if(r(),!e)return null;var o=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentList,s=o.SegmentURL_asArray.length,u=e&&!isNaN(e.startNumber)?e.startNumber:1,l=Math.max(u-1,0),c=Math.max(i-l,0),f=null;if(c<s){var d=o.SegmentURL_asArray[c];(f=(0,a.NF)(n,t,e,i))&&(f.replacementTime=(u+i-1)*e.segmentDuration,f.media=d.media?d.media:"",f.mediaRange=d.mediaRange,f.indexRange=d.indexRange)}return f}return{getSegmentByIndex:o,getSegmentByTime:function(e,t){if(r(),!e)return null;var i=e.segmentDuration;if(isNaN(i))return null;var a=n.calcPeriodRelativeTimeFromMpdRelativeTime(e,t);return o(e,Math.floor(a/i))},getMediaFinishedInformation:function(e){var t={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN};if(!e)return t;var n=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentList,r=e&&!isNaN(e.startNumber)?e.startNumber:1,i=Math.max(r-1,0);return t.numberOfSegments=i+n.SegmentURL_asArray.length,t}}}o.__dashjs_factory_name="ListSegmentsGetter";var s=r.Z.getClassFactory(o);t.Z=s},5246:function(e,t,n){"use strict";var r=n(5448),i=n(3393);function a(e){var t=(e=e||{}).timelineConverter;function n(){if(!t||!t.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(i.Z.MISSING_CONFIG_ERROR)}function r(e,t){if(n(),!e)return null;var r,i=e.segments?e.segments.length:-1;if(t<i&&(r=e.segments[t])&&r.index===t)return r;for(var a=0;a<i;a++)if((r=e.segments[a])&&r.index===t)return r;return null}return{getSegmentByIndex:r,getSegmentByTime:function(e,t){n();var i=function(e,t){if(!e)return-1;var n,r,i,a,o,s=e.segments,u=s?s.length:null,l=-1;if(s&&u>0)for(o=0;o<u;o++)if(i=(r=s[o]).presentationStartTime,t+(n=(a=r.duration)/2)>=i&&t-n<i+a){l=r.index;break}return l}(e,t);return r(e,i)},getMediaFinishedInformation:function(e){var t={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN};return e&&e.segments?(t.numberOfSegments=e.segments.length,t):t}}}a.__dashjs_factory_name="SegmentBaseGetter";var o=r.Z.getClassFactory(a);t.Z=o},7387:function(e,t,n){"use strict";n.d(t,{Aj:function(){return o},NF:function(){return c},TJ:function(){return f},eR:function(){return a},vi:function(){return s}});var r=n(2011);function i(e,t){for(;e.length<t;)e="0"+e;return e}function a(e){return e?e.split("$$").join("$"):e}function o(e,t){if(!t||!e||-1===e.indexOf("$RepresentationID$"))return e;var n=t.toString();return e.split("$RepresentationID$").join(n)}function s(e,t,n){var r,a,o,s,u,l,c=t.length,f="%0".length;if(!e)return e;for(;;){if((r=e.indexOf("$"+t))<0)return e;if((a=e.indexOf("$",r+c))<0)return e;if((o=e.indexOf("%0",r+c))>r&&o<a)switch(s=e.charAt(a-1),u=parseInt(e.substring(o+f,a-1),10),s){case"d":case"i":case"u":l=i(n.toString(),u);break;case"x":l=i(n.toString(16),u);break;case"X":l=i(n.toString(16),u).toUpperCase();break;case"o":l=i(n.toString(8),u);break;default:return e}else l=n;e=e.substring(0,r)+l+e.substring(a+1)}}function u(e,t,n,i,a,o,s,u){var l,c=new r.Z;return c.representation=e,c.duration=t,c.presentationStartTime=n,c.mediaStartTime=i,c.availabilityStartTime=a.calcAvailabilityStartTimeFromPresentationTime(o,e,s),c.availabilityEndTime=a.calcAvailabilityEndTimeFromPresentationTime(o+t,e,s),c.wallStartTime=a.calcWallTimeForSegment(c,s),c.replacementNumber=(l=u,c.representation.startNumber+l),c.index=u,c}function l(e,t,n,r){var i=t.adaptation.period;if(isFinite(i.duration)&&i.start+i.duration<=n.presentationStartTime)return!1;if(r){if("INF"===t.availabilityTimeOffset)return!0;var a=e.getClientReferenceTime();return n.availabilityStartTime.getTime()<=a&&(!isFinite(n.availabilityEndTime)||n.availabilityEndTime.getTime()>=a)}return!0}function c(e,t,n,r){var i,a,o;i=n.segmentDuration,isNaN(i)&&(i=n.adaptation.period.duration),a=parseFloat((n.adaptation.period.start+r*i).toFixed(5)),o=parseFloat((a+i).toFixed(5));var s=u(n,i,a,e.calcMediaTimeFromPresentationTime(a,n),e,o,t,r);return l(e,n,s,t)?s:null}function f(e,t,n,r,i,a,o,c,f,d){var g,h,p=r/a,m=i/a;return g=e.calcPresentationTimeFromMediaTime(p,n),l(e,n,h=u(n,m,g,p,e,g+m,t,f),t)?(h.replacementTime=d||r,o=s(o,"Number",h.replacementNumber),o=s(o,"Time",h.replacementTime),h.media=o,h.mediaRange=c,h):null}},3636:function(e,t,n){"use strict";var r=n(5448),i=n(3393),a=n(7387);function o(e,t){var n=(e=e||{}).timelineConverter;function r(){if(!n||!n.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(i.Z.MISSING_CONFIG_ERROR)}function o(e,i){if(r(),!e)return null;var o=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentTemplate;i=Math.max(i,0);var s=(0,a.NF)(n,t,e,i);if(s){s.replacementTime=Math.round((i-1)*e.segmentDuration*e.timescale,10);var u=o.media;u=(0,a.vi)(u,"Number",s.replacementNumber),u=(0,a.vi)(u,"Time",s.replacementTime),s.media=u}return s}return{getSegmentByIndex:o,getSegmentByTime:function(e,t){if(r(),!e)return null;var i=e.segmentDuration;if(isNaN(i))return null;var a=n.calcPeriodRelativeTimeFromMpdRelativeTime(e,t);return o(e,Math.floor(a/i))},getMediaFinishedInformation:function(e){var t={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN};if(!e)return t;var n=e.segmentDuration;return isNaN(n)?t.numberOfSegments=1:t.numberOfSegments=Math.ceil(e.adaptation.period.duration/n),t}}}o.__dashjs_factory_name="TemplateSegmentsGetter";var s=r.Z.getClassFactory(o);t.Z=s},1724:function(e,t,n){"use strict";var r=n(5448),i=n(3393),a=n(7387);function o(e,t){var n=(e=e||{}).timelineConverter,r=e.dashMetrics;function o(){if(!n)throw new Error(i.Z.MISSING_CONFIG_ERROR)}function s(e,t){var n,r,i,a,o,s,l,c=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentTemplate||e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentList,f=c.SegmentTimeline,d=c.SegmentURL_asArray,g=0,h=-1;l=e.timescale;var p=!1;for(i=0,a=(n=f.S_asArray).length;i<a&&!p;i++)for(s=0,(r=n[i]).hasOwnProperty("r")&&(s=r.r),r.hasOwnProperty("t")&&(g=r.t),s<0&&(s=u(e,n[i+1],r,l,g/l)),o=0;o<=s&&!p;o++)(p=t(g,c,d,r,l,++h,i))&&(e.segmentDuration=r.d/l),g+=r.d}function u(e,t,i,a,o){var s;if(t&&t.hasOwnProperty("t"))s=t.t/a;else try{var u=0;if(isNaN(e.adaptation.period.start)||isNaN(e.adaptation.period.duration)||!isFinite(e.adaptation.period.duration)){var l=r.getCurrentDVRInfo();u=isNaN(l.end)?0:l.end}else u=e.adaptation.period.start+e.adaptation.period.duration;s=n.calcMediaTimeFromPresentationTime(u,e),e.segmentDuration=i.d/a}catch(e){s=0}return Math.max(Math.ceil((s-o)/(i.d/a))-1,0)}return{getSegmentByIndex:function(e,r,i){if(o(),!e)return null;var u=null,l=!1;return s(e,(function(r,o,s,c,f,d,g){if(l||i<0){var h=o.media,p=c.mediaRange;return s&&(h=s[g].media||"",p=s[g].mediaRange),u=(0,a.TJ)(n,t,e,r,c.d,f,h,p,d,c.tManifest),!0}return r>=i*f-.5*c.d&&(l=!0),!1})),u},getSegmentByTime:function(e,r){if(o(),!e)return null;void 0===r&&(r=null);var i=null,u=n.calcMediaTimeFromPresentationTime(r,e);return s(e,(function(r,o,s,l,c,f,d){var g=parseFloat((u*c).toPrecision(15));if(g<r+l.d&&g>=r){var h=o.media,p=l.mediaRange;return s&&(h=s[d].media||"",p=s[d].mediaRange),i=(0,a.TJ)(n,t,e,r,l.d,c,h,p,f,l.tManifest),!0}return!1})),i},getMediaFinishedInformation:function(e){if(!e)return 0;var t,n,r,i,a,o,s,l=(e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentTemplate||e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentList).SegmentTimeline,c=0,f=0,d=0;for(s=e.timescale,i=(t=l.S_asArray).length,r=0;r<i;r++)for(o=0,(n=t[r]).hasOwnProperty("r")&&(o=n.r),n.hasOwnProperty("t")&&(f=(c=n.t)/s),o<0&&(o=u(e,t[r+1],n,s,f)),a=0;a<=o;a++)d++,f=(c+=n.d)/s;return{numberOfSegments:d,mediaTimeOfLastSignaledSegment:f}}}}o.__dashjs_factory_name="TimelineSegmentsGetter";var s=r.Z.getClassFactory(o);t.Z=s},2011:function(e,t){"use strict";t.Z=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.indexRange=null,this.index=null,this.mediaRange=null,this.media=null,this.duration=NaN,this.replacementTime=null,this.replacementNumber=NaN,this.mediaStartTime=NaN,this.presentationStartTime=NaN,this.availabilityStartTime=NaN,this.availabilityEndTime=NaN,this.wallStartTime=NaN,this.representation=null}},2610:function(e,t){"use strict";t.Z=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.schemeIdUri="",this.value=""}},7688:function(e,t,n){"use strict";n.d(t,{Z:function(){return ja}});var r=n(452),i=n.n(r),a=n(3393),o=n(1553),s=n(3860),u=n(5595),l=n(8512),c=n(5448),f=n(6398),d=n(8825);function g(){var e,t,n,r,i,o,c,g,h,p,m,y,E,v,_,T,S,b,A,I,R,w,N,C,D=this.context,O=(0,u.Z)(D).getInstance();function M(){F(),v=!1,p=0,m=0,T=0,w=!1,S=!0,b=!1,N=!1,A=NaN,c&&(O.off(l.Z.DATA_UPDATE_COMPLETED,Q,e),O.off(l.Z.LOADING_PROGRESS,ye,e),O.off(l.Z.MANIFEST_UPDATED,Te,e),O.off(l.Z.STREAMS_COMPOSED,Se,e),O.off(d.Z.PLAYBACK_ENDED,he,e),O.off(d.Z.STREAM_INITIALIZING,ve,e),O.off(d.Z.REPRESENTATION_SWITCH,_e,e),O.off(d.Z.BUFFER_LEVEL_STATE_CHANGED,ee,e),X(),c.removeEventListener("canplay",J),c.removeEventListener("canplaythrough",$),c.removeEventListener("play",te),c.removeEventListener("waiting",ne),c.removeEventListener("playing",re),c.removeEventListener("pause",ie),c.removeEventListener("error",pe),c.removeEventListener("seeking",ae),c.removeEventListener("seeked",oe),c.removeEventListener("timeupdate",se),c.removeEventListener("progress",ue),c.removeEventListener("ratechange",le),c.removeEventListener("loadedmetadata",ce),c.removeEventListener("loadeddata",fe),c.removeEventListener("stalled",Ee),c.removeEventListener("ended",de),c.removeEventListener("volumechange",ge)),h=null,c=null,y=null,E=null}function P(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return parseFloat((L(e)-B()).toFixed(5))}function L(e){var t=e||y;return t.start+t.duration}function x(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];y&&c&&c.getElement()?(e&&E&&Z(B()),c.play()):v=!0}function F(){y&&c&&c.pause()}function k(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(y&&c&&c.getElement()){var a=isNaN(A)?c.getTime():A;e!==a&&((I=!0===r)||(A=e),t.info("Requesting seek to time: "+e+(I?" (internal)":"")),E&&i&&Z(e),c.setCurrentTime(e,n))}}function U(){if(y&&c&&E){var e=n&&n.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,t=i.getCurrentDVRInfo(e);return t&&t.range?t.range.end:0}}function Z(e){var t=new Date(g.getClientReferenceTime()),n=o.getRegularPeriods()[0],r=g.calcPresentationTimeFromWallTime(t,n);p=r-e}function B(){return y&&c?c.getTime():null}function G(){return y&&c?c.isPaused():null}function q(){return y&&c?c.isSeeking():null}function Y(){return y&&c?c.isStalled():null}function j(){return y&&c?c.getPlaybackRate():null}function H(){return y&&c?c.getEnded():null}function V(){return E}function K(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!G()&&E&&0!==c.getReadyState()&&!q()&&!w){e||(e=n.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO);var r=B(),i=z(r,e),o=!isNaN(i)&&i!==r;o&&!q()&&(Y()||R||1===c.getReadyState())&&(t.debug("UpdateCurrentTime: Seek to actual time: ".concat(i," from currentTime: ").concat(r)),k(i,!1,!1))}}function z(e,t){var n=i.getCurrentDVRInfo(t),r=n?n.range:null;return r?e>r.end?Math.max(r.end-p,r.start):e>0&&e+.25<r.start&&Math.abs(e-r.start)<31536e4?b?Math.max(r.end-p,r.start):r.start:e:NaN}function W(){null===h&&(h=setInterval((function(){var e;O.trigger(l.Z.WALLCLOCK_TIME_UPDATED,{isDynamic:E,time:new Date}),V()&&(n.addDVRMetric(),G()?(e=Date.now(),(!_||e>_+500)&&(_=e,se())):K())}),C.get().streaming.wallclockTimeUpdateInterval))}function X(){clearInterval(h),h=null}function Q(e){var t=o.convertRepresentationToRepresentationInfo(e.currentRepresentation),n=t?t.mediaInfo.streamInfo:null;null!==n&&y.id===n.id&&(y=n)}function J(){O.trigger(l.Z.CAN_PLAY)}function $(){O.trigger(l.Z.CAN_PLAY_THROUGH)}function ee(e){e.streamId===n.getActiveStreamInfo().id&&(R=e.state===s.Z.BUFFER_EMPTY,C.get().streaming.buffer.setStallState&&c.setStallState(e.mediaType,e.state===s.Z.BUFFER_EMPTY))}function te(){t.info("Native video element event: play"),K(),W(),O.trigger(l.Z.PLAYBACK_STARTED,{startTime:B()})}function ne(){t.info("Native video element event: waiting"),O.trigger(l.Z.PLAYBACK_WAITING,{playingTime:B()})}function re(){t.info("Native video element event: playing"),I=!1,O.trigger(l.Z.PLAYBACK_PLAYING,{playingTime:B()})}function ie(){t.info("Native video element event: pause"),O.trigger(l.Z.PLAYBACK_PAUSED,{ended:H()})}function ae(){if(!I){var e=B();isNaN(A)||A===e||(e=A),A=NaN,t.info("Seeking to: "+e),W(),O.trigger(l.Z.PLAYBACK_SEEKING,{seekTime:e,streamId:y.id})}}function oe(){t.info("Native video element event: seeked"),I=!1,O.trigger(l.Z.PLAYBACK_SEEKED)}function se(){y&&O.trigger(l.Z.PLAYBACK_TIME_UPDATED,{timeToEnd:P(),time:B(),streamId:y.id})}function ue(){O.trigger(l.Z.PLAYBACK_PROGRESS,{streamId:y.id})}function le(){var e=j();t.info("Native video element event: ratechange: ",e),O.trigger(l.Z.PLAYBACK_RATE_CHANGED,{playbackRate:e})}function ce(){t.info("Native video element event: loadedmetadata"),O.trigger(l.Z.PLAYBACK_METADATA_LOADED),W()}function fe(){t.info("Native video element event: loadeddata"),O.trigger(l.Z.PLAYBACK_LOADED_DATA)}function de(){t.info("Native video element event: ended"),F(),X();var e=n?n.getActiveStreamInfo():null;e&&O.trigger(l.Z.PLAYBACK_ENDED,{isLast:e.isLast})}function ge(){O.trigger(l.Z.PLAYBACK_VOLUME_CHANGED)}function he(e){if(h&&e.isLast){t.info("onPlaybackEnded -- PLAYBACK_ENDED but native video element didn\'t fire ended");var n=e.seekTime?e.seekTime:L();c.setCurrentTime(n),F(),X()}}function pe(e){var t=e.target||e.srcElement;O.trigger(l.Z.PLAYBACK_ERROR,{error:t.error})}function me(){E=!1}function ye(e){if(!1===e.stream&&b&&!isNaN(e.request.duration)){var n=1.2*e.request.duration;n>p&&(t.warn("Browser does not support fetch API with StreamReader. Increasing live delay to be 20% higher than segment duration:",n.toFixed(2)),p=n,m=n)}}function Ee(e){O.trigger(l.Z.PLAYBACK_STALLED,{e:e})}function ve(e){var n;(n=e.mediaInfo)&&n.supplementalProperties&&"true"===n.supplementalProperties[a.Z.SUPPLEMENTAL_PROPERTY_DVB_LL_SCHEME]&&(t.debug("Low Latency critical SupplementalProperty set: Enabling low Latency"),b=!0)}function _e(e){var t=n.getActiveStreamInfo();e&&t&&e.currentRepresentation&&e.streamId&&e.streamId===t.id&&e.mediaType&&(e.mediaType===a.Z.VIDEO||e.mediaType===a.Z.AUDIO)&&(S=e.currentRepresentation.availabilityTimeComplete,(b=!S)&&!N&&(N=!0))}function Te(){w=!0}function Se(){w=!1}return e={initialize:function(t,n){y=t,!0!==n&&(c.addEventListener("canplay",J),c.addEventListener("canplaythrough",$),c.addEventListener("play",te),c.addEventListener("waiting",ne),c.addEventListener("playing",re),c.addEventListener("pause",ie),c.addEventListener("error",pe),c.addEventListener("seeking",ae),c.addEventListener("seeked",oe),c.addEventListener("timeupdate",se),c.addEventListener("progress",ue),c.addEventListener("ratechange",le),c.addEventListener("loadedmetadata",ce),c.addEventListener("loadeddata",fe),c.addEventListener("stalled",Ee),c.addEventListener("ended",de),c.addEventListener("volumechange",ge),E=y.manifestInfo.isDynamic,R=!1,I=!1,O.on(l.Z.DATA_UPDATE_COMPLETED,Q,e),O.on(l.Z.LOADING_PROGRESS,ye,e),O.on(l.Z.MANIFEST_UPDATED,Te,e),O.on(l.Z.STREAMS_COMPOSED,Se,e),O.on(d.Z.PLAYBACK_ENDED,he,e,{priority:u.Z.EVENT_PRIORITY_HIGH}),O.on(d.Z.STREAM_INITIALIZING,ve,e),O.on(d.Z.REPRESENTATION_SWITCH,_e,e),O.on(d.Z.BUFFER_LEVEL_STATE_CHANGED,ee,e),O.on(d.Z.DYNAMIC_TO_STATIC,me,e),v&&(v=!1,x()))},setConfig:function(e){e&&(e.streamController&&(n=e.streamController),e.serviceDescriptionController&&(r=e.serviceDescriptionController),e.dashMetrics&&(i=e.dashMetrics),e.adapter&&(o=e.adapter),e.videoModel&&(c=e.videoModel),e.timelineConverter&&(g=e.timelineConverter),e.settings&&(C=e.settings))},getTimeToStreamEnd:P,getBufferLevel:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=null;return n.getActiveStreamProcessors().forEach((function(n){if(!e||0===e.length||-1===e.indexOf(n.getType())){var r=n.getBufferLevel();t=null===t?r:Math.min(t,r)}})),t},getPlaybackStalled:function(){return R},getTime:B,getLowLatencyModeEnabled:function(){return b},getInitialCatchupModeActivated:function(){return N},getIsManifestUpdateInProgress:function(){return w},getPlaybackRate:j,getPlayedRanges:function(){return y&&c?c.getPlayedRanges():null},getEnded:H,getIsDynamic:V,getStreamController:function(){return n},computeAndSetLiveDelay:function(e,t){var n,i,a,s=!isNaN(e)&&isFinite(e)?e:NaN,u=o.getSuggestedPresentationDelay(),l=r.getServiceDescriptionSettings();return n=isNaN(C.get().streaming.delay.liveDelay)?null===C.get().streaming.delay.liveDelayFragmentCount||isNaN(C.get().streaming.delay.liveDelayFragmentCount)||isNaN(s)?l&&!isNaN(l.liveDelay)&&l.liveDelay>0?l.liveDelay:!0===C.get().streaming.delay.useSuggestedPresentationDelay&&null!==u&&!isNaN(u)&&u>0?u:isNaN(s)?t&&!isNaN(t.minBufferTime)?4*t.minBufferTime:4*y.manifestInfo.minBufferTime:4*s:s*C.get().streaming.delay.liveDelayFragmentCount:C.get().streaming.delay.liveDelay,null!==(a=o.getAvailabilityStartTime())&&(T=a),i=t&&t.dvrWindowSize>0?Math.min(n,t.dvrWindowSize):n,p=i,m=i,i},getLiveDelay:function(){return p},getOriginalLiveDelay:function(){return m},getCurrentLiveLatency:function(){if(!E||isNaN(T))return NaN;var e=B();if(isNaN(e)||0===e)return 0;var t=(new Date).getTime()+1e3*g.getClientTimeOffset();return Math.max(((t-T-1e3*e)/1e3).toFixed(3),0)},play:x,isPaused:G,isStalled:Y,pause:F,isSeeking:q,getStreamEndTime:L,seek:k,seekToOriginalLive:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=U();if(0!==r){var i=r-(p=m);k(i,e,t,n)}},seekToCurrentLive:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=U();if(0!==r){var i=r-p;k(i,e,t,n)}},reset:M,updateCurrentTime:K,getAvailabilityStartTime:function(){return T}},t=(0,f.Z)(D).getInstance().getLogger(e),M(),e}g.__dashjs_factory_name="PlaybackController";var h=c.Z.getSingletonFactory(g),p=n(3186),m="loading",y="executed",E="failed";function v(e){var t,n,r,i,a=(e=e||{}).eventBus,o=e.events,s=e.dashMetrics,u=e.fragmentLoader,l=e.debug,c=e.streamInfo,f=e.type;function d(e){var t;return!!e&&(t=!1,r.some((function(n){if(r=e,i=n,!isNaN(r.index)&&r.startTime===i.startTime&&r.adaptationIndex===i.adaptationIndex&&r.type===i.type||function(e,t){return isNaN(e.index)&&isNaN(t.index)&&e.quality===t.quality}(e,n)||function(e,t){return e.action===p.Z.ACTION_COMPLETE&&e.action===t.action}(e,n))return t=!0;var r,i})),t)}function g(e){return isNaN(e.duration)?.25:Math.min(e.duration/8,.5)}function h(e){r=r.filter((function(t){var n=g(t);return isNaN(t.startTime)||void 0!==e&&t.startTime>=e-n}))}function v(e,t){t<=e+.5||(r=r.filter((function(n){var r=g(n);return isNaN(n.startTime)||n.startTime>=t-r||isNaN(n.duration)||n.startTime+n.duration<=e+r})))}function _(e,t,n){for(var r=e.length-1;r>=0;r--){var i=e[r],a=i.startTime,o=a+i.duration;if(n=isNaN(n)?g(i):n,!isNaN(a)&&!isNaN(o)&&t+n>=a&&t-n<o||isNaN(a)&&isNaN(t))return i}return null}function T(e,t){s.addSchedulingInfo(e,t),s.addRequestsQueue(e.mediaType,i,r)}function S(e){e.sender===u&&(i.splice(i.indexOf(e.request),1),e.response&&!e.error&&r.push(e.request),T(e.request,e.error?E:y),a.trigger(o.FRAGMENT_LOADING_COMPLETED,{request:e.request,response:e.response,error:e.error,sender:this},{streamId:c.id,mediaType:f}))}function b(e){e.sender===u&&a.trigger(o.FRAGMENT_LOADING_PROGRESS,{request:e.request,response:e.response,error:e.error,sender:this},{streamId:c.id,mediaType:f})}function A(e){e.sender===u&&a.trigger(o.FRAGMENT_LOADING_ABANDONED,{request:e.request},{streamId:c.id,mediaType:f})}function I(){r=[],i=[]}return t={getStreamId:function(){return c.id},getType:function(){return f},getRequests:function(e){var t=e?e.state instanceof Array?e.state:[e.state]:[],n=[];return t.forEach((function(t){var a=function(e){var t;switch(e){case m:t=i;break;case y:t=r;break;default:t=[]}return t}(t);n=n.concat(function(e,t){return t.hasOwnProperty("time")?[_(e,t.time,t.threshold)]:e.filter((function(e){for(var n in t)if("state"!==n&&t.hasOwnProperty(n)&&e[n]!=t[n])return!1;return!0}))}(a,e))})),n},isFragmentLoaded:d,isFragmentLoadedOrPending:function(e){var t,n=!1,r=0;if(!(n=d(e)))for(r=0;r<i.length;r++)t=i[r],e.url===t.url&&e.startTime===t.startTime&&(n=!0);return n},removeExecutedRequestsBeforeTime:h,removeExecutedRequestsAfterTime:function(e){r=r.filter((function(t){return isNaN(t.startTime)||void 0!==e&&t.startTime<e}))},syncExecutedRequestsWithBufferedRange:function(e,t){if(e&&0!==e.length){for(var n=0,r=0,i=e.length;r<i;r++)v(n,e.start(r)),n=e.end(r);t>0&&v(n,t)}else h()},abortRequests:function(){n.debug("abort requests"),u.abort(),i=[]},executeRequest:function(e){e.action===p.Z.ACTION_DOWNLOAD?(T(e,m),i.push(e),function(e){a.trigger(o.FRAGMENT_LOADING_STARTED,{request:e},{streamId:c.id,mediaType:f}),u.load(e)}(e)):n.warn("Unknown request action.")},reset:function(){a.off(o.LOADING_COMPLETED,S,this),a.off(o.LOADING_DATA_PROGRESS,b,this),a.off(o.LOADING_ABANDONED,A,this),u&&u.reset(),I()},resetInitialSettings:I,addExecutedRequest:function(e){r.push(e)}},n=l.getLogger(t),I(),a.on(o.LOADING_COMPLETED,S,t),a.on(o.LOADING_DATA_PROGRESS,b,t),a.on(o.LOADING_ABANDONED,A,t),t}v.__dashjs_factory_name="FragmentModel";var _=c.Z.getClassFactory(v);_.FRAGMENT_MODEL_LOADING=m,_.FRAGMENT_MODEL_EXECUTED=y,_.FRAGMENT_MODEL_CANCELED="canceled",_.FRAGMENT_MODEL_FAILED=E,c.Z.updateClassFactory(v.__dashjs_factory_name,_);var T=_,S=n(5459);function b(e){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},b(e)}function A(e,t){return A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},A(e,t)}function I(e,t){return!t||"object"!==b(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var w=new(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(n){var i=R(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return I(this,e)});function i(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(e=r.call(this)).MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE=10,e.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE=11,e.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE=12,e.SEGMENT_BASE_LOADER_ERROR_CODE=15,e.TIME_SYNC_FAILED_ERROR_CODE=16,e.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE=17,e.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE=18,e.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE=19,e.APPEND_ERROR_CODE=20,e.REMOVE_ERROR_CODE=21,e.DATA_UPDATE_FAILED_ERROR_CODE=22,e.CAPABILITY_MEDIASOURCE_ERROR_CODE=23,e.CAPABILITY_MEDIAKEYS_ERROR_CODE=24,e.DOWNLOAD_ERROR_ID_MANIFEST_CODE=25,e.DOWNLOAD_ERROR_ID_SIDX_CODE=26,e.DOWNLOAD_ERROR_ID_CONTENT_CODE=27,e.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE=28,e.DOWNLOAD_ERROR_ID_XLINK_CODE=29,e.MANIFEST_ERROR_ID_PARSE_CODE=31,e.MANIFEST_ERROR_ID_NOSTREAMS_CODE=32,e.TIMED_TEXT_ERROR_ID_PARSE_CODE=33,e.MANIFEST_ERROR_ID_MULTIPLEXED_CODE=34,e.MEDIASOURCE_TYPE_UNSUPPORTED_CODE=35,e.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE="parsing failed for ",e.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading manifest: ",e.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading Xlink element: ",e.SEGMENTS_UPDATE_FAILED_ERROR_MESSAGE="Segments update failed",e.SEGMENTS_UNAVAILABLE_ERROR_MESSAGE="no segments are available yet",e.SEGMENT_BASE_LOADER_ERROR_MESSAGE="error loading segment ranges from sidx",e.TIME_SYNC_FAILED_ERROR_MESSAGE="Failed to synchronize client and server time",e.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE="request is null",e.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE="Failed to resolve a valid URL",e.APPEND_ERROR_MESSAGE="chunk is not defined",e.REMOVE_ERROR_MESSAGE="Removing data from the SourceBuffer",e.DATA_UPDATE_FAILED_ERROR_MESSAGE="Data update failed",e.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE="mediasource is not supported",e.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE="mediakeys is not supported",e.TIMED_TEXT_ERROR_MESSAGE_PARSE="parsing error :",e.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE="Error creating source buffer of type : ",e}return i}(n(2230).Z)),N=n(1264),C=n(7855);function D(e){var t,n,r,i,o,s,u=this.context,c=(0,N.Z)(u).getInstance(),d=e.textController,g=e.eventBus,h=[],p=[],m=!1,y=e.mediaSource,E=null;function v(e){return new Promise((function(t){M((function(){i.changeType&&i.changeType(e),t()}))}))}function _(e){return i=d.getTextSourceBuffer(e),Promise.resolve()}function T(){if("function"==typeof i.addEventListener)try{i.addEventListener("updateend",D,!1),i.addEventListener("error",O,!1),i.addEventListener("abort",O,!1)}catch(e){s=setInterval(D,50)}else s=setInterval(D,50)}function b(e){return new Promise((function(t){i&&c.get().streaming.buffer.useAppendWindow?M((function(){try{if(!i)return void t();var n=y.duration,a=0;e&&!isNaN(e.start)&&!isNaN(e.duration)&&isFinite(e.duration)&&(n=e.start+e.duration),e&&!isNaN(e.start)&&(a=e.start),i.appendWindowEnd===n&&i.appendWindowStart===a||(i.appendWindowStart=0,i.appendWindowEnd=n+.01,i.appendWindowStart=Math.max(a-.1,0),r.debug("Updated append window for ".concat(o.type,". Set start to ").concat(i.appendWindowStart," and end to ").concat(i.appendWindowEnd))),t()}catch(e){r.warn("Failed to set append window"),t()}})):t()}))}function A(e){return new Promise((function(t){i?M((function(){try{i.timestampOffset===e||isNaN(e)||(i.timestampOffset=e,r.debug("Set MSE timestamp offset to ".concat(e))),t()}catch(e){t()}})):t()}))}function I(){if(!m&&p.length>0){m=!0;var e=p[0];p.splice(0,1);var t=function(){m=!1,p.length>0&&I.call(this),e&&e.data&&e.data.segmentType&&e.data.segmentType!==C.w.INIT_SEGMENT_TYPE&&delete e.data.bytes,e.promise.resolve({chunk:e.data})};try{E=e.request,0===e.data.bytes.byteLength?t.call(this):(i.appendBuffer?i.appendBuffer(e.data.bytes):i.append(e.data.bytes,e.data),M(t.bind(this)))}catch(t){r.fatal(\'SourceBuffer append failed "\'+t+\'"\'),p.length>0?I():m=!1,delete e.data.bytes,e.promise.reject({chunk:e.data,error:new S.Z(t.code,t.message)})}}}function R(){h.length>0&&(i.updating||(h.shift()(),R()))}function D(){i.updating||R()}function O(e){var t,r,i=e.target||{};t=l.Z.SOURCE_BUFFER_ERROR,r={error:i,lastRequestAppended:E}||{},g.trigger(t,r,{streamId:o.streamInfo.id,mediaType:n})}function M(e){h.push(e),i.updating||R()}return t={getType:function(){return n},getAllBufferRanges:function(){try{return i.buffered}catch(e){return r.error("getAllBufferRanges exception: "+e.message),null}},getBuffer:function(){return i},append:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new Promise((function(r,i){e?(p.push({data:e,promise:{resolve:r,reject:i},request:n}),M(I.bind(t))):i({chunk:e,error:new S.Z(w.APPEND_ERROR_CODE,w.APPEND_ERROR_MESSAGE)})}))},remove:function(e){return new Promise((function(t,n){var r=e.start,a=e.end;r>=0&&a>r?M((function(){try{i.remove(r,a),M((function(){t({from:r,to:a,unintended:!1}),e.resolve&&e.resolve()}))}catch(t){n({from:r,to:a,unintended:!1,error:new S.Z(w.REMOVE_ERROR_CODE,w.REMOVE_ERROR_MESSAGE)}),e.reject&&e.reject(t)}})):t()}))},abort:function(){return new Promise((function(e){try{p=[],"open"===y.readyState?M((function(){try{i&&i.abort(),e()}catch(t){e()}})):i&&i.setTextTrack&&"ended"===y.readyState?(i.abort(),e()):e()}catch(t){e()}}))},reset:function(){if(i){try{h=[],function(){try{"function"==typeof i.removeEventListener&&(i.removeEventListener("updateend",D,!1),i.removeEventListener("error",O,!1),i.removeEventListener("abort",O,!1)),clearInterval(s)}catch(e){r.error(e)}}(),m=!1,p=[],i.getClassName&&"TextSourceBuffer"===i.getClassName()||(r.debug("Removing sourcebuffer from media source"),y.removeSourceBuffer(i))}catch(e){}i=null}E=null},updateTimestampOffset:A,initializeForStreamSwitch:function(e,t,r){n=(o=e).type;var a=o.codec;!function(e){i=e.getBuffer()}(r),T();var s=[];return s.push(new Promise((function(e){M((function(){var t=i.appendWindowStart,n=i.appendWindowEnd;i&&(i.abort(),i.appendWindowStart=t,i.appendWindowEnd=n),e()}))}))),s.push(b(o.streamInfo)),c.get().streaming.buffer.useChangeTypeForTrackSwitch&&s.push(v(a)),t&&void 0!==t.MSETimeOffset&&s.push(A(t.MSETimeOffset)),Promise.all(s)},initializeForFirstUse:function(e,t,r){n=(o=t).type;var s=o.codec;try{if(s.match(/application\\/mp4;\\s*codecs="(stpp|wvtt).*"/i))return _(e);i=y.addSourceBuffer(s),T();var u=[];return u.push(b(o.streamInfo)),r&&void 0!==r.MSETimeOffset&&u.push(A(r.MSETimeOffset)),Promise.all(u)}catch(t){return o.type==a.Z.TEXT&&!o.isFragmented||-1!==s.indexOf(\'codecs="stpp\')||-1!==s.indexOf(\'codecs="vtt\')||-1!==s.indexOf("text/vtt")?_(e):Promise.reject(t)}},updateAppendWindow:b,changeType:v},r=(0,f.Z)(u).getInstance().getLogger(t),t}D.__dashjs_factory_name="SourceBufferSink";var O=c.Z.getClassFactory(D);function M(e){var t,n,r,i=this.context,a=[],o=e;function s(e,t){return a=a.filter((function(n){return!((isNaN(t)||n.start<t)&&(isNaN(e)||n.end>e))})),Promise.resolve()}return t={getAllBufferRanges:function(){for(var e=[],t=0;t<a.length;t++){var n=a[t];0===e.length||n.start>e[e.length-1].end?e.push({start:n.start,end:n.end}):e[e.length-1].end=n.end}var r={start:function(t){return e[t].start},end:function(t){return e[t].end}};return Object.defineProperty(r,"length",{get:function(){return e.length}}),r},append:function(e){return"InitializationSegment"!==e.segmentType?(a.push(e),a.sort((function(e,t){return e.start-t.start})),r=null):r=e,n.debug("PreBufferSink appended chunk s: "+e.start+"; e: "+e.end),o&&o({chunk:e}),Promise.resolve()},remove:s,abort:function(){return Promise.resolve()},discharge:function(e,t){var n=function(e,t){return a.filter((function(n){return(isNaN(t)||n.start<t)&&(isNaN(e)||n.end>e)}))}(e,t);return r&&(n.push(r),r=null),s(e,t),n},reset:function(){a=[],r=null,o=null},updateTimestampOffset:function(){return Promise.resolve()},waitForUpdateEnd:function(e){e()},getBuffer:function(){return this}},n=(0,f.Z)(i).getInstance().getLogger(t),t}M.__dashjs_factory_name="PreBufferSink";var P=c.Z.getClassFactory(M);function L(){var e={};return{save:function(t){var n=t.streamId,r=t.representationId;e[n]=e[n]||{},e[n][r]=t},extract:function(t,n){return e&&e[t]&&e[t][n]?e[t][n]:null},reset:function(){e={}}}}L.__dashjs_factory_name="InitCache";var x=c.Z.getSingletonFactory(L),F=.01,k="BufferController";function U(e){e=e||{};var t,n,r,i,o,c,g,h,p,m,y,E,v,_,b,A,I,R,N,D,M,L=this.context,U=(0,u.Z)(L).getInstance(),Z=e.errHandler,B=e.fragmentModel,G=e.representationController,q=e.adapter,Y=e.textController,j=e.abrController,H=e.playbackController,V=e.streamInfo,K=e.type,z=e.settings;function W(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new Promise((function(n,r){c=e,p&&t&&"function"==typeof p.discharge?(m=p,Q(t).then((function(){n()})).catch((function(e){r(e)}))):n()}))}function X(e){return q.convertRepresentationToRepresentationInfo(G.getRepresentationForQuality(e))}function Q(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return new Promise((function(n,r){R&&e?c?(y=!1,$(e,t).then((function(e){n(e)})).catch((function(e){r(e)}))):(y=!0,J().then((function(e){n(e)})).catch((function(e){r(e)}))):n(null)}))}function J(){var e=this;return new Promise((function(t,n){var r=j.getQualityFor(K,V.id);p=P(L).create(ie.bind(e)),_e(X(r)).then((function(){t(p)})).catch((function(){n()}))}))}function $(e,t){return new Promise((function(r,i){var o=j.getQualityFor(K,V.id);p=O(L).create({mediaSource:c,textController:Y,eventBus:U}),function(e,t,n){var r=X(n);return t&&t[K]&&(K===a.Z.VIDEO||K===a.Z.AUDIO)?p.initializeForStreamSwitch(e,r,t[K]):p.initializeForFirstUse(V,e,r)}(e,t,o).then((function(){return _e(X(o))})).then((function(){r(p)})).catch((function(e){n.fatal("Caught error on create SourceBuffer: "+e),Z.error(new S.Z(w.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,w.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+K)),i(e)}))}))}function ee(e){z.get().streaming.cacheInitSegments&&(n.info("Init fragment finished loading saving to",K+"\'s init cache"),R.save(e.chunk)),n.debug("Append Init fragment",K," with representationId:",e.chunk.representationId," and quality:",e.chunk.quality,", data size:",e.chunk.bytes.byteLength),ne(e.chunk)}function te(e){ne(e.chunk,e.request)}function ne(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;p&&(p.append(e,t).then((function(e){ie(e)})).catch((function(e){ie(e)})),e.mediaInfo.type===a.Z.VIDEO&&Ne(l.Z.VIDEO_CHUNK_RECEIVED,{chunk:e}))}function re(e){if(e&&e.length>0)for(var t=0,r=e.length;t<r;t++)n.debug("Buffered range: "+e.start(t)+" - "+e.end(t)+", currentTime = ",H.getTime())}function ie(e){if(e.error)return 22===e.error.code&&function(){if(I=!0,o=.8*Ie(),n.warn("Quota exceeded, Critical Buffer: "+o),o>0){var e=Math.max(.2*o,1),t=o-e,r=Math.min(z.get().streaming.buffer.bufferTimeAtTopQuality,.9*t),i=Math.min(z.get().streaming.buffer.bufferTimeAtTopQualityLongForm,.9*t),a={streaming:{buffer:{bufferToKeep:parseFloat(e.toFixed(5)),bufferTimeAtTopQuality:parseFloat(r.toFixed(5)),bufferTimeAtTopQualityLongForm:parseFloat(i.toFixed(5))}}};z.update(a)}}(),void(22!==e.error.code&&we()||(n.warn("Clearing playback buffer to overcome quota exceed situation"),Ne(l.Z.QUOTA_EXCEEDED,{criticalBufferLevel:o,quotaExceededTime:e.chunk.start}),ye(me())));if(p&&(fe(),I=!1,(_=e.chunk)&&_.endFragment)){_&&!isNaN(_.index)&&(g=Math.max(_.index,g),de());var t=p.getAllBufferRanges();_.segmentType===C.w.MEDIA_SEGMENT_TYPE&&(re(t),se(),function(){if(!isNaN(M)&&!y)if(K===a.Z.AUDIO||K===a.Z.VIDEO){var e=H.getTime(),t=ce(e,0),n=ce(M,0);if(t&&n&&t.start===n.start)M=NaN;else{var r=G.getCurrentRepresentation().segmentDuration,i=ce(M,r);i&&(z.get().streaming.buffer.enableSeekDecorrelationFix&&Math.abs(e-M)>r?M<=i.end&&H.seek(Math.max(M,i.start),!1,!0):e<i.start&&H.seek(i.start,!1,!0))}}else M=NaN}());var r=!1;E&&(E.indexOf(_)>0&&(r=!0),E=null),_&&!r&&Ne(l.Z.BYTES_APPENDED_END_FRAGMENT,{quality:_.quality,startTime:_.start,index:_.index,bufferedRanges:t,segmentType:_.segmentType,mediaType:K})}}function ae(){return new Promise((function(e,t){var n=oe();if(!n||0===n.length)return se(),void e();ye(n).then((function(){e()})).catch((function(e){t(e)}))}))}function oe(e){var t=[],r=p.getAllBufferRanges();if(!r||0===r.length)return t;if(!e&&0!==e||isNaN(e))t.push({start:r.start(0),end:r.end(r.length-1)+.5});else{var i=function(e,t){var n=z.get().streaming.buffer.bufferToKeep,r=t.start(0);if(e-r>n){var i=Math.max(0,e-n),a=B.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,time:e,threshold:F})[0];if(a&&(i=Math.min(a.startTime,i)),i>0)return{start:r,end:i}}return null}(e,r),a=function(e,t){var r=t.end(t.length-1)+.5,i=Re(e),a=V.manifestInfo.duration>=z.get().streaming.buffer.longFormContentDurationThreshold?z.get().streaming.buffer.bufferTimeAtTopQualityLongForm:z.get().streaming.buffer.bufferTimeAtTopQuality,o=isNaN(i)?e:Math.min(i,e+a);if(o>=t.end(t.length-1))return null;var s=B.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,time:e,threshold:F})[0];if(s&&(o=Math.max(s.startTime+s.duration,o)),z.get().streaming.buffer.avoidCurrentTimeRangePruning)for(var u=0;u<t.length;u++)if(t.start(u)<=e&&e<=t.end(u)&&t.start(u)<=o&&o<=t.end(u)){var l=o;o=u+1<t.length?t.start(u+1):t.end(u)+1,n.debug("Buffered range ["+t.start(u)+", "+t.end(u)+"] overlaps with targetTime "+e+" and range to be pruned ["+l+", "+r+"], using ["+o+", "+r+"] instead"+(o<r?"":" (no actual pruning)"));break}return o<t.end(t.length-1)?{start:o,end:r}:null}(e,r);i&&t.push(i),a&&t.push(a)}return t}function se(){(!D||K===a.Z.TEXT&&Y.isTextEnabled())&&fe()}function ue(){ge()}function le(){ge(),M=NaN}function ce(e,t){if(!p)return null;var n,r,i=p.getAllBufferRanges(),a=0,o=0,s=null,u=null,l=0,c=isNaN(t)?.15:t;if(null!=i){for(r=0,n=i.length;r<n;r++)if(a=i.start(r),o=i.end(r),null===s)l=Math.abs(a-e),(e>=a&&e<o||l<=c)&&(s=a,u=o);else{if(!((l=a-u)<=c))break;u=o}if(null!==s)return{start:s,end:u}}return null}function fe(){if(H){var e=H.getTime()||0;y&&(e=isNaN(M)?0:M);var t=z.get().streaming.gaps.jumpGaps&&!isNaN(z.get().streaming.gaps.smallGapLimit)?z.get().streaming.gaps.smallGapLimit:NaN;i=Math.max(function(e,t){var n;return z.get().streaming.gaps.jumpGaps&&(t=z.get().streaming.gaps.smallGapLimit),null===(n=ce(e,t))?0:n.end-e}(e,t),0),Ne(l.Z.BUFFER_LEVEL_UPDATED,{mediaType:K,bufferLevel:i}),ge()}}function de(){var e=g>=h-1,t=H.getTimeToStreamEnd(V)-i<1e-5;!e&&!t||r||(Ae(!0),n.debug("checkIfBufferingCompleted trigger BUFFERING_COMPLETED for stream id ".concat(V.id," and type ").concat(K)))}function ge(){K!==a.Z.AUDIO&&K!==a.Z.VIDEO||((!H.getLowLatencyModeEnabled()&&i<z.get().streaming.buffer.stallThreshold||0===i)&&!r?he(s.Z.BUFFER_EMPTY):(r||i>=z.get().streaming.buffer.stallThreshold||H.getLowLatencyModeEnabled()&&i>0)&&he(s.Z.BUFFER_LOADED))}function he(e){v===e||e===s.Z.BUFFER_EMPTY&&0===H.getTime()||K===a.Z.TEXT&&!Y.isTextEnabled()||(v=e,Ne(l.Z.BUFFER_LEVEL_STATE_CHANGED,{state:e}),Ne(e===s.Z.BUFFER_LOADED?l.Z.BUFFER_LOADED:l.Z.BUFFER_EMPTY),n.debug(e===s.Z.BUFFER_LOADED?"Got enough buffer to start":"Waiting for more buffer before starting playback"))}function pe(){p&&K!==a.Z.TEXT&&(r||ye(me()))}function me(){var e=[],t=p.getAllBufferRanges();if(!t||0===t.length)return e;var n=H.getTime(),r=Math.max(0,n-z.get().streaming.buffer.bufferToKeep),i=B.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,time:n,threshold:F})[0];if(i)r=Math.min(i.startTime,r);else if(0===n&&H.getIsDynamic())return[];if(t.start(0)<=r){for(var a={start:0,end:r},o=0;o<t.length&&t.end(o)<=r;o++)a.end=t.end(o);a.start<a.end&&e.push(a)}return e}function ye(e){return new Promise((function(t,n){if(e&&p&&0!==e.length){var r=[];e.forEach((function(e){r.push(function(e){return new Promise((function(t,n){e.resolve=t,e.reject=n,N.push(e)}))}(e))})),A||Ee(),Promise.all(r).then((function(){t()})).catch((function(e){n(e)}))}else t()}))}function Ee(){try{if(0===N.length||!p)return n.debug("Nothing to prune, halt pruning"),N=[],void(A=!1);var e=p.getBuffer();if(!e||!e.buffered||0===e.buffered.length)return n.debug("SourceBuffer is empty (or does not exist), halt pruning"),N=[],void(A=!1);var t=N.shift();n.debug("".concat(K,": Removing buffer from: ").concat(t.start," to ").concat(t.end)),A=!0,H.getTime()<t.end&&Ae(!1),p.remove(t).then((function(e){ve(e)})).catch((function(e){ve(e)}))}catch(e){A=!1}}function ve(e){n.debug("onRemoved buffer from:",e.from,"to",e.to),p&&(re(p.getAllBufferRanges()),0===N.length&&(A=!1,fe()),e.unintended&&(n.warn("Detected unintended removal from:",e.from,"to",e.to,"setting streamprocessor time to",e.from),Ne(l.Z.SEEK_TARGET,{time:e.from})),A?Ee():(D?D=!1:fe(),Ne(l.Z.BUFFER_CLEARED,{from:e.from,to:e.to,unintended:e.unintended,hasEnoughSpaceToAppend:we(),quotaExceeded:I})))}function _e(e){return new Promise((function(t){e&&void 0!==e.MSETimeOffset&&p&&p.updateTimestampOffset?p.updateTimestampOffset(e.MSETimeOffset).then((function(){t()})).catch((function(){t()})):t()}))}function Te(){return p&&!r?p.updateAppendWindow(V):Promise.resolve()}function Se(){++b*(z.get().streaming.wallclockTimeUpdateInterval/1e3)>=z.get().streaming.buffer.bufferPruningInterval&&(b=0,pe())}function be(){ge()}function Ae(e){(r=e)?Ne(l.Z.BUFFERING_COMPLETED):h=Number.POSITIVE_INFINITY}function Ie(){try{var e,t,n=p.getAllBufferRanges(),r=0;if(!n)return r;for(t=0,e=n.length;t<e;t++)r+=n.end(t)-n.start(t);return r}catch(e){return 0}}function Re(e){try{var t=e,n=p.getAllBufferRanges();if(!n||0===n.length)return NaN;for(var r=0;t===e&&r<n.length;){var i=n.start(r),a=n.end(r);t>=i&&t<=a&&(t=a),r+=1}return t===e?NaN:t}catch(e){}}function we(){var e=Ie();return isNaN(e)||e<o}function Ne(e,t){var n=t||{};U.trigger(e,n,{streamId:V.id,mediaType:K})}function Ce(e,t){if(o=Number.POSITIVE_INFINITY,v=void 0,h=Number.POSITIVE_INFINITY,g=0,_=null,r=!1,A=!1,I=!1,i=0,b=0,N=[],M=NaN,y=!1,p){var n=p;p=null,e||t||n.abort().then((function(){n.reset(t),n=null}))}D=!1}return t={initialize:function(e){W(e),U.on(l.Z.INIT_FRAGMENT_LOADED,ee,t),U.on(l.Z.MEDIA_FRAGMENT_LOADED,te,t),U.on(l.Z.WALLCLOCK_TIME_UPDATED,Se,t),U.on(d.Z.PLAYBACK_PLAYING,le,t),U.on(d.Z.PLAYBACK_PROGRESS,se,t),U.on(d.Z.PLAYBACK_TIME_UPDATED,se,t),U.on(d.Z.PLAYBACK_RATE_CHANGED,be,t),U.on(d.Z.PLAYBACK_STALLED,ue,t)},getStreamId:function(){return V.id},getType:function(){return K},getBufferControllerType:function(){return k},createBufferSink:Q,dischargePreBuffer:function(){if(p&&m&&"function"==typeof m.discharge){var e=m.getAllBufferRanges();if(e.length>0){for(var t="Beginning "+K+"PreBuffer discharge, adding buffer for:",r=0;r<e.length;r++)t+=" start: "+e.start(r)+", end: "+e.end(r)+";";n.debug(t)}else n.debug("PreBuffer discharge requested, but there were no media segments in the PreBuffer.");E=[];for(var i=m.discharge(),a=null,o=0;o<i.length;o++){var s=i[o];if(s.segmentType!==C.w.INIT_SEGMENT_TYPE){var u=R.extract(s.streamId,s.representationId);u&&a!==u&&(E.push(u),p.append(u),a=u)}E.push(s),p.append(s)}m.reset(),m=null}},getBuffer:function(){return p},getBufferLevel:function(){return i},getRangeAt:ce,hasBufferAtTime:function(e){try{var t=p.getAllBufferRanges();if(!t||0===t.length)return!1;for(var r=0;r<t.length;){var i=t.start(r),a=t.end(r);if(e>=i&&e<=a)return!0;r+=1}return!1}catch(e){return n.error(e),!1}},pruneBuffer:pe,setMediaSource:W,getMediaSource:function(){return c},appendInitSegmentFromCache:function(e){var t=R.extract(V.id,e);return!!t&&(n.info("Append Init fragment",K," with representationId:",t.representationId," and quality:",t.quality,", data size:",t.bytes.byteLength),ne(t),!0)},getIsBufferingCompleted:function(){return r},setIsBufferingCompleted:Ae,getIsPruningInProgress:function(){return A},reset:function(e,t){U.off(l.Z.INIT_FRAGMENT_LOADED,ee,this),U.off(l.Z.MEDIA_FRAGMENT_LOADED,te,this),U.off(l.Z.WALLCLOCK_TIME_UPDATED,Se,this),U.off(d.Z.PLAYBACK_PLAYING,le,this),U.off(d.Z.PLAYBACK_PROGRESS,se,this),U.off(d.Z.PLAYBACK_TIME_UPDATED,se,this),U.off(d.Z.PLAYBACK_RATE_CHANGED,be,this),U.off(d.Z.PLAYBACK_STALLED,ue,this),Ce(e,t)},prepareForPlaybackSeek:function(){return r&&Ae(!1),p.abort()},prepareForReplacementTrackSwitch:function(e){return new Promise((function(t,n){p.abort().then((function(){return Te()})).then((function(){return z.get().streaming.buffer.useChangeTypeForTrackSwitch?p.changeType(e):Promise.resolve()})).then((function(){return ae()})).then((function(){Ae(!1),t()})).catch((function(e){n(e)}))}))},prepareForNonReplacementTrackSwitch:function(e){return new Promise((function(t,n){Te().then((function(){return z.get().streaming.buffer.useChangeTypeForTrackSwitch?p.changeType(e):Promise.resolve()})).then((function(){t()})).catch((function(e){n(e)}))}))},prepareForForceReplacementQualitySwitch:function(e){return new Promise((function(t,n){p.abort().then((function(){return Te()})).then((function(){return ae()})).then((function(){return _e(e)})).then((function(){Ae(!1),t()})).catch((function(e){n(e)}))}))},updateAppendWindow:Te,getAllRangesWithSafetyFactor:oe,getContinuousBufferTimeForTargetTime:Re,clearBuffers:ye,pruneAllSafely:ae,updateBufferTimestampOffset:_e,setSeekTarget:function(e){M=e},segmentRequestingCompleted:function(e){isNaN(e)||(h=e,de())}},n=(0,f.Z)(L).getInstance().getLogger(t),R=x(L).getInstance(),Ce(),t}U.__dashjs_factory_name=k;var Z=c.Z.getClassFactory(U),B="NotFragmentedTextBufferController";function G(e){e=e||{};var t,n,r,i,a,o,s=this.context,c=(0,u.Z)(s).getInstance(),f=e.textController,d=e.errHandler,g=e.streamInfo,h=e.type;function p(e){i=e}function m(e){var t,r;n!==e&&(n=e)&&(t=l.Z.BUFFERING_COMPLETED,r={},c.trigger(t,r,{streamId:g.id,mediaType:h}))}function y(e){e.chunk.bytes&&!n&&(o.save(e.chunk),a.append(e.chunk),m(!0))}return t={initialize:function(e){p(e)},getStreamId:function(){return g.id},getType:function(){return h},getBufferControllerType:function(){return B},createBufferSink:function(e){return new Promise((function(t,n){try{(a=O(s).create({mediaSource:i,textController:f,eventBus:c})).initializeForFirstUse(g,e),r||(a.getBuffer()&&"function"==typeof a.getBuffer().initialize&&a.getBuffer().initialize(),r=!0),t(a)}catch(e){d.error(new S.Z(w.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,w.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+h)),n(e)}}))},dischargePreBuffer:function(){},getBuffer:function(){return a},getBufferLevel:function(){return 0},getRangeAt:function(){return null},pruneBuffer:function(){},hasBufferAtTime:function(){return!0},getAllRangesWithSafetyFactor:function(){return[]},getContinuousBufferTimeForTargetTime:function(){return Number.POSITIVE_INFINITY},setMediaSource:p,getMediaSource:function(){return i},appendInitSegmentFromCache:function(e){return null!==o.extract(g.id,e)},getIsBufferingCompleted:function(){return n},setIsBufferingCompleted:m,getIsPruningInProgress:function(){return!1},reset:function(e){c.off(l.Z.INIT_FRAGMENT_LOADED,y,t),!e&&a&&(a.abort(),a.reset(),a=null)},clearBuffers:function(){return Promise.resolve()},prepareForPlaybackSeek:function(){return Promise.resolve()},prepareForReplacementTrackSwitch:function(){return n=!1,Promise.resolve()},setSeekTarget:function(){},updateAppendWindow:function(){return Promise.resolve()},pruneAllSafely:function(){return Promise.resolve()},updateBufferTimestampOffset:function(){return Promise.resolve()},segmentRequestingCompleted:function(){}},r=!1,i=null,n=!1,o=x(s).getInstance(),c.on(l.Z.INIT_FRAGMENT_LOADED,y,t),t}G.__dashjs_factory_name=B;var q=c.Z.getClassFactory(G);function Y(e){e=e||{};var t,n,r,i,o,c,g,h,p,m,y,E,v,_=this.context,S=(0,u.Z)(_).getInstance(),b=e.dashMetrics,A=e.mediaPlayerModel,I=e.fragmentModel,R=e.abrController,w=e.playbackController,N=e.textController,C=e.type,D=e.bufferController,O=e.representationController,M=e.settings;function P(){E=!0}function L(){E=!1}function x(e){if(!D.getIsBufferingCompleted()){F();var t=isNaN(e)?0:e;o=setTimeout(k,t)}}function F(){o&&(clearTimeout(o),o=null)}function k(){try{if(function(){try{return C===a.Z.TEXT&&!N.isTextEnabled()||w.isPaused()&&(!w.getStreamController().getInitialPlayback()||!w.getStreamController().getAutoPlay())&&!M.get().streaming.scheduling.scheduleWhilePaused}catch(e){return!1}}())return void F();if(function(){try{return!!E&&O.getCurrentRepresentationInfo()&&(isNaN(p)||m||(e=n.id,t=R.getMaxAllowedIndexFor(C,e),!(!isNaN(h)&&h==t||(r.info("Top quality "+C+" index has changed from "+h+" to "+t),h=t,0)))||function(){var e=O.getCurrentRepresentationInfo();return!C||!e||b.getCurrentBufferLevel(C)<U()}())}catch(e){return!1}var e,t}()){var e=!1;v&&(e=R.checkPlaybackQuality(C,n.id)),e||(i=O.getCurrentRepresentationInfo(),y||i.quality!==p||m?(m?(r.debug("Switch track for "+C+", representation id = "+i.id),m=!1):r.debug("Quality has changed, get init request for representationid = "+i.id),S.trigger(l.Z.INIT_FRAGMENT_NEEDED,{representationId:i.id,sender:t},{streamId:n.id,mediaType:C}),v=!1,y=!1):(r.debug("Media segment needed for ".concat(C," and stream id ").concat(n.id)),S.trigger(l.Z.MEDIA_FRAGMENT_NEEDED,{},{streamId:n.id,mediaType:C}),v=!0))}else x(w.getLowLatencyModeEnabled()?M.get().streaming.scheduling.lowLatencyTimeout:M.get().streaming.scheduling.defaultTimeout)}catch(e){x(w.getLowLatencyModeEnabled()?M.get().streaming.scheduling.lowLatencyTimeout:M.get().streaming.scheduling.defaultTimeout)}var i}function U(){var e=NaN,t=O.getCurrentRepresentationInfo();return C&&t?(e=C===a.Z.TEXT?function(){try{if(N.isTextEnabled()){var e=O.getCurrentRepresentationInfo();if(isNaN(e.fragmentDuration)){var t=b.getCurrentSchedulingInfo(s.Z.SCHEDULING_INFO);return t?t.duration:0}return e.fragmentDuration}return 0}catch(e){return 0}}():C===a.Z.AUDIO&&c?function(){try{var e=b.getCurrentBufferLevel(a.Z.VIDEO),t=O.getCurrentRepresentationInfo();return isNaN(t.fragmentDuration)?e+1:Math.max(e+1,t.fragmentDuration)}catch(e){return 0}}():function(){try{var e=O.getCurrentRepresentationInfo().mediaInfo.streamInfo;return R.isPlayingAtTopQuality(e)?e.manifestInfo.duration>=M.get().streaming.buffer.longFormContentDurationThreshold?M.get().streaming.buffer.bufferTimeAtTopQualityLongForm:M.get().streaming.buffer.bufferTimeAtTopQuality:A.getStableBufferTime()}catch(e){return A.getStableBufferTime()}}(),e):e}function Z(){B(!0)}function B(e){if(w&&I){var t=I.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,time:w.getTime(),threshold:0})[0];t&&w.getTime()>=t.startTime&&((!g.mediaInfo||t.mediaInfo.type===g.mediaInfo.type&&t.mediaInfo.index!==g.mediaInfo.index)&&e&&S.trigger(l.Z.TRACK_CHANGE_RENDERED,{mediaType:C,oldMediaInfo:g.mediaInfo,newMediaInfo:t.mediaInfo,streamId:n.id}),t.quality===g.quality&&t.adaptationIndex===g.adaptationIndex||!e||(r.debug("Quality change rendered for streamId ".concat(n.id," and type ").concat(C)),S.trigger(l.Z.QUALITY_CHANGE_RENDERED,{mediaType:C,oldQuality:g.quality,newQuality:t.quality,streamId:n.id})),g={mediaInfo:t.mediaInfo,quality:t.quality,adaptationIndex:t.adaptationIndex})}}function G(){I.abortRequests(),F()}function q(){M.get().streaming.scheduling.scheduleWhilePaused||x()}function Y(e){b.updatePlayListTraceMetrics({playbackspeed:e.playbackRate.toString()})}function j(){v=!0,i=0,p=NaN,g={mediaInfo:void 0,quality:NaN,adaptationIndex:NaN},h=NaN,m=!1,y=!1,E=!0}return t={initialize:function(e){c=e,S.on(l.Z.URL_RESOLUTION_FAILED,G,t),S.on(d.Z.PLAYBACK_STARTED,q,t),S.on(d.Z.PLAYBACK_RATE_CHANGED,Y,t),S.on(d.Z.PLAYBACK_TIME_UPDATED,Z,t),S.on(d.Z.MANAGED_MEDIA_SOURCE_START_STREAMING,P,t),S.on(d.Z.MANAGED_MEDIA_SOURCE_END_STREAMING,L,t)},getType:function(){return C},getStreamId:function(){return n.id},setTimeToLoadDelay:function(e){i=e},getTimeToLoadDelay:function(){return i},setSwitchTrack:function(e){m=e},getSwitchTrack:function(){return m},startScheduleTimer:x,clearScheduleTimer:F,reset:function(){S.off(l.Z.URL_RESOLUTION_FAILED,G,t),S.off(d.Z.PLAYBACK_STARTED,q,t),S.off(d.Z.PLAYBACK_RATE_CHANGED,Y,t),S.off(d.Z.PLAYBACK_TIME_UPDATED,Z,t),S.off(d.Z.MANAGED_MEDIA_SOURCE_START_STREAMING,P,t),S.off(d.Z.MANAGED_MEDIA_SOURCE_END_STREAMING,L,t),F(),B(!1),j(),n=null},getBufferTarget:U,getPlaybackController:function(){return w},setCheckPlaybackQuality:function(e){v=e},setInitSegmentRequired:function(e){y=e},setLastInitializedQuality:function(e){p=e}},r=(0,f.Z)(_).getInstance().getLogger(t),j(),n=e.streamInfo,t}Y.__dashjs_factory_name="ScheduleController";var j=c.Z.getClassFactory(Y),H=n(7387);function V(e){var t,n,r,i,o,s,u=(e=e||{}).eventBus,l=e.events,c=e.abrController,f=e.dashMetrics,g=e.playbackController,h=e.timelineConverter,p=e.type,m=e.streamInfo,y=e.dashConstants,E=e.segmentsController,v=e.isDynamic,_=e.adapter;function T(){return p}function S(){return r}function b(){return s}function A(){n=null,r=!0,i=[],o=null}function I(e){return new Promise((function(t,n){var r=e.hasInitialization(),a=e.hasSegments(),o=[];o.push(E.updateInitData(e,r)),o.push(E.updateSegmentData(e,a)),Promise.all(o).then((function(n){var r;n[0]&&!n[0].error&&(e=function(e,t){return t&&!t.error&&t.representation?t.representation:e}(e,n[0])),n[1]&&!n[1].error&&(e=function(e,t){if(t&&!t.error){var n,r,i,a,o=t.segments,s=[],u=0;for(n=0,r=o?o.length:0;n<r;n++)i=o[n],(a=(0,H.TJ)(h,v,e,i.startTime,i.duration,i.timescale,i.media,i.mediaRange,u))&&(s.push(a),a=null,u++);return s.length>0&&(e.segments=s),e}}(e,n[1])),(r=e).mediaFinishedInformation=E.getMediaFinishedInformation(r),function(e){if(S()){var t,n,r=f.getCurrentManifestUpdate(),a=!1;if(r){for(var o=0;o<r.representationInfo.length;o++)if((t=r.representationInfo[o]).index===e.index&&t.mediaType===T()){a=!0;break}a||f.addManifestUpdateRepresentationInfo(e,T())}if(function(){for(var e=0,t=i.length;e<t;e++){var n=i[e].segmentInfoType;if(!i[e].hasInitialization()||(n===y.SEGMENT_BASE||n===y.BASE_URL)&&!i[e].segments)return!1}return!0}()){c.setPlaybackQuality(p,m,(n=s,i.indexOf(n)));var u=f.getCurrentDVRInfo(p);u&&f.updateManifestUpdateInfo({latency:u.range.end-g.getTime()}),f.getCurrentRepresentationSwitch(b().adaptation.type)||R(),N()}}}(e),t()})).catch((function(e){n(e)}))}))}function R(){!function(){if(!(c&&f&&g&&h))throw new Error(a.Z.MISSING_CONFIG_ERROR)}();var e=new Date,t=b(),n=1e3*g.getTime();t&&f.addRepresentationSwitch(t.adaptation.type,e,n,t.id),u.trigger(d.Z.REPRESENTATION_SWITCH,{mediaType:p,streamId:m.id,currentRepresentation:t,numberOfRepresentations:i.length},{streamId:m.id,mediaType:p})}function w(e){return null==e||e>=i.length?null:i[e]}function N(e){r=!1,u.trigger(l.DATA_UPDATE_COMPLETED,{data:n,currentRepresentation:s,error:e},{streamId:m.id,mediaType:p})}function C(e){s=e,o=_.convertRepresentationToRepresentationInfo(s)}function D(e){if(e.newDuration){var t=b();t&&t.adaptation.period&&(t.adaptation.period.duration=e.newDuration)}}return t={getStreamId:function(){return m.id},getType:T,getData:function(){return n},isUpdating:S,updateData:function(e,t,o,s,u){return new Promise((function(l,c){if(r=!0,i=t,n=e,C(w(u)),o!==a.Z.VIDEO&&o!==a.Z.AUDIO&&(o!==a.Z.TEXT||!s))return N(),void l();for(var f=[],d=0,g=i.length;d<g;d++){var h=i[d];f.push(I(h))}Promise.all(f).then((function(){C(w(u)),l()})).catch((function(e){c(e)}))}))},getCurrentRepresentation:b,getCurrentRepresentationInfo:function(){return o},getRepresentationForQuality:w,prepareQualityChange:function(e){C(w(e)),R()},reset:function(){u.off(d.Z.MANIFEST_VALIDITY_CHANGED,D,t),A()}},A(),u.on(d.Z.MANIFEST_VALIDITY_CHANGED,D,t),t}V.__dashjs_factory_name="RepresentationController";var K=c.Z.getClassFactory(V),z=n(3106),W=n(9326),X=n(7473),Q=n(2594);function J(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var $=function e(){J(this,e),this.start=null,this.mstart=null,this.starttype=null,this.trace=[]};$.INITIAL_PLAYOUT_START_REASON="initial_playout",$.SEEK_START_REASON="seek",$.RESUME_FROM_PAUSE_START_REASON="resume",$.METRICS_COLLECTION_START_REASON="metrics_collection_start";var ee=function e(){J(this,e),this.representationid=null,this.subreplevel=null,this.start=null,this.mstart=null,this.duration=null,this.playbackspeed=null,this.stopreason=null};ee.REPRESENTATION_SWITCH_STOP_REASON="representation_switch",ee.REBUFFERING_REASON="rebuffering",ee.USER_REQUEST_STOP_REASON="user_request",ee.END_OF_PERIOD_STOP_REASON="end_of_period",ee.END_OF_CONTENT_STOP_REASON="end_of_content",ee.METRICS_COLLECTION_STOP_REASON="metrics_collection_end",ee.FAILURE_STOP_REASON="failure";var te=n(7802);function ne(){return{ntpToUTC:function(e){var t=new Date(Date.UTC(1900,0,1,0,0,0));return new Date(t.getTime()+e).getTime()}}}ne.__dashjs_factory_name="TimeUtils";var re=c.Z.getSingletonFactory(ne);function ie(e){e=e||{};var t,n,r,i,c,g,h,p,m,y,E,v,_,b,A,I=this.context,R=(0,u.Z)(I).getInstance(),N=e.streamInfo,D=e.type,O=e.errHandler,M=e.mimeType,P=e.timelineConverter,L=e.adapter,x=e.manifestModel,F=e.mediaPlayerModel,k=e.fragmentModel,U=e.abrController,B=e.playbackController,G=e.mediaController,Y=e.textController,H=e.dashMetrics,V=e.settings,J=e.boxParser,$=e.segmentBlacklistController;function ne(){return N.id}function ie(){return D}function ae(){return L.getIsTextTrack(p.getData())}function oe(){c=[],i=null,b=0,m=!1,y=!1,E=!1,A=null}function se(e){return!isNaN(e)&&!isNaN(N.duration)&&isFinite(N.duration)&&e>=N.start+N.duration}function ue(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(e.sender)if(B.getIsManifestUpdateInProgress())ge();else if((!ae()||Y.isTextEnabled())&&g&&e.representationId&&!g.appendInitSegmentFromCache(e.representationId)){var n=p.getCurrentRepresentation();if(0===n.range)return void le();var r=v?v.getInitRequest(i,n):null;r?k.executeRequest(r):t&&(h.setInitSegmentRequired(!0),ge())}}function le(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(B.getIsManifestUpdateInProgress()||g.getIsPruningInProgress())ge();else{var n=de();n?(m=!1,y=!1,ce(n)):fe(t)}}function ce(e){isNaN(e.startTime+e.duration)||(b=e.startTime+e.duration),e.delayLoadingTime=(new Date).getTime()+h.getTimeToLoadDelay(),h.setTimeToLoadDelay(0),function(e){var t=e.url;return e.range&&(t=t.concat("_",e.range)),$.contains(t)}(e)?(n.warn("Fragment request url ".concat(e.url," for stream id ").concat(N.id," and media type ").concat(D," is on the ignore list and will be skipped")),ge()):(n.debug("Next fragment request url for stream id ".concat(N.id," and media type ").concat(D," is ").concat(e.url)),k.executeRequest(e))}function fe(e){var t,a=p.getCurrentRepresentation();if(!V.get().streaming.gaps.enableSeekFix||!m&&0!==B.getTime()||(r?r&&a.segmentInfoType===o.Z.SEGMENT_TIMELINE&&(t=v.getValidTimeAheadOfTargetTime(b,i,a,V.get().streaming.gaps.threshold)):t=v.getValidTimeAheadOfTargetTime(b,i,a,V.get().streaming.gaps.threshold),isNaN(t)||t===b)){if(v.isLastSegmentRequested(a,b)){var s=v.getCurrentIndex();return n.debug("Segment requesting for stream ".concat(N.id," has finished")),R.trigger(l.Z.STREAM_REQUESTING_COMPLETED,{segmentIndex:s},{streamId:N.id,mediaType:D}),g.segmentRequestingCompleted(s),void h.clearScheduleTimer()}e&&ge()}else B.isSeeking()||0===B.getTime()?(n.warn("Adjusting playback time ".concat(t," because of gap in the manifest. Seeking by ").concat(t-b)),B.seek(t,!1,!1)):(n.warn("Adjusting buffering time ".concat(t," because of gap in the manifest. Adjusting time by ").concat(t-b)),xe(t),e&&ge())}function de(){var e,t=Ne();if(isNaN(b)||ie()===a.Z.TEXT&&!Y.isTextEnabled())return null;if(v){var n=p&&t?p.getRepresentationForQuality(t.quality):null;e=m?v.getSegmentRequestForTime(i,n,b):y?v.repeatSegmentRequest(i,n):v.getNextSegmentRequest(i,n)}return e}function ge(){h.startScheduleTimer(B.getLowLatencyModeEnabled()?V.get().streaming.scheduling.lowLatencyTimeout:V.get().streaming.scheduling.defaultTimeout)}function he(e){e.error||g.getIsBufferingCompleted()||g.updateBufferTimestampOffset(e.currentRepresentation)}function pe(e){H.addBufferState(D,e.state,h.getBufferTarget()),e.state!==s.Z.BUFFER_EMPTY||B.isSeeking()||(n.info("Buffer is empty! Stalling!"),H.pushPlayListTraceMetrics(new Date,ee.REBUFFERING_REASON))}function me(e){k.syncExecutedRequestsWithBufferedRange(g.getBuffer().getAllBufferRanges(),N.duration),e.quotaExceeded&&e.from>B.getTime()&&xe(e.from),e.hasEnoughSpaceToAppend&&e.quotaExceeded&&h.startScheduleTimer()}function ye(e){if(e&&e.lastRequestAppended&&e.lastRequestAppended.url){var t=e.lastRequestAppended.url;e.lastRequestAppended.range&&(t=t.concat("_",e.lastRequestAppended.range)),n.warn("Blacklisting segment with url ".concat(t)),$.add(t)}}function Ee(e){if(n.debug("Appended bytes for ".concat(e.mediaType," and stream id ").concat(e.streamId)),e.segmentType===C.w.INIT_SEGMENT_TYPE){var t=e.quality;h.setLastInitializedQuality(t),n.info("["+D+"] lastInitializedRepresentationInfo changed to "+e.quality)}A?ve(A):h.startScheduleTimer(0)}function ve(e){var t=k.getRequests({state:T.FRAGMENT_MODEL_LOADING});if(t&&t.length>0)return n.debug("Preparing for default quality switch: Waiting for ongoing segment request to be finished before applying switch."),void(A=e);g.updateBufferTimestampOffset(e).then((function(){h.setCheckPlaybackQuality(!1),i.segmentAlignment||i.subSegmentAlignment?h.startScheduleTimer():Pe(),A=null,E=!1})).catch((function(){A=null,E=!1}))}function _e(e){n.info("onFragmentLoadingAbandoned request: "+e.request.url+" has been aborted"),B.isSeeking()||h.getSwitchTrack()||E||(n.info("onFragmentLoadingAbandoned request: "+e.request.url+" has to be downloaded again, origin is not seeking process or switch track call"),e.request&&e.request.isInitializationRequest()?h.setInitSegmentRequired(!0):xe(e.request.startTime+e.request.duration/2),h.startScheduleTimer(0))}function Te(e){n.info("OnFragmentLoadingCompleted for stream id "+N.id+" and media type "+D+" - Url:",e.request?e.request.url:"undefined",e.request.range?", Range:"+e.request.range:""),ae()&&h.startScheduleTimer(0),e.error&&e.request.serviceLocation&&function(e){n.info("Fragment loading completed with an error"),e&&e.request&&e.request.type&&(e.request.type===C.w.INIT_SEGMENT_TYPE?ue({representationId:e.request.representationId,sender:{}},!1):e.request.type===C.w.MEDIA_SEGMENT_TYPE&&(xe(e.request.startTime+e.request.duration/2),le({},!1)))}(e)}function Se(){xe(B.getTime()),we().startScheduleTimer()}function be(e){var t=e.currentTrackInfo;if(t){var n=c.find((function(e){return e.index===t.index&&e.lang===t.lang}));n&&Re(n).then((function(){g.setIsBufferingCompleted(!1),xe(B.getTime()),h.setInitSegmentRequired(!0),h.startScheduleTimer()}))}}function Ae(e){xe(e.quotaExceededTime),h.clearScheduleTimer()}function Ie(){return g?g.getBuffer():null}function Re(e){e===i||e&&i&&e.type!==i.type||(i=e);var t=L.getRealAdaptation(N,i),n=L.getVoRepresentations(i);if(p){var o,s=p.getData(),u=U.getMaxAllowedIndexFor(D,N.id),l=U.getMinAllowedIndexFor(D,N.id),c=null;return null!==s&&s.id===t.id||D===a.Z.TEXT?o=U.getQualityFor(D,N.id):(c=U.getThroughputHistory().getAverageThroughput(D,r)||U.getInitialBitrateFor(D,N.id),o=U.getQualityForBitrate(i,c,N.id)),void 0!==l&&o<l&&(o=l),o>u&&(o=u),p.updateData(t,n,D,i.isFragmented,o)}return Promise.resolve()}function we(){return h}function Ne(e){var t;return void 0!==e?((0,z.SE)(e),t=p?p.getRepresentationForQuality(e):null):t=p?p.getCurrentRepresentation():null,L.convertRepresentationToRepresentationInfo(t)}function Ce(){return!!g&&g.getIsBufferingCompleted()}function De(e){if(V.get().streaming.enableManifestTimescaleMismatchFix){var t=e.chunk,n=t.bytes,r=Ne(t.quality),i=p&&r?p.getRepresentationForQuality(r.quality):null;r&&i&&(i.timescale=J.getMediaTimescaleFromMoov(n))}}function Oe(e){var t=e.chunk,n=t.bytes,r=t.quality,i=Ne(r),a=p&&i?p.getRepresentationForQuality(i.quality):null;if(i&&a){var s;if(V.get().streaming.parseInbandPrft&&e.request.type===C.w.MEDIA_SEGMENT_TYPE){var u=function(e,t){var n=e.getBoxes("prft"),r=[];return n.forEach((function(e){r.push(function(e,t){var n="unknown";switch(e.flags){case 0:n=o.Z.PRODUCER_REFERENCE_TIME_TYPE.ENCODER;break;case 16:n=o.Z.PRODUCER_REFERENCE_TIME_TYPE.APPLICATION;break;case 24:n=o.Z.PRODUCER_REFERENCE_TIME_TYPE.CAPTURED}var r=1e3*e.ntp_timestamp_sec+e.ntp_timestamp_frac/Math.pow(2,32)*1e3;return{type:n,ntpTimestamp:r=re(I).getInstance().ntpToUTC(r),mediaTime:e.media_time/t}}(e,t))})),r}(s=s||J.parse(n),a.timescale);u&&u.length&&R.trigger(d.Z.INBAND_PRFT,{data:u},{streamId:N.id,mediaType:D})}var c=L.getEventsFor(i.mediaInfo,null,N),f=L.getEventsFor(i,a,N);if(c&&c.length>0||f&&f.length>0){var g=k.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,quality:r,index:t.index})[0],h=function(e,t,n,r){try{for(var i={},a=[],o=n.concat(r),s=0,u=o.length;s<u;s++)i[o[s].schemeIdUri+"/"+o[s].value]=o[s];var l=e.getBoxes("emsg");if(!l||0===l.length)return a;for(var c=e.getBox("sidx"),f=!c||isNaN(c.earliest_presentation_time)||isNaN(c.timescale)?t&&!isNaN(t.mediaStartTime)?t.mediaStartTime:0:c.earliest_presentation_time/c.timescale,d=Math.max(f,0),g=p.getCurrentRepresentation(),h=0,m=l.length;h<m;h++){var y=L.getEvent(l[h],i,d,g);y&&a.push(y)}return a}catch(e){return[]}}(s=s||J.parse(n),g,c,f);R.trigger(l.Z.INBAND_EVENTS,{events:h},{streamId:N.id})}}}function Me(){var e=B.getTime();V.get().streaming.buffer.flushBufferAtTrackSwitch&&B.seek(e+.001,!1,!0),xe(e),g.setSeekTarget(e),h.startScheduleTimer()}function Pe(){var e=B.getTime(),t=g.getContinuousBufferTimeForTargetTime(e);xe(isNaN(t)?e:t),h.startScheduleTimer()}function Le(e){e&&!isNaN(e.time)&&(xe(e.time),g.setSeekTarget(e.time))}function xe(e){b=e,m=!0}return t={initialize:function(n,i,s){_=(0,te.Z)(I).create({events:l.Z,eventBus:R,streamInfo:N,timelineConverter:P,dashConstants:o.Z,segmentBaseController:e.segmentBaseController,type:D}),v=(0,W.Z)(I).create({streamInfo:N,type:D,timelineConverter:P,dashMetrics:H,mediaPlayerModel:F,baseURLController:e.baseURLController,errHandler:O,segmentsController:_,settings:V,boxParser:J,events:l.Z,eventBus:R,errors:w,debug:(0,f.Z)(I).getInstance(),requestModifier:(0,X.Z)(I).getInstance(),dashConstants:o.Z,constants:a.Z,urlUtils:(0,Q.Z)(I).getInstance()}),r=N.manifestInfo.isDynamic,v.initialize(r),U.registerStreamType(D,t),p=K(I).create({streamInfo:N,type:D,abrController:U,dashMetrics:H,playbackController:B,timelineConverter:P,dashConstants:o.Z,events:l.Z,eventBus:R,errors:w,isDynamic:r,adapter:L,segmentsController:_}),g=function(e,t){return e?e!==a.Z.TEXT||t?Z(I).create({streamInfo:N,type:e,mediaPlayerModel:F,manifestModel:x,fragmentModel:k,errHandler:O,mediaController:G,representationController:p,adapter:L,textController:Y,abrController:U,playbackController:B,settings:V}):q(I).create({streamInfo:N,type:e,mimeType:M,fragmentModel:k,textController:Y,errHandler:O,settings:V}):(O.error(new S.Z(w.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,w.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+"not properly defined")),null)}(D,s),g&&g.initialize(n),(h=j(I).create({streamInfo:N,type:D,mimeType:M,adapter:L,dashMetrics:H,mediaPlayerModel:F,fragmentModel:k,abrController:U,playbackController:B,textController:Y,mediaController:G,bufferController:g,representationController:p,settings:V})).initialize(i),b=0,m=!1,y=!1},getStreamId:ne,getType:ie,isUpdating:function(){return!!p&&p.isUpdating()},getBufferController:function(){return g},dischargePreBuffer:function(){g.dischargePreBuffer()},getFragmentModel:function(){return k},getScheduleController:we,getRepresentationController:function(){return p},getRepresentationInfo:Ne,getBufferLevel:function(){return g?g.getBufferLevel():0},isBufferingCompleted:Ce,createBufferSinks:function(e){var t=Ie();return t?Promise.resolve(t):g?g.createBufferSink(i,e):Promise.resolve(null)},updateStreamInfo:function(e){return N=e,Ce()?Promise.resolve():g.updateAppendWindow()},getStreamInfo:function(){return N},selectMediaInfo:Re,clearMediaInfoArray:function(){c=[]},addMediaInfo:function(e){-1===c.indexOf(e)&&c.push(e)},prepareTrackSwitch:function(){return new Promise((function(e){n.debug("Preparing track switch for type ".concat(D));var t=D===a.Z.TEXT||V.get().streaming.trackSwitchMode[D]===a.Z.TRACK_SWITCH_MODE_ALWAYS_REPLACE&&B.getTimeToStreamEnd(N)>V.get().streaming.buffer.stallThreshold;if(g.getIsBufferingCompleted()&&!t)return g.prepareForNonReplacementTrackSwitch(i.codec).then((function(){R.trigger(l.Z.BUFFERING_COMPLETED,{},{streamId:N.id,mediaType:D})})).catch((function(){R.trigger(l.Z.BUFFERING_COMPLETED,{},{streamId:N.id,mediaType:D})})),void e();h.clearScheduleTimer(),h.setSwitchTrack(!0),t?(R.trigger(l.Z.BUFFER_REPLACEMENT_STARTED,{mediaType:D,streamId:N.id},{mediaType:D,streamId:N.id}),k.abortRequests(),g.prepareForReplacementTrackSwitch(i.codec).then((function(){var e=Ne();return g.updateBufferTimestampOffset(e)})).then((function(){Me(),e()})).catch((function(){Me(),e()}))):g.prepareForNonReplacementTrackSwitch(i.codec).then((function(){Pe(),e()})).catch((function(){Pe(),e()}))}))},prepareQualityChange:function(e){A&&n.warning("Canceling queued representation switch to ".concat(A.quality," for ").concat(D)),n.debug("Preparing quality switch for type ".concat(D));var t=e.newQuality;E=!0,h.clearScheduleTimer(),p.prepareQualityChange(t);var r=Ne(t);e.reason&&e.reason.forceReplace?function(e){k.abortRequests(),R.trigger(l.Z.BUFFER_REPLACEMENT_STARTED,{mediaType:D,streamId:N.id},{mediaType:D,streamId:N.id}),h.setCheckPlaybackQuality(!1),g.prepareForForceReplacementQualitySwitch(e).then((function(){Me(),A=null,E=!1})).catch((function(){Me(),A=null,E=!1}))}(r):e&&e.reason&&e.reason.forceAbandon?function(e){g.updateBufferTimestampOffset(e).then((function(){k.abortRequests(),y=!0,h.setCheckPlaybackQuality(!1),h.startScheduleTimer(),E=!1,A=null})).catch((function(){A=null,E=!1}))}(r):V.get().streaming.buffer.fastSwitchEnabled?function(e){var t=B.getTime(),n=1.5*(isNaN(e.fragmentDuration)?1:e.fragmentDuration),r=k.getRequests({state:T.FRAGMENT_MODEL_EXECUTED,time:t+n,threshold:0})[0];if(r&&!ae()){var i=g.getBufferLevel(),a=U.getAbandonmentStateFor(N.id,D);r.quality<e.quality&&i>=n&&a!==s.Z.ABANDON_LOAD?g.updateBufferTimestampOffset(e).then((function(){k.abortRequests(),xe(t+n),h.setCheckPlaybackQuality(!1),h.startScheduleTimer(),E=!1})).catch((function(){E=!1})):ve(e)}else ve(e)}(r):ve(r),H.pushPlayListTraceMetrics(new Date,ee.REPRESENTATION_SWITCH_STOP_REASON),H.createPlaylistTraceMetrics(r.id,1e3*B.getTime(),B.getPlaybackRate())},getMediaInfo:function(){return i},getMediaSource:function(){return g.getMediaSource()},setMediaSource:function(e){return g.setMediaSource(e,i)},getBuffer:Ie,setExplicitBufferingTime:xe,finalisePlayList:function(e,t){H.pushPlayListTraceMetrics(e,t)},probeNextRequest:function(){var e=Ne(),t=p&&e?p.getRepresentationForQuality(e.quality):null;return v.getNextSegmentRequestIdempotent(i,t)},prepareInnerPeriodPlaybackSeeking:function(e){return new Promise((function(t){if(g.hasBufferAtTime(e.seekTime))return g.pruneBuffer(),se(g.getContinuousBufferTimeForTargetTime(e.seekTime))&&g.setIsBufferingCompleted(!0),void t();h.clearScheduleTimer(),k.abortRequests(),g.prepareForPlaybackSeek().then((function(){var t=g.getAllRangesWithSafetyFactor(e.seekTime);return g.clearBuffers(t)})).then((function(){var n=g.getContinuousBufferTimeForTargetTime(e.seekTime);if(se(n))g.setIsBufferingCompleted(!0),t();else{var r=isNaN(n)?e.seekTime:n;xe(r),g.setSeekTarget(r);var i=[];i.push(g.updateAppendWindow());var a=Ne();i.push(g.updateBufferTimestampOffset(a)),Promise.all(i).then((function(){h.setInitSegmentRequired(!0),h.setCheckPlaybackQuality(!1),h.startScheduleTimer(),t()}))}})).catch((function(e){n.error(e)}))}))},prepareOuterPeriodPlaybackSeeking:function(){return new Promise((function(e,t){try{h.clearScheduleTimer(),k.abortRequests(),g.prepareForPlaybackSeek().then((function(){return g.pruneAllSafely()})).then((function(){e()}))}catch(e){t(e)}}))},reset:function(e,n){v&&v.reset(),g&&(g.reset(e,n),g=null),h&&(h.reset(),h=null),p&&(p.reset(),p=null),_&&(_=null),U&&U.unRegisterStreamType(ne(),D),R.off(l.Z.DATA_UPDATE_COMPLETED,he,t),R.off(l.Z.INIT_FRAGMENT_NEEDED,ue,t),R.off(l.Z.MEDIA_FRAGMENT_NEEDED,le,t),R.off(l.Z.INIT_FRAGMENT_LOADED,De,t),R.off(l.Z.MEDIA_FRAGMENT_LOADED,Oe,t),R.off(l.Z.BUFFER_LEVEL_STATE_CHANGED,pe,t),R.off(l.Z.BUFFER_CLEARED,me,t),R.off(l.Z.SEEK_TARGET,Le,t),R.off(l.Z.FRAGMENT_LOADING_ABANDONED,_e,t),R.off(l.Z.FRAGMENT_LOADING_COMPLETED,Te,t),R.off(l.Z.SET_FRAGMENTED_TEXT_AFTER_DISABLED,Se,t),R.off(l.Z.SET_NON_FRAGMENTED_TEXT,be,t),R.off(l.Z.QUOTA_EXCEEDED,Ae,t),R.off(l.Z.SOURCE_BUFFER_ERROR,ye,t),R.off(l.Z.BYTES_APPENDED_END_FRAGMENT,Ee,t),oe(),D=null,N=null}},n=(0,f.Z)(I).getInstance().getLogger(t),oe(),R.on(l.Z.DATA_UPDATE_COMPLETED,he,t,{priority:u.Z.EVENT_PRIORITY_HIGH}),R.on(l.Z.INIT_FRAGMENT_NEEDED,ue,t),R.on(l.Z.MEDIA_FRAGMENT_NEEDED,le,t),R.on(l.Z.INIT_FRAGMENT_LOADED,De,t),R.on(l.Z.MEDIA_FRAGMENT_LOADED,Oe,t),R.on(l.Z.BUFFER_LEVEL_STATE_CHANGED,pe,t),R.on(l.Z.BUFFER_CLEARED,me,t),R.on(l.Z.SEEK_TARGET,Le,t),R.on(l.Z.FRAGMENT_LOADING_ABANDONED,_e,t),R.on(l.Z.FRAGMENT_LOADING_COMPLETED,Te,t),R.on(l.Z.QUOTA_EXCEEDED,Ae,t),R.on(l.Z.SET_FRAGMENTED_TEXT_AFTER_DISABLED,Se,t),R.on(l.Z.SET_NON_FRAGMENTED_TEXT,be,t),R.on(l.Z.SOURCE_BUFFER_ERROR,ye,t),R.on(l.Z.BYTES_APPENDED_END_FRAGMENT,Ee,t),t}ie.__dashjs_factory_name="StreamProcessor";var ae=c.Z.getClassFactory(ie),oe=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.streamId=null,this.mediaInfo=null,this.segmentType=null,this.quality=NaN,this.index=NaN,this.bytes=null,this.start=NaN,this.end=NaN,this.duration=NaN,this.representationId=null,this.endFragment=null},se=n(9032);function ue(e,t){if(e){if("string"==typeof e)return le(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?le(e,t):void 0}}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ce(e){e=e||{};var t,n,r=this.context,i=e.requestModifier,o=e.lowLatencyThroughputModel,s=e.boxParser,u=(0,N.Z)(r).getInstance();function l(e){var t,r=new Date,l=e.request,d=new Headers;if(l.range&&d.append("Range","bytes="+l.range),e.headers)for(var g in e.headers){var h=e.headers[g];h&&d.append(g,h)}l.requestStartDate||(l.requestStartDate=r),i&&i.modifyRequestHeader&&i.modifyRequestHeader({setRequestHeader:function(e,t){d.append(e,t)}},{url:e.url}),"function"==typeof window.AbortController&&(t=new AbortController,e.abortController=t,t.signal.onabort=e.onabort);var p={method:e.method,headers:d,credentials:e.withCredentials?"include":void 0,signal:t?t.signal:void 0},m=u.get().streaming.abr.fetchThroughputCalculationMode,y=Date.now(),E=0;new Promise((function(e){if(m===a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_AAST&&o&&(E=o.getThroughputCapacityDelayMS(l,1e3*n.getCurrentBufferLevel(l.mediaType))))return setTimeout(e,E);e()})).then((function(){var t=Date.now();fetch(e.url,p).then((function(r){e.response||(e.response={}),e.response.status=r.status,e.response.statusText=r.statusText,e.response.responseURL=r.url,r.ok||e.onerror();var i,u="",d=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=ue(e))){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}(r.headers.keys());try{for(d.s();!(i=d.n()).done;){var g=i.value;u+=g+": "+r.headers.get(g)+"\\r\\n"}}catch(e){d.e(e)}finally{d.f()}if(e.response.responseHeaders=u,!r.body)return r.arrayBuffer().then((function(t){e.response.response=t;var n={loaded:t.byteLength,total:t.byteLength,stream:!1};e.progress(n),e.onload(),e.onend()}));var h,p,v,_,T=parseInt(r.headers.get("Content-Length"),10),S=0,b=!1,A=new Uint8Array,I=0;if(m===a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_AAST&&o){var R=t,w=0,N=(v=r.body.tee(),_=2,function(e){if(Array.isArray(e))return e}(v)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}}(v,_)||ue(v,_)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),C=N[0],D=N[1];h=C.getReader(),p=[],h.read().then((function r(i){var a=i.value,s=i.done;if(w=Date.now(),a&&a.length){var c=w-R,f=a.length;p.push({chunkDownloadTimeRelativeMS:w-t,chunkDownloadDurationMS:c,chunkBytes:f,kbps:Math.round(8*f/(c/1e3)),bufferLevel:n.getCurrentBufferLevel(l.mediaType)})}if(s){var d=w-t,g=p.reduce((function(e,t){return e+t.chunkBytes}),0);return o.addMeasurement(l,d,p,y,E,u),void e.progress({loaded:g,total:g,lengthComputable:!0,time:o.getEstimatedDownloadDurationMS(l),stream:!0})}return R=Date.now(),h.read().then(r)})),e.reader=D.getReader()}else e.reader=r.body.getReader();var O=[],M=[],P=[],L=!0;c(e,(function t(n){var r=n.value;if(n.done){if(A){if(m!==a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_AAST){var i=null,o=null;m===a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING?(i=function(e,t){try{var n,r;n=e.filter((function(t,n){return n<e.length-1})),r=t.filter((function(e,n){return n<t.length-1}));var i=[];if(n.length>1){for(var a=0,o=0,s=0;s<n.length;s++)if(n[s]&&r[s]){var u=r[s].ts-n[s].ts;if(u>1)i.push(8*r[s].bytes/u),o=0;else{0===o&&(o=n[s].ts,a=0);var l=r[s].ts-o;l>1?(a+=r[s].bytes,i.push(8*a/l),o=0):a+=r[s].bytes}}if(i.length>0)return i.reduce((function(e,t){return e+t}),0)/i.length}return null}catch(e){return null}}(M,P),i&&(o=8*S/i)):m===a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA&&(o=f(O,S)),e.progress({loaded:S,total:isNaN(T)?S:T,lengthComputable:!0,time:o,stream:!0})}e.response.response=A.buffer}return e.onload(),void e.onend()}if(r&&r.length>0){A=function(e,t){if(0===e.length)return t;var n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(A,r),S+=r.length,O.push({ts:Date.now(),bytes:r.length}),m===a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING&&L&&s.findLastTopIsoBoxCompleted(["moof"],A,I).found&&(L=!1,M.push({ts:performance.now(),bytes:r.length}));var u=s.findLastTopIsoBoxCompleted(["moov","mdat"],A,I);if(u.found){var l,d=u.lastCompletedOffset+u.size;m!==a.Z.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING||L||(L=!0,P.push({ts:performance.now(),bytes:A.length})),d===A.length?(l=A,A=new Uint8Array):(l=new Uint8Array(A.subarray(0,d)),A=A.subarray(d)),e.progress({data:l.buffer,lengthComputable:!1,noTrace:!0}),I=0}else I=u.lastCompletedOffset,b||(e.progress({lengthComputable:!1,noTrace:!0}),b=!0)}c(e,t)}))})).catch((function(t){e.onerror&&e.onerror(t)}))}))}function c(e,t){e.reader.read().then(t).catch((function(t){e.onerror&&200===e.response.status&&e.onerror(t)}))}function f(e,t){try{if((e=e.filter((function(n){return n.bytes>t/4/e.length}))).length>1){var n=0,r=(e[e.length-1].ts-e[0].ts)/e.length;return e.forEach((function(t,i){var a=e[i+1];if(a){var o=a.ts-t.ts;n+=o<r?o:0}})),n}return null}catch(e){return null}}return t={load:function(e){i&&i.modifyRequest?(0,X.k)(e,i).then((function(){return l(e)})):l(e)},abort:function(e){if(e.abortController)e.abortController.abort();else if(e.reader)try{e.reader.cancel(),e.onabort()}catch(e){}},calculateDownloadedTime:f,setup:function(e){n=e.dashMetrics}},t}ce.__dashjs_factory_name="FetchLoader";var fe=c.Z.getClassFactory(ce),de=n(1180);function ge(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var he=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=null,this.index=-1,this.adaptation=null,this.segmentInfoType=null,this.initialization=null,this.codecs=null,this.mimeType=null,this.codecPrivateData=null,this.segmentDuration=NaN,this.timescale=1,this.startNumber=1,this.indexRange=null,this.range=null,this.presentationTimeOffset=0,this.MSETimeOffset=NaN,this.mediaFinishedInformation={numberOfSegments:0,mediaTimeOfLastSignaledSegment:NaN},this.bandwidth=NaN,this.width=NaN,this.height=NaN,this.scanType=null,this.maxPlayoutRate=NaN,this.availabilityTimeOffset=0,this.availabilityTimeComplete=!0,this.frameRate=null}var t,n;return t=e,(n=[{key:"hasInitialization",value:function(){return null!==this.initialization||null!==this.range}},{key:"hasSegments",value:function(){return this.segmentInfoType!==o.Z.BASE_URL&&this.segmentInfoType!==o.Z.SEGMENT_BASE&&!this.indexRange}}])&&ge(t.prototype,n),e}(),pe=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.period=null,this.index=-1,this.type=null},me=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=null,this.index=-1,this.duration=NaN,this.start=NaN,this.mpd=null,this.nextPeriodId=null};me.DEFAULT_ID="defaultId";var ye=me,Ee=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.manifest=null,this.suggestedPresentationDelay=0,this.availabilityStartTime=null,this.availabilityEndTime=Number.POSITIVE_INFINITY,this.timeShiftBufferDepth=Number.POSITIVE_INFINITY,this.maxSegmentDuration=Number.POSITIVE_INFINITY,this.publishTime=null,this.minimumUpdatePeriod=NaN,this.mediaPresentationDuration=NaN},ve=n(2610),_e=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.type="",this.duration=NaN,this.presentationTime=NaN,this.id=NaN,this.messageData="",this.eventStream=null,this.presentationTimeDelta=NaN},Te=function e(t,n,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t||"",this.serviceLocation=n||t||"",this.dvb_priority=r||1,this.dvb_weight=i||1,this.availabilityTimeOffset=0,this.availabilityTimeComplete=!0,this.queryParams={}};Te.DEFAULT_DVB_PRIORITY=1,Te.DEFAULT_DVB_WEIGHT=1;var Se=Te,be=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.adaptionSet=null,this.representation=null,this.period=null,this.timescale=1,this.value="",this.schemeIdUri="",this.presentationTimeOffset=0},Ae=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=null,this.inband=!1,this.type="encoder",this.applicationScheme=null,this.wallClockTime=null,this.presentationTime=NaN,this.UTCTiming=null},Ie=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.defaultServiceLocation=null,this.defaultServiceLocationArray=[],this.queryBeforeStart=!1,this.serverUrl=null,this.clientRequirement=!0};function Re(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var we=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.schemeIdUri=null,this.value=null,this.id=null}var t,n;return t=e,(n=[{key:"init",value:function(e){return e&&(this.schemeIdUri=e.schemeIdUri?e.schemeIdUri:null,this.value=e.value?e.value:null,this.id=e.id?e.id:null),this}}])&&Re(t.prototype,n),e}(),Ne=n(3101),Ce=n.n(Ne);function De(){return{areEqual:function(e,t){return Ce()(e,t)}}}De.__dashjs_factory_name="ObjectUtils";var Oe=c.Z.getSingletonFactory(De),Me=n(7803),Pe=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t||"",this.serviceLocation=n||null,this.queryParams={}},Le=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t||"",this.serviceLocation=n||null,this.ttl=r||NaN,this.queryParams={}};function xe(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=Fe(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Fe(e,t){if(e){if("string"==typeof e)return ke(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ke(e,t):void 0}}function ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ue(){var e,t,n,r,i=this.context,s=(0,Q.Z)(i).getInstance(),u=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function l(e,t){if(!e)throw new Error("adaptation is not defined");if(!t)throw new Error("type is not defined");if(e.Representation_asArray&&e.Representation_asArray.length){var n=v(e.Representation_asArray[0]);if(n&&n.length>0&&Me.Y.indexOf(n[0].schemeIdUri)>=0)return t===a.Z.IMAGE}if(e.ContentComponent_asArray&&e.ContentComponent_asArray.length>0){if(e.ContentComponent_asArray.length>1)return t===a.Z.MUXED;if(e.ContentComponent_asArray[0].contentType===t)return!0}var r=t===a.Z.TEXT?new RegExp("(ttml|vtt|wvtt|stpp)"):new RegExp(t);if(e.Representation_asArray&&e.Representation_asArray.length){var i=e.Representation_asArray[0].codecs;if(r.test(i))return!0}if(e.hasOwnProperty(o.Z.MIME_TYPE))return r.test(e.mimeType);if(e.Representation_asArray)for(var s,u=0;u<e.Representation_asArray.length;u++)if((s=e.Representation_asArray[u]).hasOwnProperty(o.Z.MIME_TYPE))return r.test(s.mimeType);return!1}function c(e){if(!e)throw new Error("adaptation is not defined");if(e.hasOwnProperty(o.Z.SEGMENT_TEMPLATE)||e.hasOwnProperty(o.Z.SEGMENT_TIMELINE)||e.hasOwnProperty(o.Z.SEGMENT_LIST)||e.hasOwnProperty(o.Z.SEGMENT_BASE))return!0;if(e.Representation_asArray&&e.Representation_asArray.length>0){var t=e.Representation_asArray[0];if(t.hasOwnProperty(o.Z.SEGMENT_TEMPLATE)||t.hasOwnProperty(o.Z.SEGMENT_TIMELINE)||t.hasOwnProperty(o.Z.SEGMENT_LIST)||t.hasOwnProperty(o.Z.SEGMENT_BASE))return!0}return!1}function d(e){return l(e,a.Z.VIDEO)}function g(e){return l(e,a.Z.TEXT)}function h(e){return l(e,a.Z.IMAGE)}function p(e){return e&&Array.isArray(e.Representation_asArray)&&e.Representation_asArray.sort((function(e,t){return e.bandwidth-t.bandwidth})),e}function m(e,t){return e&&e.Period_asArray&&u(t)&&e.Period_asArray[t]?e.Period_asArray[t].AdaptationSet_asArray:[]}function y(e){return e&&e.Period_asArray?e.Period_asArray:[]}function E(e){var t=!1;return e&&e.hasOwnProperty("type")&&(t=e.type===o.Z.DYNAMIC),t}function v(e){return e&&e.EssentialProperty_asArray&&e.EssentialProperty_asArray.length?e.EssentialProperty_asArray.map((function(e){return{schemeIdUri:e.schemeIdUri,value:e.value}})):null}function _(e){if(!e||!e.S_asArray)return NaN;var t=e.S_asArray[0],n=e.S_asArray[1];return t.hasOwnProperty("d")?t.d:n.t-t.t}function T(e,t){if(!e)throw new Error("Period cannot be null or undefined");var n=ye.DEFAULT_ID+"_"+t;return e.hasOwnProperty(o.Z.ID)&&e.id.length>0&&"__proto__"!==e.id&&(n=e.id),n}function b(e,t,n){var r,i=[];if(!e)return i;for(r=0;r<e.length;r++){var s=new be;if(s.timescale=1,s.representation=t,!e[r].hasOwnProperty(a.Z.SCHEME_ID_URI))throw new Error("Invalid EventStream. SchemeIdUri has to be set");s.schemeIdUri=e[r].schemeIdUri,e[r].hasOwnProperty(o.Z.TIMESCALE)&&(s.timescale=e[r].timescale),e[r].hasOwnProperty(o.Z.VALUE)&&(s.value=e[r].value),i.push(s),s.period=n}return i}function A(e){var t=[],n=e.BaseURL_asArray||[e.baseUri],r=!1;return n.some((function(n){if(n){var i=new Se,a=n.__text||n;return s.isRelative(a)&&(r=!0,e.baseUri&&(a=s.resolve(a,e.baseUri))),i.url=a,n.hasOwnProperty(o.Z.SERVICE_LOCATION)&&n.serviceLocation.length?i.serviceLocation=n.serviceLocation:i.serviceLocation=a,n.hasOwnProperty(o.Z.DVB_PRIORITY)&&(i.dvb_priority=n[o.Z.DVB_PRIORITY]),n.hasOwnProperty(o.Z.DVB_WEIGHT)&&(i.dvb_weight=n[o.Z.DVB_WEIGHT]),n.hasOwnProperty(o.Z.AVAILABILITY_TIME_OFFSET)&&(i.availabilityTimeOffset=n[o.Z.AVAILABILITY_TIME_OFFSET]),n.hasOwnProperty(o.Z.AVAILABILITY_TIME_COMPLETE)&&(i.availabilityTimeComplete="false"!==n[o.Z.AVAILABILITY_TIME_COMPLETE]),t.push(i),r}})),t}function I(e){var t=new Ie;return t.serverUrl=e.__text,e.hasOwnProperty(o.Z.DEFAULT_SERVICE_LOCATION)&&(t.defaultServiceLocation=e[o.Z.DEFAULT_SERVICE_LOCATION],t.defaultServiceLocationArray=t.defaultServiceLocation.split(" ")),e.hasOwnProperty(o.Z.QUERY_BEFORE_START)&&(t.queryBeforeStart="true"===e[o.Z.QUERY_BEFORE_START].toLowerCase()),e.hasOwnProperty(o.Z.CLIENT_REQUIREMENT)&&(t.clientRequirement="false"!==e[o.Z.CLIENT_REQUIREMENT].toLowerCase()),t}return e={getIsTypeOf:l,getIsText:g,getIsFragmented:c,getProducerReferenceTimesForAdaptation:function(e){var t=e&&e.hasOwnProperty(o.Z.PRODUCERREFERENCETIME_ASARRAY)?e[o.Z.PRODUCERREFERENCETIME_ASARRAY]:[];(e&&e.hasOwnProperty(o.Z.REPRESENTATION_ASARRAY)?e[o.Z.REPRESENTATION_ASARRAY]:[]).forEach((function(e){var n;e.hasOwnProperty(o.Z.PRODUCERREFERENCETIME_ASARRAY)&&t.push.apply(t,function(e){if(Array.isArray(e))return ke(e)}(n=e[o.Z.PRODUCERREFERENCETIME_ASARRAY])||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(n)||Fe(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}));var n=[];return t.forEach((function(e){var t=new Ae;e.hasOwnProperty(o.Z.ID)&&(t[o.Z.ID]=e[o.Z.ID],e.hasOwnProperty(o.Z.WALL_CLOCK_TIME)&&(t[o.Z.WALL_CLOCK_TIME]=e[o.Z.WALL_CLOCK_TIME],e.hasOwnProperty(o.Z.PRESENTATION_TIME)&&(t[o.Z.PRESENTATION_TIME]=e[o.Z.PRESENTATION_TIME],e.hasOwnProperty(o.Z.INBAND)&&(t[o.Z.INBAND]="false"!==e[o.Z.INBAND]),e.hasOwnProperty(o.Z.TYPE)&&(t[o.Z.TYPE]=e[o.Z.TYPE]),n.push(t))))})),n},getLanguageForAdaptation:function(e){var t="";return e&&e.hasOwnProperty(o.Z.LANG)&&(t=e.lang),t},getViewpointForAdaptation:function(e){return e&&e.hasOwnProperty(o.Z.VIEWPOINT_ASARRAY)&&e[o.Z.VIEWPOINT_ASARRAY].length?e[o.Z.VIEWPOINT_ASARRAY].map((function(e){return(new we).init(e)})):[]},getRolesForAdaptation:function(e){return e&&e.hasOwnProperty(o.Z.ROLE_ASARRAY)&&e[o.Z.ROLE_ASARRAY].length?e[o.Z.ROLE_ASARRAY].map((function(e){return(new we).init(e)})):[]},getAccessibilityForAdaptation:function(e){return e&&e.hasOwnProperty(o.Z.ACCESSIBILITY_ASARRAY)&&e[o.Z.ACCESSIBILITY_ASARRAY].length?e[o.Z.ACCESSIBILITY_ASARRAY].map((function(e){return(new we).init(e)})):[]},getAudioChannelConfigurationForAdaptation:function(e){return e&&e.hasOwnProperty(o.Z.AUDIOCHANNELCONFIGURATION_ASARRAY)&&e[o.Z.AUDIOCHANNELCONFIGURATION_ASARRAY].length?e[o.Z.AUDIOCHANNELCONFIGURATION_ASARRAY].map((function(e){return(new we).init(e)})):[]},getAudioChannelConfigurationForRepresentation:function(e){return e&&e.hasOwnProperty(o.Z.AUDIOCHANNELCONFIGURATION_ASARRAY)&&e[o.Z.AUDIOCHANNELCONFIGURATION_ASARRAY].length?e[o.Z.AUDIOCHANNELCONFIGURATION_ASARRAY].map((function(e){return(new we).init(e)})):[]},getAdaptationForIndex:function(e,t,n){var r=m(t,n);return r.length>0&&u(e)?r[e]:null},getIndexForAdaptation:function(e,t,n){if(!e)return-1;for(var r=m(t,n),a=0;a<r.length;a++)if(Oe(i).getInstance().areEqual(r[a],e))return a;return-1},getAdaptationForId:function(e,t,n){var r,i,a=m(t,n);for(r=0,i=a.length;r<i;r++)if(a[r].hasOwnProperty(o.Z.ID)&&a[r].id===e)return a[r];return null},getAdaptationsForType:function(e,t,n){var r,i,a=m(e,t),o=[];for(r=0,i=a.length;r<i;r++)l(a[r],n)&&o.push(p(a[r]));return o},getRealPeriods:y,getRealPeriodForIndex:function(e,t){var n=y(t);return n.length>0&&u(e)?n[e]:null},getCodec:function(e,t,n){var r=null;if(e&&e.Representation_asArray&&e.Representation_asArray.length>0){var i=u(t)&&t>=0&&t<e.Representation_asArray.length?e.Representation_asArray[t]:e.Representation_asArray[0];i&&(r=i.mimeType+\';codecs="\'+i.codecs+\'"\',n&&void 0!==i.width&&(r+=\';width="\'+i.width+\'";height="\'+i.height+\'"\'))}return r&&(r=r.replace(/\\sprofiles=[^;]*/g,"")),r},getSelectionPriority:function(e){try{var t=e&&void 0!==e.selectionPriority?parseInt(e.selectionPriority):1;return isNaN(t)?1:t}catch(e){return 1}},getMimeType:function(e){return e&&e.Representation_asArray&&e.Representation_asArray.length>0?e.Representation_asArray[0].mimeType:null},getKID:function(e){return e&&e.hasOwnProperty(o.Z.CENC_DEFAULT_KID)?e[o.Z.CENC_DEFAULT_KID]:null},getLabelsForAdaptation:function(e){if(!e||!Array.isArray(e.Label_asArray))return[];for(var t=[],n=0;n<e.Label_asArray.length;n++)t.push({lang:e.Label_asArray[n].lang,text:e.Label_asArray[n].__text||e.Label_asArray[n]});return t},getContentProtectionData:function(e){return e&&e.hasOwnProperty(o.Z.CONTENTPROTECTION_ASARRAY)&&0!==e.ContentProtection_asArray.length?e.ContentProtection_asArray:null},getIsDynamic:E,getId:function(e){return e&&e[o.Z.ID]||null},hasProfile:function(e,t){var n=!1;return e&&e.profiles&&e.profiles.length>0&&(n=-1!==e.profiles.indexOf(t)),n},getDuration:function(e){return e&&e.hasOwnProperty(o.Z.MEDIA_PRESENTATION_DURATION)?e.mediaPresentationDuration:e&&"dynamic"==e.type?Number.POSITIVE_INFINITY:Number.MAX_SAFE_INTEGER||Number.MAX_VALUE},getBandwidth:function(e){return e&&e.bandwidth?e.bandwidth:NaN},getManifestUpdatePeriod:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=NaN;return e&&e.hasOwnProperty(o.Z.MINIMUM_UPDATE_PERIOD)&&(n=e.minimumUpdatePeriod),isNaN(n)?n:Math.max(n-t,1)},getPublishTime:function(e){return e&&e.hasOwnProperty(o.Z.PUBLISH_TIME)?new Date(e[o.Z.PUBLISH_TIME]):null},getRepresentationCount:function(e){return e&&Array.isArray(e.Representation_asArray)?e.Representation_asArray.length:0},getBitrateListForAdaptation:function(e){var t=p(e);return(t&&Array.isArray(t.Representation_asArray)?t.Representation_asArray:[]).map((function(e){return{bandwidth:e.bandwidth,width:e.width||0,height:e.height||0,scanType:e.scanType||null,id:e.id||null}}))},getRepresentationFor:function(e,t){return t&&t.Representation_asArray&&t.Representation_asArray.length>0&&u(e)?t.Representation_asArray[e]:null},getRepresentationsForAdaptation:function(e){var t,n,r,i,a=[],s=function(e){if(e&&e.period&&u(e.period.index)){var t=e.period.mpd.manifest.Period_asArray[e.period.index];if(t&&t.AdaptationSet_asArray&&u(e.index))return p(t.AdaptationSet_asArray[e.index])}}(e);if(s&&s.Representation_asArray){if(e&&e.period&&u(e.period.index)){var l=A(e.period.mpd.manifest);l&&(n=l[0])}for(var f=0,d=s.Representation_asArray.length;f<d;++f){var h=s.Representation_asArray[f],m=new he;if(m.index=f,m.adaptation=e,h.hasOwnProperty(o.Z.ID)&&(m.id=h.id),h.hasOwnProperty(o.Z.CODECS)&&(m.codecs=h.codecs),h.hasOwnProperty(o.Z.MIME_TYPE)&&(m.mimeType=h[o.Z.MIME_TYPE]),h.hasOwnProperty(o.Z.CODEC_PRIVATE_DATA)&&(m.codecPrivateData=h.codecPrivateData),h.hasOwnProperty(o.Z.BANDWITH)&&(m.bandwidth=h.bandwidth),h.hasOwnProperty(o.Z.WIDTH)&&(m.width=h.width),h.hasOwnProperty(o.Z.HEIGHT)&&(m.height=h.height),h.hasOwnProperty(o.Z.SCAN_TYPE)&&(m.scanType=h.scanType),h.hasOwnProperty(o.Z.MAX_PLAYOUT_RATE)&&(m.maxPlayoutRate=h.maxPlayoutRate),h.hasOwnProperty(o.Z.SEGMENT_BASE)?(t=h.SegmentBase,m.segmentInfoType=o.Z.SEGMENT_BASE):h.hasOwnProperty(o.Z.SEGMENT_LIST)?(t=h.SegmentList).hasOwnProperty(o.Z.SEGMENT_TIMELINE)?m.segmentInfoType=o.Z.SEGMENT_TIMELINE:m.segmentInfoType=o.Z.SEGMENT_LIST:h.hasOwnProperty(o.Z.SEGMENT_TEMPLATE)?((t=h.SegmentTemplate).hasOwnProperty(o.Z.SEGMENT_TIMELINE)?m.segmentInfoType=o.Z.SEGMENT_TIMELINE:m.segmentInfoType=o.Z.SEGMENT_TEMPLATE,t.hasOwnProperty(o.Z.INITIALIZATION_MINUS)&&(m.initialization=t.initialization.split("$Bandwidth$").join(h.bandwidth).split("$RepresentationID$").join(h.id))):m.segmentInfoType=o.Z.BASE_URL,m.essentialProperties=v(h),t){if(t.hasOwnProperty(o.Z.INITIALIZATION)){var y=t.Initialization;y.hasOwnProperty(o.Z.SOURCE_URL)&&(m.initialization=y.sourceURL),y.hasOwnProperty(o.Z.RANGE)&&(m.range=y.range)}else g(s)&&c(s)&&s.mimeType&&-1===s.mimeType.indexOf("application/mp4")&&(m.range=0);t.hasOwnProperty(o.Z.TIMESCALE)&&(m.timescale=t.timescale),t.hasOwnProperty(o.Z.DURATION)?m.segmentDuration=t.duration/m.timescale:h.hasOwnProperty(o.Z.SEGMENT_TEMPLATE)&&(t=h.SegmentTemplate).hasOwnProperty(o.Z.SEGMENT_TIMELINE)&&(m.segmentDuration=_(t.SegmentTimeline)/m.timescale),t.hasOwnProperty(o.Z.MEDIA)&&(m.media=t.media),t.hasOwnProperty(o.Z.START_NUMBER)&&(m.startNumber=t.startNumber),t.hasOwnProperty(o.Z.INDEX_RANGE)&&(m.indexRange=t.indexRange),t.hasOwnProperty(o.Z.PRESENTATION_TIME_OFFSET)&&(m.presentationTimeOffset=t.presentationTimeOffset/m.timescale),t.hasOwnProperty(o.Z.AVAILABILITY_TIME_OFFSET)?m.availabilityTimeOffset=t.availabilityTimeOffset:n&&void 0!==n.availabilityTimeOffset&&(m.availabilityTimeOffset=n.availabilityTimeOffset),t.hasOwnProperty(o.Z.AVAILABILITY_TIME_COMPLETE)?m.availabilityTimeComplete="false"!==t.availabilityTimeComplete:n&&void 0!==n.availabilityTimeComplete&&(m.availabilityTimeComplete=n.availabilityTimeComplete)}m.MSETimeOffset=(void 0,i=(r=m).presentationTimeOffset,r.adaptation.period.start-i),m.path=[e.period.index,e.index,f],a.push(m)}}return a},getAdaptationsForPeriod:function(e){var n,r,i,s=e&&u(e.index)?e.mpd.manifest.Period_asArray[e.index]:null,c=[];if(s&&s.AdaptationSet_asArray)for(i=0;i<s.AdaptationSet_asArray.length;i++)r=s.AdaptationSet_asArray[i],n=new pe,r.hasOwnProperty(o.Z.ID)&&(n.id=r.id),n.index=i,n.period=e,l(r,a.Z.MUXED)?n.type=a.Z.MUXED:l(r,a.Z.AUDIO)?n.type=a.Z.AUDIO:d(r)?n.type=a.Z.VIDEO:g(r)?n.type=a.Z.TEXT:h(r)?n.type=a.Z.IMAGE:t.warn("Unknown Adaptation stream type"),c.push(n);return c},getRegularPeriods:function(e){var r,i,s=!!e&&E(e.manifest),u=[],l=null,c=null,f=null,d=null;for(i=0,r=e&&e.manifest&&e.manifest.Period_asArray?e.manifest.Period_asArray.length:0;i<r;i++)(c=e.manifest.Period_asArray[i]).hasOwnProperty(o.Z.START)?(d=new ye).start=c.start:null!==l&&l.hasOwnProperty(o.Z.DURATION)&&null!==f?(d=new ye).start=parseFloat((f.start+f.duration).toFixed(5)):0!==i||s||((d=new ye).start=0),null!==f&&isNaN(f.duration)&&(null!==d?f.duration=parseFloat((d.start-f.start).toFixed(5)):t.warn("First period duration could not be calculated because lack of start and duration period properties. This will cause timing issues during playback")),null!==d&&(d.id=T(c,i),d.index=i,d.mpd=e,c.hasOwnProperty(o.Z.DURATION)&&(d.duration=c.duration),f&&(f.nextPeriodId=d.id),u.push(d),l=c,f=d),c=null,d=null;return 0===u.length||null!==f&&isNaN(f.duration)&&(f.duration=parseFloat((function(e){!function(){if(!n||!n.hasOwnProperty("error"))throw new Error(a.Z.MISSING_CONFIG_ERROR)}();var t,r=E(e.mpd.manifest);return e.mpd.manifest.mediaPresentationDuration?t=e.mpd.manifest.mediaPresentationDuration:e.duration?t=e.duration:r?t=Number.POSITIVE_INFINITY:n.error(new S.Z(w.MANIFEST_ERROR_ID_PARSE_CODE,"Must have @mediaPresentationDuration on MPD or an explicit @duration on the last period.",e)),t}(f)-f.start).toFixed(5))),u},getMpd:function(e){var t=new Ee;return e&&(t.manifest=e,e.hasOwnProperty(o.Z.AVAILABILITY_START_TIME)?t.availabilityStartTime=new Date(e.availabilityStartTime.getTime()):e.loadedTime&&(t.availabilityStartTime=new Date(e.loadedTime.getTime())),e.hasOwnProperty(o.Z.AVAILABILITY_END_TIME)&&(t.availabilityEndTime=new Date(e.availabilityEndTime.getTime())),e.hasOwnProperty(o.Z.MINIMUM_UPDATE_PERIOD)&&(t.minimumUpdatePeriod=e.minimumUpdatePeriod),e.hasOwnProperty(o.Z.MEDIA_PRESENTATION_DURATION)&&(t.mediaPresentationDuration=e.mediaPresentationDuration),e.hasOwnProperty(o.Z.SUGGESTED_PRESENTATION_DELAY)&&(t.suggestedPresentationDelay=e.suggestedPresentationDelay),e.hasOwnProperty(o.Z.TIMESHIFT_BUFFER_DEPTH)&&(t.timeShiftBufferDepth=e.timeShiftBufferDepth),e.hasOwnProperty(o.Z.MAX_SEGMENT_DURATION)&&(t.maxSegmentDuration=e.maxSegmentDuration),e.hasOwnProperty(o.Z.PUBLISH_TIME)&&(t.publishTime=new Date(e.publishTime))),t},getEventsForPeriod:function(e){var t,n,i=e&&e.mpd&&e.mpd.manifest?e.mpd.manifest:null,s=i?i.Period_asArray:null,l=s&&e&&u(e.index)?s[e.index].EventStream_asArray:null,c=[];if(l)for(t=0;t<l.length;t++){var f=new be;if(f.period=e,f.timescale=1,!l[t].hasOwnProperty(a.Z.SCHEME_ID_URI))throw new Error("Invalid EventStream. SchemeIdUri has to be set");for(f.schemeIdUri=l[t][a.Z.SCHEME_ID_URI],l[t].hasOwnProperty(o.Z.TIMESCALE)&&(f.timescale=l[t][o.Z.TIMESCALE]),l[t].hasOwnProperty(o.Z.VALUE)&&(f.value=l[t][o.Z.VALUE]),l[t].hasOwnProperty(o.Z.PRESENTATION_TIME_OFFSET)&&(f.presentationTimeOffset=l[t][o.Z.PRESENTATION_TIME_OFFSET]),n=0;l[t].Event_asArray&&n<l[t].Event_asArray.length;n++){var d=l[t].Event_asArray[n],g=new _e;g.presentationTime=0,g.eventStream=f,d.hasOwnProperty(o.Z.PRESENTATION_TIME)&&(g.presentationTime=d.presentationTime);var h=f.presentationTimeOffset?f.presentationTimeOffset/f.timescale:0;g.calculatedPresentationTime=g.presentationTime/f.timescale+e.start-h,d.hasOwnProperty(o.Z.DURATION)&&(g.duration=d.duration/f.timescale),d.hasOwnProperty(o.Z.ID)?g.id=d.id:g.id=null,d.Signal&&d.Signal.Binary?g.messageData=r.decodeArray(d.Signal.Binary.toString()):g.messageData=d.messageData||d.__cdata||d.__text,c.push(g)}}return c},getEssentialPropertiesForRepresentation:v,getEventStreamForAdaptationSet:function(e,t,n){var r,i,a;return e&&e.Period_asArray&&t&&t.period&&u(t.period.index)&&(i=e.Period_asArray[t.period.index])&&i.AdaptationSet_asArray&&u(t.index)&&(a=i.AdaptationSet_asArray[t.index])&&(r=a.InbandEventStream_asArray),b(r,null,n)},getEventStreamForRepresentation:function(e,t,n){var r,i,a,o;return e&&e.Period_asArray&&t&&t.adaptation&&t.adaptation.period&&u(t.adaptation.period.index)&&(i=e.Period_asArray[t.adaptation.period.index])&&i.AdaptationSet_asArray&&u(t.adaptation.index)&&(a=i.AdaptationSet_asArray[t.adaptation.index])&&a.Representation_asArray&&u(t.index)&&(o=a.Representation_asArray[t.index])&&(r=o.InbandEventStream_asArray),b(r,t,n)},getUTCTimingSources:function(e){var t=E(e),n=!!e&&e.hasOwnProperty(o.Z.AVAILABILITY_START_TIME),r=e?e.UTCTiming_asArray:null,i=[];return(t||n)&&r&&r.forEach((function(e){var t=new ve.Z;e.hasOwnProperty(a.Z.SCHEME_ID_URI)&&(t.schemeIdUri=e.schemeIdUri,e.hasOwnProperty(o.Z.VALUE)&&(t.value=e.value.toString(),i.push(t)))})),i},getBaseURLsFromElement:A,getRepresentationSortFunction:function(){return function(e,t){return e.bandwidth-t.bandwidth}},getContentSteering:function(e){if(e&&e.hasOwnProperty(o.Z.CONTENT_STEERING_AS_ARRAY))return I(e[o.Z.CONTENT_STEERING_AS_ARRAY][0])},getLocation:function(e){return e&&e.hasOwnProperty(o.Z.LOCATION_AS_ARRAY)?e[o.Z.LOCATION_AS_ARRAY].map((function(e){var t=e.__text||e,n=e.hasOwnProperty(o.Z.SERVICE_LOCATION)?e[o.Z.SERVICE_LOCATION]:null;return new Pe(t,n)})):[]},getPatchLocation:function(e){return e&&e.hasOwnProperty(o.Z.PATCH_LOCATION_AS_ARRAY)?e[o.Z.PATCH_LOCATION_AS_ARRAY].map((function(e){var t=e.__text||e,n=e.hasOwnProperty(o.Z.SERVICE_LOCATION)?e[o.Z.SERVICE_LOCATION]:null,r=e.hasOwnProperty(o.Z.TTL)?1e3*parseFloat(e[o.Z.TTL]):NaN;return new Le(t,n,r)})):[]},getSuggestedPresentationDelay:function(e){return e&&e.hasOwnProperty(o.Z.SUGGESTED_PRESENTATION_DELAY)?e.suggestedPresentationDelay:null},getAvailabilityStartTime:function(e){return e&&e.hasOwnProperty(o.Z.AVAILABILITY_START_TIME)&&null!==e.availabilityStartTime?e.availabilityStartTime.getTime():null},getServiceDescriptions:function(e){var t=[];if(e&&e.hasOwnProperty(o.Z.SERVICE_DESCRIPTION)){var n,r=xe(e.ServiceDescription_asArray);try{for(r.s();!(n=r.n()).done;){var i=n.value,a=null,s=null,u=null,l=null,c=null,f=null,d=null;for(var g in i)i.hasOwnProperty(g)&&(g===o.Z.ID?a=i[g]:g===o.Z.SERVICE_DESCRIPTION_SCOPE?s=i[g].schemeIdUri:g===o.Z.SERVICE_DESCRIPTION_LATENCY?u={target:parseInt(i[g].target),max:parseInt(i[g].max),min:parseInt(i[g].min),referenceId:parseInt(i[g].referenceId)}:g===o.Z.SERVICE_DESCRIPTION_PLAYBACK_RATE?l={max:parseFloat(i[g].max),min:parseFloat(i[g].min)}:g===o.Z.SERVICE_DESCRIPTION_OPERATING_QUALITY?c={mediaType:i[g].mediaType,max:parseInt(i[g].max),min:parseInt(i[g].min),target:parseInt(i[g].target),type:i[g].type,maxQualityDifference:parseInt(i[g].maxQualityDifference)}:g===o.Z.SERVICE_DESCRIPTION_OPERATING_BANDWIDTH?f={mediaType:i[g].mediaType,max:parseInt(i[g].max),min:parseInt(i[g].min),target:parseInt(i[g].target)}:g===o.Z.CONTENT_STEERING&&(d=I(i[g])));t.push({id:a,schemeIdUri:s,latency:u,playbackRate:l,operatingQuality:c,operatingBandwidth:f,contentSteering:d})}}catch(e){r.e(e)}finally{r.f()}}return t},getSegmentAlignment:function(e){return!(!e||!e.hasOwnProperty(o.Z.SEGMENT_ALIGNMENT))&&"true"===e[o.Z.SEGMENT_ALIGNMENT]},getSubSegmentAlignment:function(e){return!(!e||!e.hasOwnProperty(o.Z.SUB_SEGMENT_ALIGNMENT))&&"true"===e[o.Z.SUB_SEGMENT_ALIGNMENT]},getSupplementalPropertiesForAdaptation:function(e){var t={};if(e&&e.hasOwnProperty(o.Z.SUPPLEMENTAL_PROPERTY_ASARRAY)){var n,r=xe(e.SupplementalProperty_asArray);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.hasOwnProperty(a.Z.SCHEME_ID_URI)&&i.hasOwnProperty(o.Z.VALUE)&&(t[i[a.Z.SCHEME_ID_URI]]=i[o.Z.VALUE])}}catch(e){r.e(e)}finally{r.f()}}return t},getSupplementalPropertiesAsArrayForAdaptation:function(e){return e&&e.hasOwnProperty(o.Z.SUPPLEMENTAL_PROPERTY_ASARRAY)&&e.SupplementalProperty_asArray.length?e.SupplementalProperty_asArray.map((function(e){return(new we).init(e)})):[]},getSupplementalPropertiesForRepresentation:function(e){var t={};if(e&&e.hasOwnProperty(o.Z.SUPPLEMENTAL_PROPERTY_ASARRAY)){var n,r=xe(e.SupplementalProperty_asArray);try{for(r.s();!(n=r.n()).done;){var i=n.value;i.hasOwnProperty(a.Z.SCHEME_ID_URI)&&i.hasOwnProperty(o.Z.VALUE)&&(t[i[a.Z.SCHEME_ID_URI]]=i[o.Z.VALUE])}}catch(e){r.e(e)}finally{r.f()}}return t},getSupplementalPropertiesAsArrayForRepresentation:function(e){return e&&e.hasOwnProperty(o.Z.SUPPLEMENTAL_PROPERTY_ASARRAY)&&e.SupplementalProperty_asArray.length?e.SupplementalProperty_asArray.map((function(e){return(new we).init(e)})):[]},setConfig:function(e){e&&(e.errHandler&&(n=e.errHandler),e.BASE64&&(r=e.BASE64))}},t=(0,f.Z)(i).getInstance().getLogger(e),e}Ue.__dashjs_factory_name="DashManifestModel";var Ze=c.Z.getSingletonFactory(Ue),Be=n(703);function Ge(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return qe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?qe(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function qe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ye(){var e,t,n,r,i,o,s,l,c,f,g=this.context,h=(0,u.Z)(g).getInstance(),p=(0,N.Z)(g).getInstance();function m(){n={pr:1,nor:null,st:null,sf:null,sid:"".concat(Be.Z.generateUuid()),cid:null},c={},l={},f={},E()}function y(){E()}function E(){if(o){var e=o.getStreamController();if(e&&"function"==typeof e.getActiveStream){var t=e.getActiveStream();t&&(s=t.getProcessors())}}}function v(e,t){var n,r={},i=Ge(t);try{for(i.s();!(n=i.n()).done;){var a=n.value;e[a]&&(r[a]=e[a])}}catch(e){i.e(e)}finally{i.f()}return r}function _(e){var t=p.get().streaming.cmcd.enabledKeys;return e.filter((function(e){return t.includes(e)}))}function T(e){try{return e.type===C.w.MPD_TYPE?((u=S()).ot="m",u):e.type===C.w.MEDIA_SEGMENT_TYPE?(t=e.mediaType,f.hasOwnProperty(t)||(f[t]=!1),l.hasOwnProperty(t)||(l[t]=!1),c.hasOwnProperty(t)||(c[t]=!1),function(e){var t,u=S(),d=function(e){try{var t=e.quality,n=e.mediaInfo.bitrateList;return parseInt(n[t].bandwidth/1e3)}catch(e){return null}}(e),g=function(e){try{return isNaN(e.duration)?NaN:Math.round(1e3*e.duration)}catch(e){return null}}(e),h=function(e){try{return 100*parseInt(r.getThroughputHistory().getSafeAverageThroughput(e)/100)}catch(e){return null}}(e.mediaType),m=function(e){try{var t=n.pr,r=i.getCurrentBufferLevel(e);return isNaN(t)||isNaN(r)?null:100*parseInt(r/t*10)}catch(e){return null}}(e.mediaType),y=b(e.mediaType),E=function(e){try{var t=r.getTopBitrateInfoFor(e);return Math.round(t.bitrate/1e3)}catch(e){return null}}(e.mediaType),v=n.pr,_=function(e){if(s&&0!==s.length){var t,n=Ge(s);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.getType()===e)return r.probeNextRequest()}}catch(e){n.e(e)}finally{n.f()}}}(e.mediaType);e.mediaType===a.Z.VIDEO&&(t="v"),e.mediaType===a.Z.AUDIO&&(t="a"),e.mediaType===a.Z.TEXT&&(t="application/mp4"===e.mediaInfo.mimeType?"tt":"c");var T=p.get().streaming.cmcd.rtp;return T||(T=function(e){try{var t=o.getPlaybackRate();t||(t=1);var n=e.quality,r=e.mediaType,i=e.mediaInfo,a=e.duration;if(!i)return NaN;var s=b(r);0===s&&(s=500);var u=i.bitrateList[n].bandwidth*a/1e3/(s/t/1e3),l=p.get().streaming.cmcd.rtpSafetyFactor&&!isNaN(p.get().streaming.cmcd.rtpSafetyFactor)?p.get().streaming.cmcd.rtpSafetyFactor:5;return 100*(parseInt(u*l/100)+1)}catch(e){return NaN}}(e)),isNaN(T)||(u.rtp=T),_&&(e.url!==_.url?u.nor=encodeURIComponent(Be.Z.getRelativeUrl(e.url,_.url)):_.range&&(u.nrr=_.range)),d&&(u.br=d),t&&(u.ot=t),isNaN(g)||(u.d=g),isNaN(h)||(u.mtp=h),isNaN(m)||(u.dl=m),isNaN(y)||(u.bl=y),isNaN(E)||(u.tb=E),isNaN(v)||1===v||(u.pr=v),c[e.mediaType]&&(u.bs=!0,c[e.mediaType]=!1),!l[e.mediaType]&&f[e.mediaType]||(u.su=!0,l[e.mediaType]=!1,f[e.mediaType]=!0),u}(e)):e.type===C.w.INIT_SEGMENT_TYPE?function(){var e=S();return e.ot="i",e.su=!0,e}():e.type===C.w.OTHER_TYPE||e.type===C.w.XLINK_EXPANSION_TYPE?function(){var e=S();return e.ot="o",e}():e.type===C.w.LICENSE?function(e){var t=S();return t.ot="k",t}():null}catch(e){return null}var t,u}function S(){var e={},t=p.get().streaming.cmcd.cid?p.get().streaming.cmcd.cid:n.cid;return e.v=1,e.sid=p.get().streaming.cmcd.sid?p.get().streaming.cmcd.sid:n.sid,e.sid="".concat(e.sid),t&&(e.cid="".concat(t)),isNaN(n.pr)||1===n.pr||null===n.pr||(e.pr=n.pr),n.st&&(e.st=n.st),n.sf&&(e.sf=n.sf),e}function b(e){try{var t=i.getCurrentBufferLevel(e);return isNaN(t)?null:100*parseInt(10*t)}catch(e){return null}}function A(e){try{n.pr=e.playbackRate}catch(e){}}function I(t){try{var r=e.getIsDynamic(t.data)?"l":"v",i=t.protocol&&"MSS"===t.protocol?"s":"d";n.st="".concat(r),n.sf="".concat(i)}catch(e){}}function R(e){try{e.state&&e.mediaType&&e.state===d.Z.BUFFER_EMPTY&&(c[e.mediaType]||(c[e.mediaType]=!0),l[e.mediaType]||(l[e.mediaType]=!0))}catch(e){}}function w(){for(var e in c)c.hasOwnProperty(e)&&(c[e]=!0);for(var t in l)l.hasOwnProperty(t)&&(l[t]=!0)}function D(e){try{if(!e)return null;var t=Object.keys(e).sort((function(e,t){return e.localeCompare(t)})),n=t.length,r=t.reduce((function(t,r,i){return"v"===r&&1===e[r]||("string"==typeof e[r]&&"ot"!==r&&"sf"!==r&&"st"!==r?t+="".concat(r,"=").concat(JSON.stringify(e[r])):t+="".concat(r,"=").concat(e[r]),i<n-1&&(t+=",")),t}),"");return(r=r.replace(/=true/g,"")).replace(/,\\s*$/,"")}catch(e){return null}}return t={getQueryParameter:function(e){try{if(p.get().streaming.cmcd&&p.get().streaming.cmcd.enabled){var t=T(e),n=function(e){try{var t=p.get().streaming.cmcd.enabledKeys;return Object.keys(e).filter((function(e){return t.includes(e)})).reduce((function(t,n){return t[n]=e[n],t}),{})}catch(t){return e}}(t),r=D(n);return h.trigger(de.Z.CMCD_DATA_GENERATED,{url:e.url,mediaType:e.mediaType,cmcdData:t,cmcdString:r}),{key:"CMCD",value:r}}return null}catch(e){return null}},getHeaderParameters:function(e){try{if(p.get().streaming.cmcd&&p.get().streaming.cmcd.enabled){var t=T(e),n=v(t,_(["br","d","ot","tb"])),r=v(t,_(["bl","dl","mtp","nor","nrr","su"])),i=v(t,_(["bs","rtp"])),a=v(t,_(["cid","pr","sf","sid","st","v"])),o={"CMCD-Object":D(n),"CMCD-Request":D(r),"CMCD-Status":D(i),"CMCD-Session":D(a)};return h.trigger(de.Z.CMCD_DATA_GENERATED,{url:e.url,mediaType:e.mediaType,cmcdData:t,headers:o}),o}return null}catch(e){return null}},setConfig:function(e){e&&(e.abrController&&(r=e.abrController),e.dashMetrics&&(i=e.dashMetrics),e.playbackController&&(o=e.playbackController))},reset:function(){h.off(d.Z.PLAYBACK_RATE_CHANGED,A,this),h.off(d.Z.MANIFEST_LOADED,I,this),h.off(d.Z.BUFFER_LEVEL_STATE_CHANGED,R,t),h.off(d.Z.PLAYBACK_SEEKED,w,t),m()},initialize:function(){h.on(d.Z.PLAYBACK_RATE_CHANGED,A,t),h.on(d.Z.MANIFEST_LOADED,I,t),h.on(d.Z.BUFFER_LEVEL_STATE_CHANGED,R,t),h.on(d.Z.PLAYBACK_SEEKED,w,t),h.on(d.Z.PERIOD_SWITCH_COMPLETED,y,t)}},e=Ze(g).getInstance(),m(),t}Ye.__dashjs_factory_name="CmcdModel";var je=c.Z.getSingletonFactory(Ye);function He(e){return He="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},He(e)}function Ve(e,t){Ve=function(e,t){return new a(e,void 0,t)};var n=ze(RegExp),r=RegExp.prototype,i=new WeakMap;function a(e,t,r){var a=n.call(this,e,t);return i.set(a,r||i.get(e)),a}function o(e,t){var n=i.get(t);return Object.keys(n).reduce((function(t,r){return t[r]=e[n[r]],t}),Object.create(null))}return Ke(a,n),a.prototype.exec=function(e){var t=r.exec.call(this,e);return t&&(t.groups=o(t,this)),t},a.prototype[Symbol.replace]=function(e,t){if("string"==typeof t){var n=i.get(this);return r[Symbol.replace].call(this,e,t.replace(/\\$<([^>]+)>/g,(function(e,t){return"$"+n[t]})))}if("function"==typeof t){var a=this;return r[Symbol.replace].call(this,e,(function(){var e=[];return e.push.apply(e,arguments),"object"!==He(e[e.length-1])&&e.push(o(e,a)),t.apply(this,e)}))}return r[Symbol.replace].call(this,e,t)},Ve.apply(this,arguments)}function Ke(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qe(e,t)}function ze(e){var t="function"==typeof Map?new Map:void 0;return ze=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return We(e,arguments,Je(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),Qe(r,e)},ze(e)}function We(e,t,n){return We=Xe()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var i=new(Function.bind.apply(e,r));return n&&Qe(i,n.prototype),i},We.apply(null,arguments)}function Xe(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function Qe(e,t){return Qe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Qe(e,t)}function Je(e){return Je=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Je(e)}var $e="static",et="dynamic",tt="cmsd-",nt=tt+$e,rt=tt+et,it="stream",at=["mb","st","sf","v"],ot={video:"v",audio:"a",text:"tt",stream:it},st=/^[-0-9]/;function ut(){var e,t,n,r,i=this.context,a=(0,u.Z)(i).getInstance();function o(){n={},r={}}function s(e){e&&Object.keys(e).forEach((function(t){at.includes(t)||delete e[t]}))}function c(e){return!e||"false"!==e.toLowerCase()&&(st.test(e)?parseInt(e,10):e.replace(/["]+/g,""))}function d(e){try{for(var n={},r=e.split(","),i=0;i<r.length;i++){var a=r[i].split("="),o=a[0],s=c(a[1]);n[o]=s}return n}catch(e){t.error("Failed to parse CMSD-Static response header value:",e)}}function g(e){try{for(var n={},r=e.split(","),i=r[r.length-1].split(";"),a=1;a<i.length;a++){var o=i[a].split("="),s=o[0],u=c(o[1]);n[s]=u}return n}catch(e){return t.error("Failed to parse CMSD-Dynamic response header value:",e),[]}}function h(e){return ot[e]||"o"}function p(e,t,i){var a=e===$e?n:r,o=a[t]||{},s=a[it]||{};return o[i]||s[i]}return e={setConfig:function(){},initialize:function(){},reset:function(){o()},parseResponseHeaders:function(e,t){for(var i=null,o=null,u=e.split("\\r\\n"),c=u.length-1;c>=0;c--){var f=u[c].match(Ve(/^((?:(?!:)[\\s\\S])*):[\\t-\\r \\xA0\\u1680\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]*(.*)$/,{key:1,value:2}));if(f&&f.groups){var p=f.groups.key.toLowerCase(),m=f.groups.value;switch(p){case nt:i=d(m),a.trigger(l.Z.CMSD_STATIC_HEADER,i);break;case rt:o||(o=g(m))}}}var y=it;return i&&i.ot?y=i.ot:t&&(y=h(t)),s(n[y]),s(r[y]),i&&(n[y]=Object.assign(n[y]||{},i)),o&&(r[y]=Object.assign(r[y]||{},o)),{static:i,dynamic:o}},getMaxBitrate:function(e){var t=h(e);return p(et,t,"mb")||-1},getEstimatedThroughput:function(e){var t=h(e);return p(et,t,"etp")||null},getResponseDelay:function(e){var t=h(e);return p(et,t,"rd")||null},getRoundTripTime:function(e){var t=h(e);return p(et,t,"rtt")||null}},t=(0,f.Z)(i).getInstance().getLogger(e),o(),e}ut.__dashjs_factory_name="CmsdModel";var lt=c.Z.getSingletonFactory(ut);function ct(){var e,t,n=this.context,r={};function i(){t=(0,f.Z)(n).getInstance().getLogger(e)}function a(e){for(var t={},n=0,r=0,i=0,a=0,o=e.length,s=0;s<o;++s)n+=e[s].chunkDownloadTimeRelativeMS,r+=e[s].bufferLevel,i+=e[s].chunkDownloadTimeRelativeMS*e[s].bufferLevel,a+=e[s].chunkDownloadTimeRelativeMS*e[s].chunkDownloadTimeRelativeMS;return t.m=(i-n*r/o)/(a-n*n/o),t.b=r/o-t.m*n/o,function(e){return t.m*e+t.b}}function o(e){var t,n=!0,r=e.reduce((function(e,t){return e+t.bufferLevelAtSegmentEnd}),0)/e.length;return e.forEach((function(e){Math.abs(e.bufferLevelAtSegmentEnd/e.bufferLevelAtSegmentStart)<.95&&(n=!1),e.bufferLevelAtSegmentEnd/r<.8&&(n=!1),t?t>e.bitrate&&(n=!1):t=e.bitrate})),n}return e={setup:i,addMeasurement:function(e,t,n,i,o){e&&e.mediaType&&!r[e.mediaType]&&(r[e.mediaType]=[]);var s=e.mediaInfo.bitrateList.find((function(t){return t.id===e.representationId}));r[e.mediaType].push({index:e.index,repId:e.representationId,mediaType:e.mediaType,requestTimeMS:i,adjustedAvailabilityStartTimeMS:e.availabilityStartTime.getTime(),segDurationMS:1e3*e.duration,chunksDurationMS:n.reduce((function(e,t){return e+t.chunkDownloadDurationMS}),0),segmentBytes:n.reduce((function(e,t){return e+t.chunkBytes}),0),bitrate:s&&s.bandwidth,bitrateList:e.mediaInfo.bitrateList,chunkMeasurements:n,fetchDownloadDurationMS:t,throughputCapacityDelayMS:o,getEstimatedBufferLevel:a(n.slice(1))}),r[e.mediaType].length>10&&r[e.mediaType].shift()},getThroughputCapacityDelayMS:function(e,t){var n=r[e.mediaType]&&r[e.mediaType].slice(-3);return!n||n.length<3?0:o(n)?t/4>250?250:t/4:0},getEstimatedDownloadDurationMS:function(e){var n=r[e.mediaType].slice(-1).pop(),i=r[e.mediaType].slice(-3),a=n.chunkMeasurements.slice(-1).pop().chunkDownloadTimeRelativeMS;n.bufferLevelAtSegmentStart=n.getEstimatedBufferLevel(a/2),n.bufferLevelAtSegmentEnd=n.getEstimatedBufferLevel(a);var s=o(i),u=s?.6:.8;if(n.isBufferStable&&1.05*n.segDurationMS<n.fetchDownloadDurationMS)return n.fetchDownloadDurationMS;if(!s||n.segDurationMS<n.fetchDownloadDurationMS)return.8*n.fetchDownloadDurationMS;if(n.adjustedAvailabilityStartTimeMS<=n.requestTimeMS+n.throughputCapacityDelayMS-n.segDurationMS)return.8*n.fetchDownloadDurationMS;for(var l=n.requestTimeMS+n.throughputCapacityDelayMS-n.adjustedAvailabilityStartTimeMS,c=0,f=0,d=0,g=0;g<n.chunkMeasurements.length;g++){var h=n.chunkMeasurements[g];if(l<f+h.chunkDownloadDurationMS)break;f+=h.chunkDownloadDurationMS,c+=h.chunkBytes,d++}if(l<0&&t.warn("request time was before adjusted availibitly start time"),c&&f&&d>.2*n.chunkMeasurements.length){var p=c/f,m=n.segmentBytes/p;return n.fetchDownloadDurationMS<m?n.fetchDownloadDurationMS*u:m*u}var y=n.bitrate;return n.bitrateList.some((function(e){if(e.bandwidth>n.bitrate)return y=e.bandwidth,!0})),y===n.bitrate?n.fetchDownloadDurationMS*u:u*n.segmentBytes*8*1e3/y}},i(),e}ct.__dashjs_factory_name="LowLatencyThroughputModel";var ft=c.Z.getSingletonFactory(ct),dt=n(5717);function gt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ht(e){e=e||{};var t,n,r,i,o,s,c,d,g,h,p,m=this.context,y=e.errHandler,E=e.dashMetrics,v=e.mediaPlayerModel,_=e.requestModifier,T=e.boxParser,b=e.errors,A=e.requestTimeout||0,I=(0,u.Z)(m).getInstance(),R=(0,N.Z)(m).getInstance();function w(e,t){var u,f=e.request,p=[],b=!0,N=!0,D=new Date,O=D,M=0,P=null,L=null;if(!_||!E||!y)throw new Error("config object is not correct or missing");var x,F=function(e){f.requestStartDate=D,f.requestEndDate=new Date,f.firstByteDate=f.firstByteDate||D,f.fileLoaderType=L;var t=u.response?u.response.responseURL:null,n=u.response?u.response.status:null,r=u.response&&u.response.getAllResponseHeaders?u.response.getAllResponseHeaders():u.response?u.response.responseHeaders:null,i=r&&R.get().streaming.cmsd&&R.get().streaming.cmsd.enabled?c.parseResponseHeaders(r,f.mediaType):null;E.addHttpRequest(f,t,n,r,e?p:null,i)},k=function(e){N=!1,F(e),f.type===C.w.MPD_TYPE&&(E.addManifestUpdate(f),I.trigger(l.Z.MANIFEST_LOADING_FINISHED,{request:f}))},U=function(){if(P&&(clearTimeout(P),P=null),-1!==n.indexOf(u)&&(n.splice(n.indexOf(u),1),N))if(k(!1),t>0){try{R.get().streaming.utcSynchronization.enableBackgroundSyncAfterSegmentDownloadError&&f.type===C.w.MEDIA_SEGMENT_TYPE&&v.getRetryAttemptsForType(C.w.MEDIA_SEGMENT_TYPE)===t&&I.trigger(l.Z.ATTEMPT_BACKGROUND_SYNC)}catch(e){}t--;var r={config:e};i.push(r),r.timeout=setTimeout((function(){-1!==i.indexOf(r)&&(i.splice(i.indexOf(r),1),w(e,t))}),v.getRetryIntervalsForType(f.type))}else{if(f.type===C.w.MSS_FRAGMENT_INFO_SEGMENT_TYPE)return;y.error(new S.Z(o[f.type],f.url+" is not available",{request:f,response:u.response})),e.error&&e.error(f,"error",u.response.statusText,u.response),e.complete&&e.complete(f,u.response.statusText)}};f.hasOwnProperty("availabilityTimeComplete")&&!1===f.availabilityTimeComplete&&window.fetch&&"arraybuffer"===f.responseType&&f.type===C.w.MEDIA_SEGMENT_TYPE?((x=fe(m).create({requestModifier:_,lowLatencyThroughputModel:g,boxParser:T})).setup({dashMetrics:E}),L=a.Z.FILE_LOADER_TYPES.FETCH):(x=(0,se.Z)(m).create({requestModifier:_}),L=a.Z.FILE_LOADER_TYPES.XHR);var Z=null,B=_.modifyRequestURL?_.modifyRequestURL(f.url):f.url;if(R.get().streaming.cmcd&&R.get().streaming.cmcd.enabled){var G=R.get().streaming.cmcd.mode;if(G===a.Z.CMCD_MODE_QUERY){var q=function(e){try{var t=[],n=s.getQueryParameter(e);return n&&t.push(n),t}catch(e){return[]}}(f);B=Be.Z.addAditionalQueryParameterToUrl(B,q)}else G===a.Z.CMCD_MODE_HEADER&&(Z=s.getHeaderParameters(f))}var Y=d.getXHRWithCredentialsForType(f.type);if(f.queryParams){var j=Object.keys(f.queryParams).map((function(e){return{key:e,value:f.queryParams[e]}}));B=Be.Z.addAditionalQueryParameterToUrl(B,j)}f.url=B,u={url:B,method:C.w.GET,withCredentials:Y,request:f,onload:function(){u.response.status>=200&&u.response.status<=299&&(k(!0),e.success&&e.success(u.response.response,u.response.statusText,u.response.responseURL),e.complete&&e.complete(f,u.response.statusText))},onend:U,onerror:U,progress:function(t){var n=new Date;b&&(b=!1,(!t.lengthComputable||t.lengthComputable&&t.total!==t.loaded)&&(f.firstByteDate=n)),t.lengthComputable&&(f.bytesLoaded=t.loaded,f.bytesTotal=t.total),t.noTrace||(p.push({s:O,d:t.time?t.time:n.getTime()-O.getTime(),b:[t.loaded?t.loaded-M:0]}),O=n,M=t.loaded),P&&(clearTimeout(P),P=null),R.get().streaming.fragmentRequestProgressTimeout>0&&(P=setTimeout((function(){h.warn("Abort request "+u.url+" due to progress timeout"),u.response.onabort=null,u.loader.abort(u),U()}),R.get().streaming.fragmentRequestProgressTimeout)),e.progress&&t&&e.progress(t)},onabort:function(){F(!0),P&&(clearTimeout(P),P=null),e.abort&&e.abort(f)},ontimeout:function(e){var t;if(e.lengthComputable){var n=e.loaded/e.total*100;t="Request timeout: loaded: "+e.loaded+", out of: "+e.total+" : "+n.toFixed(3)+"% Completed"}else t="Request timeout: non-computable download size";h.warn(t)},loader:x,timeout:A,headers:Z};var H=(new Date).getTime();if(isNaN(f.delayLoadingTime)||H>=f.delayLoadingTime)n.push(u),x.load(u);else{var V={httpRequest:u};r.push(V),V.delayTimeout=setTimeout((function(){if(-1!==r.indexOf(V)){r.splice(r.indexOf(V),1);try{D=new Date,O=D,n.push(V.httpRequest),x.load(V.httpRequest)}catch(e){V.httpRequest.onerror()}}}),f.delayLoadingTime-H)}}return t={load:function(e){e.request?w(e,v.getRetryAttemptsForType(e.request.type)):e.error&&e.error(e.request,"error")},abort:function(){i.forEach((function(e){clearTimeout(e.timeout),e.config.request&&e.config.abort&&e.config.abort(e.config.request)})),i=[],r.forEach((function(e){return clearTimeout(e.delayTimeout)})),r=[],n.forEach((function(e){e.request.type!==C.w.MSS_FRAGMENT_INFO_SEGMENT_TYPE&&(e.onloadend=e.onerror=e.onprogress=void 0,e.loader.abort(e))})),n=[]}},h=(0,f.Z)(m).getInstance().getLogger(t),n=[],r=[],i=[],s=je(m).getInstance(),c=lt(m).getInstance(),g=ft(m).getInstance(),d=(0,dt.Z)(m).getInstance(),gt(p={},C.w.MPD_TYPE,b.DOWNLOAD_ERROR_ID_MANIFEST_CODE),gt(p,C.w.XLINK_EXPANSION_TYPE,b.DOWNLOAD_ERROR_ID_XLINK_CODE),gt(p,C.w.INIT_SEGMENT_TYPE,b.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE),gt(p,C.w.MEDIA_SEGMENT_TYPE,b.DOWNLOAD_ERROR_ID_CONTENT_CODE),gt(p,C.w.INDEX_SEGMENT_TYPE,b.DOWNLOAD_ERROR_ID_CONTENT_CODE),gt(p,C.w.BITSTREAM_SWITCHING_SEGMENT_TYPE,b.DOWNLOAD_ERROR_ID_CONTENT_CODE),gt(p,C.w.OTHER_TYPE,b.DOWNLOAD_ERROR_ID_CONTENT_CODE),o=p,t}ht.__dashjs_factory_name="HTTPLoader";var pt=c.Z.getClassFactory(ht);function mt(){var e;function t(){e={}}function n(){t()}return n(),{getLoader:function(t){for(var n in e)if(e.hasOwnProperty(n)&&t.startsWith(n))return e[n];return pt},registerLoader:function(t,n){e[t]=n},unregisterLoader:function(t){e[t]&&delete e[t]},unregisterAllLoader:t,reset:n}}mt.__dashjs_factory_name="SchemeLoaderFactory";var yt=c.Z.getSingletonFactory(mt);function Et(e){e=e||{};var t,n,r=this.context;return t=yt(r).getInstance(),{load:function(i){if(!n){var a=t.getLoader(i&&i.request?i.request.url:null);n=a(r).create({errHandler:e.errHandler,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,dashMetrics:e.dashMetrics,boxParser:e.boxParser?e.boxParser:null,constants:e.constants?e.constants:null,dashConstants:e.dashConstants?e.dashConstants:null,urlUtils:e.urlUtils?e.urlUtils:null,requestTimeout:isNaN(e.requestTimeout)?0:e.requestTimeout,errors:e.errors})}n.load(i)},abort:function(){n&&n.abort()}}}Et.__dashjs_factory_name="URLLoader";var vt=c.Z.getClassFactory(Et);function _t(e){return _t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_t(e)}function Tt(e,t){return Tt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Tt(e,t)}function St(e,t){return!t||"object"!==_t(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function bt(e){return bt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},bt(e)}var At=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Tt(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=bt(t);if(n){var i=bt(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return St(this,e)});function i(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(t=r.call(this,e)).checkForExistenceOnly=!0,t}return i}(p.Z);function It(e){e=e||{};var t,n,r=this.context,i=e.eventBus,o=e.events,s=e.urlUtils,u=e.errors,l=e.streamId;return t={checkForExistence:function(e){var t=function(t){i.trigger(o.CHECK_FOR_EXISTENCE_COMPLETED,{request:e,exists:t})};if(e){var r=new At(e.url);n.load({request:r,success:function(){t(!0)},error:function(){t(!1)}})}else t(!1)},load:function(e){var r=function(n,r){i.trigger(o.LOADING_COMPLETED,{request:e,response:n||null,error:r||null,sender:t})};e?n.load({request:e,progress:function(n){i.trigger(o.LOADING_PROGRESS,{request:e,stream:n.stream,streamId:l}),n.data&&i.trigger(o.LOADING_DATA_PROGRESS,{request:e,response:n.data||null,error:null,sender:t})},success:function(e){r(e)},error:function(e,t,n){r(void 0,new S.Z(u.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE,n,t))},abort:function(e){e&&i.trigger(o.LOADING_ABANDONED,{mediaType:e.mediaType,request:e,sender:t})}}):r(void 0,new S.Z(u.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE,u.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE))},abort:function(){n&&n.abort()},reset:function(){n&&(n.abort(),n=null)}},n=vt(r).create({errHandler:e.errHandler,errors:u,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,urlUtils:s,constants:a.Z,boxParser:e.boxParser,dashConstants:e.dashConstants,requestTimeout:e.settings.get().streaming.fragmentRequestTimeout}),t}It.__dashjs_factory_name="FragmentLoader";var Rt=c.Z.getClassFactory(It);function wt(){return{modifyResponseAsync:function(e){return Promise.resolve(e)}}}wt.__dashjs_factory_name="SegmentResponseModifier";var Nt=c.Z.getSingletonFactory(wt);function Ct(e){e=e||{};var t,n,r,i=this.context,o=(0,u.Z)(i).getInstance(),s=e.errHandler,c=e.mediaPlayerModel,g=e.dashMetrics,h=(0,f.Z)(i).getInstance(),p=Nt(i).getInstance(),m=e.streamInfo;function y(){return m.id}function E(){for(var e in r)r[e].reset();r={}}function v(e){if(e.sender){var t=e.request,r=e.response,i=t.isInitializationRequest(),s=t.mediaInfo.streamInfo;if(e.error&&(t.mediaType===a.Z.AUDIO||t.mediaType===a.Z.VIDEO||t.mediaType===a.Z.TEXT&&t.mediaInfo.isFragmented)&&o.trigger(l.Z.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD,{entry:e.request.serviceLocation}),r&&s){var u=function(e,t,n,r){var i=new oe;return i.streamId=n,i.mediaInfo=t.mediaInfo,i.segmentType=t.type,i.start=t.startTime,i.duration=t.duration,i.end=i.start+i.duration,i.bytes=e,i.index=t.index,i.quality=t.quality,i.representationId=t.representationId,i.endFragment=r,i}(r,t,m.id,e.type!==l.Z.FRAGMENT_LOADING_PROGRESS);p.modifyResponseAsync(u).then((function(e){o.trigger(i?l.Z.INIT_FRAGMENT_LOADED:l.Z.MEDIA_FRAGMENT_LOADED,{chunk:e,request:t},{streamId:s.id,mediaType:t.mediaType})})).catch((function(e){n.error(e),o.trigger(i?l.Z.INIT_FRAGMENT_LOADED:l.Z.MEDIA_FRAGMENT_LOADED,{chunk:u,request:t},{streamId:s.id,mediaType:t.mediaType})}))}else n.warn("No "+t.mediaType+" bytes to push or stream is inactive.")}}return t={getStreamId:y,getModel:function(t){var n=r[t];return n||(n=T(i).create({streamInfo:m,type:t,dashMetrics:g,fragmentLoader:Rt(i).create({dashMetrics:g,mediaPlayerModel:c,errHandler:s,requestModifier:(0,X.Z)(i).getInstance(),settings:e.settings,boxParser:e.boxParser,eventBus:o,events:l.Z,errors:w,dashConstants:e.dashConstants,urlUtils:e.urlUtils,streamId:y()}),debug:h,eventBus:o,events:l.Z}),r[t]=n),n},reset:function(){o.off(d.Z.FRAGMENT_LOADING_COMPLETED,v,this),o.off(d.Z.FRAGMENT_LOADING_PROGRESS,v,this),E()}},n=h.getLogger(t),E(),o.on(d.Z.FRAGMENT_LOADING_COMPLETED,v,t),o.on(d.Z.FRAGMENT_LOADING_PROGRESS,v,t),t}Ct.__dashjs_factory_name="FragmentController";var Dt=c.Z.getClassFactory(Ct),Ot=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=null,this.width=null,this.height=null,this.x=null,this.y=null},Mt=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mediaType=null,this.bitrate=null,this.width=null,this.height=null,this.scanType=null,this.qualityIndex=NaN};function Pt(e){var t,n,r=this.context,i=e.streamInfo;function o(e){n.setTrackByIndex(e)}function s(){n&&n.reset()}return t={getStreamId:function(){return i.id},initialize:function(){n.addTracks();var e=n.getTracks();e&&e.length>0&&o(0)},provide:function(e,t){if("function"==typeof t){var r,i,a=n.getCurrentTrack();if(!a||a.segmentDuration<=0||null==e)t(null);else{(i=n.getThumbnailRequestForTime(e))&&(a.segmentDuration=i.duration),r=e%a.segmentDuration;var o=Math.floor(r*a.tilesHor*a.tilesVert/a.segmentDuration),s=new Ot;if(s.width=Math.floor(a.widthPerTile),s.height=Math.floor(a.heightPerTile),s.x=Math.floor(o%a.tilesHor)*a.widthPerTile,s.y=Math.floor(o/a.tilesHor)*a.heightPerTile,"readThumbnail"in a)return a.readThumbnail(e,(function(e){s.url=e,t(s)}));if(i)s.url=i.url,a.segmentDuration=NaN;else{var u=Math.floor(e/a.segmentDuration);s.url=function(e,t){var n=t+e.startNumber,r=(0,H.vi)(e.templateUrl,"Number",n);return r=(0,H.vi)(r,"Time",(n-1)*e.segmentDuration*e.timescale),r=(0,H.vi)(r,"Bandwidth",e.bandwidth),(0,H.eR)(r)}(a,u)}t(s)}}},setTrackByIndex:o,getCurrentTrackIndex:function(){return n.getCurrentTrackIndex()},getBitrateList:function(){var e=n.getTracks(),t=0;return e.map((function(e){var n=new Mt;return n.mediaType=a.Z.IMAGE,n.qualityIndex=t++,n.bitrate=e.bitrate,n.width=e.width,n.height=e.height,n}))},reset:s},s(),n=(0,Me.Z)(r).create({streamInfo:i,adapter:e.adapter,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:e.debug,eventBus:e.eventBus,events:e.events,dashConstants:e.dashConstants,dashMetrics:e.dashMetrics,segmentBaseController:e.segmentBaseController}),t}Pt.__dashjs_factory_name="ThumbnailController";var Lt=c.Z.getClassFactory(Pt),xt=n(7417);function Ft(e){var t;e=e||{};var n=[],r=(0,u.Z)(this.context).getInstance(),i=e.updateEventName,a=e.addBlacklistEventName;function o(e){-1===n.indexOf(e)&&(n.push(e),r.trigger(i,{entry:e}))}return t={add:o,contains:function(e){return!!(n.length&&e&&e.length)&&-1!==n.indexOf(e)},reset:function(){n=[]}},a&&r.on(a,(function(e){o(e.entry)}),t),t}Ft.__dashjs_factory_name="BlackListController";var kt=c.Z.getClassFactory(Ft),Ut=[a.Z.VIDEO,a.Z.AUDIO,a.Z.TEXT,a.Z.MUXED,a.Z.IMAGE];function Zt(e){e=e||{};var t,n,r,i,s,c,d,g,h,p,m,y,E,v,_,T,b,A,I=this.context,R=(0,u.Z)(I).getInstance(),N=(0,Q.Z)(I).getInstance(),C=e.manifestModel,D=e.mediaPlayerModel,O=e.dashMetrics,M=e.manifestUpdater,P=e.adapter,L=e.timelineConverter,x=e.capabilities,F=e.errHandler,k=e.abrController,U=e.playbackController,Z=e.eventController,B=e.mediaController,G=e.protectionController,q=e.textController,Y=e.videoModel,j=e.streamInfo,H=e.settings;function V(e,t){return new Promise((function(i,o){ne(),p=!0,ie();var s=Y.getElement(),u=[];Ut.forEach((function(t){(t!==a.Z.TEXT||e)&&(t!==a.Z.VIDEO||!s||s&&/^VIDEO$/i.test(s.nodeName))&&u.push(K(t,e))})),Promise.all(u).then((function(){return e=t,new Promise((function(t){var n={},i=r.map((function(t){return t.createBufferSinks(e)}));Promise.all(i).then((function(e){e.forEach((function(e){e&&(n[e.getType()]=e)})),t(n)})).catch((function(){t(n)}))}));var e})).then((function(t){if(p=!1,0===r.length){var a="No streams to play.";F.error(new S.Z(w.MANIFEST_ERROR_ID_NOSTREAMS_CODE,a,C.getValue())),n.fatal(a)}else oe();e&&q.createTracks(j),i(t)})).catch((function(e){o(e)}))}))}function K(t,i){var s,u=P.getAllMediaInfoForType(j,t),c=[],f=null;if(!u||0===u.length)return n.info("No "+t+" data."),Promise.resolve();t===a.Z.VIDEO&&(d=!0),t===a.Z.AUDIO&&(g=!0);for(var h=0,p=u.length;h<p;h++)f=u[h],t===a.Z.TEXT&&f.isEmbedded&&(q.addEmbeddedTrack(j,f),c.push(f)),z(f)&&B.addTrack(f);if(c.length>0&&(B.setInitialMediaSettingsForType(t,j),q.addMediaInfosToBuffer(j,t,c)),u=u.filter((function(e){return!e.isEmbedded})),0===u.length)return Promise.resolve();if(t===a.Z.IMAGE)return(y=Lt(I).create({streamInfo:j,adapter:P,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:T,eventBus:R,events:l.Z,dashConstants:o.Z,dashMetrics:e.dashMetrics,segmentBaseController:e.segmentBaseController})).initialize(),Promise.resolve();R.trigger(l.Z.STREAM_INITIALIZING,{streamInfo:j,mediaInfo:f}),B.setInitialMediaSettingsForType(t,j);var v=function(t,n){var i=t&&t.length>0?t[0]:null,o=m.getModel(i?i.type:null),s=i?i.type:null,u=i?i.mimeType:null,l=i?i.isFragmented:null,c=ae(I).create({streamInfo:j,type:s,mimeType:u,timelineConverter:L,adapter:P,manifestModel:C,mediaPlayerModel:D,fragmentModel:o,dashMetrics:e.dashMetrics,baseURLController:e.baseURLController,segmentBaseController:e.segmentBaseController,abrController:k,playbackController:U,mediaController:B,textController:q,errHandler:F,settings:H,boxParser:_,segmentBlacklistController:E});c.initialize(n,d,l),r.push(c);for(var f=0;f<t.length;f++)c.addMediaInfo(t[f]);return s===a.Z.TEXT&&q.addMediaInfosToBuffer(j,s,t,o),c}(u,i);return(s=B.getCurrentTrackFor(t,j.id))?(k.updateTopQualityIndex(s),v.selectMediaInfo(t===a.Z.TEXT&&s.isEmbedded?u[0]:s)):Promise.resolve()}function z(e){var t,r=e?e.type:null;return r===a.Z.MUXED?(t="Multiplexed representations are intentionally not supported, as they are not compliant with the DASH-AVC/264 guidelines",n.fatal(t),F.error(new S.Z(w.MANIFEST_ERROR_ID_MULTIPLEXED_CODE,t,C.getValue())),!1):!(r!==a.Z.TEXT&&r!==a.Z.IMAGE&&e.contentProtection&&!x.supportsEncryptedMedia()&&(F.error(new S.Z(w.CAPABILITY_MEDIAKEYS_ERROR_CODE,w.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE)),1))}function W(e){for(var t=r?r.length:0,n=0;n<t;n++){var i=r[n].getFragmentModel();i.abortRequests(),i.resetInitialSettings(),r[n].reset(!1,e)}q&&q.deactivateStream(j),r=[],s=!1,c=!1,me(!1),J(!1),R.trigger(l.Z.STREAM_DEACTIVATED,{streamInfo:j})}function X(e){W(e),i=!1,d=!1,g=!1,h={},p=!1,b=!1,A=[]}function J(e){b=e}function $(){return j?j.start:NaN}function ee(){return j?j.id:null}function te(){return j}function ne(){if(!Y||!k)throw new Error(a.Z.MISSING_CONFIG_ERROR)}function re(e){e.error&&(F.error(e.error),n.fatal(e.error.message))}function ie(){if(Z){var e=P.getEventsFor(j);e&&e.length>0&&Z.addInlineEvents(e,j.id)}}function oe(){for(var e=r.length,t=h.audio||h.video?new S.Z(w.DATA_UPDATE_FAILED_ERROR_CODE,w.DATA_UPDATE_FAILED_ERROR_MESSAGE):null,n=0;n<e;n++)if(r[n].isUpdating()||p)return;if(G){G.clearMediaInfoArray();for(var o=0;o<e&&r[o];o++){var s=r[o].getType(),u=r[o].getMediaInfo();if(s===a.Z.AUDIO||s===a.Z.VIDEO||s===a.Z.TEXT&&u.isFragmented){var c=r[o].getMediaInfo();c&&G.initializeForMedia(c)}}G.handleKeySystemFromManifest()}t?F.error(t):i||(i=!0,Y.waitForReadyState(a.Z.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,(function(){R.trigger(l.Z.STREAM_INITIALIZED,{streamInfo:j})})))}function se(){var e=de(),t=e.length;if(0!==t){for(var r=0;r<t;r++)if(!e[r].isBufferingCompleted()&&(e[r].getType()===a.Z.AUDIO||e[r].getType()===a.Z.VIDEO))return void n.debug("onBufferingCompleted - One streamProcessor has finished but",e[r].getType(),"one is not buffering completed");n.debug("onBufferingCompleted - trigger STREAM_BUFFERING_COMPLETED"),c=!0,R.trigger(l.Z.STREAM_BUFFERING_COMPLETED,{streamInfo:j},{streamInfo:j})}else n.warn("onBufferingCompleted - can\'t trigger STREAM_BUFFERING_COMPLETED because no streamProcessor is defined")}function ue(e){h[e.mediaType]=e.error,oe()}function le(e){Z&&Z.addInbandEvents(e.events,j.id)}function ce(e){return e&&e.type?fe(e.type):null}function fe(e){return e?de().filter((function(t){return t.getType()===e}))[0]:null}function de(){for(var e,t,n=[],i=0;i<r.length;i++)(e=(t=r[i]).getType())!==a.Z.AUDIO&&e!==a.Z.VIDEO&&e!==a.Z.TEXT||n.push(t);return n}function ge(e,t){var n=te(),r=t.getStreamInfo();if(!r||!n)return!0;var i=P.getAdaptationForType(r.index,e,r),a=P.getAdaptationForType(n.index,e,n);return i&&a?!(!he(a)&&he(i)):!i&&!a}function he(e){return!!e&&!!(e.ContentProtection||e.Representation_asArray&&e.Representation_asArray.length>0&&e.Representation_asArray[0].ContentProtection)}function pe(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e||!e.hasOwnProperty("getStreamInfo"))return!1;var r=e.getStreamInfo(),i=n?n.getStreamInfo():te();if(!r||!i)return!1;var a=P.getAdaptationForType(r.index,t,r),o=P.getAdaptationForType(i.index,t,i);if(!a||!o)return!a&&!o;var s=a&&o&&a.mimeType===o.mimeType,u=o.Representation_asArray.map((function(e){return e.codecs})),l=a.Representation_asArray.map((function(e){return e.codecs})),c=l.some((function(e){return u.indexOf(e)>-1})),f=l.some((function(e){return u.some((function(t){return x.codecRootCompatibleWithCodec(t,e)}))}));return c||f&&s}function me(e){v=e}function ye(){return v}return t={initialize:function(){R.on(l.Z.BUFFERING_COMPLETED,se,t),R.on(l.Z.DATA_UPDATE_COMPLETED,ue,t),R.on(l.Z.INBAND_EVENTS,le,t),G&&(R.on(l.Z.KEY_ERROR,re,t),R.on(l.Z.SERVER_CERTIFICATE_UPDATED,re,t),R.on(l.Z.LICENSE_REQUEST_COMPLETE,re,t),R.on(l.Z.KEY_SYSTEM_SELECTED,re,t),R.on(l.Z.KEY_SESSION_CREATED,re,t),R.on(l.Z.KEY_STATUSES_CHANGED,re,t)),q.initializeForStream(j),R.trigger(l.Z.STREAM_UPDATED,{streamInfo:j})},getStreamId:function(){return j?j.id:null},activate:function(e,t){return new Promise((function(n,r){if(!s)return ye()?(s=!0,R.trigger(l.Z.STREAM_ACTIVATED,{streamInfo:j}),void n(t)):void function(e,t){return V(e,t)}(e,t).then((function(e){s=!0,R.trigger(l.Z.STREAM_ACTIVATED,{streamInfo:j}),n(e)})).catch((function(e){r(e)}));n(t)}))},deactivate:W,getIsActive:function(){return s},getDuration:function(){return j?j.duration:NaN},getStartTime:$,getId:ee,getStreamInfo:te,getHasAudioTrack:function(){return g},getHasVideoTrack:function(){return d},startPreloading:function(e,t){return new Promise((function(i,a){ye()?a():(n.info("[startPreloading] Preloading next stream with id ".concat(ee())),me(!0),V(e,t).then((function(){for(var e=0;e<r.length&&r[e];e++)r[e].setExplicitBufferingTime($()),r[e].getScheduleController().startScheduleTimer();i()})).catch((function(){me(!1),a()})))}))},initializeForTextWithMediaSource:function(e){return new Promise((function(t,n){K(a.Z.TEXT,e).then((function(){return(e=fe(a.Z.TEXT))?e.createBufferSinks():Promise.resolve();var e})).then((function(){q.createTracks(j),t()})).catch((function(e){n(e)}))}))},getThumbnailController:function(){return y},getBitrateListFor:function(e){if(ne(),e===a.Z.IMAGE)return y?y.getBitrateList():[];var t=function(e){for(var t=null,n=0;n<r.length;n++)if((t=r[n]).getType()===e)return t.getMediaInfo();return null}(e);return k.getBitrateList(t)},updateData:function(e){return new Promise((function(t){p=!0,j=e,Z&&ie();for(var n=[],i=0,a=r.length;i<a;i++){var o=r[i],s=o.getMediaInfo();n.push(o.updateStreamInfo(j));var u=P.getAllMediaInfoForType(j,o.getType());if(u=u.filter((function(e){return!e.isEmbedded}))){o.clearMediaInfoArray();for(var c=0;c<u.length;c++){var f=u[c];o.addMediaInfo(u[c]),P.areMediaInfosEqual(s,f)&&(k.updateTopQualityIndex(f),n.push(o.selectMediaInfo(f)))}}}Promise.all(n).then((function(){for(n=[];A.length>0;){var e=A.pop(),t=e.newMediaInfo,r=ce(e.oldMediaInfo);if(!r)return;n.push(r.prepareTrackSwitch()),n.push(r.selectMediaInfo(t))}return Promise.all(n)})).then((function(){p=!1,oe(),R.trigger(l.Z.STREAM_UPDATED,{streamInfo:j}),t()}))}))},reset:function(e){m&&(m.reset(),m=null),k&&j&&k.clearDataForStream(j.id),E&&(E.reset(),E=null),X(e),j=null,R.off(l.Z.DATA_UPDATE_COMPLETED,ue,t),R.off(l.Z.BUFFERING_COMPLETED,se,t),R.off(l.Z.INBAND_EVENTS,le,t),G&&(R.off(l.Z.KEY_ERROR,re,t),R.off(l.Z.SERVER_CERTIFICATE_UPDATED,re,t),R.off(l.Z.LICENSE_REQUEST_COMPLETE,re,t),R.off(l.Z.KEY_SYSTEM_SELECTED,re,t),R.off(l.Z.KEY_SESSION_CREATED,re,t),R.off(l.Z.KEY_STATUSES_CHANGED,re,t))},getProcessors:de,setMediaSource:function(e){return new Promise((function(t,i){for(var a=[],o=0;o<r.length;)z(r[o].getMediaInfo())?(a.push(r[o].setMediaSource(e)),o++):(r[o].reset(),r.splice(o,1));Promise.all(a).then((function(){for(var e=0;e<r.length;e++)r[e].dischargePreBuffer();if(0===r.length){var i="No streams to play.";F.error(new S.Z(w.MANIFEST_ERROR_ID_NOSTREAMS_CODE,i+"nostreams",C.getValue())),n.fatal(i)}t()})).catch((function(e){n.error(e),i(e)}))}))},isMediaCodecCompatible:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return pe(e,a.Z.VIDEO,t)&&pe(e,a.Z.AUDIO,t)},isProtectionCompatible:function(e){return!e||ge(a.Z.VIDEO,e)&&ge(a.Z.AUDIO,e)},getPreloaded:ye,getIsEndedEventSignaled:function(){return b},setIsEndedEventSignaled:J,getAdapter:function(){return P},getHasFinishedBuffering:function(){return c},setPreloaded:me,startScheduleControllers:function(){for(var e=r.length,t=0;t<e&&r[t];t++)r[t].getScheduleController().startScheduleTimer()},prepareTrackChange:function(e){if(s&&j){c=!1;var t=e.newMediaInfo,r=C.getValue();P.setCurrentMediaInfo(j.id,t.type,t);var i=ce(t);if(i){var o=U.getTime();n.info("Stream - Process track changed at current time "+o),r.refreshManifestOnSwitchTrack?(A.push(e),M.getIsUpdating()||(n.debug("Stream - Refreshing manifest for switch track"),M.refreshManifest())):i.selectMediaInfo(t).then((function(){t.type!==a.Z.VIDEO&&t.type!==a.Z.AUDIO||k.updateTopQualityIndex(t),i.prepareTrackSwitch()}))}}},prepareQualityChange:function(e){var t=fe(e.mediaType);t&&t.prepareQualityChange(e)}},function(){try{T=(0,f.Z)(I).getInstance(),n=T.getLogger(t),X(),_=(0,xt.Z)(I).getInstance(),E=kt(I).create({updateEventName:l.Z.SEGMENT_LOCATION_BLACKLIST_CHANGED,addBlacklistEventName:l.Z.SEGMENT_LOCATION_BLACKLIST_ADD}),m=Dt(I).create({streamInfo:j,mediaPlayerModel:D,dashMetrics:O,errHandler:F,settings:H,boxParser:_,dashConstants:o.Z,urlUtils:N})}catch(e){throw e}}(),t}Zt.__dashjs_factory_name="Stream";var Bt=c.Z.getClassFactory(Zt),Gt=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t||null,this.type=C.w.CONTENT_STEERING_TYPE,this.responseType="json"},qt=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.version=null,this.ttl=300,this.reloadUri=null,this.pathwayPriority=[],this.pathwayClones=[]};function Yt(){var e,t,n,r,i,a,s,u,l,c,g,h,p,m,y,E=this.context,v=(0,Q.Z)(E).getInstance();function _(e){I(e,"baseUrl")}function T(e){I(e,"location")}function S(e){if(e&&e.request&&e.request.serviceLocation&&e.request.requestStartDate&&e.request.requestEndDate&&!isNaN(e.request.bytesTotal)){var t=e.request.serviceLocation,n=e.request.requestEndDate.getTime()-e.request.requestStartDate.getTime();A(t,parseInt(8*e.request.bytesTotal/n*1e3))}}function b(e){e&&e.httpRequest&&e.httpRequest._serviceLocation&&!isNaN(e.throughput)&&A(e.httpRequest._serviceLocation,1e3*e.throughput)}function A(e,t){i[e]||(i[e]=[]),i[e].push(t),i[e].length>4&&i[e].shift()}function I(e,t){if(e&&e.request&&e.request.serviceLocation){var n=e.request.serviceLocation;-1===r[t].all.indexOf(n)&&r[t].all.push(n),r[t].current=n}}function R(){var e=g.getValue(),t=y.getContentSteering(e);return t||(t=p.getServiceDescriptionSettings().contentSteering),t}function N(){return new Promise((function(e){try{var a=R();if(!a||!a.serverUrl)return void e();var u=function(e){var t=e.serverUrl;n&&n.reloadUri&&(t=v.isRelative(n.reloadUri)?v.resolve(n.reloadUri,e.serverUrl):n.reloadUri);var a=[],o=r.baseUrl.all.concat(r.location.all);if(o.length>0){var s=o.map((function(e){var t=function(e){if(!e||!i[e]||0===i[e].length)return-1;var t=i[e].reduce((function(e,t){return e+t}))/i[e].length;return parseInt(t)}(e);return{serviceLocation:e,throughput:t}}));s.sort((function(e,t){return t.throughput-e.throughput}));var u="",l="";s.forEach((function(e,t){0!==t&&(u="".concat(u,","),e.throughput>-1&&(l="".concat(l,","))),u="".concat(u).concat(e.serviceLocation),e.throughput>-1&&(l="".concat(l).concat(e.throughput))})),a.push({key:"_DASH_pathway",value:\'"\'.concat(u,\'"\')}),a.push({key:"_DASH_throughput",value:l})}return t=Be.Z.addAditionalQueryParameterToUrl(t,a)}(a),l=new Gt(u);s.load({request:l,success:function(t){!function(e){e&&e[o.Z.CONTENT_STEERING_RESPONSE.VERSION]&&1===parseInt(e[o.Z.CONTENT_STEERING_RESPONSE.VERSION])&&((n=new qt).version=e[o.Z.CONTENT_STEERING_RESPONSE.VERSION],e[o.Z.CONTENT_STEERING_RESPONSE.TTL]&&!isNaN(e[o.Z.CONTENT_STEERING_RESPONSE.TTL])&&(n.ttl=e[o.Z.CONTENT_STEERING_RESPONSE.TTL]),e[o.Z.CONTENT_STEERING_RESPONSE.RELOAD_URI]&&(n.reloadUri=e[o.Z.CONTENT_STEERING_RESPONSE.RELOAD_URI]),e[o.Z.CONTENT_STEERING_RESPONSE.PATHWAY_PRIORITY]&&(n.pathwayPriority=e[o.Z.CONTENT_STEERING_RESPONSE.PATHWAY_PRIORITY]),e[o.Z.CONTENT_STEERING_RESPONSE.PATHWAY_CLONES]&&(n.pathwayClones=e[o.Z.CONTENT_STEERING_RESPONSE.PATHWAY_CLONES],n.pathwayClones=n.pathwayClones.filter((function(e){return function(e){return e[o.Z.CONTENT_STEERING_RESPONSE.BASE_ID]&&e[o.Z.CONTENT_STEERING_RESPONSE.ID]&&e[o.Z.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT]&&e[o.Z.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT][o.Z.CONTENT_STEERING_RESPONSE.HOST]}(e)}))),O())}(t),m.trigger(d.Z.CONTENT_STEERING_REQUEST_COMPLETED,{currentSteeringResponseData:n,url:u}),e()},error:function(r,i,a,o){!function(e,r){try{switch(t.warn("Error fetching data from content steering server",e),r.status){case 410:break;case 429:var i=r&&r.getResponseHeader?r.getResponseHeader("retry-after"):null;null!==i&&(n||(n={}),n.ttl=parseInt(i)),O();break;default:O()}}catch(e){t.error(e)}}(r,o),e(r)},complete:function(){r.baseUrl.all=C(r.baseUrl),r.location.all=C(r.location)}})}catch(t){e(t)}}))}function C(e){return e.all&&0!==e.all.length&&e.current?e.all.filter((function(t){return t===e.current})):[]}function D(e){try{var r=[];return e&&0!==e.length&&n&&n.pathwayClones&&0!==n.pathwayClones.length?(n.pathwayClones.forEach((function(t){var n=e.filter((function(e){return t[o.Z.CONTENT_STEERING_RESPONSE.BASE_ID]===e.serviceLocation})),i=null;if(n&&n.length>0&&(i=n[0]),i){var a=new URL(i.url),s=t[o.Z.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT][o.Z.CONTENT_STEERING_RESPONSE.HOST];s=Be.Z.stringHasProtocol(s)?s:"".concat(a.protocol,"//").concat(s);var u={synthesizedUrl:"".concat(s).concat(a.pathname),serviceLocation:t[o.Z.CONTENT_STEERING_RESPONSE.ID],queryParams:t[o.Z.CONTENT_STEERING_RESPONSE.URI_REPLACEMENT][o.Z.CONTENT_STEERING_RESPONSE.PARAMS],reference:i};r.push(u)}})),r):r}catch(e){return t.error(e),[]}}function O(){n&&n.ttl&&!isNaN(n.ttl)&&(a&&clearTimeout(a),a=setTimeout((function(){N()}),1e3*n.ttl))}function M(){a&&clearTimeout(a),a=null}function P(){n=null,i={},r={baseUrl:{current:null,all:[]},location:{current:null,all:[]}},M()}return e={reset:function(){P(),m.off(d.Z.FRAGMENT_LOADING_STARTED,_,e),m.off(d.Z.MANIFEST_LOADING_STARTED,T,e),m.off(d.Z.MANIFEST_LOADING_FINISHED,S,e),m.off(d.Z.THROUGHPUT_MEASUREMENT_STORED,b,e)},setConfig:function(e){e&&(e.adapter&&(y=e.adapter),e.errHandler&&(u=e.errHandler),e.dashMetrics&&(l=e.dashMetrics),e.mediaPlayerModel&&(c=e.mediaPlayerModel),e.requestModifier&&(h=e.requestModifier),e.manifestModel&&(g=e.manifestModel),e.serviceDescriptionController&&(p=e.serviceDescriptionController),e.eventBus&&(m=e.eventBus))},loadSteeringData:N,getCurrentSteeringResponseData:function(){return n},shouldQueryBeforeStart:function(){var e=R();return!!e&&e.queryBeforeStart},getSteeringDataFromManifest:R,stopSteeringRequestTimer:M,getSynthesizedBaseUrlElements:function(e){try{return D(e).map((function(e){var t=new Se(e.synthesizedUrl,e.serviceLocation);return t.queryParams=e.queryParams,t.dvb_priority=e.reference.dvb_priority,t.dvb_weight=e.reference.dvb_weight,t.availabilityTimeOffset=e.reference.availabilityTimeOffset,t.availabilityTimeComplete=e.reference.availabilityTimeComplete,t}))}catch(e){return t.error(e),[]}},getSynthesizedLocationElements:function(e){try{return D(e).map((function(e){var t=new Pe(e.synthesizedUrl,e.serviceLocation);return t.queryParams=e.queryParams,t}))}catch(e){return t.error(e),[]}},initialize:function(){s=vt(E).create({errHandler:u,dashMetrics:l,mediaPlayerModel:c,requestModifier:h,errors:w}),m.on(d.Z.FRAGMENT_LOADING_STARTED,_,e),m.on(d.Z.MANIFEST_LOADING_STARTED,T,e),m.on(d.Z.MANIFEST_LOADING_FINISHED,S,e),m.on(d.Z.THROUGHPUT_MEASUREMENT_STORED,b,e)}},t=(0,f.Z)(E).getInstance().getLogger(e),P(),e}Yt.__dashjs_factory_name="ContentSteeringController";var jt=c.Z.getSingletonFactory(Yt);function Ht(){var e,t,n,r=this.context,i=(0,N.Z)(r).getInstance();return e={select:function(e){if(!e||0===e.length)return null;var r=null;return i.get().streaming.applyContentSteering&&(r=function(e){var r=n.getCurrentSteeringResponseData();return r&&r.pathwayPriority&&r.pathwayPriority.length>0?function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=0,i=null,a=function(){var a=e[r],o=n.findIndex((function(e){return e.serviceLocation&&e.serviceLocation===a}));if(-1!==o&&!t.contains(n[o].serviceLocation))return i=n[o],"break";r+=1};r<e.length&&"break"!==a(););return i}(r.pathwayPriority,e):null}(e)),r||(r=function(e){return e[0]}(e)),r},setConfig:function(e){e.blacklistController&&(t=e.blacklistController),e.contentSteeringController&&(n=e.contentSteeringController)},reset:function(){t.reset()}},t=kt(r).create({updateEventName:l.Z.SERVICE_LOCATION_LOCATION_BLACKLIST_CHANGED,addBlacklistEventName:l.Z.SERVICE_LOCATION_LOCATION_BLACKLIST_ADD}),n=jt(r).getInstance(),e}Ht.__dashjs_factory_name="LocationSelector";var Vt=c.Z.getClassFactory(Ht);function Kt(){var e,t,n,r,i,a,s,c,g,h,p,m,y,E,v=this.context,_=(0,u.Z)(v).getInstance(),T=(0,Q.Z)(v).getInstance();function S(){n=NaN,s=!1,i=!0,a=!1,b()}function b(){null!==r&&(clearTimeout(r),r=null)}function A(e){b(),a||(isNaN(e)&&!isNaN(n)&&(e=1e3*n),isNaN(e)||(t.debug("Refresh manifest in "+e+" milliseconds."),r=setTimeout(C,e)))}function I(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];s=!0;var t=g.getValue(),n=t.url,r=null,i=p.getPatchLocation(t),a=h.select(i),o=null;if(a&&!e)n=a.url,r=a.serviceLocation,o=a.queryParams;else{var u=R(t),l=h.select(u);l&&(n=l.url,r=l.serviceLocation,o=l.queryParams)}T.isRelative(n)&&(n=T.resolve(n,t.url)),c.load(n,r,o)}function R(e){var t=p.getLocation(e),n=y.getSynthesizedLocationElements(t);return t.concat(n)}function N(e){if(e){if(p.getIsPatch(e)){var r=e;e=g.getValue();var u=p.isPatchValid(e,r),c=u;if(u){var f=p.getPublishTime(e);c=p.applyPatchToManifest(e,r);var d=p.getPublishTime(e);c=f.getTime()!=d.getTime()}if(!c)return t.debug("Patch provided is invalid, performing full manifest refresh"),void I(!0);e.loadedTime=new Date}}else(e=g.getValue()).loadedTime=new Date;if(g.getValue()&&g.getValue().type===o.Z.DYNAMIC&&e.type===o.Z.STATIC)return _.trigger(l.Z.DYNAMIC_TO_STATIC),s=!1,void(a=!0);g.setValue(e);var h=new Date,m=(h.getTime()-e.loadedTime.getTime())/1e3;1e3*(n=p.getManifestUpdatePeriod(e,m))>2147483647&&(n=2147483.647),_.trigger(l.Z.MANIFEST_UPDATED,{manifest:e}),t.info("Manifest has been refreshed at "+h+"["+h.getTime()/1e3+"] "),i||A()}function C(){i||(s?A(E.get().streaming.manifestUpdateRetryInterval):I())}function D(e){e.error?e.error.code===w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE&&m.error(e.error):N(e.manifest)}function O(){i=!1,A()}function M(){(i=!E.get().streaming.scheduling.scheduleWhilePaused)&&b()}function P(){s=!1}return e={initialize:function(){S(),_.on(l.Z.STREAMS_COMPOSED,P,this),_.on(d.Z.PLAYBACK_STARTED,O,this),_.on(d.Z.PLAYBACK_PAUSED,M,this),_.on(l.Z.INTERNAL_MANIFEST_LOADED,D,this)},setManifest:function(e){N(e)},refreshManifest:I,getIsUpdating:function(){return s},setConfig:function(e){e&&(e.manifestModel&&(g=e.manifestModel),e.adapter&&(p=e.adapter),e.manifestLoader&&(c=e.manifestLoader),e.errHandler&&(m=e.errHandler),e.locationSelector&&(h=e.locationSelector),e.settings&&(E=e.settings),e.contentSteeringController&&(y=e.contentSteeringController))},reset:function(){_.off(d.Z.PLAYBACK_STARTED,O,this),_.off(d.Z.PLAYBACK_PAUSED,M,this),_.off(l.Z.STREAMS_COMPOSED,P,this),_.off(l.Z.INTERNAL_MANIFEST_LOADED,D,this),S()}},t=(0,f.Z)(v).getInstance().getLogger(e),h=Vt(v).create(),e}Kt.__dashjs_factory_name="ManifestUpdater";var zt=c.Z.getClassFactory(Kt);function Wt(){var e,t,n,r,i,a,o,s,c,d,g,h,p,m,y,E,v=this.context,_=(0,u.Z)(v).getInstance(),T=(0,Q.Z)(v).getInstance();function b(){s=[],c=[],d=null,g=null,p=null,h=NaN,n=!1,r=!1,m=i.get().streaming.utcSynchronization.timeBetweenSyncAttempts}function A(){i.get().streaming.utcSynchronization.enabled&&!n&&!r&&p&&p.value&&p.schemeIdUri&&!isNaN(h)&&!isNaN(i.get().streaming.utcSynchronization.backgroundAttempts)&&(g&&(Date.now()-g)/1e3<30||(s=[],r=!0,I(isNaN(i.get().streaming.utcSynchronization.backgroundAttempts)?2:i.get().streaming.utcSynchronization.backgroundAttempts)))}function I(e){try{if(e<=0)return void B();var t=Date.now();a[p.schemeIdUri](p.value,(function(n){var r=Date.now(),i=N(t,r,n);s.push(i),I(e-1)}),(function(){B()}))}catch(e){B()}}function R(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=e||0;if(!c||0===c.length||t>=c.length)D();else{var n=c[t];if(n)if(a.hasOwnProperty(n.schemeIdUri)){var r=(new Date).getTime();a[n.schemeIdUri](n.value,(function(e){var t=(new Date).getTime(),i=N(r,t,e);p=n,D(i)}),(function(){R(t+1)}))}else R(t+1);else D()}}function N(e,t,n){return n-(t-(t-e)/2)}function D(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,t=isNaN(e);t&&i.get().streaming.utcSynchronization.useManifestDateHeaderTimeSource?U():Z(t,e)}function O(e){var t=Date.parse(e);return isNaN(t)&&(t=function(e){var t,n,r=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\\.[0-9]*)?)?(?:([+\\-])([0-9]{2})([0-9]{2}))?/.exec(e);return t=Date.UTC(parseInt(r[1],10),parseInt(r[2],10)-1,parseInt(r[3],10),parseInt(r[4],10),parseInt(r[5],10),r[6]&&(parseInt(r[6],10)||0),r[7]&&1e3*parseFloat(r[7])||0),r[9]&&r[10]&&(n=60*parseInt(r[9],10)+parseInt(r[10],10),t+=("+"===r[8]?-1:1)*n*60*1e3),new Date(t).getTime()}(e)),t}function M(e){return Date.parse(e)}function P(e){return Date.parse(e)}function L(e,t,n){n()}function x(e,t,n){var r=O(e);isNaN(r)?n():t(r)}function F(e,t,n,r,i){var a,o,s=!1,u=new XMLHttpRequest,l=i?C.w.HEAD:C.w.GET,c=t.match(/\\S+/g);if(t=c.shift(),a=function(){s||(s=!0,c.length?F(e,c.join(" "),n,r,i):r())},o=function(){var t,r;200===u.status&&(t=i?u.getResponseHeader("Date"):u.response,r=e(t),isNaN(r)||(n(r),s=!0))},T.isRelative(t)){var f=E.resolve();f&&(t=T.resolve(t,f.url))}u.open(l,t),u.timeout=5e3,u.onload=o,u.onloadend=a,u.send()}function k(e,t,n){F(P,e,t,n,!0)}function U(){var e=o.getLatestMPDRequestHeaderValueByID("Date"),t=null!==e?new Date(e).getTime():Number.NaN;isNaN(t)?Z(!0):Z(!1,t-Date.now())}function Z(e,r){if(isNaN(h)||isNaN(r)||e||function(e){try{var n,r=G(e),a=isNaN(m)?30:m,o=isNaN(i.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor)?2:i.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor,s=isNaN(i.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts)?600:i.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts,u=isNaN(i.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts)?2:i.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts;r?(n=Math.min(a*o,s),t.debug("Increasing timeBetweenSyncAttempts to ".concat(n))):(n=Math.max(a/o,u),t.debug("Decreasing timeBetweenSyncAttempts to ".concat(n))),m=n}catch(e){}}(r),!e&&!isNaN(r)){d=Date.now(),n=!1;var a=isNaN(h);h=r,a&&A(),t.debug("Completed UTC sync. Setting client - server offset to ".concat(r))}e&&(p=null,n=!1,y.error(new S.Z(w.TIME_SYNC_FAILED_ERROR_CODE,w.TIME_SYNC_FAILED_ERROR_MESSAGE))),_.trigger(l.Z.UPDATE_TIME_SYNC_OFFSET,{offset:r}),_.trigger(l.Z.TIME_SYNCHRONIZATION_COMPLETED)}function B(){if(s&&0!==s.length){var e=s.reduce((function(e,t){return e+t}),0)/s.length;G(e)?t.debug("Completed background UTC sync. Offset is within allowed threshold and is not adjusted."):(t.debug("Completed background UTC sync. Setting client - server offset to ".concat(e)),h=e,_.trigger(l.Z.UPDATE_TIME_SYNC_OFFSET,{offset:h})),r=!1,g=Date.now()}}function G(e){try{if(isNaN(h))return!0;var t=i.get().streaming.utcSynchronization.maximumAllowedDrift&&!isNaN(i.get().streaming.utcSynchronization.maximumAllowedDrift)?i.get().streaming.utcSynchronization.maximumAllowedDrift:100;return e>=h-t&&e<=h+t}catch(e){return!0}}return e={initialize:function(){b(),a={"urn:mpeg:dash:utc:http-head:2014":k,"urn:mpeg:dash:utc:http-xsdate:2014":F.bind(null,O),"urn:mpeg:dash:utc:http-iso:2014":F.bind(null,M),"urn:mpeg:dash:utc:direct:2014":x,"urn:mpeg:dash:utc:http-head:2012":k,"urn:mpeg:dash:utc:http-xsdate:2012":F.bind(null,O),"urn:mpeg:dash:utc:http-iso:2012":F.bind(null,M),"urn:mpeg:dash:utc:direct:2012":x,"urn:mpeg:dash:utc:http-ntp:2014":L,"urn:mpeg:dash:utc:ntp:2014":L,"urn:mpeg:dash:utc:sntp:2014":L}},attemptSync:function(e,t){c=e,n||(function(e){try{if(!e||!i.get().streaming.utcSynchronization.enabled)return!1;var t=isNaN(m)?30:m;return!(d&&t&&!isNaN(t))||(Date.now()-d)/1e3>=t}catch(e){return!0}}(t)?(n=!0,R()):_.trigger(l.Z.TIME_SYNCHRONIZATION_COMPLETED))},setConfig:function(e){e&&(e.dashMetrics&&(o=e.dashMetrics),e.baseURLController&&(E=e.baseURLController),e.errHandler&&(y=e.errHandler),e.settings&&(i=e.settings))},reset:function(){b(),_.off(l.Z.ATTEMPT_BACKGROUND_SYNC,A,e)}},t=(0,f.Z)(v).getInstance().getLogger(e),_.on(l.Z.ATTEMPT_BACKGROUND_SYNC,A,e),e}Wt.__dashjs_factory_name="TimeSyncController";var Xt=c.Z.getSingletonFactory(Wt);Xt.HTTP_TIMEOUT_MS=5e3,c.Z.updateSingletonFactory(Wt.__dashjs_factory_name,Xt);var Qt=Xt;function Jt(){var e,t,n,r,i,a=this.context,o=(0,u.Z)(a).getInstance();return e={attachMediaSource:function(e){var n=window.URL.createObjectURL(t);return e.setSource(n),"managedMediaSource"===r&&(e.setDisableRemotePlayback(!0),t.addEventListener("startstreaming",(function(){o.trigger(d.Z.MANAGED_MEDIA_SOURCE_START_STREAMING)})),t.addEventListener("endstreaming",(function(){o.trigger(d.Z.MANAGED_MEDIA_SOURCE_END_STREAMING)}))),n},createMediaSource:function(){var e="WebKitMediaSource"in window,n="MediaSource"in window;return"ManagedMediaSource"in window?(t=new ManagedMediaSource,r="managedMediaSource",i.info("Created ManagedMediaSource")):n?(t=new MediaSource,r="mediaSource",i.info("Created MediaSource")):e&&(t=new WebKitMediaSource,i.info("Created WebkitMediaSource")),t},detachMediaSource:function(e){e.setSource(null)},setConfig:function(e){e&&e.settings&&(n=e.settings)},setDuration:function e(r){t&&"open"===t.readyState&&(null===r&&isNaN(r)||t.duration!==r&&(r!==1/0||n.get().streaming.buffer.mediaSourceDurationInfinity||(r=Math.pow(2,32)),function(e){for(var t=e.sourceBuffers,n=0;n<t.length;n++)if(t[n].updating)return!0;return!1}(t)?setTimeout(e.bind(null,r),50):(i.info("Set MediaSource duration:"+r),t.duration=r)))},setSeekable:function(e,n){t&&"function"==typeof t.setLiveSeekableRange&&"function"==typeof t.clearLiveSeekableRange&&"open"===t.readyState&&e>=0&&e<n&&(t.clearLiveSeekableRange(),t.setLiveSeekableRange(e,n))},signalEndOfStream:function(e){if(e&&"open"===e.readyState){for(var t=e.sourceBuffers,n=0;n<t.length;n++){if(t[n].updating)return;if(0===t[n].buffered.length)return}i.info("call to mediaSource endOfStream"),e.endOfStream()}}},i=(0,f.Z)(a).getInstance().getLogger(e),e}Jt.__dashjs_factory_name="MediaSourceController";var $t=c.Z.getSingletonFactory(Jt);function en(){var e,t,n,r,i,a,o,s,l,c,g,h="urn:mpeg:dash:event:2012",p="discarded",m="updated",y="added",E=this.context,v=(0,u.Z)(E).getInstance();function _(){if(!o||!s)throw new Error("setConfig function has to be called previously")}function T(){g=!1,n={},r={},i=null,c=!1,a=Date.now()/1e3}function S(){try{if(!c){c=!0;var e=s.getTime(),i=e-a;i=a>0?Math.max(0,i):0,b(r,i,e),b(n,i,e),A(r),A(n),a=e,c=!1}}catch(e){c=!1,t.error(e)}}function b(e,n,r){try{N(e,(function(i){if(void 0!==i){var a=isNaN(i.duration)?0:i.duration;i.calculatedPresentationTime<=r&&i.calculatedPresentationTime+n+a>=r?D(i,d.Z.EVENT_MODE_ON_START):(C(r,a+n,i.calculatedPresentationTime)||function(e){try{var n=e.eventStream.period.start+e.eventStream.period.duration;return e.calculatedPresentationTime>n}catch(e){return t.error(e),!1}}(i))&&(t.debug("Removing event ".concat(i.id," from period ").concat(i.eventStream.period.id," as it is expired or invalid")),function(e,n){try{var r=n.eventStream.schemeIdUri,i=n.eventStream.period.id,a=n.eventStream.value,o=n.id;e[i][r]=e[i][r].filter((function(e){return a&&e.eventStream.value&&e.eventStream.value!==a||e.id!==o})),0===e[i][r].length&&delete e[i][r]}catch(e){t.error(e)}}(e,i))}}))}catch(e){t.error(e)}}function A(e){try{for(var n in e)e.hasOwnProperty(n)&&0===Object.keys(e[n]).length&&delete e[n]}catch(e){t.error(e)}}function I(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.eventStream.schemeIdUri,i=e.eventStream.value,a=e.id,o=p;t[r]||(t[r]=[]);var s=t[r].findIndex((function(e){return(!i||e.eventStream.value&&e.eventStream.value===i)&&e.id===a}));if(-1===s)t[r].push(e),e.triggeredReceivedEvent=!1,e.triggeredStartEvent=!1,o=y;else if(n){var u=t[r][s];e.triggeredReceivedEvent=u.triggeredReceivedEvent,e.triggeredStartEvent=u.triggeredStartEvent,t[r][s]=e,o=m}return o}function R(e){try{if(1==e.eventStream.value){var n,r=e.calculatedPresentationTime;n=4294967295==e.calculatedPresentationTime?NaN:e.calculatedPresentationTime+e.duration,v.trigger(d.Z.MANIFEST_VALIDITY_CHANGED,{id:e.id,validUntil:r,newDuration:n,newManifestValidAfter:NaN},{mode:d.Z.EVENT_MODE_ON_START})}}catch(e){t.error(e)}}function w(e){try{var n=s.getTime();N(e,(function(e){var t=e.eventStream&&e.eventStream.period&&!isNaN(e.eventStream.period.duration)?e.eventStream.period.duration:NaN,r=e.eventStream&&e.eventStream.period&&!isNaN(e.eventStream.period.start)?e.eventStream.period.start:NaN;if(!isNaN(t)&&!isNaN(r)){var i=e.calculatedPresentationTime;Math.abs(i-n)<300&&D(e,d.Z.EVENT_MODE_ON_START)}}))}catch(e){t.error(e)}}function N(e,n){try{if(e)for(var r=Object.keys(e),i=0;i<r.length;i++)for(var a=e[r[i]],o=Object.keys(a),s=0;s<o.length;s++)a[o[s]].forEach((function(e){void 0!==e&&n(e)}))}catch(e){t.error(e)}}function C(e,n,r){try{return e-n>r}catch(e){return t.error(e),!1}}function D(e,n){try{var r=s.getTime(),i=e.id;if(n===d.Z.EVENT_MODE_ON_RECEIVE&&!e.triggeredReceivedEvent)return t.debug("Received event ".concat(i)),e.triggeredReceivedEvent=!0,void v.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n});e.triggeredStartEvent||(e.eventStream.schemeIdUri===h&&1==e.eventStream.value?0===e.duration&&0===e.presentationTimeDelta||(t.debug("Starting manifest refresh event ".concat(i," at ").concat(r)),function(){try{_(),o.refreshManifest()}catch(e){t.error(e)}}()):"urn:mpeg:dash:event:callback:2015"===e.eventStream.schemeIdUri&&1==e.eventStream.value?(t.debug("Starting callback event ".concat(i," at ").concat(r)),function(e){try{(0,se.Z)(E).create({}).load({method:"get",url:e,request:{responseType:"arraybuffer"}})}catch(e){t.error(e)}}(e.messageData)):(t.debug("Starting event ".concat(i," from period ").concat(e.eventStream.period.id," at ").concat(r)),v.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n})),e.triggeredStartEvent=!0)}catch(e){t.error(e)}}return e={addInlineEvents:function(e,r){try{if(_(),n[r]||(n[r]={}),e)for(var i=0;i<e.length;i++){var a=e[i];if(!C(s.getTime(),isNaN(a.duration)?0:a.duration,a.calculatedPresentationTime)){var o=I(a,n[r],!0);o===y?(t.debug("Added inline event with id ".concat(a.id," from period ").concat(r)),D(a,d.Z.EVENT_MODE_ON_RECEIVE)):o===m&&t.debug("Updated inline event with id ".concat(a.id," from period ").concat(r))}}}catch(e){throw e}},addInbandEvents:function(e,n){try{_(),r[n]||(r[n]={});for(var i=0;i<e.length;i++){var a=e[i];C(s.getTime(),isNaN(a.duration)?0:a.duration,a.calculatedPresentationTime)||(I(a,r[n],!1)===y?(a.eventStream.schemeIdUri===h&&R(a),t.debug("Added inband event with id ".concat(a.id," from period ").concat(n)),D(a,d.Z.EVENT_MODE_ON_RECEIVE)):t.debug("Inband event with scheme_id_uri ".concat(a.eventStream.schemeIdUri,", value ").concat(a.eventStream.value,", period id ").concat(n," and event id ").concat(a.id," was ignored because it has been added before.")))}S()}catch(e){throw e}},getInbandEvents:function(){return r},getInlineEvents:function(){return n},start:function(){try{_(),t.debug("Start Event Controller");var e=l.get().streaming.eventControllerRefreshDelay;g||isNaN(e)||(g=!0,i=setInterval(S,e))}catch(e){throw e}},setConfig:function(e){try{if(!e)return;e.manifestUpdater&&(o=e.manifestUpdater),e.playbackController&&(s=e.playbackController),e.settings&&(l=e.settings)}catch(e){throw e}},reset:function(){(function(){try{null!==i&&g&&(clearInterval(i),i=null,g=!1,function(){try{w(r),w(n)}catch(e){t.error(e)}}())}catch(e){throw e}})(),T()}},t=(0,f.Z)(E).getInstance().getLogger(e),T(),e}en.__dashjs_factory_name="EventController";var tn=c.Z.getSingletonFactory(en),nn={LEVELS:{SUGGESTION:"Suggestion",WARNING:"Warning",ERROR:"Error"},EVENTS:{NO_UTC_TIMING_ELEMENT:{key:"NO_UTC_TIMING_ELEMENT",message:"No UTCTiming element is present in the manifest. You may experience playback failures. For a detailed validation use https://conformance.dashif.org/"},NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE:{key:"NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE",message:\'SMPTE 2052-1:2013 defines the attribute name as "imageType" and does not define "imagetype"\'},INVALID_DVR_WINDOW:{key:"INVALID_DVR_WINDOW",message:"No valid segment found when applying a specification compliant DVR window calculation. Using SegmentTimeline entries as a fallback."}}};function rn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function an(){var e,t,n,r,i,o,c,g,h,p,m,y,E,v,_,T,b,A,I,R,N,C,D,O,M,P,L,F,k,U,Z,B,G,q,Y,j,H,V,K,z,W,X,Q,J,te,ne,re,ie,ae=this.context,oe=(0,u.Z)(ae).getInstance();function se(){if(!(o&&o.hasOwnProperty("load")&&N&&N.hasOwnProperty("initialize")&&N.hasOwnProperty("reset")&&N.hasOwnProperty("getClientTimeOffset")&&c&&R&&h&&G))throw new Error(a.Z.MISSING_CONFIG_ERROR)}function ue(){if(!i||!i.hasOwnProperty("setManifest"))throw new Error("initialize function has to be called previously")}function le(){!function(){try{var e=g.getStreamsInfo();if(!D&&0===e.length)throw new Error("There are no periods in the MPD");D&&e.length>0&&h.updateManifestUpdateInfo({currentTime:G.getTime(),buffered:B.getBufferRange(),presentationStartTime:e[0].start,clientTimeOffset:N.getClientTimeOffset()}),C.length>0&&function(e){0!==e.length?C=C.filter((function(n){var r=e.filter((function(e){return e.id===n.getId()})).length>0||n.getId()===D.getId();return r||(t.debug("Removing stream ".concat(n.getId())),n.reset(!0)),r})):t.warn("No periods included in the current manifest. Skipping the filtering of outdated stream objects.")}(e);for(var n=[],r=0,i=e.length;r<i;r++){var a=e[r];n.push(fe(a)),h.addManifestUpdateStreamInfo(a)}Promise.all(n).then((function(){return new Promise((function(t,n){D?t():de(e,t,n)}))})).then((function(){oe.trigger(l.Z.STREAMS_COMPOSED),Me()})).catch((function(e){throw e}))}catch(e){R.error(new S.Z(w.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e.message+" nostreamscomposed",c.getValue())),U=!0,Qe()}}()}function ce(){te=!0}function fe(e){var t=ze(e.id);return t?t.updateData(e):(t=Bt(ae).create({manifestModel:c,mediaPlayerModel:Y,dashMetrics:h,manifestUpdater:i,adapter:g,timelineConverter:N,capabilities:n,capabilitiesFilter:r,errHandler:R,baseURLController:E,segmentBaseController:v,textController:M,abrController:T,playbackController:G,eventController:A,mediaController:b,protectionController:O,videoModel:B,streamInfo:e,settings:J}),C.push(t),t.initialize(),Promise.resolve())}function de(e,n,r){try{Ae();var i=h.getCurrentDVRInfo().range;if(i.end<i.start){ne&&clearTimeout(ne);var a=Math.min(1e3*(-1*(i.end-i.start)+2),2147483647);return t.debug("Waiting for ".concat(a," ms before playback can start")),oe.trigger(l.Z.AST_IN_FUTURE,{delay:a}),void(ne=setTimeout((function(){de(e,n,r)}),a))}J.get().streaming.applyProducerReferenceTime&&q.calculateProducerReferenceTimeOffsets(e);var o=e[0].manifestInfo;if(J.get().streaming.applyServiceDescription&&q.applyServiceDescription(o),g.getIsDynamic()){var s=Be(e,o);G.computeAndSetLiveDelay(s,o)}(J.get().streaming.applyContentSteering&&y.shouldQueryBeforeStart()?y.loadSteeringData():Promise.resolve()).then((function(){var e=c.getValue();e&&E.update(e),ge(),n()})).catch((function(e){t.error(e),ge(),n()}))}catch(e){r(e)}}function ge(){var e=function(){var e;if(g.getIsDynamic()){var n=h.getCurrentDVRInfo();e=(n&&n.range?n.range.end:0)-G.getOriginalLiveDelay();var r=n?n.range:null;if(r){if(isNaN(re)&&-1===re.toString().indexOf("posix:")){var i=ke(!0);isNaN(i)||(t.info("Start time from URI parameters: ".concat(i)),e=Math.min(e,i))}else{t.info("Start time provided by the app: ".concat(re));var a=Ue(!0,re);isNaN(a)||(e=Math.min(e,a))}var o=J.get().streaming.timeShiftBuffer.calcFromSegmentTimeline?.1:0;e=Math.max(e,r.start+o)}}else if(e=$e()[0].getStreamInfo().start,isNaN(re)){var s=ke(!1);isNaN(s)||(t.info("Start time from URI parameters: ".concat(s)),e=Math.max(e,s))}else{t.info("Start time provided by the app: ".concat(re));var u=Ue(!1,re);isNaN(u)||(e=Math.max(e,u))}return e}(),n=be(e),r=null!==n?n:C[0];oe.trigger(l.Z.INITIAL_STREAM_SWITCH,{startTime:e}),he(r,null,e),z||(z=setInterval((function(){!F&&G.getTimeToStreamEnd()<=0&&!G.isSeeking()&&oe.trigger(l.Z.PLAYBACK_ENDED,{isLast:Ke().isLast})}),200))}function he(e,n,r){try{if(F||!e||n===e&&e.getIsActive())return;F=!0,oe.trigger(l.Z.PERIOD_SWITCH_STARTED,{fromStreamInfo:n?n.getStreamInfo():null,toStreamInfo:e.getStreamInfo()});var i=!1;D=e,n&&(i=Te(e,n),n.deactivate(i)),r=isNaN(r)?!i&&n?e.getStreamInfo().start:NaN:r,t.info("Switch to stream ".concat(e.getId(),". Seektime is ").concat(r,", current playback time is ").concat(G.getTime(),". Seamless period switch is set to ").concat(i)),X=X.filter((function(e){return e.getId()!==D.getId()})),G.initialize(Ke(),!!n),B.getElement()?pe(r,i,!1):me(r,i)}catch(e){F=!1}}function pe(e,n){var r,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];function a(){if(Z&&"open"===Z.readyState){t.debug("MediaSource is open!"),window.URL.revokeObjectURL(r),Z.removeEventListener("sourceopen",a),Z.removeEventListener("webkitsourceopen",a),Fe();var o=h.getCurrentDVRInfo();p.setSeekable(o.range.start,o.range.end),i?(isNaN(e)||G.seek(e,!0,!0),D.setMediaSource(Z).then((function(){D.initializeForTextWithMediaSource(Z)}))):me(e,n)}}function o(){Z.addEventListener("sourceopen",a,!1),Z.addEventListener("webkitsourceopen",a,!1),r=p.attachMediaSource(B),t.debug("MediaSource attached to element. Waiting on open...")}Z?n?me(e,n):(p.detachMediaSource(B),o()):(Z=p.createMediaSource(),o())}function me(e,t){D.activate(Z,t?W:void 0,e).then((function(t){if(t){var n=Object.keys(t);n.length>0&&t[n[0]].getBuffer().changeType&&(Q=!0),W=t}isNaN(e)||(oe.trigger(l.Z.SEEK_TARGET,{time:e},{streamId:D.getId()}),G.seek(e,!1,!0),D.startScheduleControllers()),F=!1,oe.trigger(l.Z.PERIOD_SWITCH_COMPLETED,{toStreamInfo:Ke()})}))}function ye(e){var t=be(e.seekTime);t&&t!==D?t&&t!==D&&(Ee(),function(e,t){var n=e&&!isNaN(e.seekTime)?e.seekTime:NaN,r=D.getProcessors().map((function(t){return t.prepareOuterPeriodPlaybackSeeking(e)}));Promise.all(r).then((function(){he(t,D,n)})).catch((function(e){R.error(e)}))}(e,t)):(Ee(),function(e){D.getProcessors().forEach((function(t){return t.prepareInnerPeriodPlaybackSeeking(e)})),je(ee.USER_REQUEST_STOP_REASON)}(e)),He($.SEEK_START_REASON)}function Ee(){ve()}function ve(){X&&X.length>0&&(X.forEach((function(e){e.deactivate(!0)})),X=[])}function _e(e){if(e.newMediaInfo.streamInfo.id===D.getId()){if(ve(),J.get().streaming.buffer.resetSourceBuffersForTrackSwitch&&e.oldMediaInfo&&e.oldMediaInfo.codec!==e.newMediaInfo.codec){var t=G.getTime();return D.deactivate(!1),void pe(t,!1,!1)}D.prepareTrackChange(e)}}function Te(e,t){try{return J.get().streaming.buffer.reuseExistingSourceBuffers&&(t.isProtectionCompatible(e)||te)&&(Q&&J.get().streaming.buffer.useChangeTypeForTrackSwitch||t.isMediaCodecCompatible(e,t))}catch(e){return!1}}function Se(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(Z&&!e.getPreloaded()){var n=Te(e,t);n&&e.startPreloading(Z,W).then((function(){X.push(e)}))}}function be(e){if(isNaN(e))return null;for(var t=C.length,n=0;n<t;n++){var r=C[n];if(e<parseFloat((r.getStartTime()+r.getDuration()).toFixed(5)))return r}return null}function Ae(){try{var e=g.getIsDynamic(),t=g.getStreamsInfo()[0].manifestInfo,n=G.getTime(),r=N.calcTimeShiftBufferWindow(C,e),i=Le();if(void 0===r.start||void 0===r.end)return;i&&0!==i.length?i.forEach((function(e){h.addDVRInfo(e.getType(),n,t,r)})):h.addDVRInfo(a.Z.VIDEO,n,t,r)}catch(e){}}function Ie(e){if(V&&L){var t=Y.getInitialBufferLevel(),n=[a.Z.TEXT];(isNaN(t)||t<=G.getBufferLevel(n)||g.getIsDynamic()&&t>G.getLiveDelay())&&(V=!1,He($.INITIAL_PLAYOUT_START_REASON),G.play())}e&&e.mediaType&&h.addBufferLevel(e.mediaType,new Date,1e3*e.bufferLevel)}function Re(e){e.streamInfo.id===D.getId()&&e.reason&&e.reason.forceReplace&&ve(),ze(e.streamInfo.id).prepareQualityChange(e)}function we(){if(g.getIsDynamic()&&0!==G.getOriginalLiveDelay()&&D){var e=g.getStreamsInfo();if(e.length>0){var t=e[0].manifestInfo,n=Be(e,t);G.computeAndSetLiveDelay(n,t)}}}function Ne(){if(qe()){var e=B.getPlaybackQuality();e&&h.addDroppedFrames(e)}}function Ce(){t.debug("[onPlaybackStarted]"),!V&&H&&He($.RESUME_FROM_PAUSE_START_REASON),V&&(V=!1),K&&(K=!1,J.get().streaming.applyContentSteering&&!y.shouldQueryBeforeStart()&&y.loadSteeringData()),H=!1}function De(e){t.debug("[onPlaybackPaused]"),e.ended||(H=!0,je(ee.USER_REQUEST_STOP_REASON))}function Oe(e){t.debug("Stream with id ".concat(e.streamInfo.id," finished buffering"));var n=e.streamInfo.isLast;Z&&n?(t.info("[onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController."),p.signalEndOfStream(Z)):Me()}function Me(){if(D&&D.getHasFinishedBuffering())for(var e=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;try{var t=e||D||null;if(t){var n=t.getStreamInfo();return C.filter((function(e){var t=e.getStreamInfo();return t.start>n.start&&n.id!==t.id}))}}catch(e){return[]}}(D),t=0;t<e.length;){var n=e[t],r=0===t?D:e[t-1];!n.getPreloaded()&&r.getHasFinishedBuffering()&&Z&&Se(n,r),t+=1}}function Pe(){z&&(clearInterval(z),z=null)}function Le(){return D?D.getProcessors():[]}function xe(e){if(D&&!D.getIsEndedEventSignaled()){D.setIsEndedEventSignaled(!0);var n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=e||D||null;if(!t)return null;for(var n=t.getStreamInfo(),r=n.start,i=0,a=-1,o=NaN;i<C.length;){var s=C[i].getStreamInfo(),u=s.start-r;u>0&&(isNaN(o)||u<o)&&n.id!==s.id&&(o=u,a=i),i+=1}return a>=0?C[a]:null}();n?(t.debug("StreamController onEnded, found next stream with id ".concat(n.getStreamInfo().id,". Switching from ").concat(D.getStreamInfo().id," to ").concat(n.getStreamInfo().id)),he(n,D,NaN)):(t.debug("StreamController no next stream found"),D.setIsEndedEventSignaled(!1)),je(n?ee.END_OF_PERIOD_STOP_REASON:ee.END_OF_CONTENT_STOP_REASON)}e&&e.isLast&&(Pe(),y.stopSteeringRequestTimer())}function Fe(e){var t=e||Ke().manifestInfo.duration;p.setDuration(t)}function ke(e){var t=_.getURIFragmentData();if(!t||!t.t)return NaN;var n=$e()[0].getStreamInfo().start;return t.t=t.t.split(",")[0],Ze(e,t.t,n)}function Ue(e,t){var n=0;return e||(n=$e()[0].getStreamInfo().start),Ze(e,t,n)}function Ze(e,t,n){var r=g.getRegularPeriods()[0],i=t.toString(),a=-1!==i.indexOf("posix:")?"now"===i.substring(6)?Date.now()/1e3:parseFloat(i.substring(6)):NaN;return e&&!isNaN(a)?N.calcPresentationTimeFromWallTime(new Date(1e3*a),r):parseFloat(i)+n}function Be(e,t){try{var n=NaN;if(t&&!isNaN(t.maxFragmentDuration)&&isFinite(t.maxFragmentDuration))return t.maxFragmentDuration;if(e&&1===e.length){var r=e[0],i=[a.Z.VIDEO,a.Z.AUDIO,a.Z.TEXT].reduce((function(e,t){var n=g.getMediaInfoForType(r,t);return n&&!1!==n.isFragmented&&e.push(n),e}),[]).reduce((function(e,t){var n=g.getVoRepresentations(t);return n&&n.length>0&&n.forEach((function(t){t&&e.push(t)})),e}),[]).reduce((function(e,t){var n=g.convertRepresentationToRepresentationInfo(t);return n&&n.fragmentDuration&&!isNaN(n.fragmentDuration)&&e.push(n.fragmentDuration),e}),[]);n=Math.max.apply(Math,function(e){if(Array.isArray(e))return rn(e)}(o=i)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(o)||function(e,t){if(e){if("string"==typeof e)return rn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rn(e,t):void 0}}(o)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}return isFinite(n)?n:NaN}catch(e){return NaN}var o}function Ge(e){if(e.error)U=!0,Qe();else{t.info("Manifest updated... updating data system wide.");var n=e.manifest;g.updatePeriods(n);var i=g.getUTCTimingSources();!g.getIsDynamic()||i&&0!==i.length||oe.trigger(d.Z.CONFORMANCE_VIOLATION,{level:nn.LEVELS.WARNING,event:nn.EVENTS.NO_UTC_TIMING_ELEMENT});var a=g.getIsDynamic()?i.concat(j.getUTCTimingSources()):i;r.filterUnsupportedFeatures(n).then((function(){E.initialize(n),m.attemptSync(a,g.getIsDynamic())}))}}function qe(){return!!D&&D.getHasVideoTrack()}function Ye(){return!!D&&D.getHasAudioTrack()}function je(e,t){t=t||new Date,Le().forEach((function(n){n.finalisePlayList(t,e)})),h.addPlayList()}function He(e){h.createPlaylistMetrics(1e3*G.getTime(),e)}function Ve(e){if(e.error){var n="";switch(e.error.code){case 1:n="MEDIA_ERR_ABORTED";break;case 2:n="MEDIA_ERR_NETWORK";break;case 3:n="MEDIA_ERR_DECODE",ie.counts.mediaErrorDecode+=1;break;case 4:n="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:n="MEDIA_ERR_ENCRYPTED";break;default:n="UNKNOWN"}"MEDIA_ERR_DECODE"===n&&J.get().errors.recoverAttempts.mediaErrorDecode>=ie.counts.mediaErrorDecode?function(){t.warn("A MEDIA_ERR_DECODE occured: Resetting the MediaSource");var e=G.getTime();D.deactivate(!1),t.warn("MediaSource has been resetted. Resuming playback from time ".concat(e)),pe(e,!1,!1)}():(k=!0,e.error.message&&(n+=" ("+e.error.message+")"),e.error.msExtendedCode&&(n+=" (0x"+(e.error.msExtendedCode>>>0).toString(16).toUpperCase()+")"),t.fatal("Video Element Error: "+n),e.error&&t.fatal(e.error),R.error(new S.Z(e.error.code,n)),Qe())}}function Ke(){return D?D.getStreamInfo():null}function ze(e){for(var t=0,n=C.length;t<n;t++)if(C[t].getId()===e)return C[t];return null}function We(e){isNaN(e.newDuration)||Fe(e.newDuration)}function Xe(){C=[],re=NaN,O=null,F=!1,D=null,k=!1,U=!1,V=!0,K=!0,H=!1,L=!0,z=null,te=!1,Q=!1,X=[],ne=null,ie={counts:{mediaErrorDecode:0}}}function Qe(){se(),m.reset(),je(k||U?ee.FAILURE_STOP_REASON:ee.USER_REQUEST_STOP_REASON);for(var t=0,n=C?C.length:0;t<n;t++)C[t].reset(k);oe.off(d.Z.PLAYBACK_TIME_UPDATED,Ne,e),oe.off(d.Z.PLAYBACK_SEEKING,ye,e),oe.off(d.Z.PLAYBACK_ERROR,Ve,e),oe.off(d.Z.PLAYBACK_STARTED,Ce,e),oe.off(d.Z.PLAYBACK_PAUSED,De,e),oe.off(d.Z.PLAYBACK_ENDED,xe,e),oe.off(d.Z.METRIC_ADDED,Je,e),oe.off(d.Z.MANIFEST_VALIDITY_CHANGED,We,e),oe.off(d.Z.BUFFER_LEVEL_UPDATED,Ie,e),oe.off(d.Z.QUALITY_CHANGE_REQUESTED,Re,e),l.Z.KEY_SESSION_UPDATED&&oe.off(l.Z.KEY_SESSION_UPDATED,ce,e),oe.off(l.Z.MANIFEST_UPDATED,Ge,e),oe.off(l.Z.STREAM_BUFFERING_COMPLETED,Oe,e),oe.off(l.Z.TIME_SYNCHRONIZATION_COMPLETED,le,e),oe.off(l.Z.CURRENT_TRACK_CHANGED,_e,e),oe.off(l.Z.SETTING_UPDATED_LIVE_DELAY,we,e),oe.off(l.Z.SETTING_UPDATED_LIVE_DELAY_FRAGMENT_COUNT,we,e),E.reset(),i.reset(),A.reset(),h.clearAllCurrentMetrics(),c.setValue(null),o.reset(),N.reset(),I.reset(),Z&&(p.detachMediaSource(B),Z=null),B=null,O&&(O=null,P=null,c.getValue()&&oe.trigger(l.Z.PROTECTION_DESTROYED,{data:c.getValue().url})),Pe(),oe.trigger(l.Z.STREAM_TEARDOWN_COMPLETE),Xe()}function Je(e){if(e.metric===s.Z.DVR_INFO){var t=Ye()?a.Z.AUDIO:a.Z.VIDEO;e.mediaType===t&&p.setSeekable(e.value.range.start,e.value.range.end)}}function $e(){return C}return e={initialize:function(t,n){se(),L=t,P=n,N.initialize(),(i=zt(ae).create()).setConfig({manifestModel:c,adapter:g,manifestLoader:o,errHandler:R,settings:J,contentSteeringController:y}),i.initialize(),(A=tn(ae).getInstance()).setConfig({manifestUpdater:i,playbackController:G,settings:J}),A.start(),m.setConfig({dashMetrics:h,baseURLController:E,errHandler:R,settings:J}),m.initialize(),p.setConfig({settings:J}),O&&(oe.trigger(l.Z.PROTECTION_CREATED,{controller:O}),O.setMediaElement(B.getElement()),P&&O.setProtectionData(P)),oe.on(d.Z.PLAYBACK_TIME_UPDATED,Ne,e),oe.on(d.Z.PLAYBACK_SEEKING,ye,e),oe.on(d.Z.PLAYBACK_ERROR,Ve,e),oe.on(d.Z.PLAYBACK_STARTED,Ce,e),oe.on(d.Z.PLAYBACK_PAUSED,De,e),oe.on(d.Z.PLAYBACK_ENDED,xe,e),oe.on(d.Z.METRIC_ADDED,Je,e),oe.on(d.Z.MANIFEST_VALIDITY_CHANGED,We,e),oe.on(d.Z.BUFFER_LEVEL_UPDATED,Ie,e),oe.on(d.Z.QUALITY_CHANGE_REQUESTED,Re,e),l.Z.KEY_SESSION_UPDATED&&oe.on(l.Z.KEY_SESSION_UPDATED,ce,e),oe.on(l.Z.MANIFEST_UPDATED,Ge,e),oe.on(l.Z.STREAM_BUFFERING_COMPLETED,Oe,e),oe.on(l.Z.TIME_SYNCHRONIZATION_COMPLETED,le,e),oe.on(l.Z.CURRENT_TRACK_CHANGED,_e,e),oe.on(l.Z.SETTING_UPDATED_LIVE_DELAY,we,e),oe.on(l.Z.SETTING_UPDATED_LIVE_DELAY_FRAGMENT_COUNT,we,e)},getActiveStreamInfo:Ke,addDVRMetric:Ae,hasVideoTrack:qe,hasAudioTrack:Ye,getStreamById:ze,getStreamForTime:be,getTimeRelativeToStreamId:function(e,t){for(var n=null,r=0,i=0,a=null,o=0;o<C.length;o++){if(i=(n=C[o]).getStartTime(),a=n.getDuration(),Number.isFinite(i)&&(r=i),n.getId()===t)return e-r;Number.isFinite(a)&&(r+=a)}return null},load:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NaN;se(),re=t,o.load(e)},loadWithManifest:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NaN;ue(),re=t,i.setManifest(e)},getActiveStreamProcessors:Le,setConfig:function(e){e&&(e.capabilities&&(n=e.capabilities),e.capabilitiesFilter&&(r=e.capabilitiesFilter),e.manifestLoader&&(o=e.manifestLoader),e.manifestModel&&(c=e.manifestModel),e.mediaPlayerModel&&(Y=e.mediaPlayerModel),e.customParametersModel&&(j=e.customParametersModel),e.protectionController&&(O=e.protectionController),e.adapter&&(g=e.adapter),e.dashMetrics&&(h=e.dashMetrics),e.errHandler&&(R=e.errHandler),e.timelineConverter&&(N=e.timelineConverter),e.videoModel&&(B=e.videoModel),e.playbackController&&(G=e.playbackController),e.serviceDescriptionController&&(q=e.serviceDescriptionController),e.contentSteeringController&&(y=e.contentSteeringController),e.textController&&(M=e.textController),e.abrController&&(T=e.abrController),e.mediaController&&(b=e.mediaController),e.settings&&(J=e.settings),e.baseURLController&&(E=e.baseURLController),e.uriFragmentModel&&(_=e.uriFragmentModel),e.segmentBaseController&&(v=e.segmentBaseController))},setProtectionData:function(e){P=e,O&&O.setProtectionData(P)},getIsStreamSwitchInProgress:function(){return F},switchToVideoElement:function(e){D&&(G.initialize(Ke()),pe(e,!1,!0))},getHasMediaOrInitialisationError:function(){return k||U},getStreams:$e,getActiveStream:function(){return D},getInitialPlayback:function(){return V},getAutoPlay:function(){return L},reset:Qe},t=(0,f.Z)(ae).getInstance().getLogger(e),m=Qt(ae).getInstance(),p=$t(ae).getInstance(),I=x(ae).getInstance(),Xe(),e}an.__dashjs_factory_name="StreamController";var on=c.Z.getSingletonFactory(an);function sn(){var e,t,n,r,i,o,s,c,d,g,h,p,m=this.context,y=(0,u.Z)(m).getInstance();function E(){p.debug("Stopping the gap controller"),i&&(clearInterval(i),i=null),function(){y.off(l.Z.WALLCLOCK_TIME_UPDATED,b,this),y.off(l.Z.INITIAL_STREAM_SWITCH,S,this),y.off(l.Z.PLAYBACK_SEEKING,v,this),y.off(l.Z.BUFFER_REPLACEMENT_STARTED,_,e),y.off(l.Z.TRACK_CHANGE_RENDERED,T,e)}(),i=null,o=NaN,r=0,g=null,h={}}function v(){g&&(clearTimeout(g),g=null)}function _(e){try{if(e.streamId!==c.getActiveStreamInfo().id||e.mediaType!==a.Z.VIDEO&&e.mediaType!==a.Z.AUDIO)return;e.streamId===c.getActiveStreamInfo().id&&(h[e.mediaType]=!0)}catch(e){p.error(e)}}function T(e){e&&e.mediaType&&(h[e.mediaType]=!1)}function S(){i||function(){try{i||(p.debug("Starting the gap controller"),i=setInterval((function(){A()&&N(s.getTime())}),100))}catch(e){}}()}function b(){if(A(n.get().streaming.gaps.enableSeekFix)&&++r>=10){var e=s.getTime();t===e?N(e,!0):(t=e,o=NaN),r=0}}function A(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!c.getActiveStream())return!1;var t=Object.keys(h).some((function(e){return h[e]})),r=!!e&&I();return!t&&n.get().streaming.gaps.jumpGaps&&c.getActiveStreamProcessors().length>0&&(!s.isSeeking()||r)&&!s.isPaused()&&!c.getIsStreamSwitchInProgress()&&!c.getHasMediaOrInitialisationError()}function I(){var e=c.getActiveStream(),t=parseFloat((e.getStartTime()+e.getDuration()).toFixed(5));return s.getTime()+n.get().streaming.gaps.threshold>=t}function R(e,t){try{if(!e||e.length<=1&&t>0)return NaN;for(var r=NaN,i=0;isNaN(r)&&i<e.length;){var a=i>0?e.end(i-1):0;t<e.start(i)&&a-t<n.get().streaming.gaps.threshold&&(r=i),i+=1}return r}catch(e){return null}}function w(e,t){for(var n=0,r=e.length;n<r;n++)if(t>=e.start(n)&&t<=e.end(n))return!0;return!1}function N(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=n.get().streaming.gaps.enableStallFix,a=n.get().streaming.gaps.stallSeek,u=n.get().streaming.gaps.smallGapLimit,l=n.get().streaming.gaps.jumpLargeGaps,f=d.getBufferRange(),h=NaN,m=!1;if(t=R(f,e),!isNaN(t)){var y=f.start(t),E=y-e;E>0&&(E<=u||l)&&(h=y)}var v=s.getTimeToStreamEnd();if(isNaN(h)&&r&&isFinite(v)&&!isNaN(v)&&v<u&&(h=parseFloat(s.getStreamEndTime().toFixed(5)),m=!0),i&&isNaN(h)&&r&&isNaN(t)&&w(f,e)&&(0===a?(p.warn("Toggle play pause to break stall"),d.pause(),d.play()):(p.warn("Jumping ".concat(a,"s to break stall")),h=e+a)),h>0&&o!==h&&h>e&&!g){var _=h-e;if(m){var T=c.getStreamForTime(h),S=T&&!!T.getPreloaded();p.warn("Jumping to end of stream because of gap from ".concat(e," to ").concat(h,". Gap duration: ").concat(_)),s.seek(h,!0,S)}else{var b=s.getIsDynamic(),A=t>0?f.end(t-1):e,I=b?1e3*Math.max(0,_-.1):0;g=window.setTimeout((function(){s.seek(h,!0,!0),p.warn("Jumping gap occuring in period ".concat(c.getActiveStream().getStreamId()," starting at ").concat(A," and ending at ").concat(h,". Jumping by: ").concat(h-A)),g=null}),I)}o=h}}return e={reset:E,setConfig:function(e){e&&(e.settings&&(n=e.settings),e.playbackController&&(s=e.playbackController),e.streamController&&(c=e.streamController),e.videoModel&&(d=e.videoModel))},initialize:function(){!function(){y.on(l.Z.WALLCLOCK_TIME_UPDATED,b,this),y.on(l.Z.INITIAL_STREAM_SWITCH,S,this),y.on(l.Z.PLAYBACK_SEEKING,v,this),y.on(l.Z.BUFFER_REPLACEMENT_STARTED,_,e),y.on(l.Z.TRACK_CHANGE_RENDERED,T,e)}()}},p=(0,f.Z)(m).getInstance().getLogger(e),E(),e}sn.__dashjs_factory_name="GapController";var un=c.Z.getSingletonFactory(sn);function ln(){var e,t,n,r,i,o,c,g,h,p,m=this.context,y=(0,u.Z)(m).getInstance();function E(){t=!1;var e=Be.Z.parseUserAgent();n=e&&e.browser&&e.browser.name&&"safari"===e.browser.name.toLowerCase()}function v(){t=!1}function _(e){if(e.streamId===o.getActiveStreamInfo().id&&h){var t=c.getLiveDelay();c.getBufferLevel()>t/2&&(h=!1)}}function T(e){e.streamId===o.getActiveStreamInfo().id&&(h=e.state===s.Z.BUFFER_EMPTY)}function S(){g.getCatchupModeEnabled()||r.setPlaybackRate(1)}function b(){c.getIsDynamic()&&g.getCatchupModeEnabled()&&(g.getCatchupPlaybackRates().max>0||g.getCatchupPlaybackRates().min<0)&&!c.isPaused()&&!c.isSeeking()&&function(){try{return!(!c.getTime()>0||t)&&(I()===a.Z.LIVE_CATCHUP_MODE_LOLP?function(e,t){try{return Math.abs(A())>0||e<t}catch(e){return!1}}(c.getBufferLevel(),i.get().streaming.liveCatchup.playbackBufferMin):function(){try{return Math.abs(A())>0}catch(e){return!1}}())}catch(e){return!1}}()&&function(){if(!t&&r){var e,o=r.getPlaybackRate(),s=g.getCatchupPlaybackRates(),u=c.getBufferLevel(),l=A(),f=g.getCatchupMaxDrift();if(!isNaN(f)&&f>0&&l>f)p.info("[CatchupController]: Low Latency catchup mechanism. Latency too high, doing a seek to live point"),t=!0,c.seekToCurrentLive(!0,!1);else{var d=c.getCurrentLiveLatency(),m=c.getLiveDelay();e=I()===a.Z.LIVE_CATCHUP_MODE_LOLP?function(e,t,n,r,i){var a;if(i<r){var o=Math.abs(e.min),s=5*(i-r);a=1-o+2*o/(1+Math.pow(Math.E,-s)),p.debug("[LoL+ playback control_buffer-based] bufferLevel: "+i+", newRate: "+a)}else{if(Math.abs(t-n)<=.02*n)a=1;else{var u=t-n,l=u<0?Math.abs(e.min):e.max,c=5*u;a=1-l+2*l/(1+Math.pow(Math.E,-c))}p.debug("[LoL+ playback control_latency-based] latency: "+t+", newRate: "+a)}return a}(s,d,m,i.get().streaming.liveCatchup.playbackBufferMin,u):function(e,t,n,r){if(h)return 1;var i=t-n,a=i<0?Math.abs(e.min):e.max,o=5*i,s=1-a+2*a/(1+Math.pow(Math.E,-o));return c.getPlaybackStalled()&&r<=n/2&&i>0&&(s=1),s}(s,d,m,u);var y=n?.25:.02/(.5/s.max);e&&Math.abs(o-e)>=y&&(p.debug("[CatchupController]: Setting playback rate to ".concat(e)),r.setPlaybackRate(e))}}}()}function A(){return c.getCurrentLiveLatency()-c.getLiveDelay()}function I(){var e=i.get().streaming.liveCatchup.playbackBufferMin;return i.get().streaming.liveCatchup.mode!==a.Z.LIVE_CATCHUP_MODE_LOLP||null===e||isNaN(e)?a.Z.LIVE_CATCHUP_MODE_DEFAULT:a.Z.LIVE_CATCHUP_MODE_LOLP}function R(){g.getCatchupPlaybackRates(!0)}return e={reset:function(){y.off(d.Z.BUFFER_LEVEL_UPDATED,_,e),y.off(d.Z.BUFFER_LEVEL_STATE_CHANGED,T,e),y.off(d.Z.PLAYBACK_PROGRESS,b,e),y.off(d.Z.PLAYBACK_TIME_UPDATED,b,e),y.off(d.Z.PLAYBACK_SEEKED,v,e),y.off(l.Z.SETTING_UPDATED_CATCHUP_ENABLED,S,e),y.off(l.Z.SETTING_UPDATED_PLAYBACK_RATE_MIN,R,e),y.off(l.Z.SETTING_UPDATED_PLAYBACK_RATE_MAX,R,e),y.off(d.Z.STREAM_INITIALIZED,R,e),E(),r.setPlaybackRate(1,!0)},setConfig:function(e){e&&(e.settings&&(i=e.settings),e.videoModel&&(r=e.videoModel),e.streamController&&(o=e.streamController),e.playbackController&&(c=e.playbackController),e.mediaPlayerModel&&(g=e.mediaPlayerModel))},initialize:function(){y.on(d.Z.BUFFER_LEVEL_UPDATED,_,e),y.on(d.Z.BUFFER_LEVEL_STATE_CHANGED,T,e),y.on(d.Z.PLAYBACK_PROGRESS,b,e),y.on(d.Z.PLAYBACK_TIME_UPDATED,b,e),y.on(d.Z.PLAYBACK_SEEKED,v,e),y.on(l.Z.SETTING_UPDATED_CATCHUP_ENABLED,S,e),y.on(l.Z.SETTING_UPDATED_PLAYBACK_RATE_MIN,R,e),y.on(l.Z.SETTING_UPDATED_PLAYBACK_RATE_MAX,R,e),y.on(d.Z.STREAM_INITIALIZED,R,e),R()}},p=(0,f.Z)(m).getInstance().getLogger(e),E(),e}ln.__dashjs_factory_name="CatchupController";var cn=c.Z.getSingletonFactory(ln),fn=[a.Z.SERVICE_DESCRIPTION_DVB_LL_SCHEME],dn="video",gn="audio";function hn(){var e,t,n,r,i,s=this.context;function u(){t={liveDelay:NaN,liveCatchup:{maxDrift:NaN,playbackRate:{min:NaN,max:NaN}},minBitrate:{},maxBitrate:{},initialBitrate:{},contentSteering:null},n=[]}function l(e,n,i){try{t[e][n]=i/1e3}catch(e){r.error(e)}}return e={getServiceDescriptionSettings:function(){return t},getProducerReferenceTimeOffsets:function(){return n},calculateProducerReferenceTimeOffsets:function(e){try{var t=[];if(e&&e.length>0){var s=[a.Z.VIDEO,a.Z.AUDIO,a.Z.TEXT],u=i.getAvailabilityStartTime()/1e3;e.forEach((function(e){var n=s.reduce((function(t,n){return t.concat(i.getAllMediaInfoForType(e,n))}),[]).reduce((function(t,n){return i.getProducerReferenceTimes(e,n).forEach((function(r){var a=i.getVoRepresentations(n);if(a&&a.length>0&&a[0].adaptation&&a[0].segmentInfoType===o.Z.SEGMENT_TEMPLATE){var s=a[0],l=new Date(r[o.Z.WALL_CLOCK_TIME]).getTime()/1e3-(r[o.Z.PRESENTATION_TIME]/s[o.Z.TIMESCALE]-s[o.Z.PRESENTATION_TIME_OFFSET]+e.start),c=u-l;t.push({id:r[o.Z.ID],to:c})}})),t}),[]);t=t.concat(n)}))}n=t}catch(e){r.error(e),n=[]}},applyServiceDescription:function(e){if(e&&e.serviceDescriptions){var i=e.serviceDescriptions.filter((function(e){return fn.includes(e.schemeIdUri)})),o=e.serviceDescriptions.filter((function(e){return null==e.schemeIdUri})),s=i.length>0?i[i.length-1]:o[o.length-1];s&&(s.latency&&s.latency.target>0&&function(e){var i;if(e.schemeIdUri,a.Z.SERVICE_DESCRIPTION_DVB_LL_SCHEME,i=function(e){return{liveDelay:e.latency.target/1e3,maxDrift:!isNaN(e.latency.max)&&e.latency.max>e.latency.target?(e.latency.max-e.latency.target+500)/1e3:NaN,referenceId:e.latency.referenceId||NaN}}(e),n.length>0){var o=function(e){var t,r=0,i=n.filter((function(t){return t.id===e.referenceId}));return 0===i.length?(r=n.length>0?n[0].to:0,t=n[0].id||NaN):(r=i[0].to||0,t=i[0].id||NaN),{to:r,id:t}}(i),s=o.to,u=o.id;t.liveDelay=i.liveDelay-s,t.liveCatchup.maxDrift=i.maxDrift,r.debug("\\n Found latency properties coming from service description. Applied time offset of ".concat(s," from ProducerReferenceTime element with id ").concat(u,".\\n Live Delay: ").concat(i.liveDelay-s,", Live catchup max drift: ").concat(i.maxDrift,"\\n "))}else t.liveDelay=i.liveDelay,t.liveCatchup.maxDrift=i.maxDrift,r.debug("Found latency properties coming from service description: Live Delay: ".concat(i.liveDelay,", Live catchup max drift: ").concat(i.maxDrift))}(s),s.playbackRate&&function(e){var n=e.playbackRate.min?Math.round(1e3*(e.playbackRate.min-1))/1e3:NaN,i=e.playbackRate.max?Math.round(1e3*(e.playbackRate.max-1))/1e3:NaN;t.liveCatchup.playbackRate.min=n,t.liveCatchup.playbackRate.max=i,r.debug("Found latency properties coming from service description: Live catchup min playback rate: ".concat(n)),r.debug("Found latency properties coming from service description: Live catchup max playback rate: ".concat(i))}(s),s.operatingQuality,s.operatingBandwidth&&function(e){if(e&&e.operatingBandwidth&&e.operatingBandwidth.mediaType&&"all"!==e.operatingBandwidth.mediaType){var t={};t.minBandwidth=e.operatingBandwidth.min,t.maxBandwidth=e.operatingBandwidth.max,t.targetBandwidth=e.operatingBandwidth.target;var n=[];e.operatingBandwidth.mediaType===dn||e.operatingBandwidth.mediaType===gn?n.push(e.operatingBandwidth.mediaType):"any"===e.operatingBandwidth.mediaType&&(n.push(gn),n.push(dn)),n.forEach((function(e){isNaN(t.minBandwidth)||l("minBitrate",e,t.minBandwidth),isNaN(t.maxBandwidth)||l("maxBitrate",e,t.maxBandwidth),isNaN(t.targetBandwidth)||l("initialBitrate",e,t.targetBandwidth)}))}}(s),s.contentSteering&&function(e){t.contentSteering=e.contentSteering}(s))}},reset:function(){u()},setConfig:function(e){e&&e.adapter&&(i=e.adapter)}},r=(0,f.Z)(s).getInstance().getLogger(e),u(),e}hn.__dashjs_factory_name="ServiceDescriptionController";var pn=c.Z.getSingletonFactory(hn),mn=n(3973),yn=n.n(mn),En=n(3039);function vn(){var e,t,n,r,i,o,s,c,d=this.context,g=(0,u.Z)(d).getInstance();function h(e,t){return e&&n[t]&&n[t][e]?n[t][e].list:[]}function p(e,t){return e&&n[t]&&n[t][e]?n[t][e].current:null}function m(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e&&e.streamInfo){var i=e.type,s=e.streamInfo,u=s.id,f=p(i,u);if(n[u]&&n[u][i]&&(n[u][i].current=e,n[u][i].current&&(i!==a.Z.TEXT&&!v(e,f)||i===a.Z.TEXT&&e.isFragmented)&&g.trigger(l.Z.CURRENT_TRACK_CHANGED,{oldMediaInfo:f,newMediaInfo:e,switchMode:r.get().streaming.trackSwitchMode[i]},{streamId:u}),!t)){var d=T(e);if(!d||!n[u][i].storeLastSettings)return;d.roles&&(d.role=d.roles[0],delete d.roles),d.accessibility&&(d.accessibility=d.accessibility[0]),d.audioChannelConfiguration&&(d.audioChannelConfiguration=d.audioChannelConfiguration[0]),o[i]=d,c.setSavedMediaSettings(i,d)}}}function y(e,t){e&&t&&(i[e]=t)}function E(e){return e?i[e]:null}function v(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;var n=e.id===t.id,r=e.viewpoint===t.viewpoint,i=JSON.stringify(e.viewpointsWithSchemeIdUri)===JSON.stringify(t.viewpointsWithSchemeIdUri),a=e.lang===t.lang,o=e.codec===t.codec,s=e.roles.toString()===t.roles.toString(),u=JSON.stringify(e.rolesWithSchemeIdUri)===JSON.stringify(t.rolesWithSchemeIdUri),l=e.accessibility.toString()===t.accessibility.toString(),c=JSON.stringify(e.accessibilitiesWithSchemeIdUri)===JSON.stringify(t.accessibilitiesWithSchemeIdUri),f=e.audioChannelConfiguration.toString()===t.audioChannelConfiguration.toString(),d=JSON.stringify(e.audioChannelConfigurationsWithSchemeIdUri)===JSON.stringify(t.audioChannelConfigurationsWithSchemeIdUri);return n&&o&&r&&i&&a&&s&&u&&l&&c&&f&&d}function _(){n={},o={},i={audio:null,video:null,text:null}}function T(e){var t={lang:e.lang,viewpoint:e.viewpoint,roles:e.roles,accessibility:e.accessibility,audioChannelConfiguration:e.audioChannelConfiguration,codec:e.codec};return t.lang||t.viewpoint||t.role&&t.role.length>0||t.accessibility&&t.accessibility.length>0||t.audioChannelConfiguration&&t.audioChannelConfiguration.length>0?t:null}function S(e,t,n){var r=[];return e.forEach((function(e){t(n,e)&&r.push(e)})),0!==r.length?r:e}function b(e,t){return!e.lang||e.lang instanceof RegExp?t.lang.match(e.lang):""!==t.lang&&(0,En.extendedFilter)(t.lang,yn()(e.lang)).length>0}function A(e,t){return void 0===e.index||null===e.index||t.index===e.index}function I(e,t){return!e.viewpoint||e.viewpoint===t.viewpoint}function R(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=!e.role||!!t.roles.filter((function(t){return t===e.role}))[0];return r||t.type===a.Z.AUDIO&&n}function w(e,t){return e.accessibility?!!t.accessibility.filter((function(t){return t===e.accessibility}))[0]:!t.accessibility.length}function N(e,t){return!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return t===e.audioChannelConfiguration}))[0]}function C(e,t){return!e.codec||e.codec===t.codec}function D(e){var t,n=0,r=[];return e.forEach((function(e){(t=Math.max.apply(Math,e.bitrateList.map((function(e){return e.bandwidth}))))>n?(n=t,r=[e]):t===n&&r.push(e)})),r}function O(e){var t,n=1/0,r=[];return e.forEach((function(e){var i=e.bitrateList.reduce((function(e,t){var n=Math.max(1,t.width*t.height);return e+t.bandwidth/n}),0);(t=i/e.bitrateList.length)<n?(n=t,r=[e]):t===n&&r.push(e)})),r}function M(e){var t,n=0,r=[];return e.forEach((function(e){(t=e.representationCount)>n?(n=t,r=[e]):t===n&&r.push(e)})),r}function P(e,n){if(e===a.Z.TEXT)return n[0];var i,o=r.get().streaming.selectionModeForInitialTrack,u=s.getCustomInitialTrackSelectionFunction();if(u&&"function"==typeof u)i=u(n);else switch(o){case a.Z.TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY:i=function(e){var t,n,r=(t=0,n=[],e.forEach((function(e){isNaN(e.selectionPriority)||(e.selectionPriority>t?(t=e.selectionPriority,n=[e]):e.selectionPriority===t&&n.push(e))})),n);return r.length>1&&(r=D(r)),r.length>1&&(r=M(r)),r}(n);break;case a.Z.TRACK_SELECTION_MODE_HIGHEST_BITRATE:i=function(e){var t=D(e);return t.length>1&&(t=M(t)),t}(n);break;case a.Z.TRACK_SELECTION_MODE_FIRST_TRACK:i=L(n);break;case a.Z.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:i=function(e){var t=O(e);return t.length>1&&(t=D(t)),t}(n);break;case a.Z.TRACK_SELECTION_MODE_WIDEST_RANGE:i=function(e){var t=M(e);return t.length>1&&(t=D(e)),t}(n);break;default:t.warn("Track selection mode ".concat(o," is not supported. Falling back to TRACK_SELECTION_MODE_FIRST_TRACK")),i=L(n)}return i.length>0?i[0]:n[0]}function L(e){return e[0]}return e={setInitialMediaSettingsForType:function(e,t){var n=o[e]||E(e),r=h(e,t.id),i=[];n||((n=c.getSavedMediaSettings(e))&&delete n.codec,y(e,n)),r&&0!==r.length&&(n&&(i=S(i=Array.from(r),b,n),i=S(i,A,n),i=S(i,I,n),e===a.Z.AUDIO&&o[e]||(i=S(i,R,n)),i=S(i,w,n),i=S(i,N,n),i=S(i,C,n)),0===i.length?m(P(e,r),!0):i.length>1?m(P(e,i)):m(i[0]))},addTrack:function(e){if(e){var t=e.type;if((i=t)===a.Z.AUDIO||i===a.Z.VIDEO||i===a.Z.TEXT||i===a.Z.IMAGE){var i,o,s=e.streamInfo.id;n[s]||(n[s]={audio:{list:[],storeLastSettings:o=r.get().streaming.saveLastMediaSettingsForCurrentStreamingSession,current:null},video:{list:[],storeLastSettings:o,current:null},text:{list:[],storeLastSettings:o,current:null},image:{list:[],storeLastSettings:o,current:null}});for(var u=n[s][t].list,l=0,c=u.length;l<c;++l)if(v(u[l],e))return;u.push(e)}}},getTracksFor:h,getCurrentTrackFor:p,isCurrentTrack:function(e){if(!e)return!1;var t=e.type,r=e.streamInfo.id;return n[r]&&n[r][t]&&v(n[r][t].current,e)},setTrack:m,selectInitialTrack:P,setInitialSettings:y,getInitialSettings:E,getTracksWithHighestBitrate:D,getTracksWithHighestEfficiency:O,getTracksWithWidestRange:M,isTracksEqual:v,matchSettings:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{var r=!1;if(e.lang){if(e.lang instanceof RegExp)r=t.lang.match(e.lang);else if(""!==t.lang){var i=yn()(e.lang);i&&(r=(0,En.extendedFilter)(t.lang,i).length>0)}}else r=!0;var o=void 0===e.index||null===e.index||t.index===e.index,s=!e.viewpoint||e.viewpoint===t.viewpoint,u=!e.role||!!t.roles.filter((function(t){return t===e.role}))[0],l=!e.accessibility||!!t.accessibility.filter((function(t){return t===e.accessibility}))[0],c=!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return t===e.audioChannelConfiguration}))[0];return r&&o&&s&&(u||t.type===a.Z.AUDIO&&n)&&l&&c}catch(e){return!1}},matchSettingsLang:b,matchSettingsIndex:A,matchSettingsViewPoint:I,matchSettingsRole:R,matchSettingsAccessibility:w,matchSettingsAudioChannelConfig:N,saveTextSettingsDisabled:function(){c.setSavedMediaSettings(a.Z.TEXT,null)},setConfig:function(e){e&&(e.domStorage&&(c=e.domStorage),e.settings&&(r=e.settings),e.customParametersModel&&(s=e.customParametersModel))},reset:_},t=(0,f.Z)(d).getInstance().getLogger(e),_(),e}vn.__dashjs_factory_name="MediaController";var _n=c.Z.getSingletonFactory(vn);c.Z.updateSingletonFactory(vn.__dashjs_factory_name,_n);var Tn=_n,Sn=NaN,bn=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data={baseUrls:t||null,selectedIdx:n||Sn},this.children=[]};function An(){var e,t,n,r,i=this.context,a=Oe(i).getInstance();function o(e,t,n){var r=s(n);e[t]?a.areEqual(r,e[t].data.baseUrls)||(e[t].data.baseUrls=r,e[t].data.selectedIdx=Sn):e[t]=new bn(r)}function s(e){var t=n.getBaseURLsFromElement(e),i=r.getSynthesizedBaseUrlElements(t);return i&&i.length>0&&(t=t.concat(i)),t}function u(e,n){var r=n||t;e(r.data),r.children&&r.children.forEach((function(t){return u(e,t)}))}function l(){t=new bn}return e={reset:l,update:function(e){!function(e){!function(){if(!n||!n.hasOwnProperty("getBaseURLsFromElement")||!n.hasOwnProperty("getRepresentationSortFunction"))throw new Error("setConfig function has to be called previously")}();var r=s(e);a.areEqual(r,t.data.baseUrls)||(t.data.baseUrls=r,t.data.selectedIdx=Sn),e&&e.Period_asArray&&e.Period_asArray.forEach((function(e,r){o(t.children,r,e),e.AdaptationSet_asArray&&e.AdaptationSet_asArray.forEach((function(e,i){o(t.children[r].children,i,e),e.Representation_asArray&&e.Representation_asArray.sort(n.getRepresentationSortFunction()).forEach((function(e,n){o(t.children[r].children[i].children,n,e)}))}))}))}(e)},getForPath:function(e){var n=t,r=[n.data];return e&&e.forEach((function(e){(n=n.children[e])&&r.push(n.data)})),r.filter((function(e){return e.baseUrls.length}))},invalidateSelectedIndexes:function(e){u((function(t){isNaN(t.selectedIdx)||e===t.baseUrls[t.selectedIdx].serviceLocation&&(t.selectedIdx=Sn)}))},setConfig:function(e){e.adapter&&(n=e.adapter),e.contentSteeringController&&(r=e.contentSteeringController)},getBaseUrls:function(e){return s(e)}},l(),e}An.__dashjs_factory_name="BaseURLTreeModel";var In=c.Z.getClassFactory(An);function Rn(e){var t=(e=e||{}).blacklistController;return{select:function(e){return e&&function(e){var t,n,r=0,i=[],a=0;if((n=e.sort((function(e,t){var n=e.dvb_priority-t.dvb_priority;return isNaN(n)?0:n})).filter((function(e,t,n){return!t||n[0].dvb_priority&&e.dvb_priority&&n[0].dvb_priority===e.dvb_priority}))).length)return n.length>1&&(n.forEach((function(e){r+=e.dvb_weight,i.push(r)})),t=Math.floor(Math.random()*(r-1)),i.every((function(e,n){return a=n,!(t<e)}))),n[a]}((n=[],e.filter((function(e){return!t.contains(e.serviceLocation)||(e.dvb_priority&&n.push(e.dvb_priority),!1)})).filter((function(e){return!n.length||!e.dvb_priority||-1===n.indexOf(e.dvb_priority)}))));var n}}}Rn.__dashjs_factory_name="DVBSelector";var wn=c.Z.getClassFactory(Rn);function Nn(e){var t=(e=e||{}).blacklistController;return{select:function(e){var n,r=0;return e&&e.some((function(e,n){return r=n,!t.contains(e.serviceLocation)}))&&(n=e[r]),n}}}Nn.__dashjs_factory_name="BasicSelector";var Cn=c.Z.getClassFactory(Nn);function Dn(){var e,t,n,r=this.context;function i(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=0,i=NaN,a=function(){var a=e[r],o=t.findIndex((function(e){return e.serviceLocation&&e.serviceLocation===a}));if(-1!==o&&!n.contains(t[o].serviceLocation))return i=o,"break";r+=1};r<e.length;){var o=a();if("break"===o)break}return i}return e={selectBaseUrlIndex:function(e){var n=NaN;if(isNaN(e.selectedIdx)){var r=t.getSteeringDataFromManifest();r&&r.defaultServiceLocationArray.length>0&&(n=i(r.defaultServiceLocationArray,e.baseUrls))}var a=t.getCurrentSteeringResponseData();return e.baseUrls&&e.baseUrls.length&&a&&a.pathwayPriority&&a.pathwayPriority.length&&(n=i(a.pathwayPriority,e.baseUrls)),n},setConfig:function(e){e.blacklistController&&(n=e.blacklistController),e.contentSteeringController&&(t=e.contentSteeringController)}},t=jt(r).getInstance(),e}Dn.__dashjs_factory_name="ContentSteeringSelector";var On=c.Z.getClassFactory(Dn);function Mn(){var e,t,n,r,i,a,o=this.context,s=(0,u.Z)(o).getInstance(),c=(0,N.Z)(o).getInstance();function f(){t.reset()}return e={chooseSelector:function(e){(0,z.PS)(e,"boolean"),a=e?r:n},select:function(e){if(e){if(c.get().streaming.applyContentSteering){var t=i.selectBaseUrlIndex(e);isNaN(t)||-1===t||(e.selectedIdx=t)}if(!isNaN(e.selectedIdx))return e.baseUrls[e.selectedIdx];var r=a.select(e.baseUrls);return r?(e.selectedIdx=e.baseUrls.indexOf(r),r):(s.trigger(l.Z.URL_RESOLUTION_FAILED,{error:new S.Z(w.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE,w.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE)}),void(a===n&&f()))}},reset:f,setConfig:function(e){e.selector&&(a=e.selector),e.contentSteeringSelector&&(i=e.contentSteeringSelector)}},t=kt(o).create({updateEventName:l.Z.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,addBlacklistEventName:l.Z.SERVICE_LOCATION_BASE_URL_BLACKLIST_ADD}),n=Cn(o).create({blacklistController:t}),r=wn(o).create({blacklistController:t}),(i=On(o).create()).setConfig({blacklistController:t}),a=n,e}Mn.__dashjs_factory_name="BaseURLSelector";var Pn=c.Z.getClassFactory(Mn);function Ln(){var e,t,n,r,i,a=this.context,o=(0,u.Z)(a).getInstance(),s=(0,Q.Z)(a).getInstance();function c(e){n.update(e),r.chooseSelector(t.getIsDVB(e)),o.trigger(d.Z.BASE_URLS_UPDATED,{baseUrls:f(e)})}function f(e){return n.getBaseUrls(e)}return e={reset:function(){n.reset(),r.reset()},initialize:function(e){n.setConfig({adapter:t,contentSteeringController:i}),c(e)},resolve:function(e){var t=n.getForPath(e).reduce((function(e,t){var n=r.select(t);return n?(s.isRelative(n.url)?e.url=s.resolve(n.url,e.url):(e.url=n.url,e.serviceLocation=n.serviceLocation),e.availabilityTimeOffset=n.availabilityTimeOffset,e.availabilityTimeComplete=n.availabilityTimeComplete,e.queryParams=n.queryParams,e):new Se}),new Se);if(!s.isRelative(t.url))return t},setConfig:function(e){e.baseURLTreeModel&&(n=e.baseURLTreeModel),e.baseURLSelector&&(r=e.baseURLSelector),e.adapter&&(t=e.adapter),e.contentSteeringController&&(i=e.contentSteeringController)},getBaseUrls:f,update:c},n=In(a).create(),r=Pn(a).create(),o.on(l.Z.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,(function(e){n.invalidateSelectedIndexes(e.entry)}),e),e}Ln.__dashjs_factory_name="BaseURLController";var xn=c.Z.getClassFactory(Ln);function Fn(e){return Fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Fn(e)}function kn(e,t){return kn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},kn(e,t)}function Un(e,t){return!t||"object"!==Fn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function Zn(e){return Zn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Zn(e)}var Bn=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&kn(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=Zn(t);if(n){var i=Zn(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return Un(this,e)});function i(e,t){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(n=r.call(this)).url=e||null,n.type=t||null,n.mediaType=a.Z.STREAM,n.responseType="",n}return i}(p.Z);function Gn(e){e=e||{};var t=this.context,n=(0,u.Z)(t).getInstance(),r=vt(t).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,errors:w});return{load:function(e,t,i){var a=function(r,a){t.resolved=!0,t.resolvedContent=r||null,n.trigger(l.Z.XLINK_ELEMENT_LOADED,{element:t,resolveObject:i,error:r||a?null:new S.Z(w.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE,w.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE+e)})};if("urn:mpeg:dash:resolve-to-zero:2013"===e)a(null,!0);else{var o=new Bn(e,C.w.XLINK_EXPANSION_TYPE);r.load({request:o,success:function(e){a(e)},error:function(){a(null)}})}},reset:function(){r&&(r.abort(),r=null)}}}Gn.__dashjs_factory_name="XlinkLoader";var qn=c.Z.getClassFactory(Gn),Yn=function(e){void 0===(e=e||{}).escapeMode&&(e.escapeMode=!0),void 0===e.attributePrefix&&(e.attributePrefix="_"),e.arrayAccessForm=e.arrayAccessForm||"none",e.emptyNodeForm=e.emptyNodeForm||"text",void 0===e.enableToStringFunc&&(e.enableToStringFunc=!0),e.arrayAccessFormPaths=e.arrayAccessFormPaths||[],void 0===e.skipEmptyTextNodesForObj&&(e.skipEmptyTextNodesForObj=!0),void 0===e.stripWhitespaces&&(e.stripWhitespaces=!0),e.datetimeAccessFormPaths=e.datetimeAccessFormPaths||[],void 0===e.useDoubleQuotes&&(e.useDoubleQuotes=!1),e.xmlElementsFilter=e.xmlElementsFilter||[],e.jsonPropertiesFilter=e.jsonPropertiesFilter||[],void 0===e.keepCData&&(e.keepCData=!1),void 0===e.ignoreRoot&&(e.ignoreRoot=!1);function t(e){var t=e.localName;return null==t&&(t=e.baseName),null!=t&&""!=t||(t=e.nodeName),t}function n(e){return"string"==typeof e?e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/\'/g,"'"):e}function r(e,t,n,r){for(var i=0;i<e.length;i++){var a=e[i];if("string"==typeof a){if(a==r)break}else if(a instanceof RegExp){if(a.test(r))break}else if("function"==typeof a&&a(t,n,r))break}return i!=e.length}function i(t,n,i){"property"===e.arrayAccessForm&&(t[n]instanceof Array?t[n+"_asArray"]=t[n]:t[n+"_asArray"]=[t[n]]),!(t[n]instanceof Array)&&e.arrayAccessFormPaths.length>0&&r(e.arrayAccessFormPaths,t,n,i)&&(t[n]=[t[n]])}function a(e){var t=e.split(/[-T:+Z]/g),n=new Date(t[0],t[1]-1,t[2]),r=t[5].split(".");if(n.setHours(t[3],t[4],r[0]),r.length>1&&n.setMilliseconds(r[1]),t[6]&&t[7]){var i=60*t[6]+Number(t[7]);i=0+("-"==(/\\d\\d-\\d\\d:\\d\\d$/.test(e)?"-":"+")?-1*i:i),n.setMinutes(n.getMinutes()-i-n.getTimezoneOffset())}else-1!==e.indexOf("Z",e.length-1)&&(n=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())));return n}function o(t,n,i,a){return!(1==n&&e.xmlElementsFilter.length>0)||r(e.xmlElementsFilter,t,i,a)}function s(n,u){if(9==n.nodeType){for(var l=new Object,c=n.childNodes,f=0;f<c.length;f++)1==(g=c[f]).nodeType&&(e.ignoreRoot?l=s(g):(l={})[h=t(g)]=s(g));return l}if(1==n.nodeType){(l=new Object).__cnt=0;var d=[];for(c=n.childNodes,f=0;f<c.length;f++){var g,h=t(g=c[f]);if(8!=g.nodeType){var p=u+"."+h;if(o(l,g.nodeType,h,p))if(l.__cnt++,null==l[h]){var m=s(g,p);("#text"!=h||/[^\\s]/.test(m))&&((y={})[h]=m,d.push(y)),l[h]=m,i(l,h,p)}else{var y;null!=l[h]&&(l[h]instanceof Array||(l[h]=[l[h]],i(l,h,p))),m=s(g,p),("#text"!=h||/[^\\s]/.test(m))&&((y={})[h]=m,d.push(y)),l[h][l[h].length]=m}}}l.__children=d;for(var E=t(n),v=0;v<n.attributes.length;v++){var _=n.attributes[v];l.__cnt++;for(var T=_.value,S=0,b=e.matchers.length;S<b;S++){var A=e.matchers[S];A.test(_,E)&&(T=A.converter(_.value))}l[e.attributePrefix+_.name]=T}var I=function(e){return e.prefix}(n);return null!=I&&""!=I&&(l.__cnt++,l.__prefix=I),null!=l["#text"]&&(l.__text=l["#text"],l.__text instanceof Array&&(l.__text=l.__text.join("\\n")),e.stripWhitespaces&&(l.__text=l.__text.trim()),delete l["#text"],"property"==e.arrayAccessForm&&delete l["#text_asArray"],l.__text=function(t,n,i){if(e.datetimeAccessFormPaths.length>0){var o=i.split(".#")[0];return r(e.datetimeAccessFormPaths,t,n,o)?a(t):t}return t}(l.__text,h,u+"."+h)),null!=l["#cdata-section"]&&(l.__cdata=l["#cdata-section"],delete l["#cdata-section"],"property"==e.arrayAccessForm&&delete l["#cdata-section_asArray"]),0==l.__cnt&&"text"==e.emptyNodeForm?l="":1==l.__cnt&&null!=l.__text?l=l.__text:1!=l.__cnt||null==l.__cdata||e.keepCData?l.__cnt>1&&null!=l.__text&&e.skipEmptyTextNodesForObj&&(e.stripWhitespaces&&""==l.__text||""==l.__text.trim())&&delete l.__text:l=l.__cdata,delete l.__cnt,!e.enableToStringFunc||null==l.__text&&null==l.__cdata||(l.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),l}if(3==n.nodeType||4==n.nodeType)return n.nodeValue}function u(t,r,i,a){var o="<"+(null!=t&&null!=t.__prefix?t.__prefix+":":"")+r;if(null!=i)for(var s=0;s<i.length;s++){var u=i[s],l=t[u];e.escapeMode&&(l=n(l)),o+=" "+u.substr(e.attributePrefix.length)+"=",e.useDoubleQuotes?o+=\'"\'+l+\'"\':o+="\'"+l+"\'"}return o+(a?"/>":">")}function l(e,t){return"</"+(null!=e.__prefix?e.__prefix+":":"")+t+">"}function c(t,n){return"property"==e.arrayAccessForm&&(i="_asArray",-1!==(r=n.toString()).indexOf(i,r.length-i.length))||0==n.toString().indexOf(e.attributePrefix)||0==n.toString().indexOf("__")||t[n]instanceof Function;var r,i}function f(e){var t=0;if(e instanceof Object)for(var n in e)c(e,n)||t++;return t}function d(t,n,i){return 0==e.jsonPropertiesFilter.length||""==i||r(e.jsonPropertiesFilter,t,n,i)}function g(t){var n=[];if(t instanceof Object)for(var r in t)-1==r.toString().indexOf("__")&&0==r.toString().indexOf(e.attributePrefix)&&n.push(r);return n}function h(t){var r="";return t instanceof Object?r+=function(t){var r="";return null!=t.__cdata&&(r+="<![CDATA["+t.__cdata+"]]>"),null!=t.__text&&(e.escapeMode?r+=n(t.__text):r+=t.__text),r}(t):null!=t&&(e.escapeMode?r+=n(t):r+=t),r}function p(e,t){return""===e?t:e+"."+t}function m(e,t,n,r){var i="";if(0==e.length)i+=u(e,t,n,!0);else for(var a=0;a<e.length;a++)i+=u(e[a],t,g(e[a]),!1),i+=y(e[a],p(r,t)),i+=l(e[a],t);return i}function y(e,t){var n="";if(f(e)>0)for(var r in e)if(!c(e,r)&&(""==t||d(e,r,p(t,r)))){var i=e[r],a=g(i);null==i||null==i?n+=u(i,r,a,!0):i instanceof Object?i instanceof Array?n+=m(i,r,a,t):i instanceof Date?(n+=u(i,r,a,!1),n+=i.toISOString(),n+=l(i,r)):f(i)>0||null!=i.__text||null!=i.__cdata?(n+=u(i,r,a,!1),n+=y(i,p(t,r)),n+=l(i,r)):n+=u(i,r,a,!0):(n+=u(i,r,a,!1),n+=h(i),n+=l(i,r))}return n+h(e)}this.parseXmlString=function(e){var t;if(window.ActiveXObject||window,void 0===e)return null;if(window.DOMParser){var n=new window.DOMParser;try{(t=n.parseFromString(e,"text/xml")).getElementsByTagNameNS("*","parsererror").length>0&&(t=null)}catch(e){t=null}}else 0==e.indexOf("<?")&&(e=e.substr(e.indexOf("?>")+2)),(t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e);return t},this.asArray=function(e){return void 0===e||null==e?[]:e instanceof Array?e:[e]},this.toXmlDateTime=function(e){return e instanceof Date?e.toISOString():"number"==typeof e?new Date(e).toISOString():null},this.asDateTime=function(e){return"string"==typeof e?a(e):e},this.xml2json=function(e){return s(e)},this.xml_str2json=function(e){var t=this.parseXmlString(e);return null!=t?this.xml2json(t):null},this.json2xml_str=function(e){return y(e,"")},this.json2xml=function(e){var t=this.json2xml_str(e);return this.parseXmlString(t)},this.getVersion=function(){return"1.2.0"}},jn="onLoad";function Hn(e){e=e||{};var t,n,r,i,a,s,c=this.context,f=(0,u.Z)(c).getInstance(),d=(0,Q.Z)(c).getInstance();function g(e,t,n){var r,i,a={};a.elements=e,a.type=t,a.resolveType=n,0===a.elements.length&&p(a);for(var o=0;o<a.elements.length;o++)r=a.elements[o],i=d.isHTTPURL(r.url)?r.url:r.originalContent.BaseURL+r.url,s.load(i,r,a)}function h(e){var t,n,r="";if(t=e.element,n=e.resolveObject,t.resolvedContent){var i=0;0===t.resolvedContent.indexOf("<?xml")&&(i=t.resolvedContent.indexOf("?>")+2),r=t.resolvedContent.substr(0,i)+"<response>"+t.resolvedContent.substr(i)+"</response>",t.resolvedContent=a.xml_str2json(r)}(function(e){var t;for(t=0;t<e.elements.length;t++)if(!1===e.elements[t].resolved)return!1;return!0})(n)&&p(n)}function p(e){var t,n,a=[];if(function(e){var t,n,a,o,s,u,l=[];for(o=e.elements.length-1;o>=0;o--){if(n=(t=e.elements[o]).type+"_asArray",t.resolvedContent){if(t.resolvedContent)for(s=0;s<t.resolvedContent[n].length;s++)a=t.resolvedContent[n][s],l.push(a)}else delete t.originalContent["xlink:actuate"],delete t.originalContent["xlink:href"],l.push(t.originalContent);for(t.parentElement[n].splice(t.index,1),u=0;u<l.length;u++)t.parentElement[n].splice(t.index+u,0,l[u]);l=[]}e.elements.length>0&&r.run(i)}(e),"onActuate"===e.resolveType&&f.trigger(l.Z.XLINK_READY,{manifest:i}),e.resolveType===jn)switch(e.type){case o.Z.PERIOD:for(t=0;t<i[o.Z.PERIOD+"_asArray"].length;t++)(n=i[o.Z.PERIOD+"_asArray"][t]).hasOwnProperty(o.Z.ADAPTATION_SET+"_asArray")&&(a=a.concat(m(n[o.Z.ADAPTATION_SET+"_asArray"],n,o.Z.ADAPTATION_SET,jn))),n.hasOwnProperty(o.Z.EVENT_STREAM+"_asArray")&&(a=a.concat(m(n[o.Z.EVENT_STREAM+"_asArray"],n,o.Z.EVENT_STREAM,jn)));g(a,o.Z.ADAPTATION_SET,jn);break;case o.Z.ADAPTATION_SET:f.trigger(l.Z.XLINK_READY,{manifest:i})}}function m(e,t,n,r){var i,a,o,s=[];for(a=e.length-1;a>=0;a--)(i=e[a]).hasOwnProperty("xlink:href")&&"urn:mpeg:dash:resolve-to-zero:2013"===i["xlink:href"]&&e.splice(a,1);for(a=0;a<e.length;a++)(i=e[a]).hasOwnProperty("xlink:href")&&i.hasOwnProperty("xlink:actuate")&&i["xlink:actuate"]===r&&(o=y(i["xlink:href"],t,n,a,r,i),s.push(o));return s}function y(e,t,n,r,i,a){return{url:e,parentElement:t,type:n,index:r,resolveType:i,originalContent:a,resolvedContent:null,resolved:!1}}return t={resolveManifestOnLoad:function(e){a=new Yn({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!1,ignoreRoot:!0,matchers:n}),(i=e).Period_asArray?g(m(i.Period_asArray,i,o.Z.PERIOD,jn),o.Z.PERIOD,jn):f.trigger(l.Z.XLINK_READY,{manifest:i})},setMatchers:function(e){e&&(n=e)},setIron:function(e){e&&(r=e)},reset:function(){f.off(l.Z.XLINK_ELEMENT_LOADED,h,t),s&&(s.reset(),s=null)}},f.on(l.Z.XLINK_ELEMENT_LOADED,h,t),s=qn(c).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,settings:e.settings}),t}Hn.__dashjs_factory_name="XlinkController";var Vn=c.Z.getClassFactory(Hn);function Kn(e){return Kn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kn(e)}function zn(e){function t(e,t){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}function n(e,n,r){for(var i=0,a=e.length;i<a;++i){var o=e[i];if(n[o.name])if(r[o.name]){if(o.merge){var s=n[o.name],u=r[o.name];"object"===Kn(s)&&"object"===Kn(u)?t(s,u):r[o.name]=s+u}}else r[o.name]=n[o.name]}}function r(e,t){for(var i=0,a=e.children.length;i<a;++i){var o=e.children[i],s=t[o.name+"_asArray"];if(s)for(var u=0,l=s.length;u<l;++u){var c=s[u];n(e.properties,t,c),r(o,c)}}}return{run:function(t){if(null===t||"object"!==Kn(t))return t;if(t.Period_asArray&&"period"in e)for(var n=e.period,i=t.Period_asArray,a=0,o=i.length;a<o;++a){var s=i[a];if(r(n,s),"adaptationset"in e){var u=s.AdaptationSet_asArray;if(u)for(var l=e.adaptationset,c=0,f=u.length;c<f;++c)r(l,u[c])}}return t}}}zn.__dashjs_factory_name="ObjectIron";var Wn=c.Z.getClassFactory(zn);function Xn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Qn=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._test=t,this._converter=n}var t,n;return t=e,(n=[{key:"test",get:function(){return this._test}},{key:"converter",get:function(){return this._converter}}])&&Xn(t.prototype,n),e}();function Jn(e){return Jn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jn(e)}function $n(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function er(e,t){return er=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},er(e,t)}function tr(e,t){return!t||"object"!==Jn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function nr(e){return nr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},nr(e)}var rr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&er(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=nr(t);if(n){var i=nr(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return tr(this,e)});function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),r.call(this,(function(e,t){var n,r=($n(n={},o.Z.MPD,[o.Z.ID,o.Z.PROFILES]),$n(n,o.Z.PERIOD,[o.Z.ID]),$n(n,o.Z.BASE_URL,[o.Z.SERVICE_LOCATION,o.Z.BYTE_RANGE]),$n(n,o.Z.SEGMENT_BASE,[o.Z.INDEX_RANGE]),$n(n,o.Z.INITIALIZATION,[o.Z.RANGE]),$n(n,o.Z.REPRESENTATION_INDEX,[o.Z.RANGE]),$n(n,o.Z.SEGMENT_LIST,[o.Z.INDEX_RANGE]),$n(n,o.Z.BITSTREAM_SWITCHING,[o.Z.RANGE]),$n(n,o.Z.SEGMENT_URL,[o.Z.MEDIA_RANGE,o.Z.INDEX_RANGE]),$n(n,o.Z.SEGMENT_TEMPLATE,[o.Z.INDEX_RANGE,o.Z.MEDIA,o.Z.INDEX,o.Z.INITIALIZATION_MINUS,o.Z.BITSTREAM_SWITCHING_MINUS]),$n(n,o.Z.ASSET_IDENTIFIER,[o.Z.VALUE,o.Z.ID]),$n(n,o.Z.EVENT_STREAM,[o.Z.VALUE]),$n(n,o.Z.ADAPTATION_SET,[o.Z.PROFILES,o.Z.MIME_TYPE,o.Z.SEGMENT_PROFILES,o.Z.CODECS,o.Z.CONTENT_TYPE]),$n(n,o.Z.FRAME_PACKING,[o.Z.VALUE,o.Z.ID]),$n(n,o.Z.AUDIO_CHANNEL_CONFIGURATION,[o.Z.VALUE,o.Z.ID]),$n(n,o.Z.CONTENT_PROTECTION,[o.Z.VALUE,o.Z.ID]),$n(n,o.Z.ESSENTIAL_PROPERTY,[o.Z.VALUE,o.Z.ID]),$n(n,o.Z.SUPPLEMENTAL_PROPERTY,[o.Z.VALUE,o.Z.ID]),$n(n,o.Z.INBAND_EVENT_STREAM,[o.Z.VALUE,o.Z.ID]),$n(n,o.Z.ACCESSIBILITY,[o.Z.VALUE,o.Z.ID]),$n(n,o.Z.ROLE,[o.Z.VALUE,o.Z.ID]),$n(n,o.Z.RATING,[o.Z.VALUE,o.Z.ID]),$n(n,o.Z.VIEWPOINT,[o.Z.VALUE,o.Z.ID]),$n(n,o.Z.CONTENT_COMPONENT,[o.Z.CONTENT_TYPE]),$n(n,o.Z.REPRESENTATION,[o.Z.ID,o.Z.DEPENDENCY_ID,o.Z.MEDIA_STREAM_STRUCTURE_ID]),$n(n,o.Z.SUBSET,[o.Z.ID]),$n(n,o.Z.METRICS,[o.Z.METRICS_MINUS]),$n(n,o.Z.REPORTING,[o.Z.VALUE,o.Z.ID]),n);if(r.hasOwnProperty(t)){var i=r[t];return void 0!==i&&i.indexOf(e.name)>=0}return!1}),(function(e){return String(e)}))}return i}(Qn);function ir(e){return ir="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ir(e)}function ar(e,t){return ar=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ar(e,t)}function or(e,t){return!t||"object"!==ir(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function sr(e){return sr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},sr(e)}var ur=/^([-])?P(([\\d.]*)Y)?(([\\d.]*)M)?(([\\d.]*)D)?T?(([\\d.]*)H)?(([\\d.]*)M)?(([\\d.]*)S)?/,lr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ar(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=sr(t);if(n){var i=sr(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return or(this,e)});function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),r.call(this,(function(e){for(var t=[o.Z.MIN_BUFFER_TIME,o.Z.MEDIA_PRESENTATION_DURATION,o.Z.MINIMUM_UPDATE_PERIOD,o.Z.TIMESHIFT_BUFFER_DEPTH,o.Z.MAX_SEGMENT_DURATION,o.Z.MAX_SUBSEGMENT_DURATION,o.Z.SUGGESTED_PRESENTATION_DELAY,o.Z.START,a.Z.START_TIME,o.Z.DURATION],n=t.length,r=0;r<n;r++)if(e.nodeName===t[r])return ur.test(e.value);return!1}),(function(e){var t=ur.exec(e),n=31536e3*parseFloat(t[3]||0)+2592e3*parseFloat(t[5]||0)+86400*parseFloat(t[7]||0)+3600*parseFloat(t[9]||0)+60*parseFloat(t[11]||0)+parseFloat(t[13]||0);return void 0!==t[1]&&(n=-n),n}))}return i}(Qn);function cr(e){return cr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cr(e)}function fr(e,t){return fr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},fr(e,t)}function dr(e,t){return!t||"object"!==cr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function gr(e){return gr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},gr(e)}var hr=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\\.[0-9]*)?)?(?:([+-])([0-9]{2})(?::?)([0-9]{2}))?/,pr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&fr(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=gr(t);if(n){var i=gr(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return dr(this,e)});function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),r.call(this,(function(e){return hr.test(e.value)}),(function(e){var t,n=hr.exec(e);if(t=Date.UTC(parseInt(n[1],10),parseInt(n[2],10)-1,parseInt(n[3],10),parseInt(n[4],10),parseInt(n[5],10),n[6]&&parseInt(n[6],10)||0,n[7]&&1e3*parseFloat(n[7])||0),n[9]&&n[10]){var r=60*parseInt(n[9],10)+parseInt(n[10],10);t+=("+"===n[8]?-1:1)*r*60*1e3}return new Date(t)}))}return i}(Qn);function mr(e){return mr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},mr(e)}function yr(e,t){return yr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},yr(e,t)}function Er(e,t){return!t||"object"!==mr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function vr(e){return vr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},vr(e)}var _r=/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/,Tr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&yr(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=vr(t);if(n){var i=vr(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return Er(this,e)});function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),r.call(this,(function(e){return _r.test(e.value)}),(function(e){return parseFloat(e)}))}return i}(Qn);function Sr(e){return Sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Sr(e)}function br(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ar(e,t){return Ar=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ar(e,t)}function Ir(e,t){return!t||"object"!==Sr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function Rr(e){return Rr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Rr(e)}var wr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ar(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=Rr(t);if(n){var i=Rr(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return Ir(this,e)});function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),r.call(this,(function(e,t){var n,r=(br(n={},o.Z.ADAPTATION_SET,[o.Z.LANG]),br(n,o.Z.REPRESENTATION,[o.Z.LANG]),br(n,o.Z.CONTENT_COMPONENT,[o.Z.LANG]),br(n,o.Z.LABEL,[o.Z.LANG]),br(n,o.Z.GROUP_LABEL,[o.Z.LANG]),n);if(r.hasOwnProperty(t)){var i=r[t];return void 0!==i&&i.indexOf(e.name)>=0}return!1}),(function(e){return yn()(e)||String(e)}))}return i}(Qn);function Nr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Cr=function(){function e(t){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t,this._merge=(n=t)&&n.length&&n.charAt(0)===n.charAt(0).toUpperCase()}var t,n;return t=e,(n=[{key:"name",get:function(){return this._name}},{key:"merge",get:function(){return this._merge}}])&&Nr(t.prototype,n),e}();function Dr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Or=function(){function e(t,n,r){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t||"",this._properties=[],this._children=r||[],Array.isArray(n)&&n.forEach((function(e){i._properties.push(new Cr(e))}))}var t,n;return t=e,(n=[{key:"name",get:function(){return this._name}},{key:"children",get:function(){return this._children}},{key:"properties",get:function(){return this._properties}}])&&Dr(t.prototype,n),e}();function Mr(e){return Mr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mr(e)}function Pr(e,t){return Pr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Pr(e,t)}function Lr(e,t){return!t||"object"!==Mr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function xr(e){return xr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},xr(e)}var Fr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Pr(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=xr(t);if(n){var i=xr(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return Lr(this,e)});function i(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var e=[o.Z.PROFILES,o.Z.WIDTH,o.Z.HEIGHT,o.Z.SAR,o.Z.FRAMERATE,o.Z.AUDIO_SAMPLING_RATE,o.Z.MIME_TYPE,o.Z.SEGMENT_PROFILES,o.Z.CODECS,o.Z.MAXIMUM_SAP_PERIOD,o.Z.START_WITH_SAP,o.Z.MAX_PLAYOUT_RATE,o.Z.CODING_DEPENDENCY,o.Z.SCAN_TYPE,o.Z.FRAME_PACKING,o.Z.AUDIO_CHANNEL_CONFIGURATION,o.Z.CONTENT_PROTECTION,o.Z.ESSENTIAL_PROPERTY,o.Z.ESSENTIAL_PROPERTY+"_asArray",o.Z.SUPPLEMENTAL_PROPERTY,o.Z.INBAND_EVENT_STREAM];return r.call(this,o.Z.ADAPTATION_SET,e,[new Or(o.Z.REPRESENTATION,e,[new Or(o.Z.SUB_REPRESENTATION,e)])])}return i}(Or);function kr(e){return kr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kr(e)}function Ur(e,t){return Ur=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},Ur(e,t)}function Zr(e,t){return!t||"object"!==kr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function Br(e){return Br=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Br(e)}var Gr=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ur(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=Br(t);if(n){var i=Br(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return Zr(this,e)});function i(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var e=[o.Z.SEGMENT_BASE,o.Z.SEGMENT_TEMPLATE,o.Z.SEGMENT_LIST];return r.call(this,o.Z.PERIOD,e,[new Or(o.Z.ADAPTATION_SET,e,[new Or(o.Z.REPRESENTATION,e)])])}return i}(Or);function qr(e){e=e||{};var t,n,r,i,a,o=this.context,s=e.debug;return t={parse:function(e){var t,r=window.performance.now();if(!(t=i.xml_str2json(e)))throw new Error("parsing the manifest failed");var o=window.performance.now();t.Patch?((t=t.Patch).add_asArray&&t.add_asArray.forEach((function(e){return a.run(e)})),t.replace_asArray&&t.replace_asArray.forEach((function(e){return a.run(e)}))):(t=t.MPD,a.run(t));var s=window.performance.now();return n.info("Parsing complete: ( xml2json: "+(o-r).toPrecision(3)+"ms, objectiron: "+(s-o).toPrecision(3)+"ms, total: "+((s-r)/1e3).toPrecision(3)+"s)"),t.protocol="DASH",t},getMatchers:function(){return r},getIron:function(){return a}},n=s.getLogger(t),r=[new lr,new pr,new Tr,new wr,new rr],i=new Yn({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!0,ignoreRoot:!1,matchers:r}),a=Wn(o).create({adaptationset:new Fr,period:new Gr}),t}qr.__dashjs_factory_name="DashParser";var Yr=c.Z.getClassFactory(qr);function jr(e){e=e||{};var t,n,r,i,s,c=this.context,f=e.debug,d=e.settings,g=(0,u.Z)(c).getInstance(),h=(0,Q.Z)(c).getInstance(),p=e.mssHandler,m=e.errHandler;function y(e){g.trigger(l.Z.INTERNAL_MANIFEST_LOADED,{manifest:e.manifest})}function E(e){var t=null;return e.indexOf("SmoothStreamingMedia")>-1?(p&&(t=p.createMssParser(),p.createMssFragmentProcessor(),p.registerEvents()),t):e.indexOf("MPD")>-1||e.indexOf("Patch")>-1?Yr(c).create({debug:f}):t}return t={load:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=new Date,u=new Bn(e,C.w.MPD_TYPE);t&&(u.serviceLocation=t),a&&(u.queryParams=a),u.requestStartDate||(u.requestStartDate=o),g.trigger(l.Z.MANIFEST_LOADING_STARTED,{request:u}),r.load({request:u,success:function(t,r,a){var o,u,c;if(i)if(a&&a!==e?(u=h.parseBaseUrl(a),o=a):(h.isRelative(e)&&(e=h.resolve(e,window.location.href)),u=h.parseBaseUrl(e)),"No Content"!=r)if(null===s&&(s=E(t)),null!==s){i.setMatchers(s.getMatchers()),i.setIron(s.getIron());try{c=s.parse(t)}catch(t){return void g.trigger(l.Z.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new S.Z(w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))})}if(c){if(c.url=o||e,c.originalUrl||(c.originalUrl=c.url),d&&d.get().streaming.enableManifestDurationMismatchFix&&c.mediaPresentationDuration&&c.Period_asArray.length>1){var f=c.Period_asArray.reduce((function(e,t){return e+t.duration}),0);!isNaN(f)&&c.mediaPresentationDuration>f&&(n.warn("Media presentation duration greater than duration of all periods. Setting duration to total period duration"),c.mediaPresentationDuration=f)}c.baseUri=u,c.loadedTime=new Date,i.resolveManifestOnLoad(c),g.trigger(l.Z.ORIGINAL_MANIFEST_LOADED,{originalManifest:t})}else g.trigger(l.Z.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new S.Z(w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))})}else g.trigger(l.Z.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new S.Z(w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,w.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+"".concat(e))});else g.trigger(l.Z.INTERNAL_MANIFEST_LOADED,{manifest:null})},error:function(t,n,r){g.trigger(l.Z.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new S.Z(w.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE,w.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE+"".concat(e,", ").concat(r))})}})},reset:function(){g.off(l.Z.XLINK_READY,y,t),p&&p.reset(),i&&(i.reset(),i=null),r&&(r.abort(),r=null)}},n=f.getLogger(t),g.on(l.Z.XLINK_READY,y,t),r=vt(c).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,urlUtils:h,constants:a.Z,dashConstants:o.Z,errors:w,requestTimeout:e.settings.get().streaming.manifestRequestTimeout}),i=Vn(c).create({errHandler:m,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,settings:e.settings}),s=null,t}jr.__dashjs_factory_name="ManifestLoader";var Hr=c.Z.getClassFactory(jr);function Vr(){var e=this.context,t=(0,u.Z)(e).getInstance();return{error:function(e){t.trigger(l.Z.ERROR,{error:e})}}}Vr.__dashjs_factory_name="ErrorHandler";var Kr=c.Z.getSingletonFactory(Vr),zr=n(1715);function Wr(){var e,t,n,r,i,o,s=this.context,c=(0,u.Z)(s).getInstance();function d(e,r){if(!r||!r.Period_asArray||0===r.Period_asArray.length)return Promise.resolve();var i=[];return r.Period_asArray.forEach((function(r){i.push(function(e,r){return new Promise((function(i){if(e&&e.AdaptationSet_asArray&&0!==e.AdaptationSet_asArray.length){var s=[];e.AdaptationSet_asArray.forEach((function(e){t.getIsTypeOf(e,r)&&s.push(function(e,r){return new Promise((function(i){if(e.Representation_asArray&&0!==e.Representation_asArray.length){var s=[],u=[];e.Representation_asArray.forEach((function(i,o){var l=t.getCodec(e,o,!1),c=function(e,t,n){switch(e){case a.Z.VIDEO:return function(e,t){return{codec:t,width:e.width||null,height:e.height||null,framerate:e.frameRate||null,bitrate:e.bandwidth||null}}(t,n);case a.Z.AUDIO:return function(e,t){var n=e.audioSamplingRate||null;return{codec:t,bitrate:e.bandwidth||null,samplerate:n}}(t,n);default:return null}}(r,i,l);u.push(c),s.push(n.supportsCodec(c,r))})),Promise.all(s).then((function(t){e.Representation_asArray=e.Representation_asArray.filter((function(e,n){return t[n]||o.debug("[Stream] Codec ".concat(u[n].codec," not supported ")),t[n]})),i()})).catch((function(){i()}))}else i()}))}(e,r))})),Promise.all(s).then((function(){e.AdaptationSet_asArray=e.AdaptationSet_asArray.filter((function(e){var t=e.Representation_asArray&&e.Representation_asArray.length>0;return t||(c.trigger(l.Z.ADAPTATION_SET_REMOVED_NO_CAPABILITIES,{adaptationSet:e}),o.warn("AdaptationSet has been removed because of no supported Representation")),t})),i()})).catch((function(){i()}))}else i()}))}(r,e))})),Promise.all(i)}return e={setConfig:function(e){e&&(e.adapter&&(t=e.adapter),e.capabilities&&(n=e.capabilities),e.settings&&(r=e.settings),e.customParametersModel&&(i=e.customParametersModel))},filterUnsupportedFeatures:function(e){return new Promise((function(s){var u=[];u.push(d(a.Z.VIDEO,e)),u.push(d(a.Z.AUDIO,e)),Promise.all(u).then((function(){r.get().streaming.capabilities.filterUnsupportedEssentialProperties&&function(e){e&&e.Period_asArray&&0!==e.Period_asArray.length&&e.Period_asArray.forEach((function(e){e.AdaptationSet_asArray=e.AdaptationSet_asArray.filter((function(e){return!e.Representation_asArray||0===e.Representation_asArray.length||(e.Representation_asArray=e.Representation_asArray.filter((function(e){var r=t.getEssentialPropertiesForRepresentation(e);if(r&&r.length>0)for(var i=0;i<r.length;){if(!n.supportsEssentialProperty(r[i]))return o.debug("[Stream] EssentialProperty not supported: "+r[i].schemeIdUri),!1;i+=1}return!0})),e.Representation_asArray&&e.Representation_asArray.length>0)}))}))}(e),function(e){var t=i.getCustomCapabilitiesFilters();t&&0!==t.length&&e&&e.Period_asArray&&0!==e.Period_asArray.length&&e.Period_asArray.forEach((function(e){e.AdaptationSet_asArray=e.AdaptationSet_asArray.filter((function(e){return!e.Representation_asArray||0===e.Representation_asArray.length||(e.Representation_asArray=e.Representation_asArray.filter((function(e){return!t.some((function(t){return!t(e)}))})),e.Representation_asArray&&e.Representation_asArray.length>0)}))}))}(e),s()})).catch((function(){s()}))}))}},o=(0,f.Z)(s).getInstance().getLogger(e),e}Wr.__dashjs_factory_name="CapabilitiesFilter";var Xr=c.Z.getSingletonFactory(Wr),Qr=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null,this.r=null};function Jr(){var e;return{initialize:function(t){if(e=new Qr,!t)return null;var n=t.indexOf("#");if(-1!==n)for(var r=t.substr(n+1).split("&"),i=0,a=r.length;i<a;++i){var o=r[i],s=o.indexOf("=");if(-1!==s){var u=o.substring(0,s);e.hasOwnProperty(u)&&(e[u]=o.substr(s+1))}}},getURIFragmentData:function(){return e}}}Jr.__dashjs_factory_name="URIFragmentModel";var $r=c.Z.getSingletonFactory(Jr);function ei(){var e,t=this.context,n=(0,u.Z)(t).getInstance();return{getValue:function(){return e},setValue:function(t){e=t,t&&n.trigger(l.Z.MANIFEST_LOADED,{data:t})}}}ei.__dashjs_factory_name="ManifestModel";var ti=c.Z.getSingletonFactory(ei),ni=-.5;function ri(){var e,t,n,r,i=this.context,a=(0,N.Z)(i).getInstance();function o(e,n){return isNaN(e)?0:e>0?(n&&t.warn("Supplied minimum playback rate is a positive value when it should be negative or 0. The supplied rate will not be applied and set to 0: 100% playback speed."),0):e<ni?(n&&t.warn("Supplied minimum playback rate is out of range and will be limited to ".concat(ni,": ").concat(-50,"% playback speed.")),ni):e}function s(e,n){return isNaN(e)?0:e<0?(n&&t.warn("Supplied maximum playback rate is a negative value when it should be negative or 0. The supplied rate will not be applied and set to 0: 100% playback speed."),0):e>1?(n&&t.warn("Supplied maximum playback rate is out of range and will be limited to ".concat(1,": ").concat(200,"% playback speed.")),1):e}function u(){var e=a.get().streaming.buffer.stableBufferTime>0?a.get().streaming.buffer.stableBufferTime:a.get().streaming.buffer.fastSwitchEnabled?20:12,t=n.getLiveDelay();return!isNaN(t)&&t>0?Math.min(e,t):e}return e={getCatchupMaxDrift:function(){if(!isNaN(a.get().streaming.liveCatchup.maxDrift)&&a.get().streaming.liveCatchup.maxDrift>0)return a.get().streaming.liveCatchup.maxDrift;var e=r.getServiceDescriptionSettings();return e&&e.liveCatchup&&!isNaN(e.liveCatchup.maxDrift)&&e.liveCatchup.maxDrift>0?e.liveCatchup.maxDrift:12},getCatchupModeEnabled:function(){return null!==a.get().streaming.liveCatchup.enabled?a.get().streaming.liveCatchup.enabled:n.getInitialCatchupModeActivated()},getStableBufferTime:u,getInitialBufferLevel:function(){var e=a.get().streaming.buffer.initialBufferLevel;return isNaN(e)||e<0?0:Math.min(u(),e)},getRetryAttemptsForType:function(e){var t=isNaN(a.get().streaming.retryAttempts.lowLatencyMultiplyFactor)?5:a.get().streaming.retryAttempts.lowLatencyMultiplyFactor;return n.getLowLatencyModeEnabled()?a.get().streaming.retryAttempts[e]*t:a.get().streaming.retryAttempts[e]},getRetryIntervalsForType:function(e){var t=isNaN(a.get().streaming.retryIntervals.lowLatencyReductionFactor)?10:a.get().streaming.retryIntervals.lowLatencyReductionFactor;return n.getLowLatencyModeEnabled()?a.get().streaming.retryIntervals[e]/t:a.get().streaming.retryIntervals[e]},getCatchupPlaybackRates:function(e){var t=a.get().streaming.liveCatchup.playbackRate;if(!isNaN(t.min)||!isNaN(t.max))return{min:o(t.min,e),max:s(t.max,e)};var n=r.getServiceDescriptionSettings();if(n&&n.liveCatchup&&(!isNaN(n.liveCatchup.playbackRate.min)||!isNaN(n.liveCatchup.playbackRate.max))){var i=n.liveCatchup.playbackRate;return{min:o(i.min,e),max:s(i.max,e)}}return{min:-.5,max:.5}},getAbrBitrateParameter:function(e,t){try{var n=a.get().streaming.abr[e][t];if(!isNaN(n)&&-1!==n)return n;var i=r.getServiceDescriptionSettings();return i&&i[e]&&!isNaN(i[e][t])?i[e][t]:-1}catch(e){return-1}},setConfig:function(e){e.playbackController&&(n=e.playbackController),e.serviceDescriptionController&&(r=e.serviceDescriptionController)},reset:function(){}},t=(0,f.Z)(i).getInstance().getLogger(e),e}ri.__dashjs_factory_name="MediaPlayerModel";var ii=c.Z.getSingletonFactory(ri),ai=n(1767);function oi(e){var t=(e=e||{}).abrController,n=e.switchHistory,r=e.droppedFramesHistory,i=e.currentRequest,a=e.useBufferOccupancyABR,o=e.useL2AABR,s=e.useLoLPABR,u=e.streamProcessor?e.streamProcessor.getScheduleController():null,l=e.streamProcessor?e.streamProcessor.getRepresentationInfo():null,c=e.videoModel?e.videoModel:null;function f(){return l?l.mediaInfo:null}return{getMediaType:function(){var e=f();return e?e.type:null},getMediaInfo:f,getDroppedFramesHistory:function(){return r},getCurrentRequest:function(){return i},getSwitchHistory:function(){return n},getStreamInfo:function(){var e=f();return e?e.streamInfo:null},getScheduleController:function(){return u},getAbrController:function(){return t},getRepresentationInfo:function(){return l},useBufferOccupancyABR:function(){return a},useL2AABR:function(){return o},useLoLPABR:function(){return s},getVideoModel:function(){return c}}}oi.__dashjs_factory_name="RulesContext";var si=c.Z.getClassFactory(oi),ui=n(2068);function li(){var e=[],t=[];return{push:function(n){n.newValue===ui.Z.NO_CHANGE&&(n.newValue=n.oldValue),e[n.oldValue]||(e[n.oldValue]={noDrops:0,drops:0,dropSize:0});var r=n.newValue-n.oldValue,i=r<0?1:0,a=i?-r:0,o=i?0:1;if(e[n.oldValue].drops+=i,e[n.oldValue].dropSize+=a,e[n.oldValue].noDrops+=o,t.push({idx:n.oldValue,noDrop:o,drop:i,dropSize:a}),t.length>8){var s=t.shift();e[s.idx].drops-=s.drop,e[s.idx].dropSize-=s.dropSize,e[s.idx].noDrops-=s.noDrop}},getSwitchRequests:function(){return e},reset:function(){e=[],t=[]}}}li.__dashjs_factory_name="SwitchRequestHistory";var ci=c.Z.getClassFactory(li);function fi(){var e={},t={},n={};return{push:function(r,i,a){if(i){e[r]||(e[r]=[],t[r]=0,n[r]=0);var o=a&&a.droppedVideoFrames?a.droppedVideoFrames:0,s=a&&a.totalVideoFrames?a.totalVideoFrames:0,u=o-t[r];t[r]=o;var l=s-n[r];n[r]=s;var c=e[r];isNaN(i)||(c[i]?(c[i].droppedVideoFrames+=u,c[i].totalVideoFrames+=l):c[i]={droppedVideoFrames:u,totalVideoFrames:l})}},getFrameHistory:function(t){return e[t]},clearForStream:function(r){try{delete e[r],delete t[r],delete n[r]}catch(e){}},reset:function(){e={},t={},n={}}}}fi.__dashjs_factory_name="DroppedFramesHistory";var di=c.Z.getClassFactory(fi);function gi(e){var t,n,r,i,o,s=this.context,l=(e=e||{}).settings,c=(0,u.Z)(s).getInstance();function f(e,t,n,r){var i=Math.pow(.5,n/r.fast);e.fastEstimate=(1-i)*t+i*e.fastEstimate;var a=Math.pow(.5,n/r.slow);e.slowEstimate=(1-a)*t+a*e.slowEstimate,e.totalWeight+=n}function g(e,s,u){return l.get().streaming.abr.movingAverageMethod!==a.Z.MOVING_AVERAGE_SLIDING_WINDOW?function(e,t){var n=e?o.throughputHalfLife:o.latencyHalfLife,a=e?r[t]:i[t];if(!a||a.totalWeight<=0)return NaN;var s=a.fastEstimate/(1-Math.pow(.5,a.totalWeight/n.fast)),u=a.slowEstimate/(1-Math.pow(.5,a.totalWeight/n.slow));return e?Math.min(s,u):Math.max(s,u)}(e,s):function(e,r,i){var a=function(e,r,i){var a,o;if(e?(a=t[r],o=i?3:4):(a=n[r],o=4),a){if(o>=a.length)o=a.length;else if(e)for(var s=1;s<o;++s){var u=a[a.length-s]/a[a.length-s-1];if((u>=1.3||u<=1/1.3)&&(o+=1)===a.length)break}}else o=0;return o}(e,r,i),o=(e?t:n)[r];return 0!==a&&o&&0!==o.length?(o=o.slice(-a)).reduce((function(e,t){return e+t}))/o.length:NaN}(e,s,u)}function h(e,t){return g(!0,e,t)}function p(e){t[e]=t[e]||[],n[e]=n[e]||[],r[e]=r[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0},i[e]=i[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0}}function m(){t={},n={},r={},i={}}var y={push:function(e,s,u){if(s.trace&&s.trace.length){var g,h=s.tresponse.getTime()-s.trequest.getTime()||1,m=s._tfinish.getTime()-s.tresponse.getTime()||1,y=s.trace.reduce((function(e,t){return e+t.b[0]}),0),E=0;if(0!==(g=s._fileLoaderType&&s._fileLoaderType===a.Z.FILE_LOADER_TYPES.FETCH?s.trace.reduce((function(e,t){return e+t.d}),0):u?m:h+m)&&(E=Math.round(8*y/g)),s.cmsd){var v=s.cmsd.dynamic&&s.cmsd.dynamic.etp?s.cmsd.dynamic.etp:null;if(v){var _=l.get().streaming.cmsd.abr.etpWeightRatio;_>0&&_<=1&&(E=E*(1-_)+v*_)}}if(p(e),function(e,t,n){return e===a.Z.VIDEO?n<l.get().streaming.cacheLoadThresholds[a.Z.VIDEO]:e===a.Z.AUDIO?n<l.get().streaming.cacheLoadThresholds[a.Z.AUDIO]:void 0}(e,0,m)){if(t[e].length>0&&!t[e].hasCachedEntries)return;t[e].hasCachedEntries=!0}else t[e]&&t[e].hasCachedEntries&&function(e){delete t[e],delete n[e],delete r[e],delete i[e],p(e)}(e);t[e].push(E),c.trigger(d.Z.THROUGHPUT_MEASUREMENT_STORED,{throughput:E,mediaType:e,httpRequest:s}),t[e].length>20&&t[e].shift(),n[e].push(h),n[e].length>20&&n[e].shift(),f(r[e],E,.001*m,o.throughputHalfLife),f(i[e],h,1,o.latencyHalfLife)}},getAverageThroughput:h,getSafeAverageThroughput:function(e,t){var n=h(e,t);return isNaN(n)||(n*=l.get().streaming.abr.bandwidthSafetyFactor),n},getAverageLatency:function(e){return g(!1,e)},reset:m};return o={throughputHalfLife:{fast:3,slow:8},latencyHalfLife:{fast:1,slow:2}},m(),y}gi.__dashjs_factory_name="ThroughputHistory";var hi=c.Z.getClassFactory(gi);function pi(){var e,t,n,r,i,o,c,g,h,p,m,y,E,v,_,S,b,A,I,R,w,N,D,O,M,P,L,x=this.context,F=(0,f.Z)(x).getInstance(),k=(0,u.Z)(x).getInstance();function U(){i={},o={},g={},c={},R={},D={},O={},M={},void 0===p&&(p=!1),w&&w.reset(),I=void 0,w=void 0,N=void 0,clearTimeout(h),h=null}function Z(t){var i=t.request.mediaType,a=t.streamId;if(i&&a&&c[a]&&L.get().streaming.abr.autoSwitchBitrate[i]){var o=c[a][i];if(o){var u=si(x).create({abrController:e,streamProcessor:o,currentRequest:t.request,useBufferOccupancyABR:D[i],useL2AABR:O[i],useLoLPABR:M[i],videoModel:v}),l=n.shouldAbandonFragment(u,a);l.quality>ui.Z.NO_CHANGE&&o.getFragmentModel().getRequests({state:T.FRAGMENT_MODEL_LOADING,index:t.request.index})[0]&&(g[a][i].state=s.Z.ABANDON_LOAD,R[a][i].reset(),R[a][i].push({oldValue:j(i,a),newValue:l.quality,confidence:1,reason:l.reason}),H(i,r.getActiveStreamInfo(),l.quality,l.reason),clearTimeout(h),h=setTimeout((function(){g[a][i].state=s.Z.ALLOW_LOAD,h=null}),L.get().streaming.abandonLoadTimeout))}}}function B(e){e.mediaType===a.Z.VIDEO&&(void 0!==I&&w.push(e.streamId,I,v.getPlaybackQuality()),I=e.newQuality)}function G(e){var n,r;e.metric!==s.Z.HTTP_REQUEST||!e.value||e.value.type!==C.w.MEDIA_SEGMENT_TYPE||e.mediaType!==a.Z.AUDIO&&e.mediaType!==a.Z.VIDEO||N.push(e.mediaType,e.value,L.get().streaming.abr.useDeadTimeLatency),e.metric!==s.Z.BUFFER_LEVEL||e.mediaType!==a.Z.AUDIO&&e.mediaType!==a.Z.VIDEO||(n=e.mediaType,r=.001*e.value.level,L.get().streaming.abr.ABRStrategy===a.Z.ABR_STRATEGY_DYNAMIC&&function(e,n){try{var r=_.getStableBufferTime(),i=r,a=.5*r,o=D[e],s=n>(o?a:i);D[e]=s,s!==o&&(s?t.info("["+e+"] switching from throughput to buffer occupancy ABR rule (buffer: "+n.toFixed(3)+")."):t.info("["+e+"] switching from buffer occupancy to throughput ABR rule (buffer: "+n.toFixed(3)+")."))}catch(e){t.error(e)}}(n,r))}function q(e,n){try{var r;return i[n]=i[n]||{},i[n].hasOwnProperty(e)||(i[n][e]=0),r=function(e,t){var n=i[t][e],r=n;if(!c[t]||!c[t][e])return r;var a=Y(e,t);void 0!==a&&(r=Math.max(n,a));var o=function(e,t){try{var n=_.getAbrBitrateParameter("maxBitrate",e);return n>-1?W(c[t][e].getMediaInfo(),n,t):void 0}catch(e){return}}(e,t);return void 0!==o&&(r=Math.min(r,o)),r}(e,n),r=function(e,t,n){var r=i[n][t],a=L.get().streaming.abr.maxRepresentationRatio[t];return isNaN(a)||a>=1||a<0?e:Math.min(e,Math.round(r*a))}(r,e,n),r=function(e,t,n){if(t!==a.Z.VIDEO||!L.get().streaming.abr.limitBitrateByPortal||!c[n]||!c[n][t])return e;p||Q();var r=c[n][t].getStreamInfo(),i=E.getAdaptationForType(r.index,t,r).Representation_asArray,o=e;if(m>0&&y>0){for(;o>0&&i[o]&&m<i[o].width&&m-i[o-1].width<i[o].width-m;)o-=1;for(;o<i.length-1&&i[o].width===i[o+1].width;)o+=1}return o}(r,e,n),L.get().streaming.cmsd.enabled&&L.get().streaming.cmsd.abr.applyMb&&(r=function(e,n,r){if("video"!==n)return e;var i=b.getMaxBitrate(n);if(i<0)return e;var a=K(r,"audio",j("audio",r));i-=a?a.bitrate/1e3:0;var o=W(c[r][n].getMediaInfo(),i,r);return t.debug("Stream ID: "+r+" ["+n+"] Apply max bit rate from CMSD: "+i),Math.min(e,o)}(r,e,n)),r}catch(e){return}}function Y(e,t){try{return function(e,t){try{var n=_.getAbrBitrateParameter("minBitrate",e);if(n>-1){var r=c[t][e].getMediaInfo(),i=X(r),a=W(r,n,t);return i[a]&&a<i.length-1&&i[a].bitrate<1e3*n&&a++,a}return}catch(e){return}}(e,t)}catch(e){return}}function j(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;try{return t||(t=r.getActiveStreamInfo().id),e&&c[t]&&c[t][e]&&t?(o[t]=o[t]||{},o[t].hasOwnProperty(e)||(o[t][e]=0),o[t][e]):0}catch(e){return 0}}function H(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(t&&t.id&&e){var i=t.id,a=j(e,i);(0,z.SE)(n);var o=q(e,i);n!==a&&n>=0&&n<=o&&V(e,a,n,o,r,i)}}function V(e,n,r,i,a,s){if(e&&c[s]&&c[s][e]){var u=c[s][e].getStreamInfo(),f=u&&u.manifestInfo&&u.manifestInfo.isDynamic,d=P.getCurrentBufferLevel(e);t.info("Stream ID: "+s+" ["+e+"] switch from "+n+" to "+r+"/"+i+" (buffer: "+d+") "+(a?JSON.stringify(a):".")),o[s]=o[s]||{},o[s][e]=r;var g=K(s,e,r);k.trigger(l.Z.QUALITY_CHANGE_REQUESTED,{oldQuality:n,newQuality:r,reason:a,streamInfo:u,bitrateInfo:g,maxIdx:i,mediaType:e},{streamId:u.id,mediaType:e});var h=N.getAverageThroughput(e,f);isNaN(h)||A.setSavedBitrateSettings(e,h)}}function K(e,t,n){if(t&&c&&c[e]&&c[e][t]){var r=X(c[e][t].getMediaInfo());return r[n]?r[n]:null}return null}function W(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=e&&e.type?c[n][e.type].getRepresentationInfo():null;if(L.get().streaming.abr.useDeadTimeLatency&&r&&i&&i.fragmentDuration){r/=1e3;var a=i.fragmentDuration;if(r>a)return 0;var o=r/a;t*=1-o}for(var s=X(e),u=s.length-1;u>=0;u--){var l=s[u];if(1e3*t>=l.bitrate)return u}return 0}function X(e){var t=[];if(!e||!e.bitrateList)return t;for(var n,r=e.bitrateList,i=e.type,a=0,o=r.length;a<o;a++)(n=new Mt).mediaType=i,n.qualityIndex=a,n.bitrate=r[a].bandwidth,n.width=r[a].width,n.height=r[a].height,n.scanType=r[a].scanType,t.push(n);return t}function Q(){if(v){var e=L.get().streaming.abr.usePixelRatioInLimitBitrateByPortal&&window.hasOwnProperty("devicePixelRatio")?window.devicePixelRatio:1;m=v.getClientWidth()*e,y=v.getClientHeight()*e}}return e={initialize:function(){w=di(x).create(),N=hi(x).create({settings:L}),(n=(0,ai.Z)(x).create({dashMetrics:P,customParametersModel:S,mediaPlayerModel:_,settings:L})).initialize(),k.on(d.Z.QUALITY_CHANGE_RENDERED,B,e),k.on(d.Z.METRIC_ADDED,G,e),k.on(l.Z.LOADING_PROGRESS,Z,e)},isPlayingAtTopQuality:function(e){var t=e?e.id:null,n=j(a.Z.AUDIO,t),r=j(a.Z.VIDEO,t);return n===q(a.Z.AUDIO,t)&&r===q(a.Z.VIDEO,t)},updateTopQualityIndex:function(e){var t=e.type,n=e.streamInfo.id,r=e.representationCount-1;return i[n]=i[n]||{},i[n][t]=r,r},clearDataForStream:function(e){w&&w.clearForStream(e),c[e]&&delete c[e],R[e]&&delete R[e],g[e]&&delete g[e]},getThroughputHistory:function(){return N},getBitrateList:X,getQualityForBitrate:W,getTopBitrateInfoFor:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t||(t=r.getActiveStreamInfo().id),e&&c&&c[t]&&c[t][e]){var n=q(e,t),i=X(c[t][e].getMediaInfo());return i[n]?i[n]:null}return null},getMinAllowedIndexFor:Y,getMaxAllowedIndexFor:q,getInitialBitrateFor:function(e,t){if(function(){if(!A||!A.hasOwnProperty("getSavedBitrateSettings"))throw new Error(a.Z.MISSING_CONFIG_ERROR)}(),e===a.Z.TEXT)return NaN;var n=A.getSavedBitrateSettings(e),r=_.getAbrBitrateParameter("initialBitrate",e),i=L.get().streaming.abr.initialRepresentationRatio[e];if(-1===r)if(i>-1){var o=c[t][e].getStreamInfo(),s=E.getAdaptationForType(o.index,e,o).Representation_asArray;r=Array.isArray(s)?s[Math.max(Math.round(s.length*i)-1,0)].bandwidth/1e3:0}else r=isNaN(n)?e===a.Z.VIDEO?1e3:100:n;return r},getQualityFor:j,getAbandonmentStateFor:function(e,t){return g[e]&&g[e][t]?g[e][t].state:null},setPlaybackQuality:H,checkPlaybackQuality:function(t,r){try{if(!(t&&c&&c[r]&&c[r][t]))return!1;if(w){var i=v.getPlaybackQuality();i&&w.push(r,I,i)}if(!L.get().streaming.abr.autoSwitchBitrate[t])return!1;var a=j(t,r),o=si(x).create({abrController:e,switchHistory:R[r][t],droppedFramesHistory:w,streamProcessor:c[r][t],currentValue:a,useBufferOccupancyABR:D[t],useL2AABR:O[t],useLoLPABR:M[t],videoModel:v}),u=Y(t,r),l=q(t,r),f=n.getMaxQuality(o),d=f.quality;return void 0!==u&&(d>ui.Z.NO_CHANGE?d:a)<u&&(d=u),d>l&&(d=l),R[r][t].push({oldValue:a,newValue:d}),d>ui.Z.NO_CHANGE&&d!==a&&(g[r][t].state===s.Z.ALLOW_LOAD||d<a)&&(V(t,a,d,l,f.reason,r),!0)}catch(e){return!1}},setElementSize:Q,setWindowResizeEventCalled:function(e){p=e},registerStreamType:function(e,t){var n=t.getStreamInfo().id;c[n]||(c[n]={}),R[n]||(R[n]={}),g[n]||(g[n]={}),R[n][e]=ci(x).create(),c[n][e]=t,g[n][e]={},g[n][e].state=s.Z.ALLOW_LOAD,function(e){var t=L.get().streaming.abr.ABRStrategy;t===a.Z.ABR_STRATEGY_L2A?(D[e]=!1,M[e]=!1,O[e]=!0):t===a.Z.ABR_STRATEGY_LoLP?(D[e]=!1,M[e]=!0,O[e]=!1):t===a.Z.ABR_STRATEGY_BOLA?(D[e]=!0,M[e]=!1,O[e]=!1):t===a.Z.ABR_STRATEGY_THROUGHPUT?(D[e]=!1,M[e]=!1,O[e]=!1):t===a.Z.ABR_STRATEGY_DYNAMIC&&(D[e]=!(!D||!D[e])&&D[e],M[e]=!1,O[e]=!1)}(e),e===a.Z.VIDEO&&Q()},unRegisterStreamType:function(e,t){try{c[e]&&c[e][t]&&delete c[e][t],R[e]&&R[e][t]&&delete R[e][t],g[e]&&g[e][t]&&delete g[e][t]}catch(e){}},setConfig:function(e){e&&(e.streamController&&(r=e.streamController),e.domStorage&&(A=e.domStorage),e.mediaPlayerModel&&(_=e.mediaPlayerModel),e.customParametersModel&&(S=e.customParametersModel),e.cmsdModel&&(b=e.cmsdModel),e.dashMetrics&&(P=e.dashMetrics),e.adapter&&(E=e.adapter),e.videoModel&&(v=e.videoModel),e.settings&&(L=e.settings))},reset:function(){U(),k.off(l.Z.LOADING_PROGRESS,Z,e),k.off(d.Z.QUALITY_CHANGE_RENDERED,B,e),k.off(d.Z.METRIC_ADDED,G,e),n&&n.reset()}},t=F.getLogger(e),U(),e}pi.__dashjs_factory_name="AbrController";var mi=c.Z.getSingletonFactory(pi);mi.QUALITY_DEFAULT=0,c.Z.updateSingletonFactory(pi.__dashjs_factory_name,mi);var yi=mi,Ei=new Map([[a.Z.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,"loadedmetadata"],[a.Z.VIDEO_ELEMENT_READY_STATES.HAVE_CURRENT_DATA,"loadeddata"],[a.Z.VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA,"canplay"],[a.Z.VIDEO_ELEMENT_READY_STATES.HAVE_ENOUGH_DATA,"canplaythrough"]]);function vi(){var e,t,n,r,i,o,s,c,d=this.context,g=(0,u.Z)(d).getInstance(),h=[];function p(){n&&(n.playbackRate=1,n.removeEventListener("canplay",p))}function m(){return h.length>0}function y(){if(n&&m()&&0===n.playbackRate){var e=document.createEvent("Event");e.initEvent("waiting",!0,!1),n.dispatchEvent(e)}}function E(e,t){n&&n.addEventListener(e,t)}function v(e,t){n&&n.removeEventListener(e,t)}function _(){return n?n.readyState:NaN}function T(){return n?n.buffered:null}function S(e,t,r,i,a){if(n)for(var o=0;o<n.textTracks.length;o++)if(n.textTracks[o].kind===e&&(!t||n.textTracks[o].label==t)&&n.textTracks[o].language===r&&n.textTracks[o].isTTML===i&&n.textTracks[o].isEmbedded===a)return n.textTracks[o];return null}function b(e,t){return e===a.Z.VIDEO_ELEMENT_READY_STATES.HAVE_NOTHING||_()>=e?(t(),null):function(e,t){var n=function n(){v(e,n),t(e)};return E(e,n),{func:n,event:e}}(Ei.get(e),t)}return e={addEventListener:E,addTextTrack:function(e,t,r,i,a){if(!n)return null;var o=S(e,t,r,i,a);return o||((o=n.addTextTrack(e,t,r)).isEmbedded=a,o.isTTML=i),o},appendChild:function(e){n&&(n.appendChild(e),void 0!==e.isTTML&&(n.textTracks[n.textTracks.length-1].isTTML=e.isTTML,n.textTracks[n.textTracks.length-1].isEmbedded=e.isEmbedded))},getBufferRange:T,getClientHeight:function(){return n?n.clientHeight:NaN},getClientWidth:function(){return n?n.clientWidth:NaN},getElement:function(){return n},getEnded:function(){return n?n.ended:null},getPlaybackQuality:function(){if(!n)return null;var e="webkitDroppedFrameCount"in n&&"webkitDecodedFrameCount"in n,t=null;return"getVideoPlaybackQuality"in n?t=n.getVideoPlaybackQuality():e&&(t={droppedVideoFrames:n.webkitDroppedFrameCount,totalVideoFrames:n.webkitDroppedFrameCount+n.webkitDecodedFrameCount,creationTime:new Date}),t},getPlaybackRate:function(){return n?n.playbackRate:null},getPlayedRanges:function(){return n?n.played:null},getReadyState:_,getSource:function(){return n?n.src:null},getTTMLRenderingDiv:function(){return o},getTextTrack:S,getTextTracks:function(){return n?n.textTracks:[]},getTime:function(){return n?isNaN(r)?n.currentTime:r:null},getVideoHeight:function(){return n?n.videoHeight:NaN},getVideoRelativeOffsetLeft:function(){if(n){var e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().left-e.getBoundingClientRect().left:NaN}return NaN},getVideoRelativeOffsetTop:function(){if(n){var e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().top-e.getBoundingClientRect().top:NaN}return NaN},getVideoWidth:function(){return n?n.videoWidth:NaN},getVttRenderingDiv:function(){return s},initialize:function(){g.on(l.Z.PLAYBACK_PLAYING,y,this)},isPaused:function(){return n?n.paused:null},isSeeking:function(){return n?n.seeking||!isNaN(r):null},isStalled:m,pause:function(){n&&(n.pause(),n.autoplay=!1)},play:function(){if(n){n.autoplay=!0;var e=n.play();e&&e.catch&&"undefined"!=typeof Promise&&e.catch((function(e){"NotAllowedError"===e.name&&g.trigger(l.Z.PLAYBACK_NOT_ALLOWED),t.warn("Caught pending play exception - continuing (".concat(e,")"))}))}},removeChild:function(e){n&&n.removeChild(e)},removeEventListener:v,reset:function(){clearTimeout(c),g.off(l.Z.PLAYBACK_PLAYING,y,this)},setCurrentTime:function(e,t){n&&(i&&i.func&&i.event&&v(i.event,i.func),r=e,i=b(a.Z.VIDEO_ELEMENT_READY_STATES.HAVE_METADATA,(function(){if(n)if(n.currentTime!==r)try{r=t?function(e){var t=T(),n=e,r=9999999999;if(t)for(var i=0;i<t.length;i++){var a=t.start(i),o=t.end(i),s=Math.abs(a-e),u=Math.abs(o-e);if(e>=a&&e<=o)return e;s<r&&(r=s,n=a),u<r&&(r=u,n=o)}return n}(r):r,isNaN(r)||(n.currentTime=r),r=NaN}catch(e){0===n.readyState&&e.code===e.INVALID_STATE_ERR&&(c=setTimeout((function(){n.currentTime=r,r=NaN}),400))}else r=NaN})))},setElement:function(e){if(!(null==e||e&&/^(VIDEO|AUDIO)$/i.test(e.nodeName)))throw"element is not video or audio DOM type!";(n=e)&&(n.preload="auto")},setPlaybackRate:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n&&(!t&&n.readyState<=2&&e>0?n.addEventListener("canplay",p):n.playbackRate=e)},setSource:function(e){n&&(e?n.src=e:(n.removeAttribute("src"),n.load()))},setStallState:function(e,t){!function(e,t){t?function(e){null!==e&&n&&!n.seeking&&-1===h.indexOf(e)&&h.push(e)}(e):function(e){var t=h.indexOf(e);null!==e&&-1!==t&&h.splice(t,1)}(e)}(e,t)},setTTMLRenderingDiv:function(e){(o=e).style.position="absolute",o.style.display="flex",o.style.overflow="hidden",o.style.pointerEvents="none",o.style.top=0,o.style.left=0},setVttRenderingDiv:function(e){s=e},waitForReadyState:b,setDisableRemotePlayback:function(e){n&&(n.disableRemotePlayback=e)}},t=(0,f.Z)(d).getInstance().getLogger(e),r=NaN,e}vi.__dashjs_factory_name="VideoModel";var _i=c.Z.getSingletonFactory(vi),Ti=[{oldKey:"dashjs_vbitrate",newKey:"dashjs_video_bitrate"},{oldKey:"dashjs_abitrate",newKey:"dashjs_audio_bitrate"},{oldKey:"dashjs_vsettings",newKey:"dashjs_video_settings"},{oldKey:"dashjs_asettings",newKey:"dashjs_audio_settings"}],Si="dashjs_?_bitrate",bi="dashjs_?_settings",Ai="localStorage",Ii="lastBitrate",Ri="lastMediaSettings";function wi(e){e=e||{};var t,n,r,i=this.context,o=e.settings;function s(e){if(void 0!==r)return r;var t;r=!1;try{"undefined"!=typeof window&&(t=window[e])}catch(e){return n.warn("DOMStorage access denied: "+e.message),r}if(!t||e!==Ai&&"sessionStorage"!==e)return r;try{t.setItem("1","1"),t.removeItem("1"),r=!0}catch(e){n.warn("DOMStorage is supported, but cannot be used: "+e.message)}return r}function u(){var e=6e5;return Math.round((new Date).getTime()/e)*e}function l(e,t){return s(e)&&o.get().streaming[t+"CachingInfo"].enabled}function c(){if(!o)throw new Error(a.Z.MISSING_CONFIG_ERROR)}return t={getSavedBitrateSettings:function(e){if(c(),!o.get().streaming.lastBitrateCachingInfo.enabled)return NaN;var t=NaN;if(l(Ai,Ii)){var r=Si.replace(/\\?/,e);try{var i=JSON.parse(localStorage.getItem(r))||{},a=(new Date).getTime()-parseInt(i.timestamp,10)>=o.get().streaming.lastBitrateCachingInfo.ttl||!1,s=parseFloat(i.bitrate);isNaN(s)||a?a&&localStorage.removeItem(r):(t=s,n.debug("Last saved bitrate for "+e+" was "+s))}catch(e){return null}}return t},setSavedBitrateSettings:function(e,t){if(l(Ai,Ii)&&t){var r=Si.replace(/\\?/,e);try{localStorage.setItem(r,JSON.stringify({bitrate:t.toFixed(3),timestamp:u()}))}catch(e){n.error(e.message)}}},getSavedMediaSettings:function(e){if(c(),!o.get().streaming.lastMediaSettingsCachingInfo.enabled)return null;var t=null;if(l(Ai,Ri)){var n=bi.replace(/\\?/,e);try{var r=JSON.parse(localStorage.getItem(n))||{},i=(new Date).getTime()-parseInt(r.timestamp,10)>=o.get().streaming.lastMediaSettingsCachingInfo.ttl||!1;t=r.settings,i&&(localStorage.removeItem(n),t=null)}catch(e){return null}}return t},setSavedMediaSettings:function(e,t){if(l(Ai,Ri)){var r=bi.replace(/\\?/,e);try{localStorage.setItem(r,JSON.stringify({settings:t,timestamp:u()}))}catch(e){n.error(e.message)}}}},n=(0,f.Z)(i).getInstance().getLogger(t),s(Ai)&&Ti.forEach((function(e){var t=localStorage.getItem(e.oldKey);if(t){localStorage.removeItem(e.oldKey);try{localStorage.setItem(e.newKey,t)}catch(e){n.error(e.message)}}})),t}wi.__dashjs_factory_name="DOMStorage";var Ni=c.Z.getSingletonFactory(wi),Ci=n(2032),Di=n(2011);function Oi(){var e,t,n,r,i,a,o,s,u,l,c,f,d,g=this.context;function h(e,n,i,a){var o=null,u=e?d.resolve(e.path):null,l=a||{init:!0,url:u?u.url:void 0,range:{start:0,end:1500},searching:!1,bytesLoaded:0,bytesToLoad:1500,mediaType:n};t.debug("Start searching for initialization.");var c=E(l);s.load({request:c,success:function(t){if(l.bytesLoaded=l.range.end,!(o=r.findInitRange(t)))return l.range.end=l.bytesLoaded+l.bytesToLoad,h(e,n,i,l);e.range=o,i(e)},error:function(){i(e)}}),t.debug("Perform init search: "+l.url)}function m(e,n,i,a,o,u){if(i&&(void 0===i.start||void 0===i.end)){var l=i?i.toString().split("-"):null;i=l?{start:parseFloat(l[0]),end:parseFloat(l[1])}:null}o=o||y;var c=null,f=null,g=!!i,h=e?d.resolve(e.path):null,p={init:!1,url:h?h.url:void 0,range:g?i:{start:0,end:1500},searching:!g,bytesLoaded:u?u.bytesLoaded:0,bytesToLoad:1500,mediaType:n},v=E(p);s.load({request:v,success:function(i){var s=p.bytesToLoad,u=i.byteLength;if(p.bytesLoaded=p.range.end-p.range.start,c=r.parse(i),(f=c.getBox("sidx"))&&f.isComplete){var l,d,g=f.references;if(null!=g&&g.length>0&&(l=1===g[0].reference_type),l){var h,y,E,v;t.debug("Initiate multiple SIDX load."),p.range.end=p.range.start+f.size;var _=[],T=0,S=(f.offset||p.range.start)+f.size,b=function(t){t?(_=_.concat(t),++T>=y&&(_.sort((function(e,t){return e.startTime-t.startTime<0?-1:0})),o(_,e,a))):o(null,e,a)};for(h=0,y=g.length;h<y;h++)E=S,v=S+g[h].referenced_size-1,S+=g[h].referenced_size,m(e,n,{start:E,end:v},a,b,p)}else t.debug("Parsing segments from SIDX. representation "+n+" - id: "+e.id+" for range : "+p.range.start+" - "+p.range.end),d=function(e,t){for(var n,r,i,a,o=e.references,s=o.length,u=e.timescale,l=e.earliest_presentation_time,c=t.range.start+e.offset+e.first_offset+e.size,f=[],d=0;d<s;d++)i=o[d].subsegment_duration,a=o[d].referenced_size,(n=new Di.Z).duration=i,n.startTime=l,n.timescale=u,r=c+a-1,n.mediaRange=c+"-"+r,f.push(n),l+=i,c+=a;return f}(f,p),o(d,e,a)}else{if(f)p.range.start=f.offset||p.range.start,p.range.end=p.range.start+(f.size||s);else{if(u<p.bytesLoaded)return void o(null,e,a);var A=c.getLastBox();A&&A.size?(p.range.start=A.offset+A.size,p.range.end=p.range.start+s):p.range.end+=s}m(e,n,p.range,a,null,p)}},error:function(){o(null,e,a)}}),t.debug("Perform SIDX load for type ".concat(n," : ").concat(p.url," with range ").concat(p.range.start," - ").concat(p.range.end))}function y(e,t,n){n({segments:e,representation:t,error:e?void 0:new S.Z(u.SEGMENT_BASE_LOADER_ERROR_CODE,u.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}function E(e){if(e.url){var t=new p.Z;return t.setInfo(e),t}}return e={setConfig:function(s){s.baseURLController&&(d=s.baseURLController),s.dashMetrics&&(a=s.dashMetrics),s.mediaPlayerModel&&(o=s.mediaPlayerModel),s.errHandler&&(n=s.errHandler),s.boxParser&&(r=s.boxParser),s.debug&&(t=s.debug.getLogger(e)),s.requestModifier&&(i=s.requestModifier),s.errors&&(u=s.errors),s.urlUtils&&(f=s.urlUtils),s.constants&&(l=s.constants),s.dashConstants&&(c=s.dashConstants)},initialize:function(){s=vt(g).create({errHandler:n,dashMetrics:a,mediaPlayerModel:o,requestModifier:i,boxParser:r,errors:u,urlUtils:f,constants:l,dashConstants:c})},loadInitialization:function(e,t){return new Promise((function(n){h(e,t,n)}))},loadSegments:function(e,t,n){return new Promise((function(r){m(e,t,n,r)}))},reset:function(){s&&(s.abort(),s=null)}}}Oi.__dashjs_factory_name="SegmentBaseLoader";var Mi=c.Z.getSingletonFactory(Oi);function Pi(e){var t;e=e||{};var n=new DataView(e.data),r=0;function i(e,t){var i=!0,a=0;if(void 0===t&&(t=!1),e.tag>16777215?(n.getUint32(r)!==e.tag&&(i=!1),a=4):e.tag>65535?(256*n.getUint16(r)+n.getUint8(r+2)!==e.tag&&(i=!1),a=3):e.tag>255?(n.getUint16(r)!==e.tag&&(i=!1),a=2):(n.getUint8(r)!==e.tag&&(i=!1),a=1),!i&&e.required&&!t)throw new Error("required tag not found");return i&&(r+=a),i}function a(e){var t=1,i=128,a=-1,o=0,s=n.getUint8(r),u=0;for(u=0;u<8;u+=1){if((s&i)===i){o=void 0===e?s&~i:s,a=u;break}i>>=1}for(u=0;u<a;u+=1,t+=1)o=o<<8|255&n.getUint8(r+t);return r+=t,o}return t={getPos:function(){return r},setPos:function(e){r=e},consumeTag:i,consumeTagAndSize:function(e,t){var n=i(e,t);return n&&a(),n},parseTag:function(e){var n;return i(e),n=a(),t[e.parse](n)},skipOverElement:function(e,t){var n,o=i(e,t);return o&&(n=a(),r+=n),o},getMatroskaCodedNum:a,getMatroskaFloat:function(e){var t;switch(e){case 4:t=n.getFloat32(r),r+=4;break;case 8:t=n.getFloat64(r),r+=8}return t},getMatroskaUint:function(e){if(e>4)return function(e){for(var t=Math.floor(Number.MAX_SAFE_INTEGER/256),i=0,a=0;a<e;a+=1){if(i>t)throw new Error("Value exceeds safe integer limit");i*=256;var o=n.getUint8(r+a);if(i>Number.MAX_SAFE_INTEGER-o)throw new Error("Value exceeds safe integer limit");i+=o}return r+=e,i}(e);for(var t=0,i=0;i<e;i+=1)t<<=8,t|=255&n.getUint8(r+i);return r+=e,t>>>0},moreData:function(){return r<n.byteLength}}}Pi.__dashjs_factory_name="EBMLParser";var Li=c.Z.getClassFactory(Pi);function xi(){var e,t,n,r,i,o,s,u,l,c,f=this.context;function d(e){var t=new p.Z;return t.setInfo(e),t}return e={setConfig:function(n){if(!(n.baseURLController&&n.dashMetrics&&n.mediaPlayerModel&&n.errHandler))throw new Error(a.Z.MISSING_CONFIG_ERROR);c=n.baseURLController,o=n.dashMetrics,s=n.mediaPlayerModel,r=n.errHandler,l=n.errors,t=n.debug.getLogger(e),i=n.requestModifier},initialize:function(){u=vt(f).create({errHandler:r,dashMetrics:o,mediaPlayerModel:s,requestModifier:i,errors:l})},loadInitialization:function(e,n){return new Promise((function(r){var i=null,a=e?c.resolve(e.path):null,o=e?e.range.split("-"):null,s={range:{start:o?parseFloat(o[0]):null,end:o?parseFloat(o[1]):null},request:i,url:a?a.url:void 0,init:!0,mediaType:n};t.info("Start loading initialization."),i=d(s),u.load({request:i,success:function(){r(e)},error:function(){r(e)}}),t.debug("Perform init load: "+s.url)}))},loadSegments:function(e,r,i){return new Promise((function(a){var o=null,s=e?c.resolve(e.path):null,g=s?s.url:void 0;o=d({bytesLoaded:0,bytesToLoad:8192,range:{start:0,end:8192},request:o,url:g,init:!1,mediaType:r}),t.debug("Parsing ebml header"),u.load({request:o,success:function(r){!function(e,r,i,a){if(e&&0!==e.byteLength){var o,s,l,c,g=Li(f).create({data:e}),h=i?i.split("-"):null,p=null,m={url:r,range:{start:h?parseFloat(h[0]):null,end:h?parseFloat(h[1]):null},request:p};for(t.debug("Parse EBML header: "+m.url),g.skipOverElement(n.EBML),g.consumeTag(n.Segment),l=g.getMatroskaCodedNum(),l+=g.getPos(),c=g.getPos();g.moreData()&&!g.consumeTagAndSize(n.Segment.Info,!0);)if(!(g.skipOverElement(n.Segment.SeekHead,!0)||g.skipOverElement(n.Segment.Tracks,!0)||g.skipOverElement(n.Segment.Cues,!0)||g.skipOverElement(n.Void,!0)))throw new Error("no valid top level element found");for(;void 0===o;){var y=g.getMatroskaCodedNum(!0),E=g.getMatroskaCodedNum();y===n.Segment.Info.Duration.tag?o=g[n.Segment.Info.Duration.parse](E):g.setPos(g.getPos()+E)}p=d(m),u.load({request:p,success:function(e){s=function(e,r,i,a){var o,s,u,l,c,d,g,h;for(u=[],c=0,d=(s=function(e){var t,r,i=[],a=Li(f).create({data:e});for(a.consumeTagAndSize(n.Segment.Cues);a.moreData()&&a.consumeTagAndSize(n.Segment.Cues.CuePoint,!0);){for((t={}).CueTime=a.parseTag(n.Segment.Cues.CuePoint.CueTime),t.CueTracks=[];a.moreData()&&a.consumeTag(n.Segment.Cues.CuePoint.CueTrackPositions,!0);){var o=a.getMatroskaCodedNum(),s=a.getPos();if((r={}).Track=a.parseTag(n.Segment.Cues.CuePoint.CueTrackPositions.CueTrack),0===r.Track)throw new Error("Cue track cannot be 0");r.ClusterPosition=a.parseTag(n.Segment.Cues.CuePoint.CueTrackPositions.CueClusterPosition),t.CueTracks.push(r),a.setPos(s+o)}if(0===t.CueTracks.length)throw new Error("Mandatory cuetrack not found");i.push(t)}if(0===i.length)throw new Error("mandatory cuepoint not found");return i}(e)).length;c<d;c+=1)l=new Di.Z,o=c<s.length-1?s[c+1].CueTime-s[c].CueTime:a-s[c].CueTime,l.duration=o,l.startTime=s[c].CueTime,l.timescale=1e3,g=s[c].CueTracks[0].ClusterPosition+r,h=c<s.length-1?s[c+1].CueTracks[0].ClusterPosition+r-1:i-1,l.mediaRange=g+"-"+h,u.push(l);return t.debug("Parsed cues: "+u.length+" cues."),u}(e,c,l,o),a(s)},error:function(){t.error("Download Error: Cues "+m.url),a(null)}}),t.debug("Perform cues load: "+m.url+" bytes="+m.range.start+"-"+m.range.end)}else a(null)}(r,g,i,(function(t){a({segments:t,representation:e,error:t?void 0:new S.Z(l.SEGMENT_BASE_LOADER_ERROR_CODE,l.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}))},error:function(){a({representation:e,error:new S.Z(l.SEGMENT_BASE_LOADER_ERROR_CODE,l.SEGMENT_BASE_LOADER_ERROR_MESSAGE)})}})}))},reset:function(){u&&(u.abort(),u=null)}},n={EBML:{tag:440786851,required:!0},Segment:{tag:408125543,required:!0,SeekHead:{tag:290298740,required:!0},Info:{tag:357149030,required:!0,TimecodeScale:{tag:2807729,required:!0,parse:"getMatroskaUint"},Duration:{tag:17545,required:!0,parse:"getMatroskaFloat"}},Tracks:{tag:374648427,required:!0},Cues:{tag:475249515,required:!0,CuePoint:{tag:187,required:!0,CueTime:{tag:179,required:!0,parse:"getMatroskaUint"},CueTrackPositions:{tag:183,required:!0,CueTrack:{tag:247,required:!0,parse:"getMatroskaUint"},CueClusterPosition:{tag:241,required:!0,parse:"getMatroskaUint"}}}}},Void:{tag:236,required:!0}},e}xi.__dashjs_factory_name="WebmSegmentBaseLoader";var Fi=c.Z.getSingletonFactory(xi);function ki(e){e=e||{};var t,n,r,i=this.context,a=e.eventBus,o=e.events,s=e.dashMetrics,u=e.mediaPlayerModel,l=e.errHandler,c=e.baseURLController,f=e.debug,d=e.boxParser,g=e.requestModifier,h=e.errors;function p(e){return"webm"===(e?e.split("/")[1]:"").toLowerCase()}return t={initialize:function(){n.initialize(),r.initialize()},getSegmentBaseInitSegment:function(e){return p(e.representation.mimeType)?r.loadInitialization(e.representation,e.mediaType):n.loadInitialization(e.representation,e.mediaType)},getSegmentList:function(e){return p(e.mimeType)?r.loadSegments(e.representation,e.mediaType,e.representation?e.representation.indexRange:null):n.loadSegments(e.representation,e.mediaType,e.representation?e.representation.indexRange:null)},reset:function(){n.reset(),r.reset()}},n=Mi(i).getInstance(),r=Fi(i).getInstance(),n.setConfig({baseURLController:c,dashMetrics:s,mediaPlayerModel:u,errHandler:l,eventBus:a,events:o,errors:h,debug:f,boxParser:d,requestModifier:g}),r.setConfig({baseURLController:c,dashMetrics:s,mediaPlayerModel:u,errHandler:l,eventBus:a,events:o,errors:h,debug:f,requestModifier:g}),t}ki.__dashjs_factory_name="SegmentBaseController";var Ui=c.Z.getSingletonFactory(ki),Zi=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=null,this.quality=null,this.fragmentDuration=null,this.mediaInfo=null,this.MSETimeOffset=null},Bi=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=null,this.index=null,this.type=null,this.streamInfo=null,this.representationCount=0,this.labels=null,this.lang=null,this.viewpoint=null,this.viewpointsWithSchemeIdUri=null,this.accessibility=null,this.accessibilitiesWithSchemeIdUri=null,this.audioChannelConfiguration=null,this.audioChannelConfigurationsWithSchemeIdUri=null,this.roles=null,this.rolesWithSchemeIdUri=null,this.codec=null,this.mimeType=null,this.contentProtection=null,this.isText=!1,this.KID=null,this.bitrateList=null,this.isFragmented=null,this.isEmbedded=null,this.selectionPriority=1,this.supplementalProperties={},this.supplementalPropertiesAsArray=[],this.segmentAlignment=!1,this.subSegmentAlignment=!1},Gi=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=null,this.index=null,this.start=NaN,this.duration=NaN,this.manifestInfo=null,this.isLast=!0},qi=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.dvrWindowSize=NaN,this.loadedTime=null,this.availableFrom=null,this.minBufferTime=NaN,this.duration=NaN,this.isDynamic=!1,this.maxFragmentDuration=null,this.serviceDescriptions=[],this.protocol=null};function Yi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var ji=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.valid="/"==t[0],this.path=t.split("/").filter((function(e){return 0!==e.length})).map((function(e){var t={name:e},r=e.indexOf("[");if(-1!=r){t.name=e.substring(0,r);var i=e.substring(r+1,e.length-1);n.valid=n.valid&&-1==i.indexOf("[");var a=i.indexOf("=");-1!=a?(t.attribute={name:i.substring(1,a),value:i.substring(a+1)},-1!=["\'",\'"\'].indexOf(t.attribute.value[0])&&(t.attribute.value=t.attribute.value.substring(1,t.attribute.value.length-1))):t.position=parseInt(i,10)-1}return t}))}var t,n;return t=e,(n=[{key:"isValid",value:function(){return this.valid}},{key:"findsElement",value:function(){return!this.findsAttribute()}},{key:"findsAttribute",value:function(){return this.path[this.path.length-1].name.startsWith("@")}},{key:"findsTextReplace",value:function(){return"text()"===this.path[this.path.length-1].name}},{key:"getMpdTarget",value:function(e,t){for(var n=null,r=e,i=1,a="MPD";i<this.path.length&&null!==r;){n=r;var o=this.path[i];if(a=o.name,i!==this.path.length-1||!a.startsWith("@")&&"text()"!==a){var s=n[a+"_asArray"]||[];0===s.length&&n[a]&&s.push(n[a]),o.position?r=s[o.position]||null:o.attribute?function(){var e=o.attribute;r=s.filter((function(t){return t[e.name]==e.value}))[0]||null}():r=s[0]||null}i++}return null===r?null:a.startsWith("@")?{name:a.substring(1),leaf:r,target:r}:"text()"===a?{name:"__text",leaf:r,target:r}:{name:a,leaf:r,target:t?n:r}}}])&&Yi(t.prototype,n),e}();function Hi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Vi=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.action=t,this.xpath=n,this.value=r,this.position=null}var t,n;return t=e,(n=[{key:"getMpdTarget",value:function(e){var t="remove"===this.action||"replace"===this.action||"before"===this.position||"after"===this.position;return this.xpath.getMpdTarget(e,t)}}])&&Hi(t.prototype,n),e}();function Ki(){var e,t,n=this.context;return e={getIsPatch:function(e){return e&&e.hasOwnProperty(o.Z.ORIGINAL_MPD_ID)||!1},getPublishTime:function(e){return e&&e.hasOwnProperty(o.Z.PUBLISH_TIME)?new Date(e[o.Z.PUBLISH_TIME]):null},getOriginalPublishTime:function(e){return e&&e.hasOwnProperty(o.Z.ORIGINAL_PUBLISH_TIME)?new Date(e[o.Z.ORIGINAL_PUBLISH_TIME]):null},getMpdId:function(e){return e&&e[o.Z.ORIGINAL_MPD_ID]||null},getPatchOperations:function(e){return e?(e.__children||[]).map((function(e){var n=Object.keys(e)[0];if("add"!==n&&"remove"!==n&&"replace"!==n)return t.warn("Ignoring node of invalid action: ".concat(n)),null;var r=e[n],i=r.sel;if("add"===n&&r.type){if(!r.type.startsWith("@"))return t.warn("Ignoring add action for prefixed namespace declaration: ".concat(r.type,"=").concat(r.__text)),null;i="".concat(i,"/").concat(r.type)}var a=new ji(i);if(!a.isValid())return t.warn("Ignoring action with invalid selector: ".concat(n," - ").concat(i)),null;var o=null;a.findsAttribute()||a.findsTextReplace()?o=r.__text||"":"remove"!==n&&(o=r.__children.reduce((function(e,t){var n=Object.keys(t)[0];return"#text"!==n&&(e[n]=e[n]||[],e[n].push(t[n])),e}),{}));var s=new Vi(n,a,o);return"add"===n&&(s.position=r.pos),s})).filter((function(e){return!!e})):[]}},t=(0,f.Z)(n).getInstance().getLogger(e),e}Ki.__dashjs_factory_name="PatchManifestModel";var zi=c.Z.getSingletonFactory(Ki);function Wi(){var e,t,n,r,i,a,s,u=this.context;function l(e,n,a){var s,u=t.getAdaptationsForType(r[0].mpd.manifest,e,n);if(!u||0===u.length)return null;if(u.length>1&&a){var l=d(a,n);if(i[a.id]&&i[a.id][n])for(var f=0,g=u.length;f<g;f++)if(c(i[a.id][n],l[f]))return u[f];for(var h=0,p=u.length;h<p;h++)if(s=u[h],t.getRolesForAdaptation(s).filter((function(e){return e.value===o.Z.MAIN}))[0])return u[h]}return u[0]}function c(e,t){if(!e||!t)return!1;var n=e.id===t.id,r=e.codec===t.codec,i=e.viewpoint===t.viewpoint,a=JSON.stringify(e.viewpointsWithSchemeIdUri)===JSON.stringify(t.viewpointsWithSchemeIdUri),o=e.lang===t.lang,s=e.roles.toString()===t.roles.toString(),u=JSON.stringify(e.rolesWithSchemeIdUri)===JSON.stringify(t.rolesWithSchemeIdUri),l=e.accessibility.toString()===t.accessibility.toString(),c=JSON.stringify(e.accessibilitiesWithSchemeIdUri)===JSON.stringify(t.accessibilitiesWithSchemeIdUri),f=e.audioChannelConfiguration.toString()===t.audioChannelConfiguration.toString(),d=JSON.stringify(e.audioChannelConfigurationsWithSchemeIdUri)===JSON.stringify(t.audioChannelConfigurationsWithSchemeIdUri);return n&&r&&i&&a&&o&&s&&u&&l&&c&&f&&d}function f(e,n,r,i,o,s){var u,l,c,f,d,g,h=[];if(!i||0===i.length)return[];var p=t.getAdaptationsForPeriod(n);for(f=0,g=i.length;f<g;f++)if(u=i[f],l=v(p[c=t.getIndexForAdaptation(u,e,r.index)]),s){var m=l.accessibility.length;for(d=0;d<m;d++)if(l){var y=l.accessibility[d];if(0===y.indexOf("cea-608:")){var E=y.substring(8).split(";");if("CC"===E[0].substring(0,2))for(d=0;d<E.length;d++)l||(l=v.call(this,p[c])),_(l,E[d].substring(0,3),E[d].substring(4)),h.push(l),l=null;else for(d=0;d<E.length;d++)l||(l=v.call(this,p[c])),_(l,"CC"+(d+1),E[d]),h.push(l),l=null}else 0===y.indexOf("cea-608")&&(_(l,a.CC1,"eng"),h.push(l),l=null)}}else o===a.IMAGE?(l.type=a.IMAGE,h.push(l),l=null):l&&h.push(l);return h}function d(e,n,i){var o=r,s=i,u=[];if(s)S(),o=g(s);else{if(!(r.length>0))return u;s=r[0].mpd.manifest}var l=E(e,o),c=t.getAdaptationsForType(s,e?e.index:null,n);return u=f(s,l,e,c,n),n===a.TEXT&&(c=t.getAdaptationsForType(s,e?e.index:null,a.VIDEO),u=u.concat(f(s,l,e,c,n,!0))),u}function g(e){var n=h(e);return t.getRegularPeriods(n)}function h(e){var n=m(e);return t.getMpd(n)}function p(){r=[],i={}}function m(e){return e||(r.length>0?r[0].mpd.manifest:null)}function y(e){try{var n=E(e.streamInfo,r),i=t.getAdaptationsForPeriod(n);return e&&e.streamInfo&&void 0!==e.streamInfo.id&&i?i[e.index]:null}catch(e){return null}}function E(e,t){for(var n=t.length,r=0;r<n;r++){var i=t[r];if(e&&e.id===i.id)return i}return null}function v(e){if(!e)return null;var n,r,i,a,o,u=new Bi,l=e.period.mpd.manifest.Period_asArray[e.period.index].AdaptationSet_asArray[e.index];if(u.id=e.id,u.index=e.index,u.type=e.type,u.streamInfo=T(e.period),u.representationCount=t.getRepresentationCount(l),u.labels=t.getLabelsForAdaptation(l),u.lang=t.getLanguageForAdaptation(l),u.segmentAlignment=t.getSegmentAlignment(l),u.subSegmentAlignment=t.getSubSegmentAlignment(l),n=t.getViewpointForAdaptation(l),u.viewpoint=n.length?n[0].value:void 0,u.viewpointsWithSchemeIdUri=n,o=t.getAccessibilityForAdaptation(l),u.accessibility=o.map((function(e){var t=e.value,n=t;return e.schemeIdUri&&e.schemeIdUri.search("cea-608")>=0&&void 0!==s&&(n=t?"cea-608:"+t:"cea-608",u.embeddedCaptions=!0),n})),u.accessibilitiesWithSchemeIdUri=o,r=t.getAudioChannelConfigurationForAdaptation(l),u.audioChannelConfiguration=r.map((function(e){return e.value})),u.audioChannelConfigurationsWithSchemeIdUri=r,0===u.audioChannelConfiguration.length&&Array.isArray(l.Representation_asArray)&&l.Representation_asArray.length>0&&(i=t.getAudioChannelConfigurationForRepresentation(l.Representation_asArray[0]),u.audioChannelConfiguration=i.map((function(e){return e.value})),u.audioChannelConfigurationsWithSchemeIdUri=i),a=t.getRolesForAdaptation(l),u.roles=a.map((function(e){return e.value})),u.rolesWithSchemeIdUri=a,u.codec=t.getCodec(l),u.mimeType=t.getMimeType(l),u.contentProtection=t.getContentProtectionData(l),u.bitrateList=t.getBitrateListForAdaptation(l),u.selectionPriority=t.getSelectionPriority(l),u.contentProtection){var c=u.contentProtection.map((function(e){return t.getKID(e)})).filter((function(e){return null!==e}));if(c.length){var f=c[0];u.contentProtection.forEach((function(e){e.keyId=f}))}}if(u.isText=t.getIsText(l),u.supplementalProperties=t.getSupplementalPropertiesForAdaptation(l),(!u.supplementalProperties||0===Object.keys(u.supplementalProperties).length)&&Array.isArray(l.Representation_asArray)&&l.Representation_asArray.length>0){var d=l.Representation_asArray.map((function(e){return t.getSupplementalPropertiesForRepresentation(e)}));d.every((function(e){return JSON.stringify(e)===JSON.stringify(d[0])}))&&(u.supplementalProperties=d[0])}if(u.supplementalPropertiesAsArray=t.getSupplementalPropertiesAsArrayForAdaptation(l),(!u.supplementalPropertiesAsArray||0===u.supplementalPropertiesAsArray.length)&&Array.isArray(l.Representation_asArray)&&l.Representation_asArray.length>0){var g=l.Representation_asArray.map((function(e){return t.getSupplementalPropertiesAsArrayForRepresentation(e)}));g.every((function(e){return JSON.stringify(e)===JSON.stringify(g[0])}))&&(u.supplementalPropertiesAsArray=g[0])}return u.isFragmented=t.getIsFragmented(l),u.isEmbedded=!1,u}function _(e,t,n){e.id=t,e.index=100+parseInt(t.substring(2,3)),e.type=a.TEXT,e.codec="cea-608-in-SEI",e.isEmbedded=!0,e.isFragmented=!1;var r=yn()(n);e.lang=r||n,e.roles=["caption"],e.rolesWithSchemeIdUri=[{schemeIdUri:"urn:mpeg:dash:role:2011",value:"caption"}]}function T(e){var n,r,i=new Gi;return i.id=e.id,i.index=e.index,i.start=e.start,i.duration=e.duration,i.manifestInfo=(n=e.mpd,(r=new qi).dvrWindowSize=n.timeShiftBufferDepth,r.loadedTime=n.manifest.loadedTime,r.availableFrom=n.availabilityStartTime,r.minBufferTime=n.manifest.minBufferTime,r.maxFragmentDuration=n.maxSegmentDuration,r.duration=t.getDuration(n.manifest),r.isDynamic=t.getIsDynamic(n.manifest),r.serviceDescriptions=t.getServiceDescriptions(n.manifest),r.protocol=n.manifest.protocol,r),i.isLast=1===e.mpd.manifest.Period_asArray.length||Math.abs(i.start+i.duration-i.manifestInfo.duration)<1,i}function S(){if(!a)throw new Error("setConfig function has to be called previously")}function b(e){return r.length>0?r[0].mpd.manifest.Period_asArray[e]:null}function A(e,t,n){var r,i,a,o,s;if(e)for(r=e.AdaptationSet_asArray,o=0;o<r.length;o+=1)for(a=r[o].Representation_asArray,s=0;s<a.length;s+=1)if(t===(i=a[s]).id)return n?s:i;return null}return e={getBandwidthForRepresentation:function(e,t){var n;return(n=A(b(t),e))?n.bandwidth:null},getIndexForRepresentation:function(e,t){return function(e,t){var n=A(e,t,!0);return null!==n?n:-1}(b(t),e)},getMaxIndexForBufferType:function(e,n){return function(e,n){var r,i,a,o;if(!e||!n)return-1;for(i=e.AdaptationSet_asArray,o=0;o<i.length;o+=1)if(a=(r=i[o]).Representation_asArray,t.getIsTypeOf(r,n))return a.length;return-1}(b(n),e)},convertRepresentationToRepresentationInfo:function(e){if(e){var n=new Zi,r=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index],i=t.getRepresentationFor(e.index,r);return n.id=e.id,n.quality=e.index,n.bandwidth=t.getBandwidth(i),n.fragmentDuration=e.segmentDuration||(e.segments&&e.segments.length>0?e.segments[0].duration:NaN),n.MSETimeOffset=e.MSETimeOffset,n.mediaInfo=v(e.adaptation),n}return null},getStreamsInfo:function(e,t){var n=[],i=r;if(e&&(S(),i=g(e)),i.length>0){(!t||t>i.length)&&(t=i.length);for(var a=0;a<t;a++)n.push(T(i[a]))}return n},getMediaInfoForType:function(e,n){if(0===r.length||!e)return null;var i=E(e,r);if(!i)return null;var a=t.getAdaptationsForPeriod(i),o=l(e.index,n,e);return o?v(a[t.getIndexForAdaptation(o,r[0].mpd.manifest,e.index)]):null},getAllMediaInfoForType:d,getAdaptationForType:l,getRealAdaptation:function(e,n){var i,a,o=E(e,r);return i=n?n.id:null,r.length>0&&o&&(a=i?t.getAdaptationForId(i,r[0].mpd.manifest,o.index):t.getAdaptationForIndex(n?n.index:null,r[0].mpd.manifest,o.index)),a},getProducerReferenceTimes:function(e,n){var i,a,o=E(e,r);return i=n?n.id:null,r.length>0&&o&&(a=i?t.getAdaptationForId(i,r[0].mpd.manifest,o.index):t.getAdaptationForIndex(n?n.index:null,r[0].mpd.manifest,o.index)),a?t.getProducerReferenceTimesForAdaptation(a):[]},getRealPeriodByIndex:function(e){return t.getRealPeriodForIndex(e,r[0].mpd.manifest)},getEssentialPropertiesForRepresentation:function(e){try{return t.getEssentialPropertiesForRepresentation(e)}catch(e){return[]}},getVoRepresentations:function(e){var n=y(e);return t.getRepresentationsForAdaptation(n)},getEventsFor:function(e,n,i){var a=[];if(r.length>0){var o=r[0].mpd.manifest;if(e instanceof Gi){var s=E(e,r);a=t.getEventsForPeriod(s)}else if(e instanceof Bi){var u=E(i,r);a=t.getEventStreamForAdaptationSet(o,y(e),u)}else if(e instanceof Zi){var l=E(i,r);a=t.getEventStreamForRepresentation(o,n,l)}}return a},getEvent:function(e,t,n,r){try{if(!e||!t||isNaN(n)||!r)return null;var i=e.scheme_id_uri,a=e.value;if(!t[i+"/"+a])return null;var o,s=new _e,u=e.timescale||1,l=r.adaptation.period.start,c=t[i+"/"+a],f=isNaN(r.presentationTimeOffset)?isNaN(c.presentationTimeOffset)?0:c.presentationTimeOffset:r.presentationTimeOffset,d=e.presentation_time_delta/u;o=0===e.version?l+n-f+d:l-f+d;var g=e.event_duration/u,h=e.id,p=e.message_data;return s.eventStream=c,s.eventStream.value=a,s.eventStream.timescale=u,s.duration=g,s.id=h,s.calculatedPresentationTime=o,s.messageData=p,s.presentationTimeDelta=d,s}catch(e){return null}},getMpd:h,setConfig:function(e){e&&(e.constants&&(a=e.constants),e.cea608parser&&(s=e.cea608parser),e.errHandler&&t.setConfig({errHandler:e.errHandler}),e.BASE64&&t.setConfig({BASE64:e.BASE64}))},updatePeriods:function(e){if(!e)return null;S(),r=g(e)},getIsTextTrack:function(e){return t.getIsText(e)},getUTCTimingSources:function(){var e=m();return t.getUTCTimingSources(e)},getSuggestedPresentationDelay:function(){var e=r.length>0?r[0].mpd:null;return t.getSuggestedPresentationDelay(e)},getAvailabilityStartTime:function(e){var n=h(e);return t.getAvailabilityStartTime(n)},getIsTypeOf:function(e,n){return t.getIsTypeOf(e,n)},getIsDynamic:function(e){var n=m(e);return t.getIsDynamic(n)},getDuration:function(e){var n=m(e);return t.getDuration(n)},getRegularPeriods:g,getContentSteering:function(e){return t.getContentSteering(e)},getLocation:function(e){return t.getLocation(e)},getPatchLocation:function(e){var n=t.getPatchLocation(e),r=t.getPublishTime(e);return n&&0!==n.length&&r?n.filter((function(e){return isNaN(e.ttl)||r.getTime()+e.ttl>(new Date).getTime()})):[]},getManifestUpdatePeriod:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.getManifestUpdatePeriod(e,n)},getPublishTime:function(e){return t.getPublishTime(e)},getIsDVB:function(e){return t.hasProfile(e,"urn:dvb:dash:profile:dvb-dash:2014")},getIsPatch:function(e){return n.getIsPatch(e)},getBaseURLsFromElement:function(e){return t.getBaseURLsFromElement(e)},getRepresentationSortFunction:function(){return t.getRepresentationSortFunction()},getCodec:function(e,n,r){return t.getCodec(e,n,r)},getPeriodById:function(e){if(!e||0===r.length)return null;var t=r.filter((function(t){return t.id===e}));return t&&t.length>0?t[0]:null},setCurrentMediaInfo:function(e,t,n){i[e]=i[e]||{},i[e][t]=i[e][t]||{},i[e][t]=n},isPatchValid:function(e,r){var i=t.getId(e),a=n.getMpdId(r),o=t.getPublishTime(e),s=n.getPublishTime(r),u=n.getOriginalPublishTime(r);return!!(i&&a&&i==a&&o&&u&&o.getTime()==u.getTime()&&s&&o.getTime()<s.getTime())},applyPatchToManifest:function(e,t){n.getPatchOperations(t).forEach((function(t){var n=t.getMpdTarget(e);if(null!==n){var r=n.name,i=n.target,a=n.leaf;if(t.xpath.findsAttribute()||"__text"===r)switch(t.action){case"add":case"replace":i[r]=t.value;break;case"remove":delete i[r]}else{var o=(i[r+"_asArray"]||[]).indexOf(a),s="prepend"===t.position||"before"===t.position;if(("remove"===t.action||"replace"===t.action)&&(delete i[r],-1!=o)){var u=i[r+"_asArray"];u.splice(o,1),u.length>1?i[r]=u:1==u.length?i[r]=u[0]:delete i[r+"_asArray"]}"add"!==t.action&&"replace"!==t.action||Object.keys(t.value).forEach((function(e){var n=t.value[e],a=i[e+"_asArray"]||[];if(0===a.length&&i[e]&&a.push(i[e]),0===a.length)a=n;else{var u=a.length;u=e==r&&-1!=o?o+(s?0:1)+("replace"==t.action?-1:0):s?0:a.length,a.splice.apply(a,[u,0].concat(n))}i[e+"_asArray"]=a,i[e]=1==a.length?a[0]:a}))}}}))},areMediaInfosEqual:c,reset:p},t=Ze(u).getInstance(),n=zi(u).getInstance(),p(),e}Wi.__dashjs_factory_name="DashAdapter";var Xi=c.Z.getSingletonFactory(Wi);function Qi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Ji=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"round10",value:function(e,t){return function(e,t,n){return void 0===n||0==+n?Math[e](t):(n=+n,null===(t=+t)||isNaN(t)||"number"!=typeof n||n%1!=0?NaN:(t=t.toString().split("e"),+((t=(t=Math[e](+(t[0]+"e"+(t[1]?+t[1]-n:-n)))).toString().split("e"))[0]+"e"+(t[1]?+t[1]+n:n))))}("round",e,t)}}],null&&0,n&&Qi(t,n),e}(),$i=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TcpList=[],this.HttpList=[],this.RepSwitchList=[],this.BufferLevel=[],this.BufferState=[],this.PlayList=[],this.DroppedFrames=[],this.SchedulingInfo=[],this.DVRInfo=[],this.ManifestUpdate=[],this.RequestsQueue=null,this.DVBErrors=[]},ea=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.t=null,this.mt=null,this.to=null,this.lto=null},ta=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.t=null,this.level=null},na=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.target=null,this.state=s.Z.BUFFER_EMPTY},ra=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.time=null,this.range=null,this.manifestInfo=null},ia=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.time=null,this.droppedFrames=null};function aa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var oa=function e(){aa(this,e),this.mediaType=null,this.type=null,this.requestTime=null,this.fetchTime=null,this.availabilityStartTime=null,this.presentationStartTime=0,this.clientTimeOffset=0,this.currentTime=null,this.buffered=null,this.latency=0,this.streamInfo=[],this.representationInfo=[]},sa=function e(){aa(this,e),this.id=null,this.index=null,this.start=null,this.duration=null},ua=function e(){aa(this,e),this.id=null,this.index=null,this.mediaType=null,this.streamIndex=null,this.presentationTimeOffset=null,this.startNumber=null,this.fragmentInfoType=null},la=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mediaType=null,this.t=null,this.type=null,this.startTime=null,this.availabilityStartTime=null,this.duration=null,this.quality=null,this.range=null,this.state=null},ca=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.loadingRequests=[],this.executedRequests=[]};function fa(e){var t,n,r=(e=e||{}).settings,i=this.context,o=(0,u.Z)(i).getInstance();function c(){o.trigger(l.Z.METRICS_CHANGED)}function f(e){o.trigger(l.Z.METRIC_CHANGED,{mediaType:e}),c()}function d(e,t,n){o.trigger(l.Z.METRIC_UPDATED,{mediaType:e,metric:t,value:n}),f(e)}function g(e,t,n){o.trigger(l.Z.METRIC_ADDED,{mediaType:e,metric:t,value:n}),f(e)}function h(e,t){var r=null;return e?(n.hasOwnProperty(e)?r=n[e]:t||(r=new $i,n[e]=r),r):r}function p(e,t,n){var i=h(e);null!==i&&(i[t].push(n),i[t].length>r.get().streaming.metrics.maxListDepth&&i[t].shift())}function m(e,t,n){p(e,t,n),g(e,t,n)}return t={clearCurrentMetricsForType:function(e){delete n[e],f(e)},clearAllCurrentMetrics:function(){n={},c()},getMetricsFor:h,addHttpRequest:function e(t,n,r,i,a,o,u,l,c,f,d,g,h,p,y,E,v){var _=new C.w;o&&o!==i&&(e(t,null,r,i,a,null,null,l,c,null,null,null,h,null,null,E,v),_.actualurl=o),_.tcpid=n,_.type=r,_.url=i,_.range=l,_.trequest=c,_.tresponse=f,_.responsecode=g,_.cmsd=v,_._tfinish=d,_._stream=t,_._mediaduration=h,_._quality=a,_._responseHeaders=p,_._serviceLocation=u,_._fileLoaderType=E,y?y.forEach((function(e){!function(e,t,n,r){var i=new C.O;i.s=t,i.d=n,i.b=r,e.trace.push(i),e.interval||(e.interval=0),e.interval+=n}(_,e.s,e.d,e.b)})):(delete _.interval,delete _.trace),m(t,s.Z.HTTP_REQUEST,_)},addRepresentationSwitch:function(e,t,n,r,i){var a=new ea;a.t=t,a.mt=n,a.to=r,i?a.lto=i:delete a.lto,m(e,s.Z.TRACK_SWITCH,a)},addBufferLevel:function(e,t,n){var r=new ta;r.t=t,r.level=n,m(e,s.Z.BUFFER_LEVEL,r)},addBufferState:function(e,t,n){var r=new na;r.target=n,r.state=t,m(e,s.Z.BUFFER_STATE,r)},addDVRInfo:function(e,t,n,r){var i=new ra;i.time=t,i.range=r,i.manifestInfo=n,m(e,s.Z.DVR_INFO,i)},addDroppedFrames:function(e,t){var n=new ia,r=h(e).DroppedFrames;t&&(n.time=t.creationTime,n.droppedFrames=t.droppedVideoFrames,r.length>0&&r[r.length-1]==n||m(e,s.Z.DROPPED_FRAMES,n))},addSchedulingInfo:function(e,t,n,r,i,a,o,u,l){var c=new la;c.mediaType=e,c.t=t,c.type=n,c.startTime=r,c.availabilityStartTime=i,c.duration=a,c.quality=o,c.range=u,c.state=l,m(e,s.Z.SCHEDULING_INFO,c)},addRequestsQueue:function(e,t,n){var r=new ca;r.loadingRequests=t,r.executedRequests=n,h(e).RequestsQueue=r,g(e,s.Z.REQUESTS_QUEUE,r)},addManifestUpdate:function(e,t,n,r,i,o,u,l,c,f){var d=new oa;d.mediaType=e,d.type=t,d.requestTime=n,d.fetchTime=r,d.availabilityStartTime=i,d.presentationStartTime=o,d.clientTimeOffset=u,d.currentTime=l,d.buffered=c,d.latency=f,p(a.Z.STREAM,s.Z.MANIFEST_UPDATE,d),g(e,s.Z.MANIFEST_UPDATE,d)},updateManifestUpdateInfo:function(e,t){if(e){for(var n in t)e[n]=t[n];d(e.mediaType,s.Z.MANIFEST_UPDATE,e)}},addManifestUpdateStreamInfo:function(e,t,n,r,i){if(e){var a=new sa;a.id=t,a.index=n,a.start=r,a.duration=i,e.streamInfo.push(a),d(e.mediaType,s.Z.MANIFEST_UPDATE_STREAM_INFO,e)}},addManifestUpdateRepresentationInfo:function(e,t,n,r,i,a,o,u){if(e&&e.representationInfo){var l=new ua;l.id=t,l.index=n,l.streamIndex=r,l.mediaType=i,l.startNumber=o,l.fragmentInfoType=u,l.presentationTimeOffset=a,e.representationInfo.push(l),d(e.mediaType,s.Z.MANIFEST_UPDATE_TRACK_INFO,e)}},addPlayList:function(e){e.trace&&Array.isArray(e.trace)?e.trace.forEach((function(e){e.hasOwnProperty("subreplevel")&&!e.subreplevel&&delete e.subreplevel})):delete e.trace,m(a.Z.STREAM,s.Z.PLAY_LIST,e)},addDVBErrors:function(e){m(a.Z.STREAM,s.Z.DVB_ERRORS,e)}},n={},t}fa.__dashjs_factory_name="MetricsModel";var da=c.Z.getSingletonFactory(fa);function ga(e){e=e||{};var t,n,r,i,o=this.context,u=e.metricsModel;function l(e){var t=u.getMetricsFor(e,!0);if(!t)return null;var n,r=t.HttpList,i=null;if(!r||r.length<=0)return null;for(n=r.length-1;n>=0;){if(r[n].responsecode){i=r[n];break}n--}return i}function c(e){var t=u.getMetricsFor(e,!0);return t&&t.HttpList?t.HttpList:[]}function f(e,t){if(!e)return null;var n=e[t];return n&&0!==n.length?n[n.length-1]:null}return t={getCurrentRepresentationSwitch:function(e){return f(u.getMetricsFor(e,!0),s.Z.TRACK_SWITCH)},getCurrentBufferState:function(e){return f(u.getMetricsFor(e,!0),s.Z.BUFFER_STATE)},getCurrentBufferLevel:function(e){var t=f(u.getMetricsFor(e,!0),s.Z.BUFFER_LEVEL);return t?Ji.round10(t.level/1e3,-3):0},getCurrentHttpRequest:l,getHttpRequests:c,getCurrentDroppedFrames:function(){return f(u.getMetricsFor(a.Z.VIDEO,!0),s.Z.DROPPED_FRAMES)},getCurrentSchedulingInfo:function(e){return f(u.getMetricsFor(e,!0),s.Z.SCHEDULING_INFO)},getCurrentDVRInfo:function(e){return f(e?u.getMetricsFor(e,!0):u.getMetricsFor(a.Z.VIDEO,!0)||u.getMetricsFor(a.Z.AUDIO,!0),s.Z.DVR_INFO)},getCurrentManifestUpdate:function(){return f(u.getMetricsFor(a.Z.STREAM),s.Z.MANIFEST_UPDATE)},getLatestFragmentRequestHeaderValueByID:function(e,t){if(!t)return null;var n={},r=l(e);r&&(n=Be.Z.parseHttpHeaders(r._responseHeaders));var i=n[t.toLowerCase()];return void 0===i?null:i},getLatestMPDRequestHeaderValueByID:function(e){if(!e)return null;var t,n,r,i={};for(r=(t=c(a.Z.STREAM)).length-1;r>=0;r--)if((n=t[r]).type===C.w.MPD_TYPE){i=Be.Z.parseHttpHeaders(n._responseHeaders);break}var o=i[e.toLowerCase()];return void 0===o?null:o},addRepresentationSwitch:function(e,t,n,r,i){u.addRepresentationSwitch(e,t,n,r,i)},addDVRInfo:function(e,t,n,r){u.addDVRInfo(e,t,n,r)},updateManifestUpdateInfo:function(e){var t=this.getCurrentManifestUpdate();u.updateManifestUpdateInfo(t,e)},addManifestUpdateStreamInfo:function(e){if(e){var t=this.getCurrentManifestUpdate();u.addManifestUpdateStreamInfo(t,e.id,e.index,e.start,e.duration)}},addManifestUpdateRepresentationInfo:function(e,t){if(e){var n=this.getCurrentManifestUpdate();u.addManifestUpdateRepresentationInfo(n,e.id,e.index,e.streamIndex,t,e.presentationTimeOffset,e.startNumber,e.fragmentInfoType)}},addManifestUpdate:function(e){u.addManifestUpdate(a.Z.STREAM,e.type,e.requestStartDate,e.requestEndDate)},addHttpRequest:function(e,t,n,r,i,a){u.addHttpRequest(e.mediaType,null,e.type,e.url,e.quality,t,e.serviceLocation||null,e.range||null,e.requestStartDate,e.firstByteDate,e.requestEndDate,n,e.duration,r,i,e.fileLoaderType,a)},addSchedulingInfo:function(e,t){u.addSchedulingInfo(e.mediaType,new Date,e.type,e.startTime,e.availabilityStartTime,e.duration,e.quality,e.range,t)},addRequestsQueue:function(e,t,n){u.addRequestsQueue(e,t,n)},addBufferLevel:function(e,t,n){u.addBufferLevel(e,t,n)},addBufferState:function(e,t,n){u.addBufferState(e,t,n)},addDroppedFrames:function(e){u.addDroppedFrames(a.Z.VIDEO,e)},addPlayList:function(){i&&(u.addPlayList(i),i=null)},addDVBErrors:function(e){u.addDVBErrors(e)},createPlaylistMetrics:function(e,t){(i=new $).start=new Date,i.mstart=e,i.starttype=t},createPlaylistTraceMetrics:function(e,t,i){!0===n&&(n=!1,(r=new ee).representationid=e,r.start=new Date,r.mstart=t,r.playbackspeed=null!==i?i.toString():null)},updatePlayListTraceMetrics:function(e){if(r)for(var t in r)r[t]=e[t]},pushPlayListTraceMetrics:function(e,t){if(!1===n&&i&&r&&r.start){var a=r.start,o=e.getTime()-a.getTime();r.duration=o,r.stopreason=t,i.trace.push(r),n=!0}},clearAllCurrentMetrics:function(){u.clearAllCurrentMetrics()}},u=u||da(o).getInstance({settings:e.settings}),n=!0,r=null,i=null,t}ga.__dashjs_factory_name="DashMetrics";var ha=c.Z.getSingletonFactory(ga);function pa(){var e,t,n,r,i=this.context,s=(0,u.Z)(i).getInstance(),c=(0,N.Z)(i).getInstance();function f(e){r=e}function g(e,t,n,r){var i,a=t.adaptation.period.mpd,o=a.availabilityStartTime;if(r)i=n&&a.timeShiftBufferDepth!==Number.POSITIVE_INFINITY?new Date(o.getTime()+1e3*(e+a.timeShiftBufferDepth)):a.availabilityEndTime;else if(n){var s=t.availabilityTimeOffset;i=new Date(o.getTime()+1e3*(e-s))}else i=o;return i}function h(e,t){return(e.getTime()-t.mpd.availabilityStartTime.getTime()+1e3*r)/1e3}function p(e,t){return e+(t.adaptation.period.start-t.presentationTimeOffset)}function m(e){var n={start:NaN,end:NaN},r=e[0].getAdapter().getRegularPeriods()[0],i=h(new Date,r);if(!e||0===e.length)return{range:n,now:i};e.forEach((function(e){var r=e.getAdapter(),s=r.getMediaInfoForType(e.getStreamInfo(),a.Z.VIDEO)||r.getMediaInfoForType(e.getStreamInfo(),a.Z.AUDIO),u=r.getVoRepresentations(s)[0],l={start:NaN,end:NaN};if(u)if(u.segmentInfoType===o.Z.SEGMENT_TIMELINE)l=function(e){var n,r,i,a,o=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index],s=t.getRepresentationFor(e.index,o),u=s.SegmentTemplate||s.SegmentList,l=u.SegmentTimeline,c=u.timescale,f=l.S_asArray,d={start:0,end:0},g=f[0].t,h=!isNaN(g),m=h?g:0,y=0;for(h&&(d.start=p(m/c,e)),i=0,a=f.length;i<a;i++)r=0,(n=f[i]).hasOwnProperty("r")&&(r=n.r),y+=n.d*(1+r);return d.end=p((m+y)/c,e),d}(u);else{var c=u.adaptation.period;l.start=c.start,l.end=Math.max(i,c.start+c.duration)}!isNaN(l.start)&&(isNaN(n.start)||n.start>l.start)&&(n.start=l.start),!isNaN(l.end)&&(isNaN(n.end)||n.end<l.end)&&(n.end=l.end)})),n.end=Math.min(i,n.end);var s=E(e,n.end,!0);return n.end=isNaN(s)?n.end:s,n.start=r&&r.mpd&&r.mpd.timeShiftBufferDepth&&!isNaN(r.mpd.timeShiftBufferDepth)&&!isNaN(n.end)?Math.max(n.end-r.mpd.timeShiftBufferDepth,n.start):n.start,n.start=E(e,n.start),{range:n,now:i}}function y(e,t){n=e-t.end}function E(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{for(var r=0,i=!1,a=NaN;!i&&r<e.length;){var o=e[r].getStreamInfo();o.start<=t&&(!isFinite(o.duration)||o.start+o.duration>=t)?(a=t,i=!0):!n&&o.start>t&&(isNaN(a)||o.start<a)?a=o.start:n&&o.start+o.duration<t&&(isNaN(a)||o.start+o.duration>a)&&(a=o.start+o.duration),r+=1}return a}catch(e){return t}}function v(e){void 0===e.offset||isNaN(e.offset)||f(e.offset/1e3)}function _(){r=0,n=0}function T(){s.off(l.Z.UPDATE_TIME_SYNC_OFFSET,v,this),_()}return e={initialize:function(){_(),s.on(l.Z.UPDATE_TIME_SYNC_OFFSET,v,this)},getClientTimeOffset:function(){return r},setClientTimeOffset:f,getClientReferenceTime:function(){return Date.now()-1e3*n+1e3*r},calcAvailabilityStartTimeFromPresentationTime:function(e,t,n){return g(e,t,n)},calcAvailabilityEndTimeFromPresentationTime:function(e,t,n){return g(e,t,n,!0)},calcPresentationTimeFromWallTime:h,calcPresentationTimeFromMediaTime:p,calcPeriodRelativeTimeFromMpdRelativeTime:function(e,t){return t-e.adaptation.period.start},calcMediaTimeFromPresentationTime:function(e,t){return e-t.adaptation.period.start+t.presentationTimeOffset},calcWallTimeForSegment:function(e,t){var n,r,i;return t&&(n=e.representation.adaptation.period.mpd.suggestedPresentationDelay,r=e.presentationStartTime+n,i=new Date(e.availabilityStartTime.getTime()+1e3*r)),i},calcTimeShiftBufferWindow:function(e,t){if(!t)return function(e){var t={start:NaN,end:NaN},n=0,r=NaN;return e.forEach((function(e){var t=e.getStreamInfo();n+=t.duration,(isNaN(r)||t.start<r)&&(r=t.start)})),t.start=r,t.end=r+n,t}(e);if(c.get().streaming.timeShiftBuffer.calcFromSegmentTimeline){var n=m(e);return y(n.now,n.range),n.range}return function(e){var t={start:NaN,end:NaN};if(!e||0===e.length)return t;var n=e[0].getAdapter().getRegularPeriods()[0],r=h(new Date,n),i=n.mpd.timeShiftBufferDepth,a=isNaN(i)?0:r-i;if(t.start=E(e,a),t.end=!isNaN(t.start)&&r<t.start?r:E(e,r,!0),!isNaN(i)&&t.end<r-i&&(t.end=NaN),c.get().streaming.timeShiftBuffer.fallbackToSegmentTimeline){var o=m(e);if(o.range.end<t.start)return s.trigger(d.Z.CONFORMANCE_VIOLATION,{level:nn.LEVELS.WARNING,event:nn.EVENTS.INVALID_DVR_WINDOW}),y(o.now,o.range),o.range}return t}(e)},reset:T},t=Ze(i).getInstance(),T(),e}pa.__dashjs_factory_name="TimelineConverter";var ma=c.Z.getSingletonFactory(pa),ya=n(4593),Ea=n(6934);function va(e){return va="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},va(e)}function _a(e,t){return _a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},_a(e,t)}function Ta(e,t){return!t||"object"!==va(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function Sa(e){return Sa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Sa(e)}var ba=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_a(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=Sa(t);if(n){var i=Sa(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return Ta(this,e)});function i(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(e=r.call(this)).captionData=null,e.label=null,e.defaultTrack=!1,e.kind=null,e.isFragmented=!1,e.isEmbedded=!1,e.isTTML=null,e}return i}(Bi),Aa=n(2295);function Ia(){var e=0;function t(e){for(var t="",n=0;n<e.length;++n)t+=e[n].uchar;return t.length-t.replace(/^\\s+/,"").length}function n(e){return"left: "+3.125*e.x+"%; top: "+6.66*e.y1+"%; width: "+(100-3.125*e.x)+"%; height: "+6.66*Math.max(e.y2-1-e.y1,1)+"%; align-items: flex-start; overflow: visible; -webkit-writing-mode: horizontal-tb;"}function r(e){return"red"===e?"rgb(255, 0, 0)":"green"===e?"rgb(0, 255, 0)":"blue"===e?"rgb(0, 0, 255)":"cyan"===e?"rgb(0, 255, 255)":"magenta"===e?"rgb(255, 0, 255)":"yellow"===e?"rgb(255, 255, 0)":"white"===e?"rgb(255, 255, 255)":"black"===e?"rgb(0, 0, 0)":e}function i(e,t){var n=e.videoHeight/15;return t?"font-size: "+n+"px; font-family: Menlo, Consolas, \'Cutive Mono\', monospace; color: "+(t.foreground?r(t.foreground):"rgb(255, 255, 255)")+"; font-style: "+(t.italics?"italic":"normal")+"; text-decoration: "+(t.underline?"underline":"none")+"; white-space: pre; background-color: "+(t.background?r(t.background):"transparent")+";":"font-size: "+n+"px; font-family: Menlo, Consolas, \'Cutive Mono\', monospace; justify-content: flex-start; text-align: left; color: rgb(255, 255, 255); font-style: normal; white-space: pre; line-height: normal; font-weight: normal; text-decoration: none; width: 100%; display: flex;"}function a(e){return e.replace(/^\\s+/g,"")}function o(e){return e.replace(/\\s+$/g,"")}return{createHTMLCaptionsFromScreen:function(r,s,u,l){var c,f,d=null,g=!1,h=-1,p={start:s,end:u,spans:[]},m="style_cea608_white_black",y={},E={},v=[];for(c=0;c<15;++c){var _=l.rows[c],T="",S=null;if(!1===_.isEmpty()){var b=t(_.chars);null===d&&(d={x:b,y1:c,y2:c+1,p:[]}),b!==h&&g&&(d.p.push(p),p={start:s,end:u,spans:[]},d.y2=c,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===y.hasOwnProperty(d.name)?(v.push(d),y[d.name]=d):y[d.name].p.contat(d.p),d={x:b,y1:c,y2:c+1,p:[]});for(var A=0;A<_.chars.length;++A){var I=_.chars[A],R=I.penState;if(null===S||!R.equals(S)){T.trim().length>0&&(p.spans.push({name:m,line:T,row:c}),T="");var w="style_cea608_"+R.foreground+"_"+R.background;R.underline&&(w+="_underline"),R.italics&&(w+="_italics"),E.hasOwnProperty(w)||(E[w]=JSON.parse(JSON.stringify(R))),S=R,m=w}T+=I.uchar}T.trim().length>0&&p.spans.push({name:m,line:T,row:c}),g=!0,h=b}else g=!1,h=-1,d&&(d.p.push(p),p={start:s,end:u,spans:[]},d.y2=c,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===y.hasOwnProperty(d.name)?(v.push(d),y[d.name]=d):y[d.name].p.contat(d.p),d=null)}d&&(d.p.push(p),d.y2=c+1,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===y.hasOwnProperty(d.name)?(v.push(d),y[d.name]=d):y[d.name].p.contat(d.p),d=null);var N=[];for(c=0;c<v.length;++c){var C=v[c],D="sub_cea608_"+e++,O=document.createElement("div");O.id=D;var M=n(C);O.style.cssText="position: absolute; margin: 0; display: flex; box-sizing: border-box; pointer-events: none;"+M;var P=document.createElement("div");P.className="paragraph bodyStyle",P.style.cssText=i(r);var L=document.createElement("div");L.className="cueUniWrapper",L.style.cssText="unicode-bidi: normal; direction: ltr;";for(var x=0;x<C.p.length;++x){var F=C.p[x],k=0;for(f=0;f<F.spans.length;++f){var U=F.spans[f];if(U.line.length>0){if(0!==f&&k!=U.row){var Z=document.createElement("br");Z.className="lineBreak",L.appendChild(Z)}var B=!1;k===U.row&&(B=!0),k=U.row;var G=E[U.name],q=document.createElement("span");q.className="spanPadding "+U.name+" customSpanColor",q.style.cssText=i(r,G),0!==f&&B?f===F.spans.length-1?q.textContent=o(U.line):q.textContent=U.line:F.spans.length>1&&f<F.spans.length-1&&U.row===F.spans[f+1].row?q.textContent=a(U.line):q.textContent=U.line.trim(),L.appendChild(q)}}}P.appendChild(L),O.appendChild(P);var Y={bodyStyle:["%",90]};for(var j in E)E.hasOwnProperty(j)&&(Y[j]=["%",90]);N.push({type:"html",start:s,end:u,cueHTMLElement:O,cueID:D,cellResolution:[32,15],isFromCEA608:!0,fontSize:Y,lineHeight:{},linePadding:{}})}return N}}}Ia.__dashjs_factory_name="EmbeddedTextHtmlRender";var Ra=c.Z.getSingletonFactory(Ia);function wa(e){var t,n,r,o,s,c,d,g,h,p,m,y,E,v,_,T,b,A=e.errHandler,I=e.manifestModel,R=e.mediaController,N=e.videoModel,D=e.textTracks,O=e.vttParser,M=e.vttCustomRenderingParser,P=e.ttmlParser,L=e.streamInfo,x=e.settings,F=this.context,k=(0,u.Z)(F).getInstance(),U=!1;function Z(){c=null,g=NaN,h=[],p=null,d=!1,s=[],o=null}function B(e){var t=new ba;for(var n in e)t[n]=e[n];t.labels=e.labels,t.defaultTrack=function(e){var t=!1;return y.length>1&&e.isEmbedded?t=e.id&&e.id===a.Z.CC1:1===y.length?e.id&&"string"==typeof e.id&&"CC"===e.id.substring(0,2)&&(t=!0):0===y.length&&(t=e.index===s[0].index),t}(e),t.isFragmented=e.isFragmented,t.isEmbedded=!!e.isEmbedded,t.isTTML=function(e){return e.codec&&e.codec.search(a.Z.STPP)>=0||e.mimeType&&e.mimeType.search(a.Z.TTML)>=0}(e),t.kind=function(e,t){var n=e.roles&&e.roles.length>0?t[e.roles[0]]:t.caption;return n=n===t.caption||n===t.subtitle?n:t.caption}(e,{subtitle:"subtitles",caption:"captions"}),D.addTextTrack(t)}function G(e){var t=e.chunk;t.mediaInfo.embeddedCaptions&&Y(t.bytes,t)}function q(e){m=e}function Y(e,s){var u=s.mediaInfo,l=u.type,f=u.mimeType,h=u.codec||f;h?-1!==u.codec.indexOf("application/mp4")?function(e,i,s){var u;if("InitializationSegment"===i.segmentType)d=!0,g=r.getMediaTimescaleFromMoov(e);else{if(!d)return;(u=r.getSamplesInfo(e).sampleList).length>0&&(p=u[0].cts-i.start*g),s.search(a.Z.STPP)>=0?function(e,r,i){var s,u;for(o=null!==o?o:V(i),s=0;s<r.length;s++){var l=r[s],f=l.cts,d=H(),h=d+f/g,p=h+l.duration/g;t.buffered.add(h,p);var y=new DataView(e,l.offset,l.subSizes[0]),E=Ea.Utils.dataViewToString(y,a.Z.UTF8),v=[],_=l.offset+l.subSizes[0];for(u=1;u<l.subSizes.length;u++){var T=new Uint8Array(e,_,l.subSizes[u]),S=String.fromCharCode.apply(null,T);v.push(S),_+=l.subSizes[u]}try{var b=I.getValue().ttmlTimeIsRelative?f/g:0,A=o.parse(E,b,f/g,(f+l.duration)/g,v);D.addCaptions(m,d,A)}catch(e){c.removeExecutedRequestsBeforeTime(),this.remove(),n.error("TTML parser error: "+e.message)}}}(e,u,s):function(e,r){var i,a,o,s=[];for(i=0;i<r.length;i++){var u=r[i];u.cts-=p;var l=H()+u.cts/g,c=l+u.duration/g;t.buffered.add(l,c);var f=e.slice(u.offset,u.offset+u.size),d=Ea.parseBuffer(f);for(a=0;a<d.boxes.length;a++){var h=d.boxes[a];if(n.debug("VTT box1: "+h.type),"vtte"!==h.type&&"vttc"===h.type){n.debug("VTT vttc boxes.length = "+h.boxes.length);var y={styles:{}};for(o=0;o<h.boxes.length;o++){var E=h.boxes[o];if(n.debug("VTT box2: "+E.type),"payl"===E.type)y.start=u.cts/g,y.end=(u.cts+u.duration)/g,y.data=E.cue_text;else if("sttg"===E.type&&E.settings&&""!==E.settings)try{var v=E.settings.split(" ");y.styles=O.getCaptionStyles(v)}catch(e){}}y&&y.data&&(s.push(y),n.debug("VTT ".concat(y.start," - ").concat(y.end," : ").concat(y.data)))}}}s.length>0&&D.addCaptions(m,0,s)}(e,u)}}(e,s,h):l===a.Z.VIDEO?function(e,t){var a,o;if(t.segmentType===C.w.INIT_SEGMENT_TYPE)0===E&&(E=r.getMediaTimescaleFromMoov(e));else if(t.segmentType===C.w.MEDIA_SEGMENT_TYPE){if(0===E)return void n.warn("CEA-608: No timescale for embeddedTextTrack yet");var s=(o=r.getSamplesInfo(e)).lastSequenceNumber,u=Math.trunc(t.start),l=Math.trunc(t.end);if(T[0]||T[1]||function(){for(var e,t=0;t<y.length;t++){if(-1===(e=D.getTrackIdxForId(y[t].id)))return void n.warn("CEA-608: data before track is ready.");var r=j(e);T[t]=new(i().Cea608Parser)(t+1,{newCue:r},null)}}(),E){if(function(e,t,n,r,i){return null!==e&&null!==t&&null!==r&&null!==i&&(t===e?r!==i:t!==e+n)}(v,s,o.numSequences,_,u))for(a=0;a<T.length;a++)T[a]&&T[a].reset();for(var c=function(e,t){if(0===t.length)return null;for(var n={splits:[],fields:[[],[]]},r=new DataView(e),a=0;a<t.length;a++)for(var o=t[a],s=i().findCea608Nalus(r,o.offset,o.size),u=null,l=0,c=0;c<s.length;c++)for(var f=i().extractCea608DataFromRange(r,s[c]),d=0;d<2;d++)if(f[d].length>0){o.cts!==u?l=0:l+=1;var g=H();n.fields[d].push([o.cts+g*E,f[d],l]),u=o.cts}return n.fields.forEach((function(e){e.sort((function(e,t){return e[0]===t[0]?e[2]-t[2]:e[0]-t[0]}))})),n}(e,o.sampleList),f=0;f<T.length;f++){var d=c.fields[f],g=T[f];if(g)for(a=0;a<d.length;a++)g.addData(d[a][0]/E,d[a][1])}v=s,_=l}}}(e,s):function(e,n,r){var i,o,s=new DataView(e,0,e.byteLength);o=Ea.Utils.dataViewToString(s,a.Z.UTF8);try{i=V(r).parse(o,0),D.addCaptions(D.getCurrentTrackIdx(),0,i),t.buffered&&t.buffered.add(n.start,n.end)}catch(e){A.error(new S.Z(w.TIMED_TEXT_ERROR_ID_PARSE_CODE,w.TIMED_TEXT_ERROR_MESSAGE_PARSE+e.message,o))}}(e,s,h):n.error("No text type defined")}function j(e){return function(t,n,r){var i;(i=N.getTTMLRenderingDiv()?b.createHTMLCaptionsFromScreen(N.getElement(),t,n,r):[{start:t,end:n,data:r.getDisplayText(),styles:{}}])&&D.addCaptions(e,0,i)}}function H(){return isNaN(t.timestampOffset)?0:t.timestampOffset}function V(e){var t;return e.search(a.Z.VTT)>=0?t=x.get().streaming.text.webvtt.customRenderingEnabled&&M?M:O:(e.search(a.Z.TTML)>=0||e.search(a.Z.STPP)>=0)&&(t=P),t}function K(e){y.forEach((function(t){var n=D.getTrackIdxForId(t.id);n>=0&&D.deleteCuesFromTrackIdx(n,e.from,e.to)}))}return t={initialize:function(){U||(y=[],m=null,E=0,T=[],v=null,_=null,U=!0,b=Ra(F).getInstance(),k.on(l.Z.VIDEO_CHUNK_RECEIVED,G,t),k.on(l.Z.BUFFER_CLEARED,K,t))},addMediaInfos:function(e,n,r){if(s=s.concat(n),e===a.Z.TEXT&&n[0].isFragmented&&!n[0].isEmbedded){c=r,t.buffered=(0,Aa.Z)(F).create(),h=R.getTracksFor(a.Z.TEXT,L.id).filter((function(e){return e.isFragmented}));for(var i=R.getCurrentTrackFor(a.Z.TEXT,L.id),o=0;o<h.length;o++)if(h[o]===i){q(o);break}}for(var u=0;u<n.length;u++)B(n[u])},resetMediaInfos:function(){s=[]},getStreamId:function(){return L.id},append:Y,abort:function(){},addEmbeddedTrack:function(e){if(U&&e)if(e.id===a.Z.CC1||e.id===a.Z.CC3){for(var t=0;t<y.length;t++)if(y[t].id===e.id)return;y.push(e)}else n.warn("Embedded track "+e.id+" not supported!")},resetEmbedded:function(){k.off(l.Z.VIDEO_CHUNK_RECEIVED,G,t),k.off(l.Z.BUFFER_CLEARED,K,t),D&&D.deleteAllTextTracks(),U=!1,y=[],T=[null,null],v=null,_=null},getConfig:function(){return{fragmentModel:c,fragmentedTracks:h,videoModel:N}},setCurrentFragmentedTrackIdx:q,remove:function(e,n){void 0===e&&e===n&&(e=t.buffered.start(0),n=t.buffered.end(t.buffered.length-1)),t.buffered.remove(e,n),D.deleteCuesFromTrackIdx(m,e,n)},reset:function(){Z(),s=[],r=null}},n=(0,f.Z)(F).getInstance().getLogger(t),r=(0,xt.Z)(F).getInstance(),Z(),t}wa.__dashjs_factory_name="TextSourceBuffer";var Na=c.Z.getClassFactory(wa),Ca=n(4403);function Da(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Oa=["text","align","fontSize","id","isd","line","lineAlign","lineHeight","linePadding","position","positionAlign","region","size","snapToLines","vertical"];function Ma(e){var t,n,r,i,o,s,c,g,h,p,m,y,E,v,_,T,S,b,A=this.context,I=(0,u.Z)(A).getInstance(),R=e.videoModel,w=e.streamInfo,N=e.settings;function C(e,t,n,r,i,a){var o=0,s=0;e/t>n/r?o=(s=t)/r*n:s=(o=e)/n*r;var u,l,c=0,f=0;return o/s>i?(f=s,c=s*i):(c=o,f=o/i),u=(e-c)/2,l=(t-f)/2,a?{x:u+.1*c,y:l+.1*f,w:.8*c,h:.8*f}:{x:u,y:l,w:c,h:f}}function D(e,t){var n=R.getClientWidth(),r=R.getClientHeight(),i=R.getVideoWidth(),a=R.getVideoHeight(),o=R.getVideoRelativeOffsetTop(),s=R.getVideoRelativeOffsetLeft();if(0!==i&&0!==a){var u=i/a,l=!1;e.isFromCEA608&&(u=3.5/3,l=!0);var f=C.call(this,n,r,i,a,u,l),y=f.w,E=f.h,T=f.x,b=f.y;if(y!=h||E!=p||T!=c||b!=g||t){if(c=T+s,g=b+o,h=y,p=E,m){var A=m.style;A&&(A.left=c+"px",A.top=g+"px",A.width=h+"px",A.height=p+"px",A.zIndex=v&&document[v]||_?S:null,I.trigger(d.Z.CAPTION_CONTAINER_RESIZE))}var w=e.activeCues;if(w)for(var N=w.length,D=0;D<N;++D){var O=w[D];O.scaleCue(O)}}}}function O(e){var t,n,r,i,a,o=h,s=p;if(e.cellResolution){var u=[o/e.cellResolution[0],s/e.cellResolution[1]];if(e.linePadding)for(t in e.linePadding)if(e.linePadding.hasOwnProperty(t)){n=(e.linePadding[t]*u[0]).toString();for(var l=document.getElementsByClassName("spanPadding"),c=0;c<l.length;c++)l[c].style.cssText=l[c].style.cssText.replace(/(padding-left\\s*:\\s*)[\\d.,]+(?=\\s*px)/gi,"$1"+n),l[c].style.cssText=l[c].style.cssText.replace(/(padding-right\\s*:\\s*)[\\d.,]+(?=\\s*px)/gi,"$1"+n)}if(e.fontSize){for(t in e.fontSize)if(e.fontSize.hasOwnProperty(t)){"%"===e.fontSize[t][0]?r=e.fontSize[t][1]/100:"c"===e.fontSize[t][0]&&(r=e.fontSize[t][1]),n=(r*u[1]).toString(),a="defaultFontSize"!==t?document.getElementsByClassName(t):document.getElementsByClassName("paragraph");for(var f=0;f<a.length;f++)a[f].style.cssText=a[f].style.cssText.replace(/(font-size\\s*:\\s*)[\\d.,]+(?=\\s*px)/gi,"$1"+n)}if(e.lineHeight)for(t in e.lineHeight)if(e.lineHeight.hasOwnProperty(t)){"%"===e.lineHeight[t][0]?i=e.lineHeight[t][1]/100:"c"===e.fontSize[t][0]&&(i=e.lineHeight[t][1]),n=(i*u[1]).toString(),a=document.getElementsByClassName(t);for(var d=0;d<a.length;d++)a[d].style.cssText=a[d].style.cssText.replace(/(line-height\\s*:\\s*)[\\d.,]+(?=\\s*px)/gi,"$1"+n)}}}if(e.isd){var g=document.getElementById(e.cueID);g&&m.removeChild(g),P(e)}}function M(e,t){var n=/^(urn:)(mpeg:[a-z0-9][a-z0-9-]{0,31}:)(subs:)([0-9]+)$/,r=/^#(.*)$/;if(n.test(t)){var i=n.exec(t),a=parseInt(i[4],10)-1;return"data:image/png;base64,"+btoa(e.images[a])}if(r.test(t)){var o=r.exec(t)[1];return"data:image/png;base64,"+e.embeddedImages[o]}return t}function P(e){if(m){var t=document.createElement("div");m.appendChild(t),T=(0,Ca.renderHTML)(e.isd,t,(function(t){return M(e,t)}),m.clientHeight,m.clientWidth,!1,(function(e){n.info("renderCaption :",e)}),T,!0),t.id=e.cueID,I.trigger(d.Z.CAPTION_RENDERED,{captionDiv:t,currentTrackIdx:s})}}function L(e,t){if(!N.get().streaming.text.extendSegmentedCues)return!1;if(!t.cues||0===t.cues.length)return!1;var n=t.cues[t.cues.length-1];return!(n.endTime<e.startTime||!function(e,t,n){for(var r=0;r<n.length;r++){var i=n[r];if(JSON.stringify(e[i])!==JSON.stringify(t[i]))return!1}return!0}(n,e,Oa)||(n.endTime=Math.max(n.endTime,e.endTime),0))}function x(e,t){t&&t.forEach((function(t){t.kind&&"image"===t.kind&&(t.src=M(e,t.src)),x(e,t.contents)}))}function F(e,t,r){var i=G(e);if(i&&Array.isArray(r)&&0!==r.length)for(var a=0;a<r.length;a++){var o=void 0,s=r[a];i.cellResolution=s.cellResolution,i.isFromCEA608=s.isFromCEA608,isNaN(s.start)||isNaN(s.end)||(o="html"===s.type&&m?k(s,t,i):s.data?U(s,t,i):null);try{if(o){j(i,o)||(N.get().streaming.text.webvtt.customRenderingEnabled?(i.manualCueList||(i.manualCueList=[]),i.manualCueList.push(o)):L(o,i)||i.addCue(o));var u=N.get().streaming.buffer.bufferToKeep;V(i,0,R.getTime()-u)}else n.error("Impossible to display subtitles. You might have missed setting a TTML rendering div via player.attachTTMLRenderingDiv(TTMLRenderingDiv)")}catch(e){throw K(i),i.addCue(o),e}}}function k(e,t,i){var o=this,u=new r(e.start+t,e.end+t,"");return u.cueHTMLElement=e.cueHTMLElement,u.isd=e.isd,u.images=e.images,u.embeddedImages=e.embeddedImages,u.cueID=e.cueID,u.scaleCue=O.bind(o),u.cellResolution=e.cellResolution,u.lineHeight=e.lineHeight,u.linePadding=e.linePadding,u.fontSize=e.fontSize,m.style.left=c+"px",m.style.top=g+"px",m.style.width=h+"px",m.style.height=p+"px",u.isd&&x(u,u.isd.contents),u.onenter=function(){i.mode===a.Z.TEXT_SHOWING&&(this.isd?(P(this),n.debug("Cue enter id:"+this.cueID)):(m.appendChild(this.cueHTMLElement),O.call(o,this),I.trigger(d.Z.CAPTION_RENDERED,{captionDiv:this.cueHTMLElement,currentTrackIdx:s})))},u.onexit=function(){if(m)for(var e=m.childNodes,t=0;t<e.length;++t)e[t].id===this.cueID&&(n.debug("Cue exit id:"+e[t].id),m.removeChild(e[t]),--t)},u}function U(e,t,i){var o=new r(e.start-t,e.end-t,e.data);if(o.cueID="".concat(o.startTime,"_").concat(o.endTime),o.isActive=!1,e.styles)try{void 0!==e.styles.align&&"align"in o&&(o.align=e.styles.align),void 0!==e.styles.line&&"line"in o&&(o.line=e.styles.line),void 0!==e.styles.snapToLines&&"snapToLines"in o&&(o.snapToLines=e.styles.snapToLines),void 0!==e.styles.position&&"position"in o&&(o.position=e.styles.position),void 0!==e.styles.size&&"size"in o&&(o.size=e.styles.size)}catch(e){n.error(e)}return o.onenter=function(){i.mode===a.Z.TEXT_SHOWING&&I.trigger(d.Z.CAPTION_RENDERED,{currentTrackIdx:s})},o}function Z(e){if(y)for(var t=y.childNodes,n=0;n<t.length;++n)t[n].id===e.cueID&&(y.removeChild(t[n]),--n)}function B(){var e,t=[],n=function(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Da(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Da(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}(R.getTextTracks());try{for(n.s();!(e=n.n()).done;){var r=e.value;r.manualMode===a.Z.TEXT_SHOWING&&t.push(r)}}catch(e){n.e(e)}finally{n.f()}return t}function G(e){return e>=0&&i[e]?R.getTextTrack(i[e].kind,i[e].id,i[e].lang,i[e].isTTML,i[e].isEmbedded):null}function q(e){var t=this;if(e!==s){var n=G(s=e);Y.call(this,n),E&&(clearInterval(E),E=null),n&&"html"===n.renderingType&&(D.call(this,n,!0),window.ResizeObserver?(b=new window.ResizeObserver((function(){D.call(t,n,!0)}))).observe(R.getElement()):E=setInterval(D.bind(this,n),500))}}function Y(e){X.call(this),e&&"html"===e.renderingType?z.call(this):W.call(this)}function j(e,t){if(!e.cues)return!1;for(var n=0;n<e.cues.length;n++)if(e.cues[n].startTime===t.startTime&&e.cues[n].endTime===t.endTime)return!0;return!1}function H(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return!!e&&(isNaN(t)||(r?e.startTime:e.endTime)>=t)&&(isNaN(n)||(r?e.endTime:e.startTime)<=n)}function V(e,t,n){var r,i;if(!(n<t)&&e&&(e.cues||e.manualCueList)){var a=e.cues&&e.cues.length>0?"native":"custom",o="native"===a?e.cues:e.manualCueList;if(!o||0===o.length)return;for(var s=o.length-1;s>=0;s--)!H(o[s],t,n,!0)||(r=o[s],void 0,i=R.getTime(),r.startTime>=i&&r.endTime<=i)||("native"===a?e.removeCue(o[s]):(Z(o[s]),delete e.manualCueList[s]))}}function K(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(e&&(e.cues||e.manualCueList)){var i=e.cues&&e.cues.length>0?"native":"custom",a="native"===i?e.cues:e.manualCueList;if(!a||0===a.length)return;for(var o=a.length-1,s=o;s>=0;s--)H(a[s],t,n,r)&&("native"===i?(a[s].onexit&&a[s].onexit(),e.removeCue(a[s])):(Z(a[s]),delete e.manualCueList[s]))}}function z(){var e=document.getElementById("native-cue-style");if(!e){(e=document.createElement("style")).id="native-cue-style",document.head.appendChild(e);var t=e.sheet,r=R.getElement();try{r&&(r.id?t.insertRule("#"+r.id+"::cue {background: transparent}",0):0!==r.classList.length?t.insertRule("."+r.className+"::cue {background: transparent}",0):t.insertRule("video::cue {background: transparent}",0))}catch(e){n.info(""+e.message)}}}function W(){var e=document.getElementById("native-cue-style");e&&document.head.removeChild(e)}function X(){if(m)for(;m.firstChild;)m.removeChild(m.firstChild)}return t={initialize:function(){"undefined"!=typeof window&&"undefined"!=typeof navigator&&(r=window.VTTCue||window.TextTrackCue,i=[],o=[],s=-1,c=0,g=0,h=0,p=0,m=null,y=null,E=null,_=!1,S=2147483647,T=null,void 0!==document.fullscreenElement?v="fullscreenElement":void 0!==document.webkitIsFullScreen?v="webkitIsFullScreen":document.msFullscreenElement?v="msFullscreenElement":document.mozFullScreen&&(v="mozFullScreen"))},getStreamId:function(){return w.id},addTextTrack:function(e){i.push(e)},addCaptions:F,createTracks:function(){i.sort((function(e,t){return e.index-t.index})),m=R.getTTMLRenderingDiv(),y=R.getVttRenderingDiv();for(var e,t,n,r,u,c,f=-1,g=0;g<i.length;g++){var h=(void 0,void 0,void 0,void 0,void 0,t=(e=i[g]).kind,n=void 0!==e.id?e.id:e.lang,r=e.lang,u=e.isTTML,c=e.isEmbedded,R.addTextTrack(t,n,r,u,c));o.push(h),i[g].defaultTrack&&(h.default=!0,f=g);var p=G(g);p&&(p.mode=a.Z.TEXT_SHOWING,m&&(i[g].isTTML||i[g].isEmbedded)?p.renderingType="html":p.renderingType="default"),F(g,0,i[g].captionData),I.trigger(d.Z.TEXT_TRACK_ADDED)}if(q.call(this,f),f>=0){I.on(d.Z.PLAYBACK_METADATA_LOADED,(function e(){var t=G(f);t&&"html"===t.renderingType&&D.call(this,t,!0),I.off(d.Z.PLAYBACK_METADATA_LOADED,e,this)}),this);for(var E=0;E<i.length;E++){var v=G(E);v&&(v.mode=E===f?a.Z.TEXT_SHOWING:a.Z.TEXT_HIDDEN,v.manualMode=E===f?a.Z.TEXT_SHOWING:a.Z.TEXT_HIDDEN)}}I.trigger(l.Z.TEXT_TRACKS_QUEUE_INITIALIZED,{index:s,tracks:i,streamId:w.id})},getCurrentTrackIdx:function(){return s},setCurrentTrackIdx:q,getTrackIdxForId:function(e){for(var t=-1,n=0;n<i.length;n++)if(i[n].id===e){t=n;break}return t},getCurrentTrackInfo:function(){return i[s]},setModeForTrackIdx:function(e,t){var n=G(e);n&&n.mode!==t&&(n.mode=t),n&&n.manualMode!==t&&(n.manualMode=t)},deleteCuesFromTrackIdx:function(e,t,n){var r=G(e);r&&K(r,t,n)},deleteAllTextTracks:function(){for(var e=o?o.length:0,t=0;t<e;t++){var n=G(t);n&&K.call(this,n,w.start,w.start+w.duration,!1)}o=[],i=[],E&&(clearInterval(E),E=null),b&&R&&(b.unobserve(R.getElement()),b=null),s=-1,X.call(this)},deleteTextTrack:function(e){R.removeChild(o[e]),o.splice(e,1)},manualCueProcessing:function(e){var t=B();if(t&&t.length>0){var n=t[0].manualCueList;n&&n.length>0&&n.forEach((function(t){t.startTime<=e&&t.endTime>=e&&!t.isActive?(t.isActive=!0,WebVTT.processCues(window,[t],y,t.cueID)):t.isActive&&(t.startTime>e||t.endTime<e)&&(t.isActive=!1,Z(t))}))}},disableManualTracks:function(){var e=B();if(e&&e.length>0){var t=e[0].manualCueList;t&&t.length>0&&t.forEach((function(e){if(e.isActive&&(e.isActive=!1,y))for(var t=y.childNodes,n=0;n<t.length;++n)t[n].id===e.cueID&&(y.removeChild(t[n]),--n)}))}}},n=(0,f.Z)(A).getInstance().getLogger(t),t}Ma.__dashjs_factory_name="TextTracks";var Pa=c.Z.getClassFactory(Ma);function La(){var e,t,n,r,i,a,o=this.context;function s(e){var t=e.split(":"),n=t.length-1;return e=60*parseInt(t[n-1],10)+parseFloat(t[n]),2===n&&(e+=3600*parseInt(t[0],10)),e}function u(e){var t=e.split(r),n=t[1].split(a);return n.shift(),t[1]=n[0],n.shift(),{cuePoints:t,styles:l(n)}}function l(e){var t={};return e.forEach((function(e){if(e.split(/:/).length>1){var n=e.split(/:/)[1],r=!1;n&&-1!=n.search(/%/)&&(r=!0,n=parseInt(n.replace(/%/,""),10)),(e.match(/align/)||e.match(/A/))&&(t.align=n),(e.match(/line/)||e.match(/L/))&&(t.line="auto"===n?n:parseInt(n,10),r&&(t.snapToLines=!1)),(e.match(/position/)||e.match(/P/))&&(t.position=n),(e.match(/size/)||e.match(/S/))&&(t.size=n)}})),t}function c(e,t){for(var n,i=t,a="",o="";""!==e[i]&&i<e.length;)i++;if((n=i-t)>1)for(var s=0;s<n;s++){if((o=e[t+s]).match(r)){a="";break}a+=o,s!==n-1&&(a+="\\n")}else(o=e[t]).match(r)||(a=o);return a}return e={parse:function(e){var a,o,l=[];if(!e)return l;a=(e=e.split(n)).length,o=-1;for(var f=0;f<a;f++){var d=e[f];if(d.length>0&&"WEBVTT"!==d&&d.match(r)){var g=u(d),h=g.cuePoints,p=g.styles,m=c(e,f+1),y=s(h[0].replace(i,"")),E=s(h[1].replace(i,""));!isNaN(y)&&!isNaN(E)&&y>=o&&E>y?""!==m?(o=y,l.push({start:y,end:E,data:m,styles:p})):t.error("Skipping cue due to empty/malformed cue text"):t.error("Skipping cue due to incorrect cue timing")}}return l},getCaptionStyles:l},t=(0,f.Z)(o).getInstance().getLogger(e),n=/(?:\\r\\n|\\r|\\n)/gm,r=/--\x3e/,i=/(^[\\s]+|[\\s]+$)/g,a=/\\s\\b/g,e}La.__dashjs_factory_name="VTTParser";var xa=c.Z.getSingletonFactory(La);function Fa(){var e,t;return e={parse:function(e){var n=[];return t.oncue=function(e){e.start=e.startTime,e.end=e.endTime,e.data=e.text,e.styles={align:e.align,line:e.line,position:e.position,size:e.size},n.push(e)},t.parse(e),n}},function(){try{window&&window.WebVTT&&window.WebVTT.Parser&&(t=new window.WebVTT.Parser(window,window.vttjs,window.WebVTT.StringDecoder()))}catch(e){}}(),e}Fa.__dashjs_factory_name="VttCustomRenderingParser";var ka=c.Z.getSingletonFactory(Fa);function Ua(){var e,t,n=this.context,r=(0,u.Z)(n).getInstance(),i=0;return e={parse:function(e,n,a,o,s){var u,c,f,g="",h=[],p={},m={},y="",E="",v={onOpenTag:function(e,n,i){if(i[" imagetype"]&&!i[" imageType"]&&(r.trigger(d.Z.CONFORMANCE_VIOLATION,{level:nn.LEVELS.ERROR,event:nn.EVENTS.NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE}),i[" imageType"]=i[" imagetype"]),"image"===n&&("http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt"===e||"http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt"===e)){if(!i[" imageType"]||"PNG"!==i[" imageType"].value)return void t.warn("smpte-tt imageType != PNG. Discarded");y=i["http://www.w3.org/XML/1998/namespace id"].value}},onCloseTag:function(){y&&(m[y]=E.trim()),E="",y=""},onText:function(e){y&&(E+=e)}};if(!e)throw g="no ttml data to parse",new Error(g);p.data=e,r.trigger(l.Z.TTML_TO_PARSE,p);var _=(0,Ca.fromXML)(p.data,(function(e){g=e}),v);r.trigger(l.Z.TTML_PARSED,{ttmlString:p.data,ttmlDoc:_});var T,S=_.getMediaTimeEvents();for(f=0;f<S.length;f++){var b=(0,Ca.generateISD)(_,S[f],(function(e){g=e}));b.contents.some((function(e){return e.contents.length}))&&(u=S[f]+n)<(c=S[f+1]+n)&&h.push({start:u,end:c,type:"html",cueID:(void 0,T="cue_TTML_"+i,i++,T),isd:b,images:s,embeddedImages:m})}if(""!==g)throw t.error(g),new Error(g);return h}},t=(0,f.Z)(n).getInstance().getLogger(e),e}Ua.__dashjs_factory_name="TTMLParser";var Za=c.Z.getSingletonFactory(Ua);function Ba(e){var t,n,r,i,o,s,c,f,g,h,p,m,y=this.context,E=e.adapter,v=e.errHandler,_=e.manifestModel,T=e.mediaController,S=e.videoModel,b=e.settings;function A(e){var t=e.tracks,r=e.index,i=e.streamId;if(!1===b.get().streaming.text.defaultEnabled&&!w()||m)N(i,-1);else{var o=T.getCurrentTrackFor(a.Z.TEXT,i);if(o){var s={lang:o.lang,role:o.roles[0],index:o.index,codec:o.codec,accessibility:o.accessibility[0]};t.some((function(e,t){if(T.matchSettings(s,e))return N(i,t),r=t,!0}))}g=!1}n[i].lastEnabledIndex=r,f.trigger(d.Z.TEXT_TRACKS_ADDED,{enabled:w(),index:r,tracks:t,streamId:i}),p=!0}function I(e){try{var t=e.streamId;if(!i[t]||isNaN(e.time))return;i[t].manualCueProcessing(e.time)}catch(e){}}function R(e){try{var t=e.streamId;if(!i[t])return;i[t].disableManualTracks()}catch(e){}}function w(){var e=!0;return g&&!h&&(e=!1),e}function N(e,t){(g=-1===t)&&T&&T.saveTextSettingsDisabled();var n=C(e);if(n!==t&&i[e]){i[e].disableManualTracks(),i[e].setModeForTrackIdx(n,a.Z.TEXT_HIDDEN),i[e].setCurrentTrackIdx(t),i[e].setModeForTrackIdx(t,a.Z.TEXT_SHOWING);var o=i[e].getCurrentTrackInfo();o&&o.isFragmented&&!o.isEmbedded?function(e,t,n){if(r[e])for(var o=r[e].getConfig().fragmentedTracks,s=0;s<o.length;s++){var u=o[s];if(t.lang===u.lang&&(u.id?t.id===u.id:t.index===u.index)){var c=T.getCurrentTrackFor(a.Z.TEXT,e);(u.id?c.id!==u.id:c.index!==u.index)?(i[e].deleteCuesFromTrackIdx(n),r[e].setCurrentFragmentedTrackIdx(s)):-1===n&&f.trigger(l.Z.SET_FRAGMENTED_TEXT_AFTER_DISABLED,{},{streamId:e,mediaType:a.Z.TEXT})}}}(e,o,n):o&&!o.isFragmented&&function(e,t){f.trigger(l.Z.SET_NON_FRAGMENTED_TEXT,{currentTrackInfo:t},{streamId:e,mediaType:a.Z.TEXT})}(e,o),T.setTrack(o)}}function C(e){return i[e].getCurrentTrackIdx()}function D(){r={},i={},n={},g=!0,p=!1,m=!1}return t={deactivateStream:function(e){if(e){var t=e.id;r[t]&&r[t].resetMediaInfos(),i[t]&&i[t].deleteAllTextTracks()}},initialize:function(){f.on(l.Z.TEXT_TRACKS_QUEUE_INITIALIZED,A,t),b.get().streaming.text.webvtt.customRenderingEnabled&&(f.on(l.Z.PLAYBACK_TIME_UPDATED,I,t),f.on(l.Z.PLAYBACK_SEEKING,R,t))},initializeForStream:function(e){var t=e.id,a=Pa(y).create({videoModel:S,settings:b,streamInfo:e});a.initialize(),i[t]=a;var u=Na(y).create({errHandler:v,adapter:E,manifestModel:_,mediaController:T,videoModel:S,textTracks:a,vttParser:o,vttCustomRenderingParser:s,ttmlParser:c,streamInfo:e,settings:b});u.initialize(),r[t]=u,n[t]={},n[t].lastEnabledIndex=-1},createTracks:function(e){var t=e.id;i[t]&&i[t].createTracks()},getTextSourceBuffer:function(e){var t=e.id;if(r&&r[t])return r[t]},getAllTracksAreDisabled:function(){return g},addEmbeddedTrack:function(e,t){var n=e.id;r[n]&&r[n].addEmbeddedTrack(t)},enableText:function(e,t){return(0,z.PS)(t,"boolean"),w()!==t&&(t&&N(e,n[e].lastEnabledIndex),t||(n[e].lastEnabledIndex=C(e),p?N(e,-1):m=!0)),!0},isTextEnabled:w,setTextTrack:N,getCurrentTrackIdx:C,enableForcedTextStreaming:function(e){return(0,z.PS)(e,"boolean"),h=e,!0},addMediaInfosToBuffer:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=e.id;r[a]&&r[a].addMediaInfos(t,n,i)},reset:function(){D(),f.off(l.Z.TEXT_TRACKS_QUEUE_INITIALIZED,A,t),b.get().streaming.text.webvtt.customRenderingEnabled&&(f.off(l.Z.PLAYBACK_TIME_UPDATED,I,t),f.off(l.Z.PLAYBACK_SEEKING,R,t)),Object.keys(r).forEach((function(e){r[e].resetEmbedded(),r[e].reset()}))}},h=!1,p=!1,m=!1,o=xa(y).getInstance(),s=ka(y).getInstance(),c=Za(y).getInstance(),f=(0,u.Z)(y).getInstance(),D(),t}Ba.__dashjs_factory_name="TextController";var Ga=c.Z.getClassFactory(Ba);function qa(){var e,t,n,r,g,p,m,y,E,v,_,T,b,A,I,R,D,O,M,P,L,x,F,k,U,Z,B,G,q,Y,j,H,V,K,W,J,$,ee,te,ne="You must first call initialize() and set a source before calling this method",re="You must first call initialize() and set a valid source and view before calling this method",ie="You must first call attachView() to set the video element before calling this method",ae="You must first call attachSource() with a valid source before calling this method",oe="MediaPlayer not initialized!",se=this.context,ue=(0,u.Z)(se).getInstance(),le=(0,N.Z)(se).getInstance(),ce=(0,f.Z)(se).getInstance({settings:le});function fe(){Ie(null),be(null),r=null,A&&(A.reset(),A=null),I&&(I.reset(),I=null),P&&P.reset(),le.reset(),D&&(D.reset(),D=null)}function de(){return!!n&&!!J.getElement()}function ge(){return(0,Ci.e)()}function he(){if(!m)throw re;return G.isPaused()}function pe(){if(!m)throw re;return G.getIsDynamic()}function me(e){var t=U&&U.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,n=H.getCurrentDVRInfo(t);if(!n)return 0;var r=G.getOriginalLiveDelay(),i=n.range.start+e;return i>n.range.end-r&&(i=n.range.end-r),i}function ye(e){if(!m)throw re;var t=Se().currentTime;if(void 0!==e)t=U.getTimeRelativeToStreamId(t,e);else if(G.getIsDynamic()){var n=U&&U.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,r=H.getCurrentDVRInfo(n);t=null===r||0===t?0:Math.max(0,t-r.range.start)}return t}function Ee(){if(!m)throw re;var e=Se().duration;if(G.getIsDynamic()){var t=U&&U.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,n=H.getCurrentDVRInfo(t);e=n?n.range.end-n.range.start:0}return e}function ve(e){(0,z.PS)(e,"boolean"),y=e}function _e(){P.restoreDefaultUTCTimingSources()}function Te(){return H}function Se(){if(!J.getElement())throw ie;return J.getElement()}function be(e){if(!g)throw oe;J.setElement(e),e&&(De(),function(){if(!I){var e=dashjs.MetricsReporting;if("function"==typeof e){var t=e(se).create();I=t.createMetricsReporting({debug:ce,eventBus:ue,mediaElement:Se(),adapter:O,dashMetrics:H,mediaPlayerModel:M,events:l.Z,constants:a.Z,metricsConstants:s.Z})}}}(),function(){if(!R){var e=dashjs.MssHandler;"function"==typeof e&&(w.extend(e.errors),R=e(se).create({eventBus:ue,mediaPlayerModel:M,dashMetrics:H,manifestModel:V,playbackController:G,streamController:U,protectionController:A,baseURLController:x,errHandler:L,events:l.Z,constants:a.Z,debug:ce,initSegmentType:C.w.INIT_SEGMENT_TYPE,BASE64:ya,ISOBoxer:Ea,settings:le}))}}(),U&&U.switchToVideoElement(E)),m&&we(),Pe(E)}function Ae(e){if(!p)throw ne;var t=U.getActiveStreamInfo();return t?b.getTracksFor(e,t.id):[]}function Ie(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:NaN;if(!g)throw oe;"string"==typeof e&&$.initialize(e),null==t&&(t=NaN),isNaN(t)||(t=Math.max(0,t)),E=t,n=e,(p||m)&&we(),de()&&Pe(E)}function Re(){if(!p)throw ne;var e=U.getActiveStreamInfo();return e?U.getStreamById(e.id):null}function we(){m=!1,p=!1,O.reset(),U.reset(),B.reset(),j.reset(),G.reset(),q.reset(),Y.reset(),v.reset(),b.reset(),te.reset(),A&&(le.get().streaming.protection.keepProtectionMediaKeys?A.stop():(A.reset(),A=null,De())),Z.reset(),K.reset(),W.reset()}function Ne(){var e=Ce();U||(U=on(se).getInstance()),Z||(Z=Ga(se).create({errHandler:L,manifestModel:V,adapter:O,mediaController:b,videoModel:J,settings:le})),k.setConfig({capabilities:F,customParametersModel:P,adapter:O,settings:le,manifestModel:V,errHandler:L}),U.setConfig({capabilities:F,capabilitiesFilter:k,manifestLoader:e,manifestModel:V,mediaPlayerModel:M,customParametersModel:P,protectionController:A,textController:Z,adapter:O,dashMetrics:H,errHandler:L,timelineConverter:T,videoModel:J,playbackController:G,serviceDescriptionController:q,contentSteeringController:Y,abrController:v,mediaController:b,settings:le,baseURLController:x,uriFragmentModel:$,segmentBaseController:te}),B.setConfig({settings:le,playbackController:G,streamController:U,videoModel:J,timelineConverter:T,adapter:O}),G.setConfig({streamController:U,serviceDescriptionController:q,dashMetrics:H,adapter:O,videoModel:J,timelineConverter:T,settings:le}),j.setConfig({streamController:U,playbackController:G,mediaPlayerModel:M,videoModel:J,settings:le}),v.setConfig({streamController:U,domStorage:ee,mediaPlayerModel:M,customParametersModel:P,cmsdModel:W,dashMetrics:H,adapter:O,videoModel:J,settings:le}),K.setConfig({abrController:v,dashMetrics:H,playbackController:G}),W.setConfig({}),v.initialize(),U.initialize(y,r),Z.initialize(),B.initialize(),j.initialize(),K.initialize(),W.initialize(),Y.initialize(),te.initialize()}function Ce(){return Hr(se).create({debug:ce,errHandler:L,dashMetrics:H,mediaPlayerModel:M,requestModifier:(0,X.Z)(se).getInstance(),mssHandler:R,settings:le})}function De(){if(A)return A;var e=dashjs.Protection;if("function"==typeof e){var t=e(se).create();return l.Z.extend(e.events),d.Z.extend(e.events,{publicOnly:!0}),w.extend(e.errors),F||(F=(0,zr.Z)(se).getInstance()),A=t.createProtectionSystem({debug:ce,errHandler:L,videoModel:J,customParametersModel:P,capabilities:F,eventBus:ue,events:l.Z,BASE64:ya,constants:a.Z,cmcdModel:K,settings:le})}return null}function Oe(){if(!g)throw oe;if(D)return D;var e=dashjs.OfflineController;if("function"==typeof e){l.Z.extend(e.events),d.Z.extend(e.events,{publicOnly:!0}),w.extend(e.errors);var t=Ce(),n=zt(se).create();return n.setConfig({manifestModel:V,adapter:O,manifestLoader:t,errHandler:L,contentSteeringController:Y}),D=e(se).create({debug:ce,manifestUpdater:n,baseURLController:x,manifestLoader:t,manifestModel:V,mediaPlayerModel:M,abrController:v,playbackController:G,adapter:O,errHandler:L,dashMetrics:H,timelineConverter:T,segmentBaseController:te,schemeLoaderFactory:_,eventBus:ue,events:l.Z,errors:w,constants:a.Z,settings:le,dashConstants:o.Z,urlUtils:(0,Q.Z)(se).getInstance()})}return null}function Me(e){var t=U&&U.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,n=H.getCurrentDVRInfo(t);return n?e+(n.manifestInfo.availableFrom.getTime()/1e3+n.range.start):0}function Pe(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN;D&&D.resetRecords(),!p&&n&&(p=!0,t.info("Streaming Initialized"),Ne(),"string"==typeof n?U.load(n,e):U.loadWithManifest(n,e)),!m&&de()&&(m=!0,t.info("Playback Initialized"))}return e={initialize:function(e,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:NaN;F||(F=(0,zr.Z)(se).getInstance()).setConfig({settings:le}),L||(L=Kr(se).getInstance()),F.supportsMediaSource()?(g||(g=!0,T=ma(se).getInstance(),v||(v=yi(se).getInstance()).setConfig({settings:le}),_||(_=yt(se).getInstance()),G||(G=h(se).getInstance()),b||(b=Tn(se).getInstance()),U||(U=on(se).getInstance()),B||(B=un(se).getInstance()),j||(j=cn(se).getInstance()),q||(q=pn(se).getInstance()),Y||(Y=jt(se).getInstance()),k||(k=Xr(se).getInstance()),O=Xi(se).getInstance(),V=ti(se).getInstance(),K=je(se).getInstance(),W=lt(se).getInstance(),H=ha(se).getInstance({settings:le}),ee=Ni(se).getInstance({settings:le}),O.setConfig({constants:a.Z,cea608parser:i(),errHandler:L,BASE64:ya}),x||(x=xn(se).create()),x.setConfig({adapter:O,contentSteeringController:Y}),q.setConfig({adapter:O}),te||(te=Ui(se).getInstance({dashMetrics:H,mediaPlayerModel:M,errHandler:L,baseURLController:x,events:l.Z,eventBus:ue,debug:ce,boxParser:(0,xt.Z)(se).getInstance(),requestModifier:(0,X.Z)(se).getInstance(),errors:w})),b.setConfig({domStorage:ee,settings:le,customParametersModel:P}),M.setConfig({playbackController:G,serviceDescriptionController:q}),Y.setConfig({adapter:O,errHandler:L,dashMetrics:H,mediaPlayerModel:M,manifestModel:V,serviceDescriptionController:q,eventBus:ue,requestModifier:(0,X.Z)(se).getInstance()}),_e(),ve(void 0===r||r),Oe()),e&&be(e),n&&Ie(n,o),t.info("[dash.js "+ge()+"] MediaPlayer has been initialized")):L.error(new S.Z(w.CAPABILITY_MEDIASOURCE_ERROR_CODE,w.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE))},setConfig:function(e){e&&(e.capabilities&&(F=e.capabilities),e.capabilitiesFilter&&(k=e.capabilitiesFilter),e.streamController&&(U=e.streamController),e.textController&&(Z=e.textController),e.gapController&&(B=e.gapController),e.playbackController&&(G=e.playbackController),e.serviceDescriptionController&&(q=e.serviceDescriptionController),e.contentSteeringController&&(Y=e.contentSteeringController),e.catchupController&&(j=e.catchupController),e.mediaPlayerModel&&(M=e.mediaPlayerModel),e.customParametersModel&&(P=e.customParametersModel),e.abrController&&(v=e.abrController),e.schemeLoaderFactory&&(_=e.schemeLoaderFactory),e.mediaController&&(b=e.mediaController),e.settings&&(le=e.settings))},on:function(e,t,n,r){ue.on(e,t,n,r)},off:function(e,t,n){ue.off(e,t,n)},extend:function(e,t,n){c.Z.extend(e,t,n,se)},attachView:be,attachSource:Ie,isReady:de,preload:function(){if(!J.getElement()&&!p){if(!n)throw ae;Pe(E)}},play:function(){if(!m)throw re;(!y||he()&&m)&&G.play(!0)},isPaused:he,pause:function(){if(!m)throw re;G.pause()},isSeeking:function(){if(!m)throw re;return G.isSeeking()},isDynamic:pe,getLowLatencyModeEnabled:function(){if(!m)throw re;return G.getLowLatencyModeEnabled()},seek:function(e){if(!m)throw re;if((0,z.PS)(e,"number"),isNaN(e))throw a.Z.BAD_ARGUMENT_ERROR;e<0&&(e=0);var t=G.getIsDynamic()?me(e):e,n=Se();!G.getIsDynamic()&&n.duration&&(t=Math.min(n.duration,t)),G.seek(t,!1,!1,!0)},seekToOriginalLive:function(){m&&pe()&&G.seekToOriginalLive()},setPlaybackRate:function(e){Se().playbackRate=e},getPlaybackRate:function(){return Se().playbackRate},setMute:function(e){(0,z.PS)(e,"boolean"),Se().muted=e},isMuted:function(){return Se().muted},setVolume:function(e){if("number"!=typeof e||isNaN(e)||e<0||e>1)throw a.Z.BAD_ARGUMENT_ERROR;Se().volume=e},getVolume:function(){return Se().volume},time:ye,duration:Ee,timeAsUTC:function(){if(!m)throw re;return ye()<0?NaN:Me(ye())},durationAsUTC:function(){if(!m)throw re;return Me(Ee())},getActiveStream:Re,getDVRWindowSize:function(){var e=U&&U.hasVideoTrack()?a.Z.VIDEO:a.Z.AUDIO,t=H.getCurrentDVRInfo(e);return t?t.manifestInfo.dvrWindowSize:0},getDVRSeekOffset:me,getAvailableBaseUrls:function(){var e=V.getValue();return e?x.getBaseUrls(e):[]},getAvailableLocations:function(){var e=V.getValue();if(!e)return[];var t=O.getLocation(e),n=Y.getSynthesizedLocationElements(t);return t.concat(n)},getTargetLiveDelay:function(){if(!m)throw re;return G.getOriginalLiveDelay()},convertToTimeCode:function(e){e=Math.max(e,0);var t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%3600%60);return(0===t?"":t<10?"0"+t.toString()+":":t.toString()+":")+(n<10?"0"+n.toString():n.toString())+":"+(r<10?"0"+r.toString():r.toString())},formatUTC:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=new Date(1e3*e),a=i.toLocaleDateString(t),o=i.toLocaleTimeString(t,{hour12:n});return r?o+" "+a:o},getVersion:ge,getDebug:function(){return ce},getBufferLength:function(e){var n=[a.Z.VIDEO,a.Z.AUDIO,a.Z.TEXT];if(e)return-1!==n.indexOf(e)?Te().getCurrentBufferLevel(e)||NaN:(t.warn("getBufferLength requested for invalid type"),NaN);var r=n.map((function(e){return Ae(e).length>0?Te().getCurrentBufferLevel(e):Number.MAX_VALUE})).reduce((function(e,t){return Math.min(e,t)}));return r===Number.MAX_VALUE?NaN:r},getTTMLRenderingDiv:function(){return J?J.getTTMLRenderingDiv():null},getVideoElement:Se,getSource:function(){if(!n)throw ae;return n},updateSource:function(e){n=e,U.load(n)},getCurrentLiveLatency:function(){if(!g)throw oe;return m?G.getCurrentLiveLatency():NaN},getTopBitrateInfoFor:function(e){if(!p)throw ne;return v.getTopBitrateInfoFor(e)},setAutoPlay:ve,getAutoPlay:function(){return y},getDashMetrics:Te,getQualityFor:function(e){if(!p)throw ne;if(e===a.Z.IMAGE){var t=Re();if(!t)return-1;var n=t.getThumbnailController();return n?n.getCurrentTrackIndex():-1}return v.getQualityFor(e)},setQualityFor:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!p)throw ne;if(e===a.Z.IMAGE){var r=Re();if(!r)return;var i=r.getThumbnailController();i&&i.setTrackByIndex(t)}v.setPlaybackQuality(e,U.getActiveStreamInfo(),t,{forceReplace:n})},updatePortalSize:function(){v.setElementSize(),v.setWindowResizeEventCalled(!0)},enableText:function(e){var t=U.getActiveStreamInfo();return!(!t||!Z)&&Z.enableText(t.id,e)},enableForcedTextStreaming:function(e){return!(!U.getActiveStreamInfo()||!Z)&&Z.enableForcedTextStreaming(e)},isTextEnabled:function(){var e=U.getActiveStreamInfo();return!(!e||!Z)&&Z.isTextEnabled(e)},setTextTrack:function(e){if(!m)throw re;var t=U.getActiveStreamInfo();t&&Z&&Z.setTextTrack(t.id,e)},getBitrateInfoListFor:function(e){if(!p)throw ne;var t=Re();return t?t.getBitrateListFor(e):[]},getStreamsFromManifest:function(e){if(!p)throw ne;return O.getStreamsInfo(e)},getTracksFor:Ae,getTracksForTypeFromManifest:function(e,t,n){if(!p)throw ne;return(n=n||O.getStreamsInfo(t,1)[0])?O.getAllMediaInfoForType(n,e,t):[]},getCurrentTrackFor:function(e){if(!p)throw ne;var t=U.getActiveStreamInfo();return b.getCurrentTrackFor(e,t.id)},setInitialMediaSettingsFor:function(e,t){if(!g)throw oe;b.setInitialSettings(e,t)},getInitialMediaSettingsFor:function(e){if(!g)throw oe;return b.getInitialSettings(e)},setCurrentTrack:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!p)throw ne;b.setTrack(e,t)},addABRCustomRule:function(e,t,n){P.addAbrCustomRule(e,t,n)},removeABRCustomRule:function(e){P.removeAbrCustomRule(e)},removeAllABRCustomRule:function(){P.removeAllAbrCustomRule()},getABRCustomRules:function(){return P.getAbrCustomRules()},getAverageThroughput:function(e){var t=v.getThroughputHistory(),n=G.getIsDynamic();return t?t.getAverageThroughput(e,n):0},retrieveManifest:function(e,t){var n=Ce(),r=this;ue.on(l.Z.INTERNAL_MANIFEST_LOADED,(function e(i){i.error?t(null,i.error):t(i.manifest),ue.off(l.Z.INTERNAL_MANIFEST_LOADED,e,r),n.reset()}),r),$.initialize(e),n.load(e)},addUTCTimingSource:function(e,t){P.addUTCTimingSource(e,t)},removeUTCTimingSource:function(e,t){P.removeUTCTimingSource(e,t)},clearDefaultUTCTimingSources:function(){P.clearDefaultUTCTimingSources()},restoreDefaultUTCTimingSources:_e,setXHRWithCredentialsForType:function(e,t){P.setXHRWithCredentialsForType(e,t)},getXHRWithCredentialsForType:function(e){return P.getXHRWithCredentialsForType(e)},getProtectionController:function(){return De()},attachProtectionController:function(e){A=e},setProtectionData:function(e){r=e,U&&U.setProtectionData(r)},registerLicenseRequestFilter:function(e){P.registerLicenseRequestFilter(e)},registerLicenseResponseFilter:function(e){P.registerLicenseResponseFilter(e)},unregisterLicenseRequestFilter:function(e){P.unregisterLicenseRequestFilter(e)},unregisterLicenseResponseFilter:function(e){P.unregisterLicenseResponseFilter(e)},registerCustomCapabilitiesFilter:function(e){P.registerCustomCapabilitiesFilter(e)},unregisterCustomCapabilitiesFilter:function(e){P.unregisterCustomCapabilitiesFilter(e)},setCustomInitialTrackSelectionFunction:function(e){P.setCustomInitialTrackSelectionFunction(e)},resetCustomInitialTrackSelectionFunction:function(){P.resetCustomInitialTrackSelectionFunction(null)},attachTTMLRenderingDiv:function(e){if(!J.getElement())throw ie;J.setTTMLRenderingDiv(e)},attachVttRenderingDiv:function(e){if(!J.getElement())throw ie;J.setVttRenderingDiv(e)},getCurrentTextTrackIndex:function(){var e=U.getActiveStreamInfo();if(e&&Z)return Z.getCurrentTrackIdx(e.id)},provideThumbnail:function(e,t){if("function"==typeof t)if(e<0)t(null);else{var n=G.getIsDynamic()?me(e):e,r=U.getStreamForTime(n);if(null!==r){var i=r.getThumbnailController();if(i)return i.provide(n,t);t(null)}else t(null)}},getDashAdapter:function(){return O},getOfflineController:function(){return Oe()},triggerSteeringRequest:function(){if(Y)return Y.loadSteeringData()},getCurrentSteeringResponseData:function(){if(Y)return Y.getCurrentSteeringResponseData()},getSettings:function(){return le.get()},updateSettings:function(e){le.update(e)},resetSettings:function(){le.reset()},reset:fe,destroy:function(){fe(),c.Z.deleteSingletonInstances(se)}},t=ce.getLogger(e),g=!1,m=!1,p=!1,y=!0,E=NaN,A=null,D=null,r=null,O=null,te=null,l.Z.extend(d.Z),M=ii(se).getInstance(),P=(0,dt.Z)(se).getInstance(),J=_i(se).getInstance(),$=$r(se).getInstance(),e}qa.__dashjs_factory_name="MediaPlayer";var Ya=c.Z.getClassFactory(qa);Ya.events=d.Z,Ya.errors=w,c.Z.updateClassFactory(qa.__dashjs_factory_name,Ya);var ja=Ya},8825:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}function a(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}var s=new(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(s,e);var t,n,r=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=o(t);if(n){var i=o(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return a(this,e)});function s(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(e=r.call(this)).AST_IN_FUTURE="astInFuture",e.BASE_URLS_UPDATED="baseUrlsUpdated",e.BUFFER_EMPTY="bufferStalled",e.BUFFER_LOADED="bufferLoaded",e.BUFFER_LEVEL_STATE_CHANGED="bufferStateChanged",e.BUFFER_LEVEL_UPDATED="bufferLevelUpdated",e.DYNAMIC_TO_STATIC="dynamicToStatic",e.ERROR="error",e.FRAGMENT_LOADING_COMPLETED="fragmentLoadingCompleted",e.FRAGMENT_LOADING_PROGRESS="fragmentLoadingProgress",e.FRAGMENT_LOADING_STARTED="fragmentLoadingStarted",e.FRAGMENT_LOADING_ABANDONED="fragmentLoadingAbandoned",e.LOG="log",e.MANIFEST_LOADING_STARTED="manifestLoadingStarted",e.MANIFEST_LOADING_FINISHED="manifestLoadingFinished",e.MANIFEST_LOADED="manifestLoaded",e.METRICS_CHANGED="metricsChanged",e.METRIC_CHANGED="metricChanged",e.METRIC_ADDED="metricAdded",e.METRIC_UPDATED="metricUpdated",e.PERIOD_SWITCH_STARTED="periodSwitchStarted",e.PERIOD_SWITCH_COMPLETED="periodSwitchCompleted",e.QUALITY_CHANGE_REQUESTED="qualityChangeRequested",e.QUALITY_CHANGE_RENDERED="qualityChangeRendered",e.TRACK_CHANGE_RENDERED="trackChangeRendered",e.STREAM_INITIALIZING="streamInitializing",e.STREAM_UPDATED="streamUpdated",e.STREAM_ACTIVATED="streamActivated",e.STREAM_DEACTIVATED="streamDeactivated",e.STREAM_INITIALIZED="streamInitialized",e.STREAM_TEARDOWN_COMPLETE="streamTeardownComplete",e.TEXT_TRACKS_ADDED="allTextTracksAdded",e.TEXT_TRACK_ADDED="textTrackAdded",e.THROUGHPUT_MEASUREMENT_STORED="throughputMeasurementStored",e.TTML_PARSED="ttmlParsed",e.TTML_TO_PARSE="ttmlToParse",e.CAPTION_RENDERED="captionRendered",e.CAPTION_CONTAINER_RESIZE="captionContainerResize",e.CAN_PLAY="canPlay",e.CAN_PLAY_THROUGH="canPlayThrough",e.PLAYBACK_ENDED="playbackEnded",e.PLAYBACK_ERROR="playbackError",e.PLAYBACK_NOT_ALLOWED="playbackNotAllowed",e.PLAYBACK_METADATA_LOADED="playbackMetaDataLoaded",e.PLAYBACK_LOADED_DATA="playbackLoadedData",e.PLAYBACK_PAUSED="playbackPaused",e.PLAYBACK_PLAYING="playbackPlaying",e.PLAYBACK_PROGRESS="playbackProgress",e.PLAYBACK_RATE_CHANGED="playbackRateChanged",e.PLAYBACK_SEEKED="playbackSeeked",e.PLAYBACK_SEEKING="playbackSeeking",e.PLAYBACK_STALLED="playbackStalled",e.PLAYBACK_STARTED="playbackStarted",e.PLAYBACK_TIME_UPDATED="playbackTimeUpdated",e.PLAYBACK_VOLUME_CHANGED="playbackVolumeChanged",e.PLAYBACK_WAITING="playbackWaiting",e.MANIFEST_VALIDITY_CHANGED="manifestValidityChanged",e.EVENT_MODE_ON_START="eventModeOnStart",e.EVENT_MODE_ON_RECEIVE="eventModeOnReceive",e.CONFORMANCE_VIOLATION="conformanceViolation",e.REPRESENTATION_SWITCH="representationSwitch",e.ADAPTATION_SET_REMOVED_NO_CAPABILITIES="adaptationSetRemovedNoCapabilities",e.CONTENT_STEERING_REQUEST_COMPLETED="contentSteeringRequestCompleted",e.INBAND_PRFT="inbandPrft",e.MANAGED_MEDIA_SOURCE_START_STREAMING="managedMediaSourceStartStreaming",e.MANAGED_MEDIA_SOURCE_END_STREAMING="managedMediaSourceEndStreaming",e}return s}(n(8342).Z));t.Z=s},3393:function(e,t){"use strict";function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.init()}var t,r;return t=e,(r=[{key:"init",value:function(){this.STREAM="stream",this.VIDEO="video",this.AUDIO="audio",this.TEXT="text",this.MUXED="muxed",this.IMAGE="image",this.STPP="stpp",this.TTML="ttml",this.VTT="vtt",this.WVTT="wvtt",this.CONTENT_STEERING="contentSteering",this.ABR_STRATEGY_DYNAMIC="abrDynamic",this.ABR_STRATEGY_BOLA="abrBola",this.ABR_STRATEGY_L2A="abrL2A",this.ABR_STRATEGY_LoLP="abrLoLP",this.ABR_STRATEGY_THROUGHPUT="abrThroughput",this.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA="abrFetchThroughputCalculationDownloadedData",this.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING="abrFetchThroughputCalculationMoofParsing",this.ABR_FETCH_THROUGHPUT_CALCULATION_AAST="abrFetchThroughputCalculationAAST",this.LIVE_CATCHUP_MODE_DEFAULT="liveCatchupModeDefault",this.LIVE_CATCHUP_MODE_LOLP="liveCatchupModeLoLP",this.MOVING_AVERAGE_SLIDING_WINDOW="slidingWindow",this.MOVING_AVERAGE_EWMA="ewma",this.BAD_ARGUMENT_ERROR="Invalid Arguments",this.MISSING_CONFIG_ERROR="Missing config parameter(s)",this.TRACK_SWITCH_MODE_ALWAYS_REPLACE="alwaysReplace",this.TRACK_SWITCH_MODE_NEVER_REPLACE="neverReplace",this.TRACK_SELECTION_MODE_FIRST_TRACK="firstTrack",this.TRACK_SELECTION_MODE_HIGHEST_BITRATE="highestBitrate",this.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY="highestEfficiency",this.TRACK_SELECTION_MODE_WIDEST_RANGE="widestRange",this.TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY="highestSelectionPriority",this.CMCD_MODE_QUERY="query",this.CMCD_MODE_HEADER="header",this.INITIALIZE="initialize",this.TEXT_SHOWING="showing",this.TEXT_HIDDEN="hidden",this.CC1="CC1",this.CC3="CC3",this.UTF8="utf-8",this.SCHEME_ID_URI="schemeIdUri",this.START_TIME="starttime",this.SERVICE_DESCRIPTION_DVB_LL_SCHEME="urn:dvb:dash:lowlatency:scope:2019",this.SUPPLEMENTAL_PROPERTY_DVB_LL_SCHEME="urn:dvb:dash:lowlatency:critical:2019",this.XML="XML",this.ARRAY_BUFFER="ArrayBuffer",this.DVB_REPORTING_URL="dvb:reportingUrl",this.DVB_PROBABILITY="dvb:probability",this.VIDEO_ELEMENT_READY_STATES={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4},this.FILE_LOADER_TYPES={FETCH:"fetch_loader",XHR:"xhr_loader"}}}])&&n(t.prototype,r),e}());t.Z=r},3860:function(e,t){"use strict";function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.init()}var t,r;return t=e,(r=[{key:"init",value:function(){this.TCP_CONNECTION="TcpList",this.HTTP_REQUEST="HttpList",this.TRACK_SWITCH="RepSwitchList",this.BUFFER_LEVEL="BufferLevel",this.BUFFER_LOADED="bufferLoaded",this.ABANDON_LOAD="abandonload",this.ALLOW_LOAD="allowload",this.BUFFER_EMPTY="bufferStalled",this.BUFFER_STATE="BufferState",this.DVR_INFO="DVRInfo",this.DROPPED_FRAMES="DroppedFrames",this.SCHEDULING_INFO="SchedulingInfo",this.REQUESTS_QUEUE="RequestsQueue",this.MANIFEST_UPDATE="ManifestUpdate",this.MANIFEST_UPDATE_STREAM_INFO="ManifestUpdatePeriodInfo",this.MANIFEST_UPDATE_TRACK_INFO="ManifestUpdateRepresentationInfo",this.PLAY_LIST="PlayList",this.DVB_ERRORS="DVBErrors",this.HTTP_REQUEST_DVB_REPORTING_TYPE="DVBReporting"}}])&&n(t.prototype,r),e}());t.Z=r},8080:function(e,t,n){"use strict";n.d(t,{default:function(){return V}});var r=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mpdurl=null,this.errorcode=null,this.terror=null,this.url=null,this.ipaddress=null,this.servicelocation=null};r.SSL_CONNECTION_FAILED_PREFIX="SSL",r.DNS_RESOLUTION_FAILED="C00",r.HOST_UNREACHABLE="C01",r.CONNECTION_REFUSED="C02",r.CONNECTION_ERROR="C03",r.CORRUPT_MEDIA_ISOBMFF="M00",r.CORRUPT_MEDIA_OTHER="M01",r.BASE_URL_CHANGED="F00",r.BECAME_REPORTER="S00";var i=r,a=n(1180);function o(e){var t,n,r=(e=e||{}).eventBus,o=e.dashMetrics,s=e.metricsConstants,u=e.events;function l(e){var t=new i;if(n){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.mpdurl||(t.mpdurl=n.originalUrl||n.url),t.terror||(t.terror=new Date),o.addDVBErrors(t)}}function c(e){e.error||(n=e.manifest)}function f(e){l({errorcode:i.BASE_URL_CHANGED,servicelocation:e.entry})}function d(){l({errorcode:i.BECAME_REPORTER})}function g(e){var t;e.metric===s.HTTP_REQUEST&&(0===(t=e.value).responsecode||null==t.responsecode||t.responsecode>=400||t.responsecode<100||t.responsecode>=600)&&l({errorcode:t.responsecode||i.CONNECTION_ERROR,url:t.url,terror:t.tresponse,servicelocation:t._serviceLocation})}function h(e){var t;switch(e.error?e.error.code:0){case MediaError.MEDIA_ERR_NETWORK:t=i.CONNECTION_ERROR;break;case MediaError.MEDIA_ERR_DECODE:t=i.CORRUPT_MEDIA_OTHER;break;default:return}l({errorcode:t})}return t={initialize:function(){r.on(u.MANIFEST_UPDATED,c,t),r.on(u.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,f,t),r.on(u.METRIC_ADDED,g,t),r.on(u.METRIC_UPDATED,g,t),r.on(u.PLAYBACK_ERROR,h,t),r.on(a.Z.BECAME_REPORTING_PLAYER,d,t)},reset:function(){r.off(u.MANIFEST_UPDATED,c,t),r.off(u.SERVICE_LOCATION_BASE_URL_BLACKLIST_CHANGED,f,t),r.off(u.METRIC_ADDED,g,t),r.off(u.METRIC_UPDATED,g,t),r.off(u.PLAYBACK_ERROR,h,t),r.off(a.Z.BECAME_REPORTING_PLAYER,d,t)}}}o.__dashjs_factory_name="DVBErrorsTranslator";var s=dashjs.FactoryMaker.getSingletonFactory(o),u=n(2295);function l(e){e=e||{};var t,n,r=!1,i=this.context,a=e.mediaElement;return t={initialize:function(e){e&&e.length&&(e.forEach((function(e){var t=e.starttime,r=t+e.duration;n.add(t,r)})),r=!!e[0]._useWallClockTime)},reset:function(){n.clear()},isEnabled:function(){var e,t=n.length;if(!t)return!0;e=r?(new Date).getTime()/1e3:a.currentTime;for(var i=0;i<t;i+=1){var o=n.start(i),s=n.end(i);if(o<=e&&e<s)return!0}return!1}},n=(0,u.Z)(i).create(),t}l.__dashjs_factory_name="RangeController";var c=dashjs.FactoryMaker.getClassFactory(l);function f(){return{serialise:function e(t){var n,r,i=[],a=[];for(n in t)if(t.hasOwnProperty(n)&&0!==n.indexOf("_")){if(null==(r=t[n])&&(r=""),Array.isArray(r)){if(!r.length)continue;a=[],r.forEach((function(t){var n="Object"!==Object.prototype.toString.call(t).slice(8,-1);a.push(n?t:e(t))})),r=a.map(encodeURIComponent).join(",")}else"string"==typeof r?r=encodeURIComponent(r):r instanceof Date?r=r.toISOString():"number"==typeof r&&(r=Math.round(r));i.push(n+"="+r)}return i.join("&")}}}f.__dashjs_factory_name="MetricSerialiser";var d=dashjs.FactoryMaker.getSingletonFactory(f);function g(){var e,t,n,r=window.crypto||window.msCrypto,i=Uint32Array,a=Math.pow(2,8*i.BYTES_PER_ELEMENT)-1;function o(){r&&(e||(e=new i(10)),r.getRandomValues(e),t=0)}return n={random:function(n,i){var s;return n||(n=0),i||(i=1),r?(t===e.length&&o(),s=e[t]/a,t+=1):s=Math.random(),s*(i-n)+n}},o(),n}g.__dashjs_factory_name="RNG";var h=dashjs.FactoryMaker.getSingletonFactory(g),p=n(5717);function m(e){var t;e=e||{};var n,r,i,a,o,s,u,l=this.context,c=[],f=e.metricsConstants;function g(){a=!1,o=!1,s=null,u=null}return t={report:function(e,t){Array.isArray(t)||(t=[t]),o&&u.isEnabled()&&t.forEach((function(t){var i=n.serialise(t);e!==f.DVB_ERRORS&&(i="metricname=".concat(e,"&").concat(i)),function(e,t,n){var i=new XMLHttpRequest;i.withCredentials=r.getXHRWithCredentialsForType(f.HTTP_REQUEST_DVB_REPORTING_TYPE);var a=function(){var e=c.indexOf(i);-1!==e&&(c.splice(e,1),!(i.status>=200&&i.status<300)&&(n&&n()))};c.push(i);try{i.open("GET",e),i.onloadend=a,i.onerror=a,i.send()}catch(e){i.onerror()}}(i="".concat(s,"?").concat(i),0,(function(){o=!1}))}))},initialize:function(e,t){var n;if(u=t,!(s=e.dvb_reportingUrl))throw new Error("required parameter missing (dvb:reportingUrl)");a||((n=e.dvb_probability)&&(1e3===n||n/1e3>=i.random())&&(o=!0),a=!0)},reset:function(){g()}},n=d(l).getInstance(),i=h(l).getInstance(),r=(0,p.Z)(l).getInstance(),g(),t}m.__dashjs_factory_name="DVBReporting";var y=dashjs.FactoryMaker.getClassFactory(m);function E(e){e=e||{};var t,n={"urn:dvb:dash:reporting:2014":y},r=this.context,i=e.debug?e.debug.getLogger(t):{},a=e.metricsConstants,o=e.mediaPlayerModel||{};return{create:function(e,t){var s;try{(s=n[e.schemeIdUri](r).create({metricsConstants:a,mediaPlayerModel:o})).initialize(e,t)}catch(t){s=null,i.error("ReportingFactory: could not create Reporting with schemeIdUri ".concat(e.schemeIdUri," (").concat(t.message,")"))}return s},register:function(e,t){n[e]=t},unregister:function(e){delete n[e]}}}E.__dashjs_factory_name="ReportingFactory";var v=dashjs.FactoryMaker.getSingletonFactory(E);function _(e){var t=[],n=v(this.context).getInstance(e);return{initialize:function(e,r){e.some((function(e){var i=n.create(e,r);if(i)return t.push(i),!0}))},reset:function(){t.forEach((function(e){return e.reset()})),t=[]},report:function(e,n){t.forEach((function(t){return t.report(e,n)}))}}}_.__dashjs_factory_name="ReportingController";var T=dashjs.FactoryMaker.getClassFactory(_);function S(){return{reconstructFullMetricName:function(e,t,n){var r=e;return t&&(r+="("+t,n&&n.length&&(r+=","+n),r+=")"),r},validateN:function(e){if(!e)throw new Error("missing n");if(isNaN(e))throw new Error("n is NaN");if(e<0)throw new Error("n must be positive");return e}}}S.__dashjs_factory_name="HandlerHelpers";var b=dashjs.FactoryMaker.getSingletonFactory(S);function A(e){var t,n,r,i,a;e=e||{};var o=this.context,s=b(o).getInstance(),u=[],l=e.metricsConstants;function c(){var e=function(){try{return Object.keys(u).map((function(e){return u[e]})).reduce((function(e,t){return e.level<t.level?e:t}))}catch(e){return}}();e&&a!==e.t&&(a=e.t,t.report(r,e))}return{initialize:function(e,a,o){a&&(n=s.validateN(o),t=a,r=s.reconstructFullMetricName(e,o),i=setInterval(c,n))},reset:function(){clearInterval(i),i=null,n=0,t=null,a=null},handleNewMetric:function(e,t,n){e===l.BUFFER_LEVEL&&(u[n]=t)}}}A.__dashjs_factory_name="BufferLevelHandler";var I=dashjs.FactoryMaker.getClassFactory(A),R=dashjs.FactoryMaker.getClassFactory((function(e){var t,n=(e=e||{}).eventBus,r=e.metricsConstants;function i(){n.off(a.Z.METRICS_INITIALISATION_COMPLETE,i,this),n.trigger(a.Z.BECAME_REPORTING_PLAYER)}return{initialize:function(e,r){r&&(t=r,n.on(a.Z.METRICS_INITIALISATION_COMPLETE,i,this))},reset:function(){t=null},handleNewMetric:function(e,n){e===r.DVB_ERRORS&&t&&t.report(e,n)}}}));function w(e){var t,n,r,i,a;e=e||{};var o=[],s=b(this.context).getInstance(),u=e.metricsConstants;function l(){var e=o;e.length&&t&&t.report(i,e),o=[]}return{initialize:function(e,o,u,c){o&&(n=s.validateN(u),t=o,c&&c.length&&(r=c),i=s.reconstructFullMetricName(e,u,c),a=setInterval(l,n))},reset:function(){clearInterval(a),a=null,n=null,r=null,o=[],t=null},handleNewMetric:function(e,t){e===u.HTTP_REQUEST&&(r&&r!==t.type||o.push(t))}}}w.__dashjs_factory_name="HttpListHandler";var N=dashjs.FactoryMaker.getClassFactory(w);function C(){var e,t;return{initialize:function(n,r){e=n,t=r},reset:function(){t=null,e=void 0},handleNewMetric:function(n,r){n===e&&t&&t.report(e,r)}}}C.__dashjs_factory_name="GenericMetricHandler";var D=dashjs.FactoryMaker.getClassFactory(C);function O(e){var t,n=(e=e||{}).debug?e.debug.getLogger(t):{},r=/([a-zA-Z]*)(\\(([0-9]*)(\\,\\s*([a-zA-Z]*))?\\))?/,i=this.context,a={BufferLevel:I,DVBErrors:R,HttpList:N,PlayList:D,RepSwitchList:D,TcpList:D};return{create:function(t,o){var s,u=t.match(r);if(u){try{(s=a[u[1]](i).create({eventBus:e.eventBus,metricsConstants:e.metricsConstants})).initialize(u[1],o,u[3],u[5])}catch(e){s=null,n.error("MetricsHandlerFactory: Could not create handler for type ".concat(u[1]," with args ").concat(u[3],", ").concat(u[5]," (").concat(e.message,")"))}return s}},register:function(e,t){a[e]=t},unregister:function(e){delete a[e]}}}O.__dashjs_factory_name="MetricsHandlerFactory";var M=dashjs.FactoryMaker.getSingletonFactory(O);function P(e){e=e||{};var t,n=[],r=this.context,i=e.eventBus,a=e.events,o=M(r).getInstance({debug:e.debug,eventBus:e.eventBus,metricsConstants:e.metricsConstants});function s(e){n.forEach((function(t){t.handleNewMetric(e.metric,e.value,e.mediaType)}))}return t={initialize:function(e,r){e.split(",").forEach((function(e,t,i){var a;if(-1!==e.indexOf("(")&&-1===e.indexOf(")")){var s=i[t+1];s&&-1===s.indexOf("(")&&-1!==s.indexOf(")")&&(e+=","+s,delete i[t+1])}(a=o.create(e,r))&&n.push(a)})),i.on(a.METRIC_ADDED,s,t),i.on(a.METRIC_UPDATED,s,t)},reset:function(){i.off(a.METRIC_ADDED,s,t),i.off(a.METRIC_UPDATED,s,t),n.forEach((function(e){return e.reset()})),n=[]}}}P.__dashjs_factory_name="MetricsHandlersController";var L=dashjs.FactoryMaker.getClassFactory(P);function x(e){var t,n,r;e=e||{};var i=this.context;function a(){t&&t.reset(),n&&n.reset(),r&&r.reset()}return{initialize:function(o){try{(r=c(i).create({mediaElement:e.mediaElement})).initialize(o.Range),(n=T(i).create({debug:e.debug,metricsConstants:e.metricsConstants,mediaPlayerModel:e.mediaPlayerModel})).initialize(o.Reporting,r),(t=L(i).create({debug:e.debug,eventBus:e.eventBus,metricsConstants:e.metricsConstants,events:e.events})).initialize(o.metrics,n)}catch(e){throw a(),e}},reset:a}}x.__dashjs_factory_name="MetricsController";var F=dashjs.FactoryMaker.getClassFactory(x),k=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metrics="",this.Range=[],this.Reporting=[]},U=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.starttime=0,this.duration=1/0,this._useWallClockTime=!1},Z=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.schemeIdUri="",this.value="",this.dvb_reportingUrl="",this.dvb_probability=1e3};function B(e){var t=(e=e||{}).adapter,n=e.constants;return{getMetrics:function(e){var r=[];return e&&e.Metrics_asArray&&e.Metrics_asArray.forEach((function(i){var a=new k,o=t.getIsDynamic(e);i.hasOwnProperty("metrics")&&(a.metrics=i.metrics,i.Range_asArray&&i.Range_asArray.forEach((function(r){var i=new U;i.starttime=function(e,r,i){var a,o,s=0;return r?s=t.getAvailabilityStartTime(e)/1e3:(a=t.getRegularPeriods(e)).length&&(s=a[0].start),o=s,i&&i.hasOwnProperty(n.START_TIME)&&(o+=i.starttime),o}(e,o,r),r.hasOwnProperty("duration")?i.duration=r.duration:i.duration=t.getDuration(e),i._useWallClockTime=o,a.Range.push(i)})),i.Reporting_asArray&&(i.Reporting_asArray.forEach((function(e){var t=new Z;e.hasOwnProperty(n.SCHEME_ID_URI)&&(t.schemeIdUri=e.schemeIdUri,e.hasOwnProperty("value")&&(t.value=e.value),e.hasOwnProperty(n.DVB_REPORTING_URL)&&(t.dvb_reportingUrl=e[n.DVB_REPORTING_URL]),e.hasOwnProperty(n.DVB_PROBABILITY)&&(t.dvb_probability=e[n.DVB_PROBABILITY]),a.Reporting.push(t))})),r.push(a)))})),r}}}B.__dashjs_factory_name="ManifestParsing";var G=dashjs.FactoryMaker.getSingletonFactory(B);function q(e){var t;e=e||{};var n={},r=this.context,i=e.eventBus,o=e.events;function s(t){if(!t.error){var o=Object.keys(n);G(r).getInstance({adapter:e.adapter,constants:e.constants}).getMetrics(t.manifest).forEach((function(t){var i=JSON.stringify(t);if(n.hasOwnProperty(i))o.splice(i,1);else try{var a=F(r).create(e);a.initialize(t),n[i]=a}catch(e){}})),o.forEach((function(e){n[e].reset(),delete n[e]})),i.trigger(a.Z.METRICS_INITIALISATION_COMPLETE)}}function u(){Object.keys(n).forEach((function(e){n[e].reset()})),n={}}return t={reset:function(){i.off(o.MANIFEST_UPDATED,s,t),i.off(o.STREAM_TEARDOWN_COMPLETE,u,t)}},i.on(o.MANIFEST_UPDATED,s,t),i.on(o.STREAM_TEARDOWN_COMPLETE,u,t),t}q.__dashjs_factory_name="MetricsCollectionController";var Y=dashjs.FactoryMaker.getClassFactory(q);function j(){var e=this.context;return{createMetricsReporting:function(t){return s(e).getInstance({eventBus:t.eventBus,dashMetrics:t.dashMetrics,metricsConstants:t.metricsConstants,events:t.events}).initialize(),Y(e).create(t)},getReportingFactory:function(){return v(e).getInstance()},getMetricsHandlerFactory:function(){return M(e).getInstance()}}}j.__dashjs_factory_name="MetricsReporting";var H=dashjs.FactoryMaker.getClassFactory(j);H.events=a.Z,dashjs.FactoryMaker.updateClassFactory(j.__dashjs_factory_name,H);var V=H},1180:function(e,t,n){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(e,t)}function a(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function o(e){return o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},o(e)}var s=new(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(s,e);var t,n,r=(t=s,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=o(t);if(n){var i=o(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return a(this,e)});function s(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(e=r.call(this)).METRICS_INITIALISATION_COMPLETE="internal_metricsReportingInitialized",e.BECAME_REPORTING_PLAYER="internal_becameReportingPlayer",e.CMCD_DATA_GENERATED="cmcdDataGenerated",e}return s}(n(8342).Z));t.Z=s},5717:function(e,t,n){"use strict";var r=n(2610),i=n(5448),a=n(1264),o=n(3106),s=n(1767),u=n(3393);function l(){var e,t,n,i,l,c,f,d,g=this.context,h=(0,a.Z)(g).getInstance();function p(){i=[],l=[],c=[],d=[],f=null,t=[]}function m(e,t){var n=-1;e.some((function(e,r){if(e===t)return n=r,!0})),n<0||e.splice(n,1)}function y(e){var t;for(t=0;t<d.length;t++)if(d[t].rulename===e)return t;return-1}function E(e,n){v(e,n);var i=new r.Z;i.schemeIdUri=e,i.value=n,t.push(i)}function v(e,n){(0,o.PS)(e,"string"),(0,o.PS)(n,"string"),t.forEach((function(r,i){r.schemeIdUri===e&&r.value===n&&t.splice(i,1)}))}return e={getCustomInitialTrackSelectionFunction:function(){return f},setCustomInitialTrackSelectionFunction:function(e){f=e},resetCustomInitialTrackSelectionFunction:function(){f=null},getLicenseResponseFilters:function(){return l},getLicenseRequestFilters:function(){return i},getCustomCapabilitiesFilters:function(){return c},registerCustomCapabilitiesFilter:function(e){c.push(e)},registerLicenseResponseFilter:function(e){l.push(e)},registerLicenseRequestFilter:function(e){i.push(e)},unregisterCustomCapabilitiesFilter:function(e){m(c,e)},unregisterLicenseResponseFilter:function(e){m(l,e)},unregisterLicenseRequestFilter:function(e){m(i,e)},addAbrCustomRule:function(e,t,n){if("string"!=typeof e||e!==s.Z.ABANDON_FRAGMENT_RULES&&e!==s.Z.QUALITY_SWITCH_RULES||"string"!=typeof t)throw u.Z.BAD_ARGUMENT_ERROR;var r=y(t);-1===r?d.push({type:e,rulename:t,rule:n}):(d[r].type=e,d[r].rule=n)},removeAllAbrCustomRule:function(){d=[]},removeAbrCustomRule:function(e){if(e){var t=y(e);-1!==t&&d.splice(t,1)}else d=[]},getAbrCustomRules:function(){return d},addUTCTimingSource:E,removeUTCTimingSource:v,getUTCTimingSources:function(){return t},clearDefaultUTCTimingSources:function(){t=[]},restoreDefaultUTCTimingSources:function(){var e=h.get().streaming.utcSynchronization.defaultTimingSource;E(e.scheme,e.value)},setXHRWithCredentialsForType:function e(t,r){t?n[t]=!!r:Object.keys(n).forEach((function(t){e(t,r)}))},getXHRWithCredentialsForType:function(e){var t=n[e];return void 0===t?n.default:t},setConfig:function(){},reset:function(){p()}},n={default:!1},p(),e}l.__dashjs_factory_name="CustomParametersModel",t.Z=i.Z.getSingletonFactory(l)},9032:function(e,t,n){"use strict";var r=n(5448),i=n(7473);function a(e){var t=(e=e||{}).requestModifier;function n(e){var n=new Date,r=e.request,i=new XMLHttpRequest;if(i.open(e.method,e.url,!0),r.responseType&&(i.responseType=r.responseType),r.range&&i.setRequestHeader("Range","bytes="+r.range),r.requestStartDate||(r.requestStartDate=n),t&&t.modifyRequestHeader&&(i=t.modifyRequestHeader(i,{url:e.url})),e.headers)for(var a in e.headers){var o=e.headers[a];o&&i.setRequestHeader(a,o)}i.withCredentials=e.withCredentials,i.onload=e.onload,i.onloadend=e.onend,i.onerror=e.onerror,i.onprogress=e.progress,i.onabort=e.onabort,i.ontimeout=e.ontimeout,i.timeout=e.timeout,i.send(),e.response=i}return{load:function(e){t&&t.modifyRequest?(0,i.k)(e,t).then((function(){return n(e)})):n(e)},abort:function(e){var t=e.response;t.onloadend=t.onerror=t.onprogress=void 0,t.abort()}}}a.__dashjs_factory_name="XHRLoader";var o=r.Z.getClassFactory(a);t.Z=o},1737:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.d(t,{default:function(){return be}});var i={attributes:["Laurl","laurl"],prefixes:["clearkey","dashif"]},a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n;return t=e,n=[{key:"findCencContentProtection",value:function(e){for(var t=null,n=0;n<e.length;++n){var r=e[n];"urn:mpeg:dash:mp4protection:2011"!==r.schemeIdUri.toLowerCase()||"cenc"!==r.value.toLowerCase()&&"cbcs"!==r.value.toLowerCase()||(t=r)}return t}},{key:"getPSSHData",value:function(e){var t=8,n=new DataView(e),r=n.getUint8(t);return t+=20,r>0&&(t+=4+16*n.getUint32(t)),t+=4,e.slice(t)}},{key:"getPSSHForKeySystem",value:function(t,n){var r=e.parsePSSHList(n);return t&&r.hasOwnProperty(t.uuid.toLowerCase())?r[t.uuid.toLowerCase()]:null}},{key:"parseInitDataFromContentProtection",value:function(e,t){return"pssh"in e?(e.pssh.__text=e.pssh.__text.replace(/\\r?\\n|\\r/g,"").replace(/\\s+/g,""),t.decodeArray(e.pssh.__text).buffer):null}},{key:"parsePSSHList",value:function(e){if(null==e)return[];for(var t=new DataView(e.buffer||e),n={},r=0;;){var i,a,o=void 0,s=r;if(r>=t.buffer.byteLength)break;if(i=r+t.getUint32(r),r+=4,1886614376===t.getUint32(r))if(r+=4,0===(a=t.getUint8(r))||1===a){r++,r+=3,o="";var u=void 0,l=void 0;for(u=0;u<4;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=4,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<6;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;r+=6,r+=4,n[o=o.toLowerCase()]=t.buffer.slice(s,i),r=i}else r=i;else r=i}return n}},{key:"getLicenseServerUrlFromMediaInfo",value:function(e,t){try{if(!e||0===e.length)return null;for(var n=0,r=null;n<e.length&&!r;){var a=e[n];if(a&&a.contentProtection&&a.contentProtection.length>0){var o=a.contentProtection.filter((function(e){return e.schemeIdUri&&e.schemeIdUri===t}));if(o&&o.length>0)for(var s=0;s<o.length&&!r;){for(var u=o[s],l=0;l<i.attributes.length&&!r;){for(var c=0,f=i.attributes[l];c<i.prefixes.length&&!r;){var d=i.prefixes[c];u[f]&&u[f].__prefix&&u[f].__prefix===d&&u[f].__text&&(r=u[f].__text),c+=1}l+=1}s+=1}}n+=1}return r}catch(e){return null}}}],null&&0,n&&r(t,n),e}(),o=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.contentType=t,this.robustness=n},s=function e(t,n,r,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.initDataTypes=["cenc"],t&&t.length&&(this.audioCapabilities=t),n&&n.length&&(this.videoCapabilities=n),this.distinctiveIdentifier=r,this.persistentState=i,this.sessionTypes=a};function u(e){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u(e)}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function c(e,t){return!t||"object"!==u(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}var d=new(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=f(t);if(n){var i=f(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return c(this,e)});function i(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(e=r.call(this)).MEDIA_KEYERR_CODE=100,e.MEDIA_KEYERR_UNKNOWN_CODE=101,e.MEDIA_KEYERR_CLIENT_CODE=102,e.MEDIA_KEYERR_SERVICE_CODE=103,e.MEDIA_KEYERR_OUTPUT_CODE=104,e.MEDIA_KEYERR_HARDWARECHANGE_CODE=105,e.MEDIA_KEYERR_DOMAIN_CODE=106,e.MEDIA_KEY_MESSAGE_ERROR_CODE=107,e.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE=108,e.SERVER_CERTIFICATE_UPDATED_ERROR_CODE=109,e.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE=110,e.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE=111,e.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE=112,e.KEY_SESSION_CREATED_ERROR_CODE=113,e.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE=114,e.MEDIA_KEYERR_UNKNOWN_MESSAGE="An unspecified error occurred. This value is used for errors that don\'t match any of the other codes.",e.MEDIA_KEYERR_CLIENT_MESSAGE="The Key System could not be installed or updated.",e.MEDIA_KEYERR_SERVICE_MESSAGE="The message passed into update indicated an error from the license service.",e.MEDIA_KEYERR_OUTPUT_MESSAGE="There is no available output device with the required characteristics for the content protection system.",e.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE="A hardware configuration change caused a content protection error.",e.MEDIA_KEYERR_DOMAIN_MESSAGE="An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain.",e.MEDIA_KEY_MESSAGE_ERROR_MESSAGE="Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!",e.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE="DRM: Empty key message from CDM",e.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE="Error updating server certificate -- ",e.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE="DRM: KeyStatusChange error! -- License has expired",e.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE="DRM: No license server URL specified!",e.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE="DRM: KeySystem Access Denied! -- ",e.KEY_SESSION_CREATED_ERROR_MESSAGE="DRM: unable to create session! --",e.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE="DRM: licenser error! --",e}return i}(n(2230).Z)),g=n(5459),h=function e(t,n,r,i,a,o,s,u){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t,this.method=n,this.responseType=r,this.headers=i,this.withCredentials=a,this.messageType=o,this.sessionId=s,this.data=u},p=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t,this.headers=n,this.data=r},m=n(7855),y=n(703),E=n(3393),v=n(5448);function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function T(e){var t,n,r,i,u,l,c,f,v,T,S,b=(e=e||{}).protectionKeyController,A=e.protectionModel,I=e.eventBus,R=e.events,w=e.debug,N=e.BASE64,C=e.constants,D=[],O=e.cmcdModel,M=e.settings,P=e.customParametersModel;function L(){if(!(I&&I.hasOwnProperty("on")&&b&&b.hasOwnProperty("getSupportedKeySystemsFromContentProtection")))throw new Error("Missing config parameter(s)")}function x(e,t){f||v?f&&F():function(e,t){if(!v){v=!0;var r,i=[];e=e.sort((function(t,n){return(u&&u[t.ks.systemString]&&u[t.ks.systemString].priority>=0?u[t.ks.systemString].priority:e.length)-(u&&u[n.ks.systemString]&&u[n.ks.systemString].priority>=0?u[n.ks.systemString].priority:e.length)}));for(var a=0;a<e.length;a++){var o=Y(e[a]);i.push({ks:e[a].ks,configs:[o],protData:e[a].protData})}A.requestKeySystemAccess(i).then((function(e){var t=(r=e.data).mksa&&r.mksa.selectedSystemString?r.mksa.selectedSystemString:r.keySystem.systemString;return n.info("DRM: KeySystem Access Granted for system string ("+t+")! Selecting key system..."),A.selectKeySystem(r)})).then((function(e){if(f=e,v=!1,A){I.trigger(R.KEY_SYSTEM_SELECTED,{data:r});var t=B(f);t&&t.serverCertificate&&t.serverCertificate.length>0&&A.setServerCertificate(N.decodeArray(t.serverCertificate).buffer),F()}})).catch((function(e){f=null,v=!1,t||I.trigger(R.KEY_SYSTEM_SELECTED,{data:null,error:new g.Z(d.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,d.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+"Error selecting key system! -- "+e.error)})}))}}(e,t)}function F(){for(var e,t=0;t<r.length;t++)for(e=0;e<r[t].length;e++)if(f===r[t][e].ks){k(r[t][e]);break}r=[]}function k(e){if(b.isClearKey(f)&&e.protData&&e.protData.hasOwnProperty("clearkeys")&&0!==Object.keys(e.protData.clearkeys).length){var t={kids:Object.keys(e.protData.clearkeys)};e.initData=(new TextEncoder).encode(JSON.stringify(t))}e.sessionId?U(e):null!==e.initData&&Z(e)}function U(e){L(),A.loadKeySession(e)}function Z(e){var t=a.getPSSHForKeySystem(f,e?e.initData:null);if(t){if(function(e){if(!e)return!1;try{for(var t=A.getSessions(),n=0;n<t.length;n++)if(t[n].getKeyId()===e)return!0;return!1}catch(e){return!1}}(e.keyId))return;if(G(t))return;try{e.initData=t,A.createKeySession(e)}catch(e){I.trigger(R.KEY_SESSION_CREATED,{data:null,error:new g.Z(d.KEY_SESSION_CREATED_ERROR_CODE,d.KEY_SESSION_CREATED_ERROR_MESSAGE+e.message)})}}else e&&e.initData?A.createKeySession(e):I.trigger(R.KEY_SESSION_CREATED,{data:null,error:new g.Z(d.KEY_SESSION_CREATED_ERROR_CODE,d.KEY_SESSION_CREATED_ERROR_MESSAGE+"Selected key system is "+(f?f.systemString:null)+". needkey/encrypted event contains no initData corresponding to that key system!")})}function B(e){if(e){var t=e.systemString;if(u)return t in u?u[t]:null}return null}function G(e){if(!e)return!1;try{for(var t=A.getAllInitData(),r=0;r<t.length;r++)if(b.initDataEquals(e,t[r]))return n.debug("DRM: Ignoring initData because we have already seen it!"),!0;return!1}catch(e){return!1}}function q(e){L(),e?(A.setMediaElement(e),I.on(R.NEED_KEY,J,t)):null===e&&(A.setMediaElement(e),I.off(R.NEED_KEY,J,t))}function Y(e){var t=e.protData,n=[],r=[],a=t&&t.audioRobustness&&t.audioRobustness.length>0?t.audioRobustness:c,u=t&&t.videoRobustness&&t.videoRobustness.length>0?t.videoRobustness:c,l=e.sessionType,f=t&&t.distinctiveIdentifier?t.distinctiveIdentifier:"optional",d=t&&t.persistentState?t.persistentState:"temporary"===l?"optional":"required";return i.forEach((function(e){e.type===C.AUDIO?n.push(new o(e.codec,a)):e.type===C.VIDEO&&r.push(new o(e.codec,u))})),new s(n,r,f,d,[l])}function j(e){e.error?I.trigger(R.KEY_STATUSES_CHANGED,{data:null,error:e.error}):n.debug("DRM: key status = "+e.status)}function H(e){n.debug("DRM: onKeyMessage");var t=e.data;I.trigger(R.KEY_MESSAGE,{data:t});var r=t.messageType?t.messageType:"license-request",o=t.message,s=t.sessionToken,u=B(f),l=b.getLicenseServerModelInstance(f,u,r),c={sessionToken:s,messageType:r};if(o&&0!==o.byteLength){if(!l)return n.debug("DRM: License server request not required for this message (type = "+e.data.messageType+"). Session ID = "+s.getSessionId()),void V(c);if(b.isClearKey(f)){var E=b.processClearKeyLicenseRequest(f,u,o);if(E&&E.keyPairs&&E.keyPairs.length>0)return n.debug("DRM: ClearKey license request handled by application!"),V(c),void A.updateKeySession(s,E)}!function(e,t,n){var r=e.sessionToken,o=e.messageType?e.messageType:"license-request",s={sessionToken:r,messageType:o},u=f?f.systemString:null,l=function(e,t,n,r,o){var s=null,u=r.message;if(e&&e.serverURL){var l=e.serverURL;"string"==typeof l&&""!==l?s=l:"object"===_(l)&&l.hasOwnProperty(t)&&(s=l[t])}else if(e&&e.laURL&&""!==e.laURL)s=e.laURL;else if(!(s=a.getLicenseServerUrlFromMediaInfo(i,f.schemeIdURI))&&!b.isClearKey(f)){var c=a.getPSSHData(n.initData);(s=f.getLicenseServerURLFromInitData(c))||(s=r.laURL)}return s=o.getServerURLFromMessage(s,u,t)}(n,o,r,e,t);if(l){var c={},E=!1;n&&W(c,n.httpRequestHeaders);var v=e.message;W(c,f.getRequestHeadersFromMessage(v)),Object.keys(c).forEach((function(e){"authorization"===e.toLowerCase()&&(E=!0)})),n&&"boolean"==typeof n.withCredentials&&(E=n.withCredentials);var T=function(e){if(A)if(e.status>=200&&e.status<=299){var n=y.Z.parseHttpHeaders(e.getAllResponseHeaders?e.getAllResponseHeaders():null),i=new p(e.responseURL,n,e.response);Q(P.getLicenseResponseFilters(),i).then((function(){var n=t.getLicenseMessage(i.data,u,o);null!==n?(V(s),A.updateKeySession(r,n)):X(e,s,u,o,t)}))}else X(e,s,u,o,t)},S=function(e){V(s,new g.Z(d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+u+\' update, XHR aborted. status is "\'+e.statusText+\'" (\'+e.status+"), readyState is "+e.readyState))},I=function(e){V(s,new g.Z(d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+u+\' update, XHR error. status is "\'+e.statusText+\'" (\'+e.status+"), readyState is "+e.readyState))},R=f.getLicenseRequestFromMessage(v),w=t.getHTTPMethod(o),N=t.getResponseType(u,o),C=n&&!isNaN(n.httpTimeout)?n.httpTimeout:8e3,D=r.getSessionId()||null,O=new h(l,w,N,c,E,o,D,R),L=isNaN(M.get().streaming.retryAttempts[m.w.LICENSE])?3:M.get().streaming.retryAttempts[m.w.LICENSE];Q(P.getLicenseRequestFilters(),O).then((function(){K(O,L,C,T,S,I)}))}else V(s,new g.Z(d.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE,d.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE))}(t,l,u)}else V(c,new g.Z(d.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE,d.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE))}function V(e,t){I.trigger(R.LICENSE_REQUEST_COMPLETE,{data:e,error:t})}function K(e,t,r,i,a,o){var s=new XMLHttpRequest;if(M.get().streaming.cmcd&&M.get().streaming.cmcd.enabled&&M.get().streaming.cmcd.mode===E.Z.CMCD_MODE_QUERY){var u=O.getQueryParameter({url:e.url,type:m.w.LICENSE});u&&(e.url=y.Z.addAditionalQueryParameterToUrl(e.url,[u]))}for(var l in s.open(e.method,e.url,!0),s.responseType=e.responseType,s.withCredentials=e.withCredentials,r>0&&(s.timeout=r),e.headers)s.setRequestHeader(l,e.headers[l]);if(M.get().streaming.cmcd&&M.get().streaming.cmcd.enabled&&M.get().streaming.cmcd.mode===E.Z.CMCD_MODE_HEADER){var c=O.getHeaderParameters({url:e.url,type:m.w.LICENSE});if(c)for(var f in c){var d=c[f];d&&s.setRequestHeader(f,d)}}var g=function(){t--;var n=isNaN(M.get().streaming.retryIntervals[m.w.LICENSE])?1e3:M.get().streaming.retryIntervals[m.w.LICENSE];S=setTimeout((function(){K(e,t,r,i,a,o)}),n)};s.onload=function(){T=null,this.status>=200&&this.status<=299||t<=0?i(this):(n.warn("License request failed ("+this.status+"). Retrying it... Pending retries: "+t),g())},s.ontimeout=s.onerror=function(){T=null,t<=0?o(this):(n.warn("License request network request failed . Retrying it... Pending retries: "+t),g())},s.onabort=function(){a(this)},I.trigger(R.LICENSE_REQUEST_SENDING,{url:e.url,headers:e.headers,payload:e.data,sessionId:e.sessionId}),T=s,s.send(e.data)}function z(){T&&(T.onloadend=T.onerror=T.onprogress=void 0,T.abort(),T=null),S&&(clearTimeout(S),S=null)}function W(e,t){if(t)for(var n in t)e[n]=t[n]}function X(e,t,n,r,i){var a="NONE",o=null;e.response&&(a=i.getErrorResponse(e.response,n,r),o={serverResponse:e.response||null,responseCode:e.status||null,responseText:e.statusText||null}),V(t,new g.Z(d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,d.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+n+\' update, XHR complete. status is "\'+e.statusText+\'" (\'+e.status+"), readyState is "+e.readyState+". Response is "+a,o))}function Q(e,t){return e?e.reduce((function(e,n){return e.then((function(){return n(t)}))}),Promise.resolve()):Promise.resolve()}function J(e,t){if(!M.get().streaming.protection.ignoreEmeEncryptedEvent){if(n.debug("DRM: onNeedKey"),"cenc"!==e.key.initDataType)return void n.warn("DRM: Only \'cenc\' initData is supported! Ignoring initData of type: "+e.key.initDataType);if(0===i.length&&(n.warn("DRM: onNeedKey called before initializeForMedia, wait until initialized"),(t=void 0===t?1:t+1)<5))return void D.push(setTimeout((function(){J(e,t)}),500));var o=e.key.initData;if(ArrayBuffer.isView(o)&&(o=o.buffer),f){var s=a.getPSSHForKeySystem(f,o);if(s&&G(s))return}n.debug("DRM: initData:",String.fromCharCode.apply(null,new Uint8Array(o)));var c=b.getSupportedKeySystemsFromSegmentPssh(o,u,l);if(0===c.length)return void n.debug("DRM: Received needkey event with initData, but we don\'t support any of the key systems!");!function(e){r.push(e),x(e,!1)}(c)}}return t={initializeForMedia:function(e){if(!e)throw new Error("mediaInfo can not be null or undefined");L(),i.push(e)},clearMediaInfoArray:function(){i=[]},handleKeySystemFromManifest:function(){if(i&&0!==i.length){var e=[];i.forEach((function(t){var n=b.getSupportedKeySystemsFromContentProtection(t.contentProtection,u,l);n.length>0&&(0===e.length&&(e=n),r.push(n))})),e&&e.length>0&&x(e,!0)}},createKeySession:Z,loadKeySession:U,removeKeySession:function(e){L(),A.removeKeySession(e)},closeKeySession:function(e){L(),A.closeKeySession(e)},setServerCertificate:function(e){L(),A.setServerCertificate(e)},setMediaElement:q,setSessionType:function(e){l=e},setRobustnessLevel:function(e){c=e},setProtectionData:function(e){u=e,b.setProtectionData(e)},getSupportedKeySystemsFromContentProtection:function(e){return L(),b.getSupportedKeySystemsFromContentProtection(e,u,l)},getKeySystems:function(){return b?b.getKeySystems():[]},setKeySystems:function(e){b&&b.setKeySystems(e)},stop:function(){z(),A&&A.stop()},reset:function(){I.off(R.INTERNAL_KEY_MESSAGE,H,t),I.off(R.INTERNAL_KEY_STATUS_CHANGED,j,t),L(),z(),q(null),f=null,v=!1,A&&(A.reset(),A=null),D.forEach((function(e){return clearTimeout(e)})),D=[],i=[],r=[]}},n=w.getLogger(t),r=[],i=[],l="temporary",c="",T=null,S=null,I.on(R.INTERNAL_KEY_MESSAGE,H,t),I.on(R.INTERNAL_KEY_STATUS_CHANGED,j,t),t}T.__dashjs_factory_name="ProtectionController";var S=v.Z.getClassFactory(T),b=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.keyID=t,this.key=n};function A(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var I=function(){function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n&&"persistent"!==n&&"temporary"!==n)throw new Error("Invalid ClearKey key set type! Must be one of \'persistent\' or \'temporary\'");this.keyPairs=t,this.type=n}var t,n;return t=e,(n=[{key:"toJWK",value:function(){var e,t=this.keyPairs.length,n={keys:[]};for(e=0;e<t;e++){var r={kty:"oct",alg:"A128KW",kid:this.keyPairs[e].keyID,k:this.keyPairs[e].key};n.keys.push(r)}this.type&&(n.type=this.type);var i=JSON.stringify(n),a=i.length,o=new ArrayBuffer(a),s=new Uint8Array(o);for(e=0;e<a;e++)s[e]=i.charCodeAt(e);return o}}])&&A(t.prototype,n),e}();function R(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var w=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.init()}var t,n;return t=e,(n=[{key:"init",value:function(){this.CLEARKEY_KEYSTEM_STRING="org.w3.clearkey",this.WIDEVINE_KEYSTEM_STRING="com.widevine.alpha",this.PLAYREADY_KEYSTEM_STRING="com.microsoft.playready",this.PLAYREADY_RECOMMENDATION_KEYSTEM_STRING="com.microsoft.playready.recommendation",this.INITIALIZATION_DATA_TYPE_CENC="cenc",this.INITIALIZATION_DATA_TYPE_KEYIDS="keyids",this.INITIALIZATION_DATA_TYPE_WEBM="webm"}}])&&R(t.prototype,n),e}()),N="e2719d58-a985-b3c9-781a-b030af78d30e",C=w.CLEARKEY_KEYSTEM_STRING,D="urn:uuid:"+N;function O(e){var t=(e=e||{}).BASE64;return{uuid:N,schemeIdURI:D,systemString:C,getInitData:function(e,n){try{var r=a.parseInitDataFromContentProtection(e,t);if(!r&&n){var i={kids:[function(e){try{var t=e.replace(/-/g,"");return(t=btoa(t.match(/\\w{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""))).replace(/=/g,"").replace(/\\//g,"_").replace(/\\+/g,"-")}catch(e){return null}}(n["cenc:default_KID"])]};r=(new TextEncoder).encode(JSON.stringify(i))}return r}catch(e){return null}},getRequestHeadersFromMessage:function(){return{"Content-Type":"application/json"}},getLicenseRequestFromMessage:function(e){return JSON.stringify(JSON.parse(String.fromCharCode.apply(null,new Uint8Array(e))))},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getClearKeysFromProtectionData:function(e,t){var n=null;if(e){for(var r=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(t))),i=[],a=0;a<r.kids.length;a++){var o=r.kids[a],s=e.clearkeys&&e.clearkeys.hasOwnProperty(o)?e.clearkeys[o]:null;if(!s)throw new Error("DRM: ClearKey keyID ("+o+") is not known!");i.push(new b(o,s))}n=new I(i)}return n}}}O.__dashjs_factory_name="KeySystemClearKey";var M=dashjs.FactoryMaker.getSingletonFactory(O),P="1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",L=w.CLEARKEY_KEYSTEM_STRING,x="urn:uuid:"+P;function F(e){var t,n=e.BASE64,r=e.debug.getLogger(t);return{uuid:P,schemeIdURI:x,systemString:L,getInitData:function(e){return a.parseInitDataFromContentProtection(e,n)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(e){return new Uint8Array(e)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getClearKeysFromProtectionData:function(e,t){var n=null;if(e){for(var i=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(t))),a=[],o=0;o<i.kids.length;o++){var s=i.kids[o],u=e.clearkeys&&e.clearkeys.hasOwnProperty(s)?e.clearkeys[s]:null;if(!u)throw new Error("DRM: ClearKey keyID ("+s+") is not known!");a.push(new b(s,u))}n=new I(a),r.warn("ClearKey schemeIdURI is using W3C Common PSSH systemID (1077efec-c0b2-4d02-ace3-3c1e52e2fb4b) in Content Protection. See DASH-IF IOP v4.1 section 7.6.2.4")}return n}}}F.__dashjs_factory_name="KeySystemW3CClearKey";var k=dashjs.FactoryMaker.getSingletonFactory(F),U="edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",Z=w.WIDEVINE_KEYSTEM_STRING,B="urn:uuid:"+U;function G(e){var t=(e=e||{}).BASE64;return{uuid:U,schemeIdURI:B,systemString:Z,getInitData:function(e){return a.parseInitDataFromContentProtection(e,t)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(e){return new Uint8Array(e)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null}}}G.__dashjs_factory_name="KeySystemWidevine";var q=dashjs.FactoryMaker.getSingletonFactory(G),Y="9a04f079-9840-4286-ab92-e65be0885f95",j=w.PLAYREADY_KEYSTEM_STRING,H="urn:uuid:"+Y;function V(e){var t="utf-16",n=(e=e||{}).BASE64,r=e.settings;function i(){if(!n||!n.hasOwnProperty("decodeArray")||!n.hasOwnProperty("decodeArray"))throw new Error("Missing config parameter(s)")}return{uuid:Y,schemeIdURI:H,systemString:j,getInitData:function(e){var t,r,o,s,u,l=new Uint8Array([112,115,115,104,0,0,0,0]),c=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),f=0,d=null;if(i(),!e)return null;if("pssh"in e)return a.parseInitDataFromContentProtection(e,n);if("pro"in e)d=n.decodeArray(e.pro.__text);else{if(!("prheader"in e))return null;d=n.decodeArray(e.prheader.__text)}return t=d.length,r=4+l.length+c.length+4+t,o=new ArrayBuffer(r),s=new Uint8Array(o),(u=new DataView(o)).setUint32(f,r),f+=4,s.set(l,f),f+=l.length,s.set(c,f),f+=c.length,u.setUint32(f,t),f+=4,s.set(d,f),f+=t,s.buffer},getRequestHeadersFromMessage:function(e){var n,i,a={},o=new DOMParser;if(r&&r.get().streaming.protection.detectPlayreadyMessageFormat&&"utf-16"===t&&e&&e.byteLength%2==1)return a["Content-Type"]="text/xml; charset=utf-8",a;var s="utf-16"===t?new Uint16Array(e):new Uint8Array(e);n=String.fromCharCode.apply(null,s);for(var u=(i=o.parseFromString(n,"application/xml")).getElementsByTagName("name"),l=i.getElementsByTagName("value"),c=0;c<u.length;c++)a[u[c].childNodes[0].nodeValue]=l[c].childNodes[0].nodeValue;return a.hasOwnProperty("Content")&&(a["Content-Type"]=a.Content,delete a.Content),a.hasOwnProperty("Content-Type")||(a["Content-Type"]="text/xml; charset=utf-8"),a},getLicenseRequestFromMessage:function(e){var a=null,o=new DOMParser;if(r&&r.get().streaming.protection.detectPlayreadyMessageFormat&&"utf-16"===t&&e&&e.byteLength%2==1)return e;var s="utf-16"===t?new Uint16Array(e):new Uint8Array(e);i();var u=String.fromCharCode.apply(null,s),l=o.parseFromString(u,"application/xml");if(!l.getElementsByTagName("PlayReadyKeyMessage")[0])return e;var c=l.getElementsByTagName("Challenge")[0].childNodes[0].nodeValue;return c&&(a=n.decode(c)),a},getLicenseServerURLFromInitData:function(e){if(e)for(var t=new DataView(e),n=t.getUint16(4,!0),r=6,i=new DOMParser,a=0;a<n;a++){var o=t.getUint16(r,!0);r+=2;var s=t.getUint16(r,!0);if(r+=2,1===o){var u=e.slice(r,r+s),l=String.fromCharCode.apply(null,new Uint16Array(u)),c=i.parseFromString(l,"application/xml");if(c.getElementsByTagName("LA_URL")[0]){var f=c.getElementsByTagName("LA_URL")[0].childNodes[0].nodeValue;if(f)return f}if(c.getElementsByTagName("LUI_URL")[0]){var d=c.getElementsByTagName("LUI_URL")[0].childNodes[0].nodeValue;if(d)return d}}else r+=s}return null},getCDMData:function(e){var t,r,a,o;if(i(),!e)return null;for(t=[],o=0;o<e.length;++o)t.push(e.charCodeAt(o)),t.push(0);for(t=String.fromCharCode.apply(null,t),t=n.encode(t),r=\'<PlayReadyCDMData type="LicenseAcquisition"><LicenseAcquisition version="1.0" Proactive="false"><CustomData encoding="base64encoded">%CUSTOMDATA%</CustomData></LicenseAcquisition></PlayReadyCDMData>\'.replace("%CUSTOMDATA%",t),a=[],o=0;o<r.length;++o)a.push(r.charCodeAt(o)),a.push(0);return new Uint8Array(a).buffer},setPlayReadyMessageFormat:function(e){if("utf-8"!==e&&"utf-16"!==e)throw new Error(\'Specified message format is not one of "utf-8" or "utf-16"\');t=e}}}V.__dashjs_factory_name="KeySystemPlayReady";var K=dashjs.FactoryMaker.getSingletonFactory(V);function z(e){var t=(e=e||{}).BASE64,n={};return n[w.WIDEVINE_KEYSTEM_STRING]={responseType:"json",getLicenseMessage:function(e){return t.decodeArray(e.license)},getErrorResponse:function(e){return e}},n[w.PLAYREADY_KEYSTEM_STRING]={responseType:"arraybuffer",getLicenseMessage:function(e){return e},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},{getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(e){return n[e].responseType},getLicenseMessage:function(e,r){return function(){if(!t||!t.hasOwnProperty("decodeArray"))throw new Error("Missing config parameter(s)")}(),n[r].getLicenseMessage(e)},getErrorResponse:function(e,t){return n[t].getErrorResponse(e)}}}z.__dashjs_factory_name="DRMToday";var W=dashjs.FactoryMaker.getSingletonFactory(z);function X(){var e="http://schemas.xmlsoap.org/soap/envelope/";function t(e){var t=String.fromCharCode.apply(null,new Uint8Array(e));return decodeURIComponent(escape(t))}function n(n){if(window.DOMParser){var r=t(n),i=(new window.DOMParser).parseFromString(r,"text/xml"),a=i?i.getElementsByTagNameNS(e,"Envelope")[0]:null,o=a?a.getElementsByTagNameNS(e,"Body")[0]:null;if(o&&o.getElementsByTagNameNS(e,"Fault")[0])return null}return n}function r(n){var r="",i="",a="",o=-1,s=-1;if(window.DOMParser){var u=t(n),l=(new window.DOMParser).parseFromString(u,"text/xml"),c=l?l.getElementsByTagNameNS(e,"Envelope")[0]:null,f=c?c.getElementsByTagNameNS(e,"Body")[0]:null,d=f?f.getElementsByTagNameNS(e,"Fault")[0]:null,g=d?d.getElementsByTagName("detail")[0]:null,h=g?g.getElementsByTagName("Exception")[0]:null,p=null;if(null===d)return u;r=(p=d.getElementsByTagName("faultstring")[0].firstChild)?p.nodeValue:null,null!==h&&(i=(p=h.getElementsByTagName("StatusCode")[0])?p.firstChild.nodeValue:null,o=(a=(p=h.getElementsByTagName("Message")[0])?p.firstChild.nodeValue:null)?a.lastIndexOf("[")+1:-1,s=a?a.indexOf("]"):-1,a=a?a.substring(o,s):"")}var m="code: ".concat(i,", name: ").concat(r);return a&&(m+=", message: ".concat(a)),m}return{getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"arraybuffer"},getLicenseMessage:function(e){return n.call(this,e)},getErrorResponse:function(e){return r.call(this,e)}}}X.__dashjs_factory_name="PlayReady";var Q=v.Z.getSingletonFactory(X);function J(){return{getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"arraybuffer"},getLicenseMessage:function(e){return e},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}}}J.__dashjs_factory_name="Widevine";var $=dashjs.FactoryMaker.getSingletonFactory(J);function ee(){return{getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"json"},getLicenseMessage:function(e){if(!e.hasOwnProperty("keys"))return null;for(var t=[],n=0;n<e.keys.length;n++){var r=e.keys[n],i=r.kid.replace(/=/g,""),a=r.k.replace(/=/g,"");t.push(new b(i,a))}return new I(t)},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}}}ee.__dashjs_factory_name="ClearKey";var te=dashjs.FactoryMaker.getSingletonFactory(ee);function ne(){var e,t,n,r,i,o,s,u,l=this.context;function c(e,t){return t&&e in t?t[e]:null}function f(e,t){return e&&e.sessionId?e.sessionId:t&&t.sessionId?t.sessionId:null}function d(e,t){return e&&e.sessionType?e.sessionType:t}return e={initialize:function(){var e;r=[],e=K(l).getInstance({BASE64:i,settings:o}),r.push(e),e=q(l).getInstance({BASE64:i}),r.push(e),e=M(l).getInstance({BASE64:i}),r.push(e),s=e,e=k(l).getInstance({BASE64:i,debug:t}),r.push(e),u=e},setProtectionData:function(e){for(var t,n,i=0;i<r.length;i++){var a=r[i];a.hasOwnProperty("init")&&a.init((t=a.systemString,n=void 0,n=null,e&&(n=t in e?e[t]:null),n))}},isClearKey:function(e){return e===s||e===u},initDataEquals:function(e,t){if(e.byteLength===t.byteLength){for(var n=new Uint8Array(e),r=new Uint8Array(t),i=0;i<n.length;i++)if(n[i]!==r[i])return!1;return!0}return!1},getKeySystems:function(){return r},setKeySystems:function(e){r=e},getKeySystemBySystemString:function(e){for(var t=0;t<r.length;t++)if(r[t].systemString===e)return r[t];return null},getSupportedKeySystemsFromContentProtection:function(e,t,n){var i,o,s,u,l=[];if(e){var g=a.findCencContentProtection(e);for(s=0;s<r.length;++s){var h=c((o=r[s]).systemString,t);for(u=0;u<e.length;++u)if((i=e[u]).schemeIdUri.toLowerCase()===o.schemeIdURI){var p=o.getInitData(i,g);l.push({ks:r[s],keyId:i.keyId,initData:p,protData:h,cdmData:o.getCDMData(h?h.cdmData:null),sessionId:f(h,i),sessionType:d(h,n)})}}}return l},getSupportedKeySystemsFromSegmentPssh:function(e,t,n){for(var i,o=[],s=a.parsePSSHList(e),u=0;u<r.length;++u){var l=c((i=r[u]).systemString,t);i.uuid in s&&o.push({ks:i,initData:s[i.uuid],protData:l,cdmData:i.getCDMData(l?l.cdmData:null),sessionId:f(l),sessionType:d(l,n)})}return o},getLicenseServerModelInstance:function(e,t,n){if("license-release"===n||"individualization-request"===n)return null;var r=null;return t&&t.hasOwnProperty("drmtoday")?r=W(l).getInstance({BASE64:i}):e.systemString===w.WIDEVINE_KEYSTEM_STRING?r=$(l).getInstance():e.systemString===w.PLAYREADY_KEYSTEM_STRING?r=Q(l).getInstance():e.systemString===w.CLEARKEY_KEYSTEM_STRING&&(r=te(l).getInstance()),r},processClearKeyLicenseRequest:function(e,t,r){try{return e.getClearKeysFromProtectionData(t,r)}catch(e){return n.error("Failed to retrieve clearkeys from ProtectionData"),null}},setConfig:function(r){r&&(r.debug&&(t=r.debug,n=t.getLogger(e)),r.BASE64&&(i=r.BASE64),r.settings&&(o=r.settings))}},e}ne.__dashjs_factory_name="ProtectionKeyController";var re=dashjs.FactoryMaker.getSingletonFactory(ne);function ie(e){return ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ie(e)}function ae(e,t){return ae=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},ae(e,t)}function oe(e,t){return!t||"object"!==ie(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");return e}(e):t}function se(e){return se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},se(e)}var ue=new(function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ae(e,t)}(i,e);var t,n,r=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=se(t);if(n){var i=se(this).constructor;e=Reflect.construct(r,arguments,i)}else e=r.apply(this,arguments);return oe(this,e)});function i(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),(e=r.call(this)).INTERNAL_KEY_MESSAGE="internalKeyMessage",e.INTERNAL_KEY_STATUS_CHANGED="internalkeyStatusChanged",e.KEY_ADDED="public_keyAdded",e.KEY_ERROR="public_keyError",e.KEY_MESSAGE="public_keyMessage",e.KEY_SESSION_CLOSED="public_keySessionClosed",e.KEY_SESSION_CREATED="public_keySessionCreated",e.KEY_SESSION_REMOVED="public_keySessionRemoved",e.KEY_STATUSES_CHANGED="public_keyStatusesChanged",e.KEY_SYSTEM_ACCESS_COMPLETE="public_keySystemAccessComplete",e.KEY_SYSTEM_SELECTED="public_keySystemSelected",e.LICENSE_REQUEST_COMPLETE="public_licenseRequestComplete",e.LICENSE_REQUEST_SENDING="public_licenseRequestSending",e.NEED_KEY="needkey",e.PROTECTION_CREATED="public_protectioncreated",e.PROTECTION_DESTROYED="public_protectiondestroyed",e.SERVER_CERTIFICATE_UPDATED="serverCertificateUpdated",e.TEARDOWN_COMPLETE="protectionTeardownComplete",e.VIDEO_ELEMENT_SELECTED="videoElementSelected",e.KEY_SESSION_UPDATED="public_keySessionUpdated",e}return i}(n(8342).Z)),le=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.initData=t,this.initDataType=n},ce=function e(t,n,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sessionToken=t,this.message=n,this.defaultURL=r,this.messageType=i||"license-request"},fe=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.keySystem=t,this.ksConfiguration=n},de={};function ge(e){e=e||{};var t,n,r,i,a,o,s,u,l=this.context,c=e.eventBus,f=e.events,h=e.debug;function p(e,t,n,r){if(void 0===navigator.requestMediaKeySystemAccess||"function"!=typeof navigator.requestMediaKeySystemAccess){var i="Insecure origins are not allowed";return c.trigger(f.KEY_SYSTEM_ACCESS_COMPLETE,{error:i}),void r({error:i})}var a=e[t].protData&&e[t].protData.systemStringPriority?e[t].protData.systemStringPriority:null,o=e[t].configs,s=e[t].ks,u=s.systemString;(function(e,t){return new Promise((function(n,r){m(e,t,0,n,r)}))})(a||(de[u]?de[u]:[u]),o).then((function(e){var t="function"==typeof e.getConfiguration?e.getConfiguration():null,r=new fe(s,t);r.mksa=e,c.trigger(f.KEY_SYSTEM_ACCESS_COMPLETE,{data:r}),n({data:r})})).catch((function(i){if(t+1<e.length)p(e,t+1,n,r);else{var a="Key system access denied! ";c.trigger(f.KEY_SYSTEM_ACCESS_COMPLETE,{error:a+i.message}),r({error:a+i.message})}}))}function m(e,t,r,i,a){var o=e[r];n.debug("Requesting key system access for system string ".concat(o)),navigator.requestMediaKeySystemAccess(o,t).then((function(e){e.selectedSystemString=o,i(e)})).catch((function(n){r+1<e.length?m(e,t,r+1,i,a):a(n)}))}function y(e){if(!e||!e.session)return Promise.resolve;var t=e.session;return t.removeEventListener("keystatuseschange",e),t.removeEventListener("message",e),t.close()}function E(e){for(var t=0;t<o.length;t++)if(o[t]===e){o.splice(t,1);break}}function v(e){var t,n;return e&&e.length>0&&(e[0]&&("string"==typeof e[0]?t=e[0]:n=e[0]),e[1]&&("string"==typeof e[1]?t=e[1]:n=e[1])),{status:t,keyId:n}}function _(e,t){var r={session:e,keyId:t.keyId,initData:t.initData,sessionId:t.sessionId,sessionType:t.sessionType,handleEvent:function(e){switch(e.type){case"keystatuseschange":c.trigger(f.KEY_STATUSES_CHANGED,{data:this}),e.target.keyStatuses.forEach((function(){var e=v(arguments);"expired"===e.status?c.trigger(f.INTERNAL_KEY_STATUS_CHANGED,{error:new g.Z(d.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE,d.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE)}):c.trigger(f.INTERNAL_KEY_STATUS_CHANGED,e)}));break;case"message":var t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;c.trigger(f.INTERNAL_KEY_MESSAGE,{data:new ce(this,t,void 0,e.messageType)})}},getKeyId:function(){return this.keyId},getSessionId:function(){return e.sessionId},getSessionType:function(){return this.sessionType},getExpirationTime:function(){return e.expiration},getKeyStatuses:function(){return e.keyStatuses},getUsable:function(){var t=!1;return e.keyStatuses.forEach((function(){var e=v(arguments);"usable"===e.status&&(t=!0)})),t}};return e.addEventListener("keystatuseschange",r),e.addEventListener("message",r),e.closed.then((function(){E(r),n.debug("DRM: Session closed. SessionID = "+r.getSessionId()),c.trigger(f.KEY_SESSION_CLOSED,{data:r.getSessionId()})})),o.push(r),r}return t={getAllInitData:function(){for(var e=[],t=0;t<o.length;t++)o[t].initData&&e.push(o[t].initData);return e},getSessions:function(){return o},requestKeySystemAccess:function(e){return new Promise((function(t,n){p(e,0,t,n)}))},selectKeySystem:function(e){return new Promise((function(t,n){e.mksa.createMediaKeys().then((function(t){return r=e.keySystem,a=t,i?i.setMediaKeys(a):Promise.resolve()})).then((function(){t(r)})).catch((function(){n({error:"Error selecting keys system ("+e.keySystem.systemString+")! Could not create MediaKeys -- TODO"})}))}))},setMediaElement:function(e){i!==e&&(i&&(i.removeEventListener("encrypted",s),i.setMediaKeys&&i.setMediaKeys(null)),(i=e)&&(i.addEventListener("encrypted",s),i.setMediaKeys&&a&&i.setMediaKeys(a)))},setServerCertificate:function(e){if(!r||!a)throw new Error("Can not set server certificate until you have selected a key system");a.setServerCertificate(e).then((function(){n.info("DRM: License server certificate successfully updated."),c.trigger(f.SERVER_CERTIFICATE_UPDATED)})).catch((function(e){c.trigger(f.SERVER_CERTIFICATE_UPDATED,{error:new g.Z(d.SERVER_CERTIFICATE_UPDATED_ERROR_CODE,d.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE+e.name)})}))},createKeySession:function(e){if(!r||!a)throw new Error("Can not create sessions until you have selected a key system");var t=a.createSession(e.sessionType),i=_(t,e),o=r.systemString===w.CLEARKEY_KEYSTEM_STRING&&(e.initData||e.protData&&e.protData.clearkeys)?w.INITIALIZATION_DATA_TYPE_KEYIDS:w.INITIALIZATION_DATA_TYPE_CENC;t.generateRequest(o,e.initData).then((function(){n.debug("DRM: Session created. SessionID = "+i.getSessionId()),c.trigger(f.KEY_SESSION_CREATED,{data:i})})).catch((function(e){E(i),c.trigger(f.KEY_SESSION_CREATED,{data:null,error:new g.Z(d.KEY_SESSION_CREATED_ERROR_CODE,d.KEY_SESSION_CREATED_ERROR_MESSAGE+"Error generating key request -- "+e.name)})}))},updateKeySession:function(e,t){var n=e.session;u.isClearKey(r)&&(t=t.toJWK()),n.update(t).then((function(){c.trigger(f.KEY_SESSION_UPDATED)})).catch((function(t){c.trigger(f.KEY_ERROR,{error:new g.Z(d.MEDIA_KEYERR_CODE,"Error sending update() message! "+t.name,e)})}))},loadKeySession:function(e){if(!r||!a)throw new Error("Can not load sessions until you have selected a key system");for(var t=e.sessionId,i=0;i<o.length;i++)if(t===o[i].sessionId)return void n.warn("DRM: Ignoring session ID because we have already seen it!");var s=a.createSession(e.sessionType),u=_(s,e);s.load(t).then((function(e){e?(n.debug("DRM: Session loaded. SessionID = "+u.getSessionId()),c.trigger(f.KEY_SESSION_CREATED,{data:u})):(E(u),c.trigger(f.KEY_SESSION_CREATED,{data:null,error:new g.Z(d.KEY_SESSION_CREATED_ERROR_CODE,d.KEY_SESSION_CREATED_ERROR_MESSAGE+"Could not load session! Invalid Session ID ("+t+")")}))})).catch((function(e){E(u),c.trigger(f.KEY_SESSION_CREATED,{data:null,error:new g.Z(d.KEY_SESSION_CREATED_ERROR_CODE,d.KEY_SESSION_CREATED_ERROR_MESSAGE+"Could not load session ("+t+")! "+e.name)})}))},removeKeySession:function(e){e.session.remove().then((function(){n.debug("DRM: Session removed. SessionID = "+e.getSessionId()),c.trigger(f.KEY_SESSION_REMOVED,{data:e.getSessionId()})}),(function(t){c.trigger(f.KEY_SESSION_REMOVED,{data:null,error:"Error removing session ("+e.getSessionId()+"). "+t.name})}))},closeKeySession:function(e){y(e).catch((function(t){E(e),c.trigger(f.KEY_SESSION_CLOSED,{data:null,error:"Error closing session ("+e.getSessionId()+") "+t.name})}))},stop:function(){for(var e,t=0;t<o.length;t++)(e=o[t]).getUsable()||(y(e),E(e))},reset:function(){var e,t=o.length;0!==t?function(){for(var n=function(e){E(e),0===o.length&&(i?(i.removeEventListener("encrypted",s),i.setMediaKeys(null).then((function(){c.trigger(f.TEARDOWN_COMPLETE)}))):c.trigger(f.TEARDOWN_COMPLETE))},r=0;r<t;r++)!function(t){y(e),n(t)}(e=o[r])}():c.trigger(f.TEARDOWN_COMPLETE)}},n=h.getLogger(t),r=null,i=null,a=null,o=[],u=re(l).getInstance(),s={handleEvent:function(e){if("encrypted"===e.type&&e.initData){var t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;c.trigger(f.NEED_KEY,{key:new le(t,e.initDataType)})}}},t}de[w.PLAYREADY_KEYSTEM_STRING]=[w.PLAYREADY_KEYSTEM_STRING,w.PLAYREADY_RECOMMENDATION_KEYSTEM_STRING],de[w.WIDEVINE_KEYSTEM_STRING]=[w.WIDEVINE_KEYSTEM_STRING],de[w.CLEARKEY_KEYSTEM_STRING]=[w.CLEARKEY_KEYSTEM_STRING],ge.__dashjs_factory_name="ProtectionModel_21Jan2015";var he=dashjs.FactoryMaker.getClassFactory(ge);function pe(e){e=e||{};var t,n,r,i,a,o,u,l,c,f=this.context,h=e.eventBus,p=e.events,m=e.debug,y=e.api;function E(){try{for(var e=0;e<u.length;e++)v(u[e]);r&&r.removeEventListener(y.needkey,l),h.trigger(p.TEARDOWN_COMPLETE)}catch(e){h.trigger(p.TEARDOWN_COMPLETE,{error:"Error tearing down key sessions and MediaKeys! -- "+e.message})}}function v(e){var t=e.session;t.removeEventListener(y.error,e),t.removeEventListener(y.message,e),t.removeEventListener(y.ready,e),t.removeEventListener(y.close,e);for(var n=0;n<u.length;n++)if(u[n]===e){u.splice(n,1);break}t[y.release]()}function _(){var e=null,t=function(){r.removeEventListener("loadedmetadata",e),r[y.setMediaKeys](a),h.trigger(p.VIDEO_ELEMENT_SELECTED)};r.readyState>=1?t():(e=t.bind(this),r.addEventListener("loadedmetadata",e))}return t={getAllInitData:function(){for(var e=[],t=0;t<u.length;t++)e.push(u[t].initData);return e},getSessions:function(){return u},requestKeySystemAccess:function(e){return new Promise((function(t,n){for(var r=!1,i=0;i<e.length;i++)for(var a=e[i].ks.systemString,o=e[i].configs,u=null,l=null,f=0;f<o.length;f++){var d=o[f].audioCapabilities,g=o[f].videoCapabilities;if(d&&0!==d.length){u=[];for(var m=0;m<d.length;m++)window[y.MediaKeys].isTypeSupported(a,d[m].contentType)&&u.push(d[m])}if(g&&0!==g.length){l=[];for(var E=0;E<g.length;E++)window[y.MediaKeys].isTypeSupported(a,g[E].contentType)&&l.push(g[E])}if(!(!u&&!l||u&&0===u.length||l&&0===l.length)){r=!0;var v=new s(u,l),_=c.getKeySystemBySystemString(a),T=new fe(_,v);h.trigger(p.KEY_SYSTEM_ACCESS_COMPLETE,{data:T}),t({data:T});break}}if(!r){var S="Key system access denied! -- No valid audio/video content configurations detected!";h.trigger(p.KEY_SYSTEM_ACCESS_COMPLETE,{error:S}),n({error:S})}}))},selectKeySystem:function(e){return new Promise((function(t,n){try{a=e.mediaKeys=new window[y.MediaKeys](e.keySystem.systemString),i=e.keySystem,o=e,r&&_(),t(i)}catch(e){n({error:"Error selecting keys system ("+i.systemString+")! Could not create MediaKeys -- TODO"})}}))},setMediaElement:function(e){r!==e&&(r&&r.removeEventListener(y.needkey,l),(r=e)&&(r.addEventListener(y.needkey,l),a&&_()))},createKeySession:function(e){if(!i||!a||!o)throw new Error("Can not create sessions until you have selected a key system");var t=null;if(o.ksConfiguration.videoCapabilities&&o.ksConfiguration.videoCapabilities.length>0&&(t=o.ksConfiguration.videoCapabilities[0]),null===t&&o.ksConfiguration.audioCapabilities&&o.ksConfiguration.audioCapabilities.length>0&&(t=o.ksConfiguration.audioCapabilities[0]),null===t)throw new Error("Can not create sessions for unknown content types.");var r=t.contentType,s=a.createSession(r,new Uint8Array(e.initData),e.cdmData?new Uint8Array(e.cdmData):null),l=function(e,t){return{session:e,keyId:t.keyId,initData:t.initData,getKeyId:function(){return this.keyId},getSessionId:function(){return this.session.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"},handleEvent:function(e){switch(e.type){case y.error:h.trigger(p.KEY_ERROR,{error:new g.Z(d.MEDIA_KEYERR_CODE,"KeyError",this)});break;case y.message:var t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;h.trigger(p.INTERNAL_KEY_MESSAGE,{data:new ce(this,t,e.destinationURL)});break;case y.ready:n.debug("DRM: Key added."),h.trigger(p.KEY_ADDED);break;case y.close:n.debug("DRM: Session closed. SessionID = "+this.getSessionId()),h.trigger(p.KEY_SESSION_CLOSED,{data:this.getSessionId()})}}}}(s,e);s.addEventListener(y.error,l),s.addEventListener(y.message,l),s.addEventListener(y.ready,l),s.addEventListener(y.close,l),u.push(l),n.debug("DRM: Session created. SessionID = "+l.getSessionId()),h.trigger(p.KEY_SESSION_CREATED,{data:l})},updateKeySession:function(e,t){var n=e.session;c.isClearKey(i)?n.update(new Uint8Array(t.toJWK())):n.update(new Uint8Array(t)),h.trigger(p.KEY_SESSION_UPDATED)},closeKeySession:v,setServerCertificate:function(){},loadKeySession:function(){},removeKeySession:function(){},stop:E,reset:E},n=m.getLogger(t),r=null,i=null,a=null,o=null,u=[],c=re(f).getInstance(),l={handleEvent:function(e){if(e.type===y.needkey&&e.initData){var t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;h.trigger(p.NEED_KEY,{key:new le(t,"cenc")})}}},t}pe.__dashjs_factory_name="ProtectionModel_3Feb2014";var me=dashjs.FactoryMaker.getClassFactory(pe);function ye(e){e=e||{};var t,n,r,i,a,o,u,l,c,f=this.context,h=e.eventBus,p=e.events,m=e.debug,y=e.api,E=e.errHandler;function v(){r&&S();for(var e=0;e<u.length;e++)_(u[e]);h.trigger(p.TEARDOWN_COMPLETE)}function _(e){try{r[y.cancelKeyRequest](i.systemString,e.sessionId)}catch(t){h.trigger(p.KEY_SESSION_CLOSED,{data:null,error:"Error closing session ("+e.sessionId+") "+t.message})}}function T(e,t){if(t&&e){for(var n=e.length,r=0;r<n;r++)if(e[r].sessionId==t)return e[r];return null}return null}function S(){r.removeEventListener(y.keyerror,c),r.removeEventListener(y.needkey,c),r.removeEventListener(y.keymessage,c),r.removeEventListener(y.keyadded,c)}return t={getAllInitData:function(){for(var e=[],t=0;t<o.length;t++)e.push(o[t].initData);for(var n=0;n<u.length;n++)e.push(u[n].initData);return e},getSessions:function(){return u.concat(o)},requestKeySystemAccess:function(e){return new Promise((function(t,n){var i=r;i||(i=document.createElement("video"));for(var o=!1,u=0;u<e.length;u++)for(var l=e[u].ks.systemString,c=e[u].configs,f=null,d=0;d<c.length;d++){var g=c[d].videoCapabilities;if(g&&0!==g.length){f=[];for(var m=0;m<g.length;m++)""!==i.canPlayType(g[m].contentType,l)&&f.push(g[m])}if(f&&(!f||0!==f.length)){o=!0;var y=new s(null,f),E=a.getKeySystemBySystemString(l),v=new fe(E,y);h.trigger(p.KEY_SYSTEM_ACCESS_COMPLETE,{data:v}),t({data:v});break}}if(!o){var _="Key system access denied! -- No valid audio/video content configurations detected!";h.trigger(p.KEY_SYSTEM_ACCESS_COMPLETE,{error:_}),n({error:_})}}))},selectKeySystem:function(e){return i=e.keySystem,Promise.resolve(i)},setMediaElement:function(e){if(r!==e){if(r){S();for(var t=0;t<u.length;t++)_(u[t]);u=[]}(r=e)&&(r.addEventListener(y.keyerror,c),r.addEventListener(y.needkey,c),r.addEventListener(y.keymessage,c),r.addEventListener(y.keyadded,c),h.trigger(p.VIDEO_ELEMENT_SELECTED))}},createKeySession:function(e){if(!i)throw new Error("Can not create sessions until you have selected a key system");if(l||0===u.length){var t={sessionId:null,keyId:e.keyId,initData:e.initData,getKeyId:function(){return this.keyId},getSessionId:function(){return this.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"}};return o.push(t),r[y.generateKeyRequest](i.systemString,new Uint8Array(e.initData)),t}throw new Error("Multiple sessions not allowed!")},updateKeySession:function(e,t){var n=e.sessionId;if(a.isClearKey(i))for(var o=0;o<t.keyPairs.length;o++)r[y.addKey](i.systemString,t.keyPairs[o].key,t.keyPairs[o].keyID,n);else r[y.addKey](i.systemString,new Uint8Array(t),new Uint8Array(e.initData),n);h.trigger(p.KEY_SESSION_UPDATED)},closeKeySession:_,setServerCertificate:function(){},loadKeySession:function(){},removeKeySession:function(){},stop:v,reset:v},n=m.getLogger(t),r=null,i=null,o=[],u=[],a=re(f).getInstance(),c={handleEvent:function(e){var t=null;switch(e.type){case y.needkey:var r=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;h.trigger(p.NEED_KEY,{key:new le(r,"cenc")});break;case y.keyerror:if((t=T(u,e.sessionId))||(t=T(o,e.sessionId)),t){var i=d.MEDIA_KEYERR_CODE,a="";switch(e.errorCode.code){case 1:i=d.MEDIA_KEYERR_UNKNOWN_CODE,a+="MEDIA_KEYERR_UNKNOWN - "+d.MEDIA_KEYERR_UNKNOWN_MESSAGE;break;case 2:i=d.MEDIA_KEYERR_CLIENT_CODE,a+="MEDIA_KEYERR_CLIENT - "+d.MEDIA_KEYERR_CLIENT_MESSAGE;break;case 3:i=d.MEDIA_KEYERR_SERVICE_CODE,a+="MEDIA_KEYERR_SERVICE - "+d.MEDIA_KEYERR_SERVICE_MESSAGE;break;case 4:i=d.MEDIA_KEYERR_OUTPUT_CODE,a+="MEDIA_KEYERR_OUTPUT - "+d.MEDIA_KEYERR_OUTPUT_MESSAGE;break;case 5:i=d.MEDIA_KEYERR_HARDWARECHANGE_CODE,a+="MEDIA_KEYERR_HARDWARECHANGE - "+d.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE;break;case 6:i=d.MEDIA_KEYERR_DOMAIN_CODE,a+="MEDIA_KEYERR_DOMAIN - "+d.MEDIA_KEYERR_DOMAIN_MESSAGE}a+=" System Code = "+e.systemCode,h.trigger(p.KEY_ERROR,{error:new g.Z(i,a,t)})}else n.error("No session token found for key error");break;case y.keyadded:(t=T(u,e.sessionId))||(t=T(o,e.sessionId)),t?(n.debug("DRM: Key added."),h.trigger(p.KEY_ADDED,{data:t})):n.debug("No session token found for key added");break;case y.keymessage:if((l=null!==e.sessionId&&void 0!==e.sessionId)?!(t=T(u,e.sessionId))&&o.length>0&&(t=o.shift(),u.push(t),t.sessionId=e.sessionId,h.trigger(p.KEY_SESSION_CREATED,{data:t})):o.length>0&&(t=o.shift(),u.push(t),0!==o.length&&E.error(new g.Z(d.MEDIA_KEY_MESSAGE_ERROR_CODE,d.MEDIA_KEY_MESSAGE_ERROR_MESSAGE))),t){var s=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;t.keyMessage=s,h.trigger(p.INTERNAL_KEY_MESSAGE,{data:new ce(t,s,e.defaultURL)})}else n.warn("No session token found for key message")}}},t}ye.__dashjs_factory_name="ProtectionModel_01b";var Ee=dashjs.FactoryMaker.getClassFactory(ye),ve=[{generateKeyRequest:"generateKeyRequest",addKey:"addKey",cancelKeyRequest:"cancelKeyRequest",needkey:"needkey",keyerror:"keyerror",keyadded:"keyadded",keymessage:"keymessage"},{generateKeyRequest:"webkitGenerateKeyRequest",addKey:"webkitAddKey",cancelKeyRequest:"webkitCancelKeyRequest",needkey:"webkitneedkey",keyerror:"webkitkeyerror",keyadded:"webkitkeyadded",keymessage:"webkitkeymessage"}],_e=[{setMediaKeys:"setMediaKeys",MediaKeys:"MediaKeys",release:"close",needkey:"needkey",error:"keyerror",message:"keymessage",ready:"keyadded",close:"keyclose"},{setMediaKeys:"msSetMediaKeys",MediaKeys:"MSMediaKeys",release:"close",needkey:"msneedkey",error:"mskeyerror",message:"mskeymessage",ready:"mskeyadded",close:"mskeyclose"}];function Te(){var e,t=this.context;function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];if("function"==typeof e[r[Object.keys(r)[0]]])return r}return null}return e={createProtectionSystem:function(r){var i=null,a=re(t).getInstance();a.setConfig({debug:r.debug,BASE64:r.BASE64,settings:r.settings}),a.initialize();var o=function(r){var i=r.debug,a=i.getLogger(e),o=r.eventBus,s=r.errHandler,u=r.videoModel?r.videoModel.getElement():null;return u&&void 0===u.onencrypted||u&&void 0===u.mediaKeys?n(u,_e)?(a.info("EME detected on this user agent! (ProtectionModel_3Feb2014)"),me(t).create({debug:i,eventBus:o,events:r.events,api:n(u,_e)})):n(u,ve)?(a.info("EME detected on this user agent! (ProtectionModel_01b)"),Ee(t).create({debug:i,eventBus:o,errHandler:s,events:r.events,api:n(u,ve)})):(a.warn("No supported version of EME detected on this user agent! - Attempts to play encrypted content will fail!"),null):(a.info("EME detected on this user agent! (ProtectionModel_21Jan2015)"),he(t).create({debug:i,eventBus:o,events:r.events}))}(r);return!i&&o&&(i=S(t).create({protectionModel:o,protectionKeyController:a,eventBus:r.eventBus,debug:r.debug,events:r.events,BASE64:r.BASE64,constants:r.constants,cmcdModel:r.cmcdModel,customParametersModel:r.customParametersModel,settings:r.settings}),r.capabilities.setEncryptedMediaSupported(!0)),i}}}Te.__dashjs_factory_name="Protection";var Se=dashjs.FactoryMaker.getClassFactory(Te);Se.events=ue,Se.errors=d,dashjs.FactoryMaker.updateClassFactory(Te.__dashjs_factory_name,Se);var be=Se},2068:function(e,t,n){"use strict";var r=n(5448),i={DEFAULT:.5,STRONG:1,WEAK:0};function a(e,t,n){var r,a;return r=void 0===e?-1:e,a=function(e){var t=i.DEFAULT;return e!==i.DEFAULT&&e!==i.STRONG&&e!==i.WEAK||(t=e),t}(n),{quality:r,reason:void 0===t?null:t,priority:a}}a.__dashjs_factory_name="SwitchRequest";var o=r.Z.getClassFactory(a);o.NO_CHANGE=-1,o.PRIORITY=i,r.Z.updateClassFactory(a.__dashjs_factory_name,o),t.Z=o},1767:function(e,t,n){"use strict";var r=n(5628),i=n(6535),a=n(7423),o=n(895),s=n(6070),u=n(3112),l=n(1914),c=n(5435),f=n(5448),d=n(2068),g=n(3393),h="qualitySwitchRules",p="abandonFragmentRules";function m(e){e=e||{};var t,n,f=this.context,m=e.mediaPlayerModel,y=e.customParametersModel,E=e.dashMetrics,v=e.settings;function _(e){return e.filter((function(e){return e.quality>d.Z.NO_CHANGE}))}function T(e){var t,n,r,i,a,o={},s=null;if(0!==e.length){for(o[d.Z.PRIORITY.STRONG]={quality:d.Z.NO_CHANGE,reason:null},o[d.Z.PRIORITY.WEAK]={quality:d.Z.NO_CHANGE,reason:null},o[d.Z.PRIORITY.DEFAULT]={quality:d.Z.NO_CHANGE,reason:null},t=0,n=e.length;t<n;t+=1)(r=e[t]).quality!==d.Z.NO_CHANGE&&(o[r.priority].quality===d.Z.NO_CHANGE||o[r.priority].quality>r.quality)&&(o[r.priority].quality=r.quality,o[r.priority].reason=r.reason||null);return o[d.Z.PRIORITY.WEAK].quality!==d.Z.NO_CHANGE&&(s=o[d.Z.PRIORITY.WEAK]),o[d.Z.PRIORITY.DEFAULT].quality!==d.Z.NO_CHANGE&&(s=o[d.Z.PRIORITY.DEFAULT]),o[d.Z.PRIORITY.STRONG].quality!==d.Z.NO_CHANGE&&(s=o[d.Z.PRIORITY.STRONG]),s&&(i=s.quality,a=s.reason),(0,d.Z)(f).create(i,a)}}return{initialize:function(){t=[],n=[],v.get().streaming.abr.useDefaultABRRules&&(v.get().streaming.abr.ABRStrategy===g.Z.ABR_STRATEGY_L2A?t.push((0,l.Z)(f).create({dashMetrics:E,settings:v})):v.get().streaming.abr.ABRStrategy===g.Z.ABR_STRATEGY_LoLP?t.push((0,c.Z)(f).create({dashMetrics:E})):(t.push((0,u.Z)(f).create({dashMetrics:E,mediaPlayerModel:m,settings:v})),t.push((0,r.Z)(f).create({dashMetrics:E})),v.get().streaming.abr.additionalAbrRules.insufficientBufferRule&&t.push((0,i.Z)(f).create({dashMetrics:E,settings:v})),v.get().streaming.abr.additionalAbrRules.switchHistoryRule&&t.push((0,s.Z)(f).create()),v.get().streaming.abr.additionalAbrRules.droppedFramesRule&&t.push((0,o.Z)(f).create()),v.get().streaming.abr.additionalAbrRules.abandonRequestsRule&&n.push((0,a.Z)(f).create({dashMetrics:E,mediaPlayerModel:m,settings:v})))),y.getAbrCustomRules().forEach((function(e){e.type===h&&t.push(e.rule(f).create()),e.type===p&&n.push(e.rule(f).create())}))},reset:function(){[t,n].forEach((function(e){e&&e.length&&e.forEach((function(e){return e.reset&&e.reset()}))})),t=[],n=[]},getMaxQuality:function(e){return T(_(t.map((function(t){return t.getMaxIndex(e)}))))||(0,d.Z)(f).create()},getMinSwitchRequest:T,shouldAbandonFragment:function(e,t){var r=T(_(n.map((function(n){return n.shouldAbandon(e,t)}))));return r&&(r.reason.forceAbandon=!0),r||(0,d.Z)(f).create()},getQualitySwitchRules:function(){return t}}}m.__dashjs_factory_name="ABRRulesCollection";var y=f.Z.getClassFactory(m);y.QUALITY_SWITCH_RULES=h,y.ABANDON_FRAGMENT_RULES=p,f.Z.updateSingletonFactory(m.__dashjs_factory_name,y),t.Z=y},7423:function(e,t,n){"use strict";var r=n(2068),i=n(5448),a=n(6398);function o(e){e=e||{};var t,n,i,s,u,l=this.context,c=e.mediaPlayerModel,f=e.dashMetrics,d=e.settings;function g(){i={},s={},u=[]}return t={shouldAbandon:function(e){var t=(0,r.Z)(l).create(r.Z.NO_CHANGE,{name:o.__dashjs_factory_name});if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getCurrentRequest")&&e.hasOwnProperty("getRepresentationInfo")&&e.hasOwnProperty("getAbrController")))return t;var a,g,h=e.getMediaInfo(),p=e.getMediaType(),m=e.getStreamInfo(),y=m?m.id:null,E=e.getCurrentRequest();if(!isNaN(E.index)){a=p,g=E.index,i[a]=i[a]||{},i[a][g]=i[a][g]||{};var v=c.getStableBufferTime();if(f.getCurrentBufferLevel(p)>v)return t;var _=i[p][E.index];if(null===_||null===E.firstByteDate||s.hasOwnProperty(_.id))return t;if(void 0===_.firstByteTime&&(u[p]=[],_.firstByteTime=E.firstByteDate.getTime(),_.segmentDuration=E.duration,_.bytesTotal=E.bytesTotal,_.id=E.index),_.bytesLoaded=E.bytesLoaded,_.elapsedTime=(new Date).getTime()-_.firstByteTime,_.bytesLoaded>0&&_.elapsedTime>0&&function(e,t){u[e]=u[e]||[],u[e].push(t)}(p,Math.round(8*_.bytesLoaded/_.elapsedTime)),u[p].length>=d.get().streaming.abr.abrRulesParameters.abandonRequestsRule.minLengthToAverage&&_.elapsedTime>d.get().streaming.abr.abrRulesParameters.abandonRequestsRule.graceTimeThreshold&&_.bytesLoaded<_.bytesTotal){var T=u[p].reduce((function(e,t){return e+t}),0);if(_.measuredBandwidthInKbps=Math.round(T/u[p].length),_.estimatedTimeOfDownload=+(8*_.bytesTotal/_.measuredBandwidthInKbps/1e3).toFixed(2),_.estimatedTimeOfDownload<_.segmentDuration*d.get().streaming.abr.abrRulesParameters.abandonRequestsRule.abandonMultiplier||0===e.getRepresentationInfo().quality)return t;if(!s.hasOwnProperty(_.id)){var S=e.getAbrController(),b=_.bytesTotal-_.bytesLoaded,A=S.getBitrateList(h),I=S.getQualityForBitrate(h,_.measuredBandwidthInKbps*d.get().streaming.abr.bandwidthSafetyFactor,y),R=S.getMinAllowedIndexFor(p,y),w=void 0!==R?Math.max(R,I):I;b>_.bytesTotal*A[w].bitrate/A[S.getQualityFor(p,y)].bitrate&&(t.quality=w,t.reason.throughput=_.measuredBandwidthInKbps,t.reason.fragmentID=_.id,t.reason.rule=this.getClassName(),s[_.id]=_,n.debug("["+p+"] frag id",_.id," is asking to abandon and switch to quality to ",w," measured bandwidth was",_.measuredBandwidthInKbps),delete i[p][_.id])}}else _.bytesLoaded===_.bytesTotal&&delete i[p][_.id]}return t},reset:g},n=(0,a.Z)(l).getInstance().getLogger(t),g(),t}o.__dashjs_factory_name="AbandonRequestsRule",t.Z=i.Z.getClassFactory(o)},3112:function(e,t,n){"use strict";var r=n(3860),i=n(2068),a=n(5448),o=n(7855),s=n(5595),u=n(8512),l=n(6398),c=n(8825),f=n(3393),d=10;function g(e){e=e||{};var t,n,a,g=this.context,h=e.dashMetrics,p=e.mediaPlayerModel,m=(0,s.Z)(g).getInstance();function y(e,t,n){var r=n.reduce((function(e,t,r){return t>n[e]?r:e}),0);if(0===r)return null;var i=Math.max(e,d+2*t.length),a=(n[r]-1)/(i/d-1);return{gp:a,Vp:d/a}}function E(e){e.placeholderBuffer=0,e.mostAdvancedSegmentStart=NaN,e.lastSegmentWasReplacement=!1,e.lastSegmentStart=NaN,e.lastSegmentDurationS=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN}function v(e,t){var n=p.getStableBufferTime();if(e.stableBufferTime!==n){var r=y(n,e.bitrates,e.utilities);if(r.Vp!==e.Vp||r.gp!==e.gp){var i=h.getCurrentBufferLevel(t),a=i+e.placeholderBuffer;a-=d,a*=r.Vp/e.Vp,a+=d,e.stableBufferTime=n,e.Vp=r.Vp,e.gp=r.gp,e.placeholderBuffer=Math.max(0,a-i)}}}function _(e,t){return e.Vp*(e.utilities[t]+e.gp)}function T(e,t){for(var n=e.bitrates[t],r=e.utilities[t],i=0,a=t-1;a>=0;--a)if(e.utilities[a]<e.utilities[t]){var o=e.bitrates[a],s=e.utilities[a],u=e.Vp*(e.gp+(n*s-o*r)/(n-o));i=Math.max(i,u)}return i}function S(e){var t=e.mediaType===f.Z.AUDIO?[f.Z.AUDIO]:a;for(var n in t)a.hasOwnProperty(n)&&2===a[n].state&&(a[n].placeholderBuffer=0)}function b(){for(var e in a)if(a.hasOwnProperty(e)){var t=a[e];0!==t.state&&(t.state=1,E(t))}}function A(e){if(e&&e.chunk&&e.chunk.mediaInfo){var t=a[e.chunk.mediaInfo.type];if(t&&0!==t.state){var n=e.chunk.start;isNaN(t.mostAdvancedSegmentStart)||n>t.mostAdvancedSegmentStart?(t.mostAdvancedSegmentStart=n,t.lastSegmentWasReplacement=!1):t.lastSegmentWasReplacement=!0,t.lastSegmentStart=n,t.lastSegmentDurationS=e.chunk.duration,t.lastQuality=e.chunk.quality,R(t,e.chunk.mediaInfo.type)}}}function I(e){if(e&&e.metric===r.Z.HTTP_REQUEST&&e.value&&e.value.type===o.w.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){var t=a[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),R(t,e.mediaType))}}function R(e,t){if(!isNaN(e.lastSegmentStart)&&!isNaN(e.lastSegmentRequestTimeMs)&&!isNaN(e.placeholderBuffer)){if(e.placeholderBuffer*=.99,!isNaN(e.lastSegmentFinishTimeMs)){var n=h.getCurrentBufferLevel(t)+.001*(e.lastSegmentFinishTimeMs-e.lastSegmentRequestTimeMs),r=_(e,e.lastQuality),i=Math.max(0,r-n);e.placeholderBuffer=Math.min(i,e.placeholderBuffer)}e.lastSegmentWasReplacement&&!isNaN(e.lastSegmentDurationS)&&(e.placeholderBuffer+=e.lastSegmentDurationS),e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN}}function w(e){if(e){var t=a[e.mediaType];t&&0!==t.state&&(t.abrQuality=e.newQuality)}}function N(e){if(e){var t=a[e.mediaType];if(t&&0!==t.state){var n,r=h.getCurrentBufferLevel(e.mediaType);n=t.abrQuality>0?T(t,t.abrQuality):d;var i=Math.max(0,n-r);t.placeholderBuffer=Math.min(t.placeholderBuffer,i)}}}function C(){a={}}return t={getMaxIndex:function(e){var t=(0,i.Z)(g).create();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getScheduleController")&&e.hasOwnProperty("getStreamInfo")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("useBufferOccupancyABR")))return t;var r=e.getMediaInfo(),o=e.getMediaType(),s=e.getScheduleController(),u=e.getStreamInfo(),l=e.getAbrController(),c=l.getThroughputHistory(),f=u?u.id:null,d=u&&u.manifestInfo&&u.manifestInfo.isDynamic,m=e.useBufferOccupancyABR();if(t.reason=t.reason||{},!m)return t;s.setTimeToLoadDelay(0);var S=function(e){var t=e.getMediaType(),n=a[t];return n?0!==n.state&&v(n,t):(n=function(e){var t={},n=e.getMediaInfo().bitrateList.map((function(e){return e.bandwidth})),r=function(e){return e.map((function(e){return Math.log(e)}))}(n);r=r.map((function(e){return e-r[0]+1}));var i=p.getStableBufferTime(),a=y(i,n,r);return a?(t.state=1,t.bitrates=n,t.utilities=r,t.stableBufferTime=i,t.Vp=a.Vp,t.gp=a.gp,t.lastQuality=0,E(t)):t.state=0,t}(e),a[t]=n),n}(e);if(0===S.state)return t;var b,A=h.getCurrentBufferLevel(o),I=c.getAverageThroughput(o,d),R=c.getSafeAverageThroughput(o,d),w=c.getAverageLatency(o);if(t.reason.state=S.state,t.reason.throughput=I,t.reason.latency=w,isNaN(I))return t;switch(S.state){case 1:b=l.getQualityForBitrate(r,R,f,w),t.quality=b,t.reason.throughput=R,S.placeholderBuffer=Math.max(0,T(S,b)-A),S.lastQuality=b,!isNaN(S.lastSegmentDurationS)&&A>=S.lastSegmentDurationS&&(S.state=2);break;case 2:!function(e,t){var n=Date.now();if(isNaN(e.lastSegmentFinishTimeMs)){if(!isNaN(e.lastCallTimeMs)){var r=.001*(n-e.lastCallTimeMs);e.placeholderBuffer+=Math.max(0,r)}}else{var i=.001*(n-e.lastSegmentFinishTimeMs);e.placeholderBuffer+=Math.max(0,i)}e.lastCallTimeMs=n,e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN,v(e,t)}(S,o),b=function(e,t){for(var n=e.bitrates.length,r=NaN,i=NaN,a=0;a<n;++a){var o=(e.Vp*(e.utilities[a]+e.gp)-t)/e.bitrates[a];(isNaN(i)||o>=i)&&(i=o,r=a)}return r}(S,A+S.placeholderBuffer);var N=l.getQualityForBitrate(r,R,f,w);b>S.lastQuality&&b>N&&(b=Math.max(N,S.lastQuality));var C=Math.max(0,A+S.placeholderBuffer-_(S,b));C<=S.placeholderBuffer?(S.placeholderBuffer-=C,C=0):(C-=S.placeholderBuffer,S.placeholderBuffer=0,b<l.getMaxAllowedIndexFor(o,f)?s.setTimeToLoadDelay(1e3*C):C=0),t.quality=b,t.reason.throughput=I,t.reason.latency=w,t.reason.bufferLevel=A,t.reason.placeholderBuffer=S.placeholderBuffer,t.reason.delay=C,S.lastQuality=b;break;default:n.debug("BOLA ABR rule invoked in bad state."),t.quality=l.getQualityForBitrate(r,R,f,w),t.reason.state=S.state,t.reason.throughput=R,t.reason.latency=w,S.state=1,E(S)}return t},reset:function(){C(),m.off(c.Z.BUFFER_EMPTY,S,t),m.off(c.Z.PLAYBACK_SEEKING,b,t),m.off(c.Z.METRIC_ADDED,I,t),m.off(c.Z.QUALITY_CHANGE_REQUESTED,w,t),m.off(c.Z.FRAGMENT_LOADING_ABANDONED,N,t),m.off(u.Z.MEDIA_FRAGMENT_LOADED,A,t)}},n=(0,l.Z)(g).getInstance().getLogger(t),C(),m.on(c.Z.BUFFER_EMPTY,S,t),m.on(c.Z.PLAYBACK_SEEKING,b,t),m.on(c.Z.METRIC_ADDED,I,t),m.on(c.Z.QUALITY_CHANGE_REQUESTED,w,t),m.on(c.Z.FRAGMENT_LOADING_ABANDONED,N,t),m.on(u.Z.MEDIA_FRAGMENT_LOADED,A,t),t}g.__dashjs_factory_name="BolaRule",t.Z=a.Z.getClassFactory(g)},895:function(e,t,n){"use strict";var r=n(5448),i=n(2068),a=n(6398);function o(){var e,t,n=this.context;return e={getMaxIndex:function(e){var r=(0,i.Z)(n).create();if(!e||!e.hasOwnProperty("getDroppedFramesHistory"))return r;var a=e.getDroppedFramesHistory(),o=e.getStreamInfo().id;if(a){var s=a.getFrameHistory(o);if(!s||0===s.length)return r;for(var u=0,l=0,c=i.Z.NO_CHANGE,f=1;f<s.length;f++)if(s[f]&&(u=s[f].droppedVideoFrames,(l=s[f].totalVideoFrames)>375&&u/l>.15)){c=f-1,t.debug("index: "+c+" Dropped Frames: "+u+" Total Frames: "+l);break}return(0,i.Z)(n).create(c,{droppedFrames:u})}return r}},t=(0,a.Z)(n).getInstance().getLogger(e),e}o.__dashjs_factory_name="DroppedFramesRule",t.Z=r.Z.getClassFactory(o)},6535:function(e,t,n){"use strict";var r=n(5595),i=n(8512),a=n(5448),o=n(6398),s=n(2068),u=n(3393),l=n(3860),c=n(8825);function f(e){e=e||{};var t,n,a,f=this.context,d=(0,r.Z)(f).getInstance(),g=e.dashMetrics;function h(){(a={})[u.Z.VIDEO]={ignoreCount:2},a[u.Z.AUDIO]={ignoreCount:2}}function p(){h()}function m(e){isNaN(e.startTime)||e.mediaType!==u.Z.AUDIO&&e.mediaType!==u.Z.VIDEO||a[e.mediaType].ignoreCount>0&&a[e.mediaType].ignoreCount--}return t={getMaxIndex:function(e){var t=(0,s.Z)(f).create();if(!e||!e.hasOwnProperty("getMediaType"))return t;!function(){if(!g||!g.hasOwnProperty("getCurrentBufferLevel")||!g.hasOwnProperty("getCurrentBufferState"))throw new Error(u.Z.MISSING_CONFIG_ERROR)}();var r=e.getMediaType(),i=g.getCurrentBufferState(r),o=e.getRepresentationInfo().fragmentDuration,c=e.getStreamInfo(),d=c?c.id:null,h=e.getScheduleController(),p=c&&c.manifestInfo&&c.manifestInfo.isDynamic;if(function(e,t){return!e&&a[t].ignoreCount>0}(h.getPlaybackController().getLowLatencyModeEnabled(),r)||!o)return t;if(i&&i.state===l.Z.BUFFER_EMPTY)n.debug("["+r+"] Switch to index 0; buffer is empty."),t.quality=0,t.reason="InsufficientBufferRule: Buffer is empty";else{var m=e.getMediaInfo(),y=e.getAbrController(),E=y.getThroughputHistory(),v=g.getCurrentBufferLevel(r),_=E.getAverageThroughput(r,p),T=E.getAverageLatency(r),S=_*(v/o)*.5;t.quality=y.getQualityForBitrate(m,S,d,T),t.reason="InsufficientBufferRule: being conservative to avoid immediate rebuffering"}return t},reset:function(){h(),d.off(c.Z.PLAYBACK_SEEKING,p,t),d.off(i.Z.BYTES_APPENDED_END_FRAGMENT,m,t)}},n=(0,o.Z)(f).getInstance().getLogger(t),h(),d.on(c.Z.PLAYBACK_SEEKING,p,t),d.on(i.Z.BYTES_APPENDED_END_FRAGMENT,m,t),t}f.__dashjs_factory_name="InsufficientBufferRule",t.Z=a.Z.getClassFactory(f)},1914:function(e,t,n){"use strict";var r=n(3860),i=n(2068),a=n(5448),o=n(7855),s=n(5595),u=n(8512),l=n(6398),c=n(3393);function f(e){e=e||{};var t,n,a,f,d=this.context,g=e.dashMetrics,h=(0,s.Z)(d).getInstance();function p(e){e.placeholderBuffer=0,e.mostAdvancedSegmentStart=NaN,e.lastSegmentWasReplacement=!1,e.lastSegmentStart=NaN,e.lastSegmentDurationS=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN,e.lastSegmentUrl=""}function m(){for(var e in n)if(n.hasOwnProperty(e)){var t=n[e];0!==t.state&&(t.state=1,p(t))}}function y(e){if(e&&e.chunk&&e.chunk.mediaInfo){var t=n[e.chunk.mediaInfo.type],r=a[e.chunk.mediaInfo.type];if(t&&0!==t.state){var i=e.chunk.start;isNaN(t.mostAdvancedSegmentStart)||i>t.mostAdvancedSegmentStart?(t.mostAdvancedSegmentStart=i,t.lastSegmentWasReplacement=!1):t.lastSegmentWasReplacement=!0,t.lastSegmentStart=i,t.lastSegmentDurationS=e.chunk.duration,t.lastQuality=e.chunk.quality,v(t,r)}}}function E(e){if(e&&e.metric===r.Z.HTTP_REQUEST&&e.value&&e.value.type===o.w.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){var t=n[e.mediaType],i=a[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),v(t,i))}}function v(e,t){isNaN(e.lastSegmentStart)||isNaN(e.lastSegmentRequestTimeMs)||(t.segment_request_start_s=.001*e.lastSegmentRequestTimeMs,t.segment_download_finish_s=.001*e.lastSegmentFinishTimeMs,e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN)}function _(e){if(e&&e.mediaType){var t=n[e.mediaType];t&&0!==t.state&&(t.abrQuality=e.newQuality)}}function T(e,t){if(e.length!==t.length)return-1;for(var n=0,r=0;r<e.length;r++)n+=e[r]*t[r];return n}function S(){n={},a={}}return t={getMaxIndex:function(e){var t,r=(0,i.Z)(d).create(),s=Math.pow(4,.99),u=Math.max(Math.pow(4,1),s*Math.sqrt(4)),l=e.getMediaInfo(),h=e.getMediaType(),m=l.bitrateList.map((function(e){return e.bandwidth})),y=m.length,E=e.getScheduleController(),v=e.getStreamInfo(),_=e.getAbrController(),S=_.getThroughputHistory(),b=v&&v.manifestInfo&&v.manifestInfo.isDynamic,A=e.useL2AABR(),I=g.getCurrentBufferLevel(h,!0),R=S.getSafeAverageThroughput(h,b),w=S.getAverageThroughput(h,b),N=S.getAverageLatency(h),C=e.getVideoModel().getPlaybackRate();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getScheduleController")&&e.hasOwnProperty("getStreamInfo")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("useL2AABR")))return r;if(r.reason=r.reason||{},!A||h===c.Z.AUDIO)return r;E.setTimeToLoadDelay(0);var D=function(e){var t=e.getMediaType(),r=n[t];return r||(r=function(e){var t={},n=e.getMediaInfo(),r=n.bitrateList.map((function(e){return e.bandwidth/1e3}));return t.state=1,t.bitrates=r,t.lastQuality=0,function(e){e&&e.type&&(a[e.type]={},a[e.type].w=[],a[e.type].prev_w=[],a[e.type].Q=0,a[e.type].segment_request_start_s=0,a[e.type].segment_download_finish_s=0,a[e.type].B_target=1.5)}(n),p(t),t}(e),n[t]=r),r}(e);if(0===D.state)return r;var O=a[h];if(!O)return r;if(r.reason.state=D.state,r.reason.throughput=w,r.reason.latency=N,isNaN(w))return r;switch(D.state){case 1:if(t=_.getQualityForBitrate(l,R,v.id,N),r.quality=t,r.reason.throughput=R,D.lastQuality=t,!isNaN(D.lastSegmentDurationS)&&I>=O.B_target){D.state=2,O.Q=s;for(var M=0;M<y;++M)M===D.lastQuality?O.prev_w[M]=1:O.prev_w[M]=0}break;case 2:var P=[],L=g.getCurrentHttpRequest(h).trace.reduce((function(e,t){return e+t.d}),0),x=g.getCurrentHttpRequest(h).trace.reduce((function(e,t){return e+t.b[0]}),0),F=Math.round(8*x/L),k=g.getCurrentHttpRequest(h);if(F<1&&(F=1),k.url===D.lastSegmentUrl||k.type===o.w.INIT_SEGMENT_TYPE)t=D.lastQuality;else{for(var U=D.lastSegmentDurationS,Z=1,B=0;B<y;++B)m[B]=m[B]/1e3,C*m[B]>F&&(Z=-1),O.w[B]=O.prev_w[B]+Z*(U/(2*u))*((O.Q+s)*(C*m[B]/F));O.w=function(e){for(var t=e.length,n=!1,r=[],i=0;i<t;++i)r[i]=e[i];for(var a=e.sort((function(e,t){return t-e})),o=0,s=0,u=[],l=0;l<t-1;++l)if((s=((o+=a[l])-1)/(l+1))>=a[l+1]){n=!0;break}n||(s=(o+a[t-1]-1)/t);for(var c=0;c<t;++c)u[c]=Math.max(r[c]-s,0);return u}(O.w);for(var G=0;G<y;++G)P[G]=O.w[G]-O.prev_w[G],O.prev_w[G]=O.w[G];O.Q=Math.max(0,O.Q-U+U*C*((T(m,O.prev_w)+T(m,P))/F));for(var q=[],Y=0;Y<y;++Y)q[Y]=Math.abs(m[Y]-T(O.w,m));(t=q.indexOf(Math.min.apply(Math,q)))>D.lastQuality&&m[D.lastQuality+1]<=F&&(t=D.lastQuality+1),m[t]>=F&&(O.Q=2*Math.max(s,O.Q)),D.lastSegmentUrl=k.url}r.quality=t,r.reason.throughput=w,r.reason.latency=N,r.reason.bufferLevel=I,D.lastQuality=r.quality;break;default:f.debug("L2A ABR rule invoked in bad state."),r.quality=_.getQualityForBitrate(l,R,v.id,N),r.reason.state=D.state,r.reason.throughput=R,r.reason.latency=N,D.state=1,p(D)}return r},reset:function(){S(),h.off(u.Z.PLAYBACK_SEEKING,m,t),h.off(u.Z.MEDIA_FRAGMENT_LOADED,y,t),h.off(u.Z.METRIC_ADDED,E,t),h.off(u.Z.QUALITY_CHANGE_REQUESTED,_,t)}},f=(0,l.Z)(d).getInstance().getLogger(t),S(),h.on(u.Z.PLAYBACK_SEEKING,m,t),h.on(u.Z.MEDIA_FRAGMENT_LOADED,y,t),h.on(u.Z.METRIC_ADDED,E,t),h.on(u.Z.QUALITY_CHANGE_REQUESTED,_,t),t}f.__dashjs_factory_name="L2ARule",t.Z=a.Z.getClassFactory(f)},6070:function(e,t,n){"use strict";var r=n(5448),i=n(6398),a=n(2068);function o(){var e,t,n=this.context;return e={getMaxIndex:function(e){for(var r=e?e.getSwitchHistory():null,i=r?r.getSwitchRequests():[],o=0,s=0,u=0,l=(0,a.Z)(n).create(),c=0;c<i.length;c++)if(void 0!==i[c]&&(o+=i[c].drops,s+=i[c].noDrops,u+=i[c].dropSize,o+s>=6&&o/s>.075)){l.quality=c>0&&i[c].drops>0?c-1:c,l.reason={index:l.quality,drops:o,noDrops:s,dropSize:u},t.debug("Switch history rule index: "+l.quality+" samples: "+(o+s)+" drops: "+o);break}return l}},t=(0,i.Z)(n).getInstance().getLogger(e),e}o.__dashjs_factory_name="SwitchHistoryRule",t.Z=r.Z.getClassFactory(o)},5628:function(e,t,n){"use strict";var r=n(5448),i=n(2068),a=n(3393),o=n(3860);function s(e){e=e||{};var t=this.context,n=e.dashMetrics;return{getMaxIndex:function(e){var r=(0,i.Z)(t).create();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("useBufferOccupancyABR")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("getScheduleController")))return r;!function(){if(!n||!n.hasOwnProperty("getCurrentBufferState"))throw new Error(a.Z.MISSING_CONFIG_ERROR)}();var s=e.getMediaInfo(),u=e.getMediaType(),l=n.getCurrentBufferState(u),c=e.getScheduleController(),f=e.getAbrController(),d=e.getStreamInfo(),g=d?d.id:null,h=d&&d.manifestInfo?d.manifestInfo.isDynamic:null,p=f.getThroughputHistory(),m=p.getSafeAverageThroughput(u,h),y=p.getAverageLatency(u),E=e.useBufferOccupancyABR();return isNaN(m)||!l||E||f.getAbandonmentStateFor(g,u)!==o.Z.ABANDON_LOAD&&(l.state===o.Z.BUFFER_LOADED||h)&&(r.quality=f.getQualityForBitrate(s,m,g,y),c.setTimeToLoadDelay(0),r.reason={throughput:m,latency:y}),r},reset:function(){}}}s.__dashjs_factory_name="ThroughputRule",t.Z=r.Z.getClassFactory(s)},4722:function(e,t,n){"use strict";var r=n(5448),i=n(6398);function a(){var e,t,n,r,a,o,s,u,l,c=this.context;function f(){n=null,r=1,a=100,o=0,s=null,u=null,l="dynamic_weight_selection"}function d(){var e=0;if(n)for(var t=0;t<n.length;t++){var r=n[t];r.state.throughput>e&&(e=r.state.throughput)}return e}function g(e,t,n){var r=e.map((function(e,r){return n[r]*Math.pow(e-t[r],2)})).reduce((function(e,t){return e+t}));return(r<0?-1:1)*Math.sqrt(Math.abs(r))}function h(e,t){return g([e.state.throughput,e.state.latency,e.state.rebuffer,e.state.switch],[t.state.throughput,t.state.latency,t.state.rebuffer,t.state.switch],[1,1,1,1])}function p(e,t,n){for(var r=0;r<t.length;r++){var i=t[r],a=h(i,e);m(i,n,Math.exp(-1*Math.pow(a,2)/(2*Math.pow(.1,2))))}}function m(e,t,n){var r=e.state,i=[.01,.01,.01,.01];r.throughput=r.throughput+(t[0]-r.throughput)*i[0]*n,r.latency=r.latency+(t[1]-r.latency)*i[1]*n,r.rebuffer=r.rebuffer+(t[2]-r.rebuffer)*i[2]*n,r.switch=r.switch+(t[3]-r.switch)*i[3]*n}return e={getNextQuality:function(e,i,c,f,h,m,y){var E=c,v=f,_=i,T=function(e){if(!n){n=[];var t=e.bitrateList,i=[];o=t[0].bandwidth,t.forEach((function(e){i.push(e.bandwidth),e.bandwidth<o&&(o=e.bandwidth)})),l=i.map((function(e){return Math.pow(e,2)})).reduce((function(e,t){return e+t})),r=Math.sqrt(l);for(var a=0;a<t.length;a++){var s={qualityIndex:a,bitrate:t[a].bandwidth,state:{throughput:t[a].bandwidth/r,latency:0,rebuffer:0,switch:0}};n.push(s)}u=function(e){var t=[],n=function(e){for(var t=[],n=0;n<e;n++){var r=[Math.random()*d(),Math.random(),Math.random(),Math.random()];t.push(r)}return t}(Math.pow(e.length,2));t.push(n[0]);for(var r=[1,1,1,1],i=1;i<e.length;i++){for(var a=null,o=null,s=0;s<n.length;s++){for(var u=n[s],l=null,c=0;c<t.length;c++){var f=g(u,t[c],r);(null===l||f<l)&&(l=f)}(null===o||l>o)&&(a=u,o=l)}t.push(a)}for(var h=null,p=null,m=0;m<t.length;m++){for(var y=0,E=0;E<t.length;E++)m!==E&&(y+=g(t[m],t[E],r));(null===h||y>h)&&(h=y,p=m)}var v=[];for(v.push(t[p]),t.splice(p,1);t.length>0;){for(var _=null,T=null,S=0;S<t.length;S++){var b=g(v[0],t[S],r);(null===_||b<_)&&(_=b,T=S)}v.push(t[T]),t.splice(T,1)}return v}(n)}var l;return n}(e),S=i/r;S>1&&(S=d()),c/=a,t.debug("getNextQuality called throughput:".concat(S," latency:").concat(c," bufferSize:").concat(f," currentQualityIndex:").concat(m," playbackRate:").concat(h));var b=T[m],A=b.bitrate*y.getSegmentDuration()/_,I=Math.max(0,A-v);if(v-A<y.getMinBuffer())return t.debug("Buffer is low for bitrate= ".concat(b.bitrate," downloadTime=").concat(A," currentBuffer=").concat(v," rebuffer=").concat(I)),function(e,t){var r=0,i=e;if(n)for(var a=0;a<n.length;a++){var o=n[a];o.bitrate<e.bitrate&&o.bitrate>r&&t>o.bitrate&&(r=o.bitrate,i=o)}return i}(b,_).qualityIndex;switch(l){case"manual_weight_selection":s=[.4,.4,.4,.4];break;case"random_weight_selection":!function(e){s=function(e,t){for(var n=[],r=Math.sqrt(2/e),i=0;i<4;i++)n.push(Math.random()*r);return s=n}(e.length)}(T);break;default:!function(e,t,n,r,i,a,o){s||(s=u[u.length-1]);var l=e.findWeightVector(t,n,r,i,a,o);null!==l&&-1!==l&&(s=l)}(y,T,E,v,I,_,h)}for(var R=null,w=null,N=null,C=0;C<T.length;C++){var D=T[C],O=D.state,M=[O.throughput,O.latency,O.rebuffer,O.switch],P=s.slice(),L=y.getNextBufferWithBitrate(D.bitrate,v,_),x=L<y.getMinBuffer();x&&t.debug("Buffer is low for bitrate=".concat(D.bitrate," downloadTime=").concat(A," currentBuffer=").concat(v," nextBuffer=").concat(L)),(D.bitrate>i-1e4||x)&&D.bitrate!==o&&(P[0]=100);var F=g(M,[S,0,0,0],P);(null===R||F<R)&&(R=F,w=D.qualityIndex,N=D)}var k=Math.abs(b.bitrate-N.bitrate)/r;return p(b,T,[S,c,I,k]),p(N,T,[S,0,0,k]),w},reset:function(){f()}},t=(0,i.Z)(c).getInstance().getLogger(e),f(),e}a.__dashjs_factory_name="LearningAbrController",t.Z=r.Z.getClassFactory(a)},5317:function(e,t,n){"use strict";var r=n(5448),i=n(2298);function a(){var e,t,n,r,a;function o(){t=null,n=null,r=null,a=null}function s(e,t,n,r){var a=new i.Z;return a.type=e,a.weights.bitrateReward=t||1,a.weights.bitrateSwitchPenalty=1,a.weights.rebufferPenalty=n||1e3,a.weights.latencyPenalty=[],a.weights.latencyPenalty.push({threshold:1.1,penalty:.05*r}),a.weights.latencyPenalty.push({threshold:1e8,penalty:.1*n}),a.weights.playbackSpeedPenalty=r||200,a}function u(e,t,n,r,i){i.bitrateWSum+=i.weights.bitrateReward*e,i.lastBitrate&&(i.bitrateSwitchWSum+=i.weights.bitrateSwitchPenalty*Math.abs(e-i.lastBitrate)),i.lastBitrate=e,i.rebufferWSum+=i.weights.rebufferPenalty*t;for(var a=0;a<i.weights.latencyPenalty.length;a++){var o=i.weights.latencyPenalty[a];if(n<=o.threshold){i.latencyWSum+=o.penalty*n;break}}i.playbackSpeedWSum+=i.weights.playbackSpeedPenalty*Math.abs(1-r),i.totalQoe=i.bitrateWSum-i.bitrateSwitchWSum-i.rebufferWSum-i.latencyWSum-i.playbackSpeedWSum}return e={setupPerSegmentQoe:function(e,i,o){t=s("segment",e,i,o),n=e,r=i,a=o},logSegmentMetrics:function(e,n,r,i){t&&u(e,n,r,i,t)},getPerSegmentQoe:function(){return t},calculateSingleUseQoe:function(e,t,i,o){var l=null;return n&&r&&a&&(l=s("segment",n,r,a)),l?(u(e,t,i,o,l),l.totalQoe):0},reset:function(){o()}},o(),e}a.__dashjs_factory_name="LoLpQoeEvaluator",t.Z=r.Z.getClassFactory(a)},5435:function(e,t,n){"use strict";var r=n(6398),i=n(5448),a=n(4722),o=n(5317),s=n(2068),u=n(3860),l=n(6523),c=n(3393);function f(e){var t,n,i,f,d=(e=e||{}).dashMetrics,g=this.context;return n={getMaxIndex:function(e){try{var n=(0,s.Z)(g).create(),r=e.getMediaInfo().type,a=e.getAbrController(),o=e.getStreamInfo(),h=a.getQualityFor(r,o.id),p=e.getMediaInfo(),m=d.getCurrentBufferState(r),y=e.getScheduleController(),E=d.getCurrentBufferLevel(r,!0),v=o&&o.manifestInfo?o.manifestInfo.isDynamic:null,_=y.getPlaybackController(),T=_.getCurrentLiveLatency();if(!e.useLoLPABR()||r===c.Z.AUDIO)return n;T||(T=0);var S=_.getPlaybackRate(),b=a.getThroughputHistory().getSafeAverageThroughput(r,v);if(t.debug("Throughput ".concat(Math.round(b)," kbps")),isNaN(b)||!m)return n;if(a.getAbandonmentStateFor(o.id,r)===u.Z.ABANDON_LOAD)return n;for(var A=p.bitrateList,I=e.getRepresentationInfo().fragmentDuration,R=A[0].bandwidth/1e3,w=A[A.length-1].bandwidth/1e3,N=0;N<A.length;N++){var C=A[N].bandwidth/1e3;C>w?w=C:C<R&&(R=C)}var D=A[h].bandwidth/1e3,O=d.getCurrentHttpRequest(r,!0),M=(O.tresponse.getTime()-O.trequest.getTime())/1e3,P=M>I?M-I:0;f.setupPerSegmentQoe(I,w,R),f.logSegmentMetrics(D,P,T,S);var L=(0,l.Z)(g).create({targetLatency:1.5,bufferMin:.3,segmentDuration:I,qoeEvaluator:f});return n.quality=i.getNextQuality(p,1e3*b,T,E,S,h,L),n.reason={throughput:b,latency:T},n.priority=s.Z.PRIORITY.STRONG,y.setTimeToLoadDelay(0),n.quality!==h&&t.debug("[TgcLearningRule]["+r+"] requesting switch to index: ",n.quality,"Average throughput",Math.round(b),"kbps"),n}catch(e){throw e}},reset:function(){i.reset(),f.reset()}},t=(0,r.Z)(g).getInstance().getLogger(n),i=(0,a.Z)(g).create(),f=(0,o.Z)(g).create(),n}f.__dashjs_factory_name="LoLPRule",t.Z=i.Z.getClassFactory(f)},6523:function(e,t,n){"use strict";var r=n(5448);function i(e){var t,n,r,i,a=e.targetLatency,o=e.bufferMin,s=e.segmentDuration,u=e.qoeEvaluator;function l(){return s}function c(e,t){var n=l();return t>n?e-n:e+n-t}return t={getMinBuffer:function(){return o},getSegmentDuration:l,getNextBufferWithBitrate:function(e,t,n){return c(t,e*s/n)},getNextBuffer:c,findWeightVector:function(e,t,i,l,f,d){var g=null,h=null,p=null,m=Math.abs(t-r);return e.forEach((function(e){n.forEach((function(n){n[0];var r=n[1],l=n[2],y=(n[3],e.bitrate*s/f),E=c(i,y),v=(0===l?10:1/l)*Math.max(1e-5,y-E),_=(0===r?10:1/r)*e.state.latency,T=u.calculateSingleUseQoe(e.bitrate,v,_,d);(null===g||T>g)&&function(e,t,n){return!(e>a+n)&&t>=o}(t,E,m)&&(g=T,h=n,p=e.bitrate)}))})),null===h&&null===p&&(h=-1),r=t,h}},4,n=function e(t,n,r){if(r===n)return t;for(var a=t.length,o=0;o<a;o++)for(var s=t.shift(),u=0;u<i.length;u++)t.push(s.concat(i[u]));return e(t,n,r+1)}((i=[.2,.4,.6,.8,1]).map((function(e){return[e]})),4,1),r=0,t}i.__dashjs_factory_name="LoLpWeightSelector",t.Z=r.Z.getClassFactory(i)},2298:function(e,t){"use strict";t.Z=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.type=null,this.lastBitrate=null,this.weights={},this.weights.bitrateReward=null,this.weights.bitrateSwitchPenalty=null,this.weights.rebufferPenalty=null,this.weights.latencyPenalty=null,this.weights.playbackSpeedPenalty=null,this.bitrateWSum=0,this.bitrateSwitchWSum=0,this.rebufferWSum=0,this.latencyWSum=0,this.playbackSpeedWSum=0,this.totalQoe=0}},7803:function(e,t,n){"use strict";n.d(t,{Y:function(){return g}});var r=n(3393),i=n(1553),a=n(5448),o=n(2128),s=n(2594),u=n(7387),l=n(7417),c=n(9032),f=n(9326),d=n(7802),g=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"];function h(e){var t,n,a,h,p,m,y,E,v=this.context,_=e.adapter,T=e.baseURLController,S=e.streamInfo,b=e.timelineConverter,A=e.debug,I=e.eventBus,R=e.events,w=e.dashConstants,N=(0,s.Z)(v).getInstance();function C(e,t){var r=new o.Z;r.id=e.id,r.bitrate=e.bandwidth,r.width=e.width,r.height=e.height,r.tilesHor=1,r.tilesVert=1,e.essentialProperties&&e.essentialProperties.forEach((function(e){if(g.indexOf(e.schemeIdUri)>=0&&e.value){var t=e.value.split("x");2!==t.length||isNaN(t[0])||isNaN(t[1])||(r.tilesHor=parseInt(t[0],10),r.tilesVert=parseInt(t[1],10))}})),t?m.updateSegmentData(e).then((function(t){!function(e,t,n){var r=[],i=function(e,t){var n,r,i,a,o=[],s=0;for(n=0,r=e.segments.length;n<r;n++)i=e.segments[n],(a=(0,u.TJ)(b,_.getIsDynamic(),t,i.startTime,i.duration,i.timescale,i.media,i.mediaRange,s))&&(o.push(a),a=null,s++);return o}(n,t);t.segments=i,e.segmentDuration=t.segments[0].duration,e.readThumbnail=function(e,n){var i=null;r.some((function(t){if(t.start<=e&&t.end>e)return i=t.url,!0})),i?n(i):t.segments.some((function(i){if(i.mediaStartTime<=e&&i.mediaStartTime+i.duration>e){var a=T.resolve(t.path);return y.load({method:"get",url:a.url,request:{range:i.mediaRange,responseType:"arraybuffer"},onload:function(e){var t=E.getSamplesInfo(e.target.response),a=new Blob([e.target.response.slice(t.sampleList[0].offset,t.sampleList[0].offset+t.sampleList[0].size)],{type:"image/jpeg"}),o=window.URL.createObjectURL(a);r.push({start:i.mediaStartTime,end:i.mediaStartTime+i.duration,url:o}),n&&n(o)}}),!0}}))}}(r,e,t)})):(r.startNumber=e.startNumber,r.segmentDuration=e.segmentDuration,r.timescale=e.timescale,r.templateUrl=function(e){var t=N.isRelative(e.media)?N.resolve(e.media,T.resolve(e.path).url):e.media;return t?(0,u.Aj)(t,e.id):""}(e)),r.tilesHor>0&&r.tilesVert>0&&(r.widthPerTile=r.width/r.tilesHor,r.heightPerTile=r.height/r.tilesVert,n.push(r))}function D(){n=[],h=-1,p=null}return t={getTracks:function(){return n},addTracks:function(){if(S&&_&&(p=_.getMediaInfoForType(S,r.Z.IMAGE))){var e=_.getVoRepresentations(p);e&&e.length>0&&e.forEach((function(e){(e.segmentInfoType===i.Z.SEGMENT_TEMPLATE&&e.segmentDuration>0&&e.media||e.segmentInfoType===i.Z.SEGMENT_TIMELINE)&&C(e),e.segmentInfoType===i.Z.SEGMENT_BASE&&C(e,!0)})),n.length>0&&n.sort((function(e,t){return e.bitrate-t.bitrate}))}},reset:D,setTrackByIndex:function(e){n&&0!==n.length&&(e>=n.length&&(e=n.length-1),h=e)},getCurrentTrack:function(){return h<0?null:n[h]},getCurrentTrackIndex:function(){return h},getThumbnailRequestForTime:function(e){for(var t,r=_.getVoRepresentations(p),i=0;i<r.length;i++)if(n[h].id===r[i].id){t=r[i];break}return a.getSegmentRequestForTime(p,t,e)}},D(),y=(0,c.Z)(v).create({}),E=(0,l.Z)(v).getInstance(),m=(0,d.Z)(v).create({events:R,eventBus:I,streamInfo:S,timelineConverter:b,dashConstants:w,dashMetrics:e.dashMetrics,segmentBaseController:e.segmentBaseController,type:r.Z.IMAGE}),(a=(0,f.Z)(v).create({streamInfo:S,type:r.Z.IMAGE,timelineConverter:b,segmentsController:m,baseURLController:T,debug:A,eventBus:I,events:R,dashConstants:w,urlUtils:N})).initialize(!!_&&_.getIsDynamic()),t}h.__dashjs_factory_name="ThumbnailTracks",t.Z=a.Z.getClassFactory(h)},7417:function(e,t,n){"use strict";var r=n(6398),i=n(8260),a=n(5448),o=n(6934),s=n(9597);function u(){var e,t,n=this.context;function a(e){if(!e)return null;void 0===e.fileStart&&(e.fileStart=0);var t=o.parseBuffer(e),r=(0,i.Z)(n).create();return r.setData(t),r}function u(e,t){return e[t+3]>>>0|e[t+2]<<8>>>0|e[t+1]<<16>>>0|e[t]<<24>>>0}function l(e,t){return String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t])}return t={parse:a,findLastTopIsoBoxCompleted:function(e,t,n){if(void 0===n&&(n=0),!t||n+8>=t.byteLength)return new s.Z(0,!1);for(var r,i=t instanceof ArrayBuffer?new Uint8Array(t):t,a=0;n<i.byteLength;){var o=u(i,n),c=l(i,n+4);if(0===o)break;n+o<=i.byteLength&&(e.indexOf(c)>=0?r=new s.Z(n,!0,o):a=n+o),n+=o}return r||new s.Z(a,!1)},getMediaTimescaleFromMoov:function(e){var t=a(e),n=t?t.getBox("mdhd"):void 0;return n?n.timescale:NaN},getSamplesInfo:function(e){if(!e||0===e.byteLength)return{sampleList:[],lastSequenceNumber:NaN,totalDuration:NaN,numSequences:NaN};var t,n,r,i,o,s,u,l,c,f,d,g,h,p,m,y,E=a(e),v=E.getBoxes("moof"),_=E.getBoxes("mfhd");m=E.getBoxes("moof").length,p=_[_.length-1].sequence_number,n=0,o=[];var T=-1,S=-1;for(f=0;f<v.length;f++){var b=v[f],A=b.getChildBoxes("traf");for(l=0;l<A.length;l++){var I=A[l],R=I.getChildBox("tfhd"),w=I.getChildBox("tfdt");i=w.baseMediaDecodeTime;var N=I.getChildBoxes("trun"),C=I.getChildBoxes("subs");for(c=0;c<N.length;c++){var D=N[c];for(n=D.sample_count,h=(R.base_data_offset||0)+(D.data_offset||0),u=0;u<n;u++){t=void 0!==(s=D.samples[u]).sample_duration?s.sample_duration:R.default_sample_duration,r=void 0!==s.sample_size?s.sample_size:R.default_sample_size;var O={dts:i,cts:i+(void 0!==s.sample_composition_time_offset?s.sample_composition_time_offset:0),duration:t,offset:b.offset+h,size:r,subSizes:[r]};if(C)for(d=0;d<C.length;d++){var M=C[d];if(T<M.entry_count-1&&u>S&&(T++,S+=M.entries[T].sample_delta),u==S){O.subSizes=[];var P=M.entries[T];for(g=0;g<P.subsample_count;g++)O.subSizes.push(P.subsamples[g].subsample_size)}}o.push(O),h+=r,i+=t}}y=i-w.baseMediaDecodeTime}}return{sampleList:o,lastSequenceNumber:p,totalDuration:y,numSequences:m}},findInitRange:function(t){var n=null,r=a(t);if(!r)return n;var i=r.getBox("ftyp"),o=r.getBox("moov");return e.debug("Searching for initialization."),o&&o.isComplete&&(n=(i?i.offset:o.offset)+"-"+(o.offset+o.size-1),e.debug("Found the initialization. Range: "+n)),n},parsePayload:function(e,t,n){if(void 0===n&&(n=0),!t||n+8>=t.byteLength)return new s.Z(0,!1);for(var r,i=t instanceof ArrayBuffer?new Uint8Array(t):t,a=0;n<i.byteLength;){var o=u(i,n),c=l(i,n+4);if(0===o)break;n+o<=i.byteLength&&(e.indexOf(c)>=0?r=new s.Z(n,!0,o,c):a=n+o),n+=o}return r||new s.Z(a,!1)}},e=(0,r.Z)(n).getInstance().getLogger(t),t}u.__dashjs_factory_name="BoxParser",t.Z=a.Z.getSingletonFactory(u)},1715:function(e,t,n){"use strict";n.d(t,{B:function(){return s}});var r=n(5448),i=n(7803),a=n(3393),o=[{codec:"avc1",compatibleCodecs:["avc3"]},{codec:"avc3",compatibleCodecs:["avc1"]}];function s(){var e="ManagedMediaSource"in window,t="WebKitMediaSource"in window,n="MediaSource"in window;return e||t||n}function u(){var e,t,n;return e={setConfig:function(e){e&&e.settings&&(t=e.settings)},supportsMediaSource:s,supportsEncryptedMedia:function(){return n},supportsCodec:function(e,n){return n!==a.Z.AUDIO&&n!==a.Z.VIDEO?Promise.resolve(!0):function(e,n){return t.get().streaming.capabilities.useMediaCapabilitiesApi&&navigator.mediaCapabilities&&navigator.mediaCapabilities.decodingInfo&&(e.codec&&n===a.Z.AUDIO||n===a.Z.VIDEO&&e.codec&&e.width&&e.height&&e.bitrate&&e.framerate)}(e,n)?function(e,t){return new Promise((function(n){if(e&&e.codec){var r={type:"media-source"};r[t]={},r[t].contentType=e.codec,r[t].width=e.width,r[t].height=e.height,r[t].bitrate=parseInt(e.bitrate),r[t].framerate=parseFloat(e.framerate),navigator.mediaCapabilities.decodingInfo(r).then((function(e){n(e.supported)})).catch((function(){n(!1)}))}else n(!1)}))}(e,n):function(e){return new Promise((function(t){if(e&&e.codec){var n=e.codec;e.width&&e.height&&(n+=\';width="\'+e.width+\'";height="\'+e.height+\'"\'),"ManagedMediaSource"in window&&ManagedMediaSource.isTypeSupported(n)||"MediaSource"in window&&MediaSource.isTypeSupported(n)||"WebKitMediaSource"in window&&WebKitMediaSource.isTypeSupported(n)?t(!0):t(!1)}else t(!1)}))}(e)},setEncryptedMediaSupported:function(e){n=e},supportsEssentialProperty:function(e){try{return-1!==i.Y.indexOf(e.schemeIdUri)}catch(e){return!0}},codecRootCompatibleWithCodec:function(e,t){for(var n,r=e.split(".")[0],i=0===t.indexOf(r),a=0;a<o.length;a++)if(o[a].codec===r){n=o[a];break}return n?i||n.compatibleCodecs.some((function(e){return 0===t.indexOf(e)})):i}},n=!1,e}u.__dashjs_factory_name="Capabilities",t.Z=r.Z.getSingletonFactory(u)},2295:function(e,t,n){"use strict";var r=n(5448),i=n(3106);function a(){return{customTimeRangeArray:[],length:0,add:function(e,t){var n;for(n=0;n<this.customTimeRangeArray.length&&e>this.customTimeRangeArray[n].start;n++);for(this.customTimeRangeArray.splice(n,0,{start:e,end:t}),n=0;n<this.customTimeRangeArray.length-1;n++)this.mergeRanges(n,n+1)&&n--;this.length=this.customTimeRangeArray.length},clear:function(){this.customTimeRangeArray=[],this.length=0},remove:function(e,t){for(var n=0;n<this.customTimeRangeArray.length;n++)if(e<=this.customTimeRangeArray[n].start&&t>=this.customTimeRangeArray[n].end)this.customTimeRangeArray.splice(n,1),n--;else{if(e>this.customTimeRangeArray[n].start&&t<this.customTimeRangeArray[n].end){this.customTimeRangeArray.splice(n+1,0,{start:t,end:this.customTimeRangeArray[n].end}),this.customTimeRangeArray[n].end=e;break}e>this.customTimeRangeArray[n].start&&e<this.customTimeRangeArray[n].end?this.customTimeRangeArray[n].end=e:t>this.customTimeRangeArray[n].start&&t<this.customTimeRangeArray[n].end&&(this.customTimeRangeArray[n].start=t)}this.length=this.customTimeRangeArray.length},mergeRanges:function(e,t){var n=this.customTimeRangeArray[e],r=this.customTimeRangeArray[t];return n.start<=r.start&&r.start<=n.end&&n.end<=r.end?(n.end=r.end,this.customTimeRangeArray.splice(t,1),!0):r.start<=n.start&&n.start<=r.end&&r.end<=n.end?(n.start=r.start,this.customTimeRangeArray.splice(t,1),!0):r.start<=n.start&&n.start<=r.end&&n.end<=r.end?(this.customTimeRangeArray.splice(e,1),!0):n.start<=r.start&&r.start<=n.end&&r.end<=n.end&&(this.customTimeRangeArray.splice(t,1),!0)},start:function(e){return(0,i.SE)(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].start},end:function(e){return(0,i.SE)(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].end}}}a.__dashjs_factory_name="CustomTimeRanges",t.Z=r.Z.getClassFactory(a)},5:function(e,t,n){"use strict";var r=n(5448);function i(){var e,t=/^[a-z][a-z0-9+\\-_.]*:/i,n=/^https?:\\/\\//i,r=/^https:\\/\\//i,i=/^([a-z][a-z0-9+\\-_.]*:\\/\\/[^\\/]+)\\/?/i,a=function(e,t){try{return new window.URL(e,t).toString()}catch(t){return e}},o=function(e,t){var n=s;if(!t)return e;if(!c(e))return e;f(e)&&(n=u),d(e)&&(n=l);var r=n(t),i="/"!==r.charAt(r.length-1)&&"/"!==e.charAt(0)?"/":"";return[r,e].join(i)};function s(e){var t=e.indexOf("/"),n=e.lastIndexOf("/");return-1!==t?n===t+1?e:(-1!==e.indexOf("?")&&(e=e.substring(0,e.indexOf("?"))),e.substring(0,n+1)):""}function u(e){var t=e.match(i);return t?t[1]:""}function l(e){var n=e.match(t);return n?n[0]:""}function c(e){return!t.test(e)}function f(e){return c(e)&&"/"===e.charAt(0)}function d(e){return 0===e.indexOf("//")}return function(){try{new window.URL("x","http://y"),e=a}catch(e){}finally{e=e||o}}(),{parseBaseUrl:s,parseOrigin:u,parseScheme:l,isRelative:c,isPathAbsolute:f,isSchemeRelative:d,isHTTPURL:function(e){return n.test(e)},isHTTPS:function(e){return r.test(e)},removeHostname:function(e){return/^(?:\\w+\\:\\/\\/)?([^\\/]+)(.*)$/.exec(e)[2].substring(1)},resolve:function(t,n){return e(t,n)}}}i.__dashjs_factory_name="DefaultURLUtils",t.Z=r.Z.getSingletonFactory(i)},8260:function(e,t,n){"use strict";var r=n(2839),i=n(5448);function a(){var e;function t(t){var r=[];if(!t||!e||"function"!=typeof e.fetchAll)return r;for(var i,a=e.fetchAll(t),o=0,s=a.length;o<s;o++)(i=n(a[o]))&&r.push(i);return r}function n(e){if(!e)return null;var t=new r.Z(e);return e.hasOwnProperty("_incomplete")&&(t.isComplete=!e._incomplete),t}return{getBox:function(t){return t&&e&&e.boxes&&0!==e.boxes.length&&"function"==typeof e.fetch?n(e.fetch(t)):null},getBoxes:t,setData:function(t){e=t},getLastBox:function(){if(!e||!e.boxes||!e.boxes.length)return null;var n=t(e.boxes[e.boxes.length-1].type);return n.length>0?n[n.length-1]:null}}}a.__dashjs_factory_name="IsoFile",t.Z=i.Z.getClassFactory(a)},7473:function(e,t,n){"use strict";n.d(t,{k:function(){return i}});var r=n(5448);function i(e,t){var n={url:e.url,method:e.method,headers:Object.assign({},e.headers),credentials:e.withCredentials?"include":void 0};return Promise.resolve(t.modifyRequest(n)).then((function(){return Object.assign(e,n,{withCredentials:"include"===n.credentials})}))}function a(){return{modifyRequest:null,modifyRequestURL:function(e){return e},modifyRequestHeader:function(e,t){return t.url,e}}}a.__dashjs_factory_name="RequestModifier",t.Z=r.Z.getSingletonFactory(a)},3106:function(e,t,n){"use strict";n.d(t,{PS:function(){return a},SE:function(){return o}});var r=n(3393);function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function a(e,t){if(i(e)!==t)throw r.Z.BAD_ARGUMENT_ERROR}function o(e){if(null===e||isNaN(e)||e%1!=0)throw r.Z.BAD_ARGUMENT_ERROR+" : argument is not an integer"}},2594:function(e,t,n){"use strict";var r=n(5448),i=n(5);function a(){var e,t=[],n=this.context;function r(n,r,i){var a=function(n){var r;for(r=0;r<t.length;r++)if(t[r].regex.test(n))return t[r].utils;return e}(i||r);return a&&"function"==typeof a[n]?a[n](r,i):e[n](r,i)}return e=(0,i.Z)(n).getInstance(),{registerUrlRegex:function(e,n){t.push({regex:e,utils:n})},parseBaseUrl:function(e){return r("parseBaseUrl",e)},parseOrigin:function(e){return r("parseOrigin",e)},parseScheme:function(e){return r("parseScheme",e)},isRelative:function(e){return r("isRelative",e)},isPathAbsolute:function(e){return r("isPathAbsolute",e)},isSchemeRelative:function(e){return r("isSchemeRelative",e)},isHTTPURL:function(e){return r("isHTTPURL",e)},isHTTPS:function(e){return r("isHTTPS",e)},removeHostname:function(e){return r("removeHostname",e)},resolve:function(e,t){return r("resolve",e,t)}}}a.__dashjs_factory_name="URLUtils";var o=r.Z.getSingletonFactory(a);t.Z=o},5459:function(e,t){"use strict";t.Z=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.code=t||null,this.message=n||null,this.data=r||null}},3186:function(e,t,n){"use strict";var r=n(7855);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.action=e.ACTION_DOWNLOAD,this.startTime=NaN,this.mediaStartTime=NaN,this.mediaType=null,this.mediaInfo=null,this.type=null,this.duration=NaN,this.timescale=NaN,this.range=null,this.url=t||null,this.serviceLocation=null,this.requestStartDate=null,this.firstByteDate=null,this.requestEndDate=null,this.quality=NaN,this.index=NaN,this.availabilityStartTime=null,this.availabilityEndTime=null,this.wallStartTime=null,this.bytesLoaded=NaN,this.bytesTotal=NaN,this.delayLoadingTime=NaN,this.responseType="arraybuffer",this.representationId=null}var t,n;return t=e,(n=[{key:"isInitializationRequest",value:function(){return this.type&&this.type===r.w.INIT_SEGMENT_TYPE}},{key:"setInfo",value:function(e){this.type=e&&e.init?r.w.INIT_SEGMENT_TYPE:r.w.MEDIA_SEGMENT_TYPE,this.url=e&&e.url?e.url:null,this.range=e&&e.range?e.range.start+"-"+e.range.end:null,this.mediaType=e&&e.mediaType?e.mediaType:null}}])&&i(t.prototype,n),e}();a.ACTION_DOWNLOAD="download",a.ACTION_COMPLETE="complete",t.Z=a},2839:function(e,t){"use strict";function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var r=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.offset=t._offset,this.type=t.type,this.size=t.size,this.boxes=[],t.boxes)for(var n=0;n<t.boxes.length;n++)this.boxes.push(new e(t.boxes[n]));switch(this.isComplete=!0,t.type){case"sidx":if(this.timescale=t.timescale,this.earliest_presentation_time=t.earliest_presentation_time,this.first_offset=t.first_offset,this.references=t.references,t.references){this.references=[];for(var r=0;r<t.references.length;r++){var i={reference_type:t.references[r].reference_type,referenced_size:t.references[r].referenced_size,subsegment_duration:t.references[r].subsegment_duration};this.references.push(i)}}break;case"emsg":this.id=t.id,this.version=1===t.version?1:0,this.value=t.value,this.timescale=t.timescale,this.scheme_id_uri=t.scheme_id_uri,this.presentation_time_delta=1===t.version?t.presentation_time:t.presentation_time_delta,this.event_duration=t.event_duration,this.message_data=t.message_data;break;case"mdhd":this.timescale=t.timescale;break;case"mfhd":this.sequence_number=t.sequence_number;break;case"subs":this.entry_count=t.entry_count,this.entries=t.entries;break;case"tfhd":this.base_data_offset=t.base_data_offset,this.sample_description_index=t.sample_description_index,this.default_sample_duration=t.default_sample_duration,this.default_sample_size=t.default_sample_size,this.default_sample_flags=t.default_sample_flags,this.flags=t.flags;break;case"tfdt":this.version=t.version,this.baseMediaDecodeTime=t.baseMediaDecodeTime,this.flags=t.flags;break;case"trun":if(this.sample_count=t.sample_count,this.first_sample_flags=t.first_sample_flags,this.data_offset=t.data_offset,this.flags=t.flags,this.samples=t.samples,t.samples){this.samples=[];for(var a=0,o=t.samples.length;a<o;a++){var s={sample_size:t.samples[a].sample_size,sample_duration:t.samples[a].sample_duration,sample_composition_time_offset:t.samples[a].sample_composition_time_offset};this.samples.push(s)}}break;case"prft":this.version=t.version,this.reference_track_ID=t.reference_track_ID,this.ntp_timestamp_sec=t.ntp_timestamp_sec,this.ntp_timestamp_frac=t.ntp_timestamp_frac,this.media_time=t.media_time,this.flags=t.flags}}var t,r;return t=e,(r=[{key:"getChildBox",value:function(e){for(var t=0;t<this.boxes.length;t++)if(this.boxes[t].type===e)return this.boxes[t]}},{key:"getChildBoxes",value:function(e){for(var t=[],n=0;n<this.boxes.length;n++)this.boxes[n].type===e&&t.push(this.boxes[n]);return t}}])&&n(t.prototype,r),e}();t.Z=r},9597:function(e,t){"use strict";t.Z=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.lastCompletedOffset=t,this.found=n,this.size=r}},2128:function(e,t){"use strict";t.Z=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bitrate=0,this.width=0,this.height=0,this.tilesHor=0,this.tilesVert=0,this.widthPerTile=0,this.heightPerTile=0,this.startNumber=0,this.segmentDuration=0,this.timescale=0,this.templateUrl="",this.id=""}},7855:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}n.d(t,{O:function(){return a},w:function(){return i}});var i=function e(){r(this,e),this.tcpid=null,this.type=null,this.url=null,this.actualurl=null,this.range=null,this.trequest=null,this.tresponse=null,this.responsecode=null,this.interval=null,this.trace=[],this.cmsd=null,this._stream=null,this._tfinish=null,this._mediaduration=null,this._quality=null,this._responseHeaders=null,this._serviceLocation=null,this._fileLoaderType=null},a=function e(){r(this,e),this.s=null,this.d=null,this.b=[]};i.GET="GET",i.HEAD="HEAD",i.MPD_TYPE="MPD",i.XLINK_EXPANSION_TYPE="XLinkExpansion",i.INIT_SEGMENT_TYPE="InitializationSegment",i.INDEX_SEGMENT_TYPE="IndexSegment",i.MEDIA_SEGMENT_TYPE="MediaSegment",i.BITSTREAM_SWITCHING_SEGMENT_TYPE="BitstreamSwitchingSegment",i.MSS_FRAGMENT_INFO_SEGMENT_TYPE="FragmentInfoSegment",i.DVB_REPORTING_TYPE="DVBReporting",i.LICENSE="license",i.CONTENT_STEERING_TYPE="ContentSteering",i.OTHER_TYPE="other"},3039:function(e,t){"use strict";function n(e,t){return function(n,i){for(var a,o,s,u=r(n,"tag"),l=r(null==i?"*":i,"range"),c=[],f=-1;++f<l.length;)if(a=l[f].toLowerCase(),t||"*"!==a){for(o=-1,s=[];++o<u.length;)if(e(u[o].toLowerCase(),a)){if(!t)return u[o];c.push(u[o])}else s.push(u[o]);u=s}return t?c:void 0}}function r(e,t){var n=e&&"string"==typeof e?[e]:e;if(!n||"object"!=typeof n||!("length"in n))throw new Error("Invalid "+t+" `"+n+"`, expected non-empty string");return n}t.basicFilter=n((function(e,t){return"*"===t||e===t||e.indexOf(t+"-")>-1}),!0),t.extendedFilter=n((function(e,t){var n=e.split("-"),r=t.split("-"),i=0,a=0;if("*"!==r[a]&&n[i]!==r[a])return!1;for(i++,a++;a<r.length;)if("*"!==r[a]){if(!n[i])return!1;if(n[i]!==r[a]){if(1===n[i].length)return!1;i++}else i++,a++}else a++;return!0}),!0),t.lookup=n((function(e,t){for(var n,r=t;;){if("*"===r||e===r)return!0;if((n=r.lastIndexOf("-"))<0)return!1;"-"===r.charAt(n-2)&&(n-=2),r=r.slice(0,n)}}))},3973:function(e,t,n){"use strict";e.exports=n(3854)},3854:function(e,t,n){"use strict";var r=n(2415),i=n(3039),a=n(7778),o=n(5813),s=n(3165),u=n(9460);e.exports=function(e,t){var n,c=t||{},m=r.parse(String(e||"").toLowerCase(),c),y=r.stringify(m),E=-1;if(!y)return y;for(;++E<a.length;)i.extendedFilter(y,a[E].from).length&&(d(m,a[E].from,a[E].to),y=r.stringify(m));for(E=-1;++E<o.length;)g(m,o[E].from.field,o[E].from.value)&&h(m,o[E].to.field,o[E].to.value);for(y=r.stringify(Object.assign({},m,f)),E=-1;++E<s.length;)y===s[E]&&(d(m,s[E],s[E].split("-").slice(0,-1).join("-")),y=r.stringify(Object.assign({},m,f)));if(m.extensions.sort(p),c.warning)for(n in u)l.call(u[n],m[n])&&c.warning("Deprecated "+n+" `"+m[n]+"`, expected one of `"+u[n][m[n]].join("`, `")+"`",null,7);return m.script&&(m.script=m.script.charAt(0).toUpperCase()+m.script.slice(1)),m.region&&(m.region=m.region.toUpperCase()),r.stringify(m)};var l={}.hasOwnProperty,c=new Intl.Collator,f={variants:[],extensions:[],privateuse:[],irregular:null,regular:null};function d(e,t,n){var i,a=r.parse(t),o=r.parse(n),s=[];for(i in a)a[i]&&a[i].length&&g(e,i,a[i])&&s.push(i);for(i in o)o[i]&&o[i].length&&(s.indexOf(i)>-1||!e[i]||!e[i].length)&&h(e,i,o[i])}function g(e,t,n){var r,i,a,o,s=!1;if(n){if(i=r=e[t],r&&"object"==typeof r)for(i=[],a=-1;++a<r.length;)o=r[a],n.indexOf(o)<0?i.push(o):s=!0;else r===n&&(i=null,s=!0);e[t]=i}return s}function h(e,t,n){var r,i,a,o=e[t];if(o&&"object"==typeof o)for(r=[].concat(n),i=-1;++i<r.length;)a=r[i],o.indexOf(a)<0&&o.push(a);else e[t]=n}function p(e,t){return c.compare(e.singleton,t.singleton)}},2415:function(e,t,n){"use strict";t.parse=n(6903),t.stringify=n(6713)},6903:function(e,t,n){"use strict";var r=n(2219),i=n(3516),a=n(395),o=n(858),s=n(8589);e.exports=function e(t,n){var l,c,f,d=n||{},g={language:null,extendedLanguageSubtags:[],script:null,region:null,variants:[],extensions:[],privateuse:[],irregular:null,regular:null},h=String(t),p=h.toLowerCase(),m=0;if(null==t)throw new Error("Expected string, got `"+t+"`");if(u.call(s,p))return(null==d.normalize||d.normalize)&&s[p]?e(s[p]):(g[-1===o.indexOf(p)?"irregular":"regular"]=h,g);for(;i(p.charCodeAt(m))&&m<9;)m++;if(m>1&&m<9){if(g.language=h.slice(0,m),m<4)for(c=0;45===p.charCodeAt(m)&&i(p.charCodeAt(m+1))&&i(p.charCodeAt(m+2))&&i(p.charCodeAt(m+3))&&!i(p.charCodeAt(m+4));){if(c>2)return y(m,3,"Too many extended language subtags, expected at most 3 subtags");g.extendedLanguageSubtags.push(h.slice(m+1,m+4)),m+=4,c++}for(45===p.charCodeAt(m)&&i(p.charCodeAt(m+1))&&i(p.charCodeAt(m+2))&&i(p.charCodeAt(m+3))&&i(p.charCodeAt(m+4))&&!i(p.charCodeAt(m+5))&&(g.script=h.slice(m+1,m+5),m+=5),45===p.charCodeAt(m)&&(i(p.charCodeAt(m+1))&&i(p.charCodeAt(m+2))&&!i(p.charCodeAt(m+3))?(g.region=h.slice(m+1,m+3),m+=3):a(p.charCodeAt(m+1))&&a(p.charCodeAt(m+2))&&a(p.charCodeAt(m+3))&&!a(p.charCodeAt(m+4))&&(g.region=h.slice(m+1,m+4),m+=4));45===p.charCodeAt(m);){for(f=l=m+1;r(p.charCodeAt(f));){if(f-l>7)return y(f,1,"Too long variant, expected at most 8 characters");f++}if(!(f-l>4||f-l>3&&a(p.charCodeAt(l))))break;g.variants.push(h.slice(l,f)),m=f}for(;45===p.charCodeAt(m)&&120!==p.charCodeAt(m+1)&&r(p.charCodeAt(m+1))&&45===p.charCodeAt(m+2)&&r(p.charCodeAt(m+3));){for(f=m+2,c=0;45===p.charCodeAt(f)&&r(p.charCodeAt(f+1))&&r(p.charCodeAt(f+2));)for(f=(l=f+1)+2,c++;r(p.charCodeAt(f));){if(f-l>7)return y(f,2,"Too long extension, expected at most 8 characters");f++}if(!c)return y(f,4,"Empty extension, extensions must have at least 2 characters of content");g.extensions.push({singleton:h.charAt(m+1),extensions:h.slice(m+3,f).split("-")}),m=f}}else m=0;if(0===m&&120===p.charCodeAt(m)||45===p.charCodeAt(m)&&120===p.charCodeAt(m+1))for(f=m=m?m+2:1;45===p.charCodeAt(f)&&r(p.charCodeAt(f+1));){for(f=l=m+1;r(p.charCodeAt(f));){if(f-l>7)return y(f,5,"Too long private-use area, expected at most 8 characters");f++}g.privateuse.push(h.slice(m+1,f)),m=f}return m!==h.length?y(m,6,"Found superfluous content after tag"):g;function y(e,t,n){return d.warning&&d.warning(n,t,e),d.forgiving?g:{language:null,extendedLanguageSubtags:[],script:null,region:null,variants:[],extensions:[],privateuse:[],irregular:null,regular:null}}};var u={}.hasOwnProperty},6713:function(e){"use strict";e.exports=function(e){var t,n,r,i=e||{},a=[];if(i.irregular||i.regular)return i.irregular||i.regular;if(i.language)for(a=a.concat(i.language,i.extendedLanguageSubtags||[],i.script||[],i.region||[],i.variants||[]),t=i.extensions||[],n=-1;++n<t.length;)(r=t[n]).singleton&&r.extensions&&r.extensions.length&&(a=a.concat(r.singleton,r.extensions));return i.privateuse&&i.privateuse.length&&(a=a.concat("x",i.privateuse)),a.join("-")}},1549:function(e,t,n){"use strict";var r=n(6693),i=n(2165),a="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.alloc(+e)},t.INSPECT_MAX_BYTES=50;var o=2147483647;function s(e){if(e>o)throw new RangeError(\'The value "\'+e+\'" is invalid for option "size"\');var t=new Uint8Array(e);return Object.setPrototypeOf(t,u.prototype),t}function u(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError(\'The "string" argument must be of type string. Received type number\');return f(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|p(e,t),r=s(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(G(e,Uint8Array)){var t=new Uint8Array(e);return g(t.buffer,t.byteOffset,t.byteLength)}return d(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(G(e,ArrayBuffer)||e&&G(e.buffer,ArrayBuffer))return g(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(G(e,SharedArrayBuffer)||e&&G(e.buffer,SharedArrayBuffer)))return g(e,t,n);if("number"==typeof e)throw new TypeError(\'The "value" argument must not be of type number. Received type number\');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return u.from(r,t,n);var i=function(e){if(u.isBuffer(e)){var t=0|h(e.length),n=s(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||q(e.length)?s(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError(\'"size" argument must be of type number\');if(e<0)throw new RangeError(\'The value "\'+e+\'" is invalid for option "size"\')}function f(e){return c(e),s(e<0?0:0|h(e))}function d(e){for(var t=e.length<0?0:0|h(e.length),n=s(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}function g(e,t,n){if(t<0||e.byteLength<t)throw new RangeError(\'"offset" is outside of buffer bounds\');if(e.byteLength<t+(n||0))throw new RangeError(\'"length" is outside of buffer bounds\');var r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,u.prototype),r}function h(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function p(e,t){if(u.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||G(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError(\'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type \'+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return U(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(e).length;default:if(i)return r?-1:U(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return D(this,t,n);case"utf8":case"utf-8":return R(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return I(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function y(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function E(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),q(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=u.from(t,r)),u.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){var a,o=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var c=-1;for(a=n;a<s;a++)if(l(e,a)===l(t,-1===c?0:a-c)){if(-1===c&&(c=a),a-c+1===u)return c*o}else-1!==c&&(a-=a-c),c=-1}else for(n+u>s&&(n=s-u),a=n;a>=0;a--){for(var f=!0,d=0;d<u;d++)if(l(e,a+d)!==l(t,d)){f=!1;break}if(f)return a}return-1}function _(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var a=t.length;r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(2*o,2),16);if(q(s))return o;e[n+o]=s}return o}function T(e,t,n,r){return B(U(t,e.length-n),e,n,r)}function S(e,t,n,r){return B(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function b(e,t,n,r){return B(Z(t),e,n,r)}function A(e,t,n,r){return B(function(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function I(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function R(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a,o,s,u,l=e[i],c=null,f=l>239?4:l>223?3:l>191?2:1;if(i+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&l)<<6|63&a)>127&&(c=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&l)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=f}return function(e){var t=e.length;if(t<=w)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=w));return n}(r)}t.kMaxLength=o,u.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(e,t,n){return l(e,t,n)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(e,t,n){return function(e,t,n){return c(e),e<=0?s(e):void 0!==t?"string"==typeof n?s(e).fill(t,n):s(e).fill(t):s(e)}(e,t,n)},u.allocUnsafe=function(e){return f(e)},u.allocUnsafeSlow=function(e){return f(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(G(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),G(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError(\'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array\');if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError(\'"list" argument must be an Array of Buffers\');if(0===e.length)return u.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=u.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(G(a,Uint8Array))i+a.length>r.length?u.from(a).copy(r,i):Uint8Array.prototype.set.call(r,a,i);else{if(!u.isBuffer(a))throw new TypeError(\'"list" argument must be an Array of Buffers\');a.copy(r,i)}i+=a.length}return r},u.byteLength=p,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):m.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},a&&(u.prototype[a]=u.prototype.inspect),u.prototype.compare=function(e,t,n,r,i){if(G(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(e))throw new TypeError(\'The "target" argument must be one of type Buffer or Uint8Array. Received type \'+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),s=Math.min(a,o),l=this.slice(r,i),c=e.slice(t,n),f=0;f<s;++f)if(l[f]!==c[f]){a=l[f],o=c[f];break}return a<o?-1:o<a?1:0},u.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},u.prototype.indexOf=function(e,t,n){return E(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return E(this,e,t,n,!1)},u.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return _(this,e,t,n);case"utf8":case"utf-8":return T(this,e,t,n);case"ascii":case"latin1":case"binary":return S(this,e,t,n);case"base64":return b(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var w=4096;function N(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function C(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function D(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",a=t;a<n;++a)i+=Y[e[a]];return i}function O(e,t,n){for(var r=e.slice(t,n),i="",a=0;a<r.length-1;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}function M(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,i,a){if(!u.isBuffer(e))throw new TypeError(\'"buffer" argument must be a Buffer instance\');if(t>i||t<a)throw new RangeError(\'"value" argument is out of bounds\');if(n+r>e.length)throw new RangeError("Index out of range")}function L(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function x(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,a){return t=+t,n>>>=0,a||L(e,0,n,8),i.write(e,t,n,r,52,8),n+8}u.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return Object.setPrototypeOf(r,u.prototype),r},u.prototype.readUintLE=u.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},u.prototype.readUintBE=u.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||M(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},u.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||M(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,n,r){e=+e,t>>>=0,n>>>=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<n&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},u.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},u.prototype.writeFloatLE=function(e,t,n){return x(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return x(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,r){if(!u.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},u.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){var i=e.charCodeAt(0);("utf8"===r&&i<128||"latin1"===r)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var o=u.isBuffer(e)?e:u.from(e,r),s=o.length;if(0===s)throw new TypeError(\'The value "\'+e+\'" is invalid for argument "value"\');for(a=0;a<n-t;++a)this[a+t]=o[a%s]}return this};var k=/[^+/0-9A-Za-z-_]/g;function U(e,t){var n;t=t||1/0;for(var r=e.length,i=null,a=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function Z(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(k,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function B(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function G(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function q(e){return e!=e}var Y=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}()},6693:function(e,t){"use strict";t.byteLength=function(e){var t=u(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){var t,n,a=u(e),o=a[0],s=a[1],l=new i(function(e,t,n){return 3*(t+n)/4-n}(0,o,s)),c=0,f=s>0?o-4:o;for(n=0;n<f;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;return 2===s&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,l[c++]=255&t),1===s&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t),l},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,a=[],o=16383,s=0,u=r-i;s<u;s+=o)a.push(l(e,s,s+o>u?u:s+o));return 1===i?(t=e[r-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),a.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=a.length;o<s;++o)n[o]=a[o],r[a.charCodeAt(o)]=o;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,r){for(var i,a,o=[],s=t;s<r;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(n[(a=i)>>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return o.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},2165:function(e,t){t.read=function(e,t,n,r,i){var a,o,s=8*i-r-1,u=(1<<s)-1,l=u>>1,c=-7,f=n?i-1:0,d=n?-1:1,g=e[t+f];for(f+=d,a=g&(1<<-c)-1,g>>=-c,c+=s;c>0;a=256*a+e[t+f],f+=d,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=r;c>0;o=256*o+e[t+f],f+=d,c-=8);if(0===a)a=1-l;else{if(a===u)return o?NaN:1/0*(g?-1:1);o+=Math.pow(2,r),a-=l}return(g?-1:1)*o*Math.pow(2,a-r)},t.write=function(e,t,n,r,i,a){var o,s,u,l=8*a-i-1,c=(1<<l)-1,f=c>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=r?0:a-1,h=r?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[n+g]=255&s,g+=h,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+g]=255&o,g+=h,o/=256,l-=8);e[n+g-h]|=128*p}},6934:function(e,t){var n={parseBuffer:function(e){return new r(e).parse()},addBoxProcessor:function(e,t){"string"==typeof e&&"function"==typeof t&&(i.prototype._boxProcessors[e]=t)},createFile:function(){return new r},createBox:function(e,t,n){var r=i.create(e);return t&&t.append(r,n),r},createFullBox:function(e,t,r){var i=n.createBox(e,t,r);return i.version=0,i.flags=0,i},Utils:{}};n.Utils.dataViewToString=function(e,t){var n=t||"utf-8";if("undefined"!=typeof TextDecoder)return new TextDecoder(n).decode(e);var r=[],i=0;if("utf-8"===n)for(;i<e.byteLength;){var a=e.getUint8(i++);a<128||(a<224?(a=(31&a)<<6,a|=63&e.getUint8(i++)):a<240?(a=(15&a)<<12,a|=(63&e.getUint8(i++))<<6,a|=63&e.getUint8(i++)):(a=(7&a)<<18,a|=(63&e.getUint8(i++))<<12,a|=(63&e.getUint8(i++))<<6,a|=63&e.getUint8(i++))),r.push(String.fromCharCode(a))}else for(;i<e.byteLength;)r.push(String.fromCharCode(e.getUint8(i++)));return r.join("")},n.Utils.utf8ToByteArray=function(e){var t,n;if("undefined"!=typeof TextEncoder)t=(new TextEncoder).encode(e);else for(t=[],n=0;n<e.length;++n){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?(t.push(192|r>>6),t.push(128|63&r)):r<65536?(t.push(224|r>>12),t.push(128|63&r>>6),t.push(128|63&r)):(t.push(240|r>>18),t.push(128|63&r>>12),t.push(128|63&r>>6),t.push(128|63&r))}return t},n.Utils.appendBox=function(e,t,n){if(t._offset=e._cursor.offset,t._root=e._root?e._root:e,t._raw=e._raw,t._parent=e,-1!==n)if(null!=n){var r,i=-1;if("number"==typeof n)i=n;else{if("string"==typeof n)r=n;else{if("object"!=typeof n||!n.type)return void e.boxes.push(t);r=n.type}for(var a=0;a<e.boxes.length;a++)if(r===e.boxes[a].type){i=a+1;break}}e.boxes.splice(i,0,t)}else e.boxes.push(t)},t.parseBuffer=n.parseBuffer,t.addBoxProcessor=n.addBoxProcessor,t.createFile=n.createFile,t.createBox=n.createBox,t.createFullBox=n.createFullBox,t.Utils=n.Utils,n.Cursor=function(e){this.offset=void 0===e?0:e};var r=function(e){this._cursor=new n.Cursor,this.boxes=[],e&&(this._raw=new DataView(e))};r.prototype.fetch=function(e){var t=this.fetchAll(e,!0);return t.length?t[0]:null},r.prototype.fetchAll=function(e,t){var n=[];return r._sweep.call(this,e,n,t),n},r.prototype.parse=function(){for(this._cursor.offset=0,this.boxes=[];this._cursor.offset<this._raw.byteLength;){var e=i.parse(this);if(void 0===e.type)break;this.boxes.push(e)}return this},r._sweep=function(e,t,n){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&n)return;r._sweep.call(this.boxes[i],e,t,n)}},r.prototype.write=function(){var e,t=0;for(e=0;e<this.boxes.length;e++)t+=this.boxes[e].getLength(!1);var n=new Uint8Array(t);for(this._rawo=new DataView(n.buffer),this.bytes=n,this._cursor.offset=0,e=0;e<this.boxes.length;e++)this.boxes[e].write();return n.buffer},r.prototype.append=function(e,t){n.Utils.appendBox(this,e,t)};var i=function(){this._cursor=new n.Cursor};i.parse=function(e){var t=new i;return t._offset=e._cursor.offset,t._root=e._root?e._root:e,t._raw=e._raw,t._parent=e,t._parseBox(),e._cursor.offset=t._raw.byteOffset+t._raw.byteLength,t},i.create=function(e){var t=new i;return t.type=e,t.boxes=[],t},i.prototype._boxContainers=["dinf","edts","mdia","meco","mfra","minf","moof","moov","mvex","stbl","strk","traf","trak","tref","udta","vttc","sinf","schi","encv","enca"],i.prototype._boxProcessors={},i.prototype._procField=function(e,t,n){this._parsing?this[e]=this._readField(t,n):this._writeField(t,n,this[e])},i.prototype._procFieldArray=function(e,t,n,r){var i;if(this._parsing)for(this[e]=[],i=0;i<t;i++)this[e][i]=this._readField(n,r);else for(i=0;i<this[e].length;i++)this._writeField(n,r,this[e][i])},i.prototype._procFullBox=function(){this._procField("version","uint",8),this._procField("flags","uint",24)},i.prototype._procEntries=function(e,t,n){var r;if(this._parsing)for(this[e]=[],r=0;r<t;r++)this[e].push({}),n.call(this,this[e][r]);else for(r=0;r<t;r++)n.call(this,this[e][r])},i.prototype._procSubEntries=function(e,t,n,r){var i;if(this._parsing)for(e[t]=[],i=0;i<n;i++)e[t].push({}),r.call(this,e[t][i]);else for(i=0;i<n;i++)r.call(this,e[t][i])},i.prototype._procEntryField=function(e,t,n,r){this._parsing?e[t]=this._readField(n,r):this._writeField(n,r,e[t])},i.prototype._procSubBoxes=function(e,t){var n;if(this._parsing)for(this[e]=[],n=0;n<t;n++)this[e].push(i.parse(this));else for(n=0;n<t;n++)this._rawo?this[e][n].write():this.size+=this[e][n].getLength()},i.prototype._readField=function(e,t){switch(e){case"uint":return this._readUint(t);case"int":return this._readInt(t);case"template":return this._readTemplate(t);case"string":return-1===t?this._readTerminatedString():this._readString(t);case"data":return this._readData(t);case"utf8":return this._readUTF8String();default:return-1}},i.prototype._readInt=function(e){var t=null,n=this._cursor.offset-this._raw.byteOffset;switch(e){case 8:t=this._raw.getInt8(n);break;case 16:t=this._raw.getInt16(n);break;case 32:t=this._raw.getInt32(n);break;case 64:var r=this._raw.getInt32(n),i=this._raw.getInt32(n+4);t=r*Math.pow(2,32)+i}return this._cursor.offset+=e>>3,t},i.prototype._readUint=function(e){var t,n,r=null,i=this._cursor.offset-this._raw.byteOffset;switch(e){case 8:r=this._raw.getUint8(i);break;case 16:r=this._raw.getUint16(i);break;case 24:r=((t=this._raw.getUint16(i))<<8)+(n=this._raw.getUint8(i+2));break;case 32:r=this._raw.getUint32(i);break;case 64:t=this._raw.getUint32(i),n=this._raw.getUint32(i+4),r=t*Math.pow(2,32)+n}return this._cursor.offset+=e>>3,r},i.prototype._readString=function(e){for(var t="",n=0;n<e;n++){var r=this._readUint(8);t+=String.fromCharCode(r)}return t},i.prototype._readTemplate=function(e){return this._readUint(e/2)+this._readUint(e/2)/Math.pow(2,e/2)},i.prototype._readTerminatedString=function(){for(var e="";this._cursor.offset-this._offset<this._raw.byteLength;){var t=this._readUint(8);if(0===t)break;e+=String.fromCharCode(t)}return e},i.prototype._readData=function(e){var t=e>0?e:this._raw.byteLength-(this._cursor.offset-this._offset);if(t>0){var n=new Uint8Array(this._raw.buffer,this._cursor.offset,t);return this._cursor.offset+=t,n}return null},i.prototype._readUTF8String=function(){var e=this._raw.byteLength-(this._cursor.offset-this._offset),t=null;return e>0&&(t=new DataView(this._raw.buffer,this._cursor.offset,e),this._cursor.offset+=e),t?n.Utils.dataViewToString(t):t},i.prototype._parseBox=function(){if(this._parsing=!0,this._cursor.offset=this._offset,this._offset+8>this._raw.buffer.byteLength)this._root._incomplete=!0;else{switch(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this.size){case 0:this._raw=new DataView(this._raw.buffer,this._offset);break;case 1:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.largesize);break;default:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.size)}this._incomplete||(this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type)?this._parseContainerBox():this._data=this._readData())}},i.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},i.prototype._parseContainerBox=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset<this._raw.byteLength;)this.boxes.push(i.parse(this))},i.prototype.append=function(e,t){n.Utils.appendBox(this,e,t)},i.prototype.getLength=function(){if(this._parsing=!1,this._rawo=null,this.size=0,this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var e=0;e<this.boxes.length;e++)this.size+=this.boxes[e].getLength();return this._data&&this._writeData(this._data),this.size},i.prototype.write=function(){switch(this._parsing=!1,this._cursor.offset=this._parent._cursor.offset,this.size){case 0:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.parent._rawo.byteLength-this._cursor.offset);break;case 1:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.largesize);break;default:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.size)}if(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var e=0;e<this.boxes.length;e++)this.boxes[e].write();return this._data&&this._writeData(this._data),this._parent._cursor.offset+=this.size,this.size},i.prototype._writeInt=function(e,t){if(this._rawo){var n=this._cursor.offset-this._rawo.byteOffset;switch(e){case 8:this._rawo.setInt8(n,t);break;case 16:this._rawo.setInt16(n,t);break;case 32:this._rawo.setInt32(n,t);break;case 64:var r=Math.floor(t/Math.pow(2,32)),i=t-r*Math.pow(2,32);this._rawo.setUint32(n,r),this._rawo.setUint32(n+4,i)}this._cursor.offset+=e>>3}else this.size+=e>>3},i.prototype._writeUint=function(e,t){if(this._rawo){var n,r,i=this._cursor.offset-this._rawo.byteOffset;switch(e){case 8:this._rawo.setUint8(i,t);break;case 16:this._rawo.setUint16(i,t);break;case 24:n=(16776960&t)>>8,r=255&t,this._rawo.setUint16(i,n),this._rawo.setUint8(i+2,r);break;case 32:this._rawo.setUint32(i,t);break;case 64:r=t-(n=Math.floor(t/Math.pow(2,32)))*Math.pow(2,32),this._rawo.setUint32(i,n),this._rawo.setUint32(i+4,r)}this._cursor.offset+=e>>3}else this.size+=e>>3},i.prototype._writeString=function(e,t){for(var n=0;n<e;n++)this._writeUint(8,t.charCodeAt(n))},i.prototype._writeTerminatedString=function(e){if(0!==e.length){for(var t=0;t<e.length;t++)this._writeUint(8,e.charCodeAt(t));this._writeUint(8,0)}},i.prototype._writeTemplate=function(e,t){var n=Math.floor(t),r=(t-n)*Math.pow(2,e/2);this._writeUint(e/2,n),this._writeUint(e/2,r)},i.prototype._writeData=function(e){if(e)if(this._rawo){if(e instanceof Array){for(var t=this._cursor.offset-this._rawo.byteOffset,n=0;n<e.length;n++)this._rawo.setInt8(t+n,e[n]);this._cursor.offset+=e.length}e instanceof Uint8Array&&(this._root.bytes.set(e,this._cursor.offset),this._cursor.offset+=e.length)}else this.size+=e.length},i.prototype._writeUTF8String=function(e){var t=n.Utils.utf8ToByteArray(e);if(this._rawo)for(var r=new DataView(this._rawo.buffer,this._cursor.offset,t.length),i=0;i<t.length;i++)r.setUint8(i,t[i]);else this.size+=t.length},i.prototype._writeField=function(e,t,n){switch(e){case"uint":this._writeUint(t,n);break;case"int":this._writeInt(t,n);break;case"template":this._writeTemplate(t,n);break;case"string":-1==t?this._writeTerminatedString(n):this._writeString(t,n);break;case"data":this._writeData(n);break;case"utf8":this._writeUTF8String(n)}},i.prototype._boxProcessors.avc1=i.prototype._boxProcessors.avc2=i.prototype._boxProcessors.avc3=i.prototype._boxProcessors.avc4=i.prototype._boxProcessors.hvc1=i.prototype._boxProcessors.hev1=i.prototype._boxProcessors.encv=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procField("pre_defined1","uint",16),this._procField("reserved2","uint",16),this._procFieldArray("pre_defined2",3,"uint",32),this._procField("width","uint",16),this._procField("height","uint",16),this._procField("horizresolution","template",32),this._procField("vertresolution","template",32),this._procField("reserved3","uint",32),this._procField("frame_count","uint",16),this._procFieldArray("compressorname",32,"uint",8),this._procField("depth","uint",16),this._procField("pre_defined3","int",16),this._procField("config","data",-1)},i.prototype._boxProcessors.ctts=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"sample_count","uint",32),this._procEntryField(e,"sample_offset",1===this.version?"int":"uint",32)}))},i.prototype._boxProcessors.dref=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},i.prototype._boxProcessors.elst=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"segment_duration","uint",1===this.version?64:32),this._procEntryField(e,"media_time","int",1===this.version?64:32),this._procEntryField(e,"media_rate_integer","int",16),this._procEntryField(e,"media_rate_fraction","int",16)}))},i.prototype._boxProcessors.emsg=function(){this._procFullBox(),1==this.version?(this._procField("timescale","uint",32),this._procField("presentation_time","uint",64),this._procField("event_duration","uint",32),this._procField("id","uint",32),this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1)):(this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1),this._procField("timescale","uint",32),this._procField("presentation_time_delta","uint",32),this._procField("event_duration","uint",32),this._procField("id","uint",32)),this._procField("message_data","data",-1)},i.prototype._boxProcessors.free=i.prototype._boxProcessors.skip=function(){this._procField("data","data",-1)},i.prototype._boxProcessors.frma=function(){this._procField("data_format","uint",32)},i.prototype._boxProcessors.ftyp=i.prototype._boxProcessors.styp=function(){this._procField("major_brand","string",4),this._procField("minor_version","uint",32);var e=-1;this._parsing&&(e=(this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset))/4),this._procFieldArray("compatible_brands",e,"string",4)},i.prototype._boxProcessors.hdlr=function(){this._procFullBox(),this._procField("pre_defined","uint",32),this._procField("handler_type","string",4),this._procFieldArray("reserved",3,"uint",32),this._procField("name","string",-1)},i.prototype._boxProcessors.mdat=function(){this._procField("data","data",-1)},i.prototype._boxProcessors.mdhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._parsing||"string"!=typeof this.language||(this.language=this.language.charCodeAt(0)-96<<10|this.language.charCodeAt(1)-96<<5|this.language.charCodeAt(2)-96),this._procField("language","uint",16),this._parsing&&(this.language=String.fromCharCode(96+(this.language>>10&31),96+(this.language>>5&31),96+(31&this.language))),this._procField("pre_defined","uint",16)},i.prototype._boxProcessors.mehd=function(){this._procFullBox(),this._procField("fragment_duration","uint",1==this.version?64:32)},i.prototype._boxProcessors.mfhd=function(){this._procFullBox(),this._procField("sequence_number","uint",32)},i.prototype._boxProcessors.mfro=function(){this._procFullBox(),this._procField("mfra_size","uint",32)},i.prototype._boxProcessors.mp4a=i.prototype._boxProcessors.enca=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procField("channelcount","uint",16),this._procField("samplesize","uint",16),this._procField("pre_defined","uint",16),this._procField("reserved3","uint",16),this._procField("samplerate","template",32),this._procField("esds","data",-1)},i.prototype._boxProcessors.mvhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procField("rate","template",32),this._procField("volume","template",16),this._procField("reserved1","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procFieldArray("matrix",9,"template",32),this._procFieldArray("pre_defined",6,"uint",32),this._procField("next_track_ID","uint",32)},i.prototype._boxProcessors.payl=function(){this._procField("cue_text","utf8")},i.prototype._boxProcessors.prft=function(){this._procFullBox(),this._procField("reference_track_ID","uint",32),this._procField("ntp_timestamp_sec","uint",32),this._procField("ntp_timestamp_frac","uint",32),this._procField("media_time","uint",1==this.version?64:32)},i.prototype._boxProcessors.pssh=function(){this._procFullBox(),this._procFieldArray("SystemID",16,"uint",8),this._procField("DataSize","uint",32),this._procFieldArray("Data",this.DataSize,"uint",8)},i.prototype._boxProcessors.schm=function(){this._procFullBox(),this._procField("scheme_type","uint",32),this._procField("scheme_version","uint",32),1&this.flags&&this._procField("scheme_uri","string",-1)},i.prototype._boxProcessors.sdtp=function(){this._procFullBox();var e=-1;this._parsing&&(e=this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset)),this._procFieldArray("sample_dependency_table",e,"uint",8)},i.prototype._boxProcessors.sidx=function(){this._procFullBox(),this._procField("reference_ID","uint",32),this._procField("timescale","uint",32),this._procField("earliest_presentation_time","uint",1==this.version?64:32),this._procField("first_offset","uint",1==this.version?64:32),this._procField("reserved","uint",16),this._procField("reference_count","uint",16),this._procEntries("references",this.reference_count,(function(e){this._parsing||(e.reference=(1&e.reference_type)<<31,e.reference|=2147483647&e.referenced_size,e.sap=(1&e.starts_with_SAP)<<31,e.sap|=(3&e.SAP_type)<<28,e.sap|=268435455&e.SAP_delta_time),this._procEntryField(e,"reference","uint",32),this._procEntryField(e,"subsegment_duration","uint",32),this._procEntryField(e,"sap","uint",32),this._parsing&&(e.reference_type=e.reference>>31&1,e.referenced_size=2147483647&e.reference,e.starts_with_SAP=e.sap>>31&1,e.SAP_type=e.sap>>28&7,e.SAP_delta_time=268435455&e.sap)}))},i.prototype._boxProcessors.smhd=function(){this._procFullBox(),this._procField("balance","uint",16),this._procField("reserved","uint",16)},i.prototype._boxProcessors.ssix=function(){this._procFullBox(),this._procField("subsegment_count","uint",32),this._procEntries("subsegments",this.subsegment_count,(function(e){this._procEntryField(e,"ranges_count","uint",32),this._procSubEntries(e,"ranges",e.ranges_count,(function(e){this._procEntryField(e,"level","uint",8),this._procEntryField(e,"range_size","uint",24)}))}))},i.prototype._boxProcessors.stsd=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},i.prototype._boxProcessors.sttg=function(){this._procField("settings","utf8")},i.prototype._boxProcessors.stts=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"sample_count","uint",32),this._procEntryField(e,"sample_delta","uint",32)}))},i.prototype._boxProcessors.subs=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"sample_delta","uint",32),this._procEntryField(e,"subsample_count","uint",16),this._procSubEntries(e,"subsamples",e.subsample_count,(function(e){this._procEntryField(e,"subsample_size","uint",1===this.version?32:16),this._procEntryField(e,"subsample_priority","uint",8),this._procEntryField(e,"discardable","uint",8),this._procEntryField(e,"codec_specific_parameters","uint",32)}))}))},i.prototype._boxProcessors.tenc=function(){this._procFullBox(),this._procField("default_IsEncrypted","uint",24),this._procField("default_IV_size","uint",8),this._procFieldArray("default_KID",16,"uint",8)},i.prototype._boxProcessors.tfdt=function(){this._procFullBox(),this._procField("baseMediaDecodeTime","uint",1==this.version?64:32)},i.prototype._boxProcessors.tfhd=function(){this._procFullBox(),this._procField("track_ID","uint",32),1&this.flags&&this._procField("base_data_offset","uint",64),2&this.flags&&this._procField("sample_description_offset","uint",32),8&this.flags&&this._procField("default_sample_duration","uint",32),16&this.flags&&this._procField("default_sample_size","uint",32),32&this.flags&&this._procField("default_sample_flags","uint",32)},i.prototype._boxProcessors.tfra=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._parsing||(this.reserved=0,this.reserved|=(48&this.length_size_of_traf_num)<<4,this.reserved|=(12&this.length_size_of_trun_num)<<2,this.reserved|=3&this.length_size_of_sample_num),this._procField("reserved","uint",32),this._parsing&&(this.length_size_of_traf_num=(48&this.reserved)>>4,this.length_size_of_trun_num=(12&this.reserved)>>2,this.length_size_of_sample_num=3&this.reserved),this._procField("number_of_entry","uint",32),this._procEntries("entries",this.number_of_entry,(function(e){this._procEntryField(e,"time","uint",1===this.version?64:32),this._procEntryField(e,"moof_offset","uint",1===this.version?64:32),this._procEntryField(e,"traf_number","uint",8*(this.length_size_of_traf_num+1)),this._procEntryField(e,"trun_number","uint",8*(this.length_size_of_trun_num+1)),this._procEntryField(e,"sample_number","uint",8*(this.length_size_of_sample_num+1))}))},i.prototype._boxProcessors.tkhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("track_ID","uint",32),this._procField("reserved1","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procFieldArray("reserved2",2,"uint",32),this._procField("layer","uint",16),this._procField("alternate_group","uint",16),this._procField("volume","template",16),this._procField("reserved3","uint",16),this._procFieldArray("matrix",9,"template",32),this._procField("width","template",32),this._procField("height","template",32)},i.prototype._boxProcessors.trex=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._procField("default_sample_description_index","uint",32),this._procField("default_sample_duration","uint",32),this._procField("default_sample_size","uint",32),this._procField("default_sample_flags","uint",32)},i.prototype._boxProcessors.trun=function(){this._procFullBox(),this._procField("sample_count","uint",32),1&this.flags&&this._procField("data_offset","int",32),4&this.flags&&this._procField("first_sample_flags","uint",32),this._procEntries("samples",this.sample_count,(function(e){256&this.flags&&this._procEntryField(e,"sample_duration","uint",32),512&this.flags&&this._procEntryField(e,"sample_size","uint",32),1024&this.flags&&this._procEntryField(e,"sample_flags","uint",32),2048&this.flags&&this._procEntryField(e,"sample_composition_time_offset",1===this.version?"int":"uint",32)}))},i.prototype._boxProcessors["url "]=i.prototype._boxProcessors["urn "]=function(){this._procFullBox(),"urn "===this.type&&this._procField("name","string",-1),this._procField("location","string",-1)},i.prototype._boxProcessors.vlab=function(){this._procField("source_label","utf8")},i.prototype._boxProcessors.vmhd=function(){this._procFullBox(),this._procField("graphicsmode","uint",16),this._procFieldArray("opcolor",3,"uint",16)},i.prototype._boxProcessors.vttC=function(){this._procField("config","utf8")},i.prototype._boxProcessors.vtte=function(){}},5530:function(e,t,n){"use strict";e.exports=n(6146).polyfill()},6146:function(e,t,n){e.exports=function(){"use strict";function e(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,i=void 0,a=void 0,o=function(e,t){g[r]=e,g[r+1]=t,2===(r+=2)&&(a?a(h):v())};var s="undefined"!=typeof window?window:void 0,u=s||{},l=u.MutationObserver||u.WebKitMutationObserver,c="undefined"==typeof self&&"undefined"!=typeof process&&"[object process]"==={}.toString.call(process),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var e=setTimeout;return function(){return e(h,1)}}var g=new Array(1e3);function h(){for(var e=0;e<r;e+=2)(0,g[e])(g[e+1]),g[e]=void 0,g[e+1]=void 0;r=0}var p,m,y,E,v=void 0;function _(e,t){var n=this,r=new this.constructor(b);void 0===r[S]&&L(r);var i=n._state;if(i){var a=arguments[i-1];o((function(){return M(i,r,a,n._result)}))}else D(n,r,e,t);return r}function T(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(b);return R(t,e),t}v=c?function(){return process.nextTick(h)}:l?(m=0,y=new l(h),E=document.createTextNode(""),y.observe(E,{characterData:!0}),function(){E.data=m=++m%2}):f?((p=new MessageChannel).port1.onmessage=h,function(){return p.port2.postMessage(0)}):void 0===s?function(){try{var e=Function("return this")().require("vertx");return void 0!==(i=e.runOnLoop||e.runOnContext)?function(){i(h)}:d()}catch(e){return d()}}():d();var S=Math.random().toString(36).substring(2);function b(){}var A=void 0;function I(t,n,r){n.constructor===t.constructor&&r===_&&n.constructor.resolve===T?function(e,t){1===t._state?N(e,t._result):2===t._state?C(e,t._result):D(t,void 0,(function(t){return R(e,t)}),(function(t){return C(e,t)}))}(t,n):void 0===r?N(t,n):e(r)?function(e,t,n){o((function(e){var r=!1,i=function(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}(n,t,(function(n){r||(r=!0,t!==n?R(e,n):N(e,n))}),(function(t){r||(r=!0,C(e,t))}),e._label);!r&&i&&(r=!0,C(e,i))}),e)}(t,n,r):N(t,n)}function R(e,t){if(e===t)C(e,new TypeError("You cannot resolve a promise with itself"));else if(i=typeof(r=t),null===r||"object"!==i&&"function"!==i)N(e,t);else{var n=void 0;try{n=t.then}catch(t){return void C(e,t)}I(e,t,n)}var r,i}function w(e){e._onerror&&e._onerror(e._result),O(e)}function N(e,t){e._state===A&&(e._result=t,e._state=1,0!==e._subscribers.length&&o(O,e))}function C(e,t){e._state===A&&(e._state=2,e._result=t,o(w,e))}function D(e,t,n,r){var i=e._subscribers,a=i.length;e._onerror=null,i[a]=t,i[a+1]=n,i[a+2]=r,0===a&&e._state&&o(O,e)}function O(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r=void 0,i=void 0,a=e._result,o=0;o<t.length;o+=3)r=t[o],i=t[o+n],r?M(n,r,i,a):i(a);e._subscribers.length=0}}function M(t,n,r,i){var a=e(r),o=void 0,s=void 0,u=!0;if(a){try{o=r(i)}catch(e){u=!1,s=e}if(n===o)return void C(n,new TypeError("A promises callback cannot return that same promise."))}else o=i;n._state!==A||(a&&u?R(n,o):!1===u?C(n,s):1===t?N(n,o):2===t&&C(n,o))}var P=0;function L(e){e[S]=P++,e._state=void 0,e._result=void 0,e._subscribers=[]}var x=function(){function e(e,n){this._instanceConstructor=e,this.promise=new e(b),this.promise[S]||L(this.promise),t(n)?(this.length=n.length,this._remaining=n.length,this._result=new Array(this.length),0===this.length?N(this.promise,this._result):(this.length=this.length||0,this._enumerate(n),0===this._remaining&&N(this.promise,this._result))):C(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===A&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===T){var i=void 0,a=void 0,o=!1;try{i=e.then}catch(e){o=!0,a=e}if(i===_&&e._state!==A)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===F){var s=new n(b);o?C(s,a):I(s,e,i),this._willSettleAt(s,t)}else this._willSettleAt(new n((function(t){return t(e)})),t)}else this._willSettleAt(r(e),t)},e.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===A&&(this._remaining--,2===e?C(r,n):this._result[t]=n),0===this._remaining&&N(r,this._result)},e.prototype._willSettleAt=function(e,t){var n=this;D(e,void 0,(function(e){return n._settledAt(1,t,e)}),(function(e){return n._settledAt(2,t,e)}))},e}();var F=function(){function t(e){this[S]=P++,this._result=this._state=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t((function(t){R(e,t)}),(function(t){C(e,t)}))}catch(t){C(e,t)}}(this,e):function(){throw new TypeError("Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var n=this,r=n.constructor;return e(t)?n.then((function(e){return r.resolve(t()).then((function(){return e}))}),(function(e){return r.resolve(t()).then((function(){throw e}))})):n.then(t,t)},t}();return F.prototype.then=_,F.all=function(e){return new x(this,e).promise},F.race=function(e){var n=this;return t(e)?new n((function(t,r){for(var i=e.length,a=0;a<i;a++)n.resolve(e[a]).then(t,r)})):new n((function(e,t){return t(new TypeError("You must pass an array to race."))}))},F.resolve=T,F.reject=function(e){var t=new this(b);return C(t,e),t},F._setScheduler=function(e){a=e},F._setAsap=function(e){o=e},F._asap=o,F.polyfill=function(){var e=void 0;if(void 0!==n.g)e=n.g;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var r=null;try{r=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===r&&!t.cast)return}e.Promise=F},F.Promise=F,F}()},1159:function(e){"use strict";var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}p(e,t,a,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&p(e,"error",t,{once:!0})}(e,i)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var o=10;function s(e){if("function"!=typeof e)throw new TypeError(\'The "listener" argument must be of type Function. Received type \'+typeof e)}function u(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var i,a,o,l;if(s(n),void 0===(a=e._events)?(a=e._events=Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),o=a[t]),void 0===o)o=a[t]=n,++e._eventsCount;else if("function"==typeof o?o=a[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=u(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,l=c,console&&console.warn&&console.warn(l)}return e}function c(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=c.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):h(i,i.length)}function g(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function p(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError(\'The "emitter" argument must be of type EventEmitter. Received type \'+typeof e);e.addEventListener(t,(function i(a){r.once&&e.removeEventListener(t,i),n(a)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError(\'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received \'+e+".");o=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw new RangeError(\'The value of "n" is out of range. It must be a non-negative number. Received \'+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i="error"===e,a=this._events;if(void 0!==a)i=i&&void 0===a.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var u=a[e];if(void 0===u)return!1;if("function"==typeof u)r(u,this,t);else{var l=u.length,c=h(u,l);for(n=0;n<l;++n)r(c[n],this,t)}return!0},a.prototype.addListener=function(e,t){return l(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return l(this,e,t,!0)},a.prototype.once=function(e,t){return s(t),this.on(e,f(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return s(t),this.prependListener(e,f(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,r,i,a,o;if(s(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,a=Object.keys(n);for(r=0;r<a.length;++r)"removeListener"!==(i=a[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},3101:function(e){"use strict";var t=Array.isArray,n=Object.keys,r=Object.prototype.hasOwnProperty;e.exports=function e(i,a){if(i===a)return!0;if(i&&a&&"object"==typeof i&&"object"==typeof a){var o,s,u,l=t(i),c=t(a);if(l&&c){if((s=i.length)!=a.length)return!1;for(o=s;0!=o--;)if(!e(i[o],a[o]))return!1;return!0}if(l!=c)return!1;var f=i instanceof Date,d=a instanceof Date;if(f!=d)return!1;if(f&&d)return i.getTime()==a.getTime();var g=i instanceof RegExp,h=a instanceof RegExp;if(g!=h)return!1;if(g&&h)return i.toString()==a.toString();var p=n(i);if((s=p.length)!==n(a).length)return!1;for(o=s;0!=o--;)if(!r.call(a,p[o]))return!1;for(o=s;0!=o--;)if(!e(i[u=p[o]],a[u]))return!1;return!0}return i!=i&&a!=a}},3362:function(e,t,n){!function(e,t,n,r,i){function a(e){if("contents"in e)for(var t=("styleAttrs"in e?e.styleAttrs[r.byName.ruby.qname]:null),n="span"===e.kind&&("container"===t||"textContainer"===t||"baseContainer"===t),i=e.contents.length-1;i>=0;i--)!n||"styleAttrs"in e.contents[i]&&r.byName.ruby.qname in e.contents[i].styleAttrs?a(e.contents[i]):delete e.contents[i]}function o(e,t,n,r){var i=r&&"seq"===r.timeContainer,a=0;r&&(a=i&&n?n.end:r.begin),t.begin=t.explicit_begin?t.explicit_begin+a:a;var s=t.begin,u=null;if("sets"in t)for(var l=0;l<t.sets.length;l++)o(e,t.sets[l],u,t),s="seq"===t.timeContainer?t.sets[l].end:Math.max(s,t.sets[l].end),u=t.sets[l];if("contents"in t){if("contents"in t)for(var c=0;c<t.contents.length;c++)o(e,t.contents[c],u,t),s="seq"===t.timeContainer?t.contents[c].end:Math.max(s,t.contents[c].end),u=t.contents[c]}else s=i?t.begin:Number.POSITIVE_INFINITY;null!==t.explicit_end&&null!==t.explicit_dur?t.end=Math.min(t.begin+t.explicit_dur,a+t.explicit_end):null===t.explicit_end&&null!==t.explicit_dur?t.end=t.begin+t.explicit_dur:null!==t.explicit_end&&null===t.explicit_dur?t.end=a+t.explicit_end:t.end=s,delete t.explicit_begin,delete t.explicit_dur,delete t.explicit_end,e._registerEvent(t)}function s(e){this.node=e}function u(){this.events=[],this.head=new l,this.body=null}function l(){this.styling=new c,this.layout=new g}function c(){this.styles={},this.initials={}}function f(){this.id=null,this.styleAttrs=null,this.styleRefs=null}function d(){this.styleAttrs=null}function g(){this.regions={}}function h(e,t){p.call(this,"image"),this.src=e,this.type=t}function p(e){this.kind=e}function m(e){this.id=e}function y(e){this.regionID=e}function E(e){this.styleAttrs=e}function v(e){this.sets=e}function _(e){this.contents=e}function T(e,t,n){this.explicit_begin=e,this.explicit_end=t,this.explicit_dur=n}function S(){p.call(this,"body")}function b(){p.call(this,"div")}function A(){p.call(this,"p")}function I(){p.call(this,"span")}function R(){p.call(this,"span")}function w(){p.call(this,"br")}function N(){}function C(){}function D(e){return e&&"xml:id"in e.attributes&&e.attributes["xml:id"].value||null}function O(e){return e&&"style"in e.attributes?e.attributes.style.value.split(" "):[]}function M(e,t){var n={};if(null!==e)for(var i in e.attributes){var a=e.attributes[i].uri+" "+e.attributes[i].local,o=r.byQName[a];if(void 0!==o){var s=o.parse(e.attributes[i].value);null!==s?(n[a]=s,o===r.byName.zIndex&&U(t,"zIndex attribute present but not used by IMSC1 since regions do not overlap")):Z(t,"Cannot parse styling attribute "+a+" --\\x3e "+e.attributes[i].value)}}return n}function P(e,t,n){for(var r in e.attributes)if(e.attributes[r].uri===t&&e.attributes[r].local===n)return e.attributes[r].value;return null}function L(e,t,n){var r,i=null;return null!==(r=/^(\\d+(?:\\.\\d+)?)f$/.exec(n))?null!==t&&(i=parseFloat(r[1])/t):null!==(r=/^(\\d+(?:\\.\\d+)?)t$/.exec(n))?null!==e&&(i=parseFloat(r[1])/e):null!==(r=/^(\\d+(?:\\.\\d+)?)ms$/.exec(n))?i=parseFloat(r[1])/1e3:null!==(r=/^(\\d+(?:\\.\\d+)?)s$/.exec(n))?i=parseFloat(r[1]):null!==(r=/^(\\d+(?:\\.\\d+)?)h$/.exec(n))?i=3600*parseFloat(r[1]):null!==(r=/^(\\d+(?:\\.\\d+)?)m$/.exec(n))?i=60*parseFloat(r[1]):null!==(r=/^(\\d{2,}):(\\d\\d):(\\d\\d(?:\\.\\d+)?)$/.exec(n))?i=3600*parseInt(r[1])+60*parseInt(r[2])+parseFloat(r[3]):null!==(r=/^(\\d{2,}):(\\d\\d):(\\d\\d)\\:(\\d{2,})$/.exec(n))&&null!==t&&(i=3600*parseInt(r[1])+60*parseInt(r[2])+parseInt(r[3])+(null===r[4]?0:parseInt(r[4])/t)),i}function x(e,t,n){for(;t.styleRefs.length>0;){var r=t.styleRefs.pop();r in e.styles?(x(e,e.styles[r],n),k(e.styles[r].styleAttrs,t.styleAttrs)):Z(n,"Non-existant style id referenced")}}function F(e,t,n,r){for(var i=t.length-1;i>=0;i--){var a=t[i];a in e.styles?k(e.styles[a].styleAttrs,n):Z(r,"Non-existant style id referenced")}}function k(e,t){for(var n in e)e.hasOwnProperty(n)&&(n in t||(t[n]=e[n]))}function U(e,t){if(e&&e.warn&&e.warn(t))throw t}function Z(e,t){if(e&&e.error&&e.error(t))throw t}function B(e,t){throw e&&e.fatal&&e.fatal(t),t}function G(e,t){for(var n,r=0,i=e.length-1;r<=i;){var a=e[n=Math.floor((r+i)/2)];if(a<t)r=n+1;else{if(!(a>t))return{found:!0,index:n};i=n-1}}return{found:!1,index:r}}e.fromXML=function(e,i,p){var m=t.parser(!0,{xmlns:!0}),y=[],E=[],v=[],_=0,T=null;m.onclosetag=function(e){if(y[0]instanceof N)null!==T.head&&null!==T.head.styling&&F(T.head.styling,y[0].styleRefs,y[0].styleAttrs,i),delete y[0].styleRefs;else if(y[0]instanceof c)for(var t in y[0].styles)y[0].styles.hasOwnProperty(t)&&x(y[0],y[0].styles[t],i);else if(y[0]instanceof A||y[0]instanceof I){if(y[0].contents.length>1){var r,a=[y[0].contents[0]];for(r=1;r<y[0].contents.length;r++)y[0].contents[r]instanceof R&&a[a.length-1]instanceof R?a[a.length-1].text+=y[0].contents[r].text:a.push(y[0].contents[r]);y[0].contents=a}y[0]instanceof I&&1===y[0].contents.length&&y[0].contents[0]instanceof R&&(y[0].text=y[0].contents[0].text,delete y[0].contents)}else y[0]instanceof s&&(y[0].node.uri===n.ns_tt&&"metadata"===y[0].node.local?_--:_>0&&p&&"onCloseTag"in p&&p.onCloseTag());v.shift(),E.shift(),y.shift()},m.ontext=function(e){if(void 0===y[0]);else if(y[0]instanceof I||y[0]instanceof A){if(y[0]instanceof I){var t=y[0].styleAttrs[r.byName.ruby.qname];if("container"===t||"textContainer"===t||"baseContainer"===t)return}var n=new R;n.initFromText(T,y[0],e,E[0],v[0],i),y[0].contents.push(n)}else y[0]instanceof s&&_>0&&p&&"onText"in p&&p.onText(e)},m.onopentag=function(e){var t=e.attributes["xml:space"];t?v.unshift(t.value):0===v.length?v.unshift("default"):v.unshift(v[0]);var a=e.attributes["xml:lang"];if(a?E.unshift(a.value):0===E.length?E.unshift(""):E.unshift(E[0]),e.uri===n.ns_tt)if("tt"===e.local)null!==T&&B(i,"Two <tt> elements at ("+this.line+","+this.column+")"),(T=new u).initFromNode(e,E[0],i),y.unshift(T);else if("head"===e.local)y[0]instanceof u||B(i,"Parent of <head> element is not <tt> at ("+this.line+","+this.column+")"),y.unshift(T.head);else if("styling"===e.local)y[0]instanceof l||B(i,"Parent of <styling> element is not <head> at ("+this.line+","+this.column+")"),y.unshift(T.head.styling);else if("style"===e.local){var o;y[0]instanceof c?((o=new f).initFromNode(e,i),o.id?T.head.styling.styles[o.id]=o:Z(i,"<style> element missing @id attribute"),y.unshift(o)):y[0]instanceof N?((o=new f).initFromNode(e,i),k(o.styleAttrs,y[0].styleAttrs),y.unshift(o)):B(i,"Parent of <style> element is not <styling> or <region> at ("+this.line+","+this.column+")")}else if("initial"===e.local){var m;if(y[0]instanceof c){for(var R in(m=new d).initFromNode(e,i),m.styleAttrs)m.styleAttrs.hasOwnProperty(R)&&(T.head.styling.initials[R]=m.styleAttrs[R]);y.unshift(m)}else B(i,"Parent of <initial> element is not <styling> at ("+this.line+","+this.column+")")}else if("layout"===e.local)y[0]instanceof l||B(i,"Parent of <layout> element is not <head> at "+this.line+","+this.column+")"),y.unshift(T.head.layout);else if("region"===e.local){y[0]instanceof g||B(i,"Parent of <region> element is not <layout> at "+this.line+","+this.column+")");var D=new N;D.initFromNode(T,e,E[0],i),!D.id||D.id in T.head.layout.regions?Z(i,"Ignoring <region> with duplicate or missing @id at "+this.line+","+this.column+")"):T.head.layout.regions[D.id]=D,y.unshift(D)}else if("body"===e.local){y[0]instanceof u||B(i,"Parent of <body> element is not <tt> at "+this.line+","+this.column+")"),null!==T.body&&B(i,"Second <body> element at "+this.line+","+this.column+")");var O=new S;O.initFromNode(T,e,E[0],i),T.body=O,y.unshift(O)}else if("div"===e.local){y[0]instanceof b||y[0]instanceof S||B(i,"Parent of <div> element is not <body> or <div> at "+this.line+","+this.column+")");var M=new b;M.initFromNode(T,y[0],e,E[0],i);var P=M.styleAttrs[r.byName.backgroundImage.qname];P&&(M.contents.push(new h(P)),delete M.styleAttrs[r.byName.backgroundImage.qname]),y[0].contents.push(M),y.unshift(M)}else if("image"===e.local){y[0]instanceof b||B(i,"Parent of <image> element is not <div> at "+this.line+","+this.column+")");var L=new h;L.initFromNode(T,y[0],e,E[0],i),y[0].contents.push(L),y.unshift(L)}else if("p"===e.local){y[0]instanceof b||B(i,"Parent of <p> element is not <div> at "+this.line+","+this.column+")");var x=new A;x.initFromNode(T,y[0],e,E[0],i),y[0].contents.push(x),y.unshift(x)}else if("span"===e.local){y[0]instanceof I||y[0]instanceof A||B(i,"Parent of <span> element is not <span> or <p> at "+this.line+","+this.column+")");var F=new I;F.initFromNode(T,y[0],e,E[0],v[0],i),y[0].contents.push(F),y.unshift(F)}else if("br"===e.local){y[0]instanceof I||y[0]instanceof A||B(i,"Parent of <br> element is not <span> or <p> at "+this.line+","+this.column+")");var U=new w;U.initFromNode(T,y[0],e,E[0],i),y[0].contents.push(U),y.unshift(U)}else if("set"===e.local){y[0]instanceof I||y[0]instanceof A||y[0]instanceof b||y[0]instanceof S||y[0]instanceof N||y[0]instanceof w||B(i,"Parent of <set> element is not a content element or a region at "+this.line+","+this.column+")");var G=new C;G.initFromNode(T,y[0],e,i),y[0].sets.push(G),y.unshift(G)}else y.unshift(new s(e));else y.unshift(new s(e));if(y[0]instanceof s)if(e.uri===n.ns_tt&&"metadata"===e.local)_++;else if(_>0&&p&&"onOpenTag"in p){var q=[];for(var Y in e.attributes)q[e.attributes[Y].uri+" "+e.attributes[Y].local]={uri:e.attributes[Y].uri,local:e.attributes[Y].local,value:e.attributes[Y].value};p.onOpenTag(e.uri,e.local,q)}},m.write(e).close(),delete T.head.styling.styles;var D=!1;for(var O in T.head.layout.regions)if(T.head.layout.regions.hasOwnProperty(O)){D=!0;break}if(!D){var M=N.prototype.createDefaultRegion(T.lang);T.head.layout.regions[M.id]=M}for(var P in T.head.layout.regions)T.head.layout.regions.hasOwnProperty(P)&&o(T,T.head.layout.regions[P],null,null);return T.body&&o(T,T.body,null,null),T.body&&a(T.body),T},u.prototype.initFromNode=function(e,t,r){var a=function(e,t){var r=P(e,n.ns_ttp,"cellResolution"),i=15,a=32;if(null!==r){var o=/(\\d+) (\\d+)/.exec(r);null!==o?(a=parseInt(o[1]),i=parseInt(o[2])):U(t,"Malformed cellResolution value (using initial value instead)")}return{w:a,h:i}}(e,r);this.cellLength={h:new i.ComputedLength(0,1/a.h),w:new i.ComputedLength(1/a.w,0)};var o=function(e,t){var r,i=P(e,n.ns_ttp,"frameRate"),a=30;null!==i&&(null!==(r=/(\\d+)/.exec(i))?a=parseInt(r[1]):U(t,"Malformed frame rate attribute (using initial value instead)"));var o=P(e,n.ns_ttp,"frameRateMultiplier"),s=1;null!==o&&(null!==(r=/(\\d+) (\\d+)/.exec(o))?s=parseInt(r[1])/parseInt(r[2]):U(t,"Malformed frame rate multiplier attribute (using initial value instead)"));var u=s*a,l=1,c=P(e,n.ns_ttp,"tickRate");return null===c?null!==i&&(l=u):null!==(r=/(\\d+)/.exec(c))?l=parseInt(r[1]):U(t,"Malformed tick rate attribute (using initial value instead)"),{effectiveFrameRate:u,tickRate:l}}(e,r);this.effectiveFrameRate=o.effectiveFrameRate,this.tickRate=o.tickRate,this.aspectRatio=function(e,t){var r=P(e,n.ns_ittp,"aspectRatio");null===r&&(r=P(e,n.ns_ttp,"displayAspectRatio"));var i=null;if(null!==r){var a=/(\\d+)\\s+(\\d+)/.exec(r);if(null!==a){var o=parseInt(a[1]),s=parseInt(a[2]);0!==o&&0!==s?i=o/s:Z(t,"Illegal aspectRatio values (ignoring)")}else Z(t,"Malformed aspectRatio attribute (ignoring)")}return i}(e,r);var s=P(e,n.ns_ttp,"timeBase");null!==s&&"media"!==s&&B(r,"Unsupported time base");var u=function(e,t){var r=P(e,n.ns_tts,"extent");if(null===r)return null;var a=r.split(" ");if(2!==a.length)return U(t,"Malformed extent (ignoring)"),null;var o=i.parseLength(a[0]),s=i.parseLength(a[1]);return s&&o?{h:s,w:o}:(U(t,"Malformed extent values (ignoring)"),null)}(e,r);null===u?this.pxLength={h:null,w:null}:("px"===u.h.unit&&"px"===u.w.unit||B(r,"Extent on TT must be in px or absent"),this.pxLength={h:new i.ComputedLength(0,1/u.h.value),w:new i.ComputedLength(1/u.w.value,0)}),this.dimensions={h:new i.ComputedLength(0,1),w:new i.ComputedLength(1,0)},this.lang=t},u.prototype._registerEvent=function(e){if(!(e.end<=e.begin)){var t=G(this.events,e.begin);if(t.found||this.events.splice(t.index,0,e.begin),e.end!==Number.POSITIVE_INFINITY){var n=G(this.events,e.end);n.found||this.events.splice(n.index,0,e.end)}}},u.prototype.getMediaTimeRange=function(){return[this.events[0],this.events[this.events.length-1]]},u.prototype.getMediaTimeEvents=function(){return this.events},f.prototype.initFromNode=function(e,t){this.id=D(e),this.styleAttrs=M(e,t),this.styleRefs=O(e)},d.prototype.initFromNode=function(e,t){for(var r in this.styleAttrs={},e.attributes)if(e.attributes[r].uri===n.ns_itts||e.attributes[r].uri===n.ns_ebutts||e.attributes[r].uri===n.ns_tts){var i=e.attributes[r].uri+" "+e.attributes[r].local;this.styleAttrs[i]=e.attributes[r].value}},h.prototype.initFromNode=function(e,t,n,r,i){this.src="src"in n.attributes?n.attributes.src.value:null,this.src||Z(i,"Invalid image@src attribute"),this.type="type"in n.attributes?n.attributes.type.value:null,this.type||Z(i,"Invalid image@type attribute"),E.prototype.initFromNode.call(this,e,t,n,i),T.prototype.initFromNode.call(this,e,t,n,i),v.prototype.initFromNode.call(this,e,t,n,i),y.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},m.prototype.initFromNode=function(e,t,n,r){this.id=D(n)},y.prototype.initFromNode=function(e,t,n,r){this.regionID=function(e){return e&&"region"in e.attributes?e.attributes.region.value:""}(n)},E.prototype.initFromNode=function(e,t,n,r){this.styleAttrs=M(n,r),null!==e.head&&null!==e.head.styling&&F(e.head.styling,O(n),this.styleAttrs,r)},v.prototype.initFromNode=function(e,t,n,r){this.sets=[]},_.prototype.initFromNode=function(e,t,n,r){this.contents=[]},T.prototype.initFromNode=function(e,t,n,r){var i=function(e,t,n,r){var i=null;n&&"begin"in n.attributes&&null===(i=L(e.tickRate,e.effectiveFrameRate,n.attributes.begin.value))&&U(r,"Malformed begin value "+n.attributes.begin.value+" (using 0)");var a=null;n&&"dur"in n.attributes&&null===(a=L(e.tickRate,e.effectiveFrameRate,n.attributes.dur.value))&&U(r,"Malformed dur value "+n.attributes.dur.value+" (ignoring)");var o=null;return n&&"end"in n.attributes&&null===(o=L(e.tickRate,e.effectiveFrameRate,n.attributes.end.value))&&U(r,"Malformed end value (ignoring)"),{explicit_begin:i,explicit_end:o,explicit_dur:a}}(e,0,n,r);this.explicit_begin=i.explicit_begin,this.explicit_end=i.explicit_end,this.explicit_dur=i.explicit_dur,this.timeContainer=function(e,t){var n=e&&"timeContainer"in e.attributes?e.attributes.timeContainer.value:null;return n&&"par"!==n?"seq"===n?"seq":(Z(t,"Illegal value of timeContainer (assuming \'par\')"),"par"):"par"}(n,r)},S.prototype.initFromNode=function(e,t,n,r){E.prototype.initFromNode.call(this,e,null,t,r),T.prototype.initFromNode.call(this,e,null,t,r),v.prototype.initFromNode.call(this,e,null,t,r),y.prototype.initFromNode.call(this,e,null,t,r),_.prototype.initFromNode.call(this,e,null,t,r),this.lang=n},b.prototype.initFromNode=function(e,t,n,r,i){E.prototype.initFromNode.call(this,e,t,n,i),T.prototype.initFromNode.call(this,e,t,n,i),v.prototype.initFromNode.call(this,e,t,n,i),y.prototype.initFromNode.call(this,e,t,n,i),_.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},A.prototype.initFromNode=function(e,t,n,r,i){E.prototype.initFromNode.call(this,e,t,n,i),T.prototype.initFromNode.call(this,e,t,n,i),v.prototype.initFromNode.call(this,e,t,n,i),y.prototype.initFromNode.call(this,e,t,n,i),_.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},I.prototype.initFromNode=function(e,t,n,r,i,a){E.prototype.initFromNode.call(this,e,t,n,a),T.prototype.initFromNode.call(this,e,t,n,a),v.prototype.initFromNode.call(this,e,t,n,a),y.prototype.initFromNode.call(this,e,t,n,a),_.prototype.initFromNode.call(this,e,t,n,a),this.space=i,this.lang=r},R.prototype.initFromText=function(e,t,n,r,i,a){T.prototype.initFromNode.call(this,e,t,null,a),this.text=n,this.space=i,this.lang=r},w.prototype.initFromNode=function(e,t,n,r,i){y.prototype.initFromNode.call(this,e,t,n,i),T.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},N.prototype.createDefaultRegion=function(e){var t=new N;return m.call(t,""),E.call(t,{}),v.call(t,[]),T.call(t,0,Number.POSITIVE_INFINITY,null),this.lang=e,t},N.prototype.initFromNode=function(e,t,n,r){m.prototype.initFromNode.call(this,e,null,t,r),T.prototype.initFromNode.call(this,e,null,t,r),v.prototype.initFromNode.call(this,e,null,t,r),this.styleAttrs=M(t,r),this.styleRefs=O(t),this.lang=n},C.prototype.initFromNode=function(e,t,n,r){T.prototype.initFromNode.call(this,e,t,n,r);var i=M(n,r);for(var a in this.qname=null,this.value=null,i)if(i.hasOwnProperty(a)){if(this.qname){Z(r,"More than one style specified on set");break}this.qname=a,this.value=i[a]}}}(t,"undefined"==typeof sax?n(5378):sax,"undefined"==typeof imscNames?n(210):imscNames,"undefined"==typeof imscStyles?n(6811):imscStyles,"undefined"==typeof imscUtils?n(5926):imscUtils)},506:function(e,t,n){var r=/firefox/i.test(navigator.userAgent);!function(e,t,n){function i(e,t,f,g){var h;if("region"===f.kind)(h=document.createElement("div")).style.position="absolute";else if("body"===f.kind)h=document.createElement("div");else if("div"===f.kind)h=document.createElement("div");else if("image"===f.kind){if(h=document.createElement("img"),null!==e.imgResolver&&null!==f.src){var y=e.imgResolver(f.src,h);y&&(h.src=y),h.height=e.regionH,h.width=e.regionW}}else if("p"===f.kind)h=document.createElement("p");else if("span"===f.kind)if("container"===f.styleAttrs[n.byName.ruby.qname])h=document.createElement("ruby"),e.ruby=!0;else if("base"===f.styleAttrs[n.byName.ruby.qname])h=document.createElement("span");else if("text"===f.styleAttrs[n.byName.ruby.qname])h=document.createElement("rt");else if("baseContainer"===f.styleAttrs[n.byName.ruby.qname])h=document.createElement("rbc");else if("textContainer"===f.styleAttrs[n.byName.ruby.qname])h=document.createElement("rtc");else{if("delimiter"===f.styleAttrs[n.byName.ruby.qname])return;h=document.createElement("span")}else"br"===f.kind&&(h=document.createElement("br"));if(h){if(f.lang&&("region"!==f.kind&&f.lang===g.lang||(h.lang=f.lang)),t.appendChild(h),h.style.margin="0","region"===f.kind){var _=f.styleAttrs[n.byName.writingMode.qname];"lrtb"===_||"lr"===_?(e.ipd="lr",e.bpd="tb"):"rltb"===_||"rl"===_?(e.ipd="rl",e.bpd="tb"):"tblr"===_?(e.ipd="tb",e.bpd="lr"):"tbrl"!==_&&"tb"!==_||(e.ipd="tb",e.bpd="rl")}else if("p"===f.kind&&"tb"===e.bpd){var T=f.styleAttrs[n.byName.direction.qname];e.ipd="ltr"===T?"lr":"rl"}for(var S=0;S<d.length;S++){var b=d[S],A=f.styleAttrs[b.qname];void 0!==A&&null!==b.map&&b.map(e,h,f,A)}var I=h,R=f.styleAttrs[n.byName.linePadding.qname];if(R&&!R.isZero()){var w=R.toUsedLength(e.w,e.h);if(w>0){var N=Math.ceil(w)+"px";"tb"===e.bpd?(I.style.paddingLeft=N,I.style.paddingRight=N):(I.style.paddingTop=N,I.style.paddingBottom=N),e.lp=R}}var C=f.styleAttrs[n.byName.multiRowAlign.qname];if(C&&"auto"!==C){var D=document.createElement("span");D.style.display="inline-block",D.style.textAlign=C,h.appendChild(D),I=D,e.mra=C}var O=f.styleAttrs[n.byName.rubyReserve.qname];if(O&&"none"!==O[0]&&(e.rubyReserve=O),f.styleAttrs[n.byName.fillLineGap.qname]&&(e.flg=!0),"span"===f.kind&&f.text){var M=f.styleAttrs[n.byName.textEmphasis.qname];if(M&&"none"!==M.style&&(e.textEmphasis=!0),n.byName.textCombine.qname in f.styleAttrs&&"all"===f.styleAttrs[n.byName.textCombine.qname])h.textContent=f.text,h._isd_element=f,M&&c(e,h,0,M);else for(var P="",L=0;L<f.text.length;L++){P+=f.text.charAt(L);var x=f.text.charCodeAt(L);if(x<55296||x>56319||L===f.text.length-1){var F=document.createElement("span");F.textContent=P,M&&c(e,F,0,M),h.appendChild(F),P="",F._isd_element=f}}}if("contents"in f)for(var k=0;k<f.contents.length;k++)i(e,I,f.contents[k],f);var U=[];if("p"===f.kind&&(l(e,I,U,null),e.rubyReserve&&(function(e,t){for(var n=0;n<e.length;n++){var r,i,a=document.createElement("ruby"),o=document.createElement("span");o.textContent="",a.appendChild(o);var s,u=t.rubyReserve[1].toUsedLength(t.w,t.h)+"px";"both"===t.rubyReserve[0]||"outside"===t.rubyReserve[0]&&1==e.length?((r=document.createElement("rtc")).style[m]=p?"after":"under",r.textContent="",r.style.fontSize=u,(i=document.createElement("rtc")).style[m]=p?"before":"over",i.textContent="",i.style.fontSize=u,a.appendChild(r),a.appendChild(i)):((r=document.createElement("rtc")).textContent="",r.style.fontSize=u,s="after"===t.rubyReserve[0]||"outside"===t.rubyReserve[0]&&n>0?p?"after":"tb"===t.bpd||"rl"===t.bpd?"under":"over":p?"before":"tb"===t.bpd||"rl"===t.bpd?"over":"under",r.style[m]=s,a.appendChild(r));for(var l=null,c=0;c<e[n].rbc.length;c++)if("ruby"===e[n].rbc[c].localName){l=e[n].rbc[c];for(var f=0;f<l.style.length;f++)a.style.setProperty(l.style.item(f),l.style.getPropertyValue(l.style.item(f)));break}(l=l||e[n].elements[0].node).parentElement.insertBefore(a,l)}}(U,e),e.rubyReserve=null),(e.ruby||e.rubyReserve)&&(function(e,t){for(var n=0;n<e.length;n++)for(var r=0;r<e[n].rbc.length;r++){var i;e[n].rbc[r].style[m]||(i=p?0===n?"before":"after":"tb"===t.bpd||"rl"===t.bpd?0===n?"over":"under":0===n?"under":"over",e[n].rbc[r].style[m]=i)}}(U,e),e.ruby=null),e.textEmphasis&&(function(e,t){for(var n=0;n<e.length;n++)for(var r=0;r<e[n].te.length;r++){var i;e[n].te[r].style[E]&&"none"!==e[n].te[r].style[E]||(i="tb"===t.bpd?0===n?"left over":"left under":"rl"===t.bpd?0===n?"right under":"left under":0===n?"left under":"right under",e[n].te[r].style[E]=i)}}(U,e),e.textEmphasis=null),e.mra&&(function(e){for(var t=0;t<e.length-1;t++){var n=e[t].elements.length;if(0!==n&&!1===e[t].br){var r=document.createElement("br"),i=e[t].elements[n-1].node;i.parentElement.insertBefore(r,i.nextSibling)}}}(U),e.mra=null),e.lp&&(function(e,t,n){if(null!==e)for(var i=0;i<e.length;i++){var a=e[i].elements.length,o=Math.ceil(t)+"px",s="-"+Math.ceil(t)+"px";if(0!==a){var u=e[i].elements[e[i].start_elem],l=e[i].elements[e[i].end_elem];if(u===l){var c=u.node.getBoundingClientRect();if(0==c.width||0==c.height)continue}"lr"===n.ipd?(u.node.style.marginLeft=s,u.node.style.paddingLeft=o):"rl"===n.ipd?(u.node.style.paddingRight=o,u.node.style.marginRight=s):"tb"===n.ipd&&(u.node.style.paddingTop=o,u.node.style.marginTop=s),"lr"===n.ipd?(r||(l.node.style.marginRight=s),l.node.style.paddingRight=o):"rl"===n.ipd?(l.node.style.paddingLeft=o,r||(l.node.style.marginLeft=s)):"tb"===n.ipd&&(l.node.style.paddingBottom=o,l.node.style.marginBottom=s)}}}(U,e.lp.toUsedLength(e.w,e.h),e),e.lp=null),function(e,t){for(var n=0;n<e.length;n++)for(var r=e[n],i=1;i<r.elements.length;){var s=r.elements[i-1],u=r.elements[i];o(s.node,u.node,t)?r.elements.splice(i,1):i++}for(var l,c,f=[],d=0;d<e.length;d++)for(var g=0;g<e[d].elements.length;g++)(c=a(l=e[d].elements[g].node,f,!1))&&(l.style.backgroundColor=c);for(var h=0;h<f.length;h++)f[h].style.backgroundColor=""}(U,e),e.flg)){var Z=u(I.getBoundingClientRect(),e);!function(e,t,n,r,i){for(var a=Math.sign(n-t),o=0;o<=e.length;o++){var s,u,l,c;if(s=0===o?Math.round(t):o===e.length?Math.round(n):Math.round((e[o-1].after+e[o].before)/2),o>0&&e[o-1])for(l=0;l<e[o-1].elements.length;l++)u=a*(s-(c=e[o-1].elements[l]).after)+"px","lr"===r.bpd?c.node.style.paddingRight=u:"rl"===r.bpd?c.node.style.paddingLeft=u:"tb"===r.bpd&&(c.node.style.paddingBottom=u);if(o<e.length)for(l=0;l<e[o].elements.length;l++)u=a*((c=e[o].elements[l]).before-s)+"px","lr"===r.bpd?c.node.style.paddingLeft=u:"rl"===r.bpd?c.node.style.paddingRight=u:"tb"===r.bpd&&(c.node.style.paddingTop=u)}}(U,Z.before,Z.after,e),e.flg=null}if("region"===f.kind&&"tb"===e.bpd&&e.enableRollUp&&f.contents.length>0&&"after"===f.styleAttrs[n.byName.displayAlign.qname]){l(e,I,U,null);var B=new s(""===f.id?"_":f.id,U);if(e.currentISDState[B.id]=B,e.previousISDState&&B.id in e.previousISDState&&e.previousISDState[B.id].plist.length>0&&B.plist.length>1&&B.plist[B.plist.length-2].text===e.previousISDState[B.id].plist[e.previousISDState[B.id].plist.length-1].text){var G=h.firstElementChild,q=B.plist[B.plist.length-1].after-B.plist[B.plist.length-1].before;G.style.bottom="-"+q+"px",G.style.transition="transform 0.4s",G.style.position="relative",G.style.transform="translateY(-"+q+"px)"}}}else v(e.errorHandler,"Error processing ISD element kind: "+f.kind)}function a(e,t,n){return e.style.backgroundColor?(n&&!t.includes(e)&&t.push(e),e.style.backgroundColor):"SPAN"===e.parentElement.nodeName||"RUBY"===e.parentElement.nodeName||"RBC"===e.parentElement.nodeName||"RTC"===e.parentElement.nodeName||"RT"===e.parentElement.nodeName?a(e.parentElement,t,!0):void 0}function o(e,t,n){if("SPAN"===e.tagName&&"SPAN"===t.tagName&&e._isd_element===t._isd_element){if(!e._isd_element)return v(n.errorHandler,"Internal error: HTML span is not linked to a source element; cannot merge spans."),!1;e.textContent+=t.textContent;for(var r=0;r<t.style.length;r++){var i=t.style[r];(i.indexOf("border")>=0||i.indexOf("padding")>=0||i.indexOf("margin")>=0)&&(e.style[i]=t.style[i])}return t.parentElement.removeChild(t),!0}return!1}function s(e,t){this.id=e,this.plist=t}function u(e,t){var n={before:null,after:null,start:null,end:null};return"tb"===t.bpd?(n.before=e.top,n.after=e.bottom,"lr"===t.ipd?(n.start=e.left,n.end=e.right):(n.start=e.right,n.end=e.left)):"lr"===t.bpd?(n.before=e.left,n.after=e.right,n.start=e.top,n.end=e.bottom):"rl"===t.bpd&&(n.before=e.right,n.after=e.left,n.start=e.top,n.end=e.bottom),n}function l(e,t,n,r){if("rt"!==t.localName&&"rtc"!==t.localName){var i,a,o,s,c=t.style.backgroundColor||r;if(0===t.childElementCount)if("span"===t.localName||"rb"===t.localName){var f=u(t.getBoundingClientRect(),e);if(0!==n.length&&(i=f.before,a=f.after,o=n[n.length-1].before,a<(s=n[n.length-1].after)&&i>o||s<=a&&o>=i)){var d=Math.sign(f.after-f.before),g=Math.sign(f.end-f.start);d*(f.before-n[n.length-1].before)<0&&(n[n.length-1].before=f.before),d*(f.after-n[n.length-1].after)>0&&(n[n.length-1].after=f.after),g*(f.start-n[n.length-1].start)<0&&(n[n.length-1].start=f.start,n[n.length-1].start_elem=n[n.length-1].elements.length),g*(f.end-n[n.length-1].end)>0&&(n[n.length-1].end=f.end,n[n.length-1].end_elem=n[n.length-1].elements.length)}else n.push({before:f.before,after:f.after,start:f.start,end:f.end,start_elem:0,end_elem:0,elements:[],rbc:[],te:[],text:"",br:!1});n[n.length-1].text+=t.textContent,n[n.length-1].elements.push({node:t,bgcolor:c,before:f.before,after:f.after})}else"br"===t.localName&&0!==n.length&&(n[n.length-1].br=!0);else for(var h=t.firstChild;h;)h.nodeType===Node.ELEMENT_NODE&&(l(e,h,n,c),"ruby"===h.localName||"rtc"===h.localName?n.length>0&&n[n.length-1].rbc.push(h):"span"===h.localName&&h.style[y]&&"none"!==h.style[y]&&n.length>0&&n[n.length-1].te.push(h)),h=h.nextSibling}}function c(e,t,n,r){var i;"none"!==r.style&&("auto"===r.style?t.style[y]="filled":t.style[y]=r.style+" "+r.symbol,("before"===r.position||"after"===r.position)&&(i="tb"===e.bpd?"before"===r.position?"left over":"left under":"rl"===e.bpd?"before"===r.position?"right under":"left under":"before"===r.position?"left under":"right under",t.style[E]=i))}function f(e,t){this.qname=e,this.map=t}e.render=function(e,t,n,r,a,o,s,u,l){var c=r||t.clientHeight,f=a||t.clientWidth;if(null!==e.aspectRatio){var d=c*e.aspectRatio;d>f?c=Math.round(f/e.aspectRatio):f=d}var g=document.createElement("div");g.style.position="relative",g.style.width=f+"px",g.style.height=c+"px",g.style.margin="auto",g.style.top=0,g.style.bottom=0,g.style.left=0,g.style.right=0,g.style.zIndex=0;var h={h:c,w:f,regionH:null,regionW:null,imgResolver:n,displayForcedOnlyMode:o||!1,isd:e,errorHandler:s,previousISDState:u,enableRollUp:l||!1,currentISDState:{},flg:null,lp:null,mra:null,ipd:null,bpd:null,ruby:null,textEmphasis:null,rubyReserve:null};if(t.appendChild(g),"contents"in e)for(var p=0;p<e.contents.length;p++)i(h,g,e.contents[p],e);return h.currentISDState};for(var d=[new f("http://www.w3.org/ns/ttml#styling backgroundColor",(function(e,t,n,r){0!==r[3]&&(t.style.backgroundColor="rgba("+r[0].toString()+","+r[1].toString()+","+r[2].toString()+","+(r[3]/255).toString()+")")})),new f("http://www.w3.org/ns/ttml#styling color",(function(e,t,n,r){t.style.color="rgba("+r[0].toString()+","+r[1].toString()+","+r[2].toString()+","+(r[3]/255).toString()+")"})),new f("http://www.w3.org/ns/ttml#styling direction",(function(e,t,n,r){t.style.direction=r})),new f("http://www.w3.org/ns/ttml#styling display",(function(e,t,n,r){})),new f("http://www.w3.org/ns/ttml#styling displayAlign",(function(e,t,n,r){t.style.display="flex",t.style.flexDirection="column","before"===r?t.style.justifyContent="flex-start":"center"===r?t.style.justifyContent="center":"after"===r&&(t.style.justifyContent="flex-end")})),new f("http://www.w3.org/ns/ttml#styling extent",(function(e,t,n,r){e.regionH=r.h.toUsedLength(e.w,e.h),e.regionW=r.w.toUsedLength(e.w,e.h);var i=0,a=0,o=n.styleAttrs["http://www.w3.org/ns/ttml#styling padding"];o&&(i=o[0].toUsedLength(e.w,e.h)+o[2].toUsedLength(e.w,e.h),a=o[1].toUsedLength(e.w,e.h)+o[3].toUsedLength(e.w,e.h)),t.style.height=e.regionH-i+"px",t.style.width=e.regionW-a+"px"})),new f("http://www.w3.org/ns/ttml#styling fontFamily",(function(e,t,n,r){for(var i=[],a=0;a<r.length;a++)r[a]=r[a].trim(),"monospaceSerif"===r[a]?(i.push("Courier New"),i.push(\'"Liberation Mono"\'),i.push("Courier"),i.push("monospace")):"proportionalSansSerif"===r[a]?(i.push("Arial"),i.push("Helvetica"),i.push(\'"Liberation Sans"\'),i.push("sans-serif")):"monospace"===r[a]?i.push("monospace"):"sansSerif"===r[a]?i.push("sans-serif"):"serif"===r[a]?i.push("serif"):"monospaceSansSerif"===r[a]?(i.push("Consolas"),i.push("monospace")):"proportionalSerif"===r[a]?i.push("serif"):i.push(r[a]);if(i.length>0){for(var o=[i[0]],s=1;s<i.length;s++)-1==o.indexOf(i[s])&&o.push(i[s]);i=o}t.style.fontFamily=i.join(",")})),new f("http://www.w3.org/ns/ttml#styling shear",(function(e,t,n,r){if(0!==r){var i=-.9*r;"tb"===e.bpd?t.style.transform="skewX("+i+"deg)":t.style.transform="skewY("+i+"deg)"}})),new f("http://www.w3.org/ns/ttml#styling fontSize",(function(e,t,n,r){t.style.fontSize=r.toUsedLength(e.w,e.h)+"px"})),new f("http://www.w3.org/ns/ttml#styling fontStyle",(function(e,t,n,r){t.style.fontStyle=r})),new f("http://www.w3.org/ns/ttml#styling fontWeight",(function(e,t,n,r){t.style.fontWeight=r})),new f("http://www.w3.org/ns/ttml#styling lineHeight",(function(e,t,n,r){t.style.lineHeight="normal"===r?"normal":r.toUsedLength(e.w,e.h)+"px"})),new f("http://www.w3.org/ns/ttml#styling opacity",(function(e,t,n,r){t.style.opacity=r})),new f("http://www.w3.org/ns/ttml#styling origin",(function(e,t,n,r){t.style.top=r.h.toUsedLength(e.w,e.h)+"px",t.style.left=r.w.toUsedLength(e.w,e.h)+"px"})),new f("http://www.w3.org/ns/ttml#styling overflow",(function(e,t,n,r){t.style.overflow=r})),new f("http://www.w3.org/ns/ttml#styling padding",(function(e,t,n,r){var i=[];i[0]=r[0].toUsedLength(e.w,e.h)+"px",i[1]=r[3].toUsedLength(e.w,e.h)+"px",i[2]=r[2].toUsedLength(e.w,e.h)+"px",i[3]=r[1].toUsedLength(e.w,e.h)+"px",t.style.padding=i.join(" ")})),new f("http://www.w3.org/ns/ttml#styling position",(function(e,t,n,r){t.style.top=r.h.toUsedLength(e.w,e.h)+"px",t.style.left=r.w.toUsedLength(e.w,e.h)+"px"})),new f("http://www.w3.org/ns/ttml#styling rubyAlign",(function(e,t,n,r){t.style.rubyAlign="spaceAround"===r?"space-around":"center"})),new f("http://www.w3.org/ns/ttml#styling rubyPosition",(function(e,t,n,r){var i;"before"!==r&&"after"!==r||(i=p?r:"tb"===e.bpd||"rl"===e.bpd?"before"===r?"over":"under":"before"===r?"under":"over",t.parentElement.style[m]=i)})),new f("http://www.w3.org/ns/ttml#styling showBackground",null),new f("http://www.w3.org/ns/ttml#styling textAlign",(function(e,t,n,r){var i;i="start"===r?"rl"===e.ipd?"right":"left":"end"===r?"rl"===e.ipd?"left":"right":r,t.style.textAlign=i})),new f("http://www.w3.org/ns/ttml#styling textDecoration",(function(e,t,n,r){t.style.textDecoration=r.join(" ").replace("lineThrough","line-through")})),new f("http://www.w3.org/ns/ttml#styling textOutline",(function(e,t,n,r){})),new f("http://www.w3.org/ns/ttml#styling textShadow",(function(e,t,r,i){var a=r.styleAttrs[n.byName.textOutline.qname];if("none"===i&&"none"===a)t.style.textShadow="";else{var o=[];if("none"!==a){var s="rgba("+a.color[0].toString()+","+a.color[1].toString()+","+a.color[2].toString()+","+(a.color[3]/255).toString()+")";o.push("1px 1px 1px "+s),o.push("-1px 1px 1px "+s),o.push("1px -1px 1px "+s),o.push("-1px -1px 1px "+s)}if("none"!==i)for(var u=0;u<i.length;u++)o.push(i[u].x_off.toUsedLength(e.w,e.h)+"px "+i[u].y_off.toUsedLength(e.w,e.h)+"px "+i[u].b_radius.toUsedLength(e.w,e.h)+"px rgba("+i[u].color[0].toString()+","+i[u].color[1].toString()+","+i[u].color[2].toString()+","+(i[u].color[3]/255).toString()+")");t.style.textShadow=o.join(",")}})),new f("http://www.w3.org/ns/ttml#styling textCombine",(function(e,t,n,r){t.style.textCombineUpright=r})),new f("http://www.w3.org/ns/ttml#styling textEmphasis",(function(e,t,n,r){})),new f("http://www.w3.org/ns/ttml#styling unicodeBidi",(function(e,t,n,r){var i;i="bidiOverride"===r?"bidi-override":r,t.style.unicodeBidi=i})),new f("http://www.w3.org/ns/ttml#styling visibility",(function(e,t,n,r){t.style.visibility=r})),new f("http://www.w3.org/ns/ttml#styling wrapOption",(function(e,t,n,r){"wrap"===r?"preserve"===n.space?t.style.whiteSpace="pre-wrap":t.style.whiteSpace="normal":"preserve"===n.space?t.style.whiteSpace="pre":t.style.whiteSpace="noWrap"})),new f("http://www.w3.org/ns/ttml#styling writingMode",(function(e,t,n,r){"lrtb"===r||"lr"===r||"rltb"===r||"rl"===r?t.style.writingMode="horizontal-tb":"tblr"===r?t.style.writingMode="vertical-lr":"tbrl"!==r&&"tb"!==r||(t.style.writingMode="vertical-rl")})),new f("http://www.w3.org/ns/ttml#styling zIndex",(function(e,t,n,r){t.style.zIndex=r})),new f("http://www.w3.org/ns/ttml/profile/imsc1#styling forcedDisplay",(function(e,t,n,r){e.displayForcedOnlyMode&&!1===r&&(t.style.visibility="hidden")}))],g={},h=0;h<d.length;h++)g[d[h].qname]=d[h];var p="webkitRubyPosition"in window.getComputedStyle(document.documentElement),m=p?"webkitRubyPosition":"rubyPosition",y="webkitTextEmphasisStyle"in window.getComputedStyle(document.documentElement)?"webkitTextEmphasisStyle":"textEmphasisStyle",E="webkitTextEmphasisPosition"in window.getComputedStyle(document.documentElement)?"webkitTextEmphasisPosition":"textEmphasisPosition";function v(e,t){if(e&&e.error&&e.error(t))throw t}}(t,"undefined"==typeof imscNames?n(210):imscNames,"undefined"==typeof imscStyles?n(6811):imscStyles,"undefined"==typeof imscUtils?n(5926):imscUtils)},4080:function(e,t,n){!function(e,t,n,r){e.generateISD=function(e,t,r){var i,o=new u(e),s={},l={},c=e.head.styling.initials[n.byName.showBackground.qname],f=e.head.styling.initials[n.byName.backgroundColor.qname];for(var d in e.head.layout.regions)if(e.head.layout.regions.hasOwnProperty(d)){var g=e.head.layout.regions[d],h=g.styleAttrs[n.byName.showBackground.qname]||c,p=g.styleAttrs[n.byName.backgroundColor.qname]||f;l[g.id]=("always"===h||void 0===h)&&void 0!==p&&!(t<g.begin||t>=g.end)}for(var m in e.body&&e.body.regionID&&(l[e.body.regionID]=!0),i=null!==e.body?function e(t,n){if(n.contents){var r={};for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i]);return r.contents=[],n.contents.filter((function(e){return!(t<e.begin||t>=e.end)})).forEach((function(n){var i=e(t,n);i.regionID&&(l[i.regionID]=!0),null!==i&&r.contents.push(i)})),r}return n}(t,e.body):null,void 0!==l[""]&&(l[""]=!0),l)if(l[m]){var y=a(e,t,e.head.layout.regions[m],i,null,"",e.head.layout.regions[m],r,s);null!==y&&o.contents.push(y.element)}return o};var i=[n.byName.color.qname,n.byName.textCombine.qname,n.byName.textDecoration.qname,n.byName.textEmphasis.qname,n.byName.textOutline.qname,n.byName.textShadow.qname];function a(e,t,u,f,d,g,h,p,m){if(t<h.begin||t>=h.end)return null;var y="regionID"in h&&""!==h.regionID?h.regionID:g;if(null!==d&&y!==u.id&&(!("contents"in h)||"contents"in h&&0===h.contents.length||""!==y))return null;var E=new l(h);if("sets"in h)for(var v=0;v<h.sets.length;v++)t<h.sets[v].begin||t>=h.sets[v].end||(E.styleAttrs[h.sets[v].qname]=h.sets[v].value);var _={};for(var T in E.styleAttrs)if(E.styleAttrs.hasOwnProperty(T)&&(_[T]=!0,"region"===E.kind&&T===n.byName.writingMode.qname&&!(n.byName.direction.qname in E.styleAttrs))){var S=E.styleAttrs[T];"lrtb"===S||"lr"===S?E.styleAttrs[n.byName.direction.qname]="ltr":"rltb"!==S&&"rl"!==S||(E.styleAttrs[n.byName.direction.qname]="rtl")}if(null!==d)for(var b=0;b<n.all.length;b++){var A=n.all[b];if(A.qname===n.byName.textDecoration.qname){var I=d.styleAttrs[A.qname],R=E.styleAttrs[A.qname],w=[];void 0===R?w=I:-1===R.indexOf("none")?((-1===R.indexOf("noUnderline")&&-1!==I.indexOf("underline")||-1!==R.indexOf("underline"))&&w.push("underline"),(-1===R.indexOf("noLineThrough")&&-1!==I.indexOf("lineThrough")||-1!==R.indexOf("lineThrough"))&&w.push("lineThrough"),(-1===R.indexOf("noOverline")&&-1!==I.indexOf("overline")||-1!==R.indexOf("overline"))&&w.push("overline")):w.push("none"),E.styleAttrs[A.qname]=w}else if(A.qname!==n.byName.fontSize.qname||A.qname in E.styleAttrs||"span"!==E.kind||"textContainer"!==E.styleAttrs[n.byName.ruby.qname])if(A.qname!==n.byName.fontSize.qname||A.qname in E.styleAttrs||"span"!==E.kind||"text"!==E.styleAttrs[n.byName.ruby.qname])A.inherit&&A.qname in d.styleAttrs&&!(A.qname in E.styleAttrs)&&(E.styleAttrs[A.qname]=d.styleAttrs[A.qname]);else{var N=d.styleAttrs[n.byName.fontSize.qname];"textContainer"===d.styleAttrs[n.byName.ruby.qname]?E.styleAttrs[A.qname]=N:E.styleAttrs[A.qname]=new r.ComputedLength(.5*N.rw,.5*N.rh)}else{var C=d.styleAttrs[n.byName.fontSize.qname];E.styleAttrs[A.qname]=new r.ComputedLength(.5*C.rw,.5*C.rh)}}for(var D=0;D<n.all.length;D++){var O=n.all[D];if(!(O.qname in E.styleAttrs)&&!(O.qname===n.byName.position.qname&&n.byName.origin.qname in E.styleAttrs||O.qname===n.byName.origin.qname&&n.byName.position.qname in E.styleAttrs)){var M=e.head.styling.initials[O.qname]||O.initial;if(null!==M&&("region"===E.kind||!1===O.inherit&&null!==M)){var P=O.parse(M);null!==P?(E.styleAttrs[O.qname]=P,_[O.qname]=!0):c(p,"Invalid initial value for \'"+O.qname+"\' on element \'"+E.kind)}}}for(var L=0;L<n.all.length;L++){var x=n.all[L];if(x.qname in _&&null!==x.compute){var F=x.compute(e,d,E,E.styleAttrs[x.qname],m);null!==F?E.styleAttrs[x.qname]=F:(E.styleAttrs[x.qname]=x.compute(e,d,E,x.parse(x.initial),m),c(p,"Style \'"+x.qname+"\' on element \'"+E.kind+"\' cannot be computed"))}}if("none"===E.styleAttrs[n.byName.display.qname])return null;var k=null;null===d?k=null===f?[]:[f]:"contents"in h&&(k=h.contents);for(var U=0;null!==k&&U<k.length;U++){var Z=a(e,t,u,f,E,y,k[U],p,m);null!==Z&&E.contents.push(Z.element)}for(var B in E.styleAttrs)if(E.styleAttrs.hasOwnProperty(B)){var G=!1;if("span"===E.kind){var q=E.styleAttrs[n.byName.ruby.qname];(G=("container"===q||"textContainer"===q||"baseContainer"===q)&&-1!==i.indexOf(B))||(G="container"!==q&&B===n.byName.rubyAlign.qname),G||(G=!("textContainer"===q||"text"===q)&&B===n.byName.rubyPosition.qname)}if(!G){var Y=n.byQName[B];"applies"in Y&&(G=-1===Y.applies.indexOf(E.kind))}G&&delete E.styleAttrs[B]}var j=E.styleAttrs[n.byName.ruby.qname];if("p"===E.kind||"span"===E.kind&&("textContainer"===j||"text"===j)){var H=[];o(E,H),function(e){for(var t,n=0;n<e.length;)if("br"!==(t=e[n]).kind&&"preserve"!==t.space){var r=t.text.replace(/[\\t\\r\\n ]+/g," ");/^[ ]/.test(r)&&(0===n||("br"===(i=e[n-1]).kind||/[\\r\\n\\t ]$/.test(i.text)))&&(r=r.substring(1)),t.text=r,0===r.length?e.splice(n,1):n++}else n++;var i,a;for(n=0;n<e.length;n++)"br"!==(t=e[n]).kind&&"preserve"!==t.space?/[ ]$/.test(t.text)&&(n===e.length-1||("br"===(a=e[n+1]).kind||"preserve"===a.space&&/^[\\r\\n]/.test(a.text)))&&(t.text=t.text.slice(0,-1)):n++}(H),s(E)}return"div"===E.kind&&n.byName.backgroundImage.qname in E.styleAttrs||"br"===E.kind||"image"===E.kind||"contents"in E&&E.contents.length>0||"span"===E.kind&&null!==E.text||"region"===E.kind&&"always"===E.styleAttrs[n.byName.showBackground.qname]?{region_id:y,element:E}:null}function o(e,t){if("contents"in e)for(var r=0;r<e.contents.length;r++){var i=e.contents[r],a=i.styleAttrs[n.byName.ruby.qname];("span"!==i.kind||"textContainer"!==a&&"text"!==a)&&("contents"in i?o(i,t):("span"===i.kind&&0!==i.text.length||"br"===i.kind)&&t.push(i))}}function s(e){if("br"===e.kind)return!1;if("text"in e)return 0===e.text.length;if("contents"in e){for(var t=e.contents.length;t--;)s(e.contents[t])&&e.contents.splice(t,1);return 0===e.contents.length}}function u(e){this.contents=[],this.aspectRatio=e.aspectRatio,this.lang=e.lang}function l(e){for(var t in this.kind=e.kind||"region",this.lang=e.lang,e.id&&(this.id=e.id),this.styleAttrs={},e.styleAttrs)e.styleAttrs.hasOwnProperty(t)&&(this.styleAttrs[t]=e.styleAttrs[t]);"src"in e&&(this.src=e.src),"type"in e&&(this.type=e.type),"text"in e?this.text=e.text:("region"===this.kind||"contents"in e)&&(this.contents=[]),"space"in e&&(this.space=e.space)}function c(e,t){if(e&&e.error&&e.error(t))throw t}}(t,"undefined"==typeof imscNames?n(210):imscNames,"undefined"==typeof imscStyles?n(6811):imscStyles,"undefined"==typeof imscUtils?n(5926):imscUtils)},4403:function(e,t,n){t.generateISD=n(4080).generateISD,t.fromXML=n(3362).fromXML,t.renderHTML=n(506).render},210:function(e,t){!function(e){e.ns_tt="http://www.w3.org/ns/ttml",e.ns_tts="http://www.w3.org/ns/ttml#styling",e.ns_ttp="http://www.w3.org/ns/ttml#parameter",e.ns_xml="http://www.w3.org/XML/1998/namespace",e.ns_itts="http://www.w3.org/ns/ttml/profile/imsc1#styling",e.ns_ittp="http://www.w3.org/ns/ttml/profile/imsc1#parameter",e.ns_smpte="http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt",e.ns_ebutts="urn:ebu:tt:style"}(t)},6811:function(e,t,n){!function(e,t,n){function r(e,t,n,r,i,a,o,s){this.name=t,this.ns=e,this.qname=e+" "+t,this.inherit=i,this.animatable=a,this.initial=n,this.applies=r,this.parse=o,this.compute=s}for(var i in e.all=[new r(t.ns_tts,"backgroundColor","transparent",["body","div","p","region","span"],!1,!0,n.parseColor,null),new r(t.ns_tts,"color","white",["span"],!0,!0,n.parseColor,null),new r(t.ns_tts,"direction","ltr",["p","span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"display","auto",["body","div","p","region","span"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"displayAlign","before",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"extent","auto",["tt","region"],!1,!0,(function(e){if("auto"===e)return e;var t=e.split(" ");if(2!==t.length)return null;var r=n.parseLength(t[0]),i=n.parseLength(t[1]);return i&&r?{h:i,w:r}:null}),(function(e,t,r,i,a){var o,s;if("auto"===i)o=new n.ComputedLength(0,1);else if(null===(o=n.toComputedLength(i.h.value,i.h.unit,null,e.dimensions.h,null,e.pxLength.h)))return null;if("auto"===i)s=new n.ComputedLength(1,0);else if(null===(s=n.toComputedLength(i.w.value,i.w.unit,null,e.dimensions.w,null,e.pxLength.w)))return null;return{h:o,w:s}})),new r(t.ns_tts,"fontFamily","default",["span","p"],!0,!0,(function(e){for(var t=e.split(","),n=[],r=0;r<t.length;r++)"\'"!==t[r].charAt(0)&&\'"\'!==t[r].charAt(0)&&"default"===t[r]?n.push("monospaceSerif"):n.push(t[r]);return n}),null),new r(t.ns_tts,"shear","0%",["p"],!0,!0,n.parseLength,(function(e,t,n,r){return"%"!==r.unit?null:Math.abs(r.value)>100?100*Math.sign(r.value):r.value})),new r(t.ns_tts,"fontSize","1c",["span","p"],!0,!0,n.parseLength,(function(t,r,i,a,o){return n.toComputedLength(a.value,a.unit,null!==r?r.styleAttrs[e.byName.fontSize.qname]:t.cellLength.h,null!==r?r.styleAttrs[e.byName.fontSize.qname]:t.cellLength.h,t.cellLength.h,t.pxLength.h)})),new r(t.ns_tts,"fontStyle","normal",["span","p"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"fontWeight","normal",["span","p"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"lineHeight","normal",["p"],!0,!0,(function(e){return"normal"===e?e:n.parseLength(e)}),(function(t,r,i,a,o){var s;if("normal"===a)s=a;else if(null===(s=n.toComputedLength(a.value,a.unit,i.styleAttrs[e.byName.fontSize.qname],i.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h)))return null;return s})),new r(t.ns_tts,"opacity",1,["region"],!1,!0,parseFloat,null),new r(t.ns_tts,"origin","auto",["region"],!1,!0,(function(e){if("auto"===e)return e;var t=e.split(" ");if(2!==t.length)return null;var r=n.parseLength(t[0]),i=n.parseLength(t[1]);return i&&r?{h:i,w:r}:null}),(function(e,t,r,i,a){var o,s;if("auto"===i)o=new n.ComputedLength(0,0);else if(null===(o=n.toComputedLength(i.h.value,i.h.unit,null,e.dimensions.h,null,e.pxLength.h)))return null;if("auto"===i)s=new n.ComputedLength(0,0);else if(null===(s=n.toComputedLength(i.w.value,i.w.unit,null,e.dimensions.w,null,e.pxLength.w)))return null;return{h:o,w:s}})),new r(t.ns_tts,"overflow","hidden",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"padding","0px",["region"],!1,!0,(function(e){var t=e.split(" ");if(t.length>4)return null;for(var r=[],i=0;i<t.length;i++){var a=n.parseLength(t[i]);if(!a)return null;r.push(a)}return r}),(function(t,r,i,a,o){var s;if(1===a.length)s=[a[0],a[0],a[0],a[0]];else if(2===a.length)s=[a[0],a[1],a[0],a[1]];else if(3===a.length)s=[a[0],a[1],a[2],a[1]];else{if(4!==a.length)return null;s=[a[0],a[1],a[2],a[3]]}var u=i.styleAttrs[e.byName.writingMode.qname];if("lrtb"===u||"lr"===u)s=[s[0],s[3],s[2],s[1]];else if("rltb"===u||"rl"===u)s=[s[0],s[1],s[2],s[3]];else if("tblr"===u)s=[s[3],s[0],s[1],s[2]];else{if("tbrl"!==u&&"tb"!==u)return null;s=[s[3],s[2],s[1],s[0]]}for(var l=[],c=0;c<s.length;c++)if(0===s[c].value)l[c]=new n.ComputedLength(0,0);else if(l[c]=n.toComputedLength(s[c].value,s[c].unit,i.styleAttrs[e.byName.fontSize.qname],0===c||2===c?i.styleAttrs[e.byName.extent.qname].h:i.styleAttrs[e.byName.extent.qname].w,0===c||2===c?t.cellLength.h:t.cellLength.w,0===c||2===c?t.pxLength.h:t.pxLength.w),null===l[c])return null;return l})),new r(t.ns_tts,"position","top left",["region"],!1,!0,(function(e){return n.parsePosition(e)}),(function(t,r,i,a){var o,s;return null===(o=n.toComputedLength(a.v.offset.value,a.v.offset.unit,null,new n.ComputedLength(-i.styleAttrs[e.byName.extent.qname].h.rw,t.dimensions.h.rh-i.styleAttrs[e.byName.extent.qname].h.rh),null,t.pxLength.h))?null:("bottom"===a.v.edge&&(o=new n.ComputedLength(-o.rw-i.styleAttrs[e.byName.extent.qname].h.rw,t.dimensions.h.rh-o.rh-i.styleAttrs[e.byName.extent.qname].h.rh)),s=n.toComputedLength(a.h.offset.value,a.h.offset.unit,null,new n.ComputedLength(t.dimensions.w.rw-i.styleAttrs[e.byName.extent.qname].w.rw,-i.styleAttrs[e.byName.extent.qname].w.rh),null,t.pxLength.w),null===o?null:("right"===a.h.edge&&(s=new n.ComputedLength(t.dimensions.w.rw-s.rw-i.styleAttrs[e.byName.extent.qname].w.rw,-s.rh-i.styleAttrs[e.byName.extent.qname].w.rh)),{h:o,w:s}))})),new r(t.ns_tts,"ruby","none",["span"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"rubyAlign","center",["span"],!0,!0,(function(e){return"center"!==e&&"spaceAround"!==e?null:e}),null),new r(t.ns_tts,"rubyPosition","outside",["span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"rubyReserve","none",["p"],!0,!0,(function(e){var t=e.split(" "),r=[null,null];if(0===t.length||t.length>2)return null;if("none"!==t[0]&&"both"!==t[0]&&"after"!==t[0]&&"before"!==t[0]&&"outside"!==t[0])return null;if(r[0]=t[0],2===t.length&&"none"!==t[0]){var i=n.parseLength(t[1]);if(!i)return null;r[1]=i}return r}),(function(t,r,i,a,o){if("none"===a[0])return a;var s;return null===(s=null===a[1]?new n.ComputedLength(.5*i.styleAttrs[e.byName.fontSize.qname].rw,.5*i.styleAttrs[e.byName.fontSize.qname].rh):n.toComputedLength(a[1].value,a[1].unit,i.styleAttrs[e.byName.fontSize.qname],i.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h))?null:[a[0],s]})),new r(t.ns_tts,"showBackground","always",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"textAlign","start",["p"],!0,!0,(function(e){return e}),(function(e,t,n,r,i){return"left"===r?"start":"right"===r?"end":r})),new r(t.ns_tts,"textCombine","none",["span"],!0,!0,(function(e){return"none"===e||"all"===e?e:null}),null),new r(t.ns_tts,"textDecoration","none",["span"],!0,!0,(function(e){return e.split(" ")}),null),new r(t.ns_tts,"textEmphasis","none",["span"],!0,!0,(function(e){for(var t=e.split(" "),r={style:null,symbol:null,color:null,position:null},i=0;i<t.length;i++)if("none"===t[i]||"auto"===t[i])r.style=t[i];else if("filled"===t[i]||"open"===t[i])r.style=t[i];else if("circle"===t[i]||"dot"===t[i]||"sesame"===t[i])r.symbol=t[i];else if("current"===t[i])r.color=t[i];else if("outside"===t[i]||"before"===t[i]||"after"===t[i])r.position=t[i];else if(r.color=n.parseColor(t[i]),null===r.color)return null;return null==r.style&&null==r.symbol?r.style="auto":(r.symbol=r.symbol||"circle",r.style=r.style||"filled"),r.position=r.position||"outside",r.color=r.color||"current",r}),null),new r(t.ns_tts,"textOutline","none",["span"],!0,!0,(function(e){if("none"===e)return e;var t={},r=e.split(" ");if(0===r.length||r.length>2)return null;var i=n.parseColor(r[0]);if(t.color=i,null!==i&&r.shift(),1!==r.length)return null;var a=n.parseLength(r[0]);return a?(t.thickness=a,t):null}),(function(t,r,i,a,o){if("none"===a)return a;var s={};return null===a.color?s.color=i.styleAttrs[e.byName.color.qname]:s.color=a.color,s.thickness=n.toComputedLength(a.thickness.value,a.thickness.unit,i.styleAttrs[e.byName.fontSize.qname],i.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h),null===s.thickness?null:s})),new r(t.ns_tts,"textShadow","none",["span"],!0,!0,n.parseTextShadow,(function(t,r,i,a){if("none"===a)return a;for(var o=[],s=0;s<a.length;s++){var u={};if(u.x_off=n.toComputedLength(a[s][0].value,a[s][0].unit,null,i.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.w),null===u.x_off)return null;if(u.y_off=n.toComputedLength(a[s][1].value,a[s][1].unit,null,i.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.h),null===u.y_off)return null;if(null===a[s][2])u.b_radius=0;else if(u.b_radius=n.toComputedLength(a[s][2].value,a[s][2].unit,null,i.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.h),null===u.b_radius)return null;null===a[s][3]?u.color=i.styleAttrs[e.byName.color.qname]:u.color=a[s][3],o.push(u)}return o})),new r(t.ns_tts,"unicodeBidi","normal",["span","p"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"visibility","visible",["body","div","p","region","span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"wrapOption","wrap",["span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"writingMode","lrtb",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"zIndex","auto",["region"],!1,!0,(function(e){var t;return"auto"===e?t=e:(t=parseInt(e),isNaN(t)&&(t=null)),t}),null),new r(t.ns_ebutts,"linePadding","0c",["p"],!0,!1,n.parseLength,(function(e,t,r,i,a){return n.toComputedLength(i.value,i.unit,null,null,e.cellLength.w,null)})),new r(t.ns_ebutts,"multiRowAlign","auto",["p"],!0,!1,(function(e){return e}),null),new r(t.ns_smpte,"backgroundImage",null,["div"],!1,!1,(function(e){return e}),null),new r(t.ns_itts,"forcedDisplay","false",["body","div","p","region","span"],!0,!0,(function(e){return"true"===e}),null),new r(t.ns_itts,"fillLineGap","false",["p"],!0,!0,(function(e){return"true"===e}),null)],e.byQName={},e.all)e.byQName[e.all[i].qname]=e.all[i];for(var a in e.byName={},e.all)e.byName[e.all[a].name]=e.all[a]}(t,"undefined"==typeof imscNames?n(210):imscNames,"undefined"==typeof imscUtils?n(5926):imscUtils)},5926:function(e,t){!function(e){var t=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?/,n=/rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)/,r=/rgba\\(\\s*(\\d+),\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)/,i={transparent:[0,0,0,0],black:[0,0,0,255],silver:[192,192,192,255],gray:[128,128,128,255],white:[255,255,255,255],maroon:[128,0,0,255],red:[255,0,0,255],purple:[128,0,128,255],fuchsia:[255,0,255,255],magenta:[255,0,255,255],green:[0,128,0,255],lime:[0,255,0,255],olive:[128,128,0,255],yellow:[255,255,0,255],navy:[0,0,128,255],blue:[0,0,255,255],teal:[0,128,128,255],aqua:[0,255,255,255],cyan:[0,255,255,255]};e.parseColor=function(e){var a,o=null,s=i[e.toLowerCase()];return void 0!==s?o=s:null!==(a=t.exec(e))?o=[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16),void 0!==a[4]?parseInt(a[4],16):255]:null!==(a=n.exec(e))?o=[parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),255]:null!==(a=r.exec(e))&&(o=[parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),parseInt(a[4])]),o};var a=/^((?:\\+|\\-)?\\d*(?:\\.\\d+)?)(px|em|c|%|rh|rw)$/;e.parseLength=function(e){var t,n=null;return null!==(t=a.exec(e))&&(n={value:parseFloat(t[1]),unit:t[2]}),n},e.parseTextShadow=function(t){for(var n=t.match(/([^\\(,\\)]|\\([^\\)]+\\))+/g),r=[],i=0;i<n.length;i++){var a=n[i].split(" ");if(1===a.length&&"none"===a[0])return"none";if(a.length>1&&a.length<5){var o=[null,null,null,null],s=e.parseLength(a.shift());if(null===s)return null;if(o[0]=s,null===(s=e.parseLength(a.shift())))return null;if(o[1]=s,0===a.length){r.push(o);continue}if(null!==(s=e.parseLength(a[0]))&&(o[2]=s,a.shift()),0===a.length){r.push(o);continue}var u=e.parseColor(a[0]);if(null===u)return null;o[3]=u,r.push(o)}}return r},e.parsePosition=function(t){var n=t.split(" "),r=function(e){return"center"===e||"left"===e||"top"===e||"bottom"===e||"right"===e};if(n.length>4)return null;for(var i=0;i<n.length;i++)if(!r(n[i])){var a=e.parseLength(n[i]);if(null===a)return null;n[i]=a}for(var o={h:{edge:"left",offset:{value:50,unit:"%"}},v:{edge:"top",offset:{value:50,unit:"%"}}},s=0;s<n.length;){var u=n[s++];if(r(u)){var l={value:0,unit:"%"};2!==n.length&&s<n.length&&!r(n[s])&&(l=n[s++]),"right"===u?(o.h.edge=u,o.h.offset=l):"bottom"===u?(o.v.edge=u,o.v.offset=l):"left"===u?o.h.offset=l:"top"===u&&(o.v.offset=l)}else{if(1!==n.length&&2!==n.length)return null;1===s?o.h.offset=u:o.v.offset=u}}return o},e.ComputedLength=function(e,t){this.rw=e,this.rh=t},e.ComputedLength.prototype.toUsedLength=function(e,t){return e*this.rw+t*this.rh},e.ComputedLength.prototype.isZero=function(){return 0===this.rw&&0===this.rh},e.toComputedLength=function(t,n,r,i,a,o){return"%"===n&&i?new e.ComputedLength(i.rw*t/100,i.rh*t/100):"em"===n&&r?new e.ComputedLength(r.rw*t,r.rh*t):"c"===n&&a?new e.ComputedLength(t*a.rw,t*a.rh):"px"===n&&o?new e.ComputedLength(t*o.rw,t*o.rh):"rh"===n?new e.ComputedLength(0,t/100):"rw"===n?new e.ComputedLength(t/100,0):null}}(t)},3516:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}},2219:function(e,t,n){"use strict";var r=n(3516),i=n(395);e.exports=function(e){return r(e)||i(e)}},395:function(e){"use strict";e.exports=function(e){var t="string"==typeof e?e.charCodeAt(0):e;return t>=48&&t<=57}},3875:function(e){"use strict";function t(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var n,r="",i=0,a=-1,o=0,s=0;s<=e.length;++s){if(s<e.length)n=e.charCodeAt(s);else{if(47===n)break;n=47}if(47===n){if(a===s-1||1===o);else if(a!==s-1&&2===o){if(r.length<2||2!==i||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){var u=r.lastIndexOf("/");if(u!==r.length-1){-1===u?(r="",i=0):i=(r=r.slice(0,u)).length-1-r.lastIndexOf("/"),a=s,o=0;continue}}else if(2===r.length||1===r.length){r="",i=0,a=s,o=0;continue}t&&(r.length>0?r+="/..":r="..",i=2)}else r.length>0?r+="/"+e.slice(a+1,s):r=e.slice(a+1,s),i=s-a-1;a=s,o=0}else 46===n&&-1!==o?++o:o=-1}return r}var r={resolve:function(){for(var e,r="",i=!1,a=arguments.length-1;a>=-1&&!i;a--){var o;a>=0?o=arguments[a]:(void 0===e&&(e=process.cwd()),o=e),t(o),0!==o.length&&(r=o+"/"+r,i=47===o.charCodeAt(0))}return r=n(r,!i),i?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(e){if(t(e),0===e.length)return".";var r=47===e.charCodeAt(0),i=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!r)).length||r||(e="."),e.length>0&&i&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,n=0;n<arguments.length;++n){var i=arguments[n];t(i),i.length>0&&(void 0===e?e=i:e+="/"+i)}return void 0===e?".":r.normalize(e)},relative:function(e,n){if(t(e),t(n),e===n)return"";if((e=r.resolve(e))===(n=r.resolve(n)))return"";for(var i=1;i<e.length&&47===e.charCodeAt(i);++i);for(var a=e.length,o=a-i,s=1;s<n.length&&47===n.charCodeAt(s);++s);for(var u=n.length-s,l=o<u?o:u,c=-1,f=0;f<=l;++f){if(f===l){if(u>l){if(47===n.charCodeAt(s+f))return n.slice(s+f+1);if(0===f)return n.slice(s+f)}else o>l&&(47===e.charCodeAt(i+f)?c=f:0===f&&(c=0));break}var d=e.charCodeAt(i+f);if(d!==n.charCodeAt(s+f))break;47===d&&(c=f)}var g="";for(f=i+c+1;f<=a;++f)f!==a&&47!==e.charCodeAt(f)||(0===g.length?g+="..":g+="/..");return g.length>0?g+n.slice(s+c):(s+=c,47===n.charCodeAt(s)&&++s,n.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var n=e.charCodeAt(0),r=47===n,i=-1,a=!0,o=e.length-1;o>=1;--o)if(47===(n=e.charCodeAt(o))){if(!a){i=o;break}}else a=!1;return-1===i?r?"/":".":r&&1===i?"//":e.slice(0,i)},basename:function(e,n){if(void 0!==n&&"string"!=typeof n)throw new TypeError(\'"ext" argument must be a string\');t(e);var r,i=0,a=-1,o=!0;if(void 0!==n&&n.length>0&&n.length<=e.length){if(n.length===e.length&&n===e)return"";var s=n.length-1,u=-1;for(r=e.length-1;r>=0;--r){var l=e.charCodeAt(r);if(47===l){if(!o){i=r+1;break}}else-1===u&&(o=!1,u=r+1),s>=0&&(l===n.charCodeAt(s)?-1==--s&&(a=r):(s=-1,a=u))}return i===a?a=u:-1===a&&(a=e.length),e.slice(i,a)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!o){i=r+1;break}}else-1===a&&(o=!1,a=r+1);return-1===a?"":e.slice(i,a)},extname:function(e){t(e);for(var n=-1,r=0,i=-1,a=!0,o=0,s=e.length-1;s>=0;--s){var u=e.charCodeAt(s);if(47!==u)-1===i&&(a=!1,i=s+1),46===u?-1===n?n=s:1!==o&&(o=1):-1!==n&&(o=-1);else if(!a){r=s+1;break}}return-1===n||-1===i||0===o||1===o&&n===i-1&&n===r+1?"":e.slice(n,i)},format:function(e){if(null===e||"object"!=typeof e)throw new TypeError(\'The "pathObject" argument must be of type Object. Received type \'+typeof e);return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+r:n+"/"+r:r}(0,e)},parse:function(e){t(e);var n={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return n;var r,i=e.charCodeAt(0),a=47===i;a?(n.root="/",r=1):r=0;for(var o=-1,s=0,u=-1,l=!0,c=e.length-1,f=0;c>=r;--c)if(47!==(i=e.charCodeAt(c)))-1===u&&(l=!1,u=c+1),46===i?-1===o?o=c:1!==f&&(f=1):-1!==o&&(f=-1);else if(!l){s=c+1;break}return-1===o||-1===u||0===f||1===f&&o===u-1&&o===s+1?-1!==u&&(n.base=n.name=0===s&&a?e.slice(1,u):e.slice(s,u)):(0===s&&a?(n.name=e.slice(1,o),n.base=e.slice(1,u)):(n.name=e.slice(s,o),n.base=e.slice(s,u)),n.ext=e.slice(o,u)),s>0?n.dir=e.slice(0,s-1):a&&(n.dir="/"),n},sep:"/",delimiter:":",win32:null,posix:null};r.posix=r,e.exports=r},8387:function(e,t,n){var r=n(1549),i=r.Buffer;function a(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(a(r,t),t.Buffer=o),a(i,o),o.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},o.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},5378:function(e,t,n){!function(e){e.parser=function(e,t){return new i(e,t)},e.SAXParser=i,e.SAXStream=o,e.createStream=function(e,t){return new o(e,t)},e.MAX_BUFFER_LENGTH=65536;var t,r=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function i(t,n){if(!(this instanceof i))return new i(t,n);var a=this;!function(e){for(var t=0,n=r.length;t<n;t++)e[r[t]]=""}(a),a.q=a.c="",a.bufferCheckPosition=e.MAX_BUFFER_LENGTH,a.opt=n||{},a.opt.lowercase=a.opt.lowercase||a.opt.lowercasetags,a.looseCase=a.opt.lowercase?"toLowerCase":"toUpperCase",a.tags=[],a.closed=a.closedRoot=a.sawRoot=!1,a.tag=a.error=null,a.strict=!!t,a.noscript=!(!t&&!a.opt.noscript),a.state=I.BEGIN,a.strictEntities=a.opt.strictEntities,a.ENTITIES=a.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),a.attribList=[],a.opt.xmlns&&(a.ns=Object.create(h)),a.trackPosition=!1!==a.opt.position,a.trackPosition&&(a.position=a.line=a.column=0),w(a,"onready")}e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(e){function t(){}return t.prototype=e,new t}),Object.keys||(Object.keys=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}),i.prototype={end:function(){M(this)},write:function(t){var n=this;if(this.error)throw this.error;if(n.closed)return O(n,"Cannot write after close. Assign an onready handler.");if(null===t)return M(n);"object"==typeof t&&(t=t.toString());for(var i=0,a="";a=G(t,i++),n.c=a,a;)switch(n.trackPosition&&(n.position++,"\\n"===a?(n.line++,n.column=0):n.column++),n.state){case I.BEGIN:if(n.state=I.BEGIN_WHITESPACE,"\\ufeff"===a)continue;B(n,a);continue;case I.BEGIN_WHITESPACE:B(n,a);continue;case I.TEXT:if(n.sawRoot&&!n.closedRoot){for(var o=i-1;a&&"<"!==a&&"&"!==a;)(a=G(t,i++))&&n.trackPosition&&(n.position++,"\\n"===a?(n.line++,n.column=0):n.column++);n.textNode+=t.substring(o,i-1)}"<"!==a||n.sawRoot&&n.closedRoot&&!n.strict?(!T(s,a)||n.sawRoot&&!n.closedRoot||P(n,"Text data outside of root node."),"&"===a?n.state=I.TEXT_ENTITY:n.textNode+=a):(n.state=I.OPEN_WAKA,n.startTagPosition=n.position);continue;case I.SCRIPT:"<"===a?n.state=I.SCRIPT_ENDING:n.script+=a;continue;case I.SCRIPT_ENDING:"/"===a?n.state=I.CLOSE_TAG:(n.script+="<"+a,n.state=I.SCRIPT);continue;case I.OPEN_WAKA:if("!"===a)n.state=I.SGML_DECL,n.sgmlDecl="";else if(_(s,a));else if(_(p,a))n.state=I.OPEN_TAG,n.tagName=a;else if("/"===a)n.state=I.CLOSE_TAG,n.tagName="";else if("?"===a)n.state=I.PROC_INST,n.procInstName=n.procInstBody="";else{if(P(n,"Unencoded <"),n.startTagPosition+1<n.position){var u=n.position-n.startTagPosition;a=new Array(u).join(" ")+a}n.textNode+="<"+a,n.state=I.TEXT}continue;case I.SGML_DECL:"[CDATA["===(n.sgmlDecl+a).toUpperCase()?(N(n,"onopencdata"),n.state=I.CDATA,n.sgmlDecl="",n.cdata=""):n.sgmlDecl+a==="--"?(n.state=I.COMMENT,n.comment="",n.sgmlDecl=""):"DOCTYPE"===(n.sgmlDecl+a).toUpperCase()?(n.state=I.DOCTYPE,(n.doctype||n.sawRoot)&&P(n,"Inappropriately located doctype declaration"),n.doctype="",n.sgmlDecl=""):">"===a?(N(n,"onsgmldeclaration",n.sgmlDecl),n.sgmlDecl="",n.state=I.TEXT):_(c,a)?(n.state=I.SGML_DECL_QUOTED,n.sgmlDecl+=a):n.sgmlDecl+=a;continue;case I.SGML_DECL_QUOTED:a===n.q&&(n.state=I.SGML_DECL,n.q=""),n.sgmlDecl+=a;continue;case I.DOCTYPE:">"===a?(n.state=I.TEXT,N(n,"ondoctype",n.doctype),n.doctype=!0):(n.doctype+=a,"["===a?n.state=I.DOCTYPE_DTD:_(c,a)&&(n.state=I.DOCTYPE_QUOTED,n.q=a));continue;case I.DOCTYPE_QUOTED:n.doctype+=a,a===n.q&&(n.q="",n.state=I.DOCTYPE);continue;case I.DOCTYPE_DTD:n.doctype+=a,"]"===a?n.state=I.DOCTYPE:_(c,a)&&(n.state=I.DOCTYPE_DTD_QUOTED,n.q=a);continue;case I.DOCTYPE_DTD_QUOTED:n.doctype+=a,a===n.q&&(n.state=I.DOCTYPE_DTD,n.q="");continue;case I.COMMENT:"-"===a?n.state=I.COMMENT_ENDING:n.comment+=a;continue;case I.COMMENT_ENDING:"-"===a?(n.state=I.COMMENT_ENDED,n.comment=D(n.opt,n.comment),n.comment&&N(n,"oncomment",n.comment),n.comment=""):(n.comment+="-"+a,n.state=I.COMMENT);continue;case I.COMMENT_ENDED:">"!==a?(P(n,"Malformed comment"),n.comment+="--"+a,n.state=I.COMMENT):n.state=I.TEXT;continue;case I.CDATA:"]"===a?n.state=I.CDATA_ENDING:n.cdata+=a;continue;case I.CDATA_ENDING:"]"===a?n.state=I.CDATA_ENDING_2:(n.cdata+="]"+a,n.state=I.CDATA);continue;case I.CDATA_ENDING_2:">"===a?(n.cdata&&N(n,"oncdata",n.cdata),N(n,"onclosecdata"),n.cdata="",n.state=I.TEXT):"]"===a?n.cdata+="]":(n.cdata+="]]"+a,n.state=I.CDATA);continue;case I.PROC_INST:"?"===a?n.state=I.PROC_INST_ENDING:_(s,a)?n.state=I.PROC_INST_BODY:n.procInstName+=a;continue;case I.PROC_INST_BODY:if(!n.procInstBody&&_(s,a))continue;"?"===a?n.state=I.PROC_INST_ENDING:n.procInstBody+=a;continue;case I.PROC_INST_ENDING:">"===a?(N(n,"onprocessinginstruction",{name:n.procInstName,body:n.procInstBody}),n.procInstName=n.procInstBody="",n.state=I.TEXT):(n.procInstBody+="?"+a,n.state=I.PROC_INST_BODY);continue;case I.OPEN_TAG:_(m,a)?n.tagName+=a:(L(n),">"===a?k(n):"/"===a?n.state=I.OPEN_TAG_SLASH:(T(s,a)&&P(n,"Invalid character in tag name"),n.state=I.ATTRIB));continue;case I.OPEN_TAG_SLASH:">"===a?(k(n,!0),U(n)):(P(n,"Forward-slash in opening tag not followed by >"),n.state=I.ATTRIB);continue;case I.ATTRIB:if(_(s,a))continue;">"===a?k(n):"/"===a?n.state=I.OPEN_TAG_SLASH:_(p,a)?(n.attribName=a,n.attribValue="",n.state=I.ATTRIB_NAME):P(n,"Invalid attribute name");continue;case I.ATTRIB_NAME:"="===a?n.state=I.ATTRIB_VALUE:">"===a?(P(n,"Attribute without value"),n.attribValue=n.attribName,F(n),k(n)):_(s,a)?n.state=I.ATTRIB_NAME_SAW_WHITE:_(m,a)?n.attribName+=a:P(n,"Invalid attribute name");continue;case I.ATTRIB_NAME_SAW_WHITE:if("="===a)n.state=I.ATTRIB_VALUE;else{if(_(s,a))continue;P(n,"Attribute without value"),n.tag.attributes[n.attribName]="",n.attribValue="",N(n,"onattribute",{name:n.attribName,value:""}),n.attribName="",">"===a?k(n):_(p,a)?(n.attribName=a,n.state=I.ATTRIB_NAME):(P(n,"Invalid attribute name"),n.state=I.ATTRIB)}continue;case I.ATTRIB_VALUE:if(_(s,a))continue;_(c,a)?(n.q=a,n.state=I.ATTRIB_VALUE_QUOTED):(P(n,"Unquoted attribute value"),n.state=I.ATTRIB_VALUE_UNQUOTED,n.attribValue=a);continue;case I.ATTRIB_VALUE_QUOTED:if(a!==n.q){"&"===a?n.state=I.ATTRIB_VALUE_ENTITY_Q:n.attribValue+=a;continue}F(n),n.q="",n.state=I.ATTRIB_VALUE_CLOSED;continue;case I.ATTRIB_VALUE_CLOSED:_(s,a)?n.state=I.ATTRIB:">"===a?k(n):"/"===a?n.state=I.OPEN_TAG_SLASH:_(p,a)?(P(n,"No whitespace between attributes"),n.attribName=a,n.attribValue="",n.state=I.ATTRIB_NAME):P(n,"Invalid attribute name");continue;case I.ATTRIB_VALUE_UNQUOTED:if(T(f,a)){"&"===a?n.state=I.ATTRIB_VALUE_ENTITY_U:n.attribValue+=a;continue}F(n),">"===a?k(n):n.state=I.ATTRIB;continue;case I.CLOSE_TAG:if(n.tagName)">"===a?U(n):_(m,a)?n.tagName+=a:n.script?(n.script+="</"+n.tagName,n.tagName="",n.state=I.SCRIPT):(T(s,a)&&P(n,"Invalid tagname in closing tag"),n.state=I.CLOSE_TAG_SAW_WHITE);else{if(_(s,a))continue;T(p,a)?n.script?(n.script+="</"+a,n.state=I.SCRIPT):P(n,"Invalid tagname in closing tag."):n.tagName=a}continue;case I.CLOSE_TAG_SAW_WHITE:if(_(s,a))continue;">"===a?U(n):P(n,"Invalid characters in closing tag");continue;case I.TEXT_ENTITY:case I.ATTRIB_VALUE_ENTITY_Q:case I.ATTRIB_VALUE_ENTITY_U:var l,d;switch(n.state){case I.TEXT_ENTITY:l=I.TEXT,d="textNode";break;case I.ATTRIB_VALUE_ENTITY_Q:l=I.ATTRIB_VALUE_QUOTED,d="attribValue";break;case I.ATTRIB_VALUE_ENTITY_U:l=I.ATTRIB_VALUE_UNQUOTED,d="attribValue"}";"===a?(n[d]+=Z(n),n.entity="",n.state=l):_(n.entity.length?E:y,a)?n.entity+=a:(P(n,"Invalid character in entity name"),n[d]+="&"+n.entity+a,n.entity="",n.state=l);continue;default:throw new Error(n,"Unknown state: "+n.state)}return n.position>=n.bufferCheckPosition&&function(t){for(var n=Math.max(e.MAX_BUFFER_LENGTH,10),i=0,a=0,o=r.length;a<o;a++){var s=t[r[a]].length;if(s>n)switch(r[a]){case"textNode":C(t);break;case"cdata":N(t,"oncdata",t.cdata),t.cdata="";break;case"script":N(t,"onscript",t.script),t.script="";break;default:O(t,"Max buffer length exceeded: "+r[a])}i=Math.max(i,s)}var u=e.MAX_BUFFER_LENGTH-i;t.bufferCheckPosition=u+t.position}(n),n},resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var e;C(e=this),""!==e.cdata&&(N(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(N(e,"onscript",e.script),e.script="")}};try{t=n(182).Stream}catch(e){t=function(){}}var a=e.EVENTS.filter((function(e){return"error"!==e&&"end"!==e}));function o(e,n){if(!(this instanceof o))return new o(e,n);t.apply(this),this._parser=new i(e,n),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(e){r.emit("error",e),r._parser.error=null},this._decoder=null,a.forEach((function(e){Object.defineProperty(r,"on"+e,{get:function(){return r._parser["on"+e]},set:function(t){if(!t)return r.removeAllListeners(e),r._parser["on"+e]=t,t;r.on(e,t)},enumerable:!0,configurable:!1})}))}o.prototype=Object.create(t.prototype,{constructor:{value:o}}),o.prototype.write=function(e){if("function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e)){if(!this._decoder){var t=n(7503).s;this._decoder=new t("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},o.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},o.prototype.on=function(e,n){var r=this;return r._parser["on"+e]||-1===a.indexOf(e)||(r._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),r.emit.apply(r,t)}),t.prototype.on.call(r,e,n)};var s="\\r\\n\\t ",u="0124356789",l="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",c="\'\\"",f=s+">",d="http://www.w3.org/XML/1998/namespace",g="http://www.w3.org/2000/xmlns/",h={xml:d,xmlns:g};s=v(s),u=v(u),l=v(l);var p=/[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/,m=/[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040\\.\\d-]/,y=/[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/,E=/[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040\\.\\d-]/;function v(e){return e.split("").reduce((function(e,t){return e[t]=!0,e}),{})}function _(e,t){return function(e){return"[object RegExp]"===Object.prototype.toString.call(e)}(e)?!!t.match(e):e[t]}function T(e,t){return!_(e,t)}c=v(c),f=v(f);var S,b,A,I=0;for(var R in e.STATE={BEGIN:I++,BEGIN_WHITESPACE:I++,TEXT:I++,TEXT_ENTITY:I++,OPEN_WAKA:I++,SGML_DECL:I++,SGML_DECL_QUOTED:I++,DOCTYPE:I++,DOCTYPE_QUOTED:I++,DOCTYPE_DTD:I++,DOCTYPE_DTD_QUOTED:I++,COMMENT_STARTING:I++,COMMENT:I++,COMMENT_ENDING:I++,COMMENT_ENDED:I++,CDATA:I++,CDATA_ENDING:I++,CDATA_ENDING_2:I++,PROC_INST:I++,PROC_INST_BODY:I++,PROC_INST_ENDING:I++,OPEN_TAG:I++,OPEN_TAG_SLASH:I++,ATTRIB:I++,ATTRIB_NAME:I++,ATTRIB_NAME_SAW_WHITE:I++,ATTRIB_VALUE:I++,ATTRIB_VALUE_QUOTED:I++,ATTRIB_VALUE_CLOSED:I++,ATTRIB_VALUE_UNQUOTED:I++,ATTRIB_VALUE_ENTITY_Q:I++,ATTRIB_VALUE_ENTITY_U:I++,CLOSE_TAG:I++,CLOSE_TAG_SAW_WHITE:I++,SCRIPT:I++,SCRIPT_ENDING:I++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:\'"\',apos:"\'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:\'"\',apos:"\'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach((function(t){var n=e.ENTITIES[t],r="number"==typeof n?String.fromCharCode(n):n;e.ENTITIES[t]=r})),e.STATE)e.STATE[e.STATE[R]]=R;function w(e,t,n){e[t]&&e[t](n)}function N(e,t,n){e.textNode&&C(e),w(e,t,n)}function C(e){e.textNode=D(e.opt,e.textNode),e.textNode&&w(e,"ontext",e.textNode),e.textNode=""}function D(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\\s+/g," ")),t}function O(e,t){return C(e),e.trackPosition&&(t+="\\nLine: "+e.line+"\\nColumn: "+e.column+"\\nChar: "+e.c),t=new Error(t),e.error=t,w(e,"onerror",t),e}function M(e){return e.sawRoot&&!e.closedRoot&&P(e,"Unclosed root tag"),e.state!==I.BEGIN&&e.state!==I.BEGIN_WHITESPACE&&e.state!==I.TEXT&&O(e,"Unexpected end"),C(e),e.c="",e.closed=!0,w(e,"onend"),i.call(e,e.strict,e.opt),e}function P(e,t){if("object"!=typeof e||!(e instanceof i))throw new Error("bad call to strictFail");e.strict&&O(e,t)}function L(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,n=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(n.ns=t.ns),e.attribList.length=0,N(e,"onopentagstart",n)}function x(e,t){var n=e.indexOf(":")<0?["",e]:e.split(":"),r=n[0],i=n[1];return t&&"xmlns"===e&&(r="xmlns",i=""),{prefix:r,local:i}}function F(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=x(e.attribName,!0),n=t.prefix,r=t.local;if("xmlns"===n)if("xml"===r&&e.attribValue!==d)P(e,"xml: prefix must be bound to "+d+"\\nActual: "+e.attribValue);else if("xmlns"===r&&e.attribValue!==g)P(e,"xmlns: prefix must be bound to "+g+"\\nActual: "+e.attribValue);else{var i=e.tag,a=e.tags[e.tags.length-1]||e;i.ns===a.ns&&(i.ns=Object.create(a.ns)),i.ns[r]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,N(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function k(e,t){if(e.opt.xmlns){var n=e.tag,r=x(e.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||"",n.prefix&&!n.uri&&(P(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),n.uri=r.prefix);var i=e.tags[e.tags.length-1]||e;n.ns&&i.ns!==n.ns&&Object.keys(n.ns).forEach((function(t){N(e,"onopennamespace",{prefix:t,uri:n.ns[t]})}));for(var a=0,o=e.attribList.length;a<o;a++){var s=e.attribList[a],u=s[0],l=s[1],c=x(u,!0),f=c.prefix,d=c.local,g=""===f?"":n.ns[f]||"",h={name:u,value:l,prefix:f,local:d,uri:g};f&&"xmlns"!==f&&!g&&(P(e,"Unbound namespace prefix: "+JSON.stringify(f)),h.uri=f),e.tag.attributes[u]=h,N(e,"onattribute",h)}e.attribList.length=0}e.tag.isSelfClosing=!!t,e.sawRoot=!0,e.tags.push(e.tag),N(e,"onopentag",e.tag),t||(e.noscript||"script"!==e.tagName.toLowerCase()?e.state=I.TEXT:e.state=I.SCRIPT,e.tag=null,e.tagName=""),e.attribName=e.attribValue="",e.attribList.length=0}function U(e){if(!e.tagName)return P(e,"Weird empty close tag."),e.textNode+="</>",void(e.state=I.TEXT);if(e.script){if("script"!==e.tagName)return e.script+="</"+e.tagName+">",e.tagName="",void(e.state=I.SCRIPT);N(e,"onscript",e.script),e.script=""}var t=e.tags.length,n=e.tagName;e.strict||(n=n[e.looseCase]());for(var r=n;t--&&e.tags[t].name!==r;)P(e,"Unexpected close tag");if(t<0)return P(e,"Unmatched closing tag: "+e.tagName),e.textNode+="</"+e.tagName+">",void(e.state=I.TEXT);e.tagName=n;for(var i=e.tags.length;i-- >t;){var a=e.tag=e.tags.pop();e.tagName=e.tag.name,N(e,"onclosetag",e.tagName);var o={};for(var s in a.ns)o[s]=a.ns[s];var u=e.tags[e.tags.length-1]||e;e.opt.xmlns&&a.ns!==u.ns&&Object.keys(a.ns).forEach((function(t){var n=a.ns[t];N(e,"onclosenamespace",{prefix:t,uri:n})}))}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=I.TEXT}function Z(e){var t,n=e.entity,r=n.toLowerCase(),i="";return e.ENTITIES[n]?e.ENTITIES[n]:e.ENTITIES[r]?e.ENTITIES[r]:("#"===(n=r).charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),i=(t=parseInt(n,16)).toString(16)):(n=n.slice(1),i=(t=parseInt(n,10)).toString(10))),n=n.replace(/^0+/,""),i.toLowerCase()!==n?(P(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function B(e,t){"<"===t?(e.state=I.OPEN_WAKA,e.startTagPosition=e.position):T(s,t)&&(P(e,"Non-whitespace before first tag."),e.textNode=t,e.state=I.TEXT)}function G(e,t){var n="";return t<e.length&&(n=e.charAt(t)),n}I=e.STATE,String.fromCodePoint||(S=String.fromCharCode,b=Math.floor,A=function(){var e,t,n=16384,r=[],i=-1,a=arguments.length;if(!a)return"";for(var o="";++i<a;){var s=Number(arguments[i]);if(!isFinite(s)||s<0||s>1114111||b(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?r.push(s):(e=55296+((s-=65536)>>10),t=s%1024+56320,r.push(e,t)),(i+1===a||r.length>n)&&(o+=S.apply(null,r),r.length=0)}return o},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:A,configurable:!0,writable:!0}):String.fromCodePoint=A)}(t)},182:function(e,t,n){e.exports=i;var r=n(1159).EventEmitter;function i(){r.call(this)}n(1765)(i,r),i.Readable=n(2846),i.Writable=n(8318),i.Duplex=n(6138),i.Transform=n(9798),i.PassThrough=n(5472),i.finished=n(8800),i.pipeline=n(7295),i.Stream=i,i.prototype.pipe=function(e,t){var n=this;function i(t){e.writable&&!1===e.write(t)&&n.pause&&n.pause()}function a(){n.readable&&n.resume&&n.resume()}n.on("data",i),e.on("drain",a),e._isStdio||t&&!1===t.end||(n.on("end",s),n.on("close",u));var o=!1;function s(){o||(o=!0,e.end())}function u(){o||(o=!0,"function"==typeof e.destroy&&e.destroy())}function l(e){if(c(),0===r.listenerCount(this,"error"))throw e}function c(){n.removeListener("data",i),e.removeListener("drain",a),n.removeListener("end",s),n.removeListener("close",u),n.removeListener("error",l),e.removeListener("error",l),n.removeListener("end",c),n.removeListener("close",c),e.removeListener("close",c)}return n.on("error",l),e.on("error",l),n.on("end",c),n.on("close",c),e.on("close",c),e.emit("pipe",n),e}},1765:function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}},3690:function(e){"use strict";var t={};function n(e,n,r){r||(r=Error);var i=function(e){var t,r;function i(t,r,i){return e.call(this,function(e,t,r){return"string"==typeof n?n:n(e,t,r)}(t,r,i))||this}return r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=e,t[e]=i}function r(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map((function(e){return String(e)})),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}n("ERR_INVALID_OPT_VALUE",(function(e,t){return\'The value "\'+t+\'" is invalid for option "\'+e+\'"\'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(e,t,n){var i,a,o,s,u;if("string"==typeof t&&(a="not ",t.substr(0,a.length)===a)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))o="The ".concat(e," ").concat(i," ").concat(r(t,"type"));else{var l=("number"!=typeof u&&(u=0),u+".".length>(s=e).length||-1===s.indexOf(".",u)?"argument":"property");o=\'The "\'.concat(e,\'" \').concat(l," ").concat(i," ").concat(r(t,"type"))}return o+". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),n("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),n("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),n("ERR_STREAM_WRITE_AFTER_END","write after end"),n("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),n("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),e.exports.q=t},6138:function(e,t,n){"use strict";var r=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=l;var i=n(2846),a=n(8318);n(1765)(l,i);for(var o=r(a.prototype),s=0;s<o.length;s++){var u=o[s];l.prototype[u]||(l.prototype[u]=a.prototype[u])}function l(e){if(!(this instanceof l))return new l(e);i.call(this,e),a.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",c)))}function c(){this._writableState.ended||process.nextTick(f,this)}function f(e){e.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})},5472:function(e,t,n){"use strict";e.exports=i;var r=n(9798);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}n(1765)(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},2846:function(e,t,n){"use strict";var r;e.exports=A,A.ReadableState=b,n(1159).EventEmitter;var i,a=function(e,t){return e.listeners(t).length},o=n(9299),s=n(1549).Buffer,u=n.g.Uint8Array||function(){},l=n(964);i=l&&l.debuglog?l.debuglog("stream"):function(){};var c,f,d,g=n(8393),h=n(6163),p=n(7269).getHighWaterMark,m=n(3690).q,y=m.ERR_INVALID_ARG_TYPE,E=m.ERR_STREAM_PUSH_AFTER_EOF,v=m.ERR_METHOD_NOT_IMPLEMENTED,_=m.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(1765)(A,o);var T=h.errorOrDestroy,S=["error","close","destroy","pause","resume"];function b(e,t,i){r=r||n(6138),e=e||{},"boolean"!=typeof i&&(i=t instanceof r),this.objectMode=!!e.objectMode,i&&(this.objectMode=this.objectMode||!!e.readableObjectMode),this.highWaterMark=p(this,e,"readableHighWaterMark",i),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(c||(c=n(7503).s),this.decoder=new c(e.encoding),this.encoding=e.encoding)}function A(e){if(r=r||n(6138),!(this instanceof A))return new A(e);var t=this instanceof r;this._readableState=new b(e,this,t),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),o.call(this)}function I(e,t,n,r,a){i("readableAddChunk",t);var o,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(i("onEofChunk"),!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?C(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,D(e)))}}(e,l);else if(a||(o=function(e,t){var n,r;return r=t,s.isBuffer(r)||r instanceof u||"string"==typeof t||void 0===t||e.objectMode||(n=new y("chunk",["string","Buffer","Uint8Array"],t)),n}(l,t)),o)T(e,o);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===s.prototype||(t=function(e){return s.from(e)}(t)),r)l.endEmitted?T(e,new _):R(e,l,t,!0);else if(l.ended)T(e,new E);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!n?(t=l.decoder.write(t),l.objectMode||0!==t.length?R(e,l,t,!1):O(e,l)):R(e,l,t,!1)}else r||(l.reading=!1,O(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function R(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&C(e)),O(e,t)}Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),A.prototype.destroy=h.destroy,A.prototype._undestroy=h.undestroy,A.prototype._destroy=function(e,t){t(e)},A.prototype.push=function(e,t){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof e&&((t=t||r.defaultEncoding)!==r.encoding&&(e=s.from(e,t),t=""),n=!0),I(this,e,t,!1,n)},A.prototype.unshift=function(e){return I(this,e,null,!0,!1)},A.prototype.isPaused=function(){return!1===this._readableState.flowing},A.prototype.setEncoding=function(e){c||(c=n(7503).s);var t=new c(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=t.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var w=1073741824;function N(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=w?e=w:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function C(e){var t=e._readableState;i("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(i("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(D,e))}function D(e){var t=e._readableState;i("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,F(e)}function O(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(M,e,t))}function M(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(i("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function P(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function L(e){i("readable nexttick read 0"),e.read(0)}function x(e,t){i("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),F(e),t.flowing&&!t.reading&&e.read(0)}function F(e){var t=e._readableState;for(i("flow",t.flowing);t.flowing&&null!==e.read(););}function k(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function U(e){var t=e._readableState;i("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(Z,t,e))}function Z(e,t){if(i("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function B(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}A.prototype.read=function(e){i("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return i("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?U(this):C(this),null;if(0===(e=N(e,t))&&t.ended)return 0===t.length&&U(this),null;var r,a=t.needReadable;return i("need readable",a),(0===t.length||t.length-e<t.highWaterMark)&&i("length less than watermark",a=!0),t.ended||t.reading?i("reading or ended",a=!1):a&&(i("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=N(n,t))),null===(r=e>0?k(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&U(this)),null!==r&&this.emit("data",r),r},A.prototype._read=function(e){T(this,new v("_read()"))},A.prototype.pipe=function(e,t){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=e;break;case 1:r.pipes=[r.pipes,e];break;default:r.pipes.push(e)}r.pipesCount+=1,i("pipe count=%d opts=%j",r.pipesCount,t);var o=t&&!1===t.end||e===process.stdout||e===process.stderr?h:s;function s(){i("onend"),e.end()}r.endEmitted?process.nextTick(o):n.once("end",o),e.on("unpipe",(function t(a,o){i("onunpipe"),a===n&&o&&!1===o.hasUnpiped&&(o.hasUnpiped=!0,i("cleanup"),e.removeListener("close",d),e.removeListener("finish",g),e.removeListener("drain",u),e.removeListener("error",f),e.removeListener("unpipe",t),n.removeListener("end",s),n.removeListener("end",h),n.removeListener("data",c),l=!0,!r.awaitDrain||e._writableState&&!e._writableState.needDrain||u())}));var u=function(e){return function(){var t=e._readableState;i("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&a(e,"data")&&(t.flowing=!0,F(e))}}(n);e.on("drain",u);var l=!1;function c(t){i("ondata");var a=e.write(t);i("dest.write",a),!1===a&&((1===r.pipesCount&&r.pipes===e||r.pipesCount>1&&-1!==B(r.pipes,e))&&!l&&(i("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function f(t){i("onerror",t),h(),e.removeListener("error",f),0===a(e,"error")&&T(e,t)}function d(){e.removeListener("finish",g),h()}function g(){i("onfinish"),e.removeListener("close",d),h()}function h(){i("unpipe"),n.unpipe(e)}return n.on("data",c),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",f),e.once("close",d),e.once("finish",g),e.emit("pipe",n),r.flowing||(i("pipe resume"),n.resume()),e},A.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)r[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=B(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},A.prototype.on=function(e,t){var n=o.prototype.on.call(this,e,t),r=this._readableState;return"data"===e?(r.readableListening=this.listenerCount("readable")>0,!1!==r.flowing&&this.resume()):"readable"===e&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,i("on readable",r.length,r.reading),r.length?C(this):r.reading||process.nextTick(L,this))),n},A.prototype.addListener=A.prototype.on,A.prototype.removeListener=function(e,t){var n=o.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(P,this),n},A.prototype.removeAllListeners=function(e){var t=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(P,this),t},A.prototype.resume=function(){var e=this._readableState;return e.flowing||(i("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(x,e,t))}(this,e)),e.paused=!1,this},A.prototype.pause=function(){return i("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(i("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},A.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var a in e.on("end",(function(){if(i("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(a){i("wrapped data"),n.decoder&&(a=n.decoder.write(a)),n.objectMode&&null==a||(n.objectMode||a&&a.length)&&(t.push(a)||(r=!0,e.pause()))})),e)void 0===this[a]&&"function"==typeof e[a]&&(this[a]=function(t){return function(){return e[t].apply(e,arguments)}}(a));for(var o=0;o<S.length;o++)e.on(S[o],this.emit.bind(this,S[o]));return this._read=function(t){i("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(A.prototype[Symbol.asyncIterator]=function(){return void 0===f&&(f=n(7299)),f(this)}),Object.defineProperty(A.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(A.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(A.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),A._fromList=k,Object.defineProperty(A.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(A.from=function(e,t){return void 0===d&&(d=n(6233)),d(A,e,t)})},9798:function(e,t,n){"use strict";e.exports=c;var r=n(3690).q,i=r.ERR_METHOD_NOT_IMPLEMENTED,a=r.ERR_MULTIPLE_CALLBACK,o=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,s=r.ERR_TRANSFORM_WITH_LENGTH_0,u=n(6138);function l(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new a);n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function c(e){if(!(this instanceof c))return new c(e);u.call(this,e),this._transformState={afterTransform:l.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",f)}function f(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush((function(t,n){d(e,t,n)}))}function d(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new s;if(e._transformState.transforming)throw new o;return e.push(null)}n(1765)(c,u),c.prototype.push=function(e,t){return this._transformState.needTransform=!1,u.prototype.push.call(this,e,t)},c.prototype._transform=function(e,t,n){n(new i("_transform()"))},c.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},c.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},c.prototype._destroy=function(e,t){u.prototype._destroy.call(this,e,(function(e){t(e)}))}},8318:function(e,t,n){"use strict";function r(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;for(e.entry=null;r;){var i=r.callback;t.pendingcb--,i(undefined),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var i;e.exports=A,A.WritableState=b;var a,o={deprecate:n(7839)},s=n(9299),u=n(1549).Buffer,l=n.g.Uint8Array||function(){},c=n(6163),f=n(7269).getHighWaterMark,d=n(3690).q,g=d.ERR_INVALID_ARG_TYPE,h=d.ERR_METHOD_NOT_IMPLEMENTED,p=d.ERR_MULTIPLE_CALLBACK,m=d.ERR_STREAM_CANNOT_PIPE,y=d.ERR_STREAM_DESTROYED,E=d.ERR_STREAM_NULL_VALUES,v=d.ERR_STREAM_WRITE_AFTER_END,_=d.ERR_UNKNOWN_ENCODING,T=c.errorOrDestroy;function S(){}function b(e,t,a){i=i||n(6138),e=e||{},"boolean"!=typeof a&&(a=t instanceof i),this.objectMode=!!e.objectMode,a&&(this.objectMode=this.objectMode||!!e.writableObjectMode),this.highWaterMark=f(this,e,"writableHighWaterMark",a),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===e.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new p;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(process.nextTick(i,r),process.nextTick(D,e,t),e._writableState.errorEmitted=!0,T(e,r)):(i(r),e._writableState.errorEmitted=!0,T(e,r),D(e,t))}(e,n,r,t,i);else{var a=N(n)||e.destroyed;a||n.corked||n.bufferProcessing||!n.bufferedRequest||w(e,n),r?process.nextTick(R,e,n,a,i):R(e,n,a,i)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==e.emitClose,this.autoDestroy=!!e.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new r(this)}function A(e){var t=this instanceof(i=i||n(6138));if(!t&&!a.call(A,this))return new A(e);this._writableState=new b(e,this,t),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),s.call(this)}function I(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new y("write")):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function R(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),D(e,t)}function w(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var i=t.bufferedRequestCount,a=new Array(i),o=t.corkedRequestsFree;o.entry=n;for(var s=0,u=!0;n;)a[s]=n,n.isBuf||(u=!1),n=n.next,s+=1;a.allBuffers=u,I(e,t,!0,t.length,a,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new r(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,f=n.callback;if(I(e,t,!1,t.objectMode?1:l.length,l,c,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function N(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function C(e,t){e._final((function(n){t.pendingcb--,n&&T(e,n),t.prefinished=!0,e.emit("prefinish"),D(e,t)}))}function D(e,t){var n=N(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(C,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}n(1765)(A,s),b.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(b.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(a=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!a.call(this,e)||this===A&&e&&e._writableState instanceof b}})):a=function(e){return e instanceof this},A.prototype.pipe=function(){T(this,new m)},A.prototype.write=function(e,t,n){var r,i=this._writableState,a=!1,o=!i.objectMode&&(r=e,u.isBuffer(r)||r instanceof l);return o&&!u.isBuffer(e)&&(e=function(e){return u.from(e)}(e)),"function"==typeof t&&(n=t,t=null),o?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof n&&(n=S),i.ending?function(e,t){var n=new v;T(e,n),process.nextTick(t,n)}(this,n):(o||function(e,t,n,r){var i;return null===n?i=new E:"string"==typeof n||t.objectMode||(i=new g("chunk",["string","Buffer"],n)),!i||(T(e,i),process.nextTick(r,i),!1)}(this,i,e,n))&&(i.pendingcb++,a=function(e,t,n,r,i,a){if(!n){var o=function(e,t,n){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=u.from(t,n)),t}(t,r,i);r!==o&&(n=!0,i="buffer",r=o)}var s=t.objectMode?1:r.length;t.length+=s;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:a,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else I(e,t,!1,s,r,i,a);return l}(this,i,o,e,t,n)),a},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||w(this,e))},A.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new _(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,n){n(new h("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,D(e,t),n&&(t.finished?process.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=c.destroy,A.prototype._undestroy=c.undestroy,A.prototype._destroy=function(e,t){t(e)}},7299:function(e,t,n){"use strict";var r;function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a=n(8800),o=Symbol("lastResolve"),s=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),c=Symbol("lastPromise"),f=Symbol("handlePromise"),d=Symbol("stream");function g(e,t){return{value:e,done:t}}function h(e){var t=e[o];if(null!==t){var n=e[d].read();null!==n&&(e[c]=null,e[o]=null,e[s]=null,t(g(n,!1)))}}function p(e){process.nextTick(h,e)}var m=Object.getPrototypeOf((function(){})),y=Object.setPrototypeOf((i(r={get stream(){return this[d]},next:function(){var e=this,t=this[u];if(null!==t)return Promise.reject(t);if(this[l])return Promise.resolve(g(void 0,!0));if(this[d].destroyed)return new Promise((function(t,n){process.nextTick((function(){e[u]?n(e[u]):t(g(void 0,!0))}))}));var n,r=this[c];if(r)n=new Promise(function(e,t){return function(n,r){e.then((function(){t[l]?n(g(void 0,!0)):t[f](n,r)}),r)}}(r,this));else{var i=this[d].read();if(null!==i)return Promise.resolve(g(i,!1));n=new Promise(this[f])}return this[c]=n,n}},Symbol.asyncIterator,(function(){return this})),i(r,"return",(function(){var e=this;return new Promise((function(t,n){e[d].destroy(null,(function(e){e?n(e):t(g(void 0,!0))}))}))})),r),m);e.exports=function(e){var t,n=Object.create(y,(i(t={},d,{value:e,writable:!0}),i(t,o,{value:null,writable:!0}),i(t,s,{value:null,writable:!0}),i(t,u,{value:null,writable:!0}),i(t,l,{value:e._readableState.endEmitted,writable:!0}),i(t,f,{value:function(e,t){var r=n[d].read();r?(n[c]=null,n[o]=null,n[s]=null,e(g(r,!1))):(n[o]=e,n[s]=t)},writable:!0}),t));return n[c]=null,a(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[s];return null!==t&&(n[c]=null,n[o]=null,n[s]=null,t(e)),void(n[u]=e)}var r=n[o];null!==r&&(n[c]=null,n[o]=null,n[s]=null,r(g(void 0,!0))),n[l]=!0})),e.on("readable",p.bind(null,n)),n}},8393:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(1549).Buffer,s=n(9862).inspect,u=s&&s.custom||"inspect";e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}var t,n;return t=e,n=[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return o.alloc(0);for(var t,n,r,i=o.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,n=i,r=s,o.prototype.copy.call(t,n,r),s+=a.data.length,a=a.next;return i}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,a=e>i.length?i.length:e;if(a===i.length?r+=i:r+=i.slice(0,e),0==(e-=a)){a===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(a));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=o.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,a=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,a),0==(e-=a)){a===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(a));break}++r}return this.length-=r,t}},{key:u,value:function(e,t){return s(this,function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},t,{depth:0,customInspect:!1}))}}],n&&a(t.prototype,n),e}()},6163:function(e){"use strict";function t(e,t){r(e,t),n(e)}function n(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function r(e,t){e.emit("error",t)}e.exports={destroy:function(e,i){var a=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(i?i(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(r,this,e)):process.nextTick(r,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,(function(e){!i&&e?a._writableState?a._writableState.errorEmitted?process.nextTick(n,a):(a._writableState.errorEmitted=!0,process.nextTick(t,a,e)):process.nextTick(t,a,e):i?(process.nextTick(n,a),i(e)):process.nextTick(n,a)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}}},8800:function(e,t,n){"use strict";var r=n(3690).q.ERR_STREAM_PREMATURE_CLOSE;function i(){}e.exports=function e(t,n,a){if("function"==typeof n)return e(t,null,n);n||(n={}),a=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(a||i);var o=n.readable||!1!==n.readable&&t.readable,s=n.writable||!1!==n.writable&&t.writable,u=function(){t.writable||c()},l=t._writableState&&t._writableState.finished,c=function(){s=!1,l=!0,o||a.call(t)},f=t._readableState&&t._readableState.endEmitted,d=function(){o=!1,f=!0,s||a.call(t)},g=function(e){a.call(t,e)},h=function(){var e;return o&&!f?(t._readableState&&t._readableState.ended||(e=new r),a.call(t,e)):s&&!l?(t._writableState&&t._writableState.ended||(e=new r),a.call(t,e)):void 0},p=function(){t.req.on("finish",c)};return function(e){return e.setHeader&&"function"==typeof e.abort}(t)?(t.on("complete",c),t.on("abort",h),t.req?p():t.on("request",p)):s&&!t._writableState&&(t.on("end",u),t.on("close",u)),t.on("end",d),t.on("finish",c),!1!==n.error&&t.on("error",g),t.on("close",h),function(){t.removeListener("complete",c),t.removeListener("abort",h),t.removeListener("request",p),t.req&&t.req.removeListener("finish",c),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",c),t.removeListener("end",d),t.removeListener("error",g),t.removeListener("close",h)}}},6233:function(e){e.exports=function(){throw new Error("Readable.from is not available in the browser")}},7295:function(e,t,n){"use strict";var r,i=n(3690).q,a=i.ERR_MISSING_ARGS,o=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function u(e,t,i,a){a=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(a);var s=!1;e.on("close",(function(){s=!0})),void 0===r&&(r=n(8800)),r(e,{readable:t,writable:i},(function(e){if(e)return a(e);s=!0,a()}));var u=!1;return function(t){if(!s&&!u)return u=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void a(t||new o("pipe"))}}function l(e){e()}function c(e,t){return e.pipe(t)}function f(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}e.exports=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i=f(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new a("streams");var o=t.map((function(e,n){var a=n<t.length-1;return u(e,a,n>0,(function(e){r||(r=e),e&&o.forEach(l),a||(o.forEach(l),i(r))}))}));return t.reduce(c)}},7269:function(e,t,n){"use strict";var r=n(3690).q.ERR_INVALID_OPT_VALUE;e.exports={getHighWaterMark:function(e,t,n,i){var a=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(t,i,n);if(null!=a){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new r(i?n:"highWaterMark",a);return Math.floor(a)}return e.objectMode?16:16384}}},9299:function(e,t,n){e.exports=n(1159).EventEmitter},7503:function(e,t,n){"use strict";var r=n(8387).Buffer,i=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function a(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===i||!i(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=u,this.end=l,t=4;break;case"utf8":this.fillLast=s,t=4;break;case"base64":this.text=c,this.end=f,t=3;break;default:return this.write=d,void(this.end=g)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function o(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function s(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function u(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function d(e){return e.toString(this.encoding)}function g(e){return e&&e.length?this.write(e):""}t.s=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},a.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},a.prototype.text=function(e,t){var n=function(e,t,n){var r=t.length-1;if(r<n)return 0;var i=o(t[r]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--r<n||-2===i?0:(i=o(t[r]))>=0?(i>0&&(e.lastNeed=i-2),i):--r<n||-2===i?0:(i=o(t[r]))>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},a.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},1067:function(e,t,n){var r;!function(i,a){"use strict";var o="function",s="undefined",u="object",l="string",c="model",f="name",d="type",g="vendor",h="version",p="architecture",m="console",y="mobile",E="tablet",v="smarttv",_="wearable",T="embedded",S="Amazon",b="Apple",A="ASUS",I="BlackBerry",R="Browser",w="Chrome",N="Firefox",C="Google",D="Huawei",O="LG",M="Microsoft",P="Motorola",L="Opera",x="Samsung",F="Sony",k="Xiaomi",U="Zebra",Z="Facebook",B=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},G=function(e,t){return typeof e===l&&-1!==q(t).indexOf(q(e))},q=function(e){return e.toLowerCase()},Y=function(e,t){if(typeof e===l)return e=e.replace(/^\\s\\s*/,"").replace(/\\s\\s*$/,""),typeof t===s?e:e.substring(0,255)},j=function(e,t){for(var n,r,i,s,l,c,f=0;f<t.length&&!l;){var d=t[f],g=t[f+1];for(n=r=0;n<d.length&&!l;)if(l=d[n++].exec(e))for(i=0;i<g.length;i++)c=l[++r],typeof(s=g[i])===u&&s.length>0?2===s.length?typeof s[1]==o?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:3===s.length?typeof s[1]!==o||s[1].exec&&s[1].test?this[s[0]]=c?c.replace(s[1],s[2]):a:this[s[0]]=c?s[1].call(this,c,s[2]):a:4===s.length&&(this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):a):this[s]=c||a;f+=2}},H=function(e,t){for(var n in t)if(typeof t[n]===u&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(G(t[n][r],e))return"?"===n?a:n}else if(G(t[n],e))return"?"===n?a:n;return e},V={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},K={browser:[[/\\b(?:crmo|crios)\\/([\\w\\.]+)/i],[h,[f,"Chrome"]],[/edg(?:e|ios|a)?\\/([\\w\\.]+)/i],[h,[f,"Edge"]],[/(opera mini)\\/([-\\w\\.]+)/i,/(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i,/(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i],[f,h],[/opios[\\/ ]+([\\w\\.]+)/i],[h,[f,L+" Mini"]],[/\\bopr\\/([\\w\\.]+)/i],[h,[f,L]],[/(kindle)\\/([\\w\\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i,/(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i,/(?:ms|\\()(ie) ([\\w\\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\\/([-\\w\\.]+)/i,/(weibo)__([\\d\\.]+)/i],[f,h],[/(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i],[h,[f,"UC"+R]],[/\\bqbcore\\/([\\w\\.]+)/i],[h,[f,"WeChat(Win) Desktop"]],[/micromessenger\\/([\\w\\.]+)/i],[h,[f,"WeChat"]],[/konqueror\\/([\\w\\.]+)/i],[h,[f,"Konqueror"]],[/trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i],[h,[f,"IE"]],[/yabrowser\\/([\\w\\.]+)/i],[h,[f,"Yandex"]],[/(avast|avg)\\/([\\w\\.]+)/i],[[f,/(.+)/,"$1 Secure "+R],h],[/\\bfocus\\/([\\w\\.]+)/i],[h,[f,N+" Focus"]],[/\\bopt\\/([\\w\\.]+)/i],[h,[f,L+" Touch"]],[/coc_coc\\w+\\/([\\w\\.]+)/i],[h,[f,"Coc Coc"]],[/dolfin\\/([\\w\\.]+)/i],[h,[f,"Dolphin"]],[/coast\\/([\\w\\.]+)/i],[h,[f,L+" Coast"]],[/miuibrowser\\/([\\w\\.]+)/i],[h,[f,"MIUI "+R]],[/fxios\\/([-\\w\\.]+)/i],[h,[f,N]],[/\\bqihu|(qi?ho?o?|360)browser/i],[[f,"360 "+R]],[/(oculus|samsung|sailfish)browser\\/([\\w\\.]+)/i],[[f,/(.+)/,"$1 "+R],h],[/(comodo_dragon)\\/([\\w\\.]+)/i],[[f,/_/g," "],h],[/(electron)\\/([\\w\\.]+) safari/i,/(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i],[f,h],[/(metasr)[\\/ ]?([\\w\\.]+)/i,/(lbbrowser)/i],[f],[/((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i],[[f,Z],h],[/safari (line)\\/([\\w\\.]+)/i,/\\b(line)\\/([\\w\\.]+)\\/iab/i,/(chromium|instagram)[\\/ ]([-\\w\\.]+)/i],[f,h],[/\\bgsa\\/([\\w\\.]+) .*safari\\//i],[h,[f,"GSA"]],[/headlesschrome(?:\\/([\\w\\.]+)| )/i],[h,[f,w+" Headless"]],[/ wv\\).+(chrome)\\/([\\w\\.]+)/i],[[f,w+" WebView"],h],[/droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i],[h,[f,"Android "+R]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i],[f,h],[/version\\/([\\w\\.]+) .*mobile\\/\\w+ (safari)/i],[h,[f,"Mobile Safari"]],[/version\\/([\\w\\.]+) .*(mobile ?safari|safari)/i],[h,f],[/webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i],[f,[h,H,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\\/([\\w\\.]+)/i],[f,h],[/(navigator|netscape\\d?)\\/([-\\w\\.]+)/i],[[f,"Netscape"],h],[/mobile vr; rv:([\\w\\.]+)\\).+firefox/i],[h,[f,N+" Reality"]],[/ekiohf.+(flow)\\/([\\w\\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,/(firefox)\\/([\\w\\.]+)/i,/(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,/(links) \\(([\\w\\.]+)/i],[f,h]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,q]],[/((?:i[346]|x)86)[;\\)]/i],[[p,"ia32"]],[/\\b(aarch64|arm(v?8e?l?|_?64))\\b/i],[[p,"arm64"]],[/\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i],[[p,"armhf"]],[/windows (ce|mobile); ppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i],[[p,/ower/,"",q]],[/(sun4\\w)[;\\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i],[[p,q]]],device:[[/\\b(sch-i[89]0\\d|shw-m380s|sm-[pt]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i],[c,[g,x],[d,E]],[/\\b((?:s[cgp]h|gt|sm)-\\w+|galaxy nexus)/i,/samsung[- ]([-\\w]+)/i,/sec-(sgh\\w+)/i],[c,[g,x],[d,y]],[/\\((ip(?:hone|od)[\\w ]*);/i],[c,[g,b],[d,y]],[/\\((ipad);[-\\w\\),; ]+apple/i,/applecoremedia\\/[\\w\\.]+ \\((ipad)/i,/\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i],[c,[g,b],[d,E]],[/\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i],[c,[g,D],[d,E]],[/(?:huawei|honor)([-\\w ]+)[;\\)]/i,/\\b(nexus 6p|\\w{2,4}-[atu]?[ln][01259x][012359][an]?)\\b(?!.+d\\/s)/i],[c,[g,D],[d,y]],[/\\b(poco[\\w ]+)(?: bui|\\))/i,/\\b; (\\w+) build\\/hm\\1/i,/\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i,/\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i,/\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i],[[c,/_/g," "],[g,k],[d,y]],[/\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i],[[c,/_/g," "],[g,k],[d,E]],[/; (\\w+) bui.+ oppo/i,/\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i],[c,[g,"OPPO"],[d,y]],[/vivo (\\w+)(?: bui|\\))/i,/\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i],[c,[g,"Vivo"],[d,y]],[/\\b(rmx[12]\\d{3})(?: bui|;|\\))/i],[c,[g,"Realme"],[d,y]],[/\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,/\\bmot(?:orola)?[- ](\\w*)/i,/((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i],[c,[g,P],[d,y]],[/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],[c,[g,P],[d,E]],[/((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[g,O],[d,E]],[/(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,/\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,/\\blg-?([\\d\\w]+) bui/i],[c,[g,O],[d,y]],[/(ideatab[-\\w ]+)/i,/lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i],[c,[g,"Lenovo"],[d,E]],[/(?:maemo|nokia).*(n900|lumia \\d+)/i,/nokia[-_ ]?([-\\w\\.]*)/i],[[c,/_/g," "],[g,"Nokia"],[d,y]],[/(pixel c)\\b/i],[c,[g,C],[d,E]],[/droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i],[c,[g,C],[d,y]],[/droid.+ ([c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i],[c,[g,F],[d,y]],[/sony tablet [ps]/i,/\\b(?:sony)?sgp\\w+(?: bui|\\))/i],[[c,"Xperia Tablet"],[g,F],[d,E]],[/ (kb2005|in20[12]5|be20[12][59])\\b/i,/(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i],[c,[g,"OnePlus"],[d,y]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\\))/i,/(kf[a-z]+)( bui|\\)).+silk\\//i],[c,[g,S],[d,E]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i],[[c,/(.+)/g,"Fire Phone $1"],[g,S],[d,y]],[/(playbook);[-\\w\\),; ]+(rim)/i],[c,g,[d,E]],[/\\b((?:bb[a-f]|st[hv])100-\\d)/i,/\\(bb10; (\\w+)/i],[c,[g,I],[d,y]],[/(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i],[c,[g,A],[d,E]],[/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],[c,[g,A],[d,y]],[/(nexus 9)/i],[c,[g,"HTC"],[d,E]],[/(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i,/(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\\w]*)/i],[g,[c,/_/g," "],[d,y]],[/droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i],[c,[g,"Acer"],[d,E]],[/droid.+; (m[1-5] note) bui/i,/\\bmz-([-\\w]{2,})/i],[c,[g,"Meizu"],[d,y]],[/\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i],[c,[g,"Sharp"],[d,y]],[/(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,/(hp) ([\\w ]+\\w)/i,/(asus)-?(\\w+)/i,/(microsoft); (lumia[\\w ]+)/i,/(lenovo)[-_ ]?([-\\w]+)/i,/(jolla)/i,/(oppo) ?([\\w ]+) bui/i],[g,c,[d,y]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\\/([\\w\\.]+)/i,/(nook)[\\w ]+build\\/(\\w+)/i,/(dell) (strea[kpr\\d ]*[\\dko])/i,/(le[- ]+pan)[- ]+(\\w{1,9}) bui/i,/(trinity)[- ]*(t\\d{3}) bui/i,/(gigaset)[- ]+(q\\w{1,9}) bui/i,/(vodafone) ([\\w ]+)(?:\\)| bui)/i],[g,c,[d,E]],[/(surface duo)/i],[c,[g,M],[d,E]],[/droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i],[c,[g,"Fairphone"],[d,y]],[/(u304aa)/i],[c,[g,"AT&T"],[d,y]],[/\\bsie-(\\w*)/i],[c,[g,"Siemens"],[d,y]],[/\\b(rct\\w+) b/i],[c,[g,"RCA"],[d,E]],[/\\b(venue[\\d ]{2,7}) b/i],[c,[g,"Dell"],[d,E]],[/\\b(q(?:mv|ta)\\w+) b/i],[c,[g,"Verizon"],[d,E]],[/\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i],[c,[g,"Barnes & Noble"],[d,E]],[/\\b(tm\\d{3}\\w+) b/i],[c,[g,"NuVision"],[d,E]],[/\\b(k88) b/i],[c,[g,"ZTE"],[d,E]],[/\\b(nx\\d{3}j) b/i],[c,[g,"ZTE"],[d,y]],[/\\b(gen\\d{3}) b.+49h/i],[c,[g,"Swiss"],[d,y]],[/\\b(zur\\d{3}) b/i],[c,[g,"Swiss"],[d,E]],[/\\b((zeki)?tb.*\\b) b/i],[c,[g,"Zeki"],[d,E]],[/\\b([yr]\\d{2}) b/i,/\\b(dragon[- ]+touch |dt)(\\w{5}) b/i],[[g,"Dragon Touch"],c,[d,E]],[/\\b(ns-?\\w{0,9}) b/i],[c,[g,"Insignia"],[d,E]],[/\\b((nxa|next)-?\\w{0,9}) b/i],[c,[g,"NextBook"],[d,E]],[/\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[g,"Voice"],c,[d,y]],[/\\b(lvtel\\-)?(v1[12]) b/i],[[g,"LvTel"],c,[d,y]],[/\\b(ph-1) /i],[c,[g,"Essential"],[d,y]],[/\\b(v(100md|700na|7011|917g).*\\b) b/i],[c,[g,"Envizen"],[d,E]],[/\\b(trio[-\\w\\. ]+) b/i],[c,[g,"MachSpeed"],[d,E]],[/\\btu_(1491) b/i],[c,[g,"Rotor"],[d,E]],[/(shield[\\w ]+) b/i],[c,[g,"Nvidia"],[d,E]],[/(sprint) (\\w+)/i],[g,c,[d,y]],[/(kin\\.[onetw]{3})/i],[[c,/\\./g," "],[g,M],[d,y]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i],[c,[g,U],[d,E]],[/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],[c,[g,U],[d,y]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[g,c,[d,m]],[/droid.+; (shield) bui/i],[c,[g,"Nvidia"],[d,m]],[/(playstation [345portablevi]+)/i],[c,[g,F],[d,m]],[/\\b(xbox(?: one)?(?!; xbox))[\\); ]/i],[c,[g,M],[d,m]],[/smart-tv.+(samsung)/i],[g,[d,v]],[/hbbtv.+maple;(\\d+)/i],[[c,/^/,"SmartTV"],[g,x],[d,v]],[/(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i],[[g,O],[d,v]],[/(apple) ?tv/i],[g,[c,b+" TV"],[d,v]],[/crkey/i],[[c,w+"cast"],[g,C],[d,v]],[/droid.+aft(\\w)( bui|\\))/i],[c,[g,S],[d,v]],[/\\(dtv[\\);].+(aquos)/i],[c,[g,"Sharp"],[d,v]],[/\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i,/hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w ]*; *(\\w[^;]*);([^;]*)/i],[[g,Y],[c,Y],[d,v]],[/\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i],[[d,v]],[/((pebble))app/i],[g,c,[d,_]],[/droid.+; (glass) \\d/i],[c,[g,C],[d,_]],[/droid.+; (wt63?0{2,3})\\)/i],[c,[g,U],[d,_]],[/(quest( 2)?)/i],[c,[g,Z],[d,_]],[/(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i],[g,[d,T]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i],[c,[d,y]],[/droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i],[c,[d,E]],[/\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i],[[d,E]],[/(phone|mobile(?:[;\\/]| safari)|pda(?=.+windows ce))/i],[[d,y]],[/(android[-\\w\\. ]{0,9});.+buil/i],[c,[g,"Generic"]]],engine:[[/windows.+ edge\\/([\\w\\.]+)/i],[h,[f,"EdgeHTML"]],[/webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i],[h,[f,"Blink"]],[/(presto)\\/([\\w\\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i,/ekioh(flow)\\/([\\w\\.]+)/i,/(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i,/(icab)[\\/ ]([23]\\.[\\d\\.]+)/i],[f,h],[/rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i],[h,f]],os:[[/microsoft (windows) (vista|xp)/i],[f,h],[/(windows) nt 6\\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i,/(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i],[f,[h,H,V]],[/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],[[f,"Windows"],[h,H,V]],[/ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i,/cfnetwork\\/.+darwin/i],[[h,/_/g,"."],[f,"iOS"]],[/(mac os x) ?([\\w\\. ]*)/i,/(macintosh|mac_powerpc\\b)(?!.+haiku)/i],[[f,"Mac OS"],[h,/_/g,"."]],[/droid ([\\w\\.]+)\\b.+(android[- ]x86)/i],[h,f],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,/(blackberry)\\w*\\/([\\w\\.]*)/i,/(tizen|kaios)[\\/ ]([\\w\\.]+)/i,/\\((series40);/i],[f,h],[/\\(bb(10);/i],[h,[f,I]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i],[h,[f,"Symbian"]],[/mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i],[h,[f,N+" OS"]],[/web0s;.+rt(tv)/i,/\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i],[h,[f,"webOS"]],[/crkey\\/([\\d\\.]+)/i],[h,[f,w+"cast"]],[/(cros) [\\w]+ ([\\w\\.]+\\w)/i],[[f,"Chromium OS"],h],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\\);]+)/i,/\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i,/(mint)[\\/\\(\\) ]?(\\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,/(hurd|linux) ?([\\w\\.]*)/i,/(gnu) ?([\\w\\.]*)/i,/\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i,/(haiku) (\\w+)/i],[f,h],[/(sunos) ?([\\w\\.\\d]*)/i],[[f,"Solaris"],h],[/((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i,/(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i,/\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\\w\\.]*)/i],[f,h]]},z=function(e,t){if(typeof e===u&&(t=e,e=a),!(this instanceof z))return new z(e,t).getResult();var n=e||(typeof i!==s&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),r=t?function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n}(K,t):K;return this.getBrowser=function(){var e,t={};return t[f]=a,t[h]=a,j.call(t,n,r.browser),t.major=typeof(e=t.version)===l?e.replace(/[^\\d\\.]/g,"").split(".")[0]:a,t},this.getCPU=function(){var e={};return e[p]=a,j.call(e,n,r.cpu),e},this.getDevice=function(){var e={};return e[g]=a,e[c]=a,e[d]=a,j.call(e,n,r.device),e},this.getEngine=function(){var e={};return e[f]=a,e[h]=a,j.call(e,n,r.engine),e},this.getOS=function(){var e={};return e[f]=a,e[h]=a,j.call(e,n,r.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===l&&e.length>255?Y(e,255):e,this},this.setUA(n),this};z.VERSION="1.0.2",z.BROWSER=B([f,h,"major"]),z.CPU=B([p]),z.DEVICE=B([c,g,d,m,y,v,E,_,T]),z.ENGINE=z.OS=B([f,h]),typeof t!==s?(e.exports&&(t=e.exports=z),t.UAParser=z):n.amdO?(r=function(){return z}.call(t,n,t,e))===a||(e.exports=r):typeof i!==s&&(i.UAParser=z);var W=typeof i!==s&&(i.jQuery||i.Zepto);if(W&&!W.ua){var X=new z;W.ua=X.getResult(),W.ua.get=function(){return X.getUA()},W.ua.set=function(e){X.setUA(e);var t=X.getResult();for(var n in t)W.ua[n]=t[n]}}}("object"==typeof window?window:this)},7839:function(e,t,n){function r(e){try{if(!n.g.localStorage)return!1}catch(e){return!1}var t=n.g.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}e.exports=function(e,t){if(r("noDeprecation"))return e;var n=!1;return function(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}}},9862:function(){},964:function(){},3165:function(e){"use strict";e.exports=JSON.parse(\'["mni-beng-in","mni-mtei-in","sat-deva-in","sat-olck-in","shi-latn-ma","shi-tfng-ma","vai-latn-lr","vai-vaii-lr","yue-hans-cn","yue-hant-hk","az-arab-ir","az-cyrl-az","az-latn-az","bm-nkoo-ml","bs-cyrl-ba","bs-latn-ba","en-dsrt-us","ff-adlm-gn","ff-latn-sn","ha-arab-ng","hi-latn-in","iu-latn-ca","ks-arab-in","ks-deva-in","mn-mong-cn","ms-arab-my","pa-arab-pk","pa-guru-in","sd-arab-pk","sd-deva-in","sr-cyrl-rs","sr-latn-rs","su-latn-id","uz-arab-af","uz-cyrl-uz","uz-latn-uz","zh-hans-cn","zh-hant-tw","mni-beng","sat-olck","shi-tfng","vai-vaii","yue-hant","az-latn","bs-latn","ff-latn","jbo-001","ks-arab","pa-guru","prg-001","sd-arab","sr-cyrl","su-latn","uz-latn","zh-hans","agq-cm","ar-001","arn-cl","asa-tz","ast-es","bas-cm","bem-zm","bez-tz","bgn-pk","blt-vn","brx-in","bss-cm","byn-er","cad-us","cch-ng","ccp-bd","ceb-ph","cgg-ug","chr-us","cic-us","ckb-iq","dav-ke","dje-ne","doi-in","dsb-de","dua-cm","dyo-sn","ebu-ke","eo-001","ewo-cm","fil-ph","fur-it","gaa-gh","gez-et","gsw-ch","guz-ke","haw-us","hsb-de","ia-001","ife-tg","io-001","jgo-cm","jmc-tz","kab-dz","kaj-ng","kam-ke","kcg-ng","kde-tz","kea-cv","ken-cm","khq-ml","kkj-cm","kln-ke","kok-in","kpe-lr","ksb-tz","ksf-cm","ksh-de","lag-tz","lkt-us","lrc-ir","luo-ke","luy-ke","mai-in","mas-ke","mer-ke","mfe-mu","mgh-mz","mgo-cm","moh-ca","mua-cm","mus-us","myv-ru","mzn-ir","naq-na","nds-de","nmg-cm","nnh-cm","nqo-gn","nso-za","nus-ss","nyn-ug","osa-us","pcm-ng","quc-gt","rof-tz","rwk-tz","sah-ru","saq-ke","sbp-tz","scn-it","sdh-ir","seh-mz","ses-ml","sid-et","sma-se","smj-se","smn-fi","sms-fi","ssy-er","syr-iq","szl-pl","teo-ug","tig-er","trv-tw","trw-pk","twq-ne","tzm-ma","vo-001","vun-tz","wae-ch","wal-et","wbp-au","xog-ug","yav-cm","yi-001","zgh-ma","aa-et","af-za","ak-gh","am-et","an-es","as-in","ba-ru","be-by","bg-bg","bm-ml","bn-bd","bo-cn","br-fr","ca-es","ce-ru","co-fr","cs-cz","cu-ru","cv-ru","cy-gb","da-dk","de-de","dv-mv","dz-bt","ee-gh","el-gr","en-us","es-es","et-ee","eu-es","fa-ir","fi-fi","fo-fo","fr-fr","fy-nl","ga-ie","gd-gb","gl-es","gn-py","gu-in","gv-im","ha-ng","he-il","hi-in","hr-hr","hu-hu","hy-am","id-id","ig-ng","ii-cn","is-is","it-it","iu-ca","ja-jp","jv-id","ka-ge","ki-ke","kk-kz","kl-gl","km-kh","kn-in","ko-kr","ku-tr","kw-gb","ky-kg","lb-lu","lg-ug","ln-cd","lo-la","lt-lt","lu-cd","lv-lv","mg-mg","mi-nz","mk-mk","ml-in","mn-mn","mr-in","ms-my","mt-mt","my-mm","nb-no","nd-zw","ne-np","nl-nl","nn-no","nr-za","nv-us","ny-mw","oc-fr","om-et","or-in","os-ge","pl-pl","ps-af","pt-br","qu-pe","rm-ch","rn-bi","ro-ro","ru-ru","rw-rw","sa-in","sc-it","se-no","sg-cf","si-lk","sk-sk","sl-si","sn-zw","so-so","sq-al","ss-za","st-za","sv-se","sw-tz","ta-in","te-in","tg-tj","th-th","ti-et","tk-tm","tn-za","to-to","tr-tr","ts-za","tt-ru","ug-cn","uk-ua","ur-pk","ve-za","vi-vn","wa-be","wo-sn","xh-za","yo-ng","zu-za"]\')},5813:function(e){"use strict";e.exports=JSON.parse(\'[{"from":{"field":"script","value":"qaai"},"to":{"field":"script","value":"zinh"}},{"from":{"field":"region","value":"bu"},"to":{"field":"region","value":"mm"}},{"from":{"field":"region","value":"ct"},"to":{"field":"region","value":"ki"}},{"from":{"field":"region","value":"dd"},"to":{"field":"region","value":"de"}},{"from":{"field":"region","value":"dy"},"to":{"field":"region","value":"bj"}},{"from":{"field":"region","value":"fx"},"to":{"field":"region","value":"fr"}},{"from":{"field":"region","value":"hv"},"to":{"field":"region","value":"bf"}},{"from":{"field":"region","value":"jt"},"to":{"field":"region","value":"um"}},{"from":{"field":"region","value":"mi"},"to":{"field":"region","value":"um"}},{"from":{"field":"region","value":"nh"},"to":{"field":"region","value":"vu"}},{"from":{"field":"region","value":"nq"},"to":{"field":"region","value":"aq"}},{"from":{"field":"region","value":"pu"},"to":{"field":"region","value":"um"}},{"from":{"field":"region","value":"pz"},"to":{"field":"region","value":"pa"}},{"from":{"field":"region","value":"qu"},"to":{"field":"region","value":"eu"}},{"from":{"field":"region","value":"rh"},"to":{"field":"region","value":"zw"}},{"from":{"field":"region","value":"tp"},"to":{"field":"region","value":"tl"}},{"from":{"field":"region","value":"uk"},"to":{"field":"region","value":"gb"}},{"from":{"field":"region","value":"vd"},"to":{"field":"region","value":"vn"}},{"from":{"field":"region","value":"wk"},"to":{"field":"region","value":"um"}},{"from":{"field":"region","value":"yd"},"to":{"field":"region","value":"ye"}},{"from":{"field":"region","value":"zr"},"to":{"field":"region","value":"cd"}},{"from":{"field":"region","value":"230"},"to":{"field":"region","value":"et"}},{"from":{"field":"region","value":"280"},"to":{"field":"region","value":"de"}},{"from":{"field":"region","value":"736"},"to":{"field":"region","value":"sd"}},{"from":{"field":"region","value":"886"},"to":{"field":"region","value":"ye"}},{"from":{"field":"region","value":"958"},"to":{"field":"region","value":"aa"}},{"from":{"field":"region","value":"020"},"to":{"field":"region","value":"ad"}},{"from":{"field":"region","value":"784"},"to":{"field":"region","value":"ae"}},{"from":{"field":"region","value":"004"},"to":{"field":"region","value":"af"}},{"from":{"field":"region","value":"028"},"to":{"field":"region","value":"ag"}},{"from":{"field":"region","value":"660"},"to":{"field":"region","value":"ai"}},{"from":{"field":"region","value":"008"},"to":{"field":"region","value":"al"}},{"from":{"field":"region","value":"051"},"to":{"field":"region","value":"am"}},{"from":{"field":"region","value":"024"},"to":{"field":"region","value":"ao"}},{"from":{"field":"region","value":"010"},"to":{"field":"region","value":"aq"}},{"from":{"field":"region","value":"032"},"to":{"field":"region","value":"ar"}},{"from":{"field":"region","value":"016"},"to":{"field":"region","value":"as"}},{"from":{"field":"region","value":"040"},"to":{"field":"region","value":"at"}},{"from":{"field":"region","value":"036"},"to":{"field":"region","value":"au"}},{"from":{"field":"region","value":"533"},"to":{"field":"region","value":"aw"}},{"from":{"field":"region","value":"248"},"to":{"field":"region","value":"ax"}},{"from":{"field":"region","value":"031"},"to":{"field":"region","value":"az"}},{"from":{"field":"region","value":"070"},"to":{"field":"region","value":"ba"}},{"from":{"field":"region","value":"052"},"to":{"field":"region","value":"bb"}},{"from":{"field":"region","value":"050"},"to":{"field":"region","value":"bd"}},{"from":{"field":"region","value":"056"},"to":{"field":"region","value":"be"}},{"from":{"field":"region","value":"854"},"to":{"field":"region","value":"bf"}},{"from":{"field":"region","value":"100"},"to":{"field":"region","value":"bg"}},{"from":{"field":"region","value":"048"},"to":{"field":"region","value":"bh"}},{"from":{"field":"region","value":"108"},"to":{"field":"region","value":"bi"}},{"from":{"field":"region","value":"204"},"to":{"field":"region","value":"bj"}},{"from":{"field":"region","value":"652"},"to":{"field":"region","value":"bl"}},{"from":{"field":"region","value":"060"},"to":{"field":"region","value":"bm"}},{"from":{"field":"region","value":"096"},"to":{"field":"region","value":"bn"}},{"from":{"field":"region","value":"068"},"to":{"field":"region","value":"bo"}},{"from":{"field":"region","value":"535"},"to":{"field":"region","value":"bq"}},{"from":{"field":"region","value":"076"},"to":{"field":"region","value":"br"}},{"from":{"field":"region","value":"044"},"to":{"field":"region","value":"bs"}},{"from":{"field":"region","value":"064"},"to":{"field":"region","value":"bt"}},{"from":{"field":"region","value":"104"},"to":{"field":"region","value":"mm"}},{"from":{"field":"region","value":"074"},"to":{"field":"region","value":"bv"}},{"from":{"field":"region","value":"072"},"to":{"field":"region","value":"bw"}},{"from":{"field":"region","value":"112"},"to":{"field":"region","value":"by"}},{"from":{"field":"region","value":"084"},"to":{"field":"region","value":"bz"}},{"from":{"field":"region","value":"124"},"to":{"field":"region","value":"ca"}},{"from":{"field":"region","value":"166"},"to":{"field":"region","value":"cc"}},{"from":{"field":"region","value":"180"},"to":{"field":"region","value":"cd"}},{"from":{"field":"region","value":"140"},"to":{"field":"region","value":"cf"}},{"from":{"field":"region","value":"178"},"to":{"field":"region","value":"cg"}},{"from":{"field":"region","value":"756"},"to":{"field":"region","value":"ch"}},{"from":{"field":"region","value":"384"},"to":{"field":"region","value":"ci"}},{"from":{"field":"region","value":"184"},"to":{"field":"region","value":"ck"}},{"from":{"field":"region","value":"152"},"to":{"field":"region","value":"cl"}},{"from":{"field":"region","value":"120"},"to":{"field":"region","value":"cm"}},{"from":{"field":"region","value":"156"},"to":{"field":"region","value":"cn"}},{"from":{"field":"region","value":"170"},"to":{"field":"region","value":"co"}},{"from":{"field":"region","value":"188"},"to":{"field":"region","value":"cr"}},{"from":{"field":"region","value":"192"},"to":{"field":"region","value":"cu"}},{"from":{"field":"region","value":"132"},"to":{"field":"region","value":"cv"}},{"from":{"field":"region","value":"531"},"to":{"field":"region","value":"cw"}},{"from":{"field":"region","value":"162"},"to":{"field":"region","value":"cx"}},{"from":{"field":"region","value":"196"},"to":{"field":"region","value":"cy"}},{"from":{"field":"region","value":"203"},"to":{"field":"region","value":"cz"}},{"from":{"field":"region","value":"278"},"to":{"field":"region","value":"de"}},{"from":{"field":"region","value":"276"},"to":{"field":"region","value":"de"}},{"from":{"field":"region","value":"262"},"to":{"field":"region","value":"dj"}},{"from":{"field":"region","value":"208"},"to":{"field":"region","value":"dk"}},{"from":{"field":"region","value":"212"},"to":{"field":"region","value":"dm"}},{"from":{"field":"region","value":"214"},"to":{"field":"region","value":"do"}},{"from":{"field":"region","value":"012"},"to":{"field":"region","value":"dz"}},{"from":{"field":"region","value":"218"},"to":{"field":"region","value":"ec"}},{"from":{"field":"region","value":"233"},"to":{"field":"region","value":"ee"}},{"from":{"field":"region","value":"818"},"to":{"field":"region","value":"eg"}},{"from":{"field":"region","value":"732"},"to":{"field":"region","value":"eh"}},{"from":{"field":"region","value":"232"},"to":{"field":"region","value":"er"}},{"from":{"field":"region","value":"724"},"to":{"field":"region","value":"es"}},{"from":{"field":"region","value":"231"},"to":{"field":"region","value":"et"}},{"from":{"field":"region","value":"246"},"to":{"field":"region","value":"fi"}},{"from":{"field":"region","value":"242"},"to":{"field":"region","value":"fj"}},{"from":{"field":"region","value":"238"},"to":{"field":"region","value":"fk"}},{"from":{"field":"region","value":"583"},"to":{"field":"region","value":"fm"}},{"from":{"field":"region","value":"234"},"to":{"field":"region","value":"fo"}},{"from":{"field":"region","value":"250"},"to":{"field":"region","value":"fr"}},{"from":{"field":"region","value":"249"},"to":{"field":"region","value":"fr"}},{"from":{"field":"region","value":"266"},"to":{"field":"region","value":"ga"}},{"from":{"field":"region","value":"826"},"to":{"field":"region","value":"gb"}},{"from":{"field":"region","value":"308"},"to":{"field":"region","value":"gd"}},{"from":{"field":"region","value":"268"},"to":{"field":"region","value":"ge"}},{"from":{"field":"region","value":"254"},"to":{"field":"region","value":"gf"}},{"from":{"field":"region","value":"831"},"to":{"field":"region","value":"gg"}},{"from":{"field":"region","value":"288"},"to":{"field":"region","value":"gh"}},{"from":{"field":"region","value":"292"},"to":{"field":"region","value":"gi"}},{"from":{"field":"region","value":"304"},"to":{"field":"region","value":"gl"}},{"from":{"field":"region","value":"270"},"to":{"field":"region","value":"gm"}},{"from":{"field":"region","value":"324"},"to":{"field":"region","value":"gn"}},{"from":{"field":"region","value":"312"},"to":{"field":"region","value":"gp"}},{"from":{"field":"region","value":"226"},"to":{"field":"region","value":"gq"}},{"from":{"field":"region","value":"300"},"to":{"field":"region","value":"gr"}},{"from":{"field":"region","value":"239"},"to":{"field":"region","value":"gs"}},{"from":{"field":"region","value":"320"},"to":{"field":"region","value":"gt"}},{"from":{"field":"region","value":"316"},"to":{"field":"region","value":"gu"}},{"from":{"field":"region","value":"624"},"to":{"field":"region","value":"gw"}},{"from":{"field":"region","value":"328"},"to":{"field":"region","value":"gy"}},{"from":{"field":"region","value":"344"},"to":{"field":"region","value":"hk"}},{"from":{"field":"region","value":"334"},"to":{"field":"region","value":"hm"}},{"from":{"field":"region","value":"340"},"to":{"field":"region","value":"hn"}},{"from":{"field":"region","value":"191"},"to":{"field":"region","value":"hr"}},{"from":{"field":"region","value":"332"},"to":{"field":"region","value":"ht"}},{"from":{"field":"region","value":"348"},"to":{"field":"region","value":"hu"}},{"from":{"field":"region","value":"360"},"to":{"field":"region","value":"id"}},{"from":{"field":"region","value":"372"},"to":{"field":"region","value":"ie"}},{"from":{"field":"region","value":"376"},"to":{"field":"region","value":"il"}},{"from":{"field":"region","value":"833"},"to":{"field":"region","value":"im"}},{"from":{"field":"region","value":"356"},"to":{"field":"region","value":"in"}},{"from":{"field":"region","value":"086"},"to":{"field":"region","value":"io"}},{"from":{"field":"region","value":"368"},"to":{"field":"region","value":"iq"}},{"from":{"field":"region","value":"364"},"to":{"field":"region","value":"ir"}},{"from":{"field":"region","value":"352"},"to":{"field":"region","value":"is"}},{"from":{"field":"region","value":"380"},"to":{"field":"region","value":"it"}},{"from":{"field":"region","value":"832"},"to":{"field":"region","value":"je"}},{"from":{"field":"region","value":"388"},"to":{"field":"region","value":"jm"}},{"from":{"field":"region","value":"400"},"to":{"field":"region","value":"jo"}},{"from":{"field":"region","value":"392"},"to":{"field":"region","value":"jp"}},{"from":{"field":"region","value":"404"},"to":{"field":"region","value":"ke"}},{"from":{"field":"region","value":"417"},"to":{"field":"region","value":"kg"}},{"from":{"field":"region","value":"116"},"to":{"field":"region","value":"kh"}},{"from":{"field":"region","value":"296"},"to":{"field":"region","value":"ki"}},{"from":{"field":"region","value":"174"},"to":{"field":"region","value":"km"}},{"from":{"field":"region","value":"659"},"to":{"field":"region","value":"kn"}},{"from":{"field":"region","value":"408"},"to":{"field":"region","value":"kp"}},{"from":{"field":"region","value":"410"},"to":{"field":"region","value":"kr"}},{"from":{"field":"region","value":"414"},"to":{"field":"region","value":"kw"}},{"from":{"field":"region","value":"136"},"to":{"field":"region","value":"ky"}},{"from":{"field":"region","value":"398"},"to":{"field":"region","value":"kz"}},{"from":{"field":"region","value":"418"},"to":{"field":"region","value":"la"}},{"from":{"field":"region","value":"422"},"to":{"field":"region","value":"lb"}},{"from":{"field":"region","value":"662"},"to":{"field":"region","value":"lc"}},{"from":{"field":"region","value":"438"},"to":{"field":"region","value":"li"}},{"from":{"field":"region","value":"144"},"to":{"field":"region","value":"lk"}},{"from":{"field":"region","value":"430"},"to":{"field":"region","value":"lr"}},{"from":{"field":"region","value":"426"},"to":{"field":"region","value":"ls"}},{"from":{"field":"region","value":"440"},"to":{"field":"region","value":"lt"}},{"from":{"field":"region","value":"442"},"to":{"field":"region","value":"lu"}},{"from":{"field":"region","value":"428"},"to":{"field":"region","value":"lv"}},{"from":{"field":"region","value":"434"},"to":{"field":"region","value":"ly"}},{"from":{"field":"region","value":"504"},"to":{"field":"region","value":"ma"}},{"from":{"field":"region","value":"492"},"to":{"field":"region","value":"mc"}},{"from":{"field":"region","value":"498"},"to":{"field":"region","value":"md"}},{"from":{"field":"region","value":"499"},"to":{"field":"region","value":"me"}},{"from":{"field":"region","value":"663"},"to":{"field":"region","value":"mf"}},{"from":{"field":"region","value":"450"},"to":{"field":"region","value":"mg"}},{"from":{"field":"region","value":"584"},"to":{"field":"region","value":"mh"}},{"from":{"field":"region","value":"807"},"to":{"field":"region","value":"mk"}},{"from":{"field":"region","value":"466"},"to":{"field":"region","value":"ml"}},{"from":{"field":"region","value":"496"},"to":{"field":"region","value":"mn"}},{"from":{"field":"region","value":"446"},"to":{"field":"region","value":"mo"}},{"from":{"field":"region","value":"580"},"to":{"field":"region","value":"mp"}},{"from":{"field":"region","value":"474"},"to":{"field":"region","value":"mq"}},{"from":{"field":"region","value":"478"},"to":{"field":"region","value":"mr"}},{"from":{"field":"region","value":"500"},"to":{"field":"region","value":"ms"}},{"from":{"field":"region","value":"470"},"to":{"field":"region","value":"mt"}},{"from":{"field":"region","value":"480"},"to":{"field":"region","value":"mu"}},{"from":{"field":"region","value":"462"},"to":{"field":"region","value":"mv"}},{"from":{"field":"region","value":"454"},"to":{"field":"region","value":"mw"}},{"from":{"field":"region","value":"484"},"to":{"field":"region","value":"mx"}},{"from":{"field":"region","value":"458"},"to":{"field":"region","value":"my"}},{"from":{"field":"region","value":"508"},"to":{"field":"region","value":"mz"}},{"from":{"field":"region","value":"516"},"to":{"field":"region","value":"na"}},{"from":{"field":"region","value":"540"},"to":{"field":"region","value":"nc"}},{"from":{"field":"region","value":"562"},"to":{"field":"region","value":"ne"}},{"from":{"field":"region","value":"574"},"to":{"field":"region","value":"nf"}},{"from":{"field":"region","value":"566"},"to":{"field":"region","value":"ng"}},{"from":{"field":"region","value":"558"},"to":{"field":"region","value":"ni"}},{"from":{"field":"region","value":"528"},"to":{"field":"region","value":"nl"}},{"from":{"field":"region","value":"578"},"to":{"field":"region","value":"no"}},{"from":{"field":"region","value":"524"},"to":{"field":"region","value":"np"}},{"from":{"field":"region","value":"520"},"to":{"field":"region","value":"nr"}},{"from":{"field":"region","value":"570"},"to":{"field":"region","value":"nu"}},{"from":{"field":"region","value":"554"},"to":{"field":"region","value":"nz"}},{"from":{"field":"region","value":"512"},"to":{"field":"region","value":"om"}},{"from":{"field":"region","value":"591"},"to":{"field":"region","value":"pa"}},{"from":{"field":"region","value":"604"},"to":{"field":"region","value":"pe"}},{"from":{"field":"region","value":"258"},"to":{"field":"region","value":"pf"}},{"from":{"field":"region","value":"598"},"to":{"field":"region","value":"pg"}},{"from":{"field":"region","value":"608"},"to":{"field":"region","value":"ph"}},{"from":{"field":"region","value":"586"},"to":{"field":"region","value":"pk"}},{"from":{"field":"region","value":"616"},"to":{"field":"region","value":"pl"}},{"from":{"field":"region","value":"666"},"to":{"field":"region","value":"pm"}},{"from":{"field":"region","value":"612"},"to":{"field":"region","value":"pn"}},{"from":{"field":"region","value":"630"},"to":{"field":"region","value":"pr"}},{"from":{"field":"region","value":"275"},"to":{"field":"region","value":"ps"}},{"from":{"field":"region","value":"620"},"to":{"field":"region","value":"pt"}},{"from":{"field":"region","value":"585"},"to":{"field":"region","value":"pw"}},{"from":{"field":"region","value":"600"},"to":{"field":"region","value":"py"}},{"from":{"field":"region","value":"634"},"to":{"field":"region","value":"qa"}},{"from":{"field":"region","value":"959"},"to":{"field":"region","value":"qm"}},{"from":{"field":"region","value":"960"},"to":{"field":"region","value":"qn"}},{"from":{"field":"region","value":"962"},"to":{"field":"region","value":"qp"}},{"from":{"field":"region","value":"963"},"to":{"field":"region","value":"qq"}},{"from":{"field":"region","value":"964"},"to":{"field":"region","value":"qr"}},{"from":{"field":"region","value":"965"},"to":{"field":"region","value":"qs"}},{"from":{"field":"region","value":"966"},"to":{"field":"region","value":"qt"}},{"from":{"field":"region","value":"967"},"to":{"field":"region","value":"eu"}},{"from":{"field":"region","value":"968"},"to":{"field":"region","value":"qv"}},{"from":{"field":"region","value":"969"},"to":{"field":"region","value":"qw"}},{"from":{"field":"region","value":"970"},"to":{"field":"region","value":"qx"}},{"from":{"field":"region","value":"971"},"to":{"field":"region","value":"qy"}},{"from":{"field":"region","value":"972"},"to":{"field":"region","value":"qz"}},{"from":{"field":"region","value":"638"},"to":{"field":"region","value":"re"}},{"from":{"field":"region","value":"642"},"to":{"field":"region","value":"ro"}},{"from":{"field":"region","value":"688"},"to":{"field":"region","value":"rs"}},{"from":{"field":"region","value":"643"},"to":{"field":"region","value":"ru"}},{"from":{"field":"region","value":"646"},"to":{"field":"region","value":"rw"}},{"from":{"field":"region","value":"682"},"to":{"field":"region","value":"sa"}},{"from":{"field":"region","value":"090"},"to":{"field":"region","value":"sb"}},{"from":{"field":"region","value":"690"},"to":{"field":"region","value":"sc"}},{"from":{"field":"region","value":"729"},"to":{"field":"region","value":"sd"}},{"from":{"field":"region","value":"752"},"to":{"field":"region","value":"se"}},{"from":{"field":"region","value":"702"},"to":{"field":"region","value":"sg"}},{"from":{"field":"region","value":"654"},"to":{"field":"region","value":"sh"}},{"from":{"field":"region","value":"705"},"to":{"field":"region","value":"si"}},{"from":{"field":"region","value":"744"},"to":{"field":"region","value":"sj"}},{"from":{"field":"region","value":"703"},"to":{"field":"region","value":"sk"}},{"from":{"field":"region","value":"694"},"to":{"field":"region","value":"sl"}},{"from":{"field":"region","value":"674"},"to":{"field":"region","value":"sm"}},{"from":{"field":"region","value":"686"},"to":{"field":"region","value":"sn"}},{"from":{"field":"region","value":"706"},"to":{"field":"region","value":"so"}},{"from":{"field":"region","value":"740"},"to":{"field":"region","value":"sr"}},{"from":{"field":"region","value":"728"},"to":{"field":"region","value":"ss"}},{"from":{"field":"region","value":"678"},"to":{"field":"region","value":"st"}},{"from":{"field":"region","value":"222"},"to":{"field":"region","value":"sv"}},{"from":{"field":"region","value":"534"},"to":{"field":"region","value":"sx"}},{"from":{"field":"region","value":"760"},"to":{"field":"region","value":"sy"}},{"from":{"field":"region","value":"748"},"to":{"field":"region","value":"sz"}},{"from":{"field":"region","value":"796"},"to":{"field":"region","value":"tc"}},{"from":{"field":"region","value":"148"},"to":{"field":"region","value":"td"}},{"from":{"field":"region","value":"260"},"to":{"field":"region","value":"tf"}},{"from":{"field":"region","value":"768"},"to":{"field":"region","value":"tg"}},{"from":{"field":"region","value":"764"},"to":{"field":"region","value":"th"}},{"from":{"field":"region","value":"762"},"to":{"field":"region","value":"tj"}},{"from":{"field":"region","value":"772"},"to":{"field":"region","value":"tk"}},{"from":{"field":"region","value":"626"},"to":{"field":"region","value":"tl"}},{"from":{"field":"region","value":"795"},"to":{"field":"region","value":"tm"}},{"from":{"field":"region","value":"788"},"to":{"field":"region","value":"tn"}},{"from":{"field":"region","value":"776"},"to":{"field":"region","value":"to"}},{"from":{"field":"region","value":"792"},"to":{"field":"region","value":"tr"}},{"from":{"field":"region","value":"780"},"to":{"field":"region","value":"tt"}},{"from":{"field":"region","value":"798"},"to":{"field":"region","value":"tv"}},{"from":{"field":"region","value":"158"},"to":{"field":"region","value":"tw"}},{"from":{"field":"region","value":"834"},"to":{"field":"region","value":"tz"}},{"from":{"field":"region","value":"804"},"to":{"field":"region","value":"ua"}},{"from":{"field":"region","value":"800"},"to":{"field":"region","value":"ug"}},{"from":{"field":"region","value":"581"},"to":{"field":"region","value":"um"}},{"from":{"field":"region","value":"840"},"to":{"field":"region","value":"us"}},{"from":{"field":"region","value":"858"},"to":{"field":"region","value":"uy"}},{"from":{"field":"region","value":"860"},"to":{"field":"region","value":"uz"}},{"from":{"field":"region","value":"336"},"to":{"field":"region","value":"va"}},{"from":{"field":"region","value":"670"},"to":{"field":"region","value":"vc"}},{"from":{"field":"region","value":"862"},"to":{"field":"region","value":"ve"}},{"from":{"field":"region","value":"092"},"to":{"field":"region","value":"vg"}},{"from":{"field":"region","value":"850"},"to":{"field":"region","value":"vi"}},{"from":{"field":"region","value":"704"},"to":{"field":"region","value":"vn"}},{"from":{"field":"region","value":"548"},"to":{"field":"region","value":"vu"}},{"from":{"field":"region","value":"876"},"to":{"field":"region","value":"wf"}},{"from":{"field":"region","value":"882"},"to":{"field":"region","value":"ws"}},{"from":{"field":"region","value":"973"},"to":{"field":"region","value":"xa"}},{"from":{"field":"region","value":"974"},"to":{"field":"region","value":"xb"}},{"from":{"field":"region","value":"975"},"to":{"field":"region","value":"xc"}},{"from":{"field":"region","value":"976"},"to":{"field":"region","value":"xd"}},{"from":{"field":"region","value":"977"},"to":{"field":"region","value":"xe"}},{"from":{"field":"region","value":"978"},"to":{"field":"region","value":"xf"}},{"from":{"field":"region","value":"979"},"to":{"field":"region","value":"xg"}},{"from":{"field":"region","value":"980"},"to":{"field":"region","value":"xh"}},{"from":{"field":"region","value":"981"},"to":{"field":"region","value":"xi"}},{"from":{"field":"region","value":"982"},"to":{"field":"region","value":"xj"}},{"from":{"field":"region","value":"983"},"to":{"field":"region","value":"xk"}},{"from":{"field":"region","value":"984"},"to":{"field":"region","value":"xl"}},{"from":{"field":"region","value":"985"},"to":{"field":"region","value":"xm"}},{"from":{"field":"region","value":"986"},"to":{"field":"region","value":"xn"}},{"from":{"field":"region","value":"987"},"to":{"field":"region","value":"xo"}},{"from":{"field":"region","value":"988"},"to":{"field":"region","value":"xp"}},{"from":{"field":"region","value":"989"},"to":{"field":"region","value":"xq"}},{"from":{"field":"region","value":"990"},"to":{"field":"region","value":"xr"}},{"from":{"field":"region","value":"991"},"to":{"field":"region","value":"xs"}},{"from":{"field":"region","value":"992"},"to":{"field":"region","value":"xt"}},{"from":{"field":"region","value":"993"},"to":{"field":"region","value":"xu"}},{"from":{"field":"region","value":"994"},"to":{"field":"region","value":"xv"}},{"from":{"field":"region","value":"995"},"to":{"field":"region","value":"xw"}},{"from":{"field":"region","value":"996"},"to":{"field":"region","value":"xx"}},{"from":{"field":"region","value":"997"},"to":{"field":"region","value":"xy"}},{"from":{"field":"region","value":"998"},"to":{"field":"region","value":"xz"}},{"from":{"field":"region","value":"720"},"to":{"field":"region","value":"ye"}},{"from":{"field":"region","value":"887"},"to":{"field":"region","value":"ye"}},{"from":{"field":"region","value":"175"},"to":{"field":"region","value":"yt"}},{"from":{"field":"region","value":"710"},"to":{"field":"region","value":"za"}},{"from":{"field":"region","value":"894"},"to":{"field":"region","value":"zm"}},{"from":{"field":"region","value":"716"},"to":{"field":"region","value":"zw"}},{"from":{"field":"region","value":"999"},"to":{"field":"region","value":"zz"}},{"from":{"field":"variants","value":"aaland"},"to":{"field":"region","value":"ax"}},{"from":{"field":"variants","value":"polytoni"},"to":{"field":"variants","value":"polyton"}},{"from":{"field":"variants","value":"heploc"},"to":{"field":"variants","value":"alalc97"}},{"from":{"field":"variants","value":"arevela"},"to":{"field":"language","value":"hy"}},{"from":{"field":"variants","value":"arevmda"},"to":{"field":"language","value":"hyw"}}]\')},9460:function(e){"use strict";e.exports=JSON.parse(\'{"region":{"172":["ru","am","az","by","ge","kg","kz","md","tj","tm","ua","uz"],"200":["cz","sk"],"530":["cw","sx","bq"],"532":["cw","sx","bq"],"536":["sa","iq"],"582":["fm","mh","mp","pw"],"810":["ru","am","az","by","ee","ge","kz","kg","lv","lt","md","tj","tm","ua","uz"],"830":["je","gg"],"890":["rs","me","si","hr","mk","ba"],"891":["rs","me"],"an":["cw","sx","bq"],"cs":["rs","me"],"fq":["aq","tf"],"nt":["sa","iq"],"pc":["fm","mh","mp","pw"],"su":["ru","am","az","by","ee","ge","kz","kg","lv","lt","md","tj","tm","ua","uz"],"yu":["rs","me"],"062":["034","143"],"ant":["cw","sx","bq"],"scg":["rs","me"],"ntz":["sa","iq"],"sun":["ru","am","az","by","ee","ge","kz","kg","lv","lt","md","tj","tm","ua","uz"],"yug":["rs","me"]}}\')},7778:function(e){"use strict";e.exports=JSON.parse(\'[{"from":"in","to":"id"},{"from":"iw","to":"he"},{"from":"ji","to":"yi"},{"from":"jw","to":"jv"},{"from":"mo","to":"ro"},{"from":"scc","to":"sr"},{"from":"scr","to":"hr"},{"from":"aam","to":"aas"},{"from":"adp","to":"dz"},{"from":"aue","to":"ktz"},{"from":"ayx","to":"nun"},{"from":"bgm","to":"bcg"},{"from":"bjd","to":"drl"},{"from":"ccq","to":"rki"},{"from":"cjr","to":"mom"},{"from":"cka","to":"cmr"},{"from":"cmk","to":"xch"},{"from":"coy","to":"pij"},{"from":"cqu","to":"quh"},{"from":"drh","to":"mn"},{"from":"drw","to":"fa-af"},{"from":"gav","to":"dev"},{"from":"gfx","to":"vaj"},{"from":"ggn","to":"gvr"},{"from":"gti","to":"nyc"},{"from":"guv","to":"duz"},{"from":"hrr","to":"jal"},{"from":"ibi","to":"opa"},{"from":"ilw","to":"gal"},{"from":"jeg","to":"oyb"},{"from":"kgc","to":"tdf"},{"from":"kgh","to":"kml"},{"from":"koj","to":"kwv"},{"from":"krm","to":"bmf"},{"from":"ktr","to":"dtp"},{"from":"kvs","to":"gdj"},{"from":"kwq","to":"yam"},{"from":"kxe","to":"tvd"},{"from":"kzj","to":"dtp"},{"from":"kzt","to":"dtp"},{"from":"lii","to":"raq"},{"from":"lmm","to":"rmx"},{"from":"meg","to":"cir"},{"from":"mst","to":"mry"},{"from":"mwj","to":"vaj"},{"from":"myt","to":"mry"},{"from":"nad","to":"xny"},{"from":"ncp","to":"kdz"},{"from":"nnx","to":"ngv"},{"from":"nts","to":"pij"},{"from":"oun","to":"vaj"},{"from":"pcr","to":"adx"},{"from":"pmc","to":"huw"},{"from":"pmu","to":"phr"},{"from":"ppa","to":"bfy"},{"from":"ppr","to":"lcq"},{"from":"pry","to":"prt"},{"from":"puz","to":"pub"},{"from":"sca","to":"hle"},{"from":"skk","to":"oyb"},{"from":"tdu","to":"dtp"},{"from":"thc","to":"tpo"},{"from":"thx","to":"oyb"},{"from":"tie","to":"ras"},{"from":"tkk","to":"twm"},{"from":"tlw","to":"weo"},{"from":"tmp","to":"tyj"},{"from":"tne","to":"kak"},{"from":"tnf","to":"fa-af"},{"from":"tsf","to":"taj"},{"from":"uok","to":"ema"},{"from":"xba","to":"cax"},{"from":"xia","to":"acn"},{"from":"xkh","to":"waw"},{"from":"xsj","to":"suj"},{"from":"ybd","to":"rki"},{"from":"yma","to":"lrr"},{"from":"ymt","to":"mtm"},{"from":"yos","to":"zom"},{"from":"yuu","to":"yug"},{"from":"asd","to":"snz"},{"from":"dit","to":"dif"},{"from":"llo","to":"ngt"},{"from":"myd","to":"aog"},{"from":"nns","to":"nbr"},{"from":"sgn-br","to":"bzs"},{"from":"sgn-co","to":"csn"},{"from":"sgn-de","to":"gsg"},{"from":"sgn-dk","to":"dsl"},{"from":"sgn-fr","to":"fsl"},{"from":"sgn-gb","to":"bfi"},{"from":"sgn-gr","to":"gss"},{"from":"sgn-ie","to":"isg"},{"from":"sgn-it","to":"ise"},{"from":"sgn-jp","to":"jsl"},{"from":"sgn-mx","to":"mfs"},{"from":"sgn-ni","to":"ncs"},{"from":"sgn-nl","to":"dse"},{"from":"sgn-no","to":"nsi"},{"from":"sgn-pt","to":"psr"},{"from":"sgn-se","to":"swl"},{"from":"sgn-us","to":"ase"},{"from":"sgn-za","to":"sfs"},{"from":"no-bokmal","to":"nb"},{"from":"no-nynorsk","to":"nn"},{"from":"aa-saaho","to":"ssy"},{"from":"sh","to":"sr-latn"},{"from":"cnr","to":"sr-me"},{"from":"no","to":"nb"},{"from":"tl","to":"fil"},{"from":"az-az","to":"az-latn-az"},{"from":"bs-ba","to":"bs-latn-ba"},{"from":"ha-latn-gh","to":"ha-gh"},{"from":"ha-latn-ne","to":"ha-ne"},{"from":"ha-latn-ng","to":"ha-ng"},{"from":"kk-cyrl-kz","to":"kk-kz"},{"from":"ky-cyrl-kg","to":"ky-kg"},{"from":"ks-arab-in","to":"ks-in"},{"from":"mn-cyrl-mn","to":"mn-mn"},{"from":"ms-latn-bn","to":"ms-bn"},{"from":"ms-latn-my","to":"ms-my"},{"from":"ms-latn-sg","to":"ms-sg"},{"from":"pa-in","to":"pa-guru-in"},{"from":"pa-pk","to":"pa-arab-pk"},{"from":"shi-ma","to":"shi-tfng-ma"},{"from":"sr-ba","to":"sr-cyrl-ba"},{"from":"sr-me","to":"sr-latn-me"},{"from":"sr-rs","to":"sr-cyrl-rs"},{"from":"sr-xk","to":"sr-cyrl-xk"},{"from":"tzm-latn-ma","to":"tzm-ma"},{"from":"ug-arab-cn","to":"ug-cn"},{"from":"uz-af","to":"uz-arab-af"},{"from":"uz-uz","to":"uz-latn-uz"},{"from":"vai-lr","to":"vai-vaii-lr"},{"from":"yue-cn","to":"yue-hans-cn"},{"from":"yue-hk","to":"yue-hant-hk"},{"from":"zh-cn","to":"zh-hans-cn"},{"from":"zh-hk","to":"zh-hant-hk"},{"from":"zh-mo","to":"zh-hant-mo"},{"from":"zh-sg","to":"zh-hans-sg"},{"from":"zh-tw","to":"zh-hant-tw"},{"from":"aju","to":"jrb"},{"from":"als","to":"sq"},{"from":"arb","to":"ar"},{"from":"ayr","to":"ay"},{"from":"azj","to":"az"},{"from":"bcc","to":"bal"},{"from":"bcl","to":"bik"},{"from":"bxk","to":"luy"},{"from":"bxr","to":"bua"},{"from":"cld","to":"syr"},{"from":"cmn","to":"zh"},{"from":"cwd","to":"cr"},{"from":"dgo","to":"doi"},{"from":"dhd","to":"mwr"},{"from":"dik","to":"din"},{"from":"diq","to":"zza"},{"from":"lbk","to":"bnc"},{"from":"ekk","to":"et"},{"from":"emk","to":"man"},{"from":"esk","to":"ik"},{"from":"fat","to":"ak"},{"from":"fuc","to":"ff"},{"from":"gaz","to":"om"},{"from":"gbo","to":"grb"},{"from":"gno","to":"gon"},{"from":"gug","to":"gn"},{"from":"gya","to":"gba"},{"from":"hdn","to":"hai"},{"from":"hea","to":"hmn"},{"from":"ike","to":"iu"},{"from":"kmr","to":"ku"},{"from":"knc","to":"kr"},{"from":"kng","to":"kg"},{"from":"knn","to":"kok"},{"from":"kpv","to":"kv"},{"from":"lvs","to":"lv"},{"from":"mhr","to":"chm"},{"from":"mup","to":"raj"},{"from":"khk","to":"mn"},{"from":"npi","to":"ne"},{"from":"ojg","to":"oj"},{"from":"ory","to":"or"},{"from":"pbu","to":"ps"},{"from":"pes","to":"fa"},{"from":"plt","to":"mg"},{"from":"pnb","to":"lah"},{"from":"quz","to":"qu"},{"from":"rmy","to":"rom"},{"from":"spy","to":"kln"},{"from":"src","to":"sc"},{"from":"swh","to":"sw"},{"from":"ttq","to":"tmh"},{"from":"tw","to":"ak"},{"from":"umu","to":"del"},{"from":"uzn","to":"uz"},{"from":"xpe","to":"kpe"},{"from":"xsl","to":"den"},{"from":"ydd","to":"yi"},{"from":"zai","to":"zap"},{"from":"zsm","to":"ms"},{"from":"zyb","to":"za"},{"from":"him","to":"srx"},{"from":"mnk","to":"man"},{"from":"bh","to":"bho"},{"from":"prs","to":"fa-af"},{"from":"swc","to":"sw-cd"},{"from":"aar","to":"aa"},{"from":"abk","to":"ab"},{"from":"ave","to":"ae"},{"from":"afr","to":"af"},{"from":"aka","to":"ak"},{"from":"amh","to":"am"},{"from":"arg","to":"an"},{"from":"ara","to":"ar"},{"from":"asm","to":"as"},{"from":"ava","to":"av"},{"from":"aym","to":"ay"},{"from":"aze","to":"az"},{"from":"bak","to":"ba"},{"from":"bel","to":"be"},{"from":"bul","to":"bg"},{"from":"bih","to":"bho"},{"from":"bis","to":"bi"},{"from":"bam","to":"bm"},{"from":"ben","to":"bn"},{"from":"bod","to":"bo"},{"from":"bre","to":"br"},{"from":"bos","to":"bs"},{"from":"cat","to":"ca"},{"from":"che","to":"ce"},{"from":"cha","to":"ch"},{"from":"cos","to":"co"},{"from":"cre","to":"cr"},{"from":"ces","to":"cs"},{"from":"chu","to":"cu"},{"from":"chv","to":"cv"},{"from":"cym","to":"cy"},{"from":"dan","to":"da"},{"from":"deu","to":"de"},{"from":"div","to":"dv"},{"from":"dzo","to":"dz"},{"from":"ewe","to":"ee"},{"from":"ell","to":"el"},{"from":"eng","to":"en"},{"from":"epo","to":"eo"},{"from":"spa","to":"es"},{"from":"est","to":"et"},{"from":"eus","to":"eu"},{"from":"fas","to":"fa"},{"from":"ful","to":"ff"},{"from":"fin","to":"fi"},{"from":"fij","to":"fj"},{"from":"fao","to":"fo"},{"from":"fra","to":"fr"},{"from":"fry","to":"fy"},{"from":"gle","to":"ga"},{"from":"gla","to":"gd"},{"from":"glg","to":"gl"},{"from":"grn","to":"gn"},{"from":"guj","to":"gu"},{"from":"glv","to":"gv"},{"from":"hau","to":"ha"},{"from":"heb","to":"he"},{"from":"hin","to":"hi"},{"from":"hmo","to":"ho"},{"from":"hrv","to":"hr"},{"from":"hat","to":"ht"},{"from":"hun","to":"hu"},{"from":"hye","to":"hy"},{"from":"her","to":"hz"},{"from":"ina","to":"ia"},{"from":"ind","to":"id"},{"from":"ile","to":"ie"},{"from":"ibo","to":"ig"},{"from":"iii","to":"ii"},{"from":"ipk","to":"ik"},{"from":"ido","to":"io"},{"from":"isl","to":"is"},{"from":"ita","to":"it"},{"from":"iku","to":"iu"},{"from":"jpn","to":"ja"},{"from":"jav","to":"jv"},{"from":"kat","to":"ka"},{"from":"kon","to":"kg"},{"from":"kik","to":"ki"},{"from":"kua","to":"kj"},{"from":"kaz","to":"kk"},{"from":"kal","to":"kl"},{"from":"khm","to":"km"},{"from":"kan","to":"kn"},{"from":"kor","to":"ko"},{"from":"kau","to":"kr"},{"from":"kas","to":"ks"},{"from":"kur","to":"ku"},{"from":"kom","to":"kv"},{"from":"cor","to":"kw"},{"from":"kir","to":"ky"},{"from":"lat","to":"la"},{"from":"ltz","to":"lb"},{"from":"lug","to":"lg"},{"from":"lim","to":"li"},{"from":"lin","to":"ln"},{"from":"lao","to":"lo"},{"from":"lit","to":"lt"},{"from":"lub","to":"lu"},{"from":"lav","to":"lv"},{"from":"mlg","to":"mg"},{"from":"mah","to":"mh"},{"from":"mri","to":"mi"},{"from":"mkd","to":"mk"},{"from":"mal","to":"ml"},{"from":"mon","to":"mn"},{"from":"mol","to":"ro"},{"from":"mar","to":"mr"},{"from":"msa","to":"ms"},{"from":"mlt","to":"mt"},{"from":"mya","to":"my"},{"from":"nau","to":"na"},{"from":"nob","to":"nb"},{"from":"nde","to":"nd"},{"from":"nep","to":"ne"},{"from":"ndo","to":"ng"},{"from":"nld","to":"nl"},{"from":"nno","to":"nn"},{"from":"nor","to":"nb"},{"from":"nbl","to":"nr"},{"from":"nav","to":"nv"},{"from":"nya","to":"ny"},{"from":"oci","to":"oc"},{"from":"oji","to":"oj"},{"from":"orm","to":"om"},{"from":"ori","to":"or"},{"from":"oss","to":"os"},{"from":"pan","to":"pa"},{"from":"pli","to":"pi"},{"from":"pol","to":"pl"},{"from":"pus","to":"ps"},{"from":"por","to":"pt"},{"from":"que","to":"qu"},{"from":"roh","to":"rm"},{"from":"run","to":"rn"},{"from":"ron","to":"ro"},{"from":"rus","to":"ru"},{"from":"kin","to":"rw"},{"from":"san","to":"sa"},{"from":"srd","to":"sc"},{"from":"snd","to":"sd"},{"from":"sme","to":"se"},{"from":"sag","to":"sg"},{"from":"hbs","to":"sr-latn"},{"from":"sin","to":"si"},{"from":"slk","to":"sk"},{"from":"slv","to":"sl"},{"from":"smo","to":"sm"},{"from":"sna","to":"sn"},{"from":"som","to":"so"},{"from":"sqi","to":"sq"},{"from":"srp","to":"sr"},{"from":"ssw","to":"ss"},{"from":"sot","to":"st"},{"from":"sun","to":"su"},{"from":"swe","to":"sv"},{"from":"swa","to":"sw"},{"from":"tam","to":"ta"},{"from":"tel","to":"te"},{"from":"tgk","to":"tg"},{"from":"tha","to":"th"},{"from":"tir","to":"ti"},{"from":"tuk","to":"tk"},{"from":"tgl","to":"fil"},{"from":"tsn","to":"tn"},{"from":"ton","to":"to"},{"from":"tur","to":"tr"},{"from":"tso","to":"ts"},{"from":"tat","to":"tt"},{"from":"twi","to":"ak"},{"from":"tah","to":"ty"},{"from":"uig","to":"ug"},{"from":"ukr","to":"uk"},{"from":"urd","to":"ur"},{"from":"uzb","to":"uz"},{"from":"ven","to":"ve"},{"from":"vie","to":"vi"},{"from":"vol","to":"vo"},{"from":"wln","to":"wa"},{"from":"wol","to":"wo"},{"from":"xho","to":"xh"},{"from":"yid","to":"yi"},{"from":"yor","to":"yo"},{"from":"zha","to":"za"},{"from":"zho","to":"zh"},{"from":"zul","to":"zu"},{"from":"alb","to":"sq"},{"from":"arm","to":"hy"},{"from":"baq","to":"eu"},{"from":"bur","to":"my"},{"from":"chi","to":"zh"},{"from":"cze","to":"cs"},{"from":"dut","to":"nl"},{"from":"fre","to":"fr"},{"from":"geo","to":"ka"},{"from":"ger","to":"de"},{"from":"gre","to":"el"},{"from":"ice","to":"is"},{"from":"mac","to":"mk"},{"from":"mao","to":"mi"},{"from":"may","to":"ms"},{"from":"per","to":"fa"},{"from":"rum","to":"ro"},{"from":"slo","to":"sk"},{"from":"tib","to":"bo"},{"from":"wel","to":"cy"}]\')},8589:function(e){"use strict";e.exports=JSON.parse(\'{"en-gb-oed":"en-GB-oxendict","i-ami":"ami","i-bnn":"bnn","i-default":null,"i-enochian":null,"i-hak":"hak","i-klingon":"tlh","i-lux":"lb","i-mingo":null,"i-navajo":"nv","i-pwn":"pwn","i-tao":"tao","i-tay":"tay","i-tsu":"tsu","sgn-be-fr":"sfb","sgn-be-nl":"vgt","sgn-ch-de":"sgg","art-lojban":"jbo","cel-gaulish":null,"no-bok":"nb","no-nyn":"nn","zh-guoyu":"cmn","zh-hakka":"hak","zh-min":null,"zh-min-nan":"nan","zh-xiang":"hsn"}\')},858:function(e){"use strict";e.exports=JSON.parse(\'["art-lojban","cel-gaulish","no-bok","no-nyn","zh-guoyu","zh-hakka","zh-min","zh-min-nan","zh-xiang"]\')}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,n),a.exports}n.amdO={},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var r={};return function(){"use strict";n.d(r,{default:function(){return c}}),n(8416);var e,t=n(1715),i=n(8080),a=n(1737),o=n(7688),s=function(){var e,t="application/dash+xml";function n(n,r,i){if(!n||!/^VIDEO$/i.test(n.nodeName))return null;if(n._dashjs_player)return n._dashjs_player;var a,s=n.id||n.name||"video element";if(!(r=r||[].slice.call(n.querySelectorAll("source")).filter((function(e){return e.type==t}))[0])&&n.src)(r=document.createElement("source")).src=n.src;else if(!r&&!n.src)return null;return i=i||{},(a=(0,o.Z)(i).create()).initialize(n,r.src,n.autoplay),e||(e=a.getDebug().getLogger()),e.debug("Converted "+s+" to dash.js player and added content: "+r.src),n._dashjs_player=a,a}function r(e){return/^VIDEO$/i.test(e.nodeName)?e:r(e.parentNode)}return{create:n,createAll:function(e,i){var a=[];e=e||"[data-dashjs-player]";for(var o=(i=i||document).querySelectorAll(e),s=0;s<o.length;s++){var u=n(o[s],null);a.push(u)}for(var l=i.querySelectorAll(\'source[type="\'+t+\'"]\'),c=0;c<l.length;c++){var f=n(r(l[c]),null);a.push(f)}return a}}}();!("undefined"!=typeof window&&window&&window.dashjs&&window.dashjs.skipAutoCreate)&&"undefined"!=typeof window&&window&&window.addEventListener&&("complete"===window.document.readyState?window.dashjs?s.createAll():e=window.setInterval((function(){window.dashjs&&(window.clearInterval(e),s.createAll())}),500):window.addEventListener("load",(function e(){window.removeEventListener("load",e),s.createAll()})));var u=s,l=n(6398);dashjs.Protection=a.default,dashjs.MetricsReporting=i.default,dashjs.MediaPlayerFactory=u,dashjs.Debug=l.Z,dashjs.supportsMediaSource=t.B;var c=dashjs}(),r.default}()}));\n//# sourceMappingURL=dash.all.min.js.map\n\n//# sourceURL=webpack://web/./node_modules/dashjs/dist/dash.all.min.js?')},"./node_modules/dayjs/dayjs.min.js":function(module){eval('!function(t,e){ true?module.exports=e():0}(this,(function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\\d{4})[-/]?(\\d{1,2})?[-/]?(\\d{0,2})[Tt\\s]*(\\d{1,2})?:?(\\d{1,2})?:?(\\d{1,2})?[.:]?(\\d+)?$/,y=/\\[([^\\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));\n\n//# sourceURL=webpack://web/./node_modules/dayjs/dayjs.min.js?')},"./node_modules/global/document.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval("var topLevel = typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g :\n typeof window !== 'undefined' ? window : {}\nvar minDoc = __webpack_require__(/*! min-document */ \"?34aa\");\n\nvar doccy;\n\nif (typeof document !== 'undefined') {\n doccy = document;\n} else {\n doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];\n\n if (!doccy) {\n doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;\n }\n}\n\nmodule.exports = doccy;\n\n\n//# sourceURL=webpack://web/./node_modules/global/document.js?")},"./node_modules/global/window.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var win;\n\nif (typeof window !== "undefined") {\n win = window;\n} else if (typeof __webpack_require__.g !== "undefined") {\n win = __webpack_require__.g;\n} else if (typeof self !== "undefined"){\n win = self;\n} else {\n win = {};\n}\n\nmodule.exports = win;\n\n\n//# sourceURL=webpack://web/./node_modules/global/window.js?')},"./node_modules/is-function/index.js":module=>{eval("module.exports = isFunction\n\nvar toString = Object.prototype.toString\n\nfunction isFunction (fn) {\n if (!fn) {\n return false\n }\n var string = toString.call(fn)\n return string === '[object Function]' ||\n (typeof fn === 'function' && string !== '[object RegExp]') ||\n (typeof window !== 'undefined' &&\n // IE8 and below\n (fn === window.setTimeout ||\n fn === window.alert ||\n fn === window.confirm ||\n fn === window.prompt))\n};\n\n\n//# sourceURL=webpack://web/./node_modules/is-function/index.js?")},"./node_modules/jquery-ui/ui/version.js":(module,exports,__webpack_require__)=>{eval('var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;( function( factory ) {\n\t"use strict";\n\n\tif ( true ) {\n\n\t\t// AMD. Register as an anonymous module.\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js") ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === \'function\' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else {}\n} )( function( $ ) {\n"use strict";\n\n$.ui = $.ui || {};\n\nreturn $.ui.version = "1.13.2";\n\n} );\n\n\n//# sourceURL=webpack://web/./node_modules/jquery-ui/ui/version.js?')},"./node_modules/jquery-ui/ui/widget.js":(module,exports,__webpack_require__)=>{eval('var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n * jQuery UI Widget 1.13.2\n * http://jqueryui.com\n *\n * Copyright jQuery Foundation and other contributors\n * Released under the MIT license.\n * http://jquery.org/license\n */\n\n//>>label: Widget\n//>>group: Core\n//>>description: Provides a factory for creating stateful widgets with a common API.\n//>>docs: http://api.jqueryui.com/jQuery.widget/\n//>>demos: http://jqueryui.com/widget/\n\n( function( factory ) {\n\t"use strict";\n\n\tif ( true ) {\n\n\t\t// AMD. Register as an anonymous module.\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [ __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"), __webpack_require__(/*! ./version */ "./node_modules/jquery-ui/ui/version.js") ], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === \'function\' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else {}\n} )( function( $ ) {\n"use strict";\n\nvar widgetUuid = 0;\nvar widgetHasOwnProperty = Array.prototype.hasOwnProperty;\nvar widgetSlice = Array.prototype.slice;\n\n$.cleanData = ( function( orig ) {\n\treturn function( elems ) {\n\t\tvar events, elem, i;\n\t\tfor ( i = 0; ( elem = elems[ i ] ) != null; i++ ) {\n\n\t\t\t// Only trigger remove when necessary to save time\n\t\t\tevents = $._data( elem, "events" );\n\t\t\tif ( events && events.remove ) {\n\t\t\t\t$( elem ).triggerHandler( "remove" );\n\t\t\t}\n\t\t}\n\t\torig( elems );\n\t};\n} )( $.cleanData );\n\n$.widget = function( name, base, prototype ) {\n\tvar existingConstructor, constructor, basePrototype;\n\n\t// ProxiedPrototype allows the provided prototype to remain unmodified\n\t// so that it can be used as a mixin for multiple widgets (#8876)\n\tvar proxiedPrototype = {};\n\n\tvar namespace = name.split( "." )[ 0 ];\n\tname = name.split( "." )[ 1 ];\n\tvar fullName = namespace + "-" + name;\n\n\tif ( !prototype ) {\n\t\tprototype = base;\n\t\tbase = $.Widget;\n\t}\n\n\tif ( Array.isArray( prototype ) ) {\n\t\tprototype = $.extend.apply( null, [ {} ].concat( prototype ) );\n\t}\n\n\t// Create selector for plugin\n\t$.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) {\n\t\treturn !!$.data( elem, fullName );\n\t};\n\n\t$[ namespace ] = $[ namespace ] || {};\n\texistingConstructor = $[ namespace ][ name ];\n\tconstructor = $[ namespace ][ name ] = function( options, element ) {\n\n\t\t// Allow instantiation without "new" keyword\n\t\tif ( !this || !this._createWidget ) {\n\t\t\treturn new constructor( options, element );\n\t\t}\n\n\t\t// Allow instantiation without initializing for simple inheritance\n\t\t// must use "new" keyword (the code above always passes args)\n\t\tif ( arguments.length ) {\n\t\t\tthis._createWidget( options, element );\n\t\t}\n\t};\n\n\t// Extend with the existing constructor to carry over any static properties\n\t$.extend( constructor, existingConstructor, {\n\t\tversion: prototype.version,\n\n\t\t// Copy the object used to create the prototype in case we need to\n\t\t// redefine the widget later\n\t\t_proto: $.extend( {}, prototype ),\n\n\t\t// Track widgets that inherit from this widget in case this widget is\n\t\t// redefined after a widget inherits from it\n\t\t_childConstructors: []\n\t} );\n\n\tbasePrototype = new base();\n\n\t// We need to make the options hash a property directly on the new instance\n\t// otherwise we\'ll modify the options hash on the prototype that we\'re\n\t// inheriting from\n\tbasePrototype.options = $.widget.extend( {}, basePrototype.options );\n\t$.each( prototype, function( prop, value ) {\n\t\tif ( typeof value !== "function" ) {\n\t\t\tproxiedPrototype[ prop ] = value;\n\t\t\treturn;\n\t\t}\n\t\tproxiedPrototype[ prop ] = ( function() {\n\t\t\tfunction _super() {\n\t\t\t\treturn base.prototype[ prop ].apply( this, arguments );\n\t\t\t}\n\n\t\t\tfunction _superApply( args ) {\n\t\t\t\treturn base.prototype[ prop ].apply( this, args );\n\t\t\t}\n\n\t\t\treturn function() {\n\t\t\t\tvar __super = this._super;\n\t\t\t\tvar __superApply = this._superApply;\n\t\t\t\tvar returnValue;\n\n\t\t\t\tthis._super = _super;\n\t\t\t\tthis._superApply = _superApply;\n\n\t\t\t\treturnValue = value.apply( this, arguments );\n\n\t\t\t\tthis._super = __super;\n\t\t\t\tthis._superApply = __superApply;\n\n\t\t\t\treturn returnValue;\n\t\t\t};\n\t\t} )();\n\t} );\n\tconstructor.prototype = $.widget.extend( basePrototype, {\n\n\t\t// TODO: remove support for widgetEventPrefix\n\t\t// always use the name + a colon as the prefix, e.g., draggable:start\n\t\t// don\'t prefix for widgets that aren\'t DOM-based\n\t\twidgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name\n\t}, proxiedPrototype, {\n\t\tconstructor: constructor,\n\t\tnamespace: namespace,\n\t\twidgetName: name,\n\t\twidgetFullName: fullName\n\t} );\n\n\t// If this widget is being redefined then we need to find all widgets that\n\t// are inheriting from it and redefine all of them so that they inherit from\n\t// the new version of this widget. We\'re essentially trying to replace one\n\t// level in the prototype chain.\n\tif ( existingConstructor ) {\n\t\t$.each( existingConstructor._childConstructors, function( i, child ) {\n\t\t\tvar childPrototype = child.prototype;\n\n\t\t\t// Redefine the child widget using the same prototype that was\n\t\t\t// originally used, but inherit from the new version of the base\n\t\t\t$.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor,\n\t\t\t\tchild._proto );\n\t\t} );\n\n\t\t// Remove the list of existing child constructors from the old constructor\n\t\t// so the old child constructors can be garbage collected\n\t\tdelete existingConstructor._childConstructors;\n\t} else {\n\t\tbase._childConstructors.push( constructor );\n\t}\n\n\t$.widget.bridge( name, constructor );\n\n\treturn constructor;\n};\n\n$.widget.extend = function( target ) {\n\tvar input = widgetSlice.call( arguments, 1 );\n\tvar inputIndex = 0;\n\tvar inputLength = input.length;\n\tvar key;\n\tvar value;\n\n\tfor ( ; inputIndex < inputLength; inputIndex++ ) {\n\t\tfor ( key in input[ inputIndex ] ) {\n\t\t\tvalue = input[ inputIndex ][ key ];\n\t\t\tif ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) {\n\n\t\t\t\t// Clone objects\n\t\t\t\tif ( $.isPlainObject( value ) ) {\n\t\t\t\t\ttarget[ key ] = $.isPlainObject( target[ key ] ) ?\n\t\t\t\t\t\t$.widget.extend( {}, target[ key ], value ) :\n\n\t\t\t\t\t\t// Don\'t extend strings, arrays, etc. with objects\n\t\t\t\t\t\t$.widget.extend( {}, value );\n\n\t\t\t\t// Copy everything else by reference\n\t\t\t\t} else {\n\t\t\t\t\ttarget[ key ] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn target;\n};\n\n$.widget.bridge = function( name, object ) {\n\tvar fullName = object.prototype.widgetFullName || name;\n\t$.fn[ name ] = function( options ) {\n\t\tvar isMethodCall = typeof options === "string";\n\t\tvar args = widgetSlice.call( arguments, 1 );\n\t\tvar returnValue = this;\n\n\t\tif ( isMethodCall ) {\n\n\t\t\t// If this is an empty collection, we need to have the instance method\n\t\t\t// return undefined instead of the jQuery instance\n\t\t\tif ( !this.length && options === "instance" ) {\n\t\t\t\treturnValue = undefined;\n\t\t\t} else {\n\t\t\t\tthis.each( function() {\n\t\t\t\t\tvar methodValue;\n\t\t\t\t\tvar instance = $.data( this, fullName );\n\n\t\t\t\t\tif ( options === "instance" ) {\n\t\t\t\t\t\treturnValue = instance;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( !instance ) {\n\t\t\t\t\t\treturn $.error( "cannot call methods on " + name +\n\t\t\t\t\t\t\t" prior to initialization; " +\n\t\t\t\t\t\t\t"attempted to call method \'" + options + "\'" );\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( typeof instance[ options ] !== "function" ||\n\t\t\t\t\t\toptions.charAt( 0 ) === "_" ) {\n\t\t\t\t\t\treturn $.error( "no such method \'" + options + "\' for " + name +\n\t\t\t\t\t\t\t" widget instance" );\n\t\t\t\t\t}\n\n\t\t\t\t\tmethodValue = instance[ options ].apply( instance, args );\n\n\t\t\t\t\tif ( methodValue !== instance && methodValue !== undefined ) {\n\t\t\t\t\t\treturnValue = methodValue && methodValue.jquery ?\n\t\t\t\t\t\t\treturnValue.pushStack( methodValue.get() ) :\n\t\t\t\t\t\t\tmethodValue;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\t\t} else {\n\n\t\t\t// Allow multiple hashes to be passed on init\n\t\t\tif ( args.length ) {\n\t\t\t\toptions = $.widget.extend.apply( null, [ options ].concat( args ) );\n\t\t\t}\n\n\t\t\tthis.each( function() {\n\t\t\t\tvar instance = $.data( this, fullName );\n\t\t\t\tif ( instance ) {\n\t\t\t\t\tinstance.option( options || {} );\n\t\t\t\t\tif ( instance._init ) {\n\t\t\t\t\t\tinstance._init();\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$.data( this, fullName, new object( options, this ) );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\treturn returnValue;\n\t};\n};\n\n$.Widget = function( /* options, element */ ) {};\n$.Widget._childConstructors = [];\n\n$.Widget.prototype = {\n\twidgetName: "widget",\n\twidgetEventPrefix: "",\n\tdefaultElement: "<div>",\n\n\toptions: {\n\t\tclasses: {},\n\t\tdisabled: false,\n\n\t\t// Callbacks\n\t\tcreate: null\n\t},\n\n\t_createWidget: function( options, element ) {\n\t\telement = $( element || this.defaultElement || this )[ 0 ];\n\t\tthis.element = $( element );\n\t\tthis.uuid = widgetUuid++;\n\t\tthis.eventNamespace = "." + this.widgetName + this.uuid;\n\n\t\tthis.bindings = $();\n\t\tthis.hoverable = $();\n\t\tthis.focusable = $();\n\t\tthis.classesElementLookup = {};\n\n\t\tif ( element !== this ) {\n\t\t\t$.data( element, this.widgetFullName, this );\n\t\t\tthis._on( true, this.element, {\n\t\t\t\tremove: function( event ) {\n\t\t\t\t\tif ( event.target === element ) {\n\t\t\t\t\t\tthis.destroy();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t\tthis.document = $( element.style ?\n\n\t\t\t\t// Element within the document\n\t\t\t\telement.ownerDocument :\n\n\t\t\t\t// Element is window or document\n\t\t\t\telement.document || element );\n\t\t\tthis.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow );\n\t\t}\n\n\t\tthis.options = $.widget.extend( {},\n\t\t\tthis.options,\n\t\t\tthis._getCreateOptions(),\n\t\t\toptions );\n\n\t\tthis._create();\n\n\t\tif ( this.options.disabled ) {\n\t\t\tthis._setOptionDisabled( this.options.disabled );\n\t\t}\n\n\t\tthis._trigger( "create", null, this._getCreateEventData() );\n\t\tthis._init();\n\t},\n\n\t_getCreateOptions: function() {\n\t\treturn {};\n\t},\n\n\t_getCreateEventData: $.noop,\n\n\t_create: $.noop,\n\n\t_init: $.noop,\n\n\tdestroy: function() {\n\t\tvar that = this;\n\n\t\tthis._destroy();\n\t\t$.each( this.classesElementLookup, function( key, value ) {\n\t\t\tthat._removeClass( value, key );\n\t\t} );\n\n\t\t// We can probably remove the unbind calls in 2.0\n\t\t// all event bindings should go through this._on()\n\t\tthis.element\n\t\t\t.off( this.eventNamespace )\n\t\t\t.removeData( this.widgetFullName );\n\t\tthis.widget()\n\t\t\t.off( this.eventNamespace )\n\t\t\t.removeAttr( "aria-disabled" );\n\n\t\t// Clean up events and states\n\t\tthis.bindings.off( this.eventNamespace );\n\t},\n\n\t_destroy: $.noop,\n\n\twidget: function() {\n\t\treturn this.element;\n\t},\n\n\toption: function( key, value ) {\n\t\tvar options = key;\n\t\tvar parts;\n\t\tvar curOption;\n\t\tvar i;\n\n\t\tif ( arguments.length === 0 ) {\n\n\t\t\t// Don\'t return a reference to the internal hash\n\t\t\treturn $.widget.extend( {}, this.options );\n\t\t}\n\n\t\tif ( typeof key === "string" ) {\n\n\t\t\t// Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }\n\t\t\toptions = {};\n\t\t\tparts = key.split( "." );\n\t\t\tkey = parts.shift();\n\t\t\tif ( parts.length ) {\n\t\t\t\tcurOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );\n\t\t\t\tfor ( i = 0; i < parts.length - 1; i++ ) {\n\t\t\t\t\tcurOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};\n\t\t\t\t\tcurOption = curOption[ parts[ i ] ];\n\t\t\t\t}\n\t\t\t\tkey = parts.pop();\n\t\t\t\tif ( arguments.length === 1 ) {\n\t\t\t\t\treturn curOption[ key ] === undefined ? null : curOption[ key ];\n\t\t\t\t}\n\t\t\t\tcurOption[ key ] = value;\n\t\t\t} else {\n\t\t\t\tif ( arguments.length === 1 ) {\n\t\t\t\t\treturn this.options[ key ] === undefined ? null : this.options[ key ];\n\t\t\t\t}\n\t\t\t\toptions[ key ] = value;\n\t\t\t}\n\t\t}\n\n\t\tthis._setOptions( options );\n\n\t\treturn this;\n\t},\n\n\t_setOptions: function( options ) {\n\t\tvar key;\n\n\t\tfor ( key in options ) {\n\t\t\tthis._setOption( key, options[ key ] );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\t_setOption: function( key, value ) {\n\t\tif ( key === "classes" ) {\n\t\t\tthis._setOptionClasses( value );\n\t\t}\n\n\t\tthis.options[ key ] = value;\n\n\t\tif ( key === "disabled" ) {\n\t\t\tthis._setOptionDisabled( value );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\t_setOptionClasses: function( value ) {\n\t\tvar classKey, elements, currentElements;\n\n\t\tfor ( classKey in value ) {\n\t\t\tcurrentElements = this.classesElementLookup[ classKey ];\n\t\t\tif ( value[ classKey ] === this.options.classes[ classKey ] ||\n\t\t\t\t\t!currentElements ||\n\t\t\t\t\t!currentElements.length ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// We are doing this to create a new jQuery object because the _removeClass() call\n\t\t\t// on the next line is going to destroy the reference to the current elements being\n\t\t\t// tracked. We need to save a copy of this collection so that we can add the new classes\n\t\t\t// below.\n\t\t\telements = $( currentElements.get() );\n\t\t\tthis._removeClass( currentElements, classKey );\n\n\t\t\t// We don\'t use _addClass() here, because that uses this.options.classes\n\t\t\t// for generating the string of classes. We want to use the value passed in from\n\t\t\t// _setOption(), this is the new value of the classes option which was passed to\n\t\t\t// _setOption(). We pass this value directly to _classes().\n\t\t\telements.addClass( this._classes( {\n\t\t\t\telement: elements,\n\t\t\t\tkeys: classKey,\n\t\t\t\tclasses: value,\n\t\t\t\tadd: true\n\t\t\t} ) );\n\t\t}\n\t},\n\n\t_setOptionDisabled: function( value ) {\n\t\tthis._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value );\n\n\t\t// If the widget is becoming disabled, then nothing is interactive\n\t\tif ( value ) {\n\t\t\tthis._removeClass( this.hoverable, null, "ui-state-hover" );\n\t\t\tthis._removeClass( this.focusable, null, "ui-state-focus" );\n\t\t}\n\t},\n\n\tenable: function() {\n\t\treturn this._setOptions( { disabled: false } );\n\t},\n\n\tdisable: function() {\n\t\treturn this._setOptions( { disabled: true } );\n\t},\n\n\t_classes: function( options ) {\n\t\tvar full = [];\n\t\tvar that = this;\n\n\t\toptions = $.extend( {\n\t\t\telement: this.element,\n\t\t\tclasses: this.options.classes || {}\n\t\t}, options );\n\n\t\tfunction bindRemoveEvent() {\n\t\t\tvar nodesToBind = [];\n\n\t\t\toptions.element.each( function( _, element ) {\n\t\t\t\tvar isTracked = $.map( that.classesElementLookup, function( elements ) {\n\t\t\t\t\treturn elements;\n\t\t\t\t} )\n\t\t\t\t\t.some( function( elements ) {\n\t\t\t\t\t\treturn elements.is( element );\n\t\t\t\t\t} );\n\n\t\t\t\tif ( !isTracked ) {\n\t\t\t\t\tnodesToBind.push( element );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tthat._on( $( nodesToBind ), {\n\t\t\t\tremove: "_untrackClassesElement"\n\t\t\t} );\n\t\t}\n\n\t\tfunction processClassString( classes, checkOption ) {\n\t\t\tvar current, i;\n\t\t\tfor ( i = 0; i < classes.length; i++ ) {\n\t\t\t\tcurrent = that.classesElementLookup[ classes[ i ] ] || $();\n\t\t\t\tif ( options.add ) {\n\t\t\t\t\tbindRemoveEvent();\n\t\t\t\t\tcurrent = $( $.uniqueSort( current.get().concat( options.element.get() ) ) );\n\t\t\t\t} else {\n\t\t\t\t\tcurrent = $( current.not( options.element ).get() );\n\t\t\t\t}\n\t\t\t\tthat.classesElementLookup[ classes[ i ] ] = current;\n\t\t\t\tfull.push( classes[ i ] );\n\t\t\t\tif ( checkOption && options.classes[ classes[ i ] ] ) {\n\t\t\t\t\tfull.push( options.classes[ classes[ i ] ] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( options.keys ) {\n\t\t\tprocessClassString( options.keys.match( /\\S+/g ) || [], true );\n\t\t}\n\t\tif ( options.extra ) {\n\t\t\tprocessClassString( options.extra.match( /\\S+/g ) || [] );\n\t\t}\n\n\t\treturn full.join( " " );\n\t},\n\n\t_untrackClassesElement: function( event ) {\n\t\tvar that = this;\n\t\t$.each( that.classesElementLookup, function( key, value ) {\n\t\t\tif ( $.inArray( event.target, value ) !== -1 ) {\n\t\t\t\tthat.classesElementLookup[ key ] = $( value.not( event.target ).get() );\n\t\t\t}\n\t\t} );\n\n\t\tthis._off( $( event.target ) );\n\t},\n\n\t_removeClass: function( element, keys, extra ) {\n\t\treturn this._toggleClass( element, keys, extra, false );\n\t},\n\n\t_addClass: function( element, keys, extra ) {\n\t\treturn this._toggleClass( element, keys, extra, true );\n\t},\n\n\t_toggleClass: function( element, keys, extra, add ) {\n\t\tadd = ( typeof add === "boolean" ) ? add : extra;\n\t\tvar shift = ( typeof element === "string" || element === null ),\n\t\t\toptions = {\n\t\t\t\textra: shift ? keys : extra,\n\t\t\t\tkeys: shift ? element : keys,\n\t\t\t\telement: shift ? this.element : element,\n\t\t\t\tadd: add\n\t\t\t};\n\t\toptions.element.toggleClass( this._classes( options ), add );\n\t\treturn this;\n\t},\n\n\t_on: function( suppressDisabledCheck, element, handlers ) {\n\t\tvar delegateElement;\n\t\tvar instance = this;\n\n\t\t// No suppressDisabledCheck flag, shuffle arguments\n\t\tif ( typeof suppressDisabledCheck !== "boolean" ) {\n\t\t\thandlers = element;\n\t\t\telement = suppressDisabledCheck;\n\t\t\tsuppressDisabledCheck = false;\n\t\t}\n\n\t\t// No element argument, shuffle and use this.element\n\t\tif ( !handlers ) {\n\t\t\thandlers = element;\n\t\t\telement = this.element;\n\t\t\tdelegateElement = this.widget();\n\t\t} else {\n\t\t\telement = delegateElement = $( element );\n\t\t\tthis.bindings = this.bindings.add( element );\n\t\t}\n\n\t\t$.each( handlers, function( event, handler ) {\n\t\t\tfunction handlerProxy() {\n\n\t\t\t\t// Allow widgets to customize the disabled handling\n\t\t\t\t// - disabled as an array instead of boolean\n\t\t\t\t// - disabled class as method for disabling individual parts\n\t\t\t\tif ( !suppressDisabledCheck &&\n\t\t\t\t\t\t( instance.options.disabled === true ||\n\t\t\t\t\t\t$( this ).hasClass( "ui-state-disabled" ) ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\treturn ( typeof handler === "string" ? instance[ handler ] : handler )\n\t\t\t\t\t.apply( instance, arguments );\n\t\t\t}\n\n\t\t\t// Copy the guid so direct unbinding works\n\t\t\tif ( typeof handler !== "string" ) {\n\t\t\t\thandlerProxy.guid = handler.guid =\n\t\t\t\t\thandler.guid || handlerProxy.guid || $.guid++;\n\t\t\t}\n\n\t\t\tvar match = event.match( /^([\\w:-]*)\\s*(.*)$/ );\n\t\t\tvar eventName = match[ 1 ] + instance.eventNamespace;\n\t\t\tvar selector = match[ 2 ];\n\n\t\t\tif ( selector ) {\n\t\t\t\tdelegateElement.on( eventName, selector, handlerProxy );\n\t\t\t} else {\n\t\t\t\telement.on( eventName, handlerProxy );\n\t\t\t}\n\t\t} );\n\t},\n\n\t_off: function( element, eventName ) {\n\t\teventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) +\n\t\t\tthis.eventNamespace;\n\t\telement.off( eventName );\n\n\t\t// Clear the stack to avoid memory leaks (#10056)\n\t\tthis.bindings = $( this.bindings.not( element ).get() );\n\t\tthis.focusable = $( this.focusable.not( element ).get() );\n\t\tthis.hoverable = $( this.hoverable.not( element ).get() );\n\t},\n\n\t_delay: function( handler, delay ) {\n\t\tfunction handlerProxy() {\n\t\t\treturn ( typeof handler === "string" ? instance[ handler ] : handler )\n\t\t\t\t.apply( instance, arguments );\n\t\t}\n\t\tvar instance = this;\n\t\treturn setTimeout( handlerProxy, delay || 0 );\n\t},\n\n\t_hoverable: function( element ) {\n\t\tthis.hoverable = this.hoverable.add( element );\n\t\tthis._on( element, {\n\t\t\tmouseenter: function( event ) {\n\t\t\t\tthis._addClass( $( event.currentTarget ), null, "ui-state-hover" );\n\t\t\t},\n\t\t\tmouseleave: function( event ) {\n\t\t\t\tthis._removeClass( $( event.currentTarget ), null, "ui-state-hover" );\n\t\t\t}\n\t\t} );\n\t},\n\n\t_focusable: function( element ) {\n\t\tthis.focusable = this.focusable.add( element );\n\t\tthis._on( element, {\n\t\t\tfocusin: function( event ) {\n\t\t\t\tthis._addClass( $( event.currentTarget ), null, "ui-state-focus" );\n\t\t\t},\n\t\t\tfocusout: function( event ) {\n\t\t\t\tthis._removeClass( $( event.currentTarget ), null, "ui-state-focus" );\n\t\t\t}\n\t\t} );\n\t},\n\n\t_trigger: function( type, event, data ) {\n\t\tvar prop, orig;\n\t\tvar callback = this.options[ type ];\n\n\t\tdata = data || {};\n\t\tevent = $.Event( event );\n\t\tevent.type = ( type === this.widgetEventPrefix ?\n\t\t\ttype :\n\t\t\tthis.widgetEventPrefix + type ).toLowerCase();\n\n\t\t// The original event may come from any element\n\t\t// so we need to reset the target on the new event\n\t\tevent.target = this.element[ 0 ];\n\n\t\t// Copy original event properties over to the new event\n\t\torig = event.originalEvent;\n\t\tif ( orig ) {\n\t\t\tfor ( prop in orig ) {\n\t\t\t\tif ( !( prop in event ) ) {\n\t\t\t\t\tevent[ prop ] = orig[ prop ];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.element.trigger( event, data );\n\t\treturn !( typeof callback === "function" &&\n\t\t\tcallback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false ||\n\t\t\tevent.isDefaultPrevented() );\n\t}\n};\n\n$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {\n\t$.Widget.prototype[ "_" + method ] = function( element, options, callback ) {\n\t\tif ( typeof options === "string" ) {\n\t\t\toptions = { effect: options };\n\t\t}\n\n\t\tvar hasOptions;\n\t\tvar effectName = !options ?\n\t\t\tmethod :\n\t\t\toptions === true || typeof options === "number" ?\n\t\t\t\tdefaultEffect :\n\t\t\t\toptions.effect || defaultEffect;\n\n\t\toptions = options || {};\n\t\tif ( typeof options === "number" ) {\n\t\t\toptions = { duration: options };\n\t\t} else if ( options === true ) {\n\t\t\toptions = {};\n\t\t}\n\n\t\thasOptions = !$.isEmptyObject( options );\n\t\toptions.complete = callback;\n\n\t\tif ( options.delay ) {\n\t\t\telement.delay( options.delay );\n\t\t}\n\n\t\tif ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {\n\t\t\telement[ method ]( options );\n\t\t} else if ( effectName !== method && element[ effectName ] ) {\n\t\t\telement[ effectName ]( options.duration, options.easing, callback );\n\t\t} else {\n\t\t\telement.queue( function( next ) {\n\t\t\t\t$( this )[ method ]();\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tcallback.call( element[ 0 ] );\n\t\t\t\t}\n\t\t\t\tnext();\n\t\t\t} );\n\t\t}\n\t};\n} );\n\nreturn $.widget;\n\n} );\n\n\n//# sourceURL=webpack://web/./node_modules/jquery-ui/ui/widget.js?')},"./node_modules/jquery.fancybox/source/jquery.fancybox.pack.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{eval('/* provided dependency */ var jQuery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");\n/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */\n(function(s,H,f,w){var K=f("html"),q=f(s),p=f(H),b=f.fancybox=function(){b.open.apply(this,arguments)},J=navigator.userAgent.match(/msie/i),C=null,t=H.createTouch!==w,u=function(a){return a&&a.hasOwnProperty&&a instanceof f},r=function(a){return a&&"string"===f.type(a)},F=function(a){return r(a)&&0<a.indexOf("%")},m=function(a,d){var e=parseInt(a,10)||0;d&&F(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},x=function(a,b){return m(a,b)+"px"};f.extend(b,{version:"2.1.5",defaults:{padding:15,margin:20,\nwidth:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!t,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},\nkeys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:\'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>\',image:\'<img class="fancybox-image" src="{href}" alt="" />\',iframe:\'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen\'+\n(J?\' allowtransparency="true"\':"")+"></iframe>",error:\'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>\',closeBtn:\'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>\',next:\'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>\',prev:\'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>\'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,\nopenMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,\nisOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=u(a)?f(a).get():[a]),f.each(a,function(e,c){var l={},g,h,k,n,m;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),u(c)?(l={href:c.data("fancybox-href")||c.attr("href"),title:f("<div/>").text(c.data("fancybox-title")||c.attr("title")).html(),isDom:!0,element:c},\nf.metadata&&f.extend(!0,l,c.metadata())):l=c);g=d.href||l.href||(r(c)?c:null);h=d.title!==w?d.title:l.title||"";n=(k=d.content||l.content)?"html":d.type||l.type;!n&&l.isDom&&(n=c.data("fancybox-type"),n||(n=(n=c.prop("class").match(/fancybox\\.(\\w+)/))?n[1]:null));r(g)&&(n||(b.isImage(g)?n="image":b.isSWF(g)?n="swf":"#"===g.charAt(0)?n="inline":r(c)&&(n="html",k=c)),"ajax"===n&&(m=g.split(/\\s+/,2),g=m.shift(),m=m.shift()));k||("inline"===n?g?k=f(r(g)?g.replace(/.*(?=#[^\\s]+$)/,""):g):l.isDom&&(k=c):\n"html"===n?k=g:n||g||!l.isDom||(n="inline",k=c));f.extend(l,{href:g,type:n,content:k,title:h,selector:m});a[e]=l}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==w&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1===b.trigger("onCancel")||(b.hideLoading(),a&&(b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),\nb.coming=null,b.current||b._afterZoomOut(a)))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(b.isOpen&&!0!==a?(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]()):(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&\n(b.player.timer=setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};!0===a||!b.player.isActive&&!1!==a?b.current&&(b.current.loop||b.current.index<b.group.length-1)&&(b.player.isActive=!0,p.bind({"onCancel.player beforeClose.player":c,"onUpdate.player":e,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")):c()},next:function(a){var d=b.current;d&&(r(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},prev:function(a){var d=\nb.current;d&&(r(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=m(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==w&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,l;c&&(l=b._getPosition(d),a&&"scroll"===a.type?(delete l.position,c.stop(!0,!0).animate(l,200)):(c.css(l),e.pos=f.extend({},e.dim,l)))},\nupdate:function(a){var d=a&&a.originalEvent&&a.originalEvent.type,e=!d||"orientationchange"===d;e&&(clearTimeout(C),C=null);b.isOpen&&!C&&(C=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),C=null)},e&&!t?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,t&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),\nb.trigger("onUpdate")),b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f(\'<div id="fancybox-loading"><div></div></div>\').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){27===(a.which||a.keyCode)&&(a.preventDefault(),b.cancel())});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}));b.trigger("onLoading")},getViewport:function(){var a=b.current&&\nb.current.locked||!1,d={x:q.scrollLeft(),y:q.scrollTop()};a&&a.length?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=t&&s.innerWidth?s.innerWidth:q.width(),d.h=t&&s.innerHeight?s.innerHeight:q.height());return d},unbindEvents:function(){b.wrap&&u(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(q.bind("orientationchange.fb"+(t?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=\ne.which||e.keyCode,l=e.target||e.srcElement;if(27===c&&b.coming)return!1;e.ctrlKey||e.altKey||e.shiftKey||e.metaKey||l&&(l.type||f(l).is("[contenteditable]"))||f.each(d,function(d,l){if(1<a.group.length&&l[c]!==w)return b[d](l[c]),e.preventDefault(),!1;if(-1<f.inArray(c,l))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,l,g){for(var h=f(d.target||null),k=!1;h.length&&!(k||h.is(".fancybox-skin")||h.is(".fancybox-wrap"));)k=h[0]&&!(h[0].style.overflow&&\n"hidden"===h[0].style.overflow)&&(h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();0!==c&&!k&&1<b.group.length&&!a.canShrink&&(0<g||0<l?b.prev(0<g?"down":"left"):(0>g||0>l)&&b.next(0>g?"up":"right"),d.preventDefault())}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&\nb.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0,{},b.helpers[d].defaults,e),c)})}p.trigger(a)},isImage:function(a){return r(a)&&a.match(/(^data:image\\/.*,)|(\\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\\?|#).*)?$)/i)},isSWF:function(a){return r(a)&&a.match(/\\.(swf)((\\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=m(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,\nc,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===\nc||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&t&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(t?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,x(d.padding[a]))});b.trigger("onReady");\nif("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=\nthis.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,\nd=f(a.tpl.iframe.replace(/\\{rnd\\}/g,(new Date).getTime())).attr("scrolling",t?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);t||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||\nb._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,l,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());\nb.unbindEvents();e=a.content;c=a.type;l=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):u(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f(\'<div class="fancybox-placeholder"></div>\').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",\n!1)}));break;case "image":e=a.tpl.image.replace(/\\{href\\}/g,g);break;case "swf":e=\'<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="\'+g+\'"></param>\',h="",f.each(a.swf,function(a,b){e+=\'<param name="\'+a+\'" value="\'+b+\'"></param>\';h+=" "+a+\'="\'+b+\'"\'}),e+=\'<embed src="\'+g+\'" type="application/x-shockwave-flash" width="100%" height="100%"\'+h+"></embed></object>"}u(e)&&e.parent().is(a.inner)||a.inner.append(e);b.trigger("beforeShow");\na.inner.css("overflow","yes"===l?"scroll":"no"===l?"hidden":l);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(!b.isOpened)f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();else if(d.prevMethod)b.transitions[d.prevMethod]();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,l=b.skin,g=b.inner,h=b.current,c=h.width,k=h.height,n=h.minWidth,v=h.minHeight,p=h.maxWidth,\nq=h.maxHeight,t=h.scrolling,r=h.scrollOutside?h.scrollbarWidth:0,y=h.margin,z=m(y[1]+y[3]),s=m(y[0]+y[2]),w,A,u,D,B,G,C,E,I;e.add(l).add(g).width("auto").height("auto").removeClass("fancybox-tmp");y=m(l.outerWidth(!0)-l.width());w=m(l.outerHeight(!0)-l.height());A=z+y;u=s+w;D=F(c)?(a.w-A)*m(c)/100:c;B=F(k)?(a.h-u)*m(k)/100:k;if("iframe"===h.type){if(I=h.content,h.autoHeight&&1===I.data("ready"))try{I[0].contentWindow.document.location&&(g.width(D).height(9999),G=I.contents().find("body"),r&&G.css("overflow-x",\n"hidden"),B=G.outerHeight(!0))}catch(H){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(D),h.autoHeight||g.height(B),h.autoWidth&&(D=g.width()),h.autoHeight&&(B=g.height()),g.removeClass("fancybox-tmp");c=m(D);k=m(B);E=D/B;n=m(F(n)?m(n,"w")-A:n);p=m(F(p)?m(p,"w")-A:p);v=m(F(v)?m(v,"h")-u:v);q=m(F(q)?m(q,"h")-u:q);G=p;C=q;h.fitToView&&(p=Math.min(a.w-A,p),q=Math.min(a.h-u,q));A=a.w-z;s=a.h-s;h.aspectRatio?(c>p&&(c=p,k=m(c/E)),k>q&&(k=q,c=m(k*E)),c<n&&(c=n,k=m(c/\nE)),k<v&&(k=v,c=m(k*E))):(c=Math.max(n,Math.min(c,p)),h.autoHeight&&"iframe"!==h.type&&(g.width(c),k=g.height()),k=Math.max(v,Math.min(k,q)));if(h.fitToView)if(g.width(c).height(k),e.width(c+y),a=e.width(),z=e.height(),h.aspectRatio)for(;(a>A||z>s)&&c>n&&k>v&&!(19<d++);)k=Math.max(v,Math.min(q,k-10)),c=m(k*E),c<n&&(c=n,k=m(c/E)),c>p&&(c=p,k=m(c/E)),g.width(c).height(k),e.width(c+y),a=e.width(),z=e.height();else c=Math.max(n,Math.min(c,c-(a-A))),k=Math.max(v,Math.min(k,k-(z-s)));r&&"auto"===t&&k<B&&\nc+y+r<A&&(c+=r);g.width(c).height(k);e.width(c+y);a=e.width();z=e.height();e=(a>A||z>s)&&c>n&&k>v;c=h.aspectRatio?c<G&&k<C&&c<D&&k<B:(c<G||k<C)&&(c<D||k<B);f.extend(h,{dim:{width:x(a),height:x(z)},origWidth:D,origHeight:B,canShrink:e,canExpand:c,wPadding:y,hPadding:w,wrapSpace:z-l.outerHeight(!0),skinSpace:l.height()-k});!I&&h.autoHeight&&k>v&&k<q&&!c&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",\ntop:c[0],left:c[3]};d.autoCenter&&d.fixed&&!a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=x(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=x(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&((b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){f(d.target).is("a")||f(d.target).parent().is("a")||\n(d.preventDefault(),b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),a.loop||a.index!==a.group.length-1)?b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play(!0)):b.play(!1))},\n_afterZoomOut:function(a){a=a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,k=a.wPadding,n=b.getViewport();!e&&a.isDom&&d.is(":visible")&&(e=d.find("img:first"),e.length||(e=d));u(e)?(c=e.offset(),e.is("img")&&\n(f=e.outerWidth(),g=e.outerHeight())):(c.top=n.y+(n.h-g)*a.topRatio,c.left=n.x+(n.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=n.y,c.left-=n.x;return c={top:x(c.top-h*a.topRatio),left:x(c.left-k*a.leftRatio),width:x(f+k),height:x(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](m("width"===\nf?c:c-g*e)),b.inner[f](m("width"===f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,l=f.extend({opacity:1},d);delete l.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(l,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&\n(c.opacity=0.1));b.wrap.animate(c,{duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=x(m(e[g])-200),c[g]="+=200px"):(e[g]=x(m(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},\nchangeOut:function(){var a=b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!t,fixed:!0},overlay:null,fixed:!1,el:f("html"),create:function(a){var d;a=f.extend({},this.defaults,a);this.overlay&&\nthis.close();d=b.coming?b.coming.parent:a.parent;this.overlay=f(\'<div class="fancybox-overlay"></div>\').appendTo(d&&d.lenth?d:"body");this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",\nfunction(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive?b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){q.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),this.el.removeClass("fancybox-lock"),q.scrollTop(this.scrollV).scrollLeft(this.scrollH));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");\nJ?(b=Math.max(H.documentElement.offsetWidth,H.body.offsetWidth),p.width()>b&&(a=p.width())):p.width()>q.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&this.fixed&&b.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&!this.el.hasClass("fancybox-lock")&&(!1!==this.fixPosition&&f("*").filter(function(){return"fixed"===\nf(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin"),this.scrollV=q.scrollTop(),this.scrollH=q.scrollLeft(),this.el.addClass("fancybox-lock"),q.scrollTop(this.scrollV).scrollLeft(this.scrollH));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",\nposition:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(r(e)&&""!==f.trim(e)){d=f(\'<div class="fancybox-title fancybox-title-\'+c+\'-wrap">\'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),J&&d.width(d.width()),d.wrapInner(\'<span class="child"></span>\'),b.current.margin[2]+=Math.abs(m(d.css("margin-bottom")))}d["top"===a.position?"prependTo":\n"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",l=function(g){var h=f(this).blur(),k=d,l,m;g.ctrlKey||g.altKey||g.shiftKey||g.metaKey||h.is(".fancybox-wrap")||(l=a.groupAttr||"data-fancybox-group",m=h.attr(l),m||(l="rel",m=h.get(0)[l]),m&&""!==m&&"nofollow"!==m&&(h=c.length?f(c):e,h=h.filter("["+l+\'="\'+m+\'"]\'),k=h.index(this)),a.index=k,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;c&&!1!==a.live?p.undelegate(c,"click.fb-start").delegate(c+":not(\'.fancybox-item, .fancybox-nav\')",\n"click.fb-start",l):e.unbind("click.fb-start").bind("click.fb-start",l);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===w&&(f.scrollbarWidth=function(){var a=f(\'<div style="width:50px;height:50px;overflow:auto"><div/></div>\').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});f.support.fixedPosition===w&&(f.support.fixedPosition=function(){var a=f(\'<div style="position:fixed;top:20px;"></div>\').appendTo("body"),\nb=20===a[0].offsetTop||15===a[0].offsetTop;a.remove();return b}());f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(s).width();K.addClass("fancybox-lock-test");d=f(s).width();K.removeClass("fancybox-lock-test");f("<style type=\'text/css\'>.fancybox-margin{margin-right:"+(d-a)+"px;}</style>").appendTo("head")})})(window,document,jQuery);\n\n//# sourceURL=webpack://web/./node_modules/jquery.fancybox/source/jquery.fancybox.pack.js?')},"./node_modules/jquery.mousewheel/jquery.mousewheel.js":(module,exports,__webpack_require__)=>{eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)\r\n * Licensed under the MIT License (LICENSE.txt).\r\n *\r\n * Version: 3.1.9\r\n *\r\n * Requires: jQuery 1.2.2+\r\n */\r\n\r\n(function (factory) {\r\n if ( true ) {\r\n // AMD. Register as an anonymous module.\r\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\r\n } else {}\r\n}(function ($) {\r\n\r\n var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],\r\n toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?\r\n ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],\r\n slice = Array.prototype.slice,\r\n nullLowestDeltaTimeout, lowestDelta;\r\n\r\n if ( $.event.fixHooks ) {\r\n for ( var i = toFix.length; i; ) {\r\n $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;\r\n }\r\n }\r\n\r\n var special = $.event.special.mousewheel = {\r\n version: '3.1.9',\r\n\r\n setup: function() {\r\n if ( this.addEventListener ) {\r\n for ( var i = toBind.length; i; ) {\r\n this.addEventListener( toBind[--i], handler, false );\r\n }\r\n } else {\r\n this.onmousewheel = handler;\r\n }\r\n // Store the line height and page height for this particular element\r\n $.data(this, 'mousewheel-line-height', special.getLineHeight(this));\r\n $.data(this, 'mousewheel-page-height', special.getPageHeight(this));\r\n },\r\n\r\n teardown: function() {\r\n if ( this.removeEventListener ) {\r\n for ( var i = toBind.length; i; ) {\r\n this.removeEventListener( toBind[--i], handler, false );\r\n }\r\n } else {\r\n this.onmousewheel = null;\r\n }\r\n },\r\n\r\n getLineHeight: function(elem) {\r\n return parseInt($(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']().css('fontSize'), 10);\r\n },\r\n\r\n getPageHeight: function(elem) {\r\n return $(elem).height();\r\n },\r\n\r\n settings: {\r\n adjustOldDeltas: true\r\n }\r\n };\r\n\r\n $.fn.extend({\r\n mousewheel: function(fn) {\r\n return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');\r\n },\r\n\r\n unmousewheel: function(fn) {\r\n return this.unbind('mousewheel', fn);\r\n }\r\n });\r\n\r\n\r\n function handler(event) {\r\n var orgEvent = event || window.event,\r\n args = slice.call(arguments, 1),\r\n delta = 0,\r\n deltaX = 0,\r\n deltaY = 0,\r\n absDelta = 0;\r\n event = $.event.fix(orgEvent);\r\n event.type = 'mousewheel';\r\n\r\n // Old school scrollwheel delta\r\n if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }\r\n if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }\r\n if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }\r\n if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }\r\n\r\n // Firefox < 17 horizontal scrolling related to DOMMouseScroll event\r\n if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {\r\n deltaX = deltaY * -1;\r\n deltaY = 0;\r\n }\r\n\r\n // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy\r\n delta = deltaY === 0 ? deltaX : deltaY;\r\n\r\n // New school wheel delta (wheel event)\r\n if ( 'deltaY' in orgEvent ) {\r\n deltaY = orgEvent.deltaY * -1;\r\n delta = deltaY;\r\n }\r\n if ( 'deltaX' in orgEvent ) {\r\n deltaX = orgEvent.deltaX;\r\n if ( deltaY === 0 ) { delta = deltaX * -1; }\r\n }\r\n\r\n // No change actually happened, no reason to go any further\r\n if ( deltaY === 0 && deltaX === 0 ) { return; }\r\n\r\n // Need to convert lines and pages to pixels if we aren't already in pixels\r\n // There are three delta modes:\r\n // * deltaMode 0 is by pixels, nothing to do\r\n // * deltaMode 1 is by lines\r\n // * deltaMode 2 is by pages\r\n if ( orgEvent.deltaMode === 1 ) {\r\n var lineHeight = $.data(this, 'mousewheel-line-height');\r\n delta *= lineHeight;\r\n deltaY *= lineHeight;\r\n deltaX *= lineHeight;\r\n } else if ( orgEvent.deltaMode === 2 ) {\r\n var pageHeight = $.data(this, 'mousewheel-page-height');\r\n delta *= pageHeight;\r\n deltaY *= pageHeight;\r\n deltaX *= pageHeight;\r\n }\r\n\r\n // Store lowest absolute delta to normalize the delta values\r\n absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );\r\n\r\n if ( !lowestDelta || absDelta < lowestDelta ) {\r\n lowestDelta = absDelta;\r\n\r\n // Adjust older deltas if necessary\r\n if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {\r\n lowestDelta /= 40;\r\n }\r\n }\r\n\r\n // Adjust older deltas if necessary\r\n if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {\r\n // Divide all the things by 40!\r\n delta /= 40;\r\n deltaX /= 40;\r\n deltaY /= 40;\r\n }\r\n\r\n // Get a whole, normalized value for the deltas\r\n delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);\r\n deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);\r\n deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);\r\n\r\n // Add information to the event object\r\n event.deltaX = deltaX;\r\n event.deltaY = deltaY;\r\n event.deltaFactor = lowestDelta;\r\n // Go ahead and set deltaMode to 0 since we converted to pixels\r\n // Although this is a little odd since we overwrite the deltaX/Y\r\n // properties with normalized deltas.\r\n event.deltaMode = 0;\r\n\r\n // Add event and delta to the front of the arguments\r\n args.unshift(event, delta, deltaX, deltaY);\r\n\r\n // Clearout lowestDelta after sometime to better\r\n // handle multiple device types that give different\r\n // a different lowestDelta\r\n // Ex: trackpad = 3 and mouse wheel = 120\r\n if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }\r\n nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);\r\n\r\n return ($.event.dispatch || $.event.handle).apply(this, args);\r\n }\r\n\r\n function nullLowestDelta() {\r\n lowestDelta = null;\r\n }\r\n\r\n function shouldAdjustOldDeltas(orgEvent, absDelta) {\r\n // If this is an older event and the delta is divisable by 120,\r\n // then we are assuming that the browser is treating this as an\r\n // older mouse wheel event and that we should divide the deltas\r\n // by 40 to try and get a more usable deltaFactor.\r\n // Side note, this actually impacts the reported scroll distance\r\n // in older browsers and can cause scrolling to be slower than native.\r\n // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.\r\n return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;\r\n }\r\n\r\n}));\r\n\n\n//# sourceURL=webpack://web/./node_modules/jquery.mousewheel/jquery.mousewheel.js?")},"./node_modules/jquery.scrollto/jquery.scrollTo.js":(module,exports,__webpack_require__)=>{eval("var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n * jQuery.scrollTo\n * Copyright (c) 2007 Ariel Flesler - aflesler ○ gmail • com | https://github.com/flesler\n * Licensed under MIT\n * https://github.com/flesler/jquery.scrollTo\n * @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery\n * @author Ariel Flesler\n * @version 2.1.3\n */\n;(function(factory) {\n\t'use strict';\n\tif (true) {\n\t\t// AMD\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else {}\n})(function($) {\n\t'use strict';\n\n\tvar $scrollTo = $.scrollTo = function(target, duration, settings) {\n\t\treturn $(window).scrollTo(target, duration, settings);\n\t};\n\n\t$scrollTo.defaults = {\n\t\taxis:'xy',\n\t\tduration: 0,\n\t\tlimit:true\n\t};\n\n\tfunction isWin(elem) {\n\t\treturn !elem.nodeName ||\n\t\t\t$.inArray(elem.nodeName.toLowerCase(), ['iframe','#document','html','body']) !== -1;\n\t}\n\n\tfunction isFunction(obj) {\n\t\t// Brought from jQuery since it's deprecated\n\t\treturn typeof obj === 'function'\n\t}\n\n\t$.fn.scrollTo = function(target, duration, settings) {\n\t\tif (typeof duration === 'object') {\n\t\t\tsettings = duration;\n\t\t\tduration = 0;\n\t\t}\n\t\tif (typeof settings === 'function') {\n\t\t\tsettings = { onAfter:settings };\n\t\t}\n\t\tif (target === 'max') {\n\t\t\ttarget = 9e9;\n\t\t}\n\n\t\tsettings = $.extend({}, $scrollTo.defaults, settings);\n\t\t// Speed is still recognized for backwards compatibility\n\t\tduration = duration || settings.duration;\n\t\t// Make sure the settings are given right\n\t\tvar queue = settings.queue && settings.axis.length > 1;\n\t\tif (queue) {\n\t\t\t// Let's keep the overall duration\n\t\t\tduration /= 2;\n\t\t}\n\t\tsettings.offset = both(settings.offset);\n\t\tsettings.over = both(settings.over);\n\n\t\treturn this.each(function() {\n\t\t\t// Null target yields nothing, just like jQuery does\n\t\t\tif (target === null) return;\n\n\t\t\tvar win = isWin(this),\n\t\t\t\telem = win ? this.contentWindow || window : this,\n\t\t\t\t$elem = $(elem),\n\t\t\t\ttarg = target,\n\t\t\t\tattr = {},\n\t\t\t\ttoff;\n\n\t\t\tswitch (typeof targ) {\n\t\t\t\t// A number will pass the regex\n\t\t\t\tcase 'number':\n\t\t\t\tcase 'string':\n\t\t\t\t\tif (/^([+-]=?)?\\d+(\\.\\d+)?(px|%)?$/.test(targ)) {\n\t\t\t\t\t\ttarg = both(targ);\n\t\t\t\t\t\t// We are done\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// Relative/Absolute selector\n\t\t\t\t\ttarg = win ? $(targ) : $(targ, elem);\n\t\t\t\t\t/* falls through */\n\t\t\t\tcase 'object':\n\t\t\t\t\tif (targ.length === 0) return;\n\t\t\t\t\t// DOMElement / jQuery\n\t\t\t\t\tif (targ.is || targ.style) {\n\t\t\t\t\t\t// Get the real position of the target\n\t\t\t\t\t\ttoff = (targ = $(targ)).offset();\n\t\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar offset = isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset;\n\n\t\t\t$.each(settings.axis.split(''), function(i, axis) {\n\t\t\t\tvar Pos\t= axis === 'x' ? 'Left' : 'Top',\n\t\t\t\t\tpos = Pos.toLowerCase(),\n\t\t\t\t\tkey = 'scroll' + Pos,\n\t\t\t\t\tprev = $elem[key](),\n\t\t\t\t\tmax = $scrollTo.max(elem, axis);\n\n\t\t\t\tif (toff) {// jQuery / DOMElement\n\t\t\t\t\tattr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos]);\n\n\t\t\t\t\t// If it's a dom element, reduce the margin\n\t\t\t\t\tif (settings.margin) {\n\t\t\t\t\t\tattr[key] -= parseInt(targ.css('margin'+Pos), 10) || 0;\n\t\t\t\t\t\tattr[key] -= parseInt(targ.css('border'+Pos+'Width'), 10) || 0;\n\t\t\t\t\t}\n\n\t\t\t\t\tattr[key] += offset[pos] || 0;\n\n\t\t\t\t\tif (settings.over[pos]) {\n\t\t\t\t\t\t// Scroll to a fraction of its width/height\n\t\t\t\t\t\tattr[key] += targ[axis === 'x'?'width':'height']() * settings.over[pos];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tvar val = targ[pos];\n\t\t\t\t\t// Handle percentage values\n\t\t\t\t\tattr[key] = val.slice && val.slice(-1) === '%' ?\n\t\t\t\t\t\tparseFloat(val) / 100 * max\n\t\t\t\t\t\t: val;\n\t\t\t\t}\n\n\t\t\t\t// Number or 'number'\n\t\t\t\tif (settings.limit && /^\\d+$/.test(attr[key])) {\n\t\t\t\t\t// Check the limits\n\t\t\t\t\tattr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);\n\t\t\t\t}\n\n\t\t\t\t// Don't waste time animating, if there's no need.\n\t\t\t\tif (!i && settings.axis.length > 1) {\n\t\t\t\t\tif (prev === attr[key]) {\n\t\t\t\t\t\t// No animation needed\n\t\t\t\t\t\tattr = {};\n\t\t\t\t\t} else if (queue) {\n\t\t\t\t\t\t// Intermediate animation\n\t\t\t\t\t\tanimate(settings.onAfterFirst);\n\t\t\t\t\t\t// Don't animate this axis again in the next iteration.\n\t\t\t\t\t\tattr = {};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tanimate(settings.onAfter);\n\n\t\t\tfunction animate(callback) {\n\t\t\t\tvar opts = $.extend({}, settings, {\n\t\t\t\t\t// The queue setting conflicts with animate()\n\t\t\t\t\t// Force it to always be true\n\t\t\t\t\tqueue: true,\n\t\t\t\t\tduration: duration,\n\t\t\t\t\tcomplete: callback && function() {\n\t\t\t\t\t\tcallback.call(elem, targ, settings);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t$elem.animate(attr, opts);\n\t\t\t}\n\t\t});\n\t};\n\n\t// Max scrolling position, works on quirks mode\n\t// It only fails (not too badly) on IE, quirks mode.\n\t$scrollTo.max = function(elem, axis) {\n\t\tvar Dim = axis === 'x' ? 'Width' : 'Height',\n\t\t\tscroll = 'scroll'+Dim;\n\n\t\tif (!isWin(elem))\n\t\t\treturn elem[scroll] - $(elem)[Dim.toLowerCase()]();\n\n\t\tvar size = 'client' + Dim,\n\t\t\tdoc = elem.ownerDocument || elem.document,\n\t\t\thtml = doc.documentElement,\n\t\t\tbody = doc.body;\n\n\t\treturn Math.max(html[scroll], body[scroll]) - Math.min(html[size], body[size]);\n\t};\n\n\tfunction both(val) {\n\t\treturn isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val };\n\t}\n\n\t// Add special hooks so that window scroll properties can be animated\n\t$.Tween.propHooks.scrollLeft =\n\t$.Tween.propHooks.scrollTop = {\n\t\tget: function(t) {\n\t\t\treturn $(t.elem)[t.prop]();\n\t\t},\n\t\tset: function(t) {\n\t\t\tvar curr = this.get(t);\n\t\t\t// If interrupt is true and user scrolled, stop animating\n\t\t\tif (t.options.interrupt && t._last && t._last !== curr) {\n\t\t\t\treturn $(t.elem).stop();\n\t\t\t}\n\t\t\tvar next = Math.round(t.now);\n\t\t\t// Don't waste CPU\n\t\t\t// Browsers don't render floating point scroll\n\t\t\tif (curr !== next) {\n\t\t\t\t$(t.elem)[t.prop](next);\n\t\t\t\tt._last = this.get(t);\n\t\t\t}\n\t\t}\n\t};\n\n\t// AMD requirement\n\treturn $scrollTo;\n});\n\n\n//# sourceURL=webpack://web/./node_modules/jquery.scrollto/jquery.scrollTo.js?")},"./node_modules/jquery/dist/jquery.js":function(module,exports){eval('var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n * jQuery JavaScript Library v3.7.1\n * https://jquery.com/\n *\n * Copyright OpenJS Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2023-08-28T13:37Z\n */\n( function( global, factory ) {\n\n\t"use strict";\n\n\tif ( true && typeof module.exports === "object" ) {\n\n\t\t// For CommonJS and CommonJS-like environments where a proper `window`\n\t\t// is present, execute the factory and get jQuery.\n\t\t// For environments that do not have a `window` with a `document`\n\t\t// (such as Node.js), expose a factory as module.exports.\n\t\t// This accentuates the need for the creation of a real `window`.\n\t\t// e.g. var jQuery = require("jquery")(window);\n\t\t// See ticket trac-14549 for more info.\n\t\tmodule.exports = global.document ?\n\t\t\tfactory( global, true ) :\n\t\t\tfunction( w ) {\n\t\t\t\tif ( !w.document ) {\n\t\t\t\t\tthrow new Error( "jQuery requires a window with a document" );\n\t\t\t\t}\n\t\t\t\treturn factory( w );\n\t\t\t};\n\t} else {\n\t\tfactory( global );\n\t}\n\n// Pass this if window is not defined yet\n} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {\n\n// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1\n// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode\n// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common\n// enough that all such attempts are guarded in a try block.\n"use strict";\n\nvar arr = [];\n\nvar getProto = Object.getPrototypeOf;\n\nvar slice = arr.slice;\n\nvar flat = arr.flat ? function( array ) {\n\treturn arr.flat.call( array );\n} : function( array ) {\n\treturn arr.concat.apply( [], array );\n};\n\n\nvar push = arr.push;\n\nvar indexOf = arr.indexOf;\n\nvar class2type = {};\n\nvar toString = class2type.toString;\n\nvar hasOwn = class2type.hasOwnProperty;\n\nvar fnToString = hasOwn.toString;\n\nvar ObjectFunctionString = fnToString.call( Object );\n\nvar support = {};\n\nvar isFunction = function isFunction( obj ) {\n\n\t\t// Support: Chrome <=57, Firefox <=52\n\t\t// In some browsers, typeof returns "function" for HTML <object> elements\n\t\t// (i.e., `typeof document.createElement( "object" ) === "function"`).\n\t\t// We don\'t want to classify *any* DOM node as a function.\n\t\t// Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5\n\t\t// Plus for old WebKit, typeof returns "function" for HTML collections\n\t\t// (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)\n\t\treturn typeof obj === "function" && typeof obj.nodeType !== "number" &&\n\t\t\ttypeof obj.item !== "function";\n\t};\n\n\nvar isWindow = function isWindow( obj ) {\n\t\treturn obj != null && obj === obj.window;\n\t};\n\n\nvar document = window.document;\n\n\n\n\tvar preservedScriptAttributes = {\n\t\ttype: true,\n\t\tsrc: true,\n\t\tnonce: true,\n\t\tnoModule: true\n\t};\n\n\tfunction DOMEval( code, node, doc ) {\n\t\tdoc = doc || document;\n\n\t\tvar i, val,\n\t\t\tscript = doc.createElement( "script" );\n\n\t\tscript.text = code;\n\t\tif ( node ) {\n\t\t\tfor ( i in preservedScriptAttributes ) {\n\n\t\t\t\t// Support: Firefox 64+, Edge 18+\n\t\t\t\t// Some browsers don\'t support the "nonce" property on scripts.\n\t\t\t\t// On the other hand, just using `getAttribute` is not enough as\n\t\t\t\t// the `nonce` attribute is reset to an empty string whenever it\n\t\t\t\t// becomes browsing-context connected.\n\t\t\t\t// See https://github.com/whatwg/html/issues/2369\n\t\t\t\t// See https://html.spec.whatwg.org/#nonce-attributes\n\t\t\t\t// The `node.getAttribute` check was added for the sake of\n\t\t\t\t// `jQuery.globalEval` so that it can fake a nonce-containing node\n\t\t\t\t// via an object.\n\t\t\t\tval = node[ i ] || node.getAttribute && node.getAttribute( i );\n\t\t\t\tif ( val ) {\n\t\t\t\t\tscript.setAttribute( i, val );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tdoc.head.appendChild( script ).parentNode.removeChild( script );\n\t}\n\n\nfunction toType( obj ) {\n\tif ( obj == null ) {\n\t\treturn obj + "";\n\t}\n\n\t// Support: Android <=2.3 only (functionish RegExp)\n\treturn typeof obj === "object" || typeof obj === "function" ?\n\t\tclass2type[ toString.call( obj ) ] || "object" :\n\t\ttypeof obj;\n}\n/* global Symbol */\n// Defining this global in .eslintrc.json would create a danger of using the global\n// unguarded in another place, it seems safer to define global only for this module\n\n\n\nvar version = "3.7.1",\n\n\trhtmlSuffix = /HTML$/i,\n\n\t// Define a local copy of jQuery\n\tjQuery = function( selector, context ) {\n\n\t\t// The jQuery object is actually just the init constructor \'enhanced\'\n\t\t// Need init if jQuery is called (just allow error to be thrown if not included)\n\t\treturn new jQuery.fn.init( selector, context );\n\t};\n\njQuery.fn = jQuery.prototype = {\n\n\t// The current version of jQuery being used\n\tjquery: version,\n\n\tconstructor: jQuery,\n\n\t// The default length of a jQuery object is 0\n\tlength: 0,\n\n\ttoArray: function() {\n\t\treturn slice.call( this );\n\t},\n\n\t// Get the Nth element in the matched element set OR\n\t// Get the whole matched element set as a clean array\n\tget: function( num ) {\n\n\t\t// Return all the elements in a clean array\n\t\tif ( num == null ) {\n\t\t\treturn slice.call( this );\n\t\t}\n\n\t\t// Return just the one element from the set\n\t\treturn num < 0 ? this[ num + this.length ] : this[ num ];\n\t},\n\n\t// Take an array of elements and push it onto the stack\n\t// (returning the new matched element set)\n\tpushStack: function( elems ) {\n\n\t\t// Build a new jQuery matched element set\n\t\tvar ret = jQuery.merge( this.constructor(), elems );\n\n\t\t// Add the old object onto the stack (as a reference)\n\t\tret.prevObject = this;\n\n\t\t// Return the newly-formed element set\n\t\treturn ret;\n\t},\n\n\t// Execute a callback for every element in the matched set.\n\teach: function( callback ) {\n\t\treturn jQuery.each( this, callback );\n\t},\n\n\tmap: function( callback ) {\n\t\treturn this.pushStack( jQuery.map( this, function( elem, i ) {\n\t\t\treturn callback.call( elem, i, elem );\n\t\t} ) );\n\t},\n\n\tslice: function() {\n\t\treturn this.pushStack( slice.apply( this, arguments ) );\n\t},\n\n\tfirst: function() {\n\t\treturn this.eq( 0 );\n\t},\n\n\tlast: function() {\n\t\treturn this.eq( -1 );\n\t},\n\n\teven: function() {\n\t\treturn this.pushStack( jQuery.grep( this, function( _elem, i ) {\n\t\t\treturn ( i + 1 ) % 2;\n\t\t} ) );\n\t},\n\n\todd: function() {\n\t\treturn this.pushStack( jQuery.grep( this, function( _elem, i ) {\n\t\t\treturn i % 2;\n\t\t} ) );\n\t},\n\n\teq: function( i ) {\n\t\tvar len = this.length,\n\t\t\tj = +i + ( i < 0 ? len : 0 );\n\t\treturn this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );\n\t},\n\n\tend: function() {\n\t\treturn this.prevObject || this.constructor();\n\t},\n\n\t// For internal use only.\n\t// Behaves like an Array\'s method, not like a jQuery method.\n\tpush: push,\n\tsort: arr.sort,\n\tsplice: arr.splice\n};\n\njQuery.extend = jQuery.fn.extend = function() {\n\tvar options, name, src, copy, copyIsArray, clone,\n\t\ttarget = arguments[ 0 ] || {},\n\t\ti = 1,\n\t\tlength = arguments.length,\n\t\tdeep = false;\n\n\t// Handle a deep copy situation\n\tif ( typeof target === "boolean" ) {\n\t\tdeep = target;\n\n\t\t// Skip the boolean and the target\n\t\ttarget = arguments[ i ] || {};\n\t\ti++;\n\t}\n\n\t// Handle case when target is a string or something (possible in deep copy)\n\tif ( typeof target !== "object" && !isFunction( target ) ) {\n\t\ttarget = {};\n\t}\n\n\t// Extend jQuery itself if only one argument is passed\n\tif ( i === length ) {\n\t\ttarget = this;\n\t\ti--;\n\t}\n\n\tfor ( ; i < length; i++ ) {\n\n\t\t// Only deal with non-null/undefined values\n\t\tif ( ( options = arguments[ i ] ) != null ) {\n\n\t\t\t// Extend the base object\n\t\t\tfor ( name in options ) {\n\t\t\t\tcopy = options[ name ];\n\n\t\t\t\t// Prevent Object.prototype pollution\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif ( name === "__proto__" || target === copy ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Recurse if we\'re merging plain objects or arrays\n\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject( copy ) ||\n\t\t\t\t\t( copyIsArray = Array.isArray( copy ) ) ) ) {\n\t\t\t\t\tsrc = target[ name ];\n\n\t\t\t\t\t// Ensure proper type for the source value\n\t\t\t\t\tif ( copyIsArray && !Array.isArray( src ) ) {\n\t\t\t\t\t\tclone = [];\n\t\t\t\t\t} else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {\n\t\t\t\t\t\tclone = {};\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclone = src;\n\t\t\t\t\t}\n\t\t\t\t\tcopyIsArray = false;\n\n\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );\n\n\t\t\t\t// Don\'t bring in undefined values\n\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\njQuery.extend( {\n\n\t// Unique for each copy of jQuery on the page\n\texpando: "jQuery" + ( version + Math.random() ).replace( /\\D/g, "" ),\n\n\t// Assume jQuery is ready without the ready module\n\tisReady: true,\n\n\terror: function( msg ) {\n\t\tthrow new Error( msg );\n\t},\n\n\tnoop: function() {},\n\n\tisPlainObject: function( obj ) {\n\t\tvar proto, Ctor;\n\n\t\t// Detect obvious negatives\n\t\t// Use toString instead of jQuery.type to catch host objects\n\t\tif ( !obj || toString.call( obj ) !== "[object Object]" ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tproto = getProto( obj );\n\n\t\t// Objects with no prototype (e.g., `Object.create( null )`) are plain\n\t\tif ( !proto ) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// Objects with prototype are plain iff they were constructed by a global Object function\n\t\tCtor = hasOwn.call( proto, "constructor" ) && proto.constructor;\n\t\treturn typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;\n\t},\n\n\tisEmptyObject: function( obj ) {\n\t\tvar name;\n\n\t\tfor ( name in obj ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},\n\n\t// Evaluates a script in a provided context; falls back to the global one\n\t// if not specified.\n\tglobalEval: function( code, options, doc ) {\n\t\tDOMEval( code, { nonce: options && options.nonce }, doc );\n\t},\n\n\teach: function( obj, callback ) {\n\t\tvar length, i = 0;\n\n\t\tif ( isArrayLike( obj ) ) {\n\t\t\tlength = obj.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfor ( i in obj ) {\n\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn obj;\n\t},\n\n\n\t// Retrieve the text value of an array of DOM nodes\n\ttext: function( elem ) {\n\t\tvar node,\n\t\t\tret = "",\n\t\t\ti = 0,\n\t\t\tnodeType = elem.nodeType;\n\n\t\tif ( !nodeType ) {\n\n\t\t\t// If no nodeType, this is expected to be an array\n\t\t\twhile ( ( node = elem[ i++ ] ) ) {\n\n\t\t\t\t// Do not traverse comment nodes\n\t\t\t\tret += jQuery.text( node );\n\t\t\t}\n\t\t}\n\t\tif ( nodeType === 1 || nodeType === 11 ) {\n\t\t\treturn elem.textContent;\n\t\t}\n\t\tif ( nodeType === 9 ) {\n\t\t\treturn elem.documentElement.textContent;\n\t\t}\n\t\tif ( nodeType === 3 || nodeType === 4 ) {\n\t\t\treturn elem.nodeValue;\n\t\t}\n\n\t\t// Do not include comment or processing instruction nodes\n\n\t\treturn ret;\n\t},\n\n\t// results is for internal usage only\n\tmakeArray: function( arr, results ) {\n\t\tvar ret = results || [];\n\n\t\tif ( arr != null ) {\n\t\t\tif ( isArrayLike( Object( arr ) ) ) {\n\t\t\t\tjQuery.merge( ret,\n\t\t\t\t\ttypeof arr === "string" ?\n\t\t\t\t\t\t[ arr ] : arr\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tpush.call( ret, arr );\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tinArray: function( elem, arr, i ) {\n\t\treturn arr == null ? -1 : indexOf.call( arr, elem, i );\n\t},\n\n\tisXMLDoc: function( elem ) {\n\t\tvar namespace = elem && elem.namespaceURI,\n\t\t\tdocElem = elem && ( elem.ownerDocument || elem ).documentElement;\n\n\t\t// Assume HTML when documentElement doesn\'t yet exist, such as inside\n\t\t// document fragments.\n\t\treturn !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );\n\t},\n\n\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t// push.apply(_, arraylike) throws on ancient WebKit\n\tmerge: function( first, second ) {\n\t\tvar len = +second.length,\n\t\t\tj = 0,\n\t\t\ti = first.length;\n\n\t\tfor ( ; j < len; j++ ) {\n\t\t\tfirst[ i++ ] = second[ j ];\n\t\t}\n\n\t\tfirst.length = i;\n\n\t\treturn first;\n\t},\n\n\tgrep: function( elems, callback, invert ) {\n\t\tvar callbackInverse,\n\t\t\tmatches = [],\n\t\t\ti = 0,\n\t\t\tlength = elems.length,\n\t\t\tcallbackExpect = !invert;\n\n\t\t// Go through the array, only saving the items\n\t\t// that pass the validator function\n\t\tfor ( ; i < length; i++ ) {\n\t\t\tcallbackInverse = !callback( elems[ i ], i );\n\t\t\tif ( callbackInverse !== callbackExpect ) {\n\t\t\t\tmatches.push( elems[ i ] );\n\t\t\t}\n\t\t}\n\n\t\treturn matches;\n\t},\n\n\t// arg is for internal usage only\n\tmap: function( elems, callback, arg ) {\n\t\tvar length, value,\n\t\t\ti = 0,\n\t\t\tret = [];\n\n\t\t// Go through the array, translating each of the items to their new values\n\t\tif ( isArrayLike( elems ) ) {\n\t\t\tlength = elems.length;\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Go through every key on the object,\n\t\t} else {\n\t\t\tfor ( i in elems ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret.push( value );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Flatten any nested arrays\n\t\treturn flat( ret );\n\t},\n\n\t// A global GUID counter for objects\n\tguid: 1,\n\n\t// jQuery.support is not used in Core but other projects attach their\n\t// properties to it so it needs to exist.\n\tsupport: support\n} );\n\nif ( typeof Symbol === "function" ) {\n\tjQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];\n}\n\n// Populate the class2type map\njQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),\n\tfunction( _i, name ) {\n\t\tclass2type[ "[object " + name + "]" ] = name.toLowerCase();\n\t} );\n\nfunction isArrayLike( obj ) {\n\n\t// Support: real iOS 8.2 only (not reproducible in simulator)\n\t// `in` check used to prevent JIT error (gh-2145)\n\t// hasOwn isn\'t used here due to false negatives\n\t// regarding Nodelist length in IE\n\tvar length = !!obj && "length" in obj && obj.length,\n\t\ttype = toType( obj );\n\n\tif ( isFunction( obj ) || isWindow( obj ) ) {\n\t\treturn false;\n\t}\n\n\treturn type === "array" || length === 0 ||\n\t\ttypeof length === "number" && length > 0 && ( length - 1 ) in obj;\n}\n\n\nfunction nodeName( elem, name ) {\n\n\treturn elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n\n}\nvar pop = arr.pop;\n\n\nvar sort = arr.sort;\n\n\nvar splice = arr.splice;\n\n\nvar whitespace = "[\\\\x20\\\\t\\\\r\\\\n\\\\f]";\n\n\nvar rtrimCSS = new RegExp(\n\t"^" + whitespace + "+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)" + whitespace + "+$",\n\t"g"\n);\n\n\n\n\n// Note: an element does not contain itself\njQuery.contains = function( a, b ) {\n\tvar bup = b && b.parentNode;\n\n\treturn a === bup || !!( bup && bup.nodeType === 1 && (\n\n\t\t// Support: IE 9 - 11+\n\t\t// IE doesn\'t have `contains` on SVG.\n\t\ta.contains ?\n\t\t\ta.contains( bup ) :\n\t\t\ta.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16\n\t) );\n};\n\n\n\n\n// CSS string/identifier serialization\n// https://drafts.csswg.org/cssom/#common-serializing-idioms\nvar rcssescape = /([\\0-\\x1f\\x7f]|^-?\\d)|^-$|[^\\x80-\\uFFFF\\w-]/g;\n\nfunction fcssescape( ch, asCodePoint ) {\n\tif ( asCodePoint ) {\n\n\t\t// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER\n\t\tif ( ch === "\\0" ) {\n\t\t\treturn "\\uFFFD";\n\t\t}\n\n\t\t// Control characters and (dependent upon position) numbers get escaped as code points\n\t\treturn ch.slice( 0, -1 ) + "\\\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";\n\t}\n\n\t// Other potentially-special ASCII characters get backslash-escaped\n\treturn "\\\\" + ch;\n}\n\njQuery.escapeSelector = function( sel ) {\n\treturn ( sel + "" ).replace( rcssescape, fcssescape );\n};\n\n\n\n\nvar preferredDoc = document,\n\tpushNative = push;\n\n( function() {\n\nvar i,\n\tExpr,\n\toutermostContext,\n\tsortInput,\n\thasDuplicate,\n\tpush = pushNative,\n\n\t// Local document vars\n\tdocument,\n\tdocumentElement,\n\tdocumentIsHTML,\n\trbuggyQSA,\n\tmatches,\n\n\t// Instance-specific data\n\texpando = jQuery.expando,\n\tdirruns = 0,\n\tdone = 0,\n\tclassCache = createCache(),\n\ttokenCache = createCache(),\n\tcompilerCache = createCache(),\n\tnonnativeSelectorCache = createCache(),\n\tsortOrder = function( a, b ) {\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t}\n\t\treturn 0;\n\t},\n\n\tbooleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" +\n\t\t"loop|multiple|open|readonly|required|scoped",\n\n\t// Regular expressions\n\n\t// https://www.w3.org/TR/css-syntax-3/#ident-token-diagram\n\tidentifier = "(?:\\\\\\\\[\\\\da-fA-F]{1,6}" + whitespace +\n\t\t"?|\\\\\\\\[^\\\\r\\\\n\\\\f]|[\\\\w-]|[^\\0-\\\\x7f])+",\n\n\t// Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors\n\tattributes = "\\\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +\n\n\t\t// Operator (capture 2)\n\t\t"*([*^$|!~]?=)" + whitespace +\n\n\t\t// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"\n\t\t"*(?:\'((?:\\\\\\\\.|[^\\\\\\\\\'])*)\'|\\"((?:\\\\\\\\.|[^\\\\\\\\\\"])*)\\"|(" + identifier + "))|)" +\n\t\twhitespace + "*\\\\]",\n\n\tpseudos = ":(" + identifier + ")(?:\\\\((" +\n\n\t\t// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:\n\t\t// 1. quoted (capture 3; capture 4 or capture 5)\n\t\t"(\'((?:\\\\\\\\.|[^\\\\\\\\\'])*)\'|\\"((?:\\\\\\\\.|[^\\\\\\\\\\"])*)\\")|" +\n\n\t\t// 2. simple (capture 6)\n\t\t"((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|" + attributes + ")*)|" +\n\n\t\t// 3. anything else (capture 2)\n\t\t".*" +\n\t\t")\\\\)|)",\n\n\t// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n\trwhitespace = new RegExp( whitespace + "+", "g" ),\n\n\trcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),\n\trleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" +\n\t\twhitespace + "*" ),\n\trdescend = new RegExp( whitespace + "|>" ),\n\n\trpseudo = new RegExp( pseudos ),\n\tridentifier = new RegExp( "^" + identifier + "$" ),\n\n\tmatchExpr = {\n\t\tID: new RegExp( "^#(" + identifier + ")" ),\n\t\tCLASS: new RegExp( "^\\\\.(" + identifier + ")" ),\n\t\tTAG: new RegExp( "^(" + identifier + "|[*])" ),\n\t\tATTR: new RegExp( "^" + attributes ),\n\t\tPSEUDO: new RegExp( "^" + pseudos ),\n\t\tCHILD: new RegExp(\n\t\t\t"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(" +\n\t\t\t\twhitespace + "*(even|odd|(([+-]|)(\\\\d*)n|)" + whitespace + "*(?:([+-]|)" +\n\t\t\t\twhitespace + "*(\\\\d+)|))" + whitespace + "*\\\\)|)", "i" ),\n\t\tbool: new RegExp( "^(?:" + booleans + ")$", "i" ),\n\n\t\t// For use in libraries implementing .is()\n\t\t// We use this for POS matching in `select`\n\t\tneedsContext: new RegExp( "^" + whitespace +\n\t\t\t"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(" + whitespace +\n\t\t\t"*((?:-\\\\d)?\\\\d*)" + whitespace + "*\\\\)|)(?=[^-]|$)", "i" )\n\t},\n\n\trinputs = /^(?:input|select|textarea|button)$/i,\n\trheader = /^h\\d$/i,\n\n\t// Easily-parseable/retrievable ID or TAG or CLASS selectors\n\trquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,\n\n\trsibling = /[+~]/,\n\n\t// CSS escapes\n\t// https://www.w3.org/TR/CSS21/syndata.html#escaped-characters\n\trunescape = new RegExp( "\\\\\\\\[\\\\da-fA-F]{1,6}" + whitespace +\n\t\t"?|\\\\\\\\([^\\\\r\\\\n\\\\f])", "g" ),\n\tfunescape = function( escape, nonHex ) {\n\t\tvar high = "0x" + escape.slice( 1 ) - 0x10000;\n\n\t\tif ( nonHex ) {\n\n\t\t\t// Strip the backslash prefix from a non-hex escape sequence\n\t\t\treturn nonHex;\n\t\t}\n\n\t\t// Replace a hexadecimal escape sequence with the encoded Unicode code point\n\t\t// Support: IE <=11+\n\t\t// For values outside the Basic Multilingual Plane (BMP), manually construct a\n\t\t// surrogate pair\n\t\treturn high < 0 ?\n\t\t\tString.fromCharCode( high + 0x10000 ) :\n\t\t\tString.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );\n\t},\n\n\t// Used for iframes; see `setDocument`.\n\t// Support: IE 9 - 11+, Edge 12 - 18+\n\t// Removing the function wrapper causes a "Permission Denied"\n\t// error in IE/Edge.\n\tunloadHandler = function() {\n\t\tsetDocument();\n\t},\n\n\tinDisabledFieldset = addCombinator(\n\t\tfunction( elem ) {\n\t\t\treturn elem.disabled === true && nodeName( elem, "fieldset" );\n\t\t},\n\t\t{ dir: "parentNode", next: "legend" }\n\t);\n\n// Support: IE <=9 only\n// Accessing document.activeElement can throw unexpectedly\n// https://bugs.jquery.com/ticket/13393\nfunction safeActiveElement() {\n\ttry {\n\t\treturn document.activeElement;\n\t} catch ( err ) { }\n}\n\n// Optimize for push.apply( _, NodeList )\ntry {\n\tpush.apply(\n\t\t( arr = slice.call( preferredDoc.childNodes ) ),\n\t\tpreferredDoc.childNodes\n\t);\n\n\t// Support: Android <=4.0\n\t// Detect silently failing push.apply\n\t// eslint-disable-next-line no-unused-expressions\n\tarr[ preferredDoc.childNodes.length ].nodeType;\n} catch ( e ) {\n\tpush = {\n\t\tapply: function( target, els ) {\n\t\t\tpushNative.apply( target, slice.call( els ) );\n\t\t},\n\t\tcall: function( target ) {\n\t\t\tpushNative.apply( target, slice.call( arguments, 1 ) );\n\t\t}\n\t};\n}\n\nfunction find( selector, context, results, seed ) {\n\tvar m, i, elem, nid, match, groups, newSelector,\n\t\tnewContext = context && context.ownerDocument,\n\n\t\t// nodeType defaults to 9, since context defaults to document\n\t\tnodeType = context ? context.nodeType : 9;\n\n\tresults = results || [];\n\n\t// Return early from calls with invalid selector or context\n\tif ( typeof selector !== "string" || !selector ||\n\t\tnodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {\n\n\t\treturn results;\n\t}\n\n\t// Try to shortcut find operations (as opposed to filters) in HTML documents\n\tif ( !seed ) {\n\t\tsetDocument( context );\n\t\tcontext = context || document;\n\n\t\tif ( documentIsHTML ) {\n\n\t\t\t// If the selector is sufficiently simple, try using a "get*By*" DOM method\n\t\t\t// (excepting DocumentFragment context, where the methods don\'t exist)\n\t\t\tif ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {\n\n\t\t\t\t// ID selector\n\t\t\t\tif ( ( m = match[ 1 ] ) ) {\n\n\t\t\t\t\t// Document context\n\t\t\t\t\tif ( nodeType === 9 ) {\n\t\t\t\t\t\tif ( ( elem = context.getElementById( m ) ) ) {\n\n\t\t\t\t\t\t\t// Support: IE 9 only\n\t\t\t\t\t\t\t// getElementById can match elements by name instead of ID\n\t\t\t\t\t\t\tif ( elem.id === m ) {\n\t\t\t\t\t\t\t\tpush.call( results, elem );\n\t\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t// Element context\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// Support: IE 9 only\n\t\t\t\t\t\t// getElementById can match elements by name instead of ID\n\t\t\t\t\t\tif ( newContext && ( elem = newContext.getElementById( m ) ) &&\n\t\t\t\t\t\t\tfind.contains( context, elem ) &&\n\t\t\t\t\t\t\telem.id === m ) {\n\n\t\t\t\t\t\t\tpush.call( results, elem );\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t// Type selector\n\t\t\t\t} else if ( match[ 2 ] ) {\n\t\t\t\t\tpush.apply( results, context.getElementsByTagName( selector ) );\n\t\t\t\t\treturn results;\n\n\t\t\t\t// Class selector\n\t\t\t\t} else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) {\n\t\t\t\t\tpush.apply( results, context.getElementsByClassName( m ) );\n\t\t\t\t\treturn results;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Take advantage of querySelectorAll\n\t\t\tif ( !nonnativeSelectorCache[ selector + " " ] &&\n\t\t\t\t( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) {\n\n\t\t\t\tnewSelector = selector;\n\t\t\t\tnewContext = context;\n\n\t\t\t\t// qSA considers elements outside a scoping root when evaluating child or\n\t\t\t\t// descendant combinators, which is not what we want.\n\t\t\t\t// In such cases, we work around the behavior by prefixing every selector in the\n\t\t\t\t// list with an ID selector referencing the scope context.\n\t\t\t\t// The technique has to be used as well when a leading combinator is used\n\t\t\t\t// as such selectors are not recognized by querySelectorAll.\n\t\t\t\t// Thanks to Andrew Dupont for this technique.\n\t\t\t\tif ( nodeType === 1 &&\n\t\t\t\t\t( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) {\n\n\t\t\t\t\t// Expand context for sibling selectors\n\t\t\t\t\tnewContext = rsibling.test( selector ) && testContext( context.parentNode ) ||\n\t\t\t\t\t\tcontext;\n\n\t\t\t\t\t// We can use :scope instead of the ID hack if the browser\n\t\t\t\t\t// supports it & if we\'re not changing the context.\n\t\t\t\t\t// Support: IE 11+, Edge 17 - 18+\n\t\t\t\t\t// IE/Edge sometimes throw a "Permission denied" error when\n\t\t\t\t\t// strict-comparing two documents; shallow comparisons work.\n\t\t\t\t\t// eslint-disable-next-line eqeqeq\n\t\t\t\t\tif ( newContext != context || !support.scope ) {\n\n\t\t\t\t\t\t// Capture the context ID, setting it first if necessary\n\t\t\t\t\t\tif ( ( nid = context.getAttribute( "id" ) ) ) {\n\t\t\t\t\t\t\tnid = jQuery.escapeSelector( nid );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcontext.setAttribute( "id", ( nid = expando ) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prefix every selector in the list\n\t\t\t\t\tgroups = tokenize( selector );\n\t\t\t\t\ti = groups.length;\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tgroups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +\n\t\t\t\t\t\t\ttoSelector( groups[ i ] );\n\t\t\t\t\t}\n\t\t\t\t\tnewSelector = groups.join( "," );\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tpush.apply( results,\n\t\t\t\t\t\tnewContext.querySelectorAll( newSelector )\n\t\t\t\t\t);\n\t\t\t\t\treturn results;\n\t\t\t\t} catch ( qsaError ) {\n\t\t\t\t\tnonnativeSelectorCache( selector, true );\n\t\t\t\t} finally {\n\t\t\t\t\tif ( nid === expando ) {\n\t\t\t\t\t\tcontext.removeAttribute( "id" );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// All others\n\treturn select( selector.replace( rtrimCSS, "$1" ), context, results, seed );\n}\n\n/**\n * Create key-value caches of limited size\n * @returns {function(string, object)} Returns the Object data after storing it on itself with\n *\tproperty name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)\n *\tdeleting the oldest entry\n */\nfunction createCache() {\n\tvar keys = [];\n\n\tfunction cache( key, value ) {\n\n\t\t// Use (key + " ") to avoid collision with native prototype properties\n\t\t// (see https://github.com/jquery/sizzle/issues/157)\n\t\tif ( keys.push( key + " " ) > Expr.cacheLength ) {\n\n\t\t\t// Only keep the most recent entries\n\t\t\tdelete cache[ keys.shift() ];\n\t\t}\n\t\treturn ( cache[ key + " " ] = value );\n\t}\n\treturn cache;\n}\n\n/**\n * Mark a function for special use by jQuery selector module\n * @param {Function} fn The function to mark\n */\nfunction markFunction( fn ) {\n\tfn[ expando ] = true;\n\treturn fn;\n}\n\n/**\n * Support testing using an element\n * @param {Function} fn Passed the created element and returns a boolean result\n */\nfunction assert( fn ) {\n\tvar el = document.createElement( "fieldset" );\n\n\ttry {\n\t\treturn !!fn( el );\n\t} catch ( e ) {\n\t\treturn false;\n\t} finally {\n\n\t\t// Remove from its parent by default\n\t\tif ( el.parentNode ) {\n\t\t\tel.parentNode.removeChild( el );\n\t\t}\n\n\t\t// release memory in IE\n\t\tel = null;\n\t}\n}\n\n/**\n * Returns a function to use in pseudos for input types\n * @param {String} type\n */\nfunction createInputPseudo( type ) {\n\treturn function( elem ) {\n\t\treturn nodeName( elem, "input" ) && elem.type === type;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for buttons\n * @param {String} type\n */\nfunction createButtonPseudo( type ) {\n\treturn function( elem ) {\n\t\treturn ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&\n\t\t\telem.type === type;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for :enabled/:disabled\n * @param {Boolean} disabled true for :disabled; false for :enabled\n */\nfunction createDisabledPseudo( disabled ) {\n\n\t// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable\n\treturn function( elem ) {\n\n\t\t// Only certain elements can match :enabled or :disabled\n\t\t// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled\n\t\t// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled\n\t\tif ( "form" in elem ) {\n\n\t\t\t// Check for inherited disabledness on relevant non-disabled elements:\n\t\t\t// * listed form-associated elements in a disabled fieldset\n\t\t\t// https://html.spec.whatwg.org/multipage/forms.html#category-listed\n\t\t\t// https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled\n\t\t\t// * option elements in a disabled optgroup\n\t\t\t// https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled\n\t\t\t// All such elements have a "form" property.\n\t\t\tif ( elem.parentNode && elem.disabled === false ) {\n\n\t\t\t\t// Option elements defer to a parent optgroup if present\n\t\t\t\tif ( "label" in elem ) {\n\t\t\t\t\tif ( "label" in elem.parentNode ) {\n\t\t\t\t\t\treturn elem.parentNode.disabled === disabled;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn elem.disabled === disabled;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Support: IE 6 - 11+\n\t\t\t\t// Use the isDisabled shortcut property to check for disabled fieldset ancestors\n\t\t\t\treturn elem.isDisabled === disabled ||\n\n\t\t\t\t\t// Where there is no isDisabled, check manually\n\t\t\t\t\telem.isDisabled !== !disabled &&\n\t\t\t\t\t\tinDisabledFieldset( elem ) === disabled;\n\t\t\t}\n\n\t\t\treturn elem.disabled === disabled;\n\n\t\t// Try to winnow out elements that can\'t be disabled before trusting the disabled property.\n\t\t// Some victims get caught in our net (label, legend, menu, track), but it shouldn\'t\n\t\t// even exist on them, let alone have a boolean value.\n\t\t} else if ( "label" in elem ) {\n\t\t\treturn elem.disabled === disabled;\n\t\t}\n\n\t\t// Remaining elements are neither :enabled nor :disabled\n\t\treturn false;\n\t};\n}\n\n/**\n * Returns a function to use in pseudos for positionals\n * @param {Function} fn\n */\nfunction createPositionalPseudo( fn ) {\n\treturn markFunction( function( argument ) {\n\t\targument = +argument;\n\t\treturn markFunction( function( seed, matches ) {\n\t\t\tvar j,\n\t\t\t\tmatchIndexes = fn( [], seed.length, argument ),\n\t\t\t\ti = matchIndexes.length;\n\n\t\t\t// Match elements found at the specified indexes\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( seed[ ( j = matchIndexes[ i ] ) ] ) {\n\t\t\t\t\tseed[ j ] = !( matches[ j ] = seed[ j ] );\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t} );\n}\n\n/**\n * Checks a node for validity as a jQuery selector context\n * @param {Element|Object=} context\n * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value\n */\nfunction testContext( context ) {\n\treturn context && typeof context.getElementsByTagName !== "undefined" && context;\n}\n\n/**\n * Sets document-related variables once based on the current document\n * @param {Element|Object} [node] An element or document object to use to set the document\n * @returns {Object} Returns the current document\n */\nfunction setDocument( node ) {\n\tvar subWindow,\n\t\tdoc = node ? node.ownerDocument || node : preferredDoc;\n\n\t// Return early if doc is invalid or already selected\n\t// Support: IE 11+, Edge 17 - 18+\n\t// IE/Edge sometimes throw a "Permission denied" error when strict-comparing\n\t// two documents; shallow comparisons work.\n\t// eslint-disable-next-line eqeqeq\n\tif ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {\n\t\treturn document;\n\t}\n\n\t// Update global variables\n\tdocument = doc;\n\tdocumentElement = document.documentElement;\n\tdocumentIsHTML = !jQuery.isXMLDoc( document );\n\n\t// Support: iOS 7 only, IE 9 - 11+\n\t// Older browsers didn\'t support unprefixed `matches`.\n\tmatches = documentElement.matches ||\n\t\tdocumentElement.webkitMatchesSelector ||\n\t\tdocumentElement.msMatchesSelector;\n\n\t// Support: IE 9 - 11+, Edge 12 - 18+\n\t// Accessing iframe documents after unload throws "permission denied" errors\n\t// (see trac-13936).\n\t// Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`,\n\t// all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well.\n\tif ( documentElement.msMatchesSelector &&\n\n\t\t// Support: IE 11+, Edge 17 - 18+\n\t\t// IE/Edge sometimes throw a "Permission denied" error when strict-comparing\n\t\t// two documents; shallow comparisons work.\n\t\t// eslint-disable-next-line eqeqeq\n\t\tpreferredDoc != document &&\n\t\t( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {\n\n\t\t// Support: IE 9 - 11+, Edge 12 - 18+\n\t\tsubWindow.addEventListener( "unload", unloadHandler );\n\t}\n\n\t// Support: IE <10\n\t// Check if getElementById returns elements by name\n\t// The broken getElementById methods don\'t pick up programmatically-set names,\n\t// so use a roundabout getElementsByName test\n\tsupport.getById = assert( function( el ) {\n\t\tdocumentElement.appendChild( el ).id = jQuery.expando;\n\t\treturn !document.getElementsByName ||\n\t\t\t!document.getElementsByName( jQuery.expando ).length;\n\t} );\n\n\t// Support: IE 9 only\n\t// Check to see if it\'s possible to do matchesSelector\n\t// on a disconnected node.\n\tsupport.disconnectedMatch = assert( function( el ) {\n\t\treturn matches.call( el, "*" );\n\t} );\n\n\t// Support: IE 9 - 11+, Edge 12 - 18+\n\t// IE/Edge don\'t support the :scope pseudo-class.\n\tsupport.scope = assert( function() {\n\t\treturn document.querySelectorAll( ":scope" );\n\t} );\n\n\t// Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only\n\t// Make sure the `:has()` argument is parsed unforgivingly.\n\t// We include `*` in the test to detect buggy implementations that are\n\t// _selectively_ forgiving (specifically when the list includes at least\n\t// one valid selector).\n\t// Note that we treat complete lack of support for `:has()` as if it were\n\t// spec-compliant support, which is fine because use of `:has()` in such\n\t// environments will fail in the qSA path and fall back to jQuery traversal\n\t// anyway.\n\tsupport.cssHas = assert( function() {\n\t\ttry {\n\t\t\tdocument.querySelector( ":has(*,:jqfake)" );\n\t\t\treturn false;\n\t\t} catch ( e ) {\n\t\t\treturn true;\n\t\t}\n\t} );\n\n\t// ID filter and find\n\tif ( support.getById ) {\n\t\tExpr.filter.ID = function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\treturn elem.getAttribute( "id" ) === attrId;\n\t\t\t};\n\t\t};\n\t\tExpr.find.ID = function( id, context ) {\n\t\t\tif ( typeof context.getElementById !== "undefined" && documentIsHTML ) {\n\t\t\t\tvar elem = context.getElementById( id );\n\t\t\t\treturn elem ? [ elem ] : [];\n\t\t\t}\n\t\t};\n\t} else {\n\t\tExpr.filter.ID = function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\tvar node = typeof elem.getAttributeNode !== "undefined" &&\n\t\t\t\t\telem.getAttributeNode( "id" );\n\t\t\t\treturn node && node.value === attrId;\n\t\t\t};\n\t\t};\n\n\t\t// Support: IE 6 - 7 only\n\t\t// getElementById is not reliable as a find shortcut\n\t\tExpr.find.ID = function( id, context ) {\n\t\t\tif ( typeof context.getElementById !== "undefined" && documentIsHTML ) {\n\t\t\t\tvar node, i, elems,\n\t\t\t\t\telem = context.getElementById( id );\n\n\t\t\t\tif ( elem ) {\n\n\t\t\t\t\t// Verify the id attribute\n\t\t\t\t\tnode = elem.getAttributeNode( "id" );\n\t\t\t\t\tif ( node && node.value === id ) {\n\t\t\t\t\t\treturn [ elem ];\n\t\t\t\t\t}\n\n\t\t\t\t\t// Fall back on getElementsByName\n\t\t\t\t\telems = context.getElementsByName( id );\n\t\t\t\t\ti = 0;\n\t\t\t\t\twhile ( ( elem = elems[ i++ ] ) ) {\n\t\t\t\t\t\tnode = elem.getAttributeNode( "id" );\n\t\t\t\t\t\tif ( node && node.value === id ) {\n\t\t\t\t\t\t\treturn [ elem ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn [];\n\t\t\t}\n\t\t};\n\t}\n\n\t// Tag\n\tExpr.find.TAG = function( tag, context ) {\n\t\tif ( typeof context.getElementsByTagName !== "undefined" ) {\n\t\t\treturn context.getElementsByTagName( tag );\n\n\t\t// DocumentFragment nodes don\'t have gEBTN\n\t\t} else {\n\t\t\treturn context.querySelectorAll( tag );\n\t\t}\n\t};\n\n\t// Class\n\tExpr.find.CLASS = function( className, context ) {\n\t\tif ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {\n\t\t\treturn context.getElementsByClassName( className );\n\t\t}\n\t};\n\n\t/* QSA/matchesSelector\n\t---------------------------------------------------------------------- */\n\n\t// QSA and matchesSelector support\n\n\trbuggyQSA = [];\n\n\t// Build QSA regex\n\t// Regex strategy adopted from Diego Perini\n\tassert( function( el ) {\n\n\t\tvar input;\n\n\t\tdocumentElement.appendChild( el ).innerHTML =\n\t\t\t"<a id=\'" + expando + "\' href=\'\' disabled=\'disabled\'></a>" +\n\t\t\t"<select id=\'" + expando + "-\\r\\\\\' disabled=\'disabled\'>" +\n\t\t\t"<option selected=\'\'></option></select>";\n\n\t\t// Support: iOS <=7 - 8 only\n\t\t// Boolean attributes and "value" are not treated correctly in some XML documents\n\t\tif ( !el.querySelectorAll( "[selected]" ).length ) {\n\t\t\trbuggyQSA.push( "\\\\[" + whitespace + "*(?:value|" + booleans + ")" );\n\t\t}\n\n\t\t// Support: iOS <=7 - 8 only\n\t\tif ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {\n\t\t\trbuggyQSA.push( "~=" );\n\t\t}\n\n\t\t// Support: iOS 8 only\n\t\t// https://bugs.webkit.org/show_bug.cgi?id=136851\n\t\t// In-page `selector#id sibling-combinator selector` fails\n\t\tif ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {\n\t\t\trbuggyQSA.push( ".#.+[+~]" );\n\t\t}\n\n\t\t// Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+\n\t\t// In some of the document kinds, these selectors wouldn\'t work natively.\n\t\t// This is probably OK but for backwards compatibility we want to maintain\n\t\t// handling them through jQuery traversal in jQuery 3.x.\n\t\tif ( !el.querySelectorAll( ":checked" ).length ) {\n\t\t\trbuggyQSA.push( ":checked" );\n\t\t}\n\n\t\t// Support: Windows 8 Native Apps\n\t\t// The type and name attributes are restricted during .innerHTML assignment\n\t\tinput = document.createElement( "input" );\n\t\tinput.setAttribute( "type", "hidden" );\n\t\tel.appendChild( input ).setAttribute( "name", "D" );\n\n\t\t// Support: IE 9 - 11+\n\t\t// IE\'s :disabled selector does not pick up the children of disabled fieldsets\n\t\t// Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+\n\t\t// In some of the document kinds, these selectors wouldn\'t work natively.\n\t\t// This is probably OK but for backwards compatibility we want to maintain\n\t\t// handling them through jQuery traversal in jQuery 3.x.\n\t\tdocumentElement.appendChild( el ).disabled = true;\n\t\tif ( el.querySelectorAll( ":disabled" ).length !== 2 ) {\n\t\t\trbuggyQSA.push( ":enabled", ":disabled" );\n\t\t}\n\n\t\t// Support: IE 11+, Edge 15 - 18+\n\t\t// IE 11/Edge don\'t find elements on a `[name=\'\']` query in some cases.\n\t\t// Adding a temporary attribute to the document before the selection works\n\t\t// around the issue.\n\t\t// Interestingly, IE 10 & older don\'t seem to have the issue.\n\t\tinput = document.createElement( "input" );\n\t\tinput.setAttribute( "name", "" );\n\t\tel.appendChild( input );\n\t\tif ( !el.querySelectorAll( "[name=\'\']" ).length ) {\n\t\t\trbuggyQSA.push( "\\\\[" + whitespace + "*name" + whitespace + "*=" +\n\t\t\t\twhitespace + "*(?:\'\'|\\"\\")" );\n\t\t}\n\t} );\n\n\tif ( !support.cssHas ) {\n\n\t\t// Support: Chrome 105 - 110+, Safari 15.4 - 16.3+\n\t\t// Our regular `try-catch` mechanism fails to detect natively-unsupported\n\t\t// pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)\n\t\t// in browsers that parse the `:has()` argument as a forgiving selector list.\n\t\t// https://drafts.csswg.org/selectors/#relational now requires the argument\n\t\t// to be parsed unforgivingly, but browsers have not yet fully adjusted.\n\t\trbuggyQSA.push( ":has" );\n\t}\n\n\trbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );\n\n\t/* Sorting\n\t---------------------------------------------------------------------- */\n\n\t// Document order sorting\n\tsortOrder = function( a, b ) {\n\n\t\t// Flag for duplicate removal\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\n\t\t// Sort on method existence if only one input has compareDocumentPosition\n\t\tvar compare = !a.compareDocumentPosition - !b.compareDocumentPosition;\n\t\tif ( compare ) {\n\t\t\treturn compare;\n\t\t}\n\n\t\t// Calculate position if both inputs belong to the same document\n\t\t// Support: IE 11+, Edge 17 - 18+\n\t\t// IE/Edge sometimes throw a "Permission denied" error when strict-comparing\n\t\t// two documents; shallow comparisons work.\n\t\t// eslint-disable-next-line eqeqeq\n\t\tcompare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?\n\t\t\ta.compareDocumentPosition( b ) :\n\n\t\t\t// Otherwise we know they are disconnected\n\t\t\t1;\n\n\t\t// Disconnected nodes\n\t\tif ( compare & 1 ||\n\t\t\t( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {\n\n\t\t\t// Choose the first element that is related to our preferred document\n\t\t\t// Support: IE 11+, Edge 17 - 18+\n\t\t\t// IE/Edge sometimes throw a "Permission denied" error when strict-comparing\n\t\t\t// two documents; shallow comparisons work.\n\t\t\t// eslint-disable-next-line eqeqeq\n\t\t\tif ( a === document || a.ownerDocument == preferredDoc &&\n\t\t\t\tfind.contains( preferredDoc, a ) ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\t// Support: IE 11+, Edge 17 - 18+\n\t\t\t// IE/Edge sometimes throw a "Permission denied" error when strict-comparing\n\t\t\t// two documents; shallow comparisons work.\n\t\t\t// eslint-disable-next-line eqeqeq\n\t\t\tif ( b === document || b.ownerDocument == preferredDoc &&\n\t\t\t\tfind.contains( preferredDoc, b ) ) {\n\t\t\t\treturn 1;\n\t\t\t}\n\n\t\t\t// Maintain original order\n\t\t\treturn sortInput ?\n\t\t\t\t( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :\n\t\t\t\t0;\n\t\t}\n\n\t\treturn compare & 4 ? -1 : 1;\n\t};\n\n\treturn document;\n}\n\nfind.matches = function( expr, elements ) {\n\treturn find( expr, null, null, elements );\n};\n\nfind.matchesSelector = function( elem, expr ) {\n\tsetDocument( elem );\n\n\tif ( documentIsHTML &&\n\t\t!nonnativeSelectorCache[ expr + " " ] &&\n\t\t( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {\n\n\t\ttry {\n\t\t\tvar ret = matches.call( elem, expr );\n\n\t\t\t// IE 9\'s matchesSelector returns false on disconnected nodes\n\t\t\tif ( ret || support.disconnectedMatch ||\n\n\t\t\t\t\t// As well, disconnected nodes are said to be in a document\n\t\t\t\t\t// fragment in IE 9\n\t\t\t\t\telem.document && elem.document.nodeType !== 11 ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t} catch ( e ) {\n\t\t\tnonnativeSelectorCache( expr, true );\n\t\t}\n\t}\n\n\treturn find( expr, document, null, [ elem ] ).length > 0;\n};\n\nfind.contains = function( context, elem ) {\n\n\t// Set document vars if needed\n\t// Support: IE 11+, Edge 17 - 18+\n\t// IE/Edge sometimes throw a "Permission denied" error when strict-comparing\n\t// two documents; shallow comparisons work.\n\t// eslint-disable-next-line eqeqeq\n\tif ( ( context.ownerDocument || context ) != document ) {\n\t\tsetDocument( context );\n\t}\n\treturn jQuery.contains( context, elem );\n};\n\n\nfind.attr = function( elem, name ) {\n\n\t// Set document vars if needed\n\t// Support: IE 11+, Edge 17 - 18+\n\t// IE/Edge sometimes throw a "Permission denied" error when strict-comparing\n\t// two documents; shallow comparisons work.\n\t// eslint-disable-next-line eqeqeq\n\tif ( ( elem.ownerDocument || elem ) != document ) {\n\t\tsetDocument( elem );\n\t}\n\n\tvar fn = Expr.attrHandle[ name.toLowerCase() ],\n\n\t\t// Don\'t get fooled by Object.prototype properties (see trac-13807)\n\t\tval = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?\n\t\t\tfn( elem, name, !documentIsHTML ) :\n\t\t\tundefined;\n\n\tif ( val !== undefined ) {\n\t\treturn val;\n\t}\n\n\treturn elem.getAttribute( name );\n};\n\nfind.error = function( msg ) {\n\tthrow new Error( "Syntax error, unrecognized expression: " + msg );\n};\n\n/**\n * Document sorting and removing duplicates\n * @param {ArrayLike} results\n */\njQuery.uniqueSort = function( results ) {\n\tvar elem,\n\t\tduplicates = [],\n\t\tj = 0,\n\t\ti = 0;\n\n\t// Unless we *know* we can detect duplicates, assume their presence\n\t//\n\t// Support: Android <=4.0+\n\t// Testing for detecting duplicates is unpredictable so instead assume we can\'t\n\t// depend on duplicate detection in all browsers without a stable sort.\n\thasDuplicate = !support.sortStable;\n\tsortInput = !support.sortStable && slice.call( results, 0 );\n\tsort.call( results, sortOrder );\n\n\tif ( hasDuplicate ) {\n\t\twhile ( ( elem = results[ i++ ] ) ) {\n\t\t\tif ( elem === results[ i ] ) {\n\t\t\t\tj = duplicates.push( i );\n\t\t\t}\n\t\t}\n\t\twhile ( j-- ) {\n\t\t\tsplice.call( results, duplicates[ j ], 1 );\n\t\t}\n\t}\n\n\t// Clear input after sorting to release objects\n\t// See https://github.com/jquery/sizzle/pull/225\n\tsortInput = null;\n\n\treturn results;\n};\n\njQuery.fn.uniqueSort = function() {\n\treturn this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );\n};\n\nExpr = jQuery.expr = {\n\n\t// Can be adjusted by the user\n\tcacheLength: 50,\n\n\tcreatePseudo: markFunction,\n\n\tmatch: matchExpr,\n\n\tattrHandle: {},\n\n\tfind: {},\n\n\trelative: {\n\t\t">": { dir: "parentNode", first: true },\n\t\t" ": { dir: "parentNode" },\n\t\t"+": { dir: "previousSibling", first: true },\n\t\t"~": { dir: "previousSibling" }\n\t},\n\n\tpreFilter: {\n\t\tATTR: function( match ) {\n\t\t\tmatch[ 1 ] = match[ 1 ].replace( runescape, funescape );\n\n\t\t\t// Move the given value to match[3] whether quoted or unquoted\n\t\t\tmatch[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )\n\t\t\t\t.replace( runescape, funescape );\n\n\t\t\tif ( match[ 2 ] === "~=" ) {\n\t\t\t\tmatch[ 3 ] = " " + match[ 3 ] + " ";\n\t\t\t}\n\n\t\t\treturn match.slice( 0, 4 );\n\t\t},\n\n\t\tCHILD: function( match ) {\n\n\t\t\t/* matches from matchExpr["CHILD"]\n\t\t\t\t1 type (only|nth|...)\n\t\t\t\t2 what (child|of-type)\n\t\t\t\t3 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n\t\t\t\t4 xn-component of xn+y argument ([+-]?\\d*n|)\n\t\t\t\t5 sign of xn-component\n\t\t\t\t6 x of xn-component\n\t\t\t\t7 sign of y-component\n\t\t\t\t8 y of y-component\n\t\t\t*/\n\t\t\tmatch[ 1 ] = match[ 1 ].toLowerCase();\n\n\t\t\tif ( match[ 1 ].slice( 0, 3 ) === "nth" ) {\n\n\t\t\t\t// nth-* requires argument\n\t\t\t\tif ( !match[ 3 ] ) {\n\t\t\t\t\tfind.error( match[ 0 ] );\n\t\t\t\t}\n\n\t\t\t\t// numeric x and y parameters for Expr.filter.CHILD\n\t\t\t\t// remember that false/true cast respectively to 0/1\n\t\t\t\tmatch[ 4 ] = +( match[ 4 ] ?\n\t\t\t\t\tmatch[ 5 ] + ( match[ 6 ] || 1 ) :\n\t\t\t\t\t2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )\n\t\t\t\t);\n\t\t\t\tmatch[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );\n\n\t\t\t// other types prohibit arguments\n\t\t\t} else if ( match[ 3 ] ) {\n\t\t\t\tfind.error( match[ 0 ] );\n\t\t\t}\n\n\t\t\treturn match;\n\t\t},\n\n\t\tPSEUDO: function( match ) {\n\t\t\tvar excess,\n\t\t\t\tunquoted = !match[ 6 ] && match[ 2 ];\n\n\t\t\tif ( matchExpr.CHILD.test( match[ 0 ] ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Accept quoted arguments as-is\n\t\t\tif ( match[ 3 ] ) {\n\t\t\t\tmatch[ 2 ] = match[ 4 ] || match[ 5 ] || "";\n\n\t\t\t// Strip excess characters from unquoted arguments\n\t\t\t} else if ( unquoted && rpseudo.test( unquoted ) &&\n\n\t\t\t\t// Get excess from tokenize (recursively)\n\t\t\t\t( excess = tokenize( unquoted, true ) ) &&\n\n\t\t\t\t// advance to the next closing parenthesis\n\t\t\t\t( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {\n\n\t\t\t\t// excess is a negative index\n\t\t\t\tmatch[ 0 ] = match[ 0 ].slice( 0, excess );\n\t\t\t\tmatch[ 2 ] = unquoted.slice( 0, excess );\n\t\t\t}\n\n\t\t\t// Return only captures needed by the pseudo filter method (type and argument)\n\t\t\treturn match.slice( 0, 3 );\n\t\t}\n\t},\n\n\tfilter: {\n\n\t\tTAG: function( nodeNameSelector ) {\n\t\t\tvar expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn nodeNameSelector === "*" ?\n\t\t\t\tfunction() {\n\t\t\t\t\treturn true;\n\t\t\t\t} :\n\t\t\t\tfunction( elem ) {\n\t\t\t\t\treturn nodeName( elem, expectedNodeName );\n\t\t\t\t};\n\t\t},\n\n\t\tCLASS: function( className ) {\n\t\t\tvar pattern = classCache[ className + " " ];\n\n\t\t\treturn pattern ||\n\t\t\t\t( pattern = new RegExp( "(^|" + whitespace + ")" + className +\n\t\t\t\t\t"(" + whitespace + "|$)" ) ) &&\n\t\t\t\tclassCache( className, function( elem ) {\n\t\t\t\t\treturn pattern.test(\n\t\t\t\t\t\ttypeof elem.className === "string" && elem.className ||\n\t\t\t\t\t\t\ttypeof elem.getAttribute !== "undefined" &&\n\t\t\t\t\t\t\t\telem.getAttribute( "class" ) ||\n\t\t\t\t\t\t\t""\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t},\n\n\t\tATTR: function( name, operator, check ) {\n\t\t\treturn function( elem ) {\n\t\t\t\tvar result = find.attr( elem, name );\n\n\t\t\t\tif ( result == null ) {\n\t\t\t\t\treturn operator === "!=";\n\t\t\t\t}\n\t\t\t\tif ( !operator ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tresult += "";\n\n\t\t\t\tif ( operator === "=" ) {\n\t\t\t\t\treturn result === check;\n\t\t\t\t}\n\t\t\t\tif ( operator === "!=" ) {\n\t\t\t\t\treturn result !== check;\n\t\t\t\t}\n\t\t\t\tif ( operator === "^=" ) {\n\t\t\t\t\treturn check && result.indexOf( check ) === 0;\n\t\t\t\t}\n\t\t\t\tif ( operator === "*=" ) {\n\t\t\t\t\treturn check && result.indexOf( check ) > -1;\n\t\t\t\t}\n\t\t\t\tif ( operator === "$=" ) {\n\t\t\t\t\treturn check && result.slice( -check.length ) === check;\n\t\t\t\t}\n\t\t\t\tif ( operator === "~=" ) {\n\t\t\t\t\treturn ( " " + result.replace( rwhitespace, " " ) + " " )\n\t\t\t\t\t\t.indexOf( check ) > -1;\n\t\t\t\t}\n\t\t\t\tif ( operator === "|=" ) {\n\t\t\t\t\treturn result === check || result.slice( 0, check.length + 1 ) === check + "-";\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t};\n\t\t},\n\n\t\tCHILD: function( type, what, _argument, first, last ) {\n\t\t\tvar simple = type.slice( 0, 3 ) !== "nth",\n\t\t\t\tforward = type.slice( -4 ) !== "last",\n\t\t\t\tofType = what === "of-type";\n\n\t\t\treturn first === 1 && last === 0 ?\n\n\t\t\t\t// Shortcut for :nth-*(n)\n\t\t\t\tfunction( elem ) {\n\t\t\t\t\treturn !!elem.parentNode;\n\t\t\t\t} :\n\n\t\t\t\tfunction( elem, _context, xml ) {\n\t\t\t\t\tvar cache, outerCache, node, nodeIndex, start,\n\t\t\t\t\t\tdir = simple !== forward ? "nextSibling" : "previousSibling",\n\t\t\t\t\t\tparent = elem.parentNode,\n\t\t\t\t\t\tname = ofType && elem.nodeName.toLowerCase(),\n\t\t\t\t\t\tuseCache = !xml && !ofType,\n\t\t\t\t\t\tdiff = false;\n\n\t\t\t\t\tif ( parent ) {\n\n\t\t\t\t\t\t// :(first|last|only)-(child|of-type)\n\t\t\t\t\t\tif ( simple ) {\n\t\t\t\t\t\t\twhile ( dir ) {\n\t\t\t\t\t\t\t\tnode = elem;\n\t\t\t\t\t\t\t\twhile ( ( node = node[ dir ] ) ) {\n\t\t\t\t\t\t\t\t\tif ( ofType ?\n\t\t\t\t\t\t\t\t\t\tnodeName( node, name ) :\n\t\t\t\t\t\t\t\t\t\tnode.nodeType === 1 ) {\n\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// Reverse direction for :only-* (if we haven\'t yet done so)\n\t\t\t\t\t\t\t\tstart = dir = type === "only" && !start && "nextSibling";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart = [ forward ? parent.firstChild : parent.lastChild ];\n\n\t\t\t\t\t\t// non-xml :nth-child(...) stores cache data on `parent`\n\t\t\t\t\t\tif ( forward && useCache ) {\n\n\t\t\t\t\t\t\t// Seek `elem` from a previously-cached index\n\t\t\t\t\t\t\touterCache = parent[ expando ] || ( parent[ expando ] = {} );\n\t\t\t\t\t\t\tcache = outerCache[ type ] || [];\n\t\t\t\t\t\t\tnodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];\n\t\t\t\t\t\t\tdiff = nodeIndex && cache[ 2 ];\n\t\t\t\t\t\t\tnode = nodeIndex && parent.childNodes[ nodeIndex ];\n\n\t\t\t\t\t\t\twhile ( ( node = ++nodeIndex && node && node[ dir ] ||\n\n\t\t\t\t\t\t\t\t// Fallback to seeking `elem` from the start\n\t\t\t\t\t\t\t\t( diff = nodeIndex = 0 ) || start.pop() ) ) {\n\n\t\t\t\t\t\t\t\t// When found, cache indexes on `parent` and break\n\t\t\t\t\t\t\t\tif ( node.nodeType === 1 && ++diff && node === elem ) {\n\t\t\t\t\t\t\t\t\touterCache[ type ] = [ dirruns, nodeIndex, diff ];\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// Use previously-cached element index if available\n\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\touterCache = elem[ expando ] || ( elem[ expando ] = {} );\n\t\t\t\t\t\t\t\tcache = outerCache[ type ] || [];\n\t\t\t\t\t\t\t\tnodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];\n\t\t\t\t\t\t\t\tdiff = nodeIndex;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// xml :nth-child(...)\n\t\t\t\t\t\t\t// or :nth-last-child(...) or :nth(-last)?-of-type(...)\n\t\t\t\t\t\t\tif ( diff === false ) {\n\n\t\t\t\t\t\t\t\t// Use the same loop as above to seek `elem` from the start\n\t\t\t\t\t\t\t\twhile ( ( node = ++nodeIndex && node && node[ dir ] ||\n\t\t\t\t\t\t\t\t\t( diff = nodeIndex = 0 ) || start.pop() ) ) {\n\n\t\t\t\t\t\t\t\t\tif ( ( ofType ?\n\t\t\t\t\t\t\t\t\t\tnodeName( node, name ) :\n\t\t\t\t\t\t\t\t\t\tnode.nodeType === 1 ) &&\n\t\t\t\t\t\t\t\t\t\t++diff ) {\n\n\t\t\t\t\t\t\t\t\t\t// Cache the index of each encountered element\n\t\t\t\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\t\t\t\touterCache = node[ expando ] ||\n\t\t\t\t\t\t\t\t\t\t\t\t( node[ expando ] = {} );\n\t\t\t\t\t\t\t\t\t\t\touterCache[ type ] = [ dirruns, diff ];\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tif ( node === elem ) {\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Incorporate the offset, then check against cycle size\n\t\t\t\t\t\tdiff -= last;\n\t\t\t\t\t\treturn diff === first || ( diff % first === 0 && diff / first >= 0 );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t},\n\n\t\tPSEUDO: function( pseudo, argument ) {\n\n\t\t\t// pseudo-class names are case-insensitive\n\t\t\t// https://www.w3.org/TR/selectors/#pseudo-classes\n\t\t\t// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n\t\t\t// Remember that setFilters inherits from pseudos\n\t\t\tvar args,\n\t\t\t\tfn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||\n\t\t\t\t\tfind.error( "unsupported pseudo: " + pseudo );\n\n\t\t\t// The user may use createPseudo to indicate that\n\t\t\t// arguments are needed to create the filter function\n\t\t\t// just as jQuery does\n\t\t\tif ( fn[ expando ] ) {\n\t\t\t\treturn fn( argument );\n\t\t\t}\n\n\t\t\t// But maintain support for old signatures\n\t\t\tif ( fn.length > 1 ) {\n\t\t\t\targs = [ pseudo, pseudo, "", argument ];\n\t\t\t\treturn Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?\n\t\t\t\t\tmarkFunction( function( seed, matches ) {\n\t\t\t\t\t\tvar idx,\n\t\t\t\t\t\t\tmatched = fn( seed, argument ),\n\t\t\t\t\t\t\ti = matched.length;\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tidx = indexOf.call( seed, matched[ i ] );\n\t\t\t\t\t\t\tseed[ idx ] = !( matches[ idx ] = matched[ i ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t} ) :\n\t\t\t\t\tfunction( elem ) {\n\t\t\t\t\t\treturn fn( elem, 0, args );\n\t\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn fn;\n\t\t}\n\t},\n\n\tpseudos: {\n\n\t\t// Potentially complex pseudos\n\t\tnot: markFunction( function( selector ) {\n\n\t\t\t// Trim the selector passed to compile\n\t\t\t// to avoid treating leading and trailing\n\t\t\t// spaces as combinators\n\t\t\tvar input = [],\n\t\t\t\tresults = [],\n\t\t\t\tmatcher = compile( selector.replace( rtrimCSS, "$1" ) );\n\n\t\t\treturn matcher[ expando ] ?\n\t\t\t\tmarkFunction( function( seed, matches, _context, xml ) {\n\t\t\t\t\tvar elem,\n\t\t\t\t\t\tunmatched = matcher( seed, null, xml, [] ),\n\t\t\t\t\t\ti = seed.length;\n\n\t\t\t\t\t// Match elements unmatched by `matcher`\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( ( elem = unmatched[ i ] ) ) {\n\t\t\t\t\t\t\tseed[ i ] = !( matches[ i ] = elem );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} ) :\n\t\t\t\tfunction( elem, _context, xml ) {\n\t\t\t\t\tinput[ 0 ] = elem;\n\t\t\t\t\tmatcher( input, null, xml, results );\n\n\t\t\t\t\t// Don\'t keep the element\n\t\t\t\t\t// (see https://github.com/jquery/sizzle/issues/299)\n\t\t\t\t\tinput[ 0 ] = null;\n\t\t\t\t\treturn !results.pop();\n\t\t\t\t};\n\t\t} ),\n\n\t\thas: markFunction( function( selector ) {\n\t\t\treturn function( elem ) {\n\t\t\t\treturn find( selector, elem ).length > 0;\n\t\t\t};\n\t\t} ),\n\n\t\tcontains: markFunction( function( text ) {\n\t\t\ttext = text.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\treturn ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;\n\t\t\t};\n\t\t} ),\n\n\t\t// "Whether an element is represented by a :lang() selector\n\t\t// is based solely on the element\'s language value\n\t\t// being equal to the identifier C,\n\t\t// or beginning with the identifier C immediately followed by "-".\n\t\t// The matching of C against the element\'s language value is performed case-insensitively.\n\t\t// The identifier C does not have to be a valid language name."\n\t\t// https://www.w3.org/TR/selectors/#lang-pseudo\n\t\tlang: markFunction( function( lang ) {\n\n\t\t\t// lang value must be a valid identifier\n\t\t\tif ( !ridentifier.test( lang || "" ) ) {\n\t\t\t\tfind.error( "unsupported lang: " + lang );\n\t\t\t}\n\t\t\tlang = lang.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn function( elem ) {\n\t\t\t\tvar elemLang;\n\t\t\t\tdo {\n\t\t\t\t\tif ( ( elemLang = documentIsHTML ?\n\t\t\t\t\t\telem.lang :\n\t\t\t\t\t\telem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {\n\n\t\t\t\t\t\telemLang = elemLang.toLowerCase();\n\t\t\t\t\t\treturn elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;\n\t\t\t\t\t}\n\t\t\t\t} while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );\n\t\t\t\treturn false;\n\t\t\t};\n\t\t} ),\n\n\t\t// Miscellaneous\n\t\ttarget: function( elem ) {\n\t\t\tvar hash = window.location && window.location.hash;\n\t\t\treturn hash && hash.slice( 1 ) === elem.id;\n\t\t},\n\n\t\troot: function( elem ) {\n\t\t\treturn elem === documentElement;\n\t\t},\n\n\t\tfocus: function( elem ) {\n\t\t\treturn elem === safeActiveElement() &&\n\t\t\t\tdocument.hasFocus() &&\n\t\t\t\t!!( elem.type || elem.href || ~elem.tabIndex );\n\t\t},\n\n\t\t// Boolean properties\n\t\tenabled: createDisabledPseudo( false ),\n\t\tdisabled: createDisabledPseudo( true ),\n\n\t\tchecked: function( elem ) {\n\n\t\t\t// In CSS3, :checked should return both checked and selected elements\n\t\t\t// https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\treturn ( nodeName( elem, "input" ) && !!elem.checked ) ||\n\t\t\t\t( nodeName( elem, "option" ) && !!elem.selected );\n\t\t},\n\n\t\tselected: function( elem ) {\n\n\t\t\t// Support: IE <=11+\n\t\t\t// Accessing the selectedIndex property\n\t\t\t// forces the browser to treat the default option as\n\t\t\t// selected when in an optgroup.\n\t\t\tif ( elem.parentNode ) {\n\t\t\t\t// eslint-disable-next-line no-unused-expressions\n\t\t\t\telem.parentNode.selectedIndex;\n\t\t\t}\n\n\t\t\treturn elem.selected === true;\n\t\t},\n\n\t\t// Contents\n\t\tempty: function( elem ) {\n\n\t\t\t// https://www.w3.org/TR/selectors/#empty-pseudo\n\t\t\t// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),\n\t\t\t// but not by others (comment: 8; processing instruction: 7; etc.)\n\t\t\t// nodeType < 6 works because attributes (2) do not appear as children\n\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\tif ( elem.nodeType < 6 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\n\t\tparent: function( elem ) {\n\t\t\treturn !Expr.pseudos.empty( elem );\n\t\t},\n\n\t\t// Element/input types\n\t\theader: function( elem ) {\n\t\t\treturn rheader.test( elem.nodeName );\n\t\t},\n\n\t\tinput: function( elem ) {\n\t\t\treturn rinputs.test( elem.nodeName );\n\t\t},\n\n\t\tbutton: function( elem ) {\n\t\t\treturn nodeName( elem, "input" ) && elem.type === "button" ||\n\t\t\t\tnodeName( elem, "button" );\n\t\t},\n\n\t\ttext: function( elem ) {\n\t\t\tvar attr;\n\t\t\treturn nodeName( elem, "input" ) && elem.type === "text" &&\n\n\t\t\t\t// Support: IE <10 only\n\t\t\t\t// New HTML5 attribute values (e.g., "search") appear\n\t\t\t\t// with elem.type === "text"\n\t\t\t\t( ( attr = elem.getAttribute( "type" ) ) == null ||\n\t\t\t\t\tattr.toLowerCase() === "text" );\n\t\t},\n\n\t\t// Position-in-collection\n\t\tfirst: createPositionalPseudo( function() {\n\t\t\treturn [ 0 ];\n\t\t} ),\n\n\t\tlast: createPositionalPseudo( function( _matchIndexes, length ) {\n\t\t\treturn [ length - 1 ];\n\t\t} ),\n\n\t\teq: createPositionalPseudo( function( _matchIndexes, length, argument ) {\n\t\t\treturn [ argument < 0 ? argument + length : argument ];\n\t\t} ),\n\n\t\teven: createPositionalPseudo( function( matchIndexes, length ) {\n\t\t\tvar i = 0;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t} ),\n\n\t\todd: createPositionalPseudo( function( matchIndexes, length ) {\n\t\t\tvar i = 1;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t} ),\n\n\t\tlt: createPositionalPseudo( function( matchIndexes, length, argument ) {\n\t\t\tvar i;\n\n\t\t\tif ( argument < 0 ) {\n\t\t\t\ti = argument + length;\n\t\t\t} else if ( argument > length ) {\n\t\t\t\ti = length;\n\t\t\t} else {\n\t\t\t\ti = argument;\n\t\t\t}\n\n\t\t\tfor ( ; --i >= 0; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t} ),\n\n\t\tgt: createPositionalPseudo( function( matchIndexes, length, argument ) {\n\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\tfor ( ; ++i < length; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t} )\n\t}\n};\n\nExpr.pseudos.nth = Expr.pseudos.eq;\n\n// Add button/input type pseudos\nfor ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {\n\tExpr.pseudos[ i ] = createInputPseudo( i );\n}\nfor ( i in { submit: true, reset: true } ) {\n\tExpr.pseudos[ i ] = createButtonPseudo( i );\n}\n\n// Easy API for creating new setFilters\nfunction setFilters() {}\nsetFilters.prototype = Expr.filters = Expr.pseudos;\nExpr.setFilters = new setFilters();\n\nfunction tokenize( selector, parseOnly ) {\n\tvar matched, match, tokens, type,\n\t\tsoFar, groups, preFilters,\n\t\tcached = tokenCache[ selector + " " ];\n\n\tif ( cached ) {\n\t\treturn parseOnly ? 0 : cached.slice( 0 );\n\t}\n\n\tsoFar = selector;\n\tgroups = [];\n\tpreFilters = Expr.preFilter;\n\n\twhile ( soFar ) {\n\n\t\t// Comma and first run\n\t\tif ( !matched || ( match = rcomma.exec( soFar ) ) ) {\n\t\t\tif ( match ) {\n\n\t\t\t\t// Don\'t consume trailing commas as valid\n\t\t\t\tsoFar = soFar.slice( match[ 0 ].length ) || soFar;\n\t\t\t}\n\t\t\tgroups.push( ( tokens = [] ) );\n\t\t}\n\n\t\tmatched = false;\n\n\t\t// Combinators\n\t\tif ( ( match = rleadingCombinator.exec( soFar ) ) ) {\n\t\t\tmatched = match.shift();\n\t\t\ttokens.push( {\n\t\t\t\tvalue: matched,\n\n\t\t\t\t// Cast descendant combinators to space\n\t\t\t\ttype: match[ 0 ].replace( rtrimCSS, " " )\n\t\t\t} );\n\t\t\tsoFar = soFar.slice( matched.length );\n\t\t}\n\n\t\t// Filters\n\t\tfor ( type in Expr.filter ) {\n\t\t\tif ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||\n\t\t\t\t( match = preFilters[ type ]( match ) ) ) ) {\n\t\t\t\tmatched = match.shift();\n\t\t\t\ttokens.push( {\n\t\t\t\t\tvalue: matched,\n\t\t\t\t\ttype: type,\n\t\t\t\t\tmatches: match\n\t\t\t\t} );\n\t\t\t\tsoFar = soFar.slice( matched.length );\n\t\t\t}\n\t\t}\n\n\t\tif ( !matched ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Return the length of the invalid excess\n\t// if we\'re just parsing\n\t// Otherwise, throw an error or return tokens\n\tif ( parseOnly ) {\n\t\treturn soFar.length;\n\t}\n\n\treturn soFar ?\n\t\tfind.error( selector ) :\n\n\t\t// Cache the tokens\n\t\ttokenCache( selector, groups ).slice( 0 );\n}\n\nfunction toSelector( tokens ) {\n\tvar i = 0,\n\t\tlen = tokens.length,\n\t\tselector = "";\n\tfor ( ; i < len; i++ ) {\n\t\tselector += tokens[ i ].value;\n\t}\n\treturn selector;\n}\n\nfunction addCombinator( matcher, combinator, base ) {\n\tvar dir = combinator.dir,\n\t\tskip = combinator.next,\n\t\tkey = skip || dir,\n\t\tcheckNonElements = base && key === "parentNode",\n\t\tdoneName = done++;\n\n\treturn combinator.first ?\n\n\t\t// Check against closest ancestor/preceding element\n\t\tfunction( elem, context, xml ) {\n\t\t\twhile ( ( elem = elem[ dir ] ) ) {\n\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\treturn matcher( elem, context, xml );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t} :\n\n\t\t// Check against all ancestor/preceding elements\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar oldCache, outerCache,\n\t\t\t\tnewCache = [ dirruns, doneName ];\n\n\t\t\t// We can\'t set arbitrary data on XML nodes, so they don\'t benefit from combinator caching\n\t\t\tif ( xml ) {\n\t\t\t\twhile ( ( elem = elem[ dir ] ) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\twhile ( ( elem = elem[ dir ] ) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\touterCache = elem[ expando ] || ( elem[ expando ] = {} );\n\n\t\t\t\t\t\tif ( skip && nodeName( elem, skip ) ) {\n\t\t\t\t\t\t\telem = elem[ dir ] || elem;\n\t\t\t\t\t\t} else if ( ( oldCache = outerCache[ key ] ) &&\n\t\t\t\t\t\t\toldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {\n\n\t\t\t\t\t\t\t// Assign to newCache so results back-propagate to previous elements\n\t\t\t\t\t\t\treturn ( newCache[ 2 ] = oldCache[ 2 ] );\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// Reuse newcache so results back-propagate to previous elements\n\t\t\t\t\t\t\touterCache[ key ] = newCache;\n\n\t\t\t\t\t\t\t// A match means we\'re done; a fail means we have to keep checking\n\t\t\t\t\t\t\tif ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n}\n\nfunction elementMatcher( matchers ) {\n\treturn matchers.length > 1 ?\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar i = matchers.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( !matchers[ i ]( elem, context, xml ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} :\n\t\tmatchers[ 0 ];\n}\n\nfunction multipleContexts( selector, contexts, results ) {\n\tvar i = 0,\n\t\tlen = contexts.length;\n\tfor ( ; i < len; i++ ) {\n\t\tfind( selector, contexts[ i ], results );\n\t}\n\treturn results;\n}\n\nfunction condense( unmatched, map, filter, context, xml ) {\n\tvar elem,\n\t\tnewUnmatched = [],\n\t\ti = 0,\n\t\tlen = unmatched.length,\n\t\tmapped = map != null;\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( ( elem = unmatched[ i ] ) ) {\n\t\t\tif ( !filter || filter( elem, context, xml ) ) {\n\t\t\t\tnewUnmatched.push( elem );\n\t\t\t\tif ( mapped ) {\n\t\t\t\t\tmap.push( i );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn newUnmatched;\n}\n\nfunction setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {\n\tif ( postFilter && !postFilter[ expando ] ) {\n\t\tpostFilter = setMatcher( postFilter );\n\t}\n\tif ( postFinder && !postFinder[ expando ] ) {\n\t\tpostFinder = setMatcher( postFinder, postSelector );\n\t}\n\treturn markFunction( function( seed, results, context, xml ) {\n\t\tvar temp, i, elem, matcherOut,\n\t\t\tpreMap = [],\n\t\t\tpostMap = [],\n\t\t\tpreexisting = results.length,\n\n\t\t\t// Get initial elements from seed or context\n\t\t\telems = seed ||\n\t\t\t\tmultipleContexts( selector || "*",\n\t\t\t\t\tcontext.nodeType ? [ context ] : context, [] ),\n\n\t\t\t// Prefilter to get matcher input, preserving a map for seed-results synchronization\n\t\t\tmatcherIn = preFilter && ( seed || !selector ) ?\n\t\t\t\tcondense( elems, preMap, preFilter, context, xml ) :\n\t\t\t\telems;\n\n\t\tif ( matcher ) {\n\n\t\t\t// If we have a postFinder, or filtered seed, or non-seed postFilter\n\t\t\t// or preexisting results,\n\t\t\tmatcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?\n\n\t\t\t\t// ...intermediate processing is necessary\n\t\t\t\t[] :\n\n\t\t\t\t// ...otherwise use results directly\n\t\t\t\tresults;\n\n\t\t\t// Find primary matches\n\t\t\tmatcher( matcherIn, matcherOut, context, xml );\n\t\t} else {\n\t\t\tmatcherOut = matcherIn;\n\t\t}\n\n\t\t// Apply postFilter\n\t\tif ( postFilter ) {\n\t\t\ttemp = condense( matcherOut, postMap );\n\t\t\tpostFilter( temp, [], context, xml );\n\n\t\t\t// Un-match failing elements by moving them back to matcherIn\n\t\t\ti = temp.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( ( elem = temp[ i ] ) ) {\n\t\t\t\t\tmatcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( seed ) {\n\t\t\tif ( postFinder || preFilter ) {\n\t\t\t\tif ( postFinder ) {\n\n\t\t\t\t\t// Get the final matcherOut by condensing this intermediate into postFinder contexts\n\t\t\t\t\ttemp = [];\n\t\t\t\t\ti = matcherOut.length;\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( ( elem = matcherOut[ i ] ) ) {\n\n\t\t\t\t\t\t\t// Restore matcherIn since elem is not yet a final match\n\t\t\t\t\t\t\ttemp.push( ( matcherIn[ i ] = elem ) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tpostFinder( null, ( matcherOut = [] ), temp, xml );\n\t\t\t\t}\n\n\t\t\t\t// Move matched elements from seed to results to keep them synchronized\n\t\t\t\ti = matcherOut.length;\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tif ( ( elem = matcherOut[ i ] ) &&\n\t\t\t\t\t\t( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {\n\n\t\t\t\t\t\tseed[ temp ] = !( results[ temp ] = elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Add elements to results, through postFinder if defined\n\t\t} else {\n\t\t\tmatcherOut = condense(\n\t\t\t\tmatcherOut === results ?\n\t\t\t\t\tmatcherOut.splice( preexisting, matcherOut.length ) :\n\t\t\t\t\tmatcherOut\n\t\t\t);\n\t\t\tif ( postFinder ) {\n\t\t\t\tpostFinder( null, results, matcherOut, xml );\n\t\t\t} else {\n\t\t\t\tpush.apply( results, matcherOut );\n\t\t\t}\n\t\t}\n\t} );\n}\n\nfunction matcherFromTokens( tokens ) {\n\tvar checkContext, matcher, j,\n\t\tlen = tokens.length,\n\t\tleadingRelative = Expr.relative[ tokens[ 0 ].type ],\n\t\timplicitRelative = leadingRelative || Expr.relative[ " " ],\n\t\ti = leadingRelative ? 1 : 0,\n\n\t\t// The foundational matcher ensures that elements are reachable from top-level context(s)\n\t\tmatchContext = addCombinator( function( elem ) {\n\t\t\treturn elem === checkContext;\n\t\t}, implicitRelative, true ),\n\t\tmatchAnyContext = addCombinator( function( elem ) {\n\t\t\treturn indexOf.call( checkContext, elem ) > -1;\n\t\t}, implicitRelative, true ),\n\t\tmatchers = [ function( elem, context, xml ) {\n\n\t\t\t// Support: IE 11+, Edge 17 - 18+\n\t\t\t// IE/Edge sometimes throw a "Permission denied" error when strict-comparing\n\t\t\t// two documents; shallow comparisons work.\n\t\t\t// eslint-disable-next-line eqeqeq\n\t\t\tvar ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || (\n\t\t\t\t( checkContext = context ).nodeType ?\n\t\t\t\t\tmatchContext( elem, context, xml ) :\n\t\t\t\t\tmatchAnyContext( elem, context, xml ) );\n\n\t\t\t// Avoid hanging onto element\n\t\t\t// (see https://github.com/jquery/sizzle/issues/299)\n\t\t\tcheckContext = null;\n\t\t\treturn ret;\n\t\t} ];\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {\n\t\t\tmatchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];\n\t\t} else {\n\t\t\tmatcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );\n\n\t\t\t// Return special upon seeing a positional matcher\n\t\t\tif ( matcher[ expando ] ) {\n\n\t\t\t\t// Find the next relative operator (if any) for proper handling\n\t\t\t\tj = ++i;\n\t\t\t\tfor ( ; j < len; j++ ) {\n\t\t\t\t\tif ( Expr.relative[ tokens[ j ].type ] ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn setMatcher(\n\t\t\t\t\ti > 1 && elementMatcher( matchers ),\n\t\t\t\t\ti > 1 && toSelector(\n\n\t\t\t\t\t\t// If the preceding token was a descendant combinator, insert an implicit any-element `*`\n\t\t\t\t\t\ttokens.slice( 0, i - 1 )\n\t\t\t\t\t\t\t.concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )\n\t\t\t\t\t).replace( rtrimCSS, "$1" ),\n\t\t\t\t\tmatcher,\n\t\t\t\t\ti < j && matcherFromTokens( tokens.slice( i, j ) ),\n\t\t\t\t\tj < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),\n\t\t\t\t\tj < len && toSelector( tokens )\n\t\t\t\t);\n\t\t\t}\n\t\t\tmatchers.push( matcher );\n\t\t}\n\t}\n\n\treturn elementMatcher( matchers );\n}\n\nfunction matcherFromGroupMatchers( elementMatchers, setMatchers ) {\n\tvar bySet = setMatchers.length > 0,\n\t\tbyElement = elementMatchers.length > 0,\n\t\tsuperMatcher = function( seed, context, xml, results, outermost ) {\n\t\t\tvar elem, j, matcher,\n\t\t\t\tmatchedCount = 0,\n\t\t\t\ti = "0",\n\t\t\t\tunmatched = seed && [],\n\t\t\t\tsetMatched = [],\n\t\t\t\tcontextBackup = outermostContext,\n\n\t\t\t\t// We must always have either seed elements or outermost context\n\t\t\t\telems = seed || byElement && Expr.find.TAG( "*", outermost ),\n\n\t\t\t\t// Use integer dirruns iff this is the outermost matcher\n\t\t\t\tdirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),\n\t\t\t\tlen = elems.length;\n\n\t\t\tif ( outermost ) {\n\n\t\t\t\t// Support: IE 11+, Edge 17 - 18+\n\t\t\t\t// IE/Edge sometimes throw a "Permission denied" error when strict-comparing\n\t\t\t\t// two documents; shallow comparisons work.\n\t\t\t\t// eslint-disable-next-line eqeqeq\n\t\t\t\toutermostContext = context == document || context || outermost;\n\t\t\t}\n\n\t\t\t// Add elements passing elementMatchers directly to results\n\t\t\t// Support: iOS <=7 - 9 only\n\t\t\t// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching\n\t\t\t// elements by id. (see trac-14142)\n\t\t\tfor ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {\n\t\t\t\tif ( byElement && elem ) {\n\t\t\t\t\tj = 0;\n\n\t\t\t\t\t// Support: IE 11+, Edge 17 - 18+\n\t\t\t\t\t// IE/Edge sometimes throw a "Permission denied" error when strict-comparing\n\t\t\t\t\t// two documents; shallow comparisons work.\n\t\t\t\t\t// eslint-disable-next-line eqeqeq\n\t\t\t\t\tif ( !context && elem.ownerDocument != document ) {\n\t\t\t\t\t\tsetDocument( elem );\n\t\t\t\t\t\txml = !documentIsHTML;\n\t\t\t\t\t}\n\t\t\t\t\twhile ( ( matcher = elementMatchers[ j++ ] ) ) {\n\t\t\t\t\t\tif ( matcher( elem, context || document, xml ) ) {\n\t\t\t\t\t\t\tpush.call( results, elem );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( outermost ) {\n\t\t\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Track unmatched elements for set filters\n\t\t\t\tif ( bySet ) {\n\n\t\t\t\t\t// They will have gone through all possible matchers\n\t\t\t\t\tif ( ( elem = !matcher && elem ) ) {\n\t\t\t\t\t\tmatchedCount--;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Lengthen the array for every element, matched or not\n\t\t\t\t\tif ( seed ) {\n\t\t\t\t\t\tunmatched.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// `i` is now the count of elements visited above, and adding it to `matchedCount`\n\t\t\t// makes the latter nonnegative.\n\t\t\tmatchedCount += i;\n\n\t\t\t// Apply set filters to unmatched elements\n\t\t\t// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`\n\t\t\t// equals `i`), unless we didn\'t visit _any_ elements in the above loop because we have\n\t\t\t// no element matchers and no seed.\n\t\t\t// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that\n\t\t\t// case, which will result in a "00" `matchedCount` that differs from `i` but is also\n\t\t\t// numerically zero.\n\t\t\tif ( bySet && i !== matchedCount ) {\n\t\t\t\tj = 0;\n\t\t\t\twhile ( ( matcher = setMatchers[ j++ ] ) ) {\n\t\t\t\t\tmatcher( unmatched, setMatched, context, xml );\n\t\t\t\t}\n\n\t\t\t\tif ( seed ) {\n\n\t\t\t\t\t// Reintegrate element matches to eliminate the need for sorting\n\t\t\t\t\tif ( matchedCount > 0 ) {\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tif ( !( unmatched[ i ] || setMatched[ i ] ) ) {\n\t\t\t\t\t\t\t\tsetMatched[ i ] = pop.call( results );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Discard index placeholder values to get only actual matches\n\t\t\t\t\tsetMatched = condense( setMatched );\n\t\t\t\t}\n\n\t\t\t\t// Add matches to results\n\t\t\t\tpush.apply( results, setMatched );\n\n\t\t\t\t// Seedless set matches succeeding multiple successful matchers stipulate sorting\n\t\t\t\tif ( outermost && !seed && setMatched.length > 0 &&\n\t\t\t\t\t( matchedCount + setMatchers.length ) > 1 ) {\n\n\t\t\t\t\tjQuery.uniqueSort( results );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Override manipulation of globals by nested matchers\n\t\t\tif ( outermost ) {\n\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\toutermostContext = contextBackup;\n\t\t\t}\n\n\t\t\treturn unmatched;\n\t\t};\n\n\treturn bySet ?\n\t\tmarkFunction( superMatcher ) :\n\t\tsuperMatcher;\n}\n\nfunction compile( selector, match /* Internal Use Only */ ) {\n\tvar i,\n\t\tsetMatchers = [],\n\t\telementMatchers = [],\n\t\tcached = compilerCache[ selector + " " ];\n\n\tif ( !cached ) {\n\n\t\t// Generate a function of recursive functions that can be used to check each element\n\t\tif ( !match ) {\n\t\t\tmatch = tokenize( selector );\n\t\t}\n\t\ti = match.length;\n\t\twhile ( i-- ) {\n\t\t\tcached = matcherFromTokens( match[ i ] );\n\t\t\tif ( cached[ expando ] ) {\n\t\t\t\tsetMatchers.push( cached );\n\t\t\t} else {\n\t\t\t\telementMatchers.push( cached );\n\t\t\t}\n\t\t}\n\n\t\t// Cache the compiled function\n\t\tcached = compilerCache( selector,\n\t\t\tmatcherFromGroupMatchers( elementMatchers, setMatchers ) );\n\n\t\t// Save selector and tokenization\n\t\tcached.selector = selector;\n\t}\n\treturn cached;\n}\n\n/**\n * A low-level selection function that works with jQuery\'s compiled\n * selector functions\n * @param {String|Function} selector A selector or a pre-compiled\n * selector function built with jQuery selector compile\n * @param {Element} context\n * @param {Array} [results]\n * @param {Array} [seed] A set of elements to match against\n */\nfunction select( selector, context, results, seed ) {\n\tvar i, tokens, token, type, find,\n\t\tcompiled = typeof selector === "function" && selector,\n\t\tmatch = !seed && tokenize( ( selector = compiled.selector || selector ) );\n\n\tresults = results || [];\n\n\t// Try to minimize operations if there is only one selector in the list and no seed\n\t// (the latter of which guarantees us context)\n\tif ( match.length === 1 ) {\n\n\t\t// Reduce context if the leading compound selector is an ID\n\t\ttokens = match[ 0 ] = match[ 0 ].slice( 0 );\n\t\tif ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&\n\t\t\t\tcontext.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {\n\n\t\t\tcontext = ( Expr.find.ID(\n\t\t\t\ttoken.matches[ 0 ].replace( runescape, funescape ),\n\t\t\t\tcontext\n\t\t\t) || [] )[ 0 ];\n\t\t\tif ( !context ) {\n\t\t\t\treturn results;\n\n\t\t\t// Precompiled matchers will still verify ancestry, so step up a level\n\t\t\t} else if ( compiled ) {\n\t\t\t\tcontext = context.parentNode;\n\t\t\t}\n\n\t\t\tselector = selector.slice( tokens.shift().value.length );\n\t\t}\n\n\t\t// Fetch a seed set for right-to-left matching\n\t\ti = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;\n\t\twhile ( i-- ) {\n\t\t\ttoken = tokens[ i ];\n\n\t\t\t// Abort if we hit a combinator\n\t\t\tif ( Expr.relative[ ( type = token.type ) ] ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( ( find = Expr.find[ type ] ) ) {\n\n\t\t\t\t// Search, expanding context for leading sibling combinators\n\t\t\t\tif ( ( seed = find(\n\t\t\t\t\ttoken.matches[ 0 ].replace( runescape, funescape ),\n\t\t\t\t\trsibling.test( tokens[ 0 ].type ) &&\n\t\t\t\t\t\ttestContext( context.parentNode ) || context\n\t\t\t\t) ) ) {\n\n\t\t\t\t\t// If seed is empty or no tokens remain, we can return early\n\t\t\t\t\ttokens.splice( i, 1 );\n\t\t\t\t\tselector = seed.length && toSelector( tokens );\n\t\t\t\t\tif ( !selector ) {\n\t\t\t\t\t\tpush.apply( results, seed );\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Compile and execute a filtering function if one is not provided\n\t// Provide `match` to avoid retokenization if we modified the selector above\n\t( compiled || compile( selector, match ) )(\n\t\tseed,\n\t\tcontext,\n\t\t!documentIsHTML,\n\t\tresults,\n\t\t!context || rsibling.test( selector ) && testContext( context.parentNode ) || context\n\t);\n\treturn results;\n}\n\n// One-time assignments\n\n// Support: Android <=4.0 - 4.1+\n// Sort stability\nsupport.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;\n\n// Initialize against the default document\nsetDocument();\n\n// Support: Android <=4.0 - 4.1+\n// Detached nodes confoundingly follow *each other*\nsupport.sortDetached = assert( function( el ) {\n\n\t// Should return 1, but returns 4 (following)\n\treturn el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;\n} );\n\njQuery.find = find;\n\n// Deprecated\njQuery.expr[ ":" ] = jQuery.expr.pseudos;\njQuery.unique = jQuery.uniqueSort;\n\n// These have always been private, but they used to be documented as part of\n// Sizzle so let\'s maintain them for now for backwards compatibility purposes.\nfind.compile = compile;\nfind.select = select;\nfind.setDocument = setDocument;\nfind.tokenize = tokenize;\n\nfind.escape = jQuery.escapeSelector;\nfind.getText = jQuery.text;\nfind.isXML = jQuery.isXMLDoc;\nfind.selectors = jQuery.expr;\nfind.support = jQuery.support;\nfind.uniqueSort = jQuery.uniqueSort;\n\n\t/* eslint-enable */\n\n} )();\n\n\nvar dir = function( elem, dir, until ) {\n\tvar matched = [],\n\t\ttruncate = until !== undefined;\n\n\twhile ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {\n\t\tif ( elem.nodeType === 1 ) {\n\t\t\tif ( truncate && jQuery( elem ).is( until ) ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tmatched.push( elem );\n\t\t}\n\t}\n\treturn matched;\n};\n\n\nvar siblings = function( n, elem ) {\n\tvar matched = [];\n\n\tfor ( ; n; n = n.nextSibling ) {\n\t\tif ( n.nodeType === 1 && n !== elem ) {\n\t\t\tmatched.push( n );\n\t\t}\n\t}\n\n\treturn matched;\n};\n\n\nvar rneedsContext = jQuery.expr.match.needsContext;\n\nvar rsingleTag = ( /^<([a-z][^\\/\\0>:\\x20\\t\\r\\n\\f]*)[\\x20\\t\\r\\n\\f]*\\/?>(?:<\\/\\1>|)$/i );\n\n\n\n// Implement the identical functionality for filter and not\nfunction winnow( elements, qualifier, not ) {\n\tif ( isFunction( qualifier ) ) {\n\t\treturn jQuery.grep( elements, function( elem, i ) {\n\t\t\treturn !!qualifier.call( elem, i, elem ) !== not;\n\t\t} );\n\t}\n\n\t// Single element\n\tif ( qualifier.nodeType ) {\n\t\treturn jQuery.grep( elements, function( elem ) {\n\t\t\treturn ( elem === qualifier ) !== not;\n\t\t} );\n\t}\n\n\t// Arraylike of elements (jQuery, arguments, Array)\n\tif ( typeof qualifier !== "string" ) {\n\t\treturn jQuery.grep( elements, function( elem ) {\n\t\t\treturn ( indexOf.call( qualifier, elem ) > -1 ) !== not;\n\t\t} );\n\t}\n\n\t// Filtered directly for both simple and complex selectors\n\treturn jQuery.filter( qualifier, elements, not );\n}\n\njQuery.filter = function( expr, elems, not ) {\n\tvar elem = elems[ 0 ];\n\n\tif ( not ) {\n\t\texpr = ":not(" + expr + ")";\n\t}\n\n\tif ( elems.length === 1 && elem.nodeType === 1 ) {\n\t\treturn jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];\n\t}\n\n\treturn jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {\n\t\treturn elem.nodeType === 1;\n\t} ) );\n};\n\njQuery.fn.extend( {\n\tfind: function( selector ) {\n\t\tvar i, ret,\n\t\t\tlen = this.length,\n\t\t\tself = this;\n\n\t\tif ( typeof selector !== "string" ) {\n\t\t\treturn this.pushStack( jQuery( selector ).filter( function() {\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tif ( jQuery.contains( self[ i ], this ) ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} ) );\n\t\t}\n\n\t\tret = this.pushStack( [] );\n\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tjQuery.find( selector, self[ i ], ret );\n\t\t}\n\n\t\treturn len > 1 ? jQuery.uniqueSort( ret ) : ret;\n\t},\n\tfilter: function( selector ) {\n\t\treturn this.pushStack( winnow( this, selector || [], false ) );\n\t},\n\tnot: function( selector ) {\n\t\treturn this.pushStack( winnow( this, selector || [], true ) );\n\t},\n\tis: function( selector ) {\n\t\treturn !!winnow(\n\t\t\tthis,\n\n\t\t\t// If this is a positional/relative selector, check membership in the returned set\n\t\t\t// so $("p:first").is("p:last") won\'t return true for a doc with two "p".\n\t\t\ttypeof selector === "string" && rneedsContext.test( selector ) ?\n\t\t\t\tjQuery( selector ) :\n\t\t\t\tselector || [],\n\t\t\tfalse\n\t\t).length;\n\t}\n} );\n\n\n// Initialize a jQuery object\n\n\n// A central reference to the root jQuery(document)\nvar rootjQuery,\n\n\t// A simple way to check for HTML strings\n\t// Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521)\n\t// Strict HTML recognition (trac-11290: must start with <)\n\t// Shortcut simple #id case for speed\n\trquickExpr = /^(?:\\s*(<[\\w\\W]+>)[^>]*|#([\\w-]+))$/,\n\n\tinit = jQuery.fn.init = function( selector, context, root ) {\n\t\tvar match, elem;\n\n\t\t// HANDLE: $(""), $(null), $(undefined), $(false)\n\t\tif ( !selector ) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// Method init() accepts an alternate rootjQuery\n\t\t// so migrate can support jQuery.sub (gh-2101)\n\t\troot = root || rootjQuery;\n\n\t\t// Handle HTML strings\n\t\tif ( typeof selector === "string" ) {\n\t\t\tif ( selector[ 0 ] === "<" &&\n\t\t\t\tselector[ selector.length - 1 ] === ">" &&\n\t\t\t\tselector.length >= 3 ) {\n\n\t\t\t\t// Assume that strings that start and end with <> are HTML and skip the regex check\n\t\t\t\tmatch = [ null, selector, null ];\n\n\t\t\t} else {\n\t\t\t\tmatch = rquickExpr.exec( selector );\n\t\t\t}\n\n\t\t\t// Match html or make sure no context is specified for #id\n\t\t\tif ( match && ( match[ 1 ] || !context ) ) {\n\n\t\t\t\t// HANDLE: $(html) -> $(array)\n\t\t\t\tif ( match[ 1 ] ) {\n\t\t\t\t\tcontext = context instanceof jQuery ? context[ 0 ] : context;\n\n\t\t\t\t\t// Option to run scripts is true for back-compat\n\t\t\t\t\t// Intentionally let the error be thrown if parseHTML is not present\n\t\t\t\t\tjQuery.merge( this, jQuery.parseHTML(\n\t\t\t\t\t\tmatch[ 1 ],\n\t\t\t\t\t\tcontext && context.nodeType ? context.ownerDocument || context : document,\n\t\t\t\t\t\ttrue\n\t\t\t\t\t) );\n\n\t\t\t\t\t// HANDLE: $(html, props)\n\t\t\t\t\tif ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {\n\t\t\t\t\t\tfor ( match in context ) {\n\n\t\t\t\t\t\t\t// Properties of context are called as methods if possible\n\t\t\t\t\t\t\tif ( isFunction( this[ match ] ) ) {\n\t\t\t\t\t\t\t\tthis[ match ]( context[ match ] );\n\n\t\t\t\t\t\t\t// ...and otherwise set as attributes\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.attr( match, context[ match ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this;\n\n\t\t\t\t// HANDLE: $(#id)\n\t\t\t\t} else {\n\t\t\t\t\telem = document.getElementById( match[ 2 ] );\n\n\t\t\t\t\tif ( elem ) {\n\n\t\t\t\t\t\t// Inject the element directly into the jQuery object\n\t\t\t\t\t\tthis[ 0 ] = elem;\n\t\t\t\t\t\tthis.length = 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\n\t\t\t// HANDLE: $(expr, $(...))\n\t\t\t} else if ( !context || context.jquery ) {\n\t\t\t\treturn ( context || root ).find( selector );\n\n\t\t\t// HANDLE: $(expr, context)\n\t\t\t// (which is just equivalent to: $(context).find(expr)\n\t\t\t} else {\n\t\t\t\treturn this.constructor( context ).find( selector );\n\t\t\t}\n\n\t\t// HANDLE: $(DOMElement)\n\t\t} else if ( selector.nodeType ) {\n\t\t\tthis[ 0 ] = selector;\n\t\t\tthis.length = 1;\n\t\t\treturn this;\n\n\t\t// HANDLE: $(function)\n\t\t// Shortcut for document ready\n\t\t} else if ( isFunction( selector ) ) {\n\t\t\treturn root.ready !== undefined ?\n\t\t\t\troot.ready( selector ) :\n\n\t\t\t\t// Execute immediately if ready is not present\n\t\t\t\tselector( jQuery );\n\t\t}\n\n\t\treturn jQuery.makeArray( selector, this );\n\t};\n\n// Give the init function the jQuery prototype for later instantiation\ninit.prototype = jQuery.fn;\n\n// Initialize central reference\nrootjQuery = jQuery( document );\n\n\nvar rparentsprev = /^(?:parents|prev(?:Until|All))/,\n\n\t// Methods guaranteed to produce a unique set when starting from a unique set\n\tguaranteedUnique = {\n\t\tchildren: true,\n\t\tcontents: true,\n\t\tnext: true,\n\t\tprev: true\n\t};\n\njQuery.fn.extend( {\n\thas: function( target ) {\n\t\tvar targets = jQuery( target, this ),\n\t\t\tl = targets.length;\n\n\t\treturn this.filter( function() {\n\t\t\tvar i = 0;\n\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\tif ( jQuery.contains( this, targets[ i ] ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t},\n\n\tclosest: function( selectors, context ) {\n\t\tvar cur,\n\t\t\ti = 0,\n\t\t\tl = this.length,\n\t\t\tmatched = [],\n\t\t\ttargets = typeof selectors !== "string" && jQuery( selectors );\n\n\t\t// Positional selectors never match, since there\'s no _selection_ context\n\t\tif ( !rneedsContext.test( selectors ) ) {\n\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\tfor ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {\n\n\t\t\t\t\t// Always skip document fragments\n\t\t\t\t\tif ( cur.nodeType < 11 && ( targets ?\n\t\t\t\t\t\ttargets.index( cur ) > -1 :\n\n\t\t\t\t\t\t// Don\'t pass non-elements to jQuery#find\n\t\t\t\t\t\tcur.nodeType === 1 &&\n\t\t\t\t\t\t\tjQuery.find.matchesSelector( cur, selectors ) ) ) {\n\n\t\t\t\t\t\tmatched.push( cur );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );\n\t},\n\n\t// Determine the position of an element within the set\n\tindex: function( elem ) {\n\n\t\t// No argument, return index in parent\n\t\tif ( !elem ) {\n\t\t\treturn ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;\n\t\t}\n\n\t\t// Index in selector\n\t\tif ( typeof elem === "string" ) {\n\t\t\treturn indexOf.call( jQuery( elem ), this[ 0 ] );\n\t\t}\n\n\t\t// Locate the position of the desired element\n\t\treturn indexOf.call( this,\n\n\t\t\t// If it receives a jQuery object, the first element is used\n\t\t\telem.jquery ? elem[ 0 ] : elem\n\t\t);\n\t},\n\n\tadd: function( selector, context ) {\n\t\treturn this.pushStack(\n\t\t\tjQuery.uniqueSort(\n\t\t\t\tjQuery.merge( this.get(), jQuery( selector, context ) )\n\t\t\t)\n\t\t);\n\t},\n\n\taddBack: function( selector ) {\n\t\treturn this.add( selector == null ?\n\t\t\tthis.prevObject : this.prevObject.filter( selector )\n\t\t);\n\t}\n} );\n\nfunction sibling( cur, dir ) {\n\twhile ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}\n\treturn cur;\n}\n\njQuery.each( {\n\tparent: function( elem ) {\n\t\tvar parent = elem.parentNode;\n\t\treturn parent && parent.nodeType !== 11 ? parent : null;\n\t},\n\tparents: function( elem ) {\n\t\treturn dir( elem, "parentNode" );\n\t},\n\tparentsUntil: function( elem, _i, until ) {\n\t\treturn dir( elem, "parentNode", until );\n\t},\n\tnext: function( elem ) {\n\t\treturn sibling( elem, "nextSibling" );\n\t},\n\tprev: function( elem ) {\n\t\treturn sibling( elem, "previousSibling" );\n\t},\n\tnextAll: function( elem ) {\n\t\treturn dir( elem, "nextSibling" );\n\t},\n\tprevAll: function( elem ) {\n\t\treturn dir( elem, "previousSibling" );\n\t},\n\tnextUntil: function( elem, _i, until ) {\n\t\treturn dir( elem, "nextSibling", until );\n\t},\n\tprevUntil: function( elem, _i, until ) {\n\t\treturn dir( elem, "previousSibling", until );\n\t},\n\tsiblings: function( elem ) {\n\t\treturn siblings( ( elem.parentNode || {} ).firstChild, elem );\n\t},\n\tchildren: function( elem ) {\n\t\treturn siblings( elem.firstChild );\n\t},\n\tcontents: function( elem ) {\n\t\tif ( elem.contentDocument != null &&\n\n\t\t\t// Support: IE 11+\n\t\t\t// <object> elements with no `data` attribute has an object\n\t\t\t// `contentDocument` with a `null` prototype.\n\t\t\tgetProto( elem.contentDocument ) ) {\n\n\t\t\treturn elem.contentDocument;\n\t\t}\n\n\t\t// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only\n\t\t// Treat the template element as a regular one in browsers that\n\t\t// don\'t support it.\n\t\tif ( nodeName( elem, "template" ) ) {\n\t\t\telem = elem.content || elem;\n\t\t}\n\n\t\treturn jQuery.merge( [], elem.childNodes );\n\t}\n}, function( name, fn ) {\n\tjQuery.fn[ name ] = function( until, selector ) {\n\t\tvar matched = jQuery.map( this, fn, until );\n\n\t\tif ( name.slice( -5 ) !== "Until" ) {\n\t\t\tselector = until;\n\t\t}\n\n\t\tif ( selector && typeof selector === "string" ) {\n\t\t\tmatched = jQuery.filter( selector, matched );\n\t\t}\n\n\t\tif ( this.length > 1 ) {\n\n\t\t\t// Remove duplicates\n\t\t\tif ( !guaranteedUnique[ name ] ) {\n\t\t\t\tjQuery.uniqueSort( matched );\n\t\t\t}\n\n\t\t\t// Reverse order for parents* and prev-derivatives\n\t\t\tif ( rparentsprev.test( name ) ) {\n\t\t\t\tmatched.reverse();\n\t\t\t}\n\t\t}\n\n\t\treturn this.pushStack( matched );\n\t};\n} );\nvar rnothtmlwhite = ( /[^\\x20\\t\\r\\n\\f]+/g );\n\n\n\n// Convert String-formatted options into Object-formatted ones\nfunction createOptions( options ) {\n\tvar object = {};\n\tjQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {\n\t\tobject[ flag ] = true;\n\t} );\n\treturn object;\n}\n\n/*\n * Create a callback list using the following parameters:\n *\n *\toptions: an optional list of space-separated options that will change how\n *\t\t\tthe callback list behaves or a more traditional option object\n *\n * By default a callback list will act like an event callback list and can be\n * "fired" multiple times.\n *\n * Possible options:\n *\n *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n *\n *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n *\t\t\t\t\tafter the list has been fired right away with the latest "memorized"\n *\t\t\t\t\tvalues (like a Deferred)\n *\n *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n *\n *\tstopOnFalse:\tinterrupt callings when a callback returns false\n *\n */\njQuery.Callbacks = function( options ) {\n\n\t// Convert options from String-formatted to Object-formatted if needed\n\t// (we check in cache first)\n\toptions = typeof options === "string" ?\n\t\tcreateOptions( options ) :\n\t\tjQuery.extend( {}, options );\n\n\tvar // Flag to know if list is currently firing\n\t\tfiring,\n\n\t\t// Last fire value for non-forgettable lists\n\t\tmemory,\n\n\t\t// Flag to know if list was already fired\n\t\tfired,\n\n\t\t// Flag to prevent firing\n\t\tlocked,\n\n\t\t// Actual callback list\n\t\tlist = [],\n\n\t\t// Queue of execution data for repeatable lists\n\t\tqueue = [],\n\n\t\t// Index of currently firing callback (modified by add/remove as needed)\n\t\tfiringIndex = -1,\n\n\t\t// Fire callbacks\n\t\tfire = function() {\n\n\t\t\t// Enforce single-firing\n\t\t\tlocked = locked || options.once;\n\n\t\t\t// Execute callbacks for all pending executions,\n\t\t\t// respecting firingIndex overrides and runtime changes\n\t\t\tfired = firing = true;\n\t\t\tfor ( ; queue.length; firingIndex = -1 ) {\n\t\t\t\tmemory = queue.shift();\n\t\t\t\twhile ( ++firingIndex < list.length ) {\n\n\t\t\t\t\t// Run callback and check for early termination\n\t\t\t\t\tif ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&\n\t\t\t\t\t\toptions.stopOnFalse ) {\n\n\t\t\t\t\t\t// Jump to end and forget the data so .add doesn\'t re-fire\n\t\t\t\t\t\tfiringIndex = list.length;\n\t\t\t\t\t\tmemory = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Forget the data if we\'re done with it\n\t\t\tif ( !options.memory ) {\n\t\t\t\tmemory = false;\n\t\t\t}\n\n\t\t\tfiring = false;\n\n\t\t\t// Clean up if we\'re done firing for good\n\t\t\tif ( locked ) {\n\n\t\t\t\t// Keep an empty list if we have data for future add calls\n\t\t\t\tif ( memory ) {\n\t\t\t\t\tlist = [];\n\n\t\t\t\t// Otherwise, this object is spent\n\t\t\t\t} else {\n\t\t\t\t\tlist = "";\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t// Actual Callbacks object\n\t\tself = {\n\n\t\t\t// Add a callback or a collection of callbacks to the list\n\t\t\tadd: function() {\n\t\t\t\tif ( list ) {\n\n\t\t\t\t\t// If we have memory from a past run, we should fire after adding\n\t\t\t\t\tif ( memory && !firing ) {\n\t\t\t\t\t\tfiringIndex = list.length - 1;\n\t\t\t\t\t\tqueue.push( memory );\n\t\t\t\t\t}\n\n\t\t\t\t\t( function add( args ) {\n\t\t\t\t\t\tjQuery.each( args, function( _, arg ) {\n\t\t\t\t\t\t\tif ( isFunction( arg ) ) {\n\t\t\t\t\t\t\t\tif ( !options.unique || !self.has( arg ) ) {\n\t\t\t\t\t\t\t\t\tlist.push( arg );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if ( arg && arg.length && toType( arg ) !== "string" ) {\n\n\t\t\t\t\t\t\t\t// Inspect recursively\n\t\t\t\t\t\t\t\tadd( arg );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t} )( arguments );\n\n\t\t\t\t\tif ( memory && !firing ) {\n\t\t\t\t\t\tfire();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Remove a callback from the list\n\t\t\tremove: function() {\n\t\t\t\tjQuery.each( arguments, function( _, arg ) {\n\t\t\t\t\tvar index;\n\t\t\t\t\twhile ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {\n\t\t\t\t\t\tlist.splice( index, 1 );\n\n\t\t\t\t\t\t// Handle firing indexes\n\t\t\t\t\t\tif ( index <= firingIndex ) {\n\t\t\t\t\t\t\tfiringIndex--;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Check if a given callback is in the list.\n\t\t\t// If no argument is given, return whether or not list has callbacks attached.\n\t\t\thas: function( fn ) {\n\t\t\t\treturn fn ?\n\t\t\t\t\tjQuery.inArray( fn, list ) > -1 :\n\t\t\t\t\tlist.length > 0;\n\t\t\t},\n\n\t\t\t// Remove all callbacks from the list\n\t\t\tempty: function() {\n\t\t\t\tif ( list ) {\n\t\t\t\t\tlist = [];\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Disable .fire and .add\n\t\t\t// Abort any current/pending executions\n\t\t\t// Clear all callbacks and values\n\t\t\tdisable: function() {\n\t\t\t\tlocked = queue = [];\n\t\t\t\tlist = memory = "";\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tdisabled: function() {\n\t\t\t\treturn !list;\n\t\t\t},\n\n\t\t\t// Disable .fire\n\t\t\t// Also disable .add unless we have memory (since it would have no effect)\n\t\t\t// Abort any pending executions\n\t\t\tlock: function() {\n\t\t\t\tlocked = queue = [];\n\t\t\t\tif ( !memory && !firing ) {\n\t\t\t\t\tlist = memory = "";\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\tlocked: function() {\n\t\t\t\treturn !!locked;\n\t\t\t},\n\n\t\t\t// Call all callbacks with the given context and arguments\n\t\t\tfireWith: function( context, args ) {\n\t\t\t\tif ( !locked ) {\n\t\t\t\t\targs = args || [];\n\t\t\t\t\targs = [ context, args.slice ? args.slice() : args ];\n\t\t\t\t\tqueue.push( args );\n\t\t\t\t\tif ( !firing ) {\n\t\t\t\t\t\tfire();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// Call all the callbacks with the given arguments\n\t\t\tfire: function() {\n\t\t\t\tself.fireWith( this, arguments );\n\t\t\t\treturn this;\n\t\t\t},\n\n\t\t\t// To know if the callbacks have already been called at least once\n\t\t\tfired: function() {\n\t\t\t\treturn !!fired;\n\t\t\t}\n\t\t};\n\n\treturn self;\n};\n\n\nfunction Identity( v ) {\n\treturn v;\n}\nfunction Thrower( ex ) {\n\tthrow ex;\n}\n\nfunction adoptValue( value, resolve, reject, noValue ) {\n\tvar method;\n\n\ttry {\n\n\t\t// Check for promise aspect first to privilege synchronous behavior\n\t\tif ( value && isFunction( ( method = value.promise ) ) ) {\n\t\t\tmethod.call( value ).done( resolve ).fail( reject );\n\n\t\t// Other thenables\n\t\t} else if ( value && isFunction( ( method = value.then ) ) ) {\n\t\t\tmethod.call( value, resolve, reject );\n\n\t\t// Other non-thenables\n\t\t} else {\n\n\t\t\t// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:\n\t\t\t// * false: [ value ].slice( 0 ) => resolve( value )\n\t\t\t// * true: [ value ].slice( 1 ) => resolve()\n\t\t\tresolve.apply( undefined, [ value ].slice( noValue ) );\n\t\t}\n\n\t// For Promises/A+, convert exceptions into rejections\n\t// Since jQuery.when doesn\'t unwrap thenables, we can skip the extra checks appearing in\n\t// Deferred#then to conditionally suppress rejection.\n\t} catch ( value ) {\n\n\t\t// Support: Android 4.0 only\n\t\t// Strict mode functions invoked without .call/.apply get global-object context\n\t\treject.apply( undefined, [ value ] );\n\t}\n}\n\njQuery.extend( {\n\n\tDeferred: function( func ) {\n\t\tvar tuples = [\n\n\t\t\t\t// action, add listener, callbacks,\n\t\t\t\t// ... .then handlers, argument index, [final state]\n\t\t\t\t[ "notify", "progress", jQuery.Callbacks( "memory" ),\n\t\t\t\t\tjQuery.Callbacks( "memory" ), 2 ],\n\t\t\t\t[ "resolve", "done", jQuery.Callbacks( "once memory" ),\n\t\t\t\t\tjQuery.Callbacks( "once memory" ), 0, "resolved" ],\n\t\t\t\t[ "reject", "fail", jQuery.Callbacks( "once memory" ),\n\t\t\t\t\tjQuery.Callbacks( "once memory" ), 1, "rejected" ]\n\t\t\t],\n\t\t\tstate = "pending",\n\t\t\tpromise = {\n\t\t\t\tstate: function() {\n\t\t\t\t\treturn state;\n\t\t\t\t},\n\t\t\t\talways: function() {\n\t\t\t\t\tdeferred.done( arguments ).fail( arguments );\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\t"catch": function( fn ) {\n\t\t\t\t\treturn promise.then( null, fn );\n\t\t\t\t},\n\n\t\t\t\t// Keep pipe for back-compat\n\t\t\t\tpipe: function( /* fnDone, fnFail, fnProgress */ ) {\n\t\t\t\t\tvar fns = arguments;\n\n\t\t\t\t\treturn jQuery.Deferred( function( newDefer ) {\n\t\t\t\t\t\tjQuery.each( tuples, function( _i, tuple ) {\n\n\t\t\t\t\t\t\t// Map tuples (progress, done, fail) to arguments (done, fail, progress)\n\t\t\t\t\t\t\tvar fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];\n\n\t\t\t\t\t\t\t// deferred.progress(function() { bind to newDefer or newDefer.notify })\n\t\t\t\t\t\t\t// deferred.done(function() { bind to newDefer or newDefer.resolve })\n\t\t\t\t\t\t\t// deferred.fail(function() { bind to newDefer or newDefer.reject })\n\t\t\t\t\t\t\tdeferred[ tuple[ 1 ] ]( function() {\n\t\t\t\t\t\t\t\tvar returned = fn && fn.apply( this, arguments );\n\t\t\t\t\t\t\t\tif ( returned && isFunction( returned.promise ) ) {\n\t\t\t\t\t\t\t\t\treturned.promise()\n\t\t\t\t\t\t\t\t\t\t.progress( newDefer.notify )\n\t\t\t\t\t\t\t\t\t\t.done( newDefer.resolve )\n\t\t\t\t\t\t\t\t\t\t.fail( newDefer.reject );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tnewDefer[ tuple[ 0 ] + "With" ](\n\t\t\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\t\t\tfn ? [ returned ] : arguments\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tfns = null;\n\t\t\t\t\t} ).promise();\n\t\t\t\t},\n\t\t\t\tthen: function( onFulfilled, onRejected, onProgress ) {\n\t\t\t\t\tvar maxDepth = 0;\n\t\t\t\t\tfunction resolve( depth, deferred, handler, special ) {\n\t\t\t\t\t\treturn function() {\n\t\t\t\t\t\t\tvar that = this,\n\t\t\t\t\t\t\t\targs = arguments,\n\t\t\t\t\t\t\t\tmightThrow = function() {\n\t\t\t\t\t\t\t\t\tvar returned, then;\n\n\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.3\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-59\n\t\t\t\t\t\t\t\t\t// Ignore double-resolution attempts\n\t\t\t\t\t\t\t\t\tif ( depth < maxDepth ) {\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\treturned = handler.apply( that, args );\n\n\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.1\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-48\n\t\t\t\t\t\t\t\t\tif ( returned === deferred.promise() ) {\n\t\t\t\t\t\t\t\t\t\tthrow new TypeError( "Thenable self-resolution" );\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Support: Promises/A+ sections 2.3.3.1, 3.5\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-54\n\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-75\n\t\t\t\t\t\t\t\t\t// Retrieve `then` only once\n\t\t\t\t\t\t\t\t\tthen = returned &&\n\n\t\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.4\n\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-64\n\t\t\t\t\t\t\t\t\t\t// Only check objects and functions for thenability\n\t\t\t\t\t\t\t\t\t\t( typeof returned === "object" ||\n\t\t\t\t\t\t\t\t\t\t\ttypeof returned === "function" ) &&\n\t\t\t\t\t\t\t\t\t\treturned.then;\n\n\t\t\t\t\t\t\t\t\t// Handle a returned thenable\n\t\t\t\t\t\t\t\t\tif ( isFunction( then ) ) {\n\n\t\t\t\t\t\t\t\t\t\t// Special processors (notify) just wait for resolution\n\t\t\t\t\t\t\t\t\t\tif ( special ) {\n\t\t\t\t\t\t\t\t\t\t\tthen.call(\n\t\t\t\t\t\t\t\t\t\t\t\treturned,\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity, special ),\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Thrower, special )\n\t\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t\t// Normal processors (resolve) also hook into progress\n\t\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\t\t// ...and disregard older resolution values\n\t\t\t\t\t\t\t\t\t\t\tmaxDepth++;\n\n\t\t\t\t\t\t\t\t\t\t\tthen.call(\n\t\t\t\t\t\t\t\t\t\t\t\treturned,\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity, special ),\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Thrower, special ),\n\t\t\t\t\t\t\t\t\t\t\t\tresolve( maxDepth, deferred, Identity,\n\t\t\t\t\t\t\t\t\t\t\t\t\tdeferred.notifyWith )\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Handle all other returned values\n\t\t\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t\t\t// Only substitute handlers pass on context\n\t\t\t\t\t\t\t\t\t\t// and multiple values (non-spec behavior)\n\t\t\t\t\t\t\t\t\t\tif ( handler !== Identity ) {\n\t\t\t\t\t\t\t\t\t\t\tthat = undefined;\n\t\t\t\t\t\t\t\t\t\t\targs = [ returned ];\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t// Process the value(s)\n\t\t\t\t\t\t\t\t\t\t// Default process is resolve\n\t\t\t\t\t\t\t\t\t\t( special || deferred.resolveWith )( that, args );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t// Only normal processors (resolve) catch and reject exceptions\n\t\t\t\t\t\t\t\tprocess = special ?\n\t\t\t\t\t\t\t\t\tmightThrow :\n\t\t\t\t\t\t\t\t\tfunction() {\n\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\tmightThrow();\n\t\t\t\t\t\t\t\t\t\t} catch ( e ) {\n\n\t\t\t\t\t\t\t\t\t\t\tif ( jQuery.Deferred.exceptionHook ) {\n\t\t\t\t\t\t\t\t\t\t\t\tjQuery.Deferred.exceptionHook( e,\n\t\t\t\t\t\t\t\t\t\t\t\t\tprocess.error );\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.4.1\n\t\t\t\t\t\t\t\t\t\t\t// https://promisesaplus.com/#point-61\n\t\t\t\t\t\t\t\t\t\t\t// Ignore post-resolution exceptions\n\t\t\t\t\t\t\t\t\t\t\tif ( depth + 1 >= maxDepth ) {\n\n\t\t\t\t\t\t\t\t\t\t\t\t// Only substitute handlers pass on context\n\t\t\t\t\t\t\t\t\t\t\t\t// and multiple values (non-spec behavior)\n\t\t\t\t\t\t\t\t\t\t\t\tif ( handler !== Thrower ) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tthat = undefined;\n\t\t\t\t\t\t\t\t\t\t\t\t\targs = [ e ];\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\tdeferred.rejectWith( that, args );\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t// Support: Promises/A+ section 2.3.3.3.1\n\t\t\t\t\t\t\t// https://promisesaplus.com/#point-57\n\t\t\t\t\t\t\t// Re-resolve promises immediately to dodge false rejection from\n\t\t\t\t\t\t\t// subsequent errors\n\t\t\t\t\t\t\tif ( depth ) {\n\t\t\t\t\t\t\t\tprocess();\n\t\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t\t// Call an optional hook to record the error, in case of exception\n\t\t\t\t\t\t\t\t// since it\'s otherwise lost when execution goes async\n\t\t\t\t\t\t\t\tif ( jQuery.Deferred.getErrorHook ) {\n\t\t\t\t\t\t\t\t\tprocess.error = jQuery.Deferred.getErrorHook();\n\n\t\t\t\t\t\t\t\t// The deprecated alias of the above. While the name suggests\n\t\t\t\t\t\t\t\t// returning the stack, not an error instance, jQuery just passes\n\t\t\t\t\t\t\t\t// it directly to `console.warn` so both will work; an instance\n\t\t\t\t\t\t\t\t// just better cooperates with source maps.\n\t\t\t\t\t\t\t\t} else if ( jQuery.Deferred.getStackHook ) {\n\t\t\t\t\t\t\t\t\tprocess.error = jQuery.Deferred.getStackHook();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\twindow.setTimeout( process );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\treturn jQuery.Deferred( function( newDefer ) {\n\n\t\t\t\t\t\t// progress_handlers.add( ... )\n\t\t\t\t\t\ttuples[ 0 ][ 3 ].add(\n\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\tisFunction( onProgress ) ?\n\t\t\t\t\t\t\t\t\tonProgress :\n\t\t\t\t\t\t\t\t\tIdentity,\n\t\t\t\t\t\t\t\tnewDefer.notifyWith\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// fulfilled_handlers.add( ... )\n\t\t\t\t\t\ttuples[ 1 ][ 3 ].add(\n\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\tisFunction( onFulfilled ) ?\n\t\t\t\t\t\t\t\t\tonFulfilled :\n\t\t\t\t\t\t\t\t\tIdentity\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\t// rejected_handlers.add( ... )\n\t\t\t\t\t\ttuples[ 2 ][ 3 ].add(\n\t\t\t\t\t\t\tresolve(\n\t\t\t\t\t\t\t\t0,\n\t\t\t\t\t\t\t\tnewDefer,\n\t\t\t\t\t\t\t\tisFunction( onRejected ) ?\n\t\t\t\t\t\t\t\t\tonRejected :\n\t\t\t\t\t\t\t\t\tThrower\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} ).promise();\n\t\t\t\t},\n\n\t\t\t\t// Get a promise for this deferred\n\t\t\t\t// If obj is provided, the promise aspect is added to the object\n\t\t\t\tpromise: function( obj ) {\n\t\t\t\t\treturn obj != null ? jQuery.extend( obj, promise ) : promise;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdeferred = {};\n\n\t\t// Add list-specific methods\n\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\tvar list = tuple[ 2 ],\n\t\t\t\tstateString = tuple[ 5 ];\n\n\t\t\t// promise.progress = list.add\n\t\t\t// promise.done = list.add\n\t\t\t// promise.fail = list.add\n\t\t\tpromise[ tuple[ 1 ] ] = list.add;\n\n\t\t\t// Handle state\n\t\t\tif ( stateString ) {\n\t\t\t\tlist.add(\n\t\t\t\t\tfunction() {\n\n\t\t\t\t\t\t// state = "resolved" (i.e., fulfilled)\n\t\t\t\t\t\t// state = "rejected"\n\t\t\t\t\t\tstate = stateString;\n\t\t\t\t\t},\n\n\t\t\t\t\t// rejected_callbacks.disable\n\t\t\t\t\t// fulfilled_callbacks.disable\n\t\t\t\t\ttuples[ 3 - i ][ 2 ].disable,\n\n\t\t\t\t\t// rejected_handlers.disable\n\t\t\t\t\t// fulfilled_handlers.disable\n\t\t\t\t\ttuples[ 3 - i ][ 3 ].disable,\n\n\t\t\t\t\t// progress_callbacks.lock\n\t\t\t\t\ttuples[ 0 ][ 2 ].lock,\n\n\t\t\t\t\t// progress_handlers.lock\n\t\t\t\t\ttuples[ 0 ][ 3 ].lock\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// progress_handlers.fire\n\t\t\t// fulfilled_handlers.fire\n\t\t\t// rejected_handlers.fire\n\t\t\tlist.add( tuple[ 3 ].fire );\n\n\t\t\t// deferred.notify = function() { deferred.notifyWith(...) }\n\t\t\t// deferred.resolve = function() { deferred.resolveWith(...) }\n\t\t\t// deferred.reject = function() { deferred.rejectWith(...) }\n\t\t\tdeferred[ tuple[ 0 ] ] = function() {\n\t\t\t\tdeferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );\n\t\t\t\treturn this;\n\t\t\t};\n\n\t\t\t// deferred.notifyWith = list.fireWith\n\t\t\t// deferred.resolveWith = list.fireWith\n\t\t\t// deferred.rejectWith = list.fireWith\n\t\t\tdeferred[ tuple[ 0 ] + "With" ] = list.fireWith;\n\t\t} );\n\n\t\t// Make the deferred a promise\n\t\tpromise.promise( deferred );\n\n\t\t// Call given func if any\n\t\tif ( func ) {\n\t\t\tfunc.call( deferred, deferred );\n\t\t}\n\n\t\t// All done!\n\t\treturn deferred;\n\t},\n\n\t// Deferred helper\n\twhen: function( singleValue ) {\n\t\tvar\n\n\t\t\t// count of uncompleted subordinates\n\t\t\tremaining = arguments.length,\n\n\t\t\t// count of unprocessed arguments\n\t\t\ti = remaining,\n\n\t\t\t// subordinate fulfillment data\n\t\t\tresolveContexts = Array( i ),\n\t\t\tresolveValues = slice.call( arguments ),\n\n\t\t\t// the primary Deferred\n\t\t\tprimary = jQuery.Deferred(),\n\n\t\t\t// subordinate callback factory\n\t\t\tupdateFunc = function( i ) {\n\t\t\t\treturn function( value ) {\n\t\t\t\t\tresolveContexts[ i ] = this;\n\t\t\t\t\tresolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;\n\t\t\t\t\tif ( !( --remaining ) ) {\n\t\t\t\t\t\tprimary.resolveWith( resolveContexts, resolveValues );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t};\n\n\t\t// Single- and empty arguments are adopted like Promise.resolve\n\t\tif ( remaining <= 1 ) {\n\t\t\tadoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,\n\t\t\t\t!remaining );\n\n\t\t\t// Use .then() to unwrap secondary thenables (cf. gh-3000)\n\t\t\tif ( primary.state() === "pending" ||\n\t\t\t\tisFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {\n\n\t\t\t\treturn primary.then();\n\t\t\t}\n\t\t}\n\n\t\t// Multiple arguments are aggregated like Promise.all array elements\n\t\twhile ( i-- ) {\n\t\t\tadoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );\n\t\t}\n\n\t\treturn primary.promise();\n\t}\n} );\n\n\n// These usually indicate a programmer mistake during development,\n// warn about them ASAP rather than swallowing them by default.\nvar rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;\n\n// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error\n// captured before the async barrier to get the original error cause\n// which may otherwise be hidden.\njQuery.Deferred.exceptionHook = function( error, asyncError ) {\n\n\t// Support: IE 8 - 9 only\n\t// Console exists when dev tools are open, which can happen at any time\n\tif ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {\n\t\twindow.console.warn( "jQuery.Deferred exception: " + error.message,\n\t\t\terror.stack, asyncError );\n\t}\n};\n\n\n\n\njQuery.readyException = function( error ) {\n\twindow.setTimeout( function() {\n\t\tthrow error;\n\t} );\n};\n\n\n\n\n// The deferred used on DOM ready\nvar readyList = jQuery.Deferred();\n\njQuery.fn.ready = function( fn ) {\n\n\treadyList\n\t\t.then( fn )\n\n\t\t// Wrap jQuery.readyException in a function so that the lookup\n\t\t// happens at the time of error handling instead of callback\n\t\t// registration.\n\t\t.catch( function( error ) {\n\t\t\tjQuery.readyException( error );\n\t\t} );\n\n\treturn this;\n};\n\njQuery.extend( {\n\n\t// Is the DOM ready to be used? Set to true once it occurs.\n\tisReady: false,\n\n\t// A counter to track how many items to wait for before\n\t// the ready event fires. See trac-6781\n\treadyWait: 1,\n\n\t// Handle when the DOM is ready\n\tready: function( wait ) {\n\n\t\t// Abort if there are pending holds or we\'re already ready\n\t\tif ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Remember that the DOM is ready\n\t\tjQuery.isReady = true;\n\n\t\t// If a normal DOM Ready event fired, decrement, and wait if need be\n\t\tif ( wait !== true && --jQuery.readyWait > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If there are functions bound, to execute\n\t\treadyList.resolveWith( document, [ jQuery ] );\n\t}\n} );\n\njQuery.ready.then = readyList.then;\n\n// The ready event handler and self cleanup method\nfunction completed() {\n\tdocument.removeEventListener( "DOMContentLoaded", completed );\n\twindow.removeEventListener( "load", completed );\n\tjQuery.ready();\n}\n\n// Catch cases where $(document).ready() is called\n// after the browser event has already occurred.\n// Support: IE <=9 - 10 only\n// Older IE sometimes signals "interactive" too soon\nif ( document.readyState === "complete" ||\n\t( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {\n\n\t// Handle it asynchronously to allow scripts the opportunity to delay ready\n\twindow.setTimeout( jQuery.ready );\n\n} else {\n\n\t// Use the handy event callback\n\tdocument.addEventListener( "DOMContentLoaded", completed );\n\n\t// A fallback to window.onload, that will always work\n\twindow.addEventListener( "load", completed );\n}\n\n\n\n\n// Multifunctional method to get and set values of a collection\n// The value/s can optionally be executed if it\'s a function\nvar access = function( elems, fn, key, value, chainable, emptyGet, raw ) {\n\tvar i = 0,\n\t\tlen = elems.length,\n\t\tbulk = key == null;\n\n\t// Sets many values\n\tif ( toType( key ) === "object" ) {\n\t\tchainable = true;\n\t\tfor ( i in key ) {\n\t\t\taccess( elems, fn, i, key[ i ], true, emptyGet, raw );\n\t\t}\n\n\t// Sets one value\n\t} else if ( value !== undefined ) {\n\t\tchainable = true;\n\n\t\tif ( !isFunction( value ) ) {\n\t\t\traw = true;\n\t\t}\n\n\t\tif ( bulk ) {\n\n\t\t\t// Bulk operations run against the entire set\n\t\t\tif ( raw ) {\n\t\t\t\tfn.call( elems, value );\n\t\t\t\tfn = null;\n\n\t\t\t// ...except when executing function values\n\t\t\t} else {\n\t\t\t\tbulk = fn;\n\t\t\t\tfn = function( elem, _key, value ) {\n\t\t\t\t\treturn bulk.call( jQuery( elem ), value );\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\tif ( fn ) {\n\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\tfn(\n\t\t\t\t\telems[ i ], key, raw ?\n\t\t\t\t\t\tvalue :\n\t\t\t\t\t\tvalue.call( elems[ i ], i, fn( elems[ i ], key ) )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( chainable ) {\n\t\treturn elems;\n\t}\n\n\t// Gets\n\tif ( bulk ) {\n\t\treturn fn.call( elems );\n\t}\n\n\treturn len ? fn( elems[ 0 ], key ) : emptyGet;\n};\n\n\n// Matches dashed string for camelizing\nvar rmsPrefix = /^-ms-/,\n\trdashAlpha = /-([a-z])/g;\n\n// Used by camelCase as callback to replace()\nfunction fcamelCase( _all, letter ) {\n\treturn letter.toUpperCase();\n}\n\n// Convert dashed to camelCase; used by the css and data modules\n// Support: IE <=9 - 11, Edge 12 - 15\n// Microsoft forgot to hump their vendor prefix (trac-9572)\nfunction camelCase( string ) {\n\treturn string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );\n}\nvar acceptData = function( owner ) {\n\n\t// Accepts only:\n\t// - Node\n\t// - Node.ELEMENT_NODE\n\t// - Node.DOCUMENT_NODE\n\t// - Object\n\t// - Any\n\treturn owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );\n};\n\n\n\n\nfunction Data() {\n\tthis.expando = jQuery.expando + Data.uid++;\n}\n\nData.uid = 1;\n\nData.prototype = {\n\n\tcache: function( owner ) {\n\n\t\t// Check if the owner object already has a cache\n\t\tvar value = owner[ this.expando ];\n\n\t\t// If not, create one\n\t\tif ( !value ) {\n\t\t\tvalue = {};\n\n\t\t\t// We can accept data for non-element nodes in modern browsers,\n\t\t\t// but we should not, see trac-8335.\n\t\t\t// Always return an empty object.\n\t\t\tif ( acceptData( owner ) ) {\n\n\t\t\t\t// If it is a node unlikely to be stringify-ed or looped over\n\t\t\t\t// use plain assignment\n\t\t\t\tif ( owner.nodeType ) {\n\t\t\t\t\towner[ this.expando ] = value;\n\n\t\t\t\t// Otherwise secure it in a non-enumerable property\n\t\t\t\t// configurable must be true to allow the property to be\n\t\t\t\t// deleted when data is removed\n\t\t\t\t} else {\n\t\t\t\t\tObject.defineProperty( owner, this.expando, {\n\t\t\t\t\t\tvalue: value,\n\t\t\t\t\t\tconfigurable: true\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t},\n\tset: function( owner, data, value ) {\n\t\tvar prop,\n\t\t\tcache = this.cache( owner );\n\n\t\t// Handle: [ owner, key, value ] args\n\t\t// Always use camelCase key (gh-2257)\n\t\tif ( typeof data === "string" ) {\n\t\t\tcache[ camelCase( data ) ] = value;\n\n\t\t// Handle: [ owner, { properties } ] args\n\t\t} else {\n\n\t\t\t// Copy the properties one-by-one to the cache object\n\t\t\tfor ( prop in data ) {\n\t\t\t\tcache[ camelCase( prop ) ] = data[ prop ];\n\t\t\t}\n\t\t}\n\t\treturn cache;\n\t},\n\tget: function( owner, key ) {\n\t\treturn key === undefined ?\n\t\t\tthis.cache( owner ) :\n\n\t\t\t// Always use camelCase key (gh-2257)\n\t\t\towner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];\n\t},\n\taccess: function( owner, key, value ) {\n\n\t\t// In cases where either:\n\t\t//\n\t\t// 1. No key was specified\n\t\t// 2. A string key was specified, but no value provided\n\t\t//\n\t\t// Take the "read" path and allow the get method to determine\n\t\t// which value to return, respectively either:\n\t\t//\n\t\t// 1. The entire cache object\n\t\t// 2. The data stored at the key\n\t\t//\n\t\tif ( key === undefined ||\n\t\t\t\t( ( key && typeof key === "string" ) && value === undefined ) ) {\n\n\t\t\treturn this.get( owner, key );\n\t\t}\n\n\t\t// When the key is not a string, or both a key and value\n\t\t// are specified, set or extend (existing objects) with either:\n\t\t//\n\t\t// 1. An object of properties\n\t\t// 2. A key and value\n\t\t//\n\t\tthis.set( owner, key, value );\n\n\t\t// Since the "set" path can have two possible entry points\n\t\t// return the expected data based on which path was taken[*]\n\t\treturn value !== undefined ? value : key;\n\t},\n\tremove: function( owner, key ) {\n\t\tvar i,\n\t\t\tcache = owner[ this.expando ];\n\n\t\tif ( cache === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( key !== undefined ) {\n\n\t\t\t// Support array or space separated string of keys\n\t\t\tif ( Array.isArray( key ) ) {\n\n\t\t\t\t// If key is an array of keys...\n\t\t\t\t// We always set camelCase keys, so remove that.\n\t\t\t\tkey = key.map( camelCase );\n\t\t\t} else {\n\t\t\t\tkey = camelCase( key );\n\n\t\t\t\t// If a key with the spaces exists, use it.\n\t\t\t\t// Otherwise, create an array by matching non-whitespace\n\t\t\t\tkey = key in cache ?\n\t\t\t\t\t[ key ] :\n\t\t\t\t\t( key.match( rnothtmlwhite ) || [] );\n\t\t\t}\n\n\t\t\ti = key.length;\n\n\t\t\twhile ( i-- ) {\n\t\t\t\tdelete cache[ key[ i ] ];\n\t\t\t}\n\t\t}\n\n\t\t// Remove the expando if there\'s no more data\n\t\tif ( key === undefined || jQuery.isEmptyObject( cache ) ) {\n\n\t\t\t// Support: Chrome <=35 - 45\n\t\t\t// Webkit & Blink performance suffers when deleting properties\n\t\t\t// from DOM nodes, so set to undefined instead\n\t\t\t// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)\n\t\t\tif ( owner.nodeType ) {\n\t\t\t\towner[ this.expando ] = undefined;\n\t\t\t} else {\n\t\t\t\tdelete owner[ this.expando ];\n\t\t\t}\n\t\t}\n\t},\n\thasData: function( owner ) {\n\t\tvar cache = owner[ this.expando ];\n\t\treturn cache !== undefined && !jQuery.isEmptyObject( cache );\n\t}\n};\nvar dataPriv = new Data();\n\nvar dataUser = new Data();\n\n\n\n//\tImplementation Summary\n//\n//\t1. Enforce API surface and semantic compatibility with 1.9.x branch\n//\t2. Improve the module\'s maintainability by reducing the storage\n//\t\tpaths to a single mechanism.\n//\t3. Use the same single mechanism to support "private" and "user" data.\n//\t4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)\n//\t5. Avoid exposing implementation details on user objects (eg. expando properties)\n//\t6. Provide a clear path for implementation upgrade to WeakMap in 2014\n\nvar rbrace = /^(?:\\{[\\w\\W]*\\}|\\[[\\w\\W]*\\])$/,\n\trmultiDash = /[A-Z]/g;\n\nfunction getData( data ) {\n\tif ( data === "true" ) {\n\t\treturn true;\n\t}\n\n\tif ( data === "false" ) {\n\t\treturn false;\n\t}\n\n\tif ( data === "null" ) {\n\t\treturn null;\n\t}\n\n\t// Only convert to a number if it doesn\'t change the string\n\tif ( data === +data + "" ) {\n\t\treturn +data;\n\t}\n\n\tif ( rbrace.test( data ) ) {\n\t\treturn JSON.parse( data );\n\t}\n\n\treturn data;\n}\n\nfunction dataAttr( elem, key, data ) {\n\tvar name;\n\n\t// If nothing was found internally, try to fetch any\n\t// data from the HTML5 data-* attribute\n\tif ( data === undefined && elem.nodeType === 1 ) {\n\t\tname = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();\n\t\tdata = elem.getAttribute( name );\n\n\t\tif ( typeof data === "string" ) {\n\t\t\ttry {\n\t\t\t\tdata = getData( data );\n\t\t\t} catch ( e ) {}\n\n\t\t\t// Make sure we set the data so it isn\'t changed later\n\t\t\tdataUser.set( elem, key, data );\n\t\t} else {\n\t\t\tdata = undefined;\n\t\t}\n\t}\n\treturn data;\n}\n\njQuery.extend( {\n\thasData: function( elem ) {\n\t\treturn dataUser.hasData( elem ) || dataPriv.hasData( elem );\n\t},\n\n\tdata: function( elem, name, data ) {\n\t\treturn dataUser.access( elem, name, data );\n\t},\n\n\tremoveData: function( elem, name ) {\n\t\tdataUser.remove( elem, name );\n\t},\n\n\t// TODO: Now that all calls to _data and _removeData have been replaced\n\t// with direct calls to dataPriv methods, these can be deprecated.\n\t_data: function( elem, name, data ) {\n\t\treturn dataPriv.access( elem, name, data );\n\t},\n\n\t_removeData: function( elem, name ) {\n\t\tdataPriv.remove( elem, name );\n\t}\n} );\n\njQuery.fn.extend( {\n\tdata: function( key, value ) {\n\t\tvar i, name, data,\n\t\t\telem = this[ 0 ],\n\t\t\tattrs = elem && elem.attributes;\n\n\t\t// Gets all values\n\t\tif ( key === undefined ) {\n\t\t\tif ( this.length ) {\n\t\t\t\tdata = dataUser.get( elem );\n\n\t\t\t\tif ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {\n\t\t\t\t\ti = attrs.length;\n\t\t\t\t\twhile ( i-- ) {\n\n\t\t\t\t\t\t// Support: IE 11 only\n\t\t\t\t\t\t// The attrs elements can be null (trac-14894)\n\t\t\t\t\t\tif ( attrs[ i ] ) {\n\t\t\t\t\t\t\tname = attrs[ i ].name;\n\t\t\t\t\t\t\tif ( name.indexOf( "data-" ) === 0 ) {\n\t\t\t\t\t\t\t\tname = camelCase( name.slice( 5 ) );\n\t\t\t\t\t\t\t\tdataAttr( elem, name, data[ name ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdataPriv.set( elem, "hasDataAttrs", true );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}\n\n\t\t// Sets multiple values\n\t\tif ( typeof key === "object" ) {\n\t\t\treturn this.each( function() {\n\t\t\t\tdataUser.set( this, key );\n\t\t\t} );\n\t\t}\n\n\t\treturn access( this, function( value ) {\n\t\t\tvar data;\n\n\t\t\t// The calling jQuery object (element matches) is not empty\n\t\t\t// (and therefore has an element appears at this[ 0 ]) and the\n\t\t\t// `value` parameter was not undefined. An empty jQuery object\n\t\t\t// will result in `undefined` for elem = this[ 0 ] which will\n\t\t\t// throw an exception if an attempt to read a data cache is made.\n\t\t\tif ( elem && value === undefined ) {\n\n\t\t\t\t// Attempt to get data from the cache\n\t\t\t\t// The key will always be camelCased in Data\n\t\t\t\tdata = dataUser.get( elem, key );\n\t\t\t\tif ( data !== undefined ) {\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\n\t\t\t\t// Attempt to "discover" the data in\n\t\t\t\t// HTML5 custom data-* attrs\n\t\t\t\tdata = dataAttr( elem, key );\n\t\t\t\tif ( data !== undefined ) {\n\t\t\t\t\treturn data;\n\t\t\t\t}\n\n\t\t\t\t// We tried really hard, but the data doesn\'t exist.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Set the data...\n\t\t\tthis.each( function() {\n\n\t\t\t\t// We always store the camelCased key\n\t\t\t\tdataUser.set( this, key, value );\n\t\t\t} );\n\t\t}, null, value, arguments.length > 1, null, true );\n\t},\n\n\tremoveData: function( key ) {\n\t\treturn this.each( function() {\n\t\t\tdataUser.remove( this, key );\n\t\t} );\n\t}\n} );\n\n\njQuery.extend( {\n\tqueue: function( elem, type, data ) {\n\t\tvar queue;\n\n\t\tif ( elem ) {\n\t\t\ttype = ( type || "fx" ) + "queue";\n\t\t\tqueue = dataPriv.get( elem, type );\n\n\t\t\t// Speed up dequeue by getting out quickly if this is just a lookup\n\t\t\tif ( data ) {\n\t\t\t\tif ( !queue || Array.isArray( data ) ) {\n\t\t\t\t\tqueue = dataPriv.access( elem, type, jQuery.makeArray( data ) );\n\t\t\t\t} else {\n\t\t\t\t\tqueue.push( data );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn queue || [];\n\t\t}\n\t},\n\n\tdequeue: function( elem, type ) {\n\t\ttype = type || "fx";\n\n\t\tvar queue = jQuery.queue( elem, type ),\n\t\t\tstartLength = queue.length,\n\t\t\tfn = queue.shift(),\n\t\t\thooks = jQuery._queueHooks( elem, type ),\n\t\t\tnext = function() {\n\t\t\t\tjQuery.dequeue( elem, type );\n\t\t\t};\n\n\t\t// If the fx queue is dequeued, always remove the progress sentinel\n\t\tif ( fn === "inprogress" ) {\n\t\t\tfn = queue.shift();\n\t\t\tstartLength--;\n\t\t}\n\n\t\tif ( fn ) {\n\n\t\t\t// Add a progress sentinel to prevent the fx queue from being\n\t\t\t// automatically dequeued\n\t\t\tif ( type === "fx" ) {\n\t\t\t\tqueue.unshift( "inprogress" );\n\t\t\t}\n\n\t\t\t// Clear up the last queue stop function\n\t\t\tdelete hooks.stop;\n\t\t\tfn.call( elem, next, hooks );\n\t\t}\n\n\t\tif ( !startLength && hooks ) {\n\t\t\thooks.empty.fire();\n\t\t}\n\t},\n\n\t// Not public - generate a queueHooks object, or return the current one\n\t_queueHooks: function( elem, type ) {\n\t\tvar key = type + "queueHooks";\n\t\treturn dataPriv.get( elem, key ) || dataPriv.access( elem, key, {\n\t\t\tempty: jQuery.Callbacks( "once memory" ).add( function() {\n\t\t\t\tdataPriv.remove( elem, [ type + "queue", key ] );\n\t\t\t} )\n\t\t} );\n\t}\n} );\n\njQuery.fn.extend( {\n\tqueue: function( type, data ) {\n\t\tvar setter = 2;\n\n\t\tif ( typeof type !== "string" ) {\n\t\t\tdata = type;\n\t\t\ttype = "fx";\n\t\t\tsetter--;\n\t\t}\n\n\t\tif ( arguments.length < setter ) {\n\t\t\treturn jQuery.queue( this[ 0 ], type );\n\t\t}\n\n\t\treturn data === undefined ?\n\t\t\tthis :\n\t\t\tthis.each( function() {\n\t\t\t\tvar queue = jQuery.queue( this, type, data );\n\n\t\t\t\t// Ensure a hooks for this queue\n\t\t\t\tjQuery._queueHooks( this, type );\n\n\t\t\t\tif ( type === "fx" && queue[ 0 ] !== "inprogress" ) {\n\t\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t\t}\n\t\t\t} );\n\t},\n\tdequeue: function( type ) {\n\t\treturn this.each( function() {\n\t\t\tjQuery.dequeue( this, type );\n\t\t} );\n\t},\n\tclearQueue: function( type ) {\n\t\treturn this.queue( type || "fx", [] );\n\t},\n\n\t// Get a promise resolved when queues of a certain type\n\t// are emptied (fx is the type by default)\n\tpromise: function( type, obj ) {\n\t\tvar tmp,\n\t\t\tcount = 1,\n\t\t\tdefer = jQuery.Deferred(),\n\t\t\telements = this,\n\t\t\ti = this.length,\n\t\t\tresolve = function() {\n\t\t\t\tif ( !( --count ) ) {\n\t\t\t\t\tdefer.resolveWith( elements, [ elements ] );\n\t\t\t\t}\n\t\t\t};\n\n\t\tif ( typeof type !== "string" ) {\n\t\t\tobj = type;\n\t\t\ttype = undefined;\n\t\t}\n\t\ttype = type || "fx";\n\n\t\twhile ( i-- ) {\n\t\t\ttmp = dataPriv.get( elements[ i ], type + "queueHooks" );\n\t\t\tif ( tmp && tmp.empty ) {\n\t\t\t\tcount++;\n\t\t\t\ttmp.empty.add( resolve );\n\t\t\t}\n\t\t}\n\t\tresolve();\n\t\treturn defer.promise( obj );\n\t}\n} );\nvar pnum = ( /[+-]?(?:\\d*\\.|)\\d+(?:[eE][+-]?\\d+|)/ ).source;\n\nvar rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );\n\n\nvar cssExpand = [ "Top", "Right", "Bottom", "Left" ];\n\nvar documentElement = document.documentElement;\n\n\n\n\tvar isAttached = function( elem ) {\n\t\t\treturn jQuery.contains( elem.ownerDocument, elem );\n\t\t},\n\t\tcomposed = { composed: true };\n\n\t// Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only\n\t// Check attachment across shadow DOM boundaries when possible (gh-3504)\n\t// Support: iOS 10.0-10.2 only\n\t// Early iOS 10 versions support `attachShadow` but not `getRootNode`,\n\t// leading to errors. We need to check for `getRootNode`.\n\tif ( documentElement.getRootNode ) {\n\t\tisAttached = function( elem ) {\n\t\t\treturn jQuery.contains( elem.ownerDocument, elem ) ||\n\t\t\t\telem.getRootNode( composed ) === elem.ownerDocument;\n\t\t};\n\t}\nvar isHiddenWithinTree = function( elem, el ) {\n\n\t\t// isHiddenWithinTree might be called from jQuery#filter function;\n\t\t// in that case, element will be second argument\n\t\telem = el || elem;\n\n\t\t// Inline style trumps all\n\t\treturn elem.style.display === "none" ||\n\t\t\telem.style.display === "" &&\n\n\t\t\t// Otherwise, check computed style\n\t\t\t// Support: Firefox <=43 - 45\n\t\t\t// Disconnected elements can have computed display: none, so first confirm that elem is\n\t\t\t// in the document.\n\t\t\tisAttached( elem ) &&\n\n\t\t\tjQuery.css( elem, "display" ) === "none";\n\t};\n\n\n\nfunction adjustCSS( elem, prop, valueParts, tween ) {\n\tvar adjusted, scale,\n\t\tmaxIterations = 20,\n\t\tcurrentValue = tween ?\n\t\t\tfunction() {\n\t\t\t\treturn tween.cur();\n\t\t\t} :\n\t\t\tfunction() {\n\t\t\t\treturn jQuery.css( elem, prop, "" );\n\t\t\t},\n\t\tinitial = currentValue(),\n\t\tunit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),\n\n\t\t// Starting value computation is required for potential unit mismatches\n\t\tinitialInUnit = elem.nodeType &&\n\t\t\t( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&\n\t\t\trcssNum.exec( jQuery.css( elem, prop ) );\n\n\tif ( initialInUnit && initialInUnit[ 3 ] !== unit ) {\n\n\t\t// Support: Firefox <=54\n\t\t// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)\n\t\tinitial = initial / 2;\n\n\t\t// Trust units reported by jQuery.css\n\t\tunit = unit || initialInUnit[ 3 ];\n\n\t\t// Iteratively approximate from a nonzero starting point\n\t\tinitialInUnit = +initial || 1;\n\n\t\twhile ( maxIterations-- ) {\n\n\t\t\t// Evaluate and update our best guess (doubling guesses that zero out).\n\t\t\t// Finish if the scale equals or crosses 1 (making the old*new product non-positive).\n\t\t\tjQuery.style( elem, prop, initialInUnit + unit );\n\t\t\tif ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {\n\t\t\t\tmaxIterations = 0;\n\t\t\t}\n\t\t\tinitialInUnit = initialInUnit / scale;\n\n\t\t}\n\n\t\tinitialInUnit = initialInUnit * 2;\n\t\tjQuery.style( elem, prop, initialInUnit + unit );\n\n\t\t// Make sure we update the tween properties later on\n\t\tvalueParts = valueParts || [];\n\t}\n\n\tif ( valueParts ) {\n\t\tinitialInUnit = +initialInUnit || +initial || 0;\n\n\t\t// Apply relative offset (+=/-=) if specified\n\t\tadjusted = valueParts[ 1 ] ?\n\t\t\tinitialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :\n\t\t\t+valueParts[ 2 ];\n\t\tif ( tween ) {\n\t\t\ttween.unit = unit;\n\t\t\ttween.start = initialInUnit;\n\t\t\ttween.end = adjusted;\n\t\t}\n\t}\n\treturn adjusted;\n}\n\n\nvar defaultDisplayMap = {};\n\nfunction getDefaultDisplay( elem ) {\n\tvar temp,\n\t\tdoc = elem.ownerDocument,\n\t\tnodeName = elem.nodeName,\n\t\tdisplay = defaultDisplayMap[ nodeName ];\n\n\tif ( display ) {\n\t\treturn display;\n\t}\n\n\ttemp = doc.body.appendChild( doc.createElement( nodeName ) );\n\tdisplay = jQuery.css( temp, "display" );\n\n\ttemp.parentNode.removeChild( temp );\n\n\tif ( display === "none" ) {\n\t\tdisplay = "block";\n\t}\n\tdefaultDisplayMap[ nodeName ] = display;\n\n\treturn display;\n}\n\nfunction showHide( elements, show ) {\n\tvar display, elem,\n\t\tvalues = [],\n\t\tindex = 0,\n\t\tlength = elements.length;\n\n\t// Determine new display value for elements that need to change\n\tfor ( ; index < length; index++ ) {\n\t\telem = elements[ index ];\n\t\tif ( !elem.style ) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tdisplay = elem.style.display;\n\t\tif ( show ) {\n\n\t\t\t// Since we force visibility upon cascade-hidden elements, an immediate (and slow)\n\t\t\t// check is required in this first loop unless we have a nonempty display value (either\n\t\t\t// inline or about-to-be-restored)\n\t\t\tif ( display === "none" ) {\n\t\t\t\tvalues[ index ] = dataPriv.get( elem, "display" ) || null;\n\t\t\t\tif ( !values[ index ] ) {\n\t\t\t\t\telem.style.display = "";\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {\n\t\t\t\tvalues[ index ] = getDefaultDisplay( elem );\n\t\t\t}\n\t\t} else {\n\t\t\tif ( display !== "none" ) {\n\t\t\t\tvalues[ index ] = "none";\n\n\t\t\t\t// Remember what we\'re overwriting\n\t\t\t\tdataPriv.set( elem, "display", display );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set the display of the elements in a second loop to avoid constant reflow\n\tfor ( index = 0; index < length; index++ ) {\n\t\tif ( values[ index ] != null ) {\n\t\t\telements[ index ].style.display = values[ index ];\n\t\t}\n\t}\n\n\treturn elements;\n}\n\njQuery.fn.extend( {\n\tshow: function() {\n\t\treturn showHide( this, true );\n\t},\n\thide: function() {\n\t\treturn showHide( this );\n\t},\n\ttoggle: function( state ) {\n\t\tif ( typeof state === "boolean" ) {\n\t\t\treturn state ? this.show() : this.hide();\n\t\t}\n\n\t\treturn this.each( function() {\n\t\t\tif ( isHiddenWithinTree( this ) ) {\n\t\t\t\tjQuery( this ).show();\n\t\t\t} else {\n\t\t\t\tjQuery( this ).hide();\n\t\t\t}\n\t\t} );\n\t}\n} );\nvar rcheckableType = ( /^(?:checkbox|radio)$/i );\n\nvar rtagName = ( /<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)/i );\n\nvar rscriptType = ( /^$|^module$|\\/(?:java|ecma)script/i );\n\n\n\n( function() {\n\tvar fragment = document.createDocumentFragment(),\n\t\tdiv = fragment.appendChild( document.createElement( "div" ) ),\n\t\tinput = document.createElement( "input" );\n\n\t// Support: Android 4.0 - 4.3 only\n\t// Check state lost if the name is set (trac-11217)\n\t// Support: Windows Web Apps (WWA)\n\t// `name` and `type` must use .setAttribute for WWA (trac-14901)\n\tinput.setAttribute( "type", "radio" );\n\tinput.setAttribute( "checked", "checked" );\n\tinput.setAttribute( "name", "t" );\n\n\tdiv.appendChild( input );\n\n\t// Support: Android <=4.1 only\n\t// Older WebKit doesn\'t clone checked state correctly in fragments\n\tsupport.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;\n\n\t// Support: IE <=11 only\n\t// Make sure textarea (and checkbox) defaultValue is properly cloned\n\tdiv.innerHTML = "<textarea>x</textarea>";\n\tsupport.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;\n\n\t// Support: IE <=9 only\n\t// IE <=9 replaces <option> tags with their contents when inserted outside of\n\t// the select element.\n\tdiv.innerHTML = "<option></option>";\n\tsupport.option = !!div.lastChild;\n} )();\n\n\n// We have to close these tags to support XHTML (trac-13200)\nvar wrapMap = {\n\n\t// XHTML parsers do not magically insert elements in the\n\t// same way that tag soup parsers do. So we cannot shorten\n\t// this by omitting <tbody> or other required elements.\n\tthead: [ 1, "<table>", "</table>" ],\n\tcol: [ 2, "<table><colgroup>", "</colgroup></table>" ],\n\ttr: [ 2, "<table><tbody>", "</tbody></table>" ],\n\ttd: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],\n\n\t_default: [ 0, "", "" ]\n};\n\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\n// Support: IE <=9 only\nif ( !support.option ) {\n\twrapMap.optgroup = wrapMap.option = [ 1, "<select multiple=\'multiple\'>", "</select>" ];\n}\n\n\nfunction getAll( context, tag ) {\n\n\t// Support: IE <=9 - 11 only\n\t// Use typeof to avoid zero-argument method invocation on host objects (trac-15151)\n\tvar ret;\n\n\tif ( typeof context.getElementsByTagName !== "undefined" ) {\n\t\tret = context.getElementsByTagName( tag || "*" );\n\n\t} else if ( typeof context.querySelectorAll !== "undefined" ) {\n\t\tret = context.querySelectorAll( tag || "*" );\n\n\t} else {\n\t\tret = [];\n\t}\n\n\tif ( tag === undefined || tag && nodeName( context, tag ) ) {\n\t\treturn jQuery.merge( [ context ], ret );\n\t}\n\n\treturn ret;\n}\n\n\n// Mark scripts as having already been evaluated\nfunction setGlobalEval( elems, refElements ) {\n\tvar i = 0,\n\t\tl = elems.length;\n\n\tfor ( ; i < l; i++ ) {\n\t\tdataPriv.set(\n\t\t\telems[ i ],\n\t\t\t"globalEval",\n\t\t\t!refElements || dataPriv.get( refElements[ i ], "globalEval" )\n\t\t);\n\t}\n}\n\n\nvar rhtml = /<|&#?\\w+;/;\n\nfunction buildFragment( elems, context, scripts, selection, ignored ) {\n\tvar elem, tmp, tag, wrap, attached, j,\n\t\tfragment = context.createDocumentFragment(),\n\t\tnodes = [],\n\t\ti = 0,\n\t\tl = elems.length;\n\n\tfor ( ; i < l; i++ ) {\n\t\telem = elems[ i ];\n\n\t\tif ( elem || elem === 0 ) {\n\n\t\t\t// Add nodes directly\n\t\t\tif ( toType( elem ) === "object" ) {\n\n\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\tjQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );\n\n\t\t\t// Convert non-html into a text node\n\t\t\t} else if ( !rhtml.test( elem ) ) {\n\t\t\t\tnodes.push( context.createTextNode( elem ) );\n\n\t\t\t// Convert html into DOM nodes\n\t\t\t} else {\n\t\t\t\ttmp = tmp || fragment.appendChild( context.createElement( "div" ) );\n\n\t\t\t\t// Deserialize a standard representation\n\t\t\t\ttag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();\n\t\t\t\twrap = wrapMap[ tag ] || wrapMap._default;\n\t\t\t\ttmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];\n\n\t\t\t\t// Descend through wrappers to the right content\n\t\t\t\tj = wrap[ 0 ];\n\t\t\t\twhile ( j-- ) {\n\t\t\t\t\ttmp = tmp.lastChild;\n\t\t\t\t}\n\n\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\tjQuery.merge( nodes, tmp.childNodes );\n\n\t\t\t\t// Remember the top-level container\n\t\t\t\ttmp = fragment.firstChild;\n\n\t\t\t\t// Ensure the created nodes are orphaned (trac-12392)\n\t\t\t\ttmp.textContent = "";\n\t\t\t}\n\t\t}\n\t}\n\n\t// Remove wrapper from fragment\n\tfragment.textContent = "";\n\n\ti = 0;\n\twhile ( ( elem = nodes[ i++ ] ) ) {\n\n\t\t// Skip elements already in the context collection (trac-4087)\n\t\tif ( selection && jQuery.inArray( elem, selection ) > -1 ) {\n\t\t\tif ( ignored ) {\n\t\t\t\tignored.push( elem );\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\tattached = isAttached( elem );\n\n\t\t// Append to fragment\n\t\ttmp = getAll( fragment.appendChild( elem ), "script" );\n\n\t\t// Preserve script evaluation history\n\t\tif ( attached ) {\n\t\t\tsetGlobalEval( tmp );\n\t\t}\n\n\t\t// Capture executables\n\t\tif ( scripts ) {\n\t\t\tj = 0;\n\t\t\twhile ( ( elem = tmp[ j++ ] ) ) {\n\t\t\t\tif ( rscriptType.test( elem.type || "" ) ) {\n\t\t\t\t\tscripts.push( elem );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn fragment;\n}\n\n\nvar rtypenamespace = /^([^.]*)(?:\\.(.+)|)/;\n\nfunction returnTrue() {\n\treturn true;\n}\n\nfunction returnFalse() {\n\treturn false;\n}\n\nfunction on( elem, types, selector, data, fn, one ) {\n\tvar origFn, type;\n\n\t// Types can be a map of types/handlers\n\tif ( typeof types === "object" ) {\n\n\t\t// ( types-Object, selector, data )\n\t\tif ( typeof selector !== "string" ) {\n\n\t\t\t// ( types-Object, data )\n\t\t\tdata = data || selector;\n\t\t\tselector = undefined;\n\t\t}\n\t\tfor ( type in types ) {\n\t\t\ton( elem, type, selector, data, types[ type ], one );\n\t\t}\n\t\treturn elem;\n\t}\n\n\tif ( data == null && fn == null ) {\n\n\t\t// ( types, fn )\n\t\tfn = selector;\n\t\tdata = selector = undefined;\n\t} else if ( fn == null ) {\n\t\tif ( typeof selector === "string" ) {\n\n\t\t\t// ( types, selector, fn )\n\t\t\tfn = data;\n\t\t\tdata = undefined;\n\t\t} else {\n\n\t\t\t// ( types, data, fn )\n\t\t\tfn = data;\n\t\t\tdata = selector;\n\t\t\tselector = undefined;\n\t\t}\n\t}\n\tif ( fn === false ) {\n\t\tfn = returnFalse;\n\t} else if ( !fn ) {\n\t\treturn elem;\n\t}\n\n\tif ( one === 1 ) {\n\t\torigFn = fn;\n\t\tfn = function( event ) {\n\n\t\t\t// Can use an empty set, since event contains the info\n\t\t\tjQuery().off( event );\n\t\t\treturn origFn.apply( this, arguments );\n\t\t};\n\n\t\t// Use same guid so caller can remove using origFn\n\t\tfn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );\n\t}\n\treturn elem.each( function() {\n\t\tjQuery.event.add( this, types, fn, data, selector );\n\t} );\n}\n\n/*\n * Helper functions for managing events -- not part of the public interface.\n * Props to Dean Edwards\' addEvent library for many of the ideas.\n */\njQuery.event = {\n\n\tglobal: {},\n\n\tadd: function( elem, types, handler, data, selector ) {\n\n\t\tvar handleObjIn, eventHandle, tmp,\n\t\t\tevents, t, handleObj,\n\t\t\tspecial, handlers, type, namespaces, origType,\n\t\t\telemData = dataPriv.get( elem );\n\n\t\t// Only attach events to objects that accept data\n\t\tif ( !acceptData( elem ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Caller can pass in an object of custom data in lieu of the handler\n\t\tif ( handler.handler ) {\n\t\t\thandleObjIn = handler;\n\t\t\thandler = handleObjIn.handler;\n\t\t\tselector = handleObjIn.selector;\n\t\t}\n\n\t\t// Ensure that invalid selectors throw exceptions at attach time\n\t\t// Evaluate against documentElement in case elem is a non-element node (e.g., document)\n\t\tif ( selector ) {\n\t\t\tjQuery.find.matchesSelector( documentElement, selector );\n\t\t}\n\n\t\t// Make sure that the handler has a unique ID, used to find/remove it later\n\t\tif ( !handler.guid ) {\n\t\t\thandler.guid = jQuery.guid++;\n\t\t}\n\n\t\t// Init the element\'s event structure and main handler, if this is the first\n\t\tif ( !( events = elemData.events ) ) {\n\t\t\tevents = elemData.events = Object.create( null );\n\t\t}\n\t\tif ( !( eventHandle = elemData.handle ) ) {\n\t\t\teventHandle = elemData.handle = function( e ) {\n\n\t\t\t\t// Discard the second event of a jQuery.event.trigger() and\n\t\t\t\t// when an event is called after a page has unloaded\n\t\t\t\treturn typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?\n\t\t\t\t\tjQuery.event.dispatch.apply( elem, arguments ) : undefined;\n\t\t\t};\n\t\t}\n\n\t\t// Handle multiple events separated by a space\n\t\ttypes = ( types || "" ).match( rnothtmlwhite ) || [ "" ];\n\t\tt = types.length;\n\t\twhile ( t-- ) {\n\t\t\ttmp = rtypenamespace.exec( types[ t ] ) || [];\n\t\t\ttype = origType = tmp[ 1 ];\n\t\t\tnamespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();\n\n\t\t\t// There *must* be a type, no attaching namespace-only handlers\n\t\t\tif ( !type ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// If event changes its type, use the special event handlers for the changed type\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\t// If selector defined, determine special event api type, otherwise given type\n\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\n\t\t\t// Update special based on newly reset type\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\t// handleObj is passed to all event handlers\n\t\t\thandleObj = jQuery.extend( {\n\t\t\t\ttype: type,\n\t\t\t\torigType: origType,\n\t\t\t\tdata: data,\n\t\t\t\thandler: handler,\n\t\t\t\tguid: handler.guid,\n\t\t\t\tselector: selector,\n\t\t\t\tneedsContext: selector && jQuery.expr.match.needsContext.test( selector ),\n\t\t\t\tnamespace: namespaces.join( "." )\n\t\t\t}, handleObjIn );\n\n\t\t\t// Init the event handler queue if we\'re the first\n\t\t\tif ( !( handlers = events[ type ] ) ) {\n\t\t\t\thandlers = events[ type ] = [];\n\t\t\t\thandlers.delegateCount = 0;\n\n\t\t\t\t// Only use addEventListener if the special events handler returns false\n\t\t\t\tif ( !special.setup ||\n\t\t\t\t\tspecial.setup.call( elem, data, namespaces, eventHandle ) === false ) {\n\n\t\t\t\t\tif ( elem.addEventListener ) {\n\t\t\t\t\t\telem.addEventListener( type, eventHandle );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( special.add ) {\n\t\t\t\tspecial.add.call( elem, handleObj );\n\n\t\t\t\tif ( !handleObj.handler.guid ) {\n\t\t\t\t\thandleObj.handler.guid = handler.guid;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add to the element\'s handler list, delegates in front\n\t\t\tif ( selector ) {\n\t\t\t\thandlers.splice( handlers.delegateCount++, 0, handleObj );\n\t\t\t} else {\n\t\t\t\thandlers.push( handleObj );\n\t\t\t}\n\n\t\t\t// Keep track of which events have ever been used, for event optimization\n\t\t\tjQuery.event.global[ type ] = true;\n\t\t}\n\n\t},\n\n\t// Detach an event or set of events from an element\n\tremove: function( elem, types, handler, selector, mappedTypes ) {\n\n\t\tvar j, origCount, tmp,\n\t\t\tevents, t, handleObj,\n\t\t\tspecial, handlers, type, namespaces, origType,\n\t\t\telemData = dataPriv.hasData( elem ) && dataPriv.get( elem );\n\n\t\tif ( !elemData || !( events = elemData.events ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Once for each type.namespace in types; type may be omitted\n\t\ttypes = ( types || "" ).match( rnothtmlwhite ) || [ "" ];\n\t\tt = types.length;\n\t\twhile ( t-- ) {\n\t\t\ttmp = rtypenamespace.exec( types[ t ] ) || [];\n\t\t\ttype = origType = tmp[ 1 ];\n\t\t\tnamespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();\n\n\t\t\t// Unbind all events (on this namespace, if provided) for the element\n\t\t\tif ( !type ) {\n\t\t\t\tfor ( type in events ) {\n\t\t\t\t\tjQuery.event.remove( elem, type + types[ t ], handler, selector, true );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\t\t\thandlers = events[ type ] || [];\n\t\t\ttmp = tmp[ 2 ] &&\n\t\t\t\tnew RegExp( "(^|\\\\.)" + namespaces.join( "\\\\.(?:.*\\\\.|)" ) + "(\\\\.|$)" );\n\n\t\t\t// Remove matching events\n\t\t\torigCount = j = handlers.length;\n\t\t\twhile ( j-- ) {\n\t\t\t\thandleObj = handlers[ j ];\n\n\t\t\t\tif ( ( mappedTypes || origType === handleObj.origType ) &&\n\t\t\t\t\t( !handler || handler.guid === handleObj.guid ) &&\n\t\t\t\t\t( !tmp || tmp.test( handleObj.namespace ) ) &&\n\t\t\t\t\t( !selector || selector === handleObj.selector ||\n\t\t\t\t\t\tselector === "**" && handleObj.selector ) ) {\n\t\t\t\t\thandlers.splice( j, 1 );\n\n\t\t\t\t\tif ( handleObj.selector ) {\n\t\t\t\t\t\thandlers.delegateCount--;\n\t\t\t\t\t}\n\t\t\t\t\tif ( special.remove ) {\n\t\t\t\t\t\tspecial.remove.call( elem, handleObj );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove generic event handler if we removed something and no more handlers exist\n\t\t\t// (avoids potential for endless recursion during removal of special event handlers)\n\t\t\tif ( origCount && !handlers.length ) {\n\t\t\t\tif ( !special.teardown ||\n\t\t\t\t\tspecial.teardown.call( elem, namespaces, elemData.handle ) === false ) {\n\n\t\t\t\t\tjQuery.removeEvent( elem, type, elemData.handle );\n\t\t\t\t}\n\n\t\t\t\tdelete events[ type ];\n\t\t\t}\n\t\t}\n\n\t\t// Remove data and the expando if it\'s no longer used\n\t\tif ( jQuery.isEmptyObject( events ) ) {\n\t\t\tdataPriv.remove( elem, "handle events" );\n\t\t}\n\t},\n\n\tdispatch: function( nativeEvent ) {\n\n\t\tvar i, j, ret, matched, handleObj, handlerQueue,\n\t\t\targs = new Array( arguments.length ),\n\n\t\t\t// Make a writable jQuery.Event from the native event object\n\t\t\tevent = jQuery.event.fix( nativeEvent ),\n\n\t\t\thandlers = (\n\t\t\t\tdataPriv.get( this, "events" ) || Object.create( null )\n\t\t\t)[ event.type ] || [],\n\t\t\tspecial = jQuery.event.special[ event.type ] || {};\n\n\t\t// Use the fix-ed jQuery.Event rather than the (read-only) native event\n\t\targs[ 0 ] = event;\n\n\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\n\t\tevent.delegateTarget = this;\n\n\t\t// Call the preDispatch hook for the mapped type, and let it bail if desired\n\t\tif ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine handlers\n\t\thandlerQueue = jQuery.event.handlers.call( this, event, handlers );\n\n\t\t// Run delegates first; they may want to stop propagation beneath us\n\t\ti = 0;\n\t\twhile ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {\n\t\t\tevent.currentTarget = matched.elem;\n\n\t\t\tj = 0;\n\t\t\twhile ( ( handleObj = matched.handlers[ j++ ] ) &&\n\t\t\t\t!event.isImmediatePropagationStopped() ) {\n\n\t\t\t\t// If the event is namespaced, then each handler is only invoked if it is\n\t\t\t\t// specially universal or its namespaces are a superset of the event\'s.\n\t\t\t\tif ( !event.rnamespace || handleObj.namespace === false ||\n\t\t\t\t\tevent.rnamespace.test( handleObj.namespace ) ) {\n\n\t\t\t\t\tevent.handleObj = handleObj;\n\t\t\t\t\tevent.data = handleObj.data;\n\n\t\t\t\t\tret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||\n\t\t\t\t\t\thandleObj.handler ).apply( matched.elem, args );\n\n\t\t\t\t\tif ( ret !== undefined ) {\n\t\t\t\t\t\tif ( ( event.result = ret ) === false ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Call the postDispatch hook for the mapped type\n\t\tif ( special.postDispatch ) {\n\t\t\tspecial.postDispatch.call( this, event );\n\t\t}\n\n\t\treturn event.result;\n\t},\n\n\thandlers: function( event, handlers ) {\n\t\tvar i, handleObj, sel, matchedHandlers, matchedSelectors,\n\t\t\thandlerQueue = [],\n\t\t\tdelegateCount = handlers.delegateCount,\n\t\t\tcur = event.target;\n\n\t\t// Find delegate handlers\n\t\tif ( delegateCount &&\n\n\t\t\t// Support: IE <=9\n\t\t\t// Black-hole SVG <use> instance trees (trac-13180)\n\t\t\tcur.nodeType &&\n\n\t\t\t// Support: Firefox <=42\n\t\t\t// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)\n\t\t\t// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click\n\t\t\t// Support: IE 11 only\n\t\t\t// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)\n\t\t\t!( event.type === "click" && event.button >= 1 ) ) {\n\n\t\t\tfor ( ; cur !== this; cur = cur.parentNode || this ) {\n\n\t\t\t\t// Don\'t check non-elements (trac-13208)\n\t\t\t\t// Don\'t process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)\n\t\t\t\tif ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {\n\t\t\t\t\tmatchedHandlers = [];\n\t\t\t\t\tmatchedSelectors = {};\n\t\t\t\t\tfor ( i = 0; i < delegateCount; i++ ) {\n\t\t\t\t\t\thandleObj = handlers[ i ];\n\n\t\t\t\t\t\t// Don\'t conflict with Object.prototype properties (trac-13203)\n\t\t\t\t\t\tsel = handleObj.selector + " ";\n\n\t\t\t\t\t\tif ( matchedSelectors[ sel ] === undefined ) {\n\t\t\t\t\t\t\tmatchedSelectors[ sel ] = handleObj.needsContext ?\n\t\t\t\t\t\t\t\tjQuery( sel, this ).index( cur ) > -1 :\n\t\t\t\t\t\t\t\tjQuery.find( sel, this, null, [ cur ] ).length;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( matchedSelectors[ sel ] ) {\n\t\t\t\t\t\t\tmatchedHandlers.push( handleObj );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( matchedHandlers.length ) {\n\t\t\t\t\t\thandlerQueue.push( { elem: cur, handlers: matchedHandlers } );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Add the remaining (directly-bound) handlers\n\t\tcur = this;\n\t\tif ( delegateCount < handlers.length ) {\n\t\t\thandlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );\n\t\t}\n\n\t\treturn handlerQueue;\n\t},\n\n\taddProp: function( name, hook ) {\n\t\tObject.defineProperty( jQuery.Event.prototype, name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\n\t\t\tget: isFunction( hook ) ?\n\t\t\t\tfunction() {\n\t\t\t\t\tif ( this.originalEvent ) {\n\t\t\t\t\t\treturn hook( this.originalEvent );\n\t\t\t\t\t}\n\t\t\t\t} :\n\t\t\t\tfunction() {\n\t\t\t\t\tif ( this.originalEvent ) {\n\t\t\t\t\t\treturn this.originalEvent[ name ];\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\tset: function( value ) {\n\t\t\t\tObject.defineProperty( this, name, {\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tvalue: value\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t},\n\n\tfix: function( originalEvent ) {\n\t\treturn originalEvent[ jQuery.expando ] ?\n\t\t\toriginalEvent :\n\t\t\tnew jQuery.Event( originalEvent );\n\t},\n\n\tspecial: {\n\t\tload: {\n\n\t\t\t// Prevent triggered image.load events from bubbling to window.load\n\t\t\tnoBubble: true\n\t\t},\n\t\tclick: {\n\n\t\t\t// Utilize native event to ensure correct state for checkable inputs\n\t\t\tsetup: function( data ) {\n\n\t\t\t\t// For mutual compressibility with _default, replace `this` access with a local var.\n\t\t\t\t// `|| data` is dead code meant only to preserve the variable through minification.\n\t\t\t\tvar el = this || data;\n\n\t\t\t\t// Claim the first handler\n\t\t\t\tif ( rcheckableType.test( el.type ) &&\n\t\t\t\t\tel.click && nodeName( el, "input" ) ) {\n\n\t\t\t\t\t// dataPriv.set( el, "click", ... )\n\t\t\t\t\tleverageNative( el, "click", true );\n\t\t\t\t}\n\n\t\t\t\t// Return false to allow normal processing in the caller\n\t\t\t\treturn false;\n\t\t\t},\n\t\t\ttrigger: function( data ) {\n\n\t\t\t\t// For mutual compressibility with _default, replace `this` access with a local var.\n\t\t\t\t// `|| data` is dead code meant only to preserve the variable through minification.\n\t\t\t\tvar el = this || data;\n\n\t\t\t\t// Force setup before triggering a click\n\t\t\t\tif ( rcheckableType.test( el.type ) &&\n\t\t\t\t\tel.click && nodeName( el, "input" ) ) {\n\n\t\t\t\t\tleverageNative( el, "click" );\n\t\t\t\t}\n\n\t\t\t\t// Return non-false to allow normal event-path propagation\n\t\t\t\treturn true;\n\t\t\t},\n\n\t\t\t// For cross-browser consistency, suppress native .click() on links\n\t\t\t// Also prevent it if we\'re currently inside a leveraged native-event stack\n\t\t\t_default: function( event ) {\n\t\t\t\tvar target = event.target;\n\t\t\t\treturn rcheckableType.test( target.type ) &&\n\t\t\t\t\ttarget.click && nodeName( target, "input" ) &&\n\t\t\t\t\tdataPriv.get( target, "click" ) ||\n\t\t\t\t\tnodeName( target, "a" );\n\t\t\t}\n\t\t},\n\n\t\tbeforeunload: {\n\t\t\tpostDispatch: function( event ) {\n\n\t\t\t\t// Support: Firefox 20+\n\t\t\t\t// Firefox doesn\'t alert if the returnValue field is not set.\n\t\t\t\tif ( event.result !== undefined && event.originalEvent ) {\n\t\t\t\t\tevent.originalEvent.returnValue = event.result;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Ensure the presence of an event listener that handles manually-triggered\n// synthetic events by interrupting progress until reinvoked in response to\n// *native* events that it fires directly, ensuring that state changes have\n// already occurred before other listeners are invoked.\nfunction leverageNative( el, type, isSetup ) {\n\n\t// Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add\n\tif ( !isSetup ) {\n\t\tif ( dataPriv.get( el, type ) === undefined ) {\n\t\t\tjQuery.event.add( el, type, returnTrue );\n\t\t}\n\t\treturn;\n\t}\n\n\t// Register the controller as a special universal handler for all event namespaces\n\tdataPriv.set( el, type, false );\n\tjQuery.event.add( el, type, {\n\t\tnamespace: false,\n\t\thandler: function( event ) {\n\t\t\tvar result,\n\t\t\t\tsaved = dataPriv.get( this, type );\n\n\t\t\tif ( ( event.isTrigger & 1 ) && this[ type ] ) {\n\n\t\t\t\t// Interrupt processing of the outer synthetic .trigger()ed event\n\t\t\t\tif ( !saved ) {\n\n\t\t\t\t\t// Store arguments for use when handling the inner native event\n\t\t\t\t\t// There will always be at least one argument (an event object), so this array\n\t\t\t\t\t// will not be confused with a leftover capture object.\n\t\t\t\t\tsaved = slice.call( arguments );\n\t\t\t\t\tdataPriv.set( this, type, saved );\n\n\t\t\t\t\t// Trigger the native event and capture its result\n\t\t\t\t\tthis[ type ]();\n\t\t\t\t\tresult = dataPriv.get( this, type );\n\t\t\t\t\tdataPriv.set( this, type, false );\n\n\t\t\t\t\tif ( saved !== result ) {\n\n\t\t\t\t\t\t// Cancel the outer synthetic event\n\t\t\t\t\t\tevent.stopImmediatePropagation();\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\n\t\t\t\t// If this is an inner synthetic event for an event with a bubbling surrogate\n\t\t\t\t// (focus or blur), assume that the surrogate already propagated from triggering\n\t\t\t\t// the native event and prevent that from happening again here.\n\t\t\t\t// This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the\n\t\t\t\t// bubbling surrogate propagates *after* the non-bubbling base), but that seems\n\t\t\t\t// less bad than duplication.\n\t\t\t\t} else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {\n\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t}\n\n\t\t\t// If this is a native event triggered above, everything is now in order\n\t\t\t// Fire an inner synthetic event with the original arguments\n\t\t\t} else if ( saved ) {\n\n\t\t\t\t// ...and capture the result\n\t\t\t\tdataPriv.set( this, type, jQuery.event.trigger(\n\t\t\t\t\tsaved[ 0 ],\n\t\t\t\t\tsaved.slice( 1 ),\n\t\t\t\t\tthis\n\t\t\t\t) );\n\n\t\t\t\t// Abort handling of the native event by all jQuery handlers while allowing\n\t\t\t\t// native handlers on the same element to run. On target, this is achieved\n\t\t\t\t// by stopping immediate propagation just on the jQuery event. However,\n\t\t\t\t// the native event is re-wrapped by a jQuery one on each level of the\n\t\t\t\t// propagation so the only way to stop it for jQuery is to stop it for\n\t\t\t\t// everyone via native `stopPropagation()`. This is not a problem for\n\t\t\t\t// focus/blur which don\'t bubble, but it does also stop click on checkboxes\n\t\t\t\t// and radios. We accept this limitation.\n\t\t\t\tevent.stopPropagation();\n\t\t\t\tevent.isImmediatePropagationStopped = returnTrue;\n\t\t\t}\n\t\t}\n\t} );\n}\n\njQuery.removeEvent = function( elem, type, handle ) {\n\n\t// This "if" is needed for plain objects\n\tif ( elem.removeEventListener ) {\n\t\telem.removeEventListener( type, handle );\n\t}\n};\n\njQuery.Event = function( src, props ) {\n\n\t// Allow instantiation without the \'new\' keyword\n\tif ( !( this instanceof jQuery.Event ) ) {\n\t\treturn new jQuery.Event( src, props );\n\t}\n\n\t// Event object\n\tif ( src && src.type ) {\n\t\tthis.originalEvent = src;\n\t\tthis.type = src.type;\n\n\t\t// Events bubbling up the document may have been marked as prevented\n\t\t// by a handler lower down the tree; reflect the correct value.\n\t\tthis.isDefaultPrevented = src.defaultPrevented ||\n\t\t\t\tsrc.defaultPrevented === undefined &&\n\n\t\t\t\t// Support: Android <=2.3 only\n\t\t\t\tsrc.returnValue === false ?\n\t\t\treturnTrue :\n\t\t\treturnFalse;\n\n\t\t// Create target properties\n\t\t// Support: Safari <=6 - 7 only\n\t\t// Target should not be a text node (trac-504, trac-13143)\n\t\tthis.target = ( src.target && src.target.nodeType === 3 ) ?\n\t\t\tsrc.target.parentNode :\n\t\t\tsrc.target;\n\n\t\tthis.currentTarget = src.currentTarget;\n\t\tthis.relatedTarget = src.relatedTarget;\n\n\t// Event type\n\t} else {\n\t\tthis.type = src;\n\t}\n\n\t// Put explicitly provided properties onto the event object\n\tif ( props ) {\n\t\tjQuery.extend( this, props );\n\t}\n\n\t// Create a timestamp if incoming event doesn\'t have one\n\tthis.timeStamp = src && src.timeStamp || Date.now();\n\n\t// Mark it as fixed\n\tthis[ jQuery.expando ] = true;\n};\n\n// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\njQuery.Event.prototype = {\n\tconstructor: jQuery.Event,\n\tisDefaultPrevented: returnFalse,\n\tisPropagationStopped: returnFalse,\n\tisImmediatePropagationStopped: returnFalse,\n\tisSimulated: false,\n\n\tpreventDefault: function() {\n\t\tvar e = this.originalEvent;\n\n\t\tthis.isDefaultPrevented = returnTrue;\n\n\t\tif ( e && !this.isSimulated ) {\n\t\t\te.preventDefault();\n\t\t}\n\t},\n\tstopPropagation: function() {\n\t\tvar e = this.originalEvent;\n\n\t\tthis.isPropagationStopped = returnTrue;\n\n\t\tif ( e && !this.isSimulated ) {\n\t\t\te.stopPropagation();\n\t\t}\n\t},\n\tstopImmediatePropagation: function() {\n\t\tvar e = this.originalEvent;\n\n\t\tthis.isImmediatePropagationStopped = returnTrue;\n\n\t\tif ( e && !this.isSimulated ) {\n\t\t\te.stopImmediatePropagation();\n\t\t}\n\n\t\tthis.stopPropagation();\n\t}\n};\n\n// Includes all common event props including KeyEvent and MouseEvent specific props\njQuery.each( {\n\taltKey: true,\n\tbubbles: true,\n\tcancelable: true,\n\tchangedTouches: true,\n\tctrlKey: true,\n\tdetail: true,\n\teventPhase: true,\n\tmetaKey: true,\n\tpageX: true,\n\tpageY: true,\n\tshiftKey: true,\n\tview: true,\n\t"char": true,\n\tcode: true,\n\tcharCode: true,\n\tkey: true,\n\tkeyCode: true,\n\tbutton: true,\n\tbuttons: true,\n\tclientX: true,\n\tclientY: true,\n\toffsetX: true,\n\toffsetY: true,\n\tpointerId: true,\n\tpointerType: true,\n\tscreenX: true,\n\tscreenY: true,\n\ttargetTouches: true,\n\ttoElement: true,\n\ttouches: true,\n\twhich: true\n}, jQuery.event.addProp );\n\njQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {\n\n\tfunction focusMappedHandler( nativeEvent ) {\n\t\tif ( document.documentMode ) {\n\n\t\t\t// Support: IE 11+\n\t\t\t// Attach a single focusin/focusout handler on the document while someone wants\n\t\t\t// focus/blur. This is because the former are synchronous in IE while the latter\n\t\t\t// are async. In other browsers, all those handlers are invoked synchronously.\n\n\t\t\t// `handle` from private data would already wrap the event, but we need\n\t\t\t// to change the `type` here.\n\t\t\tvar handle = dataPriv.get( this, "handle" ),\n\t\t\t\tevent = jQuery.event.fix( nativeEvent );\n\t\t\tevent.type = nativeEvent.type === "focusin" ? "focus" : "blur";\n\t\t\tevent.isSimulated = true;\n\n\t\t\t// First, handle focusin/focusout\n\t\t\thandle( nativeEvent );\n\n\t\t\t// ...then, handle focus/blur\n\t\t\t//\n\t\t\t// focus/blur don\'t bubble while focusin/focusout do; simulate the former by only\n\t\t\t// invoking the handler at the lower level.\n\t\t\tif ( event.target === event.currentTarget ) {\n\n\t\t\t\t// The setup part calls `leverageNative`, which, in turn, calls\n\t\t\t\t// `jQuery.event.add`, so event handle will already have been set\n\t\t\t\t// by this point.\n\t\t\t\thandle( event );\n\t\t\t}\n\t\t} else {\n\n\t\t\t// For non-IE browsers, attach a single capturing handler on the document\n\t\t\t// while someone wants focusin/focusout.\n\t\t\tjQuery.event.simulate( delegateType, nativeEvent.target,\n\t\t\t\tjQuery.event.fix( nativeEvent ) );\n\t\t}\n\t}\n\n\tjQuery.event.special[ type ] = {\n\n\t\t// Utilize native event if possible so blur/focus sequence is correct\n\t\tsetup: function() {\n\n\t\t\tvar attaches;\n\n\t\t\t// Claim the first handler\n\t\t\t// dataPriv.set( this, "focus", ... )\n\t\t\t// dataPriv.set( this, "blur", ... )\n\t\t\tleverageNative( this, type, true );\n\n\t\t\tif ( document.documentMode ) {\n\n\t\t\t\t// Support: IE 9 - 11+\n\t\t\t\t// We use the same native handler for focusin & focus (and focusout & blur)\n\t\t\t\t// so we need to coordinate setup & teardown parts between those events.\n\t\t\t\t// Use `delegateType` as the key as `type` is already used by `leverageNative`.\n\t\t\t\tattaches = dataPriv.get( this, delegateType );\n\t\t\t\tif ( !attaches ) {\n\t\t\t\t\tthis.addEventListener( delegateType, focusMappedHandler );\n\t\t\t\t}\n\t\t\t\tdataPriv.set( this, delegateType, ( attaches || 0 ) + 1 );\n\t\t\t} else {\n\n\t\t\t\t// Return false to allow normal processing in the caller\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\ttrigger: function() {\n\n\t\t\t// Force setup before trigger\n\t\t\tleverageNative( this, type );\n\n\t\t\t// Return non-false to allow normal event-path propagation\n\t\t\treturn true;\n\t\t},\n\n\t\tteardown: function() {\n\t\t\tvar attaches;\n\n\t\t\tif ( document.documentMode ) {\n\t\t\t\tattaches = dataPriv.get( this, delegateType ) - 1;\n\t\t\t\tif ( !attaches ) {\n\t\t\t\t\tthis.removeEventListener( delegateType, focusMappedHandler );\n\t\t\t\t\tdataPriv.remove( this, delegateType );\n\t\t\t\t} else {\n\t\t\t\t\tdataPriv.set( this, delegateType, attaches );\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t// Return false to indicate standard teardown should be applied\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\n\t\t// Suppress native focus or blur if we\'re currently inside\n\t\t// a leveraged native-event stack\n\t\t_default: function( event ) {\n\t\t\treturn dataPriv.get( event.target, type );\n\t\t},\n\n\t\tdelegateType: delegateType\n\t};\n\n\t// Support: Firefox <=44\n\t// Firefox doesn\'t have focus(in | out) events\n\t// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787\n\t//\n\t// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1\n\t// focus(in | out) events fire after focus & blur events,\n\t// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order\n\t// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857\n\t//\n\t// Support: IE 9 - 11+\n\t// To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,\n\t// attach a single handler for both events in IE.\n\tjQuery.event.special[ delegateType ] = {\n\t\tsetup: function() {\n\n\t\t\t// Handle: regular nodes (via `this.ownerDocument`), window\n\t\t\t// (via `this.document`) & document (via `this`).\n\t\t\tvar doc = this.ownerDocument || this.document || this,\n\t\t\t\tdataHolder = document.documentMode ? this : doc,\n\t\t\t\tattaches = dataPriv.get( dataHolder, delegateType );\n\n\t\t\t// Support: IE 9 - 11+\n\t\t\t// We use the same native handler for focusin & focus (and focusout & blur)\n\t\t\t// so we need to coordinate setup & teardown parts between those events.\n\t\t\t// Use `delegateType` as the key as `type` is already used by `leverageNative`.\n\t\t\tif ( !attaches ) {\n\t\t\t\tif ( document.documentMode ) {\n\t\t\t\t\tthis.addEventListener( delegateType, focusMappedHandler );\n\t\t\t\t} else {\n\t\t\t\t\tdoc.addEventListener( type, focusMappedHandler, true );\n\t\t\t\t}\n\t\t\t}\n\t\t\tdataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 );\n\t\t},\n\t\tteardown: function() {\n\t\t\tvar doc = this.ownerDocument || this.document || this,\n\t\t\t\tdataHolder = document.documentMode ? this : doc,\n\t\t\t\tattaches = dataPriv.get( dataHolder, delegateType ) - 1;\n\n\t\t\tif ( !attaches ) {\n\t\t\t\tif ( document.documentMode ) {\n\t\t\t\t\tthis.removeEventListener( delegateType, focusMappedHandler );\n\t\t\t\t} else {\n\t\t\t\t\tdoc.removeEventListener( type, focusMappedHandler, true );\n\t\t\t\t}\n\t\t\t\tdataPriv.remove( dataHolder, delegateType );\n\t\t\t} else {\n\t\t\t\tdataPriv.set( dataHolder, delegateType, attaches );\n\t\t\t}\n\t\t}\n\t};\n} );\n\n// Create mouseenter/leave events using mouseover/out and event-time checks\n// so that event delegation works in jQuery.\n// Do the same for pointerenter/pointerleave and pointerover/pointerout\n//\n// Support: Safari 7 only\n// Safari sends mouseenter too often; see:\n// https://bugs.chromium.org/p/chromium/issues/detail?id=470258\n// for the description of the bug (it existed in older Chrome versions as well).\njQuery.each( {\n\tmouseenter: "mouseover",\n\tmouseleave: "mouseout",\n\tpointerenter: "pointerover",\n\tpointerleave: "pointerout"\n}, function( orig, fix ) {\n\tjQuery.event.special[ orig ] = {\n\t\tdelegateType: fix,\n\t\tbindType: fix,\n\n\t\thandle: function( event ) {\n\t\t\tvar ret,\n\t\t\t\ttarget = this,\n\t\t\t\trelated = event.relatedTarget,\n\t\t\t\thandleObj = event.handleObj;\n\n\t\t\t// For mouseenter/leave call the handler if related is outside the target.\n\t\t\t// NB: No relatedTarget if the mouse left/entered the browser window\n\t\t\tif ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {\n\t\t\t\tevent.type = handleObj.origType;\n\t\t\t\tret = handleObj.handler.apply( this, arguments );\n\t\t\t\tevent.type = fix;\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\t};\n} );\n\njQuery.fn.extend( {\n\n\ton: function( types, selector, data, fn ) {\n\t\treturn on( this, types, selector, data, fn );\n\t},\n\tone: function( types, selector, data, fn ) {\n\t\treturn on( this, types, selector, data, fn, 1 );\n\t},\n\toff: function( types, selector, fn ) {\n\t\tvar handleObj, type;\n\t\tif ( types && types.preventDefault && types.handleObj ) {\n\n\t\t\t// ( event ) dispatched jQuery.Event\n\t\t\thandleObj = types.handleObj;\n\t\t\tjQuery( types.delegateTarget ).off(\n\t\t\t\thandleObj.namespace ?\n\t\t\t\t\thandleObj.origType + "." + handleObj.namespace :\n\t\t\t\t\thandleObj.origType,\n\t\t\t\thandleObj.selector,\n\t\t\t\thandleObj.handler\n\t\t\t);\n\t\t\treturn this;\n\t\t}\n\t\tif ( typeof types === "object" ) {\n\n\t\t\t// ( types-object [, selector] )\n\t\t\tfor ( type in types ) {\n\t\t\t\tthis.off( type, selector, types[ type ] );\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t\tif ( selector === false || typeof selector === "function" ) {\n\n\t\t\t// ( types [, fn] )\n\t\t\tfn = selector;\n\t\t\tselector = undefined;\n\t\t}\n\t\tif ( fn === false ) {\n\t\t\tfn = returnFalse;\n\t\t}\n\t\treturn this.each( function() {\n\t\t\tjQuery.event.remove( this, types, fn, selector );\n\t\t} );\n\t}\n} );\n\n\nvar\n\n\t// Support: IE <=10 - 11, Edge 12 - 13 only\n\t// In IE/Edge using regex groups here causes severe slowdowns.\n\t// See https://connect.microsoft.com/IE/feedback/details/1736512/\n\trnoInnerhtml = /<script|<style|<link/i,\n\n\t// checked="checked" or checked\n\trchecked = /checked\\s*(?:[^=]|=\\s*.checked.)/i,\n\n\trcleanScript = /^\\s*<!\\[CDATA\\[|\\]\\]>\\s*$/g;\n\n// Prefer a tbody over its parent table for containing new rows\nfunction manipulationTarget( elem, content ) {\n\tif ( nodeName( elem, "table" ) &&\n\t\tnodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {\n\n\t\treturn jQuery( elem ).children( "tbody" )[ 0 ] || elem;\n\t}\n\n\treturn elem;\n}\n\n// Replace/restore the type attribute of script elements for safe DOM manipulation\nfunction disableScript( elem ) {\n\telem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;\n\treturn elem;\n}\nfunction restoreScript( elem ) {\n\tif ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {\n\t\telem.type = elem.type.slice( 5 );\n\t} else {\n\t\telem.removeAttribute( "type" );\n\t}\n\n\treturn elem;\n}\n\nfunction cloneCopyEvent( src, dest ) {\n\tvar i, l, type, pdataOld, udataOld, udataCur, events;\n\n\tif ( dest.nodeType !== 1 ) {\n\t\treturn;\n\t}\n\n\t// 1. Copy private data: events, handlers, etc.\n\tif ( dataPriv.hasData( src ) ) {\n\t\tpdataOld = dataPriv.get( src );\n\t\tevents = pdataOld.events;\n\n\t\tif ( events ) {\n\t\t\tdataPriv.remove( dest, "handle events" );\n\n\t\t\tfor ( type in events ) {\n\t\t\t\tfor ( i = 0, l = events[ type ].length; i < l; i++ ) {\n\t\t\t\t\tjQuery.event.add( dest, type, events[ type ][ i ] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// 2. Copy user data\n\tif ( dataUser.hasData( src ) ) {\n\t\tudataOld = dataUser.access( src );\n\t\tudataCur = jQuery.extend( {}, udataOld );\n\n\t\tdataUser.set( dest, udataCur );\n\t}\n}\n\n// Fix IE bugs, see support tests\nfunction fixInput( src, dest ) {\n\tvar nodeName = dest.nodeName.toLowerCase();\n\n\t// Fails to persist the checked state of a cloned checkbox or radio button.\n\tif ( nodeName === "input" && rcheckableType.test( src.type ) ) {\n\t\tdest.checked = src.checked;\n\n\t// Fails to return the selected option to the default selected state when cloning options\n\t} else if ( nodeName === "input" || nodeName === "textarea" ) {\n\t\tdest.defaultValue = src.defaultValue;\n\t}\n}\n\nfunction domManip( collection, args, callback, ignored ) {\n\n\t// Flatten any nested arrays\n\targs = flat( args );\n\n\tvar fragment, first, scripts, hasScripts, node, doc,\n\t\ti = 0,\n\t\tl = collection.length,\n\t\tiNoClone = l - 1,\n\t\tvalue = args[ 0 ],\n\t\tvalueIsFunction = isFunction( value );\n\n\t// We can\'t cloneNode fragments that contain checked, in WebKit\n\tif ( valueIsFunction ||\n\t\t\t( l > 1 && typeof value === "string" &&\n\t\t\t\t!support.checkClone && rchecked.test( value ) ) ) {\n\t\treturn collection.each( function( index ) {\n\t\t\tvar self = collection.eq( index );\n\t\t\tif ( valueIsFunction ) {\n\t\t\t\targs[ 0 ] = value.call( this, index, self.html() );\n\t\t\t}\n\t\t\tdomManip( self, args, callback, ignored );\n\t\t} );\n\t}\n\n\tif ( l ) {\n\t\tfragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );\n\t\tfirst = fragment.firstChild;\n\n\t\tif ( fragment.childNodes.length === 1 ) {\n\t\t\tfragment = first;\n\t\t}\n\n\t\t// Require either new content or an interest in ignored elements to invoke the callback\n\t\tif ( first || ignored ) {\n\t\t\tscripts = jQuery.map( getAll( fragment, "script" ), disableScript );\n\t\t\thasScripts = scripts.length;\n\n\t\t\t// Use the original fragment for the last item\n\t\t\t// instead of the first because it can end up\n\t\t\t// being emptied incorrectly in certain situations (trac-8070).\n\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\tnode = fragment;\n\n\t\t\t\tif ( i !== iNoClone ) {\n\t\t\t\t\tnode = jQuery.clone( node, true, true );\n\n\t\t\t\t\t// Keep references to cloned scripts for later restoration\n\t\t\t\t\tif ( hasScripts ) {\n\n\t\t\t\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t\t\t\t// push.apply(_, arraylike) throws on ancient WebKit\n\t\t\t\t\t\tjQuery.merge( scripts, getAll( node, "script" ) );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcallback.call( collection[ i ], node, i );\n\t\t\t}\n\n\t\t\tif ( hasScripts ) {\n\t\t\t\tdoc = scripts[ scripts.length - 1 ].ownerDocument;\n\n\t\t\t\t// Re-enable scripts\n\t\t\t\tjQuery.map( scripts, restoreScript );\n\n\t\t\t\t// Evaluate executable scripts on first document insertion\n\t\t\t\tfor ( i = 0; i < hasScripts; i++ ) {\n\t\t\t\t\tnode = scripts[ i ];\n\t\t\t\t\tif ( rscriptType.test( node.type || "" ) &&\n\t\t\t\t\t\t!dataPriv.access( node, "globalEval" ) &&\n\t\t\t\t\t\tjQuery.contains( doc, node ) ) {\n\n\t\t\t\t\t\tif ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {\n\n\t\t\t\t\t\t\t// Optional AJAX dependency, but won\'t run scripts if not present\n\t\t\t\t\t\t\tif ( jQuery._evalUrl && !node.noModule ) {\n\t\t\t\t\t\t\t\tjQuery._evalUrl( node.src, {\n\t\t\t\t\t\t\t\t\tnonce: node.nonce || node.getAttribute( "nonce" )\n\t\t\t\t\t\t\t\t}, doc );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// Unwrap a CDATA section containing script contents. This shouldn\'t be\n\t\t\t\t\t\t\t// needed as in XML documents they\'re already not visible when\n\t\t\t\t\t\t\t// inspecting element contents and in HTML documents they have no\n\t\t\t\t\t\t\t// meaning but we\'re preserving that logic for backwards compatibility.\n\t\t\t\t\t\t\t// This will be removed completely in 4.0. See gh-4904.\n\t\t\t\t\t\t\tDOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn collection;\n}\n\nfunction remove( elem, selector, keepData ) {\n\tvar node,\n\t\tnodes = selector ? jQuery.filter( selector, elem ) : elem,\n\t\ti = 0;\n\n\tfor ( ; ( node = nodes[ i ] ) != null; i++ ) {\n\t\tif ( !keepData && node.nodeType === 1 ) {\n\t\t\tjQuery.cleanData( getAll( node ) );\n\t\t}\n\n\t\tif ( node.parentNode ) {\n\t\t\tif ( keepData && isAttached( node ) ) {\n\t\t\t\tsetGlobalEval( getAll( node, "script" ) );\n\t\t\t}\n\t\t\tnode.parentNode.removeChild( node );\n\t\t}\n\t}\n\n\treturn elem;\n}\n\njQuery.extend( {\n\thtmlPrefilter: function( html ) {\n\t\treturn html;\n\t},\n\n\tclone: function( elem, dataAndEvents, deepDataAndEvents ) {\n\t\tvar i, l, srcElements, destElements,\n\t\t\tclone = elem.cloneNode( true ),\n\t\t\tinPage = isAttached( elem );\n\n\t\t// Fix IE cloning issues\n\t\tif ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&\n\t\t\t\t!jQuery.isXMLDoc( elem ) ) {\n\n\t\t\t// We eschew jQuery#find here for performance reasons:\n\t\t\t// https://jsperf.com/getall-vs-sizzle/2\n\t\t\tdestElements = getAll( clone );\n\t\t\tsrcElements = getAll( elem );\n\n\t\t\tfor ( i = 0, l = srcElements.length; i < l; i++ ) {\n\t\t\t\tfixInput( srcElements[ i ], destElements[ i ] );\n\t\t\t}\n\t\t}\n\n\t\t// Copy the events from the original to the clone\n\t\tif ( dataAndEvents ) {\n\t\t\tif ( deepDataAndEvents ) {\n\t\t\t\tsrcElements = srcElements || getAll( elem );\n\t\t\t\tdestElements = destElements || getAll( clone );\n\n\t\t\t\tfor ( i = 0, l = srcElements.length; i < l; i++ ) {\n\t\t\t\t\tcloneCopyEvent( srcElements[ i ], destElements[ i ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcloneCopyEvent( elem, clone );\n\t\t\t}\n\t\t}\n\n\t\t// Preserve script evaluation history\n\t\tdestElements = getAll( clone, "script" );\n\t\tif ( destElements.length > 0 ) {\n\t\t\tsetGlobalEval( destElements, !inPage && getAll( elem, "script" ) );\n\t\t}\n\n\t\t// Return the cloned set\n\t\treturn clone;\n\t},\n\n\tcleanData: function( elems ) {\n\t\tvar data, elem, type,\n\t\t\tspecial = jQuery.event.special,\n\t\t\ti = 0;\n\n\t\tfor ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {\n\t\t\tif ( acceptData( elem ) ) {\n\t\t\t\tif ( ( data = elem[ dataPriv.expando ] ) ) {\n\t\t\t\t\tif ( data.events ) {\n\t\t\t\t\t\tfor ( type in data.events ) {\n\t\t\t\t\t\t\tif ( special[ type ] ) {\n\t\t\t\t\t\t\t\tjQuery.event.remove( elem, type );\n\n\t\t\t\t\t\t\t// This is a shortcut to avoid jQuery.event.remove\'s overhead\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tjQuery.removeEvent( elem, type, data.handle );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Support: Chrome <=35 - 45+\n\t\t\t\t\t// Assign undefined instead of using delete, see Data#remove\n\t\t\t\t\telem[ dataPriv.expando ] = undefined;\n\t\t\t\t}\n\t\t\t\tif ( elem[ dataUser.expando ] ) {\n\n\t\t\t\t\t// Support: Chrome <=35 - 45+\n\t\t\t\t\t// Assign undefined instead of using delete, see Data#remove\n\t\t\t\t\telem[ dataUser.expando ] = undefined;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n} );\n\njQuery.fn.extend( {\n\tdetach: function( selector ) {\n\t\treturn remove( this, selector, true );\n\t},\n\n\tremove: function( selector ) {\n\t\treturn remove( this, selector );\n\t},\n\n\ttext: function( value ) {\n\t\treturn access( this, function( value ) {\n\t\t\treturn value === undefined ?\n\t\t\t\tjQuery.text( this ) :\n\t\t\t\tthis.empty().each( function() {\n\t\t\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\t\t\tthis.textContent = value;\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t}, null, value, arguments.length );\n\t},\n\n\tappend: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\ttarget.appendChild( elem );\n\t\t\t}\n\t\t} );\n\t},\n\n\tprepend: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {\n\t\t\t\tvar target = manipulationTarget( this, elem );\n\t\t\t\ttarget.insertBefore( elem, target.firstChild );\n\t\t\t}\n\t\t} );\n\t},\n\n\tbefore: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.parentNode ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this );\n\t\t\t}\n\t\t} );\n\t},\n\n\tafter: function() {\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tif ( this.parentNode ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this.nextSibling );\n\t\t\t}\n\t\t} );\n\t},\n\n\tempty: function() {\n\t\tvar elem,\n\t\t\ti = 0;\n\n\t\tfor ( ; ( elem = this[ i ] ) != null; i++ ) {\n\t\t\tif ( elem.nodeType === 1 ) {\n\n\t\t\t\t// Prevent memory leaks\n\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\n\t\t\t\t// Remove any remaining nodes\n\t\t\t\telem.textContent = "";\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tclone: function( dataAndEvents, deepDataAndEvents ) {\n\t\tdataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n\t\tdeepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n\n\t\treturn this.map( function() {\n\t\t\treturn jQuery.clone( this, dataAndEvents, deepDataAndEvents );\n\t\t} );\n\t},\n\n\thtml: function( value ) {\n\t\treturn access( this, function( value ) {\n\t\t\tvar elem = this[ 0 ] || {},\n\t\t\t\ti = 0,\n\t\t\t\tl = this.length;\n\n\t\t\tif ( value === undefined && elem.nodeType === 1 ) {\n\t\t\t\treturn elem.innerHTML;\n\t\t\t}\n\n\t\t\t// See if we can take a shortcut and just use innerHTML\n\t\t\tif ( typeof value === "string" && !rnoInnerhtml.test( value ) &&\n\t\t\t\t!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {\n\n\t\t\t\tvalue = jQuery.htmlPrefilter( value );\n\n\t\t\t\ttry {\n\t\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\t\telem = this[ i ] || {};\n\n\t\t\t\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\t\tjQuery.cleanData( getAll( elem, false ) );\n\t\t\t\t\t\t\telem.innerHTML = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\telem = 0;\n\n\t\t\t\t// If using innerHTML throws an exception, use the fallback method\n\t\t\t\t} catch ( e ) {}\n\t\t\t}\n\n\t\t\tif ( elem ) {\n\t\t\t\tthis.empty().append( value );\n\t\t\t}\n\t\t}, null, value, arguments.length );\n\t},\n\n\treplaceWith: function() {\n\t\tvar ignored = [];\n\n\t\t// Make the changes, replacing each non-ignored context element with the new content\n\t\treturn domManip( this, arguments, function( elem ) {\n\t\t\tvar parent = this.parentNode;\n\n\t\t\tif ( jQuery.inArray( this, ignored ) < 0 ) {\n\t\t\t\tjQuery.cleanData( getAll( this ) );\n\t\t\t\tif ( parent ) {\n\t\t\t\t\tparent.replaceChild( elem, this );\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Force callback invocation\n\t\t}, ignored );\n\t}\n} );\n\njQuery.each( {\n\tappendTo: "append",\n\tprependTo: "prepend",\n\tinsertBefore: "before",\n\tinsertAfter: "after",\n\treplaceAll: "replaceWith"\n}, function( name, original ) {\n\tjQuery.fn[ name ] = function( selector ) {\n\t\tvar elems,\n\t\t\tret = [],\n\t\t\tinsert = jQuery( selector ),\n\t\t\tlast = insert.length - 1,\n\t\t\ti = 0;\n\n\t\tfor ( ; i <= last; i++ ) {\n\t\t\telems = i === last ? this : this.clone( true );\n\t\t\tjQuery( insert[ i ] )[ original ]( elems );\n\n\t\t\t// Support: Android <=4.0 only, PhantomJS 1 only\n\t\t\t// .get() because push.apply(_, arraylike) throws on ancient WebKit\n\t\t\tpush.apply( ret, elems.get() );\n\t\t}\n\n\t\treturn this.pushStack( ret );\n\t};\n} );\nvar rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );\n\nvar rcustomProp = /^--/;\n\n\nvar getStyles = function( elem ) {\n\n\t\t// Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150)\n\t\t// IE throws on elements created in popups\n\t\t// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"\n\t\tvar view = elem.ownerDocument.defaultView;\n\n\t\tif ( !view || !view.opener ) {\n\t\t\tview = window;\n\t\t}\n\n\t\treturn view.getComputedStyle( elem );\n\t};\n\nvar swap = function( elem, options, callback ) {\n\tvar ret, name,\n\t\told = {};\n\n\t// Remember the old values, and insert the new ones\n\tfor ( name in options ) {\n\t\told[ name ] = elem.style[ name ];\n\t\telem.style[ name ] = options[ name ];\n\t}\n\n\tret = callback.call( elem );\n\n\t// Revert the old values\n\tfor ( name in options ) {\n\t\telem.style[ name ] = old[ name ];\n\t}\n\n\treturn ret;\n};\n\n\nvar rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );\n\n\n\n( function() {\n\n\t// Executing both pixelPosition & boxSizingReliable tests require only one layout\n\t// so they\'re executed at the same time to save the second computation.\n\tfunction computeStyleTests() {\n\n\t\t// This is a singleton, we need to execute it only once\n\t\tif ( !div ) {\n\t\t\treturn;\n\t\t}\n\n\t\tcontainer.style.cssText = "position:absolute;left:-11111px;width:60px;" +\n\t\t\t"margin-top:1px;padding:0;border:0";\n\t\tdiv.style.cssText =\n\t\t\t"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +\n\t\t\t"margin:auto;border:1px;padding:1px;" +\n\t\t\t"width:60%;top:1%";\n\t\tdocumentElement.appendChild( container ).appendChild( div );\n\n\t\tvar divStyle = window.getComputedStyle( div );\n\t\tpixelPositionVal = divStyle.top !== "1%";\n\n\t\t// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44\n\t\treliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;\n\n\t\t// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3\n\t\t// Some styles come back with percentage values, even though they shouldn\'t\n\t\tdiv.style.right = "60%";\n\t\tpixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;\n\n\t\t// Support: IE 9 - 11 only\n\t\t// Detect misreporting of content dimensions for box-sizing:border-box elements\n\t\tboxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;\n\n\t\t// Support: IE 9 only\n\t\t// Detect overflow:scroll screwiness (gh-3699)\n\t\t// Support: Chrome <=64\n\t\t// Don\'t get tricked when zoom affects offsetWidth (gh-4029)\n\t\tdiv.style.position = "absolute";\n\t\tscrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;\n\n\t\tdocumentElement.removeChild( container );\n\n\t\t// Nullify the div so it wouldn\'t be stored in the memory and\n\t\t// it will also be a sign that checks already performed\n\t\tdiv = null;\n\t}\n\n\tfunction roundPixelMeasures( measure ) {\n\t\treturn Math.round( parseFloat( measure ) );\n\t}\n\n\tvar pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,\n\t\treliableTrDimensionsVal, reliableMarginLeftVal,\n\t\tcontainer = document.createElement( "div" ),\n\t\tdiv = document.createElement( "div" );\n\n\t// Finish early in limited (non-browser) environments\n\tif ( !div.style ) {\n\t\treturn;\n\t}\n\n\t// Support: IE <=9 - 11 only\n\t// Style of cloned element affects source element cloned (trac-8908)\n\tdiv.style.backgroundClip = "content-box";\n\tdiv.cloneNode( true ).style.backgroundClip = "";\n\tsupport.clearCloneStyle = div.style.backgroundClip === "content-box";\n\n\tjQuery.extend( support, {\n\t\tboxSizingReliable: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn boxSizingReliableVal;\n\t\t},\n\t\tpixelBoxStyles: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn pixelBoxStylesVal;\n\t\t},\n\t\tpixelPosition: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn pixelPositionVal;\n\t\t},\n\t\treliableMarginLeft: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn reliableMarginLeftVal;\n\t\t},\n\t\tscrollboxSize: function() {\n\t\t\tcomputeStyleTests();\n\t\t\treturn scrollboxSizeVal;\n\t\t},\n\n\t\t// Support: IE 9 - 11+, Edge 15 - 18+\n\t\t// IE/Edge misreport `getComputedStyle` of table rows with width/height\n\t\t// set in CSS while `offset*` properties report correct values.\n\t\t// Behavior in IE 9 is more subtle than in newer versions & it passes\n\t\t// some versions of this test; make sure not to make it pass there!\n\t\t//\n\t\t// Support: Firefox 70+\n\t\t// Only Firefox includes border widths\n\t\t// in computed dimensions. (gh-4529)\n\t\treliableTrDimensions: function() {\n\t\t\tvar table, tr, trChild, trStyle;\n\t\t\tif ( reliableTrDimensionsVal == null ) {\n\t\t\t\ttable = document.createElement( "table" );\n\t\t\t\ttr = document.createElement( "tr" );\n\t\t\t\ttrChild = document.createElement( "div" );\n\n\t\t\t\ttable.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";\n\t\t\t\ttr.style.cssText = "box-sizing:content-box;border:1px solid";\n\n\t\t\t\t// Support: Chrome 86+\n\t\t\t\t// Height set through cssText does not get applied.\n\t\t\t\t// Computed height then comes back as 0.\n\t\t\t\ttr.style.height = "1px";\n\t\t\t\ttrChild.style.height = "9px";\n\n\t\t\t\t// Support: Android 8 Chrome 86+\n\t\t\t\t// In our bodyBackground.html iframe,\n\t\t\t\t// display for all div elements is set to "inline",\n\t\t\t\t// which causes a problem only in Android 8 Chrome 86.\n\t\t\t\t// Ensuring the div is `display: block`\n\t\t\t\t// gets around this issue.\n\t\t\t\ttrChild.style.display = "block";\n\n\t\t\t\tdocumentElement\n\t\t\t\t\t.appendChild( table )\n\t\t\t\t\t.appendChild( tr )\n\t\t\t\t\t.appendChild( trChild );\n\n\t\t\t\ttrStyle = window.getComputedStyle( tr );\n\t\t\t\treliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +\n\t\t\t\t\tparseInt( trStyle.borderTopWidth, 10 ) +\n\t\t\t\t\tparseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;\n\n\t\t\t\tdocumentElement.removeChild( table );\n\t\t\t}\n\t\t\treturn reliableTrDimensionsVal;\n\t\t}\n\t} );\n} )();\n\n\nfunction curCSS( elem, name, computed ) {\n\tvar width, minWidth, maxWidth, ret,\n\t\tisCustomProp = rcustomProp.test( name ),\n\n\t\t// Support: Firefox 51+\n\t\t// Retrieving style before computed somehow\n\t\t// fixes an issue with getting wrong values\n\t\t// on detached elements\n\t\tstyle = elem.style;\n\n\tcomputed = computed || getStyles( elem );\n\n\t// getPropertyValue is needed for:\n\t// .css(\'filter\') (IE 9 only, trac-12537)\n\t// .css(\'--customProperty) (gh-3144)\n\tif ( computed ) {\n\n\t\t// Support: IE <=9 - 11+\n\t\t// IE only supports `"float"` in `getPropertyValue`; in computed styles\n\t\t// it\'s only available as `"cssFloat"`. We no longer modify properties\n\t\t// sent to `.css()` apart from camelCasing, so we need to check both.\n\t\t// Normally, this would create difference in behavior: if\n\t\t// `getPropertyValue` returns an empty string, the value returned\n\t\t// by `.css()` would be `undefined`. This is usually the case for\n\t\t// disconnected elements. However, in IE even disconnected elements\n\t\t// with no styles return `"none"` for `getPropertyValue( "float" )`\n\t\tret = computed.getPropertyValue( name ) || computed[ name ];\n\n\t\tif ( isCustomProp && ret ) {\n\n\t\t\t// Support: Firefox 105+, Chrome <=105+\n\t\t\t// Spec requires trimming whitespace for custom properties (gh-4926).\n\t\t\t// Firefox only trims leading whitespace. Chrome just collapses\n\t\t\t// both leading & trailing whitespace to a single space.\n\t\t\t//\n\t\t\t// Fall back to `undefined` if empty string returned.\n\t\t\t// This collapses a missing definition with property defined\n\t\t\t// and set to an empty string but there\'s no standard API\n\t\t\t// allowing us to differentiate them without a performance penalty\n\t\t\t// and returning `undefined` aligns with older jQuery.\n\t\t\t//\n\t\t\t// rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED\n\t\t\t// as whitespace while CSS does not, but this is not a problem\n\t\t\t// because CSS preprocessing replaces them with U+000A LINE FEED\n\t\t\t// (which *is* CSS whitespace)\n\t\t\t// https://www.w3.org/TR/css-syntax-3/#input-preprocessing\n\t\t\tret = ret.replace( rtrimCSS, "$1" ) || undefined;\n\t\t}\n\n\t\tif ( ret === "" && !isAttached( elem ) ) {\n\t\t\tret = jQuery.style( elem, name );\n\t\t}\n\n\t\t// A tribute to the "awesome hack by Dean Edwards"\n\t\t// Android Browser returns percentage for some values,\n\t\t// but width seems to be reliably pixels.\n\t\t// This is against the CSSOM draft spec:\n\t\t// https://drafts.csswg.org/cssom/#resolved-values\n\t\tif ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {\n\n\t\t\t// Remember the original values\n\t\t\twidth = style.width;\n\t\t\tminWidth = style.minWidth;\n\t\t\tmaxWidth = style.maxWidth;\n\n\t\t\t// Put in the new values to get a computed value out\n\t\t\tstyle.minWidth = style.maxWidth = style.width = ret;\n\t\t\tret = computed.width;\n\n\t\t\t// Revert the changed values\n\t\t\tstyle.width = width;\n\t\t\tstyle.minWidth = minWidth;\n\t\t\tstyle.maxWidth = maxWidth;\n\t\t}\n\t}\n\n\treturn ret !== undefined ?\n\n\t\t// Support: IE <=9 - 11 only\n\t\t// IE returns zIndex value as an integer.\n\t\tret + "" :\n\t\tret;\n}\n\n\nfunction addGetHookIf( conditionFn, hookFn ) {\n\n\t// Define the hook, we\'ll check on the first run if it\'s really needed.\n\treturn {\n\t\tget: function() {\n\t\t\tif ( conditionFn() ) {\n\n\t\t\t\t// Hook not needed (or it\'s not possible to use it due\n\t\t\t\t// to missing dependency), remove it.\n\t\t\t\tdelete this.get;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Hook needed; redefine it so that the support test is not executed again.\n\t\t\treturn ( this.get = hookFn ).apply( this, arguments );\n\t\t}\n\t};\n}\n\n\nvar cssPrefixes = [ "Webkit", "Moz", "ms" ],\n\temptyStyle = document.createElement( "div" ).style,\n\tvendorProps = {};\n\n// Return a vendor-prefixed property or undefined\nfunction vendorPropName( name ) {\n\n\t// Check for vendor prefixed names\n\tvar capName = name[ 0 ].toUpperCase() + name.slice( 1 ),\n\t\ti = cssPrefixes.length;\n\n\twhile ( i-- ) {\n\t\tname = cssPrefixes[ i ] + capName;\n\t\tif ( name in emptyStyle ) {\n\t\t\treturn name;\n\t\t}\n\t}\n}\n\n// Return a potentially-mapped jQuery.cssProps or vendor prefixed property\nfunction finalPropName( name ) {\n\tvar final = jQuery.cssProps[ name ] || vendorProps[ name ];\n\n\tif ( final ) {\n\t\treturn final;\n\t}\n\tif ( name in emptyStyle ) {\n\t\treturn name;\n\t}\n\treturn vendorProps[ name ] = vendorPropName( name ) || name;\n}\n\n\nvar\n\n\t// Swappable if display is none or starts with table\n\t// except "table", "table-cell", or "table-caption"\n\t// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display\n\trdisplayswap = /^(none|table(?!-c[ea]).+)/,\n\tcssShow = { position: "absolute", visibility: "hidden", display: "block" },\n\tcssNormalTransform = {\n\t\tletterSpacing: "0",\n\t\tfontWeight: "400"\n\t};\n\nfunction setPositiveNumber( _elem, value, subtract ) {\n\n\t// Any relative (+/-) values have already been\n\t// normalized at this point\n\tvar matches = rcssNum.exec( value );\n\treturn matches ?\n\n\t\t// Guard against undefined "subtract", e.g., when used as in cssHooks\n\t\tMath.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :\n\t\tvalue;\n}\n\nfunction boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {\n\tvar i = dimension === "width" ? 1 : 0,\n\t\textra = 0,\n\t\tdelta = 0,\n\t\tmarginDelta = 0;\n\n\t// Adjustment may not be necessary\n\tif ( box === ( isBorderBox ? "border" : "content" ) ) {\n\t\treturn 0;\n\t}\n\n\tfor ( ; i < 4; i += 2 ) {\n\n\t\t// Both box models exclude margin\n\t\t// Count margin delta separately to only add it after scroll gutter adjustment.\n\t\t// This is needed to make negative margins work with `outerHeight( true )` (gh-3982).\n\t\tif ( box === "margin" ) {\n\t\t\tmarginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );\n\t\t}\n\n\t\t// If we get here with a content-box, we\'re seeking "padding" or "border" or "margin"\n\t\tif ( !isBorderBox ) {\n\n\t\t\t// Add padding\n\t\t\tdelta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );\n\n\t\t\t// For "border" or "margin", add border\n\t\t\tif ( box !== "padding" ) {\n\t\t\t\tdelta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );\n\n\t\t\t// But still keep track of it otherwise\n\t\t\t} else {\n\t\t\t\textra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );\n\t\t\t}\n\n\t\t// If we get here with a border-box (content + padding + border), we\'re seeking "content" or\n\t\t// "padding" or "margin"\n\t\t} else {\n\n\t\t\t// For "content", subtract padding\n\t\t\tif ( box === "content" ) {\n\t\t\t\tdelta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );\n\t\t\t}\n\n\t\t\t// For "content" or "padding", subtract border\n\t\t\tif ( box !== "margin" ) {\n\t\t\t\tdelta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Account for positive content-box scroll gutter when requested by providing computedVal\n\tif ( !isBorderBox && computedVal >= 0 ) {\n\n\t\t// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border\n\t\t// Assuming integer scroll gutter, subtract the rest and round down\n\t\tdelta += Math.max( 0, Math.ceil(\n\t\t\telem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -\n\t\t\tcomputedVal -\n\t\t\tdelta -\n\t\t\textra -\n\t\t\t0.5\n\n\t\t// If offsetWidth/offsetHeight is unknown, then we can\'t determine content-box scroll gutter\n\t\t// Use an explicit zero to avoid NaN (gh-3964)\n\t\t) ) || 0;\n\t}\n\n\treturn delta + marginDelta;\n}\n\nfunction getWidthOrHeight( elem, dimension, extra ) {\n\n\t// Start with computed style\n\tvar styles = getStyles( elem ),\n\n\t\t// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).\n\t\t// Fake content-box until we know it\'s needed to know the true value.\n\t\tboxSizingNeeded = !support.boxSizingReliable() || extra,\n\t\tisBorderBox = boxSizingNeeded &&\n\t\t\tjQuery.css( elem, "boxSizing", false, styles ) === "border-box",\n\t\tvalueIsBorderBox = isBorderBox,\n\n\t\tval = curCSS( elem, dimension, styles ),\n\t\toffsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );\n\n\t// Support: Firefox <=54\n\t// Return a confounding non-pixel value or feign ignorance, as appropriate.\n\tif ( rnumnonpx.test( val ) ) {\n\t\tif ( !extra ) {\n\t\t\treturn val;\n\t\t}\n\t\tval = "auto";\n\t}\n\n\n\t// Support: IE 9 - 11 only\n\t// Use offsetWidth/offsetHeight for when box sizing is unreliable.\n\t// In those cases, the computed value can be trusted to be border-box.\n\tif ( ( !support.boxSizingReliable() && isBorderBox ||\n\n\t\t// Support: IE 10 - 11+, Edge 15 - 18+\n\t\t// IE/Edge misreport `getComputedStyle` of table rows with width/height\n\t\t// set in CSS while `offset*` properties report correct values.\n\t\t// Interestingly, in some cases IE 9 doesn\'t suffer from this issue.\n\t\t!support.reliableTrDimensions() && nodeName( elem, "tr" ) ||\n\n\t\t// Fall back to offsetWidth/offsetHeight when value is "auto"\n\t\t// This happens for inline elements with no explicit setting (gh-3571)\n\t\tval === "auto" ||\n\n\t\t// Support: Android <=4.1 - 4.3 only\n\t\t// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)\n\t\t!parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&\n\n\t\t// Make sure the element is visible & connected\n\t\telem.getClientRects().length ) {\n\n\t\tisBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";\n\n\t\t// Where available, offsetWidth/offsetHeight approximate border box dimensions.\n\t\t// Where not available (e.g., SVG), assume unreliable box-sizing and interpret the\n\t\t// retrieved value as a content box dimension.\n\t\tvalueIsBorderBox = offsetProp in elem;\n\t\tif ( valueIsBorderBox ) {\n\t\t\tval = elem[ offsetProp ];\n\t\t}\n\t}\n\n\t// Normalize "" and auto\n\tval = parseFloat( val ) || 0;\n\n\t// Adjust for the element\'s box model\n\treturn ( val +\n\t\tboxModelAdjustment(\n\t\t\telem,\n\t\t\tdimension,\n\t\t\textra || ( isBorderBox ? "border" : "content" ),\n\t\t\tvalueIsBorderBox,\n\t\t\tstyles,\n\n\t\t\t// Provide the current computed size to request scroll gutter calculation (gh-3589)\n\t\t\tval\n\t\t)\n\t) + "px";\n}\n\njQuery.extend( {\n\n\t// Add in style property hooks for overriding the default\n\t// behavior of getting and setting a style property\n\tcssHooks: {\n\t\topacity: {\n\t\t\tget: function( elem, computed ) {\n\t\t\t\tif ( computed ) {\n\n\t\t\t\t\t// We should always get a number back from opacity\n\t\t\t\t\tvar ret = curCSS( elem, "opacity" );\n\t\t\t\t\treturn ret === "" ? "1" : ret;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\t// Don\'t automatically add "px" to these possibly-unitless properties\n\tcssNumber: {\n\t\tanimationIterationCount: true,\n\t\taspectRatio: true,\n\t\tborderImageSlice: true,\n\t\tcolumnCount: true,\n\t\tflexGrow: true,\n\t\tflexShrink: true,\n\t\tfontWeight: true,\n\t\tgridArea: true,\n\t\tgridColumn: true,\n\t\tgridColumnEnd: true,\n\t\tgridColumnStart: true,\n\t\tgridRow: true,\n\t\tgridRowEnd: true,\n\t\tgridRowStart: true,\n\t\tlineHeight: true,\n\t\topacity: true,\n\t\torder: true,\n\t\torphans: true,\n\t\tscale: true,\n\t\twidows: true,\n\t\tzIndex: true,\n\t\tzoom: true,\n\n\t\t// SVG-related\n\t\tfillOpacity: true,\n\t\tfloodOpacity: true,\n\t\tstopOpacity: true,\n\t\tstrokeMiterlimit: true,\n\t\tstrokeOpacity: true\n\t},\n\n\t// Add in properties whose names you wish to fix before\n\t// setting or getting the value\n\tcssProps: {},\n\n\t// Get and set the style property on a DOM Node\n\tstyle: function( elem, name, value, extra ) {\n\n\t\t// Don\'t set styles on text and comment nodes\n\t\tif ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure that we\'re working with the right name\n\t\tvar ret, type, hooks,\n\t\t\torigName = camelCase( name ),\n\t\t\tisCustomProp = rcustomProp.test( name ),\n\t\t\tstyle = elem.style;\n\n\t\t// Make sure that we\'re working with the right name. We don\'t\n\t\t// want to query the value if it is a CSS custom property\n\t\t// since they are user-defined.\n\t\tif ( !isCustomProp ) {\n\t\t\tname = finalPropName( origName );\n\t\t}\n\n\t\t// Gets hook for the prefixed version, then unprefixed version\n\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n\t\t// Check if we\'re setting a value\n\t\tif ( value !== undefined ) {\n\t\t\ttype = typeof value;\n\n\t\t\t// Convert "+=" or "-=" to relative numbers (trac-7345)\n\t\t\tif ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {\n\t\t\t\tvalue = adjustCSS( elem, name, ret );\n\n\t\t\t\t// Fixes bug trac-9237\n\t\t\t\ttype = "number";\n\t\t\t}\n\n\t\t\t// Make sure that null and NaN values aren\'t set (trac-7116)\n\t\t\tif ( value == null || value !== value ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If a number was passed in, add the unit (except for certain CSS properties)\n\t\t\t// The isCustomProp check can be removed in jQuery 4.0 when we only auto-append\n\t\t\t// "px" to a few hardcoded values.\n\t\t\tif ( type === "number" && !isCustomProp ) {\n\t\t\t\tvalue += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );\n\t\t\t}\n\n\t\t\t// background-* props affect original clone\'s values\n\t\t\tif ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {\n\t\t\t\tstyle[ name ] = "inherit";\n\t\t\t}\n\n\t\t\t// If a hook was provided, use that value, otherwise just set the specified value\n\t\t\tif ( !hooks || !( "set" in hooks ) ||\n\t\t\t\t( value = hooks.set( elem, value, extra ) ) !== undefined ) {\n\n\t\t\t\tif ( isCustomProp ) {\n\t\t\t\t\tstyle.setProperty( name, value );\n\t\t\t\t} else {\n\t\t\t\t\tstyle[ name ] = value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else {\n\n\t\t\t// If a hook was provided get the non-computed value from there\n\t\t\tif ( hooks && "get" in hooks &&\n\t\t\t\t( ret = hooks.get( elem, false, extra ) ) !== undefined ) {\n\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\t// Otherwise just get the value from the style object\n\t\t\treturn style[ name ];\n\t\t}\n\t},\n\n\tcss: function( elem, name, extra, styles ) {\n\t\tvar val, num, hooks,\n\t\t\torigName = camelCase( name ),\n\t\t\tisCustomProp = rcustomProp.test( name );\n\n\t\t// Make sure that we\'re working with the right name. We don\'t\n\t\t// want to modify the value if it is a CSS custom property\n\t\t// since they are user-defined.\n\t\tif ( !isCustomProp ) {\n\t\t\tname = finalPropName( origName );\n\t\t}\n\n\t\t// Try prefixed name followed by the unprefixed name\n\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n\t\t// If a hook was provided get the computed value from there\n\t\tif ( hooks && "get" in hooks ) {\n\t\t\tval = hooks.get( elem, true, extra );\n\t\t}\n\n\t\t// Otherwise, if a way to get the computed value exists, use that\n\t\tif ( val === undefined ) {\n\t\t\tval = curCSS( elem, name, styles );\n\t\t}\n\n\t\t// Convert "normal" to computed value\n\t\tif ( val === "normal" && name in cssNormalTransform ) {\n\t\t\tval = cssNormalTransform[ name ];\n\t\t}\n\n\t\t// Make numeric if forced or a qualifier was provided and val looks numeric\n\t\tif ( extra === "" || extra ) {\n\t\t\tnum = parseFloat( val );\n\t\t\treturn extra === true || isFinite( num ) ? num || 0 : val;\n\t\t}\n\n\t\treturn val;\n\t}\n} );\n\njQuery.each( [ "height", "width" ], function( _i, dimension ) {\n\tjQuery.cssHooks[ dimension ] = {\n\t\tget: function( elem, computed, extra ) {\n\t\t\tif ( computed ) {\n\n\t\t\t\t// Certain elements can have dimension info if we invisibly show them\n\t\t\t\t// but it must have a current display style that would benefit\n\t\t\t\treturn rdisplayswap.test( jQuery.css( elem, "display" ) ) &&\n\n\t\t\t\t\t// Support: Safari 8+\n\t\t\t\t\t// Table columns in Safari have non-zero offsetWidth & zero\n\t\t\t\t\t// getBoundingClientRect().width unless display is changed.\n\t\t\t\t\t// Support: IE <=11 only\n\t\t\t\t\t// Running getBoundingClientRect on a disconnected node\n\t\t\t\t\t// in IE throws an error.\n\t\t\t\t\t( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?\n\t\t\t\t\tswap( elem, cssShow, function() {\n\t\t\t\t\t\treturn getWidthOrHeight( elem, dimension, extra );\n\t\t\t\t\t} ) :\n\t\t\t\t\tgetWidthOrHeight( elem, dimension, extra );\n\t\t\t}\n\t\t},\n\n\t\tset: function( elem, value, extra ) {\n\t\t\tvar matches,\n\t\t\t\tstyles = getStyles( elem ),\n\n\t\t\t\t// Only read styles.position if the test has a chance to fail\n\t\t\t\t// to avoid forcing a reflow.\n\t\t\t\tscrollboxSizeBuggy = !support.scrollboxSize() &&\n\t\t\t\t\tstyles.position === "absolute",\n\n\t\t\t\t// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)\n\t\t\t\tboxSizingNeeded = scrollboxSizeBuggy || extra,\n\t\t\t\tisBorderBox = boxSizingNeeded &&\n\t\t\t\t\tjQuery.css( elem, "boxSizing", false, styles ) === "border-box",\n\t\t\t\tsubtract = extra ?\n\t\t\t\t\tboxModelAdjustment(\n\t\t\t\t\t\telem,\n\t\t\t\t\t\tdimension,\n\t\t\t\t\t\textra,\n\t\t\t\t\t\tisBorderBox,\n\t\t\t\t\t\tstyles\n\t\t\t\t\t) :\n\t\t\t\t\t0;\n\n\t\t\t// Account for unreliable border-box dimensions by comparing offset* to computed and\n\t\t\t// faking a content-box to get border and padding (gh-3699)\n\t\t\tif ( isBorderBox && scrollboxSizeBuggy ) {\n\t\t\t\tsubtract -= Math.ceil(\n\t\t\t\t\telem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -\n\t\t\t\t\tparseFloat( styles[ dimension ] ) -\n\t\t\t\t\tboxModelAdjustment( elem, dimension, "border", false, styles ) -\n\t\t\t\t\t0.5\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Convert to pixels if value adjustment is needed\n\t\t\tif ( subtract && ( matches = rcssNum.exec( value ) ) &&\n\t\t\t\t( matches[ 3 ] || "px" ) !== "px" ) {\n\n\t\t\t\telem.style[ dimension ] = value;\n\t\t\t\tvalue = jQuery.css( elem, dimension );\n\t\t\t}\n\n\t\t\treturn setPositiveNumber( elem, value, subtract );\n\t\t}\n\t};\n} );\n\njQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,\n\tfunction( elem, computed ) {\n\t\tif ( computed ) {\n\t\t\treturn ( parseFloat( curCSS( elem, "marginLeft" ) ) ||\n\t\t\t\telem.getBoundingClientRect().left -\n\t\t\t\t\tswap( elem, { marginLeft: 0 }, function() {\n\t\t\t\t\t\treturn elem.getBoundingClientRect().left;\n\t\t\t\t\t} )\n\t\t\t) + "px";\n\t\t}\n\t}\n);\n\n// These hooks are used by animate to expand properties\njQuery.each( {\n\tmargin: "",\n\tpadding: "",\n\tborder: "Width"\n}, function( prefix, suffix ) {\n\tjQuery.cssHooks[ prefix + suffix ] = {\n\t\texpand: function( value ) {\n\t\t\tvar i = 0,\n\t\t\t\texpanded = {},\n\n\t\t\t\t// Assumes a single number if not a string\n\t\t\t\tparts = typeof value === "string" ? value.split( " " ) : [ value ];\n\n\t\t\tfor ( ; i < 4; i++ ) {\n\t\t\t\texpanded[ prefix + cssExpand[ i ] + suffix ] =\n\t\t\t\t\tparts[ i ] || parts[ i - 2 ] || parts[ 0 ];\n\t\t\t}\n\n\t\t\treturn expanded;\n\t\t}\n\t};\n\n\tif ( prefix !== "margin" ) {\n\t\tjQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;\n\t}\n} );\n\njQuery.fn.extend( {\n\tcss: function( name, value ) {\n\t\treturn access( this, function( elem, name, value ) {\n\t\t\tvar styles, len,\n\t\t\t\tmap = {},\n\t\t\t\ti = 0;\n\n\t\t\tif ( Array.isArray( name ) ) {\n\t\t\t\tstyles = getStyles( elem );\n\t\t\t\tlen = name.length;\n\n\t\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\t\tmap[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );\n\t\t\t\t}\n\n\t\t\t\treturn map;\n\t\t\t}\n\n\t\t\treturn value !== undefined ?\n\t\t\t\tjQuery.style( elem, name, value ) :\n\t\t\t\tjQuery.css( elem, name );\n\t\t}, name, value, arguments.length > 1 );\n\t}\n} );\n\n\nfunction Tween( elem, options, prop, end, easing ) {\n\treturn new Tween.prototype.init( elem, options, prop, end, easing );\n}\njQuery.Tween = Tween;\n\nTween.prototype = {\n\tconstructor: Tween,\n\tinit: function( elem, options, prop, end, easing, unit ) {\n\t\tthis.elem = elem;\n\t\tthis.prop = prop;\n\t\tthis.easing = easing || jQuery.easing._default;\n\t\tthis.options = options;\n\t\tthis.start = this.now = this.cur();\n\t\tthis.end = end;\n\t\tthis.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );\n\t},\n\tcur: function() {\n\t\tvar hooks = Tween.propHooks[ this.prop ];\n\n\t\treturn hooks && hooks.get ?\n\t\t\thooks.get( this ) :\n\t\t\tTween.propHooks._default.get( this );\n\t},\n\trun: function( percent ) {\n\t\tvar eased,\n\t\t\thooks = Tween.propHooks[ this.prop ];\n\n\t\tif ( this.options.duration ) {\n\t\t\tthis.pos = eased = jQuery.easing[ this.easing ](\n\t\t\t\tpercent, this.options.duration * percent, 0, 1, this.options.duration\n\t\t\t);\n\t\t} else {\n\t\t\tthis.pos = eased = percent;\n\t\t}\n\t\tthis.now = ( this.end - this.start ) * eased + this.start;\n\n\t\tif ( this.options.step ) {\n\t\t\tthis.options.step.call( this.elem, this.now, this );\n\t\t}\n\n\t\tif ( hooks && hooks.set ) {\n\t\t\thooks.set( this );\n\t\t} else {\n\t\t\tTween.propHooks._default.set( this );\n\t\t}\n\t\treturn this;\n\t}\n};\n\nTween.prototype.init.prototype = Tween.prototype;\n\nTween.propHooks = {\n\t_default: {\n\t\tget: function( tween ) {\n\t\t\tvar result;\n\n\t\t\t// Use a property on the element directly when it is not a DOM element,\n\t\t\t// or when there is no matching style property that exists.\n\t\t\tif ( tween.elem.nodeType !== 1 ||\n\t\t\t\ttween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {\n\t\t\t\treturn tween.elem[ tween.prop ];\n\t\t\t}\n\n\t\t\t// Passing an empty string as a 3rd parameter to .css will automatically\n\t\t\t// attempt a parseFloat and fallback to a string if the parse fails.\n\t\t\t// Simple values such as "10px" are parsed to Float;\n\t\t\t// complex values such as "rotate(1rad)" are returned as-is.\n\t\t\tresult = jQuery.css( tween.elem, tween.prop, "" );\n\n\t\t\t// Empty strings, null, undefined and "auto" are converted to 0.\n\t\t\treturn !result || result === "auto" ? 0 : result;\n\t\t},\n\t\tset: function( tween ) {\n\n\t\t\t// Use step hook for back compat.\n\t\t\t// Use cssHook if its there.\n\t\t\t// Use .style if available and use plain properties where available.\n\t\t\tif ( jQuery.fx.step[ tween.prop ] ) {\n\t\t\t\tjQuery.fx.step[ tween.prop ]( tween );\n\t\t\t} else if ( tween.elem.nodeType === 1 && (\n\t\t\t\tjQuery.cssHooks[ tween.prop ] ||\n\t\t\t\t\ttween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {\n\t\t\t\tjQuery.style( tween.elem, tween.prop, tween.now + tween.unit );\n\t\t\t} else {\n\t\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Support: IE <=9 only\n// Panic based approach to setting things on disconnected nodes\nTween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {\n\tset: function( tween ) {\n\t\tif ( tween.elem.nodeType && tween.elem.parentNode ) {\n\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t}\n\t}\n};\n\njQuery.easing = {\n\tlinear: function( p ) {\n\t\treturn p;\n\t},\n\tswing: function( p ) {\n\t\treturn 0.5 - Math.cos( p * Math.PI ) / 2;\n\t},\n\t_default: "swing"\n};\n\njQuery.fx = Tween.prototype.init;\n\n// Back compat <1.8 extension point\njQuery.fx.step = {};\n\n\n\n\nvar\n\tfxNow, inProgress,\n\trfxtypes = /^(?:toggle|show|hide)$/,\n\trrun = /queueHooks$/;\n\nfunction schedule() {\n\tif ( inProgress ) {\n\t\tif ( document.hidden === false && window.requestAnimationFrame ) {\n\t\t\twindow.requestAnimationFrame( schedule );\n\t\t} else {\n\t\t\twindow.setTimeout( schedule, jQuery.fx.interval );\n\t\t}\n\n\t\tjQuery.fx.tick();\n\t}\n}\n\n// Animations created synchronously will run synchronously\nfunction createFxNow() {\n\twindow.setTimeout( function() {\n\t\tfxNow = undefined;\n\t} );\n\treturn ( fxNow = Date.now() );\n}\n\n// Generate parameters to create a standard animation\nfunction genFx( type, includeWidth ) {\n\tvar which,\n\t\ti = 0,\n\t\tattrs = { height: type };\n\n\t// If we include width, step value is 1 to do all cssExpand values,\n\t// otherwise step value is 2 to skip over Left and Right\n\tincludeWidth = includeWidth ? 1 : 0;\n\tfor ( ; i < 4; i += 2 - includeWidth ) {\n\t\twhich = cssExpand[ i ];\n\t\tattrs[ "margin" + which ] = attrs[ "padding" + which ] = type;\n\t}\n\n\tif ( includeWidth ) {\n\t\tattrs.opacity = attrs.width = type;\n\t}\n\n\treturn attrs;\n}\n\nfunction createTween( value, prop, animation ) {\n\tvar tween,\n\t\tcollection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),\n\t\tindex = 0,\n\t\tlength = collection.length;\n\tfor ( ; index < length; index++ ) {\n\t\tif ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {\n\n\t\t\t// We\'re done with this property\n\t\t\treturn tween;\n\t\t}\n\t}\n}\n\nfunction defaultPrefilter( elem, props, opts ) {\n\tvar prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,\n\t\tisBox = "width" in props || "height" in props,\n\t\tanim = this,\n\t\torig = {},\n\t\tstyle = elem.style,\n\t\thidden = elem.nodeType && isHiddenWithinTree( elem ),\n\t\tdataShow = dataPriv.get( elem, "fxshow" );\n\n\t// Queue-skipping animations hijack the fx hooks\n\tif ( !opts.queue ) {\n\t\thooks = jQuery._queueHooks( elem, "fx" );\n\t\tif ( hooks.unqueued == null ) {\n\t\t\thooks.unqueued = 0;\n\t\t\toldfire = hooks.empty.fire;\n\t\t\thooks.empty.fire = function() {\n\t\t\t\tif ( !hooks.unqueued ) {\n\t\t\t\t\toldfire();\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\thooks.unqueued++;\n\n\t\tanim.always( function() {\n\n\t\t\t// Ensure the complete handler is called before this completes\n\t\t\tanim.always( function() {\n\t\t\t\thooks.unqueued--;\n\t\t\t\tif ( !jQuery.queue( elem, "fx" ).length ) {\n\t\t\t\t\thooks.empty.fire();\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t}\n\n\t// Detect show/hide animations\n\tfor ( prop in props ) {\n\t\tvalue = props[ prop ];\n\t\tif ( rfxtypes.test( value ) ) {\n\t\t\tdelete props[ prop ];\n\t\t\ttoggle = toggle || value === "toggle";\n\t\t\tif ( value === ( hidden ? "hide" : "show" ) ) {\n\n\t\t\t\t// Pretend to be hidden if this is a "show" and\n\t\t\t\t// there is still data from a stopped show/hide\n\t\t\t\tif ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {\n\t\t\t\t\thidden = true;\n\n\t\t\t\t// Ignore all other no-op show/hide data\n\t\t\t\t} else {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\torig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );\n\t\t}\n\t}\n\n\t// Bail out if this is a no-op like .hide().hide()\n\tpropTween = !jQuery.isEmptyObject( props );\n\tif ( !propTween && jQuery.isEmptyObject( orig ) ) {\n\t\treturn;\n\t}\n\n\t// Restrict "overflow" and "display" styles during box animations\n\tif ( isBox && elem.nodeType === 1 ) {\n\n\t\t// Support: IE <=9 - 11, Edge 12 - 15\n\t\t// Record all 3 overflow attributes because IE does not infer the shorthand\n\t\t// from identically-valued overflowX and overflowY and Edge just mirrors\n\t\t// the overflowX value there.\n\t\topts.overflow = [ style.overflow, style.overflowX, style.overflowY ];\n\n\t\t// Identify a display type, preferring old show/hide data over the CSS cascade\n\t\trestoreDisplay = dataShow && dataShow.display;\n\t\tif ( restoreDisplay == null ) {\n\t\t\trestoreDisplay = dataPriv.get( elem, "display" );\n\t\t}\n\t\tdisplay = jQuery.css( elem, "display" );\n\t\tif ( display === "none" ) {\n\t\t\tif ( restoreDisplay ) {\n\t\t\t\tdisplay = restoreDisplay;\n\t\t\t} else {\n\n\t\t\t\t// Get nonempty value(s) by temporarily forcing visibility\n\t\t\t\tshowHide( [ elem ], true );\n\t\t\t\trestoreDisplay = elem.style.display || restoreDisplay;\n\t\t\t\tdisplay = jQuery.css( elem, "display" );\n\t\t\t\tshowHide( [ elem ] );\n\t\t\t}\n\t\t}\n\n\t\t// Animate inline elements as inline-block\n\t\tif ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {\n\t\t\tif ( jQuery.css( elem, "float" ) === "none" ) {\n\n\t\t\t\t// Restore the original display value at the end of pure show/hide animations\n\t\t\t\tif ( !propTween ) {\n\t\t\t\t\tanim.done( function() {\n\t\t\t\t\t\tstyle.display = restoreDisplay;\n\t\t\t\t\t} );\n\t\t\t\t\tif ( restoreDisplay == null ) {\n\t\t\t\t\t\tdisplay = style.display;\n\t\t\t\t\t\trestoreDisplay = display === "none" ? "" : display;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstyle.display = "inline-block";\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( opts.overflow ) {\n\t\tstyle.overflow = "hidden";\n\t\tanim.always( function() {\n\t\t\tstyle.overflow = opts.overflow[ 0 ];\n\t\t\tstyle.overflowX = opts.overflow[ 1 ];\n\t\t\tstyle.overflowY = opts.overflow[ 2 ];\n\t\t} );\n\t}\n\n\t// Implement show/hide animations\n\tpropTween = false;\n\tfor ( prop in orig ) {\n\n\t\t// General show/hide setup for this element animation\n\t\tif ( !propTween ) {\n\t\t\tif ( dataShow ) {\n\t\t\t\tif ( "hidden" in dataShow ) {\n\t\t\t\t\thidden = dataShow.hidden;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );\n\t\t\t}\n\n\t\t\t// Store hidden/visible for toggle so `.stop().toggle()` "reverses"\n\t\t\tif ( toggle ) {\n\t\t\t\tdataShow.hidden = !hidden;\n\t\t\t}\n\n\t\t\t// Show elements before animating them\n\t\t\tif ( hidden ) {\n\t\t\t\tshowHide( [ elem ], true );\n\t\t\t}\n\n\t\t\t/* eslint-disable no-loop-func */\n\n\t\t\tanim.done( function() {\n\n\t\t\t\t/* eslint-enable no-loop-func */\n\n\t\t\t\t// The final step of a "hide" animation is actually hiding the element\n\t\t\t\tif ( !hidden ) {\n\t\t\t\t\tshowHide( [ elem ] );\n\t\t\t\t}\n\t\t\t\tdataPriv.remove( elem, "fxshow" );\n\t\t\t\tfor ( prop in orig ) {\n\t\t\t\t\tjQuery.style( elem, prop, orig[ prop ] );\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\t// Per-property setup\n\t\tpropTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );\n\t\tif ( !( prop in dataShow ) ) {\n\t\t\tdataShow[ prop ] = propTween.start;\n\t\t\tif ( hidden ) {\n\t\t\t\tpropTween.end = propTween.start;\n\t\t\t\tpropTween.start = 0;\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction propFilter( props, specialEasing ) {\n\tvar index, name, easing, value, hooks;\n\n\t// camelCase, specialEasing and expand cssHook pass\n\tfor ( index in props ) {\n\t\tname = camelCase( index );\n\t\teasing = specialEasing[ name ];\n\t\tvalue = props[ index ];\n\t\tif ( Array.isArray( value ) ) {\n\t\t\teasing = value[ 1 ];\n\t\t\tvalue = props[ index ] = value[ 0 ];\n\t\t}\n\n\t\tif ( index !== name ) {\n\t\t\tprops[ name ] = value;\n\t\t\tdelete props[ index ];\n\t\t}\n\n\t\thooks = jQuery.cssHooks[ name ];\n\t\tif ( hooks && "expand" in hooks ) {\n\t\t\tvalue = hooks.expand( value );\n\t\t\tdelete props[ name ];\n\n\t\t\t// Not quite $.extend, this won\'t overwrite existing keys.\n\t\t\t// Reusing \'index\' because we have the correct "name"\n\t\t\tfor ( index in value ) {\n\t\t\t\tif ( !( index in props ) ) {\n\t\t\t\t\tprops[ index ] = value[ index ];\n\t\t\t\t\tspecialEasing[ index ] = easing;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tspecialEasing[ name ] = easing;\n\t\t}\n\t}\n}\n\nfunction Animation( elem, properties, options ) {\n\tvar result,\n\t\tstopped,\n\t\tindex = 0,\n\t\tlength = Animation.prefilters.length,\n\t\tdeferred = jQuery.Deferred().always( function() {\n\n\t\t\t// Don\'t match elem in the :animated selector\n\t\t\tdelete tick.elem;\n\t\t} ),\n\t\ttick = function() {\n\t\t\tif ( stopped ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar currentTime = fxNow || createFxNow(),\n\t\t\t\tremaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),\n\n\t\t\t\t// Support: Android 2.3 only\n\t\t\t\t// Archaic crash bug won\'t allow us to use `1 - ( 0.5 || 0 )` (trac-12497)\n\t\t\t\ttemp = remaining / animation.duration || 0,\n\t\t\t\tpercent = 1 - temp,\n\t\t\t\tindex = 0,\n\t\t\t\tlength = animation.tweens.length;\n\n\t\t\tfor ( ; index < length; index++ ) {\n\t\t\t\tanimation.tweens[ index ].run( percent );\n\t\t\t}\n\n\t\t\tdeferred.notifyWith( elem, [ animation, percent, remaining ] );\n\n\t\t\t// If there\'s more to do, yield\n\t\t\tif ( percent < 1 && length ) {\n\t\t\t\treturn remaining;\n\t\t\t}\n\n\t\t\t// If this was an empty animation, synthesize a final progress notification\n\t\t\tif ( !length ) {\n\t\t\t\tdeferred.notifyWith( elem, [ animation, 1, 0 ] );\n\t\t\t}\n\n\t\t\t// Resolve the animation and report its conclusion\n\t\t\tdeferred.resolveWith( elem, [ animation ] );\n\t\t\treturn false;\n\t\t},\n\t\tanimation = deferred.promise( {\n\t\t\telem: elem,\n\t\t\tprops: jQuery.extend( {}, properties ),\n\t\t\topts: jQuery.extend( true, {\n\t\t\t\tspecialEasing: {},\n\t\t\t\teasing: jQuery.easing._default\n\t\t\t}, options ),\n\t\t\toriginalProperties: properties,\n\t\t\toriginalOptions: options,\n\t\t\tstartTime: fxNow || createFxNow(),\n\t\t\tduration: options.duration,\n\t\t\ttweens: [],\n\t\t\tcreateTween: function( prop, end ) {\n\t\t\t\tvar tween = jQuery.Tween( elem, animation.opts, prop, end,\n\t\t\t\t\tanimation.opts.specialEasing[ prop ] || animation.opts.easing );\n\t\t\t\tanimation.tweens.push( tween );\n\t\t\t\treturn tween;\n\t\t\t},\n\t\t\tstop: function( gotoEnd ) {\n\t\t\t\tvar index = 0,\n\n\t\t\t\t\t// If we are going to the end, we want to run all the tweens\n\t\t\t\t\t// otherwise we skip this part\n\t\t\t\t\tlength = gotoEnd ? animation.tweens.length : 0;\n\t\t\t\tif ( stopped ) {\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t\tstopped = true;\n\t\t\t\tfor ( ; index < length; index++ ) {\n\t\t\t\t\tanimation.tweens[ index ].run( 1 );\n\t\t\t\t}\n\n\t\t\t\t// Resolve when we played the last frame; otherwise, reject\n\t\t\t\tif ( gotoEnd ) {\n\t\t\t\t\tdeferred.notifyWith( elem, [ animation, 1, 0 ] );\n\t\t\t\t\tdeferred.resolveWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t} else {\n\t\t\t\t\tdeferred.rejectWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t}\n\t\t} ),\n\t\tprops = animation.props;\n\n\tpropFilter( props, animation.opts.specialEasing );\n\n\tfor ( ; index < length; index++ ) {\n\t\tresult = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );\n\t\tif ( result ) {\n\t\t\tif ( isFunction( result.stop ) ) {\n\t\t\t\tjQuery._queueHooks( animation.elem, animation.opts.queue ).stop =\n\t\t\t\t\tresult.stop.bind( result );\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t}\n\n\tjQuery.map( props, createTween, animation );\n\n\tif ( isFunction( animation.opts.start ) ) {\n\t\tanimation.opts.start.call( elem, animation );\n\t}\n\n\t// Attach callbacks from options\n\tanimation\n\t\t.progress( animation.opts.progress )\n\t\t.done( animation.opts.done, animation.opts.complete )\n\t\t.fail( animation.opts.fail )\n\t\t.always( animation.opts.always );\n\n\tjQuery.fx.timer(\n\t\tjQuery.extend( tick, {\n\t\t\telem: elem,\n\t\t\tanim: animation,\n\t\t\tqueue: animation.opts.queue\n\t\t} )\n\t);\n\n\treturn animation;\n}\n\njQuery.Animation = jQuery.extend( Animation, {\n\n\ttweeners: {\n\t\t"*": [ function( prop, value ) {\n\t\t\tvar tween = this.createTween( prop, value );\n\t\t\tadjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );\n\t\t\treturn tween;\n\t\t} ]\n\t},\n\n\ttweener: function( props, callback ) {\n\t\tif ( isFunction( props ) ) {\n\t\t\tcallback = props;\n\t\t\tprops = [ "*" ];\n\t\t} else {\n\t\t\tprops = props.match( rnothtmlwhite );\n\t\t}\n\n\t\tvar prop,\n\t\t\tindex = 0,\n\t\t\tlength = props.length;\n\n\t\tfor ( ; index < length; index++ ) {\n\t\t\tprop = props[ index ];\n\t\t\tAnimation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];\n\t\t\tAnimation.tweeners[ prop ].unshift( callback );\n\t\t}\n\t},\n\n\tprefilters: [ defaultPrefilter ],\n\n\tprefilter: function( callback, prepend ) {\n\t\tif ( prepend ) {\n\t\t\tAnimation.prefilters.unshift( callback );\n\t\t} else {\n\t\t\tAnimation.prefilters.push( callback );\n\t\t}\n\t}\n} );\n\njQuery.speed = function( speed, easing, fn ) {\n\tvar opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {\n\t\tcomplete: fn || !fn && easing ||\n\t\t\tisFunction( speed ) && speed,\n\t\tduration: speed,\n\t\teasing: fn && easing || easing && !isFunction( easing ) && easing\n\t};\n\n\t// Go to the end state if fx are off\n\tif ( jQuery.fx.off ) {\n\t\topt.duration = 0;\n\n\t} else {\n\t\tif ( typeof opt.duration !== "number" ) {\n\t\t\tif ( opt.duration in jQuery.fx.speeds ) {\n\t\t\t\topt.duration = jQuery.fx.speeds[ opt.duration ];\n\n\t\t\t} else {\n\t\t\t\topt.duration = jQuery.fx.speeds._default;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Normalize opt.queue - true/undefined/null -> "fx"\n\tif ( opt.queue == null || opt.queue === true ) {\n\t\topt.queue = "fx";\n\t}\n\n\t// Queueing\n\topt.old = opt.complete;\n\n\topt.complete = function() {\n\t\tif ( isFunction( opt.old ) ) {\n\t\t\topt.old.call( this );\n\t\t}\n\n\t\tif ( opt.queue ) {\n\t\t\tjQuery.dequeue( this, opt.queue );\n\t\t}\n\t};\n\n\treturn opt;\n};\n\njQuery.fn.extend( {\n\tfadeTo: function( speed, to, easing, callback ) {\n\n\t\t// Show any hidden elements after setting opacity to 0\n\t\treturn this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()\n\n\t\t\t// Animate to the value specified\n\t\t\t.end().animate( { opacity: to }, speed, easing, callback );\n\t},\n\tanimate: function( prop, speed, easing, callback ) {\n\t\tvar empty = jQuery.isEmptyObject( prop ),\n\t\t\toptall = jQuery.speed( speed, easing, callback ),\n\t\t\tdoAnimation = function() {\n\n\t\t\t\t// Operate on a copy of prop so per-property easing won\'t be lost\n\t\t\t\tvar anim = Animation( this, jQuery.extend( {}, prop ), optall );\n\n\t\t\t\t// Empty animations, or finishing resolves immediately\n\t\t\t\tif ( empty || dataPriv.get( this, "finish" ) ) {\n\t\t\t\t\tanim.stop( true );\n\t\t\t\t}\n\t\t\t};\n\n\t\tdoAnimation.finish = doAnimation;\n\n\t\treturn empty || optall.queue === false ?\n\t\t\tthis.each( doAnimation ) :\n\t\t\tthis.queue( optall.queue, doAnimation );\n\t},\n\tstop: function( type, clearQueue, gotoEnd ) {\n\t\tvar stopQueue = function( hooks ) {\n\t\t\tvar stop = hooks.stop;\n\t\t\tdelete hooks.stop;\n\t\t\tstop( gotoEnd );\n\t\t};\n\n\t\tif ( typeof type !== "string" ) {\n\t\t\tgotoEnd = clearQueue;\n\t\t\tclearQueue = type;\n\t\t\ttype = undefined;\n\t\t}\n\t\tif ( clearQueue ) {\n\t\t\tthis.queue( type || "fx", [] );\n\t\t}\n\n\t\treturn this.each( function() {\n\t\t\tvar dequeue = true,\n\t\t\t\tindex = type != null && type + "queueHooks",\n\t\t\t\ttimers = jQuery.timers,\n\t\t\t\tdata = dataPriv.get( this );\n\n\t\t\tif ( index ) {\n\t\t\t\tif ( data[ index ] && data[ index ].stop ) {\n\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( index in data ) {\n\t\t\t\t\tif ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {\n\t\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor ( index = timers.length; index--; ) {\n\t\t\t\tif ( timers[ index ].elem === this &&\n\t\t\t\t\t( type == null || timers[ index ].queue === type ) ) {\n\n\t\t\t\t\ttimers[ index ].anim.stop( gotoEnd );\n\t\t\t\t\tdequeue = false;\n\t\t\t\t\ttimers.splice( index, 1 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Start the next in the queue if the last step wasn\'t forced.\n\t\t\t// Timers currently will call their complete callbacks, which\n\t\t\t// will dequeue but only if they were gotoEnd.\n\t\t\tif ( dequeue || !gotoEnd ) {\n\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t}\n\t\t} );\n\t},\n\tfinish: function( type ) {\n\t\tif ( type !== false ) {\n\t\t\ttype = type || "fx";\n\t\t}\n\t\treturn this.each( function() {\n\t\t\tvar index,\n\t\t\t\tdata = dataPriv.get( this ),\n\t\t\t\tqueue = data[ type + "queue" ],\n\t\t\t\thooks = data[ type + "queueHooks" ],\n\t\t\t\ttimers = jQuery.timers,\n\t\t\t\tlength = queue ? queue.length : 0;\n\n\t\t\t// Enable finishing flag on private data\n\t\t\tdata.finish = true;\n\n\t\t\t// Empty the queue first\n\t\t\tjQuery.queue( this, type, [] );\n\n\t\t\tif ( hooks && hooks.stop ) {\n\t\t\t\thooks.stop.call( this, true );\n\t\t\t}\n\n\t\t\t// Look for any active animations, and finish them\n\t\t\tfor ( index = timers.length; index--; ) {\n\t\t\t\tif ( timers[ index ].elem === this && timers[ index ].queue === type ) {\n\t\t\t\t\ttimers[ index ].anim.stop( true );\n\t\t\t\t\ttimers.splice( index, 1 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Look for any animations in the old queue and finish them\n\t\t\tfor ( index = 0; index < length; index++ ) {\n\t\t\t\tif ( queue[ index ] && queue[ index ].finish ) {\n\t\t\t\t\tqueue[ index ].finish.call( this );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Turn off finishing flag\n\t\t\tdelete data.finish;\n\t\t} );\n\t}\n} );\n\njQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {\n\tvar cssFn = jQuery.fn[ name ];\n\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\treturn speed == null || typeof speed === "boolean" ?\n\t\t\tcssFn.apply( this, arguments ) :\n\t\t\tthis.animate( genFx( name, true ), speed, easing, callback );\n\t};\n} );\n\n// Generate shortcuts for custom animations\njQuery.each( {\n\tslideDown: genFx( "show" ),\n\tslideUp: genFx( "hide" ),\n\tslideToggle: genFx( "toggle" ),\n\tfadeIn: { opacity: "show" },\n\tfadeOut: { opacity: "hide" },\n\tfadeToggle: { opacity: "toggle" }\n}, function( name, props ) {\n\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\treturn this.animate( props, speed, easing, callback );\n\t};\n} );\n\njQuery.timers = [];\njQuery.fx.tick = function() {\n\tvar timer,\n\t\ti = 0,\n\t\ttimers = jQuery.timers;\n\n\tfxNow = Date.now();\n\n\tfor ( ; i < timers.length; i++ ) {\n\t\ttimer = timers[ i ];\n\n\t\t// Run the timer and safely remove it when done (allowing for external removal)\n\t\tif ( !timer() && timers[ i ] === timer ) {\n\t\t\ttimers.splice( i--, 1 );\n\t\t}\n\t}\n\n\tif ( !timers.length ) {\n\t\tjQuery.fx.stop();\n\t}\n\tfxNow = undefined;\n};\n\njQuery.fx.timer = function( timer ) {\n\tjQuery.timers.push( timer );\n\tjQuery.fx.start();\n};\n\njQuery.fx.interval = 13;\njQuery.fx.start = function() {\n\tif ( inProgress ) {\n\t\treturn;\n\t}\n\n\tinProgress = true;\n\tschedule();\n};\n\njQuery.fx.stop = function() {\n\tinProgress = null;\n};\n\njQuery.fx.speeds = {\n\tslow: 600,\n\tfast: 200,\n\n\t// Default speed\n\t_default: 400\n};\n\n\n// Based off of the plugin by Clint Helfers, with permission.\njQuery.fn.delay = function( time, type ) {\n\ttime = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;\n\ttype = type || "fx";\n\n\treturn this.queue( type, function( next, hooks ) {\n\t\tvar timeout = window.setTimeout( next, time );\n\t\thooks.stop = function() {\n\t\t\twindow.clearTimeout( timeout );\n\t\t};\n\t} );\n};\n\n\n( function() {\n\tvar input = document.createElement( "input" ),\n\t\tselect = document.createElement( "select" ),\n\t\topt = select.appendChild( document.createElement( "option" ) );\n\n\tinput.type = "checkbox";\n\n\t// Support: Android <=4.3 only\n\t// Default value for a checkbox should be "on"\n\tsupport.checkOn = input.value !== "";\n\n\t// Support: IE <=11 only\n\t// Must access selectedIndex to make default options select\n\tsupport.optSelected = opt.selected;\n\n\t// Support: IE <=11 only\n\t// An input loses its value after becoming a radio\n\tinput = document.createElement( "input" );\n\tinput.value = "t";\n\tinput.type = "radio";\n\tsupport.radioValue = input.value === "t";\n} )();\n\n\nvar boolHook,\n\tattrHandle = jQuery.expr.attrHandle;\n\njQuery.fn.extend( {\n\tattr: function( name, value ) {\n\t\treturn access( this, jQuery.attr, name, value, arguments.length > 1 );\n\t},\n\n\tremoveAttr: function( name ) {\n\t\treturn this.each( function() {\n\t\t\tjQuery.removeAttr( this, name );\n\t\t} );\n\t}\n} );\n\njQuery.extend( {\n\tattr: function( elem, name, value ) {\n\t\tvar ret, hooks,\n\t\t\tnType = elem.nodeType;\n\n\t\t// Don\'t get/set attributes on text, comment and attribute nodes\n\t\tif ( nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Fallback to prop when attributes are not supported\n\t\tif ( typeof elem.getAttribute === "undefined" ) {\n\t\t\treturn jQuery.prop( elem, name, value );\n\t\t}\n\n\t\t// Attribute hooks are determined by the lowercase version\n\t\t// Grab necessary hook if one is defined\n\t\tif ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {\n\t\t\thooks = jQuery.attrHooks[ name.toLowerCase() ] ||\n\t\t\t\t( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\t\t\tif ( value === null ) {\n\t\t\t\tjQuery.removeAttr( elem, name );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( hooks && "set" in hooks &&\n\t\t\t\t( ret = hooks.set( elem, value, name ) ) !== undefined ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\telem.setAttribute( name, value + "" );\n\t\t\treturn value;\n\t\t}\n\n\t\tif ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tret = jQuery.find.attr( elem, name );\n\n\t\t// Non-existent attributes return null, we normalize to undefined\n\t\treturn ret == null ? undefined : ret;\n\t},\n\n\tattrHooks: {\n\t\ttype: {\n\t\t\tset: function( elem, value ) {\n\t\t\t\tif ( !support.radioValue && value === "radio" &&\n\t\t\t\t\tnodeName( elem, "input" ) ) {\n\t\t\t\t\tvar val = elem.value;\n\t\t\t\t\telem.setAttribute( "type", value );\n\t\t\t\t\tif ( val ) {\n\t\t\t\t\t\telem.value = val;\n\t\t\t\t\t}\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tremoveAttr: function( elem, value ) {\n\t\tvar name,\n\t\t\ti = 0,\n\n\t\t\t// Attribute names can contain non-HTML whitespace characters\n\t\t\t// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n\t\t\tattrNames = value && value.match( rnothtmlwhite );\n\n\t\tif ( attrNames && elem.nodeType === 1 ) {\n\t\t\twhile ( ( name = attrNames[ i++ ] ) ) {\n\t\t\t\telem.removeAttribute( name );\n\t\t\t}\n\t\t}\n\t}\n} );\n\n// Hooks for boolean attributes\nboolHook = {\n\tset: function( elem, value, name ) {\n\t\tif ( value === false ) {\n\n\t\t\t// Remove boolean attributes when set to false\n\t\t\tjQuery.removeAttr( elem, name );\n\t\t} else {\n\t\t\telem.setAttribute( name, name );\n\t\t}\n\t\treturn name;\n\t}\n};\n\njQuery.each( jQuery.expr.match.bool.source.match( /\\w+/g ), function( _i, name ) {\n\tvar getter = attrHandle[ name ] || jQuery.find.attr;\n\n\tattrHandle[ name ] = function( elem, name, isXML ) {\n\t\tvar ret, handle,\n\t\t\tlowercaseName = name.toLowerCase();\n\n\t\tif ( !isXML ) {\n\n\t\t\t// Avoid an infinite loop by temporarily removing this function from the getter\n\t\t\thandle = attrHandle[ lowercaseName ];\n\t\t\tattrHandle[ lowercaseName ] = ret;\n\t\t\tret = getter( elem, name, isXML ) != null ?\n\t\t\t\tlowercaseName :\n\t\t\t\tnull;\n\t\t\tattrHandle[ lowercaseName ] = handle;\n\t\t}\n\t\treturn ret;\n\t};\n} );\n\n\n\n\nvar rfocusable = /^(?:input|select|textarea|button)$/i,\n\trclickable = /^(?:a|area)$/i;\n\njQuery.fn.extend( {\n\tprop: function( name, value ) {\n\t\treturn access( this, jQuery.prop, name, value, arguments.length > 1 );\n\t},\n\n\tremoveProp: function( name ) {\n\t\treturn this.each( function() {\n\t\t\tdelete this[ jQuery.propFix[ name ] || name ];\n\t\t} );\n\t}\n} );\n\njQuery.extend( {\n\tprop: function( elem, name, value ) {\n\t\tvar ret, hooks,\n\t\t\tnType = elem.nodeType;\n\n\t\t// Don\'t get/set properties on text, comment and attribute nodes\n\t\tif ( nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {\n\n\t\t\t// Fix name and attach hooks\n\t\t\tname = jQuery.propFix[ name ] || name;\n\t\t\thooks = jQuery.propHooks[ name ];\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\t\t\tif ( hooks && "set" in hooks &&\n\t\t\t\t( ret = hooks.set( elem, value, name ) ) !== undefined ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\treturn ( elem[ name ] = value );\n\t\t}\n\n\t\tif ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {\n\t\t\treturn ret;\n\t\t}\n\n\t\treturn elem[ name ];\n\t},\n\n\tpropHooks: {\n\t\ttabIndex: {\n\t\t\tget: function( elem ) {\n\n\t\t\t\t// Support: IE <=9 - 11 only\n\t\t\t\t// elem.tabIndex doesn\'t always return the\n\t\t\t\t// correct value when it hasn\'t been explicitly set\n\t\t\t\t// Use proper attribute retrieval (trac-12072)\n\t\t\t\tvar tabindex = jQuery.find.attr( elem, "tabindex" );\n\n\t\t\t\tif ( tabindex ) {\n\t\t\t\t\treturn parseInt( tabindex, 10 );\n\t\t\t\t}\n\n\t\t\t\tif (\n\t\t\t\t\trfocusable.test( elem.nodeName ) ||\n\t\t\t\t\trclickable.test( elem.nodeName ) &&\n\t\t\t\t\telem.href\n\t\t\t\t) {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t},\n\n\tpropFix: {\n\t\t"for": "htmlFor",\n\t\t"class": "className"\n\t}\n} );\n\n// Support: IE <=11 only\n// Accessing the selectedIndex property\n// forces the browser to respect setting selected\n// on the option\n// The getter ensures a default option is selected\n// when in an optgroup\n// eslint rule "no-unused-expressions" is disabled for this code\n// since it considers such accessions noop\nif ( !support.optSelected ) {\n\tjQuery.propHooks.selected = {\n\t\tget: function( elem ) {\n\n\t\t\t/* eslint no-unused-expressions: "off" */\n\n\t\t\tvar parent = elem.parentNode;\n\t\t\tif ( parent && parent.parentNode ) {\n\t\t\t\tparent.parentNode.selectedIndex;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t\tset: function( elem ) {\n\n\t\t\t/* eslint no-unused-expressions: "off" */\n\n\t\t\tvar parent = elem.parentNode;\n\t\t\tif ( parent ) {\n\t\t\t\tparent.selectedIndex;\n\n\t\t\t\tif ( parent.parentNode ) {\n\t\t\t\t\tparent.parentNode.selectedIndex;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}\n\njQuery.each( [\n\t"tabIndex",\n\t"readOnly",\n\t"maxLength",\n\t"cellSpacing",\n\t"cellPadding",\n\t"rowSpan",\n\t"colSpan",\n\t"useMap",\n\t"frameBorder",\n\t"contentEditable"\n], function() {\n\tjQuery.propFix[ this.toLowerCase() ] = this;\n} );\n\n\n\n\n\t// Strip and collapse whitespace according to HTML spec\n\t// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace\n\tfunction stripAndCollapse( value ) {\n\t\tvar tokens = value.match( rnothtmlwhite ) || [];\n\t\treturn tokens.join( " " );\n\t}\n\n\nfunction getClass( elem ) {\n\treturn elem.getAttribute && elem.getAttribute( "class" ) || "";\n}\n\nfunction classesToArray( value ) {\n\tif ( Array.isArray( value ) ) {\n\t\treturn value;\n\t}\n\tif ( typeof value === "string" ) {\n\t\treturn value.match( rnothtmlwhite ) || [];\n\t}\n\treturn [];\n}\n\njQuery.fn.extend( {\n\taddClass: function( value ) {\n\t\tvar classNames, cur, curValue, className, i, finalValue;\n\n\t\tif ( isFunction( value ) ) {\n\t\t\treturn this.each( function( j ) {\n\t\t\t\tjQuery( this ).addClass( value.call( this, j, getClass( this ) ) );\n\t\t\t} );\n\t\t}\n\n\t\tclassNames = classesToArray( value );\n\n\t\tif ( classNames.length ) {\n\t\t\treturn this.each( function() {\n\t\t\t\tcurValue = getClass( this );\n\t\t\t\tcur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );\n\n\t\t\t\tif ( cur ) {\n\t\t\t\t\tfor ( i = 0; i < classNames.length; i++ ) {\n\t\t\t\t\t\tclassName = classNames[ i ];\n\t\t\t\t\t\tif ( cur.indexOf( " " + className + " " ) < 0 ) {\n\t\t\t\t\t\t\tcur += className + " ";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Only assign if different to avoid unneeded rendering.\n\t\t\t\t\tfinalValue = stripAndCollapse( cur );\n\t\t\t\t\tif ( curValue !== finalValue ) {\n\t\t\t\t\t\tthis.setAttribute( "class", finalValue );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tremoveClass: function( value ) {\n\t\tvar classNames, cur, curValue, className, i, finalValue;\n\n\t\tif ( isFunction( value ) ) {\n\t\t\treturn this.each( function( j ) {\n\t\t\t\tjQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );\n\t\t\t} );\n\t\t}\n\n\t\tif ( !arguments.length ) {\n\t\t\treturn this.attr( "class", "" );\n\t\t}\n\n\t\tclassNames = classesToArray( value );\n\n\t\tif ( classNames.length ) {\n\t\t\treturn this.each( function() {\n\t\t\t\tcurValue = getClass( this );\n\n\t\t\t\t// This expression is here for better compressibility (see addClass)\n\t\t\t\tcur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );\n\n\t\t\t\tif ( cur ) {\n\t\t\t\t\tfor ( i = 0; i < classNames.length; i++ ) {\n\t\t\t\t\t\tclassName = classNames[ i ];\n\n\t\t\t\t\t\t// Remove *all* instances\n\t\t\t\t\t\twhile ( cur.indexOf( " " + className + " " ) > -1 ) {\n\t\t\t\t\t\t\tcur = cur.replace( " " + className + " ", " " );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Only assign if different to avoid unneeded rendering.\n\t\t\t\t\tfinalValue = stripAndCollapse( cur );\n\t\t\t\t\tif ( curValue !== finalValue ) {\n\t\t\t\t\t\tthis.setAttribute( "class", finalValue );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\ttoggleClass: function( value, stateVal ) {\n\t\tvar classNames, className, i, self,\n\t\t\ttype = typeof value,\n\t\t\tisValidValue = type === "string" || Array.isArray( value );\n\n\t\tif ( isFunction( value ) ) {\n\t\t\treturn this.each( function( i ) {\n\t\t\t\tjQuery( this ).toggleClass(\n\t\t\t\t\tvalue.call( this, i, getClass( this ), stateVal ),\n\t\t\t\t\tstateVal\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\n\t\tif ( typeof stateVal === "boolean" && isValidValue ) {\n\t\t\treturn stateVal ? this.addClass( value ) : this.removeClass( value );\n\t\t}\n\n\t\tclassNames = classesToArray( value );\n\n\t\treturn this.each( function() {\n\t\t\tif ( isValidValue ) {\n\n\t\t\t\t// Toggle individual class names\n\t\t\t\tself = jQuery( this );\n\n\t\t\t\tfor ( i = 0; i < classNames.length; i++ ) {\n\t\t\t\t\tclassName = classNames[ i ];\n\n\t\t\t\t\t// Check each className given, space separated list\n\t\t\t\t\tif ( self.hasClass( className ) ) {\n\t\t\t\t\t\tself.removeClass( className );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tself.addClass( className );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t// Toggle whole class name\n\t\t\t} else if ( value === undefined || type === "boolean" ) {\n\t\t\t\tclassName = getClass( this );\n\t\t\t\tif ( className ) {\n\n\t\t\t\t\t// Store className if set\n\t\t\t\t\tdataPriv.set( this, "__className__", className );\n\t\t\t\t}\n\n\t\t\t\t// If the element has a class name or if we\'re passed `false`,\n\t\t\t\t// then remove the whole classname (if there was one, the above saved it).\n\t\t\t\t// Otherwise bring back whatever was previously saved (if anything),\n\t\t\t\t// falling back to the empty string if nothing was stored.\n\t\t\t\tif ( this.setAttribute ) {\n\t\t\t\t\tthis.setAttribute( "class",\n\t\t\t\t\t\tclassName || value === false ?\n\t\t\t\t\t\t\t"" :\n\t\t\t\t\t\t\tdataPriv.get( this, "__className__" ) || ""\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t},\n\n\thasClass: function( selector ) {\n\t\tvar className, elem,\n\t\t\ti = 0;\n\n\t\tclassName = " " + selector + " ";\n\t\twhile ( ( elem = this[ i++ ] ) ) {\n\t\t\tif ( elem.nodeType === 1 &&\n\t\t\t\t( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n} );\n\n\n\n\nvar rreturn = /\\r/g;\n\njQuery.fn.extend( {\n\tval: function( value ) {\n\t\tvar hooks, ret, valueIsFunction,\n\t\t\telem = this[ 0 ];\n\n\t\tif ( !arguments.length ) {\n\t\t\tif ( elem ) {\n\t\t\t\thooks = jQuery.valHooks[ elem.type ] ||\n\t\t\t\t\tjQuery.valHooks[ elem.nodeName.toLowerCase() ];\n\n\t\t\t\tif ( hooks &&\n\t\t\t\t\t"get" in hooks &&\n\t\t\t\t\t( ret = hooks.get( elem, "value" ) ) !== undefined\n\t\t\t\t) {\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\n\t\t\t\tret = elem.value;\n\n\t\t\t\t// Handle most common string cases\n\t\t\t\tif ( typeof ret === "string" ) {\n\t\t\t\t\treturn ret.replace( rreturn, "" );\n\t\t\t\t}\n\n\t\t\t\t// Handle cases where value is null/undef or number\n\t\t\t\treturn ret == null ? "" : ret;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tvalueIsFunction = isFunction( value );\n\n\t\treturn this.each( function( i ) {\n\t\t\tvar val;\n\n\t\t\tif ( this.nodeType !== 1 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( valueIsFunction ) {\n\t\t\t\tval = value.call( this, i, jQuery( this ).val() );\n\t\t\t} else {\n\t\t\t\tval = value;\n\t\t\t}\n\n\t\t\t// Treat null/undefined as ""; convert numbers to string\n\t\t\tif ( val == null ) {\n\t\t\t\tval = "";\n\n\t\t\t} else if ( typeof val === "number" ) {\n\t\t\t\tval += "";\n\n\t\t\t} else if ( Array.isArray( val ) ) {\n\t\t\t\tval = jQuery.map( val, function( value ) {\n\t\t\t\t\treturn value == null ? "" : value + "";\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\thooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];\n\n\t\t\t// If set returns undefined, fall back to normal setting\n\t\t\tif ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {\n\t\t\t\tthis.value = val;\n\t\t\t}\n\t\t} );\n\t}\n} );\n\njQuery.extend( {\n\tvalHooks: {\n\t\toption: {\n\t\t\tget: function( elem ) {\n\n\t\t\t\tvar val = jQuery.find.attr( elem, "value" );\n\t\t\t\treturn val != null ?\n\t\t\t\t\tval :\n\n\t\t\t\t\t// Support: IE <=10 - 11 only\n\t\t\t\t\t// option.text throws exceptions (trac-14686, trac-14858)\n\t\t\t\t\t// Strip and collapse whitespace\n\t\t\t\t\t// https://html.spec.whatwg.org/#strip-and-collapse-whitespace\n\t\t\t\t\tstripAndCollapse( jQuery.text( elem ) );\n\t\t\t}\n\t\t},\n\t\tselect: {\n\t\t\tget: function( elem ) {\n\t\t\t\tvar value, option, i,\n\t\t\t\t\toptions = elem.options,\n\t\t\t\t\tindex = elem.selectedIndex,\n\t\t\t\t\tone = elem.type === "select-one",\n\t\t\t\t\tvalues = one ? null : [],\n\t\t\t\t\tmax = one ? index + 1 : options.length;\n\n\t\t\t\tif ( index < 0 ) {\n\t\t\t\t\ti = max;\n\n\t\t\t\t} else {\n\t\t\t\t\ti = one ? index : 0;\n\t\t\t\t}\n\n\t\t\t\t// Loop through all the selected options\n\t\t\t\tfor ( ; i < max; i++ ) {\n\t\t\t\t\toption = options[ i ];\n\n\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t// IE8-9 doesn\'t update selected after form reset (trac-2551)\n\t\t\t\t\tif ( ( option.selected || i === index ) &&\n\n\t\t\t\t\t\t\t// Don\'t return options that are disabled or in a disabled optgroup\n\t\t\t\t\t\t\t!option.disabled &&\n\t\t\t\t\t\t\t( !option.parentNode.disabled ||\n\t\t\t\t\t\t\t\t!nodeName( option.parentNode, "optgroup" ) ) ) {\n\n\t\t\t\t\t\t// Get the specific value for the option\n\t\t\t\t\t\tvalue = jQuery( option ).val();\n\n\t\t\t\t\t\t// We don\'t need an array for one selects\n\t\t\t\t\t\tif ( one ) {\n\t\t\t\t\t\t\treturn value;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Multi-Selects return an array\n\t\t\t\t\t\tvalues.push( value );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn values;\n\t\t\t},\n\n\t\t\tset: function( elem, value ) {\n\t\t\t\tvar optionSet, option,\n\t\t\t\t\toptions = elem.options,\n\t\t\t\t\tvalues = jQuery.makeArray( value ),\n\t\t\t\t\ti = options.length;\n\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\toption = options[ i ];\n\n\t\t\t\t\t/* eslint-disable no-cond-assign */\n\n\t\t\t\t\tif ( option.selected =\n\t\t\t\t\t\tjQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1\n\t\t\t\t\t) {\n\t\t\t\t\t\toptionSet = true;\n\t\t\t\t\t}\n\n\t\t\t\t\t/* eslint-enable no-cond-assign */\n\t\t\t\t}\n\n\t\t\t\t// Force browsers to behave consistently when non-matching value is set\n\t\t\t\tif ( !optionSet ) {\n\t\t\t\t\telem.selectedIndex = -1;\n\t\t\t\t}\n\t\t\t\treturn values;\n\t\t\t}\n\t\t}\n\t}\n} );\n\n// Radios and checkboxes getter/setter\njQuery.each( [ "radio", "checkbox" ], function() {\n\tjQuery.valHooks[ this ] = {\n\t\tset: function( elem, value ) {\n\t\t\tif ( Array.isArray( value ) ) {\n\t\t\t\treturn ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );\n\t\t\t}\n\t\t}\n\t};\n\tif ( !support.checkOn ) {\n\t\tjQuery.valHooks[ this ].get = function( elem ) {\n\t\t\treturn elem.getAttribute( "value" ) === null ? "on" : elem.value;\n\t\t};\n\t}\n} );\n\n\n\n\n// Return jQuery for attributes-only inclusion\nvar location = window.location;\n\nvar nonce = { guid: Date.now() };\n\nvar rquery = ( /\\?/ );\n\n\n\n// Cross-browser xml parsing\njQuery.parseXML = function( data ) {\n\tvar xml, parserErrorElem;\n\tif ( !data || typeof data !== "string" ) {\n\t\treturn null;\n\t}\n\n\t// Support: IE 9 - 11 only\n\t// IE throws on parseFromString with invalid input.\n\ttry {\n\t\txml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );\n\t} catch ( e ) {}\n\n\tparserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];\n\tif ( !xml || parserErrorElem ) {\n\t\tjQuery.error( "Invalid XML: " + (\n\t\t\tparserErrorElem ?\n\t\t\t\tjQuery.map( parserErrorElem.childNodes, function( el ) {\n\t\t\t\t\treturn el.textContent;\n\t\t\t\t} ).join( "\\n" ) :\n\t\t\t\tdata\n\t\t) );\n\t}\n\treturn xml;\n};\n\n\nvar rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,\n\tstopPropagationCallback = function( e ) {\n\t\te.stopPropagation();\n\t};\n\njQuery.extend( jQuery.event, {\n\n\ttrigger: function( event, data, elem, onlyHandlers ) {\n\n\t\tvar i, cur, tmp, bubbleType, ontype, handle, special, lastElement,\n\t\t\teventPath = [ elem || document ],\n\t\t\ttype = hasOwn.call( event, "type" ) ? event.type : event,\n\t\t\tnamespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];\n\n\t\tcur = lastElement = tmp = elem = elem || document;\n\n\t\t// Don\'t do events on text and comment nodes\n\t\tif ( elem.nodeType === 3 || elem.nodeType === 8 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// focus/blur morphs to focusin/out; ensure we\'re not firing them right now\n\t\tif ( rfocusMorph.test( type + jQuery.event.triggered ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( type.indexOf( "." ) > -1 ) {\n\n\t\t\t// Namespaced trigger; create a regexp to match event type in handle()\n\t\t\tnamespaces = type.split( "." );\n\t\t\ttype = namespaces.shift();\n\t\t\tnamespaces.sort();\n\t\t}\n\t\tontype = type.indexOf( ":" ) < 0 && "on" + type;\n\n\t\t// Caller can pass in a jQuery.Event object, Object, or just an event type string\n\t\tevent = event[ jQuery.expando ] ?\n\t\t\tevent :\n\t\t\tnew jQuery.Event( type, typeof event === "object" && event );\n\n\t\t// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)\n\t\tevent.isTrigger = onlyHandlers ? 2 : 3;\n\t\tevent.namespace = namespaces.join( "." );\n\t\tevent.rnamespace = event.namespace ?\n\t\t\tnew RegExp( "(^|\\\\.)" + namespaces.join( "\\\\.(?:.*\\\\.|)" ) + "(\\\\.|$)" ) :\n\t\t\tnull;\n\n\t\t// Clean up the event in case it is being reused\n\t\tevent.result = undefined;\n\t\tif ( !event.target ) {\n\t\t\tevent.target = elem;\n\t\t}\n\n\t\t// Clone any incoming data and prepend the event, creating the handler arg list\n\t\tdata = data == null ?\n\t\t\t[ event ] :\n\t\t\tjQuery.makeArray( data, [ event ] );\n\n\t\t// Allow special events to draw outside the lines\n\t\tspecial = jQuery.event.special[ type ] || {};\n\t\tif ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine event propagation path in advance, per W3C events spec (trac-9951)\n\t\t// Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724)\n\t\tif ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {\n\n\t\t\tbubbleType = special.delegateType || type;\n\t\t\tif ( !rfocusMorph.test( bubbleType + type ) ) {\n\t\t\t\tcur = cur.parentNode;\n\t\t\t}\n\t\t\tfor ( ; cur; cur = cur.parentNode ) {\n\t\t\t\teventPath.push( cur );\n\t\t\t\ttmp = cur;\n\t\t\t}\n\n\t\t\t// Only add window if we got to document (e.g., not plain obj or detached DOM)\n\t\t\tif ( tmp === ( elem.ownerDocument || document ) ) {\n\t\t\t\teventPath.push( tmp.defaultView || tmp.parentWindow || window );\n\t\t\t}\n\t\t}\n\n\t\t// Fire handlers on the event path\n\t\ti = 0;\n\t\twhile ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {\n\t\t\tlastElement = cur;\n\t\t\tevent.type = i > 1 ?\n\t\t\t\tbubbleType :\n\t\t\t\tspecial.bindType || type;\n\n\t\t\t// jQuery handler\n\t\t\thandle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&\n\t\t\t\tdataPriv.get( cur, "handle" );\n\t\t\tif ( handle ) {\n\t\t\t\thandle.apply( cur, data );\n\t\t\t}\n\n\t\t\t// Native handler\n\t\t\thandle = ontype && cur[ ontype ];\n\t\t\tif ( handle && handle.apply && acceptData( cur ) ) {\n\t\t\t\tevent.result = handle.apply( cur, data );\n\t\t\t\tif ( event.result === false ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tevent.type = type;\n\n\t\t// If nobody prevented the default action, do it now\n\t\tif ( !onlyHandlers && !event.isDefaultPrevented() ) {\n\n\t\t\tif ( ( !special._default ||\n\t\t\t\tspecial._default.apply( eventPath.pop(), data ) === false ) &&\n\t\t\t\tacceptData( elem ) ) {\n\n\t\t\t\t// Call a native DOM method on the target with the same name as the event.\n\t\t\t\t// Don\'t do default actions on window, that\'s where global variables be (trac-6170)\n\t\t\t\tif ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {\n\n\t\t\t\t\t// Don\'t re-trigger an onFOO event when we call its FOO() method\n\t\t\t\t\ttmp = elem[ ontype ];\n\n\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\telem[ ontype ] = null;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prevent re-triggering of the same event, since we already bubbled it above\n\t\t\t\t\tjQuery.event.triggered = type;\n\n\t\t\t\t\tif ( event.isPropagationStopped() ) {\n\t\t\t\t\t\tlastElement.addEventListener( type, stopPropagationCallback );\n\t\t\t\t\t}\n\n\t\t\t\t\telem[ type ]();\n\n\t\t\t\t\tif ( event.isPropagationStopped() ) {\n\t\t\t\t\t\tlastElement.removeEventListener( type, stopPropagationCallback );\n\t\t\t\t\t}\n\n\t\t\t\t\tjQuery.event.triggered = undefined;\n\n\t\t\t\t\tif ( tmp ) {\n\t\t\t\t\t\telem[ ontype ] = tmp;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn event.result;\n\t},\n\n\t// Piggyback on a donor event to simulate a different one\n\t// Used only for `focus(in | out)` events\n\tsimulate: function( type, elem, event ) {\n\t\tvar e = jQuery.extend(\n\t\t\tnew jQuery.Event(),\n\t\t\tevent,\n\t\t\t{\n\t\t\t\ttype: type,\n\t\t\t\tisSimulated: true\n\t\t\t}\n\t\t);\n\n\t\tjQuery.event.trigger( e, null, elem );\n\t}\n\n} );\n\njQuery.fn.extend( {\n\n\ttrigger: function( type, data ) {\n\t\treturn this.each( function() {\n\t\t\tjQuery.event.trigger( type, data, this );\n\t\t} );\n\t},\n\ttriggerHandler: function( type, data ) {\n\t\tvar elem = this[ 0 ];\n\t\tif ( elem ) {\n\t\t\treturn jQuery.event.trigger( type, data, elem, true );\n\t\t}\n\t}\n} );\n\n\nvar\n\trbracket = /\\[\\]$/,\n\trCRLF = /\\r?\\n/g,\n\trsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,\n\trsubmittable = /^(?:input|select|textarea|keygen)/i;\n\nfunction buildParams( prefix, obj, traditional, add ) {\n\tvar name;\n\n\tif ( Array.isArray( obj ) ) {\n\n\t\t// Serialize array item.\n\t\tjQuery.each( obj, function( i, v ) {\n\t\t\tif ( traditional || rbracket.test( prefix ) ) {\n\n\t\t\t\t// Treat each array item as a scalar.\n\t\t\t\tadd( prefix, v );\n\n\t\t\t} else {\n\n\t\t\t\t// Item is non-scalar (array or object), encode its numeric index.\n\t\t\t\tbuildParams(\n\t\t\t\t\tprefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",\n\t\t\t\t\tv,\n\t\t\t\t\ttraditional,\n\t\t\t\t\tadd\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t} else if ( !traditional && toType( obj ) === "object" ) {\n\n\t\t// Serialize object item.\n\t\tfor ( name in obj ) {\n\t\t\tbuildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );\n\t\t}\n\n\t} else {\n\n\t\t// Serialize scalar item.\n\t\tadd( prefix, obj );\n\t}\n}\n\n// Serialize an array of form elements or a set of\n// key/values into a query string\njQuery.param = function( a, traditional ) {\n\tvar prefix,\n\t\ts = [],\n\t\tadd = function( key, valueOrFunction ) {\n\n\t\t\t// If value is a function, invoke it and use its return value\n\t\t\tvar value = isFunction( valueOrFunction ) ?\n\t\t\t\tvalueOrFunction() :\n\t\t\t\tvalueOrFunction;\n\n\t\t\ts[ s.length ] = encodeURIComponent( key ) + "=" +\n\t\t\t\tencodeURIComponent( value == null ? "" : value );\n\t\t};\n\n\tif ( a == null ) {\n\t\treturn "";\n\t}\n\n\t// If an array was passed in, assume that it is an array of form elements.\n\tif ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {\n\n\t\t// Serialize the form elements\n\t\tjQuery.each( a, function() {\n\t\t\tadd( this.name, this.value );\n\t\t} );\n\n\t} else {\n\n\t\t// If traditional, encode the "old" way (the way 1.3.2 or older\n\t\t// did it), otherwise encode params recursively.\n\t\tfor ( prefix in a ) {\n\t\t\tbuildParams( prefix, a[ prefix ], traditional, add );\n\t\t}\n\t}\n\n\t// Return the resulting serialization\n\treturn s.join( "&" );\n};\n\njQuery.fn.extend( {\n\tserialize: function() {\n\t\treturn jQuery.param( this.serializeArray() );\n\t},\n\tserializeArray: function() {\n\t\treturn this.map( function() {\n\n\t\t\t// Can add propHook for "elements" to filter or add form elements\n\t\t\tvar elements = jQuery.prop( this, "elements" );\n\t\t\treturn elements ? jQuery.makeArray( elements ) : this;\n\t\t} ).filter( function() {\n\t\t\tvar type = this.type;\n\n\t\t\t// Use .is( ":disabled" ) so that fieldset[disabled] works\n\t\t\treturn this.name && !jQuery( this ).is( ":disabled" ) &&\n\t\t\t\trsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&\n\t\t\t\t( this.checked || !rcheckableType.test( type ) );\n\t\t} ).map( function( _i, elem ) {\n\t\t\tvar val = jQuery( this ).val();\n\n\t\t\tif ( val == null ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif ( Array.isArray( val ) ) {\n\t\t\t\treturn jQuery.map( val, function( val ) {\n\t\t\t\t\treturn { name: elem.name, value: val.replace( rCRLF, "\\r\\n" ) };\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn { name: elem.name, value: val.replace( rCRLF, "\\r\\n" ) };\n\t\t} ).get();\n\t}\n} );\n\n\nvar\n\tr20 = /%20/g,\n\trhash = /#.*$/,\n\trantiCache = /([?&])_=[^&]*/,\n\trheaders = /^(.*?):[ \\t]*([^\\r\\n]*)$/mg,\n\n\t// trac-7653, trac-8125, trac-8152: local protocol detection\n\trlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,\n\trnoContent = /^(?:GET|HEAD)$/,\n\trprotocol = /^\\/\\//,\n\n\t/* Prefilters\n\t * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n\t * 2) These are called:\n\t * - BEFORE asking for a transport\n\t * - AFTER param serialization (s.data is a string if s.processData is true)\n\t * 3) key is the dataType\n\t * 4) the catchall symbol "*" can be used\n\t * 5) execution will start with transport dataType and THEN continue down to "*" if needed\n\t */\n\tprefilters = {},\n\n\t/* Transports bindings\n\t * 1) key is the dataType\n\t * 2) the catchall symbol "*" can be used\n\t * 3) selection will start with transport dataType and THEN go to "*" if needed\n\t */\n\ttransports = {},\n\n\t// Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression\n\tallTypes = "*/".concat( "*" ),\n\n\t// Anchor tag for parsing the document origin\n\toriginAnchor = document.createElement( "a" );\n\noriginAnchor.href = location.href;\n\n// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\nfunction addToPrefiltersOrTransports( structure ) {\n\n\t// dataTypeExpression is optional and defaults to "*"\n\treturn function( dataTypeExpression, func ) {\n\n\t\tif ( typeof dataTypeExpression !== "string" ) {\n\t\t\tfunc = dataTypeExpression;\n\t\t\tdataTypeExpression = "*";\n\t\t}\n\n\t\tvar dataType,\n\t\t\ti = 0,\n\t\t\tdataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];\n\n\t\tif ( isFunction( func ) ) {\n\n\t\t\t// For each dataType in the dataTypeExpression\n\t\t\twhile ( ( dataType = dataTypes[ i++ ] ) ) {\n\n\t\t\t\t// Prepend if requested\n\t\t\t\tif ( dataType[ 0 ] === "+" ) {\n\t\t\t\t\tdataType = dataType.slice( 1 ) || "*";\n\t\t\t\t\t( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );\n\n\t\t\t\t// Otherwise append\n\t\t\t\t} else {\n\t\t\t\t\t( structure[ dataType ] = structure[ dataType ] || [] ).push( func );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n}\n\n// Base inspection function for prefilters and transports\nfunction inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {\n\n\tvar inspected = {},\n\t\tseekingTransport = ( structure === transports );\n\n\tfunction inspect( dataType ) {\n\t\tvar selected;\n\t\tinspected[ dataType ] = true;\n\t\tjQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {\n\t\t\tvar dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );\n\t\t\tif ( typeof dataTypeOrTransport === "string" &&\n\t\t\t\t!seekingTransport && !inspected[ dataTypeOrTransport ] ) {\n\n\t\t\t\toptions.dataTypes.unshift( dataTypeOrTransport );\n\t\t\t\tinspect( dataTypeOrTransport );\n\t\t\t\treturn false;\n\t\t\t} else if ( seekingTransport ) {\n\t\t\t\treturn !( selected = dataTypeOrTransport );\n\t\t\t}\n\t\t} );\n\t\treturn selected;\n\t}\n\n\treturn inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );\n}\n\n// A special extend for ajax options\n// that takes "flat" options (not to be deep extended)\n// Fixes trac-9887\nfunction ajaxExtend( target, src ) {\n\tvar key, deep,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n\n\treturn target;\n}\n\n/* Handles responses to an ajax request:\n * - finds the right dataType (mediates between content-type and expected dataType)\n * - returns the corresponding response\n */\nfunction ajaxHandleResponses( s, jqXHR, responses ) {\n\n\tvar ct, type, finalDataType, firstDataType,\n\t\tcontents = s.contents,\n\t\tdataTypes = s.dataTypes;\n\n\t// Remove auto dataType and get content-type in the process\n\twhile ( dataTypes[ 0 ] === "*" ) {\n\t\tdataTypes.shift();\n\t\tif ( ct === undefined ) {\n\t\t\tct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );\n\t\t}\n\t}\n\n\t// Check if we\'re dealing with a known content-type\n\tif ( ct ) {\n\t\tfor ( type in contents ) {\n\t\t\tif ( contents[ type ] && contents[ type ].test( ct ) ) {\n\t\t\t\tdataTypes.unshift( type );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check to see if we have a response for the expected dataType\n\tif ( dataTypes[ 0 ] in responses ) {\n\t\tfinalDataType = dataTypes[ 0 ];\n\t} else {\n\n\t\t// Try convertible dataTypes\n\t\tfor ( type in responses ) {\n\t\t\tif ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {\n\t\t\t\tfinalDataType = type;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( !firstDataType ) {\n\t\t\t\tfirstDataType = type;\n\t\t\t}\n\t\t}\n\n\t\t// Or just use first one\n\t\tfinalDataType = finalDataType || firstDataType;\n\t}\n\n\t// If we found a dataType\n\t// We add the dataType to the list if needed\n\t// and return the corresponding response\n\tif ( finalDataType ) {\n\t\tif ( finalDataType !== dataTypes[ 0 ] ) {\n\t\t\tdataTypes.unshift( finalDataType );\n\t\t}\n\t\treturn responses[ finalDataType ];\n\t}\n}\n\n/* Chain conversions given the request and the original response\n * Also sets the responseXXX fields on the jqXHR instance\n */\nfunction ajaxConvert( s, response, jqXHR, isSuccess ) {\n\tvar conv2, current, conv, tmp, prev,\n\t\tconverters = {},\n\n\t\t// Work with a copy of dataTypes in case we need to modify it for conversion\n\t\tdataTypes = s.dataTypes.slice();\n\n\t// Create converters map with lowercased keys\n\tif ( dataTypes[ 1 ] ) {\n\t\tfor ( conv in s.converters ) {\n\t\t\tconverters[ conv.toLowerCase() ] = s.converters[ conv ];\n\t\t}\n\t}\n\n\tcurrent = dataTypes.shift();\n\n\t// Convert to each sequential dataType\n\twhile ( current ) {\n\n\t\tif ( s.responseFields[ current ] ) {\n\t\t\tjqXHR[ s.responseFields[ current ] ] = response;\n\t\t}\n\n\t\t// Apply the dataFilter if provided\n\t\tif ( !prev && isSuccess && s.dataFilter ) {\n\t\t\tresponse = s.dataFilter( response, s.dataType );\n\t\t}\n\n\t\tprev = current;\n\t\tcurrent = dataTypes.shift();\n\n\t\tif ( current ) {\n\n\t\t\t// There\'s only work to do if current dataType is non-auto\n\t\t\tif ( current === "*" ) {\n\n\t\t\t\tcurrent = prev;\n\n\t\t\t// Convert response if prev dataType is non-auto and differs from current\n\t\t\t} else if ( prev !== "*" && prev !== current ) {\n\n\t\t\t\t// Seek a direct converter\n\t\t\t\tconv = converters[ prev + " " + current ] || converters[ "* " + current ];\n\n\t\t\t\t// If none found, seek a pair\n\t\t\t\tif ( !conv ) {\n\t\t\t\t\tfor ( conv2 in converters ) {\n\n\t\t\t\t\t\t// If conv2 outputs current\n\t\t\t\t\t\ttmp = conv2.split( " " );\n\t\t\t\t\t\tif ( tmp[ 1 ] === current ) {\n\n\t\t\t\t\t\t\t// If prev can be converted to accepted input\n\t\t\t\t\t\t\tconv = converters[ prev + " " + tmp[ 0 ] ] ||\n\t\t\t\t\t\t\t\tconverters[ "* " + tmp[ 0 ] ];\n\t\t\t\t\t\t\tif ( conv ) {\n\n\t\t\t\t\t\t\t\t// Condense equivalence converters\n\t\t\t\t\t\t\t\tif ( conv === true ) {\n\t\t\t\t\t\t\t\t\tconv = converters[ conv2 ];\n\n\t\t\t\t\t\t\t\t// Otherwise, insert the intermediate dataType\n\t\t\t\t\t\t\t\t} else if ( converters[ conv2 ] !== true ) {\n\t\t\t\t\t\t\t\t\tcurrent = tmp[ 0 ];\n\t\t\t\t\t\t\t\t\tdataTypes.unshift( tmp[ 1 ] );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Apply converter (if not an equivalence)\n\t\t\t\tif ( conv !== true ) {\n\n\t\t\t\t\t// Unless errors are allowed to bubble, catch and return them\n\t\t\t\t\tif ( conv && s.throws ) {\n\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t\t} catch ( e ) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tstate: "parsererror",\n\t\t\t\t\t\t\t\terror: conv ? e : "No conversion from " + prev + " to " + current\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { state: "success", data: response };\n}\n\njQuery.extend( {\n\n\t// Counter for holding the number of active queries\n\tactive: 0,\n\n\t// Last-Modified header cache for next request\n\tlastModified: {},\n\tetag: {},\n\n\tajaxSettings: {\n\t\turl: location.href,\n\t\ttype: "GET",\n\t\tisLocal: rlocalProtocol.test( location.protocol ),\n\t\tglobal: true,\n\t\tprocessData: true,\n\t\tasync: true,\n\t\tcontentType: "application/x-www-form-urlencoded; charset=UTF-8",\n\n\t\t/*\n\t\ttimeout: 0,\n\t\tdata: null,\n\t\tdataType: null,\n\t\tusername: null,\n\t\tpassword: null,\n\t\tcache: null,\n\t\tthrows: false,\n\t\ttraditional: false,\n\t\theaders: {},\n\t\t*/\n\n\t\taccepts: {\n\t\t\t"*": allTypes,\n\t\t\ttext: "text/plain",\n\t\t\thtml: "text/html",\n\t\t\txml: "application/xml, text/xml",\n\t\t\tjson: "application/json, text/javascript"\n\t\t},\n\n\t\tcontents: {\n\t\t\txml: /\\bxml\\b/,\n\t\t\thtml: /\\bhtml/,\n\t\t\tjson: /\\bjson\\b/\n\t\t},\n\n\t\tresponseFields: {\n\t\t\txml: "responseXML",\n\t\t\ttext: "responseText",\n\t\t\tjson: "responseJSON"\n\t\t},\n\n\t\t// Data converters\n\t\t// Keys separate source (or catchall "*") and destination types with a single space\n\t\tconverters: {\n\n\t\t\t// Convert anything to text\n\t\t\t"* text": String,\n\n\t\t\t// Text to html (true = no transformation)\n\t\t\t"text html": true,\n\n\t\t\t// Evaluate text as a json expression\n\t\t\t"text json": JSON.parse,\n\n\t\t\t// Parse text as xml\n\t\t\t"text xml": jQuery.parseXML\n\t\t},\n\n\t\t// For options that shouldn\'t be deep extended:\n\t\t// you can add your own custom options here if\n\t\t// and when you create one that shouldn\'t be\n\t\t// deep extended (see ajaxExtend)\n\t\tflatOptions: {\n\t\t\turl: true,\n\t\t\tcontext: true\n\t\t}\n\t},\n\n\t// Creates a full fledged settings object into target\n\t// with both ajaxSettings and settings fields.\n\t// If target is omitted, writes into ajaxSettings.\n\tajaxSetup: function( target, settings ) {\n\t\treturn settings ?\n\n\t\t\t// Building a settings object\n\t\t\tajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :\n\n\t\t\t// Extending ajaxSettings\n\t\t\tajaxExtend( jQuery.ajaxSettings, target );\n\t},\n\n\tajaxPrefilter: addToPrefiltersOrTransports( prefilters ),\n\tajaxTransport: addToPrefiltersOrTransports( transports ),\n\n\t// Main method\n\tajax: function( url, options ) {\n\n\t\t// If url is an object, simulate pre-1.5 signature\n\t\tif ( typeof url === "object" ) {\n\t\t\toptions = url;\n\t\t\turl = undefined;\n\t\t}\n\n\t\t// Force options to be an object\n\t\toptions = options || {};\n\n\t\tvar transport,\n\n\t\t\t// URL without anti-cache param\n\t\t\tcacheURL,\n\n\t\t\t// Response headers\n\t\t\tresponseHeadersString,\n\t\t\tresponseHeaders,\n\n\t\t\t// timeout handle\n\t\t\ttimeoutTimer,\n\n\t\t\t// Url cleanup var\n\t\t\turlAnchor,\n\n\t\t\t// Request state (becomes false upon send and true upon completion)\n\t\t\tcompleted,\n\n\t\t\t// To know if global events are to be dispatched\n\t\t\tfireGlobals,\n\n\t\t\t// Loop variable\n\t\t\ti,\n\n\t\t\t// uncached part of the url\n\t\t\tuncached,\n\n\t\t\t// Create the final options object\n\t\t\ts = jQuery.ajaxSetup( {}, options ),\n\n\t\t\t// Callbacks context\n\t\t\tcallbackContext = s.context || s,\n\n\t\t\t// Context for global events is callbackContext if it is a DOM node or jQuery collection\n\t\t\tglobalEventContext = s.context &&\n\t\t\t\t( callbackContext.nodeType || callbackContext.jquery ) ?\n\t\t\t\tjQuery( callbackContext ) :\n\t\t\t\tjQuery.event,\n\n\t\t\t// Deferreds\n\t\t\tdeferred = jQuery.Deferred(),\n\t\t\tcompleteDeferred = jQuery.Callbacks( "once memory" ),\n\n\t\t\t// Status-dependent callbacks\n\t\t\tstatusCode = s.statusCode || {},\n\n\t\t\t// Headers (they are sent all at once)\n\t\t\trequestHeaders = {},\n\t\t\trequestHeadersNames = {},\n\n\t\t\t// Default abort message\n\t\t\tstrAbort = "canceled",\n\n\t\t\t// Fake xhr\n\t\t\tjqXHR = {\n\t\t\t\treadyState: 0,\n\n\t\t\t\t// Builds headers hashtable if needed\n\t\t\t\tgetResponseHeader: function( key ) {\n\t\t\t\t\tvar match;\n\t\t\t\t\tif ( completed ) {\n\t\t\t\t\t\tif ( !responseHeaders ) {\n\t\t\t\t\t\t\tresponseHeaders = {};\n\t\t\t\t\t\t\twhile ( ( match = rheaders.exec( responseHeadersString ) ) ) {\n\t\t\t\t\t\t\t\tresponseHeaders[ match[ 1 ].toLowerCase() + " " ] =\n\t\t\t\t\t\t\t\t\t( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )\n\t\t\t\t\t\t\t\t\t\t.concat( match[ 2 ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmatch = responseHeaders[ key.toLowerCase() + " " ];\n\t\t\t\t\t}\n\t\t\t\t\treturn match == null ? null : match.join( ", " );\n\t\t\t\t},\n\n\t\t\t\t// Raw string\n\t\t\t\tgetAllResponseHeaders: function() {\n\t\t\t\t\treturn completed ? responseHeadersString : null;\n\t\t\t\t},\n\n\t\t\t\t// Caches the header\n\t\t\t\tsetRequestHeader: function( name, value ) {\n\t\t\t\t\tif ( completed == null ) {\n\t\t\t\t\t\tname = requestHeadersNames[ name.toLowerCase() ] =\n\t\t\t\t\t\t\trequestHeadersNames[ name.toLowerCase() ] || name;\n\t\t\t\t\t\trequestHeaders[ name ] = value;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Overrides response content-type header\n\t\t\t\toverrideMimeType: function( type ) {\n\t\t\t\t\tif ( completed == null ) {\n\t\t\t\t\t\ts.mimeType = type;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Status-dependent callbacks\n\t\t\t\tstatusCode: function( map ) {\n\t\t\t\t\tvar code;\n\t\t\t\t\tif ( map ) {\n\t\t\t\t\t\tif ( completed ) {\n\n\t\t\t\t\t\t\t// Execute the appropriate callbacks\n\t\t\t\t\t\t\tjqXHR.always( map[ jqXHR.status ] );\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t// Lazy-add the new callbacks in a way that preserves old ones\n\t\t\t\t\t\t\tfor ( code in map ) {\n\t\t\t\t\t\t\t\tstatusCode[ code ] = [ statusCode[ code ], map[ code ] ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Cancel the request\n\t\t\t\tabort: function( statusText ) {\n\t\t\t\t\tvar finalText = statusText || strAbort;\n\t\t\t\t\tif ( transport ) {\n\t\t\t\t\t\ttransport.abort( finalText );\n\t\t\t\t\t}\n\t\t\t\t\tdone( 0, finalText );\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t};\n\n\t\t// Attach deferreds\n\t\tdeferred.promise( jqXHR );\n\n\t\t// Add protocol if not provided (prefilters might expect it)\n\t\t// Handle falsy url in the settings object (trac-10093: consistency with old signature)\n\t\t// We also use the url parameter if available\n\t\ts.url = ( ( url || s.url || location.href ) + "" )\n\t\t\t.replace( rprotocol, location.protocol + "//" );\n\n\t\t// Alias method option to type as per ticket trac-12004\n\t\ts.type = options.method || options.type || s.method || s.type;\n\n\t\t// Extract dataTypes list\n\t\ts.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];\n\n\t\t// A cross-domain request is in order when the origin doesn\'t match the current origin.\n\t\tif ( s.crossDomain == null ) {\n\t\t\turlAnchor = document.createElement( "a" );\n\n\t\t\t// Support: IE <=8 - 11, Edge 12 - 15\n\t\t\t// IE throws exception on accessing the href property if url is malformed,\n\t\t\t// e.g. http://example.com:80x/\n\t\t\ttry {\n\t\t\t\turlAnchor.href = s.url;\n\n\t\t\t\t// Support: IE <=8 - 11 only\n\t\t\t\t// Anchor\'s host property isn\'t correctly set when s.url is relative\n\t\t\t\turlAnchor.href = urlAnchor.href;\n\t\t\t\ts.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==\n\t\t\t\t\turlAnchor.protocol + "//" + urlAnchor.host;\n\t\t\t} catch ( e ) {\n\n\t\t\t\t// If there is an error parsing the URL, assume it is crossDomain,\n\t\t\t\t// it can be rejected by the transport if it is invalid\n\t\t\t\ts.crossDomain = true;\n\t\t\t}\n\t\t}\n\n\t\t// Convert data if not already a string\n\t\tif ( s.data && s.processData && typeof s.data !== "string" ) {\n\t\t\ts.data = jQuery.param( s.data, s.traditional );\n\t\t}\n\n\t\t// Apply prefilters\n\t\tinspectPrefiltersOrTransports( prefilters, s, options, jqXHR );\n\n\t\t// If request was aborted inside a prefilter, stop there\n\t\tif ( completed ) {\n\t\t\treturn jqXHR;\n\t\t}\n\n\t\t// We can fire global events as of now if asked to\n\t\t// Don\'t fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118)\n\t\tfireGlobals = jQuery.event && s.global;\n\n\t\t// Watch for a new set of requests\n\t\tif ( fireGlobals && jQuery.active++ === 0 ) {\n\t\t\tjQuery.event.trigger( "ajaxStart" );\n\t\t}\n\n\t\t// Uppercase the type\n\t\ts.type = s.type.toUpperCase();\n\n\t\t// Determine if request has content\n\t\ts.hasContent = !rnoContent.test( s.type );\n\n\t\t// Save the URL in case we\'re toying with the If-Modified-Since\n\t\t// and/or If-None-Match header later on\n\t\t// Remove hash to simplify url manipulation\n\t\tcacheURL = s.url.replace( rhash, "" );\n\n\t\t// More options handling for requests with no content\n\t\tif ( !s.hasContent ) {\n\n\t\t\t// Remember the hash so we can put it back\n\t\t\tuncached = s.url.slice( cacheURL.length );\n\n\t\t\t// If data is available and should be processed, append data to url\n\t\t\tif ( s.data && ( s.processData || typeof s.data === "string" ) ) {\n\t\t\t\tcacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;\n\n\t\t\t\t// trac-9682: remove data so that it\'s not used in an eventual retry\n\t\t\t\tdelete s.data;\n\t\t\t}\n\n\t\t\t// Add or update anti-cache param if needed\n\t\t\tif ( s.cache === false ) {\n\t\t\t\tcacheURL = cacheURL.replace( rantiCache, "$1" );\n\t\t\t\tuncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +\n\t\t\t\t\tuncached;\n\t\t\t}\n\n\t\t\t// Put hash and anti-cache on the URL that will be requested (gh-1732)\n\t\t\ts.url = cacheURL + uncached;\n\n\t\t// Change \'%20\' to \'+\' if this is encoded form body content (gh-2658)\n\t\t} else if ( s.data && s.processData &&\n\t\t\t( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {\n\t\t\ts.data = s.data.replace( r20, "+" );\n\t\t}\n\n\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\tif ( s.ifModified ) {\n\t\t\tif ( jQuery.lastModified[ cacheURL ] ) {\n\t\t\t\tjqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );\n\t\t\t}\n\t\t\tif ( jQuery.etag[ cacheURL ] ) {\n\t\t\t\tjqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );\n\t\t\t}\n\t\t}\n\n\t\t// Set the correct header, if data is being sent\n\t\tif ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {\n\t\t\tjqXHR.setRequestHeader( "Content-Type", s.contentType );\n\t\t}\n\n\t\t// Set the Accepts header for the server, depending on the dataType\n\t\tjqXHR.setRequestHeader(\n\t\t\t"Accept",\n\t\t\ts.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?\n\t\t\t\ts.accepts[ s.dataTypes[ 0 ] ] +\n\t\t\t\t\t( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :\n\t\t\t\ts.accepts[ "*" ]\n\t\t);\n\n\t\t// Check for headers option\n\t\tfor ( i in s.headers ) {\n\t\t\tjqXHR.setRequestHeader( i, s.headers[ i ] );\n\t\t}\n\n\t\t// Allow custom headers/mimetypes and early abort\n\t\tif ( s.beforeSend &&\n\t\t\t( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {\n\n\t\t\t// Abort if not done already and return\n\t\t\treturn jqXHR.abort();\n\t\t}\n\n\t\t// Aborting is no longer a cancellation\n\t\tstrAbort = "abort";\n\n\t\t// Install callbacks on deferreds\n\t\tcompleteDeferred.add( s.complete );\n\t\tjqXHR.done( s.success );\n\t\tjqXHR.fail( s.error );\n\n\t\t// Get transport\n\t\ttransport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );\n\n\t\t// If no transport, we auto-abort\n\t\tif ( !transport ) {\n\t\t\tdone( -1, "No Transport" );\n\t\t} else {\n\t\t\tjqXHR.readyState = 1;\n\n\t\t\t// Send global event\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );\n\t\t\t}\n\n\t\t\t// If request was aborted inside ajaxSend, stop there\n\t\t\tif ( completed ) {\n\t\t\t\treturn jqXHR;\n\t\t\t}\n\n\t\t\t// Timeout\n\t\t\tif ( s.async && s.timeout > 0 ) {\n\t\t\t\ttimeoutTimer = window.setTimeout( function() {\n\t\t\t\t\tjqXHR.abort( "timeout" );\n\t\t\t\t}, s.timeout );\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tcompleted = false;\n\t\t\t\ttransport.send( requestHeaders, done );\n\t\t\t} catch ( e ) {\n\n\t\t\t\t// Rethrow post-completion exceptions\n\t\t\t\tif ( completed ) {\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\n\t\t\t\t// Propagate others as results\n\t\t\t\tdone( -1, e );\n\t\t\t}\n\t\t}\n\n\t\t// Callback for when everything is done\n\t\tfunction done( status, nativeStatusText, responses, headers ) {\n\t\t\tvar isSuccess, success, error, response, modified,\n\t\t\t\tstatusText = nativeStatusText;\n\n\t\t\t// Ignore repeat invocations\n\t\t\tif ( completed ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tcompleted = true;\n\n\t\t\t// Clear timeout if it exists\n\t\t\tif ( timeoutTimer ) {\n\t\t\t\twindow.clearTimeout( timeoutTimer );\n\t\t\t}\n\n\t\t\t// Dereference transport for early garbage collection\n\t\t\t// (no matter how long the jqXHR object will be used)\n\t\t\ttransport = undefined;\n\n\t\t\t// Cache response headers\n\t\t\tresponseHeadersString = headers || "";\n\n\t\t\t// Set readyState\n\t\t\tjqXHR.readyState = status > 0 ? 4 : 0;\n\n\t\t\t// Determine if successful\n\t\t\tisSuccess = status >= 200 && status < 300 || status === 304;\n\n\t\t\t// Get response data\n\t\t\tif ( responses ) {\n\t\t\t\tresponse = ajaxHandleResponses( s, jqXHR, responses );\n\t\t\t}\n\n\t\t\t// Use a noop converter for missing script but not if jsonp\n\t\t\tif ( !isSuccess &&\n\t\t\t\tjQuery.inArray( "script", s.dataTypes ) > -1 &&\n\t\t\t\tjQuery.inArray( "json", s.dataTypes ) < 0 ) {\n\t\t\t\ts.converters[ "text script" ] = function() {};\n\t\t\t}\n\n\t\t\t// Convert no matter what (that way responseXXX fields are always set)\n\t\t\tresponse = ajaxConvert( s, response, jqXHR, isSuccess );\n\n\t\t\t// If successful, handle type chaining\n\t\t\tif ( isSuccess ) {\n\n\t\t\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\t\t\tif ( s.ifModified ) {\n\t\t\t\t\tmodified = jqXHR.getResponseHeader( "Last-Modified" );\n\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\tjQuery.lastModified[ cacheURL ] = modified;\n\t\t\t\t\t}\n\t\t\t\t\tmodified = jqXHR.getResponseHeader( "etag" );\n\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\tjQuery.etag[ cacheURL ] = modified;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// if no content\n\t\t\t\tif ( status === 204 || s.type === "HEAD" ) {\n\t\t\t\t\tstatusText = "nocontent";\n\n\t\t\t\t// if not modified\n\t\t\t\t} else if ( status === 304 ) {\n\t\t\t\t\tstatusText = "notmodified";\n\n\t\t\t\t// If we have data, let\'s convert it\n\t\t\t\t} else {\n\t\t\t\t\tstatusText = response.state;\n\t\t\t\t\tsuccess = response.data;\n\t\t\t\t\terror = response.error;\n\t\t\t\t\tisSuccess = !error;\n\t\t\t\t}\n\t\t\t} else {\n\n\t\t\t\t// Extract error from statusText and normalize for non-aborts\n\t\t\t\terror = statusText;\n\t\t\t\tif ( status || !statusText ) {\n\t\t\t\t\tstatusText = "error";\n\t\t\t\t\tif ( status < 0 ) {\n\t\t\t\t\t\tstatus = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Set data for the fake xhr object\n\t\t\tjqXHR.status = status;\n\t\t\tjqXHR.statusText = ( nativeStatusText || statusText ) + "";\n\n\t\t\t// Success/Error\n\t\t\tif ( isSuccess ) {\n\t\t\t\tdeferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );\n\t\t\t} else {\n\t\t\t\tdeferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );\n\t\t\t}\n\n\t\t\t// Status-dependent callbacks\n\t\t\tjqXHR.statusCode( statusCode );\n\t\t\tstatusCode = undefined;\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",\n\t\t\t\t\t[ jqXHR, s, isSuccess ? success : error ] );\n\t\t\t}\n\n\t\t\t// Complete\n\t\t\tcompleteDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );\n\n\t\t\t\t// Handle the global AJAX counter\n\t\t\t\tif ( !( --jQuery.active ) ) {\n\t\t\t\t\tjQuery.event.trigger( "ajaxStop" );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn jqXHR;\n\t},\n\n\tgetJSON: function( url, data, callback ) {\n\t\treturn jQuery.get( url, data, callback, "json" );\n\t},\n\n\tgetScript: function( url, callback ) {\n\t\treturn jQuery.get( url, undefined, callback, "script" );\n\t}\n} );\n\njQuery.each( [ "get", "post" ], function( _i, method ) {\n\tjQuery[ method ] = function( url, data, callback, type ) {\n\n\t\t// Shift arguments if data argument was omitted\n\t\tif ( isFunction( data ) ) {\n\t\t\ttype = type || callback;\n\t\t\tcallback = data;\n\t\t\tdata = undefined;\n\t\t}\n\n\t\t// The url can be an options object (which then must have .url)\n\t\treturn jQuery.ajax( jQuery.extend( {\n\t\t\turl: url,\n\t\t\ttype: method,\n\t\t\tdataType: type,\n\t\t\tdata: data,\n\t\t\tsuccess: callback\n\t\t}, jQuery.isPlainObject( url ) && url ) );\n\t};\n} );\n\njQuery.ajaxPrefilter( function( s ) {\n\tvar i;\n\tfor ( i in s.headers ) {\n\t\tif ( i.toLowerCase() === "content-type" ) {\n\t\t\ts.contentType = s.headers[ i ] || "";\n\t\t}\n\t}\n} );\n\n\njQuery._evalUrl = function( url, options, doc ) {\n\treturn jQuery.ajax( {\n\t\turl: url,\n\n\t\t// Make this explicit, since user can override this through ajaxSetup (trac-11264)\n\t\ttype: "GET",\n\t\tdataType: "script",\n\t\tcache: true,\n\t\tasync: false,\n\t\tglobal: false,\n\n\t\t// Only evaluate the response if it is successful (gh-4126)\n\t\t// dataFilter is not invoked for failure responses, so using it instead\n\t\t// of the default converter is kludgy but it works.\n\t\tconverters: {\n\t\t\t"text script": function() {}\n\t\t},\n\t\tdataFilter: function( response ) {\n\t\t\tjQuery.globalEval( response, options, doc );\n\t\t}\n\t} );\n};\n\n\njQuery.fn.extend( {\n\twrapAll: function( html ) {\n\t\tvar wrap;\n\n\t\tif ( this[ 0 ] ) {\n\t\t\tif ( isFunction( html ) ) {\n\t\t\t\thtml = html.call( this[ 0 ] );\n\t\t\t}\n\n\t\t\t// The elements to wrap the target around\n\t\t\twrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );\n\n\t\t\tif ( this[ 0 ].parentNode ) {\n\t\t\t\twrap.insertBefore( this[ 0 ] );\n\t\t\t}\n\n\t\t\twrap.map( function() {\n\t\t\t\tvar elem = this;\n\n\t\t\t\twhile ( elem.firstElementChild ) {\n\t\t\t\t\telem = elem.firstElementChild;\n\t\t\t\t}\n\n\t\t\t\treturn elem;\n\t\t\t} ).append( this );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\twrapInner: function( html ) {\n\t\tif ( isFunction( html ) ) {\n\t\t\treturn this.each( function( i ) {\n\t\t\t\tjQuery( this ).wrapInner( html.call( this, i ) );\n\t\t\t} );\n\t\t}\n\n\t\treturn this.each( function() {\n\t\t\tvar self = jQuery( this ),\n\t\t\t\tcontents = self.contents();\n\n\t\t\tif ( contents.length ) {\n\t\t\t\tcontents.wrapAll( html );\n\n\t\t\t} else {\n\t\t\t\tself.append( html );\n\t\t\t}\n\t\t} );\n\t},\n\n\twrap: function( html ) {\n\t\tvar htmlIsFunction = isFunction( html );\n\n\t\treturn this.each( function( i ) {\n\t\t\tjQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );\n\t\t} );\n\t},\n\n\tunwrap: function( selector ) {\n\t\tthis.parent( selector ).not( "body" ).each( function() {\n\t\t\tjQuery( this ).replaceWith( this.childNodes );\n\t\t} );\n\t\treturn this;\n\t}\n} );\n\n\njQuery.expr.pseudos.hidden = function( elem ) {\n\treturn !jQuery.expr.pseudos.visible( elem );\n};\njQuery.expr.pseudos.visible = function( elem ) {\n\treturn !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );\n};\n\n\n\n\njQuery.ajaxSettings.xhr = function() {\n\ttry {\n\t\treturn new window.XMLHttpRequest();\n\t} catch ( e ) {}\n};\n\nvar xhrSuccessStatus = {\n\n\t\t// File protocol always yields status code 0, assume 200\n\t\t0: 200,\n\n\t\t// Support: IE <=9 only\n\t\t// trac-1450: sometimes IE returns 1223 when it should be 204\n\t\t1223: 204\n\t},\n\txhrSupported = jQuery.ajaxSettings.xhr();\n\nsupport.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );\nsupport.ajax = xhrSupported = !!xhrSupported;\n\njQuery.ajaxTransport( function( options ) {\n\tvar callback, errorCallback;\n\n\t// Cross domain only allowed if supported through XMLHttpRequest\n\tif ( support.cors || xhrSupported && !options.crossDomain ) {\n\t\treturn {\n\t\t\tsend: function( headers, complete ) {\n\t\t\t\tvar i,\n\t\t\t\t\txhr = options.xhr();\n\n\t\t\t\txhr.open(\n\t\t\t\t\toptions.type,\n\t\t\t\t\toptions.url,\n\t\t\t\t\toptions.async,\n\t\t\t\t\toptions.username,\n\t\t\t\t\toptions.password\n\t\t\t\t);\n\n\t\t\t\t// Apply custom fields if provided\n\t\t\t\tif ( options.xhrFields ) {\n\t\t\t\t\tfor ( i in options.xhrFields ) {\n\t\t\t\t\t\txhr[ i ] = options.xhrFields[ i ];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Override mime type if needed\n\t\t\t\tif ( options.mimeType && xhr.overrideMimeType ) {\n\t\t\t\t\txhr.overrideMimeType( options.mimeType );\n\t\t\t\t}\n\n\t\t\t\t// X-Requested-With header\n\t\t\t\t// For cross-domain requests, seeing as conditions for a preflight are\n\t\t\t\t// akin to a jigsaw puzzle, we simply never set it to be sure.\n\t\t\t\t// (it can always be set on a per-request basis or even using ajaxSetup)\n\t\t\t\t// For same-domain requests, won\'t change header if already provided.\n\t\t\t\tif ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {\n\t\t\t\t\theaders[ "X-Requested-With" ] = "XMLHttpRequest";\n\t\t\t\t}\n\n\t\t\t\t// Set headers\n\t\t\t\tfor ( i in headers ) {\n\t\t\t\t\txhr.setRequestHeader( i, headers[ i ] );\n\t\t\t\t}\n\n\t\t\t\t// Callback\n\t\t\t\tcallback = function( type ) {\n\t\t\t\t\treturn function() {\n\t\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\t\tcallback = errorCallback = xhr.onload =\n\t\t\t\t\t\t\t\txhr.onerror = xhr.onabort = xhr.ontimeout =\n\t\t\t\t\t\t\t\t\txhr.onreadystatechange = null;\n\n\t\t\t\t\t\t\tif ( type === "abort" ) {\n\t\t\t\t\t\t\t\txhr.abort();\n\t\t\t\t\t\t\t} else if ( type === "error" ) {\n\n\t\t\t\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t\t\t\t// On a manual native abort, IE9 throws\n\t\t\t\t\t\t\t\t// errors on any property access that is not readyState\n\t\t\t\t\t\t\t\tif ( typeof xhr.status !== "number" ) {\n\t\t\t\t\t\t\t\t\tcomplete( 0, "error" );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcomplete(\n\n\t\t\t\t\t\t\t\t\t\t// File: protocol always yields status 0; see trac-8605, trac-14207\n\t\t\t\t\t\t\t\t\t\txhr.status,\n\t\t\t\t\t\t\t\t\t\txhr.statusText\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcomplete(\n\t\t\t\t\t\t\t\t\txhrSuccessStatus[ xhr.status ] || xhr.status,\n\t\t\t\t\t\t\t\t\txhr.statusText,\n\n\t\t\t\t\t\t\t\t\t// Support: IE <=9 only\n\t\t\t\t\t\t\t\t\t// IE9 has no XHR2 but throws on binary (trac-11426)\n\t\t\t\t\t\t\t\t\t// For XHR2 non-text, let the caller handle it (gh-2498)\n\t\t\t\t\t\t\t\t\t( xhr.responseType || "text" ) !== "text" ||\n\t\t\t\t\t\t\t\t\ttypeof xhr.responseText !== "string" ?\n\t\t\t\t\t\t\t\t\t\t{ binary: xhr.response } :\n\t\t\t\t\t\t\t\t\t\t{ text: xhr.responseText },\n\t\t\t\t\t\t\t\t\txhr.getAllResponseHeaders()\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t};\n\n\t\t\t\t// Listen to events\n\t\t\t\txhr.onload = callback();\n\t\t\t\terrorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );\n\n\t\t\t\t// Support: IE 9 only\n\t\t\t\t// Use onreadystatechange to replace onabort\n\t\t\t\t// to handle uncaught aborts\n\t\t\t\tif ( xhr.onabort !== undefined ) {\n\t\t\t\t\txhr.onabort = errorCallback;\n\t\t\t\t} else {\n\t\t\t\t\txhr.onreadystatechange = function() {\n\n\t\t\t\t\t\t// Check readyState before timeout as it changes\n\t\t\t\t\t\tif ( xhr.readyState === 4 ) {\n\n\t\t\t\t\t\t\t// Allow onerror to be called first,\n\t\t\t\t\t\t\t// but that will not handle a native abort\n\t\t\t\t\t\t\t// Also, save errorCallback to a variable\n\t\t\t\t\t\t\t// as xhr.onerror cannot be accessed\n\t\t\t\t\t\t\twindow.setTimeout( function() {\n\t\t\t\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\t\t\t\terrorCallback();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// Create the abort callback\n\t\t\t\tcallback = callback( "abort" );\n\n\t\t\t\ttry {\n\n\t\t\t\t\t// Do send the request (this may raise an exception)\n\t\t\t\t\txhr.send( options.hasContent && options.data || null );\n\t\t\t\t} catch ( e ) {\n\n\t\t\t\t\t// trac-14683: Only rethrow if this hasn\'t been notified as an error yet\n\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tabort: function() {\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n} );\n\n\n\n\n// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)\njQuery.ajaxPrefilter( function( s ) {\n\tif ( s.crossDomain ) {\n\t\ts.contents.script = false;\n\t}\n} );\n\n// Install script dataType\njQuery.ajaxSetup( {\n\taccepts: {\n\t\tscript: "text/javascript, application/javascript, " +\n\t\t\t"application/ecmascript, application/x-ecmascript"\n\t},\n\tcontents: {\n\t\tscript: /\\b(?:java|ecma)script\\b/\n\t},\n\tconverters: {\n\t\t"text script": function( text ) {\n\t\t\tjQuery.globalEval( text );\n\t\t\treturn text;\n\t\t}\n\t}\n} );\n\n// Handle cache\'s special case and crossDomain\njQuery.ajaxPrefilter( "script", function( s ) {\n\tif ( s.cache === undefined ) {\n\t\ts.cache = false;\n\t}\n\tif ( s.crossDomain ) {\n\t\ts.type = "GET";\n\t}\n} );\n\n// Bind script tag hack transport\njQuery.ajaxTransport( "script", function( s ) {\n\n\t// This transport only deals with cross domain or forced-by-attrs requests\n\tif ( s.crossDomain || s.scriptAttrs ) {\n\t\tvar script, callback;\n\t\treturn {\n\t\t\tsend: function( _, complete ) {\n\t\t\t\tscript = jQuery( "<script>" )\n\t\t\t\t\t.attr( s.scriptAttrs || {} )\n\t\t\t\t\t.prop( { charset: s.scriptCharset, src: s.url } )\n\t\t\t\t\t.on( "load error", callback = function( evt ) {\n\t\t\t\t\t\tscript.remove();\n\t\t\t\t\t\tcallback = null;\n\t\t\t\t\t\tif ( evt ) {\n\t\t\t\t\t\t\tcomplete( evt.type === "error" ? 404 : 200, evt.type );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\n\t\t\t\t// Use native DOM manipulation to avoid our domManip AJAX trickery\n\t\t\t\tdocument.head.appendChild( script[ 0 ] );\n\t\t\t},\n\t\t\tabort: function() {\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tcallback();\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n} );\n\n\n\n\nvar oldCallbacks = [],\n\trjsonp = /(=)\\?(?=&|$)|\\?\\?/;\n\n// Default jsonp settings\njQuery.ajaxSetup( {\n\tjsonp: "callback",\n\tjsonpCallback: function() {\n\t\tvar callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );\n\t\tthis[ callback ] = true;\n\t\treturn callback;\n\t}\n} );\n\n// Detect, normalize options and install callbacks for jsonp requests\njQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {\n\n\tvar callbackName, overwritten, responseContainer,\n\t\tjsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?\n\t\t\t"url" :\n\t\t\ttypeof s.data === "string" &&\n\t\t\t\t( s.contentType || "" )\n\t\t\t\t\t.indexOf( "application/x-www-form-urlencoded" ) === 0 &&\n\t\t\t\trjsonp.test( s.data ) && "data"\n\t\t);\n\n\t// Handle iff the expected data type is "jsonp" or we have a parameter to set\n\tif ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {\n\n\t\t// Get callback name, remembering preexisting value associated with it\n\t\tcallbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?\n\t\t\ts.jsonpCallback() :\n\t\t\ts.jsonpCallback;\n\n\t\t// Insert callback into url or form data\n\t\tif ( jsonProp ) {\n\t\t\ts[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );\n\t\t} else if ( s.jsonp !== false ) {\n\t\t\ts.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;\n\t\t}\n\n\t\t// Use data converter to retrieve json after script execution\n\t\ts.converters[ "script json" ] = function() {\n\t\t\tif ( !responseContainer ) {\n\t\t\t\tjQuery.error( callbackName + " was not called" );\n\t\t\t}\n\t\t\treturn responseContainer[ 0 ];\n\t\t};\n\n\t\t// Force json dataType\n\t\ts.dataTypes[ 0 ] = "json";\n\n\t\t// Install callback\n\t\toverwritten = window[ callbackName ];\n\t\twindow[ callbackName ] = function() {\n\t\t\tresponseContainer = arguments;\n\t\t};\n\n\t\t// Clean-up function (fires after converters)\n\t\tjqXHR.always( function() {\n\n\t\t\t// If previous value didn\'t exist - remove it\n\t\t\tif ( overwritten === undefined ) {\n\t\t\t\tjQuery( window ).removeProp( callbackName );\n\n\t\t\t// Otherwise restore preexisting value\n\t\t\t} else {\n\t\t\t\twindow[ callbackName ] = overwritten;\n\t\t\t}\n\n\t\t\t// Save back as free\n\t\t\tif ( s[ callbackName ] ) {\n\n\t\t\t\t// Make sure that re-using the options doesn\'t screw things around\n\t\t\t\ts.jsonpCallback = originalSettings.jsonpCallback;\n\n\t\t\t\t// Save the callback name for future use\n\t\t\t\toldCallbacks.push( callbackName );\n\t\t\t}\n\n\t\t\t// Call if it was a function and we have a response\n\t\t\tif ( responseContainer && isFunction( overwritten ) ) {\n\t\t\t\toverwritten( responseContainer[ 0 ] );\n\t\t\t}\n\n\t\t\tresponseContainer = overwritten = undefined;\n\t\t} );\n\n\t\t// Delegate to script\n\t\treturn "script";\n\t}\n} );\n\n\n\n\n// Support: Safari 8 only\n// In Safari 8 documents created via document.implementation.createHTMLDocument\n// collapse sibling forms: the second one becomes a child of the first one.\n// Because of that, this security measure has to be disabled in Safari 8.\n// https://bugs.webkit.org/show_bug.cgi?id=137337\nsupport.createHTMLDocument = ( function() {\n\tvar body = document.implementation.createHTMLDocument( "" ).body;\n\tbody.innerHTML = "<form></form><form></form>";\n\treturn body.childNodes.length === 2;\n} )();\n\n\n// Argument "data" should be string of html\n// context (optional): If specified, the fragment will be created in this context,\n// defaults to document\n// keepScripts (optional): If true, will include scripts passed in the html string\njQuery.parseHTML = function( data, context, keepScripts ) {\n\tif ( typeof data !== "string" ) {\n\t\treturn [];\n\t}\n\tif ( typeof context === "boolean" ) {\n\t\tkeepScripts = context;\n\t\tcontext = false;\n\t}\n\n\tvar base, parsed, scripts;\n\n\tif ( !context ) {\n\n\t\t// Stop scripts or inline event handlers from being executed immediately\n\t\t// by using document.implementation\n\t\tif ( support.createHTMLDocument ) {\n\t\t\tcontext = document.implementation.createHTMLDocument( "" );\n\n\t\t\t// Set the base href for the created document\n\t\t\t// so any parsed elements with URLs\n\t\t\t// are based on the document\'s URL (gh-2965)\n\t\t\tbase = context.createElement( "base" );\n\t\t\tbase.href = document.location.href;\n\t\t\tcontext.head.appendChild( base );\n\t\t} else {\n\t\t\tcontext = document;\n\t\t}\n\t}\n\n\tparsed = rsingleTag.exec( data );\n\tscripts = !keepScripts && [];\n\n\t// Single tag\n\tif ( parsed ) {\n\t\treturn [ context.createElement( parsed[ 1 ] ) ];\n\t}\n\n\tparsed = buildFragment( [ data ], context, scripts );\n\n\tif ( scripts && scripts.length ) {\n\t\tjQuery( scripts ).remove();\n\t}\n\n\treturn jQuery.merge( [], parsed.childNodes );\n};\n\n\n/**\n * Load a url into a page\n */\njQuery.fn.load = function( url, params, callback ) {\n\tvar selector, type, response,\n\t\tself = this,\n\t\toff = url.indexOf( " " );\n\n\tif ( off > -1 ) {\n\t\tselector = stripAndCollapse( url.slice( off ) );\n\t\turl = url.slice( 0, off );\n\t}\n\n\t// If it\'s a function\n\tif ( isFunction( params ) ) {\n\n\t\t// We assume that it\'s the callback\n\t\tcallback = params;\n\t\tparams = undefined;\n\n\t// Otherwise, build a param string\n\t} else if ( params && typeof params === "object" ) {\n\t\ttype = "POST";\n\t}\n\n\t// If we have elements to modify, make the request\n\tif ( self.length > 0 ) {\n\t\tjQuery.ajax( {\n\t\t\turl: url,\n\n\t\t\t// If "type" variable is undefined, then "GET" method will be used.\n\t\t\t// Make value of this field explicit since\n\t\t\t// user can override it through ajaxSetup method\n\t\t\ttype: type || "GET",\n\t\t\tdataType: "html",\n\t\t\tdata: params\n\t\t} ).done( function( responseText ) {\n\n\t\t\t// Save response for use in complete callback\n\t\t\tresponse = arguments;\n\n\t\t\tself.html( selector ?\n\n\t\t\t\t// If a selector was specified, locate the right elements in a dummy div\n\t\t\t\t// Exclude scripts to avoid IE \'Permission Denied\' errors\n\t\t\t\tjQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :\n\n\t\t\t\t// Otherwise use the full result\n\t\t\t\tresponseText );\n\n\t\t// If the request succeeds, this function gets "data", "status", "jqXHR"\n\t\t// but they are ignored because response was set above.\n\t\t// If it fails, this function gets "jqXHR", "status", "error"\n\t\t} ).always( callback && function( jqXHR, status ) {\n\t\t\tself.each( function() {\n\t\t\t\tcallback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );\n\t\t\t} );\n\t\t} );\n\t}\n\n\treturn this;\n};\n\n\n\n\njQuery.expr.pseudos.animated = function( elem ) {\n\treturn jQuery.grep( jQuery.timers, function( fn ) {\n\t\treturn elem === fn.elem;\n\t} ).length;\n};\n\n\n\n\njQuery.offset = {\n\tsetOffset: function( elem, options, i ) {\n\t\tvar curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,\n\t\t\tposition = jQuery.css( elem, "position" ),\n\t\t\tcurElem = jQuery( elem ),\n\t\t\tprops = {};\n\n\t\t// Set position first, in-case top/left are set even on static elem\n\t\tif ( position === "static" ) {\n\t\t\telem.style.position = "relative";\n\t\t}\n\n\t\tcurOffset = curElem.offset();\n\t\tcurCSSTop = jQuery.css( elem, "top" );\n\t\tcurCSSLeft = jQuery.css( elem, "left" );\n\t\tcalculatePosition = ( position === "absolute" || position === "fixed" ) &&\n\t\t\t( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;\n\n\t\t// Need to be able to calculate position if either\n\t\t// top or left is auto and position is either absolute or fixed\n\t\tif ( calculatePosition ) {\n\t\t\tcurPosition = curElem.position();\n\t\t\tcurTop = curPosition.top;\n\t\t\tcurLeft = curPosition.left;\n\n\t\t} else {\n\t\t\tcurTop = parseFloat( curCSSTop ) || 0;\n\t\t\tcurLeft = parseFloat( curCSSLeft ) || 0;\n\t\t}\n\n\t\tif ( isFunction( options ) ) {\n\n\t\t\t// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)\n\t\t\toptions = options.call( elem, i, jQuery.extend( {}, curOffset ) );\n\t\t}\n\n\t\tif ( options.top != null ) {\n\t\t\tprops.top = ( options.top - curOffset.top ) + curTop;\n\t\t}\n\t\tif ( options.left != null ) {\n\t\t\tprops.left = ( options.left - curOffset.left ) + curLeft;\n\t\t}\n\n\t\tif ( "using" in options ) {\n\t\t\toptions.using.call( elem, props );\n\n\t\t} else {\n\t\t\tcurElem.css( props );\n\t\t}\n\t}\n};\n\njQuery.fn.extend( {\n\n\t// offset() relates an element\'s border box to the document origin\n\toffset: function( options ) {\n\n\t\t// Preserve chaining for setter\n\t\tif ( arguments.length ) {\n\t\t\treturn options === undefined ?\n\t\t\t\tthis :\n\t\t\t\tthis.each( function( i ) {\n\t\t\t\t\tjQuery.offset.setOffset( this, options, i );\n\t\t\t\t} );\n\t\t}\n\n\t\tvar rect, win,\n\t\t\telem = this[ 0 ];\n\n\t\tif ( !elem ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Return zeros for disconnected and hidden (display: none) elements (gh-2310)\n\t\t// Support: IE <=11 only\n\t\t// Running getBoundingClientRect on a\n\t\t// disconnected node in IE throws an error\n\t\tif ( !elem.getClientRects().length ) {\n\t\t\treturn { top: 0, left: 0 };\n\t\t}\n\n\t\t// Get document-relative position by adding viewport scroll to viewport-relative gBCR\n\t\trect = elem.getBoundingClientRect();\n\t\twin = elem.ownerDocument.defaultView;\n\t\treturn {\n\t\t\ttop: rect.top + win.pageYOffset,\n\t\t\tleft: rect.left + win.pageXOffset\n\t\t};\n\t},\n\n\t// position() relates an element\'s margin box to its offset parent\'s padding box\n\t// This corresponds to the behavior of CSS absolute positioning\n\tposition: function() {\n\t\tif ( !this[ 0 ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar offsetParent, offset, doc,\n\t\t\telem = this[ 0 ],\n\t\t\tparentOffset = { top: 0, left: 0 };\n\n\t\t// position:fixed elements are offset from the viewport, which itself always has zero offset\n\t\tif ( jQuery.css( elem, "position" ) === "fixed" ) {\n\n\t\t\t// Assume position:fixed implies availability of getBoundingClientRect\n\t\t\toffset = elem.getBoundingClientRect();\n\n\t\t} else {\n\t\t\toffset = this.offset();\n\n\t\t\t// Account for the *real* offset parent, which can be the document or its root element\n\t\t\t// when a statically positioned element is identified\n\t\t\tdoc = elem.ownerDocument;\n\t\t\toffsetParent = elem.offsetParent || doc.documentElement;\n\t\t\twhile ( offsetParent &&\n\t\t\t\t( offsetParent === doc.body || offsetParent === doc.documentElement ) &&\n\t\t\t\tjQuery.css( offsetParent, "position" ) === "static" ) {\n\n\t\t\t\toffsetParent = offsetParent.parentNode;\n\t\t\t}\n\t\t\tif ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {\n\n\t\t\t\t// Incorporate borders into its offset, since they are outside its content origin\n\t\t\t\tparentOffset = jQuery( offsetParent ).offset();\n\t\t\t\tparentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );\n\t\t\t\tparentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );\n\t\t\t}\n\t\t}\n\n\t\t// Subtract parent offsets and element margins\n\t\treturn {\n\t\t\ttop: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),\n\t\t\tleft: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )\n\t\t};\n\t},\n\n\t// This method will return documentElement in the following cases:\n\t// 1) For the element inside the iframe without offsetParent, this method will return\n\t// documentElement of the parent window\n\t// 2) For the hidden or detached element\n\t// 3) For body or html element, i.e. in case of the html node - it will return itself\n\t//\n\t// but those exceptions were never presented as a real life use-cases\n\t// and might be considered as more preferable results.\n\t//\n\t// This logic, however, is not guaranteed and can change at any point in the future\n\toffsetParent: function() {\n\t\treturn this.map( function() {\n\t\t\tvar offsetParent = this.offsetParent;\n\n\t\t\twhile ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {\n\t\t\t\toffsetParent = offsetParent.offsetParent;\n\t\t\t}\n\n\t\t\treturn offsetParent || documentElement;\n\t\t} );\n\t}\n} );\n\n// Create scrollLeft and scrollTop methods\njQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {\n\tvar top = "pageYOffset" === prop;\n\n\tjQuery.fn[ method ] = function( val ) {\n\t\treturn access( this, function( elem, method, val ) {\n\n\t\t\t// Coalesce documents and windows\n\t\t\tvar win;\n\t\t\tif ( isWindow( elem ) ) {\n\t\t\t\twin = elem;\n\t\t\t} else if ( elem.nodeType === 9 ) {\n\t\t\t\twin = elem.defaultView;\n\t\t\t}\n\n\t\t\tif ( val === undefined ) {\n\t\t\t\treturn win ? win[ prop ] : elem[ method ];\n\t\t\t}\n\n\t\t\tif ( win ) {\n\t\t\t\twin.scrollTo(\n\t\t\t\t\t!top ? val : win.pageXOffset,\n\t\t\t\t\ttop ? val : win.pageYOffset\n\t\t\t\t);\n\n\t\t\t} else {\n\t\t\t\telem[ method ] = val;\n\t\t\t}\n\t\t}, method, val, arguments.length );\n\t};\n} );\n\n// Support: Safari <=7 - 9.1, Chrome <=37 - 49\n// Add the top/left cssHooks using jQuery.fn.position\n// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084\n// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347\n// getComputedStyle returns percent when specified for top/left/bottom/right;\n// rather than make the css module depend on the offset module, just check for it here\njQuery.each( [ "top", "left" ], function( _i, prop ) {\n\tjQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,\n\t\tfunction( elem, computed ) {\n\t\t\tif ( computed ) {\n\t\t\t\tcomputed = curCSS( elem, prop );\n\n\t\t\t\t// If curCSS returns percentage, fallback to offset\n\t\t\t\treturn rnumnonpx.test( computed ) ?\n\t\t\t\t\tjQuery( elem ).position()[ prop ] + "px" :\n\t\t\t\t\tcomputed;\n\t\t\t}\n\t\t}\n\t);\n} );\n\n\n// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods\njQuery.each( { Height: "height", Width: "width" }, function( name, type ) {\n\tjQuery.each( {\n\t\tpadding: "inner" + name,\n\t\tcontent: type,\n\t\t"": "outer" + name\n\t}, function( defaultExtra, funcName ) {\n\n\t\t// Margin is only for outerHeight, outerWidth\n\t\tjQuery.fn[ funcName ] = function( margin, value ) {\n\t\t\tvar chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),\n\t\t\t\textra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );\n\n\t\t\treturn access( this, function( elem, type, value ) {\n\t\t\t\tvar doc;\n\n\t\t\t\tif ( isWindow( elem ) ) {\n\n\t\t\t\t\t// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)\n\t\t\t\t\treturn funcName.indexOf( "outer" ) === 0 ?\n\t\t\t\t\t\telem[ "inner" + name ] :\n\t\t\t\t\t\telem.document.documentElement[ "client" + name ];\n\t\t\t\t}\n\n\t\t\t\t// Get document width or height\n\t\t\t\tif ( elem.nodeType === 9 ) {\n\t\t\t\t\tdoc = elem.documentElement;\n\n\t\t\t\t\t// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],\n\t\t\t\t\t// whichever is greatest\n\t\t\t\t\treturn Math.max(\n\t\t\t\t\t\telem.body[ "scroll" + name ], doc[ "scroll" + name ],\n\t\t\t\t\t\telem.body[ "offset" + name ], doc[ "offset" + name ],\n\t\t\t\t\t\tdoc[ "client" + name ]\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn value === undefined ?\n\n\t\t\t\t\t// Get width or height on the element, requesting but not forcing parseFloat\n\t\t\t\t\tjQuery.css( elem, type, extra ) :\n\n\t\t\t\t\t// Set width or height on the element\n\t\t\t\t\tjQuery.style( elem, type, value, extra );\n\t\t\t}, type, chainable ? margin : undefined, chainable );\n\t\t};\n\t} );\n} );\n\n\njQuery.each( [\n\t"ajaxStart",\n\t"ajaxStop",\n\t"ajaxComplete",\n\t"ajaxError",\n\t"ajaxSuccess",\n\t"ajaxSend"\n], function( _i, type ) {\n\tjQuery.fn[ type ] = function( fn ) {\n\t\treturn this.on( type, fn );\n\t};\n} );\n\n\n\n\njQuery.fn.extend( {\n\n\tbind: function( types, data, fn ) {\n\t\treturn this.on( types, null, data, fn );\n\t},\n\tunbind: function( types, fn ) {\n\t\treturn this.off( types, null, fn );\n\t},\n\n\tdelegate: function( selector, types, data, fn ) {\n\t\treturn this.on( types, selector, data, fn );\n\t},\n\tundelegate: function( selector, types, fn ) {\n\n\t\t// ( namespace ) or ( selector, types [, fn] )\n\t\treturn arguments.length === 1 ?\n\t\t\tthis.off( selector, "**" ) :\n\t\t\tthis.off( types, selector || "**", fn );\n\t},\n\n\thover: function( fnOver, fnOut ) {\n\t\treturn this\n\t\t\t.on( "mouseenter", fnOver )\n\t\t\t.on( "mouseleave", fnOut || fnOver );\n\t}\n} );\n\njQuery.each(\n\t( "blur focus focusin focusout resize scroll click dblclick " +\n\t"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +\n\t"change select submit keydown keypress keyup contextmenu" ).split( " " ),\n\tfunction( _i, name ) {\n\n\t\t// Handle event binding\n\t\tjQuery.fn[ name ] = function( data, fn ) {\n\t\t\treturn arguments.length > 0 ?\n\t\t\t\tthis.on( name, null, data, fn ) :\n\t\t\t\tthis.trigger( name );\n\t\t};\n\t}\n);\n\n\n\n\n// Support: Android <=4.0 only\n// Make sure we trim BOM and NBSP\n// Require that the "whitespace run" starts from a non-whitespace\n// to avoid O(N^2) behavior when the engine would try matching "\\s+$" at each space position.\nvar rtrim = /^[\\s\\uFEFF\\xA0]+|([^\\s\\uFEFF\\xA0])[\\s\\uFEFF\\xA0]+$/g;\n\n// Bind a function to a context, optionally partially applying any\n// arguments.\n// jQuery.proxy is deprecated to promote standards (specifically Function#bind)\n// However, it is not slated for removal any time soon\njQuery.proxy = function( fn, context ) {\n\tvar tmp, args, proxy;\n\n\tif ( typeof context === "string" ) {\n\t\ttmp = fn[ context ];\n\t\tcontext = fn;\n\t\tfn = tmp;\n\t}\n\n\t// Quick check to determine if target is callable, in the spec\n\t// this throws a TypeError, but we will just return undefined.\n\tif ( !isFunction( fn ) ) {\n\t\treturn undefined;\n\t}\n\n\t// Simulated bind\n\targs = slice.call( arguments, 2 );\n\tproxy = function() {\n\t\treturn fn.apply( context || this, args.concat( slice.call( arguments ) ) );\n\t};\n\n\t// Set the guid of unique handler to the same of original handler, so it can be removed\n\tproxy.guid = fn.guid = fn.guid || jQuery.guid++;\n\n\treturn proxy;\n};\n\njQuery.holdReady = function( hold ) {\n\tif ( hold ) {\n\t\tjQuery.readyWait++;\n\t} else {\n\t\tjQuery.ready( true );\n\t}\n};\njQuery.isArray = Array.isArray;\njQuery.parseJSON = JSON.parse;\njQuery.nodeName = nodeName;\njQuery.isFunction = isFunction;\njQuery.isWindow = isWindow;\njQuery.camelCase = camelCase;\njQuery.type = toType;\n\njQuery.now = Date.now;\n\njQuery.isNumeric = function( obj ) {\n\n\t// As of jQuery 3.0, isNumeric is limited to\n\t// strings and numbers (primitives or objects)\n\t// that can be coerced to finite numbers (gh-2662)\n\tvar type = jQuery.type( obj );\n\treturn ( type === "number" || type === "string" ) &&\n\n\t\t// parseFloat NaNs numeric-cast false positives ("")\n\t\t// ...but misinterprets leading-number strings, particularly hex literals ("0x...")\n\t\t// subtraction forces infinities to NaN\n\t\t!isNaN( obj - parseFloat( obj ) );\n};\n\njQuery.trim = function( text ) {\n\treturn text == null ?\n\t\t"" :\n\t\t( text + "" ).replace( rtrim, "$1" );\n};\n\n\n\n// Register as a named AMD module, since jQuery can be concatenated with other\n// files that may use define, but not via a proper concatenation script that\n// understands anonymous AMD modules. A named AMD is safest and most robust\n// way to register. Lowercase jquery is used because AMD module names are\n// derived from file names, and jQuery is normally delivered in a lowercase\n// file name. Do this after creating the global so that if an AMD module wants\n// to call noConflict to hide this version of jQuery, it will work.\n\n// Note that for maximum portability, libraries that are not jQuery should\n// declare themselves as anonymous modules, and avoid setting a global if an\n// AMD loader is present. jQuery is a special case. For more information, see\n// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon\n\nif ( true ) {\n\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {\n\t\treturn jQuery;\n\t}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n}\n\n\n\n\nvar\n\n\t// Map over jQuery in case of overwrite\n\t_jQuery = window.jQuery,\n\n\t// Map over the $ in case of overwrite\n\t_$ = window.$;\n\njQuery.noConflict = function( deep ) {\n\tif ( window.$ === jQuery ) {\n\t\twindow.$ = _$;\n\t}\n\n\tif ( deep && window.jQuery === jQuery ) {\n\t\twindow.jQuery = _jQuery;\n\t}\n\n\treturn jQuery;\n};\n\n// Expose jQuery and $ identifiers, even in AMD\n// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557)\n// and CommonJS for browser emulators (trac-13566)\nif ( typeof noGlobal === "undefined" ) {\n\twindow.jQuery = window.$ = jQuery;\n}\n\n\n\n\nreturn jQuery;\n} );\n\n\n//# sourceURL=webpack://web/./node_modules/jquery/dist/jquery.js?')},"./node_modules/keycode/index.js":(module,exports)=>{eval("// Source: http://jsfiddle.net/vWx8V/\n// http://stackoverflow.com/questions/5603195/full-list-of-javascript-keycodes\n\n/**\n * Conenience method returns corresponding value for given keyName or keyCode.\n *\n * @param {Mixed} keyCode {Number} or keyName {String}\n * @return {Mixed}\n * @api public\n */\n\nfunction keyCode(searchInput) {\n // Keyboard Events\n if (searchInput && 'object' === typeof searchInput) {\n var hasKeyCode = searchInput.which || searchInput.keyCode || searchInput.charCode\n if (hasKeyCode) searchInput = hasKeyCode\n }\n\n // Numbers\n if ('number' === typeof searchInput) return names[searchInput]\n\n // Everything else (cast to string)\n var search = String(searchInput)\n\n // check codes\n var foundNamedKey = codes[search.toLowerCase()]\n if (foundNamedKey) return foundNamedKey\n\n // check aliases\n var foundNamedKey = aliases[search.toLowerCase()]\n if (foundNamedKey) return foundNamedKey\n\n // weird character?\n if (search.length === 1) return search.charCodeAt(0)\n\n return undefined\n}\n\n/**\n * Compares a keyboard event with a given keyCode or keyName.\n *\n * @param {Event} event Keyboard event that should be tested\n * @param {Mixed} keyCode {Number} or keyName {String}\n * @return {Boolean}\n * @api public\n */\nkeyCode.isEventKey = function isEventKey(event, nameOrCode) {\n if (event && 'object' === typeof event) {\n var keyCode = event.which || event.keyCode || event.charCode\n if (keyCode === null || keyCode === undefined) { return false; }\n if (typeof nameOrCode === 'string') {\n // check codes\n var foundNamedKey = codes[nameOrCode.toLowerCase()]\n if (foundNamedKey) { return foundNamedKey === keyCode; }\n \n // check aliases\n var foundNamedKey = aliases[nameOrCode.toLowerCase()]\n if (foundNamedKey) { return foundNamedKey === keyCode; }\n } else if (typeof nameOrCode === 'number') {\n return nameOrCode === keyCode;\n }\n return false;\n }\n}\n\nexports = module.exports = keyCode;\n\n/**\n * Get by name\n *\n * exports.code['enter'] // => 13\n */\n\nvar codes = exports.code = exports.codes = {\n 'backspace': 8,\n 'tab': 9,\n 'enter': 13,\n 'shift': 16,\n 'ctrl': 17,\n 'alt': 18,\n 'pause/break': 19,\n 'caps lock': 20,\n 'esc': 27,\n 'space': 32,\n 'page up': 33,\n 'page down': 34,\n 'end': 35,\n 'home': 36,\n 'left': 37,\n 'up': 38,\n 'right': 39,\n 'down': 40,\n 'insert': 45,\n 'delete': 46,\n 'command': 91,\n 'left command': 91,\n 'right command': 93,\n 'numpad *': 106,\n 'numpad +': 107,\n 'numpad -': 109,\n 'numpad .': 110,\n 'numpad /': 111,\n 'num lock': 144,\n 'scroll lock': 145,\n 'my computer': 182,\n 'my calculator': 183,\n ';': 186,\n '=': 187,\n ',': 188,\n '-': 189,\n '.': 190,\n '/': 191,\n '`': 192,\n '[': 219,\n '\\\\': 220,\n ']': 221,\n \"'\": 222\n}\n\n// Helper aliases\n\nvar aliases = exports.aliases = {\n 'windows': 91,\n '⇧': 16,\n '⌥': 18,\n '⌃': 17,\n '⌘': 91,\n 'ctl': 17,\n 'control': 17,\n 'option': 18,\n 'pause': 19,\n 'break': 19,\n 'caps': 20,\n 'return': 13,\n 'escape': 27,\n 'spc': 32,\n 'spacebar': 32,\n 'pgup': 33,\n 'pgdn': 34,\n 'ins': 45,\n 'del': 46,\n 'cmd': 91\n}\n\n/*!\n * Programatically add the following\n */\n\n// lower case chars\nfor (i = 97; i < 123; i++) codes[String.fromCharCode(i)] = i - 32\n\n// numbers\nfor (var i = 48; i < 58; i++) codes[i - 48] = i\n\n// function keys\nfor (i = 1; i < 13; i++) codes['f'+i] = i + 111\n\n// numpad keys\nfor (i = 0; i < 10; i++) codes['numpad '+i] = i + 96\n\n/**\n * Get by code\n *\n * exports.name[13] // => 'Enter'\n */\n\nvar names = exports.names = exports.title = {} // title for backward compat\n\n// Create reverse mapping\nfor (i in codes) names[codes[i]] = i\n\n// Add aliases\nfor (var alias in aliases) {\n codes[alias] = aliases[alias]\n}\n\n\n//# sourceURL=webpack://web/./node_modules/keycode/index.js?")},"./node_modules/m3u8-parser/dist/m3u8-parser.es.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LineStream: () => (/* binding */ LineStream),\n/* harmony export */ ParseStream: () => (/* binding */ ParseStream),\n/* harmony export */ Parser: () => (/* binding */ Parser)\n/* harmony export */ });\n/* harmony import */ var _videojs_vhs_utils_es_stream_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @videojs/vhs-utils/es/stream.js */ \"./node_modules/m3u8-parser/node_modules/@videojs/vhs-utils/es/stream.js\");\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var _videojs_vhs_utils_es_decode_b64_to_uint8_array_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @videojs/vhs-utils/es/decode-b64-to-uint8-array.js */ \"./node_modules/m3u8-parser/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js\");\n/*! @name m3u8-parser @version 7.1.0 @license Apache-2.0 */\n\n\n\n\n/**\n * @file m3u8/line-stream.js\n */\n/**\n * A stream that buffers string input and generates a `data` event for each\n * line.\n *\n * @class LineStream\n * @extends Stream\n */\n\nclass LineStream extends _videojs_vhs_utils_es_stream_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n constructor() {\n super();\n this.buffer = '';\n }\n /**\n * Add new data to be parsed.\n *\n * @param {string} data the text to process\n */\n\n\n push(data) {\n let nextNewline;\n this.buffer += data;\n nextNewline = this.buffer.indexOf('\\n');\n\n for (; nextNewline > -1; nextNewline = this.buffer.indexOf('\\n')) {\n this.trigger('data', this.buffer.substring(0, nextNewline));\n this.buffer = this.buffer.substring(nextNewline + 1);\n }\n }\n\n}\n\nconst TAB = String.fromCharCode(0x09);\n\nconst parseByterange = function (byterangeString) {\n // optionally match and capture 0+ digits before `@`\n // optionally match and capture 0+ digits after `@`\n const match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || '');\n const result = {};\n\n if (match[1]) {\n result.length = parseInt(match[1], 10);\n }\n\n if (match[2]) {\n result.offset = parseInt(match[2], 10);\n }\n\n return result;\n};\n/**\n * \"forgiving\" attribute list psuedo-grammar:\n * attributes -> keyvalue (',' keyvalue)*\n * keyvalue -> key '=' value\n * key -> [^=]*\n * value -> '\"' [^\"]* '\"' | [^,]*\n */\n\n\nconst attributeSeparator = function () {\n const key = '[^=]*';\n const value = '\"[^\"]*\"|[^,]*';\n const keyvalue = '(?:' + key + ')=(?:' + value + ')';\n return new RegExp('(?:^|,)(' + keyvalue + ')');\n};\n/**\n * Parse attributes from a line given the separator\n *\n * @param {string} attributes the attribute line to parse\n */\n\n\nconst parseAttributes = function (attributes) {\n const result = {};\n\n if (!attributes) {\n return result;\n } // split the string using attributes as the separator\n\n\n const attrs = attributes.split(attributeSeparator());\n let i = attrs.length;\n let attr;\n\n while (i--) {\n // filter out unmatched portions of the string\n if (attrs[i] === '') {\n continue;\n } // split the key and value\n\n\n attr = /([^=]*)=(.*)/.exec(attrs[i]).slice(1); // trim whitespace and remove optional quotes around the value\n\n attr[0] = attr[0].replace(/^\\s+|\\s+$/g, '');\n attr[1] = attr[1].replace(/^\\s+|\\s+$/g, '');\n attr[1] = attr[1].replace(/^['\"](.*)['\"]$/g, '$1');\n result[attr[0]] = attr[1];\n }\n\n return result;\n};\n/**\n * A line-level M3U8 parser event stream. It expects to receive input one\n * line at a time and performs a context-free parse of its contents. A stream\n * interpretation of a manifest can be useful if the manifest is expected to\n * be too large to fit comfortably into memory or the entirety of the input\n * is not immediately available. Otherwise, it's probably much easier to work\n * with a regular `Parser` object.\n *\n * Produces `data` events with an object that captures the parser's\n * interpretation of the input. That object has a property `tag` that is one\n * of `uri`, `comment`, or `tag`. URIs only have a single additional\n * property, `line`, which captures the entirety of the input without\n * interpretation. Comments similarly have a single additional property\n * `text` which is the input without the leading `#`.\n *\n * Tags always have a property `tagType` which is the lower-cased version of\n * the M3U8 directive without the `#EXT` or `#EXT-X-` prefix. For instance,\n * `#EXT-X-MEDIA-SEQUENCE` becomes `media-sequence` when parsed. Unrecognized\n * tags are given the tag type `unknown` and a single additional property\n * `data` with the remainder of the input.\n *\n * @class ParseStream\n * @extends Stream\n */\n\n\nclass ParseStream extends _videojs_vhs_utils_es_stream_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n constructor() {\n super();\n this.customParsers = [];\n this.tagMappers = [];\n }\n /**\n * Parses an additional line of input.\n *\n * @param {string} line a single line of an M3U8 file to parse\n */\n\n\n push(line) {\n let match;\n let event; // strip whitespace\n\n line = line.trim();\n\n if (line.length === 0) {\n // ignore empty lines\n return;\n } // URIs\n\n\n if (line[0] !== '#') {\n this.trigger('data', {\n type: 'uri',\n uri: line\n });\n return;\n } // map tags\n\n\n const newLines = this.tagMappers.reduce((acc, mapper) => {\n const mappedLine = mapper(line); // skip if unchanged\n\n if (mappedLine === line) {\n return acc;\n }\n\n return acc.concat([mappedLine]);\n }, [line]);\n newLines.forEach(newLine => {\n for (let i = 0; i < this.customParsers.length; i++) {\n if (this.customParsers[i].call(this, newLine)) {\n return;\n }\n } // Comments\n\n\n if (newLine.indexOf('#EXT') !== 0) {\n this.trigger('data', {\n type: 'comment',\n text: newLine.slice(1)\n });\n return;\n } // strip off any carriage returns here so the regex matching\n // doesn't have to account for them.\n\n\n newLine = newLine.replace('\\r', ''); // Tags\n\n match = /^#EXTM3U/.exec(newLine);\n\n if (match) {\n this.trigger('data', {\n type: 'tag',\n tagType: 'm3u'\n });\n return;\n }\n\n match = /^#EXTINF:([0-9\\.]*)?,?(.*)?$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'inf'\n };\n\n if (match[1]) {\n event.duration = parseFloat(match[1]);\n }\n\n if (match[2]) {\n event.title = match[2];\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'targetduration'\n };\n\n if (match[1]) {\n event.duration = parseInt(match[1], 10);\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-VERSION:([0-9.]*)?/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'version'\n };\n\n if (match[1]) {\n event.version = parseInt(match[1], 10);\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-MEDIA-SEQUENCE:(\\-?[0-9.]*)?/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'media-sequence'\n };\n\n if (match[1]) {\n event.number = parseInt(match[1], 10);\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-DISCONTINUITY-SEQUENCE:(\\-?[0-9.]*)?/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'discontinuity-sequence'\n };\n\n if (match[1]) {\n event.number = parseInt(match[1], 10);\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'playlist-type'\n };\n\n if (match[1]) {\n event.playlistType = match[1];\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-BYTERANGE:(.*)?$/.exec(newLine);\n\n if (match) {\n event = (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(parseByterange(match[1]), {\n type: 'tag',\n tagType: 'byterange'\n });\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'allow-cache'\n };\n\n if (match[1]) {\n event.allowed = !/NO/.test(match[1]);\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-MAP:(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'map'\n };\n\n if (match[1]) {\n const attributes = parseAttributes(match[1]);\n\n if (attributes.URI) {\n event.uri = attributes.URI;\n }\n\n if (attributes.BYTERANGE) {\n event.byterange = parseByterange(attributes.BYTERANGE);\n }\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-STREAM-INF:(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'stream-inf'\n };\n\n if (match[1]) {\n event.attributes = parseAttributes(match[1]);\n\n if (event.attributes.RESOLUTION) {\n const split = event.attributes.RESOLUTION.split('x');\n const resolution = {};\n\n if (split[0]) {\n resolution.width = parseInt(split[0], 10);\n }\n\n if (split[1]) {\n resolution.height = parseInt(split[1], 10);\n }\n\n event.attributes.RESOLUTION = resolution;\n }\n\n if (event.attributes.BANDWIDTH) {\n event.attributes.BANDWIDTH = parseInt(event.attributes.BANDWIDTH, 10);\n }\n\n if (event.attributes['FRAME-RATE']) {\n event.attributes['FRAME-RATE'] = parseFloat(event.attributes['FRAME-RATE']);\n }\n\n if (event.attributes['PROGRAM-ID']) {\n event.attributes['PROGRAM-ID'] = parseInt(event.attributes['PROGRAM-ID'], 10);\n }\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-MEDIA:(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'media'\n };\n\n if (match[1]) {\n event.attributes = parseAttributes(match[1]);\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-ENDLIST/.exec(newLine);\n\n if (match) {\n this.trigger('data', {\n type: 'tag',\n tagType: 'endlist'\n });\n return;\n }\n\n match = /^#EXT-X-DISCONTINUITY/.exec(newLine);\n\n if (match) {\n this.trigger('data', {\n type: 'tag',\n tagType: 'discontinuity'\n });\n return;\n }\n\n match = /^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'program-date-time'\n };\n\n if (match[1]) {\n event.dateTimeString = match[1];\n event.dateTimeObject = new Date(match[1]);\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-KEY:(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'key'\n };\n\n if (match[1]) {\n event.attributes = parseAttributes(match[1]); // parse the IV string into a Uint32Array\n\n if (event.attributes.IV) {\n if (event.attributes.IV.substring(0, 2).toLowerCase() === '0x') {\n event.attributes.IV = event.attributes.IV.substring(2);\n }\n\n event.attributes.IV = event.attributes.IV.match(/.{8}/g);\n event.attributes.IV[0] = parseInt(event.attributes.IV[0], 16);\n event.attributes.IV[1] = parseInt(event.attributes.IV[1], 16);\n event.attributes.IV[2] = parseInt(event.attributes.IV[2], 16);\n event.attributes.IV[3] = parseInt(event.attributes.IV[3], 16);\n event.attributes.IV = new Uint32Array(event.attributes.IV);\n }\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-START:(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'start'\n };\n\n if (match[1]) {\n event.attributes = parseAttributes(match[1]);\n event.attributes['TIME-OFFSET'] = parseFloat(event.attributes['TIME-OFFSET']);\n event.attributes.PRECISE = /YES/.test(event.attributes.PRECISE);\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'cue-out-cont'\n };\n\n if (match[1]) {\n event.data = match[1];\n } else {\n event.data = '';\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-CUE-OUT:(.*)?$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'cue-out'\n };\n\n if (match[1]) {\n event.data = match[1];\n } else {\n event.data = '';\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-CUE-IN:(.*)?$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'cue-in'\n };\n\n if (match[1]) {\n event.data = match[1];\n } else {\n event.data = '';\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-SKIP:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'skip'\n };\n event.attributes = parseAttributes(match[1]);\n\n if (event.attributes.hasOwnProperty('SKIPPED-SEGMENTS')) {\n event.attributes['SKIPPED-SEGMENTS'] = parseInt(event.attributes['SKIPPED-SEGMENTS'], 10);\n }\n\n if (event.attributes.hasOwnProperty('RECENTLY-REMOVED-DATERANGES')) {\n event.attributes['RECENTLY-REMOVED-DATERANGES'] = event.attributes['RECENTLY-REMOVED-DATERANGES'].split(TAB);\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-PART:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'part'\n };\n event.attributes = parseAttributes(match[1]);\n ['DURATION'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = parseFloat(event.attributes[key]);\n }\n });\n ['INDEPENDENT', 'GAP'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = /YES/.test(event.attributes[key]);\n }\n });\n\n if (event.attributes.hasOwnProperty('BYTERANGE')) {\n event.attributes.byterange = parseByterange(event.attributes.BYTERANGE);\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'server-control'\n };\n event.attributes = parseAttributes(match[1]);\n ['CAN-SKIP-UNTIL', 'PART-HOLD-BACK', 'HOLD-BACK'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = parseFloat(event.attributes[key]);\n }\n });\n ['CAN-SKIP-DATERANGES', 'CAN-BLOCK-RELOAD'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = /YES/.test(event.attributes[key]);\n }\n });\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'part-inf'\n };\n event.attributes = parseAttributes(match[1]);\n ['PART-TARGET'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = parseFloat(event.attributes[key]);\n }\n });\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'preload-hint'\n };\n event.attributes = parseAttributes(match[1]);\n ['BYTERANGE-START', 'BYTERANGE-LENGTH'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = parseInt(event.attributes[key], 10);\n const subkey = key === 'BYTERANGE-LENGTH' ? 'length' : 'offset';\n event.attributes.byterange = event.attributes.byterange || {};\n event.attributes.byterange[subkey] = event.attributes[key]; // only keep the parsed byterange object.\n\n delete event.attributes[key];\n }\n });\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'rendition-report'\n };\n event.attributes = parseAttributes(match[1]);\n ['LAST-MSN', 'LAST-PART'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = parseInt(event.attributes[key], 10);\n }\n });\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-DATERANGE:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'daterange'\n };\n event.attributes = parseAttributes(match[1]);\n ['ID', 'CLASS'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = String(event.attributes[key]);\n }\n });\n ['START-DATE', 'END-DATE'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = new Date(event.attributes[key]);\n }\n });\n ['DURATION', 'PLANNED-DURATION'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = parseFloat(event.attributes[key]);\n }\n });\n ['END-ON-NEXT'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = /YES/i.test(event.attributes[key]);\n }\n });\n ['SCTE35-CMD', ' SCTE35-OUT', 'SCTE35-IN'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = event.attributes[key].toString(16);\n }\n });\n const clientAttributePattern = /^X-([A-Z]+-)+[A-Z]+$/;\n\n for (const key in event.attributes) {\n if (!clientAttributePattern.test(key)) {\n continue;\n }\n\n const isHexaDecimal = /[0-9A-Fa-f]{6}/g.test(event.attributes[key]);\n const isDecimalFloating = /^\\d+(\\.\\d+)?$/.test(event.attributes[key]);\n event.attributes[key] = isHexaDecimal ? event.attributes[key].toString(16) : isDecimalFloating ? parseFloat(event.attributes[key]) : String(event.attributes[key]);\n }\n\n this.trigger('data', event);\n return;\n }\n\n match = /^#EXT-X-INDEPENDENT-SEGMENTS/.exec(newLine);\n\n if (match) {\n this.trigger('data', {\n type: 'tag',\n tagType: 'independent-segments'\n });\n return;\n }\n\n match = /^#EXT-X-CONTENT-STEERING:(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'content-steering'\n };\n event.attributes = parseAttributes(match[1]);\n this.trigger('data', event);\n return;\n } // unknown tag type\n\n\n this.trigger('data', {\n type: 'tag',\n data: newLine.slice(4)\n });\n });\n }\n /**\n * Add a parser for custom headers\n *\n * @param {Object} options a map of options for the added parser\n * @param {RegExp} options.expression a regular expression to match the custom header\n * @param {string} options.customType the custom type to register to the output\n * @param {Function} [options.dataParser] function to parse the line into an object\n * @param {boolean} [options.segment] should tag data be attached to the segment object\n */\n\n\n addParser({\n expression,\n customType,\n dataParser,\n segment\n }) {\n if (typeof dataParser !== 'function') {\n dataParser = line => line;\n }\n\n this.customParsers.push(line => {\n const match = expression.exec(line);\n\n if (match) {\n this.trigger('data', {\n type: 'custom',\n data: dataParser(line),\n customType,\n segment\n });\n return true;\n }\n });\n }\n /**\n * Add a custom header mapper\n *\n * @param {Object} options\n * @param {RegExp} options.expression a regular expression to match the custom header\n * @param {Function} options.map function to translate tag into a different tag\n */\n\n\n addTagMapper({\n expression,\n map\n }) {\n const mapFn = line => {\n if (expression.test(line)) {\n return map(line);\n }\n\n return line;\n };\n\n this.tagMappers.push(mapFn);\n }\n\n}\n\nconst camelCase = str => str.toLowerCase().replace(/-(\\w)/g, a => a[1].toUpperCase());\n\nconst camelCaseKeys = function (attributes) {\n const result = {};\n Object.keys(attributes).forEach(function (key) {\n result[camelCase(key)] = attributes[key];\n });\n return result;\n}; // set SERVER-CONTROL hold back based upon targetDuration and partTargetDuration\n// we need this helper because defaults are based upon targetDuration and\n// partTargetDuration being set, but they may not be if SERVER-CONTROL appears before\n// target durations are set.\n\n\nconst setHoldBack = function (manifest) {\n const {\n serverControl,\n targetDuration,\n partTargetDuration\n } = manifest;\n\n if (!serverControl) {\n return;\n }\n\n const tag = '#EXT-X-SERVER-CONTROL';\n const hb = 'holdBack';\n const phb = 'partHoldBack';\n const minTargetDuration = targetDuration && targetDuration * 3;\n const minPartDuration = partTargetDuration && partTargetDuration * 2;\n\n if (targetDuration && !serverControl.hasOwnProperty(hb)) {\n serverControl[hb] = minTargetDuration;\n this.trigger('info', {\n message: `${tag} defaulting HOLD-BACK to targetDuration * 3 (${minTargetDuration}).`\n });\n }\n\n if (minTargetDuration && serverControl[hb] < minTargetDuration) {\n this.trigger('warn', {\n message: `${tag} clamping HOLD-BACK (${serverControl[hb]}) to targetDuration * 3 (${minTargetDuration})`\n });\n serverControl[hb] = minTargetDuration;\n } // default no part hold back to part target duration * 3\n\n\n if (partTargetDuration && !serverControl.hasOwnProperty(phb)) {\n serverControl[phb] = partTargetDuration * 3;\n this.trigger('info', {\n message: `${tag} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${serverControl[phb]}).`\n });\n } // if part hold back is too small default it to part target duration * 2\n\n\n if (partTargetDuration && serverControl[phb] < minPartDuration) {\n this.trigger('warn', {\n message: `${tag} clamping PART-HOLD-BACK (${serverControl[phb]}) to partTargetDuration * 2 (${minPartDuration}).`\n });\n serverControl[phb] = minPartDuration;\n }\n};\n/**\n * A parser for M3U8 files. The current interpretation of the input is\n * exposed as a property `manifest` on parser objects. It's just two lines to\n * create and parse a manifest once you have the contents available as a string:\n *\n * ```js\n * var parser = new m3u8.Parser();\n * parser.push(xhr.responseText);\n * ```\n *\n * New input can later be applied to update the manifest object by calling\n * `push` again.\n *\n * The parser attempts to create a usable manifest object even if the\n * underlying input is somewhat nonsensical. It emits `info` and `warning`\n * events during the parse if it encounters input that seems invalid or\n * requires some property of the manifest object to be defaulted.\n *\n * @class Parser\n * @extends Stream\n */\n\n\nclass Parser extends _videojs_vhs_utils_es_stream_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"] {\n constructor() {\n super();\n this.lineStream = new LineStream();\n this.parseStream = new ParseStream();\n this.lineStream.pipe(this.parseStream);\n this.lastProgramDateTime = null;\n /* eslint-disable consistent-this */\n\n const self = this;\n /* eslint-enable consistent-this */\n\n const uris = [];\n let currentUri = {}; // if specified, the active EXT-X-MAP definition\n\n let currentMap; // if specified, the active decryption key\n\n let key;\n let hasParts = false;\n\n const noop = function () {};\n\n const defaultMediaGroups = {\n 'AUDIO': {},\n 'VIDEO': {},\n 'CLOSED-CAPTIONS': {},\n 'SUBTITLES': {}\n }; // This is the Widevine UUID from DASH IF IOP. The same exact string is\n // used in MPDs with Widevine encrypted streams.\n\n const widevineUuid = 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'; // group segments into numbered timelines delineated by discontinuities\n\n let currentTimeline = 0; // the manifest is empty until the parse stream begins delivering data\n\n this.manifest = {\n allowCache: true,\n discontinuityStarts: [],\n dateRanges: [],\n segments: []\n }; // keep track of the last seen segment's byte range end, as segments are not required\n // to provide the offset, in which case it defaults to the next byte after the\n // previous segment\n\n let lastByterangeEnd = 0; // keep track of the last seen part's byte range end.\n\n let lastPartByterangeEnd = 0;\n const dateRangeTags = {};\n this.on('end', () => {\n // only add preloadSegment if we don't yet have a uri for it.\n // and we actually have parts/preloadHints\n if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) {\n return;\n }\n\n if (!currentUri.map && currentMap) {\n currentUri.map = currentMap;\n }\n\n if (!currentUri.key && key) {\n currentUri.key = key;\n }\n\n if (!currentUri.timeline && typeof currentTimeline === 'number') {\n currentUri.timeline = currentTimeline;\n }\n\n this.manifest.preloadSegment = currentUri;\n }); // update the manifest with the m3u8 entry from the parse stream\n\n this.parseStream.on('data', function (entry) {\n let mediaGroup;\n let rendition;\n ({\n tag() {\n // switch based on the tag type\n (({\n version() {\n if (entry.version) {\n this.manifest.version = entry.version;\n }\n },\n\n 'allow-cache'() {\n this.manifest.allowCache = entry.allowed;\n\n if (!('allowed' in entry)) {\n this.trigger('info', {\n message: 'defaulting allowCache to YES'\n });\n this.manifest.allowCache = true;\n }\n },\n\n byterange() {\n const byterange = {};\n\n if ('length' in entry) {\n currentUri.byterange = byterange;\n byterange.length = entry.length;\n\n if (!('offset' in entry)) {\n /*\n * From the latest spec (as of this writing):\n * https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.2\n *\n * Same text since EXT-X-BYTERANGE's introduction in draft 7:\n * https://tools.ietf.org/html/draft-pantos-http-live-streaming-07#section-3.3.1)\n *\n * \"If o [offset] is not present, the sub-range begins at the next byte\n * following the sub-range of the previous media segment.\"\n */\n entry.offset = lastByterangeEnd;\n }\n }\n\n if ('offset' in entry) {\n currentUri.byterange = byterange;\n byterange.offset = entry.offset;\n }\n\n lastByterangeEnd = byterange.offset + byterange.length;\n },\n\n endlist() {\n this.manifest.endList = true;\n },\n\n inf() {\n if (!('mediaSequence' in this.manifest)) {\n this.manifest.mediaSequence = 0;\n this.trigger('info', {\n message: 'defaulting media sequence to zero'\n });\n }\n\n if (!('discontinuitySequence' in this.manifest)) {\n this.manifest.discontinuitySequence = 0;\n this.trigger('info', {\n message: 'defaulting discontinuity sequence to zero'\n });\n }\n\n if (entry.title) {\n currentUri.title = entry.title;\n }\n\n if (entry.duration > 0) {\n currentUri.duration = entry.duration;\n }\n\n if (entry.duration === 0) {\n currentUri.duration = 0.01;\n this.trigger('info', {\n message: 'updating zero segment duration to a small value'\n });\n }\n\n this.manifest.segments = uris;\n },\n\n key() {\n if (!entry.attributes) {\n this.trigger('warn', {\n message: 'ignoring key declaration without attribute list'\n });\n return;\n } // clear the active encryption key\n\n\n if (entry.attributes.METHOD === 'NONE') {\n key = null;\n return;\n }\n\n if (!entry.attributes.URI) {\n this.trigger('warn', {\n message: 'ignoring key declaration without URI'\n });\n return;\n }\n\n if (entry.attributes.KEYFORMAT === 'com.apple.streamingkeydelivery') {\n this.manifest.contentProtection = this.manifest.contentProtection || {}; // TODO: add full support for this.\n\n this.manifest.contentProtection['com.apple.fps.1_0'] = {\n attributes: entry.attributes\n };\n return;\n }\n\n if (entry.attributes.KEYFORMAT === 'com.microsoft.playready') {\n this.manifest.contentProtection = this.manifest.contentProtection || {}; // TODO: add full support for this.\n\n this.manifest.contentProtection['com.microsoft.playready'] = {\n uri: entry.attributes.URI\n };\n return;\n } // check if the content is encrypted for Widevine\n // Widevine/HLS spec: https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf\n\n\n if (entry.attributes.KEYFORMAT === widevineUuid) {\n const VALID_METHODS = ['SAMPLE-AES', 'SAMPLE-AES-CTR', 'SAMPLE-AES-CENC'];\n\n if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) {\n this.trigger('warn', {\n message: 'invalid key method provided for Widevine'\n });\n return;\n }\n\n if (entry.attributes.METHOD === 'SAMPLE-AES-CENC') {\n this.trigger('warn', {\n message: 'SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead'\n });\n }\n\n if (entry.attributes.URI.substring(0, 23) !== 'data:text/plain;base64,') {\n this.trigger('warn', {\n message: 'invalid key URI provided for Widevine'\n });\n return;\n }\n\n if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === '0x')) {\n this.trigger('warn', {\n message: 'invalid key ID provided for Widevine'\n });\n return;\n } // if Widevine key attributes are valid, store them as `contentProtection`\n // on the manifest to emulate Widevine tag structure in a DASH mpd\n\n\n this.manifest.contentProtection = this.manifest.contentProtection || {};\n this.manifest.contentProtection['com.widevine.alpha'] = {\n attributes: {\n schemeIdUri: entry.attributes.KEYFORMAT,\n // remove '0x' from the key id string\n keyId: entry.attributes.KEYID.substring(2)\n },\n // decode the base64-encoded PSSH box\n pssh: (0,_videojs_vhs_utils_es_decode_b64_to_uint8_array_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(entry.attributes.URI.split(',')[1])\n };\n return;\n }\n\n if (!entry.attributes.METHOD) {\n this.trigger('warn', {\n message: 'defaulting key method to AES-128'\n });\n } // setup an encryption key for upcoming segments\n\n\n key = {\n method: entry.attributes.METHOD || 'AES-128',\n uri: entry.attributes.URI\n };\n\n if (typeof entry.attributes.IV !== 'undefined') {\n key.iv = entry.attributes.IV;\n }\n },\n\n 'media-sequence'() {\n if (!isFinite(entry.number)) {\n this.trigger('warn', {\n message: 'ignoring invalid media sequence: ' + entry.number\n });\n return;\n }\n\n this.manifest.mediaSequence = entry.number;\n },\n\n 'discontinuity-sequence'() {\n if (!isFinite(entry.number)) {\n this.trigger('warn', {\n message: 'ignoring invalid discontinuity sequence: ' + entry.number\n });\n return;\n }\n\n this.manifest.discontinuitySequence = entry.number;\n currentTimeline = entry.number;\n },\n\n 'playlist-type'() {\n if (!/VOD|EVENT/.test(entry.playlistType)) {\n this.trigger('warn', {\n message: 'ignoring unknown playlist type: ' + entry.playlist\n });\n return;\n }\n\n this.manifest.playlistType = entry.playlistType;\n },\n\n map() {\n currentMap = {};\n\n if (entry.uri) {\n currentMap.uri = entry.uri;\n }\n\n if (entry.byterange) {\n currentMap.byterange = entry.byterange;\n }\n\n if (key) {\n currentMap.key = key;\n }\n },\n\n 'stream-inf'() {\n this.manifest.playlists = uris;\n this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;\n\n if (!entry.attributes) {\n this.trigger('warn', {\n message: 'ignoring empty stream-inf attributes'\n });\n return;\n }\n\n if (!currentUri.attributes) {\n currentUri.attributes = {};\n }\n\n (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(currentUri.attributes, entry.attributes);\n },\n\n media() {\n this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;\n\n if (!(entry.attributes && entry.attributes.TYPE && entry.attributes['GROUP-ID'] && entry.attributes.NAME)) {\n this.trigger('warn', {\n message: 'ignoring incomplete or missing media group'\n });\n return;\n } // find the media group, creating defaults as necessary\n\n\n const mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE];\n mediaGroupType[entry.attributes['GROUP-ID']] = mediaGroupType[entry.attributes['GROUP-ID']] || {};\n mediaGroup = mediaGroupType[entry.attributes['GROUP-ID']]; // collect the rendition metadata\n\n rendition = {\n default: /yes/i.test(entry.attributes.DEFAULT)\n };\n\n if (rendition.default) {\n rendition.autoselect = true;\n } else {\n rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT);\n }\n\n if (entry.attributes.LANGUAGE) {\n rendition.language = entry.attributes.LANGUAGE;\n }\n\n if (entry.attributes.URI) {\n rendition.uri = entry.attributes.URI;\n }\n\n if (entry.attributes['INSTREAM-ID']) {\n rendition.instreamId = entry.attributes['INSTREAM-ID'];\n }\n\n if (entry.attributes.CHARACTERISTICS) {\n rendition.characteristics = entry.attributes.CHARACTERISTICS;\n }\n\n if (entry.attributes.FORCED) {\n rendition.forced = /yes/i.test(entry.attributes.FORCED);\n } // insert the new rendition\n\n\n mediaGroup[entry.attributes.NAME] = rendition;\n },\n\n discontinuity() {\n currentTimeline += 1;\n currentUri.discontinuity = true;\n this.manifest.discontinuityStarts.push(uris.length);\n },\n\n 'program-date-time'() {\n if (typeof this.manifest.dateTimeString === 'undefined') {\n // PROGRAM-DATE-TIME is a media-segment tag, but for backwards\n // compatibility, we add the first occurence of the PROGRAM-DATE-TIME tag\n // to the manifest object\n // TODO: Consider removing this in future major version\n this.manifest.dateTimeString = entry.dateTimeString;\n this.manifest.dateTimeObject = entry.dateTimeObject;\n }\n\n currentUri.dateTimeString = entry.dateTimeString;\n currentUri.dateTimeObject = entry.dateTimeObject;\n const {\n lastProgramDateTime\n } = this;\n this.lastProgramDateTime = new Date(entry.dateTimeString).getTime(); // We should extrapolate Program Date Time backward only during first program date time occurrence.\n // Once we have at least one program date time point, we can always extrapolate it forward using lastProgramDateTime reference.\n\n if (lastProgramDateTime === null) {\n // Extrapolate Program Date Time backward\n // Since it is first program date time occurrence we're assuming that\n // all this.manifest.segments have no program date time info\n this.manifest.segments.reduceRight((programDateTime, segment) => {\n segment.programDateTime = programDateTime - segment.duration * 1000;\n return segment.programDateTime;\n }, this.lastProgramDateTime);\n }\n },\n\n targetduration() {\n if (!isFinite(entry.duration) || entry.duration < 0) {\n this.trigger('warn', {\n message: 'ignoring invalid target duration: ' + entry.duration\n });\n return;\n }\n\n this.manifest.targetDuration = entry.duration;\n setHoldBack.call(this, this.manifest);\n },\n\n start() {\n if (!entry.attributes || isNaN(entry.attributes['TIME-OFFSET'])) {\n this.trigger('warn', {\n message: 'ignoring start declaration without appropriate attribute list'\n });\n return;\n }\n\n this.manifest.start = {\n timeOffset: entry.attributes['TIME-OFFSET'],\n precise: entry.attributes.PRECISE\n };\n },\n\n 'cue-out'() {\n currentUri.cueOut = entry.data;\n },\n\n 'cue-out-cont'() {\n currentUri.cueOutCont = entry.data;\n },\n\n 'cue-in'() {\n currentUri.cueIn = entry.data;\n },\n\n 'skip'() {\n this.manifest.skip = camelCaseKeys(entry.attributes);\n this.warnOnMissingAttributes_('#EXT-X-SKIP', entry.attributes, ['SKIPPED-SEGMENTS']);\n },\n\n 'part'() {\n hasParts = true; // parts are always specifed before a segment\n\n const segmentIndex = this.manifest.segments.length;\n const part = camelCaseKeys(entry.attributes);\n currentUri.parts = currentUri.parts || [];\n currentUri.parts.push(part);\n\n if (part.byterange) {\n if (!part.byterange.hasOwnProperty('offset')) {\n part.byterange.offset = lastPartByterangeEnd;\n }\n\n lastPartByterangeEnd = part.byterange.offset + part.byterange.length;\n }\n\n const partIndex = currentUri.parts.length - 1;\n this.warnOnMissingAttributes_(`#EXT-X-PART #${partIndex} for segment #${segmentIndex}`, entry.attributes, ['URI', 'DURATION']);\n\n if (this.manifest.renditionReports) {\n this.manifest.renditionReports.forEach((r, i) => {\n if (!r.hasOwnProperty('lastPart')) {\n this.trigger('warn', {\n message: `#EXT-X-RENDITION-REPORT #${i} lacks required attribute(s): LAST-PART`\n });\n }\n });\n }\n },\n\n 'server-control'() {\n const attrs = this.manifest.serverControl = camelCaseKeys(entry.attributes);\n\n if (!attrs.hasOwnProperty('canBlockReload')) {\n attrs.canBlockReload = false;\n this.trigger('info', {\n message: '#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false'\n });\n }\n\n setHoldBack.call(this, this.manifest);\n\n if (attrs.canSkipDateranges && !attrs.hasOwnProperty('canSkipUntil')) {\n this.trigger('warn', {\n message: '#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set'\n });\n }\n },\n\n 'preload-hint'() {\n // parts are always specifed before a segment\n const segmentIndex = this.manifest.segments.length;\n const hint = camelCaseKeys(entry.attributes);\n const isPart = hint.type && hint.type === 'PART';\n currentUri.preloadHints = currentUri.preloadHints || [];\n currentUri.preloadHints.push(hint);\n\n if (hint.byterange) {\n if (!hint.byterange.hasOwnProperty('offset')) {\n // use last part byterange end or zero if not a part.\n hint.byterange.offset = isPart ? lastPartByterangeEnd : 0;\n\n if (isPart) {\n lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length;\n }\n }\n }\n\n const index = currentUri.preloadHints.length - 1;\n this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${index} for segment #${segmentIndex}`, entry.attributes, ['TYPE', 'URI']);\n\n if (!hint.type) {\n return;\n } // search through all preload hints except for the current one for\n // a duplicate type.\n\n\n for (let i = 0; i < currentUri.preloadHints.length - 1; i++) {\n const otherHint = currentUri.preloadHints[i];\n\n if (!otherHint.type) {\n continue;\n }\n\n if (otherHint.type === hint.type) {\n this.trigger('warn', {\n message: `#EXT-X-PRELOAD-HINT #${index} for segment #${segmentIndex} has the same TYPE ${hint.type} as preload hint #${i}`\n });\n }\n }\n },\n\n 'rendition-report'() {\n const report = camelCaseKeys(entry.attributes);\n this.manifest.renditionReports = this.manifest.renditionReports || [];\n this.manifest.renditionReports.push(report);\n const index = this.manifest.renditionReports.length - 1;\n const required = ['LAST-MSN', 'URI'];\n\n if (hasParts) {\n required.push('LAST-PART');\n }\n\n this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${index}`, entry.attributes, required);\n },\n\n 'part-inf'() {\n this.manifest.partInf = camelCaseKeys(entry.attributes);\n this.warnOnMissingAttributes_('#EXT-X-PART-INF', entry.attributes, ['PART-TARGET']);\n\n if (this.manifest.partInf.partTarget) {\n this.manifest.partTargetDuration = this.manifest.partInf.partTarget;\n }\n\n setHoldBack.call(this, this.manifest);\n },\n\n 'daterange'() {\n this.manifest.dateRanges.push(camelCaseKeys(entry.attributes));\n const index = this.manifest.dateRanges.length - 1;\n this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${index}`, entry.attributes, ['ID', 'START-DATE']);\n const dateRange = this.manifest.dateRanges[index];\n\n if (dateRange.endDate && dateRange.startDate && new Date(dateRange.endDate) < new Date(dateRange.startDate)) {\n this.trigger('warn', {\n message: 'EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE'\n });\n }\n\n if (dateRange.duration && dateRange.duration < 0) {\n this.trigger('warn', {\n message: 'EXT-X-DATERANGE DURATION must not be negative'\n });\n }\n\n if (dateRange.plannedDuration && dateRange.plannedDuration < 0) {\n this.trigger('warn', {\n message: 'EXT-X-DATERANGE PLANNED-DURATION must not be negative'\n });\n }\n\n const endOnNextYes = !!dateRange.endOnNext;\n\n if (endOnNextYes && !dateRange.class) {\n this.trigger('warn', {\n message: 'EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute'\n });\n }\n\n if (endOnNextYes && (dateRange.duration || dateRange.endDate)) {\n this.trigger('warn', {\n message: 'EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes'\n });\n }\n\n if (dateRange.duration && dateRange.endDate) {\n const startDate = dateRange.startDate;\n const newDateInSeconds = startDate.getTime() + dateRange.duration * 1000;\n this.manifest.dateRanges[index].endDate = new Date(newDateInSeconds);\n }\n\n if (!dateRangeTags[dateRange.id]) {\n dateRangeTags[dateRange.id] = dateRange;\n } else {\n for (const attribute in dateRangeTags[dateRange.id]) {\n if (!!dateRange[attribute] && JSON.stringify(dateRangeTags[dateRange.id][attribute]) !== JSON.stringify(dateRange[attribute])) {\n this.trigger('warn', {\n message: 'EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values'\n });\n break;\n }\n } // if tags with the same ID do not have conflicting attributes, merge them\n\n\n const dateRangeWithSameId = this.manifest.dateRanges.findIndex(dateRangeToFind => dateRangeToFind.id === dateRange.id);\n this.manifest.dateRanges[dateRangeWithSameId] = (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(this.manifest.dateRanges[dateRangeWithSameId], dateRange);\n dateRangeTags[dateRange.id] = (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(dateRangeTags[dateRange.id], dateRange); // after merging, delete the duplicate dateRange that was added last\n\n this.manifest.dateRanges.pop();\n }\n },\n\n 'independent-segments'() {\n this.manifest.independentSegments = true;\n },\n\n 'content-steering'() {\n this.manifest.contentSteering = camelCaseKeys(entry.attributes);\n this.warnOnMissingAttributes_('#EXT-X-CONTENT-STEERING', entry.attributes, ['SERVER-URI']);\n }\n\n })[entry.tagType] || noop).call(self);\n },\n\n uri() {\n currentUri.uri = entry.uri;\n uris.push(currentUri); // if no explicit duration was declared, use the target duration\n\n if (this.manifest.targetDuration && !('duration' in currentUri)) {\n this.trigger('warn', {\n message: 'defaulting segment duration to the target duration'\n });\n currentUri.duration = this.manifest.targetDuration;\n } // annotate with encryption information, if necessary\n\n\n if (key) {\n currentUri.key = key;\n }\n\n currentUri.timeline = currentTimeline; // annotate with initialization segment information, if necessary\n\n if (currentMap) {\n currentUri.map = currentMap;\n } // reset the last byterange end as it needs to be 0 between parts\n\n\n lastPartByterangeEnd = 0; // Once we have at least one program date time we can always extrapolate it forward\n\n if (this.lastProgramDateTime !== null) {\n currentUri.programDateTime = this.lastProgramDateTime;\n this.lastProgramDateTime += currentUri.duration * 1000;\n } // prepare for the next URI\n\n\n currentUri = {};\n },\n\n comment() {// comments are not important for playback\n },\n\n custom() {\n // if this is segment-level data attach the output to the segment\n if (entry.segment) {\n currentUri.custom = currentUri.custom || {};\n currentUri.custom[entry.customType] = entry.data; // if this is manifest-level data attach to the top level manifest object\n } else {\n this.manifest.custom = this.manifest.custom || {};\n this.manifest.custom[entry.customType] = entry.data;\n }\n }\n\n })[entry.type].call(self);\n });\n }\n\n warnOnMissingAttributes_(identifier, attributes, required) {\n const missing = [];\n required.forEach(function (key) {\n if (!attributes.hasOwnProperty(key)) {\n missing.push(key);\n }\n });\n\n if (missing.length) {\n this.trigger('warn', {\n message: `${identifier} lacks required attribute(s): ${missing.join(', ')}`\n });\n }\n }\n /**\n * Parse the input string and update the manifest object.\n *\n * @param {string} chunk a potentially incomplete portion of the manifest\n */\n\n\n push(chunk) {\n this.lineStream.push(chunk);\n }\n /**\n * Flush any remaining input. This can be handy if the last line of an M3U8\n * manifest did not contain a trailing newline but the file has been\n * completely received.\n */\n\n\n end() {\n // flush any buffered input\n this.lineStream.push('\\n');\n\n if (this.manifest.dateRanges.length && this.lastProgramDateTime === null) {\n this.trigger('warn', {\n message: 'A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag'\n });\n }\n\n this.lastProgramDateTime = null;\n this.trigger('end');\n }\n /**\n * Add an additional parser for non-standard tags\n *\n * @param {Object} options a map of options for the added parser\n * @param {RegExp} options.expression a regular expression to match the custom header\n * @param {string} options.customType the custom type to register to the output\n * @param {Function} [options.dataParser] function to parse the line into an object\n * @param {boolean} [options.segment] should tag data be attached to the segment object\n */\n\n\n addParser(options) {\n this.parseStream.addParser(options);\n }\n /**\n * Add a custom header mapper\n *\n * @param {Object} options\n * @param {RegExp} options.expression a regular expression to match the custom header\n * @param {Function} options.map function to translate tag into a different tag\n */\n\n\n addTagMapper(options) {\n this.parseStream.addTagMapper(options);\n }\n\n}\n\n\n\n\n//# sourceURL=webpack://web/./node_modules/m3u8-parser/dist/m3u8-parser.es.js?")},"./node_modules/m3u8-parser/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ decodeB64ToUint8Array)\n/* harmony export */ });\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__);\n\n\nvar atob = function atob(s) {\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default().atob) ? global_window__WEBPACK_IMPORTED_MODULE_0___default().atob(s) : Buffer.from(s, 'base64').toString('binary');\n};\n\nfunction decodeB64ToUint8Array(b64Text) {\n var decodedString = atob(b64Text);\n var array = new Uint8Array(decodedString.length);\n\n for (var i = 0; i < decodedString.length; i++) {\n array[i] = decodedString.charCodeAt(i);\n }\n\n return array;\n}\n\n//# sourceURL=webpack://web/./node_modules/m3u8-parser/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js?")},"./node_modules/m3u8-parser/node_modules/@videojs/vhs-utils/es/stream.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Stream)\n/* harmony export */ });\n/**\n * @file stream.js\n */\n\n/**\n * A lightweight readable stream implemention that handles event dispatching.\n *\n * @class Stream\n */\nvar Stream = /*#__PURE__*/function () {\n function Stream() {\n this.listeners = {};\n }\n /**\n * Add a listener for a specified event type.\n *\n * @param {string} type the event name\n * @param {Function} listener the callback to be invoked when an event of\n * the specified type occurs\n */\n\n\n var _proto = Stream.prototype;\n\n _proto.on = function on(type, listener) {\n if (!this.listeners[type]) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push(listener);\n }\n /**\n * Remove a listener for a specified event type.\n *\n * @param {string} type the event name\n * @param {Function} listener a function previously registered for this\n * type of event through `on`\n * @return {boolean} if we could turn it off or not\n */\n ;\n\n _proto.off = function off(type, listener) {\n if (!this.listeners[type]) {\n return false;\n }\n\n var index = this.listeners[type].indexOf(listener); // TODO: which is better?\n // In Video.js we slice listener functions\n // on trigger so that it does not mess up the order\n // while we loop through.\n //\n // Here we slice on off so that the loop in trigger\n // can continue using it's old reference to loop without\n // messing up the order.\n\n this.listeners[type] = this.listeners[type].slice(0);\n this.listeners[type].splice(index, 1);\n return index > -1;\n }\n /**\n * Trigger an event of the specified type on this stream. Any additional\n * arguments to this function are passed as parameters to event listeners.\n *\n * @param {string} type the event name\n */\n ;\n\n _proto.trigger = function trigger(type) {\n var callbacks = this.listeners[type];\n\n if (!callbacks) {\n return;\n } // Slicing the arguments on every invocation of this method\n // can add a significant amount of overhead. Avoid the\n // intermediate object creation for the common case of a\n // single callback argument\n\n\n if (arguments.length === 2) {\n var length = callbacks.length;\n\n for (var i = 0; i < length; ++i) {\n callbacks[i].call(this, arguments[1]);\n }\n } else {\n var args = Array.prototype.slice.call(arguments, 1);\n var _length = callbacks.length;\n\n for (var _i = 0; _i < _length; ++_i) {\n callbacks[_i].apply(this, args);\n }\n }\n }\n /**\n * Destroys the stream and cleans up.\n */\n ;\n\n _proto.dispose = function dispose() {\n this.listeners = {};\n }\n /**\n * Forwards all `data` events on this stream to the destination stream. The\n * destination stream should provide a method `push` to receive the data\n * events as they arrive.\n *\n * @param {Stream} destination the stream that will receive all `data` events\n * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options\n */\n ;\n\n _proto.pipe = function pipe(destination) {\n this.on('data', function (data) {\n destination.push(data);\n });\n };\n\n return Stream;\n}();\n\n\n\n//# sourceURL=webpack://web/./node_modules/m3u8-parser/node_modules/@videojs/vhs-utils/es/stream.js?")},"./node_modules/mpd-parser/dist/mpd-parser.es.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ VERSION: () => (/* binding */ VERSION),\n/* harmony export */ addSidxSegmentsToPlaylist: () => (/* binding */ addSidxSegmentsToPlaylist$1),\n/* harmony export */ generateSidxKey: () => (/* binding */ generateSidxKey),\n/* harmony export */ inheritAttributes: () => (/* binding */ inheritAttributes),\n/* harmony export */ parse: () => (/* binding */ parse),\n/* harmony export */ parseUTCTiming: () => (/* binding */ parseUTCTiming),\n/* harmony export */ stringToMpdXml: () => (/* binding */ stringToMpdXml),\n/* harmony export */ toM3u8: () => (/* binding */ toM3u8),\n/* harmony export */ toPlaylists: () => (/* binding */ toPlaylists)\n/* harmony export */ });\n/* harmony import */ var _videojs_vhs_utils_es_resolve_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @videojs/vhs-utils/es/resolve-url */ \"./node_modules/@videojs/vhs-utils/es/resolve-url.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _videojs_vhs_utils_es_media_groups__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @videojs/vhs-utils/es/media-groups */ \"./node_modules/@videojs/vhs-utils/es/media-groups.js\");\n/* harmony import */ var _videojs_vhs_utils_es_decode_b64_to_uint8_array__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @videojs/vhs-utils/es/decode-b64-to-uint8-array */ \"./node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js\");\n/* harmony import */ var _xmldom_xmldom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @xmldom/xmldom */ \"./node_modules/@xmldom/xmldom/lib/index.js\");\n/*! @name mpd-parser @version 1.3.0 @license Apache-2.0 */\n\n\n\n\n\n\nvar version = \"1.3.0\";\n\nconst isObject = obj => {\n return !!obj && typeof obj === 'object';\n};\n\nconst merge = (...objects) => {\n return objects.reduce((result, source) => {\n if (typeof source !== 'object') {\n return result;\n }\n\n Object.keys(source).forEach(key => {\n if (Array.isArray(result[key]) && Array.isArray(source[key])) {\n result[key] = result[key].concat(source[key]);\n } else if (isObject(result[key]) && isObject(source[key])) {\n result[key] = merge(result[key], source[key]);\n } else {\n result[key] = source[key];\n }\n });\n return result;\n }, {});\n};\nconst values = o => Object.keys(o).map(k => o[k]);\n\nconst range = (start, end) => {\n const result = [];\n\n for (let i = start; i < end; i++) {\n result.push(i);\n }\n\n return result;\n};\nconst flatten = lists => lists.reduce((x, y) => x.concat(y), []);\nconst from = list => {\n if (!list.length) {\n return [];\n }\n\n const result = [];\n\n for (let i = 0; i < list.length; i++) {\n result.push(list[i]);\n }\n\n return result;\n};\nconst findIndexes = (l, key) => l.reduce((a, e, i) => {\n if (e[key]) {\n a.push(i);\n }\n\n return a;\n}, []);\n/**\n * Returns a union of the included lists provided each element can be identified by a key.\n *\n * @param {Array} list - list of lists to get the union of\n * @param {Function} keyFunction - the function to use as a key for each element\n *\n * @return {Array} the union of the arrays\n */\n\nconst union = (lists, keyFunction) => {\n return values(lists.reduce((acc, list) => {\n list.forEach(el => {\n acc[keyFunction(el)] = el;\n });\n return acc;\n }, {}));\n};\n\nvar errors = {\n INVALID_NUMBER_OF_PERIOD: 'INVALID_NUMBER_OF_PERIOD',\n INVALID_NUMBER_OF_CONTENT_STEERING: 'INVALID_NUMBER_OF_CONTENT_STEERING',\n DASH_EMPTY_MANIFEST: 'DASH_EMPTY_MANIFEST',\n DASH_INVALID_XML: 'DASH_INVALID_XML',\n NO_BASE_URL: 'NO_BASE_URL',\n MISSING_SEGMENT_INFORMATION: 'MISSING_SEGMENT_INFORMATION',\n SEGMENT_TIME_UNSPECIFIED: 'SEGMENT_TIME_UNSPECIFIED',\n UNSUPPORTED_UTC_TIMING_SCHEME: 'UNSUPPORTED_UTC_TIMING_SCHEME'\n};\n\n/**\n * @typedef {Object} SingleUri\n * @property {string} uri - relative location of segment\n * @property {string} resolvedUri - resolved location of segment\n * @property {Object} byterange - Object containing information on how to make byte range\n * requests following byte-range-spec per RFC2616.\n * @property {String} byterange.length - length of range request\n * @property {String} byterange.offset - byte offset of range request\n *\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1\n */\n\n/**\n * Converts a URLType node (5.3.9.2.3 Table 13) to a segment object\n * that conforms to how m3u8-parser is structured\n *\n * @see https://github.com/videojs/m3u8-parser\n *\n * @param {string} baseUrl - baseUrl provided by <BaseUrl> nodes\n * @param {string} source - source url for segment\n * @param {string} range - optional range used for range calls,\n * follows RFC 2616, Clause 14.35.1\n * @return {SingleUri} full segment information transformed into a format similar\n * to m3u8-parser\n */\n\nconst urlTypeToSegment = ({\n baseUrl = '',\n source = '',\n range = '',\n indexRange = ''\n}) => {\n const segment = {\n uri: source,\n resolvedUri: (0,_videojs_vhs_utils_es_resolve_url__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(baseUrl || '', source)\n };\n\n if (range || indexRange) {\n const rangeStr = range ? range : indexRange;\n const ranges = rangeStr.split('-'); // default to parsing this as a BigInt if possible\n\n let startRange = (global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt) ? global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(ranges[0]) : parseInt(ranges[0], 10);\n let endRange = (global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt) ? global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(ranges[1]) : parseInt(ranges[1], 10); // convert back to a number if less than MAX_SAFE_INTEGER\n\n if (startRange < Number.MAX_SAFE_INTEGER && typeof startRange === 'bigint') {\n startRange = Number(startRange);\n }\n\n if (endRange < Number.MAX_SAFE_INTEGER && typeof endRange === 'bigint') {\n endRange = Number(endRange);\n }\n\n let length;\n\n if (typeof endRange === 'bigint' || typeof startRange === 'bigint') {\n length = global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(endRange) - global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(startRange) + global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(1);\n } else {\n length = endRange - startRange + 1;\n }\n\n if (typeof length === 'bigint' && length < Number.MAX_SAFE_INTEGER) {\n length = Number(length);\n } // byterange should be inclusive according to\n // RFC 2616, Clause 14.35.1\n\n\n segment.byterange = {\n length,\n offset: startRange\n };\n }\n\n return segment;\n};\nconst byteRangeToString = byterange => {\n // `endRange` is one less than `offset + length` because the HTTP range\n // header uses inclusive ranges\n let endRange;\n\n if (typeof byterange.offset === 'bigint' || typeof byterange.length === 'bigint') {\n endRange = global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(byterange.offset) + global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(byterange.length) - global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(1);\n } else {\n endRange = byterange.offset + byterange.length - 1;\n }\n\n return `${byterange.offset}-${endRange}`;\n};\n\n/**\n * parse the end number attribue that can be a string\n * number, or undefined.\n *\n * @param {string|number|undefined} endNumber\n * The end number attribute.\n *\n * @return {number|null}\n * The result of parsing the end number.\n */\n\nconst parseEndNumber = endNumber => {\n if (endNumber && typeof endNumber !== 'number') {\n endNumber = parseInt(endNumber, 10);\n }\n\n if (isNaN(endNumber)) {\n return null;\n }\n\n return endNumber;\n};\n/**\n * Functions for calculating the range of available segments in static and dynamic\n * manifests.\n */\n\n\nconst segmentRange = {\n /**\n * Returns the entire range of available segments for a static MPD\n *\n * @param {Object} attributes\n * Inheritied MPD attributes\n * @return {{ start: number, end: number }}\n * The start and end numbers for available segments\n */\n static(attributes) {\n const {\n duration,\n timescale = 1,\n sourceDuration,\n periodDuration\n } = attributes;\n const endNumber = parseEndNumber(attributes.endNumber);\n const segmentDuration = duration / timescale;\n\n if (typeof endNumber === 'number') {\n return {\n start: 0,\n end: endNumber\n };\n }\n\n if (typeof periodDuration === 'number') {\n return {\n start: 0,\n end: periodDuration / segmentDuration\n };\n }\n\n return {\n start: 0,\n end: sourceDuration / segmentDuration\n };\n },\n\n /**\n * Returns the current live window range of available segments for a dynamic MPD\n *\n * @param {Object} attributes\n * Inheritied MPD attributes\n * @return {{ start: number, end: number }}\n * The start and end numbers for available segments\n */\n dynamic(attributes) {\n const {\n NOW,\n clientOffset,\n availabilityStartTime,\n timescale = 1,\n duration,\n periodStart = 0,\n minimumUpdatePeriod = 0,\n timeShiftBufferDepth = Infinity\n } = attributes;\n const endNumber = parseEndNumber(attributes.endNumber); // clientOffset is passed in at the top level of mpd-parser and is an offset calculated\n // after retrieving UTC server time.\n\n const now = (NOW + clientOffset) / 1000; // WC stands for Wall Clock.\n // Convert the period start time to EPOCH.\n\n const periodStartWC = availabilityStartTime + periodStart; // Period end in EPOCH is manifest's retrieval time + time until next update.\n\n const periodEndWC = now + minimumUpdatePeriod;\n const periodDuration = periodEndWC - periodStartWC;\n const segmentCount = Math.ceil(periodDuration * timescale / duration);\n const availableStart = Math.floor((now - periodStartWC - timeShiftBufferDepth) * timescale / duration);\n const availableEnd = Math.floor((now - periodStartWC) * timescale / duration);\n return {\n start: Math.max(0, availableStart),\n end: typeof endNumber === 'number' ? endNumber : Math.min(segmentCount, availableEnd)\n };\n }\n\n};\n/**\n * Maps a range of numbers to objects with information needed to build the corresponding\n * segment list\n *\n * @name toSegmentsCallback\n * @function\n * @param {number} number\n * Number of the segment\n * @param {number} index\n * Index of the number in the range list\n * @return {{ number: Number, duration: Number, timeline: Number, time: Number }}\n * Object with segment timing and duration info\n */\n\n/**\n * Returns a callback for Array.prototype.map for mapping a range of numbers to\n * information needed to build the segment list.\n *\n * @param {Object} attributes\n * Inherited MPD attributes\n * @return {toSegmentsCallback}\n * Callback map function\n */\n\nconst toSegments = attributes => number => {\n const {\n duration,\n timescale = 1,\n periodStart,\n startNumber = 1\n } = attributes;\n return {\n number: startNumber + number,\n duration: duration / timescale,\n timeline: periodStart,\n time: number * duration\n };\n};\n/**\n * Returns a list of objects containing segment timing and duration info used for\n * building the list of segments. This uses the @duration attribute specified\n * in the MPD manifest to derive the range of segments.\n *\n * @param {Object} attributes\n * Inherited MPD attributes\n * @return {{number: number, duration: number, time: number, timeline: number}[]}\n * List of Objects with segment timing and duration info\n */\n\nconst parseByDuration = attributes => {\n const {\n type,\n duration,\n timescale = 1,\n periodDuration,\n sourceDuration\n } = attributes;\n const {\n start,\n end\n } = segmentRange[type](attributes);\n const segments = range(start, end).map(toSegments(attributes));\n\n if (type === 'static') {\n const index = segments.length - 1; // section is either a period or the full source\n\n const sectionDuration = typeof periodDuration === 'number' ? periodDuration : sourceDuration; // final segment may be less than full segment duration\n\n segments[index].duration = sectionDuration - duration / timescale * index;\n }\n\n return segments;\n};\n\n/**\n * Translates SegmentBase into a set of segments.\n * (DASH SPEC Section 5.3.9.3.2) contains a set of <SegmentURL> nodes. Each\n * node should be translated into segment.\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @return {Object.<Array>} list of segments\n */\n\nconst segmentsFromBase = attributes => {\n const {\n baseUrl,\n initialization = {},\n sourceDuration,\n indexRange = '',\n periodStart,\n presentationTime,\n number = 0,\n duration\n } = attributes; // base url is required for SegmentBase to work, per spec (Section 5.3.9.2.1)\n\n if (!baseUrl) {\n throw new Error(errors.NO_BASE_URL);\n }\n\n const initSegment = urlTypeToSegment({\n baseUrl,\n source: initialization.sourceURL,\n range: initialization.range\n });\n const segment = urlTypeToSegment({\n baseUrl,\n source: baseUrl,\n indexRange\n });\n segment.map = initSegment; // If there is a duration, use it, otherwise use the given duration of the source\n // (since SegmentBase is only for one total segment)\n\n if (duration) {\n const segmentTimeInfo = parseByDuration(attributes);\n\n if (segmentTimeInfo.length) {\n segment.duration = segmentTimeInfo[0].duration;\n segment.timeline = segmentTimeInfo[0].timeline;\n }\n } else if (sourceDuration) {\n segment.duration = sourceDuration;\n segment.timeline = periodStart;\n } // If presentation time is provided, these segments are being generated by SIDX\n // references, and should use the time provided. For the general case of SegmentBase,\n // there should only be one segment in the period, so its presentation time is the same\n // as its period start.\n\n\n segment.presentationTime = presentationTime || periodStart;\n segment.number = number;\n return [segment];\n};\n/**\n * Given a playlist, a sidx box, and a baseUrl, update the segment list of the playlist\n * according to the sidx information given.\n *\n * playlist.sidx has metadadata about the sidx where-as the sidx param\n * is the parsed sidx box itself.\n *\n * @param {Object} playlist the playlist to update the sidx information for\n * @param {Object} sidx the parsed sidx box\n * @return {Object} the playlist object with the updated sidx information\n */\n\nconst addSidxSegmentsToPlaylist$1 = (playlist, sidx, baseUrl) => {\n // Retain init segment information\n const initSegment = playlist.sidx.map ? playlist.sidx.map : null; // Retain source duration from initial main manifest parsing\n\n const sourceDuration = playlist.sidx.duration; // Retain source timeline\n\n const timeline = playlist.timeline || 0;\n const sidxByteRange = playlist.sidx.byterange;\n const sidxEnd = sidxByteRange.offset + sidxByteRange.length; // Retain timescale of the parsed sidx\n\n const timescale = sidx.timescale; // referenceType 1 refers to other sidx boxes\n\n const mediaReferences = sidx.references.filter(r => r.referenceType !== 1);\n const segments = [];\n const type = playlist.endList ? 'static' : 'dynamic';\n const periodStart = playlist.sidx.timeline;\n let presentationTime = periodStart;\n let number = playlist.mediaSequence || 0; // firstOffset is the offset from the end of the sidx box\n\n let startIndex; // eslint-disable-next-line\n\n if (typeof sidx.firstOffset === 'bigint') {\n startIndex = global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(sidxEnd) + sidx.firstOffset;\n } else {\n startIndex = sidxEnd + sidx.firstOffset;\n }\n\n for (let i = 0; i < mediaReferences.length; i++) {\n const reference = sidx.references[i]; // size of the referenced (sub)segment\n\n const size = reference.referencedSize; // duration of the referenced (sub)segment, in the timescale\n // this will be converted to seconds when generating segments\n\n const duration = reference.subsegmentDuration; // should be an inclusive range\n\n let endIndex; // eslint-disable-next-line\n\n if (typeof startIndex === 'bigint') {\n endIndex = startIndex + global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(size) - global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(1);\n } else {\n endIndex = startIndex + size - 1;\n }\n\n const indexRange = `${startIndex}-${endIndex}`;\n const attributes = {\n baseUrl,\n timescale,\n timeline,\n periodStart,\n presentationTime,\n number,\n duration,\n sourceDuration,\n indexRange,\n type\n };\n const segment = segmentsFromBase(attributes)[0];\n\n if (initSegment) {\n segment.map = initSegment;\n }\n\n segments.push(segment);\n\n if (typeof startIndex === 'bigint') {\n startIndex += global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(size);\n } else {\n startIndex += size;\n }\n\n presentationTime += duration / timescale;\n number++;\n }\n\n playlist.segments = segments;\n return playlist;\n};\n\nconst SUPPORTED_MEDIA_TYPES = ['AUDIO', 'SUBTITLES']; // allow one 60fps frame as leniency (arbitrarily chosen)\n\nconst TIME_FUDGE = 1 / 60;\n/**\n * Given a list of timelineStarts, combines, dedupes, and sorts them.\n *\n * @param {TimelineStart[]} timelineStarts - list of timeline starts\n *\n * @return {TimelineStart[]} the combined and deduped timeline starts\n */\n\nconst getUniqueTimelineStarts = timelineStarts => {\n return union(timelineStarts, ({\n timeline\n }) => timeline).sort((a, b) => a.timeline > b.timeline ? 1 : -1);\n};\n/**\n * Finds the playlist with the matching NAME attribute.\n *\n * @param {Array} playlists - playlists to search through\n * @param {string} name - the NAME attribute to search for\n *\n * @return {Object|null} the matching playlist object, or null\n */\n\nconst findPlaylistWithName = (playlists, name) => {\n for (let i = 0; i < playlists.length; i++) {\n if (playlists[i].attributes.NAME === name) {\n return playlists[i];\n }\n }\n\n return null;\n};\n/**\n * Gets a flattened array of media group playlists.\n *\n * @param {Object} manifest - the main manifest object\n *\n * @return {Array} the media group playlists\n */\n\nconst getMediaGroupPlaylists = manifest => {\n let mediaGroupPlaylists = [];\n (0,_videojs_vhs_utils_es_media_groups__WEBPACK_IMPORTED_MODULE_2__.forEachMediaGroup)(manifest, SUPPORTED_MEDIA_TYPES, (properties, type, group, label) => {\n mediaGroupPlaylists = mediaGroupPlaylists.concat(properties.playlists || []);\n });\n return mediaGroupPlaylists;\n};\n/**\n * Updates the playlist's media sequence numbers.\n *\n * @param {Object} config - options object\n * @param {Object} config.playlist - the playlist to update\n * @param {number} config.mediaSequence - the mediaSequence number to start with\n */\n\nconst updateMediaSequenceForPlaylist = ({\n playlist,\n mediaSequence\n}) => {\n playlist.mediaSequence = mediaSequence;\n playlist.segments.forEach((segment, index) => {\n segment.number = playlist.mediaSequence + index;\n });\n};\n/**\n * Updates the media and discontinuity sequence numbers of newPlaylists given oldPlaylists\n * and a complete list of timeline starts.\n *\n * If no matching playlist is found, only the discontinuity sequence number of the playlist\n * will be updated.\n *\n * Since early available timelines are not supported, at least one segment must be present.\n *\n * @param {Object} config - options object\n * @param {Object[]} oldPlaylists - the old playlists to use as a reference\n * @param {Object[]} newPlaylists - the new playlists to update\n * @param {Object} timelineStarts - all timelineStarts seen in the stream to this point\n */\n\nconst updateSequenceNumbers = ({\n oldPlaylists,\n newPlaylists,\n timelineStarts\n}) => {\n newPlaylists.forEach(playlist => {\n playlist.discontinuitySequence = timelineStarts.findIndex(function ({\n timeline\n }) {\n return timeline === playlist.timeline;\n }); // Playlists NAMEs come from DASH Representation IDs, which are mandatory\n // (see ISO_23009-1-2012 5.3.5.2).\n //\n // If the same Representation existed in a prior Period, it will retain the same NAME.\n\n const oldPlaylist = findPlaylistWithName(oldPlaylists, playlist.attributes.NAME);\n\n if (!oldPlaylist) {\n // Since this is a new playlist, the media sequence values can start from 0 without\n // consequence.\n return;\n } // TODO better support for live SIDX\n //\n // As of this writing, mpd-parser does not support multiperiod SIDX (in live or VOD).\n // This is evident by a playlist only having a single SIDX reference. In a multiperiod\n // playlist there would need to be multiple SIDX references. In addition, live SIDX is\n // not supported when the SIDX properties change on refreshes.\n //\n // In the future, if support needs to be added, the merging logic here can be called\n // after SIDX references are resolved. For now, exit early to prevent exceptions being\n // thrown due to undefined references.\n\n\n if (playlist.sidx) {\n return;\n } // Since we don't yet support early available timelines, we don't need to support\n // playlists with no segments.\n\n\n const firstNewSegment = playlist.segments[0];\n const oldMatchingSegmentIndex = oldPlaylist.segments.findIndex(function (oldSegment) {\n return Math.abs(oldSegment.presentationTime - firstNewSegment.presentationTime) < TIME_FUDGE;\n }); // No matching segment from the old playlist means the entire playlist was refreshed.\n // In this case the media sequence should account for this update, and the new segments\n // should be marked as discontinuous from the prior content, since the last prior\n // timeline was removed.\n\n if (oldMatchingSegmentIndex === -1) {\n updateMediaSequenceForPlaylist({\n playlist,\n mediaSequence: oldPlaylist.mediaSequence + oldPlaylist.segments.length\n });\n playlist.segments[0].discontinuity = true;\n playlist.discontinuityStarts.unshift(0); // No matching segment does not necessarily mean there's missing content.\n //\n // If the new playlist's timeline is the same as the last seen segment's timeline,\n // then a discontinuity can be added to identify that there's potentially missing\n // content. If there's no missing content, the discontinuity should still be rather\n // harmless. It's possible that if segment durations are accurate enough, that the\n // existence of a gap can be determined using the presentation times and durations,\n // but if the segment timing info is off, it may introduce more problems than simply\n // adding the discontinuity.\n //\n // If the new playlist's timeline is different from the last seen segment's timeline,\n // then a discontinuity can be added to identify that this is the first seen segment\n // of a new timeline. However, the logic at the start of this function that\n // determined the disconinuity sequence by timeline index is now off by one (the\n // discontinuity of the newest timeline hasn't yet fallen off the manifest...since\n // we added it), so the disconinuity sequence must be decremented.\n //\n // A period may also have a duration of zero, so the case of no segments is handled\n // here even though we don't yet support early available periods.\n\n if (!oldPlaylist.segments.length && playlist.timeline > oldPlaylist.timeline || oldPlaylist.segments.length && playlist.timeline > oldPlaylist.segments[oldPlaylist.segments.length - 1].timeline) {\n playlist.discontinuitySequence--;\n }\n\n return;\n } // If the first segment matched with a prior segment on a discontinuity (it's matching\n // on the first segment of a period), then the discontinuitySequence shouldn't be the\n // timeline's matching one, but instead should be the one prior, and the first segment\n // of the new manifest should be marked with a discontinuity.\n //\n // The reason for this special case is that discontinuity sequence shows how many\n // discontinuities have fallen off of the playlist, and discontinuities are marked on\n // the first segment of a new \"timeline.\" Because of this, while DASH will retain that\n // Period while the \"timeline\" exists, HLS keeps track of it via the discontinuity\n // sequence, and that first segment is an indicator, but can be removed before that\n // timeline is gone.\n\n\n const oldMatchingSegment = oldPlaylist.segments[oldMatchingSegmentIndex];\n\n if (oldMatchingSegment.discontinuity && !firstNewSegment.discontinuity) {\n firstNewSegment.discontinuity = true;\n playlist.discontinuityStarts.unshift(0);\n playlist.discontinuitySequence--;\n }\n\n updateMediaSequenceForPlaylist({\n playlist,\n mediaSequence: oldPlaylist.segments[oldMatchingSegmentIndex].number\n });\n });\n};\n/**\n * Given an old parsed manifest object and a new parsed manifest object, updates the\n * sequence and timing values within the new manifest to ensure that it lines up with the\n * old.\n *\n * @param {Array} oldManifest - the old main manifest object\n * @param {Array} newManifest - the new main manifest object\n *\n * @return {Object} the updated new manifest object\n */\n\nconst positionManifestOnTimeline = ({\n oldManifest,\n newManifest\n}) => {\n // Starting from v4.1.2 of the IOP, section 4.4.3.3 states:\n //\n // \"MPD@availabilityStartTime and Period@start shall not be changed over MPD updates.\"\n //\n // This was added from https://github.com/Dash-Industry-Forum/DASH-IF-IOP/issues/160\n //\n // Because of this change, and the difficulty of supporting periods with changing start\n // times, periods with changing start times are not supported. This makes the logic much\n // simpler, since periods with the same start time can be considerred the same period\n // across refreshes.\n //\n // To give an example as to the difficulty of handling periods where the start time may\n // change, if a single period manifest is refreshed with another manifest with a single\n // period, and both the start and end times are increased, then the only way to determine\n // if it's a new period or an old one that has changed is to look through the segments of\n // each playlist and determine the presentation time bounds to find a match. In addition,\n // if the period start changed to exceed the old period end, then there would be no\n // match, and it would not be possible to determine whether the refreshed period is a new\n // one or the old one.\n const oldPlaylists = oldManifest.playlists.concat(getMediaGroupPlaylists(oldManifest));\n const newPlaylists = newManifest.playlists.concat(getMediaGroupPlaylists(newManifest)); // Save all seen timelineStarts to the new manifest. Although this potentially means that\n // there's a \"memory leak\" in that it will never stop growing, in reality, only a couple\n // of properties are saved for each seen Period. Even long running live streams won't\n // generate too many Periods, unless the stream is watched for decades. In the future,\n // this can be optimized by mapping to discontinuity sequence numbers for each timeline,\n // but it may not become an issue, and the additional info can be useful for debugging.\n\n newManifest.timelineStarts = getUniqueTimelineStarts([oldManifest.timelineStarts, newManifest.timelineStarts]);\n updateSequenceNumbers({\n oldPlaylists,\n newPlaylists,\n timelineStarts: newManifest.timelineStarts\n });\n return newManifest;\n};\n\nconst generateSidxKey = sidx => sidx && sidx.uri + '-' + byteRangeToString(sidx.byterange);\n\nconst mergeDiscontiguousPlaylists = playlists => {\n // Break out playlists into groups based on their baseUrl\n const playlistsByBaseUrl = playlists.reduce(function (acc, cur) {\n if (!acc[cur.attributes.baseUrl]) {\n acc[cur.attributes.baseUrl] = [];\n }\n\n acc[cur.attributes.baseUrl].push(cur);\n return acc;\n }, {});\n let allPlaylists = [];\n Object.values(playlistsByBaseUrl).forEach(playlistGroup => {\n const mergedPlaylists = values(playlistGroup.reduce((acc, playlist) => {\n // assuming playlist IDs are the same across periods\n // TODO: handle multiperiod where representation sets are not the same\n // across periods\n const name = playlist.attributes.id + (playlist.attributes.lang || '');\n\n if (!acc[name]) {\n // First Period\n acc[name] = playlist;\n acc[name].attributes.timelineStarts = [];\n } else {\n // Subsequent Periods\n if (playlist.segments) {\n // first segment of subsequent periods signal a discontinuity\n if (playlist.segments[0]) {\n playlist.segments[0].discontinuity = true;\n }\n\n acc[name].segments.push(...playlist.segments);\n } // bubble up contentProtection, this assumes all DRM content\n // has the same contentProtection\n\n\n if (playlist.attributes.contentProtection) {\n acc[name].attributes.contentProtection = playlist.attributes.contentProtection;\n }\n }\n\n acc[name].attributes.timelineStarts.push({\n // Although they represent the same number, it's important to have both to make it\n // compatible with HLS potentially having a similar attribute.\n start: playlist.attributes.periodStart,\n timeline: playlist.attributes.periodStart\n });\n return acc;\n }, {}));\n allPlaylists = allPlaylists.concat(mergedPlaylists);\n });\n return allPlaylists.map(playlist => {\n playlist.discontinuityStarts = findIndexes(playlist.segments || [], 'discontinuity');\n return playlist;\n });\n};\n\nconst addSidxSegmentsToPlaylist = (playlist, sidxMapping) => {\n const sidxKey = generateSidxKey(playlist.sidx);\n const sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx;\n\n if (sidxMatch) {\n addSidxSegmentsToPlaylist$1(playlist, sidxMatch, playlist.sidx.resolvedUri);\n }\n\n return playlist;\n};\nconst addSidxSegmentsToPlaylists = (playlists, sidxMapping = {}) => {\n if (!Object.keys(sidxMapping).length) {\n return playlists;\n }\n\n for (const i in playlists) {\n playlists[i] = addSidxSegmentsToPlaylist(playlists[i], sidxMapping);\n }\n\n return playlists;\n};\nconst formatAudioPlaylist = ({\n attributes,\n segments,\n sidx,\n mediaSequence,\n discontinuitySequence,\n discontinuityStarts\n}, isAudioOnly) => {\n const playlist = {\n attributes: {\n NAME: attributes.id,\n BANDWIDTH: attributes.bandwidth,\n CODECS: attributes.codecs,\n ['PROGRAM-ID']: 1\n },\n uri: '',\n endList: attributes.type === 'static',\n timeline: attributes.periodStart,\n resolvedUri: attributes.baseUrl || '',\n targetDuration: attributes.duration,\n discontinuitySequence,\n discontinuityStarts,\n timelineStarts: attributes.timelineStarts,\n mediaSequence,\n segments\n };\n\n if (attributes.contentProtection) {\n playlist.contentProtection = attributes.contentProtection;\n }\n\n if (attributes.serviceLocation) {\n playlist.attributes.serviceLocation = attributes.serviceLocation;\n }\n\n if (sidx) {\n playlist.sidx = sidx;\n }\n\n if (isAudioOnly) {\n playlist.attributes.AUDIO = 'audio';\n playlist.attributes.SUBTITLES = 'subs';\n }\n\n return playlist;\n};\nconst formatVttPlaylist = ({\n attributes,\n segments,\n mediaSequence,\n discontinuityStarts,\n discontinuitySequence\n}) => {\n if (typeof segments === 'undefined') {\n // vtt tracks may use single file in BaseURL\n segments = [{\n uri: attributes.baseUrl,\n timeline: attributes.periodStart,\n resolvedUri: attributes.baseUrl || '',\n duration: attributes.sourceDuration,\n number: 0\n }]; // targetDuration should be the same duration as the only segment\n\n attributes.duration = attributes.sourceDuration;\n }\n\n const m3u8Attributes = {\n NAME: attributes.id,\n BANDWIDTH: attributes.bandwidth,\n ['PROGRAM-ID']: 1\n };\n\n if (attributes.codecs) {\n m3u8Attributes.CODECS = attributes.codecs;\n }\n\n const vttPlaylist = {\n attributes: m3u8Attributes,\n uri: '',\n endList: attributes.type === 'static',\n timeline: attributes.periodStart,\n resolvedUri: attributes.baseUrl || '',\n targetDuration: attributes.duration,\n timelineStarts: attributes.timelineStarts,\n discontinuityStarts,\n discontinuitySequence,\n mediaSequence,\n segments\n };\n\n if (attributes.serviceLocation) {\n vttPlaylist.attributes.serviceLocation = attributes.serviceLocation;\n }\n\n return vttPlaylist;\n};\nconst organizeAudioPlaylists = (playlists, sidxMapping = {}, isAudioOnly = false) => {\n let mainPlaylist;\n const formattedPlaylists = playlists.reduce((a, playlist) => {\n const role = playlist.attributes.role && playlist.attributes.role.value || '';\n const language = playlist.attributes.lang || '';\n let label = playlist.attributes.label || 'main';\n\n if (language && !playlist.attributes.label) {\n const roleLabel = role ? ` (${role})` : '';\n label = `${playlist.attributes.lang}${roleLabel}`;\n }\n\n if (!a[label]) {\n a[label] = {\n language,\n autoselect: true,\n default: role === 'main',\n playlists: [],\n uri: ''\n };\n }\n\n const formatted = addSidxSegmentsToPlaylist(formatAudioPlaylist(playlist, isAudioOnly), sidxMapping);\n a[label].playlists.push(formatted);\n\n if (typeof mainPlaylist === 'undefined' && role === 'main') {\n mainPlaylist = playlist;\n mainPlaylist.default = true;\n }\n\n return a;\n }, {}); // if no playlists have role \"main\", mark the first as main\n\n if (!mainPlaylist) {\n const firstLabel = Object.keys(formattedPlaylists)[0];\n formattedPlaylists[firstLabel].default = true;\n }\n\n return formattedPlaylists;\n};\nconst organizeVttPlaylists = (playlists, sidxMapping = {}) => {\n return playlists.reduce((a, playlist) => {\n const label = playlist.attributes.label || playlist.attributes.lang || 'text';\n\n if (!a[label]) {\n a[label] = {\n language: label,\n default: false,\n autoselect: false,\n playlists: [],\n uri: ''\n };\n }\n\n a[label].playlists.push(addSidxSegmentsToPlaylist(formatVttPlaylist(playlist), sidxMapping));\n return a;\n }, {});\n};\n\nconst organizeCaptionServices = captionServices => captionServices.reduce((svcObj, svc) => {\n if (!svc) {\n return svcObj;\n }\n\n svc.forEach(service => {\n const {\n channel,\n language\n } = service;\n svcObj[language] = {\n autoselect: false,\n default: false,\n instreamId: channel,\n language\n };\n\n if (service.hasOwnProperty('aspectRatio')) {\n svcObj[language].aspectRatio = service.aspectRatio;\n }\n\n if (service.hasOwnProperty('easyReader')) {\n svcObj[language].easyReader = service.easyReader;\n }\n\n if (service.hasOwnProperty('3D')) {\n svcObj[language]['3D'] = service['3D'];\n }\n });\n return svcObj;\n}, {});\n\nconst formatVideoPlaylist = ({\n attributes,\n segments,\n sidx,\n discontinuityStarts\n}) => {\n const playlist = {\n attributes: {\n NAME: attributes.id,\n AUDIO: 'audio',\n SUBTITLES: 'subs',\n RESOLUTION: {\n width: attributes.width,\n height: attributes.height\n },\n CODECS: attributes.codecs,\n BANDWIDTH: attributes.bandwidth,\n ['PROGRAM-ID']: 1\n },\n uri: '',\n endList: attributes.type === 'static',\n timeline: attributes.periodStart,\n resolvedUri: attributes.baseUrl || '',\n targetDuration: attributes.duration,\n discontinuityStarts,\n timelineStarts: attributes.timelineStarts,\n segments\n };\n\n if (attributes.frameRate) {\n playlist.attributes['FRAME-RATE'] = attributes.frameRate;\n }\n\n if (attributes.contentProtection) {\n playlist.contentProtection = attributes.contentProtection;\n }\n\n if (attributes.serviceLocation) {\n playlist.attributes.serviceLocation = attributes.serviceLocation;\n }\n\n if (sidx) {\n playlist.sidx = sidx;\n }\n\n return playlist;\n};\n\nconst videoOnly = ({\n attributes\n}) => attributes.mimeType === 'video/mp4' || attributes.mimeType === 'video/webm' || attributes.contentType === 'video';\n\nconst audioOnly = ({\n attributes\n}) => attributes.mimeType === 'audio/mp4' || attributes.mimeType === 'audio/webm' || attributes.contentType === 'audio';\n\nconst vttOnly = ({\n attributes\n}) => attributes.mimeType === 'text/vtt' || attributes.contentType === 'text';\n/**\n * Contains start and timeline properties denoting a timeline start. For DASH, these will\n * be the same number.\n *\n * @typedef {Object} TimelineStart\n * @property {number} start - the start time of the timeline\n * @property {number} timeline - the timeline number\n */\n\n/**\n * Adds appropriate media and discontinuity sequence values to the segments and playlists.\n *\n * Throughout mpd-parser, the `number` attribute is used in relation to `startNumber`, a\n * DASH specific attribute used in constructing segment URI's from templates. However, from\n * an HLS perspective, the `number` attribute on a segment would be its `mediaSequence`\n * value, which should start at the original media sequence value (or 0) and increment by 1\n * for each segment thereafter. Since DASH's `startNumber` values are independent per\n * period, it doesn't make sense to use it for `number`. Instead, assume everything starts\n * from a 0 mediaSequence value and increment from there.\n *\n * Note that VHS currently doesn't use the `number` property, but it can be helpful for\n * debugging and making sense of the manifest.\n *\n * For live playlists, to account for values increasing in manifests when periods are\n * removed on refreshes, merging logic should be used to update the numbers to their\n * appropriate values (to ensure they're sequential and increasing).\n *\n * @param {Object[]} playlists - the playlists to update\n * @param {TimelineStart[]} timelineStarts - the timeline starts for the manifest\n */\n\n\nconst addMediaSequenceValues = (playlists, timelineStarts) => {\n // increment all segments sequentially\n playlists.forEach(playlist => {\n playlist.mediaSequence = 0;\n playlist.discontinuitySequence = timelineStarts.findIndex(function ({\n timeline\n }) {\n return timeline === playlist.timeline;\n });\n\n if (!playlist.segments) {\n return;\n }\n\n playlist.segments.forEach((segment, index) => {\n segment.number = index;\n });\n });\n};\n/**\n * Given a media group object, flattens all playlists within the media group into a single\n * array.\n *\n * @param {Object} mediaGroupObject - the media group object\n *\n * @return {Object[]}\n * The media group playlists\n */\n\nconst flattenMediaGroupPlaylists = mediaGroupObject => {\n if (!mediaGroupObject) {\n return [];\n }\n\n return Object.keys(mediaGroupObject).reduce((acc, label) => {\n const labelContents = mediaGroupObject[label];\n return acc.concat(labelContents.playlists);\n }, []);\n};\nconst toM3u8 = ({\n dashPlaylists,\n locations,\n contentSteering,\n sidxMapping = {},\n previousManifest,\n eventStream\n}) => {\n if (!dashPlaylists.length) {\n return {};\n } // grab all main manifest attributes\n\n\n const {\n sourceDuration: duration,\n type,\n suggestedPresentationDelay,\n minimumUpdatePeriod\n } = dashPlaylists[0].attributes;\n const videoPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist);\n const audioPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly));\n const vttPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(vttOnly));\n const captions = dashPlaylists.map(playlist => playlist.attributes.captionServices).filter(Boolean);\n const manifest = {\n allowCache: true,\n discontinuityStarts: [],\n segments: [],\n endList: true,\n mediaGroups: {\n AUDIO: {},\n VIDEO: {},\n ['CLOSED-CAPTIONS']: {},\n SUBTITLES: {}\n },\n uri: '',\n duration,\n playlists: addSidxSegmentsToPlaylists(videoPlaylists, sidxMapping)\n };\n\n if (minimumUpdatePeriod >= 0) {\n manifest.minimumUpdatePeriod = minimumUpdatePeriod * 1000;\n }\n\n if (locations) {\n manifest.locations = locations;\n }\n\n if (contentSteering) {\n manifest.contentSteering = contentSteering;\n }\n\n if (type === 'dynamic') {\n manifest.suggestedPresentationDelay = suggestedPresentationDelay;\n }\n\n if (eventStream && eventStream.length > 0) {\n manifest.eventStream = eventStream;\n }\n\n const isAudioOnly = manifest.playlists.length === 0;\n const organizedAudioGroup = audioPlaylists.length ? organizeAudioPlaylists(audioPlaylists, sidxMapping, isAudioOnly) : null;\n const organizedVttGroup = vttPlaylists.length ? organizeVttPlaylists(vttPlaylists, sidxMapping) : null;\n const formattedPlaylists = videoPlaylists.concat(flattenMediaGroupPlaylists(organizedAudioGroup), flattenMediaGroupPlaylists(organizedVttGroup));\n const playlistTimelineStarts = formattedPlaylists.map(({\n timelineStarts\n }) => timelineStarts);\n manifest.timelineStarts = getUniqueTimelineStarts(playlistTimelineStarts);\n addMediaSequenceValues(formattedPlaylists, manifest.timelineStarts);\n\n if (organizedAudioGroup) {\n manifest.mediaGroups.AUDIO.audio = organizedAudioGroup;\n }\n\n if (organizedVttGroup) {\n manifest.mediaGroups.SUBTITLES.subs = organizedVttGroup;\n }\n\n if (captions.length) {\n manifest.mediaGroups['CLOSED-CAPTIONS'].cc = organizeCaptionServices(captions);\n }\n\n if (previousManifest) {\n return positionManifestOnTimeline({\n oldManifest: previousManifest,\n newManifest: manifest\n });\n }\n\n return manifest;\n};\n\n/**\n * Calculates the R (repetition) value for a live stream (for the final segment\n * in a manifest where the r value is negative 1)\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {number} time\n * current time (typically the total time up until the final segment)\n * @param {number} duration\n * duration property for the given <S />\n *\n * @return {number}\n * R value to reach the end of the given period\n */\nconst getLiveRValue = (attributes, time, duration) => {\n const {\n NOW,\n clientOffset,\n availabilityStartTime,\n timescale = 1,\n periodStart = 0,\n minimumUpdatePeriod = 0\n } = attributes;\n const now = (NOW + clientOffset) / 1000;\n const periodStartWC = availabilityStartTime + periodStart;\n const periodEndWC = now + minimumUpdatePeriod;\n const periodDuration = periodEndWC - periodStartWC;\n return Math.ceil((periodDuration * timescale - time) / duration);\n};\n/**\n * Uses information provided by SegmentTemplate.SegmentTimeline to determine segment\n * timing and duration\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {Object[]} segmentTimeline\n * List of objects representing the attributes of each S element contained within\n *\n * @return {{number: number, duration: number, time: number, timeline: number}[]}\n * List of Objects with segment timing and duration info\n */\n\n\nconst parseByTimeline = (attributes, segmentTimeline) => {\n const {\n type,\n minimumUpdatePeriod = 0,\n media = '',\n sourceDuration,\n timescale = 1,\n startNumber = 1,\n periodStart: timeline\n } = attributes;\n const segments = [];\n let time = -1;\n\n for (let sIndex = 0; sIndex < segmentTimeline.length; sIndex++) {\n const S = segmentTimeline[sIndex];\n const duration = S.d;\n const repeat = S.r || 0;\n const segmentTime = S.t || 0;\n\n if (time < 0) {\n // first segment\n time = segmentTime;\n }\n\n if (segmentTime && segmentTime > time) {\n // discontinuity\n // TODO: How to handle this type of discontinuity\n // timeline++ here would treat it like HLS discontuity and content would\n // get appended without gap\n // E.G.\n // <S t=\"0\" d=\"1\" />\n // <S d=\"1\" />\n // <S d=\"1\" />\n // <S t=\"5\" d=\"1\" />\n // would have $Time$ values of [0, 1, 2, 5]\n // should this be appened at time positions [0, 1, 2, 3],(#EXT-X-DISCONTINUITY)\n // or [0, 1, 2, gap, gap, 5]? (#EXT-X-GAP)\n // does the value of sourceDuration consider this when calculating arbitrary\n // negative @r repeat value?\n // E.G. Same elements as above with this added at the end\n // <S d=\"1\" r=\"-1\" />\n // with a sourceDuration of 10\n // Would the 2 gaps be included in the time duration calculations resulting in\n // 8 segments with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9] or 10 segments\n // with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9, 10, 11] ?\n time = segmentTime;\n }\n\n let count;\n\n if (repeat < 0) {\n const nextS = sIndex + 1;\n\n if (nextS === segmentTimeline.length) {\n // last segment\n if (type === 'dynamic' && minimumUpdatePeriod > 0 && media.indexOf('$Number$') > 0) {\n count = getLiveRValue(attributes, time, duration);\n } else {\n // TODO: This may be incorrect depending on conclusion of TODO above\n count = (sourceDuration * timescale - time) / duration;\n }\n } else {\n count = (segmentTimeline[nextS].t - time) / duration;\n }\n } else {\n count = repeat + 1;\n }\n\n const end = startNumber + segments.length + count;\n let number = startNumber + segments.length;\n\n while (number < end) {\n segments.push({\n number,\n duration: duration / timescale,\n time,\n timeline\n });\n time += duration;\n number++;\n }\n }\n\n return segments;\n};\n\nconst identifierPattern = /\\$([A-z]*)(?:(%0)([0-9]+)d)?\\$/g;\n/**\n * Replaces template identifiers with corresponding values. To be used as the callback\n * for String.prototype.replace\n *\n * @name replaceCallback\n * @function\n * @param {string} match\n * Entire match of identifier\n * @param {string} identifier\n * Name of matched identifier\n * @param {string} format\n * Format tag string. Its presence indicates that padding is expected\n * @param {string} width\n * Desired length of the replaced value. Values less than this width shall be left\n * zero padded\n * @return {string}\n * Replacement for the matched identifier\n */\n\n/**\n * Returns a function to be used as a callback for String.prototype.replace to replace\n * template identifiers\n *\n * @param {Obect} values\n * Object containing values that shall be used to replace known identifiers\n * @param {number} values.RepresentationID\n * Value of the Representation@id attribute\n * @param {number} values.Number\n * Number of the corresponding segment\n * @param {number} values.Bandwidth\n * Value of the Representation@bandwidth attribute.\n * @param {number} values.Time\n * Timestamp value of the corresponding segment\n * @return {replaceCallback}\n * Callback to be used with String.prototype.replace to replace identifiers\n */\n\nconst identifierReplacement = values => (match, identifier, format, width) => {\n if (match === '$$') {\n // escape sequence\n return '$';\n }\n\n if (typeof values[identifier] === 'undefined') {\n return match;\n }\n\n const value = '' + values[identifier];\n\n if (identifier === 'RepresentationID') {\n // Format tag shall not be present with RepresentationID\n return value;\n }\n\n if (!format) {\n width = 1;\n } else {\n width = parseInt(width, 10);\n }\n\n if (value.length >= width) {\n return value;\n }\n\n return `${new Array(width - value.length + 1).join('0')}${value}`;\n};\n/**\n * Constructs a segment url from a template string\n *\n * @param {string} url\n * Template string to construct url from\n * @param {Obect} values\n * Object containing values that shall be used to replace known identifiers\n * @param {number} values.RepresentationID\n * Value of the Representation@id attribute\n * @param {number} values.Number\n * Number of the corresponding segment\n * @param {number} values.Bandwidth\n * Value of the Representation@bandwidth attribute.\n * @param {number} values.Time\n * Timestamp value of the corresponding segment\n * @return {string}\n * Segment url with identifiers replaced\n */\n\nconst constructTemplateUrl = (url, values) => url.replace(identifierPattern, identifierReplacement(values));\n/**\n * Generates a list of objects containing timing and duration information about each\n * segment needed to generate segment uris and the complete segment object\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {Object[]|undefined} segmentTimeline\n * List of objects representing the attributes of each S element contained within\n * the SegmentTimeline element\n * @return {{number: number, duration: number, time: number, timeline: number}[]}\n * List of Objects with segment timing and duration info\n */\n\nconst parseTemplateInfo = (attributes, segmentTimeline) => {\n if (!attributes.duration && !segmentTimeline) {\n // if neither @duration or SegmentTimeline are present, then there shall be exactly\n // one media segment\n return [{\n number: attributes.startNumber || 1,\n duration: attributes.sourceDuration,\n time: 0,\n timeline: attributes.periodStart\n }];\n }\n\n if (attributes.duration) {\n return parseByDuration(attributes);\n }\n\n return parseByTimeline(attributes, segmentTimeline);\n};\n/**\n * Generates a list of segments using information provided by the SegmentTemplate element\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {Object[]|undefined} segmentTimeline\n * List of objects representing the attributes of each S element contained within\n * the SegmentTimeline element\n * @return {Object[]}\n * List of segment objects\n */\n\nconst segmentsFromTemplate = (attributes, segmentTimeline) => {\n const templateValues = {\n RepresentationID: attributes.id,\n Bandwidth: attributes.bandwidth || 0\n };\n const {\n initialization = {\n sourceURL: '',\n range: ''\n }\n } = attributes;\n const mapSegment = urlTypeToSegment({\n baseUrl: attributes.baseUrl,\n source: constructTemplateUrl(initialization.sourceURL, templateValues),\n range: initialization.range\n });\n const segments = parseTemplateInfo(attributes, segmentTimeline);\n return segments.map(segment => {\n templateValues.Number = segment.number;\n templateValues.Time = segment.time;\n const uri = constructTemplateUrl(attributes.media || '', templateValues); // See DASH spec section 5.3.9.2.2\n // - if timescale isn't present on any level, default to 1.\n\n const timescale = attributes.timescale || 1; // - if presentationTimeOffset isn't present on any level, default to 0\n\n const presentationTimeOffset = attributes.presentationTimeOffset || 0;\n const presentationTime = // Even if the @t attribute is not specified for the segment, segment.time is\n // calculated in mpd-parser prior to this, so it's assumed to be available.\n attributes.periodStart + (segment.time - presentationTimeOffset) / timescale;\n const map = {\n uri,\n timeline: segment.timeline,\n duration: segment.duration,\n resolvedUri: (0,_videojs_vhs_utils_es_resolve_url__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(attributes.baseUrl || '', uri),\n map: mapSegment,\n number: segment.number,\n presentationTime\n };\n return map;\n });\n};\n\n/**\n * Converts a <SegmentUrl> (of type URLType from the DASH spec 5.3.9.2 Table 14)\n * to an object that matches the output of a segment in videojs/mpd-parser\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {Object} segmentUrl\n * <SegmentURL> node to translate into a segment object\n * @return {Object} translated segment object\n */\n\nconst SegmentURLToSegmentObject = (attributes, segmentUrl) => {\n const {\n baseUrl,\n initialization = {}\n } = attributes;\n const initSegment = urlTypeToSegment({\n baseUrl,\n source: initialization.sourceURL,\n range: initialization.range\n });\n const segment = urlTypeToSegment({\n baseUrl,\n source: segmentUrl.media,\n range: segmentUrl.mediaRange\n });\n segment.map = initSegment;\n return segment;\n};\n/**\n * Generates a list of segments using information provided by the SegmentList element\n * SegmentList (DASH SPEC Section 5.3.9.3.2) contains a set of <SegmentURL> nodes. Each\n * node should be translated into segment.\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {Object[]|undefined} segmentTimeline\n * List of objects representing the attributes of each S element contained within\n * the SegmentTimeline element\n * @return {Object.<Array>} list of segments\n */\n\n\nconst segmentsFromList = (attributes, segmentTimeline) => {\n const {\n duration,\n segmentUrls = [],\n periodStart\n } = attributes; // Per spec (5.3.9.2.1) no way to determine segment duration OR\n // if both SegmentTimeline and @duration are defined, it is outside of spec.\n\n if (!duration && !segmentTimeline || duration && segmentTimeline) {\n throw new Error(errors.SEGMENT_TIME_UNSPECIFIED);\n }\n\n const segmentUrlMap = segmentUrls.map(segmentUrlObject => SegmentURLToSegmentObject(attributes, segmentUrlObject));\n let segmentTimeInfo;\n\n if (duration) {\n segmentTimeInfo = parseByDuration(attributes);\n }\n\n if (segmentTimeline) {\n segmentTimeInfo = parseByTimeline(attributes, segmentTimeline);\n }\n\n const segments = segmentTimeInfo.map((segmentTime, index) => {\n if (segmentUrlMap[index]) {\n const segment = segmentUrlMap[index]; // See DASH spec section 5.3.9.2.2\n // - if timescale isn't present on any level, default to 1.\n\n const timescale = attributes.timescale || 1; // - if presentationTimeOffset isn't present on any level, default to 0\n\n const presentationTimeOffset = attributes.presentationTimeOffset || 0;\n segment.timeline = segmentTime.timeline;\n segment.duration = segmentTime.duration;\n segment.number = segmentTime.number;\n segment.presentationTime = periodStart + (segmentTime.time - presentationTimeOffset) / timescale;\n return segment;\n } // Since we're mapping we should get rid of any blank segments (in case\n // the given SegmentTimeline is handling for more elements than we have\n // SegmentURLs for).\n\n }).filter(segment => segment);\n return segments;\n};\n\nconst generateSegments = ({\n attributes,\n segmentInfo\n}) => {\n let segmentAttributes;\n let segmentsFn;\n\n if (segmentInfo.template) {\n segmentsFn = segmentsFromTemplate;\n segmentAttributes = merge(attributes, segmentInfo.template);\n } else if (segmentInfo.base) {\n segmentsFn = segmentsFromBase;\n segmentAttributes = merge(attributes, segmentInfo.base);\n } else if (segmentInfo.list) {\n segmentsFn = segmentsFromList;\n segmentAttributes = merge(attributes, segmentInfo.list);\n }\n\n const segmentsInfo = {\n attributes\n };\n\n if (!segmentsFn) {\n return segmentsInfo;\n }\n\n const segments = segmentsFn(segmentAttributes, segmentInfo.segmentTimeline); // The @duration attribute will be used to determin the playlist's targetDuration which\n // must be in seconds. Since we've generated the segment list, we no longer need\n // @duration to be in @timescale units, so we can convert it here.\n\n if (segmentAttributes.duration) {\n const {\n duration,\n timescale = 1\n } = segmentAttributes;\n segmentAttributes.duration = duration / timescale;\n } else if (segments.length) {\n // if there is no @duration attribute, use the largest segment duration as\n // as target duration\n segmentAttributes.duration = segments.reduce((max, segment) => {\n return Math.max(max, Math.ceil(segment.duration));\n }, 0);\n } else {\n segmentAttributes.duration = 0;\n }\n\n segmentsInfo.attributes = segmentAttributes;\n segmentsInfo.segments = segments; // This is a sidx box without actual segment information\n\n if (segmentInfo.base && segmentAttributes.indexRange) {\n segmentsInfo.sidx = segments[0];\n segmentsInfo.segments = [];\n }\n\n return segmentsInfo;\n};\nconst toPlaylists = representations => representations.map(generateSegments);\n\nconst findChildren = (element, name) => from(element.childNodes).filter(({\n tagName\n}) => tagName === name);\nconst getContent = element => element.textContent.trim();\n\n/**\n * Converts the provided string that may contain a division operation to a number.\n *\n * @param {string} value - the provided string value\n *\n * @return {number} the parsed string value\n */\nconst parseDivisionValue = value => {\n return parseFloat(value.split('/').reduce((prev, current) => prev / current));\n};\n\nconst parseDuration = str => {\n const SECONDS_IN_YEAR = 365 * 24 * 60 * 60;\n const SECONDS_IN_MONTH = 30 * 24 * 60 * 60;\n const SECONDS_IN_DAY = 24 * 60 * 60;\n const SECONDS_IN_HOUR = 60 * 60;\n const SECONDS_IN_MIN = 60; // P10Y10M10DT10H10M10.1S\n\n const durationRegex = /P(?:(\\d*)Y)?(?:(\\d*)M)?(?:(\\d*)D)?(?:T(?:(\\d*)H)?(?:(\\d*)M)?(?:([\\d.]*)S)?)?/;\n const match = durationRegex.exec(str);\n\n if (!match) {\n return 0;\n }\n\n const [year, month, day, hour, minute, second] = match.slice(1);\n return parseFloat(year || 0) * SECONDS_IN_YEAR + parseFloat(month || 0) * SECONDS_IN_MONTH + parseFloat(day || 0) * SECONDS_IN_DAY + parseFloat(hour || 0) * SECONDS_IN_HOUR + parseFloat(minute || 0) * SECONDS_IN_MIN + parseFloat(second || 0);\n};\nconst parseDate = str => {\n // Date format without timezone according to ISO 8601\n // YYY-MM-DDThh:mm:ss.ssssss\n const dateRegex = /^\\d+-\\d+-\\d+T\\d+:\\d+:\\d+(\\.\\d+)?$/; // If the date string does not specifiy a timezone, we must specifiy UTC. This is\n // expressed by ending with 'Z'\n\n if (dateRegex.test(str)) {\n str += 'Z';\n }\n\n return Date.parse(str);\n};\n\nconst parsers = {\n /**\n * Specifies the duration of the entire Media Presentation. Format is a duration string\n * as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The duration in seconds\n */\n mediaPresentationDuration(value) {\n return parseDuration(value);\n },\n\n /**\n * Specifies the Segment availability start time for all Segments referred to in this\n * MPD. For a dynamic manifest, it specifies the anchor for the earliest availability\n * time. Format is a date string as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The date as seconds from unix epoch\n */\n availabilityStartTime(value) {\n return parseDate(value) / 1000;\n },\n\n /**\n * Specifies the smallest period between potential changes to the MPD. Format is a\n * duration string as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The duration in seconds\n */\n minimumUpdatePeriod(value) {\n return parseDuration(value);\n },\n\n /**\n * Specifies the suggested presentation delay. Format is a\n * duration string as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The duration in seconds\n */\n suggestedPresentationDelay(value) {\n return parseDuration(value);\n },\n\n /**\n * specifices the type of mpd. Can be either \"static\" or \"dynamic\"\n *\n * @param {string} value\n * value of attribute as a string\n *\n * @return {string}\n * The type as a string\n */\n type(value) {\n return value;\n },\n\n /**\n * Specifies the duration of the smallest time shifting buffer for any Representation\n * in the MPD. Format is a duration string as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The duration in seconds\n */\n timeShiftBufferDepth(value) {\n return parseDuration(value);\n },\n\n /**\n * Specifies the PeriodStart time of the Period relative to the availabilityStarttime.\n * Format is a duration string as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The duration in seconds\n */\n start(value) {\n return parseDuration(value);\n },\n\n /**\n * Specifies the width of the visual presentation\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed width\n */\n width(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the height of the visual presentation\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed height\n */\n height(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the bitrate of the representation\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed bandwidth\n */\n bandwidth(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the frame rate of the representation\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed frame rate\n */\n frameRate(value) {\n return parseDivisionValue(value);\n },\n\n /**\n * Specifies the number of the first Media Segment in this Representation in the Period\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed number\n */\n startNumber(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the timescale in units per seconds\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed timescale\n */\n timescale(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the presentationTimeOffset.\n *\n * @param {string} value\n * value of the attribute as a string\n *\n * @return {number}\n * The parsed presentationTimeOffset\n */\n presentationTimeOffset(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the constant approximate Segment duration\n * NOTE: The <Period> element also contains an @duration attribute. This duration\n * specifies the duration of the Period. This attribute is currently not\n * supported by the rest of the parser, however we still check for it to prevent\n * errors.\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed duration\n */\n duration(value) {\n const parsedValue = parseInt(value, 10);\n\n if (isNaN(parsedValue)) {\n return parseDuration(value);\n }\n\n return parsedValue;\n },\n\n /**\n * Specifies the Segment duration, in units of the value of the @timescale.\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed duration\n */\n d(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the MPD start time, in @timescale units, the first Segment in the series\n * starts relative to the beginning of the Period\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed time\n */\n t(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the repeat count of the number of following contiguous Segments with the\n * same duration expressed by the value of @d\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed number\n */\n r(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the presentationTime.\n *\n * @param {string} value\n * value of the attribute as a string\n *\n * @return {number}\n * The parsed presentationTime\n */\n presentationTime(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Default parser for all other attributes. Acts as a no-op and just returns the value\n * as a string\n *\n * @param {string} value\n * value of attribute as a string\n * @return {string}\n * Unparsed value\n */\n DEFAULT(value) {\n return value;\n }\n\n};\n/**\n * Gets all the attributes and values of the provided node, parses attributes with known\n * types, and returns an object with attribute names mapped to values.\n *\n * @param {Node} el\n * The node to parse attributes from\n * @return {Object}\n * Object with all attributes of el parsed\n */\n\nconst parseAttributes = el => {\n if (!(el && el.attributes)) {\n return {};\n }\n\n return from(el.attributes).reduce((a, e) => {\n const parseFn = parsers[e.name] || parsers.DEFAULT;\n a[e.name] = parseFn(e.value);\n return a;\n }, {});\n};\n\nconst keySystemsMap = {\n 'urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b': 'org.w3.clearkey',\n 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed': 'com.widevine.alpha',\n 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95': 'com.microsoft.playready',\n 'urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb': 'com.adobe.primetime',\n // ISO_IEC 23009-1_2022 5.8.5.2.2 The mp4 Protection Scheme\n 'urn:mpeg:dash:mp4protection:2011': 'mp4protection'\n};\n/**\n * Builds a list of urls that is the product of the reference urls and BaseURL values\n *\n * @param {Object[]} references\n * List of objects containing the reference URL as well as its attributes\n * @param {Node[]} baseUrlElements\n * List of BaseURL nodes from the mpd\n * @return {Object[]}\n * List of objects with resolved urls and attributes\n */\n\nconst buildBaseUrls = (references, baseUrlElements) => {\n if (!baseUrlElements.length) {\n return references;\n }\n\n return flatten(references.map(function (reference) {\n return baseUrlElements.map(function (baseUrlElement) {\n const initialBaseUrl = getContent(baseUrlElement);\n const resolvedBaseUrl = (0,_videojs_vhs_utils_es_resolve_url__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(reference.baseUrl, initialBaseUrl);\n const finalBaseUrl = merge(parseAttributes(baseUrlElement), {\n baseUrl: resolvedBaseUrl\n }); // If the URL is resolved, we want to get the serviceLocation from the reference\n // assuming there is no serviceLocation on the initialBaseUrl\n\n if (resolvedBaseUrl !== initialBaseUrl && !finalBaseUrl.serviceLocation && reference.serviceLocation) {\n finalBaseUrl.serviceLocation = reference.serviceLocation;\n }\n\n return finalBaseUrl;\n });\n }));\n};\n/**\n * Contains all Segment information for its containing AdaptationSet\n *\n * @typedef {Object} SegmentInformation\n * @property {Object|undefined} template\n * Contains the attributes for the SegmentTemplate node\n * @property {Object[]|undefined} segmentTimeline\n * Contains a list of atrributes for each S node within the SegmentTimeline node\n * @property {Object|undefined} list\n * Contains the attributes for the SegmentList node\n * @property {Object|undefined} base\n * Contains the attributes for the SegmentBase node\n */\n\n/**\n * Returns all available Segment information contained within the AdaptationSet node\n *\n * @param {Node} adaptationSet\n * The AdaptationSet node to get Segment information from\n * @return {SegmentInformation}\n * The Segment information contained within the provided AdaptationSet\n */\n\nconst getSegmentInformation = adaptationSet => {\n const segmentTemplate = findChildren(adaptationSet, 'SegmentTemplate')[0];\n const segmentList = findChildren(adaptationSet, 'SegmentList')[0];\n const segmentUrls = segmentList && findChildren(segmentList, 'SegmentURL').map(s => merge({\n tag: 'SegmentURL'\n }, parseAttributes(s)));\n const segmentBase = findChildren(adaptationSet, 'SegmentBase')[0];\n const segmentTimelineParentNode = segmentList || segmentTemplate;\n const segmentTimeline = segmentTimelineParentNode && findChildren(segmentTimelineParentNode, 'SegmentTimeline')[0];\n const segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate;\n const segmentInitialization = segmentInitializationParentNode && findChildren(segmentInitializationParentNode, 'Initialization')[0]; // SegmentTemplate is handled slightly differently, since it can have both\n // @initialization and an <Initialization> node. @initialization can be templated,\n // while the node can have a url and range specified. If the <SegmentTemplate> has\n // both @initialization and an <Initialization> subelement we opt to override with\n // the node, as this interaction is not defined in the spec.\n\n const template = segmentTemplate && parseAttributes(segmentTemplate);\n\n if (template && segmentInitialization) {\n template.initialization = segmentInitialization && parseAttributes(segmentInitialization);\n } else if (template && template.initialization) {\n // If it is @initialization we convert it to an object since this is the format that\n // later functions will rely on for the initialization segment. This is only valid\n // for <SegmentTemplate>\n template.initialization = {\n sourceURL: template.initialization\n };\n }\n\n const segmentInfo = {\n template,\n segmentTimeline: segmentTimeline && findChildren(segmentTimeline, 'S').map(s => parseAttributes(s)),\n list: segmentList && merge(parseAttributes(segmentList), {\n segmentUrls,\n initialization: parseAttributes(segmentInitialization)\n }),\n base: segmentBase && merge(parseAttributes(segmentBase), {\n initialization: parseAttributes(segmentInitialization)\n })\n };\n Object.keys(segmentInfo).forEach(key => {\n if (!segmentInfo[key]) {\n delete segmentInfo[key];\n }\n });\n return segmentInfo;\n};\n/**\n * Contains Segment information and attributes needed to construct a Playlist object\n * from a Representation\n *\n * @typedef {Object} RepresentationInformation\n * @property {SegmentInformation} segmentInfo\n * Segment information for this Representation\n * @property {Object} attributes\n * Inherited attributes for this Representation\n */\n\n/**\n * Maps a Representation node to an object containing Segment information and attributes\n *\n * @name inheritBaseUrlsCallback\n * @function\n * @param {Node} representation\n * Representation node from the mpd\n * @return {RepresentationInformation}\n * Representation information needed to construct a Playlist object\n */\n\n/**\n * Returns a callback for Array.prototype.map for mapping Representation nodes to\n * Segment information and attributes using inherited BaseURL nodes.\n *\n * @param {Object} adaptationSetAttributes\n * Contains attributes inherited by the AdaptationSet\n * @param {Object[]} adaptationSetBaseUrls\n * List of objects containing resolved base URLs and attributes\n * inherited by the AdaptationSet\n * @param {SegmentInformation} adaptationSetSegmentInfo\n * Contains Segment information for the AdaptationSet\n * @return {inheritBaseUrlsCallback}\n * Callback map function\n */\n\nconst inheritBaseUrls = (adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) => representation => {\n const repBaseUrlElements = findChildren(representation, 'BaseURL');\n const repBaseUrls = buildBaseUrls(adaptationSetBaseUrls, repBaseUrlElements);\n const attributes = merge(adaptationSetAttributes, parseAttributes(representation));\n const representationSegmentInfo = getSegmentInformation(representation);\n return repBaseUrls.map(baseUrl => {\n return {\n segmentInfo: merge(adaptationSetSegmentInfo, representationSegmentInfo),\n attributes: merge(attributes, baseUrl)\n };\n });\n};\n/**\n * Tranforms a series of content protection nodes to\n * an object containing pssh data by key system\n *\n * @param {Node[]} contentProtectionNodes\n * Content protection nodes\n * @return {Object}\n * Object containing pssh data by key system\n */\n\nconst generateKeySystemInformation = contentProtectionNodes => {\n return contentProtectionNodes.reduce((acc, node) => {\n const attributes = parseAttributes(node); // Although it could be argued that according to the UUID RFC spec the UUID string (a-f chars) should be generated\n // as a lowercase string it also mentions it should be treated as case-insensitive on input. Since the key system\n // UUIDs in the keySystemsMap are hardcoded as lowercase in the codebase there isn't any reason not to do\n // .toLowerCase() on the input UUID string from the manifest (at least I could not think of one).\n\n if (attributes.schemeIdUri) {\n attributes.schemeIdUri = attributes.schemeIdUri.toLowerCase();\n }\n\n const keySystem = keySystemsMap[attributes.schemeIdUri];\n\n if (keySystem) {\n acc[keySystem] = {\n attributes\n };\n const psshNode = findChildren(node, 'cenc:pssh')[0];\n\n if (psshNode) {\n const pssh = getContent(psshNode);\n acc[keySystem].pssh = pssh && (0,_videojs_vhs_utils_es_decode_b64_to_uint8_array__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(pssh);\n }\n }\n\n return acc;\n }, {});\n}; // defined in ANSI_SCTE 214-1 2016\n\n\nconst parseCaptionServiceMetadata = service => {\n // 608 captions\n if (service.schemeIdUri === 'urn:scte:dash:cc:cea-608:2015') {\n const values = typeof service.value !== 'string' ? [] : service.value.split(';');\n return values.map(value => {\n let channel;\n let language; // default language to value\n\n language = value;\n\n if (/^CC\\d=/.test(value)) {\n [channel, language] = value.split('=');\n } else if (/^CC\\d$/.test(value)) {\n channel = value;\n }\n\n return {\n channel,\n language\n };\n });\n } else if (service.schemeIdUri === 'urn:scte:dash:cc:cea-708:2015') {\n const values = typeof service.value !== 'string' ? [] : service.value.split(';');\n return values.map(value => {\n const flags = {\n // service or channel number 1-63\n 'channel': undefined,\n // language is a 3ALPHA per ISO 639.2/B\n // field is required\n 'language': undefined,\n // BIT 1/0 or ?\n // default value is 1, meaning 16:9 aspect ratio, 0 is 4:3, ? is unknown\n 'aspectRatio': 1,\n // BIT 1/0\n // easy reader flag indicated the text is tailed to the needs of beginning readers\n // default 0, or off\n 'easyReader': 0,\n // BIT 1/0\n // If 3d metadata is present (CEA-708.1) then 1\n // default 0\n '3D': 0\n };\n\n if (/=/.test(value)) {\n const [channel, opts = ''] = value.split('=');\n flags.channel = channel;\n flags.language = value;\n opts.split(',').forEach(opt => {\n const [name, val] = opt.split(':');\n\n if (name === 'lang') {\n flags.language = val; // er for easyReadery\n } else if (name === 'er') {\n flags.easyReader = Number(val); // war for wide aspect ratio\n } else if (name === 'war') {\n flags.aspectRatio = Number(val);\n } else if (name === '3D') {\n flags['3D'] = Number(val);\n }\n });\n } else {\n flags.language = value;\n }\n\n if (flags.channel) {\n flags.channel = 'SERVICE' + flags.channel;\n }\n\n return flags;\n });\n }\n};\n/**\n * A map callback that will parse all event stream data for a collection of periods\n * DASH ISO_IEC_23009 5.10.2.2\n * https://dashif-documents.azurewebsites.net/Events/master/event.html#mpd-event-timing\n *\n * @param {PeriodInformation} period object containing necessary period information\n * @return a collection of parsed eventstream event objects\n */\n\nconst toEventStream = period => {\n // get and flatten all EventStreams tags and parse attributes and children\n return flatten(findChildren(period.node, 'EventStream').map(eventStream => {\n const eventStreamAttributes = parseAttributes(eventStream);\n const schemeIdUri = eventStreamAttributes.schemeIdUri; // find all Events per EventStream tag and map to return objects\n\n return findChildren(eventStream, 'Event').map(event => {\n const eventAttributes = parseAttributes(event);\n const presentationTime = eventAttributes.presentationTime || 0;\n const timescale = eventStreamAttributes.timescale || 1;\n const duration = eventAttributes.duration || 0;\n const start = presentationTime / timescale + period.attributes.start;\n return {\n schemeIdUri,\n value: eventStreamAttributes.value,\n id: eventAttributes.id,\n start,\n end: start + duration / timescale,\n messageData: getContent(event) || eventAttributes.messageData,\n contentEncoding: eventStreamAttributes.contentEncoding,\n presentationTimeOffset: eventStreamAttributes.presentationTimeOffset || 0\n };\n });\n }));\n};\n/**\n * Maps an AdaptationSet node to a list of Representation information objects\n *\n * @name toRepresentationsCallback\n * @function\n * @param {Node} adaptationSet\n * AdaptationSet node from the mpd\n * @return {RepresentationInformation[]}\n * List of objects containing Representaion information\n */\n\n/**\n * Returns a callback for Array.prototype.map for mapping AdaptationSet nodes to a list of\n * Representation information objects\n *\n * @param {Object} periodAttributes\n * Contains attributes inherited by the Period\n * @param {Object[]} periodBaseUrls\n * Contains list of objects with resolved base urls and attributes\n * inherited by the Period\n * @param {string[]} periodSegmentInfo\n * Contains Segment Information at the period level\n * @return {toRepresentationsCallback}\n * Callback map function\n */\n\nconst toRepresentations = (periodAttributes, periodBaseUrls, periodSegmentInfo) => adaptationSet => {\n const adaptationSetAttributes = parseAttributes(adaptationSet);\n const adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls, findChildren(adaptationSet, 'BaseURL'));\n const role = findChildren(adaptationSet, 'Role')[0];\n const roleAttributes = {\n role: parseAttributes(role)\n };\n let attrs = merge(periodAttributes, adaptationSetAttributes, roleAttributes);\n const accessibility = findChildren(adaptationSet, 'Accessibility')[0];\n const captionServices = parseCaptionServiceMetadata(parseAttributes(accessibility));\n\n if (captionServices) {\n attrs = merge(attrs, {\n captionServices\n });\n }\n\n const label = findChildren(adaptationSet, 'Label')[0];\n\n if (label && label.childNodes.length) {\n const labelVal = label.childNodes[0].nodeValue.trim();\n attrs = merge(attrs, {\n label: labelVal\n });\n }\n\n const contentProtection = generateKeySystemInformation(findChildren(adaptationSet, 'ContentProtection'));\n\n if (Object.keys(contentProtection).length) {\n attrs = merge(attrs, {\n contentProtection\n });\n }\n\n const segmentInfo = getSegmentInformation(adaptationSet);\n const representations = findChildren(adaptationSet, 'Representation');\n const adaptationSetSegmentInfo = merge(periodSegmentInfo, segmentInfo);\n return flatten(representations.map(inheritBaseUrls(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo)));\n};\n/**\n * Contains all period information for mapping nodes onto adaptation sets.\n *\n * @typedef {Object} PeriodInformation\n * @property {Node} period.node\n * Period node from the mpd\n * @property {Object} period.attributes\n * Parsed period attributes from node plus any added\n */\n\n/**\n * Maps a PeriodInformation object to a list of Representation information objects for all\n * AdaptationSet nodes contained within the Period.\n *\n * @name toAdaptationSetsCallback\n * @function\n * @param {PeriodInformation} period\n * Period object containing necessary period information\n * @param {number} periodStart\n * Start time of the Period within the mpd\n * @return {RepresentationInformation[]}\n * List of objects containing Representaion information\n */\n\n/**\n * Returns a callback for Array.prototype.map for mapping Period nodes to a list of\n * Representation information objects\n *\n * @param {Object} mpdAttributes\n * Contains attributes inherited by the mpd\n * @param {Object[]} mpdBaseUrls\n * Contains list of objects with resolved base urls and attributes\n * inherited by the mpd\n * @return {toAdaptationSetsCallback}\n * Callback map function\n */\n\nconst toAdaptationSets = (mpdAttributes, mpdBaseUrls) => (period, index) => {\n const periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period.node, 'BaseURL'));\n const periodAttributes = merge(mpdAttributes, {\n periodStart: period.attributes.start\n });\n\n if (typeof period.attributes.duration === 'number') {\n periodAttributes.periodDuration = period.attributes.duration;\n }\n\n const adaptationSets = findChildren(period.node, 'AdaptationSet');\n const periodSegmentInfo = getSegmentInformation(period.node);\n return flatten(adaptationSets.map(toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo)));\n};\n/**\n * Tranforms an array of content steering nodes into an object\n * containing CDN content steering information from the MPD manifest.\n *\n * For more information on the DASH spec for Content Steering parsing, see:\n * https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf\n *\n * @param {Node[]} contentSteeringNodes\n * Content steering nodes\n * @param {Function} eventHandler\n * The event handler passed into the parser options to handle warnings\n * @return {Object}\n * Object containing content steering data\n */\n\nconst generateContentSteeringInformation = (contentSteeringNodes, eventHandler) => {\n // If there are more than one ContentSteering tags, throw an error\n if (contentSteeringNodes.length > 1) {\n eventHandler({\n type: 'warn',\n message: 'The MPD manifest should contain no more than one ContentSteering tag'\n });\n } // Return a null value if there are no ContentSteering tags\n\n\n if (!contentSteeringNodes.length) {\n return null;\n }\n\n const infoFromContentSteeringTag = merge({\n serverURL: getContent(contentSteeringNodes[0])\n }, parseAttributes(contentSteeringNodes[0])); // Converts `queryBeforeStart` to a boolean, as well as setting the default value\n // to `false` if it doesn't exist\n\n infoFromContentSteeringTag.queryBeforeStart = infoFromContentSteeringTag.queryBeforeStart === 'true';\n return infoFromContentSteeringTag;\n};\n/**\n * Gets Period@start property for a given period.\n *\n * @param {Object} options\n * Options object\n * @param {Object} options.attributes\n * Period attributes\n * @param {Object} [options.priorPeriodAttributes]\n * Prior period attributes (if prior period is available)\n * @param {string} options.mpdType\n * The MPD@type these periods came from\n * @return {number|null}\n * The period start, or null if it's an early available period or error\n */\n\nconst getPeriodStart = ({\n attributes,\n priorPeriodAttributes,\n mpdType\n}) => {\n // Summary of period start time calculation from DASH spec section 5.3.2.1\n //\n // A period's start is the first period's start + time elapsed after playing all\n // prior periods to this one. Periods continue one after the other in time (without\n // gaps) until the end of the presentation.\n //\n // The value of Period@start should be:\n // 1. if Period@start is present: value of Period@start\n // 2. if previous period exists and it has @duration: previous Period@start +\n // previous Period@duration\n // 3. if this is first period and MPD@type is 'static': 0\n // 4. in all other cases, consider the period an \"early available period\" (note: not\n // currently supported)\n // (1)\n if (typeof attributes.start === 'number') {\n return attributes.start;\n } // (2)\n\n\n if (priorPeriodAttributes && typeof priorPeriodAttributes.start === 'number' && typeof priorPeriodAttributes.duration === 'number') {\n return priorPeriodAttributes.start + priorPeriodAttributes.duration;\n } // (3)\n\n\n if (!priorPeriodAttributes && mpdType === 'static') {\n return 0;\n } // (4)\n // There is currently no logic for calculating the Period@start value if there is\n // no Period@start or prior Period@start and Period@duration available. This is not made\n // explicit by the DASH interop guidelines or the DASH spec, however, since there's\n // nothing about any other resolution strategies, it's implied. Thus, this case should\n // be considered an early available period, or error, and null should suffice for both\n // of those cases.\n\n\n return null;\n};\n/**\n * Traverses the mpd xml tree to generate a list of Representation information objects\n * that have inherited attributes from parent nodes\n *\n * @param {Node} mpd\n * The root node of the mpd\n * @param {Object} options\n * Available options for inheritAttributes\n * @param {string} options.manifestUri\n * The uri source of the mpd\n * @param {number} options.NOW\n * Current time per DASH IOP. Default is current time in ms since epoch\n * @param {number} options.clientOffset\n * Client time difference from NOW (in milliseconds)\n * @return {RepresentationInformation[]}\n * List of objects containing Representation information\n */\n\nconst inheritAttributes = (mpd, options = {}) => {\n const {\n manifestUri = '',\n NOW = Date.now(),\n clientOffset = 0,\n // TODO: For now, we are expecting an eventHandler callback function\n // to be passed into the mpd parser as an option.\n // In the future, we should enable stream parsing by using the Stream class from vhs-utils.\n // This will support new features including a standardized event handler.\n // See the m3u8 parser for examples of how stream parsing is currently used for HLS parsing.\n // https://github.com/videojs/vhs-utils/blob/88d6e10c631e57a5af02c5a62bc7376cd456b4f5/src/stream.js#L9\n eventHandler = function () {}\n } = options;\n const periodNodes = findChildren(mpd, 'Period');\n\n if (!periodNodes.length) {\n throw new Error(errors.INVALID_NUMBER_OF_PERIOD);\n }\n\n const locations = findChildren(mpd, 'Location');\n const mpdAttributes = parseAttributes(mpd);\n const mpdBaseUrls = buildBaseUrls([{\n baseUrl: manifestUri\n }], findChildren(mpd, 'BaseURL'));\n const contentSteeringNodes = findChildren(mpd, 'ContentSteering'); // See DASH spec section 5.3.1.2, Semantics of MPD element. Default type to 'static'.\n\n mpdAttributes.type = mpdAttributes.type || 'static';\n mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0;\n mpdAttributes.NOW = NOW;\n mpdAttributes.clientOffset = clientOffset;\n\n if (locations.length) {\n mpdAttributes.locations = locations.map(getContent);\n }\n\n const periods = []; // Since toAdaptationSets acts on individual periods right now, the simplest approach to\n // adding properties that require looking at prior periods is to parse attributes and add\n // missing ones before toAdaptationSets is called. If more such properties are added, it\n // may be better to refactor toAdaptationSets.\n\n periodNodes.forEach((node, index) => {\n const attributes = parseAttributes(node); // Use the last modified prior period, as it may contain added information necessary\n // for this period.\n\n const priorPeriod = periods[index - 1];\n attributes.start = getPeriodStart({\n attributes,\n priorPeriodAttributes: priorPeriod ? priorPeriod.attributes : null,\n mpdType: mpdAttributes.type\n });\n periods.push({\n node,\n attributes\n });\n });\n return {\n locations: mpdAttributes.locations,\n contentSteeringInfo: generateContentSteeringInformation(contentSteeringNodes, eventHandler),\n // TODO: There are occurences where this `representationInfo` array contains undesired\n // duplicates. This generally occurs when there are multiple BaseURL nodes that are\n // direct children of the MPD node. When we attempt to resolve URLs from a combination of the\n // parent BaseURL and a child BaseURL, and the value does not resolve,\n // we end up returning the child BaseURL multiple times.\n // We need to determine a way to remove these duplicates in a safe way.\n // See: https://github.com/videojs/mpd-parser/pull/17#discussion_r162750527\n representationInfo: flatten(periods.map(toAdaptationSets(mpdAttributes, mpdBaseUrls))),\n eventStream: flatten(periods.map(toEventStream))\n };\n};\n\nconst stringToMpdXml = manifestString => {\n if (manifestString === '') {\n throw new Error(errors.DASH_EMPTY_MANIFEST);\n }\n\n const parser = new _xmldom_xmldom__WEBPACK_IMPORTED_MODULE_4__.DOMParser();\n let xml;\n let mpd;\n\n try {\n xml = parser.parseFromString(manifestString, 'application/xml');\n mpd = xml && xml.documentElement.tagName === 'MPD' ? xml.documentElement : null;\n } catch (e) {// ie 11 throws on invalid xml\n }\n\n if (!mpd || mpd && mpd.getElementsByTagName('parsererror').length > 0) {\n throw new Error(errors.DASH_INVALID_XML);\n }\n\n return mpd;\n};\n\n/**\n * Parses the manifest for a UTCTiming node, returning the nodes attributes if found\n *\n * @param {string} mpd\n * XML string of the MPD manifest\n * @return {Object|null}\n * Attributes of UTCTiming node specified in the manifest. Null if none found\n */\n\nconst parseUTCTimingScheme = mpd => {\n const UTCTimingNode = findChildren(mpd, 'UTCTiming')[0];\n\n if (!UTCTimingNode) {\n return null;\n }\n\n const attributes = parseAttributes(UTCTimingNode);\n\n switch (attributes.schemeIdUri) {\n case 'urn:mpeg:dash:utc:http-head:2014':\n case 'urn:mpeg:dash:utc:http-head:2012':\n attributes.method = 'HEAD';\n break;\n\n case 'urn:mpeg:dash:utc:http-xsdate:2014':\n case 'urn:mpeg:dash:utc:http-iso:2014':\n case 'urn:mpeg:dash:utc:http-xsdate:2012':\n case 'urn:mpeg:dash:utc:http-iso:2012':\n attributes.method = 'GET';\n break;\n\n case 'urn:mpeg:dash:utc:direct:2014':\n case 'urn:mpeg:dash:utc:direct:2012':\n attributes.method = 'DIRECT';\n attributes.value = Date.parse(attributes.value);\n break;\n\n case 'urn:mpeg:dash:utc:http-ntp:2014':\n case 'urn:mpeg:dash:utc:ntp:2014':\n case 'urn:mpeg:dash:utc:sntp:2014':\n default:\n throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME);\n }\n\n return attributes;\n};\n\nconst VERSION = version;\n/*\n * Given a DASH manifest string and options, parses the DASH manifest into an object in the\n * form outputed by m3u8-parser and accepted by videojs/http-streaming.\n *\n * For live DASH manifests, if `previousManifest` is provided in options, then the newly\n * parsed DASH manifest will have its media sequence and discontinuity sequence values\n * updated to reflect its position relative to the prior manifest.\n *\n * @param {string} manifestString - the DASH manifest as a string\n * @param {options} [options] - any options\n *\n * @return {Object} the manifest object\n */\n\nconst parse = (manifestString, options = {}) => {\n const parsedManifestInfo = inheritAttributes(stringToMpdXml(manifestString), options);\n const playlists = toPlaylists(parsedManifestInfo.representationInfo);\n return toM3u8({\n dashPlaylists: playlists,\n locations: parsedManifestInfo.locations,\n contentSteering: parsedManifestInfo.contentSteeringInfo,\n sidxMapping: options.sidxMapping,\n previousManifest: options.previousManifest,\n eventStream: parsedManifestInfo.eventStream\n });\n};\n/**\n * Parses the manifest for a UTCTiming node, returning the nodes attributes if found\n *\n * @param {string} manifestString\n * XML string of the MPD manifest\n * @return {Object|null}\n * Attributes of UTCTiming node specified in the manifest. Null if none found\n */\n\n\nconst parseUTCTiming = manifestString => parseUTCTimingScheme(stringToMpdXml(manifestString));\n\n\n\n\n//# sourceURL=webpack://web/./node_modules/mpd-parser/dist/mpd-parser.es.js?")},"./node_modules/mux.js/lib/tools/parse-sidx.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var getUint64 = (__webpack_require__(/*! ../utils/numbers.js */ "./node_modules/mux.js/lib/utils/numbers.js").getUint64);\n\nvar parseSidx = function(data) {\n var view = new DataView(data.buffer, data.byteOffset, data.byteLength),\n result = {\n version: data[0],\n flags: new Uint8Array(data.subarray(1, 4)),\n references: [],\n referenceId: view.getUint32(4),\n timescale: view.getUint32(8)\n },\n i = 12;\n\n if (result.version === 0) {\n result.earliestPresentationTime = view.getUint32(i);\n result.firstOffset = view.getUint32(i + 4);\n i += 8;\n } else {\n // read 64 bits\n result.earliestPresentationTime = getUint64(data.subarray(i));\n result.firstOffset = getUint64(data.subarray(i + 8));\n i += 16;\n }\n\n i += 2; // reserved\n\n var referenceCount = view.getUint16(i);\n\n i += 2; // start of references\n\n for (; referenceCount > 0; i += 12, referenceCount--) {\n result.references.push({\n referenceType: (data[i] & 0x80) >>> 7,\n referencedSize: view.getUint32(i) & 0x7FFFFFFF,\n subsegmentDuration: view.getUint32(i + 4),\n startsWithSap: !!(data[i + 8] & 0x80),\n sapType: (data[i + 8] & 0x70) >>> 4,\n sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF\n });\n }\n\n return result;\n};\n\n\nmodule.exports = parseSidx;\n\n\n//# sourceURL=webpack://web/./node_modules/mux.js/lib/tools/parse-sidx.js?')},"./node_modules/mux.js/lib/utils/clock.js":module=>{eval("/**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\nvar\n ONE_SECOND_IN_TS = 90000, // 90kHz clock\n secondsToVideoTs,\n secondsToAudioTs,\n videoTsToSeconds,\n audioTsToSeconds,\n audioTsToVideoTs,\n videoTsToAudioTs,\n metadataTsToSeconds;\n\nsecondsToVideoTs = function(seconds) {\n return seconds * ONE_SECOND_IN_TS;\n};\n\nsecondsToAudioTs = function(seconds, sampleRate) {\n return seconds * sampleRate;\n};\n\nvideoTsToSeconds = function(timestamp) {\n return timestamp / ONE_SECOND_IN_TS;\n};\n\naudioTsToSeconds = function(timestamp, sampleRate) {\n return timestamp / sampleRate;\n};\n\naudioTsToVideoTs = function(timestamp, sampleRate) {\n return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate));\n};\n\nvideoTsToAudioTs = function(timestamp, sampleRate) {\n return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate);\n};\n\n/**\n * Adjust ID3 tag or caption timing information by the timeline pts values\n * (if keepOriginalTimestamps is false) and convert to seconds\n */\nmetadataTsToSeconds = function(timestamp, timelineStartPts, keepOriginalTimestamps) {\n return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);\n};\n\nmodule.exports = {\n ONE_SECOND_IN_TS: ONE_SECOND_IN_TS,\n secondsToVideoTs: secondsToVideoTs,\n secondsToAudioTs: secondsToAudioTs,\n videoTsToSeconds: videoTsToSeconds,\n audioTsToSeconds: audioTsToSeconds,\n audioTsToVideoTs: audioTsToVideoTs,\n videoTsToAudioTs: videoTsToAudioTs,\n metadataTsToSeconds: metadataTsToSeconds\n};\n\n\n//# sourceURL=webpack://web/./node_modules/mux.js/lib/utils/clock.js?")},"./node_modules/mux.js/lib/utils/numbers.js":module=>{eval("var MAX_UINT32 = Math.pow(2, 32);\n\nvar getUint64 = function(uint8) {\n var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);\n var value;\n\n if (dv.getBigUint64) {\n value = dv.getBigUint64(0);\n\n if (value < Number.MAX_SAFE_INTEGER) {\n return Number(value);\n }\n\n return value;\n }\n\n return (dv.getUint32(0) * MAX_UINT32) + dv.getUint32(4);\n};\n\nmodule.exports = {\n getUint64: getUint64,\n MAX_UINT32: MAX_UINT32\n};\n\n\n//# sourceURL=webpack://web/./node_modules/mux.js/lib/utils/numbers.js?")},"./node_modules/raphael/raphael.min.js":module=>{eval('!function(t,e){ true?module.exports=e():0}(window,function(){return function(t){var e={};function r(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,i){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(i,n,function(e){return t[e]}.bind(null,n));return i},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=1)}([function(t,e,r){var i,n;i=[r(2)],void 0===(n=function(t){function e(i){if(e.is(i,"function"))return r?i():t.on("raphael.DOMload",i);if(e.is(i,A))return e._engine.create[c](e,i.splice(0,3+e.is(i[0],T))).add(i);var n=Array.prototype.slice.call(arguments,0);if(e.is(n[n.length-1],"function")){var a=n.pop();return r?a.call(e._engine.create[c](e,n)):t.on("raphael.DOMload",function(){a.call(e._engine.create[c](e,n))})}return e._engine.create[c](e,arguments)}e.version="2.3.0",e.eve=t;var r,i,n=/[, ]+/,a={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},s=/\\{(\\d+)\\}/g,o="hasOwnProperty",l={doc:document,win:window},h={was:Object.prototype[o].call(l.win,"Raphael"),is:l.win.Raphael},u=function(){this.ca=this.customAttributes={}},c="apply",f="concat",p="ontouchstart"in window||window.TouchEvent||window.DocumentTouch&&document instanceof DocumentTouch,d="",g=" ",x=String,v="split",y="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[v](g),m={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},b=x.prototype.toLowerCase,_=Math,w=_.max,k=_.min,B=_.abs,C=_.pow,S=_.PI,T="number",A="array",M=Object.prototype.toString,E=(e._ISURL=/^url\\([\'"]?(.+?)[\'"]?\\)$/i,/^\\s*((#[a-f\\d]{6})|(#[a-f\\d]{3})|rgba?\\(\\s*([\\d\\.]+%?\\s*,\\s*[\\d\\.]+%?\\s*,\\s*[\\d\\.]+%?(?:\\s*,\\s*[\\d\\.]+%?)?)\\s*\\)|hsba?\\(\\s*([\\d\\.]+(?:deg|\\xb0|%)?\\s*,\\s*[\\d\\.]+%?\\s*,\\s*[\\d\\.]+(?:%?\\s*,\\s*[\\d\\.]+)?)%?\\s*\\)|hsla?\\(\\s*([\\d\\.]+(?:deg|\\xb0|%)?\\s*,\\s*[\\d\\.]+%?\\s*,\\s*[\\d\\.]+(?:%?\\s*,\\s*[\\d\\.]+)?)%?\\s*\\))\\s*$/i),N={NaN:1,Infinity:1,"-Infinity":1},L=/^(?:cubic-)?bezier\\(([^,]+),([^,]+),([^,]+),([^\\)]+)\\)/,P=_.round,z=parseFloat,F=parseInt,R=x.prototype.toUpperCase,j=e._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:\'10px "Arial"\',"font-family":\'"Arial"\',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0,class:""},I=e._availableAnimAttrs={blur:T,"clip-rect":"csv",cx:T,cy:T,fill:"colour","fill-opacity":T,"font-size":T,height:T,opacity:T,path:"path",r:T,rx:T,ry:T,stroke:"colour","stroke-opacity":T,"stroke-width":T,transform:"transform",width:T,x:T,y:T},D=/[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029]*,[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029]*/,q={hs:1,rg:1},O=/,?([achlmqrstvxz]),?/gi,V=/([achlmrqstvz])[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029,]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029]*,?[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029]*)+)/gi,W=/([rstm])[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029,]*((-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029]*,?[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029]*)+)/gi,Y=/(-?\\d*\\.?\\d*(?:e[\\-+]?\\d+)?)[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029]*,?[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029]*/gi,G=(e._radial_gradient=/^r(?:\\(([^,]+?)[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029]*,[\\x09\\x0a\\x0b\\x0c\\x0d\\x20\\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029]*([^\\)]+?)\\))?/,{}),H=function(t,e){return z(t)-z(e)},X=function(t){return t},U=e._rectPath=function(t,e,r,i,n){return n?[["M",t+n,e],["l",r-2*n,0],["a",n,n,0,0,1,n,n],["l",0,i-2*n],["a",n,n,0,0,1,-n,n],["l",2*n-r,0],["a",n,n,0,0,1,-n,-n],["l",0,2*n-i],["a",n,n,0,0,1,n,-n],["z"]]:[["M",t,e],["l",r,0],["l",0,i],["l",-r,0],["z"]]},$=function(t,e,r,i){return null==i&&(i=r),[["M",t,e],["m",0,-i],["a",r,i,0,1,1,0,2*i],["a",r,i,0,1,1,0,-2*i],["z"]]},Z=e._getPath={path:function(t){return t.attr("path")},circle:function(t){var e=t.attrs;return $(e.cx,e.cy,e.r)},ellipse:function(t){var e=t.attrs;return $(e.cx,e.cy,e.rx,e.ry)},rect:function(t){var e=t.attrs;return U(e.x,e.y,e.width,e.height,e.r)},image:function(t){var e=t.attrs;return U(e.x,e.y,e.width,e.height)},text:function(t){var e=t._getBBox();return U(e.x,e.y,e.width,e.height)},set:function(t){var e=t._getBBox();return U(e.x,e.y,e.width,e.height)}},Q=e.mapPath=function(t,e){if(!e)return t;var r,i,n,a,s,o,l;for(n=0,s=(t=Tt(t)).length;n<s;n++)for(a=1,o=(l=t[n]).length;a<o;a+=2)r=e.x(l[a],l[a+1]),i=e.y(l[a],l[a+1]),l[a]=r,l[a+1]=i;return t};if(e._g=l,e.type=l.win.SVGAngle||l.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML","VML"==e.type){var J,K=l.doc.createElement("div");if(K.innerHTML=\'<v:shape adj="1"/>\',(J=K.firstChild).style.behavior="url(#default#VML)",!J||"object"!=typeof J.adj)return e.type=d;K=null}function tt(t){if("function"==typeof t||Object(t)!==t)return t;var e=new t.constructor;for(var r in t)t[o](r)&&(e[r]=tt(t[r]));return e}e.svg=!(e.vml="VML"==e.type),e._Paper=u,e.fn=i=u.prototype=e.prototype,e._id=0,e.is=function(t,e){return"finite"==(e=b.call(e))?!N[o](+t):"array"==e?t instanceof Array:"null"==e&&null===t||e==typeof t&&null!==t||"object"==e&&t===Object(t)||"array"==e&&Array.isArray&&Array.isArray(t)||M.call(t).slice(8,-1).toLowerCase()==e},e.angle=function(t,r,i,n,a,s){if(null==a){var o=t-i,l=r-n;return o||l?(180+180*_.atan2(-l,-o)/S+360)%360:0}return e.angle(t,r,a,s)-e.angle(i,n,a,s)},e.rad=function(t){return t%360*S/180},e.deg=function(t){return Math.round(180*t/S%360*1e3)/1e3},e.snapTo=function(t,r,i){if(i=e.is(i,"finite")?i:10,e.is(t,A)){for(var n=t.length;n--;)if(B(t[n]-r)<=i)return t[n]}else{var a=r%(t=+t);if(a<i)return r-a;if(a>t-i)return r-a+t}return r};var et,rt;e.createUUID=(et=/[xy]/g,rt=function(t){var e=16*_.random()|0;return("x"==t?e:3&e|8).toString(16)},function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(et,rt).toUpperCase()});e.setWindow=function(r){t("raphael.setWindow",e,l.win,r),l.win=r,l.doc=l.win.document,e._engine.initWin&&e._engine.initWin(l.win)};var it=function(t){if(e.vml){var r,i=/^\\s+|\\s+$/g;try{var n=new ActiveXObject("htmlfile");n.write("<body>"),n.close(),r=n.body}catch(t){r=createPopup().document.body}var a=r.createTextRange();it=ht(function(t){try{r.style.color=x(t).replace(i,d);var e=a.queryCommandValue("ForeColor");return"#"+("000000"+(e=(255&e)<<16|65280&e|(16711680&e)>>>16).toString(16)).slice(-6)}catch(t){return"none"}})}else{var s=l.doc.createElement("i");s.title="Raphaël Colour Picker",s.style.display="none",l.doc.body.appendChild(s),it=ht(function(t){return s.style.color=t,l.doc.defaultView.getComputedStyle(s,d).getPropertyValue("color")})}return it(t)},nt=function(){return"hsb("+[this.h,this.s,this.b]+")"},at=function(){return"hsl("+[this.h,this.s,this.l]+")"},st=function(){return this.hex},ot=function(t,r,i){if(null==r&&e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(i=t.b,r=t.g,t=t.r),null==r&&e.is(t,"string")){var n=e.getRGB(t);t=n.r,r=n.g,i=n.b}return(t>1||r>1||i>1)&&(t/=255,r/=255,i/=255),[t,r,i]},lt=function(t,r,i,n){var a={r:t*=255,g:r*=255,b:i*=255,hex:e.rgb(t,r,i),toString:st};return e.is(n,"finite")&&(a.opacity=n),a};function ht(t,e,r){return function i(){var n=Array.prototype.slice.call(arguments,0),a=n.join("␀"),s=i.cache=i.cache||{},l=i.count=i.count||[];return s[o](a)?(function(t,e){for(var r=0,i=t.length;r<i;r++)if(t[r]===e)return t.push(t.splice(r,1)[0])}(l,a),r?r(s[a]):s[a]):(l.length>=1e3&&delete s[l.shift()],l.push(a),s[a]=t[c](e,n),r?r(s[a]):s[a])}}e.color=function(t){var r;return e.is(t,"object")&&"h"in t&&"s"in t&&"b"in t?(r=e.hsb2rgb(t),t.r=r.r,t.g=r.g,t.b=r.b,t.hex=r.hex):e.is(t,"object")&&"h"in t&&"s"in t&&"l"in t?(r=e.hsl2rgb(t),t.r=r.r,t.g=r.g,t.b=r.b,t.hex=r.hex):(e.is(t,"string")&&(t=e.getRGB(t)),e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t?(r=e.rgb2hsl(t),t.h=r.h,t.s=r.s,t.l=r.l,r=e.rgb2hsb(t),t.v=r.b):(t={hex:"none"}).r=t.g=t.b=t.h=t.s=t.v=t.l=-1),t.toString=st,t},e.hsb2rgb=function(t,e,r,i){var n,a,s,o,l;return this.is(t,"object")&&"h"in t&&"s"in t&&"b"in t&&(r=t.b,e=t.s,i=t.o,t=t.h),o=(l=r*e)*(1-B((t=(t*=360)%360/60)%2-1)),n=a=s=r-l,lt(n+=[l,o,0,0,o,l][t=~~t],a+=[o,l,l,o,0,0][t],s+=[0,0,o,l,l,o][t],i)},e.hsl2rgb=function(t,e,r,i){var n,a,s,o,l;return this.is(t,"object")&&"h"in t&&"s"in t&&"l"in t&&(r=t.l,e=t.s,t=t.h),(t>1||e>1||r>1)&&(t/=360,e/=100,r/=100),o=(l=2*e*(r<.5?r:1-r))*(1-B((t=(t*=360)%360/60)%2-1)),n=a=s=r-l/2,lt(n+=[l,o,0,0,o,l][t=~~t],a+=[o,l,l,o,0,0][t],s+=[0,0,o,l,l,o][t],i)},e.rgb2hsb=function(t,e,r){var i,n;return t=(r=ot(t,e,r))[0],e=r[1],r=r[2],{h:((0==(n=(i=w(t,e,r))-k(t,e,r))?null:i==t?(e-r)/n:i==e?(r-t)/n+2:(t-e)/n+4)+360)%6*60/360,s:0==n?0:n/i,b:i,toString:nt}},e.rgb2hsl=function(t,e,r){var i,n,a,s;return t=(r=ot(t,e,r))[0],e=r[1],r=r[2],i=((n=w(t,e,r))+(a=k(t,e,r)))/2,{h:((0==(s=n-a)?null:n==t?(e-r)/s:n==e?(r-t)/s+2:(t-e)/s+4)+360)%6*60/360,s:0==s?0:i<.5?s/(2*i):s/(2-2*i),l:i,toString:at}},e._path2string=function(){return this.join(",").replace(O,"$1")};e._preload=function(t,e){var r=l.doc.createElement("img");r.style.cssText="position:absolute;left:-9999em;top:-9999em",r.onload=function(){e.call(this),this.onload=null,l.doc.body.removeChild(this)},r.onerror=function(){l.doc.body.removeChild(this)},l.doc.body.appendChild(r),r.src=t};function ut(){return this.hex}function ct(t,e){for(var r=[],i=0,n=t.length;n-2*!e>i;i+=2){var a=[{x:+t[i-2],y:+t[i-1]},{x:+t[i],y:+t[i+1]},{x:+t[i+2],y:+t[i+3]},{x:+t[i+4],y:+t[i+5]}];e?i?n-4==i?a[3]={x:+t[0],y:+t[1]}:n-2==i&&(a[2]={x:+t[0],y:+t[1]},a[3]={x:+t[2],y:+t[3]}):a[0]={x:+t[n-2],y:+t[n-1]}:n-4==i?a[3]=a[2]:i||(a[0]={x:+t[i],y:+t[i+1]}),r.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return r}e.getRGB=ht(function(t){if(!t||(t=x(t)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:ut};if("none"==t)return{r:-1,g:-1,b:-1,hex:"none",toString:ut};!q[o](t.toLowerCase().substring(0,2))&&"#"!=t.charAt()&&(t=it(t));var r,i,n,a,s,l,h=t.match(E);return h?(h[2]&&(n=F(h[2].substring(5),16),i=F(h[2].substring(3,5),16),r=F(h[2].substring(1,3),16)),h[3]&&(n=F((s=h[3].charAt(3))+s,16),i=F((s=h[3].charAt(2))+s,16),r=F((s=h[3].charAt(1))+s,16)),h[4]&&(l=h[4][v](D),r=z(l[0]),"%"==l[0].slice(-1)&&(r*=2.55),i=z(l[1]),"%"==l[1].slice(-1)&&(i*=2.55),n=z(l[2]),"%"==l[2].slice(-1)&&(n*=2.55),"rgba"==h[1].toLowerCase().slice(0,4)&&(a=z(l[3])),l[3]&&"%"==l[3].slice(-1)&&(a/=100)),h[5]?(l=h[5][v](D),r=z(l[0]),"%"==l[0].slice(-1)&&(r*=2.55),i=z(l[1]),"%"==l[1].slice(-1)&&(i*=2.55),n=z(l[2]),"%"==l[2].slice(-1)&&(n*=2.55),("deg"==l[0].slice(-3)||"°"==l[0].slice(-1))&&(r/=360),"hsba"==h[1].toLowerCase().slice(0,4)&&(a=z(l[3])),l[3]&&"%"==l[3].slice(-1)&&(a/=100),e.hsb2rgb(r,i,n,a)):h[6]?(l=h[6][v](D),r=z(l[0]),"%"==l[0].slice(-1)&&(r*=2.55),i=z(l[1]),"%"==l[1].slice(-1)&&(i*=2.55),n=z(l[2]),"%"==l[2].slice(-1)&&(n*=2.55),("deg"==l[0].slice(-3)||"°"==l[0].slice(-1))&&(r/=360),"hsla"==h[1].toLowerCase().slice(0,4)&&(a=z(l[3])),l[3]&&"%"==l[3].slice(-1)&&(a/=100),e.hsl2rgb(r,i,n,a)):((h={r:r,g:i,b:n,toString:ut}).hex="#"+(16777216|n|i<<8|r<<16).toString(16).slice(1),e.is(a,"finite")&&(h.opacity=a),h)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:ut}},e),e.hsb=ht(function(t,r,i){return e.hsb2rgb(t,r,i).hex}),e.hsl=ht(function(t,r,i){return e.hsl2rgb(t,r,i).hex}),e.rgb=ht(function(t,e,r){function i(t){return t+.5|0}return"#"+(16777216|i(r)|i(e)<<8|i(t)<<16).toString(16).slice(1)}),e.getColor=function(t){var e=this.getColor.start=this.getColor.start||{h:0,s:1,b:t||.75},r=this.hsb2rgb(e.h,e.s,e.b);return e.h+=.075,e.h>1&&(e.h=0,e.s-=.2,e.s<=0&&(this.getColor.start={h:0,s:1,b:e.b})),r.hex},e.getColor.reset=function(){delete this.start},e.parsePathString=function(t){if(!t)return null;var r=ft(t);if(r.arr)return mt(r.arr);var i={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},n=[];return e.is(t,A)&&e.is(t[0],A)&&(n=mt(t)),n.length||x(t).replace(V,function(t,e,r){var a=[],s=e.toLowerCase();if(r.replace(Y,function(t,e){e&&a.push(+e)}),"m"==s&&a.length>2&&(n.push([e][f](a.splice(0,2))),s="l",e="m"==e?"l":"L"),"r"==s)n.push([e][f](a));else for(;a.length>=i[s]&&(n.push([e][f](a.splice(0,i[s]))),i[s]););}),n.toString=e._path2string,r.arr=mt(n),n},e.parseTransformString=ht(function(t){if(!t)return null;var r=[];return e.is(t,A)&&e.is(t[0],A)&&(r=mt(t)),r.length||x(t).replace(W,function(t,e,i){var n=[];b.call(e);i.replace(Y,function(t,e){e&&n.push(+e)}),r.push([e][f](n))}),r.toString=e._path2string,r},this,function(t){if(!t)return t;for(var e=[],r=0;r<t.length;r++){for(var i=[],n=0;n<t[r].length;n++)i.push(t[r][n]);e.push(i)}return e});var ft=function(t){var e=ft.ps=ft.ps||{};return e[t]?e[t].sleep=100:e[t]={sleep:100},setTimeout(function(){for(var r in e)e[o](r)&&r!=t&&(e[r].sleep--,!e[r].sleep&&delete e[r])}),e[t]};function pt(t,e,r,i,n){return t*(t*(-3*e+9*r-9*i+3*n)+6*e-12*r+6*i)-3*e+3*r}function dt(t,e,r,i,n,a,s,o,l){null==l&&(l=1);for(var h=(l=l>1?1:l<0?0:l)/2,u=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],c=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,p=0;p<12;p++){var d=h*u[p]+h,g=pt(d,t,r,n,s),x=pt(d,e,i,a,o),v=g*g+x*x;f+=c[p]*_.sqrt(v)}return h*f}function gt(t,e,r,i,n,a,s,o){if(!(w(t,r)<k(n,s)||k(t,r)>w(n,s)||w(e,i)<k(a,o)||k(e,i)>w(a,o))){var l=(t-r)*(a-o)-(e-i)*(n-s);if(l){var h=((t*i-e*r)*(n-s)-(t-r)*(n*o-a*s))/l,u=((t*i-e*r)*(a-o)-(e-i)*(n*o-a*s))/l,c=+h.toFixed(2),f=+u.toFixed(2);if(!(c<+k(t,r).toFixed(2)||c>+w(t,r).toFixed(2)||c<+k(n,s).toFixed(2)||c>+w(n,s).toFixed(2)||f<+k(e,i).toFixed(2)||f>+w(e,i).toFixed(2)||f<+k(a,o).toFixed(2)||f>+w(a,o).toFixed(2)))return{x:h,y:u}}}}function xt(t,r,i){var n=e.bezierBBox(t),a=e.bezierBBox(r);if(!e.isBBoxIntersect(n,a))return i?0:[];for(var s=dt.apply(0,t),o=dt.apply(0,r),l=w(~~(s/5),1),h=w(~~(o/5),1),u=[],c=[],f={},p=i?0:[],d=0;d<l+1;d++){var g=e.findDotsAtSegment.apply(e,t.concat(d/l));u.push({x:g.x,y:g.y,t:d/l})}for(d=0;d<h+1;d++)g=e.findDotsAtSegment.apply(e,r.concat(d/h)),c.push({x:g.x,y:g.y,t:d/h});for(d=0;d<l;d++)for(var x=0;x<h;x++){var v=u[d],y=u[d+1],m=c[x],b=c[x+1],_=B(y.x-v.x)<.001?"y":"x",C=B(b.x-m.x)<.001?"y":"x",S=gt(v.x,v.y,y.x,y.y,m.x,m.y,b.x,b.y);if(S){if(f[S.x.toFixed(4)]==S.y.toFixed(4))continue;f[S.x.toFixed(4)]=S.y.toFixed(4);var T=v.t+B((S[_]-v[_])/(y[_]-v[_]))*(y.t-v.t),A=m.t+B((S[C]-m[C])/(b[C]-m[C]))*(b.t-m.t);T>=0&&T<=1.001&&A>=0&&A<=1.001&&(i?p++:p.push({x:S.x,y:S.y,t1:k(T,1),t2:k(A,1)}))}}return p}function vt(t,r,i){t=e._path2curve(t),r=e._path2curve(r);for(var n,a,s,o,l,h,u,c,f,p,d=i?0:[],g=0,x=t.length;g<x;g++){var v=t[g];if("M"==v[0])n=l=v[1],a=h=v[2];else{"C"==v[0]?(f=[n,a].concat(v.slice(1)),n=f[6],a=f[7]):(f=[n,a,n,a,l,h,l,h],n=l,a=h);for(var y=0,m=r.length;y<m;y++){var b=r[y];if("M"==b[0])s=u=b[1],o=c=b[2];else{"C"==b[0]?(p=[s,o].concat(b.slice(1)),s=p[6],o=p[7]):(p=[s,o,s,o,u,c,u,c],s=u,o=c);var _=xt(f,p,i);if(i)d+=_;else{for(var w=0,k=_.length;w<k;w++)_[w].segment1=g,_[w].segment2=y,_[w].bez1=f,_[w].bez2=p;d=d.concat(_)}}}}}return d}e.findDotsAtSegment=function(t,e,r,i,n,a,s,o,l){var h=1-l,u=C(h,3),c=C(h,2),f=l*l,p=f*l,d=u*t+3*c*l*r+3*h*l*l*n+p*s,g=u*e+3*c*l*i+3*h*l*l*a+p*o,x=t+2*l*(r-t)+f*(n-2*r+t),v=e+2*l*(i-e)+f*(a-2*i+e),y=r+2*l*(n-r)+f*(s-2*n+r),m=i+2*l*(a-i)+f*(o-2*a+i),b=h*t+l*r,w=h*e+l*i,k=h*n+l*s,B=h*a+l*o,T=90-180*_.atan2(x-y,v-m)/S;return(x>y||v<m)&&(T+=180),{x:d,y:g,m:{x:x,y:v},n:{x:y,y:m},start:{x:b,y:w},end:{x:k,y:B},alpha:T}},e.bezierBBox=function(t,r,i,n,a,s,o,l){e.is(t,"array")||(t=[t,r,i,n,a,s,o,l]);var h=St.apply(null,t);return{x:h.min.x,y:h.min.y,x2:h.max.x,y2:h.max.y,width:h.max.x-h.min.x,height:h.max.y-h.min.y}},e.isPointInsideBBox=function(t,e,r){return e>=t.x&&e<=t.x2&&r>=t.y&&r<=t.y2},e.isBBoxIntersect=function(t,r){var i=e.isPointInsideBBox;return i(r,t.x,t.y)||i(r,t.x2,t.y)||i(r,t.x,t.y2)||i(r,t.x2,t.y2)||i(t,r.x,r.y)||i(t,r.x2,r.y)||i(t,r.x,r.y2)||i(t,r.x2,r.y2)||(t.x<r.x2&&t.x>r.x||r.x<t.x2&&r.x>t.x)&&(t.y<r.y2&&t.y>r.y||r.y<t.y2&&r.y>t.y)},e.pathIntersection=function(t,e){return vt(t,e)},e.pathIntersectionNumber=function(t,e){return vt(t,e,1)},e.isPointInsidePath=function(t,r,i){var n=e.pathBBox(t);return e.isPointInsideBBox(n,r,i)&&vt(t,[["M",r,i],["H",n.x2+10]],1)%2==1},e._removedFactory=function(e){return function(){t("raphael.log",null,"Raphaël: you are calling to method “"+e+"” of removed object",e)}};var yt=e.pathBBox=function(t){var e=ft(t);if(e.bbox)return tt(e.bbox);if(!t)return{x:0,y:0,width:0,height:0,x2:0,y2:0};for(var r,i=0,n=0,a=[],s=[],o=0,l=(t=Tt(t)).length;o<l;o++)if("M"==(r=t[o])[0])i=r[1],n=r[2],a.push(i),s.push(n);else{var h=St(i,n,r[1],r[2],r[3],r[4],r[5],r[6]);a=a[f](h.min.x,h.max.x),s=s[f](h.min.y,h.max.y),i=r[5],n=r[6]}var u=k[c](0,a),p=k[c](0,s),d=w[c](0,a),g=w[c](0,s),x=d-u,v=g-p,y={x:u,y:p,x2:d,y2:g,width:x,height:v,cx:u+x/2,cy:p+v/2};return e.bbox=tt(y),y},mt=function(t){var r=tt(t);return r.toString=e._path2string,r},bt=e._pathToRelative=function(t){var r=ft(t);if(r.rel)return mt(r.rel);e.is(t,A)&&e.is(t&&t[0],A)||(t=e.parsePathString(t));var i=[],n=0,a=0,s=0,o=0,l=0;"M"==t[0][0]&&(s=n=t[0][1],o=a=t[0][2],l++,i.push(["M",n,a]));for(var h=l,u=t.length;h<u;h++){var c=i[h]=[],f=t[h];if(f[0]!=b.call(f[0]))switch(c[0]=b.call(f[0]),c[0]){case"a":c[1]=f[1],c[2]=f[2],c[3]=f[3],c[4]=f[4],c[5]=f[5],c[6]=+(f[6]-n).toFixed(3),c[7]=+(f[7]-a).toFixed(3);break;case"v":c[1]=+(f[1]-a).toFixed(3);break;case"m":s=f[1],o=f[2];default:for(var p=1,d=f.length;p<d;p++)c[p]=+(f[p]-(p%2?n:a)).toFixed(3)}else{c=i[h]=[],"m"==f[0]&&(s=f[1]+n,o=f[2]+a);for(var g=0,x=f.length;g<x;g++)i[h][g]=f[g]}var v=i[h].length;switch(i[h][0]){case"z":n=s,a=o;break;case"h":n+=+i[h][v-1];break;case"v":a+=+i[h][v-1];break;default:n+=+i[h][v-2],a+=+i[h][v-1]}}return i.toString=e._path2string,r.rel=mt(i),i},_t=e._pathToAbsolute=function(t){var r=ft(t);if(r.abs)return mt(r.abs);if(e.is(t,A)&&e.is(t&&t[0],A)||(t=e.parsePathString(t)),!t||!t.length)return[["M",0,0]];var i=[],n=0,a=0,s=0,o=0,l=0;"M"==t[0][0]&&(s=n=+t[0][1],o=a=+t[0][2],l++,i[0]=["M",n,a]);for(var h,u,c=3==t.length&&"M"==t[0][0]&&"R"==t[1][0].toUpperCase()&&"Z"==t[2][0].toUpperCase(),p=l,d=t.length;p<d;p++){if(i.push(h=[]),(u=t[p])[0]!=R.call(u[0]))switch(h[0]=R.call(u[0]),h[0]){case"A":h[1]=u[1],h[2]=u[2],h[3]=u[3],h[4]=u[4],h[5]=u[5],h[6]=+(u[6]+n),h[7]=+(u[7]+a);break;case"V":h[1]=+u[1]+a;break;case"H":h[1]=+u[1]+n;break;case"R":for(var g=[n,a][f](u.slice(1)),x=2,v=g.length;x<v;x++)g[x]=+g[x]+n,g[++x]=+g[x]+a;i.pop(),i=i[f](ct(g,c));break;case"M":s=+u[1]+n,o=+u[2]+a;default:for(x=1,v=u.length;x<v;x++)h[x]=+u[x]+(x%2?n:a)}else if("R"==u[0])g=[n,a][f](u.slice(1)),i.pop(),i=i[f](ct(g,c)),h=["R"][f](u.slice(-2));else for(var y=0,m=u.length;y<m;y++)h[y]=u[y];switch(h[0]){case"Z":n=s,a=o;break;case"H":n=h[1];break;case"V":a=h[1];break;case"M":s=h[h.length-2],o=h[h.length-1];default:n=h[h.length-2],a=h[h.length-1]}}return i.toString=e._path2string,r.abs=mt(i),i},wt=function(t,e,r,i){return[t,e,r,i,r,i]},kt=function(t,e,r,i,n,a){return[1/3*t+2/3*r,1/3*e+2/3*i,1/3*n+2/3*r,1/3*a+2/3*i,n,a]},Bt=function(t,e,r,i,n,a,s,o,l,h){var u,c=120*S/180,p=S/180*(+n||0),d=[],g=ht(function(t,e,r){return{x:t*_.cos(r)-e*_.sin(r),y:t*_.sin(r)+e*_.cos(r)}});if(h)A=h[0],M=h[1],C=h[2],T=h[3];else{t=(u=g(t,e,-p)).x,e=u.y,o=(u=g(o,l,-p)).x,l=u.y;_.cos(S/180*n),_.sin(S/180*n);var x=(t-o)/2,y=(e-l)/2,m=x*x/(r*r)+y*y/(i*i);m>1&&(r*=m=_.sqrt(m),i*=m);var b=r*r,w=i*i,k=(a==s?-1:1)*_.sqrt(B((b*w-b*y*y-w*x*x)/(b*y*y+w*x*x))),C=k*r*y/i+(t+o)/2,T=k*-i*x/r+(e+l)/2,A=_.asin(((e-T)/i).toFixed(9)),M=_.asin(((l-T)/i).toFixed(9));(A=t<C?S-A:A)<0&&(A=2*S+A),(M=o<C?S-M:M)<0&&(M=2*S+M),s&&A>M&&(A-=2*S),!s&&M>A&&(M-=2*S)}var E=M-A;if(B(E)>c){var N=M,L=o,P=l;M=A+c*(s&&M>A?1:-1),o=C+r*_.cos(M),l=T+i*_.sin(M),d=Bt(o,l,r,i,n,0,s,L,P,[M,N,C,T])}E=M-A;var z=_.cos(A),F=_.sin(A),R=_.cos(M),j=_.sin(M),I=_.tan(E/4),D=4/3*r*I,q=4/3*i*I,O=[t,e],V=[t+D*F,e-q*z],W=[o+D*j,l-q*R],Y=[o,l];if(V[0]=2*O[0]-V[0],V[1]=2*O[1]-V[1],h)return[V,W,Y][f](d);for(var G=[],H=0,X=(d=[V,W,Y][f](d).join()[v](",")).length;H<X;H++)G[H]=H%2?g(d[H-1],d[H],p).y:g(d[H],d[H+1],p).x;return G},Ct=function(t,e,r,i,n,a,s,o,l){var h=1-l;return{x:C(h,3)*t+3*C(h,2)*l*r+3*h*l*l*n+C(l,3)*s,y:C(h,3)*e+3*C(h,2)*l*i+3*h*l*l*a+C(l,3)*o}},St=ht(function(t,e,r,i,n,a,s,o){var l,h=n-2*r+t-(s-2*n+r),u=2*(r-t)-2*(n-r),f=t-r,p=(-u+_.sqrt(u*u-4*h*f))/2/h,d=(-u-_.sqrt(u*u-4*h*f))/2/h,g=[e,o],x=[t,s];return B(p)>"1e12"&&(p=.5),B(d)>"1e12"&&(d=.5),p>0&&p<1&&(l=Ct(t,e,r,i,n,a,s,o,p),x.push(l.x),g.push(l.y)),d>0&&d<1&&(l=Ct(t,e,r,i,n,a,s,o,d),x.push(l.x),g.push(l.y)),h=a-2*i+e-(o-2*a+i),f=e-i,p=(-(u=2*(i-e)-2*(a-i))+_.sqrt(u*u-4*h*f))/2/h,d=(-u-_.sqrt(u*u-4*h*f))/2/h,B(p)>"1e12"&&(p=.5),B(d)>"1e12"&&(d=.5),p>0&&p<1&&(l=Ct(t,e,r,i,n,a,s,o,p),x.push(l.x),g.push(l.y)),d>0&&d<1&&(l=Ct(t,e,r,i,n,a,s,o,d),x.push(l.x),g.push(l.y)),{min:{x:k[c](0,x),y:k[c](0,g)},max:{x:w[c](0,x),y:w[c](0,g)}}}),Tt=e._path2curve=ht(function(t,e){var r=!e&&ft(t);if(!e&&r.curve)return mt(r.curve);for(var i=_t(t),n=e&&_t(e),a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=function(t,e,r){var i,n;if(!t)return["C",e.x,e.y,e.x,e.y,e.x,e.y];switch(!(t[0]in{T:1,Q:1})&&(e.qx=e.qy=null),t[0]){case"M":e.X=t[1],e.Y=t[2];break;case"A":t=["C"][f](Bt[c](0,[e.x,e.y][f](t.slice(1))));break;case"S":"C"==r||"S"==r?(i=2*e.x-e.bx,n=2*e.y-e.by):(i=e.x,n=e.y),t=["C",i,n][f](t.slice(1));break;case"T":"Q"==r||"T"==r?(e.qx=2*e.x-e.qx,e.qy=2*e.y-e.qy):(e.qx=e.x,e.qy=e.y),t=["C"][f](kt(e.x,e.y,e.qx,e.qy,t[1],t[2]));break;case"Q":e.qx=t[1],e.qy=t[2],t=["C"][f](kt(e.x,e.y,t[1],t[2],t[3],t[4]));break;case"L":t=["C"][f](wt(e.x,e.y,t[1],t[2]));break;case"H":t=["C"][f](wt(e.x,e.y,t[1],e.y));break;case"V":t=["C"][f](wt(e.x,e.y,e.x,t[1]));break;case"Z":t=["C"][f](wt(e.x,e.y,e.X,e.Y))}return t},l=function(t,e){if(t[e].length>7){t[e].shift();for(var r=t[e];r.length;)u[e]="A",n&&(p[e]="A"),t.splice(e++,0,["C"][f](r.splice(0,6)));t.splice(e,1),v=w(i.length,n&&n.length||0)}},h=function(t,e,r,a,s){t&&e&&"M"==t[s][0]&&"M"!=e[s][0]&&(e.splice(s,0,["M",a.x,a.y]),r.bx=0,r.by=0,r.x=t[s][1],r.y=t[s][2],v=w(i.length,n&&n.length||0))},u=[],p=[],d="",g="",x=0,v=w(i.length,n&&n.length||0);x<v;x++){i[x]&&(d=i[x][0]),"C"!=d&&(u[x]=d,x&&(g=u[x-1])),i[x]=o(i[x],a,g),"A"!=u[x]&&"C"==d&&(u[x]="C"),l(i,x),n&&(n[x]&&(d=n[x][0]),"C"!=d&&(p[x]=d,x&&(g=p[x-1])),n[x]=o(n[x],s,g),"A"!=p[x]&&"C"==d&&(p[x]="C"),l(n,x)),h(i,n,a,s,x),h(n,i,s,a,x);var y=i[x],m=n&&n[x],b=y.length,_=n&&m.length;a.x=y[b-2],a.y=y[b-1],a.bx=z(y[b-4])||a.x,a.by=z(y[b-3])||a.y,s.bx=n&&(z(m[_-4])||s.x),s.by=n&&(z(m[_-3])||s.y),s.x=n&&m[_-2],s.y=n&&m[_-1]}return n||(r.curve=mt(i)),n?[i,n]:i},null,mt),At=(e._parseDots=ht(function(t){for(var r=[],i=0,n=t.length;i<n;i++){var a={},s=t[i].match(/^([^:]*):?([\\d\\.]*)/);if(a.color=e.getRGB(s[1]),a.color.error)return null;a.opacity=a.color.opacity,a.color=a.color.hex,s[2]&&(a.offset=s[2]+"%"),r.push(a)}for(i=1,n=r.length-1;i<n;i++)if(!r[i].offset){for(var o=z(r[i-1].offset||0),l=0,h=i+1;h<n;h++)if(r[h].offset){l=r[h].offset;break}l||(l=100,h=n);for(var u=((l=z(l))-o)/(h-i+1);i<h;i++)o+=u,r[i].offset=o+"%"}return r}),e._tear=function(t,e){t==e.top&&(e.top=t.prev),t==e.bottom&&(e.bottom=t.next),t.next&&(t.next.prev=t.prev),t.prev&&(t.prev.next=t.next)}),Mt=(e._tofront=function(t,e){e.top!==t&&(At(t,e),t.next=null,t.prev=e.top,e.top.next=t,e.top=t)},e._toback=function(t,e){e.bottom!==t&&(At(t,e),t.next=e.bottom,t.prev=null,e.bottom.prev=t,e.bottom=t)},e._insertafter=function(t,e,r){At(t,r),e==r.top&&(r.top=t),e.next&&(e.next.prev=t),t.next=e.next,t.prev=e,e.next=t},e._insertbefore=function(t,e,r){At(t,r),e==r.bottom&&(r.bottom=t),e.prev&&(e.prev.next=t),t.prev=e.prev,e.prev=t,t.next=e},e.toMatrix=function(t,e){var r=yt(t),i={_:{transform:d},getBBox:function(){return r}};return Et(i,e),i.matrix}),Et=(e.transformPath=function(t,e){return Q(t,Mt(t,e))},e._extractTransform=function(t,r){if(null==r)return t._.transform;r=x(r).replace(/\\.{3}|\\u2026/g,t._.transform||d);var i,n,a=e.parseTransformString(r),s=0,o=1,l=1,h=t._,u=new Pt;if(h.transform=a||[],a)for(var c=0,f=a.length;c<f;c++){var p,g,v,y,m,b=a[c],_=b.length,w=x(b[0]).toLowerCase(),k=b[0]!=w,B=k?u.invert():0;"t"==w&&3==_?k?(p=B.x(0,0),g=B.y(0,0),v=B.x(b[1],b[2]),y=B.y(b[1],b[2]),u.translate(v-p,y-g)):u.translate(b[1],b[2]):"r"==w?2==_?(m=m||t.getBBox(1),u.rotate(b[1],m.x+m.width/2,m.y+m.height/2),s+=b[1]):4==_&&(k?(v=B.x(b[2],b[3]),y=B.y(b[2],b[3]),u.rotate(b[1],v,y)):u.rotate(b[1],b[2],b[3]),s+=b[1]):"s"==w?2==_||3==_?(m=m||t.getBBox(1),u.scale(b[1],b[_-1],m.x+m.width/2,m.y+m.height/2),o*=b[1],l*=b[_-1]):5==_&&(k?(v=B.x(b[3],b[4]),y=B.y(b[3],b[4]),u.scale(b[1],b[2],v,y)):u.scale(b[1],b[2],b[3],b[4]),o*=b[1],l*=b[2]):"m"==w&&7==_&&u.add(b[1],b[2],b[3],b[4],b[5],b[6]),h.dirtyT=1,t.matrix=u}t.matrix=u,h.sx=o,h.sy=l,h.deg=s,h.dx=i=u.e,h.dy=n=u.f,1==o&&1==l&&!s&&h.bbox?(h.bbox.x+=+i,h.bbox.y+=+n):h.dirtyT=1}),Nt=function(t){var e=t[0];switch(e.toLowerCase()){case"t":return[e,0,0];case"m":return[e,1,0,0,1,0,0];case"r":return 4==t.length?[e,0,t[2],t[3]]:[e,0];case"s":return 5==t.length?[e,1,1,t[3],t[4]]:3==t.length?[e,1,1]:[e,1]}},Lt=e._equaliseTransform=function(t,r){r=x(r).replace(/\\.{3}|\\u2026/g,t),t=e.parseTransformString(t)||[],r=e.parseTransformString(r)||[];for(var i,n,a,s,o=w(t.length,r.length),l=[],h=[],u=0;u<o;u++){if(a=t[u]||Nt(r[u]),s=r[u]||Nt(a),a[0]!=s[0]||"r"==a[0].toLowerCase()&&(a[2]!=s[2]||a[3]!=s[3])||"s"==a[0].toLowerCase()&&(a[3]!=s[3]||a[4]!=s[4]))return;for(l[u]=[],h[u]=[],i=0,n=w(a.length,s.length);i<n;i++)i in a&&(l[u][i]=a[i]),i in s&&(h[u][i]=s[i])}return{from:l,to:h}};function Pt(t,e,r,i,n,a){null!=t?(this.a=+t,this.b=+e,this.c=+r,this.d=+i,this.e=+n,this.f=+a):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}e._getContainer=function(t,r,i,n){var a;if(null!=(a=null!=n||e.is(t,"object")?t:l.doc.getElementById(t)))return a.tagName?null==r?{container:a,width:a.style.pixelWidth||a.offsetWidth,height:a.style.pixelHeight||a.offsetHeight}:{container:a,width:r,height:i}:{container:1,x:t,y:r,width:i,height:n}},e.pathToRelative=bt,e._engine={},e.path2curve=Tt,e.matrix=function(t,e,r,i,n,a){return new Pt(t,e,r,i,n,a)},function(t){function r(t){return t[0]*t[0]+t[1]*t[1]}function i(t){var e=_.sqrt(r(t));t[0]&&(t[0]/=e),t[1]&&(t[1]/=e)}t.add=function(t,e,r,i,n,a){var s,o,l,h,u=[[],[],[]],c=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],f=[[t,r,n],[e,i,a],[0,0,1]];for(t&&t instanceof Pt&&(f=[[t.a,t.c,t.e],[t.b,t.d,t.f],[0,0,1]]),s=0;s<3;s++)for(o=0;o<3;o++){for(h=0,l=0;l<3;l++)h+=c[s][l]*f[l][o];u[s][o]=h}this.a=u[0][0],this.b=u[1][0],this.c=u[0][1],this.d=u[1][1],this.e=u[0][2],this.f=u[1][2]},t.invert=function(){var t=this,e=t.a*t.d-t.b*t.c;return new Pt(t.d/e,-t.b/e,-t.c/e,t.a/e,(t.c*t.f-t.d*t.e)/e,(t.b*t.e-t.a*t.f)/e)},t.clone=function(){return new Pt(this.a,this.b,this.c,this.d,this.e,this.f)},t.translate=function(t,e){this.add(1,0,0,1,t,e)},t.scale=function(t,e,r,i){null==e&&(e=t),(r||i)&&this.add(1,0,0,1,r,i),this.add(t,0,0,e,0,0),(r||i)&&this.add(1,0,0,1,-r,-i)},t.rotate=function(t,r,i){t=e.rad(t),r=r||0,i=i||0;var n=+_.cos(t).toFixed(9),a=+_.sin(t).toFixed(9);this.add(n,a,-a,n,r,i),this.add(1,0,0,1,-r,-i)},t.x=function(t,e){return t*this.a+e*this.c+this.e},t.y=function(t,e){return t*this.b+e*this.d+this.f},t.get=function(t){return+this[x.fromCharCode(97+t)].toFixed(4)},t.toString=function(){return e.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},t.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod=\'auto expand\')"},t.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},t.split=function(){var t={};t.dx=this.e,t.dy=this.f;var n=[[this.a,this.c],[this.b,this.d]];t.scalex=_.sqrt(r(n[0])),i(n[0]),t.shear=n[0][0]*n[1][0]+n[0][1]*n[1][1],n[1]=[n[1][0]-n[0][0]*t.shear,n[1][1]-n[0][1]*t.shear],t.scaley=_.sqrt(r(n[1])),i(n[1]),t.shear/=t.scaley;var a=-n[0][1],s=n[1][1];return s<0?(t.rotate=e.deg(_.acos(s)),a<0&&(t.rotate=360-t.rotate)):t.rotate=e.deg(_.asin(a)),t.isSimple=!(+t.shear.toFixed(9)||t.scalex.toFixed(9)!=t.scaley.toFixed(9)&&t.rotate),t.isSuperSimple=!+t.shear.toFixed(9)&&t.scalex.toFixed(9)==t.scaley.toFixed(9)&&!t.rotate,t.noRotation=!+t.shear.toFixed(9)&&!t.rotate,t},t.toTransformString=function(t){var e=t||this[v]();return e.isSimple?(e.scalex=+e.scalex.toFixed(4),e.scaley=+e.scaley.toFixed(4),e.rotate=+e.rotate.toFixed(4),(e.dx||e.dy?"t"+[e.dx,e.dy]:d)+(1!=e.scalex||1!=e.scaley?"s"+[e.scalex,e.scaley,0,0]:d)+(e.rotate?"r"+[e.rotate,0,0]:d)):"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(Pt.prototype);for(var zt=function(){this.returnValue=!1},Ft=function(){return this.originalEvent.preventDefault()},Rt=function(){this.cancelBubble=!0},jt=function(){return this.originalEvent.stopPropagation()},It=function(t){var e=l.doc.documentElement.scrollTop||l.doc.body.scrollTop,r=l.doc.documentElement.scrollLeft||l.doc.body.scrollLeft;return{x:t.clientX+r,y:t.clientY+e}},Dt=l.doc.addEventListener?function(t,e,r,i){var n=function(t){var e=It(t);return r.call(i,t,e.x,e.y)};if(t.addEventListener(e,n,!1),p&&m[e]){var a=function(e){for(var n=It(e),a=e,s=0,o=e.targetTouches&&e.targetTouches.length;s<o;s++)if(e.targetTouches[s].target==t){(e=e.targetTouches[s]).originalEvent=a,e.preventDefault=Ft,e.stopPropagation=jt;break}return r.call(i,e,n.x,n.y)};t.addEventListener(m[e],a,!1)}return function(){return t.removeEventListener(e,n,!1),p&&m[e]&&t.removeEventListener(m[e],a,!1),!0}}:l.doc.attachEvent?function(t,e,r,i){var n=function(t){t=t||l.win.event;var e=l.doc.documentElement.scrollTop||l.doc.body.scrollTop,n=l.doc.documentElement.scrollLeft||l.doc.body.scrollLeft,a=t.clientX+n,s=t.clientY+e;return t.preventDefault=t.preventDefault||zt,t.stopPropagation=t.stopPropagation||Rt,r.call(i,t,a,s)};return t.attachEvent("on"+e,n),function(){return t.detachEvent("on"+e,n),!0}}:void 0,qt=[],Ot=function(e){for(var r,i=e.clientX,n=e.clientY,a=l.doc.documentElement.scrollTop||l.doc.body.scrollTop,s=l.doc.documentElement.scrollLeft||l.doc.body.scrollLeft,o=qt.length;o--;){if(r=qt[o],p&&e.touches){for(var h,u=e.touches.length;u--;)if((h=e.touches[u]).identifier==r.el._drag.id){i=h.clientX,n=h.clientY,(e.originalEvent?e.originalEvent:e).preventDefault();break}}else e.preventDefault();var c,f=r.el.node,d=f.nextSibling,g=f.parentNode,x=f.style.display;l.win.opera&&g.removeChild(f),f.style.display="none",c=r.el.paper.getElementByPoint(i,n),f.style.display=x,l.win.opera&&(d?g.insertBefore(f,d):g.appendChild(f)),c&&t("raphael.drag.over."+r.el.id,r.el,c),i+=s,n+=a,t("raphael.drag.move."+r.el.id,r.move_scope||r.el,i-r.el._drag.x,n-r.el._drag.y,i,n,e)}},Vt=function(r){e.unmousemove(Ot).unmouseup(Vt);for(var i,n=qt.length;n--;)(i=qt[n]).el._drag={},t("raphael.drag.end."+i.el.id,i.end_scope||i.start_scope||i.move_scope||i.el,r);qt=[]},Wt=e.el={},Yt=y.length;Yt--;)!function(t){e[t]=Wt[t]=function(r,i){return e.is(r,"function")&&(this.events=this.events||[],this.events.push({name:t,f:r,unbind:Dt(this.shape||this.node||l.doc,t,r,i||this)})),this},e["un"+t]=Wt["un"+t]=function(r){for(var i=this.events||[],n=i.length;n--;)i[n].name!=t||!e.is(r,"undefined")&&i[n].f!=r||(i[n].unbind(),i.splice(n,1),!i.length&&delete this.events);return this}}(y[Yt]);Wt.data=function(r,i){var n=G[this.id]=G[this.id]||{};if(0==arguments.length)return n;if(1==arguments.length){if(e.is(r,"object")){for(var a in r)r[o](a)&&this.data(a,r[a]);return this}return t("raphael.data.get."+this.id,this,n[r],r),n[r]}return n[r]=i,t("raphael.data.set."+this.id,this,i,r),this},Wt.removeData=function(t){return null==t?delete G[this.id]:G[this.id]&&delete G[this.id][t],this},Wt.getData=function(){return tt(G[this.id]||{})},Wt.hover=function(t,e,r,i){return this.mouseover(t,r).mouseout(e,i||r)},Wt.unhover=function(t,e){return this.unmouseover(t).unmouseout(e)};var Gt=[];Wt.drag=function(r,i,n,a,s,o){function h(h){(h.originalEvent||h).preventDefault();var u=h.clientX,c=h.clientY,f=l.doc.documentElement.scrollTop||l.doc.body.scrollTop,d=l.doc.documentElement.scrollLeft||l.doc.body.scrollLeft;if(this._drag.id=h.identifier,p&&h.touches)for(var g,x=h.touches.length;x--;)if(g=h.touches[x],this._drag.id=g.identifier,g.identifier==this._drag.id){u=g.clientX,c=g.clientY;break}this._drag.x=u+d,this._drag.y=c+f,!qt.length&&e.mousemove(Ot).mouseup(Vt),qt.push({el:this,move_scope:a,start_scope:s,end_scope:o}),i&&t.on("raphael.drag.start."+this.id,i),r&&t.on("raphael.drag.move."+this.id,r),n&&t.on("raphael.drag.end."+this.id,n),t("raphael.drag.start."+this.id,s||a||this,this._drag.x,this._drag.y,h)}return this._drag={},Gt.push({el:this,start:h}),this.mousedown(h),this},Wt.onDragOver=function(e){e?t.on("raphael.drag.over."+this.id,e):t.unbind("raphael.drag.over."+this.id)},Wt.undrag=function(){for(var r=Gt.length;r--;)Gt[r].el==this&&(this.unmousedown(Gt[r].start),Gt.splice(r,1),t.unbind("raphael.drag.*."+this.id));!Gt.length&&e.unmousemove(Ot).unmouseup(Vt),qt=[]},i.circle=function(t,r,i){var n=e._engine.circle(this,t||0,r||0,i||0);return this.__set__&&this.__set__.push(n),n},i.rect=function(t,r,i,n,a){var s=e._engine.rect(this,t||0,r||0,i||0,n||0,a||0);return this.__set__&&this.__set__.push(s),s},i.ellipse=function(t,r,i,n){var a=e._engine.ellipse(this,t||0,r||0,i||0,n||0);return this.__set__&&this.__set__.push(a),a},i.path=function(t){t&&!e.is(t,"string")&&!e.is(t[0],A)&&(t+=d);var r=e._engine.path(e.format[c](e,arguments),this);return this.__set__&&this.__set__.push(r),r},i.image=function(t,r,i,n,a){var s=e._engine.image(this,t||"about:blank",r||0,i||0,n||0,a||0);return this.__set__&&this.__set__.push(s),s},i.text=function(t,r,i){var n=e._engine.text(this,t||0,r||0,x(i));return this.__set__&&this.__set__.push(n),n},i.set=function(t){!e.is(t,"array")&&(t=Array.prototype.splice.call(arguments,0,arguments.length));var r=new ce(t);return this.__set__&&this.__set__.push(r),r.paper=this,r.type="set",r},i.setStart=function(t){this.__set__=t||this.set()},i.setFinish=function(t){var e=this.__set__;return delete this.__set__,e},i.getSize=function(){var t=this.canvas.parentNode;return{width:t.offsetWidth,height:t.offsetHeight}},i.setSize=function(t,r){return e._engine.setSize.call(this,t,r)},i.setViewBox=function(t,r,i,n,a){return e._engine.setViewBox.call(this,t,r,i,n,a)},i.top=i.bottom=null,i.raphael=e;function Ht(){return this.x+g+this.y+g+this.width+" × "+this.height}i.getElementByPoint=function(t,e){var r,i,n,a,s,o,h,u=this.canvas,c=l.doc.elementFromPoint(t,e);if(l.win.opera&&"svg"==c.tagName){var f=(i=(r=u).getBoundingClientRect(),n=r.ownerDocument,a=n.body,s=n.documentElement,o=s.clientTop||a.clientTop||0,h=s.clientLeft||a.clientLeft||0,{y:i.top+(l.win.pageYOffset||s.scrollTop||a.scrollTop)-o,x:i.left+(l.win.pageXOffset||s.scrollLeft||a.scrollLeft)-h}),p=u.createSVGRect();p.x=t-f.x,p.y=e-f.y,p.width=p.height=1;var d=u.getIntersectionList(p,null);d.length&&(c=d[d.length-1])}if(!c)return null;for(;c.parentNode&&c!=u.parentNode&&!c.raphael;)c=c.parentNode;return c==this.canvas.parentNode&&(c=u),c=c&&c.raphael?this.getById(c.raphaelid):null},i.getElementsByBBox=function(t){var r=this.set();return this.forEach(function(i){e.isBBoxIntersect(i.getBBox(),t)&&r.push(i)}),r},i.getById=function(t){for(var e=this.bottom;e;){if(e.id==t)return e;e=e.next}return null},i.forEach=function(t,e){for(var r=this.bottom;r;){if(!1===t.call(e,r))return this;r=r.next}return this},i.getElementsByPoint=function(t,e){var r=this.set();return this.forEach(function(i){i.isPointInside(t,e)&&r.push(i)}),r},Wt.isPointInside=function(t,r){var i=this.realPath=Z[this.type](this);return this.attr("transform")&&this.attr("transform").length&&(i=e.transformPath(i,this.attr("transform"))),e.isPointInsidePath(i,t,r)},Wt.getBBox=function(t){if(this.removed)return{};var e=this._;return t?(!e.dirty&&e.bboxwt||(this.realPath=Z[this.type](this),e.bboxwt=yt(this.realPath),e.bboxwt.toString=Ht,e.dirty=0),e.bboxwt):((e.dirty||e.dirtyT||!e.bbox)&&(!e.dirty&&this.realPath||(e.bboxwt=0,this.realPath=Z[this.type](this)),e.bbox=yt(Q(this.realPath,this.matrix)),e.bbox.toString=Ht,e.dirty=e.dirtyT=0),e.bbox)},Wt.clone=function(){if(this.removed)return null;var t=this.paper[this.type]().attr(this.attr());return this.__set__&&this.__set__.push(t),t},Wt.glow=function(t){if("text"==this.type)return null;var e={width:((t=t||{}).width||10)+(+this.attr("stroke-width")||1),fill:t.fill||!1,opacity:null==t.opacity?.5:t.opacity,offsetx:t.offsetx||0,offsety:t.offsety||0,color:t.color||"#000"},r=e.width/2,i=this.paper,n=i.set(),a=this.realPath||Z[this.type](this);a=this.matrix?Q(a,this.matrix):a;for(var s=1;s<r+1;s++)n.push(i.path(a).attr({stroke:e.color,fill:e.fill?e.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(e.width/r*s).toFixed(3),opacity:+(e.opacity/r).toFixed(3)}));return n.insertBefore(this).translate(e.offsetx,e.offsety)};var Xt=function(t,r,i,n,a,s,o,l,h){return null==h?dt(t,r,i,n,a,s,o,l):e.findDotsAtSegment(t,r,i,n,a,s,o,l,function(t,e,r,i,n,a,s,o,l){if(!(l<0||dt(t,e,r,i,n,a,s,o)<l)){var h,u=.5,c=1-u;for(h=dt(t,e,r,i,n,a,s,o,c);B(h-l)>.01;)h=dt(t,e,r,i,n,a,s,o,c+=(h<l?1:-1)*(u/=2));return c}}(t,r,i,n,a,s,o,l,h))},Ut=function(t,r){return function(i,n,a){for(var s,o,l,h,u,c="",f={},p=0,d=0,g=(i=Tt(i)).length;d<g;d++){if("M"==(l=i[d])[0])s=+l[1],o=+l[2];else{if(p+(h=Xt(s,o,l[1],l[2],l[3],l[4],l[5],l[6]))>n){if(r&&!f.start){if(c+=["C"+(u=Xt(s,o,l[1],l[2],l[3],l[4],l[5],l[6],n-p)).start.x,u.start.y,u.m.x,u.m.y,u.x,u.y],a)return c;f.start=c,c=["M"+u.x,u.y+"C"+u.n.x,u.n.y,u.end.x,u.end.y,l[5],l[6]].join(),p+=h,s=+l[5],o=+l[6];continue}if(!t&&!r)return{x:(u=Xt(s,o,l[1],l[2],l[3],l[4],l[5],l[6],n-p)).x,y:u.y,alpha:u.alpha}}p+=h,s=+l[5],o=+l[6]}c+=l.shift()+l}return f.end=c,(u=t?p:r?f:e.findDotsAtSegment(s,o,l[0],l[1],l[2],l[3],l[4],l[5],1)).alpha&&(u={x:u.x,y:u.y,alpha:u.alpha}),u}},$t=Ut(1),Zt=Ut(),Qt=Ut(0,1);e.getTotalLength=$t,e.getPointAtLength=Zt,e.getSubpath=function(t,e,r){if(this.getTotalLength(t)-r<1e-6)return Qt(t,e).end;var i=Qt(t,r,1);return e?Qt(i,e).end:i},Wt.getTotalLength=function(){var t=this.getPath();if(t)return this.node.getTotalLength?this.node.getTotalLength():$t(t)},Wt.getPointAtLength=function(t){var e=this.getPath();if(e)return Zt(e,t)},Wt.getPath=function(){var t,r=e._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return r&&(t=r(this)),t},Wt.getSubpath=function(t,r){var i=this.getPath();if(i)return e.getSubpath(i,t,r)};var Jt=e.easing_formulas={linear:function(t){return t},"<":function(t){return C(t,1.7)},">":function(t){return C(t,.48)},"<>":function(t){var e=.48-t/1.04,r=_.sqrt(.1734+e*e),i=r-e,n=-r-e,a=C(B(i),1/3)*(i<0?-1:1)+C(B(n),1/3)*(n<0?-1:1)+.5;return 3*(1-a)*a*a+a*a*a},backIn:function(t){var e=1.70158;return t*t*((e+1)*t-e)},backOut:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},elastic:function(t){return t==!!t?t:C(2,-10*t)*_.sin(2*S*(t-.075)/.3)+1},bounce:function(t){var e=7.5625,r=2.75;return t<1/r?e*t*t:t<2/r?e*(t-=1.5/r)*t+.75:t<2.5/r?e*(t-=2.25/r)*t+.9375:e*(t-=2.625/r)*t+.984375}};Jt.easeIn=Jt["ease-in"]=Jt["<"],Jt.easeOut=Jt["ease-out"]=Jt[">"],Jt.easeInOut=Jt["ease-in-out"]=Jt["<>"],Jt["back-in"]=Jt.backIn,Jt["back-out"]=Jt.backOut;var Kt=[],te=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){setTimeout(t,16)},ee=function(){for(var r=+new Date,i=0;i<Kt.length;i++){var n=Kt[i];if(!n.el.removed&&!n.paused){var a,s,l=r-n.start,h=n.ms,u=n.easing,c=n.from,p=n.diff,d=n.to,x=(n.t,n.el),v={},y={};if(n.initstatus?(l=(n.initstatus*n.anim.top-n.prev)/(n.percent-n.prev)*h,n.status=n.initstatus,delete n.initstatus,n.stop&&Kt.splice(i--,1)):n.status=(n.prev+(n.percent-n.prev)*(l/h))/n.anim.top,!(l<0))if(l<h){var m=u(l/h);for(var b in c)if(c[o](b)){switch(I[b]){case T:a=+c[b]+m*h*p[b];break;case"colour":a="rgb("+[re(P(c[b].r+m*h*p[b].r)),re(P(c[b].g+m*h*p[b].g)),re(P(c[b].b+m*h*p[b].b))].join(",")+")";break;case"path":a=[];for(var _=0,w=c[b].length;_<w;_++){a[_]=[c[b][_][0]];for(var k=1,B=c[b][_].length;k<B;k++)a[_][k]=+c[b][_][k]+m*h*p[b][_][k];a[_]=a[_].join(g)}a=a.join(g);break;case"transform":if(p[b].real)for(a=[],_=0,w=c[b].length;_<w;_++)for(a[_]=[c[b][_][0]],k=1,B=c[b][_].length;k<B;k++)a[_][k]=c[b][_][k]+m*h*p[b][_][k];else{var C=function(t){return+c[b][t]+m*h*p[b][t]};a=[["m",C(0),C(1),C(2),C(3),C(4),C(5)]]}break;case"csv":if("clip-rect"==b)for(a=[],_=4;_--;)a[_]=+c[b][_]+m*h*p[b][_];break;default:var S=[][f](c[b]);for(a=[],_=x.paper.customAttributes[b].length;_--;)a[_]=+S[_]+m*h*p[b][_]}v[b]=a}x.attr(v),function(e,r,i){setTimeout(function(){t("raphael.anim.frame."+e,r,i)})}(x.id,x,n.anim)}else{if(function(r,i,n){setTimeout(function(){t("raphael.anim.frame."+i.id,i,n),t("raphael.anim.finish."+i.id,i,n),e.is(r,"function")&&r.call(i)})}(n.callback,x,n.anim),x.attr(d),Kt.splice(i--,1),n.repeat>1&&!n.next){for(s in d)d[o](s)&&(y[s]=n.totalOrigin[s]);n.el.attr(y),ae(n.anim,n.el,n.anim.percents[0],null,n.totalOrigin,n.repeat-1)}n.next&&!n.stop&&ae(n.anim,n.el,n.next,null,n.totalOrigin,n.repeat)}}}Kt.length&&te(ee)},re=function(t){return t>255?255:t<0?0:t};function ie(t,e,r,i,n,a){var s=3*e,o=3*(i-e)-s,l=1-s-o,h=3*r,u=3*(n-r)-h,c=1-h-u;function f(t){return((l*t+o)*t+s)*t}return function(t,e){var r=function(t,e){var r,i,n,a,h,u;for(n=t,u=0;u<8;u++){if(a=f(n)-t,B(a)<e)return n;if(B(h=(3*l*n+2*o)*n+s)<1e-6)break;n-=a/h}if(i=1,(n=t)<(r=0))return r;if(n>i)return i;for(;r<i;){if(a=f(n),B(a-t)<e)return n;t>a?r=n:i=n,n=(i-r)/2+r}return n}(t,e);return((c*r+u)*r+h)*r}(t,1/(200*a))}function ne(t,e){var r=[],i={};if(this.ms=e,this.times=1,t){for(var n in t)t[o](n)&&(i[z(n)]=t[n],r.push(z(n)));r.sort(H)}this.anim=i,this.top=r[r.length-1],this.percents=r}function ae(r,i,a,s,l,h){a=z(a);var u,c,p,d,g,y,m=r.ms,b={},_={},w={};if(s)for(B=0,C=Kt.length;B<C;B++){var k=Kt[B];if(k.el.id==i.id&&k.anim==r){k.percent!=a?(Kt.splice(B,1),p=1):c=k,i.attr(k.totalOrigin);break}}else s=+_;for(var B=0,C=r.percents.length;B<C;B++){if(r.percents[B]==a||r.percents[B]>s*r.top){a=r.percents[B],g=r.percents[B-1]||0,m=m/r.top*(a-g),d=r.percents[B+1],u=r.anim[a];break}s&&i.attr(r.anim[r.percents[B]])}if(u){if(c)c.initstatus=s,c.start=new Date-c.ms*s;else{for(var S in u)if(u[o](S)&&(I[o](S)||i.paper.customAttributes[o](S)))switch(b[S]=i.attr(S),null==b[S]&&(b[S]=j[S]),_[S]=u[S],I[S]){case T:w[S]=(_[S]-b[S])/m;break;case"colour":b[S]=e.getRGB(b[S]);var A=e.getRGB(_[S]);w[S]={r:(A.r-b[S].r)/m,g:(A.g-b[S].g)/m,b:(A.b-b[S].b)/m};break;case"path":var M=Tt(b[S],_[S]),E=M[1];for(b[S]=M[0],w[S]=[],B=0,C=b[S].length;B<C;B++){w[S][B]=[0];for(var N=1,P=b[S][B].length;N<P;N++)w[S][B][N]=(E[B][N]-b[S][B][N])/m}break;case"transform":var F=i._,R=Lt(F[S],_[S]);if(R)for(b[S]=R.from,_[S]=R.to,w[S]=[],w[S].real=!0,B=0,C=b[S].length;B<C;B++)for(w[S][B]=[b[S][B][0]],N=1,P=b[S][B].length;N<P;N++)w[S][B][N]=(_[S][B][N]-b[S][B][N])/m;else{var D=i.matrix||new Pt,q={_:{transform:F.transform},getBBox:function(){return i.getBBox(1)}};b[S]=[D.a,D.b,D.c,D.d,D.e,D.f],Et(q,_[S]),_[S]=q._.transform,w[S]=[(q.matrix.a-D.a)/m,(q.matrix.b-D.b)/m,(q.matrix.c-D.c)/m,(q.matrix.d-D.d)/m,(q.matrix.e-D.e)/m,(q.matrix.f-D.f)/m]}break;case"csv":var O=x(u[S])[v](n),V=x(b[S])[v](n);if("clip-rect"==S)for(b[S]=V,w[S]=[],B=V.length;B--;)w[S][B]=(O[B]-b[S][B])/m;_[S]=O;break;default:for(O=[][f](u[S]),V=[][f](b[S]),w[S]=[],B=i.paper.customAttributes[S].length;B--;)w[S][B]=((O[B]||0)-(V[B]||0))/m}var W=u.easing,Y=e.easing_formulas[W];if(!Y)if((Y=x(W).match(L))&&5==Y.length){var G=Y;Y=function(t){return ie(t,+G[1],+G[2],+G[3],+G[4],m)}}else Y=X;if(k={anim:r,percent:a,timestamp:y=u.start||r.start||+new Date,start:y+(r.del||0),status:0,initstatus:s||0,stop:!1,ms:m,easing:Y,from:b,diff:w,to:_,el:i,callback:u.callback,prev:g,next:d,repeat:h||r.times,origin:i.attr(),totalOrigin:l},Kt.push(k),s&&!c&&!p&&(k.stop=!0,k.start=new Date-m*s,1==Kt.length))return ee();p&&(k.start=new Date-k.ms*s),1==Kt.length&&te(ee)}t("raphael.anim.start."+i.id,i,r)}}function se(t){for(var e=0;e<Kt.length;e++)Kt[e].el.paper==t&&Kt.splice(e--,1)}Wt.animateWith=function(t,r,i,n,a,s){if(this.removed)return s&&s.call(this),this;var o=i instanceof ne?i:e.animation(i,n,a,s);ae(o,this,o.percents[0],null,this.attr());for(var l=0,h=Kt.length;l<h;l++)if(Kt[l].anim==r&&Kt[l].el==t){Kt[h-1].start=Kt[l].start;break}return this},Wt.onAnimation=function(e){return e?t.on("raphael.anim.frame."+this.id,e):t.unbind("raphael.anim.frame."+this.id),this},ne.prototype.delay=function(t){var e=new ne(this.anim,this.ms);return e.times=this.times,e.del=+t||0,e},ne.prototype.repeat=function(t){var e=new ne(this.anim,this.ms);return e.del=this.del,e.times=_.floor(w(t,0))||1,e},e.animation=function(t,r,i,n){if(t instanceof ne)return t;!e.is(i,"function")&&i||(n=n||i||null,i=null),t=Object(t),r=+r||0;var a,s,l={};for(s in t)t[o](s)&&z(s)!=s&&z(s)+"%"!=s&&(a=!0,l[s]=t[s]);if(a)return i&&(l.easing=i),n&&(l.callback=n),new ne({100:l},r);if(n){var h=0;for(var u in t){var c=F(u);t[o](u)&&c>h&&(h=c)}!t[h+="%"].callback&&(t[h].callback=n)}return new ne(t,r)},Wt.animate=function(t,r,i,n){if(this.removed)return n&&n.call(this),this;var a=t instanceof ne?t:e.animation(t,r,i,n);return ae(a,this,a.percents[0],null,this.attr()),this},Wt.setTime=function(t,e){return t&&null!=e&&this.status(t,k(e,t.ms)/t.ms),this},Wt.status=function(t,e){var r,i,n=[],a=0;if(null!=e)return ae(t,this,-1,k(e,1)),this;for(r=Kt.length;a<r;a++)if((i=Kt[a]).el.id==this.id&&(!t||i.anim==t)){if(t)return i.status;n.push({anim:i.anim,status:i.status})}return t?0:n},Wt.pause=function(e){for(var r=0;r<Kt.length;r++)Kt[r].el.id!=this.id||e&&Kt[r].anim!=e||!1!==t("raphael.anim.pause."+this.id,this,Kt[r].anim)&&(Kt[r].paused=!0);return this},Wt.resume=function(e){for(var r=0;r<Kt.length;r++)if(Kt[r].el.id==this.id&&(!e||Kt[r].anim==e)){var i=Kt[r];!1!==t("raphael.anim.resume."+this.id,this,i.anim)&&(delete i.paused,this.status(i.anim,i.status))}return this},Wt.stop=function(e){for(var r=0;r<Kt.length;r++)Kt[r].el.id!=this.id||e&&Kt[r].anim!=e||!1!==t("raphael.anim.stop."+this.id,this,Kt[r].anim)&&Kt.splice(r--,1);return this},t.on("raphael.remove",se),t.on("raphael.clear",se),Wt.toString=function(){return"Raphaël’s object"};var oe,le,he,ue,ce=function(t){if(this.items=[],this.length=0,this.type="set",t)for(var e=0,r=t.length;e<r;e++)!t[e]||t[e].constructor!=Wt.constructor&&t[e].constructor!=ce||(this[this.items.length]=this.items[this.items.length]=t[e],this.length++)},fe=ce.prototype;for(var pe in fe.push=function(){for(var t,e,r=0,i=arguments.length;r<i;r++)!(t=arguments[r])||t.constructor!=Wt.constructor&&t.constructor!=ce||(this[e=this.items.length]=this.items[e]=t,this.length++);return this},fe.pop=function(){return this.length&&delete this[this.length--],this.items.pop()},fe.forEach=function(t,e){for(var r=0,i=this.items.length;r<i;r++)if(!1===t.call(e,this.items[r],r))return this;return this},Wt)Wt[o](pe)&&(fe[pe]=function(t){return function(){var e=arguments;return this.forEach(function(r){r[t][c](r,e)})}}(pe));return fe.attr=function(t,r){if(t&&e.is(t,A)&&e.is(t[0],"object"))for(var i=0,n=t.length;i<n;i++)this.items[i].attr(t[i]);else for(var a=0,s=this.items.length;a<s;a++)this.items[a].attr(t,r);return this},fe.clear=function(){for(;this.length;)this.pop()},fe.splice=function(t,e,r){t=t<0?w(this.length+t,0):t,e=w(0,k(this.length-t,e));var i,n=[],a=[],s=[];for(i=2;i<arguments.length;i++)s.push(arguments[i]);for(i=0;i<e;i++)a.push(this[t+i]);for(;i<this.length-t;i++)n.push(this[t+i]);var o=s.length;for(i=0;i<o+n.length;i++)this.items[t+i]=this[t+i]=i<o?s[i]:n[i-o];for(i=this.items.length=this.length-=e-o;this[i];)delete this[i++];return new ce(a)},fe.exclude=function(t){for(var e=0,r=this.length;e<r;e++)if(this[e]==t)return this.splice(e,1),!0},fe.animate=function(t,r,i,n){(e.is(i,"function")||!i)&&(n=i||null);var a,s,o=this.items.length,l=o,h=this;if(!o)return this;n&&(s=function(){!--o&&n.call(h)}),i=e.is(i,"string")?i:s;var u=e.animation(t,r,i,s);for(a=this.items[--l].animate(u);l--;)this.items[l]&&!this.items[l].removed&&this.items[l].animateWith(a,u,u),this.items[l]&&!this.items[l].removed||o--;return this},fe.insertAfter=function(t){for(var e=this.items.length;e--;)this.items[e].insertAfter(t);return this},fe.getBBox=function(){for(var t=[],e=[],r=[],i=[],n=this.items.length;n--;)if(!this.items[n].removed){var a=this.items[n].getBBox();t.push(a.x),e.push(a.y),r.push(a.x+a.width),i.push(a.y+a.height)}return{x:t=k[c](0,t),y:e=k[c](0,e),x2:r=w[c](0,r),y2:i=w[c](0,i),width:r-t,height:i-e}},fe.clone=function(t){t=this.paper.set();for(var e=0,r=this.items.length;e<r;e++)t.push(this.items[e].clone());return t},fe.toString=function(){return"Raphaël‘s set"},fe.glow=function(t){var e=this.paper.set();return this.forEach(function(r,i){var n=r.glow(t);null!=n&&n.forEach(function(t,r){e.push(t)})}),e},fe.isPointInside=function(t,e){var r=!1;return this.forEach(function(i){if(i.isPointInside(t,e))return r=!0,!1}),r},e.registerFont=function(t){if(!t.face)return t;this.fonts=this.fonts||{};var e={w:t.w,face:{},glyphs:{}},r=t.face["font-family"];for(var i in t.face)t.face[o](i)&&(e.face[i]=t.face[i]);if(this.fonts[r]?this.fonts[r].push(e):this.fonts[r]=[e],!t.svg)for(var n in e.face["units-per-em"]=F(t.face["units-per-em"],10),t.glyphs)if(t.glyphs[o](n)){var a=t.glyphs[n];if(e.glyphs[n]={w:a.w,k:{},d:a.d&&"M"+a.d.replace(/[mlcxtrv]/g,function(t){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[t]||"M"})+"z"},a.k)for(var s in a.k)a[o](s)&&(e.glyphs[n].k[s]=a.k[s])}return t},i.getFont=function(t,r,i,n){if(n=n||"normal",i=i||"normal",r=+r||{normal:400,bold:700,lighter:300,bolder:800}[r]||400,e.fonts){var a,s=e.fonts[t];if(!s){var l=new RegExp("(^|\\\\s)"+t.replace(/[^\\w\\d\\s+!~.:_-]/g,d)+"(\\\\s|$)","i");for(var h in e.fonts)if(e.fonts[o](h)&&l.test(h)){s=e.fonts[h];break}}if(s)for(var u=0,c=s.length;u<c&&((a=s[u]).face["font-weight"]!=r||a.face["font-style"]!=i&&a.face["font-style"]||a.face["font-stretch"]!=n);u++);return a}},i.print=function(t,r,i,a,s,o,l,h){o=o||"middle",l=w(k(l||0,1),-1),h=w(k(h||1,3),1);var u,c=x(i)[v](d),f=0,p=0,g=d;if(e.is(a,"string")&&(a=this.getFont(a)),a){u=(s||16)/a.face["units-per-em"];for(var y=a.face.bbox[v](n),m=+y[0],b=y[3]-y[1],_=0,B=+y[1]+("baseline"==o?b+ +a.face.descent:b/2),C=0,S=c.length;C<S;C++){if("\\n"==c[C])f=0,A=0,p=0,_+=b*h;else{var T=p&&a.glyphs[c[C-1]]||{},A=a.glyphs[c[C]];f+=p?(T.w||a.w)+(T.k&&T.k[c[C]]||0)+a.w*l:0,p=1}A&&A.d&&(g+=e.transformPath(A.d,["t",f*u,_*u,"s",u,u,m,B,"t",(t-m)/u,(r-B)/u]))}}return this.path(g).attr({fill:"#000",stroke:"none"})},i.add=function(t){if(e.is(t,"array"))for(var r,i=this.set(),n=0,s=t.length;n<s;n++)r=t[n]||{},a[o](r.type)&&i.push(this[r.type]().attr(r));return i},e.format=function(t,r){var i=e.is(r,A)?[0][f](r):arguments;return t&&e.is(t,"string")&&i.length-1&&(t=t.replace(s,function(t,e){return null==i[++e]?d:i[e]})),t||d},e.fullfill=(oe=/\\{([^\\}]+)\\}/g,le=/(?:(?:^|\\.)(.+?)(?=\\[|\\.|$|\\()|\\[(\'|")(.+?)\\2\\])(\\(\\))?/g,function(t,e){return String(t).replace(oe,function(t,r){return function(t,e,r){var i=r;return e.replace(le,function(t,e,r,n,a){e=e||n,i&&(e in i&&(i=i[e]),"function"==typeof i&&a&&(i=i()))}),i=(null==i||i==r?t:i)+""}(t,r,e)})}),e.ninja=function(){if(h.was)l.win.Raphael=h.is;else{window.Raphael=void 0;try{delete window.Raphael}catch(t){}}return e},e.st=fe,t.on("raphael.DOMload",function(){r=!0}),null==(he=document).readyState&&he.addEventListener&&(he.addEventListener("DOMContentLoaded",ue=function(){he.removeEventListener("DOMContentLoaded",ue,!1),he.readyState="complete"},!1),he.readyState="loading"),function t(){/in/.test(he.readyState)?setTimeout(t,9):e.eve("raphael.DOMload")}(),e}.apply(e,i))||(t.exports=n)},function(t,e,r){var i,n;i=[r(0),r(3),r(4)],void 0===(n=function(t){return t}.apply(e,i))||(t.exports=n)},function(t,e,r){var i,n,a,s,o,l,h,u,c,f,p,d,g,x;s="hasOwnProperty",o=/[\\.\\/]/,l=/\\s*,\\s*/,h=function(t,e){return t-e},u={n:{}},c=function(){for(var t=0,e=this.length;t<e;t++)if(void 0!==this[t])return this[t]},f=function(){for(var t=this.length;--t;)if(void 0!==this[t])return this[t]},p=Object.prototype.toString,d=String,g=Array.isArray||function(t){return t instanceof Array||"[object Array]"==p.call(t)},(x=function(t,e){var r,i=a,s=Array.prototype.slice.call(arguments,2),o=x.listeners(t),l=0,u=[],p={},d=[],g=n;d.firstDefined=c,d.lastDefined=f,n=t,a=0;for(var v=0,y=o.length;v<y;v++)"zIndex"in o[v]&&(u.push(o[v].zIndex),o[v].zIndex<0&&(p[o[v].zIndex]=o[v]));for(u.sort(h);u[l]<0;)if(r=p[u[l++]],d.push(r.apply(e,s)),a)return a=i,d;for(v=0;v<y;v++)if("zIndex"in(r=o[v]))if(r.zIndex==u[l]){if(d.push(r.apply(e,s)),a)break;do{if((r=p[u[++l]])&&d.push(r.apply(e,s)),a)break}while(r)}else p[r.zIndex]=r;else if(d.push(r.apply(e,s)),a)break;return a=i,n=g,d})._events=u,x.listeners=function(t){var e,r,i,n,a,s,l,h,c=g(t)?t:t.split(o),f=u,p=[f],d=[];for(n=0,a=c.length;n<a;n++){for(h=[],s=0,l=p.length;s<l;s++)for(r=[(f=p[s].n)[c[n]],f["*"]],i=2;i--;)(e=r[i])&&(h.push(e),d=d.concat(e.f||[]));p=h}return d},x.separator=function(t){t?(t="["+(t=d(t).replace(/(?=[\\.\\^\\]\\[\\-])/g,"\\\\"))+"]",o=new RegExp(t)):o=/[\\.\\/]/},x.on=function(t,e){if("function"!=typeof e)return function(){};for(var r=g(t)?g(t[0])?t:[t]:d(t).split(l),i=0,n=r.length;i<n;i++)!function(t){for(var r,i=g(t)?t:d(t).split(o),n=u,a=0,s=i.length;a<s;a++)n=(n=n.n).hasOwnProperty(i[a])&&n[i[a]]||(n[i[a]]={n:{}});for(n.f=n.f||[],a=0,s=n.f.length;a<s;a++)if(n.f[a]==e){r=!0;break}!r&&n.f.push(e)}(r[i]);return function(t){+t==+t&&(e.zIndex=+t)}},x.f=function(t){var e=[].slice.call(arguments,1);return function(){x.apply(null,[t,null].concat(e).concat([].slice.call(arguments,0)))}},x.stop=function(){a=1},x.nt=function(t){var e=g(n)?n.join("."):n;return t?new RegExp("(?:\\\\.|\\\\/|^)"+t+"(?:\\\\.|\\\\/|$)").test(e):e},x.nts=function(){return g(n)?n:n.split(o)},x.off=x.unbind=function(t,e){if(t){var r=g(t)?g(t[0])?t:[t]:d(t).split(l);if(r.length>1)for(var i=0,n=r.length;i<n;i++)x.off(r[i],e);else{r=g(t)?t:d(t).split(o);var a,h,c,f,p,v=[u];for(i=0,n=r.length;i<n;i++)for(f=0;f<v.length;f+=c.length-2){if(c=[f,1],a=v[f].n,"*"!=r[i])a[r[i]]&&c.push(a[r[i]]);else for(h in a)a[s](h)&&c.push(a[h]);v.splice.apply(v,c)}for(i=0,n=v.length;i<n;i++)for(a=v[i];a.n;){if(e){if(a.f){for(f=0,p=a.f.length;f<p;f++)if(a.f[f]==e){a.f.splice(f,1);break}!a.f.length&&delete a.f}for(h in a.n)if(a.n[s](h)&&a.n[h].f){var y=a.n[h].f;for(f=0,p=y.length;f<p;f++)if(y[f]==e){y.splice(f,1);break}!y.length&&delete a.n[h].f}}else for(h in delete a.f,a.n)a.n[s](h)&&a.n[h].f&&delete a.n[h].f;a=a.n}}}else x._events=u={n:{}}},x.once=function(t,e){var r=function(){return x.off(t,r),e.apply(this,arguments)};return x.on(t,r)},x.version="0.5.0",x.toString=function(){return"You are running Eve 0.5.0"},t.exports?t.exports=x:void 0===(i=function(){return x}.apply(e,[]))||(t.exports=i)},function(t,e,r){var i,n;i=[r(0)],void 0===(n=function(t){if(!t||t.svg){var e="hasOwnProperty",r=String,i=parseFloat,n=parseInt,a=Math,s=a.max,o=a.abs,l=a.pow,h=/[, ]+/,u=t.eve,c="",f=" ",p="http://www.w3.org/1999/xlink",d={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},g={};t.toString=function(){return"Your browser supports SVG.\\nYou are running Raphaël "+this.version};var x=function(i,n){if(n)for(var a in"string"==typeof i&&(i=x(i)),n)n[e](a)&&("xlink:"==a.substring(0,6)?i.setAttributeNS(p,a.substring(6),r(n[a])):i.setAttribute(a,r(n[a])));else(i=t._g.doc.createElementNS("http://www.w3.org/2000/svg",i)).style&&(i.style.webkitTapHighlightColor="rgba(0,0,0,0)");return i},v=function(e,n){var h="linear",u=e.id+n,f=.5,p=.5,d=e.node,g=e.paper,v=d.style,m=t._g.doc.getElementById(u);if(!m){if(n=(n=r(n).replace(t._radial_gradient,function(t,e,r){if(h="radial",e&&r){f=i(e);var n=2*((p=i(r))>.5)-1;l(f-.5,2)+l(p-.5,2)>.25&&(p=a.sqrt(.25-l(f-.5,2))*n+.5)&&.5!=p&&(p=p.toFixed(5)-1e-5*n)}return c})).split(/\\s*\\-\\s*/),"linear"==h){var b=n.shift();if(b=-i(b),isNaN(b))return null;var _=[0,0,a.cos(t.rad(b)),a.sin(t.rad(b))],w=1/(s(o(_[2]),o(_[3]))||1);_[2]*=w,_[3]*=w,_[2]<0&&(_[0]=-_[2],_[2]=0),_[3]<0&&(_[1]=-_[3],_[3]=0)}var k=t._parseDots(n);if(!k)return null;if(u=u.replace(/[\\(\\)\\s,\\xb0#]/g,"_"),e.gradient&&u!=e.gradient.id&&(g.defs.removeChild(e.gradient),delete e.gradient),!e.gradient){m=x(h+"Gradient",{id:u}),e.gradient=m,x(m,"radial"==h?{fx:f,fy:p}:{x1:_[0],y1:_[1],x2:_[2],y2:_[3],gradientTransform:e.matrix.invert()}),g.defs.appendChild(m);for(var B=0,C=k.length;B<C;B++)m.appendChild(x("stop",{offset:k[B].offset?k[B].offset:B?"100%":"0%","stop-color":k[B].color||"#fff","stop-opacity":isFinite(k[B].opacity)?k[B].opacity:1}))}}return x(d,{fill:y(u),opacity:1,"fill-opacity":1}),v.fill=c,v.opacity=1,v.fillOpacity=1,1},y=function(t){if((e=document.documentMode)&&(9===e||10===e))return"url(\'#"+t+"\')";var e,r=document.location;return"url(\'"+(r.protocol+"//"+r.host+r.pathname+r.search)+"#"+t+"\')"},m=function(t){var e=t.getBBox(1);x(t.pattern,{patternTransform:t.matrix.invert()+" translate("+e.x+","+e.y+")"})},b=function(i,n,a){if("path"==i.type){for(var s,o,l,h,u,f=r(n).toLowerCase().split("-"),p=i.paper,v=a?"end":"start",y=i.node,m=i.attrs,b=m["stroke-width"],_=f.length,w="classic",k=3,B=3,C=5;_--;)switch(f[_]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":w=f[_];break;case"wide":B=5;break;case"narrow":B=2;break;case"long":k=5;break;case"short":k=2}if("open"==w?(k+=2,B+=2,C+=2,l=1,h=a?4:1,u={fill:"none",stroke:m.stroke}):(h=l=k/2,u={fill:m.stroke,stroke:"none"}),i._.arrows?a?(i._.arrows.endPath&&g[i._.arrows.endPath]--,i._.arrows.endMarker&&g[i._.arrows.endMarker]--):(i._.arrows.startPath&&g[i._.arrows.startPath]--,i._.arrows.startMarker&&g[i._.arrows.startMarker]--):i._.arrows={},"none"!=w){var S="raphael-marker-"+w,T="raphael-marker-"+v+w+k+B+"-obj"+i.id;t._g.doc.getElementById(S)?g[S]++:(p.defs.appendChild(x(x("path"),{"stroke-linecap":"round",d:d[w],id:S})),g[S]=1);var A,M=t._g.doc.getElementById(T);M?(g[T]++,A=M.getElementsByTagName("use")[0]):(M=x(x("marker"),{id:T,markerHeight:B,markerWidth:k,orient:"auto",refX:h,refY:B/2}),A=x(x("use"),{"xlink:href":"#"+S,transform:(a?"rotate(180 "+k/2+" "+B/2+") ":c)+"scale("+k/C+","+B/C+")","stroke-width":(1/((k/C+B/C)/2)).toFixed(4)}),M.appendChild(A),p.defs.appendChild(M),g[T]=1),x(A,u);var E=l*("diamond"!=w&&"oval"!=w);a?(s=i._.arrows.startdx*b||0,o=t.getTotalLength(m.path)-E*b):(s=E*b,o=t.getTotalLength(m.path)-(i._.arrows.enddx*b||0)),(u={})["marker-"+v]="url(#"+T+")",(o||s)&&(u.d=t.getSubpath(m.path,s,o)),x(y,u),i._.arrows[v+"Path"]=S,i._.arrows[v+"Marker"]=T,i._.arrows[v+"dx"]=E,i._.arrows[v+"Type"]=w,i._.arrows[v+"String"]=n}else a?(s=i._.arrows.startdx*b||0,o=t.getTotalLength(m.path)-s):(s=0,o=t.getTotalLength(m.path)-(i._.arrows.enddx*b||0)),i._.arrows[v+"Path"]&&x(y,{d:t.getSubpath(m.path,s,o)}),delete i._.arrows[v+"Path"],delete i._.arrows[v+"Marker"],delete i._.arrows[v+"dx"],delete i._.arrows[v+"Type"],delete i._.arrows[v+"String"];for(u in g)if(g[e](u)&&!g[u]){var N=t._g.doc.getElementById(u);N&&N.parentNode.removeChild(N)}}},_={"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},w=function(t,e,i){if(e=_[r(e).toLowerCase()]){for(var n=t.attrs["stroke-width"]||"1",a={round:n,square:n,butt:0}[t.attrs["stroke-linecap"]||i["stroke-linecap"]]||0,s=[],o=e.length;o--;)s[o]=e[o]*n+(o%2?1:-1)*a;x(t.node,{"stroke-dasharray":s.join(",")})}else x(t.node,{"stroke-dasharray":"none"})},k=function(i,a){var l=i.node,u=i.attrs,f=l.style.visibility;for(var d in l.style.visibility="hidden",a)if(a[e](d)){if(!t._availableAttrs[e](d))continue;var g=a[d];switch(u[d]=g,d){case"blur":i.blur(g);break;case"title":var y=l.getElementsByTagName("title");if(y.length&&(y=y[0]))y.firstChild.nodeValue=g;else{y=x("title");var _=t._g.doc.createTextNode(g);y.appendChild(_),l.appendChild(y)}break;case"href":case"target":var k=l.parentNode;if("a"!=k.tagName.toLowerCase()){var C=x("a");k.insertBefore(C,l),C.appendChild(l),k=C}"target"==d?k.setAttributeNS(p,"show","blank"==g?"new":g):k.setAttributeNS(p,d,g);break;case"cursor":l.style.cursor=g;break;case"transform":i.transform(g);break;case"arrow-start":b(i,g);break;case"arrow-end":b(i,g,1);break;case"clip-rect":var S=r(g).split(h);if(4==S.length){i.clip&&i.clip.parentNode.parentNode.removeChild(i.clip.parentNode);var T=x("clipPath"),A=x("rect");T.id=t.createUUID(),x(A,{x:S[0],y:S[1],width:S[2],height:S[3]}),T.appendChild(A),i.paper.defs.appendChild(T),x(l,{"clip-path":"url(#"+T.id+")"}),i.clip=A}if(!g){var M=l.getAttribute("clip-path");if(M){var E=t._g.doc.getElementById(M.replace(/(^url\\(#|\\)$)/g,c));E&&E.parentNode.removeChild(E),x(l,{"clip-path":c}),delete i.clip}}break;case"path":"path"==i.type&&(x(l,{d:g?u.path=t._pathToAbsolute(g):"M0,0"}),i._.dirty=1,i._.arrows&&("startString"in i._.arrows&&b(i,i._.arrows.startString),"endString"in i._.arrows&&b(i,i._.arrows.endString,1)));break;case"width":if(l.setAttribute(d,g),i._.dirty=1,!u.fx)break;d="x",g=u.x;case"x":u.fx&&(g=-u.x-(u.width||0));case"rx":if("rx"==d&&"rect"==i.type)break;case"cx":l.setAttribute(d,g),i.pattern&&m(i),i._.dirty=1;break;case"height":if(l.setAttribute(d,g),i._.dirty=1,!u.fy)break;d="y",g=u.y;case"y":u.fy&&(g=-u.y-(u.height||0));case"ry":if("ry"==d&&"rect"==i.type)break;case"cy":l.setAttribute(d,g),i.pattern&&m(i),i._.dirty=1;break;case"r":"rect"==i.type?x(l,{rx:g,ry:g}):l.setAttribute(d,g),i._.dirty=1;break;case"src":"image"==i.type&&l.setAttributeNS(p,"href",g);break;case"stroke-width":1==i._.sx&&1==i._.sy||(g/=s(o(i._.sx),o(i._.sy))||1),l.setAttribute(d,g),u["stroke-dasharray"]&&w(i,u["stroke-dasharray"],a),i._.arrows&&("startString"in i._.arrows&&b(i,i._.arrows.startString),"endString"in i._.arrows&&b(i,i._.arrows.endString,1));break;case"stroke-dasharray":w(i,g,a);break;case"fill":var N=r(g).match(t._ISURL);if(N){T=x("pattern");var L=x("image");T.id=t.createUUID(),x(T,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),x(L,{x:0,y:0,"xlink:href":N[1]}),T.appendChild(L),function(e){t._preload(N[1],function(){var t=this.offsetWidth,r=this.offsetHeight;x(e,{width:t,height:r}),x(L,{width:t,height:r})})}(T),i.paper.defs.appendChild(T),x(l,{fill:"url(#"+T.id+")"}),i.pattern=T,i.pattern&&m(i);break}var P=t.getRGB(g);if(P.error){if(("circle"==i.type||"ellipse"==i.type||"r"!=r(g).charAt())&&v(i,g)){if("opacity"in u||"fill-opacity"in u){var z=t._g.doc.getElementById(l.getAttribute("fill").replace(/^url\\(#|\\)$/g,c));if(z){var F=z.getElementsByTagName("stop");x(F[F.length-1],{"stop-opacity":("opacity"in u?u.opacity:1)*("fill-opacity"in u?u["fill-opacity"]:1)})}}u.gradient=g,u.fill="none";break}}else delete a.gradient,delete u.gradient,!t.is(u.opacity,"undefined")&&t.is(a.opacity,"undefined")&&x(l,{opacity:u.opacity}),!t.is(u["fill-opacity"],"undefined")&&t.is(a["fill-opacity"],"undefined")&&x(l,{"fill-opacity":u["fill-opacity"]});P[e]("opacity")&&x(l,{"fill-opacity":P.opacity>1?P.opacity/100:P.opacity});case"stroke":P=t.getRGB(g),l.setAttribute(d,P.hex),"stroke"==d&&P[e]("opacity")&&x(l,{"stroke-opacity":P.opacity>1?P.opacity/100:P.opacity}),"stroke"==d&&i._.arrows&&("startString"in i._.arrows&&b(i,i._.arrows.startString),"endString"in i._.arrows&&b(i,i._.arrows.endString,1));break;case"gradient":("circle"==i.type||"ellipse"==i.type||"r"!=r(g).charAt())&&v(i,g);break;case"opacity":u.gradient&&!u[e]("stroke-opacity")&&x(l,{"stroke-opacity":g>1?g/100:g});case"fill-opacity":if(u.gradient){(z=t._g.doc.getElementById(l.getAttribute("fill").replace(/^url\\(#|\\)$/g,c)))&&(F=z.getElementsByTagName("stop"),x(F[F.length-1],{"stop-opacity":g}));break}default:"font-size"==d&&(g=n(g,10)+"px");var R=d.replace(/(\\-.)/g,function(t){return t.substring(1).toUpperCase()});l.style[R]=g,i._.dirty=1,l.setAttribute(d,g)}}B(i,a),l.style.visibility=f},B=function(i,a){if("text"==i.type&&(a[e]("text")||a[e]("font")||a[e]("font-size")||a[e]("x")||a[e]("y"))){var s=i.attrs,o=i.node,l=o.firstChild?n(t._g.doc.defaultView.getComputedStyle(o.firstChild,c).getPropertyValue("font-size"),10):10;if(a[e]("text")){for(s.text=a.text;o.firstChild;)o.removeChild(o.firstChild);for(var h,u=r(a.text).split("\\n"),f=[],p=0,d=u.length;p<d;p++)h=x("tspan"),p&&x(h,{dy:1.2*l,x:s.x}),h.appendChild(t._g.doc.createTextNode(u[p])),o.appendChild(h),f[p]=h}else for(p=0,d=(f=o.getElementsByTagName("tspan")).length;p<d;p++)p?x(f[p],{dy:1.2*l,x:s.x}):x(f[0],{dy:0});x(o,{x:s.x,y:s.y}),i._.dirty=1;var g=i._getBBox(),v=s.y-(g.y+g.height/2);v&&t.is(v,"finite")&&x(f[0],{dy:v})}},C=function(t){return t.parentNode&&"a"===t.parentNode.tagName.toLowerCase()?t.parentNode:t},S=function(e,r){this[0]=this.node=e,e.raphael=!0,this.id=("0000"+(Math.random()*Math.pow(36,5)<<0).toString(36)).slice(-5),e.raphaelid=this.id,this.matrix=t.matrix(),this.realPath=null,this.paper=r,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!r.bottom&&(r.bottom=this),this.prev=r.top,r.top&&(r.top.next=this),r.top=this,this.next=null},T=t.el;S.prototype=T,T.constructor=S,t._engine.path=function(t,e){var r=x("path");e.canvas&&e.canvas.appendChild(r);var i=new S(r,e);return i.type="path",k(i,{fill:"none",stroke:"#000",path:t}),i},T.rotate=function(t,e,n){if(this.removed)return this;if((t=r(t).split(h)).length-1&&(e=i(t[1]),n=i(t[2])),t=i(t[0]),null==n&&(e=n),null==e||null==n){var a=this.getBBox(1);e=a.x+a.width/2,n=a.y+a.height/2}return this.transform(this._.transform.concat([["r",t,e,n]])),this},T.scale=function(t,e,n,a){if(this.removed)return this;if((t=r(t).split(h)).length-1&&(e=i(t[1]),n=i(t[2]),a=i(t[3])),t=i(t[0]),null==e&&(e=t),null==a&&(n=a),null==n||null==a)var s=this.getBBox(1);return n=null==n?s.x+s.width/2:n,a=null==a?s.y+s.height/2:a,this.transform(this._.transform.concat([["s",t,e,n,a]])),this},T.translate=function(t,e){return this.removed?this:((t=r(t).split(h)).length-1&&(e=i(t[1])),t=i(t[0])||0,e=+e||0,this.transform(this._.transform.concat([["t",t,e]])),this)},T.transform=function(r){var i=this._;if(null==r)return i.transform;if(t._extractTransform(this,r),this.clip&&x(this.clip,{transform:this.matrix.invert()}),this.pattern&&m(this),this.node&&x(this.node,{transform:this.matrix}),1!=i.sx||1!=i.sy){var n=this.attrs[e]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":n})}return this},T.hide=function(){return this.removed||(this.node.style.display="none"),this},T.show=function(){return this.removed||(this.node.style.display=""),this},T.remove=function(){var e=C(this.node);if(!this.removed&&e.parentNode){var r=this.paper;for(var i in r.__set__&&r.__set__.exclude(this),u.unbind("raphael.*.*."+this.id),this.gradient&&r.defs.removeChild(this.gradient),t._tear(this,r),e.parentNode.removeChild(e),this.removeData(),this)this[i]="function"==typeof this[i]?t._removedFactory(i):null;this.removed=!0}},T._getBBox=function(){if("none"==this.node.style.display){this.show();var t=!0}var e,r=!1;this.paper.canvas.parentElement?e=this.paper.canvas.parentElement.style:this.paper.canvas.parentNode&&(e=this.paper.canvas.parentNode.style),e&&"none"==e.display&&(r=!0,e.display="");var i={};try{i=this.node.getBBox()}catch(t){i={x:this.node.clientLeft,y:this.node.clientTop,width:this.node.clientWidth,height:this.node.clientHeight}}finally{i=i||{},r&&(e.display="none")}return t&&this.hide(),i},T.attr=function(r,i){if(this.removed)return this;if(null==r){var n={};for(var a in this.attrs)this.attrs[e](a)&&(n[a]=this.attrs[a]);return n.gradient&&"none"==n.fill&&(n.fill=n.gradient)&&delete n.gradient,n.transform=this._.transform,n}if(null==i&&t.is(r,"string")){if("fill"==r&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;if("transform"==r)return this._.transform;for(var s=r.split(h),o={},l=0,c=s.length;l<c;l++)(r=s[l])in this.attrs?o[r]=this.attrs[r]:t.is(this.paper.customAttributes[r],"function")?o[r]=this.paper.customAttributes[r].def:o[r]=t._availableAttrs[r];return c-1?o:o[s[0]]}if(null==i&&t.is(r,"array")){for(o={},l=0,c=r.length;l<c;l++)o[r[l]]=this.attr(r[l]);return o}if(null!=i){var f={};f[r]=i}else null!=r&&t.is(r,"object")&&(f=r);for(var p in f)u("raphael.attr."+p+"."+this.id,this,f[p]);for(p in this.paper.customAttributes)if(this.paper.customAttributes[e](p)&&f[e](p)&&t.is(this.paper.customAttributes[p],"function")){var d=this.paper.customAttributes[p].apply(this,[].concat(f[p]));for(var g in this.attrs[p]=f[p],d)d[e](g)&&(f[g]=d[g])}return k(this,f),this},T.toFront=function(){if(this.removed)return this;var e=C(this.node);e.parentNode.appendChild(e);var r=this.paper;return r.top!=this&&t._tofront(this,r),this},T.toBack=function(){if(this.removed)return this;var e=C(this.node),r=e.parentNode;r.insertBefore(e,r.firstChild),t._toback(this,this.paper);this.paper;return this},T.insertAfter=function(e){if(this.removed||!e)return this;var r=C(this.node),i=C(e.node||e[e.length-1].node);return i.nextSibling?i.parentNode.insertBefore(r,i.nextSibling):i.parentNode.appendChild(r),t._insertafter(this,e,this.paper),this},T.insertBefore=function(e){if(this.removed||!e)return this;var r=C(this.node),i=C(e.node||e[0].node);return i.parentNode.insertBefore(r,i),t._insertbefore(this,e,this.paper),this},T.blur=function(e){var r=this;if(0!=+e){var i=x("filter"),n=x("feGaussianBlur");r.attrs.blur=e,i.id=t.createUUID(),x(n,{stdDeviation:+e||1.5}),i.appendChild(n),r.paper.defs.appendChild(i),r._blur=i,x(r.node,{filter:"url(#"+i.id+")"})}else r._blur&&(r._blur.parentNode.removeChild(r._blur),delete r._blur,delete r.attrs.blur),r.node.removeAttribute("filter");return r},t._engine.circle=function(t,e,r,i){var n=x("circle");t.canvas&&t.canvas.appendChild(n);var a=new S(n,t);return a.attrs={cx:e,cy:r,r:i,fill:"none",stroke:"#000"},a.type="circle",x(n,a.attrs),a},t._engine.rect=function(t,e,r,i,n,a){var s=x("rect");t.canvas&&t.canvas.appendChild(s);var o=new S(s,t);return o.attrs={x:e,y:r,width:i,height:n,rx:a||0,ry:a||0,fill:"none",stroke:"#000"},o.type="rect",x(s,o.attrs),o},t._engine.ellipse=function(t,e,r,i,n){var a=x("ellipse");t.canvas&&t.canvas.appendChild(a);var s=new S(a,t);return s.attrs={cx:e,cy:r,rx:i,ry:n,fill:"none",stroke:"#000"},s.type="ellipse",x(a,s.attrs),s},t._engine.image=function(t,e,r,i,n,a){var s=x("image");x(s,{x:r,y:i,width:n,height:a,preserveAspectRatio:"none"}),s.setAttributeNS(p,"href",e),t.canvas&&t.canvas.appendChild(s);var o=new S(s,t);return o.attrs={x:r,y:i,width:n,height:a,src:e},o.type="image",o},t._engine.text=function(e,r,i,n){var a=x("text");e.canvas&&e.canvas.appendChild(a);var s=new S(a,e);return s.attrs={x:r,y:i,"text-anchor":"middle",text:n,"font-family":t._availableAttrs["font-family"],"font-size":t._availableAttrs["font-size"],stroke:"none",fill:"#000"},s.type="text",k(s,s.attrs),s},t._engine.setSize=function(t,e){return this.width=t||this.width,this.height=e||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox),this},t._engine.create=function(){var e=t._getContainer.apply(0,arguments),r=e&&e.container;if(!r)throw new Error("SVG container not found.");var i,n=e.x,a=e.y,s=e.width,o=e.height,l=x("svg"),h="overflow:hidden;";return n=n||0,a=a||0,x(l,{height:o=o||342,version:1.1,width:s=s||512,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}),1==r?(l.style.cssText=h+"position:absolute;left:"+n+"px;top:"+a+"px",t._g.doc.body.appendChild(l),i=1):(l.style.cssText=h+"position:relative",r.firstChild?r.insertBefore(l,r.firstChild):r.appendChild(l)),(r=new t._Paper).width=s,r.height=o,r.canvas=l,r.clear(),r._left=r._top=0,i&&(r.renderfix=function(){}),r.renderfix(),r},t._engine.setViewBox=function(t,e,r,i,n){u("raphael.setViewBox",this,this._viewBox,[t,e,r,i,n]);var a,o,l=this.getSize(),h=s(r/l.width,i/l.height),c=this.top,p=n?"xMidYMid meet":"xMinYMin";for(null==t?(this._vbSize&&(h=1),delete this._vbSize,a="0 0 "+this.width+f+this.height):(this._vbSize=h,a=t+f+e+f+r+f+i),x(this.canvas,{viewBox:a,preserveAspectRatio:p});h&&c;)o="stroke-width"in c.attrs?c.attrs["stroke-width"]:1,c.attr({"stroke-width":o}),c._.dirty=1,c._.dirtyT=1,c=c.prev;return this._viewBox=[t,e,r,i,!!n],this},t.prototype.renderfix=function(){var t,e=this.canvas,r=e.style;try{t=e.getScreenCTM()||e.createSVGMatrix()}catch(r){t=e.createSVGMatrix()}var i=-t.e%1,n=-t.f%1;(i||n)&&(i&&(this._left=(this._left+i)%1,r.left=this._left+"px"),n&&(this._top=(this._top+n)%1,r.top=this._top+"px"))},t.prototype.clear=function(){t.eve("raphael.clear",this);for(var e=this.canvas;e.firstChild;)e.removeChild(e.firstChild);this.bottom=this.top=null,(this.desc=x("desc")).appendChild(t._g.doc.createTextNode("Created with Raphaël "+t.version)),e.appendChild(this.desc),e.appendChild(this.defs=x("defs"))},t.prototype.remove=function(){for(var e in u("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this)this[e]="function"==typeof this[e]?t._removedFactory(e):null};var A=t.st;for(var M in T)T[e](M)&&!A[e](M)&&(A[M]=function(t){return function(){var e=arguments;return this.forEach(function(r){r[t].apply(r,e)})}}(M))}}.apply(e,i))||(t.exports=n)},function(t,e,r){var i,n;i=[r(0)],void 0===(n=function(t){if(!t||t.vml){var e="hasOwnProperty",r=String,i=parseFloat,n=Math,a=n.round,s=n.max,o=n.min,l=n.abs,h=/[, ]+/,u=t.eve,c=" ",f="",p={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},d=/([clmz]),?([^clmz]*)/gi,g=/ progid:\\S+Blur\\([^\\)]+\\)/g,x=/-?[^,\\s-]+/g,v="position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)",y=21600,m={path:1,rect:1,image:1},b={circle:1,ellipse:1},_=function(e,r,i){var n=t.matrix();return n.rotate(-e,.5,.5),{dx:n.x(r,i),dy:n.y(r,i)}},w=function(t,e,r,i,n,a){var s=t._,o=t.matrix,h=s.fillpos,u=t.node,f=u.style,p=1,d="",g=y/e,x=y/r;if(f.visibility="hidden",e&&r){if(u.coordsize=l(g)+c+l(x),f.rotation=a*(e*r<0?-1:1),a){var v=_(a,i,n);i=v.dx,n=v.dy}if(e<0&&(d+="x"),r<0&&(d+=" y")&&(p=-1),f.flip=d,u.coordorigin=i*-g+c+n*-x,h||s.fillsize){var m=u.getElementsByTagName("fill");m=m&&m[0],u.removeChild(m),h&&(v=_(a,o.x(h[0],h[1]),o.y(h[0],h[1])),m.position=v.dx*p+c+v.dy*p),s.fillsize&&(m.size=s.fillsize[0]*l(e)+c+s.fillsize[1]*l(r)),u.appendChild(m)}f.visibility="visible"}};t.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\\nYou are running Raphaël "+this.version};var k,B=function(t,e,i){for(var n=r(e).toLowerCase().split("-"),a=i?"end":"start",s=n.length,o="classic",l="medium",h="medium";s--;)switch(n[s]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":o=n[s];break;case"wide":case"narrow":h=n[s];break;case"long":case"short":l=n[s]}var u=t.node.getElementsByTagName("stroke")[0];u[a+"arrow"]=o,u[a+"arrowlength"]=l,u[a+"arrowwidth"]=h},C=function(n,l){n.attrs=n.attrs||{};var u=n.node,g=n.attrs,v=u.style,_=m[n.type]&&(l.x!=g.x||l.y!=g.y||l.width!=g.width||l.height!=g.height||l.cx!=g.cx||l.cy!=g.cy||l.rx!=g.rx||l.ry!=g.ry||l.r!=g.r),C=b[n.type]&&(g.cx!=l.cx||g.cy!=l.cy||g.r!=l.r||g.rx!=l.rx||g.ry!=l.ry),T=n;for(var A in l)l[e](A)&&(g[A]=l[A]);if(_&&(g.path=t._getPath[n.type](n),n._.dirty=1),l.href&&(u.href=l.href),l.title&&(u.title=l.title),l.target&&(u.target=l.target),l.cursor&&(v.cursor=l.cursor),"blur"in l&&n.blur(l.blur),(l.path&&"path"==n.type||_)&&(u.path=function(e){var i=/[ahqstv]/gi,n=t._pathToAbsolute;if(r(e).match(i)&&(n=t._path2curve),i=/[clmz]/g,n==t._pathToAbsolute&&!r(e).match(i)){var s=r(e).replace(d,function(t,e,r){var i=[],n="m"==e.toLowerCase(),s=p[e];return r.replace(x,function(t){n&&2==i.length&&(s+=i+p["m"==e?"l":"L"],i=[]),i.push(a(t*y))}),s+i});return s}var o,l,h=n(e);s=[];for(var u=0,g=h.length;u<g;u++){o=h[u],"z"==(l=h[u][0].toLowerCase())&&(l="x");for(var v=1,m=o.length;v<m;v++)l+=a(o[v]*y)+(v!=m-1?",":f);s.push(l)}return s.join(c)}(~r(g.path).toLowerCase().indexOf("r")?t._pathToAbsolute(g.path):g.path),n._.dirty=1,"image"==n.type&&(n._.fillpos=[g.x,g.y],n._.fillsize=[g.width,g.height],w(n,1,1,0,0,0))),"transform"in l&&n.transform(l.transform),C){var M=+g.cx,E=+g.cy,N=+g.rx||+g.r||0,L=+g.ry||+g.r||0;u.path=t.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",a((M-N)*y),a((E-L)*y),a((M+N)*y),a((E+L)*y),a(M*y)),n._.dirty=1}if("clip-rect"in l){var P=r(l["clip-rect"]).split(h);if(4==P.length){P[2]=+P[2]+ +P[0],P[3]=+P[3]+ +P[1];var z=u.clipRect||t._g.doc.createElement("div"),F=z.style;F.clip=t.format("rect({1}px {2}px {3}px {0}px)",P),u.clipRect||(F.position="absolute",F.top=0,F.left=0,F.width=n.paper.width+"px",F.height=n.paper.height+"px",u.parentNode.insertBefore(z,u),z.appendChild(u),u.clipRect=z)}l["clip-rect"]||u.clipRect&&(u.clipRect.style.clip="auto")}if(n.textpath){var R=n.textpath.style;l.font&&(R.font=l.font),l["font-family"]&&(R.fontFamily=\'"\'+l["font-family"].split(",")[0].replace(/^[\'"]+|[\'"]+$/g,f)+\'"\'),l["font-size"]&&(R.fontSize=l["font-size"]),l["font-weight"]&&(R.fontWeight=l["font-weight"]),l["font-style"]&&(R.fontStyle=l["font-style"])}if("arrow-start"in l&&B(T,l["arrow-start"]),"arrow-end"in l&&B(T,l["arrow-end"],1),null!=l.opacity||null!=l.fill||null!=l.src||null!=l.stroke||null!=l["stroke-width"]||null!=l["stroke-opacity"]||null!=l["fill-opacity"]||null!=l["stroke-dasharray"]||null!=l["stroke-miterlimit"]||null!=l["stroke-linejoin"]||null!=l["stroke-linecap"]){var j=u.getElementsByTagName("fill");if(!(j=j&&j[0])&&(j=k("fill")),"image"==n.type&&l.src&&(j.src=l.src),l.fill&&(j.on=!0),null!=j.on&&"none"!=l.fill&&null!==l.fill||(j.on=!1),j.on&&l.fill){var I=r(l.fill).match(t._ISURL);if(I){j.parentNode==u&&u.removeChild(j),j.rotate=!0,j.src=I[1],j.type="tile";var D=n.getBBox(1);j.position=D.x+c+D.y,n._.fillpos=[D.x,D.y],t._preload(I[1],function(){n._.fillsize=[this.offsetWidth,this.offsetHeight]})}else j.color=t.getRGB(l.fill).hex,j.src=f,j.type="solid",t.getRGB(l.fill).error&&(T.type in{circle:1,ellipse:1}||"r"!=r(l.fill).charAt())&&S(T,l.fill,j)&&(g.fill="none",g.gradient=l.fill,j.rotate=!1)}if("fill-opacity"in l||"opacity"in l){var q=((+g["fill-opacity"]+1||2)-1)*((+g.opacity+1||2)-1)*((+t.getRGB(l.fill).o+1||2)-1);q=o(s(q,0),1),j.opacity=q,j.src&&(j.color="none")}u.appendChild(j);var O=u.getElementsByTagName("stroke")&&u.getElementsByTagName("stroke")[0],V=!1;!O&&(V=O=k("stroke")),(l.stroke&&"none"!=l.stroke||l["stroke-width"]||null!=l["stroke-opacity"]||l["stroke-dasharray"]||l["stroke-miterlimit"]||l["stroke-linejoin"]||l["stroke-linecap"])&&(O.on=!0),("none"==l.stroke||null===l.stroke||null==O.on||0==l.stroke||0==l["stroke-width"])&&(O.on=!1);var W=t.getRGB(l.stroke);O.on&&l.stroke&&(O.color=W.hex),q=((+g["stroke-opacity"]+1||2)-1)*((+g.opacity+1||2)-1)*((+W.o+1||2)-1);var Y=.75*(i(l["stroke-width"])||1);if(q=o(s(q,0),1),null==l["stroke-width"]&&(Y=g["stroke-width"]),l["stroke-width"]&&(O.weight=Y),Y&&Y<1&&(q*=Y)&&(O.weight=1),O.opacity=q,l["stroke-linejoin"]&&(O.joinstyle=l["stroke-linejoin"]||"miter"),O.miterlimit=l["stroke-miterlimit"]||8,l["stroke-linecap"]&&(O.endcap="butt"==l["stroke-linecap"]?"flat":"square"==l["stroke-linecap"]?"square":"round"),"stroke-dasharray"in l){var G={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};O.dashstyle=G[e](l["stroke-dasharray"])?G[l["stroke-dasharray"]]:f}V&&u.appendChild(O)}if("text"==T.type){T.paper.canvas.style.display=f;var H=T.paper.span,X=g.font&&g.font.match(/\\d+(?:\\.\\d*)?(?=px)/);v=H.style,g.font&&(v.font=g.font),g["font-family"]&&(v.fontFamily=g["font-family"]),g["font-weight"]&&(v.fontWeight=g["font-weight"]),g["font-style"]&&(v.fontStyle=g["font-style"]),X=i(g["font-size"]||X&&X[0])||10,v.fontSize=100*X+"px",T.textpath.string&&(H.innerHTML=r(T.textpath.string).replace(/</g,"<").replace(/&/g,"&").replace(/\\n/g,"<br>"));var U=H.getBoundingClientRect();T.W=g.w=(U.right-U.left)/100,T.H=g.h=(U.bottom-U.top)/100,T.X=g.x,T.Y=g.y+T.H/2,("x"in l||"y"in l)&&(T.path.v=t.format("m{0},{1}l{2},{1}",a(g.x*y),a(g.y*y),a(g.x*y)+1));for(var $=["x","y","text","font","font-family","font-weight","font-style","font-size"],Z=0,Q=$.length;Z<Q;Z++)if($[Z]in l){T._.dirty=1;break}switch(g["text-anchor"]){case"start":T.textpath.style["v-text-align"]="left",T.bbx=T.W/2;break;case"end":T.textpath.style["v-text-align"]="right",T.bbx=-T.W/2;break;default:T.textpath.style["v-text-align"]="center",T.bbx=0}T.textpath.style["v-text-kern"]=!0}},S=function(e,a,s){e.attrs=e.attrs||{};e.attrs;var o=Math.pow,l="linear",h=".5 .5";if(e.attrs.gradient=a,a=(a=r(a).replace(t._radial_gradient,function(t,e,r){return l="radial",e&&r&&(e=i(e),r=i(r),o(e-.5,2)+o(r-.5,2)>.25&&(r=n.sqrt(.25-o(e-.5,2))*(2*(r>.5)-1)+.5),h=e+c+r),f})).split(/\\s*\\-\\s*/),"linear"==l){var u=a.shift();if(u=-i(u),isNaN(u))return null}var p=t._parseDots(a);if(!p)return null;if(e=e.shape||e.node,p.length){e.removeChild(s),s.on=!0,s.method="none",s.color=p[0].color,s.color2=p[p.length-1].color;for(var d=[],g=0,x=p.length;g<x;g++)p[g].offset&&d.push(p[g].offset+c+p[g].color);s.colors=d.length?d.join():"0% "+s.color,"radial"==l?(s.type="gradientTitle",s.focus="100%",s.focussize="0 0",s.focusposition=h,s.angle=0):(s.type="gradient",s.angle=(270-u)%360),e.appendChild(s)}return 1},T=function(e,r){this[0]=this.node=e,e.raphael=!0,this.id=t._oid++,e.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=r,this.matrix=t.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!r.bottom&&(r.bottom=this),this.prev=r.top,r.top&&(r.top.next=this),r.top=this,this.next=null},A=t.el;T.prototype=A,A.constructor=T,A.transform=function(e){if(null==e)return this._.transform;var i,n=this.paper._viewBoxShift,a=n?"s"+[n.scale,n.scale]+"-1-1t"+[n.dx,n.dy]:f;n&&(i=e=r(e).replace(/\\.{3}|\\u2026/g,this._.transform||f)),t._extractTransform(this,a+e);var s,o=this.matrix.clone(),l=this.skew,h=this.node,u=~r(this.attrs.fill).indexOf("-"),p=!r(this.attrs.fill).indexOf("url(");if(o.translate(1,1),p||u||"image"==this.type)if(l.matrix="1 0 0 1",l.offset="0 0",s=o.split(),u&&s.noRotation||!s.isSimple){h.style.filter=o.toFilter();var d=this.getBBox(),g=this.getBBox(1),x=d.x-g.x,v=d.y-g.y;h.coordorigin=x*-y+c+v*-y,w(this,1,1,x,v,0)}else h.style.filter=f,w(this,s.scalex,s.scaley,s.dx,s.dy,s.rotate);else h.style.filter=f,l.matrix=r(o),l.offset=o.offset();return null!==i&&(this._.transform=i,t._extractTransform(this,i)),this},A.rotate=function(t,e,n){if(this.removed)return this;if(null!=t){if((t=r(t).split(h)).length-1&&(e=i(t[1]),n=i(t[2])),t=i(t[0]),null==n&&(e=n),null==e||null==n){var a=this.getBBox(1);e=a.x+a.width/2,n=a.y+a.height/2}return this._.dirtyT=1,this.transform(this._.transform.concat([["r",t,e,n]])),this}},A.translate=function(t,e){return this.removed?this:((t=r(t).split(h)).length-1&&(e=i(t[1])),t=i(t[0])||0,e=+e||0,this._.bbox&&(this._.bbox.x+=t,this._.bbox.y+=e),this.transform(this._.transform.concat([["t",t,e]])),this)},A.scale=function(t,e,n,a){if(this.removed)return this;if((t=r(t).split(h)).length-1&&(e=i(t[1]),n=i(t[2]),a=i(t[3]),isNaN(n)&&(n=null),isNaN(a)&&(a=null)),t=i(t[0]),null==e&&(e=t),null==a&&(n=a),null==n||null==a)var s=this.getBBox(1);return n=null==n?s.x+s.width/2:n,a=null==a?s.y+s.height/2:a,this.transform(this._.transform.concat([["s",t,e,n,a]])),this._.dirtyT=1,this},A.hide=function(){return!this.removed&&(this.node.style.display="none"),this},A.show=function(){return!this.removed&&(this.node.style.display=f),this},A.auxGetBBox=t.el.getBBox,A.getBBox=function(){var t=this.auxGetBBox();if(this.paper&&this.paper._viewBoxShift){var e={},r=1/this.paper._viewBoxShift.scale;return e.x=t.x-this.paper._viewBoxShift.dx,e.x*=r,e.y=t.y-this.paper._viewBoxShift.dy,e.y*=r,e.width=t.width*r,e.height=t.height*r,e.x2=e.x+e.width,e.y2=e.y+e.height,e}return t},A._getBBox=function(){return this.removed?{}:{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},A.remove=function(){if(!this.removed&&this.node.parentNode){for(var e in this.paper.__set__&&this.paper.__set__.exclude(this),t.eve.unbind("raphael.*.*."+this.id),t._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape),this)this[e]="function"==typeof this[e]?t._removedFactory(e):null;this.removed=!0}},A.attr=function(r,i){if(this.removed)return this;if(null==r){var n={};for(var a in this.attrs)this.attrs[e](a)&&(n[a]=this.attrs[a]);return n.gradient&&"none"==n.fill&&(n.fill=n.gradient)&&delete n.gradient,n.transform=this._.transform,n}if(null==i&&t.is(r,"string")){if("fill"==r&&"none"==this.attrs.fill&&this.attrs.gradient)return this.attrs.gradient;for(var s=r.split(h),o={},l=0,c=s.length;l<c;l++)(r=s[l])in this.attrs?o[r]=this.attrs[r]:t.is(this.paper.customAttributes[r],"function")?o[r]=this.paper.customAttributes[r].def:o[r]=t._availableAttrs[r];return c-1?o:o[s[0]]}if(this.attrs&&null==i&&t.is(r,"array")){for(o={},l=0,c=r.length;l<c;l++)o[r[l]]=this.attr(r[l]);return o}var f;for(var p in null!=i&&((f={})[r]=i),null==i&&t.is(r,"object")&&(f=r),f)u("raphael.attr."+p+"."+this.id,this,f[p]);if(f){for(p in this.paper.customAttributes)if(this.paper.customAttributes[e](p)&&f[e](p)&&t.is(this.paper.customAttributes[p],"function")){var d=this.paper.customAttributes[p].apply(this,[].concat(f[p]));for(var g in this.attrs[p]=f[p],d)d[e](g)&&(f[g]=d[g])}f.text&&"text"==this.type&&(this.textpath.string=f.text),C(this,f)}return this},A.toFront=function(){return!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&t._tofront(this,this.paper),this},A.toBack=function(){return this.removed?this:(this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),t._toback(this,this.paper)),this)},A.insertAfter=function(e){return this.removed?this:(e.constructor==t.st.constructor&&(e=e[e.length-1]),e.node.nextSibling?e.node.parentNode.insertBefore(this.node,e.node.nextSibling):e.node.parentNode.appendChild(this.node),t._insertafter(this,e,this.paper),this)},A.insertBefore=function(e){return this.removed?this:(e.constructor==t.st.constructor&&(e=e[0]),e.node.parentNode.insertBefore(this.node,e.node),t._insertbefore(this,e,this.paper),this)},A.blur=function(e){var r=this.node.runtimeStyle,i=r.filter;return i=i.replace(g,f),0!=+e?(this.attrs.blur=e,r.filter=i+c+" progid:DXImageTransform.Microsoft.Blur(pixelradius="+(+e||1.5)+")",r.margin=t.format("-{0}px 0 0 -{0}px",a(+e||1.5))):(r.filter=i,r.margin=0,delete this.attrs.blur),this},t._engine.path=function(t,e){var r=k("shape");r.style.cssText=v,r.coordsize=y+c+y,r.coordorigin=e.coordorigin;var i=new T(r,e),n={fill:"none",stroke:"#000"};t&&(n.path=t),i.type="path",i.path=[],i.Path=f,C(i,n),e.canvas&&e.canvas.appendChild(r);var a=k("skew");return a.on=!0,r.appendChild(a),i.skew=a,i.transform(f),i},t._engine.rect=function(e,r,i,n,a,s){var o=t._rectPath(r,i,n,a,s),l=e.path(o),h=l.attrs;return l.X=h.x=r,l.Y=h.y=i,l.W=h.width=n,l.H=h.height=a,h.r=s,h.path=o,l.type="rect",l},t._engine.ellipse=function(t,e,r,i,n){var a=t.path();a.attrs;return a.X=e-i,a.Y=r-n,a.W=2*i,a.H=2*n,a.type="ellipse",C(a,{cx:e,cy:r,rx:i,ry:n}),a},t._engine.circle=function(t,e,r,i){var n=t.path();n.attrs;return n.X=e-i,n.Y=r-i,n.W=n.H=2*i,n.type="circle",C(n,{cx:e,cy:r,r:i}),n},t._engine.image=function(e,r,i,n,a,s){var o=t._rectPath(i,n,a,s),l=e.path(o).attr({stroke:"none"}),h=l.attrs,u=l.node,c=u.getElementsByTagName("fill")[0];return h.src=r,l.X=h.x=i,l.Y=h.y=n,l.W=h.width=a,l.H=h.height=s,h.path=o,l.type="image",c.parentNode==u&&u.removeChild(c),c.rotate=!0,c.src=r,c.type="tile",l._.fillpos=[i,n],l._.fillsize=[a,s],u.appendChild(c),w(l,1,1,0,0,0),l},t._engine.text=function(e,i,n,s){var o=k("shape"),l=k("path"),h=k("textpath");i=i||0,n=n||0,s=s||"",l.v=t.format("m{0},{1}l{2},{1}",a(i*y),a(n*y),a(i*y)+1),l.textpathok=!0,h.string=r(s),h.on=!0,o.style.cssText=v,o.coordsize=y+c+y,o.coordorigin="0 0";var u=new T(o,e),p={fill:"#000",stroke:"none",font:t._availableAttrs.font,text:s};u.shape=o,u.path=l,u.textpath=h,u.type="text",u.attrs.text=r(s),u.attrs.x=i,u.attrs.y=n,u.attrs.w=1,u.attrs.h=1,C(u,p),o.appendChild(h),o.appendChild(l),e.canvas.appendChild(o);var d=k("skew");return d.on=!0,o.appendChild(d),u.skew=d,u.transform(f),u},t._engine.setSize=function(e,r){var i=this.canvas.style;return this.width=e,this.height=r,e==+e&&(e+="px"),r==+r&&(r+="px"),i.width=e,i.height=r,i.clip="rect(0 "+e+" "+r+" 0)",this._viewBox&&t._engine.setViewBox.apply(this,this._viewBox),this},t._engine.setViewBox=function(e,r,i,n,a){t.eve("raphael.setViewBox",this,this._viewBox,[e,r,i,n,a]);var s,o,l=this.getSize(),h=l.width,u=l.height;return a&&(i*(s=u/n)<h&&(e-=(h-i*s)/2/s),n*(o=h/i)<u&&(r-=(u-n*o)/2/o)),this._viewBox=[e,r,i,n,!!a],this._viewBoxShift={dx:-e,dy:-r,scale:l},this.forEach(function(t){t.transform("...")}),this},t._engine.initWin=function(t){var e=t.document;e.styleSheets.length<31?e.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)"):e.styleSheets[0].addRule(".rvml","behavior:url(#default#VML)");try{!e.namespaces.rvml&&e.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),k=function(t){return e.createElement("<rvml:"+t+\' class="rvml">\')}}catch(t){k=function(t){return e.createElement("<"+t+\' xmlns="urn:schemas-microsoft.com:vml" class="rvml">\')}}},t._engine.initWin(t._g.win),t._engine.create=function(){var e=t._getContainer.apply(0,arguments),r=e.container,i=e.height,n=e.width,a=e.x,s=e.y;if(!r)throw new Error("VML container not found.");var o=new t._Paper,l=o.canvas=t._g.doc.createElement("div"),h=l.style;return a=a||0,s=s||0,n=n||512,i=i||342,o.width=n,o.height=i,n==+n&&(n+="px"),i==+i&&(i+="px"),o.coordsize=216e5+c+216e5,o.coordorigin="0 0",o.span=t._g.doc.createElement("span"),o.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",l.appendChild(o.span),h.cssText=t.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",n,i),1==r?(t._g.doc.body.appendChild(l),h.left=a+"px",h.top=s+"px",h.position="absolute"):r.firstChild?r.insertBefore(l,r.firstChild):r.appendChild(l),o.renderfix=function(){},o},t.prototype.clear=function(){t.eve("raphael.clear",this),this.canvas.innerHTML=f,this.span=t._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},t.prototype.remove=function(){for(var e in t.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas),this)this[e]="function"==typeof this[e]?t._removedFactory(e):null;return!0};var M=t.st;for(var E in A)A[e](E)&&!M[e](E)&&(M[E]=function(t){return function(){var e=arguments;return this.forEach(function(r){r[t].apply(r,e)})}}(E))}}.apply(e,i))||(t.exports=n)}])});\n\n//# sourceURL=webpack://web/./node_modules/raphael/raphael.min.js?')},"./node_modules/safe-json-parse/tuple.js":module=>{eval("module.exports = SafeParseTuple\n\nfunction SafeParseTuple(obj, reviver) {\n var json\n var error = null\n\n try {\n json = JSON.parse(obj, reviver)\n } catch (err) {\n error = err\n }\n\n return [error, json]\n}\n\n\n//# sourceURL=webpack://web/./node_modules/safe-json-parse/tuple.js?")},"./node_modules/twemoji-parser/dist/index.js":(__unused_webpack_module,exports,__webpack_require__)=>{"use strict";eval("\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.TypeName = undefined;\nexports.parse = parse;\nexports.toCodePoints = toCodePoints;\n\nvar _regex = __webpack_require__(/*! ./lib/regex */ \"./node_modules/twemoji-parser/dist/lib/regex.js\");\n\nvar _regex2 = _interopRequireDefault(_regex);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar TypeName = exports.TypeName = 'emoji';\n// Copyright Twitter Inc. Licensed under MIT\n// https://github.com/twitter/twemoji-parser/blob/master/LICENSE.md\nfunction parse(text, options) {\n var assetType = options && options.assetType ? options.assetType : 'svg';\n var getTwemojiUrl = options && options.buildUrl ? options.buildUrl : function (codepoints, assetType) {\n return assetType === 'png' ? 'https://twemoji.maxcdn.com/2/72x72/' + codepoints + '.png' : 'https://twemoji.maxcdn.com/2/svg/' + codepoints + '.svg';\n };\n\n var entities = [];\n\n _regex2.default.lastIndex = 0;\n while (true) {\n var result = _regex2.default.exec(text);\n if (!result) {\n break;\n }\n\n var emojiText = result[0];\n var codepoints = toCodePoints(removeVS16s(emojiText)).join('-');\n\n entities.push({\n url: codepoints ? getTwemojiUrl(codepoints, assetType) : '',\n indices: [result.index, _regex2.default.lastIndex],\n text: emojiText,\n type: TypeName\n });\n }\n return entities;\n}\n\nvar vs16RegExp = /\\uFE0F/g;\n// avoid using a string literal like '\\u200D' here because minifiers expand it inline\nvar zeroWidthJoiner = String.fromCharCode(0x200d);\n\nvar removeVS16s = function removeVS16s(rawEmoji) {\n return rawEmoji.indexOf(zeroWidthJoiner) < 0 ? rawEmoji.replace(vs16RegExp, '') : rawEmoji;\n};\n\nfunction toCodePoints(unicodeSurrogates) {\n var points = [];\n var char = 0;\n var previous = 0;\n var i = 0;\n while (i < unicodeSurrogates.length) {\n char = unicodeSurrogates.charCodeAt(i++);\n if (previous) {\n points.push((0x10000 + (previous - 0xd800 << 10) + (char - 0xdc00)).toString(16));\n previous = 0;\n } else if (char > 0xd800 && char <= 0xdbff) {\n previous = char;\n } else {\n points.push(char.toString(16));\n }\n }\n return points;\n}\n\n//# sourceURL=webpack://web/./node_modules/twemoji-parser/dist/index.js?")},"./node_modules/twemoji-parser/dist/lib/regex.js":(__unused_webpack_module,exports)=>{"use strict";eval('\n\nObject.defineProperty(exports, "__esModule", ({\n value: true\n}));\n// Copyright Twitter Inc. Licensed under MIT\n// https://github.com/twitter/twemoji-parser/blob/master/LICENSE.md\n\n// This file is auto-generated\nexports["default"] = /(?:\\ud83d[\\udc68\\udc69])(?:\\ud83c[\\udffb-\\udfff])?\\u200d(?:\\u2695\\ufe0f|\\u2696\\ufe0f|\\u2708\\ufe0f|\\ud83c[\\udf3e\\udf73\\udf93\\udfa4\\udfa8\\udfeb\\udfed]|\\ud83d[\\udcbb\\udcbc\\udd27\\udd2c\\ude80\\ude92]|\\ud83e[\\uddb0-\\uddb3])|(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75]|\\u26f9)((?:\\ud83c[\\udffb-\\udfff]|\\ufe0f)\\u200d[\\u2640\\u2642]\\ufe0f)|(?:\\ud83c[\\udfc3\\udfc4\\udfca]|\\ud83d[\\udc6e\\udc71\\udc73\\udc77\\udc81\\udc82\\udc86\\udc87\\ude45-\\ude47\\ude4b\\ude4d\\ude4e\\udea3\\udeb4-\\udeb6]|\\ud83e[\\udd26\\udd35\\udd37-\\udd39\\udd3d\\udd3e\\uddb8\\uddb9\\uddd6-\\udddd])(?:\\ud83c[\\udffb-\\udfff])?\\u200d[\\u2640\\u2642]\\ufe0f|(?:\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d\\udc68|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc8b\\u200d\\ud83d[\\udc68\\udc69]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\u2764\\ufe0f\\u200d\\ud83d\\udc68|\\ud83d\\udc68\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc68\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc68\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\u2764\\ufe0f\\u200d\\ud83d[\\udc68\\udc69]|\\ud83d\\udc69\\u200d\\ud83d\\udc66\\u200d\\ud83d\\udc66|\\ud83d\\udc69\\u200d\\ud83d\\udc67\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83c\\udff3\\ufe0f\\u200d\\ud83c\\udf08|\\ud83c\\udff4\\u200d\\u2620\\ufe0f|\\ud83d\\udc41\\u200d\\ud83d\\udde8|\\ud83d\\udc68\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc69\\u200d\\ud83d[\\udc66\\udc67]|\\ud83d\\udc6f\\u200d\\u2640\\ufe0f|\\ud83d\\udc6f\\u200d\\u2642\\ufe0f|\\ud83e\\udd3c\\u200d\\u2640\\ufe0f|\\ud83e\\udd3c\\u200d\\u2642\\ufe0f|\\ud83e\\uddde\\u200d\\u2640\\ufe0f|\\ud83e\\uddde\\u200d\\u2642\\ufe0f|\\ud83e\\udddf\\u200d\\u2640\\ufe0f|\\ud83e\\udddf\\u200d\\u2642\\ufe0f)|[#*0-9]\\ufe0f?\\u20e3|(?:[©®\\u2122\\u265f]\\ufe0f)|(?:\\ud83c[\\udc04\\udd70\\udd71\\udd7e\\udd7f\\ude02\\ude1a\\ude2f\\ude37\\udf21\\udf24-\\udf2c\\udf36\\udf7d\\udf96\\udf97\\udf99-\\udf9b\\udf9e\\udf9f\\udfcd\\udfce\\udfd4-\\udfdf\\udff3\\udff5\\udff7]|\\ud83d[\\udc3f\\udc41\\udcfd\\udd49\\udd4a\\udd6f\\udd70\\udd73\\udd76-\\udd79\\udd87\\udd8a-\\udd8d\\udda5\\udda8\\uddb1\\uddb2\\uddbc\\uddc2-\\uddc4\\uddd1-\\uddd3\\udddc-\\uddde\\udde1\\udde3\\udde8\\uddef\\uddf3\\uddfa\\udecb\\udecd-\\udecf\\udee0-\\udee5\\udee9\\udef0\\udef3]|[\\u203c\\u2049\\u2139\\u2194-\\u2199\\u21a9\\u21aa\\u231a\\u231b\\u2328\\u23cf\\u23ed-\\u23ef\\u23f1\\u23f2\\u23f8-\\u23fa\\u24c2\\u25aa\\u25ab\\u25b6\\u25c0\\u25fb-\\u25fe\\u2600-\\u2604\\u260e\\u2611\\u2614\\u2615\\u2618\\u2620\\u2622\\u2623\\u2626\\u262a\\u262e\\u262f\\u2638-\\u263a\\u2640\\u2642\\u2648-\\u2653\\u2660\\u2663\\u2665\\u2666\\u2668\\u267b\\u267f\\u2692-\\u2697\\u2699\\u269b\\u269c\\u26a0\\u26a1\\u26aa\\u26ab\\u26b0\\u26b1\\u26bd\\u26be\\u26c4\\u26c5\\u26c8\\u26cf\\u26d1\\u26d3\\u26d4\\u26e9\\u26ea\\u26f0-\\u26f5\\u26f8\\u26fa\\u26fd\\u2702\\u2708\\u2709\\u270f\\u2712\\u2714\\u2716\\u271d\\u2721\\u2733\\u2734\\u2744\\u2747\\u2757\\u2763\\u2764\\u27a1\\u2934\\u2935\\u2b05-\\u2b07\\u2b1b\\u2b1c\\u2b50\\u2b55\\u3030\\u303d\\u3297\\u3299])(?:\\ufe0f|(?!\\ufe0e))|(?:(?:\\ud83c[\\udfcb\\udfcc]|\\ud83d[\\udd74\\udd75\\udd90]|[\\u261d\\u26f7\\u26f9\\u270c\\u270d])(?:\\ufe0f|(?!\\ufe0e))|(?:\\ud83c[\\udf85\\udfc2-\\udfc4\\udfc7\\udfca]|\\ud83d[\\udc42\\udc43\\udc46-\\udc50\\udc66-\\udc69\\udc6e\\udc70-\\udc78\\udc7c\\udc81-\\udc83\\udc85-\\udc87\\udcaa\\udd7a\\udd95\\udd96\\ude45-\\ude47\\ude4b-\\ude4f\\udea3\\udeb4-\\udeb6\\udec0\\udecc]|\\ud83e[\\udd18-\\udd1c\\udd1e\\udd1f\\udd26\\udd30-\\udd39\\udd3d\\udd3e\\uddb5\\uddb6\\uddb8\\uddb9\\uddd1-\\udddd]|[\\u270a\\u270b]))(?:\\ud83c[\\udffb-\\udfff])?|(?:\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc65\\udb40\\udc6e\\udb40\\udc67\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc73\\udb40\\udc63\\udb40\\udc74\\udb40\\udc7f|\\ud83c\\udff4\\udb40\\udc67\\udb40\\udc62\\udb40\\udc77\\udb40\\udc6c\\udb40\\udc73\\udb40\\udc7f|\\ud83c\\udde6\\ud83c[\\udde8-\\uddec\\uddee\\uddf1\\uddf2\\uddf4\\uddf6-\\uddfa\\uddfc\\uddfd\\uddff]|\\ud83c\\udde7\\ud83c[\\udde6\\udde7\\udde9-\\uddef\\uddf1-\\uddf4\\uddf6-\\uddf9\\uddfb\\uddfc\\uddfe\\uddff]|\\ud83c\\udde8\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\uddee\\uddf0-\\uddf5\\uddf7\\uddfa-\\uddff]|\\ud83c\\udde9\\ud83c[\\uddea\\uddec\\uddef\\uddf0\\uddf2\\uddf4\\uddff]|\\ud83c\\uddea\\ud83c[\\udde6\\udde8\\uddea\\uddec\\udded\\uddf7-\\uddfa]|\\ud83c\\uddeb\\ud83c[\\uddee-\\uddf0\\uddf2\\uddf4\\uddf7]|\\ud83c\\uddec\\ud83c[\\udde6\\udde7\\udde9-\\uddee\\uddf1-\\uddf3\\uddf5-\\uddfa\\uddfc\\uddfe]|\\ud83c\\udded\\ud83c[\\uddf0\\uddf2\\uddf3\\uddf7\\uddf9\\uddfa]|\\ud83c\\uddee\\ud83c[\\udde8-\\uddea\\uddf1-\\uddf4\\uddf6-\\uddf9]|\\ud83c\\uddef\\ud83c[\\uddea\\uddf2\\uddf4\\uddf5]|\\ud83c\\uddf0\\ud83c[\\uddea\\uddec-\\uddee\\uddf2\\uddf3\\uddf5\\uddf7\\uddfc\\uddfe\\uddff]|\\ud83c\\uddf1\\ud83c[\\udde6-\\udde8\\uddee\\uddf0\\uddf7-\\uddfb\\uddfe]|\\ud83c\\uddf2\\ud83c[\\udde6\\udde8-\\udded\\uddf0-\\uddff]|\\ud83c\\uddf3\\ud83c[\\udde6\\udde8\\uddea-\\uddec\\uddee\\uddf1\\uddf4\\uddf5\\uddf7\\uddfa\\uddff]|\\ud83c\\uddf4\\ud83c\\uddf2|\\ud83c\\uddf5\\ud83c[\\udde6\\uddea-\\udded\\uddf0-\\uddf3\\uddf7-\\uddf9\\uddfc\\uddfe]|\\ud83c\\uddf6\\ud83c\\udde6|\\ud83c\\uddf7\\ud83c[\\uddea\\uddf4\\uddf8\\uddfa\\uddfc]|\\ud83c\\uddf8\\ud83c[\\udde6-\\uddea\\uddec-\\uddf4\\uddf7-\\uddf9\\uddfb\\uddfd-\\uddff]|\\ud83c\\uddf9\\ud83c[\\udde6\\udde8\\udde9\\uddeb-\\udded\\uddef-\\uddf4\\uddf7\\uddf9\\uddfb\\uddfc\\uddff]|\\ud83c\\uddfa\\ud83c[\\udde6\\uddec\\uddf2\\uddf3\\uddf8\\uddfe\\uddff]|\\ud83c\\uddfb\\ud83c[\\udde6\\udde8\\uddea\\uddec\\uddee\\uddf3\\uddfa]|\\ud83c\\uddfc\\ud83c[\\uddeb\\uddf8]|\\ud83c\\uddfd\\ud83c\\uddf0|\\ud83c\\uddfe\\ud83c[\\uddea\\uddf9]|\\ud83c\\uddff\\ud83c[\\udde6\\uddf2\\uddfc]|\\ud83c[\\udccf\\udd8e\\udd91-\\udd9a\\udde6-\\uddff\\ude01\\ude32-\\ude36\\ude38-\\ude3a\\ude50\\ude51\\udf00-\\udf20\\udf2d-\\udf35\\udf37-\\udf7c\\udf7e-\\udf84\\udf86-\\udf93\\udfa0-\\udfc1\\udfc5\\udfc6\\udfc8\\udfc9\\udfcf-\\udfd3\\udfe0-\\udff0\\udff4\\udff8-\\udfff]|\\ud83d[\\udc00-\\udc3e\\udc40\\udc44\\udc45\\udc51-\\udc65\\udc6a-\\udc6d\\udc6f\\udc79-\\udc7b\\udc7d-\\udc80\\udc84\\udc88-\\udca9\\udcab-\\udcfc\\udcff-\\udd3d\\udd4b-\\udd4e\\udd50-\\udd67\\udda4\\uddfb-\\ude44\\ude48-\\ude4a\\ude80-\\udea2\\udea4-\\udeb3\\udeb7-\\udebf\\udec1-\\udec5\\uded0-\\uded2\\udeeb\\udeec\\udef4-\\udef9]|\\ud83e[\\udd10-\\udd17\\udd1d\\udd20-\\udd25\\udd27-\\udd2f\\udd3a\\udd3c\\udd40-\\udd45\\udd47-\\udd70\\udd73-\\udd76\\udd7a\\udd7c-\\udda2\\uddb4\\uddb7\\uddc0-\\uddc2\\uddd0\\uddde-\\uddff]|[\\u23e9-\\u23ec\\u23f0\\u23f3\\u267e\\u26ce\\u2705\\u2728\\u274c\\u274e\\u2753-\\u2755\\u2795-\\u2797\\u27b0\\u27bf\\ue50a])|\\ufe0f/g;\n\n//# sourceURL=webpack://web/./node_modules/twemoji-parser/dist/lib/regex.js?')},"./node_modules/twitter-text/dist/esm/autoLink.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _extractEntitiesWithIndices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extractEntitiesWithIndices */ "./node_modules/twitter-text/dist/esm/extractEntitiesWithIndices.js");\n/* harmony import */ var _autoLinkEntities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./autoLinkEntities */ "./node_modules/twitter-text/dist/esm/autoLinkEntities.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, options) {\n var entities = (0,_extractEntitiesWithIndices__WEBPACK_IMPORTED_MODULE_0__["default"])(text, {\n extractUrlsWithoutProtocol: false\n });\n return (0,_autoLinkEntities__WEBPACK_IMPORTED_MODULE_1__["default"])(text, entities, options);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/autoLink.js?')},"./node_modules/twitter-text/dist/esm/autoLinkCashtags.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _autoLinkEntities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autoLinkEntities */ "./node_modules/twitter-text/dist/esm/autoLinkEntities.js");\n/* harmony import */ var _extractCashtagsWithIndices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./extractCashtagsWithIndices */ "./node_modules/twitter-text/dist/esm/extractCashtagsWithIndices.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, options) {\n var entities = (0,_extractCashtagsWithIndices__WEBPACK_IMPORTED_MODULE_1__["default"])(text);\n return (0,_autoLinkEntities__WEBPACK_IMPORTED_MODULE_0__["default"])(text, entities, options);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/autoLinkCashtags.js?')},"./node_modules/twitter-text/dist/esm/autoLinkEntities.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.array.sort */ "./node_modules/core-js/modules/es6.array.sort.js");\n/* harmony import */ var core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lib_clone__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/clone */ "./node_modules/twitter-text/dist/esm/lib/clone.js");\n/* harmony import */ var _extractHtmlAttrsFromOptions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./extractHtmlAttrsFromOptions */ "./node_modules/twitter-text/dist/esm/extractHtmlAttrsFromOptions.js");\n/* harmony import */ var _htmlEscape__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./htmlEscape */ "./node_modules/twitter-text/dist/esm/htmlEscape.js");\n/* harmony import */ var _linkToCashtag__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./linkToCashtag */ "./node_modules/twitter-text/dist/esm/linkToCashtag.js");\n/* harmony import */ var _linkToHashtag__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./linkToHashtag */ "./node_modules/twitter-text/dist/esm/linkToHashtag.js");\n/* harmony import */ var _linkToUrl__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./linkToUrl */ "./node_modules/twitter-text/dist/esm/linkToUrl.js");\n/* harmony import */ var _linkToMentionAndList__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./linkToMentionAndList */ "./node_modules/twitter-text/dist/esm/linkToMentionAndList.js");\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\n\n // Default CSS class for auto-linked lists (along with the url class)\n\nvar DEFAULT_LIST_CLASS = \'tweet-url list-slug\'; // Default CSS class for auto-linked usernames (along with the url class)\n\nvar DEFAULT_USERNAME_CLASS = \'tweet-url username\'; // Default CSS class for auto-linked hashtags (along with the url class)\n\nvar DEFAULT_HASHTAG_CLASS = \'tweet-url hashtag\'; // Default CSS class for auto-linked cashtags (along with the url class)\n\nvar DEFAULT_CASHTAG_CLASS = \'tweet-url cashtag\';\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, entities, options) {\n var options = (0,_lib_clone__WEBPACK_IMPORTED_MODULE_1__["default"])(options || {});\n options.hashtagClass = options.hashtagClass || DEFAULT_HASHTAG_CLASS;\n options.hashtagUrlBase = options.hashtagUrlBase || \'https://twitter.com/search?q=%23\';\n options.cashtagClass = options.cashtagClass || DEFAULT_CASHTAG_CLASS;\n options.cashtagUrlBase = options.cashtagUrlBase || \'https://twitter.com/search?q=%24\';\n options.listClass = options.listClass || DEFAULT_LIST_CLASS;\n options.usernameClass = options.usernameClass || DEFAULT_USERNAME_CLASS;\n options.usernameUrlBase = options.usernameUrlBase || \'https://twitter.com/\';\n options.listUrlBase = options.listUrlBase || \'https://twitter.com/\';\n options.htmlAttrs = (0,_extractHtmlAttrsFromOptions__WEBPACK_IMPORTED_MODULE_2__["default"])(options);\n options.invisibleTagAttrs = options.invisibleTagAttrs || "style=\'position:absolute;left:-9999px;\'"; // remap url entities to hash\n\n var urlEntities, i, len;\n\n if (options.urlEntities) {\n urlEntities = {};\n\n for (i = 0, len = options.urlEntities.length; i < len; i++) {\n urlEntities[options.urlEntities[i].url] = options.urlEntities[i];\n }\n\n options.urlEntities = urlEntities;\n }\n\n var result = \'\';\n var beginIndex = 0; // sort entities by start index\n\n entities.sort(function (a, b) {\n return a.indices[0] - b.indices[0];\n });\n var nonEntity = options.htmlEscapeNonEntities ? _htmlEscape__WEBPACK_IMPORTED_MODULE_3__["default"] : function (text) {\n return text;\n };\n\n for (var i = 0; i < entities.length; i++) {\n var entity = entities[i];\n result += nonEntity(text.substring(beginIndex, entity.indices[0]));\n\n if (entity.url) {\n result += (0,_linkToUrl__WEBPACK_IMPORTED_MODULE_6__["default"])(entity, text, options);\n } else if (entity.hashtag) {\n result += (0,_linkToHashtag__WEBPACK_IMPORTED_MODULE_5__["default"])(entity, text, options);\n } else if (entity.screenName) {\n result += (0,_linkToMentionAndList__WEBPACK_IMPORTED_MODULE_7__["default"])(entity, text, options);\n } else if (entity.cashtag) {\n result += (0,_linkToCashtag__WEBPACK_IMPORTED_MODULE_4__["default"])(entity, text, options);\n }\n\n beginIndex = entity.indices[1];\n }\n\n result += nonEntity(text.substring(beginIndex, text.length));\n return result;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/autoLinkEntities.js?')},"./node_modules/twitter-text/dist/esm/autoLinkHashtags.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _extractHashtagsWithIndices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extractHashtagsWithIndices */ "./node_modules/twitter-text/dist/esm/extractHashtagsWithIndices.js");\n/* harmony import */ var _autoLinkEntities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./autoLinkEntities */ "./node_modules/twitter-text/dist/esm/autoLinkEntities.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, options) {\n var entities = (0,_extractHashtagsWithIndices__WEBPACK_IMPORTED_MODULE_0__["default"])(text);\n return (0,_autoLinkEntities__WEBPACK_IMPORTED_MODULE_1__["default"])(text, entities, options);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/autoLinkHashtags.js?')},"./node_modules/twitter-text/dist/esm/autoLinkUrlsCustom.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _autoLinkEntities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autoLinkEntities */ "./node_modules/twitter-text/dist/esm/autoLinkEntities.js");\n/* harmony import */ var _extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./extractUrlsWithIndices */ "./node_modules/twitter-text/dist/esm/extractUrlsWithIndices.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, options) {\n var entities = (0,_extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_1__["default"])(text, {\n extractUrlsWithoutProtocol: false\n });\n return (0,_autoLinkEntities__WEBPACK_IMPORTED_MODULE_0__["default"])(text, entities, options);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/autoLinkUrlsCustom.js?')},"./node_modules/twitter-text/dist/esm/autoLinkUsernamesOrLists.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _extractMentionsOrListsWithIndices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extractMentionsOrListsWithIndices */ "./node_modules/twitter-text/dist/esm/extractMentionsOrListsWithIndices.js");\n/* harmony import */ var _autoLinkEntities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./autoLinkEntities */ "./node_modules/twitter-text/dist/esm/autoLinkEntities.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, options) {\n var entities = (0,_extractMentionsOrListsWithIndices__WEBPACK_IMPORTED_MODULE_0__["default"])(text);\n return (0,_autoLinkEntities__WEBPACK_IMPORTED_MODULE_1__["default"])(text, entities, options);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/autoLinkUsernamesOrLists.js?')},"./node_modules/twitter-text/dist/esm/autoLinkWithJSON.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _autoLinkEntities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autoLinkEntities */ "./node_modules/twitter-text/dist/esm/autoLinkEntities.js");\n/* harmony import */ var _modifyIndicesFromUnicodeToUTF16__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modifyIndicesFromUnicodeToUTF16 */ "./node_modules/twitter-text/dist/esm/modifyIndicesFromUnicodeToUTF16.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, json, options) {\n // map JSON entity to twitter-text entity\n if (json.user_mentions) {\n for (var i = 0; i < json.user_mentions.length; i++) {\n // this is a @mention\n json.user_mentions[i].screenName = json.user_mentions[i].screen_name;\n }\n }\n\n if (json.hashtags) {\n for (var i = 0; i < json.hashtags.length; i++) {\n // this is a #hashtag\n json.hashtags[i].hashtag = json.hashtags[i].text;\n }\n }\n\n if (json.symbols) {\n for (var i = 0; i < json.symbols.length; i++) {\n // this is a $CASH tag\n json.symbols[i].cashtag = json.symbols[i].text;\n }\n } // concatenate all entities\n\n\n var entities = [];\n\n for (var key in json) {\n entities = entities.concat(json[key]);\n } // modify indices to UTF-16\n\n\n (0,_modifyIndicesFromUnicodeToUTF16__WEBPACK_IMPORTED_MODULE_1__["default"])(text, entities);\n return (0,_autoLinkEntities__WEBPACK_IMPORTED_MODULE_0__["default"])(text, entities, options);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/autoLinkWithJSON.js?')},"./node_modules/twitter-text/dist/esm/configs.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// This file is generated by scripts/buildConfig.js\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n version1: {\n version: 1,\n maxWeightedTweetLength: 140,\n scale: 1,\n defaultWeight: 1,\n transformedURLLength: 23,\n ranges: []\n },\n version2: {\n version: 2,\n maxWeightedTweetLength: 280,\n scale: 100,\n defaultWeight: 200,\n transformedURLLength: 23,\n ranges: [{\n start: 0,\n end: 4351,\n weight: 100\n }, {\n start: 8192,\n end: 8205,\n weight: 100\n }, {\n start: 8208,\n end: 8223,\n weight: 100\n }, {\n start: 8242,\n end: 8247,\n weight: 100\n }]\n },\n version3: {\n version: 3,\n maxWeightedTweetLength: 280,\n scale: 100,\n defaultWeight: 200,\n emojiParsingEnabled: true,\n transformedURLLength: 23,\n ranges: [{\n start: 0,\n end: 4351,\n weight: 100\n }, {\n start: 8192,\n end: 8205,\n weight: 100\n }, {\n start: 8208,\n end: 8223,\n weight: 100\n }, {\n start: 8242,\n end: 8247,\n weight: 100\n }]\n },\n defaults: {\n version: 3,\n maxWeightedTweetLength: 280,\n scale: 100,\n defaultWeight: 200,\n emojiParsingEnabled: true,\n transformedURLLength: 23,\n ranges: [{\n start: 0,\n end: 4351,\n weight: 100\n }, {\n start: 8192,\n end: 8205,\n weight: 100\n }, {\n start: 8208,\n end: 8223,\n weight: 100\n }, {\n start: 8242,\n end: 8247,\n weight: 100\n }]\n }\n});\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/configs.js?')},"./node_modules/twitter-text/dist/esm/convertUnicodeIndices.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.array.sort */ "./node_modules/core-js/modules/es6.array.sort.js");\n/* harmony import */ var core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0__);\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, entities, indicesInUTF16) {\n if (entities.length == 0) {\n return;\n }\n\n var charIndex = 0;\n var codePointIndex = 0; // sort entities by start index\n\n entities.sort(function (a, b) {\n return a.indices[0] - b.indices[0];\n });\n var entityIndex = 0;\n var entity = entities[0];\n\n while (charIndex < text.length) {\n if (entity.indices[0] == (indicesInUTF16 ? charIndex : codePointIndex)) {\n var len = entity.indices[1] - entity.indices[0];\n entity.indices[0] = indicesInUTF16 ? codePointIndex : charIndex;\n entity.indices[1] = entity.indices[0] + len;\n entityIndex++;\n\n if (entityIndex == entities.length) {\n // no more entity\n break;\n }\n\n entity = entities[entityIndex];\n }\n\n var c = text.charCodeAt(charIndex);\n\n if (c >= 0xd800 && c <= 0xdbff && charIndex < text.length - 1) {\n // Found high surrogate char\n c = text.charCodeAt(charIndex + 1);\n\n if (c >= 0xdc00 && c <= 0xdfff) {\n // Found surrogate pair\n charIndex++;\n }\n }\n\n codePointIndex++;\n charIndex++;\n }\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/convertUnicodeIndices.js?')},"./node_modules/twitter-text/dist/esm/extractCashtags.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _extractCashtagsWithIndices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extractCashtagsWithIndices */ "./node_modules/twitter-text/dist/esm/extractCashtagsWithIndices.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n var cashtagsOnly = [],\n cashtagsWithIndices = (0,_extractCashtagsWithIndices__WEBPACK_IMPORTED_MODULE_0__["default"])(text);\n\n for (var i = 0; i < cashtagsWithIndices.length; i++) {\n cashtagsOnly.push(cashtagsWithIndices[i].cashtag);\n }\n\n return cashtagsOnly;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractCashtags.js?')},"./node_modules/twitter-text/dist/esm/extractCashtagsWithIndices.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ "./node_modules/core-js/modules/es6.regexp.replace.js");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.array.index-of */ "./node_modules/core-js/modules/es6.array.index-of.js");\n/* harmony import */ var core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _regexp_validCashtag__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./regexp/validCashtag */ "./node_modules/twitter-text/dist/esm/regexp/validCashtag.js");\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n if (!text || text.indexOf(\'$\') === -1) {\n return [];\n }\n\n var tags = [];\n text.replace(_regexp_validCashtag__WEBPACK_IMPORTED_MODULE_2__["default"], function (match, before, dollar, cashtag, offset, chunk) {\n var startPosition = offset + before.length;\n var endPosition = startPosition + cashtag.length + 1;\n tags.push({\n cashtag: cashtag,\n indices: [startPosition, endPosition]\n });\n });\n return tags;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractCashtagsWithIndices.js?')},"./node_modules/twitter-text/dist/esm/extractEntitiesWithIndices.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _extractCashtagsWithIndices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extractCashtagsWithIndices */ "./node_modules/twitter-text/dist/esm/extractCashtagsWithIndices.js");\n/* harmony import */ var _extractHashtagsWithIndices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./extractHashtagsWithIndices */ "./node_modules/twitter-text/dist/esm/extractHashtagsWithIndices.js");\n/* harmony import */ var _extractMentionsOrListsWithIndices__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./extractMentionsOrListsWithIndices */ "./node_modules/twitter-text/dist/esm/extractMentionsOrListsWithIndices.js");\n/* harmony import */ var _extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./extractUrlsWithIndices */ "./node_modules/twitter-text/dist/esm/extractUrlsWithIndices.js");\n/* harmony import */ var _removeOverlappingEntities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./removeOverlappingEntities */ "./node_modules/twitter-text/dist/esm/removeOverlappingEntities.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, options) {\n var entities = (0,_extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_3__["default"])(text, options).concat((0,_extractMentionsOrListsWithIndices__WEBPACK_IMPORTED_MODULE_2__["default"])(text)).concat((0,_extractHashtagsWithIndices__WEBPACK_IMPORTED_MODULE_1__["default"])(text, {\n checkUrlOverlap: false\n })).concat((0,_extractCashtagsWithIndices__WEBPACK_IMPORTED_MODULE_0__["default"])(text));\n\n if (entities.length == 0) {\n return [];\n }\n\n (0,_removeOverlappingEntities__WEBPACK_IMPORTED_MODULE_4__["default"])(entities);\n return entities;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractEntitiesWithIndices.js?')},"./node_modules/twitter-text/dist/esm/extractHashtags.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _extractHashtagsWithIndices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extractHashtagsWithIndices */ "./node_modules/twitter-text/dist/esm/extractHashtagsWithIndices.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n var hashtagsOnly = [];\n var hashtagsWithIndices = (0,_extractHashtagsWithIndices__WEBPACK_IMPORTED_MODULE_0__["default"])(text);\n\n for (var i = 0; i < hashtagsWithIndices.length; i++) {\n hashtagsOnly.push(hashtagsWithIndices[i].hashtag);\n }\n\n return hashtagsOnly;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractHashtags.js?')},"./node_modules/twitter-text/dist/esm/extractHashtagsWithIndices.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ "./node_modules/core-js/modules/es6.regexp.replace.js");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.match */ "./node_modules/core-js/modules/es6.regexp.match.js");\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _regexp_endHashtagMatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./regexp/endHashtagMatch */ "./node_modules/twitter-text/dist/esm/regexp/endHashtagMatch.js");\n/* harmony import */ var _extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./extractUrlsWithIndices */ "./node_modules/twitter-text/dist/esm/extractUrlsWithIndices.js");\n/* harmony import */ var _regexp_hashSigns__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./regexp/hashSigns */ "./node_modules/twitter-text/dist/esm/regexp/hashSigns.js");\n/* harmony import */ var _removeOverlappingEntities__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./removeOverlappingEntities */ "./node_modules/twitter-text/dist/esm/removeOverlappingEntities.js");\n/* harmony import */ var _regexp_validHashtag__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./regexp/validHashtag */ "./node_modules/twitter-text/dist/esm/regexp/validHashtag.js");\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\n\nvar extractHashtagsWithIndices = function extractHashtagsWithIndices(text, options) {\n if (!options) {\n options = {\n checkUrlOverlap: true\n };\n }\n\n if (!text || !text.match(_regexp_hashSigns__WEBPACK_IMPORTED_MODULE_4__["default"])) {\n return [];\n }\n\n var tags = [];\n text.replace(_regexp_validHashtag__WEBPACK_IMPORTED_MODULE_6__["default"], function (match, before, hash, hashText, offset, chunk) {\n var after = chunk.slice(offset + match.length);\n\n if (after.match(_regexp_endHashtagMatch__WEBPACK_IMPORTED_MODULE_2__["default"])) {\n return;\n }\n\n var startPosition = offset + before.length;\n var endPosition = startPosition + hashText.length + 1;\n tags.push({\n hashtag: hashText,\n indices: [startPosition, endPosition]\n });\n });\n\n if (options.checkUrlOverlap) {\n // also extract URL entities\n var urls = (0,_extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_3__["default"])(text);\n\n if (urls.length > 0) {\n var entities = tags.concat(urls); // remove overlap\n\n (0,_removeOverlappingEntities__WEBPACK_IMPORTED_MODULE_5__["default"])(entities); // only push back hashtags\n\n tags = [];\n\n for (var i = 0; i < entities.length; i++) {\n if (entities[i].hashtag) {\n tags.push(entities[i]);\n }\n }\n }\n }\n\n return tags;\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (extractHashtagsWithIndices);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractHashtagsWithIndices.js?')},"./node_modules/twitter-text/dist/esm/extractHtmlAttrsFromOptions.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar BOOLEAN_ATTRIBUTES = {\n disabled: true,\n readonly: true,\n multiple: true,\n checked: true\n}; // Options which should not be passed as HTML attributes\n\nvar OPTIONS_NOT_ATTRIBUTES = {\n urlClass: true,\n listClass: true,\n usernameClass: true,\n hashtagClass: true,\n cashtagClass: true,\n usernameUrlBase: true,\n listUrlBase: true,\n hashtagUrlBase: true,\n cashtagUrlBase: true,\n usernameUrlBlock: true,\n listUrlBlock: true,\n hashtagUrlBlock: true,\n linkUrlBlock: true,\n usernameIncludeSymbol: true,\n suppressLists: true,\n suppressNoFollow: true,\n targetBlank: true,\n suppressDataScreenName: true,\n urlEntities: true,\n symbolTag: true,\n textWithSymbolTag: true,\n urlTarget: true,\n invisibleTagAttrs: true,\n linkAttributeBlock: true,\n linkTextBlock: true,\n htmlEscapeNonEntities: true\n};\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(options) {\n var htmlAttrs = {};\n\n for (var k in options) {\n var v = options[k];\n\n if (OPTIONS_NOT_ATTRIBUTES[k]) {\n continue;\n }\n\n if (BOOLEAN_ATTRIBUTES[k]) {\n v = v ? k : null;\n }\n\n if (v == null) {\n continue;\n }\n\n htmlAttrs[k] = v;\n }\n\n return htmlAttrs;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractHtmlAttrsFromOptions.js?')},"./node_modules/twitter-text/dist/esm/extractMentions.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _extractMentionsWithIndices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extractMentionsWithIndices */ "./node_modules/twitter-text/dist/esm/extractMentionsWithIndices.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n var screenNamesOnly = [],\n screenNamesWithIndices = (0,_extractMentionsWithIndices__WEBPACK_IMPORTED_MODULE_0__["default"])(text);\n\n for (var i = 0; i < screenNamesWithIndices.length; i++) {\n var screenName = screenNamesWithIndices[i].screenName;\n screenNamesOnly.push(screenName);\n }\n\n return screenNamesOnly;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractMentions.js?')},"./node_modules/twitter-text/dist/esm/extractMentionsOrListsWithIndices.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ "./node_modules/core-js/modules/es6.regexp.replace.js");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.match */ "./node_modules/core-js/modules/es6.regexp.match.js");\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _regexp_atSigns__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./regexp/atSigns */ "./node_modules/twitter-text/dist/esm/regexp/atSigns.js");\n/* harmony import */ var _regexp_endMentionMatch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./regexp/endMentionMatch */ "./node_modules/twitter-text/dist/esm/regexp/endMentionMatch.js");\n/* harmony import */ var _regexp_validMentionOrList__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./regexp/validMentionOrList */ "./node_modules/twitter-text/dist/esm/regexp/validMentionOrList.js");\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n if (!text || !text.match(_regexp_atSigns__WEBPACK_IMPORTED_MODULE_2__["default"])) {\n return [];\n }\n\n var possibleNames = [];\n text.replace(_regexp_validMentionOrList__WEBPACK_IMPORTED_MODULE_4__["default"], function (match, before, atSign, screenName, slashListname, offset, chunk) {\n var after = chunk.slice(offset + match.length);\n\n if (!after.match(_regexp_endMentionMatch__WEBPACK_IMPORTED_MODULE_3__["default"])) {\n slashListname = slashListname || \'\';\n var startPosition = offset + before.length;\n var endPosition = startPosition + screenName.length + slashListname.length + 1;\n possibleNames.push({\n screenName: screenName,\n listSlug: slashListname,\n indices: [startPosition, endPosition]\n });\n }\n });\n return possibleNames;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractMentionsOrListsWithIndices.js?')},"./node_modules/twitter-text/dist/esm/extractMentionsWithIndices.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _extractMentionsOrListsWithIndices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extractMentionsOrListsWithIndices */ "./node_modules/twitter-text/dist/esm/extractMentionsOrListsWithIndices.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n var mentions = [];\n var mentionOrList;\n var mentionsOrLists = (0,_extractMentionsOrListsWithIndices__WEBPACK_IMPORTED_MODULE_0__["default"])(text);\n\n for (var i = 0; i < mentionsOrLists.length; i++) {\n mentionOrList = mentionsOrLists[i];\n\n if (mentionOrList.listSlug === \'\') {\n mentions.push({\n screenName: mentionOrList.screenName,\n indices: mentionOrList.indices\n });\n }\n }\n\n return mentions;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractMentionsWithIndices.js?')},"./node_modules/twitter-text/dist/esm/extractReplies.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.constructor */ "./node_modules/core-js/modules/es6.regexp.constructor.js");\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.match */ "./node_modules/core-js/modules/es6.regexp.match.js");\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _regexp_endMentionMatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./regexp/endMentionMatch */ "./node_modules/twitter-text/dist/esm/regexp/endMentionMatch.js");\n/* harmony import */ var _regexp_validReply__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./regexp/validReply */ "./node_modules/twitter-text/dist/esm/regexp/validReply.js");\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n if (!text) {\n return null;\n }\n\n var possibleScreenName = text.match(_regexp_validReply__WEBPACK_IMPORTED_MODULE_3__["default"]);\n\n if (!possibleScreenName || RegExp.rightContext.match(_regexp_endMentionMatch__WEBPACK_IMPORTED_MODULE_2__["default"])) {\n return null;\n }\n\n return possibleScreenName[1];\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractReplies.js?')},"./node_modules/twitter-text/dist/esm/extractUrls.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extractUrlsWithIndices */ "./node_modules/twitter-text/dist/esm/extractUrlsWithIndices.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, options) {\n var urlsOnly = [];\n var urlsWithIndices = (0,_extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_0__["default"])(text, options);\n\n for (var i = 0; i < urlsWithIndices.length; i++) {\n urlsOnly.push(urlsWithIndices[i].url);\n }\n\n return urlsOnly;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractUrls.js?')},"./node_modules/twitter-text/dist/esm/extractUrlsWithIndices.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.array.index-of */ "./node_modules/core-js/modules/es6.array.index-of.js");\n/* harmony import */ var core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ "./node_modules/core-js/modules/es6.regexp.replace.js");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es6.regexp.constructor */ "./node_modules/core-js/modules/es6.regexp.constructor.js");\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es6.regexp.match */ "./node_modules/core-js/modules/es6.regexp.match.js");\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _regexp_extractUrl__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./regexp/extractUrl */ "./node_modules/twitter-text/dist/esm/regexp/extractUrl.js");\n/* harmony import */ var _regexp_invalidUrlWithoutProtocolPrecedingChars__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./regexp/invalidUrlWithoutProtocolPrecedingChars */ "./node_modules/twitter-text/dist/esm/regexp/invalidUrlWithoutProtocolPrecedingChars.js");\n/* harmony import */ var _lib_idna__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./lib/idna */ "./node_modules/twitter-text/dist/esm/lib/idna.js");\n/* harmony import */ var _regexp_validAsciiDomain__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./regexp/validAsciiDomain */ "./node_modules/twitter-text/dist/esm/regexp/validAsciiDomain.js");\n/* harmony import */ var _regexp_validTcoUrl__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./regexp/validTcoUrl */ "./node_modules/twitter-text/dist/esm/regexp/validTcoUrl.js");\n\n\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\nvar DEFAULT_PROTOCOL = \'https://\';\nvar DEFAULT_PROTOCOL_OPTIONS = {\n extractUrlsWithoutProtocol: true\n};\nvar MAX_URL_LENGTH = 4096;\nvar MAX_TCO_SLUG_LENGTH = 40;\n\nvar extractUrlsWithIndices = function extractUrlsWithIndices(text) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_PROTOCOL_OPTIONS;\n\n if (!text || (options.extractUrlsWithoutProtocol ? !text.match(/\\./) : !text.match(/:/))) {\n return [];\n }\n\n var urls = [];\n\n var _loop = function _loop() {\n var before = RegExp.$2;\n var url = RegExp.$3;\n var protocol = RegExp.$4;\n var domain = RegExp.$5;\n var path = RegExp.$7;\n var endPosition = _regexp_extractUrl__WEBPACK_IMPORTED_MODULE_4__["default"].lastIndex;\n var startPosition = endPosition - url.length;\n\n if (!isValidUrl(url, protocol || DEFAULT_PROTOCOL, domain)) {\n return "continue";\n } // extract ASCII-only domains.\n\n\n if (!protocol) {\n if (!options.extractUrlsWithoutProtocol || before.match(_regexp_invalidUrlWithoutProtocolPrecedingChars__WEBPACK_IMPORTED_MODULE_5__["default"])) {\n return "continue";\n }\n\n var lastUrl = null;\n var asciiEndPosition = 0;\n domain.replace(_regexp_validAsciiDomain__WEBPACK_IMPORTED_MODULE_7__["default"], function (asciiDomain) {\n var asciiStartPosition = domain.indexOf(asciiDomain, asciiEndPosition);\n asciiEndPosition = asciiStartPosition + asciiDomain.length;\n lastUrl = {\n url: asciiDomain,\n indices: [startPosition + asciiStartPosition, startPosition + asciiEndPosition]\n };\n urls.push(lastUrl);\n }); // no ASCII-only domain found. Skip the entire URL.\n\n if (lastUrl == null) {\n return "continue";\n } // lastUrl only contains domain. Need to add path and query if they exist.\n\n\n if (path) {\n lastUrl.url = url.replace(domain, lastUrl.url);\n lastUrl.indices[1] = endPosition;\n }\n } else {\n // In the case of t.co URLs, don\'t allow additional path characters.\n if (url.match(_regexp_validTcoUrl__WEBPACK_IMPORTED_MODULE_8__["default"])) {\n var tcoUrlSlug = RegExp.$1;\n\n if (tcoUrlSlug && tcoUrlSlug.length > MAX_TCO_SLUG_LENGTH) {\n return "continue";\n } else {\n url = RegExp.lastMatch;\n endPosition = startPosition + url.length;\n }\n }\n\n urls.push({\n url: url,\n indices: [startPosition, endPosition]\n });\n }\n };\n\n while (_regexp_extractUrl__WEBPACK_IMPORTED_MODULE_4__["default"].exec(text)) {\n var _ret = _loop();\n\n if (_ret === "continue") continue;\n }\n\n return urls;\n};\n\nvar isValidUrl = function isValidUrl(url, protocol, domain) {\n var urlLength = url.length;\n var punycodeEncodedDomain = _lib_idna__WEBPACK_IMPORTED_MODULE_6__["default"].toAscii(domain);\n\n if (!punycodeEncodedDomain || !punycodeEncodedDomain.length) {\n return false;\n }\n\n urlLength = urlLength + punycodeEncodedDomain.length - domain.length;\n return protocol.length + urlLength <= MAX_URL_LENGTH;\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (extractUrlsWithIndices);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/extractUrlsWithIndices.js?')},"./node_modules/twitter-text/dist/esm/getTweetLength.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _configs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./configs */ "./node_modules/twitter-text/dist/esm/configs.js");\n/* harmony import */ var _extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./extractUrlsWithIndices */ "./node_modules/twitter-text/dist/esm/extractUrlsWithIndices.js");\n/* harmony import */ var _lib_getCharacterWeight__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/getCharacterWeight */ "./node_modules/twitter-text/dist/esm/lib/getCharacterWeight.js");\n/* harmony import */ var _modifyIndicesFromUTF16ToUnicode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modifyIndicesFromUTF16ToUnicode */ "./node_modules/twitter-text/dist/esm/modifyIndicesFromUTF16ToUnicode.js");\n/* harmony import */ var _regexp_nonBmpCodePairs__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./regexp/nonBmpCodePairs */ "./node_modules/twitter-text/dist/esm/regexp/nonBmpCodePairs.js");\n/* harmony import */ var _parseTweet__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./parseTweet */ "./node_modules/twitter-text/dist/esm/parseTweet.js");\n/* harmony import */ var _regexp_urlHasHttps__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./regexp/urlHasHttps */ "./node_modules/twitter-text/dist/esm/regexp/urlHasHttps.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\n\n\n\nvar getTweetLength = function getTweetLength(text) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _configs__WEBPACK_IMPORTED_MODULE_0__["default"].defaults;\n return (0,_parseTweet__WEBPACK_IMPORTED_MODULE_5__["default"])(text, options).weightedLength;\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getTweetLength);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/getTweetLength.js?')},"./node_modules/twitter-text/dist/esm/getUnicodeTextLength.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ "./node_modules/core-js/modules/es6.regexp.replace.js");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _regexp_nonBmpCodePairs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./regexp/nonBmpCodePairs */ "./node_modules/twitter-text/dist/esm/regexp/nonBmpCodePairs.js");\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/**\n * Copied from https://github.com/twitter/twitter-text/blob/master/js/twitter-text.js\n */\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n return text.replace(_regexp_nonBmpCodePairs__WEBPACK_IMPORTED_MODULE_1__["default"], \' \').length;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/getUnicodeTextLength.js?')},"./node_modules/twitter-text/dist/esm/hasInvalidCharacters.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _regexp_invalidChars__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./regexp/invalidChars */ "./node_modules/twitter-text/dist/esm/regexp/invalidChars.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n return _regexp_invalidChars__WEBPACK_IMPORTED_MODULE_0__["default"].test(text);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/hasInvalidCharacters.js?')},"./node_modules/twitter-text/dist/esm/hitHighlight.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _splitTags__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./splitTags */ "./node_modules/twitter-text/dist/esm/splitTags.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, hits, options) {\n var defaultHighlightTag = \'em\';\n hits = hits || [];\n options = options || {};\n\n if (hits.length === 0) {\n return text;\n }\n\n var tagName = options.tag || defaultHighlightTag,\n tags = ["<".concat(tagName, ">"), "</".concat(tagName, ">")],\n chunks = (0,_splitTags__WEBPACK_IMPORTED_MODULE_0__["default"])(text),\n i,\n j,\n result = \'\',\n chunkIndex = 0,\n chunk = chunks[0],\n prevChunksLen = 0,\n chunkCursor = 0,\n startInChunk = false,\n chunkChars = chunk,\n flatHits = [],\n index,\n hit,\n tag,\n placed,\n hitSpot;\n\n for (i = 0; i < hits.length; i += 1) {\n for (j = 0; j < hits[i].length; j += 1) {\n flatHits.push(hits[i][j]);\n }\n }\n\n for (index = 0; index < flatHits.length; index += 1) {\n hit = flatHits[index];\n tag = tags[index % 2];\n placed = false;\n\n while (chunk != null && hit >= prevChunksLen + chunk.length) {\n result += chunkChars.slice(chunkCursor);\n\n if (startInChunk && hit === prevChunksLen + chunkChars.length) {\n result += tag;\n placed = true;\n }\n\n if (chunks[chunkIndex + 1]) {\n result += "<".concat(chunks[chunkIndex + 1], ">");\n }\n\n prevChunksLen += chunkChars.length;\n chunkCursor = 0;\n chunkIndex += 2;\n chunk = chunks[chunkIndex];\n chunkChars = chunk;\n startInChunk = false;\n }\n\n if (!placed && chunk != null) {\n hitSpot = hit - prevChunksLen;\n result += chunkChars.slice(chunkCursor, hitSpot) + tag;\n chunkCursor = hitSpot;\n\n if (index % 2 === 0) {\n startInChunk = true;\n } else {\n startInChunk = false;\n }\n } else if (!placed) {\n placed = true;\n result += tag;\n }\n }\n\n if (chunk != null) {\n if (chunkCursor < chunkChars.length) {\n result += chunkChars.slice(chunkCursor);\n }\n\n for (index = chunkIndex + 1; index < chunks.length; index += 1) {\n result += index % 2 === 0 ? chunks[index] : "<".concat(chunks[index], ">");\n }\n }\n\n return result;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/hitHighlight.js?')},"./node_modules/twitter-text/dist/esm/htmlEscape.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ \"./node_modules/core-js/modules/es6.regexp.replace.js\");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__);\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar HTML_ENTITIES = {\n '&': '&',\n '>': '>',\n '<': '<',\n '\"': '"',\n \"'\": '''\n};\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n return text && text.replace(/[&\"'><]/g, function (character) {\n return HTML_ENTITIES[character];\n });\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/htmlEscape.js?")},"./node_modules/twitter-text/dist/esm/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _autoLink__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./autoLink */ "./node_modules/twitter-text/dist/esm/autoLink.js");\n/* harmony import */ var _autoLinkCashtags__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./autoLinkCashtags */ "./node_modules/twitter-text/dist/esm/autoLinkCashtags.js");\n/* harmony import */ var _autoLinkEntities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./autoLinkEntities */ "./node_modules/twitter-text/dist/esm/autoLinkEntities.js");\n/* harmony import */ var _autoLinkHashtags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./autoLinkHashtags */ "./node_modules/twitter-text/dist/esm/autoLinkHashtags.js");\n/* harmony import */ var _autoLinkUrlsCustom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./autoLinkUrlsCustom */ "./node_modules/twitter-text/dist/esm/autoLinkUrlsCustom.js");\n/* harmony import */ var _autoLinkUsernamesOrLists__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./autoLinkUsernamesOrLists */ "./node_modules/twitter-text/dist/esm/autoLinkUsernamesOrLists.js");\n/* harmony import */ var _autoLinkWithJSON__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./autoLinkWithJSON */ "./node_modules/twitter-text/dist/esm/autoLinkWithJSON.js");\n/* harmony import */ var _configs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./configs */ "./node_modules/twitter-text/dist/esm/configs.js");\n/* harmony import */ var _convertUnicodeIndices__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./convertUnicodeIndices */ "./node_modules/twitter-text/dist/esm/convertUnicodeIndices.js");\n/* harmony import */ var _extractCashtags__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./extractCashtags */ "./node_modules/twitter-text/dist/esm/extractCashtags.js");\n/* harmony import */ var _extractCashtagsWithIndices__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./extractCashtagsWithIndices */ "./node_modules/twitter-text/dist/esm/extractCashtagsWithIndices.js");\n/* harmony import */ var _extractEntitiesWithIndices__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./extractEntitiesWithIndices */ "./node_modules/twitter-text/dist/esm/extractEntitiesWithIndices.js");\n/* harmony import */ var _extractHashtags__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./extractHashtags */ "./node_modules/twitter-text/dist/esm/extractHashtags.js");\n/* harmony import */ var _extractHashtagsWithIndices__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./extractHashtagsWithIndices */ "./node_modules/twitter-text/dist/esm/extractHashtagsWithIndices.js");\n/* harmony import */ var _extractHtmlAttrsFromOptions__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./extractHtmlAttrsFromOptions */ "./node_modules/twitter-text/dist/esm/extractHtmlAttrsFromOptions.js");\n/* harmony import */ var _extractMentions__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./extractMentions */ "./node_modules/twitter-text/dist/esm/extractMentions.js");\n/* harmony import */ var _extractMentionsOrListsWithIndices__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./extractMentionsOrListsWithIndices */ "./node_modules/twitter-text/dist/esm/extractMentionsOrListsWithIndices.js");\n/* harmony import */ var _extractMentionsWithIndices__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./extractMentionsWithIndices */ "./node_modules/twitter-text/dist/esm/extractMentionsWithIndices.js");\n/* harmony import */ var _extractReplies__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./extractReplies */ "./node_modules/twitter-text/dist/esm/extractReplies.js");\n/* harmony import */ var _extractUrls__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./extractUrls */ "./node_modules/twitter-text/dist/esm/extractUrls.js");\n/* harmony import */ var _extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./extractUrlsWithIndices */ "./node_modules/twitter-text/dist/esm/extractUrlsWithIndices.js");\n/* harmony import */ var _getTweetLength__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./getTweetLength */ "./node_modules/twitter-text/dist/esm/getTweetLength.js");\n/* harmony import */ var _getUnicodeTextLength__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./getUnicodeTextLength */ "./node_modules/twitter-text/dist/esm/getUnicodeTextLength.js");\n/* harmony import */ var _hasInvalidCharacters__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./hasInvalidCharacters */ "./node_modules/twitter-text/dist/esm/hasInvalidCharacters.js");\n/* harmony import */ var _hitHighlight__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./hitHighlight */ "./node_modules/twitter-text/dist/esm/hitHighlight.js");\n/* harmony import */ var _htmlEscape__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./htmlEscape */ "./node_modules/twitter-text/dist/esm/htmlEscape.js");\n/* harmony import */ var _isInvalidTweet__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./isInvalidTweet */ "./node_modules/twitter-text/dist/esm/isInvalidTweet.js");\n/* harmony import */ var _isValidHashtag__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./isValidHashtag */ "./node_modules/twitter-text/dist/esm/isValidHashtag.js");\n/* harmony import */ var _isValidList__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./isValidList */ "./node_modules/twitter-text/dist/esm/isValidList.js");\n/* harmony import */ var _isValidTweetText__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./isValidTweetText */ "./node_modules/twitter-text/dist/esm/isValidTweetText.js");\n/* harmony import */ var _isValidUrl__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./isValidUrl */ "./node_modules/twitter-text/dist/esm/isValidUrl.js");\n/* harmony import */ var _isValidUsername__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./isValidUsername */ "./node_modules/twitter-text/dist/esm/isValidUsername.js");\n/* harmony import */ var _linkTextWithEntity__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./linkTextWithEntity */ "./node_modules/twitter-text/dist/esm/linkTextWithEntity.js");\n/* harmony import */ var _linkToCashtag__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./linkToCashtag */ "./node_modules/twitter-text/dist/esm/linkToCashtag.js");\n/* harmony import */ var _linkToHashtag__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./linkToHashtag */ "./node_modules/twitter-text/dist/esm/linkToHashtag.js");\n/* harmony import */ var _linkToMentionAndList__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./linkToMentionAndList */ "./node_modules/twitter-text/dist/esm/linkToMentionAndList.js");\n/* harmony import */ var _linkToText__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./linkToText */ "./node_modules/twitter-text/dist/esm/linkToText.js");\n/* harmony import */ var _linkToTextWithSymbol__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./linkToTextWithSymbol */ "./node_modules/twitter-text/dist/esm/linkToTextWithSymbol.js");\n/* harmony import */ var _linkToUrl__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./linkToUrl */ "./node_modules/twitter-text/dist/esm/linkToUrl.js");\n/* harmony import */ var _modifyIndicesFromUTF16ToUnicode__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./modifyIndicesFromUTF16ToUnicode */ "./node_modules/twitter-text/dist/esm/modifyIndicesFromUTF16ToUnicode.js");\n/* harmony import */ var _modifyIndicesFromUnicodeToUTF16__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./modifyIndicesFromUnicodeToUTF16 */ "./node_modules/twitter-text/dist/esm/modifyIndicesFromUnicodeToUTF16.js");\n/* harmony import */ var _regexp_index__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./regexp/index */ "./node_modules/twitter-text/dist/esm/regexp/index.js");\n/* harmony import */ var _removeOverlappingEntities__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./removeOverlappingEntities */ "./node_modules/twitter-text/dist/esm/removeOverlappingEntities.js");\n/* harmony import */ var _parseTweet__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./parseTweet */ "./node_modules/twitter-text/dist/esm/parseTweet.js");\n/* harmony import */ var _splitTags__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./splitTags */ "./node_modules/twitter-text/dist/esm/splitTags.js");\n/* harmony import */ var _standardizeIndices__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./standardizeIndices */ "./node_modules/twitter-text/dist/esm/standardizeIndices.js");\n/* harmony import */ var _tagAttrs__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./tagAttrs */ "./node_modules/twitter-text/dist/esm/tagAttrs.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n autoLink: _autoLink__WEBPACK_IMPORTED_MODULE_0__["default"],\n autoLinkCashtags: _autoLinkCashtags__WEBPACK_IMPORTED_MODULE_1__["default"],\n autoLinkEntities: _autoLinkEntities__WEBPACK_IMPORTED_MODULE_2__["default"],\n autoLinkHashtags: _autoLinkHashtags__WEBPACK_IMPORTED_MODULE_3__["default"],\n autoLinkUrlsCustom: _autoLinkUrlsCustom__WEBPACK_IMPORTED_MODULE_4__["default"],\n autoLinkUsernamesOrLists: _autoLinkUsernamesOrLists__WEBPACK_IMPORTED_MODULE_5__["default"],\n autoLinkWithJSON: _autoLinkWithJSON__WEBPACK_IMPORTED_MODULE_6__["default"],\n configs: _configs__WEBPACK_IMPORTED_MODULE_7__["default"],\n convertUnicodeIndices: _convertUnicodeIndices__WEBPACK_IMPORTED_MODULE_8__["default"],\n extractCashtags: _extractCashtags__WEBPACK_IMPORTED_MODULE_9__["default"],\n extractCashtagsWithIndices: _extractCashtagsWithIndices__WEBPACK_IMPORTED_MODULE_10__["default"],\n extractEntitiesWithIndices: _extractEntitiesWithIndices__WEBPACK_IMPORTED_MODULE_11__["default"],\n extractHashtags: _extractHashtags__WEBPACK_IMPORTED_MODULE_12__["default"],\n extractHashtagsWithIndices: _extractHashtagsWithIndices__WEBPACK_IMPORTED_MODULE_13__["default"],\n extractHtmlAttrsFromOptions: _extractHtmlAttrsFromOptions__WEBPACK_IMPORTED_MODULE_14__["default"],\n extractMentions: _extractMentions__WEBPACK_IMPORTED_MODULE_15__["default"],\n extractMentionsOrListsWithIndices: _extractMentionsOrListsWithIndices__WEBPACK_IMPORTED_MODULE_16__["default"],\n extractMentionsWithIndices: _extractMentionsWithIndices__WEBPACK_IMPORTED_MODULE_17__["default"],\n extractReplies: _extractReplies__WEBPACK_IMPORTED_MODULE_18__["default"],\n extractUrls: _extractUrls__WEBPACK_IMPORTED_MODULE_19__["default"],\n extractUrlsWithIndices: _extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_20__["default"],\n getTweetLength: _getTweetLength__WEBPACK_IMPORTED_MODULE_21__["default"],\n getUnicodeTextLength: _getUnicodeTextLength__WEBPACK_IMPORTED_MODULE_22__["default"],\n hasInvalidCharacters: _hasInvalidCharacters__WEBPACK_IMPORTED_MODULE_23__["default"],\n hitHighlight: _hitHighlight__WEBPACK_IMPORTED_MODULE_24__["default"],\n htmlEscape: _htmlEscape__WEBPACK_IMPORTED_MODULE_25__["default"],\n isInvalidTweet: _isInvalidTweet__WEBPACK_IMPORTED_MODULE_26__["default"],\n isValidHashtag: _isValidHashtag__WEBPACK_IMPORTED_MODULE_27__["default"],\n isValidList: _isValidList__WEBPACK_IMPORTED_MODULE_28__["default"],\n isValidTweetText: _isValidTweetText__WEBPACK_IMPORTED_MODULE_29__["default"],\n isValidUrl: _isValidUrl__WEBPACK_IMPORTED_MODULE_30__["default"],\n isValidUsername: _isValidUsername__WEBPACK_IMPORTED_MODULE_31__["default"],\n linkTextWithEntity: _linkTextWithEntity__WEBPACK_IMPORTED_MODULE_32__["default"],\n linkToCashtag: _linkToCashtag__WEBPACK_IMPORTED_MODULE_33__["default"],\n linkToHashtag: _linkToHashtag__WEBPACK_IMPORTED_MODULE_34__["default"],\n linkToMentionAndList: _linkToMentionAndList__WEBPACK_IMPORTED_MODULE_35__["default"],\n linkToText: _linkToText__WEBPACK_IMPORTED_MODULE_36__["default"],\n linkToTextWithSymbol: _linkToTextWithSymbol__WEBPACK_IMPORTED_MODULE_37__["default"],\n linkToUrl: _linkToUrl__WEBPACK_IMPORTED_MODULE_38__["default"],\n modifyIndicesFromUTF16ToUnicode: _modifyIndicesFromUTF16ToUnicode__WEBPACK_IMPORTED_MODULE_39__["default"],\n modifyIndicesFromUnicodeToUTF16: _modifyIndicesFromUnicodeToUTF16__WEBPACK_IMPORTED_MODULE_40__["default"],\n regexen: _regexp_index__WEBPACK_IMPORTED_MODULE_41__["default"],\n removeOverlappingEntities: _removeOverlappingEntities__WEBPACK_IMPORTED_MODULE_42__["default"],\n parseTweet: _parseTweet__WEBPACK_IMPORTED_MODULE_43__["default"],\n splitTags: _splitTags__WEBPACK_IMPORTED_MODULE_44__["default"],\n standardizeIndices: _standardizeIndices__WEBPACK_IMPORTED_MODULE_45__["default"],\n tagAttrs: _tagAttrs__WEBPACK_IMPORTED_MODULE_46__["default"]\n});\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/index.js?')},"./node_modules/twitter-text/dist/esm/isInvalidTweet.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_object_define_property__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.object.define-property */ "./node_modules/core-js/modules/es6.object.define-property.js");\n/* harmony import */ var core_js_modules_es6_object_define_property__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_define_property__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_object_define_properties__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.object.define-properties */ "./node_modules/core-js/modules/es6.object.define-properties.js");\n/* harmony import */ var core_js_modules_es6_object_define_properties__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_define_properties__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es7_object_get_own_property_descriptors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es7.object.get-own-property-descriptors */ "./node_modules/core-js/modules/es7.object.get-own-property-descriptors.js");\n/* harmony import */ var core_js_modules_es7_object_get_own_property_descriptors__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es7_object_get_own_property_descriptors__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_es6_array_for_each__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es6.array.for-each */ "./node_modules/core-js/modules/es6.array.for-each.js");\n/* harmony import */ var core_js_modules_es6_array_for_each__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_for_each__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_es6_array_filter__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es6.array.filter */ "./node_modules/core-js/modules/es6.array.filter.js");\n/* harmony import */ var core_js_modules_es6_array_filter__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_filter__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var core_js_modules_es6_symbol__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es6.symbol */ "./node_modules/core-js/modules/es6.symbol.js");\n/* harmony import */ var core_js_modules_es6_symbol__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_symbol__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/web.dom.iterable */ "./node_modules/core-js/modules/web.dom.iterable.js");\n/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core-js/modules/es6.array.iterator */ "./node_modules/core-js/modules/es6.array.iterator.js");\n/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! core-js/modules/es6.object.to-string */ "./node_modules/core-js/modules/es6.object.to-string.js");\n/* harmony import */ var core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! core-js/modules/es6.object.keys */ "./node_modules/core-js/modules/es6.object.keys.js");\n/* harmony import */ var core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");\n/* harmony import */ var _configs__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./configs */ "./node_modules/twitter-text/dist/esm/configs.js");\n/* harmony import */ var _getTweetLength__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./getTweetLength */ "./node_modules/twitter-text/dist/esm/getTweetLength.js");\n/* harmony import */ var _hasInvalidCharacters__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./hasInvalidCharacters */ "./node_modules/twitter-text/dist/esm/hasInvalidCharacters.js");\n\n\n\n\n\n\n\n\n\n\n\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_10__["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _configs__WEBPACK_IMPORTED_MODULE_11__["default"].defaults;\n\n if (!text) {\n return \'empty\';\n }\n\n var mergedOptions = _objectSpread({}, _configs__WEBPACK_IMPORTED_MODULE_11__["default"].defaults, {}, options);\n\n var maxLength = mergedOptions.maxWeightedTweetLength; // Determine max length independent of URL length\n\n if ((0,_getTweetLength__WEBPACK_IMPORTED_MODULE_12__["default"])(text, mergedOptions) > maxLength) {\n return \'too_long\';\n }\n\n if ((0,_hasInvalidCharacters__WEBPACK_IMPORTED_MODULE_13__["default"])(text)) {\n return \'invalid_characters\';\n }\n\n return false;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/isInvalidTweet.js?')},"./node_modules/twitter-text/dist/esm/isValidHashtag.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _extractHashtags__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extractHashtags */ "./node_modules/twitter-text/dist/esm/extractHashtags.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(hashtag) {\n if (!hashtag) {\n return false;\n }\n\n var extracted = (0,_extractHashtags__WEBPACK_IMPORTED_MODULE_0__["default"])(hashtag); // Should extract the hashtag minus the # sign, hence the .slice(1)\n\n return extracted.length === 1 && extracted[0] === hashtag.slice(1);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/isValidHashtag.js?')},"./node_modules/twitter-text/dist/esm/isValidList.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.match */ "./node_modules/core-js/modules/es6.regexp.match.js");\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _regexp_validMentionOrList__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./regexp/validMentionOrList */ "./node_modules/twitter-text/dist/esm/regexp/validMentionOrList.js");\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\nvar VALID_LIST_RE = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__["default"])(/^#{validMentionOrList}$/, {\n validMentionOrList: _regexp_validMentionOrList__WEBPACK_IMPORTED_MODULE_2__["default"]\n});\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(usernameList) {\n var match = usernameList.match(VALID_LIST_RE); // Must have matched and had nothing before or after\n\n return !!(match && match[1] == \'\' && match[4]);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/isValidList.js?')},"./node_modules/twitter-text/dist/esm/isValidTweetText.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _isInvalidTweet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isInvalidTweet */ "./node_modules/twitter-text/dist/esm/isInvalidTweet.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, options) {\n return !(0,_isInvalidTweet__WEBPACK_IMPORTED_MODULE_0__["default"])(text, options);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/isValidTweetText.js?')},"./node_modules/twitter-text/dist/esm/isValidUrl.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.constructor */ "./node_modules/core-js/modules/es6.regexp.constructor.js");\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.match */ "./node_modules/core-js/modules/es6.regexp.match.js");\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _regexp_validateUrlAuthority__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./regexp/validateUrlAuthority */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlAuthority.js");\n/* harmony import */ var _regexp_validateUrlFragment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./regexp/validateUrlFragment */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlFragment.js");\n/* harmony import */ var _regexp_validateUrlPath__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./regexp/validateUrlPath */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPath.js");\n/* harmony import */ var _regexp_validateUrlQuery__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./regexp/validateUrlQuery */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlQuery.js");\n/* harmony import */ var _regexp_validateUrlScheme__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./regexp/validateUrlScheme */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlScheme.js");\n/* harmony import */ var _regexp_validateUrlUnencoded__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./regexp/validateUrlUnencoded */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnencoded.js");\n/* harmony import */ var _regexp_validateUrlUnicodeAuthority__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./regexp/validateUrlUnicodeAuthority */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeAuthority.js");\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\n\n\n\nfunction isValidMatch(string, regex, optional) {\n if (!optional) {\n // RegExp["$&"] is the text of the last match\n // blank strings are ok, but are falsy, so we check stringiness instead of truthiness\n return typeof string === \'string\' && string.match(regex) && RegExp[\'$&\'] === string;\n } // RegExp["$&"] is the text of the last match\n\n\n return !string || string.match(regex) && RegExp[\'$&\'] === string;\n}\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(url, unicodeDomains, requireProtocol) {\n if (unicodeDomains == null) {\n unicodeDomains = true;\n }\n\n if (requireProtocol == null) {\n requireProtocol = true;\n }\n\n if (!url) {\n return false;\n }\n\n var urlParts = url.match(_regexp_validateUrlUnencoded__WEBPACK_IMPORTED_MODULE_7__["default"]);\n\n if (!urlParts || urlParts[0] !== url) {\n return false;\n }\n\n var scheme = urlParts[1],\n authority = urlParts[2],\n path = urlParts[3],\n query = urlParts[4],\n fragment = urlParts[5];\n\n if (!((!requireProtocol || isValidMatch(scheme, _regexp_validateUrlScheme__WEBPACK_IMPORTED_MODULE_6__["default"]) && scheme.match(/^https?$/i)) && isValidMatch(path, _regexp_validateUrlPath__WEBPACK_IMPORTED_MODULE_4__["default"]) && isValidMatch(query, _regexp_validateUrlQuery__WEBPACK_IMPORTED_MODULE_5__["default"], true) && isValidMatch(fragment, _regexp_validateUrlFragment__WEBPACK_IMPORTED_MODULE_3__["default"], true))) {\n return false;\n }\n\n return unicodeDomains && isValidMatch(authority, _regexp_validateUrlUnicodeAuthority__WEBPACK_IMPORTED_MODULE_8__["default"]) || !unicodeDomains && isValidMatch(authority, _regexp_validateUrlAuthority__WEBPACK_IMPORTED_MODULE_2__["default"]);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/isValidUrl.js?')},"./node_modules/twitter-text/dist/esm/isValidUsername.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _extractMentions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extractMentions */ "./node_modules/twitter-text/dist/esm/extractMentions.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(username) {\n if (!username) {\n return false;\n }\n\n var extracted = (0,_extractMentions__WEBPACK_IMPORTED_MODULE_0__["default"])(username); // Should extract the username minus the @ sign, hence the .slice(1)\n\n return extracted.length === 1 && extracted[0] === username.slice(1);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/isValidUsername.js?')},"./node_modules/twitter-text/dist/esm/lib/clone.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(o) {\n var r = {};\n\n for (var k in o) {\n if (o.hasOwnProperty(k)) {\n r[k] = o[k];\n }\n }\n\n return r;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/lib/clone.js?')},"./node_modules/twitter-text/dist/esm/lib/convertUnicodeIndices.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.array.sort */ "./node_modules/core-js/modules/es6.array.sort.js");\n/* harmony import */ var core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0__);\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/**\n * Copied from https://github.com/twitter/twitter-text/blob/master/js/twitter-text.js\n */\nvar convertUnicodeIndices = function convertUnicodeIndices(text, entities, indicesInUTF16) {\n if (entities.length === 0) {\n return;\n }\n\n var charIndex = 0;\n var codePointIndex = 0; // sort entities by start index\n\n entities.sort(function (a, b) {\n return a.indices[0] - b.indices[0];\n });\n var entityIndex = 0;\n var entity = entities[0];\n\n while (charIndex < text.length) {\n if (entity.indices[0] === (indicesInUTF16 ? charIndex : codePointIndex)) {\n var len = entity.indices[1] - entity.indices[0];\n entity.indices[0] = indicesInUTF16 ? codePointIndex : charIndex;\n entity.indices[1] = entity.indices[0] + len;\n entityIndex++;\n\n if (entityIndex === entities.length) {\n // no more entity\n break;\n }\n\n entity = entities[entityIndex];\n }\n\n var c = text.charCodeAt(charIndex);\n\n if (c >= 0xd800 && c <= 0xdbff && charIndex < text.length - 1) {\n // Found high surrogate char\n c = text.charCodeAt(charIndex + 1);\n\n if (c >= 0xdc00 && c <= 0xdfff) {\n // Found surrogate pair\n charIndex++;\n }\n }\n\n codePointIndex++;\n charIndex++;\n }\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (convertUnicodeIndices);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/lib/convertUnicodeIndices.js?')},"./node_modules/twitter-text/dist/esm/lib/getCharacterWeight.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_array_is_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.array.is-array */ "./node_modules/core-js/modules/es6.array.is-array.js");\n/* harmony import */ var core_js_modules_es6_array_is_array__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_is_array__WEBPACK_IMPORTED_MODULE_0__);\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar getCharacterWeight = function getCharacterWeight(ch, options) {\n var defaultWeight = options.defaultWeight,\n ranges = options.ranges;\n var weight = defaultWeight;\n var chCodePoint = ch.charCodeAt(0);\n\n if (Array.isArray(ranges)) {\n for (var i = 0, length = ranges.length; i < length; i++) {\n var currRange = ranges[i];\n\n if (chCodePoint >= currRange.start && chCodePoint <= currRange.end) {\n weight = currRange.weight;\n break;\n }\n }\n }\n\n return weight;\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (getCharacterWeight);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/lib/getCharacterWeight.js?')},"./node_modules/twitter-text/dist/esm/lib/idna.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.split */ "./node_modules/core-js/modules/es6.regexp.split.js");\n/* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.match */ "./node_modules/core-js/modules/es6.regexp.match.js");\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var punycode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! punycode */ "./node_modules/twitter-text/node_modules/punycode/punycode.js");\n/* harmony import */ var punycode__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(punycode__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _regexp_validAsciiDomain__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../regexp/validAsciiDomain */ "./node_modules/twitter-text/dist/esm/regexp/validAsciiDomain.js");\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\nvar MAX_DOMAIN_LABEL_LENGTH = 63;\nvar PUNYCODE_ENCODED_DOMAIN_PREFIX = \'xn--\'; // This is an extremely lightweight implementation of domain name validation according to RFC 3490\n// Our regexes handle most of the cases well enough\n// See https://tools.ietf.org/html/rfc3490#section-4.1 for details\n\nvar idna = {\n toAscii: function toAscii(domain) {\n if (domain.substring(0, 4) === PUNYCODE_ENCODED_DOMAIN_PREFIX && !domain.match(_regexp_validAsciiDomain__WEBPACK_IMPORTED_MODULE_3__["default"])) {\n // Punycode encoded url cannot contain non ASCII characters\n return;\n }\n\n var labels = domain.split(\'.\');\n\n for (var i = 0; i < labels.length; i++) {\n var label = labels[i];\n var punycodeEncodedLabel = punycode__WEBPACK_IMPORTED_MODULE_2___default().toASCII(label);\n\n if (punycodeEncodedLabel.length < 1 || punycodeEncodedLabel.length > MAX_DOMAIN_LABEL_LENGTH) {\n // DNS label has invalid length\n return;\n }\n }\n\n return labels.join(\'.\');\n }\n};\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (idna);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/lib/idna.js?')},"./node_modules/twitter-text/dist/esm/lib/regexSupplant.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ \"./node_modules/core-js/modules/es6.regexp.replace.js\");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.regexp.constructor */ \"./node_modules/core-js/modules/es6.regexp.constructor.js\");\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es6.array.index-of */ \"./node_modules/core-js/modules/es6.array.index-of.js\");\n/* harmony import */ var core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_2__);\n\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// Builds a RegExp\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(regex, map, flags) {\n flags = flags || '';\n\n if (typeof regex !== 'string') {\n if (regex.global && flags.indexOf('g') < 0) {\n flags += 'g';\n }\n\n if (regex.ignoreCase && flags.indexOf('i') < 0) {\n flags += 'i';\n }\n\n if (regex.multiline && flags.indexOf('m') < 0) {\n flags += 'm';\n }\n\n regex = regex.source;\n }\n\n return new RegExp(regex.replace(/#\\{(\\w+)\\}/g, function (match, name) {\n var newRegex = map[name] || '';\n\n if (typeof newRegex !== 'string') {\n newRegex = newRegex.source;\n }\n\n return newRegex;\n }), flags);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/lib/regexSupplant.js?")},"./node_modules/twitter-text/dist/esm/lib/stringSupplant.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ "./node_modules/core-js/modules/es6.regexp.replace.js");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_0__);\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// simple string interpolation\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(str, map) {\n return str.replace(/#\\{(\\w+)\\}/g, function (match, name) {\n return map[name] || \'\';\n });\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/lib/stringSupplant.js?')},"./node_modules/twitter-text/dist/esm/linkTextWithEntity.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.match */ \"./node_modules/core-js/modules/es6.regexp.match.js\");\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.array.index-of */ \"./node_modules/core-js/modules/es6.array.index-of.js\");\n/* harmony import */ var core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_index_of__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es6.regexp.replace */ \"./node_modules/core-js/modules/es6.regexp.replace.js\");\n/* harmony import */ var core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_replace__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _htmlEscape__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./htmlEscape */ \"./node_modules/twitter-text/dist/esm/htmlEscape.js\");\n/* harmony import */ var _lib_stringSupplant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/stringSupplant */ \"./node_modules/twitter-text/dist/esm/lib/stringSupplant.js\");\n\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(entity, options) {\n var displayUrl = entity.display_url;\n var expandedUrl = entity.expanded_url; // Goal: If a user copies and pastes a tweet containing t.co'ed link, the resulting paste\n // should contain the full original URL (expanded_url), not the display URL.\n //\n // Method: Whenever possible, we actually emit HTML that contains expanded_url, and use\n // font-size:0 to hide those parts that should not be displayed (because they are not part of display_url).\n // Elements with font-size:0 get copied even though they are not visible.\n // Note that display:none doesn't work here. Elements with display:none don't get copied.\n //\n // Additionally, we want to *display* ellipses, but we don't want them copied. To make this happen we\n // wrap the ellipses in a tco-ellipsis class and provide an onCopy handler that sets display:none on\n // everything with the tco-ellipsis class.\n //\n // Exception: pic.twitter.com images, for which expandedUrl = \"https://twitter.com/#!/username/status/1234/photo/1\n // For those URLs, display_url is not a substring of expanded_url, so we don't do anything special to render the elided parts.\n // For a pic.twitter.com URL, the only elided part will be the \"https://\", so this is fine.\n\n var displayUrlSansEllipses = displayUrl.replace(/…/g, ''); // We have to disregard ellipses for matching\n // Note: we currently only support eliding parts of the URL at the beginning or the end.\n // Eventually we may want to elide parts of the URL in the *middle*. If so, this code will\n // become more complicated. We will probably want to create a regexp out of display URL,\n // replacing every ellipsis with a \".*\".\n\n if (expandedUrl.indexOf(displayUrlSansEllipses) != -1) {\n var displayUrlIndex = expandedUrl.indexOf(displayUrlSansEllipses);\n var v = {\n displayUrlSansEllipses: displayUrlSansEllipses,\n // Portion of expandedUrl that precedes the displayUrl substring\n beforeDisplayUrl: expandedUrl.substr(0, displayUrlIndex),\n // Portion of expandedUrl that comes after displayUrl\n afterDisplayUrl: expandedUrl.substr(displayUrlIndex + displayUrlSansEllipses.length),\n precedingEllipsis: displayUrl.match(/^…/) ? '…' : '',\n followingEllipsis: displayUrl.match(/…$/) ? '…' : ''\n };\n\n for (var k in v) {\n if (v.hasOwnProperty(k)) {\n v[k] = (0,_htmlEscape__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(v[k]);\n }\n } // As an example: The user tweets \"hi http://longdomainname.com/foo\"\n // This gets shortened to \"hi http://t.co/xyzabc\", with display_url = \"…nname.com/foo\"\n // This will get rendered as:\n // <span class='tco-ellipsis'> \x3c!-- This stuff should get displayed but not copied --\x3e\n // …\n // \x3c!-- There's a chance the onCopy event handler might not fire. In case that happens,\n // we include an here so that the … doesn't bump up against the URL and ruin it.\n // The is inside the tco-ellipsis span so that when the onCopy handler *does*\n // fire, it doesn't get copied. Otherwise the copied text would have two spaces in a row,\n // e.g. \"hi http://longdomainname.com/foo\".\n // <span style='font-size:0'> </span>\n // </span>\n // <span style='font-size:0'> \x3c!-- This stuff should get copied but not displayed --\x3e\n // http://longdomai\n // </span>\n // <span class='js-display-url'> \x3c!-- This stuff should get displayed *and* copied --\x3e\n // nname.com/foo\n // </span>\n // <span class='tco-ellipsis'> \x3c!-- This stuff should get displayed but not copied --\x3e\n // <span style='font-size:0'> </span>\n // …\n // </span>\n\n\n v['invisible'] = options.invisibleTagAttrs;\n return (0,_lib_stringSupplant__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(\"<span class='tco-ellipsis'>#{precedingEllipsis}<span #{invisible}> </span></span><span #{invisible}>#{beforeDisplayUrl}</span><span class='js-display-url'>#{displayUrlSansEllipses}</span><span #{invisible}>#{afterDisplayUrl}</span><span class='tco-ellipsis'><span #{invisible}> </span>#{followingEllipsis}</span>\", v);\n }\n\n return displayUrl;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/linkTextWithEntity.js?")},"./node_modules/twitter-text/dist/esm/linkToCashtag.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_clone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/clone */ "./node_modules/twitter-text/dist/esm/lib/clone.js");\n/* harmony import */ var _htmlEscape__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./htmlEscape */ "./node_modules/twitter-text/dist/esm/htmlEscape.js");\n/* harmony import */ var _linkToTextWithSymbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./linkToTextWithSymbol */ "./node_modules/twitter-text/dist/esm/linkToTextWithSymbol.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(entity, text, options) {\n var cashtag = (0,_htmlEscape__WEBPACK_IMPORTED_MODULE_1__["default"])(entity.cashtag);\n var attrs = (0,_lib_clone__WEBPACK_IMPORTED_MODULE_0__["default"])(options.htmlAttrs || {});\n attrs.href = options.cashtagUrlBase + cashtag;\n attrs.title = "$".concat(cashtag);\n attrs[\'class\'] = options.cashtagClass;\n\n if (options.targetBlank) {\n attrs.target = \'_blank\';\n }\n\n return (0,_linkToTextWithSymbol__WEBPACK_IMPORTED_MODULE_2__["default"])(entity, \'$\', cashtag, attrs, options);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/linkToCashtag.js?')},"./node_modules/twitter-text/dist/esm/linkToHashtag.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.match */ "./node_modules/core-js/modules/es6.regexp.match.js");\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lib_clone__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/clone */ "./node_modules/twitter-text/dist/esm/lib/clone.js");\n/* harmony import */ var _htmlEscape__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./htmlEscape */ "./node_modules/twitter-text/dist/esm/htmlEscape.js");\n/* harmony import */ var _regexp_rtlChars__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./regexp/rtlChars */ "./node_modules/twitter-text/dist/esm/regexp/rtlChars.js");\n/* harmony import */ var _linkToTextWithSymbol__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./linkToTextWithSymbol */ "./node_modules/twitter-text/dist/esm/linkToTextWithSymbol.js");\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(entity, text, options) {\n var hash = text.substring(entity.indices[0], entity.indices[0] + 1);\n var hashtag = (0,_htmlEscape__WEBPACK_IMPORTED_MODULE_2__["default"])(entity.hashtag);\n var attrs = (0,_lib_clone__WEBPACK_IMPORTED_MODULE_1__["default"])(options.htmlAttrs || {});\n attrs.href = options.hashtagUrlBase + hashtag;\n attrs.title = "#".concat(hashtag);\n attrs[\'class\'] = options.hashtagClass;\n\n if (hashtag.charAt(0).match(_regexp_rtlChars__WEBPACK_IMPORTED_MODULE_3__["default"])) {\n attrs[\'class\'] += \' rtl\';\n }\n\n if (options.targetBlank) {\n attrs.target = \'_blank\';\n }\n\n return (0,_linkToTextWithSymbol__WEBPACK_IMPORTED_MODULE_4__["default"])(entity, hash, hashtag, attrs, options);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/linkToHashtag.js?')},"./node_modules/twitter-text/dist/esm/linkToMentionAndList.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_clone__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/clone */ "./node_modules/twitter-text/dist/esm/lib/clone.js");\n/* harmony import */ var _htmlEscape__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./htmlEscape */ "./node_modules/twitter-text/dist/esm/htmlEscape.js");\n/* harmony import */ var _linkToTextWithSymbol__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./linkToTextWithSymbol */ "./node_modules/twitter-text/dist/esm/linkToTextWithSymbol.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(entity, text, options) {\n var at = text.substring(entity.indices[0], entity.indices[0] + 1);\n var user = (0,_htmlEscape__WEBPACK_IMPORTED_MODULE_1__["default"])(entity.screenName);\n var slashListname = (0,_htmlEscape__WEBPACK_IMPORTED_MODULE_1__["default"])(entity.listSlug);\n var isList = entity.listSlug && !options.suppressLists;\n var attrs = (0,_lib_clone__WEBPACK_IMPORTED_MODULE_0__["default"])(options.htmlAttrs || {});\n attrs[\'class\'] = isList ? options.listClass : options.usernameClass;\n attrs.href = isList ? options.listUrlBase + user + slashListname : options.usernameUrlBase + user;\n\n if (!isList && !options.suppressDataScreenName) {\n attrs[\'data-screen-name\'] = user;\n }\n\n if (options.targetBlank) {\n attrs.target = \'_blank\';\n }\n\n return (0,_linkToTextWithSymbol__WEBPACK_IMPORTED_MODULE_2__["default"])(entity, at, isList ? user + slashListname : user, attrs, options);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/linkToMentionAndList.js?')},"./node_modules/twitter-text/dist/esm/linkToText.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_stringSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/stringSupplant */ "./node_modules/twitter-text/dist/esm/lib/stringSupplant.js");\n/* harmony import */ var _tagAttrs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./tagAttrs */ "./node_modules/twitter-text/dist/esm/tagAttrs.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(entity, text, attributes, options) {\n if (!options.suppressNoFollow) {\n attributes.rel = \'nofollow\';\n } // if linkAttributeBlock is specified, call it to modify the attributes\n\n\n if (options.linkAttributeBlock) {\n options.linkAttributeBlock(entity, attributes);\n } // if linkTextBlock is specified, call it to get a new/modified link text\n\n\n if (options.linkTextBlock) {\n text = options.linkTextBlock(entity, text);\n }\n\n var d = {\n text: text,\n attr: (0,_tagAttrs__WEBPACK_IMPORTED_MODULE_1__["default"])(attributes)\n };\n return (0,_lib_stringSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(\'<a#{attr}>#{text}</a>\', d);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/linkToText.js?')},"./node_modules/twitter-text/dist/esm/linkToTextWithSymbol.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.match */ "./node_modules/core-js/modules/es6.regexp.match.js");\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _regexp_atSigns__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./regexp/atSigns */ "./node_modules/twitter-text/dist/esm/regexp/atSigns.js");\n/* harmony import */ var _htmlEscape__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./htmlEscape */ "./node_modules/twitter-text/dist/esm/htmlEscape.js");\n/* harmony import */ var _linkToText__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./linkToText */ "./node_modules/twitter-text/dist/esm/linkToText.js");\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(entity, symbol, text, attributes, options) {\n var taggedSymbol = options.symbolTag ? "<".concat(options.symbolTag, ">").concat(symbol, "</").concat(options.symbolTag, ">") : symbol;\n text = (0,_htmlEscape__WEBPACK_IMPORTED_MODULE_2__["default"])(text);\n var taggedText = options.textWithSymbolTag ? "<".concat(options.textWithSymbolTag, ">").concat(text, "</").concat(options.textWithSymbolTag, ">") : text;\n\n if (options.usernameIncludeSymbol || !symbol.match(_regexp_atSigns__WEBPACK_IMPORTED_MODULE_1__["default"])) {\n return (0,_linkToText__WEBPACK_IMPORTED_MODULE_3__["default"])(entity, taggedSymbol + taggedText, attributes, options);\n } else {\n return taggedSymbol + (0,_linkToText__WEBPACK_IMPORTED_MODULE_3__["default"])(entity, taggedText, attributes, options);\n }\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/linkToTextWithSymbol.js?')},"./node_modules/twitter-text/dist/esm/linkToUrl.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.match */ "./node_modules/core-js/modules/es6.regexp.match.js");\n/* harmony import */ var core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_match__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lib_clone__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/clone */ "./node_modules/twitter-text/dist/esm/lib/clone.js");\n/* harmony import */ var _htmlEscape__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./htmlEscape */ "./node_modules/twitter-text/dist/esm/htmlEscape.js");\n/* harmony import */ var _linkToText__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./linkToText */ "./node_modules/twitter-text/dist/esm/linkToText.js");\n/* harmony import */ var _linkTextWithEntity__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./linkTextWithEntity */ "./node_modules/twitter-text/dist/esm/linkTextWithEntity.js");\n/* harmony import */ var _regexp_urlHasProtocol__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./regexp/urlHasProtocol */ "./node_modules/twitter-text/dist/esm/regexp/urlHasProtocol.js");\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(entity, text, options) {\n var url = entity.url;\n var displayUrl = url;\n var linkText = (0,_htmlEscape__WEBPACK_IMPORTED_MODULE_2__["default"])(displayUrl); // If the caller passed a urlEntities object (provided by a Twitter API\n // response with include_entities=true), we use that to render the display_url\n // for each URL instead of it\'s underlying t.co URL.\n\n var urlEntity = options.urlEntities && options.urlEntities[url] || entity;\n\n if (urlEntity.display_url) {\n linkText = (0,_linkTextWithEntity__WEBPACK_IMPORTED_MODULE_4__["default"])(urlEntity, options);\n }\n\n var attrs = (0,_lib_clone__WEBPACK_IMPORTED_MODULE_1__["default"])(options.htmlAttrs || {});\n\n if (!url.match(_regexp_urlHasProtocol__WEBPACK_IMPORTED_MODULE_5__["default"])) {\n url = "http://".concat(url);\n }\n\n attrs.href = url;\n\n if (options.targetBlank) {\n attrs.target = \'_blank\';\n } // set class only if urlClass is specified.\n\n\n if (options.urlClass) {\n attrs[\'class\'] = options.urlClass;\n } // set target only if urlTarget is specified.\n\n\n if (options.urlTarget) {\n attrs.target = options.urlTarget;\n }\n\n if (!options.title && urlEntity.display_url) {\n attrs.title = urlEntity.expanded_url;\n }\n\n return (0,_linkToText__WEBPACK_IMPORTED_MODULE_3__["default"])(entity, linkText, attrs, options);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/linkToUrl.js?')},"./node_modules/twitter-text/dist/esm/modifyIndicesFromUTF16ToUnicode.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_convertUnicodeIndices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/convertUnicodeIndices */ "./node_modules/twitter-text/dist/esm/lib/convertUnicodeIndices.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, entities) {\n (0,_lib_convertUnicodeIndices__WEBPACK_IMPORTED_MODULE_0__["default"])(text, entities, true);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/modifyIndicesFromUTF16ToUnicode.js?')},"./node_modules/twitter-text/dist/esm/modifyIndicesFromUnicodeToUTF16.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_convertUnicodeIndices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./lib/convertUnicodeIndices */ "./node_modules/twitter-text/dist/esm/lib/convertUnicodeIndices.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text, entities) {\n (0,_lib_convertUnicodeIndices__WEBPACK_IMPORTED_MODULE_0__["default"])(text, entities, false);\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/modifyIndicesFromUnicodeToUTF16.js?')},"./node_modules/twitter-text/dist/esm/parseTweet.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_array_reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.array.reduce */ "./node_modules/core-js/modules/es6.array.reduce.js");\n/* harmony import */ var core_js_modules_es6_array_reduce__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_reduce__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/web.dom.iterable */ "./node_modules/core-js/modules/web.dom.iterable.js");\n/* harmony import */ var core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_iterable__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es6.array.iterator */ "./node_modules/core-js/modules/es6.array.iterator.js");\n/* harmony import */ var core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_iterator__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es6.object.to-string */ "./node_modules/core-js/modules/es6.object.to-string.js");\n/* harmony import */ var core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es6.object.keys */ "./node_modules/core-js/modules/es6.object.keys.js");\n/* harmony import */ var core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_keys__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _configs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./configs */ "./node_modules/twitter-text/dist/esm/configs.js");\n/* harmony import */ var _extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./extractUrlsWithIndices */ "./node_modules/twitter-text/dist/esm/extractUrlsWithIndices.js");\n/* harmony import */ var _lib_getCharacterWeight__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./lib/getCharacterWeight */ "./node_modules/twitter-text/dist/esm/lib/getCharacterWeight.js");\n/* harmony import */ var _hasInvalidCharacters__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./hasInvalidCharacters */ "./node_modules/twitter-text/dist/esm/hasInvalidCharacters.js");\n/* harmony import */ var _modifyIndicesFromUTF16ToUnicode__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./modifyIndicesFromUTF16ToUnicode */ "./node_modules/twitter-text/dist/esm/modifyIndicesFromUTF16ToUnicode.js");\n/* harmony import */ var twemoji_parser__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! twemoji-parser */ "./node_modules/twemoji-parser/dist/index.js");\n/* harmony import */ var _regexp_urlHasHttps__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./regexp/urlHasHttps */ "./node_modules/twitter-text/dist/esm/regexp/urlHasHttps.js");\n\n\n\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n // TODO: WEB-19861 Replace with public package after it is open sourced\n\n\n\n/**\n * [parseTweet description]\n * @param {string} text tweet text to parse\n * @param {Object} options config options to pass\n * @return {Object} Fields in response described below:\n *\n * Response fields:\n * weightedLength {int} the weighted length of tweet based on weights specified in the config\n * valid {bool} If tweet is valid\n * permillage {float} permillage of the tweet over the max length specified in config\n * validRangeStart {int} beginning of valid text\n * validRangeEnd {int} End index of valid part of the tweet text (inclusive) in utf16\n * displayRangeStart {int} beginning index of display text\n * displayRangeEnd {int} end index of display text (inclusive) in utf16\n */\n\nvar parseTweet = function parseTweet() {\n var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \'\';\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _configs__WEBPACK_IMPORTED_MODULE_5__["default"].defaults;\n var mergedOptions = Object.keys(options).length ? options : _configs__WEBPACK_IMPORTED_MODULE_5__["default"].defaults;\n var defaultWeight = mergedOptions.defaultWeight,\n emojiParsingEnabled = mergedOptions.emojiParsingEnabled,\n scale = mergedOptions.scale,\n maxWeightedTweetLength = mergedOptions.maxWeightedTweetLength,\n transformedURLLength = mergedOptions.transformedURLLength;\n var normalizedText = typeof String.prototype.normalize === \'function\' ? text.normalize() : text; // Hash all entities by their startIndex for fast lookup\n\n var urlEntitiesMap = transformEntitiesToHash((0,_extractUrlsWithIndices__WEBPACK_IMPORTED_MODULE_6__["default"])(normalizedText));\n var emojiEntitiesMap = emojiParsingEnabled ? transformEntitiesToHash((0,twemoji_parser__WEBPACK_IMPORTED_MODULE_10__.parse)(normalizedText)) : [];\n var tweetLength = normalizedText.length;\n var weightedLength = 0;\n var validDisplayIndex = 0;\n var valid = true; // Go through every character and calculate weight\n\n for (var charIndex = 0; charIndex < tweetLength; charIndex++) {\n // If a url begins at the specified index handle, add constant length\n if (urlEntitiesMap[charIndex]) {\n var _urlEntitiesMap$charI = urlEntitiesMap[charIndex],\n url = _urlEntitiesMap$charI.url,\n indices = _urlEntitiesMap$charI.indices;\n weightedLength += transformedURLLength * scale;\n charIndex += url.length - 1;\n } else if (emojiParsingEnabled && emojiEntitiesMap[charIndex]) {\n var _emojiEntitiesMap$cha = emojiEntitiesMap[charIndex],\n emoji = _emojiEntitiesMap$cha.text,\n _indices = _emojiEntitiesMap$cha.indices;\n weightedLength += defaultWeight;\n charIndex += emoji.length - 1;\n } else {\n charIndex += isSurrogatePair(normalizedText, charIndex) ? 1 : 0;\n weightedLength += (0,_lib_getCharacterWeight__WEBPACK_IMPORTED_MODULE_7__["default"])(normalizedText.charAt(charIndex), mergedOptions);\n } // Only test for validity of character if it is still valid\n\n\n if (valid) {\n valid = !(0,_hasInvalidCharacters__WEBPACK_IMPORTED_MODULE_8__["default"])(normalizedText.substring(charIndex, charIndex + 1));\n }\n\n if (valid && weightedLength <= maxWeightedTweetLength * scale) {\n validDisplayIndex = charIndex;\n }\n }\n\n weightedLength = weightedLength / scale;\n valid = valid && weightedLength > 0 && weightedLength <= maxWeightedTweetLength;\n var permillage = Math.floor(weightedLength / maxWeightedTweetLength * 1000);\n var normalizationOffset = text.length - normalizedText.length;\n validDisplayIndex += normalizationOffset;\n return {\n weightedLength: weightedLength,\n valid: valid,\n permillage: permillage,\n validRangeStart: 0,\n validRangeEnd: validDisplayIndex,\n displayRangeStart: 0,\n displayRangeEnd: text.length > 0 ? text.length - 1 : 0\n };\n};\n\nvar transformEntitiesToHash = function transformEntitiesToHash(entities) {\n return entities.reduce(function (map, entity) {\n map[entity.indices[0]] = entity;\n return map;\n }, {});\n};\n\nvar isSurrogatePair = function isSurrogatePair(text, cIndex) {\n // Test if a character is the beginning of a surrogate pair\n if (cIndex < text.length - 1) {\n var c = text.charCodeAt(cIndex);\n var cNext = text.charCodeAt(cIndex + 1);\n return 0xd800 <= c && c <= 0xdbff && 0xdc00 <= cNext && cNext <= 0xdfff;\n }\n\n return false;\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (parseTweet);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/parseTweet.js?')},"./node_modules/twitter-text/dist/esm/regexp/astralLetterAndMarks.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// Generated from unicode_regex/unicode_regex_groups.scala, same as objective c\'s \\p{L}\\p{M}\nvar astralLetterAndMarks = /\\ud800[\\udc00-\\udc0b\\udc0d-\\udc26\\udc28-\\udc3a\\udc3c\\udc3d\\udc3f-\\udc4d\\udc50-\\udc5d\\udc80-\\udcfa\\uddfd\\ude80-\\ude9c\\udea0-\\uded0\\udee0\\udf00-\\udf1f\\udf30-\\udf40\\udf42-\\udf49\\udf50-\\udf7a\\udf80-\\udf9d\\udfa0-\\udfc3\\udfc8-\\udfcf]|\\ud801[\\udc00-\\udc9d\\udd00-\\udd27\\udd30-\\udd63\\ude00-\\udf36\\udf40-\\udf55\\udf60-\\udf67]|\\ud802[\\udc00-\\udc05\\udc08\\udc0a-\\udc35\\udc37\\udc38\\udc3c\\udc3f-\\udc55\\udc60-\\udc76\\udc80-\\udc9e\\udd00-\\udd15\\udd20-\\udd39\\udd80-\\uddb7\\uddbe\\uddbf\\ude00-\\ude03\\ude05\\ude06\\ude0c-\\ude13\\ude15-\\ude17\\ude19-\\ude33\\ude38-\\ude3a\\ude3f\\ude60-\\ude7c\\ude80-\\ude9c\\udec0-\\udec7\\udec9-\\udee6\\udf00-\\udf35\\udf40-\\udf55\\udf60-\\udf72\\udf80-\\udf91]|\\ud803[\\udc00-\\udc48]|\\ud804[\\udc00-\\udc46\\udc7f-\\udcba\\udcd0-\\udce8\\udd00-\\udd34\\udd50-\\udd73\\udd76\\udd80-\\uddc4\\uddda\\ude00-\\ude11\\ude13-\\ude37\\udeb0-\\udeea\\udf01-\\udf03\\udf05-\\udf0c\\udf0f\\udf10\\udf13-\\udf28\\udf2a-\\udf30\\udf32\\udf33\\udf35-\\udf39\\udf3c-\\udf44\\udf47\\udf48\\udf4b-\\udf4d\\udf57\\udf5d-\\udf63\\udf66-\\udf6c\\udf70-\\udf74]|\\ud805[\\udc80-\\udcc5\\udcc7\\udd80-\\uddb5\\uddb8-\\uddc0\\ude00-\\ude40\\ude44\\ude80-\\udeb7]|\\ud806[\\udca0-\\udcdf\\udcff\\udec0-\\udef8]|\\ud808[\\udc00-\\udf98]|\\ud80c[\\udc00-\\udfff]|\\ud80d[\\udc00-\\udc2e]|\\ud81a[\\udc00-\\ude38\\ude40-\\ude5e\\uded0-\\udeed\\udef0-\\udef4\\udf00-\\udf36\\udf40-\\udf43\\udf63-\\udf77\\udf7d-\\udf8f]|\\ud81b[\\udf00-\\udf44\\udf50-\\udf7e\\udf8f-\\udf9f]|\\ud82c[\\udc00\\udc01]|\\ud82f[\\udc00-\\udc6a\\udc70-\\udc7c\\udc80-\\udc88\\udc90-\\udc99\\udc9d\\udc9e]|\\ud834[\\udd65-\\udd69\\udd6d-\\udd72\\udd7b-\\udd82\\udd85-\\udd8b\\uddaa-\\uddad\\ude42-\\ude44]|\\ud835[\\udc00-\\udc54\\udc56-\\udc9c\\udc9e\\udc9f\\udca2\\udca5\\udca6\\udca9-\\udcac\\udcae-\\udcb9\\udcbb\\udcbd-\\udcc3\\udcc5-\\udd05\\udd07-\\udd0a\\udd0d-\\udd14\\udd16-\\udd1c\\udd1e-\\udd39\\udd3b-\\udd3e\\udd40-\\udd44\\udd46\\udd4a-\\udd50\\udd52-\\udea5\\udea8-\\udec0\\udec2-\\udeda\\udedc-\\udefa\\udefc-\\udf14\\udf16-\\udf34\\udf36-\\udf4e\\udf50-\\udf6e\\udf70-\\udf88\\udf8a-\\udfa8\\udfaa-\\udfc2\\udfc4-\\udfcb]|\\ud83a[\\udc00-\\udcc4\\udcd0-\\udcd6]|\\ud83b[\\ude00-\\ude03\\ude05-\\ude1f\\ude21\\ude22\\ude24\\ude27\\ude29-\\ude32\\ude34-\\ude37\\ude39\\ude3b\\ude42\\ude47\\ude49\\ude4b\\ude4d-\\ude4f\\ude51\\ude52\\ude54\\ude57\\ude59\\ude5b\\ude5d\\ude5f\\ude61\\ude62\\ude64\\ude67-\\ude6a\\ude6c-\\ude72\\ude74-\\ude77\\ude79-\\ude7c\\ude7e\\ude80-\\ude89\\ude8b-\\ude9b\\udea1-\\udea3\\udea5-\\udea9\\udeab-\\udebb]|\\ud840[\\udc00-\\udfff]|\\ud841[\\udc00-\\udfff]|\\ud842[\\udc00-\\udfff]|\\ud843[\\udc00-\\udfff]|\\ud844[\\udc00-\\udfff]|\\ud845[\\udc00-\\udfff]|\\ud846[\\udc00-\\udfff]|\\ud847[\\udc00-\\udfff]|\\ud848[\\udc00-\\udfff]|\\ud849[\\udc00-\\udfff]|\\ud84a[\\udc00-\\udfff]|\\ud84b[\\udc00-\\udfff]|\\ud84c[\\udc00-\\udfff]|\\ud84d[\\udc00-\\udfff]|\\ud84e[\\udc00-\\udfff]|\\ud84f[\\udc00-\\udfff]|\\ud850[\\udc00-\\udfff]|\\ud851[\\udc00-\\udfff]|\\ud852[\\udc00-\\udfff]|\\ud853[\\udc00-\\udfff]|\\ud854[\\udc00-\\udfff]|\\ud855[\\udc00-\\udfff]|\\ud856[\\udc00-\\udfff]|\\ud857[\\udc00-\\udfff]|\\ud858[\\udc00-\\udfff]|\\ud859[\\udc00-\\udfff]|\\ud85a[\\udc00-\\udfff]|\\ud85b[\\udc00-\\udfff]|\\ud85c[\\udc00-\\udfff]|\\ud85d[\\udc00-\\udfff]|\\ud85e[\\udc00-\\udfff]|\\ud85f[\\udc00-\\udfff]|\\ud860[\\udc00-\\udfff]|\\ud861[\\udc00-\\udfff]|\\ud862[\\udc00-\\udfff]|\\ud863[\\udc00-\\udfff]|\\ud864[\\udc00-\\udfff]|\\ud865[\\udc00-\\udfff]|\\ud866[\\udc00-\\udfff]|\\ud867[\\udc00-\\udfff]|\\ud868[\\udc00-\\udfff]|\\ud869[\\udc00-\\uded6\\udf00-\\udfff]|\\ud86a[\\udc00-\\udfff]|\\ud86b[\\udc00-\\udfff]|\\ud86c[\\udc00-\\udfff]|\\ud86d[\\udc00-\\udf34\\udf40-\\udfff]|\\ud86e[\\udc00-\\udc1d]|\\ud87e[\\udc00-\\ude1d]|\\udb40[\\udd00-\\uddef]/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (astralLetterAndMarks);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/astralLetterAndMarks.js?')},"./node_modules/twitter-text/dist/esm/regexp/astralNumerals.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar astralNumerals = /\\ud801[\\udca0-\\udca9]|\\ud804[\\udc66-\\udc6f\\udcf0-\\udcf9\\udd36-\\udd3f\\uddd0-\\uddd9\\udef0-\\udef9]|\\ud805[\\udcd0-\\udcd9\\ude50-\\ude59\\udec0-\\udec9]|\\ud806[\\udce0-\\udce9]|\\ud81a[\\ude60-\\ude69\\udf50-\\udf59]|\\ud835[\\udfce-\\udfff]/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (astralNumerals);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/astralNumerals.js?')},"./node_modules/twitter-text/dist/esm/regexp/atSigns.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar atSigns = /[@@]/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (atSigns);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/atSigns.js?')},"./node_modules/twitter-text/dist/esm/regexp/bmpLetterAndMarks.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// Generated from unicode_regex/unicode_regex_groups.scala, same as objective c\'s \\p{L}\\p{M}\nvar bmpLetterAndMarks = /A-Za-z\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0300-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u037f\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u0483-\\u052f\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0610-\\u061a\\u0620-\\u065f\\u066e-\\u06d3\\u06d5-\\u06dc\\u06df-\\u06e8\\u06ea-\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710-\\u074a\\u074d-\\u07b1\\u07ca-\\u07f5\\u07fa\\u0800-\\u082d\\u0840-\\u085b\\u08a0-\\u08b2\\u08e4-\\u0963\\u0971-\\u0983\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bc-\\u09c4\\u09c7\\u09c8\\u09cb-\\u09ce\\u09d7\\u09dc\\u09dd\\u09df-\\u09e3\\u09f0\\u09f1\\u0a01-\\u0a03\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a59-\\u0a5c\\u0a5e\\u0a70-\\u0a75\\u0a81-\\u0a83\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abc-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ad0\\u0ae0-\\u0ae3\\u0b01-\\u0b03\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3c-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5c\\u0b5d\\u0b5f-\\u0b63\\u0b71\\u0b82\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd0\\u0bd7\\u0c00-\\u0c03\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c39\\u0c3d-\\u0c44\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c58\\u0c59\\u0c60-\\u0c63\\u0c81-\\u0c83\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbc-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0cde\\u0ce0-\\u0ce3\\u0cf1\\u0cf2\\u0d01-\\u0d03\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d-\\u0d44\\u0d46-\\u0d48\\u0d4a-\\u0d4e\\u0d57\\u0d60-\\u0d63\\u0d7a-\\u0d7f\\u0d82\\u0d83\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e01-\\u0e3a\\u0e40-\\u0e4e\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb9\\u0ebb-\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0ec8-\\u0ecd\\u0edc-\\u0edf\\u0f00\\u0f18\\u0f19\\u0f35\\u0f37\\u0f39\\u0f3e-\\u0f47\\u0f49-\\u0f6c\\u0f71-\\u0f84\\u0f86-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u103f\\u1050-\\u108f\\u109a-\\u109d\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u135d-\\u135f\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16f1-\\u16f8\\u1700-\\u170c\\u170e-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176c\\u176e-\\u1770\\u1772\\u1773\\u1780-\\u17d3\\u17d7\\u17dc\\u17dd\\u180b-\\u180d\\u1820-\\u1877\\u1880-\\u18aa\\u18b0-\\u18f5\\u1900-\\u191e\\u1920-\\u192b\\u1930-\\u193b\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19b0-\\u19c9\\u1a00-\\u1a1b\\u1a20-\\u1a5e\\u1a60-\\u1a7c\\u1a7f\\u1aa7\\u1ab0-\\u1abe\\u1b00-\\u1b4b\\u1b6b-\\u1b73\\u1b80-\\u1baf\\u1bba-\\u1bf3\\u1c00-\\u1c37\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1cd0-\\u1cd2\\u1cd4-\\u1cf6\\u1cf8\\u1cf9\\u1d00-\\u1df5\\u1dfc-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u20d0-\\u20f0\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2183\\u2184\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d7f-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2de0-\\u2dff\\u2e2f\\u3005\\u3006\\u302a-\\u302f\\u3031-\\u3035\\u303b\\u303c\\u3041-\\u3096\\u3099\\u309a\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua672\\ua674-\\ua67d\\ua67f-\\ua69d\\ua69f-\\ua6e5\\ua6f0\\ua6f1\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua7ad\\ua7b0\\ua7b1\\ua7f7-\\ua827\\ua840-\\ua873\\ua880-\\ua8c4\\ua8e0-\\ua8f7\\ua8fb\\ua90a-\\ua92d\\ua930-\\ua953\\ua960-\\ua97c\\ua980-\\ua9c0\\ua9cf\\ua9e0-\\ua9ef\\ua9fa-\\ua9fe\\uaa00-\\uaa36\\uaa40-\\uaa4d\\uaa60-\\uaa76\\uaa7a-\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaef\\uaaf2-\\uaaf6\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uab30-\\uab5a\\uab5c-\\uab5f\\uab64\\uab65\\uabc0-\\uabea\\uabec\\uabed\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf870-\\uf87f\\uf882\\uf884-\\uf89f\\uf8b8\\uf8c1-\\uf8d6\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe00-\\ufe0f\\ufe20-\\ufe2d\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (bmpLetterAndMarks);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/bmpLetterAndMarks.js?')},"./node_modules/twitter-text/dist/esm/regexp/bmpNumerals.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar bmpNumerals = /0-9\\u0660-\\u0669\\u06f0-\\u06f9\\u07c0-\\u07c9\\u0966-\\u096f\\u09e6-\\u09ef\\u0a66-\\u0a6f\\u0ae6-\\u0aef\\u0b66-\\u0b6f\\u0be6-\\u0bef\\u0c66-\\u0c6f\\u0ce6-\\u0cef\\u0d66-\\u0d6f\\u0de6-\\u0def\\u0e50-\\u0e59\\u0ed0-\\u0ed9\\u0f20-\\u0f29\\u1040-\\u1049\\u1090-\\u1099\\u17e0-\\u17e9\\u1810-\\u1819\\u1946-\\u194f\\u19d0-\\u19d9\\u1a80-\\u1a89\\u1a90-\\u1a99\\u1b50-\\u1b59\\u1bb0-\\u1bb9\\u1c40-\\u1c49\\u1c50-\\u1c59\\ua620-\\ua629\\ua8d0-\\ua8d9\\ua900-\\ua909\\ua9d0-\\ua9d9\\ua9f0-\\ua9f9\\uaa50-\\uaa59\\uabf0-\\uabf9\\uff10-\\uff19/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (bmpNumerals);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/bmpNumerals.js?')},"./node_modules/twitter-text/dist/esm/regexp/cashtag.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar cashtag = /[a-z]{1,6}(?:[._][a-z]{1,2})?/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (cashtag);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/cashtag.js?')},"./node_modules/twitter-text/dist/esm/regexp/codePoint.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar codePoint = /(?:[^\\uD800-\\uDFFF]|[\\uD800-\\uDBFF][\\uDC00-\\uDFFF])/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (codePoint);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/codePoint.js?')},"./node_modules/twitter-text/dist/esm/regexp/cyrillicLettersAndMarks.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar cyrillicLettersAndMarks = /\\u0400-\\u04FF/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (cyrillicLettersAndMarks);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/cyrillicLettersAndMarks.js?')},"./node_modules/twitter-text/dist/esm/regexp/directionalMarkersGroup.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar directionalMarkersGroup = /\\u202A-\\u202E\\u061C\\u200E\\u200F\\u2066\\u2067\\u2068\\u2069/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (directionalMarkersGroup);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/directionalMarkersGroup.js?')},"./node_modules/twitter-text/dist/esm/regexp/endHashtagMatch.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _hashSigns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hashSigns */ "./node_modules/twitter-text/dist/esm/regexp/hashSigns.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\nvar endHashtagMatch = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__["default"])(/^(?:#{hashSigns}|:\\/\\/)/, {\n hashSigns: _hashSigns__WEBPACK_IMPORTED_MODULE_0__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (endHashtagMatch);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/endHashtagMatch.js?')},"./node_modules/twitter-text/dist/esm/regexp/endMentionMatch.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _atSigns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./atSigns */ "./node_modules/twitter-text/dist/esm/regexp/atSigns.js");\n/* harmony import */ var _latinAccentChars__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./latinAccentChars */ "./node_modules/twitter-text/dist/esm/regexp/latinAccentChars.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\nvar endMentionMatch = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__["default"])(/^(?:#{atSigns}|[#{latinAccentChars}]|:\\/\\/)/, {\n atSigns: _atSigns__WEBPACK_IMPORTED_MODULE_0__["default"],\n latinAccentChars: _latinAccentChars__WEBPACK_IMPORTED_MODULE_1__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (endMentionMatch);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/endMentionMatch.js?')},"./node_modules/twitter-text/dist/esm/regexp/extractUrl.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validDomain__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validDomain */ "./node_modules/twitter-text/dist/esm/regexp/validDomain.js");\n/* harmony import */ var _validPortNumber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validPortNumber */ "./node_modules/twitter-text/dist/esm/regexp/validPortNumber.js");\n/* harmony import */ var _validUrlPath__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validUrlPath */ "./node_modules/twitter-text/dist/esm/regexp/validUrlPath.js");\n/* harmony import */ var _validUrlPrecedingChars__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./validUrlPrecedingChars */ "./node_modules/twitter-text/dist/esm/regexp/validUrlPrecedingChars.js");\n/* harmony import */ var _validUrlQueryChars__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./validUrlQueryChars */ "./node_modules/twitter-text/dist/esm/regexp/validUrlQueryChars.js");\n/* harmony import */ var _validUrlQueryEndingChars__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./validUrlQueryEndingChars */ "./node_modules/twitter-text/dist/esm/regexp/validUrlQueryEndingChars.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\n\n\nvar extractUrl = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(\'(\' + // $1 total match\n\'(#{validUrlPrecedingChars})\' + // $2 Preceeding chracter\n\'(\' + // $3 URL\n\'(https?:\\\\/\\\\/)?\' + // $4 Protocol (optional)\n\'(#{validDomain})\' + // $5 Domain(s)\n\'(?::(#{validPortNumber}))?\' + // $6 Port number (optional)\n\'(\\\\/#{validUrlPath}*)?\' + // $7 URL Path\n\'(\\\\?#{validUrlQueryChars}*#{validUrlQueryEndingChars})?\' + // $8 Query String\n\')\' + \')\', {\n validUrlPrecedingChars: _validUrlPrecedingChars__WEBPACK_IMPORTED_MODULE_4__["default"],\n validDomain: _validDomain__WEBPACK_IMPORTED_MODULE_1__["default"],\n validPortNumber: _validPortNumber__WEBPACK_IMPORTED_MODULE_2__["default"],\n validUrlPath: _validUrlPath__WEBPACK_IMPORTED_MODULE_3__["default"],\n validUrlQueryChars: _validUrlQueryChars__WEBPACK_IMPORTED_MODULE_5__["default"],\n validUrlQueryEndingChars: _validUrlQueryEndingChars__WEBPACK_IMPORTED_MODULE_6__["default"]\n}, \'gi\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (extractUrl);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/extractUrl.js?')},"./node_modules/twitter-text/dist/esm/regexp/hashSigns.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar hashSigns = /[##]/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (hashSigns);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/hashSigns.js?')},"./node_modules/twitter-text/dist/esm/regexp/hashtagAlpha.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _astralLetterAndMarks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./astralLetterAndMarks */ "./node_modules/twitter-text/dist/esm/regexp/astralLetterAndMarks.js");\n/* harmony import */ var _bmpLetterAndMarks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bmpLetterAndMarks */ "./node_modules/twitter-text/dist/esm/regexp/bmpLetterAndMarks.js");\n/* harmony import */ var _nonBmpCodePairs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./nonBmpCodePairs */ "./node_modules/twitter-text/dist/esm/regexp/nonBmpCodePairs.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n // A hashtag must contain at least one unicode letter or mark, as well as numbers, underscores, and select special characters.\n\nvar hashtagAlpha = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_3__["default"])(/(?:[#{bmpLetterAndMarks}]|(?=#{nonBmpCodePairs})(?:#{astralLetterAndMarks}))/, {\n bmpLetterAndMarks: _bmpLetterAndMarks__WEBPACK_IMPORTED_MODULE_1__["default"],\n nonBmpCodePairs: _nonBmpCodePairs__WEBPACK_IMPORTED_MODULE_2__["default"],\n astralLetterAndMarks: _astralLetterAndMarks__WEBPACK_IMPORTED_MODULE_0__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (hashtagAlpha);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/hashtagAlpha.js?')},"./node_modules/twitter-text/dist/esm/regexp/hashtagAlphaNumeric.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _astralLetterAndMarks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./astralLetterAndMarks */ "./node_modules/twitter-text/dist/esm/regexp/astralLetterAndMarks.js");\n/* harmony import */ var _astralNumerals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./astralNumerals */ "./node_modules/twitter-text/dist/esm/regexp/astralNumerals.js");\n/* harmony import */ var _bmpLetterAndMarks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bmpLetterAndMarks */ "./node_modules/twitter-text/dist/esm/regexp/bmpLetterAndMarks.js");\n/* harmony import */ var _bmpNumerals__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bmpNumerals */ "./node_modules/twitter-text/dist/esm/regexp/bmpNumerals.js");\n/* harmony import */ var _hashtagSpecialChars__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hashtagSpecialChars */ "./node_modules/twitter-text/dist/esm/regexp/hashtagSpecialChars.js");\n/* harmony import */ var _nonBmpCodePairs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./nonBmpCodePairs */ "./node_modules/twitter-text/dist/esm/regexp/nonBmpCodePairs.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\n\n\nvar hashtagAlphaNumeric = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_6__["default"])(/(?:[#{bmpLetterAndMarks}#{bmpNumerals}#{hashtagSpecialChars}]|(?=#{nonBmpCodePairs})(?:#{astralLetterAndMarks}|#{astralNumerals}))/, {\n bmpLetterAndMarks: _bmpLetterAndMarks__WEBPACK_IMPORTED_MODULE_2__["default"],\n bmpNumerals: _bmpNumerals__WEBPACK_IMPORTED_MODULE_3__["default"],\n hashtagSpecialChars: _hashtagSpecialChars__WEBPACK_IMPORTED_MODULE_4__["default"],\n nonBmpCodePairs: _nonBmpCodePairs__WEBPACK_IMPORTED_MODULE_5__["default"],\n astralLetterAndMarks: _astralLetterAndMarks__WEBPACK_IMPORTED_MODULE_0__["default"],\n astralNumerals: _astralNumerals__WEBPACK_IMPORTED_MODULE_1__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (hashtagAlphaNumeric);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/hashtagAlphaNumeric.js?')},"./node_modules/twitter-text/dist/esm/regexp/hashtagBoundary.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _codePoint__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./codePoint */ "./node_modules/twitter-text/dist/esm/regexp/codePoint.js");\n/* harmony import */ var _hashtagAlphaNumeric__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hashtagAlphaNumeric */ "./node_modules/twitter-text/dist/esm/regexp/hashtagAlphaNumeric.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\nvar hashtagBoundary = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__["default"])(/(?:^|\\uFE0E|\\uFE0F|$|(?!#{hashtagAlphaNumeric}|&)#{codePoint})/, {\n codePoint: _codePoint__WEBPACK_IMPORTED_MODULE_0__["default"],\n hashtagAlphaNumeric: _hashtagAlphaNumeric__WEBPACK_IMPORTED_MODULE_1__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (hashtagBoundary);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/hashtagBoundary.js?')},"./node_modules/twitter-text/dist/esm/regexp/hashtagSpecialChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar hashtagSpecialChars = /_\\u200c\\u200d\\ua67e\\u05be\\u05f3\\u05f4\\uff5e\\u301c\\u309b\\u309c\\u30a0\\u30fb\\u3003\\u0f0b\\u0f0c\\xb7/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (hashtagSpecialChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/hashtagSpecialChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _astralLetterAndMarks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./astralLetterAndMarks */ "./node_modules/twitter-text/dist/esm/regexp/astralLetterAndMarks.js");\n/* harmony import */ var _astralNumerals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./astralNumerals */ "./node_modules/twitter-text/dist/esm/regexp/astralNumerals.js");\n/* harmony import */ var _atSigns__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./atSigns */ "./node_modules/twitter-text/dist/esm/regexp/atSigns.js");\n/* harmony import */ var _bmpLetterAndMarks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./bmpLetterAndMarks */ "./node_modules/twitter-text/dist/esm/regexp/bmpLetterAndMarks.js");\n/* harmony import */ var _bmpNumerals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./bmpNumerals */ "./node_modules/twitter-text/dist/esm/regexp/bmpNumerals.js");\n/* harmony import */ var _cashtag__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./cashtag */ "./node_modules/twitter-text/dist/esm/regexp/cashtag.js");\n/* harmony import */ var _codePoint__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./codePoint */ "./node_modules/twitter-text/dist/esm/regexp/codePoint.js");\n/* harmony import */ var _cyrillicLettersAndMarks__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./cyrillicLettersAndMarks */ "./node_modules/twitter-text/dist/esm/regexp/cyrillicLettersAndMarks.js");\n/* harmony import */ var _endHashtagMatch__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./endHashtagMatch */ "./node_modules/twitter-text/dist/esm/regexp/endHashtagMatch.js");\n/* harmony import */ var _endMentionMatch__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./endMentionMatch */ "./node_modules/twitter-text/dist/esm/regexp/endMentionMatch.js");\n/* harmony import */ var _extractUrl__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./extractUrl */ "./node_modules/twitter-text/dist/esm/regexp/extractUrl.js");\n/* harmony import */ var _hashSigns__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./hashSigns */ "./node_modules/twitter-text/dist/esm/regexp/hashSigns.js");\n/* harmony import */ var _hashtagAlpha__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./hashtagAlpha */ "./node_modules/twitter-text/dist/esm/regexp/hashtagAlpha.js");\n/* harmony import */ var _hashtagAlphaNumeric__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./hashtagAlphaNumeric */ "./node_modules/twitter-text/dist/esm/regexp/hashtagAlphaNumeric.js");\n/* harmony import */ var _hashtagBoundary__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./hashtagBoundary */ "./node_modules/twitter-text/dist/esm/regexp/hashtagBoundary.js");\n/* harmony import */ var _hashtagSpecialChars__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./hashtagSpecialChars */ "./node_modules/twitter-text/dist/esm/regexp/hashtagSpecialChars.js");\n/* harmony import */ var _invalidChars__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./invalidChars */ "./node_modules/twitter-text/dist/esm/regexp/invalidChars.js");\n/* harmony import */ var _invalidCharsGroup__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./invalidCharsGroup */ "./node_modules/twitter-text/dist/esm/regexp/invalidCharsGroup.js");\n/* harmony import */ var _invalidDomainChars__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./invalidDomainChars */ "./node_modules/twitter-text/dist/esm/regexp/invalidDomainChars.js");\n/* harmony import */ var _invalidUrlWithoutProtocolPrecedingChars__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./invalidUrlWithoutProtocolPrecedingChars */ "./node_modules/twitter-text/dist/esm/regexp/invalidUrlWithoutProtocolPrecedingChars.js");\n/* harmony import */ var _latinAccentChars__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./latinAccentChars */ "./node_modules/twitter-text/dist/esm/regexp/latinAccentChars.js");\n/* harmony import */ var _nonBmpCodePairs__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./nonBmpCodePairs */ "./node_modules/twitter-text/dist/esm/regexp/nonBmpCodePairs.js");\n/* harmony import */ var _punct__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./punct */ "./node_modules/twitter-text/dist/esm/regexp/punct.js");\n/* harmony import */ var _rtlChars__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./rtlChars */ "./node_modules/twitter-text/dist/esm/regexp/rtlChars.js");\n/* harmony import */ var _spaces__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./spaces */ "./node_modules/twitter-text/dist/esm/regexp/spaces.js");\n/* harmony import */ var _spacesGroup__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./spacesGroup */ "./node_modules/twitter-text/dist/esm/regexp/spacesGroup.js");\n/* harmony import */ var _urlHasHttps__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./urlHasHttps */ "./node_modules/twitter-text/dist/esm/regexp/urlHasHttps.js");\n/* harmony import */ var _urlHasProtocol__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./urlHasProtocol */ "./node_modules/twitter-text/dist/esm/regexp/urlHasProtocol.js");\n/* harmony import */ var _validAsciiDomain__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./validAsciiDomain */ "./node_modules/twitter-text/dist/esm/regexp/validAsciiDomain.js");\n/* harmony import */ var _validateUrlAuthority__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./validateUrlAuthority */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlAuthority.js");\n/* harmony import */ var _validateUrlDecOctet__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./validateUrlDecOctet */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlDecOctet.js");\n/* harmony import */ var _validateUrlDomain__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./validateUrlDomain */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlDomain.js");\n/* harmony import */ var _validateUrlDomainSegment__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./validateUrlDomainSegment */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlDomainSegment.js");\n/* harmony import */ var _validateUrlDomainTld__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./validateUrlDomainTld */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlDomainTld.js");\n/* harmony import */ var _validateUrlFragment__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./validateUrlFragment */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlFragment.js");\n/* harmony import */ var _validateUrlHost__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./validateUrlHost */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlHost.js");\n/* harmony import */ var _validateUrlIp__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./validateUrlIp */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlIp.js");\n/* harmony import */ var _validateUrlIpv4__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./validateUrlIpv4 */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlIpv4.js");\n/* harmony import */ var _validateUrlIpv6__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./validateUrlIpv6 */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlIpv6.js");\n/* harmony import */ var _validateUrlPath__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./validateUrlPath */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPath.js");\n/* harmony import */ var _validateUrlPchar__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./validateUrlPchar */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPchar.js");\n/* harmony import */ var _validateUrlPctEncoded__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./validateUrlPctEncoded */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPctEncoded.js");\n/* harmony import */ var _validateUrlPort__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./validateUrlPort */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPort.js");\n/* harmony import */ var _validateUrlQuery__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./validateUrlQuery */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlQuery.js");\n/* harmony import */ var _validateUrlScheme__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./validateUrlScheme */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlScheme.js");\n/* harmony import */ var _validateUrlSubDelims__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./validateUrlSubDelims */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlSubDelims.js");\n/* harmony import */ var _validateUrlSubDomainSegment__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./validateUrlSubDomainSegment */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlSubDomainSegment.js");\n/* harmony import */ var _validateUrlUnencoded__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./validateUrlUnencoded */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnencoded.js");\n/* harmony import */ var _validateUrlUnicodeAuthority__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./validateUrlUnicodeAuthority */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeAuthority.js");\n/* harmony import */ var _validateUrlUnicodeDomain__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./validateUrlUnicodeDomain */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomain.js");\n/* harmony import */ var _validateUrlUnicodeDomainSegment__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./validateUrlUnicodeDomainSegment */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomainSegment.js");\n/* harmony import */ var _validateUrlUnicodeDomainTld__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./validateUrlUnicodeDomainTld */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomainTld.js");\n/* harmony import */ var _validateUrlUnicodeHost__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./validateUrlUnicodeHost */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeHost.js");\n/* harmony import */ var _validateUrlUnicodeSubDomainSegment__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./validateUrlUnicodeSubDomainSegment */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeSubDomainSegment.js");\n/* harmony import */ var _validateUrlUnreserved__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./validateUrlUnreserved */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnreserved.js");\n/* harmony import */ var _validateUrlUserinfo__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./validateUrlUserinfo */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUserinfo.js");\n/* harmony import */ var _validCashtag__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ./validCashtag */ "./node_modules/twitter-text/dist/esm/regexp/validCashtag.js");\n/* harmony import */ var _validCCTLD__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ./validCCTLD */ "./node_modules/twitter-text/dist/esm/regexp/validCCTLD.js");\n/* harmony import */ var _validDomain__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ./validDomain */ "./node_modules/twitter-text/dist/esm/regexp/validDomain.js");\n/* harmony import */ var _validDomainChars__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ./validDomainChars */ "./node_modules/twitter-text/dist/esm/regexp/validDomainChars.js");\n/* harmony import */ var _validDomainName__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ./validDomainName */ "./node_modules/twitter-text/dist/esm/regexp/validDomainName.js");\n/* harmony import */ var _validGeneralUrlPathChars__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ./validGeneralUrlPathChars */ "./node_modules/twitter-text/dist/esm/regexp/validGeneralUrlPathChars.js");\n/* harmony import */ var _validGTLD__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ./validGTLD */ "./node_modules/twitter-text/dist/esm/regexp/validGTLD.js");\n/* harmony import */ var _validHashtag__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ./validHashtag */ "./node_modules/twitter-text/dist/esm/regexp/validHashtag.js");\n/* harmony import */ var _validMentionOrList__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ./validMentionOrList */ "./node_modules/twitter-text/dist/esm/regexp/validMentionOrList.js");\n/* harmony import */ var _validMentionPrecedingChars__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! ./validMentionPrecedingChars */ "./node_modules/twitter-text/dist/esm/regexp/validMentionPrecedingChars.js");\n/* harmony import */ var _validPortNumber__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! ./validPortNumber */ "./node_modules/twitter-text/dist/esm/regexp/validPortNumber.js");\n/* harmony import */ var _validPunycode__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(/*! ./validPunycode */ "./node_modules/twitter-text/dist/esm/regexp/validPunycode.js");\n/* harmony import */ var _validReply__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(/*! ./validReply */ "./node_modules/twitter-text/dist/esm/regexp/validReply.js");\n/* harmony import */ var _validSubdomain__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(/*! ./validSubdomain */ "./node_modules/twitter-text/dist/esm/regexp/validSubdomain.js");\n/* harmony import */ var _validTcoUrl__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! ./validTcoUrl */ "./node_modules/twitter-text/dist/esm/regexp/validTcoUrl.js");\n/* harmony import */ var _validUrlBalancedParens__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(/*! ./validUrlBalancedParens */ "./node_modules/twitter-text/dist/esm/regexp/validUrlBalancedParens.js");\n/* harmony import */ var _validUrlPath__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(/*! ./validUrlPath */ "./node_modules/twitter-text/dist/esm/regexp/validUrlPath.js");\n/* harmony import */ var _validUrlPathEndingChars__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(/*! ./validUrlPathEndingChars */ "./node_modules/twitter-text/dist/esm/regexp/validUrlPathEndingChars.js");\n/* harmony import */ var _validUrlPrecedingChars__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(/*! ./validUrlPrecedingChars */ "./node_modules/twitter-text/dist/esm/regexp/validUrlPrecedingChars.js");\n/* harmony import */ var _validUrlQueryChars__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(/*! ./validUrlQueryChars */ "./node_modules/twitter-text/dist/esm/regexp/validUrlQueryChars.js");\n/* harmony import */ var _validUrlQueryEndingChars__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(/*! ./validUrlQueryEndingChars */ "./node_modules/twitter-text/dist/esm/regexp/validUrlQueryEndingChars.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n astralLetterAndMarks: _astralLetterAndMarks__WEBPACK_IMPORTED_MODULE_0__["default"],\n astralNumerals: _astralNumerals__WEBPACK_IMPORTED_MODULE_1__["default"],\n atSigns: _atSigns__WEBPACK_IMPORTED_MODULE_2__["default"],\n bmpLetterAndMarks: _bmpLetterAndMarks__WEBPACK_IMPORTED_MODULE_3__["default"],\n bmpNumerals: _bmpNumerals__WEBPACK_IMPORTED_MODULE_4__["default"],\n cashtag: _cashtag__WEBPACK_IMPORTED_MODULE_5__["default"],\n codePoint: _codePoint__WEBPACK_IMPORTED_MODULE_6__["default"],\n cyrillicLettersAndMarks: _cyrillicLettersAndMarks__WEBPACK_IMPORTED_MODULE_7__["default"],\n endHashtagMatch: _endHashtagMatch__WEBPACK_IMPORTED_MODULE_8__["default"],\n endMentionMatch: _endMentionMatch__WEBPACK_IMPORTED_MODULE_9__["default"],\n extractUrl: _extractUrl__WEBPACK_IMPORTED_MODULE_10__["default"],\n hashSigns: _hashSigns__WEBPACK_IMPORTED_MODULE_11__["default"],\n hashtagAlpha: _hashtagAlpha__WEBPACK_IMPORTED_MODULE_12__["default"],\n hashtagAlphaNumeric: _hashtagAlphaNumeric__WEBPACK_IMPORTED_MODULE_13__["default"],\n hashtagBoundary: _hashtagBoundary__WEBPACK_IMPORTED_MODULE_14__["default"],\n hashtagSpecialChars: _hashtagSpecialChars__WEBPACK_IMPORTED_MODULE_15__["default"],\n invalidChars: _invalidChars__WEBPACK_IMPORTED_MODULE_16__["default"],\n invalidCharsGroup: _invalidCharsGroup__WEBPACK_IMPORTED_MODULE_17__["default"],\n invalidDomainChars: _invalidDomainChars__WEBPACK_IMPORTED_MODULE_18__["default"],\n invalidUrlWithoutProtocolPrecedingChars: _invalidUrlWithoutProtocolPrecedingChars__WEBPACK_IMPORTED_MODULE_19__["default"],\n latinAccentChars: _latinAccentChars__WEBPACK_IMPORTED_MODULE_20__["default"],\n nonBmpCodePairs: _nonBmpCodePairs__WEBPACK_IMPORTED_MODULE_21__["default"],\n punct: _punct__WEBPACK_IMPORTED_MODULE_22__["default"],\n rtlChars: _rtlChars__WEBPACK_IMPORTED_MODULE_23__["default"],\n spaces: _spaces__WEBPACK_IMPORTED_MODULE_24__["default"],\n spacesGroup: _spacesGroup__WEBPACK_IMPORTED_MODULE_25__["default"],\n urlHasHttps: _urlHasHttps__WEBPACK_IMPORTED_MODULE_26__["default"],\n urlHasProtocol: _urlHasProtocol__WEBPACK_IMPORTED_MODULE_27__["default"],\n validAsciiDomain: _validAsciiDomain__WEBPACK_IMPORTED_MODULE_28__["default"],\n validateUrlAuthority: _validateUrlAuthority__WEBPACK_IMPORTED_MODULE_29__["default"],\n validateUrlDecOctet: _validateUrlDecOctet__WEBPACK_IMPORTED_MODULE_30__["default"],\n validateUrlDomain: _validateUrlDomain__WEBPACK_IMPORTED_MODULE_31__["default"],\n validateUrlDomainSegment: _validateUrlDomainSegment__WEBPACK_IMPORTED_MODULE_32__["default"],\n validateUrlDomainTld: _validateUrlDomainTld__WEBPACK_IMPORTED_MODULE_33__["default"],\n validateUrlFragment: _validateUrlFragment__WEBPACK_IMPORTED_MODULE_34__["default"],\n validateUrlHost: _validateUrlHost__WEBPACK_IMPORTED_MODULE_35__["default"],\n validateUrlIp: _validateUrlIp__WEBPACK_IMPORTED_MODULE_36__["default"],\n validateUrlIpv4: _validateUrlIpv4__WEBPACK_IMPORTED_MODULE_37__["default"],\n validateUrlIpv6: _validateUrlIpv6__WEBPACK_IMPORTED_MODULE_38__["default"],\n validateUrlPath: _validateUrlPath__WEBPACK_IMPORTED_MODULE_39__["default"],\n validateUrlPchar: _validateUrlPchar__WEBPACK_IMPORTED_MODULE_40__["default"],\n validateUrlPctEncoded: _validateUrlPctEncoded__WEBPACK_IMPORTED_MODULE_41__["default"],\n validateUrlPort: _validateUrlPort__WEBPACK_IMPORTED_MODULE_42__["default"],\n validateUrlQuery: _validateUrlQuery__WEBPACK_IMPORTED_MODULE_43__["default"],\n validateUrlScheme: _validateUrlScheme__WEBPACK_IMPORTED_MODULE_44__["default"],\n validateUrlSubDelims: _validateUrlSubDelims__WEBPACK_IMPORTED_MODULE_45__["default"],\n validateUrlSubDomainSegment: _validateUrlSubDomainSegment__WEBPACK_IMPORTED_MODULE_46__["default"],\n validateUrlUnencoded: _validateUrlUnencoded__WEBPACK_IMPORTED_MODULE_47__["default"],\n validateUrlUnicodeAuthority: _validateUrlUnicodeAuthority__WEBPACK_IMPORTED_MODULE_48__["default"],\n validateUrlUnicodeDomain: _validateUrlUnicodeDomain__WEBPACK_IMPORTED_MODULE_49__["default"],\n validateUrlUnicodeDomainSegment: _validateUrlUnicodeDomainSegment__WEBPACK_IMPORTED_MODULE_50__["default"],\n validateUrlUnicodeDomainTld: _validateUrlUnicodeDomainTld__WEBPACK_IMPORTED_MODULE_51__["default"],\n validateUrlUnicodeHost: _validateUrlUnicodeHost__WEBPACK_IMPORTED_MODULE_52__["default"],\n validateUrlUnicodeSubDomainSegment: _validateUrlUnicodeSubDomainSegment__WEBPACK_IMPORTED_MODULE_53__["default"],\n validateUrlUnreserved: _validateUrlUnreserved__WEBPACK_IMPORTED_MODULE_54__["default"],\n validateUrlUserinfo: _validateUrlUserinfo__WEBPACK_IMPORTED_MODULE_55__["default"],\n validCashtag: _validCashtag__WEBPACK_IMPORTED_MODULE_56__["default"],\n validCCTLD: _validCCTLD__WEBPACK_IMPORTED_MODULE_57__["default"],\n validDomain: _validDomain__WEBPACK_IMPORTED_MODULE_58__["default"],\n validDomainChars: _validDomainChars__WEBPACK_IMPORTED_MODULE_59__["default"],\n validDomainName: _validDomainName__WEBPACK_IMPORTED_MODULE_60__["default"],\n validGeneralUrlPathChars: _validGeneralUrlPathChars__WEBPACK_IMPORTED_MODULE_61__["default"],\n validGTLD: _validGTLD__WEBPACK_IMPORTED_MODULE_62__["default"],\n validHashtag: _validHashtag__WEBPACK_IMPORTED_MODULE_63__["default"],\n validMentionOrList: _validMentionOrList__WEBPACK_IMPORTED_MODULE_64__["default"],\n validMentionPrecedingChars: _validMentionPrecedingChars__WEBPACK_IMPORTED_MODULE_65__["default"],\n validPortNumber: _validPortNumber__WEBPACK_IMPORTED_MODULE_66__["default"],\n validPunycode: _validPunycode__WEBPACK_IMPORTED_MODULE_67__["default"],\n validReply: _validReply__WEBPACK_IMPORTED_MODULE_68__["default"],\n validSubdomain: _validSubdomain__WEBPACK_IMPORTED_MODULE_69__["default"],\n validTcoUrl: _validTcoUrl__WEBPACK_IMPORTED_MODULE_70__["default"],\n validUrlBalancedParens: _validUrlBalancedParens__WEBPACK_IMPORTED_MODULE_71__["default"],\n validUrlPath: _validUrlPath__WEBPACK_IMPORTED_MODULE_72__["default"],\n validUrlPathEndingChars: _validUrlPathEndingChars__WEBPACK_IMPORTED_MODULE_73__["default"],\n validUrlPrecedingChars: _validUrlPrecedingChars__WEBPACK_IMPORTED_MODULE_74__["default"],\n validUrlQueryChars: _validUrlQueryChars__WEBPACK_IMPORTED_MODULE_75__["default"],\n validUrlQueryEndingChars: _validUrlQueryEndingChars__WEBPACK_IMPORTED_MODULE_76__["default"]\n});\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/index.js?')},"./node_modules/twitter-text/dist/esm/regexp/invalidChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _invalidCharsGroup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./invalidCharsGroup */ "./node_modules/twitter-text/dist/esm/regexp/invalidCharsGroup.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\nvar invalidChars = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__["default"])(/[#{invalidCharsGroup}]/, {\n invalidCharsGroup: _invalidCharsGroup__WEBPACK_IMPORTED_MODULE_0__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (invalidChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/invalidChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/invalidCharsGroup.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar invalidCharsGroup = /\\uFFFE\\uFEFF\\uFFFF/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (invalidCharsGroup);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/invalidCharsGroup.js?')},"./node_modules/twitter-text/dist/esm/regexp/invalidDomainChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _directionalMarkersGroup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./directionalMarkersGroup */ "./node_modules/twitter-text/dist/esm/regexp/directionalMarkersGroup.js");\n/* harmony import */ var _invalidCharsGroup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./invalidCharsGroup */ "./node_modules/twitter-text/dist/esm/regexp/invalidCharsGroup.js");\n/* harmony import */ var _punct__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./punct */ "./node_modules/twitter-text/dist/esm/regexp/punct.js");\n/* harmony import */ var _spacesGroup__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./spacesGroup */ "./node_modules/twitter-text/dist/esm/regexp/spacesGroup.js");\n/* harmony import */ var _lib_stringSupplant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib/stringSupplant */ "./node_modules/twitter-text/dist/esm/lib/stringSupplant.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\nvar invalidDomainChars = (0,_lib_stringSupplant__WEBPACK_IMPORTED_MODULE_4__["default"])(\'#{punct}#{spacesGroup}#{invalidCharsGroup}#{directionalMarkersGroup}\', {\n punct: _punct__WEBPACK_IMPORTED_MODULE_2__["default"],\n spacesGroup: _spacesGroup__WEBPACK_IMPORTED_MODULE_3__["default"],\n invalidCharsGroup: _invalidCharsGroup__WEBPACK_IMPORTED_MODULE_1__["default"],\n directionalMarkersGroup: _directionalMarkersGroup__WEBPACK_IMPORTED_MODULE_0__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (invalidDomainChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/invalidDomainChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/invalidUrlWithoutProtocolPrecedingChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar invalidUrlWithoutProtocolPrecedingChars = /[-_.\\/]$/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (invalidUrlWithoutProtocolPrecedingChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/invalidUrlWithoutProtocolPrecedingChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/latinAccentChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar latinAccentChars = /\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\xFF\\u0100-\\u024F\\u0253\\u0254\\u0256\\u0257\\u0259\\u025B\\u0263\\u0268\\u026F\\u0272\\u0289\\u028B\\u02BB\\u0300-\\u036F\\u1E00-\\u1EFF/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (latinAccentChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/latinAccentChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/nonBmpCodePairs.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar nonBmpCodePairs = /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/gm;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (nonBmpCodePairs);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/nonBmpCodePairs.js?')},"./node_modules/twitter-text/dist/esm/regexp/punct.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar punct = /\\!'#%&'\\(\\)*\\+,\\\\\\-\\.\\/:;<=>\\?@\\[\\]\\^_{|}~\\$/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (punct);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/punct.js?")},"./node_modules/twitter-text/dist/esm/regexp/rtlChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar rtlChars = /[\\u0600-\\u06FF]|[\\u0750-\\u077F]|[\\u0590-\\u05FF]|[\\uFE70-\\uFEFF]/gm;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (rtlChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/rtlChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/spaces.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _spacesGroup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./spacesGroup */ "./node_modules/twitter-text/dist/esm/regexp/spacesGroup.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(/[#{spacesGroup}]/, {\n spacesGroup: _spacesGroup__WEBPACK_IMPORTED_MODULE_1__["default"]\n}));\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/spaces.js?')},"./node_modules/twitter-text/dist/esm/regexp/spacesGroup.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar spacesGroup = /\\x09-\\x0D\\x20\\x85\\xA0\\u1680\\u180E\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (spacesGroup);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/spacesGroup.js?')},"./node_modules/twitter-text/dist/esm/regexp/urlHasHttps.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar urlHasHttps = /^https:\\/\\//i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (urlHasHttps);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/urlHasHttps.js?')},"./node_modules/twitter-text/dist/esm/regexp/urlHasProtocol.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar urlHasProtocol = /^https?:\\/\\//i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (urlHasProtocol);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/urlHasProtocol.js?')},"./node_modules/twitter-text/dist/esm/regexp/validAsciiDomain.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _latinAccentChars__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./latinAccentChars */ "./node_modules/twitter-text/dist/esm/regexp/latinAccentChars.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validCCTLD__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validCCTLD */ "./node_modules/twitter-text/dist/esm/regexp/validCCTLD.js");\n/* harmony import */ var _validGTLD__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validGTLD */ "./node_modules/twitter-text/dist/esm/regexp/validGTLD.js");\n/* harmony import */ var _validPunycode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./validPunycode */ "./node_modules/twitter-text/dist/esm/regexp/validPunycode.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\nvar validAsciiDomain = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__["default"])(/(?:(?:[\\-a-z0-9#{latinAccentChars}]+)\\.)+(?:#{validGTLD}|#{validCCTLD}|#{validPunycode})/gi, {\n latinAccentChars: _latinAccentChars__WEBPACK_IMPORTED_MODULE_0__["default"],\n validGTLD: _validGTLD__WEBPACK_IMPORTED_MODULE_3__["default"],\n validCCTLD: _validCCTLD__WEBPACK_IMPORTED_MODULE_2__["default"],\n validPunycode: _validPunycode__WEBPACK_IMPORTED_MODULE_4__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validAsciiDomain);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validAsciiDomain.js?')},"./node_modules/twitter-text/dist/esm/regexp/validCCTLD.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.constructor */ \"./node_modules/core-js/modules/es6.regexp.constructor.js\");\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/regexSupplant */ \"./node_modules/twitter-text/dist/esm/lib/regexSupplant.js\");\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\nvar validCCTLD = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(RegExp('(?:(?:' + '한국|香港|澳門|新加坡|台灣|台湾|中國|中国|გე|ລາວ|ไทย|ලංකා|ഭാരതം|ಭಾರತ|భారత్|சிங்கப்பூர்|இலங்கை|இந்தியா|ଭାରତ|' + 'ભારત|ਭਾਰਤ|ভাৰত|ভারত|বাংলা|भारोत|भारतम्|भारत|ڀارت|پاکستان|موريتانيا|مليسيا|مصر|قطر|فلسطين|عمان|' + 'عراق|سورية|سودان|تونس|بھارت|بارت|ایران|امارات|المغرب|السعودية|الجزائر|البحرين|الاردن|հայ|қаз|' + 'укр|срб|рф|мон|мкд|ею|бел|бг|ευ|ελ|zw|zm|za|yt|ye|ws|wf|vu|vn|vi|vg|ve|vc|va|uz|uy|us|um|uk|' + 'ug|ua|tz|tw|tv|tt|tr|tp|to|tn|tm|tl|tk|tj|th|tg|tf|td|tc|sz|sy|sx|sv|su|st|ss|sr|so|sn|sm|sl|' + 'sk|sj|si|sh|sg|se|sd|sc|sb|sa|rw|ru|rs|ro|re|qa|py|pw|pt|ps|pr|pn|pm|pl|pk|ph|pg|pf|pe|pa|om|' + 'nz|nu|nr|np|no|nl|ni|ng|nf|ne|nc|na|mz|my|mx|mw|mv|mu|mt|ms|mr|mq|mp|mo|mn|mm|ml|mk|mh|mg|mf|' + 'me|md|mc|ma|ly|lv|lu|lt|ls|lr|lk|li|lc|lb|la|kz|ky|kw|kr|kp|kn|km|ki|kh|kg|ke|jp|jo|jm|je|it|' + 'is|ir|iq|io|in|im|il|ie|id|hu|ht|hr|hn|hm|hk|gy|gw|gu|gt|gs|gr|gq|gp|gn|gm|gl|gi|gh|gg|gf|ge|' + 'gd|gb|ga|fr|fo|fm|fk|fj|fi|eu|et|es|er|eh|eg|ee|ec|dz|do|dm|dk|dj|de|cz|cy|cx|cw|cv|cu|cr|co|' + 'cn|cm|cl|ck|ci|ch|cg|cf|cd|cc|ca|bz|by|bw|bv|bt|bs|br|bq|bo|bn|bm|bl|bj|bi|bh|bg|bf|be|bd|bb|' + 'ba|az|ax|aw|au|at|as|ar|aq|ao|an|am|al|ai|ag|af|ae|ad|ac' + ')(?=[^0-9a-zA-Z@+-]|$))'));\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validCCTLD);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validCCTLD.js?")},"./node_modules/twitter-text/dist/esm/regexp/validCashtag.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _cashtag__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cashtag */ "./node_modules/twitter-text/dist/esm/regexp/cashtag.js");\n/* harmony import */ var _punct__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./punct */ "./node_modules/twitter-text/dist/esm/regexp/punct.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _spaces__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./spaces */ "./node_modules/twitter-text/dist/esm/regexp/spaces.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\nvar validCashtag = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__["default"])(\'(^|#{spaces})(\\\\$)(#{cashtag})(?=$|\\\\s|[#{punct}])\', {\n cashtag: _cashtag__WEBPACK_IMPORTED_MODULE_0__["default"],\n spaces: _spaces__WEBPACK_IMPORTED_MODULE_3__["default"],\n punct: _punct__WEBPACK_IMPORTED_MODULE_1__["default"]\n}, \'gi\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validCashtag);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validCashtag.js?')},"./node_modules/twitter-text/dist/esm/regexp/validDomain.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validCCTLD__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validCCTLD */ "./node_modules/twitter-text/dist/esm/regexp/validCCTLD.js");\n/* harmony import */ var _validDomainName__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validDomainName */ "./node_modules/twitter-text/dist/esm/regexp/validDomainName.js");\n/* harmony import */ var _validGTLD__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validGTLD */ "./node_modules/twitter-text/dist/esm/regexp/validGTLD.js");\n/* harmony import */ var _validPunycode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./validPunycode */ "./node_modules/twitter-text/dist/esm/regexp/validPunycode.js");\n/* harmony import */ var _validSubdomain__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./validSubdomain */ "./node_modules/twitter-text/dist/esm/regexp/validSubdomain.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\n\nvar validDomain = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(/(?:#{validSubdomain}*#{validDomainName}(?:#{validGTLD}|#{validCCTLD}|#{validPunycode}))/, {\n validDomainName: _validDomainName__WEBPACK_IMPORTED_MODULE_2__["default"],\n validSubdomain: _validSubdomain__WEBPACK_IMPORTED_MODULE_5__["default"],\n validGTLD: _validGTLD__WEBPACK_IMPORTED_MODULE_3__["default"],\n validCCTLD: _validCCTLD__WEBPACK_IMPORTED_MODULE_1__["default"],\n validPunycode: _validPunycode__WEBPACK_IMPORTED_MODULE_4__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validDomain);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validDomain.js?')},"./node_modules/twitter-text/dist/esm/regexp/validDomainChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _invalidDomainChars__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./invalidDomainChars */ "./node_modules/twitter-text/dist/esm/regexp/invalidDomainChars.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\nvar validDomainChars = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__["default"])(/[^#{invalidDomainChars}]/, {\n invalidDomainChars: _invalidDomainChars__WEBPACK_IMPORTED_MODULE_0__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validDomainChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validDomainChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/validDomainName.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validDomainChars__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validDomainChars */ "./node_modules/twitter-text/dist/esm/regexp/validDomainChars.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\nvar validDomainName = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(/(?:(?:#{validDomainChars}(?:-|#{validDomainChars})*)?#{validDomainChars}\\.)/, {\n validDomainChars: _validDomainChars__WEBPACK_IMPORTED_MODULE_1__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validDomainName);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validDomainName.js?')},"./node_modules/twitter-text/dist/esm/regexp/validGTLD.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.constructor */ \"./node_modules/core-js/modules/es6.regexp.constructor.js\");\n/* harmony import */ var core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_constructor__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/regexSupplant */ \"./node_modules/twitter-text/dist/esm/lib/regexSupplant.js\");\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\nvar validGTLD = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(RegExp('(?:(?:' + '삼성|닷컴|닷넷|香格里拉|餐厅|食品|飞利浦|電訊盈科|集团|通販|购物|谷歌|诺基亚|联通|网络|网站|网店|网址|组织机构|移动|珠宝|点看|游戏|淡马锡|机构|書籍|时尚|新闻|' + '政府|政务|招聘|手表|手机|我爱你|慈善|微博|广东|工行|家電|娱乐|天主教|大拿|大众汽车|在线|嘉里大酒店|嘉里|商标|商店|商城|公益|公司|八卦|健康|信息|佛山|企业|' + '中文网|中信|世界|ポイント|ファッション|セール|ストア|コム|グーグル|クラウド|みんな|คอม|संगठन|नेट|कॉम|همراه|موقع|موبايلي|كوم|' + 'كاثوليك|عرب|شبكة|بيتك|بازار|العليان|ارامكو|اتصالات|ابوظبي|קום|сайт|рус|орг|онлайн|москва|ком|' + 'католик|дети|zuerich|zone|zippo|zip|zero|zara|zappos|yun|youtube|you|yokohama|yoga|yodobashi|' + 'yandex|yamaxun|yahoo|yachts|xyz|xxx|xperia|xin|xihuan|xfinity|xerox|xbox|wtf|wtc|wow|world|' + 'works|work|woodside|wolterskluwer|wme|winners|wine|windows|win|williamhill|wiki|wien|whoswho|' + 'weir|weibo|wedding|wed|website|weber|webcam|weatherchannel|weather|watches|watch|warman|' + 'wanggou|wang|walter|walmart|wales|vuelos|voyage|voto|voting|vote|volvo|volkswagen|vodka|' + 'vlaanderen|vivo|viva|vistaprint|vista|vision|visa|virgin|vip|vin|villas|viking|vig|video|' + 'viajes|vet|versicherung|vermögensberatung|vermögensberater|verisign|ventures|vegas|vanguard|' + 'vana|vacations|ups|uol|uno|university|unicom|uconnect|ubs|ubank|tvs|tushu|tunes|tui|tube|trv|' + 'trust|travelersinsurance|travelers|travelchannel|travel|training|trading|trade|toys|toyota|' + 'town|tours|total|toshiba|toray|top|tools|tokyo|today|tmall|tkmaxx|tjx|tjmaxx|tirol|tires|tips|' + 'tiffany|tienda|tickets|tiaa|theatre|theater|thd|teva|tennis|temasek|telefonica|telecity|tel|' + 'technology|tech|team|tdk|tci|taxi|tax|tattoo|tatar|tatamotors|target|taobao|talk|taipei|tab|' + 'systems|symantec|sydney|swiss|swiftcover|swatch|suzuki|surgery|surf|support|supply|supplies|' + 'sucks|style|study|studio|stream|store|storage|stockholm|stcgroup|stc|statoil|statefarm|' + 'statebank|starhub|star|staples|stada|srt|srl|spreadbetting|spot|sport|spiegel|space|soy|sony|' + 'song|solutions|solar|sohu|software|softbank|social|soccer|sncf|smile|smart|sling|skype|sky|' + 'skin|ski|site|singles|sina|silk|shriram|showtime|show|shouji|shopping|shop|shoes|shiksha|shia|' + 'shell|shaw|sharp|shangrila|sfr|sexy|sex|sew|seven|ses|services|sener|select|seek|security|' + 'secure|seat|search|scot|scor|scjohnson|science|schwarz|schule|school|scholarships|schmidt|' + 'schaeffler|scb|sca|sbs|sbi|saxo|save|sas|sarl|sapo|sap|sanofi|sandvikcoromant|sandvik|samsung|' + 'samsclub|salon|sale|sakura|safety|safe|saarland|ryukyu|rwe|run|ruhr|rugby|rsvp|room|rogers|' + 'rodeo|rocks|rocher|rmit|rip|rio|ril|rightathome|ricoh|richardli|rich|rexroth|reviews|review|' + 'restaurant|rest|republican|report|repair|rentals|rent|ren|reliance|reit|reisen|reise|rehab|' + 'redumbrella|redstone|red|recipes|realty|realtor|realestate|read|raid|radio|racing|qvc|quest|' + 'quebec|qpon|pwc|pub|prudential|pru|protection|property|properties|promo|progressive|prof|' + 'productions|prod|pro|prime|press|praxi|pramerica|post|porn|politie|poker|pohl|pnc|plus|' + 'plumbing|playstation|play|place|pizza|pioneer|pink|ping|pin|pid|pictures|pictet|pics|piaget|' + 'physio|photos|photography|photo|phone|philips|phd|pharmacy|pfizer|pet|pccw|pay|passagens|' + 'party|parts|partners|pars|paris|panerai|panasonic|pamperedchef|page|ovh|ott|otsuka|osaka|' + 'origins|orientexpress|organic|org|orange|oracle|open|ooo|onyourside|online|onl|ong|one|omega|' + 'ollo|oldnavy|olayangroup|olayan|okinawa|office|off|observer|obi|nyc|ntt|nrw|nra|nowtv|nowruz|' + 'now|norton|northwesternmutual|nokia|nissay|nissan|ninja|nikon|nike|nico|nhk|ngo|nfl|nexus|' + 'nextdirect|next|news|newholland|new|neustar|network|netflix|netbank|net|nec|nba|navy|natura|' + 'nationwide|name|nagoya|nadex|nab|mutuelle|mutual|museum|mtr|mtpc|mtn|msd|movistar|movie|mov|' + 'motorcycles|moto|moscow|mortgage|mormon|mopar|montblanc|monster|money|monash|mom|moi|moe|moda|' + 'mobily|mobile|mobi|mma|mls|mlb|mitsubishi|mit|mint|mini|mil|microsoft|miami|metlife|merckmsd|' + 'meo|menu|men|memorial|meme|melbourne|meet|media|med|mckinsey|mcdonalds|mcd|mba|mattel|' + 'maserati|marshalls|marriott|markets|marketing|market|map|mango|management|man|makeup|maison|' + 'maif|madrid|macys|luxury|luxe|lupin|lundbeck|ltda|ltd|lplfinancial|lpl|love|lotto|lotte|' + 'london|lol|loft|locus|locker|loans|loan|llp|llc|lixil|living|live|lipsy|link|linde|lincoln|' + 'limo|limited|lilly|like|lighting|lifestyle|lifeinsurance|life|lidl|liaison|lgbt|lexus|lego|' + 'legal|lefrak|leclerc|lease|lds|lawyer|law|latrobe|latino|lat|lasalle|lanxess|landrover|land|' + 'lancome|lancia|lancaster|lamer|lamborghini|ladbrokes|lacaixa|kyoto|kuokgroup|kred|krd|kpn|' + 'kpmg|kosher|komatsu|koeln|kiwi|kitchen|kindle|kinder|kim|kia|kfh|kerryproperties|' + 'kerrylogistics|kerryhotels|kddi|kaufen|juniper|juegos|jprs|jpmorgan|joy|jot|joburg|jobs|jnj|' + 'jmp|jll|jlc|jio|jewelry|jetzt|jeep|jcp|jcb|java|jaguar|iwc|iveco|itv|itau|istanbul|ist|' + 'ismaili|iselect|irish|ipiranga|investments|intuit|international|intel|int|insure|insurance|' + 'institute|ink|ing|info|infiniti|industries|inc|immobilien|immo|imdb|imamat|ikano|iinet|ifm|' + 'ieee|icu|ice|icbc|ibm|hyundai|hyatt|hughes|htc|hsbc|how|house|hotmail|hotels|hoteles|hot|' + 'hosting|host|hospital|horse|honeywell|honda|homesense|homes|homegoods|homedepot|holiday|' + 'holdings|hockey|hkt|hiv|hitachi|hisamitsu|hiphop|hgtv|hermes|here|helsinki|help|healthcare|' + 'health|hdfcbank|hdfc|hbo|haus|hangout|hamburg|hair|guru|guitars|guide|guge|gucci|guardian|' + 'group|grocery|gripe|green|gratis|graphics|grainger|gov|got|gop|google|goog|goodyear|goodhands|' + 'goo|golf|goldpoint|gold|godaddy|gmx|gmo|gmbh|gmail|globo|global|gle|glass|glade|giving|gives|' + 'gifts|gift|ggee|george|genting|gent|gea|gdn|gbiz|gay|garden|gap|games|game|gallup|gallo|' + 'gallery|gal|fyi|futbol|furniture|fund|fun|fujixerox|fujitsu|ftr|frontier|frontdoor|frogans|' + 'frl|fresenius|free|fox|foundation|forum|forsale|forex|ford|football|foodnetwork|food|foo|fly|' + 'flsmidth|flowers|florist|flir|flights|flickr|fitness|fit|fishing|fish|firmdale|firestone|fire|' + 'financial|finance|final|film|fido|fidelity|fiat|ferrero|ferrari|feedback|fedex|fast|fashion|' + 'farmers|farm|fans|fan|family|faith|fairwinds|fail|fage|extraspace|express|exposed|expert|' + 'exchange|everbank|events|eus|eurovision|etisalat|esurance|estate|esq|erni|ericsson|equipment|' + 'epson|epost|enterprises|engineering|engineer|energy|emerck|email|education|edu|edeka|eco|eat|' + 'earth|dvr|dvag|durban|dupont|duns|dunlop|duck|dubai|dtv|drive|download|dot|doosan|domains|' + 'doha|dog|dodge|doctor|docs|dnp|diy|dish|discover|discount|directory|direct|digital|diet|' + 'diamonds|dhl|dev|design|desi|dentist|dental|democrat|delta|deloitte|dell|delivery|degree|' + 'deals|dealer|deal|dds|dclk|day|datsun|dating|date|data|dance|dad|dabur|cyou|cymru|cuisinella|' + 'csc|cruises|cruise|crs|crown|cricket|creditunion|creditcard|credit|cpa|courses|coupons|coupon|' + 'country|corsica|coop|cool|cookingchannel|cooking|contractors|contact|consulting|construction|' + 'condos|comsec|computer|compare|company|community|commbank|comcast|com|cologne|college|coffee|' + 'codes|coach|clubmed|club|cloud|clothing|clinique|clinic|click|cleaning|claims|cityeats|city|' + 'citic|citi|citadel|cisco|circle|cipriani|church|chrysler|chrome|christmas|chloe|chintai|cheap|' + 'chat|chase|charity|channel|chanel|cfd|cfa|cern|ceo|center|ceb|cbs|cbre|cbn|cba|catholic|' + 'catering|cat|casino|cash|caseih|case|casa|cartier|cars|careers|career|care|cards|caravan|car|' + 'capitalone|capital|capetown|canon|cancerresearch|camp|camera|cam|calvinklein|call|cal|cafe|' + 'cab|bzh|buzz|buy|business|builders|build|bugatti|budapest|brussels|brother|broker|broadway|' + 'bridgestone|bradesco|box|boutique|bot|boston|bostik|bosch|boots|booking|book|boo|bond|bom|' + 'bofa|boehringer|boats|bnpparibas|bnl|bmw|bms|blue|bloomberg|blog|blockbuster|blanco|' + 'blackfriday|black|biz|bio|bingo|bing|bike|bid|bible|bharti|bet|bestbuy|best|berlin|bentley|' + 'beer|beauty|beats|bcn|bcg|bbva|bbt|bbc|bayern|bauhaus|basketball|baseball|bargains|barefoot|' + 'barclays|barclaycard|barcelona|bar|bank|band|bananarepublic|banamex|baidu|baby|azure|axa|aws|' + 'avianca|autos|auto|author|auspost|audio|audible|audi|auction|attorney|athleta|associates|asia|' + 'asda|arte|art|arpa|army|archi|aramco|arab|aquarelle|apple|app|apartments|aol|anz|anquan|' + 'android|analytics|amsterdam|amica|amfam|amex|americanfamily|americanexpress|alstom|alsace|' + 'ally|allstate|allfinanz|alipay|alibaba|alfaromeo|akdn|airtel|airforce|airbus|aigo|aig|agency|' + 'agakhan|africa|afl|afamilycompany|aetna|aero|aeg|adult|ads|adac|actor|active|aco|accountants|' + 'accountant|accenture|academy|abudhabi|abogado|able|abc|abbvie|abbott|abb|abarth|aarp|aaa|' + 'onion' + ')(?=[^0-9a-zA-Z@+-]|$))'));\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validGTLD);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validGTLD.js?")},"./node_modules/twitter-text/dist/esm/regexp/validGeneralUrlPathChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _cyrillicLettersAndMarks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cyrillicLettersAndMarks */ "./node_modules/twitter-text/dist/esm/regexp/cyrillicLettersAndMarks.js");\n/* harmony import */ var _latinAccentChars__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./latinAccentChars */ "./node_modules/twitter-text/dist/esm/regexp/latinAccentChars.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\nvar validGeneralUrlPathChars = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__["default"])(/[a-z#{cyrillicLettersAndMarks}0-9!\\*\';:=\\+,\\.\\$\\/%#\\[\\]\\-\\u2013_~@\\|&#{latinAccentChars}]/i, {\n cyrillicLettersAndMarks: _cyrillicLettersAndMarks__WEBPACK_IMPORTED_MODULE_0__["default"],\n latinAccentChars: _latinAccentChars__WEBPACK_IMPORTED_MODULE_1__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validGeneralUrlPathChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validGeneralUrlPathChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/validHashtag.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _hashSigns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hashSigns */ "./node_modules/twitter-text/dist/esm/regexp/hashSigns.js");\n/* harmony import */ var _hashtagAlpha__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hashtagAlpha */ "./node_modules/twitter-text/dist/esm/regexp/hashtagAlpha.js");\n/* harmony import */ var _hashtagAlphaNumeric__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hashtagAlphaNumeric */ "./node_modules/twitter-text/dist/esm/regexp/hashtagAlphaNumeric.js");\n/* harmony import */ var _hashtagBoundary__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hashtagBoundary */ "./node_modules/twitter-text/dist/esm/regexp/hashtagBoundary.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\n\nvar validHashtag = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_4__["default"])(/(#{hashtagBoundary})(#{hashSigns})(?!\\uFE0F|\\u20E3)(#{hashtagAlphaNumeric}*#{hashtagAlpha}#{hashtagAlphaNumeric}*)/gi, {\n hashtagBoundary: _hashtagBoundary__WEBPACK_IMPORTED_MODULE_3__["default"],\n hashSigns: _hashSigns__WEBPACK_IMPORTED_MODULE_0__["default"],\n hashtagAlphaNumeric: _hashtagAlphaNumeric__WEBPACK_IMPORTED_MODULE_2__["default"],\n hashtagAlpha: _hashtagAlpha__WEBPACK_IMPORTED_MODULE_1__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validHashtag);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validHashtag.js?')},"./node_modules/twitter-text/dist/esm/regexp/validMentionOrList.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _atSigns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./atSigns */ "./node_modules/twitter-text/dist/esm/regexp/atSigns.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validMentionPrecedingChars__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validMentionPrecedingChars */ "./node_modules/twitter-text/dist/esm/regexp/validMentionPrecedingChars.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\nvar validMentionOrList = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__["default"])(\'(#{validMentionPrecedingChars})\' + // $1: Preceding character\n\'(#{atSigns})\' + // $2: At mark\n\'([a-zA-Z0-9_]{1,20})\' + // $3: Screen name\n\'(/[a-zA-Z][a-zA-Z0-9_-]{0,24})?\', // $4: List (optional)\n{\n validMentionPrecedingChars: _validMentionPrecedingChars__WEBPACK_IMPORTED_MODULE_2__["default"],\n atSigns: _atSigns__WEBPACK_IMPORTED_MODULE_0__["default"]\n}, \'g\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validMentionOrList);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validMentionOrList.js?')},"./node_modules/twitter-text/dist/esm/regexp/validMentionPrecedingChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validMentionPrecedingChars = /(?:^|[^a-zA-Z0-9_!#$%&*@@]|(?:^|[^a-zA-Z0-9_+~.-])(?:rt|RT|rT|Rt):?)/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validMentionPrecedingChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validMentionPrecedingChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/validPortNumber.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validPortNumber = /[0-9]+/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validPortNumber);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validPortNumber.js?')},"./node_modules/twitter-text/dist/esm/regexp/validPunycode.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validPunycode = /(?:xn--[\\-0-9a-z]+)/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validPunycode);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validPunycode.js?')},"./node_modules/twitter-text/dist/esm/regexp/validReply.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _atSigns__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./atSigns */ "./node_modules/twitter-text/dist/esm/regexp/atSigns.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _spaces__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./spaces */ "./node_modules/twitter-text/dist/esm/regexp/spaces.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\nvar validReply = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_1__["default"])(/^(?:#{spaces})*#{atSigns}([a-zA-Z0-9_]{1,20})/, {\n atSigns: _atSigns__WEBPACK_IMPORTED_MODULE_0__["default"],\n spaces: _spaces__WEBPACK_IMPORTED_MODULE_2__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validReply);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validReply.js?')},"./node_modules/twitter-text/dist/esm/regexp/validSubdomain.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validDomainChars__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validDomainChars */ "./node_modules/twitter-text/dist/esm/regexp/validDomainChars.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\nvar validSubdomain = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(/(?:(?:#{validDomainChars}(?:[_-]|#{validDomainChars})*)?#{validDomainChars}\\.)/, {\n validDomainChars: _validDomainChars__WEBPACK_IMPORTED_MODULE_1__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validSubdomain);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validSubdomain.js?')},"./node_modules/twitter-text/dist/esm/regexp/validTcoUrl.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validUrlQueryChars__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validUrlQueryChars */ "./node_modules/twitter-text/dist/esm/regexp/validUrlQueryChars.js");\n/* harmony import */ var _validUrlQueryEndingChars__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validUrlQueryEndingChars */ "./node_modules/twitter-text/dist/esm/regexp/validUrlQueryEndingChars.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\nvar validTcoUrl = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(/^https?:\\/\\/t\\.co\\/([a-z0-9]+)(?:\\?#{validUrlQueryChars}*#{validUrlQueryEndingChars})?/, {\n validUrlQueryChars: _validUrlQueryChars__WEBPACK_IMPORTED_MODULE_1__["default"],\n validUrlQueryEndingChars: _validUrlQueryEndingChars__WEBPACK_IMPORTED_MODULE_2__["default"]\n}, \'i\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validTcoUrl);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validTcoUrl.js?')},"./node_modules/twitter-text/dist/esm/regexp/validUrlBalancedParens.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ \"./node_modules/twitter-text/dist/esm/lib/regexSupplant.js\");\n/* harmony import */ var _validGeneralUrlPathChars__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validGeneralUrlPathChars */ \"./node_modules/twitter-text/dist/esm/regexp/validGeneralUrlPathChars.js\");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n // Allow URL paths to contain up to two nested levels of balanced parens\n// 1. Used in Wikipedia URLs like /Primer_(film)\n// 2. Used in IIS sessions like /S(dfd346)/\n// 3. Used in Rdio URLs like /track/We_Up_(Album_Version_(Edited))/\n\nvar validUrlBalancedParens = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__[\"default\"])('\\\\(' + '(?:' + '#{validGeneralUrlPathChars}+' + '|' + // allow one nested level of balanced parentheses\n'(?:' + '#{validGeneralUrlPathChars}*' + '\\\\(' + '#{validGeneralUrlPathChars}+' + '\\\\)' + '#{validGeneralUrlPathChars}*' + ')' + ')' + '\\\\)', {\n validGeneralUrlPathChars: _validGeneralUrlPathChars__WEBPACK_IMPORTED_MODULE_1__[\"default\"]\n}, 'i');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validUrlBalancedParens);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validUrlBalancedParens.js?")},"./node_modules/twitter-text/dist/esm/regexp/validUrlPath.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validGeneralUrlPathChars__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validGeneralUrlPathChars */ "./node_modules/twitter-text/dist/esm/regexp/validGeneralUrlPathChars.js");\n/* harmony import */ var _validUrlBalancedParens__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validUrlBalancedParens */ "./node_modules/twitter-text/dist/esm/regexp/validUrlBalancedParens.js");\n/* harmony import */ var _validUrlPathEndingChars__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validUrlPathEndingChars */ "./node_modules/twitter-text/dist/esm/regexp/validUrlPathEndingChars.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n // Allow @ in a url, but only in the middle. Catch things like http://example.com/@user/\n\nvar validUrlPath = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(\'(?:\' + \'(?:\' + \'#{validGeneralUrlPathChars}*\' + \'(?:#{validUrlBalancedParens}#{validGeneralUrlPathChars}*)*\' + \'#{validUrlPathEndingChars}\' + \')|(?:@#{validGeneralUrlPathChars}+/)\' + \')\', {\n validGeneralUrlPathChars: _validGeneralUrlPathChars__WEBPACK_IMPORTED_MODULE_1__["default"],\n validUrlBalancedParens: _validUrlBalancedParens__WEBPACK_IMPORTED_MODULE_2__["default"],\n validUrlPathEndingChars: _validUrlPathEndingChars__WEBPACK_IMPORTED_MODULE_3__["default"]\n}, \'i\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validUrlPath);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validUrlPath.js?')},"./node_modules/twitter-text/dist/esm/regexp/validUrlPathEndingChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _cyrillicLettersAndMarks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cyrillicLettersAndMarks */ "./node_modules/twitter-text/dist/esm/regexp/cyrillicLettersAndMarks.js");\n/* harmony import */ var _latinAccentChars__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./latinAccentChars */ "./node_modules/twitter-text/dist/esm/regexp/latinAccentChars.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validUrlBalancedParens__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validUrlBalancedParens */ "./node_modules/twitter-text/dist/esm/regexp/validUrlBalancedParens.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n // Valid end-of-path chracters (so /foo. does not gobble the period).\n// 1. Allow =&# for empty URL parameters and other URL-join artifacts\n\nvar validUrlPathEndingChars = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__["default"])(/[\\+\\-a-z#{cyrillicLettersAndMarks}0-9=_#\\/#{latinAccentChars}]|(?:#{validUrlBalancedParens})/i, {\n cyrillicLettersAndMarks: _cyrillicLettersAndMarks__WEBPACK_IMPORTED_MODULE_0__["default"],\n latinAccentChars: _latinAccentChars__WEBPACK_IMPORTED_MODULE_1__["default"],\n validUrlBalancedParens: _validUrlBalancedParens__WEBPACK_IMPORTED_MODULE_3__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validUrlPathEndingChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validUrlPathEndingChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/validUrlPrecedingChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _directionalMarkersGroup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./directionalMarkersGroup */ "./node_modules/twitter-text/dist/esm/regexp/directionalMarkersGroup.js");\n/* harmony import */ var _invalidCharsGroup__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./invalidCharsGroup */ "./node_modules/twitter-text/dist/esm/regexp/invalidCharsGroup.js");\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\nvar validUrlPrecedingChars = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_2__["default"])(/(?:[^A-Za-z0-9@@$###{invalidCharsGroup}]|[#{directionalMarkersGroup}]|^)/, {\n invalidCharsGroup: _invalidCharsGroup__WEBPACK_IMPORTED_MODULE_1__["default"],\n directionalMarkersGroup: _directionalMarkersGroup__WEBPACK_IMPORTED_MODULE_0__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validUrlPrecedingChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validUrlPrecedingChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/validUrlQueryChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validUrlQueryChars = /[a-z0-9!?\\*\'@\\(\\);:&=\\+\\$\\/%#\\[\\]\\-_\\.,~|]/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validUrlQueryChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validUrlQueryChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/validUrlQueryEndingChars.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validUrlQueryEndingChars = /[a-z0-9\\-_&=#\\/]/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validUrlQueryEndingChars);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validUrlQueryEndingChars.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlAuthority.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlUserinfo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlUserinfo */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUserinfo.js");\n/* harmony import */ var _validateUrlHost__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validateUrlHost */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlHost.js");\n/* harmony import */ var _validateUrlPort__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validateUrlPort */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPort.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\nvar validateUrlAuthority = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])( // $1 userinfo\n\'(?:(#{validateUrlUserinfo})@)?\' + // $2 host\n\'(#{validateUrlHost})\' + // $3 port\n\'(?::(#{validateUrlPort}))?\', {\n validateUrlUserinfo: _validateUrlUserinfo__WEBPACK_IMPORTED_MODULE_1__["default"],\n validateUrlHost: _validateUrlHost__WEBPACK_IMPORTED_MODULE_2__["default"],\n validateUrlPort: _validateUrlPort__WEBPACK_IMPORTED_MODULE_3__["default"]\n}, \'i\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlAuthority);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlAuthority.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlDecOctet.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlDecOctet = /(?:[0-9]|(?:[1-9][0-9])|(?:1[0-9]{2})|(?:2[0-4][0-9])|(?:25[0-5]))/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlDecOctet);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlDecOctet.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlDomain.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlDomainSegment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlDomainSegment */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlDomainSegment.js");\n/* harmony import */ var _validateUrlDomainTld__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validateUrlDomainTld */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlDomainTld.js");\n/* harmony import */ var _validateUrlSubDomainSegment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validateUrlSubDomainSegment */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlSubDomainSegment.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\nvar validateUrlDomain = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(/(?:(?:#{validateUrlSubDomainSegment}\\.)*(?:#{validateUrlDomainSegment}\\.)#{validateUrlDomainTld})/i, {\n validateUrlSubDomainSegment: _validateUrlSubDomainSegment__WEBPACK_IMPORTED_MODULE_3__["default"],\n validateUrlDomainSegment: _validateUrlDomainSegment__WEBPACK_IMPORTED_MODULE_1__["default"],\n validateUrlDomainTld: _validateUrlDomainTld__WEBPACK_IMPORTED_MODULE_2__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlDomain);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlDomain.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlDomainSegment.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlDomainSegment = /(?:[a-z0-9](?:[a-z0-9\\-]*[a-z0-9])?)/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlDomainSegment);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlDomainSegment.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlDomainTld.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlDomainTld = /(?:[a-z](?:[a-z0-9\\-]*[a-z0-9])?)/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlDomainTld);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlDomainTld.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlFragment.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlPchar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlPchar */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPchar.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\nvar validateUrlFragment = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(/(#{validateUrlPchar}|\\/|\\?)*/i, {\n validateUrlPchar: _validateUrlPchar__WEBPACK_IMPORTED_MODULE_1__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlFragment);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlFragment.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlHost.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlDomain__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlDomain */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlDomain.js");\n/* harmony import */ var _validateUrlIp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validateUrlIp */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlIp.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\nvar validateUrlHost = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(\'(?:\' + \'#{validateUrlIp}|\' + \'#{validateUrlDomain}\' + \')\', {\n validateUrlIp: _validateUrlIp__WEBPACK_IMPORTED_MODULE_2__["default"],\n validateUrlDomain: _validateUrlDomain__WEBPACK_IMPORTED_MODULE_1__["default"]\n}, \'i\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlHost);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlHost.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlIp.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlIpv4__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlIpv4 */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlIpv4.js");\n/* harmony import */ var _validateUrlIpv6__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validateUrlIpv6 */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlIpv6.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n // Punting on IPvFuture for now\n\nvar validateUrlIp = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(\'(?:\' + \'#{validateUrlIpv4}|\' + \'#{validateUrlIpv6}\' + \')\', {\n validateUrlIpv4: _validateUrlIpv4__WEBPACK_IMPORTED_MODULE_1__["default"],\n validateUrlIpv6: _validateUrlIpv6__WEBPACK_IMPORTED_MODULE_2__["default"]\n}, \'i\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlIp);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlIp.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlIpv4.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlDecOctet__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlDecOctet */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlDecOctet.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\nvar validateUrlIpv4 = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(/(?:#{validateUrlDecOctet}(?:\\.#{validateUrlDecOctet}){3})/i, {\n validateUrlDecOctet: _validateUrlDecOctet__WEBPACK_IMPORTED_MODULE_1__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlIpv4);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlIpv4.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlIpv6.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// Punting on real IPv6 validation for now\nvar validateUrlIpv6 = /(?:\\[[a-f0-9:\\.]+\\])/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlIpv6);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlIpv6.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlPath.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlPchar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlPchar */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPchar.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\nvar validateUrlPath = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(/(\\/#{validateUrlPchar}*)*/i, {\n validateUrlPchar: _validateUrlPchar__WEBPACK_IMPORTED_MODULE_1__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlPath);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlPath.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlPchar.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlUnreserved__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlUnreserved */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnreserved.js");\n/* harmony import */ var _validateUrlPctEncoded__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validateUrlPctEncoded */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPctEncoded.js");\n/* harmony import */ var _validateUrlSubDelims__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validateUrlSubDelims */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlSubDelims.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n // These URL validation pattern strings are based on the ABNF from RFC 3986\n\nvar validateUrlPchar = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(\'(?:\' + \'#{validateUrlUnreserved}|\' + \'#{validateUrlPctEncoded}|\' + \'#{validateUrlSubDelims}|\' + \'[:|@]\' + \')\', {\n validateUrlUnreserved: _validateUrlUnreserved__WEBPACK_IMPORTED_MODULE_1__["default"],\n validateUrlPctEncoded: _validateUrlPctEncoded__WEBPACK_IMPORTED_MODULE_2__["default"],\n validateUrlSubDelims: _validateUrlSubDelims__WEBPACK_IMPORTED_MODULE_3__["default"]\n}, \'i\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlPchar);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlPchar.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlPctEncoded.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlPctEncoded = /(?:%[0-9a-f]{2})/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlPctEncoded);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlPctEncoded.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlPort.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlPort = /[0-9]{1,5}/;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlPort);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlPort.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlQuery.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlPchar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlPchar */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPchar.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\nvar validateUrlQuery = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(/(#{validateUrlPchar}|\\/|\\?)*/i, {\n validateUrlPchar: _validateUrlPchar__WEBPACK_IMPORTED_MODULE_1__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlQuery);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlQuery.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlScheme.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlScheme = /(?:[a-z][a-z0-9+\\-.]*)/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlScheme);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlScheme.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlSubDelims.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlSubDelims = /[!$&\'()*+,;=]/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlSubDelims);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlSubDelims.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlSubDomainSegment.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlSubDomainSegment = /(?:[a-z0-9](?:[a-z0-9_\\-]*[a-z0-9])?)/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlSubDomainSegment);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlSubDomainSegment.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlUnencoded.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ \"./node_modules/twitter-text/dist/esm/lib/regexSupplant.js\");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n // Modified version of RFC 3986 Appendix B\n\nvar validateUrlUnencoded = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__[\"default\"])('^' + // Full URL\n'(?:' + '([^:/?#]+):\\\\/\\\\/' + // $1 Scheme\n')?' + '([^/?#]*)' + // $2 Authority\n'([^?#]*)' + // $3 Path\n'(?:' + '\\\\?([^#]*)' + // $4 Query\n')?' + '(?:' + '#(.*)' + // $5 Fragment\n')?$', 'i');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlUnencoded);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlUnencoded.js?")},"./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeAuthority.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlUserinfo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlUserinfo */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUserinfo.js");\n/* harmony import */ var _validateUrlUnicodeHost__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validateUrlUnicodeHost */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeHost.js");\n/* harmony import */ var _validateUrlPort__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validateUrlPort */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPort.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\nvar validateUrlUnicodeAuthority = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])( // $1 userinfo\n\'(?:(#{validateUrlUserinfo})@)?\' + // $2 host\n\'(#{validateUrlUnicodeHost})\' + // $3 port\n\'(?::(#{validateUrlPort}))?\', {\n validateUrlUserinfo: _validateUrlUserinfo__WEBPACK_IMPORTED_MODULE_1__["default"],\n validateUrlUnicodeHost: _validateUrlUnicodeHost__WEBPACK_IMPORTED_MODULE_2__["default"],\n validateUrlPort: _validateUrlPort__WEBPACK_IMPORTED_MODULE_3__["default"]\n}, \'i\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlUnicodeAuthority);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeAuthority.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomain.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlUnicodeSubDomainSegment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlUnicodeSubDomainSegment */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeSubDomainSegment.js");\n/* harmony import */ var _validateUrlUnicodeDomainSegment__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validateUrlUnicodeDomainSegment */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomainSegment.js");\n/* harmony import */ var _validateUrlUnicodeDomainTld__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validateUrlUnicodeDomainTld */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomainTld.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n // Unencoded internationalized domains - this doesn\'t check for invalid UTF-8 sequences\n\nvar validateUrlUnicodeDomain = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(/(?:(?:#{validateUrlUnicodeSubDomainSegment}\\.)*(?:#{validateUrlUnicodeDomainSegment}\\.)#{validateUrlUnicodeDomainTld})/i, {\n validateUrlUnicodeSubDomainSegment: _validateUrlUnicodeSubDomainSegment__WEBPACK_IMPORTED_MODULE_1__["default"],\n validateUrlUnicodeDomainSegment: _validateUrlUnicodeDomainSegment__WEBPACK_IMPORTED_MODULE_2__["default"],\n validateUrlUnicodeDomainTld: _validateUrlUnicodeDomainTld__WEBPACK_IMPORTED_MODULE_3__["default"]\n});\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlUnicodeDomain);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomain.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomainSegment.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlUnicodeDomainSegment = /(?:(?:[a-z0-9]|[^\\u0000-\\u007f])(?:(?:[a-z0-9\\-]|[^\\u0000-\\u007f])*(?:[a-z0-9]|[^\\u0000-\\u007f]))?)/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlUnicodeDomainSegment);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomainSegment.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomainTld.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// Unencoded internationalized domains - this doesn\'t check for invalid UTF-8 sequences\nvar validateUrlUnicodeDomainTld = /(?:(?:[a-z]|[^\\u0000-\\u007f])(?:(?:[a-z0-9\\-]|[^\\u0000-\\u007f])*(?:[a-z0-9]|[^\\u0000-\\u007f]))?)/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlUnicodeDomainTld);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomainTld.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeHost.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlIp__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlIp */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlIp.js");\n/* harmony import */ var _validateUrlUnicodeDomain__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validateUrlUnicodeDomain */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeDomain.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\nvar validateUrlUnicodeHost = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(\'(?:\' + \'#{validateUrlIp}|\' + \'#{validateUrlUnicodeDomain}\' + \')\', {\n validateUrlIp: _validateUrlIp__WEBPACK_IMPORTED_MODULE_1__["default"],\n validateUrlUnicodeDomain: _validateUrlUnicodeDomain__WEBPACK_IMPORTED_MODULE_2__["default"]\n}, \'i\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlUnicodeHost);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeHost.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeSubDomainSegment.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlUnicodeSubDomainSegment = /(?:(?:[a-z0-9]|[^\\u0000-\\u007f])(?:(?:[a-z0-9_\\-]|[^\\u0000-\\u007f])*(?:[a-z0-9]|[^\\u0000-\\u007f]))?)/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlUnicodeSubDomainSegment);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlUnicodeSubDomainSegment.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlUnreserved.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\nvar validateUrlUnreserved = /[a-z\\u0400-\\u04FF0-9\\-._~]/i;\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlUnreserved);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlUnreserved.js?')},"./node_modules/twitter-text/dist/esm/regexp/validateUrlUserinfo.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/regexSupplant */ "./node_modules/twitter-text/dist/esm/lib/regexSupplant.js");\n/* harmony import */ var _validateUrlUnreserved__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./validateUrlUnreserved */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlUnreserved.js");\n/* harmony import */ var _validateUrlPctEncoded__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./validateUrlPctEncoded */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlPctEncoded.js");\n/* harmony import */ var _validateUrlSubDelims__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./validateUrlSubDelims */ "./node_modules/twitter-text/dist/esm/regexp/validateUrlSubDelims.js");\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\n\n\n\nvar validateUrlUserinfo = (0,_lib_regexSupplant__WEBPACK_IMPORTED_MODULE_0__["default"])(\'(?:\' + \'#{validateUrlUnreserved}|\' + \'#{validateUrlPctEncoded}|\' + \'#{validateUrlSubDelims}|\' + \':\' + \')*\', {\n validateUrlUnreserved: _validateUrlUnreserved__WEBPACK_IMPORTED_MODULE_1__["default"],\n validateUrlPctEncoded: _validateUrlPctEncoded__WEBPACK_IMPORTED_MODULE_2__["default"],\n validateUrlSubDelims: _validateUrlSubDelims__WEBPACK_IMPORTED_MODULE_3__["default"]\n}, \'i\');\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (validateUrlUserinfo);\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/regexp/validateUrlUserinfo.js?')},"./node_modules/twitter-text/dist/esm/removeOverlappingEntities.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.array.sort */ "./node_modules/core-js/modules/es6.array.sort.js");\n/* harmony import */ var core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_sort__WEBPACK_IMPORTED_MODULE_0__);\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(entities) {\n entities.sort(function (a, b) {\n return a.indices[0] - b.indices[0];\n });\n var prev = entities[0];\n\n for (var i = 1; i < entities.length; i++) {\n if (prev.indices[1] > entities[i].indices[0]) {\n entities.splice(i, 1);\n i--;\n } else {\n prev = entities[i];\n }\n }\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/removeOverlappingEntities.js?')},"./node_modules/twitter-text/dist/esm/splitTags.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.split */ "./node_modules/core-js/modules/es6.regexp.split.js");\n/* harmony import */ var core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_split__WEBPACK_IMPORTED_MODULE_0__);\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n// this essentially does text.split(/<|>/)\n// except that won\'t work in IE, where empty strings are ommitted\n// so "<>".split(/<|>/) => [] in IE, but is ["", "", ""] in all others\n// but "<<".split("<") => ["", "", ""]\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(text) {\n var firstSplits = text.split(\'<\'),\n secondSplits,\n allSplits = [],\n split;\n\n for (var i = 0; i < firstSplits.length; i += 1) {\n split = firstSplits[i];\n\n if (!split) {\n allSplits.push(\'\');\n } else {\n secondSplits = split.split(\'>\');\n\n for (var j = 0; j < secondSplits.length; j += 1) {\n allSplits.push(secondSplits[j]);\n }\n }\n }\n\n return allSplits;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/splitTags.js?')},"./node_modules/twitter-text/dist/esm/standardizeIndices.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ standardizeIndices)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_string_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.string.iterator */ "./node_modules/core-js/modules/es6.string.iterator.js");\n/* harmony import */ var core_js_modules_es6_string_iterator__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_string_iterator__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_array_from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.array.from */ "./node_modules/core-js/modules/es6.array.from.js");\n/* harmony import */ var core_js_modules_es6_array_from__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_array_from__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _getUnicodeTextLength__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./getUnicodeTextLength */ "./node_modules/twitter-text/dist/esm/getUnicodeTextLength.js");\n\n\n\nfunction standardizeIndices(text, startIndex, endIndex) {\n var totalUnicodeTextLength = (0,_getUnicodeTextLength__WEBPACK_IMPORTED_MODULE_2__["default"])(text);\n var encodingDiff = text.length - totalUnicodeTextLength;\n\n if (encodingDiff > 0) {\n // split the string into codepoints which will map to the API\'s indices\n var byCodePair = Array.from(text);\n var beforeText = startIndex === 0 ? \'\' : byCodePair.slice(0, startIndex).join(\'\');\n var actualText = byCodePair.slice(startIndex, endIndex).join(\'\');\n return [beforeText.length, beforeText.length + actualText.length];\n }\n\n return [startIndex, endIndex];\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/standardizeIndices.js?')},"./node_modules/twitter-text/dist/esm/tagAttrs.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es6.regexp.to-string */ "./node_modules/core-js/modules/es6.regexp.to-string.js");\n/* harmony import */ var core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_regexp_to_string__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es6_date_to_string__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es6.date.to-string */ "./node_modules/core-js/modules/es6.date.to-string.js");\n/* harmony import */ var core_js_modules_es6_date_to_string__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_date_to_string__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es6.object.to-string */ "./node_modules/core-js/modules/es6.object.to-string.js");\n/* harmony import */ var core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es6_object_to_string__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _htmlEscape__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./htmlEscape */ "./node_modules/twitter-text/dist/esm/htmlEscape.js");\n\n\n\n// Copyright 2018 Twitter, Inc.\n// Licensed under the Apache License, Version 2.0\n// http://www.apache.org/licenses/LICENSE-2.0\n\nvar BOOLEAN_ATTRIBUTES = {\n disabled: true,\n readonly: true,\n multiple: true,\n checked: true\n};\n/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(attributes) {\n var htmlAttrs = \'\';\n\n for (var k in attributes) {\n var v = attributes[k];\n\n if (BOOLEAN_ATTRIBUTES[k]) {\n v = v ? k : null;\n }\n\n if (v == null) {\n continue;\n }\n\n htmlAttrs += " ".concat((0,_htmlEscape__WEBPACK_IMPORTED_MODULE_3__["default"])(k), "=\\"").concat((0,_htmlEscape__WEBPACK_IMPORTED_MODULE_3__["default"])(v.toString()), "\\"");\n }\n\n return htmlAttrs;\n}\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/dist/esm/tagAttrs.js?')},"./node_modules/twitter-text/node_modules/punycode/punycode.js":function(module,exports,__webpack_require__){eval("/* module decorator */ module = __webpack_require__.nmd(module);\nvar __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = true && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = true && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow new RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * https://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.4.1',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (\n\t\ttrue\n\t) {\n\t\t!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {\n\t\t\treturn punycode;\n\t\t}).call(exports, __webpack_require__, exports, module),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else {}\n\n}(this));\n\n\n//# sourceURL=webpack://web/./node_modules/twitter-text/node_modules/punycode/punycode.js?")},"./node_modules/url-toolkit/src/url-toolkit.js":function(module){eval("// see https://tools.ietf.org/html/rfc1808\n\n(function (root) {\n var URL_REGEX =\n /^(?=((?:[a-zA-Z0-9+\\-.]+:)?))\\1(?=((?:\\/\\/[^\\/?#]*)?))\\2(?=((?:(?:[^?#\\/]*\\/)*[^;?#\\/]*)?))\\3((?:;[^?#]*)?)(\\?[^#]*)?(#[^]*)?$/;\n var FIRST_SEGMENT_REGEX = /^(?=([^\\/?#]*))\\1([^]*)$/;\n var SLASH_DOT_REGEX = /(?:\\/|^)\\.(?=\\/)/g;\n var SLASH_DOT_DOT_REGEX = /(?:\\/|^)\\.\\.\\/(?!\\.\\.\\/)[^\\/]*(?=\\/)/g;\n\n var URLToolkit = {\n // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //\n // E.g\n // With opts.alwaysNormalize = false (default, spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g\n // With opts.alwaysNormalize = true (not spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/g\n buildAbsoluteURL: function (baseURL, relativeURL, opts) {\n opts = opts || {};\n // remove any remaining space and CRLF\n baseURL = baseURL.trim();\n relativeURL = relativeURL.trim();\n if (!relativeURL) {\n // 2a) If the embedded URL is entirely empty, it inherits the\n // entire base URL (i.e., is set equal to the base URL)\n // and we are done.\n if (!opts.alwaysNormalize) {\n return baseURL;\n }\n var basePartsForNormalise = URLToolkit.parseURL(baseURL);\n if (!basePartsForNormalise) {\n throw new Error('Error trying to parse base URL.');\n }\n basePartsForNormalise.path = URLToolkit.normalizePath(\n basePartsForNormalise.path\n );\n return URLToolkit.buildURLFromParts(basePartsForNormalise);\n }\n var relativeParts = URLToolkit.parseURL(relativeURL);\n if (!relativeParts) {\n throw new Error('Error trying to parse relative URL.');\n }\n if (relativeParts.scheme) {\n // 2b) If the embedded URL starts with a scheme name, it is\n // interpreted as an absolute URL and we are done.\n if (!opts.alwaysNormalize) {\n return relativeURL;\n }\n relativeParts.path = URLToolkit.normalizePath(relativeParts.path);\n return URLToolkit.buildURLFromParts(relativeParts);\n }\n var baseParts = URLToolkit.parseURL(baseURL);\n if (!baseParts) {\n throw new Error('Error trying to parse base URL.');\n }\n if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') {\n // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc\n // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a'\n var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);\n baseParts.netLoc = pathParts[1];\n baseParts.path = pathParts[2];\n }\n if (baseParts.netLoc && !baseParts.path) {\n baseParts.path = '/';\n }\n var builtParts = {\n // 2c) Otherwise, the embedded URL inherits the scheme of\n // the base URL.\n scheme: baseParts.scheme,\n netLoc: relativeParts.netLoc,\n path: null,\n params: relativeParts.params,\n query: relativeParts.query,\n fragment: relativeParts.fragment,\n };\n if (!relativeParts.netLoc) {\n // 3) If the embedded URL's <net_loc> is non-empty, we skip to\n // Step 7. Otherwise, the embedded URL inherits the <net_loc>\n // (if any) of the base URL.\n builtParts.netLoc = baseParts.netLoc;\n // 4) If the embedded URL path is preceded by a slash \"/\", the\n // path is not relative and we skip to Step 7.\n if (relativeParts.path[0] !== '/') {\n if (!relativeParts.path) {\n // 5) If the embedded URL path is empty (and not preceded by a\n // slash), then the embedded URL inherits the base URL path\n builtParts.path = baseParts.path;\n // 5a) if the embedded URL's <params> is non-empty, we skip to\n // step 7; otherwise, it inherits the <params> of the base\n // URL (if any) and\n if (!relativeParts.params) {\n builtParts.params = baseParts.params;\n // 5b) if the embedded URL's <query> is non-empty, we skip to\n // step 7; otherwise, it inherits the <query> of the base\n // URL (if any) and we skip to step 7.\n if (!relativeParts.query) {\n builtParts.query = baseParts.query;\n }\n }\n } else {\n // 6) The last segment of the base URL's path (anything\n // following the rightmost slash \"/\", or the entire path if no\n // slash is present) is removed and the embedded URL's path is\n // appended in its place.\n var baseURLPath = baseParts.path;\n var newPath =\n baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) +\n relativeParts.path;\n builtParts.path = URLToolkit.normalizePath(newPath);\n }\n }\n }\n if (builtParts.path === null) {\n builtParts.path = opts.alwaysNormalize\n ? URLToolkit.normalizePath(relativeParts.path)\n : relativeParts.path;\n }\n return URLToolkit.buildURLFromParts(builtParts);\n },\n parseURL: function (url) {\n var parts = URL_REGEX.exec(url);\n if (!parts) {\n return null;\n }\n return {\n scheme: parts[1] || '',\n netLoc: parts[2] || '',\n path: parts[3] || '',\n params: parts[4] || '',\n query: parts[5] || '',\n fragment: parts[6] || '',\n };\n },\n normalizePath: function (path) {\n // The following operations are\n // then applied, in order, to the new path:\n // 6a) All occurrences of \"./\", where \".\" is a complete path\n // segment, are removed.\n // 6b) If the path ends with \".\" as a complete path segment,\n // that \".\" is removed.\n path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, '');\n // 6c) All occurrences of \"<segment>/../\", where <segment> is a\n // complete path segment not equal to \"..\", are removed.\n // Removal of these path segments is performed iteratively,\n // removing the leftmost matching pattern on each iteration,\n // until no matching pattern remains.\n // 6d) If the path ends with \"<segment>/..\", where <segment> is a\n // complete path segment not equal to \"..\", that\n // \"<segment>/..\" is removed.\n while (\n path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length\n ) {}\n return path.split('').reverse().join('');\n },\n buildURLFromParts: function (parts) {\n return (\n parts.scheme +\n parts.netLoc +\n parts.path +\n parts.params +\n parts.query +\n parts.fragment\n );\n },\n };\n\n if (true)\n module.exports = URLToolkit;\n else {}\n})(this);\n\n\n//# sourceURL=webpack://web/./node_modules/url-toolkit/src/url-toolkit.js?")},"./node_modules/video.js/dist/video.es.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ videojs)\n/* harmony export */ });\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var global_document__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! global/document */ \"./node_modules/global/document.js\");\n/* harmony import */ var global_document__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global_document__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var keycode__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! keycode */ \"./node_modules/keycode/index.js\");\n/* harmony import */ var keycode__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(keycode__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! safe-json-parse/tuple */ \"./node_modules/safe-json-parse/tuple.js\");\n/* harmony import */ var safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _videojs_xhr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @videojs/xhr */ \"./node_modules/@videojs/xhr/lib/index.js\");\n/* harmony import */ var _videojs_xhr__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_videojs_xhr__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! videojs-vtt.js */ \"./node_modules/videojs-vtt.js/lib/browser-index.js\");\n/* harmony import */ var videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var _videojs_vhs_utils_es_resolve_url_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @videojs/vhs-utils/es/resolve-url.js */ \"./node_modules/@videojs/vhs-utils/es/resolve-url.js\");\n/* harmony import */ var m3u8_parser__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! m3u8-parser */ \"./node_modules/m3u8-parser/dist/m3u8-parser.es.js\");\n/* harmony import */ var _videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @videojs/vhs-utils/es/codecs.js */ \"./node_modules/@videojs/vhs-utils/es/codecs.js\");\n/* harmony import */ var _videojs_vhs_utils_es_media_types_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @videojs/vhs-utils/es/media-types.js */ \"./node_modules/@videojs/vhs-utils/es/media-types.js\");\n/* harmony import */ var _videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @videojs/vhs-utils/es/byte-helpers */ \"./node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n/* harmony import */ var mpd_parser__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! mpd-parser */ \"./node_modules/mpd-parser/dist/mpd-parser.es.js\");\n/* harmony import */ var mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! mux.js/lib/tools/parse-sidx */ \"./node_modules/mux.js/lib/tools/parse-sidx.js\");\n/* harmony import */ var mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_13__);\n/* harmony import */ var _videojs_vhs_utils_es_id3_helpers__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @videojs/vhs-utils/es/id3-helpers */ \"./node_modules/@videojs/vhs-utils/es/id3-helpers.js\");\n/* harmony import */ var _videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @videojs/vhs-utils/es/containers */ \"./node_modules/@videojs/vhs-utils/es/containers.js\");\n/* harmony import */ var mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! mux.js/lib/utils/clock */ \"./node_modules/mux.js/lib/utils/clock.js\");\n/* harmony import */ var mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_16__);\n/**\n * @license\n * Video.js 8.9.0 <http://videojs.com/>\n * Copyright Brightcove, Inc. <https://www.brightcove.com/>\n * Available under Apache License Version 2.0\n * <https://github.com/videojs/video.js/blob/main/LICENSE>\n *\n * Includes vtt.js <https://github.com/mozilla/vtt.js>\n * Available under Apache License Version 2.0\n * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar version$6 = \"8.9.0\";\n\n/**\n * An Object that contains lifecycle hooks as keys which point to an array\n * of functions that are run when a lifecycle is triggered\n *\n * @private\n */\nconst hooks_ = {};\n\n/**\n * Get a list of hooks for a specific lifecycle\n *\n * @param {string} type\n * the lifecycle to get hooks from\n *\n * @param {Function|Function[]} [fn]\n * Optionally add a hook (or hooks) to the lifecycle that your are getting.\n *\n * @return {Array}\n * an array of hooks, or an empty array if there are none.\n */\nconst hooks = function (type, fn) {\n hooks_[type] = hooks_[type] || [];\n if (fn) {\n hooks_[type] = hooks_[type].concat(fn);\n }\n return hooks_[type];\n};\n\n/**\n * Add a function hook to a specific videojs lifecycle.\n *\n * @param {string} type\n * the lifecycle to hook the function to.\n *\n * @param {Function|Function[]}\n * The function or array of functions to attach.\n */\nconst hook = function (type, fn) {\n hooks(type, fn);\n};\n\n/**\n * Remove a hook from a specific videojs lifecycle.\n *\n * @param {string} type\n * the lifecycle that the function hooked to\n *\n * @param {Function} fn\n * The hooked function to remove\n *\n * @return {boolean}\n * The function that was removed or undef\n */\nconst removeHook = function (type, fn) {\n const index = hooks(type).indexOf(fn);\n if (index <= -1) {\n return false;\n }\n hooks_[type] = hooks_[type].slice();\n hooks_[type].splice(index, 1);\n return true;\n};\n\n/**\n * Add a function hook that will only run once to a specific videojs lifecycle.\n *\n * @param {string} type\n * the lifecycle to hook the function to.\n *\n * @param {Function|Function[]}\n * The function or array of functions to attach.\n */\nconst hookOnce = function (type, fn) {\n hooks(type, [].concat(fn).map(original => {\n const wrapper = (...args) => {\n removeHook(type, wrapper);\n return original(...args);\n };\n return wrapper;\n }));\n};\n\n/**\n * @file fullscreen-api.js\n * @module fullscreen-api\n */\n\n/**\n * Store the browser-specific methods for the fullscreen API.\n *\n * @type {Object}\n * @see [Specification]{@link https://fullscreen.spec.whatwg.org}\n * @see [Map Approach From Screenfull.js]{@link https://github.com/sindresorhus/screenfull.js}\n */\nconst FullscreenApi = {\n prefixed: true\n};\n\n// browser API methods\nconst apiMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror', 'fullscreen'],\n// WebKit\n['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror', '-webkit-full-screen']];\nconst specApi = apiMap[0];\nlet browserApi;\n\n// determine the supported set of functions\nfor (let i = 0; i < apiMap.length; i++) {\n // check for exitFullscreen function\n if (apiMap[i][1] in (global_document__WEBPACK_IMPORTED_MODULE_1___default())) {\n browserApi = apiMap[i];\n break;\n }\n}\n\n// map the browser API names to the spec API names\nif (browserApi) {\n for (let i = 0; i < browserApi.length; i++) {\n FullscreenApi[specApi[i]] = browserApi[i];\n }\n FullscreenApi.prefixed = browserApi[0] !== specApi[0];\n}\n\n/**\n * @file create-logger.js\n * @module create-logger\n */\n\n// This is the private tracking variable for the logging history.\nlet history = [];\n\n/**\n * Log messages to the console and history based on the type of message\n *\n * @private\n * @param {string} name\n * The name of the console method to use.\n *\n * @param {Object} log\n * The arguments to be passed to the matching console method.\n *\n * @param {string} [styles]\n * styles for name\n */\nconst LogByTypeFactory = (name, log, styles) => (type, level, args) => {\n const lvl = log.levels[level];\n const lvlRegExp = new RegExp(`^(${lvl})$`);\n let resultName = name;\n if (type !== 'log') {\n // Add the type to the front of the message when it's not \"log\".\n args.unshift(type.toUpperCase() + ':');\n }\n if (styles) {\n resultName = `%c${name}`;\n args.unshift(styles);\n }\n\n // Add console prefix after adding to history.\n args.unshift(resultName + ':');\n\n // Add a clone of the args at this point to history.\n if (history) {\n history.push([].concat(args));\n\n // only store 1000 history entries\n const splice = history.length - 1000;\n history.splice(0, splice > 0 ? splice : 0);\n }\n\n // If there's no console then don't try to output messages, but they will\n // still be stored in history.\n if (!(global_window__WEBPACK_IMPORTED_MODULE_0___default().console)) {\n return;\n }\n\n // Was setting these once outside of this function, but containing them\n // in the function makes it easier to test cases where console doesn't exist\n // when the module is executed.\n let fn = (global_window__WEBPACK_IMPORTED_MODULE_0___default().console)[type];\n if (!fn && type === 'debug') {\n // Certain browsers don't have support for console.debug. For those, we\n // should default to the closest comparable log.\n fn = (global_window__WEBPACK_IMPORTED_MODULE_0___default().console).info || (global_window__WEBPACK_IMPORTED_MODULE_0___default().console).log;\n }\n\n // Bail out if there's no console or if this type is not allowed by the\n // current logging level.\n if (!fn || !lvl || !lvlRegExp.test(type)) {\n return;\n }\n fn[Array.isArray(args) ? 'apply' : 'call']((global_window__WEBPACK_IMPORTED_MODULE_0___default().console), args);\n};\nfunction createLogger$1(name, delimiter = ':', styles = '') {\n // This is the private tracking variable for logging level.\n let level = 'info';\n\n // the curried logByType bound to the specific log and history\n let logByType;\n\n /**\n * Logs plain debug messages. Similar to `console.log`.\n *\n * Due to [limitations](https://github.com/jsdoc3/jsdoc/issues/955#issuecomment-313829149)\n * of our JSDoc template, we cannot properly document this as both a function\n * and a namespace, so its function signature is documented here.\n *\n * #### Arguments\n * ##### *args\n * *[]\n *\n * Any combination of values that could be passed to `console.log()`.\n *\n * #### Return Value\n *\n * `undefined`\n *\n * @namespace\n * @param {...*} args\n * One or more messages or objects that should be logged.\n */\n const log = function (...args) {\n logByType('log', level, args);\n };\n\n // This is the logByType helper that the logging methods below use\n logByType = LogByTypeFactory(name, log, styles);\n\n /**\n * Create a new subLogger which chains the old name to the new name.\n *\n * For example, doing `videojs.log.createLogger('player')` and then using that logger will log the following:\n * ```js\n * mylogger('foo');\n * // > VIDEOJS: player: foo\n * ```\n *\n * @param {string} subName\n * The name to add call the new logger\n * @param {string} [subDelimiter]\n * Optional delimiter\n * @param {string} [subStyles]\n * Optional styles\n * @return {Object}\n */\n log.createLogger = (subName, subDelimiter, subStyles) => {\n const resultDelimiter = subDelimiter !== undefined ? subDelimiter : delimiter;\n const resultStyles = subStyles !== undefined ? subStyles : styles;\n const resultName = `${name} ${resultDelimiter} ${subName}`;\n return createLogger$1(resultName, resultDelimiter, resultStyles);\n };\n\n /**\n * Create a new logger.\n *\n * @param {string} newName\n * The name for the new logger\n * @param {string} [newDelimiter]\n * Optional delimiter\n * @param {string} [newStyles]\n * Optional styles\n * @return {Object}\n */\n log.createNewLogger = (newName, newDelimiter, newStyles) => {\n return createLogger$1(newName, newDelimiter, newStyles);\n };\n\n /**\n * Enumeration of available logging levels, where the keys are the level names\n * and the values are `|`-separated strings containing logging methods allowed\n * in that logging level. These strings are used to create a regular expression\n * matching the function name being called.\n *\n * Levels provided by Video.js are:\n *\n * - `off`: Matches no calls. Any value that can be cast to `false` will have\n * this effect. The most restrictive.\n * - `all`: Matches only Video.js-provided functions (`debug`, `log`,\n * `log.warn`, and `log.error`).\n * - `debug`: Matches `log.debug`, `log`, `log.warn`, and `log.error` calls.\n * - `info` (default): Matches `log`, `log.warn`, and `log.error` calls.\n * - `warn`: Matches `log.warn` and `log.error` calls.\n * - `error`: Matches only `log.error` calls.\n *\n * @type {Object}\n */\n log.levels = {\n all: 'debug|log|warn|error',\n off: '',\n debug: 'debug|log|warn|error',\n info: 'log|warn|error',\n warn: 'warn|error',\n error: 'error',\n DEFAULT: level\n };\n\n /**\n * Get or set the current logging level.\n *\n * If a string matching a key from {@link module:log.levels} is provided, acts\n * as a setter.\n *\n * @param {'all'|'debug'|'info'|'warn'|'error'|'off'} [lvl]\n * Pass a valid level to set a new logging level.\n *\n * @return {string}\n * The current logging level.\n */\n log.level = lvl => {\n if (typeof lvl === 'string') {\n if (!log.levels.hasOwnProperty(lvl)) {\n throw new Error(`\"${lvl}\" in not a valid log level`);\n }\n level = lvl;\n }\n return level;\n };\n\n /**\n * Returns an array containing everything that has been logged to the history.\n *\n * This array is a shallow clone of the internal history record. However, its\n * contents are _not_ cloned; so, mutating objects inside this array will\n * mutate them in history.\n *\n * @return {Array}\n */\n log.history = () => history ? [].concat(history) : [];\n\n /**\n * Allows you to filter the history by the given logger name\n *\n * @param {string} fname\n * The name to filter by\n *\n * @return {Array}\n * The filtered list to return\n */\n log.history.filter = fname => {\n return (history || []).filter(historyItem => {\n // if the first item in each historyItem includes `fname`, then it's a match\n return new RegExp(`.*${fname}.*`).test(historyItem[0]);\n });\n };\n\n /**\n * Clears the internal history tracking, but does not prevent further history\n * tracking.\n */\n log.history.clear = () => {\n if (history) {\n history.length = 0;\n }\n };\n\n /**\n * Disable history tracking if it is currently enabled.\n */\n log.history.disable = () => {\n if (history !== null) {\n history.length = 0;\n history = null;\n }\n };\n\n /**\n * Enable history tracking if it is currently disabled.\n */\n log.history.enable = () => {\n if (history === null) {\n history = [];\n }\n };\n\n /**\n * Logs error messages. Similar to `console.error`.\n *\n * @param {...*} args\n * One or more messages or objects that should be logged as an error\n */\n log.error = (...args) => logByType('error', level, args);\n\n /**\n * Logs warning messages. Similar to `console.warn`.\n *\n * @param {...*} args\n * One or more messages or objects that should be logged as a warning.\n */\n log.warn = (...args) => logByType('warn', level, args);\n\n /**\n * Logs debug messages. Similar to `console.debug`, but may also act as a comparable\n * log if `console.debug` is not available\n *\n * @param {...*} args\n * One or more messages or objects that should be logged as debug.\n */\n log.debug = (...args) => logByType('debug', level, args);\n return log;\n}\n\n/**\n * @file log.js\n * @module log\n */\nconst log$1 = createLogger$1('VIDEOJS');\nconst createLogger = log$1.createLogger;\n\n/**\n * @file obj.js\n * @module obj\n */\n\n/**\n * @callback obj:EachCallback\n *\n * @param {*} value\n * The current key for the object that is being iterated over.\n *\n * @param {string} key\n * The current key-value for object that is being iterated over\n */\n\n/**\n * @callback obj:ReduceCallback\n *\n * @param {*} accum\n * The value that is accumulating over the reduce loop.\n *\n * @param {*} value\n * The current key for the object that is being iterated over.\n *\n * @param {string} key\n * The current key-value for object that is being iterated over\n *\n * @return {*}\n * The new accumulated value.\n */\nconst toString = Object.prototype.toString;\n\n/**\n * Get the keys of an Object\n *\n * @param {Object}\n * The Object to get the keys from\n *\n * @return {string[]}\n * An array of the keys from the object. Returns an empty array if the\n * object passed in was invalid or had no keys.\n *\n * @private\n */\nconst keys = function (object) {\n return isObject(object) ? Object.keys(object) : [];\n};\n\n/**\n * Array-like iteration for objects.\n *\n * @param {Object} object\n * The object to iterate over\n *\n * @param {obj:EachCallback} fn\n * The callback function which is called for each key in the object.\n */\nfunction each(object, fn) {\n keys(object).forEach(key => fn(object[key], key));\n}\n\n/**\n * Array-like reduce for objects.\n *\n * @param {Object} object\n * The Object that you want to reduce.\n *\n * @param {Function} fn\n * A callback function which is called for each key in the object. It\n * receives the accumulated value and the per-iteration value and key\n * as arguments.\n *\n * @param {*} [initial = 0]\n * Starting value\n *\n * @return {*}\n * The final accumulated value.\n */\nfunction reduce(object, fn, initial = 0) {\n return keys(object).reduce((accum, key) => fn(accum, object[key], key), initial);\n}\n\n/**\n * Returns whether a value is an object of any kind - including DOM nodes,\n * arrays, regular expressions, etc. Not functions, though.\n *\n * This avoids the gotcha where using `typeof` on a `null` value\n * results in `'object'`.\n *\n * @param {Object} value\n * @return {boolean}\n */\nfunction isObject(value) {\n return !!value && typeof value === 'object';\n}\n\n/**\n * Returns whether an object appears to be a \"plain\" object - that is, a\n * direct instance of `Object`.\n *\n * @param {Object} value\n * @return {boolean}\n */\nfunction isPlain(value) {\n return isObject(value) && toString.call(value) === '[object Object]' && value.constructor === Object;\n}\n\n/**\n * Merge two objects recursively.\n *\n * Performs a deep merge like\n * {@link https://lodash.com/docs/4.17.10#merge|lodash.merge}, but only merges\n * plain objects (not arrays, elements, or anything else).\n *\n * Non-plain object values will be copied directly from the right-most\n * argument.\n *\n * @param {Object[]} sources\n * One or more objects to merge into a new object.\n *\n * @return {Object}\n * A new object that is the merged result of all sources.\n */\nfunction merge$1(...sources) {\n const result = {};\n sources.forEach(source => {\n if (!source) {\n return;\n }\n each(source, (value, key) => {\n if (!isPlain(value)) {\n result[key] = value;\n return;\n }\n if (!isPlain(result[key])) {\n result[key] = {};\n }\n result[key] = merge$1(result[key], value);\n });\n });\n return result;\n}\n\n/**\n * Returns an array of values for a given object\n *\n * @param {Object} source - target object\n * @return {Array<unknown>} - object values\n */\nfunction values(source = {}) {\n const result = [];\n for (const key in source) {\n if (source.hasOwnProperty(key)) {\n const value = source[key];\n result.push(value);\n }\n }\n return result;\n}\n\n/**\n * Object.defineProperty but \"lazy\", which means that the value is only set after\n * it is retrieved the first time, rather than being set right away.\n *\n * @param {Object} obj the object to set the property on\n * @param {string} key the key for the property to set\n * @param {Function} getValue the function used to get the value when it is needed.\n * @param {boolean} setter whether a setter should be allowed or not\n */\nfunction defineLazyProperty(obj, key, getValue, setter = true) {\n const set = value => Object.defineProperty(obj, key, {\n value,\n enumerable: true,\n writable: true\n });\n const options = {\n configurable: true,\n enumerable: true,\n get() {\n const value = getValue();\n set(value);\n return value;\n }\n };\n if (setter) {\n options.set = set;\n }\n return Object.defineProperty(obj, key, options);\n}\n\nvar Obj = /*#__PURE__*/Object.freeze({\n __proto__: null,\n each: each,\n reduce: reduce,\n isObject: isObject,\n isPlain: isPlain,\n merge: merge$1,\n values: values,\n defineLazyProperty: defineLazyProperty\n});\n\n/**\n * @file browser.js\n * @module browser\n */\n\n/**\n * Whether or not this device is an iPod.\n *\n * @static\n * @type {Boolean}\n */\nlet IS_IPOD = false;\n\n/**\n * The detected iOS version - or `null`.\n *\n * @static\n * @type {string|null}\n */\nlet IOS_VERSION = null;\n\n/**\n * Whether or not this is an Android device.\n *\n * @static\n * @type {Boolean}\n */\nlet IS_ANDROID = false;\n\n/**\n * The detected Android version - or `null` if not Android or indeterminable.\n *\n * @static\n * @type {number|string|null}\n */\nlet ANDROID_VERSION;\n\n/**\n * Whether or not this is Mozilla Firefox.\n *\n * @static\n * @type {Boolean}\n */\nlet IS_FIREFOX = false;\n\n/**\n * Whether or not this is Microsoft Edge.\n *\n * @static\n * @type {Boolean}\n */\nlet IS_EDGE = false;\n\n/**\n * Whether or not this is any Chromium Browser\n *\n * @static\n * @type {Boolean}\n */\nlet IS_CHROMIUM = false;\n\n/**\n * Whether or not this is any Chromium browser that is not Edge.\n *\n * This will also be `true` for Chrome on iOS, which will have different support\n * as it is actually Safari under the hood.\n *\n * Deprecated, as the behaviour to not match Edge was to prevent Legacy Edge's UA matching.\n * IS_CHROMIUM should be used instead.\n * \"Chromium but not Edge\" could be explicitly tested with IS_CHROMIUM && !IS_EDGE\n *\n * @static\n * @deprecated\n * @type {Boolean}\n */\nlet IS_CHROME = false;\n\n/**\n * The detected Chromium version - or `null`.\n *\n * @static\n * @type {number|null}\n */\nlet CHROMIUM_VERSION = null;\n\n/**\n * The detected Google Chrome version - or `null`.\n * This has always been the _Chromium_ version, i.e. would return on Chromium Edge.\n * Deprecated, use CHROMIUM_VERSION instead.\n *\n * @static\n * @deprecated\n * @type {number|null}\n */\nlet CHROME_VERSION = null;\n\n/**\n * The detected Internet Explorer version - or `null`.\n *\n * @static\n * @deprecated\n * @type {number|null}\n */\nlet IE_VERSION = null;\n\n/**\n * Whether or not this is desktop Safari.\n *\n * @static\n * @type {Boolean}\n */\nlet IS_SAFARI = false;\n\n/**\n * Whether or not this is a Windows machine.\n *\n * @static\n * @type {Boolean}\n */\nlet IS_WINDOWS = false;\n\n/**\n * Whether or not this device is an iPad.\n *\n * @static\n * @type {Boolean}\n */\nlet IS_IPAD = false;\n\n/**\n * Whether or not this device is an iPhone.\n *\n * @static\n * @type {Boolean}\n */\n// The Facebook app's UIWebView identifies as both an iPhone and iPad, so\n// to identify iPhones, we need to exclude iPads.\n// http://artsy.github.io/blog/2012/10/18/the-perils-of-ios-user-agent-sniffing/\nlet IS_IPHONE = false;\n\n/**\n * Whether or not this device is touch-enabled.\n *\n * @static\n * @const\n * @type {Boolean}\n */\nconst TOUCH_ENABLED = Boolean(isReal() && (\"ontouchstart\" in (global_window__WEBPACK_IMPORTED_MODULE_0___default()) || (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).maxTouchPoints || (global_window__WEBPACK_IMPORTED_MODULE_0___default().DocumentTouch) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().document) instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().DocumentTouch)));\nconst UAD = (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).userAgentData;\nif (UAD && UAD.platform && UAD.brands) {\n // If userAgentData is present, use it instead of userAgent to avoid warnings\n // Currently only implemented on Chromium\n // userAgentData does not expose Android version, so ANDROID_VERSION remains `null`\n\n IS_ANDROID = UAD.platform === 'Android';\n IS_EDGE = Boolean(UAD.brands.find(b => b.brand === 'Microsoft Edge'));\n IS_CHROMIUM = Boolean(UAD.brands.find(b => b.brand === 'Chromium'));\n IS_CHROME = !IS_EDGE && IS_CHROMIUM;\n CHROMIUM_VERSION = CHROME_VERSION = (UAD.brands.find(b => b.brand === 'Chromium') || {}).version || null;\n IS_WINDOWS = UAD.platform === 'Windows';\n}\n\n// If the browser is not Chromium, either userAgentData is not present which could be an old Chromium browser,\n// or it's a browser that has added userAgentData since that we don't have tests for yet. In either case,\n// the checks need to be made agiainst the regular userAgent string.\nif (!IS_CHROMIUM) {\n const USER_AGENT = (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).userAgent || '';\n IS_IPOD = /iPod/i.test(USER_AGENT);\n IOS_VERSION = function () {\n const match = USER_AGENT.match(/OS (\\d+)_/i);\n if (match && match[1]) {\n return match[1];\n }\n return null;\n }();\n IS_ANDROID = /Android/i.test(USER_AGENT);\n ANDROID_VERSION = function () {\n // This matches Android Major.Minor.Patch versions\n // ANDROID_VERSION is Major.Minor as a Number, if Minor isn't available, then only Major is returned\n const match = USER_AGENT.match(/Android (\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))*/i);\n if (!match) {\n return null;\n }\n const major = match[1] && parseFloat(match[1]);\n const minor = match[2] && parseFloat(match[2]);\n if (major && minor) {\n return parseFloat(match[1] + '.' + match[2]);\n } else if (major) {\n return major;\n }\n return null;\n }();\n IS_FIREFOX = /Firefox/i.test(USER_AGENT);\n IS_EDGE = /Edg/i.test(USER_AGENT);\n IS_CHROMIUM = /Chrome/i.test(USER_AGENT) || /CriOS/i.test(USER_AGENT);\n IS_CHROME = !IS_EDGE && IS_CHROMIUM;\n CHROMIUM_VERSION = CHROME_VERSION = function () {\n const match = USER_AGENT.match(/(Chrome|CriOS)\\/(\\d+)/);\n if (match && match[2]) {\n return parseFloat(match[2]);\n }\n return null;\n }();\n IE_VERSION = function () {\n const result = /MSIE\\s(\\d+)\\.\\d/.exec(USER_AGENT);\n let version = result && parseFloat(result[1]);\n if (!version && /Trident\\/7.0/i.test(USER_AGENT) && /rv:11.0/.test(USER_AGENT)) {\n // IE 11 has a different user agent string than other IE versions\n version = 11.0;\n }\n return version;\n }();\n IS_SAFARI = /Safari/i.test(USER_AGENT) && !IS_CHROME && !IS_ANDROID && !IS_EDGE;\n IS_WINDOWS = /Windows/i.test(USER_AGENT);\n IS_IPAD = /iPad/i.test(USER_AGENT) || IS_SAFARI && TOUCH_ENABLED && !/iPhone/i.test(USER_AGENT);\n IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD;\n}\n\n/**\n * Whether or not this is an iOS device.\n *\n * @static\n * @const\n * @type {Boolean}\n */\nconst IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD;\n\n/**\n * Whether or not this is any flavor of Safari - including iOS.\n *\n * @static\n * @const\n * @type {Boolean}\n */\nconst IS_ANY_SAFARI = (IS_SAFARI || IS_IOS) && !IS_CHROME;\n\nvar browser = /*#__PURE__*/Object.freeze({\n __proto__: null,\n get IS_IPOD () { return IS_IPOD; },\n get IOS_VERSION () { return IOS_VERSION; },\n get IS_ANDROID () { return IS_ANDROID; },\n get ANDROID_VERSION () { return ANDROID_VERSION; },\n get IS_FIREFOX () { return IS_FIREFOX; },\n get IS_EDGE () { return IS_EDGE; },\n get IS_CHROMIUM () { return IS_CHROMIUM; },\n get IS_CHROME () { return IS_CHROME; },\n get CHROMIUM_VERSION () { return CHROMIUM_VERSION; },\n get CHROME_VERSION () { return CHROME_VERSION; },\n get IE_VERSION () { return IE_VERSION; },\n get IS_SAFARI () { return IS_SAFARI; },\n get IS_WINDOWS () { return IS_WINDOWS; },\n get IS_IPAD () { return IS_IPAD; },\n get IS_IPHONE () { return IS_IPHONE; },\n TOUCH_ENABLED: TOUCH_ENABLED,\n IS_IOS: IS_IOS,\n IS_ANY_SAFARI: IS_ANY_SAFARI\n});\n\n/**\n * @file dom.js\n * @module dom\n */\n\n/**\n * Detect if a value is a string with any non-whitespace characters.\n *\n * @private\n * @param {string} str\n * The string to check\n *\n * @return {boolean}\n * Will be `true` if the string is non-blank, `false` otherwise.\n *\n */\nfunction isNonBlankString(str) {\n // we use str.trim as it will trim any whitespace characters\n // from the front or back of non-whitespace characters. aka\n // Any string that contains non-whitespace characters will\n // still contain them after `trim` but whitespace only strings\n // will have a length of 0, failing this check.\n return typeof str === 'string' && Boolean(str.trim());\n}\n\n/**\n * Throws an error if the passed string has whitespace. This is used by\n * class methods to be relatively consistent with the classList API.\n *\n * @private\n * @param {string} str\n * The string to check for whitespace.\n *\n * @throws {Error}\n * Throws an error if there is whitespace in the string.\n */\nfunction throwIfWhitespace(str) {\n // str.indexOf instead of regex because str.indexOf is faster performance wise.\n if (str.indexOf(' ') >= 0) {\n throw new Error('class has illegal whitespace characters');\n }\n}\n\n/**\n * Whether the current DOM interface appears to be real (i.e. not simulated).\n *\n * @return {boolean}\n * Will be `true` if the DOM appears to be real, `false` otherwise.\n */\nfunction isReal() {\n // Both document and window will never be undefined thanks to `global`.\n return (global_document__WEBPACK_IMPORTED_MODULE_1___default()) === (global_window__WEBPACK_IMPORTED_MODULE_0___default().document);\n}\n\n/**\n * Determines, via duck typing, whether or not a value is a DOM element.\n *\n * @param {*} value\n * The value to check.\n *\n * @return {boolean}\n * Will be `true` if the value is a DOM element, `false` otherwise.\n */\nfunction isEl(value) {\n return isObject(value) && value.nodeType === 1;\n}\n\n/**\n * Determines if the current DOM is embedded in an iframe.\n *\n * @return {boolean}\n * Will be `true` if the DOM is embedded in an iframe, `false`\n * otherwise.\n */\nfunction isInFrame() {\n // We need a try/catch here because Safari will throw errors when attempting\n // to get either `parent` or `self`\n try {\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default().parent) !== (global_window__WEBPACK_IMPORTED_MODULE_0___default().self);\n } catch (x) {\n return true;\n }\n}\n\n/**\n * Creates functions to query the DOM using a given method.\n *\n * @private\n * @param {string} method\n * The method to create the query with.\n *\n * @return {Function}\n * The query method\n */\nfunction createQuerier(method) {\n return function (selector, context) {\n if (!isNonBlankString(selector)) {\n return (global_document__WEBPACK_IMPORTED_MODULE_1___default())[method](null);\n }\n if (isNonBlankString(context)) {\n context = global_document__WEBPACK_IMPORTED_MODULE_1___default().querySelector(context);\n }\n const ctx = isEl(context) ? context : (global_document__WEBPACK_IMPORTED_MODULE_1___default());\n return ctx[method] && ctx[method](selector);\n };\n}\n\n/**\n * Creates an element and applies properties, attributes, and inserts content.\n *\n * @param {string} [tagName='div']\n * Name of tag to be created.\n *\n * @param {Object} [properties={}]\n * Element properties to be applied.\n *\n * @param {Object} [attributes={}]\n * Element attributes to be applied.\n *\n * @param {ContentDescriptor} [content]\n * A content descriptor object.\n *\n * @return {Element}\n * The element that was created.\n */\nfunction createEl(tagName = 'div', properties = {}, attributes = {}, content) {\n const el = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement(tagName);\n Object.getOwnPropertyNames(properties).forEach(function (propName) {\n const val = properties[propName];\n\n // Handle textContent since it's not supported everywhere and we have a\n // method for it.\n if (propName === 'textContent') {\n textContent(el, val);\n } else if (el[propName] !== val || propName === 'tabIndex') {\n el[propName] = val;\n }\n });\n Object.getOwnPropertyNames(attributes).forEach(function (attrName) {\n el.setAttribute(attrName, attributes[attrName]);\n });\n if (content) {\n appendContent(el, content);\n }\n return el;\n}\n\n/**\n * Injects text into an element, replacing any existing contents entirely.\n *\n * @param {HTMLElement} el\n * The element to add text content into\n *\n * @param {string} text\n * The text content to add.\n *\n * @return {Element}\n * The element with added text content.\n */\nfunction textContent(el, text) {\n if (typeof el.textContent === 'undefined') {\n el.innerText = text;\n } else {\n el.textContent = text;\n }\n return el;\n}\n\n/**\n * Insert an element as the first child node of another\n *\n * @param {Element} child\n * Element to insert\n *\n * @param {Element} parent\n * Element to insert child into\n */\nfunction prependTo(child, parent) {\n if (parent.firstChild) {\n parent.insertBefore(child, parent.firstChild);\n } else {\n parent.appendChild(child);\n }\n}\n\n/**\n * Check if an element has a class name.\n *\n * @param {Element} element\n * Element to check\n *\n * @param {string} classToCheck\n * Class name to check for\n *\n * @return {boolean}\n * Will be `true` if the element has a class, `false` otherwise.\n *\n * @throws {Error}\n * Throws an error if `classToCheck` has white space.\n */\nfunction hasClass(element, classToCheck) {\n throwIfWhitespace(classToCheck);\n return element.classList.contains(classToCheck);\n}\n\n/**\n * Add a class name to an element.\n *\n * @param {Element} element\n * Element to add class name to.\n *\n * @param {...string} classesToAdd\n * One or more class name to add.\n *\n * @return {Element}\n * The DOM element with the added class name.\n */\nfunction addClass(element, ...classesToAdd) {\n element.classList.add(...classesToAdd.reduce((prev, current) => prev.concat(current.split(/\\s+/)), []));\n return element;\n}\n\n/**\n * Remove a class name from an element.\n *\n * @param {Element} element\n * Element to remove a class name from.\n *\n * @param {...string} classesToRemove\n * One or more class name to remove.\n *\n * @return {Element}\n * The DOM element with class name removed.\n */\nfunction removeClass(element, ...classesToRemove) {\n // Protect in case the player gets disposed\n if (!element) {\n log$1.warn(\"removeClass was called with an element that doesn't exist\");\n return null;\n }\n element.classList.remove(...classesToRemove.reduce((prev, current) => prev.concat(current.split(/\\s+/)), []));\n return element;\n}\n\n/**\n * The callback definition for toggleClass.\n *\n * @callback module:dom~PredicateCallback\n * @param {Element} element\n * The DOM element of the Component.\n *\n * @param {string} classToToggle\n * The `className` that wants to be toggled\n *\n * @return {boolean|undefined}\n * If `true` is returned, the `classToToggle` will be added to the\n * `element`. If `false`, the `classToToggle` will be removed from\n * the `element`. If `undefined`, the callback will be ignored.\n */\n\n/**\n * Adds or removes a class name to/from an element depending on an optional\n * condition or the presence/absence of the class name.\n *\n * @param {Element} element\n * The element to toggle a class name on.\n *\n * @param {string} classToToggle\n * The class that should be toggled.\n *\n * @param {boolean|module:dom~PredicateCallback} [predicate]\n * See the return value for {@link module:dom~PredicateCallback}\n *\n * @return {Element}\n * The element with a class that has been toggled.\n */\nfunction toggleClass(element, classToToggle, predicate) {\n if (typeof predicate === 'function') {\n predicate = predicate(element, classToToggle);\n }\n if (typeof predicate !== 'boolean') {\n predicate = undefined;\n }\n classToToggle.split(/\\s+/).forEach(className => element.classList.toggle(className, predicate));\n return element;\n}\n\n/**\n * Apply attributes to an HTML element.\n *\n * @param {Element} el\n * Element to add attributes to.\n *\n * @param {Object} [attributes]\n * Attributes to be applied.\n */\nfunction setAttributes(el, attributes) {\n Object.getOwnPropertyNames(attributes).forEach(function (attrName) {\n const attrValue = attributes[attrName];\n if (attrValue === null || typeof attrValue === 'undefined' || attrValue === false) {\n el.removeAttribute(attrName);\n } else {\n el.setAttribute(attrName, attrValue === true ? '' : attrValue);\n }\n });\n}\n\n/**\n * Get an element's attribute values, as defined on the HTML tag.\n *\n * Attributes are not the same as properties. They're defined on the tag\n * or with setAttribute.\n *\n * @param {Element} tag\n * Element from which to get tag attributes.\n *\n * @return {Object}\n * All attributes of the element. Boolean attributes will be `true` or\n * `false`, others will be strings.\n */\nfunction getAttributes(tag) {\n const obj = {};\n\n // known boolean attributes\n // we can check for matching boolean properties, but not all browsers\n // and not all tags know about these attributes, so, we still want to check them manually\n const knownBooleans = ['autoplay', 'controls', 'playsinline', 'loop', 'muted', 'default', 'defaultMuted'];\n if (tag && tag.attributes && tag.attributes.length > 0) {\n const attrs = tag.attributes;\n for (let i = attrs.length - 1; i >= 0; i--) {\n const attrName = attrs[i].name;\n /** @type {boolean|string} */\n let attrVal = attrs[i].value;\n\n // check for known booleans\n // the matching element property will return a value for typeof\n if (knownBooleans.includes(attrName)) {\n // the value of an included boolean attribute is typically an empty\n // string ('') which would equal false if we just check for a false value.\n // we also don't want support bad code like autoplay='false'\n attrVal = attrVal !== null ? true : false;\n }\n obj[attrName] = attrVal;\n }\n }\n return obj;\n}\n\n/**\n * Get the value of an element's attribute.\n *\n * @param {Element} el\n * A DOM element.\n *\n * @param {string} attribute\n * Attribute to get the value of.\n *\n * @return {string}\n * The value of the attribute.\n */\nfunction getAttribute(el, attribute) {\n return el.getAttribute(attribute);\n}\n\n/**\n * Set the value of an element's attribute.\n *\n * @param {Element} el\n * A DOM element.\n *\n * @param {string} attribute\n * Attribute to set.\n *\n * @param {string} value\n * Value to set the attribute to.\n */\nfunction setAttribute(el, attribute, value) {\n el.setAttribute(attribute, value);\n}\n\n/**\n * Remove an element's attribute.\n *\n * @param {Element} el\n * A DOM element.\n *\n * @param {string} attribute\n * Attribute to remove.\n */\nfunction removeAttribute(el, attribute) {\n el.removeAttribute(attribute);\n}\n\n/**\n * Attempt to block the ability to select text.\n */\nfunction blockTextSelection() {\n global_document__WEBPACK_IMPORTED_MODULE_1___default().body.focus();\n (global_document__WEBPACK_IMPORTED_MODULE_1___default().onselectstart) = function () {\n return false;\n };\n}\n\n/**\n * Turn off text selection blocking.\n */\nfunction unblockTextSelection() {\n (global_document__WEBPACK_IMPORTED_MODULE_1___default().onselectstart) = function () {\n return true;\n };\n}\n\n/**\n * Identical to the native `getBoundingClientRect` function, but ensures that\n * the method is supported at all (it is in all browsers we claim to support)\n * and that the element is in the DOM before continuing.\n *\n * This wrapper function also shims properties which are not provided by some\n * older browsers (namely, IE8).\n *\n * Additionally, some browsers do not support adding properties to a\n * `ClientRect`/`DOMRect` object; so, we shallow-copy it with the standard\n * properties (except `x` and `y` which are not widely supported). This helps\n * avoid implementations where keys are non-enumerable.\n *\n * @param {Element} el\n * Element whose `ClientRect` we want to calculate.\n *\n * @return {Object|undefined}\n * Always returns a plain object - or `undefined` if it cannot.\n */\nfunction getBoundingClientRect(el) {\n if (el && el.getBoundingClientRect && el.parentNode) {\n const rect = el.getBoundingClientRect();\n const result = {};\n ['bottom', 'height', 'left', 'right', 'top', 'width'].forEach(k => {\n if (rect[k] !== undefined) {\n result[k] = rect[k];\n }\n });\n if (!result.height) {\n result.height = parseFloat(computedStyle(el, 'height'));\n }\n if (!result.width) {\n result.width = parseFloat(computedStyle(el, 'width'));\n }\n return result;\n }\n}\n\n/**\n * Represents the position of a DOM element on the page.\n *\n * @typedef {Object} module:dom~Position\n *\n * @property {number} left\n * Pixels to the left.\n *\n * @property {number} top\n * Pixels from the top.\n */\n\n/**\n * Get the position of an element in the DOM.\n *\n * Uses `getBoundingClientRect` technique from John Resig.\n *\n * @see http://ejohn.org/blog/getboundingclientrect-is-awesome/\n *\n * @param {Element} el\n * Element from which to get offset.\n *\n * @return {module:dom~Position}\n * The position of the element that was passed in.\n */\nfunction findPosition(el) {\n if (!el || el && !el.offsetParent) {\n return {\n left: 0,\n top: 0,\n width: 0,\n height: 0\n };\n }\n const width = el.offsetWidth;\n const height = el.offsetHeight;\n let left = 0;\n let top = 0;\n while (el.offsetParent && el !== (global_document__WEBPACK_IMPORTED_MODULE_1___default())[FullscreenApi.fullscreenElement]) {\n left += el.offsetLeft;\n top += el.offsetTop;\n el = el.offsetParent;\n }\n return {\n left,\n top,\n width,\n height\n };\n}\n\n/**\n * Represents x and y coordinates for a DOM element or mouse pointer.\n *\n * @typedef {Object} module:dom~Coordinates\n *\n * @property {number} x\n * x coordinate in pixels\n *\n * @property {number} y\n * y coordinate in pixels\n */\n\n/**\n * Get the pointer position within an element.\n *\n * The base on the coordinates are the bottom left of the element.\n *\n * @param {Element} el\n * Element on which to get the pointer position on.\n *\n * @param {Event} event\n * Event object.\n *\n * @return {module:dom~Coordinates}\n * A coordinates object corresponding to the mouse position.\n *\n */\nfunction getPointerPosition(el, event) {\n const translated = {\n x: 0,\n y: 0\n };\n if (IS_IOS) {\n let item = el;\n while (item && item.nodeName.toLowerCase() !== 'html') {\n const transform = computedStyle(item, 'transform');\n if (/^matrix/.test(transform)) {\n const values = transform.slice(7, -1).split(/,\\s/).map(Number);\n translated.x += values[4];\n translated.y += values[5];\n } else if (/^matrix3d/.test(transform)) {\n const values = transform.slice(9, -1).split(/,\\s/).map(Number);\n translated.x += values[12];\n translated.y += values[13];\n }\n item = item.parentNode;\n }\n }\n const position = {};\n const boxTarget = findPosition(event.target);\n const box = findPosition(el);\n const boxW = box.width;\n const boxH = box.height;\n let offsetY = event.offsetY - (box.top - boxTarget.top);\n let offsetX = event.offsetX - (box.left - boxTarget.left);\n if (event.changedTouches) {\n offsetX = event.changedTouches[0].pageX - box.left;\n offsetY = event.changedTouches[0].pageY + box.top;\n if (IS_IOS) {\n offsetX -= translated.x;\n offsetY -= translated.y;\n }\n }\n position.y = 1 - Math.max(0, Math.min(1, offsetY / boxH));\n position.x = Math.max(0, Math.min(1, offsetX / boxW));\n return position;\n}\n\n/**\n * Determines, via duck typing, whether or not a value is a text node.\n *\n * @param {*} value\n * Check if this value is a text node.\n *\n * @return {boolean}\n * Will be `true` if the value is a text node, `false` otherwise.\n */\nfunction isTextNode(value) {\n return isObject(value) && value.nodeType === 3;\n}\n\n/**\n * Empties the contents of an element.\n *\n * @param {Element} el\n * The element to empty children from\n *\n * @return {Element}\n * The element with no children\n */\nfunction emptyEl(el) {\n while (el.firstChild) {\n el.removeChild(el.firstChild);\n }\n return el;\n}\n\n/**\n * This is a mixed value that describes content to be injected into the DOM\n * via some method. It can be of the following types:\n *\n * Type | Description\n * -----------|-------------\n * `string` | The value will be normalized into a text node.\n * `Element` | The value will be accepted as-is.\n * `Text` | A TextNode. The value will be accepted as-is.\n * `Array` | A one-dimensional array of strings, elements, text nodes, or functions. These functions should return a string, element, or text node (any other return value, like an array, will be ignored).\n * `Function` | A function, which is expected to return a string, element, text node, or array - any of the other possible values described above. This means that a content descriptor could be a function that returns an array of functions, but those second-level functions must return strings, elements, or text nodes.\n *\n * @typedef {string|Element|Text|Array|Function} ContentDescriptor\n */\n\n/**\n * Normalizes content for eventual insertion into the DOM.\n *\n * This allows a wide range of content definition methods, but helps protect\n * from falling into the trap of simply writing to `innerHTML`, which could\n * be an XSS concern.\n *\n * The content for an element can be passed in multiple types and\n * combinations, whose behavior is as follows:\n *\n * @param {ContentDescriptor} content\n * A content descriptor value.\n *\n * @return {Array}\n * All of the content that was passed in, normalized to an array of\n * elements or text nodes.\n */\nfunction normalizeContent(content) {\n // First, invoke content if it is a function. If it produces an array,\n // that needs to happen before normalization.\n if (typeof content === 'function') {\n content = content();\n }\n\n // Next up, normalize to an array, so one or many items can be normalized,\n // filtered, and returned.\n return (Array.isArray(content) ? content : [content]).map(value => {\n // First, invoke value if it is a function to produce a new value,\n // which will be subsequently normalized to a Node of some kind.\n if (typeof value === 'function') {\n value = value();\n }\n if (isEl(value) || isTextNode(value)) {\n return value;\n }\n if (typeof value === 'string' && /\\S/.test(value)) {\n return global_document__WEBPACK_IMPORTED_MODULE_1___default().createTextNode(value);\n }\n }).filter(value => value);\n}\n\n/**\n * Normalizes and appends content to an element.\n *\n * @param {Element} el\n * Element to append normalized content to.\n *\n * @param {ContentDescriptor} content\n * A content descriptor value.\n *\n * @return {Element}\n * The element with appended normalized content.\n */\nfunction appendContent(el, content) {\n normalizeContent(content).forEach(node => el.appendChild(node));\n return el;\n}\n\n/**\n * Normalizes and inserts content into an element; this is identical to\n * `appendContent()`, except it empties the element first.\n *\n * @param {Element} el\n * Element to insert normalized content into.\n *\n * @param {ContentDescriptor} content\n * A content descriptor value.\n *\n * @return {Element}\n * The element with inserted normalized content.\n */\nfunction insertContent(el, content) {\n return appendContent(emptyEl(el), content);\n}\n\n/**\n * Check if an event was a single left click.\n *\n * @param {MouseEvent} event\n * Event object.\n *\n * @return {boolean}\n * Will be `true` if a single left click, `false` otherwise.\n */\nfunction isSingleLeftClick(event) {\n // Note: if you create something draggable, be sure to\n // call it on both `mousedown` and `mousemove` event,\n // otherwise `mousedown` should be enough for a button\n\n if (event.button === undefined && event.buttons === undefined) {\n // Why do we need `buttons` ?\n // Because, middle mouse sometimes have this:\n // e.button === 0 and e.buttons === 4\n // Furthermore, we want to prevent combination click, something like\n // HOLD middlemouse then left click, that would be\n // e.button === 0, e.buttons === 5\n // just `button` is not gonna work\n\n // Alright, then what this block does ?\n // this is for chrome `simulate mobile devices`\n // I want to support this as well\n\n return true;\n }\n if (event.button === 0 && event.buttons === undefined) {\n // Touch screen, sometimes on some specific device, `buttons`\n // doesn't have anything (safari on ios, blackberry...)\n\n return true;\n }\n\n // `mouseup` event on a single left click has\n // `button` and `buttons` equal to 0\n if (event.type === 'mouseup' && event.button === 0 && event.buttons === 0) {\n return true;\n }\n if (event.button !== 0 || event.buttons !== 1) {\n // This is the reason we have those if else block above\n // if any special case we can catch and let it slide\n // we do it above, when get to here, this definitely\n // is-not-left-click\n\n return false;\n }\n return true;\n}\n\n/**\n * Finds a single DOM element matching `selector` within the optional\n * `context` of another DOM element (defaulting to `document`).\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelector`.\n *\n * @param {Element|String} [context=document]\n * A DOM element within which to query. Can also be a selector\n * string in which case the first matching element will be used\n * as context. If missing (or no element matches selector), falls\n * back to `document`.\n *\n * @return {Element|null}\n * The element that was found or null.\n */\nconst $ = createQuerier('querySelector');\n\n/**\n * Finds a all DOM elements matching `selector` within the optional\n * `context` of another DOM element (defaulting to `document`).\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelectorAll`.\n *\n * @param {Element|String} [context=document]\n * A DOM element within which to query. Can also be a selector\n * string in which case the first matching element will be used\n * as context. If missing (or no element matches selector), falls\n * back to `document`.\n *\n * @return {NodeList}\n * A element list of elements that were found. Will be empty if none\n * were found.\n *\n */\nconst $$ = createQuerier('querySelectorAll');\n\n/**\n * A safe getComputedStyle.\n *\n * This is needed because in Firefox, if the player is loaded in an iframe with\n * `display:none`, then `getComputedStyle` returns `null`, so, we do a\n * null-check to make sure that the player doesn't break in these cases.\n *\n * @param {Element} el\n * The element you want the computed style of\n *\n * @param {string} prop\n * The property name you want\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397\n */\nfunction computedStyle(el, prop) {\n if (!el || !prop) {\n return '';\n }\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().getComputedStyle) === 'function') {\n let computedStyleValue;\n try {\n computedStyleValue = global_window__WEBPACK_IMPORTED_MODULE_0___default().getComputedStyle(el);\n } catch (e) {\n return '';\n }\n return computedStyleValue ? computedStyleValue.getPropertyValue(prop) || computedStyleValue[prop] : '';\n }\n return '';\n}\n\n/**\n * Copy document style sheets to another window.\n *\n * @param {Window} win\n * The window element you want to copy the document style sheets to.\n *\n */\nfunction copyStyleSheetsToWindow(win) {\n [...(global_document__WEBPACK_IMPORTED_MODULE_1___default().styleSheets)].forEach(styleSheet => {\n try {\n const cssRules = [...styleSheet.cssRules].map(rule => rule.cssText).join('');\n const style = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('style');\n style.textContent = cssRules;\n win.document.head.appendChild(style);\n } catch (e) {\n const link = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('link');\n link.rel = 'stylesheet';\n link.type = styleSheet.type;\n // For older Safari this has to be the string; on other browsers setting the MediaList works\n link.media = styleSheet.media.mediaText;\n link.href = styleSheet.href;\n win.document.head.appendChild(link);\n }\n });\n}\n\nvar Dom = /*#__PURE__*/Object.freeze({\n __proto__: null,\n isReal: isReal,\n isEl: isEl,\n isInFrame: isInFrame,\n createEl: createEl,\n textContent: textContent,\n prependTo: prependTo,\n hasClass: hasClass,\n addClass: addClass,\n removeClass: removeClass,\n toggleClass: toggleClass,\n setAttributes: setAttributes,\n getAttributes: getAttributes,\n getAttribute: getAttribute,\n setAttribute: setAttribute,\n removeAttribute: removeAttribute,\n blockTextSelection: blockTextSelection,\n unblockTextSelection: unblockTextSelection,\n getBoundingClientRect: getBoundingClientRect,\n findPosition: findPosition,\n getPointerPosition: getPointerPosition,\n isTextNode: isTextNode,\n emptyEl: emptyEl,\n normalizeContent: normalizeContent,\n appendContent: appendContent,\n insertContent: insertContent,\n isSingleLeftClick: isSingleLeftClick,\n $: $,\n $$: $$,\n computedStyle: computedStyle,\n copyStyleSheetsToWindow: copyStyleSheetsToWindow\n});\n\n/**\n * @file setup.js - Functions for setting up a player without\n * user interaction based on the data-setup `attribute` of the video tag.\n *\n * @module setup\n */\nlet _windowLoaded = false;\nlet videojs$1;\n\n/**\n * Set up any tags that have a data-setup `attribute` when the player is started.\n */\nconst autoSetup = function () {\n if (videojs$1.options.autoSetup === false) {\n return;\n }\n const vids = Array.prototype.slice.call(global_document__WEBPACK_IMPORTED_MODULE_1___default().getElementsByTagName('video'));\n const audios = Array.prototype.slice.call(global_document__WEBPACK_IMPORTED_MODULE_1___default().getElementsByTagName('audio'));\n const divs = Array.prototype.slice.call(global_document__WEBPACK_IMPORTED_MODULE_1___default().getElementsByTagName('video-js'));\n const mediaEls = vids.concat(audios, divs);\n\n // Check if any media elements exist\n if (mediaEls && mediaEls.length > 0) {\n for (let i = 0, e = mediaEls.length; i < e; i++) {\n const mediaEl = mediaEls[i];\n\n // Check if element exists, has getAttribute func.\n if (mediaEl && mediaEl.getAttribute) {\n // Make sure this player hasn't already been set up.\n if (mediaEl.player === undefined) {\n const options = mediaEl.getAttribute('data-setup');\n\n // Check if data-setup attr exists.\n // We only auto-setup if they've added the data-setup attr.\n if (options !== null) {\n // Create new video.js instance.\n videojs$1(mediaEl);\n }\n }\n\n // If getAttribute isn't defined, we need to wait for the DOM.\n } else {\n autoSetupTimeout(1);\n break;\n }\n }\n\n // No videos were found, so keep looping unless page is finished loading.\n } else if (!_windowLoaded) {\n autoSetupTimeout(1);\n }\n};\n\n/**\n * Wait until the page is loaded before running autoSetup. This will be called in\n * autoSetup if `hasLoaded` returns false.\n *\n * @param {number} wait\n * How long to wait in ms\n *\n * @param {module:videojs} [vjs]\n * The videojs library function\n */\nfunction autoSetupTimeout(wait, vjs) {\n // Protect against breakage in non-browser environments\n if (!isReal()) {\n return;\n }\n if (vjs) {\n videojs$1 = vjs;\n }\n global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(autoSetup, wait);\n}\n\n/**\n * Used to set the internal tracking of window loaded state to true.\n *\n * @private\n */\nfunction setWindowLoaded() {\n _windowLoaded = true;\n global_window__WEBPACK_IMPORTED_MODULE_0___default().removeEventListener('load', setWindowLoaded);\n}\nif (isReal()) {\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default().readyState) === 'complete') {\n setWindowLoaded();\n } else {\n /**\n * Listen for the load event on window, and set _windowLoaded to true.\n *\n * We use a standard event listener here to avoid incrementing the GUID\n * before any players are created.\n *\n * @listens load\n */\n global_window__WEBPACK_IMPORTED_MODULE_0___default().addEventListener('load', setWindowLoaded);\n }\n}\n\n/**\n * @file stylesheet.js\n * @module stylesheet\n */\n\n/**\n * Create a DOM style element given a className for it.\n *\n * @param {string} className\n * The className to add to the created style element.\n *\n * @return {Element}\n * The element that was created.\n */\nconst createStyleElement = function (className) {\n const style = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('style');\n style.className = className;\n return style;\n};\n\n/**\n * Add text to a DOM element.\n *\n * @param {Element} el\n * The Element to add text content to.\n *\n * @param {string} content\n * The text to add to the element.\n */\nconst setTextContent = function (el, content) {\n if (el.styleSheet) {\n el.styleSheet.cssText = content;\n } else {\n el.textContent = content;\n }\n};\n\n/**\n * @file dom-data.js\n * @module dom-data\n */\n\n/**\n * Element Data Store.\n *\n * Allows for binding data to an element without putting it directly on the\n * element. Ex. Event listeners are stored here.\n * (also from jsninja.com, slightly modified and updated for closure compiler)\n *\n * @type {Object}\n * @private\n */\nvar DomData = new WeakMap();\n\n/**\n * @file guid.js\n * @module guid\n */\n\n// Default value for GUIDs. This allows us to reset the GUID counter in tests.\n//\n// The initial GUID is 3 because some users have come to rely on the first\n// default player ID ending up as `vjs_video_3`.\n//\n// See: https://github.com/videojs/video.js/pull/6216\nconst _initialGuid = 3;\n\n/**\n * Unique ID for an element or function\n *\n * @type {Number}\n */\nlet _guid = _initialGuid;\n\n/**\n * Get a unique auto-incrementing ID by number that has not been returned before.\n *\n * @return {number}\n * A new unique ID.\n */\nfunction newGUID() {\n return _guid++;\n}\n\n/**\n * @file events.js. An Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/)\n * (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible)\n * This should work very similarly to jQuery's events, however it's based off the book version which isn't as\n * robust as jquery's, so there's probably some differences.\n *\n * @file events.js\n * @module events\n */\n\n/**\n * Clean up the listener cache and dispatchers\n *\n * @param {Element|Object} elem\n * Element to clean up\n *\n * @param {string} type\n * Type of event to clean up\n */\nfunction _cleanUpEvents(elem, type) {\n if (!DomData.has(elem)) {\n return;\n }\n const data = DomData.get(elem);\n\n // Remove the events of a particular type if there are none left\n if (data.handlers[type].length === 0) {\n delete data.handlers[type];\n // data.handlers[type] = null;\n // Setting to null was causing an error with data.handlers\n\n // Remove the meta-handler from the element\n if (elem.removeEventListener) {\n elem.removeEventListener(type, data.dispatcher, false);\n } else if (elem.detachEvent) {\n elem.detachEvent('on' + type, data.dispatcher);\n }\n }\n\n // Remove the events object if there are no types left\n if (Object.getOwnPropertyNames(data.handlers).length <= 0) {\n delete data.handlers;\n delete data.dispatcher;\n delete data.disabled;\n }\n\n // Finally remove the element data if there is no data left\n if (Object.getOwnPropertyNames(data).length === 0) {\n DomData.delete(elem);\n }\n}\n\n/**\n * Loops through an array of event types and calls the requested method for each type.\n *\n * @param {Function} fn\n * The event method we want to use.\n *\n * @param {Element|Object} elem\n * Element or object to bind listeners to\n *\n * @param {string[]} types\n * Type of event to bind to.\n *\n * @param {Function} callback\n * Event listener.\n */\nfunction _handleMultipleEvents(fn, elem, types, callback) {\n types.forEach(function (type) {\n // Call the event method for each one of the types\n fn(elem, type, callback);\n });\n}\n\n/**\n * Fix a native event to have standard property values\n *\n * @param {Object} event\n * Event object to fix.\n *\n * @return {Object}\n * Fixed event object.\n */\nfunction fixEvent(event) {\n if (event.fixed_) {\n return event;\n }\n function returnTrue() {\n return true;\n }\n function returnFalse() {\n return false;\n }\n\n // Test if fixing up is needed\n // Used to check if !event.stopPropagation instead of isPropagationStopped\n // But native events return true for stopPropagation, but don't have\n // other expected methods like isPropagationStopped. Seems to be a problem\n // with the Javascript Ninja code. So we're just overriding all events now.\n if (!event || !event.isPropagationStopped || !event.isImmediatePropagationStopped) {\n const old = event || (global_window__WEBPACK_IMPORTED_MODULE_0___default().event);\n event = {};\n // Clone the old object so that we can modify the values event = {};\n // IE8 Doesn't like when you mess with native event properties\n // Firefox returns false for event.hasOwnProperty('type') and other props\n // which makes copying more difficult.\n // TODO: Probably best to create a whitelist of event props\n for (const key in old) {\n // Safari 6.0.3 warns you if you try to copy deprecated layerX/Y\n // Chrome warns you if you try to copy deprecated keyboardEvent.keyLocation\n // and webkitMovementX/Y\n // Lighthouse complains if Event.path is copied\n if (key !== 'layerX' && key !== 'layerY' && key !== 'keyLocation' && key !== 'webkitMovementX' && key !== 'webkitMovementY' && key !== 'path') {\n // Chrome 32+ warns if you try to copy deprecated returnValue, but\n // we still want to if preventDefault isn't supported (IE8).\n if (!(key === 'returnValue' && old.preventDefault)) {\n event[key] = old[key];\n }\n }\n }\n\n // The event occurred on this element\n if (!event.target) {\n event.target = event.srcElement || (global_document__WEBPACK_IMPORTED_MODULE_1___default());\n }\n\n // Handle which other element the event is related to\n if (!event.relatedTarget) {\n event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;\n }\n\n // Stop the default browser action\n event.preventDefault = function () {\n if (old.preventDefault) {\n old.preventDefault();\n }\n event.returnValue = false;\n old.returnValue = false;\n event.defaultPrevented = true;\n };\n event.defaultPrevented = false;\n\n // Stop the event from bubbling\n event.stopPropagation = function () {\n if (old.stopPropagation) {\n old.stopPropagation();\n }\n event.cancelBubble = true;\n old.cancelBubble = true;\n event.isPropagationStopped = returnTrue;\n };\n event.isPropagationStopped = returnFalse;\n\n // Stop the event from bubbling and executing other handlers\n event.stopImmediatePropagation = function () {\n if (old.stopImmediatePropagation) {\n old.stopImmediatePropagation();\n }\n event.isImmediatePropagationStopped = returnTrue;\n event.stopPropagation();\n };\n event.isImmediatePropagationStopped = returnFalse;\n\n // Handle mouse position\n if (event.clientX !== null && event.clientX !== undefined) {\n const doc = (global_document__WEBPACK_IMPORTED_MODULE_1___default().documentElement);\n const body = (global_document__WEBPACK_IMPORTED_MODULE_1___default().body);\n event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);\n event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);\n }\n\n // Handle key presses\n event.which = event.charCode || event.keyCode;\n\n // Fix button for mouse clicks:\n // 0 == left; 1 == middle; 2 == right\n if (event.button !== null && event.button !== undefined) {\n // The following is disabled because it does not pass videojs-standard\n // and... yikes.\n /* eslint-disable */\n event.button = event.button & 1 ? 0 : event.button & 4 ? 1 : event.button & 2 ? 2 : 0;\n /* eslint-enable */\n }\n }\n\n event.fixed_ = true;\n // Returns fixed-up instance\n return event;\n}\n\n/**\n * Whether passive event listeners are supported\n */\nlet _supportsPassive;\nconst supportsPassive = function () {\n if (typeof _supportsPassive !== 'boolean') {\n _supportsPassive = false;\n try {\n const opts = Object.defineProperty({}, 'passive', {\n get() {\n _supportsPassive = true;\n }\n });\n global_window__WEBPACK_IMPORTED_MODULE_0___default().addEventListener('test', null, opts);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().removeEventListener('test', null, opts);\n } catch (e) {\n // disregard\n }\n }\n return _supportsPassive;\n};\n\n/**\n * Touch events Chrome expects to be passive\n */\nconst passiveEvents = ['touchstart', 'touchmove'];\n\n/**\n * Add an event listener to element\n * It stores the handler function in a separate cache object\n * and adds a generic handler to the element's event,\n * along with a unique id (guid) to the element.\n *\n * @param {Element|Object} elem\n * Element or object to bind listeners to\n *\n * @param {string|string[]} type\n * Type of event to bind to.\n *\n * @param {Function} fn\n * Event listener.\n */\nfunction on(elem, type, fn) {\n if (Array.isArray(type)) {\n return _handleMultipleEvents(on, elem, type, fn);\n }\n if (!DomData.has(elem)) {\n DomData.set(elem, {});\n }\n const data = DomData.get(elem);\n\n // We need a place to store all our handler data\n if (!data.handlers) {\n data.handlers = {};\n }\n if (!data.handlers[type]) {\n data.handlers[type] = [];\n }\n if (!fn.guid) {\n fn.guid = newGUID();\n }\n data.handlers[type].push(fn);\n if (!data.dispatcher) {\n data.disabled = false;\n data.dispatcher = function (event, hash) {\n if (data.disabled) {\n return;\n }\n event = fixEvent(event);\n const handlers = data.handlers[event.type];\n if (handlers) {\n // Copy handlers so if handlers are added/removed during the process it doesn't throw everything off.\n const handlersCopy = handlers.slice(0);\n for (let m = 0, n = handlersCopy.length; m < n; m++) {\n if (event.isImmediatePropagationStopped()) {\n break;\n } else {\n try {\n handlersCopy[m].call(elem, event, hash);\n } catch (e) {\n log$1.error(e);\n }\n }\n }\n }\n };\n }\n if (data.handlers[type].length === 1) {\n if (elem.addEventListener) {\n let options = false;\n if (supportsPassive() && passiveEvents.indexOf(type) > -1) {\n options = {\n passive: true\n };\n }\n elem.addEventListener(type, data.dispatcher, options);\n } else if (elem.attachEvent) {\n elem.attachEvent('on' + type, data.dispatcher);\n }\n }\n}\n\n/**\n * Removes event listeners from an element\n *\n * @param {Element|Object} elem\n * Object to remove listeners from.\n *\n * @param {string|string[]} [type]\n * Type of listener to remove. Don't include to remove all events from element.\n *\n * @param {Function} [fn]\n * Specific listener to remove. Don't include to remove listeners for an event\n * type.\n */\nfunction off(elem, type, fn) {\n // Don't want to add a cache object through getElData if not needed\n if (!DomData.has(elem)) {\n return;\n }\n const data = DomData.get(elem);\n\n // If no events exist, nothing to unbind\n if (!data.handlers) {\n return;\n }\n if (Array.isArray(type)) {\n return _handleMultipleEvents(off, elem, type, fn);\n }\n\n // Utility function\n const removeType = function (el, t) {\n data.handlers[t] = [];\n _cleanUpEvents(el, t);\n };\n\n // Are we removing all bound events?\n if (type === undefined) {\n for (const t in data.handlers) {\n if (Object.prototype.hasOwnProperty.call(data.handlers || {}, t)) {\n removeType(elem, t);\n }\n }\n return;\n }\n const handlers = data.handlers[type];\n\n // If no handlers exist, nothing to unbind\n if (!handlers) {\n return;\n }\n\n // If no listener was provided, remove all listeners for type\n if (!fn) {\n removeType(elem, type);\n return;\n }\n\n // We're only removing a single handler\n if (fn.guid) {\n for (let n = 0; n < handlers.length; n++) {\n if (handlers[n].guid === fn.guid) {\n handlers.splice(n--, 1);\n }\n }\n }\n _cleanUpEvents(elem, type);\n}\n\n/**\n * Trigger an event for an element\n *\n * @param {Element|Object} elem\n * Element to trigger an event on\n *\n * @param {EventTarget~Event|string} event\n * A string (the type) or an event object with a type attribute\n *\n * @param {Object} [hash]\n * data hash to pass along with the event\n *\n * @return {boolean|undefined}\n * Returns the opposite of `defaultPrevented` if default was\n * prevented. Otherwise, returns `undefined`\n */\nfunction trigger(elem, event, hash) {\n // Fetches element data and a reference to the parent (for bubbling).\n // Don't want to add a data object to cache for every parent,\n // so checking hasElData first.\n const elemData = DomData.has(elem) ? DomData.get(elem) : {};\n const parent = elem.parentNode || elem.ownerDocument;\n // type = event.type || event,\n // handler;\n\n // If an event name was passed as a string, creates an event out of it\n if (typeof event === 'string') {\n event = {\n type: event,\n target: elem\n };\n } else if (!event.target) {\n event.target = elem;\n }\n\n // Normalizes the event properties.\n event = fixEvent(event);\n\n // If the passed element has a dispatcher, executes the established handlers.\n if (elemData.dispatcher) {\n elemData.dispatcher.call(elem, event, hash);\n }\n\n // Unless explicitly stopped or the event does not bubble (e.g. media events)\n // recursively calls this function to bubble the event up the DOM.\n if (parent && !event.isPropagationStopped() && event.bubbles === true) {\n trigger.call(null, parent, event, hash);\n\n // If at the top of the DOM, triggers the default action unless disabled.\n } else if (!parent && !event.defaultPrevented && event.target && event.target[event.type]) {\n if (!DomData.has(event.target)) {\n DomData.set(event.target, {});\n }\n const targetData = DomData.get(event.target);\n\n // Checks if the target has a default action for this event.\n if (event.target[event.type]) {\n // Temporarily disables event dispatching on the target as we have already executed the handler.\n targetData.disabled = true;\n // Executes the default action.\n if (typeof event.target[event.type] === 'function') {\n event.target[event.type]();\n }\n // Re-enables event dispatching.\n targetData.disabled = false;\n }\n }\n\n // Inform the triggerer if the default was prevented by returning false\n return !event.defaultPrevented;\n}\n\n/**\n * Trigger a listener only once for an event.\n *\n * @param {Element|Object} elem\n * Element or object to bind to.\n *\n * @param {string|string[]} type\n * Name/type of event\n *\n * @param {Event~EventListener} fn\n * Event listener function\n */\nfunction one(elem, type, fn) {\n if (Array.isArray(type)) {\n return _handleMultipleEvents(one, elem, type, fn);\n }\n const func = function () {\n off(elem, type, func);\n fn.apply(this, arguments);\n };\n\n // copy the guid to the new function so it can removed using the original function's ID\n func.guid = fn.guid = fn.guid || newGUID();\n on(elem, type, func);\n}\n\n/**\n * Trigger a listener only once and then turn if off for all\n * configured events\n *\n * @param {Element|Object} elem\n * Element or object to bind to.\n *\n * @param {string|string[]} type\n * Name/type of event\n *\n * @param {Event~EventListener} fn\n * Event listener function\n */\nfunction any(elem, type, fn) {\n const func = function () {\n off(elem, type, func);\n fn.apply(this, arguments);\n };\n\n // copy the guid to the new function so it can removed using the original function's ID\n func.guid = fn.guid = fn.guid || newGUID();\n\n // multiple ons, but one off for everything\n on(elem, type, func);\n}\n\nvar Events = /*#__PURE__*/Object.freeze({\n __proto__: null,\n fixEvent: fixEvent,\n on: on,\n off: off,\n trigger: trigger,\n one: one,\n any: any\n});\n\n/**\n * @file fn.js\n * @module fn\n */\nconst UPDATE_REFRESH_INTERVAL = 30;\n\n/**\n * A private, internal-only function for changing the context of a function.\n *\n * It also stores a unique id on the function so it can be easily removed from\n * events.\n *\n * @private\n * @function\n * @param {*} context\n * The object to bind as scope.\n *\n * @param {Function} fn\n * The function to be bound to a scope.\n *\n * @param {number} [uid]\n * An optional unique ID for the function to be set\n *\n * @return {Function}\n * The new function that will be bound into the context given\n */\nconst bind_ = function (context, fn, uid) {\n // Make sure the function has a unique ID\n if (!fn.guid) {\n fn.guid = newGUID();\n }\n\n // Create the new function that changes the context\n const bound = fn.bind(context);\n\n // Allow for the ability to individualize this function\n // Needed in the case where multiple objects might share the same prototype\n // IF both items add an event listener with the same function, then you try to remove just one\n // it will remove both because they both have the same guid.\n // when using this, you need to use the bind method when you remove the listener as well.\n // currently used in text tracks\n bound.guid = uid ? uid + '_' + fn.guid : fn.guid;\n return bound;\n};\n\n/**\n * Wraps the given function, `fn`, with a new function that only invokes `fn`\n * at most once per every `wait` milliseconds.\n *\n * @function\n * @param {Function} fn\n * The function to be throttled.\n *\n * @param {number} wait\n * The number of milliseconds by which to throttle.\n *\n * @return {Function}\n */\nconst throttle = function (fn, wait) {\n let last = global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now();\n const throttled = function (...args) {\n const now = global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now();\n if (now - last >= wait) {\n fn(...args);\n last = now;\n }\n };\n return throttled;\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked.\n *\n * Inspired by lodash and underscore implementations.\n *\n * @function\n * @param {Function} func\n * The function to wrap with debounce behavior.\n *\n * @param {number} wait\n * The number of milliseconds to wait after the last invocation.\n *\n * @param {boolean} [immediate]\n * Whether or not to invoke the function immediately upon creation.\n *\n * @param {Object} [context=window]\n * The \"context\" in which the debounced function should debounce. For\n * example, if this function should be tied to a Video.js player,\n * the player can be passed here. Alternatively, defaults to the\n * global `window` object.\n *\n * @return {Function}\n * A debounced function.\n */\nconst debounce = function (func, wait, immediate, context = (global_window__WEBPACK_IMPORTED_MODULE_0___default())) {\n let timeout;\n const cancel = () => {\n context.clearTimeout(timeout);\n timeout = null;\n };\n\n /* eslint-disable consistent-this */\n const debounced = function () {\n const self = this;\n const args = arguments;\n let later = function () {\n timeout = null;\n later = null;\n if (!immediate) {\n func.apply(self, args);\n }\n };\n if (!timeout && immediate) {\n func.apply(self, args);\n }\n context.clearTimeout(timeout);\n timeout = context.setTimeout(later, wait);\n };\n /* eslint-enable consistent-this */\n\n debounced.cancel = cancel;\n return debounced;\n};\n\nvar Fn = /*#__PURE__*/Object.freeze({\n __proto__: null,\n UPDATE_REFRESH_INTERVAL: UPDATE_REFRESH_INTERVAL,\n bind_: bind_,\n throttle: throttle,\n debounce: debounce\n});\n\n/**\n * @file src/js/event-target.js\n */\nlet EVENT_MAP;\n\n/**\n * `EventTarget` is a class that can have the same API as the DOM `EventTarget`. It\n * adds shorthand functions that wrap around lengthy functions. For example:\n * the `on` function is a wrapper around `addEventListener`.\n *\n * @see [EventTarget Spec]{@link https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget}\n * @class EventTarget\n */\nclass EventTarget$2 {\n /**\n * Adds an `event listener` to an instance of an `EventTarget`. An `event listener` is a\n * function that will get called when an event with a certain name gets triggered.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {Function} fn\n * The function to call with `EventTarget`s\n */\n on(type, fn) {\n // Remove the addEventListener alias before calling Events.on\n // so we don't get into an infinite type loop\n const ael = this.addEventListener;\n this.addEventListener = () => {};\n on(this, type, fn);\n this.addEventListener = ael;\n }\n /**\n * Removes an `event listener` for a specific event from an instance of `EventTarget`.\n * This makes it so that the `event listener` will no longer get called when the\n * named event happens.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {Function} fn\n * The function to remove.\n */\n off(type, fn) {\n off(this, type, fn);\n }\n /**\n * This function will add an `event listener` that gets triggered only once. After the\n * first trigger it will get removed. This is like adding an `event listener`\n * with {@link EventTarget#on} that calls {@link EventTarget#off} on itself.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {Function} fn\n * The function to be called once for each event name.\n */\n one(type, fn) {\n // Remove the addEventListener aliasing Events.on\n // so we don't get into an infinite type loop\n const ael = this.addEventListener;\n this.addEventListener = () => {};\n one(this, type, fn);\n this.addEventListener = ael;\n }\n /**\n * This function will add an `event listener` that gets triggered only once and is\n * removed from all events. This is like adding an array of `event listener`s\n * with {@link EventTarget#on} that calls {@link EventTarget#off} on all events the\n * first time it is triggered.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {Function} fn\n * The function to be called once for each event name.\n */\n any(type, fn) {\n // Remove the addEventListener aliasing Events.on\n // so we don't get into an infinite type loop\n const ael = this.addEventListener;\n this.addEventListener = () => {};\n any(this, type, fn);\n this.addEventListener = ael;\n }\n /**\n * This function causes an event to happen. This will then cause any `event listeners`\n * that are waiting for that event, to get called. If there are no `event listeners`\n * for an event then nothing will happen.\n *\n * If the name of the `Event` that is being triggered is in `EventTarget.allowedEvents_`.\n * Trigger will also call the `on` + `uppercaseEventName` function.\n *\n * Example:\n * 'click' is in `EventTarget.allowedEvents_`, so, trigger will attempt to call\n * `onClick` if it exists.\n *\n * @param {string|EventTarget~Event|Object} event\n * The name of the event, an `Event`, or an object with a key of type set to\n * an event name.\n */\n trigger(event) {\n const type = event.type || event;\n\n // deprecation\n // In a future version we should default target to `this`\n // similar to how we default the target to `elem` in\n // `Events.trigger`. Right now the default `target` will be\n // `document` due to the `Event.fixEvent` call.\n if (typeof event === 'string') {\n event = {\n type\n };\n }\n event = fixEvent(event);\n if (this.allowedEvents_[type] && this['on' + type]) {\n this['on' + type](event);\n }\n trigger(this, event);\n }\n queueTrigger(event) {\n // only set up EVENT_MAP if it'll be used\n if (!EVENT_MAP) {\n EVENT_MAP = new Map();\n }\n const type = event.type || event;\n let map = EVENT_MAP.get(this);\n if (!map) {\n map = new Map();\n EVENT_MAP.set(this, map);\n }\n const oldTimeout = map.get(type);\n map.delete(type);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(oldTimeout);\n const timeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => {\n map.delete(type);\n // if we cleared out all timeouts for the current target, delete its map\n if (map.size === 0) {\n map = null;\n EVENT_MAP.delete(this);\n }\n this.trigger(event);\n }, 0);\n map.set(type, timeout);\n }\n}\n\n/**\n * A Custom DOM event.\n *\n * @typedef {CustomEvent} Event\n * @see [Properties]{@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent}\n */\n\n/**\n * All event listeners should follow the following format.\n *\n * @callback EventListener\n * @this {EventTarget}\n *\n * @param {Event} event\n * the event that triggered this function\n *\n * @param {Object} [hash]\n * hash of data sent during the event\n */\n\n/**\n * An object containing event names as keys and booleans as values.\n *\n * > NOTE: If an event name is set to a true value here {@link EventTarget#trigger}\n * will have extra functionality. See that function for more information.\n *\n * @property EventTarget.prototype.allowedEvents_\n * @protected\n */\nEventTarget$2.prototype.allowedEvents_ = {};\n\n/**\n * An alias of {@link EventTarget#on}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#on}\n */\nEventTarget$2.prototype.addEventListener = EventTarget$2.prototype.on;\n\n/**\n * An alias of {@link EventTarget#off}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#off}\n */\nEventTarget$2.prototype.removeEventListener = EventTarget$2.prototype.off;\n\n/**\n * An alias of {@link EventTarget#trigger}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#trigger}\n */\nEventTarget$2.prototype.dispatchEvent = EventTarget$2.prototype.trigger;\n\n/**\n * @file mixins/evented.js\n * @module evented\n */\nconst objName = obj => {\n if (typeof obj.name === 'function') {\n return obj.name();\n }\n if (typeof obj.name === 'string') {\n return obj.name;\n }\n if (obj.name_) {\n return obj.name_;\n }\n if (obj.constructor && obj.constructor.name) {\n return obj.constructor.name;\n }\n return typeof obj;\n};\n\n/**\n * Returns whether or not an object has had the evented mixin applied.\n *\n * @param {Object} object\n * An object to test.\n *\n * @return {boolean}\n * Whether or not the object appears to be evented.\n */\nconst isEvented = object => object instanceof EventTarget$2 || !!object.eventBusEl_ && ['on', 'one', 'off', 'trigger'].every(k => typeof object[k] === 'function');\n\n/**\n * Adds a callback to run after the evented mixin applied.\n *\n * @param {Object} target\n * An object to Add\n * @param {Function} callback\n * The callback to run.\n */\nconst addEventedCallback = (target, callback) => {\n if (isEvented(target)) {\n callback();\n } else {\n if (!target.eventedCallbacks) {\n target.eventedCallbacks = [];\n }\n target.eventedCallbacks.push(callback);\n }\n};\n\n/**\n * Whether a value is a valid event type - non-empty string or array.\n *\n * @private\n * @param {string|Array} type\n * The type value to test.\n *\n * @return {boolean}\n * Whether or not the type is a valid event type.\n */\nconst isValidEventType = type =>\n// The regex here verifies that the `type` contains at least one non-\n// whitespace character.\ntypeof type === 'string' && /\\S/.test(type) || Array.isArray(type) && !!type.length;\n\n/**\n * Validates a value to determine if it is a valid event target. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the target does not appear to be a valid event target.\n *\n * @param {Object} target\n * The object to test.\n *\n * @param {Object} obj\n * The evented object we are validating for\n *\n * @param {string} fnName\n * The name of the evented mixin function that called this.\n */\nconst validateTarget = (target, obj, fnName) => {\n if (!target || !target.nodeName && !isEvented(target)) {\n throw new Error(`Invalid target for ${objName(obj)}#${fnName}; must be a DOM node or evented object.`);\n }\n};\n\n/**\n * Validates a value to determine if it is a valid event target. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the type does not appear to be a valid event type.\n *\n * @param {string|Array} type\n * The type to test.\n *\n * @param {Object} obj\n* The evented object we are validating for\n *\n * @param {string} fnName\n * The name of the evented mixin function that called this.\n */\nconst validateEventType = (type, obj, fnName) => {\n if (!isValidEventType(type)) {\n throw new Error(`Invalid event type for ${objName(obj)}#${fnName}; must be a non-empty string or array.`);\n }\n};\n\n/**\n * Validates a value to determine if it is a valid listener. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the listener is not a function.\n *\n * @param {Function} listener\n * The listener to test.\n *\n * @param {Object} obj\n * The evented object we are validating for\n *\n * @param {string} fnName\n * The name of the evented mixin function that called this.\n */\nconst validateListener = (listener, obj, fnName) => {\n if (typeof listener !== 'function') {\n throw new Error(`Invalid listener for ${objName(obj)}#${fnName}; must be a function.`);\n }\n};\n\n/**\n * Takes an array of arguments given to `on()` or `one()`, validates them, and\n * normalizes them into an object.\n *\n * @private\n * @param {Object} self\n * The evented object on which `on()` or `one()` was called. This\n * object will be bound as the `this` value for the listener.\n *\n * @param {Array} args\n * An array of arguments passed to `on()` or `one()`.\n *\n * @param {string} fnName\n * The name of the evented mixin function that called this.\n *\n * @return {Object}\n * An object containing useful values for `on()` or `one()` calls.\n */\nconst normalizeListenArgs = (self, args, fnName) => {\n // If the number of arguments is less than 3, the target is always the\n // evented object itself.\n const isTargetingSelf = args.length < 3 || args[0] === self || args[0] === self.eventBusEl_;\n let target;\n let type;\n let listener;\n if (isTargetingSelf) {\n target = self.eventBusEl_;\n\n // Deal with cases where we got 3 arguments, but we are still listening to\n // the evented object itself.\n if (args.length >= 3) {\n args.shift();\n }\n [type, listener] = args;\n } else {\n [target, type, listener] = args;\n }\n validateTarget(target, self, fnName);\n validateEventType(type, self, fnName);\n validateListener(listener, self, fnName);\n listener = bind_(self, listener);\n return {\n isTargetingSelf,\n target,\n type,\n listener\n };\n};\n\n/**\n * Adds the listener to the event type(s) on the target, normalizing for\n * the type of target.\n *\n * @private\n * @param {Element|Object} target\n * A DOM node or evented object.\n *\n * @param {string} method\n * The event binding method to use (\"on\" or \"one\").\n *\n * @param {string|Array} type\n * One or more event type(s).\n *\n * @param {Function} listener\n * A listener function.\n */\nconst listen = (target, method, type, listener) => {\n validateTarget(target, target, method);\n if (target.nodeName) {\n Events[method](target, type, listener);\n } else {\n target[method](type, listener);\n }\n};\n\n/**\n * Contains methods that provide event capabilities to an object which is passed\n * to {@link module:evented|evented}.\n *\n * @mixin EventedMixin\n */\nconst EventedMixin = {\n /**\n * Add a listener to an event (or events) on this object or another evented\n * object.\n *\n * @param {string|Array|Element|Object} targetOrType\n * If this is a string or array, it represents the event type(s)\n * that will trigger the listener.\n *\n * Another evented object can be passed here instead, which will\n * cause the listener to listen for events on _that_ object.\n *\n * In either case, the listener's `this` value will be bound to\n * this object.\n *\n * @param {string|Array|Function} typeOrListener\n * If the first argument was a string or array, this should be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function.\n */\n on(...args) {\n const {\n isTargetingSelf,\n target,\n type,\n listener\n } = normalizeListenArgs(this, args, 'on');\n listen(target, 'on', type, listener);\n\n // If this object is listening to another evented object.\n if (!isTargetingSelf) {\n // If this object is disposed, remove the listener.\n const removeListenerOnDispose = () => this.off(target, type, listener);\n\n // Use the same function ID as the listener so we can remove it later it\n // using the ID of the original listener.\n removeListenerOnDispose.guid = listener.guid;\n\n // Add a listener to the target's dispose event as well. This ensures\n // that if the target is disposed BEFORE this object, we remove the\n // removal listener that was just added. Otherwise, we create a memory leak.\n const removeRemoverOnTargetDispose = () => this.off('dispose', removeListenerOnDispose);\n\n // Use the same function ID as the listener so we can remove it later\n // it using the ID of the original listener.\n removeRemoverOnTargetDispose.guid = listener.guid;\n listen(this, 'on', 'dispose', removeListenerOnDispose);\n listen(target, 'on', 'dispose', removeRemoverOnTargetDispose);\n }\n },\n /**\n * Add a listener to an event (or events) on this object or another evented\n * object. The listener will be called once per event and then removed.\n *\n * @param {string|Array|Element|Object} targetOrType\n * If this is a string or array, it represents the event type(s)\n * that will trigger the listener.\n *\n * Another evented object can be passed here instead, which will\n * cause the listener to listen for events on _that_ object.\n *\n * In either case, the listener's `this` value will be bound to\n * this object.\n *\n * @param {string|Array|Function} typeOrListener\n * If the first argument was a string or array, this should be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function.\n */\n one(...args) {\n const {\n isTargetingSelf,\n target,\n type,\n listener\n } = normalizeListenArgs(this, args, 'one');\n\n // Targeting this evented object.\n if (isTargetingSelf) {\n listen(target, 'one', type, listener);\n\n // Targeting another evented object.\n } else {\n // TODO: This wrapper is incorrect! It should only\n // remove the wrapper for the event type that called it.\n // Instead all listeners are removed on the first trigger!\n // see https://github.com/videojs/video.js/issues/5962\n const wrapper = (...largs) => {\n this.off(target, type, wrapper);\n listener.apply(null, largs);\n };\n\n // Use the same function ID as the listener so we can remove it later\n // it using the ID of the original listener.\n wrapper.guid = listener.guid;\n listen(target, 'one', type, wrapper);\n }\n },\n /**\n * Add a listener to an event (or events) on this object or another evented\n * object. The listener will only be called once for the first event that is triggered\n * then removed.\n *\n * @param {string|Array|Element|Object} targetOrType\n * If this is a string or array, it represents the event type(s)\n * that will trigger the listener.\n *\n * Another evented object can be passed here instead, which will\n * cause the listener to listen for events on _that_ object.\n *\n * In either case, the listener's `this` value will be bound to\n * this object.\n *\n * @param {string|Array|Function} typeOrListener\n * If the first argument was a string or array, this should be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function.\n */\n any(...args) {\n const {\n isTargetingSelf,\n target,\n type,\n listener\n } = normalizeListenArgs(this, args, 'any');\n\n // Targeting this evented object.\n if (isTargetingSelf) {\n listen(target, 'any', type, listener);\n\n // Targeting another evented object.\n } else {\n const wrapper = (...largs) => {\n this.off(target, type, wrapper);\n listener.apply(null, largs);\n };\n\n // Use the same function ID as the listener so we can remove it later\n // it using the ID of the original listener.\n wrapper.guid = listener.guid;\n listen(target, 'any', type, wrapper);\n }\n },\n /**\n * Removes listener(s) from event(s) on an evented object.\n *\n * @param {string|Array|Element|Object} [targetOrType]\n * If this is a string or array, it represents the event type(s).\n *\n * Another evented object can be passed here instead, in which case\n * ALL 3 arguments are _required_.\n *\n * @param {string|Array|Function} [typeOrListener]\n * If the first argument was a string or array, this may be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function; otherwise, _all_ listeners bound to the\n * event type(s) will be removed.\n */\n off(targetOrType, typeOrListener, listener) {\n // Targeting this evented object.\n if (!targetOrType || isValidEventType(targetOrType)) {\n off(this.eventBusEl_, targetOrType, typeOrListener);\n\n // Targeting another evented object.\n } else {\n const target = targetOrType;\n const type = typeOrListener;\n\n // Fail fast and in a meaningful way!\n validateTarget(target, this, 'off');\n validateEventType(type, this, 'off');\n validateListener(listener, this, 'off');\n\n // Ensure there's at least a guid, even if the function hasn't been used\n listener = bind_(this, listener);\n\n // Remove the dispose listener on this evented object, which was given\n // the same guid as the event listener in on().\n this.off('dispose', listener);\n if (target.nodeName) {\n off(target, type, listener);\n off(target, 'dispose', listener);\n } else if (isEvented(target)) {\n target.off(type, listener);\n target.off('dispose', listener);\n }\n }\n },\n /**\n * Fire an event on this evented object, causing its listeners to be called.\n *\n * @param {string|Object} event\n * An event type or an object with a type property.\n *\n * @param {Object} [hash]\n * An additional object to pass along to listeners.\n *\n * @return {boolean}\n * Whether or not the default behavior was prevented.\n */\n trigger(event, hash) {\n validateTarget(this.eventBusEl_, this, 'trigger');\n const type = event && typeof event !== 'string' ? event.type : event;\n if (!isValidEventType(type)) {\n throw new Error(`Invalid event type for ${objName(this)}#trigger; ` + 'must be a non-empty string or object with a type key that has a non-empty value.');\n }\n return trigger(this.eventBusEl_, event, hash);\n }\n};\n\n/**\n * Applies {@link module:evented~EventedMixin|EventedMixin} to a target object.\n *\n * @param {Object} target\n * The object to which to add event methods.\n *\n * @param {Object} [options={}]\n * Options for customizing the mixin behavior.\n *\n * @param {string} [options.eventBusKey]\n * By default, adds a `eventBusEl_` DOM element to the target object,\n * which is used as an event bus. If the target object already has a\n * DOM element that should be used, pass its key here.\n *\n * @return {Object}\n * The target object.\n */\nfunction evented(target, options = {}) {\n const {\n eventBusKey\n } = options;\n\n // Set or create the eventBusEl_.\n if (eventBusKey) {\n if (!target[eventBusKey].nodeName) {\n throw new Error(`The eventBusKey \"${eventBusKey}\" does not refer to an element.`);\n }\n target.eventBusEl_ = target[eventBusKey];\n } else {\n target.eventBusEl_ = createEl('span', {\n className: 'vjs-event-bus'\n });\n }\n Object.assign(target, EventedMixin);\n if (target.eventedCallbacks) {\n target.eventedCallbacks.forEach(callback => {\n callback();\n });\n }\n\n // When any evented object is disposed, it removes all its listeners.\n target.on('dispose', () => {\n target.off();\n [target, target.el_, target.eventBusEl_].forEach(function (val) {\n if (val && DomData.has(val)) {\n DomData.delete(val);\n }\n });\n global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => {\n target.eventBusEl_ = null;\n }, 0);\n });\n return target;\n}\n\n/**\n * @file mixins/stateful.js\n * @module stateful\n */\n\n/**\n * Contains methods that provide statefulness to an object which is passed\n * to {@link module:stateful}.\n *\n * @mixin StatefulMixin\n */\nconst StatefulMixin = {\n /**\n * A hash containing arbitrary keys and values representing the state of\n * the object.\n *\n * @type {Object}\n */\n state: {},\n /**\n * Set the state of an object by mutating its\n * {@link module:stateful~StatefulMixin.state|state} object in place.\n *\n * @fires module:stateful~StatefulMixin#statechanged\n * @param {Object|Function} stateUpdates\n * A new set of properties to shallow-merge into the plugin state.\n * Can be a plain object or a function returning a plain object.\n *\n * @return {Object|undefined}\n * An object containing changes that occurred. If no changes\n * occurred, returns `undefined`.\n */\n setState(stateUpdates) {\n // Support providing the `stateUpdates` state as a function.\n if (typeof stateUpdates === 'function') {\n stateUpdates = stateUpdates();\n }\n let changes;\n each(stateUpdates, (value, key) => {\n // Record the change if the value is different from what's in the\n // current state.\n if (this.state[key] !== value) {\n changes = changes || {};\n changes[key] = {\n from: this.state[key],\n to: value\n };\n }\n this.state[key] = value;\n });\n\n // Only trigger \"statechange\" if there were changes AND we have a trigger\n // function. This allows us to not require that the target object be an\n // evented object.\n if (changes && isEvented(this)) {\n /**\n * An event triggered on an object that is both\n * {@link module:stateful|stateful} and {@link module:evented|evented}\n * indicating that its state has changed.\n *\n * @event module:stateful~StatefulMixin#statechanged\n * @type {Object}\n * @property {Object} changes\n * A hash containing the properties that were changed and\n * the values they were changed `from` and `to`.\n */\n this.trigger({\n changes,\n type: 'statechanged'\n });\n }\n return changes;\n }\n};\n\n/**\n * Applies {@link module:stateful~StatefulMixin|StatefulMixin} to a target\n * object.\n *\n * If the target object is {@link module:evented|evented} and has a\n * `handleStateChanged` method, that method will be automatically bound to the\n * `statechanged` event on itself.\n *\n * @param {Object} target\n * The object to be made stateful.\n *\n * @param {Object} [defaultState]\n * A default set of properties to populate the newly-stateful object's\n * `state` property.\n *\n * @return {Object}\n * Returns the `target`.\n */\nfunction stateful(target, defaultState) {\n Object.assign(target, StatefulMixin);\n\n // This happens after the mixing-in because we need to replace the `state`\n // added in that step.\n target.state = Object.assign({}, target.state, defaultState);\n\n // Auto-bind the `handleStateChanged` method of the target object if it exists.\n if (typeof target.handleStateChanged === 'function' && isEvented(target)) {\n target.on('statechanged', target.handleStateChanged);\n }\n return target;\n}\n\n/**\n * @file str.js\n * @module to-lower-case\n */\n\n/**\n * Lowercase the first letter of a string.\n *\n * @param {string} string\n * String to be lowercased\n *\n * @return {string}\n * The string with a lowercased first letter\n */\nconst toLowerCase = function (string) {\n if (typeof string !== 'string') {\n return string;\n }\n return string.replace(/./, w => w.toLowerCase());\n};\n\n/**\n * Uppercase the first letter of a string.\n *\n * @param {string} string\n * String to be uppercased\n *\n * @return {string}\n * The string with an uppercased first letter\n */\nconst toTitleCase$1 = function (string) {\n if (typeof string !== 'string') {\n return string;\n }\n return string.replace(/./, w => w.toUpperCase());\n};\n\n/**\n * Compares the TitleCase versions of the two strings for equality.\n *\n * @param {string} str1\n * The first string to compare\n *\n * @param {string} str2\n * The second string to compare\n *\n * @return {boolean}\n * Whether the TitleCase versions of the strings are equal\n */\nconst titleCaseEquals = function (str1, str2) {\n return toTitleCase$1(str1) === toTitleCase$1(str2);\n};\n\nvar Str = /*#__PURE__*/Object.freeze({\n __proto__: null,\n toLowerCase: toLowerCase,\n toTitleCase: toTitleCase$1,\n titleCaseEquals: titleCaseEquals\n});\n\n/**\n * Player Component - Base class for all UI objects\n *\n * @file component.js\n */\n\n/**\n * Base class for all UI Components.\n * Components are UI objects which represent both a javascript object and an element\n * in the DOM. They can be children of other components, and can have\n * children themselves.\n *\n * Components can also use methods from {@link EventTarget}\n */\nclass Component$1 {\n /**\n * A callback that is called when a component is ready. Does not have any\n * parameters and any callback value will be ignored.\n *\n * @callback ReadyCallback\n * @this Component\n */\n\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of component options.\n *\n * @param {Object[]} [options.children]\n * An array of children objects to initialize this component with. Children objects have\n * a name property that will be used if more than one component of the same type needs to be\n * added.\n *\n * @param {string} [options.className]\n * A class or space separated list of classes to add the component\n *\n * @param {ReadyCallback} [ready]\n * Function that gets called when the `Component` is ready.\n */\n constructor(player, options, ready) {\n // The component might be the player itself and we can't pass `this` to super\n if (!player && this.play) {\n this.player_ = player = this; // eslint-disable-line\n } else {\n this.player_ = player;\n }\n this.isDisposed_ = false;\n\n // Hold the reference to the parent component via `addChild` method\n this.parentComponent_ = null;\n\n // Make a copy of prototype.options_ to protect against overriding defaults\n this.options_ = merge$1({}, this.options_);\n\n // Updated options with supplied options\n options = this.options_ = merge$1(this.options_, options);\n\n // Get ID from options or options element if one is supplied\n this.id_ = options.id || options.el && options.el.id;\n\n // If there was no ID from the options, generate one\n if (!this.id_) {\n // Don't require the player ID function in the case of mock players\n const id = player && player.id && player.id() || 'no_player';\n this.id_ = `${id}_component_${newGUID()}`;\n }\n this.name_ = options.name || null;\n\n // Create element if one wasn't provided in options\n if (options.el) {\n this.el_ = options.el;\n } else if (options.createEl !== false) {\n this.el_ = this.createEl();\n }\n if (options.className && this.el_) {\n options.className.split(' ').forEach(c => this.addClass(c));\n }\n\n // Remove the placeholder event methods. If the component is evented, the\n // real methods are added next\n ['on', 'off', 'one', 'any', 'trigger'].forEach(fn => {\n this[fn] = undefined;\n });\n\n // if evented is anything except false, we want to mixin in evented\n if (options.evented !== false) {\n // Make this an evented object and use `el_`, if available, as its event bus\n evented(this, {\n eventBusKey: this.el_ ? 'el_' : null\n });\n this.handleLanguagechange = this.handleLanguagechange.bind(this);\n this.on(this.player_, 'languagechange', this.handleLanguagechange);\n }\n stateful(this, this.constructor.defaultState);\n this.children_ = [];\n this.childIndex_ = {};\n this.childNameIndex_ = {};\n this.setTimeoutIds_ = new Set();\n this.setIntervalIds_ = new Set();\n this.rafIds_ = new Set();\n this.namedRafs_ = new Map();\n this.clearingTimersOnDispose_ = false;\n\n // Add any child components in options\n if (options.initChildren !== false) {\n this.initChildren();\n }\n\n // Don't want to trigger ready here or it will go before init is actually\n // finished for all children that run this constructor\n this.ready(ready);\n if (options.reportTouchActivity !== false) {\n this.enableTouchActivity();\n }\n }\n\n // `on`, `off`, `one`, `any` and `trigger` are here so tsc includes them in definitions.\n // They are replaced or removed in the constructor\n\n /**\n * Adds an `event listener` to an instance of an `EventTarget`. An `event listener` is a\n * function that will get called when an event with a certain name gets triggered.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {Function} fn\n * The function to call with `EventTarget`s\n */\n on(type, fn) {}\n\n /**\n * Removes an `event listener` for a specific event from an instance of `EventTarget`.\n * This makes it so that the `event listener` will no longer get called when the\n * named event happens.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {Function} [fn]\n * The function to remove. If not specified, all listeners managed by Video.js will be removed.\n */\n off(type, fn) {}\n\n /**\n * This function will add an `event listener` that gets triggered only once. After the\n * first trigger it will get removed. This is like adding an `event listener`\n * with {@link EventTarget#on} that calls {@link EventTarget#off} on itself.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {Function} fn\n * The function to be called once for each event name.\n */\n one(type, fn) {}\n\n /**\n * This function will add an `event listener` that gets triggered only once and is\n * removed from all events. This is like adding an array of `event listener`s\n * with {@link EventTarget#on} that calls {@link EventTarget#off} on all events the\n * first time it is triggered.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {Function} fn\n * The function to be called once for each event name.\n */\n any(type, fn) {}\n\n /**\n * This function causes an event to happen. This will then cause any `event listeners`\n * that are waiting for that event, to get called. If there are no `event listeners`\n * for an event then nothing will happen.\n *\n * If the name of the `Event` that is being triggered is in `EventTarget.allowedEvents_`.\n * Trigger will also call the `on` + `uppercaseEventName` function.\n *\n * Example:\n * 'click' is in `EventTarget.allowedEvents_`, so, trigger will attempt to call\n * `onClick` if it exists.\n *\n * @param {string|Event|Object} event\n * The name of the event, an `Event`, or an object with a key of type set to\n * an event name.\n *\n * @param {Object} [hash]\n * Optionally extra argument to pass through to an event listener\n */\n trigger(event, hash) {}\n\n /**\n * Dispose of the `Component` and all child components.\n *\n * @fires Component#dispose\n *\n * @param {Object} options\n * @param {Element} options.originalEl element with which to replace player element\n */\n dispose(options = {}) {\n // Bail out if the component has already been disposed.\n if (this.isDisposed_) {\n return;\n }\n if (this.readyQueue_) {\n this.readyQueue_.length = 0;\n }\n\n /**\n * Triggered when a `Component` is disposed.\n *\n * @event Component#dispose\n * @type {Event}\n *\n * @property {boolean} [bubbles=false]\n * set to false so that the dispose event does not\n * bubble up\n */\n this.trigger({\n type: 'dispose',\n bubbles: false\n });\n this.isDisposed_ = true;\n\n // Dispose all children.\n if (this.children_) {\n for (let i = this.children_.length - 1; i >= 0; i--) {\n if (this.children_[i].dispose) {\n this.children_[i].dispose();\n }\n }\n }\n\n // Delete child references\n this.children_ = null;\n this.childIndex_ = null;\n this.childNameIndex_ = null;\n this.parentComponent_ = null;\n if (this.el_) {\n // Remove element from DOM\n if (this.el_.parentNode) {\n if (options.restoreEl) {\n this.el_.parentNode.replaceChild(options.restoreEl, this.el_);\n } else {\n this.el_.parentNode.removeChild(this.el_);\n }\n }\n this.el_ = null;\n }\n\n // remove reference to the player after disposing of the element\n this.player_ = null;\n }\n\n /**\n * Determine whether or not this component has been disposed.\n *\n * @return {boolean}\n * If the component has been disposed, will be `true`. Otherwise, `false`.\n */\n isDisposed() {\n return Boolean(this.isDisposed_);\n }\n\n /**\n * Return the {@link Player} that the `Component` has attached to.\n *\n * @return { import('./player').default }\n * The player that this `Component` has attached to.\n */\n player() {\n return this.player_;\n }\n\n /**\n * Deep merge of options objects with new options.\n * > Note: When both `obj` and `options` contain properties whose values are objects.\n * The two properties get merged using {@link module:obj.merge}\n *\n * @param {Object} obj\n * The object that contains new options.\n *\n * @return {Object}\n * A new object of `this.options_` and `obj` merged together.\n */\n options(obj) {\n if (!obj) {\n return this.options_;\n }\n this.options_ = merge$1(this.options_, obj);\n return this.options_;\n }\n\n /**\n * Get the `Component`s DOM element\n *\n * @return {Element}\n * The DOM element for this `Component`.\n */\n el() {\n return this.el_;\n }\n\n /**\n * Create the `Component`s DOM element.\n *\n * @param {string} [tagName]\n * Element's DOM node type. e.g. 'div'\n *\n * @param {Object} [properties]\n * An object of properties that should be set.\n *\n * @param {Object} [attributes]\n * An object of attributes that should be set.\n *\n * @return {Element}\n * The element that gets created.\n */\n createEl(tagName, properties, attributes) {\n return createEl(tagName, properties, attributes);\n }\n\n /**\n * Localize a string given the string in english.\n *\n * If tokens are provided, it'll try and run a simple token replacement on the provided string.\n * The tokens it looks for look like `{1}` with the index being 1-indexed into the tokens array.\n *\n * If a `defaultValue` is provided, it'll use that over `string`,\n * if a value isn't found in provided language files.\n * This is useful if you want to have a descriptive key for token replacement\n * but have a succinct localized string and not require `en.json` to be included.\n *\n * Currently, it is used for the progress bar timing.\n * ```js\n * {\n * \"progress bar timing: currentTime={1} duration={2}\": \"{1} of {2}\"\n * }\n * ```\n * It is then used like so:\n * ```js\n * this.localize('progress bar timing: currentTime={1} duration{2}',\n * [this.player_.currentTime(), this.player_.duration()],\n * '{1} of {2}');\n * ```\n *\n * Which outputs something like: `01:23 of 24:56`.\n *\n *\n * @param {string} string\n * The string to localize and the key to lookup in the language files.\n * @param {string[]} [tokens]\n * If the current item has token replacements, provide the tokens here.\n * @param {string} [defaultValue]\n * Defaults to `string`. Can be a default value to use for token replacement\n * if the lookup key is needed to be separate.\n *\n * @return {string}\n * The localized string or if no localization exists the english string.\n */\n localize(string, tokens, defaultValue = string) {\n const code = this.player_.language && this.player_.language();\n const languages = this.player_.languages && this.player_.languages();\n const language = languages && languages[code];\n const primaryCode = code && code.split('-')[0];\n const primaryLang = languages && languages[primaryCode];\n let localizedString = defaultValue;\n if (language && language[string]) {\n localizedString = language[string];\n } else if (primaryLang && primaryLang[string]) {\n localizedString = primaryLang[string];\n }\n if (tokens) {\n localizedString = localizedString.replace(/\\{(\\d+)\\}/g, function (match, index) {\n const value = tokens[index - 1];\n let ret = value;\n if (typeof value === 'undefined') {\n ret = match;\n }\n return ret;\n });\n }\n return localizedString;\n }\n\n /**\n * Handles language change for the player in components. Should be overridden by sub-components.\n *\n * @abstract\n */\n handleLanguagechange() {}\n\n /**\n * Return the `Component`s DOM element. This is where children get inserted.\n * This will usually be the the same as the element returned in {@link Component#el}.\n *\n * @return {Element}\n * The content element for this `Component`.\n */\n contentEl() {\n return this.contentEl_ || this.el_;\n }\n\n /**\n * Get this `Component`s ID\n *\n * @return {string}\n * The id of this `Component`\n */\n id() {\n return this.id_;\n }\n\n /**\n * Get the `Component`s name. The name gets used to reference the `Component`\n * and is set during registration.\n *\n * @return {string}\n * The name of this `Component`.\n */\n name() {\n return this.name_;\n }\n\n /**\n * Get an array of all child components\n *\n * @return {Array}\n * The children\n */\n children() {\n return this.children_;\n }\n\n /**\n * Returns the child `Component` with the given `id`.\n *\n * @param {string} id\n * The id of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The child `Component` with the given `id` or undefined.\n */\n getChildById(id) {\n return this.childIndex_[id];\n }\n\n /**\n * Returns the child `Component` with the given `name`.\n *\n * @param {string} name\n * The name of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The child `Component` with the given `name` or undefined.\n */\n getChild(name) {\n if (!name) {\n return;\n }\n return this.childNameIndex_[name];\n }\n\n /**\n * Returns the descendant `Component` following the givent\n * descendant `names`. For instance ['foo', 'bar', 'baz'] would\n * try to get 'foo' on the current component, 'bar' on the 'foo'\n * component and 'baz' on the 'bar' component and return undefined\n * if any of those don't exist.\n *\n * @param {...string[]|...string} names\n * The name of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The descendant `Component` following the given descendant\n * `names` or undefined.\n */\n getDescendant(...names) {\n // flatten array argument into the main array\n names = names.reduce((acc, n) => acc.concat(n), []);\n let currentChild = this;\n for (let i = 0; i < names.length; i++) {\n currentChild = currentChild.getChild(names[i]);\n if (!currentChild || !currentChild.getChild) {\n return;\n }\n }\n return currentChild;\n }\n\n /**\n * Adds an SVG icon element to another element or component.\n *\n * @param {string} iconName\n * The name of icon. A list of all the icon names can be found at 'sandbox/svg-icons.html'\n *\n * @param {Element} [el=this.el()]\n * Element to set the title on. Defaults to the current Component's element.\n *\n * @return {Element}\n * The newly created icon element.\n */\n setIcon(iconName, el = this.el()) {\n // TODO: In v9 of video.js, we will want to remove font icons entirely.\n // This means this check, as well as the others throughout the code, and\n // the unecessary CSS for font icons, will need to be removed.\n // See https://github.com/videojs/video.js/pull/8260 as to which components\n // need updating.\n if (!this.player_.options_.experimentalSvgIcons) {\n return;\n }\n const xmlnsURL = 'http://www.w3.org/2000/svg';\n\n // The below creates an element in the format of:\n // <span><svg><use>....</use></svg></span>\n const iconContainer = createEl('span', {\n className: 'vjs-icon-placeholder vjs-svg-icon'\n }, {\n 'aria-hidden': 'true'\n });\n const svgEl = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElementNS(xmlnsURL, 'svg');\n svgEl.setAttributeNS(null, 'viewBox', '0 0 512 512');\n const useEl = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElementNS(xmlnsURL, 'use');\n svgEl.appendChild(useEl);\n useEl.setAttributeNS(null, 'href', `#vjs-icon-${iconName}`);\n iconContainer.appendChild(svgEl);\n\n // Replace a pre-existing icon if one exists.\n if (this.iconIsSet_) {\n el.replaceChild(iconContainer, el.querySelector('.vjs-icon-placeholder'));\n } else {\n el.appendChild(iconContainer);\n }\n this.iconIsSet_ = true;\n return iconContainer;\n }\n\n /**\n * Add a child `Component` inside the current `Component`.\n *\n * @param {string|Component} child\n * The name or instance of a child to add.\n *\n * @param {Object} [options={}]\n * The key/value store of options that will get passed to children of\n * the child.\n *\n * @param {number} [index=this.children_.length]\n * The index to attempt to add a child into.\n *\n *\n * @return {Component}\n * The `Component` that gets added as a child. When using a string the\n * `Component` will get created by this process.\n */\n addChild(child, options = {}, index = this.children_.length) {\n let component;\n let componentName;\n\n // If child is a string, create component with options\n if (typeof child === 'string') {\n componentName = toTitleCase$1(child);\n const componentClassName = options.componentClass || componentName;\n\n // Set name through options\n options.name = componentName;\n\n // Create a new object & element for this controls set\n // If there's no .player_, this is a player\n const ComponentClass = Component$1.getComponent(componentClassName);\n if (!ComponentClass) {\n throw new Error(`Component ${componentClassName} does not exist`);\n }\n\n // data stored directly on the videojs object may be\n // misidentified as a component to retain\n // backwards-compatibility with 4.x. check to make sure the\n // component class can be instantiated.\n if (typeof ComponentClass !== 'function') {\n return null;\n }\n component = new ComponentClass(this.player_ || this, options);\n\n // child is a component instance\n } else {\n component = child;\n }\n if (component.parentComponent_) {\n component.parentComponent_.removeChild(component);\n }\n this.children_.splice(index, 0, component);\n component.parentComponent_ = this;\n if (typeof component.id === 'function') {\n this.childIndex_[component.id()] = component;\n }\n\n // If a name wasn't used to create the component, check if we can use the\n // name function of the component\n componentName = componentName || component.name && toTitleCase$1(component.name());\n if (componentName) {\n this.childNameIndex_[componentName] = component;\n this.childNameIndex_[toLowerCase(componentName)] = component;\n }\n\n // Add the UI object's element to the container div (box)\n // Having an element is not required\n if (typeof component.el === 'function' && component.el()) {\n // If inserting before a component, insert before that component's element\n let refNode = null;\n if (this.children_[index + 1]) {\n // Most children are components, but the video tech is an HTML element\n if (this.children_[index + 1].el_) {\n refNode = this.children_[index + 1].el_;\n } else if (isEl(this.children_[index + 1])) {\n refNode = this.children_[index + 1];\n }\n }\n this.contentEl().insertBefore(component.el(), refNode);\n }\n\n // Return so it can stored on parent object if desired.\n return component;\n }\n\n /**\n * Remove a child `Component` from this `Component`s list of children. Also removes\n * the child `Component`s element from this `Component`s element.\n *\n * @param {Component} component\n * The child `Component` to remove.\n */\n removeChild(component) {\n if (typeof component === 'string') {\n component = this.getChild(component);\n }\n if (!component || !this.children_) {\n return;\n }\n let childFound = false;\n for (let i = this.children_.length - 1; i >= 0; i--) {\n if (this.children_[i] === component) {\n childFound = true;\n this.children_.splice(i, 1);\n break;\n }\n }\n if (!childFound) {\n return;\n }\n component.parentComponent_ = null;\n this.childIndex_[component.id()] = null;\n this.childNameIndex_[toTitleCase$1(component.name())] = null;\n this.childNameIndex_[toLowerCase(component.name())] = null;\n const compEl = component.el();\n if (compEl && compEl.parentNode === this.contentEl()) {\n this.contentEl().removeChild(component.el());\n }\n }\n\n /**\n * Add and initialize default child `Component`s based upon options.\n */\n initChildren() {\n const children = this.options_.children;\n if (children) {\n // `this` is `parent`\n const parentOptions = this.options_;\n const handleAdd = child => {\n const name = child.name;\n let opts = child.opts;\n\n // Allow options for children to be set at the parent options\n // e.g. videojs(id, { controlBar: false });\n // instead of videojs(id, { children: { controlBar: false });\n if (parentOptions[name] !== undefined) {\n opts = parentOptions[name];\n }\n\n // Allow for disabling default components\n // e.g. options['children']['posterImage'] = false\n if (opts === false) {\n return;\n }\n\n // Allow options to be passed as a simple boolean if no configuration\n // is necessary.\n if (opts === true) {\n opts = {};\n }\n\n // We also want to pass the original player options\n // to each component as well so they don't need to\n // reach back into the player for options later.\n opts.playerOptions = this.options_.playerOptions;\n\n // Create and add the child component.\n // Add a direct reference to the child by name on the parent instance.\n // If two of the same component are used, different names should be supplied\n // for each\n const newChild = this.addChild(name, opts);\n if (newChild) {\n this[name] = newChild;\n }\n };\n\n // Allow for an array of children details to passed in the options\n let workingChildren;\n const Tech = Component$1.getComponent('Tech');\n if (Array.isArray(children)) {\n workingChildren = children;\n } else {\n workingChildren = Object.keys(children);\n }\n workingChildren\n // children that are in this.options_ but also in workingChildren would\n // give us extra children we do not want. So, we want to filter them out.\n .concat(Object.keys(this.options_).filter(function (child) {\n return !workingChildren.some(function (wchild) {\n if (typeof wchild === 'string') {\n return child === wchild;\n }\n return child === wchild.name;\n });\n })).map(child => {\n let name;\n let opts;\n if (typeof child === 'string') {\n name = child;\n opts = children[name] || this.options_[name] || {};\n } else {\n name = child.name;\n opts = child;\n }\n return {\n name,\n opts\n };\n }).filter(child => {\n // we have to make sure that child.name isn't in the techOrder since\n // techs are registered as Components but can't aren't compatible\n // See https://github.com/videojs/video.js/issues/2772\n const c = Component$1.getComponent(child.opts.componentClass || toTitleCase$1(child.name));\n return c && !Tech.isTech(c);\n }).forEach(handleAdd);\n }\n }\n\n /**\n * Builds the default DOM class name. Should be overridden by sub-components.\n *\n * @return {string}\n * The DOM class name for this object.\n *\n * @abstract\n */\n buildCSSClass() {\n // Child classes can include a function that does:\n // return 'CLASS NAME' + this._super();\n return '';\n }\n\n /**\n * Bind a listener to the component's ready state.\n * Different from event listeners in that if the ready event has already happened\n * it will trigger the function immediately.\n *\n * @param {ReadyCallback} fn\n * Function that gets called when the `Component` is ready.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n ready(fn, sync = false) {\n if (!fn) {\n return;\n }\n if (!this.isReady_) {\n this.readyQueue_ = this.readyQueue_ || [];\n this.readyQueue_.push(fn);\n return;\n }\n if (sync) {\n fn.call(this);\n } else {\n // Call the function asynchronously by default for consistency\n this.setTimeout(fn, 1);\n }\n }\n\n /**\n * Trigger all the ready listeners for this `Component`.\n *\n * @fires Component#ready\n */\n triggerReady() {\n this.isReady_ = true;\n\n // Ensure ready is triggered asynchronously\n this.setTimeout(function () {\n const readyQueue = this.readyQueue_;\n\n // Reset Ready Queue\n this.readyQueue_ = [];\n if (readyQueue && readyQueue.length > 0) {\n readyQueue.forEach(function (fn) {\n fn.call(this);\n }, this);\n }\n\n // Allow for using event listeners also\n /**\n * Triggered when a `Component` is ready.\n *\n * @event Component#ready\n * @type {Event}\n */\n this.trigger('ready');\n }, 1);\n }\n\n /**\n * Find a single DOM element matching a `selector`. This can be within the `Component`s\n * `contentEl()` or another custom context.\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelector`.\n *\n * @param {Element|string} [context=this.contentEl()]\n * A DOM element within which to query. Can also be a selector string in\n * which case the first matching element will get used as context. If\n * missing `this.contentEl()` gets used. If `this.contentEl()` returns\n * nothing it falls back to `document`.\n *\n * @return {Element|null}\n * the dom element that was found, or null\n *\n * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)\n */\n $(selector, context) {\n return $(selector, context || this.contentEl());\n }\n\n /**\n * Finds all DOM element matching a `selector`. This can be within the `Component`s\n * `contentEl()` or another custom context.\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelectorAll`.\n *\n * @param {Element|string} [context=this.contentEl()]\n * A DOM element within which to query. Can also be a selector string in\n * which case the first matching element will get used as context. If\n * missing `this.contentEl()` gets used. If `this.contentEl()` returns\n * nothing it falls back to `document`.\n *\n * @return {NodeList}\n * a list of dom elements that were found\n *\n * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)\n */\n $$(selector, context) {\n return $$(selector, context || this.contentEl());\n }\n\n /**\n * Check if a component's element has a CSS class name.\n *\n * @param {string} classToCheck\n * CSS class name to check.\n *\n * @return {boolean}\n * - True if the `Component` has the class.\n * - False if the `Component` does not have the class`\n */\n hasClass(classToCheck) {\n return hasClass(this.el_, classToCheck);\n }\n\n /**\n * Add a CSS class name to the `Component`s element.\n *\n * @param {...string} classesToAdd\n * One or more CSS class name to add.\n */\n addClass(...classesToAdd) {\n addClass(this.el_, ...classesToAdd);\n }\n\n /**\n * Remove a CSS class name from the `Component`s element.\n *\n * @param {...string} classesToRemove\n * One or more CSS class name to remove.\n */\n removeClass(...classesToRemove) {\n removeClass(this.el_, ...classesToRemove);\n }\n\n /**\n * Add or remove a CSS class name from the component's element.\n * - `classToToggle` gets added when {@link Component#hasClass} would return false.\n * - `classToToggle` gets removed when {@link Component#hasClass} would return true.\n *\n * @param {string} classToToggle\n * The class to add or remove based on (@link Component#hasClass}\n *\n * @param {boolean|Dom~predicate} [predicate]\n * An {@link Dom~predicate} function or a boolean\n */\n toggleClass(classToToggle, predicate) {\n toggleClass(this.el_, classToToggle, predicate);\n }\n\n /**\n * Show the `Component`s element if it is hidden by removing the\n * 'vjs-hidden' class name from it.\n */\n show() {\n this.removeClass('vjs-hidden');\n }\n\n /**\n * Hide the `Component`s element if it is currently showing by adding the\n * 'vjs-hidden` class name to it.\n */\n hide() {\n this.addClass('vjs-hidden');\n }\n\n /**\n * Lock a `Component`s element in its visible state by adding the 'vjs-lock-showing'\n * class name to it. Used during fadeIn/fadeOut.\n *\n * @private\n */\n lockShowing() {\n this.addClass('vjs-lock-showing');\n }\n\n /**\n * Unlock a `Component`s element from its visible state by removing the 'vjs-lock-showing'\n * class name from it. Used during fadeIn/fadeOut.\n *\n * @private\n */\n unlockShowing() {\n this.removeClass('vjs-lock-showing');\n }\n\n /**\n * Get the value of an attribute on the `Component`s element.\n *\n * @param {string} attribute\n * Name of the attribute to get the value from.\n *\n * @return {string|null}\n * - The value of the attribute that was asked for.\n * - Can be an empty string on some browsers if the attribute does not exist\n * or has no value\n * - Most browsers will return null if the attribute does not exist or has\n * no value.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute}\n */\n getAttribute(attribute) {\n return getAttribute(this.el_, attribute);\n }\n\n /**\n * Set the value of an attribute on the `Component`'s element\n *\n * @param {string} attribute\n * Name of the attribute to set.\n *\n * @param {string} value\n * Value to set the attribute to.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute}\n */\n setAttribute(attribute, value) {\n setAttribute(this.el_, attribute, value);\n }\n\n /**\n * Remove an attribute from the `Component`s element.\n *\n * @param {string} attribute\n * Name of the attribute to remove.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute}\n */\n removeAttribute(attribute) {\n removeAttribute(this.el_, attribute);\n }\n\n /**\n * Get or set the width of the component based upon the CSS styles.\n * See {@link Component#dimension} for more detailed information.\n *\n * @param {number|string} [num]\n * The width that you want to set postfixed with '%', 'px' or nothing.\n *\n * @param {boolean} [skipListeners]\n * Skip the componentresize event trigger\n *\n * @return {number|undefined}\n * The width when getting, zero if there is no width\n */\n width(num, skipListeners) {\n return this.dimension('width', num, skipListeners);\n }\n\n /**\n * Get or set the height of the component based upon the CSS styles.\n * See {@link Component#dimension} for more detailed information.\n *\n * @param {number|string} [num]\n * The height that you want to set postfixed with '%', 'px' or nothing.\n *\n * @param {boolean} [skipListeners]\n * Skip the componentresize event trigger\n *\n * @return {number|undefined}\n * The height when getting, zero if there is no height\n */\n height(num, skipListeners) {\n return this.dimension('height', num, skipListeners);\n }\n\n /**\n * Set both the width and height of the `Component` element at the same time.\n *\n * @param {number|string} width\n * Width to set the `Component`s element to.\n *\n * @param {number|string} height\n * Height to set the `Component`s element to.\n */\n dimensions(width, height) {\n // Skip componentresize listeners on width for optimization\n this.width(width, true);\n this.height(height);\n }\n\n /**\n * Get or set width or height of the `Component` element. This is the shared code\n * for the {@link Component#width} and {@link Component#height}.\n *\n * Things to know:\n * - If the width or height in an number this will return the number postfixed with 'px'.\n * - If the width/height is a percent this will return the percent postfixed with '%'\n * - Hidden elements have a width of 0 with `window.getComputedStyle`. This function\n * defaults to the `Component`s `style.width` and falls back to `window.getComputedStyle`.\n * See [this]{@link http://www.foliotek.com/devblog/getting-the-width-of-a-hidden-element-with-jquery-using-width/}\n * for more information\n * - If you want the computed style of the component, use {@link Component#currentWidth}\n * and {@link {Component#currentHeight}\n *\n * @fires Component#componentresize\n *\n * @param {string} widthOrHeight\n 8 'width' or 'height'\n *\n * @param {number|string} [num]\n 8 New dimension\n *\n * @param {boolean} [skipListeners]\n * Skip componentresize event trigger\n *\n * @return {number|undefined}\n * The dimension when getting or 0 if unset\n */\n dimension(widthOrHeight, num, skipListeners) {\n if (num !== undefined) {\n // Set to zero if null or literally NaN (NaN !== NaN)\n if (num === null || num !== num) {\n num = 0;\n }\n\n // Check if using css width/height (% or px) and adjust\n if (('' + num).indexOf('%') !== -1 || ('' + num).indexOf('px') !== -1) {\n this.el_.style[widthOrHeight] = num;\n } else if (num === 'auto') {\n this.el_.style[widthOrHeight] = '';\n } else {\n this.el_.style[widthOrHeight] = num + 'px';\n }\n\n // skipListeners allows us to avoid triggering the resize event when setting both width and height\n if (!skipListeners) {\n /**\n * Triggered when a component is resized.\n *\n * @event Component#componentresize\n * @type {Event}\n */\n this.trigger('componentresize');\n }\n return;\n }\n\n // Not setting a value, so getting it\n // Make sure element exists\n if (!this.el_) {\n return 0;\n }\n\n // Get dimension value from style\n const val = this.el_.style[widthOrHeight];\n const pxIndex = val.indexOf('px');\n if (pxIndex !== -1) {\n // Return the pixel value with no 'px'\n return parseInt(val.slice(0, pxIndex), 10);\n }\n\n // No px so using % or no style was set, so falling back to offsetWidth/height\n // If component has display:none, offset will return 0\n // TODO: handle display:none and no dimension style using px\n return parseInt(this.el_['offset' + toTitleCase$1(widthOrHeight)], 10);\n }\n\n /**\n * Get the computed width or the height of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @param {string} widthOrHeight\n * A string containing 'width' or 'height'. Whichever one you want to get.\n *\n * @return {number}\n * The dimension that gets asked for or 0 if nothing was set\n * for that dimension.\n */\n currentDimension(widthOrHeight) {\n let computedWidthOrHeight = 0;\n if (widthOrHeight !== 'width' && widthOrHeight !== 'height') {\n throw new Error('currentDimension only accepts width or height value');\n }\n computedWidthOrHeight = computedStyle(this.el_, widthOrHeight);\n\n // remove 'px' from variable and parse as integer\n computedWidthOrHeight = parseFloat(computedWidthOrHeight);\n\n // if the computed value is still 0, it's possible that the browser is lying\n // and we want to check the offset values.\n // This code also runs wherever getComputedStyle doesn't exist.\n if (computedWidthOrHeight === 0 || isNaN(computedWidthOrHeight)) {\n const rule = `offset${toTitleCase$1(widthOrHeight)}`;\n computedWidthOrHeight = this.el_[rule];\n }\n return computedWidthOrHeight;\n }\n\n /**\n * An object that contains width and height values of the `Component`s\n * computed style. Uses `window.getComputedStyle`.\n *\n * @typedef {Object} Component~DimensionObject\n *\n * @property {number} width\n * The width of the `Component`s computed style.\n *\n * @property {number} height\n * The height of the `Component`s computed style.\n */\n\n /**\n * Get an object that contains computed width and height values of the\n * component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {Component~DimensionObject}\n * The computed dimensions of the component's element.\n */\n currentDimensions() {\n return {\n width: this.currentDimension('width'),\n height: this.currentDimension('height')\n };\n }\n\n /**\n * Get the computed width of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {number}\n * The computed width of the component's element.\n */\n currentWidth() {\n return this.currentDimension('width');\n }\n\n /**\n * Get the computed height of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {number}\n * The computed height of the component's element.\n */\n currentHeight() {\n return this.currentDimension('height');\n }\n\n /**\n * Set the focus to this component\n */\n focus() {\n this.el_.focus();\n }\n\n /**\n * Remove the focus from this component\n */\n blur() {\n this.el_.blur();\n }\n\n /**\n * When this Component receives a `keydown` event which it does not process,\n * it passes the event to the Player for handling.\n *\n * @param {KeyboardEvent} event\n * The `keydown` event that caused this function to be called.\n */\n handleKeyDown(event) {\n if (this.player_) {\n // We only stop propagation here because we want unhandled events to fall\n // back to the browser. Exclude Tab for focus trapping.\n if (!keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Tab')) {\n event.stopPropagation();\n }\n this.player_.handleKeyDown(event);\n }\n }\n\n /**\n * Many components used to have a `handleKeyPress` method, which was poorly\n * named because it listened to a `keydown` event. This method name now\n * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress`\n * will not see their method calls stop working.\n *\n * @param {KeyboardEvent} event\n * The event that caused this function to be called.\n */\n handleKeyPress(event) {\n this.handleKeyDown(event);\n }\n\n /**\n * Emit a 'tap' events when touch event support gets detected. This gets used to\n * support toggling the controls through a tap on the video. They get enabled\n * because every sub-component would have extra overhead otherwise.\n *\n * @protected\n * @fires Component#tap\n * @listens Component#touchstart\n * @listens Component#touchmove\n * @listens Component#touchleave\n * @listens Component#touchcancel\n * @listens Component#touchend\n */\n emitTapEvents() {\n // Track the start time so we can determine how long the touch lasted\n let touchStart = 0;\n let firstTouch = null;\n\n // Maximum movement allowed during a touch event to still be considered a tap\n // Other popular libs use anywhere from 2 (hammer.js) to 15,\n // so 10 seems like a nice, round number.\n const tapMovementThreshold = 10;\n\n // The maximum length a touch can be while still being considered a tap\n const touchTimeThreshold = 200;\n let couldBeTap;\n this.on('touchstart', function (event) {\n // If more than one finger, don't consider treating this as a click\n if (event.touches.length === 1) {\n // Copy pageX/pageY from the object\n firstTouch = {\n pageX: event.touches[0].pageX,\n pageY: event.touches[0].pageY\n };\n // Record start time so we can detect a tap vs. \"touch and hold\"\n touchStart = global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now();\n // Reset couldBeTap tracking\n couldBeTap = true;\n }\n });\n this.on('touchmove', function (event) {\n // If more than one finger, don't consider treating this as a click\n if (event.touches.length > 1) {\n couldBeTap = false;\n } else if (firstTouch) {\n // Some devices will throw touchmoves for all but the slightest of taps.\n // So, if we moved only a small distance, this could still be a tap\n const xdiff = event.touches[0].pageX - firstTouch.pageX;\n const ydiff = event.touches[0].pageY - firstTouch.pageY;\n const touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);\n if (touchDistance > tapMovementThreshold) {\n couldBeTap = false;\n }\n }\n });\n const noTap = function () {\n couldBeTap = false;\n };\n\n // TODO: Listen to the original target. http://youtu.be/DujfpXOKUp8?t=13m8s\n this.on('touchleave', noTap);\n this.on('touchcancel', noTap);\n\n // When the touch ends, measure how long it took and trigger the appropriate\n // event\n this.on('touchend', function (event) {\n firstTouch = null;\n // Proceed only if the touchmove/leave/cancel event didn't happen\n if (couldBeTap === true) {\n // Measure how long the touch lasted\n const touchTime = global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now() - touchStart;\n\n // Make sure the touch was less than the threshold to be considered a tap\n if (touchTime < touchTimeThreshold) {\n // Don't let browser turn this into a click\n event.preventDefault();\n /**\n * Triggered when a `Component` is tapped.\n *\n * @event Component#tap\n * @type {MouseEvent}\n */\n this.trigger('tap');\n // It may be good to copy the touchend event object and change the\n // type to tap, if the other event properties aren't exact after\n // Events.fixEvent runs (e.g. event.target)\n }\n }\n });\n }\n\n /**\n * This function reports user activity whenever touch events happen. This can get\n * turned off by any sub-components that wants touch events to act another way.\n *\n * Report user touch activity when touch events occur. User activity gets used to\n * determine when controls should show/hide. It is simple when it comes to mouse\n * events, because any mouse event should show the controls. So we capture mouse\n * events that bubble up to the player and report activity when that happens.\n * With touch events it isn't as easy as `touchstart` and `touchend` toggle player\n * controls. So touch events can't help us at the player level either.\n *\n * User activity gets checked asynchronously. So what could happen is a tap event\n * on the video turns the controls off. Then the `touchend` event bubbles up to\n * the player. Which, if it reported user activity, would turn the controls right\n * back on. We also don't want to completely block touch events from bubbling up.\n * Furthermore a `touchmove` event and anything other than a tap, should not turn\n * controls back on.\n *\n * @listens Component#touchstart\n * @listens Component#touchmove\n * @listens Component#touchend\n * @listens Component#touchcancel\n */\n enableTouchActivity() {\n // Don't continue if the root player doesn't support reporting user activity\n if (!this.player() || !this.player().reportUserActivity) {\n return;\n }\n\n // listener for reporting that the user is active\n const report = bind_(this.player(), this.player().reportUserActivity);\n let touchHolding;\n this.on('touchstart', function () {\n report();\n // For as long as the they are touching the device or have their mouse down,\n // we consider them active even if they're not moving their finger or mouse.\n // So we want to continue to update that they are active\n this.clearInterval(touchHolding);\n // report at the same interval as activityCheck\n touchHolding = this.setInterval(report, 250);\n });\n const touchEnd = function (event) {\n report();\n // stop the interval that maintains activity if the touch is holding\n this.clearInterval(touchHolding);\n };\n this.on('touchmove', report);\n this.on('touchend', touchEnd);\n this.on('touchcancel', touchEnd);\n }\n\n /**\n * A callback that has no parameters and is bound into `Component`s context.\n *\n * @callback Component~GenericCallback\n * @this Component\n */\n\n /**\n * Creates a function that runs after an `x` millisecond timeout. This function is a\n * wrapper around `window.setTimeout`. There are a few reasons to use this one\n * instead though:\n * 1. It gets cleared via {@link Component#clearTimeout} when\n * {@link Component#dispose} gets called.\n * 2. The function callback will gets turned into a {@link Component~GenericCallback}\n *\n * > Note: You can't use `window.clearTimeout` on the id returned by this function. This\n * will cause its dispose listener not to get cleaned up! Please use\n * {@link Component#clearTimeout} or {@link Component#dispose} instead.\n *\n * @param {Component~GenericCallback} fn\n * The function that will be run after `timeout`.\n *\n * @param {number} timeout\n * Timeout in milliseconds to delay before executing the specified function.\n *\n * @return {number}\n * Returns a timeout ID that gets used to identify the timeout. It can also\n * get used in {@link Component#clearTimeout} to clear the timeout that\n * was set.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout}\n */\n setTimeout(fn, timeout) {\n // declare as variables so they are properly available in timeout function\n // eslint-disable-next-line\n var timeoutId;\n fn = bind_(this, fn);\n this.clearTimersOnDispose_();\n timeoutId = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => {\n if (this.setTimeoutIds_.has(timeoutId)) {\n this.setTimeoutIds_.delete(timeoutId);\n }\n fn();\n }, timeout);\n this.setTimeoutIds_.add(timeoutId);\n return timeoutId;\n }\n\n /**\n * Clears a timeout that gets created via `window.setTimeout` or\n * {@link Component#setTimeout}. If you set a timeout via {@link Component#setTimeout}\n * use this function instead of `window.clearTimout`. If you don't your dispose\n * listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} timeoutId\n * The id of the timeout to clear. The return value of\n * {@link Component#setTimeout} or `window.setTimeout`.\n *\n * @return {number}\n * Returns the timeout id that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearTimeout}\n */\n clearTimeout(timeoutId) {\n if (this.setTimeoutIds_.has(timeoutId)) {\n this.setTimeoutIds_.delete(timeoutId);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(timeoutId);\n }\n return timeoutId;\n }\n\n /**\n * Creates a function that gets run every `x` milliseconds. This function is a wrapper\n * around `window.setInterval`. There are a few reasons to use this one instead though.\n * 1. It gets cleared via {@link Component#clearInterval} when\n * {@link Component#dispose} gets called.\n * 2. The function callback will be a {@link Component~GenericCallback}\n *\n * @param {Component~GenericCallback} fn\n * The function to run every `x` seconds.\n *\n * @param {number} interval\n * Execute the specified function every `x` milliseconds.\n *\n * @return {number}\n * Returns an id that can be used to identify the interval. It can also be be used in\n * {@link Component#clearInterval} to clear the interval.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval}\n */\n setInterval(fn, interval) {\n fn = bind_(this, fn);\n this.clearTimersOnDispose_();\n const intervalId = global_window__WEBPACK_IMPORTED_MODULE_0___default().setInterval(fn, interval);\n this.setIntervalIds_.add(intervalId);\n return intervalId;\n }\n\n /**\n * Clears an interval that gets created via `window.setInterval` or\n * {@link Component#setInterval}. If you set an interval via {@link Component#setInterval}\n * use this function instead of `window.clearInterval`. If you don't your dispose\n * listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} intervalId\n * The id of the interval to clear. The return value of\n * {@link Component#setInterval} or `window.setInterval`.\n *\n * @return {number}\n * Returns the interval id that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearInterval}\n */\n clearInterval(intervalId) {\n if (this.setIntervalIds_.has(intervalId)) {\n this.setIntervalIds_.delete(intervalId);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearInterval(intervalId);\n }\n return intervalId;\n }\n\n /**\n * Queues up a callback to be passed to requestAnimationFrame (rAF), but\n * with a few extra bonuses:\n *\n * - Supports browsers that do not support rAF by falling back to\n * {@link Component#setTimeout}.\n *\n * - The callback is turned into a {@link Component~GenericCallback} (i.e.\n * bound to the component).\n *\n * - Automatic cancellation of the rAF callback is handled if the component\n * is disposed before it is called.\n *\n * @param {Component~GenericCallback} fn\n * A function that will be bound to this component and executed just\n * before the browser's next repaint.\n *\n * @return {number}\n * Returns an rAF ID that gets used to identify the timeout. It can\n * also be used in {@link Component#cancelAnimationFrame} to cancel\n * the animation frame callback.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame}\n */\n requestAnimationFrame(fn) {\n this.clearTimersOnDispose_();\n\n // declare as variables so they are properly available in rAF function\n // eslint-disable-next-line\n var id;\n fn = bind_(this, fn);\n id = global_window__WEBPACK_IMPORTED_MODULE_0___default().requestAnimationFrame(() => {\n if (this.rafIds_.has(id)) {\n this.rafIds_.delete(id);\n }\n fn();\n });\n this.rafIds_.add(id);\n return id;\n }\n\n /**\n * Request an animation frame, but only one named animation\n * frame will be queued. Another will never be added until\n * the previous one finishes.\n *\n * @param {string} name\n * The name to give this requestAnimationFrame\n *\n * @param {Component~GenericCallback} fn\n * A function that will be bound to this component and executed just\n * before the browser's next repaint.\n */\n requestNamedAnimationFrame(name, fn) {\n if (this.namedRafs_.has(name)) {\n return;\n }\n this.clearTimersOnDispose_();\n fn = bind_(this, fn);\n const id = this.requestAnimationFrame(() => {\n fn();\n if (this.namedRafs_.has(name)) {\n this.namedRafs_.delete(name);\n }\n });\n this.namedRafs_.set(name, id);\n return name;\n }\n\n /**\n * Cancels a current named animation frame if it exists.\n *\n * @param {string} name\n * The name of the requestAnimationFrame to cancel.\n */\n cancelNamedAnimationFrame(name) {\n if (!this.namedRafs_.has(name)) {\n return;\n }\n this.cancelAnimationFrame(this.namedRafs_.get(name));\n this.namedRafs_.delete(name);\n }\n\n /**\n * Cancels a queued callback passed to {@link Component#requestAnimationFrame}\n * (rAF).\n *\n * If you queue an rAF callback via {@link Component#requestAnimationFrame},\n * use this function instead of `window.cancelAnimationFrame`. If you don't,\n * your dispose listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} id\n * The rAF ID to clear. The return value of {@link Component#requestAnimationFrame}.\n *\n * @return {number}\n * Returns the rAF ID that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/cancelAnimationFrame}\n */\n cancelAnimationFrame(id) {\n if (this.rafIds_.has(id)) {\n this.rafIds_.delete(id);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().cancelAnimationFrame(id);\n }\n return id;\n }\n\n /**\n * A function to setup `requestAnimationFrame`, `setTimeout`,\n * and `setInterval`, clearing on dispose.\n *\n * > Previously each timer added and removed dispose listeners on it's own.\n * For better performance it was decided to batch them all, and use `Set`s\n * to track outstanding timer ids.\n *\n * @private\n */\n clearTimersOnDispose_() {\n if (this.clearingTimersOnDispose_) {\n return;\n }\n this.clearingTimersOnDispose_ = true;\n this.one('dispose', () => {\n [['namedRafs_', 'cancelNamedAnimationFrame'], ['rafIds_', 'cancelAnimationFrame'], ['setTimeoutIds_', 'clearTimeout'], ['setIntervalIds_', 'clearInterval']].forEach(([idName, cancelName]) => {\n // for a `Set` key will actually be the value again\n // so forEach((val, val) =>` but for maps we want to use\n // the key.\n this[idName].forEach((val, key) => this[cancelName](key));\n });\n this.clearingTimersOnDispose_ = false;\n });\n }\n\n /**\n * Register a `Component` with `videojs` given the name and the component.\n *\n * > NOTE: {@link Tech}s should not be registered as a `Component`. {@link Tech}s\n * should be registered using {@link Tech.registerTech} or\n * {@link videojs:videojs.registerTech}.\n *\n * > NOTE: This function can also be seen on videojs as\n * {@link videojs:videojs.registerComponent}.\n *\n * @param {string} name\n * The name of the `Component` to register.\n *\n * @param {Component} ComponentToRegister\n * The `Component` class to register.\n *\n * @return {Component}\n * The `Component` that was registered.\n */\n static registerComponent(name, ComponentToRegister) {\n if (typeof name !== 'string' || !name) {\n throw new Error(`Illegal component name, \"${name}\"; must be a non-empty string.`);\n }\n const Tech = Component$1.getComponent('Tech');\n\n // We need to make sure this check is only done if Tech has been registered.\n const isTech = Tech && Tech.isTech(ComponentToRegister);\n const isComp = Component$1 === ComponentToRegister || Component$1.prototype.isPrototypeOf(ComponentToRegister.prototype);\n if (isTech || !isComp) {\n let reason;\n if (isTech) {\n reason = 'techs must be registered using Tech.registerTech()';\n } else {\n reason = 'must be a Component subclass';\n }\n throw new Error(`Illegal component, \"${name}\"; ${reason}.`);\n }\n name = toTitleCase$1(name);\n if (!Component$1.components_) {\n Component$1.components_ = {};\n }\n const Player = Component$1.getComponent('Player');\n if (name === 'Player' && Player && Player.players) {\n const players = Player.players;\n const playerNames = Object.keys(players);\n\n // If we have players that were disposed, then their name will still be\n // in Players.players. So, we must loop through and verify that the value\n // for each item is not null. This allows registration of the Player component\n // after all players have been disposed or before any were created.\n if (players && playerNames.length > 0 && playerNames.map(pname => players[pname]).every(Boolean)) {\n throw new Error('Can not register Player component after player has been created.');\n }\n }\n Component$1.components_[name] = ComponentToRegister;\n Component$1.components_[toLowerCase(name)] = ComponentToRegister;\n return ComponentToRegister;\n }\n\n /**\n * Get a `Component` based on the name it was registered with.\n *\n * @param {string} name\n * The Name of the component to get.\n *\n * @return {typeof Component}\n * The `Component` that got registered under the given name.\n */\n static getComponent(name) {\n if (!name || !Component$1.components_) {\n return;\n }\n return Component$1.components_[name];\n }\n}\nComponent$1.registerComponent('Component', Component$1);\n\n/**\n * @file time.js\n * @module time\n */\n\n/**\n * Returns the time for the specified index at the start or end\n * of a TimeRange object.\n *\n * @typedef {Function} TimeRangeIndex\n *\n * @param {number} [index=0]\n * The range number to return the time for.\n *\n * @return {number}\n * The time offset at the specified index.\n *\n * @deprecated The index argument must be provided.\n * In the future, leaving it out will throw an error.\n */\n\n/**\n * An object that contains ranges of time, which mimics {@link TimeRanges}.\n *\n * @typedef {Object} TimeRange\n *\n * @property {number} length\n * The number of time ranges represented by this object.\n *\n * @property {module:time~TimeRangeIndex} start\n * Returns the time offset at which a specified time range begins.\n *\n * @property {module:time~TimeRangeIndex} end\n * Returns the time offset at which a specified time range ends.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges\n */\n\n/**\n * Check if any of the time ranges are over the maximum index.\n *\n * @private\n * @param {string} fnName\n * The function name to use for logging\n *\n * @param {number} index\n * The index to check\n *\n * @param {number} maxIndex\n * The maximum possible index\n *\n * @throws {Error} if the timeRanges provided are over the maxIndex\n */\nfunction rangeCheck(fnName, index, maxIndex) {\n if (typeof index !== 'number' || index < 0 || index > maxIndex) {\n throw new Error(`Failed to execute '${fnName}' on 'TimeRanges': The index provided (${index}) is non-numeric or out of bounds (0-${maxIndex}).`);\n }\n}\n\n/**\n * Get the time for the specified index at the start or end\n * of a TimeRange object.\n *\n * @private\n * @param {string} fnName\n * The function name to use for logging\n *\n * @param {string} valueIndex\n * The property that should be used to get the time. should be\n * 'start' or 'end'\n *\n * @param {Array} ranges\n * An array of time ranges\n *\n * @param {Array} [rangeIndex=0]\n * The index to start the search at\n *\n * @return {number}\n * The time that offset at the specified index.\n *\n * @deprecated rangeIndex must be set to a value, in the future this will throw an error.\n * @throws {Error} if rangeIndex is more than the length of ranges\n */\nfunction getRange(fnName, valueIndex, ranges, rangeIndex) {\n rangeCheck(fnName, rangeIndex, ranges.length - 1);\n return ranges[rangeIndex][valueIndex];\n}\n\n/**\n * Create a time range object given ranges of time.\n *\n * @private\n * @param {Array} [ranges]\n * An array of time ranges.\n *\n * @return {TimeRange}\n */\nfunction createTimeRangesObj(ranges) {\n let timeRangesObj;\n if (ranges === undefined || ranges.length === 0) {\n timeRangesObj = {\n length: 0,\n start() {\n throw new Error('This TimeRanges object is empty');\n },\n end() {\n throw new Error('This TimeRanges object is empty');\n }\n };\n } else {\n timeRangesObj = {\n length: ranges.length,\n start: getRange.bind(null, 'start', 0, ranges),\n end: getRange.bind(null, 'end', 1, ranges)\n };\n }\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().Symbol) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().Symbol).iterator) {\n timeRangesObj[(global_window__WEBPACK_IMPORTED_MODULE_0___default().Symbol).iterator] = () => (ranges || []).values();\n }\n return timeRangesObj;\n}\n\n/**\n * Create a `TimeRange` object which mimics an\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges|HTML5 TimeRanges instance}.\n *\n * @param {number|Array[]} start\n * The start of a single range (a number) or an array of ranges (an\n * array of arrays of two numbers each).\n *\n * @param {number} end\n * The end of a single range. Cannot be used with the array form of\n * the `start` argument.\n *\n * @return {TimeRange}\n */\nfunction createTimeRanges$1(start, end) {\n if (Array.isArray(start)) {\n return createTimeRangesObj(start);\n } else if (start === undefined || end === undefined) {\n return createTimeRangesObj();\n }\n return createTimeRangesObj([[start, end]]);\n}\n\n/**\n * Format seconds as a time string, H:MM:SS or M:SS. Supplying a guide (in\n * seconds) will force a number of leading zeros to cover the length of the\n * guide.\n *\n * @private\n * @param {number} seconds\n * Number of seconds to be turned into a string\n *\n * @param {number} guide\n * Number (in seconds) to model the string after\n *\n * @return {string}\n * Time formatted as H:MM:SS or M:SS\n */\nconst defaultImplementation = function (seconds, guide) {\n seconds = seconds < 0 ? 0 : seconds;\n let s = Math.floor(seconds % 60);\n let m = Math.floor(seconds / 60 % 60);\n let h = Math.floor(seconds / 3600);\n const gm = Math.floor(guide / 60 % 60);\n const gh = Math.floor(guide / 3600);\n\n // handle invalid times\n if (isNaN(seconds) || seconds === Infinity) {\n // '-' is false for all relational operators (e.g. <, >=) so this setting\n // will add the minimum number of fields specified by the guide\n h = m = s = '-';\n }\n\n // Check if we need to show hours\n h = h > 0 || gh > 0 ? h + ':' : '';\n\n // If hours are showing, we may need to add a leading zero.\n // Always show at least one digit of minutes.\n m = ((h || gm >= 10) && m < 10 ? '0' + m : m) + ':';\n\n // Check if leading zero is need for seconds\n s = s < 10 ? '0' + s : s;\n return h + m + s;\n};\n\n// Internal pointer to the current implementation.\nlet implementation = defaultImplementation;\n\n/**\n * Replaces the default formatTime implementation with a custom implementation.\n *\n * @param {Function} customImplementation\n * A function which will be used in place of the default formatTime\n * implementation. Will receive the current time in seconds and the\n * guide (in seconds) as arguments.\n */\nfunction setFormatTime(customImplementation) {\n implementation = customImplementation;\n}\n\n/**\n * Resets formatTime to the default implementation.\n */\nfunction resetFormatTime() {\n implementation = defaultImplementation;\n}\n\n/**\n * Delegates to either the default time formatting function or a custom\n * function supplied via `setFormatTime`.\n *\n * Formats seconds as a time string (H:MM:SS or M:SS). Supplying a\n * guide (in seconds) will force a number of leading zeros to cover the\n * length of the guide.\n *\n * @example formatTime(125, 600) === \"02:05\"\n * @param {number} seconds\n * Number of seconds to be turned into a string\n *\n * @param {number} guide\n * Number (in seconds) to model the string after\n *\n * @return {string}\n * Time formatted as H:MM:SS or M:SS\n */\nfunction formatTime(seconds, guide = seconds) {\n return implementation(seconds, guide);\n}\n\nvar Time = /*#__PURE__*/Object.freeze({\n __proto__: null,\n createTimeRanges: createTimeRanges$1,\n createTimeRange: createTimeRanges$1,\n setFormatTime: setFormatTime,\n resetFormatTime: resetFormatTime,\n formatTime: formatTime\n});\n\n/**\n * @file buffer.js\n * @module buffer\n */\n\n/**\n * Compute the percentage of the media that has been buffered.\n *\n * @param { import('./time').TimeRange } buffered\n * The current `TimeRanges` object representing buffered time ranges\n *\n * @param {number} duration\n * Total duration of the media\n *\n * @return {number}\n * Percent buffered of the total duration in decimal form.\n */\nfunction bufferedPercent(buffered, duration) {\n let bufferedDuration = 0;\n let start;\n let end;\n if (!duration) {\n return 0;\n }\n if (!buffered || !buffered.length) {\n buffered = createTimeRanges$1(0, 0);\n }\n for (let i = 0; i < buffered.length; i++) {\n start = buffered.start(i);\n end = buffered.end(i);\n\n // buffered end can be bigger than duration by a very small fraction\n if (end > duration) {\n end = duration;\n }\n bufferedDuration += end - start;\n }\n return bufferedDuration / duration;\n}\n\n/**\n * @file media-error.js\n */\n\n/**\n * A Custom `MediaError` class which mimics the standard HTML5 `MediaError` class.\n *\n * @param {number|string|Object|MediaError} value\n * This can be of multiple types:\n * - number: should be a standard error code\n * - string: an error message (the code will be 0)\n * - Object: arbitrary properties\n * - `MediaError` (native): used to populate a video.js `MediaError` object\n * - `MediaError` (video.js): will return itself if it's already a\n * video.js `MediaError` object.\n *\n * @see [MediaError Spec]{@link https://dev.w3.org/html5/spec-author-view/video.html#mediaerror}\n * @see [Encrypted MediaError Spec]{@link https://www.w3.org/TR/2013/WD-encrypted-media-20130510/#error-codes}\n *\n * @class MediaError\n */\nfunction MediaError(value) {\n // Allow redundant calls to this constructor to avoid having `instanceof`\n // checks peppered around the code.\n if (value instanceof MediaError) {\n return value;\n }\n if (typeof value === 'number') {\n this.code = value;\n } else if (typeof value === 'string') {\n // default code is zero, so this is a custom error\n this.message = value;\n } else if (isObject(value)) {\n // We assign the `code` property manually because native `MediaError` objects\n // do not expose it as an own/enumerable property of the object.\n if (typeof value.code === 'number') {\n this.code = value.code;\n }\n Object.assign(this, value);\n }\n if (!this.message) {\n this.message = MediaError.defaultMessages[this.code] || '';\n }\n}\n\n/**\n * The error code that refers two one of the defined `MediaError` types\n *\n * @type {Number}\n */\nMediaError.prototype.code = 0;\n\n/**\n * An optional message that to show with the error. Message is not part of the HTML5\n * video spec but allows for more informative custom errors.\n *\n * @type {String}\n */\nMediaError.prototype.message = '';\n\n/**\n * An optional status code that can be set by plugins to allow even more detail about\n * the error. For example a plugin might provide a specific HTTP status code and an\n * error message for that code. Then when the plugin gets that error this class will\n * know how to display an error message for it. This allows a custom message to show\n * up on the `Player` error overlay.\n *\n * @type {Array}\n */\nMediaError.prototype.status = null;\n\n/**\n * Errors indexed by the W3C standard. The order **CANNOT CHANGE**! See the\n * specification listed under {@link MediaError} for more information.\n *\n * @enum {array}\n * @readonly\n * @property {string} 0 - MEDIA_ERR_CUSTOM\n * @property {string} 1 - MEDIA_ERR_ABORTED\n * @property {string} 2 - MEDIA_ERR_NETWORK\n * @property {string} 3 - MEDIA_ERR_DECODE\n * @property {string} 4 - MEDIA_ERR_SRC_NOT_SUPPORTED\n * @property {string} 5 - MEDIA_ERR_ENCRYPTED\n */\nMediaError.errorTypes = ['MEDIA_ERR_CUSTOM', 'MEDIA_ERR_ABORTED', 'MEDIA_ERR_NETWORK', 'MEDIA_ERR_DECODE', 'MEDIA_ERR_SRC_NOT_SUPPORTED', 'MEDIA_ERR_ENCRYPTED'];\n\n/**\n * The default `MediaError` messages based on the {@link MediaError.errorTypes}.\n *\n * @type {Array}\n * @constant\n */\nMediaError.defaultMessages = {\n 1: 'You aborted the media playback',\n 2: 'A network error caused the media download to fail part-way.',\n 3: 'The media playback was aborted due to a corruption problem or because the media used features your browser did not support.',\n 4: 'The media could not be loaded, either because the server or network failed or because the format is not supported.',\n 5: 'The media is encrypted and we do not have the keys to decrypt it.'\n};\n\n// Add types as properties on MediaError\n// e.g. MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = 4;\nfor (let errNum = 0; errNum < MediaError.errorTypes.length; errNum++) {\n MediaError[MediaError.errorTypes[errNum]] = errNum;\n // values should be accessible on both the class and instance\n MediaError.prototype[MediaError.errorTypes[errNum]] = errNum;\n}\n\n/**\n * Returns whether an object is `Promise`-like (i.e. has a `then` method).\n *\n * @param {Object} value\n * An object that may or may not be `Promise`-like.\n *\n * @return {boolean}\n * Whether or not the object is `Promise`-like.\n */\nfunction isPromise(value) {\n return value !== undefined && value !== null && typeof value.then === 'function';\n}\n\n/**\n * Silence a Promise-like object.\n *\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n *\n * @param {Object} value\n * An object that may or may not be `Promise`-like.\n */\nfunction silencePromise(value) {\n if (isPromise(value)) {\n value.then(null, e => {});\n }\n}\n\n/**\n * @file text-track-list-converter.js Utilities for capturing text track state and\n * re-creating tracks based on a capture.\n *\n * @module text-track-list-converter\n */\n\n/**\n * Examine a single {@link TextTrack} and return a JSON-compatible javascript object that\n * represents the {@link TextTrack}'s state.\n *\n * @param {TextTrack} track\n * The text track to query.\n *\n * @return {Object}\n * A serializable javascript representation of the TextTrack.\n * @private\n */\nconst trackToJson_ = function (track) {\n const ret = ['kind', 'label', 'language', 'id', 'inBandMetadataTrackDispatchType', 'mode', 'src'].reduce((acc, prop, i) => {\n if (track[prop]) {\n acc[prop] = track[prop];\n }\n return acc;\n }, {\n cues: track.cues && Array.prototype.map.call(track.cues, function (cue) {\n return {\n startTime: cue.startTime,\n endTime: cue.endTime,\n text: cue.text,\n id: cue.id\n };\n })\n });\n return ret;\n};\n\n/**\n * Examine a {@link Tech} and return a JSON-compatible javascript array that represents the\n * state of all {@link TextTrack}s currently configured. The return array is compatible with\n * {@link text-track-list-converter:jsonToTextTracks}.\n *\n * @param { import('../tech/tech').default } tech\n * The tech object to query\n *\n * @return {Array}\n * A serializable javascript representation of the {@link Tech}s\n * {@link TextTrackList}.\n */\nconst textTracksToJson = function (tech) {\n const trackEls = tech.$$('track');\n const trackObjs = Array.prototype.map.call(trackEls, t => t.track);\n const tracks = Array.prototype.map.call(trackEls, function (trackEl) {\n const json = trackToJson_(trackEl.track);\n if (trackEl.src) {\n json.src = trackEl.src;\n }\n return json;\n });\n return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function (track) {\n return trackObjs.indexOf(track) === -1;\n }).map(trackToJson_));\n};\n\n/**\n * Create a set of remote {@link TextTrack}s on a {@link Tech} based on an array of javascript\n * object {@link TextTrack} representations.\n *\n * @param {Array} json\n * An array of `TextTrack` representation objects, like those that would be\n * produced by `textTracksToJson`.\n *\n * @param {Tech} tech\n * The `Tech` to create the `TextTrack`s on.\n */\nconst jsonToTextTracks = function (json, tech) {\n json.forEach(function (track) {\n const addedTrack = tech.addRemoteTextTrack(track).track;\n if (!track.src && track.cues) {\n track.cues.forEach(cue => addedTrack.addCue(cue));\n }\n });\n return tech.textTracks();\n};\nvar textTrackConverter = {\n textTracksToJson,\n jsonToTextTracks,\n trackToJson_\n};\n\n/**\n * @file modal-dialog.js\n */\nconst MODAL_CLASS_NAME = 'vjs-modal-dialog';\n\n/**\n * The `ModalDialog` displays over the video and its controls, which blocks\n * interaction with the player until it is closed.\n *\n * Modal dialogs include a \"Close\" button and will close when that button\n * is activated - or when ESC is pressed anywhere.\n *\n * @extends Component\n */\nclass ModalDialog extends Component$1 {\n /**\n * Create an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param { import('./utils/dom').ContentDescriptor} [options.content=undefined]\n * Provide customized content for this modal.\n *\n * @param {string} [options.description]\n * A text description for the modal, primarily for accessibility.\n *\n * @param {boolean} [options.fillAlways=false]\n * Normally, modals are automatically filled only the first time\n * they open. This tells the modal to refresh its content\n * every time it opens.\n *\n * @param {string} [options.label]\n * A text label for the modal, primarily for accessibility.\n *\n * @param {boolean} [options.pauseOnOpen=true]\n * If `true`, playback will will be paused if playing when\n * the modal opens, and resumed when it closes.\n *\n * @param {boolean} [options.temporary=true]\n * If `true`, the modal can only be opened once; it will be\n * disposed as soon as it's closed.\n *\n * @param {boolean} [options.uncloseable=false]\n * If `true`, the user will not be able to close the modal\n * through the UI in the normal ways. Programmatic closing is\n * still possible.\n */\n constructor(player, options) {\n super(player, options);\n this.handleKeyDown_ = e => this.handleKeyDown(e);\n this.close_ = e => this.close(e);\n this.opened_ = this.hasBeenOpened_ = this.hasBeenFilled_ = false;\n this.closeable(!this.options_.uncloseable);\n this.content(this.options_.content);\n\n // Make sure the contentEl is defined AFTER any children are initialized\n // because we only want the contents of the modal in the contentEl\n // (not the UI elements like the close button).\n this.contentEl_ = createEl('div', {\n className: `${MODAL_CLASS_NAME}-content`\n }, {\n role: 'document'\n });\n this.descEl_ = createEl('p', {\n className: `${MODAL_CLASS_NAME}-description vjs-control-text`,\n id: this.el().getAttribute('aria-describedby')\n });\n textContent(this.descEl_, this.description());\n this.el_.appendChild(this.descEl_);\n this.el_.appendChild(this.contentEl_);\n }\n\n /**\n * Create the `ModalDialog`'s DOM element\n *\n * @return {Element}\n * The DOM element that gets created.\n */\n createEl() {\n return super.createEl('div', {\n className: this.buildCSSClass(),\n tabIndex: -1\n }, {\n 'aria-describedby': `${this.id()}_description`,\n 'aria-hidden': 'true',\n 'aria-label': this.label(),\n 'role': 'dialog'\n });\n }\n dispose() {\n this.contentEl_ = null;\n this.descEl_ = null;\n this.previouslyActiveEl_ = null;\n super.dispose();\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `${MODAL_CLASS_NAME} vjs-hidden ${super.buildCSSClass()}`;\n }\n\n /**\n * Returns the label string for this modal. Primarily used for accessibility.\n *\n * @return {string}\n * the localized or raw label of this modal.\n */\n label() {\n return this.localize(this.options_.label || 'Modal Window');\n }\n\n /**\n * Returns the description string for this modal. Primarily used for\n * accessibility.\n *\n * @return {string}\n * The localized or raw description of this modal.\n */\n description() {\n let desc = this.options_.description || this.localize('This is a modal window.');\n\n // Append a universal closeability message if the modal is closeable.\n if (this.closeable()) {\n desc += ' ' + this.localize('This modal can be closed by pressing the Escape key or activating the close button.');\n }\n return desc;\n }\n\n /**\n * Opens the modal.\n *\n * @fires ModalDialog#beforemodalopen\n * @fires ModalDialog#modalopen\n */\n open() {\n if (!this.opened_) {\n const player = this.player();\n\n /**\n * Fired just before a `ModalDialog` is opened.\n *\n * @event ModalDialog#beforemodalopen\n * @type {Event}\n */\n this.trigger('beforemodalopen');\n this.opened_ = true;\n\n // Fill content if the modal has never opened before and\n // never been filled.\n if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {\n this.fill();\n }\n\n // If the player was playing, pause it and take note of its previously\n // playing state.\n this.wasPlaying_ = !player.paused();\n if (this.options_.pauseOnOpen && this.wasPlaying_) {\n player.pause();\n }\n this.on('keydown', this.handleKeyDown_);\n\n // Hide controls and note if they were enabled.\n this.hadControls_ = player.controls();\n player.controls(false);\n this.show();\n this.conditionalFocus_();\n this.el().setAttribute('aria-hidden', 'false');\n\n /**\n * Fired just after a `ModalDialog` is opened.\n *\n * @event ModalDialog#modalopen\n * @type {Event}\n */\n this.trigger('modalopen');\n this.hasBeenOpened_ = true;\n }\n }\n\n /**\n * If the `ModalDialog` is currently open or closed.\n *\n * @param {boolean} [value]\n * If given, it will open (`true`) or close (`false`) the modal.\n *\n * @return {boolean}\n * the current open state of the modaldialog\n */\n opened(value) {\n if (typeof value === 'boolean') {\n this[value ? 'open' : 'close']();\n }\n return this.opened_;\n }\n\n /**\n * Closes the modal, does nothing if the `ModalDialog` is\n * not open.\n *\n * @fires ModalDialog#beforemodalclose\n * @fires ModalDialog#modalclose\n */\n close() {\n if (!this.opened_) {\n return;\n }\n const player = this.player();\n\n /**\n * Fired just before a `ModalDialog` is closed.\n *\n * @event ModalDialog#beforemodalclose\n * @type {Event}\n */\n this.trigger('beforemodalclose');\n this.opened_ = false;\n if (this.wasPlaying_ && this.options_.pauseOnOpen) {\n player.play();\n }\n this.off('keydown', this.handleKeyDown_);\n if (this.hadControls_) {\n player.controls(true);\n }\n this.hide();\n this.el().setAttribute('aria-hidden', 'true');\n\n /**\n * Fired just after a `ModalDialog` is closed.\n *\n * @event ModalDialog#modalclose\n * @type {Event}\n */\n this.trigger('modalclose');\n this.conditionalBlur_();\n if (this.options_.temporary) {\n this.dispose();\n }\n }\n\n /**\n * Check to see if the `ModalDialog` is closeable via the UI.\n *\n * @param {boolean} [value]\n * If given as a boolean, it will set the `closeable` option.\n *\n * @return {boolean}\n * Returns the final value of the closable option.\n */\n closeable(value) {\n if (typeof value === 'boolean') {\n const closeable = this.closeable_ = !!value;\n let close = this.getChild('closeButton');\n\n // If this is being made closeable and has no close button, add one.\n if (closeable && !close) {\n // The close button should be a child of the modal - not its\n // content element, so temporarily change the content element.\n const temp = this.contentEl_;\n this.contentEl_ = this.el_;\n close = this.addChild('closeButton', {\n controlText: 'Close Modal Dialog'\n });\n this.contentEl_ = temp;\n this.on(close, 'close', this.close_);\n }\n\n // If this is being made uncloseable and has a close button, remove it.\n if (!closeable && close) {\n this.off(close, 'close', this.close_);\n this.removeChild(close);\n close.dispose();\n }\n }\n return this.closeable_;\n }\n\n /**\n * Fill the modal's content element with the modal's \"content\" option.\n * The content element will be emptied before this change takes place.\n */\n fill() {\n this.fillWith(this.content());\n }\n\n /**\n * Fill the modal's content element with arbitrary content.\n * The content element will be emptied before this change takes place.\n *\n * @fires ModalDialog#beforemodalfill\n * @fires ModalDialog#modalfill\n *\n * @param { import('./utils/dom').ContentDescriptor} [content]\n * The same rules apply to this as apply to the `content` option.\n */\n fillWith(content) {\n const contentEl = this.contentEl();\n const parentEl = contentEl.parentNode;\n const nextSiblingEl = contentEl.nextSibling;\n\n /**\n * Fired just before a `ModalDialog` is filled with content.\n *\n * @event ModalDialog#beforemodalfill\n * @type {Event}\n */\n this.trigger('beforemodalfill');\n this.hasBeenFilled_ = true;\n\n // Detach the content element from the DOM before performing\n // manipulation to avoid modifying the live DOM multiple times.\n parentEl.removeChild(contentEl);\n this.empty();\n insertContent(contentEl, content);\n /**\n * Fired just after a `ModalDialog` is filled with content.\n *\n * @event ModalDialog#modalfill\n * @type {Event}\n */\n this.trigger('modalfill');\n\n // Re-inject the re-filled content element.\n if (nextSiblingEl) {\n parentEl.insertBefore(contentEl, nextSiblingEl);\n } else {\n parentEl.appendChild(contentEl);\n }\n\n // make sure that the close button is last in the dialog DOM\n const closeButton = this.getChild('closeButton');\n if (closeButton) {\n parentEl.appendChild(closeButton.el_);\n }\n }\n\n /**\n * Empties the content element. This happens anytime the modal is filled.\n *\n * @fires ModalDialog#beforemodalempty\n * @fires ModalDialog#modalempty\n */\n empty() {\n /**\n * Fired just before a `ModalDialog` is emptied.\n *\n * @event ModalDialog#beforemodalempty\n * @type {Event}\n */\n this.trigger('beforemodalempty');\n emptyEl(this.contentEl());\n\n /**\n * Fired just after a `ModalDialog` is emptied.\n *\n * @event ModalDialog#modalempty\n * @type {Event}\n */\n this.trigger('modalempty');\n }\n\n /**\n * Gets or sets the modal content, which gets normalized before being\n * rendered into the DOM.\n *\n * This does not update the DOM or fill the modal, but it is called during\n * that process.\n *\n * @param { import('./utils/dom').ContentDescriptor} [value]\n * If defined, sets the internal content value to be used on the\n * next call(s) to `fill`. This value is normalized before being\n * inserted. To \"clear\" the internal content value, pass `null`.\n *\n * @return { import('./utils/dom').ContentDescriptor}\n * The current content of the modal dialog\n */\n content(value) {\n if (typeof value !== 'undefined') {\n this.content_ = value;\n }\n return this.content_;\n }\n\n /**\n * conditionally focus the modal dialog if focus was previously on the player.\n *\n * @private\n */\n conditionalFocus_() {\n const activeEl = (global_document__WEBPACK_IMPORTED_MODULE_1___default().activeElement);\n const playerEl = this.player_.el_;\n this.previouslyActiveEl_ = null;\n if (playerEl.contains(activeEl) || playerEl === activeEl) {\n this.previouslyActiveEl_ = activeEl;\n this.focus();\n }\n }\n\n /**\n * conditionally blur the element and refocus the last focused element\n *\n * @private\n */\n conditionalBlur_() {\n if (this.previouslyActiveEl_) {\n this.previouslyActiveEl_.focus();\n this.previouslyActiveEl_ = null;\n }\n }\n\n /**\n * Keydown handler. Attached when modal is focused.\n *\n * @listens keydown\n */\n handleKeyDown(event) {\n // Do not allow keydowns to reach out of the modal dialog.\n event.stopPropagation();\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Escape') && this.closeable()) {\n event.preventDefault();\n this.close();\n return;\n }\n\n // exit early if it isn't a tab key\n if (!keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Tab')) {\n return;\n }\n const focusableEls = this.focusableEls_();\n const activeEl = this.el_.querySelector(':focus');\n let focusIndex;\n for (let i = 0; i < focusableEls.length; i++) {\n if (activeEl === focusableEls[i]) {\n focusIndex = i;\n break;\n }\n }\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default().activeElement) === this.el_) {\n focusIndex = 0;\n }\n if (event.shiftKey && focusIndex === 0) {\n focusableEls[focusableEls.length - 1].focus();\n event.preventDefault();\n } else if (!event.shiftKey && focusIndex === focusableEls.length - 1) {\n focusableEls[0].focus();\n event.preventDefault();\n }\n }\n\n /**\n * get all focusable elements\n *\n * @private\n */\n focusableEls_() {\n const allChildren = this.el_.querySelectorAll('*');\n return Array.prototype.filter.call(allChildren, child => {\n return (child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLAnchorElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLAreaElement)) && child.hasAttribute('href') || (child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLInputElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLSelectElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLTextAreaElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLButtonElement)) && !child.hasAttribute('disabled') || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLIFrameElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLObjectElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLEmbedElement) || child.hasAttribute('tabindex') && child.getAttribute('tabindex') !== -1 || child.hasAttribute('contenteditable');\n });\n }\n}\n\n/**\n * Default options for `ModalDialog` default options.\n *\n * @type {Object}\n * @private\n */\nModalDialog.prototype.options_ = {\n pauseOnOpen: true,\n temporary: true\n};\nComponent$1.registerComponent('ModalDialog', ModalDialog);\n\n/**\n * @file track-list.js\n */\n\n/**\n * Common functionaliy between {@link TextTrackList}, {@link AudioTrackList}, and\n * {@link VideoTrackList}\n *\n * @extends EventTarget\n */\nclass TrackList extends EventTarget$2 {\n /**\n * Create an instance of this class\n *\n * @param { import('./track').default[] } tracks\n * A list of tracks to initialize the list with.\n *\n * @abstract\n */\n constructor(tracks = []) {\n super();\n this.tracks_ = [];\n\n /**\n * @memberof TrackList\n * @member {number} length\n * The current number of `Track`s in the this Trackist.\n * @instance\n */\n Object.defineProperty(this, 'length', {\n get() {\n return this.tracks_.length;\n }\n });\n for (let i = 0; i < tracks.length; i++) {\n this.addTrack(tracks[i]);\n }\n }\n\n /**\n * Add a {@link Track} to the `TrackList`\n *\n * @param { import('./track').default } track\n * The audio, video, or text track to add to the list.\n *\n * @fires TrackList#addtrack\n */\n addTrack(track) {\n const index = this.tracks_.length;\n if (!('' + index in this)) {\n Object.defineProperty(this, index, {\n get() {\n return this.tracks_[index];\n }\n });\n }\n\n // Do not add duplicate tracks\n if (this.tracks_.indexOf(track) === -1) {\n this.tracks_.push(track);\n /**\n * Triggered when a track is added to a track list.\n *\n * @event TrackList#addtrack\n * @type {Event}\n * @property {Track} track\n * A reference to track that was added.\n */\n this.trigger({\n track,\n type: 'addtrack',\n target: this\n });\n }\n\n /**\n * Triggered when a track label is changed.\n *\n * @event TrackList#addtrack\n * @type {Event}\n * @property {Track} track\n * A reference to track that was added.\n */\n track.labelchange_ = () => {\n this.trigger({\n track,\n type: 'labelchange',\n target: this\n });\n };\n if (isEvented(track)) {\n track.addEventListener('labelchange', track.labelchange_);\n }\n }\n\n /**\n * Remove a {@link Track} from the `TrackList`\n *\n * @param { import('./track').default } rtrack\n * The audio, video, or text track to remove from the list.\n *\n * @fires TrackList#removetrack\n */\n removeTrack(rtrack) {\n let track;\n for (let i = 0, l = this.length; i < l; i++) {\n if (this[i] === rtrack) {\n track = this[i];\n if (track.off) {\n track.off();\n }\n this.tracks_.splice(i, 1);\n break;\n }\n }\n if (!track) {\n return;\n }\n\n /**\n * Triggered when a track is removed from track list.\n *\n * @event TrackList#removetrack\n * @type {Event}\n * @property {Track} track\n * A reference to track that was removed.\n */\n this.trigger({\n track,\n type: 'removetrack',\n target: this\n });\n }\n\n /**\n * Get a Track from the TrackList by a tracks id\n *\n * @param {string} id - the id of the track to get\n * @method getTrackById\n * @return { import('./track').default }\n * @private\n */\n getTrackById(id) {\n let result = null;\n for (let i = 0, l = this.length; i < l; i++) {\n const track = this[i];\n if (track.id === id) {\n result = track;\n break;\n }\n }\n return result;\n }\n}\n\n/**\n * Triggered when a different track is selected/enabled.\n *\n * @event TrackList#change\n * @type {Event}\n */\n\n/**\n * Events that can be called with on + eventName. See {@link EventHandler}.\n *\n * @property {Object} TrackList#allowedEvents_\n * @protected\n */\nTrackList.prototype.allowedEvents_ = {\n change: 'change',\n addtrack: 'addtrack',\n removetrack: 'removetrack',\n labelchange: 'labelchange'\n};\n\n// emulate attribute EventHandler support to allow for feature detection\nfor (const event in TrackList.prototype.allowedEvents_) {\n TrackList.prototype['on' + event] = null;\n}\n\n/**\n * @file audio-track-list.js\n */\n\n/**\n * Anywhere we call this function we diverge from the spec\n * as we only support one enabled audiotrack at a time\n *\n * @param {AudioTrackList} list\n * list to work on\n *\n * @param { import('./audio-track').default } track\n * The track to skip\n *\n * @private\n */\nconst disableOthers$1 = function (list, track) {\n for (let i = 0; i < list.length; i++) {\n if (!Object.keys(list[i]).length || track.id === list[i].id) {\n continue;\n }\n // another audio track is enabled, disable it\n list[i].enabled = false;\n }\n};\n\n/**\n * The current list of {@link AudioTrack} for a media file.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist}\n * @extends TrackList\n */\nclass AudioTrackList extends TrackList {\n /**\n * Create an instance of this class.\n *\n * @param { import('./audio-track').default[] } [tracks=[]]\n * A list of `AudioTrack` to instantiate the list with.\n */\n constructor(tracks = []) {\n // make sure only 1 track is enabled\n // sorted from last index to first index\n for (let i = tracks.length - 1; i >= 0; i--) {\n if (tracks[i].enabled) {\n disableOthers$1(tracks, tracks[i]);\n break;\n }\n }\n super(tracks);\n this.changing_ = false;\n }\n\n /**\n * Add an {@link AudioTrack} to the `AudioTrackList`.\n *\n * @param { import('./audio-track').default } track\n * The AudioTrack to add to the list\n *\n * @fires TrackList#addtrack\n */\n addTrack(track) {\n if (track.enabled) {\n disableOthers$1(this, track);\n }\n super.addTrack(track);\n // native tracks don't have this\n if (!track.addEventListener) {\n return;\n }\n track.enabledChange_ = () => {\n // when we are disabling other tracks (since we don't support\n // more than one track at a time) we will set changing_\n // to true so that we don't trigger additional change events\n if (this.changing_) {\n return;\n }\n this.changing_ = true;\n disableOthers$1(this, track);\n this.changing_ = false;\n this.trigger('change');\n };\n\n /**\n * @listens AudioTrack#enabledchange\n * @fires TrackList#change\n */\n track.addEventListener('enabledchange', track.enabledChange_);\n }\n removeTrack(rtrack) {\n super.removeTrack(rtrack);\n if (rtrack.removeEventListener && rtrack.enabledChange_) {\n rtrack.removeEventListener('enabledchange', rtrack.enabledChange_);\n rtrack.enabledChange_ = null;\n }\n }\n}\n\n/**\n * @file video-track-list.js\n */\n\n/**\n * Un-select all other {@link VideoTrack}s that are selected.\n *\n * @param {VideoTrackList} list\n * list to work on\n *\n * @param { import('./video-track').default } track\n * The track to skip\n *\n * @private\n */\nconst disableOthers = function (list, track) {\n for (let i = 0; i < list.length; i++) {\n if (!Object.keys(list[i]).length || track.id === list[i].id) {\n continue;\n }\n // another video track is enabled, disable it\n list[i].selected = false;\n }\n};\n\n/**\n * The current list of {@link VideoTrack} for a video.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist}\n * @extends TrackList\n */\nclass VideoTrackList extends TrackList {\n /**\n * Create an instance of this class.\n *\n * @param {VideoTrack[]} [tracks=[]]\n * A list of `VideoTrack` to instantiate the list with.\n */\n constructor(tracks = []) {\n // make sure only 1 track is enabled\n // sorted from last index to first index\n for (let i = tracks.length - 1; i >= 0; i--) {\n if (tracks[i].selected) {\n disableOthers(tracks, tracks[i]);\n break;\n }\n }\n super(tracks);\n this.changing_ = false;\n\n /**\n * @member {number} VideoTrackList#selectedIndex\n * The current index of the selected {@link VideoTrack`}.\n */\n Object.defineProperty(this, 'selectedIndex', {\n get() {\n for (let i = 0; i < this.length; i++) {\n if (this[i].selected) {\n return i;\n }\n }\n return -1;\n },\n set() {}\n });\n }\n\n /**\n * Add a {@link VideoTrack} to the `VideoTrackList`.\n *\n * @param { import('./video-track').default } track\n * The VideoTrack to add to the list\n *\n * @fires TrackList#addtrack\n */\n addTrack(track) {\n if (track.selected) {\n disableOthers(this, track);\n }\n super.addTrack(track);\n // native tracks don't have this\n if (!track.addEventListener) {\n return;\n }\n track.selectedChange_ = () => {\n if (this.changing_) {\n return;\n }\n this.changing_ = true;\n disableOthers(this, track);\n this.changing_ = false;\n this.trigger('change');\n };\n\n /**\n * @listens VideoTrack#selectedchange\n * @fires TrackList#change\n */\n track.addEventListener('selectedchange', track.selectedChange_);\n }\n removeTrack(rtrack) {\n super.removeTrack(rtrack);\n if (rtrack.removeEventListener && rtrack.selectedChange_) {\n rtrack.removeEventListener('selectedchange', rtrack.selectedChange_);\n rtrack.selectedChange_ = null;\n }\n }\n}\n\n/**\n * @file text-track-list.js\n */\n\n/**\n * The current list of {@link TextTrack} for a media file.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttracklist}\n * @extends TrackList\n */\nclass TextTrackList extends TrackList {\n /**\n * Add a {@link TextTrack} to the `TextTrackList`\n *\n * @param { import('./text-track').default } track\n * The text track to add to the list.\n *\n * @fires TrackList#addtrack\n */\n addTrack(track) {\n super.addTrack(track);\n if (!this.queueChange_) {\n this.queueChange_ = () => this.queueTrigger('change');\n }\n if (!this.triggerSelectedlanguagechange) {\n this.triggerSelectedlanguagechange_ = () => this.trigger('selectedlanguagechange');\n }\n\n /**\n * @listens TextTrack#modechange\n * @fires TrackList#change\n */\n track.addEventListener('modechange', this.queueChange_);\n const nonLanguageTextTrackKind = ['metadata', 'chapters'];\n if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) {\n track.addEventListener('modechange', this.triggerSelectedlanguagechange_);\n }\n }\n removeTrack(rtrack) {\n super.removeTrack(rtrack);\n\n // manually remove the event handlers we added\n if (rtrack.removeEventListener) {\n if (this.queueChange_) {\n rtrack.removeEventListener('modechange', this.queueChange_);\n }\n if (this.selectedlanguagechange_) {\n rtrack.removeEventListener('modechange', this.triggerSelectedlanguagechange_);\n }\n }\n }\n}\n\n/**\n * @file html-track-element-list.js\n */\n\n/**\n * The current list of {@link HtmlTrackElement}s.\n */\nclass HtmlTrackElementList {\n /**\n * Create an instance of this class.\n *\n * @param {HtmlTrackElement[]} [tracks=[]]\n * A list of `HtmlTrackElement` to instantiate the list with.\n */\n constructor(trackElements = []) {\n this.trackElements_ = [];\n\n /**\n * @memberof HtmlTrackElementList\n * @member {number} length\n * The current number of `Track`s in the this Trackist.\n * @instance\n */\n Object.defineProperty(this, 'length', {\n get() {\n return this.trackElements_.length;\n }\n });\n for (let i = 0, length = trackElements.length; i < length; i++) {\n this.addTrackElement_(trackElements[i]);\n }\n }\n\n /**\n * Add an {@link HtmlTrackElement} to the `HtmlTrackElementList`\n *\n * @param {HtmlTrackElement} trackElement\n * The track element to add to the list.\n *\n * @private\n */\n addTrackElement_(trackElement) {\n const index = this.trackElements_.length;\n if (!('' + index in this)) {\n Object.defineProperty(this, index, {\n get() {\n return this.trackElements_[index];\n }\n });\n }\n\n // Do not add duplicate elements\n if (this.trackElements_.indexOf(trackElement) === -1) {\n this.trackElements_.push(trackElement);\n }\n }\n\n /**\n * Get an {@link HtmlTrackElement} from the `HtmlTrackElementList` given an\n * {@link TextTrack}.\n *\n * @param {TextTrack} track\n * The track associated with a track element.\n *\n * @return {HtmlTrackElement|undefined}\n * The track element that was found or undefined.\n *\n * @private\n */\n getTrackElementByTrack_(track) {\n let trackElement_;\n for (let i = 0, length = this.trackElements_.length; i < length; i++) {\n if (track === this.trackElements_[i].track) {\n trackElement_ = this.trackElements_[i];\n break;\n }\n }\n return trackElement_;\n }\n\n /**\n * Remove a {@link HtmlTrackElement} from the `HtmlTrackElementList`\n *\n * @param {HtmlTrackElement} trackElement\n * The track element to remove from the list.\n *\n * @private\n */\n removeTrackElement_(trackElement) {\n for (let i = 0, length = this.trackElements_.length; i < length; i++) {\n if (trackElement === this.trackElements_[i]) {\n if (this.trackElements_[i].track && typeof this.trackElements_[i].track.off === 'function') {\n this.trackElements_[i].track.off();\n }\n if (typeof this.trackElements_[i].off === 'function') {\n this.trackElements_[i].off();\n }\n this.trackElements_.splice(i, 1);\n break;\n }\n }\n }\n}\n\n/**\n * @file text-track-cue-list.js\n */\n\n/**\n * @typedef {Object} TextTrackCueList~TextTrackCue\n *\n * @property {string} id\n * The unique id for this text track cue\n *\n * @property {number} startTime\n * The start time for this text track cue\n *\n * @property {number} endTime\n * The end time for this text track cue\n *\n * @property {boolean} pauseOnExit\n * Pause when the end time is reached if true.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcue}\n */\n\n/**\n * A List of TextTrackCues.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcuelist}\n */\nclass TextTrackCueList {\n /**\n * Create an instance of this class..\n *\n * @param {Array} cues\n * A list of cues to be initialized with\n */\n constructor(cues) {\n TextTrackCueList.prototype.setCues_.call(this, cues);\n\n /**\n * @memberof TextTrackCueList\n * @member {number} length\n * The current number of `TextTrackCue`s in the TextTrackCueList.\n * @instance\n */\n Object.defineProperty(this, 'length', {\n get() {\n return this.length_;\n }\n });\n }\n\n /**\n * A setter for cues in this list. Creates getters\n * an an index for the cues.\n *\n * @param {Array} cues\n * An array of cues to set\n *\n * @private\n */\n setCues_(cues) {\n const oldLength = this.length || 0;\n let i = 0;\n const l = cues.length;\n this.cues_ = cues;\n this.length_ = cues.length;\n const defineProp = function (index) {\n if (!('' + index in this)) {\n Object.defineProperty(this, '' + index, {\n get() {\n return this.cues_[index];\n }\n });\n }\n };\n if (oldLength < l) {\n i = oldLength;\n for (; i < l; i++) {\n defineProp.call(this, i);\n }\n }\n }\n\n /**\n * Get a `TextTrackCue` that is currently in the `TextTrackCueList` by id.\n *\n * @param {string} id\n * The id of the cue that should be searched for.\n *\n * @return {TextTrackCueList~TextTrackCue|null}\n * A single cue or null if none was found.\n */\n getCueById(id) {\n let result = null;\n for (let i = 0, l = this.length; i < l; i++) {\n const cue = this[i];\n if (cue.id === id) {\n result = cue;\n break;\n }\n }\n return result;\n }\n}\n\n/**\n * @file track-kinds.js\n */\n\n/**\n * All possible `VideoTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-videotrack-kind\n * @typedef VideoTrack~Kind\n * @enum\n */\nconst VideoTrackKind = {\n alternative: 'alternative',\n captions: 'captions',\n main: 'main',\n sign: 'sign',\n subtitles: 'subtitles',\n commentary: 'commentary'\n};\n\n/**\n * All possible `AudioTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-audiotrack-kind\n * @typedef AudioTrack~Kind\n * @enum\n */\nconst AudioTrackKind = {\n 'alternative': 'alternative',\n 'descriptions': 'descriptions',\n 'main': 'main',\n 'main-desc': 'main-desc',\n 'translation': 'translation',\n 'commentary': 'commentary'\n};\n\n/**\n * All possible `TextTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-kind\n * @typedef TextTrack~Kind\n * @enum\n */\nconst TextTrackKind = {\n subtitles: 'subtitles',\n captions: 'captions',\n descriptions: 'descriptions',\n chapters: 'chapters',\n metadata: 'metadata'\n};\n\n/**\n * All possible `TextTrackMode`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackmode\n * @typedef TextTrack~Mode\n * @enum\n */\nconst TextTrackMode = {\n disabled: 'disabled',\n hidden: 'hidden',\n showing: 'showing'\n};\n\n/**\n * @file track.js\n */\n\n/**\n * A Track class that contains all of the common functionality for {@link AudioTrack},\n * {@link VideoTrack}, and {@link TextTrack}.\n *\n * > Note: This class should not be used directly\n *\n * @see {@link https://html.spec.whatwg.org/multipage/embedded-content.html}\n * @extends EventTarget\n * @abstract\n */\nclass Track extends EventTarget$2 {\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {string} [options.kind='']\n * A valid kind for the track type you are creating.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @abstract\n */\n constructor(options = {}) {\n super();\n const trackProps = {\n id: options.id || 'vjs_track_' + newGUID(),\n kind: options.kind || '',\n language: options.language || ''\n };\n let label = options.label || '';\n\n /**\n * @memberof Track\n * @member {string} id\n * The id of this track. Cannot be changed after creation.\n * @instance\n *\n * @readonly\n */\n\n /**\n * @memberof Track\n * @member {string} kind\n * The kind of track that this is. Cannot be changed after creation.\n * @instance\n *\n * @readonly\n */\n\n /**\n * @memberof Track\n * @member {string} language\n * The two letter language code for this track. Cannot be changed after\n * creation.\n * @instance\n *\n * @readonly\n */\n\n for (const key in trackProps) {\n Object.defineProperty(this, key, {\n get() {\n return trackProps[key];\n },\n set() {}\n });\n }\n\n /**\n * @memberof Track\n * @member {string} label\n * The label of this track. Cannot be changed after creation.\n * @instance\n *\n * @fires Track#labelchange\n */\n Object.defineProperty(this, 'label', {\n get() {\n return label;\n },\n set(newLabel) {\n if (newLabel !== label) {\n label = newLabel;\n\n /**\n * An event that fires when label changes on this track.\n *\n * > Note: This is not part of the spec!\n *\n * @event Track#labelchange\n * @type {Event}\n */\n this.trigger('labelchange');\n }\n }\n });\n }\n}\n\n/**\n * @file url.js\n * @module url\n */\n\n/**\n * @typedef {Object} url:URLObject\n *\n * @property {string} protocol\n * The protocol of the url that was parsed.\n *\n * @property {string} hostname\n * The hostname of the url that was parsed.\n *\n * @property {string} port\n * The port of the url that was parsed.\n *\n * @property {string} pathname\n * The pathname of the url that was parsed.\n *\n * @property {string} search\n * The search query of the url that was parsed.\n *\n * @property {string} hash\n * The hash of the url that was parsed.\n *\n * @property {string} host\n * The host of the url that was parsed.\n */\n\n/**\n * Resolve and parse the elements of a URL.\n *\n * @function\n * @param {String} url\n * The url to parse\n *\n * @return {url:URLObject}\n * An object of url details\n */\nconst parseUrl = function (url) {\n // This entire method can be replace with URL once we are able to drop IE11\n\n const props = ['protocol', 'hostname', 'port', 'pathname', 'search', 'hash', 'host'];\n\n // add the url to an anchor and let the browser parse the URL\n const a = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('a');\n a.href = url;\n\n // Copy the specific URL properties to a new object\n // This is also needed for IE because the anchor loses its\n // properties when it's removed from the dom\n const details = {};\n for (let i = 0; i < props.length; i++) {\n details[props[i]] = a[props[i]];\n }\n\n // IE adds the port to the host property unlike everyone else. If\n // a port identifier is added for standard ports, strip it.\n if (details.protocol === 'http:') {\n details.host = details.host.replace(/:80$/, '');\n }\n if (details.protocol === 'https:') {\n details.host = details.host.replace(/:443$/, '');\n }\n if (!details.protocol) {\n details.protocol = (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).protocol;\n }\n\n /* istanbul ignore if */\n if (!details.host) {\n details.host = (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).host;\n }\n return details;\n};\n\n/**\n * Get absolute version of relative URL.\n *\n * @function\n * @param {string} url\n * URL to make absolute\n *\n * @return {string}\n * Absolute URL\n *\n * @see http://stackoverflow.com/questions/470832/getting-an-absolute-url-from-a-relative-one-ie6-issue\n */\nconst getAbsoluteURL = function (url) {\n // Check if absolute URL\n if (!url.match(/^https?:\\/\\//)) {\n // Add the url to an anchor and let the browser parse it to convert to an absolute url\n const a = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('a');\n a.href = url;\n url = a.href;\n }\n return url;\n};\n\n/**\n * Returns the extension of the passed file name. It will return an empty string\n * if passed an invalid path.\n *\n * @function\n * @param {string} path\n * The fileName path like '/path/to/file.mp4'\n *\n * @return {string}\n * The extension in lower case or an empty string if no\n * extension could be found.\n */\nconst getFileExtension = function (path) {\n if (typeof path === 'string') {\n const splitPathRe = /^(\\/?)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?)(\\.([^\\.\\/\\?]+)))(?:[\\/]*|[\\?].*)$/;\n const pathParts = splitPathRe.exec(path);\n if (pathParts) {\n return pathParts.pop().toLowerCase();\n }\n }\n return '';\n};\n\n/**\n * Returns whether the url passed is a cross domain request or not.\n *\n * @function\n * @param {string} url\n * The url to check.\n *\n * @param {Object} [winLoc]\n * the domain to check the url against, defaults to window.location\n *\n * @param {string} [winLoc.protocol]\n * The window location protocol defaults to window.location.protocol\n *\n * @param {string} [winLoc.host]\n * The window location host defaults to window.location.host\n *\n * @return {boolean}\n * Whether it is a cross domain request or not.\n */\nconst isCrossOrigin = function (url, winLoc = (global_window__WEBPACK_IMPORTED_MODULE_0___default().location)) {\n const urlInfo = parseUrl(url);\n\n // IE8 protocol relative urls will return ':' for protocol\n const srcProtocol = urlInfo.protocol === ':' ? winLoc.protocol : urlInfo.protocol;\n\n // Check if url is for another domain/origin\n // IE8 doesn't know location.origin, so we won't rely on it here\n const crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;\n return crossOrigin;\n};\n\nvar Url = /*#__PURE__*/Object.freeze({\n __proto__: null,\n parseUrl: parseUrl,\n getAbsoluteURL: getAbsoluteURL,\n getFileExtension: getFileExtension,\n isCrossOrigin: isCrossOrigin\n});\n\n/**\n * @file text-track.js\n */\n\n/**\n * Takes a webvtt file contents and parses it into cues\n *\n * @param {string} srcContent\n * webVTT file contents\n *\n * @param {TextTrack} track\n * TextTrack to add cues to. Cues come from the srcContent.\n *\n * @private\n */\nconst parseCues = function (srcContent, track) {\n const parser = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT).Parser((global_window__WEBPACK_IMPORTED_MODULE_0___default()), (global_window__WEBPACK_IMPORTED_MODULE_0___default().vttjs), global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT.StringDecoder());\n const errors = [];\n parser.oncue = function (cue) {\n track.addCue(cue);\n };\n parser.onparsingerror = function (error) {\n errors.push(error);\n };\n parser.onflush = function () {\n track.trigger({\n type: 'loadeddata',\n target: track\n });\n };\n parser.parse(srcContent);\n if (errors.length > 0) {\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().console) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().console).groupCollapsed) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().console.groupCollapsed(`Text Track parsing errors for ${track.src}`);\n }\n errors.forEach(error => log$1.error(error));\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().console) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().console).groupEnd) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().console.groupEnd();\n }\n }\n parser.flush();\n};\n\n/**\n * Load a `TextTrack` from a specified url.\n *\n * @param {string} src\n * Url to load track from.\n *\n * @param {TextTrack} track\n * Track to add cues to. Comes from the content at the end of `url`.\n *\n * @private\n */\nconst loadTrack = function (src, track) {\n const opts = {\n uri: src\n };\n const crossOrigin = isCrossOrigin(src);\n if (crossOrigin) {\n opts.cors = crossOrigin;\n }\n const withCredentials = track.tech_.crossOrigin() === 'use-credentials';\n if (withCredentials) {\n opts.withCredentials = withCredentials;\n }\n _videojs_xhr__WEBPACK_IMPORTED_MODULE_4___default()(opts, bind_(this, function (err, response, responseBody) {\n if (err) {\n return log$1.error(err, response);\n }\n track.loaded_ = true;\n\n // Make sure that vttjs has loaded, otherwise, wait till it finished loading\n // NOTE: this is only used for the alt/video.novtt.js build\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) !== 'function') {\n if (track.tech_) {\n // to prevent use before define eslint error, we define loadHandler\n // as a let here\n track.tech_.any(['vttjsloaded', 'vttjserror'], event => {\n if (event.type === 'vttjserror') {\n log$1.error(`vttjs failed to load, stopping trying to process ${track.src}`);\n return;\n }\n return parseCues(responseBody, track);\n });\n }\n } else {\n parseCues(responseBody, track);\n }\n }));\n};\n\n/**\n * A representation of a single `TextTrack`.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrack}\n * @extends Track\n */\nclass TextTrack extends Track {\n /**\n * Create an instance of this class.\n *\n * @param {Object} options={}\n * Object of option names and values\n *\n * @param { import('../tech/tech').default } options.tech\n * A reference to the tech that owns this TextTrack.\n *\n * @param {TextTrack~Kind} [options.kind='subtitles']\n * A valid text track kind.\n *\n * @param {TextTrack~Mode} [options.mode='disabled']\n * A valid text track mode.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this TextTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {string} [options.srclang='']\n * A valid two character language code. An alternative, but deprioritized\n * version of `options.language`\n *\n * @param {string} [options.src]\n * A url to TextTrack cues.\n *\n * @param {boolean} [options.default]\n * If this track should default to on or off.\n */\n constructor(options = {}) {\n if (!options.tech) {\n throw new Error('A tech was not provided.');\n }\n const settings = merge$1(options, {\n kind: TextTrackKind[options.kind] || 'subtitles',\n language: options.language || options.srclang || ''\n });\n let mode = TextTrackMode[settings.mode] || 'disabled';\n const default_ = settings.default;\n if (settings.kind === 'metadata' || settings.kind === 'chapters') {\n mode = 'hidden';\n }\n super(settings);\n this.tech_ = settings.tech;\n this.cues_ = [];\n this.activeCues_ = [];\n this.preload_ = this.tech_.preloadTextTracks !== false;\n const cues = new TextTrackCueList(this.cues_);\n const activeCues = new TextTrackCueList(this.activeCues_);\n let changed = false;\n this.timeupdateHandler = bind_(this, function (event = {}) {\n if (this.tech_.isDisposed()) {\n return;\n }\n if (!this.tech_.isReady_) {\n if (event.type !== 'timeupdate') {\n this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);\n }\n return;\n }\n\n // Accessing this.activeCues for the side-effects of updating itself\n // due to its nature as a getter function. Do not remove or cues will\n // stop updating!\n // Use the setter to prevent deletion from uglify (pure_getters rule)\n this.activeCues = this.activeCues;\n if (changed) {\n this.trigger('cuechange');\n changed = false;\n }\n if (event.type !== 'timeupdate') {\n this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);\n }\n });\n const disposeHandler = () => {\n this.stopTracking();\n };\n this.tech_.one('dispose', disposeHandler);\n if (mode !== 'disabled') {\n this.startTracking();\n }\n Object.defineProperties(this, {\n /**\n * @memberof TextTrack\n * @member {boolean} default\n * If this track was set to be on or off by default. Cannot be changed after\n * creation.\n * @instance\n *\n * @readonly\n */\n default: {\n get() {\n return default_;\n },\n set() {}\n },\n /**\n * @memberof TextTrack\n * @member {string} mode\n * Set the mode of this TextTrack to a valid {@link TextTrack~Mode}. Will\n * not be set if setting to an invalid mode.\n * @instance\n *\n * @fires TextTrack#modechange\n */\n mode: {\n get() {\n return mode;\n },\n set(newMode) {\n if (!TextTrackMode[newMode]) {\n return;\n }\n if (mode === newMode) {\n return;\n }\n mode = newMode;\n if (!this.preload_ && mode !== 'disabled' && this.cues.length === 0) {\n // On-demand load.\n loadTrack(this.src, this);\n }\n this.stopTracking();\n if (mode !== 'disabled') {\n this.startTracking();\n }\n /**\n * An event that fires when mode changes on this track. This allows\n * the TextTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec!\n *\n * @event TextTrack#modechange\n * @type {Event}\n */\n this.trigger('modechange');\n }\n },\n /**\n * @memberof TextTrack\n * @member {TextTrackCueList} cues\n * The text track cue list for this TextTrack.\n * @instance\n */\n cues: {\n get() {\n if (!this.loaded_) {\n return null;\n }\n return cues;\n },\n set() {}\n },\n /**\n * @memberof TextTrack\n * @member {TextTrackCueList} activeCues\n * The list text track cues that are currently active for this TextTrack.\n * @instance\n */\n activeCues: {\n get() {\n if (!this.loaded_) {\n return null;\n }\n\n // nothing to do\n if (this.cues.length === 0) {\n return activeCues;\n }\n const ct = this.tech_.currentTime();\n const active = [];\n for (let i = 0, l = this.cues.length; i < l; i++) {\n const cue = this.cues[i];\n if (cue.startTime <= ct && cue.endTime >= ct) {\n active.push(cue);\n }\n }\n changed = false;\n if (active.length !== this.activeCues_.length) {\n changed = true;\n } else {\n for (let i = 0; i < active.length; i++) {\n if (this.activeCues_.indexOf(active[i]) === -1) {\n changed = true;\n }\n }\n }\n this.activeCues_ = active;\n activeCues.setCues_(this.activeCues_);\n return activeCues;\n },\n // /!\\ Keep this setter empty (see the timeupdate handler above)\n set() {}\n }\n });\n if (settings.src) {\n this.src = settings.src;\n if (!this.preload_) {\n // Tracks will load on-demand.\n // Act like we're loaded for other purposes.\n this.loaded_ = true;\n }\n if (this.preload_ || settings.kind !== 'subtitles' && settings.kind !== 'captions') {\n loadTrack(this.src, this);\n }\n } else {\n this.loaded_ = true;\n }\n }\n startTracking() {\n // More precise cues based on requestVideoFrameCallback with a requestAnimationFram fallback\n this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);\n // Also listen to timeupdate in case rVFC/rAF stops (window in background, audio in video el)\n this.tech_.on('timeupdate', this.timeupdateHandler);\n }\n stopTracking() {\n if (this.rvf_) {\n this.tech_.cancelVideoFrameCallback(this.rvf_);\n this.rvf_ = undefined;\n }\n this.tech_.off('timeupdate', this.timeupdateHandler);\n }\n\n /**\n * Add a cue to the internal list of cues.\n *\n * @param {TextTrack~Cue} cue\n * The cue to add to our internal list\n */\n addCue(originalCue) {\n let cue = originalCue;\n\n // Testing if the cue is a VTTCue in a way that survives minification\n if (!('getCueAsHTML' in cue)) {\n cue = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().vttjs).VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);\n for (const prop in originalCue) {\n if (!(prop in cue)) {\n cue[prop] = originalCue[prop];\n }\n }\n\n // make sure that `id` is copied over\n cue.id = originalCue.id;\n cue.originalCue_ = originalCue;\n }\n const tracks = this.tech_.textTracks();\n for (let i = 0; i < tracks.length; i++) {\n if (tracks[i] !== this) {\n tracks[i].removeCue(cue);\n }\n }\n this.cues_.push(cue);\n this.cues.setCues_(this.cues_);\n }\n\n /**\n * Remove a cue from our internal list\n *\n * @param {TextTrack~Cue} removeCue\n * The cue to remove from our internal list\n */\n removeCue(removeCue) {\n let i = this.cues_.length;\n while (i--) {\n const cue = this.cues_[i];\n if (cue === removeCue || cue.originalCue_ && cue.originalCue_ === removeCue) {\n this.cues_.splice(i, 1);\n this.cues.setCues_(this.cues_);\n break;\n }\n }\n }\n}\n\n/**\n * cuechange - One or more cues in the track have become active or stopped being active.\n * @protected\n */\nTextTrack.prototype.allowedEvents_ = {\n cuechange: 'cuechange'\n};\n\n/**\n * A representation of a single `AudioTrack`. If it is part of an {@link AudioTrackList}\n * only one `AudioTrack` in the list will be enabled at a time.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotrack}\n * @extends Track\n */\nclass AudioTrack extends Track {\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {AudioTrack~Kind} [options.kind='']\n * A valid audio track kind\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {boolean} [options.enabled]\n * If this track is the one that is currently playing. If this track is part of\n * an {@link AudioTrackList}, only one {@link AudioTrack} will be enabled.\n */\n constructor(options = {}) {\n const settings = merge$1(options, {\n kind: AudioTrackKind[options.kind] || ''\n });\n super(settings);\n let enabled = false;\n\n /**\n * @memberof AudioTrack\n * @member {boolean} enabled\n * If this `AudioTrack` is enabled or not. When setting this will\n * fire {@link AudioTrack#enabledchange} if the state of enabled is changed.\n * @instance\n *\n * @fires VideoTrack#selectedchange\n */\n Object.defineProperty(this, 'enabled', {\n get() {\n return enabled;\n },\n set(newEnabled) {\n // an invalid or unchanged value\n if (typeof newEnabled !== 'boolean' || newEnabled === enabled) {\n return;\n }\n enabled = newEnabled;\n\n /**\n * An event that fires when enabled changes on this track. This allows\n * the AudioTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec! Native tracks will do\n * this internally without an event.\n *\n * @event AudioTrack#enabledchange\n * @type {Event}\n */\n this.trigger('enabledchange');\n }\n });\n\n // if the user sets this track to selected then\n // set selected to that true value otherwise\n // we keep it false\n if (settings.enabled) {\n this.enabled = settings.enabled;\n }\n this.loaded_ = true;\n }\n}\n\n/**\n * A representation of a single `VideoTrack`.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotrack}\n * @extends Track\n */\nclass VideoTrack extends Track {\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {string} [options.kind='']\n * A valid {@link VideoTrack~Kind}\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {boolean} [options.selected]\n * If this track is the one that is currently playing.\n */\n constructor(options = {}) {\n const settings = merge$1(options, {\n kind: VideoTrackKind[options.kind] || ''\n });\n super(settings);\n let selected = false;\n\n /**\n * @memberof VideoTrack\n * @member {boolean} selected\n * If this `VideoTrack` is selected or not. When setting this will\n * fire {@link VideoTrack#selectedchange} if the state of selected changed.\n * @instance\n *\n * @fires VideoTrack#selectedchange\n */\n Object.defineProperty(this, 'selected', {\n get() {\n return selected;\n },\n set(newSelected) {\n // an invalid or unchanged value\n if (typeof newSelected !== 'boolean' || newSelected === selected) {\n return;\n }\n selected = newSelected;\n\n /**\n * An event that fires when selected changes on this track. This allows\n * the VideoTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec! Native tracks will do\n * this internally without an event.\n *\n * @event VideoTrack#selectedchange\n * @type {Event}\n */\n this.trigger('selectedchange');\n }\n });\n\n // if the user sets this track to selected then\n // set selected to that true value otherwise\n // we keep it false\n if (settings.selected) {\n this.selected = settings.selected;\n }\n }\n}\n\n/**\n * @file html-track-element.js\n */\n\n/**\n * A single track represented in the DOM.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#htmltrackelement}\n * @extends EventTarget\n */\nclass HTMLTrackElement extends EventTarget$2 {\n /**\n * Create an instance of this class.\n *\n * @param {Object} options={}\n * Object of option names and values\n *\n * @param { import('../tech/tech').default } options.tech\n * A reference to the tech that owns this HTMLTrackElement.\n *\n * @param {TextTrack~Kind} [options.kind='subtitles']\n * A valid text track kind.\n *\n * @param {TextTrack~Mode} [options.mode='disabled']\n * A valid text track mode.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this TextTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {string} [options.srclang='']\n * A valid two character language code. An alternative, but deprioritized\n * version of `options.language`\n *\n * @param {string} [options.src]\n * A url to TextTrack cues.\n *\n * @param {boolean} [options.default]\n * If this track should default to on or off.\n */\n constructor(options = {}) {\n super();\n let readyState;\n const track = new TextTrack(options);\n this.kind = track.kind;\n this.src = track.src;\n this.srclang = track.language;\n this.label = track.label;\n this.default = track.default;\n Object.defineProperties(this, {\n /**\n * @memberof HTMLTrackElement\n * @member {HTMLTrackElement~ReadyState} readyState\n * The current ready state of the track element.\n * @instance\n */\n readyState: {\n get() {\n return readyState;\n }\n },\n /**\n * @memberof HTMLTrackElement\n * @member {TextTrack} track\n * The underlying TextTrack object.\n * @instance\n *\n */\n track: {\n get() {\n return track;\n }\n }\n });\n readyState = HTMLTrackElement.NONE;\n\n /**\n * @listens TextTrack#loadeddata\n * @fires HTMLTrackElement#load\n */\n track.addEventListener('loadeddata', () => {\n readyState = HTMLTrackElement.LOADED;\n this.trigger({\n type: 'load',\n target: this\n });\n });\n }\n}\n\n/**\n * @protected\n */\nHTMLTrackElement.prototype.allowedEvents_ = {\n load: 'load'\n};\n\n/**\n * The text track not loaded state.\n *\n * @type {number}\n * @static\n */\nHTMLTrackElement.NONE = 0;\n\n/**\n * The text track loading state.\n *\n * @type {number}\n * @static\n */\nHTMLTrackElement.LOADING = 1;\n\n/**\n * The text track loaded state.\n *\n * @type {number}\n * @static\n */\nHTMLTrackElement.LOADED = 2;\n\n/**\n * The text track failed to load state.\n *\n * @type {number}\n * @static\n */\nHTMLTrackElement.ERROR = 3;\n\n/*\n * This file contains all track properties that are used in\n * player.js, tech.js, html5.js and possibly other techs in the future.\n */\n\nconst NORMAL = {\n audio: {\n ListClass: AudioTrackList,\n TrackClass: AudioTrack,\n capitalName: 'Audio'\n },\n video: {\n ListClass: VideoTrackList,\n TrackClass: VideoTrack,\n capitalName: 'Video'\n },\n text: {\n ListClass: TextTrackList,\n TrackClass: TextTrack,\n capitalName: 'Text'\n }\n};\nObject.keys(NORMAL).forEach(function (type) {\n NORMAL[type].getterName = `${type}Tracks`;\n NORMAL[type].privateName = `${type}Tracks_`;\n});\nconst REMOTE = {\n remoteText: {\n ListClass: TextTrackList,\n TrackClass: TextTrack,\n capitalName: 'RemoteText',\n getterName: 'remoteTextTracks',\n privateName: 'remoteTextTracks_'\n },\n remoteTextEl: {\n ListClass: HtmlTrackElementList,\n TrackClass: HTMLTrackElement,\n capitalName: 'RemoteTextTrackEls',\n getterName: 'remoteTextTrackEls',\n privateName: 'remoteTextTrackEls_'\n }\n};\nconst ALL = Object.assign({}, NORMAL, REMOTE);\nREMOTE.names = Object.keys(REMOTE);\nNORMAL.names = Object.keys(NORMAL);\nALL.names = [].concat(REMOTE.names).concat(NORMAL.names);\n\n/**\n * @file tech.js\n */\n\n/**\n * An Object containing a structure like: `{src: 'url', type: 'mimetype'}` or string\n * that just contains the src url alone.\n * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};`\n * `var SourceString = 'http://example.com/some-video.mp4';`\n *\n * @typedef {Object|string} SourceObject\n *\n * @property {string} src\n * The url to the source\n *\n * @property {string} type\n * The mime type of the source\n */\n\n/**\n * A function used by {@link Tech} to create a new {@link TextTrack}.\n *\n * @private\n *\n * @param {Tech} self\n * An instance of the Tech class.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @param {Object} [options={}]\n * An object with additional text track options\n *\n * @return {TextTrack}\n * The text track that was created.\n */\nfunction createTrackHelper(self, kind, label, language, options = {}) {\n const tracks = self.textTracks();\n options.kind = kind;\n if (label) {\n options.label = label;\n }\n if (language) {\n options.language = language;\n }\n options.tech = self;\n const track = new ALL.text.TrackClass(options);\n tracks.addTrack(track);\n return track;\n}\n\n/**\n * This is the base class for media playback technology controllers, such as\n * {@link HTML5}\n *\n * @extends Component\n */\nclass Tech extends Component$1 {\n /**\n * Create an instance of this Tech.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Function} [ready]\n * Callback function to call when the `HTML5` Tech is ready.\n */\n constructor(options = {}, ready = function () {}) {\n // we don't want the tech to report user activity automatically.\n // This is done manually in addControlsListeners\n options.reportTouchActivity = false;\n super(null, options, ready);\n this.onDurationChange_ = e => this.onDurationChange(e);\n this.trackProgress_ = e => this.trackProgress(e);\n this.trackCurrentTime_ = e => this.trackCurrentTime(e);\n this.stopTrackingCurrentTime_ = e => this.stopTrackingCurrentTime(e);\n this.disposeSourceHandler_ = e => this.disposeSourceHandler(e);\n this.queuedHanders_ = new Set();\n\n // keep track of whether the current source has played at all to\n // implement a very limited played()\n this.hasStarted_ = false;\n this.on('playing', function () {\n this.hasStarted_ = true;\n });\n this.on('loadstart', function () {\n this.hasStarted_ = false;\n });\n ALL.names.forEach(name => {\n const props = ALL[name];\n if (options && options[props.getterName]) {\n this[props.privateName] = options[props.getterName];\n }\n });\n\n // Manually track progress in cases where the browser/tech doesn't report it.\n if (!this.featuresProgressEvents) {\n this.manualProgressOn();\n }\n\n // Manually track timeupdates in cases where the browser/tech doesn't report it.\n if (!this.featuresTimeupdateEvents) {\n this.manualTimeUpdatesOn();\n }\n ['Text', 'Audio', 'Video'].forEach(track => {\n if (options[`native${track}Tracks`] === false) {\n this[`featuresNative${track}Tracks`] = false;\n }\n });\n if (options.nativeCaptions === false || options.nativeTextTracks === false) {\n this.featuresNativeTextTracks = false;\n } else if (options.nativeCaptions === true || options.nativeTextTracks === true) {\n this.featuresNativeTextTracks = true;\n }\n if (!this.featuresNativeTextTracks) {\n this.emulateTextTracks();\n }\n this.preloadTextTracks = options.preloadTextTracks !== false;\n this.autoRemoteTextTracks_ = new ALL.text.ListClass();\n this.initTrackListeners();\n\n // Turn on component tap events only if not using native controls\n if (!options.nativeControlsForTouch) {\n this.emitTapEvents();\n }\n if (this.constructor) {\n this.name_ = this.constructor.name || 'Unknown Tech';\n }\n }\n\n /**\n * A special function to trigger source set in a way that will allow player\n * to re-trigger if the player or tech are not ready yet.\n *\n * @fires Tech#sourceset\n * @param {string} src The source string at the time of the source changing.\n */\n triggerSourceset(src) {\n if (!this.isReady_) {\n // on initial ready we have to trigger source set\n // 1ms after ready so that player can watch for it.\n this.one('ready', () => this.setTimeout(() => this.triggerSourceset(src), 1));\n }\n\n /**\n * Fired when the source is set on the tech causing the media element\n * to reload.\n *\n * @see {@link Player#event:sourceset}\n * @event Tech#sourceset\n * @type {Event}\n */\n this.trigger({\n src,\n type: 'sourceset'\n });\n }\n\n /* Fallbacks for unsupported event types\n ================================================================================ */\n\n /**\n * Polyfill the `progress` event for browsers that don't support it natively.\n *\n * @see {@link Tech#trackProgress}\n */\n manualProgressOn() {\n this.on('durationchange', this.onDurationChange_);\n this.manualProgress = true;\n\n // Trigger progress watching when a source begins loading\n this.one('ready', this.trackProgress_);\n }\n\n /**\n * Turn off the polyfill for `progress` events that was created in\n * {@link Tech#manualProgressOn}\n */\n manualProgressOff() {\n this.manualProgress = false;\n this.stopTrackingProgress();\n this.off('durationchange', this.onDurationChange_);\n }\n\n /**\n * This is used to trigger a `progress` event when the buffered percent changes. It\n * sets an interval function that will be called every 500 milliseconds to check if the\n * buffer end percent has changed.\n *\n * > This function is called by {@link Tech#manualProgressOn}\n *\n * @param {Event} event\n * The `ready` event that caused this to run.\n *\n * @listens Tech#ready\n * @fires Tech#progress\n */\n trackProgress(event) {\n this.stopTrackingProgress();\n this.progressInterval = this.setInterval(bind_(this, function () {\n // Don't trigger unless buffered amount is greater than last time\n\n const numBufferedPercent = this.bufferedPercent();\n if (this.bufferedPercent_ !== numBufferedPercent) {\n /**\n * See {@link Player#progress}\n *\n * @event Tech#progress\n * @type {Event}\n */\n this.trigger('progress');\n }\n this.bufferedPercent_ = numBufferedPercent;\n if (numBufferedPercent === 1) {\n this.stopTrackingProgress();\n }\n }), 500);\n }\n\n /**\n * Update our internal duration on a `durationchange` event by calling\n * {@link Tech#duration}.\n *\n * @param {Event} event\n * The `durationchange` event that caused this to run.\n *\n * @listens Tech#durationchange\n */\n onDurationChange(event) {\n this.duration_ = this.duration();\n }\n\n /**\n * Get and create a `TimeRange` object for buffering.\n *\n * @return { import('../utils/time').TimeRange }\n * The time range object that was created.\n */\n buffered() {\n return createTimeRanges$1(0, 0);\n }\n\n /**\n * Get the percentage of the current video that is currently buffered.\n *\n * @return {number}\n * A number from 0 to 1 that represents the decimal percentage of the\n * video that is buffered.\n *\n */\n bufferedPercent() {\n return bufferedPercent(this.buffered(), this.duration_);\n }\n\n /**\n * Turn off the polyfill for `progress` events that was created in\n * {@link Tech#manualProgressOn}\n * Stop manually tracking progress events by clearing the interval that was set in\n * {@link Tech#trackProgress}.\n */\n stopTrackingProgress() {\n this.clearInterval(this.progressInterval);\n }\n\n /**\n * Polyfill the `timeupdate` event for browsers that don't support it.\n *\n * @see {@link Tech#trackCurrentTime}\n */\n manualTimeUpdatesOn() {\n this.manualTimeUpdates = true;\n this.on('play', this.trackCurrentTime_);\n this.on('pause', this.stopTrackingCurrentTime_);\n }\n\n /**\n * Turn off the polyfill for `timeupdate` events that was created in\n * {@link Tech#manualTimeUpdatesOn}\n */\n manualTimeUpdatesOff() {\n this.manualTimeUpdates = false;\n this.stopTrackingCurrentTime();\n this.off('play', this.trackCurrentTime_);\n this.off('pause', this.stopTrackingCurrentTime_);\n }\n\n /**\n * Sets up an interval function to track current time and trigger `timeupdate` every\n * 250 milliseconds.\n *\n * @listens Tech#play\n * @triggers Tech#timeupdate\n */\n trackCurrentTime() {\n if (this.currentTimeInterval) {\n this.stopTrackingCurrentTime();\n }\n this.currentTimeInterval = this.setInterval(function () {\n /**\n * Triggered at an interval of 250ms to indicated that time is passing in the video.\n *\n * @event Tech#timeupdate\n * @type {Event}\n */\n this.trigger({\n type: 'timeupdate',\n target: this,\n manuallyTriggered: true\n });\n\n // 42 = 24 fps // 250 is what Webkit uses // FF uses 15\n }, 250);\n }\n\n /**\n * Stop the interval function created in {@link Tech#trackCurrentTime} so that the\n * `timeupdate` event is no longer triggered.\n *\n * @listens {Tech#pause}\n */\n stopTrackingCurrentTime() {\n this.clearInterval(this.currentTimeInterval);\n\n // #1002 - if the video ends right before the next timeupdate would happen,\n // the progress bar won't make it all the way to the end\n this.trigger({\n type: 'timeupdate',\n target: this,\n manuallyTriggered: true\n });\n }\n\n /**\n * Turn off all event polyfills, clear the `Tech`s {@link AudioTrackList},\n * {@link VideoTrackList}, and {@link TextTrackList}, and dispose of this Tech.\n *\n * @fires Component#dispose\n */\n dispose() {\n // clear out all tracks because we can't reuse them between techs\n this.clearTracks(NORMAL.names);\n\n // Turn off any manual progress or timeupdate tracking\n if (this.manualProgress) {\n this.manualProgressOff();\n }\n if (this.manualTimeUpdates) {\n this.manualTimeUpdatesOff();\n }\n super.dispose();\n }\n\n /**\n * Clear out a single `TrackList` or an array of `TrackLists` given their names.\n *\n * > Note: Techs without source handlers should call this between sources for `video`\n * & `audio` tracks. You don't want to use them between tracks!\n *\n * @param {string[]|string} types\n * TrackList names to clear, valid names are `video`, `audio`, and\n * `text`.\n */\n clearTracks(types) {\n types = [].concat(types);\n // clear out all tracks because we can't reuse them between techs\n types.forEach(type => {\n const list = this[`${type}Tracks`]() || [];\n let i = list.length;\n while (i--) {\n const track = list[i];\n if (type === 'text') {\n this.removeRemoteTextTrack(track);\n }\n list.removeTrack(track);\n }\n });\n }\n\n /**\n * Remove any TextTracks added via addRemoteTextTrack that are\n * flagged for automatic garbage collection\n */\n cleanupAutoTextTracks() {\n const list = this.autoRemoteTextTracks_ || [];\n let i = list.length;\n while (i--) {\n const track = list[i];\n this.removeRemoteTextTrack(track);\n }\n }\n\n /**\n * Reset the tech, which will removes all sources and reset the internal readyState.\n *\n * @abstract\n */\n reset() {}\n\n /**\n * Get the value of `crossOrigin` from the tech.\n *\n * @abstract\n *\n * @see {Html5#crossOrigin}\n */\n crossOrigin() {}\n\n /**\n * Set the value of `crossOrigin` on the tech.\n *\n * @abstract\n *\n * @param {string} crossOrigin the crossOrigin value\n * @see {Html5#setCrossOrigin}\n */\n setCrossOrigin() {}\n\n /**\n * Get or set an error on the Tech.\n *\n * @param {MediaError} [err]\n * Error to set on the Tech\n *\n * @return {MediaError|null}\n * The current error object on the tech, or null if there isn't one.\n */\n error(err) {\n if (err !== undefined) {\n this.error_ = new MediaError(err);\n this.trigger('error');\n }\n return this.error_;\n }\n\n /**\n * Returns the `TimeRange`s that have been played through for the current source.\n *\n * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`.\n * It only checks whether the source has played at all or not.\n *\n * @return { import('../utils/time').TimeRange }\n * - A single time range if this video has played\n * - An empty set of ranges if not.\n */\n played() {\n if (this.hasStarted_) {\n return createTimeRanges$1(0, 0);\n }\n return createTimeRanges$1();\n }\n\n /**\n * Start playback\n *\n * @abstract\n *\n * @see {Html5#play}\n */\n play() {}\n\n /**\n * Set whether we are scrubbing or not\n *\n * @abstract\n * @param {boolean} _isScrubbing\n * - true for we are currently scrubbing\n * - false for we are no longer scrubbing\n *\n * @see {Html5#setScrubbing}\n */\n setScrubbing(_isScrubbing) {}\n\n /**\n * Get whether we are scrubbing or not\n *\n * @abstract\n *\n * @see {Html5#scrubbing}\n */\n scrubbing() {}\n\n /**\n * Causes a manual time update to occur if {@link Tech#manualTimeUpdatesOn} was\n * previously called.\n *\n * @param {number} _seconds\n * Set the current time of the media to this.\n * @fires Tech#timeupdate\n */\n setCurrentTime(_seconds) {\n // improve the accuracy of manual timeupdates\n if (this.manualTimeUpdates) {\n /**\n * A manual `timeupdate` event.\n *\n * @event Tech#timeupdate\n * @type {Event}\n */\n this.trigger({\n type: 'timeupdate',\n target: this,\n manuallyTriggered: true\n });\n }\n }\n\n /**\n * Turn on listeners for {@link VideoTrackList}, {@link {AudioTrackList}, and\n * {@link TextTrackList} events.\n *\n * This adds {@link EventTarget~EventListeners} for `addtrack`, and `removetrack`.\n *\n * @fires Tech#audiotrackchange\n * @fires Tech#videotrackchange\n * @fires Tech#texttrackchange\n */\n initTrackListeners() {\n /**\n * Triggered when tracks are added or removed on the Tech {@link AudioTrackList}\n *\n * @event Tech#audiotrackchange\n * @type {Event}\n */\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link VideoTrackList}\n *\n * @event Tech#videotrackchange\n * @type {Event}\n */\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link TextTrackList}\n *\n * @event Tech#texttrackchange\n * @type {Event}\n */\n NORMAL.names.forEach(name => {\n const props = NORMAL[name];\n const trackListChanges = () => {\n this.trigger(`${name}trackchange`);\n };\n const tracks = this[props.getterName]();\n tracks.addEventListener('removetrack', trackListChanges);\n tracks.addEventListener('addtrack', trackListChanges);\n this.on('dispose', () => {\n tracks.removeEventListener('removetrack', trackListChanges);\n tracks.removeEventListener('addtrack', trackListChanges);\n });\n });\n }\n\n /**\n * Emulate TextTracks using vtt.js if necessary\n *\n * @fires Tech#vttjsloaded\n * @fires Tech#vttjserror\n */\n addWebVttScript_() {\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT)) {\n return;\n }\n\n // Initially, Tech.el_ is a child of a dummy-div wait until the Component system\n // signals that the Tech is ready at which point Tech.el_ is part of the DOM\n // before inserting the WebVTT script\n if (global_document__WEBPACK_IMPORTED_MODULE_1___default().body.contains(this.el())) {\n // load via require if available and vtt.js script location was not passed in\n // as an option. novtt builds will turn the above require call into an empty object\n // which will cause this if check to always fail.\n if (!this.options_['vtt.js'] && isPlain((videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5___default())) && Object.keys((videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5___default())).length > 0) {\n this.trigger('vttjsloaded');\n return;\n }\n\n // load vtt.js via the script location option or the cdn of no location was\n // passed in\n const script = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('script');\n script.src = this.options_['vtt.js'] || 'https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js';\n script.onload = () => {\n /**\n * Fired when vtt.js is loaded.\n *\n * @event Tech#vttjsloaded\n * @type {Event}\n */\n this.trigger('vttjsloaded');\n };\n script.onerror = () => {\n /**\n * Fired when vtt.js was not loaded due to an error\n *\n * @event Tech#vttjsloaded\n * @type {Event}\n */\n this.trigger('vttjserror');\n };\n this.on('dispose', () => {\n script.onload = null;\n script.onerror = null;\n });\n // but have not loaded yet and we set it to true before the inject so that\n // we don't overwrite the injected window.WebVTT if it loads right away\n (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) = true;\n this.el().parentNode.appendChild(script);\n } else {\n this.ready(this.addWebVttScript_);\n }\n }\n\n /**\n * Emulate texttracks\n *\n */\n emulateTextTracks() {\n const tracks = this.textTracks();\n const remoteTracks = this.remoteTextTracks();\n const handleAddTrack = e => tracks.addTrack(e.track);\n const handleRemoveTrack = e => tracks.removeTrack(e.track);\n remoteTracks.on('addtrack', handleAddTrack);\n remoteTracks.on('removetrack', handleRemoveTrack);\n this.addWebVttScript_();\n const updateDisplay = () => this.trigger('texttrackchange');\n const textTracksChanges = () => {\n updateDisplay();\n for (let i = 0; i < tracks.length; i++) {\n const track = tracks[i];\n track.removeEventListener('cuechange', updateDisplay);\n if (track.mode === 'showing') {\n track.addEventListener('cuechange', updateDisplay);\n }\n }\n };\n textTracksChanges();\n tracks.addEventListener('change', textTracksChanges);\n tracks.addEventListener('addtrack', textTracksChanges);\n tracks.addEventListener('removetrack', textTracksChanges);\n this.on('dispose', function () {\n remoteTracks.off('addtrack', handleAddTrack);\n remoteTracks.off('removetrack', handleRemoveTrack);\n tracks.removeEventListener('change', textTracksChanges);\n tracks.removeEventListener('addtrack', textTracksChanges);\n tracks.removeEventListener('removetrack', textTracksChanges);\n for (let i = 0; i < tracks.length; i++) {\n const track = tracks[i];\n track.removeEventListener('cuechange', updateDisplay);\n }\n });\n }\n\n /**\n * Create and returns a remote {@link TextTrack} object.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @return {TextTrack}\n * The TextTrack that gets created.\n */\n addTextTrack(kind, label, language) {\n if (!kind) {\n throw new Error('TextTrack kind is required but was not provided');\n }\n return createTrackHelper(this, kind, label, language);\n }\n\n /**\n * Create an emulated TextTrack for use by addRemoteTextTrack\n *\n * This is intended to be overridden by classes that inherit from\n * Tech in order to create native or custom TextTracks.\n *\n * @param {Object} options\n * The object should contain the options to initialize the TextTrack with.\n *\n * @param {string} [options.kind]\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata).\n *\n * @param {string} [options.label].\n * Label to identify the text track\n *\n * @param {string} [options.language]\n * Two letter language abbreviation.\n *\n * @return {HTMLTrackElement}\n * The track element that gets created.\n */\n createRemoteTextTrack(options) {\n const track = merge$1(options, {\n tech: this\n });\n return new REMOTE.remoteTextEl.TrackClass(track);\n }\n\n /**\n * Creates a remote text track object and returns an html track element.\n *\n * > Note: This can be an emulated {@link HTMLTrackElement} or a native one.\n *\n * @param {Object} options\n * See {@link Tech#createRemoteTextTrack} for more detailed properties.\n *\n * @param {boolean} [manualCleanup=false]\n * - When false: the TextTrack will be automatically removed from the video\n * element whenever the source changes\n * - When True: The TextTrack will have to be cleaned up manually\n *\n * @return {HTMLTrackElement}\n * An Html Track Element.\n *\n */\n addRemoteTextTrack(options = {}, manualCleanup) {\n const htmlTrackElement = this.createRemoteTextTrack(options);\n if (typeof manualCleanup !== 'boolean') {\n manualCleanup = false;\n }\n\n // store HTMLTrackElement and TextTrack to remote list\n this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);\n this.remoteTextTracks().addTrack(htmlTrackElement.track);\n if (manualCleanup === false) {\n // create the TextTrackList if it doesn't exist\n this.ready(() => this.autoRemoteTextTracks_.addTrack(htmlTrackElement.track));\n }\n return htmlTrackElement;\n }\n\n /**\n * Remove a remote text track from the remote `TextTrackList`.\n *\n * @param {TextTrack} track\n * `TextTrack` to remove from the `TextTrackList`\n */\n removeRemoteTextTrack(track) {\n const trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track);\n\n // remove HTMLTrackElement and TextTrack from remote list\n this.remoteTextTrackEls().removeTrackElement_(trackElement);\n this.remoteTextTracks().removeTrack(track);\n this.autoRemoteTextTracks_.removeTrack(track);\n }\n\n /**\n * Gets available media playback quality metrics as specified by the W3C's Media\n * Playback Quality API.\n *\n * @see [Spec]{@link https://wicg.github.io/media-playback-quality}\n *\n * @return {Object}\n * An object with supported media playback quality metrics\n *\n * @abstract\n */\n getVideoPlaybackQuality() {\n return {};\n }\n\n /**\n * Attempt to create a floating video window always on top of other windows\n * so that users may continue consuming media while they interact with other\n * content sites, or applications on their device.\n *\n * @see [Spec]{@link https://wicg.github.io/picture-in-picture}\n *\n * @return {Promise|undefined}\n * A promise with a Picture-in-Picture window if the browser supports\n * Promises (or one was passed in as an option). It returns undefined\n * otherwise.\n *\n * @abstract\n */\n requestPictureInPicture() {\n return Promise.reject();\n }\n\n /**\n * A method to check for the value of the 'disablePictureInPicture' <video> property.\n * Defaults to true, as it should be considered disabled if the tech does not support pip\n *\n * @abstract\n */\n disablePictureInPicture() {\n return true;\n }\n\n /**\n * A method to set or unset the 'disablePictureInPicture' <video> property.\n *\n * @abstract\n */\n setDisablePictureInPicture() {}\n\n /**\n * A fallback implementation of requestVideoFrameCallback using requestAnimationFrame\n *\n * @param {function} cb\n * @return {number} request id\n */\n requestVideoFrameCallback(cb) {\n const id = newGUID();\n if (!this.isReady_ || this.paused()) {\n this.queuedHanders_.add(id);\n this.one('playing', () => {\n if (this.queuedHanders_.has(id)) {\n this.queuedHanders_.delete(id);\n cb();\n }\n });\n } else {\n this.requestNamedAnimationFrame(id, cb);\n }\n return id;\n }\n\n /**\n * A fallback implementation of cancelVideoFrameCallback\n *\n * @param {number} id id of callback to be cancelled\n */\n cancelVideoFrameCallback(id) {\n if (this.queuedHanders_.has(id)) {\n this.queuedHanders_.delete(id);\n } else {\n this.cancelNamedAnimationFrame(id);\n }\n }\n\n /**\n * A method to set a poster from a `Tech`.\n *\n * @abstract\n */\n setPoster() {}\n\n /**\n * A method to check for the presence of the 'playsinline' <video> attribute.\n *\n * @abstract\n */\n playsinline() {}\n\n /**\n * A method to set or unset the 'playsinline' <video> attribute.\n *\n * @abstract\n */\n setPlaysinline() {}\n\n /**\n * Attempt to force override of native audio tracks.\n *\n * @param {boolean} override - If set to true native audio will be overridden,\n * otherwise native audio will potentially be used.\n *\n * @abstract\n */\n overrideNativeAudioTracks(override) {}\n\n /**\n * Attempt to force override of native video tracks.\n *\n * @param {boolean} override - If set to true native video will be overridden,\n * otherwise native video will potentially be used.\n *\n * @abstract\n */\n overrideNativeVideoTracks(override) {}\n\n /**\n * Check if the tech can support the given mime-type.\n *\n * The base tech does not support any type, but source handlers might\n * overwrite this.\n *\n * @param {string} _type\n * The mimetype to check for support\n *\n * @return {string}\n * 'probably', 'maybe', or empty string\n *\n * @see [Spec]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canPlayType}\n *\n * @abstract\n */\n canPlayType(_type) {\n return '';\n }\n\n /**\n * Check if the type is supported by this tech.\n *\n * The base tech does not support any type, but source handlers might\n * overwrite this.\n *\n * @param {string} _type\n * The media type to check\n * @return {string} Returns the native video element's response\n */\n static canPlayType(_type) {\n return '';\n }\n\n /**\n * Check if the tech can support the given source\n *\n * @param {Object} srcObj\n * The source object\n * @param {Object} options\n * The options passed to the tech\n * @return {string} 'probably', 'maybe', or '' (empty string)\n */\n static canPlaySource(srcObj, options) {\n return Tech.canPlayType(srcObj.type);\n }\n\n /*\n * Return whether the argument is a Tech or not.\n * Can be passed either a Class like `Html5` or a instance like `player.tech_`\n *\n * @param {Object} component\n * The item to check\n *\n * @return {boolean}\n * Whether it is a tech or not\n * - True if it is a tech\n * - False if it is not\n */\n static isTech(component) {\n return component.prototype instanceof Tech || component instanceof Tech || component === Tech;\n }\n\n /**\n * Registers a `Tech` into a shared list for videojs.\n *\n * @param {string} name\n * Name of the `Tech` to register.\n *\n * @param {Object} tech\n * The `Tech` class to register.\n */\n static registerTech(name, tech) {\n if (!Tech.techs_) {\n Tech.techs_ = {};\n }\n if (!Tech.isTech(tech)) {\n throw new Error(`Tech ${name} must be a Tech`);\n }\n if (!Tech.canPlayType) {\n throw new Error('Techs must have a static canPlayType method on them');\n }\n if (!Tech.canPlaySource) {\n throw new Error('Techs must have a static canPlaySource method on them');\n }\n name = toTitleCase$1(name);\n Tech.techs_[name] = tech;\n Tech.techs_[toLowerCase(name)] = tech;\n if (name !== 'Tech') {\n // camel case the techName for use in techOrder\n Tech.defaultTechOrder_.push(name);\n }\n return tech;\n }\n\n /**\n * Get a `Tech` from the shared list by name.\n *\n * @param {string} name\n * `camelCase` or `TitleCase` name of the Tech to get\n *\n * @return {Tech|undefined}\n * The `Tech` or undefined if there was no tech with the name requested.\n */\n static getTech(name) {\n if (!name) {\n return;\n }\n if (Tech.techs_ && Tech.techs_[name]) {\n return Tech.techs_[name];\n }\n name = toTitleCase$1(name);\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default()) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().videojs) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().videojs)[name]) {\n log$1.warn(`The ${name} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`);\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default().videojs)[name];\n }\n }\n}\n\n/**\n * Get the {@link VideoTrackList}\n *\n * @returns {VideoTrackList}\n * @method Tech.prototype.videoTracks\n */\n\n/**\n * Get the {@link AudioTrackList}\n *\n * @returns {AudioTrackList}\n * @method Tech.prototype.audioTracks\n */\n\n/**\n * Get the {@link TextTrackList}\n *\n * @returns {TextTrackList}\n * @method Tech.prototype.textTracks\n */\n\n/**\n * Get the remote element {@link TextTrackList}\n *\n * @returns {TextTrackList}\n * @method Tech.prototype.remoteTextTracks\n */\n\n/**\n * Get the remote element {@link HtmlTrackElementList}\n *\n * @returns {HtmlTrackElementList}\n * @method Tech.prototype.remoteTextTrackEls\n */\n\nALL.names.forEach(function (name) {\n const props = ALL[name];\n Tech.prototype[props.getterName] = function () {\n this[props.privateName] = this[props.privateName] || new props.ListClass();\n return this[props.privateName];\n };\n});\n\n/**\n * List of associated text tracks\n *\n * @type {TextTrackList}\n * @private\n * @property Tech#textTracks_\n */\n\n/**\n * List of associated audio tracks.\n *\n * @type {AudioTrackList}\n * @private\n * @property Tech#audioTracks_\n */\n\n/**\n * List of associated video tracks.\n *\n * @type {VideoTrackList}\n * @private\n * @property Tech#videoTracks_\n */\n\n/**\n * Boolean indicating whether the `Tech` supports volume control.\n *\n * @type {boolean}\n * @default\n */\nTech.prototype.featuresVolumeControl = true;\n\n/**\n * Boolean indicating whether the `Tech` supports muting volume.\n *\n * @type {boolean}\n * @default\n */\nTech.prototype.featuresMuteControl = true;\n\n/**\n * Boolean indicating whether the `Tech` supports fullscreen resize control.\n * Resizing plugins using request fullscreen reloads the plugin\n *\n * @type {boolean}\n * @default\n */\nTech.prototype.featuresFullscreenResize = false;\n\n/**\n * Boolean indicating whether the `Tech` supports changing the speed at which the video\n * plays. Examples:\n * - Set player to play 2x (twice) as fast\n * - Set player to play 0.5x (half) as fast\n *\n * @type {boolean}\n * @default\n */\nTech.prototype.featuresPlaybackRate = false;\n\n/**\n * Boolean indicating whether the `Tech` supports the `progress` event.\n * This will be used to determine if {@link Tech#manualProgressOn} should be called.\n *\n * @type {boolean}\n * @default\n */\nTech.prototype.featuresProgressEvents = false;\n\n/**\n * Boolean indicating whether the `Tech` supports the `sourceset` event.\n *\n * A tech should set this to `true` and then use {@link Tech#triggerSourceset}\n * to trigger a {@link Tech#event:sourceset} at the earliest time after getting\n * a new source.\n *\n * @type {boolean}\n * @default\n */\nTech.prototype.featuresSourceset = false;\n\n/**\n * Boolean indicating whether the `Tech` supports the `timeupdate` event.\n * This will be used to determine if {@link Tech#manualTimeUpdates} should be called.\n *\n * @type {boolean}\n * @default\n */\nTech.prototype.featuresTimeupdateEvents = false;\n\n/**\n * Boolean indicating whether the `Tech` supports the native `TextTrack`s.\n * This will help us integrate with native `TextTrack`s if the browser supports them.\n *\n * @type {boolean}\n * @default\n */\nTech.prototype.featuresNativeTextTracks = false;\n\n/**\n * Boolean indicating whether the `Tech` supports `requestVideoFrameCallback`.\n *\n * @type {boolean}\n * @default\n */\nTech.prototype.featuresVideoFrameCallback = false;\n\n/**\n * A functional mixin for techs that want to use the Source Handler pattern.\n * Source handlers are scripts for handling specific formats.\n * The source handler pattern is used for adaptive formats (HLS, DASH) that\n * manually load video data and feed it into a Source Buffer (Media Source Extensions)\n * Example: `Tech.withSourceHandlers.call(MyTech);`\n *\n * @param {Tech} _Tech\n * The tech to add source handler functions to.\n *\n * @mixes Tech~SourceHandlerAdditions\n */\nTech.withSourceHandlers = function (_Tech) {\n /**\n * Register a source handler\n *\n * @param {Function} handler\n * The source handler class\n *\n * @param {number} [index]\n * Register it at the following index\n */\n _Tech.registerSourceHandler = function (handler, index) {\n let handlers = _Tech.sourceHandlers;\n if (!handlers) {\n handlers = _Tech.sourceHandlers = [];\n }\n if (index === undefined) {\n // add to the end of the list\n index = handlers.length;\n }\n handlers.splice(index, 0, handler);\n };\n\n /**\n * Check if the tech can support the given type. Also checks the\n * Techs sourceHandlers.\n *\n * @param {string} type\n * The mimetype to check.\n *\n * @return {string}\n * 'probably', 'maybe', or '' (empty string)\n */\n _Tech.canPlayType = function (type) {\n const handlers = _Tech.sourceHandlers || [];\n let can;\n for (let i = 0; i < handlers.length; i++) {\n can = handlers[i].canPlayType(type);\n if (can) {\n return can;\n }\n }\n return '';\n };\n\n /**\n * Returns the first source handler that supports the source.\n *\n * TODO: Answer question: should 'probably' be prioritized over 'maybe'\n *\n * @param {SourceObject} source\n * The source object\n *\n * @param {Object} options\n * The options passed to the tech\n *\n * @return {SourceHandler|null}\n * The first source handler that supports the source or null if\n * no SourceHandler supports the source\n */\n _Tech.selectSourceHandler = function (source, options) {\n const handlers = _Tech.sourceHandlers || [];\n let can;\n for (let i = 0; i < handlers.length; i++) {\n can = handlers[i].canHandleSource(source, options);\n if (can) {\n return handlers[i];\n }\n }\n return null;\n };\n\n /**\n * Check if the tech can support the given source.\n *\n * @param {SourceObject} srcObj\n * The source object\n *\n * @param {Object} options\n * The options passed to the tech\n *\n * @return {string}\n * 'probably', 'maybe', or '' (empty string)\n */\n _Tech.canPlaySource = function (srcObj, options) {\n const sh = _Tech.selectSourceHandler(srcObj, options);\n if (sh) {\n return sh.canHandleSource(srcObj, options);\n }\n return '';\n };\n\n /**\n * When using a source handler, prefer its implementation of\n * any function normally provided by the tech.\n */\n const deferrable = ['seekable', 'seeking', 'duration'];\n\n /**\n * A wrapper around {@link Tech#seekable} that will call a `SourceHandler`s seekable\n * function if it exists, with a fallback to the Techs seekable function.\n *\n * @method _Tech.seekable\n */\n\n /**\n * A wrapper around {@link Tech#duration} that will call a `SourceHandler`s duration\n * function if it exists, otherwise it will fallback to the techs duration function.\n *\n * @method _Tech.duration\n */\n\n deferrable.forEach(function (fnName) {\n const originalFn = this[fnName];\n if (typeof originalFn !== 'function') {\n return;\n }\n this[fnName] = function () {\n if (this.sourceHandler_ && this.sourceHandler_[fnName]) {\n return this.sourceHandler_[fnName].apply(this.sourceHandler_, arguments);\n }\n return originalFn.apply(this, arguments);\n };\n }, _Tech.prototype);\n\n /**\n * Create a function for setting the source using a source object\n * and source handlers.\n * Should never be called unless a source handler was found.\n *\n * @param {SourceObject} source\n * A source object with src and type keys\n */\n _Tech.prototype.setSource = function (source) {\n let sh = _Tech.selectSourceHandler(source, this.options_);\n if (!sh) {\n // Fall back to a native source handler when unsupported sources are\n // deliberately set\n if (_Tech.nativeSourceHandler) {\n sh = _Tech.nativeSourceHandler;\n } else {\n log$1.error('No source handler found for the current source.');\n }\n }\n\n // Dispose any existing source handler\n this.disposeSourceHandler();\n this.off('dispose', this.disposeSourceHandler_);\n if (sh !== _Tech.nativeSourceHandler) {\n this.currentSource_ = source;\n }\n this.sourceHandler_ = sh.handleSource(source, this, this.options_);\n this.one('dispose', this.disposeSourceHandler_);\n };\n\n /**\n * Clean up any existing SourceHandlers and listeners when the Tech is disposed.\n *\n * @listens Tech#dispose\n */\n _Tech.prototype.disposeSourceHandler = function () {\n // if we have a source and get another one\n // then we are loading something new\n // than clear all of our current tracks\n if (this.currentSource_) {\n this.clearTracks(['audio', 'video']);\n this.currentSource_ = null;\n }\n\n // always clean up auto-text tracks\n this.cleanupAutoTextTracks();\n if (this.sourceHandler_) {\n if (this.sourceHandler_.dispose) {\n this.sourceHandler_.dispose();\n }\n this.sourceHandler_ = null;\n }\n };\n};\n\n// The base Tech class needs to be registered as a Component. It is the only\n// Tech that can be registered as a Component.\nComponent$1.registerComponent('Tech', Tech);\nTech.registerTech('Tech', Tech);\n\n/**\n * A list of techs that should be added to techOrder on Players\n *\n * @private\n */\nTech.defaultTechOrder_ = [];\n\n/**\n * @file middleware.js\n * @module middleware\n */\nconst middlewares = {};\nconst middlewareInstances = {};\nconst TERMINATOR = {};\n\n/**\n * A middleware object is a plain JavaScript object that has methods that\n * match the {@link Tech} methods found in the lists of allowed\n * {@link module:middleware.allowedGetters|getters},\n * {@link module:middleware.allowedSetters|setters}, and\n * {@link module:middleware.allowedMediators|mediators}.\n *\n * @typedef {Object} MiddlewareObject\n */\n\n/**\n * A middleware factory function that should return a\n * {@link module:middleware~MiddlewareObject|MiddlewareObject}.\n *\n * This factory will be called for each player when needed, with the player\n * passed in as an argument.\n *\n * @callback MiddlewareFactory\n * @param { import('../player').default } player\n * A Video.js player.\n */\n\n/**\n * Define a middleware that the player should use by way of a factory function\n * that returns a middleware object.\n *\n * @param {string} type\n * The MIME type to match or `\"*\"` for all MIME types.\n *\n * @param {MiddlewareFactory} middleware\n * A middleware factory function that will be executed for\n * matching types.\n */\nfunction use(type, middleware) {\n middlewares[type] = middlewares[type] || [];\n middlewares[type].push(middleware);\n}\n\n/**\n * Asynchronously sets a source using middleware by recursing through any\n * matching middlewares and calling `setSource` on each, passing along the\n * previous returned value each time.\n *\n * @param { import('../player').default } player\n * A {@link Player} instance.\n *\n * @param {Tech~SourceObject} src\n * A source object.\n *\n * @param {Function}\n * The next middleware to run.\n */\nfunction setSource(player, src, next) {\n player.setTimeout(() => setSourceHelper(src, middlewares[src.type], next, player), 1);\n}\n\n/**\n * When the tech is set, passes the tech to each middleware's `setTech` method.\n *\n * @param {Object[]} middleware\n * An array of middleware instances.\n *\n * @param { import('../tech/tech').default } tech\n * A Video.js tech.\n */\nfunction setTech(middleware, tech) {\n middleware.forEach(mw => mw.setTech && mw.setTech(tech));\n}\n\n/**\n * Calls a getter on the tech first, through each middleware\n * from right to left to the player.\n *\n * @param {Object[]} middleware\n * An array of middleware instances.\n *\n * @param { import('../tech/tech').default } tech\n * The current tech.\n *\n * @param {string} method\n * A method name.\n *\n * @return {*}\n * The final value from the tech after middleware has intercepted it.\n */\nfunction get(middleware, tech, method) {\n return middleware.reduceRight(middlewareIterator(method), tech[method]());\n}\n\n/**\n * Takes the argument given to the player and calls the setter method on each\n * middleware from left to right to the tech.\n *\n * @param {Object[]} middleware\n * An array of middleware instances.\n *\n * @param { import('../tech/tech').default } tech\n * The current tech.\n *\n * @param {string} method\n * A method name.\n *\n * @param {*} arg\n * The value to set on the tech.\n *\n * @return {*}\n * The return value of the `method` of the `tech`.\n */\nfunction set(middleware, tech, method, arg) {\n return tech[method](middleware.reduce(middlewareIterator(method), arg));\n}\n\n/**\n * Takes the argument given to the player and calls the `call` version of the\n * method on each middleware from left to right.\n *\n * Then, call the passed in method on the tech and return the result unchanged\n * back to the player, through middleware, this time from right to left.\n *\n * @param {Object[]} middleware\n * An array of middleware instances.\n *\n * @param { import('../tech/tech').default } tech\n * The current tech.\n *\n * @param {string} method\n * A method name.\n *\n * @param {*} arg\n * The value to set on the tech.\n *\n * @return {*}\n * The return value of the `method` of the `tech`, regardless of the\n * return values of middlewares.\n */\nfunction mediate(middleware, tech, method, arg = null) {\n const callMethod = 'call' + toTitleCase$1(method);\n const middlewareValue = middleware.reduce(middlewareIterator(callMethod), arg);\n const terminated = middlewareValue === TERMINATOR;\n // deprecated. The `null` return value should instead return TERMINATOR to\n // prevent confusion if a techs method actually returns null.\n const returnValue = terminated ? null : tech[method](middlewareValue);\n executeRight(middleware, method, returnValue, terminated);\n return returnValue;\n}\n\n/**\n * Enumeration of allowed getters where the keys are method names.\n *\n * @type {Object}\n */\nconst allowedGetters = {\n buffered: 1,\n currentTime: 1,\n duration: 1,\n muted: 1,\n played: 1,\n paused: 1,\n seekable: 1,\n volume: 1,\n ended: 1\n};\n\n/**\n * Enumeration of allowed setters where the keys are method names.\n *\n * @type {Object}\n */\nconst allowedSetters = {\n setCurrentTime: 1,\n setMuted: 1,\n setVolume: 1\n};\n\n/**\n * Enumeration of allowed mediators where the keys are method names.\n *\n * @type {Object}\n */\nconst allowedMediators = {\n play: 1,\n pause: 1\n};\nfunction middlewareIterator(method) {\n return (value, mw) => {\n // if the previous middleware terminated, pass along the termination\n if (value === TERMINATOR) {\n return TERMINATOR;\n }\n if (mw[method]) {\n return mw[method](value);\n }\n return value;\n };\n}\nfunction executeRight(mws, method, value, terminated) {\n for (let i = mws.length - 1; i >= 0; i--) {\n const mw = mws[i];\n if (mw[method]) {\n mw[method](terminated, value);\n }\n }\n}\n\n/**\n * Clear the middleware cache for a player.\n *\n * @param { import('../player').default } player\n * A {@link Player} instance.\n */\nfunction clearCacheForPlayer(player) {\n middlewareInstances[player.id()] = null;\n}\n\n/**\n * {\n * [playerId]: [[mwFactory, mwInstance], ...]\n * }\n *\n * @private\n */\nfunction getOrCreateFactory(player, mwFactory) {\n const mws = middlewareInstances[player.id()];\n let mw = null;\n if (mws === undefined || mws === null) {\n mw = mwFactory(player);\n middlewareInstances[player.id()] = [[mwFactory, mw]];\n return mw;\n }\n for (let i = 0; i < mws.length; i++) {\n const [mwf, mwi] = mws[i];\n if (mwf !== mwFactory) {\n continue;\n }\n mw = mwi;\n }\n if (mw === null) {\n mw = mwFactory(player);\n mws.push([mwFactory, mw]);\n }\n return mw;\n}\nfunction setSourceHelper(src = {}, middleware = [], next, player, acc = [], lastRun = false) {\n const [mwFactory, ...mwrest] = middleware;\n\n // if mwFactory is a string, then we're at a fork in the road\n if (typeof mwFactory === 'string') {\n setSourceHelper(src, middlewares[mwFactory], next, player, acc, lastRun);\n\n // if we have an mwFactory, call it with the player to get the mw,\n // then call the mw's setSource method\n } else if (mwFactory) {\n const mw = getOrCreateFactory(player, mwFactory);\n\n // if setSource isn't present, implicitly select this middleware\n if (!mw.setSource) {\n acc.push(mw);\n return setSourceHelper(src, mwrest, next, player, acc, lastRun);\n }\n mw.setSource(Object.assign({}, src), function (err, _src) {\n // something happened, try the next middleware on the current level\n // make sure to use the old src\n if (err) {\n return setSourceHelper(src, mwrest, next, player, acc, lastRun);\n }\n\n // we've succeeded, now we need to go deeper\n acc.push(mw);\n\n // if it's the same type, continue down the current chain\n // otherwise, we want to go down the new chain\n setSourceHelper(_src, src.type === _src.type ? mwrest : middlewares[_src.type], next, player, acc, lastRun);\n });\n } else if (mwrest.length) {\n setSourceHelper(src, mwrest, next, player, acc, lastRun);\n } else if (lastRun) {\n next(src, acc);\n } else {\n setSourceHelper(src, middlewares['*'], next, player, acc, true);\n }\n}\n\n/**\n * Mimetypes\n *\n * @see https://www.iana.org/assignments/media-types/media-types.xhtml\n * @typedef Mimetypes~Kind\n * @enum\n */\nconst MimetypesKind = {\n opus: 'video/ogg',\n ogv: 'video/ogg',\n mp4: 'video/mp4',\n mov: 'video/mp4',\n m4v: 'video/mp4',\n mkv: 'video/x-matroska',\n m4a: 'audio/mp4',\n mp3: 'audio/mpeg',\n aac: 'audio/aac',\n caf: 'audio/x-caf',\n flac: 'audio/flac',\n oga: 'audio/ogg',\n wav: 'audio/wav',\n m3u8: 'application/x-mpegURL',\n mpd: 'application/dash+xml',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n gif: 'image/gif',\n png: 'image/png',\n svg: 'image/svg+xml',\n webp: 'image/webp'\n};\n\n/**\n * Get the mimetype of a given src url if possible\n *\n * @param {string} src\n * The url to the src\n *\n * @return {string}\n * return the mimetype if it was known or empty string otherwise\n */\nconst getMimetype = function (src = '') {\n const ext = getFileExtension(src);\n const mimetype = MimetypesKind[ext.toLowerCase()];\n return mimetype || '';\n};\n\n/**\n * Find the mime type of a given source string if possible. Uses the player\n * source cache.\n *\n * @param { import('../player').default } player\n * The player object\n *\n * @param {string} src\n * The source string\n *\n * @return {string}\n * The type that was found\n */\nconst findMimetype = (player, src) => {\n if (!src) {\n return '';\n }\n\n // 1. check for the type in the `source` cache\n if (player.cache_.source.src === src && player.cache_.source.type) {\n return player.cache_.source.type;\n }\n\n // 2. see if we have this source in our `currentSources` cache\n const matchingSources = player.cache_.sources.filter(s => s.src === src);\n if (matchingSources.length) {\n return matchingSources[0].type;\n }\n\n // 3. look for the src url in source elements and use the type there\n const sources = player.$$('source');\n for (let i = 0; i < sources.length; i++) {\n const s = sources[i];\n if (s.type && s.src && s.src === src) {\n return s.type;\n }\n }\n\n // 4. finally fallback to our list of mime types based on src url extension\n return getMimetype(src);\n};\n\n/**\n * @module filter-source\n */\n\n/**\n * Filter out single bad source objects or multiple source objects in an\n * array. Also flattens nested source object arrays into a 1 dimensional\n * array of source objects.\n *\n * @param {Tech~SourceObject|Tech~SourceObject[]} src\n * The src object to filter\n *\n * @return {Tech~SourceObject[]}\n * An array of sourceobjects containing only valid sources\n *\n * @private\n */\nconst filterSource = function (src) {\n // traverse array\n if (Array.isArray(src)) {\n let newsrc = [];\n src.forEach(function (srcobj) {\n srcobj = filterSource(srcobj);\n if (Array.isArray(srcobj)) {\n newsrc = newsrc.concat(srcobj);\n } else if (isObject(srcobj)) {\n newsrc.push(srcobj);\n }\n });\n src = newsrc;\n } else if (typeof src === 'string' && src.trim()) {\n // convert string into object\n src = [fixSource({\n src\n })];\n } else if (isObject(src) && typeof src.src === 'string' && src.src && src.src.trim()) {\n // src is already valid\n src = [fixSource(src)];\n } else {\n // invalid source, turn it into an empty array\n src = [];\n }\n return src;\n};\n\n/**\n * Checks src mimetype, adding it when possible\n *\n * @param {Tech~SourceObject} src\n * The src object to check\n * @return {Tech~SourceObject}\n * src Object with known type\n */\nfunction fixSource(src) {\n if (!src.type) {\n const mimetype = getMimetype(src.src);\n if (mimetype) {\n src.type = mimetype;\n }\n }\n return src;\n}\n\nvar icons = \"<svg xmlns=\\\"http://www.w3.org/2000/svg\\\">\\n <defs>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-play\\\">\\n <path d=\\\"M16 10v28l22-14z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-pause\\\">\\n <path d=\\\"M12 38h8V10h-8v28zm16-28v28h8V10h-8z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-audio\\\">\\n <path d=\\\"M24 2C14.06 2 6 10.06 6 20v14c0 3.31 2.69 6 6 6h6V24h-8v-4c0-7.73 6.27-14 14-14s14 6.27 14 14v4h-8v16h6c3.31 0 6-2.69 6-6V20c0-9.94-8.06-18-18-18z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-captions\\\">\\n <path d=\\\"M38 8H10c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h28c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM22 22h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2zm14 0h-3v-1h-4v6h4v-1h3v2a2 2 0 0 1-2 2h-6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-subtitles\\\">\\n <path d=\\\"M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-fullscreen-enter\\\">\\n <path d=\\\"M14 28h-4v10h10v-4h-6v-6zm-4-8h4v-6h6v-4H10v10zm24 14h-6v4h10V28h-4v6zm-6-24v4h6v6h4V10H28z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-fullscreen-exit\\\">\\n <path d=\\\"M10 32h6v6h4V28H10v4zm6-16h-6v4h10V10h-4v6zm12 22h4v-6h6v-4H28v10zm4-22v-6h-4v10h10v-4h-6z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-play-circle\\\">\\n <path d=\\\"M20 33l12-9-12-9v18zm4-29C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-volume-mute\\\">\\n <path d=\\\"M33 24c0-3.53-2.04-6.58-5-8.05v4.42l4.91 4.91c.06-.42.09-.85.09-1.28zm5 0c0 1.88-.41 3.65-1.08 5.28l3.03 3.03C41.25 29.82 42 27 42 24c0-8.56-5.99-15.72-14-17.54v4.13c5.78 1.72 10 7.07 10 13.41zM8.55 6L6 8.55 15.45 18H6v12h8l10 10V26.55l8.51 8.51c-1.34 1.03-2.85 1.86-4.51 2.36v4.13a17.94 17.94 0 0 0 7.37-3.62L39.45 42 42 39.45l-18-18L8.55 6zM24 8l-4.18 4.18L24 16.36V8z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-volume-low\\\">\\n <path d=\\\"M14 18v12h8l10 10V8L22 18h-8z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-volume-medium\\\">\\n <path d=\\\"M37 24c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zm-27-6v12h8l10 10V8L18 18h-8z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-volume-high\\\">\\n <path d=\\\"M6 18v12h8l10 10V8L14 18H6zm27 6c0-3.53-2.04-6.58-5-8.05v16.11c2.96-1.48 5-4.53 5-8.06zM28 6.46v4.13c5.78 1.72 10 7.07 10 13.41s-4.22 11.69-10 13.41v4.13c8.01-1.82 14-8.97 14-17.54S36.01 8.28 28 6.46z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-spinner\\\">\\n <path d=\\\"M18.8 21l9.53-16.51C26.94 4.18 25.49 4 24 4c-4.8 0-9.19 1.69-12.64 4.51l7.33 12.69.11-.2zm24.28-3c-1.84-5.85-6.3-10.52-11.99-12.68L23.77 18h19.31zm.52 2H28.62l.58 1 9.53 16.5C41.99 33.94 44 29.21 44 24c0-1.37-.14-2.71-.4-4zm-26.53 4l-7.8-13.5C6.01 14.06 4 18.79 4 24c0 1.37.14 2.71.4 4h14.98l-2.31-4zM4.92 30c1.84 5.85 6.3 10.52 11.99 12.68L24.23 30H4.92zm22.54 0l-7.8 13.51c1.4.31 2.85.49 4.34.49 4.8 0 9.19-1.69 12.64-4.51L29.31 26.8 27.46 30z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 24 24\\\" id=\\\"vjs-icon-hd\\\">\\n <path d=\\\"M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-8 12H9.5v-2h-2v2H6V9h1.5v2.5h2V9H11v6zm2-6h4c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1h-4V9zm1.5 4.5h2v-3h-2v3z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-chapters\\\">\\n <path d=\\\"M6 26h4v-4H6v4zm0 8h4v-4H6v4zm0-16h4v-4H6v4zm8 8h28v-4H14v4zm0 8h28v-4H14v4zm0-20v4h28v-4H14z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 40 40\\\" id=\\\"vjs-icon-downloading\\\">\\n <path d=\\\"M18.208 36.875q-3.208-.292-5.979-1.729-2.771-1.438-4.812-3.729-2.042-2.292-3.188-5.229-1.146-2.938-1.146-6.23 0-6.583 4.334-11.416 4.333-4.834 10.833-5.5v3.166q-5.167.75-8.583 4.646Q6.25 14.75 6.25 19.958q0 5.209 3.396 9.104 3.396 3.896 8.562 4.646zM20 28.417L11.542 20l2.083-2.083 4.917 4.916v-11.25h2.916v11.25l4.875-4.916L28.417 20zm1.792 8.458v-3.167q1.833-.25 3.541-.958 1.709-.708 3.167-1.875l2.333 2.292q-1.958 1.583-4.25 2.541-2.291.959-4.791 1.167zm6.791-27.792q-1.541-1.125-3.25-1.854-1.708-.729-3.541-1.021V3.042q2.5.25 4.77 1.208 2.271.958 4.271 2.5zm4.584 21.584l-2.25-2.25q1.166-1.5 1.854-3.209.687-1.708.937-3.541h3.209q-.292 2.5-1.229 4.791-.938 2.292-2.521 4.209zm.541-12.417q-.291-1.833-.958-3.562-.667-1.73-1.833-3.188l2.375-2.208q1.541 1.916 2.458 4.208.917 2.292 1.167 4.75z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-file-download\\\">\\n <path d=\\\"M10.8 40.55q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h26.35v-7.7h3.4v7.7q0 1.4-1 2.4t-2.4 1zM24 32.1L13.9 22.05l2.45-2.45 5.95 5.95V7.15h3.4v18.4l5.95-5.95 2.45 2.45z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-file-download-done\\\">\\n <path d=\\\"M9.8 40.5v-3.45h28.4v3.45zm9.2-9.05L7.4 19.85l2.45-2.35L19 26.65l19.2-19.2 2.4 2.4z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-file-download-off\\\">\\n <path d=\\\"M4.9 4.75L43.25 43.1 41 45.3l-4.75-4.75q-.05.05-.075.025-.025-.025-.075-.025H10.8q-1.35 0-2.375-1T7.4 37.15v-7.7h3.4v7.7h22.05l-7-7-1.85 1.8L13.9 21.9l1.85-1.85L2.7 7zm26.75 14.7l2.45 2.45-3.75 3.8-2.45-2.5zM25.7 7.15V21.1l-3.4-3.45V7.15z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-share\\\">\\n <path d=\\\"M36 32.17c-1.52 0-2.89.59-3.93 1.54L17.82 25.4c.11-.45.18-.92.18-1.4s-.07-.95-.18-1.4l14.1-8.23c1.07 1 2.5 1.62 4.08 1.62 3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6c0 .48.07.95.18 1.4l-14.1 8.23c-1.07-1-2.5-1.62-4.08-1.62-3.31 0-6 2.69-6 6s2.69 6 6 6c1.58 0 3.01-.62 4.08-1.62l14.25 8.31c-.1.42-.16.86-.16 1.31A5.83 5.83 0 1 0 36 32.17z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-cog\\\">\\n <path d=\\\"M38.86 25.95c.08-.64.14-1.29.14-1.95s-.06-1.31-.14-1.95l4.23-3.31c.38-.3.49-.84.24-1.28l-4-6.93c-.25-.43-.77-.61-1.22-.43l-4.98 2.01c-1.03-.79-2.16-1.46-3.38-1.97L29 4.84c-.09-.47-.5-.84-1-.84h-8c-.5 0-.91.37-.99.84l-.75 5.3a14.8 14.8 0 0 0-3.38 1.97L9.9 10.1a1 1 0 0 0-1.22.43l-4 6.93c-.25.43-.14.97.24 1.28l4.22 3.31C9.06 22.69 9 23.34 9 24s.06 1.31.14 1.95l-4.22 3.31c-.38.3-.49.84-.24 1.28l4 6.93c.25.43.77.61 1.22.43l4.98-2.01c1.03.79 2.16 1.46 3.38 1.97l.75 5.3c.08.47.49.84.99.84h8c.5 0 .91-.37.99-.84l.75-5.3a14.8 14.8 0 0 0 3.38-1.97l4.98 2.01a1 1 0 0 0 1.22-.43l4-6.93c.25-.43.14-.97-.24-1.28l-4.22-3.31zM24 31c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-square\\\">\\n <path d=\\\"M36 8H12c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h24c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zm0 28H12V12h24v24z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-circle\\\">\\n <circle cx=\\\"24\\\" cy=\\\"24\\\" r=\\\"20\\\"></circle>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-circle-outline\\\">\\n <path d=\\\"M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-circle-inner-circle\\\">\\n <path d=\\\"M24 4C12.97 4 4 12.97 4 24s8.97 20 20 20 20-8.97 20-20S35.03 4 24 4zm0 36c-8.82 0-16-7.18-16-16S15.18 8 24 8s16 7.18 16 16-7.18 16-16 16zm6-16c0 3.31-2.69 6-6 6s-6-2.69-6-6 2.69-6 6-6 6 2.69 6 6z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-cancel\\\">\\n <path d=\\\"M24 4C12.95 4 4 12.95 4 24s8.95 20 20 20 20-8.95 20-20S35.05 4 24 4zm10 27.17L31.17 34 24 26.83 16.83 34 14 31.17 21.17 24 14 16.83 16.83 14 24 21.17 31.17 14 34 16.83 26.83 24 34 31.17z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-replay\\\">\\n <path d=\\\"M24 10V2L14 12l10 10v-8c6.63 0 12 5.37 12 12s-5.37 12-12 12-12-5.37-12-12H8c0 8.84 7.16 16 16 16s16-7.16 16-16-7.16-16-16-16z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-repeat\\\">\\n <path d=\\\"M14 14h20v6l8-8-8-8v6H10v12h4v-8zm20 20H14v-6l-8 8 8 8v-6h24V26h-4v8z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 96 48 48\\\" id=\\\"vjs-icon-replay-5\\\">\\n <path d=\\\"M17.689 98l-8.697 8.696 8.697 8.697 2.486-2.485-4.32-4.319h1.302c4.93 0 9.071 1.722 12.424 5.165 3.352 3.443 5.029 7.638 5.029 12.584h3.55c0-2.958-.553-5.73-1.658-8.313-1.104-2.583-2.622-4.841-4.555-6.774-1.932-1.932-4.19-3.45-6.773-4.555-2.584-1.104-5.355-1.657-8.313-1.657H15.5l4.615-4.615zm-8.08 21.659v13.861h11.357v5.008H9.609V143h12.7c.834 0 1.55-.298 2.146-.894.596-.597.895-1.31.895-2.145v-7.781c0-.835-.299-1.55-.895-2.147a2.929 2.929 0 0 0-2.147-.894h-8.227v-5.096H25.35v-4.384z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 96 48 48\\\" id=\\\"vjs-icon-replay-10\\\">\\n <path d=\\\"M42.315 125.63c0-4.997-1.694-9.235-5.08-12.713-3.388-3.479-7.571-5.218-12.552-5.218h-1.315l4.363 4.363-2.51 2.51-8.787-8.786L25.221 97l2.45 2.45-4.662 4.663h1.375c2.988 0 5.788.557 8.397 1.673 2.61 1.116 4.892 2.65 6.844 4.602 1.953 1.953 3.487 4.234 4.602 6.844 1.116 2.61 1.674 5.41 1.674 8.398zM8.183 142v-19.657H3.176V117.8h9.643V142zm13.63 0c-1.156 0-2.127-.393-2.912-1.178-.778-.778-1.168-1.746-1.168-2.902v-16.04c0-1.156.393-2.127 1.178-2.912.779-.779 1.746-1.168 2.902-1.168h7.696c1.156 0 2.126.392 2.911 1.177.779.78 1.168 1.747 1.168 2.903v16.04c0 1.156-.392 2.127-1.177 2.912-.779.779-1.746 1.168-2.902 1.168zm.556-4.636h6.583v-15.02H22.37z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 96 48 48\\\" id=\\\"vjs-icon-replay-30\\\">\\n <path d=\\\"M26.047 97l-8.733 8.732 8.733 8.733 2.496-2.494-4.336-4.338h1.307c4.95 0 9.108 1.73 12.474 5.187 3.367 3.458 5.051 7.668 5.051 12.635h3.565c0-2.97-.556-5.751-1.665-8.346-1.109-2.594-2.633-4.862-4.574-6.802-1.94-1.941-4.208-3.466-6.803-4.575-2.594-1.109-5.375-1.664-8.345-1.664H23.85l4.634-4.634zM2.555 117.531v4.688h10.297v5.25H5.873v4.687h6.979v5.156H2.555V142H13.36c1.061 0 1.95-.395 2.668-1.186.718-.79 1.076-1.772 1.076-2.94v-16.218c0-1.168-.358-2.149-1.076-2.94-.717-.79-1.607-1.185-2.668-1.185zm22.482.14c-1.149 0-2.11.39-2.885 1.165-.78.78-1.172 1.744-1.172 2.893v15.943c0 1.149.388 2.11 1.163 2.885.78.78 1.745 1.172 2.894 1.172h7.649c1.148 0 2.11-.388 2.884-1.163.78-.78 1.17-1.745 1.17-2.894v-15.943c0-1.15-.386-2.111-1.16-2.885-.78-.78-1.746-1.172-2.894-1.172zm.553 4.518h6.545v14.93H25.59z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 96 48 48\\\" id=\\\"vjs-icon-forward-5\\\">\\n <path d=\\\"M29.508 97l-2.431 2.43 4.625 4.625h-1.364c-2.965 0-5.742.554-8.332 1.66-2.589 1.107-4.851 2.629-6.788 4.566-1.937 1.937-3.458 4.2-4.565 6.788-1.107 2.59-1.66 5.367-1.66 8.331h3.557c0-4.957 1.68-9.16 5.04-12.611 3.36-3.45 7.51-5.177 12.451-5.177h1.304l-4.326 4.33 2.49 2.49 8.715-8.716zm-9.783 21.61v13.89h11.382v5.018H19.725V142h12.727a2.93 2.93 0 0 0 2.15-.896 2.93 2.93 0 0 0 .896-2.15v-7.798c0-.837-.299-1.554-.896-2.152a2.93 2.93 0 0 0-2.15-.896h-8.245V123h11.29v-4.392z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 96 48 48\\\" id=\\\"vjs-icon-forward-10\\\">\\n <path d=\\\"M23.119 97l-2.386 2.383 4.538 4.538h-1.339c-2.908 0-5.633.543-8.173 1.63-2.54 1.085-4.76 2.577-6.66 4.478-1.9 1.9-3.392 4.12-4.478 6.66-1.085 2.54-1.629 5.264-1.629 8.172h3.49c0-4.863 1.648-8.986 4.944-12.372 3.297-3.385 7.368-5.078 12.216-5.078h1.279l-4.245 4.247 2.443 2.442 8.55-8.55zm-9.52 21.45v4.42h4.871V142h4.513v-23.55zm18.136 0c-1.125 0-2.066.377-2.824 1.135-.764.764-1.148 1.709-1.148 2.834v15.612c0 1.124.38 2.066 1.139 2.824.764.764 1.708 1.145 2.833 1.145h7.489c1.125 0 2.066-.378 2.824-1.136.764-.764 1.145-1.709 1.145-2.833v-15.612c0-1.125-.378-2.067-1.136-2.825-.764-.764-1.708-1.145-2.833-1.145zm.54 4.42h6.408v14.617h-6.407z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 96 48 48\\\" id=\\\"vjs-icon-forward-30\\\">\\n <path d=\\\"M25.549 97l-2.437 2.434 4.634 4.635H26.38c-2.97 0-5.753.555-8.347 1.664-2.594 1.109-4.861 2.633-6.802 4.574-1.94 1.94-3.465 4.207-4.574 6.802-1.109 2.594-1.664 5.377-1.664 8.347h3.565c0-4.967 1.683-9.178 5.05-12.636 3.366-3.458 7.525-5.187 12.475-5.187h1.307l-4.335 4.338 2.495 2.494 8.732-8.732zm-11.553 20.53v4.689h10.297v5.249h-6.978v4.688h6.978v5.156H13.996V142h10.808c1.06 0 1.948-.395 2.666-1.186.718-.79 1.077-1.771 1.077-2.94v-16.217c0-1.169-.36-2.15-1.077-2.94-.718-.79-1.605-1.186-2.666-1.186zm21.174.168c-1.149 0-2.11.389-2.884 1.163-.78.78-1.172 1.745-1.172 2.894v15.942c0 1.15.388 2.11 1.162 2.885.78.78 1.745 1.17 2.894 1.17h7.649c1.149 0 2.11-.386 2.885-1.16.78-.78 1.17-1.746 1.17-2.895v-15.942c0-1.15-.387-2.11-1.161-2.885-.78-.78-1.745-1.172-2.894-1.172zm.552 4.516h6.542v14.931h-6.542z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 512 512\\\" id=\\\"vjs-icon-audio-description\\\">\\n <g fill-rule=\\\"evenodd\\\"><path d=\\\"M227.29 381.351V162.993c50.38-1.017 89.108-3.028 117.631 17.126 27.374 19.342 48.734 56.965 44.89 105.325-4.067 51.155-41.335 94.139-89.776 98.475-24.085 2.155-71.972 0-71.972 0s-.84-1.352-.773-2.568m48.755-54.804c31.43 1.26 53.208-16.633 56.495-45.386 4.403-38.51-21.188-63.552-58.041-60.796v103.612c-.036 1.466.575 2.22 1.546 2.57\\\"></path><path d=\\\"M383.78 381.328c13.336 3.71 17.387-11.06 23.215-21.408 12.722-22.571 22.294-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.226 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894\\\"></path><path d=\\\"M425.154 381.328c13.336 3.71 17.384-11.061 23.215-21.408 12.721-22.571 22.291-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.511c-.586 3.874 2.226 7.315 3.866 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894\\\"></path><path d=\\\"M466.26 381.328c13.337 3.71 17.385-11.061 23.216-21.408 12.722-22.571 22.292-51.594 22.445-84.774.221-47.594-18.343-82.517-35.6-106.182h-8.51c-.587 3.874 2.225 7.315 3.865 10.276 13.166 23.762 25.367 56.553 25.54 94.194.2 43.176-14.162 79.278-30.955 107.894M4.477 383.005H72.58l18.573-28.484 64.169-.135s.065 19.413.065 28.62h48.756V160.307h-58.816c-5.653 9.537-140.85 222.697-140.85 222.697zm152.667-145.282v71.158l-40.453-.27 40.453-70.888z\\\"></path></g>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-next-item\\\">\\n <path d=\\\"M12 36l17-12-17-12v24zm20-24v24h4V12h-4z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-previous-item\\\">\\n <path d=\\\"M12 12h4v24h-4zm7 12l17 12V12z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-shuffle\\\">\\n <path d=\\\"M21.17 18.34L10.83 8 8 10.83l10.34 10.34 2.83-2.83zM29 8l4.09 4.09L8 37.17 10.83 40l25.09-25.09L40 19V8H29zm.66 18.83l-2.83 2.83 6.26 6.26L29 40h11V29l-4.09 4.09-6.25-6.26z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-cast\\\">\\n <path d=\\\"M42 6H6c-2.21 0-4 1.79-4 4v6h4v-6h36v28H28v4h14c2.21 0 4-1.79 4-4V10c0-2.21-1.79-4-4-4zM2 36v6h6c0-3.31-2.69-6-6-6zm0-8v4c5.52 0 10 4.48 10 10h4c0-7.73-6.27-14-14-14zm0-8v4c9.94 0 18 8.06 18 18h4c0-12.15-9.85-22-22-22z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 48 48\\\" id=\\\"vjs-icon-picture-in-picture-enter\\\">\\n <path d=\\\"M38 22H22v11.99h16V22zm8 16V9.96C46 7.76 44.2 6 42 6H6C3.8 6 2 7.76 2 9.96V38c0 2.2 1.8 4 4 4h36c2.2 0 4-1.8 4-4zm-4 .04H6V9.94h36v28.1z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 22 18\\\" id=\\\"vjs-icon-picture-in-picture-exit\\\">\\n <path d=\\\"M18 4H4v10h14V4zm4 12V1.98C22 .88 21.1 0 20 0H2C.9 0 0 .88 0 1.98V16c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H2V1.97h18v14.05z\\\"></path>\\n <path fill=\\\"none\\\" d=\\\"M-1-3h24v24H-1z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 1792 1792\\\" id=\\\"vjs-icon-facebook\\\">\\n <path d=\\\"M1343 12v264h-157q-86 0-116 36t-30 108v189h293l-39 296h-254v759H734V905H479V609h255V391q0-186 104-288.5T1115 0q147 0 228 12z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 1792 1792\\\" id=\\\"vjs-icon-linkedin\\\">\\n <path d=\\\"M477 625v991H147V625h330zm21-306q1 73-50.5 122T312 490h-2q-82 0-132-49t-50-122q0-74 51.5-122.5T314 148t133 48.5T498 319zm1166 729v568h-329v-530q0-105-40.5-164.5T1168 862q-63 0-105.5 34.5T999 982q-11 30-11 81v553H659q2-399 2-647t-1-296l-1-48h329v144h-2q20-32 41-56t56.5-52 87-43.5T1285 602q171 0 275 113.5t104 332.5z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 1792 1792\\\" id=\\\"vjs-icon-twitter\\\">\\n <path d=\\\"M1684 408q-67 98-162 167 1 14 1 42 0 130-38 259.5T1369.5 1125 1185 1335.5t-258 146-323 54.5q-271 0-496-145 35 4 78 4 225 0 401-138-105-2-188-64.5T285 1033q33 5 61 5 43 0 85-11-112-23-185.5-111.5T172 710v-4q68 38 146 41-66-44-105-115t-39-154q0-88 44-163 121 149 294.5 238.5T884 653q-8-38-8-74 0-134 94.5-228.5T1199 256q140 0 236 102 109-21 205-78-37 115-142 178 93-10 186-50z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 1792 1792\\\" id=\\\"vjs-icon-tumblr\\\">\\n <path d=\\\"M1328 1329l80 237q-23 35-111 66t-177 32q-104 2-190.5-26T787 1564t-95-106-55.5-120-16.5-118V676H452V461q72-26 129-69.5t91-90 58-102 34-99T779 12q1-5 4.5-8.5T791 0h244v424h333v252h-334v518q0 30 6.5 56t22.5 52.5 49.5 41.5 81.5 14q78-2 134-29z\\\"></path>\\n </symbol>\\n <symbol viewBox=\\\"0 0 1792 1792\\\" id=\\\"vjs-icon-pinterest\\\">\\n <path d=\\\"M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z\\\"></path>\\n </symbol>\\n </defs>\\n</svg>\";\n\n/**\n * @file loader.js\n */\n\n/**\n * The `MediaLoader` is the `Component` that decides which playback technology to load\n * when a player is initialized.\n *\n * @extends Component\n */\nclass MediaLoader extends Component$1 {\n /**\n * Create an instance of this class.\n *\n * @param { import('../player').default } player\n * The `Player` that this class should attach to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Function} [ready]\n * The function that is run when this component is ready.\n */\n constructor(player, options, ready) {\n // MediaLoader has no element\n const options_ = merge$1({\n createEl: false\n }, options);\n super(player, options_, ready);\n\n // If there are no sources when the player is initialized,\n // load the first supported playback technology.\n\n if (!options.playerOptions.sources || options.playerOptions.sources.length === 0) {\n for (let i = 0, j = options.playerOptions.techOrder; i < j.length; i++) {\n const techName = toTitleCase$1(j[i]);\n let tech = Tech.getTech(techName);\n\n // Support old behavior of techs being registered as components.\n // Remove once that deprecated behavior is removed.\n if (!techName) {\n tech = Component$1.getComponent(techName);\n }\n\n // Check if the browser supports this technology\n if (tech && tech.isSupported()) {\n player.loadTech_(techName);\n break;\n }\n }\n } else {\n // Loop through playback technologies (e.g. HTML5) and check for support.\n // Then load the best source.\n // A few assumptions here:\n // All playback technologies respect preload false.\n player.src(options.playerOptions.sources);\n }\n }\n}\nComponent$1.registerComponent('MediaLoader', MediaLoader);\n\n/**\n * @file clickable-component.js\n */\n\n/**\n * Component which is clickable or keyboard actionable, but is not a\n * native HTML button.\n *\n * @extends Component\n */\nclass ClickableComponent extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of component options.\n *\n * @param {function} [options.clickHandler]\n * The function to call when the button is clicked / activated\n *\n * @param {string} [options.controlText]\n * The text to set on the button\n *\n * @param {string} [options.className]\n * A class or space separated list of classes to add the component\n *\n */\n constructor(player, options) {\n super(player, options);\n if (this.options_.controlText) {\n this.controlText(this.options_.controlText);\n }\n this.handleMouseOver_ = e => this.handleMouseOver(e);\n this.handleMouseOut_ = e => this.handleMouseOut(e);\n this.handleClick_ = e => this.handleClick(e);\n this.handleKeyDown_ = e => this.handleKeyDown(e);\n this.emitTapEvents();\n this.enable();\n }\n\n /**\n * Create the `ClickableComponent`s DOM element.\n *\n * @param {string} [tag=div]\n * The element's node type.\n *\n * @param {Object} [props={}]\n * An object of properties that should be set on the element.\n *\n * @param {Object} [attributes={}]\n * An object of attributes that should be set on the element.\n *\n * @return {Element}\n * The element that gets created.\n */\n createEl(tag = 'div', props = {}, attributes = {}) {\n props = Object.assign({\n className: this.buildCSSClass(),\n tabIndex: 0\n }, props);\n if (tag === 'button') {\n log$1.error(`Creating a ClickableComponent with an HTML element of ${tag} is not supported; use a Button instead.`);\n }\n\n // Add ARIA attributes for clickable element which is not a native HTML button\n attributes = Object.assign({\n role: 'button'\n }, attributes);\n this.tabIndex_ = props.tabIndex;\n const el = createEl(tag, props, attributes);\n if (!this.player_.options_.experimentalSvgIcons) {\n el.appendChild(createEl('span', {\n className: 'vjs-icon-placeholder'\n }, {\n 'aria-hidden': true\n }));\n }\n this.createControlTextEl(el);\n return el;\n }\n dispose() {\n // remove controlTextEl_ on dispose\n this.controlTextEl_ = null;\n super.dispose();\n }\n\n /**\n * Create a control text element on this `ClickableComponent`\n *\n * @param {Element} [el]\n * Parent element for the control text.\n *\n * @return {Element}\n * The control text element that gets created.\n */\n createControlTextEl(el) {\n this.controlTextEl_ = createEl('span', {\n className: 'vjs-control-text'\n }, {\n // let the screen reader user know that the text of the element may change\n 'aria-live': 'polite'\n });\n if (el) {\n el.appendChild(this.controlTextEl_);\n }\n this.controlText(this.controlText_, el);\n return this.controlTextEl_;\n }\n\n /**\n * Get or set the localize text to use for the controls on the `ClickableComponent`.\n *\n * @param {string} [text]\n * Control text for element.\n *\n * @param {Element} [el=this.el()]\n * Element to set the title on.\n *\n * @return {string}\n * - The control text when getting\n */\n controlText(text, el = this.el()) {\n if (text === undefined) {\n return this.controlText_ || 'Need Text';\n }\n const localizedText = this.localize(text);\n\n /** @protected */\n this.controlText_ = text;\n textContent(this.controlTextEl_, localizedText);\n if (!this.nonIconControl && !this.player_.options_.noUITitleAttributes) {\n // Set title attribute if only an icon is shown\n el.setAttribute('title', localizedText);\n }\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-control vjs-button ${super.buildCSSClass()}`;\n }\n\n /**\n * Enable this `ClickableComponent`\n */\n enable() {\n if (!this.enabled_) {\n this.enabled_ = true;\n this.removeClass('vjs-disabled');\n this.el_.setAttribute('aria-disabled', 'false');\n if (typeof this.tabIndex_ !== 'undefined') {\n this.el_.setAttribute('tabIndex', this.tabIndex_);\n }\n this.on(['tap', 'click'], this.handleClick_);\n this.on('keydown', this.handleKeyDown_);\n }\n }\n\n /**\n * Disable this `ClickableComponent`\n */\n disable() {\n this.enabled_ = false;\n this.addClass('vjs-disabled');\n this.el_.setAttribute('aria-disabled', 'true');\n if (typeof this.tabIndex_ !== 'undefined') {\n this.el_.removeAttribute('tabIndex');\n }\n this.off('mouseover', this.handleMouseOver_);\n this.off('mouseout', this.handleMouseOut_);\n this.off(['tap', 'click'], this.handleClick_);\n this.off('keydown', this.handleKeyDown_);\n }\n\n /**\n * Handles language change in ClickableComponent for the player in components\n *\n *\n */\n handleLanguagechange() {\n this.controlText(this.controlText_);\n }\n\n /**\n * Event handler that is called when a `ClickableComponent` receives a\n * `click` or `tap` event.\n *\n * @param {Event} event\n * The `tap` or `click` event that caused this function to be called.\n *\n * @listens tap\n * @listens click\n * @abstract\n */\n handleClick(event) {\n if (this.options_.clickHandler) {\n this.options_.clickHandler.call(this, arguments);\n }\n }\n\n /**\n * Event handler that is called when a `ClickableComponent` receives a\n * `keydown` event.\n *\n * By default, if the key is Space or Enter, it will trigger a `click` event.\n *\n * @param {KeyboardEvent} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n handleKeyDown(event) {\n // Support Space or Enter key operation to fire a click event. Also,\n // prevent the event from propagating through the DOM and triggering\n // Player hotkeys.\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Space') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Enter')) {\n event.preventDefault();\n event.stopPropagation();\n this.trigger('click');\n } else {\n // Pass keypress handling up for unsupported keys\n super.handleKeyDown(event);\n }\n }\n}\nComponent$1.registerComponent('ClickableComponent', ClickableComponent);\n\n/**\n * @file poster-image.js\n */\n\n/**\n * A `ClickableComponent` that handles showing the poster image for the player.\n *\n * @extends ClickableComponent\n */\nclass PosterImage extends ClickableComponent {\n /**\n * Create an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should attach to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.update();\n this.update_ = e => this.update(e);\n player.on('posterchange', this.update_);\n }\n\n /**\n * Clean up and dispose of the `PosterImage`.\n */\n dispose() {\n this.player().off('posterchange', this.update_);\n super.dispose();\n }\n\n /**\n * Create the `PosterImage`s DOM element.\n *\n * @return {Element}\n * The element that gets created.\n */\n createEl() {\n // The el is an empty div to keep position in the DOM\n // A picture and img el will be inserted when a source is set\n return createEl('div', {\n className: 'vjs-poster'\n });\n }\n\n /**\n * Get or set the `PosterImage`'s crossOrigin option.\n *\n * @param {string|null} [value]\n * The value to set the crossOrigin to. If an argument is\n * given, must be one of `'anonymous'` or `'use-credentials'`, or 'null'.\n *\n * @return {string|null}\n * - The current crossOrigin value of the `Player` when getting.\n * - undefined when setting\n */\n crossOrigin(value) {\n // `null` can be set to unset a value\n if (typeof value === 'undefined') {\n if (this.$('img')) {\n // If the poster's element exists, give its value\n return this.$('img').crossOrigin;\n } else if (this.player_.tech_ && this.player_.tech_.isReady_) {\n // If not but the tech is ready, query the tech\n return this.player_.crossOrigin();\n }\n // Otherwise check options as the poster is usually set before the state of crossorigin\n // can be retrieved by the getter\n return this.player_.options_.crossOrigin || this.player_.options_.crossorigin || null;\n }\n if (value !== null && value !== 'anonymous' && value !== 'use-credentials') {\n this.player_.log.warn(`crossOrigin must be null, \"anonymous\" or \"use-credentials\", given \"${value}\"`);\n return;\n }\n if (this.$('img')) {\n this.$('img').crossOrigin = value;\n }\n return;\n }\n\n /**\n * An {@link EventTarget~EventListener} for {@link Player#posterchange} events.\n *\n * @listens Player#posterchange\n *\n * @param {Event} [event]\n * The `Player#posterchange` event that triggered this function.\n */\n update(event) {\n const url = this.player().poster();\n this.setSrc(url);\n\n // If there's no poster source we should display:none on this component\n // so it's not still clickable or right-clickable\n if (url) {\n this.show();\n } else {\n this.hide();\n }\n }\n\n /**\n * Set the source of the `PosterImage` depending on the display method. (Re)creates\n * the inner picture and img elementss when needed.\n *\n * @param {string} [url]\n * The URL to the source for the `PosterImage`. If not specified or falsy,\n * any source and ant inner picture/img are removed.\n */\n setSrc(url) {\n if (!url) {\n this.el_.textContent = '';\n return;\n }\n if (!this.$('img')) {\n this.el_.appendChild(createEl('picture', {\n className: 'vjs-poster',\n // Don't want poster to be tabbable.\n tabIndex: -1\n }, {}, createEl('img', {\n loading: 'lazy',\n crossOrigin: this.crossOrigin()\n }, {\n alt: ''\n })));\n }\n this.$('img').src = url;\n }\n\n /**\n * An {@link EventTarget~EventListener} for clicks on the `PosterImage`. See\n * {@link ClickableComponent#handleClick} for instances where this will be triggered.\n *\n * @listens tap\n * @listens click\n * @listens keydown\n *\n * @param {Event} event\n + The `click`, `tap` or `keydown` event that caused this function to be called.\n */\n handleClick(event) {\n // We don't want a click to trigger playback when controls are disabled\n if (!this.player_.controls()) {\n return;\n }\n if (this.player_.tech(true)) {\n this.player_.tech(true).focus();\n }\n if (this.player_.paused()) {\n silencePromise(this.player_.play());\n } else {\n this.player_.pause();\n }\n }\n}\n\n/**\n * Get or set the `PosterImage`'s crossorigin option. For the HTML5 player, this\n * sets the `crossOrigin` property on the `<img>` tag to control the CORS\n * behavior.\n *\n * @param {string|null} [value]\n * The value to set the `PosterImages`'s crossorigin to. If an argument is\n * given, must be one of `anonymous` or `use-credentials`.\n *\n * @return {string|null|undefined}\n * - The current crossorigin value of the `Player` when getting.\n * - undefined when setting\n */\nPosterImage.prototype.crossorigin = PosterImage.prototype.crossOrigin;\nComponent$1.registerComponent('PosterImage', PosterImage);\n\n/**\n * @file text-track-display.js\n */\nconst darkGray = '#222';\nconst lightGray = '#ccc';\nconst fontMap = {\n monospace: 'monospace',\n sansSerif: 'sans-serif',\n serif: 'serif',\n monospaceSansSerif: '\"Andale Mono\", \"Lucida Console\", monospace',\n monospaceSerif: '\"Courier New\", monospace',\n proportionalSansSerif: 'sans-serif',\n proportionalSerif: 'serif',\n casual: '\"Comic Sans MS\", Impact, fantasy',\n script: '\"Monotype Corsiva\", cursive',\n smallcaps: '\"Andale Mono\", \"Lucida Console\", monospace, sans-serif'\n};\n\n/**\n * Construct an rgba color from a given hex color code.\n *\n * @param {number} color\n * Hex number for color, like #f0e or #f604e2.\n *\n * @param {number} opacity\n * Value for opacity, 0.0 - 1.0.\n *\n * @return {string}\n * The rgba color that was created, like 'rgba(255, 0, 0, 0.3)'.\n */\nfunction constructColor(color, opacity) {\n let hex;\n if (color.length === 4) {\n // color looks like \"#f0e\"\n hex = color[1] + color[1] + color[2] + color[2] + color[3] + color[3];\n } else if (color.length === 7) {\n // color looks like \"#f604e2\"\n hex = color.slice(1);\n } else {\n throw new Error('Invalid color code provided, ' + color + '; must be formatted as e.g. #f0e or #f604e2.');\n }\n return 'rgba(' + parseInt(hex.slice(0, 2), 16) + ',' + parseInt(hex.slice(2, 4), 16) + ',' + parseInt(hex.slice(4, 6), 16) + ',' + opacity + ')';\n}\n\n/**\n * Try to update the style of a DOM element. Some style changes will throw an error,\n * particularly in IE8. Those should be noops.\n *\n * @param {Element} el\n * The DOM element to be styled.\n *\n * @param {string} style\n * The CSS property on the element that should be styled.\n *\n * @param {string} rule\n * The style rule that should be applied to the property.\n *\n * @private\n */\nfunction tryUpdateStyle(el, style, rule) {\n try {\n el.style[style] = rule;\n } catch (e) {\n // Satisfies linter.\n return;\n }\n}\n\n/**\n * Converts the CSS top/right/bottom/left property numeric value to string in pixels.\n *\n * @param {number} position\n * The CSS top/right/bottom/left property value.\n *\n * @return {string}\n * The CSS property value that was created, like '10px'.\n *\n * @private\n */\nfunction getCSSPositionValue(position) {\n return position ? `${position}px` : '';\n}\n\n/**\n * The component for displaying text track cues.\n *\n * @extends Component\n */\nclass TextTrackDisplay extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Function} [ready]\n * The function to call when `TextTrackDisplay` is ready.\n */\n constructor(player, options, ready) {\n super(player, options, ready);\n const updateDisplayTextHandler = e => this.updateDisplay(e);\n const updateDisplayHandler = e => {\n this.updateDisplayOverlay();\n this.updateDisplay(e);\n };\n player.on('loadstart', e => this.toggleDisplay(e));\n player.on('texttrackchange', updateDisplayTextHandler);\n player.on('loadedmetadata', e => {\n this.updateDisplayOverlay();\n this.preselectTrack(e);\n });\n\n // This used to be called during player init, but was causing an error\n // if a track should show by default and the display hadn't loaded yet.\n // Should probably be moved to an external track loader when we support\n // tracks that don't need a display.\n player.ready(bind_(this, function () {\n if (player.tech_ && player.tech_.featuresNativeTextTracks) {\n this.hide();\n return;\n }\n player.on('fullscreenchange', updateDisplayHandler);\n player.on('playerresize', updateDisplayHandler);\n const screenOrientation = (global_window__WEBPACK_IMPORTED_MODULE_0___default().screen).orientation || (global_window__WEBPACK_IMPORTED_MODULE_0___default());\n const changeOrientationEvent = (global_window__WEBPACK_IMPORTED_MODULE_0___default().screen).orientation ? 'change' : 'orientationchange';\n screenOrientation.addEventListener(changeOrientationEvent, updateDisplayHandler);\n player.on('dispose', () => screenOrientation.removeEventListener(changeOrientationEvent, updateDisplayHandler));\n const tracks = this.options_.playerOptions.tracks || [];\n for (let i = 0; i < tracks.length; i++) {\n this.player_.addRemoteTextTrack(tracks[i], true);\n }\n this.preselectTrack();\n }));\n }\n\n /**\n * Preselect a track following this precedence:\n * - matches the previously selected {@link TextTrack}'s language and kind\n * - matches the previously selected {@link TextTrack}'s language only\n * - is the first default captions track\n * - is the first default descriptions track\n *\n * @listens Player#loadstart\n */\n preselectTrack() {\n const modes = {\n captions: 1,\n subtitles: 1\n };\n const trackList = this.player_.textTracks();\n const userPref = this.player_.cache_.selectedLanguage;\n let firstDesc;\n let firstCaptions;\n let preferredTrack;\n for (let i = 0; i < trackList.length; i++) {\n const track = trackList[i];\n if (userPref && userPref.enabled && userPref.language && userPref.language === track.language && track.kind in modes) {\n // Always choose the track that matches both language and kind\n if (track.kind === userPref.kind) {\n preferredTrack = track;\n // or choose the first track that matches language\n } else if (!preferredTrack) {\n preferredTrack = track;\n }\n\n // clear everything if offTextTrackMenuItem was clicked\n } else if (userPref && !userPref.enabled) {\n preferredTrack = null;\n firstDesc = null;\n firstCaptions = null;\n } else if (track.default) {\n if (track.kind === 'descriptions' && !firstDesc) {\n firstDesc = track;\n } else if (track.kind in modes && !firstCaptions) {\n firstCaptions = track;\n }\n }\n }\n\n // The preferredTrack matches the user preference and takes\n // precedence over all the other tracks.\n // So, display the preferredTrack before the first default track\n // and the subtitles/captions track before the descriptions track\n if (preferredTrack) {\n preferredTrack.mode = 'showing';\n } else if (firstCaptions) {\n firstCaptions.mode = 'showing';\n } else if (firstDesc) {\n firstDesc.mode = 'showing';\n }\n }\n\n /**\n * Turn display of {@link TextTrack}'s from the current state into the other state.\n * There are only two states:\n * - 'shown'\n * - 'hidden'\n *\n * @listens Player#loadstart\n */\n toggleDisplay() {\n if (this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks) {\n this.hide();\n } else {\n this.show();\n }\n }\n\n /**\n * Create the {@link Component}'s DOM element.\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n return super.createEl('div', {\n className: 'vjs-text-track-display'\n }, {\n 'translate': 'yes',\n 'aria-live': 'off',\n 'aria-atomic': 'true'\n });\n }\n\n /**\n * Clear all displayed {@link TextTrack}s.\n */\n clearDisplay() {\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) === 'function') {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT.processCues((global_window__WEBPACK_IMPORTED_MODULE_0___default()), [], this.el_);\n }\n }\n\n /**\n * Update the displayed TextTrack when a either a {@link Player#texttrackchange} or\n * a {@link Player#fullscreenchange} is fired.\n *\n * @listens Player#texttrackchange\n * @listens Player#fullscreenchange\n */\n updateDisplay() {\n const tracks = this.player_.textTracks();\n const allowMultipleShowingTracks = this.options_.allowMultipleShowingTracks;\n this.clearDisplay();\n if (allowMultipleShowingTracks) {\n const showingTracks = [];\n for (let i = 0; i < tracks.length; ++i) {\n const track = tracks[i];\n if (track.mode !== 'showing') {\n continue;\n }\n showingTracks.push(track);\n }\n this.updateForTrack(showingTracks);\n return;\n }\n\n // Track display prioritization model: if multiple tracks are 'showing',\n // display the first 'subtitles' or 'captions' track which is 'showing',\n // otherwise display the first 'descriptions' track which is 'showing'\n\n let descriptionsTrack = null;\n let captionsSubtitlesTrack = null;\n let i = tracks.length;\n while (i--) {\n const track = tracks[i];\n if (track.mode === 'showing') {\n if (track.kind === 'descriptions') {\n descriptionsTrack = track;\n } else {\n captionsSubtitlesTrack = track;\n }\n }\n }\n if (captionsSubtitlesTrack) {\n if (this.getAttribute('aria-live') !== 'off') {\n this.setAttribute('aria-live', 'off');\n }\n this.updateForTrack(captionsSubtitlesTrack);\n } else if (descriptionsTrack) {\n if (this.getAttribute('aria-live') !== 'assertive') {\n this.setAttribute('aria-live', 'assertive');\n }\n this.updateForTrack(descriptionsTrack);\n }\n }\n\n /**\n * Updates the displayed TextTrack to be sure it overlays the video when a either\n * a {@link Player#texttrackchange} or a {@link Player#fullscreenchange} is fired.\n */\n updateDisplayOverlay() {\n // inset-inline and inset-block are not supprted on old chrome, but these are\n // only likely to be used on TV devices\n if (!this.player_.videoHeight() || !global_window__WEBPACK_IMPORTED_MODULE_0___default().CSS.supports('inset-inline: 10px')) {\n return;\n }\n const playerWidth = this.player_.currentWidth();\n const playerHeight = this.player_.currentHeight();\n const playerAspectRatio = playerWidth / playerHeight;\n const videoAspectRatio = this.player_.videoWidth() / this.player_.videoHeight();\n let insetInlineMatch = 0;\n let insetBlockMatch = 0;\n if (Math.abs(playerAspectRatio - videoAspectRatio) > 0.1) {\n if (playerAspectRatio > videoAspectRatio) {\n insetInlineMatch = Math.round((playerWidth - playerHeight * videoAspectRatio) / 2);\n } else {\n insetBlockMatch = Math.round((playerHeight - playerWidth / videoAspectRatio) / 2);\n }\n }\n tryUpdateStyle(this.el_, 'insetInline', getCSSPositionValue(insetInlineMatch));\n tryUpdateStyle(this.el_, 'insetBlock', getCSSPositionValue(insetBlockMatch));\n }\n\n /**\n * Style {@Link TextTrack} activeCues according to {@Link TextTrackSettings}.\n *\n * @param {TextTrack} track\n * Text track object containing active cues to style.\n */\n updateDisplayState(track) {\n const overrides = this.player_.textTrackSettings.getValues();\n const cues = track.activeCues;\n let i = cues.length;\n while (i--) {\n const cue = cues[i];\n if (!cue) {\n continue;\n }\n const cueDiv = cue.displayState;\n if (overrides.color) {\n cueDiv.firstChild.style.color = overrides.color;\n }\n if (overrides.textOpacity) {\n tryUpdateStyle(cueDiv.firstChild, 'color', constructColor(overrides.color || '#fff', overrides.textOpacity));\n }\n if (overrides.backgroundColor) {\n cueDiv.firstChild.style.backgroundColor = overrides.backgroundColor;\n }\n if (overrides.backgroundOpacity) {\n tryUpdateStyle(cueDiv.firstChild, 'backgroundColor', constructColor(overrides.backgroundColor || '#000', overrides.backgroundOpacity));\n }\n if (overrides.windowColor) {\n if (overrides.windowOpacity) {\n tryUpdateStyle(cueDiv, 'backgroundColor', constructColor(overrides.windowColor, overrides.windowOpacity));\n } else {\n cueDiv.style.backgroundColor = overrides.windowColor;\n }\n }\n if (overrides.edgeStyle) {\n if (overrides.edgeStyle === 'dropshadow') {\n cueDiv.firstChild.style.textShadow = `2px 2px 3px ${darkGray}, 2px 2px 4px ${darkGray}, 2px 2px 5px ${darkGray}`;\n } else if (overrides.edgeStyle === 'raised') {\n cueDiv.firstChild.style.textShadow = `1px 1px ${darkGray}, 2px 2px ${darkGray}, 3px 3px ${darkGray}`;\n } else if (overrides.edgeStyle === 'depressed') {\n cueDiv.firstChild.style.textShadow = `1px 1px ${lightGray}, 0 1px ${lightGray}, -1px -1px ${darkGray}, 0 -1px ${darkGray}`;\n } else if (overrides.edgeStyle === 'uniform') {\n cueDiv.firstChild.style.textShadow = `0 0 4px ${darkGray}, 0 0 4px ${darkGray}, 0 0 4px ${darkGray}, 0 0 4px ${darkGray}`;\n }\n }\n if (overrides.fontPercent && overrides.fontPercent !== 1) {\n const fontSize = global_window__WEBPACK_IMPORTED_MODULE_0___default().parseFloat(cueDiv.style.fontSize);\n cueDiv.style.fontSize = fontSize * overrides.fontPercent + 'px';\n cueDiv.style.height = 'auto';\n cueDiv.style.top = 'auto';\n }\n if (overrides.fontFamily && overrides.fontFamily !== 'default') {\n if (overrides.fontFamily === 'small-caps') {\n cueDiv.firstChild.style.fontVariant = 'small-caps';\n } else {\n cueDiv.firstChild.style.fontFamily = fontMap[overrides.fontFamily];\n }\n }\n }\n }\n\n /**\n * Add an {@link TextTrack} to to the {@link Tech}s {@link TextTrackList}.\n *\n * @param {TextTrack|TextTrack[]} tracks\n * Text track object or text track array to be added to the list.\n */\n updateForTrack(tracks) {\n if (!Array.isArray(tracks)) {\n tracks = [tracks];\n }\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) !== 'function' || tracks.every(track => {\n return !track.activeCues;\n })) {\n return;\n }\n const cues = [];\n\n // push all active track cues\n for (let i = 0; i < tracks.length; ++i) {\n const track = tracks[i];\n for (let j = 0; j < track.activeCues.length; ++j) {\n cues.push(track.activeCues[j]);\n }\n }\n\n // removes all cues before it processes new ones\n global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT.processCues((global_window__WEBPACK_IMPORTED_MODULE_0___default()), cues, this.el_);\n\n // add unique class to each language text track & add settings styling if necessary\n for (let i = 0; i < tracks.length; ++i) {\n const track = tracks[i];\n for (let j = 0; j < track.activeCues.length; ++j) {\n const cueEl = track.activeCues[j].displayState;\n addClass(cueEl, 'vjs-text-track-cue', 'vjs-text-track-cue-' + (track.language ? track.language : i));\n if (track.language) {\n setAttribute(cueEl, 'lang', track.language);\n }\n }\n if (this.player_.textTrackSettings) {\n this.updateDisplayState(track);\n }\n }\n }\n}\nComponent$1.registerComponent('TextTrackDisplay', TextTrackDisplay);\n\n/**\n * @file loading-spinner.js\n */\n\n/**\n * A loading spinner for use during waiting/loading events.\n *\n * @extends Component\n */\nclass LoadingSpinner extends Component$1 {\n /**\n * Create the `LoadingSpinner`s DOM element.\n *\n * @return {Element}\n * The dom element that gets created.\n */\n createEl() {\n const isAudio = this.player_.isAudio();\n const playerType = this.localize(isAudio ? 'Audio Player' : 'Video Player');\n const controlText = createEl('span', {\n className: 'vjs-control-text',\n textContent: this.localize('{1} is loading.', [playerType])\n });\n const el = super.createEl('div', {\n className: 'vjs-loading-spinner',\n dir: 'ltr'\n });\n el.appendChild(controlText);\n return el;\n }\n\n /**\n * Update control text on languagechange\n */\n handleLanguagechange() {\n this.$('.vjs-control-text').textContent = this.localize('{1} is loading.', [this.player_.isAudio() ? 'Audio Player' : 'Video Player']);\n }\n}\nComponent$1.registerComponent('LoadingSpinner', LoadingSpinner);\n\n/**\n * @file button.js\n */\n\n/**\n * Base class for all buttons.\n *\n * @extends ClickableComponent\n */\nclass Button extends ClickableComponent {\n /**\n * Create the `Button`s DOM element.\n *\n * @param {string} [tag=\"button\"]\n * The element's node type. This argument is IGNORED: no matter what\n * is passed, it will always create a `button` element.\n *\n * @param {Object} [props={}]\n * An object of properties that should be set on the element.\n *\n * @param {Object} [attributes={}]\n * An object of attributes that should be set on the element.\n *\n * @return {Element}\n * The element that gets created.\n */\n createEl(tag, props = {}, attributes = {}) {\n tag = 'button';\n props = Object.assign({\n className: this.buildCSSClass()\n }, props);\n\n // Add attributes for button element\n attributes = Object.assign({\n // Necessary since the default button type is \"submit\"\n type: 'button'\n }, attributes);\n const el = createEl(tag, props, attributes);\n if (!this.player_.options_.experimentalSvgIcons) {\n el.appendChild(createEl('span', {\n className: 'vjs-icon-placeholder'\n }, {\n 'aria-hidden': true\n }));\n }\n this.createControlTextEl(el);\n return el;\n }\n\n /**\n * Add a child `Component` inside of this `Button`.\n *\n * @param {string|Component} child\n * The name or instance of a child to add.\n *\n * @param {Object} [options={}]\n * The key/value store of options that will get passed to children of\n * the child.\n *\n * @return {Component}\n * The `Component` that gets added as a child. When using a string the\n * `Component` will get created by this process.\n *\n * @deprecated since version 5\n */\n addChild(child, options = {}) {\n const className = this.constructor.name;\n log$1.warn(`Adding an actionable (user controllable) child to a Button (${className}) is not supported; use a ClickableComponent instead.`);\n\n // Avoid the error message generated by ClickableComponent's addChild method\n return Component$1.prototype.addChild.call(this, child, options);\n }\n\n /**\n * Enable the `Button` element so that it can be activated or clicked. Use this with\n * {@link Button#disable}.\n */\n enable() {\n super.enable();\n this.el_.removeAttribute('disabled');\n }\n\n /**\n * Disable the `Button` element so that it cannot be activated or clicked. Use this with\n * {@link Button#enable}.\n */\n disable() {\n super.disable();\n this.el_.setAttribute('disabled', 'disabled');\n }\n\n /**\n * This gets called when a `Button` has focus and `keydown` is triggered via a key\n * press.\n *\n * @param {KeyboardEvent} event\n * The event that caused this function to get called.\n *\n * @listens keydown\n */\n handleKeyDown(event) {\n // Ignore Space or Enter key operation, which is handled by the browser for\n // a button - though not for its super class, ClickableComponent. Also,\n // prevent the event from propagating through the DOM and triggering Player\n // hotkeys. We do not preventDefault here because we _want_ the browser to\n // handle it.\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Space') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Enter')) {\n event.stopPropagation();\n return;\n }\n\n // Pass keypress handling up for unsupported keys\n super.handleKeyDown(event);\n }\n}\nComponent$1.registerComponent('Button', Button);\n\n/**\n * @file big-play-button.js\n */\n\n/**\n * The initial play button that shows before the video has played. The hiding of the\n * `BigPlayButton` get done via CSS and `Player` states.\n *\n * @extends Button\n */\nclass BigPlayButton extends Button {\n constructor(player, options) {\n super(player, options);\n this.mouseused_ = false;\n this.setIcon('play');\n this.on('mousedown', e => this.handleMouseDown(e));\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object. Always returns 'vjs-big-play-button'.\n */\n buildCSSClass() {\n return 'vjs-big-play-button';\n }\n\n /**\n * This gets called when a `BigPlayButton` \"clicked\". See {@link ClickableComponent}\n * for more detailed information on what a click can be.\n *\n * @param {KeyboardEvent|MouseEvent|TouchEvent} event\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n const playPromise = this.player_.play();\n\n // exit early if clicked via the mouse\n if (this.mouseused_ && 'clientX' in event && 'clientY' in event) {\n silencePromise(playPromise);\n if (this.player_.tech(true)) {\n this.player_.tech(true).focus();\n }\n return;\n }\n const cb = this.player_.getChild('controlBar');\n const playToggle = cb && cb.getChild('playToggle');\n if (!playToggle) {\n this.player_.tech(true).focus();\n return;\n }\n const playFocus = () => playToggle.focus();\n if (isPromise(playPromise)) {\n playPromise.then(playFocus, () => {});\n } else {\n this.setTimeout(playFocus, 1);\n }\n }\n\n /**\n * Event handler that is called when a `BigPlayButton` receives a\n * `keydown` event.\n *\n * @param {KeyboardEvent} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n handleKeyDown(event) {\n this.mouseused_ = false;\n super.handleKeyDown(event);\n }\n\n /**\n * Handle `mousedown` events on the `BigPlayButton`.\n *\n * @param {MouseEvent} event\n * `mousedown` or `touchstart` event that triggered this function\n *\n * @listens mousedown\n */\n handleMouseDown(event) {\n this.mouseused_ = true;\n }\n}\n\n/**\n * The text that should display over the `BigPlayButton`s controls. Added to for localization.\n *\n * @type {string}\n * @protected\n */\nBigPlayButton.prototype.controlText_ = 'Play Video';\nComponent$1.registerComponent('BigPlayButton', BigPlayButton);\n\n/**\n * @file close-button.js\n */\n\n/**\n * The `CloseButton` is a `{@link Button}` that fires a `close` event when\n * it gets clicked.\n *\n * @extends Button\n */\nclass CloseButton extends Button {\n /**\n * Creates an instance of the this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.setIcon('cancel');\n this.controlText(options && options.controlText || this.localize('Close'));\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-close-button ${super.buildCSSClass()}`;\n }\n\n /**\n * This gets called when a `CloseButton` gets clicked. See\n * {@link ClickableComponent#handleClick} for more information on when\n * this will be triggered\n *\n * @param {Event} event\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n * @fires CloseButton#close\n */\n handleClick(event) {\n /**\n * Triggered when the a `CloseButton` is clicked.\n *\n * @event CloseButton#close\n * @type {Event}\n *\n * @property {boolean} [bubbles=false]\n * set to false so that the close event does not\n * bubble up to parents if there is no listener\n */\n this.trigger({\n type: 'close',\n bubbles: false\n });\n }\n /**\n * Event handler that is called when a `CloseButton` receives a\n * `keydown` event.\n *\n * By default, if the key is Esc, it will trigger a `click` event.\n *\n * @param {KeyboardEvent} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n handleKeyDown(event) {\n // Esc button will trigger `click` event\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Esc')) {\n event.preventDefault();\n event.stopPropagation();\n this.trigger('click');\n } else {\n // Pass keypress handling up for unsupported keys\n super.handleKeyDown(event);\n }\n }\n}\nComponent$1.registerComponent('CloseButton', CloseButton);\n\n/**\n * @file play-toggle.js\n */\n\n/**\n * Button to toggle between play and pause.\n *\n * @extends Button\n */\nclass PlayToggle extends Button {\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n constructor(player, options = {}) {\n super(player, options);\n\n // show or hide replay icon\n options.replay = options.replay === undefined || options.replay;\n this.setIcon('play');\n this.on(player, 'play', e => this.handlePlay(e));\n this.on(player, 'pause', e => this.handlePause(e));\n if (options.replay) {\n this.on(player, 'ended', e => this.handleEnded(e));\n }\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-play-control ${super.buildCSSClass()}`;\n }\n\n /**\n * This gets called when an `PlayToggle` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n if (this.player_.paused()) {\n silencePromise(this.player_.play());\n } else {\n this.player_.pause();\n }\n }\n\n /**\n * This gets called once after the video has ended and the user seeks so that\n * we can change the replay button back to a play button.\n *\n * @param {Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#seeked\n */\n handleSeeked(event) {\n this.removeClass('vjs-ended');\n if (this.player_.paused()) {\n this.handlePause(event);\n } else {\n this.handlePlay(event);\n }\n }\n\n /**\n * Add the vjs-playing class to the element so it can change appearance.\n *\n * @param {Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#play\n */\n handlePlay(event) {\n this.removeClass('vjs-ended', 'vjs-paused');\n this.addClass('vjs-playing');\n // change the button text to \"Pause\"\n this.setIcon('pause');\n this.controlText('Pause');\n }\n\n /**\n * Add the vjs-paused class to the element so it can change appearance.\n *\n * @param {Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#pause\n */\n handlePause(event) {\n this.removeClass('vjs-playing');\n this.addClass('vjs-paused');\n // change the button text to \"Play\"\n this.setIcon('play');\n this.controlText('Play');\n }\n\n /**\n * Add the vjs-ended class to the element so it can change appearance\n *\n * @param {Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#ended\n */\n handleEnded(event) {\n this.removeClass('vjs-playing');\n this.addClass('vjs-ended');\n // change the button text to \"Replay\"\n this.setIcon('replay');\n this.controlText('Replay');\n\n // on the next seek remove the replay button\n this.one(this.player_, 'seeked', e => this.handleSeeked(e));\n }\n}\n\n/**\n * The text that should display over the `PlayToggle`s controls. Added for localization.\n *\n * @type {string}\n * @protected\n */\nPlayToggle.prototype.controlText_ = 'Play';\nComponent$1.registerComponent('PlayToggle', PlayToggle);\n\n/**\n * @file time-display.js\n */\n\n/**\n * Displays time information about the video\n *\n * @extends Component\n */\nclass TimeDisplay extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.on(player, ['timeupdate', 'ended', 'seeking'], e => this.update(e));\n this.updateTextNode_();\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n const className = this.buildCSSClass();\n const el = super.createEl('div', {\n className: `${className} vjs-time-control vjs-control`\n });\n const span = createEl('span', {\n className: 'vjs-control-text',\n textContent: `${this.localize(this.labelText_)}\\u00a0`\n }, {\n role: 'presentation'\n });\n el.appendChild(span);\n this.contentEl_ = createEl('span', {\n className: `${className}-display`\n }, {\n // span elements have no implicit role, but some screen readers (notably VoiceOver)\n // treat them as a break between items in the DOM when using arrow keys\n // (or left-to-right swipes on iOS) to read contents of a page. Using\n // role='presentation' causes VoiceOver to NOT treat this span as a break.\n role: 'presentation'\n });\n el.appendChild(this.contentEl_);\n return el;\n }\n dispose() {\n this.contentEl_ = null;\n this.textNode_ = null;\n super.dispose();\n }\n\n /**\n * Updates the displayed time according to the `updateContent` function which is defined in the child class.\n *\n * @param {Event} [event]\n * The `timeupdate`, `ended` or `seeking` (if enableSmoothSeeking is true) event that caused this function to be called.\n */\n update(event) {\n if (!this.player_.options_.enableSmoothSeeking && event.type === 'seeking') {\n return;\n }\n this.updateContent(event);\n }\n\n /**\n * Updates the time display text node with a new time\n *\n * @param {number} [time=0] the time to update to\n *\n * @private\n */\n updateTextNode_(time = 0) {\n time = formatTime(time);\n if (this.formattedTime_ === time) {\n return;\n }\n this.formattedTime_ = time;\n this.requestNamedAnimationFrame('TimeDisplay#updateTextNode_', () => {\n if (!this.contentEl_) {\n return;\n }\n let oldNode = this.textNode_;\n if (oldNode && this.contentEl_.firstChild !== oldNode) {\n oldNode = null;\n log$1.warn('TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.');\n }\n this.textNode_ = global_document__WEBPACK_IMPORTED_MODULE_1___default().createTextNode(this.formattedTime_);\n if (!this.textNode_) {\n return;\n }\n if (oldNode) {\n this.contentEl_.replaceChild(this.textNode_, oldNode);\n } else {\n this.contentEl_.appendChild(this.textNode_);\n }\n });\n }\n\n /**\n * To be filled out in the child class, should update the displayed time\n * in accordance with the fact that the current time has changed.\n *\n * @param {Event} [event]\n * The `timeupdate` event that caused this to run.\n *\n * @listens Player#timeupdate\n */\n updateContent(event) {}\n}\n\n/**\n * The text that is added to the `TimeDisplay` for screen reader users.\n *\n * @type {string}\n * @private\n */\nTimeDisplay.prototype.labelText_ = 'Time';\n\n/**\n * The text that should display over the `TimeDisplay`s controls. Added to for localization.\n *\n * @type {string}\n * @protected\n *\n * @deprecated in v7; controlText_ is not used in non-active display Components\n */\nTimeDisplay.prototype.controlText_ = 'Time';\nComponent$1.registerComponent('TimeDisplay', TimeDisplay);\n\n/**\n * @file current-time-display.js\n */\n\n/**\n * Displays the current time\n *\n * @extends Component\n */\nclass CurrentTimeDisplay extends TimeDisplay {\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return 'vjs-current-time';\n }\n\n /**\n * Update current time display\n *\n * @param {Event} [event]\n * The `timeupdate` event that caused this function to run.\n *\n * @listens Player#timeupdate\n */\n updateContent(event) {\n // Allows for smooth scrubbing, when player can't keep up.\n let time;\n if (this.player_.ended()) {\n time = this.player_.duration();\n } else {\n time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();\n }\n this.updateTextNode_(time);\n }\n}\n\n/**\n * The text that is added to the `CurrentTimeDisplay` for screen reader users.\n *\n * @type {string}\n * @private\n */\nCurrentTimeDisplay.prototype.labelText_ = 'Current Time';\n\n/**\n * The text that should display over the `CurrentTimeDisplay`s controls. Added to for localization.\n *\n * @type {string}\n * @protected\n *\n * @deprecated in v7; controlText_ is not used in non-active display Components\n */\nCurrentTimeDisplay.prototype.controlText_ = 'Current Time';\nComponent$1.registerComponent('CurrentTimeDisplay', CurrentTimeDisplay);\n\n/**\n * @file duration-display.js\n */\n\n/**\n * Displays the duration\n *\n * @extends Component\n */\nclass DurationDisplay extends TimeDisplay {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n const updateContent = e => this.updateContent(e);\n\n // we do not want to/need to throttle duration changes,\n // as they should always display the changed duration as\n // it has changed\n this.on(player, 'durationchange', updateContent);\n\n // Listen to loadstart because the player duration is reset when a new media element is loaded,\n // but the durationchange on the user agent will not fire.\n // @see [Spec]{@link https://www.w3.org/TR/2011/WD-html5-20110113/video.html#media-element-load-algorithm}\n this.on(player, 'loadstart', updateContent);\n\n // Also listen for timeupdate (in the parent) and loadedmetadata because removing those\n // listeners could have broken dependent applications/libraries. These\n // can likely be removed for 7.0.\n this.on(player, 'loadedmetadata', updateContent);\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return 'vjs-duration';\n }\n\n /**\n * Update duration time display.\n *\n * @param {Event} [event]\n * The `durationchange`, `timeupdate`, or `loadedmetadata` event that caused\n * this function to be called.\n *\n * @listens Player#durationchange\n * @listens Player#timeupdate\n * @listens Player#loadedmetadata\n */\n updateContent(event) {\n const duration = this.player_.duration();\n this.updateTextNode_(duration);\n }\n}\n\n/**\n * The text that is added to the `DurationDisplay` for screen reader users.\n *\n * @type {string}\n * @private\n */\nDurationDisplay.prototype.labelText_ = 'Duration';\n\n/**\n * The text that should display over the `DurationDisplay`s controls. Added to for localization.\n *\n * @type {string}\n * @protected\n *\n * @deprecated in v7; controlText_ is not used in non-active display Components\n */\nDurationDisplay.prototype.controlText_ = 'Duration';\nComponent$1.registerComponent('DurationDisplay', DurationDisplay);\n\n/**\n * @file time-divider.js\n */\n\n/**\n * The separator between the current time and duration.\n * Can be hidden if it's not needed in the design.\n *\n * @extends Component\n */\nclass TimeDivider extends Component$1 {\n /**\n * Create the component's DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n const el = super.createEl('div', {\n className: 'vjs-time-control vjs-time-divider'\n }, {\n // this element and its contents can be hidden from assistive techs since\n // it is made extraneous by the announcement of the control text\n // for the current time and duration displays\n 'aria-hidden': true\n });\n const div = super.createEl('div');\n const span = super.createEl('span', {\n textContent: '/'\n });\n div.appendChild(span);\n el.appendChild(div);\n return el;\n }\n}\nComponent$1.registerComponent('TimeDivider', TimeDivider);\n\n/**\n * @file remaining-time-display.js\n */\n\n/**\n * Displays the time left in the video\n *\n * @extends Component\n */\nclass RemainingTimeDisplay extends TimeDisplay {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.on(player, 'durationchange', e => this.updateContent(e));\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return 'vjs-remaining-time';\n }\n\n /**\n * Create the `Component`'s DOM element with the \"minus\" character prepend to the time\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n const el = super.createEl();\n if (this.options_.displayNegative !== false) {\n el.insertBefore(createEl('span', {}, {\n 'aria-hidden': true\n }, '-'), this.contentEl_);\n }\n return el;\n }\n\n /**\n * Update remaining time display.\n *\n * @param {Event} [event]\n * The `timeupdate` or `durationchange` event that caused this to run.\n *\n * @listens Player#timeupdate\n * @listens Player#durationchange\n */\n updateContent(event) {\n if (typeof this.player_.duration() !== 'number') {\n return;\n }\n let time;\n\n // @deprecated We should only use remainingTimeDisplay\n // as of video.js 7\n if (this.player_.ended()) {\n time = 0;\n } else if (this.player_.remainingTimeDisplay) {\n time = this.player_.remainingTimeDisplay();\n } else {\n time = this.player_.remainingTime();\n }\n this.updateTextNode_(time);\n }\n}\n\n/**\n * The text that is added to the `RemainingTimeDisplay` for screen reader users.\n *\n * @type {string}\n * @private\n */\nRemainingTimeDisplay.prototype.labelText_ = 'Remaining Time';\n\n/**\n * The text that should display over the `RemainingTimeDisplay`s controls. Added to for localization.\n *\n * @type {string}\n * @protected\n *\n * @deprecated in v7; controlText_ is not used in non-active display Components\n */\nRemainingTimeDisplay.prototype.controlText_ = 'Remaining Time';\nComponent$1.registerComponent('RemainingTimeDisplay', RemainingTimeDisplay);\n\n/**\n * @file live-display.js\n */\n\n// TODO - Future make it click to snap to live\n\n/**\n * Displays the live indicator when duration is Infinity.\n *\n * @extends Component\n */\nclass LiveDisplay extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.updateShowing();\n this.on(this.player(), 'durationchange', e => this.updateShowing(e));\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n const el = super.createEl('div', {\n className: 'vjs-live-control vjs-control'\n });\n this.contentEl_ = createEl('div', {\n className: 'vjs-live-display'\n }, {\n 'aria-live': 'off'\n });\n this.contentEl_.appendChild(createEl('span', {\n className: 'vjs-control-text',\n textContent: `${this.localize('Stream Type')}\\u00a0`\n }));\n this.contentEl_.appendChild(global_document__WEBPACK_IMPORTED_MODULE_1___default().createTextNode(this.localize('LIVE')));\n el.appendChild(this.contentEl_);\n return el;\n }\n dispose() {\n this.contentEl_ = null;\n super.dispose();\n }\n\n /**\n * Check the duration to see if the LiveDisplay should be showing or not. Then show/hide\n * it accordingly\n *\n * @param {Event} [event]\n * The {@link Player#durationchange} event that caused this function to run.\n *\n * @listens Player#durationchange\n */\n updateShowing(event) {\n if (this.player().duration() === Infinity) {\n this.show();\n } else {\n this.hide();\n }\n }\n}\nComponent$1.registerComponent('LiveDisplay', LiveDisplay);\n\n/**\n * @file seek-to-live.js\n */\n\n/**\n * Displays the live indicator when duration is Infinity.\n *\n * @extends Component\n */\nclass SeekToLive extends Button {\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.updateLiveEdgeStatus();\n if (this.player_.liveTracker) {\n this.updateLiveEdgeStatusHandler_ = e => this.updateLiveEdgeStatus(e);\n this.on(this.player_.liveTracker, 'liveedgechange', this.updateLiveEdgeStatusHandler_);\n }\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n const el = super.createEl('button', {\n className: 'vjs-seek-to-live-control vjs-control'\n });\n this.setIcon('circle', el);\n this.textEl_ = createEl('span', {\n className: 'vjs-seek-to-live-text',\n textContent: this.localize('LIVE')\n }, {\n 'aria-hidden': 'true'\n });\n el.appendChild(this.textEl_);\n return el;\n }\n\n /**\n * Update the state of this button if we are at the live edge\n * or not\n */\n updateLiveEdgeStatus() {\n // default to live edge\n if (!this.player_.liveTracker || this.player_.liveTracker.atLiveEdge()) {\n this.setAttribute('aria-disabled', true);\n this.addClass('vjs-at-live-edge');\n this.controlText('Seek to live, currently playing live');\n } else {\n this.setAttribute('aria-disabled', false);\n this.removeClass('vjs-at-live-edge');\n this.controlText('Seek to live, currently behind live');\n }\n }\n\n /**\n * On click bring us as near to the live point as possible.\n * This requires that we wait for the next `live-seekable-change`\n * event which will happen every segment length seconds.\n */\n handleClick() {\n this.player_.liveTracker.seekToLiveEdge();\n }\n\n /**\n * Dispose of the element and stop tracking\n */\n dispose() {\n if (this.player_.liveTracker) {\n this.off(this.player_.liveTracker, 'liveedgechange', this.updateLiveEdgeStatusHandler_);\n }\n this.textEl_ = null;\n super.dispose();\n }\n}\n/**\n * The text that should display over the `SeekToLive`s control. Added for localization.\n *\n * @type {string}\n * @protected\n */\nSeekToLive.prototype.controlText_ = 'Seek to live, currently playing live';\nComponent$1.registerComponent('SeekToLive', SeekToLive);\n\n/**\n * @file num.js\n * @module num\n */\n\n/**\n * Keep a number between a min and a max value\n *\n * @param {number} number\n * The number to clamp\n *\n * @param {number} min\n * The minimum value\n * @param {number} max\n * The maximum value\n *\n * @return {number}\n * the clamped number\n */\nfunction clamp(number, min, max) {\n number = Number(number);\n return Math.min(max, Math.max(min, isNaN(number) ? min : number));\n}\n\nvar Num = /*#__PURE__*/Object.freeze({\n __proto__: null,\n clamp: clamp\n});\n\n/**\n * @file slider.js\n */\n\n/**\n * The base functionality for a slider. Can be vertical or horizontal.\n * For instance the volume bar or the seek bar on a video is a slider.\n *\n * @extends Component\n */\nclass Slider extends Component$1 {\n /**\n * Create an instance of this class\n *\n * @param { import('../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.handleMouseDown_ = e => this.handleMouseDown(e);\n this.handleMouseUp_ = e => this.handleMouseUp(e);\n this.handleKeyDown_ = e => this.handleKeyDown(e);\n this.handleClick_ = e => this.handleClick(e);\n this.handleMouseMove_ = e => this.handleMouseMove(e);\n this.update_ = e => this.update(e);\n\n // Set property names to bar to match with the child Slider class is looking for\n this.bar = this.getChild(this.options_.barName);\n\n // Set a horizontal or vertical class on the slider depending on the slider type\n this.vertical(!!this.options_.vertical);\n this.enable();\n }\n\n /**\n * Are controls are currently enabled for this slider or not.\n *\n * @return {boolean}\n * true if controls are enabled, false otherwise\n */\n enabled() {\n return this.enabled_;\n }\n\n /**\n * Enable controls for this slider if they are disabled\n */\n enable() {\n if (this.enabled()) {\n return;\n }\n this.on('mousedown', this.handleMouseDown_);\n this.on('touchstart', this.handleMouseDown_);\n this.on('keydown', this.handleKeyDown_);\n this.on('click', this.handleClick_);\n\n // TODO: deprecated, controlsvisible does not seem to be fired\n this.on(this.player_, 'controlsvisible', this.update);\n if (this.playerEvent) {\n this.on(this.player_, this.playerEvent, this.update);\n }\n this.removeClass('disabled');\n this.setAttribute('tabindex', 0);\n this.enabled_ = true;\n }\n\n /**\n * Disable controls for this slider if they are enabled\n */\n disable() {\n if (!this.enabled()) {\n return;\n }\n const doc = this.bar.el_.ownerDocument;\n this.off('mousedown', this.handleMouseDown_);\n this.off('touchstart', this.handleMouseDown_);\n this.off('keydown', this.handleKeyDown_);\n this.off('click', this.handleClick_);\n this.off(this.player_, 'controlsvisible', this.update_);\n this.off(doc, 'mousemove', this.handleMouseMove_);\n this.off(doc, 'mouseup', this.handleMouseUp_);\n this.off(doc, 'touchmove', this.handleMouseMove_);\n this.off(doc, 'touchend', this.handleMouseUp_);\n this.removeAttribute('tabindex');\n this.addClass('disabled');\n if (this.playerEvent) {\n this.off(this.player_, this.playerEvent, this.update);\n }\n this.enabled_ = false;\n }\n\n /**\n * Create the `Slider`s DOM element.\n *\n * @param {string} type\n * Type of element to create.\n *\n * @param {Object} [props={}]\n * List of properties in Object form.\n *\n * @param {Object} [attributes={}]\n * list of attributes in Object form.\n *\n * @return {Element}\n * The element that gets created.\n */\n createEl(type, props = {}, attributes = {}) {\n // Add the slider element class to all sub classes\n props.className = props.className + ' vjs-slider';\n props = Object.assign({\n tabIndex: 0\n }, props);\n attributes = Object.assign({\n 'role': 'slider',\n 'aria-valuenow': 0,\n 'aria-valuemin': 0,\n 'aria-valuemax': 100\n }, attributes);\n return super.createEl(type, props, attributes);\n }\n\n /**\n * Handle `mousedown` or `touchstart` events on the `Slider`.\n *\n * @param {MouseEvent} event\n * `mousedown` or `touchstart` event that triggered this function\n *\n * @listens mousedown\n * @listens touchstart\n * @fires Slider#slideractive\n */\n handleMouseDown(event) {\n const doc = this.bar.el_.ownerDocument;\n if (event.type === 'mousedown') {\n event.preventDefault();\n }\n // Do not call preventDefault() on touchstart in Chrome\n // to avoid console warnings. Use a 'touch-action: none' style\n // instead to prevent unintended scrolling.\n // https://developers.google.com/web/updates/2017/01/scrolling-intervention\n if (event.type === 'touchstart' && !IS_CHROME) {\n event.preventDefault();\n }\n blockTextSelection();\n this.addClass('vjs-sliding');\n /**\n * Triggered when the slider is in an active state\n *\n * @event Slider#slideractive\n * @type {MouseEvent}\n */\n this.trigger('slideractive');\n this.on(doc, 'mousemove', this.handleMouseMove_);\n this.on(doc, 'mouseup', this.handleMouseUp_);\n this.on(doc, 'touchmove', this.handleMouseMove_);\n this.on(doc, 'touchend', this.handleMouseUp_);\n this.handleMouseMove(event, true);\n }\n\n /**\n * Handle the `mousemove`, `touchmove`, and `mousedown` events on this `Slider`.\n * The `mousemove` and `touchmove` events will only only trigger this function during\n * `mousedown` and `touchstart`. This is due to {@link Slider#handleMouseDown} and\n * {@link Slider#handleMouseUp}.\n *\n * @param {MouseEvent} event\n * `mousedown`, `mousemove`, `touchstart`, or `touchmove` event that triggered\n * this function\n * @param {boolean} mouseDown this is a flag that should be set to true if `handleMouseMove` is called directly. It allows us to skip things that should not happen if coming from mouse down but should happen on regular mouse move handler. Defaults to false.\n *\n * @listens mousemove\n * @listens touchmove\n */\n handleMouseMove(event) {}\n\n /**\n * Handle `mouseup` or `touchend` events on the `Slider`.\n *\n * @param {MouseEvent} event\n * `mouseup` or `touchend` event that triggered this function.\n *\n * @listens touchend\n * @listens mouseup\n * @fires Slider#sliderinactive\n */\n handleMouseUp(event) {\n const doc = this.bar.el_.ownerDocument;\n unblockTextSelection();\n this.removeClass('vjs-sliding');\n /**\n * Triggered when the slider is no longer in an active state.\n *\n * @event Slider#sliderinactive\n * @type {Event}\n */\n this.trigger('sliderinactive');\n this.off(doc, 'mousemove', this.handleMouseMove_);\n this.off(doc, 'mouseup', this.handleMouseUp_);\n this.off(doc, 'touchmove', this.handleMouseMove_);\n this.off(doc, 'touchend', this.handleMouseUp_);\n this.update();\n }\n\n /**\n * Update the progress bar of the `Slider`.\n *\n * @return {number}\n * The percentage of progress the progress bar represents as a\n * number from 0 to 1.\n */\n update() {\n // In VolumeBar init we have a setTimeout for update that pops and update\n // to the end of the execution stack. The player is destroyed before then\n // update will cause an error\n // If there's no bar...\n if (!this.el_ || !this.bar) {\n return;\n }\n\n // clamp progress between 0 and 1\n // and only round to four decimal places, as we round to two below\n const progress = this.getProgress();\n if (progress === this.progress_) {\n return progress;\n }\n this.progress_ = progress;\n this.requestNamedAnimationFrame('Slider#update', () => {\n // Set the new bar width or height\n const sizeKey = this.vertical() ? 'height' : 'width';\n\n // Convert to a percentage for css value\n this.bar.el().style[sizeKey] = (progress * 100).toFixed(2) + '%';\n });\n return progress;\n }\n\n /**\n * Get the percentage of the bar that should be filled\n * but clamped and rounded.\n *\n * @return {number}\n * percentage filled that the slider is\n */\n getProgress() {\n return Number(clamp(this.getPercent(), 0, 1).toFixed(4));\n }\n\n /**\n * Calculate distance for slider\n *\n * @param {Event} event\n * The event that caused this function to run.\n *\n * @return {number}\n * The current position of the Slider.\n * - position.x for vertical `Slider`s\n * - position.y for horizontal `Slider`s\n */\n calculateDistance(event) {\n const position = getPointerPosition(this.el_, event);\n if (this.vertical()) {\n return position.y;\n }\n return position.x;\n }\n\n /**\n * Handle a `keydown` event on the `Slider`. Watches for left, right, up, and down\n * arrow keys. This function will only be called when the slider has focus. See\n * {@link Slider#handleFocus} and {@link Slider#handleBlur}.\n *\n * @param {KeyboardEvent} event\n * the `keydown` event that caused this function to run.\n *\n * @listens keydown\n */\n handleKeyDown(event) {\n // Left and Down Arrows\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Left') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Down')) {\n event.preventDefault();\n event.stopPropagation();\n this.stepBack();\n\n // Up and Right Arrows\n } else if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Right') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Up')) {\n event.preventDefault();\n event.stopPropagation();\n this.stepForward();\n } else {\n // Pass keydown handling up for unsupported keys\n super.handleKeyDown(event);\n }\n }\n\n /**\n * Listener for click events on slider, used to prevent clicks\n * from bubbling up to parent elements like button menus.\n *\n * @param {Object} event\n * Event that caused this object to run\n */\n handleClick(event) {\n event.stopPropagation();\n event.preventDefault();\n }\n\n /**\n * Get/set if slider is horizontal for vertical\n *\n * @param {boolean} [bool]\n * - true if slider is vertical,\n * - false is horizontal\n *\n * @return {boolean}\n * - true if slider is vertical, and getting\n * - false if the slider is horizontal, and getting\n */\n vertical(bool) {\n if (bool === undefined) {\n return this.vertical_ || false;\n }\n this.vertical_ = !!bool;\n if (this.vertical_) {\n this.addClass('vjs-slider-vertical');\n } else {\n this.addClass('vjs-slider-horizontal');\n }\n }\n}\nComponent$1.registerComponent('Slider', Slider);\n\n/**\n * @file load-progress-bar.js\n */\n\n// get the percent width of a time compared to the total end\nconst percentify = (time, end) => clamp(time / end * 100, 0, 100).toFixed(2) + '%';\n\n/**\n * Shows loading progress\n *\n * @extends Component\n */\nclass LoadProgressBar extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.partEls_ = [];\n this.on(player, 'progress', e => this.update(e));\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n const el = super.createEl('div', {\n className: 'vjs-load-progress'\n });\n const wrapper = createEl('span', {\n className: 'vjs-control-text'\n });\n const loadedText = createEl('span', {\n textContent: this.localize('Loaded')\n });\n const separator = global_document__WEBPACK_IMPORTED_MODULE_1___default().createTextNode(': ');\n this.percentageEl_ = createEl('span', {\n className: 'vjs-control-text-loaded-percentage',\n textContent: '0%'\n });\n el.appendChild(wrapper);\n wrapper.appendChild(loadedText);\n wrapper.appendChild(separator);\n wrapper.appendChild(this.percentageEl_);\n return el;\n }\n dispose() {\n this.partEls_ = null;\n this.percentageEl_ = null;\n super.dispose();\n }\n\n /**\n * Update progress bar\n *\n * @param {Event} [event]\n * The `progress` event that caused this function to run.\n *\n * @listens Player#progress\n */\n update(event) {\n this.requestNamedAnimationFrame('LoadProgressBar#update', () => {\n const liveTracker = this.player_.liveTracker;\n const buffered = this.player_.buffered();\n const duration = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : this.player_.duration();\n const bufferedEnd = this.player_.bufferedEnd();\n const children = this.partEls_;\n const percent = percentify(bufferedEnd, duration);\n if (this.percent_ !== percent) {\n // update the width of the progress bar\n this.el_.style.width = percent;\n // update the control-text\n textContent(this.percentageEl_, percent);\n this.percent_ = percent;\n }\n\n // add child elements to represent the individual buffered time ranges\n for (let i = 0; i < buffered.length; i++) {\n const start = buffered.start(i);\n const end = buffered.end(i);\n let part = children[i];\n if (!part) {\n part = this.el_.appendChild(createEl());\n children[i] = part;\n }\n\n // only update if changed\n if (part.dataset.start === start && part.dataset.end === end) {\n continue;\n }\n part.dataset.start = start;\n part.dataset.end = end;\n\n // set the percent based on the width of the progress bar (bufferedEnd)\n part.style.left = percentify(start, bufferedEnd);\n part.style.width = percentify(end - start, bufferedEnd);\n }\n\n // remove unused buffered range elements\n for (let i = children.length; i > buffered.length; i--) {\n this.el_.removeChild(children[i - 1]);\n }\n children.length = buffered.length;\n });\n }\n}\nComponent$1.registerComponent('LoadProgressBar', LoadProgressBar);\n\n/**\n * @file time-tooltip.js\n */\n\n/**\n * Time tooltips display a time above the progress bar.\n *\n * @extends Component\n */\nclass TimeTooltip extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The {@link Player} that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.update = throttle(bind_(this, this.update), UPDATE_REFRESH_INTERVAL);\n }\n\n /**\n * Create the time tooltip DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n return super.createEl('div', {\n className: 'vjs-time-tooltip'\n }, {\n 'aria-hidden': 'true'\n });\n }\n\n /**\n * Updates the position of the time tooltip relative to the `SeekBar`.\n *\n * @param {Object} seekBarRect\n * The `ClientRect` for the {@link SeekBar} element.\n *\n * @param {number} seekBarPoint\n * A number from 0 to 1, representing a horizontal reference point\n * from the left edge of the {@link SeekBar}\n */\n update(seekBarRect, seekBarPoint, content) {\n const tooltipRect = findPosition(this.el_);\n const playerRect = getBoundingClientRect(this.player_.el());\n const seekBarPointPx = seekBarRect.width * seekBarPoint;\n\n // do nothing if either rect isn't available\n // for example, if the player isn't in the DOM for testing\n if (!playerRect || !tooltipRect) {\n return;\n }\n\n // This is the space left of the `seekBarPoint` available within the bounds\n // of the player. We calculate any gap between the left edge of the player\n // and the left edge of the `SeekBar` and add the number of pixels in the\n // `SeekBar` before hitting the `seekBarPoint`\n const spaceLeftOfPoint = seekBarRect.left - playerRect.left + seekBarPointPx;\n\n // This is the space right of the `seekBarPoint` available within the bounds\n // of the player. We calculate the number of pixels from the `seekBarPoint`\n // to the right edge of the `SeekBar` and add to that any gap between the\n // right edge of the `SeekBar` and the player.\n const spaceRightOfPoint = seekBarRect.width - seekBarPointPx + (playerRect.right - seekBarRect.right);\n\n // This is the number of pixels by which the tooltip will need to be pulled\n // further to the right to center it over the `seekBarPoint`.\n let pullTooltipBy = tooltipRect.width / 2;\n\n // Adjust the `pullTooltipBy` distance to the left or right depending on\n // the results of the space calculations above.\n if (spaceLeftOfPoint < pullTooltipBy) {\n pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;\n } else if (spaceRightOfPoint < pullTooltipBy) {\n pullTooltipBy = spaceRightOfPoint;\n }\n\n // Due to the imprecision of decimal/ratio based calculations and varying\n // rounding behaviors, there are cases where the spacing adjustment is off\n // by a pixel or two. This adds insurance to these calculations.\n if (pullTooltipBy < 0) {\n pullTooltipBy = 0;\n } else if (pullTooltipBy > tooltipRect.width) {\n pullTooltipBy = tooltipRect.width;\n }\n\n // prevent small width fluctuations within 0.4px from\n // changing the value below.\n // This really helps for live to prevent the play\n // progress time tooltip from jittering\n pullTooltipBy = Math.round(pullTooltipBy);\n this.el_.style.right = `-${pullTooltipBy}px`;\n this.write(content);\n }\n\n /**\n * Write the time to the tooltip DOM element.\n *\n * @param {string} content\n * The formatted time for the tooltip.\n */\n write(content) {\n textContent(this.el_, content);\n }\n\n /**\n * Updates the position of the time tooltip relative to the `SeekBar`.\n *\n * @param {Object} seekBarRect\n * The `ClientRect` for the {@link SeekBar} element.\n *\n * @param {number} seekBarPoint\n * A number from 0 to 1, representing a horizontal reference point\n * from the left edge of the {@link SeekBar}\n *\n * @param {number} time\n * The time to update the tooltip to, not used during live playback\n *\n * @param {Function} cb\n * A function that will be called during the request animation frame\n * for tooltips that need to do additional animations from the default\n */\n updateTime(seekBarRect, seekBarPoint, time, cb) {\n this.requestNamedAnimationFrame('TimeTooltip#updateTime', () => {\n let content;\n const duration = this.player_.duration();\n if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {\n const liveWindow = this.player_.liveTracker.liveWindow();\n const secondsBehind = liveWindow - seekBarPoint * liveWindow;\n content = (secondsBehind < 1 ? '' : '-') + formatTime(secondsBehind, liveWindow);\n } else {\n content = formatTime(time, duration);\n }\n this.update(seekBarRect, seekBarPoint, content);\n if (cb) {\n cb();\n }\n });\n }\n}\nComponent$1.registerComponent('TimeTooltip', TimeTooltip);\n\n/**\n * @file play-progress-bar.js\n */\n\n/**\n * Used by {@link SeekBar} to display media playback progress as part of the\n * {@link ProgressControl}.\n *\n * @extends Component\n */\nclass PlayProgressBar extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The {@link Player} that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.setIcon('circle');\n this.update = throttle(bind_(this, this.update), UPDATE_REFRESH_INTERVAL);\n }\n\n /**\n * Create the the DOM element for this class.\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n return super.createEl('div', {\n className: 'vjs-play-progress vjs-slider-bar'\n }, {\n 'aria-hidden': 'true'\n });\n }\n\n /**\n * Enqueues updates to its own DOM as well as the DOM of its\n * {@link TimeTooltip} child.\n *\n * @param {Object} seekBarRect\n * The `ClientRect` for the {@link SeekBar} element.\n *\n * @param {number} seekBarPoint\n * A number from 0 to 1, representing a horizontal reference point\n * from the left edge of the {@link SeekBar}\n */\n update(seekBarRect, seekBarPoint) {\n const timeTooltip = this.getChild('timeTooltip');\n if (!timeTooltip) {\n return;\n }\n const time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();\n timeTooltip.updateTime(seekBarRect, seekBarPoint, time);\n }\n}\n\n/**\n * Default options for {@link PlayProgressBar}.\n *\n * @type {Object}\n * @private\n */\nPlayProgressBar.prototype.options_ = {\n children: []\n};\n\n// Time tooltips should not be added to a player on mobile devices\nif (!IS_IOS && !IS_ANDROID) {\n PlayProgressBar.prototype.options_.children.push('timeTooltip');\n}\nComponent$1.registerComponent('PlayProgressBar', PlayProgressBar);\n\n/**\n * @file mouse-time-display.js\n */\n\n/**\n * The {@link MouseTimeDisplay} component tracks mouse movement over the\n * {@link ProgressControl}. It displays an indicator and a {@link TimeTooltip}\n * indicating the time which is represented by a given point in the\n * {@link ProgressControl}.\n *\n * @extends Component\n */\nclass MouseTimeDisplay extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The {@link Player} that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.update = throttle(bind_(this, this.update), UPDATE_REFRESH_INTERVAL);\n }\n\n /**\n * Create the DOM element for this class.\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n return super.createEl('div', {\n className: 'vjs-mouse-display'\n });\n }\n\n /**\n * Enqueues updates to its own DOM as well as the DOM of its\n * {@link TimeTooltip} child.\n *\n * @param {Object} seekBarRect\n * The `ClientRect` for the {@link SeekBar} element.\n *\n * @param {number} seekBarPoint\n * A number from 0 to 1, representing a horizontal reference point\n * from the left edge of the {@link SeekBar}\n */\n update(seekBarRect, seekBarPoint) {\n const time = seekBarPoint * this.player_.duration();\n this.getChild('timeTooltip').updateTime(seekBarRect, seekBarPoint, time, () => {\n this.el_.style.left = `${seekBarRect.width * seekBarPoint}px`;\n });\n }\n}\n\n/**\n * Default options for `MouseTimeDisplay`\n *\n * @type {Object}\n * @private\n */\nMouseTimeDisplay.prototype.options_ = {\n children: ['timeTooltip']\n};\nComponent$1.registerComponent('MouseTimeDisplay', MouseTimeDisplay);\n\n/**\n * @file seek-bar.js\n */\n\n// The number of seconds the `step*` functions move the timeline.\nconst STEP_SECONDS = 5;\n\n// The multiplier of STEP_SECONDS that PgUp/PgDown move the timeline.\nconst PAGE_KEY_MULTIPLIER = 12;\n\n/**\n * Seek bar and container for the progress bars. Uses {@link PlayProgressBar}\n * as its `bar`.\n *\n * @extends Slider\n */\nclass SeekBar extends Slider {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.setEventHandlers_();\n }\n\n /**\n * Sets the event handlers\n *\n * @private\n */\n setEventHandlers_() {\n this.update_ = bind_(this, this.update);\n this.update = throttle(this.update_, UPDATE_REFRESH_INTERVAL);\n this.on(this.player_, ['ended', 'durationchange', 'timeupdate'], this.update);\n if (this.player_.liveTracker) {\n this.on(this.player_.liveTracker, 'liveedgechange', this.update);\n }\n\n // when playing, let's ensure we smoothly update the play progress bar\n // via an interval\n this.updateInterval = null;\n this.enableIntervalHandler_ = e => this.enableInterval_(e);\n this.disableIntervalHandler_ = e => this.disableInterval_(e);\n this.on(this.player_, ['playing'], this.enableIntervalHandler_);\n this.on(this.player_, ['ended', 'pause', 'waiting'], this.disableIntervalHandler_);\n\n // we don't need to update the play progress if the document is hidden,\n // also, this causes the CPU to spike and eventually crash the page on IE11.\n if (\"hidden\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default()) && \"visibilityState\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default())) {\n this.on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'visibilitychange', this.toggleVisibility_);\n }\n }\n toggleVisibility_(e) {\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default().visibilityState) === 'hidden') {\n this.cancelNamedAnimationFrame('SeekBar#update');\n this.cancelNamedAnimationFrame('Slider#update');\n this.disableInterval_(e);\n } else {\n if (!this.player_.ended() && !this.player_.paused()) {\n this.enableInterval_();\n }\n\n // we just switched back to the page and someone may be looking, so, update ASAP\n this.update();\n }\n }\n enableInterval_() {\n if (this.updateInterval) {\n return;\n }\n this.updateInterval = this.setInterval(this.update, UPDATE_REFRESH_INTERVAL);\n }\n disableInterval_(e) {\n if (this.player_.liveTracker && this.player_.liveTracker.isLive() && e && e.type !== 'ended') {\n return;\n }\n if (!this.updateInterval) {\n return;\n }\n this.clearInterval(this.updateInterval);\n this.updateInterval = null;\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n return super.createEl('div', {\n className: 'vjs-progress-holder'\n }, {\n 'aria-label': this.localize('Progress Bar')\n });\n }\n\n /**\n * This function updates the play progress bar and accessibility\n * attributes to whatever is passed in.\n *\n * @param {Event} [event]\n * The `timeupdate` or `ended` event that caused this to run.\n *\n * @listens Player#timeupdate\n *\n * @return {number}\n * The current percent at a number from 0-1\n */\n update(event) {\n // ignore updates while the tab is hidden\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default().visibilityState) === 'hidden') {\n return;\n }\n const percent = super.update();\n this.requestNamedAnimationFrame('SeekBar#update', () => {\n const currentTime = this.player_.ended() ? this.player_.duration() : this.getCurrentTime_();\n const liveTracker = this.player_.liveTracker;\n let duration = this.player_.duration();\n if (liveTracker && liveTracker.isLive()) {\n duration = this.player_.liveTracker.liveCurrentTime();\n }\n if (this.percent_ !== percent) {\n // machine readable value of progress bar (percentage complete)\n this.el_.setAttribute('aria-valuenow', (percent * 100).toFixed(2));\n this.percent_ = percent;\n }\n if (this.currentTime_ !== currentTime || this.duration_ !== duration) {\n // human readable value of progress bar (time complete)\n this.el_.setAttribute('aria-valuetext', this.localize('progress bar timing: currentTime={1} duration={2}', [formatTime(currentTime, duration), formatTime(duration, duration)], '{1} of {2}'));\n this.currentTime_ = currentTime;\n this.duration_ = duration;\n }\n\n // update the progress bar time tooltip with the current time\n if (this.bar) {\n this.bar.update(getBoundingClientRect(this.el()), this.getProgress());\n }\n });\n return percent;\n }\n\n /**\n * Prevent liveThreshold from causing seeks to seem like they\n * are not happening from a user perspective.\n *\n * @param {number} ct\n * current time to seek to\n */\n userSeek_(ct) {\n if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {\n this.player_.liveTracker.nextSeekedFromUser();\n }\n this.player_.currentTime(ct);\n }\n\n /**\n * Get the value of current time but allows for smooth scrubbing,\n * when player can't keep up.\n *\n * @return {number}\n * The current time value to display\n *\n * @private\n */\n getCurrentTime_() {\n return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();\n }\n\n /**\n * Get the percentage of media played so far.\n *\n * @return {number}\n * The percentage of media played so far (0 to 1).\n */\n getPercent() {\n const currentTime = this.getCurrentTime_();\n let percent;\n const liveTracker = this.player_.liveTracker;\n if (liveTracker && liveTracker.isLive()) {\n percent = (currentTime - liveTracker.seekableStart()) / liveTracker.liveWindow();\n\n // prevent the percent from changing at the live edge\n if (liveTracker.atLiveEdge()) {\n percent = 1;\n }\n } else {\n percent = currentTime / this.player_.duration();\n }\n return percent;\n }\n\n /**\n * Handle mouse down on seek bar\n *\n * @param {MouseEvent} event\n * The `mousedown` event that caused this to run.\n *\n * @listens mousedown\n */\n handleMouseDown(event) {\n if (!isSingleLeftClick(event)) {\n return;\n }\n\n // Stop event propagation to prevent double fire in progress-control.js\n event.stopPropagation();\n this.videoWasPlaying = !this.player_.paused();\n this.player_.pause();\n super.handleMouseDown(event);\n }\n\n /**\n * Handle mouse move on seek bar\n *\n * @param {MouseEvent} event\n * The `mousemove` event that caused this to run.\n * @param {boolean} mouseDown this is a flag that should be set to true if `handleMouseMove` is called directly. It allows us to skip things that should not happen if coming from mouse down but should happen on regular mouse move handler. Defaults to false\n *\n * @listens mousemove\n */\n handleMouseMove(event, mouseDown = false) {\n if (!isSingleLeftClick(event) || isNaN(this.player_.duration())) {\n return;\n }\n if (!mouseDown && !this.player_.scrubbing()) {\n this.player_.scrubbing(true);\n }\n let newTime;\n const distance = this.calculateDistance(event);\n const liveTracker = this.player_.liveTracker;\n if (!liveTracker || !liveTracker.isLive()) {\n newTime = distance * this.player_.duration();\n\n // Don't let video end while scrubbing.\n if (newTime === this.player_.duration()) {\n newTime = newTime - 0.1;\n }\n } else {\n if (distance >= 0.99) {\n liveTracker.seekToLiveEdge();\n return;\n }\n const seekableStart = liveTracker.seekableStart();\n const seekableEnd = liveTracker.liveCurrentTime();\n newTime = seekableStart + distance * liveTracker.liveWindow();\n\n // Don't let video end while scrubbing.\n if (newTime >= seekableEnd) {\n newTime = seekableEnd;\n }\n\n // Compensate for precision differences so that currentTime is not less\n // than seekable start\n if (newTime <= seekableStart) {\n newTime = seekableStart + 0.1;\n }\n\n // On android seekableEnd can be Infinity sometimes,\n // this will cause newTime to be Infinity, which is\n // not a valid currentTime.\n if (newTime === Infinity) {\n return;\n }\n }\n\n // Set new time (tell player to seek to new time)\n this.userSeek_(newTime);\n if (this.player_.options_.enableSmoothSeeking) {\n this.update();\n }\n }\n enable() {\n super.enable();\n const mouseTimeDisplay = this.getChild('mouseTimeDisplay');\n if (!mouseTimeDisplay) {\n return;\n }\n mouseTimeDisplay.show();\n }\n disable() {\n super.disable();\n const mouseTimeDisplay = this.getChild('mouseTimeDisplay');\n if (!mouseTimeDisplay) {\n return;\n }\n mouseTimeDisplay.hide();\n }\n\n /**\n * Handle mouse up on seek bar\n *\n * @param {MouseEvent} event\n * The `mouseup` event that caused this to run.\n *\n * @listens mouseup\n */\n handleMouseUp(event) {\n super.handleMouseUp(event);\n\n // Stop event propagation to prevent double fire in progress-control.js\n if (event) {\n event.stopPropagation();\n }\n this.player_.scrubbing(false);\n\n /**\n * Trigger timeupdate because we're done seeking and the time has changed.\n * This is particularly useful for if the player is paused to time the time displays.\n *\n * @event Tech#timeupdate\n * @type {Event}\n */\n this.player_.trigger({\n type: 'timeupdate',\n target: this,\n manuallyTriggered: true\n });\n if (this.videoWasPlaying) {\n silencePromise(this.player_.play());\n } else {\n // We're done seeking and the time has changed.\n // If the player is paused, make sure we display the correct time on the seek bar.\n this.update_();\n }\n }\n\n /**\n * Move more quickly fast forward for keyboard-only users\n */\n stepForward() {\n this.userSeek_(this.player_.currentTime() + STEP_SECONDS);\n }\n\n /**\n * Move more quickly rewind for keyboard-only users\n */\n stepBack() {\n this.userSeek_(this.player_.currentTime() - STEP_SECONDS);\n }\n\n /**\n * Toggles the playback state of the player\n * This gets called when enter or space is used on the seekbar\n *\n * @param {KeyboardEvent} event\n * The `keydown` event that caused this function to be called\n *\n */\n handleAction(event) {\n if (this.player_.paused()) {\n this.player_.play();\n } else {\n this.player_.pause();\n }\n }\n\n /**\n * Called when this SeekBar has focus and a key gets pressed down.\n * Supports the following keys:\n *\n * Space or Enter key fire a click event\n * Home key moves to start of the timeline\n * End key moves to end of the timeline\n * Digit \"0\" through \"9\" keys move to 0%, 10% ... 80%, 90% of the timeline\n * PageDown key moves back a larger step than ArrowDown\n * PageUp key moves forward a large step\n *\n * @param {KeyboardEvent} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n handleKeyDown(event) {\n const liveTracker = this.player_.liveTracker;\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Space') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Enter')) {\n event.preventDefault();\n event.stopPropagation();\n this.handleAction(event);\n } else if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Home')) {\n event.preventDefault();\n event.stopPropagation();\n this.userSeek_(0);\n } else if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'End')) {\n event.preventDefault();\n event.stopPropagation();\n if (liveTracker && liveTracker.isLive()) {\n this.userSeek_(liveTracker.liveCurrentTime());\n } else {\n this.userSeek_(this.player_.duration());\n }\n } else if (/^[0-9]$/.test(keycode__WEBPACK_IMPORTED_MODULE_2___default()(event))) {\n event.preventDefault();\n event.stopPropagation();\n const gotoFraction = ((keycode__WEBPACK_IMPORTED_MODULE_2___default().codes)[keycode__WEBPACK_IMPORTED_MODULE_2___default()(event)] - (keycode__WEBPACK_IMPORTED_MODULE_2___default().codes)['0']) * 10.0 / 100.0;\n if (liveTracker && liveTracker.isLive()) {\n this.userSeek_(liveTracker.seekableStart() + liveTracker.liveWindow() * gotoFraction);\n } else {\n this.userSeek_(this.player_.duration() * gotoFraction);\n }\n } else if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'PgDn')) {\n event.preventDefault();\n event.stopPropagation();\n this.userSeek_(this.player_.currentTime() - STEP_SECONDS * PAGE_KEY_MULTIPLIER);\n } else if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'PgUp')) {\n event.preventDefault();\n event.stopPropagation();\n this.userSeek_(this.player_.currentTime() + STEP_SECONDS * PAGE_KEY_MULTIPLIER);\n } else {\n // Pass keydown handling up for unsupported keys\n super.handleKeyDown(event);\n }\n }\n dispose() {\n this.disableInterval_();\n this.off(this.player_, ['ended', 'durationchange', 'timeupdate'], this.update);\n if (this.player_.liveTracker) {\n this.off(this.player_.liveTracker, 'liveedgechange', this.update);\n }\n this.off(this.player_, ['playing'], this.enableIntervalHandler_);\n this.off(this.player_, ['ended', 'pause', 'waiting'], this.disableIntervalHandler_);\n\n // we don't need to update the play progress if the document is hidden,\n // also, this causes the CPU to spike and eventually crash the page on IE11.\n if (\"hidden\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default()) && \"visibilityState\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default())) {\n this.off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'visibilitychange', this.toggleVisibility_);\n }\n super.dispose();\n }\n}\n\n/**\n * Default options for the `SeekBar`\n *\n * @type {Object}\n * @private\n */\nSeekBar.prototype.options_ = {\n children: ['loadProgressBar', 'playProgressBar'],\n barName: 'playProgressBar'\n};\n\n// MouseTimeDisplay tooltips should not be added to a player on mobile devices\nif (!IS_IOS && !IS_ANDROID) {\n SeekBar.prototype.options_.children.splice(1, 0, 'mouseTimeDisplay');\n}\nComponent$1.registerComponent('SeekBar', SeekBar);\n\n/**\n * @file progress-control.js\n */\n\n/**\n * The Progress Control component contains the seek bar, load progress,\n * and play progress.\n *\n * @extends Component\n */\nclass ProgressControl extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.handleMouseMove = throttle(bind_(this, this.handleMouseMove), UPDATE_REFRESH_INTERVAL);\n this.throttledHandleMouseSeek = throttle(bind_(this, this.handleMouseSeek), UPDATE_REFRESH_INTERVAL);\n this.handleMouseUpHandler_ = e => this.handleMouseUp(e);\n this.handleMouseDownHandler_ = e => this.handleMouseDown(e);\n this.enable();\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n return super.createEl('div', {\n className: 'vjs-progress-control vjs-control'\n });\n }\n\n /**\n * When the mouse moves over the `ProgressControl`, the pointer position\n * gets passed down to the `MouseTimeDisplay` component.\n *\n * @param {Event} event\n * The `mousemove` event that caused this function to run.\n *\n * @listen mousemove\n */\n handleMouseMove(event) {\n const seekBar = this.getChild('seekBar');\n if (!seekBar) {\n return;\n }\n const playProgressBar = seekBar.getChild('playProgressBar');\n const mouseTimeDisplay = seekBar.getChild('mouseTimeDisplay');\n if (!playProgressBar && !mouseTimeDisplay) {\n return;\n }\n const seekBarEl = seekBar.el();\n const seekBarRect = findPosition(seekBarEl);\n let seekBarPoint = getPointerPosition(seekBarEl, event).x;\n\n // The default skin has a gap on either side of the `SeekBar`. This means\n // that it's possible to trigger this behavior outside the boundaries of\n // the `SeekBar`. This ensures we stay within it at all times.\n seekBarPoint = clamp(seekBarPoint, 0, 1);\n if (mouseTimeDisplay) {\n mouseTimeDisplay.update(seekBarRect, seekBarPoint);\n }\n if (playProgressBar) {\n playProgressBar.update(seekBarRect, seekBar.getProgress());\n }\n }\n\n /**\n * A throttled version of the {@link ProgressControl#handleMouseSeek} listener.\n *\n * @method ProgressControl#throttledHandleMouseSeek\n * @param {Event} event\n * The `mousemove` event that caused this function to run.\n *\n * @listen mousemove\n * @listen touchmove\n */\n\n /**\n * Handle `mousemove` or `touchmove` events on the `ProgressControl`.\n *\n * @param {Event} event\n * `mousedown` or `touchstart` event that triggered this function\n *\n * @listens mousemove\n * @listens touchmove\n */\n handleMouseSeek(event) {\n const seekBar = this.getChild('seekBar');\n if (seekBar) {\n seekBar.handleMouseMove(event);\n }\n }\n\n /**\n * Are controls are currently enabled for this progress control.\n *\n * @return {boolean}\n * true if controls are enabled, false otherwise\n */\n enabled() {\n return this.enabled_;\n }\n\n /**\n * Disable all controls on the progress control and its children\n */\n disable() {\n this.children().forEach(child => child.disable && child.disable());\n if (!this.enabled()) {\n return;\n }\n this.off(['mousedown', 'touchstart'], this.handleMouseDownHandler_);\n this.off(this.el_, 'mousemove', this.handleMouseMove);\n this.removeListenersAddedOnMousedownAndTouchstart();\n this.addClass('disabled');\n this.enabled_ = false;\n\n // Restore normal playback state if controls are disabled while scrubbing\n if (this.player_.scrubbing()) {\n const seekBar = this.getChild('seekBar');\n this.player_.scrubbing(false);\n if (seekBar.videoWasPlaying) {\n silencePromise(this.player_.play());\n }\n }\n }\n\n /**\n * Enable all controls on the progress control and its children\n */\n enable() {\n this.children().forEach(child => child.enable && child.enable());\n if (this.enabled()) {\n return;\n }\n this.on(['mousedown', 'touchstart'], this.handleMouseDownHandler_);\n this.on(this.el_, 'mousemove', this.handleMouseMove);\n this.removeClass('disabled');\n this.enabled_ = true;\n }\n\n /**\n * Cleanup listeners after the user finishes interacting with the progress controls\n */\n removeListenersAddedOnMousedownAndTouchstart() {\n const doc = this.el_.ownerDocument;\n this.off(doc, 'mousemove', this.throttledHandleMouseSeek);\n this.off(doc, 'touchmove', this.throttledHandleMouseSeek);\n this.off(doc, 'mouseup', this.handleMouseUpHandler_);\n this.off(doc, 'touchend', this.handleMouseUpHandler_);\n }\n\n /**\n * Handle `mousedown` or `touchstart` events on the `ProgressControl`.\n *\n * @param {Event} event\n * `mousedown` or `touchstart` event that triggered this function\n *\n * @listens mousedown\n * @listens touchstart\n */\n handleMouseDown(event) {\n const doc = this.el_.ownerDocument;\n const seekBar = this.getChild('seekBar');\n if (seekBar) {\n seekBar.handleMouseDown(event);\n }\n this.on(doc, 'mousemove', this.throttledHandleMouseSeek);\n this.on(doc, 'touchmove', this.throttledHandleMouseSeek);\n this.on(doc, 'mouseup', this.handleMouseUpHandler_);\n this.on(doc, 'touchend', this.handleMouseUpHandler_);\n }\n\n /**\n * Handle `mouseup` or `touchend` events on the `ProgressControl`.\n *\n * @param {Event} event\n * `mouseup` or `touchend` event that triggered this function.\n *\n * @listens touchend\n * @listens mouseup\n */\n handleMouseUp(event) {\n const seekBar = this.getChild('seekBar');\n if (seekBar) {\n seekBar.handleMouseUp(event);\n }\n this.removeListenersAddedOnMousedownAndTouchstart();\n }\n}\n\n/**\n * Default options for `ProgressControl`\n *\n * @type {Object}\n * @private\n */\nProgressControl.prototype.options_ = {\n children: ['seekBar']\n};\nComponent$1.registerComponent('ProgressControl', ProgressControl);\n\n/**\n * @file picture-in-picture-toggle.js\n */\n\n/**\n * Toggle Picture-in-Picture mode\n *\n * @extends Button\n */\nclass PictureInPictureToggle extends Button {\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @listens Player#enterpictureinpicture\n * @listens Player#leavepictureinpicture\n */\n constructor(player, options) {\n super(player, options);\n this.setIcon('picture-in-picture-enter');\n this.on(player, ['enterpictureinpicture', 'leavepictureinpicture'], e => this.handlePictureInPictureChange(e));\n this.on(player, ['disablepictureinpicturechanged', 'loadedmetadata'], e => this.handlePictureInPictureEnabledChange(e));\n this.on(player, ['loadedmetadata', 'audioonlymodechange', 'audiopostermodechange'], () => this.handlePictureInPictureAudioModeChange());\n\n // TODO: Deactivate button on player emptied event.\n this.disable();\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`;\n }\n\n /**\n * Displays or hides the button depending on the audio mode detection.\n * Exits picture-in-picture if it is enabled when switching to audio mode.\n */\n handlePictureInPictureAudioModeChange() {\n // This audio detection will not detect HLS or DASH audio-only streams because there was no reliable way to detect them at the time\n const isSourceAudio = this.player_.currentType().substring(0, 5) === 'audio';\n const isAudioMode = isSourceAudio || this.player_.audioPosterMode() || this.player_.audioOnlyMode();\n if (!isAudioMode) {\n this.show();\n return;\n }\n if (this.player_.isInPictureInPicture()) {\n this.player_.exitPictureInPicture();\n }\n this.hide();\n }\n\n /**\n * Enables or disables button based on availability of a Picture-In-Picture mode.\n *\n * Enabled if\n * - `player.options().enableDocumentPictureInPicture` is true and\n * window.documentPictureInPicture is available; or\n * - `player.disablePictureInPicture()` is false and\n * element.requestPictureInPicture is available\n */\n handlePictureInPictureEnabledChange() {\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default().pictureInPictureEnabled) && this.player_.disablePictureInPicture() === false || this.player_.options_.enableDocumentPictureInPicture && \"documentPictureInPicture\" in (global_window__WEBPACK_IMPORTED_MODULE_0___default())) {\n this.enable();\n } else {\n this.disable();\n }\n }\n\n /**\n * Handles enterpictureinpicture and leavepictureinpicture on the player and change control text accordingly.\n *\n * @param {Event} [event]\n * The {@link Player#enterpictureinpicture} or {@link Player#leavepictureinpicture} event that caused this function to be\n * called.\n *\n * @listens Player#enterpictureinpicture\n * @listens Player#leavepictureinpicture\n */\n handlePictureInPictureChange(event) {\n if (this.player_.isInPictureInPicture()) {\n this.setIcon('picture-in-picture-exit');\n this.controlText('Exit Picture-in-Picture');\n } else {\n this.setIcon('picture-in-picture-enter');\n this.controlText('Picture-in-Picture');\n }\n this.handlePictureInPictureEnabledChange();\n }\n\n /**\n * This gets called when an `PictureInPictureToggle` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n if (!this.player_.isInPictureInPicture()) {\n this.player_.requestPictureInPicture();\n } else {\n this.player_.exitPictureInPicture();\n }\n }\n\n /**\n * Show the `Component`s element if it is hidden by removing the\n * 'vjs-hidden' class name from it only in browsers that support the Picture-in-Picture API.\n */\n show() {\n // Does not allow to display the pictureInPictureToggle in browsers that do not support the Picture-in-Picture API, e.g. Firefox.\n if (typeof (global_document__WEBPACK_IMPORTED_MODULE_1___default().exitPictureInPicture) !== 'function') {\n return;\n }\n super.show();\n }\n}\n\n/**\n * The text that should display over the `PictureInPictureToggle`s controls. Added for localization.\n *\n * @type {string}\n * @protected\n */\nPictureInPictureToggle.prototype.controlText_ = 'Picture-in-Picture';\nComponent$1.registerComponent('PictureInPictureToggle', PictureInPictureToggle);\n\n/**\n * @file fullscreen-toggle.js\n */\n\n/**\n * Toggle fullscreen video\n *\n * @extends Button\n */\nclass FullscreenToggle extends Button {\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.setIcon('fullscreen-enter');\n this.on(player, 'fullscreenchange', e => this.handleFullscreenChange(e));\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default())[player.fsApi_.fullscreenEnabled] === false) {\n this.disable();\n }\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-fullscreen-control ${super.buildCSSClass()}`;\n }\n\n /**\n * Handles fullscreenchange on the player and change control text accordingly.\n *\n * @param {Event} [event]\n * The {@link Player#fullscreenchange} event that caused this function to be\n * called.\n *\n * @listens Player#fullscreenchange\n */\n handleFullscreenChange(event) {\n if (this.player_.isFullscreen()) {\n this.controlText('Exit Fullscreen');\n this.setIcon('fullscreen-exit');\n } else {\n this.controlText('Fullscreen');\n this.setIcon('fullscreen-enter');\n }\n }\n\n /**\n * This gets called when an `FullscreenToggle` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n if (!this.player_.isFullscreen()) {\n this.player_.requestFullscreen();\n } else {\n this.player_.exitFullscreen();\n }\n }\n}\n\n/**\n * The text that should display over the `FullscreenToggle`s controls. Added for localization.\n *\n * @type {string}\n * @protected\n */\nFullscreenToggle.prototype.controlText_ = 'Fullscreen';\nComponent$1.registerComponent('FullscreenToggle', FullscreenToggle);\n\n/**\n * Check if volume control is supported and if it isn't hide the\n * `Component` that was passed using the `vjs-hidden` class.\n *\n * @param { import('../../component').default } self\n * The component that should be hidden if volume is unsupported\n *\n * @param { import('../../player').default } player\n * A reference to the player\n *\n * @private\n */\nconst checkVolumeSupport = function (self, player) {\n // hide volume controls when they're not supported by the current tech\n if (player.tech_ && !player.tech_.featuresVolumeControl) {\n self.addClass('vjs-hidden');\n }\n self.on(player, 'loadstart', function () {\n if (!player.tech_.featuresVolumeControl) {\n self.addClass('vjs-hidden');\n } else {\n self.removeClass('vjs-hidden');\n }\n });\n};\n\n/**\n * @file volume-level.js\n */\n\n/**\n * Shows volume level\n *\n * @extends Component\n */\nclass VolumeLevel extends Component$1 {\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n const el = super.createEl('div', {\n className: 'vjs-volume-level'\n });\n this.setIcon('circle', el);\n el.appendChild(super.createEl('span', {\n className: 'vjs-control-text'\n }));\n return el;\n }\n}\nComponent$1.registerComponent('VolumeLevel', VolumeLevel);\n\n/**\n * @file volume-level-tooltip.js\n */\n\n/**\n * Volume level tooltips display a volume above or side by side the volume bar.\n *\n * @extends Component\n */\nclass VolumeLevelTooltip extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The {@link Player} that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.update = throttle(bind_(this, this.update), UPDATE_REFRESH_INTERVAL);\n }\n\n /**\n * Create the volume tooltip DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n return super.createEl('div', {\n className: 'vjs-volume-tooltip'\n }, {\n 'aria-hidden': 'true'\n });\n }\n\n /**\n * Updates the position of the tooltip relative to the `VolumeBar` and\n * its content text.\n *\n * @param {Object} rangeBarRect\n * The `ClientRect` for the {@link VolumeBar} element.\n *\n * @param {number} rangeBarPoint\n * A number from 0 to 1, representing a horizontal/vertical reference point\n * from the left edge of the {@link VolumeBar}\n *\n * @param {boolean} vertical\n * Referees to the Volume control position\n * in the control bar{@link VolumeControl}\n *\n */\n update(rangeBarRect, rangeBarPoint, vertical, content) {\n if (!vertical) {\n const tooltipRect = getBoundingClientRect(this.el_);\n const playerRect = getBoundingClientRect(this.player_.el());\n const volumeBarPointPx = rangeBarRect.width * rangeBarPoint;\n if (!playerRect || !tooltipRect) {\n return;\n }\n const spaceLeftOfPoint = rangeBarRect.left - playerRect.left + volumeBarPointPx;\n const spaceRightOfPoint = rangeBarRect.width - volumeBarPointPx + (playerRect.right - rangeBarRect.right);\n let pullTooltipBy = tooltipRect.width / 2;\n if (spaceLeftOfPoint < pullTooltipBy) {\n pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;\n } else if (spaceRightOfPoint < pullTooltipBy) {\n pullTooltipBy = spaceRightOfPoint;\n }\n if (pullTooltipBy < 0) {\n pullTooltipBy = 0;\n } else if (pullTooltipBy > tooltipRect.width) {\n pullTooltipBy = tooltipRect.width;\n }\n this.el_.style.right = `-${pullTooltipBy}px`;\n }\n this.write(`${content}%`);\n }\n\n /**\n * Write the volume to the tooltip DOM element.\n *\n * @param {string} content\n * The formatted volume for the tooltip.\n */\n write(content) {\n textContent(this.el_, content);\n }\n\n /**\n * Updates the position of the volume tooltip relative to the `VolumeBar`.\n *\n * @param {Object} rangeBarRect\n * The `ClientRect` for the {@link VolumeBar} element.\n *\n * @param {number} rangeBarPoint\n * A number from 0 to 1, representing a horizontal/vertical reference point\n * from the left edge of the {@link VolumeBar}\n *\n * @param {boolean} vertical\n * Referees to the Volume control position\n * in the control bar{@link VolumeControl}\n *\n * @param {number} volume\n * The volume level to update the tooltip to\n *\n * @param {Function} cb\n * A function that will be called during the request animation frame\n * for tooltips that need to do additional animations from the default\n */\n updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, cb) {\n this.requestNamedAnimationFrame('VolumeLevelTooltip#updateVolume', () => {\n this.update(rangeBarRect, rangeBarPoint, vertical, volume.toFixed(0));\n if (cb) {\n cb();\n }\n });\n }\n}\nComponent$1.registerComponent('VolumeLevelTooltip', VolumeLevelTooltip);\n\n/**\n * @file mouse-volume-level-display.js\n */\n\n/**\n * The {@link MouseVolumeLevelDisplay} component tracks mouse movement over the\n * {@link VolumeControl}. It displays an indicator and a {@link VolumeLevelTooltip}\n * indicating the volume level which is represented by a given point in the\n * {@link VolumeBar}.\n *\n * @extends Component\n */\nclass MouseVolumeLevelDisplay extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The {@link Player} that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.update = throttle(bind_(this, this.update), UPDATE_REFRESH_INTERVAL);\n }\n\n /**\n * Create the DOM element for this class.\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n return super.createEl('div', {\n className: 'vjs-mouse-display'\n });\n }\n\n /**\n * Enquires updates to its own DOM as well as the DOM of its\n * {@link VolumeLevelTooltip} child.\n *\n * @param {Object} rangeBarRect\n * The `ClientRect` for the {@link VolumeBar} element.\n *\n * @param {number} rangeBarPoint\n * A number from 0 to 1, representing a horizontal/vertical reference point\n * from the left edge of the {@link VolumeBar}\n *\n * @param {boolean} vertical\n * Referees to the Volume control position\n * in the control bar{@link VolumeControl}\n *\n */\n update(rangeBarRect, rangeBarPoint, vertical) {\n const volume = 100 * rangeBarPoint;\n this.getChild('volumeLevelTooltip').updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, () => {\n if (vertical) {\n this.el_.style.bottom = `${rangeBarRect.height * rangeBarPoint}px`;\n } else {\n this.el_.style.left = `${rangeBarRect.width * rangeBarPoint}px`;\n }\n });\n }\n}\n\n/**\n * Default options for `MouseVolumeLevelDisplay`\n *\n * @type {Object}\n * @private\n */\nMouseVolumeLevelDisplay.prototype.options_ = {\n children: ['volumeLevelTooltip']\n};\nComponent$1.registerComponent('MouseVolumeLevelDisplay', MouseVolumeLevelDisplay);\n\n/**\n * @file volume-bar.js\n */\n\n/**\n * The bar that contains the volume level and can be clicked on to adjust the level\n *\n * @extends Slider\n */\nclass VolumeBar extends Slider {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.on('slideractive', e => this.updateLastVolume_(e));\n this.on(player, 'volumechange', e => this.updateARIAAttributes(e));\n player.ready(() => this.updateARIAAttributes());\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n return super.createEl('div', {\n className: 'vjs-volume-bar vjs-slider-bar'\n }, {\n 'aria-label': this.localize('Volume Level'),\n 'aria-live': 'polite'\n });\n }\n\n /**\n * Handle mouse down on volume bar\n *\n * @param {Event} event\n * The `mousedown` event that caused this to run.\n *\n * @listens mousedown\n */\n handleMouseDown(event) {\n if (!isSingleLeftClick(event)) {\n return;\n }\n super.handleMouseDown(event);\n }\n\n /**\n * Handle movement events on the {@link VolumeMenuButton}.\n *\n * @param {Event} event\n * The event that caused this function to run.\n *\n * @listens mousemove\n */\n handleMouseMove(event) {\n const mouseVolumeLevelDisplay = this.getChild('mouseVolumeLevelDisplay');\n if (mouseVolumeLevelDisplay) {\n const volumeBarEl = this.el();\n const volumeBarRect = getBoundingClientRect(volumeBarEl);\n const vertical = this.vertical();\n let volumeBarPoint = getPointerPosition(volumeBarEl, event);\n volumeBarPoint = vertical ? volumeBarPoint.y : volumeBarPoint.x;\n // The default skin has a gap on either side of the `VolumeBar`. This means\n // that it's possible to trigger this behavior outside the boundaries of\n // the `VolumeBar`. This ensures we stay within it at all times.\n volumeBarPoint = clamp(volumeBarPoint, 0, 1);\n mouseVolumeLevelDisplay.update(volumeBarRect, volumeBarPoint, vertical);\n }\n if (!isSingleLeftClick(event)) {\n return;\n }\n this.checkMuted();\n this.player_.volume(this.calculateDistance(event));\n }\n\n /**\n * If the player is muted unmute it.\n */\n checkMuted() {\n if (this.player_.muted()) {\n this.player_.muted(false);\n }\n }\n\n /**\n * Get percent of volume level\n *\n * @return {number}\n * Volume level percent as a decimal number.\n */\n getPercent() {\n if (this.player_.muted()) {\n return 0;\n }\n return this.player_.volume();\n }\n\n /**\n * Increase volume level for keyboard users\n */\n stepForward() {\n this.checkMuted();\n this.player_.volume(this.player_.volume() + 0.1);\n }\n\n /**\n * Decrease volume level for keyboard users\n */\n stepBack() {\n this.checkMuted();\n this.player_.volume(this.player_.volume() - 0.1);\n }\n\n /**\n * Update ARIA accessibility attributes\n *\n * @param {Event} [event]\n * The `volumechange` event that caused this function to run.\n *\n * @listens Player#volumechange\n */\n updateARIAAttributes(event) {\n const ariaValue = this.player_.muted() ? 0 : this.volumeAsPercentage_();\n this.el_.setAttribute('aria-valuenow', ariaValue);\n this.el_.setAttribute('aria-valuetext', ariaValue + '%');\n }\n\n /**\n * Returns the current value of the player volume as a percentage\n *\n * @private\n */\n volumeAsPercentage_() {\n return Math.round(this.player_.volume() * 100);\n }\n\n /**\n * When user starts dragging the VolumeBar, store the volume and listen for\n * the end of the drag. When the drag ends, if the volume was set to zero,\n * set lastVolume to the stored volume.\n *\n * @listens slideractive\n * @private\n */\n updateLastVolume_() {\n const volumeBeforeDrag = this.player_.volume();\n this.one('sliderinactive', () => {\n if (this.player_.volume() === 0) {\n this.player_.lastVolume_(volumeBeforeDrag);\n }\n });\n }\n}\n\n/**\n * Default options for the `VolumeBar`\n *\n * @type {Object}\n * @private\n */\nVolumeBar.prototype.options_ = {\n children: ['volumeLevel'],\n barName: 'volumeLevel'\n};\n\n// MouseVolumeLevelDisplay tooltip should not be added to a player on mobile devices\nif (!IS_IOS && !IS_ANDROID) {\n VolumeBar.prototype.options_.children.splice(0, 0, 'mouseVolumeLevelDisplay');\n}\n\n/**\n * Call the update event for this Slider when this event happens on the player.\n *\n * @type {string}\n */\nVolumeBar.prototype.playerEvent = 'volumechange';\nComponent$1.registerComponent('VolumeBar', VolumeBar);\n\n/**\n * @file volume-control.js\n */\n\n/**\n * The component for controlling the volume level\n *\n * @extends Component\n */\nclass VolumeControl extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n constructor(player, options = {}) {\n options.vertical = options.vertical || false;\n\n // Pass the vertical option down to the VolumeBar if\n // the VolumeBar is turned on.\n if (typeof options.volumeBar === 'undefined' || isPlain(options.volumeBar)) {\n options.volumeBar = options.volumeBar || {};\n options.volumeBar.vertical = options.vertical;\n }\n super(player, options);\n\n // hide this control if volume support is missing\n checkVolumeSupport(this, player);\n this.throttledHandleMouseMove = throttle(bind_(this, this.handleMouseMove), UPDATE_REFRESH_INTERVAL);\n this.handleMouseUpHandler_ = e => this.handleMouseUp(e);\n this.on('mousedown', e => this.handleMouseDown(e));\n this.on('touchstart', e => this.handleMouseDown(e));\n this.on('mousemove', e => this.handleMouseMove(e));\n\n // while the slider is active (the mouse has been pressed down and\n // is dragging) or in focus we do not want to hide the VolumeBar\n this.on(this.volumeBar, ['focus', 'slideractive'], () => {\n this.volumeBar.addClass('vjs-slider-active');\n this.addClass('vjs-slider-active');\n this.trigger('slideractive');\n });\n this.on(this.volumeBar, ['blur', 'sliderinactive'], () => {\n this.volumeBar.removeClass('vjs-slider-active');\n this.removeClass('vjs-slider-active');\n this.trigger('sliderinactive');\n });\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n let orientationClass = 'vjs-volume-horizontal';\n if (this.options_.vertical) {\n orientationClass = 'vjs-volume-vertical';\n }\n return super.createEl('div', {\n className: `vjs-volume-control vjs-control ${orientationClass}`\n });\n }\n\n /**\n * Handle `mousedown` or `touchstart` events on the `VolumeControl`.\n *\n * @param {Event} event\n * `mousedown` or `touchstart` event that triggered this function\n *\n * @listens mousedown\n * @listens touchstart\n */\n handleMouseDown(event) {\n const doc = this.el_.ownerDocument;\n this.on(doc, 'mousemove', this.throttledHandleMouseMove);\n this.on(doc, 'touchmove', this.throttledHandleMouseMove);\n this.on(doc, 'mouseup', this.handleMouseUpHandler_);\n this.on(doc, 'touchend', this.handleMouseUpHandler_);\n }\n\n /**\n * Handle `mouseup` or `touchend` events on the `VolumeControl`.\n *\n * @param {Event} event\n * `mouseup` or `touchend` event that triggered this function.\n *\n * @listens touchend\n * @listens mouseup\n */\n handleMouseUp(event) {\n const doc = this.el_.ownerDocument;\n this.off(doc, 'mousemove', this.throttledHandleMouseMove);\n this.off(doc, 'touchmove', this.throttledHandleMouseMove);\n this.off(doc, 'mouseup', this.handleMouseUpHandler_);\n this.off(doc, 'touchend', this.handleMouseUpHandler_);\n }\n\n /**\n * Handle `mousedown` or `touchstart` events on the `VolumeControl`.\n *\n * @param {Event} event\n * `mousedown` or `touchstart` event that triggered this function\n *\n * @listens mousedown\n * @listens touchstart\n */\n handleMouseMove(event) {\n this.volumeBar.handleMouseMove(event);\n }\n}\n\n/**\n * Default options for the `VolumeControl`\n *\n * @type {Object}\n * @private\n */\nVolumeControl.prototype.options_ = {\n children: ['volumeBar']\n};\nComponent$1.registerComponent('VolumeControl', VolumeControl);\n\n/**\n * Check if muting volume is supported and if it isn't hide the mute toggle\n * button.\n *\n * @param { import('../../component').default } self\n * A reference to the mute toggle button\n *\n * @param { import('../../player').default } player\n * A reference to the player\n *\n * @private\n */\nconst checkMuteSupport = function (self, player) {\n // hide mute toggle button if it's not supported by the current tech\n if (player.tech_ && !player.tech_.featuresMuteControl) {\n self.addClass('vjs-hidden');\n }\n self.on(player, 'loadstart', function () {\n if (!player.tech_.featuresMuteControl) {\n self.addClass('vjs-hidden');\n } else {\n self.removeClass('vjs-hidden');\n }\n });\n};\n\n/**\n * @file mute-toggle.js\n */\n\n/**\n * A button component for muting the audio.\n *\n * @extends Button\n */\nclass MuteToggle extends Button {\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n\n // hide this control if volume support is missing\n checkMuteSupport(this, player);\n this.on(player, ['loadstart', 'volumechange'], e => this.update(e));\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-mute-control ${super.buildCSSClass()}`;\n }\n\n /**\n * This gets called when an `MuteToggle` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n const vol = this.player_.volume();\n const lastVolume = this.player_.lastVolume_();\n if (vol === 0) {\n const volumeToSet = lastVolume < 0.1 ? 0.1 : lastVolume;\n this.player_.volume(volumeToSet);\n this.player_.muted(false);\n } else {\n this.player_.muted(this.player_.muted() ? false : true);\n }\n }\n\n /**\n * Update the `MuteToggle` button based on the state of `volume` and `muted`\n * on the player.\n *\n * @param {Event} [event]\n * The {@link Player#loadstart} event if this function was called\n * through an event.\n *\n * @listens Player#loadstart\n * @listens Player#volumechange\n */\n update(event) {\n this.updateIcon_();\n this.updateControlText_();\n }\n\n /**\n * Update the appearance of the `MuteToggle` icon.\n *\n * Possible states (given `level` variable below):\n * - 0: crossed out\n * - 1: zero bars of volume\n * - 2: one bar of volume\n * - 3: two bars of volume\n *\n * @private\n */\n updateIcon_() {\n const vol = this.player_.volume();\n let level = 3;\n this.setIcon('volume-high');\n\n // in iOS when a player is loaded with muted attribute\n // and volume is changed with a native mute button\n // we want to make sure muted state is updated\n if (IS_IOS && this.player_.tech_ && this.player_.tech_.el_) {\n this.player_.muted(this.player_.tech_.el_.muted);\n }\n if (vol === 0 || this.player_.muted()) {\n this.setIcon('volume-mute');\n level = 0;\n } else if (vol < 0.33) {\n this.setIcon('volume-low');\n level = 1;\n } else if (vol < 0.67) {\n this.setIcon('volume-medium');\n level = 2;\n }\n removeClass(this.el_, [0, 1, 2, 3].reduce((str, i) => str + `${i ? ' ' : ''}vjs-vol-${i}`, ''));\n addClass(this.el_, `vjs-vol-${level}`);\n }\n\n /**\n * If `muted` has changed on the player, update the control text\n * (`title` attribute on `vjs-mute-control` element and content of\n * `vjs-control-text` element).\n *\n * @private\n */\n updateControlText_() {\n const soundOff = this.player_.muted() || this.player_.volume() === 0;\n const text = soundOff ? 'Unmute' : 'Mute';\n if (this.controlText() !== text) {\n this.controlText(text);\n }\n }\n}\n\n/**\n * The text that should display over the `MuteToggle`s controls. Added for localization.\n *\n * @type {string}\n * @protected\n */\nMuteToggle.prototype.controlText_ = 'Mute';\nComponent$1.registerComponent('MuteToggle', MuteToggle);\n\n/**\n * @file volume-control.js\n */\n\n/**\n * A Component to contain the MuteToggle and VolumeControl so that\n * they can work together.\n *\n * @extends Component\n */\nclass VolumePanel extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n constructor(player, options = {}) {\n if (typeof options.inline !== 'undefined') {\n options.inline = options.inline;\n } else {\n options.inline = true;\n }\n\n // pass the inline option down to the VolumeControl as vertical if\n // the VolumeControl is on.\n if (typeof options.volumeControl === 'undefined' || isPlain(options.volumeControl)) {\n options.volumeControl = options.volumeControl || {};\n options.volumeControl.vertical = !options.inline;\n }\n super(player, options);\n\n // this handler is used by mouse handler methods below\n this.handleKeyPressHandler_ = e => this.handleKeyPress(e);\n this.on(player, ['loadstart'], e => this.volumePanelState_(e));\n this.on(this.muteToggle, 'keyup', e => this.handleKeyPress(e));\n this.on(this.volumeControl, 'keyup', e => this.handleVolumeControlKeyUp(e));\n this.on('keydown', e => this.handleKeyPress(e));\n this.on('mouseover', e => this.handleMouseOver(e));\n this.on('mouseout', e => this.handleMouseOut(e));\n\n // while the slider is active (the mouse has been pressed down and\n // is dragging) we do not want to hide the VolumeBar\n this.on(this.volumeControl, ['slideractive'], this.sliderActive_);\n this.on(this.volumeControl, ['sliderinactive'], this.sliderInactive_);\n }\n\n /**\n * Add vjs-slider-active class to the VolumePanel\n *\n * @listens VolumeControl#slideractive\n * @private\n */\n sliderActive_() {\n this.addClass('vjs-slider-active');\n }\n\n /**\n * Removes vjs-slider-active class to the VolumePanel\n *\n * @listens VolumeControl#sliderinactive\n * @private\n */\n sliderInactive_() {\n this.removeClass('vjs-slider-active');\n }\n\n /**\n * Adds vjs-hidden or vjs-mute-toggle-only to the VolumePanel\n * depending on MuteToggle and VolumeControl state\n *\n * @listens Player#loadstart\n * @private\n */\n volumePanelState_() {\n // hide volume panel if neither volume control or mute toggle\n // are displayed\n if (this.volumeControl.hasClass('vjs-hidden') && this.muteToggle.hasClass('vjs-hidden')) {\n this.addClass('vjs-hidden');\n }\n\n // if only mute toggle is visible we don't want\n // volume panel expanding when hovered or active\n if (this.volumeControl.hasClass('vjs-hidden') && !this.muteToggle.hasClass('vjs-hidden')) {\n this.addClass('vjs-mute-toggle-only');\n }\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n let orientationClass = 'vjs-volume-panel-horizontal';\n if (!this.options_.inline) {\n orientationClass = 'vjs-volume-panel-vertical';\n }\n return super.createEl('div', {\n className: `vjs-volume-panel vjs-control ${orientationClass}`\n });\n }\n\n /**\n * Dispose of the `volume-panel` and all child components.\n */\n dispose() {\n this.handleMouseOut();\n super.dispose();\n }\n\n /**\n * Handles `keyup` events on the `VolumeControl`, looking for ESC, which closes\n * the volume panel and sets focus on `MuteToggle`.\n *\n * @param {Event} event\n * The `keyup` event that caused this function to be called.\n *\n * @listens keyup\n */\n handleVolumeControlKeyUp(event) {\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Esc')) {\n this.muteToggle.focus();\n }\n }\n\n /**\n * This gets called when a `VolumePanel` gains hover via a `mouseover` event.\n * Turns on listening for `mouseover` event. When they happen it\n * calls `this.handleMouseOver`.\n *\n * @param {Event} event\n * The `mouseover` event that caused this function to be called.\n *\n * @listens mouseover\n */\n handleMouseOver(event) {\n this.addClass('vjs-hover');\n on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keyup', this.handleKeyPressHandler_);\n }\n\n /**\n * This gets called when a `VolumePanel` gains hover via a `mouseout` event.\n * Turns on listening for `mouseout` event. When they happen it\n * calls `this.handleMouseOut`.\n *\n * @param {Event} event\n * The `mouseout` event that caused this function to be called.\n *\n * @listens mouseout\n */\n handleMouseOut(event) {\n this.removeClass('vjs-hover');\n off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keyup', this.handleKeyPressHandler_);\n }\n\n /**\n * Handles `keyup` event on the document or `keydown` event on the `VolumePanel`,\n * looking for ESC, which hides the `VolumeControl`.\n *\n * @param {Event} event\n * The keypress that triggered this event.\n *\n * @listens keydown | keyup\n */\n handleKeyPress(event) {\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Esc')) {\n this.handleMouseOut();\n }\n }\n}\n\n/**\n * Default options for the `VolumeControl`\n *\n * @type {Object}\n * @private\n */\nVolumePanel.prototype.options_ = {\n children: ['muteToggle', 'volumeControl']\n};\nComponent$1.registerComponent('VolumePanel', VolumePanel);\n\n/**\n * Button to skip forward a configurable amount of time\n * through a video. Renders in the control bar.\n *\n * e.g. options: {controlBar: {skipButtons: forward: 5}}\n *\n * @extends Button\n */\nclass SkipForward extends Button {\n constructor(player, options) {\n super(player, options);\n this.validOptions = [5, 10, 30];\n this.skipTime = this.getSkipForwardTime();\n if (this.skipTime && this.validOptions.includes(this.skipTime)) {\n this.setIcon(`forward-${this.skipTime}`);\n this.controlText(this.localize('Skip forward {1} seconds', [this.skipTime]));\n this.show();\n } else {\n this.hide();\n }\n }\n getSkipForwardTime() {\n const playerOptions = this.options_.playerOptions;\n return playerOptions.controlBar && playerOptions.controlBar.skipButtons && playerOptions.controlBar.skipButtons.forward;\n }\n buildCSSClass() {\n return `vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`;\n }\n\n /**\n * On click, skips forward in the duration/seekable range by a configurable amount of seconds.\n * If the time left in the duration/seekable range is less than the configured 'skip forward' time,\n * skips to end of duration/seekable range.\n *\n * Handle a click on a `SkipForward` button\n *\n * @param {EventTarget~Event} event\n * The `click` event that caused this function\n * to be called\n */\n handleClick(event) {\n if (isNaN(this.player_.duration())) {\n return;\n }\n const currentVideoTime = this.player_.currentTime();\n const liveTracker = this.player_.liveTracker;\n const duration = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : this.player_.duration();\n let newTime;\n if (currentVideoTime + this.skipTime <= duration) {\n newTime = currentVideoTime + this.skipTime;\n } else {\n newTime = duration;\n }\n this.player_.currentTime(newTime);\n }\n\n /**\n * Update control text on languagechange\n */\n handleLanguagechange() {\n this.controlText(this.localize('Skip forward {1} seconds', [this.skipTime]));\n }\n}\nSkipForward.prototype.controlText_ = 'Skip Forward';\nComponent$1.registerComponent('SkipForward', SkipForward);\n\n/**\n * Button to skip backward a configurable amount of time\n * through a video. Renders in the control bar.\n *\n * * e.g. options: {controlBar: {skipButtons: backward: 5}}\n *\n * @extends Button\n */\nclass SkipBackward extends Button {\n constructor(player, options) {\n super(player, options);\n this.validOptions = [5, 10, 30];\n this.skipTime = this.getSkipBackwardTime();\n if (this.skipTime && this.validOptions.includes(this.skipTime)) {\n this.setIcon(`replay-${this.skipTime}`);\n this.controlText(this.localize('Skip backward {1} seconds', [this.skipTime]));\n this.show();\n } else {\n this.hide();\n }\n }\n getSkipBackwardTime() {\n const playerOptions = this.options_.playerOptions;\n return playerOptions.controlBar && playerOptions.controlBar.skipButtons && playerOptions.controlBar.skipButtons.backward;\n }\n buildCSSClass() {\n return `vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`;\n }\n\n /**\n * On click, skips backward in the video by a configurable amount of seconds.\n * If the current time in the video is less than the configured 'skip backward' time,\n * skips to beginning of video or seekable range.\n *\n * Handle a click on a `SkipBackward` button\n *\n * @param {EventTarget~Event} event\n * The `click` event that caused this function\n * to be called\n */\n handleClick(event) {\n const currentVideoTime = this.player_.currentTime();\n const liveTracker = this.player_.liveTracker;\n const seekableStart = liveTracker && liveTracker.isLive() && liveTracker.seekableStart();\n let newTime;\n if (seekableStart && currentVideoTime - this.skipTime <= seekableStart) {\n newTime = seekableStart;\n } else if (currentVideoTime >= this.skipTime) {\n newTime = currentVideoTime - this.skipTime;\n } else {\n newTime = 0;\n }\n this.player_.currentTime(newTime);\n }\n\n /**\n * Update control text on languagechange\n */\n handleLanguagechange() {\n this.controlText(this.localize('Skip backward {1} seconds', [this.skipTime]));\n }\n}\nSkipBackward.prototype.controlText_ = 'Skip Backward';\nComponent$1.registerComponent('SkipBackward', SkipBackward);\n\n/**\n * @file menu.js\n */\n\n/**\n * The Menu component is used to build popup menus, including subtitle and\n * captions selection menus.\n *\n * @extends Component\n */\nclass Menu extends Component$1 {\n /**\n * Create an instance of this class.\n *\n * @param { import('../player').default } player\n * the player that this component should attach to\n *\n * @param {Object} [options]\n * Object of option names and values\n *\n */\n constructor(player, options) {\n super(player, options);\n if (options) {\n this.menuButton_ = options.menuButton;\n }\n this.focusedChild_ = -1;\n this.on('keydown', e => this.handleKeyDown(e));\n\n // All the menu item instances share the same blur handler provided by the menu container.\n this.boundHandleBlur_ = e => this.handleBlur(e);\n this.boundHandleTapClick_ = e => this.handleTapClick(e);\n }\n\n /**\n * Add event listeners to the {@link MenuItem}.\n *\n * @param {Object} component\n * The instance of the `MenuItem` to add listeners to.\n *\n */\n addEventListenerForItem(component) {\n if (!(component instanceof Component$1)) {\n return;\n }\n this.on(component, 'blur', this.boundHandleBlur_);\n this.on(component, ['tap', 'click'], this.boundHandleTapClick_);\n }\n\n /**\n * Remove event listeners from the {@link MenuItem}.\n *\n * @param {Object} component\n * The instance of the `MenuItem` to remove listeners.\n *\n */\n removeEventListenerForItem(component) {\n if (!(component instanceof Component$1)) {\n return;\n }\n this.off(component, 'blur', this.boundHandleBlur_);\n this.off(component, ['tap', 'click'], this.boundHandleTapClick_);\n }\n\n /**\n * This method will be called indirectly when the component has been added\n * before the component adds to the new menu instance by `addItem`.\n * In this case, the original menu instance will remove the component\n * by calling `removeChild`.\n *\n * @param {Object} component\n * The instance of the `MenuItem`\n */\n removeChild(component) {\n if (typeof component === 'string') {\n component = this.getChild(component);\n }\n this.removeEventListenerForItem(component);\n super.removeChild(component);\n }\n\n /**\n * Add a {@link MenuItem} to the menu.\n *\n * @param {Object|string} component\n * The name or instance of the `MenuItem` to add.\n *\n */\n addItem(component) {\n const childComponent = this.addChild(component);\n if (childComponent) {\n this.addEventListenerForItem(childComponent);\n }\n }\n\n /**\n * Create the `Menu`s DOM element.\n *\n * @return {Element}\n * the element that was created\n */\n createEl() {\n const contentElType = this.options_.contentElType || 'ul';\n this.contentEl_ = createEl(contentElType, {\n className: 'vjs-menu-content'\n });\n this.contentEl_.setAttribute('role', 'menu');\n const el = super.createEl('div', {\n append: this.contentEl_,\n className: 'vjs-menu'\n });\n el.appendChild(this.contentEl_);\n\n // Prevent clicks from bubbling up. Needed for Menu Buttons,\n // where a click on the parent is significant\n on(el, 'click', function (event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n });\n return el;\n }\n dispose() {\n this.contentEl_ = null;\n this.boundHandleBlur_ = null;\n this.boundHandleTapClick_ = null;\n super.dispose();\n }\n\n /**\n * Called when a `MenuItem` loses focus.\n *\n * @param {Event} event\n * The `blur` event that caused this function to be called.\n *\n * @listens blur\n */\n handleBlur(event) {\n const relatedTarget = event.relatedTarget || (global_document__WEBPACK_IMPORTED_MODULE_1___default().activeElement);\n\n // Close menu popup when a user clicks outside the menu\n if (!this.children().some(element => {\n return element.el() === relatedTarget;\n })) {\n const btn = this.menuButton_;\n if (btn && btn.buttonPressed_ && relatedTarget !== btn.el().firstChild) {\n btn.unpressButton();\n }\n }\n }\n\n /**\n * Called when a `MenuItem` gets clicked or tapped.\n *\n * @param {Event} event\n * The `click` or `tap` event that caused this function to be called.\n *\n * @listens click,tap\n */\n handleTapClick(event) {\n // Unpress the associated MenuButton, and move focus back to it\n if (this.menuButton_) {\n this.menuButton_.unpressButton();\n const childComponents = this.children();\n if (!Array.isArray(childComponents)) {\n return;\n }\n const foundComponent = childComponents.filter(component => component.el() === event.target)[0];\n if (!foundComponent) {\n return;\n }\n\n // don't focus menu button if item is a caption settings item\n // because focus will move elsewhere\n if (foundComponent.name() !== 'CaptionSettingsMenuItem') {\n this.menuButton_.focus();\n }\n }\n }\n\n /**\n * Handle a `keydown` event on this menu. This listener is added in the constructor.\n *\n * @param {KeyboardEvent} event\n * A `keydown` event that happened on the menu.\n *\n * @listens keydown\n */\n handleKeyDown(event) {\n // Left and Down Arrows\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Left') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Down')) {\n event.preventDefault();\n event.stopPropagation();\n this.stepForward();\n\n // Up and Right Arrows\n } else if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Right') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Up')) {\n event.preventDefault();\n event.stopPropagation();\n this.stepBack();\n }\n }\n\n /**\n * Move to next (lower) menu item for keyboard users.\n */\n stepForward() {\n let stepChild = 0;\n if (this.focusedChild_ !== undefined) {\n stepChild = this.focusedChild_ + 1;\n }\n this.focus(stepChild);\n }\n\n /**\n * Move to previous (higher) menu item for keyboard users.\n */\n stepBack() {\n let stepChild = 0;\n if (this.focusedChild_ !== undefined) {\n stepChild = this.focusedChild_ - 1;\n }\n this.focus(stepChild);\n }\n\n /**\n * Set focus on a {@link MenuItem} in the `Menu`.\n *\n * @param {Object|string} [item=0]\n * Index of child item set focus on.\n */\n focus(item = 0) {\n const children = this.children().slice();\n const haveTitle = children.length && children[0].hasClass('vjs-menu-title');\n if (haveTitle) {\n children.shift();\n }\n if (children.length > 0) {\n if (item < 0) {\n item = 0;\n } else if (item >= children.length) {\n item = children.length - 1;\n }\n this.focusedChild_ = item;\n children[item].el_.focus();\n }\n }\n}\nComponent$1.registerComponent('Menu', Menu);\n\n/**\n * @file menu-button.js\n */\n\n/**\n * A `MenuButton` class for any popup {@link Menu}.\n *\n * @extends Component\n */\nclass MenuButton extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n constructor(player, options = {}) {\n super(player, options);\n this.menuButton_ = new Button(player, options);\n this.menuButton_.controlText(this.controlText_);\n this.menuButton_.el_.setAttribute('aria-haspopup', 'true');\n\n // Add buildCSSClass values to the button, not the wrapper\n const buttonClass = Button.prototype.buildCSSClass();\n this.menuButton_.el_.className = this.buildCSSClass() + ' ' + buttonClass;\n this.menuButton_.removeClass('vjs-control');\n this.addChild(this.menuButton_);\n this.update();\n this.enabled_ = true;\n const handleClick = e => this.handleClick(e);\n this.handleMenuKeyUp_ = e => this.handleMenuKeyUp(e);\n this.on(this.menuButton_, 'tap', handleClick);\n this.on(this.menuButton_, 'click', handleClick);\n this.on(this.menuButton_, 'keydown', e => this.handleKeyDown(e));\n this.on(this.menuButton_, 'mouseenter', () => {\n this.addClass('vjs-hover');\n this.menu.show();\n on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keyup', this.handleMenuKeyUp_);\n });\n this.on('mouseleave', e => this.handleMouseLeave(e));\n this.on('keydown', e => this.handleSubmenuKeyDown(e));\n }\n\n /**\n * Update the menu based on the current state of its items.\n */\n update() {\n const menu = this.createMenu();\n if (this.menu) {\n this.menu.dispose();\n this.removeChild(this.menu);\n }\n this.menu = menu;\n this.addChild(menu);\n\n /**\n * Track the state of the menu button\n *\n * @type {Boolean}\n * @private\n */\n this.buttonPressed_ = false;\n this.menuButton_.el_.setAttribute('aria-expanded', 'false');\n if (this.items && this.items.length <= this.hideThreshold_) {\n this.hide();\n this.menu.contentEl_.removeAttribute('role');\n } else {\n this.show();\n this.menu.contentEl_.setAttribute('role', 'menu');\n }\n }\n\n /**\n * Create the menu and add all items to it.\n *\n * @return {Menu}\n * The constructed menu\n */\n createMenu() {\n const menu = new Menu(this.player_, {\n menuButton: this\n });\n\n /**\n * Hide the menu if the number of items is less than or equal to this threshold. This defaults\n * to 0 and whenever we add items which can be hidden to the menu we'll increment it. We list\n * it here because every time we run `createMenu` we need to reset the value.\n *\n * @protected\n * @type {Number}\n */\n this.hideThreshold_ = 0;\n\n // Add a title list item to the top\n if (this.options_.title) {\n const titleEl = createEl('li', {\n className: 'vjs-menu-title',\n textContent: toTitleCase$1(this.options_.title),\n tabIndex: -1\n });\n const titleComponent = new Component$1(this.player_, {\n el: titleEl\n });\n menu.addItem(titleComponent);\n }\n this.items = this.createItems();\n if (this.items) {\n // Add menu items to the menu\n for (let i = 0; i < this.items.length; i++) {\n menu.addItem(this.items[i]);\n }\n }\n return menu;\n }\n\n /**\n * Create the list of menu items. Specific to each subclass.\n *\n * @abstract\n */\n createItems() {}\n\n /**\n * Create the `MenuButtons`s DOM element.\n *\n * @return {Element}\n * The element that gets created.\n */\n createEl() {\n return super.createEl('div', {\n className: this.buildWrapperCSSClass()\n }, {});\n }\n\n /**\n * Overwrites the `setIcon` method from `Component`.\n * In this case, we want the icon to be appended to the menuButton.\n *\n * @param {string} name\n * The icon name to be added.\n */\n setIcon(name) {\n super.setIcon(name, this.menuButton_.el_);\n }\n\n /**\n * Allow sub components to stack CSS class names for the wrapper element\n *\n * @return {string}\n * The constructed wrapper DOM `className`\n */\n buildWrapperCSSClass() {\n let menuButtonClass = 'vjs-menu-button';\n\n // If the inline option is passed, we want to use different styles altogether.\n if (this.options_.inline === true) {\n menuButtonClass += '-inline';\n } else {\n menuButtonClass += '-popup';\n }\n\n // TODO: Fix the CSS so that this isn't necessary\n const buttonClass = Button.prototype.buildCSSClass();\n return `vjs-menu-button ${menuButtonClass} ${buttonClass} ${super.buildCSSClass()}`;\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n let menuButtonClass = 'vjs-menu-button';\n\n // If the inline option is passed, we want to use different styles altogether.\n if (this.options_.inline === true) {\n menuButtonClass += '-inline';\n } else {\n menuButtonClass += '-popup';\n }\n return `vjs-menu-button ${menuButtonClass} ${super.buildCSSClass()}`;\n }\n\n /**\n * Get or set the localized control text that will be used for accessibility.\n *\n * > NOTE: This will come from the internal `menuButton_` element.\n *\n * @param {string} [text]\n * Control text for element.\n *\n * @param {Element} [el=this.menuButton_.el()]\n * Element to set the title on.\n *\n * @return {string}\n * - The control text when getting\n */\n controlText(text, el = this.menuButton_.el()) {\n return this.menuButton_.controlText(text, el);\n }\n\n /**\n * Dispose of the `menu-button` and all child components.\n */\n dispose() {\n this.handleMouseLeave();\n super.dispose();\n }\n\n /**\n * Handle a click on a `MenuButton`.\n * See {@link ClickableComponent#handleClick} for instances where this is called.\n *\n * @param {Event} event\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n if (this.buttonPressed_) {\n this.unpressButton();\n } else {\n this.pressButton();\n }\n }\n\n /**\n * Handle `mouseleave` for `MenuButton`.\n *\n * @param {Event} event\n * The `mouseleave` event that caused this function to be called.\n *\n * @listens mouseleave\n */\n handleMouseLeave(event) {\n this.removeClass('vjs-hover');\n off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keyup', this.handleMenuKeyUp_);\n }\n\n /**\n * Set the focus to the actual button, not to this element\n */\n focus() {\n this.menuButton_.focus();\n }\n\n /**\n * Remove the focus from the actual button, not this element\n */\n blur() {\n this.menuButton_.blur();\n }\n\n /**\n * Handle tab, escape, down arrow, and up arrow keys for `MenuButton`. See\n * {@link ClickableComponent#handleKeyDown} for instances where this is called.\n *\n * @param {Event} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n handleKeyDown(event) {\n // Escape or Tab unpress the 'button'\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Esc') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Tab')) {\n if (this.buttonPressed_) {\n this.unpressButton();\n }\n\n // Don't preventDefault for Tab key - we still want to lose focus\n if (!keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Tab')) {\n event.preventDefault();\n // Set focus back to the menu button's button\n this.menuButton_.focus();\n }\n // Up Arrow or Down Arrow also 'press' the button to open the menu\n } else if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Up') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Down')) {\n if (!this.buttonPressed_) {\n event.preventDefault();\n this.pressButton();\n }\n }\n }\n\n /**\n * Handle a `keyup` event on a `MenuButton`. The listener for this is added in\n * the constructor.\n *\n * @param {Event} event\n * Key press event\n *\n * @listens keyup\n */\n handleMenuKeyUp(event) {\n // Escape hides popup menu\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Esc') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Tab')) {\n this.removeClass('vjs-hover');\n }\n }\n\n /**\n * This method name now delegates to `handleSubmenuKeyDown`. This means\n * anyone calling `handleSubmenuKeyPress` will not see their method calls\n * stop working.\n *\n * @param {Event} event\n * The event that caused this function to be called.\n */\n handleSubmenuKeyPress(event) {\n this.handleSubmenuKeyDown(event);\n }\n\n /**\n * Handle a `keydown` event on a sub-menu. The listener for this is added in\n * the constructor.\n *\n * @param {Event} event\n * Key press event\n *\n * @listens keydown\n */\n handleSubmenuKeyDown(event) {\n // Escape or Tab unpress the 'button'\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Esc') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Tab')) {\n if (this.buttonPressed_) {\n this.unpressButton();\n }\n // Don't preventDefault for Tab key - we still want to lose focus\n if (!keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Tab')) {\n event.preventDefault();\n // Set focus back to the menu button's button\n this.menuButton_.focus();\n }\n }\n }\n\n /**\n * Put the current `MenuButton` into a pressed state.\n */\n pressButton() {\n if (this.enabled_) {\n this.buttonPressed_ = true;\n this.menu.show();\n this.menu.lockShowing();\n this.menuButton_.el_.setAttribute('aria-expanded', 'true');\n\n // set the focus into the submenu, except on iOS where it is resulting in\n // undesired scrolling behavior when the player is in an iframe\n if (IS_IOS && isInFrame()) {\n // Return early so that the menu isn't focused\n return;\n }\n this.menu.focus();\n }\n }\n\n /**\n * Take the current `MenuButton` out of a pressed state.\n */\n unpressButton() {\n if (this.enabled_) {\n this.buttonPressed_ = false;\n this.menu.unlockShowing();\n this.menu.hide();\n this.menuButton_.el_.setAttribute('aria-expanded', 'false');\n }\n }\n\n /**\n * Disable the `MenuButton`. Don't allow it to be clicked.\n */\n disable() {\n this.unpressButton();\n this.enabled_ = false;\n this.addClass('vjs-disabled');\n this.menuButton_.disable();\n }\n\n /**\n * Enable the `MenuButton`. Allow it to be clicked.\n */\n enable() {\n this.enabled_ = true;\n this.removeClass('vjs-disabled');\n this.menuButton_.enable();\n }\n}\nComponent$1.registerComponent('MenuButton', MenuButton);\n\n/**\n * @file track-button.js\n */\n\n/**\n * The base class for buttons that toggle specific track types (e.g. subtitles).\n *\n * @extends MenuButton\n */\nclass TrackButton extends MenuButton {\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n const tracks = options.tracks;\n super(player, options);\n if (this.items.length <= 1) {\n this.hide();\n }\n if (!tracks) {\n return;\n }\n const updateHandler = bind_(this, this.update);\n tracks.addEventListener('removetrack', updateHandler);\n tracks.addEventListener('addtrack', updateHandler);\n tracks.addEventListener('labelchange', updateHandler);\n this.player_.on('ready', updateHandler);\n this.player_.on('dispose', function () {\n tracks.removeEventListener('removetrack', updateHandler);\n tracks.removeEventListener('addtrack', updateHandler);\n tracks.removeEventListener('labelchange', updateHandler);\n });\n }\n}\nComponent$1.registerComponent('TrackButton', TrackButton);\n\n/**\n * @file menu-keys.js\n */\n\n/**\n * All keys used for operation of a menu (`MenuButton`, `Menu`, and `MenuItem`)\n * Note that 'Enter' and 'Space' are not included here (otherwise they would\n * prevent the `MenuButton` and `MenuItem` from being keyboard-clickable)\n *\n * @typedef MenuKeys\n * @array\n */\nconst MenuKeys = ['Tab', 'Esc', 'Up', 'Down', 'Right', 'Left'];\n\n/**\n * @file menu-item.js\n */\n\n/**\n * The component for a menu item. `<li>`\n *\n * @extends ClickableComponent\n */\nclass MenuItem extends ClickableComponent {\n /**\n * Creates an instance of the this class.\n *\n * @param { import('../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n *\n */\n constructor(player, options) {\n super(player, options);\n this.selectable = options.selectable;\n this.isSelected_ = options.selected || false;\n this.multiSelectable = options.multiSelectable;\n this.selected(this.isSelected_);\n if (this.selectable) {\n if (this.multiSelectable) {\n this.el_.setAttribute('role', 'menuitemcheckbox');\n } else {\n this.el_.setAttribute('role', 'menuitemradio');\n }\n } else {\n this.el_.setAttribute('role', 'menuitem');\n }\n }\n\n /**\n * Create the `MenuItem's DOM element\n *\n * @param {string} [type=li]\n * Element's node type, not actually used, always set to `li`.\n *\n * @param {Object} [props={}]\n * An object of properties that should be set on the element\n *\n * @param {Object} [attrs={}]\n * An object of attributes that should be set on the element\n *\n * @return {Element}\n * The element that gets created.\n */\n createEl(type, props, attrs) {\n // The control is textual, not just an icon\n this.nonIconControl = true;\n const el = super.createEl('li', Object.assign({\n className: 'vjs-menu-item',\n tabIndex: -1\n }, props), attrs);\n\n // swap icon with menu item text.\n const menuItemEl = createEl('span', {\n className: 'vjs-menu-item-text',\n textContent: this.localize(this.options_.label)\n });\n\n // If using SVG icons, the element with vjs-icon-placeholder will be added separately.\n if (this.player_.options_.experimentalSvgIcons) {\n el.appendChild(menuItemEl);\n } else {\n el.replaceChild(menuItemEl, el.querySelector('.vjs-icon-placeholder'));\n }\n return el;\n }\n\n /**\n * Ignore keys which are used by the menu, but pass any other ones up. See\n * {@link ClickableComponent#handleKeyDown} for instances where this is called.\n *\n * @param {KeyboardEvent} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n handleKeyDown(event) {\n if (!MenuKeys.some(key => keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, key))) {\n // Pass keydown handling up for unused keys\n super.handleKeyDown(event);\n }\n }\n\n /**\n * Any click on a `MenuItem` puts it into the selected state.\n * See {@link ClickableComponent#handleClick} for instances where this is called.\n *\n * @param {Event} event\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n this.selected(true);\n }\n\n /**\n * Set the state for this menu item as selected or not.\n *\n * @param {boolean} selected\n * if the menu item is selected or not\n */\n selected(selected) {\n if (this.selectable) {\n if (selected) {\n this.addClass('vjs-selected');\n this.el_.setAttribute('aria-checked', 'true');\n // aria-checked isn't fully supported by browsers/screen readers,\n // so indicate selected state to screen reader in the control text.\n this.controlText(', selected');\n this.isSelected_ = true;\n } else {\n this.removeClass('vjs-selected');\n this.el_.setAttribute('aria-checked', 'false');\n // Indicate un-selected state to screen reader\n this.controlText('');\n this.isSelected_ = false;\n }\n }\n }\n}\nComponent$1.registerComponent('MenuItem', MenuItem);\n\n/**\n * @file text-track-menu-item.js\n */\n\n/**\n * The specific menu item type for selecting a language within a text track kind\n *\n * @extends MenuItem\n */\nclass TextTrackMenuItem extends MenuItem {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n const track = options.track;\n const tracks = player.textTracks();\n\n // Modify options for parent MenuItem class's init.\n options.label = track.label || track.language || 'Unknown';\n options.selected = track.mode === 'showing';\n super(player, options);\n this.track = track;\n // Determine the relevant kind(s) of tracks for this component and filter\n // out empty kinds.\n this.kinds = (options.kinds || [options.kind || this.track.kind]).filter(Boolean);\n const changeHandler = (...args) => {\n this.handleTracksChange.apply(this, args);\n };\n const selectedLanguageChangeHandler = (...args) => {\n this.handleSelectedLanguageChange.apply(this, args);\n };\n player.on(['loadstart', 'texttrackchange'], changeHandler);\n tracks.addEventListener('change', changeHandler);\n tracks.addEventListener('selectedlanguagechange', selectedLanguageChangeHandler);\n this.on('dispose', function () {\n player.off(['loadstart', 'texttrackchange'], changeHandler);\n tracks.removeEventListener('change', changeHandler);\n tracks.removeEventListener('selectedlanguagechange', selectedLanguageChangeHandler);\n });\n\n // iOS7 doesn't dispatch change events to TextTrackLists when an\n // associated track's mode changes. Without something like\n // Object.observe() (also not present on iOS7), it's not\n // possible to detect changes to the mode attribute and polyfill\n // the change event. As a poor substitute, we manually dispatch\n // change events whenever the controls modify the mode.\n if (tracks.onchange === undefined) {\n let event;\n this.on(['tap', 'click'], function () {\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().Event) !== 'object') {\n // Android 2.3 throws an Illegal Constructor error for window.Event\n try {\n event = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().Event)('change');\n } catch (err) {\n // continue regardless of error\n }\n }\n if (!event) {\n event = global_document__WEBPACK_IMPORTED_MODULE_1___default().createEvent('Event');\n event.initEvent('change', true, true);\n }\n tracks.dispatchEvent(event);\n });\n }\n\n // set the default state based on current tracks\n this.handleTracksChange();\n }\n\n /**\n * This gets called when an `TextTrackMenuItem` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {Event} event\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n const referenceTrack = this.track;\n const tracks = this.player_.textTracks();\n super.handleClick(event);\n if (!tracks) {\n return;\n }\n for (let i = 0; i < tracks.length; i++) {\n const track = tracks[i];\n\n // If the track from the text tracks list is not of the right kind,\n // skip it. We do not want to affect tracks of incompatible kind(s).\n if (this.kinds.indexOf(track.kind) === -1) {\n continue;\n }\n\n // If this text track is the component's track and it is not showing,\n // set it to showing.\n if (track === referenceTrack) {\n if (track.mode !== 'showing') {\n track.mode = 'showing';\n }\n\n // If this text track is not the component's track and it is not\n // disabled, set it to disabled.\n } else if (track.mode !== 'disabled') {\n track.mode = 'disabled';\n }\n }\n }\n\n /**\n * Handle text track list change\n *\n * @param {Event} event\n * The `change` event that caused this function to be called.\n *\n * @listens TextTrackList#change\n */\n handleTracksChange(event) {\n const shouldBeSelected = this.track.mode === 'showing';\n\n // Prevent redundant selected() calls because they may cause\n // screen readers to read the appended control text unnecessarily\n if (shouldBeSelected !== this.isSelected_) {\n this.selected(shouldBeSelected);\n }\n }\n handleSelectedLanguageChange(event) {\n if (this.track.mode === 'showing') {\n const selectedLanguage = this.player_.cache_.selectedLanguage;\n\n // Don't replace the kind of track across the same language\n if (selectedLanguage && selectedLanguage.enabled && selectedLanguage.language === this.track.language && selectedLanguage.kind !== this.track.kind) {\n return;\n }\n this.player_.cache_.selectedLanguage = {\n enabled: true,\n language: this.track.language,\n kind: this.track.kind\n };\n }\n }\n dispose() {\n // remove reference to track object on dispose\n this.track = null;\n super.dispose();\n }\n}\nComponent$1.registerComponent('TextTrackMenuItem', TextTrackMenuItem);\n\n/**\n * @file off-text-track-menu-item.js\n */\n\n/**\n * A special menu item for turning off a specific type of text track\n *\n * @extends TextTrackMenuItem\n */\nclass OffTextTrackMenuItem extends TextTrackMenuItem {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n // Create pseudo track info\n // Requires options['kind']\n options.track = {\n player,\n // it is no longer necessary to store `kind` or `kinds` on the track itself\n // since they are now stored in the `kinds` property of all instances of\n // TextTrackMenuItem, but this will remain for backwards compatibility\n kind: options.kind,\n kinds: options.kinds,\n default: false,\n mode: 'disabled'\n };\n if (!options.kinds) {\n options.kinds = [options.kind];\n }\n if (options.label) {\n options.track.label = options.label;\n } else {\n options.track.label = options.kinds.join(' and ') + ' off';\n }\n\n // MenuItem is selectable\n options.selectable = true;\n // MenuItem is NOT multiSelectable (i.e. only one can be marked \"selected\" at a time)\n options.multiSelectable = false;\n super(player, options);\n }\n\n /**\n * Handle text track change\n *\n * @param {Event} event\n * The event that caused this function to run\n */\n handleTracksChange(event) {\n const tracks = this.player().textTracks();\n let shouldBeSelected = true;\n for (let i = 0, l = tracks.length; i < l; i++) {\n const track = tracks[i];\n if (this.options_.kinds.indexOf(track.kind) > -1 && track.mode === 'showing') {\n shouldBeSelected = false;\n break;\n }\n }\n\n // Prevent redundant selected() calls because they may cause\n // screen readers to read the appended control text unnecessarily\n if (shouldBeSelected !== this.isSelected_) {\n this.selected(shouldBeSelected);\n }\n }\n handleSelectedLanguageChange(event) {\n const tracks = this.player().textTracks();\n let allHidden = true;\n for (let i = 0, l = tracks.length; i < l; i++) {\n const track = tracks[i];\n if (['captions', 'descriptions', 'subtitles'].indexOf(track.kind) > -1 && track.mode === 'showing') {\n allHidden = false;\n break;\n }\n }\n if (allHidden) {\n this.player_.cache_.selectedLanguage = {\n enabled: false\n };\n }\n }\n\n /**\n * Update control text and label on languagechange\n */\n handleLanguagechange() {\n this.$('.vjs-menu-item-text').textContent = this.player_.localize(this.options_.label);\n super.handleLanguagechange();\n }\n}\nComponent$1.registerComponent('OffTextTrackMenuItem', OffTextTrackMenuItem);\n\n/**\n * @file text-track-button.js\n */\n\n/**\n * The base class for buttons that toggle specific text track types (e.g. subtitles)\n *\n * @extends MenuButton\n */\nclass TextTrackButton extends TrackButton {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n constructor(player, options = {}) {\n options.tracks = player.textTracks();\n super(player, options);\n }\n\n /**\n * Create a menu item for each text track\n *\n * @param {TextTrackMenuItem[]} [items=[]]\n * Existing array of items to use during creation\n *\n * @return {TextTrackMenuItem[]}\n * Array of menu items that were created\n */\n createItems(items = [], TrackMenuItem = TextTrackMenuItem) {\n // Label is an override for the [track] off label\n // USed to localise captions/subtitles\n let label;\n if (this.label_) {\n label = `${this.label_} off`;\n }\n // Add an OFF menu item to turn all tracks off\n items.push(new OffTextTrackMenuItem(this.player_, {\n kinds: this.kinds_,\n kind: this.kind_,\n label\n }));\n this.hideThreshold_ += 1;\n const tracks = this.player_.textTracks();\n if (!Array.isArray(this.kinds_)) {\n this.kinds_ = [this.kind_];\n }\n for (let i = 0; i < tracks.length; i++) {\n const track = tracks[i];\n\n // only add tracks that are of an appropriate kind and have a label\n if (this.kinds_.indexOf(track.kind) > -1) {\n const item = new TrackMenuItem(this.player_, {\n track,\n kinds: this.kinds_,\n kind: this.kind_,\n // MenuItem is selectable\n selectable: true,\n // MenuItem is NOT multiSelectable (i.e. only one can be marked \"selected\" at a time)\n multiSelectable: false\n });\n item.addClass(`vjs-${track.kind}-menu-item`);\n items.push(item);\n }\n }\n return items;\n }\n}\nComponent$1.registerComponent('TextTrackButton', TextTrackButton);\n\n/**\n * @file chapters-track-menu-item.js\n */\n\n/**\n * The chapter track menu item\n *\n * @extends MenuItem\n */\nclass ChaptersTrackMenuItem extends MenuItem {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n const track = options.track;\n const cue = options.cue;\n const currentTime = player.currentTime();\n\n // Modify options for parent MenuItem class's init.\n options.selectable = true;\n options.multiSelectable = false;\n options.label = cue.text;\n options.selected = cue.startTime <= currentTime && currentTime < cue.endTime;\n super(player, options);\n this.track = track;\n this.cue = cue;\n }\n\n /**\n * This gets called when an `ChaptersTrackMenuItem` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n super.handleClick();\n this.player_.currentTime(this.cue.startTime);\n }\n}\nComponent$1.registerComponent('ChaptersTrackMenuItem', ChaptersTrackMenuItem);\n\n/**\n * @file chapters-button.js\n */\n\n/**\n * The button component for toggling and selecting chapters\n * Chapters act much differently than other text tracks\n * Cues are navigation vs. other tracks of alternative languages\n *\n * @extends TextTrackButton\n */\nclass ChaptersButton extends TextTrackButton {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Function} [ready]\n * The function to call when this function is ready.\n */\n constructor(player, options, ready) {\n super(player, options, ready);\n this.setIcon('chapters');\n this.selectCurrentItem_ = () => {\n this.items.forEach(item => {\n item.selected(this.track_.activeCues[0] === item.cue);\n });\n };\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-chapters-button ${super.buildCSSClass()}`;\n }\n buildWrapperCSSClass() {\n return `vjs-chapters-button ${super.buildWrapperCSSClass()}`;\n }\n\n /**\n * Update the menu based on the current state of its items.\n *\n * @param {Event} [event]\n * An event that triggered this function to run.\n *\n * @listens TextTrackList#addtrack\n * @listens TextTrackList#removetrack\n * @listens TextTrackList#change\n */\n update(event) {\n if (event && event.track && event.track.kind !== 'chapters') {\n return;\n }\n const track = this.findChaptersTrack();\n if (track !== this.track_) {\n this.setTrack(track);\n super.update();\n } else if (!this.items || track && track.cues && track.cues.length !== this.items.length) {\n // Update the menu initially or if the number of cues has changed since set\n super.update();\n }\n }\n\n /**\n * Set the currently selected track for the chapters button.\n *\n * @param {TextTrack} track\n * The new track to select. Nothing will change if this is the currently selected\n * track.\n */\n setTrack(track) {\n if (this.track_ === track) {\n return;\n }\n if (!this.updateHandler_) {\n this.updateHandler_ = this.update.bind(this);\n }\n\n // here this.track_ refers to the old track instance\n if (this.track_) {\n const remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);\n if (remoteTextTrackEl) {\n remoteTextTrackEl.removeEventListener('load', this.updateHandler_);\n }\n this.track_.removeEventListener('cuechange', this.selectCurrentItem_);\n this.track_ = null;\n }\n this.track_ = track;\n\n // here this.track_ refers to the new track instance\n if (this.track_) {\n this.track_.mode = 'hidden';\n const remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);\n if (remoteTextTrackEl) {\n remoteTextTrackEl.addEventListener('load', this.updateHandler_);\n }\n this.track_.addEventListener('cuechange', this.selectCurrentItem_);\n }\n }\n\n /**\n * Find the track object that is currently in use by this ChaptersButton\n *\n * @return {TextTrack|undefined}\n * The current track or undefined if none was found.\n */\n findChaptersTrack() {\n const tracks = this.player_.textTracks() || [];\n for (let i = tracks.length - 1; i >= 0; i--) {\n // We will always choose the last track as our chaptersTrack\n const track = tracks[i];\n if (track.kind === this.kind_) {\n return track;\n }\n }\n }\n\n /**\n * Get the caption for the ChaptersButton based on the track label. This will also\n * use the current tracks localized kind as a fallback if a label does not exist.\n *\n * @return {string}\n * The tracks current label or the localized track kind.\n */\n getMenuCaption() {\n if (this.track_ && this.track_.label) {\n return this.track_.label;\n }\n return this.localize(toTitleCase$1(this.kind_));\n }\n\n /**\n * Create menu from chapter track\n *\n * @return { import('../../menu/menu').default }\n * New menu for the chapter buttons\n */\n createMenu() {\n this.options_.title = this.getMenuCaption();\n return super.createMenu();\n }\n\n /**\n * Create a menu item for each text track\n *\n * @return { import('./text-track-menu-item').default[] }\n * Array of menu items\n */\n createItems() {\n const items = [];\n if (!this.track_) {\n return items;\n }\n const cues = this.track_.cues;\n if (!cues) {\n return items;\n }\n for (let i = 0, l = cues.length; i < l; i++) {\n const cue = cues[i];\n const mi = new ChaptersTrackMenuItem(this.player_, {\n track: this.track_,\n cue\n });\n items.push(mi);\n }\n return items;\n }\n}\n\n/**\n * `kind` of TextTrack to look for to associate it with this menu.\n *\n * @type {string}\n * @private\n */\nChaptersButton.prototype.kind_ = 'chapters';\n\n/**\n * The text that should display over the `ChaptersButton`s controls. Added for localization.\n *\n * @type {string}\n * @protected\n */\nChaptersButton.prototype.controlText_ = 'Chapters';\nComponent$1.registerComponent('ChaptersButton', ChaptersButton);\n\n/**\n * @file descriptions-button.js\n */\n\n/**\n * The button component for toggling and selecting descriptions\n *\n * @extends TextTrackButton\n */\nclass DescriptionsButton extends TextTrackButton {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Function} [ready]\n * The function to call when this component is ready.\n */\n constructor(player, options, ready) {\n super(player, options, ready);\n this.setIcon('audio-description');\n const tracks = player.textTracks();\n const changeHandler = bind_(this, this.handleTracksChange);\n tracks.addEventListener('change', changeHandler);\n this.on('dispose', function () {\n tracks.removeEventListener('change', changeHandler);\n });\n }\n\n /**\n * Handle text track change\n *\n * @param {Event} event\n * The event that caused this function to run\n *\n * @listens TextTrackList#change\n */\n handleTracksChange(event) {\n const tracks = this.player().textTracks();\n let disabled = false;\n\n // Check whether a track of a different kind is showing\n for (let i = 0, l = tracks.length; i < l; i++) {\n const track = tracks[i];\n if (track.kind !== this.kind_ && track.mode === 'showing') {\n disabled = true;\n break;\n }\n }\n\n // If another track is showing, disable this menu button\n if (disabled) {\n this.disable();\n } else {\n this.enable();\n }\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-descriptions-button ${super.buildCSSClass()}`;\n }\n buildWrapperCSSClass() {\n return `vjs-descriptions-button ${super.buildWrapperCSSClass()}`;\n }\n}\n\n/**\n * `kind` of TextTrack to look for to associate it with this menu.\n *\n * @type {string}\n * @private\n */\nDescriptionsButton.prototype.kind_ = 'descriptions';\n\n/**\n * The text that should display over the `DescriptionsButton`s controls. Added for localization.\n *\n * @type {string}\n * @protected\n */\nDescriptionsButton.prototype.controlText_ = 'Descriptions';\nComponent$1.registerComponent('DescriptionsButton', DescriptionsButton);\n\n/**\n * @file subtitles-button.js\n */\n\n/**\n * The button component for toggling and selecting subtitles\n *\n * @extends TextTrackButton\n */\nclass SubtitlesButton extends TextTrackButton {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Function} [ready]\n * The function to call when this component is ready.\n */\n constructor(player, options, ready) {\n super(player, options, ready);\n this.setIcon('subtitles');\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-subtitles-button ${super.buildCSSClass()}`;\n }\n buildWrapperCSSClass() {\n return `vjs-subtitles-button ${super.buildWrapperCSSClass()}`;\n }\n}\n\n/**\n * `kind` of TextTrack to look for to associate it with this menu.\n *\n * @type {string}\n * @private\n */\nSubtitlesButton.prototype.kind_ = 'subtitles';\n\n/**\n * The text that should display over the `SubtitlesButton`s controls. Added for localization.\n *\n * @type {string}\n * @protected\n */\nSubtitlesButton.prototype.controlText_ = 'Subtitles';\nComponent$1.registerComponent('SubtitlesButton', SubtitlesButton);\n\n/**\n * @file caption-settings-menu-item.js\n */\n\n/**\n * The menu item for caption track settings menu\n *\n * @extends TextTrackMenuItem\n */\nclass CaptionSettingsMenuItem extends TextTrackMenuItem {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n options.track = {\n player,\n kind: options.kind,\n label: options.kind + ' settings',\n selectable: false,\n default: false,\n mode: 'disabled'\n };\n\n // CaptionSettingsMenuItem has no concept of 'selected'\n options.selectable = false;\n options.name = 'CaptionSettingsMenuItem';\n super(player, options);\n this.addClass('vjs-texttrack-settings');\n this.controlText(', opens ' + options.kind + ' settings dialog');\n }\n\n /**\n * This gets called when an `CaptionSettingsMenuItem` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n this.player().getChild('textTrackSettings').open();\n }\n\n /**\n * Update control text and label on languagechange\n */\n handleLanguagechange() {\n this.$('.vjs-menu-item-text').textContent = this.player_.localize(this.options_.kind + ' settings');\n super.handleLanguagechange();\n }\n}\nComponent$1.registerComponent('CaptionSettingsMenuItem', CaptionSettingsMenuItem);\n\n/**\n * @file captions-button.js\n */\n\n/**\n * The button component for toggling and selecting captions\n *\n * @extends TextTrackButton\n */\nclass CaptionsButton extends TextTrackButton {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Function} [ready]\n * The function to call when this component is ready.\n */\n constructor(player, options, ready) {\n super(player, options, ready);\n this.setIcon('captions');\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-captions-button ${super.buildCSSClass()}`;\n }\n buildWrapperCSSClass() {\n return `vjs-captions-button ${super.buildWrapperCSSClass()}`;\n }\n\n /**\n * Create caption menu items\n *\n * @return {CaptionSettingsMenuItem[]}\n * The array of current menu items.\n */\n createItems() {\n const items = [];\n if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild('textTrackSettings')) {\n items.push(new CaptionSettingsMenuItem(this.player_, {\n kind: this.kind_\n }));\n this.hideThreshold_ += 1;\n }\n return super.createItems(items);\n }\n}\n\n/**\n * `kind` of TextTrack to look for to associate it with this menu.\n *\n * @type {string}\n * @private\n */\nCaptionsButton.prototype.kind_ = 'captions';\n\n/**\n * The text that should display over the `CaptionsButton`s controls. Added for localization.\n *\n * @type {string}\n * @protected\n */\nCaptionsButton.prototype.controlText_ = 'Captions';\nComponent$1.registerComponent('CaptionsButton', CaptionsButton);\n\n/**\n * @file subs-caps-menu-item.js\n */\n\n/**\n * SubsCapsMenuItem has an [cc] icon to distinguish captions from subtitles\n * in the SubsCapsMenu.\n *\n * @extends TextTrackMenuItem\n */\nclass SubsCapsMenuItem extends TextTrackMenuItem {\n createEl(type, props, attrs) {\n const el = super.createEl(type, props, attrs);\n const parentSpan = el.querySelector('.vjs-menu-item-text');\n if (this.options_.track.kind === 'captions') {\n if (this.player_.options_.experimentalSvgIcons) {\n this.setIcon('captions', el);\n } else {\n parentSpan.appendChild(createEl('span', {\n className: 'vjs-icon-placeholder'\n }, {\n 'aria-hidden': true\n }));\n }\n parentSpan.appendChild(createEl('span', {\n className: 'vjs-control-text',\n // space added as the text will visually flow with the\n // label\n textContent: ` ${this.localize('Captions')}`\n }));\n }\n return el;\n }\n}\nComponent$1.registerComponent('SubsCapsMenuItem', SubsCapsMenuItem);\n\n/**\n * @file sub-caps-button.js\n */\n\n/**\n * The button component for toggling and selecting captions and/or subtitles\n *\n * @extends TextTrackButton\n */\nclass SubsCapsButton extends TextTrackButton {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Function} [ready]\n * The function to call when this component is ready.\n */\n constructor(player, options = {}) {\n super(player, options);\n\n // Although North America uses \"captions\" in most cases for\n // \"captions and subtitles\" other locales use \"subtitles\"\n this.label_ = 'subtitles';\n this.setIcon('subtitles');\n if (['en', 'en-us', 'en-ca', 'fr-ca'].indexOf(this.player_.language_) > -1) {\n this.label_ = 'captions';\n this.setIcon('captions');\n }\n this.menuButton_.controlText(toTitleCase$1(this.label_));\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-subs-caps-button ${super.buildCSSClass()}`;\n }\n buildWrapperCSSClass() {\n return `vjs-subs-caps-button ${super.buildWrapperCSSClass()}`;\n }\n\n /**\n * Create caption/subtitles menu items\n *\n * @return {CaptionSettingsMenuItem[]}\n * The array of current menu items.\n */\n createItems() {\n let items = [];\n if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild('textTrackSettings')) {\n items.push(new CaptionSettingsMenuItem(this.player_, {\n kind: this.label_\n }));\n this.hideThreshold_ += 1;\n }\n items = super.createItems(items, SubsCapsMenuItem);\n return items;\n }\n}\n\n/**\n * `kind`s of TextTrack to look for to associate it with this menu.\n *\n * @type {array}\n * @private\n */\nSubsCapsButton.prototype.kinds_ = ['captions', 'subtitles'];\n\n/**\n * The text that should display over the `SubsCapsButton`s controls.\n *\n *\n * @type {string}\n * @protected\n */\nSubsCapsButton.prototype.controlText_ = 'Subtitles';\nComponent$1.registerComponent('SubsCapsButton', SubsCapsButton);\n\n/**\n * @file audio-track-menu-item.js\n */\n\n/**\n * An {@link AudioTrack} {@link MenuItem}\n *\n * @extends MenuItem\n */\nclass AudioTrackMenuItem extends MenuItem {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n const track = options.track;\n const tracks = player.audioTracks();\n\n // Modify options for parent MenuItem class's init.\n options.label = track.label || track.language || 'Unknown';\n options.selected = track.enabled;\n super(player, options);\n this.track = track;\n this.addClass(`vjs-${track.kind}-menu-item`);\n const changeHandler = (...args) => {\n this.handleTracksChange.apply(this, args);\n };\n tracks.addEventListener('change', changeHandler);\n this.on('dispose', () => {\n tracks.removeEventListener('change', changeHandler);\n });\n }\n createEl(type, props, attrs) {\n const el = super.createEl(type, props, attrs);\n const parentSpan = el.querySelector('.vjs-menu-item-text');\n if (['main-desc', 'description'].indexOf(this.options_.track.kind) >= 0) {\n parentSpan.appendChild(createEl('span', {\n className: 'vjs-icon-placeholder'\n }, {\n 'aria-hidden': true\n }));\n parentSpan.appendChild(createEl('span', {\n className: 'vjs-control-text',\n textContent: ' ' + this.localize('Descriptions')\n }));\n }\n return el;\n }\n\n /**\n * This gets called when an `AudioTrackMenuItem is \"clicked\". See {@link ClickableComponent}\n * for more detailed information on what a click can be.\n *\n * @param {Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n super.handleClick(event);\n\n // the audio track list will automatically toggle other tracks\n // off for us.\n this.track.enabled = true;\n\n // when native audio tracks are used, we want to make sure that other tracks are turned off\n if (this.player_.tech_.featuresNativeAudioTracks) {\n const tracks = this.player_.audioTracks();\n for (let i = 0; i < tracks.length; i++) {\n const track = tracks[i];\n\n // skip the current track since we enabled it above\n if (track === this.track) {\n continue;\n }\n track.enabled = track === this.track;\n }\n }\n }\n\n /**\n * Handle any {@link AudioTrack} change.\n *\n * @param {Event} [event]\n * The {@link AudioTrackList#change} event that caused this to run.\n *\n * @listens AudioTrackList#change\n */\n handleTracksChange(event) {\n this.selected(this.track.enabled);\n }\n}\nComponent$1.registerComponent('AudioTrackMenuItem', AudioTrackMenuItem);\n\n/**\n * @file audio-track-button.js\n */\n\n/**\n * The base class for buttons that toggle specific {@link AudioTrack} types.\n *\n * @extends TrackButton\n */\nclass AudioTrackButton extends TrackButton {\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n constructor(player, options = {}) {\n options.tracks = player.audioTracks();\n super(player, options);\n this.setIcon('audio');\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-audio-button ${super.buildCSSClass()}`;\n }\n buildWrapperCSSClass() {\n return `vjs-audio-button ${super.buildWrapperCSSClass()}`;\n }\n\n /**\n * Create a menu item for each audio track\n *\n * @param {AudioTrackMenuItem[]} [items=[]]\n * An array of existing menu items to use.\n *\n * @return {AudioTrackMenuItem[]}\n * An array of menu items\n */\n createItems(items = []) {\n // if there's only one audio track, there no point in showing it\n this.hideThreshold_ = 1;\n const tracks = this.player_.audioTracks();\n for (let i = 0; i < tracks.length; i++) {\n const track = tracks[i];\n items.push(new AudioTrackMenuItem(this.player_, {\n track,\n // MenuItem is selectable\n selectable: true,\n // MenuItem is NOT multiSelectable (i.e. only one can be marked \"selected\" at a time)\n multiSelectable: false\n }));\n }\n return items;\n }\n}\n\n/**\n * The text that should display over the `AudioTrackButton`s controls. Added for localization.\n *\n * @type {string}\n * @protected\n */\nAudioTrackButton.prototype.controlText_ = 'Audio Track';\nComponent$1.registerComponent('AudioTrackButton', AudioTrackButton);\n\n/**\n * @file playback-rate-menu-item.js\n */\n\n/**\n * The specific menu item type for selecting a playback rate.\n *\n * @extends MenuItem\n */\nclass PlaybackRateMenuItem extends MenuItem {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n const label = options.rate;\n const rate = parseFloat(label, 10);\n\n // Modify options for parent MenuItem class's init.\n options.label = label;\n options.selected = rate === player.playbackRate();\n options.selectable = true;\n options.multiSelectable = false;\n super(player, options);\n this.label = label;\n this.rate = rate;\n this.on(player, 'ratechange', e => this.update(e));\n }\n\n /**\n * This gets called when an `PlaybackRateMenuItem` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n handleClick(event) {\n super.handleClick();\n this.player().playbackRate(this.rate);\n }\n\n /**\n * Update the PlaybackRateMenuItem when the playbackrate changes.\n *\n * @param {Event} [event]\n * The `ratechange` event that caused this function to run.\n *\n * @listens Player#ratechange\n */\n update(event) {\n this.selected(this.player().playbackRate() === this.rate);\n }\n}\n\n/**\n * The text that should display over the `PlaybackRateMenuItem`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\nPlaybackRateMenuItem.prototype.contentElType = 'button';\nComponent$1.registerComponent('PlaybackRateMenuItem', PlaybackRateMenuItem);\n\n/**\n * @file playback-rate-menu-button.js\n */\n\n/**\n * The component for controlling the playback rate.\n *\n * @extends MenuButton\n */\nclass PlaybackRateMenuButton extends MenuButton {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.menuButton_.el_.setAttribute('aria-describedby', this.labelElId_);\n this.updateVisibility();\n this.updateLabel();\n this.on(player, 'loadstart', e => this.updateVisibility(e));\n this.on(player, 'ratechange', e => this.updateLabel(e));\n this.on(player, 'playbackrateschange', e => this.handlePlaybackRateschange(e));\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n const el = super.createEl();\n this.labelElId_ = 'vjs-playback-rate-value-label-' + this.id_;\n this.labelEl_ = createEl('div', {\n className: 'vjs-playback-rate-value',\n id: this.labelElId_,\n textContent: '1x'\n });\n el.appendChild(this.labelEl_);\n return el;\n }\n dispose() {\n this.labelEl_ = null;\n super.dispose();\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-playback-rate ${super.buildCSSClass()}`;\n }\n buildWrapperCSSClass() {\n return `vjs-playback-rate ${super.buildWrapperCSSClass()}`;\n }\n\n /**\n * Create the list of menu items. Specific to each subclass.\n *\n */\n createItems() {\n const rates = this.playbackRates();\n const items = [];\n for (let i = rates.length - 1; i >= 0; i--) {\n items.push(new PlaybackRateMenuItem(this.player(), {\n rate: rates[i] + 'x'\n }));\n }\n return items;\n }\n\n /**\n * On playbackrateschange, update the menu to account for the new items.\n *\n * @listens Player#playbackrateschange\n */\n handlePlaybackRateschange(event) {\n this.update();\n }\n\n /**\n * Get possible playback rates\n *\n * @return {Array}\n * All possible playback rates\n */\n playbackRates() {\n const player = this.player();\n return player.playbackRates && player.playbackRates() || [];\n }\n\n /**\n * Get whether playback rates is supported by the tech\n * and an array of playback rates exists\n *\n * @return {boolean}\n * Whether changing playback rate is supported\n */\n playbackRateSupported() {\n return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0;\n }\n\n /**\n * Hide playback rate controls when they're no playback rate options to select\n *\n * @param {Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#loadstart\n */\n updateVisibility(event) {\n if (this.playbackRateSupported()) {\n this.removeClass('vjs-hidden');\n } else {\n this.addClass('vjs-hidden');\n }\n }\n\n /**\n * Update button label when rate changed\n *\n * @param {Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#ratechange\n */\n updateLabel(event) {\n if (this.playbackRateSupported()) {\n this.labelEl_.textContent = this.player().playbackRate() + 'x';\n }\n }\n}\n\n/**\n * The text that should display over the `PlaybackRateMenuButton`s controls.\n *\n * Added for localization.\n *\n * @type {string}\n * @protected\n */\nPlaybackRateMenuButton.prototype.controlText_ = 'Playback Rate';\nComponent$1.registerComponent('PlaybackRateMenuButton', PlaybackRateMenuButton);\n\n/**\n * @file spacer.js\n */\n\n/**\n * Just an empty spacer element that can be used as an append point for plugins, etc.\n * Also can be used to create space between elements when necessary.\n *\n * @extends Component\n */\nclass Spacer extends Component$1 {\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-spacer ${super.buildCSSClass()}`;\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl(tag = 'div', props = {}, attributes = {}) {\n if (!props.className) {\n props.className = this.buildCSSClass();\n }\n return super.createEl(tag, props, attributes);\n }\n}\nComponent$1.registerComponent('Spacer', Spacer);\n\n/**\n * @file custom-control-spacer.js\n */\n\n/**\n * Spacer specifically meant to be used as an insertion point for new plugins, etc.\n *\n * @extends Spacer\n */\nclass CustomControlSpacer extends Spacer {\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n buildCSSClass() {\n return `vjs-custom-control-spacer ${super.buildCSSClass()}`;\n }\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n return super.createEl('div', {\n className: this.buildCSSClass(),\n // No-flex/table-cell mode requires there be some content\n // in the cell to fill the remaining space of the table.\n textContent: '\\u00a0'\n });\n }\n}\nComponent$1.registerComponent('CustomControlSpacer', CustomControlSpacer);\n\n/**\n * @file control-bar.js\n */\n\n/**\n * Container of main controls.\n *\n * @extends Component\n */\nclass ControlBar extends Component$1 {\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n return super.createEl('div', {\n className: 'vjs-control-bar',\n dir: 'ltr'\n });\n }\n}\n\n/**\n * Default options for `ControlBar`\n *\n * @type {Object}\n * @private\n */\nControlBar.prototype.options_ = {\n children: ['playToggle', 'skipBackward', 'skipForward', 'volumePanel', 'currentTimeDisplay', 'timeDivider', 'durationDisplay', 'progressControl', 'liveDisplay', 'seekToLive', 'remainingTimeDisplay', 'customControlSpacer', 'playbackRateMenuButton', 'chaptersButton', 'descriptionsButton', 'subsCapsButton', 'audioTrackButton', 'pictureInPictureToggle', 'fullscreenToggle']\n};\nComponent$1.registerComponent('ControlBar', ControlBar);\n\n/**\n * @file error-display.js\n */\n\n/**\n * A display that indicates an error has occurred. This means that the video\n * is unplayable.\n *\n * @extends ModalDialog\n */\nclass ErrorDisplay extends ModalDialog {\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n super(player, options);\n this.on(player, 'error', e => {\n this.close();\n this.open(e);\n });\n }\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n *\n * @deprecated Since version 5.\n */\n buildCSSClass() {\n return `vjs-error-display ${super.buildCSSClass()}`;\n }\n\n /**\n * Gets the localized error message based on the `Player`s error.\n *\n * @return {string}\n * The `Player`s error message localized or an empty string.\n */\n content() {\n const error = this.player().error();\n return error ? this.localize(error.message) : '';\n }\n}\n\n/**\n * The default options for an `ErrorDisplay`.\n *\n * @private\n */\nErrorDisplay.prototype.options_ = Object.assign({}, ModalDialog.prototype.options_, {\n pauseOnOpen: false,\n fillAlways: true,\n temporary: false,\n uncloseable: true\n});\nComponent$1.registerComponent('ErrorDisplay', ErrorDisplay);\n\n/**\n * @file text-track-settings.js\n */\nconst LOCAL_STORAGE_KEY$1 = 'vjs-text-track-settings';\nconst COLOR_BLACK = ['#000', 'Black'];\nconst COLOR_BLUE = ['#00F', 'Blue'];\nconst COLOR_CYAN = ['#0FF', 'Cyan'];\nconst COLOR_GREEN = ['#0F0', 'Green'];\nconst COLOR_MAGENTA = ['#F0F', 'Magenta'];\nconst COLOR_RED = ['#F00', 'Red'];\nconst COLOR_WHITE = ['#FFF', 'White'];\nconst COLOR_YELLOW = ['#FF0', 'Yellow'];\nconst OPACITY_OPAQUE = ['1', 'Opaque'];\nconst OPACITY_SEMI = ['0.5', 'Semi-Transparent'];\nconst OPACITY_TRANS = ['0', 'Transparent'];\n\n// Configuration for the various <select> elements in the DOM of this component.\n//\n// Possible keys include:\n//\n// `default`:\n// The default option index. Only needs to be provided if not zero.\n// `parser`:\n// A function which is used to parse the value from the selected option in\n// a customized way.\n// `selector`:\n// The selector used to find the associated <select> element.\nconst selectConfigs = {\n backgroundColor: {\n selector: '.vjs-bg-color > select',\n id: 'captions-background-color-%s',\n label: 'Color',\n options: [COLOR_BLACK, COLOR_WHITE, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN]\n },\n backgroundOpacity: {\n selector: '.vjs-bg-opacity > select',\n id: 'captions-background-opacity-%s',\n label: 'Opacity',\n options: [OPACITY_OPAQUE, OPACITY_SEMI, OPACITY_TRANS]\n },\n color: {\n selector: '.vjs-text-color > select',\n id: 'captions-foreground-color-%s',\n label: 'Color',\n options: [COLOR_WHITE, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN]\n },\n edgeStyle: {\n selector: '.vjs-edge-style > select',\n id: '%s',\n label: 'Text Edge Style',\n options: [['none', 'None'], ['raised', 'Raised'], ['depressed', 'Depressed'], ['uniform', 'Uniform'], ['dropshadow', 'Drop shadow']]\n },\n fontFamily: {\n selector: '.vjs-font-family > select',\n id: 'captions-font-family-%s',\n label: 'Font Family',\n options: [['proportionalSansSerif', 'Proportional Sans-Serif'], ['monospaceSansSerif', 'Monospace Sans-Serif'], ['proportionalSerif', 'Proportional Serif'], ['monospaceSerif', 'Monospace Serif'], ['casual', 'Casual'], ['script', 'Script'], ['small-caps', 'Small Caps']]\n },\n fontPercent: {\n selector: '.vjs-font-percent > select',\n id: 'captions-font-size-%s',\n label: 'Font Size',\n 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%']],\n default: 2,\n parser: v => v === '1.00' ? null : Number(v)\n },\n textOpacity: {\n selector: '.vjs-text-opacity > select',\n id: 'captions-foreground-opacity-%s',\n label: 'Opacity',\n options: [OPACITY_OPAQUE, OPACITY_SEMI]\n },\n // Options for this object are defined below.\n windowColor: {\n selector: '.vjs-window-color > select',\n id: 'captions-window-color-%s',\n label: 'Color'\n },\n // Options for this object are defined below.\n windowOpacity: {\n selector: '.vjs-window-opacity > select',\n id: 'captions-window-opacity-%s',\n label: 'Opacity',\n options: [OPACITY_TRANS, OPACITY_SEMI, OPACITY_OPAQUE]\n }\n};\nselectConfigs.windowColor.options = selectConfigs.backgroundColor.options;\n\n/**\n * Get the actual value of an option.\n *\n * @param {string} value\n * The value to get\n *\n * @param {Function} [parser]\n * Optional function to adjust the value.\n *\n * @return {*}\n * - Will be `undefined` if no value exists\n * - Will be `undefined` if the given value is \"none\".\n * - Will be the actual value otherwise.\n *\n * @private\n */\nfunction parseOptionValue(value, parser) {\n if (parser) {\n value = parser(value);\n }\n if (value && value !== 'none') {\n return value;\n }\n}\n\n/**\n * Gets the value of the selected <option> element within a <select> element.\n *\n * @param {Element} el\n * the element to look in\n *\n * @param {Function} [parser]\n * Optional function to adjust the value.\n *\n * @return {*}\n * - Will be `undefined` if no value exists\n * - Will be `undefined` if the given value is \"none\".\n * - Will be the actual value otherwise.\n *\n * @private\n */\nfunction getSelectedOptionValue(el, parser) {\n const value = el.options[el.options.selectedIndex].value;\n return parseOptionValue(value, parser);\n}\n\n/**\n * Sets the selected <option> element within a <select> element based on a\n * given value.\n *\n * @param {Element} el\n * The element to look in.\n *\n * @param {string} value\n * the property to look on.\n *\n * @param {Function} [parser]\n * Optional function to adjust the value before comparing.\n *\n * @private\n */\nfunction setSelectedOption(el, value, parser) {\n if (!value) {\n return;\n }\n for (let i = 0; i < el.options.length; i++) {\n if (parseOptionValue(el.options[i].value, parser) === value) {\n el.selectedIndex = i;\n break;\n }\n }\n}\n\n/**\n * Manipulate Text Tracks settings.\n *\n * @extends ModalDialog\n */\nclass TextTrackSettings extends ModalDialog {\n /**\n * Creates an instance of this class.\n *\n * @param { import('../player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n constructor(player, options) {\n options.temporary = false;\n super(player, options);\n this.updateDisplay = this.updateDisplay.bind(this);\n\n // fill the modal and pretend we have opened it\n this.fill();\n this.hasBeenOpened_ = this.hasBeenFilled_ = true;\n this.endDialog = createEl('p', {\n className: 'vjs-control-text',\n textContent: this.localize('End of dialog window.')\n });\n this.el().appendChild(this.endDialog);\n this.setDefaults();\n\n // Grab `persistTextTrackSettings` from the player options if not passed in child options\n if (options.persistTextTrackSettings === undefined) {\n this.options_.persistTextTrackSettings = this.options_.playerOptions.persistTextTrackSettings;\n }\n this.on(this.$('.vjs-done-button'), 'click', () => {\n this.saveSettings();\n this.close();\n });\n this.on(this.$('.vjs-default-button'), 'click', () => {\n this.setDefaults();\n this.updateDisplay();\n });\n each(selectConfigs, config => {\n this.on(this.$(config.selector), 'change', this.updateDisplay);\n });\n if (this.options_.persistTextTrackSettings) {\n this.restoreSettings();\n }\n }\n dispose() {\n this.endDialog = null;\n super.dispose();\n }\n\n /**\n * Create a <select> element with configured options.\n *\n * @param {string} key\n * Configuration key to use during creation.\n *\n * @return {string}\n * An HTML string.\n *\n * @private\n */\n createElSelect_(key, legendId = '', type = 'label') {\n const config = selectConfigs[key];\n const id = config.id.replace('%s', this.id_);\n const selectLabelledbyIds = [legendId, id].join(' ').trim();\n return [`<${type} id=\"${id}\" class=\"${type === 'label' ? 'vjs-label' : ''}\">`, this.localize(config.label), `</${type}>`, `<select aria-labelledby=\"${selectLabelledbyIds}\">`].concat(config.options.map(o => {\n const optionId = id + '-' + o[1].replace(/\\W+/g, '');\n return [`<option id=\"${optionId}\" value=\"${o[0]}\" `, `aria-labelledby=\"${selectLabelledbyIds} ${optionId}\">`, this.localize(o[1]), '</option>'].join('');\n })).concat('</select>').join('');\n }\n\n /**\n * Create foreground color element for the component\n *\n * @return {string}\n * An HTML string.\n *\n * @private\n */\n createElFgColor_() {\n const legendId = `captions-text-legend-${this.id_}`;\n return ['<fieldset class=\"vjs-fg vjs-track-setting\">', `<legend id=\"${legendId}\">`, this.localize('Text'), '</legend>', '<span class=\"vjs-text-color\">', this.createElSelect_('color', legendId), '</span>', '<span class=\"vjs-text-opacity vjs-opacity\">', this.createElSelect_('textOpacity', legendId), '</span>', '</fieldset>'].join('');\n }\n\n /**\n * Create background color element for the component\n *\n * @return {string}\n * An HTML string.\n *\n * @private\n */\n createElBgColor_() {\n const legendId = `captions-background-${this.id_}`;\n return ['<fieldset class=\"vjs-bg vjs-track-setting\">', `<legend id=\"${legendId}\">`, this.localize('Text Background'), '</legend>', '<span class=\"vjs-bg-color\">', this.createElSelect_('backgroundColor', legendId), '</span>', '<span class=\"vjs-bg-opacity vjs-opacity\">', this.createElSelect_('backgroundOpacity', legendId), '</span>', '</fieldset>'].join('');\n }\n\n /**\n * Create window color element for the component\n *\n * @return {string}\n * An HTML string.\n *\n * @private\n */\n createElWinColor_() {\n const legendId = `captions-window-${this.id_}`;\n return ['<fieldset class=\"vjs-window vjs-track-setting\">', `<legend id=\"${legendId}\">`, this.localize('Caption Area Background'), '</legend>', '<span class=\"vjs-window-color\">', this.createElSelect_('windowColor', legendId), '</span>', '<span class=\"vjs-window-opacity vjs-opacity\">', this.createElSelect_('windowOpacity', legendId), '</span>', '</fieldset>'].join('');\n }\n\n /**\n * Create color elements for the component\n *\n * @return {Element}\n * The element that was created\n *\n * @private\n */\n createElColors_() {\n return createEl('div', {\n className: 'vjs-track-settings-colors',\n innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join('')\n });\n }\n\n /**\n * Create font elements for the component\n *\n * @return {Element}\n * The element that was created.\n *\n * @private\n */\n createElFont_() {\n return createEl('div', {\n className: 'vjs-track-settings-font',\n 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('')\n });\n }\n\n /**\n * Create controls for the component\n *\n * @return {Element}\n * The element that was created.\n *\n * @private\n */\n createElControls_() {\n const defaultsDescription = this.localize('restore all settings to the default values');\n return createEl('div', {\n className: 'vjs-track-settings-controls',\n innerHTML: [`<button type=\"button\" class=\"vjs-default-button\" title=\"${defaultsDescription}\">`, this.localize('Reset'), `<span class=\"vjs-control-text\"> ${defaultsDescription}</span>`, '</button>', `<button type=\"button\" class=\"vjs-done-button\">${this.localize('Done')}</button>`].join('')\n });\n }\n content() {\n return [this.createElColors_(), this.createElFont_(), this.createElControls_()];\n }\n label() {\n return this.localize('Caption Settings Dialog');\n }\n description() {\n return this.localize('Beginning of dialog window. Escape will cancel and close the window.');\n }\n buildCSSClass() {\n return super.buildCSSClass() + ' vjs-text-track-settings';\n }\n\n /**\n * Gets an object of text track settings (or null).\n *\n * @return {Object}\n * An object with config values parsed from the DOM or localStorage.\n */\n getValues() {\n return reduce(selectConfigs, (accum, config, key) => {\n const value = getSelectedOptionValue(this.$(config.selector), config.parser);\n if (value !== undefined) {\n accum[key] = value;\n }\n return accum;\n }, {});\n }\n\n /**\n * Sets text track settings from an object of values.\n *\n * @param {Object} values\n * An object with config values parsed from the DOM or localStorage.\n */\n setValues(values) {\n each(selectConfigs, (config, key) => {\n setSelectedOption(this.$(config.selector), values[key], config.parser);\n });\n }\n\n /**\n * Sets all `<select>` elements to their default values.\n */\n setDefaults() {\n each(selectConfigs, config => {\n const index = config.hasOwnProperty('default') ? config.default : 0;\n this.$(config.selector).selectedIndex = index;\n });\n }\n\n /**\n * Restore texttrack settings from localStorage\n */\n restoreSettings() {\n let values;\n try {\n values = JSON.parse(global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage.getItem(LOCAL_STORAGE_KEY$1));\n } catch (err) {\n log$1.warn(err);\n }\n if (values) {\n this.setValues(values);\n }\n }\n\n /**\n * Save text track settings to localStorage\n */\n saveSettings() {\n if (!this.options_.persistTextTrackSettings) {\n return;\n }\n const values = this.getValues();\n try {\n if (Object.keys(values).length) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage.setItem(LOCAL_STORAGE_KEY$1, JSON.stringify(values));\n } else {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage.removeItem(LOCAL_STORAGE_KEY$1);\n }\n } catch (err) {\n log$1.warn(err);\n }\n }\n\n /**\n * Update display of text track settings\n */\n updateDisplay() {\n const ttDisplay = this.player_.getChild('textTrackDisplay');\n if (ttDisplay) {\n ttDisplay.updateDisplay();\n }\n }\n\n /**\n * conditionally blur the element and refocus the captions button\n *\n * @private\n */\n conditionalBlur_() {\n this.previouslyActiveEl_ = null;\n const cb = this.player_.controlBar;\n const subsCapsBtn = cb && cb.subsCapsButton;\n const ccBtn = cb && cb.captionsButton;\n if (subsCapsBtn) {\n subsCapsBtn.focus();\n } else if (ccBtn) {\n ccBtn.focus();\n }\n }\n\n /**\n * Repopulate dialog with new localizations on languagechange\n */\n handleLanguagechange() {\n this.fill();\n }\n}\nComponent$1.registerComponent('TextTrackSettings', TextTrackSettings);\n\n/**\n * @file resize-manager.js\n */\n\n/**\n * A Resize Manager. It is in charge of triggering `playerresize` on the player in the right conditions.\n *\n * It'll either create an iframe and use a debounced resize handler on it or use the new {@link https://wicg.github.io/ResizeObserver/|ResizeObserver}.\n *\n * If the ResizeObserver is available natively, it will be used. A polyfill can be passed in as an option.\n * If a `playerresize` event is not needed, the ResizeManager component can be removed from the player, see the example below.\n *\n * @example <caption>How to disable the resize manager</caption>\n * const player = videojs('#vid', {\n * resizeManager: false\n * });\n *\n * @see {@link https://wicg.github.io/ResizeObserver/|ResizeObserver specification}\n *\n * @extends Component\n */\nclass ResizeManager extends Component$1 {\n /**\n * Create the ResizeManager.\n *\n * @param {Object} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of ResizeManager options.\n *\n * @param {Object} [options.ResizeObserver]\n * A polyfill for ResizeObserver can be passed in here.\n * If this is set to null it will ignore the native ResizeObserver and fall back to the iframe fallback.\n */\n constructor(player, options) {\n let RESIZE_OBSERVER_AVAILABLE = options.ResizeObserver || (global_window__WEBPACK_IMPORTED_MODULE_0___default().ResizeObserver);\n\n // if `null` was passed, we want to disable the ResizeObserver\n if (options.ResizeObserver === null) {\n RESIZE_OBSERVER_AVAILABLE = false;\n }\n\n // Only create an element when ResizeObserver isn't available\n const options_ = merge$1({\n createEl: !RESIZE_OBSERVER_AVAILABLE,\n reportTouchActivity: false\n }, options);\n super(player, options_);\n this.ResizeObserver = options.ResizeObserver || (global_window__WEBPACK_IMPORTED_MODULE_0___default().ResizeObserver);\n this.loadListener_ = null;\n this.resizeObserver_ = null;\n this.debouncedHandler_ = debounce(() => {\n this.resizeHandler();\n }, 100, false, this);\n if (RESIZE_OBSERVER_AVAILABLE) {\n this.resizeObserver_ = new this.ResizeObserver(this.debouncedHandler_);\n this.resizeObserver_.observe(player.el());\n } else {\n this.loadListener_ = () => {\n if (!this.el_ || !this.el_.contentWindow) {\n return;\n }\n const debouncedHandler_ = this.debouncedHandler_;\n let unloadListener_ = this.unloadListener_ = function () {\n off(this, 'resize', debouncedHandler_);\n off(this, 'unload', unloadListener_);\n unloadListener_ = null;\n };\n\n // safari and edge can unload the iframe before resizemanager dispose\n // we have to dispose of event handlers correctly before that happens\n on(this.el_.contentWindow, 'unload', unloadListener_);\n on(this.el_.contentWindow, 'resize', debouncedHandler_);\n };\n this.one('load', this.loadListener_);\n }\n }\n createEl() {\n return super.createEl('iframe', {\n className: 'vjs-resize-manager',\n tabIndex: -1,\n title: this.localize('No content')\n }, {\n 'aria-hidden': 'true'\n });\n }\n\n /**\n * Called when a resize is triggered on the iframe or a resize is observed via the ResizeObserver\n *\n * @fires Player#playerresize\n */\n resizeHandler() {\n /**\n * Called when the player size has changed\n *\n * @event Player#playerresize\n * @type {Event}\n */\n // make sure player is still around to trigger\n // prevents this from causing an error after dispose\n if (!this.player_ || !this.player_.trigger) {\n return;\n }\n this.player_.trigger('playerresize');\n }\n dispose() {\n if (this.debouncedHandler_) {\n this.debouncedHandler_.cancel();\n }\n if (this.resizeObserver_) {\n if (this.player_.el()) {\n this.resizeObserver_.unobserve(this.player_.el());\n }\n this.resizeObserver_.disconnect();\n }\n if (this.loadListener_) {\n this.off('load', this.loadListener_);\n }\n if (this.el_ && this.el_.contentWindow && this.unloadListener_) {\n this.unloadListener_.call(this.el_.contentWindow);\n }\n this.ResizeObserver = null;\n this.resizeObserver = null;\n this.debouncedHandler_ = null;\n this.loadListener_ = null;\n super.dispose();\n }\n}\nComponent$1.registerComponent('ResizeManager', ResizeManager);\n\nconst defaults = {\n trackingThreshold: 20,\n liveTolerance: 15\n};\n\n/*\n track when we are at the live edge, and other helpers for live playback */\n\n/**\n * A class for checking live current time and determining when the player\n * is at or behind the live edge.\n */\nclass LiveTracker extends Component$1 {\n /**\n * Creates an instance of this class.\n *\n * @param { import('./player').default } player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {number} [options.trackingThreshold=20]\n * Number of seconds of live window (seekableEnd - seekableStart) that\n * media needs to have before the liveui will be shown.\n *\n * @param {number} [options.liveTolerance=15]\n * Number of seconds behind live that we have to be\n * before we will be considered non-live. Note that this will only\n * be used when playing at the live edge. This allows large seekable end\n * changes to not effect whether we are live or not.\n */\n constructor(player, options) {\n // LiveTracker does not need an element\n const options_ = merge$1(defaults, options, {\n createEl: false\n });\n super(player, options_);\n this.trackLiveHandler_ = () => this.trackLive_();\n this.handlePlay_ = e => this.handlePlay(e);\n this.handleFirstTimeupdate_ = e => this.handleFirstTimeupdate(e);\n this.handleSeeked_ = e => this.handleSeeked(e);\n this.seekToLiveEdge_ = e => this.seekToLiveEdge(e);\n this.reset_();\n this.on(this.player_, 'durationchange', e => this.handleDurationchange(e));\n // we should try to toggle tracking on canplay as native playback engines, like Safari\n // may not have the proper values for things like seekableEnd until then\n this.on(this.player_, 'canplay', () => this.toggleTracking());\n }\n\n /**\n * all the functionality for tracking when seek end changes\n * and for tracking how far past seek end we should be\n */\n trackLive_() {\n const seekable = this.player_.seekable();\n\n // skip undefined seekable\n if (!seekable || !seekable.length) {\n return;\n }\n const newTime = Number(global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now().toFixed(4));\n const deltaTime = this.lastTime_ === -1 ? 0 : (newTime - this.lastTime_) / 1000;\n this.lastTime_ = newTime;\n this.pastSeekEnd_ = this.pastSeekEnd() + deltaTime;\n const liveCurrentTime = this.liveCurrentTime();\n const currentTime = this.player_.currentTime();\n\n // we are behind live if any are true\n // 1. the player is paused\n // 2. the user seeked to a location 2 seconds away from live\n // 3. the difference between live and current time is greater\n // liveTolerance which defaults to 15s\n let isBehind = this.player_.paused() || this.seekedBehindLive_ || Math.abs(liveCurrentTime - currentTime) > this.options_.liveTolerance;\n\n // we cannot be behind if\n // 1. until we have not seen a timeupdate yet\n // 2. liveCurrentTime is Infinity, which happens on Android and Native Safari\n if (!this.timeupdateSeen_ || liveCurrentTime === Infinity) {\n isBehind = false;\n }\n if (isBehind !== this.behindLiveEdge_) {\n this.behindLiveEdge_ = isBehind;\n this.trigger('liveedgechange');\n }\n }\n\n /**\n * handle a durationchange event on the player\n * and start/stop tracking accordingly.\n */\n handleDurationchange() {\n this.toggleTracking();\n }\n\n /**\n * start/stop tracking\n */\n toggleTracking() {\n if (this.player_.duration() === Infinity && this.liveWindow() >= this.options_.trackingThreshold) {\n if (this.player_.options_.liveui) {\n this.player_.addClass('vjs-liveui');\n }\n this.startTracking();\n } else {\n this.player_.removeClass('vjs-liveui');\n this.stopTracking();\n }\n }\n\n /**\n * start tracking live playback\n */\n startTracking() {\n if (this.isTracking()) {\n return;\n }\n\n // If we haven't seen a timeupdate, we need to check whether playback\n // began before this component started tracking. This can happen commonly\n // when using autoplay.\n if (!this.timeupdateSeen_) {\n this.timeupdateSeen_ = this.player_.hasStarted();\n }\n this.trackingInterval_ = this.setInterval(this.trackLiveHandler_, UPDATE_REFRESH_INTERVAL);\n this.trackLive_();\n this.on(this.player_, ['play', 'pause'], this.trackLiveHandler_);\n if (!this.timeupdateSeen_) {\n this.one(this.player_, 'play', this.handlePlay_);\n this.one(this.player_, 'timeupdate', this.handleFirstTimeupdate_);\n } else {\n this.on(this.player_, 'seeked', this.handleSeeked_);\n }\n }\n\n /**\n * handle the first timeupdate on the player if it wasn't already playing\n * when live tracker started tracking.\n */\n handleFirstTimeupdate() {\n this.timeupdateSeen_ = true;\n this.on(this.player_, 'seeked', this.handleSeeked_);\n }\n\n /**\n * Keep track of what time a seek starts, and listen for seeked\n * to find where a seek ends.\n */\n handleSeeked() {\n const timeDiff = Math.abs(this.liveCurrentTime() - this.player_.currentTime());\n this.seekedBehindLive_ = this.nextSeekedFromUser_ && timeDiff > 2;\n this.nextSeekedFromUser_ = false;\n this.trackLive_();\n }\n\n /**\n * handle the first play on the player, and make sure that we seek\n * right to the live edge.\n */\n handlePlay() {\n this.one(this.player_, 'timeupdate', this.seekToLiveEdge_);\n }\n\n /**\n * Stop tracking, and set all internal variables to\n * their initial value.\n */\n reset_() {\n this.lastTime_ = -1;\n this.pastSeekEnd_ = 0;\n this.lastSeekEnd_ = -1;\n this.behindLiveEdge_ = true;\n this.timeupdateSeen_ = false;\n this.seekedBehindLive_ = false;\n this.nextSeekedFromUser_ = false;\n this.clearInterval(this.trackingInterval_);\n this.trackingInterval_ = null;\n this.off(this.player_, ['play', 'pause'], this.trackLiveHandler_);\n this.off(this.player_, 'seeked', this.handleSeeked_);\n this.off(this.player_, 'play', this.handlePlay_);\n this.off(this.player_, 'timeupdate', this.handleFirstTimeupdate_);\n this.off(this.player_, 'timeupdate', this.seekToLiveEdge_);\n }\n\n /**\n * The next seeked event is from the user. Meaning that any seek\n * > 2s behind live will be considered behind live for real and\n * liveTolerance will be ignored.\n */\n nextSeekedFromUser() {\n this.nextSeekedFromUser_ = true;\n }\n\n /**\n * stop tracking live playback\n */\n stopTracking() {\n if (!this.isTracking()) {\n return;\n }\n this.reset_();\n this.trigger('liveedgechange');\n }\n\n /**\n * A helper to get the player seekable end\n * so that we don't have to null check everywhere\n *\n * @return {number}\n * The furthest seekable end or Infinity.\n */\n seekableEnd() {\n const seekable = this.player_.seekable();\n const seekableEnds = [];\n let i = seekable ? seekable.length : 0;\n while (i--) {\n seekableEnds.push(seekable.end(i));\n }\n\n // grab the furthest seekable end after sorting, or if there are none\n // default to Infinity\n return seekableEnds.length ? seekableEnds.sort()[seekableEnds.length - 1] : Infinity;\n }\n\n /**\n * A helper to get the player seekable start\n * so that we don't have to null check everywhere\n *\n * @return {number}\n * The earliest seekable start or 0.\n */\n seekableStart() {\n const seekable = this.player_.seekable();\n const seekableStarts = [];\n let i = seekable ? seekable.length : 0;\n while (i--) {\n seekableStarts.push(seekable.start(i));\n }\n\n // grab the first seekable start after sorting, or if there are none\n // default to 0\n return seekableStarts.length ? seekableStarts.sort()[0] : 0;\n }\n\n /**\n * Get the live time window aka\n * the amount of time between seekable start and\n * live current time.\n *\n * @return {number}\n * The amount of seconds that are seekable in\n * the live video.\n */\n liveWindow() {\n const liveCurrentTime = this.liveCurrentTime();\n\n // if liveCurrenTime is Infinity then we don't have a liveWindow at all\n if (liveCurrentTime === Infinity) {\n return 0;\n }\n return liveCurrentTime - this.seekableStart();\n }\n\n /**\n * Determines if the player is live, only checks if this component\n * is tracking live playback or not\n *\n * @return {boolean}\n * Whether liveTracker is tracking\n */\n isLive() {\n return this.isTracking();\n }\n\n /**\n * Determines if currentTime is at the live edge and won't fall behind\n * on each seekableendchange\n *\n * @return {boolean}\n * Whether playback is at the live edge\n */\n atLiveEdge() {\n return !this.behindLiveEdge();\n }\n\n /**\n * get what we expect the live current time to be\n *\n * @return {number}\n * The expected live current time\n */\n liveCurrentTime() {\n return this.pastSeekEnd() + this.seekableEnd();\n }\n\n /**\n * The number of seconds that have occurred after seekable end\n * changed. This will be reset to 0 once seekable end changes.\n *\n * @return {number}\n * Seconds past the current seekable end\n */\n pastSeekEnd() {\n const seekableEnd = this.seekableEnd();\n if (this.lastSeekEnd_ !== -1 && seekableEnd !== this.lastSeekEnd_) {\n this.pastSeekEnd_ = 0;\n }\n this.lastSeekEnd_ = seekableEnd;\n return this.pastSeekEnd_;\n }\n\n /**\n * If we are currently behind the live edge, aka currentTime will be\n * behind on a seekableendchange\n *\n * @return {boolean}\n * If we are behind the live edge\n */\n behindLiveEdge() {\n return this.behindLiveEdge_;\n }\n\n /**\n * Whether live tracker is currently tracking or not.\n */\n isTracking() {\n return typeof this.trackingInterval_ === 'number';\n }\n\n /**\n * Seek to the live edge if we are behind the live edge\n */\n seekToLiveEdge() {\n this.seekedBehindLive_ = false;\n if (this.atLiveEdge()) {\n return;\n }\n this.nextSeekedFromUser_ = false;\n this.player_.currentTime(this.liveCurrentTime());\n }\n\n /**\n * Dispose of liveTracker\n */\n dispose() {\n this.stopTracking();\n super.dispose();\n }\n}\nComponent$1.registerComponent('LiveTracker', LiveTracker);\n\n/**\n * Displays an element over the player which contains an optional title and\n * description for the current content.\n *\n * Much of the code for this component originated in the now obsolete\n * videojs-dock plugin: https://github.com/brightcove/videojs-dock/\n *\n * @extends Component\n */\nclass TitleBar extends Component$1 {\n constructor(player, options) {\n super(player, options);\n this.on('statechanged', e => this.updateDom_());\n this.updateDom_();\n }\n\n /**\n * Create the `TitleBar`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n createEl() {\n this.els = {\n title: createEl('div', {\n className: 'vjs-title-bar-title',\n id: `vjs-title-bar-title-${newGUID()}`\n }),\n description: createEl('div', {\n className: 'vjs-title-bar-description',\n id: `vjs-title-bar-description-${newGUID()}`\n })\n };\n return createEl('div', {\n className: 'vjs-title-bar'\n }, {}, values(this.els));\n }\n\n /**\n * Updates the DOM based on the component's state object.\n */\n updateDom_() {\n const tech = this.player_.tech_;\n const techEl = tech && tech.el_;\n const techAriaAttrs = {\n title: 'aria-labelledby',\n description: 'aria-describedby'\n };\n ['title', 'description'].forEach(k => {\n const value = this.state[k];\n const el = this.els[k];\n const techAriaAttr = techAriaAttrs[k];\n emptyEl(el);\n if (value) {\n textContent(el, value);\n }\n\n // If there is a tech element available, update its ARIA attributes\n // according to whether a title and/or description have been provided.\n if (techEl) {\n techEl.removeAttribute(techAriaAttr);\n if (value) {\n techEl.setAttribute(techAriaAttr, el.id);\n }\n }\n });\n if (this.state.title || this.state.description) {\n this.show();\n } else {\n this.hide();\n }\n }\n\n /**\n * Update the contents of the title bar component with new title and\n * description text.\n *\n * If both title and description are missing, the title bar will be hidden.\n *\n * If either title or description are present, the title bar will be visible.\n *\n * NOTE: Any previously set value will be preserved. To unset a previously\n * set value, you must pass an empty string or null.\n *\n * For example:\n *\n * ```\n * update({title: 'foo', description: 'bar'}) // title: 'foo', description: 'bar'\n * update({description: 'bar2'}) // title: 'foo', description: 'bar2'\n * update({title: ''}) // title: '', description: 'bar2'\n * update({title: 'foo', description: null}) // title: 'foo', description: null\n * ```\n *\n * @param {Object} [options={}]\n * An options object. When empty, the title bar will be hidden.\n *\n * @param {string} [options.title]\n * A title to display in the title bar.\n *\n * @param {string} [options.description]\n * A description to display in the title bar.\n */\n update(options) {\n this.setState(options);\n }\n\n /**\n * Dispose the component.\n */\n dispose() {\n const tech = this.player_.tech_;\n const techEl = tech && tech.el_;\n if (techEl) {\n techEl.removeAttribute('aria-labelledby');\n techEl.removeAttribute('aria-describedby');\n }\n super.dispose();\n this.els = null;\n }\n}\nComponent$1.registerComponent('TitleBar', TitleBar);\n\n/**\n * This function is used to fire a sourceset when there is something\n * similar to `mediaEl.load()` being called. It will try to find the source via\n * the `src` attribute and then the `<source>` elements. It will then fire `sourceset`\n * with the source that was found or empty string if we cannot know. If it cannot\n * find a source then `sourceset` will not be fired.\n *\n * @param { import('./html5').default } tech\n * The tech object that sourceset was setup on\n *\n * @return {boolean}\n * returns false if the sourceset was not fired and true otherwise.\n */\nconst sourcesetLoad = tech => {\n const el = tech.el();\n\n // if `el.src` is set, that source will be loaded.\n if (el.hasAttribute('src')) {\n tech.triggerSourceset(el.src);\n return true;\n }\n\n /**\n * Since there isn't a src property on the media element, source elements will be used for\n * implementing the source selection algorithm. This happens asynchronously and\n * for most cases were there is more than one source we cannot tell what source will\n * be loaded, without re-implementing the source selection algorithm. At this time we are not\n * going to do that. There are three special cases that we do handle here though:\n *\n * 1. If there are no sources, do not fire `sourceset`.\n * 2. If there is only one `<source>` with a `src` property/attribute that is our `src`\n * 3. If there is more than one `<source>` but all of them have the same `src` url.\n * That will be our src.\n */\n const sources = tech.$$('source');\n const srcUrls = [];\n let src = '';\n\n // if there are no sources, do not fire sourceset\n if (!sources.length) {\n return false;\n }\n\n // only count valid/non-duplicate source elements\n for (let i = 0; i < sources.length; i++) {\n const url = sources[i].src;\n if (url && srcUrls.indexOf(url) === -1) {\n srcUrls.push(url);\n }\n }\n\n // there were no valid sources\n if (!srcUrls.length) {\n return false;\n }\n\n // there is only one valid source element url\n // use that\n if (srcUrls.length === 1) {\n src = srcUrls[0];\n }\n tech.triggerSourceset(src);\n return true;\n};\n\n/**\n * our implementation of an `innerHTML` descriptor for browsers\n * that do not have one.\n */\nconst innerHTMLDescriptorPolyfill = Object.defineProperty({}, 'innerHTML', {\n get() {\n return this.cloneNode(true).innerHTML;\n },\n set(v) {\n // make a dummy node to use innerHTML on\n const dummy = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement(this.nodeName.toLowerCase());\n\n // set innerHTML to the value provided\n dummy.innerHTML = v;\n\n // make a document fragment to hold the nodes from dummy\n const docFrag = global_document__WEBPACK_IMPORTED_MODULE_1___default().createDocumentFragment();\n\n // copy all of the nodes created by the innerHTML on dummy\n // to the document fragment\n while (dummy.childNodes.length) {\n docFrag.appendChild(dummy.childNodes[0]);\n }\n\n // remove content\n this.innerText = '';\n\n // now we add all of that html in one by appending the\n // document fragment. This is how innerHTML does it.\n global_window__WEBPACK_IMPORTED_MODULE_0___default().Element.prototype.appendChild.call(this, docFrag);\n\n // then return the result that innerHTML's setter would\n return this.innerHTML;\n }\n});\n\n/**\n * Get a property descriptor given a list of priorities and the\n * property to get.\n */\nconst getDescriptor = (priority, prop) => {\n let descriptor = {};\n for (let i = 0; i < priority.length; i++) {\n descriptor = Object.getOwnPropertyDescriptor(priority[i], prop);\n if (descriptor && descriptor.set && descriptor.get) {\n break;\n }\n }\n descriptor.enumerable = true;\n descriptor.configurable = true;\n return descriptor;\n};\nconst getInnerHTMLDescriptor = tech => getDescriptor([tech.el(), (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLMediaElement).prototype, (global_window__WEBPACK_IMPORTED_MODULE_0___default().Element).prototype, innerHTMLDescriptorPolyfill], 'innerHTML');\n\n/**\n * Patches browser internal functions so that we can tell synchronously\n * if a `<source>` was appended to the media element. For some reason this\n * causes a `sourceset` if the the media element is ready and has no source.\n * This happens when:\n * - The page has just loaded and the media element does not have a source.\n * - The media element was emptied of all sources, then `load()` was called.\n *\n * It does this by patching the following functions/properties when they are supported:\n *\n * - `append()` - can be used to add a `<source>` element to the media element\n * - `appendChild()` - can be used to add a `<source>` element to the media element\n * - `insertAdjacentHTML()` - can be used to add a `<source>` element to the media element\n * - `innerHTML` - can be used to add a `<source>` element to the media element\n *\n * @param {Html5} tech\n * The tech object that sourceset is being setup on.\n */\nconst firstSourceWatch = function (tech) {\n const el = tech.el();\n\n // make sure firstSourceWatch isn't setup twice.\n if (el.resetSourceWatch_) {\n return;\n }\n const old = {};\n const innerDescriptor = getInnerHTMLDescriptor(tech);\n const appendWrapper = appendFn => (...args) => {\n const retval = appendFn.apply(el, args);\n sourcesetLoad(tech);\n return retval;\n };\n ['append', 'appendChild', 'insertAdjacentHTML'].forEach(k => {\n if (!el[k]) {\n return;\n }\n\n // store the old function\n old[k] = el[k];\n\n // call the old function with a sourceset if a source\n // was loaded\n el[k] = appendWrapper(old[k]);\n });\n Object.defineProperty(el, 'innerHTML', merge$1(innerDescriptor, {\n set: appendWrapper(innerDescriptor.set)\n }));\n el.resetSourceWatch_ = () => {\n el.resetSourceWatch_ = null;\n Object.keys(old).forEach(k => {\n el[k] = old[k];\n });\n Object.defineProperty(el, 'innerHTML', innerDescriptor);\n };\n\n // on the first sourceset, we need to revert our changes\n tech.one('sourceset', el.resetSourceWatch_);\n};\n\n/**\n * our implementation of a `src` descriptor for browsers\n * that do not have one\n */\nconst srcDescriptorPolyfill = Object.defineProperty({}, 'src', {\n get() {\n if (this.hasAttribute('src')) {\n return getAbsoluteURL(global_window__WEBPACK_IMPORTED_MODULE_0___default().Element.prototype.getAttribute.call(this, 'src'));\n }\n return '';\n },\n set(v) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().Element.prototype.setAttribute.call(this, 'src', v);\n return v;\n }\n});\nconst getSrcDescriptor = tech => getDescriptor([tech.el(), (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLMediaElement).prototype, srcDescriptorPolyfill], 'src');\n\n/**\n * setup `sourceset` handling on the `Html5` tech. This function\n * patches the following element properties/functions:\n *\n * - `src` - to determine when `src` is set\n * - `setAttribute()` - to determine when `src` is set\n * - `load()` - this re-triggers the source selection algorithm, and can\n * cause a sourceset.\n *\n * If there is no source when we are adding `sourceset` support or during a `load()`\n * we also patch the functions listed in `firstSourceWatch`.\n *\n * @param {Html5} tech\n * The tech to patch\n */\nconst setupSourceset = function (tech) {\n if (!tech.featuresSourceset) {\n return;\n }\n const el = tech.el();\n\n // make sure sourceset isn't setup twice.\n if (el.resetSourceset_) {\n return;\n }\n const srcDescriptor = getSrcDescriptor(tech);\n const oldSetAttribute = el.setAttribute;\n const oldLoad = el.load;\n Object.defineProperty(el, 'src', merge$1(srcDescriptor, {\n set: v => {\n const retval = srcDescriptor.set.call(el, v);\n\n // we use the getter here to get the actual value set on src\n tech.triggerSourceset(el.src);\n return retval;\n }\n }));\n el.setAttribute = (n, v) => {\n const retval = oldSetAttribute.call(el, n, v);\n if (/src/i.test(n)) {\n tech.triggerSourceset(el.src);\n }\n return retval;\n };\n el.load = () => {\n const retval = oldLoad.call(el);\n\n // if load was called, but there was no source to fire\n // sourceset on. We have to watch for a source append\n // as that can trigger a `sourceset` when the media element\n // has no source\n if (!sourcesetLoad(tech)) {\n tech.triggerSourceset('');\n firstSourceWatch(tech);\n }\n return retval;\n };\n if (el.currentSrc) {\n tech.triggerSourceset(el.currentSrc);\n } else if (!sourcesetLoad(tech)) {\n firstSourceWatch(tech);\n }\n el.resetSourceset_ = () => {\n el.resetSourceset_ = null;\n el.load = oldLoad;\n el.setAttribute = oldSetAttribute;\n Object.defineProperty(el, 'src', srcDescriptor);\n if (el.resetSourceWatch_) {\n el.resetSourceWatch_();\n }\n };\n};\n\n/**\n * @file html5.js\n */\n\n/**\n * HTML5 Media Controller - Wrapper for HTML5 Media API\n *\n * @mixes Tech~SourceHandlerAdditions\n * @extends Tech\n */\nclass Html5 extends Tech {\n /**\n * Create an instance of this Tech.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Function} [ready]\n * Callback function to call when the `HTML5` Tech is ready.\n */\n constructor(options, ready) {\n super(options, ready);\n const source = options.source;\n let crossoriginTracks = false;\n this.featuresVideoFrameCallback = this.featuresVideoFrameCallback && this.el_.tagName === 'VIDEO';\n\n // Set the source if one is provided\n // 1) Check if the source is new (if not, we want to keep the original so playback isn't interrupted)\n // 2) Check to see if the network state of the tag was failed at init, and if so, reset the source\n // anyway so the error gets fired.\n if (source && (this.el_.currentSrc !== source.src || options.tag && options.tag.initNetworkState_ === 3)) {\n this.setSource(source);\n } else {\n this.handleLateInit_(this.el_);\n }\n\n // setup sourceset after late sourceset/init\n if (options.enableSourceset) {\n this.setupSourcesetHandling_();\n }\n this.isScrubbing_ = false;\n if (this.el_.hasChildNodes()) {\n const nodes = this.el_.childNodes;\n let nodesLength = nodes.length;\n const removeNodes = [];\n while (nodesLength--) {\n const node = nodes[nodesLength];\n const nodeName = node.nodeName.toLowerCase();\n if (nodeName === 'track') {\n if (!this.featuresNativeTextTracks) {\n // Empty video tag tracks so the built-in player doesn't use them also.\n // This may not be fast enough to stop HTML5 browsers from reading the tags\n // so we'll need to turn off any default tracks if we're manually doing\n // captions and subtitles. videoElement.textTracks\n removeNodes.push(node);\n } else {\n // store HTMLTrackElement and TextTrack to remote list\n this.remoteTextTrackEls().addTrackElement_(node);\n this.remoteTextTracks().addTrack(node.track);\n this.textTracks().addTrack(node.track);\n if (!crossoriginTracks && !this.el_.hasAttribute('crossorigin') && isCrossOrigin(node.src)) {\n crossoriginTracks = true;\n }\n }\n }\n }\n for (let i = 0; i < removeNodes.length; i++) {\n this.el_.removeChild(removeNodes[i]);\n }\n }\n this.proxyNativeTracks_();\n if (this.featuresNativeTextTracks && crossoriginTracks) {\n log$1.warn('Text Tracks are being loaded from another origin but the crossorigin attribute isn\\'t used.\\n' + 'This may prevent text tracks from loading.');\n }\n\n // prevent iOS Safari from disabling metadata text tracks during native playback\n this.restoreMetadataTracksInIOSNativePlayer_();\n\n // Determine if native controls should be used\n // Our goal should be to get the custom controls on mobile solid everywhere\n // so we can remove this all together. Right now this will block custom\n // controls on touch enabled laptops like the Chrome Pixel\n if ((TOUCH_ENABLED || IS_IPHONE) && options.nativeControlsForTouch === true) {\n this.setControls(true);\n }\n\n // on iOS, we want to proxy `webkitbeginfullscreen` and `webkitendfullscreen`\n // into a `fullscreenchange` event\n this.proxyWebkitFullscreen_();\n this.triggerReady();\n }\n\n /**\n * Dispose of `HTML5` media element and remove all tracks.\n */\n dispose() {\n if (this.el_ && this.el_.resetSourceset_) {\n this.el_.resetSourceset_();\n }\n Html5.disposeMediaElement(this.el_);\n this.options_ = null;\n\n // tech will handle clearing of the emulated track list\n super.dispose();\n }\n\n /**\n * Modify the media element so that we can detect when\n * the source is changed. Fires `sourceset` just after the source has changed\n */\n setupSourcesetHandling_() {\n setupSourceset(this);\n }\n\n /**\n * When a captions track is enabled in the iOS Safari native player, all other\n * tracks are disabled (including metadata tracks), which nulls all of their\n * associated cue points. This will restore metadata tracks to their pre-fullscreen\n * state in those cases so that cue points are not needlessly lost.\n *\n * @private\n */\n restoreMetadataTracksInIOSNativePlayer_() {\n const textTracks = this.textTracks();\n let metadataTracksPreFullscreenState;\n\n // captures a snapshot of every metadata track's current state\n const takeMetadataTrackSnapshot = () => {\n metadataTracksPreFullscreenState = [];\n for (let i = 0; i < textTracks.length; i++) {\n const track = textTracks[i];\n if (track.kind === 'metadata') {\n metadataTracksPreFullscreenState.push({\n track,\n storedMode: track.mode\n });\n }\n }\n };\n\n // snapshot each metadata track's initial state, and update the snapshot\n // each time there is a track 'change' event\n takeMetadataTrackSnapshot();\n textTracks.addEventListener('change', takeMetadataTrackSnapshot);\n this.on('dispose', () => textTracks.removeEventListener('change', takeMetadataTrackSnapshot));\n const restoreTrackMode = () => {\n for (let i = 0; i < metadataTracksPreFullscreenState.length; i++) {\n const storedTrack = metadataTracksPreFullscreenState[i];\n if (storedTrack.track.mode === 'disabled' && storedTrack.track.mode !== storedTrack.storedMode) {\n storedTrack.track.mode = storedTrack.storedMode;\n }\n }\n // we only want this handler to be executed on the first 'change' event\n textTracks.removeEventListener('change', restoreTrackMode);\n };\n\n // when we enter fullscreen playback, stop updating the snapshot and\n // restore all track modes to their pre-fullscreen state\n this.on('webkitbeginfullscreen', () => {\n textTracks.removeEventListener('change', takeMetadataTrackSnapshot);\n\n // remove the listener before adding it just in case it wasn't previously removed\n textTracks.removeEventListener('change', restoreTrackMode);\n textTracks.addEventListener('change', restoreTrackMode);\n });\n\n // start updating the snapshot again after leaving fullscreen\n this.on('webkitendfullscreen', () => {\n // remove the listener before adding it just in case it wasn't previously removed\n textTracks.removeEventListener('change', takeMetadataTrackSnapshot);\n textTracks.addEventListener('change', takeMetadataTrackSnapshot);\n\n // remove the restoreTrackMode handler in case it wasn't triggered during fullscreen playback\n textTracks.removeEventListener('change', restoreTrackMode);\n });\n }\n\n /**\n * Attempt to force override of tracks for the given type\n *\n * @param {string} type - Track type to override, possible values include 'Audio',\n * 'Video', and 'Text'.\n * @param {boolean} override - If set to true native audio/video will be overridden,\n * otherwise native audio/video will potentially be used.\n * @private\n */\n overrideNative_(type, override) {\n // If there is no behavioral change don't add/remove listeners\n if (override !== this[`featuresNative${type}Tracks`]) {\n return;\n }\n const lowerCaseType = type.toLowerCase();\n if (this[`${lowerCaseType}TracksListeners_`]) {\n Object.keys(this[`${lowerCaseType}TracksListeners_`]).forEach(eventName => {\n const elTracks = this.el()[`${lowerCaseType}Tracks`];\n elTracks.removeEventListener(eventName, this[`${lowerCaseType}TracksListeners_`][eventName]);\n });\n }\n this[`featuresNative${type}Tracks`] = !override;\n this[`${lowerCaseType}TracksListeners_`] = null;\n this.proxyNativeTracksForType_(lowerCaseType);\n }\n\n /**\n * Attempt to force override of native audio tracks.\n *\n * @param {boolean} override - If set to true native audio will be overridden,\n * otherwise native audio will potentially be used.\n */\n overrideNativeAudioTracks(override) {\n this.overrideNative_('Audio', override);\n }\n\n /**\n * Attempt to force override of native video tracks.\n *\n * @param {boolean} override - If set to true native video will be overridden,\n * otherwise native video will potentially be used.\n */\n overrideNativeVideoTracks(override) {\n this.overrideNative_('Video', override);\n }\n\n /**\n * Proxy native track list events for the given type to our track\n * lists if the browser we are playing in supports that type of track list.\n *\n * @param {string} name - Track type; values include 'audio', 'video', and 'text'\n * @private\n */\n proxyNativeTracksForType_(name) {\n const props = NORMAL[name];\n const elTracks = this.el()[props.getterName];\n const techTracks = this[props.getterName]();\n if (!this[`featuresNative${props.capitalName}Tracks`] || !elTracks || !elTracks.addEventListener) {\n return;\n }\n const listeners = {\n change: e => {\n const event = {\n type: 'change',\n target: techTracks,\n currentTarget: techTracks,\n srcElement: techTracks\n };\n techTracks.trigger(event);\n\n // if we are a text track change event, we should also notify the\n // remote text track list. This can potentially cause a false positive\n // if we were to get a change event on a non-remote track and\n // we triggered the event on the remote text track list which doesn't\n // contain that track. However, best practices mean looping through the\n // list of tracks and searching for the appropriate mode value, so,\n // this shouldn't pose an issue\n if (name === 'text') {\n this[REMOTE.remoteText.getterName]().trigger(event);\n }\n },\n addtrack(e) {\n techTracks.addTrack(e.track);\n },\n removetrack(e) {\n techTracks.removeTrack(e.track);\n }\n };\n const removeOldTracks = function () {\n const removeTracks = [];\n for (let i = 0; i < techTracks.length; i++) {\n let found = false;\n for (let j = 0; j < elTracks.length; j++) {\n if (elTracks[j] === techTracks[i]) {\n found = true;\n break;\n }\n }\n if (!found) {\n removeTracks.push(techTracks[i]);\n }\n }\n while (removeTracks.length) {\n techTracks.removeTrack(removeTracks.shift());\n }\n };\n this[props.getterName + 'Listeners_'] = listeners;\n Object.keys(listeners).forEach(eventName => {\n const listener = listeners[eventName];\n elTracks.addEventListener(eventName, listener);\n this.on('dispose', e => elTracks.removeEventListener(eventName, listener));\n });\n\n // Remove (native) tracks that are not used anymore\n this.on('loadstart', removeOldTracks);\n this.on('dispose', e => this.off('loadstart', removeOldTracks));\n }\n\n /**\n * Proxy all native track list events to our track lists if the browser we are playing\n * in supports that type of track list.\n *\n * @private\n */\n proxyNativeTracks_() {\n NORMAL.names.forEach(name => {\n this.proxyNativeTracksForType_(name);\n });\n }\n\n /**\n * Create the `Html5` Tech's DOM element.\n *\n * @return {Element}\n * The element that gets created.\n */\n createEl() {\n let el = this.options_.tag;\n\n // Check if this browser supports moving the element into the box.\n // On the iPhone video will break if you move the element,\n // So we have to create a brand new element.\n // If we ingested the player div, we do not need to move the media element.\n if (!el || !(this.options_.playerElIngest || this.movingMediaElementInDOM)) {\n // If the original tag is still there, clone and remove it.\n if (el) {\n const clone = el.cloneNode(true);\n if (el.parentNode) {\n el.parentNode.insertBefore(clone, el);\n }\n Html5.disposeMediaElement(el);\n el = clone;\n } else {\n el = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video');\n\n // determine if native controls should be used\n const tagAttributes = this.options_.tag && getAttributes(this.options_.tag);\n const attributes = merge$1({}, tagAttributes);\n if (!TOUCH_ENABLED || this.options_.nativeControlsForTouch !== true) {\n delete attributes.controls;\n }\n setAttributes(el, Object.assign(attributes, {\n id: this.options_.techId,\n class: 'vjs-tech'\n }));\n }\n el.playerId = this.options_.playerId;\n }\n if (typeof this.options_.preload !== 'undefined') {\n setAttribute(el, 'preload', this.options_.preload);\n }\n if (this.options_.disablePictureInPicture !== undefined) {\n el.disablePictureInPicture = this.options_.disablePictureInPicture;\n }\n\n // Update specific tag settings, in case they were overridden\n // `autoplay` has to be *last* so that `muted` and `playsinline` are present\n // when iOS/Safari or other browsers attempt to autoplay.\n const settingsAttrs = ['loop', 'muted', 'playsinline', 'autoplay'];\n for (let i = 0; i < settingsAttrs.length; i++) {\n const attr = settingsAttrs[i];\n const value = this.options_[attr];\n if (typeof value !== 'undefined') {\n if (value) {\n setAttribute(el, attr, attr);\n } else {\n removeAttribute(el, attr);\n }\n el[attr] = value;\n }\n }\n return el;\n }\n\n /**\n * This will be triggered if the loadstart event has already fired, before videojs was\n * ready. Two known examples of when this can happen are:\n * 1. If we're loading the playback object after it has started loading\n * 2. The media is already playing the (often with autoplay on) then\n *\n * This function will fire another loadstart so that videojs can catchup.\n *\n * @fires Tech#loadstart\n *\n * @return {undefined}\n * returns nothing.\n */\n handleLateInit_(el) {\n if (el.networkState === 0 || el.networkState === 3) {\n // The video element hasn't started loading the source yet\n // or didn't find a source\n return;\n }\n if (el.readyState === 0) {\n // NetworkState is set synchronously BUT loadstart is fired at the\n // end of the current stack, usually before setInterval(fn, 0).\n // So at this point we know loadstart may have already fired or is\n // about to fire, and either way the player hasn't seen it yet.\n // We don't want to fire loadstart prematurely here and cause a\n // double loadstart so we'll wait and see if it happens between now\n // and the next loop, and fire it if not.\n // HOWEVER, we also want to make sure it fires before loadedmetadata\n // which could also happen between now and the next loop, so we'll\n // watch for that also.\n let loadstartFired = false;\n const setLoadstartFired = function () {\n loadstartFired = true;\n };\n this.on('loadstart', setLoadstartFired);\n const triggerLoadstart = function () {\n // We did miss the original loadstart. Make sure the player\n // sees loadstart before loadedmetadata\n if (!loadstartFired) {\n this.trigger('loadstart');\n }\n };\n this.on('loadedmetadata', triggerLoadstart);\n this.ready(function () {\n this.off('loadstart', setLoadstartFired);\n this.off('loadedmetadata', triggerLoadstart);\n if (!loadstartFired) {\n // We did miss the original native loadstart. Fire it now.\n this.trigger('loadstart');\n }\n });\n return;\n }\n\n // From here on we know that loadstart already fired and we missed it.\n // The other readyState events aren't as much of a problem if we double\n // them, so not going to go to as much trouble as loadstart to prevent\n // that unless we find reason to.\n const eventsToTrigger = ['loadstart'];\n\n // loadedmetadata: newly equal to HAVE_METADATA (1) or greater\n eventsToTrigger.push('loadedmetadata');\n\n // loadeddata: newly increased to HAVE_CURRENT_DATA (2) or greater\n if (el.readyState >= 2) {\n eventsToTrigger.push('loadeddata');\n }\n\n // canplay: newly increased to HAVE_FUTURE_DATA (3) or greater\n if (el.readyState >= 3) {\n eventsToTrigger.push('canplay');\n }\n\n // canplaythrough: newly equal to HAVE_ENOUGH_DATA (4)\n if (el.readyState >= 4) {\n eventsToTrigger.push('canplaythrough');\n }\n\n // We still need to give the player time to add event listeners\n this.ready(function () {\n eventsToTrigger.forEach(function (type) {\n this.trigger(type);\n }, this);\n });\n }\n\n /**\n * Set whether we are scrubbing or not.\n * This is used to decide whether we should use `fastSeek` or not.\n * `fastSeek` is used to provide trick play on Safari browsers.\n *\n * @param {boolean} isScrubbing\n * - true for we are currently scrubbing\n * - false for we are no longer scrubbing\n */\n setScrubbing(isScrubbing) {\n this.isScrubbing_ = isScrubbing;\n }\n\n /**\n * Get whether we are scrubbing or not.\n *\n * @return {boolean} isScrubbing\n * - true for we are currently scrubbing\n * - false for we are no longer scrubbing\n */\n scrubbing() {\n return this.isScrubbing_;\n }\n\n /**\n * Set current time for the `HTML5` tech.\n *\n * @param {number} seconds\n * Set the current time of the media to this.\n */\n setCurrentTime(seconds) {\n try {\n if (this.isScrubbing_ && this.el_.fastSeek && IS_ANY_SAFARI) {\n this.el_.fastSeek(seconds);\n } else {\n this.el_.currentTime = seconds;\n }\n } catch (e) {\n log$1(e, 'Video is not ready. (Video.js)');\n // this.warning(VideoJS.warnings.videoNotReady);\n }\n }\n\n /**\n * Get the current duration of the HTML5 media element.\n *\n * @return {number}\n * The duration of the media or 0 if there is no duration.\n */\n duration() {\n // Android Chrome will report duration as Infinity for VOD HLS until after\n // playback has started, which triggers the live display erroneously.\n // Return NaN if playback has not started and trigger a durationupdate once\n // the duration can be reliably known.\n if (this.el_.duration === Infinity && IS_ANDROID && IS_CHROME && this.el_.currentTime === 0) {\n // Wait for the first `timeupdate` with currentTime > 0 - there may be\n // several with 0\n const checkProgress = () => {\n if (this.el_.currentTime > 0) {\n // Trigger durationchange for genuinely live video\n if (this.el_.duration === Infinity) {\n this.trigger('durationchange');\n }\n this.off('timeupdate', checkProgress);\n }\n };\n this.on('timeupdate', checkProgress);\n return NaN;\n }\n return this.el_.duration || NaN;\n }\n\n /**\n * Get the current width of the HTML5 media element.\n *\n * @return {number}\n * The width of the HTML5 media element.\n */\n width() {\n return this.el_.offsetWidth;\n }\n\n /**\n * Get the current height of the HTML5 media element.\n *\n * @return {number}\n * The height of the HTML5 media element.\n */\n height() {\n return this.el_.offsetHeight;\n }\n\n /**\n * Proxy iOS `webkitbeginfullscreen` and `webkitendfullscreen` into\n * `fullscreenchange` event.\n *\n * @private\n * @fires fullscreenchange\n * @listens webkitendfullscreen\n * @listens webkitbeginfullscreen\n * @listens webkitbeginfullscreen\n */\n proxyWebkitFullscreen_() {\n if (!('webkitDisplayingFullscreen' in this.el_)) {\n return;\n }\n const endFn = function () {\n this.trigger('fullscreenchange', {\n isFullscreen: false\n });\n // Safari will sometimes set controls on the videoelement when existing fullscreen.\n if (this.el_.controls && !this.options_.nativeControlsForTouch && this.controls()) {\n this.el_.controls = false;\n }\n };\n const beginFn = function () {\n if ('webkitPresentationMode' in this.el_ && this.el_.webkitPresentationMode !== 'picture-in-picture') {\n this.one('webkitendfullscreen', endFn);\n this.trigger('fullscreenchange', {\n isFullscreen: true,\n // set a flag in case another tech triggers fullscreenchange\n nativeIOSFullscreen: true\n });\n }\n };\n this.on('webkitbeginfullscreen', beginFn);\n this.on('dispose', () => {\n this.off('webkitbeginfullscreen', beginFn);\n this.off('webkitendfullscreen', endFn);\n });\n }\n\n /**\n * Check if fullscreen is supported on the video el.\n *\n * @return {boolean}\n * - True if fullscreen is supported.\n * - False if fullscreen is not supported.\n */\n supportsFullScreen() {\n return typeof this.el_.webkitEnterFullScreen === 'function';\n }\n\n /**\n * Request that the `HTML5` Tech enter fullscreen.\n */\n enterFullScreen() {\n const video = this.el_;\n if (video.paused && video.networkState <= video.HAVE_METADATA) {\n // attempt to prime the video element for programmatic access\n // this isn't necessary on the desktop but shouldn't hurt\n silencePromise(this.el_.play());\n\n // playing and pausing synchronously during the transition to fullscreen\n // can get iOS ~6.1 devices into a play/pause loop\n this.setTimeout(function () {\n video.pause();\n try {\n video.webkitEnterFullScreen();\n } catch (e) {\n this.trigger('fullscreenerror', e);\n }\n }, 0);\n } else {\n try {\n video.webkitEnterFullScreen();\n } catch (e) {\n this.trigger('fullscreenerror', e);\n }\n }\n }\n\n /**\n * Request that the `HTML5` Tech exit fullscreen.\n */\n exitFullScreen() {\n if (!this.el_.webkitDisplayingFullscreen) {\n this.trigger('fullscreenerror', new Error('The video is not fullscreen'));\n return;\n }\n this.el_.webkitExitFullScreen();\n }\n\n /**\n * Create a floating video window always on top of other windows so that users may\n * continue consuming media while they interact with other content sites, or\n * applications on their device.\n *\n * @see [Spec]{@link https://wicg.github.io/picture-in-picture}\n *\n * @return {Promise}\n * A promise with a Picture-in-Picture window.\n */\n requestPictureInPicture() {\n return this.el_.requestPictureInPicture();\n }\n\n /**\n * Native requestVideoFrameCallback if supported by browser/tech, or fallback\n * Don't use rVCF on Safari when DRM is playing, as it doesn't fire\n * Needs to be checked later than the constructor\n * This will be a false positive for clear sources loaded after a Fairplay source\n *\n * @param {function} cb function to call\n * @return {number} id of request\n */\n requestVideoFrameCallback(cb) {\n if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {\n return this.el_.requestVideoFrameCallback(cb);\n }\n return super.requestVideoFrameCallback(cb);\n }\n\n /**\n * Native or fallback requestVideoFrameCallback\n *\n * @param {number} id request id to cancel\n */\n cancelVideoFrameCallback(id) {\n if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {\n this.el_.cancelVideoFrameCallback(id);\n } else {\n super.cancelVideoFrameCallback(id);\n }\n }\n\n /**\n * A getter/setter for the `Html5` Tech's source object.\n * > Note: Please use {@link Html5#setSource}\n *\n * @param {Tech~SourceObject} [src]\n * The source object you want to set on the `HTML5` techs element.\n *\n * @return {Tech~SourceObject|undefined}\n * - The current source object when a source is not passed in.\n * - undefined when setting\n *\n * @deprecated Since version 5.\n */\n src(src) {\n if (src === undefined) {\n return this.el_.src;\n }\n\n // Setting src through `src` instead of `setSrc` will be deprecated\n this.setSrc(src);\n }\n\n /**\n * Reset the tech by removing all sources and then calling\n * {@link Html5.resetMediaElement}.\n */\n reset() {\n Html5.resetMediaElement(this.el_);\n }\n\n /**\n * Get the current source on the `HTML5` Tech. Falls back to returning the source from\n * the HTML5 media element.\n *\n * @return {Tech~SourceObject}\n * The current source object from the HTML5 tech. With a fallback to the\n * elements source.\n */\n currentSrc() {\n if (this.currentSource_) {\n return this.currentSource_.src;\n }\n return this.el_.currentSrc;\n }\n\n /**\n * Set controls attribute for the HTML5 media Element.\n *\n * @param {string} val\n * Value to set the controls attribute to\n */\n setControls(val) {\n this.el_.controls = !!val;\n }\n\n /**\n * Create and returns a remote {@link TextTrack} object.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @return {TextTrack}\n * The TextTrack that gets created.\n */\n addTextTrack(kind, label, language) {\n if (!this.featuresNativeTextTracks) {\n return super.addTextTrack(kind, label, language);\n }\n return this.el_.addTextTrack(kind, label, language);\n }\n\n /**\n * Creates either native TextTrack or an emulated TextTrack depending\n * on the value of `featuresNativeTextTracks`\n *\n * @param {Object} options\n * The object should contain the options to initialize the TextTrack with.\n *\n * @param {string} [options.kind]\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata).\n *\n * @param {string} [options.label]\n * Label to identify the text track\n *\n * @param {string} [options.language]\n * Two letter language abbreviation.\n *\n * @param {boolean} [options.default]\n * Default this track to on.\n *\n * @param {string} [options.id]\n * The internal id to assign this track.\n *\n * @param {string} [options.src]\n * A source url for the track.\n *\n * @return {HTMLTrackElement}\n * The track element that gets created.\n */\n createRemoteTextTrack(options) {\n if (!this.featuresNativeTextTracks) {\n return super.createRemoteTextTrack(options);\n }\n const htmlTrackElement = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('track');\n if (options.kind) {\n htmlTrackElement.kind = options.kind;\n }\n if (options.label) {\n htmlTrackElement.label = options.label;\n }\n if (options.language || options.srclang) {\n htmlTrackElement.srclang = options.language || options.srclang;\n }\n if (options.default) {\n htmlTrackElement.default = options.default;\n }\n if (options.id) {\n htmlTrackElement.id = options.id;\n }\n if (options.src) {\n htmlTrackElement.src = options.src;\n }\n return htmlTrackElement;\n }\n\n /**\n * Creates a remote text track object and returns an html track element.\n *\n * @param {Object} options The object should contain values for\n * kind, language, label, and src (location of the WebVTT file)\n * @param {boolean} [manualCleanup=false] if set to true, the TextTrack\n * will not be removed from the TextTrackList and HtmlTrackElementList\n * after a source change\n * @return {HTMLTrackElement} An Html Track Element.\n * This can be an emulated {@link HTMLTrackElement} or a native one.\n *\n */\n addRemoteTextTrack(options, manualCleanup) {\n const htmlTrackElement = super.addRemoteTextTrack(options, manualCleanup);\n if (this.featuresNativeTextTracks) {\n this.el().appendChild(htmlTrackElement);\n }\n return htmlTrackElement;\n }\n\n /**\n * Remove remote `TextTrack` from `TextTrackList` object\n *\n * @param {TextTrack} track\n * `TextTrack` object to remove\n */\n removeRemoteTextTrack(track) {\n super.removeRemoteTextTrack(track);\n if (this.featuresNativeTextTracks) {\n const tracks = this.$$('track');\n let i = tracks.length;\n while (i--) {\n if (track === tracks[i] || track === tracks[i].track) {\n this.el().removeChild(tracks[i]);\n }\n }\n }\n }\n\n /**\n * Gets available media playback quality metrics as specified by the W3C's Media\n * Playback Quality API.\n *\n * @see [Spec]{@link https://wicg.github.io/media-playback-quality}\n *\n * @return {Object}\n * An object with supported media playback quality metrics\n */\n getVideoPlaybackQuality() {\n if (typeof this.el().getVideoPlaybackQuality === 'function') {\n return this.el().getVideoPlaybackQuality();\n }\n const videoPlaybackQuality = {};\n if (typeof this.el().webkitDroppedFrameCount !== 'undefined' && typeof this.el().webkitDecodedFrameCount !== 'undefined') {\n videoPlaybackQuality.droppedVideoFrames = this.el().webkitDroppedFrameCount;\n videoPlaybackQuality.totalVideoFrames = this.el().webkitDecodedFrameCount;\n }\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().performance)) {\n videoPlaybackQuality.creationTime = global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now();\n }\n return videoPlaybackQuality;\n }\n}\n\n/* HTML5 Support Testing ---------------------------------------------------- */\n\n/**\n * Element for testing browser HTML5 media capabilities\n *\n * @type {Element}\n * @constant\n * @private\n */\ndefineLazyProperty(Html5, 'TEST_VID', function () {\n if (!isReal()) {\n return;\n }\n const video = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video');\n const track = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('track');\n track.kind = 'captions';\n track.srclang = 'en';\n track.label = 'English';\n video.appendChild(track);\n return video;\n});\n\n/**\n * Check if HTML5 media is supported by this browser/device.\n *\n * @return {boolean}\n * - True if HTML5 media is supported.\n * - False if HTML5 media is not supported.\n */\nHtml5.isSupported = function () {\n // IE with no Media Player is a LIAR! (#984)\n try {\n Html5.TEST_VID.volume = 0.5;\n } catch (e) {\n return false;\n }\n return !!(Html5.TEST_VID && Html5.TEST_VID.canPlayType);\n};\n\n/**\n * Check if the tech can support the given type\n *\n * @param {string} type\n * The mimetype to check\n * @return {string} 'probably', 'maybe', or '' (empty string)\n */\nHtml5.canPlayType = function (type) {\n return Html5.TEST_VID.canPlayType(type);\n};\n\n/**\n * Check if the tech can support the given source\n *\n * @param {Object} srcObj\n * The source object\n * @param {Object} options\n * The options passed to the tech\n * @return {string} 'probably', 'maybe', or '' (empty string)\n */\nHtml5.canPlaySource = function (srcObj, options) {\n return Html5.canPlayType(srcObj.type);\n};\n\n/**\n * Check if the volume can be changed in this browser/device.\n * Volume cannot be changed in a lot of mobile devices.\n * Specifically, it can't be changed from 1 on iOS.\n *\n * @return {boolean}\n * - True if volume can be controlled\n * - False otherwise\n */\nHtml5.canControlVolume = function () {\n // IE will error if Windows Media Player not installed #3315\n try {\n const volume = Html5.TEST_VID.volume;\n Html5.TEST_VID.volume = volume / 2 + 0.1;\n const canControl = volume !== Html5.TEST_VID.volume;\n\n // With the introduction of iOS 15, there are cases where the volume is read as\n // changed but reverts back to its original state at the start of the next tick.\n // To determine whether volume can be controlled on iOS,\n // a timeout is set and the volume is checked asynchronously.\n // Since `features` doesn't currently work asynchronously, the value is manually set.\n if (canControl && IS_IOS) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => {\n if (Html5 && Html5.prototype) {\n Html5.prototype.featuresVolumeControl = volume !== Html5.TEST_VID.volume;\n }\n });\n\n // default iOS to false, which will be updated in the timeout above.\n return false;\n }\n return canControl;\n } catch (e) {\n return false;\n }\n};\n\n/**\n * Check if the volume can be muted in this browser/device.\n * Some devices, e.g. iOS, don't allow changing volume\n * but permits muting/unmuting.\n *\n * @return {boolean}\n * - True if volume can be muted\n * - False otherwise\n */\nHtml5.canMuteVolume = function () {\n try {\n const muted = Html5.TEST_VID.muted;\n\n // in some versions of iOS muted property doesn't always\n // work, so we want to set both property and attribute\n Html5.TEST_VID.muted = !muted;\n if (Html5.TEST_VID.muted) {\n setAttribute(Html5.TEST_VID, 'muted', 'muted');\n } else {\n removeAttribute(Html5.TEST_VID, 'muted', 'muted');\n }\n return muted !== Html5.TEST_VID.muted;\n } catch (e) {\n return false;\n }\n};\n\n/**\n * Check if the playback rate can be changed in this browser/device.\n *\n * @return {boolean}\n * - True if playback rate can be controlled\n * - False otherwise\n */\nHtml5.canControlPlaybackRate = function () {\n // Playback rate API is implemented in Android Chrome, but doesn't do anything\n // https://github.com/videojs/video.js/issues/3180\n if (IS_ANDROID && IS_CHROME && CHROME_VERSION < 58) {\n return false;\n }\n // IE will error if Windows Media Player not installed #3315\n try {\n const playbackRate = Html5.TEST_VID.playbackRate;\n Html5.TEST_VID.playbackRate = playbackRate / 2 + 0.1;\n return playbackRate !== Html5.TEST_VID.playbackRate;\n } catch (e) {\n return false;\n }\n};\n\n/**\n * Check if we can override a video/audio elements attributes, with\n * Object.defineProperty.\n *\n * @return {boolean}\n * - True if builtin attributes can be overridden\n * - False otherwise\n */\nHtml5.canOverrideAttributes = function () {\n // if we cannot overwrite the src/innerHTML property, there is no support\n // iOS 7 safari for instance cannot do this.\n try {\n const noop = () => {};\n Object.defineProperty(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video'), 'src', {\n get: noop,\n set: noop\n });\n Object.defineProperty(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('audio'), 'src', {\n get: noop,\n set: noop\n });\n Object.defineProperty(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video'), 'innerHTML', {\n get: noop,\n set: noop\n });\n Object.defineProperty(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('audio'), 'innerHTML', {\n get: noop,\n set: noop\n });\n } catch (e) {\n return false;\n }\n return true;\n};\n\n/**\n * Check to see if native `TextTrack`s are supported by this browser/device.\n *\n * @return {boolean}\n * - True if native `TextTrack`s are supported.\n * - False otherwise\n */\nHtml5.supportsNativeTextTracks = function () {\n return IS_ANY_SAFARI || IS_IOS && IS_CHROME;\n};\n\n/**\n * Check to see if native `VideoTrack`s are supported by this browser/device\n *\n * @return {boolean}\n * - True if native `VideoTrack`s are supported.\n * - False otherwise\n */\nHtml5.supportsNativeVideoTracks = function () {\n return !!(Html5.TEST_VID && Html5.TEST_VID.videoTracks);\n};\n\n/**\n * Check to see if native `AudioTrack`s are supported by this browser/device\n *\n * @return {boolean}\n * - True if native `AudioTrack`s are supported.\n * - False otherwise\n */\nHtml5.supportsNativeAudioTracks = function () {\n return !!(Html5.TEST_VID && Html5.TEST_VID.audioTracks);\n};\n\n/**\n * An array of events available on the Html5 tech.\n *\n * @private\n * @type {Array}\n */\nHtml5.Events = ['loadstart', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'loadedmetadata', 'loadeddata', 'canplay', 'canplaythrough', 'playing', 'waiting', 'seeking', 'seeked', 'ended', 'durationchange', 'timeupdate', 'progress', 'play', 'pause', 'ratechange', 'resize', 'volumechange'];\n\n/**\n * Boolean indicating whether the `Tech` supports volume control.\n *\n * @type {boolean}\n * @default {@link Html5.canControlVolume}\n */\n/**\n * Boolean indicating whether the `Tech` supports muting volume.\n *\n * @type {boolean}\n * @default {@link Html5.canMuteVolume}\n */\n\n/**\n * Boolean indicating whether the `Tech` supports changing the speed at which the media\n * plays. Examples:\n * - Set player to play 2x (twice) as fast\n * - Set player to play 0.5x (half) as fast\n *\n * @type {boolean}\n * @default {@link Html5.canControlPlaybackRate}\n */\n\n/**\n * Boolean indicating whether the `Tech` supports the `sourceset` event.\n *\n * @type {boolean}\n * @default\n */\n/**\n * Boolean indicating whether the `HTML5` tech currently supports native `TextTrack`s.\n *\n * @type {boolean}\n * @default {@link Html5.supportsNativeTextTracks}\n */\n/**\n * Boolean indicating whether the `HTML5` tech currently supports native `VideoTrack`s.\n *\n * @type {boolean}\n * @default {@link Html5.supportsNativeVideoTracks}\n */\n/**\n * Boolean indicating whether the `HTML5` tech currently supports native `AudioTrack`s.\n *\n * @type {boolean}\n * @default {@link Html5.supportsNativeAudioTracks}\n */\n[['featuresMuteControl', 'canMuteVolume'], ['featuresPlaybackRate', 'canControlPlaybackRate'], ['featuresSourceset', 'canOverrideAttributes'], ['featuresNativeTextTracks', 'supportsNativeTextTracks'], ['featuresNativeVideoTracks', 'supportsNativeVideoTracks'], ['featuresNativeAudioTracks', 'supportsNativeAudioTracks']].forEach(function ([key, fn]) {\n defineLazyProperty(Html5.prototype, key, () => Html5[fn](), true);\n});\nHtml5.prototype.featuresVolumeControl = Html5.canControlVolume();\n\n/**\n * Boolean indicating whether the `HTML5` tech currently supports the media element\n * moving in the DOM. iOS breaks if you move the media element, so this is set this to\n * false there. Everywhere else this should be true.\n *\n * @type {boolean}\n * @default\n */\nHtml5.prototype.movingMediaElementInDOM = !IS_IOS;\n\n// TODO: Previous comment: No longer appears to be used. Can probably be removed.\n// Is this true?\n/**\n * Boolean indicating whether the `HTML5` tech currently supports automatic media resize\n * when going into fullscreen.\n *\n * @type {boolean}\n * @default\n */\nHtml5.prototype.featuresFullscreenResize = true;\n\n/**\n * Boolean indicating whether the `HTML5` tech currently supports the progress event.\n * If this is false, manual `progress` events will be triggered instead.\n *\n * @type {boolean}\n * @default\n */\nHtml5.prototype.featuresProgressEvents = true;\n\n/**\n * Boolean indicating whether the `HTML5` tech currently supports the timeupdate event.\n * If this is false, manual `timeupdate` events will be triggered instead.\n *\n * @default\n */\nHtml5.prototype.featuresTimeupdateEvents = true;\n\n/**\n * Whether the HTML5 el supports `requestVideoFrameCallback`\n *\n * @type {boolean}\n */\nHtml5.prototype.featuresVideoFrameCallback = !!(Html5.TEST_VID && Html5.TEST_VID.requestVideoFrameCallback);\nHtml5.disposeMediaElement = function (el) {\n if (!el) {\n return;\n }\n if (el.parentNode) {\n el.parentNode.removeChild(el);\n }\n\n // remove any child track or source nodes to prevent their loading\n while (el.hasChildNodes()) {\n el.removeChild(el.firstChild);\n }\n\n // remove any src reference. not setting `src=''` because that causes a warning\n // in firefox\n el.removeAttribute('src');\n\n // force the media element to update its loading state by calling load()\n // however IE on Windows 7N has a bug that throws an error so need a try/catch (#793)\n if (typeof el.load === 'function') {\n // wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473)\n (function () {\n try {\n el.load();\n } catch (e) {\n // not supported\n }\n })();\n }\n};\nHtml5.resetMediaElement = function (el) {\n if (!el) {\n return;\n }\n const sources = el.querySelectorAll('source');\n let i = sources.length;\n while (i--) {\n el.removeChild(sources[i]);\n }\n\n // remove any src reference.\n // not setting `src=''` because that throws an error\n el.removeAttribute('src');\n if (typeof el.load === 'function') {\n // wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473)\n (function () {\n try {\n el.load();\n } catch (e) {\n // satisfy linter\n }\n })();\n }\n};\n\n/* Native HTML5 element property wrapping ----------------------------------- */\n// Wrap native boolean attributes with getters that check both property and attribute\n// The list is as followed:\n// muted, defaultMuted, autoplay, controls, loop, playsinline\n[\n/**\n * Get the value of `muted` from the media element. `muted` indicates\n * that the volume for the media should be set to silent. This does not actually change\n * the `volume` attribute.\n *\n * @method Html5#muted\n * @return {boolean}\n * - True if the value of `volume` should be ignored and the audio set to silent.\n * - False if the value of `volume` should be used.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-muted}\n */\n'muted',\n/**\n * Get the value of `defaultMuted` from the media element. `defaultMuted` indicates\n * whether the media should start muted or not. Only changes the default state of the\n * media. `muted` and `defaultMuted` can have different values. {@link Html5#muted} indicates the\n * current state.\n *\n * @method Html5#defaultMuted\n * @return {boolean}\n * - The value of `defaultMuted` from the media element.\n * - True indicates that the media should start muted.\n * - False indicates that the media should not start muted\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultmuted}\n */\n'defaultMuted',\n/**\n * Get the value of `autoplay` from the media element. `autoplay` indicates\n * that the media should start to play as soon as the page is ready.\n *\n * @method Html5#autoplay\n * @return {boolean}\n * - The value of `autoplay` from the media element.\n * - True indicates that the media should start as soon as the page loads.\n * - False indicates that the media should not start as soon as the page loads.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-autoplay}\n */\n'autoplay',\n/**\n * Get the value of `controls` from the media element. `controls` indicates\n * whether the native media controls should be shown or hidden.\n *\n * @method Html5#controls\n * @return {boolean}\n * - The value of `controls` from the media element.\n * - True indicates that native controls should be showing.\n * - False indicates that native controls should be hidden.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-controls}\n */\n'controls',\n/**\n * Get the value of `loop` from the media element. `loop` indicates\n * that the media should return to the start of the media and continue playing once\n * it reaches the end.\n *\n * @method Html5#loop\n * @return {boolean}\n * - The value of `loop` from the media element.\n * - True indicates that playback should seek back to start once\n * the end of a media is reached.\n * - False indicates that playback should not loop back to the start when the\n * end of the media is reached.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-loop}\n */\n'loop',\n/**\n * Get the value of `playsinline` from the media element. `playsinline` indicates\n * to the browser that non-fullscreen playback is preferred when fullscreen\n * playback is the native default, such as in iOS Safari.\n *\n * @method Html5#playsinline\n * @return {boolean}\n * - The value of `playsinline` from the media element.\n * - True indicates that the media should play inline.\n * - False indicates that the media should not play inline.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline}\n */\n'playsinline'].forEach(function (prop) {\n Html5.prototype[prop] = function () {\n return this.el_[prop] || this.el_.hasAttribute(prop);\n };\n});\n\n// Wrap native boolean attributes with setters that set both property and attribute\n// The list is as followed:\n// setMuted, setDefaultMuted, setAutoplay, setLoop, setPlaysinline\n// setControls is special-cased above\n[\n/**\n * Set the value of `muted` on the media element. `muted` indicates that the current\n * audio level should be silent.\n *\n * @method Html5#setMuted\n * @param {boolean} muted\n * - True if the audio should be set to silent\n * - False otherwise\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-muted}\n */\n'muted',\n/**\n * Set the value of `defaultMuted` on the media element. `defaultMuted` indicates that the current\n * audio level should be silent, but will only effect the muted level on initial playback..\n *\n * @method Html5.prototype.setDefaultMuted\n * @param {boolean} defaultMuted\n * - True if the audio should be set to silent\n * - False otherwise\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultmuted}\n */\n'defaultMuted',\n/**\n * Set the value of `autoplay` on the media element. `autoplay` indicates\n * that the media should start to play as soon as the page is ready.\n *\n * @method Html5#setAutoplay\n * @param {boolean} autoplay\n * - True indicates that the media should start as soon as the page loads.\n * - False indicates that the media should not start as soon as the page loads.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-autoplay}\n */\n'autoplay',\n/**\n * Set the value of `loop` on the media element. `loop` indicates\n * that the media should return to the start of the media and continue playing once\n * it reaches the end.\n *\n * @method Html5#setLoop\n * @param {boolean} loop\n * - True indicates that playback should seek back to start once\n * the end of a media is reached.\n * - False indicates that playback should not loop back to the start when the\n * end of the media is reached.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-loop}\n */\n'loop',\n/**\n * Set the value of `playsinline` from the media element. `playsinline` indicates\n * to the browser that non-fullscreen playback is preferred when fullscreen\n * playback is the native default, such as in iOS Safari.\n *\n * @method Html5#setPlaysinline\n * @param {boolean} playsinline\n * - True indicates that the media should play inline.\n * - False indicates that the media should not play inline.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline}\n */\n'playsinline'].forEach(function (prop) {\n Html5.prototype['set' + toTitleCase$1(prop)] = function (v) {\n this.el_[prop] = v;\n if (v) {\n this.el_.setAttribute(prop, prop);\n } else {\n this.el_.removeAttribute(prop);\n }\n };\n});\n\n// Wrap native properties with a getter\n// The list is as followed\n// paused, currentTime, buffered, volume, poster, preload, error, seeking\n// seekable, ended, playbackRate, defaultPlaybackRate, disablePictureInPicture\n// played, networkState, readyState, videoWidth, videoHeight, crossOrigin\n[\n/**\n * Get the value of `paused` from the media element. `paused` indicates whether the media element\n * is currently paused or not.\n *\n * @method Html5#paused\n * @return {boolean}\n * The value of `paused` from the media element.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-paused}\n */\n'paused',\n/**\n * Get the value of `currentTime` from the media element. `currentTime` indicates\n * the current second that the media is at in playback.\n *\n * @method Html5#currentTime\n * @return {number}\n * The value of `currentTime` from the media element.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-currenttime}\n */\n'currentTime',\n/**\n * Get the value of `buffered` from the media element. `buffered` is a `TimeRange`\n * object that represents the parts of the media that are already downloaded and\n * available for playback.\n *\n * @method Html5#buffered\n * @return {TimeRange}\n * The value of `buffered` from the media element.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered}\n */\n'buffered',\n/**\n * Get the value of `volume` from the media element. `volume` indicates\n * the current playback volume of audio for a media. `volume` will be a value from 0\n * (silent) to 1 (loudest and default).\n *\n * @method Html5#volume\n * @return {number}\n * The value of `volume` from the media element. Value will be between 0-1.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-a-volume}\n */\n'volume',\n/**\n * Get the value of `poster` from the media element. `poster` indicates\n * that the url of an image file that can/will be shown when no media data is available.\n *\n * @method Html5#poster\n * @return {string}\n * The value of `poster` from the media element. Value will be a url to an\n * image.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-video-poster}\n */\n'poster',\n/**\n * Get the value of `preload` from the media element. `preload` indicates\n * what should download before the media is interacted with. It can have the following\n * values:\n * - none: nothing should be downloaded\n * - metadata: poster and the first few frames of the media may be downloaded to get\n * media dimensions and other metadata\n * - auto: allow the media and metadata for the media to be downloaded before\n * interaction\n *\n * @method Html5#preload\n * @return {string}\n * The value of `preload` from the media element. Will be 'none', 'metadata',\n * or 'auto'.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-preload}\n */\n'preload',\n/**\n * Get the value of the `error` from the media element. `error` indicates any\n * MediaError that may have occurred during playback. If error returns null there is no\n * current error.\n *\n * @method Html5#error\n * @return {MediaError|null}\n * The value of `error` from the media element. Will be `MediaError` if there\n * is a current error and null otherwise.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-error}\n */\n'error',\n/**\n * Get the value of `seeking` from the media element. `seeking` indicates whether the\n * media is currently seeking to a new position or not.\n *\n * @method Html5#seeking\n * @return {boolean}\n * - The value of `seeking` from the media element.\n * - True indicates that the media is currently seeking to a new position.\n * - False indicates that the media is not seeking to a new position at this time.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seeking}\n */\n'seeking',\n/**\n * Get the value of `seekable` from the media element. `seekable` returns a\n * `TimeRange` object indicating ranges of time that can currently be `seeked` to.\n *\n * @method Html5#seekable\n * @return {TimeRange}\n * The value of `seekable` from the media element. A `TimeRange` object\n * indicating the current ranges of time that can be seeked to.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seekable}\n */\n'seekable',\n/**\n * Get the value of `ended` from the media element. `ended` indicates whether\n * the media has reached the end or not.\n *\n * @method Html5#ended\n * @return {boolean}\n * - The value of `ended` from the media element.\n * - True indicates that the media has ended.\n * - False indicates that the media has not ended.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-ended}\n */\n'ended',\n/**\n * Get the value of `playbackRate` from the media element. `playbackRate` indicates\n * the rate at which the media is currently playing back. Examples:\n * - if playbackRate is set to 2, media will play twice as fast.\n * - if playbackRate is set to 0.5, media will play half as fast.\n *\n * @method Html5#playbackRate\n * @return {number}\n * The value of `playbackRate` from the media element. A number indicating\n * the current playback speed of the media, where 1 is normal speed.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate}\n */\n'playbackRate',\n/**\n * Get the value of `defaultPlaybackRate` from the media element. `defaultPlaybackRate` indicates\n * the rate at which the media is currently playing back. This value will not indicate the current\n * `playbackRate` after playback has started, use {@link Html5#playbackRate} for that.\n *\n * Examples:\n * - if defaultPlaybackRate is set to 2, media will play twice as fast.\n * - if defaultPlaybackRate is set to 0.5, media will play half as fast.\n *\n * @method Html5.prototype.defaultPlaybackRate\n * @return {number}\n * The value of `defaultPlaybackRate` from the media element. A number indicating\n * the current playback speed of the media, where 1 is normal speed.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate}\n */\n'defaultPlaybackRate',\n/**\n * Get the value of 'disablePictureInPicture' from the video element.\n *\n * @method Html5#disablePictureInPicture\n * @return {boolean} value\n * - The value of `disablePictureInPicture` from the video element.\n * - True indicates that the video can't be played in Picture-In-Picture mode\n * - False indicates that the video can be played in Picture-In-Picture mode\n *\n * @see [Spec]{@link https://w3c.github.io/picture-in-picture/#disable-pip}\n */\n'disablePictureInPicture',\n/**\n * Get the value of `played` from the media element. `played` returns a `TimeRange`\n * object representing points in the media timeline that have been played.\n *\n * @method Html5#played\n * @return {TimeRange}\n * The value of `played` from the media element. A `TimeRange` object indicating\n * the ranges of time that have been played.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-played}\n */\n'played',\n/**\n * Get the value of `networkState` from the media element. `networkState` indicates\n * the current network state. It returns an enumeration from the following list:\n * - 0: NETWORK_EMPTY\n * - 1: NETWORK_IDLE\n * - 2: NETWORK_LOADING\n * - 3: NETWORK_NO_SOURCE\n *\n * @method Html5#networkState\n * @return {number}\n * The value of `networkState` from the media element. This will be a number\n * from the list in the description.\n *\n * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-networkstate}\n */\n'networkState',\n/**\n * Get the value of `readyState` from the media element. `readyState` indicates\n * the current state of the media element. It returns an enumeration from the\n * following list:\n * - 0: HAVE_NOTHING\n * - 1: HAVE_METADATA\n * - 2: HAVE_CURRENT_DATA\n * - 3: HAVE_FUTURE_DATA\n * - 4: HAVE_ENOUGH_DATA\n *\n * @method Html5#readyState\n * @return {number}\n * The value of `readyState` from the media element. This will be a number\n * from the list in the description.\n *\n * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#ready-states}\n */\n'readyState',\n/**\n * Get the value of `videoWidth` from the video element. `videoWidth` indicates\n * the current width of the video in css pixels.\n *\n * @method Html5#videoWidth\n * @return {number}\n * The value of `videoWidth` from the video element. This will be a number\n * in css pixels.\n *\n * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth}\n */\n'videoWidth',\n/**\n * Get the value of `videoHeight` from the video element. `videoHeight` indicates\n * the current height of the video in css pixels.\n *\n * @method Html5#videoHeight\n * @return {number}\n * The value of `videoHeight` from the video element. This will be a number\n * in css pixels.\n *\n * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth}\n */\n'videoHeight',\n/**\n * Get the value of `crossOrigin` from the media element. `crossOrigin` indicates\n * to the browser that should sent the cookies along with the requests for the\n * different assets/playlists\n *\n * @method Html5#crossOrigin\n * @return {string}\n * - anonymous indicates that the media should not sent cookies.\n * - use-credentials indicates that the media should sent cookies along the requests.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/#attr-media-crossorigin}\n */\n'crossOrigin'].forEach(function (prop) {\n Html5.prototype[prop] = function () {\n return this.el_[prop];\n };\n});\n\n// Wrap native properties with a setter in this format:\n// set + toTitleCase(name)\n// The list is as follows:\n// setVolume, setSrc, setPoster, setPreload, setPlaybackRate, setDefaultPlaybackRate,\n// setDisablePictureInPicture, setCrossOrigin\n[\n/**\n * Set the value of `volume` on the media element. `volume` indicates the current\n * audio level as a percentage in decimal form. This means that 1 is 100%, 0.5 is 50%, and\n * so on.\n *\n * @method Html5#setVolume\n * @param {number} percentAsDecimal\n * The volume percent as a decimal. Valid range is from 0-1.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-a-volume}\n */\n'volume',\n/**\n * Set the value of `src` on the media element. `src` indicates the current\n * {@link Tech~SourceObject} for the media.\n *\n * @method Html5#setSrc\n * @param {Tech~SourceObject} src\n * The source object to set as the current source.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-src}\n */\n'src',\n/**\n * Set the value of `poster` on the media element. `poster` is the url to\n * an image file that can/will be shown when no media data is available.\n *\n * @method Html5#setPoster\n * @param {string} poster\n * The url to an image that should be used as the `poster` for the media\n * element.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-poster}\n */\n'poster',\n/**\n * Set the value of `preload` on the media element. `preload` indicates\n * what should download before the media is interacted with. It can have the following\n * values:\n * - none: nothing should be downloaded\n * - metadata: poster and the first few frames of the media may be downloaded to get\n * media dimensions and other metadata\n * - auto: allow the media and metadata for the media to be downloaded before\n * interaction\n *\n * @method Html5#setPreload\n * @param {string} preload\n * The value of `preload` to set on the media element. Must be 'none', 'metadata',\n * or 'auto'.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-preload}\n */\n'preload',\n/**\n * Set the value of `playbackRate` on the media element. `playbackRate` indicates\n * the rate at which the media should play back. Examples:\n * - if playbackRate is set to 2, media will play twice as fast.\n * - if playbackRate is set to 0.5, media will play half as fast.\n *\n * @method Html5#setPlaybackRate\n * @return {number}\n * The value of `playbackRate` from the media element. A number indicating\n * the current playback speed of the media, where 1 is normal speed.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate}\n */\n'playbackRate',\n/**\n * Set the value of `defaultPlaybackRate` on the media element. `defaultPlaybackRate` indicates\n * the rate at which the media should play back upon initial startup. Changing this value\n * after a video has started will do nothing. Instead you should used {@link Html5#setPlaybackRate}.\n *\n * Example Values:\n * - if playbackRate is set to 2, media will play twice as fast.\n * - if playbackRate is set to 0.5, media will play half as fast.\n *\n * @method Html5.prototype.setDefaultPlaybackRate\n * @return {number}\n * The value of `defaultPlaybackRate` from the media element. A number indicating\n * the current playback speed of the media, where 1 is normal speed.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultplaybackrate}\n */\n'defaultPlaybackRate',\n/**\n * Prevents the browser from suggesting a Picture-in-Picture context menu\n * or to request Picture-in-Picture automatically in some cases.\n *\n * @method Html5#setDisablePictureInPicture\n * @param {boolean} value\n * The true value will disable Picture-in-Picture mode.\n *\n * @see [Spec]{@link https://w3c.github.io/picture-in-picture/#disable-pip}\n */\n'disablePictureInPicture',\n/**\n * Set the value of `crossOrigin` from the media element. `crossOrigin` indicates\n * to the browser that should sent the cookies along with the requests for the\n * different assets/playlists\n *\n * @method Html5#setCrossOrigin\n * @param {string} crossOrigin\n * - anonymous indicates that the media should not sent cookies.\n * - use-credentials indicates that the media should sent cookies along the requests.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/#attr-media-crossorigin}\n */\n'crossOrigin'].forEach(function (prop) {\n Html5.prototype['set' + toTitleCase$1(prop)] = function (v) {\n this.el_[prop] = v;\n };\n});\n\n// wrap native functions with a function\n// The list is as follows:\n// pause, load, play\n[\n/**\n * A wrapper around the media elements `pause` function. This will call the `HTML5`\n * media elements `pause` function.\n *\n * @method Html5#pause\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-pause}\n */\n'pause',\n/**\n * A wrapper around the media elements `load` function. This will call the `HTML5`s\n * media element `load` function.\n *\n * @method Html5#load\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-load}\n */\n'load',\n/**\n * A wrapper around the media elements `play` function. This will call the `HTML5`s\n * media element `play` function.\n *\n * @method Html5#play\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-play}\n */\n'play'].forEach(function (prop) {\n Html5.prototype[prop] = function () {\n return this.el_[prop]();\n };\n});\nTech.withSourceHandlers(Html5);\n\n/**\n * Native source handler for Html5, simply passes the source to the media element.\n *\n * @property {Tech~SourceObject} source\n * The source object\n *\n * @property {Html5} tech\n * The instance of the HTML5 tech.\n */\nHtml5.nativeSourceHandler = {};\n\n/**\n * Check if the media element can play the given mime type.\n *\n * @param {string} type\n * The mimetype to check\n *\n * @return {string}\n * 'probably', 'maybe', or '' (empty string)\n */\nHtml5.nativeSourceHandler.canPlayType = function (type) {\n // IE without MediaPlayer throws an error (#519)\n try {\n return Html5.TEST_VID.canPlayType(type);\n } catch (e) {\n return '';\n }\n};\n\n/**\n * Check if the media element can handle a source natively.\n *\n * @param {Tech~SourceObject} source\n * The source object\n *\n * @param {Object} [options]\n * Options to be passed to the tech.\n *\n * @return {string}\n * 'probably', 'maybe', or '' (empty string).\n */\nHtml5.nativeSourceHandler.canHandleSource = function (source, options) {\n // If a type was provided we should rely on that\n if (source.type) {\n return Html5.nativeSourceHandler.canPlayType(source.type);\n\n // If no type, fall back to checking 'video/[EXTENSION]'\n } else if (source.src) {\n const ext = getFileExtension(source.src);\n return Html5.nativeSourceHandler.canPlayType(`video/${ext}`);\n }\n return '';\n};\n\n/**\n * Pass the source to the native media element.\n *\n * @param {Tech~SourceObject} source\n * The source object\n *\n * @param {Html5} tech\n * The instance of the Html5 tech\n *\n * @param {Object} [options]\n * The options to pass to the source\n */\nHtml5.nativeSourceHandler.handleSource = function (source, tech, options) {\n tech.setSrc(source.src);\n};\n\n/**\n * A noop for the native dispose function, as cleanup is not needed.\n */\nHtml5.nativeSourceHandler.dispose = function () {};\n\n// Register the native source handler\nHtml5.registerSourceHandler(Html5.nativeSourceHandler);\nTech.registerTech('Html5', Html5);\n\n/**\n * @file player.js\n */\n\n// The following tech events are simply re-triggered\n// on the player when they happen\nconst TECH_EVENTS_RETRIGGER = [\n/**\n * Fired while the user agent is downloading media data.\n *\n * @event Player#progress\n * @type {Event}\n */\n/**\n * Retrigger the `progress` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechProgress_\n * @fires Player#progress\n * @listens Tech#progress\n */\n'progress',\n/**\n * Fires when the loading of an audio/video is aborted.\n *\n * @event Player#abort\n * @type {Event}\n */\n/**\n * Retrigger the `abort` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechAbort_\n * @fires Player#abort\n * @listens Tech#abort\n */\n'abort',\n/**\n * Fires when the browser is intentionally not getting media data.\n *\n * @event Player#suspend\n * @type {Event}\n */\n/**\n * Retrigger the `suspend` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechSuspend_\n * @fires Player#suspend\n * @listens Tech#suspend\n */\n'suspend',\n/**\n * Fires when the current playlist is empty.\n *\n * @event Player#emptied\n * @type {Event}\n */\n/**\n * Retrigger the `emptied` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechEmptied_\n * @fires Player#emptied\n * @listens Tech#emptied\n */\n'emptied',\n/**\n * Fires when the browser is trying to get media data, but data is not available.\n *\n * @event Player#stalled\n * @type {Event}\n */\n/**\n * Retrigger the `stalled` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechStalled_\n * @fires Player#stalled\n * @listens Tech#stalled\n */\n'stalled',\n/**\n * Fires when the browser has loaded meta data for the audio/video.\n *\n * @event Player#loadedmetadata\n * @type {Event}\n */\n/**\n * Retrigger the `loadedmetadata` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechLoadedmetadata_\n * @fires Player#loadedmetadata\n * @listens Tech#loadedmetadata\n */\n'loadedmetadata',\n/**\n * Fires when the browser has loaded the current frame of the audio/video.\n *\n * @event Player#loadeddata\n * @type {event}\n */\n/**\n * Retrigger the `loadeddata` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechLoaddeddata_\n * @fires Player#loadeddata\n * @listens Tech#loadeddata\n */\n'loadeddata',\n/**\n * Fires when the current playback position has changed.\n *\n * @event Player#timeupdate\n * @type {event}\n */\n/**\n * Retrigger the `timeupdate` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechTimeUpdate_\n * @fires Player#timeupdate\n * @listens Tech#timeupdate\n */\n'timeupdate',\n/**\n * Fires when the video's intrinsic dimensions change\n *\n * @event Player#resize\n * @type {event}\n */\n/**\n * Retrigger the `resize` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechResize_\n * @fires Player#resize\n * @listens Tech#resize\n */\n'resize',\n/**\n * Fires when the volume has been changed\n *\n * @event Player#volumechange\n * @type {event}\n */\n/**\n * Retrigger the `volumechange` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechVolumechange_\n * @fires Player#volumechange\n * @listens Tech#volumechange\n */\n'volumechange',\n/**\n * Fires when the text track has been changed\n *\n * @event Player#texttrackchange\n * @type {event}\n */\n/**\n * Retrigger the `texttrackchange` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechTexttrackchange_\n * @fires Player#texttrackchange\n * @listens Tech#texttrackchange\n */\n'texttrackchange'];\n\n// events to queue when playback rate is zero\n// this is a hash for the sole purpose of mapping non-camel-cased event names\n// to camel-cased function names\nconst TECH_EVENTS_QUEUE = {\n canplay: 'CanPlay',\n canplaythrough: 'CanPlayThrough',\n playing: 'Playing',\n seeked: 'Seeked'\n};\nconst BREAKPOINT_ORDER = ['tiny', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'huge'];\nconst BREAKPOINT_CLASSES = {};\n\n// grep: vjs-layout-tiny\n// grep: vjs-layout-x-small\n// grep: vjs-layout-small\n// grep: vjs-layout-medium\n// grep: vjs-layout-large\n// grep: vjs-layout-x-large\n// grep: vjs-layout-huge\nBREAKPOINT_ORDER.forEach(k => {\n const v = k.charAt(0) === 'x' ? `x-${k.substring(1)}` : k;\n BREAKPOINT_CLASSES[k] = `vjs-layout-${v}`;\n});\nconst DEFAULT_BREAKPOINTS = {\n tiny: 210,\n xsmall: 320,\n small: 425,\n medium: 768,\n large: 1440,\n xlarge: 2560,\n huge: Infinity\n};\n\n/**\n * An instance of the `Player` class is created when any of the Video.js setup methods\n * are used to initialize a video.\n *\n * After an instance has been created it can be accessed globally in three ways:\n * 1. By calling `videojs.getPlayer('example_video_1');`\n * 2. By calling `videojs('example_video_1');` (not recommended)\n * 2. By using it directly via `videojs.players.example_video_1;`\n *\n * @extends Component\n * @global\n */\nclass Player extends Component$1 {\n /**\n * Create an instance of this class.\n *\n * @param {Element} tag\n * The original video DOM element used for configuring options.\n *\n * @param {Object} [options]\n * Object of option names and values.\n *\n * @param {Function} [ready]\n * Ready callback function.\n */\n constructor(tag, options, ready) {\n // Make sure tag ID exists\n // also here.. probably better\n tag.id = tag.id || options.id || `vjs_video_${newGUID()}`;\n\n // Set Options\n // The options argument overrides options set in the video tag\n // which overrides globally set options.\n // This latter part coincides with the load order\n // (tag must exist before Player)\n options = Object.assign(Player.getTagSettings(tag), options);\n\n // Delay the initialization of children because we need to set up\n // player properties first, and can't use `this` before `super()`\n options.initChildren = false;\n\n // Same with creating the element\n options.createEl = false;\n\n // don't auto mixin the evented mixin\n options.evented = false;\n\n // we don't want the player to report touch activity on itself\n // see enableTouchActivity in Component\n options.reportTouchActivity = false;\n\n // If language is not set, get the closest lang attribute\n if (!options.language) {\n const closest = tag.closest('[lang]');\n if (closest) {\n options.language = closest.getAttribute('lang');\n }\n }\n\n // Run base component initializing with new options\n super(null, options, ready);\n\n // Create bound methods for document listeners.\n this.boundDocumentFullscreenChange_ = e => this.documentFullscreenChange_(e);\n this.boundFullWindowOnEscKey_ = e => this.fullWindowOnEscKey(e);\n this.boundUpdateStyleEl_ = e => this.updateStyleEl_(e);\n this.boundApplyInitTime_ = e => this.applyInitTime_(e);\n this.boundUpdateCurrentBreakpoint_ = e => this.updateCurrentBreakpoint_(e);\n this.boundHandleTechClick_ = e => this.handleTechClick_(e);\n this.boundHandleTechDoubleClick_ = e => this.handleTechDoubleClick_(e);\n this.boundHandleTechTouchStart_ = e => this.handleTechTouchStart_(e);\n this.boundHandleTechTouchMove_ = e => this.handleTechTouchMove_(e);\n this.boundHandleTechTouchEnd_ = e => this.handleTechTouchEnd_(e);\n this.boundHandleTechTap_ = e => this.handleTechTap_(e);\n\n // default isFullscreen_ to false\n this.isFullscreen_ = false;\n\n // create logger\n this.log = createLogger(this.id_);\n\n // Hold our own reference to fullscreen api so it can be mocked in tests\n this.fsApi_ = FullscreenApi;\n\n // Tracks when a tech changes the poster\n this.isPosterFromTech_ = false;\n\n // Holds callback info that gets queued when playback rate is zero\n // and a seek is happening\n this.queuedCallbacks_ = [];\n\n // Turn off API access because we're loading a new tech that might load asynchronously\n this.isReady_ = false;\n\n // Init state hasStarted_\n this.hasStarted_ = false;\n\n // Init state userActive_\n this.userActive_ = false;\n\n // Init debugEnabled_\n this.debugEnabled_ = false;\n\n // Init state audioOnlyMode_\n this.audioOnlyMode_ = false;\n\n // Init state audioPosterMode_\n this.audioPosterMode_ = false;\n\n // Init state audioOnlyCache_\n this.audioOnlyCache_ = {\n playerHeight: null,\n hiddenChildren: []\n };\n\n // if the global option object was accidentally blown away by\n // someone, bail early with an informative error\n if (!this.options_ || !this.options_.techOrder || !this.options_.techOrder.length) {\n throw new Error('No techOrder specified. Did you overwrite ' + 'videojs.options instead of just changing the ' + 'properties you want to override?');\n }\n\n // Store the original tag used to set options\n this.tag = tag;\n\n // Store the tag attributes used to restore html5 element\n this.tagAttributes = tag && getAttributes(tag);\n\n // Update current language\n this.language(this.options_.language);\n\n // Update Supported Languages\n if (options.languages) {\n // Normalise player option languages to lowercase\n const languagesToLower = {};\n Object.getOwnPropertyNames(options.languages).forEach(function (name) {\n languagesToLower[name.toLowerCase()] = options.languages[name];\n });\n this.languages_ = languagesToLower;\n } else {\n this.languages_ = Player.prototype.options_.languages;\n }\n this.resetCache_();\n\n // Set poster\n /** @type string */\n this.poster_ = options.poster || '';\n\n // Set controls\n /** @type {boolean} */\n this.controls_ = !!options.controls;\n\n // Original tag settings stored in options\n // now remove immediately so native controls don't flash.\n // May be turned back on by HTML5 tech if nativeControlsForTouch is true\n tag.controls = false;\n tag.removeAttribute('controls');\n this.changingSrc_ = false;\n this.playCallbacks_ = [];\n this.playTerminatedQueue_ = [];\n\n // the attribute overrides the option\n if (tag.hasAttribute('autoplay')) {\n this.autoplay(true);\n } else {\n // otherwise use the setter to validate and\n // set the correct value.\n this.autoplay(this.options_.autoplay);\n }\n\n // check plugins\n if (options.plugins) {\n Object.keys(options.plugins).forEach(name => {\n if (typeof this[name] !== 'function') {\n throw new Error(`plugin \"${name}\" does not exist`);\n }\n });\n }\n\n /*\n * Store the internal state of scrubbing\n *\n * @private\n * @return {Boolean} True if the user is scrubbing\n */\n this.scrubbing_ = false;\n this.el_ = this.createEl();\n\n // Make this an evented object and use `el_` as its event bus.\n evented(this, {\n eventBusKey: 'el_'\n });\n\n // listen to document and player fullscreenchange handlers so we receive those events\n // before a user can receive them so we can update isFullscreen appropriately.\n // make sure that we listen to fullscreenchange events before everything else to make sure that\n // our isFullscreen method is updated properly for internal components as well as external.\n if (this.fsApi_.requestFullscreen) {\n on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);\n this.on(this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);\n }\n if (this.fluid_) {\n this.on(['playerreset', 'resize'], this.boundUpdateStyleEl_);\n }\n // We also want to pass the original player options to each component and plugin\n // as well so they don't need to reach back into the player for options later.\n // We also need to do another copy of this.options_ so we don't end up with\n // an infinite loop.\n const playerOptionsCopy = merge$1(this.options_);\n\n // Load plugins\n if (options.plugins) {\n Object.keys(options.plugins).forEach(name => {\n this[name](options.plugins[name]);\n });\n }\n\n // Enable debug mode to fire debugon event for all plugins.\n if (options.debug) {\n this.debug(true);\n }\n this.options_.playerOptions = playerOptionsCopy;\n this.middleware_ = [];\n this.playbackRates(options.playbackRates);\n if (options.experimentalSvgIcons) {\n // Add SVG Sprite to the DOM\n const parser = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().DOMParser)();\n const parsedSVG = parser.parseFromString(icons, 'image/svg+xml');\n const errorNode = parsedSVG.querySelector('parsererror');\n if (errorNode) {\n log$1.warn('Failed to load SVG Icons. Falling back to Font Icons.');\n this.options_.experimentalSvgIcons = null;\n } else {\n const sprite = parsedSVG.documentElement;\n sprite.style.display = 'none';\n this.el_.appendChild(sprite);\n this.addClass('vjs-svg-icons-enabled');\n }\n }\n this.initChildren();\n\n // Set isAudio based on whether or not an audio tag was used\n this.isAudio(tag.nodeName.toLowerCase() === 'audio');\n\n // Update controls className. Can't do this when the controls are initially\n // set because the element doesn't exist yet.\n if (this.controls()) {\n this.addClass('vjs-controls-enabled');\n } else {\n this.addClass('vjs-controls-disabled');\n }\n\n // Set ARIA label and region role depending on player type\n this.el_.setAttribute('role', 'region');\n if (this.isAudio()) {\n this.el_.setAttribute('aria-label', this.localize('Audio Player'));\n } else {\n this.el_.setAttribute('aria-label', this.localize('Video Player'));\n }\n if (this.isAudio()) {\n this.addClass('vjs-audio');\n }\n\n // TODO: Make this smarter. Toggle user state between touching/mousing\n // using events, since devices can have both touch and mouse events.\n // TODO: Make this check be performed again when the window switches between monitors\n // (See https://github.com/videojs/video.js/issues/5683)\n if (TOUCH_ENABLED) {\n this.addClass('vjs-touch-enabled');\n }\n\n // iOS Safari has broken hover handling\n if (!IS_IOS) {\n this.addClass('vjs-workinghover');\n }\n\n // Make player easily findable by ID\n Player.players[this.id_] = this;\n\n // Add a major version class to aid css in plugins\n const majorVersion = version$6.split('.')[0];\n this.addClass(`vjs-v${majorVersion}`);\n\n // When the player is first initialized, trigger activity so components\n // like the control bar show themselves if needed\n this.userActive(true);\n this.reportUserActivity();\n this.one('play', e => this.listenForUserActivity_(e));\n this.on('keydown', e => this.handleKeyDown(e));\n this.on('languagechange', e => this.handleLanguagechange(e));\n this.breakpoints(this.options_.breakpoints);\n this.responsive(this.options_.responsive);\n\n // Calling both the audio mode methods after the player is fully\n // setup to be able to listen to the events triggered by them\n this.on('ready', () => {\n // Calling the audioPosterMode method first so that\n // the audioOnlyMode can take precedence when both options are set to true\n this.audioPosterMode(this.options_.audioPosterMode);\n this.audioOnlyMode(this.options_.audioOnlyMode);\n });\n }\n\n /**\n * Destroys the video player and does any necessary cleanup.\n *\n * This is especially helpful if you are dynamically adding and removing videos\n * to/from the DOM.\n *\n * @fires Player#dispose\n */\n dispose() {\n /**\n * Called when the player is being disposed of.\n *\n * @event Player#dispose\n * @type {Event}\n */\n this.trigger('dispose');\n // prevent dispose from being called twice\n this.off('dispose');\n\n // Make sure all player-specific document listeners are unbound. This is\n off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);\n off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keydown', this.boundFullWindowOnEscKey_);\n if (this.styleEl_ && this.styleEl_.parentNode) {\n this.styleEl_.parentNode.removeChild(this.styleEl_);\n this.styleEl_ = null;\n }\n\n // Kill reference to this player\n Player.players[this.id_] = null;\n if (this.tag && this.tag.player) {\n this.tag.player = null;\n }\n if (this.el_ && this.el_.player) {\n this.el_.player = null;\n }\n if (this.tech_) {\n this.tech_.dispose();\n this.isPosterFromTech_ = false;\n this.poster_ = '';\n }\n if (this.playerElIngest_) {\n this.playerElIngest_ = null;\n }\n if (this.tag) {\n this.tag = null;\n }\n clearCacheForPlayer(this);\n\n // remove all event handlers for track lists\n // all tracks and track listeners are removed on\n // tech dispose\n ALL.names.forEach(name => {\n const props = ALL[name];\n const list = this[props.getterName]();\n\n // if it is not a native list\n // we have to manually remove event listeners\n if (list && list.off) {\n list.off();\n }\n });\n\n // the actual .el_ is removed here, or replaced if\n super.dispose({\n restoreEl: this.options_.restoreEl\n });\n }\n\n /**\n * Create the `Player`'s DOM element.\n *\n * @return {Element}\n * The DOM element that gets created.\n */\n createEl() {\n let tag = this.tag;\n let el;\n let playerElIngest = this.playerElIngest_ = tag.parentNode && tag.parentNode.hasAttribute && tag.parentNode.hasAttribute('data-vjs-player');\n const divEmbed = this.tag.tagName.toLowerCase() === 'video-js';\n if (playerElIngest) {\n el = this.el_ = tag.parentNode;\n } else if (!divEmbed) {\n el = this.el_ = super.createEl('div');\n }\n\n // Copy over all the attributes from the tag, including ID and class\n // ID will now reference player box, not the video tag\n const attrs = getAttributes(tag);\n if (divEmbed) {\n el = this.el_ = tag;\n tag = this.tag = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video');\n while (el.children.length) {\n tag.appendChild(el.firstChild);\n }\n if (!hasClass(el, 'video-js')) {\n addClass(el, 'video-js');\n }\n el.appendChild(tag);\n playerElIngest = this.playerElIngest_ = el;\n // move properties over from our custom `video-js` element\n // to our new `video` element. This will move things like\n // `src` or `controls` that were set via js before the player\n // was initialized.\n Object.keys(el).forEach(k => {\n try {\n tag[k] = el[k];\n } catch (e) {\n // we got a a property like outerHTML which we can't actually copy, ignore it\n }\n });\n }\n\n // set tabindex to -1 to remove the video element from the focus order\n tag.setAttribute('tabindex', '-1');\n attrs.tabindex = '-1';\n\n // Workaround for #4583 on Chrome (on Windows) with JAWS.\n // See https://github.com/FreedomScientific/VFO-standards-support/issues/78\n // Note that we can't detect if JAWS is being used, but this ARIA attribute\n // doesn't change behavior of Chrome if JAWS is not being used\n if (IS_CHROME && IS_WINDOWS) {\n tag.setAttribute('role', 'application');\n attrs.role = 'application';\n }\n\n // Remove width/height attrs from tag so CSS can make it 100% width/height\n tag.removeAttribute('width');\n tag.removeAttribute('height');\n if ('width' in attrs) {\n delete attrs.width;\n }\n if ('height' in attrs) {\n delete attrs.height;\n }\n Object.getOwnPropertyNames(attrs).forEach(function (attr) {\n // don't copy over the class attribute to the player element when we're in a div embed\n // the class is already set up properly in the divEmbed case\n // and we want to make sure that the `video-js` class doesn't get lost\n if (!(divEmbed && attr === 'class')) {\n el.setAttribute(attr, attrs[attr]);\n }\n if (divEmbed) {\n tag.setAttribute(attr, attrs[attr]);\n }\n });\n\n // Update tag id/class for use as HTML5 playback tech\n // Might think we should do this after embedding in container so .vjs-tech class\n // doesn't flash 100% width/height, but class only applies with .video-js parent\n tag.playerId = tag.id;\n tag.id += '_html5_api';\n tag.className = 'vjs-tech';\n\n // Make player findable on elements\n tag.player = el.player = this;\n // Default state of video is paused\n this.addClass('vjs-paused');\n\n // Add a style element in the player that we'll use to set the width/height\n // of the player in a way that's still overridable by CSS, just like the\n // video element\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().VIDEOJS_NO_DYNAMIC_STYLE) !== true) {\n this.styleEl_ = createStyleElement('vjs-styles-dimensions');\n const defaultsStyleEl = $('.vjs-styles-defaults');\n const head = $('head');\n head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild);\n }\n this.fill_ = false;\n this.fluid_ = false;\n\n // Pass in the width/height/aspectRatio options which will update the style el\n this.width(this.options_.width);\n this.height(this.options_.height);\n this.fill(this.options_.fill);\n this.fluid(this.options_.fluid);\n this.aspectRatio(this.options_.aspectRatio);\n // support both crossOrigin and crossorigin to reduce confusion and issues around the name\n this.crossOrigin(this.options_.crossOrigin || this.options_.crossorigin);\n\n // Hide any links within the video/audio tag,\n // because IE doesn't hide them completely from screen readers.\n const links = tag.getElementsByTagName('a');\n for (let i = 0; i < links.length; i++) {\n const linkEl = links.item(i);\n addClass(linkEl, 'vjs-hidden');\n linkEl.setAttribute('hidden', 'hidden');\n }\n\n // insertElFirst seems to cause the networkState to flicker from 3 to 2, so\n // keep track of the original for later so we can know if the source originally failed\n tag.initNetworkState_ = tag.networkState;\n\n // Wrap video tag in div (el/box) container\n if (tag.parentNode && !playerElIngest) {\n tag.parentNode.insertBefore(el, tag);\n }\n\n // insert the tag as the first child of the player element\n // then manually add it to the children array so that this.addChild\n // will work properly for other components\n //\n // Breaks iPhone, fixed in HTML5 setup.\n prependTo(tag, el);\n this.children_.unshift(tag);\n\n // Set lang attr on player to ensure CSS :lang() in consistent with player\n // if it's been set to something different to the doc\n this.el_.setAttribute('lang', this.language_);\n this.el_.setAttribute('translate', 'no');\n this.el_ = el;\n return el;\n }\n\n /**\n * Get or set the `Player`'s crossOrigin option. For the HTML5 player, this\n * sets the `crossOrigin` property on the `<video>` tag to control the CORS\n * behavior.\n *\n * @see [Video Element Attributes]{@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-crossorigin}\n *\n * @param {string|null} [value]\n * The value to set the `Player`'s crossOrigin to. If an argument is\n * given, must be one of `'anonymous'` or `'use-credentials'`, or 'null'.\n *\n * @return {string|null|undefined}\n * - The current crossOrigin value of the `Player` when getting.\n * - undefined when setting\n */\n crossOrigin(value) {\n // `null` can be set to unset a value\n if (typeof value === 'undefined') {\n return this.techGet_('crossOrigin');\n }\n if (value !== null && value !== 'anonymous' && value !== 'use-credentials') {\n log$1.warn(`crossOrigin must be null, \"anonymous\" or \"use-credentials\", given \"${value}\"`);\n return;\n }\n this.techCall_('setCrossOrigin', value);\n if (this.posterImage) {\n this.posterImage.crossOrigin(value);\n }\n return;\n }\n\n /**\n * A getter/setter for the `Player`'s width. Returns the player's configured value.\n * To get the current width use `currentWidth()`.\n *\n * @param {number|string} [value]\n * CSS value to set the `Player`'s width to.\n *\n * @return {number|undefined}\n * - The current width of the `Player` when getting.\n * - Nothing when setting\n */\n width(value) {\n return this.dimension('width', value);\n }\n\n /**\n * A getter/setter for the `Player`'s height. Returns the player's configured value.\n * To get the current height use `currentheight()`.\n *\n * @param {number|string} [value]\n * CSS value to set the `Player`'s height to.\n *\n * @return {number|undefined}\n * - The current height of the `Player` when getting.\n * - Nothing when setting\n */\n height(value) {\n return this.dimension('height', value);\n }\n\n /**\n * A getter/setter for the `Player`'s width & height.\n *\n * @param {string} dimension\n * This string can be:\n * - 'width'\n * - 'height'\n *\n * @param {number|string} [value]\n * Value for dimension specified in the first argument.\n *\n * @return {number}\n * The dimension arguments value when getting (width/height).\n */\n dimension(dimension, value) {\n const privDimension = dimension + '_';\n if (value === undefined) {\n return this[privDimension] || 0;\n }\n if (value === '' || value === 'auto') {\n // If an empty string is given, reset the dimension to be automatic\n this[privDimension] = undefined;\n this.updateStyleEl_();\n return;\n }\n const parsedVal = parseFloat(value);\n if (isNaN(parsedVal)) {\n log$1.error(`Improper value \"${value}\" supplied for for ${dimension}`);\n return;\n }\n this[privDimension] = parsedVal;\n this.updateStyleEl_();\n }\n\n /**\n * A getter/setter/toggler for the vjs-fluid `className` on the `Player`.\n *\n * Turning this on will turn off fill mode.\n *\n * @param {boolean} [bool]\n * - A value of true adds the class.\n * - A value of false removes the class.\n * - No value will be a getter.\n *\n * @return {boolean|undefined}\n * - The value of fluid when getting.\n * - `undefined` when setting.\n */\n fluid(bool) {\n if (bool === undefined) {\n return !!this.fluid_;\n }\n this.fluid_ = !!bool;\n if (isEvented(this)) {\n this.off(['playerreset', 'resize'], this.boundUpdateStyleEl_);\n }\n if (bool) {\n this.addClass('vjs-fluid');\n this.fill(false);\n addEventedCallback(this, () => {\n this.on(['playerreset', 'resize'], this.boundUpdateStyleEl_);\n });\n } else {\n this.removeClass('vjs-fluid');\n }\n this.updateStyleEl_();\n }\n\n /**\n * A getter/setter/toggler for the vjs-fill `className` on the `Player`.\n *\n * Turning this on will turn off fluid mode.\n *\n * @param {boolean} [bool]\n * - A value of true adds the class.\n * - A value of false removes the class.\n * - No value will be a getter.\n *\n * @return {boolean|undefined}\n * - The value of fluid when getting.\n * - `undefined` when setting.\n */\n fill(bool) {\n if (bool === undefined) {\n return !!this.fill_;\n }\n this.fill_ = !!bool;\n if (bool) {\n this.addClass('vjs-fill');\n this.fluid(false);\n } else {\n this.removeClass('vjs-fill');\n }\n }\n\n /**\n * Get/Set the aspect ratio\n *\n * @param {string} [ratio]\n * Aspect ratio for player\n *\n * @return {string|undefined}\n * returns the current aspect ratio when getting\n */\n\n /**\n * A getter/setter for the `Player`'s aspect ratio.\n *\n * @param {string} [ratio]\n * The value to set the `Player`'s aspect ratio to.\n *\n * @return {string|undefined}\n * - The current aspect ratio of the `Player` when getting.\n * - undefined when setting\n */\n aspectRatio(ratio) {\n if (ratio === undefined) {\n return this.aspectRatio_;\n }\n\n // Check for width:height format\n if (!/^\\d+\\:\\d+$/.test(ratio)) {\n throw new Error('Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.');\n }\n this.aspectRatio_ = ratio;\n\n // We're assuming if you set an aspect ratio you want fluid mode,\n // because in fixed mode you could calculate width and height yourself.\n this.fluid(true);\n this.updateStyleEl_();\n }\n\n /**\n * Update styles of the `Player` element (height, width and aspect ratio).\n *\n * @private\n * @listens Tech#loadedmetadata\n */\n updateStyleEl_() {\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().VIDEOJS_NO_DYNAMIC_STYLE) === true) {\n const width = typeof this.width_ === 'number' ? this.width_ : this.options_.width;\n const height = typeof this.height_ === 'number' ? this.height_ : this.options_.height;\n const techEl = this.tech_ && this.tech_.el();\n if (techEl) {\n if (width >= 0) {\n techEl.width = width;\n }\n if (height >= 0) {\n techEl.height = height;\n }\n }\n return;\n }\n let width;\n let height;\n let aspectRatio;\n let idClass;\n\n // The aspect ratio is either used directly or to calculate width and height.\n if (this.aspectRatio_ !== undefined && this.aspectRatio_ !== 'auto') {\n // Use any aspectRatio that's been specifically set\n aspectRatio = this.aspectRatio_;\n } else if (this.videoWidth() > 0) {\n // Otherwise try to get the aspect ratio from the video metadata\n aspectRatio = this.videoWidth() + ':' + this.videoHeight();\n } else {\n // Or use a default. The video element's is 2:1, but 16:9 is more common.\n aspectRatio = '16:9';\n }\n\n // Get the ratio as a decimal we can use to calculate dimensions\n const ratioParts = aspectRatio.split(':');\n const ratioMultiplier = ratioParts[1] / ratioParts[0];\n if (this.width_ !== undefined) {\n // Use any width that's been specifically set\n width = this.width_;\n } else if (this.height_ !== undefined) {\n // Or calculate the width from the aspect ratio if a height has been set\n width = this.height_ / ratioMultiplier;\n } else {\n // Or use the video's metadata, or use the video el's default of 300\n width = this.videoWidth() || 300;\n }\n if (this.height_ !== undefined) {\n // Use any height that's been specifically set\n height = this.height_;\n } else {\n // Otherwise calculate the height from the ratio and the width\n height = width * ratioMultiplier;\n }\n\n // Ensure the CSS class is valid by starting with an alpha character\n if (/^[^a-zA-Z]/.test(this.id())) {\n idClass = 'dimensions-' + this.id();\n } else {\n idClass = this.id() + '-dimensions';\n }\n\n // Ensure the right class is still on the player for the style element\n this.addClass(idClass);\n setTextContent(this.styleEl_, `\n .${idClass} {\n width: ${width}px;\n height: ${height}px;\n }\n\n .${idClass}.vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: ${ratioMultiplier * 100}%;\n }\n `);\n }\n\n /**\n * Load/Create an instance of playback {@link Tech} including element\n * and API methods. Then append the `Tech` element in `Player` as a child.\n *\n * @param {string} techName\n * name of the playback technology\n *\n * @param {string} source\n * video source\n *\n * @private\n */\n loadTech_(techName, source) {\n // Pause and remove current playback technology\n if (this.tech_) {\n this.unloadTech_();\n }\n const titleTechName = toTitleCase$1(techName);\n const camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1);\n\n // get rid of the HTML5 video tag as soon as we are using another tech\n if (titleTechName !== 'Html5' && this.tag) {\n Tech.getTech('Html5').disposeMediaElement(this.tag);\n this.tag.player = null;\n this.tag = null;\n }\n this.techName_ = titleTechName;\n\n // Turn off API access because we're loading a new tech that might load asynchronously\n this.isReady_ = false;\n let autoplay = this.autoplay();\n\n // if autoplay is a string (or `true` with normalizeAutoplay: true) we pass false to the tech\n // because the player is going to handle autoplay on `loadstart`\n if (typeof this.autoplay() === 'string' || this.autoplay() === true && this.options_.normalizeAutoplay) {\n autoplay = false;\n }\n\n // Grab tech-specific options from player options and add source and parent element to use.\n const techOptions = {\n source,\n autoplay,\n 'nativeControlsForTouch': this.options_.nativeControlsForTouch,\n 'playerId': this.id(),\n 'techId': `${this.id()}_${camelTechName}_api`,\n 'playsinline': this.options_.playsinline,\n 'preload': this.options_.preload,\n 'loop': this.options_.loop,\n 'disablePictureInPicture': this.options_.disablePictureInPicture,\n 'muted': this.options_.muted,\n 'poster': this.poster(),\n 'language': this.language(),\n 'playerElIngest': this.playerElIngest_ || false,\n 'vtt.js': this.options_['vtt.js'],\n 'canOverridePoster': !!this.options_.techCanOverridePoster,\n 'enableSourceset': this.options_.enableSourceset\n };\n ALL.names.forEach(name => {\n const props = ALL[name];\n techOptions[props.getterName] = this[props.privateName];\n });\n Object.assign(techOptions, this.options_[titleTechName]);\n Object.assign(techOptions, this.options_[camelTechName]);\n Object.assign(techOptions, this.options_[techName.toLowerCase()]);\n if (this.tag) {\n techOptions.tag = this.tag;\n }\n if (source && source.src === this.cache_.src && this.cache_.currentTime > 0) {\n techOptions.startTime = this.cache_.currentTime;\n }\n\n // Initialize tech instance\n const TechClass = Tech.getTech(techName);\n if (!TechClass) {\n throw new Error(`No Tech named '${titleTechName}' exists! '${titleTechName}' should be registered using videojs.registerTech()'`);\n }\n this.tech_ = new TechClass(techOptions);\n\n // player.triggerReady is always async, so don't need this to be async\n this.tech_.ready(bind_(this, this.handleTechReady_), true);\n textTrackConverter.jsonToTextTracks(this.textTracksJson_ || [], this.tech_);\n\n // Listen to all HTML5-defined events and trigger them on the player\n TECH_EVENTS_RETRIGGER.forEach(event => {\n this.on(this.tech_, event, e => this[`handleTech${toTitleCase$1(event)}_`](e));\n });\n Object.keys(TECH_EVENTS_QUEUE).forEach(event => {\n this.on(this.tech_, event, eventObj => {\n if (this.tech_.playbackRate() === 0 && this.tech_.seeking()) {\n this.queuedCallbacks_.push({\n callback: this[`handleTech${TECH_EVENTS_QUEUE[event]}_`].bind(this),\n event: eventObj\n });\n return;\n }\n this[`handleTech${TECH_EVENTS_QUEUE[event]}_`](eventObj);\n });\n });\n this.on(this.tech_, 'loadstart', e => this.handleTechLoadStart_(e));\n this.on(this.tech_, 'sourceset', e => this.handleTechSourceset_(e));\n this.on(this.tech_, 'waiting', e => this.handleTechWaiting_(e));\n this.on(this.tech_, 'ended', e => this.handleTechEnded_(e));\n this.on(this.tech_, 'seeking', e => this.handleTechSeeking_(e));\n this.on(this.tech_, 'play', e => this.handleTechPlay_(e));\n this.on(this.tech_, 'pause', e => this.handleTechPause_(e));\n this.on(this.tech_, 'durationchange', e => this.handleTechDurationChange_(e));\n this.on(this.tech_, 'fullscreenchange', (e, data) => this.handleTechFullscreenChange_(e, data));\n this.on(this.tech_, 'fullscreenerror', (e, err) => this.handleTechFullscreenError_(e, err));\n this.on(this.tech_, 'enterpictureinpicture', e => this.handleTechEnterPictureInPicture_(e));\n this.on(this.tech_, 'leavepictureinpicture', e => this.handleTechLeavePictureInPicture_(e));\n this.on(this.tech_, 'error', e => this.handleTechError_(e));\n this.on(this.tech_, 'posterchange', e => this.handleTechPosterChange_(e));\n this.on(this.tech_, 'textdata', e => this.handleTechTextData_(e));\n this.on(this.tech_, 'ratechange', e => this.handleTechRateChange_(e));\n this.on(this.tech_, 'loadedmetadata', this.boundUpdateStyleEl_);\n this.usingNativeControls(this.techGet_('controls'));\n if (this.controls() && !this.usingNativeControls()) {\n this.addTechControlsListeners_();\n }\n\n // Add the tech element in the DOM if it was not already there\n // Make sure to not insert the original video element if using Html5\n if (this.tech_.el().parentNode !== this.el() && (titleTechName !== 'Html5' || !this.tag)) {\n prependTo(this.tech_.el(), this.el());\n }\n\n // Get rid of the original video tag reference after the first tech is loaded\n if (this.tag) {\n this.tag.player = null;\n this.tag = null;\n }\n }\n\n /**\n * Unload and dispose of the current playback {@link Tech}.\n *\n * @private\n */\n unloadTech_() {\n // Save the current text tracks so that we can reuse the same text tracks with the next tech\n ALL.names.forEach(name => {\n const props = ALL[name];\n this[props.privateName] = this[props.getterName]();\n });\n this.textTracksJson_ = textTrackConverter.textTracksToJson(this.tech_);\n this.isReady_ = false;\n this.tech_.dispose();\n this.tech_ = false;\n if (this.isPosterFromTech_) {\n this.poster_ = '';\n this.trigger('posterchange');\n }\n this.isPosterFromTech_ = false;\n }\n\n /**\n * Return a reference to the current {@link Tech}.\n * It will print a warning by default about the danger of using the tech directly\n * but any argument that is passed in will silence the warning.\n *\n * @param {*} [safety]\n * Anything passed in to silence the warning\n *\n * @return {Tech}\n * The Tech\n */\n tech(safety) {\n if (safety === undefined) {\n log$1.warn('Using the tech directly can be dangerous. I hope you know what you\\'re doing.\\n' + 'See https://github.com/videojs/video.js/issues/2617 for more info.\\n');\n }\n return this.tech_;\n }\n\n /**\n * Set up click and touch listeners for the playback element\n *\n * - On desktops: a click on the video itself will toggle playback\n * - On mobile devices: a click on the video toggles controls\n * which is done by toggling the user state between active and\n * inactive\n * - A tap can signal that a user has become active or has become inactive\n * e.g. a quick tap on an iPhone movie should reveal the controls. Another\n * quick tap should hide them again (signaling the user is in an inactive\n * viewing state)\n * - In addition to this, we still want the user to be considered inactive after\n * a few seconds of inactivity.\n *\n * > Note: the only part of iOS interaction we can't mimic with this setup\n * is a touch and hold on the video element counting as activity in order to\n * keep the controls showing, but that shouldn't be an issue. A touch and hold\n * on any controls will still keep the user active\n *\n * @private\n */\n addTechControlsListeners_() {\n // Make sure to remove all the previous listeners in case we are called multiple times.\n this.removeTechControlsListeners_();\n this.on(this.tech_, 'click', this.boundHandleTechClick_);\n this.on(this.tech_, 'dblclick', this.boundHandleTechDoubleClick_);\n\n // If the controls were hidden we don't want that to change without a tap event\n // so we'll check if the controls were already showing before reporting user\n // activity\n this.on(this.tech_, 'touchstart', this.boundHandleTechTouchStart_);\n this.on(this.tech_, 'touchmove', this.boundHandleTechTouchMove_);\n this.on(this.tech_, 'touchend', this.boundHandleTechTouchEnd_);\n\n // The tap listener needs to come after the touchend listener because the tap\n // listener cancels out any reportedUserActivity when setting userActive(false)\n this.on(this.tech_, 'tap', this.boundHandleTechTap_);\n }\n\n /**\n * Remove the listeners used for click and tap controls. This is needed for\n * toggling to controls disabled, where a tap/touch should do nothing.\n *\n * @private\n */\n removeTechControlsListeners_() {\n // We don't want to just use `this.off()` because there might be other needed\n // listeners added by techs that extend this.\n this.off(this.tech_, 'tap', this.boundHandleTechTap_);\n this.off(this.tech_, 'touchstart', this.boundHandleTechTouchStart_);\n this.off(this.tech_, 'touchmove', this.boundHandleTechTouchMove_);\n this.off(this.tech_, 'touchend', this.boundHandleTechTouchEnd_);\n this.off(this.tech_, 'click', this.boundHandleTechClick_);\n this.off(this.tech_, 'dblclick', this.boundHandleTechDoubleClick_);\n }\n\n /**\n * Player waits for the tech to be ready\n *\n * @private\n */\n handleTechReady_() {\n this.triggerReady();\n\n // Keep the same volume as before\n if (this.cache_.volume) {\n this.techCall_('setVolume', this.cache_.volume);\n }\n\n // Look if the tech found a higher resolution poster while loading\n this.handleTechPosterChange_();\n\n // Update the duration if available\n this.handleTechDurationChange_();\n }\n\n /**\n * Retrigger the `loadstart` event that was triggered by the {@link Tech}.\n *\n * @fires Player#loadstart\n * @listens Tech#loadstart\n * @private\n */\n handleTechLoadStart_() {\n // TODO: Update to use `emptied` event instead. See #1277.\n\n this.removeClass('vjs-ended', 'vjs-seeking');\n\n // reset the error state\n this.error(null);\n\n // Update the duration\n this.handleTechDurationChange_();\n if (!this.paused()) {\n /**\n * Fired when the user agent begins looking for media data\n *\n * @event Player#loadstart\n * @type {Event}\n */\n this.trigger('loadstart');\n } else {\n // reset the hasStarted state\n this.hasStarted(false);\n this.trigger('loadstart');\n }\n\n // autoplay happens after loadstart for the browser,\n // so we mimic that behavior\n this.manualAutoplay_(this.autoplay() === true && this.options_.normalizeAutoplay ? 'play' : this.autoplay());\n }\n\n /**\n * Handle autoplay string values, rather than the typical boolean\n * values that should be handled by the tech. Note that this is not\n * part of any specification. Valid values and what they do can be\n * found on the autoplay getter at Player#autoplay()\n */\n manualAutoplay_(type) {\n if (!this.tech_ || typeof type !== 'string') {\n return;\n }\n\n // Save original muted() value, set muted to true, and attempt to play().\n // On promise rejection, restore muted from saved value\n const resolveMuted = () => {\n const previouslyMuted = this.muted();\n this.muted(true);\n const restoreMuted = () => {\n this.muted(previouslyMuted);\n };\n\n // restore muted on play terminatation\n this.playTerminatedQueue_.push(restoreMuted);\n const mutedPromise = this.play();\n if (!isPromise(mutedPromise)) {\n return;\n }\n return mutedPromise.catch(err => {\n restoreMuted();\n throw new Error(`Rejection at manualAutoplay. Restoring muted value. ${err ? err : ''}`);\n });\n };\n let promise;\n\n // if muted defaults to true\n // the only thing we can do is call play\n if (type === 'any' && !this.muted()) {\n promise = this.play();\n if (isPromise(promise)) {\n promise = promise.catch(resolveMuted);\n }\n } else if (type === 'muted' && !this.muted()) {\n promise = resolveMuted();\n } else {\n promise = this.play();\n }\n if (!isPromise(promise)) {\n return;\n }\n return promise.then(() => {\n this.trigger({\n type: 'autoplay-success',\n autoplay: type\n });\n }).catch(() => {\n this.trigger({\n type: 'autoplay-failure',\n autoplay: type\n });\n });\n }\n\n /**\n * Update the internal source caches so that we return the correct source from\n * `src()`, `currentSource()`, and `currentSources()`.\n *\n * > Note: `currentSources` will not be updated if the source that is passed in exists\n * in the current `currentSources` cache.\n *\n *\n * @param {Tech~SourceObject} srcObj\n * A string or object source to update our caches to.\n */\n updateSourceCaches_(srcObj = '') {\n let src = srcObj;\n let type = '';\n if (typeof src !== 'string') {\n src = srcObj.src;\n type = srcObj.type;\n }\n\n // make sure all the caches are set to default values\n // to prevent null checking\n this.cache_.source = this.cache_.source || {};\n this.cache_.sources = this.cache_.sources || [];\n\n // try to get the type of the src that was passed in\n if (src && !type) {\n type = findMimetype(this, src);\n }\n\n // update `currentSource` cache always\n this.cache_.source = merge$1({}, srcObj, {\n src,\n type\n });\n const matchingSources = this.cache_.sources.filter(s => s.src && s.src === src);\n const sourceElSources = [];\n const sourceEls = this.$$('source');\n const matchingSourceEls = [];\n for (let i = 0; i < sourceEls.length; i++) {\n const sourceObj = getAttributes(sourceEls[i]);\n sourceElSources.push(sourceObj);\n if (sourceObj.src && sourceObj.src === src) {\n matchingSourceEls.push(sourceObj.src);\n }\n }\n\n // if we have matching source els but not matching sources\n // the current source cache is not up to date\n if (matchingSourceEls.length && !matchingSources.length) {\n this.cache_.sources = sourceElSources;\n // if we don't have matching source or source els set the\n // sources cache to the `currentSource` cache\n } else if (!matchingSources.length) {\n this.cache_.sources = [this.cache_.source];\n }\n\n // update the tech `src` cache\n this.cache_.src = src;\n }\n\n /**\n * *EXPERIMENTAL* Fired when the source is set or changed on the {@link Tech}\n * causing the media element to reload.\n *\n * It will fire for the initial source and each subsequent source.\n * This event is a custom event from Video.js and is triggered by the {@link Tech}.\n *\n * The event object for this event contains a `src` property that will contain the source\n * that was available when the event was triggered. This is generally only necessary if Video.js\n * is switching techs while the source was being changed.\n *\n * It is also fired when `load` is called on the player (or media element)\n * because the {@link https://html.spec.whatwg.org/multipage/media.html#dom-media-load|specification for `load`}\n * says that the resource selection algorithm needs to be aborted and restarted.\n * In this case, it is very likely that the `src` property will be set to the\n * empty string `\"\"` to indicate we do not know what the source will be but\n * that it is changing.\n *\n * *This event is currently still experimental and may change in minor releases.*\n * __To use this, pass `enableSourceset` option to the player.__\n *\n * @event Player#sourceset\n * @type {Event}\n * @prop {string} src\n * The source url available when the `sourceset` was triggered.\n * It will be an empty string if we cannot know what the source is\n * but know that the source will change.\n */\n /**\n * Retrigger the `sourceset` event that was triggered by the {@link Tech}.\n *\n * @fires Player#sourceset\n * @listens Tech#sourceset\n * @private\n */\n handleTechSourceset_(event) {\n // only update the source cache when the source\n // was not updated using the player api\n if (!this.changingSrc_) {\n let updateSourceCaches = src => this.updateSourceCaches_(src);\n const playerSrc = this.currentSource().src;\n const eventSrc = event.src;\n\n // if we have a playerSrc that is not a blob, and a tech src that is a blob\n if (playerSrc && !/^blob:/.test(playerSrc) && /^blob:/.test(eventSrc)) {\n // if both the tech source and the player source were updated we assume\n // something like @videojs/http-streaming did the sourceset and skip updating the source cache.\n if (!this.lastSource_ || this.lastSource_.tech !== eventSrc && this.lastSource_.player !== playerSrc) {\n updateSourceCaches = () => {};\n }\n }\n\n // update the source to the initial source right away\n // in some cases this will be empty string\n updateSourceCaches(eventSrc);\n\n // if the `sourceset` `src` was an empty string\n // wait for a `loadstart` to update the cache to `currentSrc`.\n // If a sourceset happens before a `loadstart`, we reset the state\n if (!event.src) {\n this.tech_.any(['sourceset', 'loadstart'], e => {\n // if a sourceset happens before a `loadstart` there\n // is nothing to do as this `handleTechSourceset_`\n // will be called again and this will be handled there.\n if (e.type === 'sourceset') {\n return;\n }\n const techSrc = this.techGet_('currentSrc');\n this.lastSource_.tech = techSrc;\n this.updateSourceCaches_(techSrc);\n });\n }\n }\n this.lastSource_ = {\n player: this.currentSource().src,\n tech: event.src\n };\n this.trigger({\n src: event.src,\n type: 'sourceset'\n });\n }\n\n /**\n * Add/remove the vjs-has-started class\n *\n *\n * @param {boolean} request\n * - true: adds the class\n * - false: remove the class\n *\n * @return {boolean}\n * the boolean value of hasStarted_\n */\n hasStarted(request) {\n if (request === undefined) {\n // act as getter, if we have no request to change\n return this.hasStarted_;\n }\n if (request === this.hasStarted_) {\n return;\n }\n this.hasStarted_ = request;\n if (this.hasStarted_) {\n this.addClass('vjs-has-started');\n } else {\n this.removeClass('vjs-has-started');\n }\n }\n\n /**\n * Fired whenever the media begins or resumes playback\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-play}\n * @fires Player#play\n * @listens Tech#play\n * @private\n */\n handleTechPlay_() {\n this.removeClass('vjs-ended', 'vjs-paused');\n this.addClass('vjs-playing');\n\n // hide the poster when the user hits play\n this.hasStarted(true);\n /**\n * Triggered whenever an {@link Tech#play} event happens. Indicates that\n * playback has started or resumed.\n *\n * @event Player#play\n * @type {Event}\n */\n this.trigger('play');\n }\n\n /**\n * Retrigger the `ratechange` event that was triggered by the {@link Tech}.\n *\n * If there were any events queued while the playback rate was zero, fire\n * those events now.\n *\n * @private\n * @method Player#handleTechRateChange_\n * @fires Player#ratechange\n * @listens Tech#ratechange\n */\n handleTechRateChange_() {\n if (this.tech_.playbackRate() > 0 && this.cache_.lastPlaybackRate === 0) {\n this.queuedCallbacks_.forEach(queued => queued.callback(queued.event));\n this.queuedCallbacks_ = [];\n }\n this.cache_.lastPlaybackRate = this.tech_.playbackRate();\n /**\n * Fires when the playing speed of the audio/video is changed\n *\n * @event Player#ratechange\n * @type {event}\n */\n this.trigger('ratechange');\n }\n\n /**\n * Retrigger the `waiting` event that was triggered by the {@link Tech}.\n *\n * @fires Player#waiting\n * @listens Tech#waiting\n * @private\n */\n handleTechWaiting_() {\n this.addClass('vjs-waiting');\n /**\n * A readyState change on the DOM element has caused playback to stop.\n *\n * @event Player#waiting\n * @type {Event}\n */\n this.trigger('waiting');\n\n // Browsers may emit a timeupdate event after a waiting event. In order to prevent\n // premature removal of the waiting class, wait for the time to change.\n const timeWhenWaiting = this.currentTime();\n const timeUpdateListener = () => {\n if (timeWhenWaiting !== this.currentTime()) {\n this.removeClass('vjs-waiting');\n this.off('timeupdate', timeUpdateListener);\n }\n };\n this.on('timeupdate', timeUpdateListener);\n }\n\n /**\n * Retrigger the `canplay` event that was triggered by the {@link Tech}.\n * > Note: This is not consistent between browsers. See #1351\n *\n * @fires Player#canplay\n * @listens Tech#canplay\n * @private\n */\n handleTechCanPlay_() {\n this.removeClass('vjs-waiting');\n /**\n * The media has a readyState of HAVE_FUTURE_DATA or greater.\n *\n * @event Player#canplay\n * @type {Event}\n */\n this.trigger('canplay');\n }\n\n /**\n * Retrigger the `canplaythrough` event that was triggered by the {@link Tech}.\n *\n * @fires Player#canplaythrough\n * @listens Tech#canplaythrough\n * @private\n */\n handleTechCanPlayThrough_() {\n this.removeClass('vjs-waiting');\n /**\n * The media has a readyState of HAVE_ENOUGH_DATA or greater. This means that the\n * entire media file can be played without buffering.\n *\n * @event Player#canplaythrough\n * @type {Event}\n */\n this.trigger('canplaythrough');\n }\n\n /**\n * Retrigger the `playing` event that was triggered by the {@link Tech}.\n *\n * @fires Player#playing\n * @listens Tech#playing\n * @private\n */\n handleTechPlaying_() {\n this.removeClass('vjs-waiting');\n /**\n * The media is no longer blocked from playback, and has started playing.\n *\n * @event Player#playing\n * @type {Event}\n */\n this.trigger('playing');\n }\n\n /**\n * Retrigger the `seeking` event that was triggered by the {@link Tech}.\n *\n * @fires Player#seeking\n * @listens Tech#seeking\n * @private\n */\n handleTechSeeking_() {\n this.addClass('vjs-seeking');\n /**\n * Fired whenever the player is jumping to a new time\n *\n * @event Player#seeking\n * @type {Event}\n */\n this.trigger('seeking');\n }\n\n /**\n * Retrigger the `seeked` event that was triggered by the {@link Tech}.\n *\n * @fires Player#seeked\n * @listens Tech#seeked\n * @private\n */\n handleTechSeeked_() {\n this.removeClass('vjs-seeking', 'vjs-ended');\n /**\n * Fired when the player has finished jumping to a new time\n *\n * @event Player#seeked\n * @type {Event}\n */\n this.trigger('seeked');\n }\n\n /**\n * Retrigger the `pause` event that was triggered by the {@link Tech}.\n *\n * @fires Player#pause\n * @listens Tech#pause\n * @private\n */\n handleTechPause_() {\n this.removeClass('vjs-playing');\n this.addClass('vjs-paused');\n /**\n * Fired whenever the media has been paused\n *\n * @event Player#pause\n * @type {Event}\n */\n this.trigger('pause');\n }\n\n /**\n * Retrigger the `ended` event that was triggered by the {@link Tech}.\n *\n * @fires Player#ended\n * @listens Tech#ended\n * @private\n */\n handleTechEnded_() {\n this.addClass('vjs-ended');\n this.removeClass('vjs-waiting');\n if (this.options_.loop) {\n this.currentTime(0);\n this.play();\n } else if (!this.paused()) {\n this.pause();\n }\n\n /**\n * Fired when the end of the media resource is reached (currentTime == duration)\n *\n * @event Player#ended\n * @type {Event}\n */\n this.trigger('ended');\n }\n\n /**\n * Fired when the duration of the media resource is first known or changed\n *\n * @listens Tech#durationchange\n * @private\n */\n handleTechDurationChange_() {\n this.duration(this.techGet_('duration'));\n }\n\n /**\n * Handle a click on the media element to play/pause\n *\n * @param {Event} event\n * the event that caused this function to trigger\n *\n * @listens Tech#click\n * @private\n */\n handleTechClick_(event) {\n // When controls are disabled a click should not toggle playback because\n // the click is considered a control\n if (!this.controls_) {\n return;\n }\n if (this.options_ === undefined || this.options_.userActions === undefined || this.options_.userActions.click === undefined || this.options_.userActions.click !== false) {\n if (this.options_ !== undefined && this.options_.userActions !== undefined && typeof this.options_.userActions.click === 'function') {\n this.options_.userActions.click.call(this, event);\n } else if (this.paused()) {\n silencePromise(this.play());\n } else {\n this.pause();\n }\n }\n }\n\n /**\n * Handle a double-click on the media element to enter/exit fullscreen\n *\n * @param {Event} event\n * the event that caused this function to trigger\n *\n * @listens Tech#dblclick\n * @private\n */\n handleTechDoubleClick_(event) {\n if (!this.controls_) {\n return;\n }\n\n // we do not want to toggle fullscreen state\n // when double-clicking inside a control bar or a modal\n const inAllowedEls = Array.prototype.some.call(this.$$('.vjs-control-bar, .vjs-modal-dialog'), el => el.contains(event.target));\n if (!inAllowedEls) {\n /*\n * options.userActions.doubleClick\n *\n * If `undefined` or `true`, double-click toggles fullscreen if controls are present\n * Set to `false` to disable double-click handling\n * Set to a function to substitute an external double-click handler\n */\n if (this.options_ === undefined || this.options_.userActions === undefined || this.options_.userActions.doubleClick === undefined || this.options_.userActions.doubleClick !== false) {\n if (this.options_ !== undefined && this.options_.userActions !== undefined && typeof this.options_.userActions.doubleClick === 'function') {\n this.options_.userActions.doubleClick.call(this, event);\n } else if (this.isFullscreen()) {\n this.exitFullscreen();\n } else {\n this.requestFullscreen();\n }\n }\n }\n }\n\n /**\n * Handle a tap on the media element. It will toggle the user\n * activity state, which hides and shows the controls.\n *\n * @listens Tech#tap\n * @private\n */\n handleTechTap_() {\n this.userActive(!this.userActive());\n }\n\n /**\n * Handle touch to start\n *\n * @listens Tech#touchstart\n * @private\n */\n handleTechTouchStart_() {\n this.userWasActive = this.userActive();\n }\n\n /**\n * Handle touch to move\n *\n * @listens Tech#touchmove\n * @private\n */\n handleTechTouchMove_() {\n if (this.userWasActive) {\n this.reportUserActivity();\n }\n }\n\n /**\n * Handle touch to end\n *\n * @param {Event} event\n * the touchend event that triggered\n * this function\n *\n * @listens Tech#touchend\n * @private\n */\n handleTechTouchEnd_(event) {\n // Stop the mouse events from also happening\n if (event.cancelable) {\n event.preventDefault();\n }\n }\n\n /**\n * @private\n */\n toggleFullscreenClass_() {\n if (this.isFullscreen()) {\n this.addClass('vjs-fullscreen');\n } else {\n this.removeClass('vjs-fullscreen');\n }\n }\n\n /**\n * when the document fschange event triggers it calls this\n */\n documentFullscreenChange_(e) {\n const targetPlayer = e.target.player;\n\n // if another player was fullscreen\n // do a null check for targetPlayer because older firefox's would put document as e.target\n if (targetPlayer && targetPlayer !== this) {\n return;\n }\n const el = this.el();\n let isFs = (global_document__WEBPACK_IMPORTED_MODULE_1___default())[this.fsApi_.fullscreenElement] === el;\n if (!isFs && el.matches) {\n isFs = el.matches(':' + this.fsApi_.fullscreen);\n }\n this.isFullscreen(isFs);\n }\n\n /**\n * Handle Tech Fullscreen Change\n *\n * @param {Event} event\n * the fullscreenchange event that triggered this function\n *\n * @param {Object} data\n * the data that was sent with the event\n *\n * @private\n * @listens Tech#fullscreenchange\n * @fires Player#fullscreenchange\n */\n handleTechFullscreenChange_(event, data) {\n if (data) {\n if (data.nativeIOSFullscreen) {\n this.addClass('vjs-ios-native-fs');\n this.tech_.one('webkitendfullscreen', () => {\n this.removeClass('vjs-ios-native-fs');\n });\n }\n this.isFullscreen(data.isFullscreen);\n }\n }\n handleTechFullscreenError_(event, err) {\n this.trigger('fullscreenerror', err);\n }\n\n /**\n * @private\n */\n togglePictureInPictureClass_() {\n if (this.isInPictureInPicture()) {\n this.addClass('vjs-picture-in-picture');\n } else {\n this.removeClass('vjs-picture-in-picture');\n }\n }\n\n /**\n * Handle Tech Enter Picture-in-Picture.\n *\n * @param {Event} event\n * the enterpictureinpicture event that triggered this function\n *\n * @private\n * @listens Tech#enterpictureinpicture\n */\n handleTechEnterPictureInPicture_(event) {\n this.isInPictureInPicture(true);\n }\n\n /**\n * Handle Tech Leave Picture-in-Picture.\n *\n * @param {Event} event\n * the leavepictureinpicture event that triggered this function\n *\n * @private\n * @listens Tech#leavepictureinpicture\n */\n handleTechLeavePictureInPicture_(event) {\n this.isInPictureInPicture(false);\n }\n\n /**\n * Fires when an error occurred during the loading of an audio/video.\n *\n * @private\n * @listens Tech#error\n */\n handleTechError_() {\n const error = this.tech_.error();\n if (error) {\n this.error(error);\n }\n }\n\n /**\n * Retrigger the `textdata` event that was triggered by the {@link Tech}.\n *\n * @fires Player#textdata\n * @listens Tech#textdata\n * @private\n */\n handleTechTextData_() {\n let data = null;\n if (arguments.length > 1) {\n data = arguments[1];\n }\n\n /**\n * Fires when we get a textdata event from tech\n *\n * @event Player#textdata\n * @type {Event}\n */\n this.trigger('textdata', data);\n }\n\n /**\n * Get object for cached values.\n *\n * @return {Object}\n * get the current object cache\n */\n getCache() {\n return this.cache_;\n }\n\n /**\n * Resets the internal cache object.\n *\n * Using this function outside the player constructor or reset method may\n * have unintended side-effects.\n *\n * @private\n */\n resetCache_() {\n this.cache_ = {\n // Right now, the currentTime is not _really_ cached because it is always\n // retrieved from the tech (see: currentTime). However, for completeness,\n // we set it to zero here to ensure that if we do start actually caching\n // it, we reset it along with everything else.\n currentTime: 0,\n initTime: 0,\n inactivityTimeout: this.options_.inactivityTimeout,\n duration: NaN,\n lastVolume: 1,\n lastPlaybackRate: this.defaultPlaybackRate(),\n media: null,\n src: '',\n source: {},\n sources: [],\n playbackRates: [],\n volume: 1\n };\n }\n\n /**\n * Pass values to the playback tech\n *\n * @param {string} [method]\n * the method to call\n *\n * @param {Object} [arg]\n * the argument to pass\n *\n * @private\n */\n techCall_(method, arg) {\n // If it's not ready yet, call method when it is\n\n this.ready(function () {\n if (method in allowedSetters) {\n return set(this.middleware_, this.tech_, method, arg);\n } else if (method in allowedMediators) {\n return mediate(this.middleware_, this.tech_, method, arg);\n }\n try {\n if (this.tech_) {\n this.tech_[method](arg);\n }\n } catch (e) {\n log$1(e);\n throw e;\n }\n }, true);\n }\n\n /**\n * Mediate attempt to call playback tech method\n * and return the value of the method called.\n *\n * @param {string} method\n * Tech method\n *\n * @return {*}\n * Value returned by the tech method called, undefined if tech\n * is not ready or tech method is not present\n *\n * @private\n */\n techGet_(method) {\n if (!this.tech_ || !this.tech_.isReady_) {\n return;\n }\n if (method in allowedGetters) {\n return get(this.middleware_, this.tech_, method);\n } else if (method in allowedMediators) {\n return mediate(this.middleware_, this.tech_, method);\n }\n\n // Log error when playback tech object is present but method\n // is undefined or unavailable\n try {\n return this.tech_[method]();\n } catch (e) {\n // When building additional tech libs, an expected method may not be defined yet\n if (this.tech_[method] === undefined) {\n log$1(`Video.js: ${method} method not defined for ${this.techName_} playback technology.`, e);\n throw e;\n }\n\n // When a method isn't available on the object it throws a TypeError\n if (e.name === 'TypeError') {\n log$1(`Video.js: ${method} unavailable on ${this.techName_} playback technology element.`, e);\n this.tech_.isReady_ = false;\n throw e;\n }\n\n // If error unknown, just log and throw\n log$1(e);\n throw e;\n }\n }\n\n /**\n * Attempt to begin playback at the first opportunity.\n *\n * @return {Promise|undefined}\n * Returns a promise if the browser supports Promises (or one\n * was passed in as an option). This promise will be resolved on\n * the return value of play. If this is undefined it will fulfill the\n * promise chain otherwise the promise chain will be fulfilled when\n * the promise from play is fulfilled.\n */\n play() {\n return new Promise(resolve => {\n this.play_(resolve);\n });\n }\n\n /**\n * The actual logic for play, takes a callback that will be resolved on the\n * return value of play. This allows us to resolve to the play promise if there\n * is one on modern browsers.\n *\n * @private\n * @param {Function} [callback]\n * The callback that should be called when the techs play is actually called\n */\n play_(callback = silencePromise) {\n this.playCallbacks_.push(callback);\n const isSrcReady = Boolean(!this.changingSrc_ && (this.src() || this.currentSrc()));\n const isSafariOrIOS = Boolean(IS_ANY_SAFARI || IS_IOS);\n\n // treat calls to play_ somewhat like the `one` event function\n if (this.waitToPlay_) {\n this.off(['ready', 'loadstart'], this.waitToPlay_);\n this.waitToPlay_ = null;\n }\n\n // if the player/tech is not ready or the src itself is not ready\n // queue up a call to play on `ready` or `loadstart`\n if (!this.isReady_ || !isSrcReady) {\n this.waitToPlay_ = e => {\n this.play_();\n };\n this.one(['ready', 'loadstart'], this.waitToPlay_);\n\n // if we are in Safari, there is a high chance that loadstart will trigger after the gesture timeperiod\n // in that case, we need to prime the video element by calling load so it'll be ready in time\n if (!isSrcReady && isSafariOrIOS) {\n this.load();\n }\n return;\n }\n\n // If the player/tech is ready and we have a source, we can attempt playback.\n const val = this.techGet_('play');\n\n // For native playback, reset the progress bar if we get a play call from a replay.\n const isNativeReplay = isSafariOrIOS && this.hasClass('vjs-ended');\n if (isNativeReplay) {\n this.resetProgressBar_();\n }\n // play was terminated if the returned value is null\n if (val === null) {\n this.runPlayTerminatedQueue_();\n } else {\n this.runPlayCallbacks_(val);\n }\n }\n\n /**\n * These functions will be run when if play is terminated. If play\n * runPlayCallbacks_ is run these function will not be run. This allows us\n * to differentiate between a terminated play and an actual call to play.\n */\n runPlayTerminatedQueue_() {\n const queue = this.playTerminatedQueue_.slice(0);\n this.playTerminatedQueue_ = [];\n queue.forEach(function (q) {\n q();\n });\n }\n\n /**\n * When a callback to play is delayed we have to run these\n * callbacks when play is actually called on the tech. This function\n * runs the callbacks that were delayed and accepts the return value\n * from the tech.\n *\n * @param {undefined|Promise} val\n * The return value from the tech.\n */\n runPlayCallbacks_(val) {\n const callbacks = this.playCallbacks_.slice(0);\n this.playCallbacks_ = [];\n // clear play terminatedQueue since we finished a real play\n this.playTerminatedQueue_ = [];\n callbacks.forEach(function (cb) {\n cb(val);\n });\n }\n\n /**\n * Pause the video playback\n */\n pause() {\n this.techCall_('pause');\n }\n\n /**\n * Check if the player is paused or has yet to play\n *\n * @return {boolean}\n * - false: if the media is currently playing\n * - true: if media is not currently playing\n */\n paused() {\n // The initial state of paused should be true (in Safari it's actually false)\n return this.techGet_('paused') === false ? false : true;\n }\n\n /**\n * Get a TimeRange object representing the current ranges of time that the user\n * has played.\n *\n * @return { import('./utils/time').TimeRange }\n * A time range object that represents all the increments of time that have\n * been played.\n */\n played() {\n return this.techGet_('played') || createTimeRanges$1(0, 0);\n }\n\n /**\n * Sets or returns whether or not the user is \"scrubbing\". Scrubbing is\n * when the user has clicked the progress bar handle and is\n * dragging it along the progress bar.\n *\n * @param {boolean} [isScrubbing]\n * whether the user is or is not scrubbing\n *\n * @return {boolean|undefined}\n * - The value of scrubbing when getting\n * - Nothing when setting\n */\n scrubbing(isScrubbing) {\n if (typeof isScrubbing === 'undefined') {\n return this.scrubbing_;\n }\n this.scrubbing_ = !!isScrubbing;\n this.techCall_('setScrubbing', this.scrubbing_);\n if (isScrubbing) {\n this.addClass('vjs-scrubbing');\n } else {\n this.removeClass('vjs-scrubbing');\n }\n }\n\n /**\n * Get or set the current time (in seconds)\n *\n * @param {number|string} [seconds]\n * The time to seek to in seconds\n *\n * @return {number|undefined}\n * - the current time in seconds when getting\n * - Nothing when setting\n */\n currentTime(seconds) {\n if (seconds === undefined) {\n // cache last currentTime and return. default to 0 seconds\n //\n // Caching the currentTime is meant to prevent a massive amount of reads on the tech's\n // currentTime when scrubbing, but may not provide much performance benefit after all.\n // Should be tested. Also something has to read the actual current time or the cache will\n // never get updated.\n this.cache_.currentTime = this.techGet_('currentTime') || 0;\n return this.cache_.currentTime;\n }\n if (seconds < 0) {\n seconds = 0;\n }\n if (!this.isReady_ || this.changingSrc_ || !this.tech_ || !this.tech_.isReady_) {\n this.cache_.initTime = seconds;\n this.off('canplay', this.boundApplyInitTime_);\n this.one('canplay', this.boundApplyInitTime_);\n return;\n }\n this.techCall_('setCurrentTime', seconds);\n this.cache_.initTime = 0;\n if (isFinite(seconds)) {\n this.cache_.currentTime = Number(seconds);\n }\n }\n\n /**\n * Apply the value of initTime stored in cache as currentTime.\n *\n * @private\n */\n applyInitTime_() {\n this.currentTime(this.cache_.initTime);\n }\n\n /**\n * Normally gets the length in time of the video in seconds;\n * in all but the rarest use cases an argument will NOT be passed to the method\n *\n * > **NOTE**: The video must have started loading before the duration can be\n * known, and depending on preload behaviour may not be known until the video starts\n * playing.\n *\n * @fires Player#durationchange\n *\n * @param {number} [seconds]\n * The duration of the video to set in seconds\n *\n * @return {number|undefined}\n * - The duration of the video in seconds when getting\n * - Nothing when setting\n */\n duration(seconds) {\n if (seconds === undefined) {\n // return NaN if the duration is not known\n return this.cache_.duration !== undefined ? this.cache_.duration : NaN;\n }\n seconds = parseFloat(seconds);\n\n // Standardize on Infinity for signaling video is live\n if (seconds < 0) {\n seconds = Infinity;\n }\n if (seconds !== this.cache_.duration) {\n // Cache the last set value for optimized scrubbing\n this.cache_.duration = seconds;\n if (seconds === Infinity) {\n this.addClass('vjs-live');\n } else {\n this.removeClass('vjs-live');\n }\n if (!isNaN(seconds)) {\n // Do not fire durationchange unless the duration value is known.\n // @see [Spec]{@link https://www.w3.org/TR/2011/WD-html5-20110113/video.html#media-element-load-algorithm}\n\n /**\n * @event Player#durationchange\n * @type {Event}\n */\n this.trigger('durationchange');\n }\n }\n }\n\n /**\n * Calculates how much time is left in the video. Not part\n * of the native video API.\n *\n * @return {number}\n * The time remaining in seconds\n */\n remainingTime() {\n return this.duration() - this.currentTime();\n }\n\n /**\n * A remaining time function that is intended to be used when\n * the time is to be displayed directly to the user.\n *\n * @return {number}\n * The rounded time remaining in seconds\n */\n remainingTimeDisplay() {\n return Math.floor(this.duration()) - Math.floor(this.currentTime());\n }\n\n //\n // Kind of like an array of portions of the video that have been downloaded.\n\n /**\n * Get a TimeRange object with an array of the times of the video\n * that have been downloaded. If you just want the percent of the\n * video that's been downloaded, use bufferedPercent.\n *\n * @see [Buffered Spec]{@link http://dev.w3.org/html5/spec/video.html#dom-media-buffered}\n *\n * @return { import('./utils/time').TimeRange }\n * A mock {@link TimeRanges} object (following HTML spec)\n */\n buffered() {\n let buffered = this.techGet_('buffered');\n if (!buffered || !buffered.length) {\n buffered = createTimeRanges$1(0, 0);\n }\n return buffered;\n }\n\n /**\n * Get the TimeRanges of the media that are currently available\n * for seeking to.\n *\n * @see [Seekable Spec]{@link https://html.spec.whatwg.org/multipage/media.html#dom-media-seekable}\n *\n * @return { import('./utils/time').TimeRange }\n * A mock {@link TimeRanges} object (following HTML spec)\n */\n seekable() {\n let seekable = this.techGet_('seekable');\n if (!seekable || !seekable.length) {\n seekable = createTimeRanges$1(0, 0);\n }\n return seekable;\n }\n\n /**\n * Returns whether the player is in the \"seeking\" state.\n *\n * @return {boolean} True if the player is in the seeking state, false if not.\n */\n seeking() {\n return this.techGet_('seeking');\n }\n\n /**\n * Returns whether the player is in the \"ended\" state.\n *\n * @return {boolean} True if the player is in the ended state, false if not.\n */\n ended() {\n return this.techGet_('ended');\n }\n\n /**\n * Returns the current state of network activity for the element, from\n * the codes in the list below.\n * - NETWORK_EMPTY (numeric value 0)\n * The element has not yet been initialised. All attributes are in\n * their initial states.\n * - NETWORK_IDLE (numeric value 1)\n * The element's resource selection algorithm is active and has\n * selected a resource, but it is not actually using the network at\n * this time.\n * - NETWORK_LOADING (numeric value 2)\n * The user agent is actively trying to download data.\n * - NETWORK_NO_SOURCE (numeric value 3)\n * The element's resource selection algorithm is active, but it has\n * not yet found a resource to use.\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#network-states\n * @return {number} the current network activity state\n */\n networkState() {\n return this.techGet_('networkState');\n }\n\n /**\n * Returns a value that expresses the current state of the element\n * with respect to rendering the current playback position, from the\n * codes in the list below.\n * - HAVE_NOTHING (numeric value 0)\n * No information regarding the media resource is available.\n * - HAVE_METADATA (numeric value 1)\n * Enough of the resource has been obtained that the duration of the\n * resource is available.\n * - HAVE_CURRENT_DATA (numeric value 2)\n * Data for the immediate current playback position is available.\n * - HAVE_FUTURE_DATA (numeric value 3)\n * Data for the immediate current playback position is available, as\n * well as enough data for the user agent to advance the current\n * playback position in the direction of playback.\n * - HAVE_ENOUGH_DATA (numeric value 4)\n * The user agent estimates that enough data is available for\n * playback to proceed uninterrupted.\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-readystate\n * @return {number} the current playback rendering state\n */\n readyState() {\n return this.techGet_('readyState');\n }\n\n /**\n * Get the percent (as a decimal) of the video that's been downloaded.\n * This method is not a part of the native HTML video API.\n *\n * @return {number}\n * A decimal between 0 and 1 representing the percent\n * that is buffered 0 being 0% and 1 being 100%\n */\n bufferedPercent() {\n return bufferedPercent(this.buffered(), this.duration());\n }\n\n /**\n * Get the ending time of the last buffered time range\n * This is used in the progress bar to encapsulate all time ranges.\n *\n * @return {number}\n * The end of the last buffered time range\n */\n bufferedEnd() {\n const buffered = this.buffered();\n const duration = this.duration();\n let end = buffered.end(buffered.length - 1);\n if (end > duration) {\n end = duration;\n }\n return end;\n }\n\n /**\n * Get or set the current volume of the media\n *\n * @param {number} [percentAsDecimal]\n * The new volume as a decimal percent:\n * - 0 is muted/0%/off\n * - 1.0 is 100%/full\n * - 0.5 is half volume or 50%\n *\n * @return {number|undefined}\n * The current volume as a percent when getting\n */\n volume(percentAsDecimal) {\n let vol;\n if (percentAsDecimal !== undefined) {\n // Force value to between 0 and 1\n vol = Math.max(0, Math.min(1, percentAsDecimal));\n this.cache_.volume = vol;\n this.techCall_('setVolume', vol);\n if (vol > 0) {\n this.lastVolume_(vol);\n }\n return;\n }\n\n // Default to 1 when returning current volume.\n vol = parseFloat(this.techGet_('volume'));\n return isNaN(vol) ? 1 : vol;\n }\n\n /**\n * Get the current muted state, or turn mute on or off\n *\n * @param {boolean} [muted]\n * - true to mute\n * - false to unmute\n *\n * @return {boolean|undefined}\n * - true if mute is on and getting\n * - false if mute is off and getting\n * - nothing if setting\n */\n muted(muted) {\n if (muted !== undefined) {\n this.techCall_('setMuted', muted);\n return;\n }\n return this.techGet_('muted') || false;\n }\n\n /**\n * Get the current defaultMuted state, or turn defaultMuted on or off. defaultMuted\n * indicates the state of muted on initial playback.\n *\n * ```js\n * var myPlayer = videojs('some-player-id');\n *\n * myPlayer.src(\"http://www.example.com/path/to/video.mp4\");\n *\n * // get, should be false\n * console.log(myPlayer.defaultMuted());\n * // set to true\n * myPlayer.defaultMuted(true);\n * // get should be true\n * console.log(myPlayer.defaultMuted());\n * ```\n *\n * @param {boolean} [defaultMuted]\n * - true to mute\n * - false to unmute\n *\n * @return {boolean|undefined}\n * - true if defaultMuted is on and getting\n * - false if defaultMuted is off and getting\n * - Nothing when setting\n */\n defaultMuted(defaultMuted) {\n if (defaultMuted !== undefined) {\n this.techCall_('setDefaultMuted', defaultMuted);\n }\n return this.techGet_('defaultMuted') || false;\n }\n\n /**\n * Get the last volume, or set it\n *\n * @param {number} [percentAsDecimal]\n * The new last volume as a decimal percent:\n * - 0 is muted/0%/off\n * - 1.0 is 100%/full\n * - 0.5 is half volume or 50%\n *\n * @return {number|undefined}\n * - The current value of lastVolume as a percent when getting\n * - Nothing when setting\n *\n * @private\n */\n lastVolume_(percentAsDecimal) {\n if (percentAsDecimal !== undefined && percentAsDecimal !== 0) {\n this.cache_.lastVolume = percentAsDecimal;\n return;\n }\n return this.cache_.lastVolume;\n }\n\n /**\n * Check if current tech can support native fullscreen\n * (e.g. with built in controls like iOS)\n *\n * @return {boolean}\n * if native fullscreen is supported\n */\n supportsFullScreen() {\n return this.techGet_('supportsFullScreen') || false;\n }\n\n /**\n * Check if the player is in fullscreen mode or tell the player that it\n * is or is not in fullscreen mode.\n *\n * > NOTE: As of the latest HTML5 spec, isFullscreen is no longer an official\n * property and instead document.fullscreenElement is used. But isFullscreen is\n * still a valuable property for internal player workings.\n *\n * @param {boolean} [isFS]\n * Set the players current fullscreen state\n *\n * @return {boolean|undefined}\n * - true if fullscreen is on and getting\n * - false if fullscreen is off and getting\n * - Nothing when setting\n */\n isFullscreen(isFS) {\n if (isFS !== undefined) {\n const oldValue = this.isFullscreen_;\n this.isFullscreen_ = Boolean(isFS);\n\n // if we changed fullscreen state and we're in prefixed mode, trigger fullscreenchange\n // this is the only place where we trigger fullscreenchange events for older browsers\n // fullWindow mode is treated as a prefixed event and will get a fullscreenchange event as well\n if (this.isFullscreen_ !== oldValue && this.fsApi_.prefixed) {\n /**\n * @event Player#fullscreenchange\n * @type {Event}\n */\n this.trigger('fullscreenchange');\n }\n this.toggleFullscreenClass_();\n return;\n }\n return this.isFullscreen_;\n }\n\n /**\n * Increase the size of the video to full screen\n * In some browsers, full screen is not supported natively, so it enters\n * \"full window mode\", where the video fills the browser window.\n * In browsers and devices that support native full screen, sometimes the\n * browser's default controls will be shown, and not the Video.js custom skin.\n * This includes most mobile devices (iOS, Android) and older versions of\n * Safari.\n *\n * @param {Object} [fullscreenOptions]\n * Override the player fullscreen options\n *\n * @fires Player#fullscreenchange\n */\n requestFullscreen(fullscreenOptions) {\n if (this.isInPictureInPicture()) {\n this.exitPictureInPicture();\n }\n const self = this;\n return new Promise((resolve, reject) => {\n function offHandler() {\n self.off('fullscreenerror', errorHandler);\n self.off('fullscreenchange', changeHandler);\n }\n function changeHandler() {\n offHandler();\n resolve();\n }\n function errorHandler(e, err) {\n offHandler();\n reject(err);\n }\n self.one('fullscreenchange', changeHandler);\n self.one('fullscreenerror', errorHandler);\n const promise = self.requestFullscreenHelper_(fullscreenOptions);\n if (promise) {\n promise.then(offHandler, offHandler);\n promise.then(resolve, reject);\n }\n });\n }\n requestFullscreenHelper_(fullscreenOptions) {\n let fsOptions;\n\n // Only pass fullscreen options to requestFullscreen in spec-compliant browsers.\n // Use defaults or player configured option unless passed directly to this method.\n if (!this.fsApi_.prefixed) {\n fsOptions = this.options_.fullscreen && this.options_.fullscreen.options || {};\n if (fullscreenOptions !== undefined) {\n fsOptions = fullscreenOptions;\n }\n }\n\n // This method works as follows:\n // 1. if a fullscreen api is available, use it\n // 1. call requestFullscreen with potential options\n // 2. if we got a promise from above, use it to update isFullscreen()\n // 2. otherwise, if the tech supports fullscreen, call `enterFullScreen` on it.\n // This is particularly used for iPhone, older iPads, and non-safari browser on iOS.\n // 3. otherwise, use \"fullWindow\" mode\n if (this.fsApi_.requestFullscreen) {\n const promise = this.el_[this.fsApi_.requestFullscreen](fsOptions);\n\n // Even on browsers with promise support this may not return a promise\n if (promise) {\n promise.then(() => this.isFullscreen(true), () => this.isFullscreen(false));\n }\n return promise;\n } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {\n // we can't take the video.js controls fullscreen but we can go fullscreen\n // with native controls\n this.techCall_('enterFullScreen');\n } else {\n // fullscreen isn't supported so we'll just stretch the video element to\n // fill the viewport\n this.enterFullWindow();\n }\n }\n\n /**\n * Return the video to its normal size after having been in full screen mode\n *\n * @fires Player#fullscreenchange\n */\n exitFullscreen() {\n const self = this;\n return new Promise((resolve, reject) => {\n function offHandler() {\n self.off('fullscreenerror', errorHandler);\n self.off('fullscreenchange', changeHandler);\n }\n function changeHandler() {\n offHandler();\n resolve();\n }\n function errorHandler(e, err) {\n offHandler();\n reject(err);\n }\n self.one('fullscreenchange', changeHandler);\n self.one('fullscreenerror', errorHandler);\n const promise = self.exitFullscreenHelper_();\n if (promise) {\n promise.then(offHandler, offHandler);\n // map the promise to our resolve/reject methods\n promise.then(resolve, reject);\n }\n });\n }\n exitFullscreenHelper_() {\n if (this.fsApi_.requestFullscreen) {\n const promise = (global_document__WEBPACK_IMPORTED_MODULE_1___default())[this.fsApi_.exitFullscreen]();\n\n // Even on browsers with promise support this may not return a promise\n if (promise) {\n // we're splitting the promise here, so, we want to catch the\n // potential error so that this chain doesn't have unhandled errors\n silencePromise(promise.then(() => this.isFullscreen(false)));\n }\n return promise;\n } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {\n this.techCall_('exitFullScreen');\n } else {\n this.exitFullWindow();\n }\n }\n\n /**\n * When fullscreen isn't supported we can stretch the\n * video container to as wide as the browser will let us.\n *\n * @fires Player#enterFullWindow\n */\n enterFullWindow() {\n this.isFullscreen(true);\n this.isFullWindow = true;\n\n // Storing original doc overflow value to return to when fullscreen is off\n this.docOrigOverflow = (global_document__WEBPACK_IMPORTED_MODULE_1___default().documentElement).style.overflow;\n\n // Add listener for esc key to exit fullscreen\n on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keydown', this.boundFullWindowOnEscKey_);\n\n // Hide any scroll bars\n (global_document__WEBPACK_IMPORTED_MODULE_1___default().documentElement).style.overflow = 'hidden';\n\n // Apply fullscreen styles\n addClass((global_document__WEBPACK_IMPORTED_MODULE_1___default().body), 'vjs-full-window');\n\n /**\n * @event Player#enterFullWindow\n * @type {Event}\n */\n this.trigger('enterFullWindow');\n }\n\n /**\n * Check for call to either exit full window or\n * full screen on ESC key\n *\n * @param {string} event\n * Event to check for key press\n */\n fullWindowOnEscKey(event) {\n if (keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(event, 'Esc')) {\n if (this.isFullscreen() === true) {\n if (!this.isFullWindow) {\n this.exitFullscreen();\n } else {\n this.exitFullWindow();\n }\n }\n }\n }\n\n /**\n * Exit full window\n *\n * @fires Player#exitFullWindow\n */\n exitFullWindow() {\n this.isFullscreen(false);\n this.isFullWindow = false;\n off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keydown', this.boundFullWindowOnEscKey_);\n\n // Unhide scroll bars.\n (global_document__WEBPACK_IMPORTED_MODULE_1___default().documentElement).style.overflow = this.docOrigOverflow;\n\n // Remove fullscreen styles\n removeClass((global_document__WEBPACK_IMPORTED_MODULE_1___default().body), 'vjs-full-window');\n\n // Resize the box, controller, and poster to original sizes\n // this.positionAll();\n /**\n * @event Player#exitFullWindow\n * @type {Event}\n */\n this.trigger('exitFullWindow');\n }\n\n /**\n * Get or set disable Picture-in-Picture mode.\n *\n * @param {boolean} [value]\n * - true will disable Picture-in-Picture mode\n * - false will enable Picture-in-Picture mode\n */\n disablePictureInPicture(value) {\n if (value === undefined) {\n return this.techGet_('disablePictureInPicture');\n }\n this.techCall_('setDisablePictureInPicture', value);\n this.options_.disablePictureInPicture = value;\n this.trigger('disablepictureinpicturechanged');\n }\n\n /**\n * Check if the player is in Picture-in-Picture mode or tell the player that it\n * is or is not in Picture-in-Picture mode.\n *\n * @param {boolean} [isPiP]\n * Set the players current Picture-in-Picture state\n *\n * @return {boolean|undefined}\n * - true if Picture-in-Picture is on and getting\n * - false if Picture-in-Picture is off and getting\n * - nothing if setting\n */\n isInPictureInPicture(isPiP) {\n if (isPiP !== undefined) {\n this.isInPictureInPicture_ = !!isPiP;\n this.togglePictureInPictureClass_();\n return;\n }\n return !!this.isInPictureInPicture_;\n }\n\n /**\n * Create a floating video window always on top of other windows so that users may\n * continue consuming media while they interact with other content sites, or\n * applications on their device.\n *\n * This can use document picture-in-picture or element picture in picture\n *\n * Set `enableDocumentPictureInPicture` to `true` to use docPiP on a supported browser\n * Else set `disablePictureInPicture` to `false` to disable elPiP on a supported browser\n *\n *\n * @see [Spec]{@link https://w3c.github.io/picture-in-picture/}\n * @see [Spec]{@link https://wicg.github.io/document-picture-in-picture/}\n *\n * @fires Player#enterpictureinpicture\n *\n * @return {Promise}\n * A promise with a Picture-in-Picture window.\n */\n requestPictureInPicture() {\n if (this.options_.enableDocumentPictureInPicture && (global_window__WEBPACK_IMPORTED_MODULE_0___default().documentPictureInPicture)) {\n const pipContainer = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement(this.el().tagName);\n pipContainer.classList = this.el().classList;\n pipContainer.classList.add('vjs-pip-container');\n if (this.posterImage) {\n pipContainer.appendChild(this.posterImage.el().cloneNode(true));\n }\n if (this.titleBar) {\n pipContainer.appendChild(this.titleBar.el().cloneNode(true));\n }\n pipContainer.appendChild(createEl('p', {\n className: 'vjs-pip-text'\n }, {}, this.localize('Playing in picture-in-picture')));\n return global_window__WEBPACK_IMPORTED_MODULE_0___default().documentPictureInPicture.requestWindow({\n // The aspect ratio won't be correct, Chrome bug https://crbug.com/1407629\n width: this.videoWidth(),\n height: this.videoHeight()\n }).then(pipWindow => {\n copyStyleSheetsToWindow(pipWindow);\n this.el_.parentNode.insertBefore(pipContainer, this.el_);\n pipWindow.document.body.appendChild(this.el_);\n pipWindow.document.body.classList.add('vjs-pip-window');\n this.player_.isInPictureInPicture(true);\n this.player_.trigger('enterpictureinpicture');\n\n // Listen for the PiP closing event to move the video back.\n pipWindow.addEventListener('pagehide', event => {\n const pipVideo = event.target.querySelector('.video-js');\n pipContainer.parentNode.replaceChild(pipVideo, pipContainer);\n this.player_.isInPictureInPicture(false);\n this.player_.trigger('leavepictureinpicture');\n });\n return pipWindow;\n });\n }\n if (\"pictureInPictureEnabled\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default()) && this.disablePictureInPicture() === false) {\n /**\n * This event fires when the player enters picture in picture mode\n *\n * @event Player#enterpictureinpicture\n * @type {Event}\n */\n return this.techGet_('requestPictureInPicture');\n }\n return Promise.reject('No PiP mode is available');\n }\n\n /**\n * Exit Picture-in-Picture mode.\n *\n * @see [Spec]{@link https://wicg.github.io/picture-in-picture}\n *\n * @fires Player#leavepictureinpicture\n *\n * @return {Promise}\n * A promise.\n */\n exitPictureInPicture() {\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().documentPictureInPicture) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().documentPictureInPicture).window) {\n // With documentPictureInPicture, Player#leavepictureinpicture is fired in the pagehide handler\n global_window__WEBPACK_IMPORTED_MODULE_0___default().documentPictureInPicture.window.close();\n return Promise.resolve();\n }\n if (\"pictureInPictureEnabled\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default())) {\n /**\n * This event fires when the player leaves picture in picture mode\n *\n * @event Player#leavepictureinpicture\n * @type {Event}\n */\n return global_document__WEBPACK_IMPORTED_MODULE_1___default().exitPictureInPicture();\n }\n }\n\n /**\n * Called when this Player has focus and a key gets pressed down, or when\n * any Component of this player receives a key press that it doesn't handle.\n * This allows player-wide hotkeys (either as defined below, or optionally\n * by an external function).\n *\n * @param {KeyboardEvent} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n handleKeyDown(event) {\n const {\n userActions\n } = this.options_;\n\n // Bail out if hotkeys are not configured.\n if (!userActions || !userActions.hotkeys) {\n return;\n }\n\n // Function that determines whether or not to exclude an element from\n // hotkeys handling.\n const excludeElement = el => {\n const tagName = el.tagName.toLowerCase();\n\n // The first and easiest test is for `contenteditable` elements.\n if (el.isContentEditable) {\n return true;\n }\n\n // Inputs matching these types will still trigger hotkey handling as\n // they are not text inputs.\n const allowedInputTypes = ['button', 'checkbox', 'hidden', 'radio', 'reset', 'submit'];\n if (tagName === 'input') {\n return allowedInputTypes.indexOf(el.type) === -1;\n }\n\n // The final test is by tag name. These tags will be excluded entirely.\n const excludedTags = ['textarea'];\n return excludedTags.indexOf(tagName) !== -1;\n };\n\n // Bail out if the user is focused on an interactive form element.\n if (excludeElement(this.el_.ownerDocument.activeElement)) {\n return;\n }\n if (typeof userActions.hotkeys === 'function') {\n userActions.hotkeys.call(this, event);\n } else {\n this.handleHotkeys(event);\n }\n }\n\n /**\n * Called when this Player receives a hotkey keydown event.\n * Supported player-wide hotkeys are:\n *\n * f - toggle fullscreen\n * m - toggle mute\n * k or Space - toggle play/pause\n *\n * @param {Event} event\n * The `keydown` event that caused this function to be called.\n */\n handleHotkeys(event) {\n const hotkeys = this.options_.userActions ? this.options_.userActions.hotkeys : {};\n\n // set fullscreenKey, muteKey, playPauseKey from `hotkeys`, use defaults if not set\n const {\n fullscreenKey = keydownEvent => keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(keydownEvent, 'f'),\n muteKey = keydownEvent => keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(keydownEvent, 'm'),\n playPauseKey = keydownEvent => keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(keydownEvent, 'k') || keycode__WEBPACK_IMPORTED_MODULE_2___default().isEventKey(keydownEvent, 'Space')\n } = hotkeys;\n if (fullscreenKey.call(this, event)) {\n event.preventDefault();\n event.stopPropagation();\n const FSToggle = Component$1.getComponent('FullscreenToggle');\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default())[this.fsApi_.fullscreenEnabled] !== false) {\n FSToggle.prototype.handleClick.call(this, event);\n }\n } else if (muteKey.call(this, event)) {\n event.preventDefault();\n event.stopPropagation();\n const MuteToggle = Component$1.getComponent('MuteToggle');\n MuteToggle.prototype.handleClick.call(this, event);\n } else if (playPauseKey.call(this, event)) {\n event.preventDefault();\n event.stopPropagation();\n const PlayToggle = Component$1.getComponent('PlayToggle');\n PlayToggle.prototype.handleClick.call(this, event);\n }\n }\n\n /**\n * Check whether the player can play a given mimetype\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110113/video.html#dom-navigator-canplaytype\n *\n * @param {string} type\n * The mimetype to check\n *\n * @return {string}\n * 'probably', 'maybe', or '' (empty string)\n */\n canPlayType(type) {\n let can;\n\n // Loop through each playback technology in the options order\n for (let i = 0, j = this.options_.techOrder; i < j.length; i++) {\n const techName = j[i];\n let tech = Tech.getTech(techName);\n\n // Support old behavior of techs being registered as components.\n // Remove once that deprecated behavior is removed.\n if (!tech) {\n tech = Component$1.getComponent(techName);\n }\n\n // Check if the current tech is defined before continuing\n if (!tech) {\n log$1.error(`The \"${techName}\" tech is undefined. Skipped browser support check for that tech.`);\n continue;\n }\n\n // Check if the browser supports this technology\n if (tech.isSupported()) {\n can = tech.canPlayType(type);\n if (can) {\n return can;\n }\n }\n }\n return '';\n }\n\n /**\n * Select source based on tech-order or source-order\n * Uses source-order selection if `options.sourceOrder` is truthy. Otherwise,\n * defaults to tech-order selection\n *\n * @param {Array} sources\n * The sources for a media asset\n *\n * @return {Object|boolean}\n * Object of source and tech order or false\n */\n selectSource(sources) {\n // Get only the techs specified in `techOrder` that exist and are supported by the\n // current platform\n const techs = this.options_.techOrder.map(techName => {\n return [techName, Tech.getTech(techName)];\n }).filter(([techName, tech]) => {\n // Check if the current tech is defined before continuing\n if (tech) {\n // Check if the browser supports this technology\n return tech.isSupported();\n }\n log$1.error(`The \"${techName}\" tech is undefined. Skipped browser support check for that tech.`);\n return false;\n });\n\n // Iterate over each `innerArray` element once per `outerArray` element and execute\n // `tester` with both. If `tester` returns a non-falsy value, exit early and return\n // that value.\n const findFirstPassingTechSourcePair = function (outerArray, innerArray, tester) {\n let found;\n outerArray.some(outerChoice => {\n return innerArray.some(innerChoice => {\n found = tester(outerChoice, innerChoice);\n if (found) {\n return true;\n }\n });\n });\n return found;\n };\n let foundSourceAndTech;\n const flip = fn => (a, b) => fn(b, a);\n const finder = ([techName, tech], source) => {\n if (tech.canPlaySource(source, this.options_[techName.toLowerCase()])) {\n return {\n source,\n tech: techName\n };\n }\n };\n\n // Depending on the truthiness of `options.sourceOrder`, we swap the order of techs and sources\n // to select from them based on their priority.\n if (this.options_.sourceOrder) {\n // Source-first ordering\n foundSourceAndTech = findFirstPassingTechSourcePair(sources, techs, flip(finder));\n } else {\n // Tech-first ordering\n foundSourceAndTech = findFirstPassingTechSourcePair(techs, sources, finder);\n }\n return foundSourceAndTech || false;\n }\n\n /**\n * Executes source setting and getting logic\n *\n * @param {Tech~SourceObject|Tech~SourceObject[]|string} [source]\n * A SourceObject, an array of SourceObjects, or a string referencing\n * a URL to a media source. It is _highly recommended_ that an object\n * or array of objects is used here, so that source selection\n * algorithms can take the `type` into account.\n *\n * If not provided, this method acts as a getter.\n * @param {boolean} [isRetry]\n * Indicates whether this is being called internally as a result of a retry\n *\n * @return {string|undefined}\n * If the `source` argument is missing, returns the current source\n * URL. Otherwise, returns nothing/undefined.\n */\n handleSrc_(source, isRetry) {\n // getter usage\n if (typeof source === 'undefined') {\n return this.cache_.src || '';\n }\n\n // Reset retry behavior for new source\n if (this.resetRetryOnError_) {\n this.resetRetryOnError_();\n }\n\n // filter out invalid sources and turn our source into\n // an array of source objects\n const sources = filterSource(source);\n\n // if a source was passed in then it is invalid because\n // it was filtered to a zero length Array. So we have to\n // show an error\n if (!sources.length) {\n this.setTimeout(function () {\n this.error({\n code: 4,\n message: this.options_.notSupportedMessage\n });\n }, 0);\n return;\n }\n\n // initial sources\n this.changingSrc_ = true;\n\n // Only update the cached source list if we are not retrying a new source after error,\n // since in that case we want to include the failed source(s) in the cache\n if (!isRetry) {\n this.cache_.sources = sources;\n }\n this.updateSourceCaches_(sources[0]);\n\n // middlewareSource is the source after it has been changed by middleware\n setSource(this, sources[0], (middlewareSource, mws) => {\n this.middleware_ = mws;\n\n // since sourceSet is async we have to update the cache again after we select a source since\n // the source that is selected could be out of order from the cache update above this callback.\n if (!isRetry) {\n this.cache_.sources = sources;\n }\n this.updateSourceCaches_(middlewareSource);\n const err = this.src_(middlewareSource);\n if (err) {\n if (sources.length > 1) {\n return this.handleSrc_(sources.slice(1));\n }\n this.changingSrc_ = false;\n\n // We need to wrap this in a timeout to give folks a chance to add error event handlers\n this.setTimeout(function () {\n this.error({\n code: 4,\n message: this.options_.notSupportedMessage\n });\n }, 0);\n\n // we could not find an appropriate tech, but let's still notify the delegate that this is it\n // this needs a better comment about why this is needed\n this.triggerReady();\n return;\n }\n setTech(mws, this.tech_);\n });\n\n // Try another available source if this one fails before playback.\n if (sources.length > 1) {\n const retry = () => {\n // Remove the error modal\n this.error(null);\n this.handleSrc_(sources.slice(1), true);\n };\n const stopListeningForErrors = () => {\n this.off('error', retry);\n };\n this.one('error', retry);\n this.one('playing', stopListeningForErrors);\n this.resetRetryOnError_ = () => {\n this.off('error', retry);\n this.off('playing', stopListeningForErrors);\n };\n }\n }\n\n /**\n * Get or set the video source.\n *\n * @param {Tech~SourceObject|Tech~SourceObject[]|string} [source]\n * A SourceObject, an array of SourceObjects, or a string referencing\n * a URL to a media source. It is _highly recommended_ that an object\n * or array of objects is used here, so that source selection\n * algorithms can take the `type` into account.\n *\n * If not provided, this method acts as a getter.\n *\n * @return {string|undefined}\n * If the `source` argument is missing, returns the current source\n * URL. Otherwise, returns nothing/undefined.\n */\n src(source) {\n return this.handleSrc_(source, false);\n }\n\n /**\n * Set the source object on the tech, returns a boolean that indicates whether\n * there is a tech that can play the source or not\n *\n * @param {Tech~SourceObject} source\n * The source object to set on the Tech\n *\n * @return {boolean}\n * - True if there is no Tech to playback this source\n * - False otherwise\n *\n * @private\n */\n src_(source) {\n const sourceTech = this.selectSource([source]);\n if (!sourceTech) {\n return true;\n }\n if (!titleCaseEquals(sourceTech.tech, this.techName_)) {\n this.changingSrc_ = true;\n // load this technology with the chosen source\n this.loadTech_(sourceTech.tech, sourceTech.source);\n this.tech_.ready(() => {\n this.changingSrc_ = false;\n });\n return false;\n }\n\n // wait until the tech is ready to set the source\n // and set it synchronously if possible (#2326)\n this.ready(function () {\n // The setSource tech method was added with source handlers\n // so older techs won't support it\n // We need to check the direct prototype for the case where subclasses\n // of the tech do not support source handlers\n if (this.tech_.constructor.prototype.hasOwnProperty('setSource')) {\n this.techCall_('setSource', source);\n } else {\n this.techCall_('src', source.src);\n }\n this.changingSrc_ = false;\n }, true);\n return false;\n }\n\n /**\n * Begin loading the src data.\n */\n load() {\n // Workaround to use the load method with the VHS.\n // Does not cover the case when the load method is called directly from the mediaElement.\n if (this.tech_ && this.tech_.vhs) {\n this.src(this.currentSource());\n return;\n }\n this.techCall_('load');\n }\n\n /**\n * Reset the player. Loads the first tech in the techOrder,\n * removes all the text tracks in the existing `tech`,\n * and calls `reset` on the `tech`.\n */\n reset() {\n if (this.paused()) {\n this.doReset_();\n } else {\n const playPromise = this.play();\n silencePromise(playPromise.then(() => this.doReset_()));\n }\n }\n doReset_() {\n if (this.tech_) {\n this.tech_.clearTracks('text');\n }\n this.removeClass('vjs-playing');\n this.addClass('vjs-paused');\n this.resetCache_();\n this.poster('');\n this.loadTech_(this.options_.techOrder[0], null);\n this.techCall_('reset');\n this.resetControlBarUI_();\n this.error(null);\n if (this.titleBar) {\n this.titleBar.update({\n title: undefined,\n description: undefined\n });\n }\n if (isEvented(this)) {\n this.trigger('playerreset');\n }\n }\n\n /**\n * Reset Control Bar's UI by calling sub-methods that reset\n * all of Control Bar's components\n */\n resetControlBarUI_() {\n this.resetProgressBar_();\n this.resetPlaybackRate_();\n this.resetVolumeBar_();\n }\n\n /**\n * Reset tech's progress so progress bar is reset in the UI\n */\n resetProgressBar_() {\n this.currentTime(0);\n const {\n currentTimeDisplay,\n durationDisplay,\n progressControl,\n remainingTimeDisplay\n } = this.controlBar || {};\n const {\n seekBar\n } = progressControl || {};\n if (currentTimeDisplay) {\n currentTimeDisplay.updateContent();\n }\n if (durationDisplay) {\n durationDisplay.updateContent();\n }\n if (remainingTimeDisplay) {\n remainingTimeDisplay.updateContent();\n }\n if (seekBar) {\n seekBar.update();\n if (seekBar.loadProgressBar) {\n seekBar.loadProgressBar.update();\n }\n }\n }\n\n /**\n * Reset Playback ratio\n */\n resetPlaybackRate_() {\n this.playbackRate(this.defaultPlaybackRate());\n this.handleTechRateChange_();\n }\n\n /**\n * Reset Volume bar\n */\n resetVolumeBar_() {\n this.volume(1.0);\n this.trigger('volumechange');\n }\n\n /**\n * Returns all of the current source objects.\n *\n * @return {Tech~SourceObject[]}\n * The current source objects\n */\n currentSources() {\n const source = this.currentSource();\n const sources = [];\n\n // assume `{}` or `{ src }`\n if (Object.keys(source).length !== 0) {\n sources.push(source);\n }\n return this.cache_.sources || sources;\n }\n\n /**\n * Returns the current source object.\n *\n * @return {Tech~SourceObject}\n * The current source object\n */\n currentSource() {\n return this.cache_.source || {};\n }\n\n /**\n * Returns the fully qualified URL of the current source value e.g. http://mysite.com/video.mp4\n * Can be used in conjunction with `currentType` to assist in rebuilding the current source object.\n *\n * @return {string}\n * The current source\n */\n currentSrc() {\n return this.currentSource() && this.currentSource().src || '';\n }\n\n /**\n * Get the current source type e.g. video/mp4\n * This can allow you rebuild the current source object so that you could load the same\n * source and tech later\n *\n * @return {string}\n * The source MIME type\n */\n currentType() {\n return this.currentSource() && this.currentSource().type || '';\n }\n\n /**\n * Get or set the preload attribute\n *\n * @param {'none'|'auto'|'metadata'} [value]\n * Preload mode to pass to tech\n *\n * @return {string|undefined}\n * - The preload attribute value when getting\n * - Nothing when setting\n */\n preload(value) {\n if (value !== undefined) {\n this.techCall_('setPreload', value);\n this.options_.preload = value;\n return;\n }\n return this.techGet_('preload');\n }\n\n /**\n * Get or set the autoplay option. When this is a boolean it will\n * modify the attribute on the tech. When this is a string the attribute on\n * the tech will be removed and `Player` will handle autoplay on loadstarts.\n *\n * @param {boolean|'play'|'muted'|'any'} [value]\n * - true: autoplay using the browser behavior\n * - false: do not autoplay\n * - 'play': call play() on every loadstart\n * - 'muted': call muted() then play() on every loadstart\n * - 'any': call play() on every loadstart. if that fails call muted() then play().\n * - *: values other than those listed here will be set `autoplay` to true\n *\n * @return {boolean|string|undefined}\n * - The current value of autoplay when getting\n * - Nothing when setting\n */\n autoplay(value) {\n // getter usage\n if (value === undefined) {\n return this.options_.autoplay || false;\n }\n let techAutoplay;\n\n // if the value is a valid string set it to that, or normalize `true` to 'play', if need be\n if (typeof value === 'string' && /(any|play|muted)/.test(value) || value === true && this.options_.normalizeAutoplay) {\n this.options_.autoplay = value;\n this.manualAutoplay_(typeof value === 'string' ? value : 'play');\n techAutoplay = false;\n\n // any falsy value sets autoplay to false in the browser,\n // lets do the same\n } else if (!value) {\n this.options_.autoplay = false;\n\n // any other value (ie truthy) sets autoplay to true\n } else {\n this.options_.autoplay = true;\n }\n techAutoplay = typeof techAutoplay === 'undefined' ? this.options_.autoplay : techAutoplay;\n\n // if we don't have a tech then we do not queue up\n // a setAutoplay call on tech ready. We do this because the\n // autoplay option will be passed in the constructor and we\n // do not need to set it twice\n if (this.tech_) {\n this.techCall_('setAutoplay', techAutoplay);\n }\n }\n\n /**\n * Set or unset the playsinline attribute.\n * Playsinline tells the browser that non-fullscreen playback is preferred.\n *\n * @param {boolean} [value]\n * - true means that we should try to play inline by default\n * - false means that we should use the browser's default playback mode,\n * which in most cases is inline. iOS Safari is a notable exception\n * and plays fullscreen by default.\n *\n * @return {string|undefined}\n * - the current value of playsinline\n * - Nothing when setting\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline}\n */\n playsinline(value) {\n if (value !== undefined) {\n this.techCall_('setPlaysinline', value);\n this.options_.playsinline = value;\n }\n return this.techGet_('playsinline');\n }\n\n /**\n * Get or set the loop attribute on the video element.\n *\n * @param {boolean} [value]\n * - true means that we should loop the video\n * - false means that we should not loop the video\n *\n * @return {boolean|undefined}\n * - The current value of loop when getting\n * - Nothing when setting\n */\n loop(value) {\n if (value !== undefined) {\n this.techCall_('setLoop', value);\n this.options_.loop = value;\n return;\n }\n return this.techGet_('loop');\n }\n\n /**\n * Get or set the poster image source url\n *\n * @fires Player#posterchange\n *\n * @param {string} [src]\n * Poster image source URL\n *\n * @return {string|undefined}\n * - The current value of poster when getting\n * - Nothing when setting\n */\n poster(src) {\n if (src === undefined) {\n return this.poster_;\n }\n\n // The correct way to remove a poster is to set as an empty string\n // other falsey values will throw errors\n if (!src) {\n src = '';\n }\n if (src === this.poster_) {\n return;\n }\n\n // update the internal poster variable\n this.poster_ = src;\n\n // update the tech's poster\n this.techCall_('setPoster', src);\n this.isPosterFromTech_ = false;\n\n // alert components that the poster has been set\n /**\n * This event fires when the poster image is changed on the player.\n *\n * @event Player#posterchange\n * @type {Event}\n */\n this.trigger('posterchange');\n }\n\n /**\n * Some techs (e.g. YouTube) can provide a poster source in an\n * asynchronous way. We want the poster component to use this\n * poster source so that it covers up the tech's controls.\n * (YouTube's play button). However we only want to use this\n * source if the player user hasn't set a poster through\n * the normal APIs.\n *\n * @fires Player#posterchange\n * @listens Tech#posterchange\n * @private\n */\n handleTechPosterChange_() {\n if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) {\n const newPoster = this.tech_.poster() || '';\n if (newPoster !== this.poster_) {\n this.poster_ = newPoster;\n this.isPosterFromTech_ = true;\n\n // Let components know the poster has changed\n this.trigger('posterchange');\n }\n }\n }\n\n /**\n * Get or set whether or not the controls are showing.\n *\n * @fires Player#controlsenabled\n *\n * @param {boolean} [bool]\n * - true to turn controls on\n * - false to turn controls off\n *\n * @return {boolean|undefined}\n * - The current value of controls when getting\n * - Nothing when setting\n */\n controls(bool) {\n if (bool === undefined) {\n return !!this.controls_;\n }\n bool = !!bool;\n\n // Don't trigger a change event unless it actually changed\n if (this.controls_ === bool) {\n return;\n }\n this.controls_ = bool;\n if (this.usingNativeControls()) {\n this.techCall_('setControls', bool);\n }\n if (this.controls_) {\n this.removeClass('vjs-controls-disabled');\n this.addClass('vjs-controls-enabled');\n /**\n * @event Player#controlsenabled\n * @type {Event}\n */\n this.trigger('controlsenabled');\n if (!this.usingNativeControls()) {\n this.addTechControlsListeners_();\n }\n } else {\n this.removeClass('vjs-controls-enabled');\n this.addClass('vjs-controls-disabled');\n /**\n * @event Player#controlsdisabled\n * @type {Event}\n */\n this.trigger('controlsdisabled');\n if (!this.usingNativeControls()) {\n this.removeTechControlsListeners_();\n }\n }\n }\n\n /**\n * Toggle native controls on/off. Native controls are the controls built into\n * devices (e.g. default iPhone controls) or other techs\n * (e.g. Vimeo Controls)\n * **This should only be set by the current tech, because only the tech knows\n * if it can support native controls**\n *\n * @fires Player#usingnativecontrols\n * @fires Player#usingcustomcontrols\n *\n * @param {boolean} [bool]\n * - true to turn native controls on\n * - false to turn native controls off\n *\n * @return {boolean|undefined}\n * - The current value of native controls when getting\n * - Nothing when setting\n */\n usingNativeControls(bool) {\n if (bool === undefined) {\n return !!this.usingNativeControls_;\n }\n bool = !!bool;\n\n // Don't trigger a change event unless it actually changed\n if (this.usingNativeControls_ === bool) {\n return;\n }\n this.usingNativeControls_ = bool;\n if (this.usingNativeControls_) {\n this.addClass('vjs-using-native-controls');\n\n /**\n * player is using the native device controls\n *\n * @event Player#usingnativecontrols\n * @type {Event}\n */\n this.trigger('usingnativecontrols');\n } else {\n this.removeClass('vjs-using-native-controls');\n\n /**\n * player is using the custom HTML controls\n *\n * @event Player#usingcustomcontrols\n * @type {Event}\n */\n this.trigger('usingcustomcontrols');\n }\n }\n\n /**\n * Set or get the current MediaError\n *\n * @fires Player#error\n *\n * @param {MediaError|string|number} [err]\n * A MediaError or a string/number to be turned\n * into a MediaError\n *\n * @return {MediaError|null|undefined}\n * - The current MediaError when getting (or null)\n * - Nothing when setting\n */\n error(err) {\n if (err === undefined) {\n return this.error_ || null;\n }\n\n // allow hooks to modify error object\n hooks('beforeerror').forEach(hookFunction => {\n const newErr = hookFunction(this, err);\n if (!(isObject(newErr) && !Array.isArray(newErr) || typeof newErr === 'string' || typeof newErr === 'number' || newErr === null)) {\n this.log.error('please return a value that MediaError expects in beforeerror hooks');\n return;\n }\n err = newErr;\n });\n\n // Suppress the first error message for no compatible source until\n // user interaction\n if (this.options_.suppressNotSupportedError && err && err.code === 4) {\n const triggerSuppressedError = function () {\n this.error(err);\n };\n this.options_.suppressNotSupportedError = false;\n this.any(['click', 'touchstart'], triggerSuppressedError);\n this.one('loadstart', function () {\n this.off(['click', 'touchstart'], triggerSuppressedError);\n });\n return;\n }\n\n // restoring to default\n if (err === null) {\n this.error_ = null;\n this.removeClass('vjs-error');\n if (this.errorDisplay) {\n this.errorDisplay.close();\n }\n return;\n }\n this.error_ = new MediaError(err);\n\n // add the vjs-error classname to the player\n this.addClass('vjs-error');\n\n // log the name of the error type and any message\n // IE11 logs \"[object object]\" and required you to expand message to see error object\n log$1.error(`(CODE:${this.error_.code} ${MediaError.errorTypes[this.error_.code]})`, this.error_.message, this.error_);\n\n /**\n * @event Player#error\n * @type {Event}\n */\n this.trigger('error');\n\n // notify hooks of the per player error\n hooks('error').forEach(hookFunction => hookFunction(this, this.error_));\n return;\n }\n\n /**\n * Report user activity\n *\n * @param {Object} event\n * Event object\n */\n reportUserActivity(event) {\n this.userActivity_ = true;\n }\n\n /**\n * Get/set if user is active\n *\n * @fires Player#useractive\n * @fires Player#userinactive\n *\n * @param {boolean} [bool]\n * - true if the user is active\n * - false if the user is inactive\n *\n * @return {boolean|undefined}\n * - The current value of userActive when getting\n * - Nothing when setting\n */\n userActive(bool) {\n if (bool === undefined) {\n return this.userActive_;\n }\n bool = !!bool;\n if (bool === this.userActive_) {\n return;\n }\n this.userActive_ = bool;\n if (this.userActive_) {\n this.userActivity_ = true;\n this.removeClass('vjs-user-inactive');\n this.addClass('vjs-user-active');\n /**\n * @event Player#useractive\n * @type {Event}\n */\n this.trigger('useractive');\n return;\n }\n\n // Chrome/Safari/IE have bugs where when you change the cursor it can\n // trigger a mousemove event. This causes an issue when you're hiding\n // the cursor when the user is inactive, and a mousemove signals user\n // activity. Making it impossible to go into inactive mode. Specifically\n // this happens in fullscreen when we really need to hide the cursor.\n //\n // When this gets resolved in ALL browsers it can be removed\n // https://code.google.com/p/chromium/issues/detail?id=103041\n if (this.tech_) {\n this.tech_.one('mousemove', function (e) {\n e.stopPropagation();\n e.preventDefault();\n });\n }\n this.userActivity_ = false;\n this.removeClass('vjs-user-active');\n this.addClass('vjs-user-inactive');\n /**\n * @event Player#userinactive\n * @type {Event}\n */\n this.trigger('userinactive');\n }\n\n /**\n * Listen for user activity based on timeout value\n *\n * @private\n */\n listenForUserActivity_() {\n let mouseInProgress;\n let lastMoveX;\n let lastMoveY;\n const handleActivity = bind_(this, this.reportUserActivity);\n const handleMouseMove = function (e) {\n // #1068 - Prevent mousemove spamming\n // Chrome Bug: https://code.google.com/p/chromium/issues/detail?id=366970\n if (e.screenX !== lastMoveX || e.screenY !== lastMoveY) {\n lastMoveX = e.screenX;\n lastMoveY = e.screenY;\n handleActivity();\n }\n };\n const handleMouseDown = function () {\n handleActivity();\n // For as long as the they are touching the device or have their mouse down,\n // we consider them active even if they're not moving their finger or mouse.\n // So we want to continue to update that they are active\n this.clearInterval(mouseInProgress);\n // Setting userActivity=true now and setting the interval to the same time\n // as the activityCheck interval (250) should ensure we never miss the\n // next activityCheck\n mouseInProgress = this.setInterval(handleActivity, 250);\n };\n const handleMouseUpAndMouseLeave = function (event) {\n handleActivity();\n // Stop the interval that maintains activity if the mouse/touch is down\n this.clearInterval(mouseInProgress);\n };\n\n // Any mouse movement will be considered user activity\n this.on('mousedown', handleMouseDown);\n this.on('mousemove', handleMouseMove);\n this.on('mouseup', handleMouseUpAndMouseLeave);\n this.on('mouseleave', handleMouseUpAndMouseLeave);\n const controlBar = this.getChild('controlBar');\n\n // Fixes bug on Android & iOS where when tapping progressBar (when control bar is displayed)\n // controlBar would no longer be hidden by default timeout.\n if (controlBar && !IS_IOS && !IS_ANDROID) {\n controlBar.on('mouseenter', function (event) {\n if (this.player().options_.inactivityTimeout !== 0) {\n this.player().cache_.inactivityTimeout = this.player().options_.inactivityTimeout;\n }\n this.player().options_.inactivityTimeout = 0;\n });\n controlBar.on('mouseleave', function (event) {\n this.player().options_.inactivityTimeout = this.player().cache_.inactivityTimeout;\n });\n }\n\n // Listen for keyboard navigation\n // Shouldn't need to use inProgress interval because of key repeat\n this.on('keydown', handleActivity);\n this.on('keyup', handleActivity);\n\n // Run an interval every 250 milliseconds instead of stuffing everything into\n // the mousemove/touchmove function itself, to prevent performance degradation.\n // `this.reportUserActivity` simply sets this.userActivity_ to true, which\n // then gets picked up by this loop\n // http://ejohn.org/blog/learning-from-twitter/\n let inactivityTimeout;\n\n /** @this Player */\n const activityCheck = function () {\n // Check to see if mouse/touch activity has happened\n if (!this.userActivity_) {\n return;\n }\n\n // Reset the activity tracker\n this.userActivity_ = false;\n\n // If the user state was inactive, set the state to active\n this.userActive(true);\n\n // Clear any existing inactivity timeout to start the timer over\n this.clearTimeout(inactivityTimeout);\n const timeout = this.options_.inactivityTimeout;\n if (timeout <= 0) {\n return;\n }\n\n // In <timeout> milliseconds, if no more activity has occurred the\n // user will be considered inactive\n inactivityTimeout = this.setTimeout(function () {\n // Protect against the case where the inactivityTimeout can trigger just\n // before the next user activity is picked up by the activity check loop\n // causing a flicker\n if (!this.userActivity_) {\n this.userActive(false);\n }\n }, timeout);\n };\n this.setInterval(activityCheck, 250);\n }\n\n /**\n * Gets or sets the current playback rate. A playback rate of\n * 1.0 represents normal speed and 0.5 would indicate half-speed\n * playback, for instance.\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-playbackrate\n *\n * @param {number} [rate]\n * New playback rate to set.\n *\n * @return {number|undefined}\n * - The current playback rate when getting or 1.0\n * - Nothing when setting\n */\n playbackRate(rate) {\n if (rate !== undefined) {\n // NOTE: this.cache_.lastPlaybackRate is set from the tech handler\n // that is registered above\n this.techCall_('setPlaybackRate', rate);\n return;\n }\n if (this.tech_ && this.tech_.featuresPlaybackRate) {\n return this.cache_.lastPlaybackRate || this.techGet_('playbackRate');\n }\n return 1.0;\n }\n\n /**\n * Gets or sets the current default playback rate. A default playback rate of\n * 1.0 represents normal speed and 0.5 would indicate half-speed playback, for instance.\n * defaultPlaybackRate will only represent what the initial playbackRate of a video was, not\n * not the current playbackRate.\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-defaultplaybackrate\n *\n * @param {number} [rate]\n * New default playback rate to set.\n *\n * @return {number|undefined}\n * - The default playback rate when getting or 1.0\n * - Nothing when setting\n */\n defaultPlaybackRate(rate) {\n if (rate !== undefined) {\n return this.techCall_('setDefaultPlaybackRate', rate);\n }\n if (this.tech_ && this.tech_.featuresPlaybackRate) {\n return this.techGet_('defaultPlaybackRate');\n }\n return 1.0;\n }\n\n /**\n * Gets or sets the audio flag\n *\n * @param {boolean} [bool]\n * - true signals that this is an audio player\n * - false signals that this is not an audio player\n *\n * @return {boolean|undefined}\n * - The current value of isAudio when getting\n * - Nothing when setting\n */\n isAudio(bool) {\n if (bool !== undefined) {\n this.isAudio_ = !!bool;\n return;\n }\n return !!this.isAudio_;\n }\n enableAudioOnlyUI_() {\n // Update styling immediately to show the control bar so we can get its height\n this.addClass('vjs-audio-only-mode');\n const playerChildren = this.children();\n const controlBar = this.getChild('ControlBar');\n const controlBarHeight = controlBar && controlBar.currentHeight();\n\n // Hide all player components except the control bar. Control bar components\n // needed only for video are hidden with CSS\n playerChildren.forEach(child => {\n if (child === controlBar) {\n return;\n }\n if (child.el_ && !child.hasClass('vjs-hidden')) {\n child.hide();\n this.audioOnlyCache_.hiddenChildren.push(child);\n }\n });\n this.audioOnlyCache_.playerHeight = this.currentHeight();\n\n // Set the player height the same as the control bar\n this.height(controlBarHeight);\n this.trigger('audioonlymodechange');\n }\n disableAudioOnlyUI_() {\n this.removeClass('vjs-audio-only-mode');\n\n // Show player components that were previously hidden\n this.audioOnlyCache_.hiddenChildren.forEach(child => child.show());\n\n // Reset player height\n this.height(this.audioOnlyCache_.playerHeight);\n this.trigger('audioonlymodechange');\n }\n\n /**\n * Get the current audioOnlyMode state or set audioOnlyMode to true or false.\n *\n * Setting this to `true` will hide all player components except the control bar,\n * as well as control bar components needed only for video.\n *\n * @param {boolean} [value]\n * The value to set audioOnlyMode to.\n *\n * @return {Promise|boolean}\n * A Promise is returned when setting the state, and a boolean when getting\n * the present state\n */\n audioOnlyMode(value) {\n if (typeof value !== 'boolean' || value === this.audioOnlyMode_) {\n return this.audioOnlyMode_;\n }\n this.audioOnlyMode_ = value;\n\n // Enable Audio Only Mode\n if (value) {\n const exitPromises = [];\n\n // Fullscreen and PiP are not supported in audioOnlyMode, so exit if we need to.\n if (this.isInPictureInPicture()) {\n exitPromises.push(this.exitPictureInPicture());\n }\n if (this.isFullscreen()) {\n exitPromises.push(this.exitFullscreen());\n }\n if (this.audioPosterMode()) {\n exitPromises.push(this.audioPosterMode(false));\n }\n return Promise.all(exitPromises).then(() => this.enableAudioOnlyUI_());\n }\n\n // Disable Audio Only Mode\n return Promise.resolve().then(() => this.disableAudioOnlyUI_());\n }\n enablePosterModeUI_() {\n // Hide the video element and show the poster image to enable posterModeUI\n const tech = this.tech_ && this.tech_;\n tech.hide();\n this.addClass('vjs-audio-poster-mode');\n this.trigger('audiopostermodechange');\n }\n disablePosterModeUI_() {\n // Show the video element and hide the poster image to disable posterModeUI\n const tech = this.tech_ && this.tech_;\n tech.show();\n this.removeClass('vjs-audio-poster-mode');\n this.trigger('audiopostermodechange');\n }\n\n /**\n * Get the current audioPosterMode state or set audioPosterMode to true or false\n *\n * @param {boolean} [value]\n * The value to set audioPosterMode to.\n *\n * @return {Promise|boolean}\n * A Promise is returned when setting the state, and a boolean when getting\n * the present state\n */\n audioPosterMode(value) {\n if (typeof value !== 'boolean' || value === this.audioPosterMode_) {\n return this.audioPosterMode_;\n }\n this.audioPosterMode_ = value;\n if (value) {\n if (this.audioOnlyMode()) {\n const audioOnlyModePromise = this.audioOnlyMode(false);\n return audioOnlyModePromise.then(() => {\n // enable audio poster mode after audio only mode is disabled\n this.enablePosterModeUI_();\n });\n }\n return Promise.resolve().then(() => {\n // enable audio poster mode\n this.enablePosterModeUI_();\n });\n }\n return Promise.resolve().then(() => {\n // disable audio poster mode\n this.disablePosterModeUI_();\n });\n }\n\n /**\n * A helper method for adding a {@link TextTrack} to our\n * {@link TextTrackList}.\n *\n * In addition to the W3C settings we allow adding additional info through options.\n *\n * @see http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-addtexttrack\n *\n * @param {string} [kind]\n * the kind of TextTrack you are adding\n *\n * @param {string} [label]\n * the label to give the TextTrack label\n *\n * @param {string} [language]\n * the language to set on the TextTrack\n *\n * @return {TextTrack|undefined}\n * the TextTrack that was added or undefined\n * if there is no tech\n */\n addTextTrack(kind, label, language) {\n if (this.tech_) {\n return this.tech_.addTextTrack(kind, label, language);\n }\n }\n\n /**\n * Create a remote {@link TextTrack} and an {@link HTMLTrackElement}.\n *\n * @param {Object} options\n * Options to pass to {@link HTMLTrackElement} during creation. See\n * {@link HTMLTrackElement} for object properties that you should use.\n *\n * @param {boolean} [manualCleanup=false] if set to true, the TextTrack will not be removed\n * from the TextTrackList and HtmlTrackElementList\n * after a source change\n *\n * @return { import('./tracks/html-track-element').default }\n * the HTMLTrackElement that was created and added\n * to the HtmlTrackElementList and the remote\n * TextTrackList\n *\n */\n addRemoteTextTrack(options, manualCleanup) {\n if (this.tech_) {\n return this.tech_.addRemoteTextTrack(options, manualCleanup);\n }\n }\n\n /**\n * Remove a remote {@link TextTrack} from the respective\n * {@link TextTrackList} and {@link HtmlTrackElementList}.\n *\n * @param {Object} track\n * Remote {@link TextTrack} to remove\n *\n * @return {undefined}\n * does not return anything\n */\n removeRemoteTextTrack(obj = {}) {\n let {\n track\n } = obj;\n if (!track) {\n track = obj;\n }\n\n // destructure the input into an object with a track argument, defaulting to arguments[0]\n // default the whole argument to an empty object if nothing was passed in\n\n if (this.tech_) {\n return this.tech_.removeRemoteTextTrack(track);\n }\n }\n\n /**\n * Gets available media playback quality metrics as specified by the W3C's Media\n * Playback Quality API.\n *\n * @see [Spec]{@link https://wicg.github.io/media-playback-quality}\n *\n * @return {Object|undefined}\n * An object with supported media playback quality metrics or undefined if there\n * is no tech or the tech does not support it.\n */\n getVideoPlaybackQuality() {\n return this.techGet_('getVideoPlaybackQuality');\n }\n\n /**\n * Get video width\n *\n * @return {number}\n * current video width\n */\n videoWidth() {\n return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0;\n }\n\n /**\n * Get video height\n *\n * @return {number}\n * current video height\n */\n videoHeight() {\n return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0;\n }\n\n /**\n * Set or get the player's language code.\n *\n * Changing the language will trigger\n * [languagechange]{@link Player#event:languagechange}\n * which Components can use to update control text.\n * ClickableComponent will update its control text by default on\n * [languagechange]{@link Player#event:languagechange}.\n *\n * @fires Player#languagechange\n *\n * @param {string} [code]\n * the language code to set the player to\n *\n * @return {string|undefined}\n * - The current language code when getting\n * - Nothing when setting\n */\n language(code) {\n if (code === undefined) {\n return this.language_;\n }\n if (this.language_ !== String(code).toLowerCase()) {\n this.language_ = String(code).toLowerCase();\n\n // during first init, it's possible some things won't be evented\n if (isEvented(this)) {\n /**\n * fires when the player language change\n *\n * @event Player#languagechange\n * @type {Event}\n */\n this.trigger('languagechange');\n }\n }\n }\n\n /**\n * Get the player's language dictionary\n * Merge every time, because a newly added plugin might call videojs.addLanguage() at any time\n * Languages specified directly in the player options have precedence\n *\n * @return {Array}\n * An array of of supported languages\n */\n languages() {\n return merge$1(Player.prototype.options_.languages, this.languages_);\n }\n\n /**\n * returns a JavaScript object representing the current track\n * information. **DOES not return it as JSON**\n *\n * @return {Object}\n * Object representing the current of track info\n */\n toJSON() {\n const options = merge$1(this.options_);\n const tracks = options.tracks;\n options.tracks = [];\n for (let i = 0; i < tracks.length; i++) {\n let track = tracks[i];\n\n // deep merge tracks and null out player so no circular references\n track = merge$1(track);\n track.player = undefined;\n options.tracks[i] = track;\n }\n return options;\n }\n\n /**\n * Creates a simple modal dialog (an instance of the {@link ModalDialog}\n * component) that immediately overlays the player with arbitrary\n * content and removes itself when closed.\n *\n * @param {string|Function|Element|Array|null} content\n * Same as {@link ModalDialog#content}'s param of the same name.\n * The most straight-forward usage is to provide a string or DOM\n * element.\n *\n * @param {Object} [options]\n * Extra options which will be passed on to the {@link ModalDialog}.\n *\n * @return {ModalDialog}\n * the {@link ModalDialog} that was created\n */\n createModal(content, options) {\n options = options || {};\n options.content = content || '';\n const modal = new ModalDialog(this, options);\n this.addChild(modal);\n modal.on('dispose', () => {\n this.removeChild(modal);\n });\n modal.open();\n return modal;\n }\n\n /**\n * Change breakpoint classes when the player resizes.\n *\n * @private\n */\n updateCurrentBreakpoint_() {\n if (!this.responsive()) {\n return;\n }\n const currentBreakpoint = this.currentBreakpoint();\n const currentWidth = this.currentWidth();\n for (let i = 0; i < BREAKPOINT_ORDER.length; i++) {\n const candidateBreakpoint = BREAKPOINT_ORDER[i];\n const maxWidth = this.breakpoints_[candidateBreakpoint];\n if (currentWidth <= maxWidth) {\n // The current breakpoint did not change, nothing to do.\n if (currentBreakpoint === candidateBreakpoint) {\n return;\n }\n\n // Only remove a class if there is a current breakpoint.\n if (currentBreakpoint) {\n this.removeClass(BREAKPOINT_CLASSES[currentBreakpoint]);\n }\n this.addClass(BREAKPOINT_CLASSES[candidateBreakpoint]);\n this.breakpoint_ = candidateBreakpoint;\n break;\n }\n }\n }\n\n /**\n * Removes the current breakpoint.\n *\n * @private\n */\n removeCurrentBreakpoint_() {\n const className = this.currentBreakpointClass();\n this.breakpoint_ = '';\n if (className) {\n this.removeClass(className);\n }\n }\n\n /**\n * Get or set breakpoints on the player.\n *\n * Calling this method with an object or `true` will remove any previous\n * custom breakpoints and start from the defaults again.\n *\n * @param {Object|boolean} [breakpoints]\n * If an object is given, it can be used to provide custom\n * breakpoints. If `true` is given, will set default breakpoints.\n * If this argument is not given, will simply return the current\n * breakpoints.\n *\n * @param {number} [breakpoints.tiny]\n * The maximum width for the \"vjs-layout-tiny\" class.\n *\n * @param {number} [breakpoints.xsmall]\n * The maximum width for the \"vjs-layout-x-small\" class.\n *\n * @param {number} [breakpoints.small]\n * The maximum width for the \"vjs-layout-small\" class.\n *\n * @param {number} [breakpoints.medium]\n * The maximum width for the \"vjs-layout-medium\" class.\n *\n * @param {number} [breakpoints.large]\n * The maximum width for the \"vjs-layout-large\" class.\n *\n * @param {number} [breakpoints.xlarge]\n * The maximum width for the \"vjs-layout-x-large\" class.\n *\n * @param {number} [breakpoints.huge]\n * The maximum width for the \"vjs-layout-huge\" class.\n *\n * @return {Object}\n * An object mapping breakpoint names to maximum width values.\n */\n breakpoints(breakpoints) {\n // Used as a getter.\n if (breakpoints === undefined) {\n return Object.assign(this.breakpoints_);\n }\n this.breakpoint_ = '';\n this.breakpoints_ = Object.assign({}, DEFAULT_BREAKPOINTS, breakpoints);\n\n // When breakpoint definitions change, we need to update the currently\n // selected breakpoint.\n this.updateCurrentBreakpoint_();\n\n // Clone the breakpoints before returning.\n return Object.assign(this.breakpoints_);\n }\n\n /**\n * Get or set a flag indicating whether or not this player should adjust\n * its UI based on its dimensions.\n *\n * @param {boolean} [value]\n * Should be `true` if the player should adjust its UI based on its\n * dimensions; otherwise, should be `false`.\n *\n * @return {boolean|undefined}\n * Will be `true` if this player should adjust its UI based on its\n * dimensions; otherwise, will be `false`.\n * Nothing if setting\n */\n responsive(value) {\n // Used as a getter.\n if (value === undefined) {\n return this.responsive_;\n }\n value = Boolean(value);\n const current = this.responsive_;\n\n // Nothing changed.\n if (value === current) {\n return;\n }\n\n // The value actually changed, set it.\n this.responsive_ = value;\n\n // Start listening for breakpoints and set the initial breakpoint if the\n // player is now responsive.\n if (value) {\n this.on('playerresize', this.boundUpdateCurrentBreakpoint_);\n this.updateCurrentBreakpoint_();\n\n // Stop listening for breakpoints if the player is no longer responsive.\n } else {\n this.off('playerresize', this.boundUpdateCurrentBreakpoint_);\n this.removeCurrentBreakpoint_();\n }\n return value;\n }\n\n /**\n * Get current breakpoint name, if any.\n *\n * @return {string}\n * If there is currently a breakpoint set, returns a the key from the\n * breakpoints object matching it. Otherwise, returns an empty string.\n */\n currentBreakpoint() {\n return this.breakpoint_;\n }\n\n /**\n * Get the current breakpoint class name.\n *\n * @return {string}\n * The matching class name (e.g. `\"vjs-layout-tiny\"` or\n * `\"vjs-layout-large\"`) for the current breakpoint. Empty string if\n * there is no current breakpoint.\n */\n currentBreakpointClass() {\n return BREAKPOINT_CLASSES[this.breakpoint_] || '';\n }\n\n /**\n * An object that describes a single piece of media.\n *\n * Properties that are not part of this type description will be retained; so,\n * this can be viewed as a generic metadata storage mechanism as well.\n *\n * @see {@link https://wicg.github.io/mediasession/#the-mediametadata-interface}\n * @typedef {Object} Player~MediaObject\n *\n * @property {string} [album]\n * Unused, except if this object is passed to the `MediaSession`\n * API.\n *\n * @property {string} [artist]\n * Unused, except if this object is passed to the `MediaSession`\n * API.\n *\n * @property {Object[]} [artwork]\n * Unused, except if this object is passed to the `MediaSession`\n * API. If not specified, will be populated via the `poster`, if\n * available.\n *\n * @property {string} [poster]\n * URL to an image that will display before playback.\n *\n * @property {Tech~SourceObject|Tech~SourceObject[]|string} [src]\n * A single source object, an array of source objects, or a string\n * referencing a URL to a media source. It is _highly recommended_\n * that an object or array of objects is used here, so that source\n * selection algorithms can take the `type` into account.\n *\n * @property {string} [title]\n * Unused, except if this object is passed to the `MediaSession`\n * API.\n *\n * @property {Object[]} [textTracks]\n * An array of objects to be used to create text tracks, following\n * the {@link https://www.w3.org/TR/html50/embedded-content-0.html#the-track-element|native track element format}.\n * For ease of removal, these will be created as \"remote\" text\n * tracks and set to automatically clean up on source changes.\n *\n * These objects may have properties like `src`, `kind`, `label`,\n * and `language`, see {@link Tech#createRemoteTextTrack}.\n */\n\n /**\n * Populate the player using a {@link Player~MediaObject|MediaObject}.\n *\n * @param {Player~MediaObject} media\n * A media object.\n *\n * @param {Function} ready\n * A callback to be called when the player is ready.\n */\n loadMedia(media, ready) {\n if (!media || typeof media !== 'object') {\n return;\n }\n const crossOrigin = this.crossOrigin();\n this.reset();\n\n // Clone the media object so it cannot be mutated from outside.\n this.cache_.media = merge$1(media);\n const {\n artist,\n artwork,\n description,\n poster,\n src,\n textTracks,\n title\n } = this.cache_.media;\n\n // If `artwork` is not given, create it using `poster`.\n if (!artwork && poster) {\n this.cache_.media.artwork = [{\n src: poster,\n type: getMimetype(poster)\n }];\n }\n if (crossOrigin) {\n this.crossOrigin(crossOrigin);\n }\n if (src) {\n this.src(src);\n }\n if (poster) {\n this.poster(poster);\n }\n if (Array.isArray(textTracks)) {\n textTracks.forEach(tt => this.addRemoteTextTrack(tt, false));\n }\n if (this.titleBar) {\n this.titleBar.update({\n title,\n description: description || artist || ''\n });\n }\n this.ready(ready);\n }\n\n /**\n * Get a clone of the current {@link Player~MediaObject} for this player.\n *\n * If the `loadMedia` method has not been used, will attempt to return a\n * {@link Player~MediaObject} based on the current state of the player.\n *\n * @return {Player~MediaObject}\n */\n getMedia() {\n if (!this.cache_.media) {\n const poster = this.poster();\n const src = this.currentSources();\n const textTracks = Array.prototype.map.call(this.remoteTextTracks(), tt => ({\n kind: tt.kind,\n label: tt.label,\n language: tt.language,\n src: tt.src\n }));\n const media = {\n src,\n textTracks\n };\n if (poster) {\n media.poster = poster;\n media.artwork = [{\n src: media.poster,\n type: getMimetype(media.poster)\n }];\n }\n return media;\n }\n return merge$1(this.cache_.media);\n }\n\n /**\n * Gets tag settings\n *\n * @param {Element} tag\n * The player tag\n *\n * @return {Object}\n * An object containing all of the settings\n * for a player tag\n */\n static getTagSettings(tag) {\n const baseOptions = {\n sources: [],\n tracks: []\n };\n const tagOptions = getAttributes(tag);\n const dataSetup = tagOptions['data-setup'];\n if (hasClass(tag, 'vjs-fill')) {\n tagOptions.fill = true;\n }\n if (hasClass(tag, 'vjs-fluid')) {\n tagOptions.fluid = true;\n }\n\n // Check if data-setup attr exists.\n if (dataSetup !== null) {\n // Parse options JSON\n // If empty string, make it a parsable json object.\n const [err, data] = safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_3___default()(dataSetup || '{}');\n if (err) {\n log$1.error(err);\n }\n Object.assign(tagOptions, data);\n }\n Object.assign(baseOptions, tagOptions);\n\n // Get tag children settings\n if (tag.hasChildNodes()) {\n const children = tag.childNodes;\n for (let i = 0, j = children.length; i < j; i++) {\n const child = children[i];\n // Change case needed: http://ejohn.org/blog/nodename-case-sensitivity/\n const childName = child.nodeName.toLowerCase();\n if (childName === 'source') {\n baseOptions.sources.push(getAttributes(child));\n } else if (childName === 'track') {\n baseOptions.tracks.push(getAttributes(child));\n }\n }\n }\n return baseOptions;\n }\n\n /**\n * Set debug mode to enable/disable logs at info level.\n *\n * @param {boolean} enabled\n * @fires Player#debugon\n * @fires Player#debugoff\n * @return {boolean|undefined}\n */\n debug(enabled) {\n if (enabled === undefined) {\n return this.debugEnabled_;\n }\n if (enabled) {\n this.trigger('debugon');\n this.previousLogLevel_ = this.log.level;\n this.log.level('debug');\n this.debugEnabled_ = true;\n } else {\n this.trigger('debugoff');\n this.log.level(this.previousLogLevel_);\n this.previousLogLevel_ = undefined;\n this.debugEnabled_ = false;\n }\n }\n\n /**\n * Set or get current playback rates.\n * Takes an array and updates the playback rates menu with the new items.\n * Pass in an empty array to hide the menu.\n * Values other than arrays are ignored.\n *\n * @fires Player#playbackrateschange\n * @param {number[]} newRates\n * The new rates that the playback rates menu should update to.\n * An empty array will hide the menu\n * @return {number[]} When used as a getter will return the current playback rates\n */\n playbackRates(newRates) {\n if (newRates === undefined) {\n return this.cache_.playbackRates;\n }\n\n // ignore any value that isn't an array\n if (!Array.isArray(newRates)) {\n return;\n }\n\n // ignore any arrays that don't only contain numbers\n if (!newRates.every(rate => typeof rate === 'number')) {\n return;\n }\n this.cache_.playbackRates = newRates;\n\n /**\n * fires when the playback rates in a player are changed\n *\n * @event Player#playbackrateschange\n * @type {Event}\n */\n this.trigger('playbackrateschange');\n }\n}\n\n/**\n * Get the {@link VideoTrackList}\n *\n * @link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist\n *\n * @return {VideoTrackList}\n * the current video track list\n *\n * @method Player.prototype.videoTracks\n */\n\n/**\n * Get the {@link AudioTrackList}\n *\n * @link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist\n *\n * @return {AudioTrackList}\n * the current audio track list\n *\n * @method Player.prototype.audioTracks\n */\n\n/**\n * Get the {@link TextTrackList}\n *\n * @link http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-texttracks\n *\n * @return {TextTrackList}\n * the current text track list\n *\n * @method Player.prototype.textTracks\n */\n\n/**\n * Get the remote {@link TextTrackList}\n *\n * @return {TextTrackList}\n * The current remote text track list\n *\n * @method Player.prototype.remoteTextTracks\n */\n\n/**\n * Get the remote {@link HtmlTrackElementList} tracks.\n *\n * @return {HtmlTrackElementList}\n * The current remote text track element list\n *\n * @method Player.prototype.remoteTextTrackEls\n */\n\nALL.names.forEach(function (name) {\n const props = ALL[name];\n Player.prototype[props.getterName] = function () {\n if (this.tech_) {\n return this.tech_[props.getterName]();\n }\n\n // if we have not yet loadTech_, we create {video,audio,text}Tracks_\n // these will be passed to the tech during loading\n this[props.privateName] = this[props.privateName] || new props.ListClass();\n return this[props.privateName];\n };\n});\n\n/**\n * Get or set the `Player`'s crossorigin option. For the HTML5 player, this\n * sets the `crossOrigin` property on the `<video>` tag to control the CORS\n * behavior.\n *\n * @see [Video Element Attributes]{@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-crossorigin}\n *\n * @param {string} [value]\n * The value to set the `Player`'s crossorigin to. If an argument is\n * given, must be one of `anonymous` or `use-credentials`.\n *\n * @return {string|undefined}\n * - The current crossorigin value of the `Player` when getting.\n * - undefined when setting\n */\nPlayer.prototype.crossorigin = Player.prototype.crossOrigin;\n\n/**\n * Global enumeration of players.\n *\n * The keys are the player IDs and the values are either the {@link Player}\n * instance or `null` for disposed players.\n *\n * @type {Object}\n */\nPlayer.players = {};\nconst navigator = (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator);\n\n/*\n * Player instance options, surfaced using options\n * options = Player.prototype.options_\n * Make changes in options, not here.\n *\n * @type {Object}\n * @private\n */\nPlayer.prototype.options_ = {\n // Default order of fallback technology\n techOrder: Tech.defaultTechOrder_,\n html5: {},\n // enable sourceset by default\n enableSourceset: true,\n // default inactivity timeout\n inactivityTimeout: 2000,\n // default playback rates\n playbackRates: [],\n // Add playback rate selection by adding rates\n // 'playbackRates': [0.5, 1, 1.5, 2],\n liveui: false,\n // Included control sets\n children: ['mediaLoader', 'posterImage', 'titleBar', 'textTrackDisplay', 'loadingSpinner', 'bigPlayButton', 'liveTracker', 'controlBar', 'errorDisplay', 'textTrackSettings', 'resizeManager'],\n language: navigator && (navigator.languages && navigator.languages[0] || navigator.userLanguage || navigator.language) || 'en',\n // locales and their language translations\n languages: {},\n // Default message to show when a video cannot be played.\n notSupportedMessage: 'No compatible source was found for this media.',\n normalizeAutoplay: false,\n fullscreen: {\n options: {\n navigationUI: 'hide'\n }\n },\n breakpoints: {},\n responsive: false,\n audioOnlyMode: false,\n audioPosterMode: false,\n // Default smooth seeking to false\n enableSmoothSeeking: false\n};\nTECH_EVENTS_RETRIGGER.forEach(function (event) {\n Player.prototype[`handleTech${toTitleCase$1(event)}_`] = function () {\n return this.trigger(event);\n };\n});\n\n/**\n * Fired when the player has initial duration and dimension information\n *\n * @event Player#loadedmetadata\n * @type {Event}\n */\n\n/**\n * Fired when the player has downloaded data at the current playback position\n *\n * @event Player#loadeddata\n * @type {Event}\n */\n\n/**\n * Fired when the current playback position has changed *\n * During playback this is fired every 15-250 milliseconds, depending on the\n * playback technology in use.\n *\n * @event Player#timeupdate\n * @type {Event}\n */\n\n/**\n * Fired when the volume changes\n *\n * @event Player#volumechange\n * @type {Event}\n */\n\n/**\n * Reports whether or not a player has a plugin available.\n *\n * This does not report whether or not the plugin has ever been initialized\n * on this player. For that, [usingPlugin]{@link Player#usingPlugin}.\n *\n * @method Player#hasPlugin\n * @param {string} name\n * The name of a plugin.\n *\n * @return {boolean}\n * Whether or not this player has the requested plugin available.\n */\n\n/**\n * Reports whether or not a player is using a plugin by name.\n *\n * For basic plugins, this only reports whether the plugin has _ever_ been\n * initialized on this player.\n *\n * @method Player#usingPlugin\n * @param {string} name\n * The name of a plugin.\n *\n * @return {boolean}\n * Whether or not this player is using the requested plugin.\n */\n\nComponent$1.registerComponent('Player', Player);\n\n/**\n * @file plugin.js\n */\n\n/**\n * The base plugin name.\n *\n * @private\n * @constant\n * @type {string}\n */\nconst BASE_PLUGIN_NAME = 'plugin';\n\n/**\n * The key on which a player's active plugins cache is stored.\n *\n * @private\n * @constant\n * @type {string}\n */\nconst PLUGIN_CACHE_KEY = 'activePlugins_';\n\n/**\n * Stores registered plugins in a private space.\n *\n * @private\n * @type {Object}\n */\nconst pluginStorage = {};\n\n/**\n * Reports whether or not a plugin has been registered.\n *\n * @private\n * @param {string} name\n * The name of a plugin.\n *\n * @return {boolean}\n * Whether or not the plugin has been registered.\n */\nconst pluginExists = name => pluginStorage.hasOwnProperty(name);\n\n/**\n * Get a single registered plugin by name.\n *\n * @private\n * @param {string} name\n * The name of a plugin.\n *\n * @return {typeof Plugin|Function|undefined}\n * The plugin (or undefined).\n */\nconst getPlugin = name => pluginExists(name) ? pluginStorage[name] : undefined;\n\n/**\n * Marks a plugin as \"active\" on a player.\n *\n * Also, ensures that the player has an object for tracking active plugins.\n *\n * @private\n * @param {Player} player\n * A Video.js player instance.\n *\n * @param {string} name\n * The name of a plugin.\n */\nconst markPluginAsActive = (player, name) => {\n player[PLUGIN_CACHE_KEY] = player[PLUGIN_CACHE_KEY] || {};\n player[PLUGIN_CACHE_KEY][name] = true;\n};\n\n/**\n * Triggers a pair of plugin setup events.\n *\n * @private\n * @param {Player} player\n * A Video.js player instance.\n *\n * @param {PluginEventHash} hash\n * A plugin event hash.\n *\n * @param {boolean} [before]\n * If true, prefixes the event name with \"before\". In other words,\n * use this to trigger \"beforepluginsetup\" instead of \"pluginsetup\".\n */\nconst triggerSetupEvent = (player, hash, before) => {\n const eventName = (before ? 'before' : '') + 'pluginsetup';\n player.trigger(eventName, hash);\n player.trigger(eventName + ':' + hash.name, hash);\n};\n\n/**\n * Takes a basic plugin function and returns a wrapper function which marks\n * on the player that the plugin has been activated.\n *\n * @private\n * @param {string} name\n * The name of the plugin.\n *\n * @param {Function} plugin\n * The basic plugin.\n *\n * @return {Function}\n * A wrapper function for the given plugin.\n */\nconst createBasicPlugin = function (name, plugin) {\n const basicPluginWrapper = function () {\n // We trigger the \"beforepluginsetup\" and \"pluginsetup\" events on the player\n // regardless, but we want the hash to be consistent with the hash provided\n // for advanced plugins.\n //\n // The only potentially counter-intuitive thing here is the `instance` in\n // the \"pluginsetup\" event is the value returned by the `plugin` function.\n triggerSetupEvent(this, {\n name,\n plugin,\n instance: null\n }, true);\n const instance = plugin.apply(this, arguments);\n markPluginAsActive(this, name);\n triggerSetupEvent(this, {\n name,\n plugin,\n instance\n });\n return instance;\n };\n Object.keys(plugin).forEach(function (prop) {\n basicPluginWrapper[prop] = plugin[prop];\n });\n return basicPluginWrapper;\n};\n\n/**\n * Takes a plugin sub-class and returns a factory function for generating\n * instances of it.\n *\n * This factory function will replace itself with an instance of the requested\n * sub-class of Plugin.\n *\n * @private\n * @param {string} name\n * The name of the plugin.\n *\n * @param {Plugin} PluginSubClass\n * The advanced plugin.\n *\n * @return {Function}\n */\nconst createPluginFactory = (name, PluginSubClass) => {\n // Add a `name` property to the plugin prototype so that each plugin can\n // refer to itself by name.\n PluginSubClass.prototype.name = name;\n return function (...args) {\n triggerSetupEvent(this, {\n name,\n plugin: PluginSubClass,\n instance: null\n }, true);\n const instance = new PluginSubClass(...[this, ...args]);\n\n // The plugin is replaced by a function that returns the current instance.\n this[name] = () => instance;\n triggerSetupEvent(this, instance.getEventHash());\n return instance;\n };\n};\n\n/**\n * Parent class for all advanced plugins.\n *\n * @mixes module:evented~EventedMixin\n * @mixes module:stateful~StatefulMixin\n * @fires Player#beforepluginsetup\n * @fires Player#beforepluginsetup:$name\n * @fires Player#pluginsetup\n * @fires Player#pluginsetup:$name\n * @listens Player#dispose\n * @throws {Error}\n * If attempting to instantiate the base {@link Plugin} class\n * directly instead of via a sub-class.\n */\nclass Plugin {\n /**\n * Creates an instance of this class.\n *\n * Sub-classes should call `super` to ensure plugins are properly initialized.\n *\n * @param {Player} player\n * A Video.js player instance.\n */\n constructor(player) {\n if (this.constructor === Plugin) {\n throw new Error('Plugin must be sub-classed; not directly instantiated.');\n }\n this.player = player;\n if (!this.log) {\n this.log = this.player.log.createLogger(this.name);\n }\n\n // Make this object evented, but remove the added `trigger` method so we\n // use the prototype version instead.\n evented(this);\n delete this.trigger;\n stateful(this, this.constructor.defaultState);\n markPluginAsActive(player, this.name);\n\n // Auto-bind the dispose method so we can use it as a listener and unbind\n // it later easily.\n this.dispose = this.dispose.bind(this);\n\n // If the player is disposed, dispose the plugin.\n player.on('dispose', this.dispose);\n }\n\n /**\n * Get the version of the plugin that was set on <pluginName>.VERSION\n */\n version() {\n return this.constructor.VERSION;\n }\n\n /**\n * Each event triggered by plugins includes a hash of additional data with\n * conventional properties.\n *\n * This returns that object or mutates an existing hash.\n *\n * @param {Object} [hash={}]\n * An object to be used as event an event hash.\n *\n * @return {PluginEventHash}\n * An event hash object with provided properties mixed-in.\n */\n getEventHash(hash = {}) {\n hash.name = this.name;\n hash.plugin = this.constructor;\n hash.instance = this;\n return hash;\n }\n\n /**\n * Triggers an event on the plugin object and overrides\n * {@link module:evented~EventedMixin.trigger|EventedMixin.trigger}.\n *\n * @param {string|Object} event\n * An event type or an object with a type property.\n *\n * @param {Object} [hash={}]\n * Additional data hash to merge with a\n * {@link PluginEventHash|PluginEventHash}.\n *\n * @return {boolean}\n * Whether or not default was prevented.\n */\n trigger(event, hash = {}) {\n return trigger(this.eventBusEl_, event, this.getEventHash(hash));\n }\n\n /**\n * Handles \"statechanged\" events on the plugin. No-op by default, override by\n * subclassing.\n *\n * @abstract\n * @param {Event} e\n * An event object provided by a \"statechanged\" event.\n *\n * @param {Object} e.changes\n * An object describing changes that occurred with the \"statechanged\"\n * event.\n */\n handleStateChanged(e) {}\n\n /**\n * Disposes a plugin.\n *\n * Subclasses can override this if they want, but for the sake of safety,\n * it's probably best to subscribe the \"dispose\" event.\n *\n * @fires Plugin#dispose\n */\n dispose() {\n const {\n name,\n player\n } = this;\n\n /**\n * Signals that a advanced plugin is about to be disposed.\n *\n * @event Plugin#dispose\n * @type {Event}\n */\n this.trigger('dispose');\n this.off();\n player.off('dispose', this.dispose);\n\n // Eliminate any possible sources of leaking memory by clearing up\n // references between the player and the plugin instance and nulling out\n // the plugin's state and replacing methods with a function that throws.\n player[PLUGIN_CACHE_KEY][name] = false;\n this.player = this.state = null;\n\n // Finally, replace the plugin name on the player with a new factory\n // function, so that the plugin is ready to be set up again.\n player[name] = createPluginFactory(name, pluginStorage[name]);\n }\n\n /**\n * Determines if a plugin is a basic plugin (i.e. not a sub-class of `Plugin`).\n *\n * @param {string|Function} plugin\n * If a string, matches the name of a plugin. If a function, will be\n * tested directly.\n *\n * @return {boolean}\n * Whether or not a plugin is a basic plugin.\n */\n static isBasic(plugin) {\n const p = typeof plugin === 'string' ? getPlugin(plugin) : plugin;\n return typeof p === 'function' && !Plugin.prototype.isPrototypeOf(p.prototype);\n }\n\n /**\n * Register a Video.js plugin.\n *\n * @param {string} name\n * The name of the plugin to be registered. Must be a string and\n * must not match an existing plugin or a method on the `Player`\n * prototype.\n *\n * @param {typeof Plugin|Function} plugin\n * A sub-class of `Plugin` or a function for basic plugins.\n *\n * @return {typeof Plugin|Function}\n * For advanced plugins, a factory function for that plugin. For\n * basic plugins, a wrapper function that initializes the plugin.\n */\n static registerPlugin(name, plugin) {\n if (typeof name !== 'string') {\n throw new Error(`Illegal plugin name, \"${name}\", must be a string, was ${typeof name}.`);\n }\n if (pluginExists(name)) {\n log$1.warn(`A plugin named \"${name}\" already exists. You may want to avoid re-registering plugins!`);\n } else if (Player.prototype.hasOwnProperty(name)) {\n throw new Error(`Illegal plugin name, \"${name}\", cannot share a name with an existing player method!`);\n }\n if (typeof plugin !== 'function') {\n throw new Error(`Illegal plugin for \"${name}\", must be a function, was ${typeof plugin}.`);\n }\n pluginStorage[name] = plugin;\n\n // Add a player prototype method for all sub-classed plugins (but not for\n // the base Plugin class).\n if (name !== BASE_PLUGIN_NAME) {\n if (Plugin.isBasic(plugin)) {\n Player.prototype[name] = createBasicPlugin(name, plugin);\n } else {\n Player.prototype[name] = createPluginFactory(name, plugin);\n }\n }\n return plugin;\n }\n\n /**\n * De-register a Video.js plugin.\n *\n * @param {string} name\n * The name of the plugin to be de-registered. Must be a string that\n * matches an existing plugin.\n *\n * @throws {Error}\n * If an attempt is made to de-register the base plugin.\n */\n static deregisterPlugin(name) {\n if (name === BASE_PLUGIN_NAME) {\n throw new Error('Cannot de-register base plugin.');\n }\n if (pluginExists(name)) {\n delete pluginStorage[name];\n delete Player.prototype[name];\n }\n }\n\n /**\n * Gets an object containing multiple Video.js plugins.\n *\n * @param {Array} [names]\n * If provided, should be an array of plugin names. Defaults to _all_\n * plugin names.\n *\n * @return {Object|undefined}\n * An object containing plugin(s) associated with their name(s) or\n * `undefined` if no matching plugins exist).\n */\n static getPlugins(names = Object.keys(pluginStorage)) {\n let result;\n names.forEach(name => {\n const plugin = getPlugin(name);\n if (plugin) {\n result = result || {};\n result[name] = plugin;\n }\n });\n return result;\n }\n\n /**\n * Gets a plugin's version, if available\n *\n * @param {string} name\n * The name of a plugin.\n *\n * @return {string}\n * The plugin's version or an empty string.\n */\n static getPluginVersion(name) {\n const plugin = getPlugin(name);\n return plugin && plugin.VERSION || '';\n }\n}\n\n/**\n * Gets a plugin by name if it exists.\n *\n * @static\n * @method getPlugin\n * @memberOf Plugin\n * @param {string} name\n * The name of a plugin.\n *\n * @returns {typeof Plugin|Function|undefined}\n * The plugin (or `undefined`).\n */\nPlugin.getPlugin = getPlugin;\n\n/**\n * The name of the base plugin class as it is registered.\n *\n * @type {string}\n */\nPlugin.BASE_PLUGIN_NAME = BASE_PLUGIN_NAME;\nPlugin.registerPlugin(BASE_PLUGIN_NAME, Plugin);\n\n/**\n * Documented in player.js\n *\n * @ignore\n */\nPlayer.prototype.usingPlugin = function (name) {\n return !!this[PLUGIN_CACHE_KEY] && this[PLUGIN_CACHE_KEY][name] === true;\n};\n\n/**\n * Documented in player.js\n *\n * @ignore\n */\nPlayer.prototype.hasPlugin = function (name) {\n return !!pluginExists(name);\n};\n\n/**\n * Signals that a plugin is about to be set up on a player.\n *\n * @event Player#beforepluginsetup\n * @type {PluginEventHash}\n */\n\n/**\n * Signals that a plugin is about to be set up on a player - by name. The name\n * is the name of the plugin.\n *\n * @event Player#beforepluginsetup:$name\n * @type {PluginEventHash}\n */\n\n/**\n * Signals that a plugin has just been set up on a player.\n *\n * @event Player#pluginsetup\n * @type {PluginEventHash}\n */\n\n/**\n * Signals that a plugin has just been set up on a player - by name. The name\n * is the name of the plugin.\n *\n * @event Player#pluginsetup:$name\n * @type {PluginEventHash}\n */\n\n/**\n * @typedef {Object} PluginEventHash\n *\n * @property {string} instance\n * For basic plugins, the return value of the plugin function. For\n * advanced plugins, the plugin instance on which the event is fired.\n *\n * @property {string} name\n * The name of the plugin.\n *\n * @property {string} plugin\n * For basic plugins, the plugin function. For advanced plugins, the\n * plugin class/constructor.\n */\n\n/**\n * @file deprecate.js\n * @module deprecate\n */\n\n/**\n * Decorate a function with a deprecation message the first time it is called.\n *\n * @param {string} message\n * A deprecation message to log the first time the returned function\n * is called.\n *\n * @param {Function} fn\n * The function to be deprecated.\n *\n * @return {Function}\n * A wrapper function that will log a deprecation warning the first\n * time it is called. The return value will be the return value of\n * the wrapped function.\n */\nfunction deprecate(message, fn) {\n let warned = false;\n return function (...args) {\n if (!warned) {\n log$1.warn(message);\n }\n warned = true;\n return fn.apply(this, args);\n };\n}\n\n/**\n * Internal function used to mark a function as deprecated in the next major\n * version with consistent messaging.\n *\n * @param {number} major The major version where it will be removed\n * @param {string} oldName The old function name\n * @param {string} newName The new function name\n * @param {Function} fn The function to deprecate\n * @return {Function} The decorated function\n */\nfunction deprecateForMajor(major, oldName, newName, fn) {\n return deprecate(`${oldName} is deprecated and will be removed in ${major}.0; please use ${newName} instead.`, fn);\n}\n\n/**\n * @file video.js\n * @module videojs\n */\n\n/**\n * Normalize an `id` value by trimming off a leading `#`\n *\n * @private\n * @param {string} id\n * A string, maybe with a leading `#`.\n *\n * @return {string}\n * The string, without any leading `#`.\n */\nconst normalizeId = id => id.indexOf('#') === 0 ? id.slice(1) : id;\n\n/**\n * A callback that is called when a component is ready. Does not have any\n * parameters and any callback value will be ignored. See: {@link Component~ReadyCallback}\n *\n * @callback ReadyCallback\n */\n\n/**\n * The `videojs()` function doubles as the main function for users to create a\n * {@link Player} instance as well as the main library namespace.\n *\n * It can also be used as a getter for a pre-existing {@link Player} instance.\n * However, we _strongly_ recommend using `videojs.getPlayer()` for this\n * purpose because it avoids any potential for unintended initialization.\n *\n * Due to [limitations](https://github.com/jsdoc3/jsdoc/issues/955#issuecomment-313829149)\n * of our JSDoc template, we cannot properly document this as both a function\n * and a namespace, so its function signature is documented here.\n *\n * #### Arguments\n * ##### id\n * string|Element, **required**\n *\n * Video element or video element ID.\n *\n * ##### options\n * Object, optional\n *\n * Options object for providing settings.\n * See: [Options Guide](https://docs.videojs.com/tutorial-options.html).\n *\n * ##### ready\n * {@link Component~ReadyCallback}, optional\n *\n * A function to be called when the {@link Player} and {@link Tech} are ready.\n *\n * #### Return Value\n *\n * The `videojs()` function returns a {@link Player} instance.\n *\n * @namespace\n *\n * @borrows AudioTrack as AudioTrack\n * @borrows Component.getComponent as getComponent\n * @borrows module:events.on as on\n * @borrows module:events.one as one\n * @borrows module:events.off as off\n * @borrows module:events.trigger as trigger\n * @borrows EventTarget as EventTarget\n * @borrows module:middleware.use as use\n * @borrows Player.players as players\n * @borrows Plugin.registerPlugin as registerPlugin\n * @borrows Plugin.deregisterPlugin as deregisterPlugin\n * @borrows Plugin.getPlugins as getPlugins\n * @borrows Plugin.getPlugin as getPlugin\n * @borrows Plugin.getPluginVersion as getPluginVersion\n * @borrows Tech.getTech as getTech\n * @borrows Tech.registerTech as registerTech\n * @borrows TextTrack as TextTrack\n * @borrows VideoTrack as VideoTrack\n *\n * @param {string|Element} id\n * Video element or video element ID.\n *\n * @param {Object} [options]\n * Options object for providing settings.\n * See: [Options Guide](https://docs.videojs.com/tutorial-options.html).\n *\n * @param {ReadyCallback} [ready]\n * A function to be called when the {@link Player} and {@link Tech} are\n * ready.\n *\n * @return {Player}\n * The `videojs()` function returns a {@link Player|Player} instance.\n */\nfunction videojs(id, options, ready) {\n let player = videojs.getPlayer(id);\n if (player) {\n if (options) {\n log$1.warn(`Player \"${id}\" is already initialised. Options will not be applied.`);\n }\n if (ready) {\n player.ready(ready);\n }\n return player;\n }\n const el = typeof id === 'string' ? $('#' + normalizeId(id)) : id;\n if (!isEl(el)) {\n throw new TypeError('The element or ID supplied is not valid. (videojs)');\n }\n\n // document.body.contains(el) will only check if el is contained within that one document.\n // This causes problems for elements in iframes.\n // Instead, use the element's ownerDocument instead of the global document.\n // This will make sure that the element is indeed in the dom of that document.\n // Additionally, check that the document in question has a default view.\n // If the document is no longer attached to the dom, the defaultView of the document will be null.\n // If element is inside Shadow DOM (e.g. is part of a Custom element), ownerDocument.body\n // always returns false. Instead, use the Shadow DOM root.\n const inShadowDom = 'getRootNode' in el ? el.getRootNode() instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().ShadowRoot) : false;\n const rootNode = inShadowDom ? el.getRootNode() : el.ownerDocument.body;\n if (!el.ownerDocument.defaultView || !rootNode.contains(el)) {\n log$1.warn('The element supplied is not included in the DOM');\n }\n options = options || {};\n\n // Store a copy of the el before modification, if it is to be restored in destroy()\n // If div ingest, store the parent div\n if (options.restoreEl === true) {\n options.restoreEl = (el.parentNode && el.parentNode.hasAttribute('data-vjs-player') ? el.parentNode : el).cloneNode(true);\n }\n hooks('beforesetup').forEach(hookFunction => {\n const opts = hookFunction(el, merge$1(options));\n if (!isObject(opts) || Array.isArray(opts)) {\n log$1.error('please return an object in beforesetup hooks');\n return;\n }\n options = merge$1(options, opts);\n });\n\n // We get the current \"Player\" component here in case an integration has\n // replaced it with a custom player.\n const PlayerComponent = Component$1.getComponent('Player');\n player = new PlayerComponent(el, options, ready);\n hooks('setup').forEach(hookFunction => hookFunction(player));\n return player;\n}\nvideojs.hooks_ = hooks_;\nvideojs.hooks = hooks;\nvideojs.hook = hook;\nvideojs.hookOnce = hookOnce;\nvideojs.removeHook = removeHook;\n\n// Add default styles\nif ((global_window__WEBPACK_IMPORTED_MODULE_0___default().VIDEOJS_NO_DYNAMIC_STYLE) !== true && isReal()) {\n let style = $('.vjs-styles-defaults');\n if (!style) {\n style = createStyleElement('vjs-styles-defaults');\n const head = $('head');\n if (head) {\n head.insertBefore(style, head.firstChild);\n }\n setTextContent(style, `\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 `);\n }\n}\n\n// Run Auto-load players\n// You have to wait at least once in case this script is loaded after your\n// video in the DOM (weird behavior only with minified version)\nautoSetupTimeout(1, videojs);\n\n/**\n * Current Video.js version. Follows [semantic versioning](https://semver.org/).\n *\n * @type {string}\n */\nvideojs.VERSION = version$6;\n\n/**\n * The global options object. These are the settings that take effect\n * if no overrides are specified when the player is created.\n *\n * @type {Object}\n */\nvideojs.options = Player.prototype.options_;\n\n/**\n * Get an object with the currently created players, keyed by player ID\n *\n * @return {Object}\n * The created players\n */\nvideojs.getPlayers = () => Player.players;\n\n/**\n * Get a single player based on an ID or DOM element.\n *\n * This is useful if you want to check if an element or ID has an associated\n * Video.js player, but not create one if it doesn't.\n *\n * @param {string|Element} id\n * An HTML element - `<video>`, `<audio>`, or `<video-js>` -\n * or a string matching the `id` of such an element.\n *\n * @return {Player|undefined}\n * A player instance or `undefined` if there is no player instance\n * matching the argument.\n */\nvideojs.getPlayer = id => {\n const players = Player.players;\n let tag;\n if (typeof id === 'string') {\n const nId = normalizeId(id);\n const player = players[nId];\n if (player) {\n return player;\n }\n tag = $('#' + nId);\n } else {\n tag = id;\n }\n if (isEl(tag)) {\n const {\n player,\n playerId\n } = tag;\n\n // Element may have a `player` property referring to an already created\n // player instance. If so, return that.\n if (player || players[playerId]) {\n return player || players[playerId];\n }\n }\n};\n\n/**\n * Returns an array of all current players.\n *\n * @return {Array}\n * An array of all players. The array will be in the order that\n * `Object.keys` provides, which could potentially vary between\n * JavaScript engines.\n *\n */\nvideojs.getAllPlayers = () =>\n// Disposed players leave a key with a `null` value, so we need to make sure\n// we filter those out.\nObject.keys(Player.players).map(k => Player.players[k]).filter(Boolean);\nvideojs.players = Player.players;\nvideojs.getComponent = Component$1.getComponent;\n\n/**\n * Register a component so it can referred to by name. Used when adding to other\n * components, either through addChild `component.addChild('myComponent')` or through\n * default children options `{ children: ['myComponent'] }`.\n *\n * > NOTE: You could also just initialize the component before adding.\n * `component.addChild(new MyComponent());`\n *\n * @param {string} name\n * The class name of the component\n *\n * @param {typeof Component} comp\n * The component class\n *\n * @return {typeof Component}\n * The newly registered component\n */\nvideojs.registerComponent = (name, comp) => {\n if (Tech.isTech(comp)) {\n log$1.warn(`The ${name} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`);\n }\n return Component$1.registerComponent.call(Component$1, name, comp);\n};\nvideojs.getTech = Tech.getTech;\nvideojs.registerTech = Tech.registerTech;\nvideojs.use = use;\n\n/**\n * An object that can be returned by a middleware to signify\n * that the middleware is being terminated.\n *\n * @type {object}\n * @property {object} middleware.TERMINATOR\n */\nObject.defineProperty(videojs, 'middleware', {\n value: {},\n writeable: false,\n enumerable: true\n});\nObject.defineProperty(videojs.middleware, 'TERMINATOR', {\n value: TERMINATOR,\n writeable: false,\n enumerable: true\n});\n\n/**\n * A reference to the {@link module:browser|browser utility module} as an object.\n *\n * @type {Object}\n * @see {@link module:browser|browser}\n */\nvideojs.browser = browser;\n\n/**\n * A reference to the {@link module:obj|obj utility module} as an object.\n *\n * @type {Object}\n * @see {@link module:obj|obj}\n */\nvideojs.obj = Obj;\n\n/**\n * Deprecated reference to the {@link module:obj.merge|merge function}\n *\n * @type {Function}\n * @see {@link module:obj.merge|merge}\n * @deprecated Deprecated and will be removed in 9.0. Please use videojs.obj.merge instead.\n */\nvideojs.mergeOptions = deprecateForMajor(9, 'videojs.mergeOptions', 'videojs.obj.merge', merge$1);\n\n/**\n * Deprecated reference to the {@link module:obj.defineLazyProperty|defineLazyProperty function}\n *\n * @type {Function}\n * @see {@link module:obj.defineLazyProperty|defineLazyProperty}\n * @deprecated Deprecated and will be removed in 9.0. Please use videojs.obj.defineLazyProperty instead.\n */\nvideojs.defineLazyProperty = deprecateForMajor(9, 'videojs.defineLazyProperty', 'videojs.obj.defineLazyProperty', defineLazyProperty);\n\n/**\n * Deprecated reference to the {@link module:fn.bind_|fn.bind_ function}\n *\n * @type {Function}\n * @see {@link module:fn.bind_|fn.bind_}\n * @deprecated Deprecated and will be removed in 9.0. Please use native Function.prototype.bind instead.\n */\nvideojs.bind = deprecateForMajor(9, 'videojs.bind', 'native Function.prototype.bind', bind_);\nvideojs.registerPlugin = Plugin.registerPlugin;\nvideojs.deregisterPlugin = Plugin.deregisterPlugin;\n\n/**\n * Deprecated method to register a plugin with Video.js\n *\n * @deprecated Deprecated and will be removed in 9.0. Use videojs.registerPlugin() instead.\n *\n * @param {string} name\n * The plugin name\n*\n * @param {typeof Plugin|Function} plugin\n * The plugin sub-class or function\n *\n * @return {typeof Plugin|Function}\n */\nvideojs.plugin = (name, plugin) => {\n log$1.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead');\n return Plugin.registerPlugin(name, plugin);\n};\nvideojs.getPlugins = Plugin.getPlugins;\nvideojs.getPlugin = Plugin.getPlugin;\nvideojs.getPluginVersion = Plugin.getPluginVersion;\n\n/**\n * Adding languages so that they're available to all players.\n * Example: `videojs.addLanguage('es', { 'Hello': 'Hola' });`\n *\n * @param {string} code\n * The language code or dictionary property\n *\n * @param {Object} data\n * The data values to be translated\n *\n * @return {Object}\n * The resulting language dictionary object\n */\nvideojs.addLanguage = function (code, data) {\n code = ('' + code).toLowerCase();\n videojs.options.languages = merge$1(videojs.options.languages, {\n [code]: data\n });\n return videojs.options.languages[code];\n};\n\n/**\n * A reference to the {@link module:log|log utility module} as an object.\n *\n * @type {Function}\n * @see {@link module:log|log}\n */\nvideojs.log = log$1;\nvideojs.createLogger = createLogger;\n\n/**\n * A reference to the {@link module:time|time utility module} as an object.\n *\n * @type {Object}\n * @see {@link module:time|time}\n */\nvideojs.time = Time;\n\n/**\n * Deprecated reference to the {@link module:time.createTimeRanges|createTimeRanges function}\n *\n * @type {Function}\n * @see {@link module:time.createTimeRanges|createTimeRanges}\n * @deprecated Deprecated and will be removed in 9.0. Please use videojs.time.createTimeRanges instead.\n */\nvideojs.createTimeRange = deprecateForMajor(9, 'videojs.createTimeRange', 'videojs.time.createTimeRanges', createTimeRanges$1);\n\n/**\n * Deprecated reference to the {@link module:time.createTimeRanges|createTimeRanges function}\n *\n * @type {Function}\n * @see {@link module:time.createTimeRanges|createTimeRanges}\n * @deprecated Deprecated and will be removed in 9.0. Please use videojs.time.createTimeRanges instead.\n */\nvideojs.createTimeRanges = deprecateForMajor(9, 'videojs.createTimeRanges', 'videojs.time.createTimeRanges', createTimeRanges$1);\n\n/**\n * Deprecated reference to the {@link module:time.formatTime|formatTime function}\n *\n * @type {Function}\n * @see {@link module:time.formatTime|formatTime}\n * @deprecated Deprecated and will be removed in 9.0. Please use videojs.time.format instead.\n */\nvideojs.formatTime = deprecateForMajor(9, 'videojs.formatTime', 'videojs.time.formatTime', formatTime);\n\n/**\n * Deprecated reference to the {@link module:time.setFormatTime|setFormatTime function}\n *\n * @type {Function}\n * @see {@link module:time.setFormatTime|setFormatTime}\n * @deprecated Deprecated and will be removed in 9.0. Please use videojs.time.setFormat instead.\n */\nvideojs.setFormatTime = deprecateForMajor(9, 'videojs.setFormatTime', 'videojs.time.setFormatTime', setFormatTime);\n\n/**\n * Deprecated reference to the {@link module:time.resetFormatTime|resetFormatTime function}\n *\n * @type {Function}\n * @see {@link module:time.resetFormatTime|resetFormatTime}\n * @deprecated Deprecated and will be removed in 9.0. Please use videojs.time.resetFormat instead.\n */\nvideojs.resetFormatTime = deprecateForMajor(9, 'videojs.resetFormatTime', 'videojs.time.resetFormatTime', resetFormatTime);\n\n/**\n * Deprecated reference to the {@link module:url.parseUrl|Url.parseUrl function}\n *\n * @type {Function}\n * @see {@link module:url.parseUrl|parseUrl}\n * @deprecated Deprecated and will be removed in 9.0. Please use videojs.url.parseUrl instead.\n */\nvideojs.parseUrl = deprecateForMajor(9, 'videojs.parseUrl', 'videojs.url.parseUrl', parseUrl);\n\n/**\n * Deprecated reference to the {@link module:url.isCrossOrigin|Url.isCrossOrigin function}\n *\n * @type {Function}\n * @see {@link module:url.isCrossOrigin|isCrossOrigin}\n * @deprecated Deprecated and will be removed in 9.0. Please use videojs.url.isCrossOrigin instead.\n */\nvideojs.isCrossOrigin = deprecateForMajor(9, 'videojs.isCrossOrigin', 'videojs.url.isCrossOrigin', isCrossOrigin);\nvideojs.EventTarget = EventTarget$2;\nvideojs.any = any;\nvideojs.on = on;\nvideojs.one = one;\nvideojs.off = off;\nvideojs.trigger = trigger;\n\n/**\n * A cross-browser XMLHttpRequest wrapper.\n *\n * @function\n * @param {Object} options\n * Settings for the request.\n *\n * @return {XMLHttpRequest|XDomainRequest}\n * The request object.\n *\n * @see https://github.com/Raynos/xhr\n */\nvideojs.xhr = (_videojs_xhr__WEBPACK_IMPORTED_MODULE_4___default());\nvideojs.TextTrack = TextTrack;\nvideojs.AudioTrack = AudioTrack;\nvideojs.VideoTrack = VideoTrack;\n['isEl', 'isTextNode', 'createEl', 'hasClass', 'addClass', 'removeClass', 'toggleClass', 'setAttributes', 'getAttributes', 'emptyEl', 'appendContent', 'insertContent'].forEach(k => {\n videojs[k] = function () {\n log$1.warn(`videojs.${k}() is deprecated; use videojs.dom.${k}() instead`);\n return Dom[k].apply(null, arguments);\n };\n});\nvideojs.computedStyle = deprecateForMajor(9, 'videojs.computedStyle', 'videojs.dom.computedStyle', computedStyle);\n\n/**\n * A reference to the {@link module:dom|DOM utility module} as an object.\n *\n * @type {Object}\n * @see {@link module:dom|dom}\n */\nvideojs.dom = Dom;\n\n/**\n * A reference to the {@link module:fn|fn utility module} as an object.\n *\n * @type {Object}\n * @see {@link module:fn|fn}\n */\nvideojs.fn = Fn;\n\n/**\n * A reference to the {@link module:num|num utility module} as an object.\n *\n * @type {Object}\n * @see {@link module:num|num}\n */\nvideojs.num = Num;\n\n/**\n * A reference to the {@link module:str|str utility module} as an object.\n *\n * @type {Object}\n * @see {@link module:str|str}\n */\nvideojs.str = Str;\n\n/**\n * A reference to the {@link module:url|URL utility module} as an object.\n *\n * @type {Object}\n * @see {@link module:url|url}\n */\nvideojs.url = Url;\n\n/*! @name videojs-contrib-quality-levels @version 4.0.0 @license Apache-2.0 */\n\n/**\n * A single QualityLevel.\n *\n * interface QualityLevel {\n * readonly attribute DOMString id;\n * attribute DOMString label;\n * readonly attribute long width;\n * readonly attribute long height;\n * readonly attribute long bitrate;\n * attribute boolean enabled;\n * };\n *\n * @class QualityLevel\n */\nclass QualityLevel {\n /**\n * Creates a QualityLevel\n *\n * @param {Representation|Object} representation The representation of the quality level\n * @param {string} representation.id Unique id of the QualityLevel\n * @param {number=} representation.width Resolution width of the QualityLevel\n * @param {number=} representation.height Resolution height of the QualityLevel\n * @param {number} representation.bandwidth Bitrate of the QualityLevel\n * @param {number=} representation.frameRate Frame-rate of the QualityLevel\n * @param {Function} representation.enabled Callback to enable/disable QualityLevel\n */\n constructor(representation) {\n let level = this; // eslint-disable-line\n\n level.id = representation.id;\n level.label = level.id;\n level.width = representation.width;\n level.height = representation.height;\n level.bitrate = representation.bandwidth;\n level.frameRate = representation.frameRate;\n level.enabled_ = representation.enabled;\n Object.defineProperty(level, 'enabled', {\n /**\n * Get whether the QualityLevel is enabled.\n *\n * @return {boolean} True if the QualityLevel is enabled.\n */\n get() {\n return level.enabled_();\n },\n /**\n * Enable or disable the QualityLevel.\n *\n * @param {boolean} enable true to enable QualityLevel, false to disable.\n */\n set(enable) {\n level.enabled_(enable);\n }\n });\n return level;\n }\n}\n\n/**\n * A list of QualityLevels.\n *\n * interface QualityLevelList : EventTarget {\n * getter QualityLevel (unsigned long index);\n * readonly attribute unsigned long length;\n * readonly attribute long selectedIndex;\n *\n * void addQualityLevel(QualityLevel qualityLevel)\n * void removeQualityLevel(QualityLevel remove)\n * QualityLevel? getQualityLevelById(DOMString id);\n *\n * attribute EventHandler onchange;\n * attribute EventHandler onaddqualitylevel;\n * attribute EventHandler onremovequalitylevel;\n * };\n *\n * @extends videojs.EventTarget\n * @class QualityLevelList\n */\n\nclass QualityLevelList extends videojs.EventTarget {\n /**\n * Creates a QualityLevelList.\n */\n constructor() {\n super();\n let list = this; // eslint-disable-line\n\n list.levels_ = [];\n list.selectedIndex_ = -1;\n /**\n * Get the index of the currently selected QualityLevel.\n *\n * @returns {number} The index of the selected QualityLevel. -1 if none selected.\n * @readonly\n */\n\n Object.defineProperty(list, 'selectedIndex', {\n get() {\n return list.selectedIndex_;\n }\n });\n /**\n * Get the length of the list of QualityLevels.\n *\n * @returns {number} The length of the list.\n * @readonly\n */\n\n Object.defineProperty(list, 'length', {\n get() {\n return list.levels_.length;\n }\n });\n list[Symbol.iterator] = () => list.levels_.values();\n return list;\n }\n /**\n * Adds a quality level to the list.\n *\n * @param {Representation|Object} representation The representation of the quality level\n * @param {string} representation.id Unique id of the QualityLevel\n * @param {number=} representation.width Resolution width of the QualityLevel\n * @param {number=} representation.height Resolution height of the QualityLevel\n * @param {number} representation.bandwidth Bitrate of the QualityLevel\n * @param {number=} representation.frameRate Frame-rate of the QualityLevel\n * @param {Function} representation.enabled Callback to enable/disable QualityLevel\n * @return {QualityLevel} the QualityLevel added to the list\n * @method addQualityLevel\n */\n\n addQualityLevel(representation) {\n let qualityLevel = this.getQualityLevelById(representation.id); // Do not add duplicate quality levels\n\n if (qualityLevel) {\n return qualityLevel;\n }\n const index = this.levels_.length;\n qualityLevel = new QualityLevel(representation);\n if (!('' + index in this)) {\n Object.defineProperty(this, index, {\n get() {\n return this.levels_[index];\n }\n });\n }\n this.levels_.push(qualityLevel);\n this.trigger({\n qualityLevel,\n type: 'addqualitylevel'\n });\n return qualityLevel;\n }\n /**\n * Removes a quality level from the list.\n *\n * @param {QualityLevel} qualityLevel The QualityLevel to remove from the list.\n * @return {QualityLevel|null} the QualityLevel removed or null if nothing removed\n * @method removeQualityLevel\n */\n\n removeQualityLevel(qualityLevel) {\n let removed = null;\n for (let i = 0, l = this.length; i < l; i++) {\n if (this[i] === qualityLevel) {\n removed = this.levels_.splice(i, 1)[0];\n if (this.selectedIndex_ === i) {\n this.selectedIndex_ = -1;\n } else if (this.selectedIndex_ > i) {\n this.selectedIndex_--;\n }\n break;\n }\n }\n if (removed) {\n this.trigger({\n qualityLevel,\n type: 'removequalitylevel'\n });\n }\n return removed;\n }\n /**\n * Searches for a QualityLevel with the given id.\n *\n * @param {string} id The id of the QualityLevel to find.\n * @return {QualityLevel|null} The QualityLevel with id, or null if not found.\n * @method getQualityLevelById\n */\n\n getQualityLevelById(id) {\n for (let i = 0, l = this.length; i < l; i++) {\n const level = this[i];\n if (level.id === id) {\n return level;\n }\n }\n return null;\n }\n /**\n * Resets the list of QualityLevels to empty\n *\n * @method dispose\n */\n\n dispose() {\n this.selectedIndex_ = -1;\n this.levels_.length = 0;\n }\n}\n/**\n * change - The selected QualityLevel has changed.\n * addqualitylevel - A QualityLevel has been added to the QualityLevelList.\n * removequalitylevel - A QualityLevel has been removed from the QualityLevelList.\n */\n\nQualityLevelList.prototype.allowedEvents_ = {\n change: 'change',\n addqualitylevel: 'addqualitylevel',\n removequalitylevel: 'removequalitylevel'\n}; // emulate attribute EventHandler support to allow for feature detection\n\nfor (const event in QualityLevelList.prototype.allowedEvents_) {\n QualityLevelList.prototype['on' + event] = null;\n}\nvar version$5 = \"4.0.0\";\n\n/**\n * Initialization function for the qualityLevels plugin. Sets up the QualityLevelList and\n * event handlers.\n *\n * @param {Player} player Player object.\n * @param {Object} options Plugin options object.\n * @return {QualityLevelList} a list of QualityLevels\n */\n\nconst initPlugin$1 = function (player, options) {\n const originalPluginFn = player.qualityLevels;\n const qualityLevelList = new QualityLevelList();\n const disposeHandler = function () {\n qualityLevelList.dispose();\n player.qualityLevels = originalPluginFn;\n player.off('dispose', disposeHandler);\n };\n player.on('dispose', disposeHandler);\n player.qualityLevels = () => qualityLevelList;\n player.qualityLevels.VERSION = version$5;\n return qualityLevelList;\n};\n/**\n * A video.js plugin.\n *\n * In the plugin function, the value of `this` is a video.js `Player`\n * instance. You cannot rely on the player being in a \"ready\" state here,\n * depending on how the plugin is invoked. This may or may not be important\n * to you; if not, remove the wait for \"ready\"!\n *\n * @param {Object} options Plugin options object\n * @return {QualityLevelList} a list of QualityLevels\n */\n\nconst qualityLevels = function (options) {\n return initPlugin$1(this, videojs.obj.merge({}, options));\n}; // Register the plugin with video.js.\n\nvideojs.registerPlugin('qualityLevels', qualityLevels); // Include the version number.\n\nqualityLevels.VERSION = version$5;\n\n/*! @name @videojs/http-streaming @version 3.9.1 @license Apache-2.0 */\n\n/**\n * @file resolve-url.js - Handling how URLs are resolved and manipulated\n */\nconst resolveUrl = _videojs_vhs_utils_es_resolve_url_js__WEBPACK_IMPORTED_MODULE_7__[\"default\"];\n/**\n * If the xhr request was redirected, return the responseURL, otherwise,\n * return the original url.\n *\n * @api private\n *\n * @param {string} url - an url being requested\n * @param {XMLHttpRequest} req - xhr request result\n *\n * @return {string}\n */\n\nconst resolveManifestRedirect = (url, req) => {\n // To understand how the responseURL below is set and generated:\n // - https://fetch.spec.whatwg.org/#concept-response-url\n // - https://fetch.spec.whatwg.org/#atomic-http-redirect-handling\n if (req && req.responseURL && url !== req.responseURL) {\n return req.responseURL;\n }\n return url;\n};\nconst logger = source => {\n if (videojs.log.debug) {\n return videojs.log.debug.bind(videojs, 'VHS:', `${source} >`);\n }\n return function () {};\n};\n\n/**\n * Provides a compatibility layer between Video.js 7 and 8 API changes for VHS.\n */\n/**\n * Delegates to videojs.obj.merge (Video.js 8) or\n * videojs.mergeOptions (Video.js 7).\n */\n\nfunction merge(...args) {\n const context = videojs.obj || videojs;\n const fn = context.merge || context.mergeOptions;\n return fn.apply(context, args);\n}\n/**\n * Delegates to videojs.time.createTimeRanges (Video.js 8) or\n * videojs.createTimeRanges (Video.js 7).\n */\n\nfunction createTimeRanges(...args) {\n const context = videojs.time || videojs;\n const fn = context.createTimeRanges || context.createTimeRanges;\n return fn.apply(context, args);\n}\n\n/**\n * ranges\n *\n * Utilities for working with TimeRanges.\n *\n */\n\nconst TIME_FUDGE_FACTOR = 1 / 30; // Comparisons between time values such as current time and the end of the buffered range\n// can be misleading because of precision differences or when the current media has poorly\n// aligned audio and video, which can cause values to be slightly off from what you would\n// expect. This value is what we consider to be safe to use in such comparisons to account\n// for these scenarios.\n\nconst SAFE_TIME_DELTA = TIME_FUDGE_FACTOR * 3;\nconst filterRanges = function (timeRanges, predicate) {\n const results = [];\n let i;\n if (timeRanges && timeRanges.length) {\n // Search for ranges that match the predicate\n for (i = 0; i < timeRanges.length; i++) {\n if (predicate(timeRanges.start(i), timeRanges.end(i))) {\n results.push([timeRanges.start(i), timeRanges.end(i)]);\n }\n }\n }\n return createTimeRanges(results);\n};\n/**\n * Attempts to find the buffered TimeRange that contains the specified\n * time.\n *\n * @param {TimeRanges} buffered - the TimeRanges object to query\n * @param {number} time - the time to filter on.\n * @return {TimeRanges} a new TimeRanges object\n */\n\nconst findRange = function (buffered, time) {\n return filterRanges(buffered, function (start, end) {\n return start - SAFE_TIME_DELTA <= time && end + SAFE_TIME_DELTA >= time;\n });\n};\n/**\n * Returns the TimeRanges that begin later than the specified time.\n *\n * @param {TimeRanges} timeRanges - the TimeRanges object to query\n * @param {number} time - the time to filter on.\n * @return {TimeRanges} a new TimeRanges object.\n */\n\nconst findNextRange = function (timeRanges, time) {\n return filterRanges(timeRanges, function (start) {\n return start - TIME_FUDGE_FACTOR >= time;\n });\n};\n/**\n * Returns gaps within a list of TimeRanges\n *\n * @param {TimeRanges} buffered - the TimeRanges object\n * @return {TimeRanges} a TimeRanges object of gaps\n */\n\nconst findGaps = function (buffered) {\n if (buffered.length < 2) {\n return createTimeRanges();\n }\n const ranges = [];\n for (let i = 1; i < buffered.length; i++) {\n const start = buffered.end(i - 1);\n const end = buffered.start(i);\n ranges.push([start, end]);\n }\n return createTimeRanges(ranges);\n};\n/**\n * Calculate the intersection of two TimeRanges\n *\n * @param {TimeRanges} bufferA\n * @param {TimeRanges} bufferB\n * @return {TimeRanges} The interesection of `bufferA` with `bufferB`\n */\n\nconst bufferIntersection = function (bufferA, bufferB) {\n let start = null;\n let end = null;\n let arity = 0;\n const extents = [];\n const ranges = [];\n if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) {\n return createTimeRanges();\n } // Handle the case where we have both buffers and create an\n // intersection of the two\n\n let count = bufferA.length; // A) Gather up all start and end times\n\n while (count--) {\n extents.push({\n time: bufferA.start(count),\n type: 'start'\n });\n extents.push({\n time: bufferA.end(count),\n type: 'end'\n });\n }\n count = bufferB.length;\n while (count--) {\n extents.push({\n time: bufferB.start(count),\n type: 'start'\n });\n extents.push({\n time: bufferB.end(count),\n type: 'end'\n });\n } // B) Sort them by time\n\n extents.sort(function (a, b) {\n return a.time - b.time;\n }); // C) Go along one by one incrementing arity for start and decrementing\n // arity for ends\n\n for (count = 0; count < extents.length; count++) {\n if (extents[count].type === 'start') {\n arity++; // D) If arity is ever incremented to 2 we are entering an\n // overlapping range\n\n if (arity === 2) {\n start = extents[count].time;\n }\n } else if (extents[count].type === 'end') {\n arity--; // E) If arity is ever decremented to 1 we leaving an\n // overlapping range\n\n if (arity === 1) {\n end = extents[count].time;\n }\n } // F) Record overlapping ranges\n\n if (start !== null && end !== null) {\n ranges.push([start, end]);\n start = null;\n end = null;\n }\n }\n return createTimeRanges(ranges);\n};\n/**\n * Gets a human readable string for a TimeRange\n *\n * @param {TimeRange} range\n * @return {string} a human readable string\n */\n\nconst printableRange = range => {\n const strArr = [];\n if (!range || !range.length) {\n return '';\n }\n for (let i = 0; i < range.length; i++) {\n strArr.push(range.start(i) + ' => ' + range.end(i));\n }\n return strArr.join(', ');\n};\n/**\n * Calculates the amount of time left in seconds until the player hits the end of the\n * buffer and causes a rebuffer\n *\n * @param {TimeRange} buffered\n * The state of the buffer\n * @param {Numnber} currentTime\n * The current time of the player\n * @param {number} playbackRate\n * The current playback rate of the player. Defaults to 1.\n * @return {number}\n * Time until the player has to start rebuffering in seconds.\n * @function timeUntilRebuffer\n */\n\nconst timeUntilRebuffer = function (buffered, currentTime, playbackRate = 1) {\n const bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0;\n return (bufferedEnd - currentTime) / playbackRate;\n};\n/**\n * Converts a TimeRanges object into an array representation\n *\n * @param {TimeRanges} timeRanges\n * @return {Array}\n */\n\nconst timeRangesToArray = timeRanges => {\n const timeRangesList = [];\n for (let i = 0; i < timeRanges.length; i++) {\n timeRangesList.push({\n start: timeRanges.start(i),\n end: timeRanges.end(i)\n });\n }\n return timeRangesList;\n};\n/**\n * Determines if two time range objects are different.\n *\n * @param {TimeRange} a\n * the first time range object to check\n *\n * @param {TimeRange} b\n * the second time range object to check\n *\n * @return {Boolean}\n * Whether the time range objects differ\n */\n\nconst isRangeDifferent = function (a, b) {\n // same object\n if (a === b) {\n return false;\n } // one or the other is undefined\n\n if (!a && b || !b && a) {\n return true;\n } // length is different\n\n if (a.length !== b.length) {\n return true;\n } // see if any start/end pair is different\n\n for (let i = 0; i < a.length; i++) {\n if (a.start(i) !== b.start(i) || a.end(i) !== b.end(i)) {\n return true;\n }\n } // if the length and every pair is the same\n // this is the same time range\n\n return false;\n};\nconst lastBufferedEnd = function (a) {\n if (!a || !a.length || !a.end) {\n return;\n }\n return a.end(a.length - 1);\n};\n/**\n * A utility function to add up the amount of time in a timeRange\n * after a specified startTime.\n * ie:[[0, 10], [20, 40], [50, 60]] with a startTime 0\n * would return 40 as there are 40s seconds after 0 in the timeRange\n *\n * @param {TimeRange} range\n * The range to check against\n * @param {number} startTime\n * The time in the time range that you should start counting from\n *\n * @return {number}\n * The number of seconds in the buffer passed the specified time.\n */\n\nconst timeAheadOf = function (range, startTime) {\n let time = 0;\n if (!range || !range.length) {\n return time;\n }\n for (let i = 0; i < range.length; i++) {\n const start = range.start(i);\n const end = range.end(i); // startTime is after this range entirely\n\n if (startTime > end) {\n continue;\n } // startTime is within this range\n\n if (startTime > start && startTime <= end) {\n time += end - startTime;\n continue;\n } // startTime is before this range.\n\n time += end - start;\n }\n return time;\n};\n\n/**\n * @file playlist.js\n *\n * Playlist related utilities.\n */\n/**\n * Get the duration of a segment, with special cases for\n * llhls segments that do not have a duration yet.\n *\n * @param {Object} playlist\n * the playlist that the segment belongs to.\n * @param {Object} segment\n * the segment to get a duration for.\n *\n * @return {number}\n * the segment duration\n */\n\nconst segmentDurationWithParts = (playlist, segment) => {\n // if this isn't a preload segment\n // then we will have a segment duration that is accurate.\n if (!segment.preload) {\n return segment.duration;\n } // otherwise we have to add up parts and preload hints\n // to get an up to date duration.\n\n let result = 0;\n (segment.parts || []).forEach(function (p) {\n result += p.duration;\n }); // for preload hints we have to use partTargetDuration\n // as they won't even have a duration yet.\n\n (segment.preloadHints || []).forEach(function (p) {\n if (p.type === 'PART') {\n result += playlist.partTargetDuration;\n }\n });\n return result;\n};\n/**\n * A function to get a combined list of parts and segments with durations\n * and indexes.\n *\n * @param {Playlist} playlist the playlist to get the list for.\n *\n * @return {Array} The part/segment list.\n */\n\nconst getPartsAndSegments = playlist => (playlist.segments || []).reduce((acc, segment, si) => {\n if (segment.parts) {\n segment.parts.forEach(function (part, pi) {\n acc.push({\n duration: part.duration,\n segmentIndex: si,\n partIndex: pi,\n part,\n segment\n });\n });\n } else {\n acc.push({\n duration: segment.duration,\n segmentIndex: si,\n partIndex: null,\n segment,\n part: null\n });\n }\n return acc;\n}, []);\nconst getLastParts = media => {\n const lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1];\n return lastSegment && lastSegment.parts || [];\n};\nconst getKnownPartCount = ({\n preloadSegment\n}) => {\n if (!preloadSegment) {\n return;\n }\n const {\n parts,\n preloadHints\n } = preloadSegment;\n let partCount = (preloadHints || []).reduce((count, hint) => count + (hint.type === 'PART' ? 1 : 0), 0);\n partCount += parts && parts.length ? parts.length : 0;\n return partCount;\n};\n/**\n * Get the number of seconds to delay from the end of a\n * live playlist.\n *\n * @param {Playlist} main the main playlist\n * @param {Playlist} media the media playlist\n * @return {number} the hold back in seconds.\n */\n\nconst liveEdgeDelay = (main, media) => {\n if (media.endList) {\n return 0;\n } // dash suggestedPresentationDelay trumps everything\n\n if (main && main.suggestedPresentationDelay) {\n return main.suggestedPresentationDelay;\n }\n const hasParts = getLastParts(media).length > 0; // look for \"part\" delays from ll-hls first\n\n if (hasParts && media.serverControl && media.serverControl.partHoldBack) {\n return media.serverControl.partHoldBack;\n } else if (hasParts && media.partTargetDuration) {\n return media.partTargetDuration * 3; // finally look for full segment delays\n } else if (media.serverControl && media.serverControl.holdBack) {\n return media.serverControl.holdBack;\n } else if (media.targetDuration) {\n return media.targetDuration * 3;\n }\n return 0;\n};\n/**\n * walk backward until we find a duration we can use\n * or return a failure\n *\n * @param {Playlist} playlist the playlist to walk through\n * @param {Number} endSequence the mediaSequence to stop walking on\n */\n\nconst backwardDuration = function (playlist, endSequence) {\n let result = 0;\n let i = endSequence - playlist.mediaSequence; // if a start time is available for segment immediately following\n // the interval, use it\n\n let segment = playlist.segments[i]; // Walk backward until we find the latest segment with timeline\n // information that is earlier than endSequence\n\n if (segment) {\n if (typeof segment.start !== 'undefined') {\n return {\n result: segment.start,\n precise: true\n };\n }\n if (typeof segment.end !== 'undefined') {\n return {\n result: segment.end - segment.duration,\n precise: true\n };\n }\n }\n while (i--) {\n segment = playlist.segments[i];\n if (typeof segment.end !== 'undefined') {\n return {\n result: result + segment.end,\n precise: true\n };\n }\n result += segmentDurationWithParts(playlist, segment);\n if (typeof segment.start !== 'undefined') {\n return {\n result: result + segment.start,\n precise: true\n };\n }\n }\n return {\n result,\n precise: false\n };\n};\n/**\n * walk forward until we find a duration we can use\n * or return a failure\n *\n * @param {Playlist} playlist the playlist to walk through\n * @param {number} endSequence the mediaSequence to stop walking on\n */\n\nconst forwardDuration = function (playlist, endSequence) {\n let result = 0;\n let segment;\n let i = endSequence - playlist.mediaSequence; // Walk forward until we find the earliest segment with timeline\n // information\n\n for (; i < playlist.segments.length; i++) {\n segment = playlist.segments[i];\n if (typeof segment.start !== 'undefined') {\n return {\n result: segment.start - result,\n precise: true\n };\n }\n result += segmentDurationWithParts(playlist, segment);\n if (typeof segment.end !== 'undefined') {\n return {\n result: segment.end - result,\n precise: true\n };\n }\n } // indicate we didn't find a useful duration estimate\n\n return {\n result: -1,\n precise: false\n };\n};\n/**\n * Calculate the media duration from the segments associated with a\n * playlist. The duration of a subinterval of the available segments\n * may be calculated by specifying an end index.\n *\n * @param {Object} playlist a media playlist object\n * @param {number=} endSequence an exclusive upper boundary\n * for the playlist. Defaults to playlist length.\n * @param {number} expired the amount of time that has dropped\n * off the front of the playlist in a live scenario\n * @return {number} the duration between the first available segment\n * and end index.\n */\n\nconst intervalDuration = function (playlist, endSequence, expired) {\n if (typeof endSequence === 'undefined') {\n endSequence = playlist.mediaSequence + playlist.segments.length;\n }\n if (endSequence < playlist.mediaSequence) {\n return 0;\n } // do a backward walk to estimate the duration\n\n const backward = backwardDuration(playlist, endSequence);\n if (backward.precise) {\n // if we were able to base our duration estimate on timing\n // information provided directly from the Media Source, return\n // it\n return backward.result;\n } // walk forward to see if a precise duration estimate can be made\n // that way\n\n const forward = forwardDuration(playlist, endSequence);\n if (forward.precise) {\n // we found a segment that has been buffered and so it's\n // position is known precisely\n return forward.result;\n } // return the less-precise, playlist-based duration estimate\n\n return backward.result + expired;\n};\n/**\n * Calculates the duration of a playlist. If a start and end index\n * are specified, the duration will be for the subset of the media\n * timeline between those two indices. The total duration for live\n * playlists is always Infinity.\n *\n * @param {Object} playlist a media playlist object\n * @param {number=} endSequence an exclusive upper\n * boundary for the playlist. Defaults to the playlist media\n * sequence number plus its length.\n * @param {number=} expired the amount of time that has\n * dropped off the front of the playlist in a live scenario\n * @return {number} the duration between the start index and end\n * index.\n */\n\nconst duration = function (playlist, endSequence, expired) {\n if (!playlist) {\n return 0;\n }\n if (typeof expired !== 'number') {\n expired = 0;\n } // if a slice of the total duration is not requested, use\n // playlist-level duration indicators when they're present\n\n if (typeof endSequence === 'undefined') {\n // if present, use the duration specified in the playlist\n if (playlist.totalDuration) {\n return playlist.totalDuration;\n } // duration should be Infinity for live playlists\n\n if (!playlist.endList) {\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default()[Infinity]);\n }\n } // calculate the total duration based on the segment durations\n\n return intervalDuration(playlist, endSequence, expired);\n};\n/**\n * Calculate the time between two indexes in the current playlist\n * neight the start- nor the end-index need to be within the current\n * playlist in which case, the targetDuration of the playlist is used\n * to approximate the durations of the segments\n *\n * @param {Array} options.durationList list to iterate over for durations.\n * @param {number} options.defaultDuration duration to use for elements before or after the durationList\n * @param {number} options.startIndex partsAndSegments index to start\n * @param {number} options.endIndex partsAndSegments index to end.\n * @return {number} the number of seconds between startIndex and endIndex\n */\n\nconst sumDurations = function ({\n defaultDuration,\n durationList,\n startIndex,\n endIndex\n}) {\n let durations = 0;\n if (startIndex > endIndex) {\n [startIndex, endIndex] = [endIndex, startIndex];\n }\n if (startIndex < 0) {\n for (let i = startIndex; i < Math.min(0, endIndex); i++) {\n durations += defaultDuration;\n }\n startIndex = 0;\n }\n for (let i = startIndex; i < endIndex; i++) {\n durations += durationList[i].duration;\n }\n return durations;\n};\n/**\n * Calculates the playlist end time\n *\n * @param {Object} playlist a media playlist object\n * @param {number=} expired the amount of time that has\n * dropped off the front of the playlist in a live scenario\n * @param {boolean|false} useSafeLiveEnd a boolean value indicating whether or not the\n * playlist end calculation should consider the safe live end\n * (truncate the playlist end by three segments). This is normally\n * used for calculating the end of the playlist's seekable range.\n * This takes into account the value of liveEdgePadding.\n * Setting liveEdgePadding to 0 is equivalent to setting this to false.\n * @param {number} liveEdgePadding a number indicating how far from the end of the playlist we should be in seconds.\n * If this is provided, it is used in the safe live end calculation.\n * Setting useSafeLiveEnd=false or liveEdgePadding=0 are equivalent.\n * Corresponds to suggestedPresentationDelay in DASH manifests.\n * @return {number} the end time of playlist\n * @function playlistEnd\n */\n\nconst playlistEnd = function (playlist, expired, useSafeLiveEnd, liveEdgePadding) {\n if (!playlist || !playlist.segments) {\n return null;\n }\n if (playlist.endList) {\n return duration(playlist);\n }\n if (expired === null) {\n return null;\n }\n expired = expired || 0;\n let lastSegmentEndTime = intervalDuration(playlist, playlist.mediaSequence + playlist.segments.length, expired);\n if (useSafeLiveEnd) {\n liveEdgePadding = typeof liveEdgePadding === 'number' ? liveEdgePadding : liveEdgeDelay(null, playlist);\n lastSegmentEndTime -= liveEdgePadding;\n } // don't return a time less than zero\n\n return Math.max(0, lastSegmentEndTime);\n};\n/**\n * Calculates the interval of time that is currently seekable in a\n * playlist. The returned time ranges are relative to the earliest\n * moment in the specified playlist that is still available. A full\n * seekable implementation for live streams would need to offset\n * these values by the duration of content that has expired from the\n * stream.\n *\n * @param {Object} playlist a media playlist object\n * dropped off the front of the playlist in a live scenario\n * @param {number=} expired the amount of time that has\n * dropped off the front of the playlist in a live scenario\n * @param {number} liveEdgePadding how far from the end of the playlist we should be in seconds.\n * Corresponds to suggestedPresentationDelay in DASH manifests.\n * @return {TimeRanges} the periods of time that are valid targets\n * for seeking\n */\n\nconst seekable = function (playlist, expired, liveEdgePadding) {\n const useSafeLiveEnd = true;\n const seekableStart = expired || 0;\n let seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding);\n if (seekableEnd === null) {\n return createTimeRanges();\n } // Clamp seekable end since it can not be less than the seekable start\n\n if (seekableEnd < seekableStart) {\n seekableEnd = seekableStart;\n }\n return createTimeRanges(seekableStart, seekableEnd);\n};\n/**\n * Determine the index and estimated starting time of the segment that\n * contains a specified playback position in a media playlist.\n *\n * @param {Object} options.playlist the media playlist to query\n * @param {number} options.currentTime The number of seconds since the earliest\n * possible position to determine the containing segment for\n * @param {number} options.startTime the time when the segment/part starts\n * @param {number} options.startingSegmentIndex the segment index to start looking at.\n * @param {number?} [options.startingPartIndex] the part index to look at within the segment.\n *\n * @return {Object} an object with partIndex, segmentIndex, and startTime.\n */\n\nconst getMediaInfoForTime = function ({\n playlist,\n currentTime,\n startingSegmentIndex,\n startingPartIndex,\n startTime,\n exactManifestTimings\n}) {\n let time = currentTime - startTime;\n const partsAndSegments = getPartsAndSegments(playlist);\n let startIndex = 0;\n for (let i = 0; i < partsAndSegments.length; i++) {\n const partAndSegment = partsAndSegments[i];\n if (startingSegmentIndex !== partAndSegment.segmentIndex) {\n continue;\n } // skip this if part index does not match.\n\n if (typeof startingPartIndex === 'number' && typeof partAndSegment.partIndex === 'number' && startingPartIndex !== partAndSegment.partIndex) {\n continue;\n }\n startIndex = i;\n break;\n }\n if (time < 0) {\n // Walk backward from startIndex in the playlist, adding durations\n // until we find a segment that contains `time` and return it\n if (startIndex > 0) {\n for (let i = startIndex - 1; i >= 0; i--) {\n const partAndSegment = partsAndSegments[i];\n time += partAndSegment.duration;\n if (exactManifestTimings) {\n if (time < 0) {\n continue;\n }\n } else if (time + TIME_FUDGE_FACTOR <= 0) {\n continue;\n }\n return {\n partIndex: partAndSegment.partIndex,\n segmentIndex: partAndSegment.segmentIndex,\n startTime: startTime - sumDurations({\n defaultDuration: playlist.targetDuration,\n durationList: partsAndSegments,\n startIndex,\n endIndex: i\n })\n };\n }\n } // We were unable to find a good segment within the playlist\n // so select the first segment\n\n return {\n partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,\n segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,\n startTime: currentTime\n };\n } // When startIndex is negative, we first walk forward to first segment\n // adding target durations. If we \"run out of time\" before getting to\n // the first segment, return the first segment\n\n if (startIndex < 0) {\n for (let i = startIndex; i < 0; i++) {\n time -= playlist.targetDuration;\n if (time < 0) {\n return {\n partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,\n segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,\n startTime: currentTime\n };\n }\n }\n startIndex = 0;\n } // Walk forward from startIndex in the playlist, subtracting durations\n // until we find a segment that contains `time` and return it\n\n for (let i = startIndex; i < partsAndSegments.length; i++) {\n const partAndSegment = partsAndSegments[i];\n time -= partAndSegment.duration;\n const canUseFudgeFactor = partAndSegment.duration > TIME_FUDGE_FACTOR;\n const isExactlyAtTheEnd = time === 0;\n const isExtremelyCloseToTheEnd = canUseFudgeFactor && time + TIME_FUDGE_FACTOR >= 0;\n if (isExactlyAtTheEnd || isExtremelyCloseToTheEnd) {\n // 1) We are exactly at the end of the current segment.\n // 2) We are extremely close to the end of the current segment (The difference is less than 1 / 30).\n // We may encounter this situation when\n // we don't have exact match between segment duration info in the manifest and the actual duration of the segment\n // For example:\n // We appended 3 segments 10 seconds each, meaning we should have 30 sec buffered,\n // but we the actual buffered is 29.99999\n //\n // In both cases:\n // if we passed current time -> it means that we already played current segment\n // if we passed buffered.end -> it means that this segment is already loaded and buffered\n // we should select the next segment if we have one:\n if (i !== partsAndSegments.length - 1) {\n continue;\n }\n }\n if (exactManifestTimings) {\n if (time > 0) {\n continue;\n }\n } else if (time - TIME_FUDGE_FACTOR >= 0) {\n continue;\n }\n return {\n partIndex: partAndSegment.partIndex,\n segmentIndex: partAndSegment.segmentIndex,\n startTime: startTime + sumDurations({\n defaultDuration: playlist.targetDuration,\n durationList: partsAndSegments,\n startIndex,\n endIndex: i\n })\n };\n } // We are out of possible candidates so load the last one...\n\n return {\n segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex,\n partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex,\n startTime: currentTime\n };\n};\n/**\n * Check whether the playlist is excluded or not.\n *\n * @param {Object} playlist the media playlist object\n * @return {boolean} whether the playlist is excluded or not\n * @function isExcluded\n */\n\nconst isExcluded = function (playlist) {\n return playlist.excludeUntil && playlist.excludeUntil > Date.now();\n};\n/**\n * Check whether the playlist is compatible with current playback configuration or has\n * been excluded permanently for being incompatible.\n *\n * @param {Object} playlist the media playlist object\n * @return {boolean} whether the playlist is incompatible or not\n * @function isIncompatible\n */\n\nconst isIncompatible = function (playlist) {\n return playlist.excludeUntil && playlist.excludeUntil === Infinity;\n};\n/**\n * Check whether the playlist is enabled or not.\n *\n * @param {Object} playlist the media playlist object\n * @return {boolean} whether the playlist is enabled or not\n * @function isEnabled\n */\n\nconst isEnabled = function (playlist) {\n const excluded = isExcluded(playlist);\n return !playlist.disabled && !excluded;\n};\n/**\n * Check whether the playlist has been manually disabled through the representations api.\n *\n * @param {Object} playlist the media playlist object\n * @return {boolean} whether the playlist is disabled manually or not\n * @function isDisabled\n */\n\nconst isDisabled = function (playlist) {\n return playlist.disabled;\n};\n/**\n * Returns whether the current playlist is an AES encrypted HLS stream\n *\n * @return {boolean} true if it's an AES encrypted HLS stream\n */\n\nconst isAes = function (media) {\n for (let i = 0; i < media.segments.length; i++) {\n if (media.segments[i].key) {\n return true;\n }\n }\n return false;\n};\n/**\n * Checks if the playlist has a value for the specified attribute\n *\n * @param {string} attr\n * Attribute to check for\n * @param {Object} playlist\n * The media playlist object\n * @return {boolean}\n * Whether the playlist contains a value for the attribute or not\n * @function hasAttribute\n */\n\nconst hasAttribute = function (attr, playlist) {\n return playlist.attributes && playlist.attributes[attr];\n};\n/**\n * Estimates the time required to complete a segment download from the specified playlist\n *\n * @param {number} segmentDuration\n * Duration of requested segment\n * @param {number} bandwidth\n * Current measured bandwidth of the player\n * @param {Object} playlist\n * The media playlist object\n * @param {number=} bytesReceived\n * Number of bytes already received for the request. Defaults to 0\n * @return {number|NaN}\n * The estimated time to request the segment. NaN if bandwidth information for\n * the given playlist is unavailable\n * @function estimateSegmentRequestTime\n */\n\nconst estimateSegmentRequestTime = function (segmentDuration, bandwidth, playlist, bytesReceived = 0) {\n if (!hasAttribute('BANDWIDTH', playlist)) {\n return NaN;\n }\n const size = segmentDuration * playlist.attributes.BANDWIDTH;\n return (size - bytesReceived * 8) / bandwidth;\n};\n/*\n * Returns whether the current playlist is the lowest rendition\n *\n * @return {Boolean} true if on lowest rendition\n */\n\nconst isLowestEnabledRendition = (main, media) => {\n if (main.playlists.length === 1) {\n return true;\n }\n const currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE;\n return main.playlists.filter(playlist => {\n if (!isEnabled(playlist)) {\n return false;\n }\n return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth;\n }).length === 0;\n};\nconst playlistMatch = (a, b) => {\n // both playlits are null\n // or only one playlist is non-null\n // no match\n if (!a && !b || !a && b || a && !b) {\n return false;\n } // playlist objects are the same, match\n\n if (a === b) {\n return true;\n } // first try to use id as it should be the most\n // accurate\n\n if (a.id && b.id && a.id === b.id) {\n return true;\n } // next try to use reslovedUri as it should be the\n // second most accurate.\n\n if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) {\n return true;\n } // finally try to use uri as it should be accurate\n // but might miss a few cases for relative uris\n\n if (a.uri && b.uri && a.uri === b.uri) {\n return true;\n }\n return false;\n};\nconst someAudioVariant = function (main, callback) {\n const AUDIO = main && main.mediaGroups && main.mediaGroups.AUDIO || {};\n let found = false;\n for (const groupName in AUDIO) {\n for (const label in AUDIO[groupName]) {\n found = callback(AUDIO[groupName][label]);\n if (found) {\n break;\n }\n }\n if (found) {\n break;\n }\n }\n return !!found;\n};\nconst isAudioOnly = main => {\n // we are audio only if we have no main playlists but do\n // have media group playlists.\n if (!main || !main.playlists || !main.playlists.length) {\n // without audio variants or playlists this\n // is not an audio only main.\n const found = someAudioVariant(main, variant => variant.playlists && variant.playlists.length || variant.uri);\n return found;\n } // if every playlist has only an audio codec it is audio only\n\n for (let i = 0; i < main.playlists.length; i++) {\n const playlist = main.playlists[i];\n const CODECS = playlist.attributes && playlist.attributes.CODECS; // all codecs are audio, this is an audio playlist.\n\n if (CODECS && CODECS.split(',').every(c => (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.isAudioCodec)(c))) {\n continue;\n } // playlist is in an audio group it is audio only\n\n const found = someAudioVariant(main, variant => playlistMatch(playlist, variant));\n if (found) {\n continue;\n } // if we make it here this playlist isn't audio and we\n // are not audio only\n\n return false;\n } // if we make it past every playlist without returning, then\n // this is an audio only playlist.\n\n return true;\n}; // exports\n\nvar Playlist = {\n liveEdgeDelay,\n duration,\n seekable,\n getMediaInfoForTime,\n isEnabled,\n isDisabled,\n isExcluded,\n isIncompatible,\n playlistEnd,\n isAes,\n hasAttribute,\n estimateSegmentRequestTime,\n isLowestEnabledRendition,\n isAudioOnly,\n playlistMatch,\n segmentDurationWithParts\n};\nconst {\n log\n} = videojs;\nconst createPlaylistID = (index, uri) => {\n return `${index}-${uri}`;\n}; // default function for creating a group id\n\nconst groupID = (type, group, label) => {\n return `placeholder-uri-${type}-${group}-${label}`;\n};\n/**\n * Parses a given m3u8 playlist\n *\n * @param {Function} [onwarn]\n * a function to call when the parser triggers a warning event.\n * @param {Function} [oninfo]\n * a function to call when the parser triggers an info event.\n * @param {string} manifestString\n * The downloaded manifest string\n * @param {Object[]} [customTagParsers]\n * An array of custom tag parsers for the m3u8-parser instance\n * @param {Object[]} [customTagMappers]\n * An array of custom tag mappers for the m3u8-parser instance\n * @param {boolean} [llhls]\n * Whether to keep ll-hls features in the manifest after parsing.\n * @return {Object}\n * The manifest object\n */\n\nconst parseManifest = ({\n onwarn,\n oninfo,\n manifestString,\n customTagParsers = [],\n customTagMappers = [],\n llhls\n}) => {\n const parser = new m3u8_parser__WEBPACK_IMPORTED_MODULE_8__.Parser();\n if (onwarn) {\n parser.on('warn', onwarn);\n }\n if (oninfo) {\n parser.on('info', oninfo);\n }\n customTagParsers.forEach(customParser => parser.addParser(customParser));\n customTagMappers.forEach(mapper => parser.addTagMapper(mapper));\n parser.push(manifestString);\n parser.end();\n const manifest = parser.manifest; // remove llhls features from the parsed manifest\n // if we don't want llhls support.\n\n if (!llhls) {\n ['preloadSegment', 'skip', 'serverControl', 'renditionReports', 'partInf', 'partTargetDuration'].forEach(function (k) {\n if (manifest.hasOwnProperty(k)) {\n delete manifest[k];\n }\n });\n if (manifest.segments) {\n manifest.segments.forEach(function (segment) {\n ['parts', 'preloadHints'].forEach(function (k) {\n if (segment.hasOwnProperty(k)) {\n delete segment[k];\n }\n });\n });\n }\n }\n if (!manifest.targetDuration) {\n let targetDuration = 10;\n if (manifest.segments && manifest.segments.length) {\n targetDuration = manifest.segments.reduce((acc, s) => Math.max(acc, s.duration), 0);\n }\n if (onwarn) {\n onwarn({\n message: `manifest has no targetDuration defaulting to ${targetDuration}`\n });\n }\n manifest.targetDuration = targetDuration;\n }\n const parts = getLastParts(manifest);\n if (parts.length && !manifest.partTargetDuration) {\n const partTargetDuration = parts.reduce((acc, p) => Math.max(acc, p.duration), 0);\n if (onwarn) {\n onwarn({\n message: `manifest has no partTargetDuration defaulting to ${partTargetDuration}`\n });\n log.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.');\n }\n manifest.partTargetDuration = partTargetDuration;\n }\n return manifest;\n};\n/**\n * Loops through all supported media groups in main and calls the provided\n * callback for each group\n *\n * @param {Object} main\n * The parsed main manifest object\n * @param {Function} callback\n * Callback to call for each media group\n */\n\nconst forEachMediaGroup = (main, callback) => {\n if (!main.mediaGroups) {\n return;\n }\n ['AUDIO', 'SUBTITLES'].forEach(mediaType => {\n if (!main.mediaGroups[mediaType]) {\n return;\n }\n for (const groupKey in main.mediaGroups[mediaType]) {\n for (const labelKey in main.mediaGroups[mediaType][groupKey]) {\n const mediaProperties = main.mediaGroups[mediaType][groupKey][labelKey];\n callback(mediaProperties, mediaType, groupKey, labelKey);\n }\n }\n });\n};\n/**\n * Adds properties and attributes to the playlist to keep consistent functionality for\n * playlists throughout VHS.\n *\n * @param {Object} config\n * Arguments object\n * @param {Object} config.playlist\n * The media playlist\n * @param {string} [config.uri]\n * The uri to the media playlist (if media playlist is not from within a main\n * playlist)\n * @param {string} id\n * ID to use for the playlist\n */\n\nconst setupMediaPlaylist = ({\n playlist,\n uri,\n id\n}) => {\n playlist.id = id;\n playlist.playlistErrors_ = 0;\n if (uri) {\n // For media playlists, m3u8-parser does not have access to a URI, as HLS media\n // playlists do not contain their own source URI, but one is needed for consistency in\n // VHS.\n playlist.uri = uri;\n } // For HLS main playlists, even though certain attributes MUST be defined, the\n // stream may still be played without them.\n // For HLS media playlists, m3u8-parser does not attach an attributes object to the\n // manifest.\n //\n // To avoid undefined reference errors through the project, and make the code easier\n // to write/read, add an empty attributes object for these cases.\n\n playlist.attributes = playlist.attributes || {};\n};\n/**\n * Adds ID, resolvedUri, and attributes properties to each playlist of the main, where\n * necessary. In addition, creates playlist IDs for each playlist and adds playlist ID to\n * playlist references to the playlists array.\n *\n * @param {Object} main\n * The main playlist\n */\n\nconst setupMediaPlaylists = main => {\n let i = main.playlists.length;\n while (i--) {\n const playlist = main.playlists[i];\n setupMediaPlaylist({\n playlist,\n id: createPlaylistID(i, playlist.uri)\n });\n playlist.resolvedUri = resolveUrl(main.uri, playlist.uri);\n main.playlists[playlist.id] = playlist; // URI reference added for backwards compatibility\n\n main.playlists[playlist.uri] = playlist; // Although the spec states an #EXT-X-STREAM-INF tag MUST have a BANDWIDTH attribute,\n // the stream can be played without it. Although an attributes property may have been\n // added to the playlist to prevent undefined references, issue a warning to fix the\n // manifest.\n\n if (!playlist.attributes.BANDWIDTH) {\n log.warn('Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.');\n }\n }\n};\n/**\n * Adds resolvedUri properties to each media group.\n *\n * @param {Object} main\n * The main playlist\n */\n\nconst resolveMediaGroupUris = main => {\n forEachMediaGroup(main, properties => {\n if (properties.uri) {\n properties.resolvedUri = resolveUrl(main.uri, properties.uri);\n }\n });\n};\n/**\n * Creates a main playlist wrapper to insert a sole media playlist into.\n *\n * @param {Object} media\n * Media playlist\n * @param {string} uri\n * The media URI\n *\n * @return {Object}\n * main playlist\n */\n\nconst mainForMedia = (media, uri) => {\n const id = createPlaylistID(0, uri);\n const main = {\n mediaGroups: {\n 'AUDIO': {},\n 'VIDEO': {},\n 'CLOSED-CAPTIONS': {},\n 'SUBTITLES': {}\n },\n uri: (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).href,\n resolvedUri: (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).href,\n playlists: [{\n uri,\n id,\n resolvedUri: uri,\n // m3u8-parser does not attach an attributes property to media playlists so make\n // sure that the property is attached to avoid undefined reference errors\n attributes: {}\n }]\n }; // set up ID reference\n\n main.playlists[id] = main.playlists[0]; // URI reference added for backwards compatibility\n\n main.playlists[uri] = main.playlists[0];\n return main;\n};\n/**\n * Does an in-place update of the main manifest to add updated playlist URI references\n * as well as other properties needed by VHS that aren't included by the parser.\n *\n * @param {Object} main\n * main manifest object\n * @param {string} uri\n * The source URI\n * @param {function} createGroupID\n * A function to determine how to create the groupID for mediaGroups\n */\n\nconst addPropertiesToMain = (main, uri, createGroupID = groupID) => {\n main.uri = uri;\n for (let i = 0; i < main.playlists.length; i++) {\n if (!main.playlists[i].uri) {\n // Set up phony URIs for the playlists since playlists are referenced by their URIs\n // throughout VHS, but some formats (e.g., DASH) don't have external URIs\n // TODO: consider adding dummy URIs in mpd-parser\n const phonyUri = `placeholder-uri-${i}`;\n main.playlists[i].uri = phonyUri;\n }\n }\n const audioOnlyMain = isAudioOnly(main);\n forEachMediaGroup(main, (properties, mediaType, groupKey, labelKey) => {\n // add a playlist array under properties\n if (!properties.playlists || !properties.playlists.length) {\n // If the manifest is audio only and this media group does not have a uri, check\n // if the media group is located in the main list of playlists. If it is, don't add\n // placeholder properties as it shouldn't be considered an alternate audio track.\n if (audioOnlyMain && mediaType === 'AUDIO' && !properties.uri) {\n for (let i = 0; i < main.playlists.length; i++) {\n const p = main.playlists[i];\n if (p.attributes && p.attributes.AUDIO && p.attributes.AUDIO === groupKey) {\n return;\n }\n }\n }\n properties.playlists = [(0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_6__[\"default\"])({}, properties)];\n }\n properties.playlists.forEach(function (p, i) {\n const groupId = createGroupID(mediaType, groupKey, labelKey, p);\n const id = createPlaylistID(i, groupId);\n if (p.uri) {\n p.resolvedUri = p.resolvedUri || resolveUrl(main.uri, p.uri);\n } else {\n // DEPRECATED, this has been added to prevent a breaking change.\n // previously we only ever had a single media group playlist, so\n // we mark the first playlist uri without prepending the index as we used to\n // ideally we would do all of the playlists the same way.\n p.uri = i === 0 ? groupId : id; // don't resolve a placeholder uri to an absolute url, just use\n // the placeholder again\n\n p.resolvedUri = p.uri;\n }\n p.id = p.id || id; // add an empty attributes object, all playlists are\n // expected to have this.\n\n p.attributes = p.attributes || {}; // setup ID and URI references (URI for backwards compatibility)\n\n main.playlists[p.id] = p;\n main.playlists[p.uri] = p;\n });\n });\n setupMediaPlaylists(main);\n resolveMediaGroupUris(main);\n};\nclass DateRangesStorage {\n constructor() {\n this.offset_ = null;\n this.pendingDateRanges_ = new Map();\n this.processedDateRanges_ = new Map();\n }\n setOffset(segments = []) {\n // already set\n if (this.offset_ !== null) {\n return;\n } // no segment to process\n\n if (!segments.length) {\n return;\n }\n const [firstSegment] = segments; // no program date time\n\n if (firstSegment.programDateTime === undefined) {\n return;\n } // Set offset as ProgramDateTime for the very first segment of the very first playlist load:\n\n this.offset_ = firstSegment.programDateTime / 1000;\n }\n setPendingDateRanges(dateRanges = []) {\n if (!dateRanges.length) {\n return;\n }\n const [dateRange] = dateRanges;\n const startTime = dateRange.startDate.getTime();\n this.trimProcessedDateRanges_(startTime);\n this.pendingDateRanges_ = dateRanges.reduce((map, pendingDateRange) => {\n map.set(pendingDateRange.id, pendingDateRange);\n return map;\n }, new Map());\n }\n processDateRange(dateRange) {\n this.pendingDateRanges_.delete(dateRange.id);\n this.processedDateRanges_.set(dateRange.id, dateRange);\n }\n getDateRangesToProcess() {\n if (this.offset_ === null) {\n return [];\n }\n const dateRangeClasses = {};\n const dateRangesToProcess = [];\n this.pendingDateRanges_.forEach((dateRange, id) => {\n if (this.processedDateRanges_.has(id)) {\n return;\n }\n dateRange.startTime = dateRange.startDate.getTime() / 1000 - this.offset_;\n dateRange.processDateRange = () => this.processDateRange(dateRange);\n dateRangesToProcess.push(dateRange);\n if (!dateRange.class) {\n return;\n }\n if (dateRangeClasses[dateRange.class]) {\n const length = dateRangeClasses[dateRange.class].push(dateRange);\n dateRange.classListIndex = length - 1;\n } else {\n dateRangeClasses[dateRange.class] = [dateRange];\n dateRange.classListIndex = 0;\n }\n });\n for (const dateRange of dateRangesToProcess) {\n const classList = dateRangeClasses[dateRange.class] || [];\n if (dateRange.endDate) {\n dateRange.endTime = dateRange.endDate.getTime() / 1000 - this.offset_;\n } else if (dateRange.endOnNext && classList[dateRange.classListIndex + 1]) {\n dateRange.endTime = classList[dateRange.classListIndex + 1].startTime;\n } else if (dateRange.duration) {\n dateRange.endTime = dateRange.startTime + dateRange.duration;\n } else if (dateRange.plannedDuration) {\n dateRange.endTime = dateRange.startTime + dateRange.plannedDuration;\n } else {\n dateRange.endTime = dateRange.startTime;\n }\n }\n return dateRangesToProcess;\n }\n trimProcessedDateRanges_(startTime) {\n const copy = new Map(this.processedDateRanges_);\n copy.forEach((dateRange, id) => {\n if (dateRange.startDate.getTime() < startTime) {\n this.processedDateRanges_.delete(id);\n }\n });\n }\n}\nconst {\n EventTarget: EventTarget$1\n} = videojs;\nconst addLLHLSQueryDirectives = (uri, media) => {\n if (media.endList || !media.serverControl) {\n return uri;\n }\n const parameters = {};\n if (media.serverControl.canBlockReload) {\n const {\n preloadSegment\n } = media; // next msn is a zero based value, length is not.\n\n let nextMSN = media.mediaSequence + media.segments.length; // If preload segment has parts then it is likely\n // that we are going to request a part of that preload segment.\n // the logic below is used to determine that.\n\n if (preloadSegment) {\n const parts = preloadSegment.parts || []; // _HLS_part is a zero based index\n\n const nextPart = getKnownPartCount(media) - 1; // if nextPart is > -1 and not equal to just the\n // length of parts, then we know we had part preload hints\n // and we need to add the _HLS_part= query\n\n if (nextPart > -1 && nextPart !== parts.length - 1) {\n // add existing parts to our preload hints\n // eslint-disable-next-line\n parameters._HLS_part = nextPart;\n } // this if statement makes sure that we request the msn\n // of the preload segment if:\n // 1. the preload segment had parts (and was not yet a full segment)\n // but was added to our segments array\n // 2. the preload segment had preload hints for parts that are not in\n // the manifest yet.\n // in all other cases we want the segment after the preload segment\n // which will be given by using media.segments.length because it is 1 based\n // rather than 0 based.\n\n if (nextPart > -1 || parts.length) {\n nextMSN--;\n }\n } // add _HLS_msn= in front of any _HLS_part query\n // eslint-disable-next-line\n\n parameters._HLS_msn = nextMSN;\n }\n if (media.serverControl && media.serverControl.canSkipUntil) {\n // add _HLS_skip= infront of all other queries.\n // eslint-disable-next-line\n parameters._HLS_skip = media.serverControl.canSkipDateranges ? 'v2' : 'YES';\n }\n if (Object.keys(parameters).length) {\n const parsedUri = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().URL)(uri);\n ['_HLS_skip', '_HLS_msn', '_HLS_part'].forEach(function (name) {\n if (!parameters.hasOwnProperty(name)) {\n return;\n }\n parsedUri.searchParams.set(name, parameters[name]);\n });\n uri = parsedUri.toString();\n }\n return uri;\n};\n/**\n * Returns a new segment object with properties and\n * the parts array merged.\n *\n * @param {Object} a the old segment\n * @param {Object} b the new segment\n *\n * @return {Object} the merged segment\n */\n\nconst updateSegment = (a, b) => {\n if (!a) {\n return b;\n }\n const result = merge(a, b); // if only the old segment has preload hints\n // and the new one does not, remove preload hints.\n\n if (a.preloadHints && !b.preloadHints) {\n delete result.preloadHints;\n } // if only the old segment has parts\n // then the parts are no longer valid\n\n if (a.parts && !b.parts) {\n delete result.parts; // if both segments have parts\n // copy part propeties from the old segment\n // to the new one.\n } else if (a.parts && b.parts) {\n for (let i = 0; i < b.parts.length; i++) {\n if (a.parts && a.parts[i]) {\n result.parts[i] = merge(a.parts[i], b.parts[i]);\n }\n }\n } // set skipped to false for segments that have\n // have had information merged from the old segment.\n\n if (!a.skipped && b.skipped) {\n result.skipped = false;\n } // set preload to false for segments that have\n // had information added in the new segment.\n\n if (a.preload && !b.preload) {\n result.preload = false;\n }\n return result;\n};\n/**\n * Returns a new array of segments that is the result of merging\n * properties from an older list of segments onto an updated\n * list. No properties on the updated playlist will be ovewritten.\n *\n * @param {Array} original the outdated list of segments\n * @param {Array} update the updated list of segments\n * @param {number=} offset the index of the first update\n * segment in the original segment list. For non-live playlists,\n * this should always be zero and does not need to be\n * specified. For live playlists, it should be the difference\n * between the media sequence numbers in the original and updated\n * playlists.\n * @return {Array} a list of merged segment objects\n */\n\nconst updateSegments = (original, update, offset) => {\n const oldSegments = original.slice();\n const newSegments = update.slice();\n offset = offset || 0;\n const result = [];\n let currentMap;\n for (let newIndex = 0; newIndex < newSegments.length; newIndex++) {\n const oldSegment = oldSegments[newIndex + offset];\n const newSegment = newSegments[newIndex];\n if (oldSegment) {\n currentMap = oldSegment.map || currentMap;\n result.push(updateSegment(oldSegment, newSegment));\n } else {\n // carry over map to new segment if it is missing\n if (currentMap && !newSegment.map) {\n newSegment.map = currentMap;\n }\n result.push(newSegment);\n }\n }\n return result;\n};\nconst resolveSegmentUris = (segment, baseUri) => {\n // preloadSegment will not have a uri at all\n // as the segment isn't actually in the manifest yet, only parts\n if (!segment.resolvedUri && segment.uri) {\n segment.resolvedUri = resolveUrl(baseUri, segment.uri);\n }\n if (segment.key && !segment.key.resolvedUri) {\n segment.key.resolvedUri = resolveUrl(baseUri, segment.key.uri);\n }\n if (segment.map && !segment.map.resolvedUri) {\n segment.map.resolvedUri = resolveUrl(baseUri, segment.map.uri);\n }\n if (segment.map && segment.map.key && !segment.map.key.resolvedUri) {\n segment.map.key.resolvedUri = resolveUrl(baseUri, segment.map.key.uri);\n }\n if (segment.parts && segment.parts.length) {\n segment.parts.forEach(p => {\n if (p.resolvedUri) {\n return;\n }\n p.resolvedUri = resolveUrl(baseUri, p.uri);\n });\n }\n if (segment.preloadHints && segment.preloadHints.length) {\n segment.preloadHints.forEach(p => {\n if (p.resolvedUri) {\n return;\n }\n p.resolvedUri = resolveUrl(baseUri, p.uri);\n });\n }\n};\nconst getAllSegments = function (media) {\n const segments = media.segments || [];\n const preloadSegment = media.preloadSegment; // a preloadSegment with only preloadHints is not currently\n // a usable segment, only include a preloadSegment that has\n // parts.\n\n if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) {\n // if preloadHints has a MAP that means that the\n // init segment is going to change. We cannot use any of the parts\n // from this preload segment.\n if (preloadSegment.preloadHints) {\n for (let i = 0; i < preloadSegment.preloadHints.length; i++) {\n if (preloadSegment.preloadHints[i].type === 'MAP') {\n return segments;\n }\n }\n } // set the duration for our preload segment to target duration.\n\n preloadSegment.duration = media.targetDuration;\n preloadSegment.preload = true;\n segments.push(preloadSegment);\n }\n return segments;\n}; // consider the playlist unchanged if the playlist object is the same or\n// the number of segments is equal, the media sequence number is unchanged,\n// and this playlist hasn't become the end of the playlist\n\nconst isPlaylistUnchanged = (a, b) => a === b || a.segments && b.segments && a.segments.length === b.segments.length && a.endList === b.endList && a.mediaSequence === b.mediaSequence && a.preloadSegment === b.preloadSegment;\n/**\n * Returns a new main playlist that is the result of merging an\n * updated media playlist into the original version. If the\n * updated media playlist does not match any of the playlist\n * entries in the original main playlist, null is returned.\n *\n * @param {Object} main a parsed main M3U8 object\n * @param {Object} media a parsed media M3U8 object\n * @return {Object} a new object that represents the original\n * main playlist with the updated media playlist merged in, or\n * null if the merge produced no change.\n */\n\nconst updateMain$1 = (main, newMedia, unchangedCheck = isPlaylistUnchanged) => {\n const result = merge(main, {});\n const oldMedia = result.playlists[newMedia.id];\n if (!oldMedia) {\n return null;\n }\n if (unchangedCheck(oldMedia, newMedia)) {\n return null;\n }\n newMedia.segments = getAllSegments(newMedia);\n const mergedPlaylist = merge(oldMedia, newMedia); // always use the new media's preload segment\n\n if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) {\n delete mergedPlaylist.preloadSegment;\n } // if the update could overlap existing segment information, merge the two segment lists\n\n if (oldMedia.segments) {\n if (newMedia.skip) {\n newMedia.segments = newMedia.segments || []; // add back in objects for skipped segments, so that we merge\n // old properties into the new segments\n\n for (let i = 0; i < newMedia.skip.skippedSegments; i++) {\n newMedia.segments.unshift({\n skipped: true\n });\n }\n }\n mergedPlaylist.segments = updateSegments(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence);\n } // resolve any segment URIs to prevent us from having to do it later\n\n mergedPlaylist.segments.forEach(segment => {\n resolveSegmentUris(segment, mergedPlaylist.resolvedUri);\n }); // TODO Right now in the playlists array there are two references to each playlist, one\n // that is referenced by index, and one by URI. The index reference may no longer be\n // necessary.\n\n for (let i = 0; i < result.playlists.length; i++) {\n if (result.playlists[i].id === newMedia.id) {\n result.playlists[i] = mergedPlaylist;\n }\n }\n result.playlists[newMedia.id] = mergedPlaylist; // URI reference added for backwards compatibility\n\n result.playlists[newMedia.uri] = mergedPlaylist; // update media group playlist references.\n\n forEachMediaGroup(main, (properties, mediaType, groupKey, labelKey) => {\n if (!properties.playlists) {\n return;\n }\n for (let i = 0; i < properties.playlists.length; i++) {\n if (newMedia.id === properties.playlists[i].id) {\n properties.playlists[i] = mergedPlaylist;\n }\n }\n });\n return result;\n};\n/**\n * Calculates the time to wait before refreshing a live playlist\n *\n * @param {Object} media\n * The current media\n * @param {boolean} update\n * True if there were any updates from the last refresh, false otherwise\n * @return {number}\n * The time in ms to wait before refreshing the live playlist\n */\n\nconst refreshDelay = (media, update) => {\n const segments = media.segments || [];\n const lastSegment = segments[segments.length - 1];\n const lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1];\n const lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration;\n if (update && lastDuration) {\n return lastDuration * 1000;\n } // if the playlist is unchanged since the last reload or last segment duration\n // cannot be determined, try again after half the target duration\n\n return (media.partTargetDuration || media.targetDuration || 10) * 500;\n};\n/**\n * Load a playlist from a remote location\n *\n * @class PlaylistLoader\n * @extends Stream\n * @param {string|Object} src url or object of manifest\n * @param {boolean} withCredentials the withCredentials xhr option\n * @class\n */\n\nclass PlaylistLoader extends EventTarget$1 {\n constructor(src, vhs, options = {}) {\n super();\n if (!src) {\n throw new Error('A non-empty playlist URL or object is required');\n }\n this.logger_ = logger('PlaylistLoader');\n const {\n withCredentials = false\n } = options;\n this.src = src;\n this.vhs_ = vhs;\n this.withCredentials = withCredentials;\n this.addDateRangesToTextTrack_ = options.addDateRangesToTextTrack;\n const vhsOptions = vhs.options_;\n this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || [];\n this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || [];\n this.llhls = vhsOptions && vhsOptions.llhls;\n this.dateRangesStorage_ = new DateRangesStorage(); // initialize the loader state\n\n this.state = 'HAVE_NOTHING'; // live playlist staleness timeout\n\n this.handleMediaupdatetimeout_ = this.handleMediaupdatetimeout_.bind(this);\n this.on('mediaupdatetimeout', this.handleMediaupdatetimeout_);\n this.on('loadedplaylist', this.handleLoadedPlaylist_.bind(this));\n }\n handleLoadedPlaylist_() {\n const mediaPlaylist = this.media();\n if (!mediaPlaylist) {\n return;\n }\n this.dateRangesStorage_.setOffset(mediaPlaylist.segments);\n this.dateRangesStorage_.setPendingDateRanges(mediaPlaylist.dateRanges);\n const availableDateRanges = this.dateRangesStorage_.getDateRangesToProcess();\n if (!availableDateRanges.length || !this.addDateRangesToTextTrack_) {\n return;\n }\n this.addDateRangesToTextTrack_(availableDateRanges);\n }\n handleMediaupdatetimeout_() {\n if (this.state !== 'HAVE_METADATA') {\n // only refresh the media playlist if no other activity is going on\n return;\n }\n const media = this.media();\n let uri = resolveUrl(this.main.uri, media.uri);\n if (this.llhls) {\n uri = addLLHLSQueryDirectives(uri, media);\n }\n this.state = 'HAVE_CURRENT_METADATA';\n this.request = this.vhs_.xhr({\n uri,\n withCredentials: this.withCredentials\n }, (error, req) => {\n // disposed\n if (!this.request) {\n return;\n }\n if (error) {\n return this.playlistRequestError(this.request, this.media(), 'HAVE_METADATA');\n }\n this.haveMetadata({\n playlistString: this.request.responseText,\n url: this.media().uri,\n id: this.media().id\n });\n });\n }\n playlistRequestError(xhr, playlist, startingState) {\n const {\n uri,\n id\n } = playlist; // any in-flight request is now finished\n\n this.request = null;\n if (startingState) {\n this.state = startingState;\n }\n this.error = {\n playlist: this.main.playlists[id],\n status: xhr.status,\n message: `HLS playlist request error at URL: ${uri}.`,\n responseText: xhr.responseText,\n code: xhr.status >= 500 ? 4 : 2\n };\n this.trigger('error');\n }\n parseManifest_({\n url,\n manifestString\n }) {\n return parseManifest({\n onwarn: ({\n message\n }) => this.logger_(`m3u8-parser warn for ${url}: ${message}`),\n oninfo: ({\n message\n }) => this.logger_(`m3u8-parser info for ${url}: ${message}`),\n manifestString,\n customTagParsers: this.customTagParsers,\n customTagMappers: this.customTagMappers,\n llhls: this.llhls\n });\n }\n /**\n * Update the playlist loader's state in response to a new or updated playlist.\n *\n * @param {string} [playlistString]\n * Playlist string (if playlistObject is not provided)\n * @param {Object} [playlistObject]\n * Playlist object (if playlistString is not provided)\n * @param {string} url\n * URL of playlist\n * @param {string} id\n * ID to use for playlist\n */\n\n haveMetadata({\n playlistString,\n playlistObject,\n url,\n id\n }) {\n // any in-flight request is now finished\n this.request = null;\n this.state = 'HAVE_METADATA';\n const playlist = playlistObject || this.parseManifest_({\n url,\n manifestString: playlistString\n });\n playlist.lastRequest = Date.now();\n setupMediaPlaylist({\n playlist,\n uri: url,\n id\n }); // merge this playlist into the main manifest\n\n const update = updateMain$1(this.main, playlist);\n this.targetDuration = playlist.partTargetDuration || playlist.targetDuration;\n this.pendingMedia_ = null;\n if (update) {\n this.main = update;\n this.media_ = this.main.playlists[id];\n } else {\n this.trigger('playlistunchanged');\n }\n this.updateMediaUpdateTimeout_(refreshDelay(this.media(), !!update));\n this.trigger('loadedplaylist');\n }\n /**\n * Abort any outstanding work and clean up.\n */\n\n dispose() {\n this.trigger('dispose');\n this.stopRequest();\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.finalRenditionTimeout);\n this.dateRangesStorage_ = new DateRangesStorage();\n this.off();\n }\n stopRequest() {\n if (this.request) {\n const oldRequest = this.request;\n this.request = null;\n oldRequest.onreadystatechange = null;\n oldRequest.abort();\n }\n }\n /**\n * When called without any arguments, returns the currently\n * active media playlist. When called with a single argument,\n * triggers the playlist loader to asynchronously switch to the\n * specified media playlist. Calling this method while the\n * loader is in the HAVE_NOTHING causes an error to be emitted\n * but otherwise has no effect.\n *\n * @param {Object=} playlist the parsed media playlist\n * object to switch to\n * @param {boolean=} shouldDelay whether we should delay the request by half target duration\n *\n * @return {Playlist} the current loaded media\n */\n\n media(playlist, shouldDelay) {\n // getter\n if (!playlist) {\n return this.media_;\n } // setter\n\n if (this.state === 'HAVE_NOTHING') {\n throw new Error('Cannot switch media playlist from ' + this.state);\n } // find the playlist object if the target playlist has been\n // specified by URI\n\n if (typeof playlist === 'string') {\n if (!this.main.playlists[playlist]) {\n throw new Error('Unknown playlist URI: ' + playlist);\n }\n playlist = this.main.playlists[playlist];\n }\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.finalRenditionTimeout);\n if (shouldDelay) {\n const delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1000 || 5 * 1000;\n this.finalRenditionTimeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(this.media.bind(this, playlist, false), delay);\n return;\n }\n const startingState = this.state;\n const mediaChange = !this.media_ || playlist.id !== this.media_.id;\n const mainPlaylistRef = this.main.playlists[playlist.id]; // switch to fully loaded playlists immediately\n\n if (mainPlaylistRef && mainPlaylistRef.endList ||\n // handle the case of a playlist object (e.g., if using vhs-json with a resolved\n // media playlist or, for the case of demuxed audio, a resolved audio media group)\n playlist.endList && playlist.segments.length) {\n // abort outstanding playlist requests\n if (this.request) {\n this.request.onreadystatechange = null;\n this.request.abort();\n this.request = null;\n }\n this.state = 'HAVE_METADATA';\n this.media_ = playlist; // trigger media change if the active media has been updated\n\n if (mediaChange) {\n this.trigger('mediachanging');\n if (startingState === 'HAVE_MAIN_MANIFEST') {\n // The initial playlist was a main manifest, and the first media selected was\n // also provided (in the form of a resolved playlist object) as part of the\n // source object (rather than just a URL). Therefore, since the media playlist\n // doesn't need to be requested, loadedmetadata won't trigger as part of the\n // normal flow, and needs an explicit trigger here.\n this.trigger('loadedmetadata');\n } else {\n this.trigger('mediachange');\n }\n }\n return;\n } // We update/set the timeout here so that live playlists\n // that are not a media change will \"start\" the loader as expected.\n // We expect that this function will start the media update timeout\n // cycle again. This also prevents a playlist switch failure from\n // causing us to stall during live.\n\n this.updateMediaUpdateTimeout_(refreshDelay(playlist, true)); // switching to the active playlist is a no-op\n\n if (!mediaChange) {\n return;\n }\n this.state = 'SWITCHING_MEDIA'; // there is already an outstanding playlist request\n\n if (this.request) {\n if (playlist.resolvedUri === this.request.url) {\n // requesting to switch to the same playlist multiple times\n // has no effect after the first\n return;\n }\n this.request.onreadystatechange = null;\n this.request.abort();\n this.request = null;\n } // request the new playlist\n\n if (this.media_) {\n this.trigger('mediachanging');\n }\n this.pendingMedia_ = playlist;\n this.request = this.vhs_.xhr({\n uri: playlist.resolvedUri,\n withCredentials: this.withCredentials\n }, (error, req) => {\n // disposed\n if (!this.request) {\n return;\n }\n playlist.lastRequest = Date.now();\n playlist.resolvedUri = resolveManifestRedirect(playlist.resolvedUri, req);\n if (error) {\n return this.playlistRequestError(this.request, playlist, startingState);\n }\n this.haveMetadata({\n playlistString: req.responseText,\n url: playlist.uri,\n id: playlist.id\n }); // fire loadedmetadata the first time a media playlist is loaded\n\n if (startingState === 'HAVE_MAIN_MANIFEST') {\n this.trigger('loadedmetadata');\n } else {\n this.trigger('mediachange');\n }\n });\n }\n /**\n * pause loading of the playlist\n */\n\n pause() {\n if (this.mediaUpdateTimeout) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n }\n this.stopRequest();\n if (this.state === 'HAVE_NOTHING') {\n // If we pause the loader before any data has been retrieved, its as if we never\n // started, so reset to an unstarted state.\n this.started = false;\n } // Need to restore state now that no activity is happening\n\n if (this.state === 'SWITCHING_MEDIA') {\n // if the loader was in the process of switching media, it should either return to\n // HAVE_MAIN_MANIFEST or HAVE_METADATA depending on if the loader has loaded a media\n // playlist yet. This is determined by the existence of loader.media_\n if (this.media_) {\n this.state = 'HAVE_METADATA';\n } else {\n this.state = 'HAVE_MAIN_MANIFEST';\n }\n } else if (this.state === 'HAVE_CURRENT_METADATA') {\n this.state = 'HAVE_METADATA';\n }\n }\n /**\n * start loading of the playlist\n */\n\n load(shouldDelay) {\n if (this.mediaUpdateTimeout) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n }\n const media = this.media();\n if (shouldDelay) {\n const delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1000 : 5 * 1000;\n this.mediaUpdateTimeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => {\n this.mediaUpdateTimeout = null;\n this.load();\n }, delay);\n return;\n }\n if (!this.started) {\n this.start();\n return;\n }\n if (media && !media.endList) {\n this.trigger('mediaupdatetimeout');\n } else {\n this.trigger('loadedplaylist');\n }\n }\n updateMediaUpdateTimeout_(delay) {\n if (this.mediaUpdateTimeout) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n } // we only have use mediaupdatetimeout for live playlists.\n\n if (!this.media() || this.media().endList) {\n return;\n }\n this.mediaUpdateTimeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => {\n this.mediaUpdateTimeout = null;\n this.trigger('mediaupdatetimeout');\n this.updateMediaUpdateTimeout_(delay);\n }, delay);\n }\n /**\n * start loading of the playlist\n */\n\n start() {\n this.started = true;\n if (typeof this.src === 'object') {\n // in the case of an entirely constructed manifest object (meaning there's no actual\n // manifest on a server), default the uri to the page's href\n if (!this.src.uri) {\n this.src.uri = (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).href;\n } // resolvedUri is added on internally after the initial request. Since there's no\n // request for pre-resolved manifests, add on resolvedUri here.\n\n this.src.resolvedUri = this.src.uri; // Since a manifest object was passed in as the source (instead of a URL), the first\n // request can be skipped (since the top level of the manifest, at a minimum, is\n // already available as a parsed manifest object). However, if the manifest object\n // represents a main playlist, some media playlists may need to be resolved before\n // the starting segment list is available. Therefore, go directly to setup of the\n // initial playlist, and let the normal flow continue from there.\n //\n // Note that the call to setup is asynchronous, as other sections of VHS may assume\n // that the first request is asynchronous.\n\n setTimeout(() => {\n this.setupInitialPlaylist(this.src);\n }, 0);\n return;\n } // request the specified URL\n\n this.request = this.vhs_.xhr({\n uri: this.src,\n withCredentials: this.withCredentials\n }, (error, req) => {\n // disposed\n if (!this.request) {\n return;\n } // clear the loader's request reference\n\n this.request = null;\n if (error) {\n this.error = {\n status: req.status,\n message: `HLS playlist request error at URL: ${this.src}.`,\n responseText: req.responseText,\n // MEDIA_ERR_NETWORK\n code: 2\n };\n if (this.state === 'HAVE_NOTHING') {\n this.started = false;\n }\n return this.trigger('error');\n }\n this.src = resolveManifestRedirect(this.src, req);\n const manifest = this.parseManifest_({\n manifestString: req.responseText,\n url: this.src\n });\n this.setupInitialPlaylist(manifest);\n });\n }\n srcUri() {\n return typeof this.src === 'string' ? this.src : this.src.uri;\n }\n /**\n * Given a manifest object that's either a main or media playlist, trigger the proper\n * events and set the state of the playlist loader.\n *\n * If the manifest object represents a main playlist, `loadedplaylist` will be\n * triggered to allow listeners to select a playlist. If none is selected, the loader\n * will default to the first one in the playlists array.\n *\n * If the manifest object represents a media playlist, `loadedplaylist` will be\n * triggered followed by `loadedmetadata`, as the only available playlist is loaded.\n *\n * In the case of a media playlist, a main playlist object wrapper with one playlist\n * will be created so that all logic can handle playlists in the same fashion (as an\n * assumed manifest object schema).\n *\n * @param {Object} manifest\n * The parsed manifest object\n */\n\n setupInitialPlaylist(manifest) {\n this.state = 'HAVE_MAIN_MANIFEST';\n if (manifest.playlists) {\n this.main = manifest;\n addPropertiesToMain(this.main, this.srcUri()); // If the initial main playlist has playlists wtih segments already resolved,\n // then resolve URIs in advance, as they are usually done after a playlist request,\n // which may not happen if the playlist is resolved.\n\n manifest.playlists.forEach(playlist => {\n playlist.segments = getAllSegments(playlist);\n playlist.segments.forEach(segment => {\n resolveSegmentUris(segment, playlist.resolvedUri);\n });\n });\n this.trigger('loadedplaylist');\n if (!this.request) {\n // no media playlist was specifically selected so start\n // from the first listed one\n this.media(this.main.playlists[0]);\n }\n return;\n } // In order to support media playlists passed in as vhs-json, the case where the uri\n // is not provided as part of the manifest should be considered, and an appropriate\n // default used.\n\n const uri = this.srcUri() || (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).href;\n this.main = mainForMedia(manifest, uri);\n this.haveMetadata({\n playlistObject: manifest,\n url: uri,\n id: this.main.playlists[0].id\n });\n this.trigger('loadedmetadata');\n }\n /**\n * Updates or deletes a preexisting pathway clone.\n * Ensures that all playlists related to the old pathway clone are\n * either updated or deleted.\n *\n * @param {Object} clone On update, the pathway clone object for the newly updated pathway clone.\n * On delete, the old pathway clone object to be deleted.\n * @param {boolean} isUpdate True if the pathway is to be updated,\n * false if it is meant to be deleted.\n */\n\n updateOrDeleteClone(clone, isUpdate) {\n const main = this.main;\n const pathway = clone.ID;\n let i = main.playlists.length; // Iterate backwards through the playlist so we can remove playlists if necessary.\n\n while (i--) {\n const p = main.playlists[i];\n if (p.attributes['PATHWAY-ID'] === pathway) {\n const oldPlaylistUri = p.resolvedUri;\n const oldPlaylistId = p.id; // update the indexed playlist and add new playlists by ID and URI\n\n if (isUpdate) {\n const newPlaylistUri = this.createCloneURI_(p.resolvedUri, clone);\n const newPlaylistId = createPlaylistID(pathway, newPlaylistUri);\n const attributes = this.createCloneAttributes_(pathway, p.attributes);\n const updatedPlaylist = this.createClonePlaylist_(p, newPlaylistId, clone, attributes);\n main.playlists[i] = updatedPlaylist;\n main.playlists[newPlaylistId] = updatedPlaylist;\n main.playlists[newPlaylistUri] = updatedPlaylist;\n } else {\n // Remove the indexed playlist.\n main.playlists.splice(i, 1);\n } // Remove playlists by the old ID and URI.\n\n delete main.playlists[oldPlaylistId];\n delete main.playlists[oldPlaylistUri];\n }\n }\n this.updateOrDeleteCloneMedia(clone, isUpdate);\n }\n /**\n * Updates or deletes media data based on the pathway clone object.\n * Due to the complexity of the media groups and playlists, in all cases\n * we remove all of the old media groups and playlists.\n * On updates, we then create new media groups and playlists based on the\n * new pathway clone object.\n *\n * @param {Object} clone The pathway clone object for the newly updated pathway clone.\n * @param {boolean} isUpdate True if the pathway is to be updated,\n * false if it is meant to be deleted.\n */\n\n updateOrDeleteCloneMedia(clone, isUpdate) {\n const main = this.main;\n const id = clone.ID;\n ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(mediaType => {\n if (!main.mediaGroups[mediaType] || !main.mediaGroups[mediaType][id]) {\n return;\n }\n for (const groupKey in main.mediaGroups[mediaType]) {\n // Remove all media playlists for the media group for this pathway clone.\n if (groupKey === id) {\n for (const labelKey in main.mediaGroups[mediaType][groupKey]) {\n const oldMedia = main.mediaGroups[mediaType][groupKey][labelKey];\n oldMedia.playlists.forEach((p, i) => {\n const oldMediaPlaylist = main.playlists[p.id];\n const oldPlaylistId = oldMediaPlaylist.id;\n const oldPlaylistUri = oldMediaPlaylist.resolvedUri;\n delete main.playlists[oldPlaylistId];\n delete main.playlists[oldPlaylistUri];\n });\n } // Delete the old media group.\n\n delete main.mediaGroups[mediaType][groupKey];\n }\n }\n }); // Create the new media groups and playlists if there is an update.\n\n if (isUpdate) {\n this.createClonedMediaGroups_(clone);\n }\n }\n /**\n * Given a pathway clone object, clones all necessary playlists.\n *\n * @param {Object} clone The pathway clone object.\n * @param {Object} basePlaylist The original playlist to clone from.\n */\n\n addClonePathway(clone, basePlaylist = {}) {\n const main = this.main;\n const index = main.playlists.length;\n const uri = this.createCloneURI_(basePlaylist.resolvedUri, clone);\n const playlistId = createPlaylistID(clone.ID, uri);\n const attributes = this.createCloneAttributes_(clone.ID, basePlaylist.attributes);\n const playlist = this.createClonePlaylist_(basePlaylist, playlistId, clone, attributes);\n main.playlists[index] = playlist; // add playlist by ID and URI\n\n main.playlists[playlistId] = playlist;\n main.playlists[uri] = playlist;\n this.createClonedMediaGroups_(clone);\n }\n /**\n * Given a pathway clone object we create clones of all media.\n * In this function, all necessary information and updated playlists\n * are added to the `mediaGroup` object.\n * Playlists are also added to the `playlists` array so the media groups\n * will be properly linked.\n *\n * @param {Object} clone The pathway clone object.\n */\n\n createClonedMediaGroups_(clone) {\n const id = clone.ID;\n const baseID = clone['BASE-ID'];\n const main = this.main;\n ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(mediaType => {\n // If the media type doesn't exist, or there is already a clone, skip\n // to the next media type.\n if (!main.mediaGroups[mediaType] || main.mediaGroups[mediaType][id]) {\n return;\n }\n for (const groupKey in main.mediaGroups[mediaType]) {\n if (groupKey === baseID) {\n // Create the group.\n main.mediaGroups[mediaType][id] = {};\n } else {\n // There is no need to iterate over label keys in this case.\n continue;\n }\n for (const labelKey in main.mediaGroups[mediaType][groupKey]) {\n const oldMedia = main.mediaGroups[mediaType][groupKey][labelKey];\n main.mediaGroups[mediaType][id][labelKey] = (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_6__[\"default\"])({}, oldMedia);\n const newMedia = main.mediaGroups[mediaType][id][labelKey]; // update URIs on the media\n\n const newUri = this.createCloneURI_(oldMedia.resolvedUri, clone);\n newMedia.resolvedUri = newUri;\n newMedia.uri = newUri; // Reset playlists in the new media group.\n\n newMedia.playlists = []; // Create new playlists in the newly cloned media group.\n\n oldMedia.playlists.forEach((p, i) => {\n const oldMediaPlaylist = main.playlists[p.id];\n const group = groupID(mediaType, id, labelKey);\n const newPlaylistID = createPlaylistID(id, group); // Check to see if it already exists\n\n if (oldMediaPlaylist && !main.playlists[newPlaylistID]) {\n const newMediaPlaylist = this.createClonePlaylist_(oldMediaPlaylist, newPlaylistID, clone);\n const newPlaylistUri = newMediaPlaylist.resolvedUri;\n main.playlists[newPlaylistID] = newMediaPlaylist;\n main.playlists[newPlaylistUri] = newMediaPlaylist;\n }\n newMedia.playlists[i] = this.createClonePlaylist_(p, newPlaylistID, clone);\n });\n }\n }\n });\n }\n /**\n * Using the original playlist to be cloned, and the pathway clone object\n * information, we create a new playlist.\n *\n * @param {Object} basePlaylist The original playlist to be cloned from.\n * @param {string} id The desired id of the newly cloned playlist.\n * @param {Object} clone The pathway clone object.\n * @param {Object} attributes An optional object to populate the `attributes` property in the playlist.\n *\n * @return {Object} The combined cloned playlist.\n */\n\n createClonePlaylist_(basePlaylist, id, clone, attributes) {\n const uri = this.createCloneURI_(basePlaylist.resolvedUri, clone);\n const newProps = {\n resolvedUri: uri,\n uri,\n id\n }; // Remove all segments from previous playlist in the clone.\n\n if (basePlaylist.segments) {\n newProps.segments = [];\n }\n if (attributes) {\n newProps.attributes = attributes;\n }\n return merge(basePlaylist, newProps);\n }\n /**\n * Generates an updated URI for a cloned pathway based on the original\n * pathway's URI and the paramaters from the pathway clone object in the\n * content steering server response.\n *\n * @param {string} baseUri URI to be updated in the cloned pathway.\n * @param {Object} clone The pathway clone object.\n *\n * @return {string} The updated URI for the cloned pathway.\n */\n\n createCloneURI_(baseURI, clone) {\n const uri = new URL(baseURI);\n uri.hostname = clone['URI-REPLACEMENT'].HOST;\n const params = clone['URI-REPLACEMENT'].PARAMS; // Add params to the cloned URL.\n\n for (const key of Object.keys(params)) {\n uri.searchParams.set(key, params[key]);\n }\n return uri.href;\n }\n /**\n * Helper function to create the attributes needed for the new clone.\n * This mainly adds the necessary media attributes.\n *\n * @param {string} id The pathway clone object ID.\n * @param {Object} oldAttributes The old attributes to compare to.\n * @return {Object} The new attributes to add to the playlist.\n */\n\n createCloneAttributes_(id, oldAttributes) {\n const attributes = {\n ['PATHWAY-ID']: id\n };\n ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(mediaType => {\n if (oldAttributes[mediaType]) {\n attributes[mediaType] = id;\n }\n });\n return attributes;\n }\n /**\n * Returns the key ID set from a playlist\n *\n * @param {playlist} playlist to fetch the key ID set from.\n * @return a Set of 32 digit hex strings that represent the unique keyIds for that playlist.\n */\n\n getKeyIdSet(playlist) {\n if (playlist.contentProtection) {\n const keyIds = new Set();\n for (const keysystem in playlist.contentProtection) {\n const keyId = playlist.contentProtection[keysystem].attributes.keyId;\n if (keyId) {\n keyIds.add(keyId.toLowerCase());\n }\n }\n return keyIds;\n }\n }\n}\n\n/**\n * @file xhr.js\n */\nconst {\n xhr: videojsXHR\n} = videojs;\nconst callbackWrapper = function (request, error, response, callback) {\n const reqResponse = request.responseType === 'arraybuffer' ? request.response : request.responseText;\n if (!error && reqResponse) {\n request.responseTime = Date.now();\n request.roundTripTime = request.responseTime - request.requestTime;\n request.bytesReceived = reqResponse.byteLength || reqResponse.length;\n if (!request.bandwidth) {\n request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1000);\n }\n }\n if (response.headers) {\n request.responseHeaders = response.headers;\n } // videojs.xhr now uses a specific code on the error\n // object to signal that a request has timed out instead\n // of setting a boolean on the request object\n\n if (error && error.code === 'ETIMEDOUT') {\n request.timedout = true;\n } // videojs.xhr no longer considers status codes outside of 200 and 0\n // (for file uris) to be errors, but the old XHR did, so emulate that\n // behavior. Status 206 may be used in response to byterange requests.\n\n if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) {\n error = new Error('XHR Failed with a response of: ' + (request && (reqResponse || request.responseText)));\n }\n callback(error, request);\n};\n/**\n * Iterates over the request hooks Set and calls them in order\n *\n * @param {Set} hooks the hook Set to iterate over\n * @param {Object} options the request options to pass to the xhr wrapper\n * @return the callback hook function return value, the modified or new options Object.\n */\n\nconst callAllRequestHooks = (requestSet, options) => {\n if (!requestSet || !requestSet.size) {\n return;\n }\n let newOptions = options;\n requestSet.forEach(requestCallback => {\n newOptions = requestCallback(newOptions);\n });\n return newOptions;\n};\n/**\n * Iterates over the response hooks Set and calls them in order.\n *\n * @param {Set} hooks the hook Set to iterate over\n * @param {Object} request the xhr request object\n * @param {Object} error the xhr error object\n * @param {Object} response the xhr response object\n */\n\nconst callAllResponseHooks = (responseSet, request, error, response) => {\n if (!responseSet || !responseSet.size) {\n return;\n }\n responseSet.forEach(responseCallback => {\n responseCallback(request, error, response);\n });\n};\nconst xhrFactory = function () {\n const xhr = function XhrFunction(options, callback) {\n // Add a default timeout\n options = merge({\n timeout: 45e3\n }, options); // Allow an optional user-specified function to modify the option\n // object before we construct the xhr request\n // TODO: Remove beforeRequest in the next major release.\n\n const beforeRequest = XhrFunction.beforeRequest || videojs.Vhs.xhr.beforeRequest; // onRequest and onResponse hooks as a Set, at either the player or global level.\n // TODO: new Set added here for beforeRequest alias. Remove this when beforeRequest is removed.\n\n const _requestCallbackSet = XhrFunction._requestCallbackSet || videojs.Vhs.xhr._requestCallbackSet || new Set();\n const _responseCallbackSet = XhrFunction._responseCallbackSet || videojs.Vhs.xhr._responseCallbackSet;\n if (beforeRequest && typeof beforeRequest === 'function') {\n videojs.log.warn('beforeRequest is deprecated, use onRequest instead.');\n _requestCallbackSet.add(beforeRequest);\n } // Use the standard videojs.xhr() method unless `videojs.Vhs.xhr` has been overriden\n // TODO: switch back to videojs.Vhs.xhr.name === 'XhrFunction' when we drop IE11\n\n const xhrMethod = videojs.Vhs.xhr.original === true ? videojsXHR : videojs.Vhs.xhr; // call all registered onRequest hooks, assign new options.\n\n const beforeRequestOptions = callAllRequestHooks(_requestCallbackSet, options); // Remove the beforeRequest function from the hooks set so stale beforeRequest functions are not called.\n\n _requestCallbackSet.delete(beforeRequest); // xhrMethod will call XMLHttpRequest.open and XMLHttpRequest.send\n\n const request = xhrMethod(beforeRequestOptions || options, function (error, response) {\n // call all registered onResponse hooks\n callAllResponseHooks(_responseCallbackSet, request, error, response);\n return callbackWrapper(request, error, response, callback);\n });\n const originalAbort = request.abort;\n request.abort = function () {\n request.aborted = true;\n return originalAbort.apply(request, arguments);\n };\n request.uri = options.uri;\n request.requestTime = Date.now();\n return request;\n };\n xhr.original = true;\n return xhr;\n};\n/**\n * Turns segment byterange into a string suitable for use in\n * HTTP Range requests\n *\n * @param {Object} byterange - an object with two values defining the start and end\n * of a byte-range\n */\n\nconst byterangeStr = function (byterange) {\n // `byterangeEnd` is one less than `offset + length` because the HTTP range\n // header uses inclusive ranges\n let byterangeEnd;\n const byterangeStart = byterange.offset;\n if (typeof byterange.offset === 'bigint' || typeof byterange.length === 'bigint') {\n byterangeEnd = global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt(byterange.offset) + global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt(byterange.length) - global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt(1);\n } else {\n byterangeEnd = byterange.offset + byterange.length - 1;\n }\n return 'bytes=' + byterangeStart + '-' + byterangeEnd;\n};\n/**\n * Defines headers for use in the xhr request for a particular segment.\n *\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n */\n\nconst segmentXhrHeaders = function (segment) {\n const headers = {};\n if (segment.byterange) {\n headers.Range = byterangeStr(segment.byterange);\n }\n return headers;\n};\n\n/**\n * @file bin-utils.js\n */\n\n/**\n * convert a TimeRange to text\n *\n * @param {TimeRange} range the timerange to use for conversion\n * @param {number} i the iterator on the range to convert\n * @return {string} the range in string format\n */\n\nconst textRange = function (range, i) {\n return range.start(i) + '-' + range.end(i);\n};\n/**\n * format a number as hex string\n *\n * @param {number} e The number\n * @param {number} i the iterator\n * @return {string} the hex formatted number as a string\n */\n\nconst formatHexString = function (e, i) {\n const value = e.toString(16);\n return '00'.substring(0, 2 - value.length) + value + (i % 2 ? ' ' : '');\n};\nconst formatAsciiString = function (e) {\n if (e >= 0x20 && e < 0x7e) {\n return String.fromCharCode(e);\n }\n return '.';\n};\n/**\n * Creates an object for sending to a web worker modifying properties that are TypedArrays\n * into a new object with seperated properties for the buffer, byteOffset, and byteLength.\n *\n * @param {Object} message\n * Object of properties and values to send to the web worker\n * @return {Object}\n * Modified message with TypedArray values expanded\n * @function createTransferableMessage\n */\n\nconst createTransferableMessage = function (message) {\n const transferable = {};\n Object.keys(message).forEach(key => {\n const value = message[key];\n if ((0,_videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_11__.isArrayBufferView)(value)) {\n transferable[key] = {\n bytes: value.buffer,\n byteOffset: value.byteOffset,\n byteLength: value.byteLength\n };\n } else {\n transferable[key] = value;\n }\n });\n return transferable;\n};\n/**\n * Returns a unique string identifier for a media initialization\n * segment.\n *\n * @param {Object} initSegment\n * the init segment object.\n *\n * @return {string} the generated init segment id\n */\n\nconst initSegmentId = function (initSegment) {\n const byterange = initSegment.byterange || {\n length: Infinity,\n offset: 0\n };\n return [byterange.length, byterange.offset, initSegment.resolvedUri].join(',');\n};\n/**\n * Returns a unique string identifier for a media segment key.\n *\n * @param {Object} key the encryption key\n * @return {string} the unique id for the media segment key.\n */\n\nconst segmentKeyId = function (key) {\n return key.resolvedUri;\n};\n/**\n * utils to help dump binary data to the console\n *\n * @param {Array|TypedArray} data\n * data to dump to a string\n *\n * @return {string} the data as a hex string.\n */\n\nconst hexDump = data => {\n const bytes = Array.prototype.slice.call(data);\n const step = 16;\n let result = '';\n let hex;\n let ascii;\n for (let j = 0; j < bytes.length / step; j++) {\n hex = bytes.slice(j * step, j * step + step).map(formatHexString).join('');\n ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join('');\n result += hex + ' ' + ascii + '\\n';\n }\n return result;\n};\nconst tagDump = ({\n bytes\n}) => hexDump(bytes);\nconst textRanges = ranges => {\n let result = '';\n let i;\n for (i = 0; i < ranges.length; i++) {\n result += textRange(ranges, i) + ' ';\n }\n return result;\n};\nvar utils = /*#__PURE__*/Object.freeze({\n __proto__: null,\n createTransferableMessage: createTransferableMessage,\n initSegmentId: initSegmentId,\n segmentKeyId: segmentKeyId,\n hexDump: hexDump,\n tagDump: tagDump,\n textRanges: textRanges\n});\n\n// TODO handle fmp4 case where the timing info is accurate and doesn't involve transmux\n// 25% was arbitrarily chosen, and may need to be refined over time.\n\nconst SEGMENT_END_FUDGE_PERCENT = 0.25;\n/**\n * Converts a player time (any time that can be gotten/set from player.currentTime(),\n * e.g., any time within player.seekable().start(0) to player.seekable().end(0)) to a\n * program time (any time referencing the real world (e.g., EXT-X-PROGRAM-DATE-TIME)).\n *\n * The containing segment is required as the EXT-X-PROGRAM-DATE-TIME serves as an \"anchor\n * point\" (a point where we have a mapping from program time to player time, with player\n * time being the post transmux start of the segment).\n *\n * For more details, see [this doc](../../docs/program-time-from-player-time.md).\n *\n * @param {number} playerTime the player time\n * @param {Object} segment the segment which contains the player time\n * @return {Date} program time\n */\n\nconst playerTimeToProgramTime = (playerTime, segment) => {\n if (!segment.dateTimeObject) {\n // Can't convert without an \"anchor point\" for the program time (i.e., a time that can\n // be used to map the start of a segment with a real world time).\n return null;\n }\n const transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds;\n const transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart; // get the start of the content from before old content is prepended\n\n const startOfSegment = transmuxedStart + transmuxerPrependedSeconds;\n const offsetFromSegmentStart = playerTime - startOfSegment;\n return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1000);\n};\nconst originalSegmentVideoDuration = videoTimingInfo => {\n return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds;\n};\n/**\n * Finds a segment that contains the time requested given as an ISO-8601 string. The\n * returned segment might be an estimate or an accurate match.\n *\n * @param {string} programTime The ISO-8601 programTime to find a match for\n * @param {Object} playlist A playlist object to search within\n */\n\nconst findSegmentForProgramTime = (programTime, playlist) => {\n // Assumptions:\n // - verifyProgramDateTimeTags has already been run\n // - live streams have been started\n let dateTimeObject;\n try {\n dateTimeObject = new Date(programTime);\n } catch (e) {\n return null;\n }\n if (!playlist || !playlist.segments || playlist.segments.length === 0) {\n return null;\n }\n let segment = playlist.segments[0];\n if (dateTimeObject < new Date(segment.dateTimeObject)) {\n // Requested time is before stream start.\n return null;\n }\n for (let i = 0; i < playlist.segments.length - 1; i++) {\n segment = playlist.segments[i];\n const nextSegmentStart = new Date(playlist.segments[i + 1].dateTimeObject);\n if (dateTimeObject < nextSegmentStart) {\n break;\n }\n }\n const lastSegment = playlist.segments[playlist.segments.length - 1];\n const lastSegmentStart = lastSegment.dateTimeObject;\n const lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT;\n const lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1000);\n if (dateTimeObject > lastSegmentEnd) {\n // Beyond the end of the stream, or our best guess of the end of the stream.\n return null;\n }\n if (dateTimeObject > new Date(lastSegmentStart)) {\n segment = lastSegment;\n }\n return {\n segment,\n estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)),\n // Although, given that all segments have accurate date time objects, the segment\n // selected should be accurate, unless the video has been transmuxed at some point\n // (determined by the presence of the videoTimingInfo object), the segment's \"player\n // time\" (the start time in the player) can't be considered accurate.\n type: segment.videoTimingInfo ? 'accurate' : 'estimate'\n };\n};\n/**\n * Finds a segment that contains the given player time(in seconds).\n *\n * @param {number} time The player time to find a match for\n * @param {Object} playlist A playlist object to search within\n */\n\nconst findSegmentForPlayerTime = (time, playlist) => {\n // Assumptions:\n // - there will always be a segment.duration\n // - we can start from zero\n // - segments are in time order\n if (!playlist || !playlist.segments || playlist.segments.length === 0) {\n return null;\n }\n let segmentEnd = 0;\n let segment;\n for (let i = 0; i < playlist.segments.length; i++) {\n segment = playlist.segments[i]; // videoTimingInfo is set after the segment is downloaded and transmuxed, and\n // should contain the most accurate values we have for the segment's player times.\n //\n // Use the accurate transmuxedPresentationEnd value if it is available, otherwise fall\n // back to an estimate based on the manifest derived (inaccurate) segment.duration, to\n // calculate an end value.\n\n segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration;\n if (time <= segmentEnd) {\n break;\n }\n }\n const lastSegment = playlist.segments[playlist.segments.length - 1];\n if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) {\n // The time requested is beyond the stream end.\n return null;\n }\n if (time > segmentEnd) {\n // The time is within or beyond the last segment.\n //\n // Check to see if the time is beyond a reasonable guess of the end of the stream.\n if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT) {\n // Technically, because the duration value is only an estimate, the time may still\n // exist in the last segment, however, there isn't enough information to make even\n // a reasonable estimate.\n return null;\n }\n segment = lastSegment;\n }\n return {\n segment,\n estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration,\n // Because videoTimingInfo is only set after transmux, it is the only way to get\n // accurate timing values.\n type: segment.videoTimingInfo ? 'accurate' : 'estimate'\n };\n};\n/**\n * Gives the offset of the comparisonTimestamp from the programTime timestamp in seconds.\n * If the offset returned is positive, the programTime occurs after the\n * comparisonTimestamp.\n * If the offset is negative, the programTime occurs before the comparisonTimestamp.\n *\n * @param {string} comparisonTimeStamp An ISO-8601 timestamp to compare against\n * @param {string} programTime The programTime as an ISO-8601 string\n * @return {number} offset\n */\n\nconst getOffsetFromTimestamp = (comparisonTimeStamp, programTime) => {\n let segmentDateTime;\n let programDateTime;\n try {\n segmentDateTime = new Date(comparisonTimeStamp);\n programDateTime = new Date(programTime);\n } catch (e) {// TODO handle error\n }\n const segmentTimeEpoch = segmentDateTime.getTime();\n const programTimeEpoch = programDateTime.getTime();\n return (programTimeEpoch - segmentTimeEpoch) / 1000;\n};\n/**\n * Checks that all segments in this playlist have programDateTime tags.\n *\n * @param {Object} playlist A playlist object\n */\n\nconst verifyProgramDateTimeTags = playlist => {\n if (!playlist.segments || playlist.segments.length === 0) {\n return false;\n }\n for (let i = 0; i < playlist.segments.length; i++) {\n const segment = playlist.segments[i];\n if (!segment.dateTimeObject) {\n return false;\n }\n }\n return true;\n};\n/**\n * Returns the programTime of the media given a playlist and a playerTime.\n * The playlist must have programDateTime tags for a programDateTime tag to be returned.\n * If the segments containing the time requested have not been buffered yet, an estimate\n * may be returned to the callback.\n *\n * @param {Object} args\n * @param {Object} args.playlist A playlist object to search within\n * @param {number} time A playerTime in seconds\n * @param {Function} callback(err, programTime)\n * @return {string} err.message A detailed error message\n * @return {Object} programTime\n * @return {number} programTime.mediaSeconds The streamTime in seconds\n * @return {string} programTime.programDateTime The programTime as an ISO-8601 String\n */\n\nconst getProgramTime = ({\n playlist,\n time = undefined,\n callback\n}) => {\n if (!callback) {\n throw new Error('getProgramTime: callback must be provided');\n }\n if (!playlist || time === undefined) {\n return callback({\n message: 'getProgramTime: playlist and time must be provided'\n });\n }\n const matchedSegment = findSegmentForPlayerTime(time, playlist);\n if (!matchedSegment) {\n return callback({\n message: 'valid programTime was not found'\n });\n }\n if (matchedSegment.type === 'estimate') {\n return callback({\n message: 'Accurate programTime could not be determined.' + ' Please seek to e.seekTime and try again',\n seekTime: matchedSegment.estimatedStart\n });\n }\n const programTimeObject = {\n mediaSeconds: time\n };\n const programTime = playerTimeToProgramTime(time, matchedSegment.segment);\n if (programTime) {\n programTimeObject.programDateTime = programTime.toISOString();\n }\n return callback(null, programTimeObject);\n};\n/**\n * Seeks in the player to a time that matches the given programTime ISO-8601 string.\n *\n * @param {Object} args\n * @param {string} args.programTime A programTime to seek to as an ISO-8601 String\n * @param {Object} args.playlist A playlist to look within\n * @param {number} args.retryCount The number of times to try for an accurate seek. Default is 2.\n * @param {Function} args.seekTo A method to perform a seek\n * @param {boolean} args.pauseAfterSeek Whether to end in a paused state after seeking. Default is true.\n * @param {Object} args.tech The tech to seek on\n * @param {Function} args.callback(err, newTime) A callback to return the new time to\n * @return {string} err.message A detailed error message\n * @return {number} newTime The exact time that was seeked to in seconds\n */\n\nconst seekToProgramTime = ({\n programTime,\n playlist,\n retryCount = 2,\n seekTo,\n pauseAfterSeek = true,\n tech,\n callback\n}) => {\n if (!callback) {\n throw new Error('seekToProgramTime: callback must be provided');\n }\n if (typeof programTime === 'undefined' || !playlist || !seekTo) {\n return callback({\n message: 'seekToProgramTime: programTime, seekTo and playlist must be provided'\n });\n }\n if (!playlist.endList && !tech.hasStarted_) {\n return callback({\n message: 'player must be playing a live stream to start buffering'\n });\n }\n if (!verifyProgramDateTimeTags(playlist)) {\n return callback({\n message: 'programDateTime tags must be provided in the manifest ' + playlist.resolvedUri\n });\n }\n const matchedSegment = findSegmentForProgramTime(programTime, playlist); // no match\n\n if (!matchedSegment) {\n return callback({\n message: `${programTime} was not found in the stream`\n });\n }\n const segment = matchedSegment.segment;\n const mediaOffset = getOffsetFromTimestamp(segment.dateTimeObject, programTime);\n if (matchedSegment.type === 'estimate') {\n // we've run out of retries\n if (retryCount === 0) {\n return callback({\n message: `${programTime} is not buffered yet. Try again`\n });\n }\n seekTo(matchedSegment.estimatedStart + mediaOffset);\n tech.one('seeked', () => {\n seekToProgramTime({\n programTime,\n playlist,\n retryCount: retryCount - 1,\n seekTo,\n pauseAfterSeek,\n tech,\n callback\n });\n });\n return;\n } // Since the segment.start value is determined from the buffered end or ending time\n // of the prior segment, the seekToTime doesn't need to account for any transmuxer\n // modifications.\n\n const seekToTime = segment.start + mediaOffset;\n const seekedCallback = () => {\n return callback(null, tech.currentTime());\n }; // listen for seeked event\n\n tech.one('seeked', seekedCallback); // pause before seeking as video.js will restore this state\n\n if (pauseAfterSeek) {\n tech.pause();\n }\n seekTo(seekToTime);\n};\n\n// which will only happen if the request is complete.\n\nconst callbackOnCompleted = (request, cb) => {\n if (request.readyState === 4) {\n return cb();\n }\n return;\n};\nconst containerRequest = (uri, xhr, cb) => {\n let bytes = [];\n let id3Offset;\n let finished = false;\n const endRequestAndCallback = function (err, req, type, _bytes) {\n req.abort();\n finished = true;\n return cb(err, req, type, _bytes);\n };\n const progressListener = function (error, request) {\n if (finished) {\n return;\n }\n if (error) {\n return endRequestAndCallback(error, request, '', bytes);\n } // grap the new part of content that was just downloaded\n\n const newPart = request.responseText.substring(bytes && bytes.byteLength || 0, request.responseText.length); // add that onto bytes\n\n bytes = (0,_videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_11__.concatTypedArrays)(bytes, (0,_videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_11__.stringToBytes)(newPart, true));\n id3Offset = id3Offset || (0,_videojs_vhs_utils_es_id3_helpers__WEBPACK_IMPORTED_MODULE_14__.getId3Offset)(bytes); // we need at least 10 bytes to determine a type\n // or we need at least two bytes after an id3Offset\n\n if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) {\n return callbackOnCompleted(request, () => endRequestAndCallback(error, request, '', bytes));\n }\n const type = (0,_videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_15__.detectContainerForBytes)(bytes); // if this looks like a ts segment but we don't have enough data\n // to see the second sync byte, wait until we have enough data\n // before declaring it ts\n\n if (type === 'ts' && bytes.length < 188) {\n return callbackOnCompleted(request, () => endRequestAndCallback(error, request, '', bytes));\n } // this may be an unsynced ts segment\n // wait for 376 bytes before detecting no container\n\n if (!type && bytes.length < 376) {\n return callbackOnCompleted(request, () => endRequestAndCallback(error, request, '', bytes));\n }\n return endRequestAndCallback(null, request, type, bytes);\n };\n const options = {\n uri,\n beforeSend(request) {\n // this forces the browser to pass the bytes to us unprocessed\n request.overrideMimeType('text/plain; charset=x-user-defined');\n request.addEventListener('progress', function ({\n total,\n loaded\n }) {\n return callbackWrapper(request, null, {\n statusCode: request.status\n }, progressListener);\n });\n }\n };\n const request = xhr(options, function (error, response) {\n return callbackWrapper(request, error, response, progressListener);\n });\n return request;\n};\nconst {\n EventTarget\n} = videojs;\nconst dashPlaylistUnchanged = function (a, b) {\n if (!isPlaylistUnchanged(a, b)) {\n return false;\n } // for dash the above check will often return true in scenarios where\n // the playlist actually has changed because mediaSequence isn't a\n // dash thing, and we often set it to 1. So if the playlists have the same amount\n // of segments we return true.\n // So for dash we need to make sure that the underlying segments are different.\n // if sidx changed then the playlists are different.\n\n if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) {\n return false;\n } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) {\n return false;\n } // one or the other does not have segments\n // there was a change.\n\n if (a.segments && !b.segments || !a.segments && b.segments) {\n return false;\n } // neither has segments nothing changed\n\n if (!a.segments && !b.segments) {\n return true;\n } // check segments themselves\n\n for (let i = 0; i < a.segments.length; i++) {\n const aSegment = a.segments[i];\n const bSegment = b.segments[i]; // if uris are different between segments there was a change\n\n if (aSegment.uri !== bSegment.uri) {\n return false;\n } // neither segment has a byterange, there will be no byterange change.\n\n if (!aSegment.byterange && !bSegment.byterange) {\n continue;\n }\n const aByterange = aSegment.byterange;\n const bByterange = bSegment.byterange; // if byterange only exists on one of the segments, there was a change.\n\n if (aByterange && !bByterange || !aByterange && bByterange) {\n return false;\n } // if both segments have byterange with different offsets, there was a change.\n\n if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) {\n return false;\n }\n } // if everything was the same with segments, this is the same playlist.\n\n return true;\n};\n/**\n * Use the representation IDs from the mpd object to create groupIDs, the NAME is set to mandatory representation\n * ID in the parser. This allows for continuous playout across periods with the same representation IDs\n * (continuous periods as defined in DASH-IF 3.2.12). This is assumed in the mpd-parser as well. If we want to support\n * periods without continuous playback this function may need modification as well as the parser.\n */\n\nconst dashGroupId = (type, group, label, playlist) => {\n // If the manifest somehow does not have an ID (non-dash compliant), use the label.\n const playlistId = playlist.attributes.NAME || label;\n return `placeholder-uri-${type}-${group}-${playlistId}`;\n};\n/**\n * Parses the main XML string and updates playlist URI references.\n *\n * @param {Object} config\n * Object of arguments\n * @param {string} config.mainXml\n * The mpd XML\n * @param {string} config.srcUrl\n * The mpd URL\n * @param {Date} config.clientOffset\n * A time difference between server and client\n * @param {Object} config.sidxMapping\n * SIDX mappings for moof/mdat URIs and byte ranges\n * @return {Object}\n * The parsed mpd manifest object\n */\n\nconst parseMainXml = ({\n mainXml,\n srcUrl,\n clientOffset,\n sidxMapping,\n previousManifest\n}) => {\n const manifest = (0,mpd_parser__WEBPACK_IMPORTED_MODULE_12__.parse)(mainXml, {\n manifestUri: srcUrl,\n clientOffset,\n sidxMapping,\n previousManifest\n });\n addPropertiesToMain(manifest, srcUrl, dashGroupId);\n return manifest;\n};\n/**\n * Removes any mediaGroup labels that no longer exist in the newMain\n *\n * @param {Object} update\n * The previous mpd object being updated\n * @param {Object} newMain\n * The new mpd object\n */\n\nconst removeOldMediaGroupLabels = (update, newMain) => {\n forEachMediaGroup(update, (properties, type, group, label) => {\n if (!(label in newMain.mediaGroups[type][group])) {\n delete update.mediaGroups[type][group][label];\n }\n });\n};\n/**\n * Returns a new main manifest that is the result of merging an updated main manifest\n * into the original version.\n *\n * @param {Object} oldMain\n * The old parsed mpd object\n * @param {Object} newMain\n * The updated parsed mpd object\n * @return {Object}\n * A new object representing the original main manifest with the updated media\n * playlists merged in\n */\n\nconst updateMain = (oldMain, newMain, sidxMapping) => {\n let noChanges = true;\n let update = merge(oldMain, {\n // These are top level properties that can be updated\n duration: newMain.duration,\n minimumUpdatePeriod: newMain.minimumUpdatePeriod,\n timelineStarts: newMain.timelineStarts\n }); // First update the playlists in playlist list\n\n for (let i = 0; i < newMain.playlists.length; i++) {\n const playlist = newMain.playlists[i];\n if (playlist.sidx) {\n const sidxKey = (0,mpd_parser__WEBPACK_IMPORTED_MODULE_12__.generateSidxKey)(playlist.sidx); // add sidx segments to the playlist if we have all the sidx info already\n\n if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) {\n (0,mpd_parser__WEBPACK_IMPORTED_MODULE_12__.addSidxSegmentsToPlaylist)(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri);\n }\n }\n const playlistUpdate = updateMain$1(update, playlist, dashPlaylistUnchanged);\n if (playlistUpdate) {\n update = playlistUpdate;\n noChanges = false;\n }\n } // Then update media group playlists\n\n forEachMediaGroup(newMain, (properties, type, group, label) => {\n if (properties.playlists && properties.playlists.length) {\n const id = properties.playlists[0].id;\n const playlistUpdate = updateMain$1(update, properties.playlists[0], dashPlaylistUnchanged);\n if (playlistUpdate) {\n update = playlistUpdate; // add new mediaGroup label if it doesn't exist and assign the new mediaGroup.\n\n if (!(label in update.mediaGroups[type][group])) {\n update.mediaGroups[type][group][label] = properties;\n } // update the playlist reference within media groups\n\n update.mediaGroups[type][group][label].playlists[0] = update.playlists[id];\n noChanges = false;\n }\n }\n }); // remove mediaGroup labels and references that no longer exist in the newMain\n\n removeOldMediaGroupLabels(update, newMain);\n if (newMain.minimumUpdatePeriod !== oldMain.minimumUpdatePeriod) {\n noChanges = false;\n }\n if (noChanges) {\n return null;\n }\n return update;\n}; // SIDX should be equivalent if the URI and byteranges of the SIDX match.\n// If the SIDXs have maps, the two maps should match,\n// both `a` and `b` missing SIDXs is considered matching.\n// If `a` or `b` but not both have a map, they aren't matching.\n\nconst equivalentSidx = (a, b) => {\n const neitherMap = Boolean(!a.map && !b.map);\n const equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length);\n return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length;\n}; // exported for testing\n\nconst compareSidxEntry = (playlists, oldSidxMapping) => {\n const newSidxMapping = {};\n for (const id in playlists) {\n const playlist = playlists[id];\n const currentSidxInfo = playlist.sidx;\n if (currentSidxInfo) {\n const key = (0,mpd_parser__WEBPACK_IMPORTED_MODULE_12__.generateSidxKey)(currentSidxInfo);\n if (!oldSidxMapping[key]) {\n break;\n }\n const savedSidxInfo = oldSidxMapping[key].sidxInfo;\n if (equivalentSidx(savedSidxInfo, currentSidxInfo)) {\n newSidxMapping[key] = oldSidxMapping[key];\n }\n }\n }\n return newSidxMapping;\n};\n/**\n * A function that filters out changed items as they need to be requested separately.\n *\n * The method is exported for testing\n *\n * @param {Object} main the parsed mpd XML returned via mpd-parser\n * @param {Object} oldSidxMapping the SIDX to compare against\n */\n\nconst filterChangedSidxMappings = (main, oldSidxMapping) => {\n const videoSidx = compareSidxEntry(main.playlists, oldSidxMapping);\n let mediaGroupSidx = videoSidx;\n forEachMediaGroup(main, (properties, mediaType, groupKey, labelKey) => {\n if (properties.playlists && properties.playlists.length) {\n const playlists = properties.playlists;\n mediaGroupSidx = merge(mediaGroupSidx, compareSidxEntry(playlists, oldSidxMapping));\n }\n });\n return mediaGroupSidx;\n};\nclass DashPlaylistLoader extends EventTarget {\n // DashPlaylistLoader must accept either a src url or a playlist because subsequent\n // playlist loader setups from media groups will expect to be able to pass a playlist\n // (since there aren't external URLs to media playlists with DASH)\n constructor(srcUrlOrPlaylist, vhs, options = {}, mainPlaylistLoader) {\n super();\n this.mainPlaylistLoader_ = mainPlaylistLoader || this;\n if (!mainPlaylistLoader) {\n this.isMain_ = true;\n }\n const {\n withCredentials = false\n } = options;\n this.vhs_ = vhs;\n this.withCredentials = withCredentials;\n this.addMetadataToTextTrack = options.addMetadataToTextTrack;\n if (!srcUrlOrPlaylist) {\n throw new Error('A non-empty playlist URL or object is required');\n } // event naming?\n\n this.on('minimumUpdatePeriod', () => {\n this.refreshXml_();\n }); // live playlist staleness timeout\n\n this.on('mediaupdatetimeout', () => {\n this.refreshMedia_(this.media().id);\n });\n this.state = 'HAVE_NOTHING';\n this.loadedPlaylists_ = {};\n this.logger_ = logger('DashPlaylistLoader'); // initialize the loader state\n // The mainPlaylistLoader will be created with a string\n\n if (this.isMain_) {\n this.mainPlaylistLoader_.srcUrl = srcUrlOrPlaylist; // TODO: reset sidxMapping between period changes\n // once multi-period is refactored\n\n this.mainPlaylistLoader_.sidxMapping_ = {};\n } else {\n this.childPlaylist_ = srcUrlOrPlaylist;\n }\n }\n requestErrored_(err, request, startingState) {\n // disposed\n if (!this.request) {\n return true;\n } // pending request is cleared\n\n this.request = null;\n if (err) {\n // use the provided error object or create one\n // based on the request/response\n this.error = typeof err === 'object' && !(err instanceof Error) ? err : {\n status: request.status,\n message: 'DASH request error at URL: ' + request.uri,\n response: request.response,\n // MEDIA_ERR_NETWORK\n code: 2\n };\n if (startingState) {\n this.state = startingState;\n }\n this.trigger('error');\n return true;\n }\n }\n /**\n * Verify that the container of the sidx segment can be parsed\n * and if it can, get and parse that segment.\n */\n\n addSidxSegments_(playlist, startingState, cb) {\n const sidxKey = playlist.sidx && (0,mpd_parser__WEBPACK_IMPORTED_MODULE_12__.generateSidxKey)(playlist.sidx); // playlist lacks sidx or sidx segments were added to this playlist already.\n\n if (!playlist.sidx || !sidxKey || this.mainPlaylistLoader_.sidxMapping_[sidxKey]) {\n // keep this function async\n this.mediaRequest_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => cb(false), 0);\n return;\n } // resolve the segment URL relative to the playlist\n\n const uri = resolveManifestRedirect(playlist.sidx.resolvedUri);\n const fin = (err, request) => {\n if (this.requestErrored_(err, request, startingState)) {\n return;\n }\n const sidxMapping = this.mainPlaylistLoader_.sidxMapping_;\n let sidx;\n try {\n sidx = mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_13___default()((0,_videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_11__.toUint8)(request.response).subarray(8));\n } catch (e) {\n // sidx parsing failed.\n this.requestErrored_(e, request, startingState);\n return;\n }\n sidxMapping[sidxKey] = {\n sidxInfo: playlist.sidx,\n sidx\n };\n (0,mpd_parser__WEBPACK_IMPORTED_MODULE_12__.addSidxSegmentsToPlaylist)(playlist, sidx, playlist.sidx.resolvedUri);\n return cb(true);\n };\n this.request = containerRequest(uri, this.vhs_.xhr, (err, request, container, bytes) => {\n if (err) {\n return fin(err, request);\n }\n if (!container || container !== 'mp4') {\n return fin({\n status: request.status,\n message: `Unsupported ${container || 'unknown'} container type for sidx segment at URL: ${uri}`,\n // response is just bytes in this case\n // but we really don't want to return that.\n response: '',\n playlist,\n internal: true,\n playlistExclusionDuration: Infinity,\n // MEDIA_ERR_NETWORK\n code: 2\n }, request);\n } // if we already downloaded the sidx bytes in the container request, use them\n\n const {\n offset,\n length\n } = playlist.sidx.byterange;\n if (bytes.length >= length + offset) {\n return fin(err, {\n response: bytes.subarray(offset, offset + length),\n status: request.status,\n uri: request.uri\n });\n } // otherwise request sidx bytes\n\n this.request = this.vhs_.xhr({\n uri,\n responseType: 'arraybuffer',\n headers: segmentXhrHeaders({\n byterange: playlist.sidx.byterange\n })\n }, fin);\n });\n }\n dispose() {\n this.trigger('dispose');\n this.stopRequest();\n this.loadedPlaylists_ = {};\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.minimumUpdatePeriodTimeout_);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaRequest_);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n this.mediaRequest_ = null;\n this.minimumUpdatePeriodTimeout_ = null;\n if (this.mainPlaylistLoader_.createMupOnMedia_) {\n this.off('loadedmetadata', this.mainPlaylistLoader_.createMupOnMedia_);\n this.mainPlaylistLoader_.createMupOnMedia_ = null;\n }\n this.off();\n }\n hasPendingRequest() {\n return this.request || this.mediaRequest_;\n }\n stopRequest() {\n if (this.request) {\n const oldRequest = this.request;\n this.request = null;\n oldRequest.onreadystatechange = null;\n oldRequest.abort();\n }\n }\n media(playlist) {\n // getter\n if (!playlist) {\n return this.media_;\n } // setter\n\n if (this.state === 'HAVE_NOTHING') {\n throw new Error('Cannot switch media playlist from ' + this.state);\n }\n const startingState = this.state; // find the playlist object if the target playlist has been specified by URI\n\n if (typeof playlist === 'string') {\n if (!this.mainPlaylistLoader_.main.playlists[playlist]) {\n throw new Error('Unknown playlist URI: ' + playlist);\n }\n playlist = this.mainPlaylistLoader_.main.playlists[playlist];\n }\n const mediaChange = !this.media_ || playlist.id !== this.media_.id; // switch to previously loaded playlists immediately\n\n if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) {\n this.state = 'HAVE_METADATA';\n this.media_ = playlist; // trigger media change if the active media has been updated\n\n if (mediaChange) {\n this.trigger('mediachanging');\n this.trigger('mediachange');\n }\n return;\n } // switching to the active playlist is a no-op\n\n if (!mediaChange) {\n return;\n } // switching from an already loaded playlist\n\n if (this.media_) {\n this.trigger('mediachanging');\n }\n this.addSidxSegments_(playlist, startingState, sidxChanged => {\n // everything is ready just continue to haveMetadata\n this.haveMetadata({\n startingState,\n playlist\n });\n });\n }\n haveMetadata({\n startingState,\n playlist\n }) {\n this.state = 'HAVE_METADATA';\n this.loadedPlaylists_[playlist.id] = playlist;\n this.mediaRequest_ = null; // This will trigger loadedplaylist\n\n this.refreshMedia_(playlist.id); // fire loadedmetadata the first time a media playlist is loaded\n // to resolve setup of media groups\n\n if (startingState === 'HAVE_MAIN_MANIFEST') {\n this.trigger('loadedmetadata');\n } else {\n // trigger media change if the active media has been updated\n this.trigger('mediachange');\n }\n }\n pause() {\n if (this.mainPlaylistLoader_.createMupOnMedia_) {\n this.off('loadedmetadata', this.mainPlaylistLoader_.createMupOnMedia_);\n this.mainPlaylistLoader_.createMupOnMedia_ = null;\n }\n this.stopRequest();\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n if (this.isMain_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_);\n this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_ = null;\n }\n if (this.state === 'HAVE_NOTHING') {\n // If we pause the loader before any data has been retrieved, its as if we never\n // started, so reset to an unstarted state.\n this.started = false;\n }\n }\n load(isFinalRendition) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n const media = this.media();\n if (isFinalRendition) {\n const delay = media ? media.targetDuration / 2 * 1000 : 5 * 1000;\n this.mediaUpdateTimeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => this.load(), delay);\n return;\n } // because the playlists are internal to the manifest, load should either load the\n // main manifest, or do nothing but trigger an event\n\n if (!this.started) {\n this.start();\n return;\n }\n if (media && !media.endList) {\n // Check to see if this is the main loader and the MUP was cleared (this happens\n // when the loader was paused). `media` should be set at this point since one is always\n // set during `start()`.\n if (this.isMain_ && !this.minimumUpdatePeriodTimeout_) {\n // Trigger minimumUpdatePeriod to refresh the main manifest\n this.trigger('minimumUpdatePeriod'); // Since there was no prior minimumUpdatePeriodTimeout it should be recreated\n\n this.updateMinimumUpdatePeriodTimeout_();\n }\n this.trigger('mediaupdatetimeout');\n } else {\n this.trigger('loadedplaylist');\n }\n }\n start() {\n this.started = true; // We don't need to request the main manifest again\n // Call this asynchronously to match the xhr request behavior below\n\n if (!this.isMain_) {\n this.mediaRequest_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => this.haveMain_(), 0);\n return;\n }\n this.requestMain_((req, mainChanged) => {\n this.haveMain_();\n if (!this.hasPendingRequest() && !this.media_) {\n this.media(this.mainPlaylistLoader_.main.playlists[0]);\n }\n });\n }\n requestMain_(cb) {\n this.request = this.vhs_.xhr({\n uri: this.mainPlaylistLoader_.srcUrl,\n withCredentials: this.withCredentials\n }, (error, req) => {\n if (this.requestErrored_(error, req)) {\n if (this.state === 'HAVE_NOTHING') {\n this.started = false;\n }\n return;\n }\n const mainChanged = req.responseText !== this.mainPlaylistLoader_.mainXml_;\n this.mainPlaylistLoader_.mainXml_ = req.responseText;\n if (req.responseHeaders && req.responseHeaders.date) {\n this.mainLoaded_ = Date.parse(req.responseHeaders.date);\n } else {\n this.mainLoaded_ = Date.now();\n }\n this.mainPlaylistLoader_.srcUrl = resolveManifestRedirect(this.mainPlaylistLoader_.srcUrl, req);\n if (mainChanged) {\n this.handleMain_();\n this.syncClientServerClock_(() => {\n return cb(req, mainChanged);\n });\n return;\n }\n return cb(req, mainChanged);\n });\n }\n /**\n * Parses the main xml for UTCTiming node to sync the client clock to the server\n * clock. If the UTCTiming node requires a HEAD or GET request, that request is made.\n *\n * @param {Function} done\n * Function to call when clock sync has completed\n */\n\n syncClientServerClock_(done) {\n const utcTiming = (0,mpd_parser__WEBPACK_IMPORTED_MODULE_12__.parseUTCTiming)(this.mainPlaylistLoader_.mainXml_); // No UTCTiming element found in the mpd. Use Date header from mpd request as the\n // server clock\n\n if (utcTiming === null) {\n this.mainPlaylistLoader_.clientOffset_ = this.mainLoaded_ - Date.now();\n return done();\n }\n if (utcTiming.method === 'DIRECT') {\n this.mainPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now();\n return done();\n }\n this.request = this.vhs_.xhr({\n uri: resolveUrl(this.mainPlaylistLoader_.srcUrl, utcTiming.value),\n method: utcTiming.method,\n withCredentials: this.withCredentials\n }, (error, req) => {\n // disposed\n if (!this.request) {\n return;\n }\n if (error) {\n // sync request failed, fall back to using date header from mpd\n // TODO: log warning\n this.mainPlaylistLoader_.clientOffset_ = this.mainLoaded_ - Date.now();\n return done();\n }\n let serverTime;\n if (utcTiming.method === 'HEAD') {\n if (!req.responseHeaders || !req.responseHeaders.date) {\n // expected date header not preset, fall back to using date header from mpd\n // TODO: log warning\n serverTime = this.mainLoaded_;\n } else {\n serverTime = Date.parse(req.responseHeaders.date);\n }\n } else {\n serverTime = Date.parse(req.responseText);\n }\n this.mainPlaylistLoader_.clientOffset_ = serverTime - Date.now();\n done();\n });\n }\n haveMain_() {\n this.state = 'HAVE_MAIN_MANIFEST';\n if (this.isMain_) {\n // We have the main playlist at this point, so\n // trigger this to allow PlaylistController\n // to make an initial playlist selection\n this.trigger('loadedplaylist');\n } else if (!this.media_) {\n // no media playlist was specifically selected so select\n // the one the child playlist loader was created with\n this.media(this.childPlaylist_);\n }\n }\n handleMain_() {\n // clear media request\n this.mediaRequest_ = null;\n const oldMain = this.mainPlaylistLoader_.main;\n let newMain = parseMainXml({\n mainXml: this.mainPlaylistLoader_.mainXml_,\n srcUrl: this.mainPlaylistLoader_.srcUrl,\n clientOffset: this.mainPlaylistLoader_.clientOffset_,\n sidxMapping: this.mainPlaylistLoader_.sidxMapping_,\n previousManifest: oldMain\n }); // if we have an old main to compare the new main against\n\n if (oldMain) {\n newMain = updateMain(oldMain, newMain, this.mainPlaylistLoader_.sidxMapping_);\n } // only update main if we have a new main\n\n this.mainPlaylistLoader_.main = newMain ? newMain : oldMain;\n const location = this.mainPlaylistLoader_.main.locations && this.mainPlaylistLoader_.main.locations[0];\n if (location && location !== this.mainPlaylistLoader_.srcUrl) {\n this.mainPlaylistLoader_.srcUrl = location;\n }\n if (!oldMain || newMain && newMain.minimumUpdatePeriod !== oldMain.minimumUpdatePeriod) {\n this.updateMinimumUpdatePeriodTimeout_();\n }\n this.addEventStreamToMetadataTrack_(newMain);\n return Boolean(newMain);\n }\n updateMinimumUpdatePeriodTimeout_() {\n const mpl = this.mainPlaylistLoader_; // cancel any pending creation of mup on media\n // a new one will be added if needed.\n\n if (mpl.createMupOnMedia_) {\n mpl.off('loadedmetadata', mpl.createMupOnMedia_);\n mpl.createMupOnMedia_ = null;\n } // clear any pending timeouts\n\n if (mpl.minimumUpdatePeriodTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(mpl.minimumUpdatePeriodTimeout_);\n mpl.minimumUpdatePeriodTimeout_ = null;\n }\n let mup = mpl.main && mpl.main.minimumUpdatePeriod; // If the minimumUpdatePeriod has a value of 0, that indicates that the current\n // MPD has no future validity, so a new one will need to be acquired when new\n // media segments are to be made available. Thus, we use the target duration\n // in this case\n\n if (mup === 0) {\n if (mpl.media()) {\n mup = mpl.media().targetDuration * 1000;\n } else {\n mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_;\n mpl.one('loadedmetadata', mpl.createMupOnMedia_);\n }\n } // if minimumUpdatePeriod is invalid or <= zero, which\n // can happen when a live video becomes VOD. skip timeout\n // creation.\n\n if (typeof mup !== 'number' || mup <= 0) {\n if (mup < 0) {\n this.logger_(`found invalid minimumUpdatePeriod of ${mup}, not setting a timeout`);\n }\n return;\n }\n this.createMUPTimeout_(mup);\n }\n createMUPTimeout_(mup) {\n const mpl = this.mainPlaylistLoader_;\n mpl.minimumUpdatePeriodTimeout_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => {\n mpl.minimumUpdatePeriodTimeout_ = null;\n mpl.trigger('minimumUpdatePeriod');\n mpl.createMUPTimeout_(mup);\n }, mup);\n }\n /**\n * Sends request to refresh the main xml and updates the parsed main manifest\n */\n\n refreshXml_() {\n this.requestMain_((req, mainChanged) => {\n if (!mainChanged) {\n return;\n }\n if (this.media_) {\n this.media_ = this.mainPlaylistLoader_.main.playlists[this.media_.id];\n } // This will filter out updated sidx info from the mapping\n\n this.mainPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.sidxMapping_);\n this.addSidxSegments_(this.media(), this.state, sidxChanged => {\n // TODO: do we need to reload the current playlist?\n this.refreshMedia_(this.media().id);\n });\n });\n }\n /**\n * Refreshes the media playlist by re-parsing the main xml and updating playlist\n * references. If this is an alternate loader, the updated parsed manifest is retrieved\n * from the main loader.\n */\n\n refreshMedia_(mediaID) {\n if (!mediaID) {\n throw new Error('refreshMedia_ must take a media id');\n } // for main we have to reparse the main xml\n // to re-create segments based on current timing values\n // which may change media. We only skip updating the main manifest\n // if this is the first time this.media_ is being set.\n // as main was just parsed in that case.\n\n if (this.media_ && this.isMain_) {\n this.handleMain_();\n }\n const playlists = this.mainPlaylistLoader_.main.playlists;\n const mediaChanged = !this.media_ || this.media_ !== playlists[mediaID];\n if (mediaChanged) {\n this.media_ = playlists[mediaID];\n } else {\n this.trigger('playlistunchanged');\n }\n if (!this.mediaUpdateTimeout) {\n const createMediaUpdateTimeout = () => {\n if (this.media().endList) {\n return;\n }\n this.mediaUpdateTimeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => {\n this.trigger('mediaupdatetimeout');\n createMediaUpdateTimeout();\n }, refreshDelay(this.media(), Boolean(mediaChanged)));\n };\n createMediaUpdateTimeout();\n }\n this.trigger('loadedplaylist');\n }\n /**\n * Takes eventstream data from a parsed DASH manifest and adds it to the metadata text track.\n *\n * @param {manifest} newMain the newly parsed manifest\n */\n\n addEventStreamToMetadataTrack_(newMain) {\n // Only add new event stream metadata if we have a new manifest.\n if (newMain && this.mainPlaylistLoader_.main.eventStream) {\n // convert EventStream to ID3-like data.\n const metadataArray = this.mainPlaylistLoader_.main.eventStream.map(eventStreamNode => {\n return {\n cueTime: eventStreamNode.start,\n frames: [{\n data: eventStreamNode.messageData\n }]\n };\n });\n this.addMetadataToTextTrack('EventStream', metadataArray, this.mainPlaylistLoader_.main.duration);\n }\n }\n /**\n * Returns the key ID set from a playlist\n *\n * @param {playlist} playlist to fetch the key ID set from.\n * @return a Set of 32 digit hex strings that represent the unique keyIds for that playlist.\n */\n\n getKeyIdSet(playlist) {\n if (playlist.contentProtection) {\n const keyIds = new Set();\n for (const keysystem in playlist.contentProtection) {\n const defaultKID = playlist.contentProtection[keysystem].attributes['cenc:default_KID'];\n if (defaultKID) {\n // DASH keyIds are separated by dashes.\n keyIds.add(defaultKID.replace(/-/g, '').toLowerCase());\n }\n }\n return keyIds;\n }\n }\n}\nvar Config = {\n GOAL_BUFFER_LENGTH: 30,\n MAX_GOAL_BUFFER_LENGTH: 60,\n BACK_BUFFER_LENGTH: 30,\n GOAL_BUFFER_LENGTH_RATE: 1,\n // 0.5 MB/s\n INITIAL_BANDWIDTH: 4194304,\n // A fudge factor to apply to advertised playlist bitrates to account for\n // temporary flucations in client bandwidth\n BANDWIDTH_VARIANCE: 1.2,\n // How much of the buffer must be filled before we consider upswitching\n BUFFER_LOW_WATER_LINE: 0,\n MAX_BUFFER_LOW_WATER_LINE: 30,\n // TODO: Remove this when experimentalBufferBasedABR is removed\n EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16,\n BUFFER_LOW_WATER_LINE_RATE: 1,\n // If the buffer is greater than the high water line, we won't switch down\n BUFFER_HIGH_WATER_LINE: 30\n};\nconst stringToArrayBuffer = string => {\n const view = new Uint8Array(new ArrayBuffer(string.length));\n for (let i = 0; i < string.length; i++) {\n view[i] = string.charCodeAt(i);\n }\n return view.buffer;\n};\n\n/* global Blob, BlobBuilder, Worker */\n// unify worker interface\nconst browserWorkerPolyFill = function (workerObj) {\n // node only supports on/off\n workerObj.on = workerObj.addEventListener;\n workerObj.off = workerObj.removeEventListener;\n return workerObj;\n};\nconst createObjectURL = function (str) {\n try {\n return URL.createObjectURL(new Blob([str], {\n type: 'application/javascript'\n }));\n } catch (e) {\n const blob = new BlobBuilder();\n blob.append(str);\n return URL.createObjectURL(blob.getBlob());\n }\n};\nconst factory = function (code) {\n return function () {\n const objectUrl = createObjectURL(code);\n const worker = browserWorkerPolyFill(new Worker(objectUrl));\n worker.objURL = objectUrl;\n const terminate = worker.terminate;\n worker.on = worker.addEventListener;\n worker.off = worker.removeEventListener;\n worker.terminate = function () {\n URL.revokeObjectURL(objectUrl);\n return terminate.call(this);\n };\n return worker;\n };\n};\nconst transform = function (code) {\n return `var browserWorkerPolyFill = ${browserWorkerPolyFill.toString()};\\n` + 'browserWorkerPolyFill(self);\\n' + code;\n};\nconst getWorkerString = function (fn) {\n return fn.toString().replace(/^function.+?{/, '').slice(0, -1);\n};\n\n/* rollup-plugin-worker-factory start for worker!/home/runner/work/http-streaming/http-streaming/src/transmuxer-worker.js */\nconst workerCode$1 = transform(getWorkerString(function () {\n var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * A lightweight readable stream implemention that handles event dispatching.\n * Objects that inherit from streams should call init in their constructors.\n */\n\n var Stream$8 = function () {\n this.init = function () {\n var listeners = {};\n /**\n * Add a listener for a specified event type.\n * @param type {string} the event name\n * @param listener {function} the callback to be invoked when an event of\n * the specified type occurs\n */\n\n this.on = function (type, listener) {\n if (!listeners[type]) {\n listeners[type] = [];\n }\n listeners[type] = listeners[type].concat(listener);\n };\n /**\n * Remove a listener for a specified event type.\n * @param type {string} the event name\n * @param listener {function} a function previously registered for this\n * type of event through `on`\n */\n\n this.off = function (type, listener) {\n var index;\n if (!listeners[type]) {\n return false;\n }\n index = listeners[type].indexOf(listener);\n listeners[type] = listeners[type].slice();\n listeners[type].splice(index, 1);\n return index > -1;\n };\n /**\n * Trigger an event of the specified type on this stream. Any additional\n * arguments to this function are passed as parameters to event listeners.\n * @param type {string} the event name\n */\n\n this.trigger = function (type) {\n var callbacks, i, length, args;\n callbacks = listeners[type];\n if (!callbacks) {\n return;\n } // Slicing the arguments on every invocation of this method\n // can add a significant amount of overhead. Avoid the\n // intermediate object creation for the common case of a\n // single callback argument\n\n if (arguments.length === 2) {\n length = callbacks.length;\n for (i = 0; i < length; ++i) {\n callbacks[i].call(this, arguments[1]);\n }\n } else {\n args = [];\n i = arguments.length;\n for (i = 1; i < arguments.length; ++i) {\n args.push(arguments[i]);\n }\n length = callbacks.length;\n for (i = 0; i < length; ++i) {\n callbacks[i].apply(this, args);\n }\n }\n };\n /**\n * Destroys the stream and cleans up.\n */\n\n this.dispose = function () {\n listeners = {};\n };\n };\n };\n /**\n * Forwards all `data` events on this stream to the destination stream. The\n * destination stream should provide a method `push` to receive the data\n * events as they arrive.\n * @param destination {stream} the stream that will receive all `data` events\n * @param autoFlush {boolean} if false, we will not call `flush` on the destination\n * when the current stream emits a 'done' event\n * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options\n */\n\n Stream$8.prototype.pipe = function (destination) {\n this.on('data', function (data) {\n destination.push(data);\n });\n this.on('done', function (flushSource) {\n destination.flush(flushSource);\n });\n this.on('partialdone', function (flushSource) {\n destination.partialFlush(flushSource);\n });\n this.on('endedtimeline', function (flushSource) {\n destination.endTimeline(flushSource);\n });\n this.on('reset', function (flushSource) {\n destination.reset(flushSource);\n });\n return destination;\n }; // Default stream functions that are expected to be overridden to perform\n // actual work. These are provided by the prototype as a sort of no-op\n // implementation so that we don't have to check for their existence in the\n // `pipe` function above.\n\n Stream$8.prototype.push = function (data) {\n this.trigger('data', data);\n };\n Stream$8.prototype.flush = function (flushSource) {\n this.trigger('done', flushSource);\n };\n Stream$8.prototype.partialFlush = function (flushSource) {\n this.trigger('partialdone', flushSource);\n };\n Stream$8.prototype.endTimeline = function (flushSource) {\n this.trigger('endedtimeline', flushSource);\n };\n Stream$8.prototype.reset = function (flushSource) {\n this.trigger('reset', flushSource);\n };\n var stream = Stream$8;\n var MAX_UINT32$1 = Math.pow(2, 32);\n var getUint64$3 = function (uint8) {\n var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);\n var value;\n if (dv.getBigUint64) {\n value = dv.getBigUint64(0);\n if (value < Number.MAX_SAFE_INTEGER) {\n return Number(value);\n }\n return value;\n }\n return dv.getUint32(0) * MAX_UINT32$1 + dv.getUint32(4);\n };\n var numbers = {\n getUint64: getUint64$3,\n MAX_UINT32: MAX_UINT32$1\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Functions that generate fragmented MP4s suitable for use with Media\n * Source Extensions.\n */\n\n var MAX_UINT32 = numbers.MAX_UINT32;\n var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants\n\n (function () {\n var i;\n types = {\n avc1: [],\n // codingname\n avcC: [],\n btrt: [],\n dinf: [],\n dref: [],\n esds: [],\n ftyp: [],\n hdlr: [],\n mdat: [],\n mdhd: [],\n mdia: [],\n mfhd: [],\n minf: [],\n moof: [],\n moov: [],\n mp4a: [],\n // codingname\n mvex: [],\n mvhd: [],\n pasp: [],\n sdtp: [],\n smhd: [],\n stbl: [],\n stco: [],\n stsc: [],\n stsd: [],\n stsz: [],\n stts: [],\n styp: [],\n tfdt: [],\n tfhd: [],\n traf: [],\n trak: [],\n trun: [],\n trex: [],\n tkhd: [],\n vmhd: []\n }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we\n // don't throw an error\n\n if (typeof Uint8Array === 'undefined') {\n return;\n }\n for (i in types) {\n if (types.hasOwnProperty(i)) {\n types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)];\n }\n }\n MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]);\n AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]);\n MINOR_VERSION = new Uint8Array([0, 0, 0, 1]);\n VIDEO_HDLR = new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x00,\n // pre_defined\n 0x76, 0x69, 0x64, 0x65,\n // handler_type: 'vide'\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler'\n ]);\n\n AUDIO_HDLR = new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x00,\n // pre_defined\n 0x73, 0x6f, 0x75, 0x6e,\n // handler_type: 'soun'\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler'\n ]);\n\n HDLR_TYPES = {\n video: VIDEO_HDLR,\n audio: AUDIO_HDLR\n };\n DREF = new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x01,\n // entry_count\n 0x00, 0x00, 0x00, 0x0c,\n // entry_size\n 0x75, 0x72, 0x6c, 0x20,\n // 'url' type\n 0x00,\n // version 0\n 0x00, 0x00, 0x01 // entry_flags\n ]);\n\n SMHD = new Uint8Array([0x00,\n // version\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00,\n // balance, 0 means centered\n 0x00, 0x00 // reserved\n ]);\n\n STCO = new Uint8Array([0x00,\n // version\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ]);\n\n STSC = STCO;\n STSZ = new Uint8Array([0x00,\n // version\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x00,\n // sample_size\n 0x00, 0x00, 0x00, 0x00 // sample_count\n ]);\n\n STTS = STCO;\n VMHD = new Uint8Array([0x00,\n // version\n 0x00, 0x00, 0x01,\n // flags\n 0x00, 0x00,\n // graphicsmode\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor\n ]);\n })();\n\n box = function (type) {\n var payload = [],\n size = 0,\n i,\n result,\n view;\n for (i = 1; i < arguments.length; i++) {\n payload.push(arguments[i]);\n }\n i = payload.length; // calculate the total size we need to allocate\n\n while (i--) {\n size += payload[i].byteLength;\n }\n result = new Uint8Array(size + 8);\n view = new DataView(result.buffer, result.byteOffset, result.byteLength);\n view.setUint32(0, result.byteLength);\n result.set(type, 4); // copy the payload into the result\n\n for (i = 0, size = 8; i < payload.length; i++) {\n result.set(payload[i], size);\n size += payload[i].byteLength;\n }\n return result;\n };\n dinf = function () {\n return box(types.dinf, box(types.dref, DREF));\n };\n esds = function (track) {\n return box(types.esds, new Uint8Array([0x00,\n // version\n 0x00, 0x00, 0x00,\n // flags\n // ES_Descriptor\n 0x03,\n // tag, ES_DescrTag\n 0x19,\n // length\n 0x00, 0x00,\n // ES_ID\n 0x00,\n // streamDependenceFlag, URL_flag, reserved, streamPriority\n // DecoderConfigDescriptor\n 0x04,\n // tag, DecoderConfigDescrTag\n 0x11,\n // length\n 0x40,\n // object type\n 0x15,\n // streamType\n 0x00, 0x06, 0x00,\n // bufferSizeDB\n 0x00, 0x00, 0xda, 0xc0,\n // maxBitrate\n 0x00, 0x00, 0xda, 0xc0,\n // avgBitrate\n // DecoderSpecificInfo\n 0x05,\n // tag, DecoderSpecificInfoTag\n 0x02,\n // length\n // ISO/IEC 14496-3, AudioSpecificConfig\n // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35\n track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig\n ]));\n };\n\n ftyp = function () {\n return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND);\n };\n hdlr = function (type) {\n return box(types.hdlr, HDLR_TYPES[type]);\n };\n mdat = function (data) {\n return box(types.mdat, data);\n };\n mdhd = function (track) {\n var result = new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x02,\n // creation_time\n 0x00, 0x00, 0x00, 0x03,\n // modification_time\n 0x00, 0x01, 0x5f, 0x90,\n // timescale, 90,000 \"ticks\" per second\n track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF,\n // duration\n 0x55, 0xc4,\n // 'und' language (undetermined)\n 0x00, 0x00]); // Use the sample rate from the track metadata, when it is\n // defined. The sample rate can be parsed out of an ADTS header, for\n // instance.\n\n if (track.samplerate) {\n result[12] = track.samplerate >>> 24 & 0xFF;\n result[13] = track.samplerate >>> 16 & 0xFF;\n result[14] = track.samplerate >>> 8 & 0xFF;\n result[15] = track.samplerate & 0xFF;\n }\n return box(types.mdhd, result);\n };\n mdia = function (track) {\n return box(types.mdia, mdhd(track), hdlr(track.type), minf(track));\n };\n mfhd = function (sequenceNumber) {\n return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00,\n // flags\n (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number\n ]));\n };\n\n minf = function (track) {\n return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track));\n };\n moof = function (sequenceNumber, tracks) {\n var trackFragments = [],\n i = tracks.length; // build traf boxes for each track fragment\n\n while (i--) {\n trackFragments[i] = traf(tracks[i]);\n }\n return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments));\n };\n /**\n * Returns a movie box.\n * @param tracks {array} the tracks associated with this movie\n * @see ISO/IEC 14496-12:2012(E), section 8.2.1\n */\n\n moov = function (tracks) {\n var i = tracks.length,\n boxes = [];\n while (i--) {\n boxes[i] = trak(tracks[i]);\n }\n return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks)));\n };\n mvex = function (tracks) {\n var i = tracks.length,\n boxes = [];\n while (i--) {\n boxes[i] = trex(tracks[i]);\n }\n return box.apply(null, [types.mvex].concat(boxes));\n };\n mvhd = function (duration) {\n var bytes = new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x01,\n // creation_time\n 0x00, 0x00, 0x00, 0x02,\n // modification_time\n 0x00, 0x01, 0x5f, 0x90,\n // timescale, 90,000 \"ticks\" per second\n (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF,\n // duration\n 0x00, 0x01, 0x00, 0x00,\n // 1.0 rate\n 0x01, 0x00,\n // 1.0 volume\n 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,\n // transformation: unity matrix\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // pre_defined\n 0xff, 0xff, 0xff, 0xff // next_track_ID\n ]);\n\n return box(types.mvhd, bytes);\n };\n sdtp = function (track) {\n var samples = track.samples || [],\n bytes = new Uint8Array(4 + samples.length),\n flags,\n i; // leave the full box header (4 bytes) all zero\n // write the sample table\n\n for (i = 0; i < samples.length; i++) {\n flags = samples[i].flags;\n bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;\n }\n return box(types.sdtp, bytes);\n };\n stbl = function (track) {\n return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO));\n };\n (function () {\n var videoSample, audioSample;\n stsd = function (track) {\n return box(types.stsd, new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track));\n };\n videoSample = function (track) {\n var sps = track.sps || [],\n pps = track.pps || [],\n sequenceParameterSets = [],\n pictureParameterSets = [],\n i,\n avc1Box; // assemble the SPSs\n\n for (i = 0; i < sps.length; i++) {\n sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8);\n sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength\n\n sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS\n } // assemble the PPSs\n\n for (i = 0; i < pps.length; i++) {\n pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8);\n pictureParameterSets.push(pps[i].byteLength & 0xFF);\n pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i]));\n }\n avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x01,\n // data_reference_index\n 0x00, 0x00,\n // pre_defined\n 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // pre_defined\n (track.width & 0xff00) >> 8, track.width & 0xff,\n // width\n (track.height & 0xff00) >> 8, track.height & 0xff,\n // height\n 0x00, 0x48, 0x00, 0x00,\n // horizresolution\n 0x00, 0x48, 0x00, 0x00,\n // vertresolution\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x01,\n // frame_count\n 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // compressorname\n 0x00, 0x18,\n // depth = 24\n 0x11, 0x11 // pre_defined = -1\n ]), box(types.avcC, new Uint8Array([0x01,\n // configurationVersion\n track.profileIdc,\n // AVCProfileIndication\n track.profileCompatibility,\n // profile_compatibility\n track.levelIdc,\n // AVCLevelIndication\n 0xff // lengthSizeMinusOne, hard-coded to 4 bytes\n ].concat([sps.length],\n // numOfSequenceParameterSets\n sequenceParameterSets,\n // \"SPS\"\n [pps.length],\n // numOfPictureParameterSets\n pictureParameterSets // \"PPS\"\n ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80,\n // bufferSizeDB\n 0x00, 0x2d, 0xc6, 0xc0,\n // maxBitrate\n 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate\n ]))];\n\n if (track.sarRatio) {\n var hSpacing = track.sarRatio[0],\n vSpacing = track.sarRatio[1];\n avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF])));\n }\n return box.apply(null, avc1Box);\n };\n audioSample = function (track) {\n return box(types.mp4a, new Uint8Array([\n // SampleEntry, ISO/IEC 14496-12\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x01,\n // data_reference_index\n // AudioSampleEntry, ISO/IEC 14496-12\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff,\n // channelcount\n (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff,\n // samplesize\n 0x00, 0x00,\n // pre_defined\n 0x00, 0x00,\n // reserved\n (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16\n // MP4AudioSampleEntry, ISO/IEC 14496-14\n ]), esds(track));\n };\n })();\n tkhd = function (track) {\n var result = new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x07,\n // flags\n 0x00, 0x00, 0x00, 0x00,\n // creation_time\n 0x00, 0x00, 0x00, 0x00,\n // modification_time\n (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF,\n // track_ID\n 0x00, 0x00, 0x00, 0x00,\n // reserved\n (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF,\n // duration\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n // reserved\n 0x00, 0x00,\n // layer\n 0x00, 0x00,\n // alternate_group\n 0x01, 0x00,\n // non-audio track volume\n 0x00, 0x00,\n // reserved\n 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,\n // transformation: unity matrix\n (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00,\n // width\n (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height\n ]);\n\n return box(types.tkhd, result);\n };\n /**\n * Generate a track fragment (traf) box. A traf box collects metadata\n * about tracks in a movie fragment (moof) box.\n */\n\n traf = function (track) {\n var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime;\n trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x3a,\n // flags\n (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF,\n // track_ID\n 0x00, 0x00, 0x00, 0x01,\n // sample_description_index\n 0x00, 0x00, 0x00, 0x00,\n // default_sample_duration\n 0x00, 0x00, 0x00, 0x00,\n // default_sample_size\n 0x00, 0x00, 0x00, 0x00 // default_sample_flags\n ]));\n\n upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT32);\n lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT32);\n trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01,\n // version 1\n 0x00, 0x00, 0x00,\n // flags\n // baseMediaDecodeTime\n upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of\n // the containing moof to the first payload byte of the associated\n // mdat\n\n dataOffset = 32 +\n // tfhd\n 20 +\n // tfdt\n 8 +\n // traf header\n 16 +\n // mfhd\n 8 +\n // moof header\n 8; // mdat header\n // audio tracks require less metadata\n\n if (track.type === 'audio') {\n trackFragmentRun = trun$1(track, dataOffset);\n return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun);\n } // video tracks should contain an independent and disposable samples\n // box (sdtp)\n // generate one and adjust offsets to match\n\n sampleDependencyTable = sdtp(track);\n trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset);\n return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable);\n };\n /**\n * Generate a track box.\n * @param track {object} a track definition\n * @return {Uint8Array} the track box\n */\n\n trak = function (track) {\n track.duration = track.duration || 0xffffffff;\n return box(types.trak, tkhd(track), mdia(track));\n };\n trex = function (track) {\n var result = new Uint8Array([0x00,\n // version 0\n 0x00, 0x00, 0x00,\n // flags\n (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF,\n // track_ID\n 0x00, 0x00, 0x00, 0x01,\n // default_sample_description_index\n 0x00, 0x00, 0x00, 0x00,\n // default_sample_duration\n 0x00, 0x00, 0x00, 0x00,\n // default_sample_size\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]); // the last two bytes of default_sample_flags is the sample\n // degradation priority, a hint about the importance of this sample\n // relative to others. Lower the degradation priority for all sample\n // types other than video.\n\n if (track.type !== 'video') {\n result[result.length - 1] = 0x00;\n }\n return box(types.trex, result);\n };\n (function () {\n var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a\n // duration is present for the first sample, it will be present for\n // all subsequent samples.\n // see ISO/IEC 14496-12:2012, Section 8.8.8.1\n\n trunHeader = function (samples, offset) {\n var durationPresent = 0,\n sizePresent = 0,\n flagsPresent = 0,\n compositionTimeOffset = 0; // trun flag constants\n\n if (samples.length) {\n if (samples[0].duration !== undefined) {\n durationPresent = 0x1;\n }\n if (samples[0].size !== undefined) {\n sizePresent = 0x2;\n }\n if (samples[0].flags !== undefined) {\n flagsPresent = 0x4;\n }\n if (samples[0].compositionTimeOffset !== undefined) {\n compositionTimeOffset = 0x8;\n }\n }\n return [0x00,\n // version 0\n 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01,\n // flags\n (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF,\n // sample_count\n (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset\n ];\n };\n\n videoTrun = function (track, offset) {\n var bytesOffest, bytes, header, samples, sample, i;\n samples = track.samples || [];\n offset += 8 + 12 + 16 * samples.length;\n header = trunHeader(samples, offset);\n bytes = new Uint8Array(header.length + samples.length * 16);\n bytes.set(header);\n bytesOffest = header.length;\n for (i = 0; i < samples.length; i++) {\n sample = samples[i];\n bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24;\n bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16;\n bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8;\n bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration\n\n bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24;\n bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16;\n bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8;\n bytes[bytesOffest++] = sample.size & 0xFF; // sample_size\n\n bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn;\n bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample;\n bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8;\n bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags\n\n bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24;\n bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16;\n bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8;\n bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset\n }\n\n return box(types.trun, bytes);\n };\n audioTrun = function (track, offset) {\n var bytes, bytesOffest, header, samples, sample, i;\n samples = track.samples || [];\n offset += 8 + 12 + 8 * samples.length;\n header = trunHeader(samples, offset);\n bytes = new Uint8Array(header.length + samples.length * 8);\n bytes.set(header);\n bytesOffest = header.length;\n for (i = 0; i < samples.length; i++) {\n sample = samples[i];\n bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24;\n bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16;\n bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8;\n bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration\n\n bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24;\n bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16;\n bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8;\n bytes[bytesOffest++] = sample.size & 0xFF; // sample_size\n }\n\n return box(types.trun, bytes);\n };\n trun$1 = function (track, offset) {\n if (track.type === 'audio') {\n return audioTrun(track, offset);\n }\n return videoTrun(track, offset);\n };\n })();\n var mp4Generator = {\n ftyp: ftyp,\n mdat: mdat,\n moof: moof,\n moov: moov,\n initSegment: function (tracks) {\n var fileType = ftyp(),\n movie = moov(tracks),\n result;\n result = new Uint8Array(fileType.byteLength + movie.byteLength);\n result.set(fileType);\n result.set(movie, fileType.byteLength);\n return result;\n }\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n // composed of the nal units that make up that frame\n // Also keep track of cummulative data about the frame from the nal units such\n // as the frame duration, starting pts, etc.\n\n var groupNalsIntoFrames = function (nalUnits) {\n var i,\n currentNal,\n currentFrame = [],\n frames = []; // TODO added for LHLS, make sure this is OK\n\n frames.byteLength = 0;\n frames.nalCount = 0;\n frames.duration = 0;\n currentFrame.byteLength = 0;\n for (i = 0; i < nalUnits.length; i++) {\n currentNal = nalUnits[i]; // Split on 'aud'-type nal units\n\n if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') {\n // Since the very first nal unit is expected to be an AUD\n // only push to the frames array when currentFrame is not empty\n if (currentFrame.length) {\n currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK\n\n frames.byteLength += currentFrame.byteLength;\n frames.nalCount += currentFrame.length;\n frames.duration += currentFrame.duration;\n frames.push(currentFrame);\n }\n currentFrame = [currentNal];\n currentFrame.byteLength = currentNal.data.byteLength;\n currentFrame.pts = currentNal.pts;\n currentFrame.dts = currentNal.dts;\n } else {\n // Specifically flag key frames for ease of use later\n if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') {\n currentFrame.keyFrame = true;\n }\n currentFrame.duration = currentNal.dts - currentFrame.dts;\n currentFrame.byteLength += currentNal.data.byteLength;\n currentFrame.push(currentNal);\n }\n } // For the last frame, use the duration of the previous frame if we\n // have nothing better to go on\n\n if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) {\n currentFrame.duration = frames[frames.length - 1].duration;\n } // Push the final frame\n // TODO added for LHLS, make sure this is OK\n\n frames.byteLength += currentFrame.byteLength;\n frames.nalCount += currentFrame.length;\n frames.duration += currentFrame.duration;\n frames.push(currentFrame);\n return frames;\n }; // Convert an array of frames into an array of Gop with each Gop being composed\n // of the frames that make up that Gop\n // Also keep track of cummulative data about the Gop from the frames such as the\n // Gop duration, starting pts, etc.\n\n var groupFramesIntoGops = function (frames) {\n var i,\n currentFrame,\n currentGop = [],\n gops = []; // We must pre-set some of the values on the Gop since we\n // keep running totals of these values\n\n currentGop.byteLength = 0;\n currentGop.nalCount = 0;\n currentGop.duration = 0;\n currentGop.pts = frames[0].pts;\n currentGop.dts = frames[0].dts; // store some metadata about all the Gops\n\n gops.byteLength = 0;\n gops.nalCount = 0;\n gops.duration = 0;\n gops.pts = frames[0].pts;\n gops.dts = frames[0].dts;\n for (i = 0; i < frames.length; i++) {\n currentFrame = frames[i];\n if (currentFrame.keyFrame) {\n // Since the very first frame is expected to be an keyframe\n // only push to the gops array when currentGop is not empty\n if (currentGop.length) {\n gops.push(currentGop);\n gops.byteLength += currentGop.byteLength;\n gops.nalCount += currentGop.nalCount;\n gops.duration += currentGop.duration;\n }\n currentGop = [currentFrame];\n currentGop.nalCount = currentFrame.length;\n currentGop.byteLength = currentFrame.byteLength;\n currentGop.pts = currentFrame.pts;\n currentGop.dts = currentFrame.dts;\n currentGop.duration = currentFrame.duration;\n } else {\n currentGop.duration += currentFrame.duration;\n currentGop.nalCount += currentFrame.length;\n currentGop.byteLength += currentFrame.byteLength;\n currentGop.push(currentFrame);\n }\n }\n if (gops.length && currentGop.duration <= 0) {\n currentGop.duration = gops[gops.length - 1].duration;\n }\n gops.byteLength += currentGop.byteLength;\n gops.nalCount += currentGop.nalCount;\n gops.duration += currentGop.duration; // push the final Gop\n\n gops.push(currentGop);\n return gops;\n };\n /*\n * Search for the first keyframe in the GOPs and throw away all frames\n * until that keyframe. Then extend the duration of the pulled keyframe\n * and pull the PTS and DTS of the keyframe so that it covers the time\n * range of the frames that were disposed.\n *\n * @param {Array} gops video GOPs\n * @returns {Array} modified video GOPs\n */\n\n var extendFirstKeyFrame = function (gops) {\n var currentGop;\n if (!gops[0][0].keyFrame && gops.length > 1) {\n // Remove the first GOP\n currentGop = gops.shift();\n gops.byteLength -= currentGop.byteLength;\n gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the\n // first gop to cover the time period of the\n // frames we just removed\n\n gops[0][0].dts = currentGop.dts;\n gops[0][0].pts = currentGop.pts;\n gops[0][0].duration += currentGop.duration;\n }\n return gops;\n };\n /**\n * Default sample object\n * see ISO/IEC 14496-12:2012, section 8.6.4.3\n */\n\n var createDefaultSample = function () {\n return {\n size: 0,\n flags: {\n isLeading: 0,\n dependsOn: 1,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradationPriority: 0,\n isNonSyncSample: 1\n }\n };\n };\n /*\n * Collates information from a video frame into an object for eventual\n * entry into an MP4 sample table.\n *\n * @param {Object} frame the video frame\n * @param {Number} dataOffset the byte offset to position the sample\n * @return {Object} object containing sample table info for a frame\n */\n\n var sampleForFrame = function (frame, dataOffset) {\n var sample = createDefaultSample();\n sample.dataOffset = dataOffset;\n sample.compositionTimeOffset = frame.pts - frame.dts;\n sample.duration = frame.duration;\n sample.size = 4 * frame.length; // Space for nal unit size\n\n sample.size += frame.byteLength;\n if (frame.keyFrame) {\n sample.flags.dependsOn = 2;\n sample.flags.isNonSyncSample = 0;\n }\n return sample;\n }; // generate the track's sample table from an array of gops\n\n var generateSampleTable$1 = function (gops, baseDataOffset) {\n var h,\n i,\n sample,\n currentGop,\n currentFrame,\n dataOffset = baseDataOffset || 0,\n samples = [];\n for (h = 0; h < gops.length; h++) {\n currentGop = gops[h];\n for (i = 0; i < currentGop.length; i++) {\n currentFrame = currentGop[i];\n sample = sampleForFrame(currentFrame, dataOffset);\n dataOffset += sample.size;\n samples.push(sample);\n }\n }\n return samples;\n }; // generate the track's raw mdat data from an array of gops\n\n var concatenateNalData = function (gops) {\n var h,\n i,\n j,\n currentGop,\n currentFrame,\n currentNal,\n dataOffset = 0,\n nalsByteLength = gops.byteLength,\n numberOfNals = gops.nalCount,\n totalByteLength = nalsByteLength + 4 * numberOfNals,\n data = new Uint8Array(totalByteLength),\n view = new DataView(data.buffer); // For each Gop..\n\n for (h = 0; h < gops.length; h++) {\n currentGop = gops[h]; // For each Frame..\n\n for (i = 0; i < currentGop.length; i++) {\n currentFrame = currentGop[i]; // For each NAL..\n\n for (j = 0; j < currentFrame.length; j++) {\n currentNal = currentFrame[j];\n view.setUint32(dataOffset, currentNal.data.byteLength);\n dataOffset += 4;\n data.set(currentNal.data, dataOffset);\n dataOffset += currentNal.data.byteLength;\n }\n }\n }\n return data;\n }; // generate the track's sample table from a frame\n\n var generateSampleTableForFrame = function (frame, baseDataOffset) {\n var sample,\n dataOffset = baseDataOffset || 0,\n samples = [];\n sample = sampleForFrame(frame, dataOffset);\n samples.push(sample);\n return samples;\n }; // generate the track's raw mdat data from a frame\n\n var concatenateNalDataForFrame = function (frame) {\n var i,\n currentNal,\n dataOffset = 0,\n nalsByteLength = frame.byteLength,\n numberOfNals = frame.length,\n totalByteLength = nalsByteLength + 4 * numberOfNals,\n data = new Uint8Array(totalByteLength),\n view = new DataView(data.buffer); // For each NAL..\n\n for (i = 0; i < frame.length; i++) {\n currentNal = frame[i];\n view.setUint32(dataOffset, currentNal.data.byteLength);\n dataOffset += 4;\n data.set(currentNal.data, dataOffset);\n dataOffset += currentNal.data.byteLength;\n }\n return data;\n };\n var frameUtils$1 = {\n groupNalsIntoFrames: groupNalsIntoFrames,\n groupFramesIntoGops: groupFramesIntoGops,\n extendFirstKeyFrame: extendFirstKeyFrame,\n generateSampleTable: generateSampleTable$1,\n concatenateNalData: concatenateNalData,\n generateSampleTableForFrame: generateSampleTableForFrame,\n concatenateNalDataForFrame: concatenateNalDataForFrame\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var highPrefix = [33, 16, 5, 32, 164, 27];\n var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252];\n var zeroFill = function (count) {\n var a = [];\n while (count--) {\n a.push(0);\n }\n return a;\n };\n var makeTable = function (metaTable) {\n return Object.keys(metaTable).reduce(function (obj, key) {\n obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) {\n return arr.concat(part);\n }, []));\n return obj;\n }, {});\n };\n var silence;\n var silence_1 = function () {\n if (!silence) {\n // Frames-of-silence to use for filling in missing AAC frames\n var coneOfSilence = {\n 96000: [highPrefix, [227, 64], zeroFill(154), [56]],\n 88200: [highPrefix, [231], zeroFill(170), [56]],\n 64000: [highPrefix, [248, 192], zeroFill(240), [56]],\n 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]],\n 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]],\n 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]],\n 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]],\n 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]],\n 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]],\n 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]],\n 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]]\n };\n silence = makeTable(coneOfSilence);\n }\n return silence;\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var ONE_SECOND_IN_TS$4 = 90000,\n // 90kHz clock\n secondsToVideoTs,\n secondsToAudioTs,\n videoTsToSeconds,\n audioTsToSeconds,\n audioTsToVideoTs,\n videoTsToAudioTs,\n metadataTsToSeconds;\n secondsToVideoTs = function (seconds) {\n return seconds * ONE_SECOND_IN_TS$4;\n };\n secondsToAudioTs = function (seconds, sampleRate) {\n return seconds * sampleRate;\n };\n videoTsToSeconds = function (timestamp) {\n return timestamp / ONE_SECOND_IN_TS$4;\n };\n audioTsToSeconds = function (timestamp, sampleRate) {\n return timestamp / sampleRate;\n };\n audioTsToVideoTs = function (timestamp, sampleRate) {\n return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate));\n };\n videoTsToAudioTs = function (timestamp, sampleRate) {\n return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate);\n };\n /**\n * Adjust ID3 tag or caption timing information by the timeline pts values\n * (if keepOriginalTimestamps is false) and convert to seconds\n */\n\n metadataTsToSeconds = function (timestamp, timelineStartPts, keepOriginalTimestamps) {\n return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);\n };\n var clock$2 = {\n ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4,\n secondsToVideoTs: secondsToVideoTs,\n secondsToAudioTs: secondsToAudioTs,\n videoTsToSeconds: videoTsToSeconds,\n audioTsToSeconds: audioTsToSeconds,\n audioTsToVideoTs: audioTsToVideoTs,\n videoTsToAudioTs: videoTsToAudioTs,\n metadataTsToSeconds: metadataTsToSeconds\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var coneOfSilence = silence_1;\n var clock$1 = clock$2;\n /**\n * Sum the `byteLength` properties of the data in each AAC frame\n */\n\n var sumFrameByteLengths = function (array) {\n var i,\n currentObj,\n sum = 0; // sum the byteLength's all each nal unit in the frame\n\n for (i = 0; i < array.length; i++) {\n currentObj = array[i];\n sum += currentObj.data.byteLength;\n }\n return sum;\n }; // Possibly pad (prefix) the audio track with silence if appending this track\n // would lead to the introduction of a gap in the audio buffer\n\n var prefixWithSilence = function (track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) {\n var baseMediaDecodeTimeTs,\n frameDuration = 0,\n audioGapDuration = 0,\n audioFillFrameCount = 0,\n audioFillDuration = 0,\n silentFrame,\n i,\n firstFrame;\n if (!frames.length) {\n return;\n }\n baseMediaDecodeTimeTs = clock$1.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills\n\n frameDuration = Math.ceil(clock$1.ONE_SECOND_IN_TS / (track.samplerate / 1024));\n if (audioAppendStartTs && videoBaseMediaDecodeTime) {\n // insert the shortest possible amount (audio gap or audio to video gap)\n audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap\n\n audioFillFrameCount = Math.floor(audioGapDuration / frameDuration);\n audioFillDuration = audioFillFrameCount * frameDuration;\n } // don't attempt to fill gaps smaller than a single frame or larger\n // than a half second\n\n if (audioFillFrameCount < 1 || audioFillDuration > clock$1.ONE_SECOND_IN_TS / 2) {\n return;\n }\n silentFrame = coneOfSilence()[track.samplerate];\n if (!silentFrame) {\n // we don't have a silent frame pregenerated for the sample rate, so use a frame\n // from the content instead\n silentFrame = frames[0].data;\n }\n for (i = 0; i < audioFillFrameCount; i++) {\n firstFrame = frames[0];\n frames.splice(0, 0, {\n data: silentFrame,\n dts: firstFrame.dts - frameDuration,\n pts: firstFrame.pts - frameDuration\n });\n }\n track.baseMediaDecodeTime -= Math.floor(clock$1.videoTsToAudioTs(audioFillDuration, track.samplerate));\n return audioFillDuration;\n }; // If the audio segment extends before the earliest allowed dts\n // value, remove AAC frames until starts at or after the earliest\n // allowed DTS so that we don't end up with a negative baseMedia-\n // DecodeTime for the audio track\n\n var trimAdtsFramesByEarliestDts = function (adtsFrames, track, earliestAllowedDts) {\n if (track.minSegmentDts >= earliestAllowedDts) {\n return adtsFrames;\n } // We will need to recalculate the earliest segment Dts\n\n track.minSegmentDts = Infinity;\n return adtsFrames.filter(function (currentFrame) {\n // If this is an allowed frame, keep it and record it's Dts\n if (currentFrame.dts >= earliestAllowedDts) {\n track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts);\n track.minSegmentPts = track.minSegmentDts;\n return true;\n } // Otherwise, discard it\n\n return false;\n });\n }; // generate the track's raw mdat data from an array of frames\n\n var generateSampleTable = function (frames) {\n var i,\n currentFrame,\n samples = [];\n for (i = 0; i < frames.length; i++) {\n currentFrame = frames[i];\n samples.push({\n size: currentFrame.data.byteLength,\n duration: 1024 // For AAC audio, all samples contain 1024 samples\n });\n }\n\n return samples;\n }; // generate the track's sample table from an array of frames\n\n var concatenateFrameData = function (frames) {\n var i,\n currentFrame,\n dataOffset = 0,\n data = new Uint8Array(sumFrameByteLengths(frames));\n for (i = 0; i < frames.length; i++) {\n currentFrame = frames[i];\n data.set(currentFrame.data, dataOffset);\n dataOffset += currentFrame.data.byteLength;\n }\n return data;\n };\n var audioFrameUtils$1 = {\n prefixWithSilence: prefixWithSilence,\n trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts,\n generateSampleTable: generateSampleTable,\n concatenateFrameData: concatenateFrameData\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var ONE_SECOND_IN_TS$3 = clock$2.ONE_SECOND_IN_TS;\n /**\n * Store information about the start and end of the track and the\n * duration for each frame/sample we process in order to calculate\n * the baseMediaDecodeTime\n */\n\n var collectDtsInfo = function (track, data) {\n if (typeof data.pts === 'number') {\n if (track.timelineStartInfo.pts === undefined) {\n track.timelineStartInfo.pts = data.pts;\n }\n if (track.minSegmentPts === undefined) {\n track.minSegmentPts = data.pts;\n } else {\n track.minSegmentPts = Math.min(track.minSegmentPts, data.pts);\n }\n if (track.maxSegmentPts === undefined) {\n track.maxSegmentPts = data.pts;\n } else {\n track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts);\n }\n }\n if (typeof data.dts === 'number') {\n if (track.timelineStartInfo.dts === undefined) {\n track.timelineStartInfo.dts = data.dts;\n }\n if (track.minSegmentDts === undefined) {\n track.minSegmentDts = data.dts;\n } else {\n track.minSegmentDts = Math.min(track.minSegmentDts, data.dts);\n }\n if (track.maxSegmentDts === undefined) {\n track.maxSegmentDts = data.dts;\n } else {\n track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts);\n }\n }\n };\n /**\n * Clear values used to calculate the baseMediaDecodeTime between\n * tracks\n */\n\n var clearDtsInfo = function (track) {\n delete track.minSegmentDts;\n delete track.maxSegmentDts;\n delete track.minSegmentPts;\n delete track.maxSegmentPts;\n };\n /**\n * Calculate the track's baseMediaDecodeTime based on the earliest\n * DTS the transmuxer has ever seen and the minimum DTS for the\n * current track\n * @param track {object} track metadata configuration\n * @param keepOriginalTimestamps {boolean} If true, keep the timestamps\n * in the source; false to adjust the first segment to start at 0.\n */\n\n var calculateTrackBaseMediaDecodeTime = function (track, keepOriginalTimestamps) {\n var baseMediaDecodeTime,\n scale,\n minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero.\n\n if (!keepOriginalTimestamps) {\n minSegmentDts -= track.timelineStartInfo.dts;\n } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where\n // we want the start of the first segment to be placed\n\n baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first\n\n baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative\n\n baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime);\n if (track.type === 'audio') {\n // Audio has a different clock equal to the sampling_rate so we need to\n // scale the PTS values into the clock rate of the track\n scale = track.samplerate / ONE_SECOND_IN_TS$3;\n baseMediaDecodeTime *= scale;\n baseMediaDecodeTime = Math.floor(baseMediaDecodeTime);\n }\n return baseMediaDecodeTime;\n };\n var trackDecodeInfo$1 = {\n clearDtsInfo: clearDtsInfo,\n calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime,\n collectDtsInfo: collectDtsInfo\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Reads in-band caption information from a video elementary\n * stream. Captions must follow the CEA-708 standard for injection\n * into an MPEG-2 transport streams.\n * @see https://en.wikipedia.org/wiki/CEA-708\n * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf\n */\n // payload type field to indicate how they are to be\n // interpreted. CEAS-708 caption content is always transmitted with\n // payload type 0x04.\n\n var USER_DATA_REGISTERED_ITU_T_T35 = 4,\n RBSP_TRAILING_BITS = 128;\n /**\n * Parse a supplemental enhancement information (SEI) NAL unit.\n * Stops parsing once a message of type ITU T T35 has been found.\n *\n * @param bytes {Uint8Array} the bytes of a SEI NAL unit\n * @return {object} the parsed SEI payload\n * @see Rec. ITU-T H.264, 7.3.2.3.1\n */\n\n var parseSei = function (bytes) {\n var i = 0,\n result = {\n payloadType: -1,\n payloadSize: 0\n },\n payloadType = 0,\n payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message\n\n while (i < bytes.byteLength) {\n // stop once we have hit the end of the sei_rbsp\n if (bytes[i] === RBSP_TRAILING_BITS) {\n break;\n } // Parse payload type\n\n while (bytes[i] === 0xFF) {\n payloadType += 255;\n i++;\n }\n payloadType += bytes[i++]; // Parse payload size\n\n while (bytes[i] === 0xFF) {\n payloadSize += 255;\n i++;\n }\n payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break\n // there can only ever be one caption message in a frame's sei\n\n if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) {\n var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]);\n if (userIdentifier === 'GA94') {\n result.payloadType = payloadType;\n result.payloadSize = payloadSize;\n result.payload = bytes.subarray(i, i + payloadSize);\n break;\n } else {\n result.payload = void 0;\n }\n } // skip the payload and parse the next message\n\n i += payloadSize;\n payloadType = 0;\n payloadSize = 0;\n }\n return result;\n }; // see ANSI/SCTE 128-1 (2013), section 8.1\n\n var parseUserData = function (sei) {\n // itu_t_t35_contry_code must be 181 (United States) for\n // captions\n if (sei.payload[0] !== 181) {\n return null;\n } // itu_t_t35_provider_code should be 49 (ATSC) for captions\n\n if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) {\n return null;\n } // the user_identifier should be \"GA94\" to indicate ATSC1 data\n\n if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') {\n return null;\n } // finally, user_data_type_code should be 0x03 for caption data\n\n if (sei.payload[7] !== 0x03) {\n return null;\n } // return the user_data_type_structure and strip the trailing\n // marker bits\n\n return sei.payload.subarray(8, sei.payload.length - 1);\n }; // see CEA-708-D, section 4.4\n\n var parseCaptionPackets = function (pts, userData) {\n var results = [],\n i,\n count,\n offset,\n data; // if this is just filler, return immediately\n\n if (!(userData[0] & 0x40)) {\n return results;\n } // parse out the cc_data_1 and cc_data_2 fields\n\n count = userData[0] & 0x1f;\n for (i = 0; i < count; i++) {\n offset = i * 3;\n data = {\n type: userData[offset + 2] & 0x03,\n pts: pts\n }; // capture cc data when cc_valid is 1\n\n if (userData[offset + 2] & 0x04) {\n data.ccData = userData[offset + 3] << 8 | userData[offset + 4];\n results.push(data);\n }\n }\n return results;\n };\n var discardEmulationPreventionBytes$1 = function (data) {\n var length = data.byteLength,\n emulationPreventionBytesPositions = [],\n i = 1,\n newLength,\n newData; // Find all `Emulation Prevention Bytes`\n\n while (i < length - 2) {\n if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) {\n emulationPreventionBytesPositions.push(i + 2);\n i += 2;\n } else {\n i++;\n }\n } // If no Emulation Prevention Bytes were found just return the original\n // array\n\n if (emulationPreventionBytesPositions.length === 0) {\n return data;\n } // Create a new array to hold the NAL unit data\n\n newLength = length - emulationPreventionBytesPositions.length;\n newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === emulationPreventionBytesPositions[0]) {\n // Skip this byte\n sourceIndex++; // Remove this position index\n\n emulationPreventionBytesPositions.shift();\n }\n newData[i] = data[sourceIndex];\n }\n return newData;\n }; // exports\n\n var captionPacketParser = {\n parseSei: parseSei,\n parseUserData: parseUserData,\n parseCaptionPackets: parseCaptionPackets,\n discardEmulationPreventionBytes: discardEmulationPreventionBytes$1,\n USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Reads in-band caption information from a video elementary\n * stream. Captions must follow the CEA-708 standard for injection\n * into an MPEG-2 transport streams.\n * @see https://en.wikipedia.org/wiki/CEA-708\n * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf\n */\n // Link To Transport\n // -----------------\n\n var Stream$7 = stream;\n var cea708Parser = captionPacketParser;\n var CaptionStream$2 = function (options) {\n options = options || {};\n CaptionStream$2.prototype.init.call(this); // parse708captions flag, default to true\n\n this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true;\n this.captionPackets_ = [];\n this.ccStreams_ = [new Cea608Stream(0, 0),\n // eslint-disable-line no-use-before-define\n new Cea608Stream(0, 1),\n // eslint-disable-line no-use-before-define\n new Cea608Stream(1, 0),\n // eslint-disable-line no-use-before-define\n new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define\n ];\n\n if (this.parse708captions_) {\n this.cc708Stream_ = new Cea708Stream({\n captionServices: options.captionServices\n }); // eslint-disable-line no-use-before-define\n }\n\n this.reset(); // forward data and done events from CCs to this CaptionStream\n\n this.ccStreams_.forEach(function (cc) {\n cc.on('data', this.trigger.bind(this, 'data'));\n cc.on('partialdone', this.trigger.bind(this, 'partialdone'));\n cc.on('done', this.trigger.bind(this, 'done'));\n }, this);\n if (this.parse708captions_) {\n this.cc708Stream_.on('data', this.trigger.bind(this, 'data'));\n this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone'));\n this.cc708Stream_.on('done', this.trigger.bind(this, 'done'));\n }\n };\n CaptionStream$2.prototype = new Stream$7();\n CaptionStream$2.prototype.push = function (event) {\n var sei, userData, newCaptionPackets; // only examine SEI NALs\n\n if (event.nalUnitType !== 'sei_rbsp') {\n return;\n } // parse the sei\n\n sei = cea708Parser.parseSei(event.escapedRBSP); // no payload data, skip\n\n if (!sei.payload) {\n return;\n } // ignore everything but user_data_registered_itu_t_t35\n\n if (sei.payloadType !== cea708Parser.USER_DATA_REGISTERED_ITU_T_T35) {\n return;\n } // parse out the user data payload\n\n userData = cea708Parser.parseUserData(sei); // ignore unrecognized userData\n\n if (!userData) {\n return;\n } // Sometimes, the same segment # will be downloaded twice. To stop the\n // caption data from being processed twice, we track the latest dts we've\n // received and ignore everything with a dts before that. However, since\n // data for a specific dts can be split across packets on either side of\n // a segment boundary, we need to make sure we *don't* ignore the packets\n // from the *next* segment that have dts === this.latestDts_. By constantly\n // tracking the number of packets received with dts === this.latestDts_, we\n // know how many should be ignored once we start receiving duplicates.\n\n if (event.dts < this.latestDts_) {\n // We've started getting older data, so set the flag.\n this.ignoreNextEqualDts_ = true;\n return;\n } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) {\n this.numSameDts_--;\n if (!this.numSameDts_) {\n // We've received the last duplicate packet, time to start processing again\n this.ignoreNextEqualDts_ = false;\n }\n return;\n } // parse out CC data packets and save them for later\n\n newCaptionPackets = cea708Parser.parseCaptionPackets(event.pts, userData);\n this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets);\n if (this.latestDts_ !== event.dts) {\n this.numSameDts_ = 0;\n }\n this.numSameDts_++;\n this.latestDts_ = event.dts;\n };\n CaptionStream$2.prototype.flushCCStreams = function (flushType) {\n this.ccStreams_.forEach(function (cc) {\n return flushType === 'flush' ? cc.flush() : cc.partialFlush();\n }, this);\n };\n CaptionStream$2.prototype.flushStream = function (flushType) {\n // make sure we actually parsed captions before proceeding\n if (!this.captionPackets_.length) {\n this.flushCCStreams(flushType);\n return;\n } // In Chrome, the Array#sort function is not stable so add a\n // presortIndex that we can use to ensure we get a stable-sort\n\n this.captionPackets_.forEach(function (elem, idx) {\n elem.presortIndex = idx;\n }); // sort caption byte-pairs based on their PTS values\n\n this.captionPackets_.sort(function (a, b) {\n if (a.pts === b.pts) {\n return a.presortIndex - b.presortIndex;\n }\n return a.pts - b.pts;\n });\n this.captionPackets_.forEach(function (packet) {\n if (packet.type < 2) {\n // Dispatch packet to the right Cea608Stream\n this.dispatchCea608Packet(packet);\n } else {\n // Dispatch packet to the Cea708Stream\n this.dispatchCea708Packet(packet);\n }\n }, this);\n this.captionPackets_.length = 0;\n this.flushCCStreams(flushType);\n };\n CaptionStream$2.prototype.flush = function () {\n return this.flushStream('flush');\n }; // Only called if handling partial data\n\n CaptionStream$2.prototype.partialFlush = function () {\n return this.flushStream('partialFlush');\n };\n CaptionStream$2.prototype.reset = function () {\n this.latestDts_ = null;\n this.ignoreNextEqualDts_ = false;\n this.numSameDts_ = 0;\n this.activeCea608Channel_ = [null, null];\n this.ccStreams_.forEach(function (ccStream) {\n ccStream.reset();\n });\n }; // From the CEA-608 spec:\n\n /*\n * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed\n * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is\n * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair\n * and subsequent data should then be processed according to the FCC rules. It may be necessary for the\n * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD)\n * to switch to captioning or Text.\n */\n // With that in mind, we ignore any data between an XDS control code and a\n // subsequent closed-captioning control code.\n\n CaptionStream$2.prototype.dispatchCea608Packet = function (packet) {\n // NOTE: packet.type is the CEA608 field\n if (this.setsTextOrXDSActive(packet)) {\n this.activeCea608Channel_[packet.type] = null;\n } else if (this.setsChannel1Active(packet)) {\n this.activeCea608Channel_[packet.type] = 0;\n } else if (this.setsChannel2Active(packet)) {\n this.activeCea608Channel_[packet.type] = 1;\n }\n if (this.activeCea608Channel_[packet.type] === null) {\n // If we haven't received anything to set the active channel, or the\n // packets are Text/XDS data, discard the data; we don't want jumbled\n // captions\n return;\n }\n this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet);\n };\n CaptionStream$2.prototype.setsChannel1Active = function (packet) {\n return (packet.ccData & 0x7800) === 0x1000;\n };\n CaptionStream$2.prototype.setsChannel2Active = function (packet) {\n return (packet.ccData & 0x7800) === 0x1800;\n };\n CaptionStream$2.prototype.setsTextOrXDSActive = function (packet) {\n return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a;\n };\n CaptionStream$2.prototype.dispatchCea708Packet = function (packet) {\n if (this.parse708captions_) {\n this.cc708Stream_.push(packet);\n }\n }; // ----------------------\n // Session to Application\n // ----------------------\n // This hash maps special and extended character codes to their\n // proper Unicode equivalent. The first one-byte key is just a\n // non-standard character code. The two-byte keys that follow are\n // the extended CEA708 character codes, along with the preceding\n // 0x10 extended character byte to distinguish these codes from\n // non-extended character codes. Every CEA708 character code that\n // is not in this object maps directly to a standard unicode\n // character code.\n // The transparent space and non-breaking transparent space are\n // technically not fully supported since there is no code to\n // make them transparent, so they have normal non-transparent\n // stand-ins.\n // The special closed caption (CC) character isn't a standard\n // unicode character, so a fairly similar unicode character was\n // chosen in it's place.\n\n var CHARACTER_TRANSLATION_708 = {\n 0x7f: 0x266a,\n // ♪\n 0x1020: 0x20,\n // Transparent Space\n 0x1021: 0xa0,\n // Nob-breaking Transparent Space\n 0x1025: 0x2026,\n // …\n 0x102a: 0x0160,\n // Š\n 0x102c: 0x0152,\n // Œ\n 0x1030: 0x2588,\n // █\n 0x1031: 0x2018,\n // ‘\n 0x1032: 0x2019,\n // ’\n 0x1033: 0x201c,\n // “\n 0x1034: 0x201d,\n // ”\n 0x1035: 0x2022,\n // •\n 0x1039: 0x2122,\n // ™\n 0x103a: 0x0161,\n // š\n 0x103c: 0x0153,\n // œ\n 0x103d: 0x2120,\n // ℠\n 0x103f: 0x0178,\n // Ÿ\n 0x1076: 0x215b,\n // ⅛\n 0x1077: 0x215c,\n // ⅜\n 0x1078: 0x215d,\n // ⅝\n 0x1079: 0x215e,\n // ⅞\n 0x107a: 0x23d0,\n // ⏐\n 0x107b: 0x23a4,\n // ⎤\n 0x107c: 0x23a3,\n // ⎣\n 0x107d: 0x23af,\n // ⎯\n 0x107e: 0x23a6,\n // ⎦\n 0x107f: 0x23a1,\n // ⎡\n 0x10a0: 0x3138 // ㄸ (CC char)\n };\n\n var get708CharFromCode = function (code) {\n var newCode = CHARACTER_TRANSLATION_708[code] || code;\n if (code & 0x1000 && code === newCode) {\n // Invalid extended code\n return '';\n }\n return String.fromCharCode(newCode);\n };\n var within708TextBlock = function (b) {\n return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff;\n };\n var Cea708Window = function (windowNum) {\n this.windowNum = windowNum;\n this.reset();\n };\n Cea708Window.prototype.reset = function () {\n this.clearText();\n this.pendingNewLine = false;\n this.winAttr = {};\n this.penAttr = {};\n this.penLoc = {};\n this.penColor = {}; // These default values are arbitrary,\n // defineWindow will usually override them\n\n this.visible = 0;\n this.rowLock = 0;\n this.columnLock = 0;\n this.priority = 0;\n this.relativePositioning = 0;\n this.anchorVertical = 0;\n this.anchorHorizontal = 0;\n this.anchorPoint = 0;\n this.rowCount = 1;\n this.virtualRowCount = this.rowCount + 1;\n this.columnCount = 41;\n this.windowStyle = 0;\n this.penStyle = 0;\n };\n Cea708Window.prototype.getText = function () {\n return this.rows.join('\\n');\n };\n Cea708Window.prototype.clearText = function () {\n this.rows = [''];\n this.rowIdx = 0;\n };\n Cea708Window.prototype.newLine = function (pts) {\n if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') {\n this.beforeRowOverflow(pts);\n }\n if (this.rows.length > 0) {\n this.rows.push('');\n this.rowIdx++;\n } // Show all virtual rows since there's no visible scrolling\n\n while (this.rows.length > this.virtualRowCount) {\n this.rows.shift();\n this.rowIdx--;\n }\n };\n Cea708Window.prototype.isEmpty = function () {\n if (this.rows.length === 0) {\n return true;\n } else if (this.rows.length === 1) {\n return this.rows[0] === '';\n }\n return false;\n };\n Cea708Window.prototype.addText = function (text) {\n this.rows[this.rowIdx] += text;\n };\n Cea708Window.prototype.backspace = function () {\n if (!this.isEmpty()) {\n var row = this.rows[this.rowIdx];\n this.rows[this.rowIdx] = row.substr(0, row.length - 1);\n }\n };\n var Cea708Service = function (serviceNum, encoding, stream) {\n this.serviceNum = serviceNum;\n this.text = '';\n this.currentWindow = new Cea708Window(-1);\n this.windows = [];\n this.stream = stream; // Try to setup a TextDecoder if an `encoding` value was provided\n\n if (typeof encoding === 'string') {\n this.createTextDecoder(encoding);\n }\n };\n /**\n * Initialize service windows\n * Must be run before service use\n *\n * @param {Integer} pts PTS value\n * @param {Function} beforeRowOverflow Function to execute before row overflow of a window\n */\n\n Cea708Service.prototype.init = function (pts, beforeRowOverflow) {\n this.startPts = pts;\n for (var win = 0; win < 8; win++) {\n this.windows[win] = new Cea708Window(win);\n if (typeof beforeRowOverflow === 'function') {\n this.windows[win].beforeRowOverflow = beforeRowOverflow;\n }\n }\n };\n /**\n * Set current window of service to be affected by commands\n *\n * @param {Integer} windowNum Window number\n */\n\n Cea708Service.prototype.setCurrentWindow = function (windowNum) {\n this.currentWindow = this.windows[windowNum];\n };\n /**\n * Try to create a TextDecoder if it is natively supported\n */\n\n Cea708Service.prototype.createTextDecoder = function (encoding) {\n if (typeof TextDecoder === 'undefined') {\n this.stream.trigger('log', {\n level: 'warn',\n message: 'The `encoding` option is unsupported without TextDecoder support'\n });\n } else {\n try {\n this.textDecoder_ = new TextDecoder(encoding);\n } catch (error) {\n this.stream.trigger('log', {\n level: 'warn',\n message: 'TextDecoder could not be created with ' + encoding + ' encoding. ' + error\n });\n }\n }\n };\n var Cea708Stream = function (options) {\n options = options || {};\n Cea708Stream.prototype.init.call(this);\n var self = this;\n var captionServices = options.captionServices || {};\n var captionServiceEncodings = {};\n var serviceProps; // Get service encodings from captionServices option block\n\n Object.keys(captionServices).forEach(serviceName => {\n serviceProps = captionServices[serviceName];\n if (/^SERVICE/.test(serviceName)) {\n captionServiceEncodings[serviceName] = serviceProps.encoding;\n }\n });\n this.serviceEncodings = captionServiceEncodings;\n this.current708Packet = null;\n this.services = {};\n this.push = function (packet) {\n if (packet.type === 3) {\n // 708 packet start\n self.new708Packet();\n self.add708Bytes(packet);\n } else {\n if (self.current708Packet === null) {\n // This should only happen at the start of a file if there's no packet start.\n self.new708Packet();\n }\n self.add708Bytes(packet);\n }\n };\n };\n Cea708Stream.prototype = new Stream$7();\n /**\n * Push current 708 packet, create new 708 packet.\n */\n\n Cea708Stream.prototype.new708Packet = function () {\n if (this.current708Packet !== null) {\n this.push708Packet();\n }\n this.current708Packet = {\n data: [],\n ptsVals: []\n };\n };\n /**\n * Add pts and both bytes from packet into current 708 packet.\n */\n\n Cea708Stream.prototype.add708Bytes = function (packet) {\n var data = packet.ccData;\n var byte0 = data >>> 8;\n var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec\n // that service blocks will always line up with byte pairs.\n\n this.current708Packet.ptsVals.push(packet.pts);\n this.current708Packet.data.push(byte0);\n this.current708Packet.data.push(byte1);\n };\n /**\n * Parse completed 708 packet into service blocks and push each service block.\n */\n\n Cea708Stream.prototype.push708Packet = function () {\n var packet708 = this.current708Packet;\n var packetData = packet708.data;\n var serviceNum = null;\n var blockSize = null;\n var i = 0;\n var b = packetData[i++];\n packet708.seq = b >> 6;\n packet708.sizeCode = b & 0x3f; // 0b00111111;\n\n for (; i < packetData.length; i++) {\n b = packetData[i++];\n serviceNum = b >> 5;\n blockSize = b & 0x1f; // 0b00011111\n\n if (serviceNum === 7 && blockSize > 0) {\n // Extended service num\n b = packetData[i++];\n serviceNum = b;\n }\n this.pushServiceBlock(serviceNum, i, blockSize);\n if (blockSize > 0) {\n i += blockSize - 1;\n }\n }\n };\n /**\n * Parse service block, execute commands, read text.\n *\n * Note: While many of these commands serve important purposes,\n * many others just parse out the parameters or attributes, but\n * nothing is done with them because this is not a full and complete\n * implementation of the entire 708 spec.\n *\n * @param {Integer} serviceNum Service number\n * @param {Integer} start Start index of the 708 packet data\n * @param {Integer} size Block size\n */\n\n Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) {\n var b;\n var i = start;\n var packetData = this.current708Packet.data;\n var service = this.services[serviceNum];\n if (!service) {\n service = this.initService(serviceNum, i);\n }\n for (; i < start + size && i < packetData.length; i++) {\n b = packetData[i];\n if (within708TextBlock(b)) {\n i = this.handleText(i, service);\n } else if (b === 0x18) {\n i = this.multiByteCharacter(i, service);\n } else if (b === 0x10) {\n i = this.extendedCommands(i, service);\n } else if (0x80 <= b && b <= 0x87) {\n i = this.setCurrentWindow(i, service);\n } else if (0x98 <= b && b <= 0x9f) {\n i = this.defineWindow(i, service);\n } else if (b === 0x88) {\n i = this.clearWindows(i, service);\n } else if (b === 0x8c) {\n i = this.deleteWindows(i, service);\n } else if (b === 0x89) {\n i = this.displayWindows(i, service);\n } else if (b === 0x8a) {\n i = this.hideWindows(i, service);\n } else if (b === 0x8b) {\n i = this.toggleWindows(i, service);\n } else if (b === 0x97) {\n i = this.setWindowAttributes(i, service);\n } else if (b === 0x90) {\n i = this.setPenAttributes(i, service);\n } else if (b === 0x91) {\n i = this.setPenColor(i, service);\n } else if (b === 0x92) {\n i = this.setPenLocation(i, service);\n } else if (b === 0x8f) {\n service = this.reset(i, service);\n } else if (b === 0x08) {\n // BS: Backspace\n service.currentWindow.backspace();\n } else if (b === 0x0c) {\n // FF: Form feed\n service.currentWindow.clearText();\n } else if (b === 0x0d) {\n // CR: Carriage return\n service.currentWindow.pendingNewLine = true;\n } else if (b === 0x0e) {\n // HCR: Horizontal carriage return\n service.currentWindow.clearText();\n } else if (b === 0x8d) {\n // DLY: Delay, nothing to do\n i++;\n } else ;\n }\n };\n /**\n * Execute an extended command\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.extendedCommands = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n if (within708TextBlock(b)) {\n i = this.handleText(i, service, {\n isExtended: true\n });\n }\n return i;\n };\n /**\n * Get PTS value of a given byte index\n *\n * @param {Integer} byteIndex Index of the byte\n * @return {Integer} PTS\n */\n\n Cea708Stream.prototype.getPts = function (byteIndex) {\n // There's 1 pts value per 2 bytes\n return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)];\n };\n /**\n * Initializes a service\n *\n * @param {Integer} serviceNum Service number\n * @return {Service} Initialized service object\n */\n\n Cea708Stream.prototype.initService = function (serviceNum, i) {\n var serviceName = 'SERVICE' + serviceNum;\n var self = this;\n var serviceName;\n var encoding;\n if (serviceName in this.serviceEncodings) {\n encoding = this.serviceEncodings[serviceName];\n }\n this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self);\n this.services[serviceNum].init(this.getPts(i), function (pts) {\n self.flushDisplayed(pts, self.services[serviceNum]);\n });\n return this.services[serviceNum];\n };\n /**\n * Execute text writing to current window\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.handleText = function (i, service, options) {\n var isExtended = options && options.isExtended;\n var isMultiByte = options && options.isMultiByte;\n var packetData = this.current708Packet.data;\n var extended = isExtended ? 0x1000 : 0x0000;\n var currentByte = packetData[i];\n var nextByte = packetData[i + 1];\n var win = service.currentWindow;\n var char;\n var charCodeArray; // Converts an array of bytes to a unicode hex string.\n\n function toHexString(byteArray) {\n return byteArray.map(byte => {\n return ('0' + (byte & 0xFF).toString(16)).slice(-2);\n }).join('');\n }\n if (isMultiByte) {\n charCodeArray = [currentByte, nextByte];\n i++;\n } else {\n charCodeArray = [currentByte];\n } // Use the TextDecoder if one was created for this service\n\n if (service.textDecoder_ && !isExtended) {\n char = service.textDecoder_.decode(new Uint8Array(charCodeArray));\n } else {\n // We assume any multi-byte char without a decoder is unicode.\n if (isMultiByte) {\n const unicode = toHexString(charCodeArray); // Takes a unicode hex string and creates a single character.\n\n char = String.fromCharCode(parseInt(unicode, 16));\n } else {\n char = get708CharFromCode(extended | currentByte);\n }\n }\n if (win.pendingNewLine && !win.isEmpty()) {\n win.newLine(this.getPts(i));\n }\n win.pendingNewLine = false;\n win.addText(char);\n return i;\n };\n /**\n * Handle decoding of multibyte character\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.multiByteCharacter = function (i, service) {\n var packetData = this.current708Packet.data;\n var firstByte = packetData[i + 1];\n var secondByte = packetData[i + 2];\n if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) {\n i = this.handleText(++i, service, {\n isMultiByte: true\n });\n }\n return i;\n };\n /**\n * Parse and execute the CW# command.\n *\n * Set the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.setCurrentWindow = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var windowNum = b & 0x07;\n service.setCurrentWindow(windowNum);\n return i;\n };\n /**\n * Parse and execute the DF# command.\n *\n * Define a window and set it as the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.defineWindow = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var windowNum = b & 0x07;\n service.setCurrentWindow(windowNum);\n var win = service.currentWindow;\n b = packetData[++i];\n win.visible = (b & 0x20) >> 5; // v\n\n win.rowLock = (b & 0x10) >> 4; // rl\n\n win.columnLock = (b & 0x08) >> 3; // cl\n\n win.priority = b & 0x07; // p\n\n b = packetData[++i];\n win.relativePositioning = (b & 0x80) >> 7; // rp\n\n win.anchorVertical = b & 0x7f; // av\n\n b = packetData[++i];\n win.anchorHorizontal = b; // ah\n\n b = packetData[++i];\n win.anchorPoint = (b & 0xf0) >> 4; // ap\n\n win.rowCount = b & 0x0f; // rc\n\n b = packetData[++i];\n win.columnCount = b & 0x3f; // cc\n\n b = packetData[++i];\n win.windowStyle = (b & 0x38) >> 3; // ws\n\n win.penStyle = b & 0x07; // ps\n // The spec says there are (rowCount+1) \"virtual rows\"\n\n win.virtualRowCount = win.rowCount + 1;\n return i;\n };\n /**\n * Parse and execute the SWA command.\n *\n * Set attributes of the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.setWindowAttributes = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var winAttr = service.currentWindow.winAttr;\n b = packetData[++i];\n winAttr.fillOpacity = (b & 0xc0) >> 6; // fo\n\n winAttr.fillRed = (b & 0x30) >> 4; // fr\n\n winAttr.fillGreen = (b & 0x0c) >> 2; // fg\n\n winAttr.fillBlue = b & 0x03; // fb\n\n b = packetData[++i];\n winAttr.borderType = (b & 0xc0) >> 6; // bt\n\n winAttr.borderRed = (b & 0x30) >> 4; // br\n\n winAttr.borderGreen = (b & 0x0c) >> 2; // bg\n\n winAttr.borderBlue = b & 0x03; // bb\n\n b = packetData[++i];\n winAttr.borderType += (b & 0x80) >> 5; // bt\n\n winAttr.wordWrap = (b & 0x40) >> 6; // ww\n\n winAttr.printDirection = (b & 0x30) >> 4; // pd\n\n winAttr.scrollDirection = (b & 0x0c) >> 2; // sd\n\n winAttr.justify = b & 0x03; // j\n\n b = packetData[++i];\n winAttr.effectSpeed = (b & 0xf0) >> 4; // es\n\n winAttr.effectDirection = (b & 0x0c) >> 2; // ed\n\n winAttr.displayEffect = b & 0x03; // de\n\n return i;\n };\n /**\n * Gather text from all displayed windows and push a caption to output.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n */\n\n Cea708Stream.prototype.flushDisplayed = function (pts, service) {\n var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily\n // display text in the correct order, but sample files so far have not shown any issue.\n\n for (var winId = 0; winId < 8; winId++) {\n if (service.windows[winId].visible && !service.windows[winId].isEmpty()) {\n displayedText.push(service.windows[winId].getText());\n }\n }\n service.endPts = pts;\n service.text = displayedText.join('\\n\\n');\n this.pushCaption(service);\n service.startPts = pts;\n };\n /**\n * Push a caption to output if the caption contains text.\n *\n * @param {Service} service The service object to be affected\n */\n\n Cea708Stream.prototype.pushCaption = function (service) {\n if (service.text !== '') {\n this.trigger('data', {\n startPts: service.startPts,\n endPts: service.endPts,\n text: service.text,\n stream: 'cc708_' + service.serviceNum\n });\n service.text = '';\n service.startPts = service.endPts;\n }\n };\n /**\n * Parse and execute the DSW command.\n *\n * Set visible property of windows based on the parsed bitmask.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.displayWindows = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n for (var winId = 0; winId < 8; winId++) {\n if (b & 0x01 << winId) {\n service.windows[winId].visible = 1;\n }\n }\n return i;\n };\n /**\n * Parse and execute the HDW command.\n *\n * Set visible property of windows based on the parsed bitmask.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.hideWindows = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n for (var winId = 0; winId < 8; winId++) {\n if (b & 0x01 << winId) {\n service.windows[winId].visible = 0;\n }\n }\n return i;\n };\n /**\n * Parse and execute the TGW command.\n *\n * Set visible property of windows based on the parsed bitmask.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.toggleWindows = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n for (var winId = 0; winId < 8; winId++) {\n if (b & 0x01 << winId) {\n service.windows[winId].visible ^= 1;\n }\n }\n return i;\n };\n /**\n * Parse and execute the CLW command.\n *\n * Clear text of windows based on the parsed bitmask.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.clearWindows = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n for (var winId = 0; winId < 8; winId++) {\n if (b & 0x01 << winId) {\n service.windows[winId].clearText();\n }\n }\n return i;\n };\n /**\n * Parse and execute the DLW command.\n *\n * Re-initialize windows based on the parsed bitmask.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.deleteWindows = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n for (var winId = 0; winId < 8; winId++) {\n if (b & 0x01 << winId) {\n service.windows[winId].reset();\n }\n }\n return i;\n };\n /**\n * Parse and execute the SPA command.\n *\n * Set pen attributes of the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.setPenAttributes = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var penAttr = service.currentWindow.penAttr;\n b = packetData[++i];\n penAttr.textTag = (b & 0xf0) >> 4; // tt\n\n penAttr.offset = (b & 0x0c) >> 2; // o\n\n penAttr.penSize = b & 0x03; // s\n\n b = packetData[++i];\n penAttr.italics = (b & 0x80) >> 7; // i\n\n penAttr.underline = (b & 0x40) >> 6; // u\n\n penAttr.edgeType = (b & 0x38) >> 3; // et\n\n penAttr.fontStyle = b & 0x07; // fs\n\n return i;\n };\n /**\n * Parse and execute the SPC command.\n *\n * Set pen color of the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.setPenColor = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var penColor = service.currentWindow.penColor;\n b = packetData[++i];\n penColor.fgOpacity = (b & 0xc0) >> 6; // fo\n\n penColor.fgRed = (b & 0x30) >> 4; // fr\n\n penColor.fgGreen = (b & 0x0c) >> 2; // fg\n\n penColor.fgBlue = b & 0x03; // fb\n\n b = packetData[++i];\n penColor.bgOpacity = (b & 0xc0) >> 6; // bo\n\n penColor.bgRed = (b & 0x30) >> 4; // br\n\n penColor.bgGreen = (b & 0x0c) >> 2; // bg\n\n penColor.bgBlue = b & 0x03; // bb\n\n b = packetData[++i];\n penColor.edgeRed = (b & 0x30) >> 4; // er\n\n penColor.edgeGreen = (b & 0x0c) >> 2; // eg\n\n penColor.edgeBlue = b & 0x03; // eb\n\n return i;\n };\n /**\n * Parse and execute the SPL command.\n *\n * Set pen location of the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n Cea708Stream.prototype.setPenLocation = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak\n\n service.currentWindow.pendingNewLine = true;\n b = packetData[++i];\n penLoc.row = b & 0x0f; // r\n\n b = packetData[++i];\n penLoc.column = b & 0x3f; // c\n\n return i;\n };\n /**\n * Execute the RST command.\n *\n * Reset service to a clean slate. Re-initialize.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Service} Re-initialized service\n */\n\n Cea708Stream.prototype.reset = function (i, service) {\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n return this.initService(service.serviceNum, i);\n }; // This hash maps non-ASCII, special, and extended character codes to their\n // proper Unicode equivalent. The first keys that are only a single byte\n // are the non-standard ASCII characters, which simply map the CEA608 byte\n // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608\n // character codes, but have their MSB bitmasked with 0x03 so that a lookup\n // can be performed regardless of the field and data channel on which the\n // character code was received.\n\n var CHARACTER_TRANSLATION = {\n 0x2a: 0xe1,\n // á\n 0x5c: 0xe9,\n // é\n 0x5e: 0xed,\n // í\n 0x5f: 0xf3,\n // ó\n 0x60: 0xfa,\n // ú\n 0x7b: 0xe7,\n // ç\n 0x7c: 0xf7,\n // ÷\n 0x7d: 0xd1,\n // Ñ\n 0x7e: 0xf1,\n // ñ\n 0x7f: 0x2588,\n // █\n 0x0130: 0xae,\n // ®\n 0x0131: 0xb0,\n // °\n 0x0132: 0xbd,\n // ½\n 0x0133: 0xbf,\n // ¿\n 0x0134: 0x2122,\n // ™\n 0x0135: 0xa2,\n // ¢\n 0x0136: 0xa3,\n // £\n 0x0137: 0x266a,\n // ♪\n 0x0138: 0xe0,\n // à\n 0x0139: 0xa0,\n //\n 0x013a: 0xe8,\n // è\n 0x013b: 0xe2,\n // â\n 0x013c: 0xea,\n // ê\n 0x013d: 0xee,\n // î\n 0x013e: 0xf4,\n // ô\n 0x013f: 0xfb,\n // û\n 0x0220: 0xc1,\n // Á\n 0x0221: 0xc9,\n // É\n 0x0222: 0xd3,\n // Ó\n 0x0223: 0xda,\n // Ú\n 0x0224: 0xdc,\n // Ü\n 0x0225: 0xfc,\n // ü\n 0x0226: 0x2018,\n // ‘\n 0x0227: 0xa1,\n // ¡\n 0x0228: 0x2a,\n // *\n 0x0229: 0x27,\n // '\n 0x022a: 0x2014,\n // —\n 0x022b: 0xa9,\n // ©\n 0x022c: 0x2120,\n // ℠\n 0x022d: 0x2022,\n // •\n 0x022e: 0x201c,\n // “\n 0x022f: 0x201d,\n // ”\n 0x0230: 0xc0,\n // À\n 0x0231: 0xc2,\n // Â\n 0x0232: 0xc7,\n // Ç\n 0x0233: 0xc8,\n // È\n 0x0234: 0xca,\n // Ê\n 0x0235: 0xcb,\n // Ë\n 0x0236: 0xeb,\n // ë\n 0x0237: 0xce,\n // Î\n 0x0238: 0xcf,\n // Ï\n 0x0239: 0xef,\n // ï\n 0x023a: 0xd4,\n // Ô\n 0x023b: 0xd9,\n // Ù\n 0x023c: 0xf9,\n // ù\n 0x023d: 0xdb,\n // Û\n 0x023e: 0xab,\n // «\n 0x023f: 0xbb,\n // »\n 0x0320: 0xc3,\n // Ã\n 0x0321: 0xe3,\n // ã\n 0x0322: 0xcd,\n // Í\n 0x0323: 0xcc,\n // Ì\n 0x0324: 0xec,\n // ì\n 0x0325: 0xd2,\n // Ò\n 0x0326: 0xf2,\n // ò\n 0x0327: 0xd5,\n // Õ\n 0x0328: 0xf5,\n // õ\n 0x0329: 0x7b,\n // {\n 0x032a: 0x7d,\n // }\n 0x032b: 0x5c,\n // \\\n 0x032c: 0x5e,\n // ^\n 0x032d: 0x5f,\n // _\n 0x032e: 0x7c,\n // |\n 0x032f: 0x7e,\n // ~\n 0x0330: 0xc4,\n // Ä\n 0x0331: 0xe4,\n // ä\n 0x0332: 0xd6,\n // Ö\n 0x0333: 0xf6,\n // ö\n 0x0334: 0xdf,\n // ß\n 0x0335: 0xa5,\n // ¥\n 0x0336: 0xa4,\n // ¤\n 0x0337: 0x2502,\n // │\n 0x0338: 0xc5,\n // Å\n 0x0339: 0xe5,\n // å\n 0x033a: 0xd8,\n // Ø\n 0x033b: 0xf8,\n // ø\n 0x033c: 0x250c,\n // ┌\n 0x033d: 0x2510,\n // ┐\n 0x033e: 0x2514,\n // └\n 0x033f: 0x2518 // ┘\n };\n\n var getCharFromCode = function (code) {\n if (code === null) {\n return '';\n }\n code = CHARACTER_TRANSLATION[code] || code;\n return String.fromCharCode(code);\n }; // the index of the last row in a CEA-608 display buffer\n\n var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of\n // getting it through bit logic.\n\n var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character\n // cells. The \"bottom\" row is the last element in the outer array.\n // We keep track of positioning information as we go by storing the\n // number of indentations and the tab offset in this buffer.\n\n var createDisplayBuffer = function () {\n var result = [],\n i = BOTTOM_ROW + 1;\n while (i--) {\n result.push({\n text: '',\n indent: 0,\n offset: 0\n });\n }\n return result;\n };\n var Cea608Stream = function (field, dataChannel) {\n Cea608Stream.prototype.init.call(this);\n this.field_ = field || 0;\n this.dataChannel_ = dataChannel || 0;\n this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1);\n this.setConstants();\n this.reset();\n this.push = function (packet) {\n var data, swap, char0, char1, text; // remove the parity bits\n\n data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice\n\n if (data === this.lastControlCode_) {\n this.lastControlCode_ = null;\n return;\n } // Store control codes\n\n if ((data & 0xf000) === 0x1000) {\n this.lastControlCode_ = data;\n } else if (data !== this.PADDING_) {\n this.lastControlCode_ = null;\n }\n char0 = data >>> 8;\n char1 = data & 0xff;\n if (data === this.PADDING_) {\n return;\n } else if (data === this.RESUME_CAPTION_LOADING_) {\n this.mode_ = 'popOn';\n } else if (data === this.END_OF_CAPTION_) {\n // If an EOC is received while in paint-on mode, the displayed caption\n // text should be swapped to non-displayed memory as if it was a pop-on\n // caption. Because of that, we should explicitly switch back to pop-on\n // mode\n this.mode_ = 'popOn';\n this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now\n\n this.flushDisplayed(packet.pts); // flip memory\n\n swap = this.displayed_;\n this.displayed_ = this.nonDisplayed_;\n this.nonDisplayed_ = swap; // start measuring the time to display the caption\n\n this.startPts_ = packet.pts;\n } else if (data === this.ROLL_UP_2_ROWS_) {\n this.rollUpRows_ = 2;\n this.setRollUp(packet.pts);\n } else if (data === this.ROLL_UP_3_ROWS_) {\n this.rollUpRows_ = 3;\n this.setRollUp(packet.pts);\n } else if (data === this.ROLL_UP_4_ROWS_) {\n this.rollUpRows_ = 4;\n this.setRollUp(packet.pts);\n } else if (data === this.CARRIAGE_RETURN_) {\n this.clearFormatting(packet.pts);\n this.flushDisplayed(packet.pts);\n this.shiftRowsUp_();\n this.startPts_ = packet.pts;\n } else if (data === this.BACKSPACE_) {\n if (this.mode_ === 'popOn') {\n this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1);\n } else {\n this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1);\n }\n } else if (data === this.ERASE_DISPLAYED_MEMORY_) {\n this.flushDisplayed(packet.pts);\n this.displayed_ = createDisplayBuffer();\n } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) {\n this.nonDisplayed_ = createDisplayBuffer();\n } else if (data === this.RESUME_DIRECT_CAPTIONING_) {\n if (this.mode_ !== 'paintOn') {\n // NOTE: This should be removed when proper caption positioning is\n // implemented\n this.flushDisplayed(packet.pts);\n this.displayed_ = createDisplayBuffer();\n }\n this.mode_ = 'paintOn';\n this.startPts_ = packet.pts; // Append special characters to caption text\n } else if (this.isSpecialCharacter(char0, char1)) {\n // Bitmask char0 so that we can apply character transformations\n // regardless of field and data channel.\n // Then byte-shift to the left and OR with char1 so we can pass the\n // entire character code to `getCharFromCode`.\n char0 = (char0 & 0x03) << 8;\n text = getCharFromCode(char0 | char1);\n this[this.mode_](packet.pts, text);\n this.column_++; // Append extended characters to caption text\n } else if (this.isExtCharacter(char0, char1)) {\n // Extended characters always follow their \"non-extended\" equivalents.\n // IE if a \"è\" is desired, you'll always receive \"eè\"; non-compliant\n // decoders are supposed to drop the \"è\", while compliant decoders\n // backspace the \"e\" and insert \"è\".\n // Delete the previous character\n if (this.mode_ === 'popOn') {\n this.nonDisplayed_[this.row_].text = this.nonDisplayed_[this.row_].text.slice(0, -1);\n } else {\n this.displayed_[this.row_].text = this.displayed_[this.row_].text.slice(0, -1);\n } // Bitmask char0 so that we can apply character transformations\n // regardless of field and data channel.\n // Then byte-shift to the left and OR with char1 so we can pass the\n // entire character code to `getCharFromCode`.\n\n char0 = (char0 & 0x03) << 8;\n text = getCharFromCode(char0 | char1);\n this[this.mode_](packet.pts, text);\n this.column_++; // Process mid-row codes\n } else if (this.isMidRowCode(char0, char1)) {\n // Attributes are not additive, so clear all formatting\n this.clearFormatting(packet.pts); // According to the standard, mid-row codes\n // should be replaced with spaces, so add one now\n\n this[this.mode_](packet.pts, ' ');\n this.column_++;\n if ((char1 & 0xe) === 0xe) {\n this.addFormatting(packet.pts, ['i']);\n }\n if ((char1 & 0x1) === 0x1) {\n this.addFormatting(packet.pts, ['u']);\n } // Detect offset control codes and adjust cursor\n } else if (this.isOffsetControlCode(char0, char1)) {\n // Cursor position is set by indent PAC (see below) in 4-column\n // increments, with an additional offset code of 1-3 to reach any\n // of the 32 columns specified by CEA-608. So all we need to do\n // here is increment the column cursor by the given offset.\n const offset = char1 & 0x03; // For an offest value 1-3, set the offset for that caption\n // in the non-displayed array.\n\n this.nonDisplayed_[this.row_].offset = offset;\n this.column_ += offset; // Detect PACs (Preamble Address Codes)\n } else if (this.isPAC(char0, char1)) {\n // There's no logic for PAC -> row mapping, so we have to just\n // find the row code in an array and use its index :(\n var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode\n\n if (this.mode_ === 'rollUp') {\n // This implies that the base row is incorrectly set.\n // As per the recommendation in CEA-608(Base Row Implementation), defer to the number\n // of roll-up rows set.\n if (row - this.rollUpRows_ + 1 < 0) {\n row = this.rollUpRows_ - 1;\n }\n this.setRollUp(packet.pts, row);\n }\n if (row !== this.row_) {\n // formatting is only persistent for current row\n this.clearFormatting(packet.pts);\n this.row_ = row;\n } // All PACs can apply underline, so detect and apply\n // (All odd-numbered second bytes set underline)\n\n if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) {\n this.addFormatting(packet.pts, ['u']);\n }\n if ((data & 0x10) === 0x10) {\n // We've got an indent level code. Each successive even number\n // increments the column cursor by 4, so we can get the desired\n // column position by bit-shifting to the right (to get n/2)\n // and multiplying by 4.\n const indentations = (data & 0xe) >> 1;\n this.column_ = indentations * 4; // add to the number of indentations for positioning\n\n this.nonDisplayed_[this.row_].indent += indentations;\n }\n if (this.isColorPAC(char1)) {\n // it's a color code, though we only support white, which\n // can be either normal or italicized. white italics can be\n // either 0x4e or 0x6e depending on the row, so we just\n // bitwise-and with 0xe to see if italics should be turned on\n if ((char1 & 0xe) === 0xe) {\n this.addFormatting(packet.pts, ['i']);\n }\n } // We have a normal character in char0, and possibly one in char1\n } else if (this.isNormalChar(char0)) {\n if (char1 === 0x00) {\n char1 = null;\n }\n text = getCharFromCode(char0);\n text += getCharFromCode(char1);\n this[this.mode_](packet.pts, text);\n this.column_ += text.length;\n } // finish data processing\n };\n };\n\n Cea608Stream.prototype = new Stream$7(); // Trigger a cue point that captures the current state of the\n // display buffer\n\n Cea608Stream.prototype.flushDisplayed = function (pts) {\n const logWarning = index => {\n this.trigger('log', {\n level: 'warn',\n message: 'Skipping a malformed 608 caption at index ' + index + '.'\n });\n };\n const content = [];\n this.displayed_.forEach((row, i) => {\n if (row && row.text && row.text.length) {\n try {\n // remove spaces from the start and end of the string\n row.text = row.text.trim();\n } catch (e) {\n // Ordinarily, this shouldn't happen. However, caption\n // parsing errors should not throw exceptions and\n // break playback.\n logWarning(i);\n } // See the below link for more details on the following fields:\n // https://dvcs.w3.org/hg/text-tracks/raw-file/default/608toVTT/608toVTT.html#positioning-in-cea-608\n\n if (row.text.length) {\n content.push({\n // The text to be displayed in the caption from this specific row, with whitespace removed.\n text: row.text,\n // Value between 1 and 15 representing the PAC row used to calculate line height.\n line: i + 1,\n // A number representing the indent position by percentage (CEA-608 PAC indent code).\n // The value will be a number between 10 and 80. Offset is used to add an aditional\n // value to the position if necessary.\n position: 10 + Math.min(70, row.indent * 10) + row.offset * 2.5\n });\n }\n } else if (row === undefined || row === null) {\n logWarning(i);\n }\n });\n if (content.length) {\n this.trigger('data', {\n startPts: this.startPts_,\n endPts: pts,\n content,\n stream: this.name_\n });\n }\n };\n /**\n * Zero out the data, used for startup and on seek\n */\n\n Cea608Stream.prototype.reset = function () {\n this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will\n // actually display captions. If a caption is shifted to a row\n // with a lower index than this, it is cleared from the display\n // buffer\n\n this.topRow_ = 0;\n this.startPts_ = 0;\n this.displayed_ = createDisplayBuffer();\n this.nonDisplayed_ = createDisplayBuffer();\n this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing\n\n this.column_ = 0;\n this.row_ = BOTTOM_ROW;\n this.rollUpRows_ = 2; // This variable holds currently-applied formatting\n\n this.formatting_ = [];\n };\n /**\n * Sets up control code and related constants for this instance\n */\n\n Cea608Stream.prototype.setConstants = function () {\n // The following attributes have these uses:\n // ext_ : char0 for mid-row codes, and the base for extended\n // chars (ext_+0, ext_+1, and ext_+2 are char0s for\n // extended codes)\n // control_: char0 for control codes, except byte-shifted to the\n // left so that we can do this.control_ | CONTROL_CODE\n // offset_: char0 for tab offset codes\n //\n // It's also worth noting that control codes, and _only_ control codes,\n // differ between field 1 and field2. Field 2 control codes are always\n // their field 1 value plus 1. That's why there's the \"| field\" on the\n // control value.\n if (this.dataChannel_ === 0) {\n this.BASE_ = 0x10;\n this.EXT_ = 0x11;\n this.CONTROL_ = (0x14 | this.field_) << 8;\n this.OFFSET_ = 0x17;\n } else if (this.dataChannel_ === 1) {\n this.BASE_ = 0x18;\n this.EXT_ = 0x19;\n this.CONTROL_ = (0x1c | this.field_) << 8;\n this.OFFSET_ = 0x1f;\n } // Constants for the LSByte command codes recognized by Cea608Stream. This\n // list is not exhaustive. For a more comprehensive listing and semantics see\n // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf\n // Padding\n\n this.PADDING_ = 0x0000; // Pop-on Mode\n\n this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20;\n this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode\n\n this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25;\n this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26;\n this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27;\n this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode\n\n this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure\n\n this.BACKSPACE_ = this.CONTROL_ | 0x21;\n this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c;\n this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e;\n };\n /**\n * Detects if the 2-byte packet data is a special character\n *\n * Special characters have a second byte in the range 0x30 to 0x3f,\n * with the first byte being 0x11 (for data channel 1) or 0x19 (for\n * data channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are an special character\n */\n\n Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) {\n return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f;\n };\n /**\n * Detects if the 2-byte packet data is an extended character\n *\n * Extended characters have a second byte in the range 0x20 to 0x3f,\n * with the first byte being 0x12 or 0x13 (for data channel 1) or\n * 0x1a or 0x1b (for data channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are an extended character\n */\n\n Cea608Stream.prototype.isExtCharacter = function (char0, char1) {\n return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f;\n };\n /**\n * Detects if the 2-byte packet is a mid-row code\n *\n * Mid-row codes have a second byte in the range 0x20 to 0x2f, with\n * the first byte being 0x11 (for data channel 1) or 0x19 (for data\n * channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are a mid-row code\n */\n\n Cea608Stream.prototype.isMidRowCode = function (char0, char1) {\n return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f;\n };\n /**\n * Detects if the 2-byte packet is an offset control code\n *\n * Offset control codes have a second byte in the range 0x21 to 0x23,\n * with the first byte being 0x17 (for data channel 1) or 0x1f (for\n * data channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are an offset control code\n */\n\n Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) {\n return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23;\n };\n /**\n * Detects if the 2-byte packet is a Preamble Address Code\n *\n * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1)\n * or 0x18 to 0x1f (for data channel 2), with the second byte in the\n * range 0x40 to 0x7f.\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are a PAC\n */\n\n Cea608Stream.prototype.isPAC = function (char0, char1) {\n return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f;\n };\n /**\n * Detects if a packet's second byte is in the range of a PAC color code\n *\n * PAC color codes have the second byte be in the range 0x40 to 0x4f, or\n * 0x60 to 0x6f.\n *\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the byte is a color PAC\n */\n\n Cea608Stream.prototype.isColorPAC = function (char1) {\n return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f;\n };\n /**\n * Detects if a single byte is in the range of a normal character\n *\n * Normal text bytes are in the range 0x20 to 0x7f.\n *\n * @param {Integer} char The byte\n * @return {Boolean} Whether the byte is a normal character\n */\n\n Cea608Stream.prototype.isNormalChar = function (char) {\n return char >= 0x20 && char <= 0x7f;\n };\n /**\n * Configures roll-up\n *\n * @param {Integer} pts Current PTS\n * @param {Integer} newBaseRow Used by PACs to slide the current window to\n * a new position\n */\n\n Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) {\n // Reset the base row to the bottom row when switching modes\n if (this.mode_ !== 'rollUp') {\n this.row_ = BOTTOM_ROW;\n this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up\n\n this.flushDisplayed(pts);\n this.nonDisplayed_ = createDisplayBuffer();\n this.displayed_ = createDisplayBuffer();\n }\n if (newBaseRow !== undefined && newBaseRow !== this.row_) {\n // move currently displayed captions (up or down) to the new base row\n for (var i = 0; i < this.rollUpRows_; i++) {\n this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i];\n this.displayed_[this.row_ - i] = {\n text: '',\n indent: 0,\n offset: 0\n };\n }\n }\n if (newBaseRow === undefined) {\n newBaseRow = this.row_;\n }\n this.topRow_ = newBaseRow - this.rollUpRows_ + 1;\n }; // Adds the opening HTML tag for the passed character to the caption text,\n // and keeps track of it for later closing\n\n Cea608Stream.prototype.addFormatting = function (pts, format) {\n this.formatting_ = this.formatting_.concat(format);\n var text = format.reduce(function (text, format) {\n return text + '<' + format + '>';\n }, '');\n this[this.mode_](pts, text);\n }; // Adds HTML closing tags for current formatting to caption text and\n // clears remembered formatting\n\n Cea608Stream.prototype.clearFormatting = function (pts) {\n if (!this.formatting_.length) {\n return;\n }\n var text = this.formatting_.reverse().reduce(function (text, format) {\n return text + '</' + format + '>';\n }, '');\n this.formatting_ = [];\n this[this.mode_](pts, text);\n }; // Mode Implementations\n\n Cea608Stream.prototype.popOn = function (pts, text) {\n var baseRow = this.nonDisplayed_[this.row_].text; // buffer characters\n\n baseRow += text;\n this.nonDisplayed_[this.row_].text = baseRow;\n };\n Cea608Stream.prototype.rollUp = function (pts, text) {\n var baseRow = this.displayed_[this.row_].text;\n baseRow += text;\n this.displayed_[this.row_].text = baseRow;\n };\n Cea608Stream.prototype.shiftRowsUp_ = function () {\n var i; // clear out inactive rows\n\n for (i = 0; i < this.topRow_; i++) {\n this.displayed_[i] = {\n text: '',\n indent: 0,\n offset: 0\n };\n }\n for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) {\n this.displayed_[i] = {\n text: '',\n indent: 0,\n offset: 0\n };\n } // shift displayed rows up\n\n for (i = this.topRow_; i < this.row_; i++) {\n this.displayed_[i] = this.displayed_[i + 1];\n } // clear out the bottom row\n\n this.displayed_[this.row_] = {\n text: '',\n indent: 0,\n offset: 0\n };\n };\n Cea608Stream.prototype.paintOn = function (pts, text) {\n var baseRow = this.displayed_[this.row_].text;\n baseRow += text;\n this.displayed_[this.row_].text = baseRow;\n }; // exports\n\n var captionStream = {\n CaptionStream: CaptionStream$2,\n Cea608Stream: Cea608Stream,\n Cea708Stream: Cea708Stream\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var streamTypes = {\n H264_STREAM_TYPE: 0x1B,\n ADTS_STREAM_TYPE: 0x0F,\n METADATA_STREAM_TYPE: 0x15\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Accepts program elementary stream (PES) data events and corrects\n * decode and presentation time stamps to account for a rollover\n * of the 33 bit value.\n */\n\n var Stream$6 = stream;\n var MAX_TS = 8589934592;\n var RO_THRESH = 4294967296;\n var TYPE_SHARED = 'shared';\n var handleRollover$1 = function (value, reference) {\n var direction = 1;\n if (value > reference) {\n // If the current timestamp value is greater than our reference timestamp and we detect a\n // timestamp rollover, this means the roll over is happening in the opposite direction.\n // Example scenario: Enter a long stream/video just after a rollover occurred. The reference\n // point will be set to a small number, e.g. 1. The user then seeks backwards over the\n // rollover point. In loading this segment, the timestamp values will be very large,\n // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust\n // the time stamp to be `value - 2^33`.\n direction = -1;\n } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will\n // cause an incorrect adjustment.\n\n while (Math.abs(reference - value) > RO_THRESH) {\n value += direction * MAX_TS;\n }\n return value;\n };\n var TimestampRolloverStream$1 = function (type) {\n var lastDTS, referenceDTS;\n TimestampRolloverStream$1.prototype.init.call(this); // The \"shared\" type is used in cases where a stream will contain muxed\n // video and audio. We could use `undefined` here, but having a string\n // makes debugging a little clearer.\n\n this.type_ = type || TYPE_SHARED;\n this.push = function (data) {\n /**\n * Rollover stream expects data from elementary stream.\n * Elementary stream can push forward 2 types of data\n * - Parsed Video/Audio/Timed-metadata PES (packetized elementary stream) packets\n * - Tracks metadata from PMT (Program Map Table)\n * Rollover stream expects pts/dts info to be available, since it stores lastDTS\n * We should ignore non-PES packets since they may override lastDTS to undefined.\n * lastDTS is important to signal the next segments\n * about rollover from the previous segments.\n */\n if (data.type === 'metadata') {\n this.trigger('data', data);\n return;\n } // Any \"shared\" rollover streams will accept _all_ data. Otherwise,\n // streams will only accept data that matches their type.\n\n if (this.type_ !== TYPE_SHARED && data.type !== this.type_) {\n return;\n }\n if (referenceDTS === undefined) {\n referenceDTS = data.dts;\n }\n data.dts = handleRollover$1(data.dts, referenceDTS);\n data.pts = handleRollover$1(data.pts, referenceDTS);\n lastDTS = data.dts;\n this.trigger('data', data);\n };\n this.flush = function () {\n referenceDTS = lastDTS;\n this.trigger('done');\n };\n this.endTimeline = function () {\n this.flush();\n this.trigger('endedtimeline');\n };\n this.discontinuity = function () {\n referenceDTS = void 0;\n lastDTS = void 0;\n };\n this.reset = function () {\n this.discontinuity();\n this.trigger('reset');\n };\n };\n TimestampRolloverStream$1.prototype = new Stream$6();\n var timestampRolloverStream = {\n TimestampRolloverStream: TimestampRolloverStream$1,\n handleRollover: handleRollover$1\n }; // Once IE11 support is dropped, this function should be removed.\n\n var typedArrayIndexOf$1 = (typedArray, element, fromIndex) => {\n if (!typedArray) {\n return -1;\n }\n var currentIndex = fromIndex;\n for (; currentIndex < typedArray.length; currentIndex++) {\n if (typedArray[currentIndex] === element) {\n return currentIndex;\n }\n }\n return -1;\n };\n var typedArray = {\n typedArrayIndexOf: typedArrayIndexOf$1\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Tools for parsing ID3 frame data\n * @see http://id3.org/id3v2.3.0\n */\n\n var typedArrayIndexOf = typedArray.typedArrayIndexOf,\n // Frames that allow different types of text encoding contain a text\n // encoding description byte [ID3v2.4.0 section 4.]\n textEncodingDescriptionByte = {\n Iso88591: 0x00,\n // ISO-8859-1, terminated with \\0.\n Utf16: 0x01,\n // UTF-16 encoded Unicode BOM, terminated with \\0\\0\n Utf16be: 0x02,\n // UTF-16BE encoded Unicode, without BOM, terminated with \\0\\0\n Utf8: 0x03 // UTF-8 encoded Unicode, terminated with \\0\n },\n // return a percent-encoded representation of the specified byte range\n // @see http://en.wikipedia.org/wiki/Percent-encoding \n percentEncode$1 = function (bytes, start, end) {\n var i,\n result = '';\n for (i = start; i < end; i++) {\n result += '%' + ('00' + bytes[i].toString(16)).slice(-2);\n }\n return result;\n },\n // return the string representation of the specified byte range,\n // interpreted as UTf-8.\n parseUtf8 = function (bytes, start, end) {\n return decodeURIComponent(percentEncode$1(bytes, start, end));\n },\n // return the string representation of the specified byte range,\n // interpreted as ISO-8859-1.\n parseIso88591$1 = function (bytes, start, end) {\n return unescape(percentEncode$1(bytes, start, end)); // jshint ignore:line\n },\n parseSyncSafeInteger$1 = function (data) {\n return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];\n },\n frameParsers = {\n 'APIC': function (frame) {\n var i = 1,\n mimeTypeEndIndex,\n descriptionEndIndex,\n LINK_MIME_TYPE = '--\x3e';\n if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {\n // ignore frames with unrecognized character encodings\n return;\n } // parsing fields [ID3v2.4.0 section 4.14.]\n\n mimeTypeEndIndex = typedArrayIndexOf(frame.data, 0, i);\n if (mimeTypeEndIndex < 0) {\n // malformed frame\n return;\n } // parsing Mime type field (terminated with \\0)\n\n frame.mimeType = parseIso88591$1(frame.data, i, mimeTypeEndIndex);\n i = mimeTypeEndIndex + 1; // parsing 1-byte Picture Type field\n\n frame.pictureType = frame.data[i];\n i++;\n descriptionEndIndex = typedArrayIndexOf(frame.data, 0, i);\n if (descriptionEndIndex < 0) {\n // malformed frame\n return;\n } // parsing Description field (terminated with \\0)\n\n frame.description = parseUtf8(frame.data, i, descriptionEndIndex);\n i = descriptionEndIndex + 1;\n if (frame.mimeType === LINK_MIME_TYPE) {\n // parsing Picture Data field as URL (always represented as ISO-8859-1 [ID3v2.4.0 section 4.])\n frame.url = parseIso88591$1(frame.data, i, frame.data.length);\n } else {\n // parsing Picture Data field as binary data\n frame.pictureData = frame.data.subarray(i, frame.data.length);\n }\n },\n 'T*': function (frame) {\n if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {\n // ignore frames with unrecognized character encodings\n return;\n } // parse text field, do not include null terminator in the frame value\n // frames that allow different types of encoding contain terminated text [ID3v2.4.0 section 4.]\n\n frame.value = parseUtf8(frame.data, 1, frame.data.length).replace(/\\0*$/, ''); // text information frames supports multiple strings, stored as a terminator separated list [ID3v2.4.0 section 4.2.]\n\n frame.values = frame.value.split('\\0');\n },\n 'TXXX': function (frame) {\n var descriptionEndIndex;\n if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {\n // ignore frames with unrecognized character encodings\n return;\n }\n descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1);\n if (descriptionEndIndex === -1) {\n return;\n } // parse the text fields\n\n frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // do not include the null terminator in the tag value\n // frames that allow different types of encoding contain terminated text\n // [ID3v2.4.0 section 4.]\n\n frame.value = parseUtf8(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\\0*$/, '');\n frame.data = frame.value;\n },\n 'W*': function (frame) {\n // parse URL field; URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.]\n // if the value is followed by a string termination all the following information should be ignored [ID3v2.4.0 section 4.3]\n frame.url = parseIso88591$1(frame.data, 0, frame.data.length).replace(/\\0.*$/, '');\n },\n 'WXXX': function (frame) {\n var descriptionEndIndex;\n if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {\n // ignore frames with unrecognized character encodings\n return;\n }\n descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1);\n if (descriptionEndIndex === -1) {\n return;\n } // parse the description and URL fields\n\n frame.description = parseUtf8(frame.data, 1, descriptionEndIndex); // URL fields are always represented as ISO-8859-1 [ID3v2.4.0 section 4.]\n // if the value is followed by a string termination all the following information\n // should be ignored [ID3v2.4.0 section 4.3]\n\n frame.url = parseIso88591$1(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\\0.*$/, '');\n },\n 'PRIV': function (frame) {\n var i;\n for (i = 0; i < frame.data.length; i++) {\n if (frame.data[i] === 0) {\n // parse the description and URL fields\n frame.owner = parseIso88591$1(frame.data, 0, i);\n break;\n }\n }\n frame.privateData = frame.data.subarray(i + 1);\n frame.data = frame.privateData;\n }\n };\n var parseId3Frames$1 = function (data) {\n var frameSize,\n frameHeader,\n frameStart = 10,\n tagSize = 0,\n frames = []; // If we don't have enough data for a header, 10 bytes, \n // or 'ID3' in the first 3 bytes this is not a valid ID3 tag.\n\n if (data.length < 10 || data[0] !== 'I'.charCodeAt(0) || data[1] !== 'D'.charCodeAt(0) || data[2] !== '3'.charCodeAt(0)) {\n return;\n } // the frame size is transmitted as a 28-bit integer in the\n // last four bytes of the ID3 header.\n // The most significant bit of each byte is dropped and the\n // results concatenated to recover the actual value.\n\n tagSize = parseSyncSafeInteger$1(data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more\n // convenient for our comparisons to include it\n\n tagSize += 10; // check bit 6 of byte 5 for the extended header flag.\n\n var hasExtendedHeader = data[5] & 0x40;\n if (hasExtendedHeader) {\n // advance the frame start past the extended header\n frameStart += 4; // header size field\n\n frameStart += parseSyncSafeInteger$1(data.subarray(10, 14));\n tagSize -= parseSyncSafeInteger$1(data.subarray(16, 20)); // clip any padding off the end\n } // parse one or more ID3 frames\n // http://id3.org/id3v2.3.0#ID3v2_frame_overview\n\n do {\n // determine the number of bytes in this frame\n frameSize = parseSyncSafeInteger$1(data.subarray(frameStart + 4, frameStart + 8));\n if (frameSize < 1) {\n break;\n }\n frameHeader = String.fromCharCode(data[frameStart], data[frameStart + 1], data[frameStart + 2], data[frameStart + 3]);\n var frame = {\n id: frameHeader,\n data: data.subarray(frameStart + 10, frameStart + frameSize + 10)\n };\n frame.key = frame.id; // parse frame values\n\n if (frameParsers[frame.id]) {\n // use frame specific parser\n frameParsers[frame.id](frame);\n } else if (frame.id[0] === 'T') {\n // use text frame generic parser\n frameParsers['T*'](frame);\n } else if (frame.id[0] === 'W') {\n // use URL link frame generic parser\n frameParsers['W*'](frame);\n }\n frames.push(frame);\n frameStart += 10; // advance past the frame header\n\n frameStart += frameSize; // advance past the frame body\n } while (frameStart < tagSize);\n return frames;\n };\n var parseId3 = {\n parseId3Frames: parseId3Frames$1,\n parseSyncSafeInteger: parseSyncSafeInteger$1,\n frameParsers: frameParsers\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Accepts program elementary stream (PES) data events and parses out\n * ID3 metadata from them, if present.\n * @see http://id3.org/id3v2.3.0\n */\n\n var Stream$5 = stream,\n StreamTypes$3 = streamTypes,\n id3 = parseId3,\n MetadataStream;\n MetadataStream = function (options) {\n var settings = {\n // the bytes of the program-level descriptor field in MP2T\n // see ISO/IEC 13818-1:2013 (E), section 2.6 \"Program and\n // program element descriptors\"\n descriptor: options && options.descriptor\n },\n // the total size in bytes of the ID3 tag being parsed\n tagSize = 0,\n // tag data that is not complete enough to be parsed\n buffer = [],\n // the total number of bytes currently in the buffer\n bufferSize = 0,\n i;\n MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type\n // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track\n\n this.dispatchType = StreamTypes$3.METADATA_STREAM_TYPE.toString(16);\n if (settings.descriptor) {\n for (i = 0; i < settings.descriptor.length; i++) {\n this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2);\n }\n }\n this.push = function (chunk) {\n var tag, frameStart, frameSize, frame, i, frameHeader;\n if (chunk.type !== 'timed-metadata') {\n return;\n } // if data_alignment_indicator is set in the PES header,\n // we must have the start of a new ID3 tag. Assume anything\n // remaining in the buffer was malformed and throw it out\n\n if (chunk.dataAlignmentIndicator) {\n bufferSize = 0;\n buffer.length = 0;\n } // ignore events that don't look like ID3 data\n\n if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) {\n this.trigger('log', {\n level: 'warn',\n message: 'Skipping unrecognized metadata packet'\n });\n return;\n } // add this chunk to the data we've collected so far\n\n buffer.push(chunk);\n bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header\n\n if (buffer.length === 1) {\n // the frame size is transmitted as a 28-bit integer in the\n // last four bytes of the ID3 header.\n // The most significant bit of each byte is dropped and the\n // results concatenated to recover the actual value.\n tagSize = id3.parseSyncSafeInteger(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more\n // convenient for our comparisons to include it\n\n tagSize += 10;\n } // if the entire frame has not arrived, wait for more data\n\n if (bufferSize < tagSize) {\n return;\n } // collect the entire frame so it can be parsed\n\n tag = {\n data: new Uint8Array(tagSize),\n frames: [],\n pts: buffer[0].pts,\n dts: buffer[0].dts\n };\n for (i = 0; i < tagSize;) {\n tag.data.set(buffer[0].data.subarray(0, tagSize - i), i);\n i += buffer[0].data.byteLength;\n bufferSize -= buffer[0].data.byteLength;\n buffer.shift();\n } // find the start of the first frame and the end of the tag\n\n frameStart = 10;\n if (tag.data[5] & 0x40) {\n // advance the frame start past the extended header\n frameStart += 4; // header size field\n\n frameStart += id3.parseSyncSafeInteger(tag.data.subarray(10, 14)); // clip any padding off the end\n\n tagSize -= id3.parseSyncSafeInteger(tag.data.subarray(16, 20));\n } // parse one or more ID3 frames\n // http://id3.org/id3v2.3.0#ID3v2_frame_overview\n\n do {\n // determine the number of bytes in this frame\n frameSize = id3.parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8));\n if (frameSize < 1) {\n this.trigger('log', {\n level: 'warn',\n message: 'Malformed ID3 frame encountered. Skipping remaining metadata parsing.'\n }); // If the frame is malformed, don't parse any further frames but allow previous valid parsed frames\n // to be sent along.\n\n break;\n }\n frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]);\n frame = {\n id: frameHeader,\n data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10)\n };\n frame.key = frame.id; // parse frame values\n\n if (id3.frameParsers[frame.id]) {\n // use frame specific parser\n id3.frameParsers[frame.id](frame);\n } else if (frame.id[0] === 'T') {\n // use text frame generic parser\n id3.frameParsers['T*'](frame);\n } else if (frame.id[0] === 'W') {\n // use URL link frame generic parser\n id3.frameParsers['W*'](frame);\n } // handle the special PRIV frame used to indicate the start\n // time for raw AAC data\n\n if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') {\n var d = frame.data,\n size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2;\n size *= 4;\n size += d[7] & 0x03;\n frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based\n // on the value of this frame\n // we couldn't have known the appropriate pts and dts before\n // parsing this ID3 tag so set those values now\n\n if (tag.pts === undefined && tag.dts === undefined) {\n tag.pts = frame.timeStamp;\n tag.dts = frame.timeStamp;\n }\n this.trigger('timestamp', frame);\n }\n tag.frames.push(frame);\n frameStart += 10; // advance past the frame header\n\n frameStart += frameSize; // advance past the frame body\n } while (frameStart < tagSize);\n this.trigger('data', tag);\n };\n };\n MetadataStream.prototype = new Stream$5();\n var metadataStream = MetadataStream;\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * A stream-based mp2t to mp4 converter. This utility can be used to\n * deliver mp4s to a SourceBuffer on platforms that support native\n * Media Source Extensions.\n */\n\n var Stream$4 = stream,\n CaptionStream$1 = captionStream,\n StreamTypes$2 = streamTypes,\n TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream; // object types\n\n var TransportPacketStream, TransportParseStream, ElementaryStream; // constants\n\n var MP2T_PACKET_LENGTH$1 = 188,\n // bytes\n SYNC_BYTE$1 = 0x47;\n /**\n * Splits an incoming stream of binary data into MPEG-2 Transport\n * Stream packets.\n */\n\n TransportPacketStream = function () {\n var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1),\n bytesInBuffer = 0;\n TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream.\n\n /**\n * Split a stream of data into M2TS packets\n **/\n\n this.push = function (bytes) {\n var startIndex = 0,\n endIndex = MP2T_PACKET_LENGTH$1,\n everything; // If there are bytes remaining from the last segment, prepend them to the\n // bytes that were pushed in\n\n if (bytesInBuffer) {\n everything = new Uint8Array(bytes.byteLength + bytesInBuffer);\n everything.set(buffer.subarray(0, bytesInBuffer));\n everything.set(bytes, bytesInBuffer);\n bytesInBuffer = 0;\n } else {\n everything = bytes;\n } // While we have enough data for a packet\n\n while (endIndex < everything.byteLength) {\n // Look for a pair of start and end sync bytes in the data..\n if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) {\n // We found a packet so emit it and jump one whole packet forward in\n // the stream\n this.trigger('data', everything.subarray(startIndex, endIndex));\n startIndex += MP2T_PACKET_LENGTH$1;\n endIndex += MP2T_PACKET_LENGTH$1;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n startIndex++;\n endIndex++;\n } // If there was some data left over at the end of the segment that couldn't\n // possibly be a whole packet, keep it because it might be the start of a packet\n // that continues in the next segment\n\n if (startIndex < everything.byteLength) {\n buffer.set(everything.subarray(startIndex), 0);\n bytesInBuffer = everything.byteLength - startIndex;\n }\n };\n /**\n * Passes identified M2TS packets to the TransportParseStream to be parsed\n **/\n\n this.flush = function () {\n // If the buffer contains a whole packet when we are being flushed, emit it\n // and empty the buffer. Otherwise hold onto the data because it may be\n // important for decoding the next segment\n if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) {\n this.trigger('data', buffer);\n bytesInBuffer = 0;\n }\n this.trigger('done');\n };\n this.endTimeline = function () {\n this.flush();\n this.trigger('endedtimeline');\n };\n this.reset = function () {\n bytesInBuffer = 0;\n this.trigger('reset');\n };\n };\n TransportPacketStream.prototype = new Stream$4();\n /**\n * Accepts an MP2T TransportPacketStream and emits data events with parsed\n * forms of the individual transport stream packets.\n */\n\n TransportParseStream = function () {\n var parsePsi, parsePat, parsePmt, self;\n TransportParseStream.prototype.init.call(this);\n self = this;\n this.packetsWaitingForPmt = [];\n this.programMapTable = undefined;\n parsePsi = function (payload, psi) {\n var offset = 0; // PSI packets may be split into multiple sections and those\n // sections may be split into multiple packets. If a PSI\n // section starts in this packet, the payload_unit_start_indicator\n // will be true and the first byte of the payload will indicate\n // the offset from the current position to the start of the\n // section.\n\n if (psi.payloadUnitStartIndicator) {\n offset += payload[offset] + 1;\n }\n if (psi.type === 'pat') {\n parsePat(payload.subarray(offset), psi);\n } else {\n parsePmt(payload.subarray(offset), psi);\n }\n };\n parsePat = function (payload, pat) {\n pat.section_number = payload[7]; // eslint-disable-line camelcase\n\n pat.last_section_number = payload[8]; // eslint-disable-line camelcase\n // skip the PSI header and parse the first PMT entry\n\n self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11];\n pat.pmtPid = self.pmtPid;\n };\n /**\n * Parse out the relevant fields of a Program Map Table (PMT).\n * @param payload {Uint8Array} the PMT-specific portion of an MP2T\n * packet. The first byte in this array should be the table_id\n * field.\n * @param pmt {object} the object that should be decorated with\n * fields parsed from the PMT.\n */\n\n parsePmt = function (payload, pmt) {\n var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually\n // take effect. We don't believe this should ever be the case\n // for HLS but we'll ignore \"forward\" PMT declarations if we see\n // them. Future PMT declarations have the current_next_indicator\n // set to zero.\n\n if (!(payload[5] & 0x01)) {\n return;\n } // overwrite any existing program map table\n\n self.programMapTable = {\n video: null,\n audio: null,\n 'timed-metadata': {}\n }; // the mapping table ends at the end of the current section\n\n sectionLength = (payload[1] & 0x0f) << 8 | payload[2];\n tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how\n // long the program info descriptors are\n\n programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table\n\n offset = 12 + programInfoLength;\n while (offset < tableEnd) {\n var streamType = payload[offset];\n var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types\n // TODO: should this be done for metadata too? for now maintain behavior of\n // multiple metadata streams\n\n if (streamType === StreamTypes$2.H264_STREAM_TYPE && self.programMapTable.video === null) {\n self.programMapTable.video = pid;\n } else if (streamType === StreamTypes$2.ADTS_STREAM_TYPE && self.programMapTable.audio === null) {\n self.programMapTable.audio = pid;\n } else if (streamType === StreamTypes$2.METADATA_STREAM_TYPE) {\n // map pid to stream type for metadata streams\n self.programMapTable['timed-metadata'][pid] = streamType;\n } // move to the next table entry\n // skip past the elementary stream descriptors, if present\n\n offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5;\n } // record the map on the packet as well\n\n pmt.programMapTable = self.programMapTable;\n };\n /**\n * Deliver a new MP2T packet to the next stream in the pipeline.\n */\n\n this.push = function (packet) {\n var result = {},\n offset = 4;\n result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1]\n\n result.pid = packet[1] & 0x1f;\n result.pid <<= 8;\n result.pid |= packet[2]; // if an adaption field is present, its length is specified by the\n // fifth byte of the TS packet header. The adaptation field is\n // used to add stuffing to PES packets that don't fill a complete\n // TS packet, and to specify some forms of timing and control data\n // that we do not currently use.\n\n if ((packet[3] & 0x30) >>> 4 > 0x01) {\n offset += packet[offset] + 1;\n } // parse the rest of the packet based on the type\n\n if (result.pid === 0) {\n result.type = 'pat';\n parsePsi(packet.subarray(offset), result);\n this.trigger('data', result);\n } else if (result.pid === this.pmtPid) {\n result.type = 'pmt';\n parsePsi(packet.subarray(offset), result);\n this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now\n\n while (this.packetsWaitingForPmt.length) {\n this.processPes_.apply(this, this.packetsWaitingForPmt.shift());\n }\n } else if (this.programMapTable === undefined) {\n // When we have not seen a PMT yet, defer further processing of\n // PES packets until one has been parsed\n this.packetsWaitingForPmt.push([packet, offset, result]);\n } else {\n this.processPes_(packet, offset, result);\n }\n };\n this.processPes_ = function (packet, offset, result) {\n // set the appropriate stream type\n if (result.pid === this.programMapTable.video) {\n result.streamType = StreamTypes$2.H264_STREAM_TYPE;\n } else if (result.pid === this.programMapTable.audio) {\n result.streamType = StreamTypes$2.ADTS_STREAM_TYPE;\n } else {\n // if not video or audio, it is timed-metadata or unknown\n // if unknown, streamType will be undefined\n result.streamType = this.programMapTable['timed-metadata'][result.pid];\n }\n result.type = 'pes';\n result.data = packet.subarray(offset);\n this.trigger('data', result);\n };\n };\n TransportParseStream.prototype = new Stream$4();\n TransportParseStream.STREAM_TYPES = {\n h264: 0x1b,\n adts: 0x0f\n };\n /**\n * Reconsistutes program elementary stream (PES) packets from parsed\n * transport stream packets. That is, if you pipe an\n * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output\n * events will be events which capture the bytes for individual PES\n * packets plus relevant metadata that has been extracted from the\n * container.\n */\n\n ElementaryStream = function () {\n var self = this,\n segmentHadPmt = false,\n // PES packet fragments\n video = {\n data: [],\n size: 0\n },\n audio = {\n data: [],\n size: 0\n },\n timedMetadata = {\n data: [],\n size: 0\n },\n programMapTable,\n parsePes = function (payload, pes) {\n var ptsDtsFlags;\n const startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array\n\n pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets\n // that are frame data that is continuing from the previous fragment. This\n // is to check that the pes data is the start of a new pes payload\n\n if (startPrefix !== 1) {\n return;\n } // get the packet length, this will be 0 for video\n\n pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe\n\n pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value\n // and a DTS value. Determine what combination of values is\n // available to work with.\n\n ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript\n // performs all bitwise operations on 32-bit integers but javascript\n // supports a much greater range (52-bits) of integer using standard\n // mathematical operations.\n // We construct a 31-bit value using bitwise operators over the 31\n // most significant bits and then multiply by 4 (equal to a left-shift\n // of 2) before we add the final 2 least significant bits of the\n // timestamp (equal to an OR.)\n\n if (ptsDtsFlags & 0xC0) {\n // the PTS and DTS are not written out directly. For information\n // on how they are encoded, see\n // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html\n pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3;\n pes.pts *= 4; // Left shift by 2\n\n pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs\n\n pes.dts = pes.pts;\n if (ptsDtsFlags & 0x40) {\n pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3;\n pes.dts *= 4; // Left shift by 2\n\n pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs\n }\n } // the data section starts immediately after the PES header.\n // pes_header_data_length specifies the number of header bytes\n // that follow the last byte of the field.\n\n pes.data = payload.subarray(9 + payload[8]);\n },\n /**\n * Pass completely parsed PES packets to the next stream in the pipeline\n **/\n flushStream = function (stream, type, forceFlush) {\n var packetData = new Uint8Array(stream.size),\n event = {\n type: type\n },\n i = 0,\n offset = 0,\n packetFlushable = false,\n fragment; // do nothing if there is not enough buffered data for a complete\n // PES header\n\n if (!stream.data.length || stream.size < 9) {\n return;\n }\n event.trackId = stream.data[0].pid; // reassemble the packet\n\n for (i = 0; i < stream.data.length; i++) {\n fragment = stream.data[i];\n packetData.set(fragment.data, offset);\n offset += fragment.data.byteLength;\n } // parse assembled packet's PES header\n\n parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length\n // check that there is enough stream data to fill the packet\n\n packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right\n\n if (forceFlush || packetFlushable) {\n stream.size = 0;\n stream.data.length = 0;\n } // only emit packets that are complete. this is to avoid assembling\n // incomplete PES packets due to poor segmentation\n\n if (packetFlushable) {\n self.trigger('data', event);\n }\n };\n ElementaryStream.prototype.init.call(this);\n /**\n * Identifies M2TS packet types and parses PES packets using metadata\n * parsed from the PMT\n **/\n\n this.push = function (data) {\n ({\n pat: function () {// we have to wait for the PMT to arrive as well before we\n // have any meaningful metadata\n },\n pes: function () {\n var stream, streamType;\n switch (data.streamType) {\n case StreamTypes$2.H264_STREAM_TYPE:\n stream = video;\n streamType = 'video';\n break;\n case StreamTypes$2.ADTS_STREAM_TYPE:\n stream = audio;\n streamType = 'audio';\n break;\n case StreamTypes$2.METADATA_STREAM_TYPE:\n stream = timedMetadata;\n streamType = 'timed-metadata';\n break;\n default:\n // ignore unknown stream types\n return;\n } // if a new packet is starting, we can flush the completed\n // packet\n\n if (data.payloadUnitStartIndicator) {\n flushStream(stream, streamType, true);\n } // buffer this fragment until we are sure we've received the\n // complete payload\n\n stream.data.push(data);\n stream.size += data.data.byteLength;\n },\n pmt: function () {\n var event = {\n type: 'metadata',\n tracks: []\n };\n programMapTable = data.programMapTable; // translate audio and video streams to tracks\n\n if (programMapTable.video !== null) {\n event.tracks.push({\n timelineStartInfo: {\n baseMediaDecodeTime: 0\n },\n id: +programMapTable.video,\n codec: 'avc',\n type: 'video'\n });\n }\n if (programMapTable.audio !== null) {\n event.tracks.push({\n timelineStartInfo: {\n baseMediaDecodeTime: 0\n },\n id: +programMapTable.audio,\n codec: 'adts',\n type: 'audio'\n });\n }\n segmentHadPmt = true;\n self.trigger('data', event);\n }\n })[data.type]();\n };\n this.reset = function () {\n video.size = 0;\n video.data.length = 0;\n audio.size = 0;\n audio.data.length = 0;\n this.trigger('reset');\n };\n /**\n * Flush any remaining input. Video PES packets may be of variable\n * length. Normally, the start of a new video packet can trigger the\n * finalization of the previous packet. That is not possible if no\n * more video is forthcoming, however. In that case, some other\n * mechanism (like the end of the file) has to be employed. When it is\n * clear that no additional data is forthcoming, calling this method\n * will flush the buffered packets.\n */\n\n this.flushStreams_ = function () {\n // !!THIS ORDER IS IMPORTANT!!\n // video first then audio\n flushStream(video, 'video');\n flushStream(audio, 'audio');\n flushStream(timedMetadata, 'timed-metadata');\n };\n this.flush = function () {\n // if on flush we haven't had a pmt emitted\n // and we have a pmt to emit. emit the pmt\n // so that we trigger a trackinfo downstream.\n if (!segmentHadPmt && programMapTable) {\n var pmt = {\n type: 'metadata',\n tracks: []\n }; // translate audio and video streams to tracks\n\n if (programMapTable.video !== null) {\n pmt.tracks.push({\n timelineStartInfo: {\n baseMediaDecodeTime: 0\n },\n id: +programMapTable.video,\n codec: 'avc',\n type: 'video'\n });\n }\n if (programMapTable.audio !== null) {\n pmt.tracks.push({\n timelineStartInfo: {\n baseMediaDecodeTime: 0\n },\n id: +programMapTable.audio,\n codec: 'adts',\n type: 'audio'\n });\n }\n self.trigger('data', pmt);\n }\n segmentHadPmt = false;\n this.flushStreams_();\n this.trigger('done');\n };\n };\n ElementaryStream.prototype = new Stream$4();\n var m2ts$1 = {\n PAT_PID: 0x0000,\n MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1,\n TransportPacketStream: TransportPacketStream,\n TransportParseStream: TransportParseStream,\n ElementaryStream: ElementaryStream,\n TimestampRolloverStream: TimestampRolloverStream,\n CaptionStream: CaptionStream$1.CaptionStream,\n Cea608Stream: CaptionStream$1.Cea608Stream,\n Cea708Stream: CaptionStream$1.Cea708Stream,\n MetadataStream: metadataStream\n };\n for (var type in StreamTypes$2) {\n if (StreamTypes$2.hasOwnProperty(type)) {\n m2ts$1[type] = StreamTypes$2[type];\n }\n }\n var m2ts_1 = m2ts$1;\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var Stream$3 = stream;\n var ONE_SECOND_IN_TS$2 = clock$2.ONE_SECOND_IN_TS;\n var AdtsStream$1;\n var ADTS_SAMPLING_FREQUENCIES$1 = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350];\n /*\n * Accepts a ElementaryStream and emits data events with parsed\n * AAC Audio Frames of the individual packets. Input audio in ADTS\n * format is unpacked and re-emitted as AAC frames.\n *\n * @see http://wiki.multimedia.cx/index.php?title=ADTS\n * @see http://wiki.multimedia.cx/?title=Understanding_AAC\n */\n\n AdtsStream$1 = function (handlePartialSegments) {\n var buffer,\n frameNum = 0;\n AdtsStream$1.prototype.init.call(this);\n this.skipWarn_ = function (start, end) {\n this.trigger('log', {\n level: 'warn',\n message: `adts skiping bytes ${start} to ${end} in frame ${frameNum} outside syncword`\n });\n };\n this.push = function (packet) {\n var i = 0,\n frameLength,\n protectionSkipBytes,\n oldBuffer,\n sampleCount,\n adtsFrameDuration;\n if (!handlePartialSegments) {\n frameNum = 0;\n }\n if (packet.type !== 'audio') {\n // ignore non-audio data\n return;\n } // Prepend any data in the buffer to the input data so that we can parse\n // aac frames the cross a PES packet boundary\n\n if (buffer && buffer.length) {\n oldBuffer = buffer;\n buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength);\n buffer.set(oldBuffer);\n buffer.set(packet.data, oldBuffer.byteLength);\n } else {\n buffer = packet.data;\n } // unpack any ADTS frames which have been fully received\n // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS\n\n var skip; // We use i + 7 here because we want to be able to parse the entire header.\n // If we don't have enough bytes to do that, then we definitely won't have a full frame.\n\n while (i + 7 < buffer.length) {\n // Look for the start of an ADTS header..\n if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) {\n if (typeof skip !== 'number') {\n skip = i;\n } // If a valid header was not found, jump one forward and attempt to\n // find a valid ADTS header starting at the next byte\n\n i++;\n continue;\n }\n if (typeof skip === 'number') {\n this.skipWarn_(skip, i);\n skip = null;\n } // The protection skip bit tells us if we have 2 bytes of CRC data at the\n // end of the ADTS header\n\n protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the\n // end of the sync sequence\n // NOTE: frame length includes the size of the header\n\n frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5;\n sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024;\n adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2]; // If we don't have enough data to actually finish this ADTS frame,\n // then we have to wait for more data\n\n if (buffer.byteLength - i < frameLength) {\n break;\n } // Otherwise, deliver the complete AAC frame\n\n this.trigger('data', {\n pts: packet.pts + frameNum * adtsFrameDuration,\n dts: packet.dts + frameNum * adtsFrameDuration,\n sampleCount: sampleCount,\n audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1,\n channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6,\n samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2],\n samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2,\n // assume ISO/IEC 14496-12 AudioSampleEntry default of 16\n samplesize: 16,\n // data is the frame without it's header\n data: buffer.subarray(i + 7 + protectionSkipBytes, i + frameLength)\n });\n frameNum++;\n i += frameLength;\n }\n if (typeof skip === 'number') {\n this.skipWarn_(skip, i);\n skip = null;\n } // remove processed bytes from the buffer.\n\n buffer = buffer.subarray(i);\n };\n this.flush = function () {\n frameNum = 0;\n this.trigger('done');\n };\n this.reset = function () {\n buffer = void 0;\n this.trigger('reset');\n };\n this.endTimeline = function () {\n buffer = void 0;\n this.trigger('endedtimeline');\n };\n };\n AdtsStream$1.prototype = new Stream$3();\n var adts = AdtsStream$1;\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var ExpGolomb$1;\n /**\n * Parser for exponential Golomb codes, a variable-bitwidth number encoding\n * scheme used by h264.\n */\n\n ExpGolomb$1 = function (workingData) {\n var\n // the number of bytes left to examine in workingData\n workingBytesAvailable = workingData.byteLength,\n // the current word being examined\n workingWord = 0,\n // :uint\n // the number of bits left to examine in the current word\n workingBitsAvailable = 0; // :uint;\n // ():uint\n\n this.length = function () {\n return 8 * workingBytesAvailable;\n }; // ():uint\n\n this.bitsAvailable = function () {\n return 8 * workingBytesAvailable + workingBitsAvailable;\n }; // ():void\n\n this.loadWord = function () {\n var position = workingData.byteLength - workingBytesAvailable,\n workingBytes = new Uint8Array(4),\n availableBytes = Math.min(4, workingBytesAvailable);\n if (availableBytes === 0) {\n throw new Error('no bytes available');\n }\n workingBytes.set(workingData.subarray(position, position + availableBytes));\n workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed\n\n workingBitsAvailable = availableBytes * 8;\n workingBytesAvailable -= availableBytes;\n }; // (count:int):void\n\n this.skipBits = function (count) {\n var skipBytes; // :int\n\n if (workingBitsAvailable > count) {\n workingWord <<= count;\n workingBitsAvailable -= count;\n } else {\n count -= workingBitsAvailable;\n skipBytes = Math.floor(count / 8);\n count -= skipBytes * 8;\n workingBytesAvailable -= skipBytes;\n this.loadWord();\n workingWord <<= count;\n workingBitsAvailable -= count;\n }\n }; // (size:int):uint\n\n this.readBits = function (size) {\n var bits = Math.min(workingBitsAvailable, size),\n // :uint\n valu = workingWord >>> 32 - bits; // :uint\n // if size > 31, handle error\n\n workingBitsAvailable -= bits;\n if (workingBitsAvailable > 0) {\n workingWord <<= bits;\n } else if (workingBytesAvailable > 0) {\n this.loadWord();\n }\n bits = size - bits;\n if (bits > 0) {\n return valu << bits | this.readBits(bits);\n }\n return valu;\n }; // ():uint\n\n this.skipLeadingZeros = function () {\n var leadingZeroCount; // :uint\n\n for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) {\n if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) {\n // the first bit of working word is 1\n workingWord <<= leadingZeroCount;\n workingBitsAvailable -= leadingZeroCount;\n return leadingZeroCount;\n }\n } // we exhausted workingWord and still have not found a 1\n\n this.loadWord();\n return leadingZeroCount + this.skipLeadingZeros();\n }; // ():void\n\n this.skipUnsignedExpGolomb = function () {\n this.skipBits(1 + this.skipLeadingZeros());\n }; // ():void\n\n this.skipExpGolomb = function () {\n this.skipBits(1 + this.skipLeadingZeros());\n }; // ():uint\n\n this.readUnsignedExpGolomb = function () {\n var clz = this.skipLeadingZeros(); // :uint\n\n return this.readBits(clz + 1) - 1;\n }; // ():int\n\n this.readExpGolomb = function () {\n var valu = this.readUnsignedExpGolomb(); // :int\n\n if (0x01 & valu) {\n // the number is odd if the low order bit is set\n return 1 + valu >>> 1; // add 1 to make it even, and divide by 2\n }\n\n return -1 * (valu >>> 1); // divide by two then make it negative\n }; // Some convenience functions\n // :Boolean\n\n this.readBoolean = function () {\n return this.readBits(1) === 1;\n }; // ():int\n\n this.readUnsignedByte = function () {\n return this.readBits(8);\n };\n this.loadWord();\n };\n var expGolomb = ExpGolomb$1;\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var Stream$2 = stream;\n var ExpGolomb = expGolomb;\n var H264Stream$1, NalByteStream;\n var PROFILES_WITH_OPTIONAL_SPS_DATA;\n /**\n * Accepts a NAL unit byte stream and unpacks the embedded NAL units.\n */\n\n NalByteStream = function () {\n var syncPoint = 0,\n i,\n buffer;\n NalByteStream.prototype.init.call(this);\n /*\n * Scans a byte stream and triggers a data event with the NAL units found.\n * @param {Object} data Event received from H264Stream\n * @param {Uint8Array} data.data The h264 byte stream to be scanned\n *\n * @see H264Stream.push\n */\n\n this.push = function (data) {\n var swapBuffer;\n if (!buffer) {\n buffer = data.data;\n } else {\n swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength);\n swapBuffer.set(buffer);\n swapBuffer.set(data.data, buffer.byteLength);\n buffer = swapBuffer;\n }\n var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B\n // scan for NAL unit boundaries\n // a match looks like this:\n // 0 0 1 .. NAL .. 0 0 1\n // ^ sync point ^ i\n // or this:\n // 0 0 1 .. NAL .. 0 0 0\n // ^ sync point ^ i\n // advance the sync point to a NAL start, if necessary\n\n for (; syncPoint < len - 3; syncPoint++) {\n if (buffer[syncPoint + 2] === 1) {\n // the sync point is properly aligned\n i = syncPoint + 5;\n break;\n }\n }\n while (i < len) {\n // look at the current byte to determine if we've hit the end of\n // a NAL unit boundary\n switch (buffer[i]) {\n case 0:\n // skip past non-sync sequences\n if (buffer[i - 1] !== 0) {\n i += 2;\n break;\n } else if (buffer[i - 2] !== 0) {\n i++;\n break;\n } // deliver the NAL unit if it isn't empty\n\n if (syncPoint + 3 !== i - 2) {\n this.trigger('data', buffer.subarray(syncPoint + 3, i - 2));\n } // drop trailing zeroes\n\n do {\n i++;\n } while (buffer[i] !== 1 && i < len);\n syncPoint = i - 2;\n i += 3;\n break;\n case 1:\n // skip past non-sync sequences\n if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) {\n i += 3;\n break;\n } // deliver the NAL unit\n\n this.trigger('data', buffer.subarray(syncPoint + 3, i - 2));\n syncPoint = i - 2;\n i += 3;\n break;\n default:\n // the current byte isn't a one or zero, so it cannot be part\n // of a sync sequence\n i += 3;\n break;\n }\n } // filter out the NAL units that were delivered\n\n buffer = buffer.subarray(syncPoint);\n i -= syncPoint;\n syncPoint = 0;\n };\n this.reset = function () {\n buffer = null;\n syncPoint = 0;\n this.trigger('reset');\n };\n this.flush = function () {\n // deliver the last buffered NAL unit\n if (buffer && buffer.byteLength > 3) {\n this.trigger('data', buffer.subarray(syncPoint + 3));\n } // reset the stream state\n\n buffer = null;\n syncPoint = 0;\n this.trigger('done');\n };\n this.endTimeline = function () {\n this.flush();\n this.trigger('endedtimeline');\n };\n };\n NalByteStream.prototype = new Stream$2(); // values of profile_idc that indicate additional fields are included in the SPS\n // see Recommendation ITU-T H.264 (4/2013),\n // 7.3.2.1.1 Sequence parameter set data syntax\n\n PROFILES_WITH_OPTIONAL_SPS_DATA = {\n 100: true,\n 110: true,\n 122: true,\n 244: true,\n 44: true,\n 83: true,\n 86: true,\n 118: true,\n 128: true,\n // TODO: the three profiles below don't\n // appear to have sps data in the specificiation anymore?\n 138: true,\n 139: true,\n 134: true\n };\n /**\n * Accepts input from a ElementaryStream and produces H.264 NAL unit data\n * events.\n */\n\n H264Stream$1 = function () {\n var nalByteStream = new NalByteStream(),\n self,\n trackId,\n currentPts,\n currentDts,\n discardEmulationPreventionBytes,\n readSequenceParameterSet,\n skipScalingList;\n H264Stream$1.prototype.init.call(this);\n self = this;\n /*\n * Pushes a packet from a stream onto the NalByteStream\n *\n * @param {Object} packet - A packet received from a stream\n * @param {Uint8Array} packet.data - The raw bytes of the packet\n * @param {Number} packet.dts - Decode timestamp of the packet\n * @param {Number} packet.pts - Presentation timestamp of the packet\n * @param {Number} packet.trackId - The id of the h264 track this packet came from\n * @param {('video'|'audio')} packet.type - The type of packet\n *\n */\n\n this.push = function (packet) {\n if (packet.type !== 'video') {\n return;\n }\n trackId = packet.trackId;\n currentPts = packet.pts;\n currentDts = packet.dts;\n nalByteStream.push(packet);\n };\n /*\n * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps\n * for the NALUs to the next stream component.\n * Also, preprocess caption and sequence parameter NALUs.\n *\n * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push`\n * @see NalByteStream.push\n */\n\n nalByteStream.on('data', function (data) {\n var event = {\n trackId: trackId,\n pts: currentPts,\n dts: currentDts,\n data: data,\n nalUnitTypeCode: data[0] & 0x1f\n };\n switch (event.nalUnitTypeCode) {\n case 0x05:\n event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr';\n break;\n case 0x06:\n event.nalUnitType = 'sei_rbsp';\n event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1));\n break;\n case 0x07:\n event.nalUnitType = 'seq_parameter_set_rbsp';\n event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1));\n event.config = readSequenceParameterSet(event.escapedRBSP);\n break;\n case 0x08:\n event.nalUnitType = 'pic_parameter_set_rbsp';\n break;\n case 0x09:\n event.nalUnitType = 'access_unit_delimiter_rbsp';\n break;\n } // This triggers data on the H264Stream\n\n self.trigger('data', event);\n });\n nalByteStream.on('done', function () {\n self.trigger('done');\n });\n nalByteStream.on('partialdone', function () {\n self.trigger('partialdone');\n });\n nalByteStream.on('reset', function () {\n self.trigger('reset');\n });\n nalByteStream.on('endedtimeline', function () {\n self.trigger('endedtimeline');\n });\n this.flush = function () {\n nalByteStream.flush();\n };\n this.partialFlush = function () {\n nalByteStream.partialFlush();\n };\n this.reset = function () {\n nalByteStream.reset();\n };\n this.endTimeline = function () {\n nalByteStream.endTimeline();\n };\n /**\n * Advance the ExpGolomb decoder past a scaling list. The scaling\n * list is optionally transmitted as part of a sequence parameter\n * set and is not relevant to transmuxing.\n * @param count {number} the number of entries in this scaling list\n * @param expGolombDecoder {object} an ExpGolomb pointed to the\n * start of a scaling list\n * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1\n */\n\n skipScalingList = function (count, expGolombDecoder) {\n var lastScale = 8,\n nextScale = 8,\n j,\n deltaScale;\n for (j = 0; j < count; j++) {\n if (nextScale !== 0) {\n deltaScale = expGolombDecoder.readExpGolomb();\n nextScale = (lastScale + deltaScale + 256) % 256;\n }\n lastScale = nextScale === 0 ? lastScale : nextScale;\n }\n };\n /**\n * Expunge any \"Emulation Prevention\" bytes from a \"Raw Byte\n * Sequence Payload\"\n * @param data {Uint8Array} the bytes of a RBSP from a NAL\n * unit\n * @return {Uint8Array} the RBSP without any Emulation\n * Prevention Bytes\n */\n\n discardEmulationPreventionBytes = function (data) {\n var length = data.byteLength,\n emulationPreventionBytesPositions = [],\n i = 1,\n newLength,\n newData; // Find all `Emulation Prevention Bytes`\n\n while (i < length - 2) {\n if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) {\n emulationPreventionBytesPositions.push(i + 2);\n i += 2;\n } else {\n i++;\n }\n } // If no Emulation Prevention Bytes were found just return the original\n // array\n\n if (emulationPreventionBytesPositions.length === 0) {\n return data;\n } // Create a new array to hold the NAL unit data\n\n newLength = length - emulationPreventionBytesPositions.length;\n newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === emulationPreventionBytesPositions[0]) {\n // Skip this byte\n sourceIndex++; // Remove this position index\n\n emulationPreventionBytesPositions.shift();\n }\n newData[i] = data[sourceIndex];\n }\n return newData;\n };\n /**\n * Read a sequence parameter set and return some interesting video\n * properties. A sequence parameter set is the H264 metadata that\n * describes the properties of upcoming video frames.\n * @param data {Uint8Array} the bytes of a sequence parameter set\n * @return {object} an object with configuration parsed from the\n * sequence parameter set, including the dimensions of the\n * associated video frames.\n */\n\n readSequenceParameterSet = function (data) {\n var frameCropLeftOffset = 0,\n frameCropRightOffset = 0,\n frameCropTopOffset = 0,\n frameCropBottomOffset = 0,\n expGolombDecoder,\n profileIdc,\n levelIdc,\n profileCompatibility,\n chromaFormatIdc,\n picOrderCntType,\n numRefFramesInPicOrderCntCycle,\n picWidthInMbsMinus1,\n picHeightInMapUnitsMinus1,\n frameMbsOnlyFlag,\n scalingListCount,\n sarRatio = [1, 1],\n aspectRatioIdc,\n i;\n expGolombDecoder = new ExpGolomb(data);\n profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc\n\n profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag\n\n levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8)\n\n expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id\n // some profiles have more optional data we don't need\n\n if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) {\n chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb();\n if (chromaFormatIdc === 3) {\n expGolombDecoder.skipBits(1); // separate_colour_plane_flag\n }\n\n expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8\n\n expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8\n\n expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag\n\n if (expGolombDecoder.readBoolean()) {\n // seq_scaling_matrix_present_flag\n scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;\n for (i = 0; i < scalingListCount; i++) {\n if (expGolombDecoder.readBoolean()) {\n // seq_scaling_list_present_flag[ i ]\n if (i < 6) {\n skipScalingList(16, expGolombDecoder);\n } else {\n skipScalingList(64, expGolombDecoder);\n }\n }\n }\n }\n }\n expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4\n\n picOrderCntType = expGolombDecoder.readUnsignedExpGolomb();\n if (picOrderCntType === 0) {\n expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4\n } else if (picOrderCntType === 1) {\n expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag\n\n expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic\n\n expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field\n\n numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb();\n for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) {\n expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ]\n }\n }\n\n expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames\n\n expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag\n\n picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb();\n picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb();\n frameMbsOnlyFlag = expGolombDecoder.readBits(1);\n if (frameMbsOnlyFlag === 0) {\n expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag\n }\n\n expGolombDecoder.skipBits(1); // direct_8x8_inference_flag\n\n if (expGolombDecoder.readBoolean()) {\n // frame_cropping_flag\n frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb();\n frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb();\n frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb();\n frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb();\n }\n if (expGolombDecoder.readBoolean()) {\n // vui_parameters_present_flag\n if (expGolombDecoder.readBoolean()) {\n // aspect_ratio_info_present_flag\n aspectRatioIdc = expGolombDecoder.readUnsignedByte();\n switch (aspectRatioIdc) {\n case 1:\n sarRatio = [1, 1];\n break;\n case 2:\n sarRatio = [12, 11];\n break;\n case 3:\n sarRatio = [10, 11];\n break;\n case 4:\n sarRatio = [16, 11];\n break;\n case 5:\n sarRatio = [40, 33];\n break;\n case 6:\n sarRatio = [24, 11];\n break;\n case 7:\n sarRatio = [20, 11];\n break;\n case 8:\n sarRatio = [32, 11];\n break;\n case 9:\n sarRatio = [80, 33];\n break;\n case 10:\n sarRatio = [18, 11];\n break;\n case 11:\n sarRatio = [15, 11];\n break;\n case 12:\n sarRatio = [64, 33];\n break;\n case 13:\n sarRatio = [160, 99];\n break;\n case 14:\n sarRatio = [4, 3];\n break;\n case 15:\n sarRatio = [3, 2];\n break;\n case 16:\n sarRatio = [2, 1];\n break;\n case 255:\n {\n sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()];\n break;\n }\n }\n if (sarRatio) {\n sarRatio[0] / sarRatio[1];\n }\n }\n }\n return {\n profileIdc: profileIdc,\n levelIdc: levelIdc,\n profileCompatibility: profileCompatibility,\n width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2,\n height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2,\n // sar is sample aspect ratio\n sarRatio: sarRatio\n };\n };\n };\n H264Stream$1.prototype = new Stream$2();\n var h264 = {\n H264Stream: H264Stream$1,\n NalByteStream: NalByteStream\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Utilities to detect basic properties and metadata about Aac data.\n */\n\n var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350];\n var parseId3TagSize = function (header, byteIndex) {\n var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9],\n flags = header[byteIndex + 5],\n footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0\n\n returnSize = returnSize >= 0 ? returnSize : 0;\n if (footerPresent) {\n return returnSize + 20;\n }\n return returnSize + 10;\n };\n var getId3Offset = function (data, offset) {\n if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) {\n return offset;\n }\n offset += parseId3TagSize(data, offset);\n return getId3Offset(data, offset);\n }; // TODO: use vhs-utils\n\n var isLikelyAacData$1 = function (data) {\n var offset = getId3Offset(data, 0);\n return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 &&\n // verify that the 2 layer bits are 0, aka this\n // is not mp3 data but aac data.\n (data[offset + 1] & 0x16) === 0x10;\n };\n var parseSyncSafeInteger = function (data) {\n return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];\n }; // return a percent-encoded representation of the specified byte range\n // @see http://en.wikipedia.org/wiki/Percent-encoding\n\n var percentEncode = function (bytes, start, end) {\n var i,\n result = '';\n for (i = start; i < end; i++) {\n result += '%' + ('00' + bytes[i].toString(16)).slice(-2);\n }\n return result;\n }; // return the string representation of the specified byte range,\n // interpreted as ISO-8859-1.\n\n var parseIso88591 = function (bytes, start, end) {\n return unescape(percentEncode(bytes, start, end)); // jshint ignore:line\n };\n\n var parseAdtsSize = function (header, byteIndex) {\n var lowThree = (header[byteIndex + 5] & 0xE0) >> 5,\n middle = header[byteIndex + 4] << 3,\n highTwo = header[byteIndex + 3] & 0x3 << 11;\n return highTwo | middle | lowThree;\n };\n var parseType$4 = function (header, byteIndex) {\n if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) {\n return 'timed-metadata';\n } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) {\n return 'audio';\n }\n return null;\n };\n var parseSampleRate = function (packet) {\n var i = 0;\n while (i + 5 < packet.length) {\n if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) {\n // If a valid header was not found, jump one forward and attempt to\n // find a valid ADTS header starting at the next byte\n i++;\n continue;\n }\n return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2];\n }\n return null;\n };\n var parseAacTimestamp = function (packet) {\n var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag\n\n frameStart = 10;\n if (packet[5] & 0x40) {\n // advance the frame start past the extended header\n frameStart += 4; // header size field\n\n frameStart += parseSyncSafeInteger(packet.subarray(10, 14));\n } // parse one or more ID3 frames\n // http://id3.org/id3v2.3.0#ID3v2_frame_overview\n\n do {\n // determine the number of bytes in this frame\n frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8));\n if (frameSize < 1) {\n return null;\n }\n frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]);\n if (frameHeader === 'PRIV') {\n frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10);\n for (var i = 0; i < frame.byteLength; i++) {\n if (frame[i] === 0) {\n var owner = parseIso88591(frame, 0, i);\n if (owner === 'com.apple.streaming.transportStreamTimestamp') {\n var d = frame.subarray(i + 1);\n var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2;\n size *= 4;\n size += d[7] & 0x03;\n return size;\n }\n break;\n }\n }\n }\n frameStart += 10; // advance past the frame header\n\n frameStart += frameSize; // advance past the frame body\n } while (frameStart < packet.byteLength);\n return null;\n };\n var utils = {\n isLikelyAacData: isLikelyAacData$1,\n parseId3TagSize: parseId3TagSize,\n parseAdtsSize: parseAdtsSize,\n parseType: parseType$4,\n parseSampleRate: parseSampleRate,\n parseAacTimestamp: parseAacTimestamp\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * A stream-based aac to mp4 converter. This utility can be used to\n * deliver mp4s to a SourceBuffer on platforms that support native\n * Media Source Extensions.\n */\n\n var Stream$1 = stream;\n var aacUtils = utils; // Constants\n\n var AacStream$1;\n /**\n * Splits an incoming stream of binary data into ADTS and ID3 Frames.\n */\n\n AacStream$1 = function () {\n var everything = new Uint8Array(),\n timeStamp = 0;\n AacStream$1.prototype.init.call(this);\n this.setTimestamp = function (timestamp) {\n timeStamp = timestamp;\n };\n this.push = function (bytes) {\n var frameSize = 0,\n byteIndex = 0,\n bytesLeft,\n chunk,\n packet,\n tempLength; // If there are bytes remaining from the last segment, prepend them to the\n // bytes that were pushed in\n\n if (everything.length) {\n tempLength = everything.length;\n everything = new Uint8Array(bytes.byteLength + tempLength);\n everything.set(everything.subarray(0, tempLength));\n everything.set(bytes, tempLength);\n } else {\n everything = bytes;\n }\n while (everything.length - byteIndex >= 3) {\n if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) {\n // Exit early because we don't have enough to parse\n // the ID3 tag header\n if (everything.length - byteIndex < 10) {\n break;\n } // check framesize\n\n frameSize = aacUtils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer\n // to emit a full packet\n // Add to byteIndex to support multiple ID3 tags in sequence\n\n if (byteIndex + frameSize > everything.length) {\n break;\n }\n chunk = {\n type: 'timed-metadata',\n data: everything.subarray(byteIndex, byteIndex + frameSize)\n };\n this.trigger('data', chunk);\n byteIndex += frameSize;\n continue;\n } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) {\n // Exit early because we don't have enough to parse\n // the ADTS frame header\n if (everything.length - byteIndex < 7) {\n break;\n }\n frameSize = aacUtils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer\n // to emit a full packet\n\n if (byteIndex + frameSize > everything.length) {\n break;\n }\n packet = {\n type: 'audio',\n data: everything.subarray(byteIndex, byteIndex + frameSize),\n pts: timeStamp,\n dts: timeStamp\n };\n this.trigger('data', packet);\n byteIndex += frameSize;\n continue;\n }\n byteIndex++;\n }\n bytesLeft = everything.length - byteIndex;\n if (bytesLeft > 0) {\n everything = everything.subarray(byteIndex);\n } else {\n everything = new Uint8Array();\n }\n };\n this.reset = function () {\n everything = new Uint8Array();\n this.trigger('reset');\n };\n this.endTimeline = function () {\n everything = new Uint8Array();\n this.trigger('endedtimeline');\n };\n };\n AacStream$1.prototype = new Stream$1();\n var aac = AacStream$1;\n var AUDIO_PROPERTIES$1 = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize'];\n var audioProperties = AUDIO_PROPERTIES$1;\n var VIDEO_PROPERTIES$1 = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio'];\n var videoProperties = VIDEO_PROPERTIES$1;\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * A stream-based mp2t to mp4 converter. This utility can be used to\n * deliver mp4s to a SourceBuffer on platforms that support native\n * Media Source Extensions.\n */\n\n var Stream = stream;\n var mp4 = mp4Generator;\n var frameUtils = frameUtils$1;\n var audioFrameUtils = audioFrameUtils$1;\n var trackDecodeInfo = trackDecodeInfo$1;\n var m2ts = m2ts_1;\n var clock = clock$2;\n var AdtsStream = adts;\n var H264Stream = h264.H264Stream;\n var AacStream = aac;\n var isLikelyAacData = utils.isLikelyAacData;\n var ONE_SECOND_IN_TS$1 = clock$2.ONE_SECOND_IN_TS;\n var AUDIO_PROPERTIES = audioProperties;\n var VIDEO_PROPERTIES = videoProperties; // object types\n\n var VideoSegmentStream, AudioSegmentStream, Transmuxer, CoalesceStream;\n var retriggerForStream = function (key, event) {\n event.stream = key;\n this.trigger('log', event);\n };\n var addPipelineLogRetriggers = function (transmuxer, pipeline) {\n var keys = Object.keys(pipeline);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i]; // skip non-stream keys and headOfPipeline\n // which is just a duplicate\n\n if (key === 'headOfPipeline' || !pipeline[key].on) {\n continue;\n }\n pipeline[key].on('log', retriggerForStream.bind(transmuxer, key));\n }\n };\n /**\n * Compare two arrays (even typed) for same-ness\n */\n\n var arrayEquals = function (a, b) {\n var i;\n if (a.length !== b.length) {\n return false;\n } // compare the value of each element in the array\n\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n };\n var generateSegmentTimingInfo = function (baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) {\n var ptsOffsetFromDts = startPts - startDts,\n decodeDuration = endDts - startDts,\n presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment,\n // however, the player time values will reflect a start from the baseMediaDecodeTime.\n // In order to provide relevant values for the player times, base timing info on the\n // baseMediaDecodeTime and the DTS and PTS durations of the segment.\n\n return {\n start: {\n dts: baseMediaDecodeTime,\n pts: baseMediaDecodeTime + ptsOffsetFromDts\n },\n end: {\n dts: baseMediaDecodeTime + decodeDuration,\n pts: baseMediaDecodeTime + presentationDuration\n },\n prependedContentDuration: prependedContentDuration,\n baseMediaDecodeTime: baseMediaDecodeTime\n };\n };\n /**\n * Constructs a single-track, ISO BMFF media segment from AAC data\n * events. The output of this stream can be fed to a SourceBuffer\n * configured with a suitable initialization segment.\n * @param track {object} track metadata configuration\n * @param options {object} transmuxer options object\n * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps\n * in the source; false to adjust the first segment to start at 0.\n */\n\n AudioSegmentStream = function (track, options) {\n var adtsFrames = [],\n sequenceNumber,\n earliestAllowedDts = 0,\n audioAppendStartTs = 0,\n videoBaseMediaDecodeTime = Infinity;\n options = options || {};\n sequenceNumber = options.firstSequenceNumber || 0;\n AudioSegmentStream.prototype.init.call(this);\n this.push = function (data) {\n trackDecodeInfo.collectDtsInfo(track, data);\n if (track) {\n AUDIO_PROPERTIES.forEach(function (prop) {\n track[prop] = data[prop];\n });\n } // buffer audio data until end() is called\n\n adtsFrames.push(data);\n };\n this.setEarliestDts = function (earliestDts) {\n earliestAllowedDts = earliestDts;\n };\n this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) {\n videoBaseMediaDecodeTime = baseMediaDecodeTime;\n };\n this.setAudioAppendStart = function (timestamp) {\n audioAppendStartTs = timestamp;\n };\n this.flush = function () {\n var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed\n\n if (adtsFrames.length === 0) {\n this.trigger('done', 'AudioSegmentStream');\n return;\n }\n frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts);\n track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock\n\n videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to\n // samples (that is, adts frames) in the audio data\n\n track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat\n\n mdat = mp4.mdat(audioFrameUtils.concatenateFrameData(frames));\n adtsFrames = [];\n moof = mp4.moof(sequenceNumber, [track]);\n boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time\n\n sequenceNumber++;\n boxes.set(moof);\n boxes.set(mdat, moof.byteLength);\n trackDecodeInfo.clearDtsInfo(track);\n frameDuration = Math.ceil(ONE_SECOND_IN_TS$1 * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with\n // tests) on adding the timingInfo event. However, it seems unlikely that there's a\n // valid use-case where an init segment/data should be triggered without associated\n // frames. Leaving for now, but should be looked into.\n\n if (frames.length) {\n segmentDuration = frames.length * frameDuration;\n this.trigger('segmentTimingInfo', generateSegmentTimingInfo(\n // The audio track's baseMediaDecodeTime is in audio clock cycles, but the\n // frame info is in video clock cycles. Convert to match expectation of\n // listeners (that all timestamps will be based on video clock cycles).\n clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate),\n // frame times are already in video clock, as is segment duration\n frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0));\n this.trigger('timingInfo', {\n start: frames[0].pts,\n end: frames[0].pts + segmentDuration\n });\n }\n this.trigger('data', {\n track: track,\n boxes: boxes\n });\n this.trigger('done', 'AudioSegmentStream');\n };\n this.reset = function () {\n trackDecodeInfo.clearDtsInfo(track);\n adtsFrames = [];\n this.trigger('reset');\n };\n };\n AudioSegmentStream.prototype = new Stream();\n /**\n * Constructs a single-track, ISO BMFF media segment from H264 data\n * events. The output of this stream can be fed to a SourceBuffer\n * configured with a suitable initialization segment.\n * @param track {object} track metadata configuration\n * @param options {object} transmuxer options object\n * @param options.alignGopsAtEnd {boolean} If true, start from the end of the\n * gopsToAlignWith list when attempting to align gop pts\n * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps\n * in the source; false to adjust the first segment to start at 0.\n */\n\n VideoSegmentStream = function (track, options) {\n var sequenceNumber,\n nalUnits = [],\n gopsToAlignWith = [],\n config,\n pps;\n options = options || {};\n sequenceNumber = options.firstSequenceNumber || 0;\n VideoSegmentStream.prototype.init.call(this);\n delete track.minPTS;\n this.gopCache_ = [];\n /**\n * Constructs a ISO BMFF segment given H264 nalUnits\n * @param {Object} nalUnit A data event representing a nalUnit\n * @param {String} nalUnit.nalUnitType\n * @param {Object} nalUnit.config Properties for a mp4 track\n * @param {Uint8Array} nalUnit.data The nalUnit bytes\n * @see lib/codecs/h264.js\n **/\n\n this.push = function (nalUnit) {\n trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config\n\n if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) {\n config = nalUnit.config;\n track.sps = [nalUnit.data];\n VIDEO_PROPERTIES.forEach(function (prop) {\n track[prop] = config[prop];\n }, this);\n }\n if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) {\n pps = nalUnit.data;\n track.pps = [nalUnit.data];\n } // buffer video until flush() is called\n\n nalUnits.push(nalUnit);\n };\n /**\n * Pass constructed ISO BMFF track and boxes on to the\n * next stream in the pipeline\n **/\n\n this.flush = function () {\n var frames,\n gopForFusion,\n gops,\n moof,\n mdat,\n boxes,\n prependedContentDuration = 0,\n firstGop,\n lastGop; // Throw away nalUnits at the start of the byte stream until\n // we find the first AUD\n\n while (nalUnits.length) {\n if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') {\n break;\n }\n nalUnits.shift();\n } // Return early if no video data has been observed\n\n if (nalUnits.length === 0) {\n this.resetStream_();\n this.trigger('done', 'VideoSegmentStream');\n return;\n } // Organize the raw nal-units into arrays that represent\n // higher-level constructs such as frames and gops\n // (group-of-pictures)\n\n frames = frameUtils.groupNalsIntoFrames(nalUnits);\n gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have\n // a problem since MSE (on Chrome) requires a leading keyframe.\n //\n // We have two approaches to repairing this situation:\n // 1) GOP-FUSION:\n // This is where we keep track of the GOPS (group-of-pictures)\n // from previous fragments and attempt to find one that we can\n // prepend to the current fragment in order to create a valid\n // fragment.\n // 2) KEYFRAME-PULLING:\n // Here we search for the first keyframe in the fragment and\n // throw away all the frames between the start of the fragment\n // and that keyframe. We then extend the duration and pull the\n // PTS of the keyframe forward so that it covers the time range\n // of the frames that were disposed of.\n //\n // #1 is far prefereable over #2 which can cause \"stuttering\" but\n // requires more things to be just right.\n\n if (!gops[0][0].keyFrame) {\n // Search for a gop for fusion from our gopCache\n gopForFusion = this.getGopForFusion_(nalUnits[0], track);\n if (gopForFusion) {\n // in order to provide more accurate timing information about the segment, save\n // the number of seconds prepended to the original segment due to GOP fusion\n prependedContentDuration = gopForFusion.duration;\n gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the\n // new gop at the beginning\n\n gops.byteLength += gopForFusion.byteLength;\n gops.nalCount += gopForFusion.nalCount;\n gops.pts = gopForFusion.pts;\n gops.dts = gopForFusion.dts;\n gops.duration += gopForFusion.duration;\n } else {\n // If we didn't find a candidate gop fall back to keyframe-pulling\n gops = frameUtils.extendFirstKeyFrame(gops);\n }\n } // Trim gops to align with gopsToAlignWith\n\n if (gopsToAlignWith.length) {\n var alignedGops;\n if (options.alignGopsAtEnd) {\n alignedGops = this.alignGopsAtEnd_(gops);\n } else {\n alignedGops = this.alignGopsAtStart_(gops);\n }\n if (!alignedGops) {\n // save all the nals in the last GOP into the gop cache\n this.gopCache_.unshift({\n gop: gops.pop(),\n pps: track.pps,\n sps: track.sps\n }); // Keep a maximum of 6 GOPs in the cache\n\n this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits\n\n nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith\n\n this.resetStream_();\n this.trigger('done', 'VideoSegmentStream');\n return;\n } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct\n // when recalculated before sending off to CoalesceStream\n\n trackDecodeInfo.clearDtsInfo(track);\n gops = alignedGops;\n }\n trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to\n // samples (that is, frames) in the video data\n\n track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat\n\n mdat = mp4.mdat(frameUtils.concatenateNalData(gops));\n track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps);\n this.trigger('processedGopsInfo', gops.map(function (gop) {\n return {\n pts: gop.pts,\n dts: gop.dts,\n byteLength: gop.byteLength\n };\n }));\n firstGop = gops[0];\n lastGop = gops[gops.length - 1];\n this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration));\n this.trigger('timingInfo', {\n start: gops[0].pts,\n end: gops[gops.length - 1].pts + gops[gops.length - 1].duration\n }); // save all the nals in the last GOP into the gop cache\n\n this.gopCache_.unshift({\n gop: gops.pop(),\n pps: track.pps,\n sps: track.sps\n }); // Keep a maximum of 6 GOPs in the cache\n\n this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits\n\n nalUnits = [];\n this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime);\n this.trigger('timelineStartInfo', track.timelineStartInfo);\n moof = mp4.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of\n // throwing away hundreds of media segment fragments\n\n boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time\n\n sequenceNumber++;\n boxes.set(moof);\n boxes.set(mdat, moof.byteLength);\n this.trigger('data', {\n track: track,\n boxes: boxes\n });\n this.resetStream_(); // Continue with the flush process now\n\n this.trigger('done', 'VideoSegmentStream');\n };\n this.reset = function () {\n this.resetStream_();\n nalUnits = [];\n this.gopCache_.length = 0;\n gopsToAlignWith.length = 0;\n this.trigger('reset');\n };\n this.resetStream_ = function () {\n trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments\n // for instance, when we are rendition switching\n\n config = undefined;\n pps = undefined;\n }; // Search for a candidate Gop for gop-fusion from the gop cache and\n // return it or return null if no good candidate was found\n\n this.getGopForFusion_ = function (nalUnit) {\n var halfSecond = 45000,\n // Half-a-second in a 90khz clock\n allowableOverlap = 10000,\n // About 3 frames @ 30fps\n nearestDistance = Infinity,\n dtsDistance,\n nearestGopObj,\n currentGop,\n currentGopObj,\n i; // Search for the GOP nearest to the beginning of this nal unit\n\n for (i = 0; i < this.gopCache_.length; i++) {\n currentGopObj = this.gopCache_[i];\n currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS\n\n if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) {\n continue;\n } // Reject Gops that would require a negative baseMediaDecodeTime\n\n if (currentGop.dts < track.timelineStartInfo.dts) {\n continue;\n } // The distance between the end of the gop and the start of the nalUnit\n\n dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within\n // a half-second of the nal unit\n\n if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) {\n // Always use the closest GOP we found if there is more than\n // one candidate\n if (!nearestGopObj || nearestDistance > dtsDistance) {\n nearestGopObj = currentGopObj;\n nearestDistance = dtsDistance;\n }\n }\n }\n if (nearestGopObj) {\n return nearestGopObj.gop;\n }\n return null;\n }; // trim gop list to the first gop found that has a matching pts with a gop in the list\n // of gopsToAlignWith starting from the START of the list\n\n this.alignGopsAtStart_ = function (gops) {\n var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops;\n byteLength = gops.byteLength;\n nalCount = gops.nalCount;\n duration = gops.duration;\n alignIndex = gopIndex = 0;\n while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) {\n align = gopsToAlignWith[alignIndex];\n gop = gops[gopIndex];\n if (align.pts === gop.pts) {\n break;\n }\n if (gop.pts > align.pts) {\n // this current gop starts after the current gop we want to align on, so increment\n // align index\n alignIndex++;\n continue;\n } // current gop starts before the current gop we want to align on. so increment gop\n // index\n\n gopIndex++;\n byteLength -= gop.byteLength;\n nalCount -= gop.nalCount;\n duration -= gop.duration;\n }\n if (gopIndex === 0) {\n // no gops to trim\n return gops;\n }\n if (gopIndex === gops.length) {\n // all gops trimmed, skip appending all gops\n return null;\n }\n alignedGops = gops.slice(gopIndex);\n alignedGops.byteLength = byteLength;\n alignedGops.duration = duration;\n alignedGops.nalCount = nalCount;\n alignedGops.pts = alignedGops[0].pts;\n alignedGops.dts = alignedGops[0].dts;\n return alignedGops;\n }; // trim gop list to the first gop found that has a matching pts with a gop in the list\n // of gopsToAlignWith starting from the END of the list\n\n this.alignGopsAtEnd_ = function (gops) {\n var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound;\n alignIndex = gopsToAlignWith.length - 1;\n gopIndex = gops.length - 1;\n alignEndIndex = null;\n matchFound = false;\n while (alignIndex >= 0 && gopIndex >= 0) {\n align = gopsToAlignWith[alignIndex];\n gop = gops[gopIndex];\n if (align.pts === gop.pts) {\n matchFound = true;\n break;\n }\n if (align.pts > gop.pts) {\n alignIndex--;\n continue;\n }\n if (alignIndex === gopsToAlignWith.length - 1) {\n // gop.pts is greater than the last alignment candidate. If no match is found\n // by the end of this loop, we still want to append gops that come after this\n // point\n alignEndIndex = gopIndex;\n }\n gopIndex--;\n }\n if (!matchFound && alignEndIndex === null) {\n return null;\n }\n var trimIndex;\n if (matchFound) {\n trimIndex = gopIndex;\n } else {\n trimIndex = alignEndIndex;\n }\n if (trimIndex === 0) {\n return gops;\n }\n var alignedGops = gops.slice(trimIndex);\n var metadata = alignedGops.reduce(function (total, gop) {\n total.byteLength += gop.byteLength;\n total.duration += gop.duration;\n total.nalCount += gop.nalCount;\n return total;\n }, {\n byteLength: 0,\n duration: 0,\n nalCount: 0\n });\n alignedGops.byteLength = metadata.byteLength;\n alignedGops.duration = metadata.duration;\n alignedGops.nalCount = metadata.nalCount;\n alignedGops.pts = alignedGops[0].pts;\n alignedGops.dts = alignedGops[0].dts;\n return alignedGops;\n };\n this.alignGopsWith = function (newGopsToAlignWith) {\n gopsToAlignWith = newGopsToAlignWith;\n };\n };\n VideoSegmentStream.prototype = new Stream();\n /**\n * A Stream that can combine multiple streams (ie. audio & video)\n * into a single output segment for MSE. Also supports audio-only\n * and video-only streams.\n * @param options {object} transmuxer options object\n * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps\n * in the source; false to adjust the first segment to start at media timeline start.\n */\n\n CoalesceStream = function (options, metadataStream) {\n // Number of Tracks per output segment\n // If greater than 1, we combine multiple\n // tracks into a single segment\n this.numberOfTracks = 0;\n this.metadataStream = metadataStream;\n options = options || {};\n if (typeof options.remux !== 'undefined') {\n this.remuxTracks = !!options.remux;\n } else {\n this.remuxTracks = true;\n }\n if (typeof options.keepOriginalTimestamps === 'boolean') {\n this.keepOriginalTimestamps = options.keepOriginalTimestamps;\n } else {\n this.keepOriginalTimestamps = false;\n }\n this.pendingTracks = [];\n this.videoTrack = null;\n this.pendingBoxes = [];\n this.pendingCaptions = [];\n this.pendingMetadata = [];\n this.pendingBytes = 0;\n this.emittedTracks = 0;\n CoalesceStream.prototype.init.call(this); // Take output from multiple\n\n this.push = function (output) {\n // buffer incoming captions until the associated video segment\n // finishes\n if (output.content || output.text) {\n return this.pendingCaptions.push(output);\n } // buffer incoming id3 tags until the final flush\n\n if (output.frames) {\n return this.pendingMetadata.push(output);\n } // Add this track to the list of pending tracks and store\n // important information required for the construction of\n // the final segment\n\n this.pendingTracks.push(output.track);\n this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome?\n // We unshift audio and push video because\n // as of Chrome 75 when switching from\n // one init segment to another if the video\n // mdat does not appear after the audio mdat\n // only audio will play for the duration of our transmux.\n\n if (output.track.type === 'video') {\n this.videoTrack = output.track;\n this.pendingBoxes.push(output.boxes);\n }\n if (output.track.type === 'audio') {\n this.audioTrack = output.track;\n this.pendingBoxes.unshift(output.boxes);\n }\n };\n };\n CoalesceStream.prototype = new Stream();\n CoalesceStream.prototype.flush = function (flushSource) {\n var offset = 0,\n event = {\n captions: [],\n captionStreams: {},\n metadata: [],\n info: {}\n },\n caption,\n id3,\n initSegment,\n timelineStartPts = 0,\n i;\n if (this.pendingTracks.length < this.numberOfTracks) {\n if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') {\n // Return because we haven't received a flush from a data-generating\n // portion of the segment (meaning that we have only recieved meta-data\n // or captions.)\n return;\n } else if (this.remuxTracks) {\n // Return until we have enough tracks from the pipeline to remux (if we\n // are remuxing audio and video into a single MP4)\n return;\n } else if (this.pendingTracks.length === 0) {\n // In the case where we receive a flush without any data having been\n // received we consider it an emitted track for the purposes of coalescing\n // `done` events.\n // We do this for the case where there is an audio and video track in the\n // segment but no audio data. (seen in several playlists with alternate\n // audio tracks and no audio present in the main TS segments.)\n this.emittedTracks++;\n if (this.emittedTracks >= this.numberOfTracks) {\n this.trigger('done');\n this.emittedTracks = 0;\n }\n return;\n }\n }\n if (this.videoTrack) {\n timelineStartPts = this.videoTrack.timelineStartInfo.pts;\n VIDEO_PROPERTIES.forEach(function (prop) {\n event.info[prop] = this.videoTrack[prop];\n }, this);\n } else if (this.audioTrack) {\n timelineStartPts = this.audioTrack.timelineStartInfo.pts;\n AUDIO_PROPERTIES.forEach(function (prop) {\n event.info[prop] = this.audioTrack[prop];\n }, this);\n }\n if (this.videoTrack || this.audioTrack) {\n if (this.pendingTracks.length === 1) {\n event.type = this.pendingTracks[0].type;\n } else {\n event.type = 'combined';\n }\n this.emittedTracks += this.pendingTracks.length;\n initSegment = mp4.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment\n\n event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov\n // and track definitions\n\n event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats\n\n event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together\n\n for (i = 0; i < this.pendingBoxes.length; i++) {\n event.data.set(this.pendingBoxes[i], offset);\n offset += this.pendingBoxes[i].byteLength;\n } // Translate caption PTS times into second offsets to match the\n // video timeline for the segment, and add track info\n\n for (i = 0; i < this.pendingCaptions.length; i++) {\n caption = this.pendingCaptions[i];\n caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps);\n caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps);\n event.captionStreams[caption.stream] = true;\n event.captions.push(caption);\n } // Translate ID3 frame PTS times into second offsets to match the\n // video timeline for the segment\n\n for (i = 0; i < this.pendingMetadata.length; i++) {\n id3 = this.pendingMetadata[i];\n id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps);\n event.metadata.push(id3);\n } // We add this to every single emitted segment even though we only need\n // it for the first\n\n event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state\n\n this.pendingTracks.length = 0;\n this.videoTrack = null;\n this.pendingBoxes.length = 0;\n this.pendingCaptions.length = 0;\n this.pendingBytes = 0;\n this.pendingMetadata.length = 0; // Emit the built segment\n // We include captions and ID3 tags for backwards compatibility,\n // ideally we should send only video and audio in the data event\n\n this.trigger('data', event); // Emit each caption to the outside world\n // Ideally, this would happen immediately on parsing captions,\n // but we need to ensure that video data is sent back first\n // so that caption timing can be adjusted to match video timing\n\n for (i = 0; i < event.captions.length; i++) {\n caption = event.captions[i];\n this.trigger('caption', caption);\n } // Emit each id3 tag to the outside world\n // Ideally, this would happen immediately on parsing the tag,\n // but we need to ensure that video data is sent back first\n // so that ID3 frame timing can be adjusted to match video timing\n\n for (i = 0; i < event.metadata.length; i++) {\n id3 = event.metadata[i];\n this.trigger('id3Frame', id3);\n }\n } // Only emit `done` if all tracks have been flushed and emitted\n\n if (this.emittedTracks >= this.numberOfTracks) {\n this.trigger('done');\n this.emittedTracks = 0;\n }\n };\n CoalesceStream.prototype.setRemux = function (val) {\n this.remuxTracks = val;\n };\n /**\n * A Stream that expects MP2T binary data as input and produces\n * corresponding media segments, suitable for use with Media Source\n * Extension (MSE) implementations that support the ISO BMFF byte\n * stream format, like Chrome.\n */\n\n Transmuxer = function (options) {\n var self = this,\n hasFlushed = true,\n videoTrack,\n audioTrack;\n Transmuxer.prototype.init.call(this);\n options = options || {};\n this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0;\n this.transmuxPipeline_ = {};\n this.setupAacPipeline = function () {\n var pipeline = {};\n this.transmuxPipeline_ = pipeline;\n pipeline.type = 'aac';\n pipeline.metadataStream = new m2ts.MetadataStream(); // set up the parsing pipeline\n\n pipeline.aacStream = new AacStream();\n pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream('audio');\n pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream('timed-metadata');\n pipeline.adtsStream = new AdtsStream();\n pipeline.coalesceStream = new CoalesceStream(options, pipeline.metadataStream);\n pipeline.headOfPipeline = pipeline.aacStream;\n pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream);\n pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);\n pipeline.metadataStream.on('timestamp', function (frame) {\n pipeline.aacStream.setTimestamp(frame.timeStamp);\n });\n pipeline.aacStream.on('data', function (data) {\n if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) {\n return;\n }\n audioTrack = audioTrack || {\n timelineStartInfo: {\n baseMediaDecodeTime: self.baseMediaDecodeTime\n },\n codec: 'adts',\n type: 'audio'\n }; // hook up the audio segment stream to the first track with aac data\n\n pipeline.coalesceStream.numberOfTracks++;\n pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options);\n pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream'));\n pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline\n\n pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info\n\n self.trigger('trackinfo', {\n hasAudio: !!audioTrack,\n hasVideo: !!videoTrack\n });\n }); // Re-emit any data coming from the coalesce stream to the outside world\n\n pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline\n\n pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done'));\n addPipelineLogRetriggers(this, pipeline);\n };\n this.setupTsPipeline = function () {\n var pipeline = {};\n this.transmuxPipeline_ = pipeline;\n pipeline.type = 'ts';\n pipeline.metadataStream = new m2ts.MetadataStream(); // set up the parsing pipeline\n\n pipeline.packetStream = new m2ts.TransportPacketStream();\n pipeline.parseStream = new m2ts.TransportParseStream();\n pipeline.elementaryStream = new m2ts.ElementaryStream();\n pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream();\n pipeline.adtsStream = new AdtsStream();\n pipeline.h264Stream = new H264Stream();\n pipeline.captionStream = new m2ts.CaptionStream(options);\n pipeline.coalesceStream = new CoalesceStream(options, pipeline.metadataStream);\n pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams\n\n pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!!\n // demux the streams\n\n pipeline.timestampRolloverStream.pipe(pipeline.h264Stream);\n pipeline.timestampRolloverStream.pipe(pipeline.adtsStream);\n pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream\n\n pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream);\n pipeline.elementaryStream.on('data', function (data) {\n var i;\n if (data.type === 'metadata') {\n i = data.tracks.length; // scan the tracks listed in the metadata\n\n while (i--) {\n if (!videoTrack && data.tracks[i].type === 'video') {\n videoTrack = data.tracks[i];\n videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime;\n } else if (!audioTrack && data.tracks[i].type === 'audio') {\n audioTrack = data.tracks[i];\n audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime;\n }\n } // hook up the video segment stream to the first track with h264 data\n\n if (videoTrack && !pipeline.videoSegmentStream) {\n pipeline.coalesceStream.numberOfTracks++;\n pipeline.videoSegmentStream = new VideoSegmentStream(videoTrack, options);\n pipeline.videoSegmentStream.on('log', self.getLogTrigger_('videoSegmentStream'));\n pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) {\n // When video emits timelineStartInfo data after a flush, we forward that\n // info to the AudioSegmentStream, if it exists, because video timeline\n // data takes precedence. Do not do this if keepOriginalTimestamps is set,\n // because this is a particularly subtle form of timestamp alteration.\n if (audioTrack && !options.keepOriginalTimestamps) {\n audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the\n // very earliest DTS we have seen in video because Chrome will\n // interpret any video track with a baseMediaDecodeTime that is\n // non-zero as a gap.\n\n pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime);\n }\n });\n pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo'));\n pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo'));\n pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) {\n if (audioTrack) {\n pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime);\n }\n });\n pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline\n\n pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream);\n }\n if (audioTrack && !pipeline.audioSegmentStream) {\n // hook up the audio segment stream to the first track with aac data\n pipeline.coalesceStream.numberOfTracks++;\n pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options);\n pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream'));\n pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo'));\n pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline\n\n pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);\n } // emit pmt info\n\n self.trigger('trackinfo', {\n hasAudio: !!audioTrack,\n hasVideo: !!videoTrack\n });\n }\n }); // Re-emit any data coming from the coalesce stream to the outside world\n\n pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data'));\n pipeline.coalesceStream.on('id3Frame', function (id3Frame) {\n id3Frame.dispatchType = pipeline.metadataStream.dispatchType;\n self.trigger('id3Frame', id3Frame);\n });\n pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline\n\n pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done'));\n addPipelineLogRetriggers(this, pipeline);\n }; // hook up the segment streams once track metadata is delivered\n\n this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) {\n var pipeline = this.transmuxPipeline_;\n if (!options.keepOriginalTimestamps) {\n this.baseMediaDecodeTime = baseMediaDecodeTime;\n }\n if (audioTrack) {\n audioTrack.timelineStartInfo.dts = undefined;\n audioTrack.timelineStartInfo.pts = undefined;\n trackDecodeInfo.clearDtsInfo(audioTrack);\n if (pipeline.audioTimestampRolloverStream) {\n pipeline.audioTimestampRolloverStream.discontinuity();\n }\n }\n if (videoTrack) {\n if (pipeline.videoSegmentStream) {\n pipeline.videoSegmentStream.gopCache_ = [];\n }\n videoTrack.timelineStartInfo.dts = undefined;\n videoTrack.timelineStartInfo.pts = undefined;\n trackDecodeInfo.clearDtsInfo(videoTrack);\n pipeline.captionStream.reset();\n }\n if (pipeline.timestampRolloverStream) {\n pipeline.timestampRolloverStream.discontinuity();\n }\n };\n this.setAudioAppendStart = function (timestamp) {\n if (audioTrack) {\n this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp);\n }\n };\n this.setRemux = function (val) {\n var pipeline = this.transmuxPipeline_;\n options.remux = val;\n if (pipeline && pipeline.coalesceStream) {\n pipeline.coalesceStream.setRemux(val);\n }\n };\n this.alignGopsWith = function (gopsToAlignWith) {\n if (videoTrack && this.transmuxPipeline_.videoSegmentStream) {\n this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith);\n }\n };\n this.getLogTrigger_ = function (key) {\n var self = this;\n return function (event) {\n event.stream = key;\n self.trigger('log', event);\n };\n }; // feed incoming data to the front of the parsing pipeline\n\n this.push = function (data) {\n if (hasFlushed) {\n var isAac = isLikelyAacData(data);\n if (isAac && this.transmuxPipeline_.type !== 'aac') {\n this.setupAacPipeline();\n } else if (!isAac && this.transmuxPipeline_.type !== 'ts') {\n this.setupTsPipeline();\n }\n hasFlushed = false;\n }\n this.transmuxPipeline_.headOfPipeline.push(data);\n }; // flush any buffered data\n\n this.flush = function () {\n hasFlushed = true; // Start at the top of the pipeline and flush all pending work\n\n this.transmuxPipeline_.headOfPipeline.flush();\n };\n this.endTimeline = function () {\n this.transmuxPipeline_.headOfPipeline.endTimeline();\n };\n this.reset = function () {\n if (this.transmuxPipeline_.headOfPipeline) {\n this.transmuxPipeline_.headOfPipeline.reset();\n }\n }; // Caption data has to be reset when seeking outside buffered range\n\n this.resetCaptions = function () {\n if (this.transmuxPipeline_.captionStream) {\n this.transmuxPipeline_.captionStream.reset();\n }\n };\n };\n Transmuxer.prototype = new Stream();\n var transmuxer = {\n Transmuxer: Transmuxer,\n VideoSegmentStream: VideoSegmentStream,\n AudioSegmentStream: AudioSegmentStream,\n AUDIO_PROPERTIES: AUDIO_PROPERTIES,\n VIDEO_PROPERTIES: VIDEO_PROPERTIES,\n // exported for testing\n generateSegmentTimingInfo: generateSegmentTimingInfo\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var toUnsigned$3 = function (value) {\n return value >>> 0;\n };\n var toHexString$1 = function (value) {\n return ('00' + value.toString(16)).slice(-2);\n };\n var bin = {\n toUnsigned: toUnsigned$3,\n toHexString: toHexString$1\n };\n var parseType$3 = function (buffer) {\n var result = '';\n result += String.fromCharCode(buffer[0]);\n result += String.fromCharCode(buffer[1]);\n result += String.fromCharCode(buffer[2]);\n result += String.fromCharCode(buffer[3]);\n return result;\n };\n var parseType_1 = parseType$3;\n var toUnsigned$2 = bin.toUnsigned;\n var parseType$2 = parseType_1;\n var findBox$2 = function (data, path) {\n var results = [],\n i,\n size,\n type,\n end,\n subresults;\n if (!path.length) {\n // short-circuit the search for empty paths\n return null;\n }\n for (i = 0; i < data.byteLength;) {\n size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]);\n type = parseType$2(data.subarray(i + 4, i + 8));\n end = size > 1 ? i + size : data.byteLength;\n if (type === path[0]) {\n if (path.length === 1) {\n // this is the end of the path and we've found the box we were\n // looking for\n results.push(data.subarray(i + 8, end));\n } else {\n // recursively search for the next box along the path\n subresults = findBox$2(data.subarray(i + 8, end), path.slice(1));\n if (subresults.length) {\n results = results.concat(subresults);\n }\n }\n }\n i = end;\n } // we've finished searching all of data\n\n return results;\n };\n var findBox_1 = findBox$2;\n var toUnsigned$1 = bin.toUnsigned;\n var getUint64$2 = numbers.getUint64;\n var tfdt = function (data) {\n var result = {\n version: data[0],\n flags: new Uint8Array(data.subarray(1, 4))\n };\n if (result.version === 1) {\n result.baseMediaDecodeTime = getUint64$2(data.subarray(4));\n } else {\n result.baseMediaDecodeTime = toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]);\n }\n return result;\n };\n var parseTfdt$2 = tfdt;\n var parseSampleFlags$1 = function (flags) {\n return {\n isLeading: (flags[0] & 0x0c) >>> 2,\n dependsOn: flags[0] & 0x03,\n isDependedOn: (flags[1] & 0xc0) >>> 6,\n hasRedundancy: (flags[1] & 0x30) >>> 4,\n paddingValue: (flags[1] & 0x0e) >>> 1,\n isNonSyncSample: flags[1] & 0x01,\n degradationPriority: flags[2] << 8 | flags[3]\n };\n };\n var parseSampleFlags_1 = parseSampleFlags$1;\n var parseSampleFlags = parseSampleFlags_1;\n var trun = function (data) {\n var result = {\n version: data[0],\n flags: new Uint8Array(data.subarray(1, 4)),\n samples: []\n },\n view = new DataView(data.buffer, data.byteOffset, data.byteLength),\n // Flag interpretation\n dataOffsetPresent = result.flags[2] & 0x01,\n // compare with 2nd byte of 0x1\n firstSampleFlagsPresent = result.flags[2] & 0x04,\n // compare with 2nd byte of 0x4\n sampleDurationPresent = result.flags[1] & 0x01,\n // compare with 2nd byte of 0x100\n sampleSizePresent = result.flags[1] & 0x02,\n // compare with 2nd byte of 0x200\n sampleFlagsPresent = result.flags[1] & 0x04,\n // compare with 2nd byte of 0x400\n sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08,\n // compare with 2nd byte of 0x800\n sampleCount = view.getUint32(4),\n offset = 8,\n sample;\n if (dataOffsetPresent) {\n // 32 bit signed integer\n result.dataOffset = view.getInt32(offset);\n offset += 4;\n } // Overrides the flags for the first sample only. The order of\n // optional values will be: duration, size, compositionTimeOffset\n\n if (firstSampleFlagsPresent && sampleCount) {\n sample = {\n flags: parseSampleFlags(data.subarray(offset, offset + 4))\n };\n offset += 4;\n if (sampleDurationPresent) {\n sample.duration = view.getUint32(offset);\n offset += 4;\n }\n if (sampleSizePresent) {\n sample.size = view.getUint32(offset);\n offset += 4;\n }\n if (sampleCompositionTimeOffsetPresent) {\n if (result.version === 1) {\n sample.compositionTimeOffset = view.getInt32(offset);\n } else {\n sample.compositionTimeOffset = view.getUint32(offset);\n }\n offset += 4;\n }\n result.samples.push(sample);\n sampleCount--;\n }\n while (sampleCount--) {\n sample = {};\n if (sampleDurationPresent) {\n sample.duration = view.getUint32(offset);\n offset += 4;\n }\n if (sampleSizePresent) {\n sample.size = view.getUint32(offset);\n offset += 4;\n }\n if (sampleFlagsPresent) {\n sample.flags = parseSampleFlags(data.subarray(offset, offset + 4));\n offset += 4;\n }\n if (sampleCompositionTimeOffsetPresent) {\n if (result.version === 1) {\n sample.compositionTimeOffset = view.getInt32(offset);\n } else {\n sample.compositionTimeOffset = view.getUint32(offset);\n }\n offset += 4;\n }\n result.samples.push(sample);\n }\n return result;\n };\n var parseTrun$2 = trun;\n var tfhd = function (data) {\n var view = new DataView(data.buffer, data.byteOffset, data.byteLength),\n result = {\n version: data[0],\n flags: new Uint8Array(data.subarray(1, 4)),\n trackId: view.getUint32(4)\n },\n baseDataOffsetPresent = result.flags[2] & 0x01,\n sampleDescriptionIndexPresent = result.flags[2] & 0x02,\n defaultSampleDurationPresent = result.flags[2] & 0x08,\n defaultSampleSizePresent = result.flags[2] & 0x10,\n defaultSampleFlagsPresent = result.flags[2] & 0x20,\n durationIsEmpty = result.flags[0] & 0x010000,\n defaultBaseIsMoof = result.flags[0] & 0x020000,\n i;\n i = 8;\n if (baseDataOffsetPresent) {\n i += 4; // truncate top 4 bytes\n // FIXME: should we read the full 64 bits?\n\n result.baseDataOffset = view.getUint32(12);\n i += 4;\n }\n if (sampleDescriptionIndexPresent) {\n result.sampleDescriptionIndex = view.getUint32(i);\n i += 4;\n }\n if (defaultSampleDurationPresent) {\n result.defaultSampleDuration = view.getUint32(i);\n i += 4;\n }\n if (defaultSampleSizePresent) {\n result.defaultSampleSize = view.getUint32(i);\n i += 4;\n }\n if (defaultSampleFlagsPresent) {\n result.defaultSampleFlags = view.getUint32(i);\n }\n if (durationIsEmpty) {\n result.durationIsEmpty = true;\n }\n if (!baseDataOffsetPresent && defaultBaseIsMoof) {\n result.baseDataOffsetIsMoof = true;\n }\n return result;\n };\n var parseTfhd$2 = tfhd;\n var win;\n if (typeof window !== \"undefined\") {\n win = window;\n } else if (typeof commonjsGlobal !== \"undefined\") {\n win = commonjsGlobal;\n } else if (typeof self !== \"undefined\") {\n win = self;\n } else {\n win = {};\n }\n var window_1 = win;\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Reads in-band CEA-708 captions out of FMP4 segments.\n * @see https://en.wikipedia.org/wiki/CEA-708\n */\n\n var discardEmulationPreventionBytes = captionPacketParser.discardEmulationPreventionBytes;\n var CaptionStream = captionStream.CaptionStream;\n var findBox$1 = findBox_1;\n var parseTfdt$1 = parseTfdt$2;\n var parseTrun$1 = parseTrun$2;\n var parseTfhd$1 = parseTfhd$2;\n var window$2 = window_1;\n /**\n * Maps an offset in the mdat to a sample based on the the size of the samples.\n * Assumes that `parseSamples` has been called first.\n *\n * @param {Number} offset - The offset into the mdat\n * @param {Object[]} samples - An array of samples, parsed using `parseSamples`\n * @return {?Object} The matching sample, or null if no match was found.\n *\n * @see ISO-BMFF-12/2015, Section 8.8.8\n **/\n\n var mapToSample = function (offset, samples) {\n var approximateOffset = offset;\n for (var i = 0; i < samples.length; i++) {\n var sample = samples[i];\n if (approximateOffset < sample.size) {\n return sample;\n }\n approximateOffset -= sample.size;\n }\n return null;\n };\n /**\n * Finds SEI nal units contained in a Media Data Box.\n * Assumes that `parseSamples` has been called first.\n *\n * @param {Uint8Array} avcStream - The bytes of the mdat\n * @param {Object[]} samples - The samples parsed out by `parseSamples`\n * @param {Number} trackId - The trackId of this video track\n * @return {Object[]} seiNals - the parsed SEI NALUs found.\n * The contents of the seiNal should match what is expected by\n * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts)\n *\n * @see ISO-BMFF-12/2015, Section 8.1.1\n * @see Rec. ITU-T H.264, 7.3.2.3.1\n **/\n\n var findSeiNals = function (avcStream, samples, trackId) {\n var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength),\n result = {\n logs: [],\n seiNals: []\n },\n seiNal,\n i,\n length,\n lastMatchedSample;\n for (i = 0; i + 4 < avcStream.length; i += length) {\n length = avcView.getUint32(i);\n i += 4; // Bail if this doesn't appear to be an H264 stream\n\n if (length <= 0) {\n continue;\n }\n switch (avcStream[i] & 0x1F) {\n case 0x06:\n var data = avcStream.subarray(i + 1, i + 1 + length);\n var matchingSample = mapToSample(i, samples);\n seiNal = {\n nalUnitType: 'sei_rbsp',\n size: length,\n data: data,\n escapedRBSP: discardEmulationPreventionBytes(data),\n trackId: trackId\n };\n if (matchingSample) {\n seiNal.pts = matchingSample.pts;\n seiNal.dts = matchingSample.dts;\n lastMatchedSample = matchingSample;\n } else if (lastMatchedSample) {\n // If a matching sample cannot be found, use the last\n // sample's values as they should be as close as possible\n seiNal.pts = lastMatchedSample.pts;\n seiNal.dts = lastMatchedSample.dts;\n } else {\n result.logs.push({\n level: 'warn',\n message: 'We\\'ve encountered a nal unit without data at ' + i + ' for trackId ' + trackId + '. See mux.js#223.'\n });\n break;\n }\n result.seiNals.push(seiNal);\n break;\n }\n }\n return result;\n };\n /**\n * Parses sample information out of Track Run Boxes and calculates\n * the absolute presentation and decode timestamps of each sample.\n *\n * @param {Array<Uint8Array>} truns - The Trun Run boxes to be parsed\n * @param {Number|BigInt} baseMediaDecodeTime - base media decode time from tfdt\n @see ISO-BMFF-12/2015, Section 8.8.12\n * @param {Object} tfhd - The parsed Track Fragment Header\n * @see inspect.parseTfhd\n * @return {Object[]} the parsed samples\n *\n * @see ISO-BMFF-12/2015, Section 8.8.8\n **/\n\n var parseSamples = function (truns, baseMediaDecodeTime, tfhd) {\n var currentDts = baseMediaDecodeTime;\n var defaultSampleDuration = tfhd.defaultSampleDuration || 0;\n var defaultSampleSize = tfhd.defaultSampleSize || 0;\n var trackId = tfhd.trackId;\n var allSamples = [];\n truns.forEach(function (trun) {\n // Note: We currently do not parse the sample table as well\n // as the trun. It's possible some sources will require this.\n // moov > trak > mdia > minf > stbl\n var trackRun = parseTrun$1(trun);\n var samples = trackRun.samples;\n samples.forEach(function (sample) {\n if (sample.duration === undefined) {\n sample.duration = defaultSampleDuration;\n }\n if (sample.size === undefined) {\n sample.size = defaultSampleSize;\n }\n sample.trackId = trackId;\n sample.dts = currentDts;\n if (sample.compositionTimeOffset === undefined) {\n sample.compositionTimeOffset = 0;\n }\n if (typeof currentDts === 'bigint') {\n sample.pts = currentDts + window$2.BigInt(sample.compositionTimeOffset);\n currentDts += window$2.BigInt(sample.duration);\n } else {\n sample.pts = currentDts + sample.compositionTimeOffset;\n currentDts += sample.duration;\n }\n });\n allSamples = allSamples.concat(samples);\n });\n return allSamples;\n };\n /**\n * Parses out caption nals from an FMP4 segment's video tracks.\n *\n * @param {Uint8Array} segment - The bytes of a single segment\n * @param {Number} videoTrackId - The trackId of a video track in the segment\n * @return {Object.<Number, Object[]>} A mapping of video trackId to\n * a list of seiNals found in that track\n **/\n\n var parseCaptionNals = function (segment, videoTrackId) {\n // To get the samples\n var trafs = findBox$1(segment, ['moof', 'traf']); // To get SEI NAL units\n\n var mdats = findBox$1(segment, ['mdat']);\n var captionNals = {};\n var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs\n\n mdats.forEach(function (mdat, index) {\n var matchingTraf = trafs[index];\n mdatTrafPairs.push({\n mdat: mdat,\n traf: matchingTraf\n });\n });\n mdatTrafPairs.forEach(function (pair) {\n var mdat = pair.mdat;\n var traf = pair.traf;\n var tfhd = findBox$1(traf, ['tfhd']); // Exactly 1 tfhd per traf\n\n var headerInfo = parseTfhd$1(tfhd[0]);\n var trackId = headerInfo.trackId;\n var tfdt = findBox$1(traf, ['tfdt']); // Either 0 or 1 tfdt per traf\n\n var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt$1(tfdt[0]).baseMediaDecodeTime : 0;\n var truns = findBox$1(traf, ['trun']);\n var samples;\n var result; // Only parse video data for the chosen video track\n\n if (videoTrackId === trackId && truns.length > 0) {\n samples = parseSamples(truns, baseMediaDecodeTime, headerInfo);\n result = findSeiNals(mdat, samples, trackId);\n if (!captionNals[trackId]) {\n captionNals[trackId] = {\n seiNals: [],\n logs: []\n };\n }\n captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals);\n captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs);\n }\n });\n return captionNals;\n };\n /**\n * Parses out inband captions from an MP4 container and returns\n * caption objects that can be used by WebVTT and the TextTrack API.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack\n * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first\n *\n * @param {Uint8Array} segment - The fmp4 segment containing embedded captions\n * @param {Number} trackId - The id of the video track to parse\n * @param {Number} timescale - The timescale for the video track from the init segment\n *\n * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks\n * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds\n * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds\n * @return {Object[]} parsedCaptions[].content - A list of individual caption segments\n * @return {String} parsedCaptions[].content.text - The visible content of the caption segment\n * @return {Number} parsedCaptions[].content.line - The line height from 1-15 for positioning of the caption segment\n * @return {Number} parsedCaptions[].content.position - The column indent percentage for cue positioning from 10-80\n **/\n\n var parseEmbeddedCaptions = function (segment, trackId, timescale) {\n var captionNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there\n\n if (trackId === null) {\n return null;\n }\n captionNals = parseCaptionNals(segment, trackId);\n var trackNals = captionNals[trackId] || {};\n return {\n seiNals: trackNals.seiNals,\n logs: trackNals.logs,\n timescale: timescale\n };\n };\n /**\n * Converts SEI NALUs into captions that can be used by video.js\n **/\n\n var CaptionParser = function () {\n var isInitialized = false;\n var captionStream; // Stores segments seen before trackId and timescale are set\n\n var segmentCache; // Stores video track ID of the track being parsed\n\n var trackId; // Stores the timescale of the track being parsed\n\n var timescale; // Stores captions parsed so far\n\n var parsedCaptions; // Stores whether we are receiving partial data or not\n\n var parsingPartial;\n /**\n * A method to indicate whether a CaptionParser has been initalized\n * @returns {Boolean}\n **/\n\n this.isInitialized = function () {\n return isInitialized;\n };\n /**\n * Initializes the underlying CaptionStream, SEI NAL parsing\n * and management, and caption collection\n **/\n\n this.init = function (options) {\n captionStream = new CaptionStream();\n isInitialized = true;\n parsingPartial = options ? options.isPartial : false; // Collect dispatched captions\n\n captionStream.on('data', function (event) {\n // Convert to seconds in the source's timescale\n event.startTime = event.startPts / timescale;\n event.endTime = event.endPts / timescale;\n parsedCaptions.captions.push(event);\n parsedCaptions.captionStreams[event.stream] = true;\n });\n captionStream.on('log', function (log) {\n parsedCaptions.logs.push(log);\n });\n };\n /**\n * Determines if a new video track will be selected\n * or if the timescale changed\n * @return {Boolean}\n **/\n\n this.isNewInit = function (videoTrackIds, timescales) {\n if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) {\n return false;\n }\n return trackId !== videoTrackIds[0] || timescale !== timescales[trackId];\n };\n /**\n * Parses out SEI captions and interacts with underlying\n * CaptionStream to return dispatched captions\n *\n * @param {Uint8Array} segment - The fmp4 segment containing embedded captions\n * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment\n * @param {Object.<Number, Number>} timescales - The timescales found in the init segment\n * @see parseEmbeddedCaptions\n * @see m2ts/caption-stream.js\n **/\n\n this.parse = function (segment, videoTrackIds, timescales) {\n var parsedData;\n if (!this.isInitialized()) {\n return null; // This is not likely to be a video segment\n } else if (!videoTrackIds || !timescales) {\n return null;\n } else if (this.isNewInit(videoTrackIds, timescales)) {\n // Use the first video track only as there is no\n // mechanism to switch to other video tracks\n trackId = videoTrackIds[0];\n timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment\n // data until we have one.\n // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there\n } else if (trackId === null || !timescale) {\n segmentCache.push(segment);\n return null;\n } // Now that a timescale and trackId is set, parse cached segments\n\n while (segmentCache.length > 0) {\n var cachedSegment = segmentCache.shift();\n this.parse(cachedSegment, videoTrackIds, timescales);\n }\n parsedData = parseEmbeddedCaptions(segment, trackId, timescale);\n if (parsedData && parsedData.logs) {\n parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs);\n }\n if (parsedData === null || !parsedData.seiNals) {\n if (parsedCaptions.logs.length) {\n return {\n logs: parsedCaptions.logs,\n captions: [],\n captionStreams: []\n };\n }\n return null;\n }\n this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched\n\n this.flushStream();\n return parsedCaptions;\n };\n /**\n * Pushes SEI NALUs onto CaptionStream\n * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals`\n * Assumes that `parseCaptionNals` has been called first\n * @see m2ts/caption-stream.js\n **/\n\n this.pushNals = function (nals) {\n if (!this.isInitialized() || !nals || nals.length === 0) {\n return null;\n }\n nals.forEach(function (nal) {\n captionStream.push(nal);\n });\n };\n /**\n * Flushes underlying CaptionStream to dispatch processed, displayable captions\n * @see m2ts/caption-stream.js\n **/\n\n this.flushStream = function () {\n if (!this.isInitialized()) {\n return null;\n }\n if (!parsingPartial) {\n captionStream.flush();\n } else {\n captionStream.partialFlush();\n }\n };\n /**\n * Reset caption buckets for new data\n **/\n\n this.clearParsedCaptions = function () {\n parsedCaptions.captions = [];\n parsedCaptions.captionStreams = {};\n parsedCaptions.logs = [];\n };\n /**\n * Resets underlying CaptionStream\n * @see m2ts/caption-stream.js\n **/\n\n this.resetCaptionStream = function () {\n if (!this.isInitialized()) {\n return null;\n }\n captionStream.reset();\n };\n /**\n * Convenience method to clear all captions flushed from the\n * CaptionStream and still being parsed\n * @see m2ts/caption-stream.js\n **/\n\n this.clearAllCaptions = function () {\n this.clearParsedCaptions();\n this.resetCaptionStream();\n };\n /**\n * Reset caption parser\n **/\n\n this.reset = function () {\n segmentCache = [];\n trackId = null;\n timescale = null;\n if (!parsedCaptions) {\n parsedCaptions = {\n captions: [],\n // CC1, CC2, CC3, CC4\n captionStreams: {},\n logs: []\n };\n } else {\n this.clearParsedCaptions();\n }\n this.resetCaptionStream();\n };\n this.reset();\n };\n var captionParser = CaptionParser;\n /**\n * Returns the first string in the data array ending with a null char '\\0'\n * @param {UInt8} data \n * @returns the string with the null char\n */\n\n var uint8ToCString$1 = function (data) {\n var index = 0;\n var curChar = String.fromCharCode(data[index]);\n var retString = '';\n while (curChar !== '\\0') {\n retString += curChar;\n index++;\n curChar = String.fromCharCode(data[index]);\n } // Add nullChar\n\n retString += curChar;\n return retString;\n };\n var string = {\n uint8ToCString: uint8ToCString$1\n };\n var uint8ToCString = string.uint8ToCString;\n var getUint64$1 = numbers.getUint64;\n /**\n * Based on: ISO/IEC 23009 Section: 5.10.3.3\n * References:\n * https://dashif-documents.azurewebsites.net/Events/master/event.html#emsg-format\n * https://aomediacodec.github.io/id3-emsg/\n * \n * Takes emsg box data as a uint8 array and returns a emsg box object\n * @param {UInt8Array} boxData data from emsg box\n * @returns A parsed emsg box object\n */\n\n var parseEmsgBox = function (boxData) {\n // version + flags\n var offset = 4;\n var version = boxData[0];\n var scheme_id_uri, value, timescale, presentation_time, presentation_time_delta, event_duration, id, message_data;\n if (version === 0) {\n scheme_id_uri = uint8ToCString(boxData.subarray(offset));\n offset += scheme_id_uri.length;\n value = uint8ToCString(boxData.subarray(offset));\n offset += value.length;\n var dv = new DataView(boxData.buffer);\n timescale = dv.getUint32(offset);\n offset += 4;\n presentation_time_delta = dv.getUint32(offset);\n offset += 4;\n event_duration = dv.getUint32(offset);\n offset += 4;\n id = dv.getUint32(offset);\n offset += 4;\n } else if (version === 1) {\n var dv = new DataView(boxData.buffer);\n timescale = dv.getUint32(offset);\n offset += 4;\n presentation_time = getUint64$1(boxData.subarray(offset));\n offset += 8;\n event_duration = dv.getUint32(offset);\n offset += 4;\n id = dv.getUint32(offset);\n offset += 4;\n scheme_id_uri = uint8ToCString(boxData.subarray(offset));\n offset += scheme_id_uri.length;\n value = uint8ToCString(boxData.subarray(offset));\n offset += value.length;\n }\n message_data = new Uint8Array(boxData.subarray(offset, boxData.byteLength));\n var emsgBox = {\n scheme_id_uri,\n value,\n // if timescale is undefined or 0 set to 1 \n timescale: timescale ? timescale : 1,\n presentation_time,\n presentation_time_delta,\n event_duration,\n id,\n message_data\n };\n return isValidEmsgBox(version, emsgBox) ? emsgBox : undefined;\n };\n /**\n * Scales a presentation time or time delta with an offset with a provided timescale\n * @param {number} presentationTime \n * @param {number} timescale \n * @param {number} timeDelta \n * @param {number} offset \n * @returns the scaled time as a number\n */\n\n var scaleTime = function (presentationTime, timescale, timeDelta, offset) {\n return presentationTime || presentationTime === 0 ? presentationTime / timescale : offset + timeDelta / timescale;\n };\n /**\n * Checks the emsg box data for validity based on the version\n * @param {number} version of the emsg box to validate\n * @param {Object} emsg the emsg data to validate\n * @returns if the box is valid as a boolean\n */\n\n var isValidEmsgBox = function (version, emsg) {\n var hasScheme = emsg.scheme_id_uri !== '\\0';\n var isValidV0Box = version === 0 && isDefined(emsg.presentation_time_delta) && hasScheme;\n var isValidV1Box = version === 1 && isDefined(emsg.presentation_time) && hasScheme; // Only valid versions of emsg are 0 and 1\n\n return !(version > 1) && isValidV0Box || isValidV1Box;\n }; // Utility function to check if an object is defined\n\n var isDefined = function (data) {\n return data !== undefined || data !== null;\n };\n var emsg$1 = {\n parseEmsgBox: parseEmsgBox,\n scaleTime: scaleTime\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Utilities to detect basic properties and metadata about MP4s.\n */\n\n var toUnsigned = bin.toUnsigned;\n var toHexString = bin.toHexString;\n var findBox = findBox_1;\n var parseType$1 = parseType_1;\n var emsg = emsg$1;\n var parseTfhd = parseTfhd$2;\n var parseTrun = parseTrun$2;\n var parseTfdt = parseTfdt$2;\n var getUint64 = numbers.getUint64;\n var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader, getEmsgID3;\n var window$1 = window_1;\n var parseId3Frames = parseId3.parseId3Frames;\n /**\n * Parses an MP4 initialization segment and extracts the timescale\n * values for any declared tracks. Timescale values indicate the\n * number of clock ticks per second to assume for time-based values\n * elsewhere in the MP4.\n *\n * To determine the start time of an MP4, you need two pieces of\n * information: the timescale unit and the earliest base media decode\n * time. Multiple timescales can be specified within an MP4 but the\n * base media decode time is always expressed in the timescale from\n * the media header box for the track:\n * ```\n * moov > trak > mdia > mdhd.timescale\n * ```\n * @param init {Uint8Array} the bytes of the init segment\n * @return {object} a hash of track ids to timescale values or null if\n * the init segment is malformed.\n */\n\n timescale = function (init) {\n var result = {},\n traks = findBox(init, ['moov', 'trak']); // mdhd timescale\n\n return traks.reduce(function (result, trak) {\n var tkhd, version, index, id, mdhd;\n tkhd = findBox(trak, ['tkhd'])[0];\n if (!tkhd) {\n return null;\n }\n version = tkhd[0];\n index = version === 0 ? 12 : 20;\n id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]);\n mdhd = findBox(trak, ['mdia', 'mdhd'])[0];\n if (!mdhd) {\n return null;\n }\n version = mdhd[0];\n index = version === 0 ? 12 : 20;\n result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]);\n return result;\n }, result);\n };\n /**\n * Determine the base media decode start time, in seconds, for an MP4\n * fragment. If multiple fragments are specified, the earliest time is\n * returned.\n *\n * The base media decode time can be parsed from track fragment\n * metadata:\n * ```\n * moof > traf > tfdt.baseMediaDecodeTime\n * ```\n * It requires the timescale value from the mdhd to interpret.\n *\n * @param timescale {object} a hash of track ids to timescale values.\n * @return {number} the earliest base media decode start time for the\n * fragment, in seconds\n */\n\n startTime = function (timescale, fragment) {\n var trafs; // we need info from two childrend of each track fragment box\n\n trafs = findBox(fragment, ['moof', 'traf']); // determine the start times for each track\n\n var lowestTime = trafs.reduce(function (acc, traf) {\n var tfhd = findBox(traf, ['tfhd'])[0]; // get the track id from the tfhd\n\n var id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified\n\n var scale = timescale[id] || 90e3; // get the base media decode time from the tfdt\n\n var tfdt = findBox(traf, ['tfdt'])[0];\n var dv = new DataView(tfdt.buffer, tfdt.byteOffset, tfdt.byteLength);\n var baseTime; // version 1 is 64 bit\n\n if (tfdt[0] === 1) {\n baseTime = getUint64(tfdt.subarray(4, 12));\n } else {\n baseTime = dv.getUint32(4);\n } // convert base time to seconds if it is a valid number.\n\n let seconds;\n if (typeof baseTime === 'bigint') {\n seconds = baseTime / window$1.BigInt(scale);\n } else if (typeof baseTime === 'number' && !isNaN(baseTime)) {\n seconds = baseTime / scale;\n }\n if (seconds < Number.MAX_SAFE_INTEGER) {\n seconds = Number(seconds);\n }\n if (seconds < acc) {\n acc = seconds;\n }\n return acc;\n }, Infinity);\n return typeof lowestTime === 'bigint' || isFinite(lowestTime) ? lowestTime : 0;\n };\n /**\n * Determine the composition start, in seconds, for an MP4\n * fragment.\n *\n * The composition start time of a fragment can be calculated using the base\n * media decode time, composition time offset, and timescale, as follows:\n *\n * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale\n *\n * All of the aforementioned information is contained within a media fragment's\n * `traf` box, except for timescale info, which comes from the initialization\n * segment, so a track id (also contained within a `traf`) is also necessary to\n * associate it with a timescale\n *\n *\n * @param timescales {object} - a hash of track ids to timescale values.\n * @param fragment {Unit8Array} - the bytes of a media segment\n * @return {number} the composition start time for the fragment, in seconds\n **/\n\n compositionStartTime = function (timescales, fragment) {\n var trafBoxes = findBox(fragment, ['moof', 'traf']);\n var baseMediaDecodeTime = 0;\n var compositionTimeOffset = 0;\n var trackId;\n if (trafBoxes && trafBoxes.length) {\n // The spec states that track run samples contained within a `traf` box are contiguous, but\n // it does not explicitly state whether the `traf` boxes themselves are contiguous.\n // We will assume that they are, so we only need the first to calculate start time.\n var tfhd = findBox(trafBoxes[0], ['tfhd'])[0];\n var trun = findBox(trafBoxes[0], ['trun'])[0];\n var tfdt = findBox(trafBoxes[0], ['tfdt'])[0];\n if (tfhd) {\n var parsedTfhd = parseTfhd(tfhd);\n trackId = parsedTfhd.trackId;\n }\n if (tfdt) {\n var parsedTfdt = parseTfdt(tfdt);\n baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime;\n }\n if (trun) {\n var parsedTrun = parseTrun(trun);\n if (parsedTrun.samples && parsedTrun.samples.length) {\n compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0;\n }\n }\n } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was\n // specified.\n\n var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds\n\n if (typeof baseMediaDecodeTime === 'bigint') {\n compositionTimeOffset = window$1.BigInt(compositionTimeOffset);\n timescale = window$1.BigInt(timescale);\n }\n var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale;\n if (typeof result === 'bigint' && result < Number.MAX_SAFE_INTEGER) {\n result = Number(result);\n }\n return result;\n };\n /**\n * Find the trackIds of the video tracks in this source.\n * Found by parsing the Handler Reference and Track Header Boxes:\n * moov > trak > mdia > hdlr\n * moov > trak > tkhd\n *\n * @param {Uint8Array} init - The bytes of the init segment for this source\n * @return {Number[]} A list of trackIds\n *\n * @see ISO-BMFF-12/2015, Section 8.4.3\n **/\n\n getVideoTrackIds = function (init) {\n var traks = findBox(init, ['moov', 'trak']);\n var videoTrackIds = [];\n traks.forEach(function (trak) {\n var hdlrs = findBox(trak, ['mdia', 'hdlr']);\n var tkhds = findBox(trak, ['tkhd']);\n hdlrs.forEach(function (hdlr, index) {\n var handlerType = parseType$1(hdlr.subarray(8, 12));\n var tkhd = tkhds[index];\n var view;\n var version;\n var trackId;\n if (handlerType === 'vide') {\n view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength);\n version = view.getUint8(0);\n trackId = version === 0 ? view.getUint32(12) : view.getUint32(20);\n videoTrackIds.push(trackId);\n }\n });\n });\n return videoTrackIds;\n };\n getTimescaleFromMediaHeader = function (mdhd) {\n // mdhd is a FullBox, meaning it will have its own version as the first byte\n var version = mdhd[0];\n var index = version === 0 ? 12 : 20;\n return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]);\n };\n /**\n * Get all the video, audio, and hint tracks from a non fragmented\n * mp4 segment\n */\n\n getTracks = function (init) {\n var traks = findBox(init, ['moov', 'trak']);\n var tracks = [];\n traks.forEach(function (trak) {\n var track = {};\n var tkhd = findBox(trak, ['tkhd'])[0];\n var view, tkhdVersion; // id\n\n if (tkhd) {\n view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength);\n tkhdVersion = view.getUint8(0);\n track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20);\n }\n var hdlr = findBox(trak, ['mdia', 'hdlr'])[0]; // type\n\n if (hdlr) {\n var type = parseType$1(hdlr.subarray(8, 12));\n if (type === 'vide') {\n track.type = 'video';\n } else if (type === 'soun') {\n track.type = 'audio';\n } else {\n track.type = type;\n }\n } // codec\n\n var stsd = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];\n if (stsd) {\n var sampleDescriptions = stsd.subarray(8); // gives the codec type string\n\n track.codec = parseType$1(sampleDescriptions.subarray(4, 8));\n var codecBox = findBox(sampleDescriptions, [track.codec])[0];\n var codecConfig, codecConfigType;\n if (codecBox) {\n // https://tools.ietf.org/html/rfc6381#section-3.3\n if (/^[asm]vc[1-9]$/i.test(track.codec)) {\n // we don't need anything but the \"config\" parameter of the\n // avc1 codecBox\n codecConfig = codecBox.subarray(78);\n codecConfigType = parseType$1(codecConfig.subarray(4, 8));\n if (codecConfigType === 'avcC' && codecConfig.length > 11) {\n track.codec += '.'; // left padded with zeroes for single digit hex\n // profile idc\n\n track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags\n\n track.codec += toHexString(codecConfig[10]); // level idc\n\n track.codec += toHexString(codecConfig[11]);\n } else {\n // TODO: show a warning that we couldn't parse the codec\n // and are using the default\n track.codec = 'avc1.4d400d';\n }\n } else if (/^mp4[a,v]$/i.test(track.codec)) {\n // we do not need anything but the streamDescriptor of the mp4a codecBox\n codecConfig = codecBox.subarray(28);\n codecConfigType = parseType$1(codecConfig.subarray(4, 8));\n if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) {\n track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit\n\n track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, '');\n } else {\n // TODO: show a warning that we couldn't parse the codec\n // and are using the default\n track.codec = 'mp4a.40.2';\n }\n } else {\n // flac, opus, etc\n track.codec = track.codec.toLowerCase();\n }\n }\n }\n var mdhd = findBox(trak, ['mdia', 'mdhd'])[0];\n if (mdhd) {\n track.timescale = getTimescaleFromMediaHeader(mdhd);\n }\n tracks.push(track);\n });\n return tracks;\n };\n /**\n * Returns an array of emsg ID3 data from the provided segmentData.\n * An offset can also be provided as the Latest Arrival Time to calculate \n * the Event Start Time of v0 EMSG boxes. \n * See: https://dashif-documents.azurewebsites.net/Events/master/event.html#Inband-event-timing\n * \n * @param {Uint8Array} segmentData the segment byte array.\n * @param {number} offset the segment start time or Latest Arrival Time, \n * @return {Object[]} an array of ID3 parsed from EMSG boxes\n */\n\n getEmsgID3 = function (segmentData, offset = 0) {\n var emsgBoxes = findBox(segmentData, ['emsg']);\n return emsgBoxes.map(data => {\n var parsedBox = emsg.parseEmsgBox(new Uint8Array(data));\n var parsedId3Frames = parseId3Frames(parsedBox.message_data);\n return {\n cueTime: emsg.scaleTime(parsedBox.presentation_time, parsedBox.timescale, parsedBox.presentation_time_delta, offset),\n duration: emsg.scaleTime(parsedBox.event_duration, parsedBox.timescale),\n frames: parsedId3Frames\n };\n });\n };\n var probe$2 = {\n // export mp4 inspector's findBox and parseType for backwards compatibility\n findBox: findBox,\n parseType: parseType$1,\n timescale: timescale,\n startTime: startTime,\n compositionStartTime: compositionStartTime,\n videoTrackIds: getVideoTrackIds,\n tracks: getTracks,\n getTimescaleFromMediaHeader: getTimescaleFromMediaHeader,\n getEmsgID3: getEmsgID3\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Utilities to detect basic properties and metadata about TS Segments.\n */\n\n var StreamTypes$1 = streamTypes;\n var parsePid = function (packet) {\n var pid = packet[1] & 0x1f;\n pid <<= 8;\n pid |= packet[2];\n return pid;\n };\n var parsePayloadUnitStartIndicator = function (packet) {\n return !!(packet[1] & 0x40);\n };\n var parseAdaptionField = function (packet) {\n var offset = 0; // if an adaption field is present, its length is specified by the\n // fifth byte of the TS packet header. The adaptation field is\n // used to add stuffing to PES packets that don't fill a complete\n // TS packet, and to specify some forms of timing and control data\n // that we do not currently use.\n\n if ((packet[3] & 0x30) >>> 4 > 0x01) {\n offset += packet[4] + 1;\n }\n return offset;\n };\n var parseType = function (packet, pmtPid) {\n var pid = parsePid(packet);\n if (pid === 0) {\n return 'pat';\n } else if (pid === pmtPid) {\n return 'pmt';\n } else if (pmtPid) {\n return 'pes';\n }\n return null;\n };\n var parsePat = function (packet) {\n var pusi = parsePayloadUnitStartIndicator(packet);\n var offset = 4 + parseAdaptionField(packet);\n if (pusi) {\n offset += packet[offset] + 1;\n }\n return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11];\n };\n var parsePmt = function (packet) {\n var programMapTable = {};\n var pusi = parsePayloadUnitStartIndicator(packet);\n var payloadOffset = 4 + parseAdaptionField(packet);\n if (pusi) {\n payloadOffset += packet[payloadOffset] + 1;\n } // PMTs can be sent ahead of the time when they should actually\n // take effect. We don't believe this should ever be the case\n // for HLS but we'll ignore \"forward\" PMT declarations if we see\n // them. Future PMT declarations have the current_next_indicator\n // set to zero.\n\n if (!(packet[payloadOffset + 5] & 0x01)) {\n return;\n }\n var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section\n\n sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2];\n tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how\n // long the program info descriptors are\n\n programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table\n\n var offset = 12 + programInfoLength;\n while (offset < tableEnd) {\n var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type\n\n programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry\n // skip past the elementary stream descriptors, if present\n\n offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5;\n }\n return programMapTable;\n };\n var parsePesType = function (packet, programMapTable) {\n var pid = parsePid(packet);\n var type = programMapTable[pid];\n switch (type) {\n case StreamTypes$1.H264_STREAM_TYPE:\n return 'video';\n case StreamTypes$1.ADTS_STREAM_TYPE:\n return 'audio';\n case StreamTypes$1.METADATA_STREAM_TYPE:\n return 'timed-metadata';\n default:\n return null;\n }\n };\n var parsePesTime = function (packet) {\n var pusi = parsePayloadUnitStartIndicator(packet);\n if (!pusi) {\n return null;\n }\n var offset = 4 + parseAdaptionField(packet);\n if (offset >= packet.byteLength) {\n // From the H 222.0 MPEG-TS spec\n // \"For transport stream packets carrying PES packets, stuffing is needed when there\n // is insufficient PES packet data to completely fill the transport stream packet\n // payload bytes. Stuffing is accomplished by defining an adaptation field longer than\n // the sum of the lengths of the data elements in it, so that the payload bytes\n // remaining after the adaptation field exactly accommodates the available PES packet\n // data.\"\n //\n // If the offset is >= the length of the packet, then the packet contains no data\n // and instead is just adaption field stuffing bytes\n return null;\n }\n var pes = null;\n var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value\n // and a DTS value. Determine what combination of values is\n // available to work with.\n\n ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript\n // performs all bitwise operations on 32-bit integers but javascript\n // supports a much greater range (52-bits) of integer using standard\n // mathematical operations.\n // We construct a 31-bit value using bitwise operators over the 31\n // most significant bits and then multiply by 4 (equal to a left-shift\n // of 2) before we add the final 2 least significant bits of the\n // timestamp (equal to an OR.)\n\n if (ptsDtsFlags & 0xC0) {\n pes = {}; // the PTS and DTS are not written out directly. For information\n // on how they are encoded, see\n // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html\n\n pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3;\n pes.pts *= 4; // Left shift by 2\n\n pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs\n\n pes.dts = pes.pts;\n if (ptsDtsFlags & 0x40) {\n pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3;\n pes.dts *= 4; // Left shift by 2\n\n pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs\n }\n }\n\n return pes;\n };\n var parseNalUnitType = function (type) {\n switch (type) {\n case 0x05:\n return 'slice_layer_without_partitioning_rbsp_idr';\n case 0x06:\n return 'sei_rbsp';\n case 0x07:\n return 'seq_parameter_set_rbsp';\n case 0x08:\n return 'pic_parameter_set_rbsp';\n case 0x09:\n return 'access_unit_delimiter_rbsp';\n default:\n return null;\n }\n };\n var videoPacketContainsKeyFrame = function (packet) {\n var offset = 4 + parseAdaptionField(packet);\n var frameBuffer = packet.subarray(offset);\n var frameI = 0;\n var frameSyncPoint = 0;\n var foundKeyFrame = false;\n var nalType; // advance the sync point to a NAL start, if necessary\n\n for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) {\n if (frameBuffer[frameSyncPoint + 2] === 1) {\n // the sync point is properly aligned\n frameI = frameSyncPoint + 5;\n break;\n }\n }\n while (frameI < frameBuffer.byteLength) {\n // look at the current byte to determine if we've hit the end of\n // a NAL unit boundary\n switch (frameBuffer[frameI]) {\n case 0:\n // skip past non-sync sequences\n if (frameBuffer[frameI - 1] !== 0) {\n frameI += 2;\n break;\n } else if (frameBuffer[frameI - 2] !== 0) {\n frameI++;\n break;\n }\n if (frameSyncPoint + 3 !== frameI - 2) {\n nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f);\n if (nalType === 'slice_layer_without_partitioning_rbsp_idr') {\n foundKeyFrame = true;\n }\n } // drop trailing zeroes\n\n do {\n frameI++;\n } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length);\n frameSyncPoint = frameI - 2;\n frameI += 3;\n break;\n case 1:\n // skip past non-sync sequences\n if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) {\n frameI += 3;\n break;\n }\n nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f);\n if (nalType === 'slice_layer_without_partitioning_rbsp_idr') {\n foundKeyFrame = true;\n }\n frameSyncPoint = frameI - 2;\n frameI += 3;\n break;\n default:\n // the current byte isn't a one or zero, so it cannot be part\n // of a sync sequence\n frameI += 3;\n break;\n }\n }\n frameBuffer = frameBuffer.subarray(frameSyncPoint);\n frameI -= frameSyncPoint;\n frameSyncPoint = 0; // parse the final nal\n\n if (frameBuffer && frameBuffer.byteLength > 3) {\n nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f);\n if (nalType === 'slice_layer_without_partitioning_rbsp_idr') {\n foundKeyFrame = true;\n }\n }\n return foundKeyFrame;\n };\n var probe$1 = {\n parseType: parseType,\n parsePat: parsePat,\n parsePmt: parsePmt,\n parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator,\n parsePesType: parsePesType,\n parsePesTime: parsePesTime,\n videoPacketContainsKeyFrame: videoPacketContainsKeyFrame\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Parse mpeg2 transport stream packets to extract basic timing information\n */\n\n var StreamTypes = streamTypes;\n var handleRollover = timestampRolloverStream.handleRollover;\n var probe = {};\n probe.ts = probe$1;\n probe.aac = utils;\n var ONE_SECOND_IN_TS = clock$2.ONE_SECOND_IN_TS;\n var MP2T_PACKET_LENGTH = 188,\n // bytes\n SYNC_BYTE = 0x47;\n /**\n * walks through segment data looking for pat and pmt packets to parse out\n * program map table information\n */\n\n var parsePsi_ = function (bytes, pmt) {\n var startIndex = 0,\n endIndex = MP2T_PACKET_LENGTH,\n packet,\n type;\n while (endIndex < bytes.byteLength) {\n // Look for a pair of start and end sync bytes in the data..\n if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {\n // We found a packet\n packet = bytes.subarray(startIndex, endIndex);\n type = probe.ts.parseType(packet, pmt.pid);\n switch (type) {\n case 'pat':\n pmt.pid = probe.ts.parsePat(packet);\n break;\n case 'pmt':\n var table = probe.ts.parsePmt(packet);\n pmt.table = pmt.table || {};\n Object.keys(table).forEach(function (key) {\n pmt.table[key] = table[key];\n });\n break;\n }\n startIndex += MP2T_PACKET_LENGTH;\n endIndex += MP2T_PACKET_LENGTH;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n startIndex++;\n endIndex++;\n }\n };\n /**\n * walks through the segment data from the start and end to get timing information\n * for the first and last audio pes packets\n */\n\n var parseAudioPes_ = function (bytes, pmt, result) {\n var startIndex = 0,\n endIndex = MP2T_PACKET_LENGTH,\n packet,\n type,\n pesType,\n pusi,\n parsed;\n var endLoop = false; // Start walking from start of segment to get first audio packet\n\n while (endIndex <= bytes.byteLength) {\n // Look for a pair of start and end sync bytes in the data..\n if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {\n // We found a packet\n packet = bytes.subarray(startIndex, endIndex);\n type = probe.ts.parseType(packet, pmt.pid);\n switch (type) {\n case 'pes':\n pesType = probe.ts.parsePesType(packet, pmt.table);\n pusi = probe.ts.parsePayloadUnitStartIndicator(packet);\n if (pesType === 'audio' && pusi) {\n parsed = probe.ts.parsePesTime(packet);\n if (parsed) {\n parsed.type = 'audio';\n result.audio.push(parsed);\n endLoop = true;\n }\n }\n break;\n }\n if (endLoop) {\n break;\n }\n startIndex += MP2T_PACKET_LENGTH;\n endIndex += MP2T_PACKET_LENGTH;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n startIndex++;\n endIndex++;\n } // Start walking from end of segment to get last audio packet\n\n endIndex = bytes.byteLength;\n startIndex = endIndex - MP2T_PACKET_LENGTH;\n endLoop = false;\n while (startIndex >= 0) {\n // Look for a pair of start and end sync bytes in the data..\n if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {\n // We found a packet\n packet = bytes.subarray(startIndex, endIndex);\n type = probe.ts.parseType(packet, pmt.pid);\n switch (type) {\n case 'pes':\n pesType = probe.ts.parsePesType(packet, pmt.table);\n pusi = probe.ts.parsePayloadUnitStartIndicator(packet);\n if (pesType === 'audio' && pusi) {\n parsed = probe.ts.parsePesTime(packet);\n if (parsed) {\n parsed.type = 'audio';\n result.audio.push(parsed);\n endLoop = true;\n }\n }\n break;\n }\n if (endLoop) {\n break;\n }\n startIndex -= MP2T_PACKET_LENGTH;\n endIndex -= MP2T_PACKET_LENGTH;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n startIndex--;\n endIndex--;\n }\n };\n /**\n * walks through the segment data from the start and end to get timing information\n * for the first and last video pes packets as well as timing information for the first\n * key frame.\n */\n\n var parseVideoPes_ = function (bytes, pmt, result) {\n var startIndex = 0,\n endIndex = MP2T_PACKET_LENGTH,\n packet,\n type,\n pesType,\n pusi,\n parsed,\n frame,\n i,\n pes;\n var endLoop = false;\n var currentFrame = {\n data: [],\n size: 0\n }; // Start walking from start of segment to get first video packet\n\n while (endIndex < bytes.byteLength) {\n // Look for a pair of start and end sync bytes in the data..\n if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {\n // We found a packet\n packet = bytes.subarray(startIndex, endIndex);\n type = probe.ts.parseType(packet, pmt.pid);\n switch (type) {\n case 'pes':\n pesType = probe.ts.parsePesType(packet, pmt.table);\n pusi = probe.ts.parsePayloadUnitStartIndicator(packet);\n if (pesType === 'video') {\n if (pusi && !endLoop) {\n parsed = probe.ts.parsePesTime(packet);\n if (parsed) {\n parsed.type = 'video';\n result.video.push(parsed);\n endLoop = true;\n }\n }\n if (!result.firstKeyFrame) {\n if (pusi) {\n if (currentFrame.size !== 0) {\n frame = new Uint8Array(currentFrame.size);\n i = 0;\n while (currentFrame.data.length) {\n pes = currentFrame.data.shift();\n frame.set(pes, i);\n i += pes.byteLength;\n }\n if (probe.ts.videoPacketContainsKeyFrame(frame)) {\n var firstKeyFrame = probe.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting\n // the keyframe seems to work fine with HLS playback\n // and definitely preferable to a crash with TypeError...\n\n if (firstKeyFrame) {\n result.firstKeyFrame = firstKeyFrame;\n result.firstKeyFrame.type = 'video';\n } else {\n // eslint-disable-next-line\n 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.');\n }\n }\n currentFrame.size = 0;\n }\n }\n currentFrame.data.push(packet);\n currentFrame.size += packet.byteLength;\n }\n }\n break;\n }\n if (endLoop && result.firstKeyFrame) {\n break;\n }\n startIndex += MP2T_PACKET_LENGTH;\n endIndex += MP2T_PACKET_LENGTH;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n startIndex++;\n endIndex++;\n } // Start walking from end of segment to get last video packet\n\n endIndex = bytes.byteLength;\n startIndex = endIndex - MP2T_PACKET_LENGTH;\n endLoop = false;\n while (startIndex >= 0) {\n // Look for a pair of start and end sync bytes in the data..\n if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {\n // We found a packet\n packet = bytes.subarray(startIndex, endIndex);\n type = probe.ts.parseType(packet, pmt.pid);\n switch (type) {\n case 'pes':\n pesType = probe.ts.parsePesType(packet, pmt.table);\n pusi = probe.ts.parsePayloadUnitStartIndicator(packet);\n if (pesType === 'video' && pusi) {\n parsed = probe.ts.parsePesTime(packet);\n if (parsed) {\n parsed.type = 'video';\n result.video.push(parsed);\n endLoop = true;\n }\n }\n break;\n }\n if (endLoop) {\n break;\n }\n startIndex -= MP2T_PACKET_LENGTH;\n endIndex -= MP2T_PACKET_LENGTH;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n startIndex--;\n endIndex--;\n }\n };\n /**\n * Adjusts the timestamp information for the segment to account for\n * rollover and convert to seconds based on pes packet timescale (90khz clock)\n */\n\n var adjustTimestamp_ = function (segmentInfo, baseTimestamp) {\n if (segmentInfo.audio && segmentInfo.audio.length) {\n var audioBaseTimestamp = baseTimestamp;\n if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) {\n audioBaseTimestamp = segmentInfo.audio[0].dts;\n }\n segmentInfo.audio.forEach(function (info) {\n info.dts = handleRollover(info.dts, audioBaseTimestamp);\n info.pts = handleRollover(info.pts, audioBaseTimestamp); // time in seconds\n\n info.dtsTime = info.dts / ONE_SECOND_IN_TS;\n info.ptsTime = info.pts / ONE_SECOND_IN_TS;\n });\n }\n if (segmentInfo.video && segmentInfo.video.length) {\n var videoBaseTimestamp = baseTimestamp;\n if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) {\n videoBaseTimestamp = segmentInfo.video[0].dts;\n }\n segmentInfo.video.forEach(function (info) {\n info.dts = handleRollover(info.dts, videoBaseTimestamp);\n info.pts = handleRollover(info.pts, videoBaseTimestamp); // time in seconds\n\n info.dtsTime = info.dts / ONE_SECOND_IN_TS;\n info.ptsTime = info.pts / ONE_SECOND_IN_TS;\n });\n if (segmentInfo.firstKeyFrame) {\n var frame = segmentInfo.firstKeyFrame;\n frame.dts = handleRollover(frame.dts, videoBaseTimestamp);\n frame.pts = handleRollover(frame.pts, videoBaseTimestamp); // time in seconds\n\n frame.dtsTime = frame.dts / ONE_SECOND_IN_TS;\n frame.ptsTime = frame.pts / ONE_SECOND_IN_TS;\n }\n }\n };\n /**\n * inspects the aac data stream for start and end time information\n */\n\n var inspectAac_ = function (bytes) {\n var endLoop = false,\n audioCount = 0,\n sampleRate = null,\n timestamp = null,\n frameSize = 0,\n byteIndex = 0,\n packet;\n while (bytes.length - byteIndex >= 3) {\n var type = probe.aac.parseType(bytes, byteIndex);\n switch (type) {\n case 'timed-metadata':\n // Exit early because we don't have enough to parse\n // the ID3 tag header\n if (bytes.length - byteIndex < 10) {\n endLoop = true;\n break;\n }\n frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer\n // to emit a full packet\n\n if (frameSize > bytes.length) {\n endLoop = true;\n break;\n }\n if (timestamp === null) {\n packet = bytes.subarray(byteIndex, byteIndex + frameSize);\n timestamp = probe.aac.parseAacTimestamp(packet);\n }\n byteIndex += frameSize;\n break;\n case 'audio':\n // Exit early because we don't have enough to parse\n // the ADTS frame header\n if (bytes.length - byteIndex < 7) {\n endLoop = true;\n break;\n }\n frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer\n // to emit a full packet\n\n if (frameSize > bytes.length) {\n endLoop = true;\n break;\n }\n if (sampleRate === null) {\n packet = bytes.subarray(byteIndex, byteIndex + frameSize);\n sampleRate = probe.aac.parseSampleRate(packet);\n }\n audioCount++;\n byteIndex += frameSize;\n break;\n default:\n byteIndex++;\n break;\n }\n if (endLoop) {\n return null;\n }\n }\n if (sampleRate === null || timestamp === null) {\n return null;\n }\n var audioTimescale = ONE_SECOND_IN_TS / sampleRate;\n var result = {\n audio: [{\n type: 'audio',\n dts: timestamp,\n pts: timestamp\n }, {\n type: 'audio',\n dts: timestamp + audioCount * 1024 * audioTimescale,\n pts: timestamp + audioCount * 1024 * audioTimescale\n }]\n };\n return result;\n };\n /**\n * inspects the transport stream segment data for start and end time information\n * of the audio and video tracks (when present) as well as the first key frame's\n * start time.\n */\n\n var inspectTs_ = function (bytes) {\n var pmt = {\n pid: null,\n table: null\n };\n var result = {};\n parsePsi_(bytes, pmt);\n for (var pid in pmt.table) {\n if (pmt.table.hasOwnProperty(pid)) {\n var type = pmt.table[pid];\n switch (type) {\n case StreamTypes.H264_STREAM_TYPE:\n result.video = [];\n parseVideoPes_(bytes, pmt, result);\n if (result.video.length === 0) {\n delete result.video;\n }\n break;\n case StreamTypes.ADTS_STREAM_TYPE:\n result.audio = [];\n parseAudioPes_(bytes, pmt, result);\n if (result.audio.length === 0) {\n delete result.audio;\n }\n break;\n }\n }\n }\n return result;\n };\n /**\n * Inspects segment byte data and returns an object with start and end timing information\n *\n * @param {Uint8Array} bytes The segment byte data\n * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame\n * timestamps for rollover. This value must be in 90khz clock.\n * @return {Object} Object containing start and end frame timing info of segment.\n */\n\n var inspect = function (bytes, baseTimestamp) {\n var isAacData = probe.aac.isLikelyAacData(bytes);\n var result;\n if (isAacData) {\n result = inspectAac_(bytes);\n } else {\n result = inspectTs_(bytes);\n }\n if (!result || !result.audio && !result.video) {\n return null;\n }\n adjustTimestamp_(result, baseTimestamp);\n return result;\n };\n var tsInspector = {\n inspect: inspect,\n parseAudioPes_: parseAudioPes_\n };\n /* global self */\n\n /**\n * Re-emits transmuxer events by converting them into messages to the\n * world outside the worker.\n *\n * @param {Object} transmuxer the transmuxer to wire events on\n * @private\n */\n\n const wireTransmuxerEvents = function (self, transmuxer) {\n transmuxer.on('data', function (segment) {\n // transfer ownership of the underlying ArrayBuffer\n // instead of doing a copy to save memory\n // ArrayBuffers are transferable but generic TypedArrays are not\n // @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_by_transferring_ownership_(transferable_objects)\n const initArray = segment.initSegment;\n segment.initSegment = {\n data: initArray.buffer,\n byteOffset: initArray.byteOffset,\n byteLength: initArray.byteLength\n };\n const typedArray = segment.data;\n segment.data = typedArray.buffer;\n self.postMessage({\n action: 'data',\n segment,\n byteOffset: typedArray.byteOffset,\n byteLength: typedArray.byteLength\n }, [segment.data]);\n });\n transmuxer.on('done', function (data) {\n self.postMessage({\n action: 'done'\n });\n });\n transmuxer.on('gopInfo', function (gopInfo) {\n self.postMessage({\n action: 'gopInfo',\n gopInfo\n });\n });\n transmuxer.on('videoSegmentTimingInfo', function (timingInfo) {\n const videoSegmentTimingInfo = {\n start: {\n decode: clock$2.videoTsToSeconds(timingInfo.start.dts),\n presentation: clock$2.videoTsToSeconds(timingInfo.start.pts)\n },\n end: {\n decode: clock$2.videoTsToSeconds(timingInfo.end.dts),\n presentation: clock$2.videoTsToSeconds(timingInfo.end.pts)\n },\n baseMediaDecodeTime: clock$2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)\n };\n if (timingInfo.prependedContentDuration) {\n videoSegmentTimingInfo.prependedContentDuration = clock$2.videoTsToSeconds(timingInfo.prependedContentDuration);\n }\n self.postMessage({\n action: 'videoSegmentTimingInfo',\n videoSegmentTimingInfo\n });\n });\n transmuxer.on('audioSegmentTimingInfo', function (timingInfo) {\n // Note that all times for [audio/video]SegmentTimingInfo events are in video clock\n const audioSegmentTimingInfo = {\n start: {\n decode: clock$2.videoTsToSeconds(timingInfo.start.dts),\n presentation: clock$2.videoTsToSeconds(timingInfo.start.pts)\n },\n end: {\n decode: clock$2.videoTsToSeconds(timingInfo.end.dts),\n presentation: clock$2.videoTsToSeconds(timingInfo.end.pts)\n },\n baseMediaDecodeTime: clock$2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)\n };\n if (timingInfo.prependedContentDuration) {\n audioSegmentTimingInfo.prependedContentDuration = clock$2.videoTsToSeconds(timingInfo.prependedContentDuration);\n }\n self.postMessage({\n action: 'audioSegmentTimingInfo',\n audioSegmentTimingInfo\n });\n });\n transmuxer.on('id3Frame', function (id3Frame) {\n self.postMessage({\n action: 'id3Frame',\n id3Frame\n });\n });\n transmuxer.on('caption', function (caption) {\n self.postMessage({\n action: 'caption',\n caption\n });\n });\n transmuxer.on('trackinfo', function (trackInfo) {\n self.postMessage({\n action: 'trackinfo',\n trackInfo\n });\n });\n transmuxer.on('audioTimingInfo', function (audioTimingInfo) {\n // convert to video TS since we prioritize video time over audio\n self.postMessage({\n action: 'audioTimingInfo',\n audioTimingInfo: {\n start: clock$2.videoTsToSeconds(audioTimingInfo.start),\n end: clock$2.videoTsToSeconds(audioTimingInfo.end)\n }\n });\n });\n transmuxer.on('videoTimingInfo', function (videoTimingInfo) {\n self.postMessage({\n action: 'videoTimingInfo',\n videoTimingInfo: {\n start: clock$2.videoTsToSeconds(videoTimingInfo.start),\n end: clock$2.videoTsToSeconds(videoTimingInfo.end)\n }\n });\n });\n transmuxer.on('log', function (log) {\n self.postMessage({\n action: 'log',\n log\n });\n });\n };\n /**\n * All incoming messages route through this hash. If no function exists\n * to handle an incoming message, then we ignore the message.\n *\n * @class MessageHandlers\n * @param {Object} options the options to initialize with\n */\n\n class MessageHandlers {\n constructor(self, options) {\n this.options = options || {};\n this.self = self;\n this.init();\n }\n /**\n * initialize our web worker and wire all the events.\n */\n\n init() {\n if (this.transmuxer) {\n this.transmuxer.dispose();\n }\n this.transmuxer = new transmuxer.Transmuxer(this.options);\n wireTransmuxerEvents(this.self, this.transmuxer);\n }\n pushMp4Captions(data) {\n if (!this.captionParser) {\n this.captionParser = new captionParser();\n this.captionParser.init();\n }\n const segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);\n const parsed = this.captionParser.parse(segment, data.trackIds, data.timescales);\n this.self.postMessage({\n action: 'mp4Captions',\n captions: parsed && parsed.captions || [],\n logs: parsed && parsed.logs || [],\n data: segment.buffer\n }, [segment.buffer]);\n }\n probeMp4StartTime({\n timescales,\n data\n }) {\n const startTime = probe$2.startTime(timescales, data);\n this.self.postMessage({\n action: 'probeMp4StartTime',\n startTime,\n data\n }, [data.buffer]);\n }\n probeMp4Tracks({\n data\n }) {\n const tracks = probe$2.tracks(data);\n this.self.postMessage({\n action: 'probeMp4Tracks',\n tracks,\n data\n }, [data.buffer]);\n }\n /**\n * Probes an mp4 segment for EMSG boxes containing ID3 data.\n * https://aomediacodec.github.io/id3-emsg/\n *\n * @param {Uint8Array} data segment data\n * @param {number} offset segment start time\n * @return {Object[]} an array of ID3 frames\n */\n\n probeEmsgID3({\n data,\n offset\n }) {\n const id3Frames = probe$2.getEmsgID3(data, offset);\n this.self.postMessage({\n action: 'probeEmsgID3',\n id3Frames,\n emsgData: data\n }, [data.buffer]);\n }\n /**\n * Probe an mpeg2-ts segment to determine the start time of the segment in it's\n * internal \"media time,\" as well as whether it contains video and/or audio.\n *\n * @private\n * @param {Uint8Array} bytes - segment bytes\n * @param {number} baseStartTime\n * Relative reference timestamp used when adjusting frame timestamps for rollover.\n * This value should be in seconds, as it's converted to a 90khz clock within the\n * function body.\n * @return {Object} The start time of the current segment in \"media time\" as well as\n * whether it contains video and/or audio\n */\n\n probeTs({\n data,\n baseStartTime\n }) {\n const tsStartTime = typeof baseStartTime === 'number' && !isNaN(baseStartTime) ? baseStartTime * clock$2.ONE_SECOND_IN_TS : void 0;\n const timeInfo = tsInspector.inspect(data, tsStartTime);\n let result = null;\n if (timeInfo) {\n result = {\n // each type's time info comes back as an array of 2 times, start and end\n hasVideo: timeInfo.video && timeInfo.video.length === 2 || false,\n hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false\n };\n if (result.hasVideo) {\n result.videoStart = timeInfo.video[0].ptsTime;\n }\n if (result.hasAudio) {\n result.audioStart = timeInfo.audio[0].ptsTime;\n }\n }\n this.self.postMessage({\n action: 'probeTs',\n result,\n data\n }, [data.buffer]);\n }\n clearAllMp4Captions() {\n if (this.captionParser) {\n this.captionParser.clearAllCaptions();\n }\n }\n clearParsedMp4Captions() {\n if (this.captionParser) {\n this.captionParser.clearParsedCaptions();\n }\n }\n /**\n * Adds data (a ts segment) to the start of the transmuxer pipeline for\n * processing.\n *\n * @param {ArrayBuffer} data data to push into the muxer\n */\n\n push(data) {\n // Cast array buffer to correct type for transmuxer\n const segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);\n this.transmuxer.push(segment);\n }\n /**\n * Recreate the transmuxer so that the next segment added via `push`\n * start with a fresh transmuxer.\n */\n\n reset() {\n this.transmuxer.reset();\n }\n /**\n * Set the value that will be used as the `baseMediaDecodeTime` time for the\n * next segment pushed in. Subsequent segments will have their `baseMediaDecodeTime`\n * set relative to the first based on the PTS values.\n *\n * @param {Object} data used to set the timestamp offset in the muxer\n */\n\n setTimestampOffset(data) {\n const timestampOffset = data.timestampOffset || 0;\n this.transmuxer.setBaseMediaDecodeTime(Math.round(clock$2.secondsToVideoTs(timestampOffset)));\n }\n setAudioAppendStart(data) {\n this.transmuxer.setAudioAppendStart(Math.ceil(clock$2.secondsToVideoTs(data.appendStart)));\n }\n setRemux(data) {\n this.transmuxer.setRemux(data.remux);\n }\n /**\n * Forces the pipeline to finish processing the last segment and emit it's\n * results.\n *\n * @param {Object} data event data, not really used\n */\n\n flush(data) {\n this.transmuxer.flush(); // transmuxed done action is fired after both audio/video pipelines are flushed\n\n self.postMessage({\n action: 'done',\n type: 'transmuxed'\n });\n }\n endTimeline() {\n this.transmuxer.endTimeline(); // transmuxed endedtimeline action is fired after both audio/video pipelines end their\n // timelines\n\n self.postMessage({\n action: 'endedtimeline',\n type: 'transmuxed'\n });\n }\n alignGopsWith(data) {\n this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice());\n }\n }\n /**\n * Our web worker interface so that things can talk to mux.js\n * that will be running in a web worker. the scope is passed to this by\n * webworkify.\n *\n * @param {Object} self the scope for the web worker\n */\n\n self.onmessage = function (event) {\n if (event.data.action === 'init' && event.data.options) {\n this.messageHandlers = new MessageHandlers(self, event.data.options);\n return;\n }\n if (!this.messageHandlers) {\n this.messageHandlers = new MessageHandlers(self);\n }\n if (event.data && event.data.action && event.data.action !== 'init') {\n if (this.messageHandlers[event.data.action]) {\n this.messageHandlers[event.data.action](event.data);\n }\n }\n };\n}));\nvar TransmuxWorker = factory(workerCode$1);\n/* rollup-plugin-worker-factory end for worker!/home/runner/work/http-streaming/http-streaming/src/transmuxer-worker.js */\n\nconst handleData_ = (event, transmuxedData, callback) => {\n const {\n type,\n initSegment,\n captions,\n captionStreams,\n metadata,\n videoFrameDtsTime,\n videoFramePtsTime\n } = event.data.segment;\n transmuxedData.buffer.push({\n captions,\n captionStreams,\n metadata\n });\n const boxes = event.data.segment.boxes || {\n data: event.data.segment.data\n };\n const result = {\n type,\n // cast ArrayBuffer to TypedArray\n data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength),\n initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength)\n };\n if (typeof videoFrameDtsTime !== 'undefined') {\n result.videoFrameDtsTime = videoFrameDtsTime;\n }\n if (typeof videoFramePtsTime !== 'undefined') {\n result.videoFramePtsTime = videoFramePtsTime;\n }\n callback(result);\n};\nconst handleDone_ = ({\n transmuxedData,\n callback\n}) => {\n // Previously we only returned data on data events,\n // not on done events. Clear out the buffer to keep that consistent.\n transmuxedData.buffer = []; // all buffers should have been flushed from the muxer, so start processing anything we\n // have received\n\n callback(transmuxedData);\n};\nconst handleGopInfo_ = (event, transmuxedData) => {\n transmuxedData.gopInfo = event.data.gopInfo;\n};\nconst processTransmux = options => {\n const {\n transmuxer,\n bytes,\n audioAppendStart,\n gopsToAlignWith,\n remux,\n onData,\n onTrackInfo,\n onAudioTimingInfo,\n onVideoTimingInfo,\n onVideoSegmentTimingInfo,\n onAudioSegmentTimingInfo,\n onId3,\n onCaptions,\n onDone,\n onEndedTimeline,\n onTransmuxerLog,\n isEndOfTimeline\n } = options;\n const transmuxedData = {\n buffer: []\n };\n let waitForEndedTimelineEvent = isEndOfTimeline;\n const handleMessage = event => {\n if (transmuxer.currentTransmux !== options) {\n // disposed\n return;\n }\n if (event.data.action === 'data') {\n handleData_(event, transmuxedData, onData);\n }\n if (event.data.action === 'trackinfo') {\n onTrackInfo(event.data.trackInfo);\n }\n if (event.data.action === 'gopInfo') {\n handleGopInfo_(event, transmuxedData);\n }\n if (event.data.action === 'audioTimingInfo') {\n onAudioTimingInfo(event.data.audioTimingInfo);\n }\n if (event.data.action === 'videoTimingInfo') {\n onVideoTimingInfo(event.data.videoTimingInfo);\n }\n if (event.data.action === 'videoSegmentTimingInfo') {\n onVideoSegmentTimingInfo(event.data.videoSegmentTimingInfo);\n }\n if (event.data.action === 'audioSegmentTimingInfo') {\n onAudioSegmentTimingInfo(event.data.audioSegmentTimingInfo);\n }\n if (event.data.action === 'id3Frame') {\n onId3([event.data.id3Frame], event.data.id3Frame.dispatchType);\n }\n if (event.data.action === 'caption') {\n onCaptions(event.data.caption);\n }\n if (event.data.action === 'endedtimeline') {\n waitForEndedTimelineEvent = false;\n onEndedTimeline();\n }\n if (event.data.action === 'log') {\n onTransmuxerLog(event.data.log);\n } // wait for the transmuxed event since we may have audio and video\n\n if (event.data.type !== 'transmuxed') {\n return;\n } // If the \"endedtimeline\" event has not yet fired, and this segment represents the end\n // of a timeline, that means there may still be data events before the segment\n // processing can be considerred complete. In that case, the final event should be\n // an \"endedtimeline\" event with the type \"transmuxed.\"\n\n if (waitForEndedTimelineEvent) {\n return;\n }\n transmuxer.onmessage = null;\n handleDone_({\n transmuxedData,\n callback: onDone\n });\n /* eslint-disable no-use-before-define */\n\n dequeue(transmuxer);\n /* eslint-enable */\n };\n\n transmuxer.onmessage = handleMessage;\n if (audioAppendStart) {\n transmuxer.postMessage({\n action: 'setAudioAppendStart',\n appendStart: audioAppendStart\n });\n } // allow empty arrays to be passed to clear out GOPs\n\n if (Array.isArray(gopsToAlignWith)) {\n transmuxer.postMessage({\n action: 'alignGopsWith',\n gopsToAlignWith\n });\n }\n if (typeof remux !== 'undefined') {\n transmuxer.postMessage({\n action: 'setRemux',\n remux\n });\n }\n if (bytes.byteLength) {\n const buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer;\n const byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset;\n transmuxer.postMessage({\n action: 'push',\n // Send the typed-array of data as an ArrayBuffer so that\n // it can be sent as a \"Transferable\" and avoid the costly\n // memory copy\n data: buffer,\n // To recreate the original typed-array, we need information\n // about what portion of the ArrayBuffer it was a view into\n byteOffset,\n byteLength: bytes.byteLength\n }, [buffer]);\n }\n if (isEndOfTimeline) {\n transmuxer.postMessage({\n action: 'endTimeline'\n });\n } // even if we didn't push any bytes, we have to make sure we flush in case we reached\n // the end of the segment\n\n transmuxer.postMessage({\n action: 'flush'\n });\n};\nconst dequeue = transmuxer => {\n transmuxer.currentTransmux = null;\n if (transmuxer.transmuxQueue.length) {\n transmuxer.currentTransmux = transmuxer.transmuxQueue.shift();\n if (typeof transmuxer.currentTransmux === 'function') {\n transmuxer.currentTransmux();\n } else {\n processTransmux(transmuxer.currentTransmux);\n }\n }\n};\nconst processAction = (transmuxer, action) => {\n transmuxer.postMessage({\n action\n });\n dequeue(transmuxer);\n};\nconst enqueueAction = (action, transmuxer) => {\n if (!transmuxer.currentTransmux) {\n transmuxer.currentTransmux = action;\n processAction(transmuxer, action);\n return;\n }\n transmuxer.transmuxQueue.push(processAction.bind(null, transmuxer, action));\n};\nconst reset = transmuxer => {\n enqueueAction('reset', transmuxer);\n};\nconst endTimeline = transmuxer => {\n enqueueAction('endTimeline', transmuxer);\n};\nconst transmux = options => {\n if (!options.transmuxer.currentTransmux) {\n options.transmuxer.currentTransmux = options;\n processTransmux(options);\n return;\n }\n options.transmuxer.transmuxQueue.push(options);\n};\nconst createTransmuxer = options => {\n const transmuxer = new TransmuxWorker();\n transmuxer.currentTransmux = null;\n transmuxer.transmuxQueue = [];\n const term = transmuxer.terminate;\n transmuxer.terminate = () => {\n transmuxer.currentTransmux = null;\n transmuxer.transmuxQueue.length = 0;\n return term.call(transmuxer);\n };\n transmuxer.postMessage({\n action: 'init',\n options\n });\n return transmuxer;\n};\nvar segmentTransmuxer = {\n reset,\n endTimeline,\n transmux,\n createTransmuxer\n};\nconst workerCallback = function (options) {\n const transmuxer = options.transmuxer;\n const endAction = options.endAction || options.action;\n const callback = options.callback;\n const message = (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_6__[\"default\"])({}, options, {\n endAction: null,\n transmuxer: null,\n callback: null\n });\n const listenForEndEvent = event => {\n if (event.data.action !== endAction) {\n return;\n }\n transmuxer.removeEventListener('message', listenForEndEvent); // transfer ownership of bytes back to us.\n\n if (event.data.data) {\n event.data.data = new Uint8Array(event.data.data, options.byteOffset || 0, options.byteLength || event.data.data.byteLength);\n if (options.data) {\n options.data = event.data.data;\n }\n }\n callback(event.data);\n };\n transmuxer.addEventListener('message', listenForEndEvent);\n if (options.data) {\n const isArrayBuffer = options.data instanceof ArrayBuffer;\n message.byteOffset = isArrayBuffer ? 0 : options.data.byteOffset;\n message.byteLength = options.data.byteLength;\n const transfers = [isArrayBuffer ? options.data : options.data.buffer];\n transmuxer.postMessage(message, transfers);\n } else {\n transmuxer.postMessage(message);\n }\n};\nconst REQUEST_ERRORS = {\n FAILURE: 2,\n TIMEOUT: -101,\n ABORTED: -102\n};\n/**\n * Abort all requests\n *\n * @param {Object} activeXhrs - an object that tracks all XHR requests\n */\n\nconst abortAll = activeXhrs => {\n activeXhrs.forEach(xhr => {\n xhr.abort();\n });\n};\n/**\n * Gather important bandwidth stats once a request has completed\n *\n * @param {Object} request - the XHR request from which to gather stats\n */\n\nconst getRequestStats = request => {\n return {\n bandwidth: request.bandwidth,\n bytesReceived: request.bytesReceived || 0,\n roundTripTime: request.roundTripTime || 0\n };\n};\n/**\n * If possible gather bandwidth stats as a request is in\n * progress\n *\n * @param {Event} progressEvent - an event object from an XHR's progress event\n */\n\nconst getProgressStats = progressEvent => {\n const request = progressEvent.target;\n const roundTripTime = Date.now() - request.requestTime;\n const stats = {\n bandwidth: Infinity,\n bytesReceived: 0,\n roundTripTime: roundTripTime || 0\n };\n stats.bytesReceived = progressEvent.loaded; // This can result in Infinity if stats.roundTripTime is 0 but that is ok\n // because we should only use bandwidth stats on progress to determine when\n // abort a request early due to insufficient bandwidth\n\n stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1000);\n return stats;\n};\n/**\n * Handle all error conditions in one place and return an object\n * with all the information\n *\n * @param {Error|null} error - if non-null signals an error occured with the XHR\n * @param {Object} request - the XHR request that possibly generated the error\n */\n\nconst handleErrors = (error, request) => {\n if (request.timedout) {\n return {\n status: request.status,\n message: 'HLS request timed-out at URL: ' + request.uri,\n code: REQUEST_ERRORS.TIMEOUT,\n xhr: request\n };\n }\n if (request.aborted) {\n return {\n status: request.status,\n message: 'HLS request aborted at URL: ' + request.uri,\n code: REQUEST_ERRORS.ABORTED,\n xhr: request\n };\n }\n if (error) {\n return {\n status: request.status,\n message: 'HLS request errored at URL: ' + request.uri,\n code: REQUEST_ERRORS.FAILURE,\n xhr: request\n };\n }\n if (request.responseType === 'arraybuffer' && request.response.byteLength === 0) {\n return {\n status: request.status,\n message: 'Empty HLS response at URL: ' + request.uri,\n code: REQUEST_ERRORS.FAILURE,\n xhr: request\n };\n }\n return null;\n};\n/**\n * Handle responses for key data and convert the key data to the correct format\n * for the decryption step later\n *\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Array} objects - objects to add the key bytes to.\n * @param {Function} finishProcessingFn - a callback to execute to continue processing\n * this request\n */\n\nconst handleKeyResponse = (segment, objects, finishProcessingFn) => (error, request) => {\n const response = request.response;\n const errorObj = handleErrors(error, request);\n if (errorObj) {\n return finishProcessingFn(errorObj, segment);\n }\n if (response.byteLength !== 16) {\n return finishProcessingFn({\n status: request.status,\n message: 'Invalid HLS key at URL: ' + request.uri,\n code: REQUEST_ERRORS.FAILURE,\n xhr: request\n }, segment);\n }\n const view = new DataView(response);\n const bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]);\n for (let i = 0; i < objects.length; i++) {\n objects[i].bytes = bytes;\n }\n return finishProcessingFn(null, segment);\n};\nconst parseInitSegment = (segment, callback) => {\n const type = (0,_videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_15__.detectContainerForBytes)(segment.map.bytes); // TODO: We should also handle ts init segments here, but we\n // only know how to parse mp4 init segments at the moment\n\n if (type !== 'mp4') {\n const uri = segment.map.resolvedUri || segment.map.uri;\n return callback({\n internal: true,\n message: `Found unsupported ${type || 'unknown'} container for initialization segment at URL: ${uri}`,\n code: REQUEST_ERRORS.FAILURE\n });\n }\n workerCallback({\n action: 'probeMp4Tracks',\n data: segment.map.bytes,\n transmuxer: segment.transmuxer,\n callback: ({\n tracks,\n data\n }) => {\n // transfer bytes back to us\n segment.map.bytes = data;\n tracks.forEach(function (track) {\n segment.map.tracks = segment.map.tracks || {}; // only support one track of each type for now\n\n if (segment.map.tracks[track.type]) {\n return;\n }\n segment.map.tracks[track.type] = track;\n if (typeof track.id === 'number' && track.timescale) {\n segment.map.timescales = segment.map.timescales || {};\n segment.map.timescales[track.id] = track.timescale;\n }\n });\n return callback(null);\n }\n });\n};\n/**\n * Handle init-segment responses\n *\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Function} finishProcessingFn - a callback to execute to continue processing\n * this request\n */\n\nconst handleInitSegmentResponse = ({\n segment,\n finishProcessingFn\n}) => (error, request) => {\n const errorObj = handleErrors(error, request);\n if (errorObj) {\n return finishProcessingFn(errorObj, segment);\n }\n const bytes = new Uint8Array(request.response); // init segment is encypted, we will have to wait\n // until the key request is done to decrypt.\n\n if (segment.map.key) {\n segment.map.encryptedBytes = bytes;\n return finishProcessingFn(null, segment);\n }\n segment.map.bytes = bytes;\n parseInitSegment(segment, function (parseError) {\n if (parseError) {\n parseError.xhr = request;\n parseError.status = request.status;\n return finishProcessingFn(parseError, segment);\n }\n finishProcessingFn(null, segment);\n });\n};\n/**\n * Response handler for segment-requests being sure to set the correct\n * property depending on whether the segment is encryped or not\n * Also records and keeps track of stats that are used for ABR purposes\n *\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Function} finishProcessingFn - a callback to execute to continue processing\n * this request\n */\n\nconst handleSegmentResponse = ({\n segment,\n finishProcessingFn,\n responseType\n}) => (error, request) => {\n const errorObj = handleErrors(error, request);\n if (errorObj) {\n return finishProcessingFn(errorObj, segment);\n }\n const newBytes =\n // although responseText \"should\" exist, this guard serves to prevent an error being\n // thrown for two primary cases:\n // 1. the mime type override stops working, or is not implemented for a specific\n // browser\n // 2. when using mock XHR libraries like sinon that do not allow the override behavior\n responseType === 'arraybuffer' || !request.responseText ? request.response : stringToArrayBuffer(request.responseText.substring(segment.lastReachedChar || 0));\n segment.stats = getRequestStats(request);\n if (segment.key) {\n segment.encryptedBytes = new Uint8Array(newBytes);\n } else {\n segment.bytes = new Uint8Array(newBytes);\n }\n return finishProcessingFn(null, segment);\n};\nconst transmuxAndNotify = ({\n segment,\n bytes,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn,\n doneFn,\n onTransmuxerLog\n}) => {\n const fmp4Tracks = segment.map && segment.map.tracks || {};\n const isMuxed = Boolean(fmp4Tracks.audio && fmp4Tracks.video); // Keep references to each function so we can null them out after we're done with them.\n // One reason for this is that in the case of full segments, we want to trust start\n // times from the probe, rather than the transmuxer.\n\n let audioStartFn = timingInfoFn.bind(null, segment, 'audio', 'start');\n const audioEndFn = timingInfoFn.bind(null, segment, 'audio', 'end');\n let videoStartFn = timingInfoFn.bind(null, segment, 'video', 'start');\n const videoEndFn = timingInfoFn.bind(null, segment, 'video', 'end');\n const finish = () => transmux({\n bytes,\n transmuxer: segment.transmuxer,\n audioAppendStart: segment.audioAppendStart,\n gopsToAlignWith: segment.gopsToAlignWith,\n remux: isMuxed,\n onData: result => {\n result.type = result.type === 'combined' ? 'video' : result.type;\n dataFn(segment, result);\n },\n onTrackInfo: trackInfo => {\n if (trackInfoFn) {\n if (isMuxed) {\n trackInfo.isMuxed = true;\n }\n trackInfoFn(segment, trackInfo);\n }\n },\n onAudioTimingInfo: audioTimingInfo => {\n // we only want the first start value we encounter\n if (audioStartFn && typeof audioTimingInfo.start !== 'undefined') {\n audioStartFn(audioTimingInfo.start);\n audioStartFn = null;\n } // we want to continually update the end time\n\n if (audioEndFn && typeof audioTimingInfo.end !== 'undefined') {\n audioEndFn(audioTimingInfo.end);\n }\n },\n onVideoTimingInfo: videoTimingInfo => {\n // we only want the first start value we encounter\n if (videoStartFn && typeof videoTimingInfo.start !== 'undefined') {\n videoStartFn(videoTimingInfo.start);\n videoStartFn = null;\n } // we want to continually update the end time\n\n if (videoEndFn && typeof videoTimingInfo.end !== 'undefined') {\n videoEndFn(videoTimingInfo.end);\n }\n },\n onVideoSegmentTimingInfo: videoSegmentTimingInfo => {\n videoSegmentTimingInfoFn(videoSegmentTimingInfo);\n },\n onAudioSegmentTimingInfo: audioSegmentTimingInfo => {\n audioSegmentTimingInfoFn(audioSegmentTimingInfo);\n },\n onId3: (id3Frames, dispatchType) => {\n id3Fn(segment, id3Frames, dispatchType);\n },\n onCaptions: captions => {\n captionsFn(segment, [captions]);\n },\n isEndOfTimeline,\n onEndedTimeline: () => {\n endedTimelineFn();\n },\n onTransmuxerLog,\n onDone: result => {\n if (!doneFn) {\n return;\n }\n result.type = result.type === 'combined' ? 'video' : result.type;\n doneFn(null, segment, result);\n }\n }); // In the transmuxer, we don't yet have the ability to extract a \"proper\" start time.\n // Meaning cached frame data may corrupt our notion of where this segment\n // really starts. To get around this, probe for the info needed.\n\n workerCallback({\n action: 'probeTs',\n transmuxer: segment.transmuxer,\n data: bytes,\n baseStartTime: segment.baseStartTime,\n callback: data => {\n segment.bytes = bytes = data.data;\n const probeResult = data.result;\n if (probeResult) {\n trackInfoFn(segment, {\n hasAudio: probeResult.hasAudio,\n hasVideo: probeResult.hasVideo,\n isMuxed\n });\n trackInfoFn = null;\n }\n finish();\n }\n });\n};\nconst handleSegmentBytes = ({\n segment,\n bytes,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn,\n doneFn,\n onTransmuxerLog\n}) => {\n let bytesAsUint8Array = new Uint8Array(bytes); // TODO:\n // We should have a handler that fetches the number of bytes required\n // to check if something is fmp4. This will allow us to save bandwidth\n // because we can only exclude a playlist and abort requests\n // by codec after trackinfo triggers.\n\n if ((0,_videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_15__.isLikelyFmp4MediaSegment)(bytesAsUint8Array)) {\n segment.isFmp4 = true;\n const {\n tracks\n } = segment.map;\n const trackInfo = {\n isFmp4: true,\n hasVideo: !!tracks.video,\n hasAudio: !!tracks.audio\n }; // if we have a audio track, with a codec that is not set to\n // encrypted audio\n\n if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== 'enca') {\n trackInfo.audioCodec = tracks.audio.codec;\n } // if we have a video track, with a codec that is not set to\n // encrypted video\n\n if (tracks.video && tracks.video.codec && tracks.video.codec !== 'encv') {\n trackInfo.videoCodec = tracks.video.codec;\n }\n if (tracks.video && tracks.audio) {\n trackInfo.isMuxed = true;\n } // since we don't support appending fmp4 data on progress, we know we have the full\n // segment here\n\n trackInfoFn(segment, trackInfo); // The probe doesn't provide the segment end time, so only callback with the start\n // time. The end time can be roughly calculated by the receiver using the duration.\n //\n // Note that the start time returned by the probe reflects the baseMediaDecodeTime, as\n // that is the true start of the segment (where the playback engine should begin\n // decoding).\n\n const finishLoading = (captions, id3Frames) => {\n // if the track still has audio at this point it is only possible\n // for it to be audio only. See `tracks.video && tracks.audio` if statement\n // above.\n // we make sure to use segment.bytes here as that\n dataFn(segment, {\n data: bytesAsUint8Array,\n type: trackInfo.hasAudio && !trackInfo.isMuxed ? 'audio' : 'video'\n });\n if (id3Frames && id3Frames.length) {\n id3Fn(segment, id3Frames);\n }\n if (captions && captions.length) {\n captionsFn(segment, captions);\n }\n doneFn(null, segment, {});\n };\n workerCallback({\n action: 'probeMp4StartTime',\n timescales: segment.map.timescales,\n data: bytesAsUint8Array,\n transmuxer: segment.transmuxer,\n callback: ({\n data,\n startTime\n }) => {\n // transfer bytes back to us\n bytes = data.buffer;\n segment.bytes = bytesAsUint8Array = data;\n if (trackInfo.hasAudio && !trackInfo.isMuxed) {\n timingInfoFn(segment, 'audio', 'start', startTime);\n }\n if (trackInfo.hasVideo) {\n timingInfoFn(segment, 'video', 'start', startTime);\n }\n workerCallback({\n action: 'probeEmsgID3',\n data: bytesAsUint8Array,\n transmuxer: segment.transmuxer,\n offset: startTime,\n callback: ({\n emsgData,\n id3Frames\n }) => {\n // transfer bytes back to us\n bytes = emsgData.buffer;\n segment.bytes = bytesAsUint8Array = emsgData; // Run through the CaptionParser in case there are captions.\n // Initialize CaptionParser if it hasn't been yet\n\n if (!tracks.video || !emsgData.byteLength || !segment.transmuxer) {\n finishLoading(undefined, id3Frames);\n return;\n }\n workerCallback({\n action: 'pushMp4Captions',\n endAction: 'mp4Captions',\n transmuxer: segment.transmuxer,\n data: bytesAsUint8Array,\n timescales: segment.map.timescales,\n trackIds: [tracks.video.id],\n callback: message => {\n // transfer bytes back to us\n bytes = message.data.buffer;\n segment.bytes = bytesAsUint8Array = message.data;\n message.logs.forEach(function (log) {\n onTransmuxerLog(merge(log, {\n stream: 'mp4CaptionParser'\n }));\n });\n finishLoading(message.captions, id3Frames);\n }\n });\n }\n });\n }\n });\n return;\n } // VTT or other segments that don't need processing\n\n if (!segment.transmuxer) {\n doneFn(null, segment, {});\n return;\n }\n if (typeof segment.container === 'undefined') {\n segment.container = (0,_videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_15__.detectContainerForBytes)(bytesAsUint8Array);\n }\n if (segment.container !== 'ts' && segment.container !== 'aac') {\n trackInfoFn(segment, {\n hasAudio: false,\n hasVideo: false\n });\n doneFn(null, segment, {});\n return;\n } // ts or aac\n\n transmuxAndNotify({\n segment,\n bytes,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn,\n doneFn,\n onTransmuxerLog\n });\n};\nconst decrypt = function ({\n id,\n key,\n encryptedBytes,\n decryptionWorker\n}, callback) {\n const decryptionHandler = event => {\n if (event.data.source === id) {\n decryptionWorker.removeEventListener('message', decryptionHandler);\n const decrypted = event.data.decrypted;\n callback(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength));\n }\n };\n decryptionWorker.addEventListener('message', decryptionHandler);\n let keyBytes;\n if (key.bytes.slice) {\n keyBytes = key.bytes.slice();\n } else {\n keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes));\n } // incrementally decrypt the bytes\n\n decryptionWorker.postMessage(createTransferableMessage({\n source: id,\n encrypted: encryptedBytes,\n key: keyBytes,\n iv: key.iv\n }), [encryptedBytes.buffer, keyBytes.buffer]);\n};\n/**\n * Decrypt the segment via the decryption web worker\n *\n * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption\n * routines\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Function} trackInfoFn - a callback that receives track info\n * @param {Function} timingInfoFn - a callback that receives timing info\n * @param {Function} videoSegmentTimingInfoFn\n * a callback that receives video timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} audioSegmentTimingInfoFn\n * a callback that receives audio timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {boolean} isEndOfTimeline\n * true if this segment represents the last segment in a timeline\n * @param {Function} endedTimelineFn\n * a callback made when a timeline is ended, will only be called if\n * isEndOfTimeline is true\n * @param {Function} dataFn - a callback that is executed when segment bytes are available\n * and ready to use\n * @param {Function} doneFn - a callback that is executed after decryption has completed\n */\n\nconst decryptSegment = ({\n decryptionWorker,\n segment,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn,\n doneFn,\n onTransmuxerLog\n}) => {\n decrypt({\n id: segment.requestId,\n key: segment.key,\n encryptedBytes: segment.encryptedBytes,\n decryptionWorker\n }, decryptedBytes => {\n segment.bytes = decryptedBytes;\n handleSegmentBytes({\n segment,\n bytes: segment.bytes,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn,\n doneFn,\n onTransmuxerLog\n });\n });\n};\n/**\n * This function waits for all XHRs to finish (with either success or failure)\n * before continueing processing via it's callback. The function gathers errors\n * from each request into a single errors array so that the error status for\n * each request can be examined later.\n *\n * @param {Object} activeXhrs - an object that tracks all XHR requests\n * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption\n * routines\n * @param {Function} trackInfoFn - a callback that receives track info\n * @param {Function} timingInfoFn - a callback that receives timing info\n * @param {Function} videoSegmentTimingInfoFn\n * a callback that receives video timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} audioSegmentTimingInfoFn\n * a callback that receives audio timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} id3Fn - a callback that receives ID3 metadata\n * @param {Function} captionsFn - a callback that receives captions\n * @param {boolean} isEndOfTimeline\n * true if this segment represents the last segment in a timeline\n * @param {Function} endedTimelineFn\n * a callback made when a timeline is ended, will only be called if\n * isEndOfTimeline is true\n * @param {Function} dataFn - a callback that is executed when segment bytes are available\n * and ready to use\n * @param {Function} doneFn - a callback that is executed after all resources have been\n * downloaded and any decryption completed\n */\n\nconst waitForCompletion = ({\n activeXhrs,\n decryptionWorker,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn,\n doneFn,\n onTransmuxerLog\n}) => {\n let count = 0;\n let didError = false;\n return (error, segment) => {\n if (didError) {\n return;\n }\n if (error) {\n didError = true; // If there are errors, we have to abort any outstanding requests\n\n abortAll(activeXhrs); // Even though the requests above are aborted, and in theory we could wait until we\n // handle the aborted events from those requests, there are some cases where we may\n // never get an aborted event. For instance, if the network connection is lost and\n // there were two requests, the first may have triggered an error immediately, while\n // the second request remains unsent. In that case, the aborted algorithm will not\n // trigger an abort: see https://xhr.spec.whatwg.org/#the-abort()-method\n //\n // We also can't rely on the ready state of the XHR, since the request that\n // triggered the connection error may also show as a ready state of 0 (unsent).\n // Therefore, we have to finish this group of requests immediately after the first\n // seen error.\n\n return doneFn(error, segment);\n }\n count += 1;\n if (count === activeXhrs.length) {\n const segmentFinish = function () {\n if (segment.encryptedBytes) {\n return decryptSegment({\n decryptionWorker,\n segment,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn,\n doneFn,\n onTransmuxerLog\n });\n } // Otherwise, everything is ready just continue\n\n handleSegmentBytes({\n segment,\n bytes: segment.bytes,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn,\n doneFn,\n onTransmuxerLog\n });\n }; // Keep track of when *all* of the requests have completed\n\n segment.endOfAllRequests = Date.now();\n if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) {\n return decrypt({\n decryptionWorker,\n // add -init to the \"id\" to differentiate between segment\n // and init segment decryption, just in case they happen\n // at the same time at some point in the future.\n id: segment.requestId + '-init',\n encryptedBytes: segment.map.encryptedBytes,\n key: segment.map.key\n }, decryptedBytes => {\n segment.map.bytes = decryptedBytes;\n parseInitSegment(segment, parseError => {\n if (parseError) {\n abortAll(activeXhrs);\n return doneFn(parseError, segment);\n }\n segmentFinish();\n });\n });\n }\n segmentFinish();\n }\n };\n};\n/**\n * Calls the abort callback if any request within the batch was aborted. Will only call\n * the callback once per batch of requests, even if multiple were aborted.\n *\n * @param {Object} loadendState - state to check to see if the abort function was called\n * @param {Function} abortFn - callback to call for abort\n */\n\nconst handleLoadEnd = ({\n loadendState,\n abortFn\n}) => event => {\n const request = event.target;\n if (request.aborted && abortFn && !loadendState.calledAbortFn) {\n abortFn();\n loadendState.calledAbortFn = true;\n }\n};\n/**\n * Simple progress event callback handler that gathers some stats before\n * executing a provided callback with the `segment` object\n *\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Function} progressFn - a callback that is executed each time a progress event\n * is received\n * @param {Function} trackInfoFn - a callback that receives track info\n * @param {Function} timingInfoFn - a callback that receives timing info\n * @param {Function} videoSegmentTimingInfoFn\n * a callback that receives video timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} audioSegmentTimingInfoFn\n * a callback that receives audio timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {boolean} isEndOfTimeline\n * true if this segment represents the last segment in a timeline\n * @param {Function} endedTimelineFn\n * a callback made when a timeline is ended, will only be called if\n * isEndOfTimeline is true\n * @param {Function} dataFn - a callback that is executed when segment bytes are available\n * and ready to use\n * @param {Event} event - the progress event object from XMLHttpRequest\n */\n\nconst handleProgress = ({\n segment,\n progressFn,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn\n}) => event => {\n const request = event.target;\n if (request.aborted) {\n return;\n }\n segment.stats = merge(segment.stats, getProgressStats(event)); // record the time that we receive the first byte of data\n\n if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) {\n segment.stats.firstBytesReceivedAt = Date.now();\n }\n return progressFn(event, segment);\n};\n/**\n * Load all resources and does any processing necessary for a media-segment\n *\n * Features:\n * decrypts the media-segment if it has a key uri and an iv\n * aborts *all* requests if *any* one request fails\n *\n * The segment object, at minimum, has the following format:\n * {\n * resolvedUri: String,\n * [transmuxer]: Object,\n * [byterange]: {\n * offset: Number,\n * length: Number\n * },\n * [key]: {\n * resolvedUri: String\n * [byterange]: {\n * offset: Number,\n * length: Number\n * },\n * iv: {\n * bytes: Uint32Array\n * }\n * },\n * [map]: {\n * resolvedUri: String,\n * [byterange]: {\n * offset: Number,\n * length: Number\n * },\n * [bytes]: Uint8Array\n * }\n * }\n * ...where [name] denotes optional properties\n *\n * @param {Function} xhr - an instance of the xhr wrapper in xhr.js\n * @param {Object} xhrOptions - the base options to provide to all xhr requests\n * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128\n * decryption routines\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Function} abortFn - a callback called (only once) if any piece of a request was\n * aborted\n * @param {Function} progressFn - a callback that receives progress events from the main\n * segment's xhr request\n * @param {Function} trackInfoFn - a callback that receives track info\n * @param {Function} timingInfoFn - a callback that receives timing info\n * @param {Function} videoSegmentTimingInfoFn\n * a callback that receives video timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} audioSegmentTimingInfoFn\n * a callback that receives audio timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} id3Fn - a callback that receives ID3 metadata\n * @param {Function} captionsFn - a callback that receives captions\n * @param {boolean} isEndOfTimeline\n * true if this segment represents the last segment in a timeline\n * @param {Function} endedTimelineFn\n * a callback made when a timeline is ended, will only be called if\n * isEndOfTimeline is true\n * @param {Function} dataFn - a callback that receives data from the main segment's xhr\n * request, transmuxed if needed\n * @param {Function} doneFn - a callback that is executed only once all requests have\n * succeeded or failed\n * @return {Function} a function that, when invoked, immediately aborts all\n * outstanding requests\n */\n\nconst mediaSegmentRequest = ({\n xhr,\n xhrOptions,\n decryptionWorker,\n segment,\n abortFn,\n progressFn,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn,\n doneFn,\n onTransmuxerLog\n}) => {\n const activeXhrs = [];\n const finishProcessingFn = waitForCompletion({\n activeXhrs,\n decryptionWorker,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn,\n doneFn,\n onTransmuxerLog\n }); // optionally, request the decryption key\n\n if (segment.key && !segment.key.bytes) {\n const objects = [segment.key];\n if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) {\n objects.push(segment.map.key);\n }\n const keyRequestOptions = merge(xhrOptions, {\n uri: segment.key.resolvedUri,\n responseType: 'arraybuffer'\n });\n const keyRequestCallback = handleKeyResponse(segment, objects, finishProcessingFn);\n const keyXhr = xhr(keyRequestOptions, keyRequestCallback);\n activeXhrs.push(keyXhr);\n } // optionally, request the associated media init segment\n\n if (segment.map && !segment.map.bytes) {\n const differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri);\n if (differentMapKey) {\n const mapKeyRequestOptions = merge(xhrOptions, {\n uri: segment.map.key.resolvedUri,\n responseType: 'arraybuffer'\n });\n const mapKeyRequestCallback = handleKeyResponse(segment, [segment.map.key], finishProcessingFn);\n const mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback);\n activeXhrs.push(mapKeyXhr);\n }\n const initSegmentOptions = merge(xhrOptions, {\n uri: segment.map.resolvedUri,\n responseType: 'arraybuffer',\n headers: segmentXhrHeaders(segment.map)\n });\n const initSegmentRequestCallback = handleInitSegmentResponse({\n segment,\n finishProcessingFn\n });\n const initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback);\n activeXhrs.push(initSegmentXhr);\n }\n const segmentRequestOptions = merge(xhrOptions, {\n uri: segment.part && segment.part.resolvedUri || segment.resolvedUri,\n responseType: 'arraybuffer',\n headers: segmentXhrHeaders(segment)\n });\n const segmentRequestCallback = handleSegmentResponse({\n segment,\n finishProcessingFn,\n responseType: segmentRequestOptions.responseType\n });\n const segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback);\n segmentXhr.addEventListener('progress', handleProgress({\n segment,\n progressFn,\n trackInfoFn,\n timingInfoFn,\n videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn,\n id3Fn,\n captionsFn,\n isEndOfTimeline,\n endedTimelineFn,\n dataFn\n }));\n activeXhrs.push(segmentXhr); // since all parts of the request must be considered, but should not make callbacks\n // multiple times, provide a shared state object\n\n const loadendState = {};\n activeXhrs.forEach(activeXhr => {\n activeXhr.addEventListener('loadend', handleLoadEnd({\n loadendState,\n abortFn\n }));\n });\n return () => abortAll(activeXhrs);\n};\n\n/**\n * @file - codecs.js - Handles tasks regarding codec strings such as translating them to\n * codec strings, or translating codec strings into objects that can be examined.\n */\nconst logFn$1 = logger('CodecUtils');\n/**\n * Returns a set of codec strings parsed from the playlist or the default\n * codec strings if no codecs were specified in the playlist\n *\n * @param {Playlist} media the current media playlist\n * @return {Object} an object with the video and audio codecs\n */\n\nconst getCodecs = function (media) {\n // if the codecs were explicitly specified, use them instead of the\n // defaults\n const mediaAttributes = media.attributes || {};\n if (mediaAttributes.CODECS) {\n return (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.parseCodecs)(mediaAttributes.CODECS);\n }\n};\nconst isMaat = (main, media) => {\n const mediaAttributes = media.attributes || {};\n return main && main.mediaGroups && main.mediaGroups.AUDIO && mediaAttributes.AUDIO && main.mediaGroups.AUDIO[mediaAttributes.AUDIO];\n};\nconst isMuxed = (main, media) => {\n if (!isMaat(main, media)) {\n return true;\n }\n const mediaAttributes = media.attributes || {};\n const audioGroup = main.mediaGroups.AUDIO[mediaAttributes.AUDIO];\n for (const groupId in audioGroup) {\n // If an audio group has a URI (the case for HLS, as HLS will use external playlists),\n // or there are listed playlists (the case for DASH, as the manifest will have already\n // provided all of the details necessary to generate the audio playlist, as opposed to\n // HLS' externally requested playlists), then the content is demuxed.\n if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) {\n return true;\n }\n }\n return false;\n};\nconst unwrapCodecList = function (codecList) {\n const codecs = {};\n codecList.forEach(({\n mediaType,\n type,\n details\n }) => {\n codecs[mediaType] = codecs[mediaType] || [];\n codecs[mediaType].push((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.translateLegacyCodec)(`${type}${details}`));\n });\n Object.keys(codecs).forEach(function (mediaType) {\n if (codecs[mediaType].length > 1) {\n logFn$1(`multiple ${mediaType} codecs found as attributes: ${codecs[mediaType].join(', ')}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`);\n codecs[mediaType] = null;\n return;\n }\n codecs[mediaType] = codecs[mediaType][0];\n });\n return codecs;\n};\nconst codecCount = function (codecObj) {\n let count = 0;\n if (codecObj.audio) {\n count++;\n }\n if (codecObj.video) {\n count++;\n }\n return count;\n};\n/**\n * Calculates the codec strings for a working configuration of\n * SourceBuffers to play variant streams in a main playlist. If\n * there is no possible working configuration, an empty object will be\n * returned.\n *\n * @param main {Object} the m3u8 object for the main playlist\n * @param media {Object} the m3u8 object for the variant playlist\n * @return {Object} the codec strings.\n *\n * @private\n */\n\nconst codecsForPlaylist = function (main, media) {\n const mediaAttributes = media.attributes || {};\n const codecInfo = unwrapCodecList(getCodecs(media) || []); // HLS with multiple-audio tracks must always get an audio codec.\n // Put another way, there is no way to have a video-only multiple-audio HLS!\n\n if (isMaat(main, media) && !codecInfo.audio) {\n if (!isMuxed(main, media)) {\n // It is possible for codecs to be specified on the audio media group playlist but\n // not on the rendition playlist. This is mostly the case for DASH, where audio and\n // video are always separate (and separately specified).\n const defaultCodecs = unwrapCodecList((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.codecsFromDefault)(main, mediaAttributes.AUDIO) || []);\n if (defaultCodecs.audio) {\n codecInfo.audio = defaultCodecs.audio;\n }\n }\n }\n return codecInfo;\n};\nconst logFn = logger('PlaylistSelector');\nconst representationToString = function (representation) {\n if (!representation || !representation.playlist) {\n return;\n }\n const playlist = representation.playlist;\n return JSON.stringify({\n id: playlist.id,\n bandwidth: representation.bandwidth,\n width: representation.width,\n height: representation.height,\n codecs: playlist.attributes && playlist.attributes.CODECS || ''\n });\n}; // Utilities\n\n/**\n * Returns the CSS value for the specified property on an element\n * using `getComputedStyle`. Firefox has a long-standing issue where\n * getComputedStyle() may return null when running in an iframe with\n * `display: none`.\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397\n * @param {HTMLElement} el the htmlelement to work on\n * @param {string} the proprety to get the style for\n */\n\nconst safeGetComputedStyle = function (el, property) {\n if (!el) {\n return '';\n }\n const result = global_window__WEBPACK_IMPORTED_MODULE_0___default().getComputedStyle(el);\n if (!result) {\n return '';\n }\n return result[property];\n};\n/**\n * Resuable stable sort function\n *\n * @param {Playlists} array\n * @param {Function} sortFn Different comparators\n * @function stableSort\n */\n\nconst stableSort = function (array, sortFn) {\n const newArray = array.slice();\n array.sort(function (left, right) {\n const cmp = sortFn(left, right);\n if (cmp === 0) {\n return newArray.indexOf(left) - newArray.indexOf(right);\n }\n return cmp;\n });\n};\n/**\n * A comparator function to sort two playlist object by bandwidth.\n *\n * @param {Object} left a media playlist object\n * @param {Object} right a media playlist object\n * @return {number} Greater than zero if the bandwidth attribute of\n * left is greater than the corresponding attribute of right. Less\n * than zero if the bandwidth of right is greater than left and\n * exactly zero if the two are equal.\n */\n\nconst comparePlaylistBandwidth = function (left, right) {\n let leftBandwidth;\n let rightBandwidth;\n if (left.attributes.BANDWIDTH) {\n leftBandwidth = left.attributes.BANDWIDTH;\n }\n leftBandwidth = leftBandwidth || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Number).MAX_VALUE;\n if (right.attributes.BANDWIDTH) {\n rightBandwidth = right.attributes.BANDWIDTH;\n }\n rightBandwidth = rightBandwidth || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Number).MAX_VALUE;\n return leftBandwidth - rightBandwidth;\n};\n/**\n * A comparator function to sort two playlist object by resolution (width).\n *\n * @param {Object} left a media playlist object\n * @param {Object} right a media playlist object\n * @return {number} Greater than zero if the resolution.width attribute of\n * left is greater than the corresponding attribute of right. Less\n * than zero if the resolution.width of right is greater than left and\n * exactly zero if the two are equal.\n */\n\nconst comparePlaylistResolution = function (left, right) {\n let leftWidth;\n let rightWidth;\n if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) {\n leftWidth = left.attributes.RESOLUTION.width;\n }\n leftWidth = leftWidth || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Number).MAX_VALUE;\n if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) {\n rightWidth = right.attributes.RESOLUTION.width;\n }\n rightWidth = rightWidth || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Number).MAX_VALUE; // NOTE - Fallback to bandwidth sort as appropriate in cases where multiple renditions\n // have the same media dimensions/ resolution\n\n if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) {\n return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH;\n }\n return leftWidth - rightWidth;\n};\n/**\n * Chooses the appropriate media playlist based on bandwidth and player size\n *\n * @param {Object} main\n * Object representation of the main manifest\n * @param {number} playerBandwidth\n * Current calculated bandwidth of the player\n * @param {number} playerWidth\n * Current width of the player element (should account for the device pixel ratio)\n * @param {number} playerHeight\n * Current height of the player element (should account for the device pixel ratio)\n * @param {boolean} limitRenditionByPlayerDimensions\n * True if the player width and height should be used during the selection, false otherwise\n * @param {Object} playlistController\n * the current playlistController object\n * @return {Playlist} the highest bitrate playlist less than the\n * currently detected bandwidth, accounting for some amount of\n * bandwidth variance\n */\n\nlet simpleSelector = function (main, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, playlistController) {\n // If we end up getting called before `main` is available, exit early\n if (!main) {\n return;\n }\n const options = {\n bandwidth: playerBandwidth,\n width: playerWidth,\n height: playerHeight,\n limitRenditionByPlayerDimensions\n };\n let playlists = main.playlists; // if playlist is audio only, select between currently active audio group playlists.\n\n if (Playlist.isAudioOnly(main)) {\n playlists = playlistController.getAudioTrackPlaylists_(); // add audioOnly to options so that we log audioOnly: true\n // at the buttom of this function for debugging.\n\n options.audioOnly = true;\n } // convert the playlists to an intermediary representation to make comparisons easier\n\n let sortedPlaylistReps = playlists.map(playlist => {\n let bandwidth;\n const width = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width;\n const height = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height;\n bandwidth = playlist.attributes && playlist.attributes.BANDWIDTH;\n bandwidth = bandwidth || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Number).MAX_VALUE;\n return {\n bandwidth,\n width,\n height,\n playlist\n };\n });\n stableSort(sortedPlaylistReps, (left, right) => left.bandwidth - right.bandwidth); // filter out any playlists that have been excluded due to\n // incompatible configurations\n\n sortedPlaylistReps = sortedPlaylistReps.filter(rep => !Playlist.isIncompatible(rep.playlist)); // filter out any playlists that have been disabled manually through the representations\n // api or excluded temporarily due to playback errors.\n\n let enabledPlaylistReps = sortedPlaylistReps.filter(rep => Playlist.isEnabled(rep.playlist));\n if (!enabledPlaylistReps.length) {\n // if there are no enabled playlists, then they have all been excluded or disabled\n // by the user through the representations api. In this case, ignore exclusion and\n // fallback to what the user wants by using playlists the user has not disabled.\n enabledPlaylistReps = sortedPlaylistReps.filter(rep => !Playlist.isDisabled(rep.playlist));\n } // filter out any variant that has greater effective bitrate\n // than the current estimated bandwidth\n\n const bandwidthPlaylistReps = enabledPlaylistReps.filter(rep => rep.bandwidth * Config.BANDWIDTH_VARIANCE < playerBandwidth);\n let highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1]; // get all of the renditions with the same (highest) bandwidth\n // and then taking the very first element\n\n const bandwidthBestRep = bandwidthPlaylistReps.filter(rep => rep.bandwidth === highestRemainingBandwidthRep.bandwidth)[0]; // if we're not going to limit renditions by player size, make an early decision.\n\n if (limitRenditionByPlayerDimensions === false) {\n const chosenRep = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];\n if (chosenRep && chosenRep.playlist) {\n let type = 'sortedPlaylistReps';\n if (bandwidthBestRep) {\n type = 'bandwidthBestRep';\n }\n if (enabledPlaylistReps[0]) {\n type = 'enabledPlaylistReps';\n }\n logFn(`choosing ${representationToString(chosenRep)} using ${type} with options`, options);\n return chosenRep.playlist;\n }\n logFn('could not choose a playlist with options', options);\n return null;\n } // filter out playlists without resolution information\n\n const haveResolution = bandwidthPlaylistReps.filter(rep => rep.width && rep.height); // sort variants by resolution\n\n stableSort(haveResolution, (left, right) => left.width - right.width); // if we have the exact resolution as the player use it\n\n const resolutionBestRepList = haveResolution.filter(rep => rep.width === playerWidth && rep.height === playerHeight);\n highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1]; // ensure that we pick the highest bandwidth variant that have exact resolution\n\n const resolutionBestRep = resolutionBestRepList.filter(rep => rep.bandwidth === highestRemainingBandwidthRep.bandwidth)[0];\n let resolutionPlusOneList;\n let resolutionPlusOneSmallest;\n let resolutionPlusOneRep; // find the smallest variant that is larger than the player\n // if there is no match of exact resolution\n\n if (!resolutionBestRep) {\n resolutionPlusOneList = haveResolution.filter(rep => rep.width > playerWidth || rep.height > playerHeight); // find all the variants have the same smallest resolution\n\n resolutionPlusOneSmallest = resolutionPlusOneList.filter(rep => rep.width === resolutionPlusOneList[0].width && rep.height === resolutionPlusOneList[0].height); // ensure that we also pick the highest bandwidth variant that\n // is just-larger-than the video player\n\n highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1];\n resolutionPlusOneRep = resolutionPlusOneSmallest.filter(rep => rep.bandwidth === highestRemainingBandwidthRep.bandwidth)[0];\n }\n let leastPixelDiffRep; // If this selector proves to be better than others,\n // resolutionPlusOneRep and resolutionBestRep and all\n // the code involving them should be removed.\n\n if (playlistController.leastPixelDiffSelector) {\n // find the variant that is closest to the player's pixel size\n const leastPixelDiffList = haveResolution.map(rep => {\n rep.pixelDiff = Math.abs(rep.width - playerWidth) + Math.abs(rep.height - playerHeight);\n return rep;\n }); // get the highest bandwidth, closest resolution playlist\n\n stableSort(leastPixelDiffList, (left, right) => {\n // sort by highest bandwidth if pixelDiff is the same\n if (left.pixelDiff === right.pixelDiff) {\n return right.bandwidth - left.bandwidth;\n }\n return left.pixelDiff - right.pixelDiff;\n });\n leastPixelDiffRep = leastPixelDiffList[0];\n } // fallback chain of variants\n\n const chosenRep = leastPixelDiffRep || resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];\n if (chosenRep && chosenRep.playlist) {\n let type = 'sortedPlaylistReps';\n if (leastPixelDiffRep) {\n type = 'leastPixelDiffRep';\n } else if (resolutionPlusOneRep) {\n type = 'resolutionPlusOneRep';\n } else if (resolutionBestRep) {\n type = 'resolutionBestRep';\n } else if (bandwidthBestRep) {\n type = 'bandwidthBestRep';\n } else if (enabledPlaylistReps[0]) {\n type = 'enabledPlaylistReps';\n }\n logFn(`choosing ${representationToString(chosenRep)} using ${type} with options`, options);\n return chosenRep.playlist;\n }\n logFn('could not choose a playlist with options', options);\n return null;\n};\n\n/**\n * Chooses the appropriate media playlist based on the most recent\n * bandwidth estimate and the player size.\n *\n * Expects to be called within the context of an instance of VhsHandler\n *\n * @return {Playlist} the highest bitrate playlist less than the\n * currently detected bandwidth, accounting for some amount of\n * bandwidth variance\n */\n\nconst lastBandwidthSelector = function () {\n const pixelRatio = this.useDevicePixelRatio ? (global_window__WEBPACK_IMPORTED_MODULE_0___default().devicePixelRatio) || 1 : 1;\n return simpleSelector(this.playlists.main, this.systemBandwidth, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.playlistController_);\n};\n/**\n * Chooses the appropriate media playlist based on an\n * exponential-weighted moving average of the bandwidth after\n * filtering for player size.\n *\n * Expects to be called within the context of an instance of VhsHandler\n *\n * @param {number} decay - a number between 0 and 1. Higher values of\n * this parameter will cause previous bandwidth estimates to lose\n * significance more quickly.\n * @return {Function} a function which can be invoked to create a new\n * playlist selector function.\n * @see https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average\n */\n\nconst movingAverageBandwidthSelector = function (decay) {\n let average = -1;\n let lastSystemBandwidth = -1;\n if (decay < 0 || decay > 1) {\n throw new Error('Moving average bandwidth decay must be between 0 and 1.');\n }\n return function () {\n const pixelRatio = this.useDevicePixelRatio ? (global_window__WEBPACK_IMPORTED_MODULE_0___default().devicePixelRatio) || 1 : 1;\n if (average < 0) {\n average = this.systemBandwidth;\n lastSystemBandwidth = this.systemBandwidth;\n } // stop the average value from decaying for every 250ms\n // when the systemBandwidth is constant\n // and\n // stop average from setting to a very low value when the\n // systemBandwidth becomes 0 in case of chunk cancellation\n\n if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) {\n average = decay * this.systemBandwidth + (1 - decay) * average;\n lastSystemBandwidth = this.systemBandwidth;\n }\n return simpleSelector(this.playlists.main, average, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.playlistController_);\n };\n};\n/**\n * Chooses the appropriate media playlist based on the potential to rebuffer\n *\n * @param {Object} settings\n * Object of information required to use this selector\n * @param {Object} settings.main\n * Object representation of the main manifest\n * @param {number} settings.currentTime\n * The current time of the player\n * @param {number} settings.bandwidth\n * Current measured bandwidth\n * @param {number} settings.duration\n * Duration of the media\n * @param {number} settings.segmentDuration\n * Segment duration to be used in round trip time calculations\n * @param {number} settings.timeUntilRebuffer\n * Time left in seconds until the player has to rebuffer\n * @param {number} settings.currentTimeline\n * The current timeline segments are being loaded from\n * @param {SyncController} settings.syncController\n * SyncController for determining if we have a sync point for a given playlist\n * @return {Object|null}\n * {Object} return.playlist\n * The highest bandwidth playlist with the least amount of rebuffering\n * {Number} return.rebufferingImpact\n * The amount of time in seconds switching to this playlist will rebuffer. A\n * negative value means that switching will cause zero rebuffering.\n */\n\nconst minRebufferMaxBandwidthSelector = function (settings) {\n const {\n main,\n currentTime,\n bandwidth,\n duration,\n segmentDuration,\n timeUntilRebuffer,\n currentTimeline,\n syncController\n } = settings; // filter out any playlists that have been excluded due to\n // incompatible configurations\n\n const compatiblePlaylists = main.playlists.filter(playlist => !Playlist.isIncompatible(playlist)); // filter out any playlists that have been disabled manually through the representations\n // api or excluded temporarily due to playback errors.\n\n let enabledPlaylists = compatiblePlaylists.filter(Playlist.isEnabled);\n if (!enabledPlaylists.length) {\n // if there are no enabled playlists, then they have all been excluded or disabled\n // by the user through the representations api. In this case, ignore exclusion and\n // fallback to what the user wants by using playlists the user has not disabled.\n enabledPlaylists = compatiblePlaylists.filter(playlist => !Playlist.isDisabled(playlist));\n }\n const bandwidthPlaylists = enabledPlaylists.filter(Playlist.hasAttribute.bind(null, 'BANDWIDTH'));\n const rebufferingEstimates = bandwidthPlaylists.map(playlist => {\n const syncPoint = syncController.getSyncPoint(playlist, duration, currentTimeline, currentTime); // If there is no sync point for this playlist, switching to it will require a\n // sync request first. This will double the request time\n\n const numRequests = syncPoint ? 1 : 2;\n const requestTimeEstimate = Playlist.estimateSegmentRequestTime(segmentDuration, bandwidth, playlist);\n const rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer;\n return {\n playlist,\n rebufferingImpact\n };\n });\n const noRebufferingPlaylists = rebufferingEstimates.filter(estimate => estimate.rebufferingImpact <= 0); // Sort by bandwidth DESC\n\n stableSort(noRebufferingPlaylists, (a, b) => comparePlaylistBandwidth(b.playlist, a.playlist));\n if (noRebufferingPlaylists.length) {\n return noRebufferingPlaylists[0];\n }\n stableSort(rebufferingEstimates, (a, b) => a.rebufferingImpact - b.rebufferingImpact);\n return rebufferingEstimates[0] || null;\n};\n/**\n * Chooses the appropriate media playlist, which in this case is the lowest bitrate\n * one with video. If no renditions with video exist, return the lowest audio rendition.\n *\n * Expects to be called within the context of an instance of VhsHandler\n *\n * @return {Object|null}\n * {Object} return.playlist\n * The lowest bitrate playlist that contains a video codec. If no such rendition\n * exists pick the lowest audio rendition.\n */\n\nconst lowestBitrateCompatibleVariantSelector = function () {\n // filter out any playlists that have been excluded due to\n // incompatible configurations or playback errors\n const playlists = this.playlists.main.playlists.filter(Playlist.isEnabled); // Sort ascending by bitrate\n\n stableSort(playlists, (a, b) => comparePlaylistBandwidth(a, b)); // Parse and assume that playlists with no video codec have no video\n // (this is not necessarily true, although it is generally true).\n //\n // If an entire manifest has no valid videos everything will get filtered\n // out.\n\n const playlistsWithVideo = playlists.filter(playlist => !!codecsForPlaylist(this.playlists.main, playlist).video);\n return playlistsWithVideo[0] || null;\n};\n\n/**\n * Combine all segments into a single Uint8Array\n *\n * @param {Object} segmentObj\n * @return {Uint8Array} concatenated bytes\n * @private\n */\nconst concatSegments = segmentObj => {\n let offset = 0;\n let tempBuffer;\n if (segmentObj.bytes) {\n tempBuffer = new Uint8Array(segmentObj.bytes); // combine the individual segments into one large typed-array\n\n segmentObj.segments.forEach(segment => {\n tempBuffer.set(segment, offset);\n offset += segment.byteLength;\n });\n }\n return tempBuffer;\n};\n\n/**\n * @file text-tracks.js\n */\n/**\n * Create captions text tracks on video.js if they do not exist\n *\n * @param {Object} inbandTextTracks a reference to current inbandTextTracks\n * @param {Object} tech the video.js tech\n * @param {Object} captionStream the caption stream to create\n * @private\n */\n\nconst createCaptionsTrackIfNotExists = function (inbandTextTracks, tech, captionStream) {\n if (!inbandTextTracks[captionStream]) {\n tech.trigger({\n type: 'usage',\n name: 'vhs-608'\n });\n let instreamId = captionStream; // we need to translate SERVICEn for 708 to how mux.js currently labels them\n\n if (/^cc708_/.test(captionStream)) {\n instreamId = 'SERVICE' + captionStream.split('_')[1];\n }\n const track = tech.textTracks().getTrackById(instreamId);\n if (track) {\n // Resuse an existing track with a CC# id because this was\n // very likely created by videojs-contrib-hls from information\n // in the m3u8 for us to use\n inbandTextTracks[captionStream] = track;\n } else {\n // This section gets called when we have caption services that aren't specified in the manifest.\n // Manifest level caption services are handled in media-groups.js under CLOSED-CAPTIONS.\n const captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};\n let label = captionStream;\n let language = captionStream;\n let def = false;\n const captionService = captionServices[instreamId];\n if (captionService) {\n label = captionService.label;\n language = captionService.language;\n def = captionService.default;\n } // Otherwise, create a track with the default `CC#` label and\n // without a language\n\n inbandTextTracks[captionStream] = tech.addRemoteTextTrack({\n kind: 'captions',\n id: instreamId,\n // TODO: investigate why this doesn't seem to turn the caption on by default\n default: def,\n label,\n language\n }, false).track;\n }\n }\n};\n/**\n * Add caption text track data to a source handler given an array of captions\n *\n * @param {Object}\n * @param {Object} inbandTextTracks the inband text tracks\n * @param {number} timestampOffset the timestamp offset of the source buffer\n * @param {Array} captionArray an array of caption data\n * @private\n */\n\nconst addCaptionData = function ({\n inbandTextTracks,\n captionArray,\n timestampOffset\n}) {\n if (!captionArray) {\n return;\n }\n const Cue = (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebKitDataCue) || (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue);\n captionArray.forEach(caption => {\n const track = caption.stream; // in CEA 608 captions, video.js/mux.js sends a content array\n // with positioning data\n\n if (caption.content) {\n caption.content.forEach(value => {\n const cue = new Cue(caption.startTime + timestampOffset, caption.endTime + timestampOffset, value.text);\n cue.line = value.line;\n cue.align = 'left';\n cue.position = value.position;\n cue.positionAlign = 'line-left';\n inbandTextTracks[track].addCue(cue);\n });\n } else {\n // otherwise, a text value with combined captions is sent\n inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset, caption.endTime + timestampOffset, caption.text));\n }\n });\n};\n/**\n * Define properties on a cue for backwards compatability,\n * but warn the user that the way that they are using it\n * is depricated and will be removed at a later date.\n *\n * @param {Cue} cue the cue to add the properties on\n * @private\n */\n\nconst deprecateOldCue = function (cue) {\n Object.defineProperties(cue.frame, {\n id: {\n get() {\n videojs.log.warn('cue.frame.id is deprecated. Use cue.value.key instead.');\n return cue.value.key;\n }\n },\n value: {\n get() {\n videojs.log.warn('cue.frame.value is deprecated. Use cue.value.data instead.');\n return cue.value.data;\n }\n },\n privateData: {\n get() {\n videojs.log.warn('cue.frame.privateData is deprecated. Use cue.value.data instead.');\n return cue.value.data;\n }\n }\n });\n};\n/**\n * Add metadata text track data to a source handler given an array of metadata\n *\n * @param {Object}\n * @param {Object} inbandTextTracks the inband text tracks\n * @param {Array} metadataArray an array of meta data\n * @param {number} timestampOffset the timestamp offset of the source buffer\n * @param {number} videoDuration the duration of the video\n * @private\n */\n\nconst addMetadata = ({\n inbandTextTracks,\n metadataArray,\n timestampOffset,\n videoDuration\n}) => {\n if (!metadataArray) {\n return;\n }\n const Cue = (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebKitDataCue) || (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue);\n const metadataTrack = inbandTextTracks.metadataTrack_;\n if (!metadataTrack) {\n return;\n }\n metadataArray.forEach(metadata => {\n const time = metadata.cueTime + timestampOffset; // if time isn't a finite number between 0 and Infinity, like NaN,\n // ignore this bit of metadata.\n // This likely occurs when you have an non-timed ID3 tag like TIT2,\n // which is the \"Title/Songname/Content description\" frame\n\n if (typeof time !== 'number' || global_window__WEBPACK_IMPORTED_MODULE_0___default().isNaN(time) || time < 0 || !(time < Infinity)) {\n return;\n } // If we have no frames, we can't create a cue.\n\n if (!metadata.frames || !metadata.frames.length) {\n return;\n }\n metadata.frames.forEach(frame => {\n const cue = new Cue(time, time, frame.value || frame.url || frame.data || '');\n cue.frame = frame;\n cue.value = frame;\n deprecateOldCue(cue);\n metadataTrack.addCue(cue);\n });\n });\n if (!metadataTrack.cues || !metadataTrack.cues.length) {\n return;\n } // Updating the metadeta cues so that\n // the endTime of each cue is the startTime of the next cue\n // the endTime of last cue is the duration of the video\n\n const cues = metadataTrack.cues;\n const cuesArray = []; // Create a copy of the TextTrackCueList...\n // ...disregarding cues with a falsey value\n\n for (let i = 0; i < cues.length; i++) {\n if (cues[i]) {\n cuesArray.push(cues[i]);\n }\n } // Group cues by their startTime value\n\n const cuesGroupedByStartTime = cuesArray.reduce((obj, cue) => {\n const timeSlot = obj[cue.startTime] || [];\n timeSlot.push(cue);\n obj[cue.startTime] = timeSlot;\n return obj;\n }, {}); // Sort startTimes by ascending order\n\n const sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort((a, b) => Number(a) - Number(b)); // Map each cue group's endTime to the next group's startTime\n\n sortedStartTimes.forEach((startTime, idx) => {\n const cueGroup = cuesGroupedByStartTime[startTime];\n const finiteDuration = isFinite(videoDuration) ? videoDuration : startTime;\n const nextTime = Number(sortedStartTimes[idx + 1]) || finiteDuration; // Map each cue's endTime the next group's startTime\n\n cueGroup.forEach(cue => {\n cue.endTime = nextTime;\n });\n });\n}; // object for mapping daterange attributes\n\nconst dateRangeAttr = {\n id: 'ID',\n class: 'CLASS',\n startDate: 'START-DATE',\n duration: 'DURATION',\n endDate: 'END-DATE',\n endOnNext: 'END-ON-NEXT',\n plannedDuration: 'PLANNED-DURATION',\n scte35Out: 'SCTE35-OUT',\n scte35In: 'SCTE35-IN'\n};\nconst dateRangeKeysToOmit = new Set(['id', 'class', 'startDate', 'duration', 'endDate', 'endOnNext', 'startTime', 'endTime', 'processDateRange']);\n/**\n * Add DateRange metadata text track to a source handler given an array of metadata\n *\n * @param {Object}\n * @param {Object} inbandTextTracks the inband text tracks\n * @param {Array} dateRanges parsed media playlist\n * @private\n */\n\nconst addDateRangeMetadata = ({\n inbandTextTracks,\n dateRanges\n}) => {\n const metadataTrack = inbandTextTracks.metadataTrack_;\n if (!metadataTrack) {\n return;\n }\n const Cue = (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebKitDataCue) || (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue);\n dateRanges.forEach(dateRange => {\n // we generate multiple cues for each date range with different attributes\n for (const key of Object.keys(dateRange)) {\n if (dateRangeKeysToOmit.has(key)) {\n continue;\n }\n const cue = new Cue(dateRange.startTime, dateRange.endTime, '');\n cue.id = dateRange.id;\n cue.type = 'com.apple.quicktime.HLS';\n cue.value = {\n key: dateRangeAttr[key],\n data: dateRange[key]\n };\n if (key === 'scte35Out' || key === 'scte35In') {\n cue.value.data = new Uint8Array(cue.value.data.match(/[\\da-f]{2}/gi)).buffer;\n }\n metadataTrack.addCue(cue);\n }\n dateRange.processDateRange();\n });\n};\n/**\n * Create metadata text track on video.js if it does not exist\n *\n * @param {Object} inbandTextTracks a reference to current inbandTextTracks\n * @param {string} dispatchType the inband metadata track dispatch type\n * @param {Object} tech the video.js tech\n * @private\n */\n\nconst createMetadataTrackIfNotExists = (inbandTextTracks, dispatchType, tech) => {\n if (inbandTextTracks.metadataTrack_) {\n return;\n }\n inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({\n kind: 'metadata',\n label: 'Timed Metadata'\n }, false).track;\n if (!videojs.browser.IS_ANY_SAFARI) {\n inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType;\n }\n};\n/**\n * Remove cues from a track on video.js.\n *\n * @param {Double} start start of where we should remove the cue\n * @param {Double} end end of where the we should remove the cue\n * @param {Object} track the text track to remove the cues from\n * @private\n */\n\nconst removeCuesFromTrack = function (start, end, track) {\n let i;\n let cue;\n if (!track) {\n return;\n }\n if (!track.cues) {\n return;\n }\n i = track.cues.length;\n while (i--) {\n cue = track.cues[i]; // Remove any cue within the provided start and end time\n\n if (cue.startTime >= start && cue.endTime <= end) {\n track.removeCue(cue);\n }\n }\n};\n/**\n * Remove duplicate cues from a track on video.js (a cue is considered a\n * duplicate if it has the same time interval and text as another)\n *\n * @param {Object} track the text track to remove the duplicate cues from\n * @private\n */\n\nconst removeDuplicateCuesFromTrack = function (track) {\n const cues = track.cues;\n if (!cues) {\n return;\n }\n const uniqueCues = {};\n for (let i = cues.length - 1; i >= 0; i--) {\n const cue = cues[i];\n const cueKey = `${cue.startTime}-${cue.endTime}-${cue.text}`;\n if (uniqueCues[cueKey]) {\n track.removeCue(cue);\n } else {\n uniqueCues[cueKey] = cue;\n }\n }\n};\n\n/**\n * Returns a list of gops in the buffer that have a pts value of 3 seconds or more in\n * front of current time.\n *\n * @param {Array} buffer\n * The current buffer of gop information\n * @param {number} currentTime\n * The current time\n * @param {Double} mapping\n * Offset to map display time to stream presentation time\n * @return {Array}\n * List of gops considered safe to append over\n */\n\nconst gopsSafeToAlignWith = (buffer, currentTime, mapping) => {\n if (typeof currentTime === 'undefined' || currentTime === null || !buffer.length) {\n return [];\n } // pts value for current time + 3 seconds to give a bit more wiggle room\n\n const currentTimePts = Math.ceil((currentTime - mapping + 3) * mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_16__.ONE_SECOND_IN_TS);\n let i;\n for (i = 0; i < buffer.length; i++) {\n if (buffer[i].pts > currentTimePts) {\n break;\n }\n }\n return buffer.slice(i);\n};\n/**\n * Appends gop information (timing and byteLength) received by the transmuxer for the\n * gops appended in the last call to appendBuffer\n *\n * @param {Array} buffer\n * The current buffer of gop information\n * @param {Array} gops\n * List of new gop information\n * @param {boolean} replace\n * If true, replace the buffer with the new gop information. If false, append the\n * new gop information to the buffer in the right location of time.\n * @return {Array}\n * Updated list of gop information\n */\n\nconst updateGopBuffer = (buffer, gops, replace) => {\n if (!gops.length) {\n return buffer;\n }\n if (replace) {\n // If we are in safe append mode, then completely overwrite the gop buffer\n // with the most recent appeneded data. This will make sure that when appending\n // future segments, we only try to align with gops that are both ahead of current\n // time and in the last segment appended.\n return gops.slice();\n }\n const start = gops[0].pts;\n let i = 0;\n for (i; i < buffer.length; i++) {\n if (buffer[i].pts >= start) {\n break;\n }\n }\n return buffer.slice(0, i).concat(gops);\n};\n/**\n * Removes gop information in buffer that overlaps with provided start and end\n *\n * @param {Array} buffer\n * The current buffer of gop information\n * @param {Double} start\n * position to start the remove at\n * @param {Double} end\n * position to end the remove at\n * @param {Double} mapping\n * Offset to map display time to stream presentation time\n */\n\nconst removeGopBuffer = (buffer, start, end, mapping) => {\n const startPts = Math.ceil((start - mapping) * mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_16__.ONE_SECOND_IN_TS);\n const endPts = Math.ceil((end - mapping) * mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_16__.ONE_SECOND_IN_TS);\n const updatedBuffer = buffer.slice();\n let i = buffer.length;\n while (i--) {\n if (buffer[i].pts <= endPts) {\n break;\n }\n }\n if (i === -1) {\n // no removal because end of remove range is before start of buffer\n return updatedBuffer;\n }\n let j = i + 1;\n while (j--) {\n if (buffer[j].pts <= startPts) {\n break;\n }\n } // clamp remove range start to 0 index\n\n j = Math.max(j, 0);\n updatedBuffer.splice(j, i - j + 1);\n return updatedBuffer;\n};\nconst shallowEqual = function (a, b) {\n // if both are undefined\n // or one or the other is undefined\n // they are not equal\n if (!a && !b || !a && b || a && !b) {\n return false;\n } // they are the same object and thus, equal\n\n if (a === b) {\n return true;\n } // sort keys so we can make sure they have\n // all the same keys later.\n\n const akeys = Object.keys(a).sort();\n const bkeys = Object.keys(b).sort(); // different number of keys, not equal\n\n if (akeys.length !== bkeys.length) {\n return false;\n }\n for (let i = 0; i < akeys.length; i++) {\n const key = akeys[i]; // different sorted keys, not equal\n\n if (key !== bkeys[i]) {\n return false;\n } // different values, not equal\n\n if (a[key] !== b[key]) {\n return false;\n }\n }\n return true;\n};\n\n// https://www.w3.org/TR/WebIDL-1/#quotaexceedederror\nconst QUOTA_EXCEEDED_ERR = 22;\n\n/**\n * The segment loader has no recourse except to fetch a segment in the\n * current playlist and use the internal timestamps in that segment to\n * generate a syncPoint. This function returns a good candidate index\n * for that process.\n *\n * @param {Array} segments - the segments array from a playlist.\n * @return {number} An index of a segment from the playlist to load\n */\n\nconst getSyncSegmentCandidate = function (currentTimeline, segments, targetTime) {\n segments = segments || [];\n const timelineSegments = [];\n let time = 0;\n for (let i = 0; i < segments.length; i++) {\n const segment = segments[i];\n if (currentTimeline === segment.timeline) {\n timelineSegments.push(i);\n time += segment.duration;\n if (time > targetTime) {\n return i;\n }\n }\n }\n if (timelineSegments.length === 0) {\n return 0;\n } // default to the last timeline segment\n\n return timelineSegments[timelineSegments.length - 1];\n}; // In the event of a quota exceeded error, keep at least one second of back buffer. This\n// number was arbitrarily chosen and may be updated in the future, but seemed reasonable\n// as a start to prevent any potential issues with removing content too close to the\n// playhead.\n\nconst MIN_BACK_BUFFER = 1; // in ms\n\nconst CHECK_BUFFER_DELAY = 500;\nconst finite = num => typeof num === 'number' && isFinite(num); // With most content hovering around 30fps, if a segment has a duration less than a half\n// frame at 30fps or one frame at 60fps, the bandwidth and throughput calculations will\n// not accurately reflect the rest of the content.\n\nconst MIN_SEGMENT_DURATION_TO_SAVE_STATS = 1 / 60;\nconst illegalMediaSwitch = (loaderType, startingMedia, trackInfo) => {\n // Although these checks should most likely cover non 'main' types, for now it narrows\n // the scope of our checks.\n if (loaderType !== 'main' || !startingMedia || !trackInfo) {\n return null;\n }\n if (!trackInfo.hasAudio && !trackInfo.hasVideo) {\n return 'Neither audio nor video found in segment.';\n }\n if (startingMedia.hasVideo && !trackInfo.hasVideo) {\n return '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.';\n }\n if (!startingMedia.hasVideo && trackInfo.hasVideo) {\n return '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.';\n }\n return null;\n};\n/**\n * Calculates a time value that is safe to remove from the back buffer without interrupting\n * playback.\n *\n * @param {TimeRange} seekable\n * The current seekable range\n * @param {number} currentTime\n * The current time of the player\n * @param {number} targetDuration\n * The target duration of the current playlist\n * @return {number}\n * Time that is safe to remove from the back buffer without interrupting playback\n */\n\nconst safeBackBufferTrimTime = (seekable, currentTime, targetDuration) => {\n // 30 seconds before the playhead provides a safe default for trimming.\n //\n // Choosing a reasonable default is particularly important for high bitrate content and\n // VOD videos/live streams with large windows, as the buffer may end up overfilled and\n // throw an APPEND_BUFFER_ERR.\n let trimTime = currentTime - Config.BACK_BUFFER_LENGTH;\n if (seekable.length) {\n // Some live playlists may have a shorter window of content than the full allowed back\n // buffer. For these playlists, don't save content that's no longer within the window.\n trimTime = Math.max(trimTime, seekable.start(0));\n } // Don't remove within target duration of the current time to avoid the possibility of\n // removing the GOP currently being played, as removing it can cause playback stalls.\n\n const maxTrimTime = currentTime - targetDuration;\n return Math.min(maxTrimTime, trimTime);\n};\nconst segmentInfoString = segmentInfo => {\n const {\n startOfSegment,\n duration,\n segment,\n part,\n playlist: {\n mediaSequence: seq,\n id,\n segments = []\n },\n mediaIndex: index,\n partIndex,\n timeline\n } = segmentInfo;\n const segmentLen = segments.length - 1;\n let selection = 'mediaIndex/partIndex increment';\n if (segmentInfo.getMediaInfoForTime) {\n selection = `getMediaInfoForTime (${segmentInfo.getMediaInfoForTime})`;\n } else if (segmentInfo.isSyncRequest) {\n selection = 'getSyncSegmentCandidate (isSyncRequest)';\n }\n if (segmentInfo.independent) {\n selection += ` with independent ${segmentInfo.independent}`;\n }\n const hasPartIndex = typeof partIndex === 'number';\n const name = segmentInfo.segment.uri ? 'segment' : 'pre-segment';\n const zeroBasedPartCount = hasPartIndex ? getKnownPartCount({\n preloadSegment: segment\n }) - 1 : 0;\n return `${name} [${seq + index}/${seq + segmentLen}]` + (hasPartIndex ? ` part [${partIndex}/${zeroBasedPartCount}]` : '') + ` segment start/end [${segment.start} => ${segment.end}]` + (hasPartIndex ? ` part start/end [${part.start} => ${part.end}]` : '') + ` startOfSegment [${startOfSegment}]` + ` duration [${duration}]` + ` timeline [${timeline}]` + ` selected by [${selection}]` + ` playlist [${id}]`;\n};\nconst timingInfoPropertyForMedia = mediaType => `${mediaType}TimingInfo`;\n/**\n * Returns the timestamp offset to use for the segment.\n *\n * @param {number} segmentTimeline\n * The timeline of the segment\n * @param {number} currentTimeline\n * The timeline currently being followed by the loader\n * @param {number} startOfSegment\n * The estimated segment start\n * @param {TimeRange[]} buffered\n * The loader's buffer\n * @param {boolean} overrideCheck\n * If true, no checks are made to see if the timestamp offset value should be set,\n * but sets it directly to a value.\n *\n * @return {number|null}\n * Either a number representing a new timestamp offset, or null if the segment is\n * part of the same timeline\n */\n\nconst timestampOffsetForSegment = ({\n segmentTimeline,\n currentTimeline,\n startOfSegment,\n buffered,\n overrideCheck\n}) => {\n // Check to see if we are crossing a discontinuity to see if we need to set the\n // timestamp offset on the transmuxer and source buffer.\n //\n // Previously, we changed the timestampOffset if the start of this segment was less than\n // the currently set timestampOffset, but this isn't desirable as it can produce bad\n // behavior, especially around long running live streams.\n if (!overrideCheck && segmentTimeline === currentTimeline) {\n return null;\n } // When changing renditions, it's possible to request a segment on an older timeline. For\n // instance, given two renditions with the following:\n //\n // #EXTINF:10\n // segment1\n // #EXT-X-DISCONTINUITY\n // #EXTINF:10\n // segment2\n // #EXTINF:10\n // segment3\n //\n // And the current player state:\n //\n // current time: 8\n // buffer: 0 => 20\n //\n // The next segment on the current rendition would be segment3, filling the buffer from\n // 20s onwards. However, if a rendition switch happens after segment2 was requested,\n // then the next segment to be requested will be segment1 from the new rendition in\n // order to fill time 8 and onwards. Using the buffered end would result in repeated\n // content (since it would position segment1 of the new rendition starting at 20s). This\n // case can be identified when the new segment's timeline is a prior value. Instead of\n // using the buffered end, the startOfSegment can be used, which, hopefully, will be\n // more accurate to the actual start time of the segment.\n\n if (segmentTimeline < currentTimeline) {\n return startOfSegment;\n } // segmentInfo.startOfSegment used to be used as the timestamp offset, however, that\n // value uses the end of the last segment if it is available. While this value\n // should often be correct, it's better to rely on the buffered end, as the new\n // content post discontinuity should line up with the buffered end as if it were\n // time 0 for the new content.\n\n return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment;\n};\n/**\n * Returns whether or not the loader should wait for a timeline change from the timeline\n * change controller before processing the segment.\n *\n * Primary timing in VHS goes by video. This is different from most media players, as\n * audio is more often used as the primary timing source. For the foreseeable future, VHS\n * will continue to use video as the primary timing source, due to the current logic and\n * expectations built around it.\n\n * Since the timing follows video, in order to maintain sync, the video loader is\n * responsible for setting both audio and video source buffer timestamp offsets.\n *\n * Setting different values for audio and video source buffers could lead to\n * desyncing. The following examples demonstrate some of the situations where this\n * distinction is important. Note that all of these cases involve demuxed content. When\n * content is muxed, the audio and video are packaged together, therefore syncing\n * separate media playlists is not an issue.\n *\n * CASE 1: Audio prepares to load a new timeline before video:\n *\n * Timeline: 0 1\n * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Audio Loader: ^\n * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Video Loader ^\n *\n * In the above example, the audio loader is preparing to load the 6th segment, the first\n * after a discontinuity, while the video loader is still loading the 5th segment, before\n * the discontinuity.\n *\n * If the audio loader goes ahead and loads and appends the 6th segment before the video\n * loader crosses the discontinuity, then when appended, the 6th audio segment will use\n * the timestamp offset from timeline 0. This will likely lead to desyncing. In addition,\n * the audio loader must provide the audioAppendStart value to trim the content in the\n * transmuxer, and that value relies on the audio timestamp offset. Since the audio\n * timestamp offset is set by the video (main) loader, the audio loader shouldn't load the\n * segment until that value is provided.\n *\n * CASE 2: Video prepares to load a new timeline before audio:\n *\n * Timeline: 0 1\n * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Audio Loader: ^\n * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Video Loader ^\n *\n * In the above example, the video loader is preparing to load the 6th segment, the first\n * after a discontinuity, while the audio loader is still loading the 5th segment, before\n * the discontinuity.\n *\n * If the video loader goes ahead and loads and appends the 6th segment, then once the\n * segment is loaded and processed, both the video and audio timestamp offsets will be\n * set, since video is used as the primary timing source. This is to ensure content lines\n * up appropriately, as any modifications to the video timing are reflected by audio when\n * the video loader sets the audio and video timestamp offsets to the same value. However,\n * setting the timestamp offset for audio before audio has had a chance to change\n * timelines will likely lead to desyncing, as the audio loader will append segment 5 with\n * a timestamp intended to apply to segments from timeline 1 rather than timeline 0.\n *\n * CASE 3: When seeking, audio prepares to load a new timeline before video\n *\n * Timeline: 0 1\n * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Audio Loader: ^\n * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Video Loader ^\n *\n * In the above example, both audio and video loaders are loading segments from timeline\n * 0, but imagine that the seek originated from timeline 1.\n *\n * When seeking to a new timeline, the timestamp offset will be set based on the expected\n * segment start of the loaded video segment. In order to maintain sync, the audio loader\n * must wait for the video loader to load its segment and update both the audio and video\n * timestamp offsets before it may load and append its own segment. This is the case\n * whether the seek results in a mismatched segment request (e.g., the audio loader\n * chooses to load segment 3 and the video loader chooses to load segment 4) or the\n * loaders choose to load the same segment index from each playlist, as the segments may\n * not be aligned perfectly, even for matching segment indexes.\n *\n * @param {Object} timelinechangeController\n * @param {number} currentTimeline\n * The timeline currently being followed by the loader\n * @param {number} segmentTimeline\n * The timeline of the segment being loaded\n * @param {('main'|'audio')} loaderType\n * The loader type\n * @param {boolean} audioDisabled\n * Whether the audio is disabled for the loader. This should only be true when the\n * loader may have muxed audio in its segment, but should not append it, e.g., for\n * the main loader when an alternate audio playlist is active.\n *\n * @return {boolean}\n * Whether the loader should wait for a timeline change from the timeline change\n * controller before processing the segment\n */\n\nconst shouldWaitForTimelineChange = ({\n timelineChangeController,\n currentTimeline,\n segmentTimeline,\n loaderType,\n audioDisabled\n}) => {\n if (currentTimeline === segmentTimeline) {\n return false;\n }\n if (loaderType === 'audio') {\n const lastMainTimelineChange = timelineChangeController.lastTimelineChange({\n type: 'main'\n }); // Audio loader should wait if:\n //\n // * main hasn't had a timeline change yet (thus has not loaded its first segment)\n // * main hasn't yet changed to the timeline audio is looking to load\n\n return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline;\n } // The main loader only needs to wait for timeline changes if there's demuxed audio.\n // Otherwise, there's nothing to wait for, since audio would be muxed into the main\n // loader's segments (or the content is audio/video only and handled by the main\n // loader).\n\n if (loaderType === 'main' && audioDisabled) {\n const pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({\n type: 'audio'\n }); // Main loader should wait for the audio loader if audio is not pending a timeline\n // change to the current timeline.\n //\n // Since the main loader is responsible for setting the timestamp offset for both\n // audio and video, the main loader must wait for audio to be about to change to its\n // timeline before setting the offset, otherwise, if audio is behind in loading,\n // segments from the previous timeline would be adjusted by the new timestamp offset.\n //\n // This requirement means that video will not cross a timeline until the audio is\n // about to cross to it, so that way audio and video will always cross the timeline\n // together.\n //\n // In addition to normal timeline changes, these rules also apply to the start of a\n // stream (going from a non-existent timeline, -1, to timeline 0). It's important\n // that these rules apply to the first timeline change because if they did not, it's\n // possible that the main loader will cross two timelines before the audio loader has\n // crossed one. Logic may be implemented to handle the startup as a special case, but\n // it's easier to simply treat all timeline changes the same.\n\n if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) {\n return false;\n }\n return true;\n }\n return false;\n};\nconst mediaDuration = timingInfos => {\n let maxDuration = 0;\n ['video', 'audio'].forEach(function (type) {\n const typeTimingInfo = timingInfos[`${type}TimingInfo`];\n if (!typeTimingInfo) {\n return;\n }\n const {\n start,\n end\n } = typeTimingInfo;\n let duration;\n if (typeof start === 'bigint' || typeof end === 'bigint') {\n duration = global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt(end) - global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt(start);\n } else if (typeof start === 'number' && typeof end === 'number') {\n duration = end - start;\n }\n if (typeof duration !== 'undefined' && duration > maxDuration) {\n maxDuration = duration;\n }\n }); // convert back to a number if it is lower than MAX_SAFE_INTEGER\n // as we only need BigInt when we are above that.\n\n if (typeof maxDuration === 'bigint' && maxDuration < Number.MAX_SAFE_INTEGER) {\n maxDuration = Number(maxDuration);\n }\n return maxDuration;\n};\nconst segmentTooLong = ({\n segmentDuration,\n maxDuration\n}) => {\n // 0 duration segments are most likely due to metadata only segments or a lack of\n // information.\n if (!segmentDuration) {\n return false;\n } // For HLS:\n //\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1\n // The EXTINF duration of each Media Segment in the Playlist\n // file, when rounded to the nearest integer, MUST be less than or equal\n // to the target duration; longer segments can trigger playback stalls\n // or other errors.\n //\n // For DASH, the mpd-parser uses the largest reported segment duration as the target\n // duration. Although that reported duration is occasionally approximate (i.e., not\n // exact), a strict check may report that a segment is too long more often in DASH.\n\n return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR;\n};\nconst getTroublesomeSegmentDurationMessage = (segmentInfo, sourceType) => {\n // Right now we aren't following DASH's timing model exactly, so only perform\n // this check for HLS content.\n if (sourceType !== 'hls') {\n return null;\n }\n const segmentDuration = mediaDuration({\n audioTimingInfo: segmentInfo.audioTimingInfo,\n videoTimingInfo: segmentInfo.videoTimingInfo\n }); // Don't report if we lack information.\n //\n // If the segment has a duration of 0 it is either a lack of information or a\n // metadata only segment and shouldn't be reported here.\n\n if (!segmentDuration) {\n return null;\n }\n const targetDuration = segmentInfo.playlist.targetDuration;\n const isSegmentWayTooLong = segmentTooLong({\n segmentDuration,\n maxDuration: targetDuration * 2\n });\n const isSegmentSlightlyTooLong = segmentTooLong({\n segmentDuration,\n maxDuration: targetDuration\n });\n const segmentTooLongMessage = `Segment with index ${segmentInfo.mediaIndex} ` + `from playlist ${segmentInfo.playlist.id} ` + `has a duration of ${segmentDuration} ` + `when the reported duration is ${segmentInfo.duration} ` + `and the target duration is ${targetDuration}. ` + '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';\n if (isSegmentWayTooLong || isSegmentSlightlyTooLong) {\n return {\n severity: isSegmentWayTooLong ? 'warn' : 'info',\n message: segmentTooLongMessage\n };\n }\n return null;\n};\n/**\n * An object that manages segment loading and appending.\n *\n * @class SegmentLoader\n * @param {Object} options required and optional options\n * @extends videojs.EventTarget\n */\n\nclass SegmentLoader extends videojs.EventTarget {\n constructor(settings, options = {}) {\n super(); // check pre-conditions\n\n if (!settings) {\n throw new TypeError('Initialization settings are required');\n }\n if (typeof settings.currentTime !== 'function') {\n throw new TypeError('No currentTime getter specified');\n }\n if (!settings.mediaSource) {\n throw new TypeError('No MediaSource specified');\n } // public properties\n\n this.bandwidth = settings.bandwidth;\n this.throughput = {\n rate: 0,\n count: 0\n };\n this.roundTrip = NaN;\n this.resetStats_();\n this.mediaIndex = null;\n this.partIndex = null; // private settings\n\n this.hasPlayed_ = settings.hasPlayed;\n this.currentTime_ = settings.currentTime;\n this.seekable_ = settings.seekable;\n this.seeking_ = settings.seeking;\n this.duration_ = settings.duration;\n this.mediaSource_ = settings.mediaSource;\n this.vhs_ = settings.vhs;\n this.loaderType_ = settings.loaderType;\n this.currentMediaInfo_ = void 0;\n this.startingMediaInfo_ = void 0;\n this.segmentMetadataTrack_ = settings.segmentMetadataTrack;\n this.goalBufferLength_ = settings.goalBufferLength;\n this.sourceType_ = settings.sourceType;\n this.sourceUpdater_ = settings.sourceUpdater;\n this.inbandTextTracks_ = settings.inbandTextTracks;\n this.state_ = 'INIT';\n this.timelineChangeController_ = settings.timelineChangeController;\n this.shouldSaveSegmentTimingInfo_ = true;\n this.parse708captions_ = settings.parse708captions;\n this.useDtsForTimestampOffset_ = settings.useDtsForTimestampOffset;\n this.captionServices_ = settings.captionServices;\n this.exactManifestTimings = settings.exactManifestTimings;\n this.addMetadataToTextTrack = settings.addMetadataToTextTrack; // private instance variables\n\n this.checkBufferTimeout_ = null;\n this.error_ = void 0;\n this.currentTimeline_ = -1;\n this.shouldForceTimestampOffsetAfterResync_ = false;\n this.pendingSegment_ = null;\n this.xhrOptions_ = null;\n this.pendingSegments_ = [];\n this.audioDisabled_ = false;\n this.isPendingTimestampOffset_ = false; // TODO possibly move gopBuffer and timeMapping info to a separate controller\n\n this.gopBuffer_ = [];\n this.timeMapping_ = 0;\n this.safeAppend_ = false;\n this.appendInitSegment_ = {\n audio: true,\n video: true\n };\n this.playlistOfLastInitSegment_ = {\n audio: null,\n video: null\n };\n this.callQueue_ = []; // If the segment loader prepares to load a segment, but does not have enough\n // information yet to start the loading process (e.g., if the audio loader wants to\n // load a segment from the next timeline but the main loader hasn't yet crossed that\n // timeline), then the load call will be added to the queue until it is ready to be\n // processed.\n\n this.loadQueue_ = [];\n this.metadataQueue_ = {\n id3: [],\n caption: []\n };\n this.waitingOnRemove_ = false;\n this.quotaExceededErrorRetryTimeout_ = null; // Fragmented mp4 playback\n\n this.activeInitSegmentId_ = null;\n this.initSegments_ = {}; // HLSe playback\n\n this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys;\n this.keyCache_ = {};\n this.decrypter_ = settings.decrypter; // Manages the tracking and generation of sync-points, mappings\n // between a time in the display time and a segment index within\n // a playlist\n\n this.syncController_ = settings.syncController;\n this.syncPoint_ = {\n segmentIndex: 0,\n time: 0\n };\n this.transmuxer_ = this.createTransmuxer_();\n this.triggerSyncInfoUpdate_ = () => this.trigger('syncinfoupdate');\n this.syncController_.on('syncinfoupdate', this.triggerSyncInfoUpdate_);\n this.mediaSource_.addEventListener('sourceopen', () => {\n if (!this.isEndOfStream_()) {\n this.ended_ = false;\n }\n }); // ...for determining the fetch location\n\n this.fetchAtBuffer_ = false;\n this.logger_ = logger(`SegmentLoader[${this.loaderType_}]`);\n Object.defineProperty(this, 'state', {\n get() {\n return this.state_;\n },\n set(newState) {\n if (newState !== this.state_) {\n this.logger_(`${this.state_} -> ${newState}`);\n this.state_ = newState;\n this.trigger('statechange');\n }\n }\n });\n this.sourceUpdater_.on('ready', () => {\n if (this.hasEnoughInfoToAppend_()) {\n this.processCallQueue_();\n }\n }); // Only the main loader needs to listen for pending timeline changes, as the main\n // loader should wait for audio to be ready to change its timeline so that both main\n // and audio timelines change together. For more details, see the\n // shouldWaitForTimelineChange function.\n\n if (this.loaderType_ === 'main') {\n this.timelineChangeController_.on('pendingtimelinechange', () => {\n if (this.hasEnoughInfoToAppend_()) {\n this.processCallQueue_();\n }\n });\n } // The main loader only listens on pending timeline changes, but the audio loader,\n // since its loads follow main, needs to listen on timeline changes. For more details,\n // see the shouldWaitForTimelineChange function.\n\n if (this.loaderType_ === 'audio') {\n this.timelineChangeController_.on('timelinechange', () => {\n if (this.hasEnoughInfoToLoad_()) {\n this.processLoadQueue_();\n }\n if (this.hasEnoughInfoToAppend_()) {\n this.processCallQueue_();\n }\n });\n }\n }\n createTransmuxer_() {\n return segmentTransmuxer.createTransmuxer({\n remux: false,\n alignGopsAtEnd: this.safeAppend_,\n keepOriginalTimestamps: true,\n parse708captions: this.parse708captions_,\n captionServices: this.captionServices_\n });\n }\n /**\n * reset all of our media stats\n *\n * @private\n */\n\n resetStats_() {\n this.mediaBytesTransferred = 0;\n this.mediaRequests = 0;\n this.mediaRequestsAborted = 0;\n this.mediaRequestsTimedout = 0;\n this.mediaRequestsErrored = 0;\n this.mediaTransferDuration = 0;\n this.mediaSecondsLoaded = 0;\n this.mediaAppends = 0;\n }\n /**\n * dispose of the SegmentLoader and reset to the default state\n */\n\n dispose() {\n this.trigger('dispose');\n this.state = 'DISPOSED';\n this.pause();\n this.abort_();\n if (this.transmuxer_) {\n this.transmuxer_.terminate();\n }\n this.resetStats_();\n if (this.checkBufferTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.checkBufferTimeout_);\n }\n if (this.syncController_ && this.triggerSyncInfoUpdate_) {\n this.syncController_.off('syncinfoupdate', this.triggerSyncInfoUpdate_);\n }\n this.off();\n }\n setAudio(enable) {\n this.audioDisabled_ = !enable;\n if (enable) {\n this.appendInitSegment_.audio = true;\n } else {\n // remove current track audio if it gets disabled\n this.sourceUpdater_.removeAudio(0, this.duration_());\n }\n }\n /**\n * abort anything that is currently doing on with the SegmentLoader\n * and reset to a default state\n */\n\n abort() {\n if (this.state !== 'WAITING') {\n if (this.pendingSegment_) {\n this.pendingSegment_ = null;\n }\n return;\n }\n this.abort_(); // We aborted the requests we were waiting on, so reset the loader's state to READY\n // since we are no longer \"waiting\" on any requests. XHR callback is not always run\n // when the request is aborted. This will prevent the loader from being stuck in the\n // WAITING state indefinitely.\n\n this.state = 'READY'; // don't wait for buffer check timeouts to begin fetching the\n // next segment\n\n if (!this.paused()) {\n this.monitorBuffer_();\n }\n }\n /**\n * abort all pending xhr requests and null any pending segements\n *\n * @private\n */\n\n abort_() {\n if (this.pendingSegment_ && this.pendingSegment_.abortRequests) {\n this.pendingSegment_.abortRequests();\n } // clear out the segment being processed\n\n this.pendingSegment_ = null;\n this.callQueue_ = [];\n this.loadQueue_ = [];\n this.metadataQueue_.id3 = [];\n this.metadataQueue_.caption = [];\n this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);\n this.waitingOnRemove_ = false;\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.quotaExceededErrorRetryTimeout_);\n this.quotaExceededErrorRetryTimeout_ = null;\n }\n checkForAbort_(requestId) {\n // If the state is APPENDING, then aborts will not modify the state, meaning the first\n // callback that happens should reset the state to READY so that loading can continue.\n if (this.state === 'APPENDING' && !this.pendingSegment_) {\n this.state = 'READY';\n return true;\n }\n if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) {\n return true;\n }\n return false;\n }\n /**\n * set an error on the segment loader and null out any pending segements\n *\n * @param {Error} error the error to set on the SegmentLoader\n * @return {Error} the error that was set or that is currently set\n */\n\n error(error) {\n if (typeof error !== 'undefined') {\n this.logger_('error occurred:', error);\n this.error_ = error;\n }\n this.pendingSegment_ = null;\n return this.error_;\n }\n endOfStream() {\n this.ended_ = true;\n if (this.transmuxer_) {\n // need to clear out any cached data to prepare for the new segment\n segmentTransmuxer.reset(this.transmuxer_);\n }\n this.gopBuffer_.length = 0;\n this.pause();\n this.trigger('ended');\n }\n /**\n * Indicates which time ranges are buffered\n *\n * @return {TimeRange}\n * TimeRange object representing the current buffered ranges\n */\n\n buffered_() {\n const trackInfo = this.getMediaInfo_();\n if (!this.sourceUpdater_ || !trackInfo) {\n return createTimeRanges();\n }\n if (this.loaderType_ === 'main') {\n const {\n hasAudio,\n hasVideo,\n isMuxed\n } = trackInfo;\n if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed) {\n return this.sourceUpdater_.buffered();\n }\n if (hasVideo) {\n return this.sourceUpdater_.videoBuffered();\n }\n } // One case that can be ignored for now is audio only with alt audio,\n // as we don't yet have proper support for that.\n\n return this.sourceUpdater_.audioBuffered();\n }\n /**\n * Gets and sets init segment for the provided map\n *\n * @param {Object} map\n * The map object representing the init segment to get or set\n * @param {boolean=} set\n * If true, the init segment for the provided map should be saved\n * @return {Object}\n * map object for desired init segment\n */\n\n initSegmentForMap(map, set = false) {\n if (!map) {\n return null;\n }\n const id = initSegmentId(map);\n let storedMap = this.initSegments_[id];\n if (set && !storedMap && map.bytes) {\n this.initSegments_[id] = storedMap = {\n resolvedUri: map.resolvedUri,\n byterange: map.byterange,\n bytes: map.bytes,\n tracks: map.tracks,\n timescales: map.timescales\n };\n }\n return storedMap || map;\n }\n /**\n * Gets and sets key for the provided key\n *\n * @param {Object} key\n * The key object representing the key to get or set\n * @param {boolean=} set\n * If true, the key for the provided key should be saved\n * @return {Object}\n * Key object for desired key\n */\n\n segmentKey(key, set = false) {\n if (!key) {\n return null;\n }\n const id = segmentKeyId(key);\n let storedKey = this.keyCache_[id]; // TODO: We should use the HTTP Expires header to invalidate our cache per\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-6.2.3\n\n if (this.cacheEncryptionKeys_ && set && !storedKey && key.bytes) {\n this.keyCache_[id] = storedKey = {\n resolvedUri: key.resolvedUri,\n bytes: key.bytes\n };\n }\n const result = {\n resolvedUri: (storedKey || key).resolvedUri\n };\n if (storedKey) {\n result.bytes = storedKey.bytes;\n }\n return result;\n }\n /**\n * Returns true if all configuration required for loading is present, otherwise false.\n *\n * @return {boolean} True if the all configuration is ready for loading\n * @private\n */\n\n couldBeginLoading_() {\n return this.playlist_ && !this.paused();\n }\n /**\n * load a playlist and start to fill the buffer\n */\n\n load() {\n // un-pause\n this.monitorBuffer_(); // if we don't have a playlist yet, keep waiting for one to be\n // specified\n\n if (!this.playlist_) {\n return;\n } // if all the configuration is ready, initialize and begin loading\n\n if (this.state === 'INIT' && this.couldBeginLoading_()) {\n return this.init_();\n } // if we're in the middle of processing a segment already, don't\n // kick off an additional segment request\n\n if (!this.couldBeginLoading_() || this.state !== 'READY' && this.state !== 'INIT') {\n return;\n }\n this.state = 'READY';\n }\n /**\n * Once all the starting parameters have been specified, begin\n * operation. This method should only be invoked from the INIT\n * state.\n *\n * @private\n */\n\n init_() {\n this.state = 'READY'; // if this is the audio segment loader, and it hasn't been inited before, then any old\n // audio data from the muxed content should be removed\n\n this.resetEverything();\n return this.monitorBuffer_();\n }\n /**\n * set a playlist on the segment loader\n *\n * @param {PlaylistLoader} media the playlist to set on the segment loader\n */\n\n playlist(newPlaylist, options = {}) {\n if (!newPlaylist) {\n return;\n }\n const oldPlaylist = this.playlist_;\n const segmentInfo = this.pendingSegment_;\n this.playlist_ = newPlaylist;\n this.xhrOptions_ = options; // when we haven't started playing yet, the start of a live playlist\n // is always our zero-time so force a sync update each time the playlist\n // is refreshed from the server\n //\n // Use the INIT state to determine if playback has started, as the playlist sync info\n // should be fixed once requests begin (as sync points are generated based on sync\n // info), but not before then.\n\n if (this.state === 'INIT') {\n newPlaylist.syncInfo = {\n mediaSequence: newPlaylist.mediaSequence,\n time: 0\n }; // Setting the date time mapping means mapping the program date time (if available)\n // to time 0 on the player's timeline. The playlist's syncInfo serves a similar\n // purpose, mapping the initial mediaSequence to time zero. Since the syncInfo can\n // be updated as the playlist is refreshed before the loader starts loading, the\n // program date time mapping needs to be updated as well.\n //\n // This mapping is only done for the main loader because a program date time should\n // map equivalently between playlists.\n\n if (this.loaderType_ === 'main') {\n this.syncController_.setDateTimeMappingForStart(newPlaylist);\n }\n }\n let oldId = null;\n if (oldPlaylist) {\n if (oldPlaylist.id) {\n oldId = oldPlaylist.id;\n } else if (oldPlaylist.uri) {\n oldId = oldPlaylist.uri;\n }\n }\n this.logger_(`playlist update [${oldId} => ${newPlaylist.id || newPlaylist.uri}]`);\n this.syncController_.updateMediaSequenceMap(newPlaylist, this.currentTime_(), this.loaderType_); // in VOD, this is always a rendition switch (or we updated our syncInfo above)\n // in LIVE, we always want to update with new playlists (including refreshes)\n\n this.trigger('syncinfoupdate'); // if we were unpaused but waiting for a playlist, start\n // buffering now\n\n if (this.state === 'INIT' && this.couldBeginLoading_()) {\n return this.init_();\n }\n if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) {\n if (this.mediaIndex !== null) {\n // we must reset/resync the segment loader when we switch renditions and\n // the segment loader is already synced to the previous rendition\n // We only want to reset the loader here for LLHLS playback, as resetLoader sets fetchAtBuffer_\n // to false, resulting in fetching segments at currentTime and causing repeated\n // same-segment requests on playlist change. This erroneously drives up the playback watcher\n // stalled segment count, as re-requesting segments at the currentTime or browser cached segments\n // will not change the buffer.\n // Reference for LLHLS fixes: https://github.com/videojs/http-streaming/pull/1201\n const isLLHLS = !newPlaylist.endList && typeof newPlaylist.partTargetDuration === 'number';\n if (isLLHLS) {\n this.resetLoader();\n } else {\n this.resyncLoader();\n }\n }\n this.currentMediaInfo_ = void 0;\n this.trigger('playlistupdate'); // the rest of this function depends on `oldPlaylist` being defined\n\n return;\n } // we reloaded the same playlist so we are in a live scenario\n // and we will likely need to adjust the mediaIndex\n\n const mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;\n this.logger_(`live window shift [${mediaSequenceDiff}]`); // update the mediaIndex on the SegmentLoader\n // this is important because we can abort a request and this value must be\n // equal to the last appended mediaIndex\n\n if (this.mediaIndex !== null) {\n this.mediaIndex -= mediaSequenceDiff; // this can happen if we are going to load the first segment, but get a playlist\n // update during that. mediaIndex would go from 0 to -1 if mediaSequence in the\n // new playlist was incremented by 1.\n\n if (this.mediaIndex < 0) {\n this.mediaIndex = null;\n this.partIndex = null;\n } else {\n const segment = this.playlist_.segments[this.mediaIndex]; // partIndex should remain the same for the same segment\n // unless parts fell off of the playlist for this segment.\n // In that case we need to reset partIndex and resync\n\n if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) {\n const mediaIndex = this.mediaIndex;\n this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`);\n this.resetLoader(); // We want to throw away the partIndex and the data associated with it,\n // as the part was dropped from our current playlists segment.\n // The mediaIndex will still be valid so keep that around.\n\n this.mediaIndex = mediaIndex;\n }\n }\n } // update the mediaIndex on the SegmentInfo object\n // this is important because we will update this.mediaIndex with this value\n // in `handleAppendsDone_` after the segment has been successfully appended\n\n if (segmentInfo) {\n segmentInfo.mediaIndex -= mediaSequenceDiff;\n if (segmentInfo.mediaIndex < 0) {\n segmentInfo.mediaIndex = null;\n segmentInfo.partIndex = null;\n } else {\n // we need to update the referenced segment so that timing information is\n // saved for the new playlist's segment, however, if the segment fell off the\n // playlist, we can leave the old reference and just lose the timing info\n if (segmentInfo.mediaIndex >= 0) {\n segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex];\n }\n if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) {\n segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex];\n }\n }\n }\n this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist);\n }\n /**\n * Prevent the loader from fetching additional segments. If there\n * is a segment request outstanding, it will finish processing\n * before the loader halts. A segment loader can be unpaused by\n * calling load().\n */\n\n pause() {\n if (this.checkBufferTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.checkBufferTimeout_);\n this.checkBufferTimeout_ = null;\n }\n }\n /**\n * Returns whether the segment loader is fetching additional\n * segments when given the opportunity. This property can be\n * modified through calls to pause() and load().\n */\n\n paused() {\n return this.checkBufferTimeout_ === null;\n }\n /**\n * Delete all the buffered data and reset the SegmentLoader\n *\n * @param {Function} [done] an optional callback to be executed when the remove\n * operation is complete\n */\n\n resetEverything(done) {\n this.ended_ = false;\n this.activeInitSegmentId_ = null;\n this.appendInitSegment_ = {\n audio: true,\n video: true\n };\n this.resetLoader(); // remove from 0, the earliest point, to Infinity, to signify removal of everything.\n // VTT Segment Loader doesn't need to do anything but in the regular SegmentLoader,\n // we then clamp the value to duration if necessary.\n\n this.remove(0, Infinity, done); // clears fmp4 captions\n\n if (this.transmuxer_) {\n this.transmuxer_.postMessage({\n action: 'clearAllMp4Captions'\n }); // reset the cache in the transmuxer\n\n this.transmuxer_.postMessage({\n action: 'reset'\n });\n }\n }\n /**\n * Force the SegmentLoader to resync and start loading around the currentTime instead\n * of starting at the end of the buffer\n *\n * Useful for fast quality changes\n */\n\n resetLoader() {\n this.fetchAtBuffer_ = false;\n this.resyncLoader();\n }\n /**\n * Force the SegmentLoader to restart synchronization and make a conservative guess\n * before returning to the simple walk-forward method\n */\n\n resyncLoader() {\n if (this.transmuxer_) {\n // need to clear out any cached data to prepare for the new segment\n segmentTransmuxer.reset(this.transmuxer_);\n }\n this.mediaIndex = null;\n this.partIndex = null;\n this.syncPoint_ = null;\n this.isPendingTimestampOffset_ = false;\n this.shouldForceTimestampOffsetAfterResync_ = true;\n this.callQueue_ = [];\n this.loadQueue_ = [];\n this.metadataQueue_.id3 = [];\n this.metadataQueue_.caption = [];\n this.abort();\n if (this.transmuxer_) {\n this.transmuxer_.postMessage({\n action: 'clearParsedMp4Captions'\n });\n }\n }\n /**\n * Remove any data in the source buffer between start and end times\n *\n * @param {number} start - the start time of the region to remove from the buffer\n * @param {number} end - the end time of the region to remove from the buffer\n * @param {Function} [done] - an optional callback to be executed when the remove\n * @param {boolean} force - force all remove operations to happen\n * operation is complete\n */\n\n remove(start, end, done = () => {}, force = false) {\n // clamp end to duration if we need to remove everything.\n // This is due to a browser bug that causes issues if we remove to Infinity.\n // videojs/videojs-contrib-hls#1225\n if (end === Infinity) {\n end = this.duration_();\n } // skip removes that would throw an error\n // commonly happens during a rendition switch at the start of a video\n // from start 0 to end 0\n\n if (end <= start) {\n this.logger_('skipping remove because end ${end} is <= start ${start}');\n return;\n }\n if (!this.sourceUpdater_ || !this.getMediaInfo_()) {\n this.logger_('skipping remove because no source updater or starting media info'); // nothing to remove if we haven't processed any media\n\n return;\n } // set it to one to complete this function's removes\n\n let removesRemaining = 1;\n const removeFinished = () => {\n removesRemaining--;\n if (removesRemaining === 0) {\n done();\n }\n };\n if (force || !this.audioDisabled_) {\n removesRemaining++;\n this.sourceUpdater_.removeAudio(start, end, removeFinished);\n } // While it would be better to only remove video if the main loader has video, this\n // should be safe with audio only as removeVideo will call back even if there's no\n // video buffer.\n //\n // In theory we can check to see if there's video before calling the remove, but in\n // the event that we're switching between renditions and from video to audio only\n // (when we add support for that), we may need to clear the video contents despite\n // what the new media will contain.\n\n if (force || this.loaderType_ === 'main') {\n this.gopBuffer_ = removeGopBuffer(this.gopBuffer_, start, end, this.timeMapping_);\n removesRemaining++;\n this.sourceUpdater_.removeVideo(start, end, removeFinished);\n } // remove any captions and ID3 tags\n\n for (const track in this.inbandTextTracks_) {\n removeCuesFromTrack(start, end, this.inbandTextTracks_[track]);\n }\n removeCuesFromTrack(start, end, this.segmentMetadataTrack_); // finished this function's removes\n\n removeFinished();\n }\n /**\n * (re-)schedule monitorBufferTick_ to run as soon as possible\n *\n * @private\n */\n\n monitorBuffer_() {\n if (this.checkBufferTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.checkBufferTimeout_);\n }\n this.checkBufferTimeout_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(this.monitorBufferTick_.bind(this), 1);\n }\n /**\n * As long as the SegmentLoader is in the READY state, periodically\n * invoke fillBuffer_().\n *\n * @private\n */\n\n monitorBufferTick_() {\n if (this.state === 'READY') {\n this.fillBuffer_();\n }\n if (this.checkBufferTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.checkBufferTimeout_);\n }\n this.checkBufferTimeout_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY);\n }\n /**\n * fill the buffer with segements unless the sourceBuffers are\n * currently updating\n *\n * Note: this function should only ever be called by monitorBuffer_\n * and never directly\n *\n * @private\n */\n\n fillBuffer_() {\n // TODO since the source buffer maintains a queue, and we shouldn't call this function\n // except when we're ready for the next segment, this check can most likely be removed\n if (this.sourceUpdater_.updating()) {\n return;\n } // see if we need to begin loading immediately\n\n const segmentInfo = this.chooseNextRequest_();\n if (!segmentInfo) {\n return;\n }\n if (typeof segmentInfo.timestampOffset === 'number') {\n this.isPendingTimestampOffset_ = false;\n this.timelineChangeController_.pendingTimelineChange({\n type: this.loaderType_,\n from: this.currentTimeline_,\n to: segmentInfo.timeline\n });\n }\n this.loadSegment_(segmentInfo);\n }\n /**\n * Determines if we should call endOfStream on the media source based\n * on the state of the buffer or if appened segment was the final\n * segment in the playlist.\n *\n * @param {number} [mediaIndex] the media index of segment we last appended\n * @param {Object} [playlist] a media playlist object\n * @return {boolean} do we need to call endOfStream on the MediaSource\n */\n\n isEndOfStream_(mediaIndex = this.mediaIndex, playlist = this.playlist_, partIndex = this.partIndex) {\n if (!playlist || !this.mediaSource_) {\n return false;\n }\n const segment = typeof mediaIndex === 'number' && playlist.segments[mediaIndex]; // mediaIndex is zero based but length is 1 based\n\n const appendedLastSegment = mediaIndex + 1 === playlist.segments.length; // true if there are no parts, or this is the last part.\n\n const appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length; // if we've buffered to the end of the video, we need to call endOfStream\n // so that MediaSources can trigger the `ended` event when it runs out of\n // buffered data instead of waiting for me\n\n return playlist.endList && this.mediaSource_.readyState === 'open' && appendedLastSegment && appendedLastPart;\n }\n /**\n * Determines what request should be made given current segment loader state.\n *\n * @return {Object} a request object that describes the segment/part to load\n */\n\n chooseNextRequest_() {\n const buffered = this.buffered_();\n const bufferedEnd = lastBufferedEnd(buffered) || 0;\n const bufferedTime = timeAheadOf(buffered, this.currentTime_());\n const preloaded = !this.hasPlayed_() && bufferedTime >= 1;\n const haveEnoughBuffer = bufferedTime >= this.goalBufferLength_();\n const segments = this.playlist_.segments; // return no segment if:\n // 1. we don't have segments\n // 2. The video has not yet played and we already downloaded a segment\n // 3. we already have enough buffered time\n\n if (!segments.length || preloaded || haveEnoughBuffer) {\n return null;\n }\n this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_(), this.loaderType_);\n const next = {\n partIndex: null,\n mediaIndex: null,\n startOfSegment: null,\n playlist: this.playlist_,\n isSyncRequest: Boolean(!this.syncPoint_)\n };\n if (next.isSyncRequest) {\n next.mediaIndex = getSyncSegmentCandidate(this.currentTimeline_, segments, bufferedEnd);\n this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${next.mediaIndex}`);\n } else if (this.mediaIndex !== null) {\n const segment = segments[this.mediaIndex];\n const partIndex = typeof this.partIndex === 'number' ? this.partIndex : -1;\n next.startOfSegment = segment.end ? segment.end : bufferedEnd;\n if (segment.parts && segment.parts[partIndex + 1]) {\n next.mediaIndex = this.mediaIndex;\n next.partIndex = partIndex + 1;\n } else {\n next.mediaIndex = this.mediaIndex + 1;\n }\n } else {\n // Find the segment containing the end of the buffer or current time.\n const {\n segmentIndex,\n startTime,\n partIndex\n } = Playlist.getMediaInfoForTime({\n exactManifestTimings: this.exactManifestTimings,\n playlist: this.playlist_,\n currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(),\n startingPartIndex: this.syncPoint_.partIndex,\n startingSegmentIndex: this.syncPoint_.segmentIndex,\n startTime: this.syncPoint_.time\n });\n next.getMediaInfoForTime = this.fetchAtBuffer_ ? `bufferedEnd ${bufferedEnd}` : `currentTime ${this.currentTime_()}`;\n next.mediaIndex = segmentIndex;\n next.startOfSegment = startTime;\n next.partIndex = partIndex;\n this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${next.mediaIndex} `);\n }\n const nextSegment = segments[next.mediaIndex];\n let nextPart = nextSegment && typeof next.partIndex === 'number' && nextSegment.parts && nextSegment.parts[next.partIndex]; // if the next segment index is invalid or\n // the next partIndex is invalid do not choose a next segment.\n\n if (!nextSegment || typeof next.partIndex === 'number' && !nextPart) {\n return null;\n } // if the next segment has parts, and we don't have a partIndex.\n // Set partIndex to 0\n\n if (typeof next.partIndex !== 'number' && nextSegment.parts) {\n next.partIndex = 0;\n nextPart = nextSegment.parts[0];\n } // independentSegments applies to every segment in a playlist. If independentSegments appears in a main playlist,\n // it applies to each segment in each media playlist.\n // https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-23#section-4.3.5.1\n\n const hasIndependentSegments = this.vhs_.playlists && this.vhs_.playlists.main && this.vhs_.playlists.main.independentSegments || this.playlist_.independentSegments; // if we have no buffered data then we need to make sure\n // that the next part we append is \"independent\" if possible.\n // So we check if the previous part is independent, and request\n // it if it is.\n\n if (!bufferedTime && nextPart && !hasIndependentSegments && !nextPart.independent) {\n if (next.partIndex === 0) {\n const lastSegment = segments[next.mediaIndex - 1];\n const lastSegmentLastPart = lastSegment.parts && lastSegment.parts.length && lastSegment.parts[lastSegment.parts.length - 1];\n if (lastSegmentLastPart && lastSegmentLastPart.independent) {\n next.mediaIndex -= 1;\n next.partIndex = lastSegment.parts.length - 1;\n next.independent = 'previous segment';\n }\n } else if (nextSegment.parts[next.partIndex - 1].independent) {\n next.partIndex -= 1;\n next.independent = 'previous part';\n }\n }\n const ended = this.mediaSource_ && this.mediaSource_.readyState === 'ended'; // do not choose a next segment if all of the following:\n // 1. this is the last segment in the playlist\n // 2. end of stream has been called on the media source already\n // 3. the player is not seeking\n\n if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) {\n return null;\n }\n if (this.shouldForceTimestampOffsetAfterResync_) {\n this.shouldForceTimestampOffsetAfterResync_ = false;\n next.forceTimestampOffset = true;\n this.logger_('choose next request. Force timestamp offset after loader resync');\n }\n return this.generateSegmentInfo_(next);\n }\n generateSegmentInfo_(options) {\n const {\n independent,\n playlist,\n mediaIndex,\n startOfSegment,\n isSyncRequest,\n partIndex,\n forceTimestampOffset,\n getMediaInfoForTime\n } = options;\n const segment = playlist.segments[mediaIndex];\n const part = typeof partIndex === 'number' && segment.parts[partIndex];\n const segmentInfo = {\n requestId: 'segment-loader-' + Math.random(),\n // resolve the segment URL relative to the playlist\n uri: part && part.resolvedUri || segment.resolvedUri,\n // the segment's mediaIndex at the time it was requested\n mediaIndex,\n partIndex: part ? partIndex : null,\n // whether or not to update the SegmentLoader's state with this\n // segment's mediaIndex\n isSyncRequest,\n startOfSegment,\n // the segment's playlist\n playlist,\n // unencrypted bytes of the segment\n bytes: null,\n // when a key is defined for this segment, the encrypted bytes\n encryptedBytes: null,\n // The target timestampOffset for this segment when we append it\n // to the source buffer\n timestampOffset: null,\n // The timeline that the segment is in\n timeline: segment.timeline,\n // The expected duration of the segment in seconds\n duration: part && part.duration || segment.duration,\n // retain the segment in case the playlist updates while doing an async process\n segment,\n part,\n byteLength: 0,\n transmuxer: this.transmuxer_,\n // type of getMediaInfoForTime that was used to get this segment\n getMediaInfoForTime,\n independent\n };\n const overrideCheck = typeof forceTimestampOffset !== 'undefined' ? forceTimestampOffset : this.isPendingTimestampOffset_;\n segmentInfo.timestampOffset = this.timestampOffsetForSegment_({\n segmentTimeline: segment.timeline,\n currentTimeline: this.currentTimeline_,\n startOfSegment,\n buffered: this.buffered_(),\n overrideCheck\n });\n const audioBufferedEnd = lastBufferedEnd(this.sourceUpdater_.audioBuffered());\n if (typeof audioBufferedEnd === 'number') {\n // since the transmuxer is using the actual timing values, but the buffer is\n // adjusted by the timestamp offset, we must adjust the value here\n segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset();\n }\n if (this.sourceUpdater_.videoBuffered().length) {\n segmentInfo.gopsToAlignWith = gopsSafeToAlignWith(this.gopBuffer_,\n // since the transmuxer is using the actual timing values, but the time is\n // adjusted by the timestmap offset, we must adjust the value here\n this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(), this.timeMapping_);\n }\n return segmentInfo;\n } // get the timestampoffset for a segment,\n // added so that vtt segment loader can override and prevent\n // adding timestamp offsets.\n\n timestampOffsetForSegment_(options) {\n return timestampOffsetForSegment(options);\n }\n /**\n * Determines if the network has enough bandwidth to complete the current segment\n * request in a timely manner. If not, the request will be aborted early and bandwidth\n * updated to trigger a playlist switch.\n *\n * @param {Object} stats\n * Object containing stats about the request timing and size\n * @private\n */\n\n earlyAbortWhenNeeded_(stats) {\n if (this.vhs_.tech_.paused() ||\n // Don't abort if the current playlist is on the lowestEnabledRendition\n // TODO: Replace using timeout with a boolean indicating whether this playlist is\n // the lowestEnabledRendition.\n !this.xhrOptions_.timeout ||\n // Don't abort if we have no bandwidth information to estimate segment sizes\n !this.playlist_.attributes.BANDWIDTH) {\n return;\n } // Wait at least 1 second since the first byte of data has been received before\n // using the calculated bandwidth from the progress event to allow the bitrate\n // to stabilize\n\n if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1000) {\n return;\n }\n const currentTime = this.currentTime_();\n const measuredBandwidth = stats.bandwidth;\n const segmentDuration = this.pendingSegment_.duration;\n const requestTimeRemaining = Playlist.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived); // Subtract 1 from the timeUntilRebuffer so we still consider an early abort\n // if we are only left with less than 1 second when the request completes.\n // A negative timeUntilRebuffering indicates we are already rebuffering\n\n const timeUntilRebuffer$1 = timeUntilRebuffer(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1; // Only consider aborting early if the estimated time to finish the download\n // is larger than the estimated time until the player runs out of forward buffer\n\n if (requestTimeRemaining <= timeUntilRebuffer$1) {\n return;\n }\n const switchCandidate = minRebufferMaxBandwidthSelector({\n main: this.vhs_.playlists.main,\n currentTime,\n bandwidth: measuredBandwidth,\n duration: this.duration_(),\n segmentDuration,\n timeUntilRebuffer: timeUntilRebuffer$1,\n currentTimeline: this.currentTimeline_,\n syncController: this.syncController_\n });\n if (!switchCandidate) {\n return;\n }\n const rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$1;\n const timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact;\n let minimumTimeSaving = 0.5; // If we are already rebuffering, increase the amount of variance we add to the\n // potential round trip time of the new request so that we are not too aggressive\n // with switching to a playlist that might save us a fraction of a second.\n\n if (timeUntilRebuffer$1 <= TIME_FUDGE_FACTOR) {\n minimumTimeSaving = 1;\n }\n if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) {\n return;\n } // set the bandwidth to that of the desired playlist being sure to scale by\n // BANDWIDTH_VARIANCE and add one so the playlist selector does not exclude it\n // don't trigger a bandwidthupdate as the bandwidth is artifial\n\n this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config.BANDWIDTH_VARIANCE + 1;\n this.trigger('earlyabort');\n }\n handleAbort_(segmentInfo) {\n this.logger_(`Aborting ${segmentInfoString(segmentInfo)}`);\n this.mediaRequestsAborted += 1;\n }\n /**\n * XHR `progress` event handler\n *\n * @param {Event}\n * The XHR `progress` event\n * @param {Object} simpleSegment\n * A simplified segment object copy\n * @private\n */\n\n handleProgress_(event, simpleSegment) {\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n }\n this.trigger('progress');\n }\n handleTrackInfo_(simpleSegment, trackInfo) {\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n }\n if (this.checkForIllegalMediaSwitch(trackInfo)) {\n return;\n }\n trackInfo = trackInfo || {}; // When we have track info, determine what media types this loader is dealing with.\n // Guard against cases where we're not getting track info at all until we are\n // certain that all streams will provide it.\n\n if (!shallowEqual(this.currentMediaInfo_, trackInfo)) {\n this.appendInitSegment_ = {\n audio: true,\n video: true\n };\n this.startingMediaInfo_ = trackInfo;\n this.currentMediaInfo_ = trackInfo;\n this.logger_('trackinfo update', trackInfo);\n this.trigger('trackinfo');\n } // trackinfo may cause an abort if the trackinfo\n // causes a codec change to an unsupported codec.\n\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n } // set trackinfo on the pending segment so that\n // it can append.\n\n this.pendingSegment_.trackInfo = trackInfo; // check if any calls were waiting on the track info\n\n if (this.hasEnoughInfoToAppend_()) {\n this.processCallQueue_();\n }\n }\n handleTimingInfo_(simpleSegment, mediaType, timeType, time) {\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n }\n const segmentInfo = this.pendingSegment_;\n const timingInfoProperty = timingInfoPropertyForMedia(mediaType);\n segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {};\n segmentInfo[timingInfoProperty][timeType] = time;\n this.logger_(`timinginfo: ${mediaType} - ${timeType} - ${time}`); // check if any calls were waiting on the timing info\n\n if (this.hasEnoughInfoToAppend_()) {\n this.processCallQueue_();\n }\n }\n handleCaptions_(simpleSegment, captionData) {\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n } // This could only happen with fmp4 segments, but\n // should still not happen in general\n\n if (captionData.length === 0) {\n this.logger_('SegmentLoader received no captions from a caption event');\n return;\n }\n const segmentInfo = this.pendingSegment_; // Wait until we have some video data so that caption timing\n // can be adjusted by the timestamp offset\n\n if (!segmentInfo.hasAppendedData_) {\n this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData));\n return;\n }\n const timestampOffset = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();\n const captionTracks = {}; // get total start/end and captions for each track/stream\n\n captionData.forEach(caption => {\n // caption.stream is actually a track name...\n // set to the existing values in tracks or default values\n captionTracks[caption.stream] = captionTracks[caption.stream] || {\n // Infinity, as any other value will be less than this\n startTime: Infinity,\n captions: [],\n // 0 as an other value will be more than this\n endTime: 0\n };\n const captionTrack = captionTracks[caption.stream];\n captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset);\n captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset);\n captionTrack.captions.push(caption);\n });\n Object.keys(captionTracks).forEach(trackName => {\n const {\n startTime,\n endTime,\n captions\n } = captionTracks[trackName];\n const inbandTextTracks = this.inbandTextTracks_;\n this.logger_(`adding cues from ${startTime} -> ${endTime} for ${trackName}`);\n createCaptionsTrackIfNotExists(inbandTextTracks, this.vhs_.tech_, trackName); // clear out any cues that start and end at the same time period for the same track.\n // We do this because a rendition change that also changes the timescale for captions\n // will result in captions being re-parsed for certain segments. If we add them again\n // without clearing we will have two of the same captions visible.\n\n removeCuesFromTrack(startTime, endTime, inbandTextTracks[trackName]);\n addCaptionData({\n captionArray: captions,\n inbandTextTracks,\n timestampOffset\n });\n }); // Reset stored captions since we added parsed\n // captions to a text track at this point\n\n if (this.transmuxer_) {\n this.transmuxer_.postMessage({\n action: 'clearParsedMp4Captions'\n });\n }\n }\n handleId3_(simpleSegment, id3Frames, dispatchType) {\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n }\n const segmentInfo = this.pendingSegment_; // we need to have appended data in order for the timestamp offset to be set\n\n if (!segmentInfo.hasAppendedData_) {\n this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType));\n return;\n }\n this.addMetadataToTextTrack(dispatchType, id3Frames, this.duration_());\n }\n processMetadataQueue_() {\n this.metadataQueue_.id3.forEach(fn => fn());\n this.metadataQueue_.caption.forEach(fn => fn());\n this.metadataQueue_.id3 = [];\n this.metadataQueue_.caption = [];\n }\n processCallQueue_() {\n const callQueue = this.callQueue_; // Clear out the queue before the queued functions are run, since some of the\n // functions may check the length of the load queue and default to pushing themselves\n // back onto the queue.\n\n this.callQueue_ = [];\n callQueue.forEach(fun => fun());\n }\n processLoadQueue_() {\n const loadQueue = this.loadQueue_; // Clear out the queue before the queued functions are run, since some of the\n // functions may check the length of the load queue and default to pushing themselves\n // back onto the queue.\n\n this.loadQueue_ = [];\n loadQueue.forEach(fun => fun());\n }\n /**\n * Determines whether the loader has enough info to load the next segment.\n *\n * @return {boolean}\n * Whether or not the loader has enough info to load the next segment\n */\n\n hasEnoughInfoToLoad_() {\n // Since primary timing goes by video, only the audio loader potentially needs to wait\n // to load.\n if (this.loaderType_ !== 'audio') {\n return true;\n }\n const segmentInfo = this.pendingSegment_; // A fill buffer must have already run to establish a pending segment before there's\n // enough info to load.\n\n if (!segmentInfo) {\n return false;\n } // The first segment can and should be loaded immediately so that source buffers are\n // created together (before appending). Source buffer creation uses the presence of\n // audio and video data to determine whether to create audio/video source buffers, and\n // uses processed (transmuxed or parsed) media to determine the types required.\n\n if (!this.getCurrentMediaInfo_()) {\n return true;\n }\n if (\n // Technically, instead of waiting to load a segment on timeline changes, a segment\n // can be requested and downloaded and only wait before it is transmuxed or parsed.\n // But in practice, there are a few reasons why it is better to wait until a loader\n // is ready to append that segment before requesting and downloading:\n //\n // 1. Because audio and main loaders cross discontinuities together, if this loader\n // is waiting for the other to catch up, then instead of requesting another\n // segment and using up more bandwidth, by not yet loading, more bandwidth is\n // allotted to the loader currently behind.\n // 2. media-segment-request doesn't have to have logic to consider whether a segment\n // is ready to be processed or not, isolating the queueing behavior to the loader.\n // 3. The audio loader bases some of its segment properties on timing information\n // provided by the main loader, meaning that, if the logic for waiting on\n // processing was in media-segment-request, then it would also need to know how\n // to re-generate the segment information after the main loader caught up.\n shouldWaitForTimelineChange({\n timelineChangeController: this.timelineChangeController_,\n currentTimeline: this.currentTimeline_,\n segmentTimeline: segmentInfo.timeline,\n loaderType: this.loaderType_,\n audioDisabled: this.audioDisabled_\n })) {\n return false;\n }\n return true;\n }\n getCurrentMediaInfo_(segmentInfo = this.pendingSegment_) {\n return segmentInfo && segmentInfo.trackInfo || this.currentMediaInfo_;\n }\n getMediaInfo_(segmentInfo = this.pendingSegment_) {\n return this.getCurrentMediaInfo_(segmentInfo) || this.startingMediaInfo_;\n }\n getPendingSegmentPlaylist() {\n return this.pendingSegment_ ? this.pendingSegment_.playlist : null;\n }\n hasEnoughInfoToAppend_() {\n if (!this.sourceUpdater_.ready()) {\n return false;\n } // If content needs to be removed or the loader is waiting on an append reattempt,\n // then no additional content should be appended until the prior append is resolved.\n\n if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) {\n return false;\n }\n const segmentInfo = this.pendingSegment_;\n const trackInfo = this.getCurrentMediaInfo_(); // no segment to append any data for or\n // we do not have information on this specific\n // segment yet\n\n if (!segmentInfo || !trackInfo) {\n return false;\n }\n const {\n hasAudio,\n hasVideo,\n isMuxed\n } = trackInfo;\n if (hasVideo && !segmentInfo.videoTimingInfo) {\n return false;\n } // muxed content only relies on video timing information for now.\n\n if (hasAudio && !this.audioDisabled_ && !isMuxed && !segmentInfo.audioTimingInfo) {\n return false;\n }\n if (shouldWaitForTimelineChange({\n timelineChangeController: this.timelineChangeController_,\n currentTimeline: this.currentTimeline_,\n segmentTimeline: segmentInfo.timeline,\n loaderType: this.loaderType_,\n audioDisabled: this.audioDisabled_\n })) {\n return false;\n }\n return true;\n }\n handleData_(simpleSegment, result) {\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n } // If there's anything in the call queue, then this data came later and should be\n // executed after the calls currently queued.\n\n if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) {\n this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result));\n return;\n }\n const segmentInfo = this.pendingSegment_; // update the time mapping so we can translate from display time to media time\n\n this.setTimeMapping_(segmentInfo.timeline); // for tracking overall stats\n\n this.updateMediaSecondsLoaded_(segmentInfo.part || segmentInfo.segment); // Note that the state isn't changed from loading to appending. This is because abort\n // logic may change behavior depending on the state, and changing state too early may\n // inflate our estimates of bandwidth. In the future this should be re-examined to\n // note more granular states.\n // don't process and append data if the mediaSource is closed\n\n if (this.mediaSource_.readyState === 'closed') {\n return;\n } // if this request included an initialization segment, save that data\n // to the initSegment cache\n\n if (simpleSegment.map) {\n simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true); // move over init segment properties to media request\n\n segmentInfo.segment.map = simpleSegment.map;\n } // if this request included a segment key, save that data in the cache\n\n if (simpleSegment.key) {\n this.segmentKey(simpleSegment.key, true);\n }\n segmentInfo.isFmp4 = simpleSegment.isFmp4;\n segmentInfo.timingInfo = segmentInfo.timingInfo || {};\n if (segmentInfo.isFmp4) {\n this.trigger('fmp4');\n segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia(result.type)].start;\n } else {\n const trackInfo = this.getCurrentMediaInfo_();\n const useVideoTimingInfo = this.loaderType_ === 'main' && trackInfo && trackInfo.hasVideo;\n let firstVideoFrameTimeForData;\n if (useVideoTimingInfo) {\n firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start;\n } // Segment loader knows more about segment timing than the transmuxer (in certain\n // aspects), so make any changes required for a more accurate start time.\n // Don't set the end time yet, as the segment may not be finished processing.\n\n segmentInfo.timingInfo.start = this.trueSegmentStart_({\n currentStart: segmentInfo.timingInfo.start,\n playlist: segmentInfo.playlist,\n mediaIndex: segmentInfo.mediaIndex,\n currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(),\n useVideoTimingInfo,\n firstVideoFrameTimeForData,\n videoTimingInfo: segmentInfo.videoTimingInfo,\n audioTimingInfo: segmentInfo.audioTimingInfo\n });\n } // Init segments for audio and video only need to be appended in certain cases. Now\n // that data is about to be appended, we can check the final cases to determine\n // whether we should append an init segment.\n\n this.updateAppendInitSegmentStatus(segmentInfo, result.type); // Timestamp offset should be updated once we get new data and have its timing info,\n // as we use the start of the segment to offset the best guess (playlist provided)\n // timestamp offset.\n\n this.updateSourceBufferTimestampOffset_(segmentInfo); // if this is a sync request we need to determine whether it should\n // be appended or not.\n\n if (segmentInfo.isSyncRequest) {\n // first save/update our timing info for this segment.\n // this is what allows us to choose an accurate segment\n // and the main reason we make a sync request.\n this.updateTimingInfoEnd_(segmentInfo);\n this.syncController_.saveSegmentTimingInfo({\n segmentInfo,\n shouldSaveTimelineMapping: this.loaderType_ === 'main'\n });\n const next = this.chooseNextRequest_(); // If the sync request isn't the segment that would be requested next\n // after taking into account its timing info, do not append it.\n\n if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) {\n this.logger_('sync segment was incorrect, not appending');\n return;\n } // otherwise append it like any other segment as our guess was correct.\n\n this.logger_('sync segment was correct, appending');\n } // Save some state so that in the future anything waiting on first append (and/or\n // timestamp offset(s)) can process immediately. While the extra state isn't optimal,\n // we need some notion of whether the timestamp offset or other relevant information\n // has had a chance to be set.\n\n segmentInfo.hasAppendedData_ = true; // Now that the timestamp offset should be set, we can append any waiting ID3 tags.\n\n this.processMetadataQueue_();\n this.appendData_(segmentInfo, result);\n }\n updateAppendInitSegmentStatus(segmentInfo, type) {\n // alt audio doesn't manage timestamp offset\n if (this.loaderType_ === 'main' && typeof segmentInfo.timestampOffset === 'number' &&\n // in the case that we're handling partial data, we don't want to append an init\n // segment for each chunk\n !segmentInfo.changedTimestampOffset) {\n // if the timestamp offset changed, the timeline may have changed, so we have to re-\n // append init segments\n this.appendInitSegment_ = {\n audio: true,\n video: true\n };\n }\n if (this.playlistOfLastInitSegment_[type] !== segmentInfo.playlist) {\n // make sure we append init segment on playlist changes, in case the media config\n // changed\n this.appendInitSegment_[type] = true;\n }\n }\n getInitSegmentAndUpdateState_({\n type,\n initSegment,\n map,\n playlist\n }) {\n // \"The EXT-X-MAP tag specifies how to obtain the Media Initialization Section\n // (Section 3) required to parse the applicable Media Segments. It applies to every\n // Media Segment that appears after it in the Playlist until the next EXT-X-MAP tag\n // or until the end of the playlist.\"\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.5\n if (map) {\n const id = initSegmentId(map);\n if (this.activeInitSegmentId_ === id) {\n // don't need to re-append the init segment if the ID matches\n return null;\n } // a map-specified init segment takes priority over any transmuxed (or otherwise\n // obtained) init segment\n //\n // this also caches the init segment for later use\n\n initSegment = this.initSegmentForMap(map, true).bytes;\n this.activeInitSegmentId_ = id;\n } // We used to always prepend init segments for video, however, that shouldn't be\n // necessary. Instead, we should only append on changes, similar to what we've always\n // done for audio. This is more important (though may not be that important) for\n // frame-by-frame appending for LHLS, simply because of the increased quantity of\n // appends.\n\n if (initSegment && this.appendInitSegment_[type]) {\n // Make sure we track the playlist that we last used for the init segment, so that\n // we can re-append the init segment in the event that we get data from a new\n // playlist. Discontinuities and track changes are handled in other sections.\n this.playlistOfLastInitSegment_[type] = playlist; // Disable future init segment appends for this type. Until a change is necessary.\n\n this.appendInitSegment_[type] = false; // we need to clear out the fmp4 active init segment id, since\n // we are appending the muxer init segment\n\n this.activeInitSegmentId_ = null;\n return initSegment;\n }\n return null;\n }\n handleQuotaExceededError_({\n segmentInfo,\n type,\n bytes\n }, error) {\n const audioBuffered = this.sourceUpdater_.audioBuffered();\n const videoBuffered = this.sourceUpdater_.videoBuffered(); // For now we're ignoring any notion of gaps in the buffer, but they, in theory,\n // should be cleared out during the buffer removals. However, log in case it helps\n // debug.\n\n if (audioBuffered.length > 1) {\n this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: ' + timeRangesToArray(audioBuffered).join(', '));\n }\n if (videoBuffered.length > 1) {\n this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: ' + timeRangesToArray(videoBuffered).join(', '));\n }\n const audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0;\n const audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0;\n const videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0;\n const videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0;\n if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER) {\n // Can't remove enough buffer to make room for new segment (or the browser doesn't\n // allow for appends of segments this size). In the future, it may be possible to\n // split up the segment and append in pieces, but for now, error out this playlist\n // in an attempt to switch to a more manageable rendition.\n this.logger_('On QUOTA_EXCEEDED_ERR, single segment too large to append to ' + 'buffer, triggering an error. ' + `Appended byte length: ${bytes.byteLength}, ` + `audio buffer: ${timeRangesToArray(audioBuffered).join(', ')}, ` + `video buffer: ${timeRangesToArray(videoBuffered).join(', ')}, `);\n this.error({\n message: 'Quota exceeded error with append of a single segment of content',\n excludeUntil: Infinity\n });\n this.trigger('error');\n return;\n } // To try to resolve the quota exceeded error, clear back buffer and retry. This means\n // that the segment-loader should block on future events until this one is handled, so\n // that it doesn't keep moving onto further segments. Adding the call to the call\n // queue will prevent further appends until waitingOnRemove_ and\n // quotaExceededErrorRetryTimeout_ are cleared.\n //\n // Note that this will only block the current loader. In the case of demuxed content,\n // the other load may keep filling as fast as possible. In practice, this should be\n // OK, as it is a rare case when either audio has a high enough bitrate to fill up a\n // source buffer, or video fills without enough room for audio to append (and without\n // the availability of clearing out seconds of back buffer to make room for audio).\n // But it might still be good to handle this case in the future as a TODO.\n\n this.waitingOnRemove_ = true;\n this.callQueue_.push(this.appendToSourceBuffer_.bind(this, {\n segmentInfo,\n type,\n bytes\n }));\n const currentTime = this.currentTime_(); // Try to remove as much audio and video as possible to make room for new content\n // before retrying.\n\n const timeToRemoveUntil = currentTime - MIN_BACK_BUFFER;\n this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${timeToRemoveUntil}`);\n this.remove(0, timeToRemoveUntil, () => {\n this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${MIN_BACK_BUFFER}s`);\n this.waitingOnRemove_ = false; // wait the length of time alotted in the back buffer to prevent wasted\n // attempts (since we can't clear less than the minimum)\n\n this.quotaExceededErrorRetryTimeout_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => {\n this.logger_('On QUOTA_EXCEEDED_ERR, re-processing call queue');\n this.quotaExceededErrorRetryTimeout_ = null;\n this.processCallQueue_();\n }, MIN_BACK_BUFFER * 1000);\n }, true);\n }\n handleAppendError_({\n segmentInfo,\n type,\n bytes\n }, error) {\n // if there's no error, nothing to do\n if (!error) {\n return;\n }\n if (error.code === QUOTA_EXCEEDED_ERR) {\n this.handleQuotaExceededError_({\n segmentInfo,\n type,\n bytes\n }); // A quota exceeded error should be recoverable with a future re-append, so no need\n // to trigger an append error.\n\n return;\n }\n this.logger_('Received non QUOTA_EXCEEDED_ERR on append', error);\n this.error(`${type} append of ${bytes.length}b failed for segment ` + `#${segmentInfo.mediaIndex} in playlist ${segmentInfo.playlist.id}`); // If an append errors, we often can't recover.\n // (see https://w3c.github.io/media-source/#sourcebuffer-append-error).\n //\n // Trigger a special error so that it can be handled separately from normal,\n // recoverable errors.\n\n this.trigger('appenderror');\n }\n appendToSourceBuffer_({\n segmentInfo,\n type,\n initSegment,\n data,\n bytes\n }) {\n // If this is a re-append, bytes were already created and don't need to be recreated\n if (!bytes) {\n const segments = [data];\n let byteLength = data.byteLength;\n if (initSegment) {\n // if the media initialization segment is changing, append it before the content\n // segment\n segments.unshift(initSegment);\n byteLength += initSegment.byteLength;\n } // Technically we should be OK appending the init segment separately, however, we\n // haven't yet tested that, and prepending is how we have always done things.\n\n bytes = concatSegments({\n bytes: byteLength,\n segments\n });\n }\n this.sourceUpdater_.appendBuffer({\n segmentInfo,\n type,\n bytes\n }, this.handleAppendError_.bind(this, {\n segmentInfo,\n type,\n bytes\n }));\n }\n handleSegmentTimingInfo_(type, requestId, segmentTimingInfo) {\n if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) {\n return;\n }\n const segment = this.pendingSegment_.segment;\n const timingInfoProperty = `${type}TimingInfo`;\n if (!segment[timingInfoProperty]) {\n segment[timingInfoProperty] = {};\n }\n segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0;\n segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation;\n segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode;\n segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation;\n segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode; // mainly used as a reference for debugging\n\n segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime;\n }\n appendData_(segmentInfo, result) {\n const {\n type,\n data\n } = result;\n if (!data || !data.byteLength) {\n return;\n }\n if (type === 'audio' && this.audioDisabled_) {\n return;\n }\n const initSegment = this.getInitSegmentAndUpdateState_({\n type,\n initSegment: result.initSegment,\n playlist: segmentInfo.playlist,\n map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null\n });\n this.appendToSourceBuffer_({\n segmentInfo,\n type,\n initSegment,\n data\n });\n }\n /**\n * load a specific segment from a request into the buffer\n *\n * @private\n */\n\n loadSegment_(segmentInfo) {\n this.state = 'WAITING';\n this.pendingSegment_ = segmentInfo;\n this.trimBackBuffer_(segmentInfo);\n if (typeof segmentInfo.timestampOffset === 'number') {\n if (this.transmuxer_) {\n this.transmuxer_.postMessage({\n action: 'clearAllMp4Captions'\n });\n }\n }\n if (!this.hasEnoughInfoToLoad_()) {\n this.loadQueue_.push(() => {\n // regenerate the audioAppendStart, timestampOffset, etc as they\n // may have changed since this function was added to the queue.\n const options = (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_6__[\"default\"])({}, segmentInfo, {\n forceTimestampOffset: true\n });\n (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_6__[\"default\"])(segmentInfo, this.generateSegmentInfo_(options));\n this.isPendingTimestampOffset_ = false;\n this.updateTransmuxerAndRequestSegment_(segmentInfo);\n });\n return;\n }\n this.updateTransmuxerAndRequestSegment_(segmentInfo);\n }\n updateTransmuxerAndRequestSegment_(segmentInfo) {\n // We'll update the source buffer's timestamp offset once we have transmuxed data, but\n // the transmuxer still needs to be updated before then.\n //\n // Even though keepOriginalTimestamps is set to true for the transmuxer, timestamp\n // offset must be passed to the transmuxer for stream correcting adjustments.\n if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) {\n this.gopBuffer_.length = 0; // gopsToAlignWith was set before the GOP buffer was cleared\n\n segmentInfo.gopsToAlignWith = [];\n this.timeMapping_ = 0; // reset values in the transmuxer since a discontinuity should start fresh\n\n this.transmuxer_.postMessage({\n action: 'reset'\n });\n this.transmuxer_.postMessage({\n action: 'setTimestampOffset',\n timestampOffset: segmentInfo.timestampOffset\n });\n }\n const simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo);\n const isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex);\n const isWalkingForward = this.mediaIndex !== null;\n const isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ &&\n // currentTimeline starts at -1, so we shouldn't end the timeline switching to 0,\n // the first timeline\n segmentInfo.timeline > 0;\n const isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity;\n this.logger_(`Requesting ${segmentInfoString(segmentInfo)}`); // If there's an init segment associated with this segment, but it is not cached (identified by a lack of bytes),\n // then this init segment has never been seen before and should be appended.\n //\n // At this point the content type (audio/video or both) is not yet known, but it should be safe to set\n // both to true and leave the decision of whether to append the init segment to append time.\n\n if (simpleSegment.map && !simpleSegment.map.bytes) {\n this.logger_('going to request init segment.');\n this.appendInitSegment_ = {\n video: true,\n audio: true\n };\n }\n segmentInfo.abortRequests = mediaSegmentRequest({\n xhr: this.vhs_.xhr,\n xhrOptions: this.xhrOptions_,\n decryptionWorker: this.decrypter_,\n segment: simpleSegment,\n abortFn: this.handleAbort_.bind(this, segmentInfo),\n progressFn: this.handleProgress_.bind(this),\n trackInfoFn: this.handleTrackInfo_.bind(this),\n timingInfoFn: this.handleTimingInfo_.bind(this),\n videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'video', segmentInfo.requestId),\n audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'audio', segmentInfo.requestId),\n captionsFn: this.handleCaptions_.bind(this),\n isEndOfTimeline,\n endedTimelineFn: () => {\n this.logger_('received endedtimeline callback');\n },\n id3Fn: this.handleId3_.bind(this),\n dataFn: this.handleData_.bind(this),\n doneFn: this.segmentRequestFinished_.bind(this),\n onTransmuxerLog: ({\n message,\n level,\n stream\n }) => {\n this.logger_(`${segmentInfoString(segmentInfo)} logged from transmuxer stream ${stream} as a ${level}: ${message}`);\n }\n });\n }\n /**\n * trim the back buffer so that we don't have too much data\n * in the source buffer\n *\n * @private\n *\n * @param {Object} segmentInfo - the current segment\n */\n\n trimBackBuffer_(segmentInfo) {\n const removeToTime = safeBackBufferTrimTime(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10); // Chrome has a hard limit of 150MB of\n // buffer and a very conservative \"garbage collector\"\n // We manually clear out the old buffer to ensure\n // we don't trigger the QuotaExceeded error\n // on the source buffer during subsequent appends\n\n if (removeToTime > 0) {\n this.remove(0, removeToTime);\n }\n }\n /**\n * created a simplified copy of the segment object with just the\n * information necessary to perform the XHR and decryption\n *\n * @private\n *\n * @param {Object} segmentInfo - the current segment\n * @return {Object} a simplified segment object copy\n */\n\n createSimplifiedSegmentObj_(segmentInfo) {\n const segment = segmentInfo.segment;\n const part = segmentInfo.part;\n const simpleSegment = {\n resolvedUri: part ? part.resolvedUri : segment.resolvedUri,\n byterange: part ? part.byterange : segment.byterange,\n requestId: segmentInfo.requestId,\n transmuxer: segmentInfo.transmuxer,\n audioAppendStart: segmentInfo.audioAppendStart,\n gopsToAlignWith: segmentInfo.gopsToAlignWith,\n part: segmentInfo.part\n };\n const previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1];\n if (previousSegment && previousSegment.timeline === segment.timeline) {\n // The baseStartTime of a segment is used to handle rollover when probing the TS\n // segment to retrieve timing information. Since the probe only looks at the media's\n // times (e.g., PTS and DTS values of the segment), and doesn't consider the\n // player's time (e.g., player.currentTime()), baseStartTime should reflect the\n // media time as well. transmuxedDecodeEnd represents the end time of a segment, in\n // seconds of media time, so should be used here. The previous segment is used since\n // the end of the previous segment should represent the beginning of the current\n // segment, so long as they are on the same timeline.\n if (previousSegment.videoTimingInfo) {\n simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd;\n } else if (previousSegment.audioTimingInfo) {\n simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd;\n }\n }\n if (segment.key) {\n // if the media sequence is greater than 2^32, the IV will be incorrect\n // assuming 10s segments, that would be about 1300 years\n const iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]);\n simpleSegment.key = this.segmentKey(segment.key);\n simpleSegment.key.iv = iv;\n }\n if (segment.map) {\n simpleSegment.map = this.initSegmentForMap(segment.map);\n }\n return simpleSegment;\n }\n saveTransferStats_(stats) {\n // every request counts as a media request even if it has been aborted\n // or canceled due to a timeout\n this.mediaRequests += 1;\n if (stats) {\n this.mediaBytesTransferred += stats.bytesReceived;\n this.mediaTransferDuration += stats.roundTripTime;\n }\n }\n saveBandwidthRelatedStats_(duration, stats) {\n // byteLength will be used for throughput, and should be based on bytes receieved,\n // which we only know at the end of the request and should reflect total bytes\n // downloaded rather than just bytes processed from components of the segment\n this.pendingSegment_.byteLength = stats.bytesReceived;\n if (duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) {\n this.logger_(`Ignoring segment's bandwidth because its duration of ${duration}` + ` is less than the min to record ${MIN_SEGMENT_DURATION_TO_SAVE_STATS}`);\n return;\n }\n this.bandwidth = stats.bandwidth;\n this.roundTrip = stats.roundTripTime;\n }\n handleTimeout_() {\n // although the VTT segment loader bandwidth isn't really used, it's good to\n // maintain functinality between segment loaders\n this.mediaRequestsTimedout += 1;\n this.bandwidth = 1;\n this.roundTrip = NaN;\n this.trigger('bandwidthupdate');\n this.trigger('timeout');\n }\n /**\n * Handle the callback from the segmentRequest function and set the\n * associated SegmentLoader state and errors if necessary\n *\n * @private\n */\n\n segmentRequestFinished_(error, simpleSegment, result) {\n // TODO handle special cases, e.g., muxed audio/video but only audio in the segment\n // check the call queue directly since this function doesn't need to deal with any\n // data, and can continue even if the source buffers are not set up and we didn't get\n // any data from the segment\n if (this.callQueue_.length) {\n this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result));\n return;\n }\n this.saveTransferStats_(simpleSegment.stats); // The request was aborted and the SegmentLoader has already been reset\n\n if (!this.pendingSegment_) {\n return;\n } // the request was aborted and the SegmentLoader has already started\n // another request. this can happen when the timeout for an aborted\n // request triggers due to a limitation in the XHR library\n // do not count this as any sort of request or we risk double-counting\n\n if (simpleSegment.requestId !== this.pendingSegment_.requestId) {\n return;\n } // an error occurred from the active pendingSegment_ so reset everything\n\n if (error) {\n this.pendingSegment_ = null;\n this.state = 'READY'; // aborts are not a true error condition and nothing corrective needs to be done\n\n if (error.code === REQUEST_ERRORS.ABORTED) {\n return;\n }\n this.pause(); // the error is really just that at least one of the requests timed-out\n // set the bandwidth to a very low value and trigger an ABR switch to\n // take emergency action\n\n if (error.code === REQUEST_ERRORS.TIMEOUT) {\n this.handleTimeout_();\n return;\n } // if control-flow has arrived here, then the error is real\n // emit an error event to exclude the current playlist\n\n this.mediaRequestsErrored += 1;\n this.error(error);\n this.trigger('error');\n return;\n }\n const segmentInfo = this.pendingSegment_; // the response was a success so set any bandwidth stats the request\n // generated for ABR purposes\n\n this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);\n segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests;\n if (result.gopInfo) {\n this.gopBuffer_ = updateGopBuffer(this.gopBuffer_, result.gopInfo, this.safeAppend_);\n } // Although we may have already started appending on progress, we shouldn't switch the\n // state away from loading until we are officially done loading the segment data.\n\n this.state = 'APPENDING'; // used for testing\n\n this.trigger('appending');\n this.waitForAppendsToComplete_(segmentInfo);\n }\n setTimeMapping_(timeline) {\n const timelineMapping = this.syncController_.mappingForTimeline(timeline);\n if (timelineMapping !== null) {\n this.timeMapping_ = timelineMapping;\n }\n }\n updateMediaSecondsLoaded_(segment) {\n if (typeof segment.start === 'number' && typeof segment.end === 'number') {\n this.mediaSecondsLoaded += segment.end - segment.start;\n } else {\n this.mediaSecondsLoaded += segment.duration;\n }\n }\n shouldUpdateTransmuxerTimestampOffset_(timestampOffset) {\n if (timestampOffset === null) {\n return false;\n } // note that we're potentially using the same timestamp offset for both video and\n // audio\n\n if (this.loaderType_ === 'main' && timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) {\n return true;\n }\n if (!this.audioDisabled_ && timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) {\n return true;\n }\n return false;\n }\n trueSegmentStart_({\n currentStart,\n playlist,\n mediaIndex,\n firstVideoFrameTimeForData,\n currentVideoTimestampOffset,\n useVideoTimingInfo,\n videoTimingInfo,\n audioTimingInfo\n }) {\n if (typeof currentStart !== 'undefined') {\n // if start was set once, keep using it\n return currentStart;\n }\n if (!useVideoTimingInfo) {\n return audioTimingInfo.start;\n }\n const previousSegment = playlist.segments[mediaIndex - 1]; // The start of a segment should be the start of the first full frame contained\n // within that segment. Since the transmuxer maintains a cache of incomplete data\n // from and/or the last frame seen, the start time may reflect a frame that starts\n // in the previous segment. Check for that case and ensure the start time is\n // accurate for the segment.\n\n if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === 'undefined' || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) {\n return firstVideoFrameTimeForData;\n }\n return videoTimingInfo.start;\n }\n waitForAppendsToComplete_(segmentInfo) {\n const trackInfo = this.getCurrentMediaInfo_(segmentInfo);\n if (!trackInfo) {\n this.error({\n message: 'No starting media returned, likely due to an unsupported media format.',\n playlistExclusionDuration: Infinity\n });\n this.trigger('error');\n return;\n } // Although transmuxing is done, appends may not yet be finished. Throw a marker\n // on each queue this loader is responsible for to ensure that the appends are\n // complete.\n\n const {\n hasAudio,\n hasVideo,\n isMuxed\n } = trackInfo;\n const waitForVideo = this.loaderType_ === 'main' && hasVideo;\n const waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed;\n segmentInfo.waitingOnAppends = 0; // segments with no data\n\n if (!segmentInfo.hasAppendedData_) {\n if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === 'number') {\n // When there's no audio or video data in the segment, there's no audio or video\n // timing information.\n //\n // If there's no audio or video timing information, then the timestamp offset\n // can't be adjusted to the appropriate value for the transmuxer and source\n // buffers.\n //\n // Therefore, the next segment should be used to set the timestamp offset.\n this.isPendingTimestampOffset_ = true;\n } // override settings for metadata only segments\n\n segmentInfo.timingInfo = {\n start: 0\n };\n segmentInfo.waitingOnAppends++;\n if (!this.isPendingTimestampOffset_) {\n // update the timestampoffset\n this.updateSourceBufferTimestampOffset_(segmentInfo); // make sure the metadata queue is processed even though we have\n // no video/audio data.\n\n this.processMetadataQueue_();\n } // append is \"done\" instantly with no data.\n\n this.checkAppendsDone_(segmentInfo);\n return;\n } // Since source updater could call back synchronously, do the increments first.\n\n if (waitForVideo) {\n segmentInfo.waitingOnAppends++;\n }\n if (waitForAudio) {\n segmentInfo.waitingOnAppends++;\n }\n if (waitForVideo) {\n this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));\n }\n if (waitForAudio) {\n this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));\n }\n }\n checkAppendsDone_(segmentInfo) {\n if (this.checkForAbort_(segmentInfo.requestId)) {\n return;\n }\n segmentInfo.waitingOnAppends--;\n if (segmentInfo.waitingOnAppends === 0) {\n this.handleAppendsDone_();\n }\n }\n checkForIllegalMediaSwitch(trackInfo) {\n const illegalMediaSwitchError = illegalMediaSwitch(this.loaderType_, this.getCurrentMediaInfo_(), trackInfo);\n if (illegalMediaSwitchError) {\n this.error({\n message: illegalMediaSwitchError,\n playlistExclusionDuration: Infinity\n });\n this.trigger('error');\n return true;\n }\n return false;\n }\n updateSourceBufferTimestampOffset_(segmentInfo) {\n if (segmentInfo.timestampOffset === null ||\n // we don't yet have the start for whatever media type (video or audio) has\n // priority, timing-wise, so we must wait\n typeof segmentInfo.timingInfo.start !== 'number' ||\n // already updated the timestamp offset for this segment\n segmentInfo.changedTimestampOffset ||\n // the alt audio loader should not be responsible for setting the timestamp offset\n this.loaderType_ !== 'main') {\n return;\n }\n let didChange = false; // Primary timing goes by video, and audio is trimmed in the transmuxer, meaning that\n // the timing info here comes from video. In the event that the audio is longer than\n // the video, this will trim the start of the audio.\n // This also trims any offset from 0 at the beginning of the media\n\n segmentInfo.timestampOffset -= this.getSegmentStartTimeForTimestampOffsetCalculation_({\n videoTimingInfo: segmentInfo.segment.videoTimingInfo,\n audioTimingInfo: segmentInfo.segment.audioTimingInfo,\n timingInfo: segmentInfo.timingInfo\n }); // In the event that there are part segment downloads, each will try to update the\n // timestamp offset. Retaining this bit of state prevents us from updating in the\n // future (within the same segment), however, there may be a better way to handle it.\n\n segmentInfo.changedTimestampOffset = true;\n if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) {\n this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset);\n didChange = true;\n }\n if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) {\n this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset);\n didChange = true;\n }\n if (didChange) {\n this.trigger('timestampoffset');\n }\n }\n getSegmentStartTimeForTimestampOffsetCalculation_({\n videoTimingInfo,\n audioTimingInfo,\n timingInfo\n }) {\n if (!this.useDtsForTimestampOffset_) {\n return timingInfo.start;\n }\n if (videoTimingInfo && typeof videoTimingInfo.transmuxedDecodeStart === 'number') {\n return videoTimingInfo.transmuxedDecodeStart;\n } // handle audio only\n\n if (audioTimingInfo && typeof audioTimingInfo.transmuxedDecodeStart === 'number') {\n return audioTimingInfo.transmuxedDecodeStart;\n } // handle content not transmuxed (e.g., MP4)\n\n return timingInfo.start;\n }\n updateTimingInfoEnd_(segmentInfo) {\n segmentInfo.timingInfo = segmentInfo.timingInfo || {};\n const trackInfo = this.getMediaInfo_();\n const useVideoTimingInfo = this.loaderType_ === 'main' && trackInfo && trackInfo.hasVideo;\n const prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo;\n if (!prioritizedTimingInfo) {\n return;\n }\n segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === 'number' ?\n // End time may not exist in a case where we aren't parsing the full segment (one\n // current example is the case of fmp4), so use the rough duration to calculate an\n // end time.\n prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration;\n }\n /**\n * callback to run when appendBuffer is finished. detects if we are\n * in a good state to do things with the data we got, or if we need\n * to wait for more\n *\n * @private\n */\n\n handleAppendsDone_() {\n // appendsdone can cause an abort\n if (this.pendingSegment_) {\n this.trigger('appendsdone');\n }\n if (!this.pendingSegment_) {\n this.state = 'READY'; // TODO should this move into this.checkForAbort to speed up requests post abort in\n // all appending cases?\n\n if (!this.paused()) {\n this.monitorBuffer_();\n }\n return;\n }\n const segmentInfo = this.pendingSegment_; // Now that the end of the segment has been reached, we can set the end time. It's\n // best to wait until all appends are done so we're sure that the primary media is\n // finished (and we have its end time).\n\n this.updateTimingInfoEnd_(segmentInfo);\n if (this.shouldSaveSegmentTimingInfo_) {\n // Timeline mappings should only be saved for the main loader. This is for multiple\n // reasons:\n //\n // 1) Only one mapping is saved per timeline, meaning that if both the audio loader\n // and the main loader try to save the timeline mapping, whichever comes later\n // will overwrite the first. In theory this is OK, as the mappings should be the\n // same, however, it breaks for (2)\n // 2) In the event of a live stream, the initial live point will make for a somewhat\n // arbitrary mapping. If audio and video streams are not perfectly in-sync, then\n // the mapping will be off for one of the streams, dependent on which one was\n // first saved (see (1)).\n // 3) Primary timing goes by video in VHS, so the mapping should be video.\n //\n // Since the audio loader will wait for the main loader to load the first segment,\n // the main loader will save the first timeline mapping, and ensure that there won't\n // be a case where audio loads two segments without saving a mapping (thus leading\n // to missing segment timing info).\n this.syncController_.saveSegmentTimingInfo({\n segmentInfo,\n shouldSaveTimelineMapping: this.loaderType_ === 'main'\n });\n }\n const segmentDurationMessage = getTroublesomeSegmentDurationMessage(segmentInfo, this.sourceType_);\n if (segmentDurationMessage) {\n if (segmentDurationMessage.severity === 'warn') {\n videojs.log.warn(segmentDurationMessage.message);\n } else {\n this.logger_(segmentDurationMessage.message);\n }\n }\n this.recordThroughput_(segmentInfo);\n this.pendingSegment_ = null;\n this.state = 'READY';\n if (segmentInfo.isSyncRequest) {\n this.trigger('syncinfoupdate'); // if the sync request was not appended\n // then it was not the correct segment.\n // throw it away and use the data it gave us\n // to get the correct one.\n\n if (!segmentInfo.hasAppendedData_) {\n this.logger_(`Throwing away un-appended sync request ${segmentInfoString(segmentInfo)}`);\n return;\n }\n }\n this.logger_(`Appended ${segmentInfoString(segmentInfo)}`);\n this.addSegmentMetadataCue_(segmentInfo);\n this.fetchAtBuffer_ = true;\n if (this.currentTimeline_ !== segmentInfo.timeline) {\n this.timelineChangeController_.lastTimelineChange({\n type: this.loaderType_,\n from: this.currentTimeline_,\n to: segmentInfo.timeline\n }); // If audio is not disabled, the main segment loader is responsible for updating\n // the audio timeline as well. If the content is video only, this won't have any\n // impact.\n\n if (this.loaderType_ === 'main' && !this.audioDisabled_) {\n this.timelineChangeController_.lastTimelineChange({\n type: 'audio',\n from: this.currentTimeline_,\n to: segmentInfo.timeline\n });\n }\n }\n this.currentTimeline_ = segmentInfo.timeline; // We must update the syncinfo to recalculate the seekable range before\n // the following conditional otherwise it may consider this a bad \"guess\"\n // and attempt to resync when the post-update seekable window and live\n // point would mean that this was the perfect segment to fetch\n\n this.trigger('syncinfoupdate');\n const segment = segmentInfo.segment;\n const part = segmentInfo.part;\n const badSegmentGuess = segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3;\n const badPartGuess = part && part.end && this.currentTime_() - part.end > segmentInfo.playlist.partTargetDuration * 3; // If we previously appended a segment/part that ends more than 3 part/targetDurations before\n // the currentTime_ that means that our conservative guess was too conservative.\n // In that case, reset the loader state so that we try to use any information gained\n // from the previous request to create a new, more accurate, sync-point.\n\n if (badSegmentGuess || badPartGuess) {\n this.logger_(`bad ${badSegmentGuess ? 'segment' : 'part'} ${segmentInfoString(segmentInfo)}`);\n this.resetEverything();\n return;\n }\n const isWalkingForward = this.mediaIndex !== null; // Don't do a rendition switch unless we have enough time to get a sync segment\n // and conservatively guess\n\n if (isWalkingForward) {\n this.trigger('bandwidthupdate');\n }\n this.trigger('progress');\n this.mediaIndex = segmentInfo.mediaIndex;\n this.partIndex = segmentInfo.partIndex; // any time an update finishes and the last segment is in the\n // buffer, end the stream. this ensures the \"ended\" event will\n // fire if playback reaches that point.\n\n if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) {\n this.endOfStream();\n } // used for testing\n\n this.trigger('appended');\n if (segmentInfo.hasAppendedData_) {\n this.mediaAppends++;\n }\n if (!this.paused()) {\n this.monitorBuffer_();\n }\n }\n /**\n * Records the current throughput of the decrypt, transmux, and append\n * portion of the semgment pipeline. `throughput.rate` is a the cumulative\n * moving average of the throughput. `throughput.count` is the number of\n * data points in the average.\n *\n * @private\n * @param {Object} segmentInfo the object returned by loadSegment\n */\n\n recordThroughput_(segmentInfo) {\n if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) {\n this.logger_(`Ignoring segment's throughput because its duration of ${segmentInfo.duration}` + ` is less than the min to record ${MIN_SEGMENT_DURATION_TO_SAVE_STATS}`);\n return;\n }\n const rate = this.throughput.rate; // Add one to the time to ensure that we don't accidentally attempt to divide\n // by zero in the case where the throughput is ridiculously high\n\n const segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1; // Multiply by 8000 to convert from bytes/millisecond to bits/second\n\n const segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1000); // This is just a cumulative moving average calculation:\n // newAvg = oldAvg + (sample - oldAvg) / (sampleCount + 1)\n\n this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count;\n }\n /**\n * Adds a cue to the segment-metadata track with some metadata information about the\n * segment\n *\n * @private\n * @param {Object} segmentInfo\n * the object returned by loadSegment\n * @method addSegmentMetadataCue_\n */\n\n addSegmentMetadataCue_(segmentInfo) {\n if (!this.segmentMetadataTrack_) {\n return;\n }\n const segment = segmentInfo.segment;\n const start = segment.start;\n const end = segment.end; // Do not try adding the cue if the start and end times are invalid.\n\n if (!finite(start) || !finite(end)) {\n return;\n }\n removeCuesFromTrack(start, end, this.segmentMetadataTrack_);\n const Cue = (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebKitDataCue) || (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue);\n const value = {\n custom: segment.custom,\n dateTimeObject: segment.dateTimeObject,\n dateTimeString: segment.dateTimeString,\n programDateTime: segment.programDateTime,\n bandwidth: segmentInfo.playlist.attributes.BANDWIDTH,\n resolution: segmentInfo.playlist.attributes.RESOLUTION,\n codecs: segmentInfo.playlist.attributes.CODECS,\n byteLength: segmentInfo.byteLength,\n uri: segmentInfo.uri,\n timeline: segmentInfo.timeline,\n playlist: segmentInfo.playlist.id,\n start,\n end\n };\n const data = JSON.stringify(value);\n const cue = new Cue(start, end, data); // Attach the metadata to the value property of the cue to keep consistency between\n // the differences of WebKitDataCue in safari and VTTCue in other browsers\n\n cue.value = value;\n this.segmentMetadataTrack_.addCue(cue);\n }\n}\nfunction noop() {}\nconst toTitleCase = function (string) {\n if (typeof string !== 'string') {\n return string;\n }\n return string.replace(/./, w => w.toUpperCase());\n};\n\n/**\n * @file source-updater.js\n */\nconst bufferTypes = ['video', 'audio'];\nconst updating = (type, sourceUpdater) => {\n const sourceBuffer = sourceUpdater[`${type}Buffer`];\n return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type];\n};\nconst nextQueueIndexOfType = (type, queue) => {\n for (let i = 0; i < queue.length; i++) {\n const queueEntry = queue[i];\n if (queueEntry.type === 'mediaSource') {\n // If the next entry is a media source entry (uses multiple source buffers), block\n // processing to allow it to go through first.\n return null;\n }\n if (queueEntry.type === type) {\n return i;\n }\n }\n return null;\n};\nconst shiftQueue = (type, sourceUpdater) => {\n if (sourceUpdater.queue.length === 0) {\n return;\n }\n let queueIndex = 0;\n let queueEntry = sourceUpdater.queue[queueIndex];\n if (queueEntry.type === 'mediaSource') {\n if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== 'closed') {\n sourceUpdater.queue.shift();\n queueEntry.action(sourceUpdater);\n if (queueEntry.doneFn) {\n queueEntry.doneFn();\n } // Only specific source buffer actions must wait for async updateend events. Media\n // Source actions process synchronously. Therefore, both audio and video source\n // buffers are now clear to process the next queue entries.\n\n shiftQueue('audio', sourceUpdater);\n shiftQueue('video', sourceUpdater);\n } // Media Source actions require both source buffers, so if the media source action\n // couldn't process yet (because one or both source buffers are busy), block other\n // queue actions until both are available and the media source action can process.\n\n return;\n }\n if (type === 'mediaSource') {\n // If the queue was shifted by a media source action (this happens when pushing a\n // media source action onto the queue), then it wasn't from an updateend event from an\n // audio or video source buffer, so there's no change from previous state, and no\n // processing should be done.\n return;\n } // Media source queue entries don't need to consider whether the source updater is\n // started (i.e., source buffers are created) as they don't need the source buffers, but\n // source buffer queue entries do.\n\n if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === 'closed' || updating(type, sourceUpdater)) {\n return;\n }\n if (queueEntry.type !== type) {\n queueIndex = nextQueueIndexOfType(type, sourceUpdater.queue);\n if (queueIndex === null) {\n // Either there's no queue entry that uses this source buffer type in the queue, or\n // there's a media source queue entry before the next entry of this type, in which\n // case wait for that action to process first.\n return;\n }\n queueEntry = sourceUpdater.queue[queueIndex];\n }\n sourceUpdater.queue.splice(queueIndex, 1); // Keep a record that this source buffer type is in use.\n //\n // The queue pending operation must be set before the action is performed in the event\n // that the action results in a synchronous event that is acted upon. For instance, if\n // an exception is thrown that can be handled, it's possible that new actions will be\n // appended to an empty queue and immediately executed, but would not have the correct\n // pending information if this property was set after the action was performed.\n\n sourceUpdater.queuePending[type] = queueEntry;\n queueEntry.action(type, sourceUpdater);\n if (!queueEntry.doneFn) {\n // synchronous operation, process next entry\n sourceUpdater.queuePending[type] = null;\n shiftQueue(type, sourceUpdater);\n return;\n }\n};\nconst cleanupBuffer = (type, sourceUpdater) => {\n const buffer = sourceUpdater[`${type}Buffer`];\n const titleType = toTitleCase(type);\n if (!buffer) {\n return;\n }\n buffer.removeEventListener('updateend', sourceUpdater[`on${titleType}UpdateEnd_`]);\n buffer.removeEventListener('error', sourceUpdater[`on${titleType}Error_`]);\n sourceUpdater.codecs[type] = null;\n sourceUpdater[`${type}Buffer`] = null;\n};\nconst inSourceBuffers = (mediaSource, sourceBuffer) => mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1;\nconst actions = {\n appendBuffer: (bytes, segmentInfo, onError) => (type, sourceUpdater) => {\n const sourceBuffer = sourceUpdater[`${type}Buffer`]; // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n }\n sourceUpdater.logger_(`Appending segment ${segmentInfo.mediaIndex}'s ${bytes.length} bytes to ${type}Buffer`);\n try {\n sourceBuffer.appendBuffer(bytes);\n } catch (e) {\n sourceUpdater.logger_(`Error with code ${e.code} ` + (e.code === QUOTA_EXCEEDED_ERR ? '(QUOTA_EXCEEDED_ERR) ' : '') + `when appending segment ${segmentInfo.mediaIndex} to ${type}Buffer`);\n sourceUpdater.queuePending[type] = null;\n onError(e);\n }\n },\n remove: (start, end) => (type, sourceUpdater) => {\n const sourceBuffer = sourceUpdater[`${type}Buffer`]; // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n }\n sourceUpdater.logger_(`Removing ${start} to ${end} from ${type}Buffer`);\n try {\n sourceBuffer.remove(start, end);\n } catch (e) {\n sourceUpdater.logger_(`Remove ${start} to ${end} from ${type}Buffer failed`);\n }\n },\n timestampOffset: offset => (type, sourceUpdater) => {\n const sourceBuffer = sourceUpdater[`${type}Buffer`]; // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n }\n sourceUpdater.logger_(`Setting ${type}timestampOffset to ${offset}`);\n sourceBuffer.timestampOffset = offset;\n },\n callback: callback => (type, sourceUpdater) => {\n callback();\n },\n endOfStream: error => sourceUpdater => {\n if (sourceUpdater.mediaSource.readyState !== 'open') {\n return;\n }\n sourceUpdater.logger_(`Calling mediaSource endOfStream(${error || ''})`);\n try {\n sourceUpdater.mediaSource.endOfStream(error);\n } catch (e) {\n videojs.log.warn('Failed to call media source endOfStream', e);\n }\n },\n duration: duration => sourceUpdater => {\n sourceUpdater.logger_(`Setting mediaSource duration to ${duration}`);\n try {\n sourceUpdater.mediaSource.duration = duration;\n } catch (e) {\n videojs.log.warn('Failed to set media source duration', e);\n }\n },\n abort: () => (type, sourceUpdater) => {\n if (sourceUpdater.mediaSource.readyState !== 'open') {\n return;\n }\n const sourceBuffer = sourceUpdater[`${type}Buffer`]; // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n }\n sourceUpdater.logger_(`calling abort on ${type}Buffer`);\n try {\n sourceBuffer.abort();\n } catch (e) {\n videojs.log.warn(`Failed to abort on ${type}Buffer`, e);\n }\n },\n addSourceBuffer: (type, codec) => sourceUpdater => {\n const titleType = toTitleCase(type);\n const mime = (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.getMimeForCodec)(codec);\n sourceUpdater.logger_(`Adding ${type}Buffer with codec ${codec} to mediaSource`);\n const sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime);\n sourceBuffer.addEventListener('updateend', sourceUpdater[`on${titleType}UpdateEnd_`]);\n sourceBuffer.addEventListener('error', sourceUpdater[`on${titleType}Error_`]);\n sourceUpdater.codecs[type] = codec;\n sourceUpdater[`${type}Buffer`] = sourceBuffer;\n },\n removeSourceBuffer: type => sourceUpdater => {\n const sourceBuffer = sourceUpdater[`${type}Buffer`];\n cleanupBuffer(type, sourceUpdater); // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n }\n sourceUpdater.logger_(`Removing ${type}Buffer with codec ${sourceUpdater.codecs[type]} from mediaSource`);\n try {\n sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer);\n } catch (e) {\n videojs.log.warn(`Failed to removeSourceBuffer ${type}Buffer`, e);\n }\n },\n changeType: codec => (type, sourceUpdater) => {\n const sourceBuffer = sourceUpdater[`${type}Buffer`];\n const mime = (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.getMimeForCodec)(codec); // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n } // do not update codec if we don't need to.\n\n if (sourceUpdater.codecs[type] === codec) {\n return;\n }\n sourceUpdater.logger_(`changing ${type}Buffer codec from ${sourceUpdater.codecs[type]} to ${codec}`);\n sourceBuffer.changeType(mime);\n sourceUpdater.codecs[type] = codec;\n }\n};\nconst pushQueue = ({\n type,\n sourceUpdater,\n action,\n doneFn,\n name\n}) => {\n sourceUpdater.queue.push({\n type,\n action,\n doneFn,\n name\n });\n shiftQueue(type, sourceUpdater);\n};\nconst onUpdateend = (type, sourceUpdater) => e => {\n // Although there should, in theory, be a pending action for any updateend receieved,\n // there are some actions that may trigger updateend events without set definitions in\n // the w3c spec. For instance, setting the duration on the media source may trigger\n // updateend events on source buffers. This does not appear to be in the spec. As such,\n // if we encounter an updateend without a corresponding pending action from our queue\n // for that source buffer type, process the next action.\n if (sourceUpdater.queuePending[type]) {\n const doneFn = sourceUpdater.queuePending[type].doneFn;\n sourceUpdater.queuePending[type] = null;\n if (doneFn) {\n // if there's an error, report it\n doneFn(sourceUpdater[`${type}Error_`]);\n }\n }\n shiftQueue(type, sourceUpdater);\n};\n/**\n * A queue of callbacks to be serialized and applied when a\n * MediaSource and its associated SourceBuffers are not in the\n * updating state. It is used by the segment loader to update the\n * underlying SourceBuffers when new data is loaded, for instance.\n *\n * @class SourceUpdater\n * @param {MediaSource} mediaSource the MediaSource to create the SourceBuffer from\n * @param {string} mimeType the desired MIME type of the underlying SourceBuffer\n */\n\nclass SourceUpdater extends videojs.EventTarget {\n constructor(mediaSource) {\n super();\n this.mediaSource = mediaSource;\n this.sourceopenListener_ = () => shiftQueue('mediaSource', this);\n this.mediaSource.addEventListener('sourceopen', this.sourceopenListener_);\n this.logger_ = logger('SourceUpdater'); // initial timestamp offset is 0\n\n this.audioTimestampOffset_ = 0;\n this.videoTimestampOffset_ = 0;\n this.queue = [];\n this.queuePending = {\n audio: null,\n video: null\n };\n this.delayedAudioAppendQueue_ = [];\n this.videoAppendQueued_ = false;\n this.codecs = {};\n this.onVideoUpdateEnd_ = onUpdateend('video', this);\n this.onAudioUpdateEnd_ = onUpdateend('audio', this);\n this.onVideoError_ = e => {\n // used for debugging\n this.videoError_ = e;\n };\n this.onAudioError_ = e => {\n // used for debugging\n this.audioError_ = e;\n };\n this.createdSourceBuffers_ = false;\n this.initializedEme_ = false;\n this.triggeredReady_ = false;\n }\n initializedEme() {\n this.initializedEme_ = true;\n this.triggerReady();\n }\n hasCreatedSourceBuffers() {\n // if false, likely waiting on one of the segment loaders to get enough data to create\n // source buffers\n return this.createdSourceBuffers_;\n }\n hasInitializedAnyEme() {\n return this.initializedEme_;\n }\n ready() {\n return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme();\n }\n createSourceBuffers(codecs) {\n if (this.hasCreatedSourceBuffers()) {\n // already created them before\n return;\n } // the intial addOrChangeSourceBuffers will always be\n // two add buffers.\n\n this.addOrChangeSourceBuffers(codecs);\n this.createdSourceBuffers_ = true;\n this.trigger('createdsourcebuffers');\n this.triggerReady();\n }\n triggerReady() {\n // only allow ready to be triggered once, this prevents the case\n // where:\n // 1. we trigger createdsourcebuffers\n // 2. ie 11 synchronously initializates eme\n // 3. the synchronous initialization causes us to trigger ready\n // 4. We go back to the ready check in createSourceBuffers and ready is triggered again.\n if (this.ready() && !this.triggeredReady_) {\n this.triggeredReady_ = true;\n this.trigger('ready');\n }\n }\n /**\n * Add a type of source buffer to the media source.\n *\n * @param {string} type\n * The type of source buffer to add.\n *\n * @param {string} codec\n * The codec to add the source buffer with.\n */\n\n addSourceBuffer(type, codec) {\n pushQueue({\n type: 'mediaSource',\n sourceUpdater: this,\n action: actions.addSourceBuffer(type, codec),\n name: 'addSourceBuffer'\n });\n }\n /**\n * call abort on a source buffer.\n *\n * @param {string} type\n * The type of source buffer to call abort on.\n */\n\n abort(type) {\n pushQueue({\n type,\n sourceUpdater: this,\n action: actions.abort(type),\n name: 'abort'\n });\n }\n /**\n * Call removeSourceBuffer and remove a specific type\n * of source buffer on the mediaSource.\n *\n * @param {string} type\n * The type of source buffer to remove.\n */\n\n removeSourceBuffer(type) {\n if (!this.canRemoveSourceBuffer()) {\n videojs.log.error('removeSourceBuffer is not supported!');\n return;\n }\n pushQueue({\n type: 'mediaSource',\n sourceUpdater: this,\n action: actions.removeSourceBuffer(type),\n name: 'removeSourceBuffer'\n });\n }\n /**\n * Whether or not the removeSourceBuffer function is supported\n * on the mediaSource.\n *\n * @return {boolean}\n * if removeSourceBuffer can be called.\n */\n\n canRemoveSourceBuffer() {\n // As of Firefox 83 removeSourceBuffer\n // throws errors, so we report that it does not support this.\n return !videojs.browser.IS_FIREFOX && (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource).prototype && typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource).prototype.removeSourceBuffer === 'function';\n }\n /**\n * Whether or not the changeType function is supported\n * on our SourceBuffers.\n *\n * @return {boolean}\n * if changeType can be called.\n */\n\n static canChangeType() {\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default().SourceBuffer) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().SourceBuffer).prototype && typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().SourceBuffer).prototype.changeType === 'function';\n }\n /**\n * Whether or not the changeType function is supported\n * on our SourceBuffers.\n *\n * @return {boolean}\n * if changeType can be called.\n */\n\n canChangeType() {\n return this.constructor.canChangeType();\n }\n /**\n * Call the changeType function on a source buffer, given the code and type.\n *\n * @param {string} type\n * The type of source buffer to call changeType on.\n *\n * @param {string} codec\n * The codec string to change type with on the source buffer.\n */\n\n changeType(type, codec) {\n if (!this.canChangeType()) {\n videojs.log.error('changeType is not supported!');\n return;\n }\n pushQueue({\n type,\n sourceUpdater: this,\n action: actions.changeType(codec),\n name: 'changeType'\n });\n }\n /**\n * Add source buffers with a codec or, if they are already created,\n * call changeType on source buffers using changeType.\n *\n * @param {Object} codecs\n * Codecs to switch to\n */\n\n addOrChangeSourceBuffers(codecs) {\n if (!codecs || typeof codecs !== 'object' || Object.keys(codecs).length === 0) {\n throw new Error('Cannot addOrChangeSourceBuffers to undefined codecs');\n }\n Object.keys(codecs).forEach(type => {\n const codec = codecs[type];\n if (!this.hasCreatedSourceBuffers()) {\n return this.addSourceBuffer(type, codec);\n }\n if (this.canChangeType()) {\n this.changeType(type, codec);\n }\n });\n }\n /**\n * Queue an update to append an ArrayBuffer.\n *\n * @param {MediaObject} object containing audioBytes and/or videoBytes\n * @param {Function} done the function to call when done\n * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-appendBuffer-void-ArrayBuffer-data\n */\n\n appendBuffer(options, doneFn) {\n const {\n segmentInfo,\n type,\n bytes\n } = options;\n this.processedAppend_ = true;\n if (type === 'audio' && this.videoBuffer && !this.videoAppendQueued_) {\n this.delayedAudioAppendQueue_.push([options, doneFn]);\n this.logger_(`delayed audio append of ${bytes.length} until video append`);\n return;\n } // In the case of certain errors, for instance, QUOTA_EXCEEDED_ERR, updateend will\n // not be fired. This means that the queue will be blocked until the next action\n // taken by the segment-loader. Provide a mechanism for segment-loader to handle\n // these errors by calling the doneFn with the specific error.\n\n const onError = doneFn;\n pushQueue({\n type,\n sourceUpdater: this,\n action: actions.appendBuffer(bytes, segmentInfo || {\n mediaIndex: -1\n }, onError),\n doneFn,\n name: 'appendBuffer'\n });\n if (type === 'video') {\n this.videoAppendQueued_ = true;\n if (!this.delayedAudioAppendQueue_.length) {\n return;\n }\n const queue = this.delayedAudioAppendQueue_.slice();\n this.logger_(`queuing delayed audio ${queue.length} appendBuffers`);\n this.delayedAudioAppendQueue_.length = 0;\n queue.forEach(que => {\n this.appendBuffer.apply(this, que);\n });\n }\n }\n /**\n * Get the audio buffer's buffered timerange.\n *\n * @return {TimeRange}\n * The audio buffer's buffered time range\n */\n\n audioBuffered() {\n // no media source/source buffer or it isn't in the media sources\n // source buffer list\n if (!inSourceBuffers(this.mediaSource, this.audioBuffer)) {\n return createTimeRanges();\n }\n return this.audioBuffer.buffered ? this.audioBuffer.buffered : createTimeRanges();\n }\n /**\n * Get the video buffer's buffered timerange.\n *\n * @return {TimeRange}\n * The video buffer's buffered time range\n */\n\n videoBuffered() {\n // no media source/source buffer or it isn't in the media sources\n // source buffer list\n if (!inSourceBuffers(this.mediaSource, this.videoBuffer)) {\n return createTimeRanges();\n }\n return this.videoBuffer.buffered ? this.videoBuffer.buffered : createTimeRanges();\n }\n /**\n * Get a combined video/audio buffer's buffered timerange.\n *\n * @return {TimeRange}\n * the combined time range\n */\n\n buffered() {\n const video = inSourceBuffers(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null;\n const audio = inSourceBuffers(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null;\n if (audio && !video) {\n return this.audioBuffered();\n }\n if (video && !audio) {\n return this.videoBuffered();\n }\n return bufferIntersection(this.audioBuffered(), this.videoBuffered());\n }\n /**\n * Add a callback to the queue that will set duration on the mediaSource.\n *\n * @param {number} duration\n * The duration to set\n *\n * @param {Function} [doneFn]\n * function to run after duration has been set.\n */\n\n setDuration(duration, doneFn = noop) {\n // In order to set the duration on the media source, it's necessary to wait for all\n // source buffers to no longer be updating. \"If the updating attribute equals true on\n // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and\n // abort these steps.\" (source: https://www.w3.org/TR/media-source/#attributes).\n pushQueue({\n type: 'mediaSource',\n sourceUpdater: this,\n action: actions.duration(duration),\n name: 'duration',\n doneFn\n });\n }\n /**\n * Add a mediaSource endOfStream call to the queue\n *\n * @param {Error} [error]\n * Call endOfStream with an error\n *\n * @param {Function} [doneFn]\n * A function that should be called when the\n * endOfStream call has finished.\n */\n\n endOfStream(error = null, doneFn = noop) {\n if (typeof error !== 'string') {\n error = undefined;\n } // In order to set the duration on the media source, it's necessary to wait for all\n // source buffers to no longer be updating. \"If the updating attribute equals true on\n // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and\n // abort these steps.\" (source: https://www.w3.org/TR/media-source/#attributes).\n\n pushQueue({\n type: 'mediaSource',\n sourceUpdater: this,\n action: actions.endOfStream(error),\n name: 'endOfStream',\n doneFn\n });\n }\n /**\n * Queue an update to remove a time range from the buffer.\n *\n * @param {number} start where to start the removal\n * @param {number} end where to end the removal\n * @param {Function} [done=noop] optional callback to be executed when the remove\n * operation is complete\n * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end\n */\n\n removeAudio(start, end, done = noop) {\n if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) {\n done();\n return;\n }\n pushQueue({\n type: 'audio',\n sourceUpdater: this,\n action: actions.remove(start, end),\n doneFn: done,\n name: 'remove'\n });\n }\n /**\n * Queue an update to remove a time range from the buffer.\n *\n * @param {number} start where to start the removal\n * @param {number} end where to end the removal\n * @param {Function} [done=noop] optional callback to be executed when the remove\n * operation is complete\n * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end\n */\n\n removeVideo(start, end, done = noop) {\n if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) {\n done();\n return;\n }\n pushQueue({\n type: 'video',\n sourceUpdater: this,\n action: actions.remove(start, end),\n doneFn: done,\n name: 'remove'\n });\n }\n /**\n * Whether the underlying sourceBuffer is updating or not\n *\n * @return {boolean} the updating status of the SourceBuffer\n */\n\n updating() {\n // the audio/video source buffer is updating\n if (updating('audio', this) || updating('video', this)) {\n return true;\n }\n return false;\n }\n /**\n * Set/get the timestampoffset on the audio SourceBuffer\n *\n * @return {number} the timestamp offset\n */\n\n audioTimestampOffset(offset) {\n if (typeof offset !== 'undefined' && this.audioBuffer &&\n // no point in updating if it's the same\n this.audioTimestampOffset_ !== offset) {\n pushQueue({\n type: 'audio',\n sourceUpdater: this,\n action: actions.timestampOffset(offset),\n name: 'timestampOffset'\n });\n this.audioTimestampOffset_ = offset;\n }\n return this.audioTimestampOffset_;\n }\n /**\n * Set/get the timestampoffset on the video SourceBuffer\n *\n * @return {number} the timestamp offset\n */\n\n videoTimestampOffset(offset) {\n if (typeof offset !== 'undefined' && this.videoBuffer &&\n // no point in updating if it's the same\n this.videoTimestampOffset !== offset) {\n pushQueue({\n type: 'video',\n sourceUpdater: this,\n action: actions.timestampOffset(offset),\n name: 'timestampOffset'\n });\n this.videoTimestampOffset_ = offset;\n }\n return this.videoTimestampOffset_;\n }\n /**\n * Add a function to the queue that will be called\n * when it is its turn to run in the audio queue.\n *\n * @param {Function} callback\n * The callback to queue.\n */\n\n audioQueueCallback(callback) {\n if (!this.audioBuffer) {\n return;\n }\n pushQueue({\n type: 'audio',\n sourceUpdater: this,\n action: actions.callback(callback),\n name: 'callback'\n });\n }\n /**\n * Add a function to the queue that will be called\n * when it is its turn to run in the video queue.\n *\n * @param {Function} callback\n * The callback to queue.\n */\n\n videoQueueCallback(callback) {\n if (!this.videoBuffer) {\n return;\n }\n pushQueue({\n type: 'video',\n sourceUpdater: this,\n action: actions.callback(callback),\n name: 'callback'\n });\n }\n /**\n * dispose of the source updater and the underlying sourceBuffer\n */\n\n dispose() {\n this.trigger('dispose');\n bufferTypes.forEach(type => {\n this.abort(type);\n if (this.canRemoveSourceBuffer()) {\n this.removeSourceBuffer(type);\n } else {\n this[`${type}QueueCallback`](() => cleanupBuffer(type, this));\n }\n });\n this.videoAppendQueued_ = false;\n this.delayedAudioAppendQueue_.length = 0;\n if (this.sourceopenListener_) {\n this.mediaSource.removeEventListener('sourceopen', this.sourceopenListener_);\n }\n this.off();\n }\n}\nconst uint8ToUtf8 = uintArray => decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray)));\nconst bufferToHexString = buffer => {\n const uInt8Buffer = new Uint8Array(buffer);\n return Array.from(uInt8Buffer).map(byte => byte.toString(16).padStart(2, '0')).join('');\n};\n\n/**\n * @file vtt-segment-loader.js\n */\nconst VTT_LINE_TERMINATORS = new Uint8Array('\\n\\n'.split('').map(char => char.charCodeAt(0)));\nclass NoVttJsError extends Error {\n constructor() {\n super('Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.');\n }\n}\n/**\n * An object that manages segment loading and appending.\n *\n * @class VTTSegmentLoader\n * @param {Object} options required and optional options\n * @extends videojs.EventTarget\n */\n\nclass VTTSegmentLoader extends SegmentLoader {\n constructor(settings, options = {}) {\n super(settings, options); // SegmentLoader requires a MediaSource be specified or it will throw an error;\n // however, VTTSegmentLoader has no need of a media source, so delete the reference\n\n this.mediaSource_ = null;\n this.subtitlesTrack_ = null;\n this.loaderType_ = 'subtitle';\n this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks;\n this.loadVttJs = settings.loadVttJs; // The VTT segment will have its own time mappings. Saving VTT segment timing info in\n // the sync controller leads to improper behavior.\n\n this.shouldSaveSegmentTimingInfo_ = false;\n }\n createTransmuxer_() {\n // don't need to transmux any subtitles\n return null;\n }\n /**\n * Indicates which time ranges are buffered\n *\n * @return {TimeRange}\n * TimeRange object representing the current buffered ranges\n */\n\n buffered_() {\n if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) {\n return createTimeRanges();\n }\n const cues = this.subtitlesTrack_.cues;\n const start = cues[0].startTime;\n const end = cues[cues.length - 1].startTime;\n return createTimeRanges([[start, end]]);\n }\n /**\n * Gets and sets init segment for the provided map\n *\n * @param {Object} map\n * The map object representing the init segment to get or set\n * @param {boolean=} set\n * If true, the init segment for the provided map should be saved\n * @return {Object}\n * map object for desired init segment\n */\n\n initSegmentForMap(map, set = false) {\n if (!map) {\n return null;\n }\n const id = initSegmentId(map);\n let storedMap = this.initSegments_[id];\n if (set && !storedMap && map.bytes) {\n // append WebVTT line terminators to the media initialization segment if it exists\n // to follow the WebVTT spec (https://w3c.github.io/webvtt/#file-structure) that\n // requires two or more WebVTT line terminators between the WebVTT header and the\n // rest of the file\n const combinedByteLength = VTT_LINE_TERMINATORS.byteLength + map.bytes.byteLength;\n const combinedSegment = new Uint8Array(combinedByteLength);\n combinedSegment.set(map.bytes);\n combinedSegment.set(VTT_LINE_TERMINATORS, map.bytes.byteLength);\n this.initSegments_[id] = storedMap = {\n resolvedUri: map.resolvedUri,\n byterange: map.byterange,\n bytes: combinedSegment\n };\n }\n return storedMap || map;\n }\n /**\n * Returns true if all configuration required for loading is present, otherwise false.\n *\n * @return {boolean} True if the all configuration is ready for loading\n * @private\n */\n\n couldBeginLoading_() {\n return this.playlist_ && this.subtitlesTrack_ && !this.paused();\n }\n /**\n * Once all the starting parameters have been specified, begin\n * operation. This method should only be invoked from the INIT\n * state.\n *\n * @private\n */\n\n init_() {\n this.state = 'READY';\n this.resetEverything();\n return this.monitorBuffer_();\n }\n /**\n * Set a subtitle track on the segment loader to add subtitles to\n *\n * @param {TextTrack=} track\n * The text track to add loaded subtitles to\n * @return {TextTrack}\n * Returns the subtitles track\n */\n\n track(track) {\n if (typeof track === 'undefined') {\n return this.subtitlesTrack_;\n }\n this.subtitlesTrack_ = track; // if we were unpaused but waiting for a sourceUpdater, start\n // buffering now\n\n if (this.state === 'INIT' && this.couldBeginLoading_()) {\n this.init_();\n }\n return this.subtitlesTrack_;\n }\n /**\n * Remove any data in the source buffer between start and end times\n *\n * @param {number} start - the start time of the region to remove from the buffer\n * @param {number} end - the end time of the region to remove from the buffer\n */\n\n remove(start, end) {\n removeCuesFromTrack(start, end, this.subtitlesTrack_);\n }\n /**\n * fill the buffer with segements unless the sourceBuffers are\n * currently updating\n *\n * Note: this function should only ever be called by monitorBuffer_\n * and never directly\n *\n * @private\n */\n\n fillBuffer_() {\n // see if we need to begin loading immediately\n const segmentInfo = this.chooseNextRequest_();\n if (!segmentInfo) {\n return;\n }\n if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) {\n // We don't have the timestamp offset that we need to sync subtitles.\n // Rerun on a timestamp offset or user interaction.\n const checkTimestampOffset = () => {\n this.state = 'READY';\n if (!this.paused()) {\n // if not paused, queue a buffer check as soon as possible\n this.monitorBuffer_();\n }\n };\n this.syncController_.one('timestampoffset', checkTimestampOffset);\n this.state = 'WAITING_ON_TIMELINE';\n return;\n }\n this.loadSegment_(segmentInfo);\n } // never set a timestamp offset for vtt segments.\n\n timestampOffsetForSegment_() {\n return null;\n }\n chooseNextRequest_() {\n return this.skipEmptySegments_(super.chooseNextRequest_());\n }\n /**\n * Prevents the segment loader from requesting segments we know contain no subtitles\n * by walking forward until we find the next segment that we don't know whether it is\n * empty or not.\n *\n * @param {Object} segmentInfo\n * a segment info object that describes the current segment\n * @return {Object}\n * a segment info object that describes the current segment\n */\n\n skipEmptySegments_(segmentInfo) {\n while (segmentInfo && segmentInfo.segment.empty) {\n // stop at the last possible segmentInfo\n if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) {\n segmentInfo = null;\n break;\n }\n segmentInfo = this.generateSegmentInfo_({\n playlist: segmentInfo.playlist,\n mediaIndex: segmentInfo.mediaIndex + 1,\n startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration,\n isSyncRequest: segmentInfo.isSyncRequest\n });\n }\n return segmentInfo;\n }\n stopForError(error) {\n this.error(error);\n this.state = 'READY';\n this.pause();\n this.trigger('error');\n }\n /**\n * append a decrypted segement to the SourceBuffer through a SourceUpdater\n *\n * @private\n */\n\n segmentRequestFinished_(error, simpleSegment, result) {\n if (!this.subtitlesTrack_) {\n this.state = 'READY';\n return;\n }\n this.saveTransferStats_(simpleSegment.stats); // the request was aborted\n\n if (!this.pendingSegment_) {\n this.state = 'READY';\n this.mediaRequestsAborted += 1;\n return;\n }\n if (error) {\n if (error.code === REQUEST_ERRORS.TIMEOUT) {\n this.handleTimeout_();\n }\n if (error.code === REQUEST_ERRORS.ABORTED) {\n this.mediaRequestsAborted += 1;\n } else {\n this.mediaRequestsErrored += 1;\n }\n this.stopForError(error);\n return;\n }\n const segmentInfo = this.pendingSegment_; // although the VTT segment loader bandwidth isn't really used, it's good to\n // maintain functionality between segment loaders\n\n this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats); // if this request included a segment key, save that data in the cache\n\n if (simpleSegment.key) {\n this.segmentKey(simpleSegment.key, true);\n }\n this.state = 'APPENDING'; // used for tests\n\n this.trigger('appending');\n const segment = segmentInfo.segment;\n if (segment.map) {\n segment.map.bytes = simpleSegment.map.bytes;\n }\n segmentInfo.bytes = simpleSegment.bytes; // Make sure that vttjs has loaded, otherwise, load it and wait till it finished loading\n\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) !== 'function' && typeof this.loadVttJs === 'function') {\n this.state = 'WAITING_ON_VTTJS'; // should be fine to call multiple times\n // script will be loaded once but multiple listeners will be added to the queue, which is expected.\n\n this.loadVttJs().then(() => this.segmentRequestFinished_(error, simpleSegment, result), () => this.stopForError({\n message: 'Error loading vtt.js'\n }));\n return;\n }\n segment.requested = true;\n try {\n this.parseVTTCues_(segmentInfo);\n } catch (e) {\n this.stopForError({\n message: e.message\n });\n return;\n }\n this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_);\n if (segmentInfo.cues.length) {\n segmentInfo.timingInfo = {\n start: segmentInfo.cues[0].startTime,\n end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime\n };\n } else {\n segmentInfo.timingInfo = {\n start: segmentInfo.startOfSegment,\n end: segmentInfo.startOfSegment + segmentInfo.duration\n };\n }\n if (segmentInfo.isSyncRequest) {\n this.trigger('syncinfoupdate');\n this.pendingSegment_ = null;\n this.state = 'READY';\n return;\n }\n segmentInfo.byteLength = segmentInfo.bytes.byteLength;\n this.mediaSecondsLoaded += segment.duration; // Create VTTCue instances for each cue in the new segment and add them to\n // the subtitle track\n\n segmentInfo.cues.forEach(cue => {\n this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_ ? new (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue)(cue.startTime, cue.endTime, cue.text) : cue);\n }); // Remove any duplicate cues from the subtitle track. The WebVTT spec allows\n // cues to have identical time-intervals, but if the text is also identical\n // we can safely assume it is a duplicate that can be removed (ex. when a cue\n // \"overlaps\" VTT segments)\n\n removeDuplicateCuesFromTrack(this.subtitlesTrack_);\n this.handleAppendsDone_();\n }\n handleData_() {// noop as we shouldn't be getting video/audio data captions\n // that we do not support here.\n }\n updateTimingInfoEnd_() {// noop\n }\n /**\n * Uses the WebVTT parser to parse the segment response\n *\n * @throws NoVttJsError\n *\n * @param {Object} segmentInfo\n * a segment info object that describes the current segment\n * @private\n */\n\n parseVTTCues_(segmentInfo) {\n let decoder;\n let decodeBytesToString = false;\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) !== 'function') {\n // caller is responsible for exception handling.\n throw new NoVttJsError();\n }\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().TextDecoder) === 'function') {\n decoder = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().TextDecoder)('utf8');\n } else {\n decoder = global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT.StringDecoder();\n decodeBytesToString = true;\n }\n const parser = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT).Parser((global_window__WEBPACK_IMPORTED_MODULE_0___default()), (global_window__WEBPACK_IMPORTED_MODULE_0___default().vttjs), decoder);\n segmentInfo.cues = [];\n segmentInfo.timestampmap = {\n MPEGTS: 0,\n LOCAL: 0\n };\n parser.oncue = segmentInfo.cues.push.bind(segmentInfo.cues);\n parser.ontimestampmap = map => {\n segmentInfo.timestampmap = map;\n };\n parser.onparsingerror = error => {\n videojs.log.warn('Error encountered when parsing cues: ' + error.message);\n };\n if (segmentInfo.segment.map) {\n let mapData = segmentInfo.segment.map.bytes;\n if (decodeBytesToString) {\n mapData = uint8ToUtf8(mapData);\n }\n parser.parse(mapData);\n }\n let segmentData = segmentInfo.bytes;\n if (decodeBytesToString) {\n segmentData = uint8ToUtf8(segmentData);\n }\n parser.parse(segmentData);\n parser.flush();\n }\n /**\n * Updates the start and end times of any cues parsed by the WebVTT parser using\n * the information parsed from the X-TIMESTAMP-MAP header and a TS to media time mapping\n * from the SyncController\n *\n * @param {Object} segmentInfo\n * a segment info object that describes the current segment\n * @param {Object} mappingObj\n * object containing a mapping from TS to media time\n * @param {Object} playlist\n * the playlist object containing the segment\n * @private\n */\n\n updateTimeMapping_(segmentInfo, mappingObj, playlist) {\n const segment = segmentInfo.segment;\n if (!mappingObj) {\n // If the sync controller does not have a mapping of TS to Media Time for the\n // timeline, then we don't have enough information to update the cue\n // start/end times\n return;\n }\n if (!segmentInfo.cues.length) {\n // If there are no cues, we also do not have enough information to figure out\n // segment timing. Mark that the segment contains no cues so we don't re-request\n // an empty segment.\n segment.empty = true;\n return;\n }\n const timestampmap = segmentInfo.timestampmap;\n const diff = timestampmap.MPEGTS / mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_16__.ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping;\n segmentInfo.cues.forEach(cue => {\n // First convert cue time to TS time using the timestamp-map provided within the vtt\n cue.startTime += diff;\n cue.endTime += diff;\n });\n if (!playlist.syncInfo) {\n const firstStart = segmentInfo.cues[0].startTime;\n const lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime;\n playlist.syncInfo = {\n mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex,\n time: Math.min(firstStart, lastStart - segment.duration)\n };\n }\n }\n}\n\n/**\n * @file ad-cue-tags.js\n */\n/**\n * Searches for an ad cue that overlaps with the given mediaTime\n *\n * @param {Object} track\n * the track to find the cue for\n *\n * @param {number} mediaTime\n * the time to find the cue at\n *\n * @return {Object|null}\n * the found cue or null\n */\n\nconst findAdCue = function (track, mediaTime) {\n const cues = track.cues;\n for (let i = 0; i < cues.length; i++) {\n const cue = cues[i];\n if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) {\n return cue;\n }\n }\n return null;\n};\nconst updateAdCues = function (media, track, offset = 0) {\n if (!media.segments) {\n return;\n }\n let mediaTime = offset;\n let cue;\n for (let i = 0; i < media.segments.length; i++) {\n const segment = media.segments[i];\n if (!cue) {\n // Since the cues will span for at least the segment duration, adding a fudge\n // factor of half segment duration will prevent duplicate cues from being\n // created when timing info is not exact (e.g. cue start time initialized\n // at 10.006677, but next call mediaTime is 10.003332 )\n cue = findAdCue(track, mediaTime + segment.duration / 2);\n }\n if (cue) {\n if ('cueIn' in segment) {\n // Found a CUE-IN so end the cue\n cue.endTime = mediaTime;\n cue.adEndTime = mediaTime;\n mediaTime += segment.duration;\n cue = null;\n continue;\n }\n if (mediaTime < cue.endTime) {\n // Already processed this mediaTime for this cue\n mediaTime += segment.duration;\n continue;\n } // otherwise extend cue until a CUE-IN is found\n\n cue.endTime += segment.duration;\n } else {\n if ('cueOut' in segment) {\n cue = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue)(mediaTime, mediaTime + segment.duration, segment.cueOut);\n cue.adStartTime = mediaTime; // Assumes tag format to be\n // #EXT-X-CUE-OUT:30\n\n cue.adEndTime = mediaTime + parseFloat(segment.cueOut);\n track.addCue(cue);\n }\n if ('cueOutCont' in segment) {\n // Entered into the middle of an ad cue\n // Assumes tag formate to be\n // #EXT-X-CUE-OUT-CONT:10/30\n const [adOffset, adTotal] = segment.cueOutCont.split('/').map(parseFloat);\n cue = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue)(mediaTime, mediaTime + segment.duration, '');\n cue.adStartTime = mediaTime - adOffset;\n cue.adEndTime = cue.adStartTime + adTotal;\n track.addCue(cue);\n }\n }\n mediaTime += segment.duration;\n }\n};\n\n/**\n * @file sync-controller.js\n */\n// synchronize expired playlist segments.\n// the max media sequence diff is 48 hours of live stream\n// content with two second segments. Anything larger than that\n// will likely be invalid.\n\nconst MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC = 86400;\nconst syncPointStrategies = [\n// Stategy \"VOD\": Handle the VOD-case where the sync-point is *always*\n// the equivalence display-time 0 === segment-index 0\n{\n name: 'VOD',\n run: (syncController, playlist, duration, currentTimeline, currentTime) => {\n if (duration !== Infinity) {\n const syncPoint = {\n time: 0,\n segmentIndex: 0,\n partIndex: null\n };\n return syncPoint;\n }\n return null;\n }\n}, {\n name: 'MediaSequence',\n /**\n * run media sequence strategy\n *\n * @param {SyncController} syncController\n * @param {Object} playlist\n * @param {number} duration\n * @param {number} currentTimeline\n * @param {number} currentTime\n * @param {string} type\n */\n run: (syncController, playlist, duration, currentTimeline, currentTime, type) => {\n if (!type) {\n return null;\n }\n const mediaSequenceMap = syncController.getMediaSequenceMap(type);\n if (!mediaSequenceMap || mediaSequenceMap.size === 0) {\n return null;\n }\n if (playlist.mediaSequence === undefined || !Array.isArray(playlist.segments) || !playlist.segments.length) {\n return null;\n }\n let currentMediaSequence = playlist.mediaSequence;\n let segmentIndex = 0;\n for (const segment of playlist.segments) {\n const range = mediaSequenceMap.get(currentMediaSequence);\n if (!range) {\n // unexpected case\n // we expect this playlist to be the same playlist in the map\n // just break from the loop and move forward to the next strategy\n break;\n }\n if (currentTime >= range.start && currentTime < range.end) {\n // we found segment\n if (Array.isArray(segment.parts) && segment.parts.length) {\n let currentPartStart = range.start;\n let partIndex = 0;\n for (const part of segment.parts) {\n const start = currentPartStart;\n const end = start + part.duration;\n if (currentTime >= start && currentTime < end) {\n return {\n time: range.start,\n segmentIndex,\n partIndex\n };\n }\n partIndex++;\n currentPartStart = end;\n }\n } // no parts found, return sync point for segment\n\n return {\n time: range.start,\n segmentIndex,\n partIndex: null\n };\n }\n segmentIndex++;\n currentMediaSequence++;\n } // we didn't find any segments for provided current time\n\n return null;\n }\n},\n// Stategy \"ProgramDateTime\": We have a program-date-time tag in this playlist\n{\n name: 'ProgramDateTime',\n run: (syncController, playlist, duration, currentTimeline, currentTime) => {\n if (!Object.keys(syncController.timelineToDatetimeMappings).length) {\n return null;\n }\n let syncPoint = null;\n let lastDistance = null;\n const partsAndSegments = getPartsAndSegments(playlist);\n currentTime = currentTime || 0;\n for (let i = 0; i < partsAndSegments.length; i++) {\n // start from the end and loop backwards for live\n // or start from the front and loop forwards for non-live\n const index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1);\n const partAndSegment = partsAndSegments[index];\n const segment = partAndSegment.segment;\n const datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline];\n if (!datetimeMapping || !segment.dateTimeObject) {\n continue;\n }\n const segmentTime = segment.dateTimeObject.getTime() / 1000;\n let start = segmentTime + datetimeMapping; // take part duration into account.\n\n if (segment.parts && typeof partAndSegment.partIndex === 'number') {\n for (let z = 0; z < partAndSegment.partIndex; z++) {\n start += segment.parts[z].duration;\n }\n }\n const distance = Math.abs(currentTime - start); // Once the distance begins to increase, or if distance is 0, we have passed\n // currentTime and can stop looking for better candidates\n\n if (lastDistance !== null && (distance === 0 || lastDistance < distance)) {\n break;\n }\n lastDistance = distance;\n syncPoint = {\n time: start,\n segmentIndex: partAndSegment.segmentIndex,\n partIndex: partAndSegment.partIndex\n };\n }\n return syncPoint;\n }\n},\n// Stategy \"Segment\": We have a known time mapping for a timeline and a\n// segment in the current timeline with timing data\n{\n name: 'Segment',\n run: (syncController, playlist, duration, currentTimeline, currentTime) => {\n let syncPoint = null;\n let lastDistance = null;\n currentTime = currentTime || 0;\n const partsAndSegments = getPartsAndSegments(playlist);\n for (let i = 0; i < partsAndSegments.length; i++) {\n // start from the end and loop backwards for live\n // or start from the front and loop forwards for non-live\n const index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1);\n const partAndSegment = partsAndSegments[index];\n const segment = partAndSegment.segment;\n const start = partAndSegment.part && partAndSegment.part.start || segment && segment.start;\n if (segment.timeline === currentTimeline && typeof start !== 'undefined') {\n const distance = Math.abs(currentTime - start); // Once the distance begins to increase, we have passed\n // currentTime and can stop looking for better candidates\n\n if (lastDistance !== null && lastDistance < distance) {\n break;\n }\n if (!syncPoint || lastDistance === null || lastDistance >= distance) {\n lastDistance = distance;\n syncPoint = {\n time: start,\n segmentIndex: partAndSegment.segmentIndex,\n partIndex: partAndSegment.partIndex\n };\n }\n }\n }\n return syncPoint;\n }\n},\n// Stategy \"Discontinuity\": We have a discontinuity with a known\n// display-time\n{\n name: 'Discontinuity',\n run: (syncController, playlist, duration, currentTimeline, currentTime) => {\n let syncPoint = null;\n currentTime = currentTime || 0;\n if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {\n let lastDistance = null;\n for (let i = 0; i < playlist.discontinuityStarts.length; i++) {\n const segmentIndex = playlist.discontinuityStarts[i];\n const discontinuity = playlist.discontinuitySequence + i + 1;\n const discontinuitySync = syncController.discontinuities[discontinuity];\n if (discontinuitySync) {\n const distance = Math.abs(currentTime - discontinuitySync.time); // Once the distance begins to increase, we have passed\n // currentTime and can stop looking for better candidates\n\n if (lastDistance !== null && lastDistance < distance) {\n break;\n }\n if (!syncPoint || lastDistance === null || lastDistance >= distance) {\n lastDistance = distance;\n syncPoint = {\n time: discontinuitySync.time,\n segmentIndex,\n partIndex: null\n };\n }\n }\n }\n }\n return syncPoint;\n }\n},\n// Stategy \"Playlist\": We have a playlist with a known mapping of\n// segment index to display time\n{\n name: 'Playlist',\n run: (syncController, playlist, duration, currentTimeline, currentTime) => {\n if (playlist.syncInfo) {\n const syncPoint = {\n time: playlist.syncInfo.time,\n segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence,\n partIndex: null\n };\n return syncPoint;\n }\n return null;\n }\n}];\nclass SyncController extends videojs.EventTarget {\n constructor(options = {}) {\n super(); // ...for synching across variants\n\n this.timelines = [];\n this.discontinuities = [];\n this.timelineToDatetimeMappings = {};\n /**\n * @type {Map<string, Map<number, { start: number, end: number }>>}\n * @private\n */\n\n this.mediaSequenceStorage_ = new Map();\n this.logger_ = logger('SyncController');\n }\n /**\n * Get media sequence map by type\n *\n * @param {string} type - segment loader type\n * @return {Map<number, { start: number, end: number }> | undefined}\n */\n\n getMediaSequenceMap(type) {\n return this.mediaSequenceStorage_.get(type);\n }\n /**\n * Update Media Sequence Map -> <MediaSequence, Range>\n *\n * @param {Object} playlist - parsed playlist\n * @param {number} currentTime - current player's time\n * @param {string} type - segment loader type\n * @return {void}\n */\n\n updateMediaSequenceMap(playlist, currentTime, type) {\n // we should not process this playlist if it does not have mediaSequence or segments\n if (playlist.mediaSequence === undefined || !Array.isArray(playlist.segments) || !playlist.segments.length) {\n return;\n }\n const currentMap = this.getMediaSequenceMap(type);\n const result = new Map();\n let currentMediaSequence = playlist.mediaSequence;\n let currentBaseTime;\n if (!currentMap) {\n // first playlist setup:\n currentBaseTime = 0;\n } else if (currentMap.has(playlist.mediaSequence)) {\n // further playlists setup:\n currentBaseTime = currentMap.get(playlist.mediaSequence).start;\n } else {\n // it seems like we have a gap between playlists, use current time as a fallback:\n this.logger_(`MediaSequence sync for ${type} segment loader - received a gap between playlists.\nFallback base time to: ${currentTime}.\nReceived media sequence: ${currentMediaSequence}.\nCurrent map: `, currentMap);\n currentBaseTime = currentTime;\n }\n this.logger_(`MediaSequence sync for ${type} segment loader.\nReceived media sequence: ${currentMediaSequence}.\nbase time is ${currentBaseTime}\nCurrent map: `, currentMap);\n playlist.segments.forEach(segment => {\n const start = currentBaseTime;\n const end = start + segment.duration;\n const range = {\n start,\n end\n };\n result.set(currentMediaSequence, range);\n currentMediaSequence++;\n currentBaseTime = end;\n });\n this.mediaSequenceStorage_.set(type, result);\n }\n /**\n * Find a sync-point for the playlist specified\n *\n * A sync-point is defined as a known mapping from display-time to\n * a segment-index in the current playlist.\n *\n * @param {Playlist} playlist\n * The playlist that needs a sync-point\n * @param {number} duration\n * Duration of the MediaSource (Infinite if playing a live source)\n * @param {number} currentTimeline\n * The last timeline from which a segment was loaded\n * @param {number} currentTime\n * Current player's time\n * @param {string} type\n * Segment loader type\n * @return {Object}\n * A sync-point object\n */\n\n getSyncPoint(playlist, duration, currentTimeline, currentTime, type) {\n // Always use VOD sync point for VOD\n if (duration !== Infinity) {\n const vodSyncPointStrategy = syncPointStrategies.find(({\n name\n }) => name === 'VOD');\n return vodSyncPointStrategy.run(this, playlist, duration);\n }\n const syncPoints = this.runStrategies_(playlist, duration, currentTimeline, currentTime, type);\n if (!syncPoints.length) {\n // Signal that we need to attempt to get a sync-point manually\n // by fetching a segment in the playlist and constructing\n // a sync-point from that information\n return null;\n } // If we have exact match just return it instead of finding the nearest distance\n\n for (const syncPointInfo of syncPoints) {\n const {\n syncPoint,\n strategy\n } = syncPointInfo;\n const {\n segmentIndex,\n time\n } = syncPoint;\n if (segmentIndex < 0) {\n continue;\n }\n const selectedSegment = playlist.segments[segmentIndex];\n const start = time;\n const end = start + selectedSegment.duration;\n this.logger_(`Strategy: ${strategy}. Current time: ${currentTime}. selected segment: ${segmentIndex}. Time: [${start} -> ${end}]}`);\n if (currentTime >= start && currentTime < end) {\n this.logger_('Found sync point with exact match: ', syncPoint);\n return syncPoint;\n }\n } // Now find the sync-point that is closest to the currentTime because\n // that should result in the most accurate guess about which segment\n // to fetch\n\n return this.selectSyncPoint_(syncPoints, {\n key: 'time',\n value: currentTime\n });\n }\n /**\n * Calculate the amount of time that has expired off the playlist during playback\n *\n * @param {Playlist} playlist\n * Playlist object to calculate expired from\n * @param {number} duration\n * Duration of the MediaSource (Infinity if playling a live source)\n * @return {number|null}\n * The amount of time that has expired off the playlist during playback. Null\n * if no sync-points for the playlist can be found.\n */\n\n getExpiredTime(playlist, duration) {\n if (!playlist || !playlist.segments) {\n return null;\n }\n const syncPoints = this.runStrategies_(playlist, duration, playlist.discontinuitySequence, 0, 'main'); // Without sync-points, there is not enough information to determine the expired time\n\n if (!syncPoints.length) {\n return null;\n }\n const syncPoint = this.selectSyncPoint_(syncPoints, {\n key: 'segmentIndex',\n value: 0\n }); // If the sync-point is beyond the start of the playlist, we want to subtract the\n // duration from index 0 to syncPoint.segmentIndex instead of adding.\n\n if (syncPoint.segmentIndex > 0) {\n syncPoint.time *= -1;\n }\n return Math.abs(syncPoint.time + sumDurations({\n defaultDuration: playlist.targetDuration,\n durationList: playlist.segments,\n startIndex: syncPoint.segmentIndex,\n endIndex: 0\n }));\n }\n /**\n * Runs each sync-point strategy and returns a list of sync-points returned by the\n * strategies\n *\n * @private\n * @param {Playlist} playlist\n * The playlist that needs a sync-point\n * @param {number} duration\n * Duration of the MediaSource (Infinity if playing a live source)\n * @param {number} currentTimeline\n * The last timeline from which a segment was loaded\n * @param {number} currentTime\n * Current player's time\n * @param {string} type\n * Segment loader type\n * @return {Array}\n * A list of sync-point objects\n */\n\n runStrategies_(playlist, duration, currentTimeline, currentTime, type) {\n const syncPoints = []; // Try to find a sync-point in by utilizing various strategies...\n\n for (let i = 0; i < syncPointStrategies.length; i++) {\n const strategy = syncPointStrategies[i];\n const syncPoint = strategy.run(this, playlist, duration, currentTimeline, currentTime, type);\n if (syncPoint) {\n syncPoint.strategy = strategy.name;\n syncPoints.push({\n strategy: strategy.name,\n syncPoint\n });\n }\n }\n return syncPoints;\n }\n /**\n * Selects the sync-point nearest the specified target\n *\n * @private\n * @param {Array} syncPoints\n * List of sync-points to select from\n * @param {Object} target\n * Object specifying the property and value we are targeting\n * @param {string} target.key\n * Specifies the property to target. Must be either 'time' or 'segmentIndex'\n * @param {number} target.value\n * The value to target for the specified key.\n * @return {Object}\n * The sync-point nearest the target\n */\n\n selectSyncPoint_(syncPoints, target) {\n let bestSyncPoint = syncPoints[0].syncPoint;\n let bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value);\n let bestStrategy = syncPoints[0].strategy;\n for (let i = 1; i < syncPoints.length; i++) {\n const newDistance = Math.abs(syncPoints[i].syncPoint[target.key] - target.value);\n if (newDistance < bestDistance) {\n bestDistance = newDistance;\n bestSyncPoint = syncPoints[i].syncPoint;\n bestStrategy = syncPoints[i].strategy;\n }\n }\n this.logger_(`syncPoint for [${target.key}: ${target.value}] chosen with strategy` + ` [${bestStrategy}]: [time:${bestSyncPoint.time},` + ` segmentIndex:${bestSyncPoint.segmentIndex}` + (typeof bestSyncPoint.partIndex === 'number' ? `,partIndex:${bestSyncPoint.partIndex}` : '') + ']');\n return bestSyncPoint;\n }\n /**\n * Save any meta-data present on the segments when segments leave\n * the live window to the playlist to allow for synchronization at the\n * playlist level later.\n *\n * @param {Playlist} oldPlaylist - The previous active playlist\n * @param {Playlist} newPlaylist - The updated and most current playlist\n */\n\n saveExpiredSegmentInfo(oldPlaylist, newPlaylist) {\n const mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; // Ignore large media sequence gaps\n\n if (mediaSequenceDiff > MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC) {\n videojs.log.warn(`Not saving expired segment info. Media sequence gap ${mediaSequenceDiff} is too large.`);\n return;\n } // When a segment expires from the playlist and it has a start time\n // save that information as a possible sync-point reference in future\n\n for (let i = mediaSequenceDiff - 1; i >= 0; i--) {\n const lastRemovedSegment = oldPlaylist.segments[i];\n if (lastRemovedSegment && typeof lastRemovedSegment.start !== 'undefined') {\n newPlaylist.syncInfo = {\n mediaSequence: oldPlaylist.mediaSequence + i,\n time: lastRemovedSegment.start\n };\n this.logger_(`playlist refresh sync: [time:${newPlaylist.syncInfo.time},` + ` mediaSequence: ${newPlaylist.syncInfo.mediaSequence}]`);\n this.trigger('syncinfoupdate');\n break;\n }\n }\n }\n /**\n * Save the mapping from playlist's ProgramDateTime to display. This should only happen\n * before segments start to load.\n *\n * @param {Playlist} playlist - The currently active playlist\n */\n\n setDateTimeMappingForStart(playlist) {\n // It's possible for the playlist to be updated before playback starts, meaning time\n // zero is not yet set. If, during these playlist refreshes, a discontinuity is\n // crossed, then the old time zero mapping (for the prior timeline) would be retained\n // unless the mappings are cleared.\n this.timelineToDatetimeMappings = {};\n if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) {\n const firstSegment = playlist.segments[0];\n const playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1000;\n this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp;\n }\n }\n /**\n * Calculates and saves timeline mappings, playlist sync info, and segment timing values\n * based on the latest timing information.\n *\n * @param {Object} options\n * Options object\n * @param {SegmentInfo} options.segmentInfo\n * The current active request information\n * @param {boolean} options.shouldSaveTimelineMapping\n * If there's a timeline change, determines if the timeline mapping should be\n * saved for timeline mapping and program date time mappings.\n */\n\n saveSegmentTimingInfo({\n segmentInfo,\n shouldSaveTimelineMapping\n }) {\n const didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping);\n const segment = segmentInfo.segment;\n if (didCalculateSegmentTimeMapping) {\n this.saveDiscontinuitySyncInfo_(segmentInfo); // If the playlist does not have sync information yet, record that information\n // now with segment timing information\n\n if (!segmentInfo.playlist.syncInfo) {\n segmentInfo.playlist.syncInfo = {\n mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex,\n time: segment.start\n };\n }\n }\n const dateTime = segment.dateTimeObject;\n if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) {\n this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1000);\n }\n }\n timestampOffsetForTimeline(timeline) {\n if (typeof this.timelines[timeline] === 'undefined') {\n return null;\n }\n return this.timelines[timeline].time;\n }\n mappingForTimeline(timeline) {\n if (typeof this.timelines[timeline] === 'undefined') {\n return null;\n }\n return this.timelines[timeline].mapping;\n }\n /**\n * Use the \"media time\" for a segment to generate a mapping to \"display time\" and\n * save that display time to the segment.\n *\n * @private\n * @param {SegmentInfo} segmentInfo\n * The current active request information\n * @param {Object} timingInfo\n * The start and end time of the current segment in \"media time\"\n * @param {boolean} shouldSaveTimelineMapping\n * If there's a timeline change, determines if the timeline mapping should be\n * saved in timelines.\n * @return {boolean}\n * Returns false if segment time mapping could not be calculated\n */\n\n calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) {\n // TODO: remove side effects\n const segment = segmentInfo.segment;\n const part = segmentInfo.part;\n let mappingObj = this.timelines[segmentInfo.timeline];\n let start;\n let end;\n if (typeof segmentInfo.timestampOffset === 'number') {\n mappingObj = {\n time: segmentInfo.startOfSegment,\n mapping: segmentInfo.startOfSegment - timingInfo.start\n };\n if (shouldSaveTimelineMapping) {\n this.timelines[segmentInfo.timeline] = mappingObj;\n this.trigger('timestampoffset');\n this.logger_(`time mapping for timeline ${segmentInfo.timeline}: ` + `[time: ${mappingObj.time}] [mapping: ${mappingObj.mapping}]`);\n }\n start = segmentInfo.startOfSegment;\n end = timingInfo.end + mappingObj.mapping;\n } else if (mappingObj) {\n start = timingInfo.start + mappingObj.mapping;\n end = timingInfo.end + mappingObj.mapping;\n } else {\n return false;\n }\n if (part) {\n part.start = start;\n part.end = end;\n } // If we don't have a segment start yet or the start value we got\n // is less than our current segment.start value, save a new start value.\n // We have to do this because parts will have segment timing info saved\n // multiple times and we want segment start to be the earliest part start\n // value for that segment.\n\n if (!segment.start || start < segment.start) {\n segment.start = start;\n }\n segment.end = end;\n return true;\n }\n /**\n * Each time we have discontinuity in the playlist, attempt to calculate the location\n * in display of the start of the discontinuity and save that. We also save an accuracy\n * value so that we save values with the most accuracy (closest to 0.)\n *\n * @private\n * @param {SegmentInfo} segmentInfo - The current active request information\n */\n\n saveDiscontinuitySyncInfo_(segmentInfo) {\n const playlist = segmentInfo.playlist;\n const segment = segmentInfo.segment; // If the current segment is a discontinuity then we know exactly where\n // the start of the range and it's accuracy is 0 (greater accuracy values\n // mean more approximation)\n\n if (segment.discontinuity) {\n this.discontinuities[segment.timeline] = {\n time: segment.start,\n accuracy: 0\n };\n } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {\n // Search for future discontinuities that we can provide better timing\n // information for and save that information for sync purposes\n for (let i = 0; i < playlist.discontinuityStarts.length; i++) {\n const segmentIndex = playlist.discontinuityStarts[i];\n const discontinuity = playlist.discontinuitySequence + i + 1;\n const mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex;\n const accuracy = Math.abs(mediaIndexDiff);\n if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) {\n let time;\n if (mediaIndexDiff < 0) {\n time = segment.start - sumDurations({\n defaultDuration: playlist.targetDuration,\n durationList: playlist.segments,\n startIndex: segmentInfo.mediaIndex,\n endIndex: segmentIndex\n });\n } else {\n time = segment.end + sumDurations({\n defaultDuration: playlist.targetDuration,\n durationList: playlist.segments,\n startIndex: segmentInfo.mediaIndex + 1,\n endIndex: segmentIndex\n });\n }\n this.discontinuities[discontinuity] = {\n time,\n accuracy\n };\n }\n }\n }\n }\n dispose() {\n this.trigger('dispose');\n this.off();\n }\n}\n\n/**\n * The TimelineChangeController acts as a source for segment loaders to listen for and\n * keep track of latest and pending timeline changes. This is useful to ensure proper\n * sync, as each loader may need to make a consideration for what timeline the other\n * loader is on before making changes which could impact the other loader's media.\n *\n * @class TimelineChangeController\n * @extends videojs.EventTarget\n */\n\nclass TimelineChangeController extends videojs.EventTarget {\n constructor() {\n super();\n this.pendingTimelineChanges_ = {};\n this.lastTimelineChanges_ = {};\n }\n clearPendingTimelineChange(type) {\n this.pendingTimelineChanges_[type] = null;\n this.trigger('pendingtimelinechange');\n }\n pendingTimelineChange({\n type,\n from,\n to\n }) {\n if (typeof from === 'number' && typeof to === 'number') {\n this.pendingTimelineChanges_[type] = {\n type,\n from,\n to\n };\n this.trigger('pendingtimelinechange');\n }\n return this.pendingTimelineChanges_[type];\n }\n lastTimelineChange({\n type,\n from,\n to\n }) {\n if (typeof from === 'number' && typeof to === 'number') {\n this.lastTimelineChanges_[type] = {\n type,\n from,\n to\n };\n delete this.pendingTimelineChanges_[type];\n this.trigger('timelinechange');\n }\n return this.lastTimelineChanges_[type];\n }\n dispose() {\n this.trigger('dispose');\n this.pendingTimelineChanges_ = {};\n this.lastTimelineChanges_ = {};\n this.off();\n }\n}\n\n/* rollup-plugin-worker-factory start for worker!/home/runner/work/http-streaming/http-streaming/src/decrypter-worker.js */\nconst workerCode = transform(getWorkerString(function () {\n /**\n * @file stream.js\n */\n\n /**\n * A lightweight readable stream implemention that handles event dispatching.\n *\n * @class Stream\n */\n\n var Stream = /*#__PURE__*/function () {\n function Stream() {\n this.listeners = {};\n }\n /**\n * Add a listener for a specified event type.\n *\n * @param {string} type the event name\n * @param {Function} listener the callback to be invoked when an event of\n * the specified type occurs\n */\n\n var _proto = Stream.prototype;\n _proto.on = function on(type, listener) {\n if (!this.listeners[type]) {\n this.listeners[type] = [];\n }\n this.listeners[type].push(listener);\n }\n /**\n * Remove a listener for a specified event type.\n *\n * @param {string} type the event name\n * @param {Function} listener a function previously registered for this\n * type of event through `on`\n * @return {boolean} if we could turn it off or not\n */;\n\n _proto.off = function off(type, listener) {\n if (!this.listeners[type]) {\n return false;\n }\n var index = this.listeners[type].indexOf(listener); // TODO: which is better?\n // In Video.js we slice listener functions\n // on trigger so that it does not mess up the order\n // while we loop through.\n //\n // Here we slice on off so that the loop in trigger\n // can continue using it's old reference to loop without\n // messing up the order.\n\n this.listeners[type] = this.listeners[type].slice(0);\n this.listeners[type].splice(index, 1);\n return index > -1;\n }\n /**\n * Trigger an event of the specified type on this stream. Any additional\n * arguments to this function are passed as parameters to event listeners.\n *\n * @param {string} type the event name\n */;\n\n _proto.trigger = function trigger(type) {\n var callbacks = this.listeners[type];\n if (!callbacks) {\n return;\n } // Slicing the arguments on every invocation of this method\n // can add a significant amount of overhead. Avoid the\n // intermediate object creation for the common case of a\n // single callback argument\n\n if (arguments.length === 2) {\n var length = callbacks.length;\n for (var i = 0; i < length; ++i) {\n callbacks[i].call(this, arguments[1]);\n }\n } else {\n var args = Array.prototype.slice.call(arguments, 1);\n var _length = callbacks.length;\n for (var _i = 0; _i < _length; ++_i) {\n callbacks[_i].apply(this, args);\n }\n }\n }\n /**\n * Destroys the stream and cleans up.\n */;\n\n _proto.dispose = function dispose() {\n this.listeners = {};\n }\n /**\n * Forwards all `data` events on this stream to the destination stream. The\n * destination stream should provide a method `push` to receive the data\n * events as they arrive.\n *\n * @param {Stream} destination the stream that will receive all `data` events\n * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options\n */;\n\n _proto.pipe = function pipe(destination) {\n this.on('data', function (data) {\n destination.push(data);\n });\n };\n return Stream;\n }();\n /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */\n\n /**\n * Returns the subarray of a Uint8Array without PKCS#7 padding.\n *\n * @param padded {Uint8Array} unencrypted bytes that have been padded\n * @return {Uint8Array} the unpadded bytes\n * @see http://tools.ietf.org/html/rfc5652\n */\n\n function unpad(padded) {\n return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);\n }\n /*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */\n\n /**\n * @file aes.js\n *\n * This file contains an adaptation of the AES decryption algorithm\n * from the Standford Javascript Cryptography Library. That work is\n * covered by the following copyright and permissions notice:\n *\n * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * The views and conclusions contained in the software and documentation\n * are those of the authors and should not be interpreted as representing\n * official policies, either expressed or implied, of the authors.\n */\n\n /**\n * Expand the S-box tables.\n *\n * @private\n */\n\n const precompute = function () {\n const tables = [[[], [], [], [], []], [[], [], [], [], []]];\n const encTable = tables[0];\n const decTable = tables[1];\n const sbox = encTable[4];\n const sboxInv = decTable[4];\n let i;\n let x;\n let xInv;\n const d = [];\n const th = [];\n let x2;\n let x4;\n let x8;\n let s;\n let tEnc;\n let tDec; // Compute double and third tables\n\n for (i = 0; i < 256; i++) {\n th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i;\n }\n for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {\n // Compute sbox\n s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;\n s = s >> 8 ^ s & 255 ^ 99;\n sbox[x] = s;\n sboxInv[s] = x; // Compute MixColumns\n\n x8 = d[x4 = d[x2 = d[x]]];\n tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;\n tEnc = d[s] * 0x101 ^ s * 0x1010100;\n for (i = 0; i < 4; i++) {\n encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;\n decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8;\n }\n } // Compactify. Considerable speedup on Firefox.\n\n for (i = 0; i < 5; i++) {\n encTable[i] = encTable[i].slice(0);\n decTable[i] = decTable[i].slice(0);\n }\n return tables;\n };\n let aesTables = null;\n /**\n * Schedule out an AES key for both encryption and decryption. This\n * is a low-level class. Use a cipher mode to do bulk encryption.\n *\n * @class AES\n * @param key {Array} The key as an array of 4, 6 or 8 words.\n */\n\n class AES {\n constructor(key) {\n /**\n * The expanded S-box and inverse S-box tables. These will be computed\n * on the client so that we don't have to send them down the wire.\n *\n * There are two tables, _tables[0] is for encryption and\n * _tables[1] is for decryption.\n *\n * The first 4 sub-tables are the expanded S-box with MixColumns. The\n * last (_tables[01][4]) is the S-box itself.\n *\n * @private\n */\n // if we have yet to precompute the S-box tables\n // do so now\n if (!aesTables) {\n aesTables = precompute();\n } // then make a copy of that object for use\n\n this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]];\n let i;\n let j;\n let tmp;\n const sbox = this._tables[0][4];\n const decTable = this._tables[1];\n const keyLen = key.length;\n let rcon = 1;\n if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {\n throw new Error('Invalid aes key size');\n }\n const encKey = key.slice(0);\n const decKey = [];\n this._key = [encKey, decKey]; // schedule encryption keys\n\n for (i = keyLen; i < 4 * keyLen + 28; i++) {\n tmp = encKey[i - 1]; // apply sbox\n\n if (i % keyLen === 0 || keyLen === 8 && i % keyLen === 4) {\n tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255]; // shift rows and add rcon\n\n if (i % keyLen === 0) {\n tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;\n rcon = rcon << 1 ^ (rcon >> 7) * 283;\n }\n }\n encKey[i] = encKey[i - keyLen] ^ tmp;\n } // schedule decryption keys\n\n for (j = 0; i; j++, i--) {\n tmp = encKey[j & 3 ? i : i - 4];\n if (i <= 4 || j < 4) {\n decKey[j] = tmp;\n } else {\n decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]];\n }\n }\n }\n /**\n * Decrypt 16 bytes, specified as four 32-bit words.\n *\n * @param {number} encrypted0 the first word to decrypt\n * @param {number} encrypted1 the second word to decrypt\n * @param {number} encrypted2 the third word to decrypt\n * @param {number} encrypted3 the fourth word to decrypt\n * @param {Int32Array} out the array to write the decrypted words\n * into\n * @param {number} offset the offset into the output array to start\n * writing results\n * @return {Array} The plaintext.\n */\n\n decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {\n const key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data\n\n let a = encrypted0 ^ key[0];\n let b = encrypted3 ^ key[1];\n let c = encrypted2 ^ key[2];\n let d = encrypted1 ^ key[3];\n let a2;\n let b2;\n let c2; // key.length === 2 ?\n\n const nInnerRounds = key.length / 4 - 2;\n let i;\n let kIndex = 4;\n const table = this._tables[1]; // load up the tables\n\n const table0 = table[0];\n const table1 = table[1];\n const table2 = table[2];\n const table3 = table[3];\n const sbox = table[4]; // Inner rounds. Cribbed from OpenSSL.\n\n for (i = 0; i < nInnerRounds; i++) {\n a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex];\n b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1];\n c2 = table0[c >>> 24] ^ table1[d >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2];\n d = table0[d >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3];\n kIndex += 4;\n a = a2;\n b = b2;\n c = c2;\n } // Last round.\n\n for (i = 0; i < 4; i++) {\n out[(3 & -i) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++];\n a2 = a;\n a = b;\n b = c;\n c = d;\n d = a2;\n }\n }\n }\n /**\n * @file async-stream.js\n */\n\n /**\n * A wrapper around the Stream class to use setTimeout\n * and run stream \"jobs\" Asynchronously\n *\n * @class AsyncStream\n * @extends Stream\n */\n\n class AsyncStream extends Stream {\n constructor() {\n super(Stream);\n this.jobs = [];\n this.delay = 1;\n this.timeout_ = null;\n }\n /**\n * process an async job\n *\n * @private\n */\n\n processJob_() {\n this.jobs.shift()();\n if (this.jobs.length) {\n this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);\n } else {\n this.timeout_ = null;\n }\n }\n /**\n * push a job into the stream\n *\n * @param {Function} job the job to push into the stream\n */\n\n push(job) {\n this.jobs.push(job);\n if (!this.timeout_) {\n this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);\n }\n }\n }\n /**\n * @file decrypter.js\n *\n * An asynchronous implementation of AES-128 CBC decryption with\n * PKCS#7 padding.\n */\n\n /**\n * Convert network-order (big-endian) bytes into their little-endian\n * representation.\n */\n\n const ntoh = function (word) {\n return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24;\n };\n /**\n * Decrypt bytes using AES-128 with CBC and PKCS#7 padding.\n *\n * @param {Uint8Array} encrypted the encrypted bytes\n * @param {Uint32Array} key the bytes of the decryption key\n * @param {Uint32Array} initVector the initialization vector (IV) to\n * use for the first round of CBC.\n * @return {Uint8Array} the decrypted bytes\n *\n * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard\n * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29\n * @see https://tools.ietf.org/html/rfc2315\n */\n\n const decrypt = function (encrypted, key, initVector) {\n // word-level access to the encrypted bytes\n const encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);\n const decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output\n\n const decrypted = new Uint8Array(encrypted.byteLength);\n const decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and\n // decrypted data\n\n let init0;\n let init1;\n let init2;\n let init3;\n let encrypted0;\n let encrypted1;\n let encrypted2;\n let encrypted3; // iteration variable\n\n let wordIx; // pull out the words of the IV to ensure we don't modify the\n // passed-in reference and easier access\n\n init0 = initVector[0];\n init1 = initVector[1];\n init2 = initVector[2];\n init3 = initVector[3]; // decrypt four word sequences, applying cipher-block chaining (CBC)\n // to each decrypted block\n\n for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) {\n // convert big-endian (network order) words into little-endian\n // (javascript order)\n encrypted0 = ntoh(encrypted32[wordIx]);\n encrypted1 = ntoh(encrypted32[wordIx + 1]);\n encrypted2 = ntoh(encrypted32[wordIx + 2]);\n encrypted3 = ntoh(encrypted32[wordIx + 3]); // decrypt the block\n\n decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx); // XOR with the IV, and restore network byte-order to obtain the\n // plaintext\n\n decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0);\n decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1);\n decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2);\n decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3); // setup the IV for the next round\n\n init0 = encrypted0;\n init1 = encrypted1;\n init2 = encrypted2;\n init3 = encrypted3;\n }\n return decrypted;\n };\n /**\n * The `Decrypter` class that manages decryption of AES\n * data through `AsyncStream` objects and the `decrypt`\n * function\n *\n * @param {Uint8Array} encrypted the encrypted bytes\n * @param {Uint32Array} key the bytes of the decryption key\n * @param {Uint32Array} initVector the initialization vector (IV) to\n * @param {Function} done the function to run when done\n * @class Decrypter\n */\n\n class Decrypter {\n constructor(encrypted, key, initVector, done) {\n const step = Decrypter.STEP;\n const encrypted32 = new Int32Array(encrypted.buffer);\n const decrypted = new Uint8Array(encrypted.byteLength);\n let i = 0;\n this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously\n\n this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted));\n for (i = step; i < encrypted32.length; i += step) {\n initVector = new Uint32Array([ntoh(encrypted32[i - 4]), ntoh(encrypted32[i - 3]), ntoh(encrypted32[i - 2]), ntoh(encrypted32[i - 1])]);\n this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted));\n } // invoke the done() callback when everything is finished\n\n this.asyncStream_.push(function () {\n // remove pkcs#7 padding from the decrypted bytes\n done(null, unpad(decrypted));\n });\n }\n /**\n * a getter for step the maximum number of bytes to process at one time\n *\n * @return {number} the value of step 32000\n */\n\n static get STEP() {\n // 4 * 8000;\n return 32000;\n }\n /**\n * @private\n */\n\n decryptChunk_(encrypted, key, initVector, decrypted) {\n return function () {\n const bytes = decrypt(encrypted, key, initVector);\n decrypted.set(bytes, encrypted.byteOffset);\n };\n }\n }\n var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};\n var win;\n if (typeof window !== \"undefined\") {\n win = window;\n } else if (typeof commonjsGlobal !== \"undefined\") {\n win = commonjsGlobal;\n } else if (typeof self !== \"undefined\") {\n win = self;\n } else {\n win = {};\n }\n var window_1 = win;\n var isArrayBufferView = function isArrayBufferView(obj) {\n if (ArrayBuffer.isView === 'function') {\n return ArrayBuffer.isView(obj);\n }\n return obj && obj.buffer instanceof ArrayBuffer;\n };\n var BigInt = window_1.BigInt || Number;\n [BigInt('0x1'), BigInt('0x100'), BigInt('0x10000'), BigInt('0x1000000'), BigInt('0x100000000'), BigInt('0x10000000000'), BigInt('0x1000000000000'), BigInt('0x100000000000000'), BigInt('0x10000000000000000')];\n (function () {\n var a = new Uint16Array([0xFFCC]);\n var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);\n if (b[0] === 0xFF) {\n return 'big';\n }\n if (b[0] === 0xCC) {\n return 'little';\n }\n return 'unknown';\n })();\n /**\n * Creates an object for sending to a web worker modifying properties that are TypedArrays\n * into a new object with seperated properties for the buffer, byteOffset, and byteLength.\n *\n * @param {Object} message\n * Object of properties and values to send to the web worker\n * @return {Object}\n * Modified message with TypedArray values expanded\n * @function createTransferableMessage\n */\n\n const createTransferableMessage = function (message) {\n const transferable = {};\n Object.keys(message).forEach(key => {\n const value = message[key];\n if (isArrayBufferView(value)) {\n transferable[key] = {\n bytes: value.buffer,\n byteOffset: value.byteOffset,\n byteLength: value.byteLength\n };\n } else {\n transferable[key] = value;\n }\n });\n return transferable;\n };\n /* global self */\n\n /**\n * Our web worker interface so that things can talk to aes-decrypter\n * that will be running in a web worker. the scope is passed to this by\n * webworkify.\n */\n\n self.onmessage = function (event) {\n const data = event.data;\n const encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength);\n const key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4);\n const iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4);\n /* eslint-disable no-new, handle-callback-err */\n\n new Decrypter(encrypted, key, iv, function (err, bytes) {\n self.postMessage(createTransferableMessage({\n source: data.source,\n decrypted: bytes\n }), [bytes.buffer]);\n });\n /* eslint-enable */\n };\n}));\n\nvar Decrypter = factory(workerCode);\n/* rollup-plugin-worker-factory end for worker!/home/runner/work/http-streaming/http-streaming/src/decrypter-worker.js */\n\n/**\n * Convert the properties of an HLS track into an audioTrackKind.\n *\n * @private\n */\n\nconst audioTrackKind_ = properties => {\n let kind = properties.default ? 'main' : 'alternative';\n if (properties.characteristics && properties.characteristics.indexOf('public.accessibility.describes-video') >= 0) {\n kind = 'main-desc';\n }\n return kind;\n};\n/**\n * Pause provided segment loader and playlist loader if active\n *\n * @param {SegmentLoader} segmentLoader\n * SegmentLoader to pause\n * @param {Object} mediaType\n * Active media type\n * @function stopLoaders\n */\n\nconst stopLoaders = (segmentLoader, mediaType) => {\n segmentLoader.abort();\n segmentLoader.pause();\n if (mediaType && mediaType.activePlaylistLoader) {\n mediaType.activePlaylistLoader.pause();\n mediaType.activePlaylistLoader = null;\n }\n};\n/**\n * Start loading provided segment loader and playlist loader\n *\n * @param {PlaylistLoader} playlistLoader\n * PlaylistLoader to start loading\n * @param {Object} mediaType\n * Active media type\n * @function startLoaders\n */\n\nconst startLoaders = (playlistLoader, mediaType) => {\n // Segment loader will be started after `loadedmetadata` or `loadedplaylist` from the\n // playlist loader\n mediaType.activePlaylistLoader = playlistLoader;\n playlistLoader.load();\n};\n/**\n * Returns a function to be called when the media group changes. It performs a\n * non-destructive (preserve the buffer) resync of the SegmentLoader. This is because a\n * change of group is merely a rendition switch of the same content at another encoding,\n * rather than a change of content, such as switching audio from English to Spanish.\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Handler for a non-destructive resync of SegmentLoader when the active media\n * group changes.\n * @function onGroupChanged\n */\n\nconst onGroupChanged = (type, settings) => () => {\n const {\n segmentLoaders: {\n [type]: segmentLoader,\n main: mainSegmentLoader\n },\n mediaTypes: {\n [type]: mediaType\n }\n } = settings;\n const activeTrack = mediaType.activeTrack();\n const activeGroup = mediaType.getActiveGroup();\n const previousActiveLoader = mediaType.activePlaylistLoader;\n const lastGroup = mediaType.lastGroup_; // the group did not change do nothing\n\n if (activeGroup && lastGroup && activeGroup.id === lastGroup.id) {\n return;\n }\n mediaType.lastGroup_ = activeGroup;\n mediaType.lastTrack_ = activeTrack;\n stopLoaders(segmentLoader, mediaType);\n if (!activeGroup || activeGroup.isMainPlaylist) {\n // there is no group active or active group is a main playlist and won't change\n return;\n }\n if (!activeGroup.playlistLoader) {\n if (previousActiveLoader) {\n // The previous group had a playlist loader but the new active group does not\n // this means we are switching from demuxed to muxed audio. In this case we want to\n // do a destructive reset of the main segment loader and not restart the audio\n // loaders.\n mainSegmentLoader.resetEverything();\n }\n return;\n } // Non-destructive resync\n\n segmentLoader.resyncLoader();\n startLoaders(activeGroup.playlistLoader, mediaType);\n};\nconst onGroupChanging = (type, settings) => () => {\n const {\n segmentLoaders: {\n [type]: segmentLoader\n },\n mediaTypes: {\n [type]: mediaType\n }\n } = settings;\n mediaType.lastGroup_ = null;\n segmentLoader.abort();\n segmentLoader.pause();\n};\n/**\n * Returns a function to be called when the media track changes. It performs a\n * destructive reset of the SegmentLoader to ensure we start loading as close to\n * currentTime as possible.\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Handler for a destructive reset of SegmentLoader when the active media\n * track changes.\n * @function onTrackChanged\n */\n\nconst onTrackChanged = (type, settings) => () => {\n const {\n mainPlaylistLoader,\n segmentLoaders: {\n [type]: segmentLoader,\n main: mainSegmentLoader\n },\n mediaTypes: {\n [type]: mediaType\n }\n } = settings;\n const activeTrack = mediaType.activeTrack();\n const activeGroup = mediaType.getActiveGroup();\n const previousActiveLoader = mediaType.activePlaylistLoader;\n const lastTrack = mediaType.lastTrack_; // track did not change, do nothing\n\n if (lastTrack && activeTrack && lastTrack.id === activeTrack.id) {\n return;\n }\n mediaType.lastGroup_ = activeGroup;\n mediaType.lastTrack_ = activeTrack;\n stopLoaders(segmentLoader, mediaType);\n if (!activeGroup) {\n // there is no group active so we do not want to restart loaders\n return;\n }\n if (activeGroup.isMainPlaylist) {\n // track did not change, do nothing\n if (!activeTrack || !lastTrack || activeTrack.id === lastTrack.id) {\n return;\n }\n const pc = settings.vhs.playlistController_;\n const newPlaylist = pc.selectPlaylist(); // media will not change do nothing\n\n if (pc.media() === newPlaylist) {\n return;\n }\n mediaType.logger_(`track change. Switching main audio from ${lastTrack.id} to ${activeTrack.id}`);\n mainPlaylistLoader.pause();\n mainSegmentLoader.resetEverything();\n pc.fastQualityChange_(newPlaylist);\n return;\n }\n if (type === 'AUDIO') {\n if (!activeGroup.playlistLoader) {\n // when switching from demuxed audio/video to muxed audio/video (noted by no\n // playlist loader for the audio group), we want to do a destructive reset of the\n // main segment loader and not restart the audio loaders\n mainSegmentLoader.setAudio(true); // don't have to worry about disabling the audio of the audio segment loader since\n // it should be stopped\n\n mainSegmentLoader.resetEverything();\n return;\n } // although the segment loader is an audio segment loader, call the setAudio\n // function to ensure it is prepared to re-append the init segment (or handle other\n // config changes)\n\n segmentLoader.setAudio(true);\n mainSegmentLoader.setAudio(false);\n }\n if (previousActiveLoader === activeGroup.playlistLoader) {\n // Nothing has actually changed. This can happen because track change events can fire\n // multiple times for a \"single\" change. One for enabling the new active track, and\n // one for disabling the track that was active\n startLoaders(activeGroup.playlistLoader, mediaType);\n return;\n }\n if (segmentLoader.track) {\n // For WebVTT, set the new text track in the segmentloader\n segmentLoader.track(activeTrack);\n } // destructive reset\n\n segmentLoader.resetEverything();\n startLoaders(activeGroup.playlistLoader, mediaType);\n};\nconst onError = {\n /**\n * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters\n * an error.\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Error handler. Logs warning (or error if the playlist is excluded) to\n * console and switches back to default audio track.\n * @function onError.AUDIO\n */\n AUDIO: (type, settings) => () => {\n const {\n mediaTypes: {\n [type]: mediaType\n },\n excludePlaylist\n } = settings; // switch back to default audio track\n\n const activeTrack = mediaType.activeTrack();\n const activeGroup = mediaType.activeGroup();\n const id = (activeGroup.filter(group => group.default)[0] || activeGroup[0]).id;\n const defaultTrack = mediaType.tracks[id];\n if (activeTrack === defaultTrack) {\n // Default track encountered an error. All we can do now is exclude the current\n // rendition and hope another will switch audio groups\n excludePlaylist({\n error: {\n message: 'Problem encountered loading the default audio track.'\n }\n });\n return;\n }\n videojs.log.warn('Problem encountered loading the alternate audio track.' + 'Switching back to default.');\n for (const trackId in mediaType.tracks) {\n mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack;\n }\n mediaType.onTrackChanged();\n },\n /**\n * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters\n * an error.\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Error handler. Logs warning to console and disables the active subtitle track\n * @function onError.SUBTITLES\n */\n SUBTITLES: (type, settings) => () => {\n const {\n mediaTypes: {\n [type]: mediaType\n }\n } = settings;\n videojs.log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.');\n const track = mediaType.activeTrack();\n if (track) {\n track.mode = 'disabled';\n }\n mediaType.onTrackChanged();\n }\n};\nconst setupListeners = {\n /**\n * Setup event listeners for audio playlist loader\n *\n * @param {string} type\n * MediaGroup type\n * @param {PlaylistLoader|null} playlistLoader\n * PlaylistLoader to register listeners on\n * @param {Object} settings\n * Object containing required information for media groups\n * @function setupListeners.AUDIO\n */\n AUDIO: (type, playlistLoader, settings) => {\n if (!playlistLoader) {\n // no playlist loader means audio will be muxed with the video\n return;\n }\n const {\n tech,\n requestOptions,\n segmentLoaders: {\n [type]: segmentLoader\n }\n } = settings;\n playlistLoader.on('loadedmetadata', () => {\n const media = playlistLoader.media();\n segmentLoader.playlist(media, requestOptions); // if the video is already playing, or if this isn't a live video and preload\n // permits, start downloading segments\n\n if (!tech.paused() || media.endList && tech.preload() !== 'none') {\n segmentLoader.load();\n }\n });\n playlistLoader.on('loadedplaylist', () => {\n segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running\n\n if (!tech.paused()) {\n segmentLoader.load();\n }\n });\n playlistLoader.on('error', onError[type](type, settings));\n },\n /**\n * Setup event listeners for subtitle playlist loader\n *\n * @param {string} type\n * MediaGroup type\n * @param {PlaylistLoader|null} playlistLoader\n * PlaylistLoader to register listeners on\n * @param {Object} settings\n * Object containing required information for media groups\n * @function setupListeners.SUBTITLES\n */\n SUBTITLES: (type, playlistLoader, settings) => {\n const {\n tech,\n requestOptions,\n segmentLoaders: {\n [type]: segmentLoader\n },\n mediaTypes: {\n [type]: mediaType\n }\n } = settings;\n playlistLoader.on('loadedmetadata', () => {\n const media = playlistLoader.media();\n segmentLoader.playlist(media, requestOptions);\n segmentLoader.track(mediaType.activeTrack()); // if the video is already playing, or if this isn't a live video and preload\n // permits, start downloading segments\n\n if (!tech.paused() || media.endList && tech.preload() !== 'none') {\n segmentLoader.load();\n }\n });\n playlistLoader.on('loadedplaylist', () => {\n segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running\n\n if (!tech.paused()) {\n segmentLoader.load();\n }\n });\n playlistLoader.on('error', onError[type](type, settings));\n }\n};\nconst initialize = {\n /**\n * Setup PlaylistLoaders and AudioTracks for the audio groups\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @function initialize.AUDIO\n */\n 'AUDIO': (type, settings) => {\n const {\n vhs,\n sourceType,\n segmentLoaders: {\n [type]: segmentLoader\n },\n requestOptions,\n main: {\n mediaGroups\n },\n mediaTypes: {\n [type]: {\n groups,\n tracks,\n logger_\n }\n },\n mainPlaylistLoader\n } = settings;\n const audioOnlyMain = isAudioOnly(mainPlaylistLoader.main); // force a default if we have none\n\n if (!mediaGroups[type] || Object.keys(mediaGroups[type]).length === 0) {\n mediaGroups[type] = {\n main: {\n default: {\n default: true\n }\n }\n };\n if (audioOnlyMain) {\n mediaGroups[type].main.default.playlists = mainPlaylistLoader.main.playlists;\n }\n }\n for (const groupId in mediaGroups[type]) {\n if (!groups[groupId]) {\n groups[groupId] = [];\n }\n for (const variantLabel in mediaGroups[type][groupId]) {\n let properties = mediaGroups[type][groupId][variantLabel];\n let playlistLoader;\n if (audioOnlyMain) {\n logger_(`AUDIO group '${groupId}' label '${variantLabel}' is a main playlist`);\n properties.isMainPlaylist = true;\n playlistLoader = null; // if vhs-json was provided as the source, and the media playlist was resolved,\n // use the resolved media playlist object\n } else if (sourceType === 'vhs-json' && properties.playlists) {\n playlistLoader = new PlaylistLoader(properties.playlists[0], vhs, requestOptions);\n } else if (properties.resolvedUri) {\n playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions); // TODO: dash isn't the only type with properties.playlists\n // should we even have properties.playlists in this check.\n } else if (properties.playlists && sourceType === 'dash') {\n playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, mainPlaylistLoader);\n } else {\n // no resolvedUri means the audio is muxed with the video when using this\n // audio track\n playlistLoader = null;\n }\n properties = merge({\n id: variantLabel,\n playlistLoader\n }, properties);\n setupListeners[type](type, properties.playlistLoader, settings);\n groups[groupId].push(properties);\n if (typeof tracks[variantLabel] === 'undefined') {\n const track = new videojs.AudioTrack({\n id: variantLabel,\n kind: audioTrackKind_(properties),\n enabled: false,\n language: properties.language,\n default: properties.default,\n label: variantLabel\n });\n tracks[variantLabel] = track;\n }\n }\n } // setup single error event handler for the segment loader\n\n segmentLoader.on('error', onError[type](type, settings));\n },\n /**\n * Setup PlaylistLoaders and TextTracks for the subtitle groups\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @function initialize.SUBTITLES\n */\n 'SUBTITLES': (type, settings) => {\n const {\n tech,\n vhs,\n sourceType,\n segmentLoaders: {\n [type]: segmentLoader\n },\n requestOptions,\n main: {\n mediaGroups\n },\n mediaTypes: {\n [type]: {\n groups,\n tracks\n }\n },\n mainPlaylistLoader\n } = settings;\n for (const groupId in mediaGroups[type]) {\n if (!groups[groupId]) {\n groups[groupId] = [];\n }\n for (const variantLabel in mediaGroups[type][groupId]) {\n if (!vhs.options_.useForcedSubtitles && mediaGroups[type][groupId][variantLabel].forced) {\n // Subtitle playlists with the forced attribute are not selectable in Safari.\n // According to Apple's HLS Authoring Specification:\n // If content has forced subtitles and regular subtitles in a given language,\n // the regular subtitles track in that language MUST contain both the forced\n // subtitles and the regular subtitles for that language.\n // Because of this requirement and that Safari does not add forced subtitles,\n // forced subtitles are skipped here to maintain consistent experience across\n // all platforms\n continue;\n }\n let properties = mediaGroups[type][groupId][variantLabel];\n let playlistLoader;\n if (sourceType === 'hls') {\n playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions);\n } else if (sourceType === 'dash') {\n const playlists = properties.playlists.filter(p => p.excludeUntil !== Infinity);\n if (!playlists.length) {\n return;\n }\n playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, mainPlaylistLoader);\n } else if (sourceType === 'vhs-json') {\n playlistLoader = new PlaylistLoader(\n // if the vhs-json object included the media playlist, use the media playlist\n // as provided, otherwise use the resolved URI to load the playlist\n properties.playlists ? properties.playlists[0] : properties.resolvedUri, vhs, requestOptions);\n }\n properties = merge({\n id: variantLabel,\n playlistLoader\n }, properties);\n setupListeners[type](type, properties.playlistLoader, settings);\n groups[groupId].push(properties);\n if (typeof tracks[variantLabel] === 'undefined') {\n const track = tech.addRemoteTextTrack({\n id: variantLabel,\n kind: 'subtitles',\n default: properties.default && properties.autoselect,\n language: properties.language,\n label: variantLabel\n }, false).track;\n tracks[variantLabel] = track;\n }\n }\n } // setup single error event handler for the segment loader\n\n segmentLoader.on('error', onError[type](type, settings));\n },\n /**\n * Setup TextTracks for the closed-caption groups\n *\n * @param {String} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @function initialize['CLOSED-CAPTIONS']\n */\n 'CLOSED-CAPTIONS': (type, settings) => {\n const {\n tech,\n main: {\n mediaGroups\n },\n mediaTypes: {\n [type]: {\n groups,\n tracks\n }\n }\n } = settings;\n for (const groupId in mediaGroups[type]) {\n if (!groups[groupId]) {\n groups[groupId] = [];\n }\n for (const variantLabel in mediaGroups[type][groupId]) {\n const properties = mediaGroups[type][groupId][variantLabel]; // Look for either 608 (CCn) or 708 (SERVICEn) caption services\n\n if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) {\n continue;\n }\n const captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};\n let newProps = {\n label: variantLabel,\n language: properties.language,\n instreamId: properties.instreamId,\n default: properties.default && properties.autoselect\n };\n if (captionServices[newProps.instreamId]) {\n newProps = merge(newProps, captionServices[newProps.instreamId]);\n }\n if (newProps.default === undefined) {\n delete newProps.default;\n } // No PlaylistLoader is required for Closed-Captions because the captions are\n // embedded within the video stream\n\n groups[groupId].push(merge({\n id: variantLabel\n }, properties));\n if (typeof tracks[variantLabel] === 'undefined') {\n const track = tech.addRemoteTextTrack({\n id: newProps.instreamId,\n kind: 'captions',\n default: newProps.default,\n language: newProps.language,\n label: newProps.label\n }, false).track;\n tracks[variantLabel] = track;\n }\n }\n }\n }\n};\nconst groupMatch = (list, media) => {\n for (let i = 0; i < list.length; i++) {\n if (playlistMatch(media, list[i])) {\n return true;\n }\n if (list[i].playlists && groupMatch(list[i].playlists, media)) {\n return true;\n }\n }\n return false;\n};\n/**\n * Returns a function used to get the active group of the provided type\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Function that returns the active media group for the provided type. Takes an\n * optional parameter {TextTrack} track. If no track is provided, a list of all\n * variants in the group, otherwise the variant corresponding to the provided\n * track is returned.\n * @function activeGroup\n */\n\nconst activeGroup = (type, settings) => track => {\n const {\n mainPlaylistLoader,\n mediaTypes: {\n [type]: {\n groups\n }\n }\n } = settings;\n const media = mainPlaylistLoader.media();\n if (!media) {\n return null;\n }\n let variants = null; // set to variants to main media active group\n\n if (media.attributes[type]) {\n variants = groups[media.attributes[type]];\n }\n const groupKeys = Object.keys(groups);\n if (!variants) {\n // find the mainPlaylistLoader media\n // that is in a media group if we are dealing\n // with audio only\n if (type === 'AUDIO' && groupKeys.length > 1 && isAudioOnly(settings.main)) {\n for (let i = 0; i < groupKeys.length; i++) {\n const groupPropertyList = groups[groupKeys[i]];\n if (groupMatch(groupPropertyList, media)) {\n variants = groupPropertyList;\n break;\n }\n } // use the main group if it exists\n } else if (groups.main) {\n variants = groups.main; // only one group, use that one\n } else if (groupKeys.length === 1) {\n variants = groups[groupKeys[0]];\n }\n }\n if (typeof track === 'undefined') {\n return variants;\n }\n if (track === null || !variants) {\n // An active track was specified so a corresponding group is expected. track === null\n // means no track is currently active so there is no corresponding group\n return null;\n }\n return variants.filter(props => props.id === track.id)[0] || null;\n};\nconst activeTrack = {\n /**\n * Returns a function used to get the active track of type provided\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Function that returns the active media track for the provided type. Returns\n * null if no track is active\n * @function activeTrack.AUDIO\n */\n AUDIO: (type, settings) => () => {\n const {\n mediaTypes: {\n [type]: {\n tracks\n }\n }\n } = settings;\n for (const id in tracks) {\n if (tracks[id].enabled) {\n return tracks[id];\n }\n }\n return null;\n },\n /**\n * Returns a function used to get the active track of type provided\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Function that returns the active media track for the provided type. Returns\n * null if no track is active\n * @function activeTrack.SUBTITLES\n */\n SUBTITLES: (type, settings) => () => {\n const {\n mediaTypes: {\n [type]: {\n tracks\n }\n }\n } = settings;\n for (const id in tracks) {\n if (tracks[id].mode === 'showing' || tracks[id].mode === 'hidden') {\n return tracks[id];\n }\n }\n return null;\n }\n};\nconst getActiveGroup = (type, {\n mediaTypes\n}) => () => {\n const activeTrack_ = mediaTypes[type].activeTrack();\n if (!activeTrack_) {\n return null;\n }\n return mediaTypes[type].activeGroup(activeTrack_);\n};\n/**\n * Setup PlaylistLoaders and Tracks for media groups (Audio, Subtitles,\n * Closed-Captions) specified in the main manifest.\n *\n * @param {Object} settings\n * Object containing required information for setting up the media groups\n * @param {Tech} settings.tech\n * The tech of the player\n * @param {Object} settings.requestOptions\n * XHR request options used by the segment loaders\n * @param {PlaylistLoader} settings.mainPlaylistLoader\n * PlaylistLoader for the main source\n * @param {VhsHandler} settings.vhs\n * VHS SourceHandler\n * @param {Object} settings.main\n * The parsed main manifest\n * @param {Object} settings.mediaTypes\n * Object to store the loaders, tracks, and utility methods for each media type\n * @param {Function} settings.excludePlaylist\n * Excludes the current rendition and forces a rendition switch.\n * @function setupMediaGroups\n */\n\nconst setupMediaGroups = settings => {\n ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => {\n initialize[type](type, settings);\n });\n const {\n mediaTypes,\n mainPlaylistLoader,\n tech,\n vhs,\n segmentLoaders: {\n ['AUDIO']: audioSegmentLoader,\n main: mainSegmentLoader\n }\n } = settings; // setup active group and track getters and change event handlers\n\n ['AUDIO', 'SUBTITLES'].forEach(type => {\n mediaTypes[type].activeGroup = activeGroup(type, settings);\n mediaTypes[type].activeTrack = activeTrack[type](type, settings);\n mediaTypes[type].onGroupChanged = onGroupChanged(type, settings);\n mediaTypes[type].onGroupChanging = onGroupChanging(type, settings);\n mediaTypes[type].onTrackChanged = onTrackChanged(type, settings);\n mediaTypes[type].getActiveGroup = getActiveGroup(type, settings);\n }); // DO NOT enable the default subtitle or caption track.\n // DO enable the default audio track\n\n const audioGroup = mediaTypes.AUDIO.activeGroup();\n if (audioGroup) {\n const groupId = (audioGroup.filter(group => group.default)[0] || audioGroup[0]).id;\n mediaTypes.AUDIO.tracks[groupId].enabled = true;\n mediaTypes.AUDIO.onGroupChanged();\n mediaTypes.AUDIO.onTrackChanged();\n const activeAudioGroup = mediaTypes.AUDIO.getActiveGroup(); // a similar check for handling setAudio on each loader is run again each time the\n // track is changed, but needs to be handled here since the track may not be considered\n // changed on the first call to onTrackChanged\n\n if (!activeAudioGroup.playlistLoader) {\n // either audio is muxed with video or the stream is audio only\n mainSegmentLoader.setAudio(true);\n } else {\n // audio is demuxed\n mainSegmentLoader.setAudio(false);\n audioSegmentLoader.setAudio(true);\n }\n }\n mainPlaylistLoader.on('mediachange', () => {\n ['AUDIO', 'SUBTITLES'].forEach(type => mediaTypes[type].onGroupChanged());\n });\n mainPlaylistLoader.on('mediachanging', () => {\n ['AUDIO', 'SUBTITLES'].forEach(type => mediaTypes[type].onGroupChanging());\n }); // custom audio track change event handler for usage event\n\n const onAudioTrackChanged = () => {\n mediaTypes.AUDIO.onTrackChanged();\n tech.trigger({\n type: 'usage',\n name: 'vhs-audio-change'\n });\n };\n tech.audioTracks().addEventListener('change', onAudioTrackChanged);\n tech.remoteTextTracks().addEventListener('change', mediaTypes.SUBTITLES.onTrackChanged);\n vhs.on('dispose', () => {\n tech.audioTracks().removeEventListener('change', onAudioTrackChanged);\n tech.remoteTextTracks().removeEventListener('change', mediaTypes.SUBTITLES.onTrackChanged);\n }); // clear existing audio tracks and add the ones we just created\n\n tech.clearTracks('audio');\n for (const id in mediaTypes.AUDIO.tracks) {\n tech.audioTracks().addTrack(mediaTypes.AUDIO.tracks[id]);\n }\n};\n/**\n * Creates skeleton object used to store the loaders, tracks, and utility methods for each\n * media type\n *\n * @return {Object}\n * Object to store the loaders, tracks, and utility methods for each media type\n * @function createMediaTypes\n */\n\nconst createMediaTypes = () => {\n const mediaTypes = {};\n ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => {\n mediaTypes[type] = {\n groups: {},\n tracks: {},\n activePlaylistLoader: null,\n activeGroup: noop,\n activeTrack: noop,\n getActiveGroup: noop,\n onGroupChanged: noop,\n onTrackChanged: noop,\n lastTrack_: null,\n logger_: logger(`MediaGroups[${type}]`)\n };\n });\n return mediaTypes;\n};\n\n/**\n * A utility class for setting properties and maintaining the state of the content steering manifest.\n *\n * Content Steering manifest format:\n * VERSION: number (required) currently only version 1 is supported.\n * TTL: number in seconds (optional) until the next content steering manifest reload.\n * RELOAD-URI: string (optional) uri to fetch the next content steering manifest.\n * SERVICE-LOCATION-PRIORITY or PATHWAY-PRIORITY a non empty array of unique string values.\n * PATHWAY-CLONES: array (optional) (HLS only) pathway clone objects to copy from other playlists.\n */\n\nclass SteeringManifest {\n constructor() {\n this.priority_ = [];\n this.pathwayClones_ = new Map();\n }\n set version(number) {\n // Only version 1 is currently supported for both DASH and HLS.\n if (number === 1) {\n this.version_ = number;\n }\n }\n set ttl(seconds) {\n // TTL = time-to-live, default = 300 seconds.\n this.ttl_ = seconds || 300;\n }\n set reloadUri(uri) {\n if (uri) {\n // reload URI can be relative to the previous reloadUri.\n this.reloadUri_ = resolveUrl(this.reloadUri_, uri);\n }\n }\n set priority(array) {\n // priority must be non-empty and unique values.\n if (array && array.length) {\n this.priority_ = array;\n }\n }\n set pathwayClones(array) {\n // pathwayClones must be non-empty.\n if (array && array.length) {\n this.pathwayClones_ = new Map(array.map(clone => [clone.ID, clone]));\n }\n }\n get version() {\n return this.version_;\n }\n get ttl() {\n return this.ttl_;\n }\n get reloadUri() {\n return this.reloadUri_;\n }\n get priority() {\n return this.priority_;\n }\n get pathwayClones() {\n return this.pathwayClones_;\n }\n}\n/**\n * This class represents a content steering manifest and associated state. See both HLS and DASH specifications.\n * HLS: https://developer.apple.com/streaming/HLSContentSteeringSpecification.pdf and\n * https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/ section 4.4.6.6.\n * DASH: https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf\n *\n * @param {function} xhr for making a network request from the browser.\n * @param {function} bandwidth for fetching the current bandwidth from the main segment loader.\n */\n\nclass ContentSteeringController extends videojs.EventTarget {\n constructor(xhr, bandwidth) {\n super();\n this.currentPathway = null;\n this.defaultPathway = null;\n this.queryBeforeStart = false;\n this.availablePathways_ = new Set();\n this.steeringManifest = new SteeringManifest();\n this.proxyServerUrl_ = null;\n this.manifestType_ = null;\n this.ttlTimeout_ = null;\n this.request_ = null;\n this.currentPathwayClones = new Map();\n this.nextPathwayClones = new Map();\n this.excludedSteeringManifestURLs = new Set();\n this.logger_ = logger('Content Steering');\n this.xhr_ = xhr;\n this.getBandwidth_ = bandwidth;\n }\n /**\n * Assigns the content steering tag properties to the steering controller\n *\n * @param {string} baseUrl the baseURL from the main manifest for resolving the steering manifest url\n * @param {Object} steeringTag the content steering tag from the main manifest\n */\n\n assignTagProperties(baseUrl, steeringTag) {\n this.manifestType_ = steeringTag.serverUri ? 'HLS' : 'DASH'; // serverUri is HLS serverURL is DASH\n\n const steeringUri = steeringTag.serverUri || steeringTag.serverURL;\n if (!steeringUri) {\n this.logger_(`steering manifest URL is ${steeringUri}, cannot request steering manifest.`);\n this.trigger('error');\n return;\n } // Content steering manifests can be encoded as a data URI. We can decode, parse and return early if that's the case.\n\n if (steeringUri.startsWith('data:')) {\n this.decodeDataUriManifest_(steeringUri.substring(steeringUri.indexOf(',') + 1));\n return;\n } // reloadUri is the resolution of the main manifest URL and steering URL.\n\n this.steeringManifest.reloadUri = resolveUrl(baseUrl, steeringUri); // pathwayId is HLS defaultServiceLocation is DASH\n\n this.defaultPathway = steeringTag.pathwayId || steeringTag.defaultServiceLocation; // currently only DASH supports the following properties on <ContentSteering> tags.\n\n this.queryBeforeStart = steeringTag.queryBeforeStart;\n this.proxyServerUrl_ = steeringTag.proxyServerURL; // trigger a steering event if we have a pathway from the content steering tag.\n // this tells VHS which segment pathway to start with.\n // If queryBeforeStart is true we need to wait for the steering manifest response.\n\n if (this.defaultPathway && !this.queryBeforeStart) {\n this.trigger('content-steering');\n }\n }\n /**\n * Requests the content steering manifest and parse the response. This should only be called after\n * assignTagProperties was called with a content steering tag.\n *\n * @param {string} initialUri The optional uri to make the request with.\n * If set, the request should be made with exactly what is passed in this variable.\n * This scenario should only happen once on initalization.\n */\n\n requestSteeringManifest(initial) {\n const reloadUri = this.steeringManifest.reloadUri;\n if (!reloadUri) {\n return;\n } // We currently don't support passing MPD query parameters directly to the content steering URL as this requires\n // ExtUrlQueryInfo tag support. See the DASH content steering spec section 8.1.\n // This request URI accounts for manifest URIs that have been excluded.\n\n const uri = initial ? reloadUri : this.getRequestURI(reloadUri); // If there are no valid manifest URIs, we should stop content steering.\n\n if (!uri) {\n this.logger_('No valid content steering manifest URIs. Stopping content steering.');\n this.trigger('error');\n this.dispose();\n return;\n }\n this.request_ = this.xhr_({\n uri\n }, (error, errorInfo) => {\n if (error) {\n // If the client receives HTTP 410 Gone in response to a manifest request,\n // it MUST NOT issue another request for that URI for the remainder of the\n // playback session. It MAY continue to use the most-recently obtained set\n // of Pathways.\n if (errorInfo.status === 410) {\n this.logger_(`manifest request 410 ${error}.`);\n this.logger_(`There will be no more content steering requests to ${uri} this session.`);\n this.excludedSteeringManifestURLs.add(uri);\n return;\n } // If the client receives HTTP 429 Too Many Requests with a Retry-After\n // header in response to a manifest request, it SHOULD wait until the time\n // specified by the Retry-After header to reissue the request.\n\n if (errorInfo.status === 429) {\n const retrySeconds = errorInfo.responseHeaders['retry-after'];\n this.logger_(`manifest request 429 ${error}.`);\n this.logger_(`content steering will retry in ${retrySeconds} seconds.`);\n this.startTTLTimeout_(parseInt(retrySeconds, 10));\n return;\n } // If the Steering Manifest cannot be loaded and parsed correctly, the\n // client SHOULD continue to use the previous values and attempt to reload\n // it after waiting for the previously-specified TTL (or 5 minutes if\n // none).\n\n this.logger_(`manifest failed to load ${error}.`);\n this.startTTLTimeout_();\n return;\n }\n const steeringManifestJson = JSON.parse(this.request_.responseText);\n this.assignSteeringProperties_(steeringManifestJson);\n this.startTTLTimeout_();\n });\n }\n /**\n * Set the proxy server URL and add the steering manifest url as a URI encoded parameter.\n *\n * @param {string} steeringUrl the steering manifest url\n * @return the steering manifest url to a proxy server with all parameters set\n */\n\n setProxyServerUrl_(steeringUrl) {\n const steeringUrlObject = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().URL)(steeringUrl);\n const proxyServerUrlObject = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().URL)(this.proxyServerUrl_);\n proxyServerUrlObject.searchParams.set('url', encodeURI(steeringUrlObject.toString()));\n return this.setSteeringParams_(proxyServerUrlObject.toString());\n }\n /**\n * Decodes and parses the data uri encoded steering manifest\n *\n * @param {string} dataUri the data uri to be decoded and parsed.\n */\n\n decodeDataUriManifest_(dataUri) {\n const steeringManifestJson = JSON.parse(global_window__WEBPACK_IMPORTED_MODULE_0___default().atob(dataUri));\n this.assignSteeringProperties_(steeringManifestJson);\n }\n /**\n * Set the HLS or DASH content steering manifest request query parameters. For example:\n * _HLS_pathway=\"<CURRENT-PATHWAY-ID>\" and _HLS_throughput=<THROUGHPUT>\n * _DASH_pathway and _DASH_throughput\n *\n * @param {string} uri to add content steering server parameters to.\n * @return a new uri as a string with the added steering query parameters.\n */\n\n setSteeringParams_(url) {\n const urlObject = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().URL)(url);\n const path = this.getPathway();\n const networkThroughput = this.getBandwidth_();\n if (path) {\n const pathwayKey = `_${this.manifestType_}_pathway`;\n urlObject.searchParams.set(pathwayKey, path);\n }\n if (networkThroughput) {\n const throughputKey = `_${this.manifestType_}_throughput`;\n urlObject.searchParams.set(throughputKey, networkThroughput);\n }\n return urlObject.toString();\n }\n /**\n * Assigns the current steering manifest properties and to the SteeringManifest object\n *\n * @param {Object} steeringJson the raw JSON steering manifest\n */\n\n assignSteeringProperties_(steeringJson) {\n this.steeringManifest.version = steeringJson.VERSION;\n if (!this.steeringManifest.version) {\n this.logger_(`manifest version is ${steeringJson.VERSION}, which is not supported.`);\n this.trigger('error');\n return;\n }\n this.steeringManifest.ttl = steeringJson.TTL;\n this.steeringManifest.reloadUri = steeringJson['RELOAD-URI']; // HLS = PATHWAY-PRIORITY required. DASH = SERVICE-LOCATION-PRIORITY optional\n\n this.steeringManifest.priority = steeringJson['PATHWAY-PRIORITY'] || steeringJson['SERVICE-LOCATION-PRIORITY']; // Pathway clones to be created/updated in HLS.\n // See section 7.2 https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/\n\n this.steeringManifest.pathwayClones = steeringJson['PATHWAY-CLONES'];\n this.nextPathwayClones = this.steeringManifest.pathwayClones; // 1. apply first pathway from the array.\n // 2. if first pathway doesn't exist in manifest, try next pathway.\n // a. if all pathways are exhausted, ignore the steering manifest priority.\n // 3. if segments fail from an established pathway, try all variants/renditions, then exclude the failed pathway.\n // a. exclude a pathway for a minimum of the last TTL duration. Meaning, from the next steering response,\n // the excluded pathway will be ignored.\n // See excludePathway usage in excludePlaylist().\n // If there are no available pathways, we need to stop content steering.\n\n if (!this.availablePathways_.size) {\n this.logger_('There are no available pathways for content steering. Ending content steering.');\n this.trigger('error');\n this.dispose();\n }\n const chooseNextPathway = pathwaysByPriority => {\n for (const path of pathwaysByPriority) {\n if (this.availablePathways_.has(path)) {\n return path;\n }\n } // If no pathway matches, ignore the manifest and choose the first available.\n\n return [...this.availablePathways_][0];\n };\n const nextPathway = chooseNextPathway(this.steeringManifest.priority);\n if (this.currentPathway !== nextPathway) {\n this.currentPathway = nextPathway;\n this.trigger('content-steering');\n }\n }\n /**\n * Returns the pathway to use for steering decisions\n *\n * @return {string} returns the current pathway or the default\n */\n\n getPathway() {\n return this.currentPathway || this.defaultPathway;\n }\n /**\n * Chooses the manifest request URI based on proxy URIs and server URLs.\n * Also accounts for exclusion on certain manifest URIs.\n *\n * @param {string} reloadUri the base uri before parameters\n *\n * @return {string} the final URI for the request to the manifest server.\n */\n\n getRequestURI(reloadUri) {\n if (!reloadUri) {\n return null;\n }\n const isExcluded = uri => this.excludedSteeringManifestURLs.has(uri);\n if (this.proxyServerUrl_) {\n const proxyURI = this.setProxyServerUrl_(reloadUri);\n if (!isExcluded(proxyURI)) {\n return proxyURI;\n }\n }\n const steeringURI = this.setSteeringParams_(reloadUri);\n if (!isExcluded(steeringURI)) {\n return steeringURI;\n } // Return nothing if all valid manifest URIs are excluded.\n\n return null;\n }\n /**\n * Start the timeout for re-requesting the steering manifest at the TTL interval.\n *\n * @param {number} ttl time in seconds of the timeout. Defaults to the\n * ttl interval in the steering manifest\n */\n\n startTTLTimeout_(ttl = this.steeringManifest.ttl) {\n // 300 (5 minutes) is the default value.\n const ttlMS = ttl * 1000;\n this.ttlTimeout_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(() => {\n this.requestSteeringManifest();\n }, ttlMS);\n }\n /**\n * Clear the TTL timeout if necessary.\n */\n\n clearTTLTimeout_() {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.ttlTimeout_);\n this.ttlTimeout_ = null;\n }\n /**\n * aborts any current steering xhr and sets the current request object to null\n */\n\n abort() {\n if (this.request_) {\n this.request_.abort();\n }\n this.request_ = null;\n }\n /**\n * aborts steering requests clears the ttl timeout and resets all properties.\n */\n\n dispose() {\n this.off('content-steering');\n this.off('error');\n this.abort();\n this.clearTTLTimeout_();\n this.currentPathway = null;\n this.defaultPathway = null;\n this.queryBeforeStart = null;\n this.proxyServerUrl_ = null;\n this.manifestType_ = null;\n this.ttlTimeout_ = null;\n this.request_ = null;\n this.excludedSteeringManifestURLs = new Set();\n this.availablePathways_ = new Set();\n this.steeringManifest = new SteeringManifest();\n }\n /**\n * adds a pathway to the available pathways set\n *\n * @param {string} pathway the pathway string to add\n */\n\n addAvailablePathway(pathway) {\n if (pathway) {\n this.availablePathways_.add(pathway);\n }\n }\n /**\n * Clears all pathways from the available pathways set\n */\n\n clearAvailablePathways() {\n this.availablePathways_.clear();\n }\n /**\n * Removes a pathway from the available pathways set.\n */\n\n excludePathway(pathway) {\n return this.availablePathways_.delete(pathway);\n }\n /**\n * Checks the refreshed DASH manifest content steering tag for changes.\n *\n * @param {string} baseURL new steering tag on DASH manifest refresh\n * @param {Object} newTag the new tag to check for changes\n * @return a true or false whether the new tag has different values\n */\n\n didDASHTagChange(baseURL, newTag) {\n return !newTag && this.steeringManifest.reloadUri || newTag && (resolveUrl(baseURL, newTag.serverURL) !== this.steeringManifest.reloadUri || newTag.defaultServiceLocation !== this.defaultPathway || newTag.queryBeforeStart !== this.queryBeforeStart || newTag.proxyServerURL !== this.proxyServerUrl_);\n }\n getAvailablePathways() {\n return this.availablePathways_;\n }\n}\n\n/**\n * @file playlist-controller.js\n */\nconst ABORT_EARLY_EXCLUSION_SECONDS = 10;\nlet Vhs$1; // SegmentLoader stats that need to have each loader's\n// values summed to calculate the final value\n\nconst loaderStats = ['mediaRequests', 'mediaRequestsAborted', 'mediaRequestsTimedout', 'mediaRequestsErrored', 'mediaTransferDuration', 'mediaBytesTransferred', 'mediaAppends'];\nconst sumLoaderStat = function (stat) {\n return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat];\n};\nconst shouldSwitchToMedia = function ({\n currentPlaylist,\n buffered,\n currentTime,\n nextPlaylist,\n bufferLowWaterLine,\n bufferHighWaterLine,\n duration,\n bufferBasedABR,\n log\n}) {\n // we have no other playlist to switch to\n if (!nextPlaylist) {\n videojs.log.warn('We received no playlist to switch to. Please check your stream.');\n return false;\n }\n const sharedLogLine = `allowing switch ${currentPlaylist && currentPlaylist.id || 'null'} -> ${nextPlaylist.id}`;\n if (!currentPlaylist) {\n log(`${sharedLogLine} as current playlist is not set`);\n return true;\n } // no need to switch if playlist is the same\n\n if (nextPlaylist.id === currentPlaylist.id) {\n return false;\n } // determine if current time is in a buffered range.\n\n const isBuffered = Boolean(findRange(buffered, currentTime).length); // If the playlist is live, then we want to not take low water line into account.\n // This is because in LIVE, the player plays 3 segments from the end of the\n // playlist, and if `BUFFER_LOW_WATER_LINE` is greater than the duration availble\n // in those segments, a viewer will never experience a rendition upswitch.\n\n if (!currentPlaylist.endList) {\n // For LLHLS live streams, don't switch renditions before playback has started, as it almost\n // doubles the time to first playback.\n if (!isBuffered && typeof currentPlaylist.partTargetDuration === 'number') {\n log(`not ${sharedLogLine} as current playlist is live llhls, but currentTime isn't in buffered.`);\n return false;\n }\n log(`${sharedLogLine} as current playlist is live`);\n return true;\n }\n const forwardBuffer = timeAheadOf(buffered, currentTime);\n const maxBufferLowWaterLine = bufferBasedABR ? Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config.MAX_BUFFER_LOW_WATER_LINE; // For the same reason as LIVE, we ignore the low water line when the VOD\n // duration is below the max potential low water line\n\n if (duration < maxBufferLowWaterLine) {\n log(`${sharedLogLine} as duration < max low water line (${duration} < ${maxBufferLowWaterLine})`);\n return true;\n }\n const nextBandwidth = nextPlaylist.attributes.BANDWIDTH;\n const currBandwidth = currentPlaylist.attributes.BANDWIDTH; // when switching down, if our buffer is lower than the high water line,\n // we can switch down\n\n if (nextBandwidth < currBandwidth && (!bufferBasedABR || forwardBuffer < bufferHighWaterLine)) {\n let logLine = `${sharedLogLine} as next bandwidth < current bandwidth (${nextBandwidth} < ${currBandwidth})`;\n if (bufferBasedABR) {\n logLine += ` and forwardBuffer < bufferHighWaterLine (${forwardBuffer} < ${bufferHighWaterLine})`;\n }\n log(logLine);\n return true;\n } // and if our buffer is higher than the low water line,\n // we can switch up\n\n if ((!bufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) {\n let logLine = `${sharedLogLine} as forwardBuffer >= bufferLowWaterLine (${forwardBuffer} >= ${bufferLowWaterLine})`;\n if (bufferBasedABR) {\n logLine += ` and next bandwidth > current bandwidth (${nextBandwidth} > ${currBandwidth})`;\n }\n log(logLine);\n return true;\n }\n log(`not ${sharedLogLine} as no switching criteria met`);\n return false;\n};\n/**\n * the main playlist controller controller all interactons\n * between playlists and segmentloaders. At this time this mainly\n * involves a main playlist and a series of audio playlists\n * if they are available\n *\n * @class PlaylistController\n * @extends videojs.EventTarget\n */\n\nclass PlaylistController extends videojs.EventTarget {\n constructor(options) {\n super();\n const {\n src,\n withCredentials,\n tech,\n bandwidth,\n externVhs,\n useCueTags,\n playlistExclusionDuration,\n enableLowInitialPlaylist,\n sourceType,\n cacheEncryptionKeys,\n bufferBasedABR,\n leastPixelDiffSelector,\n captionServices\n } = options;\n if (!src) {\n throw new Error('A non-empty playlist URL or JSON manifest string is required');\n }\n let {\n maxPlaylistRetries\n } = options;\n if (maxPlaylistRetries === null || typeof maxPlaylistRetries === 'undefined') {\n maxPlaylistRetries = Infinity;\n }\n Vhs$1 = externVhs;\n this.bufferBasedABR = Boolean(bufferBasedABR);\n this.leastPixelDiffSelector = Boolean(leastPixelDiffSelector);\n this.withCredentials = withCredentials;\n this.tech_ = tech;\n this.vhs_ = tech.vhs;\n this.sourceType_ = sourceType;\n this.useCueTags_ = useCueTags;\n this.playlistExclusionDuration = playlistExclusionDuration;\n this.maxPlaylistRetries = maxPlaylistRetries;\n this.enableLowInitialPlaylist = enableLowInitialPlaylist;\n if (this.useCueTags_) {\n this.cueTagsTrack_ = this.tech_.addTextTrack('metadata', 'ad-cues');\n this.cueTagsTrack_.inBandMetadataTrackDispatchType = '';\n }\n this.requestOptions_ = {\n withCredentials,\n maxPlaylistRetries,\n timeout: null\n };\n this.on('error', this.pauseLoading);\n this.mediaTypes_ = createMediaTypes();\n this.mediaSource = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource)();\n this.handleDurationChange_ = this.handleDurationChange_.bind(this);\n this.handleSourceOpen_ = this.handleSourceOpen_.bind(this);\n this.handleSourceEnded_ = this.handleSourceEnded_.bind(this);\n this.mediaSource.addEventListener('durationchange', this.handleDurationChange_); // load the media source into the player\n\n this.mediaSource.addEventListener('sourceopen', this.handleSourceOpen_);\n this.mediaSource.addEventListener('sourceended', this.handleSourceEnded_); // we don't have to handle sourceclose since dispose will handle termination of\n // everything, and the MediaSource should not be detached without a proper disposal\n\n this.seekable_ = createTimeRanges();\n this.hasPlayed_ = false;\n this.syncController_ = new SyncController(options);\n this.segmentMetadataTrack_ = tech.addRemoteTextTrack({\n kind: 'metadata',\n label: 'segment-metadata'\n }, false).track;\n this.decrypter_ = new Decrypter();\n this.sourceUpdater_ = new SourceUpdater(this.mediaSource);\n this.inbandTextTracks_ = {};\n this.timelineChangeController_ = new TimelineChangeController();\n this.keyStatusMap_ = new Map();\n const segmentLoaderSettings = {\n vhs: this.vhs_,\n parse708captions: options.parse708captions,\n useDtsForTimestampOffset: options.useDtsForTimestampOffset,\n captionServices,\n mediaSource: this.mediaSource,\n currentTime: this.tech_.currentTime.bind(this.tech_),\n seekable: () => this.seekable(),\n seeking: () => this.tech_.seeking(),\n duration: () => this.duration(),\n hasPlayed: () => this.hasPlayed_,\n goalBufferLength: () => this.goalBufferLength(),\n bandwidth,\n syncController: this.syncController_,\n decrypter: this.decrypter_,\n sourceType: this.sourceType_,\n inbandTextTracks: this.inbandTextTracks_,\n cacheEncryptionKeys,\n sourceUpdater: this.sourceUpdater_,\n timelineChangeController: this.timelineChangeController_,\n exactManifestTimings: options.exactManifestTimings,\n addMetadataToTextTrack: this.addMetadataToTextTrack.bind(this)\n }; // The source type check not only determines whether a special DASH playlist loader\n // should be used, but also covers the case where the provided src is a vhs-json\n // manifest object (instead of a URL). In the case of vhs-json, the default\n // PlaylistLoader should be used.\n\n this.mainPlaylistLoader_ = this.sourceType_ === 'dash' ? new DashPlaylistLoader(src, this.vhs_, merge(this.requestOptions_, {\n addMetadataToTextTrack: this.addMetadataToTextTrack.bind(this)\n })) : new PlaylistLoader(src, this.vhs_, merge(this.requestOptions_, {\n addDateRangesToTextTrack: this.addDateRangesToTextTrack_.bind(this)\n }));\n this.setupMainPlaylistLoaderListeners_(); // setup segment loaders\n // combined audio/video or just video when alternate audio track is selected\n\n this.mainSegmentLoader_ = new SegmentLoader(merge(segmentLoaderSettings, {\n segmentMetadataTrack: this.segmentMetadataTrack_,\n loaderType: 'main'\n }), options); // alternate audio track\n\n this.audioSegmentLoader_ = new SegmentLoader(merge(segmentLoaderSettings, {\n loaderType: 'audio'\n }), options);\n this.subtitleSegmentLoader_ = new VTTSegmentLoader(merge(segmentLoaderSettings, {\n loaderType: 'vtt',\n featuresNativeTextTracks: this.tech_.featuresNativeTextTracks,\n loadVttJs: () => new Promise((resolve, reject) => {\n function onLoad() {\n tech.off('vttjserror', onError);\n resolve();\n }\n function onError() {\n tech.off('vttjsloaded', onLoad);\n reject();\n }\n tech.one('vttjsloaded', onLoad);\n tech.one('vttjserror', onError); // safe to call multiple times, script will be loaded only once:\n\n tech.addWebVttScript_();\n })\n }), options);\n const getBandwidth = () => {\n return this.mainSegmentLoader_.bandwidth;\n };\n this.contentSteeringController_ = new ContentSteeringController(this.vhs_.xhr, getBandwidth);\n this.setupSegmentLoaderListeners_();\n if (this.bufferBasedABR) {\n this.mainPlaylistLoader_.one('loadedplaylist', () => this.startABRTimer_());\n this.tech_.on('pause', () => this.stopABRTimer_());\n this.tech_.on('play', () => this.startABRTimer_());\n } // Create SegmentLoader stat-getters\n // mediaRequests_\n // mediaRequestsAborted_\n // mediaRequestsTimedout_\n // mediaRequestsErrored_\n // mediaTransferDuration_\n // mediaBytesTransferred_\n // mediaAppends_\n\n loaderStats.forEach(stat => {\n this[stat + '_'] = sumLoaderStat.bind(this, stat);\n });\n this.logger_ = logger('pc');\n this.triggeredFmp4Usage = false;\n if (this.tech_.preload() === 'none') {\n this.loadOnPlay_ = () => {\n this.loadOnPlay_ = null;\n this.mainPlaylistLoader_.load();\n };\n this.tech_.one('play', this.loadOnPlay_);\n } else {\n this.mainPlaylistLoader_.load();\n }\n this.timeToLoadedData__ = -1;\n this.mainAppendsToLoadedData__ = -1;\n this.audioAppendsToLoadedData__ = -1;\n const event = this.tech_.preload() === 'none' ? 'play' : 'loadstart'; // start the first frame timer on loadstart or play (for preload none)\n\n this.tech_.one(event, () => {\n const timeToLoadedDataStart = Date.now();\n this.tech_.one('loadeddata', () => {\n this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart;\n this.mainAppendsToLoadedData__ = this.mainSegmentLoader_.mediaAppends;\n this.audioAppendsToLoadedData__ = this.audioSegmentLoader_.mediaAppends;\n });\n });\n }\n mainAppendsToLoadedData_() {\n return this.mainAppendsToLoadedData__;\n }\n audioAppendsToLoadedData_() {\n return this.audioAppendsToLoadedData__;\n }\n appendsToLoadedData_() {\n const main = this.mainAppendsToLoadedData_();\n const audio = this.audioAppendsToLoadedData_();\n if (main === -1 || audio === -1) {\n return -1;\n }\n return main + audio;\n }\n timeToLoadedData_() {\n return this.timeToLoadedData__;\n }\n /**\n * Run selectPlaylist and switch to the new playlist if we should\n *\n * @param {string} [reason=abr] a reason for why the ABR check is made\n * @private\n */\n\n checkABR_(reason = 'abr') {\n const nextPlaylist = this.selectPlaylist();\n if (nextPlaylist && this.shouldSwitchToMedia_(nextPlaylist)) {\n this.switchMedia_(nextPlaylist, reason);\n }\n }\n switchMedia_(playlist, cause, delay) {\n const oldMedia = this.media();\n const oldId = oldMedia && (oldMedia.id || oldMedia.uri);\n const newId = playlist && (playlist.id || playlist.uri);\n if (oldId && oldId !== newId) {\n this.logger_(`switch media ${oldId} -> ${newId} from ${cause}`);\n this.tech_.trigger({\n type: 'usage',\n name: `vhs-rendition-change-${cause}`\n });\n }\n this.mainPlaylistLoader_.media(playlist, delay);\n }\n /**\n * A function that ensures we switch our playlists inside of `mediaTypes`\n * to match the current `serviceLocation` provided by the contentSteering controller.\n * We want to check media types of `AUDIO`, `SUBTITLES`, and `CLOSED-CAPTIONS`.\n *\n * This should only be called on a DASH playback scenario while using content steering.\n * This is necessary due to differences in how media in HLS manifests are generally tied to\n * a video playlist, where in DASH that is not always the case.\n */\n\n switchMediaForDASHContentSteering_() {\n ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(type => {\n const mediaType = this.mediaTypes_[type];\n const activeGroup = mediaType ? mediaType.activeGroup() : null;\n const pathway = this.contentSteeringController_.getPathway();\n if (activeGroup && pathway) {\n // activeGroup can be an array or a single group\n const mediaPlaylists = activeGroup.length ? activeGroup[0].playlists : activeGroup.playlists;\n const dashMediaPlaylists = mediaPlaylists.filter(p => p.attributes.serviceLocation === pathway); // Switch the current active playlist to the correct CDN\n\n if (dashMediaPlaylists.length) {\n this.mediaTypes_[type].activePlaylistLoader.media(dashMediaPlaylists[0]);\n }\n }\n });\n }\n /**\n * Start a timer that periodically calls checkABR_\n *\n * @private\n */\n\n startABRTimer_() {\n this.stopABRTimer_();\n this.abrTimer_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setInterval(() => this.checkABR_(), 250);\n }\n /**\n * Stop the timer that periodically calls checkABR_\n *\n * @private\n */\n\n stopABRTimer_() {\n // if we're scrubbing, we don't need to pause.\n // This getter will be added to Video.js in version 7.11.\n if (this.tech_.scrubbing && this.tech_.scrubbing()) {\n return;\n }\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearInterval(this.abrTimer_);\n this.abrTimer_ = null;\n }\n /**\n * Get a list of playlists for the currently selected audio playlist\n *\n * @return {Array} the array of audio playlists\n */\n\n getAudioTrackPlaylists_() {\n const main = this.main();\n const defaultPlaylists = main && main.playlists || []; // if we don't have any audio groups then we can only\n // assume that the audio tracks are contained in main\n // playlist array, use that or an empty array.\n\n if (!main || !main.mediaGroups || !main.mediaGroups.AUDIO) {\n return defaultPlaylists;\n }\n const AUDIO = main.mediaGroups.AUDIO;\n const groupKeys = Object.keys(AUDIO);\n let track; // get the current active track\n\n if (Object.keys(this.mediaTypes_.AUDIO.groups).length) {\n track = this.mediaTypes_.AUDIO.activeTrack(); // or get the default track from main if mediaTypes_ isn't setup yet\n } else {\n // default group is `main` or just the first group.\n const defaultGroup = AUDIO.main || groupKeys.length && AUDIO[groupKeys[0]];\n for (const label in defaultGroup) {\n if (defaultGroup[label].default) {\n track = {\n label\n };\n break;\n }\n }\n } // no active track no playlists.\n\n if (!track) {\n return defaultPlaylists;\n }\n const playlists = []; // get all of the playlists that are possible for the\n // active track.\n\n for (const group in AUDIO) {\n if (AUDIO[group][track.label]) {\n const properties = AUDIO[group][track.label];\n if (properties.playlists && properties.playlists.length) {\n playlists.push.apply(playlists, properties.playlists);\n } else if (properties.uri) {\n playlists.push(properties);\n } else if (main.playlists.length) {\n // if an audio group does not have a uri\n // see if we have main playlists that use it as a group.\n // if we do then add those to the playlists list.\n for (let i = 0; i < main.playlists.length; i++) {\n const playlist = main.playlists[i];\n if (playlist.attributes && playlist.attributes.AUDIO && playlist.attributes.AUDIO === group) {\n playlists.push(playlist);\n }\n }\n }\n }\n }\n if (!playlists.length) {\n return defaultPlaylists;\n }\n return playlists;\n }\n /**\n * Register event handlers on the main playlist loader. A helper\n * function for construction time.\n *\n * @private\n */\n\n setupMainPlaylistLoaderListeners_() {\n this.mainPlaylistLoader_.on('loadedmetadata', () => {\n const media = this.mainPlaylistLoader_.media();\n const requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to\n // timeout the request.\n\n if (isLowestEnabledRendition(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.media())) {\n this.requestOptions_.timeout = 0;\n } else {\n this.requestOptions_.timeout = requestTimeout;\n } // if this isn't a live video and preload permits, start\n // downloading segments\n\n if (media.endList && this.tech_.preload() !== 'none') {\n this.mainSegmentLoader_.playlist(media, this.requestOptions_);\n this.mainSegmentLoader_.load();\n }\n setupMediaGroups({\n sourceType: this.sourceType_,\n segmentLoaders: {\n AUDIO: this.audioSegmentLoader_,\n SUBTITLES: this.subtitleSegmentLoader_,\n main: this.mainSegmentLoader_\n },\n tech: this.tech_,\n requestOptions: this.requestOptions_,\n mainPlaylistLoader: this.mainPlaylistLoader_,\n vhs: this.vhs_,\n main: this.main(),\n mediaTypes: this.mediaTypes_,\n excludePlaylist: this.excludePlaylist.bind(this)\n });\n this.triggerPresenceUsage_(this.main(), media);\n this.setupFirstPlay();\n if (!this.mediaTypes_.AUDIO.activePlaylistLoader || this.mediaTypes_.AUDIO.activePlaylistLoader.media()) {\n this.trigger('selectedinitialmedia');\n } else {\n // We must wait for the active audio playlist loader to\n // finish setting up before triggering this event so the\n // representations API and EME setup is correct\n this.mediaTypes_.AUDIO.activePlaylistLoader.one('loadedmetadata', () => {\n this.trigger('selectedinitialmedia');\n });\n }\n });\n this.mainPlaylistLoader_.on('loadedplaylist', () => {\n if (this.loadOnPlay_) {\n this.tech_.off('play', this.loadOnPlay_);\n }\n let updatedPlaylist = this.mainPlaylistLoader_.media();\n if (!updatedPlaylist) {\n // Add content steering listeners on first load and init.\n this.attachContentSteeringListeners_();\n this.initContentSteeringController_(); // exclude any variants that are not supported by the browser before selecting\n // an initial media as the playlist selectors do not consider browser support\n\n this.excludeUnsupportedVariants_();\n let selectedMedia;\n if (this.enableLowInitialPlaylist) {\n selectedMedia = this.selectInitialPlaylist();\n }\n if (!selectedMedia) {\n selectedMedia = this.selectPlaylist();\n }\n if (!selectedMedia || !this.shouldSwitchToMedia_(selectedMedia)) {\n return;\n }\n this.initialMedia_ = selectedMedia;\n this.switchMedia_(this.initialMedia_, 'initial'); // Under the standard case where a source URL is provided, loadedplaylist will\n // fire again since the playlist will be requested. In the case of vhs-json\n // (where the manifest object is provided as the source), when the media\n // playlist's `segments` list is already available, a media playlist won't be\n // requested, and loadedplaylist won't fire again, so the playlist handler must be\n // called on its own here.\n\n const haveJsonSource = this.sourceType_ === 'vhs-json' && this.initialMedia_.segments;\n if (!haveJsonSource) {\n return;\n }\n updatedPlaylist = this.initialMedia_;\n }\n this.handleUpdatedMediaPlaylist(updatedPlaylist);\n });\n this.mainPlaylistLoader_.on('error', () => {\n const error = this.mainPlaylistLoader_.error;\n this.excludePlaylist({\n playlistToExclude: error.playlist,\n error\n });\n });\n this.mainPlaylistLoader_.on('mediachanging', () => {\n this.mainSegmentLoader_.abort();\n this.mainSegmentLoader_.pause();\n });\n this.mainPlaylistLoader_.on('mediachange', () => {\n const media = this.mainPlaylistLoader_.media();\n const requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to\n // timeout the request.\n\n if (isLowestEnabledRendition(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.media())) {\n this.requestOptions_.timeout = 0;\n } else {\n this.requestOptions_.timeout = requestTimeout;\n }\n if (this.sourceType_ === 'dash') {\n // we don't want to re-request the same hls playlist right after it was changed\n this.mainPlaylistLoader_.load();\n } // TODO: Create a new event on the PlaylistLoader that signals\n // that the segments have changed in some way and use that to\n // update the SegmentLoader instead of doing it twice here and\n // on `loadedplaylist`\n\n this.mainSegmentLoader_.pause();\n this.mainSegmentLoader_.playlist(media, this.requestOptions_);\n if (this.waitingForFastQualityPlaylistReceived_) {\n this.runFastQualitySwitch_();\n } else {\n this.mainSegmentLoader_.load();\n }\n this.tech_.trigger({\n type: 'mediachange',\n bubbles: true\n });\n });\n this.mainPlaylistLoader_.on('playlistunchanged', () => {\n const updatedPlaylist = this.mainPlaylistLoader_.media(); // ignore unchanged playlists that have already been\n // excluded for not-changing. We likely just have a really slowly updating\n // playlist.\n\n if (updatedPlaylist.lastExcludeReason_ === 'playlist-unchanged') {\n return;\n }\n const playlistOutdated = this.stuckAtPlaylistEnd_(updatedPlaylist);\n if (playlistOutdated) {\n // Playlist has stopped updating and we're stuck at its end. Try to\n // exclude it and switch to another playlist in the hope that that\n // one is updating (and give the player a chance to re-adjust to the\n // safe live point).\n this.excludePlaylist({\n error: {\n message: 'Playlist no longer updating.',\n reason: 'playlist-unchanged'\n }\n }); // useful for monitoring QoS\n\n this.tech_.trigger('playliststuck');\n }\n });\n this.mainPlaylistLoader_.on('renditiondisabled', () => {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-rendition-disabled'\n });\n });\n this.mainPlaylistLoader_.on('renditionenabled', () => {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-rendition-enabled'\n });\n });\n }\n /**\n * Given an updated media playlist (whether it was loaded for the first time, or\n * refreshed for live playlists), update any relevant properties and state to reflect\n * changes in the media that should be accounted for (e.g., cues and duration).\n *\n * @param {Object} updatedPlaylist the updated media playlist object\n *\n * @private\n */\n\n handleUpdatedMediaPlaylist(updatedPlaylist) {\n if (this.useCueTags_) {\n this.updateAdCues_(updatedPlaylist);\n } // TODO: Create a new event on the PlaylistLoader that signals\n // that the segments have changed in some way and use that to\n // update the SegmentLoader instead of doing it twice here and\n // on `mediachange`\n\n this.mainSegmentLoader_.pause();\n this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_);\n if (this.waitingForFastQualityPlaylistReceived_) {\n this.runFastQualitySwitch_();\n }\n this.updateDuration(!updatedPlaylist.endList); // If the player isn't paused, ensure that the segment loader is running,\n // as it is possible that it was temporarily stopped while waiting for\n // a playlist (e.g., in case the playlist errored and we re-requested it).\n\n if (!this.tech_.paused()) {\n this.mainSegmentLoader_.load();\n if (this.audioSegmentLoader_) {\n this.audioSegmentLoader_.load();\n }\n }\n }\n /**\n * A helper function for triggerring presence usage events once per source\n *\n * @private\n */\n\n triggerPresenceUsage_(main, media) {\n const mediaGroups = main.mediaGroups || {};\n let defaultDemuxed = true;\n const audioGroupKeys = Object.keys(mediaGroups.AUDIO);\n for (const mediaGroup in mediaGroups.AUDIO) {\n for (const label in mediaGroups.AUDIO[mediaGroup]) {\n const properties = mediaGroups.AUDIO[mediaGroup][label];\n if (!properties.uri) {\n defaultDemuxed = false;\n }\n }\n }\n if (defaultDemuxed) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-demuxed'\n });\n }\n if (Object.keys(mediaGroups.SUBTITLES).length) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-webvtt'\n });\n }\n if (Vhs$1.Playlist.isAes(media)) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-aes'\n });\n }\n if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-alternate-audio'\n });\n }\n if (this.useCueTags_) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-playlist-cue-tags'\n });\n }\n }\n shouldSwitchToMedia_(nextPlaylist) {\n const currentPlaylist = this.mainPlaylistLoader_.media() || this.mainPlaylistLoader_.pendingMedia_;\n const currentTime = this.tech_.currentTime();\n const bufferLowWaterLine = this.bufferLowWaterLine();\n const bufferHighWaterLine = this.bufferHighWaterLine();\n const buffered = this.tech_.buffered();\n return shouldSwitchToMedia({\n buffered,\n currentTime,\n currentPlaylist,\n nextPlaylist,\n bufferLowWaterLine,\n bufferHighWaterLine,\n duration: this.duration(),\n bufferBasedABR: this.bufferBasedABR,\n log: this.logger_\n });\n }\n /**\n * Register event handlers on the segment loaders. A helper function\n * for construction time.\n *\n * @private\n */\n\n setupSegmentLoaderListeners_() {\n this.mainSegmentLoader_.on('bandwidthupdate', () => {\n // Whether or not buffer based ABR or another ABR is used, on a bandwidth change it's\n // useful to check to see if a rendition switch should be made.\n this.checkABR_('bandwidthupdate');\n this.tech_.trigger('bandwidthupdate');\n });\n this.mainSegmentLoader_.on('timeout', () => {\n if (this.bufferBasedABR) {\n // If a rendition change is needed, then it would've be done on `bandwidthupdate`.\n // Here the only consideration is that for buffer based ABR there's no guarantee\n // of an immediate switch (since the bandwidth is averaged with a timeout\n // bandwidth value of 1), so force a load on the segment loader to keep it going.\n this.mainSegmentLoader_.load();\n }\n }); // `progress` events are not reliable enough of a bandwidth measure to trigger buffer\n // based ABR.\n\n if (!this.bufferBasedABR) {\n this.mainSegmentLoader_.on('progress', () => {\n this.trigger('progress');\n });\n }\n this.mainSegmentLoader_.on('error', () => {\n const error = this.mainSegmentLoader_.error();\n this.excludePlaylist({\n playlistToExclude: error.playlist,\n error\n });\n });\n this.mainSegmentLoader_.on('appenderror', () => {\n this.error = this.mainSegmentLoader_.error_;\n this.trigger('error');\n });\n this.mainSegmentLoader_.on('syncinfoupdate', () => {\n this.onSyncInfoUpdate_();\n });\n this.mainSegmentLoader_.on('timestampoffset', () => {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-timestamp-offset'\n });\n });\n this.audioSegmentLoader_.on('syncinfoupdate', () => {\n this.onSyncInfoUpdate_();\n });\n this.audioSegmentLoader_.on('appenderror', () => {\n this.error = this.audioSegmentLoader_.error_;\n this.trigger('error');\n });\n this.mainSegmentLoader_.on('ended', () => {\n this.logger_('main segment loader ended');\n this.onEndOfStream();\n });\n this.mainSegmentLoader_.on('earlyabort', event => {\n // never try to early abort with the new ABR algorithm\n if (this.bufferBasedABR) {\n return;\n }\n this.delegateLoaders_('all', ['abort']);\n this.excludePlaylist({\n error: {\n message: 'Aborted early because there isn\\'t enough bandwidth to complete ' + 'the request without rebuffering.'\n },\n playlistExclusionDuration: ABORT_EARLY_EXCLUSION_SECONDS\n });\n });\n const updateCodecs = () => {\n if (!this.sourceUpdater_.hasCreatedSourceBuffers()) {\n return this.tryToCreateSourceBuffers_();\n }\n const codecs = this.getCodecsOrExclude_(); // no codecs means that the playlist was excluded\n\n if (!codecs) {\n return;\n }\n this.sourceUpdater_.addOrChangeSourceBuffers(codecs);\n };\n this.mainSegmentLoader_.on('trackinfo', updateCodecs);\n this.audioSegmentLoader_.on('trackinfo', updateCodecs);\n this.mainSegmentLoader_.on('fmp4', () => {\n if (!this.triggeredFmp4Usage) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-fmp4'\n });\n this.triggeredFmp4Usage = true;\n }\n });\n this.audioSegmentLoader_.on('fmp4', () => {\n if (!this.triggeredFmp4Usage) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-fmp4'\n });\n this.triggeredFmp4Usage = true;\n }\n });\n this.audioSegmentLoader_.on('ended', () => {\n this.logger_('audioSegmentLoader ended');\n this.onEndOfStream();\n });\n }\n mediaSecondsLoaded_() {\n return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded);\n }\n /**\n * Call load on our SegmentLoaders\n */\n\n load() {\n this.mainSegmentLoader_.load();\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n this.audioSegmentLoader_.load();\n }\n if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {\n this.subtitleSegmentLoader_.load();\n }\n }\n /**\n * Re-tune playback quality level for the current player\n * conditions. This method will perform destructive actions like removing\n * already buffered content in order to readjust the currently active\n * playlist quickly. This is good for manual quality changes\n *\n * @private\n */\n\n fastQualityChange_(media = this.selectPlaylist()) {\n if (media && media === this.mainPlaylistLoader_.media()) {\n this.logger_('skipping fastQualityChange because new media is same as old');\n return;\n }\n this.switchMedia_(media, 'fast-quality'); // we would like to avoid race condition when we call fastQuality,\n // reset everything and start loading segments from prev segments instead of new because new playlist is not received yet\n\n this.waitingForFastQualityPlaylistReceived_ = true;\n }\n runFastQualitySwitch_() {\n this.waitingForFastQualityPlaylistReceived_ = false; // Delete all buffered data to allow an immediate quality switch, then seek to give\n // the browser a kick to remove any cached frames from the previous rendtion (.04 seconds\n // ahead was roughly the minimum that will accomplish this across a variety of content\n // in IE and Edge, but seeking in place is sufficient on all other browsers)\n // Edge/IE bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14600375/\n // Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=651904\n\n this.mainSegmentLoader_.pause();\n this.mainSegmentLoader_.resetEverything(() => {\n this.tech_.setCurrentTime(this.tech_.currentTime());\n }); // don't need to reset audio as it is reset when media changes\n }\n /**\n * Begin playback.\n */\n\n play() {\n if (this.setupFirstPlay()) {\n return;\n }\n if (this.tech_.ended()) {\n this.tech_.setCurrentTime(0);\n }\n if (this.hasPlayed_) {\n this.load();\n }\n const seekable = this.tech_.seekable(); // if the viewer has paused and we fell out of the live window,\n // seek forward to the live point\n\n if (this.tech_.duration() === Infinity) {\n if (this.tech_.currentTime() < seekable.start(0)) {\n return this.tech_.setCurrentTime(seekable.end(seekable.length - 1));\n }\n }\n }\n /**\n * Seek to the latest media position if this is a live video and the\n * player and video are loaded and initialized.\n */\n\n setupFirstPlay() {\n const media = this.mainPlaylistLoader_.media(); // Check that everything is ready to begin buffering for the first call to play\n // If 1) there is no active media\n // 2) the player is paused\n // 3) the first play has already been setup\n // then exit early\n\n if (!media || this.tech_.paused() || this.hasPlayed_) {\n return false;\n } // when the video is a live stream and/or has a start time\n\n if (!media.endList || media.start) {\n const seekable = this.seekable();\n if (!seekable.length) {\n // without a seekable range, the player cannot seek to begin buffering at the\n // live or start point\n return false;\n }\n const seekableEnd = seekable.end(0);\n let startPoint = seekableEnd;\n if (media.start) {\n const offset = media.start.timeOffset;\n if (offset < 0) {\n startPoint = Math.max(seekableEnd + offset, seekable.start(0));\n } else {\n startPoint = Math.min(seekableEnd, offset);\n }\n } // trigger firstplay to inform the source handler to ignore the next seek event\n\n this.trigger('firstplay'); // seek to the live point\n\n this.tech_.setCurrentTime(startPoint);\n }\n this.hasPlayed_ = true; // we can begin loading now that everything is ready\n\n this.load();\n return true;\n }\n /**\n * handle the sourceopen event on the MediaSource\n *\n * @private\n */\n\n handleSourceOpen_() {\n // Only attempt to create the source buffer if none already exist.\n // handleSourceOpen is also called when we are \"re-opening\" a source buffer\n // after `endOfStream` has been called (in response to a seek for instance)\n this.tryToCreateSourceBuffers_(); // if autoplay is enabled, begin playback. This is duplicative of\n // code in video.js but is required because play() must be invoked\n // *after* the media source has opened.\n\n if (this.tech_.autoplay()) {\n const playPromise = this.tech_.play(); // Catch/silence error when a pause interrupts a play request\n // on browsers which return a promise\n\n if (typeof playPromise !== 'undefined' && typeof playPromise.then === 'function') {\n playPromise.then(null, e => {});\n }\n }\n this.trigger('sourceopen');\n }\n /**\n * handle the sourceended event on the MediaSource\n *\n * @private\n */\n\n handleSourceEnded_() {\n if (!this.inbandTextTracks_.metadataTrack_) {\n return;\n }\n const cues = this.inbandTextTracks_.metadataTrack_.cues;\n if (!cues || !cues.length) {\n return;\n }\n const duration = this.duration();\n cues[cues.length - 1].endTime = isNaN(duration) || Math.abs(duration) === Infinity ? Number.MAX_VALUE : duration;\n }\n /**\n * handle the durationchange event on the MediaSource\n *\n * @private\n */\n\n handleDurationChange_() {\n this.tech_.trigger('durationchange');\n }\n /**\n * Calls endOfStream on the media source when all active stream types have called\n * endOfStream\n *\n * @param {string} streamType\n * Stream type of the segment loader that called endOfStream\n * @private\n */\n\n onEndOfStream() {\n let isEndOfStream = this.mainSegmentLoader_.ended_;\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n const mainMediaInfo = this.mainSegmentLoader_.getCurrentMediaInfo_(); // if the audio playlist loader exists, then alternate audio is active\n\n if (!mainMediaInfo || mainMediaInfo.hasVideo) {\n // if we do not know if the main segment loader contains video yet or if we\n // definitively know the main segment loader contains video, then we need to wait\n // for both main and audio segment loaders to call endOfStream\n isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_;\n } else {\n // otherwise just rely on the audio loader\n isEndOfStream = this.audioSegmentLoader_.ended_;\n }\n }\n if (!isEndOfStream) {\n return;\n }\n this.stopABRTimer_();\n this.sourceUpdater_.endOfStream();\n }\n /**\n * Check if a playlist has stopped being updated\n *\n * @param {Object} playlist the media playlist object\n * @return {boolean} whether the playlist has stopped being updated or not\n */\n\n stuckAtPlaylistEnd_(playlist) {\n const seekable = this.seekable();\n if (!seekable.length) {\n // playlist doesn't have enough information to determine whether we are stuck\n return false;\n }\n const expired = this.syncController_.getExpiredTime(playlist, this.duration());\n if (expired === null) {\n return false;\n } // does not use the safe live end to calculate playlist end, since we\n // don't want to say we are stuck while there is still content\n\n const absolutePlaylistEnd = Vhs$1.Playlist.playlistEnd(playlist, expired);\n const currentTime = this.tech_.currentTime();\n const buffered = this.tech_.buffered();\n if (!buffered.length) {\n // return true if the playhead reached the absolute end of the playlist\n return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA;\n }\n const bufferedEnd = buffered.end(buffered.length - 1); // return true if there is too little buffer left and buffer has reached absolute\n // end of playlist\n\n return bufferedEnd - currentTime <= SAFE_TIME_DELTA && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA;\n }\n /**\n * Exclude a playlist for a set amount of time, making it unavailable for selection by\n * the rendition selection algorithm, then force a new playlist (rendition) selection.\n *\n * @param {Object=} playlistToExclude\n * the playlist to exclude, defaults to the currently selected playlist\n * @param {Object=} error\n * an optional error\n * @param {number=} playlistExclusionDuration\n * an optional number of seconds to exclude the playlist\n */\n\n excludePlaylist({\n playlistToExclude = this.mainPlaylistLoader_.media(),\n error = {},\n playlistExclusionDuration\n }) {\n // If the `error` was generated by the playlist loader, it will contain\n // the playlist we were trying to load (but failed) and that should be\n // excluded instead of the currently selected playlist which is likely\n // out-of-date in this scenario\n playlistToExclude = playlistToExclude || this.mainPlaylistLoader_.media();\n playlistExclusionDuration = playlistExclusionDuration || error.playlistExclusionDuration || this.playlistExclusionDuration; // If there is no current playlist, then an error occurred while we were\n // trying to load the main OR while we were disposing of the tech\n\n if (!playlistToExclude) {\n this.error = error;\n if (this.mediaSource.readyState !== 'open') {\n this.trigger('error');\n } else {\n this.sourceUpdater_.endOfStream('network');\n }\n return;\n }\n playlistToExclude.playlistErrors_++;\n const playlists = this.mainPlaylistLoader_.main.playlists;\n const enabledPlaylists = playlists.filter(isEnabled);\n const isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === playlistToExclude; // Don't exclude the only playlist unless it was excluded\n // forever\n\n if (playlists.length === 1 && playlistExclusionDuration !== Infinity) {\n videojs.log.warn(`Problem encountered with playlist ${playlistToExclude.id}. ` + 'Trying again since it is the only playlist.');\n this.tech_.trigger('retryplaylist'); // if this is a final rendition, we should delay\n\n return this.mainPlaylistLoader_.load(isFinalRendition);\n }\n if (isFinalRendition) {\n // If we're content steering, try other pathways.\n if (this.main().contentSteering) {\n const pathway = this.pathwayAttribute_(playlistToExclude); // Ignore at least 1 steering manifest refresh.\n\n const reIncludeDelay = this.contentSteeringController_.steeringManifest.ttl * 1000;\n this.contentSteeringController_.excludePathway(pathway);\n this.excludeThenChangePathway_();\n setTimeout(() => {\n this.contentSteeringController_.addAvailablePathway(pathway);\n }, reIncludeDelay);\n return;\n } // Since we're on the final non-excluded playlist, and we're about to exclude\n // it, instead of erring the player or retrying this playlist, clear out the current\n // exclusion list. This allows other playlists to be attempted in case any have been\n // fixed.\n\n let reincluded = false;\n playlists.forEach(playlist => {\n // skip current playlist which is about to be excluded\n if (playlist === playlistToExclude) {\n return;\n }\n const excludeUntil = playlist.excludeUntil; // a playlist cannot be reincluded if it wasn't excluded to begin with.\n\n if (typeof excludeUntil !== 'undefined' && excludeUntil !== Infinity) {\n reincluded = true;\n delete playlist.excludeUntil;\n }\n });\n if (reincluded) {\n videojs.log.warn('Removing other playlists from the exclusion list because the last ' + 'rendition is about to be excluded.'); // Technically we are retrying a playlist, in that we are simply retrying a previous\n // playlist. This is needed for users relying on the retryplaylist event to catch a\n // case where the player might be stuck and looping through \"dead\" playlists.\n\n this.tech_.trigger('retryplaylist');\n }\n } // Exclude this playlist\n\n let excludeUntil;\n if (playlistToExclude.playlistErrors_ > this.maxPlaylistRetries) {\n excludeUntil = Infinity;\n } else {\n excludeUntil = Date.now() + playlistExclusionDuration * 1000;\n }\n playlistToExclude.excludeUntil = excludeUntil;\n if (error.reason) {\n playlistToExclude.lastExcludeReason_ = error.reason;\n }\n this.tech_.trigger('excludeplaylist');\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-rendition-excluded'\n }); // TODO: only load a new playlist if we're excluding the current playlist\n // If this function was called with a playlist that's not the current active playlist\n // (e.g., media().id !== playlistToExclude.id),\n // then a new playlist should not be selected and loaded, as there's nothing wrong with the current playlist.\n\n const nextPlaylist = this.selectPlaylist();\n if (!nextPlaylist) {\n this.error = 'Playback cannot continue. No available working or supported playlists.';\n this.trigger('error');\n return;\n }\n const logFn = error.internal ? this.logger_ : videojs.log.warn;\n const errorMessage = error.message ? ' ' + error.message : '';\n logFn(`${error.internal ? 'Internal problem' : 'Problem'} encountered with playlist ${playlistToExclude.id}.` + `${errorMessage} Switching to playlist ${nextPlaylist.id}.`); // if audio group changed reset audio loaders\n\n if (nextPlaylist.attributes.AUDIO !== playlistToExclude.attributes.AUDIO) {\n this.delegateLoaders_('audio', ['abort', 'pause']);\n } // if subtitle group changed reset subtitle loaders\n\n if (nextPlaylist.attributes.SUBTITLES !== playlistToExclude.attributes.SUBTITLES) {\n this.delegateLoaders_('subtitle', ['abort', 'pause']);\n }\n this.delegateLoaders_('main', ['abort', 'pause']);\n const delayDuration = nextPlaylist.targetDuration / 2 * 1000 || 5 * 1000;\n const shouldDelay = typeof nextPlaylist.lastRequest === 'number' && Date.now() - nextPlaylist.lastRequest <= delayDuration; // delay if it's a final rendition or if the last refresh is sooner than half targetDuration\n\n return this.switchMedia_(nextPlaylist, 'exclude', isFinalRendition || shouldDelay);\n }\n /**\n * Pause all segment/playlist loaders\n */\n\n pauseLoading() {\n this.delegateLoaders_('all', ['abort', 'pause']);\n this.stopABRTimer_();\n }\n /**\n * Call a set of functions in order on playlist loaders, segment loaders,\n * or both types of loaders.\n *\n * @param {string} filter\n * Filter loaders that should call fnNames using a string. Can be:\n * * all - run on all loaders\n * * audio - run on all audio loaders\n * * subtitle - run on all subtitle loaders\n * * main - run on the main loaders\n *\n * @param {Array|string} fnNames\n * A string or array of function names to call.\n */\n\n delegateLoaders_(filter, fnNames) {\n const loaders = [];\n const dontFilterPlaylist = filter === 'all';\n if (dontFilterPlaylist || filter === 'main') {\n loaders.push(this.mainPlaylistLoader_);\n }\n const mediaTypes = [];\n if (dontFilterPlaylist || filter === 'audio') {\n mediaTypes.push('AUDIO');\n }\n if (dontFilterPlaylist || filter === 'subtitle') {\n mediaTypes.push('CLOSED-CAPTIONS');\n mediaTypes.push('SUBTITLES');\n }\n mediaTypes.forEach(mediaType => {\n const loader = this.mediaTypes_[mediaType] && this.mediaTypes_[mediaType].activePlaylistLoader;\n if (loader) {\n loaders.push(loader);\n }\n });\n ['main', 'audio', 'subtitle'].forEach(name => {\n const loader = this[`${name}SegmentLoader_`];\n if (loader && (filter === name || filter === 'all')) {\n loaders.push(loader);\n }\n });\n loaders.forEach(loader => fnNames.forEach(fnName => {\n if (typeof loader[fnName] === 'function') {\n loader[fnName]();\n }\n }));\n }\n /**\n * set the current time on all segment loaders\n *\n * @param {TimeRange} currentTime the current time to set\n * @return {TimeRange} the current time\n */\n\n setCurrentTime(currentTime) {\n const buffered = findRange(this.tech_.buffered(), currentTime);\n if (!(this.mainPlaylistLoader_ && this.mainPlaylistLoader_.media())) {\n // return immediately if the metadata is not ready yet\n return 0;\n } // it's clearly an edge-case but don't thrown an error if asked to\n // seek within an empty playlist\n\n if (!this.mainPlaylistLoader_.media().segments) {\n return 0;\n } // if the seek location is already buffered, continue buffering as usual\n\n if (buffered && buffered.length) {\n return currentTime;\n } // cancel outstanding requests so we begin buffering at the new\n // location\n\n this.mainSegmentLoader_.pause();\n this.mainSegmentLoader_.resetEverything();\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n this.audioSegmentLoader_.pause();\n this.audioSegmentLoader_.resetEverything();\n }\n if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {\n this.subtitleSegmentLoader_.pause();\n this.subtitleSegmentLoader_.resetEverything();\n } // start segment loader loading in case they are paused\n\n this.load();\n }\n /**\n * get the current duration\n *\n * @return {TimeRange} the duration\n */\n\n duration() {\n if (!this.mainPlaylistLoader_) {\n return 0;\n }\n const media = this.mainPlaylistLoader_.media();\n if (!media) {\n // no playlists loaded yet, so can't determine a duration\n return 0;\n } // Don't rely on the media source for duration in the case of a live playlist since\n // setting the native MediaSource's duration to infinity ends up with consequences to\n // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details.\n //\n // This is resolved in the spec by https://github.com/w3c/media-source/pull/92,\n // however, few browsers have support for setLiveSeekableRange()\n // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange\n //\n // Until a time when the duration of the media source can be set to infinity, and a\n // seekable range specified across browsers, just return Infinity.\n\n if (!media.endList) {\n return Infinity;\n } // Since this is a VOD video, it is safe to rely on the media source's duration (if\n // available). If it's not available, fall back to a playlist-calculated estimate.\n\n if (this.mediaSource) {\n return this.mediaSource.duration;\n }\n return Vhs$1.Playlist.duration(media);\n }\n /**\n * check the seekable range\n *\n * @return {TimeRange} the seekable range\n */\n\n seekable() {\n return this.seekable_;\n }\n onSyncInfoUpdate_() {\n let audioSeekable; // TODO check for creation of both source buffers before updating seekable\n //\n // A fix was made to this function where a check for\n // this.sourceUpdater_.hasCreatedSourceBuffers\n // was added to ensure that both source buffers were created before seekable was\n // updated. However, it originally had a bug where it was checking for a true and\n // returning early instead of checking for false. Setting it to check for false to\n // return early though created other issues. A call to play() would check for seekable\n // end without verifying that a seekable range was present. In addition, even checking\n // for that didn't solve some issues, as handleFirstPlay is sometimes worked around\n // due to a media update calling load on the segment loaders, skipping a seek to live,\n // thereby starting live streams at the beginning of the stream rather than at the end.\n //\n // This conditional should be fixed to wait for the creation of two source buffers at\n // the same time as the other sections of code are fixed to properly seek to live and\n // not throw an error due to checking for a seekable end when no seekable range exists.\n //\n // For now, fall back to the older behavior, with the understanding that the seekable\n // range may not be completely correct, leading to a suboptimal initial live point.\n\n if (!this.mainPlaylistLoader_) {\n return;\n }\n let media = this.mainPlaylistLoader_.media();\n if (!media) {\n return;\n }\n let expired = this.syncController_.getExpiredTime(media, this.duration());\n if (expired === null) {\n // not enough information to update seekable\n return;\n }\n const main = this.mainPlaylistLoader_.main;\n const mainSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(main, media));\n if (mainSeekable.length === 0) {\n return;\n }\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n media = this.mediaTypes_.AUDIO.activePlaylistLoader.media();\n expired = this.syncController_.getExpiredTime(media, this.duration());\n if (expired === null) {\n return;\n }\n audioSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(main, media));\n if (audioSeekable.length === 0) {\n return;\n }\n }\n let oldEnd;\n let oldStart;\n if (this.seekable_ && this.seekable_.length) {\n oldEnd = this.seekable_.end(0);\n oldStart = this.seekable_.start(0);\n }\n if (!audioSeekable) {\n // seekable has been calculated based on buffering video data so it\n // can be returned directly\n this.seekable_ = mainSeekable;\n } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) {\n // seekables are pretty far off, rely on main\n this.seekable_ = mainSeekable;\n } else {\n this.seekable_ = createTimeRanges([[audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0)]]);\n } // seekable is the same as last time\n\n if (this.seekable_ && this.seekable_.length) {\n if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) {\n return;\n }\n }\n this.logger_(`seekable updated [${printableRange(this.seekable_)}]`);\n this.tech_.trigger('seekablechanged');\n }\n /**\n * Update the player duration\n */\n\n updateDuration(isLive) {\n if (this.updateDuration_) {\n this.mediaSource.removeEventListener('sourceopen', this.updateDuration_);\n this.updateDuration_ = null;\n }\n if (this.mediaSource.readyState !== 'open') {\n this.updateDuration_ = this.updateDuration.bind(this, isLive);\n this.mediaSource.addEventListener('sourceopen', this.updateDuration_);\n return;\n }\n if (isLive) {\n const seekable = this.seekable();\n if (!seekable.length) {\n return;\n } // Even in the case of a live playlist, the native MediaSource's duration should not\n // be set to Infinity (even though this would be expected for a live playlist), since\n // setting the native MediaSource's duration to infinity ends up with consequences to\n // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details.\n //\n // This is resolved in the spec by https://github.com/w3c/media-source/pull/92,\n // however, few browsers have support for setLiveSeekableRange()\n // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange\n //\n // Until a time when the duration of the media source can be set to infinity, and a\n // seekable range specified across browsers, the duration should be greater than or\n // equal to the last possible seekable value.\n // MediaSource duration starts as NaN\n // It is possible (and probable) that this case will never be reached for many\n // sources, since the MediaSource reports duration as the highest value without\n // accounting for timestamp offset. For example, if the timestamp offset is -100 and\n // we buffered times 0 to 100 with real times of 100 to 200, even though current\n // time will be between 0 and 100, the native media source may report the duration\n // as 200. However, since we report duration separate from the media source (as\n // Infinity), and as long as the native media source duration value is greater than\n // our reported seekable range, seeks will work as expected. The large number as\n // duration for live is actually a strategy used by some players to work around the\n // issue of live seekable ranges cited above.\n\n if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable.end(seekable.length - 1)) {\n this.sourceUpdater_.setDuration(seekable.end(seekable.length - 1));\n }\n return;\n }\n const buffered = this.tech_.buffered();\n let duration = Vhs$1.Playlist.duration(this.mainPlaylistLoader_.media());\n if (buffered.length > 0) {\n duration = Math.max(duration, buffered.end(buffered.length - 1));\n }\n if (this.mediaSource.duration !== duration) {\n this.sourceUpdater_.setDuration(duration);\n }\n }\n /**\n * dispose of the PlaylistController and everything\n * that it controls\n */\n\n dispose() {\n this.trigger('dispose');\n this.decrypter_.terminate();\n this.mainPlaylistLoader_.dispose();\n this.mainSegmentLoader_.dispose();\n this.contentSteeringController_.dispose();\n this.keyStatusMap_.clear();\n if (this.loadOnPlay_) {\n this.tech_.off('play', this.loadOnPlay_);\n }\n ['AUDIO', 'SUBTITLES'].forEach(type => {\n const groups = this.mediaTypes_[type].groups;\n for (const id in groups) {\n groups[id].forEach(group => {\n if (group.playlistLoader) {\n group.playlistLoader.dispose();\n }\n });\n }\n });\n this.audioSegmentLoader_.dispose();\n this.subtitleSegmentLoader_.dispose();\n this.sourceUpdater_.dispose();\n this.timelineChangeController_.dispose();\n this.stopABRTimer_();\n if (this.updateDuration_) {\n this.mediaSource.removeEventListener('sourceopen', this.updateDuration_);\n }\n this.mediaSource.removeEventListener('durationchange', this.handleDurationChange_); // load the media source into the player\n\n this.mediaSource.removeEventListener('sourceopen', this.handleSourceOpen_);\n this.mediaSource.removeEventListener('sourceended', this.handleSourceEnded_);\n this.off();\n }\n /**\n * return the main playlist object if we have one\n *\n * @return {Object} the main playlist object that we parsed\n */\n\n main() {\n return this.mainPlaylistLoader_.main;\n }\n /**\n * return the currently selected playlist\n *\n * @return {Object} the currently selected playlist object that we parsed\n */\n\n media() {\n // playlist loader will not return media if it has not been fully loaded\n return this.mainPlaylistLoader_.media() || this.initialMedia_;\n }\n areMediaTypesKnown_() {\n const usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;\n const hasMainMediaInfo = !!this.mainSegmentLoader_.getCurrentMediaInfo_(); // if we are not using an audio loader, then we have audio media info\n // otherwise check on the segment loader.\n\n const hasAudioMediaInfo = !usingAudioLoader ? true : !!this.audioSegmentLoader_.getCurrentMediaInfo_(); // one or both loaders has not loaded sufficently to get codecs\n\n if (!hasMainMediaInfo || !hasAudioMediaInfo) {\n return false;\n }\n return true;\n }\n getCodecsOrExclude_() {\n const media = {\n main: this.mainSegmentLoader_.getCurrentMediaInfo_() || {},\n audio: this.audioSegmentLoader_.getCurrentMediaInfo_() || {}\n };\n const playlist = this.mainSegmentLoader_.getPendingSegmentPlaylist() || this.media(); // set \"main\" media equal to video\n\n media.video = media.main;\n const playlistCodecs = codecsForPlaylist(this.main(), playlist);\n const codecs = {};\n const usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;\n if (media.main.hasVideo) {\n codecs.video = playlistCodecs.video || media.main.videoCodec || _videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.DEFAULT_VIDEO_CODEC;\n }\n if (media.main.isMuxed) {\n codecs.video += `,${playlistCodecs.audio || media.main.audioCodec || _videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.DEFAULT_AUDIO_CODEC}`;\n }\n if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) {\n codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || _videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.DEFAULT_AUDIO_CODEC; // set audio isFmp4 so we use the correct \"supports\" function below\n\n media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4;\n } // no codecs, no playback.\n\n if (!codecs.audio && !codecs.video) {\n this.excludePlaylist({\n playlistToExclude: playlist,\n error: {\n message: 'Could not determine codecs for playlist.'\n },\n playlistExclusionDuration: Infinity\n });\n return;\n } // fmp4 relies on browser support, while ts relies on muxer support\n\n const supportFunction = (isFmp4, codec) => isFmp4 ? (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.browserSupportsCodec)(codec) : (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.muxerSupportsCodec)(codec);\n const unsupportedCodecs = {};\n let unsupportedAudio;\n ['video', 'audio'].forEach(function (type) {\n if (codecs.hasOwnProperty(type) && !supportFunction(media[type].isFmp4, codecs[type])) {\n const supporter = media[type].isFmp4 ? 'browser' : 'muxer';\n unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || [];\n unsupportedCodecs[supporter].push(codecs[type]);\n if (type === 'audio') {\n unsupportedAudio = supporter;\n }\n }\n });\n if (usingAudioLoader && unsupportedAudio && playlist.attributes.AUDIO) {\n const audioGroup = playlist.attributes.AUDIO;\n this.main().playlists.forEach(variant => {\n const variantAudioGroup = variant.attributes && variant.attributes.AUDIO;\n if (variantAudioGroup === audioGroup && variant !== playlist) {\n variant.excludeUntil = Infinity;\n }\n });\n this.logger_(`excluding audio group ${audioGroup} as ${unsupportedAudio} does not support codec(s): \"${codecs.audio}\"`);\n } // if we have any unsupported codecs exclude this playlist.\n\n if (Object.keys(unsupportedCodecs).length) {\n const message = Object.keys(unsupportedCodecs).reduce((acc, supporter) => {\n if (acc) {\n acc += ', ';\n }\n acc += `${supporter} does not support codec(s): \"${unsupportedCodecs[supporter].join(',')}\"`;\n return acc;\n }, '') + '.';\n this.excludePlaylist({\n playlistToExclude: playlist,\n error: {\n internal: true,\n message\n },\n playlistExclusionDuration: Infinity\n });\n return;\n } // check if codec switching is happening\n\n if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {\n const switchMessages = [];\n ['video', 'audio'].forEach(type => {\n const newCodec = ((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.parseCodecs)(this.sourceUpdater_.codecs[type] || '')[0] || {}).type;\n const oldCodec = ((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.parseCodecs)(codecs[type] || '')[0] || {}).type;\n if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) {\n switchMessages.push(`\"${this.sourceUpdater_.codecs[type]}\" -> \"${codecs[type]}\"`);\n }\n });\n if (switchMessages.length) {\n this.excludePlaylist({\n playlistToExclude: playlist,\n error: {\n message: `Codec switching not supported: ${switchMessages.join(', ')}.`,\n internal: true\n },\n playlistExclusionDuration: Infinity\n });\n return;\n }\n } // TODO: when using the muxer shouldn't we just return\n // the codecs that the muxer outputs?\n\n return codecs;\n }\n /**\n * Create source buffers and exlude any incompatible renditions.\n *\n * @private\n */\n\n tryToCreateSourceBuffers_() {\n // media source is not ready yet or sourceBuffers are already\n // created.\n if (this.mediaSource.readyState !== 'open' || this.sourceUpdater_.hasCreatedSourceBuffers()) {\n return;\n }\n if (!this.areMediaTypesKnown_()) {\n return;\n }\n const codecs = this.getCodecsOrExclude_(); // no codecs means that the playlist was excluded\n\n if (!codecs) {\n return;\n }\n this.sourceUpdater_.createSourceBuffers(codecs);\n const codecString = [codecs.video, codecs.audio].filter(Boolean).join(',');\n this.excludeIncompatibleVariants_(codecString);\n }\n /**\n * Excludes playlists with codecs that are unsupported by the muxer and browser.\n */\n\n excludeUnsupportedVariants_() {\n const playlists = this.main().playlists;\n const ids = []; // TODO: why don't we have a property to loop through all\n // playlist? Why did we ever mix indexes and keys?\n\n Object.keys(playlists).forEach(key => {\n const variant = playlists[key]; // check if we already processed this playlist.\n\n if (ids.indexOf(variant.id) !== -1) {\n return;\n }\n ids.push(variant.id);\n const codecs = codecsForPlaylist(this.main, variant);\n const unsupported = [];\n if (codecs.audio && !(0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.muxerSupportsCodec)(codecs.audio) && !(0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.browserSupportsCodec)(codecs.audio)) {\n unsupported.push(`audio codec ${codecs.audio}`);\n }\n if (codecs.video && !(0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.muxerSupportsCodec)(codecs.video) && !(0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.browserSupportsCodec)(codecs.video)) {\n unsupported.push(`video codec ${codecs.video}`);\n }\n if (codecs.text && codecs.text === 'stpp.ttml.im1t') {\n unsupported.push(`text codec ${codecs.text}`);\n }\n if (unsupported.length) {\n variant.excludeUntil = Infinity;\n this.logger_(`excluding ${variant.id} for unsupported: ${unsupported.join(', ')}`);\n }\n });\n }\n /**\n * Exclude playlists that are known to be codec or\n * stream-incompatible with the SourceBuffer configuration. For\n * instance, Media Source Extensions would cause the video element to\n * stall waiting for video data if you switched from a variant with\n * video and audio to an audio-only one.\n *\n * @param {Object} media a media playlist compatible with the current\n * set of SourceBuffers. Variants in the current main playlist that\n * do not appear to have compatible codec or stream configurations\n * will be excluded from the default playlist selection algorithm\n * indefinitely.\n * @private\n */\n\n excludeIncompatibleVariants_(codecString) {\n const ids = [];\n const playlists = this.main().playlists;\n const codecs = unwrapCodecList((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.parseCodecs)(codecString));\n const codecCount_ = codecCount(codecs);\n const videoDetails = codecs.video && (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.parseCodecs)(codecs.video)[0] || null;\n const audioDetails = codecs.audio && (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.parseCodecs)(codecs.audio)[0] || null;\n Object.keys(playlists).forEach(key => {\n const variant = playlists[key]; // check if we already processed this playlist.\n // or it if it is already excluded forever.\n\n if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) {\n return;\n }\n ids.push(variant.id);\n const exclusionReasons = []; // get codecs from the playlist for this variant\n\n const variantCodecs = codecsForPlaylist(this.mainPlaylistLoader_.main, variant);\n const variantCodecCount = codecCount(variantCodecs); // if no codecs are listed, we cannot determine that this\n // variant is incompatible. Wait for mux.js to probe\n\n if (!variantCodecs.audio && !variantCodecs.video) {\n return;\n } // TODO: we can support this by removing the\n // old media source and creating a new one, but it will take some work.\n // The number of streams cannot change\n\n if (variantCodecCount !== codecCount_) {\n exclusionReasons.push(`codec count \"${variantCodecCount}\" !== \"${codecCount_}\"`);\n } // only exclude playlists by codec change, if codecs cannot switch\n // during playback.\n\n if (!this.sourceUpdater_.canChangeType()) {\n const variantVideoDetails = variantCodecs.video && (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.parseCodecs)(variantCodecs.video)[0] || null;\n const variantAudioDetails = variantCodecs.audio && (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.parseCodecs)(variantCodecs.audio)[0] || null; // the video codec cannot change\n\n if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) {\n exclusionReasons.push(`video codec \"${variantVideoDetails.type}\" !== \"${videoDetails.type}\"`);\n } // the audio codec cannot change\n\n if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) {\n exclusionReasons.push(`audio codec \"${variantAudioDetails.type}\" !== \"${audioDetails.type}\"`);\n }\n }\n if (exclusionReasons.length) {\n variant.excludeUntil = Infinity;\n this.logger_(`excluding ${variant.id}: ${exclusionReasons.join(' && ')}`);\n }\n });\n }\n updateAdCues_(media) {\n let offset = 0;\n const seekable = this.seekable();\n if (seekable.length) {\n offset = seekable.start(0);\n }\n updateAdCues(media, this.cueTagsTrack_, offset);\n }\n /**\n * Calculates the desired forward buffer length based on current time\n *\n * @return {number} Desired forward buffer length in seconds\n */\n\n goalBufferLength() {\n const currentTime = this.tech_.currentTime();\n const initial = Config.GOAL_BUFFER_LENGTH;\n const rate = Config.GOAL_BUFFER_LENGTH_RATE;\n const max = Math.max(initial, Config.MAX_GOAL_BUFFER_LENGTH);\n return Math.min(initial + currentTime * rate, max);\n }\n /**\n * Calculates the desired buffer low water line based on current time\n *\n * @return {number} Desired buffer low water line in seconds\n */\n\n bufferLowWaterLine() {\n const currentTime = this.tech_.currentTime();\n const initial = Config.BUFFER_LOW_WATER_LINE;\n const rate = Config.BUFFER_LOW_WATER_LINE_RATE;\n const max = Math.max(initial, Config.MAX_BUFFER_LOW_WATER_LINE);\n const newMax = Math.max(initial, Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);\n return Math.min(initial + currentTime * rate, this.bufferBasedABR ? newMax : max);\n }\n bufferHighWaterLine() {\n return Config.BUFFER_HIGH_WATER_LINE;\n }\n addDateRangesToTextTrack_(dateRanges) {\n createMetadataTrackIfNotExists(this.inbandTextTracks_, 'com.apple.streaming', this.tech_);\n addDateRangeMetadata({\n inbandTextTracks: this.inbandTextTracks_,\n dateRanges\n });\n }\n addMetadataToTextTrack(dispatchType, metadataArray, videoDuration) {\n const timestampOffset = this.sourceUpdater_.videoBuffer ? this.sourceUpdater_.videoTimestampOffset() : this.sourceUpdater_.audioTimestampOffset(); // There's potentially an issue where we could double add metadata if there's a muxed\n // audio/video source with a metadata track, and an alt audio with a metadata track.\n // However, this probably won't happen, and if it does it can be handled then.\n\n createMetadataTrackIfNotExists(this.inbandTextTracks_, dispatchType, this.tech_);\n addMetadata({\n inbandTextTracks: this.inbandTextTracks_,\n metadataArray,\n timestampOffset,\n videoDuration\n });\n }\n /**\n * Utility for getting the pathway or service location from an HLS or DASH playlist.\n *\n * @param {Object} playlist for getting pathway from.\n * @return the pathway attribute of a playlist\n */\n\n pathwayAttribute_(playlist) {\n return playlist.attributes['PATHWAY-ID'] || playlist.attributes.serviceLocation;\n }\n /**\n * Initialize available pathways and apply the tag properties.\n */\n\n initContentSteeringController_() {\n const main = this.main();\n if (!main.contentSteering) {\n return;\n }\n for (const playlist of main.playlists) {\n this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(playlist));\n }\n this.contentSteeringController_.assignTagProperties(main.uri, main.contentSteering); // request the steering manifest immediately if queryBeforeStart is set.\n\n if (this.contentSteeringController_.queryBeforeStart) {\n // When queryBeforeStart is true, initial request should omit steering parameters.\n this.contentSteeringController_.requestSteeringManifest(true);\n return;\n } // otherwise start content steering after playback starts\n\n this.tech_.one('canplay', () => {\n this.contentSteeringController_.requestSteeringManifest();\n });\n }\n /**\n * Reset the content steering controller and re-init.\n */\n\n resetContentSteeringController_() {\n this.contentSteeringController_.clearAvailablePathways();\n this.contentSteeringController_.dispose();\n this.initContentSteeringController_();\n }\n /**\n * Attaches the listeners for content steering.\n */\n\n attachContentSteeringListeners_() {\n this.contentSteeringController_.on('content-steering', this.excludeThenChangePathway_.bind(this));\n if (this.sourceType_ === 'dash') {\n this.mainPlaylistLoader_.on('loadedplaylist', () => {\n const main = this.main(); // check if steering tag or pathways changed.\n\n const didDashTagChange = this.contentSteeringController_.didDASHTagChange(main.uri, main.contentSteering);\n const didPathwaysChange = () => {\n const availablePathways = this.contentSteeringController_.getAvailablePathways();\n const newPathways = [];\n for (const playlist of main.playlists) {\n const serviceLocation = playlist.attributes.serviceLocation;\n if (serviceLocation) {\n newPathways.push(serviceLocation);\n if (!availablePathways.has(serviceLocation)) {\n return true;\n }\n }\n } // If we have no new serviceLocations and previously had availablePathways\n\n if (!newPathways.length && availablePathways.size) {\n return true;\n }\n return false;\n };\n if (didDashTagChange || didPathwaysChange()) {\n this.resetContentSteeringController_();\n }\n });\n }\n }\n /**\n * Simple exclude and change playlist logic for content steering.\n */\n\n excludeThenChangePathway_() {\n const currentPathway = this.contentSteeringController_.getPathway();\n if (!currentPathway) {\n return;\n }\n this.handlePathwayClones_();\n const main = this.main();\n const playlists = main.playlists;\n const ids = new Set();\n let didEnablePlaylists = false;\n Object.keys(playlists).forEach(key => {\n const variant = playlists[key];\n const pathwayId = this.pathwayAttribute_(variant);\n const differentPathwayId = pathwayId && currentPathway !== pathwayId;\n const steeringExclusion = variant.excludeUntil === Infinity && variant.lastExcludeReason_ === 'content-steering';\n if (steeringExclusion && !differentPathwayId) {\n delete variant.excludeUntil;\n delete variant.lastExcludeReason_;\n didEnablePlaylists = true;\n }\n const noExcludeUntil = !variant.excludeUntil && variant.excludeUntil !== Infinity;\n const shouldExclude = !ids.has(variant.id) && differentPathwayId && noExcludeUntil;\n if (!shouldExclude) {\n return;\n }\n ids.add(variant.id);\n variant.excludeUntil = Infinity;\n variant.lastExcludeReason_ = 'content-steering'; // TODO: kind of spammy, maybe move this.\n\n this.logger_(`excluding ${variant.id} for ${variant.lastExcludeReason_}`);\n });\n if (this.contentSteeringController_.manifestType_ === 'DASH') {\n Object.keys(this.mediaTypes_).forEach(key => {\n const type = this.mediaTypes_[key];\n if (type.activePlaylistLoader) {\n const currentPlaylist = type.activePlaylistLoader.media_; // Check if the current media playlist matches the current CDN\n\n if (currentPlaylist && currentPlaylist.attributes.serviceLocation !== currentPathway) {\n didEnablePlaylists = true;\n }\n }\n });\n }\n if (didEnablePlaylists) {\n this.changeSegmentPathway_();\n }\n }\n /**\n * Add, update, or delete playlists and media groups for\n * the pathway clones for HLS Content Steering.\n *\n * See https://datatracker.ietf.org/doc/draft-pantos-hls-rfc8216bis/\n *\n * NOTE: Pathway cloning does not currently support the `PER_VARIANT_URIS` and\n * `PER_RENDITION_URIS` as we do not handle `STABLE-VARIANT-ID` or\n * `STABLE-RENDITION-ID` values.\n */\n\n handlePathwayClones_() {\n const main = this.main();\n const playlists = main.playlists;\n const currentPathwayClones = this.contentSteeringController_.currentPathwayClones;\n const nextPathwayClones = this.contentSteeringController_.nextPathwayClones;\n const hasClones = currentPathwayClones && currentPathwayClones.size || nextPathwayClones && nextPathwayClones.size;\n if (!hasClones) {\n return;\n }\n for (const [id, clone] of currentPathwayClones.entries()) {\n const newClone = nextPathwayClones.get(id); // Delete the old pathway clone.\n\n if (!newClone) {\n this.mainPlaylistLoader_.updateOrDeleteClone(clone);\n this.contentSteeringController_.excludePathway(id);\n }\n }\n for (const [id, clone] of nextPathwayClones.entries()) {\n const oldClone = currentPathwayClones.get(id); // Create a new pathway if it is a new pathway clone object.\n\n if (!oldClone) {\n const playlistsToClone = playlists.filter(p => {\n return p.attributes['PATHWAY-ID'] === clone['BASE-ID'];\n });\n playlistsToClone.forEach(p => {\n this.mainPlaylistLoader_.addClonePathway(clone, p);\n });\n this.contentSteeringController_.addAvailablePathway(id);\n continue;\n } // There have not been changes to the pathway clone object, so skip.\n\n if (this.equalPathwayClones_(oldClone, clone)) {\n continue;\n } // Update a preexisting cloned pathway.\n // True is set for the update flag.\n\n this.mainPlaylistLoader_.updateOrDeleteClone(clone, true);\n this.contentSteeringController_.addAvailablePathway(id);\n } // Deep copy contents of next to current pathways.\n\n this.contentSteeringController_.currentPathwayClones = new Map(JSON.parse(JSON.stringify([...nextPathwayClones])));\n }\n /**\n * Determines whether two pathway clone objects are equivalent.\n *\n * @param {Object} a The first pathway clone object.\n * @param {Object} b The second pathway clone object.\n * @return {boolean} True if the pathway clone objects are equal, false otherwise.\n */\n\n equalPathwayClones_(a, b) {\n if (a['BASE-ID'] !== b['BASE-ID'] || a.ID !== b.ID || a['URI-REPLACEMENT'].HOST !== b['URI-REPLACEMENT'].HOST) {\n return false;\n }\n const aParams = a['URI-REPLACEMENT'].PARAMS;\n const bParams = b['URI-REPLACEMENT'].PARAMS; // We need to iterate through both lists of params because one could be\n // missing a parameter that the other has.\n\n for (const p in aParams) {\n if (aParams[p] !== bParams[p]) {\n return false;\n }\n }\n for (const p in bParams) {\n if (aParams[p] !== bParams[p]) {\n return false;\n }\n }\n return true;\n }\n /**\n * Changes the current playlists for audio, video and subtitles after a new pathway\n * is chosen from content steering.\n */\n\n changeSegmentPathway_() {\n const nextPlaylist = this.selectPlaylist();\n this.pauseLoading(); // Switch audio and text track playlists if necessary in DASH\n\n if (this.contentSteeringController_.manifestType_ === 'DASH') {\n this.switchMediaForDASHContentSteering_();\n }\n this.switchMedia_(nextPlaylist, 'content-steering');\n }\n /**\n * Iterates through playlists and check their keyId set and compare with the\n * keyStatusMap, only enable playlists that have a usable key. If the playlist\n * has no keyId leave it enabled by default.\n */\n\n excludeNonUsablePlaylistsByKeyId_() {\n if (!this.mainPlaylistLoader_ || !this.mainPlaylistLoader_.main) {\n return;\n }\n let nonUsableKeyStatusCount = 0;\n const NON_USABLE = 'non-usable';\n this.mainPlaylistLoader_.main.playlists.forEach(playlist => {\n const keyIdSet = this.mainPlaylistLoader_.getKeyIdSet(playlist); // If the playlist doesn't have keyIDs lets not exclude it.\n\n if (!keyIdSet || !keyIdSet.size) {\n return;\n }\n keyIdSet.forEach(key => {\n const USABLE = 'usable';\n const hasUsableKeyStatus = this.keyStatusMap_.has(key) && this.keyStatusMap_.get(key) === USABLE;\n const nonUsableExclusion = playlist.lastExcludeReason_ === NON_USABLE && playlist.excludeUntil === Infinity;\n if (!hasUsableKeyStatus) {\n // Only exclude playlists that haven't already been excluded as non-usable.\n if (playlist.excludeUntil !== Infinity && playlist.lastExcludeReason_ !== NON_USABLE) {\n playlist.excludeUntil = Infinity;\n playlist.lastExcludeReason_ = NON_USABLE;\n this.logger_(`excluding playlist ${playlist.id} because the key ID ${key} doesn't exist in the keyStatusMap or is not ${USABLE}`);\n } // count all nonUsableKeyStatus\n\n nonUsableKeyStatusCount++;\n } else if (hasUsableKeyStatus && nonUsableExclusion) {\n delete playlist.excludeUntil;\n delete playlist.lastExcludeReason_;\n this.logger_(`enabling playlist ${playlist.id} because key ID ${key} is ${USABLE}`);\n }\n });\n }); // If for whatever reason every playlist has a non usable key status. Lets try re-including the SD renditions as a failsafe.\n\n if (nonUsableKeyStatusCount >= this.mainPlaylistLoader_.main.playlists.length) {\n this.mainPlaylistLoader_.main.playlists.forEach(playlist => {\n const isNonHD = playlist && playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height < 720;\n const excludedForNonUsableKey = playlist.excludeUntil === Infinity && playlist.lastExcludeReason_ === NON_USABLE;\n if (isNonHD && excludedForNonUsableKey) {\n // Only delete the excludeUntil so we don't try and re-exclude these playlists.\n delete playlist.excludeUntil;\n videojs.log.warn(`enabling non-HD playlist ${playlist.id} because all playlists were excluded due to ${NON_USABLE} key IDs`);\n }\n });\n }\n }\n /**\n * Adds a keystatus to the keystatus map, tries to convert to string if necessary.\n *\n * @param {any} keyId the keyId to add a status for\n * @param {string} status the status of the keyId\n */\n\n addKeyStatus_(keyId, status) {\n const isString = typeof keyId === 'string';\n const keyIdHexString = isString ? keyId : bufferToHexString(keyId);\n const formattedKeyIdString = keyIdHexString.slice(0, 32).toLowerCase();\n this.logger_(`KeyStatus '${status}' with key ID ${formattedKeyIdString} added to the keyStatusMap`);\n this.keyStatusMap_.set(formattedKeyIdString, status);\n }\n /**\n * Utility function for adding key status to the keyStatusMap and filtering usable encrypted playlists.\n *\n * @param {any} keyId the keyId from the keystatuschange event\n * @param {string} status the key status string\n */\n\n updatePlaylistByKeyStatus(keyId, status) {\n this.addKeyStatus_(keyId, status);\n if (!this.waitingForFastQualityPlaylistReceived_) {\n this.excludeNonUsableThenChangePlaylist_();\n } // Listen to loadedplaylist with a single listener and check for new contentProtection elements when a playlist is updated.\n\n this.mainPlaylistLoader_.off('loadedplaylist', this.excludeNonUsableThenChangePlaylist_.bind(this));\n this.mainPlaylistLoader_.on('loadedplaylist', this.excludeNonUsableThenChangePlaylist_.bind(this));\n }\n excludeNonUsableThenChangePlaylist_() {\n this.excludeNonUsablePlaylistsByKeyId_();\n this.fastQualityChange_();\n }\n}\n\n/**\n * Returns a function that acts as the Enable/disable playlist function.\n *\n * @param {PlaylistLoader} loader - The main playlist loader\n * @param {string} playlistID - id of the playlist\n * @param {Function} changePlaylistFn - A function to be called after a\n * playlist's enabled-state has been changed. Will NOT be called if a\n * playlist's enabled-state is unchanged\n * @param {boolean=} enable - Value to set the playlist enabled-state to\n * or if undefined returns the current enabled-state for the playlist\n * @return {Function} Function for setting/getting enabled\n */\n\nconst enableFunction = (loader, playlistID, changePlaylistFn) => enable => {\n const playlist = loader.main.playlists[playlistID];\n const incompatible = isIncompatible(playlist);\n const currentlyEnabled = isEnabled(playlist);\n if (typeof enable === 'undefined') {\n return currentlyEnabled;\n }\n if (enable) {\n delete playlist.disabled;\n } else {\n playlist.disabled = true;\n }\n if (enable !== currentlyEnabled && !incompatible) {\n // Ensure the outside world knows about our changes\n changePlaylistFn();\n if (enable) {\n loader.trigger('renditionenabled');\n } else {\n loader.trigger('renditiondisabled');\n }\n }\n return enable;\n};\n/**\n * The representation object encapsulates the publicly visible information\n * in a media playlist along with a setter/getter-type function (enabled)\n * for changing the enabled-state of a particular playlist entry\n *\n * @class Representation\n */\n\nclass Representation {\n constructor(vhsHandler, playlist, id) {\n const {\n playlistController_: pc\n } = vhsHandler;\n const qualityChangeFunction = pc.fastQualityChange_.bind(pc); // some playlist attributes are optional\n\n if (playlist.attributes) {\n const resolution = playlist.attributes.RESOLUTION;\n this.width = resolution && resolution.width;\n this.height = resolution && resolution.height;\n this.bandwidth = playlist.attributes.BANDWIDTH;\n this.frameRate = playlist.attributes['FRAME-RATE'];\n }\n this.codecs = codecsForPlaylist(pc.main(), playlist);\n this.playlist = playlist; // The id is simply the ordinality of the media playlist\n // within the main playlist\n\n this.id = id; // Partially-apply the enableFunction to create a playlist-\n // specific variant\n\n this.enabled = enableFunction(vhsHandler.playlists, playlist.id, qualityChangeFunction);\n }\n}\n/**\n * A mixin function that adds the `representations` api to an instance\n * of the VhsHandler class\n *\n * @param {VhsHandler} vhsHandler - An instance of VhsHandler to add the\n * representation API into\n */\n\nconst renditionSelectionMixin = function (vhsHandler) {\n // Add a single API-specific function to the VhsHandler instance\n vhsHandler.representations = () => {\n const main = vhsHandler.playlistController_.main();\n const playlists = isAudioOnly(main) ? vhsHandler.playlistController_.getAudioTrackPlaylists_() : main.playlists;\n if (!playlists) {\n return [];\n }\n return playlists.filter(media => !isIncompatible(media)).map((e, i) => new Representation(vhsHandler, e, e.id));\n };\n};\n\n/**\n * @file playback-watcher.js\n *\n * Playback starts, and now my watch begins. It shall not end until my death. I shall\n * take no wait, hold no uncleared timeouts, father no bad seeks. I shall wear no crowns\n * and win no glory. I shall live and die at my post. I am the corrector of the underflow.\n * I am the watcher of gaps. I am the shield that guards the realms of seekable. I pledge\n * my life and honor to the Playback Watch, for this Player and all the Players to come.\n */\n\nconst timerCancelEvents = ['seeking', 'seeked', 'pause', 'playing', 'error'];\n/**\n * @class PlaybackWatcher\n */\n\nclass PlaybackWatcher {\n /**\n * Represents an PlaybackWatcher object.\n *\n * @class\n * @param {Object} options an object that includes the tech and settings\n */\n constructor(options) {\n this.playlistController_ = options.playlistController;\n this.tech_ = options.tech;\n this.seekable = options.seekable;\n this.allowSeeksWithinUnsafeLiveWindow = options.allowSeeksWithinUnsafeLiveWindow;\n this.liveRangeSafeTimeDelta = options.liveRangeSafeTimeDelta;\n this.media = options.media;\n this.consecutiveUpdates = 0;\n this.lastRecordedTime = null;\n this.checkCurrentTimeTimeout_ = null;\n this.logger_ = logger('PlaybackWatcher');\n this.logger_('initialize');\n const playHandler = () => this.monitorCurrentTime_();\n const canPlayHandler = () => this.monitorCurrentTime_();\n const waitingHandler = () => this.techWaiting_();\n const cancelTimerHandler = () => this.resetTimeUpdate_();\n const pc = this.playlistController_;\n const loaderTypes = ['main', 'subtitle', 'audio'];\n const loaderChecks = {};\n loaderTypes.forEach(type => {\n loaderChecks[type] = {\n reset: () => this.resetSegmentDownloads_(type),\n updateend: () => this.checkSegmentDownloads_(type)\n };\n pc[`${type}SegmentLoader_`].on('appendsdone', loaderChecks[type].updateend); // If a rendition switch happens during a playback stall where the buffer\n // isn't changing we want to reset. We cannot assume that the new rendition\n // will also be stalled, until after new appends.\n\n pc[`${type}SegmentLoader_`].on('playlistupdate', loaderChecks[type].reset); // Playback stalls should not be detected right after seeking.\n // This prevents one segment playlists (single vtt or single segment content)\n // from being detected as stalling. As the buffer will not change in those cases, since\n // the buffer is the entire video duration.\n\n this.tech_.on(['seeked', 'seeking'], loaderChecks[type].reset);\n });\n /**\n * We check if a seek was into a gap through the following steps:\n * 1. We get a seeking event and we do not get a seeked event. This means that\n * a seek was attempted but not completed.\n * 2. We run `fixesBadSeeks_` on segment loader appends. This means that we already\n * removed everything from our buffer and appended a segment, and should be ready\n * to check for gaps.\n */\n\n const setSeekingHandlers = fn => {\n ['main', 'audio'].forEach(type => {\n pc[`${type}SegmentLoader_`][fn]('appended', this.seekingAppendCheck_);\n });\n };\n this.seekingAppendCheck_ = () => {\n if (this.fixesBadSeeks_()) {\n this.consecutiveUpdates = 0;\n this.lastRecordedTime = this.tech_.currentTime();\n setSeekingHandlers('off');\n }\n };\n this.clearSeekingAppendCheck_ = () => setSeekingHandlers('off');\n this.watchForBadSeeking_ = () => {\n this.clearSeekingAppendCheck_();\n setSeekingHandlers('on');\n };\n this.tech_.on('seeked', this.clearSeekingAppendCheck_);\n this.tech_.on('seeking', this.watchForBadSeeking_);\n this.tech_.on('waiting', waitingHandler);\n this.tech_.on(timerCancelEvents, cancelTimerHandler);\n this.tech_.on('canplay', canPlayHandler);\n /*\n An edge case exists that results in gaps not being skipped when they exist at the beginning of a stream. This case\n is surfaced in one of two ways:\n 1) The `waiting` event is fired before the player has buffered content, making it impossible\n to find or skip the gap. The `waiting` event is followed by a `play` event. On first play\n we can check if playback is stalled due to a gap, and skip the gap if necessary.\n 2) A source with a gap at the beginning of the stream is loaded programatically while the player\n is in a playing state. To catch this case, it's important that our one-time play listener is setup\n even if the player is in a playing state\n */\n\n this.tech_.one('play', playHandler); // Define the dispose function to clean up our events\n\n this.dispose = () => {\n this.clearSeekingAppendCheck_();\n this.logger_('dispose');\n this.tech_.off('waiting', waitingHandler);\n this.tech_.off(timerCancelEvents, cancelTimerHandler);\n this.tech_.off('canplay', canPlayHandler);\n this.tech_.off('play', playHandler);\n this.tech_.off('seeking', this.watchForBadSeeking_);\n this.tech_.off('seeked', this.clearSeekingAppendCheck_);\n loaderTypes.forEach(type => {\n pc[`${type}SegmentLoader_`].off('appendsdone', loaderChecks[type].updateend);\n pc[`${type}SegmentLoader_`].off('playlistupdate', loaderChecks[type].reset);\n this.tech_.off(['seeked', 'seeking'], loaderChecks[type].reset);\n });\n if (this.checkCurrentTimeTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.checkCurrentTimeTimeout_);\n }\n this.resetTimeUpdate_();\n };\n }\n /**\n * Periodically check current time to see if playback stopped\n *\n * @private\n */\n\n monitorCurrentTime_() {\n this.checkCurrentTime_();\n if (this.checkCurrentTimeTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.checkCurrentTimeTimeout_);\n } // 42 = 24 fps // 250 is what Webkit uses // FF uses 15\n\n this.checkCurrentTimeTimeout_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(this.monitorCurrentTime_.bind(this), 250);\n }\n /**\n * Reset stalled download stats for a specific type of loader\n *\n * @param {string} type\n * The segment loader type to check.\n *\n * @listens SegmentLoader#playlistupdate\n * @listens Tech#seeking\n * @listens Tech#seeked\n */\n\n resetSegmentDownloads_(type) {\n const loader = this.playlistController_[`${type}SegmentLoader_`];\n if (this[`${type}StalledDownloads_`] > 0) {\n this.logger_(`resetting possible stalled download count for ${type} loader`);\n }\n this[`${type}StalledDownloads_`] = 0;\n this[`${type}Buffered_`] = loader.buffered_();\n }\n /**\n * Checks on every segment `appendsdone` to see\n * if segment appends are making progress. If they are not\n * and we are still downloading bytes. We exclude the playlist.\n *\n * @param {string} type\n * The segment loader type to check.\n *\n * @listens SegmentLoader#appendsdone\n */\n\n checkSegmentDownloads_(type) {\n const pc = this.playlistController_;\n const loader = pc[`${type}SegmentLoader_`];\n const buffered = loader.buffered_();\n const isBufferedDifferent = isRangeDifferent(this[`${type}Buffered_`], buffered);\n this[`${type}Buffered_`] = buffered; // if another watcher is going to fix the issue or\n // the buffered value for this loader changed\n // appends are working\n\n if (isBufferedDifferent) {\n this.resetSegmentDownloads_(type);\n return;\n }\n this[`${type}StalledDownloads_`]++;\n this.logger_(`found #${this[`${type}StalledDownloads_`]} ${type} appends that did not increase buffer (possible stalled download)`, {\n playlistId: loader.playlist_ && loader.playlist_.id,\n buffered: timeRangesToArray(buffered)\n }); // after 10 possibly stalled appends with no reset, exclude\n\n if (this[`${type}StalledDownloads_`] < 10) {\n return;\n }\n this.logger_(`${type} loader stalled download exclusion`);\n this.resetSegmentDownloads_(type);\n this.tech_.trigger({\n type: 'usage',\n name: `vhs-${type}-download-exclusion`\n });\n if (type === 'subtitle') {\n return;\n } // TODO: should we exclude audio tracks rather than main tracks\n // when type is audio?\n\n pc.excludePlaylist({\n error: {\n message: `Excessive ${type} segment downloading detected.`\n },\n playlistExclusionDuration: Infinity\n });\n }\n /**\n * The purpose of this function is to emulate the \"waiting\" event on\n * browsers that do not emit it when they are waiting for more\n * data to continue playback\n *\n * @private\n */\n\n checkCurrentTime_() {\n if (this.tech_.paused() || this.tech_.seeking()) {\n return;\n }\n const currentTime = this.tech_.currentTime();\n const buffered = this.tech_.buffered();\n if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA >= buffered.end(buffered.length - 1))) {\n // If current time is at the end of the final buffered region, then any playback\n // stall is most likely caused by buffering in a low bandwidth environment. The tech\n // should fire a `waiting` event in this scenario, but due to browser and tech\n // inconsistencies. Calling `techWaiting_` here allows us to simulate\n // responding to a native `waiting` event when the tech fails to emit one.\n return this.techWaiting_();\n }\n if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) {\n this.consecutiveUpdates++;\n this.waiting_();\n } else if (currentTime === this.lastRecordedTime) {\n this.consecutiveUpdates++;\n } else {\n this.consecutiveUpdates = 0;\n this.lastRecordedTime = currentTime;\n }\n }\n /**\n * Resets the 'timeupdate' mechanism designed to detect that we are stalled\n *\n * @private\n */\n\n resetTimeUpdate_() {\n this.consecutiveUpdates = 0;\n }\n /**\n * Fixes situations where there's a bad seek\n *\n * @return {boolean} whether an action was taken to fix the seek\n * @private\n */\n\n fixesBadSeeks_() {\n const seeking = this.tech_.seeking();\n if (!seeking) {\n return false;\n } // TODO: It's possible that these seekable checks should be moved out of this function\n // and into a function that runs on seekablechange. It's also possible that we only need\n // afterSeekableWindow as the buffered check at the bottom is good enough to handle before\n // seekable range.\n\n const seekable = this.seekable();\n const currentTime = this.tech_.currentTime();\n const isAfterSeekableRange = this.afterSeekableWindow_(seekable, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow);\n let seekTo;\n if (isAfterSeekableRange) {\n const seekableEnd = seekable.end(seekable.length - 1); // sync to live point (if VOD, our seekable was updated and we're simply adjusting)\n\n seekTo = seekableEnd;\n }\n if (this.beforeSeekableWindow_(seekable, currentTime)) {\n const seekableStart = seekable.start(0); // sync to the beginning of the live window\n // provide a buffer of .1 seconds to handle rounding/imprecise numbers\n\n seekTo = seekableStart + (\n // if the playlist is too short and the seekable range is an exact time (can\n // happen in live with a 3 segment playlist), then don't use a time delta\n seekableStart === seekable.end(0) ? 0 : SAFE_TIME_DELTA);\n }\n if (typeof seekTo !== 'undefined') {\n this.logger_(`Trying to seek outside of seekable at time ${currentTime} with ` + `seekable range ${printableRange(seekable)}. Seeking to ` + `${seekTo}.`);\n this.tech_.setCurrentTime(seekTo);\n return true;\n }\n const sourceUpdater = this.playlistController_.sourceUpdater_;\n const buffered = this.tech_.buffered();\n const audioBuffered = sourceUpdater.audioBuffer ? sourceUpdater.audioBuffered() : null;\n const videoBuffered = sourceUpdater.videoBuffer ? sourceUpdater.videoBuffered() : null;\n const media = this.media(); // verify that at least two segment durations or one part duration have been\n // appended before checking for a gap.\n\n const minAppendedDuration = media.partTargetDuration ? media.partTargetDuration : (media.targetDuration - TIME_FUDGE_FACTOR) * 2; // verify that at least two segment durations have been\n // appended before checking for a gap.\n\n const bufferedToCheck = [audioBuffered, videoBuffered];\n for (let i = 0; i < bufferedToCheck.length; i++) {\n // skip null buffered\n if (!bufferedToCheck[i]) {\n continue;\n }\n const timeAhead = timeAheadOf(bufferedToCheck[i], currentTime); // if we are less than two video/audio segment durations or one part\n // duration behind we haven't appended enough to call this a bad seek.\n\n if (timeAhead < minAppendedDuration) {\n return false;\n }\n }\n const nextRange = findNextRange(buffered, currentTime); // we have appended enough content, but we don't have anything buffered\n // to seek over the gap\n\n if (nextRange.length === 0) {\n return false;\n }\n seekTo = nextRange.start(0) + SAFE_TIME_DELTA;\n this.logger_(`Buffered region starts (${nextRange.start(0)}) ` + ` just beyond seek point (${currentTime}). Seeking to ${seekTo}.`);\n this.tech_.setCurrentTime(seekTo);\n return true;\n }\n /**\n * Handler for situations when we determine the player is waiting.\n *\n * @private\n */\n\n waiting_() {\n if (this.techWaiting_()) {\n return;\n } // All tech waiting checks failed. Use last resort correction\n\n const currentTime = this.tech_.currentTime();\n const buffered = this.tech_.buffered();\n const currentRange = findRange(buffered, currentTime); // Sometimes the player can stall for unknown reasons within a contiguous buffered\n // region with no indication that anything is amiss (seen in Firefox). Seeking to\n // currentTime is usually enough to kickstart the player. This checks that the player\n // is currently within a buffered region before attempting a corrective seek.\n // Chrome does not appear to continue `timeupdate` events after a `waiting` event\n // until there is ~ 3 seconds of forward buffer available. PlaybackWatcher should also\n // make sure there is ~3 seconds of forward buffer before taking any corrective action\n // to avoid triggering an `unknownwaiting` event when the network is slow.\n\n if (currentRange.length && currentTime + 3 <= currentRange.end(0)) {\n this.resetTimeUpdate_();\n this.tech_.setCurrentTime(currentTime);\n this.logger_(`Stopped at ${currentTime} while inside a buffered region ` + `[${currentRange.start(0)} -> ${currentRange.end(0)}]. Attempting to resume ` + 'playback by seeking to the current time.'); // unknown waiting corrections may be useful for monitoring QoS\n\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-unknown-waiting'\n });\n return;\n }\n }\n /**\n * Handler for situations when the tech fires a `waiting` event\n *\n * @return {boolean}\n * True if an action (or none) was needed to correct the waiting. False if no\n * checks passed\n * @private\n */\n\n techWaiting_() {\n const seekable = this.seekable();\n const currentTime = this.tech_.currentTime();\n if (this.tech_.seeking()) {\n // Tech is seeking or already waiting on another action, no action needed\n return true;\n }\n if (this.beforeSeekableWindow_(seekable, currentTime)) {\n const livePoint = seekable.end(seekable.length - 1);\n this.logger_(`Fell out of live window at time ${currentTime}. Seeking to ` + `live point (seekable end) ${livePoint}`);\n this.resetTimeUpdate_();\n this.tech_.setCurrentTime(livePoint); // live window resyncs may be useful for monitoring QoS\n\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-live-resync'\n });\n return true;\n }\n const sourceUpdater = this.tech_.vhs.playlistController_.sourceUpdater_;\n const buffered = this.tech_.buffered();\n const videoUnderflow = this.videoUnderflow_({\n audioBuffered: sourceUpdater.audioBuffered(),\n videoBuffered: sourceUpdater.videoBuffered(),\n currentTime\n });\n if (videoUnderflow) {\n // Even though the video underflowed and was stuck in a gap, the audio overplayed\n // the gap, leading currentTime into a buffered range. Seeking to currentTime\n // allows the video to catch up to the audio position without losing any audio\n // (only suffering ~3 seconds of frozen video and a pause in audio playback).\n this.resetTimeUpdate_();\n this.tech_.setCurrentTime(currentTime); // video underflow may be useful for monitoring QoS\n\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-video-underflow'\n });\n return true;\n }\n const nextRange = findNextRange(buffered, currentTime); // check for gap\n\n if (nextRange.length > 0) {\n this.logger_(`Stopped at ${currentTime} and seeking to ${nextRange.start(0)}`);\n this.resetTimeUpdate_();\n this.skipTheGap_(currentTime);\n return true;\n } // All checks failed. Returning false to indicate failure to correct waiting\n\n return false;\n }\n afterSeekableWindow_(seekable, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow = false) {\n if (!seekable.length) {\n // we can't make a solid case if there's no seekable, default to false\n return false;\n }\n let allowedEnd = seekable.end(seekable.length - 1) + SAFE_TIME_DELTA;\n const isLive = !playlist.endList;\n const isLLHLS = typeof playlist.partTargetDuration === 'number';\n if (isLive && (isLLHLS || allowSeeksWithinUnsafeLiveWindow)) {\n allowedEnd = seekable.end(seekable.length - 1) + playlist.targetDuration * 3;\n }\n if (currentTime > allowedEnd) {\n return true;\n }\n return false;\n }\n beforeSeekableWindow_(seekable, currentTime) {\n if (seekable.length &&\n // can't fall before 0 and 0 seekable start identifies VOD stream\n seekable.start(0) > 0 && currentTime < seekable.start(0) - this.liveRangeSafeTimeDelta) {\n return true;\n }\n return false;\n }\n videoUnderflow_({\n videoBuffered,\n audioBuffered,\n currentTime\n }) {\n // audio only content will not have video underflow :)\n if (!videoBuffered) {\n return;\n }\n let gap; // find a gap in demuxed content.\n\n if (videoBuffered.length && audioBuffered.length) {\n // in Chrome audio will continue to play for ~3s when we run out of video\n // so we have to check that the video buffer did have some buffer in the\n // past.\n const lastVideoRange = findRange(videoBuffered, currentTime - 3);\n const videoRange = findRange(videoBuffered, currentTime);\n const audioRange = findRange(audioBuffered, currentTime);\n if (audioRange.length && !videoRange.length && lastVideoRange.length) {\n gap = {\n start: lastVideoRange.end(0),\n end: audioRange.end(0)\n };\n } // find a gap in muxed content.\n } else {\n const nextRange = findNextRange(videoBuffered, currentTime); // Even if there is no available next range, there is still a possibility we are\n // stuck in a gap due to video underflow.\n\n if (!nextRange.length) {\n gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime);\n }\n }\n if (gap) {\n this.logger_(`Encountered a gap in video from ${gap.start} to ${gap.end}. ` + `Seeking to current time ${currentTime}`);\n return true;\n }\n return false;\n }\n /**\n * Timer callback. If playback still has not proceeded, then we seek\n * to the start of the next buffered region.\n *\n * @private\n */\n\n skipTheGap_(scheduledCurrentTime) {\n const buffered = this.tech_.buffered();\n const currentTime = this.tech_.currentTime();\n const nextRange = findNextRange(buffered, currentTime);\n this.resetTimeUpdate_();\n if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) {\n return;\n }\n this.logger_('skipTheGap_:', 'currentTime:', currentTime, 'scheduled currentTime:', scheduledCurrentTime, 'nextRange start:', nextRange.start(0)); // only seek if we still have not played\n\n this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR);\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-gap-skip'\n });\n }\n gapFromVideoUnderflow_(buffered, currentTime) {\n // At least in Chrome, if there is a gap in the video buffer, the audio will continue\n // playing for ~3 seconds after the video gap starts. This is done to account for\n // video buffer underflow/underrun (note that this is not done when there is audio\n // buffer underflow/underrun -- in that case the video will stop as soon as it\n // encounters the gap, as audio stalls are more noticeable/jarring to a user than\n // video stalls). The player's time will reflect the playthrough of audio, so the\n // time will appear as if we are in a buffered region, even if we are stuck in a\n // \"gap.\"\n //\n // Example:\n // video buffer: 0 => 10.1, 10.2 => 20\n // audio buffer: 0 => 20\n // overall buffer: 0 => 10.1, 10.2 => 20\n // current time: 13\n //\n // Chrome's video froze at 10 seconds, where the video buffer encountered the gap,\n // however, the audio continued playing until it reached ~3 seconds past the gap\n // (13 seconds), at which point it stops as well. Since current time is past the\n // gap, findNextRange will return no ranges.\n //\n // To check for this issue, we see if there is a gap that starts somewhere within\n // a 3 second range (3 seconds +/- 1 second) back from our current time.\n const gaps = findGaps(buffered);\n for (let i = 0; i < gaps.length; i++) {\n const start = gaps.start(i);\n const end = gaps.end(i); // gap is starts no more than 4 seconds back\n\n if (currentTime - start < 4 && currentTime - start > 2) {\n return {\n start,\n end\n };\n }\n }\n return null;\n }\n}\nconst defaultOptions = {\n errorInterval: 30,\n getSource(next) {\n const tech = this.tech({\n IWillNotUseThisInPlugins: true\n });\n const sourceObj = tech.currentSource_ || this.currentSource();\n return next(sourceObj);\n }\n};\n/**\n * Main entry point for the plugin\n *\n * @param {Player} player a reference to a videojs Player instance\n * @param {Object} [options] an object with plugin options\n * @private\n */\n\nconst initPlugin = function (player, options) {\n let lastCalled = 0;\n let seekTo = 0;\n const localOptions = merge(defaultOptions, options);\n player.ready(() => {\n player.trigger({\n type: 'usage',\n name: 'vhs-error-reload-initialized'\n });\n });\n /**\n * Player modifications to perform that must wait until `loadedmetadata`\n * has been triggered\n *\n * @private\n */\n\n const loadedMetadataHandler = function () {\n if (seekTo) {\n player.currentTime(seekTo);\n }\n };\n /**\n * Set the source on the player element, play, and seek if necessary\n *\n * @param {Object} sourceObj An object specifying the source url and mime-type to play\n * @private\n */\n\n const setSource = function (sourceObj) {\n if (sourceObj === null || sourceObj === undefined) {\n return;\n }\n seekTo = player.duration() !== Infinity && player.currentTime() || 0;\n player.one('loadedmetadata', loadedMetadataHandler);\n player.src(sourceObj);\n player.trigger({\n type: 'usage',\n name: 'vhs-error-reload'\n });\n player.play();\n };\n /**\n * Attempt to get a source from either the built-in getSource function\n * or a custom function provided via the options\n *\n * @private\n */\n\n const errorHandler = function () {\n // Do not attempt to reload the source if a source-reload occurred before\n // 'errorInterval' time has elapsed since the last source-reload\n if (Date.now() - lastCalled < localOptions.errorInterval * 1000) {\n player.trigger({\n type: 'usage',\n name: 'vhs-error-reload-canceled'\n });\n return;\n }\n if (!localOptions.getSource || typeof localOptions.getSource !== 'function') {\n videojs.log.error('ERROR: reloadSourceOnError - The option getSource must be a function!');\n return;\n }\n lastCalled = Date.now();\n return localOptions.getSource.call(player, setSource);\n };\n /**\n * Unbind any event handlers that were bound by the plugin\n *\n * @private\n */\n\n const cleanupEvents = function () {\n player.off('loadedmetadata', loadedMetadataHandler);\n player.off('error', errorHandler);\n player.off('dispose', cleanupEvents);\n };\n /**\n * Cleanup before re-initializing the plugin\n *\n * @param {Object} [newOptions] an object with plugin options\n * @private\n */\n\n const reinitPlugin = function (newOptions) {\n cleanupEvents();\n initPlugin(player, newOptions);\n };\n player.on('error', errorHandler);\n player.on('dispose', cleanupEvents); // Overwrite the plugin function so that we can correctly cleanup before\n // initializing the plugin\n\n player.reloadSourceOnError = reinitPlugin;\n};\n/**\n * Reload the source when an error is detected as long as there\n * wasn't an error previously within the last 30 seconds\n *\n * @param {Object} [options] an object with plugin options\n */\n\nconst reloadSourceOnError = function (options) {\n initPlugin(this, options);\n};\nvar version$4 = \"3.9.1\";\nvar version$3 = \"7.0.2\";\nvar version$2 = \"1.3.0\";\nvar version$1 = \"7.1.0\";\nvar version = \"4.0.1\";\n\n/**\n * @file videojs-http-streaming.js\n *\n * The main file for the VHS project.\n * License: https://github.com/videojs/videojs-http-streaming/blob/main/LICENSE\n */\nconst Vhs = {\n PlaylistLoader,\n Playlist,\n utils,\n STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector,\n INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector,\n lastBandwidthSelector,\n movingAverageBandwidthSelector,\n comparePlaylistBandwidth,\n comparePlaylistResolution,\n xhr: xhrFactory()\n}; // Define getter/setters for config properties\n\nObject.keys(Config).forEach(prop => {\n Object.defineProperty(Vhs, prop, {\n get() {\n videojs.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);\n return Config[prop];\n },\n set(value) {\n videojs.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);\n if (typeof value !== 'number' || value < 0) {\n videojs.log.warn(`value of Vhs.${prop} must be greater than or equal to 0`);\n return;\n }\n Config[prop] = value;\n }\n });\n});\nconst LOCAL_STORAGE_KEY = 'videojs-vhs';\n/**\n * Updates the selectedIndex of the QualityLevelList when a mediachange happens in vhs.\n *\n * @param {QualityLevelList} qualityLevels The QualityLevelList to update.\n * @param {PlaylistLoader} playlistLoader PlaylistLoader containing the new media info.\n * @function handleVhsMediaChange\n */\n\nconst handleVhsMediaChange = function (qualityLevels, playlistLoader) {\n const newPlaylist = playlistLoader.media();\n let selectedIndex = -1;\n for (let i = 0; i < qualityLevels.length; i++) {\n if (qualityLevels[i].id === newPlaylist.id) {\n selectedIndex = i;\n break;\n }\n }\n qualityLevels.selectedIndex_ = selectedIndex;\n qualityLevels.trigger({\n selectedIndex,\n type: 'change'\n });\n};\n/**\n * Adds quality levels to list once playlist metadata is available\n *\n * @param {QualityLevelList} qualityLevels The QualityLevelList to attach events to.\n * @param {Object} vhs Vhs object to listen to for media events.\n * @function handleVhsLoadedMetadata\n */\n\nconst handleVhsLoadedMetadata = function (qualityLevels, vhs) {\n vhs.representations().forEach(rep => {\n qualityLevels.addQualityLevel(rep);\n });\n handleVhsMediaChange(qualityLevels, vhs.playlists);\n}; // VHS is a source handler, not a tech. Make sure attempts to use it\n// as one do not cause exceptions.\n\nVhs.canPlaySource = function () {\n return videojs.log.warn('VHS is no longer a tech. Please remove it from ' + 'your player\\'s techOrder.');\n};\nconst emeKeySystems = (keySystemOptions, mainPlaylist, audioPlaylist) => {\n if (!keySystemOptions) {\n return keySystemOptions;\n }\n let codecs = {};\n if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) {\n codecs = unwrapCodecList((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.parseCodecs)(mainPlaylist.attributes.CODECS));\n }\n if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) {\n codecs.audio = audioPlaylist.attributes.CODECS;\n }\n const videoContentType = (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.getMimeForCodec)(codecs.video);\n const audioContentType = (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.getMimeForCodec)(codecs.audio); // upsert the content types based on the selected playlist\n\n const keySystemContentTypes = {};\n for (const keySystem in keySystemOptions) {\n keySystemContentTypes[keySystem] = {};\n if (audioContentType) {\n keySystemContentTypes[keySystem].audioContentType = audioContentType;\n }\n if (videoContentType) {\n keySystemContentTypes[keySystem].videoContentType = videoContentType;\n } // Default to using the video playlist's PSSH even though they may be different, as\n // videojs-contrib-eme will only accept one in the options.\n //\n // This shouldn't be an issue for most cases as early intialization will handle all\n // unique PSSH values, and if they aren't, then encrypted events should have the\n // specific information needed for the unique license.\n\n if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) {\n keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh;\n } // videojs-contrib-eme accepts the option of specifying: 'com.some.cdm': 'url'\n // so we need to prevent overwriting the URL entirely\n\n if (typeof keySystemOptions[keySystem] === 'string') {\n keySystemContentTypes[keySystem].url = keySystemOptions[keySystem];\n }\n }\n return merge(keySystemOptions, keySystemContentTypes);\n};\n/**\n * @typedef {Object} KeySystems\n *\n * keySystems configuration for https://github.com/videojs/videojs-contrib-eme\n * Note: not all options are listed here.\n *\n * @property {Uint8Array} [pssh]\n * Protection System Specific Header\n */\n\n/**\n * Goes through all the playlists and collects an array of KeySystems options objects\n * containing each playlist's keySystems and their pssh values, if available.\n *\n * @param {Object[]} playlists\n * The playlists to look through\n * @param {string[]} keySystems\n * The keySystems to collect pssh values for\n *\n * @return {KeySystems[]}\n * An array of KeySystems objects containing available key systems and their\n * pssh values\n */\n\nconst getAllPsshKeySystemsOptions = (playlists, keySystems) => {\n return playlists.reduce((keySystemsArr, playlist) => {\n if (!playlist.contentProtection) {\n return keySystemsArr;\n }\n const keySystemsOptions = keySystems.reduce((keySystemsObj, keySystem) => {\n const keySystemOptions = playlist.contentProtection[keySystem];\n if (keySystemOptions && keySystemOptions.pssh) {\n keySystemsObj[keySystem] = {\n pssh: keySystemOptions.pssh\n };\n }\n return keySystemsObj;\n }, {});\n if (Object.keys(keySystemsOptions).length) {\n keySystemsArr.push(keySystemsOptions);\n }\n return keySystemsArr;\n }, []);\n};\n/**\n * Returns a promise that waits for the\n * [eme plugin](https://github.com/videojs/videojs-contrib-eme) to create a key session.\n *\n * Works around https://bugs.chromium.org/p/chromium/issues/detail?id=895449 in non-IE11\n * browsers.\n *\n * As per the above ticket, this is particularly important for Chrome, where, if\n * unencrypted content is appended before encrypted content and the key session has not\n * been created, a MEDIA_ERR_DECODE will be thrown once the encrypted content is reached\n * during playback.\n *\n * @param {Object} player\n * The player instance\n * @param {Object[]} sourceKeySystems\n * The key systems options from the player source\n * @param {Object} [audioMedia]\n * The active audio media playlist (optional)\n * @param {Object[]} mainPlaylists\n * The playlists found on the main playlist object\n *\n * @return {Object}\n * Promise that resolves when the key session has been created\n */\n\nconst waitForKeySessionCreation = ({\n player,\n sourceKeySystems,\n audioMedia,\n mainPlaylists\n}) => {\n if (!player.eme.initializeMediaKeys) {\n return Promise.resolve();\n } // TODO should all audio PSSH values be initialized for DRM?\n //\n // All unique video rendition pssh values are initialized for DRM, but here only\n // the initial audio playlist license is initialized. In theory, an encrypted\n // event should be fired if the user switches to an alternative audio playlist\n // where a license is required, but this case hasn't yet been tested. In addition, there\n // may be many alternate audio playlists unlikely to be used (e.g., multiple different\n // languages).\n\n const playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists;\n const keySystemsOptionsArr = getAllPsshKeySystemsOptions(playlists, Object.keys(sourceKeySystems));\n const initializationFinishedPromises = [];\n const keySessionCreatedPromises = []; // Since PSSH values are interpreted as initData, EME will dedupe any duplicates. The\n // only place where it should not be deduped is for ms-prefixed APIs, but\n // the existence of modern EME APIs in addition to\n // ms-prefixed APIs on Edge should prevent this from being a concern.\n // initializeMediaKeys also won't use the webkit-prefixed APIs.\n\n keySystemsOptionsArr.forEach(keySystemsOptions => {\n keySessionCreatedPromises.push(new Promise((resolve, reject) => {\n player.tech_.one('keysessioncreated', resolve);\n }));\n initializationFinishedPromises.push(new Promise((resolve, reject) => {\n player.eme.initializeMediaKeys({\n keySystems: keySystemsOptions\n }, err => {\n if (err) {\n reject(err);\n return;\n }\n resolve();\n });\n }));\n }); // The reasons Promise.race is chosen over Promise.any:\n //\n // * Promise.any is only available in Safari 14+.\n // * None of these promises are expected to reject. If they do reject, it might be\n // better here for the race to surface the rejection, rather than mask it by using\n // Promise.any.\n\n return Promise.race([\n // If a session was previously created, these will all finish resolving without\n // creating a new session, otherwise it will take until the end of all license\n // requests, which is why the key session check is used (to make setup much faster).\n Promise.all(initializationFinishedPromises),\n // Once a single session is created, the browser knows DRM will be used.\n Promise.race(keySessionCreatedPromises)]);\n};\n/**\n * If the [eme](https://github.com/videojs/videojs-contrib-eme) plugin is available, and\n * there are keySystems on the source, sets up source options to prepare the source for\n * eme.\n *\n * @param {Object} player\n * The player instance\n * @param {Object[]} sourceKeySystems\n * The key systems options from the player source\n * @param {Object} media\n * The active media playlist\n * @param {Object} [audioMedia]\n * The active audio media playlist (optional)\n *\n * @return {boolean}\n * Whether or not options were configured and EME is available\n */\n\nconst setupEmeOptions = ({\n player,\n sourceKeySystems,\n media,\n audioMedia\n}) => {\n const sourceOptions = emeKeySystems(sourceKeySystems, media, audioMedia);\n if (!sourceOptions) {\n return false;\n }\n player.currentSource().keySystems = sourceOptions; // eme handles the rest of the setup, so if it is missing\n // do nothing.\n\n if (sourceOptions && !player.eme) {\n videojs.log.warn('DRM encrypted source cannot be decrypted without a DRM plugin');\n return false;\n }\n return true;\n};\nconst getVhsLocalStorage = () => {\n if (!(global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage)) {\n return null;\n }\n const storedObject = global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage.getItem(LOCAL_STORAGE_KEY);\n if (!storedObject) {\n return null;\n }\n try {\n return JSON.parse(storedObject);\n } catch (e) {\n // someone may have tampered with the value\n return null;\n }\n};\nconst updateVhsLocalStorage = options => {\n if (!(global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage)) {\n return false;\n }\n let objectToStore = getVhsLocalStorage();\n objectToStore = objectToStore ? merge(objectToStore, options) : options;\n try {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(objectToStore));\n } catch (e) {\n // Throws if storage is full (e.g., always on iOS 5+ Safari private mode, where\n // storage is set to 0).\n // https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#Exceptions\n // No need to perform any operation.\n return false;\n }\n return objectToStore;\n};\n/**\n * Parses VHS-supported media types from data URIs. See\n * https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs\n * for information on data URIs.\n *\n * @param {string} dataUri\n * The data URI\n *\n * @return {string|Object}\n * The parsed object/string, or the original string if no supported media type\n * was found\n */\n\nconst expandDataUri = dataUri => {\n if (dataUri.toLowerCase().indexOf('data:application/vnd.videojs.vhs+json,') === 0) {\n return JSON.parse(dataUri.substring(dataUri.indexOf(',') + 1));\n } // no known case for this data URI, return the string as-is\n\n return dataUri;\n};\n/**\n * Adds a request hook to an xhr object\n *\n * @param {Object} xhr object to add the onRequest hook to\n * @param {function} callback hook function for an xhr request\n */\n\nconst addOnRequestHook = (xhr, callback) => {\n if (!xhr._requestCallbackSet) {\n xhr._requestCallbackSet = new Set();\n }\n xhr._requestCallbackSet.add(callback);\n};\n/**\n * Adds a response hook to an xhr object\n *\n * @param {Object} xhr object to add the onResponse hook to\n * @param {function} callback hook function for an xhr response\n */\n\nconst addOnResponseHook = (xhr, callback) => {\n if (!xhr._responseCallbackSet) {\n xhr._responseCallbackSet = new Set();\n }\n xhr._responseCallbackSet.add(callback);\n};\n/**\n * Removes a request hook on an xhr object, deletes the onRequest set if empty.\n *\n * @param {Object} xhr object to remove the onRequest hook from\n * @param {function} callback hook function to remove\n */\n\nconst removeOnRequestHook = (xhr, callback) => {\n if (!xhr._requestCallbackSet) {\n return;\n }\n xhr._requestCallbackSet.delete(callback);\n if (!xhr._requestCallbackSet.size) {\n delete xhr._requestCallbackSet;\n }\n};\n/**\n * Removes a response hook on an xhr object, deletes the onResponse set if empty.\n *\n * @param {Object} xhr object to remove the onResponse hook from\n * @param {function} callback hook function to remove\n */\n\nconst removeOnResponseHook = (xhr, callback) => {\n if (!xhr._responseCallbackSet) {\n return;\n }\n xhr._responseCallbackSet.delete(callback);\n if (!xhr._responseCallbackSet.size) {\n delete xhr._responseCallbackSet;\n }\n};\n/**\n * Whether the browser has built-in HLS support.\n */\n\nVhs.supportsNativeHls = function () {\n if (!(global_document__WEBPACK_IMPORTED_MODULE_1___default()) || !(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement)) {\n return false;\n }\n const video = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video'); // native HLS is definitely not supported if HTML5 video isn't\n\n if (!videojs.getTech('Html5').isSupported()) {\n return false;\n } // HLS manifests can go by many mime-types\n\n const canPlay = [\n // Apple santioned\n 'application/vnd.apple.mpegurl',\n // Apple sanctioned for backwards compatibility\n 'audio/mpegurl',\n // Very common\n 'audio/x-mpegurl',\n // Very common\n 'application/x-mpegurl',\n // Included for completeness\n 'video/x-mpegurl', 'video/mpegurl', 'application/mpegurl'];\n return canPlay.some(function (canItPlay) {\n return /maybe|probably/i.test(video.canPlayType(canItPlay));\n });\n}();\nVhs.supportsNativeDash = function () {\n if (!(global_document__WEBPACK_IMPORTED_MODULE_1___default()) || !(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement) || !videojs.getTech('Html5').isSupported()) {\n return false;\n }\n return /maybe|probably/i.test(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video').canPlayType('application/dash+xml'));\n}();\nVhs.supportsTypeNatively = type => {\n if (type === 'hls') {\n return Vhs.supportsNativeHls;\n }\n if (type === 'dash') {\n return Vhs.supportsNativeDash;\n }\n return false;\n};\n/**\n * VHS is a source handler, not a tech. Make sure attempts to use it\n * as one do not cause exceptions.\n */\n\nVhs.isSupported = function () {\n return videojs.log.warn('VHS is no longer a tech. Please remove it from ' + 'your player\\'s techOrder.');\n};\n/**\n * A global function for setting an onRequest hook\n *\n * @param {function} callback for request modifiction\n */\n\nVhs.xhr.onRequest = function (callback) {\n addOnRequestHook(Vhs.xhr, callback);\n};\n/**\n * A global function for setting an onResponse hook\n *\n * @param {callback} callback for response data retrieval\n */\n\nVhs.xhr.onResponse = function (callback) {\n addOnResponseHook(Vhs.xhr, callback);\n};\n/**\n * Deletes a global onRequest callback if it exists\n *\n * @param {function} callback to delete from the global set\n */\n\nVhs.xhr.offRequest = function (callback) {\n removeOnRequestHook(Vhs.xhr, callback);\n};\n/**\n * Deletes a global onResponse callback if it exists\n *\n * @param {function} callback to delete from the global set\n */\n\nVhs.xhr.offResponse = function (callback) {\n removeOnResponseHook(Vhs.xhr, callback);\n};\nconst Component = videojs.getComponent('Component');\n/**\n * The Vhs Handler object, where we orchestrate all of the parts\n * of VHS to interact with video.js\n *\n * @class VhsHandler\n * @extends videojs.Component\n * @param {Object} source the soruce object\n * @param {Tech} tech the parent tech object\n * @param {Object} options optional and required options\n */\n\nclass VhsHandler extends Component {\n constructor(source, tech, options) {\n super(tech, options.vhs); // if a tech level `initialBandwidth` option was passed\n // use that over the VHS level `bandwidth` option\n\n if (typeof options.initialBandwidth === 'number') {\n this.options_.bandwidth = options.initialBandwidth;\n }\n this.logger_ = logger('VhsHandler'); // we need access to the player in some cases,\n // so, get it from Video.js via the `playerId`\n\n if (tech.options_ && tech.options_.playerId) {\n const _player = videojs.getPlayer(tech.options_.playerId);\n this.player_ = _player;\n }\n this.tech_ = tech;\n this.source_ = source;\n this.stats = {};\n this.ignoreNextSeekingEvent_ = false;\n this.setOptions_();\n if (this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) {\n tech.overrideNativeAudioTracks(true);\n tech.overrideNativeVideoTracks(true);\n } else if (this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) {\n // overriding native VHS only works if audio tracks have been emulated\n // error early if we're misconfigured\n throw new Error('Overriding native VHS requires emulated tracks. ' + 'See https://git.io/vMpjB');\n } // listen for fullscreenchange events for this player so that we\n // can adjust our quality selection quickly\n\n this.on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'], event => {\n const fullscreenElement = (global_document__WEBPACK_IMPORTED_MODULE_1___default().fullscreenElement) || (global_document__WEBPACK_IMPORTED_MODULE_1___default().webkitFullscreenElement) || (global_document__WEBPACK_IMPORTED_MODULE_1___default().mozFullScreenElement) || (global_document__WEBPACK_IMPORTED_MODULE_1___default().msFullscreenElement);\n if (fullscreenElement && fullscreenElement.contains(this.tech_.el())) {\n this.playlistController_.fastQualityChange_();\n } else {\n // When leaving fullscreen, since the in page pixel dimensions should be smaller\n // than full screen, see if there should be a rendition switch down to preserve\n // bandwidth.\n this.playlistController_.checkABR_();\n }\n });\n this.on(this.tech_, 'seeking', function () {\n if (this.ignoreNextSeekingEvent_) {\n this.ignoreNextSeekingEvent_ = false;\n return;\n }\n this.setCurrentTime(this.tech_.currentTime());\n });\n this.on(this.tech_, 'error', function () {\n // verify that the error was real and we are loaded\n // enough to have pc loaded.\n if (this.tech_.error() && this.playlistController_) {\n this.playlistController_.pauseLoading();\n }\n });\n this.on(this.tech_, 'play', this.play);\n }\n /**\n * Set VHS options based on options from configuration, as well as partial\n * options to be passed at a later time.\n *\n * @param {Object} options A partial chunk of config options\n */\n\n setOptions_(options = {}) {\n this.options_ = merge(this.options_, options); // defaults\n\n this.options_.withCredentials = this.options_.withCredentials || false;\n this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true;\n this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false;\n this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== 'undefined' ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false;\n this.options_.useForcedSubtitles = this.options_.useForcedSubtitles || false;\n this.options_.useNetworkInformationApi = this.options_.useNetworkInformationApi || false;\n this.options_.useDtsForTimestampOffset = this.options_.useDtsForTimestampOffset || false;\n this.options_.customTagParsers = this.options_.customTagParsers || [];\n this.options_.customTagMappers = this.options_.customTagMappers || [];\n this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false;\n this.options_.llhls = this.options_.llhls === false ? false : true;\n this.options_.bufferBasedABR = this.options_.bufferBasedABR || false;\n if (typeof this.options_.playlistExclusionDuration !== 'number') {\n this.options_.playlistExclusionDuration = 60;\n }\n if (typeof this.options_.bandwidth !== 'number') {\n if (this.options_.useBandwidthFromLocalStorage) {\n const storedObject = getVhsLocalStorage();\n if (storedObject && storedObject.bandwidth) {\n this.options_.bandwidth = storedObject.bandwidth;\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-bandwidth-from-local-storage'\n });\n }\n if (storedObject && storedObject.throughput) {\n this.options_.throughput = storedObject.throughput;\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-throughput-from-local-storage'\n });\n }\n }\n } // if bandwidth was not set by options or pulled from local storage, start playlist\n // selection at a reasonable bandwidth\n\n if (typeof this.options_.bandwidth !== 'number') {\n this.options_.bandwidth = Config.INITIAL_BANDWIDTH;\n } // If the bandwidth number is unchanged from the initial setting\n // then this takes precedence over the enableLowInitialPlaylist option\n\n this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config.INITIAL_BANDWIDTH; // grab options passed to player.src\n\n ['withCredentials', 'useDevicePixelRatio', 'limitRenditionByPlayerDimensions', 'bandwidth', 'customTagParsers', 'customTagMappers', 'cacheEncryptionKeys', 'playlistSelector', 'initialPlaylistSelector', 'bufferBasedABR', 'liveRangeSafeTimeDelta', 'llhls', 'useForcedSubtitles', 'useNetworkInformationApi', 'useDtsForTimestampOffset', 'exactManifestTimings', 'leastPixelDiffSelector'].forEach(option => {\n if (typeof this.source_[option] !== 'undefined') {\n this.options_[option] = this.source_[option];\n }\n });\n this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions;\n this.useDevicePixelRatio = this.options_.useDevicePixelRatio;\n } // alias for public method to set options\n\n setOptions(options = {}) {\n this.setOptions_(options);\n }\n /**\n * called when player.src gets called, handle a new source\n *\n * @param {Object} src the source object to handle\n */\n\n src(src, type) {\n // do nothing if the src is falsey\n if (!src) {\n return;\n }\n this.setOptions_(); // add main playlist controller options\n\n this.options_.src = expandDataUri(this.source_.src);\n this.options_.tech = this.tech_;\n this.options_.externVhs = Vhs;\n this.options_.sourceType = (0,_videojs_vhs_utils_es_media_types_js__WEBPACK_IMPORTED_MODULE_10__.simpleTypeFromSourceType)(type); // Whenever we seek internally, we should update the tech\n\n this.options_.seekTo = time => {\n this.tech_.setCurrentTime(time);\n };\n this.playlistController_ = new PlaylistController(this.options_);\n const playbackWatcherOptions = merge({\n liveRangeSafeTimeDelta: SAFE_TIME_DELTA\n }, this.options_, {\n seekable: () => this.seekable(),\n media: () => this.playlistController_.media(),\n playlistController: this.playlistController_\n });\n this.playbackWatcher_ = new PlaybackWatcher(playbackWatcherOptions);\n this.playlistController_.on('error', () => {\n const player = videojs.players[this.tech_.options_.playerId];\n let error = this.playlistController_.error;\n if (typeof error === 'object' && !error.code) {\n error.code = 3;\n } else if (typeof error === 'string') {\n error = {\n message: error,\n code: 3\n };\n }\n player.error(error);\n });\n const defaultSelector = this.options_.bufferBasedABR ? Vhs.movingAverageBandwidthSelector(0.55) : Vhs.STANDARD_PLAYLIST_SELECTOR; // `this` in selectPlaylist should be the VhsHandler for backwards\n // compatibility with < v2\n\n this.playlistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this);\n this.playlistController_.selectInitialPlaylist = Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this); // re-expose some internal objects for backwards compatibility with < v2\n\n this.playlists = this.playlistController_.mainPlaylistLoader_;\n this.mediaSource = this.playlistController_.mediaSource; // Proxy assignment of some properties to the main playlist\n // controller. Using a custom property for backwards compatibility\n // with < v2\n\n Object.defineProperties(this, {\n selectPlaylist: {\n get() {\n return this.playlistController_.selectPlaylist;\n },\n set(selectPlaylist) {\n this.playlistController_.selectPlaylist = selectPlaylist.bind(this);\n }\n },\n throughput: {\n get() {\n return this.playlistController_.mainSegmentLoader_.throughput.rate;\n },\n set(throughput) {\n this.playlistController_.mainSegmentLoader_.throughput.rate = throughput; // By setting `count` to 1 the throughput value becomes the starting value\n // for the cumulative average\n\n this.playlistController_.mainSegmentLoader_.throughput.count = 1;\n }\n },\n bandwidth: {\n get() {\n let playerBandwidthEst = this.playlistController_.mainSegmentLoader_.bandwidth;\n const networkInformation = (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).connection || (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).mozConnection || (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).webkitConnection;\n const tenMbpsAsBitsPerSecond = 10e6;\n if (this.options_.useNetworkInformationApi && networkInformation) {\n // downlink returns Mbps\n // https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/downlink\n const networkInfoBandwidthEstBitsPerSec = networkInformation.downlink * 1000 * 1000; // downlink maxes out at 10 Mbps. In the event that both networkInformationApi and the player\n // estimate a bandwidth greater than 10 Mbps, use the larger of the two estimates to ensure that\n // high quality streams are not filtered out.\n\n if (networkInfoBandwidthEstBitsPerSec >= tenMbpsAsBitsPerSecond && playerBandwidthEst >= tenMbpsAsBitsPerSecond) {\n playerBandwidthEst = Math.max(playerBandwidthEst, networkInfoBandwidthEstBitsPerSec);\n } else {\n playerBandwidthEst = networkInfoBandwidthEstBitsPerSec;\n }\n }\n return playerBandwidthEst;\n },\n set(bandwidth) {\n this.playlistController_.mainSegmentLoader_.bandwidth = bandwidth; // setting the bandwidth manually resets the throughput counter\n // `count` is set to zero that current value of `rate` isn't included\n // in the cumulative average\n\n this.playlistController_.mainSegmentLoader_.throughput = {\n rate: 0,\n count: 0\n };\n }\n },\n /**\n * `systemBandwidth` is a combination of two serial processes bit-rates. The first\n * is the network bitrate provided by `bandwidth` and the second is the bitrate of\n * the entire process after that - decryption, transmuxing, and appending - provided\n * by `throughput`.\n *\n * Since the two process are serial, the overall system bandwidth is given by:\n * sysBandwidth = 1 / (1 / bandwidth + 1 / throughput)\n */\n systemBandwidth: {\n get() {\n const invBandwidth = 1 / (this.bandwidth || 1);\n let invThroughput;\n if (this.throughput > 0) {\n invThroughput = 1 / this.throughput;\n } else {\n invThroughput = 0;\n }\n const systemBitrate = Math.floor(1 / (invBandwidth + invThroughput));\n return systemBitrate;\n },\n set() {\n videojs.log.error('The \"systemBandwidth\" property is read-only');\n }\n }\n });\n if (this.options_.bandwidth) {\n this.bandwidth = this.options_.bandwidth;\n }\n if (this.options_.throughput) {\n this.throughput = this.options_.throughput;\n }\n Object.defineProperties(this.stats, {\n bandwidth: {\n get: () => this.bandwidth || 0,\n enumerable: true\n },\n mediaRequests: {\n get: () => this.playlistController_.mediaRequests_() || 0,\n enumerable: true\n },\n mediaRequestsAborted: {\n get: () => this.playlistController_.mediaRequestsAborted_() || 0,\n enumerable: true\n },\n mediaRequestsTimedout: {\n get: () => this.playlistController_.mediaRequestsTimedout_() || 0,\n enumerable: true\n },\n mediaRequestsErrored: {\n get: () => this.playlistController_.mediaRequestsErrored_() || 0,\n enumerable: true\n },\n mediaTransferDuration: {\n get: () => this.playlistController_.mediaTransferDuration_() || 0,\n enumerable: true\n },\n mediaBytesTransferred: {\n get: () => this.playlistController_.mediaBytesTransferred_() || 0,\n enumerable: true\n },\n mediaSecondsLoaded: {\n get: () => this.playlistController_.mediaSecondsLoaded_() || 0,\n enumerable: true\n },\n mediaAppends: {\n get: () => this.playlistController_.mediaAppends_() || 0,\n enumerable: true\n },\n mainAppendsToLoadedData: {\n get: () => this.playlistController_.mainAppendsToLoadedData_() || 0,\n enumerable: true\n },\n audioAppendsToLoadedData: {\n get: () => this.playlistController_.audioAppendsToLoadedData_() || 0,\n enumerable: true\n },\n appendsToLoadedData: {\n get: () => this.playlistController_.appendsToLoadedData_() || 0,\n enumerable: true\n },\n timeToLoadedData: {\n get: () => this.playlistController_.timeToLoadedData_() || 0,\n enumerable: true\n },\n buffered: {\n get: () => timeRangesToArray(this.tech_.buffered()),\n enumerable: true\n },\n currentTime: {\n get: () => this.tech_.currentTime(),\n enumerable: true\n },\n currentSource: {\n get: () => this.tech_.currentSource_,\n enumerable: true\n },\n currentTech: {\n get: () => this.tech_.name_,\n enumerable: true\n },\n duration: {\n get: () => this.tech_.duration(),\n enumerable: true\n },\n main: {\n get: () => this.playlists.main,\n enumerable: true\n },\n playerDimensions: {\n get: () => this.tech_.currentDimensions(),\n enumerable: true\n },\n seekable: {\n get: () => timeRangesToArray(this.tech_.seekable()),\n enumerable: true\n },\n timestamp: {\n get: () => Date.now(),\n enumerable: true\n },\n videoPlaybackQuality: {\n get: () => this.tech_.getVideoPlaybackQuality(),\n enumerable: true\n }\n });\n this.tech_.one('canplay', this.playlistController_.setupFirstPlay.bind(this.playlistController_));\n this.tech_.on('bandwidthupdate', () => {\n if (this.options_.useBandwidthFromLocalStorage) {\n updateVhsLocalStorage({\n bandwidth: this.bandwidth,\n throughput: Math.round(this.throughput)\n });\n }\n });\n this.playlistController_.on('selectedinitialmedia', () => {\n // Add the manual rendition mix-in to VhsHandler\n renditionSelectionMixin(this);\n });\n this.playlistController_.sourceUpdater_.on('createdsourcebuffers', () => {\n this.setupEme_();\n }); // the bandwidth of the primary segment loader is our best\n // estimate of overall bandwidth\n\n this.on(this.playlistController_, 'progress', function () {\n this.tech_.trigger('progress');\n }); // In the live case, we need to ignore the very first `seeking` event since\n // that will be the result of the seek-to-live behavior\n\n this.on(this.playlistController_, 'firstplay', function () {\n this.ignoreNextSeekingEvent_ = true;\n });\n this.setupQualityLevels_(); // do nothing if the tech has been disposed already\n // this can occur if someone sets the src in player.ready(), for instance\n\n if (!this.tech_.el()) {\n return;\n }\n this.mediaSourceUrl_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().URL.createObjectURL(this.playlistController_.mediaSource);\n this.tech_.src(this.mediaSourceUrl_);\n }\n createKeySessions_() {\n const audioPlaylistLoader = this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;\n this.logger_('waiting for EME key session creation');\n waitForKeySessionCreation({\n player: this.player_,\n sourceKeySystems: this.source_.keySystems,\n audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(),\n mainPlaylists: this.playlists.main.playlists\n }).then(() => {\n this.logger_('created EME key session');\n this.playlistController_.sourceUpdater_.initializedEme();\n }).catch(err => {\n this.logger_('error while creating EME key session', err);\n this.player_.error({\n message: 'Failed to initialize media keys for EME',\n code: 3\n });\n });\n }\n handleWaitingForKey_() {\n // If waitingforkey is fired, it's possible that the data that's necessary to retrieve\n // the key is in the manifest. While this should've happened on initial source load, it\n // may happen again in live streams where the keys change, and the manifest info\n // reflects the update.\n //\n // Because videojs-contrib-eme compares the PSSH data we send to that of PSSH data it's\n // already requested keys for, we don't have to worry about this generating extraneous\n // requests.\n this.logger_('waitingforkey fired, attempting to create any new key sessions');\n this.createKeySessions_();\n }\n /**\n * If necessary and EME is available, sets up EME options and waits for key session\n * creation.\n *\n * This function also updates the source updater so taht it can be used, as for some\n * browsers, EME must be configured before content is appended (if appending unencrypted\n * content before encrypted content).\n */\n\n setupEme_() {\n const audioPlaylistLoader = this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;\n const didSetupEmeOptions = setupEmeOptions({\n player: this.player_,\n sourceKeySystems: this.source_.keySystems,\n media: this.playlists.media(),\n audioMedia: audioPlaylistLoader && audioPlaylistLoader.media()\n });\n this.player_.tech_.on('keystatuschange', e => {\n this.playlistController_.updatePlaylistByKeyStatus(e.keyId, e.status);\n });\n this.handleWaitingForKey_ = this.handleWaitingForKey_.bind(this);\n this.player_.tech_.on('waitingforkey', this.handleWaitingForKey_);\n if (!didSetupEmeOptions) {\n // If EME options were not set up, we've done all we could to initialize EME.\n this.playlistController_.sourceUpdater_.initializedEme();\n return;\n }\n this.createKeySessions_();\n }\n /**\n * Initializes the quality levels and sets listeners to update them.\n *\n * @method setupQualityLevels_\n * @private\n */\n\n setupQualityLevels_() {\n const player = videojs.players[this.tech_.options_.playerId]; // if there isn't a player or there isn't a qualityLevels plugin\n // or qualityLevels_ listeners have already been setup, do nothing.\n\n if (!player || !player.qualityLevels || this.qualityLevels_) {\n return;\n }\n this.qualityLevels_ = player.qualityLevels();\n this.playlistController_.on('selectedinitialmedia', () => {\n handleVhsLoadedMetadata(this.qualityLevels_, this);\n });\n this.playlists.on('mediachange', () => {\n handleVhsMediaChange(this.qualityLevels_, this.playlists);\n });\n }\n /**\n * return the version\n */\n\n static version() {\n return {\n '@videojs/http-streaming': version$4,\n 'mux.js': version$3,\n 'mpd-parser': version$2,\n 'm3u8-parser': version$1,\n 'aes-decrypter': version\n };\n }\n /**\n * return the version\n */\n\n version() {\n return this.constructor.version();\n }\n canChangeType() {\n return SourceUpdater.canChangeType();\n }\n /**\n * Begin playing the video.\n */\n\n play() {\n this.playlistController_.play();\n }\n /**\n * a wrapper around the function in PlaylistController\n */\n\n setCurrentTime(currentTime) {\n this.playlistController_.setCurrentTime(currentTime);\n }\n /**\n * a wrapper around the function in PlaylistController\n */\n\n duration() {\n return this.playlistController_.duration();\n }\n /**\n * a wrapper around the function in PlaylistController\n */\n\n seekable() {\n return this.playlistController_.seekable();\n }\n /**\n * Abort all outstanding work and cleanup.\n */\n\n dispose() {\n if (this.playbackWatcher_) {\n this.playbackWatcher_.dispose();\n }\n if (this.playlistController_) {\n this.playlistController_.dispose();\n }\n if (this.qualityLevels_) {\n this.qualityLevels_.dispose();\n }\n if (this.tech_ && this.tech_.vhs) {\n delete this.tech_.vhs;\n }\n if (this.mediaSourceUrl_ && (global_window__WEBPACK_IMPORTED_MODULE_0___default().URL).revokeObjectURL) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().URL.revokeObjectURL(this.mediaSourceUrl_);\n this.mediaSourceUrl_ = null;\n }\n if (this.tech_) {\n this.tech_.off('waitingforkey', this.handleWaitingForKey_);\n }\n super.dispose();\n }\n convertToProgramTime(time, callback) {\n return getProgramTime({\n playlist: this.playlistController_.media(),\n time,\n callback\n });\n } // the player must be playing before calling this\n\n seekToProgramTime(programTime, callback, pauseAfterSeek = true, retryCount = 2) {\n return seekToProgramTime({\n programTime,\n playlist: this.playlistController_.media(),\n retryCount,\n pauseAfterSeek,\n seekTo: this.options_.seekTo,\n tech: this.options_.tech,\n callback\n });\n }\n /**\n * Adds the onRequest, onResponse, offRequest and offResponse functions\n * to the VhsHandler xhr Object.\n */\n\n setupXhrHooks_() {\n /**\n * A player function for setting an onRequest hook\n *\n * @param {function} callback for request modifiction\n */\n this.xhr.onRequest = callback => {\n addOnRequestHook(this.xhr, callback);\n };\n /**\n * A player function for setting an onResponse hook\n *\n * @param {callback} callback for response data retrieval\n */\n\n this.xhr.onResponse = callback => {\n addOnResponseHook(this.xhr, callback);\n };\n /**\n * Deletes a player onRequest callback if it exists\n *\n * @param {function} callback to delete from the player set\n */\n\n this.xhr.offRequest = callback => {\n removeOnRequestHook(this.xhr, callback);\n };\n /**\n * Deletes a player onResponse callback if it exists\n *\n * @param {function} callback to delete from the player set\n */\n\n this.xhr.offResponse = callback => {\n removeOnResponseHook(this.xhr, callback);\n }; // Trigger an event on the player to notify the user that vhs is ready to set xhr hooks.\n // This allows hooks to be set before the source is set to vhs when handleSource is called.\n\n this.player_.trigger('xhr-hooks-ready');\n }\n}\n/**\n * The Source Handler object, which informs video.js what additional\n * MIME types are supported and sets up playback. It is registered\n * automatically to the appropriate tech based on the capabilities of\n * the browser it is running in. It is not necessary to use or modify\n * this object in normal usage.\n */\n\nconst VhsSourceHandler = {\n name: 'videojs-http-streaming',\n VERSION: version$4,\n canHandleSource(srcObj, options = {}) {\n const localOptions = merge(videojs.options, options);\n return VhsSourceHandler.canPlayType(srcObj.type, localOptions);\n },\n handleSource(source, tech, options = {}) {\n const localOptions = merge(videojs.options, options);\n tech.vhs = new VhsHandler(source, tech, localOptions);\n tech.vhs.xhr = xhrFactory();\n tech.vhs.setupXhrHooks_();\n tech.vhs.src(source.src, source.type);\n return tech.vhs;\n },\n canPlayType(type, options) {\n const simpleType = (0,_videojs_vhs_utils_es_media_types_js__WEBPACK_IMPORTED_MODULE_10__.simpleTypeFromSourceType)(type);\n if (!simpleType) {\n return '';\n }\n const overrideNative = VhsSourceHandler.getOverrideNative(options);\n const supportsTypeNatively = Vhs.supportsTypeNatively(simpleType);\n const canUseMsePlayback = !supportsTypeNatively || overrideNative;\n return canUseMsePlayback ? 'maybe' : '';\n },\n getOverrideNative(options = {}) {\n const {\n vhs = {}\n } = options;\n const defaultOverrideNative = !(videojs.browser.IS_ANY_SAFARI || videojs.browser.IS_IOS);\n const {\n overrideNative = defaultOverrideNative\n } = vhs;\n return overrideNative;\n }\n};\n/**\n * Check to see if the native MediaSource object exists and supports\n * an MP4 container with both H.264 video and AAC-LC audio.\n *\n * @return {boolean} if native media sources are supported\n */\n\nconst supportsNativeMediaSources = () => {\n return (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_9__.browserSupportsCodec)('avc1.4d400d,mp4a.40.2');\n}; // register source handlers with the appropriate techs\n\nif (supportsNativeMediaSources()) {\n videojs.getTech('Html5').registerSourceHandler(VhsSourceHandler, 0);\n}\nvideojs.VhsHandler = VhsHandler;\nvideojs.VhsSourceHandler = VhsSourceHandler;\nvideojs.Vhs = Vhs;\nif (!videojs.use) {\n videojs.registerComponent('Vhs', Vhs);\n}\nvideojs.options.vhs = videojs.options.vhs || {};\nif (!videojs.getPlugin || !videojs.getPlugin('reloadSourceOnError')) {\n videojs.registerPlugin('reloadSourceOnError', reloadSourceOnError);\n}\n\n\n\n\n//# sourceURL=webpack://web/./node_modules/video.js/dist/video.es.js?")},"./node_modules/videojs-contrib-dash/dist/videojs-dash.es.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var video_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! video.js */ "./node_modules/videojs-contrib-dash/node_modules/video.js/dist/video.es.js");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! global/window */ "./node_modules/global/window.js");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var global_document__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! global/document */ "./node_modules/global/document.js");\n/* harmony import */ var global_document__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(global_document__WEBPACK_IMPORTED_MODULE_2__);\n/*! @name videojs-contrib-dash @version 5.1.1 @license Apache-2.0 */\n\n\n\n\nfunction unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, \'default\') ? x[\'default\'] : x;\n}\n\nfunction createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nvar dash_all_debug = createCommonjsModule(function (module, exports) {\n(function webpackUniversalModuleDefinition(root, factory) {\n\tmodule.exports = factory();\n})(window, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __nested_webpack_require_800__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_800__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__nested_webpack_require_800__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__nested_webpack_require_800__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__nested_webpack_require_800__.d = function(exports, name, getter) {\n/******/ \t\tif(!__nested_webpack_require_800__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__nested_webpack_require_800__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== \'undefined\' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: \'Module\' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, \'__esModule\', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__nested_webpack_require_800__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __nested_webpack_require_800__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === \'object\' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__nested_webpack_require_800__.r(ns);\n/******/ \t\tObject.defineProperty(ns, \'default\', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != \'string\') for(var key in value) __nested_webpack_require_800__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__nested_webpack_require_800__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module[\'default\']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__nested_webpack_require_800__.d(getter, \'a\', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__nested_webpack_require_800__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__nested_webpack_require_800__.p = "/dist/";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __nested_webpack_require_800__(__nested_webpack_require_800__.s = "./index.js");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ "./externals/base64.js":\n/*!*****************************!*\\\n !*** ./externals/base64.js ***!\n \\*****************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* $Date: 2007-06-12 18:02:31 $ */\n// from: http://bannister.us/weblog/2007/06/09/simple-base64-encodedecode-javascript/\n// Handles encode/decode of ASCII and Unicode strings.\nvar UTF8 = {};\n\nUTF8.encode = function (s) {\n var u = [];\n\n for (var i = 0; i < s.length; ++i) {\n var c = s.charCodeAt(i);\n\n if (c < 0x80) {\n u.push(c);\n } else if (c < 0x800) {\n u.push(0xC0 | c >> 6);\n u.push(0x80 | 63 & c);\n } else if (c < 0x10000) {\n u.push(0xE0 | c >> 12);\n u.push(0x80 | 63 & c >> 6);\n u.push(0x80 | 63 & c);\n } else {\n u.push(0xF0 | c >> 18);\n u.push(0x80 | 63 & c >> 12);\n u.push(0x80 | 63 & c >> 6);\n u.push(0x80 | 63 & c);\n }\n }\n\n return u;\n};\n\nUTF8.decode = function (u) {\n var a = [];\n var i = 0;\n\n while (i < u.length) {\n var v = u[i++];\n\n if (v < 0x80) ; else if (v < 0xE0) {\n v = (31 & v) << 6;\n v |= 63 & u[i++];\n } else if (v < 0xF0) {\n v = (15 & v) << 12;\n v |= (63 & u[i++]) << 6;\n v |= 63 & u[i++];\n } else {\n v = (7 & v) << 18;\n v |= (63 & u[i++]) << 12;\n v |= (63 & u[i++]) << 6;\n v |= 63 & u[i++];\n }\n\n a.push(String.fromCharCode(v));\n }\n\n return a.join(\'\');\n};\n\nvar BASE64 = {};\n\n(function (T) {\n var encodeArray = function encodeArray(u) {\n var i = 0;\n var a = [];\n var n = 0 | u.length / 3;\n\n while (0 < n--) {\n var v = (u[i] << 16) + (u[i + 1] << 8) + u[i + 2];\n i += 3;\n a.push(T.charAt(63 & v >> 18));\n a.push(T.charAt(63 & v >> 12));\n a.push(T.charAt(63 & v >> 6));\n a.push(T.charAt(63 & v));\n }\n\n if (2 == u.length - i) {\n var v = (u[i] << 16) + (u[i + 1] << 8);\n a.push(T.charAt(63 & v >> 18));\n a.push(T.charAt(63 & v >> 12));\n a.push(T.charAt(63 & v >> 6));\n a.push(\'=\');\n } else if (1 == u.length - i) {\n var v = u[i] << 16;\n a.push(T.charAt(63 & v >> 18));\n a.push(T.charAt(63 & v >> 12));\n a.push(\'==\');\n }\n\n return a.join(\'\');\n };\n\n var R = function () {\n var a = [];\n\n for (var i = 0; i < T.length; ++i) {\n a[T.charCodeAt(i)] = i;\n }\n\n a[\'=\'.charCodeAt(0)] = 0;\n return a;\n }();\n\n var decodeArray = function decodeArray(s) {\n var i = 0;\n var u = [];\n var n = 0 | s.length / 4;\n\n while (0 < n--) {\n var v = (R[s.charCodeAt(i)] << 18) + (R[s.charCodeAt(i + 1)] << 12) + (R[s.charCodeAt(i + 2)] << 6) + R[s.charCodeAt(i + 3)];\n u.push(255 & v >> 16);\n u.push(255 & v >> 8);\n u.push(255 & v);\n i += 4;\n }\n\n if (u) {\n if (\'=\' == s.charAt(i - 2)) {\n u.pop();\n u.pop();\n } else if (\'=\' == s.charAt(i - 1)) {\n u.pop();\n }\n }\n\n return u;\n };\n\n var ASCII = {};\n\n ASCII.encode = function (s) {\n var u = [];\n\n for (var i = 0; i < s.length; ++i) {\n u.push(s.charCodeAt(i));\n }\n\n return u;\n };\n\n ASCII.decode = function (u) {\n for (var i = 0; i < s.length; ++i) {\n a[i] = String.fromCharCode(a[i]);\n }\n\n return a.join(\'\');\n };\n\n BASE64.decodeArray = function (s) {\n var u = decodeArray(s);\n return new Uint8Array(u);\n };\n\n BASE64.encodeASCII = function (s) {\n var u = ASCII.encode(s);\n return encodeArray(u);\n };\n\n BASE64.decodeASCII = function (s) {\n var a = decodeArray(s);\n return ASCII.decode(a);\n };\n\n BASE64.encode = function (s) {\n var u = UTF8.encode(s);\n return encodeArray(u);\n };\n\n BASE64.decode = function (s) {\n var u = decodeArray(s);\n return UTF8.decode(u);\n };\n})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");\n/*The following polyfills are not used in dash.js but have caused multiplayer integration issues.\n Therefore commenting them out.\nif (undefined === btoa) {\n var btoa = BASE64.encode;\n}\nif (undefined === atob) {\n var atob = BASE64.decode;\n}\n*/\n\n\n{\n exports.decode = BASE64.decode;\n exports.decodeArray = BASE64.decodeArray;\n exports.encode = BASE64.encode;\n exports.encodeASCII = BASE64.encodeASCII;\n}\n\n/***/ }),\n\n/***/ "./externals/cea608-parser.js":\n/*!************************************!*\\\n !*** ./externals/cea608-parser.js ***!\n \\************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2015-2016, DASH Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * 2. Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n(function (exports) {\n /**\n * Exceptions from regular ASCII. CodePoints are mapped to UTF-16 codes\n */\n\n var specialCea608CharsCodes = {\n 0x2a: 0xe1,\n // lowercase a, acute accent\n 0x5c: 0xe9,\n // lowercase e, acute accent\n 0x5e: 0xed,\n // lowercase i, acute accent\n 0x5f: 0xf3,\n // lowercase o, acute accent\n 0x60: 0xfa,\n // lowercase u, acute accent\n 0x7b: 0xe7,\n // lowercase c with cedilla\n 0x7c: 0xf7,\n // division symbol\n 0x7d: 0xd1,\n // uppercase N tilde\n 0x7e: 0xf1,\n // lowercase n tilde\n 0x7f: 0x2588,\n // Full block\n // THIS BLOCK INCLUDES THE 16 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x11 AND LOW BETWEEN 0x30 AND 0x3F\n // THIS MEANS THAT \\x50 MUST BE ADDED TO THE VALUES\n 0x80: 0xae,\n // Registered symbol (R)\n 0x81: 0xb0,\n // degree sign\n 0x82: 0xbd,\n // 1/2 symbol\n 0x83: 0xbf,\n // Inverted (open) question mark\n 0x84: 0x2122,\n // Trademark symbol (TM)\n 0x85: 0xa2,\n // Cents symbol\n 0x86: 0xa3,\n // Pounds sterling\n 0x87: 0x266a,\n // Music 8\'th note\n 0x88: 0xe0,\n // lowercase a, grave accent\n 0x89: 0x20,\n // transparent space (regular)\n 0x8a: 0xe8,\n // lowercase e, grave accent\n 0x8b: 0xe2,\n // lowercase a, circumflex accent\n 0x8c: 0xea,\n // lowercase e, circumflex accent\n 0x8d: 0xee,\n // lowercase i, circumflex accent\n 0x8e: 0xf4,\n // lowercase o, circumflex accent\n 0x8f: 0xfb,\n // lowercase u, circumflex accent\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x12 AND LOW BETWEEN 0x20 AND 0x3F\n 0x90: 0xc1,\n // capital letter A with acute\n 0x91: 0xc9,\n // capital letter E with acute\n 0x92: 0xd3,\n // capital letter O with acute\n 0x93: 0xda,\n // capital letter U with acute\n 0x94: 0xdc,\n // capital letter U with diaresis\n 0x95: 0xfc,\n // lowercase letter U with diaeresis\n 0x96: 0x2018,\n // opening single quote\n 0x97: 0xa1,\n // inverted exclamation mark\n 0x98: 0x2a,\n // asterisk\n 0x99: 0x2019,\n // closing single quote\n 0x9a: 0x2501,\n // box drawings heavy horizontal\n 0x9b: 0xa9,\n // copyright sign\n 0x9c: 0x2120,\n // Service mark\n 0x9d: 0x2022,\n // (round) bullet\n 0x9e: 0x201c,\n // Left double quotation mark\n 0x9f: 0x201d,\n // Right double quotation mark\n 0xa0: 0xc0,\n // uppercase A, grave accent\n 0xa1: 0xc2,\n // uppercase A, circumflex\n 0xa2: 0xc7,\n // uppercase C with cedilla\n 0xa3: 0xc8,\n // uppercase E, grave accent\n 0xa4: 0xca,\n // uppercase E, circumflex\n 0xa5: 0xcb,\n // capital letter E with diaresis\n 0xa6: 0xeb,\n // lowercase letter e with diaresis\n 0xa7: 0xce,\n // uppercase I, circumflex\n 0xa8: 0xcf,\n // uppercase I, with diaresis\n 0xa9: 0xef,\n // lowercase i, with diaresis\n 0xaa: 0xd4,\n // uppercase O, circumflex\n 0xab: 0xd9,\n // uppercase U, grave accent\n 0xac: 0xf9,\n // lowercase u, grave accent\n 0xad: 0xdb,\n // uppercase U, circumflex\n 0xae: 0xab,\n // left-pointing double angle quotation mark\n 0xaf: 0xbb,\n // right-pointing double angle quotation mark\n // THIS BLOCK INCLUDES THE 32 EXTENDED (TWO-BYTE) LINE 21 CHARACTERS\n // THAT COME FROM HI BYTE=0x13 AND LOW BETWEEN 0x20 AND 0x3F\n 0xb0: 0xc3,\n // Uppercase A, tilde\n 0xb1: 0xe3,\n // Lowercase a, tilde\n 0xb2: 0xcd,\n // Uppercase I, acute accent\n 0xb3: 0xcc,\n // Uppercase I, grave accent\n 0xb4: 0xec,\n // Lowercase i, grave accent\n 0xb5: 0xd2,\n // Uppercase O, grave accent\n 0xb6: 0xf2,\n // Lowercase o, grave accent\n 0xb7: 0xd5,\n // Uppercase O, tilde\n 0xb8: 0xf5,\n // Lowercase o, tilde\n 0xb9: 0x7b,\n // Open curly brace\n 0xba: 0x7d,\n // Closing curly brace\n 0xbb: 0x5c,\n // Backslash\n 0xbc: 0x5e,\n // Caret\n 0xbd: 0x5f,\n // Underscore\n 0xbe: 0x7c,\n // Pipe (vertical line)\n 0xbf: 0x223c,\n // Tilde operator\n 0xc0: 0xc4,\n // Uppercase A, umlaut\n 0xc1: 0xe4,\n // Lowercase A, umlaut\n 0xc2: 0xd6,\n // Uppercase O, umlaut\n 0xc3: 0xf6,\n // Lowercase o, umlaut\n 0xc4: 0xdf,\n // Esszett (sharp S)\n 0xc5: 0xa5,\n // Yen symbol\n 0xc6: 0xa4,\n // Generic currency sign\n 0xc7: 0x2503,\n // Box drawings heavy vertical\n 0xc8: 0xc5,\n // Uppercase A, ring\n 0xc9: 0xe5,\n // Lowercase A, ring\n 0xca: 0xd8,\n // Uppercase O, stroke\n 0xcb: 0xf8,\n // Lowercase o, strok\n 0xcc: 0x250f,\n // Box drawings heavy down and right\n 0xcd: 0x2513,\n // Box drawings heavy down and left\n 0xce: 0x2517,\n // Box drawings heavy up and right\n 0xcf: 0x251b // Box drawings heavy up and left\n\n };\n /**\n * Get Unicode Character from CEA-608 byte code\n */\n\n var getCharForByte = function getCharForByte(_byte) {\n var charCode = _byte;\n\n if (specialCea608CharsCodes.hasOwnProperty(_byte)) {\n charCode = specialCea608CharsCodes[_byte];\n }\n\n return String.fromCharCode(charCode);\n };\n\n var NR_ROWS = 15,\n NR_COLS = 32; // Tables to look up row from PAC data\n\n var rowsLowCh1 = {\n 0x11: 1,\n 0x12: 3,\n 0x15: 5,\n 0x16: 7,\n 0x17: 9,\n 0x10: 11,\n 0x13: 12,\n 0x14: 14\n };\n var rowsHighCh1 = {\n 0x11: 2,\n 0x12: 4,\n 0x15: 6,\n 0x16: 8,\n 0x17: 10,\n 0x13: 13,\n 0x14: 15\n };\n var rowsLowCh2 = {\n 0x19: 1,\n 0x1A: 3,\n 0x1D: 5,\n 0x1E: 7,\n 0x1F: 9,\n 0x18: 11,\n 0x1B: 12,\n 0x1C: 14\n };\n var rowsHighCh2 = {\n 0x19: 2,\n 0x1A: 4,\n 0x1D: 6,\n 0x1E: 8,\n 0x1F: 10,\n 0x1B: 13,\n 0x1C: 15\n };\n var backgroundColors = [\'white\', \'green\', \'blue\', \'cyan\', \'red\', \'yellow\', \'magenta\', \'black\', \'transparent\'];\n /**\n * Simple logger class to be able to write with time-stamps and filter on level.\n */\n\n var logger = {\n verboseFilter: {\n \'DATA\': 3,\n \'DEBUG\': 3,\n \'INFO\': 2,\n \'WARNING\': 2,\n \'TEXT\': 1,\n \'ERROR\': 0\n },\n time: null,\n verboseLevel: 0,\n // Only write errors\n setTime: function setTime(newTime) {\n this.time = newTime;\n },\n log: function log(severity, msg) {\n var minLevel = this.verboseFilter[severity];\n\n if (this.verboseLevel >= minLevel) {\n console.log(this.time + " [" + severity + "] " + msg);\n }\n }\n };\n\n var numArrayToHexArray = function numArrayToHexArray(numArray) {\n var hexArray = [];\n\n for (var j = 0; j < numArray.length; j++) {\n hexArray.push(numArray[j].toString(16));\n }\n\n return hexArray;\n };\n /**\n * State of CEA-608 pen or character\n * @constructor\n */\n\n\n var PenState = function PenState(foreground, underline, italics, background, flash) {\n this.foreground = foreground || "white";\n this.underline = underline || false;\n this.italics = italics || false;\n this.background = background || "black";\n this.flash = flash || false;\n };\n\n PenState.prototype = {\n reset: function reset() {\n this.foreground = "white";\n this.underline = false;\n this.italics = false;\n this.background = "black";\n this.flash = false;\n },\n setStyles: function setStyles(styles) {\n var attribs = ["foreground", "underline", "italics", "background", "flash"];\n\n for (var i = 0; i < attribs.length; i++) {\n var style = attribs[i];\n\n if (styles.hasOwnProperty(style)) {\n this[style] = styles[style];\n }\n }\n },\n isDefault: function isDefault() {\n return this.foreground === "white" && !this.underline && !this.italics && this.background === "black" && !this.flash;\n },\n equals: function equals(other) {\n return this.foreground === other.foreground && this.underline === other.underline && this.italics === other.italics && this.background === other.background && this.flash === other.flash;\n },\n copy: function copy(newPenState) {\n this.foreground = newPenState.foreground;\n this.underline = newPenState.underline;\n this.italics = newPenState.italics;\n this.background = newPenState.background;\n this.flash = newPenState.flash;\n },\n toString: function toString() {\n return "color=" + this.foreground + ", underline=" + this.underline + ", italics=" + this.italics + ", background=" + this.background + ", flash=" + this.flash;\n }\n };\n /**\n * Unicode character with styling and background.\n * @constructor\n */\n\n var StyledUnicodeChar = function StyledUnicodeChar(uchar, foreground, underline, italics, background, flash) {\n this.uchar = uchar || \' \'; // unicode character\n\n this.penState = new PenState(foreground, underline, italics, background, flash);\n };\n\n StyledUnicodeChar.prototype = {\n reset: function reset() {\n this.uchar = \' \';\n this.penState.reset();\n },\n setChar: function setChar(uchar, newPenState) {\n this.uchar = uchar;\n this.penState.copy(newPenState);\n },\n setPenState: function setPenState(newPenState) {\n this.penState.copy(newPenState);\n },\n equals: function equals(other) {\n return this.uchar === other.uchar && this.penState.equals(other.penState);\n },\n copy: function copy(newChar) {\n this.uchar = newChar.uchar;\n this.penState.copy(newChar.penState);\n },\n isEmpty: function isEmpty() {\n return this.uchar === \' \' && this.penState.isDefault();\n }\n };\n /**\n * CEA-608 row consisting of NR_COLS instances of StyledUnicodeChar.\n * @constructor\n */\n\n var Row = function Row() {\n this.chars = [];\n\n for (var i = 0; i < NR_COLS; i++) {\n this.chars.push(new StyledUnicodeChar());\n }\n\n this.pos = 0;\n this.currPenState = new PenState();\n };\n\n Row.prototype = {\n equals: function equals(other) {\n var equal = true;\n\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].equals(other.chars[i])) {\n equal = false;\n break;\n }\n }\n\n return equal;\n },\n copy: function copy(other) {\n for (var i = 0; i < NR_COLS; i++) {\n this.chars[i].copy(other.chars[i]);\n }\n },\n isEmpty: function isEmpty() {\n var empty = true;\n\n for (var i = 0; i < NR_COLS; i++) {\n if (!this.chars[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n\n return empty;\n },\n\n /**\n * Set the cursor to a valid column.\n */\n setCursor: function setCursor(absPos) {\n if (this.pos !== absPos) {\n this.pos = absPos;\n }\n\n if (this.pos < 0) {\n logger.log("ERROR", "Negative cursor position " + this.pos);\n this.pos = 0;\n } else if (this.pos > NR_COLS) {\n logger.log("ERROR", "Too large cursor position " + this.pos);\n this.pos = NR_COLS;\n }\n },\n\n /** \n * Move the cursor relative to current position.\n */\n moveCursor: function moveCursor(relPos) {\n var newPos = this.pos + relPos;\n\n if (relPos > 1) {\n for (var i = this.pos + 1; i < newPos + 1; i++) {\n this.chars[i].setPenState(this.currPenState);\n }\n }\n\n this.setCursor(newPos);\n },\n\n /**\n * Backspace, move one step back and clear character.\n */\n backSpace: function backSpace() {\n this.moveCursor(-1);\n this.chars[this.pos].setChar(\' \', this.currPenState);\n },\n insertChar: function insertChar(_byte2) {\n if (_byte2 >= 0x90) {\n //Extended char\n this.backSpace();\n }\n\n var _char = getCharForByte(_byte2);\n\n if (this.pos >= NR_COLS) {\n logger.log("ERROR", "Cannot insert " + _byte2.toString(16) + " (" + _char + ") at position " + this.pos + ". Skipping it!");\n return;\n }\n\n this.chars[this.pos].setChar(_char, this.currPenState);\n this.moveCursor(1);\n },\n clearFromPos: function clearFromPos(startPos) {\n var i;\n\n for (i = startPos; i < NR_COLS; i++) {\n this.chars[i].reset();\n }\n },\n clear: function clear() {\n this.clearFromPos(0);\n this.pos = 0;\n this.currPenState.reset();\n },\n clearToEndOfRow: function clearToEndOfRow() {\n this.clearFromPos(this.pos);\n },\n getTextString: function getTextString() {\n var chars = [];\n var empty = true;\n\n for (var i = 0; i < NR_COLS; i++) {\n var _char2 = this.chars[i].uchar;\n\n if (_char2 !== " ") {\n empty = false;\n }\n\n chars.push(_char2);\n }\n\n if (empty) {\n return "";\n } else {\n return chars.join("");\n }\n },\n setPenStyles: function setPenStyles(styles) {\n this.currPenState.setStyles(styles);\n var currChar = this.chars[this.pos];\n currChar.setPenState(this.currPenState);\n }\n };\n /**\n * Keep a CEA-608 screen of 32x15 styled characters\n * @constructor\n */\n\n var CaptionScreen = function CaptionScreen() {\n this.rows = [];\n\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows.push(new Row()); // Note that we use zero-based numbering (0-14)\n }\n\n this.currRow = NR_ROWS - 1;\n this.nrRollUpRows = null;\n this.reset();\n };\n\n CaptionScreen.prototype = {\n reset: function reset() {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].clear();\n }\n\n this.currRow = NR_ROWS - 1;\n },\n equals: function equals(other) {\n var equal = true;\n\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].equals(other.rows[i])) {\n equal = false;\n break;\n }\n }\n\n return equal;\n },\n copy: function copy(other) {\n for (var i = 0; i < NR_ROWS; i++) {\n this.rows[i].copy(other.rows[i]);\n }\n },\n isEmpty: function isEmpty() {\n var empty = true;\n\n for (var i = 0; i < NR_ROWS; i++) {\n if (!this.rows[i].isEmpty()) {\n empty = false;\n break;\n }\n }\n\n return empty;\n },\n backSpace: function backSpace() {\n var row = this.rows[this.currRow];\n row.backSpace();\n },\n clearToEndOfRow: function clearToEndOfRow() {\n var row = this.rows[this.currRow];\n row.clearToEndOfRow();\n },\n\n /**\n * Insert a character (without styling) in the current row.\n */\n insertChar: function insertChar(_char3) {\n var row = this.rows[this.currRow];\n row.insertChar(_char3);\n },\n setPen: function setPen(styles) {\n var row = this.rows[this.currRow];\n row.setPenStyles(styles);\n },\n moveCursor: function moveCursor(relPos) {\n var row = this.rows[this.currRow];\n row.moveCursor(relPos);\n },\n setCursor: function setCursor(absPos) {\n logger.log("INFO", "setCursor: " + absPos);\n var row = this.rows[this.currRow];\n row.setCursor(absPos);\n },\n setPAC: function setPAC(pacData) {\n logger.log("INFO", "pacData = " + JSON.stringify(pacData));\n var newRow = pacData.row - 1;\n\n if (this.nrRollUpRows && newRow < this.nrRollUpRows - 1) {\n newRow = this.nrRollUpRows - 1;\n }\n\n this.currRow = newRow;\n var row = this.rows[this.currRow];\n\n if (pacData.indent !== null) {\n var indent = pacData.indent;\n var prevPos = Math.max(indent - 1, 0);\n row.setCursor(pacData.indent);\n pacData.color = row.chars[prevPos].penState.foreground;\n }\n\n var styles = {\n foreground: pacData.color,\n underline: pacData.underline,\n italics: pacData.italics,\n background: \'black\',\n flash: false\n };\n this.setPen(styles);\n },\n\n /**\n * Set background/extra foreground, but first do back_space, and then insert space (backwards compatibility).\n */\n setBkgData: function setBkgData(bkgData) {\n logger.log("INFO", "bkgData = " + JSON.stringify(bkgData));\n this.backSpace();\n this.setPen(bkgData);\n this.insertChar(0x20); //Space\n },\n setRollUpRows: function setRollUpRows(nrRows) {\n this.nrRollUpRows = nrRows;\n },\n rollUp: function rollUp() {\n if (this.nrRollUpRows === null) {\n logger.log("DEBUG", "roll_up but nrRollUpRows not set yet");\n return; //Not properly setup\n }\n\n logger.log("TEXT", this.getDisplayText());\n var topRowIndex = this.currRow + 1 - this.nrRollUpRows;\n var topRow = this.rows.splice(topRowIndex, 1)[0];\n topRow.clear();\n this.rows.splice(this.currRow, 0, topRow);\n logger.log("INFO", "Rolling up"); //logger.log("TEXT", this.get_display_text())\n },\n\n /**\n * Get all non-empty rows with as unicode text. \n */\n getDisplayText: function getDisplayText(asOneRow) {\n asOneRow = asOneRow || false;\n var displayText = [];\n var text = "";\n var rowNr = -1;\n\n for (var i = 0; i < NR_ROWS; i++) {\n var rowText = this.rows[i].getTextString();\n\n if (rowText) {\n rowNr = i + 1;\n\n if (asOneRow) {\n displayText.push("Row " + rowNr + \': "\' + rowText + \'"\');\n } else {\n displayText.push(rowText.trim());\n }\n }\n }\n\n if (displayText.length > 0) {\n if (asOneRow) {\n text = "[" + displayText.join(" | ") + "]";\n } else {\n text = displayText.join("\\n");\n }\n }\n\n return text;\n },\n getTextAndFormat: function getTextAndFormat() {\n return this.rows;\n }\n };\n /**\n * Handle a CEA-608 channel and send decoded data to outputFilter\n * @constructor\n * @param {Number} channelNumber (1 or 2)\n * @param {CueHandler} outputFilter Output from channel1 newCue(startTime, endTime, captionScreen)\n */\n\n var Cea608Channel = function Cea608Channel(channelNumber, outputFilter) {\n this.chNr = channelNumber;\n this.outputFilter = outputFilter;\n this.mode = null;\n this.verbose = 0;\n this.displayedMemory = new CaptionScreen();\n this.nonDisplayedMemory = new CaptionScreen();\n this.lastOutputScreen = new CaptionScreen();\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null; // Keeps track of where a cue started.\n };\n\n Cea608Channel.prototype = {\n modes: ["MODE_ROLL-UP", "MODE_POP-ON", "MODE_PAINT-ON", "MODE_TEXT"],\n reset: function reset() {\n this.mode = null;\n this.displayedMemory.reset();\n this.nonDisplayedMemory.reset();\n this.lastOutputScreen.reset();\n this.currRollUpRow = this.displayedMemory.rows[NR_ROWS - 1];\n this.writeScreen = this.displayedMemory;\n this.mode = null;\n this.cueStartTime = null;\n this.lastCueEndTime = null;\n },\n getHandler: function getHandler() {\n return this.outputFilter;\n },\n setHandler: function setHandler(newHandler) {\n this.outputFilter = newHandler;\n },\n setPAC: function setPAC(pacData) {\n this.writeScreen.setPAC(pacData);\n },\n setBkgData: function setBkgData(bkgData) {\n this.writeScreen.setBkgData(bkgData);\n },\n setMode: function setMode(newMode) {\n if (newMode === this.mode) {\n return;\n }\n\n this.mode = newMode;\n logger.log("INFO", "MODE=" + newMode);\n\n if (this.mode == "MODE_POP-ON") {\n this.writeScreen = this.nonDisplayedMemory;\n } else {\n this.writeScreen = this.displayedMemory;\n this.writeScreen.reset();\n }\n\n if (this.mode !== "MODE_ROLL-UP") {\n this.displayedMemory.nrRollUpRows = null;\n this.nonDisplayedMemory.nrRollUpRows = null;\n }\n\n this.mode = newMode;\n },\n insertChars: function insertChars(chars) {\n for (var i = 0; i < chars.length; i++) {\n this.writeScreen.insertChar(chars[i]);\n }\n\n var screen = this.writeScreen === this.displayedMemory ? "DISP" : "NON_DISP";\n logger.log("INFO", screen + ": " + this.writeScreen.getDisplayText(true));\n\n if (this.mode === "MODE_PAINT-ON" || this.mode === "MODE_ROLL-UP") {\n logger.log("TEXT", "DISPLAYED: " + this.displayedMemory.getDisplayText(true));\n this.outputDataUpdate();\n }\n },\n cc_RCL: function cc_RCL() {\n // Resume Caption Loading (switch mode to Pop On)\n logger.log("INFO", "RCL - Resume Caption Loading");\n this.setMode("MODE_POP-ON");\n },\n cc_BS: function cc_BS() {\n // BackSpace\n logger.log("INFO", "BS - BackSpace");\n\n if (this.mode === "MODE_TEXT") {\n return;\n }\n\n this.writeScreen.backSpace();\n\n if (this.writeScreen === this.displayedMemory) {\n this.outputDataUpdate();\n }\n },\n cc_AOF: function cc_AOF() {\n // Reserved (formerly Alarm Off)\n return;\n },\n cc_AON: function cc_AON() {\n // Reserved (formerly Alarm On)\n return;\n },\n cc_DER: function cc_DER() {\n // Delete to End of Row\n logger.log("INFO", "DER- Delete to End of Row");\n this.writeScreen.clearToEndOfRow();\n this.outputDataUpdate();\n },\n cc_RU: function cc_RU(nrRows) {\n //Roll-Up Captions-2,3,or 4 Rows\n logger.log("INFO", "RU(" + nrRows + ") - Roll Up");\n this.writeScreen = this.displayedMemory;\n this.setMode("MODE_ROLL-UP");\n this.writeScreen.setRollUpRows(nrRows);\n },\n cc_FON: function cc_FON() {\n //Flash On\n logger.log("INFO", "FON - Flash On");\n this.writeScreen.setPen({\n flash: true\n });\n },\n cc_RDC: function cc_RDC() {\n // Resume Direct Captioning (switch mode to PaintOn)\n logger.log("INFO", "RDC - Resume Direct Captioning");\n this.setMode("MODE_PAINT-ON");\n },\n cc_TR: function cc_TR() {\n // Text Restart in text mode (not supported, however)\n logger.log("INFO", "TR");\n this.setMode("MODE_TEXT");\n },\n cc_RTD: function cc_RTD() {\n // Resume Text Display in Text mode (not supported, however)\n logger.log("INFO", "RTD");\n this.setMode("MODE_TEXT");\n },\n cc_EDM: function cc_EDM() {\n // Erase Displayed Memory\n logger.log("INFO", "EDM - Erase Displayed Memory");\n this.displayedMemory.reset();\n this.outputDataUpdate();\n },\n cc_CR: function cc_CR() {\n // Carriage Return\n logger.log("CR - Carriage Return");\n this.writeScreen.rollUp();\n this.outputDataUpdate();\n },\n cc_ENM: function cc_ENM() {\n //Erase Non-Displayed Memory\n logger.log("INFO", "ENM - Erase Non-displayed Memory");\n this.nonDisplayedMemory.reset();\n },\n cc_EOC: function cc_EOC() {\n //End of Caption (Flip Memories)\n logger.log("INFO", "EOC - End Of Caption");\n\n if (this.mode === "MODE_POP-ON") {\n var tmp = this.displayedMemory;\n this.displayedMemory = this.nonDisplayedMemory;\n this.nonDisplayedMemory = tmp;\n this.writeScreen = this.nonDisplayedMemory;\n logger.log("TEXT", "DISP: " + this.displayedMemory.getDisplayText());\n }\n\n this.outputDataUpdate();\n },\n cc_TO: function cc_TO(nrCols) {\n // Tab Offset 1,2, or 3 columns\n logger.log("INFO", "TO(" + nrCols + ") - Tab Offset");\n this.writeScreen.moveCursor(nrCols);\n },\n cc_MIDROW: function cc_MIDROW(secondByte) {\n // Parse MIDROW command\n var styles = {\n flash: false\n };\n styles.underline = secondByte % 2 === 1;\n styles.italics = secondByte >= 0x2e;\n\n if (!styles.italics) {\n var colorIndex = Math.floor(secondByte / 2) - 0x10;\n var colors = ["white", "green", "blue", "cyan", "red", "yellow", "magenta"];\n styles.foreground = colors[colorIndex];\n } else {\n styles.foreground = "white";\n }\n\n logger.log("INFO", "MIDROW: " + JSON.stringify(styles));\n this.writeScreen.setPen(styles);\n },\n outputDataUpdate: function outputDataUpdate() {\n var t = logger.time;\n\n if (t === null) {\n return;\n }\n\n if (this.outputFilter) {\n if (this.outputFilter.updateData) {\n this.outputFilter.updateData(t, this.displayedMemory);\n }\n\n if (this.cueStartTime === null && !this.displayedMemory.isEmpty()) {\n // Start of a new cue\n this.cueStartTime = t;\n } else {\n if (!this.displayedMemory.equals(this.lastOutputScreen)) {\n if (this.outputFilter.newCue) {\n this.outputFilter.newCue(this.cueStartTime, t, this.lastOutputScreen);\n }\n\n this.cueStartTime = this.displayedMemory.isEmpty() ? null : t;\n }\n }\n\n this.lastOutputScreen.copy(this.displayedMemory);\n }\n },\n cueSplitAtTime: function cueSplitAtTime(t) {\n if (this.outputFilter) {\n if (!this.displayedMemory.isEmpty()) {\n if (this.outputFilter.newCue) {\n this.outputFilter.newCue(this.cueStartTime, t, this.displayedMemory);\n }\n\n this.cueStartTime = t;\n }\n }\n }\n };\n /**\n * Parse CEA-608 data and send decoded data to out1 and out2.\n * @constructor\n * @param {Number} field CEA-608 field (1 or 2)\n * @param {CueHandler} out1 Output from channel1 newCue(startTime, endTime, captionScreen)\n * @param {CueHandler} out2 Output from channel2 newCue(startTime, endTime, captionScreen)\n */\n\n var Cea608Parser = function Cea608Parser(field, out1, out2) {\n this.field = field || 1;\n this.outputs = [out1, out2];\n this.channels = [new Cea608Channel(1, out1), new Cea608Channel(2, out2)];\n this.currChNr = -1; // Will be 1 or 2\n\n this.lastCmdA = null; // First byte of last command\n\n this.lastCmdB = null; // Second byte of last command\n\n this.bufferedData = [];\n this.startTime = null;\n this.lastTime = null;\n this.dataCounters = {\n \'padding\': 0,\n \'char\': 0,\n \'cmd\': 0,\n \'other\': 0\n };\n };\n\n Cea608Parser.prototype = {\n getHandler: function getHandler(index) {\n return this.channels[index].getHandler();\n },\n setHandler: function setHandler(index, newHandler) {\n this.channels[index].setHandler(newHandler);\n },\n\n /**\n * Add data for time t in forms of list of bytes (unsigned ints). The bytes are treated as pairs.\n */\n addData: function addData(t, byteList) {\n var cmdFound,\n a,\n b,\n charsFound = false;\n this.lastTime = t;\n logger.setTime(t);\n\n for (var i = 0; i < byteList.length; i += 2) {\n a = byteList[i] & 0x7f;\n b = byteList[i + 1] & 0x7f;\n\n if (a >= 0x10 && a <= 0x1f && a === this.lastCmdA && b === this.lastCmdB) {\n this.lastCmdA = null;\n this.lastCmdB = null;\n logger.log("DEBUG", "Repeated command (" + numArrayToHexArray([a, b]) + ") is dropped");\n continue; // Repeated commands are dropped (once)\n }\n\n if (a === 0 && b === 0) {\n this.dataCounters.padding += 2;\n continue;\n } else {\n logger.log("DATA", "[" + numArrayToHexArray([byteList[i], byteList[i + 1]]) + "] -> (" + numArrayToHexArray([a, b]) + ")");\n }\n\n cmdFound = this.parseCmd(a, b);\n\n if (!cmdFound) {\n cmdFound = this.parseMidrow(a, b);\n }\n\n if (!cmdFound) {\n cmdFound = this.parsePAC(a, b);\n }\n\n if (!cmdFound) {\n cmdFound = this.parseBackgroundAttributes(a, b);\n }\n\n if (!cmdFound) {\n charsFound = this.parseChars(a, b);\n\n if (charsFound) {\n if (this.currChNr && this.currChNr >= 0) {\n var channel = this.channels[this.currChNr - 1];\n channel.insertChars(charsFound);\n } else {\n logger.log("WARNING", "No channel found yet. TEXT-MODE?");\n }\n }\n }\n\n if (cmdFound) {\n this.dataCounters.cmd += 2;\n } else if (charsFound) {\n this.dataCounters["char"] += 2;\n } else {\n this.dataCounters.other += 2;\n logger.log("WARNING", "Couldn\'t parse cleaned data " + numArrayToHexArray([a, b]) + " orig: " + numArrayToHexArray([byteList[i], byteList[i + 1]]));\n }\n }\n },\n\n /**\n * Parse Command.\n * @returns {Boolean} Tells if a command was found\n */\n parseCmd: function parseCmd(a, b) {\n var chNr = null;\n var cond1 = (a === 0x14 || a === 0x15 || a === 0x1C || a === 0x1D) && 0x20 <= b && b <= 0x2F;\n var cond2 = (a === 0x17 || a === 0x1F) && 0x21 <= b && b <= 0x23;\n\n if (!(cond1 || cond2)) {\n return false;\n }\n\n if (a === 0x14 || a === 0x15 || a === 0x17) {\n chNr = 1;\n } else {\n chNr = 2; // (a === 0x1C || a === 0x1D || a=== 0x1f)\n }\n\n var channel = this.channels[chNr - 1];\n\n if (a === 0x14 || a === 0x15 || a === 0x1C || a === 0x1D) {\n if (b === 0x20) {\n channel.cc_RCL();\n } else if (b === 0x21) {\n channel.cc_BS();\n } else if (b === 0x22) {\n channel.cc_AOF();\n } else if (b === 0x23) {\n channel.cc_AON();\n } else if (b === 0x24) {\n channel.cc_DER();\n } else if (b === 0x25) {\n channel.cc_RU(2);\n } else if (b === 0x26) {\n channel.cc_RU(3);\n } else if (b === 0x27) {\n channel.cc_RU(4);\n } else if (b === 0x28) {\n channel.cc_FON();\n } else if (b === 0x29) {\n channel.cc_RDC();\n } else if (b === 0x2A) {\n channel.cc_TR();\n } else if (b === 0x2B) {\n channel.cc_RTD();\n } else if (b === 0x2C) {\n channel.cc_EDM();\n } else if (b === 0x2D) {\n channel.cc_CR();\n } else if (b === 0x2E) {\n channel.cc_ENM();\n } else if (b === 0x2F) {\n channel.cc_EOC();\n }\n } else {\n //a == 0x17 || a == 0x1F\n channel.cc_TO(b - 0x20);\n }\n\n this.lastCmdA = a;\n this.lastCmdB = b;\n this.currChNr = chNr;\n return true;\n },\n\n /**\n * Parse midrow styling command\n * @returns {Boolean}\n */\n parseMidrow: function parseMidrow(a, b) {\n var chNr = null;\n\n if ((a === 0x11 || a === 0x19) && 0x20 <= b && b <= 0x2f) {\n if (a === 0x11) {\n chNr = 1;\n } else {\n chNr = 2;\n }\n\n if (chNr !== this.currChNr) {\n logger.log("ERROR", "Mismatch channel in midrow parsing");\n return false;\n }\n\n var channel = this.channels[chNr - 1]; // cea608 spec says midrow codes should inject a space\n\n channel.insertChars([0x20]);\n channel.cc_MIDROW(b);\n logger.log("DEBUG", "MIDROW (" + numArrayToHexArray([a, b]) + ")");\n this.lastCmdA = a;\n this.lastCmdB = b;\n return true;\n }\n\n return false;\n },\n\n /**\n * Parse Preable Access Codes (Table 53).\n * @returns {Boolean} Tells if PAC found\n */\n parsePAC: function parsePAC(a, b) {\n var chNr = null;\n var row = null;\n var case1 = (0x11 <= a && a <= 0x17 || 0x19 <= a && a <= 0x1F) && 0x40 <= b && b <= 0x7F;\n var case2 = (a === 0x10 || a === 0x18) && 0x40 <= b && b <= 0x5F;\n\n if (!(case1 || case2)) {\n return false;\n }\n\n chNr = a <= 0x17 ? 1 : 2;\n\n if (0x40 <= b && b <= 0x5F) {\n row = chNr === 1 ? rowsLowCh1[a] : rowsLowCh2[a];\n } else {\n // 0x60 <= b <= 0x7F\n row = chNr === 1 ? rowsHighCh1[a] : rowsHighCh2[a];\n }\n\n var pacData = this.interpretPAC(row, b);\n var channel = this.channels[chNr - 1];\n channel.setPAC(pacData);\n this.lastCmdA = a;\n this.lastCmdB = b;\n this.currChNr = chNr;\n return true;\n },\n\n /**\n * Interpret the second byte of the pac, and return the information.\n * @returns {Object} pacData with style parameters.\n */\n interpretPAC: function interpretPAC(row, _byte3) {\n var pacIndex = _byte3;\n var pacData = {\n color: null,\n italics: false,\n indent: null,\n underline: false,\n row: row\n };\n\n if (_byte3 > 0x5F) {\n pacIndex = _byte3 - 0x60;\n } else {\n pacIndex = _byte3 - 0x40;\n }\n\n pacData.underline = (pacIndex & 1) === 1;\n\n if (pacIndex <= 0xd) {\n pacData.color = [\'white\', \'green\', \'blue\', \'cyan\', \'red\', \'yellow\', \'magenta\', \'white\'][Math.floor(pacIndex / 2)];\n } else if (pacIndex <= 0xf) {\n pacData.italics = true;\n pacData.color = \'white\';\n } else {\n pacData.indent = Math.floor((pacIndex - 0x10) / 2) * 4;\n }\n\n return pacData; // Note that row has zero offset. The spec uses 1.\n },\n\n /**\n * Parse characters.\n * @returns An array with 1 to 2 codes corresponding to chars, if found. null otherwise.\n */\n parseChars: function parseChars(a, b) {\n var channelNr = null,\n charCodes = null,\n charCode1 = null;\n\n if (a >= 0x19) {\n channelNr = 2;\n charCode1 = a - 8;\n } else {\n channelNr = 1;\n charCode1 = a;\n }\n\n if (0x11 <= charCode1 && charCode1 <= 0x13) {\n // Special character\n var oneCode = b;\n\n if (charCode1 === 0x11) {\n oneCode = b + 0x50;\n } else if (charCode1 === 0x12) {\n oneCode = b + 0x70;\n } else {\n oneCode = b + 0x90;\n }\n\n logger.log("INFO", "Special char \'" + getCharForByte(oneCode) + "\' in channel " + channelNr);\n charCodes = [oneCode];\n this.lastCmdA = a;\n this.lastCmdB = b;\n } else if (0x20 <= a && a <= 0x7f) {\n charCodes = b === 0 ? [a] : [a, b];\n this.lastCmdA = null;\n this.lastCmdB = null;\n }\n\n if (charCodes) {\n var hexCodes = numArrayToHexArray(charCodes);\n logger.log("DEBUG", "Char codes = " + hexCodes.join(","));\n }\n\n return charCodes;\n },\n\n /**\n * Parse extended background attributes as well as new foreground color black.\n * @returns{Boolean} Tells if background attributes are found\n */\n parseBackgroundAttributes: function parseBackgroundAttributes(a, b) {\n var bkgData, index, chNr, channel;\n var case1 = (a === 0x10 || a === 0x18) && 0x20 <= b && b <= 0x2f;\n var case2 = (a === 0x17 || a === 0x1f) && 0x2d <= b && b <= 0x2f;\n\n if (!(case1 || case2)) {\n return false;\n }\n\n bkgData = {};\n\n if (a === 0x10 || a === 0x18) {\n index = Math.floor((b - 0x20) / 2);\n bkgData.background = backgroundColors[index];\n\n if (b % 2 === 1) {\n bkgData.background = bkgData.background + "_semi";\n }\n } else if (b === 0x2d) {\n bkgData.background = "transparent";\n } else {\n bkgData.foreground = "black";\n\n if (b === 0x2f) {\n bkgData.underline = true;\n }\n }\n\n chNr = a < 0x18 ? 1 : 2;\n channel = this.channels[chNr - 1];\n channel.setBkgData(bkgData);\n this.lastCmdA = a;\n this.lastCmdB = b;\n return true;\n },\n\n /**\n * Reset state of parser and its channels.\n */\n reset: function reset() {\n for (var i = 0; i < this.channels.length; i++) {\n if (this.channels[i]) {\n this.channels[i].reset();\n }\n }\n\n this.lastCmdA = null;\n this.lastCmdB = null;\n },\n\n /**\n * Trigger the generation of a cue, and the start of a new one if displayScreens are not empty.\n */\n cueSplitAtTime: function cueSplitAtTime(t) {\n for (var i = 0; i < this.channels.length; i++) {\n if (this.channels[i]) {\n this.channels[i].cueSplitAtTime(t);\n }\n }\n }\n };\n /**\n * Find ranges corresponding to SEA CEA-608 NALUS in sizeprepended NALU array.\n * @param {raw} dataView of binary data\n * @param {startPos} start position in raw\n * @param {size} total size of data in raw to consider\n * @returns \n */\n\n var findCea608Nalus = function findCea608Nalus(raw, startPos, size) {\n var nalSize = 0,\n cursor = startPos,\n nalType = 0,\n cea608NaluRanges = [],\n // Check SEI data according to ANSI-SCTE 128\n isCEA608SEI = function isCEA608SEI(payloadType, payloadSize, raw, pos) {\n if (payloadType !== 4 || payloadSize < 8) {\n return null;\n }\n\n var countryCode = raw.getUint8(pos);\n var providerCode = raw.getUint16(pos + 1);\n var userIdentifier = raw.getUint32(pos + 3);\n var userDataTypeCode = raw.getUint8(pos + 7);\n return countryCode == 0xB5 && providerCode == 0x31 && userIdentifier == 0x47413934 && userDataTypeCode == 0x3;\n };\n\n while (cursor < startPos + size) {\n nalSize = raw.getUint32(cursor);\n nalType = raw.getUint8(cursor + 4) & 0x1F; //console.log(time + " NAL " + nalType);\n\n if (nalType === 6) {\n // SEI NAL Unit. The NAL header is the first byte\n //console.log("SEI NALU of size " + nalSize + " at time " + time);\n var pos = cursor + 5;\n var payloadType = -1;\n\n while (pos < cursor + 4 + nalSize - 1) {\n // The last byte should be rbsp_trailing_bits\n payloadType = 0;\n var b = 0xFF;\n\n while (b === 0xFF) {\n b = raw.getUint8(pos);\n payloadType += b;\n pos++;\n }\n\n var payloadSize = 0;\n b = 0xFF;\n\n while (b === 0xFF) {\n b = raw.getUint8(pos);\n payloadSize += b;\n pos++;\n }\n\n if (isCEA608SEI(payloadType, payloadSize, raw, pos)) {\n //console.log("CEA608 SEI " + time + " " + payloadSize);\n cea608NaluRanges.push([pos, payloadSize]);\n }\n\n pos += payloadSize;\n }\n }\n\n cursor += nalSize + 4;\n }\n\n return cea608NaluRanges;\n };\n\n var extractCea608DataFromRange = function extractCea608DataFromRange(raw, cea608Range) {\n var pos = cea608Range[0];\n var fieldData = [[], []];\n pos += 8; // Skip the identifier up to userDataTypeCode\n\n var ccCount = raw.getUint8(pos) & 0x1f;\n pos += 2; // Advance 1 and skip reserved byte\n\n for (var i = 0; i < ccCount; i++) {\n var _byte4 = raw.getUint8(pos);\n\n var ccValid = _byte4 & 0x4;\n var ccType = _byte4 & 0x3;\n pos++;\n var ccData1 = raw.getUint8(pos); // Keep parity bit\n\n pos++;\n var ccData2 = raw.getUint8(pos); // Keep parity bit\n\n pos++;\n\n if (ccValid && (ccData1 & 0x7f) + (ccData2 & 0x7f) !== 0) {\n //Check validity and non-empty data\n if (ccType === 0) {\n fieldData[0].push(ccData1);\n fieldData[0].push(ccData2);\n } else if (ccType === 1) {\n fieldData[1].push(ccData1);\n fieldData[1].push(ccData2);\n }\n }\n }\n\n return fieldData;\n };\n\n exports.logger = logger;\n exports.PenState = PenState;\n exports.CaptionScreen = CaptionScreen;\n exports.Cea608Parser = Cea608Parser;\n exports.findCea608Nalus = findCea608Nalus;\n exports.extractCea608DataFromRange = extractCea608DataFromRange;\n})( exports);\n\n/***/ }),\n\n/***/ "./externals/xml2json.js":\n/*!*******************************!*\\\n !*** ./externals/xml2json.js ***!\n \\*******************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_49779__) {\n__nested_webpack_require_49779__.r(__nested_webpack_exports__);\n/*\n Copyright 2011-2013 Abdulla Abdurakhmanov\n Original sources are available at https://code.google.com/p/x2js/\n\n Licensed under the Apache License, Version 2.0 (the "License");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n */\n\n/*\n Further modified for dashjs to:\n - keep track of children nodes in order in attribute __children.\n - add type conversion matchers\n - re-add ignoreRoot\n - allow zero-length attributePrefix\n - don\'t add white-space text nodes\n - remove explicit RequireJS support\n*/\nfunction X2JS(config) {\n\n var VERSION = "1.2.0";\n config = config || {};\n initConfigDefaults();\n\n function initConfigDefaults() {\n if (config.escapeMode === undefined) {\n config.escapeMode = true;\n }\n\n if (config.attributePrefix === undefined) {\n config.attributePrefix = "_";\n }\n\n config.arrayAccessForm = config.arrayAccessForm || "none";\n config.emptyNodeForm = config.emptyNodeForm || "text";\n\n if (config.enableToStringFunc === undefined) {\n config.enableToStringFunc = true;\n }\n\n config.arrayAccessFormPaths = config.arrayAccessFormPaths || [];\n\n if (config.skipEmptyTextNodesForObj === undefined) {\n config.skipEmptyTextNodesForObj = true;\n }\n\n if (config.stripWhitespaces === undefined) {\n config.stripWhitespaces = true;\n }\n\n config.datetimeAccessFormPaths = config.datetimeAccessFormPaths || [];\n\n if (config.useDoubleQuotes === undefined) {\n config.useDoubleQuotes = false;\n }\n\n config.xmlElementsFilter = config.xmlElementsFilter || [];\n config.jsonPropertiesFilter = config.jsonPropertiesFilter || [];\n\n if (config.keepCData === undefined) {\n config.keepCData = false;\n }\n\n if (config.ignoreRoot === undefined) {\n config.ignoreRoot = false;\n }\n }\n\n var DOMNodeTypes = {\n ELEMENT_NODE: 1,\n TEXT_NODE: 3,\n CDATA_SECTION_NODE: 4,\n COMMENT_NODE: 8,\n DOCUMENT_NODE: 9\n };\n\n function getNodeLocalName(node) {\n var nodeLocalName = node.localName;\n if (nodeLocalName == null) // Yeah, this is IE!!\n nodeLocalName = node.baseName;\n if (nodeLocalName == null || nodeLocalName == "") // =="" is IE too\n nodeLocalName = node.nodeName;\n return nodeLocalName;\n }\n\n function getNodePrefix(node) {\n return node.prefix;\n }\n\n function escapeXmlChars(str) {\n if (typeof str == "string") return str.replace(/&/g, \'&\').replace(/</g, \'<\').replace(/>/g, \'>\').replace(/"/g, \'"\').replace(/\'/g, \''\');else return str;\n }\n\n function checkInStdFiltersArrayForm(stdFiltersArrayForm, obj, name, path) {\n var idx = 0;\n\n for (; idx < stdFiltersArrayForm.length; idx++) {\n var filterPath = stdFiltersArrayForm[idx];\n\n if (typeof filterPath === "string") {\n if (filterPath == path) break;\n } else if (filterPath instanceof RegExp) {\n if (filterPath.test(path)) break;\n } else if (typeof filterPath === "function") {\n if (filterPath(obj, name, path)) break;\n }\n }\n\n return idx != stdFiltersArrayForm.length;\n }\n\n function toArrayAccessForm(obj, childName, path) {\n switch (config.arrayAccessForm) {\n case "property":\n if (!(obj[childName] instanceof Array)) obj[childName + "_asArray"] = [obj[childName]];else obj[childName + "_asArray"] = obj[childName];\n break;\n\n /*case "none":\n break;*/\n }\n\n if (!(obj[childName] instanceof Array) && config.arrayAccessFormPaths.length > 0) {\n if (checkInStdFiltersArrayForm(config.arrayAccessFormPaths, obj, childName, path)) {\n obj[childName] = [obj[childName]];\n }\n }\n }\n\n function fromXmlDateTime(prop) {\n // Implementation based up on http://stackoverflow.com/questions/8178598/xml-datetime-to-javascript-date-object\n // Improved to support full spec and optional parts\n var bits = prop.split(/[-T:+Z]/g);\n var d = new Date(bits[0], bits[1] - 1, bits[2]);\n var secondBits = bits[5].split("\\.");\n d.setHours(bits[3], bits[4], secondBits[0]);\n if (secondBits.length > 1) d.setMilliseconds(secondBits[1]); // Get supplied time zone offset in minutes\n\n if (bits[6] && bits[7]) {\n var offsetMinutes = bits[6] * 60 + Number(bits[7]);\n var sign = /\\d\\d-\\d\\d:\\d\\d$/.test(prop) ? \'-\' : \'+\'; // Apply the sign\n\n offsetMinutes = 0 + (sign == \'-\' ? -1 * offsetMinutes : offsetMinutes); // Apply offset and local timezone\n\n d.setMinutes(d.getMinutes() - offsetMinutes - d.getTimezoneOffset());\n } else if (prop.indexOf("Z", prop.length - 1) !== -1) {\n d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds()));\n } // d is now a local time equivalent to the supplied time\n\n\n return d;\n }\n\n function checkFromXmlDateTimePaths(value, childName, fullPath) {\n if (config.datetimeAccessFormPaths.length > 0) {\n var path = fullPath.split("\\.#")[0];\n\n if (checkInStdFiltersArrayForm(config.datetimeAccessFormPaths, value, childName, path)) {\n return fromXmlDateTime(value);\n } else return value;\n } else return value;\n }\n\n function checkXmlElementsFilter(obj, childType, childName, childPath) {\n if (childType == DOMNodeTypes.ELEMENT_NODE && config.xmlElementsFilter.length > 0) {\n return checkInStdFiltersArrayForm(config.xmlElementsFilter, obj, childName, childPath);\n } else return true;\n }\n\n function parseDOMChildren(node, path) {\n if (node.nodeType == DOMNodeTypes.DOCUMENT_NODE) {\n var result = new Object();\n var nodeChildren = node.childNodes; // Alternative for firstElementChild which is not supported in some environments\n\n for (var cidx = 0; cidx < nodeChildren.length; cidx++) {\n var child = nodeChildren[cidx];\n\n if (child.nodeType == DOMNodeTypes.ELEMENT_NODE) {\n if (config.ignoreRoot) {\n result = parseDOMChildren(child);\n } else {\n result = {};\n var childName = getNodeLocalName(child);\n result[childName] = parseDOMChildren(child);\n }\n }\n }\n\n return result;\n } else if (node.nodeType == DOMNodeTypes.ELEMENT_NODE) {\n var result = new Object();\n result.__cnt = 0;\n var children = [];\n var nodeChildren = node.childNodes; // Children nodes\n\n for (var cidx = 0; cidx < nodeChildren.length; cidx++) {\n var child = nodeChildren[cidx];\n var childName = getNodeLocalName(child);\n\n if (child.nodeType != DOMNodeTypes.COMMENT_NODE) {\n var childPath = path + "." + childName;\n\n if (checkXmlElementsFilter(result, child.nodeType, childName, childPath)) {\n result.__cnt++;\n\n if (result[childName] == null) {\n var c = parseDOMChildren(child, childPath);\n\n if (childName != "#text" || /[^\\s]/.test(c)) {\n var o = {};\n o[childName] = c;\n children.push(o);\n }\n\n result[childName] = c;\n toArrayAccessForm(result, childName, childPath);\n } else {\n if (result[childName] != null) {\n if (!(result[childName] instanceof Array)) {\n result[childName] = [result[childName]];\n toArrayAccessForm(result, childName, childPath);\n }\n }\n\n var c = parseDOMChildren(child, childPath);\n\n if (childName != "#text" || /[^\\s]/.test(c)) {\n // Don\'t add white-space text nodes\n var o = {};\n o[childName] = c;\n children.push(o);\n }\n\n result[childName][result[childName].length] = c;\n }\n }\n }\n }\n\n result.__children = children; // Attributes\n\n var nodeLocalName = getNodeLocalName(node);\n\n for (var aidx = 0; aidx < node.attributes.length; aidx++) {\n var attr = node.attributes[aidx];\n result.__cnt++;\n var value2 = attr.value;\n\n for (var m = 0, ml = config.matchers.length; m < ml; m++) {\n var matchobj = config.matchers[m];\n if (matchobj.test(attr, nodeLocalName)) value2 = matchobj.converter(attr.value);\n }\n\n result[config.attributePrefix + attr.name] = value2;\n } // Node namespace prefix\n\n\n var nodePrefix = getNodePrefix(node);\n\n if (nodePrefix != null && nodePrefix != "") {\n result.__cnt++;\n result.__prefix = nodePrefix;\n }\n\n if (result["#text"] != null) {\n result.__text = result["#text"];\n\n if (result.__text instanceof Array) {\n result.__text = result.__text.join("\\n");\n } //if(config.escapeMode)\n //\tresult.__text = unescapeXmlChars(result.__text);\n\n\n if (config.stripWhitespaces) result.__text = result.__text.trim();\n delete result["#text"];\n if (config.arrayAccessForm == "property") delete result["#text_asArray"];\n result.__text = checkFromXmlDateTimePaths(result.__text, childName, path + "." + childName);\n }\n\n if (result["#cdata-section"] != null) {\n result.__cdata = result["#cdata-section"];\n delete result["#cdata-section"];\n if (config.arrayAccessForm == "property") delete result["#cdata-section_asArray"];\n }\n\n if (result.__cnt == 0 && config.emptyNodeForm == "text") {\n result = \'\';\n } else if (result.__cnt == 1 && result.__text != null) {\n result = result.__text;\n } else if (result.__cnt == 1 && result.__cdata != null && !config.keepCData) {\n result = result.__cdata;\n } else if (result.__cnt > 1 && result.__text != null && config.skipEmptyTextNodesForObj) {\n if (config.stripWhitespaces && result.__text == "" || result.__text.trim() == "") {\n delete result.__text;\n }\n }\n\n delete result.__cnt;\n\n if (config.enableToStringFunc && (result.__text != null || result.__cdata != null)) {\n result.toString = function () {\n return (this.__text != null ? this.__text : \'\') + (this.__cdata != null ? this.__cdata : \'\');\n };\n }\n\n return result;\n } else if (node.nodeType == DOMNodeTypes.TEXT_NODE || node.nodeType == DOMNodeTypes.CDATA_SECTION_NODE) {\n return node.nodeValue;\n }\n }\n\n function startTag(jsonObj, element, attrList, closed) {\n var resultStr = "<" + (jsonObj != null && jsonObj.__prefix != null ? jsonObj.__prefix + ":" : "") + element;\n\n if (attrList != null) {\n for (var aidx = 0; aidx < attrList.length; aidx++) {\n var attrName = attrList[aidx];\n var attrVal = jsonObj[attrName];\n if (config.escapeMode) attrVal = escapeXmlChars(attrVal);\n resultStr += " " + attrName.substr(config.attributePrefix.length) + "=";\n if (config.useDoubleQuotes) resultStr += \'"\' + attrVal + \'"\';else resultStr += "\'" + attrVal + "\'";\n }\n }\n\n if (!closed) resultStr += ">";else resultStr += "/>";\n return resultStr;\n }\n\n function endTag(jsonObj, elementName) {\n return "</" + (jsonObj.__prefix != null ? jsonObj.__prefix + ":" : "") + elementName + ">";\n }\n\n function endsWith(str, suffix) {\n return str.indexOf(suffix, str.length - suffix.length) !== -1;\n }\n\n function jsonXmlSpecialElem(jsonObj, jsonObjField) {\n if (config.arrayAccessForm == "property" && endsWith(jsonObjField.toString(), "_asArray") || jsonObjField.toString().indexOf(config.attributePrefix) == 0 || jsonObjField.toString().indexOf("__") == 0 || jsonObj[jsonObjField] instanceof Function) return true;else return false;\n }\n\n function jsonXmlElemCount(jsonObj) {\n var elementsCnt = 0;\n\n if (jsonObj instanceof Object) {\n for (var it in jsonObj) {\n if (jsonXmlSpecialElem(jsonObj, it)) continue;\n elementsCnt++;\n }\n }\n\n return elementsCnt;\n }\n\n function checkJsonObjPropertiesFilter(jsonObj, propertyName, jsonObjPath) {\n return config.jsonPropertiesFilter.length == 0 || jsonObjPath == "" || checkInStdFiltersArrayForm(config.jsonPropertiesFilter, jsonObj, propertyName, jsonObjPath);\n }\n\n function parseJSONAttributes(jsonObj) {\n var attrList = [];\n\n if (jsonObj instanceof Object) {\n for (var ait in jsonObj) {\n if (ait.toString().indexOf("__") == -1 && ait.toString().indexOf(config.attributePrefix) == 0) {\n attrList.push(ait);\n }\n }\n }\n\n return attrList;\n }\n\n function parseJSONTextAttrs(jsonTxtObj) {\n var result = "";\n\n if (jsonTxtObj.__cdata != null) {\n result += "<![CDATA[" + jsonTxtObj.__cdata + "]]>";\n }\n\n if (jsonTxtObj.__text != null) {\n if (config.escapeMode) result += escapeXmlChars(jsonTxtObj.__text);else result += jsonTxtObj.__text;\n }\n\n return result;\n }\n\n function parseJSONTextObject(jsonTxtObj) {\n var result = "";\n\n if (jsonTxtObj instanceof Object) {\n result += parseJSONTextAttrs(jsonTxtObj);\n } else if (jsonTxtObj != null) {\n if (config.escapeMode) result += escapeXmlChars(jsonTxtObj);else result += jsonTxtObj;\n }\n\n return result;\n }\n\n function getJsonPropertyPath(jsonObjPath, jsonPropName) {\n if (jsonObjPath === "") {\n return jsonPropName;\n } else return jsonObjPath + "." + jsonPropName;\n }\n\n function parseJSONArray(jsonArrRoot, jsonArrObj, attrList, jsonObjPath) {\n var result = "";\n\n if (jsonArrRoot.length == 0) {\n result += startTag(jsonArrRoot, jsonArrObj, attrList, true);\n } else {\n for (var arIdx = 0; arIdx < jsonArrRoot.length; arIdx++) {\n result += startTag(jsonArrRoot[arIdx], jsonArrObj, parseJSONAttributes(jsonArrRoot[arIdx]), false);\n result += parseJSONObject(jsonArrRoot[arIdx], getJsonPropertyPath(jsonObjPath, jsonArrObj));\n result += endTag(jsonArrRoot[arIdx], jsonArrObj);\n }\n }\n\n return result;\n }\n\n function parseJSONObject(jsonObj, jsonObjPath) {\n var result = "";\n var elementsCnt = jsonXmlElemCount(jsonObj);\n\n if (elementsCnt > 0) {\n for (var it in jsonObj) {\n if (jsonXmlSpecialElem(jsonObj, it) || jsonObjPath != "" && !checkJsonObjPropertiesFilter(jsonObj, it, getJsonPropertyPath(jsonObjPath, it))) continue;\n var subObj = jsonObj[it];\n var attrList = parseJSONAttributes(subObj);\n\n if (subObj == null || subObj == undefined) {\n result += startTag(subObj, it, attrList, true);\n } else if (subObj instanceof Object) {\n if (subObj instanceof Array) {\n result += parseJSONArray(subObj, it, attrList, jsonObjPath);\n } else if (subObj instanceof Date) {\n result += startTag(subObj, it, attrList, false);\n result += subObj.toISOString();\n result += endTag(subObj, it);\n } else {\n var subObjElementsCnt = jsonXmlElemCount(subObj);\n\n if (subObjElementsCnt > 0 || subObj.__text != null || subObj.__cdata != null) {\n result += startTag(subObj, it, attrList, false);\n result += parseJSONObject(subObj, getJsonPropertyPath(jsonObjPath, it));\n result += endTag(subObj, it);\n } else {\n result += startTag(subObj, it, attrList, true);\n }\n }\n } else {\n result += startTag(subObj, it, attrList, false);\n result += parseJSONTextObject(subObj);\n result += endTag(subObj, it);\n }\n }\n }\n\n result += parseJSONTextObject(jsonObj);\n return result;\n }\n\n this.parseXmlString = function (xmlDocStr) {\n var isIEParser = window.ActiveXObject || "ActiveXObject" in window;\n\n if (xmlDocStr === undefined) {\n return null;\n }\n\n var xmlDoc;\n\n if (window.DOMParser) {\n var parser = new window.DOMParser();\n\n try {\n xmlDoc = parser.parseFromString(xmlDocStr, "text/xml");\n\n if (xmlDoc.getElementsByTagNameNS("*", "parsererror").length > 0) {\n xmlDoc = null;\n }\n } catch (err) {\n xmlDoc = null;\n }\n } else {\n // IE :(\n if (xmlDocStr.indexOf("<?") == 0) {\n xmlDocStr = xmlDocStr.substr(xmlDocStr.indexOf("?>") + 2);\n }\n\n xmlDoc = new ActiveXObject("Microsoft.XMLDOM");\n xmlDoc.async = "false";\n xmlDoc.loadXML(xmlDocStr);\n }\n\n return xmlDoc;\n };\n\n this.asArray = function (prop) {\n if (prop === undefined || prop == null) return [];else if (prop instanceof Array) return prop;else return [prop];\n };\n\n this.toXmlDateTime = function (dt) {\n if (dt instanceof Date) return dt.toISOString();else if (typeof dt === \'number\') return new Date(dt).toISOString();else return null;\n };\n\n this.asDateTime = function (prop) {\n if (typeof prop == "string") {\n return fromXmlDateTime(prop);\n } else return prop;\n };\n\n this.xml2json = function (xmlDoc) {\n return parseDOMChildren(xmlDoc);\n };\n\n this.xml_str2json = function (xmlDocStr) {\n var xmlDoc = this.parseXmlString(xmlDocStr);\n if (xmlDoc != null) return this.xml2json(xmlDoc);else return null;\n };\n\n this.json2xml_str = function (jsonObj) {\n return parseJSONObject(jsonObj, "");\n };\n\n this.json2xml = function (jsonObj) {\n var xmlDocStr = this.json2xml_str(jsonObj);\n return this.parseXmlString(xmlDocStr);\n };\n\n this.getVersion = function () {\n return VERSION;\n };\n}\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (X2JS);\n\n/***/ }),\n\n/***/ "./index.js":\n/*!******************!*\\\n !*** ./index.js ***!\n \\******************/\n/*! exports provided: default, MediaPlayer, Protection, MetricsReporting, MediaPlayerFactory, Debug, supportsMediaSource */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_67874__) {\n__nested_webpack_require_67874__.r(__nested_webpack_exports__);\n/* harmony import */ var _index_mediaplayerOnly__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_67874__(/*! ./index_mediaplayerOnly */ "./index_mediaplayerOnly.js");\n/* harmony reexport (safe) */ __nested_webpack_require_67874__.d(__nested_webpack_exports__, "MediaPlayer", function() { return _index_mediaplayerOnly__WEBPACK_IMPORTED_MODULE_0__["MediaPlayer"]; });\n\n/* harmony import */ var _src_streaming_utils_Capabilities__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_67874__(/*! ./src/streaming/utils/Capabilities */ "./src/streaming/utils/Capabilities.js");\n/* harmony reexport (safe) */ __nested_webpack_require_67874__.d(__nested_webpack_exports__, "supportsMediaSource", function() { return _src_streaming_utils_Capabilities__WEBPACK_IMPORTED_MODULE_1__["supportsMediaSource"]; });\n\n/* harmony import */ var _src_streaming_metrics_MetricsReporting__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_67874__(/*! ./src/streaming/metrics/MetricsReporting */ "./src/streaming/metrics/MetricsReporting.js");\n/* harmony reexport (safe) */ __nested_webpack_require_67874__.d(__nested_webpack_exports__, "MetricsReporting", function() { return _src_streaming_metrics_MetricsReporting__WEBPACK_IMPORTED_MODULE_2__["default"]; });\n\n/* harmony import */ var _src_streaming_protection_Protection__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_67874__(/*! ./src/streaming/protection/Protection */ "./src/streaming/protection/Protection.js");\n/* harmony reexport (safe) */ __nested_webpack_require_67874__.d(__nested_webpack_exports__, "Protection", function() { return _src_streaming_protection_Protection__WEBPACK_IMPORTED_MODULE_3__["default"]; });\n\n/* harmony import */ var _src_streaming_MediaPlayerFactory__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_67874__(/*! ./src/streaming/MediaPlayerFactory */ "./src/streaming/MediaPlayerFactory.js");\n/* harmony reexport (safe) */ __nested_webpack_require_67874__.d(__nested_webpack_exports__, "MediaPlayerFactory", function() { return _src_streaming_MediaPlayerFactory__WEBPACK_IMPORTED_MODULE_4__["default"]; });\n\n/* harmony import */ var _src_core_Debug__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_67874__(/*! ./src/core/Debug */ "./src/core/Debug.js");\n/* harmony reexport (safe) */ __nested_webpack_require_67874__.d(__nested_webpack_exports__, "Debug", function() { return _src_core_Debug__WEBPACK_IMPORTED_MODULE_5__["default"]; });\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\ndashjs.Protection = _src_streaming_protection_Protection__WEBPACK_IMPORTED_MODULE_3__["default"];\ndashjs.MetricsReporting = _src_streaming_metrics_MetricsReporting__WEBPACK_IMPORTED_MODULE_2__["default"];\ndashjs.MediaPlayerFactory = _src_streaming_MediaPlayerFactory__WEBPACK_IMPORTED_MODULE_4__["default"];\ndashjs.Debug = _src_core_Debug__WEBPACK_IMPORTED_MODULE_5__["default"];\ndashjs.supportsMediaSource = _src_streaming_utils_Capabilities__WEBPACK_IMPORTED_MODULE_1__["supportsMediaSource"];\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs);\n\n\n/***/ }),\n\n/***/ "./index_mediaplayerOnly.js":\n/*!**********************************!*\\\n !*** ./index_mediaplayerOnly.js ***!\n \\**********************************/\n/*! exports provided: default, MediaPlayer, FactoryMaker, Debug */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_72870__) {\n__nested_webpack_require_72870__.r(__nested_webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var _src_streaming_MediaPlayer__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_72870__(/*! ./src/streaming/MediaPlayer */ "./src/streaming/MediaPlayer.js");\n/* harmony reexport (safe) */ __nested_webpack_require_72870__.d(__nested_webpack_exports__, "MediaPlayer", function() { return _src_streaming_MediaPlayer__WEBPACK_IMPORTED_MODULE_0__["default"]; });\n\n/* harmony import */ var _src_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_72870__(/*! ./src/core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony reexport (safe) */ __nested_webpack_require_72870__.d(__nested_webpack_exports__, "FactoryMaker", function() { return _src_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"]; });\n\n/* harmony import */ var _src_core_Debug__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_72870__(/*! ./src/core/Debug */ "./src/core/Debug.js");\n/* harmony reexport (safe) */ __nested_webpack_require_72870__.d(__nested_webpack_exports__, "Debug", function() { return _src_core_Debug__WEBPACK_IMPORTED_MODULE_2__["default"]; });\n\n/* harmony import */ var _src_core_Version__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_72870__(/*! ./src/core/Version */ "./src/core/Version.js");\n/* harmony import */ var es6_promise_auto__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_72870__(/*! es6-promise/auto */ "./node_modules/es6-promise/auto.js");\n/* harmony import */ var es6_promise_auto__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__nested_webpack_require_72870__.n(es6_promise_auto__WEBPACK_IMPORTED_MODULE_4__);\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n // Shove both of these into the global scope\n\nvar context = typeof window !== \'undefined\' && window || global;\nvar dashjs = context.dashjs;\n\nif (!dashjs) {\n dashjs = context.dashjs = {};\n}\n\ndashjs.MediaPlayer = _src_streaming_MediaPlayer__WEBPACK_IMPORTED_MODULE_0__["default"];\ndashjs.FactoryMaker = _src_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"];\ndashjs.Debug = _src_core_Debug__WEBPACK_IMPORTED_MODULE_2__["default"];\ndashjs.Version = Object(_src_core_Version__WEBPACK_IMPORTED_MODULE_3__["getVersionString"])();\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs);\n\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_72870__(/*! ./node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")));\n\n/***/ }),\n\n/***/ "./node_modules/base64-js/index.js":\n/*!*****************************************!*\\\n !*** ./node_modules/base64-js/index.js ***!\n \\*****************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\nexports.byteLength = byteLength;\nexports.toByteArray = toByteArray;\nexports.fromByteArray = fromByteArray;\n\nvar lookup = [];\nvar revLookup = [];\nvar Arr = typeof Uint8Array !== \'undefined\' ? Uint8Array : Array;\n\nvar code = \'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\';\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i];\n revLookup[code.charCodeAt(i)] = i;\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup[\'-\'.charCodeAt(0)] = 62;\nrevLookup[\'_\'.charCodeAt(0)] = 63;\n\nfunction getLens (b64) {\n var len = b64.length;\n\n if (len % 4 > 0) {\n throw new Error(\'Invalid string. Length must be a multiple of 4\')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf(\'=\');\n if (validLen === -1) validLen = len;\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4);\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp;\n var lens = getLens(b64);\n var validLen = lens[0];\n var placeHoldersLen = lens[1];\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));\n\n var curByte = 0;\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen;\n\n for (var i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)];\n arr[curByte++] = (tmp >> 16) & 0xFF;\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4);\n arr[curByte++] = tmp & 0xFF;\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2);\n arr[curByte++] = (tmp >> 8) & 0xFF;\n arr[curByte++] = tmp & 0xFF;\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp;\n var output = [];\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF);\n output.push(tripletToBase64(tmp));\n }\n return output.join(\'\')\n}\n\nfunction fromByteArray (uint8) {\n var tmp;\n var len = uint8.length;\n var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes\n var parts = [];\n var maxChunkLength = 16383; // must be multiple of 3\n\n // go through the array every three bytes, we\'ll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(\n uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)\n ));\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1];\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n \'==\'\n );\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1];\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n \'=\'\n );\n }\n\n return parts.join(\'\')\n}\n\n\n/***/ }),\n\n/***/ "./node_modules/codem-isoboxer/dist/iso_boxer.js":\n/*!*******************************************************!*\\\n !*** ./node_modules/codem-isoboxer/dist/iso_boxer.js ***!\n \\*******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n/*! codem-isoboxer v0.3.6 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */\nvar ISOBoxer = {};\n\nISOBoxer.parseBuffer = function(arrayBuffer) {\n return new ISOFile(arrayBuffer).parse();\n};\n\nISOBoxer.addBoxProcessor = function(type, parser) {\n if (typeof type !== \'string\' || typeof parser !== \'function\') {\n return;\n }\n ISOBox.prototype._boxProcessors[type] = parser;\n};\n\nISOBoxer.createFile = function() {\n return new ISOFile();\n};\n\n// See ISOBoxer.append() for \'pos\' parameter syntax\nISOBoxer.createBox = function(type, parent, pos) {\n var newBox = ISOBox.create(type);\n if (parent) {\n parent.append(newBox, pos);\n }\n return newBox;\n};\n\n// See ISOBoxer.append() for \'pos\' parameter syntax\nISOBoxer.createFullBox = function(type, parent, pos) {\n var newBox = ISOBoxer.createBox(type, parent, pos);\n newBox.version = 0;\n newBox.flags = 0;\n return newBox;\n};\n\nISOBoxer.Utils = {};\nISOBoxer.Utils.dataViewToString = function(dataView, encoding) {\n var impliedEncoding = encoding || \'utf-8\';\n if (typeof TextDecoder !== \'undefined\') {\n return new TextDecoder(impliedEncoding).decode(dataView);\n }\n var a = [];\n var i = 0;\n\n if (impliedEncoding === \'utf-8\') {\n /* The following algorithm is essentially a rewrite of the UTF8.decode at\n http://bannister.us/weblog/2007/simple-base64-encodedecode-javascript/\n */\n\n while (i < dataView.byteLength) {\n var c = dataView.getUint8(i++);\n if (c < 0x80) ; else if (c < 0xe0) {\n // 2-byte character (11 bits)\n c = (c & 0x1f) << 6;\n c |= (dataView.getUint8(i++) & 0x3f);\n } else if (c < 0xf0) {\n // 3-byte character (16 bits)\n c = (c & 0xf) << 12;\n c |= (dataView.getUint8(i++) & 0x3f) << 6;\n c |= (dataView.getUint8(i++) & 0x3f);\n } else {\n // 4-byte character (21 bits)\n c = (c & 0x7) << 18;\n c |= (dataView.getUint8(i++) & 0x3f) << 12;\n c |= (dataView.getUint8(i++) & 0x3f) << 6;\n c |= (dataView.getUint8(i++) & 0x3f);\n }\n a.push(String.fromCharCode(c));\n }\n } else { // Just map byte-by-byte (probably wrong)\n while (i < dataView.byteLength) {\n a.push(String.fromCharCode(dataView.getUint8(i++)));\n }\n }\n return a.join(\'\');\n};\n\nISOBoxer.Utils.utf8ToByteArray = function(string) {\n // Only UTF-8 encoding is supported by TextEncoder\n var u, i;\n if (typeof TextEncoder !== \'undefined\') {\n u = new TextEncoder().encode(string);\n } else {\n u = [];\n for (i = 0; i < string.length; ++i) {\n var c = string.charCodeAt(i);\n if (c < 0x80) {\n u.push(c);\n } else if (c < 0x800) {\n u.push(0xC0 | (c >> 6));\n u.push(0x80 | (63 & c));\n } else if (c < 0x10000) {\n u.push(0xE0 | (c >> 12));\n u.push(0x80 | (63 & (c >> 6)));\n u.push(0x80 | (63 & c));\n } else {\n u.push(0xF0 | (c >> 18));\n u.push(0x80 | (63 & (c >> 12)));\n u.push(0x80 | (63 & (c >> 6)));\n u.push(0x80 | (63 & c));\n }\n }\n }\n return u;\n};\n\n// Method to append a box in the list of child boxes\n// The \'pos\' parameter can be either:\n// - (number) a position index at which to insert the new box\n// - (string) the type of the box after which to insert the new box\n// - (object) the box after which to insert the new box\nISOBoxer.Utils.appendBox = function(parent, box, pos) {\n box._offset = parent._cursor.offset;\n box._root = (parent._root ? parent._root : parent);\n box._raw = parent._raw;\n box._parent = parent;\n\n if (pos === -1) {\n // The new box is a sub-box of the parent but not added in boxes array,\n // for example when the new box is set as an entry (see dref and stsd for example)\n return;\n }\n\n if (pos === undefined || pos === null) {\n parent.boxes.push(box);\n return;\n }\n\n var index = -1,\n type;\n\n if (typeof pos === "number") {\n index = pos;\n } else {\n if (typeof pos === "string") {\n type = pos;\n } else if (typeof pos === "object" && pos.type) {\n type = pos.type;\n } else {\n parent.boxes.push(box);\n return;\n }\n\n for (var i = 0; i < parent.boxes.length; i++) {\n if (type === parent.boxes[i].type) {\n index = i + 1;\n break;\n }\n }\n }\n parent.boxes.splice(index, 0, box);\n};\n\n{\n exports.parseBuffer = ISOBoxer.parseBuffer;\n exports.addBoxProcessor = ISOBoxer.addBoxProcessor;\n exports.createFile = ISOBoxer.createFile;\n exports.createBox = ISOBoxer.createBox;\n exports.createFullBox = ISOBoxer.createFullBox;\n exports.Utils = ISOBoxer.Utils;\n}\n\nISOBoxer.Cursor = function(initialOffset) {\n this.offset = (typeof initialOffset == \'undefined\' ? 0 : initialOffset);\n};\n\nvar ISOFile = function(arrayBuffer) {\n this._cursor = new ISOBoxer.Cursor();\n this.boxes = [];\n if (arrayBuffer) {\n this._raw = new DataView(arrayBuffer);\n }\n};\n\nISOFile.prototype.fetch = function(type) {\n var result = this.fetchAll(type, true);\n return (result.length ? result[0] : null);\n};\n\nISOFile.prototype.fetchAll = function(type, returnEarly) {\n var result = [];\n ISOFile._sweep.call(this, type, result, returnEarly);\n return result;\n};\n\nISOFile.prototype.parse = function() {\n this._cursor.offset = 0;\n this.boxes = [];\n while (this._cursor.offset < this._raw.byteLength) {\n var box = ISOBox.parse(this);\n\n // Box could not be parsed\n if (typeof box.type === \'undefined\') break;\n\n this.boxes.push(box);\n }\n return this;\n};\n\nISOFile._sweep = function(type, result, returnEarly) {\n if (this.type && this.type == type) result.push(this);\n for (var box in this.boxes) {\n if (result.length && returnEarly) return;\n ISOFile._sweep.call(this.boxes[box], type, result, returnEarly);\n }\n};\n\nISOFile.prototype.write = function() {\n\n var length = 0,\n i;\n\n for (i = 0; i < this.boxes.length; i++) {\n length += this.boxes[i].getLength(false);\n }\n\n var bytes = new Uint8Array(length);\n this._rawo = new DataView(bytes.buffer);\n this.bytes = bytes;\n this._cursor.offset = 0;\n\n for (i = 0; i < this.boxes.length; i++) {\n this.boxes[i].write();\n }\n\n return bytes.buffer;\n};\n\nISOFile.prototype.append = function(box, pos) {\n ISOBoxer.Utils.appendBox(this, box, pos);\n};\nvar ISOBox = function() {\n this._cursor = new ISOBoxer.Cursor();\n};\n\nISOBox.parse = function(parent) {\n var newBox = new ISOBox();\n newBox._offset = parent._cursor.offset;\n newBox._root = (parent._root ? parent._root : parent);\n newBox._raw = parent._raw;\n newBox._parent = parent;\n newBox._parseBox();\n parent._cursor.offset = newBox._raw.byteOffset + newBox._raw.byteLength;\n return newBox;\n};\n\nISOBox.create = function(type) {\n var newBox = new ISOBox();\n newBox.type = type;\n newBox.boxes = [];\n return newBox;\n};\n\nISOBox.prototype._boxContainers = [\'dinf\', \'edts\', \'mdia\', \'meco\', \'mfra\', \'minf\', \'moof\', \'moov\', \'mvex\', \'stbl\', \'strk\', \'traf\', \'trak\', \'tref\', \'udta\', \'vttc\', \'sinf\', \'schi\', \'encv\', \'enca\'];\n\nISOBox.prototype._boxProcessors = {};\n\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Generic read/write functions\n\nISOBox.prototype._procField = function (name, type, size) {\n if (this._parsing) {\n this[name] = this._readField(type, size);\n }\n else {\n this._writeField(type, size, this[name]);\n }\n};\n\nISOBox.prototype._procFieldArray = function (name, length, type, size) {\n var i;\n if (this._parsing) {\n this[name] = [];\n for (i = 0; i < length; i++) {\n this[name][i] = this._readField(type, size);\n }\n }\n else {\n for (i = 0; i < this[name].length; i++) {\n this._writeField(type, size, this[name][i]);\n }\n }\n};\n\nISOBox.prototype._procFullBox = function() {\n this._procField(\'version\', \'uint\', 8);\n this._procField(\'flags\', \'uint\', 24);\n};\n\nISOBox.prototype._procEntries = function(name, length, fn) {\n var i;\n if (this._parsing) {\n this[name] = [];\n for (i = 0; i < length; i++) {\n this[name].push({});\n fn.call(this, this[name][i]);\n }\n }\n else {\n for (i = 0; i < length; i++) {\n fn.call(this, this[name][i]);\n }\n }\n};\n\nISOBox.prototype._procSubEntries = function(entry, name, length, fn) {\n var i;\n if (this._parsing) {\n entry[name] = [];\n for (i = 0; i < length; i++) {\n entry[name].push({});\n fn.call(this, entry[name][i]);\n }\n }\n else {\n for (i = 0; i < length; i++) {\n fn.call(this, entry[name][i]);\n }\n }\n};\n\nISOBox.prototype._procEntryField = function (entry, name, type, size) {\n if (this._parsing) {\n entry[name] = this._readField(type, size);\n }\n else {\n this._writeField(type, size, entry[name]);\n }\n};\n\nISOBox.prototype._procSubBoxes = function(name, length) {\n var i;\n if (this._parsing) {\n this[name] = [];\n for (i = 0; i < length; i++) {\n this[name].push(ISOBox.parse(this));\n }\n }\n else {\n for (i = 0; i < length; i++) {\n if (this._rawo) {\n this[name][i].write();\n } else {\n this.size += this[name][i].getLength();\n }\n }\n }\n};\n\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Read/parse functions\n\nISOBox.prototype._readField = function(type, size) {\n switch (type) {\n case \'uint\':\n return this._readUint(size);\n case \'int\':\n return this._readInt(size);\n case \'template\':\n return this._readTemplate(size);\n case \'string\':\n return (size === -1) ? this._readTerminatedString() : this._readString(size);\n case \'data\':\n return this._readData(size);\n case \'utf8\':\n return this._readUTF8String();\n default:\n return -1;\n }\n};\n\nISOBox.prototype._readInt = function(size) {\n var result = null,\n offset = this._cursor.offset - this._raw.byteOffset;\n switch(size) {\n case 8:\n result = this._raw.getInt8(offset);\n break;\n case 16:\n result = this._raw.getInt16(offset);\n break;\n case 32:\n result = this._raw.getInt32(offset);\n break;\n case 64:\n // Warning: JavaScript cannot handle 64-bit integers natively.\n // This will give unexpected results for integers >= 2^53\n var s1 = this._raw.getInt32(offset);\n var s2 = this._raw.getInt32(offset + 4);\n result = (s1 * Math.pow(2,32)) + s2;\n break;\n }\n this._cursor.offset += (size >> 3);\n return result;\n};\n\nISOBox.prototype._readUint = function(size) {\n var result = null,\n offset = this._cursor.offset - this._raw.byteOffset,\n s1, s2;\n switch(size) {\n case 8:\n result = this._raw.getUint8(offset);\n break;\n case 16:\n result = this._raw.getUint16(offset);\n break;\n case 24:\n s1 = this._raw.getUint16(offset);\n s2 = this._raw.getUint8(offset + 2);\n result = (s1 << 8) + s2;\n break;\n case 32:\n result = this._raw.getUint32(offset);\n break;\n case 64:\n // Warning: JavaScript cannot handle 64-bit integers natively.\n // This will give unexpected results for integers >= 2^53\n s1 = this._raw.getUint32(offset);\n s2 = this._raw.getUint32(offset + 4);\n result = (s1 * Math.pow(2,32)) + s2;\n break;\n }\n this._cursor.offset += (size >> 3);\n return result;\n};\n\nISOBox.prototype._readString = function(length) {\n var str = \'\';\n for (var c = 0; c < length; c++) {\n var char = this._readUint(8);\n str += String.fromCharCode(char);\n }\n return str;\n};\n\nISOBox.prototype._readTemplate = function(size) {\n var pre = this._readUint(size / 2);\n var post = this._readUint(size / 2);\n return pre + (post / Math.pow(2, size / 2));\n};\n\nISOBox.prototype._readTerminatedString = function() {\n var str = \'\';\n while (this._cursor.offset - this._offset < this._raw.byteLength) {\n var char = this._readUint(8);\n if (char === 0) break;\n str += String.fromCharCode(char);\n }\n return str;\n};\n\nISOBox.prototype._readData = function(size) {\n var length = (size > 0) ? size : (this._raw.byteLength - (this._cursor.offset - this._offset));\n if (length > 0) {\n var data = new Uint8Array(this._raw.buffer, this._cursor.offset, length);\n\n this._cursor.offset += length;\n return data;\n }\n else {\n return null;\n }\n};\n\nISOBox.prototype._readUTF8String = function() {\n var length = this._raw.byteLength - (this._cursor.offset - this._offset);\n var data = null;\n if (length > 0) {\n data = new DataView(this._raw.buffer, this._cursor.offset, length);\n this._cursor.offset += length;\n }\n \n return data ? ISOBoxer.Utils.dataViewToString(data) : data;\n};\n\nISOBox.prototype._parseBox = function() {\n this._parsing = true;\n this._cursor.offset = this._offset;\n\n // return immediately if there are not enough bytes to read the header\n if (this._offset + 8 > this._raw.buffer.byteLength) {\n this._root._incomplete = true;\n return;\n }\n\n this._procField(\'size\', \'uint\', 32);\n this._procField(\'type\', \'string\', 4);\n\n if (this.size === 1) { this._procField(\'largesize\', \'uint\', 64); }\n if (this.type === \'uuid\') { this._procFieldArray(\'usertype\', 16, \'uint\', 8); }\n\n switch(this.size) {\n case 0:\n this._raw = new DataView(this._raw.buffer, this._offset, (this._raw.byteLength - this._cursor.offset + 8));\n break;\n case 1:\n if (this._offset + this.size > this._raw.buffer.byteLength) {\n this._incomplete = true;\n this._root._incomplete = true;\n } else {\n this._raw = new DataView(this._raw.buffer, this._offset, this.largesize);\n }\n break;\n default:\n if (this._offset + this.size > this._raw.buffer.byteLength) {\n this._incomplete = true;\n this._root._incomplete = true;\n } else {\n this._raw = new DataView(this._raw.buffer, this._offset, this.size);\n }\n }\n\n // additional parsing\n if (!this._incomplete) {\n if (this._boxProcessors[this.type]) {\n this._boxProcessors[this.type].call(this);\n }\n if (this._boxContainers.indexOf(this.type) !== -1) {\n this._parseContainerBox();\n } else{\n // Unknown box => read and store box content\n this._data = this._readData();\n }\n }\n};\n\nISOBox.prototype._parseFullBox = function() {\n this.version = this._readUint(8);\n this.flags = this._readUint(24);\n};\n\nISOBox.prototype._parseContainerBox = function() {\n this.boxes = [];\n while (this._cursor.offset - this._raw.byteOffset < this._raw.byteLength) {\n this.boxes.push(ISOBox.parse(this));\n }\n};\n\n///////////////////////////////////////////////////////////////////////////////////////////////////\n// Write functions\n\nISOBox.prototype.append = function(box, pos) {\n ISOBoxer.Utils.appendBox(this, box, pos);\n};\n\nISOBox.prototype.getLength = function() {\n this._parsing = false;\n this._rawo = null;\n\n this.size = 0;\n this._procField(\'size\', \'uint\', 32);\n this._procField(\'type\', \'string\', 4);\n\n if (this.size === 1) { this._procField(\'largesize\', \'uint\', 64); }\n if (this.type === \'uuid\') { this._procFieldArray(\'usertype\', 16, \'uint\', 8); }\n\n if (this._boxProcessors[this.type]) {\n this._boxProcessors[this.type].call(this);\n }\n\n if (this._boxContainers.indexOf(this.type) !== -1) {\n for (var i = 0; i < this.boxes.length; i++) {\n this.size += this.boxes[i].getLength();\n }\n } \n\n if (this._data) {\n this._writeData(this._data);\n }\n\n return this.size;\n};\n\nISOBox.prototype.write = function() {\n this._parsing = false;\n this._cursor.offset = this._parent._cursor.offset;\n\n switch(this.size) {\n case 0:\n this._rawo = new DataView(this._parent._rawo.buffer, this._cursor.offset, (this.parent._rawo.byteLength - this._cursor.offset));\n break;\n case 1:\n this._rawo = new DataView(this._parent._rawo.buffer, this._cursor.offset, this.largesize);\n break;\n default:\n this._rawo = new DataView(this._parent._rawo.buffer, this._cursor.offset, this.size);\n }\n\n this._procField(\'size\', \'uint\', 32);\n this._procField(\'type\', \'string\', 4);\n\n if (this.size === 1) { this._procField(\'largesize\', \'uint\', 64); }\n if (this.type === \'uuid\') { this._procFieldArray(\'usertype\', 16, \'uint\', 8); }\n\n if (this._boxProcessors[this.type]) {\n this._boxProcessors[this.type].call(this);\n }\n\n if (this._boxContainers.indexOf(this.type) !== -1) {\n for (var i = 0; i < this.boxes.length; i++) {\n this.boxes[i].write();\n }\n } \n\n if (this._data) {\n this._writeData(this._data);\n }\n\n this._parent._cursor.offset += this.size;\n\n return this.size;\n};\n\nISOBox.prototype._writeInt = function(size, value) {\n if (this._rawo) {\n var offset = this._cursor.offset - this._rawo.byteOffset;\n switch(size) {\n case 8:\n this._rawo.setInt8(offset, value);\n break;\n case 16:\n this._rawo.setInt16(offset, value);\n break;\n case 32:\n this._rawo.setInt32(offset, value);\n break;\n case 64:\n // Warning: JavaScript cannot handle 64-bit integers natively.\n // This will give unexpected results for integers >= 2^53\n var s1 = Math.floor(value / Math.pow(2,32));\n var s2 = value - (s1 * Math.pow(2,32));\n this._rawo.setUint32(offset, s1);\n this._rawo.setUint32(offset + 4, s2);\n break;\n }\n this._cursor.offset += (size >> 3);\n } else {\n this.size += (size >> 3);\n }\n};\n\nISOBox.prototype._writeUint = function(size, value) {\n\n if (this._rawo) {\n var offset = this._cursor.offset - this._rawo.byteOffset,\n s1, s2;\n switch(size) {\n case 8:\n this._rawo.setUint8(offset, value);\n break;\n case 16:\n this._rawo.setUint16(offset, value);\n break;\n case 24:\n s1 = (value & 0xFFFF00) >> 8;\n s2 = (value & 0x0000FF);\n this._rawo.setUint16(offset, s1);\n this._rawo.setUint8(offset + 2, s2);\n break;\n case 32:\n this._rawo.setUint32(offset, value);\n break;\n case 64:\n // Warning: JavaScript cannot handle 64-bit integers natively.\n // This will give unexpected results for integers >= 2^53\n s1 = Math.floor(value / Math.pow(2,32));\n s2 = value - (s1 * Math.pow(2,32));\n this._rawo.setUint32(offset, s1);\n this._rawo.setUint32(offset + 4, s2);\n break;\n }\n this._cursor.offset += (size >> 3);\n } else {\n this.size += (size >> 3);\n }\n};\n\nISOBox.prototype._writeString = function(size, str) {\n for (var c = 0; c < size; c++) {\n this._writeUint(8, str.charCodeAt(c));\n }\n};\n\nISOBox.prototype._writeTerminatedString = function(str) {\n if (str.length === 0) {\n return;\n }\n for (var c = 0; c < str.length; c++) {\n this._writeUint(8, str.charCodeAt(c));\n }\n this._writeUint(8, 0);\n};\n\nISOBox.prototype._writeTemplate = function(size, value) {\n var pre = Math.floor(value);\n var post = (value - pre) * Math.pow(2, size / 2);\n this._writeUint(size / 2, pre);\n this._writeUint(size / 2, post);\n};\n\nISOBox.prototype._writeData = function(data) {\n var i;\n //data to copy\n if (data) {\n if (this._rawo) {\n //Array and Uint8Array has also to be managed\n if (data instanceof Array) {\n var offset = this._cursor.offset - this._rawo.byteOffset;\n for (var i = 0; i < data.length; i++) {\n this._rawo.setInt8(offset + i, data[i]);\n }\n this._cursor.offset += data.length;\n } \n\n if (data instanceof Uint8Array) {\n this._root.bytes.set(data, this._cursor.offset);\n this._cursor.offset += data.length;\n }\n\n } else {\n //nothing to copy only size to compute\n this.size += data.length;\n }\n }\n};\n\nISOBox.prototype._writeUTF8String = function(string) {\n var u = ISOBoxer.Utils.utf8ToByteArray(string);\n if (this._rawo) {\n var dataView = new DataView(this._rawo.buffer, this._cursor.offset, u.length);\n for (var i = 0; i < u.length; i++) {\n dataView.setUint8(i, u[i]);\n }\n } else {\n this.size += u.length;\n }\n};\n\nISOBox.prototype._writeField = function(type, size, value) {\n switch (type) {\n case \'uint\':\n this._writeUint(size, value);\n break;\n case \'int\':\n this._writeInt(size, value);\n break;\n case \'template\':\n this._writeTemplate(size, value);\n break;\n case \'string\':\n if (size == -1) {\n this._writeTerminatedString(value);\n } else {\n this._writeString(size, value);\n }\n break;\n case \'data\':\n this._writeData(value);\n break;\n case \'utf8\':\n this._writeUTF8String(value);\n break;\n default:\n break;\n }\n};\n\n// ISO/IEC 14496-15:2014 - avc1 box\nISOBox.prototype._boxProcessors[\'avc1\'] = ISOBox.prototype._boxProcessors[\'encv\'] = function() {\n // SampleEntry fields\n this._procFieldArray(\'reserved1\', 6, \'uint\', 8);\n this._procField(\'data_reference_index\', \'uint\', 16);\n // VisualSampleEntry fields\n this._procField(\'pre_defined1\', \'uint\', 16);\n this._procField(\'reserved2\', \'uint\', 16);\n this._procFieldArray(\'pre_defined2\', 3, \'uint\', 32);\n this._procField(\'width\', \'uint\', 16);\n this._procField(\'height\', \'uint\', 16);\n this._procField(\'horizresolution\', \'template\', 32);\n this._procField(\'vertresolution\', \'template\', 32);\n this._procField(\'reserved3\', \'uint\', 32);\n this._procField(\'frame_count\', \'uint\', 16);\n this._procFieldArray(\'compressorname\', 32,\'uint\', 8);\n this._procField(\'depth\', \'uint\', 16);\n this._procField(\'pre_defined3\', \'int\', 16);\n // AVCSampleEntry fields\n this._procField(\'config\', \'data\', -1);\n};\n\n// ISO/IEC 14496-12:2012 - 8.7.2 Data Reference Box\nISOBox.prototype._boxProcessors[\'dref\'] = function() {\n this._procFullBox();\n this._procField(\'entry_count\', \'uint\', 32);\n this._procSubBoxes(\'entries\', this.entry_count);\n};\n\n// ISO/IEC 14496-12:2012 - 8.6.6 Edit List Box\nISOBox.prototype._boxProcessors[\'elst\'] = function() {\n this._procFullBox();\n this._procField(\'entry_count\', \'uint\', 32);\n this._procEntries(\'entries\', this.entry_count, function(entry) {\n this._procEntryField(entry, \'segment_duration\', \'uint\', (this.version === 1) ? 64 : 32);\n this._procEntryField(entry, \'media_time\', \'int\', (this.version === 1) ? 64 : 32);\n this._procEntryField(entry, \'media_rate_integer\', \'int\', 16);\n this._procEntryField(entry, \'media_rate_fraction\', \'int\', 16);\n });\n};\n\n// ISO/IEC 23009-1:2014 - 5.10.3.3 Event Message Box\nISOBox.prototype._boxProcessors[\'emsg\'] = function() {\n this._procFullBox();\n if (this.version == 1) {\n this._procField(\'timescale\', \'uint\', 32);\n this._procField(\'presentation_time\', \'uint\', 64);\n this._procField(\'event_duration\', \'uint\', 32);\n this._procField(\'id\', \'uint\', 32);\n this._procField(\'scheme_id_uri\', \'string\', -1);\n this._procField(\'value\', \'string\', -1);\n } else {\n this._procField(\'scheme_id_uri\', \'string\', -1);\n this._procField(\'value\', \'string\', -1);\n this._procField(\'timescale\', \'uint\', 32);\n this._procField(\'presentation_time_delta\', \'uint\', 32);\n this._procField(\'event_duration\', \'uint\', 32);\n this._procField(\'id\', \'uint\', 32);\n }\n this._procField(\'message_data\', \'data\', -1);\n};\n// ISO/IEC 14496-12:2012 - 8.1.2 Free Space Box\nISOBox.prototype._boxProcessors[\'free\'] = ISOBox.prototype._boxProcessors[\'skip\'] = function() {\n this._procField(\'data\', \'data\', -1);\n};\n\n// ISO/IEC 14496-12:2012 - 8.12.2 Original Format Box\nISOBox.prototype._boxProcessors[\'frma\'] = function() {\n this._procField(\'data_format\', \'uint\', 32);\n};\n// ISO/IEC 14496-12:2012 - 4.3 File Type Box / 8.16.2 Segment Type Box\nISOBox.prototype._boxProcessors[\'ftyp\'] =\nISOBox.prototype._boxProcessors[\'styp\'] = function() {\n this._procField(\'major_brand\', \'string\', 4);\n this._procField(\'minor_version\', \'uint\', 32);\n var nbCompatibleBrands = -1;\n if (this._parsing) {\n nbCompatibleBrands = (this._raw.byteLength - (this._cursor.offset - this._raw.byteOffset)) / 4;\n }\n this._procFieldArray(\'compatible_brands\', nbCompatibleBrands, \'string\', 4);\n};\n\n// ISO/IEC 14496-12:2012 - 8.4.3 Handler Reference Box\nISOBox.prototype._boxProcessors[\'hdlr\'] = function() {\n this._procFullBox();\n this._procField(\'pre_defined\', \'uint\', 32);\n this._procField(\'handler_type\', \'string\', 4);\n this._procFieldArray(\'reserved\', 3, \'uint\', 32);\n this._procField(\'name\', \'string\', -1);\n};\n\n// ISO/IEC 14496-12:2012 - 8.1.1 Media Data Box\nISOBox.prototype._boxProcessors[\'mdat\'] = function() {\n this._procField(\'data\', \'data\', -1);\n};\n\n// ISO/IEC 14496-12:2012 - 8.4.2 Media Header Box\nISOBox.prototype._boxProcessors[\'mdhd\'] = function() {\n this._procFullBox();\n this._procField(\'creation_time\', \'uint\', (this.version == 1) ? 64 : 32);\n this._procField(\'modification_time\', \'uint\', (this.version == 1) ? 64 : 32);\n this._procField(\'timescale\', \'uint\', 32);\n this._procField(\'duration\', \'uint\', (this.version == 1) ? 64 : 32);\n if (!this._parsing && typeof this.language === \'string\') {\n // In case of writing and language has been set as a string, then convert it into char codes array\n this.language = ((this.language.charCodeAt(0) - 0x60) << 10) |\n ((this.language.charCodeAt(1) - 0x60) << 5) |\n ((this.language.charCodeAt(2) - 0x60));\n }\n this._procField(\'language\', \'uint\', 16);\n if (this._parsing) {\n this.language = String.fromCharCode(((this.language >> 10) & 0x1F) + 0x60,\n ((this.language >> 5) & 0x1F) + 0x60,\n (this.language & 0x1F) + 0x60);\n }\n this._procField(\'pre_defined\', \'uint\', 16);\n};\n\n// ISO/IEC 14496-12:2012 - 8.8.2 Movie Extends Header Box\nISOBox.prototype._boxProcessors[\'mehd\'] = function() {\n this._procFullBox();\n this._procField(\'fragment_duration\', \'uint\', (this.version == 1) ? 64 : 32);\n};\n\n// ISO/IEC 14496-12:2012 - 8.8.5 Movie Fragment Header Box\nISOBox.prototype._boxProcessors[\'mfhd\'] = function() {\n this._procFullBox();\n this._procField(\'sequence_number\', \'uint\', 32);\n};\n\n// ISO/IEC 14496-12:2012 - 8.8.11 Movie Fragment Random Access Box\nISOBox.prototype._boxProcessors[\'mfro\'] = function() {\n this._procFullBox();\n this._procField(\'mfra_size\', \'uint\', 32); // Called mfra_size to distinguish from the normal "size" attribute of a box\n};\n\n\n// ISO/IEC 14496-12:2012 - 8.5.2.2 mp4a box (use AudioSampleEntry definition and naming)\nISOBox.prototype._boxProcessors[\'mp4a\'] = ISOBox.prototype._boxProcessors[\'enca\'] = function() {\n // SampleEntry fields\n this._procFieldArray(\'reserved1\', 6, \'uint\', 8);\n this._procField(\'data_reference_index\', \'uint\', 16);\n // AudioSampleEntry fields\n this._procFieldArray(\'reserved2\', 2, \'uint\', 32);\n this._procField(\'channelcount\', \'uint\', 16);\n this._procField(\'samplesize\', \'uint\', 16);\n this._procField(\'pre_defined\', \'uint\', 16);\n this._procField(\'reserved3\', \'uint\', 16);\n this._procField(\'samplerate\', \'template\', 32);\n // ESDescriptor fields\n this._procField(\'esds\', \'data\', -1);\n};\n\n// ISO/IEC 14496-12:2012 - 8.2.2 Movie Header Box\nISOBox.prototype._boxProcessors[\'mvhd\'] = function() {\n this._procFullBox();\n this._procField(\'creation_time\', \'uint\', (this.version == 1) ? 64 : 32);\n this._procField(\'modification_time\', \'uint\', (this.version == 1) ? 64 : 32);\n this._procField(\'timescale\', \'uint\', 32);\n this._procField(\'duration\', \'uint\', (this.version == 1) ? 64 : 32);\n this._procField(\'rate\', \'template\', 32);\n this._procField(\'volume\', \'template\', 16);\n this._procField(\'reserved1\', \'uint\', 16);\n this._procFieldArray(\'reserved2\', 2, \'uint\', 32);\n this._procFieldArray(\'matrix\', 9, \'template\', 32);\n this._procFieldArray(\'pre_defined\', 6,\'uint\', 32);\n this._procField(\'next_track_ID\', \'uint\', 32);\n};\n\n// ISO/IEC 14496-30:2014 - WebVTT Cue Payload Box.\nISOBox.prototype._boxProcessors[\'payl\'] = function() {\n this._procField(\'cue_text\', \'utf8\');\n};\n\n//ISO/IEC 23001-7:2011 - 8.1 Protection System Specific Header Box\nISOBox.prototype._boxProcessors[\'pssh\'] = function() {\n this._procFullBox();\n \n this._procFieldArray(\'SystemID\', 16, \'uint\', 8);\n this._procField(\'DataSize\', \'uint\', 32);\n this._procFieldArray(\'Data\', this.DataSize, \'uint\', 8);\n};\n// ISO/IEC 14496-12:2012 - 8.12.5 Scheme Type Box\nISOBox.prototype._boxProcessors[\'schm\'] = function() {\n this._procFullBox();\n \n this._procField(\'scheme_type\', \'uint\', 32);\n this._procField(\'scheme_version\', \'uint\', 32);\n\n if (this.flags & 0x000001) {\n this._procField(\'scheme_uri\', \'string\', -1);\n }\n};\n// ISO/IEC 14496-12:2012 - 8.6.4.1 sdtp box \nISOBox.prototype._boxProcessors[\'sdtp\'] = function() {\n this._procFullBox();\n\n var sample_count = -1;\n if (this._parsing) {\n sample_count = (this._raw.byteLength - (this._cursor.offset - this._raw.byteOffset));\n }\n\n this._procFieldArray(\'sample_dependency_table\', sample_count, \'uint\', 8);\n};\n\n// ISO/IEC 14496-12:2012 - 8.16.3 Segment Index Box\nISOBox.prototype._boxProcessors[\'sidx\'] = function() {\n this._procFullBox();\n this._procField(\'reference_ID\', \'uint\', 32);\n this._procField(\'timescale\', \'uint\', 32);\n this._procField(\'earliest_presentation_time\', \'uint\', (this.version == 1) ? 64 : 32);\n this._procField(\'first_offset\', \'uint\', (this.version == 1) ? 64 : 32);\n this._procField(\'reserved\', \'uint\', 16);\n this._procField(\'reference_count\', \'uint\', 16);\n this._procEntries(\'references\', this.reference_count, function(entry) {\n if (!this._parsing) {\n entry.reference = (entry.reference_type & 0x00000001) << 31;\n entry.reference |= (entry.referenced_size & 0x7FFFFFFF);\n entry.sap = (entry.starts_with_SAP & 0x00000001) << 31;\n entry.sap |= (entry.SAP_type & 0x00000003) << 28;\n entry.sap |= (entry.SAP_delta_time & 0x0FFFFFFF);\n }\n this._procEntryField(entry, \'reference\', \'uint\', 32);\n this._procEntryField(entry, \'subsegment_duration\', \'uint\', 32);\n this._procEntryField(entry, \'sap\', \'uint\', 32);\n if (this._parsing) {\n entry.reference_type = (entry.reference >> 31) & 0x00000001;\n entry.referenced_size = entry.reference & 0x7FFFFFFF;\n entry.starts_with_SAP = (entry.sap >> 31) & 0x00000001;\n entry.SAP_type = (entry.sap >> 28) & 0x00000007;\n entry.SAP_delta_time = (entry.sap & 0x0FFFFFFF);\n }\n });\n};\n\n// ISO/IEC 14496-12:2012 - 8.4.5.3 Sound Media Header Box\nISOBox.prototype._boxProcessors[\'smhd\'] = function() {\n this._procFullBox();\n this._procField(\'balance\', \'uint\', 16);\n this._procField(\'reserved\', \'uint\', 16);\n};\n\n// ISO/IEC 14496-12:2012 - 8.16.4 Subsegment Index Box\nISOBox.prototype._boxProcessors[\'ssix\'] = function() {\n this._procFullBox();\n this._procField(\'subsegment_count\', \'uint\', 32);\n this._procEntries(\'subsegments\', this.subsegment_count, function(subsegment) {\n this._procEntryField(subsegment, \'ranges_count\', \'uint\', 32);\n this._procSubEntries(subsegment, \'ranges\', subsegment.ranges_count, function(range) {\n this._procEntryField(range, \'level\', \'uint\', 8);\n this._procEntryField(range, \'range_size\', \'uint\', 24);\n });\n });\n};\n\n// ISO/IEC 14496-12:2012 - 8.5.2 Sample Description Box\nISOBox.prototype._boxProcessors[\'stsd\'] = function() {\n this._procFullBox();\n this._procField(\'entry_count\', \'uint\', 32);\n this._procSubBoxes(\'entries\', this.entry_count);\n};\n\n// ISO/IEC 14496-12:2015 - 8.7.7 Sub-Sample Information Box\nISOBox.prototype._boxProcessors[\'subs\'] = function () {\n this._procFullBox();\n this._procField(\'entry_count\', \'uint\', 32);\n this._procEntries(\'entries\', this.entry_count, function(entry) {\n this._procEntryField(entry, \'sample_delta\', \'uint\', 32);\n this._procEntryField(entry, \'subsample_count\', \'uint\', 16);\n this._procSubEntries(entry, \'subsamples\', entry.subsample_count, function(subsample) {\n this._procEntryField(subsample, \'subsample_size\', \'uint\', (this.version === 1) ? 32 : 16);\n this._procEntryField(subsample, \'subsample_priority\', \'uint\', 8);\n this._procEntryField(subsample, \'discardable\', \'uint\', 8);\n this._procEntryField(subsample, \'codec_specific_parameters\', \'uint\', 32);\n });\n });\n};\n\n//ISO/IEC 23001-7:2011 - 8.2 Track Encryption Box\nISOBox.prototype._boxProcessors[\'tenc\'] = function() {\n this._procFullBox();\n\n this._procField(\'default_IsEncrypted\', \'uint\', 24);\n this._procField(\'default_IV_size\', \'uint\', 8);\n this._procFieldArray(\'default_KID\', 16, \'uint\', 8);\n };\n\n// ISO/IEC 14496-12:2012 - 8.8.12 Track Fragmnent Decode Time\nISOBox.prototype._boxProcessors[\'tfdt\'] = function() {\n this._procFullBox();\n this._procField(\'baseMediaDecodeTime\', \'uint\', (this.version == 1) ? 64 : 32);\n};\n\n// ISO/IEC 14496-12:2012 - 8.8.7 Track Fragment Header Box\nISOBox.prototype._boxProcessors[\'tfhd\'] = function() {\n this._procFullBox();\n this._procField(\'track_ID\', \'uint\', 32);\n if (this.flags & 0x01) this._procField(\'base_data_offset\', \'uint\', 64);\n if (this.flags & 0x02) this._procField(\'sample_description_offset\', \'uint\', 32);\n if (this.flags & 0x08) this._procField(\'default_sample_duration\', \'uint\', 32);\n if (this.flags & 0x10) this._procField(\'default_sample_size\', \'uint\', 32);\n if (this.flags & 0x20) this._procField(\'default_sample_flags\', \'uint\', 32);\n};\n\n// ISO/IEC 14496-12:2012 - 8.8.10 Track Fragment Random Access Box\nISOBox.prototype._boxProcessors[\'tfra\'] = function() {\n this._procFullBox();\n this._procField(\'track_ID\', \'uint\', 32);\n if (!this._parsing) {\n this.reserved = 0;\n this.reserved |= (this.length_size_of_traf_num & 0x00000030) << 4;\n this.reserved |= (this.length_size_of_trun_num & 0x0000000C) << 2;\n this.reserved |= (this.length_size_of_sample_num & 0x00000003);\n }\n this._procField(\'reserved\', \'uint\', 32);\n if (this._parsing) {\n this.length_size_of_traf_num = (this.reserved & 0x00000030) >> 4;\n this.length_size_of_trun_num = (this.reserved & 0x0000000C) >> 2;\n this.length_size_of_sample_num = (this.reserved & 0x00000003);\n }\n this._procField(\'number_of_entry\', \'uint\', 32);\n this._procEntries(\'entries\', this.number_of_entry, function(entry) {\n this._procEntryField(entry, \'time\', \'uint\', (this.version === 1) ? 64 : 32);\n this._procEntryField(entry, \'moof_offset\', \'uint\', (this.version === 1) ? 64 : 32);\n this._procEntryField(entry, \'traf_number\', \'uint\', (this.length_size_of_traf_num + 1) * 8);\n this._procEntryField(entry, \'trun_number\', \'uint\', (this.length_size_of_trun_num + 1) * 8);\n this._procEntryField(entry, \'sample_number\', \'uint\', (this.length_size_of_sample_num + 1) * 8);\n });\n};\n\n// ISO/IEC 14496-12:2012 - 8.3.2 Track Header Box\nISOBox.prototype._boxProcessors[\'tkhd\'] = function() {\n this._procFullBox();\n this._procField(\'creation_time\', \'uint\', (this.version == 1) ? 64 : 32);\n this._procField(\'modification_time\', \'uint\', (this.version == 1) ? 64 : 32);\n this._procField(\'track_ID\', \'uint\', 32);\n this._procField(\'reserved1\', \'uint\', 32);\n this._procField(\'duration\', \'uint\', (this.version == 1) ? 64 : 32);\n this._procFieldArray(\'reserved2\', 2, \'uint\', 32);\n this._procField(\'layer\', \'uint\', 16);\n this._procField(\'alternate_group\', \'uint\', 16);\n this._procField(\'volume\', \'template\', 16);\n this._procField(\'reserved3\', \'uint\', 16);\n this._procFieldArray(\'matrix\', 9, \'template\', 32);\n this._procField(\'width\', \'template\', 32);\n this._procField(\'height\', \'template\', 32);\n};\n\n// ISO/IEC 14496-12:2012 - 8.8.3 Track Extends Box\nISOBox.prototype._boxProcessors[\'trex\'] = function() {\n this._procFullBox();\n this._procField(\'track_ID\', \'uint\', 32);\n this._procField(\'default_sample_description_index\', \'uint\', 32);\n this._procField(\'default_sample_duration\', \'uint\', 32);\n this._procField(\'default_sample_size\', \'uint\', 32);\n this._procField(\'default_sample_flags\', \'uint\', 32);\n};\n\n// ISO/IEC 14496-12:2012 - 8.8.8 Track Run Box\n// Note: the \'trun\' box has a direct relation to the \'tfhd\' box for defaults.\n// These defaults are not set explicitly here, but are left to resolve for the user.\nISOBox.prototype._boxProcessors[\'trun\'] = function() {\n this._procFullBox();\n this._procField(\'sample_count\', \'uint\', 32);\n if (this.flags & 0x1) this._procField(\'data_offset\', \'int\', 32);\n if (this.flags & 0x4) this._procField(\'first_sample_flags\', \'uint\', 32);\n this._procEntries(\'samples\', this.sample_count, function(sample) {\n if (this.flags & 0x100) this._procEntryField(sample, \'sample_duration\', \'uint\', 32);\n if (this.flags & 0x200) this._procEntryField(sample, \'sample_size\', \'uint\', 32);\n if (this.flags & 0x400) this._procEntryField(sample, \'sample_flags\', \'uint\', 32);\n if (this.flags & 0x800) this._procEntryField(sample, \'sample_composition_time_offset\', (this.version === 1) ? \'int\' : \'uint\', 32);\n });\n};\n\n// ISO/IEC 14496-12:2012 - 8.7.2 Data Reference Box\nISOBox.prototype._boxProcessors[\'url \'] = ISOBox.prototype._boxProcessors[\'urn \'] = function() {\n this._procFullBox();\n if (this.type === \'urn \') {\n this._procField(\'name\', \'string\', -1);\n }\n this._procField(\'location\', \'string\', -1);\n};\n\n// ISO/IEC 14496-30:2014 - WebVTT Source Label Box\nISOBox.prototype._boxProcessors[\'vlab\'] = function() {\n this._procField(\'source_label\', \'utf8\');\n};\n\n// ISO/IEC 14496-12:2012 - 8.4.5.2 Video Media Header Box\nISOBox.prototype._boxProcessors[\'vmhd\'] = function() {\n this._procFullBox();\n this._procField(\'graphicsmode\', \'uint\', 16);\n this._procFieldArray(\'opcolor\', 3, \'uint\', 16);\n};\n\n// ISO/IEC 14496-30:2014 - WebVTT Configuration Box\nISOBox.prototype._boxProcessors[\'vttC\'] = function() {\n this._procField(\'config\', \'utf8\');\n};\n\n// ISO/IEC 14496-30:2014 - WebVTT Empty Sample Box\nISOBox.prototype._boxProcessors[\'vtte\'] = function() {\n // Nothing should happen here.\n};\n\n\n/***/ }),\n\n/***/ "./node_modules/core-util-is/lib/util.js":\n/*!***********************************************!*\\\n !*** ./node_modules/core-util-is/lib/util.js ***!\n \\***********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_119963__) {\n\n/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// "Software"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don\'t use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\nfunction isArray(arg) {\n if (Array.isArray) {\n return Array.isArray(arg);\n }\n return objectToString(arg) === \'[object Array]\';\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === \'boolean\';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === \'number\';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === \'string\';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === \'symbol\';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return objectToString(re) === \'[object RegExp]\';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === \'object\' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return objectToString(d) === \'[object Date]\';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return (objectToString(e) === \'[object Error]\' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === \'function\';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === \'boolean\' ||\n typeof arg === \'number\' ||\n typeof arg === \'string\' ||\n typeof arg === \'symbol\' || // ES6 symbol\n typeof arg === \'undefined\';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_119963__(/*! ./../../node-libs-browser/node_modules/buffer/index.js */ "./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer));\n\n/***/ }),\n\n/***/ "./node_modules/es6-promise/auto.js":\n/*!******************************************!*\\\n !*** ./node_modules/es6-promise/auto.js ***!\n \\******************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_123515__) {\n// This file can be required in Browserify and Node.js for automatic polyfill\n// To use it: require(\'es6-promise/auto\');\n\nmodule.exports = __nested_webpack_require_123515__(/*! ./ */ "./node_modules/es6-promise/dist/es6-promise.js").polyfill();\n\n\n/***/ }),\n\n/***/ "./node_modules/es6-promise/dist/es6-promise.js":\n/*!******************************************************!*\\\n !*** ./node_modules/es6-promise/dist/es6-promise.js ***!\n \\******************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_124082__) {\n\n/* WEBPACK VAR INJECTION */(function(process, global) {/*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version v4.2.8+1e68dce6\n */\n\n(function (global, factory) {\n\t module.exports = factory();\n}(this, (function () {\nfunction objectOrFunction(x) {\n var type = typeof x;\n return x !== null && (type === \'object\' || type === \'function\');\n}\n\nfunction isFunction(x) {\n return typeof x === \'function\';\n}\n\n\n\nvar _isArray = void 0;\nif (Array.isArray) {\n _isArray = Array.isArray;\n} else {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === \'[object Array]\';\n };\n}\n\nvar isArray = _isArray;\n\nvar len = 0;\nvar vertxNext = void 0;\nvar customSchedulerFn = void 0;\n\nvar asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n } else {\n scheduleFlush();\n }\n }\n};\n\nfunction setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n}\n\nfunction setAsap(asapFn) {\n asap = asapFn;\n}\n\nvar browserWindow = typeof window !== \'undefined\' ? window : undefined;\nvar browserGlobal = browserWindow || {};\nvar BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\nvar isNode = typeof self === \'undefined\' && typeof process !== \'undefined\' && {}.toString.call(process) === \'[object process]\';\n\n// test for web worker but not in IE10\nvar isWorker = typeof Uint8ClampedArray !== \'undefined\' && typeof importScripts !== \'undefined\' && typeof MessageChannel !== \'undefined\';\n\n// node\nfunction useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n}\n\n// vertx\nfunction useVertxTimer() {\n if (typeof vertxNext !== \'undefined\') {\n return function () {\n vertxNext(flush);\n };\n }\n\n return useSetTimeout();\n}\n\nfunction useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode(\'\');\n observer.observe(node, { characterData: true });\n\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n}\n\n// web worker\nfunction useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n}\n\nfunction useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n}\n\nvar queue = new Array(1000);\nfunction flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n\n callback(arg);\n\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n\n len = 0;\n}\n\nfunction attemptVertx() {\n try {\n var vertx = Function(\'return this\')().require(\'vertx\');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n } catch (e) {\n return useSetTimeout();\n }\n}\n\nvar scheduleFlush = void 0;\n// Decide what async method to use to triggering processing of queued callbacks:\nif (isNode) {\n scheduleFlush = useNextTick();\n} else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n} else if (isWorker) {\n scheduleFlush = useMessageChannel();\n} else if (browserWindow === undefined && "function" === \'function\') {\n scheduleFlush = attemptVertx();\n} else {\n scheduleFlush = useSetTimeout();\n}\n\nfunction then(onFulfillment, onRejection) {\n var parent = this;\n\n var child = new this.constructor(noop);\n\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n\n var _state = parent._state;\n\n\n if (_state) {\n var callback = arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n } else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n\n return child;\n}\n\n/**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.resolve(1);\n\n promise.then(function(value){\n // value === 1\n });\n ```\n\n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n*/\nfunction resolve$1(object) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (object && typeof object === \'object\' && object.constructor === Constructor) {\n return object;\n }\n\n var promise = new Constructor(noop);\n resolve(promise, object);\n return promise;\n}\n\nvar PROMISE_ID = Math.random().toString(36).substring(2);\n\nfunction noop() {}\n\nvar PENDING = void 0;\nvar FULFILLED = 1;\nvar REJECTED = 2;\n\nfunction selfFulfillment() {\n return new TypeError("You cannot resolve a promise with itself");\n}\n\nfunction cannotReturnOwn() {\n return new TypeError(\'A promises callback cannot return that same promise.\');\n}\n\nfunction tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {\n try {\n then$$1.call(value, fulfillmentHandler, rejectionHandler);\n } catch (e) {\n return e;\n }\n}\n\nfunction handleForeignThenable(promise, thenable, then$$1) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then$$1, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n resolve(promise, value);\n } else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n\n reject(promise, reason);\n }, \'Settle: \' + (promise._label || \' unknown promise\'));\n\n if (!sealed && error) {\n sealed = true;\n reject(promise, error);\n }\n }, promise);\n}\n\nfunction handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n } else if (thenable._state === REJECTED) {\n reject(promise, thenable._result);\n } else {\n subscribe(thenable, undefined, function (value) {\n return resolve(promise, value);\n }, function (reason) {\n return reject(promise, reason);\n });\n }\n}\n\nfunction handleMaybeThenable(promise, maybeThenable, then$$1) {\n if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {\n handleOwnThenable(promise, maybeThenable);\n } else {\n if (then$$1 === undefined) {\n fulfill(promise, maybeThenable);\n } else if (isFunction(then$$1)) {\n handleForeignThenable(promise, maybeThenable, then$$1);\n } else {\n fulfill(promise, maybeThenable);\n }\n }\n}\n\nfunction resolve(promise, value) {\n if (promise === value) {\n reject(promise, selfFulfillment());\n } else if (objectOrFunction(value)) {\n var then$$1 = void 0;\n try {\n then$$1 = value.then;\n } catch (error) {\n reject(promise, error);\n return;\n }\n handleMaybeThenable(promise, value, then$$1);\n } else {\n fulfill(promise, value);\n }\n}\n\nfunction publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n\n publish(promise);\n}\n\nfunction fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n\n promise._result = value;\n promise._state = FULFILLED;\n\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n}\n\nfunction reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n\n asap(publishRejection, promise);\n}\n\nfunction subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n\n\n parent._onerror = null;\n\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n}\n\nfunction publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n\n if (subscribers.length === 0) {\n return;\n }\n\n var child = void 0,\n callback = void 0,\n detail = promise._result;\n\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n\n if (child) {\n invokeCallback(settled, child, callback, detail);\n } else {\n callback(detail);\n }\n }\n\n promise._subscribers.length = 0;\n}\n\nfunction invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback),\n value = void 0,\n error = void 0,\n succeeded = true;\n\n if (hasCallback) {\n try {\n value = callback(detail);\n } catch (e) {\n succeeded = false;\n error = e;\n }\n\n if (promise === value) {\n reject(promise, cannotReturnOwn());\n return;\n }\n } else {\n value = detail;\n }\n\n if (promise._state !== PENDING) ; else if (hasCallback && succeeded) {\n resolve(promise, value);\n } else if (succeeded === false) {\n reject(promise, error);\n } else if (settled === FULFILLED) {\n fulfill(promise, value);\n } else if (settled === REJECTED) {\n reject(promise, value);\n }\n}\n\nfunction initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n resolve(promise, value);\n }, function rejectPromise(reason) {\n reject(promise, reason);\n });\n } catch (e) {\n reject(promise, e);\n }\n}\n\nvar id = 0;\nfunction nextId() {\n return id++;\n}\n\nfunction makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n}\n\nfunction validationError() {\n return new Error(\'Array Methods must be provided an Array\');\n}\n\nvar Enumerator = function () {\n function Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n\n if (isArray(input)) {\n this.length = input.length;\n this._remaining = input.length;\n\n this._result = new Array(this.length);\n\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n } else {\n this.length = this.length || 0;\n this._enumerate(input);\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n } else {\n reject(this.promise, validationError());\n }\n }\n\n Enumerator.prototype._enumerate = function _enumerate(input) {\n for (var i = 0; this._state === PENDING && i < input.length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n\n Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {\n var c = this._instanceConstructor;\n var resolve$$1 = c.resolve;\n\n\n if (resolve$$1 === resolve$1) {\n var _then = void 0;\n var error = void 0;\n var didError = false;\n try {\n _then = entry.then;\n } catch (e) {\n didError = true;\n error = e;\n }\n\n if (_then === then && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n } else if (typeof _then !== \'function\') {\n this._remaining--;\n this._result[i] = entry;\n } else if (c === Promise$1) {\n var promise = new c(noop);\n if (didError) {\n reject(promise, error);\n } else {\n handleMaybeThenable(promise, entry, _then);\n }\n this._willSettleAt(promise, i);\n } else {\n this._willSettleAt(new c(function (resolve$$1) {\n return resolve$$1(entry);\n }), i);\n }\n } else {\n this._willSettleAt(resolve$$1(entry), i);\n }\n };\n\n Enumerator.prototype._settledAt = function _settledAt(state, i, value) {\n var promise = this.promise;\n\n\n if (promise._state === PENDING) {\n this._remaining--;\n\n if (state === REJECTED) {\n reject(promise, value);\n } else {\n this._result[i] = value;\n }\n }\n\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n };\n\n Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {\n var enumerator = this;\n\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n };\n\n return Enumerator;\n}();\n\n/**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n\n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises\'s\n rejection handler. For example:\n\n Example:\n\n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error("2"));\n let promise3 = reject(new Error("3"));\n let promises = [ promise1, promise2, promise3 ];\n\n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === "2"\n });\n ```\n\n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n*/\nfunction all(entries) {\n return new Enumerator(this, entries).promise;\n}\n\n/**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n\n Example:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve(\'promise 1\');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve(\'promise 2\');\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // result === \'promise 2\' because it was resolved before promise1\n // was resolved.\n });\n ```\n\n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n\n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve(\'promise 1\');\n }, 200);\n });\n\n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error(\'promise 2\'));\n }, 100);\n });\n\n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === \'promise 2\' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n\n An example real-world use case is implementing timeouts:\n\n ```javascript\n Promise.race([ajax(\'foo.json\'), timeout(5000)])\n ```\n\n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n*/\nfunction race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError(\'You must pass an array to race.\'));\n });\n } else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n}\n\n/**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n\n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error(\'WHOOPS\'));\n });\n\n promise.then(function(value){\n // Code here doesn\'t run because the promise is rejected!\n }, function(reason){\n // reason.message === \'WHOOPS\'\n });\n ```\n\n Instead of writing the above, your code now simply becomes the following:\n\n ```javascript\n let promise = Promise.reject(new Error(\'WHOOPS\'));\n\n promise.then(function(value){\n // Code here doesn\'t run because the promise is rejected!\n }, function(reason){\n // reason.message === \'WHOOPS\'\n });\n ```\n\n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n*/\nfunction reject$1(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n reject(promise, reason);\n return promise;\n}\n\nfunction needsResolver() {\n throw new TypeError(\'You must pass a resolver function as the first argument to the promise constructor\');\n}\n\nfunction needsNew() {\n throw new TypeError("Failed to construct \'Promise\': Please use the \'new\' operator, this object constructor cannot be called as a function.");\n}\n\n/**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise\'s eventual value or the reason\n why the promise cannot be fulfilled.\n\n Terminology\n -----------\n\n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n\n A promise can be in one of three states: pending, fulfilled, or rejected.\n\n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n\n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise\'s settled state will match the value\'s\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n\n\n Basic Usage:\n ------------\n\n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n\n // on failure\n reject(reason);\n });\n\n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Advanced Usage:\n ---------------\n\n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n\n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n\n xhr.open(\'GET\', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = \'json\';\n xhr.setRequestHeader(\'Accept\', \'application/json\');\n xhr.send();\n\n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error(\'getJSON: `\' + url + \'` failed with status: [\' + this.status + \']\'));\n }\n }\n };\n });\n }\n\n getJSON(\'/posts.json\').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n\n Unlike callbacks, promises are great composable primitives.\n\n ```js\n Promise.all([\n getJSON(\'/posts\'),\n getJSON(\'/comments\')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n\n return values;\n });\n ```\n\n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n*/\n\nvar Promise$1 = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n\n if (noop !== resolver) {\n typeof resolver !== \'function\' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise\'s eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, \'downstream\'\n promise is resolved with the return value of the first promise\'s fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return \'default name\';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user\'s name, otherwise it\n // will be `\'default name\'`\n });\n findUser().then(function (user) {\n throw new Error(\'Found user, but still unhappy\');\n }, function (reason) {\n throw new Error(\'`findUser` rejected and we\'re unhappy\');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be \'Found user, but still unhappy\'.\n // If `findUser` rejected, `reason` will be \'`findUser` rejected and we\'re unhappy\'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException(\'Upstream error\');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user\'s comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we\'ll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we\'ll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error(\'couldn\'t find that author\');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n\n\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n\n /**\n `finally` will be invoked regardless of the promise\'s fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn\'t affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n\n\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n\n if (isFunction(callback)) {\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n }\n\n return promise.then(callback, callback);\n };\n\n return Promise;\n}();\n\nPromise$1.prototype.then = then;\nPromise$1.all = all;\nPromise$1.race = race;\nPromise$1.resolve = resolve$1;\nPromise$1.reject = reject$1;\nPromise$1._setScheduler = setScheduler;\nPromise$1._setAsap = setAsap;\nPromise$1._asap = asap;\n\n/*global self*/\nfunction polyfill() {\n var local = void 0;\n\n if (typeof global !== \'undefined\') {\n local = global;\n } else if (typeof self !== \'undefined\') {\n local = self;\n } else {\n try {\n local = Function(\'return this\')();\n } catch (e) {\n throw new Error(\'polyfill failed because global object is unavailable in this environment\');\n }\n }\n\n var P = local.Promise;\n\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n } catch (e) {\n // silently ignored\n }\n\n if (promiseToString === \'[object Promise]\' && !P.cast) {\n return;\n }\n }\n\n local.Promise = Promise$1;\n}\n\n// Strange compat..\nPromise$1.polyfill = polyfill;\nPromise$1.Promise = Promise$1;\n\nreturn Promise$1;\n\n})));\n\n\n\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_124082__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"), __nested_webpack_require_124082__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")));\n\n/***/ }),\n\n/***/ "./node_modules/fast-deep-equal/index.js":\n/*!***********************************************!*\\\n !*** ./node_modules/fast-deep-equal/index.js ***!\n \\***********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n\nvar isArray = Array.isArray;\nvar keyList = Object.keys;\nvar hasProp = Object.prototype.hasOwnProperty;\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == \'object\' && typeof b == \'object\') {\n var arrA = isArray(a)\n , arrB = isArray(b)\n , i\n , length\n , key;\n\n if (arrA && arrB) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n if (arrA != arrB) return false;\n\n var dateA = a instanceof Date\n , dateB = b instanceof Date;\n if (dateA != dateB) return false;\n if (dateA && dateB) return a.getTime() == b.getTime();\n\n var regexpA = a instanceof RegExp\n , regexpB = b instanceof RegExp;\n if (regexpA != regexpB) return false;\n if (regexpA && regexpB) return a.toString() == b.toString();\n\n var keys = keyList(a);\n length = keys.length;\n\n if (length !== keyList(b).length)\n return false;\n\n for (i = length; i-- !== 0;)\n if (!hasProp.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n key = keys[i];\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n return a!==a && b!==b;\n};\n\n\n/***/ }),\n\n/***/ "./node_modules/ieee754/index.js":\n/*!***************************************!*\\\n !*** ./node_modules/ieee754/index.js ***!\n \\***************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m;\n var eLen = (nBytes * 8) - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var nBits = -7;\n var i = isLE ? (nBytes - 1) : 0;\n var d = isLE ? -1 : 1;\n var s = buffer[offset + i];\n\n i += d;\n\n e = s & ((1 << (-nBits)) - 1);\n s >>= (-nBits);\n nBits += eLen;\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1);\n e >>= (-nBits);\n nBits += mLen;\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias;\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen);\n e = e - eBias;\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n};\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c;\n var eLen = (nBytes * 8) - mLen - 1;\n var eMax = (1 << eLen) - 1;\n var eBias = eMax >> 1;\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0);\n var i = isLE ? 0 : (nBytes - 1);\n var d = isLE ? 1 : -1;\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0;\n\n value = Math.abs(value);\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0;\n e = eMax;\n } else {\n e = Math.floor(Math.log(value) / Math.LN2);\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--;\n c *= 2;\n }\n if (e + eBias >= 1) {\n value += rt / c;\n } else {\n value += rt * Math.pow(2, 1 - eBias);\n }\n if (value * c >= 2) {\n e++;\n c /= 2;\n }\n\n if (e + eBias >= eMax) {\n m = 0;\n e = eMax;\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen);\n e = e + eBias;\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);\n e = 0;\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m;\n eLen += mLen;\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128;\n};\n\n\n/***/ }),\n\n/***/ "./node_modules/imsc/src/main/js/doc.js":\n/*!**********************************************!*\\\n !*** ./node_modules/imsc/src/main/js/doc.js ***!\n \\**********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_157567__) {\n(function (imscDoc, sax, imscNames, imscStyles, imscUtils) {\r\n\r\n\r\n /**\r\n * Allows a client to provide callbacks to handle children of the <metadata> element\r\n * @typedef {Object} MetadataHandler\r\n * @property {?OpenTagCallBack} onOpenTag\r\n * @property {?CloseTagCallBack} onCloseTag\r\n * @property {?TextCallBack} onText\r\n */\r\n\r\n /**\r\n * Called when the opening tag of an element node is encountered.\r\n * @callback OpenTagCallBack\r\n * @param {string} ns Namespace URI of the element\r\n * @param {string} name Local name of the element\r\n * @param {Object[]} attributes List of attributes, each consisting of a\r\n * `uri`, `name` and `value`\r\n */\r\n\r\n /**\r\n * Called when the closing tag of an element node is encountered.\r\n * @callback CloseTagCallBack\r\n */\r\n\r\n /**\r\n * Called when a text node is encountered.\r\n * @callback TextCallBack\r\n * @param {string} contents Contents of the text node\r\n */\r\n\r\n /**\r\n * Parses an IMSC1 document into an opaque in-memory representation that exposes\r\n * a single method <pre>getMediaTimeEvents()</pre> that returns a list of time\r\n * offsets (in seconds) of the ISD, i.e. the points in time where the visual\r\n * representation of the document change. `metadataHandler` allows the caller to\r\n * be called back when nodes are present in <metadata> elements. \r\n * \r\n * @param {string} xmlstring XML document\r\n * @param {?module:imscUtils.ErrorHandler} errorHandler Error callback\r\n * @param {?MetadataHandler} metadataHandler Callback for <Metadata> elements\r\n * @returns {Object} Opaque in-memory representation of an IMSC1 document\r\n */\r\n\r\n imscDoc.fromXML = function (xmlstring, errorHandler, metadataHandler) {\r\n var p = sax.parser(true, {xmlns: true});\r\n var estack = [];\r\n var xmllangstack = [];\r\n var xmlspacestack = [];\r\n var metadata_depth = 0;\r\n var doc = null;\r\n\r\n p.onclosetag = function (node) {\r\n\r\n if (estack[0] instanceof Styling) {\r\n\r\n /* flatten chained referential styling */\r\n\r\n for (var sid in estack[0].styles) {\r\n\r\n mergeChainedStyles(estack[0], estack[0].styles[sid], errorHandler);\r\n\r\n }\r\n\r\n } else if (estack[0] instanceof P || estack[0] instanceof Span) {\r\n\r\n /* merge anonymous spans */\r\n\r\n if (estack[0].contents.length > 1) {\r\n\r\n var cs = [estack[0].contents[0]];\r\n\r\n var c;\r\n\r\n for (c = 1; c < estack[0].contents.length; c++) {\r\n\r\n if (estack[0].contents[c] instanceof AnonymousSpan &&\r\n cs[cs.length - 1] instanceof AnonymousSpan) {\r\n\r\n cs[cs.length - 1].text += estack[0].contents[c].text;\r\n\r\n } else {\r\n\r\n cs.push(estack[0].contents[c]);\r\n\r\n }\r\n\r\n }\r\n\r\n estack[0].contents = cs;\r\n\r\n }\r\n\r\n // remove redundant nested anonymous spans (9.3.3(1)(c))\r\n\r\n if (estack[0] instanceof Span &&\r\n estack[0].contents.length === 1 &&\r\n estack[0].contents[0] instanceof AnonymousSpan) {\r\n\r\n estack[0].text = estack[0].contents[0].text;\r\n delete estack[0].contents;\r\n\r\n }\r\n\r\n } else if (estack[0] instanceof ForeignElement) {\r\n\r\n if (estack[0].node.uri === imscNames.ns_tt &&\r\n estack[0].node.local === \'metadata\') {\r\n\r\n /* leave the metadata element */\r\n\r\n metadata_depth--;\r\n\r\n } else if (metadata_depth > 0 &&\r\n metadataHandler &&\r\n \'onCloseTag\' in metadataHandler) {\r\n\r\n /* end of child of metadata element */\r\n\r\n metadataHandler.onCloseTag();\r\n\r\n }\r\n\r\n }\r\n\r\n // TODO: delete stylerefs?\r\n\r\n // maintain the xml:space stack\r\n\r\n xmlspacestack.shift();\r\n\r\n // maintain the xml:lang stack\r\n\r\n xmllangstack.shift();\r\n\r\n // prepare for the next element\r\n\r\n estack.shift();\r\n };\r\n\r\n p.ontext = function (str) {\r\n\r\n if (estack[0] === undefined) ; else if (estack[0] instanceof Span || estack[0] instanceof P) {\r\n\r\n /* create an anonymous span */\r\n\r\n var s = new AnonymousSpan();\r\n\r\n s.initFromText(doc, estack[0], str, xmlspacestack[0], errorHandler);\r\n\r\n estack[0].contents.push(s);\r\n\r\n } else if (estack[0] instanceof ForeignElement &&\r\n metadata_depth > 0 &&\r\n metadataHandler &&\r\n \'onText\' in metadataHandler) {\r\n\r\n /* text node within a child of metadata element */\r\n\r\n metadataHandler.onText(str);\r\n\r\n }\r\n\r\n };\r\n\r\n\r\n p.onopentag = function (node) {\r\n\r\n // maintain the xml:space stack\r\n\r\n var xmlspace = node.attributes["xml:space"];\r\n\r\n if (xmlspace) {\r\n\r\n xmlspacestack.unshift(xmlspace.value);\r\n\r\n } else {\r\n\r\n if (xmlspacestack.length === 0) {\r\n\r\n xmlspacestack.unshift("default");\r\n\r\n } else {\r\n\r\n xmlspacestack.unshift(xmlspacestack[0]);\r\n\r\n }\r\n\r\n }\r\n\r\n /* maintain the xml:lang stack */\r\n\r\n\r\n var xmllang = node.attributes["xml:lang"];\r\n\r\n if (xmllang) {\r\n\r\n xmllangstack.unshift(xmllang.value);\r\n\r\n } else {\r\n\r\n if (xmllangstack.length === 0) {\r\n\r\n xmllangstack.unshift("");\r\n\r\n } else {\r\n\r\n xmllangstack.unshift(xmllangstack[0]);\r\n\r\n }\r\n\r\n }\r\n\r\n\r\n /* process the element */\r\n\r\n if (node.uri === imscNames.ns_tt) {\r\n\r\n if (node.local === \'tt\') {\r\n\r\n if (doc !== null) {\r\n\r\n reportFatal(errorHandler, "Two <tt> elements at (" + this.line + "," + this.column + ")");\r\n\r\n }\r\n\r\n doc = new TT();\r\n\r\n doc.initFromNode(node, errorHandler);\r\n\r\n estack.unshift(doc);\r\n\r\n } else if (node.local === \'head\') {\r\n\r\n if (!(estack[0] instanceof TT)) {\r\n reportFatal(errorHandler, "Parent of <head> element is not <tt> at (" + this.line + "," + this.column + ")");\r\n }\r\n\r\n if (doc.head !== null) {\r\n reportFatal("Second <head> element at (" + this.line + "," + this.column + ")");\r\n }\r\n\r\n doc.head = new Head();\r\n\r\n estack.unshift(doc.head);\r\n\r\n } else if (node.local === \'styling\') {\r\n\r\n if (!(estack[0] instanceof Head)) {\r\n reportFatal(errorHandler, "Parent of <styling> element is not <head> at (" + this.line + "," + this.column + ")");\r\n }\r\n\r\n if (doc.head.styling !== null) {\r\n reportFatal("Second <styling> element at (" + this.line + "," + this.column + ")");\r\n }\r\n\r\n doc.head.styling = new Styling();\r\n\r\n estack.unshift(doc.head.styling);\r\n\r\n } else if (node.local === \'style\') {\r\n\r\n var s;\r\n\r\n if (estack[0] instanceof Styling) {\r\n\r\n s = new Style();\r\n\r\n s.initFromNode(node, errorHandler);\r\n\r\n /* ignore <style> element missing @id */\r\n\r\n if (!s.id) {\r\n\r\n reportError(errorHandler, "<style> element missing @id attribute");\r\n\r\n } else {\r\n\r\n doc.head.styling.styles[s.id] = s;\r\n\r\n }\r\n\r\n estack.unshift(s);\r\n\r\n } else if (estack[0] instanceof Region) {\r\n\r\n /* nested styles can be merged with specified styles\r\n * immediately, with lower priority\r\n * (see 8.4.4.2(3) at TTML1 )\r\n */\r\n\r\n s = new Style();\r\n\r\n s.initFromNode(node, errorHandler);\r\n\r\n mergeStylesIfNotPresent(s.styleAttrs, estack[0].styleAttrs);\r\n\r\n estack.unshift(s);\r\n\r\n } else {\r\n\r\n reportFatal(errorHandler, "Parent of <style> element is not <styling> or <region> at (" + this.line + "," + this.column + ")");\r\n\r\n }\r\n\r\n } else if (node.local === \'layout\') {\r\n\r\n if (!(estack[0] instanceof Head)) {\r\n\r\n reportFatal(errorHandler, "Parent of <layout> element is not <head> at " + this.line + "," + this.column + ")");\r\n\r\n }\r\n\r\n if (doc.head.layout !== null) {\r\n\r\n reportFatal(errorHandler, "Second <layout> element at " + this.line + "," + this.column + ")");\r\n\r\n }\r\n\r\n doc.head.layout = new Layout();\r\n\r\n estack.unshift(doc.head.layout);\r\n\r\n } else if (node.local === \'region\') {\r\n\r\n if (!(estack[0] instanceof Layout)) {\r\n reportFatal(errorHandler, "Parent of <region> element is not <layout> at " + this.line + "," + this.column + ")");\r\n }\r\n\r\n var r = new Region();\r\n\r\n r.initFromNode(doc, node, errorHandler);\r\n\r\n if (!r.id || r.id in doc.head.layout.regions) {\r\n\r\n reportError(errorHandler, "Ignoring <region> with duplicate or missing @id at " + this.line + "," + this.column + ")");\r\n\r\n } else {\r\n\r\n doc.head.layout.regions[r.id] = r;\r\n\r\n }\r\n\r\n estack.unshift(r);\r\n\r\n } else if (node.local === \'body\') {\r\n\r\n if (!(estack[0] instanceof TT)) {\r\n\r\n reportFatal(errorHandler, "Parent of <body> element is not <tt> at " + this.line + "," + this.column + ")");\r\n\r\n }\r\n\r\n if (doc.body !== null) {\r\n\r\n reportFatal(errorHandler, "Second <body> element at " + this.line + "," + this.column + ")");\r\n\r\n }\r\n\r\n var b = new Body();\r\n\r\n b.initFromNode(doc, node, errorHandler);\r\n\r\n doc.body = b;\r\n\r\n estack.unshift(b);\r\n\r\n } else if (node.local === \'div\') {\r\n\r\n if (!(estack[0] instanceof Div || estack[0] instanceof Body)) {\r\n\r\n reportFatal(errorHandler, "Parent of <div> element is not <body> or <div> at " + this.line + "," + this.column + ")");\r\n\r\n }\r\n\r\n var d = new Div();\r\n\r\n d.initFromNode(doc, estack[0], node, errorHandler);\r\n\r\n estack[0].contents.push(d);\r\n\r\n estack.unshift(d);\r\n\r\n } else if (node.local === \'p\') {\r\n\r\n if (!(estack[0] instanceof Div)) {\r\n\r\n reportFatal(errorHandler, "Parent of <p> element is not <div> at " + this.line + "," + this.column + ")");\r\n\r\n }\r\n\r\n var p = new P();\r\n\r\n p.initFromNode(doc, estack[0], node, errorHandler);\r\n\r\n estack[0].contents.push(p);\r\n\r\n estack.unshift(p);\r\n\r\n } else if (node.local === \'span\') {\r\n\r\n if (!(estack[0] instanceof Span || estack[0] instanceof P)) {\r\n\r\n reportFatal(errorHandler, "Parent of <span> element is not <span> or <p> at " + this.line + "," + this.column + ")");\r\n\r\n }\r\n\r\n var ns = new Span();\r\n\r\n ns.initFromNode(doc, estack[0], node, xmlspacestack[0], errorHandler);\r\n\r\n estack[0].contents.push(ns);\r\n\r\n estack.unshift(ns);\r\n\r\n } else if (node.local === \'br\') {\r\n\r\n if (!(estack[0] instanceof Span || estack[0] instanceof P)) {\r\n\r\n reportFatal(errorHandler, "Parent of <br> element is not <span> or <p> at " + this.line + "," + this.column + ")");\r\n\r\n }\r\n\r\n var nb = new Br();\r\n\r\n nb.initFromNode(doc, estack[0], node, errorHandler);\r\n\r\n estack[0].contents.push(nb);\r\n\r\n estack.unshift(nb);\r\n\r\n } else if (node.local === \'set\') {\r\n\r\n if (!(estack[0] instanceof Span ||\r\n estack[0] instanceof P ||\r\n estack[0] instanceof Div ||\r\n estack[0] instanceof Body ||\r\n estack[0] instanceof Region ||\r\n estack[0] instanceof Br)) {\r\n\r\n reportFatal(errorHandler, "Parent of <set> element is not a content element or a region at " + this.line + "," + this.column + ")");\r\n\r\n }\r\n\r\n var st = new Set();\r\n\r\n st.initFromNode(doc, estack[0], node, errorHandler);\r\n\r\n estack[0].sets.push(st);\r\n\r\n estack.unshift(st);\r\n\r\n } else {\r\n\r\n /* element in the TT namespace, but not a content element */\r\n\r\n estack.unshift(new ForeignElement(node));\r\n }\r\n\r\n } else {\r\n\r\n /* ignore elements not in the TTML namespace unless in metadata element */\r\n\r\n estack.unshift(new ForeignElement(node));\r\n\r\n }\r\n\r\n /* handle metadata callbacks */\r\n\r\n if (estack[0] instanceof ForeignElement) {\r\n\r\n if (node.uri === imscNames.ns_tt &&\r\n node.local === \'metadata\') {\r\n\r\n /* enter the metadata element */\r\n\r\n metadata_depth++;\r\n\r\n } else if (\r\n metadata_depth > 0 &&\r\n metadataHandler &&\r\n \'onOpenTag\' in metadataHandler\r\n ) {\r\n\r\n /* start of child of metadata element */\r\n\r\n var attrs = [];\r\n\r\n for (var a in node.attributes) {\r\n attrs[node.attributes[a].uri + " " + node.attributes[a].local] =\r\n {\r\n uri: node.attributes[a].uri,\r\n local: node.attributes[a].local,\r\n value: node.attributes[a].value\r\n };\r\n }\r\n\r\n metadataHandler.onOpenTag(node.uri, node.local, attrs);\r\n\r\n }\r\n\r\n }\r\n\r\n };\r\n\r\n // parse the document\r\n\r\n p.write(xmlstring).close();\r\n\r\n // all referential styling has been flatten, so delete the styling elements if there is a head\r\n // otherwise create an empty head\r\n\r\n if (doc.head !== null) {\r\n delete doc.head.styling;\r\n } else {\r\n doc.head = new Head();\r\n }\r\n\r\n // create default region if no regions specified\r\n\r\n if (doc.head.layout === null) {\r\n\r\n doc.head.layout = new Layout();\r\n\r\n }\r\n\r\n var hasRegions = false;\r\n\r\n /* AFAIK the only way to determine whether an object has members */\r\n\r\n for (var i in doc.head.layout.regions) {\r\n\r\n hasRegions = true;\r\n\r\n break;\r\n\r\n }\r\n\r\n if (!hasRegions) {\r\n\r\n /* create default region */\r\n\r\n var dr = Region.prototype.createDefaultRegion();\r\n\r\n doc.head.layout.regions[dr.id] = dr;\r\n\r\n }\r\n\r\n /* resolve desired timing for regions */\r\n\r\n for (var region_i in doc.head.layout.regions) {\r\n\r\n resolveTiming(doc, doc.head.layout.regions[region_i], null, null);\r\n\r\n }\r\n\r\n /* resolve desired timing for content elements */\r\n\r\n if (doc.body) {\r\n resolveTiming(doc, doc.body, null, null);\r\n }\r\n\r\n return doc;\r\n };\r\n\r\n function resolveTiming(doc, element, prev_sibling, parent) {\r\n\r\n /* are we in a seq container? */\r\n\r\n var isinseq = parent && parent.timeContainer === "seq";\r\n\r\n /* determine implicit begin */\r\n\r\n var implicit_begin = 0; /* default */\r\n\r\n if (parent) {\r\n\r\n if (isinseq && prev_sibling) {\r\n\r\n /*\r\n * if seq time container, offset from the previous sibling end\r\n */\r\n\r\n implicit_begin = prev_sibling.end;\r\n\r\n\r\n } else {\r\n\r\n implicit_begin = parent.begin;\r\n\r\n }\r\n\r\n }\r\n\r\n /* compute desired begin */\r\n\r\n element.begin = element.explicit_begin ? element.explicit_begin + implicit_begin : implicit_begin;\r\n\r\n\r\n /* determine implicit end */\r\n\r\n var implicit_end = element.begin;\r\n\r\n var s = null;\r\n\r\n for (var set_i in element.sets) {\r\n\r\n resolveTiming(doc, element.sets[set_i], s, element);\r\n\r\n if (element.timeContainer === "seq") {\r\n\r\n implicit_end = element.sets[set_i].end;\r\n\r\n } else {\r\n\r\n implicit_end = Math.max(implicit_end, element.sets[set_i].end);\r\n\r\n }\r\n\r\n s = element.sets[set_i];\r\n\r\n }\r\n\r\n if (!(\'contents\' in element)) {\r\n\r\n /* anonymous spans and regions and <set> and <br>s and spans with only children text nodes */\r\n\r\n if (isinseq) {\r\n\r\n /* in seq container, implicit duration is zero */\r\n\r\n implicit_end = element.begin;\r\n\r\n } else {\r\n\r\n /* in par container, implicit duration is indefinite */\r\n\r\n implicit_end = Number.POSITIVE_INFINITY;\r\n\r\n }\r\n\r\n } else {\r\n\r\n for (var content_i in element.contents) {\r\n\r\n resolveTiming(doc, element.contents[content_i], s, element);\r\n\r\n if (element.timeContainer === "seq") {\r\n\r\n implicit_end = element.contents[content_i].end;\r\n\r\n } else {\r\n\r\n implicit_end = Math.max(implicit_end, element.contents[content_i].end);\r\n\r\n }\r\n\r\n s = element.contents[content_i];\r\n\r\n }\r\n\r\n }\r\n\r\n /* determine desired end */\r\n /* it is never made really clear in SMIL that the explicit end is offset by the implicit begin */\r\n\r\n if (element.explicit_end !== null && element.explicit_dur !== null) {\r\n\r\n element.end = Math.min(element.begin + element.explicit_dur, implicit_begin + element.explicit_end);\r\n\r\n } else if (element.explicit_end === null && element.explicit_dur !== null) {\r\n\r\n element.end = element.begin + element.explicit_dur;\r\n\r\n } else if (element.explicit_end !== null && element.explicit_dur === null) {\r\n\r\n element.end = implicit_begin + element.explicit_end;\r\n\r\n } else {\r\n\r\n element.end = implicit_end;\r\n }\r\n\r\n delete element.explicit_begin;\r\n delete element.explicit_dur;\r\n delete element.explicit_end;\r\n\r\n doc._registerEvent(element);\r\n\r\n }\r\n\r\n function ForeignElement(node) {\r\n this.node = node;\r\n }\r\n\r\n function TT() {\r\n this.events = [];\r\n this.head = null;\r\n this.body = null;\r\n }\r\n\r\n TT.prototype.initFromNode = function (node, errorHandler) {\r\n\r\n /* compute cell resolution */\r\n\r\n this.cellResolution = extractCellResolution(node, errorHandler);\r\n\r\n /* extract frame rate and tick rate */\r\n\r\n var frtr = extractFrameAndTickRate(node, errorHandler);\r\n\r\n this.effectiveFrameRate = frtr.effectiveFrameRate;\r\n\r\n this.tickRate = frtr.tickRate;\r\n\r\n /* extract aspect ratio */\r\n\r\n this.aspectRatio = extractAspectRatio(node, errorHandler);\r\n\r\n /* check timebase */\r\n\r\n var attr = findAttribute(node, imscNames.ns_ttp, "timeBase");\r\n\r\n if (attr !== null && attr !== "media") {\r\n\r\n reportFatal(errorHandler, "Unsupported time base");\r\n\r\n }\r\n\r\n /* retrieve extent */\r\n\r\n var e = extractExtent(node, errorHandler);\r\n\r\n if (e === null) {\r\n\r\n /* TODO: remove once unit tests are ready */\r\n\r\n this.pxDimensions = {\'h\': 480, \'w\': 640};\r\n\r\n } else {\r\n\r\n if (e.h.unit !== "px" || e.w.unit !== "px") {\r\n reportFatal(errorHandler, "Extent on TT must be in px or absent");\r\n }\r\n\r\n this.pxDimensions = {\'h\': e.h.value, \'w\': e.w.value};\r\n }\r\n\r\n };\r\n\r\n /* register a temporal events */\r\n TT.prototype._registerEvent = function (elem) {\r\n\r\n /* skip if begin is not < then end */\r\n\r\n if (elem.end <= elem.begin)\r\n return;\r\n\r\n /* index the begin time of the event */\r\n\r\n var b_i = indexOf(this.events, elem.begin);\r\n\r\n if (!b_i.found) {\r\n this.events.splice(b_i.index, 0, elem.begin);\r\n }\r\n\r\n /* index the end time of the event */\r\n\r\n if (elem.end !== Number.POSITIVE_INFINITY) {\r\n\r\n var e_i = indexOf(this.events, elem.end);\r\n\r\n if (!e_i.found) {\r\n this.events.splice(e_i.index, 0, elem.end);\r\n }\r\n\r\n }\r\n\r\n };\r\n\r\n\r\n /*\r\n * Retrieves the range of ISD times covered by the document\r\n * \r\n * @returns {Array} Array of two elements: min_begin_time and max_begin_time\r\n * \r\n */\r\n TT.prototype.getMediaTimeRange = function () {\r\n\r\n return [this.events[0], this.events[this.events.length - 1]];\r\n };\r\n\r\n /*\r\n * Returns list of ISD begin times \r\n * \r\n * @returns {Array}\r\n */\r\n TT.prototype.getMediaTimeEvents = function () {\r\n\r\n return this.events;\r\n };\r\n\r\n /*\r\n * Represents a TTML Head element\r\n */\r\n\r\n function Head() {\r\n this.styling = null;\r\n this.layout = null;\r\n }\r\n\r\n /*\r\n * Represents a TTML Styling element\r\n */\r\n\r\n function Styling() {\r\n this.styles = {};\r\n }\r\n\r\n /*\r\n * Represents a TTML Style element\r\n */\r\n\r\n function Style() {\r\n this.id = null;\r\n this.styleAttrs = null;\r\n this.styleRefs = null;\r\n }\r\n\r\n Style.prototype.initFromNode = function (node, errorHandler) {\r\n this.id = elementGetXMLID(node);\r\n this.styleAttrs = elementGetStyles(node, errorHandler);\r\n this.styleRefs = elementGetStyleRefs(node);\r\n };\r\n\r\n /*\r\n * Represents a TTML Layout element\r\n * \r\n */\r\n\r\n function Layout() {\r\n this.regions = {};\r\n }\r\n\r\n /*\r\n * TTML element utility functions\r\n * \r\n */\r\n\r\n function ContentElement(kind) {\r\n this.kind = kind;\r\n }\r\n\r\n function IdentifiedElement(id) {\r\n this.id = id;\r\n }\r\n\r\n IdentifiedElement.prototype.initFromNode = function (doc, parent, node, errorHandler) {\r\n this.id = elementGetXMLID(node);\r\n };\r\n\r\n function LayoutElement(id) {\r\n this.regionID = id;\r\n }\r\n\r\n LayoutElement.prototype.initFromNode = function (doc, parent, node, errorHandler) {\r\n this.regionID = elementGetRegionID(node);\r\n };\r\n\r\n function StyledElement(styleAttrs) {\r\n this.styleAttrs = styleAttrs;\r\n }\r\n\r\n StyledElement.prototype.initFromNode = function (doc, parent, node, errorHandler) {\r\n\r\n this.styleAttrs = elementGetStyles(node, errorHandler);\r\n\r\n if (doc.head !== null && doc.head.styling !== null) {\r\n mergeReferencedStyles(doc.head.styling, elementGetStyleRefs(node), this.styleAttrs, errorHandler);\r\n }\r\n\r\n };\r\n\r\n function AnimatedElement(sets) {\r\n this.sets = sets;\r\n }\r\n\r\n AnimatedElement.prototype.initFromNode = function (doc, parent, node, errorHandler) {\r\n this.sets = [];\r\n };\r\n\r\n function ContainerElement(contents) {\r\n this.contents = contents;\r\n }\r\n\r\n ContainerElement.prototype.initFromNode = function (doc, parent, node, errorHandler) {\r\n this.contents = [];\r\n };\r\n\r\n function TimedElement(explicit_begin, explicit_end, explicit_dur) {\r\n this.explicit_begin = explicit_begin;\r\n this.explicit_end = explicit_end;\r\n this.explicit_dur = explicit_dur;\r\n }\r\n\r\n TimedElement.prototype.initFromNode = function (doc, parent, node, errorHandler) {\r\n var t = processTiming(doc, parent, node, errorHandler);\r\n this.explicit_begin = t.explicit_begin;\r\n this.explicit_end = t.explicit_end;\r\n this.explicit_dur = t.explicit_dur;\r\n\r\n this.timeContainer = elementGetTimeContainer(node, errorHandler);\r\n };\r\n\r\n\r\n /*\r\n * Represents a TTML body element\r\n */\r\n\r\n\r\n\r\n function Body() {\r\n ContentElement.call(this, \'body\');\r\n }\r\n\r\n\r\n Body.prototype.initFromNode = function (doc, node, errorHandler) {\r\n StyledElement.prototype.initFromNode.call(this, doc, null, node, errorHandler);\r\n TimedElement.prototype.initFromNode.call(this, doc, null, node, errorHandler);\r\n AnimatedElement.prototype.initFromNode.call(this, doc, null, node, errorHandler);\r\n LayoutElement.prototype.initFromNode.call(this, doc, null, node, errorHandler);\r\n ContainerElement.prototype.initFromNode.call(this, doc, null, node, errorHandler);\r\n };\r\n\r\n /*\r\n * Represents a TTML div element\r\n */\r\n\r\n function Div() {\r\n ContentElement.call(this, \'div\');\r\n }\r\n\r\n Div.prototype.initFromNode = function (doc, parent, node, errorHandler) {\r\n StyledElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n TimedElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n AnimatedElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n LayoutElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n ContainerElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n };\r\n\r\n /*\r\n * Represents a TTML p element\r\n */\r\n\r\n function P() {\r\n ContentElement.call(this, \'p\');\r\n }\r\n\r\n P.prototype.initFromNode = function (doc, parent, node, errorHandler) {\r\n StyledElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n TimedElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n AnimatedElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n LayoutElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n ContainerElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n };\r\n\r\n /*\r\n * Represents a TTML span element\r\n */\r\n\r\n function Span() {\r\n ContentElement.call(this, \'span\');\r\n }\r\n\r\n Span.prototype.initFromNode = function (doc, parent, node, xmlspace, errorHandler) {\r\n StyledElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n TimedElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n AnimatedElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n LayoutElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n ContainerElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n\r\n this.space = xmlspace;\r\n };\r\n\r\n /*\r\n * Represents a TTML anonymous span element\r\n */\r\n\r\n function AnonymousSpan() {\r\n ContentElement.call(this, \'span\');\r\n }\r\n\r\n AnonymousSpan.prototype.initFromText = function (doc, parent, text, xmlspace, errorHandler) {\r\n TimedElement.prototype.initFromNode.call(this, doc, parent, null, errorHandler);\r\n\r\n this.text = text;\r\n this.space = xmlspace;\r\n };\r\n\r\n /*\r\n * Represents a TTML br element\r\n */\r\n\r\n function Br() {\r\n ContentElement.call(this, \'br\');\r\n }\r\n\r\n Br.prototype.initFromNode = function (doc, parent, node, errorHandler) {\r\n LayoutElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n TimedElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n };\r\n\r\n /*\r\n * Represents a TTML Region element\r\n * \r\n */\r\n\r\n function Region() {\r\n }\r\n\r\n Region.prototype.createDefaultRegion = function () {\r\n var r = new Region();\r\n\r\n IdentifiedElement.call(r, \'\');\r\n StyledElement.call(r, {});\r\n AnimatedElement.call(r, []);\r\n TimedElement.call(r, 0, Number.POSITIVE_INFINITY, null);\r\n\r\n return r;\r\n };\r\n\r\n Region.prototype.initFromNode = function (doc, node, errorHandler) {\r\n IdentifiedElement.prototype.initFromNode.call(this, doc, null, node, errorHandler);\r\n StyledElement.prototype.initFromNode.call(this, doc, null, node, errorHandler);\r\n TimedElement.prototype.initFromNode.call(this, doc, null, node, errorHandler);\r\n AnimatedElement.prototype.initFromNode.call(this, doc, null, node, errorHandler);\r\n\r\n /* immediately merge referenced styles */\r\n\r\n if (doc.head !== null && doc.head.styling !== null) {\r\n mergeReferencedStyles(doc.head.styling, elementGetStyleRefs(node), this.styleAttrs, errorHandler);\r\n }\r\n\r\n };\r\n\r\n /*\r\n * Represents a TTML Set element\r\n * \r\n */\r\n\r\n function Set() {\r\n }\r\n\r\n Set.prototype.initFromNode = function (doc, parent, node, errorHandler) {\r\n\r\n TimedElement.prototype.initFromNode.call(this, doc, parent, node, errorHandler);\r\n\r\n var styles = elementGetStyles(node, errorHandler);\r\n\r\n this.qname = null;\r\n this.value = null;\r\n\r\n for (var qname in styles) {\r\n\r\n if (this.qname) {\r\n\r\n reportError(errorHandler, "More than one style specified on set");\r\n break;\r\n\r\n }\r\n\r\n this.qname = qname;\r\n this.value = styles[qname];\r\n\r\n }\r\n\r\n };\r\n\r\n /*\r\n * Utility functions\r\n * \r\n */\r\n\r\n\r\n function elementGetXMLID(node) {\r\n return node && \'xml:id\' in node.attributes ? node.attributes[\'xml:id\'].value || null : null;\r\n }\r\n\r\n function elementGetRegionID(node) {\r\n return node && \'region\' in node.attributes ? node.attributes.region.value : \'\';\r\n }\r\n\r\n function elementGetTimeContainer(node, errorHandler) {\r\n\r\n var tc = node && \'timeContainer\' in node.attributes ? node.attributes.timeContainer.value : null;\r\n\r\n if ((!tc) || tc === "par") {\r\n\r\n return "par";\r\n\r\n } else if (tc === "seq") {\r\n\r\n return "seq";\r\n\r\n } else {\r\n\r\n reportError(errorHandler, "Illegal value of timeContainer (assuming \'par\')");\r\n\r\n return "par";\r\n\r\n }\r\n\r\n }\r\n\r\n function elementGetStyleRefs(node) {\r\n\r\n return node && \'style\' in node.attributes ? node.attributes.style.value.split(" ") : [];\r\n\r\n }\r\n\r\n function elementGetStyles(node, errorHandler) {\r\n\r\n var s = {};\r\n\r\n if (node !== null) {\r\n\r\n for (var i in node.attributes) {\r\n\r\n var qname = node.attributes[i].uri + " " + node.attributes[i].local;\r\n\r\n var sa = imscStyles.byQName[qname];\r\n\r\n if (sa !== undefined) {\r\n\r\n var val = sa.parse(node.attributes[i].value);\r\n\r\n if (val !== null) {\r\n\r\n s[qname] = val;\r\n\r\n /* TODO: consider refactoring errorHandler into parse and compute routines */\r\n\r\n if (sa === imscStyles.byName.zIndex) {\r\n reportWarning(errorHandler, "zIndex attribute present but not used by IMSC1 since regions do not overlap");\r\n }\r\n\r\n } else {\r\n\r\n reportError(errorHandler, "Cannot parse styling attribute " + qname + " --\x3e " + node.attributes[i].value);\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n return s;\r\n }\r\n\r\n function findAttribute(node, ns, name) {\r\n for (var i in node.attributes) {\r\n\r\n if (node.attributes[i].uri === ns &&\r\n node.attributes[i].local === name) {\r\n\r\n return node.attributes[i].value;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n function extractAspectRatio(node, errorHandler) {\r\n\r\n var ar = findAttribute(node, imscNames.ns_ittp, "aspectRatio");\r\n\r\n var rslt = null;\r\n\r\n if (ar !== null) {\r\n\r\n var ASPECT_RATIO_RE = /(\\d+) (\\d+)/;\r\n\r\n var m = ASPECT_RATIO_RE.exec(ar);\r\n\r\n if (m !== null) {\r\n\r\n var w = parseInt(m[1]);\r\n\r\n var h = parseInt(m[2]);\r\n\r\n if (w !== 0 && h !== 0) {\r\n\r\n rslt = w / h;\r\n\r\n } else {\r\n\r\n reportError(errorHandler, "Illegal aspectRatio values (ignoring)");\r\n }\r\n\r\n } else {\r\n\r\n reportError(errorHandler, "Malformed aspectRatio attribute (ignoring)");\r\n }\r\n\r\n }\r\n\r\n return rslt;\r\n\r\n }\r\n\r\n /*\r\n * Returns the cellResolution attribute from a node\r\n * \r\n */\r\n function extractCellResolution(node, errorHandler) {\r\n\r\n var cr = findAttribute(node, imscNames.ns_ttp, "cellResolution");\r\n\r\n // initial value\r\n\r\n var h = 15;\r\n var w = 32;\r\n\r\n if (cr !== null) {\r\n\r\n var CELL_RESOLUTION_RE = /(\\d+) (\\d+)/;\r\n\r\n var m = CELL_RESOLUTION_RE.exec(cr);\r\n\r\n if (m !== null) {\r\n\r\n w = parseInt(m[1]);\r\n\r\n h = parseInt(m[2]);\r\n\r\n } else {\r\n\r\n reportWarning(errorHandler, "Malformed cellResolution value (using initial value instead)");\r\n\r\n }\r\n\r\n }\r\n\r\n return {\'w\': w, \'h\': h};\r\n\r\n }\r\n\r\n\r\n function extractFrameAndTickRate(node, errorHandler) {\r\n\r\n // subFrameRate is ignored per IMSC1 specification\r\n\r\n // extract frame rate\r\n\r\n var fps_attr = findAttribute(node, imscNames.ns_ttp, "frameRate");\r\n\r\n // initial value\r\n\r\n var fps = 30;\r\n\r\n // match variable\r\n\r\n var m;\r\n\r\n if (fps_attr !== null) {\r\n\r\n var FRAME_RATE_RE = /(\\d+)/;\r\n\r\n m = FRAME_RATE_RE.exec(fps_attr);\r\n\r\n if (m !== null) {\r\n\r\n fps = parseInt(m[1]);\r\n\r\n } else {\r\n\r\n reportWarning(errorHandler, "Malformed frame rate attribute (using initial value instead)");\r\n }\r\n\r\n }\r\n\r\n // extract frame rate multiplier\r\n\r\n var frm_attr = findAttribute(node, imscNames.ns_ttp, "frameRateMultiplier");\r\n\r\n // initial value\r\n\r\n var frm = 1;\r\n\r\n if (frm_attr !== null) {\r\n\r\n var FRAME_RATE_MULT_RE = /(\\d+) (\\d+)/;\r\n\r\n m = FRAME_RATE_MULT_RE.exec(frm_attr);\r\n\r\n if (m !== null) {\r\n\r\n frm = parseInt(m[1]) / parseInt(m[2]);\r\n\r\n } else {\r\n\r\n reportWarning(errorHandler, "Malformed frame rate multiplier attribute (using initial value instead)");\r\n }\r\n\r\n }\r\n\r\n var efps = frm * fps;\r\n\r\n // extract tick rate\r\n\r\n var tr = 1;\r\n\r\n var trattr = findAttribute(node, imscNames.ns_ttp, "tickRate");\r\n\r\n if (trattr === null) {\r\n\r\n if (fps_attr !== null)\r\n tr = efps;\r\n\r\n } else {\r\n\r\n var TICK_RATE_RE = /(\\d+)/;\r\n\r\n m = TICK_RATE_RE.exec(trattr);\r\n\r\n if (m !== null) {\r\n\r\n tr = parseInt(m[1]);\r\n\r\n } else {\r\n\r\n reportWarning(errorHandler, "Malformed tick rate attribute (using initial value instead)");\r\n }\r\n\r\n }\r\n\r\n return {effectiveFrameRate: efps, tickRate: tr};\r\n\r\n }\r\n\r\n function extractExtent(node, errorHandler) {\r\n\r\n var attr = findAttribute(node, imscNames.ns_tts, "extent");\r\n\r\n if (attr === null)\r\n return null;\r\n\r\n var s = attr.split(" ");\r\n\r\n if (s.length !== 2) {\r\n\r\n reportWarning(errorHandler, "Malformed extent (ignoring)");\r\n\r\n return null;\r\n }\r\n\r\n var w = imscUtils.parseLength(s[0]);\r\n\r\n var h = imscUtils.parseLength(s[1]);\r\n\r\n if (!h || !w) {\r\n\r\n reportWarning(errorHandler, "Malformed extent values (ignoring)");\r\n\r\n return null;\r\n }\r\n\r\n return {\'h\': h, \'w\': w};\r\n\r\n }\r\n\r\n function parseTimeExpression(tickRate, effectiveFrameRate, str) {\r\n\r\n var CLOCK_TIME_FRACTION_RE = /^(\\d{2,}):(\\d\\d):(\\d\\d(?:\\.\\d+)?)$/;\r\n var CLOCK_TIME_FRAMES_RE = /^(\\d{2,}):(\\d\\d):(\\d\\d)\\:(\\d{2,})$/;\r\n var OFFSET_FRAME_RE = /^(\\d+(?:\\.\\d+)?)f$/;\r\n var OFFSET_TICK_RE = /^(\\d+(?:\\.\\d+)?)t$/;\r\n var OFFSET_MS_RE = /^(\\d+(?:\\.\\d+)?)ms$/;\r\n var OFFSET_S_RE = /^(\\d+(?:\\.\\d+)?)s$/;\r\n var OFFSET_H_RE = /^(\\d+(?:\\.\\d+)?)h$/;\r\n var OFFSET_M_RE = /^(\\d+(?:\\.\\d+)?)m$/;\r\n var m;\r\n var r = null;\r\n if ((m = OFFSET_FRAME_RE.exec(str)) !== null) {\r\n\r\n if (effectiveFrameRate !== null) {\r\n\r\n r = parseFloat(m[1]) / effectiveFrameRate;\r\n }\r\n\r\n } else if ((m = OFFSET_TICK_RE.exec(str)) !== null) {\r\n\r\n if (tickRate !== null) {\r\n\r\n r = parseFloat(m[1]) / tickRate;\r\n }\r\n\r\n } else if ((m = OFFSET_MS_RE.exec(str)) !== null) {\r\n\r\n r = parseFloat(m[1]) / 1000.0;\r\n\r\n } else if ((m = OFFSET_S_RE.exec(str)) !== null) {\r\n\r\n r = parseFloat(m[1]);\r\n\r\n } else if ((m = OFFSET_H_RE.exec(str)) !== null) {\r\n\r\n r = parseFloat(m[1]) * 3600.0;\r\n\r\n } else if ((m = OFFSET_M_RE.exec(str)) !== null) {\r\n\r\n r = parseFloat(m[1]) * 60.0;\r\n\r\n } else if ((m = CLOCK_TIME_FRACTION_RE.exec(str)) !== null) {\r\n\r\n r = parseInt(m[1]) * 3600 +\r\n parseInt(m[2]) * 60 +\r\n parseFloat(m[3]);\r\n\r\n } else if ((m = CLOCK_TIME_FRAMES_RE.exec(str)) !== null) {\r\n\r\n /* this assumes that HH:MM:SS is a clock-time-with-fraction */\r\n\r\n if (effectiveFrameRate !== null) {\r\n\r\n r = parseInt(m[1]) * 3600 +\r\n parseInt(m[2]) * 60 +\r\n parseInt(m[3]) +\r\n (m[4] === null ? 0 : parseInt(m[4]) / effectiveFrameRate);\r\n }\r\n\r\n }\r\n\r\n return r;\r\n }\r\n\r\n function processTiming(doc, parent, node, errorHandler) {\r\n\r\n /* determine explicit begin */\r\n\r\n var explicit_begin = null;\r\n\r\n if (node && \'begin\' in node.attributes) {\r\n\r\n explicit_begin = parseTimeExpression(doc.tickRate, doc.effectiveFrameRate, node.attributes.begin.value);\r\n\r\n if (explicit_begin === null) {\r\n\r\n reportWarning(errorHandler, "Malformed begin value " + node.attributes.begin.value + " (using 0)");\r\n\r\n }\r\n\r\n }\r\n\r\n /* determine explicit duration */\r\n\r\n var explicit_dur = null;\r\n\r\n if (node && \'dur\' in node.attributes) {\r\n\r\n explicit_dur = parseTimeExpression(doc.tickRate, doc.effectiveFrameRate, node.attributes.dur.value);\r\n\r\n if (explicit_dur === null) {\r\n\r\n reportWarning(errorHandler, "Malformed dur value " + node.attributes.dur.value + " (ignoring)");\r\n\r\n }\r\n\r\n }\r\n\r\n /* determine explicit end */\r\n\r\n var explicit_end = null;\r\n\r\n if (node && \'end\' in node.attributes) {\r\n\r\n explicit_end = parseTimeExpression(doc.tickRate, doc.effectiveFrameRate, node.attributes.end.value);\r\n\r\n if (explicit_end === null) {\r\n\r\n reportWarning(errorHandler, "Malformed end value (ignoring)");\r\n\r\n }\r\n\r\n }\r\n\r\n return {explicit_begin: explicit_begin,\r\n explicit_end: explicit_end,\r\n explicit_dur: explicit_dur};\r\n\r\n }\r\n\r\n\r\n\r\n function mergeChainedStyles(styling, style, errorHandler) {\r\n\r\n while (style.styleRefs.length > 0) {\r\n\r\n var sref = style.styleRefs.pop();\r\n\r\n if (!(sref in styling.styles)) {\r\n reportError(errorHandler, "Non-existant style id referenced");\r\n continue;\r\n }\r\n\r\n mergeChainedStyles(styling, styling.styles[sref], errorHandler);\r\n\r\n mergeStylesIfNotPresent(styling.styles[sref].styleAttrs, style.styleAttrs);\r\n\r\n }\r\n\r\n }\r\n\r\n function mergeReferencedStyles(styling, stylerefs, styleattrs, errorHandler) {\r\n\r\n for (var i = stylerefs.length - 1; i >= 0; i--) {\r\n\r\n var sref = stylerefs[i];\r\n\r\n if (!(sref in styling.styles)) {\r\n reportError(errorHandler, "Non-existant style id referenced");\r\n continue;\r\n }\r\n\r\n mergeStylesIfNotPresent(styling.styles[sref].styleAttrs, styleattrs);\r\n\r\n }\r\n\r\n }\r\n\r\n function mergeStylesIfNotPresent(from_styles, into_styles) {\r\n\r\n for (var sname in from_styles) {\r\n\r\n if (sname in into_styles)\r\n continue;\r\n\r\n into_styles[sname] = from_styles[sname];\r\n\r\n }\r\n\r\n }\r\n\r\n function reportWarning(errorHandler, msg) {\r\n\r\n if (errorHandler && errorHandler.warn && errorHandler.warn(msg))\r\n throw msg;\r\n\r\n }\r\n\r\n function reportError(errorHandler, msg) {\r\n\r\n if (errorHandler && errorHandler.error && errorHandler.error(msg))\r\n throw msg;\r\n\r\n }\r\n\r\n function reportFatal(errorHandler, msg) {\r\n\r\n if (errorHandler && errorHandler.fatal)\r\n errorHandler.fatal(msg);\r\n\r\n throw msg;\r\n\r\n }\r\n\r\n /*\r\n * Binary search utility function\r\n * \r\n * @typedef {Object} BinarySearchResult\r\n * @property {boolean} found Was an exact match found?\r\n * @property {number} index Position of the exact match or insert position\r\n * \r\n * @returns {BinarySearchResult}\r\n */\r\n\r\n function indexOf(arr, searchval) {\r\n\r\n var min = 0;\r\n var max = arr.length - 1;\r\n var cur;\r\n\r\n while (min <= max) {\r\n\r\n cur = Math.floor((min + max) / 2);\r\n\r\n var curval = arr[cur];\r\n\r\n if (curval < searchval) {\r\n\r\n min = cur + 1;\r\n\r\n } else if (curval > searchval) {\r\n\r\n max = cur - 1;\r\n\r\n } else {\r\n\r\n return {found: true, index: cur};\r\n\r\n }\r\n\r\n }\r\n\r\n return {found: false, index: min};\r\n }\r\n\r\n\r\n})( exports,\r\n typeof sax === \'undefined\' ? __nested_webpack_require_157567__(/*! sax */ "./node_modules/sax/lib/sax.js") : sax,\r\n typeof imscNames === \'undefined\' ? __nested_webpack_require_157567__(/*! ./names */ "./node_modules/imsc/src/main/js/names.js") : imscNames,\r\n typeof imscStyles === \'undefined\' ? __nested_webpack_require_157567__(/*! ./styles */ "./node_modules/imsc/src/main/js/styles.js") : imscStyles,\r\n typeof imscUtils === \'undefined\' ? __nested_webpack_require_157567__(/*! ./utils */ "./node_modules/imsc/src/main/js/utils.js") : imscUtils);\r\n\n\n/***/ }),\n\n/***/ "./node_modules/imsc/src/main/js/html.js":\n/*!***********************************************!*\\\n !*** ./node_modules/imsc/src/main/js/html.js ***!\n \\***********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_202020__) {\n(function (imscHTML, imscNames, imscStyles) {\r\n\r\n /**\r\n * Function that maps <pre>smpte:background</pre> URIs to URLs resolving to image resource\r\n * @callback IMGResolver\r\n * @param {string} <pre>smpte:background</pre> URI\r\n * @return {string} PNG resource URL\r\n */\r\n\r\n\r\n /**\r\n * Renders an ISD object (returned by <pre>generateISD()</pre>) into a \r\n * parent element, that must be attached to the DOM. The ISD will be rendered\r\n * into a child <pre>div</pre>\r\n * with heigh and width equal to the clientHeight and clientWidth of the element,\r\n * unless explicitly specified otherwise by the caller. Images URIs specified \r\n * by <pre>smpte:background</pre> attributes are mapped to image resource URLs\r\n * by an <pre>imgResolver</pre> function. The latter takes the value of <code>smpte:background</code>\r\n * attribute and an <code>img</code> DOM element as input, and is expected to\r\n * set the <code>src</code> attribute of the <code>img</code> to the absolute URI of the image.\r\n * <pre>displayForcedOnlyMode</pre> sets the (boolean)\r\n * value of the IMSC1 displayForcedOnlyMode parameter. The function returns\r\n * an opaque object that should passed in <code>previousISDState</code> when this function\r\n * is called for the next ISD, otherwise <code>previousISDState</code> should be set to \r\n * <code>null</code>.\r\n * \r\n * @param {Object} isd ISD to be rendered\r\n * @param {Object} element Element into which the ISD is rendered\r\n * @param {?IMGResolver} imgResolver Resolve <pre>smpte:background</pre> URIs into URLs.\r\n * @param {?number} eheight Height (in pixel) of the child <div>div</div> or null \r\n * to use clientHeight of the parent element\r\n * @param {?number} ewidth Width (in pixel) of the child <div>div</div> or null\r\n * to use clientWidth of the parent element\r\n * @param {?boolean} displayForcedOnlyMode Value of the IMSC1 displayForcedOnlyMode parameter,\r\n * or false if null \r\n * @param {?module:imscUtils.ErrorHandler} errorHandler Error callback\r\n * @param {Object} previousISDState State saved during processing of the previous ISD, or null if initial call\r\n * @param {?boolean} enableRollUp Enables roll-up animations (see CEA 708)\r\n * @return {Object} ISD state to be provided when this funtion is called for the next ISD\r\n */\r\n\r\n imscHTML.render = function (isd,\r\n element,\r\n imgResolver,\r\n eheight,\r\n ewidth,\r\n displayForcedOnlyMode,\r\n errorHandler,\r\n previousISDState,\r\n enableRollUp\r\n ) {\r\n\r\n /* maintain aspect ratio if specified */\r\n\r\n var height = eheight || element.clientHeight;\r\n var width = ewidth || element.clientWidth;\r\n\r\n if (isd.aspectRatio !== null) {\r\n\r\n var twidth = height * isd.aspectRatio;\r\n\r\n if (twidth > width) {\r\n\r\n height = Math.round(width / isd.aspectRatio);\r\n\r\n } else {\r\n\r\n width = twidth;\r\n\r\n }\r\n\r\n }\r\n\r\n var rootcontainer = document.createElement("div");\r\n\r\n rootcontainer.style.position = "relative";\r\n rootcontainer.style.width = width + "px";\r\n rootcontainer.style.height = height + "px";\r\n rootcontainer.style.margin = "auto";\r\n rootcontainer.style.top = 0;\r\n rootcontainer.style.bottom = 0;\r\n rootcontainer.style.left = 0;\r\n rootcontainer.style.right = 0;\r\n rootcontainer.style.zIndex = 0;\r\n\r\n var context = {\r\n h: height,\r\n w: width,\r\n regionH: null,\r\n regionW: null,\r\n imgResolver: imgResolver,\r\n displayForcedOnlyMode: displayForcedOnlyMode || false,\r\n isd: isd,\r\n errorHandler: errorHandler,\r\n previousISDState: previousISDState,\r\n enableRollUp: enableRollUp || false,\r\n currentISDState: {},\r\n flg: null, /* current fillLineGap value if active, null otherwise */\r\n lp: null, /* current linePadding value if active, null otherwise */\r\n mra: null, /* current multiRowAlign value if active, null otherwise */\r\n ipd: null, /* inline progression direction (lr, rl, tb) */\r\n bpd: null /* block progression direction (lr, rl, tb) */\r\n };\r\n\r\n element.appendChild(rootcontainer);\r\n\r\n for (var i in isd.contents) {\r\n\r\n processElement(context, rootcontainer, isd.contents[i]);\r\n\r\n }\r\n\r\n return context.currentISDState;\r\n\r\n };\r\n\r\n function processElement(context, dom_parent, isd_element) {\r\n\r\n var e;\r\n\r\n if (isd_element.kind === \'region\') {\r\n\r\n e = document.createElement("div");\r\n e.style.position = "absolute";\r\n\r\n } else if (isd_element.kind === \'body\') {\r\n\r\n e = document.createElement("div");\r\n\r\n } else if (isd_element.kind === \'div\') {\r\n\r\n e = document.createElement("div");\r\n\r\n } else if (isd_element.kind === \'p\') {\r\n\r\n e = document.createElement("p");\r\n\r\n } else if (isd_element.kind === \'span\') {\r\n\r\n e = document.createElement("span");\r\n\r\n //e.textContent = isd_element.text;\r\n\r\n } else if (isd_element.kind === \'br\') {\r\n\r\n e = document.createElement("br");\r\n\r\n }\r\n\r\n if (!e) {\r\n\r\n reportError(context.errorHandler, "Error processing ISD element kind: " + isd_element.kind);\r\n\r\n return;\r\n\r\n }\r\n\r\n /* override UA default margin */\r\n /* TODO: should apply to <p> only */\r\n\r\n e.style.margin = "0";\r\n\r\n /* tranform TTML styles to CSS styles */\r\n\r\n for (var i in STYLING_MAP_DEFS) {\r\n\r\n var sm = STYLING_MAP_DEFS[i];\r\n\r\n var attr = isd_element.styleAttrs[sm.qname];\r\n\r\n if (attr !== undefined && sm.map !== null) {\r\n\r\n sm.map(context, e, isd_element, attr);\r\n\r\n }\r\n\r\n }\r\n\r\n var proc_e = e;\r\n\r\n /* remember writing direction */\r\n\r\n if (isd_element.kind === "region") {\r\n\r\n var wdir = isd_element.styleAttrs[imscStyles.byName.writingMode.qname];\r\n\r\n if (wdir === "lrtb" || wdir === "lr") {\r\n\r\n context.ipd = "lr";\r\n context.bpd = "tb";\r\n\r\n } else if (wdir === "rltb" || wdir === "rl") {\r\n\r\n context.ipd = "rl";\r\n context.bpd = "tb";\r\n\r\n } else if (wdir === "tblr") {\r\n\r\n context.ipd = "tb";\r\n context.bpd = "lr";\r\n\r\n } else if (wdir === "tbrl" || wdir === "tb") {\r\n\r\n context.ipd = "tb";\r\n context.bpd = "rl";\r\n\r\n }\r\n\r\n }\r\n\r\n /* do we have linePadding ? */\r\n\r\n var lp = isd_element.styleAttrs[imscStyles.byName.linePadding.qname];\r\n\r\n if (lp && lp > 0) {\r\n\r\n /* apply padding to the <p> so that line padding does not cause line wraps */\r\n\r\n var padmeasure = Math.ceil(lp * context.h) + "px";\r\n\r\n if (context.bpd === "tb") {\r\n\r\n proc_e.style.paddingLeft = padmeasure;\r\n proc_e.style.paddingRight = padmeasure;\r\n\r\n } else {\r\n\r\n proc_e.style.paddingTop = padmeasure;\r\n proc_e.style.paddingBottom = padmeasure;\r\n\r\n }\r\n\r\n context.lp = lp;\r\n }\r\n\r\n // do we have multiRowAlign?\r\n\r\n var mra = isd_element.styleAttrs[imscStyles.byName.multiRowAlign.qname];\r\n\r\n if (mra && mra !== "auto") {\r\n\r\n /* create inline block to handle multirowAlign */\r\n\r\n var s = document.createElement("span");\r\n\r\n s.style.display = "inline-block";\r\n\r\n s.style.textAlign = mra;\r\n\r\n e.appendChild(s);\r\n\r\n proc_e = s;\r\n\r\n context.mra = mra;\r\n\r\n }\r\n\r\n /* remember we are filling line gaps */\r\n\r\n if (isd_element.styleAttrs[imscStyles.byName.fillLineGap.qname]) {\r\n context.flg = true;\r\n }\r\n\r\n\r\n if (isd_element.kind === "span" && isd_element.text) {\r\n\r\n if (context.lp || context.mra || context.flg) {\r\n\r\n // wrap characters in spans to find the line wrap locations\r\n\r\n var cbuf = \'\';\r\n\r\n for (var j = 0; j < isd_element.text.length; j++) {\r\n\r\n cbuf += isd_element.text.charAt(j);\r\n\r\n var cc = isd_element.text.charCodeAt(j);\r\n\r\n if (cc < 0xD800 || cc > 0xDBFF || j === isd_element.text.length) {\r\n\r\n /* wrap the character(s) in a span unless it is a high surrogate */\r\n\r\n var span = document.createElement("span");\r\n\r\n span.textContent = cbuf;\r\n \r\n e.appendChild(span);\r\n\r\n cbuf = \'\';\r\n\r\n }\r\n\r\n }\r\n\r\n } else {\r\n\r\n e.textContent = isd_element.text;\r\n\r\n }\r\n }\r\n\r\n dom_parent.appendChild(e);\r\n\r\n /* process the children of the ISD element */\r\n\r\n for (var k in isd_element.contents) {\r\n\r\n processElement(context, proc_e, isd_element.contents[k]);\r\n\r\n }\r\n\r\n /* list of lines */\r\n\r\n var linelist = [];\r\n\r\n\r\n /* paragraph processing */\r\n /* TODO: linePadding only supported for horizontal scripts */\r\n\r\n if ((context.lp || context.mra || context.flg) && isd_element.kind === "p") {\r\n\r\n constructLineList(context, proc_e, linelist, null);\r\n\r\n /* insert line breaks for multirowalign */\r\n\r\n if (context.mra) {\r\n\r\n applyMultiRowAlign(linelist);\r\n\r\n context.mra = null;\r\n\r\n }\r\n\r\n /* add linepadding */\r\n\r\n if (context.lp) {\r\n\r\n applyLinePadding(linelist, context.lp * context.h, context);\r\n\r\n context.lp = null;\r\n\r\n }\r\n\r\n /* fill line gaps linepadding */\r\n\r\n if (context.flg) {\r\n\r\n var par_edges = rect2edges(proc_e.getBoundingClientRect(), context);\r\n\r\n applyFillLineGap(linelist, par_edges.before, par_edges.after, context);\r\n\r\n context.flg = null;\r\n\r\n }\r\n\r\n }\r\n\r\n\r\n /* region processing */\r\n\r\n if (isd_element.kind === "region") {\r\n\r\n /* build line list */\r\n\r\n constructLineList(context, proc_e, linelist);\r\n\r\n /* perform roll up if needed */\r\n\r\n if ((context.bpd === "tb") &&\r\n context.enableRollUp &&\r\n isd_element.contents.length > 0 &&\r\n isd_element.styleAttrs[imscStyles.byName.displayAlign.qname] === \'after\') {\r\n\r\n /* horrible hack, perhaps default region id should be underscore everywhere? */\r\n\r\n var rid = isd_element.id === \'\' ? \'_\' : isd_element.id;\r\n\r\n var rb = new RegionPBuffer(rid, linelist);\r\n\r\n context.currentISDState[rb.id] = rb;\r\n\r\n if (context.previousISDState &&\r\n rb.id in context.previousISDState &&\r\n context.previousISDState[rb.id].plist.length > 0 &&\r\n rb.plist.length > 1 &&\r\n rb.plist[rb.plist.length - 2].text ===\r\n context.previousISDState[rb.id].plist[context.previousISDState[rb.id].plist.length - 1].text) {\r\n\r\n var body_elem = e.firstElementChild;\r\n \r\n var h = rb.plist[rb.plist.length - 1].after - rb.plist[rb.plist.length - 1].before;\r\n\r\n body_elem.style.bottom = "-" + h + "px";\r\n body_elem.style.transition = "transform 0.4s";\r\n body_elem.style.position = "relative";\r\n body_elem.style.transform = "translateY(-" + h + "px)";\r\n\r\n }\r\n\r\n }\r\n\r\n /* TODO: clean-up the spans ? */\r\n\r\n }\r\n }\r\n\r\n function applyLinePadding(lineList, lp, context) {\r\n\r\n for (var i in lineList) {\r\n\r\n var l = lineList[i].elements.length;\r\n\r\n var se = lineList[i].elements[lineList[i].start_elem];\r\n\r\n var ee = lineList[i].elements[lineList[i].end_elem];\r\n\r\n var pospadpxlen = Math.ceil(lp) + "px";\r\n\r\n var negpadpxlen = "-" + Math.ceil(lp) + "px";\r\n\r\n if (l !== 0) {\r\n\r\n if (context.ipd === "lr") {\r\n\r\n se.node.style.borderLeftColor = se.bgcolor || "#00000000";\r\n se.node.style.borderLeftStyle = "solid";\r\n se.node.style.borderLeftWidth = pospadpxlen;\r\n se.node.style.marginLeft = negpadpxlen;\r\n\r\n } else if (context.ipd === "rl") {\r\n\r\n se.node.style.borderRightColor = se.bgcolor || "#00000000";\r\n se.node.style.borderRightStyle = "solid";\r\n se.node.style.borderRightWidth = pospadpxlen;\r\n se.node.style.marginRight = negpadpxlen;\r\n\r\n } else if (context.ipd === "tb") {\r\n\r\n se.node.style.borderTopColor = se.bgcolor || "#00000000";\r\n se.node.style.borderTopStyle = "solid";\r\n se.node.style.borderTopWidth = pospadpxlen;\r\n se.node.style.marginTop = negpadpxlen;\r\n\r\n }\r\n\r\n if (context.ipd === "lr") {\r\n\r\n ee.node.style.borderRightColor = ee.bgcolor || "#00000000";\r\n ee.node.style.borderRightStyle = "solid";\r\n ee.node.style.borderRightWidth = pospadpxlen;\r\n ee.node.style.marginRight = negpadpxlen;\r\n\r\n } else if (context.ipd === "rl") {\r\n\r\n ee.node.style.borderLeftColor = ee.bgcolor || "#00000000";\r\n ee.node.style.borderLeftStyle = "solid";\r\n ee.node.style.borderLeftWidth = pospadpxlen;\r\n ee.node.style.marginLeft = negpadpxlen;\r\n\r\n } else if (context.ipd === "tb") {\r\n\r\n ee.node.style.borderBottomColor = ee.bgcolor || "#00000000";\r\n ee.node.style.borderBottomStyle = "solid";\r\n ee.node.style.borderBottomWidth = pospadpxlen;\r\n ee.node.style.marginBottom = negpadpxlen;\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n function applyMultiRowAlign(lineList) {\r\n\r\n /* apply an explicit br to all but the last line */\r\n\r\n for (var i = 0; i < lineList.length - 1; i++) {\r\n\r\n var l = lineList[i].elements.length;\r\n\r\n if (l !== 0 && lineList[i].br === false) {\r\n var br = document.createElement("br");\r\n\r\n var lastnode = lineList[i].elements[l - 1].node;\r\n\r\n lastnode.parentElement.insertBefore(br, lastnode.nextSibling);\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n function applyFillLineGap(lineList, par_before, par_after, context) {\r\n\r\n /* positive for BPD = lr and tb, negative for BPD = rl */\r\n var s = Math.sign(par_after - par_before);\r\n\r\n for (var i = 0; i <= lineList.length; i++) {\r\n\r\n /* compute frontier between lines */\r\n\r\n var frontier;\r\n\r\n if (i === 0) {\r\n\r\n frontier = par_before;\r\n\r\n } else if (i === lineList.length) {\r\n\r\n frontier = par_after;\r\n\r\n } else {\r\n\r\n frontier = (lineList[i].before + lineList[i - 1].after) / 2;\r\n\r\n }\r\n\r\n /* padding amount */\r\n\r\n var pad;\r\n\r\n /* current element */\r\n\r\n var e;\r\n\r\n /* before line */\r\n\r\n if (i > 0) {\r\n\r\n for (var j = 0; j < lineList[i - 1].elements.length; j++) {\r\n\r\n if (lineList[i - 1].elements[j].bgcolor === null) continue;\r\n\r\n e = lineList[i - 1].elements[j];\r\n\r\n if (s * (e.after - frontier) < 0) {\r\n\r\n pad = Math.ceil(Math.abs(frontier - e.after)) + "px";\r\n\r\n e.node.style.backgroundColor = e.bgcolor;\r\n\r\n if (context.bpd === "lr") {\r\n\r\n e.node.style.paddingRight = pad;\r\n\r\n\r\n } else if (context.bpd === "rl") {\r\n\r\n e.node.style.paddingLeft = pad;\r\n\r\n } else if (context.bpd === "tb") {\r\n\r\n e.node.style.paddingBottom = pad;\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n /* after line */\r\n\r\n if (i < lineList.length) {\r\n\r\n for (var k = 0; k < lineList[i].elements.length; k++) {\r\n\r\n e = lineList[i].elements[k];\r\n\r\n if (e.bgcolor === null) continue;\r\n\r\n if (s * (e.before - frontier) > 0) {\r\n\r\n pad = Math.ceil(Math.abs(e.before - frontier)) + "px";\r\n\r\n e.node.style.backgroundColor = e.bgcolor;\r\n\r\n if (context.bpd === "lr") {\r\n\r\n e.node.style.paddingLeft = pad;\r\n\r\n\r\n } else if (context.bpd === "rl") {\r\n\r\n e.node.style.paddingRight = pad;\r\n\r\n\r\n } else if (context.bpd === "tb") {\r\n\r\n e.node.style.paddingTop = pad;\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n function RegionPBuffer(id, lineList) {\r\n\r\n this.id = id;\r\n\r\n this.plist = lineList;\r\n\r\n }\r\n\r\n function rect2edges(rect, context) {\r\n\r\n var edges = {before: null, after: null, start: null, end: null};\r\n\r\n if (context.bpd === "tb") {\r\n\r\n edges.before = rect.top;\r\n edges.after = rect.bottom;\r\n\r\n if (context.ipd === "lr") {\r\n\r\n edges.start = rect.left;\r\n edges.end = rect.right;\r\n\r\n } else {\r\n\r\n edges.start = rect.right;\r\n edges.end = rect.left;\r\n }\r\n\r\n } else if (context.bpd === "lr") {\r\n\r\n edges.before = rect.left;\r\n edges.after = rect.right;\r\n edges.start = rect.top;\r\n edges.end = rect.bottom;\r\n\r\n } else if (context.bpd === "rl") {\r\n\r\n edges.before = rect.right;\r\n edges.after = rect.left;\r\n edges.start = rect.top;\r\n edges.end = rect.bottom;\r\n\r\n }\r\n\r\n return edges;\r\n\r\n }\r\n\r\n function constructLineList(context, element, llist, bgcolor) {\r\n\r\n var curbgcolor = element.style.backgroundColor || bgcolor;\r\n\r\n if (element.childElementCount === 0) {\r\n\r\n if (element.localName === \'span\') {\r\n\r\n var r = element.getBoundingClientRect();\r\n\r\n /* skip if span is not displayed */\r\n\r\n if (r.height === 0 || r.width === 0) return;\r\n\r\n var edges = rect2edges(r, context);\r\n\r\n if (llist.length === 0 ||\r\n (!isSameLine(edges.before, edges.after, llist[llist.length - 1].before, llist[llist.length - 1].after))\r\n ) {\r\n\r\n llist.push({\r\n before: edges.before,\r\n after: edges.after,\r\n start: edges.start,\r\n end: edges.end,\r\n start_elem: 0,\r\n end_elem: 0,\r\n elements: [],\r\n text: "",\r\n br: false\r\n });\r\n\r\n } else {\r\n\r\n /* positive for BPD = lr and tb, negative for BPD = rl */\r\n var bpd_dir = Math.sign(edges.after - edges.before);\r\n\r\n /* positive for IPD = lr and tb, negative for IPD = rl */\r\n var ipd_dir = Math.sign(edges.end - edges.start);\r\n\r\n /* check if the line height has increased */\r\n\r\n if (bpd_dir * (edges.before - llist[llist.length - 1].before) < 0) {\r\n llist[llist.length - 1].before = edges.before;\r\n }\r\n\r\n if (bpd_dir * (edges.after - llist[llist.length - 1].after) > 0) {\r\n llist[llist.length - 1].after = edges.after;\r\n }\r\n\r\n if (ipd_dir * (edges.start - llist[llist.length - 1].start) < 0) {\r\n llist[llist.length - 1].start = edges.start;\r\n llist[llist.length - 1].start_elem = llist[llist.length - 1].elements.length;\r\n }\r\n\r\n if (ipd_dir * (edges.end - llist[llist.length - 1].end) > 0) {\r\n llist[llist.length - 1].end = edges.end;\r\n llist[llist.length - 1].end_elem = llist[llist.length - 1].elements.length;\r\n }\r\n\r\n }\r\n\r\n llist[llist.length - 1].text += element.textContent;\r\n\r\n llist[llist.length - 1].elements.push(\r\n {\r\n node: element,\r\n bgcolor: curbgcolor,\r\n before: edges.before,\r\n after: edges.after\r\n }\r\n );\r\n\r\n } else if (element.localName === \'br\' && llist.length !== 0) {\r\n\r\n llist[llist.length - 1].br = true;\r\n\r\n }\r\n\r\n } else {\r\n\r\n var child = element.firstChild;\r\n\r\n while (child) {\r\n\r\n if (child.nodeType === Node.ELEMENT_NODE) {\r\n\r\n constructLineList(context, child, llist, curbgcolor);\r\n\r\n }\r\n\r\n child = child.nextSibling;\r\n }\r\n }\r\n\r\n }\r\n\r\n function isSameLine(before1, after1, before2, after2) {\r\n\r\n return ((after1 < after2) && (before1 > before2)) || ((after2 <= after1) && (before2 >= before1));\r\n\r\n }\r\n\r\n function HTMLStylingMapDefintion(qName, mapFunc) {\r\n this.qname = qName;\r\n this.map = mapFunc;\r\n }\r\n\r\n var STYLING_MAP_DEFS = [\r\n\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling backgroundColor",\r\n function (context, dom_element, isd_element, attr) {\r\n\r\n /* skip if transparent */\r\n if (attr[3] === 0) return;\r\n\r\n dom_element.style.backgroundColor = "rgba(" +\r\n attr[0].toString() + "," +\r\n attr[1].toString() + "," +\r\n attr[2].toString() + "," +\r\n (attr[3] / 255).toString() +\r\n ")";\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling color",\r\n function (context, dom_element, isd_element, attr) {\r\n dom_element.style.color = "rgba(" +\r\n attr[0].toString() + "," +\r\n attr[1].toString() + "," +\r\n attr[2].toString() + "," +\r\n (attr[3] / 255).toString() +\r\n ")";\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling direction",\r\n function (context, dom_element, isd_element, attr) {\r\n dom_element.style.direction = attr;\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling display",\r\n function (context, dom_element, isd_element, attr) {}\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling displayAlign",\r\n function (context, dom_element, isd_element, attr) {\r\n\r\n /* see https://css-tricks.com/snippets/css/a-guide-to-flexbox/ */\r\n\r\n /* TODO: is this affected by writing direction? */\r\n\r\n dom_element.style.display = "flex";\r\n dom_element.style.flexDirection = "column";\r\n\r\n\r\n if (attr === "before") {\r\n\r\n dom_element.style.justifyContent = "flex-start";\r\n\r\n } else if (attr === "center") {\r\n\r\n dom_element.style.justifyContent = "center";\r\n\r\n } else if (attr === "after") {\r\n\r\n dom_element.style.justifyContent = "flex-end";\r\n }\r\n\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling extent",\r\n function (context, dom_element, isd_element, attr) {\r\n /* TODO: this is super ugly */\r\n\r\n context.regionH = (attr.h * context.h);\r\n context.regionW = (attr.w * context.w);\r\n\r\n /* \r\n * CSS height/width are measured against the content rectangle,\r\n * whereas TTML height/width include padding\r\n */\r\n\r\n var hdelta = 0;\r\n var wdelta = 0;\r\n\r\n var p = isd_element.styleAttrs["http://www.w3.org/ns/ttml#styling padding"];\r\n\r\n if (!p) ; else {\r\n\r\n hdelta = (p[0] + p[2]) * context.h;\r\n wdelta = (p[1] + p[3]) * context.w;\r\n\r\n }\r\n\r\n dom_element.style.height = (context.regionH - hdelta) + "px";\r\n dom_element.style.width = (context.regionW - wdelta) + "px";\r\n\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling fontFamily",\r\n function (context, dom_element, isd_element, attr) {\r\n\r\n var rslt = [];\r\n\r\n /* per IMSC1 */\r\n\r\n for (var i in attr) {\r\n\r\n if (attr[i] === "monospaceSerif") {\r\n\r\n rslt.push("Courier New");\r\n rslt.push(\'"Liberation Mono"\');\r\n rslt.push("Courier");\r\n rslt.push("monospace");\r\n\r\n } else if (attr[i] === "proportionalSansSerif") {\r\n\r\n rslt.push("Arial");\r\n rslt.push("Helvetica");\r\n rslt.push(\'"Liberation Sans"\');\r\n rslt.push("sans-serif");\r\n\r\n } else if (attr[i] === "monospace") {\r\n\r\n rslt.push("monospace");\r\n\r\n } else if (attr[i] === "sansSerif") {\r\n\r\n rslt.push("sans-serif");\r\n\r\n } else if (attr[i] === "serif") {\r\n\r\n rslt.push("serif");\r\n\r\n } else if (attr[i] === "monospaceSansSerif") {\r\n\r\n rslt.push("Consolas");\r\n rslt.push("monospace");\r\n\r\n } else if (attr[i] === "proportionalSerif") {\r\n\r\n rslt.push("serif");\r\n\r\n } else {\r\n\r\n rslt.push(attr[i]);\r\n\r\n }\r\n\r\n }\r\n\r\n dom_element.style.fontFamily = rslt.join(",");\r\n }\r\n ),\r\n\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling fontSize",\r\n function (context, dom_element, isd_element, attr) {\r\n dom_element.style.fontSize = (attr * context.h) + "px";\r\n }\r\n ),\r\n\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling fontStyle",\r\n function (context, dom_element, isd_element, attr) {\r\n dom_element.style.fontStyle = attr;\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling fontWeight",\r\n function (context, dom_element, isd_element, attr) {\r\n dom_element.style.fontWeight = attr;\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling lineHeight",\r\n function (context, dom_element, isd_element, attr) {\r\n if (attr === "normal") {\r\n\r\n dom_element.style.lineHeight = "normal";\r\n\r\n } else {\r\n\r\n dom_element.style.lineHeight = (attr * context.h) + "px";\r\n }\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling opacity",\r\n function (context, dom_element, isd_element, attr) {\r\n dom_element.style.opacity = attr;\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling origin",\r\n function (context, dom_element, isd_element, attr) {\r\n dom_element.style.top = (attr.h * context.h) + "px";\r\n dom_element.style.left = (attr.w * context.w) + "px";\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling overflow",\r\n function (context, dom_element, isd_element, attr) {\r\n dom_element.style.overflow = attr;\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling padding",\r\n function (context, dom_element, isd_element, attr) {\r\n\r\n /* attr: top,left,bottom,right*/\r\n\r\n /* style: top right bottom left*/\r\n\r\n var rslt = [];\r\n\r\n rslt[0] = (attr[0] * context.h) + "px";\r\n rslt[1] = (attr[3] * context.w) + "px";\r\n rslt[2] = (attr[2] * context.h) + "px";\r\n rslt[3] = (attr[1] * context.w) + "px";\r\n\r\n dom_element.style.padding = rslt.join(" ");\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling showBackground",\r\n null\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling textAlign",\r\n function (context, dom_element, isd_element, attr) {\r\n\r\n var ta;\r\n var dir = isd_element.styleAttrs[imscStyles.byName.direction.qname];\r\n\r\n /* handle UAs that do not understand start or end */\r\n\r\n if (attr === "start") {\r\n\r\n ta = (dir === "rtl") ? "right" : "left";\r\n\r\n } else if (attr === "end") {\r\n\r\n ta = (dir === "rtl") ? "left" : "right";\r\n\r\n } else {\r\n\r\n ta = attr;\r\n\r\n }\r\n\r\n dom_element.style.textAlign = ta;\r\n\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling textDecoration",\r\n function (context, dom_element, isd_element, attr) {\r\n dom_element.style.textDecoration = attr.join(" ").replace("lineThrough", "line-through");\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling textOutline",\r\n function (context, dom_element, isd_element, attr) {\r\n\r\n if (attr === "none") {\r\n\r\n dom_element.style.textShadow = "";\r\n\r\n } else {\r\n\r\n dom_element.style.textShadow = "rgba(" +\r\n attr.color[0].toString() + "," +\r\n attr.color[1].toString() + "," +\r\n attr.color[2].toString() + "," +\r\n (attr.color[3] / 255).toString() +\r\n ")" + " 0px 0px " +\r\n (attr.thickness * context.h) + "px";\r\n\r\n }\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling unicodeBidi",\r\n function (context, dom_element, isd_element, attr) {\r\n\r\n var ub;\r\n\r\n if (attr === \'bidiOverride\') {\r\n ub = "bidi-override";\r\n } else {\r\n ub = attr;\r\n }\r\n\r\n dom_element.style.unicodeBidi = ub;\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling visibility",\r\n function (context, dom_element, isd_element, attr) {\r\n dom_element.style.visibility = attr;\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling wrapOption",\r\n function (context, dom_element, isd_element, attr) {\r\n\r\n if (attr === "wrap") {\r\n\r\n if (isd_element.space === "preserve") {\r\n dom_element.style.whiteSpace = "pre-wrap";\r\n } else {\r\n dom_element.style.whiteSpace = "normal";\r\n }\r\n\r\n } else {\r\n\r\n if (isd_element.space === "preserve") {\r\n\r\n dom_element.style.whiteSpace = "pre";\r\n\r\n } else {\r\n dom_element.style.whiteSpace = "noWrap";\r\n }\r\n\r\n }\r\n\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling writingMode",\r\n function (context, dom_element, isd_element, attr) {\r\n if (attr === "lrtb" || attr === "lr") {\r\n\r\n dom_element.style.writingMode = "horizontal-tb";\r\n\r\n } else if (attr === "rltb" || attr === "rl") {\r\n\r\n dom_element.style.writingMode = "horizontal-tb";\r\n\r\n } else if (attr === "tblr") {\r\n\r\n dom_element.style.writingMode = "vertical-lr";\r\n\r\n } else if (attr === "tbrl" || attr === "tb") {\r\n\r\n dom_element.style.writingMode = "vertical-rl";\r\n\r\n }\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml#styling zIndex",\r\n function (context, dom_element, isd_element, attr) {\r\n dom_element.style.zIndex = attr;\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt backgroundImage",\r\n function (context, dom_element, isd_element, attr) {\r\n\r\n if (context.imgResolver !== null && attr !== null) {\r\n\r\n var img = document.createElement("img");\r\n\r\n var uri = context.imgResolver(attr, img);\r\n\r\n if (uri)\r\n img.src = uri;\r\n\r\n img.height = context.regionH;\r\n img.width = context.regionW;\r\n\r\n dom_element.appendChild(img);\r\n }\r\n }\r\n ),\r\n new HTMLStylingMapDefintion(\r\n "http://www.w3.org/ns/ttml/profile/imsc1#styling forcedDisplay",\r\n function (context, dom_element, isd_element, attr) {\r\n\r\n if (context.displayForcedOnlyMode && attr === false) {\r\n dom_element.style.visibility = "hidden";\r\n }\r\n\r\n }\r\n )\r\n ];\r\n\r\n var STYLMAP_BY_QNAME = {};\r\n\r\n for (var i in STYLING_MAP_DEFS) {\r\n\r\n STYLMAP_BY_QNAME[STYLING_MAP_DEFS[i].qname] = STYLING_MAP_DEFS[i];\r\n }\r\n\r\n function reportError(errorHandler, msg) {\r\n\r\n if (errorHandler && errorHandler.error && errorHandler.error(msg))\r\n throw msg;\r\n\r\n }\r\n\r\n})( exports,\r\n typeof imscNames === \'undefined\' ? __nested_webpack_require_202020__(/*! ./names */ "./node_modules/imsc/src/main/js/names.js") : imscNames,\r\n typeof imscStyles === \'undefined\' ? __nested_webpack_require_202020__(/*! ./styles */ "./node_modules/imsc/src/main/js/styles.js") : imscStyles);\n\n/***/ }),\n\n/***/ "./node_modules/imsc/src/main/js/isd.js":\n/*!**********************************************!*\\\n !*** ./node_modules/imsc/src/main/js/isd.js ***!\n \\**********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_238445__) {\n(function (imscISD, imscNames, imscStyles) { // wrapper for non-node envs\r\n\r\n /** \r\n * Creates a canonical representation of an IMSC1 document returned by <pre>imscDoc.fromXML()</pre>\r\n * at a given absolute offset in seconds. This offset does not have to be one of the values returned\r\n * by <pre>getMediaTimeEvents()</pre>.\r\n * \r\n * @param {Object} tt IMSC1 document\r\n * @param {number} offset Absolute offset (in seconds)\r\n * @param {?module:imscUtils.ErrorHandler} errorHandler Error callback\r\n * @returns {Object} Opaque in-memory representation of an ISD\r\n */\r\n\r\n imscISD.generateISD = function (tt, offset, errorHandler) {\r\n\r\n /* TODO check for tt and offset validity */\r\n\r\n /* create the ISD object from the IMSC1 doc */\r\n\r\n var isd = new ISD(tt);\r\n \r\n /* context */\r\n \r\n var context = {\r\n \r\n /* empty for now */\r\n \r\n };\r\n\r\n /* process regions */\r\n\r\n for (var r in tt.head.layout.regions) {\r\n\r\n /* post-order traversal of the body tree per [construct intermediate document] */\r\n\r\n var c = isdProcessContentElement(tt, offset, tt.head.layout.regions[r], tt.body, null, \'\', tt.head.layout.regions[r], errorHandler, context);\r\n\r\n if (c !== null) {\r\n\r\n /* add the region to the ISD */\r\n\r\n isd.contents.push(c.element);\r\n }\r\n\r\n\r\n }\r\n\r\n return isd;\r\n };\r\n\r\n function isdProcessContentElement(doc, offset, region, body, parent, inherited_region_id, elem, errorHandler, context) {\r\n\r\n /* prune if temporally inactive */\r\n\r\n if (offset < elem.begin || offset >= elem.end) {\r\n return null;\r\n }\r\n\r\n /* \r\n * set the associated region as specified by the regionID attribute, or the \r\n * inherited associated region otherwise\r\n */\r\n\r\n var associated_region_id = \'regionID\' in elem && elem.regionID !== \'\' ? elem.regionID : inherited_region_id;\r\n\r\n /* prune the element if either:\r\n * - the element is not terminal and the associated region is neither the default\r\n * region nor the parent region (this allows children to be associated with a \r\n * region later on)\r\n * - the element is terminal and the associated region is not the parent region\r\n */\r\n \r\n /* TODO: improve detection of terminal elements since <region> has no contents */\r\n\r\n if (parent !== null /* are we in the region element */ &&\r\n associated_region_id !== region.id &&\r\n (\r\n (! (\'contents\' in elem)) ||\r\n (\'contents\' in elem && elem.contents.length === 0) ||\r\n associated_region_id !== \'\'\r\n )\r\n )\r\n return null;\r\n\r\n /* create an ISD element, including applying specified styles */\r\n\r\n var isd_element = new ISDContentElement(elem);\r\n\r\n /* apply set (animation) styling */\r\n\r\n for (var i in elem.sets) {\r\n\r\n if (offset < elem.sets[i].begin || offset >= elem.sets[i].end)\r\n continue;\r\n\r\n isd_element.styleAttrs[elem.sets[i].qname] = elem.sets[i].value;\r\n\r\n }\r\n\r\n /* \r\n * keep track of specified styling attributes so that we\r\n * can compute them later\r\n */\r\n\r\n var spec_attr = {};\r\n\r\n for (var qname in isd_element.styleAttrs) {\r\n\r\n spec_attr[qname] = true;\r\n\r\n /* special rule for tts:writingMode (section 7.29.1 of XSL)\r\n * direction is set consistently with writingMode only\r\n * if writingMode sets inline-direction to LTR or RTL \r\n */\r\n\r\n if (qname === imscStyles.byName.writingMode.qname &&\r\n !(imscStyles.byName.direction.qname in isd_element.styleAttrs)) {\r\n\r\n var wm = isd_element.styleAttrs[qname];\r\n\r\n if (wm === "lrtb" || wm === "lr") {\r\n\r\n isd_element.styleAttrs[imscStyles.byName.direction.qname] = "ltr";\r\n\r\n } else if (wm === "rltb" || wm === "rl") {\r\n\r\n isd_element.styleAttrs[imscStyles.byName.direction.qname] = "rtl";\r\n\r\n }\r\n\r\n }\r\n }\r\n\r\n /* inherited styling */\r\n\r\n if (parent !== null) {\r\n\r\n for (var j in imscStyles.all) {\r\n\r\n var sa = imscStyles.all[j];\r\n\r\n /* textDecoration has special inheritance rules */\r\n\r\n if (sa.qname === imscStyles.byName.textDecoration.qname) {\r\n\r\n /* handle both textDecoration inheritance and specification */\r\n\r\n var ps = parent.styleAttrs[sa.qname];\r\n var es = isd_element.styleAttrs[sa.qname];\r\n var outs = [];\r\n\r\n if (es === undefined) {\r\n\r\n outs = ps;\r\n\r\n } else if (es.indexOf("none") === -1) {\r\n\r\n if ((es.indexOf("noUnderline") === -1 &&\r\n ps.indexOf("underline") !== -1) ||\r\n es.indexOf("underline") !== -1) {\r\n\r\n outs.push("underline");\r\n\r\n }\r\n\r\n if ((es.indexOf("noLineThrough") === -1 &&\r\n ps.indexOf("lineThrough") !== -1) ||\r\n es.indexOf("lineThrough") !== -1) {\r\n\r\n outs.push("lineThrough");\r\n\r\n }\r\n\r\n if ((es.indexOf("noOverline") === -1 &&\r\n ps.indexOf("overline") !== -1) ||\r\n es.indexOf("overline") !== -1) {\r\n\r\n outs.push("overline");\r\n\r\n }\r\n\r\n } else {\r\n\r\n outs.push("none");\r\n\r\n }\r\n\r\n isd_element.styleAttrs[sa.qname] = outs;\r\n\r\n } else if (sa.inherit &&\r\n (sa.qname in parent.styleAttrs) &&\r\n !(sa.qname in isd_element.styleAttrs)) {\r\n\r\n isd_element.styleAttrs[sa.qname] = parent.styleAttrs[sa.qname];\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n\r\n /* initial value styling */\r\n\r\n for (var k in imscStyles.all) {\r\n\r\n var ivs = imscStyles.all[k];\r\n\r\n /* skip if value is already specified */\r\n\r\n if (ivs.qname in isd_element.styleAttrs) continue;\r\n\r\n /* apply initial value to elements other than region only if non-inherited */\r\n\r\n if (isd_element.kind === \'region\' || (ivs.inherit === false && ivs.initial !== null)) {\r\n\r\n isd_element.styleAttrs[ivs.qname] = ivs.parse(ivs.initial);\r\n\r\n /* keep track of the style as specified */\r\n\r\n spec_attr[ivs.qname] = true;\r\n\r\n }\r\n\r\n }\r\n\r\n /* compute styles (only for non-inherited styles) */\r\n /* TODO: get rid of spec_attr */\r\n\r\n for (var z in imscStyles.all) {\r\n\r\n var cs = imscStyles.all[z];\r\n\r\n if (!(cs.qname in spec_attr)) continue;\r\n\r\n if (cs.compute !== null) {\r\n\r\n var cstyle = cs.compute(\r\n /*doc, parent, element, attr, context*/\r\n doc,\r\n parent,\r\n isd_element,\r\n isd_element.styleAttrs[cs.qname],\r\n context\r\n );\r\n\r\n if (cstyle !== null) {\r\n isd_element.styleAttrs[cs.qname] = cstyle;\r\n } else {\r\n reportError(errorHandler, "Style \'" + cs.qname + "\' on element \'" + isd_element.kind + "\' cannot be computed");\r\n }\r\n }\r\n\r\n }\r\n\r\n /* prune if tts:display is none */\r\n\r\n if (isd_element.styleAttrs[imscStyles.byName.display.qname] === "none")\r\n return null;\r\n\r\n /* process contents of the element */\r\n\r\n var contents;\r\n\r\n if (parent === null) {\r\n\r\n /* we are processing the region */\r\n\r\n if (body === null) {\r\n\r\n /* if there is no body, still process the region but with empty content */\r\n\r\n contents = [];\r\n\r\n } else {\r\n\r\n /*use the body element as contents */\r\n\r\n contents = [body];\r\n\r\n }\r\n\r\n } else if (\'contents\' in elem) {\r\n\r\n contents = elem.contents;\r\n\r\n }\r\n\r\n for (var x in contents) {\r\n\r\n var c = isdProcessContentElement(doc, offset, region, body, isd_element, associated_region_id, contents[x], errorHandler, context);\r\n\r\n /* \r\n * keep child element only if they are non-null and their region match \r\n * the region of this element\r\n */\r\n\r\n if (c !== null) {\r\n\r\n isd_element.contents.push(c.element);\r\n\r\n }\r\n\r\n }\r\n\r\n /* compute used value of lineHeight="normal" */\r\n\r\n /* if (isd_element.styleAttrs[imscStyles.byName.lineHeight.qname] === "normal" ) {\r\n \r\n isd_element.styleAttrs[imscStyles.byName.lineHeight.qname] =\r\n isd_element.styleAttrs[imscStyles.byName.fontSize.qname] * 1.2;\r\n \r\n }\r\n */\r\n\r\n /* remove styles that are not applicable */\r\n\r\n for (var qnameb in isd_element.styleAttrs) {\r\n var da = imscStyles.byQName[qnameb];\r\n\r\n if (da.applies.indexOf(isd_element.kind) === -1) {\r\n delete isd_element.styleAttrs[qnameb];\r\n }\r\n }\r\n\r\n /* collapse white space if space is "default" */\r\n\r\n if (isd_element.kind === \'span\' && isd_element.text && isd_element.space === "default") {\r\n\r\n var trimmedspan = isd_element.text.replace(/\\s+/g, \' \');\r\n\r\n isd_element.text = trimmedspan;\r\n\r\n }\r\n\r\n /* trim whitespace around explicit line breaks */\r\n\r\n if (isd_element.kind === \'p\') {\r\n\r\n var elist = [];\r\n\r\n constructSpanList(isd_element, elist);\r\n\r\n var l = 0;\r\n\r\n var state = "after_br";\r\n var br_pos = 0;\r\n\r\n while (true) {\r\n\r\n if (state === "after_br") {\r\n\r\n if (l >= elist.length || elist[l].kind === "br") {\r\n\r\n state = "before_br";\r\n br_pos = l;\r\n l--;\r\n\r\n } else {\r\n\r\n if (elist[l].space !== "preserve") {\r\n\r\n elist[l].text = elist[l].text.replace(/^\\s+/g, \'\');\r\n\r\n }\r\n\r\n if (elist[l].text.length > 0) {\r\n\r\n state = "looking_br";\r\n l++;\r\n\r\n } else {\r\n\r\n elist.splice(l, 1);\r\n\r\n }\r\n\r\n }\r\n\r\n } else if (state === "before_br") {\r\n\r\n if (l < 0 || elist[l].kind === "br") {\r\n\r\n state = "after_br";\r\n l = br_pos + 1;\r\n\r\n if (l >= elist.length) break;\r\n\r\n } else {\r\n\r\n if (elist[l].space !== "preserve") {\r\n\r\n elist[l].text = elist[l].text.replace(/\\s+$/g, \'\');\r\n\r\n }\r\n\r\n if (elist[l].text.length > 0) {\r\n\r\n state = "after_br";\r\n l = br_pos + 1;\r\n\r\n if (l >= elist.length) break;\r\n\r\n } else {\r\n\r\n elist.splice(l, 1);\r\n l--;\r\n\r\n }\r\n\r\n }\r\n\r\n } else {\r\n\r\n if (l >= elist.length || elist[l].kind === "br") {\r\n\r\n state = "before_br";\r\n br_pos = l;\r\n l--;\r\n\r\n } else {\r\n\r\n l++;\r\n\r\n }\r\n\r\n }\r\n\r\n }\r\n \r\n pruneEmptySpans(isd_element);\r\n\r\n }\r\n\r\n /* keep element if:\r\n * * contains a background image\r\n * * <br/>\r\n * * if there are children\r\n * * if <span> and has text\r\n * * if region and showBackground = always\r\n */\r\n\r\n if ((isd_element.kind === \'div\' && imscStyles.byName.backgroundImage.qname in isd_element.styleAttrs) ||\r\n isd_element.kind === \'br\' ||\r\n (\'contents\' in isd_element && isd_element.contents.length > 0) ||\r\n (isd_element.kind === \'span\' && isd_element.text !== null) ||\r\n (isd_element.kind === \'region\' &&\r\n isd_element.styleAttrs[imscStyles.byName.showBackground.qname] === \'always\')) {\r\n\r\n return {\r\n region_id: associated_region_id,\r\n element: isd_element\r\n };\r\n }\r\n\r\n return null;\r\n }\r\n\r\n function constructSpanList(element, elist) {\r\n\r\n if (\'contents\' in element) {\r\n\r\n for (var i in element.contents) {\r\n constructSpanList(element.contents[i], elist);\r\n }\r\n\r\n } else {\r\n\r\n elist.push(element);\r\n\r\n }\r\n\r\n }\r\n\r\n function pruneEmptySpans(element) {\r\n\r\n if (element.kind === \'br\') {\r\n \r\n return false;\r\n \r\n } else if (\'text\' in element) {\r\n \r\n return element.text.length === 0;\r\n \r\n } else if (\'contents\' in element) {\r\n \r\n var i = element.contents.length;\r\n\r\n while (i--) {\r\n \r\n if (pruneEmptySpans(element.contents[i])) {\r\n element.contents.splice(i, 1);\r\n }\r\n \r\n }\r\n \r\n return element.contents.length === 0;\r\n\r\n }\r\n }\r\n\r\n function ISD(tt) {\r\n this.contents = [];\r\n this.aspectRatio = tt.aspectRatio;\r\n }\r\n\r\n function ISDContentElement(ttelem) {\r\n\r\n /* assume the element is a region if it does not have a kind */\r\n\r\n this.kind = ttelem.kind || \'region\';\r\n \r\n /* copy id */\r\n \r\n if (ttelem.id) {\r\n this.id = ttelem.id;\r\n }\r\n\r\n /* deep copy of style attributes */\r\n this.styleAttrs = {};\r\n\r\n for (var sname in ttelem.styleAttrs) {\r\n\r\n this.styleAttrs[sname] =\r\n ttelem.styleAttrs[sname];\r\n }\r\n\r\n /* TODO: clean this! */\r\n\r\n if (\'text\' in ttelem) {\r\n\r\n this.text = ttelem.text;\r\n\r\n } else if (ttelem.kind !== \'br\') {\r\n \r\n this.contents = [];\r\n }\r\n\r\n if (\'space\' in ttelem) {\r\n\r\n this.space = ttelem.space;\r\n }\r\n }\r\n\r\n function reportError(errorHandler, msg) {\r\n\r\n if (errorHandler && errorHandler.error && errorHandler.error(msg))\r\n throw msg;\r\n\r\n }\r\n\r\n\r\n})( exports,\r\n typeof imscNames === \'undefined\' ? __nested_webpack_require_238445__(/*! ./names */ "./node_modules/imsc/src/main/js/names.js") : imscNames,\r\n typeof imscStyles === \'undefined\' ? __nested_webpack_require_238445__(/*! ./styles */ "./node_modules/imsc/src/main/js/styles.js") : imscStyles\r\n );\r\n\n\n/***/ }),\n\n/***/ "./node_modules/imsc/src/main/js/main.js":\n/*!***********************************************!*\\\n !*** ./node_modules/imsc/src/main/js/main.js ***!\n \\***********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_254303__) {\n\n/* \r\n * Copyright (c) 2016, Pierre-Anthony Lemieux <pal@sandflow.com>\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * * Redistributions of source code must retain the above copyright notice, this\r\n * list of conditions and the following disclaimer.\r\n * * Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n */\r\n\r\nexports.generateISD = __nested_webpack_require_254303__(/*! ./isd */ "./node_modules/imsc/src/main/js/isd.js").generateISD;\r\nexports.fromXML = __nested_webpack_require_254303__(/*! ./doc */ "./node_modules/imsc/src/main/js/doc.js").fromXML;\r\nexports.renderHTML = __nested_webpack_require_254303__(/*! ./html */ "./node_modules/imsc/src/main/js/html.js").render;\n\n/***/ }),\n\n/***/ "./node_modules/imsc/src/main/js/names.js":\n/*!************************************************!*\\\n !*** ./node_modules/imsc/src/main/js/names.js ***!\n \\************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n(function (imscNames) { // wrapper for non-node envs\r\n\r\n imscNames.ns_tt = "http://www.w3.org/ns/ttml";\r\n imscNames.ns_tts = "http://www.w3.org/ns/ttml#styling";\r\n imscNames.ns_ttp = "http://www.w3.org/ns/ttml#parameter";\r\n imscNames.ns_xml = "http://www.w3.org/XML/1998/namespace";\r\n imscNames.ns_itts = "http://www.w3.org/ns/ttml/profile/imsc1#styling";\r\n imscNames.ns_ittp = "http://www.w3.org/ns/ttml/profile/imsc1#parameter";\r\n imscNames.ns_smpte = "http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt";\r\n imscNames.ns_ebutts = "urn:ebu:tt:style";\r\n \r\n})( exports);\r\n\r\n\r\n\r\n\r\n\n\n/***/ }),\n\n/***/ "./node_modules/imsc/src/main/js/styles.js":\n/*!*************************************************!*\\\n !*** ./node_modules/imsc/src/main/js/styles.js ***!\n \\*************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_257281__) {\n(function (imscStyles, imscNames, imscUtils) { // wrapper for non-node envs\r\n\r\n function StylingAttributeDefinition(ns, name, initialValue, appliesTo, isInherit, isAnimatable, parseFunc, computeFunc) {\r\n this.name = name;\r\n this.ns = ns;\r\n this.qname = ns + " " + name;\r\n this.inherit = isInherit;\r\n this.animatable = isAnimatable;\r\n this.initial = initialValue;\r\n this.applies = appliesTo;\r\n this.parse = parseFunc;\r\n this.compute = computeFunc;\r\n }\r\n\r\n imscStyles.all = [\r\n\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "backgroundColor",\r\n "transparent",\r\n [\'body\', \'div\', \'p\', \'region\', \'span\'],\r\n false,\r\n true,\r\n imscUtils.parseColor,\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "color",\r\n "white",\r\n [\'span\'],\r\n true,\r\n true,\r\n imscUtils.parseColor,\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "direction",\r\n "ltr",\r\n [\'p\', \'span\'],\r\n true,\r\n true,\r\n function (str) {\r\n return str;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "display",\r\n "auto",\r\n [\'body\', \'div\', \'p\', \'region\', \'span\'],\r\n false,\r\n true,\r\n function (str) {\r\n return str;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "displayAlign",\r\n "before",\r\n [\'region\'],\r\n false,\r\n true,\r\n function (str) {\r\n return str;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "extent",\r\n "auto",\r\n [\'tt\', \'region\'],\r\n false,\r\n true,\r\n function (str) {\r\n\r\n if (str === "auto") {\r\n\r\n return str;\r\n\r\n } else {\r\n\r\n var s = str.split(" ");\r\n if (s.length !== 2) return null;\r\n var w = imscUtils.parseLength(s[0]);\r\n var h = imscUtils.parseLength(s[1]);\r\n if (!h || !w) return null;\r\n return {\'h\': h, \'w\': w};\r\n }\r\n\r\n },\r\n function (doc, parent, element, attr, context) {\r\n\r\n var h;\r\n var w;\r\n\r\n if (attr === "auto") {\r\n\r\n h = 1;\r\n\r\n } else if (attr.h.unit === "%") {\r\n\r\n h = attr.h.value / 100;\r\n\r\n } else if (attr.h.unit === "px") {\r\n\r\n h = attr.h.value / doc.pxDimensions.h;\r\n\r\n } else {\r\n\r\n return null;\r\n\r\n }\r\n\r\n if (attr === "auto") {\r\n\r\n w = 1;\r\n\r\n } else if (attr.w.unit === "%") {\r\n\r\n w = attr.w.value / 100;\r\n\r\n } else if (attr.w.unit === "px") {\r\n\r\n w = attr.w.value / doc.pxDimensions.w;\r\n\r\n } else {\r\n\r\n return null;\r\n\r\n }\r\n\r\n return {\'h\': h, \'w\': w};\r\n }\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "fontFamily",\r\n "default",\r\n [\'span\'],\r\n true,\r\n true,\r\n function (str) {\r\n var ffs = str.split(",");\r\n var rslt = [];\r\n\r\n for (var i in ffs) {\r\n\r\n if (ffs[i].charAt(0) !== "\'" && ffs[i].charAt(0) !== \'"\') {\r\n\r\n if (ffs[i] === "default") {\r\n\r\n /* per IMSC1 */\r\n\r\n rslt.push("monospaceSerif");\r\n\r\n } else {\r\n\r\n rslt.push(ffs[i]);\r\n\r\n }\r\n\r\n } else {\r\n\r\n rslt.push(ffs[i]);\r\n\r\n }\r\n\r\n }\r\n\r\n return rslt;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "fontSize",\r\n "1c",\r\n [\'span\'],\r\n true,\r\n true,\r\n imscUtils.parseLength,\r\n function (doc, parent, element, attr, context) {\r\n\r\n var fs;\r\n\r\n if (attr.unit === "%") {\r\n\r\n if (parent !== null) {\r\n\r\n fs = parent.styleAttrs[imscStyles.byName.fontSize.qname] * attr.value / 100;\r\n\r\n } else {\r\n\r\n /* region, so percent of 1c */\r\n\r\n fs = attr.value / 100 / doc.cellResolution.h;\r\n\r\n }\r\n\r\n } else if (attr.unit === "em") {\r\n\r\n if (parent !== null) {\r\n\r\n fs = parent.styleAttrs[imscStyles.byName.fontSize.qname] * attr.value;\r\n\r\n } else {\r\n\r\n /* region, so percent of 1c */\r\n\r\n fs = attr.value / doc.cellResolution.h;\r\n\r\n }\r\n\r\n } else if (attr.unit === "c") {\r\n\r\n fs = attr.value / doc.cellResolution.h;\r\n\r\n } else if (attr.unit === "px") {\r\n\r\n fs = attr.value / doc.pxDimensions.h;\r\n\r\n } else {\r\n\r\n return null;\r\n\r\n }\r\n\r\n return fs;\r\n }\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "fontStyle",\r\n "normal",\r\n [\'span\'],\r\n true,\r\n true,\r\n function (str) {\r\n /* TODO: handle font style */\r\n\r\n return str;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "fontWeight",\r\n "normal",\r\n [\'span\'],\r\n true,\r\n true,\r\n function (str) {\r\n /* TODO: handle font weight */\r\n\r\n return str;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "lineHeight",\r\n "normal",\r\n [\'p\'],\r\n true,\r\n true,\r\n function (str) {\r\n if (str === "normal") {\r\n return str;\r\n } else {\r\n return imscUtils.parseLength(str);\r\n }\r\n },\r\n function (doc, parent, element, attr, context) {\r\n\r\n var lh;\r\n\r\n if (attr === "normal") {\r\n\r\n /* inherit normal per https://github.com/w3c/ttml1/issues/220 */\r\n\r\n lh = attr;\r\n\r\n } else if (attr.unit === "%") {\r\n\r\n lh = element.styleAttrs[imscStyles.byName.fontSize.qname] * attr.value / 100;\r\n\r\n } else if (attr.unit === "em") {\r\n\r\n lh = element.styleAttrs[imscStyles.byName.fontSize.qname] * attr.value;\r\n\r\n } else if (attr.unit === "c") {\r\n\r\n lh = attr.value / doc.cellResolution.h;\r\n\r\n } else if (attr.unit === "px") {\r\n\r\n /* TODO: handle error if no px dimensions are provided */\r\n\r\n lh = attr.value / doc.pxDimensions.h;\r\n\r\n } else {\r\n\r\n return null;\r\n\r\n }\r\n\r\n /* TODO: create a Length constructor */\r\n\r\n return lh;\r\n }\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "opacity",\r\n 1.0,\r\n [\'region\'],\r\n false,\r\n true,\r\n parseFloat,\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "origin",\r\n "auto",\r\n [\'region\'],\r\n false,\r\n true,\r\n function (str) {\r\n\r\n if (str === "auto") {\r\n\r\n return str;\r\n\r\n } else {\r\n\r\n var s = str.split(" ");\r\n if (s.length !== 2) return null;\r\n var w = imscUtils.parseLength(s[0]);\r\n var h = imscUtils.parseLength(s[1]);\r\n if (!h || !w) return null;\r\n return {\'h\': h, \'w\': w};\r\n }\r\n\r\n },\r\n function (doc, parent, element, attr, context) {\r\n\r\n var h;\r\n var w;\r\n\r\n if (attr === "auto") {\r\n\r\n h = 0;\r\n\r\n } else if (attr.h.unit === "%") {\r\n\r\n h = attr.h.value / 100;\r\n\r\n } else if (attr.h.unit === "px") {\r\n\r\n h = attr.h.value / doc.pxDimensions.h;\r\n\r\n } else {\r\n\r\n return null;\r\n\r\n }\r\n\r\n if (attr === "auto") {\r\n\r\n w = 0;\r\n\r\n } else if (attr.w.unit === "%") {\r\n\r\n w = attr.w.value / 100;\r\n\r\n } else if (attr.w.unit === "px") {\r\n\r\n w = attr.w.value / doc.pxDimensions.w;\r\n\r\n } else {\r\n\r\n return null;\r\n\r\n }\r\n\r\n return {\'h\': h, \'w\': w};\r\n }\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "overflow",\r\n "hidden",\r\n [\'region\'],\r\n false,\r\n true,\r\n function (str) {\r\n return str;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "padding",\r\n "0px",\r\n [\'region\'],\r\n false,\r\n true,\r\n function (str) {\r\n\r\n var s = str.split(" ");\r\n if (s.length > 4) return null;\r\n var r = [];\r\n for (var i in s) {\r\n\r\n var l = imscUtils.parseLength(s[i]);\r\n if (!l) return null;\r\n r.push(l);\r\n }\r\n\r\n return r;\r\n },\r\n function (doc, parent, element, attr, context) {\r\n\r\n var padding;\r\n\r\n /* TODO: make sure we are in region */\r\n\r\n /*\r\n * expand padding shortcuts to \r\n * [before, end, after, start]\r\n * \r\n */\r\n\r\n if (attr.length === 1) {\r\n\r\n padding = [attr[0], attr[0], attr[0], attr[0]];\r\n\r\n } else if (attr.length === 2) {\r\n\r\n padding = [attr[0], attr[1], attr[0], attr[1]];\r\n\r\n } else if (attr.length === 3) {\r\n\r\n padding = [attr[0], attr[1], attr[2], attr[1]];\r\n\r\n } else if (attr.length === 4) {\r\n\r\n padding = [attr[0], attr[1], attr[2], attr[3]];\r\n\r\n } else {\r\n\r\n return null;\r\n\r\n }\r\n\r\n /* TODO: take into account tts:direction */\r\n\r\n /* \r\n * transform [before, end, after, start] according to writingMode to \r\n * [top,left,bottom,right]\r\n * \r\n */\r\n\r\n var dir = element.styleAttrs[imscStyles.byName.writingMode.qname];\r\n\r\n if (dir === "lrtb" || dir === "lr") {\r\n\r\n padding = [padding[0], padding[3], padding[2], padding[1]];\r\n\r\n } else if (dir === "rltb" || dir === "rl") {\r\n\r\n padding = [padding[0], padding[1], padding[2], padding[3]];\r\n\r\n } else if (dir === "tblr") {\r\n\r\n padding = [padding[3], padding[0], padding[1], padding[2]];\r\n\r\n } else if (dir === "tbrl" || dir === "tb") {\r\n\r\n padding = [padding[3], padding[2], padding[1], padding[0]];\r\n\r\n } else {\r\n\r\n return null;\r\n\r\n }\r\n\r\n var out = [];\r\n\r\n for (var i in padding) {\r\n\r\n if (padding[i].value === 0) {\r\n\r\n out[i] = 0;\r\n\r\n } else if (padding[i].unit === "%") {\r\n\r\n if (i === "0" || i === "2") {\r\n\r\n out[i] = element.styleAttrs[imscStyles.byName.extent.qname].h * padding[i].value / 100;\r\n\r\n } else {\r\n\r\n out[i] = element.styleAttrs[imscStyles.byName.extent.qname].w * padding[i].value / 100;\r\n }\r\n\r\n } else if (padding[i].unit === "em") {\r\n\r\n out[i] = element.styleAttrs[imscStyles.byName.fontSize.qname] * padding[i].value;\r\n\r\n } else if (padding[i].unit === "c") {\r\n\r\n out[i] = padding[i].value / doc.cellResolution.h;\r\n\r\n } else if (padding[i].unit === "px") {\r\n \r\n if (i === "0" || i === "2") {\r\n\r\n out[i] = padding[i].value / doc.pxDimensions.h;\r\n\r\n } else {\r\n\r\n out[i] = padding[i].value / doc.pxDimensions.w;\r\n }\r\n \r\n } else {\r\n\r\n return null;\r\n\r\n }\r\n }\r\n\r\n\r\n return out;\r\n }\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "showBackground",\r\n "always",\r\n [\'region\'],\r\n false,\r\n true,\r\n function (str) {\r\n return str;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "textAlign",\r\n "start",\r\n [\'p\'],\r\n true,\r\n true,\r\n function (str) {\r\n return str;\r\n },\r\n function (doc, parent, element, attr, context) {\r\n \r\n /* Section 7.16.9 of XSL */\r\n \r\n if (attr === "left") {\r\n \r\n return "start";\r\n \r\n } else if (attr === "right") {\r\n \r\n return "end";\r\n \r\n } else {\r\n \r\n return attr;\r\n \r\n }\r\n }\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "textDecoration",\r\n "none",\r\n [\'span\'],\r\n true,\r\n true,\r\n function (str) {\r\n return str.split(" ");\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "textOutline",\r\n "none",\r\n [\'span\'],\r\n true,\r\n true,\r\n function (str) {\r\n\r\n /*\r\n * returns {c: <color>?, thichness: <length>} | "none"\r\n * \r\n */\r\n\r\n if (str === "none") {\r\n\r\n return str;\r\n\r\n } else {\r\n\r\n var r = {};\r\n var s = str.split(" ");\r\n if (s.length === 0 || s.length > 2) return null;\r\n var c = imscUtils.parseColor(s[0]);\r\n \r\n r.color = c;\r\n \r\n if (c !== null) s.shift();\r\n\r\n if (s.length !== 1) return null;\r\n\r\n var l = imscUtils.parseLength(s[0]);\r\n\r\n if (!l) return null;\r\n\r\n r.thickness = l;\r\n\r\n return r;\r\n }\r\n\r\n },\r\n function (doc, parent, element, attr, context) {\r\n\r\n /*\r\n * returns {color: <color>, thickness: <norm length>}\r\n * \r\n */\r\n\r\n if (attr === "none") return attr;\r\n\r\n var rslt = {};\r\n\r\n if (attr.color === null) {\r\n \r\n rslt.color = element.styleAttrs[imscStyles.byName.color.qname];\r\n \r\n } else {\r\n \r\n rslt.color = attr.color;\r\n\r\n }\r\n\r\n if (attr.thickness.unit === "%") {\r\n\r\n rslt.thickness = element.styleAttrs[imscStyles.byName.fontSize.qname] * attr.thickness.value / 100;\r\n\r\n } else if (attr.thickness.unit === "em") {\r\n\r\n rslt.thickness = element.styleAttrs[imscStyles.byName.fontSize.qname] * attr.thickness.value;\r\n\r\n } else if (attr.thickness.unit === "c") {\r\n\r\n rslt.thickness = attr.thickness.value / doc.cellResolution.h;\r\n\r\n } else if (attr.thickness.unit === "px") {\r\n\r\n rslt.thickness = attr.thickness.value / doc.pxDimensions.h;\r\n\r\n } else {\r\n\r\n return null;\r\n\r\n }\r\n\r\n\r\n return rslt;\r\n }\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "unicodeBidi",\r\n "normal",\r\n [\'span\', \'p\'],\r\n false,\r\n true,\r\n function (str) {\r\n return str;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "visibility",\r\n "visible",\r\n [\'body\', \'div\', \'p\', \'region\', \'span\'],\r\n true,\r\n true,\r\n function (str) {\r\n return str;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "wrapOption",\r\n "wrap",\r\n [\'span\'],\r\n true,\r\n true,\r\n function (str) {\r\n return str;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "writingMode",\r\n "lrtb",\r\n [\'region\'],\r\n false,\r\n true,\r\n function (str) {\r\n return str;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_tts,\r\n "zIndex",\r\n "auto",\r\n [\'region\'],\r\n false,\r\n true,\r\n function (str) {\r\n \r\n var rslt;\r\n \r\n if (str === \'auto\') {\r\n \r\n rslt = str;\r\n \r\n } else {\r\n \r\n rslt = parseInt(str);\r\n \r\n if (isNaN(rslt)) {\r\n rslt = null;\r\n }\r\n \r\n }\r\n \r\n return rslt;\r\n },\r\n null\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_ebutts,\r\n "linePadding",\r\n "0c",\r\n [\'p\'],\r\n true,\r\n false,\r\n imscUtils.parseLength,\r\n function (doc, parent, element, attr, context) {\r\n if (attr.unit === "c") {\r\n\r\n return attr.value / doc.cellResolution.h;\r\n\r\n } else {\r\n\r\n return null;\r\n\r\n }\r\n }\r\n ),\r\n new StylingAttributeDefinition(\r\n imscNames.ns_ebutts,\r\n "multiRowAlign",\r\n "auto",\r\n [\'p\'],\r\n true,\r\n false,\r\n function (str) {\r\n return str;\r\n },\r\n null\r\n ),\r\n\r\n new StylingAttributeDefinition(\r\n imscNames.ns_smpte,\r\n "backgroundImage",\r\n null,\r\n [\'div\'],\r\n false,\r\n false,\r\n function (str) {\r\n return str;\r\n },\r\n null\r\n ),\r\n\r\n new StylingAttributeDefinition(\r\n imscNames.ns_itts,\r\n "forcedDisplay",\r\n "false",\r\n [\'body\', \'div\', \'p\', \'region\', \'span\'],\r\n true,\r\n true,\r\n function (str) {\r\n return str === \'true\' ? true : false;\r\n },\r\n null\r\n ),\r\n\r\n new StylingAttributeDefinition(\r\n imscNames.ns_itts,\r\n "fillLineGap",\r\n "false",\r\n [\'p\'],\r\n true,\r\n true,\r\n function (str) {\r\n return str === \'true\' ? true : false;\r\n },\r\n null\r\n )\r\n ];\r\n\r\n /* TODO: allow null parse function */\r\n\r\n imscStyles.byQName = {};\r\n for (var i in imscStyles.all) {\r\n\r\n imscStyles.byQName[imscStyles.all[i].qname] = imscStyles.all[i];\r\n }\r\n\r\n imscStyles.byName = {};\r\n for (var j in imscStyles.all) {\r\n\r\n imscStyles.byName[imscStyles.all[j].name] = imscStyles.all[j];\r\n }\r\n\r\n})( exports,\r\n typeof imscNames === \'undefined\' ? __nested_webpack_require_257281__(/*! ./names */ "./node_modules/imsc/src/main/js/names.js") : imscNames,\r\n typeof imscUtils === \'undefined\' ? __nested_webpack_require_257281__(/*! ./utils */ "./node_modules/imsc/src/main/js/utils.js") : imscUtils);\r\n\n\n/***/ }),\n\n/***/ "./node_modules/imsc/src/main/js/utils.js":\n/*!************************************************!*\\\n !*** ./node_modules/imsc/src/main/js/utils.js ***!\n \\************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n(function (imscUtils) { // wrapper for non-node envs\r\n \r\n /* Documents the error handler interface */\r\n \r\n /**\r\n * @classdesc Generic interface for handling events. The interface exposes four\r\n * methods:\r\n * * <pre>info</pre>: unusual event that does not result in an inconsistent state\r\n * * <pre>warn</pre>: unexpected event that should not result in an inconsistent state\r\n * * <pre>error</pre>: unexpected event that may result in an inconsistent state\r\n * * <pre>fatal</pre>: unexpected event that results in an inconsistent state\r\n * and termination of processing\r\n * Each method takes a single <pre>string</pre> describing the event as argument,\r\n * and returns a single <pre>boolean</pre>, which terminates processing if <pre>true</pre>.\r\n *\r\n * @name ErrorHandler\r\n * @class\r\n */\r\n\r\n\r\n /*\r\n * Parses a TTML color expression\r\n * \r\n */\r\n\r\n var HEX_COLOR_RE = /#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?/;\r\n var DEC_COLOR_RE = /rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)/;\r\n var DEC_COLORA_RE = /rgba\\(\\s*(\\d+),\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)/;\r\n var NAMED_COLOR = {\r\n transparent: [0, 0, 0, 0],\r\n black: [0, 0, 0, 255],\r\n silver: [192, 192, 192, 255],\r\n gray: [128, 128, 128, 255],\r\n white: [255, 255, 255, 255],\r\n maroon: [128, 0, 0, 255],\r\n red: [255, 0, 0, 255],\r\n purple: [128, 0, 128, 255],\r\n fuchsia: [255, 0, 255, 255],\r\n magenta: [255, 0, 255, 255],\r\n green: [0, 128, 0, 255],\r\n lime: [0, 255, 0, 255],\r\n olive: [128, 128, 0, 255],\r\n yellow: [255, 255, 0, 255],\r\n navy: [0, 0, 128, 255],\r\n blue: [0, 0, 255, 255],\r\n teal: [0, 128, 128, 255],\r\n aqua: [0, 255, 255, 255],\r\n cyan: [0, 255, 255, 255]\r\n };\r\n\r\n imscUtils.parseColor = function (str) {\r\n\r\n var m;\r\n \r\n var r = null;\r\n \r\n var nc = NAMED_COLOR[str.toLowerCase()];\r\n \r\n if (nc !== undefined) {\r\n\r\n r = nc;\r\n\r\n } else if ((m = HEX_COLOR_RE.exec(str)) !== null) {\r\n\r\n r = [parseInt(m[1], 16),\r\n parseInt(m[2], 16),\r\n parseInt(m[3], 16),\r\n (m[4] !== undefined ? parseInt(m[4], 16) : 255)];\r\n \r\n } else if ((m = DEC_COLOR_RE.exec(str)) !== null) {\r\n\r\n r = [parseInt(m[1]),\r\n parseInt(m[2]),\r\n parseInt(m[3]),\r\n 255];\r\n \r\n } else if ((m = DEC_COLORA_RE.exec(str)) !== null) {\r\n\r\n r = [parseInt(m[1]),\r\n parseInt(m[2]),\r\n parseInt(m[3]),\r\n parseInt(m[4])];\r\n \r\n }\r\n\r\n return r;\r\n };\r\n\r\n var LENGTH_RE = /^((?:\\+|\\-)?\\d*(?:\\.\\d+)?)(px|em|c|%)$/;\r\n\r\n imscUtils.parseLength = function (str) {\r\n\r\n var m;\r\n\r\n var r = null;\r\n\r\n if ((m = LENGTH_RE.exec(str)) !== null) {\r\n\r\n r = {value: parseFloat(m[1]), unit: m[2]};\r\n }\r\n\r\n return r;\r\n };\r\n\r\n})( exports);\r\n\n\n/***/ }),\n\n/***/ "./node_modules/inherits/inherits_browser.js":\n/*!***************************************************!*\\\n !*** ./node_modules/inherits/inherits_browser.js ***!\n \\***************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nif (typeof Object.create === \'function\') {\n // implementation from standard node.js \'util\' module\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n ctor.prototype = Object.create(superCtor.prototype, {\n constructor: {\n value: ctor,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n };\n} else {\n // old school shim for old browsers\n module.exports = function inherits(ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n };\n}\n\n\n/***/ }),\n\n/***/ "./node_modules/isarray/index.js":\n/*!***************************************!*\\\n !*** ./node_modules/isarray/index.js ***!\n \\***************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nvar toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == \'[object Array]\';\n};\n\n\n/***/ }),\n\n/***/ "./node_modules/node-libs-browser/node_modules/buffer/index.js":\n/*!*********************************************************************!*\\\n !*** ./node_modules/node-libs-browser/node_modules/buffer/index.js ***!\n \\*********************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_287095__) {\n/* WEBPACK VAR INJECTION */(function(global) {/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh <http://feross.org>\n * @license MIT\n */\n/* eslint-disable no-proto */\n\n\n\nvar base64 = __nested_webpack_require_287095__(/*! base64-js */ "./node_modules/base64-js/index.js");\nvar ieee754 = __nested_webpack_require_287095__(/*! ieee754 */ "./node_modules/ieee754/index.js");\nvar isArray = __nested_webpack_require_287095__(/*! isarray */ "./node_modules/isarray/index.js");\n\nexports.Buffer = Buffer;\nexports.SlowBuffer = SlowBuffer;\nexports.INSPECT_MAX_BYTES = 50;\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport();\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength();\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1);\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }};\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === \'function\' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError(\'Invalid typed array length\')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length);\n that.__proto__ = Buffer.prototype;\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length);\n }\n that.length = length;\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === \'number\') {\n if (typeof encodingOrOffset === \'string\') {\n throw new Error(\n \'If encoding is specified then the first argument must be a string\'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192; // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype;\n return arr\n};\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === \'number\') {\n throw new TypeError(\'"value" argument must not be a number\')\n }\n\n if (typeof ArrayBuffer !== \'undefined\' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === \'string\') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n};\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype;\n Buffer.__proto__ = Uint8Array;\n if (typeof Symbol !== \'undefined\' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n });\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== \'number\') {\n throw new TypeError(\'"size" argument must be a number\')\n } else if (size < 0) {\n throw new RangeError(\'"size" argument must not be negative\')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size);\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it\'s a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === \'string\'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n};\n\nfunction allocUnsafe (that, size) {\n assertSize(size);\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0);\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0;\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n};\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n};\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== \'string\' || encoding === \'\') {\n encoding = \'utf8\';\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError(\'"encoding" must be a valid string encoding\')\n }\n\n var length = byteLength(string, encoding) | 0;\n that = createBuffer(that, length);\n\n var actual = that.write(string, encoding);\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // \'abxxcd\' will be treated as \'ab\')\n that = that.slice(0, actual);\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0;\n that = createBuffer(that, length);\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255;\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength; // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError(\'\\\'offset\\\' is out of bounds\')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError(\'\\\'length\\\' is out of bounds\')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array);\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset);\n } else {\n array = new Uint8Array(array, byteOffset, length);\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array;\n that.__proto__ = Buffer.prototype;\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array);\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0;\n that = createBuffer(that, len);\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len);\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== \'undefined\' &&\n obj.buffer instanceof ArrayBuffer) || \'length\' in obj) {\n if (typeof obj.length !== \'number\' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === \'Buffer\' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError(\'First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.\')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError(\'Attempt to allocate Buffer larger than maximum \' +\n \'size: 0x\' + kMaxLength().toString(16) + \' bytes\')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0;\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n};\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\'Arguments must be Buffers\')\n }\n\n if (a === b) return 0\n\n var x = a.length;\n var y = b.length;\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i];\n y = b[i];\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n};\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case \'hex\':\n case \'utf8\':\n case \'utf-8\':\n case \'ascii\':\n case \'latin1\':\n case \'binary\':\n case \'base64\':\n case \'ucs2\':\n case \'ucs-2\':\n case \'utf16le\':\n case \'utf-16le\':\n return true\n default:\n return false\n }\n};\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError(\'"list" argument must be an Array of Buffers\')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i;\n if (length === undefined) {\n length = 0;\n for (i = 0; i < list.length; ++i) {\n length += list[i].length;\n }\n }\n\n var buffer = Buffer.allocUnsafe(length);\n var pos = 0;\n for (i = 0; i < list.length; ++i) {\n var buf = list[i];\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError(\'"list" argument must be an Array of Buffers\')\n }\n buf.copy(buffer, pos);\n pos += buf.length;\n }\n return buffer\n};\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== \'undefined\' && typeof ArrayBuffer.isView === \'function\' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== \'string\') {\n string = \'\' + string;\n }\n\n var len = string.length;\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false;\n for (;;) {\n switch (encoding) {\n case \'ascii\':\n case \'latin1\':\n case \'binary\':\n return len\n case \'utf8\':\n case \'utf-8\':\n case undefined:\n return utf8ToBytes(string).length\n case \'ucs2\':\n case \'ucs-2\':\n case \'utf16le\':\n case \'utf-16le\':\n return len * 2\n case \'hex\':\n return len >>> 1\n case \'base64\':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = (\'\' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n}\nBuffer.byteLength = byteLength;\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false;\n\n // No need to verify that "this.length <= MAX_UINT32" since it\'s a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0;\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return \'\'\n }\n\n if (end === undefined || end > this.length) {\n end = this.length;\n }\n\n if (end <= 0) {\n return \'\'\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0;\n start >>>= 0;\n\n if (end <= start) {\n return \'\'\n }\n\n if (!encoding) encoding = \'utf8\';\n\n while (true) {\n switch (encoding) {\n case \'hex\':\n return hexSlice(this, start, end)\n\n case \'utf8\':\n case \'utf-8\':\n return utf8Slice(this, start, end)\n\n case \'ascii\':\n return asciiSlice(this, start, end)\n\n case \'latin1\':\n case \'binary\':\n return latin1Slice(this, start, end)\n\n case \'base64\':\n return base64Slice(this, start, end)\n\n case \'ucs2\':\n case \'ucs-2\':\n case \'utf16le\':\n case \'utf-16le\':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError(\'Unknown encoding: \' + encoding)\n encoding = (encoding + \'\').toLowerCase();\n loweredCase = true;\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true;\n\nfunction swap (b, n, m) {\n var i = b[n];\n b[n] = b[m];\n b[m] = i;\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length;\n if (len % 2 !== 0) {\n throw new RangeError(\'Buffer size must be a multiple of 16-bits\')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1);\n }\n return this\n};\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length;\n if (len % 4 !== 0) {\n throw new RangeError(\'Buffer size must be a multiple of 32-bits\')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3);\n swap(this, i + 1, i + 2);\n }\n return this\n};\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length;\n if (len % 8 !== 0) {\n throw new RangeError(\'Buffer size must be a multiple of 64-bits\')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7);\n swap(this, i + 1, i + 6);\n swap(this, i + 2, i + 5);\n swap(this, i + 3, i + 4);\n }\n return this\n};\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0;\n if (length === 0) return \'\'\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n};\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError(\'Argument must be a Buffer\')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n};\n\nBuffer.prototype.inspect = function inspect () {\n var str = \'\';\n var max = exports.INSPECT_MAX_BYTES;\n if (this.length > 0) {\n str = this.toString(\'hex\', 0, max).match(/.{2}/g).join(\' \');\n if (this.length > max) str += \' ... \';\n }\n return \'<Buffer \' + str + \'>\'\n};\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\'Argument must be a Buffer\')\n }\n\n if (start === undefined) {\n start = 0;\n }\n if (end === undefined) {\n end = target ? target.length : 0;\n }\n if (thisStart === undefined) {\n thisStart = 0;\n }\n if (thisEnd === undefined) {\n thisEnd = this.length;\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError(\'out of range index\')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0;\n end >>>= 0;\n thisStart >>>= 0;\n thisEnd >>>= 0;\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart;\n var y = end - start;\n var len = Math.min(x, y);\n\n var thisCopy = this.slice(thisStart, thisEnd);\n var targetCopy = target.slice(start, end);\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i];\n y = targetCopy[i];\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n};\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === \'string\') {\n encoding = byteOffset;\n byteOffset = 0;\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff;\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000;\n }\n byteOffset = +byteOffset; // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it\'s undefined, null, NaN, "foo", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1);\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset;\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1;\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0;\n else return -1\n }\n\n // Normalize val\n if (typeof val === \'string\') {\n val = Buffer.from(val, encoding);\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === \'number\') {\n val = val & 0xFF; // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === \'function\') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError(\'val must be string, number or Buffer\')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1;\n var arrLength = arr.length;\n var valLength = val.length;\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase();\n if (encoding === \'ucs2\' || encoding === \'ucs-2\' ||\n encoding === \'utf16le\' || encoding === \'utf-16le\') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2;\n arrLength /= 2;\n valLength /= 2;\n byteOffset /= 2;\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i;\n if (dir) {\n var foundIndex = -1;\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i;\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex;\n foundIndex = -1;\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;\n for (i = byteOffset; i >= 0; i--) {\n var found = true;\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false;\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n};\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n};\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n};\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0;\n var remaining = buf.length - offset;\n if (!length) {\n length = remaining;\n } else {\n length = Number(length);\n if (length > remaining) {\n length = remaining;\n }\n }\n\n // must be an even number of digits\n var strLen = string.length;\n if (strLen % 2 !== 0) throw new TypeError(\'Invalid hex string\')\n\n if (length > strLen / 2) {\n length = strLen / 2;\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16);\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed;\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = \'utf8\';\n length = this.length;\n offset = 0;\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === \'string\') {\n encoding = offset;\n length = this.length;\n offset = 0;\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0;\n if (isFinite(length)) {\n length = length | 0;\n if (encoding === undefined) encoding = \'utf8\';\n } else {\n encoding = length;\n length = undefined;\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n \'Buffer.write(string, encoding, offset[, length]) is no longer supported\'\n )\n }\n\n var remaining = this.length - offset;\n if (length === undefined || length > remaining) length = remaining;\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError(\'Attempt to write outside buffer bounds\')\n }\n\n if (!encoding) encoding = \'utf8\';\n\n var loweredCase = false;\n for (;;) {\n switch (encoding) {\n case \'hex\':\n return hexWrite(this, string, offset, length)\n\n case \'utf8\':\n case \'utf-8\':\n return utf8Write(this, string, offset, length)\n\n case \'ascii\':\n return asciiWrite(this, string, offset, length)\n\n case \'latin1\':\n case \'binary\':\n return latin1Write(this, string, offset, length)\n\n case \'base64\':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case \'ucs2\':\n case \'ucs-2\':\n case \'utf16le\':\n case \'utf-16le\':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError(\'Unknown encoding: \' + encoding)\n encoding = (\'\' + encoding).toLowerCase();\n loweredCase = true;\n }\n }\n};\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: \'Buffer\',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n};\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end);\n var res = [];\n\n var i = start;\n while (i < end) {\n var firstByte = buf[i];\n var codePoint = null;\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1;\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint;\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte;\n }\n break\n case 2:\n secondByte = buf[i + 1];\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F);\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint;\n }\n }\n break\n case 3:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F);\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint;\n }\n }\n break\n case 4:\n secondByte = buf[i + 1];\n thirdByte = buf[i + 2];\n fourthByte = buf[i + 3];\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F);\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint;\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD;\n bytesPerSequence = 1;\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000;\n res.push(codePoint >>> 10 & 0x3FF | 0xD800);\n codePoint = 0xDC00 | codePoint & 0x3FF;\n }\n\n res.push(codePoint);\n i += bytesPerSequence;\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000;\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length;\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid "call stack size exceeded".\n var res = \'\';\n var i = 0;\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n );\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = \'\';\n end = Math.min(buf.length, end);\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F);\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = \'\';\n end = Math.min(buf.length, end);\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i]);\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length;\n\n if (!start || start < 0) start = 0;\n if (!end || end < 0 || end > len) end = len;\n\n var out = \'\';\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i]);\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end);\n var res = \'\';\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length;\n start = ~~start;\n end = end === undefined ? len : ~~end;\n\n if (start < 0) {\n start += len;\n if (start < 0) start = 0;\n } else if (start > len) {\n start = len;\n }\n\n if (end < 0) {\n end += len;\n if (end < 0) end = 0;\n } else if (end > len) {\n end = len;\n }\n\n if (end < start) end = start;\n\n var newBuf;\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end);\n newBuf.__proto__ = Buffer.prototype;\n } else {\n var sliceLen = end - start;\n newBuf = new Buffer(sliceLen, undefined);\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start];\n }\n }\n\n return newBuf\n};\n\n/*\n * Need to make sure that buffer isn\'t trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError(\'offset is not uint\')\n if (offset + ext > length) throw new RangeError(\'Trying to access beyond buffer length\')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n var val = this[offset];\n var mul = 1;\n var i = 0;\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n\n return val\n};\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length);\n }\n\n var val = this[offset + --byteLength];\n var mul = 1;\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul;\n }\n\n return val\n};\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length);\n return this[offset]\n};\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n return this[offset] | (this[offset + 1] << 8)\n};\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n return (this[offset] << 8) | this[offset + 1]\n};\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n};\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n};\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n var val = this[offset];\n var mul = 1;\n var i = 0;\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul;\n }\n mul *= 0x80;\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n return val\n};\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) checkOffset(offset, byteLength, this.length);\n\n var i = byteLength;\n var mul = 1;\n var val = this[offset + --i];\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul;\n }\n mul *= 0x80;\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength);\n\n return val\n};\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length);\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n};\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n var val = this[offset] | (this[offset + 1] << 8);\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n};\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length);\n var val = this[offset + 1] | (this[offset] << 8);\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n};\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n};\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n};\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, true, 23, 4)\n};\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length);\n return ieee754.read(this, offset, false, 23, 4)\n};\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, true, 52, 8)\n};\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length);\n return ieee754.read(this, offset, false, 52, 8)\n};\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError(\'"buffer" argument must be a Buffer instance\')\n if (value > max || value < min) throw new RangeError(\'"value" argument is out of bounds\')\n if (offset + ext > buf.length) throw new RangeError(\'Index out of range\')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n var mul = 1;\n var i = 0;\n this[offset] = value & 0xFF;\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF;\n }\n\n return offset + byteLength\n};\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n byteLength = byteLength | 0;\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1;\n checkInt(this, value, offset, byteLength, maxBytes, 0);\n }\n\n var i = byteLength - 1;\n var mul = 1;\n this[offset + i] = value & 0xFF;\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF;\n }\n\n return offset + byteLength\n};\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0);\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);\n this[offset] = (value & 0xff);\n return offset + 1\n};\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1;\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8;\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n } else {\n objectWriteUInt16(this, value, offset, true);\n }\n return offset + 2\n};\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0);\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8);\n this[offset + 1] = (value & 0xff);\n } else {\n objectWriteUInt16(this, value, offset, false);\n }\n return offset + 2\n};\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1;\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff;\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24);\n this[offset + 2] = (value >>> 16);\n this[offset + 1] = (value >>> 8);\n this[offset] = (value & 0xff);\n } else {\n objectWriteUInt32(this, value, offset, true);\n }\n return offset + 4\n};\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0);\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24);\n this[offset + 1] = (value >>> 16);\n this[offset + 2] = (value >>> 8);\n this[offset + 3] = (value & 0xff);\n } else {\n objectWriteUInt32(this, value, offset, false);\n }\n return offset + 4\n};\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1);\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n var i = 0;\n var mul = 1;\n var sub = 0;\n this[offset] = value & 0xFF;\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength\n};\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1);\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit);\n }\n\n var i = byteLength - 1;\n var mul = 1;\n var sub = 0;\n this[offset + i] = value & 0xFF;\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1;\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF;\n }\n\n return offset + byteLength\n};\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80);\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value);\n if (value < 0) value = 0xff + value + 1;\n this[offset] = (value & 0xff);\n return offset + 1\n};\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n } else {\n objectWriteUInt16(this, value, offset, true);\n }\n return offset + 2\n};\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000);\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8);\n this[offset + 1] = (value & 0xff);\n } else {\n objectWriteUInt16(this, value, offset, false);\n }\n return offset + 2\n};\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff);\n this[offset + 1] = (value >>> 8);\n this[offset + 2] = (value >>> 16);\n this[offset + 3] = (value >>> 24);\n } else {\n objectWriteUInt32(this, value, offset, true);\n }\n return offset + 4\n};\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value;\n offset = offset | 0;\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000);\n if (value < 0) value = 0xffffffff + value + 1;\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24);\n this[offset + 1] = (value >>> 16);\n this[offset + 2] = (value >>> 8);\n this[offset + 3] = (value & 0xff);\n } else {\n objectWriteUInt32(this, value, offset, false);\n }\n return offset + 4\n};\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError(\'Index out of range\')\n if (offset < 0) throw new RangeError(\'Index out of range\')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38);\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4);\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n};\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n};\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308);\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8);\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n};\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n};\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0;\n if (!end && end !== 0) end = this.length;\n if (targetStart >= target.length) targetStart = target.length;\n if (!targetStart) targetStart = 0;\n if (end > 0 && end < start) end = start;\n\n // Copy 0 bytes; we\'re done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError(\'targetStart out of bounds\')\n }\n if (start < 0 || start >= this.length) throw new RangeError(\'sourceStart out of bounds\')\n if (end < 0) throw new RangeError(\'sourceEnd out of bounds\')\n\n // Are we oob?\n if (end > this.length) end = this.length;\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start;\n }\n\n var len = end - start;\n var i;\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start];\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start];\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n );\n }\n\n return len\n};\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === \'string\') {\n if (typeof start === \'string\') {\n encoding = start;\n start = 0;\n end = this.length;\n } else if (typeof end === \'string\') {\n encoding = end;\n end = this.length;\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0);\n if (code < 256) {\n val = code;\n }\n }\n if (encoding !== undefined && typeof encoding !== \'string\') {\n throw new TypeError(\'encoding must be a string\')\n }\n if (typeof encoding === \'string\' && !Buffer.isEncoding(encoding)) {\n throw new TypeError(\'Unknown encoding: \' + encoding)\n }\n } else if (typeof val === \'number\') {\n val = val & 255;\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError(\'Out of range index\')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0;\n end = end === undefined ? this.length : end >>> 0;\n\n if (!val) val = 0;\n\n var i;\n if (typeof val === \'number\') {\n for (i = start; i < end; ++i) {\n this[i] = val;\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString());\n var len = bytes.length;\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len];\n }\n }\n\n return this\n};\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g;\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, \'\');\n // Node converts strings with length < 2 to \'\'\n if (str.length < 2) return \'\'\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + \'=\';\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, \'\')\n}\n\nfunction toHex (n) {\n if (n < 16) return \'0\' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity;\n var codePoint;\n var length = string.length;\n var leadSurrogate = null;\n var bytes = [];\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i);\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint;\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n leadSurrogate = codePoint;\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000;\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD);\n }\n\n leadSurrogate = null;\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint);\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n );\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n );\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n );\n } else {\n throw new Error(\'Invalid code point\')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = [];\n for (var i = 0; i < str.length; ++i) {\n // Node\'s code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF);\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo;\n var byteArray = [];\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i);\n hi = c >> 8;\n lo = c % 256;\n byteArray.push(lo);\n byteArray.push(hi);\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i];\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_287095__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")));\n\n/***/ }),\n\n/***/ "./node_modules/node-libs-browser/node_modules/events/events.js":\n/*!**********************************************************************!*\\\n !*** ./node_modules/node-libs-browser/node_modules/events/events.js ***!\n \\**********************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// "Software"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\nvar R = typeof Reflect === \'object\' ? Reflect : null;\nvar ReflectApply = R && typeof R.apply === \'function\'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n };\n\nvar ReflectOwnKeys;\nif (R && typeof R.ownKeys === \'function\') {\n ReflectOwnKeys = R.ownKeys;\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n};\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== \'function\') {\n throw new TypeError(\'The "listener" argument must be of type Function. Received type \' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, \'defaultMaxListeners\', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== \'number\' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError(\'The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received \' + arg + \'.\');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== \'number\' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError(\'The value of "n" is out of range. It must be a non-negative number. Received \' + n + \'.\');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === \'error\');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no \'error\' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node\'s output if this results in an unhandled exception.\n throw er; // Unhandled \'error\' event\n }\n // At least give some kind of context to the user\n var err = new Error(\'Unhandled error.\' + (er ? \' (\' + er.message + \')\' : \'\'));\n err.context = er;\n throw err; // Unhandled \'error\' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === \'function\') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === "newListener"! Before\n // adding it to the listeners, first emit "newListener".\n if (events.newListener !== undefined) {\n target.emit(\'newListener\', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don\'t need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === \'function\') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we\'ve already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error(\'Possible EventEmitter memory leak detected. \' +\n existing.length + \' \' + String(type) + \' listeners \' +\n \'added. Use emitter.setMaxListeners() to \' +\n \'increase limit\');\n w.name = \'MaxListenersExceededWarning\';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a \'removeListener\' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit(\'removeListener\', type, list.listener || listener);\n }\n } else if (typeof list !== \'function\') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit(\'removeListener\', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === \'removeListener\') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners(\'removeListener\');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === \'function\') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === \'function\')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === \'function\') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === \'function\') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === \'function\') {\n emitter.removeListener(\'error\', errorListener);\n }\n resolve([].slice.call(arguments));\n }\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== \'error\') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === \'function\') {\n eventTargetAgnosticAddListener(emitter, \'error\', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === \'function\') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === \'function\') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError(\'The "emitter" argument must be of type EventEmitter. Received type \' + typeof emitter);\n }\n}\n\n\n/***/ }),\n\n/***/ "./node_modules/node-libs-browser/node_modules/timers-browserify/main.js":\n/*!*******************************************************************************!*\\\n !*** ./node_modules/node-libs-browser/node_modules/timers-browserify/main.js ***!\n \\*******************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_352236__) {\n\n/* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||\n (typeof self !== "undefined" && self) ||\n window;\nvar apply = Function.prototype.apply;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(scope, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// setimmediate attaches itself to the global object\n__nested_webpack_require_352236__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js");\n// On some exotic environments, it\'s not clear which object `setimmediate` was\n// able to install onto. Search each possibility in the same order as the\n// `setimmediate` library.\nexports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||\n (typeof global !== "undefined" && global.setImmediate) ||\n (this && this.setImmediate);\nexports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||\n (typeof global !== "undefined" && global.clearImmediate) ||\n (this && this.clearImmediate);\n\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_352236__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")));\n\n/***/ }),\n\n/***/ "./node_modules/path-browserify/index.js":\n/*!***********************************************!*\\\n !*** ./node_modules/path-browserify/index.js ***!\n \\***********************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_354826__) {\n\n/* WEBPACK VAR INJECTION */(function(process) {// .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,\n// backported and transplited with Babel, with backwards-compat fixes\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// "Software"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === \'.\') {\n parts.splice(i, 1);\n } else if (last === \'..\') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift(\'..\');\n }\n }\n\n return parts;\n}\n\n// path.resolve([from ...], to)\n// posix version\nexports.resolve = function() {\n var resolvedPath = \'\',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : process.cwd();\n\n // Skip empty and invalid entries\n if (typeof path !== \'string\') {\n throw new TypeError(\'Arguments to path.resolve must be strings\');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + \'/\' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === \'/\';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split(\'/\'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join(\'/\');\n\n return ((resolvedAbsolute ? \'/\' : \'\') + resolvedPath) || \'.\';\n};\n\n// path.normalize(path)\n// posix version\nexports.normalize = function(path) {\n var isAbsolute = exports.isAbsolute(path),\n trailingSlash = substr(path, -1) === \'/\';\n\n // Normalize the path\n path = normalizeArray(filter(path.split(\'/\'), function(p) {\n return !!p;\n }), !isAbsolute).join(\'/\');\n\n if (!path && !isAbsolute) {\n path = \'.\';\n }\n if (path && trailingSlash) {\n path += \'/\';\n }\n\n return (isAbsolute ? \'/\' : \'\') + path;\n};\n\n// posix version\nexports.isAbsolute = function(path) {\n return path.charAt(0) === \'/\';\n};\n\n// posix version\nexports.join = function() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return exports.normalize(filter(paths, function(p, index) {\n if (typeof p !== \'string\') {\n throw new TypeError(\'Arguments to path.join must be strings\');\n }\n return p;\n }).join(\'/\'));\n};\n\n\n// path.relative(from, to)\n// posix version\nexports.relative = function(from, to) {\n from = exports.resolve(from).substr(1);\n to = exports.resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== \'\') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== \'\') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split(\'/\'));\n var toParts = trim(to.split(\'/\'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push(\'..\');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join(\'/\');\n};\n\nexports.sep = \'/\';\nexports.delimiter = \':\';\n\nexports.dirname = function (path) {\n if (typeof path !== \'string\') path = path + \'\';\n if (path.length === 0) return \'.\';\n var code = path.charCodeAt(0);\n var hasRoot = code === 47 /*/*/;\n var end = -1;\n var matchedSlash = true;\n for (var i = path.length - 1; i >= 1; --i) {\n code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n if (!matchedSlash) {\n end = i;\n break;\n }\n } else {\n // We saw the first non-path separator\n matchedSlash = false;\n }\n }\n\n if (end === -1) return hasRoot ? \'/\' : \'.\';\n if (hasRoot && end === 1) {\n // return \'//\';\n // Backwards-compat fix:\n return \'/\';\n }\n return path.slice(0, end);\n};\n\nfunction basename(path) {\n if (typeof path !== \'string\') path = path + \'\';\n\n var start = 0;\n var end = -1;\n var matchedSlash = true;\n var i;\n\n for (i = path.length - 1; i >= 0; --i) {\n if (path.charCodeAt(i) === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n start = i + 1;\n break;\n }\n } else if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // path component\n matchedSlash = false;\n end = i + 1;\n }\n }\n\n if (end === -1) return \'\';\n return path.slice(start, end);\n}\n\n// Uses a mixed approach for backwards-compatibility, as ext behavior changed\n// in new Node.js versions, so only basename() above is backported here\nexports.basename = function (path, ext) {\n var f = basename(path);\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n};\n\nexports.extname = function (path) {\n if (typeof path !== \'string\') path = path + \'\';\n var startDot = -1;\n var startPart = 0;\n var end = -1;\n var matchedSlash = true;\n // Track the state of characters (if any) we see before our first dot and\n // after any path separator we find\n var preDotState = 0;\n for (var i = path.length - 1; i >= 0; --i) {\n var code = path.charCodeAt(i);\n if (code === 47 /*/*/) {\n // If we reached a path separator that was not part of a set of path\n // separators at the end of the string, stop now\n if (!matchedSlash) {\n startPart = i + 1;\n break;\n }\n continue;\n }\n if (end === -1) {\n // We saw the first non-path separator, mark this as the end of our\n // extension\n matchedSlash = false;\n end = i + 1;\n }\n if (code === 46 /*.*/) {\n // If this is our first dot, mark it as the start of our extension\n if (startDot === -1)\n startDot = i;\n else if (preDotState !== 1)\n preDotState = 1;\n } else if (startDot !== -1) {\n // We saw a non-dot and non-path separator before our dot, so we should\n // have a good chance at having a non-empty extension\n preDotState = -1;\n }\n }\n\n if (startDot === -1 || end === -1 ||\n // We saw a non-dot character immediately before the dot\n preDotState === 0 ||\n // The (right-most) trimmed path component is exactly \'..\'\n preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {\n return \'\';\n }\n return path.slice(startDot, end);\n};\n\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don\'t work in IE8\nvar substr = true\n ? function (str, start, len) { return str.substr(start, len) }\n : 0\n;\n\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_354826__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")));\n\n/***/ }),\n\n/***/ "./node_modules/process-nextick-args/index.js":\n/*!****************************************************!*\\\n !*** ./node_modules/process-nextick-args/index.js ***!\n \\****************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_364074__) {\n/* WEBPACK VAR INJECTION */(function(process) {\n\nif (!process.version ||\n process.version.indexOf(\'v0.\') === 0 ||\n process.version.indexOf(\'v1.\') === 0 && process.version.indexOf(\'v1.8.\') !== 0) {\n module.exports = { nextTick: nextTick };\n} else {\n module.exports = process;\n}\n\nfunction nextTick(fn, arg1, arg2, arg3) {\n if (typeof fn !== \'function\') {\n throw new TypeError(\'"callback" argument must be a function\');\n }\n var len = arguments.length;\n var args, i;\n switch (len) {\n case 0:\n case 1:\n return process.nextTick(fn);\n case 2:\n return process.nextTick(function afterTickOne() {\n fn.call(null, arg1);\n });\n case 3:\n return process.nextTick(function afterTickTwo() {\n fn.call(null, arg1, arg2);\n });\n case 4:\n return process.nextTick(function afterTickThree() {\n fn.call(null, arg1, arg2, arg3);\n });\n default:\n args = new Array(len - 1);\n i = 0;\n while (i < args.length) {\n args[i++] = arguments[i];\n }\n return process.nextTick(function afterTick() {\n fn.apply(null, args);\n });\n }\n}\n\n\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_364074__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")));\n\n/***/ }),\n\n/***/ "./node_modules/process/browser.js":\n/*!*****************************************!*\\\n !*** ./node_modules/process/browser.js ***!\n \\*****************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don\'t break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn\'t define any globals. It\'s inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error(\'setTimeout has not been defined\');\n}\nfunction defaultClearTimeout () {\n throw new Error(\'clearTimeout has not been defined\');\n}\n(function () {\n try {\n if (typeof setTimeout === \'function\') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === \'function\') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ());\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn\'t available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn\'t trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it\'s a version of I.E. that must have the global object for \'this\', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn\'t available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn\'t trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it\'s a version of I.E. that must have the global object for \'this\', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = \'browser\';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = \'\'; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] };\n\nprocess.binding = function (name) {\n throw new Error(\'process.binding is not supported\');\n};\n\nprocess.cwd = function () { return \'/\' };\nprocess.chdir = function (dir) {\n throw new Error(\'process.chdir is not supported\');\n};\nprocess.umask = function() { return 0; };\n\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/duplex-browser.js":\n/*!********************************************************!*\\\n !*** ./node_modules/readable-stream/duplex-browser.js ***!\n \\********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_371311__) {\n\nmodule.exports = __nested_webpack_require_371311__(/*! ./lib/_stream_duplex.js */ "./node_modules/readable-stream/lib/_stream_duplex.js");\n\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/lib/_stream_duplex.js":\n/*!************************************************************!*\\\n !*** ./node_modules/readable-stream/lib/_stream_duplex.js ***!\n \\************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_371796__) {\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// "Software"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn\'t have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n\n\n/*<replacement>*/\n\nvar pna = __nested_webpack_require_371796__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js");\n/*</replacement>*/\n\n/*<replacement>*/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n keys.push(key);\n }return keys;\n};\n/*</replacement>*/\n\nmodule.exports = Duplex;\n\n/*<replacement>*/\nvar util = __nested_webpack_require_371796__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js");\nutil.inherits = __nested_webpack_require_371796__(/*! inherits */ "./node_modules/inherits/inherits_browser.js");\n/*</replacement>*/\n\nvar Readable = __nested_webpack_require_371796__(/*! ./_stream_readable */ "./node_modules/readable-stream/lib/_stream_readable.js");\nvar Writable = __nested_webpack_require_371796__(/*! ./_stream_writable */ "./node_modules/readable-stream/lib/_stream_writable.js");\n\nutil.inherits(Duplex, Readable);\n\n{\n // avoid scope creep, the keys array can then be collected\n var keys = objectKeys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false) this.readable = false;\n\n if (options && options.writable === false) this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;\n\n this.once(\'end\', onend);\n}\n\nObject.defineProperty(Duplex.prototype, \'writableHighWaterMark\', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._writableState.highWaterMark;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we\'re ok.\n if (this.allowHalfOpen || this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n pna.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, \'destroyed\', {\n get: function () {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\nDuplex.prototype._destroy = function (err, cb) {\n this.push(null);\n this.end();\n\n pna.nextTick(cb, err);\n};\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/lib/_stream_passthrough.js":\n/*!*****************************************************************!*\\\n !*** ./node_modules/readable-stream/lib/_stream_passthrough.js ***!\n \\*****************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_376496__) {\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// "Software"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a passthrough stream.\n// basically just the most minimal sort of Transform stream.\n// Every written chunk gets output as-is.\n\n\n\nmodule.exports = PassThrough;\n\nvar Transform = __nested_webpack_require_376496__(/*! ./_stream_transform */ "./node_modules/readable-stream/lib/_stream_transform.js");\n\n/*<replacement>*/\nvar util = __nested_webpack_require_376496__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js");\nutil.inherits = __nested_webpack_require_376496__(/*! inherits */ "./node_modules/inherits/inherits_browser.js");\n/*</replacement>*/\n\nutil.inherits(PassThrough, Transform);\n\nfunction PassThrough(options) {\n if (!(this instanceof PassThrough)) return new PassThrough(options);\n\n Transform.call(this, options);\n}\n\nPassThrough.prototype._transform = function (chunk, encoding, cb) {\n cb(null, chunk);\n};\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/lib/_stream_readable.js":\n/*!**************************************************************!*\\\n !*** ./node_modules/readable-stream/lib/_stream_readable.js ***!\n \\**************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_378785__) {\n/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// "Software"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n/*<replacement>*/\n\nvar pna = __nested_webpack_require_378785__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js");\n/*</replacement>*/\n\nmodule.exports = Readable;\n\n/*<replacement>*/\nvar isArray = __nested_webpack_require_378785__(/*! isarray */ "./node_modules/isarray/index.js");\n/*</replacement>*/\n\n/*<replacement>*/\nvar Duplex;\n/*</replacement>*/\n\nReadable.ReadableState = ReadableState;\n\n/*<replacement>*/\nvar EE = __nested_webpack_require_378785__(/*! events */ "./node_modules/node-libs-browser/node_modules/events/events.js").EventEmitter;\n\nvar EElistenerCount = function (emitter, type) {\n return emitter.listeners(type).length;\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream = __nested_webpack_require_378785__(/*! ./internal/streams/stream */ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js");\n/*</replacement>*/\n\n/*<replacement>*/\n\nvar Buffer = __nested_webpack_require_378785__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer;\nvar OurUint8Array = global.Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/*</replacement>*/\n\n/*<replacement>*/\nvar util = __nested_webpack_require_378785__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js");\nutil.inherits = __nested_webpack_require_378785__(/*! inherits */ "./node_modules/inherits/inherits_browser.js");\n/*</replacement>*/\n\n/*<replacement>*/\nvar debugUtil = __nested_webpack_require_378785__(/*! util */ 0);\nvar debug = void 0;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog(\'stream\');\n} else {\n debug = function () {};\n}\n/*</replacement>*/\n\nvar BufferList = __nested_webpack_require_378785__(/*! ./internal/streams/BufferList */ "./node_modules/readable-stream/lib/internal/streams/BufferList.js");\nvar destroyImpl = __nested_webpack_require_378785__(/*! ./internal/streams/destroy */ "./node_modules/readable-stream/lib/internal/streams/destroy.js");\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nvar kProxyEvents = [\'error\', \'close\', \'destroy\', \'pause\', \'resume\'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === \'function\') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream) {\n Duplex = Duplex || __nested_webpack_require_378785__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js");\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means "don\'t call _read preemptively ever"\n var hwm = options.highWaterMark;\n var readableHwm = options.readableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event \'readable\'/\'data\' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn\'t happen until "later" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we\'re awaiting a \'readable\' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is \'binary\' so we have to make this configurable.\n // Everything else in the universe uses \'utf8\', though.\n this.defaultEncoding = options.defaultEncoding || \'utf8\';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = __nested_webpack_require_378785__(/*! string_decoder/ */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || __nested_webpack_require_378785__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js");\n\n if (!(this instanceof Readable)) return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n if (options) {\n if (typeof options.read === \'function\') this._read = options.read;\n\n if (typeof options.destroy === \'function\') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, \'destroyed\', {\n get: function () {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\n\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n this.push(null);\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === \'string\') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = \'\';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit(\'error\', er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== \'string\' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) stream.emit(\'error\', new Error(\'stream.unshift() after end event\'));else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n stream.emit(\'error\', new Error(\'stream.push() after EOF\'));\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n }\n\n return needMoreData(state);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit(\'data\', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== \'string\' && chunk !== undefined && !state.objectMode) {\n er = new TypeError(\'Invalid non-string/buffer chunk\');\n }\n return er;\n}\n\n// if it\'s past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// \'readable\' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = __nested_webpack_require_378785__(/*! string_decoder/ */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n};\n\n// Don\'t raise the hwm > 8MB\nvar MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we\'re asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don\'t have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug(\'read\', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n\n if (n !== 0) state.emittedReadable = false;\n\n // if we\'re doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the \'readable\' event and move on.\n if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {\n debug(\'read: emitReadable\', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we\'ve ended, and we\'re now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn\'t mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it\'s safe to emit\n // \'readable\' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug(\'need readable\', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug(\'length less than watermark\', doRead);\n }\n\n // however, if we\'ve ended, then there\'s no point, and if we\'re already\n // reading, then it\'s unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug(\'reading or ended\', doRead);\n } else if (doRead) {\n debug(\'do read\');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n } else {\n state.length -= n;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit(\'data\', ret);\n\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // emit \'readable\' now to make sure it gets picked up.\n emitReadable(stream);\n}\n\n// Don\'t emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that\'s not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug(\'emitReadable\', state.flowing);\n state.emittedReadable = true;\n if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug(\'emit readable\');\n stream.emit(\'readable\');\n flow(stream);\n}\n\n// at this point, the user has presumably seen the \'readable\' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it\'s in progress.\n// However, if we\'re not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n pna.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {\n debug(\'maybeReadMore read 0\');\n stream.read(0);\n if (len === state.length)\n // didn\'t get any data, stop spinning.\n break;else len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, "length" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n this.emit(\'error\', new Error(\'_read() is not implemented\'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug(\'pipe count=%d opts=%j\', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) pna.nextTick(endFn);else src.once(\'end\', endFn);\n\n dest.on(\'unpipe\', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug(\'onunpipe\');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug(\'onend\');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on(\'drain\', ondrain);\n\n var cleanedUp = false;\n function cleanup() {\n debug(\'cleanup\');\n // cleanup event handlers once the pipe is broken\n dest.removeListener(\'close\', onclose);\n dest.removeListener(\'finish\', onfinish);\n dest.removeListener(\'drain\', ondrain);\n dest.removeListener(\'error\', onerror);\n dest.removeListener(\'unpipe\', onunpipe);\n src.removeListener(\'end\', onend);\n src.removeListener(\'end\', unpipe);\n src.removeListener(\'data\', ondata);\n\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don\'t know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n // If the user pushes more data while we\'re writing to dest then we\'ll end up\n // in ondata again. However, we only want to increase awaitDrain once because\n // dest will only emit one \'drain\' event for the multiple writes.\n // => Introduce a guard on increasing awaitDrain.\n var increasedAwaitDrain = false;\n src.on(\'data\', ondata);\n function ondata(chunk) {\n debug(\'ondata\');\n increasedAwaitDrain = false;\n var ret = dest.write(chunk);\n if (false === ret && !increasedAwaitDrain) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug(\'false write response, pause\', src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n increasedAwaitDrain = true;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don\'t suppress the throwing behavior for this.\n function onerror(er) {\n debug(\'onerror\', er);\n unpipe();\n dest.removeListener(\'error\', onerror);\n if (EElistenerCount(dest, \'error\') === 0) dest.emit(\'error\', er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, \'error\', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener(\'finish\', onfinish);\n unpipe();\n }\n dest.once(\'close\', onclose);\n function onfinish() {\n debug(\'onfinish\');\n dest.removeListener(\'close\', onclose);\n unpipe();\n }\n dest.once(\'finish\', onfinish);\n\n function unpipe() {\n debug(\'unpipe\');\n src.unpipe(dest);\n }\n\n // tell the dest that it\'s being piped to\n dest.emit(\'pipe\', src);\n\n // start the flow if it hasn\'t been started already.\n if (!state.flowing) {\n debug(\'pipe resume\');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function () {\n var state = src._readableState;\n debug(\'pipeOnDrain\', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, \'data\')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = { hasUnpiped: false };\n\n // if we\'re not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it\'s not the right one.\n if (dest && dest !== state.pipes) return this;\n\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit(\'unpipe\', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit(\'unpipe\', this, unpipeInfo);\n }return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n\n dest.emit(\'unpipe\', this, unpipeInfo);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n if (ev === \'data\') {\n // Start flowing on next tick if stream isn\'t explicitly paused\n if (this._readableState.flowing !== false) this.resume();\n } else if (ev === \'readable\') {\n var state = this._readableState;\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.emittedReadable = false;\n if (!state.reading) {\n pna.nextTick(nReadingNextTick, this);\n } else if (state.length) {\n emitReadable(this);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n debug(\'readable nexttick read 0\');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug(\'resume\');\n state.flowing = true;\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n pna.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n if (!state.reading) {\n debug(\'resume read 0\');\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n state.awaitDrain = 0;\n stream.emit(\'resume\');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug(\'call pause flowing=%j\', this._readableState.flowing);\n if (false !== this._readableState.flowing) {\n debug(\'pause\');\n this._readableState.flowing = false;\n this.emit(\'pause\');\n }\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug(\'flow\', state.flowing);\n while (state.flowing && stream.read() !== null) {}\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n\n stream.on(\'end\', function () {\n debug(\'wrapped end\');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n\n stream.on(\'data\', function (chunk) {\n debug(\'wrapped data\');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don\'t skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === \'function\') {\n this[i] = function (method) {\n return function () {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug(\'wrapped _read\', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nObject.defineProperty(Readable.prototype, \'readableHighWaterMark\', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._readableState.highWaterMark;\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join(\'\');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = fromListPartial(n, state.buffer, state.decoder);\n }\n\n return ret;\n}\n\n// Extracts only enough buffered data to satisfy the amount requested.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n}\n\n// Copies a specified amount of characters from the list of buffered data\n// chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\n// Copies a specified amount of bytes from the list of buffered data chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBuffer(n, list) {\n var ret = Buffer.allocUnsafe(n);\n var p = list.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0) throw new Error(\'"endReadable()" called on non-empty stream\');\n\n if (!state.endEmitted) {\n state.ended = true;\n pna.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n // Check that we didn\'t get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit(\'end\');\n }\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_378785__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __nested_webpack_require_378785__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")));\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/lib/_stream_transform.js":\n/*!***************************************************************!*\\\n !*** ./node_modules/readable-stream/lib/_stream_transform.js ***!\n \\***************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_411682__) {\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// "Software"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it\'s called a "filter",\n// but that\'s not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it\'s not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here\'s how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there\'s a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there\'s enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb\'s as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit \'readable\' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there\'d be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n\n\nmodule.exports = Transform;\n\nvar Duplex = __nested_webpack_require_411682__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js");\n\n/*<replacement>*/\nvar util = __nested_webpack_require_411682__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js");\nutil.inherits = __nested_webpack_require_411682__(/*! inherits */ "./node_modules/inherits/inherits_browser.js");\n/*</replacement>*/\n\nutil.inherits(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb) {\n return this.emit(\'error\', new Error(\'write callback called multiple times\'));\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n\n cb(er);\n\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === \'function\') this._transform = options.transform;\n\n if (typeof options.flush === \'function\') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on(\'prefinish\', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === \'function\') {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// \'chunk\' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call \'push\' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that\'ll put the hurt on the whole operation. If you\n// never call cb(), then you\'ll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n throw new Error(\'_transform() is not implemented\');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn\'t matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we\'ve asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n var _this2 = this;\n\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n _this2.emit(\'close\');\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit(\'error\', er);\n\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // if there\'s nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new Error(\'Calling transform done when ws.length != 0\');\n\n if (stream._transformState.transforming) throw new Error(\'Calling transform done when still transforming\');\n\n return stream.push(null);\n}\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/lib/_stream_writable.js":\n/*!**************************************************************!*\\\n !*** ./node_modules/readable-stream/lib/_stream_writable.js ***!\n \\**************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_419957__) {\n/* WEBPACK VAR INJECTION */(function(process, setImmediate, global) {// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// "Software"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it\'ll handle all\n// the drain event emission and buffering.\n\n\n\n/*<replacement>*/\n\nvar pna = __nested_webpack_require_419957__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js");\n/*</replacement>*/\n\nmodule.exports = Writable;\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* </replacement> */\n\n/*<replacement>*/\nvar asyncWrite = !process.browser && [\'v0.10\', \'v0.9.\'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;\n/*</replacement>*/\n\n/*<replacement>*/\nvar Duplex;\n/*</replacement>*/\n\nWritable.WritableState = WritableState;\n\n/*<replacement>*/\nvar util = __nested_webpack_require_419957__(/*! core-util-is */ "./node_modules/core-util-is/lib/util.js");\nutil.inherits = __nested_webpack_require_419957__(/*! inherits */ "./node_modules/inherits/inherits_browser.js");\n/*</replacement>*/\n\n/*<replacement>*/\nvar internalUtil = {\n deprecate: __nested_webpack_require_419957__(/*! util-deprecate */ "./node_modules/util-deprecate/browser.js")\n};\n/*</replacement>*/\n\n/*<replacement>*/\nvar Stream = __nested_webpack_require_419957__(/*! ./internal/streams/stream */ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js");\n/*</replacement>*/\n\n/*<replacement>*/\n\nvar Buffer = __nested_webpack_require_419957__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer;\nvar OurUint8Array = global.Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/*</replacement>*/\n\nvar destroyImpl = __nested_webpack_require_419957__(/*! ./internal/streams/destroy */ "./node_modules/readable-stream/lib/internal/streams/destroy.js");\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream) {\n Duplex = Duplex || __nested_webpack_require_419957__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js");\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n var writableHwm = options.writableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when \'finish\' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is \'binary\' so we have to make this configurable.\n // Everything else in the universe uses \'utf8\', though.\n this.defaultEncoding = options.defaultEncoding || \'utf8\';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we\'re waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we\'re in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn\'t happen until "later" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we\'re processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don\'t\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that\'s passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before \'finish\' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we\'re waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, \'buffer\', {\n get: internalUtil.deprecate(function () {\n return this.getBuffer();\n }, \'_writableState.buffer is deprecated. Use _writableState.getBuffer \' + \'instead.\', \'DEP0003\')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === \'function\' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === \'function\') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function (object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function (object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || __nested_webpack_require_419957__(/*! ./_stream_duplex */ "./node_modules/readable-stream/lib/_stream_duplex.js");\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {\n return new Writable(options);\n }\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n if (options) {\n if (typeof options.write === \'function\') this._write = options.write;\n\n if (typeof options.writev === \'function\') this._writev = options.writev;\n\n if (typeof options.destroy === \'function\') this._destroy = options.destroy;\n\n if (typeof options.final === \'function\') this._final = options.final;\n }\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n this.emit(\'error\', new Error(\'Cannot pipe, not readable\'));\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new Error(\'write after end\');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit(\'error\', er);\n pna.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError(\'May not write null values to stream\');\n } else if (typeof chunk !== \'string\' && chunk !== undefined && !state.objectMode) {\n er = new TypeError(\'Invalid non-string/buffer chunk\');\n }\n if (er) {\n stream.emit(\'error\', er);\n pna.nextTick(cb, er);\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === \'function\') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = \'buffer\';else if (!encoding) encoding = state.defaultEncoding;\n\n if (typeof cb !== \'function\') cb = nop;\n\n if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function () {\n var state = this._writableState;\n\n state.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === \'string\') encoding = encoding.toLowerCase();\n if (!([\'hex\', \'utf8\', \'utf-8\', \'ascii\', \'binary\', \'base64\', \'ucs2\', \'ucs-2\', \'utf16le\', \'utf-16le\', \'raw\'].indexOf((encoding + \'\').toLowerCase()) > -1)) throw new TypeError(\'Unknown encoding: \' + encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === \'string\') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, \'writableHighWaterMark\', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we\'re already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = \'buffer\';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n pna.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n pna.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n stream.emit(\'error\', er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n stream.emit(\'error\', er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we\'re actually ready to finish, but don\'t emit yet\n var finished = needFinish(state);\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n /*<replacement>*/\n asyncWrite(afterWrite, stream, state, finished, cb);\n /*</replacement>*/\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don\'t\n// emit \'drain\' before the write() consumer gets the \'false\' return\n// value, and has a chance to attach a \'drain\' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit(\'drain\');\n }\n}\n\n// if there\'s something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n\n doWrite(stream, state, true, state.length, buffer, \'\', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn\'t call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new Error(\'_write() is not implemented\'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === \'function\') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === \'function\') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished) endWritable(this, state, cb);\n};\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n stream.emit(\'error\', err);\n }\n state.prefinished = true;\n stream.emit(\'prefinish\');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === \'function\') {\n state.pendingcb++;\n state.finalCalled = true;\n pna.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit(\'prefinish\');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit(\'finish\');\n }\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) pna.nextTick(cb);else stream.once(\'finish\', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n if (state.corkedRequestsFree) {\n state.corkedRequestsFree.next = corkReq;\n } else {\n state.corkedRequestsFree = corkReq;\n }\n}\n\nObject.defineProperty(Writable.prototype, \'destroyed\', {\n get: function () {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\n\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n this.end();\n cb(err);\n};\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_419957__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js"), __nested_webpack_require_419957__(/*! ./../../node-libs-browser/node_modules/timers-browserify/main.js */ "./node_modules/node-libs-browser/node_modules/timers-browserify/main.js").setImmediate, __nested_webpack_require_419957__(/*! ./../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")));\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/lib/internal/streams/BufferList.js":\n/*!*************************************************************************!*\\\n !*** ./node_modules/readable-stream/lib/internal/streams/BufferList.js ***!\n \\*************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_441607__) {\n\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nvar Buffer = __nested_webpack_require_441607__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer;\nvar util = __nested_webpack_require_441607__(/*! util */ 1);\n\nfunction copyBuffer(src, target, offset) {\n src.copy(target, offset);\n}\n\nmodule.exports = function () {\n function BufferList() {\n _classCallCheck(this, BufferList);\n\n this.head = null;\n this.tail = null;\n this.length = 0;\n }\n\n BufferList.prototype.push = function push(v) {\n var entry = { data: v, next: null };\n if (this.length > 0) this.tail.next = entry;else this.head = entry;\n this.tail = entry;\n ++this.length;\n };\n\n BufferList.prototype.unshift = function unshift(v) {\n var entry = { data: v, next: this.head };\n if (this.length === 0) this.tail = entry;\n this.head = entry;\n ++this.length;\n };\n\n BufferList.prototype.shift = function shift() {\n if (this.length === 0) return;\n var ret = this.head.data;\n if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;\n --this.length;\n return ret;\n };\n\n BufferList.prototype.clear = function clear() {\n this.head = this.tail = null;\n this.length = 0;\n };\n\n BufferList.prototype.join = function join(s) {\n if (this.length === 0) return \'\';\n var p = this.head;\n var ret = \'\' + p.data;\n while (p = p.next) {\n ret += s + p.data;\n }return ret;\n };\n\n BufferList.prototype.concat = function concat(n) {\n if (this.length === 0) return Buffer.alloc(0);\n if (this.length === 1) return this.head.data;\n var ret = Buffer.allocUnsafe(n >>> 0);\n var p = this.head;\n var i = 0;\n while (p) {\n copyBuffer(p.data, ret, i);\n i += p.data.length;\n p = p.next;\n }\n return ret;\n };\n\n return BufferList;\n}();\n\nif (util && util.inspect && util.inspect.custom) {\n module.exports.prototype[util.inspect.custom] = function () {\n var obj = util.inspect({ length: this.length });\n return this.constructor.name + \' \' + obj;\n };\n}\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/lib/internal/streams/destroy.js":\n/*!**********************************************************************!*\\\n !*** ./node_modules/readable-stream/lib/internal/streams/destroy.js ***!\n \\**********************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_444126__) {\n\n\n/*<replacement>*/\n\nvar pna = __nested_webpack_require_444126__(/*! process-nextick-args */ "./node_modules/process-nextick-args/index.js");\n/*</replacement>*/\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {\n pna.nextTick(emitErrorNT, this, err);\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n pna.nextTick(emitErrorNT, _this, err);\n if (_this._writableState) {\n _this._writableState.errorEmitted = true;\n }\n } else if (cb) {\n cb(err);\n }\n });\n\n return this;\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit(\'error\', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy\n};\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/lib/internal/streams/stream-browser.js":\n/*!*****************************************************************************!*\\\n !*** ./node_modules/readable-stream/lib/internal/streams/stream-browser.js ***!\n \\*****************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_446453__) {\n\nmodule.exports = __nested_webpack_require_446453__(/*! events */ "./node_modules/node-libs-browser/node_modules/events/events.js").EventEmitter;\n\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/passthrough.js":\n/*!*****************************************************!*\\\n !*** ./node_modules/readable-stream/passthrough.js ***!\n \\*****************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_446916__) {\n\nmodule.exports = __nested_webpack_require_446916__(/*! ./readable */ "./node_modules/readable-stream/readable-browser.js").PassThrough;\n\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/readable-browser.js":\n/*!**********************************************************!*\\\n !*** ./node_modules/readable-stream/readable-browser.js ***!\n \\**********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_447390__) {\n\nexports = module.exports = __nested_webpack_require_447390__(/*! ./lib/_stream_readable.js */ "./node_modules/readable-stream/lib/_stream_readable.js");\nexports.Stream = exports;\nexports.Readable = exports;\nexports.Writable = __nested_webpack_require_447390__(/*! ./lib/_stream_writable.js */ "./node_modules/readable-stream/lib/_stream_writable.js");\nexports.Duplex = __nested_webpack_require_447390__(/*! ./lib/_stream_duplex.js */ "./node_modules/readable-stream/lib/_stream_duplex.js");\nexports.Transform = __nested_webpack_require_447390__(/*! ./lib/_stream_transform.js */ "./node_modules/readable-stream/lib/_stream_transform.js");\nexports.PassThrough = __nested_webpack_require_447390__(/*! ./lib/_stream_passthrough.js */ "./node_modules/readable-stream/lib/_stream_passthrough.js");\n\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/transform.js":\n/*!***************************************************!*\\\n !*** ./node_modules/readable-stream/transform.js ***!\n \\***************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_448437__) {\n\nmodule.exports = __nested_webpack_require_448437__(/*! ./readable */ "./node_modules/readable-stream/readable-browser.js").Transform;\n\n\n/***/ }),\n\n/***/ "./node_modules/readable-stream/writable-browser.js":\n/*!**********************************************************!*\\\n !*** ./node_modules/readable-stream/writable-browser.js ***!\n \\**********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_448909__) {\n\nmodule.exports = __nested_webpack_require_448909__(/*! ./lib/_stream_writable.js */ "./node_modules/readable-stream/lib/_stream_writable.js");\n\n\n/***/ }),\n\n/***/ "./node_modules/safe-buffer/index.js":\n/*!*******************************************!*\\\n !*** ./node_modules/safe-buffer/index.js ***!\n \\*******************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_449330__) {\n\n/* eslint-disable node/no-deprecated-api */\nvar buffer = __nested_webpack_require_449330__(/*! buffer */ "./node_modules/node-libs-browser/node_modules/buffer/index.js");\nvar Buffer = buffer.Buffer;\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key];\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer;\n} else {\n // Copy properties from require(\'buffer\')\n copyProps(buffer, exports);\n exports.Buffer = SafeBuffer;\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer);\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === \'number\') {\n throw new TypeError(\'Argument must not be a number\')\n }\n return Buffer(arg, encodingOrOffset, length)\n};\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== \'number\') {\n throw new TypeError(\'Argument must be a number\')\n }\n var buf = Buffer(size);\n if (fill !== undefined) {\n if (typeof encoding === \'string\') {\n buf.fill(fill, encoding);\n } else {\n buf.fill(fill);\n }\n } else {\n buf.fill(0);\n }\n return buf\n};\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== \'number\') {\n throw new TypeError(\'Argument must be a number\')\n }\n return Buffer(size)\n};\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== \'number\') {\n throw new TypeError(\'Argument must be a number\')\n }\n return buffer.SlowBuffer(size)\n};\n\n\n/***/ }),\n\n/***/ "./node_modules/sax/lib/sax.js":\n/*!*************************************!*\\\n !*** ./node_modules/sax/lib/sax.js ***!\n \\*************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_451223__) {\n\n/* WEBPACK VAR INJECTION */(function(Buffer) {(function (sax) { // wrapper for non-node envs\n sax.parser = function (strict, opt) { return new SAXParser(strict, opt) };\n sax.SAXParser = SAXParser;\n sax.SAXStream = SAXStream;\n sax.createStream = createStream;\n\n // When we pass the MAX_BUFFER_LENGTH position, start checking for buffer overruns.\n // When we check, schedule the next check for MAX_BUFFER_LENGTH - (max(buffer lengths)),\n // since that\'s the earliest that a buffer overrun could occur. This way, checks are\n // as rare as required, but as often as necessary to ensure never crossing this bound.\n // Furthermore, buffers are only tested at most once per write(), so passing a very\n // large string into write() might have undesirable effects, but this is manageable by\n // the caller, so it is assumed to be safe. Thus, a call to write() may, in the extreme\n // edge case, result in creating at most one complete copy of the string passed in.\n // Set to Infinity to have unlimited buffers.\n sax.MAX_BUFFER_LENGTH = 64 * 1024;\n\n var buffers = [\n \'comment\', \'sgmlDecl\', \'textNode\', \'tagName\', \'doctype\',\n \'procInstName\', \'procInstBody\', \'entity\', \'attribName\',\n \'attribValue\', \'cdata\', \'script\'\n ];\n\n sax.EVENTS = [\n \'text\',\n \'processinginstruction\',\n \'sgmldeclaration\',\n \'doctype\',\n \'comment\',\n \'opentagstart\',\n \'attribute\',\n \'opentag\',\n \'closetag\',\n \'opencdata\',\n \'cdata\',\n \'closecdata\',\n \'error\',\n \'end\',\n \'ready\',\n \'script\',\n \'opennamespace\',\n \'closenamespace\'\n ];\n\n function SAXParser (strict, opt) {\n if (!(this instanceof SAXParser)) {\n return new SAXParser(strict, opt)\n }\n\n var parser = this;\n clearBuffers(parser);\n parser.q = parser.c = \'\';\n parser.bufferCheckPosition = sax.MAX_BUFFER_LENGTH;\n parser.opt = opt || {};\n parser.opt.lowercase = parser.opt.lowercase || parser.opt.lowercasetags;\n parser.looseCase = parser.opt.lowercase ? \'toLowerCase\' : \'toUpperCase\';\n parser.tags = [];\n parser.closed = parser.closedRoot = parser.sawRoot = false;\n parser.tag = parser.error = null;\n parser.strict = !!strict;\n parser.noscript = !!(strict || parser.opt.noscript);\n parser.state = S.BEGIN;\n parser.strictEntities = parser.opt.strictEntities;\n parser.ENTITIES = parser.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES);\n parser.attribList = [];\n\n // namespaces form a prototype chain.\n // it always points at the current tag,\n // which protos to its parent tag.\n if (parser.opt.xmlns) {\n parser.ns = Object.create(rootNS);\n }\n\n // mostly just for error reporting\n parser.trackPosition = parser.opt.position !== false;\n if (parser.trackPosition) {\n parser.position = parser.line = parser.column = 0;\n }\n emit(parser, \'onready\');\n }\n\n if (!Object.create) {\n Object.create = function (o) {\n function F () {}\n F.prototype = o;\n var newf = new F();\n return newf\n };\n }\n\n if (!Object.keys) {\n Object.keys = function (o) {\n var a = [];\n for (var i in o) if (o.hasOwnProperty(i)) a.push(i);\n return a\n };\n }\n\n function checkBufferLength (parser) {\n var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10);\n var maxActual = 0;\n for (var i = 0, l = buffers.length; i < l; i++) {\n var len = parser[buffers[i]].length;\n if (len > maxAllowed) {\n // Text/cdata nodes can get big, and since they\'re buffered,\n // we can get here under normal conditions.\n // Avoid issues by emitting the text node now,\n // so at least it won\'t get any bigger.\n switch (buffers[i]) {\n case \'textNode\':\n closeText(parser);\n break\n\n case \'cdata\':\n emitNode(parser, \'oncdata\', parser.cdata);\n parser.cdata = \'\';\n break\n\n case \'script\':\n emitNode(parser, \'onscript\', parser.script);\n parser.script = \'\';\n break\n\n default:\n error(parser, \'Max buffer length exceeded: \' + buffers[i]);\n }\n }\n maxActual = Math.max(maxActual, len);\n }\n // schedule the next check for the earliest possible buffer overrun.\n var m = sax.MAX_BUFFER_LENGTH - maxActual;\n parser.bufferCheckPosition = m + parser.position;\n }\n\n function clearBuffers (parser) {\n for (var i = 0, l = buffers.length; i < l; i++) {\n parser[buffers[i]] = \'\';\n }\n }\n\n function flushBuffers (parser) {\n closeText(parser);\n if (parser.cdata !== \'\') {\n emitNode(parser, \'oncdata\', parser.cdata);\n parser.cdata = \'\';\n }\n if (parser.script !== \'\') {\n emitNode(parser, \'onscript\', parser.script);\n parser.script = \'\';\n }\n }\n\n SAXParser.prototype = {\n end: function () { end(this); },\n write: write,\n resume: function () { this.error = null; return this },\n close: function () { return this.write(null) },\n flush: function () { flushBuffers(this); }\n };\n\n var Stream;\n try {\n Stream = __nested_webpack_require_451223__(/*! stream */ "./node_modules/stream-browserify/index.js").Stream;\n } catch (ex) {\n Stream = function () {};\n }\n\n var streamWraps = sax.EVENTS.filter(function (ev) {\n return ev !== \'error\' && ev !== \'end\'\n });\n\n function createStream (strict, opt) {\n return new SAXStream(strict, opt)\n }\n\n function SAXStream (strict, opt) {\n if (!(this instanceof SAXStream)) {\n return new SAXStream(strict, opt)\n }\n\n Stream.apply(this);\n\n this._parser = new SAXParser(strict, opt);\n this.writable = true;\n this.readable = true;\n\n var me = this;\n\n this._parser.onend = function () {\n me.emit(\'end\');\n };\n\n this._parser.onerror = function (er) {\n me.emit(\'error\', er);\n\n // if didn\'t throw, then means error was handled.\n // go ahead and clear error, so we can write again.\n me._parser.error = null;\n };\n\n this._decoder = null;\n\n streamWraps.forEach(function (ev) {\n Object.defineProperty(me, \'on\' + ev, {\n get: function () {\n return me._parser[\'on\' + ev]\n },\n set: function (h) {\n if (!h) {\n me.removeAllListeners(ev);\n me._parser[\'on\' + ev] = h;\n return h\n }\n me.on(ev, h);\n },\n enumerable: true,\n configurable: false\n });\n });\n }\n\n SAXStream.prototype = Object.create(Stream.prototype, {\n constructor: {\n value: SAXStream\n }\n });\n\n SAXStream.prototype.write = function (data) {\n if (typeof Buffer === \'function\' &&\n typeof Buffer.isBuffer === \'function\' &&\n Buffer.isBuffer(data)) {\n if (!this._decoder) {\n var SD = __nested_webpack_require_451223__(/*! string_decoder */ "./node_modules/string_decoder/lib/string_decoder.js").StringDecoder;\n this._decoder = new SD(\'utf8\');\n }\n data = this._decoder.write(data);\n }\n\n this._parser.write(data.toString());\n this.emit(\'data\', data);\n return true\n };\n\n SAXStream.prototype.end = function (chunk) {\n if (chunk && chunk.length) {\n this.write(chunk);\n }\n this._parser.end();\n return true\n };\n\n SAXStream.prototype.on = function (ev, handler) {\n var me = this;\n if (!me._parser[\'on\' + ev] && streamWraps.indexOf(ev) !== -1) {\n me._parser[\'on\' + ev] = function () {\n var args = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);\n args.splice(0, 0, ev);\n me.emit.apply(me, args);\n };\n }\n\n return Stream.prototype.on.call(me, ev, handler)\n };\n\n // character classes and tokens\n var whitespace = \'\\r\\n\\t \';\n\n // this really needs to be replaced with character classes.\n // XML allows all manner of ridiculous numbers and digits.\n var number = \'0124356789\';\n var letter = \'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\';\n\n // (Letter | "_" | ":")\n var quote = \'\\\'"\';\n var attribEnd = whitespace + \'>\';\n var CDATA = \'[CDATA[\';\n var DOCTYPE = \'DOCTYPE\';\n var XML_NAMESPACE = \'http://www.w3.org/XML/1998/namespace\';\n var XMLNS_NAMESPACE = \'http://www.w3.org/2000/xmlns/\';\n var rootNS = { xml: XML_NAMESPACE, xmlns: XMLNS_NAMESPACE };\n\n // turn all the string character sets into character class objects.\n whitespace = charClass(whitespace);\n number = charClass(number);\n letter = charClass(letter);\n\n // http://www.w3.org/TR/REC-xml/#NT-NameStartChar\n // This implementation works on strings, a single character at a time\n // as such, it cannot ever support astral-plane characters (10000-EFFFF)\n // without a significant breaking change to either this parser, or the\n // JavaScript language. Implementation of an emoji-capable xml parser\n // is left as an exercise for the reader.\n var nameStart = /[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/;\n\n var nameBody = /[:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040\\.\\d-]/;\n\n var entityStart = /[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/;\n var entityBody = /[#:_A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\u00B7\\u0300-\\u036F\\u203F-\\u2040\\.\\d-]/;\n\n quote = charClass(quote);\n attribEnd = charClass(attribEnd);\n\n function charClass (str) {\n return str.split(\'\').reduce(function (s, c) {\n s[c] = true;\n return s\n }, {})\n }\n\n function isRegExp (c) {\n return Object.prototype.toString.call(c) === \'[object RegExp]\'\n }\n\n function is (charclass, c) {\n return isRegExp(charclass) ? !!c.match(charclass) : charclass[c]\n }\n\n function not (charclass, c) {\n return !is(charclass, c)\n }\n\n var S = 0;\n sax.STATE = {\n BEGIN: S++, // leading byte order mark or whitespace\n BEGIN_WHITESPACE: S++, // leading whitespace\n TEXT: S++, // general stuff\n TEXT_ENTITY: S++, // & and such.\n OPEN_WAKA: S++, // <\n SGML_DECL: S++, // <!BLARG\n SGML_DECL_QUOTED: S++, // <!BLARG foo "bar\n DOCTYPE: S++, // <!DOCTYPE\n DOCTYPE_QUOTED: S++, // <!DOCTYPE "//blah\n DOCTYPE_DTD: S++, // <!DOCTYPE "//blah" [ ...\n DOCTYPE_DTD_QUOTED: S++, // <!DOCTYPE "//blah" [ "foo\n COMMENT_STARTING: S++, // <!-\n COMMENT: S++, // \x3c!--\n COMMENT_ENDING: S++, // \x3c!-- blah -\n COMMENT_ENDED: S++, // \x3c!-- blah --\n CDATA: S++, // <![CDATA[ something\n CDATA_ENDING: S++, // ]\n CDATA_ENDING_2: S++, // ]]\n PROC_INST: S++, // <?hi\n PROC_INST_BODY: S++, // <?hi there\n PROC_INST_ENDING: S++, // <?hi "there" ?\n OPEN_TAG: S++, // <strong\n OPEN_TAG_SLASH: S++, // <strong /\n ATTRIB: S++, // <a\n ATTRIB_NAME: S++, // <a foo\n ATTRIB_NAME_SAW_WHITE: S++, // <a foo _\n ATTRIB_VALUE: S++, // <a foo=\n ATTRIB_VALUE_QUOTED: S++, // <a foo="bar\n ATTRIB_VALUE_CLOSED: S++, // <a foo="bar"\n ATTRIB_VALUE_UNQUOTED: S++, // <a foo=bar\n ATTRIB_VALUE_ENTITY_Q: S++, // <foo bar="""\n ATTRIB_VALUE_ENTITY_U: S++, // <foo bar="\n CLOSE_TAG: S++, // </a\n CLOSE_TAG_SAW_WHITE: S++, // </a >\n SCRIPT: S++, // <script> ...\n SCRIPT_ENDING: S++ // <script> ... <\n };\n\n sax.XML_ENTITIES = {\n \'amp\': \'&\',\n \'gt\': \'>\',\n \'lt\': \'<\',\n \'quot\': \'"\',\n \'apos\': "\'"\n };\n\n sax.ENTITIES = {\n \'amp\': \'&\',\n \'gt\': \'>\',\n \'lt\': \'<\',\n \'quot\': \'"\',\n \'apos\': "\'",\n \'AElig\': 198,\n \'Aacute\': 193,\n \'Acirc\': 194,\n \'Agrave\': 192,\n \'Aring\': 197,\n \'Atilde\': 195,\n \'Auml\': 196,\n \'Ccedil\': 199,\n \'ETH\': 208,\n \'Eacute\': 201,\n \'Ecirc\': 202,\n \'Egrave\': 200,\n \'Euml\': 203,\n \'Iacute\': 205,\n \'Icirc\': 206,\n \'Igrave\': 204,\n \'Iuml\': 207,\n \'Ntilde\': 209,\n \'Oacute\': 211,\n \'Ocirc\': 212,\n \'Ograve\': 210,\n \'Oslash\': 216,\n \'Otilde\': 213,\n \'Ouml\': 214,\n \'THORN\': 222,\n \'Uacute\': 218,\n \'Ucirc\': 219,\n \'Ugrave\': 217,\n \'Uuml\': 220,\n \'Yacute\': 221,\n \'aacute\': 225,\n \'acirc\': 226,\n \'aelig\': 230,\n \'agrave\': 224,\n \'aring\': 229,\n \'atilde\': 227,\n \'auml\': 228,\n \'ccedil\': 231,\n \'eacute\': 233,\n \'ecirc\': 234,\n \'egrave\': 232,\n \'eth\': 240,\n \'euml\': 235,\n \'iacute\': 237,\n \'icirc\': 238,\n \'igrave\': 236,\n \'iuml\': 239,\n \'ntilde\': 241,\n \'oacute\': 243,\n \'ocirc\': 244,\n \'ograve\': 242,\n \'oslash\': 248,\n \'otilde\': 245,\n \'ouml\': 246,\n \'szlig\': 223,\n \'thorn\': 254,\n \'uacute\': 250,\n \'ucirc\': 251,\n \'ugrave\': 249,\n \'uuml\': 252,\n \'yacute\': 253,\n \'yuml\': 255,\n \'copy\': 169,\n \'reg\': 174,\n \'nbsp\': 160,\n \'iexcl\': 161,\n \'cent\': 162,\n \'pound\': 163,\n \'curren\': 164,\n \'yen\': 165,\n \'brvbar\': 166,\n \'sect\': 167,\n \'uml\': 168,\n \'ordf\': 170,\n \'laquo\': 171,\n \'not\': 172,\n \'shy\': 173,\n \'macr\': 175,\n \'deg\': 176,\n \'plusmn\': 177,\n \'sup1\': 185,\n \'sup2\': 178,\n \'sup3\': 179,\n \'acute\': 180,\n \'micro\': 181,\n \'para\': 182,\n \'middot\': 183,\n \'cedil\': 184,\n \'ordm\': 186,\n \'raquo\': 187,\n \'frac14\': 188,\n \'frac12\': 189,\n \'frac34\': 190,\n \'iquest\': 191,\n \'times\': 215,\n \'divide\': 247,\n \'OElig\': 338,\n \'oelig\': 339,\n \'Scaron\': 352,\n \'scaron\': 353,\n \'Yuml\': 376,\n \'fnof\': 402,\n \'circ\': 710,\n \'tilde\': 732,\n \'Alpha\': 913,\n \'Beta\': 914,\n \'Gamma\': 915,\n \'Delta\': 916,\n \'Epsilon\': 917,\n \'Zeta\': 918,\n \'Eta\': 919,\n \'Theta\': 920,\n \'Iota\': 921,\n \'Kappa\': 922,\n \'Lambda\': 923,\n \'Mu\': 924,\n \'Nu\': 925,\n \'Xi\': 926,\n \'Omicron\': 927,\n \'Pi\': 928,\n \'Rho\': 929,\n \'Sigma\': 931,\n \'Tau\': 932,\n \'Upsilon\': 933,\n \'Phi\': 934,\n \'Chi\': 935,\n \'Psi\': 936,\n \'Omega\': 937,\n \'alpha\': 945,\n \'beta\': 946,\n \'gamma\': 947,\n \'delta\': 948,\n \'epsilon\': 949,\n \'zeta\': 950,\n \'eta\': 951,\n \'theta\': 952,\n \'iota\': 953,\n \'kappa\': 954,\n \'lambda\': 955,\n \'mu\': 956,\n \'nu\': 957,\n \'xi\': 958,\n \'omicron\': 959,\n \'pi\': 960,\n \'rho\': 961,\n \'sigmaf\': 962,\n \'sigma\': 963,\n \'tau\': 964,\n \'upsilon\': 965,\n \'phi\': 966,\n \'chi\': 967,\n \'psi\': 968,\n \'omega\': 969,\n \'thetasym\': 977,\n \'upsih\': 978,\n \'piv\': 982,\n \'ensp\': 8194,\n \'emsp\': 8195,\n \'thinsp\': 8201,\n \'zwnj\': 8204,\n \'zwj\': 8205,\n \'lrm\': 8206,\n \'rlm\': 8207,\n \'ndash\': 8211,\n \'mdash\': 8212,\n \'lsquo\': 8216,\n \'rsquo\': 8217,\n \'sbquo\': 8218,\n \'ldquo\': 8220,\n \'rdquo\': 8221,\n \'bdquo\': 8222,\n \'dagger\': 8224,\n \'Dagger\': 8225,\n \'bull\': 8226,\n \'hellip\': 8230,\n \'permil\': 8240,\n \'prime\': 8242,\n \'Prime\': 8243,\n \'lsaquo\': 8249,\n \'rsaquo\': 8250,\n \'oline\': 8254,\n \'frasl\': 8260,\n \'euro\': 8364,\n \'image\': 8465,\n \'weierp\': 8472,\n \'real\': 8476,\n \'trade\': 8482,\n \'alefsym\': 8501,\n \'larr\': 8592,\n \'uarr\': 8593,\n \'rarr\': 8594,\n \'darr\': 8595,\n \'harr\': 8596,\n \'crarr\': 8629,\n \'lArr\': 8656,\n \'uArr\': 8657,\n \'rArr\': 8658,\n \'dArr\': 8659,\n \'hArr\': 8660,\n \'forall\': 8704,\n \'part\': 8706,\n \'exist\': 8707,\n \'empty\': 8709,\n \'nabla\': 8711,\n \'isin\': 8712,\n \'notin\': 8713,\n \'ni\': 8715,\n \'prod\': 8719,\n \'sum\': 8721,\n \'minus\': 8722,\n \'lowast\': 8727,\n \'radic\': 8730,\n \'prop\': 8733,\n \'infin\': 8734,\n \'ang\': 8736,\n \'and\': 8743,\n \'or\': 8744,\n \'cap\': 8745,\n \'cup\': 8746,\n \'int\': 8747,\n \'there4\': 8756,\n \'sim\': 8764,\n \'cong\': 8773,\n \'asymp\': 8776,\n \'ne\': 8800,\n \'equiv\': 8801,\n \'le\': 8804,\n \'ge\': 8805,\n \'sub\': 8834,\n \'sup\': 8835,\n \'nsub\': 8836,\n \'sube\': 8838,\n \'supe\': 8839,\n \'oplus\': 8853,\n \'otimes\': 8855,\n \'perp\': 8869,\n \'sdot\': 8901,\n \'lceil\': 8968,\n \'rceil\': 8969,\n \'lfloor\': 8970,\n \'rfloor\': 8971,\n \'lang\': 9001,\n \'rang\': 9002,\n \'loz\': 9674,\n \'spades\': 9824,\n \'clubs\': 9827,\n \'hearts\': 9829,\n \'diams\': 9830\n };\n\n Object.keys(sax.ENTITIES).forEach(function (key) {\n var e = sax.ENTITIES[key];\n var s = typeof e === \'number\' ? String.fromCharCode(e) : e;\n sax.ENTITIES[key] = s;\n });\n\n for (var s in sax.STATE) {\n sax.STATE[sax.STATE[s]] = s;\n }\n\n // shorthand\n S = sax.STATE;\n\n function emit (parser, event, data) {\n parser[event] && parser[event](data);\n }\n\n function emitNode (parser, nodeType, data) {\n if (parser.textNode) closeText(parser);\n emit(parser, nodeType, data);\n }\n\n function closeText (parser) {\n parser.textNode = textopts(parser.opt, parser.textNode);\n if (parser.textNode) emit(parser, \'ontext\', parser.textNode);\n parser.textNode = \'\';\n }\n\n function textopts (opt, text) {\n if (opt.trim) text = text.trim();\n if (opt.normalize) text = text.replace(/\\s+/g, \' \');\n return text\n }\n\n function error (parser, er) {\n closeText(parser);\n if (parser.trackPosition) {\n er += \'\\nLine: \' + parser.line +\n \'\\nColumn: \' + parser.column +\n \'\\nChar: \' + parser.c;\n }\n er = new Error(er);\n parser.error = er;\n emit(parser, \'onerror\', er);\n return parser\n }\n\n function end (parser) {\n if (parser.sawRoot && !parser.closedRoot) strictFail(parser, \'Unclosed root tag\');\n if ((parser.state !== S.BEGIN) &&\n (parser.state !== S.BEGIN_WHITESPACE) &&\n (parser.state !== S.TEXT)) {\n error(parser, \'Unexpected end\');\n }\n closeText(parser);\n parser.c = \'\';\n parser.closed = true;\n emit(parser, \'onend\');\n SAXParser.call(parser, parser.strict, parser.opt);\n return parser\n }\n\n function strictFail (parser, message) {\n if (typeof parser !== \'object\' || !(parser instanceof SAXParser)) {\n throw new Error(\'bad call to strictFail\')\n }\n if (parser.strict) {\n error(parser, message);\n }\n }\n\n function newTag (parser) {\n if (!parser.strict) parser.tagName = parser.tagName[parser.looseCase]();\n var parent = parser.tags[parser.tags.length - 1] || parser;\n var tag = parser.tag = { name: parser.tagName, attributes: {} };\n\n // will be overridden if tag contails an xmlns="foo" or xmlns:foo="bar"\n if (parser.opt.xmlns) {\n tag.ns = parent.ns;\n }\n parser.attribList.length = 0;\n emitNode(parser, \'onopentagstart\', tag);\n }\n\n function qname (name, attribute) {\n var i = name.indexOf(\':\');\n var qualName = i < 0 ? [ \'\', name ] : name.split(\':\');\n var prefix = qualName[0];\n var local = qualName[1];\n\n // <x "xmlns"="http://foo">\n if (attribute && name === \'xmlns\') {\n prefix = \'xmlns\';\n local = \'\';\n }\n\n return { prefix: prefix, local: local }\n }\n\n function attrib (parser) {\n if (!parser.strict) {\n parser.attribName = parser.attribName[parser.looseCase]();\n }\n\n if (parser.attribList.indexOf(parser.attribName) !== -1 ||\n parser.tag.attributes.hasOwnProperty(parser.attribName)) {\n parser.attribName = parser.attribValue = \'\';\n return\n }\n\n if (parser.opt.xmlns) {\n var qn = qname(parser.attribName, true);\n var prefix = qn.prefix;\n var local = qn.local;\n\n if (prefix === \'xmlns\') {\n // namespace binding attribute. push the binding into scope\n if (local === \'xml\' && parser.attribValue !== XML_NAMESPACE) {\n strictFail(parser,\n \'xml: prefix must be bound to \' + XML_NAMESPACE + \'\\n\' +\n \'Actual: \' + parser.attribValue);\n } else if (local === \'xmlns\' && parser.attribValue !== XMLNS_NAMESPACE) {\n strictFail(parser,\n \'xmlns: prefix must be bound to \' + XMLNS_NAMESPACE + \'\\n\' +\n \'Actual: \' + parser.attribValue);\n } else {\n var tag = parser.tag;\n var parent = parser.tags[parser.tags.length - 1] || parser;\n if (tag.ns === parent.ns) {\n tag.ns = Object.create(parent.ns);\n }\n tag.ns[local] = parser.attribValue;\n }\n }\n\n // defer onattribute events until all attributes have been seen\n // so any new bindings can take effect. preserve attribute order\n // so deferred events can be emitted in document order\n parser.attribList.push([parser.attribName, parser.attribValue]);\n } else {\n // in non-xmlns mode, we can emit the event right away\n parser.tag.attributes[parser.attribName] = parser.attribValue;\n emitNode(parser, \'onattribute\', {\n name: parser.attribName,\n value: parser.attribValue\n });\n }\n\n parser.attribName = parser.attribValue = \'\';\n }\n\n function openTag (parser, selfClosing) {\n if (parser.opt.xmlns) {\n // emit namespace binding events\n var tag = parser.tag;\n\n // add namespace info to tag\n var qn = qname(parser.tagName);\n tag.prefix = qn.prefix;\n tag.local = qn.local;\n tag.uri = tag.ns[qn.prefix] || \'\';\n\n if (tag.prefix && !tag.uri) {\n strictFail(parser, \'Unbound namespace prefix: \' +\n JSON.stringify(parser.tagName));\n tag.uri = qn.prefix;\n }\n\n var parent = parser.tags[parser.tags.length - 1] || parser;\n if (tag.ns && parent.ns !== tag.ns) {\n Object.keys(tag.ns).forEach(function (p) {\n emitNode(parser, \'onopennamespace\', {\n prefix: p,\n uri: tag.ns[p]\n });\n });\n }\n\n // handle deferred onattribute events\n // Note: do not apply default ns to attributes:\n // http://www.w3.org/TR/REC-xml-names/#defaulting\n for (var i = 0, l = parser.attribList.length; i < l; i++) {\n var nv = parser.attribList[i];\n var name = nv[0];\n var value = nv[1];\n var qualName = qname(name, true);\n var prefix = qualName.prefix;\n var local = qualName.local;\n var uri = prefix === \'\' ? \'\' : (tag.ns[prefix] || \'\');\n var a = {\n name: name,\n value: value,\n prefix: prefix,\n local: local,\n uri: uri\n };\n\n // if there\'s any attributes with an undefined namespace,\n // then fail on them now.\n if (prefix && prefix !== \'xmlns\' && !uri) {\n strictFail(parser, \'Unbound namespace prefix: \' +\n JSON.stringify(prefix));\n a.uri = prefix;\n }\n parser.tag.attributes[name] = a;\n emitNode(parser, \'onattribute\', a);\n }\n parser.attribList.length = 0;\n }\n\n parser.tag.isSelfClosing = !!selfClosing;\n\n // process the tag\n parser.sawRoot = true;\n parser.tags.push(parser.tag);\n emitNode(parser, \'onopentag\', parser.tag);\n if (!selfClosing) {\n // special case for <script> in non-strict mode.\n if (!parser.noscript && parser.tagName.toLowerCase() === \'script\') {\n parser.state = S.SCRIPT;\n } else {\n parser.state = S.TEXT;\n }\n parser.tag = null;\n parser.tagName = \'\';\n }\n parser.attribName = parser.attribValue = \'\';\n parser.attribList.length = 0;\n }\n\n function closeTag (parser) {\n if (!parser.tagName) {\n strictFail(parser, \'Weird empty close tag.\');\n parser.textNode += \'</>\';\n parser.state = S.TEXT;\n return\n }\n\n if (parser.script) {\n if (parser.tagName !== \'script\') {\n parser.script += \'</\' + parser.tagName + \'>\';\n parser.tagName = \'\';\n parser.state = S.SCRIPT;\n return\n }\n emitNode(parser, \'onscript\', parser.script);\n parser.script = \'\';\n }\n\n // first make sure that the closing tag actually exists.\n // <a><b></c></b></a> will close everything, otherwise.\n var t = parser.tags.length;\n var tagName = parser.tagName;\n if (!parser.strict) {\n tagName = tagName[parser.looseCase]();\n }\n var closeTo = tagName;\n while (t--) {\n var close = parser.tags[t];\n if (close.name !== closeTo) {\n // fail the first time in strict mode\n strictFail(parser, \'Unexpected close tag\');\n } else {\n break\n }\n }\n\n // didn\'t find it. we already failed for strict, so just abort.\n if (t < 0) {\n strictFail(parser, \'Unmatched closing tag: \' + parser.tagName);\n parser.textNode += \'</\' + parser.tagName + \'>\';\n parser.state = S.TEXT;\n return\n }\n parser.tagName = tagName;\n var s = parser.tags.length;\n while (s-- > t) {\n var tag = parser.tag = parser.tags.pop();\n parser.tagName = parser.tag.name;\n emitNode(parser, \'onclosetag\', parser.tagName);\n\n var x = {};\n for (var i in tag.ns) {\n x[i] = tag.ns[i];\n }\n\n var parent = parser.tags[parser.tags.length - 1] || parser;\n if (parser.opt.xmlns && tag.ns !== parent.ns) {\n // remove namespace bindings introduced by tag\n Object.keys(tag.ns).forEach(function (p) {\n var n = tag.ns[p];\n emitNode(parser, \'onclosenamespace\', { prefix: p, uri: n });\n });\n }\n }\n if (t === 0) parser.closedRoot = true;\n parser.tagName = parser.attribValue = parser.attribName = \'\';\n parser.attribList.length = 0;\n parser.state = S.TEXT;\n }\n\n function parseEntity (parser) {\n var entity = parser.entity;\n var entityLC = entity.toLowerCase();\n var num;\n var numStr = \'\';\n\n if (parser.ENTITIES[entity]) {\n return parser.ENTITIES[entity]\n }\n if (parser.ENTITIES[entityLC]) {\n return parser.ENTITIES[entityLC]\n }\n entity = entityLC;\n if (entity.charAt(0) === \'#\') {\n if (entity.charAt(1) === \'x\') {\n entity = entity.slice(2);\n num = parseInt(entity, 16);\n numStr = num.toString(16);\n } else {\n entity = entity.slice(1);\n num = parseInt(entity, 10);\n numStr = num.toString(10);\n }\n }\n entity = entity.replace(/^0+/, \'\');\n if (numStr.toLowerCase() !== entity) {\n strictFail(parser, \'Invalid character entity\');\n return \'&\' + parser.entity + \';\'\n }\n\n return String.fromCodePoint(num)\n }\n\n function beginWhiteSpace (parser, c) {\n if (c === \'<\') {\n parser.state = S.OPEN_WAKA;\n parser.startTagPosition = parser.position;\n } else if (not(whitespace, c)) {\n // have to process this as a text node.\n // weird, but happens.\n strictFail(parser, \'Non-whitespace before first tag.\');\n parser.textNode = c;\n parser.state = S.TEXT;\n }\n }\n\n function charAt (chunk, i) {\n var result = \'\';\n if (i < chunk.length) {\n result = chunk.charAt(i);\n }\n return result\n }\n\n function write (chunk) {\n var parser = this;\n if (this.error) {\n throw this.error\n }\n if (parser.closed) {\n return error(parser,\n \'Cannot write after close. Assign an onready handler.\')\n }\n if (chunk === null) {\n return end(parser)\n }\n if (typeof chunk === \'object\') {\n chunk = chunk.toString();\n }\n var i = 0;\n var c = \'\';\n while (true) {\n c = charAt(chunk, i++);\n parser.c = c;\n if (!c) {\n break\n }\n if (parser.trackPosition) {\n parser.position++;\n if (c === \'\\n\') {\n parser.line++;\n parser.column = 0;\n } else {\n parser.column++;\n }\n }\n switch (parser.state) {\n case S.BEGIN:\n parser.state = S.BEGIN_WHITESPACE;\n if (c === \'\\uFEFF\') {\n continue\n }\n beginWhiteSpace(parser, c);\n continue\n\n case S.BEGIN_WHITESPACE:\n beginWhiteSpace(parser, c);\n continue\n\n case S.TEXT:\n if (parser.sawRoot && !parser.closedRoot) {\n var starti = i - 1;\n while (c && c !== \'<\' && c !== \'&\') {\n c = charAt(chunk, i++);\n if (c && parser.trackPosition) {\n parser.position++;\n if (c === \'\\n\') {\n parser.line++;\n parser.column = 0;\n } else {\n parser.column++;\n }\n }\n }\n parser.textNode += chunk.substring(starti, i - 1);\n }\n if (c === \'<\' && !(parser.sawRoot && parser.closedRoot && !parser.strict)) {\n parser.state = S.OPEN_WAKA;\n parser.startTagPosition = parser.position;\n } else {\n if (not(whitespace, c) && (!parser.sawRoot || parser.closedRoot)) {\n strictFail(parser, \'Text data outside of root node.\');\n }\n if (c === \'&\') {\n parser.state = S.TEXT_ENTITY;\n } else {\n parser.textNode += c;\n }\n }\n continue\n\n case S.SCRIPT:\n // only non-strict\n if (c === \'<\') {\n parser.state = S.SCRIPT_ENDING;\n } else {\n parser.script += c;\n }\n continue\n\n case S.SCRIPT_ENDING:\n if (c === \'/\') {\n parser.state = S.CLOSE_TAG;\n } else {\n parser.script += \'<\' + c;\n parser.state = S.SCRIPT;\n }\n continue\n\n case S.OPEN_WAKA:\n // either a /, ?, !, or text is coming next.\n if (c === \'!\') {\n parser.state = S.SGML_DECL;\n parser.sgmlDecl = \'\';\n } else if (is(whitespace, c)) ; else if (is(nameStart, c)) {\n parser.state = S.OPEN_TAG;\n parser.tagName = c;\n } else if (c === \'/\') {\n parser.state = S.CLOSE_TAG;\n parser.tagName = \'\';\n } else if (c === \'?\') {\n parser.state = S.PROC_INST;\n parser.procInstName = parser.procInstBody = \'\';\n } else {\n strictFail(parser, \'Unencoded <\');\n // if there was some whitespace, then add that in.\n if (parser.startTagPosition + 1 < parser.position) {\n var pad = parser.position - parser.startTagPosition;\n c = new Array(pad).join(\' \') + c;\n }\n parser.textNode += \'<\' + c;\n parser.state = S.TEXT;\n }\n continue\n\n case S.SGML_DECL:\n if ((parser.sgmlDecl + c).toUpperCase() === CDATA) {\n emitNode(parser, \'onopencdata\');\n parser.state = S.CDATA;\n parser.sgmlDecl = \'\';\n parser.cdata = \'\';\n } else if (parser.sgmlDecl + c === \'--\') {\n parser.state = S.COMMENT;\n parser.comment = \'\';\n parser.sgmlDecl = \'\';\n } else if ((parser.sgmlDecl + c).toUpperCase() === DOCTYPE) {\n parser.state = S.DOCTYPE;\n if (parser.doctype || parser.sawRoot) {\n strictFail(parser,\n \'Inappropriately located doctype declaration\');\n }\n parser.doctype = \'\';\n parser.sgmlDecl = \'\';\n } else if (c === \'>\') {\n emitNode(parser, \'onsgmldeclaration\', parser.sgmlDecl);\n parser.sgmlDecl = \'\';\n parser.state = S.TEXT;\n } else if (is(quote, c)) {\n parser.state = S.SGML_DECL_QUOTED;\n parser.sgmlDecl += c;\n } else {\n parser.sgmlDecl += c;\n }\n continue\n\n case S.SGML_DECL_QUOTED:\n if (c === parser.q) {\n parser.state = S.SGML_DECL;\n parser.q = \'\';\n }\n parser.sgmlDecl += c;\n continue\n\n case S.DOCTYPE:\n if (c === \'>\') {\n parser.state = S.TEXT;\n emitNode(parser, \'ondoctype\', parser.doctype);\n parser.doctype = true; // just remember that we saw it.\n } else {\n parser.doctype += c;\n if (c === \'[\') {\n parser.state = S.DOCTYPE_DTD;\n } else if (is(quote, c)) {\n parser.state = S.DOCTYPE_QUOTED;\n parser.q = c;\n }\n }\n continue\n\n case S.DOCTYPE_QUOTED:\n parser.doctype += c;\n if (c === parser.q) {\n parser.q = \'\';\n parser.state = S.DOCTYPE;\n }\n continue\n\n case S.DOCTYPE_DTD:\n parser.doctype += c;\n if (c === \']\') {\n parser.state = S.DOCTYPE;\n } else if (is(quote, c)) {\n parser.state = S.DOCTYPE_DTD_QUOTED;\n parser.q = c;\n }\n continue\n\n case S.DOCTYPE_DTD_QUOTED:\n parser.doctype += c;\n if (c === parser.q) {\n parser.state = S.DOCTYPE_DTD;\n parser.q = \'\';\n }\n continue\n\n case S.COMMENT:\n if (c === \'-\') {\n parser.state = S.COMMENT_ENDING;\n } else {\n parser.comment += c;\n }\n continue\n\n case S.COMMENT_ENDING:\n if (c === \'-\') {\n parser.state = S.COMMENT_ENDED;\n parser.comment = textopts(parser.opt, parser.comment);\n if (parser.comment) {\n emitNode(parser, \'oncomment\', parser.comment);\n }\n parser.comment = \'\';\n } else {\n parser.comment += \'-\' + c;\n parser.state = S.COMMENT;\n }\n continue\n\n case S.COMMENT_ENDED:\n if (c !== \'>\') {\n strictFail(parser, \'Malformed comment\');\n // allow \x3c!-- blah -- bloo --\x3e in non-strict mode,\n // which is a comment of " blah -- bloo "\n parser.comment += \'--\' + c;\n parser.state = S.COMMENT;\n } else {\n parser.state = S.TEXT;\n }\n continue\n\n case S.CDATA:\n if (c === \']\') {\n parser.state = S.CDATA_ENDING;\n } else {\n parser.cdata += c;\n }\n continue\n\n case S.CDATA_ENDING:\n if (c === \']\') {\n parser.state = S.CDATA_ENDING_2;\n } else {\n parser.cdata += \']\' + c;\n parser.state = S.CDATA;\n }\n continue\n\n case S.CDATA_ENDING_2:\n if (c === \'>\') {\n if (parser.cdata) {\n emitNode(parser, \'oncdata\', parser.cdata);\n }\n emitNode(parser, \'onclosecdata\');\n parser.cdata = \'\';\n parser.state = S.TEXT;\n } else if (c === \']\') {\n parser.cdata += \']\';\n } else {\n parser.cdata += \']]\' + c;\n parser.state = S.CDATA;\n }\n continue\n\n case S.PROC_INST:\n if (c === \'?\') {\n parser.state = S.PROC_INST_ENDING;\n } else if (is(whitespace, c)) {\n parser.state = S.PROC_INST_BODY;\n } else {\n parser.procInstName += c;\n }\n continue\n\n case S.PROC_INST_BODY:\n if (!parser.procInstBody && is(whitespace, c)) {\n continue\n } else if (c === \'?\') {\n parser.state = S.PROC_INST_ENDING;\n } else {\n parser.procInstBody += c;\n }\n continue\n\n case S.PROC_INST_ENDING:\n if (c === \'>\') {\n emitNode(parser, \'onprocessinginstruction\', {\n name: parser.procInstName,\n body: parser.procInstBody\n });\n parser.procInstName = parser.procInstBody = \'\';\n parser.state = S.TEXT;\n } else {\n parser.procInstBody += \'?\' + c;\n parser.state = S.PROC_INST_BODY;\n }\n continue\n\n case S.OPEN_TAG:\n if (is(nameBody, c)) {\n parser.tagName += c;\n } else {\n newTag(parser);\n if (c === \'>\') {\n openTag(parser);\n } else if (c === \'/\') {\n parser.state = S.OPEN_TAG_SLASH;\n } else {\n if (not(whitespace, c)) {\n strictFail(parser, \'Invalid character in tag name\');\n }\n parser.state = S.ATTRIB;\n }\n }\n continue\n\n case S.OPEN_TAG_SLASH:\n if (c === \'>\') {\n openTag(parser, true);\n closeTag(parser);\n } else {\n strictFail(parser, \'Forward-slash in opening tag not followed by >\');\n parser.state = S.ATTRIB;\n }\n continue\n\n case S.ATTRIB:\n // haven\'t read the attribute name yet.\n if (is(whitespace, c)) {\n continue\n } else if (c === \'>\') {\n openTag(parser);\n } else if (c === \'/\') {\n parser.state = S.OPEN_TAG_SLASH;\n } else if (is(nameStart, c)) {\n parser.attribName = c;\n parser.attribValue = \'\';\n parser.state = S.ATTRIB_NAME;\n } else {\n strictFail(parser, \'Invalid attribute name\');\n }\n continue\n\n case S.ATTRIB_NAME:\n if (c === \'=\') {\n parser.state = S.ATTRIB_VALUE;\n } else if (c === \'>\') {\n strictFail(parser, \'Attribute without value\');\n parser.attribValue = parser.attribName;\n attrib(parser);\n openTag(parser);\n } else if (is(whitespace, c)) {\n parser.state = S.ATTRIB_NAME_SAW_WHITE;\n } else if (is(nameBody, c)) {\n parser.attribName += c;\n } else {\n strictFail(parser, \'Invalid attribute name\');\n }\n continue\n\n case S.ATTRIB_NAME_SAW_WHITE:\n if (c === \'=\') {\n parser.state = S.ATTRIB_VALUE;\n } else if (is(whitespace, c)) {\n continue\n } else {\n strictFail(parser, \'Attribute without value\');\n parser.tag.attributes[parser.attribName] = \'\';\n parser.attribValue = \'\';\n emitNode(parser, \'onattribute\', {\n name: parser.attribName,\n value: \'\'\n });\n parser.attribName = \'\';\n if (c === \'>\') {\n openTag(parser);\n } else if (is(nameStart, c)) {\n parser.attribName = c;\n parser.state = S.ATTRIB_NAME;\n } else {\n strictFail(parser, \'Invalid attribute name\');\n parser.state = S.ATTRIB;\n }\n }\n continue\n\n case S.ATTRIB_VALUE:\n if (is(whitespace, c)) {\n continue\n } else if (is(quote, c)) {\n parser.q = c;\n parser.state = S.ATTRIB_VALUE_QUOTED;\n } else {\n strictFail(parser, \'Unquoted attribute value\');\n parser.state = S.ATTRIB_VALUE_UNQUOTED;\n parser.attribValue = c;\n }\n continue\n\n case S.ATTRIB_VALUE_QUOTED:\n if (c !== parser.q) {\n if (c === \'&\') {\n parser.state = S.ATTRIB_VALUE_ENTITY_Q;\n } else {\n parser.attribValue += c;\n }\n continue\n }\n attrib(parser);\n parser.q = \'\';\n parser.state = S.ATTRIB_VALUE_CLOSED;\n continue\n\n case S.ATTRIB_VALUE_CLOSED:\n if (is(whitespace, c)) {\n parser.state = S.ATTRIB;\n } else if (c === \'>\') {\n openTag(parser);\n } else if (c === \'/\') {\n parser.state = S.OPEN_TAG_SLASH;\n } else if (is(nameStart, c)) {\n strictFail(parser, \'No whitespace between attributes\');\n parser.attribName = c;\n parser.attribValue = \'\';\n parser.state = S.ATTRIB_NAME;\n } else {\n strictFail(parser, \'Invalid attribute name\');\n }\n continue\n\n case S.ATTRIB_VALUE_UNQUOTED:\n if (not(attribEnd, c)) {\n if (c === \'&\') {\n parser.state = S.ATTRIB_VALUE_ENTITY_U;\n } else {\n parser.attribValue += c;\n }\n continue\n }\n attrib(parser);\n if (c === \'>\') {\n openTag(parser);\n } else {\n parser.state = S.ATTRIB;\n }\n continue\n\n case S.CLOSE_TAG:\n if (!parser.tagName) {\n if (is(whitespace, c)) {\n continue\n } else if (not(nameStart, c)) {\n if (parser.script) {\n parser.script += \'</\' + c;\n parser.state = S.SCRIPT;\n } else {\n strictFail(parser, \'Invalid tagname in closing tag.\');\n }\n } else {\n parser.tagName = c;\n }\n } else if (c === \'>\') {\n closeTag(parser);\n } else if (is(nameBody, c)) {\n parser.tagName += c;\n } else if (parser.script) {\n parser.script += \'</\' + parser.tagName;\n parser.tagName = \'\';\n parser.state = S.SCRIPT;\n } else {\n if (not(whitespace, c)) {\n strictFail(parser, \'Invalid tagname in closing tag\');\n }\n parser.state = S.CLOSE_TAG_SAW_WHITE;\n }\n continue\n\n case S.CLOSE_TAG_SAW_WHITE:\n if (is(whitespace, c)) {\n continue\n }\n if (c === \'>\') {\n closeTag(parser);\n } else {\n strictFail(parser, \'Invalid characters in closing tag\');\n }\n continue\n\n case S.TEXT_ENTITY:\n case S.ATTRIB_VALUE_ENTITY_Q:\n case S.ATTRIB_VALUE_ENTITY_U:\n var returnState;\n var buffer;\n switch (parser.state) {\n case S.TEXT_ENTITY:\n returnState = S.TEXT;\n buffer = \'textNode\';\n break\n\n case S.ATTRIB_VALUE_ENTITY_Q:\n returnState = S.ATTRIB_VALUE_QUOTED;\n buffer = \'attribValue\';\n break\n\n case S.ATTRIB_VALUE_ENTITY_U:\n returnState = S.ATTRIB_VALUE_UNQUOTED;\n buffer = \'attribValue\';\n break\n }\n\n if (c === \';\') {\n parser[buffer] += parseEntity(parser);\n parser.entity = \'\';\n parser.state = returnState;\n } else if (is(parser.entity.length ? entityBody : entityStart, c)) {\n parser.entity += c;\n } else {\n strictFail(parser, \'Invalid character in entity name\');\n parser[buffer] += \'&\' + parser.entity + c;\n parser.entity = \'\';\n parser.state = returnState;\n }\n\n continue\n\n default:\n throw new Error(parser, \'Unknown state: \' + parser.state)\n }\n } // while\n\n if (parser.position >= parser.bufferCheckPosition) {\n checkBufferLength(parser);\n }\n return parser\n }\n\n /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */\n if (!String.fromCodePoint) {\n (function () {\n var stringFromCharCode = String.fromCharCode;\n var floor = Math.floor;\n var fromCodePoint = function () {\n var MAX_SIZE = 0x4000;\n var codeUnits = [];\n var highSurrogate;\n var lowSurrogate;\n var index = -1;\n var length = arguments.length;\n if (!length) {\n return \'\'\n }\n var result = \'\';\n while (++index < length) {\n var codePoint = Number(arguments[index]);\n if (\n !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`\n codePoint < 0 || // not a valid Unicode code point\n codePoint > 0x10FFFF || // not a valid Unicode code point\n floor(codePoint) !== codePoint // not an integer\n ) {\n throw RangeError(\'Invalid code point: \' + codePoint)\n }\n if (codePoint <= 0xFFFF) { // BMP code point\n codeUnits.push(codePoint);\n } else { // Astral code point; split in surrogate halves\n // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n codePoint -= 0x10000;\n highSurrogate = (codePoint >> 10) + 0xD800;\n lowSurrogate = (codePoint % 0x400) + 0xDC00;\n codeUnits.push(highSurrogate, lowSurrogate);\n }\n if (index + 1 === length || codeUnits.length > MAX_SIZE) {\n result += stringFromCharCode.apply(null, codeUnits);\n codeUnits.length = 0;\n }\n }\n return result\n };\n if (Object.defineProperty) {\n Object.defineProperty(String, \'fromCodePoint\', {\n value: fromCodePoint,\n configurable: true,\n writable: true\n });\n } else {\n String.fromCodePoint = fromCodePoint;\n }\n }());\n }\n})( exports);\n\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_451223__(/*! ./../../node-libs-browser/node_modules/buffer/index.js */ "./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer));\n\n/***/ }),\n\n/***/ "./node_modules/setimmediate/setImmediate.js":\n/*!***************************************************!*\\\n !*** ./node_modules/setimmediate/setImmediate.js ***!\n \\***************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_496268__) {\n\n/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== "function") {\n callback = new Function("" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: "Wait until any invocations of this algorithm started before this one have completed."\n // So if we\'re currently running a task, we\'ll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // "too much recursion" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can\'t be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage("", "*");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = "setImmediate$" + Math.random() + "$";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === "string" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener("message", onGlobalMessage, false);\n } else {\n global.attachEvent("onmessage", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, "*");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it\'s been called.\n var script = doc.createElement("script");\n script.onreadystatechange = function () {\n runIfPresent(handle);\n script.onreadystatechange = null;\n html.removeChild(script);\n script = null;\n };\n html.appendChild(script);\n };\n }\n\n function installSetTimeoutImplementation() {\n registerImmediate = function(handle) {\n setTimeout(runIfPresent, 0, handle);\n };\n }\n\n // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.\n var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);\n attachTo = attachTo && attachTo.setTimeout ? attachTo : global;\n\n // Don\'t get fooled by e.g. browserify environments.\n if ({}.toString.call(global.process) === "[object process]") {\n // For Node.js before 0.9\n installNextTickImplementation();\n\n } else if (canUsePostMessage()) {\n // For non-IE10 modern browsers\n installPostMessageImplementation();\n\n } else if (global.MessageChannel) {\n // For web workers, where supported\n installMessageChannelImplementation();\n\n } else if (doc && "onreadystatechange" in doc.createElement("script")) {\n // For IE 6–8\n installReadyStateChangeImplementation();\n\n } else {\n // For older browsers\n installSetTimeoutImplementation();\n }\n\n attachTo.setImmediate = setImmediate;\n attachTo.clearImmediate = clearImmediate;\n}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));\n\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_496268__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __nested_webpack_require_496268__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")));\n\n/***/ }),\n\n/***/ "./node_modules/stream-browserify/index.js":\n/*!*************************************************!*\\\n !*** ./node_modules/stream-browserify/index.js ***!\n \\*************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_503328__) {\n\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// "Software"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nmodule.exports = Stream;\n\nvar EE = __nested_webpack_require_503328__(/*! events */ "./node_modules/node-libs-browser/node_modules/events/events.js").EventEmitter;\nvar inherits = __nested_webpack_require_503328__(/*! inherits */ "./node_modules/inherits/inherits_browser.js");\n\ninherits(Stream, EE);\nStream.Readable = __nested_webpack_require_503328__(/*! readable-stream/readable.js */ "./node_modules/readable-stream/readable-browser.js");\nStream.Writable = __nested_webpack_require_503328__(/*! readable-stream/writable.js */ "./node_modules/readable-stream/writable-browser.js");\nStream.Duplex = __nested_webpack_require_503328__(/*! readable-stream/duplex.js */ "./node_modules/readable-stream/duplex-browser.js");\nStream.Transform = __nested_webpack_require_503328__(/*! readable-stream/transform.js */ "./node_modules/readable-stream/transform.js");\nStream.PassThrough = __nested_webpack_require_503328__(/*! readable-stream/passthrough.js */ "./node_modules/readable-stream/passthrough.js");\n\n// Backwards-compat with node 0.4.x\nStream.Stream = Stream;\n\n\n\n// old-style streams. Note that the pipe method (the only relevant\n// part of this class) is overridden in the Readable class.\n\nfunction Stream() {\n EE.call(this);\n}\n\nStream.prototype.pipe = function(dest, options) {\n var source = this;\n\n function ondata(chunk) {\n if (dest.writable) {\n if (false === dest.write(chunk) && source.pause) {\n source.pause();\n }\n }\n }\n\n source.on(\'data\', ondata);\n\n function ondrain() {\n if (source.readable && source.resume) {\n source.resume();\n }\n }\n\n dest.on(\'drain\', ondrain);\n\n // If the \'end\' option is not supplied, dest.end() will be called when\n // source gets the \'end\' or \'close\' events. Only dest.end() once.\n if (!dest._isStdio && (!options || options.end !== false)) {\n source.on(\'end\', onend);\n source.on(\'close\', onclose);\n }\n\n var didOnEnd = false;\n function onend() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n dest.end();\n }\n\n\n function onclose() {\n if (didOnEnd) return;\n didOnEnd = true;\n\n if (typeof dest.destroy === \'function\') dest.destroy();\n }\n\n // don\'t leave dangling pipes when there are errors.\n function onerror(er) {\n cleanup();\n if (EE.listenerCount(this, \'error\') === 0) {\n throw er; // Unhandled stream error in pipe.\n }\n }\n\n source.on(\'error\', onerror);\n dest.on(\'error\', onerror);\n\n // remove all the event listeners that were added.\n function cleanup() {\n source.removeListener(\'data\', ondata);\n dest.removeListener(\'drain\', ondrain);\n\n source.removeListener(\'end\', onend);\n source.removeListener(\'close\', onclose);\n\n source.removeListener(\'error\', onerror);\n dest.removeListener(\'error\', onerror);\n\n source.removeListener(\'end\', cleanup);\n source.removeListener(\'close\', cleanup);\n\n dest.removeListener(\'close\', cleanup);\n }\n\n source.on(\'end\', cleanup);\n source.on(\'close\', cleanup);\n\n dest.on(\'close\', cleanup);\n\n dest.emit(\'pipe\', source);\n\n // Allow for unix-like usage: A.pipe(B).pipe(C)\n return dest;\n};\n\n\n/***/ }),\n\n/***/ "./node_modules/string_decoder/lib/string_decoder.js":\n/*!***********************************************************!*\\\n !*** ./node_modules/string_decoder/lib/string_decoder.js ***!\n \\***********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_507792__) {\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// "Software"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n\n/*<replacement>*/\n\nvar Buffer = __nested_webpack_require_507792__(/*! safe-buffer */ "./node_modules/safe-buffer/index.js").Buffer;\n/*</replacement>*/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = \'\' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case \'hex\':case \'utf8\':case \'utf-8\':case \'ascii\':case \'binary\':case \'base64\':case \'ucs2\':case \'ucs-2\':case \'utf16le\':case \'utf-16le\':case \'raw\':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return \'utf8\';\n var retried;\n while (true) {\n switch (enc) {\n case \'utf8\':\n case \'utf-8\':\n return \'utf8\';\n case \'ucs2\':\n case \'ucs-2\':\n case \'utf16le\':\n case \'utf-16le\':\n return \'utf16le\';\n case \'latin1\':\n case \'binary\':\n return \'latin1\';\n case \'base64\':\n case \'ascii\':\n case \'hex\':\n return enc;\n default:\n if (retried) return; // undefined\n enc = (\'\' + enc).toLowerCase();\n retried = true;\n }\n }\n}\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== \'string\' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error(\'Unknown encoding: \' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case \'utf16le\':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case \'utf8\':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case \'base64\':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return \'\';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return \'\';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || \'\';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it\'s ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we "replace" the validated continuation bytes we\'ve seen so far with\n// a single UTF-8 replacement character (\'\\ufffd\'), to match v8\'s UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return \'\\ufffd\';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return \'\\ufffd\';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return \'\\ufffd\';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character\'s bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString(\'utf8\', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString(\'utf8\', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : \'\';\n if (this.lastNeed) return r + \'\\ufffd\';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString(\'utf16le\', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString(\'utf16le\', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : \'\';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString(\'utf16le\', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString(\'base64\', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString(\'base64\', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : \'\';\n if (this.lastNeed) return r + this.lastChar.toString(\'base64\', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : \'\';\n}\n\n/***/ }),\n\n/***/ "./node_modules/util-deprecate/browser.js":\n/*!************************************************!*\\\n !*** ./node_modules/util-deprecate/browser.js ***!\n \\************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __nested_webpack_require_517608__) {\n\n/* WEBPACK VAR INJECTION */(function(global) {\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new "deprecated" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config(\'noDeprecation\')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config(\'throwDeprecation\')) {\n throw new Error(msg);\n } else if (config(\'traceDeprecation\')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === \'true\';\n}\n\n/* WEBPACK VAR INJECTION */}.call(this, __nested_webpack_require_517608__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")));\n\n/***/ }),\n\n/***/ "./node_modules/webpack/buildin/global.js":\n/*!***********************************!*\\\n !*** (webpack)/buildin/global.js ***!\n \\***********************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nvar g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function("return this")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === "object") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it\'s\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n/***/ }),\n\n/***/ "./src/core/Debug.js":\n/*!***************************!*\\\n !*** ./src/core/Debug.js ***!\n \\***************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_520379__) {\n__nested_webpack_require_520379__.r(__nested_webpack_exports__);\n/* harmony import */ var _EventBus__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_520379__(/*! ./EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _events_Events__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_520379__(/*! ./events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_520379__(/*! ./FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\nvar LOG_LEVEL_NONE = 0;\nvar LOG_LEVEL_FATAL = 1;\nvar LOG_LEVEL_ERROR = 2;\nvar LOG_LEVEL_WARNING = 3;\nvar LOG_LEVEL_INFO = 4;\nvar LOG_LEVEL_DEBUG = 5;\n/**\n * @module Debug\n * @param {object} config\n * @ignore\n */\n\nfunction Debug(config) {\n config = config || {};\n var context = this.context;\n var eventBus = Object(_EventBus__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n var settings = config.settings;\n var logFn = [];\n var instance, showLogTimestamp, showCalleeName, startTime;\n\n function setup() {\n showLogTimestamp = true;\n showCalleeName = true;\n startTime = new Date().getTime();\n\n if (typeof window !== \'undefined\' && window.console) {\n logFn[LOG_LEVEL_FATAL] = getLogFn(window.console.error);\n logFn[LOG_LEVEL_ERROR] = getLogFn(window.console.error);\n logFn[LOG_LEVEL_WARNING] = getLogFn(window.console.warn);\n logFn[LOG_LEVEL_INFO] = getLogFn(window.console.info);\n logFn[LOG_LEVEL_DEBUG] = getLogFn(window.console.debug);\n }\n }\n\n function getLogFn(fn) {\n if (fn && fn.bind) {\n return fn.bind(window.console);\n } // if not define, return the default function for reporting logs\n\n\n return window.console.log.bind(window.console);\n }\n /**\n * Retrieves a logger which can be used to write logging information in browser console.\n * @param {object} instance Object for which the logger is created. It is used\n * to include calle object information in log messages.\n * @memberof module:Debug\n * @returns {Logger}\n * @instance\n */\n\n\n function getLogger(instance) {\n return {\n fatal: fatal.bind(instance),\n error: error.bind(instance),\n warn: warn.bind(instance),\n info: info.bind(instance),\n debug: debug.bind(instance)\n };\n }\n /**\n * Prepends a timestamp in milliseconds to each log message.\n * @param {boolean} value Set to true if you want to see a timestamp in each log message.\n * @default LOG_LEVEL_WARNING\n * @memberof module:Debug\n * @instance\n */\n\n\n function setLogTimestampVisible(value) {\n showLogTimestamp = value;\n }\n /**\n * Prepends the callee object name, and media type if available, to each log message.\n * @param {boolean} value Set to true if you want to see the callee object name and media type in each log message.\n * @default true\n * @memberof module:Debug\n * @instance\n */\n\n\n function setCalleeNameVisible(value) {\n showCalleeName = value;\n }\n\n function fatal() {\n for (var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++) {\n params[_key] = arguments[_key];\n }\n\n doLog.apply(void 0, [LOG_LEVEL_FATAL, this].concat(params));\n }\n\n function error() {\n for (var _len2 = arguments.length, params = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n params[_key2] = arguments[_key2];\n }\n\n doLog.apply(void 0, [LOG_LEVEL_ERROR, this].concat(params));\n }\n\n function warn() {\n for (var _len3 = arguments.length, params = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n params[_key3] = arguments[_key3];\n }\n\n doLog.apply(void 0, [LOG_LEVEL_WARNING, this].concat(params));\n }\n\n function info() {\n for (var _len4 = arguments.length, params = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n params[_key4] = arguments[_key4];\n }\n\n doLog.apply(void 0, [LOG_LEVEL_INFO, this].concat(params));\n }\n\n function debug() {\n for (var _len5 = arguments.length, params = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n params[_key5] = arguments[_key5];\n }\n\n doLog.apply(void 0, [LOG_LEVEL_DEBUG, this].concat(params));\n }\n\n function doLog(level, _this) {\n var message = \'\';\n var logTime = null;\n\n if (showLogTimestamp) {\n logTime = new Date().getTime();\n message += \'[\' + (logTime - startTime) + \']\';\n }\n\n if (showCalleeName && _this && _this.getClassName) {\n message += \'[\' + _this.getClassName() + \']\';\n\n if (_this.getType) {\n message += \'[\' + _this.getType() + \']\';\n }\n }\n\n if (message.length > 0) {\n message += \' \';\n }\n\n for (var _len6 = arguments.length, params = new Array(_len6 > 2 ? _len6 - 2 : 0), _key6 = 2; _key6 < _len6; _key6++) {\n params[_key6 - 2] = arguments[_key6];\n }\n\n Array.apply(null, params).forEach(function (item) {\n message += item + \' \';\n }); // log to console if the log level is high enough\n\n if (logFn[level] && settings.get().debug.logLevel >= level) {\n logFn[level](message);\n } // send log event regardless of log level\n\n\n if (settings && settings.get().debug.dispatchEvent) {\n eventBus.trigger(_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].LOG, {\n message: message,\n level: level\n });\n }\n }\n\n instance = {\n getLogger: getLogger,\n setLogTimestampVisible: setLogTimestampVisible,\n setCalleeNameVisible: setCalleeNameVisible\n };\n setup();\n return instance;\n}\n\nDebug.__dashjs_factory_name = \'Debug\';\nvar factory = _FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getSingletonFactory(Debug);\nfactory.LOG_LEVEL_NONE = LOG_LEVEL_NONE;\nfactory.LOG_LEVEL_FATAL = LOG_LEVEL_FATAL;\nfactory.LOG_LEVEL_ERROR = LOG_LEVEL_ERROR;\nfactory.LOG_LEVEL_WARNING = LOG_LEVEL_WARNING;\nfactory.LOG_LEVEL_INFO = LOG_LEVEL_INFO;\nfactory.LOG_LEVEL_DEBUG = LOG_LEVEL_DEBUG;\n_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].updateSingletonFactory(Debug.__dashjs_factory_name, factory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/core/EventBus.js":\n/*!******************************!*\\\n !*** ./src/core/EventBus.js ***!\n \\******************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_528463__) {\n__nested_webpack_require_528463__.r(__nested_webpack_exports__);\n/* harmony import */ var _FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_528463__(/*! ./FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_528463__(/*! ../streaming/MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nvar EVENT_PRIORITY_LOW = 0;\nvar EVENT_PRIORITY_HIGH = 5000;\n\nfunction EventBus() {\n var handlers = {};\n\n function on(type, listener, scope) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n\n if (!type) {\n throw new Error(\'event type cannot be null or undefined\');\n }\n\n if (!listener || typeof listener !== \'function\') {\n throw new Error(\'listener must be a function: \' + listener);\n }\n\n var priority = options.priority || EVENT_PRIORITY_LOW;\n if (getHandlerIdx(type, listener, scope) >= 0) return;\n handlers[type] = handlers[type] || [];\n var handler = {\n callback: listener,\n scope: scope,\n priority: priority\n };\n\n if (scope && scope.getStreamId) {\n handler.streamId = scope.getStreamId();\n }\n\n if (scope && scope.getType) {\n handler.mediaType = scope.getType();\n }\n\n if (options && options.mode) {\n handler.mode = options.mode;\n }\n\n var inserted = handlers[type].some(function (item, idx) {\n if (item && priority > item.priority) {\n handlers[type].splice(idx, 0, handler);\n return true;\n }\n });\n\n if (!inserted) {\n handlers[type].push(handler);\n }\n }\n\n function off(type, listener, scope) {\n if (!type || !listener || !handlers[type]) return;\n var idx = getHandlerIdx(type, listener, scope);\n if (idx < 0) return;\n handlers[type][idx] = null;\n }\n\n function trigger(type) {\n var payload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var filters = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n if (!type || !handlers[type]) return;\n payload = payload || {};\n if (payload.hasOwnProperty(\'type\')) throw new Error(\'\\\'type\\\' is a reserved word for event dispatching\');\n payload.type = type;\n\n if (filters.streamId) {\n payload.streamId = filters.streamId;\n }\n\n if (filters.mediaType) {\n payload.mediaType = filters.mediaType;\n }\n\n handlers[type].filter(function (handler) {\n if (!handler) {\n return false;\n }\n\n if (filters.streamId && handler.streamId && handler.streamId !== filters.streamId) {\n return false;\n }\n\n if (filters.mediaType && handler.mediaType && handler.mediaType !== filters.mediaType) {\n return false;\n } // This is used for dispatching DASH events. By default we use the onStart mode. Consequently we filter everything that has a non matching mode and the onReceive events for handlers that did not specify a mode.\n\n\n if (filters.mode && handler.mode && handler.mode !== filters.mode || !handler.mode && filters.mode && filters.mode === _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__["default"].EVENT_MODE_ON_RECEIVE) {\n return false;\n }\n\n return true;\n }).forEach(function (handler) {\n return handler && handler.callback.call(handler.scope, payload);\n });\n }\n\n function getHandlerIdx(type, listener, scope) {\n var idx = -1;\n if (!handlers[type]) return idx;\n handlers[type].some(function (item, index) {\n if (item && item.callback === listener && (!scope || scope === item.scope)) {\n idx = index;\n return true;\n }\n });\n return idx;\n }\n\n function reset() {\n handlers = {};\n }\n\n var instance = {\n on: on,\n off: off,\n trigger: trigger,\n reset: reset\n };\n return instance;\n}\n\nEventBus.__dashjs_factory_name = \'EventBus\';\nvar factory = _FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(EventBus);\nfactory.EVENT_PRIORITY_LOW = EVENT_PRIORITY_LOW;\nfactory.EVENT_PRIORITY_HIGH = EVENT_PRIORITY_HIGH;\n_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].updateSingletonFactory(EventBus.__dashjs_factory_name, factory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/core/FactoryMaker.js":\n/*!**********************************!*\\\n !*** ./src/core/FactoryMaker.js ***!\n \\**********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_534805__) {\n__nested_webpack_require_534805__.r(__nested_webpack_exports__);\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @module FactoryMaker\n * @ignore\n */\nvar FactoryMaker = function () {\n var instance;\n var singletonContexts = [];\n var singletonFactories = {};\n var classFactories = {};\n\n function extend(name, childInstance, override, context) {\n if (!context[name] && childInstance) {\n context[name] = {\n instance: childInstance,\n override: override\n };\n }\n }\n /**\n * Use this method from your extended object. this.factory is injected into your object.\n * this.factory.getSingletonInstance(this.context, \'VideoModel\')\n * will return the video model for use in the extended object.\n *\n * @param {Object} context - injected into extended object as this.context\n * @param {string} className - string name found in all dash.js objects\n * with name __dashjs_factory_name Will be at the bottom. Will be the same as the object\'s name.\n * @returns {*} Context aware instance of specified singleton name.\n * @memberof module:FactoryMaker\n * @instance\n */\n\n\n function getSingletonInstance(context, className) {\n for (var i in singletonContexts) {\n var obj = singletonContexts[i];\n\n if (obj.context === context && obj.name === className) {\n return obj.instance;\n }\n }\n\n return null;\n }\n /**\n * Use this method to add an singleton instance to the system. Useful for unit testing to mock objects etc.\n *\n * @param {Object} context\n * @param {string} className\n * @param {Object} instance\n * @memberof module:FactoryMaker\n * @instance\n */\n\n\n function setSingletonInstance(context, className, instance) {\n for (var i in singletonContexts) {\n var obj = singletonContexts[i];\n\n if (obj.context === context && obj.name === className) {\n singletonContexts[i].instance = instance;\n return;\n }\n }\n\n singletonContexts.push({\n name: className,\n context: context,\n instance: instance\n });\n }\n /**\n * Use this method to remove all singleton instances associated with a particular context.\n *\n * @param {Object} context\n * @memberof module:FactoryMaker\n * @instance\n */\n\n\n function deleteSingletonInstances(context) {\n singletonContexts = singletonContexts.filter(function (x) {\n return x.context !== context;\n });\n }\n /*------------------------------------------------------------------------------------------*/\n // Factories storage Management\n\n /*------------------------------------------------------------------------------------------*/\n\n\n function getFactoryByName(name, factoriesArray) {\n return factoriesArray[name];\n }\n\n function updateFactory(name, factory, factoriesArray) {\n if (name in factoriesArray) {\n factoriesArray[name] = factory;\n }\n }\n /*------------------------------------------------------------------------------------------*/\n // Class Factories Management\n\n /*------------------------------------------------------------------------------------------*/\n\n\n function updateClassFactory(name, factory) {\n updateFactory(name, factory, classFactories);\n }\n\n function getClassFactoryByName(name) {\n return getFactoryByName(name, classFactories);\n }\n\n function getClassFactory(classConstructor) {\n var factory = getFactoryByName(classConstructor.__dashjs_factory_name, classFactories);\n\n if (!factory) {\n factory = function factory(context) {\n if (context === undefined) {\n context = {};\n }\n\n return {\n create: function create() {\n return merge(classConstructor, context, arguments);\n }\n };\n };\n\n classFactories[classConstructor.__dashjs_factory_name] = factory; // store factory\n }\n\n return factory;\n }\n /*------------------------------------------------------------------------------------------*/\n // Singleton Factory MAangement\n\n /*------------------------------------------------------------------------------------------*/\n\n\n function updateSingletonFactory(name, factory) {\n updateFactory(name, factory, singletonFactories);\n }\n\n function getSingletonFactoryByName(name) {\n return getFactoryByName(name, singletonFactories);\n }\n\n function getSingletonFactory(classConstructor) {\n var factory = getFactoryByName(classConstructor.__dashjs_factory_name, singletonFactories);\n\n if (!factory) {\n factory = function factory(context) {\n var instance;\n\n if (context === undefined) {\n context = {};\n }\n\n return {\n getInstance: function getInstance() {\n // If we don\'t have an instance yet check for one on the context\n if (!instance) {\n instance = getSingletonInstance(context, classConstructor.__dashjs_factory_name);\n } // If there\'s no instance on the context then create one\n\n\n if (!instance) {\n instance = merge(classConstructor, context, arguments);\n singletonContexts.push({\n name: classConstructor.__dashjs_factory_name,\n context: context,\n instance: instance\n });\n }\n\n return instance;\n }\n };\n };\n\n singletonFactories[classConstructor.__dashjs_factory_name] = factory; // store factory\n }\n\n return factory;\n }\n\n function merge(classConstructor, context, args) {\n var classInstance;\n var className = classConstructor.__dashjs_factory_name;\n var extensionObject = context[className];\n\n if (extensionObject) {\n var extension = extensionObject.instance;\n\n if (extensionObject.override) {\n //Override public methods in parent but keep parent.\n classInstance = classConstructor.apply({\n context: context\n }, args);\n extension = extension.apply({\n context: context,\n factory: instance,\n parent: classInstance\n }, args);\n\n for (var prop in extension) {\n if (classInstance.hasOwnProperty(prop)) {\n classInstance[prop] = extension[prop];\n }\n }\n } else {\n //replace parent object completely with new object. Same as dijon.\n return extension.apply({\n context: context,\n factory: instance\n }, args);\n }\n } else {\n // Create new instance of the class\n classInstance = classConstructor.apply({\n context: context\n }, args);\n } // Add getClassName function to class instance prototype (used by Debug)\n\n\n classInstance.getClassName = function () {\n return className;\n };\n\n return classInstance;\n }\n\n instance = {\n extend: extend,\n getSingletonInstance: getSingletonInstance,\n setSingletonInstance: setSingletonInstance,\n deleteSingletonInstances: deleteSingletonInstances,\n getSingletonFactory: getSingletonFactory,\n getSingletonFactoryByName: getSingletonFactoryByName,\n updateSingletonFactory: updateSingletonFactory,\n getClassFactory: getClassFactory,\n getClassFactoryByName: getClassFactoryByName,\n updateClassFactory: updateClassFactory\n };\n return instance;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (FactoryMaker);\n\n/***/ }),\n\n/***/ "./src/core/Settings.js":\n/*!******************************!*\\\n !*** ./src/core/Settings.js ***!\n \\******************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_544115__) {\n__nested_webpack_require_544115__.r(__nested_webpack_exports__);\n/* harmony import */ var _FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_544115__(/*! ./FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _Utils_js__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_544115__(/*! ./Utils.js */ "./src/core/Utils.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_544115__(/*! ../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_544115__(/*! ../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_544115__(/*! ../streaming/vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n/** @module Settings\n * @description Define the configuration parameters of Dash.js MediaPlayer.\n * @see {@link module:Settings~PlayerSettings PlayerSettings} for further information about the supported configuration properties.\n */\n\n/**\n * @typedef {Object} PlayerSettings\n * @property {module:Settings~DebugSettings} [debug]\n * Debug related settings.\n * @property {module:Settings~ErrorSettings} [errors]\n * Error related settings\n * @property {module:Settings~StreamingSettings} [streaming]\n * Streaming related settings.\n * @example\n *\n * // Full settings object\n * settings = {\n * debug: {\n * logLevel: Debug.LOG_LEVEL_WARNING,\n * dispatchEvent: false\n * },\n * streaming: {\n * abandonLoadTimeout: 10000,\n * wallclockTimeUpdateInterval: 100,\n * lowLatencyEnabled: false,\n * lowLatencyEnabledByManifest: true,\n * manifestUpdateRetryInterval: 100,\n * cacheInitSegments: true,\n * eventControllerRefreshDelay: 100,\n * capabilities: {\n * filterUnsupportedEssentialProperties: true,\n * useMediaCapabilitiesApi: false\n * },\n * timeShiftBuffer: {\n * calcFromSegmentTimeline: false,\n * fallbackToSegmentTimeline: true\n * },\n * metrics: {\n * maxListDepth: 100\n * },\n * delay: {\n * liveDelayFragmentCount: NaN,\n * liveDelay: NaN,\n * useSuggestedPresentationDelay: true,\n * applyServiceDescription: true\n * },\n * protection: {\n * keepProtectionMediaKeys: false\n * },\n * buffer: {\n * enableSeekDecorrelationFix: true,\n * fastSwitchEnabled: true,\n * flushBufferAtTrackSwitch: false,\n * reuseExistingSourceBuffers: true,\n * bufferPruningInterval: 10,\n * bufferToKeep: 20,\n * bufferTimeAtTopQuality: 30,\n * bufferTimeAtTopQualityLongForm: 60,\n * initialBufferLevel: NaN,\n * stableBufferTime: 12,\n * longFormContentDurationThreshold: 600,\n * stallThreshold: 0.5,\n * useAppendWindow: true,\n * setStallState: false\n * },\n * gaps: {\n * jumpGaps: true,\n * jumpLargeGaps: true,\n * smallGapLimit: 1.5,\n * threshold: 0.3,\n * enableSeekFix: false\n * },\n * utcSynchronization: {\n * enabled: true,\n * useManifestDateHeaderTimeSource: true,\n * backgroundAttempts: 2,\n * timeBetweenSyncAttempts: 30,\n * maximumTimeBetweenSyncAttempts: 600,\n * minimumTimeBetweenSyncAttempts: 2,\n * timeBetweenSyncAttemptsAdjustmentFactor: 2,\n * maximumAllowedDrift: 100,\n * enableBackgroundSyncAfterSegmentDownloadError: true,\n * defaultTimingSource: {\n * scheme: \'urn:mpeg:dash:utc:http-xsdate:2014\',\n * value: \'http://time.akamai.com/?iso&ms\'\n * }\n * },\n * scheduling: {\n * defaultTimeout: 300,\n * lowLatencyTimeout: 100,\n * scheduleWhilePaused: true\n * },\n * text: {\n * defaultEnabled: true\n * },\n * liveCatchup: {\n * minDrift: 0.02,\n * maxDrift: 12,\n * playbackRate: 0.5,\n * latencyThreshold: 60,\n * playbackBufferMin: 0.5,\n * enabled: false,\n * mode: Constants.LIVE_CATCHUP_MODE_DEFAULT\n * },\n * lastBitrateCachingInfo: { enabled: true, ttl: 360000 },\n * lastMediaSettingsCachingInfo: { enabled: true, ttl: 360000 },\n * cacheLoadThresholds: { video: 50, audio: 5 },\n * trackSwitchMode: {\n * audio: Constants.TRACK_SWITCH_MODE_ALWAYS_REPLACE,\n * video: Constants.TRACK_SWITCH_MODE_NEVER_REPLACE\n * },\n * selectionModeForInitialTrack: Constants.TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY,\n * fragmentRequestTimeout: 0,\n * retryIntervals: {\n * [HTTPRequest.MPD_TYPE]: 500,\n * [HTTPRequest.XLINK_EXPANSION_TYPE]: 500,\n * [HTTPRequest.MEDIA_SEGMENT_TYPE]: 1000,\n * [HTTPRequest.INIT_SEGMENT_TYPE]: 1000,\n * [HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE]: 1000,\n * [HTTPRequest.INDEX_SEGMENT_TYPE]: 1000,\n * [HTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE]: 1000,\n * [HTTPRequest.LICENSE]: 1000,\n * [HTTPRequest.OTHER_TYPE]: 1000,\n * lowLatencyReductionFactor: 10\n * },\n * retryAttempts: {\n * [HTTPRequest.MPD_TYPE]: 3,\n * [HTTPRequest.XLINK_EXPANSION_TYPE]: 1,\n * [HTTPRequest.MEDIA_SEGMENT_TYPE]: 3,\n * [HTTPRequest.INIT_SEGMENT_TYPE]: 3,\n * [HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE]: 3,\n * [HTTPRequest.INDEX_SEGMENT_TYPE]: 3,\n * [HTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE]: 3,\n * [HTTPRequest.LICENSE]: 3,\n * [HTTPRequest.OTHER_TYPE]: 3,\n * lowLatencyMultiplyFactor: 5\n * },\n * abr: {\n * movingAverageMethod: Constants.MOVING_AVERAGE_SLIDING_WINDOW,\n * ABRStrategy: Constants.ABR_STRATEGY_DYNAMIC,\n * additionalAbrRules: {\n * insufficientBufferRule: false,\n * switchHistoryRule: true,\n * droppedFramesRule: true,\n * abandonRequestsRule: false\n * },\n * bandwidthSafetyFactor: 0.9,\n * useDefaultABRRules: true,\n * useDeadTimeLatency: true,\n * limitBitrateByPortal: false,\n * usePixelRatioInLimitBitrateByPortal: false,\n * maxBitrate: { audio: -1, video: -1 },\n * minBitrate: { audio: -1, video: -1 },\n * maxRepresentationRatio: { audio: 1, video: 1 },\n * initialBitrate: { audio: -1, video: -1 },\n * initialRepresentationRatio: { audio: -1, video: -1 },\n * autoSwitchBitrate: { audio: true, video: true },\n * fetchThroughputCalculationMode: Constants.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA\n * },\n * cmcd: {\n * enabled: false,\n * sid: null,\n * cid: null,\n * rtp: null,\n * rtpSafetyFactor: 5,\n * mode: Constants.CMCD_MODE_QUERY\n * }\n * },\n * errors: {\n * recoverAttempts: {\n * mediaErrorDecode: 5\n * }\n * }\n * }\n */\n\n/**\n * @typedef {Object} TimeShiftBuffer\n * @property {boolean} [calcFromSegmentTimeline=false]\n * Enable calculation of the DVR window for SegmentTimeline manifests based on the entries in \\<SegmentTimeline\\>.\n * * @property {boolean} [fallbackToSegmentTimeline=true]\n * In case the MPD uses \\<SegmentTimeline\\ and no segment is found within the DVR window the DVR window is calculated based on the entries in \\<SegmentTimeline\\>.\n */\n\n/**\n * @typedef {Object} LiveDelay\n * @property {number} [liveDelayFragmentCount=NaN]\n * Changing this value will lower or increase live stream latency.\n *\n * The detected segment duration will be multiplied by this value to define a time in seconds to delay a live stream from the live edge.\n *\n * Lowering this value will lower latency but may decrease the player\'s ability to build a stable buffer.\n * @property {number} [liveDelay]\n * Equivalent in seconds of setLiveDelayFragmentCount.\n *\n * Lowering this value will lower latency but may decrease the player\'s ability to build a stable buffer.\n *\n * This value should be less than the manifest duration by a couple of segment durations to avoid playback issues.\n *\n * If set, this parameter will take precedence over setLiveDelayFragmentCount and manifest info.\n * @property {boolean} [useSuggestedPresentationDelay=true]\n * Set to true if you would like to overwrite the default live delay and honor the SuggestedPresentationDelay attribute in by the manifest.\n * @property {boolean} [applyServiceDescription=true]\n * Set to true if dash.js should use latency targets defined in ServiceDescription elements\n */\n\n/**\n * @typedef {Object} Buffer\n * @property {boolean} [enableSeekDecorrelationFix=false]\n * Enables a workaround for playback start on some devices, e.g. WebOS 4.9.\n * It is necessary because some browsers do not support setting currentTime on video element to a value that is outside of current buffer.\n *\n * If you experience unexpected seeking triggered by BufferController, you can try setting this value to false.\n\n * @property {boolean} [fastSwitchEnabled=true]\n * When enabled, after an ABR up-switch in quality, instead of requesting and appending the next fragment at the end of the current buffer range it is requested and appended closer to the current time.\n *\n * When enabled, The maximum time to render a higher quality is current time + (1.5 * fragment duration).\n *\n * Note, When ABR down-switch is detected, we appended the lower quality at the end of the buffer range to preserve the\n * higher quality media for as long as possible.\n *\n * If enabled, it should be noted there are a few cases when the client will not replace inside buffer range but rather just append at the end.\n * 1. When the buffer level is less than one fragment duration.\n * 2. The client is in an Abandonment State due to recent fragment abandonment event.\n *\n * Known issues:\n * 1. In IE11 with auto switching off, if a user switches to a quality they can not download in time the fragment may be appended in the same range as the playhead or even in the past, in IE11 it may cause a stutter or stall in playback.\n * @property {boolean} [flushBufferAtTrackSwitch=false]\n * When enabled, after a track switch and in case buffer is being replaced, the video element is flushed (seek at current playback time) once a segment of the new track is appended in buffer in order to force video decoder to play new track.\n *\n * This can be required on some devices like GoogleCast devices to make track switching functional.\n *\n * Otherwise track switching will be effective only once after previous buffered track is fully consumed.\n * @property {boolean} [reuseExistingSourceBuffers=true]\n * Enable reuse of existing MediaSource Sourcebuffers during period transition.\n * @property {number} [bufferPruningInterval=10]\n * The interval of pruning buffer in seconds.\n * @property {number} [bufferToKeep=20]\n * This value influences the buffer pruning logic.\n *\n * Allows you to modify the buffer that is kept in source buffer in seconds.\n * 0|-----------bufferToPrune-----------|-----bufferToKeep-----|currentTime|\n * @property {number} [bufferTimeAtTopQuality=30]\n * The time that the internal buffer target will be set to once playing the top quality.\n *\n * If there are multiple bitrates in your adaptation, and the media is playing at the highest bitrate, then we try to build a larger buffer at the top quality to increase stability and to maintain media quality.\n * @property {number} [bufferTimeAtTopQualityLongForm=60]\n * The time that the internal buffer target will be set to once playing the top quality for long form content.\n * @property {number} [longFormContentDurationThreshold=600]\n * The threshold which defines if the media is considered long form content.\n *\n * This will directly affect the buffer targets when playing back at the top quality.\n * @property {number} [initialBufferLevel=NaN]\n * Initial buffer level before playback starts\n * @property {number} [stableBufferTime=12]\n * The time that the internal buffer target will be set to post startup/seeks (NOT top quality).\n *\n * When the time is set higher than the default you will have to wait longer to see automatic bitrate switches but will have a larger buffer which will increase stability.\n * @property {number} [stallThreshold=0.3]\n * Stall threshold used in BufferController.js to determine whether a track should still be changed and which buffer range to prune.\n * @property {boolean} [useAppendWindow=true]\n * Specifies if the appendWindow attributes of the MSE SourceBuffers should be set according to content duration from manifest.\n * @property {boolean} [setStallState=false]\n * Specifies if we fire manual waiting events once the stall threshold is reached\n */\n\n/**\n * @typedef {Object} module:Settings~AudioVideoSettings\n * @property {number|boolean|string} [audio]\n * Configuration for audio media type of tracks.\n * @property {number|boolean|string} [video]\n * Configuration for video media type of tracks.\n */\n\n/**\n * @typedef {Object} DebugSettings\n * @property {number} [logLevel=dashjs.Debug.LOG_LEVEL_WARNING]\n * Sets up the log level. The levels are cumulative.\n *\n * For example, if you set the log level to dashjs.Debug.LOG_LEVEL_WARNING all warnings, errors and fatals will be logged.\n *\n * Possible values.\n *\n * - dashjs.Debug.LOG_LEVEL_NONE\n * No message is written in the browser console.\n *\n * - dashjs.Debug.LOG_LEVEL_FATAL\n * Log fatal errors.\n * An error is considered fatal when it causes playback to fail completely.\n *\n * - dashjs.Debug.LOG_LEVEL_ERROR\n * Log error messages.\n *\n * - dashjs.Debug.LOG_LEVEL_WARNING\n * Log warning messages.\n *\n * - dashjs.Debug.LOG_LEVEL_INFO\n * Log info messages.\n *\n * - dashjs.Debug.LOG_LEVEL_DEBUG\n * Log debug messages.\n * @property {boolean} [dispatchEvent=false]\n * Enable to trigger a Events.LOG event whenever log output is generated.\n *\n * Note this will be dispatched regardless of log level.\n */\n\n/**\n * @typedef {Object} module:Settings~ErrorSettings\n * @property {object} [recoverAttempts={mediaErrorDecode: 5}]\n * Defines the maximum number of recover attempts for specific media errors.\n *\n * For mediaErrorDecode the player will reset the MSE and skip the blacklisted segment that caused the decode error. The resulting gap will be handled by the GapController.\n */\n\n/**\n * @typedef {Object} CachingInfoSettings\n * @property {boolean} [enable]\n * Enable or disable the caching feature.\n * @property {number} [ttl]\n * Time to live.\n *\n * A value defined in milliseconds representing how log to cache the settings for.\n */\n\n/**\n * @typedef {Object} Gaps\n * @property {boolean} [jumpGaps=true]\n * Sets whether player should jump small gaps (discontinuities) in the buffer.\n * @property {boolean} [jumpLargeGaps=true]\n * Sets whether player should jump large gaps (discontinuities) in the buffer.\n * @property {number} [smallGapLimit=1.5]\n * Time in seconds for a gap to be considered small.\n * @property {number} [threshold=0.3]\n * Threshold at which the gap handling is executed. If currentRangeEnd - currentTime < threshold the gap jump will be triggered.\n * For live stream the jump might be delayed to keep a consistent live edge.\n * Note that the amount of buffer at which platforms automatically stall might differ.\n * @property {boolean} [enableSeekFix=false]\n * Enables the adjustment of the seek target once no valid segment request could be generated for a specific seek time. This can happen if the user seeks to a position for which there is a gap in the timeline.\n */\n\n/**\n * @typedef {Object} UtcSynchronizationSettings\n * @property {boolean} [enabled=true]\n * Enables or disables the UTC clock synchronization\n * @property {boolean} [useManifestDateHeaderTimeSource=true]\n * Allows you to enable the use of the Date Header, if exposed with CORS, as a timing source for live edge detection.\n *\n * The use of the date header will happen only after the other timing source that take precedence fail or are omitted as described.\n * @property {number} [backgroundAttempts=2]\n * Number of synchronization attempts to perform in the background after an initial synchronization request has been done. This is used to verify that the derived client-server offset is correct.\n *\n * The background requests are async and done in parallel to the start of the playback.\n *\n * This value is also used to perform a resync after 404 errors on segments.\n * @property {number} [timeBetweenSyncAttempts=30]\n * The time in seconds between two consecutive sync attempts.\n *\n * Note: This value is used as an initial starting value. The internal value of the TimeSyncController is adjusted during playback based on the drift between two consecutive synchronization attempts.\n *\n * Note: A sync is only performed after an MPD update. In case the @minimumUpdatePeriod is larger than this value the sync will be delayed until the next MPD update.\n * @property {number} [maximumTimeBetweenSyncAttempts=600]\n * The maximum time in seconds between two consecutive sync attempts.\n *\n * @property {number} [minimumTimeBetweenSyncAttempts=2]\n * The minimum time in seconds between two consecutive sync attempts.\n *\n * @property {number} [timeBetweenSyncAttemptsAdjustmentFactor=2]\n * The factor used to multiply or divide the timeBetweenSyncAttempts parameter after a sync. The maximumAllowedDrift defines whether this value is used as a factor or a dividend.\n *\n * @property {number} [maximumAllowedDrift=100]\n * The maximum allowed drift specified in milliseconds between two consecutive synchronization attempts.\n *\n * @property {boolean} [enableBackgroundSyncAfterSegmentDownloadError=true]\n * Enables or disables the background sync after the player ran into a segment download error.\n *\n * @property {object} [defaultTimingSource={scheme:\'urn:mpeg:dash:utc:http-xsdate:2014\',value: \'http://time.akamai.com/?iso&ms\'}]\n * The default timing source to be used. The timing sources in the MPD take precedence over this one.\n */\n\n/**\n * @typedef {Object} Scheduling\n * @property {number} [defaultTimeout=300]\n * Default timeout between two consecutive segment scheduling attempts\n * @property {number} [lowLatencyTimeout]\n * Default timeout between two consecutive low-latency segment scheduling attempts\n * @property {boolean} [scheduleWhilePaused=true]\n * Set to true if you would like dash.js to keep downloading fragments in the background when the video element is paused.\n */\n\n/**\n * @typedef {Object} Text\n * @property {number} [defaultEnabled=true]\n * Enable/disable subtitle rendering by default.\n */\n\n/**\n * @typedef {Object} LiveCatchupSettings\n * @property {number} [minDrift=0.02]\n * Use this method to set the minimum latency deviation allowed before activating catch-up mechanism.\n *\n * In low latency mode, when the difference between the measured latency and the target one, as an absolute number, is higher than the one sets with this method, then dash.js increases/decreases playback rate until target latency is reached.\n *\n * LowLatencyMinDrift should be provided in seconds, and it uses values between 0.0 and 0.5.\n *\n * Note: Catch-up mechanism is only applied when playing low latency live streams.\n * @property {number} [maxDrift=12]\n * Use this method to set the maximum latency deviation allowed before dash.js to do a seeking to live position.\n *\n * In low latency mode, when the difference between the measured latency and the target one, as an absolute number, is higher than the one sets with this method, then dash.js does a seek to live edge position minus the target live delay.\n *\n * LowLatencyMaxDriftBeforeSeeking should be provided in seconds.\n *\n * If 0, then seeking operations won\'t be used for fixing latency deviations.\n *\n * Note: Catch-up mechanism is only applied when playing low latency live streams.\n * @property {number} [playbackRate=0.5]\n * Use this parameter to set the maximum catch up rate, as a percentage, for low latency live streams.\n *\n * In low latency mode, when measured latency is higher/lower than the target one, dash.js increases/decreases playback rate respectively up to (+/-) the percentage defined with this method until target is reached.\n *\n * Valid values for catch up rate are in range 0-0.5 (0-50%).\n *\n * Set it to 0 to turn off live catch up feature.\n *\n * Note: Catch-up mechanism is only applied when playing low latency live streams.\n * @property {number} [latencyThreshold=NaN]\n * Use this parameter to set the maximum threshold for which live catch up is applied.\n *\n * For instance, if this value is set to 8 seconds, then live catchup is only applied if the current live latency is equal or below 8 seconds.\n *\n * The reason behind this parameter is to avoid an increase of the playback rate if the user seeks within the DVR window.\n *\n * If no value is specified this will be twice the maximum live delay.\n *\n * The maximum live delay is either specified in the manifest as part of a ServiceDescriptor or calculated the following:\n * maximumLiveDelay = targetDelay + liveCatchupMinDrift.\n *\n * @property {number} [playbackBufferMin=NaN]\n * Use this parameter to specify the minimum buffer which is used for LoL+ based playback rate reduction.\n *\n *\n * @property {boolean} [enabled=false]\n * Use this parameter to enable the catchup mode for non low-latency streams.\n *\n * @property {string} [mode="liveCatchupModeDefault"]\n * Use this parameter to switch between different catchup modes.\n *\n * Options: "liveCatchupModeDefault" or "liveCatchupModeLOLP".\n *\n * Note: Catch-up mechanism is automatically applied when playing low latency live streams.\n */\n\n/**\n * @typedef {Object} RequestTypeSettings\n * @property {number} [MPD]\n * Manifest type of requests.\n * @property {number} [XLinkExpansion]\n * XLink expansion type of requests.\n * @property {number} [InitializationSegment]\n * Request to retrieve an initialization segment.\n * @property {number} [IndexSegment]\n * Request to retrieve an index segment (SegmentBase).\n * @property {number} [MediaSegment]\n * Request to retrieve a media segment (video/audio/image/text chunk).\n * @property {number} [BitstreamSwitchingSegment]\n * Bitrate stream switching type of request.\n * @property {number} [FragmentInfoSegment]\n * Request to retrieve a FragmentInfo segment (specific to Smooth Streaming live streams).\n * @property {number} [other]\n * Other type of request.\n * @property {number} [lowLatencyReductionFactor]\n * For low latency mode, values of type of request are divided by lowLatencyReductionFactor.\n *\n * Note: It\'s not type of request.\n * @property {number} [lowLatencyMultiplyFactor]\n * For low latency mode, values of type of request are multiplied by lowLatencyMultiplyFactor.\n *\n * Note: It\'s not type of request.\n */\n\n/**\n * @typedef {Object} Protection\n * @property {boolean} [keepProtectionMediaKeys=false]\n * Set the value for the ProtectionController and MediaKeys life cycle.\n *\n * If true, the ProtectionController and then created MediaKeys and MediaKeySessions will be preserved during the MediaPlayer lifetime.\n * @property {boolean} ignoreEmeEncryptedEvent\n * If set to true the player will ignore "encrypted" and "needkey" events thrown by the EME.\n */\n\n/**\n * @typedef {Object} Capabilities\n * @property {boolean} [filterUnsupportedEssentialProperties=true]\n * Enable to filter all the AdaptationSets and Representations which contain an unsupported \\<EssentialProperty\\> element.\n * @property {boolean} [useMediaCapabilitiesApi=false]\n * Enable to use the MediaCapabilities API to check whether codecs are supported. If disabled MSE.isTypeSupported will be used instead.\n */\n\n/**\n * @typedef {Object} AbrSettings\n * @property {string} [movingAverageMethod="slidingWindow"]\n * Sets the moving average method used for smoothing throughput estimates.\n *\n * Valid methods are "slidingWindow" and "ewma".\n *\n * The call has no effect if an invalid method is passed.\n *\n * The sliding window moving average method computes the average throughput using the last four segments downloaded.\n *\n * If the stream is live (as opposed to VOD), then only the last three segments are used.\n *\n * If wide variations in throughput are detected, the number of segments can be dynamically increased to avoid oscillations.\n *\n * The exponentially weighted moving average (EWMA) method computes the average using exponential smoothing.\n *\n * Two separate estimates are maintained, a fast one with a three-second half life and a slow one with an eight-second half life.\n *\n * The throughput estimate at any time is the minimum of the fast and slow estimates.\n *\n * This allows a fast reaction to a bandwidth drop and prevents oscillations on bandwidth spikes.\n * @property {string} [ABRStrategy="abrDynamic"]\n * Returns the current ABR strategy being used: "abrDynamic", "abrBola" or "abrThroughput".\n * @property {object} [trackSwitchMode={video: "neverReplace", audio: "alwaysReplace"}]\n * @property {object} [additionalAbrRules={insufficientBufferRule: false,switchHistoryRule: true,droppedFramesRule: true,abandonRequestsRule: false}]\n * Enable/Disable additional ABR rules in case ABRStrategy is set to "abrDynamic", "abrBola" or "abrThroughput".\n * @property {number} [bandwidthSafetyFactor=0.9]\n * Standard ABR throughput rules multiply the throughput by this value.\n *\n * It should be between 0 and 1, with lower values giving less rebuffering (but also lower quality).\n * @property {boolean} [useDefaultABRRules=true]\n * Should the default ABR rules be used, or the custom ones added.\n * @property {boolean} [useDeadTimeLatency=true]\n * If true, only the download portion will be considered part of the download bitrate and latency will be regarded as static.\n *\n * If false, the reciprocal of the whole transfer time will be used.\n * @property {boolean} [limitBitrateByPortal=false]\n * If true, the size of the video portal will limit the max chosen video resolution.\n * @property {boolean} [usePixelRatioInLimitBitrateByPortal=false]\n * Sets whether to take into account the device\'s pixel ratio when defining the portal dimensions.\n *\n * Useful on, for example, retina displays.\n * @property {module:Settings~AudioVideoSettings} [maxBitrate={audio: -1, video: -1}]\n * The maximum bitrate that the ABR algorithms will choose.\n *\n * Use NaN for no limit.\n * @property {module:Settings~AudioVideoSettings} [minBitrate={audio: -1, video: -1}]\n * The minimum bitrate that the ABR algorithms will choose.\n *\n * Use NaN for no limit.\n * @property {module:Settings~AudioVideoSettings} [maxRepresentationRatio={audio: 1, video: 1}]\n * When switching multi-bitrate content (auto or manual mode) this property specifies the maximum representation allowed, as a proportion of the size of the representation set.\n *\n * You can set or remove this cap at anytime before or during playback.\n *\n * To clear this setting you set the value to 1.\n *\n * If both this and maxAllowedBitrate are defined, maxAllowedBitrate is evaluated first, then maxAllowedRepresentation, i.e. the lowest value from executing these rules is used.\n *\n * This feature is typically used to reserve higher representations for playback only when connected over a fast connection.\n * @property {module:Settings~AudioVideoSettings} [initialBitrate={audio: -1, video: -1}]\n * Explicitly set the starting bitrate for audio or video.\n * @property {module:Settings~AudioVideoSettings} [initialRepresentationRatio={audio: -1, video: -1}]\n * Explicitly set the initial representation ratio.\n *\n * If initalBitrate is specified, this is ignored.\n * @property {module:Settings~AudioVideoSettings} [autoSwitchBitrate={audio: true, video: true}]\n * Indicates whether the player should enable ABR algorithms to switch the bitrate.\n *\n * @property {string} [fetchThroughputCalculationMode="abrFetchThroughputCalculationDownloadedData"]\n * Algorithm to determine the throughput in case the Fetch API is used for low latency streaming.\n *\n * For details please check the samples section and FetchLoader.js.\n */\n\n/**\n * @typedef {Object} module:Settings~CmcdSettings\n * @property {boolean} [enable=false]\n * Enable or disable the CMCD reporting.\n * @property {string} [sid]\n * GUID identifying the current playback session.\n *\n * Should be in UUID format.\n *\n * If not specified a UUID will be automatically generated.\n * @property {string} [cid]\n * A unique string to identify the current content.\n *\n * If not specified it will be a hash of the MPD url.\n * @property {number} [rtp]\n * The requested maximum throughput that the client considers sufficient for delivery of the asset.\n *\n * If not specified this value will be dynamically calculated in the CMCDModel based on the current buffer level.\n * @property {number} [rtpSafetyFactor]\n * This value is used as a factor for the rtp value calculation: rtp = minBandwidth * rtpSafetyFactor\n *\n * If not specified this value defaults to 5. Note that this value is only used when no static rtp value is defined.\n * @property {number} [mode]\n * The method to use to attach cmcd metrics to the requests. \'query\' to use query parameters, \'header\' to use http headers.\n *\n * If not specified this value defaults to \'query\'.\n */\n\n/**\n * @typedef {Object} Metrics\n * @property {number} [metricsMaxListDepth=100]\n * Maximum number of metrics that are persisted per type.\n */\n\n/**\n * @typedef {Object} StreamingSettings\n * @property {number} [abandonLoadTimeout=10000]\n * A timeout value in seconds, which during the ABRController will block switch-up events.\n *\n * This will only take effect after an abandoned fragment event occurs.\n * @property {number} [wallclockTimeUpdateInterval=50]\n * How frequently the wallclockTimeUpdated internal event is triggered (in milliseconds).\n * @property {boolean} [lowLatencyEnabled=false]\n * Manually enable or disable low latency mode.\n *\n * @property {boolean} [lowLatencyEnabledByManifest=true]\n * If this value is set to true we enable the low latency mode based on MPD attributes: Specifically in case "availabilityTimeComplete" of the current representation is set to false.\n *\n * @property {number} [manifestUpdateRetryInterval=100]\n * For live streams, set the interval-frequency in milliseconds at which dash.js will check if the current manifest is still processed before downloading the next manifest once the minimumUpdatePeriod time has.\n * @property {boolean} [cacheInitSegments=true]\n * Enables the caching of init segments to avoid requesting the init segments before each representation switch.\n * @property {number} [eventControllerRefreshDelay=100]\n * Defines the delay in milliseconds between two consecutive checks for events to be fired.\n * @property {module:Settings~Metrics} metrics Metric settings\n * @property {module:Settings~LiveDelay} delay Live Delay settings\n * @property {module:Settings~TimeShiftBuffer} timeShiftBuffer TimeShiftBuffer settings\n * @property {module:Settings~Protection} protection DRM related settings\n * @property {module:Settings~Capabilities} capabilities Capability related settings\n * @property {module:Settings~Buffer} buffer Buffer related settings\n * @property {module:Settings~Gaps} gaps Gap related settings\n * @property {module:Settings~UtcSynchronizationSettings} utcSynchronization Settings related to UTC clock synchronization\n * @property {module:Settings~Scheduling} scheduling Settings related to segment scheduling\n * @property {module:Settings~Text} text Settings related to Subtitles and captions\n * @property {module:Settings~LiveCatchupSettings} liveCatchup Settings related to live catchup.\n * @property {module:Settings~CachingInfoSettings} [lastBitrateCachingInfo={enabled: true, ttl: 360000}]\n * Set to false if you would like to disable the last known bit rate from being stored during playback and used to set the initial bit rate for subsequent playback within the expiration window.\n *\n * The default expiration is one hour, defined in milliseconds.\n *\n * If expired, the default initial bit rate (closest to 1000 kbps) will be used for that session and a new bit rate will be stored during that session.\n * @property {module:Settings~AudioVideoSettings} [cacheLoadThresholds={video: 50, audio: 5}]\n * For a given media type, the threshold which defines if the response to a fragment request is coming from browser cache or not.\n * @property {module:Settings~AudioVideoSettings} [trackSwitchMode={video: "neverReplace", audio: "alwaysReplace"}]\n * For a given media type defines if existing segments in the buffer should be overwritten once the track is switched. For instance if the user switches the audio language the existing segments in the audio buffer will be replaced when setting this value to "alwaysReplace".\n *\n * Possible values\n *\n * - Constants.TRACK_SWITCH_MODE_ALWAYS_REPLACE\n * Replace existing segments in the buffer\n *\n * - Constants.TRACK_SWITCH_MODE_NEVER_REPLACE\n * Do not replace existing segments in the buffer\n *\n * @property {string} [selectionModeForInitialTrack="highestBitrate"]\n * Sets the selection mode for the initial track. This mode defines how the initial track will be selected if no initial media settings are set. If initial media settings are set this parameter will be ignored. Available options are:\n *\n * Possible values\n *\n * - Constants.TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY\n * This mode makes the player select the track with the highest selectionPriority as defined in the manifest. If not selectionPriority is given we fallback to TRACK_SELECTION_MODE_HIGHEST_BITRATE. This mode is a default mode.\n *\n * - Constants.TRACK_SELECTION_MODE_HIGHEST_BITRATE\n * This mode makes the player select the track with a highest bitrate.\n *\n * - Constants.TRACK_SELECTION_MODE_FIRST_TRACK\n * This mode makes the player select the first track found in the manifest.\n *\n * - Constants.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY\n * This mode makes the player select the track with the lowest bitrate per pixel average.\n *\n * - Constants.TRACK_SELECTION_MODE_WIDEST_RANGE\n * This mode makes the player select the track with a widest range of bitrates.\n *\n *\n * @property {number} [fragmentRequestTimeout=0]\n * Time in milliseconds before timing out on loading a media fragment.\n *\n * Fragments that timeout are retried as if they failed.\n * @property {module:Settings~RequestTypeSettings} [retryIntervals]\n * Time in milliseconds of which to reload a failed file load attempt.\n *\n * For low latency mode these values are divided by lowLatencyReductionFactor.\n * @property {module:Settings~RequestTypeSettings} [retryAttempts]\n * Total number of retry attempts that will occur on a file load before it fails.\n *\n * For low latency mode these values are multiplied by lowLatencyMultiplyFactor.\n * @property {module:Settings~AbrSettings} abr\n * Adaptive Bitrate algorithm related settings.\n * @property {module:Settings~CmcdSettings} cmcd\n * Settings related to Common Media Client Data reporting.\n */\n\n/**\n * @class\n * @ignore\n */\n\nfunction Settings() {\n var _retryIntervals, _retryAttempts;\n\n var instance;\n /**\n * @const {PlayerSettings} defaultSettings\n * @ignore\n */\n\n var defaultSettings = {\n debug: {\n logLevel: _core_Debug__WEBPACK_IMPORTED_MODULE_2__["default"].LOG_LEVEL_WARNING,\n dispatchEvent: false\n },\n streaming: {\n abandonLoadTimeout: 10000,\n wallclockTimeUpdateInterval: 100,\n lowLatencyEnabled: false,\n lowLatencyEnabledByManifest: true,\n manifestUpdateRetryInterval: 100,\n cacheInitSegments: false,\n eventControllerRefreshDelay: 150,\n capabilities: {\n filterUnsupportedEssentialProperties: true,\n useMediaCapabilitiesApi: false\n },\n timeShiftBuffer: {\n calcFromSegmentTimeline: false,\n fallbackToSegmentTimeline: true\n },\n metrics: {\n maxListDepth: 100\n },\n delay: {\n liveDelayFragmentCount: NaN,\n liveDelay: NaN,\n useSuggestedPresentationDelay: true,\n applyServiceDescription: true\n },\n protection: {\n keepProtectionMediaKeys: false,\n ignoreEmeEncryptedEvent: false\n },\n buffer: {\n enableSeekDecorrelationFix: false,\n fastSwitchEnabled: true,\n flushBufferAtTrackSwitch: false,\n reuseExistingSourceBuffers: true,\n bufferPruningInterval: 10,\n bufferToKeep: 20,\n bufferTimeAtTopQuality: 30,\n bufferTimeAtTopQualityLongForm: 60,\n initialBufferLevel: NaN,\n stableBufferTime: 12,\n longFormContentDurationThreshold: 600,\n stallThreshold: 0.3,\n useAppendWindow: true,\n setStallState: true\n },\n gaps: {\n jumpGaps: true,\n jumpLargeGaps: true,\n smallGapLimit: 1.5,\n threshold: 0.3,\n enableSeekFix: false\n },\n utcSynchronization: {\n enabled: true,\n useManifestDateHeaderTimeSource: true,\n backgroundAttempts: 2,\n timeBetweenSyncAttempts: 30,\n maximumTimeBetweenSyncAttempts: 600,\n minimumTimeBetweenSyncAttempts: 2,\n timeBetweenSyncAttemptsAdjustmentFactor: 2,\n maximumAllowedDrift: 100,\n enableBackgroundSyncAfterSegmentDownloadError: true,\n defaultTimingSource: {\n scheme: \'urn:mpeg:dash:utc:http-xsdate:2014\',\n value: \'https://time.akamai.com/?iso&ms\'\n }\n },\n scheduling: {\n defaultTimeout: 500,\n lowLatencyTimeout: 0,\n scheduleWhilePaused: true\n },\n text: {\n defaultEnabled: true\n },\n liveCatchup: {\n minDrift: 0.02,\n maxDrift: 12,\n playbackRate: 0.5,\n latencyThreshold: 60,\n playbackBufferMin: 0.5,\n enabled: false,\n mode: _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_3__["default"].LIVE_CATCHUP_MODE_DEFAULT\n },\n lastBitrateCachingInfo: {\n enabled: true,\n ttl: 360000\n },\n lastMediaSettingsCachingInfo: {\n enabled: true,\n ttl: 360000\n },\n cacheLoadThresholds: {\n video: 50,\n audio: 5\n },\n trackSwitchMode: {\n audio: _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_3__["default"].TRACK_SWITCH_MODE_ALWAYS_REPLACE,\n video: _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_3__["default"].TRACK_SWITCH_MODE_NEVER_REPLACE\n },\n selectionModeForInitialTrack: _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_3__["default"].TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY,\n fragmentRequestTimeout: 0,\n retryIntervals: (_retryIntervals = {}, _defineProperty(_retryIntervals, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].MPD_TYPE, 500), _defineProperty(_retryIntervals, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].XLINK_EXPANSION_TYPE, 500), _defineProperty(_retryIntervals, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].MEDIA_SEGMENT_TYPE, 1000), _defineProperty(_retryIntervals, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].INIT_SEGMENT_TYPE, 1000), _defineProperty(_retryIntervals, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].BITSTREAM_SWITCHING_SEGMENT_TYPE, 1000), _defineProperty(_retryIntervals, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].INDEX_SEGMENT_TYPE, 1000), _defineProperty(_retryIntervals, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].MSS_FRAGMENT_INFO_SEGMENT_TYPE, 1000), _defineProperty(_retryIntervals, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].LICENSE, 1000), _defineProperty(_retryIntervals, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].OTHER_TYPE, 1000), _defineProperty(_retryIntervals, "lowLatencyReductionFactor", 10), _retryIntervals),\n retryAttempts: (_retryAttempts = {}, _defineProperty(_retryAttempts, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].MPD_TYPE, 3), _defineProperty(_retryAttempts, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].XLINK_EXPANSION_TYPE, 1), _defineProperty(_retryAttempts, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].MEDIA_SEGMENT_TYPE, 3), _defineProperty(_retryAttempts, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].INIT_SEGMENT_TYPE, 3), _defineProperty(_retryAttempts, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].BITSTREAM_SWITCHING_SEGMENT_TYPE, 3), _defineProperty(_retryAttempts, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].INDEX_SEGMENT_TYPE, 3), _defineProperty(_retryAttempts, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].MSS_FRAGMENT_INFO_SEGMENT_TYPE, 3), _defineProperty(_retryAttempts, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].LICENSE, 3), _defineProperty(_retryAttempts, _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_4__["HTTPRequest"].OTHER_TYPE, 3), _defineProperty(_retryAttempts, "lowLatencyMultiplyFactor", 5), _retryAttempts),\n abr: {\n movingAverageMethod: _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_3__["default"].MOVING_AVERAGE_SLIDING_WINDOW,\n ABRStrategy: _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_3__["default"].ABR_STRATEGY_DYNAMIC,\n additionalAbrRules: {\n insufficientBufferRule: true,\n switchHistoryRule: true,\n droppedFramesRule: true,\n abandonRequestsRule: false\n },\n bandwidthSafetyFactor: 0.9,\n useDefaultABRRules: true,\n useDeadTimeLatency: true,\n limitBitrateByPortal: false,\n usePixelRatioInLimitBitrateByPortal: false,\n maxBitrate: {\n audio: -1,\n video: -1\n },\n minBitrate: {\n audio: -1,\n video: -1\n },\n maxRepresentationRatio: {\n audio: 1,\n video: 1\n },\n initialBitrate: {\n audio: -1,\n video: -1\n },\n initialRepresentationRatio: {\n audio: -1,\n video: -1\n },\n autoSwitchBitrate: {\n audio: true,\n video: true\n },\n fetchThroughputCalculationMode: _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_3__["default"].ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING\n },\n cmcd: {\n enabled: false,\n sid: null,\n cid: null,\n rtp: null,\n rtpSafetyFactor: 5,\n mode: _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_3__["default"].CMCD_MODE_QUERY\n }\n },\n errors: {\n recoverAttempts: {\n mediaErrorDecode: 5\n }\n }\n };\n var settings = _Utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].clone(defaultSettings); //Merge in the settings. If something exists in the new config that doesn\'t match the schema of the default config,\n //regard it as an error and log it.\n\n function mixinSettings(source, dest, path) {\n for (var n in source) {\n if (source.hasOwnProperty(n)) {\n if (dest.hasOwnProperty(n)) {\n if (_typeof(source[n]) === \'object\' && source[n] !== null) {\n mixinSettings(source[n], dest[n], path.slice() + n + \'.\');\n } else {\n dest[n] = _Utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].clone(source[n]);\n }\n }\n }\n }\n }\n /**\n * Return the settings object. Don\'t copy/store this object, you won\'t get updates.\n * @func\n * @instance\n */\n\n\n function get() {\n return settings;\n }\n /**\n * @func\n * @instance\n * @param {object} settingsObj - This should be a partial object of the Settings.Schema type. That is, fields defined should match the path (e.g.\n * settingsObj.streaming.abr.autoSwitchBitrate.audio -> defaultSettings.streaming.abr.autoSwitchBitrate.audio). Where an element\'s path does\n * not match it is ignored, and a warning is logged.\n *\n * Use to change the settings object. Any new values defined will overwrite the settings and anything undefined will not change.\n * Implementers of new settings should add it in an approriate namespace to the defaultSettings object and give it a default value (that is not undefined).\n *\n */\n\n\n function update(settingsObj) {\n if (_typeof(settingsObj) === \'object\') {\n mixinSettings(settingsObj, settings, \'\');\n }\n }\n /**\n * Resets the settings object. Everything is set to its default value.\n * @func\n * @instance\n *\n */\n\n\n function reset() {\n settings = _Utils_js__WEBPACK_IMPORTED_MODULE_1__["default"].clone(defaultSettings);\n }\n\n instance = {\n get: get,\n update: update,\n reset: reset\n };\n return instance;\n}\n\nSettings.__dashjs_factory_name = \'Settings\';\nvar factory = _FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(Settings);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/core/Utils.js":\n/*!***************************!*\\\n !*** ./src/core/Utils.js ***!\n \\***************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_592804__) {\n__nested_webpack_require_592804__.r(__nested_webpack_exports__);\n/* harmony import */ var path_browserify__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_592804__(/*! path-browserify */ "./node_modules/path-browserify/index.js");\n/* harmony import */ var path_browserify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_592804__.n(path_browserify__WEBPACK_IMPORTED_MODULE_0__);\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\n\n\nvar Utils = /*#__PURE__*/function () {\n function Utils() {\n _classCallCheck(this, Utils);\n }\n\n _createClass(Utils, null, [{\n key: "mixin",\n value: function mixin(dest, source, copy) {\n var s;\n var empty = {};\n\n if (dest) {\n for (var name in source) {\n if (source.hasOwnProperty(name)) {\n s = source[name];\n\n if (!(name in dest) || dest[name] !== s && (!(name in empty) || empty[name] !== s)) {\n if (_typeof(dest[name]) === \'object\' && dest[name] !== null) {\n dest[name] = Utils.mixin(dest[name], s, copy);\n } else {\n dest[name] = copy(s);\n }\n }\n }\n }\n }\n\n return dest;\n }\n }, {\n key: "clone",\n value: function clone(src) {\n if (!src || _typeof(src) !== \'object\') {\n return src; // anything\n }\n\n var r;\n\n if (src instanceof Array) {\n // array\n r = [];\n\n for (var i = 0, l = src.length; i < l; ++i) {\n if (i in src) {\n r.push(Utils.clone(src[i]));\n }\n }\n } else {\n r = {};\n }\n\n return Utils.mixin(r, src, Utils.clone);\n }\n }, {\n key: "addAditionalQueryParameterToUrl",\n value: function addAditionalQueryParameterToUrl(url, params) {\n try {\n if (!params || params.length === 0) {\n return url;\n }\n\n var modifiedUrl = new URL(url);\n params.forEach(function (param) {\n if (param.key && param.value) {\n modifiedUrl.searchParams.set(param.key, param.value);\n }\n });\n return modifiedUrl.href;\n } catch (e) {\n return url;\n }\n }\n }, {\n key: "parseHttpHeaders",\n value: function parseHttpHeaders(headerStr) {\n var headers = {};\n\n if (!headerStr) {\n return headers;\n } // Trim headerStr to fix a MS Edge bug with xhr.getAllResponseHeaders method\n // which send a string starting with a "\\n" character\n\n\n var headerPairs = headerStr.trim().split("\\r\\n");\n\n for (var i = 0, ilen = headerPairs.length; i < ilen; i++) {\n var headerPair = headerPairs[i];\n var index = headerPair.indexOf(": ");\n\n if (index > 0) {\n headers[headerPair.substring(0, index)] = headerPair.substring(index + 2);\n }\n }\n\n return headers;\n }\n }, {\n key: "generateUuid",\n value: function generateUuid() {\n var dt = new Date().getTime();\n var uuid = \'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\'.replace(/[xy]/g, function (c) {\n var r = (dt + Math.random() * 16) % 16 | 0;\n dt = Math.floor(dt / 16);\n return (c == \'x\' ? r : r & 0x3 | 0x8).toString(16);\n });\n return uuid;\n }\n }, {\n key: "generateHashCode",\n value: function generateHashCode(string) {\n var hash = 0;\n\n if (string.length === 0) {\n return hash;\n }\n\n for (var i = 0; i < string.length; i++) {\n var chr = string.charCodeAt(i);\n hash = (hash << 5) - hash + chr;\n hash |= 0;\n }\n\n return hash;\n }\n /**\n * Compares both urls and returns a relative url (target relative to original)\n * @param {string} original\n * @param {string} target\n * @return {string|*}\n */\n\n }, {\n key: "getRelativeUrl",\n value: function getRelativeUrl(originalUrl, targetUrl) {\n try {\n var original = new URL(originalUrl);\n var target = new URL(targetUrl); // Unify the protocol to compare the origins\n\n original.protocol = target.protocol;\n\n if (original.origin !== target.origin) {\n return targetUrl;\n } // Use the relative path implementation of the path library. We need to cut off the actual filename in the end to get the relative path\n\n\n var relativePath = path_browserify__WEBPACK_IMPORTED_MODULE_0___default.a.relative(original.pathname.substr(0, original.pathname.lastIndexOf(\'/\')), target.pathname.substr(0, target.pathname.lastIndexOf(\'/\'))); // In case the relative path is empty (both path are equal) return the filename only. Otherwise add a slash in front of the filename\n\n var startIndexOffset = relativePath.length === 0 ? 1 : 0;\n relativePath += target.pathname.substr(target.pathname.lastIndexOf(\'/\') + startIndexOffset, target.pathname.length - 1); // Build the other candidate, e.g. the \'host relative\' path that starts with "/", and return the shortest of the two candidates.\n\n if (target.pathname.length < relativePath.length) {\n return target.pathname;\n }\n\n return relativePath;\n } catch (e) {\n return targetUrl;\n }\n }\n }]);\n\n return Utils;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (Utils);\n\n/***/ }),\n\n/***/ "./src/core/Version.js":\n/*!*****************************!*\\\n !*** ./src/core/Version.js ***!\n \\*****************************/\n/*! exports provided: getVersionString */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_601151__) {\n__nested_webpack_require_601151__.r(__nested_webpack_exports__);\n/* harmony export (binding) */ __nested_webpack_require_601151__.d(__nested_webpack_exports__, "getVersionString", function() { return getVersionString; });\nvar VERSION = \'4.2.0\';\nfunction getVersionString() {\n return VERSION;\n}\n\n/***/ }),\n\n/***/ "./src/core/errors/Errors.js":\n/*!***********************************!*\\\n !*** ./src/core/errors/Errors.js ***!\n \\***********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_601676__) {\n__nested_webpack_require_601676__.r(__nested_webpack_exports__);\n/* harmony import */ var _ErrorsBase__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_601676__(/*! ./ErrorsBase */ "./src/core/errors/ErrorsBase.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Errors declaration\n * @class\n */\n\nvar Errors = /*#__PURE__*/function (_ErrorsBase) {\n _inherits(Errors, _ErrorsBase);\n\n var _super = _createSuper(Errors);\n\n function Errors() {\n var _this;\n\n _classCallCheck(this, Errors);\n\n _this = _super.call(this);\n /**\n * Error code returned when a manifest parsing error occurs\n */\n\n _this.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE = 10;\n /**\n * Error code returned when a manifest loading error occurs\n */\n\n _this.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE = 11;\n /**\n * Error code returned when a xlink loading error occurs\n */\n\n _this.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE = 12;\n /**\n * Error code returned when no segment ranges could be determined from the sidx box\n */\n\n _this.SEGMENT_BASE_LOADER_ERROR_CODE = 15;\n /**\n * Error code returned when the time synchronization failed\n */\n\n _this.TIME_SYNC_FAILED_ERROR_CODE = 16;\n /**\n * Error code returned when loading a fragment failed\n */\n\n _this.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE = 17;\n /**\n * Error code returned when the FragmentLoader did not receive a request object\n */\n\n _this.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE = 18;\n /**\n * Error code returned when the BaseUrl resolution failed\n */\n\n _this.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE = 19;\n /**\n * Error code returned when the append operation in the SourceBuffer failed\n */\n\n _this.APPEND_ERROR_CODE = 20;\n /**\n * Error code returned when the remove operation in the SourceBuffer failed\n */\n\n _this.REMOVE_ERROR_CODE = 21;\n /**\n * Error code returned when updating the internal objects after loading an MPD failed\n */\n\n _this.DATA_UPDATE_FAILED_ERROR_CODE = 22;\n /**\n * Error code returned when MediaSource is not supported by the browser\n */\n\n _this.CAPABILITY_MEDIASOURCE_ERROR_CODE = 23;\n /**\n * Error code returned when Protected contents are not supported\n */\n\n _this.CAPABILITY_MEDIAKEYS_ERROR_CODE = 24;\n /**\n * Error code returned when loading the manifest failed\n */\n\n _this.DOWNLOAD_ERROR_ID_MANIFEST_CODE = 25;\n /**\n * Error code returned when loading the sidx failed\n */\n\n _this.DOWNLOAD_ERROR_ID_SIDX_CODE = 26;\n /**\n * Error code returned when loading the media content failed\n */\n\n _this.DOWNLOAD_ERROR_ID_CONTENT_CODE = 27;\n /**\n * Error code returned when loading the init segment failed\n */\n\n _this.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE = 28;\n /**\n * Error code returned when loading the XLink content failed\n */\n\n _this.DOWNLOAD_ERROR_ID_XLINK_CODE = 29;\n /**\n * Error code returned when parsing the MPD resulted in a logical error\n */\n\n _this.MANIFEST_ERROR_ID_PARSE_CODE = 31;\n /**\n * Error code returned when no stream (period) has been detected in the manifest\n */\n\n _this.MANIFEST_ERROR_ID_NOSTREAMS_CODE = 32;\n /**\n * Error code returned when something wrong has happened during parsing and appending subtitles (TTML or VTT)\n */\n\n _this.TIMED_TEXT_ERROR_ID_PARSE_CODE = 33;\n /**\n * Error code returned when a \'muxed\' media type has been detected in the manifest. This type is not supported\n */\n\n _this.MANIFEST_ERROR_ID_MULTIPLEXED_CODE = 34;\n /**\n * Error code returned when a media source type is not supported\n */\n\n _this.MEDIASOURCE_TYPE_UNSUPPORTED_CODE = 35;\n _this.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE = \'parsing failed for \';\n _this.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE = \'Failed loading manifest: \';\n _this.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE = \'Failed loading Xlink element: \';\n _this.SEGMENTS_UPDATE_FAILED_ERROR_MESSAGE = \'Segments update failed\';\n _this.SEGMENTS_UNAVAILABLE_ERROR_MESSAGE = \'no segments are available yet\';\n _this.SEGMENT_BASE_LOADER_ERROR_MESSAGE = \'error loading segment ranges from sidx\';\n _this.TIME_SYNC_FAILED_ERROR_MESSAGE = \'Failed to synchronize client and server time\';\n _this.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE = \'request is null\';\n _this.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE = \'Failed to resolve a valid URL\';\n _this.APPEND_ERROR_MESSAGE = \'chunk is not defined\';\n _this.REMOVE_ERROR_MESSAGE = \'Removing data from the SourceBuffer\';\n _this.DATA_UPDATE_FAILED_ERROR_MESSAGE = \'Data update failed\';\n _this.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE = \'mediasource is not supported\';\n _this.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE = \'mediakeys is not supported\';\n _this.TIMED_TEXT_ERROR_MESSAGE_PARSE = \'parsing error :\';\n _this.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE = \'Error creating source buffer of type : \';\n return _this;\n }\n\n return Errors;\n}(_ErrorsBase__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\nvar errors = new Errors();\n/* harmony default export */ __nested_webpack_exports__["default"] = (errors);\n\n/***/ }),\n\n/***/ "./src/core/errors/ErrorsBase.js":\n/*!***************************************!*\\\n !*** ./src/core/errors/ErrorsBase.js ***!\n \\***************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_611350__) {\n__nested_webpack_require_611350__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar ErrorsBase = /*#__PURE__*/function () {\n function ErrorsBase() {\n _classCallCheck(this, ErrorsBase);\n }\n\n _createClass(ErrorsBase, [{\n key: "extend",\n value: function extend(errors, config) {\n if (!errors) return;\n var override = config ? config.override : false;\n var publicOnly = config ? config.publicOnly : false;\n\n for (var err in errors) {\n if (!errors.hasOwnProperty(err) || this[err] && !override) continue;\n if (publicOnly && errors[err].indexOf(\'public_\') === -1) continue;\n this[err] = errors[err];\n }\n }\n }]);\n\n return ErrorsBase;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (ErrorsBase);\n\n/***/ }),\n\n/***/ "./src/core/events/CoreEvents.js":\n/*!***************************************!*\\\n !*** ./src/core/events/CoreEvents.js ***!\n \\***************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_614929__) {\n__nested_webpack_require_614929__.r(__nested_webpack_exports__);\n/* harmony import */ var _EventsBase__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_614929__(/*! ./EventsBase */ "./src/core/events/EventsBase.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * These are internal events that should not be needed at the player level.\n * If you find and event in here that you would like access to from MediaPlayer level\n * please add an issue at https://github.com/Dash-Industry-Forum/dash.js/issues/new\n * @class\n * @ignore\n */\n\nvar CoreEvents = /*#__PURE__*/function (_EventsBase) {\n _inherits(CoreEvents, _EventsBase);\n\n var _super = _createSuper(CoreEvents);\n\n function CoreEvents() {\n var _this;\n\n _classCallCheck(this, CoreEvents);\n\n _this = _super.call(this);\n _this.ATTEMPT_BACKGROUND_SYNC = \'attemptBackgroundSync\';\n _this.BUFFERING_COMPLETED = \'bufferingCompleted\';\n _this.BUFFER_CLEARED = \'bufferCleared\';\n _this.BYTES_APPENDED_END_FRAGMENT = \'bytesAppendedEndFragment\';\n _this.BUFFER_REPLACEMENT_STARTED = \'bufferReplacementStarted\';\n _this.CHECK_FOR_EXISTENCE_COMPLETED = \'checkForExistenceCompleted\';\n _this.CURRENT_TRACK_CHANGED = \'currentTrackChanged\';\n _this.DATA_UPDATE_COMPLETED = \'dataUpdateCompleted\';\n _this.INBAND_EVENTS = \'inbandEvents\';\n _this.INITIAL_STREAM_SWITCH = \'initialStreamSwitch\';\n _this.INIT_FRAGMENT_LOADED = \'initFragmentLoaded\';\n _this.INIT_FRAGMENT_NEEDED = \'initFragmentNeeded\';\n _this.INTERNAL_MANIFEST_LOADED = \'internalManifestLoaded\';\n _this.ORIGINAL_MANIFEST_LOADED = \'originalManifestLoaded\';\n _this.LOADING_COMPLETED = \'loadingCompleted\';\n _this.LOADING_PROGRESS = \'loadingProgress\';\n _this.LOADING_DATA_PROGRESS = \'loadingDataProgress\';\n _this.LOADING_ABANDONED = \'loadingAborted\';\n _this.MANIFEST_UPDATED = \'manifestUpdated\';\n _this.MEDIA_FRAGMENT_LOADED = \'mediaFragmentLoaded\';\n _this.MEDIA_FRAGMENT_NEEDED = \'mediaFragmentNeeded\';\n _this.QUOTA_EXCEEDED = \'quotaExceeded\';\n _this.SEGMENT_LOCATION_BLACKLIST_ADD = \'segmentLocationBlacklistAdd\';\n _this.SEGMENT_LOCATION_BLACKLIST_CHANGED = \'segmentLocationBlacklistChanged\';\n _this.SERVICE_LOCATION_BLACKLIST_ADD = \'serviceLocationBlacklistAdd\';\n _this.SERVICE_LOCATION_BLACKLIST_CHANGED = \'serviceLocationBlacklistChanged\';\n _this.SET_FRAGMENTED_TEXT_AFTER_DISABLED = \'setFragmentedTextAfterDisabled\';\n _this.SET_NON_FRAGMENTED_TEXT = \'setNonFragmentedText\';\n _this.SOURCE_BUFFER_ERROR = \'sourceBufferError\';\n _this.STREAMS_COMPOSED = \'streamsComposed\';\n _this.STREAM_BUFFERING_COMPLETED = \'streamBufferingCompleted\';\n _this.STREAM_REQUESTING_COMPLETED = \'streamRequestingCompleted\';\n _this.TEXT_TRACKS_QUEUE_INITIALIZED = \'textTracksQueueInitialized\';\n _this.TIME_SYNCHRONIZATION_COMPLETED = \'timeSynchronizationComplete\';\n _this.UPDATE_TIME_SYNC_OFFSET = \'updateTimeSyncOffset\';\n _this.URL_RESOLUTION_FAILED = \'urlResolutionFailed\';\n _this.VIDEO_CHUNK_RECEIVED = \'videoChunkReceived\';\n _this.WALLCLOCK_TIME_UPDATED = \'wallclockTimeUpdated\';\n _this.XLINK_ELEMENT_LOADED = \'xlinkElementLoaded\';\n _this.XLINK_READY = \'xlinkReady\';\n _this.SEEK_TARGET = \'seekTarget\';\n return _this;\n }\n\n return CoreEvents;\n}(_EventsBase__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (CoreEvents);\n\n/***/ }),\n\n/***/ "./src/core/events/Events.js":\n/*!***********************************!*\\\n !*** ./src/core/events/Events.js ***!\n \\***********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_622754__) {\n__nested_webpack_require_622754__.r(__nested_webpack_exports__);\n/* harmony import */ var _CoreEvents__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_622754__(/*! ./CoreEvents */ "./src/core/events/CoreEvents.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\n\n\nvar Events = /*#__PURE__*/function (_CoreEvents) {\n _inherits(Events, _CoreEvents);\n\n var _super = _createSuper(Events);\n\n function Events() {\n _classCallCheck(this, Events);\n\n return _super.apply(this, arguments);\n }\n\n return Events;\n}(_CoreEvents__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\nvar events = new Events();\n/* harmony default export */ __nested_webpack_exports__["default"] = (events);\n\n/***/ }),\n\n/***/ "./src/core/events/EventsBase.js":\n/*!***************************************!*\\\n !*** ./src/core/events/EventsBase.js ***!\n \\***************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_627904__) {\n__nested_webpack_require_627904__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar EventsBase = /*#__PURE__*/function () {\n function EventsBase() {\n _classCallCheck(this, EventsBase);\n }\n\n _createClass(EventsBase, [{\n key: "extend",\n value: function extend(events, config) {\n if (!events) return;\n var override = config ? config.override : false;\n var publicOnly = config ? config.publicOnly : false;\n\n for (var evt in events) {\n if (!events.hasOwnProperty(evt) || this[evt] && !override) continue;\n if (publicOnly && events[evt].indexOf(\'public_\') === -1) continue;\n this[evt] = events[evt];\n }\n }\n }]);\n\n return EventsBase;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (EventsBase);\n\n/***/ }),\n\n/***/ "./src/dash/DashAdapter.js":\n/*!*********************************!*\\\n !*** ./src/dash/DashAdapter.js ***!\n \\*********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_631459__) {\n__nested_webpack_require_631459__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_631459__(/*! ./constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/* harmony import */ var _vo_RepresentationInfo__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_631459__(/*! ./vo/RepresentationInfo */ "./src/dash/vo/RepresentationInfo.js");\n/* harmony import */ var _vo_MediaInfo__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_631459__(/*! ./vo/MediaInfo */ "./src/dash/vo/MediaInfo.js");\n/* harmony import */ var _vo_StreamInfo__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_631459__(/*! ./vo/StreamInfo */ "./src/dash/vo/StreamInfo.js");\n/* harmony import */ var _vo_ManifestInfo__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_631459__(/*! ./vo/ManifestInfo */ "./src/dash/vo/ManifestInfo.js");\n/* harmony import */ var _vo_Event__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_631459__(/*! ./vo/Event */ "./src/dash/vo/Event.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_631459__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _models_DashManifestModel__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_631459__(/*! ./models/DashManifestModel */ "./src/dash/models/DashManifestModel.js");\n/* harmony import */ var _models_PatchManifestModel__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_631459__(/*! ./models/PatchManifestModel */ "./src/dash/models/PatchManifestModel.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n/**\n * @module DashAdapter\n * @description The DashAdapter module can be accessed using the MediaPlayer API getDashAdapter()\n */\n\nfunction DashAdapter() {\n var instance, dashManifestModel, patchManifestModel, voPeriods, currentMediaInfo, constants, cea608parser;\n var context = this.context;\n var PROFILE_DVB = \'urn:dvb:dash:profile:dvb-dash:2014\';\n\n function setup() {\n dashManifestModel = Object(_models_DashManifestModel__WEBPACK_IMPORTED_MODULE_7__["default"])(context).getInstance();\n patchManifestModel = Object(_models_PatchManifestModel__WEBPACK_IMPORTED_MODULE_8__["default"])(context).getInstance();\n reset();\n } // #region PUBLIC FUNCTIONS\n // --------------------------------------------------\n\n\n function setConfig(config) {\n if (!config) return;\n\n if (config.constants) {\n constants = config.constants;\n }\n\n if (config.cea608parser) {\n cea608parser = config.cea608parser;\n }\n\n if (config.errHandler) {\n dashManifestModel.setConfig({\n errHandler: config.errHandler\n });\n }\n\n if (config.BASE64) {\n dashManifestModel.setConfig({\n BASE64: config.BASE64\n });\n }\n }\n /**\n * Creates an instance of RepresentationInfo based on a representation value object\n * @param {object} voRepresentation\n * @returns {RepresentationInfo|null} representationInfo\n * @memberOf module:DashAdapter\n * @instance\n * @ignore\n */\n\n\n function convertRepresentationToRepresentationInfo(voRepresentation) {\n if (voRepresentation) {\n var representationInfo = new _vo_RepresentationInfo__WEBPACK_IMPORTED_MODULE_1__["default"]();\n var realAdaptation = voRepresentation.adaptation.period.mpd.manifest.Period_asArray[voRepresentation.adaptation.period.index].AdaptationSet_asArray[voRepresentation.adaptation.index];\n var realRepresentation = dashManifestModel.getRepresentationFor(voRepresentation.index, realAdaptation);\n representationInfo.id = voRepresentation.id;\n representationInfo.quality = voRepresentation.index;\n representationInfo.bandwidth = dashManifestModel.getBandwidth(realRepresentation);\n representationInfo.fragmentDuration = voRepresentation.segmentDuration || (voRepresentation.segments && voRepresentation.segments.length > 0 ? voRepresentation.segments[0].duration : NaN);\n representationInfo.MSETimeOffset = voRepresentation.MSETimeOffset;\n representationInfo.mediaInfo = convertAdaptationToMediaInfo(voRepresentation.adaptation);\n return representationInfo;\n } else {\n return null;\n }\n }\n /**\n * Returns a MediaInfo object for a given media type and the corresponding streamInfo.\n * @param {object} streamInfo\n * @param {MediaType }type\n * @returns {null|MediaInfo} mediaInfo\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getMediaInfoForType(streamInfo, type) {\n if (voPeriods.length === 0 || !streamInfo) {\n return null;\n }\n\n var selectedVoPeriod = getPeriodForStreamInfo(streamInfo, voPeriods);\n if (!selectedVoPeriod) return null;\n var voAdaptations = dashManifestModel.getAdaptationsForPeriod(selectedVoPeriod);\n var realAdaptation = getAdaptationForType(streamInfo.index, type, streamInfo);\n if (!realAdaptation) return null;\n var idx = dashManifestModel.getIndexForAdaptation(realAdaptation, voPeriods[0].mpd.manifest, streamInfo.index);\n return convertAdaptationToMediaInfo(voAdaptations[idx]);\n }\n /**\n * Checks if the role of the specified AdaptationSet is set to main\n * @param {object} adaptation\n * @returns {boolean}\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getIsMain(adaptation) {\n return dashManifestModel.getRolesForAdaptation(adaptation).filter(function (role) {\n return role.value === _constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__["default"].MAIN;\n })[0];\n }\n /**\n * Returns the AdaptationSet for a given period index and a given mediaType.\n * @param {number} periodIndex\n * @param {MediaType} type\n * @param {object} streamInfo\n * @returns {null|object} adaptation\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getAdaptationForType(periodIndex, type, streamInfo) {\n var adaptations = dashManifestModel.getAdaptationsForType(voPeriods[0].mpd.manifest, periodIndex, type);\n if (!adaptations || adaptations.length === 0) return null;\n\n if (adaptations.length > 1 && streamInfo) {\n var allMediaInfoForType = getAllMediaInfoForType(streamInfo, type);\n\n if (currentMediaInfo[streamInfo.id] && currentMediaInfo[streamInfo.id][type]) {\n for (var i = 0, ln = adaptations.length; i < ln; i++) {\n if (areMediaInfosEqual(currentMediaInfo[streamInfo.id][type], allMediaInfoForType[i])) {\n return adaptations[i];\n }\n }\n }\n\n for (var _i = 0, _ln = adaptations.length; _i < _ln; _i++) {\n if (getIsMain(adaptations[_i])) {\n return adaptations[_i];\n }\n }\n }\n\n return adaptations[0];\n }\n /**\n * Compares two mediaInfo objects\n * @param {MediaInfo} mInfoOne\n * @param {MediaInfo} mInfoTwo\n * @returns {boolean}\n */\n\n\n function areMediaInfosEqual(mInfoOne, mInfoTwo) {\n if (!mInfoOne || !mInfoTwo) {\n return false;\n }\n\n var sameId = mInfoOne.id === mInfoTwo.id;\n var sameCodec = mInfoOne.codec === mInfoTwo.codec;\n var sameViewpoint = mInfoOne.viewpoint === mInfoTwo.viewpoint;\n var sameLang = mInfoOne.lang === mInfoTwo.lang;\n var sameRoles = mInfoOne.roles.toString() === mInfoTwo.roles.toString();\n var sameAccessibility = mInfoOne.accessibility.toString() === mInfoTwo.accessibility.toString();\n var sameAudioChannelConfiguration = mInfoOne.audioChannelConfiguration.toString() === mInfoTwo.audioChannelConfiguration.toString();\n return sameId && sameCodec && sameViewpoint && sameLang && sameRoles && sameAccessibility && sameAudioChannelConfiguration;\n }\n\n function _getAllMediaInfo(manifest, period, streamInfo, adaptations, type, embeddedText) {\n var mediaArr = [];\n var data, media, idx, i, j, ln;\n\n if (!adaptations || adaptations.length === 0) {\n return [];\n }\n\n var voAdaptations = dashManifestModel.getAdaptationsForPeriod(period);\n\n for (i = 0, ln = adaptations.length; i < ln; i++) {\n data = adaptations[i];\n idx = dashManifestModel.getIndexForAdaptation(data, manifest, streamInfo.index);\n media = convertAdaptationToMediaInfo(voAdaptations[idx]);\n\n if (embeddedText) {\n var accessibilityLength = media.accessibility.length;\n\n for (j = 0; j < accessibilityLength; j++) {\n if (!media) {\n continue;\n }\n\n var accessibility = media.accessibility[j];\n\n if (accessibility.indexOf(\'cea-608:\') === 0) {\n var value = accessibility.substring(8);\n var parts = value.split(\';\');\n\n if (parts[0].substring(0, 2) === \'CC\') {\n for (j = 0; j < parts.length; j++) {\n if (!media) {\n media = convertAdaptationToMediaInfo.call(this, voAdaptations[idx]);\n }\n\n convertVideoInfoToEmbeddedTextInfo(media, parts[j].substring(0, 3), parts[j].substring(4));\n mediaArr.push(media);\n media = null;\n }\n } else {\n for (j = 0; j < parts.length; j++) {\n // Only languages for CC1, CC2, ...\n if (!media) {\n media = convertAdaptationToMediaInfo.call(this, voAdaptations[idx]);\n }\n\n convertVideoInfoToEmbeddedTextInfo(media, \'CC\' + (j + 1), parts[j]);\n mediaArr.push(media);\n media = null;\n }\n }\n } else if (accessibility.indexOf(\'cea-608\') === 0) {\n // Nothing known. We interpret it as CC1=eng\n convertVideoInfoToEmbeddedTextInfo(media, constants.CC1, \'eng\');\n mediaArr.push(media);\n media = null;\n }\n }\n } else if (type === constants.IMAGE) {\n convertVideoInfoToThumbnailInfo(media);\n mediaArr.push(media);\n media = null;\n } else if (media) {\n mediaArr.push(media);\n }\n }\n\n return mediaArr;\n }\n /**\n * Returns all the mediaInfos for a given mediaType and the corresponding streamInfo.\n * @param {object} streamInfo\n * @param {MediaType} type\n * @param {object} externalManifest Set to null or undefined if no external manifest is to be used\n * @returns {Array} mediaArr\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getAllMediaInfoForType(streamInfo, type, externalManifest) {\n var voLocalPeriods = voPeriods;\n var manifest = externalManifest;\n var mediaArr = [];\n\n if (manifest) {\n checkConfig();\n voLocalPeriods = getRegularPeriods(manifest);\n } else {\n if (voPeriods.length > 0) {\n manifest = voPeriods[0].mpd.manifest;\n } else {\n return mediaArr;\n }\n }\n\n var selectedVoPeriod = getPeriodForStreamInfo(streamInfo, voLocalPeriods);\n var adaptationsForType = dashManifestModel.getAdaptationsForType(manifest, streamInfo ? streamInfo.index : null, type);\n mediaArr = _getAllMediaInfo(manifest, selectedVoPeriod, streamInfo, adaptationsForType, type); // Search for embedded text in video track\n\n if (type === constants.TEXT) {\n adaptationsForType = dashManifestModel.getAdaptationsForType(manifest, streamInfo ? streamInfo.index : null, constants.VIDEO);\n mediaArr = mediaArr.concat(_getAllMediaInfo(manifest, selectedVoPeriod, streamInfo, adaptationsForType, type, true));\n }\n\n return mediaArr;\n }\n /**\n * Update the internal voPeriods array with the information from the new manifest\n * @param {object} newManifest\n * @returns {*}\n * @memberOf module:DashAdapter\n * @instance\n * @ignore\n */\n\n\n function updatePeriods(newManifest) {\n if (!newManifest) return null;\n checkConfig();\n voPeriods = getRegularPeriods(newManifest);\n }\n /**\n * Returns an array of streamInfo objects\n * @param {object} externalManifest\n * @param {number} maxStreamsInfo\n * @returns {Array} streams\n * @memberOf module:DashAdapter\n * @instance\n * @ignore\n */\n\n\n function getStreamsInfo(externalManifest, maxStreamsInfo) {\n var streams = [];\n var voLocalPeriods = voPeriods; //if manifest is defined, getStreamsInfo is for an outside manifest, not the current one\n\n if (externalManifest) {\n checkConfig();\n voLocalPeriods = getRegularPeriods(externalManifest);\n }\n\n if (voLocalPeriods.length > 0) {\n if (!maxStreamsInfo || maxStreamsInfo > voLocalPeriods.length) {\n maxStreamsInfo = voLocalPeriods.length;\n }\n\n for (var i = 0; i < maxStreamsInfo; i++) {\n streams.push(convertPeriodToStreamInfo(voLocalPeriods[i]));\n }\n }\n\n return streams;\n }\n /**\n * Returns the AdaptationSet as saved in the DashManifestModel\n * @param {object} streamInfo\n * @param {object} mediaInfo\n * @returns {object} realAdaptation\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getRealAdaptation(streamInfo, mediaInfo) {\n var id, realAdaptation;\n var selectedVoPeriod = getPeriodForStreamInfo(streamInfo, voPeriods);\n id = mediaInfo ? mediaInfo.id : null;\n\n if (voPeriods.length > 0 && selectedVoPeriod) {\n realAdaptation = id ? dashManifestModel.getAdaptationForId(id, voPeriods[0].mpd.manifest, selectedVoPeriod.index) : dashManifestModel.getAdaptationForIndex(mediaInfo ? mediaInfo.index : null, voPeriods[0].mpd.manifest, selectedVoPeriod.index);\n }\n\n return realAdaptation;\n }\n /**\n * Return all EssentialProperties of a Representation\n * @param {object} representation\n * @return {array}\n */\n\n\n function getEssentialPropertiesForRepresentation(representation) {\n try {\n return dashManifestModel.getEssentialPropertiesForRepresentation(representation);\n } catch (e) {\n return [];\n }\n }\n /**\n * Returns the period as defined in the DashManifestModel for a given index\n * @param {number} index\n * @return {object}\n */\n\n\n function getRealPeriodByIndex(index) {\n return dashManifestModel.getRealPeriodForIndex(index, voPeriods[0].mpd.manifest);\n }\n /**\n * Returns all voRepresentations for a given mediaInfo\n * @param {object} mediaInfo\n * @returns {Array} voReps\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getVoRepresentations(mediaInfo) {\n var voReps;\n var voAdaptation = getAdaptationForMediaInfo(mediaInfo);\n voReps = dashManifestModel.getRepresentationsForAdaptation(voAdaptation);\n return voReps;\n }\n /**\n * Returns the event for the given parameters.\n * @param {object} eventBox\n * @param {object} eventStreams\n * @param {number} mediaStartTime\n * @param {object} voRepresentation\n * @returns {null|Event}\n * @memberOf module:DashAdapter\n * @instance\n * @ignore\n */\n\n\n function getEvent(eventBox, eventStreams, mediaStartTime, voRepresentation) {\n try {\n if (!eventBox || !eventStreams || isNaN(mediaStartTime) || !voRepresentation) {\n return null;\n }\n\n var schemeIdUri = eventBox.scheme_id_uri;\n var value = eventBox.value;\n\n if (!eventStreams[schemeIdUri + \'/\' + value]) {\n return null;\n }\n\n var event = new _vo_Event__WEBPACK_IMPORTED_MODULE_5__["default"]();\n var timescale = eventBox.timescale || 1;\n var periodStart = voRepresentation.adaptation.period.start;\n var eventStream = eventStreams[schemeIdUri + \'/\' + value];\n var presentationTimeOffset = !isNaN(voRepresentation.presentationTimeOffset) ? voRepresentation.presentationTimeOffset : !isNaN(eventStream.presentationTimeOffset) ? eventStream.presentationTimeOffset : 0;\n var presentationTimeDelta = eventBox.presentation_time_delta / timescale; // In case of version 1 events the presentation_time is parsed as presentation_time_delta\n\n var calculatedPresentationTime;\n\n if (eventBox.version === 0) {\n calculatedPresentationTime = periodStart + mediaStartTime - presentationTimeOffset + presentationTimeDelta;\n } else {\n calculatedPresentationTime = periodStart - presentationTimeOffset + presentationTimeDelta;\n }\n\n var duration = eventBox.event_duration;\n var id = eventBox.id;\n var messageData = eventBox.message_data;\n event.eventStream = eventStream;\n event.eventStream.value = value;\n event.eventStream.timescale = timescale;\n event.duration = duration;\n event.id = id;\n event.calculatedPresentationTime = calculatedPresentationTime;\n event.messageData = messageData;\n event.presentationTimeDelta = presentationTimeDelta;\n return event;\n } catch (e) {\n return null;\n }\n }\n /**\n * Returns the events for the given info object. info can either be an instance of StreamInfo, MediaInfo or RepresentationInfo\n * @param {object} info\n * @param {object} voRepresentation\n * @returns {Array}\n * @memberOf module:DashAdapter\n * @instance\n * @ignore\n */\n\n\n function getEventsFor(info, voRepresentation) {\n var events = [];\n\n if (voPeriods.length > 0) {\n var manifest = voPeriods[0].mpd.manifest;\n\n if (info instanceof _vo_StreamInfo__WEBPACK_IMPORTED_MODULE_3__["default"]) {\n events = dashManifestModel.getEventsForPeriod(getPeriodForStreamInfo(info, voPeriods));\n } else if (info instanceof _vo_MediaInfo__WEBPACK_IMPORTED_MODULE_2__["default"]) {\n events = dashManifestModel.getEventStreamForAdaptationSet(manifest, getAdaptationForMediaInfo(info));\n } else if (info instanceof _vo_RepresentationInfo__WEBPACK_IMPORTED_MODULE_1__["default"]) {\n events = dashManifestModel.getEventStreamForRepresentation(manifest, voRepresentation);\n }\n }\n\n return events;\n }\n /**\n * Sets the current active mediaInfo for a given streamId and a given mediaType\n * @param {number} streamId\n * @param {MediaType} type\n * @param {object} mediaInfo\n * @memberOf module:DashAdapter\n * @instance\n * @ignore\n */\n\n\n function setCurrentMediaInfo(streamId, type, mediaInfo) {\n currentMediaInfo[streamId] = currentMediaInfo[streamId] || {};\n currentMediaInfo[streamId][type] = currentMediaInfo[streamId][type] || {};\n currentMediaInfo[streamId][type] = mediaInfo;\n }\n /**\n * Check if the given type is a text track\n * @param {object} adaptation\n * @returns {boolean}\n * @memberOf module:DashAdapter\n * @instance\n * @ignore\n */\n\n\n function getIsTextTrack(adaptation) {\n return dashManifestModel.getIsText(adaptation);\n }\n /**\n * Returns the UTC Timing Sources specified in the manifest\n * @returns {Array} utcTimingSources\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getUTCTimingSources() {\n var manifest = getManifest();\n return dashManifestModel.getUTCTimingSources(manifest);\n }\n /**\n * Returns the suggestedPresentationDelay as specified in the manifest\n * @returns {String} suggestedPresentationDelay\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getSuggestedPresentationDelay() {\n var mpd = voPeriods.length > 0 ? voPeriods[0].mpd : null;\n return dashManifestModel.getSuggestedPresentationDelay(mpd);\n }\n /**\n * Returns the availabilityStartTime as specified in the manifest\n * @param {object} externalManifest Omit this value if no external manifest should be used\n * @returns {string} availabilityStartTime\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getAvailabilityStartTime(externalManifest) {\n var mpd = getMpd(externalManifest);\n return dashManifestModel.getAvailabilityStartTime(mpd);\n }\n /**\n * Returns a boolean indicating if the manifest is dynamic or not\n * @param {object} externalManifest Omit this value if no external manifest should be used\n * @returns {boolean}\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getIsDynamic(externalManifest) {\n var manifest = getManifest(externalManifest);\n return dashManifestModel.getIsDynamic(manifest);\n }\n /**\n * Returns the duration of the MPD\n * @param {object} externalManifest Omit this value if no external manifest should be used\n * @returns {number} duration\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getDuration(externalManifest) {\n var manifest = getManifest(externalManifest);\n return dashManifestModel.getDuration(manifest);\n }\n /**\n * Returns all periods of the MPD\n * @param {object} externalManifest Omit this value if no external manifest should be used\n * @returns {Array} periods\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getRegularPeriods(externalManifest) {\n var mpd = getMpd(externalManifest);\n return dashManifestModel.getRegularPeriods(mpd);\n }\n /**\n * Returns an MPD object\n * @param {object} externalManifest Omit this value if no external manifest should be used\n * @returns {object} MPD\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getMpd(externalManifest) {\n var manifest = getManifest(externalManifest);\n return dashManifestModel.getMpd(manifest);\n }\n /**\n * Returns the location element of the MPD\n * @param {object} manifest\n * @returns {String} location\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getLocation(manifest) {\n return dashManifestModel.getLocation(manifest);\n }\n /**\n * Returns the manifest update period used for dynamic manifests\n * @param {object} manifest\n * @param {number} latencyOfLastUpdate\n * @returns {NaN|number} manifestUpdatePeriod\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getManifestUpdatePeriod(manifest) {\n var latencyOfLastUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n return dashManifestModel.getManifestUpdatePeriod(manifest, latencyOfLastUpdate);\n }\n /**\n * Returns the publish time from the manifest\n * @param {object} manifest\n * @returns {Date|null} publishTime\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getPublishTime(manifest) {\n return dashManifestModel.getPublishTime(manifest);\n }\n /**\n * Returns the patch location of the MPD if one exists and it is still valid\n * @param {object} manifest\n * @returns {(String|null)} patch location\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getPatchLocation(manifest) {\n var patchLocation = dashManifestModel.getPatchLocation(manifest);\n var publishTime = dashManifestModel.getPublishTime(manifest); // short-circuit when no patch location or publish time exists\n\n if (!patchLocation || !publishTime) {\n return null;\n } // if a ttl is provided, ensure patch location has not expired\n\n\n if (patchLocation.hasOwnProperty(\'ttl\') && publishTime) {\n // attribute describes number of seconds as a double\n var ttl = parseFloat(patchLocation.ttl) * 1000; // check if the patch location has expired, if so do not consider it\n\n if (publishTime.getTime() + ttl <= new Date().getTime()) {\n return null;\n }\n } // the patch location exists and, if a ttl applies, has not expired\n\n\n return patchLocation.__text;\n }\n /**\n * Checks if the manifest has a DVB profile\n * @param {object} manifest\n * @returns {boolean}\n * @memberOf module:DashAdapter\n * @instance\n * @ignore\n */\n\n\n function getIsDVB(manifest) {\n return dashManifestModel.hasProfile(manifest, PROFILE_DVB);\n }\n /**\n * Checks if the manifest is actually just a patch manifest\n * @param {object} manifest\n * @return {boolean}\n */\n\n\n function getIsPatch(manifest) {\n return patchManifestModel.getIsPatch(manifest);\n }\n /**\n * Returns the base urls for a given element\n * @param {object} node\n * @returns {Array}\n * @memberOf module:DashAdapter\n * @instance\n * @ignore\n */\n\n\n function getBaseURLsFromElement(node) {\n return dashManifestModel.getBaseURLsFromElement(node);\n }\n /**\n * Returns the function to sort the Representations\n * @returns {*}\n * @memberOf module:DashAdapter\n * @instance\n * @ignore\n */\n\n\n function getRepresentationSortFunction() {\n return dashManifestModel.getRepresentationSortFunction();\n }\n /**\n * Returns the codec for a given adaptation set and a given representation id.\n * @param {object} adaptation\n * @param {number} representationId\n * @param {boolean} addResolutionInfo Defines whether to include resolution information in the output\n * @returns {String} codec\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getCodec(adaptation, representationId, addResolutionInfo) {\n return dashManifestModel.getCodec(adaptation, representationId, addResolutionInfo);\n }\n /**\n * Returns the bandwidth for a given representation id and the corresponding period index\n * @param {number} representationId\n * @param {number} periodIdx\n * @returns {number} bandwidth\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getBandwidthForRepresentation(representationId, periodIdx) {\n var representation;\n var period = getPeriod(periodIdx);\n representation = findRepresentation(period, representationId);\n return representation ? representation.bandwidth : null;\n }\n /**\n * Returns the index for a given representation id\n * @param {string} representationId\n * @param {number} periodIdx\n * @returns {number} index\n * @memberOf module:DashAdapter\n * @instance\n */\n\n\n function getIndexForRepresentation(representationId, periodIdx) {\n var period = getPeriod(periodIdx);\n return findRepresentationIndex(period, representationId);\n }\n /**\n * This method returns the current max index based on what is defined in the MPD.\n * @param {string} bufferType - String \'audio\' or \'video\',\n * @param {number} periodIdx - Make sure this is the period index not id\n * @return {number}\n * @memberof module:DashAdapter\n * @instance\n */\n\n\n function getMaxIndexForBufferType(bufferType, periodIdx) {\n var period = getPeriod(periodIdx);\n return findMaxBufferIndex(period, bufferType);\n }\n /**\n * Returns the voPeriod object for a given id\n * @param {String} id\n * @returns {object|null}\n */\n\n\n function getPeriodById(id) {\n if (!id || voPeriods.length === 0) {\n return null;\n }\n\n var periods = voPeriods.filter(function (p) {\n return p.id === id;\n });\n\n if (periods && periods.length > 0) {\n return periods[0];\n }\n\n return null;\n }\n /**\n * Checks if the given AdaptationSet is from the given media type\n * @param {object} adaptation\n * @param {string} type\n * @return {boolean}\n */\n\n\n function getIsTypeOf(adaptation, type) {\n return dashManifestModel.getIsTypeOf(adaptation, type);\n }\n\n function reset() {\n voPeriods = [];\n currentMediaInfo = {};\n }\n /**\n * Checks if the supplied manifest is compatible for application of the supplied patch\n * @param {object} manifest\n * @param {object} patch\n * @return {boolean}\n */\n\n\n function isPatchValid(manifest, patch) {\n var manifestId = dashManifestModel.getId(manifest);\n var patchManifestId = patchManifestModel.getMpdId(patch);\n var manifestPublishTime = dashManifestModel.getPublishTime(manifest);\n var patchPublishTime = patchManifestModel.getPublishTime(patch);\n var originalManifestPublishTime = patchManifestModel.getOriginalPublishTime(patch); // Patches are considered compatible if the following are true\n // - MPD@id == Patch@mpdId\n // - MPD@publishTime == Patch@originalPublishTime\n // - MPD@publishTime < Patch@publishTime\n // - All values in comparison exist\n\n return !!(manifestId && patchManifestId && manifestId == patchManifestId && manifestPublishTime && originalManifestPublishTime && manifestPublishTime.getTime() == originalManifestPublishTime.getTime() && patchPublishTime && manifestPublishTime.getTime() < patchPublishTime.getTime());\n }\n /**\n * Takes a given patch and applies it to the provided manifest, assumes patch is valid for manifest\n * @param {object} manifest\n * @param {object} patch\n */\n\n\n function applyPatchToManifest(manifest, patch) {\n // get all operations from the patch and apply them in document order\n patchManifestModel.getPatchOperations(patch).forEach(function (operation) {\n var result = operation.getMpdTarget(manifest); // operation supplies a path that doesn\'t match mpd, skip\n\n if (result === null) {\n return;\n }\n\n var name = result.name,\n target = result.target,\n leaf = result.leaf; // short circuit for attribute selectors\n\n if (operation.xpath.findsAttribute()) {\n switch (operation.action) {\n case \'add\':\n case \'replace\':\n // add and replace are just setting the value\n target[name] = operation.value;\n break;\n\n case \'remove\':\n // remove is deleting the value\n delete target[name];\n break;\n }\n\n return;\n } // determine the relative insert position prior to possible removal\n\n\n var relativePosition = (target[name + \'_asArray\'] || []).indexOf(leaf);\n var insertBefore = operation.position === \'prepend\' || operation.position === \'before\'; // perform removal operation first, we have already capture the appropriate relative position\n\n if (operation.action === \'remove\' || operation.action === \'replace\') {\n // note that we ignore the \'ws\' attribute of patch operations as it does not effect parsed mpd operations\n // purge the directly named entity\n delete target[name]; // if we did have a positional reference we need to purge from array set and restore X2JS proper semantics\n\n if (relativePosition != -1) {\n var targetArray = target[name + \'_asArray\'];\n targetArray.splice(relativePosition, 1);\n\n if (targetArray.length > 1) {\n target[name] = targetArray;\n } else if (targetArray.length == 1) {\n // xml parsing semantics, singular asArray must be non-array in the unsuffixed key\n target[name] = targetArray[0];\n } else {\n // all nodes of this type deleted, remove entry\n delete target[name + \'_asArray\'];\n }\n }\n } // Perform any add/replace operations now, technically RFC5261 only allows a single element to take the\n // place of a replaced element while the add case allows an arbitrary number of children.\n // Due to the both operations requiring the same insertion logic they have been combined here and we will\n // not enforce single child operations for replace, assertions should be made at patch parse time if necessary\n\n\n if (operation.action === \'add\' || operation.action === \'replace\') {\n // value will be an object with element name keys pointing to arrays of objects\n Object.keys(operation.value).forEach(function (insert) {\n var insertNodes = operation.value[insert];\n var updatedNodes = target[insert + \'_asArray\'] || [];\n\n if (updatedNodes.length === 0 && target[insert]) {\n updatedNodes.push(target[insert]);\n }\n\n if (updatedNodes.length === 0) {\n // no original nodes for this element type\n updatedNodes = insertNodes;\n } else {\n // compute the position we need to insert at, default to end of set\n var position = updatedNodes.length;\n\n if (insert == name && relativePosition != -1) {\n // if the inserted element matches the operation target (not leaf) and there is a relative position we\n // want the inserted position to be set such that our insertion is relative to original position\n // since replace has modified the array length we reduce the insert point by 1\n position = relativePosition + (insertBefore ? 0 : 1) + (operation.action == \'replace\' ? -1 : 0);\n } else {\n // otherwise we are in an add append/prepend case or replace case that removed the target name completely\n position = insertBefore ? 0 : updatedNodes.length;\n } // we dont have to perform element removal for the replace case as that was done above\n\n\n updatedNodes.splice.apply(updatedNodes, [position, 0].concat(insertNodes));\n } // now we properly reset the element keys on the target to match parsing semantics\n\n\n target[insert + \'_asArray\'] = updatedNodes;\n target[insert] = updatedNodes.length == 1 ? updatedNodes[0] : updatedNodes;\n });\n }\n });\n } // #endregion PUBLIC FUNCTIONS\n // #region PRIVATE FUNCTIONS\n // --------------------------------------------------\n\n\n function getManifest(externalManifest) {\n return externalManifest ? externalManifest : voPeriods.length > 0 ? voPeriods[0].mpd.manifest : null;\n }\n\n function getAdaptationForMediaInfo(mediaInfo) {\n try {\n var selectedVoPeriod = getPeriodForStreamInfo(mediaInfo.streamInfo, voPeriods);\n var voAdaptations = dashManifestModel.getAdaptationsForPeriod(selectedVoPeriod);\n if (!mediaInfo || !mediaInfo.streamInfo || mediaInfo.streamInfo.id === undefined || !voAdaptations) return null;\n return voAdaptations[mediaInfo.index];\n } catch (e) {\n return null;\n }\n }\n\n function getPeriodForStreamInfo(streamInfo, voPeriodsArray) {\n var ln = voPeriodsArray.length;\n\n for (var i = 0; i < ln; i++) {\n var voPeriod = voPeriodsArray[i];\n if (streamInfo && streamInfo.id === voPeriod.id) return voPeriod;\n }\n\n return null;\n }\n\n function convertAdaptationToMediaInfo(adaptation) {\n if (!adaptation) {\n return null;\n }\n\n var mediaInfo = new _vo_MediaInfo__WEBPACK_IMPORTED_MODULE_2__["default"]();\n var realAdaptation = adaptation.period.mpd.manifest.Period_asArray[adaptation.period.index].AdaptationSet_asArray[adaptation.index];\n var viewpoint;\n mediaInfo.id = adaptation.id;\n mediaInfo.index = adaptation.index;\n mediaInfo.type = adaptation.type;\n mediaInfo.streamInfo = convertPeriodToStreamInfo(adaptation.period);\n mediaInfo.representationCount = dashManifestModel.getRepresentationCount(realAdaptation);\n mediaInfo.labels = dashManifestModel.getLabelsForAdaptation(realAdaptation);\n mediaInfo.lang = dashManifestModel.getLanguageForAdaptation(realAdaptation);\n viewpoint = dashManifestModel.getViewpointForAdaptation(realAdaptation);\n mediaInfo.viewpoint = viewpoint ? viewpoint.value : undefined;\n mediaInfo.accessibility = dashManifestModel.getAccessibilityForAdaptation(realAdaptation).map(function (accessibility) {\n var accessibilityValue = accessibility.value;\n var accessibilityData = accessibilityValue;\n\n if (accessibility.schemeIdUri && accessibility.schemeIdUri.search(\'cea-608\') >= 0 && typeof cea608parser !== \'undefined\') {\n if (accessibilityValue) {\n accessibilityData = \'cea-608:\' + accessibilityValue;\n } else {\n accessibilityData = \'cea-608\';\n }\n\n mediaInfo.embeddedCaptions = true;\n }\n\n return accessibilityData;\n });\n mediaInfo.audioChannelConfiguration = dashManifestModel.getAudioChannelConfigurationForAdaptation(realAdaptation).map(function (audioChannelConfiguration) {\n return audioChannelConfiguration.value;\n });\n\n if (mediaInfo.audioChannelConfiguration.length === 0 && Array.isArray(realAdaptation.Representation_asArray) && realAdaptation.Representation_asArray.length > 0) {\n mediaInfo.audioChannelConfiguration = dashManifestModel.getAudioChannelConfigurationForRepresentation(realAdaptation.Representation_asArray[0]).map(function (audioChannelConfiguration) {\n return audioChannelConfiguration.value;\n });\n }\n\n mediaInfo.roles = dashManifestModel.getRolesForAdaptation(realAdaptation).map(function (role) {\n return role.value;\n });\n mediaInfo.codec = dashManifestModel.getCodec(realAdaptation);\n mediaInfo.mimeType = dashManifestModel.getMimeType(realAdaptation);\n mediaInfo.contentProtection = dashManifestModel.getContentProtectionData(realAdaptation);\n mediaInfo.bitrateList = dashManifestModel.getBitrateListForAdaptation(realAdaptation);\n mediaInfo.selectionPriority = dashManifestModel.getSelectionPriority(realAdaptation);\n\n if (mediaInfo.contentProtection) {\n // Get the default key ID and apply it to all key systems\n var keyIds = mediaInfo.contentProtection.map(function (cp) {\n return dashManifestModel.getKID(cp);\n }).filter(function (kid) {\n return kid !== null;\n });\n\n if (keyIds.length) {\n var keyId = keyIds[0];\n mediaInfo.contentProtection.forEach(function (cp) {\n cp.keyId = keyId;\n });\n }\n }\n\n mediaInfo.isText = dashManifestModel.getIsText(realAdaptation);\n mediaInfo.supplementalProperties = dashManifestModel.getSupplementalProperties(realAdaptation);\n mediaInfo.isFragmented = dashManifestModel.getIsFragmented(realAdaptation);\n mediaInfo.isEmbedded = false;\n return mediaInfo;\n }\n\n function convertVideoInfoToEmbeddedTextInfo(mediaInfo, channel, lang) {\n mediaInfo.id = channel; // CC1, CC2, CC3, or CC4\n\n mediaInfo.index = 100 + parseInt(channel.substring(2, 3));\n mediaInfo.type = constants.TEXT;\n mediaInfo.codec = \'cea-608-in-SEI\';\n mediaInfo.isEmbedded = true;\n mediaInfo.isFragmented = false;\n mediaInfo.lang = lang;\n mediaInfo.roles = [\'caption\'];\n }\n\n function convertVideoInfoToThumbnailInfo(mediaInfo) {\n mediaInfo.type = constants.IMAGE;\n }\n\n function convertPeriodToStreamInfo(period) {\n var streamInfo = new _vo_StreamInfo__WEBPACK_IMPORTED_MODULE_3__["default"]();\n var THRESHOLD = 1;\n streamInfo.id = period.id;\n streamInfo.index = period.index;\n streamInfo.start = period.start;\n streamInfo.duration = period.duration;\n streamInfo.manifestInfo = convertMpdToManifestInfo(period.mpd);\n streamInfo.isLast = period.mpd.manifest.Period_asArray.length === 1 || Math.abs(streamInfo.start + streamInfo.duration - streamInfo.manifestInfo.duration) < THRESHOLD;\n return streamInfo;\n }\n\n function convertMpdToManifestInfo(mpd) {\n var manifestInfo = new _vo_ManifestInfo__WEBPACK_IMPORTED_MODULE_4__["default"]();\n manifestInfo.dvrWindowSize = mpd.timeShiftBufferDepth;\n manifestInfo.loadedTime = mpd.manifest.loadedTime;\n manifestInfo.availableFrom = mpd.availabilityStartTime;\n manifestInfo.minBufferTime = mpd.manifest.minBufferTime;\n manifestInfo.maxFragmentDuration = mpd.maxSegmentDuration;\n manifestInfo.duration = dashManifestModel.getDuration(mpd.manifest);\n manifestInfo.isDynamic = dashManifestModel.getIsDynamic(mpd.manifest);\n manifestInfo.serviceDescriptions = dashManifestModel.getServiceDescriptions(mpd.manifest);\n manifestInfo.protocol = mpd.manifest.protocol;\n return manifestInfo;\n }\n\n function checkConfig() {\n if (!constants) {\n throw new Error(\'setConfig function has to be called previously\');\n }\n }\n\n function getPeriod(periodIdx) {\n return voPeriods.length > 0 ? voPeriods[0].mpd.manifest.Period_asArray[periodIdx] : null;\n }\n\n function findRepresentationIndex(period, representationId) {\n var index = findRepresentation(period, representationId, true);\n return index !== null ? index : -1;\n }\n\n function findRepresentation(period, representationId, returnIndex) {\n var adaptationSet, adaptationSetArray, representation, representationArray, adaptationSetArrayIndex, representationArrayIndex;\n\n if (period) {\n adaptationSetArray = period.AdaptationSet_asArray;\n\n for (adaptationSetArrayIndex = 0; adaptationSetArrayIndex < adaptationSetArray.length; adaptationSetArrayIndex = adaptationSetArrayIndex + 1) {\n adaptationSet = adaptationSetArray[adaptationSetArrayIndex];\n representationArray = adaptationSet.Representation_asArray;\n\n for (representationArrayIndex = 0; representationArrayIndex < representationArray.length; representationArrayIndex = representationArrayIndex + 1) {\n representation = representationArray[representationArrayIndex];\n\n if (representationId === representation.id) {\n if (returnIndex) {\n return representationArrayIndex;\n } else {\n return representation;\n }\n }\n }\n }\n }\n\n return null;\n }\n\n function findMaxBufferIndex(period, bufferType) {\n var adaptationSet, adaptationSetArray, representationArray, adaptationSetArrayIndex;\n if (!period || !bufferType) return -1;\n adaptationSetArray = period.AdaptationSet_asArray;\n\n for (adaptationSetArrayIndex = 0; adaptationSetArrayIndex < adaptationSetArray.length; adaptationSetArrayIndex = adaptationSetArrayIndex + 1) {\n adaptationSet = adaptationSetArray[adaptationSetArrayIndex];\n representationArray = adaptationSet.Representation_asArray;\n\n if (dashManifestModel.getIsTypeOf(adaptationSet, bufferType)) {\n return representationArray.length;\n }\n }\n\n return -1;\n } // #endregion PRIVATE FUNCTIONS\n\n\n instance = {\n getBandwidthForRepresentation: getBandwidthForRepresentation,\n getIndexForRepresentation: getIndexForRepresentation,\n getMaxIndexForBufferType: getMaxIndexForBufferType,\n convertRepresentationToRepresentationInfo: convertRepresentationToRepresentationInfo,\n getStreamsInfo: getStreamsInfo,\n getMediaInfoForType: getMediaInfoForType,\n getAllMediaInfoForType: getAllMediaInfoForType,\n getAdaptationForType: getAdaptationForType,\n getRealAdaptation: getRealAdaptation,\n getRealPeriodByIndex: getRealPeriodByIndex,\n getEssentialPropertiesForRepresentation: getEssentialPropertiesForRepresentation,\n getVoRepresentations: getVoRepresentations,\n getEventsFor: getEventsFor,\n getEvent: getEvent,\n getMpd: getMpd,\n setConfig: setConfig,\n updatePeriods: updatePeriods,\n getIsTextTrack: getIsTextTrack,\n getUTCTimingSources: getUTCTimingSources,\n getSuggestedPresentationDelay: getSuggestedPresentationDelay,\n getAvailabilityStartTime: getAvailabilityStartTime,\n getIsTypeOf: getIsTypeOf,\n getIsDynamic: getIsDynamic,\n getDuration: getDuration,\n getRegularPeriods: getRegularPeriods,\n getLocation: getLocation,\n getPatchLocation: getPatchLocation,\n getManifestUpdatePeriod: getManifestUpdatePeriod,\n getPublishTime: getPublishTime,\n getIsDVB: getIsDVB,\n getIsPatch: getIsPatch,\n getBaseURLsFromElement: getBaseURLsFromElement,\n getRepresentationSortFunction: getRepresentationSortFunction,\n getCodec: getCodec,\n getPeriodById: getPeriodById,\n setCurrentMediaInfo: setCurrentMediaInfo,\n isPatchValid: isPatchValid,\n applyPatchToManifest: applyPatchToManifest,\n areMediaInfosEqual: areMediaInfosEqual,\n reset: reset\n };\n setup();\n return instance;\n}\n\nDashAdapter.__dashjs_factory_name = \'DashAdapter\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_6__["default"].getSingletonFactory(DashAdapter));\n\n/***/ }),\n\n/***/ "./src/dash/DashHandler.js":\n/*!*********************************!*\\\n !*** ./src/dash/DashHandler.js ***!\n \\*********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_676360__) {\n__nested_webpack_require_676360__.r(__nested_webpack_exports__);\n/* harmony import */ var _streaming_vo_FragmentRequest__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_676360__(/*! ../streaming/vo/FragmentRequest */ "./src/streaming/vo/FragmentRequest.js");\n/* harmony import */ var _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_676360__(/*! ../streaming/vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_676360__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_676360__(/*! ../streaming/MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_676360__(/*! ./utils/SegmentsUtils */ "./src/dash/utils/SegmentsUtils.js");\n/* harmony import */ var _constants_DashConstants__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_676360__(/*! ./constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\nvar DEFAULT_ADJUST_SEEK_TIME_THRESHOLD = 0.5;\n\nfunction DashHandler(config) {\n config = config || {};\n var eventBus = config.eventBus;\n var debug = config.debug;\n var urlUtils = config.urlUtils;\n var type = config.type;\n var streamInfo = config.streamInfo;\n var segmentsController = config.segmentsController;\n var timelineConverter = config.timelineConverter;\n var baseURLController = config.baseURLController;\n var instance, logger, lastSegment, isDynamicManifest, mediaHasFinished;\n\n function setup() {\n logger = debug.getLogger(instance);\n resetInitialSettings();\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].DYNAMIC_TO_STATIC, _onDynamicToStatic, instance);\n }\n\n function initialize(isDynamic) {\n isDynamicManifest = isDynamic;\n mediaHasFinished = false;\n segmentsController.initialize(isDynamic);\n }\n\n function getStreamId() {\n return streamInfo.id;\n }\n\n function getType() {\n return type;\n }\n\n function getStreamInfo() {\n return streamInfo;\n }\n\n function resetInitialSettings() {\n lastSegment = null;\n }\n\n function reset() {\n resetInitialSettings();\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].DYNAMIC_TO_STATIC, _onDynamicToStatic, instance);\n }\n\n function _setRequestUrl(request, destination, representation) {\n var baseURL = baseURLController.resolve(representation.path);\n var url, serviceLocation;\n\n if (!baseURL || destination === baseURL.url || !urlUtils.isRelative(destination)) {\n url = destination;\n } else {\n url = baseURL.url;\n serviceLocation = baseURL.serviceLocation;\n\n if (destination) {\n url = urlUtils.resolve(destination, url);\n }\n }\n\n if (urlUtils.isRelative(url)) {\n return false;\n }\n\n request.url = url;\n request.serviceLocation = serviceLocation;\n return true;\n }\n\n function getInitRequest(mediaInfo, representation) {\n if (!representation) return null;\n return _generateInitRequest(mediaInfo, representation, getType());\n }\n\n function _generateInitRequest(mediaInfo, representation, mediaType) {\n var request = new _streaming_vo_FragmentRequest__WEBPACK_IMPORTED_MODULE_0__["default"]();\n var period = representation.adaptation.period;\n var presentationStartTime = period.start;\n request.mediaType = mediaType;\n request.type = _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_1__["HTTPRequest"].INIT_SEGMENT_TYPE;\n request.range = representation.range;\n request.availabilityStartTime = timelineConverter.calcAvailabilityStartTimeFromPresentationTime(presentationStartTime, representation, isDynamicManifest);\n request.availabilityEndTime = timelineConverter.calcAvailabilityEndTimeFromPresentationTime(presentationStartTime + period.duration, representation, isDynamicManifest);\n request.quality = representation.index;\n request.mediaInfo = mediaInfo;\n request.representationId = representation.id;\n\n if (_setRequestUrl(request, representation.initialization, representation)) {\n request.url = Object(_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_4__["replaceTokenForTemplate"])(request.url, \'Bandwidth\', representation.bandwidth);\n return request;\n }\n }\n\n function _getRequestForSegment(mediaInfo, segment) {\n if (segment === null || segment === undefined) {\n return null;\n }\n\n var request = new _streaming_vo_FragmentRequest__WEBPACK_IMPORTED_MODULE_0__["default"]();\n var representation = segment.representation;\n var bandwidth = representation.adaptation.period.mpd.manifest.Period_asArray[representation.adaptation.period.index].AdaptationSet_asArray[representation.adaptation.index].Representation_asArray[representation.index].bandwidth;\n var url = segment.media;\n url = Object(_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_4__["replaceTokenForTemplate"])(url, \'Number\', segment.replacementNumber);\n url = Object(_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_4__["replaceTokenForTemplate"])(url, \'Time\', segment.replacementTime);\n url = Object(_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_4__["replaceTokenForTemplate"])(url, \'Bandwidth\', bandwidth);\n url = Object(_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_4__["replaceIDForTemplate"])(url, representation.id);\n url = Object(_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_4__["unescapeDollarsInTemplate"])(url);\n request.mediaType = getType();\n request.type = _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_1__["HTTPRequest"].MEDIA_SEGMENT_TYPE;\n request.range = segment.mediaRange;\n request.startTime = segment.presentationStartTime;\n request.mediaStartTime = segment.mediaStartTime;\n request.duration = segment.duration;\n request.timescale = representation.timescale;\n request.availabilityStartTime = segment.availabilityStartTime;\n request.availabilityEndTime = segment.availabilityEndTime;\n request.wallStartTime = segment.wallStartTime;\n request.quality = representation.index;\n request.index = segment.index;\n request.mediaInfo = mediaInfo;\n request.adaptationIndex = representation.adaptation.index;\n request.representationId = representation.id;\n\n if (_setRequestUrl(request, url, representation)) {\n return request;\n }\n }\n\n function isLastSegmentRequested(representation, bufferingTime) {\n if (!representation || !lastSegment) {\n return false;\n } // Either transition from dynamic to static was done or no next static segment found\n\n\n if (mediaHasFinished) {\n return true;\n } // Period is endless\n\n\n if (!isFinite(representation.adaptation.period.duration)) {\n return false;\n } // we are replacing existing stuff in the buffer for instance after a track switch\n\n\n if (lastSegment.presentationStartTime + lastSegment.duration > bufferingTime) {\n return false;\n } // Additional segment references may be added to the last period.\n // Additional periods may be added to the end of the MPD.\n // Segment references SHALL NOT be added to any period other than the last period.\n // An MPD update MAY combine adding segment references to the last period with adding of new periods. An MPD update that adds content MAY be combined with an MPD update that removes content.\n // The index of the last requested segment is higher than the number of available segments.\n // For SegmentTimeline and SegmentTemplate the index does not include the startNumber.\n // For SegmentList the index includes the startnumber which is why the numberOfSegments includes this as well\n\n\n if (representation.mediaFinishedInformation && !isNaN(representation.mediaFinishedInformation.numberOfSegments) && !isNaN(lastSegment.index) && lastSegment.index >= representation.mediaFinishedInformation.numberOfSegments - 1) {\n // For static manifests and Template addressing we can compare the index against the number of available segments\n if (!isDynamicManifest || representation.segmentInfoType === _constants_DashConstants__WEBPACK_IMPORTED_MODULE_5__["default"].SEGMENT_TEMPLATE) {\n return true;\n } // For SegmentList we need to check if the next period is signaled\n else if (isDynamicManifest && representation.segmentInfoType === _constants_DashConstants__WEBPACK_IMPORTED_MODULE_5__["default"].SEGMENT_LIST && representation.adaptation.period.nextPeriodId) {\n return true;\n }\n } // For dynamic SegmentTimeline manifests we need to check if the next period is already signaled and the segment we fetched before is the last one that is signaled.\n // We can not simply use the index, as numberOfSegments might have decreased after an MPD update\n\n\n return !!(isDynamicManifest && representation.adaptation.period.nextPeriodId && representation.segmentInfoType === _constants_DashConstants__WEBPACK_IMPORTED_MODULE_5__["default"].SEGMENT_TIMELINE && representation.mediaFinishedInformation && !isNaN(representation.mediaFinishedInformation.mediaTimeOfLastSignaledSegment) && lastSegment && !isNaN(lastSegment.mediaStartTime) && !isNaN(lastSegment.duration) && lastSegment.mediaStartTime + lastSegment.duration >= representation.mediaFinishedInformation.mediaTimeOfLastSignaledSegment - 0.05);\n }\n\n function getSegmentRequestForTime(mediaInfo, representation, time) {\n var request = null;\n\n if (!representation || !representation.segmentInfoType) {\n return request;\n }\n\n var segment = segmentsController.getSegmentByTime(representation, time);\n\n if (segment) {\n lastSegment = segment;\n logger.debug(\'Index for time \' + time + \' is \' + segment.index);\n request = _getRequestForSegment(mediaInfo, segment);\n }\n\n return request;\n }\n /**\n * This function returns the next segment request without modifying any internal variables. Any class (e.g CMCD Model) that needs information about the upcoming request should use this method.\n * @param {object} mediaInfo\n * @param {object} representation\n * @return {FragmentRequest|null}\n */\n\n\n function getNextSegmentRequestIdempotent(mediaInfo, representation) {\n var request = null;\n var indexToRequest = lastSegment ? lastSegment.index + 1 : 0;\n var segment = segmentsController.getSegmentByIndex(representation, indexToRequest, lastSegment ? lastSegment.mediaStartTime : -1);\n if (!segment) return null;\n request = _getRequestForSegment(mediaInfo, segment);\n return request;\n }\n /**\n * Main function to get the next segment request.\n * @param {object} mediaInfo\n * @param {object} representation\n * @return {FragmentRequest|null}\n */\n\n\n function getNextSegmentRequest(mediaInfo, representation) {\n var request = null;\n\n if (!representation || !representation.segmentInfoType) {\n return null;\n }\n\n var indexToRequest = lastSegment ? lastSegment.index + 1 : 0;\n var segment = segmentsController.getSegmentByIndex(representation, indexToRequest, lastSegment ? lastSegment.mediaStartTime : -1); // No segment found\n\n if (!segment) {\n // Dynamic manifest there might be something available in the next iteration\n if (isDynamicManifest && !mediaHasFinished) {\n logger.debug(getType() + \' No segment found at index: \' + indexToRequest + \'. Wait for next loop\');\n return null;\n } else {\n mediaHasFinished = true;\n }\n } else {\n request = _getRequestForSegment(mediaInfo, segment);\n lastSegment = segment;\n }\n\n return request;\n }\n /**\n * This function returns a time for which we can generate a request. It is supposed to be as close as possible to the target time.\n * This is useful in scenarios in which the user seeks into a gap. We will not find a valid request then and need to adjust the seektime.\n * @param {number} time\n * @param {object} mediaInfo\n * @param {object} representation\n * @param {number} targetThreshold\n */\n\n\n function getValidSeekTimeCloseToTargetTime(time, mediaInfo, representation, targetThreshold) {\n try {\n if (isNaN(time) || !mediaInfo || !representation) {\n return NaN;\n }\n\n if (time < 0) {\n time = 0;\n }\n\n if (isNaN(targetThreshold)) {\n targetThreshold = DEFAULT_ADJUST_SEEK_TIME_THRESHOLD;\n }\n\n if (getSegmentRequestForTime(mediaInfo, representation, time)) {\n return time;\n }\n\n var start = representation.adaptation.period.start;\n var end = representation.adaptation.period.start + representation.adaptation.period.duration;\n var currentUpperTime = Math.min(time + targetThreshold, end);\n var currentLowerTime = Math.max(time - targetThreshold, start);\n var adjustedTime = NaN;\n var targetRequest = null;\n\n while (currentUpperTime <= end || currentLowerTime >= start) {\n var upperRequest = null;\n var lowerRequest = null;\n\n if (currentUpperTime <= end) {\n upperRequest = getSegmentRequestForTime(mediaInfo, representation, currentUpperTime);\n }\n\n if (currentLowerTime >= start) {\n lowerRequest = getSegmentRequestForTime(mediaInfo, representation, currentLowerTime);\n }\n\n if (lowerRequest) {\n adjustedTime = currentLowerTime;\n targetRequest = lowerRequest;\n break;\n } else if (upperRequest) {\n adjustedTime = currentUpperTime;\n targetRequest = upperRequest;\n break;\n }\n\n currentUpperTime += targetThreshold;\n currentLowerTime -= targetThreshold;\n }\n\n if (targetRequest) {\n var requestEndTime = targetRequest.startTime + targetRequest.duration; // Keep the original start time in case it is covered by a segment\n\n if (time >= targetRequest.startTime && requestEndTime - time > targetThreshold) {\n return time;\n } // If target time is before the start of the request use request starttime\n\n\n if (time < targetRequest.startTime) {\n return targetRequest.startTime;\n }\n\n return Math.min(requestEndTime - targetThreshold, adjustedTime);\n }\n\n return adjustedTime;\n } catch (e) {\n return NaN;\n }\n }\n\n function getCurrentIndex() {\n return lastSegment ? lastSegment.index : -1;\n }\n\n function _onDynamicToStatic() {\n logger.debug(\'Dynamic stream complete\');\n mediaHasFinished = true;\n }\n\n instance = {\n initialize: initialize,\n getStreamId: getStreamId,\n getType: getType,\n getStreamInfo: getStreamInfo,\n getInitRequest: getInitRequest,\n getSegmentRequestForTime: getSegmentRequestForTime,\n getCurrentIndex: getCurrentIndex,\n getNextSegmentRequest: getNextSegmentRequest,\n isLastSegmentRequested: isLastSegmentRequested,\n reset: reset,\n getNextSegmentRequestIdempotent: getNextSegmentRequestIdempotent,\n getValidSeekTimeCloseToTargetTime: getValidSeekTimeCloseToTargetTime\n };\n setup();\n return instance;\n}\n\nDashHandler.__dashjs_factory_name = \'DashHandler\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getClassFactory(DashHandler));\n\n/***/ }),\n\n/***/ "./src/dash/DashMetrics.js":\n/*!*********************************!*\\\n !*** ./src/dash/DashMetrics.js ***!\n \\*********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_693690__) {\n__nested_webpack_require_693690__.r(__nested_webpack_exports__);\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_693690__(/*! ../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_693690__(/*! ../streaming/vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_693690__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _streaming_constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_693690__(/*! ../streaming/constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _utils_Round10__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_693690__(/*! ./utils/Round10 */ "./src/dash/utils/Round10.js");\n/* harmony import */ var _streaming_models_MetricsModel__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_693690__(/*! ../streaming/models/MetricsModel */ "./src/streaming/models/MetricsModel.js");\n/* harmony import */ var _core_Utils__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_693690__(/*! ../core/Utils */ "./src/core/Utils.js");\n/* harmony import */ var _streaming_vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_693690__(/*! ../streaming/vo/metrics/PlayList */ "./src/streaming/vo/metrics/PlayList.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n/**\n * @module DashMetrics\n * @description The DashMetrics module can be accessed using the MediaPlayer API getDashMetrics()\n * @param {object} config\n */\n\nfunction DashMetrics(config) {\n config = config || {};\n var context = this.context;\n var instance, playListTraceMetricsClosed, playListTraceMetrics, playListMetrics;\n var metricsModel = config.metricsModel;\n\n function setup() {\n metricsModel = metricsModel || Object(_streaming_models_MetricsModel__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance({\n settings: config.settings\n });\n resetInitialSettings();\n }\n\n function resetInitialSettings() {\n playListTraceMetricsClosed = true;\n playListTraceMetrics = null;\n playListMetrics = null;\n }\n /**\n * Returns the latest Representation switch for a given media type\n * @param {MediaType} mediaType\n * @returns {*}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getCurrentRepresentationSwitch(mediaType) {\n var metrics = metricsModel.getMetricsFor(mediaType, true);\n return getCurrent(metrics, _streaming_constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__["default"].TRACK_SWITCH);\n }\n /**\n * @param {MediaType} mediaType\n * @param {Date} t time of the switch event\n * @param {Date} mt media presentation time\n * @param {string} to id of representation\n * @param {string} lto if present, subrepresentation reference\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addRepresentationSwitch(mediaType, t, mt, to, lto) {\n metricsModel.addRepresentationSwitch(mediaType, t, mt, to, lto);\n }\n /**\n * Returns the current buffer state for a given media type\n * @param {MediaType} mediaType\n * @returns {number}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getCurrentBufferState(mediaType) {\n var metrics = metricsModel.getMetricsFor(mediaType, true);\n return getCurrent(metrics, _streaming_constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__["default"].BUFFER_STATE);\n }\n /**\n * Returns the current buffer level for a given media type\n * @param {MediaType} mediaType\n * @returns {number}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getCurrentBufferLevel(mediaType) {\n var metrics = metricsModel.getMetricsFor(mediaType, true);\n var metric = getCurrent(metrics, _streaming_constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__["default"].BUFFER_LEVEL);\n\n if (metric) {\n return _utils_Round10__WEBPACK_IMPORTED_MODULE_4__["default"].round10(metric.level / 1000, -3);\n }\n\n return 0;\n }\n /**\n * @param {MediaType} mediaType\n * @param {number} t\n * @param {number} level\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addBufferLevel(mediaType, t, level) {\n metricsModel.addBufferLevel(mediaType, t, level);\n }\n /**\n * @param {MediaType} mediaType\n * @param {string} state\n * @param {number} target\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addBufferState(mediaType, state, target) {\n metricsModel.addBufferState(mediaType, state, target);\n }\n /**\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function clearAllCurrentMetrics() {\n metricsModel.clearAllCurrentMetrics();\n }\n /**\n * Returns the latest HTTP request for a given media type\n * @param {MediaType} mediaType\n * @returns {*}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getCurrentHttpRequest(mediaType) {\n var metrics = metricsModel.getMetricsFor(mediaType, true);\n\n if (!metrics) {\n return null;\n }\n\n var httpList = metrics.HttpList;\n var currentHttpList = null;\n var httpListLastIndex;\n\n if (!httpList || httpList.length <= 0) {\n return null;\n }\n\n httpListLastIndex = httpList.length - 1;\n\n while (httpListLastIndex >= 0) {\n if (httpList[httpListLastIndex].responsecode) {\n currentHttpList = httpList[httpListLastIndex];\n break;\n }\n\n httpListLastIndex--;\n }\n\n return currentHttpList;\n }\n /**\n * Returns all HTTP requests for a given media type\n * @param {MediaType} mediaType\n * @returns {*}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getHttpRequests(mediaType) {\n var metrics = metricsModel.getMetricsFor(mediaType, true);\n\n if (!metrics) {\n return [];\n }\n\n return !!metrics.HttpList ? metrics.HttpList : [];\n }\n /**\n * @param {MediaType} mediaType\n * @param {Array} loadingRequests\n * @param {Array} executedRequests\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addRequestsQueue(mediaType, loadingRequests, executedRequests) {\n metricsModel.addRequestsQueue(mediaType, loadingRequests, executedRequests);\n }\n /**\n * Returns the latest metrics for a given metric list and specific metric name\n * @param {MetricsList} metrics\n * @param {string} metricName\n * @returns {*}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getCurrent(metrics, metricName) {\n if (!metrics) {\n return null;\n }\n\n var list = metrics[metricName];\n return !list || list.length === 0 ? null : list[list.length - 1];\n }\n /**\n * Returns the number of dropped frames\n * @returns {*}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getCurrentDroppedFrames() {\n var metrics = metricsModel.getMetricsFor(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO, true);\n return getCurrent(metrics, _streaming_constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__["default"].DROPPED_FRAMES);\n }\n /**\n * @param {number} quality\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addDroppedFrames(quality) {\n metricsModel.addDroppedFrames(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO, quality);\n }\n /**\n * Returns the current scheduling info for a given media type\n * @param {MediaType} mediaType\n * @returns {*}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getCurrentSchedulingInfo(mediaType) {\n var metrics = metricsModel.getMetricsFor(mediaType, true);\n return getCurrent(metrics, _streaming_constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__["default"].SCHEDULING_INFO);\n }\n /**\n * @param {object} request\n * @param {string} state\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addSchedulingInfo(request, state) {\n metricsModel.addSchedulingInfo(request.mediaType, new Date(), request.type, request.startTime, request.availabilityStartTime, request.duration, request.quality, request.range, state);\n }\n /**\n * Returns the current manifest update information\n * @returns {*}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getCurrentManifestUpdate() {\n var streamMetrics = metricsModel.getMetricsFor(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].STREAM);\n return getCurrent(streamMetrics, _streaming_constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__["default"].MANIFEST_UPDATE);\n }\n /**\n * @param {object} updatedFields fields to be updated\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function updateManifestUpdateInfo(updatedFields) {\n var manifestUpdate = this.getCurrentManifestUpdate();\n metricsModel.updateManifestUpdateInfo(manifestUpdate, updatedFields);\n }\n /**\n * @param {object} streamInfo\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addManifestUpdateStreamInfo(streamInfo) {\n if (streamInfo) {\n var manifestUpdate = this.getCurrentManifestUpdate();\n metricsModel.addManifestUpdateStreamInfo(manifestUpdate, streamInfo.id, streamInfo.index, streamInfo.start, streamInfo.duration);\n }\n }\n /**\n * @param {object} request\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addManifestUpdate(request) {\n metricsModel.addManifestUpdate(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].STREAM, request.type, request.requestStartDate, request.requestEndDate);\n }\n /**\n * @param {object} request\n * @param {string} responseURL\n * @param {number} responseStatus\n * @param {object} responseHeaders\n * @param {object} traces\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addHttpRequest(request, responseURL, responseStatus, responseHeaders, traces) {\n metricsModel.addHttpRequest(request.mediaType, null, request.type, request.url, request.quality, responseURL, request.serviceLocation || null, request.range || null, request.requestStartDate, request.firstByteDate, request.requestEndDate, responseStatus, request.duration, responseHeaders, traces);\n }\n /**\n * @param {object} representation\n * @param {MediaType} mediaType\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addManifestUpdateRepresentationInfo(representation, mediaType) {\n if (representation) {\n var manifestUpdateInfo = this.getCurrentManifestUpdate();\n metricsModel.addManifestUpdateRepresentationInfo(manifestUpdateInfo, representation.id, representation.index, representation.streamIndex, mediaType, representation.presentationTimeOffset, representation.startNumber, representation.fragmentInfoType);\n }\n }\n /**\n * Returns the current DVR window\n * @param {MediaType} mediaType\n * @returns {*}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getCurrentDVRInfo(mediaType) {\n var metrics = mediaType ? metricsModel.getMetricsFor(mediaType, true) : metricsModel.getMetricsFor(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO, true) || metricsModel.getMetricsFor(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO, true);\n return getCurrent(metrics, _streaming_constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__["default"].DVR_INFO);\n }\n /**\n * @param {MediaType} mediaType\n * @param {Date} currentTime time of the switch event\n * @param {object} mpd mpd reference\n * @param {object} range range of the dvr info\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addDVRInfo(mediaType, currentTime, mpd, range) {\n metricsModel.addDVRInfo(mediaType, currentTime, mpd, range);\n }\n /**\n * Returns the value for a specific request headers used in the latest MPD request\n * @param {string} id\n * @returns {*}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getLatestMPDRequestHeaderValueByID(id) {\n if (!id) {\n return null;\n }\n\n var headers = {};\n var httpRequestList, httpRequest, i;\n httpRequestList = getHttpRequests(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].STREAM);\n\n for (i = httpRequestList.length - 1; i >= 0; i--) {\n httpRequest = httpRequestList[i];\n\n if (httpRequest.type === _streaming_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_1__["HTTPRequest"].MPD_TYPE) {\n headers = _core_Utils__WEBPACK_IMPORTED_MODULE_6__["default"].parseHttpHeaders(httpRequest._responseHeaders);\n break;\n }\n }\n\n var value = headers[id.toLowerCase()];\n return value === undefined ? null : value;\n }\n /**\n * Returns the value for a specific request headers used in the latest fragment request\n * @param {MediaType} mediaType\n * @param {string} id\n * @returns {*}\n * @memberof module:DashMetrics\n * @instance\n */\n\n\n function getLatestFragmentRequestHeaderValueByID(mediaType, id) {\n if (!id) {\n return null;\n }\n\n var headers = {};\n var httpRequest = getCurrentHttpRequest(mediaType);\n\n if (httpRequest) {\n headers = _core_Utils__WEBPACK_IMPORTED_MODULE_6__["default"].parseHttpHeaders(httpRequest._responseHeaders);\n }\n\n var value = headers[id.toLowerCase()];\n return value === undefined ? null : value;\n }\n /**\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addPlayList() {\n if (playListMetrics) {\n metricsModel.addPlayList(playListMetrics);\n playListMetrics = null;\n }\n }\n /**\n * Create a new playlist metric\n * @param {number} mediaStartTime\n * @param {string} startReason\n * @ignore\n */\n\n\n function createPlaylistMetrics(mediaStartTime, startReason) {\n playListMetrics = new _streaming_vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__["PlayList"]();\n playListMetrics.start = new Date();\n playListMetrics.mstart = mediaStartTime;\n playListMetrics.starttype = startReason;\n }\n /**\n * Create a playlist trace metric\n * @param {number} representationId\n * @param {number} mediaStartTime\n * @param {number} speed\n * @ignore\n */\n\n\n function createPlaylistTraceMetrics(representationId, mediaStartTime, speed) {\n if (playListTraceMetricsClosed === true) {\n playListTraceMetricsClosed = false;\n playListTraceMetrics = new _streaming_vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__["PlayListTrace"]();\n playListTraceMetrics.representationid = representationId;\n playListTraceMetrics.start = new Date();\n playListTraceMetrics.mstart = mediaStartTime;\n playListTraceMetrics.playbackspeed = speed !== null ? speed.toString() : null;\n }\n }\n /**\n * Update existing playlist trace metric\n * @param {object} traceToUpdate\n * @ignore\n */\n\n\n function updatePlayListTraceMetrics(traceToUpdate) {\n if (playListTraceMetrics) {\n for (var field in playListTraceMetrics) {\n playListTraceMetrics[field] = traceToUpdate[field];\n }\n }\n }\n /**\n * Push a new playlist trace metric\n * @param endTime\n * @param reason\n * @ignore\n */\n\n\n function pushPlayListTraceMetrics(endTime, reason) {\n if (playListTraceMetricsClosed === false && playListMetrics && playListTraceMetrics && playListTraceMetrics.start) {\n var startTime = playListTraceMetrics.start;\n var duration = endTime.getTime() - startTime.getTime();\n playListTraceMetrics.duration = duration;\n playListTraceMetrics.stopreason = reason;\n playListMetrics.trace.push(playListTraceMetrics);\n playListTraceMetricsClosed = true;\n }\n }\n /**\n * @param {object} errors\n * @memberof module:DashMetrics\n * @instance\n * @ignore\n */\n\n\n function addDVBErrors(errors) {\n metricsModel.addDVBErrors(errors);\n }\n\n instance = {\n getCurrentRepresentationSwitch: getCurrentRepresentationSwitch,\n getCurrentBufferState: getCurrentBufferState,\n getCurrentBufferLevel: getCurrentBufferLevel,\n getCurrentHttpRequest: getCurrentHttpRequest,\n getHttpRequests: getHttpRequests,\n getCurrentDroppedFrames: getCurrentDroppedFrames,\n getCurrentSchedulingInfo: getCurrentSchedulingInfo,\n getCurrentDVRInfo: getCurrentDVRInfo,\n getCurrentManifestUpdate: getCurrentManifestUpdate,\n getLatestFragmentRequestHeaderValueByID: getLatestFragmentRequestHeaderValueByID,\n getLatestMPDRequestHeaderValueByID: getLatestMPDRequestHeaderValueByID,\n addRepresentationSwitch: addRepresentationSwitch,\n addDVRInfo: addDVRInfo,\n updateManifestUpdateInfo: updateManifestUpdateInfo,\n addManifestUpdateStreamInfo: addManifestUpdateStreamInfo,\n addManifestUpdateRepresentationInfo: addManifestUpdateRepresentationInfo,\n addManifestUpdate: addManifestUpdate,\n addHttpRequest: addHttpRequest,\n addSchedulingInfo: addSchedulingInfo,\n addRequestsQueue: addRequestsQueue,\n addBufferLevel: addBufferLevel,\n addBufferState: addBufferState,\n addDroppedFrames: addDroppedFrames,\n addPlayList: addPlayList,\n addDVBErrors: addDVBErrors,\n createPlaylistMetrics: createPlaylistMetrics,\n createPlaylistTraceMetrics: createPlaylistTraceMetrics,\n updatePlayListTraceMetrics: updatePlayListTraceMetrics,\n pushPlayListTraceMetrics: pushPlayListTraceMetrics,\n clearAllCurrentMetrics: clearAllCurrentMetrics\n };\n setup();\n return instance;\n}\n\nDashMetrics.__dashjs_factory_name = \'DashMetrics\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getSingletonFactory(DashMetrics));\n\n/***/ }),\n\n/***/ "./src/dash/SegmentBaseLoader.js":\n/*!***************************************!*\\\n !*** ./src/dash/SegmentBaseLoader.js ***!\n \\***************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_713507__) {\n__nested_webpack_require_713507__.r(__nested_webpack_exports__);\n/* harmony import */ var _vo_Segment__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_713507__(/*! ./vo/Segment */ "./src/dash/vo/Segment.js");\n/* harmony import */ var _streaming_vo_DashJSError__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_713507__(/*! ../streaming/vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_713507__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _streaming_vo_FragmentRequest__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_713507__(/*! ../streaming/vo/FragmentRequest */ "./src/streaming/vo/FragmentRequest.js");\n/* harmony import */ var _streaming_net_URLLoader__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_713507__(/*! ../streaming/net/URLLoader */ "./src/streaming/net/URLLoader.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\nfunction SegmentBaseLoader() {\n var context = this.context;\n var instance, logger, errHandler, boxParser, requestModifier, dashMetrics, mediaPlayerModel, urlLoader, errors, constants, dashConstants, urlUtils, baseURLController;\n\n function initialize() {\n urlLoader = Object(_streaming_net_URLLoader__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create({\n errHandler: errHandler,\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n requestModifier: requestModifier,\n boxParser: boxParser,\n errors: errors,\n urlUtils: urlUtils,\n constants: constants,\n dashConstants: dashConstants\n });\n }\n\n function setConfig(config) {\n if (config.baseURLController) {\n baseURLController = config.baseURLController;\n }\n\n if (config.dashMetrics) {\n dashMetrics = config.dashMetrics;\n }\n\n if (config.mediaPlayerModel) {\n mediaPlayerModel = config.mediaPlayerModel;\n }\n\n if (config.errHandler) {\n errHandler = config.errHandler;\n }\n\n if (config.boxParser) {\n boxParser = config.boxParser;\n }\n\n if (config.debug) {\n logger = config.debug.getLogger(instance);\n }\n\n if (config.requestModifier) {\n requestModifier = config.requestModifier;\n }\n\n if (config.errors) {\n errors = config.errors;\n }\n\n if (config.urlUtils) {\n urlUtils = config.urlUtils;\n }\n\n if (config.constants) {\n constants = config.constants;\n }\n\n if (config.dashConstants) {\n dashConstants = config.dashConstants;\n }\n }\n\n function loadInitialization(representation, mediaType) {\n return new Promise(function (resolve) {\n _loadInitializationRecursively(representation, mediaType, resolve);\n });\n }\n\n function _loadInitializationRecursively(representation, mediaType, resolve, loadingInfo) {\n var initRange = null;\n var baseUrl = representation ? baseURLController.resolve(representation.path) : null;\n var info = loadingInfo || {\n init: true,\n url: baseUrl ? baseUrl.url : undefined,\n range: {\n start: 0,\n end: 1500\n },\n searching: false,\n bytesLoaded: 0,\n bytesToLoad: 1500,\n mediaType: mediaType\n };\n logger.debug(\'Start searching for initialization.\');\n var request = getFragmentRequest(info);\n\n var onload = function onload(response) {\n info.bytesLoaded = info.range.end;\n initRange = boxParser.findInitRange(response);\n\n if (initRange) {\n representation.range = initRange; // note that we don\'t explicitly set rep.initialization as this\n // will be computed when all BaseURLs are resolved later\n\n resolve(representation);\n } else {\n info.range.end = info.bytesLoaded + info.bytesToLoad;\n return _loadInitializationRecursively(representation, mediaType, resolve, info);\n }\n };\n\n var onerror = function onerror() {\n resolve(representation);\n };\n\n urlLoader.load({\n request: request,\n success: onload,\n error: onerror\n });\n logger.debug(\'Perform init search: \' + info.url);\n }\n\n function loadSegments(representation, mediaType, range) {\n return new Promise(function (resolve) {\n _loadSegmentsRecursively(representation, mediaType, range, resolve);\n });\n }\n\n function _loadSegmentsRecursively(representation, mediaType, range, resolve, callback, loadingInfo) {\n if (range && (range.start === undefined || range.end === undefined)) {\n var parts = range ? range.toString().split(\'-\') : null;\n range = parts ? {\n start: parseFloat(parts[0]),\n end: parseFloat(parts[1])\n } : null;\n }\n\n callback = !callback ? onLoaded : callback;\n var isoFile = null;\n var sidx = null;\n var hasRange = !!range;\n var baseUrl = representation ? baseURLController.resolve(representation.path) : null;\n var info = {\n init: false,\n url: baseUrl ? baseUrl.url : undefined,\n range: hasRange ? range : {\n start: 0,\n end: 1500\n },\n searching: !hasRange,\n bytesLoaded: loadingInfo ? loadingInfo.bytesLoaded : 0,\n bytesToLoad: 1500,\n mediaType: mediaType\n };\n var request = getFragmentRequest(info);\n\n var onload = function onload(response) {\n var extraBytes = info.bytesToLoad;\n var loadedLength = response.byteLength;\n info.bytesLoaded = info.range.end - info.range.start;\n isoFile = boxParser.parse(response);\n sidx = isoFile.getBox(\'sidx\');\n\n if (!sidx || !sidx.isComplete) {\n if (sidx) {\n info.range.start = sidx.offset || info.range.start;\n info.range.end = info.range.start + (sidx.size || extraBytes);\n } else if (loadedLength < info.bytesLoaded) {\n // if we have reached a search limit or if we have reached the end of the file we have to stop trying to find sidx\n callback(null, representation, resolve);\n return;\n } else {\n var lastBox = isoFile.getLastBox();\n\n if (lastBox && lastBox.size) {\n info.range.start = lastBox.offset + lastBox.size;\n info.range.end = info.range.start + extraBytes;\n } else {\n info.range.end += extraBytes;\n }\n }\n\n _loadSegmentsRecursively(representation, mediaType, info.range, resolve, null, info);\n } else {\n var ref = sidx.references;\n var loadMultiSidx, segments;\n\n if (ref !== null && ref !== undefined && ref.length > 0) {\n loadMultiSidx = ref[0].reference_type === 1;\n }\n\n if (loadMultiSidx) {\n logger.debug(\'Initiate multiple SIDX load.\');\n info.range.end = info.range.start + sidx.size;\n var j, len, ss, se, r;\n var segs = [];\n var count = 0;\n var offset = (sidx.offset || info.range.start) + sidx.size;\n\n var tmpCallback = function tmpCallback(result) {\n if (result) {\n segs = segs.concat(result);\n count++;\n\n if (count >= len) {\n // http requests can be processed in a wrong order, so, we have to reorder segments with an ascending start Time order\n segs.sort(function (a, b) {\n return a.startTime - b.startTime < 0 ? -1 : 0;\n });\n callback(segs, representation, resolve);\n }\n } else {\n callback(null, representation, resolve);\n }\n };\n\n for (j = 0, len = ref.length; j < len; j++) {\n ss = offset;\n se = offset + ref[j].referenced_size - 1;\n offset = offset + ref[j].referenced_size;\n r = {\n start: ss,\n end: se\n };\n\n _loadSegmentsRecursively(representation, mediaType, r, resolve, tmpCallback, info);\n }\n } else {\n logger.debug(\'Parsing segments from SIDX. representation \' + mediaType + \' - id: \' + representation.id + \' for range : \' + info.range.start + \' - \' + info.range.end);\n segments = getSegmentsForSidx(sidx, info);\n callback(segments, representation, resolve);\n }\n }\n };\n\n var onerror = function onerror() {\n callback(null, representation, resolve);\n };\n\n urlLoader.load({\n request: request,\n success: onload,\n error: onerror\n });\n logger.debug("Perform SIDX load for type ".concat(mediaType, " : ").concat(info.url, " with range ").concat(info.range.start, " - ").concat(info.range.end));\n }\n\n function onLoaded(segments, representation, resolve) {\n resolve({\n segments: segments,\n representation: representation,\n error: segments ? undefined : new _streaming_vo_DashJSError__WEBPACK_IMPORTED_MODULE_1__["default"](errors.SEGMENT_BASE_LOADER_ERROR_CODE, errors.SEGMENT_BASE_LOADER_ERROR_MESSAGE)\n });\n }\n\n function reset() {\n if (urlLoader) {\n urlLoader.abort();\n urlLoader = null;\n }\n }\n\n function getSegmentsForSidx(sidx, info) {\n var refs = sidx.references;\n var len = refs.length;\n var timescale = sidx.timescale;\n var time = sidx.earliest_presentation_time;\n var start = info.range.start + sidx.offset + sidx.first_offset + sidx.size;\n var segments = [];\n var segment, end, duration, size;\n\n for (var i = 0; i < len; i++) {\n duration = refs[i].subsegment_duration;\n size = refs[i].referenced_size;\n segment = new _vo_Segment__WEBPACK_IMPORTED_MODULE_0__["default"](); // note that we don\'t explicitly set segment.media as this will be\n // computed when all BaseURLs are resolved later\n\n segment.duration = duration;\n segment.startTime = time;\n segment.timescale = timescale;\n end = start + size - 1;\n segment.mediaRange = start + \'-\' + end;\n segments.push(segment);\n time += duration;\n start += size;\n }\n\n return segments;\n }\n\n function getFragmentRequest(info) {\n if (!info.url) {\n return;\n }\n\n var request = new _streaming_vo_FragmentRequest__WEBPACK_IMPORTED_MODULE_3__["default"]();\n request.setInfo(info);\n return request;\n }\n\n instance = {\n setConfig: setConfig,\n initialize: initialize,\n loadInitialization: loadInitialization,\n loadSegments: loadSegments,\n reset: reset\n };\n return instance;\n}\n\nSegmentBaseLoader.__dashjs_factory_name = \'SegmentBaseLoader\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getSingletonFactory(SegmentBaseLoader));\n\n/***/ }),\n\n/***/ "./src/dash/WebmSegmentBaseLoader.js":\n/*!*******************************************!*\\\n !*** ./src/dash/WebmSegmentBaseLoader.js ***!\n \\*******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_726081__) {\n__nested_webpack_require_726081__.r(__nested_webpack_exports__);\n/* harmony import */ var _streaming_utils_EBMLParser__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_726081__(/*! ../streaming/utils/EBMLParser */ "./src/streaming/utils/EBMLParser.js");\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_726081__(/*! ../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_726081__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _vo_Segment__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_726081__(/*! ./vo/Segment */ "./src/dash/vo/Segment.js");\n/* harmony import */ var _streaming_vo_FragmentRequest__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_726081__(/*! ../streaming/vo/FragmentRequest */ "./src/streaming/vo/FragmentRequest.js");\n/* harmony import */ var _streaming_net_URLLoader__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_726081__(/*! ../streaming/net/URLLoader */ "./src/streaming/net/URLLoader.js");\n/* harmony import */ var _streaming_vo_DashJSError__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_726081__(/*! ../streaming/vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n\n\n\n\n\n\n\n\nfunction WebmSegmentBaseLoader() {\n var context = this.context;\n var instance, logger, WebM, errHandler, requestModifier, dashMetrics, mediaPlayerModel, urlLoader, errors, baseURLController;\n\n function setup() {\n WebM = {\n EBML: {\n tag: 0x1A45DFA3,\n required: true\n },\n Segment: {\n tag: 0x18538067,\n required: true,\n SeekHead: {\n tag: 0x114D9B74,\n required: true\n },\n Info: {\n tag: 0x1549A966,\n required: true,\n TimecodeScale: {\n tag: 0x2AD7B1,\n required: true,\n parse: \'getMatroskaUint\'\n },\n Duration: {\n tag: 0x4489,\n required: true,\n parse: \'getMatroskaFloat\'\n }\n },\n Tracks: {\n tag: 0x1654AE6B,\n required: true\n },\n Cues: {\n tag: 0x1C53BB6B,\n required: true,\n CuePoint: {\n tag: 0xBB,\n required: true,\n CueTime: {\n tag: 0xB3,\n required: true,\n parse: \'getMatroskaUint\'\n },\n CueTrackPositions: {\n tag: 0xB7,\n required: true,\n CueTrack: {\n tag: 0xF7,\n required: true,\n parse: \'getMatroskaUint\'\n },\n CueClusterPosition: {\n tag: 0xF1,\n required: true,\n parse: \'getMatroskaUint\'\n }\n }\n }\n }\n },\n Void: {\n tag: 0xEC,\n required: true\n }\n };\n }\n\n function initialize() {\n urlLoader = Object(_streaming_net_URLLoader__WEBPACK_IMPORTED_MODULE_5__["default"])(context).create({\n errHandler: errHandler,\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n requestModifier: requestModifier,\n errors: errors\n });\n }\n\n function setConfig(config) {\n if (!config.baseURLController || !config.dashMetrics || !config.mediaPlayerModel || !config.errHandler) {\n throw new Error(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].MISSING_CONFIG_ERROR);\n }\n\n baseURLController = config.baseURLController;\n dashMetrics = config.dashMetrics;\n mediaPlayerModel = config.mediaPlayerModel;\n errHandler = config.errHandler;\n errors = config.errors;\n logger = config.debug.getLogger(instance);\n requestModifier = config.requestModifier;\n }\n\n function parseCues(ab) {\n var cues = [];\n var ebmlParser = Object(_streaming_utils_EBMLParser__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create({\n data: ab\n });\n var cue, cueTrack;\n ebmlParser.consumeTagAndSize(WebM.Segment.Cues);\n\n while (ebmlParser.moreData() && ebmlParser.consumeTagAndSize(WebM.Segment.Cues.CuePoint, true)) {\n cue = {};\n cue.CueTime = ebmlParser.parseTag(WebM.Segment.Cues.CuePoint.CueTime);\n cue.CueTracks = [];\n\n while (ebmlParser.moreData() && ebmlParser.consumeTag(WebM.Segment.Cues.CuePoint.CueTrackPositions, true)) {\n var cueTrackPositionSize = ebmlParser.getMatroskaCodedNum();\n var startPos = ebmlParser.getPos();\n cueTrack = {};\n cueTrack.Track = ebmlParser.parseTag(WebM.Segment.Cues.CuePoint.CueTrackPositions.CueTrack);\n\n if (cueTrack.Track === 0) {\n throw new Error(\'Cue track cannot be 0\');\n }\n\n cueTrack.ClusterPosition = ebmlParser.parseTag(WebM.Segment.Cues.CuePoint.CueTrackPositions.CueClusterPosition);\n cue.CueTracks.push(cueTrack); // we\'re not interested any other elements - skip remaining bytes\n\n ebmlParser.setPos(startPos + cueTrackPositionSize);\n }\n\n if (cue.CueTracks.length === 0) {\n throw new Error(\'Mandatory cuetrack not found\');\n }\n\n cues.push(cue);\n }\n\n if (cues.length === 0) {\n throw new Error(\'mandatory cuepoint not found\');\n }\n\n return cues;\n }\n\n function parseSegments(data, segmentStart, segmentEnd, segmentDuration) {\n var duration, parsed, segments, segment, i, len, start, end;\n parsed = parseCues(data);\n segments = []; // we are assuming one cue track per cue point\n // both duration and media range require the i + 1 segment\n // the final segment has to use global segment parameters\n\n for (i = 0, len = parsed.length; i < len; i += 1) {\n segment = new _vo_Segment__WEBPACK_IMPORTED_MODULE_3__["default"]();\n duration = 0;\n\n if (i < parsed.length - 1) {\n duration = parsed[i + 1].CueTime - parsed[i].CueTime;\n } else {\n duration = segmentDuration - parsed[i].CueTime;\n } // note that we don\'t explicitly set segment.media as this will be\n // computed when all BaseURLs are resolved later\n\n\n segment.duration = duration;\n segment.startTime = parsed[i].CueTime;\n segment.timescale = 1000; // hardcoded for ms\n\n start = parsed[i].CueTracks[0].ClusterPosition + segmentStart;\n\n if (i < parsed.length - 1) {\n end = parsed[i + 1].CueTracks[0].ClusterPosition + segmentStart - 1;\n } else {\n end = segmentEnd - 1;\n }\n\n segment.mediaRange = start + \'-\' + end;\n segments.push(segment);\n }\n\n logger.debug(\'Parsed cues: \' + segments.length + \' cues.\');\n return segments;\n }\n\n function parseEbmlHeader(data, media, theRange, callback) {\n if (!data || data.byteLength === 0) {\n callback(null);\n return;\n }\n\n var ebmlParser = Object(_streaming_utils_EBMLParser__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create({\n data: data\n });\n var duration, segments, segmentEnd, segmentStart;\n var parts = theRange ? theRange.split(\'-\') : null;\n var request = null;\n var info = {\n url: media,\n range: {\n start: parts ? parseFloat(parts[0]) : null,\n end: parts ? parseFloat(parts[1]) : null\n },\n request: request\n };\n logger.debug(\'Parse EBML header: \' + info.url); // skip over the header itself\n\n ebmlParser.skipOverElement(WebM.EBML);\n ebmlParser.consumeTag(WebM.Segment); // segments start here\n\n segmentEnd = ebmlParser.getMatroskaCodedNum();\n segmentEnd += ebmlParser.getPos();\n segmentStart = ebmlParser.getPos(); // skip over any top level elements to get to the segment info\n\n while (ebmlParser.moreData() && !ebmlParser.consumeTagAndSize(WebM.Segment.Info, true)) {\n if (!(ebmlParser.skipOverElement(WebM.Segment.SeekHead, true) || ebmlParser.skipOverElement(WebM.Segment.Tracks, true) || ebmlParser.skipOverElement(WebM.Segment.Cues, true) || ebmlParser.skipOverElement(WebM.Void, true))) {\n throw new Error(\'no valid top level element found\');\n }\n } // we only need one thing in segment info, duration\n\n\n while (duration === undefined) {\n var infoTag = ebmlParser.getMatroskaCodedNum(true);\n var infoElementSize = ebmlParser.getMatroskaCodedNum();\n\n switch (infoTag) {\n case WebM.Segment.Info.Duration.tag:\n duration = ebmlParser[WebM.Segment.Info.Duration.parse](infoElementSize);\n break;\n\n default:\n ebmlParser.setPos(ebmlParser.getPos() + infoElementSize);\n break;\n }\n } // once we have what we need from segment info, we jump right to the\n // cues\n\n\n request = _getFragmentRequest(info);\n\n var onload = function onload(response) {\n segments = parseSegments(response, segmentStart, segmentEnd, duration);\n callback(segments);\n };\n\n var onloadend = function onloadend() {\n logger.error(\'Download Error: Cues \' + info.url);\n callback(null);\n };\n\n urlLoader.load({\n request: request,\n success: onload,\n error: onloadend\n });\n logger.debug(\'Perform cues load: \' + info.url + \' bytes=\' + info.range.start + \'-\' + info.range.end);\n }\n\n function loadInitialization(representation, mediaType) {\n return new Promise(function (resolve) {\n var request = null;\n var baseUrl = representation ? baseURLController.resolve(representation.path) : null;\n var initRange = representation ? representation.range.split(\'-\') : null;\n var info = {\n range: {\n start: initRange ? parseFloat(initRange[0]) : null,\n end: initRange ? parseFloat(initRange[1]) : null\n },\n request: request,\n url: baseUrl ? baseUrl.url : undefined,\n init: true,\n mediaType: mediaType\n };\n logger.info(\'Start loading initialization.\');\n request = _getFragmentRequest(info);\n\n var onload = function onload() {\n // note that we don\'t explicitly set rep.initialization as this\n // will be computed when all BaseURLs are resolved later\n resolve(representation);\n };\n\n var onloadend = function onloadend() {\n resolve(representation);\n };\n\n urlLoader.load({\n request: request,\n success: onload,\n error: onloadend\n });\n logger.debug(\'Perform init load: \' + info.url);\n });\n }\n\n function loadSegments(representation, mediaType, theRange) {\n return new Promise(function (resolve) {\n var request = null;\n var baseUrl = representation ? baseURLController.resolve(representation.path) : null;\n var media = baseUrl ? baseUrl.url : undefined;\n var bytesToLoad = 8192;\n var info = {\n bytesLoaded: 0,\n bytesToLoad: bytesToLoad,\n range: {\n start: 0,\n end: bytesToLoad\n },\n request: request,\n url: media,\n init: false,\n mediaType: mediaType\n };\n request = _getFragmentRequest(info); // first load the header, but preserve the manifest range so we can\n // load the cues after parsing the header\n // NOTE: we expect segment info to appear in the first 8192 bytes\n\n logger.debug(\'Parsing ebml header\');\n\n var onload = function onload(response) {\n parseEbmlHeader(response, media, theRange, function (segments) {\n resolve({\n segments: segments,\n representation: representation,\n error: segments ? undefined : new _streaming_vo_DashJSError__WEBPACK_IMPORTED_MODULE_6__["default"](errors.SEGMENT_BASE_LOADER_ERROR_CODE, errors.SEGMENT_BASE_LOADER_ERROR_MESSAGE)\n });\n });\n };\n\n var onloadend = function onloadend() {\n resolve({\n representation: representation,\n error: new _streaming_vo_DashJSError__WEBPACK_IMPORTED_MODULE_6__["default"](errors.SEGMENT_BASE_LOADER_ERROR_CODE, errors.SEGMENT_BASE_LOADER_ERROR_MESSAGE)\n });\n };\n\n urlLoader.load({\n request: request,\n success: onload,\n error: onloadend\n });\n });\n }\n\n function _getFragmentRequest(info) {\n var request = new _streaming_vo_FragmentRequest__WEBPACK_IMPORTED_MODULE_4__["default"]();\n request.setInfo(info);\n return request;\n }\n\n function reset() {\n if (urlLoader) {\n urlLoader.abort();\n urlLoader = null;\n }\n }\n\n instance = {\n setConfig: setConfig,\n initialize: initialize,\n loadInitialization: loadInitialization,\n loadSegments: loadSegments,\n reset: reset\n };\n setup();\n return instance;\n}\n\nWebmSegmentBaseLoader.__dashjs_factory_name = \'WebmSegmentBaseLoader\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getSingletonFactory(WebmSegmentBaseLoader));\n\n/***/ }),\n\n/***/ "./src/dash/constants/DashConstants.js":\n/*!*********************************************!*\\\n !*** ./src/dash/constants/DashConstants.js ***!\n \\*********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_739118__) {\n__nested_webpack_require_739118__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Dash constants declaration\n * @class\n * @ignore\n */\nvar DashConstants = /*#__PURE__*/function () {\n function DashConstants() {\n _classCallCheck(this, DashConstants);\n\n this.init();\n }\n\n _createClass(DashConstants, [{\n key: "init",\n value: function init() {\n this.BASE_URL = \'BaseURL\';\n this.SEGMENT_BASE = \'SegmentBase\';\n this.SEGMENT_TEMPLATE = \'SegmentTemplate\';\n this.SEGMENT_LIST = \'SegmentList\';\n this.SEGMENT_URL = \'SegmentURL\';\n this.SEGMENT_TIMELINE = \'SegmentTimeline\';\n this.SEGMENT_PROFILES = \'segmentProfiles\';\n this.ADAPTATION_SET = \'AdaptationSet\';\n this.REPRESENTATION = \'Representation\';\n this.REPRESENTATION_INDEX = \'RepresentationIndex\';\n this.SUB_REPRESENTATION = \'SubRepresentation\';\n this.INITIALIZATION = \'Initialization\';\n this.INITIALIZATION_MINUS = \'initialization\';\n this.MPD = \'MPD\';\n this.PERIOD = \'Period\';\n this.ASSET_IDENTIFIER = \'AssetIdentifier\';\n this.EVENT_STREAM = \'EventStream\';\n this.ID = \'id\';\n this.PROFILES = \'profiles\';\n this.SERVICE_LOCATION = \'serviceLocation\';\n this.RANGE = \'range\';\n this.INDEX = \'index\';\n this.MEDIA = \'media\';\n this.BYTE_RANGE = \'byteRange\';\n this.INDEX_RANGE = \'indexRange\';\n this.MEDIA_RANGE = \'mediaRange\';\n this.VALUE = \'value\';\n this.CONTENT_TYPE = \'contentType\';\n this.MIME_TYPE = \'mimeType\';\n this.BITSTREAM_SWITCHING = \'BitstreamSwitching\';\n this.BITSTREAM_SWITCHING_MINUS = \'bitstreamSwitching\';\n this.CODECS = \'codecs\';\n this.DEPENDENCY_ID = \'dependencyId\';\n this.MEDIA_STREAM_STRUCTURE_ID = \'mediaStreamStructureId\';\n this.METRICS = \'Metrics\';\n this.METRICS_MINUS = \'metrics\';\n this.REPORTING = \'Reporting\';\n this.WIDTH = \'width\';\n this.HEIGHT = \'height\';\n this.SAR = \'sar\';\n this.FRAMERATE = \'frameRate\';\n this.AUDIO_SAMPLING_RATE = \'audioSamplingRate\';\n this.MAXIMUM_SAP_PERIOD = \'maximumSAPPeriod\';\n this.START_WITH_SAP = \'startWithSAP\';\n this.MAX_PLAYOUT_RATE = \'maxPlayoutRate\';\n this.CODING_DEPENDENCY = \'codingDependency\';\n this.SCAN_TYPE = \'scanType\';\n this.FRAME_PACKING = \'FramePacking\';\n this.AUDIO_CHANNEL_CONFIGURATION = \'AudioChannelConfiguration\';\n this.CONTENT_PROTECTION = \'ContentProtection\';\n this.ESSENTIAL_PROPERTY = \'EssentialProperty\';\n this.SUPPLEMENTAL_PROPERTY = \'SupplementalProperty\';\n this.INBAND_EVENT_STREAM = \'InbandEventStream\';\n this.ACCESSIBILITY = \'Accessibility\';\n this.ROLE = \'Role\';\n this.RATING = \'Rating\';\n this.CONTENT_COMPONENT = \'ContentComponent\';\n this.SUBSET = \'Subset\';\n this.LANG = \'lang\';\n this.VIEWPOINT = \'Viewpoint\';\n this.ROLE_ASARRAY = \'Role_asArray\';\n this.ACCESSIBILITY_ASARRAY = \'Accessibility_asArray\';\n this.AUDIOCHANNELCONFIGURATION_ASARRAY = \'AudioChannelConfiguration_asArray\';\n this.CONTENTPROTECTION_ASARRAY = \'ContentProtection_asArray\';\n this.MAIN = \'main\';\n this.DYNAMIC = \'dynamic\';\n this.STATIC = \'static\';\n this.MEDIA_PRESENTATION_DURATION = \'mediaPresentationDuration\';\n this.MINIMUM_UPDATE_PERIOD = \'minimumUpdatePeriod\';\n this.CODEC_PRIVATE_DATA = \'codecPrivateData\';\n this.BANDWITH = \'bandwidth\';\n this.SOURCE_URL = \'sourceURL\';\n this.TIMESCALE = \'timescale\';\n this.DURATION = \'duration\';\n this.START_NUMBER = \'startNumber\';\n this.PRESENTATION_TIME_OFFSET = \'presentationTimeOffset\';\n this.AVAILABILITY_START_TIME = \'availabilityStartTime\';\n this.AVAILABILITY_END_TIME = \'availabilityEndTime\';\n this.TIMESHIFT_BUFFER_DEPTH = \'timeShiftBufferDepth\';\n this.MAX_SEGMENT_DURATION = \'maxSegmentDuration\';\n this.PRESENTATION_TIME = \'presentationTime\';\n this.MIN_BUFFER_TIME = \'minBufferTime\';\n this.MAX_SUBSEGMENT_DURATION = \'maxSubsegmentDuration\';\n this.START = \'start\';\n this.AVAILABILITY_TIME_OFFSET = \'availabilityTimeOffset\';\n this.AVAILABILITY_TIME_COMPLETE = \'availabilityTimeComplete\';\n this.CENC_DEFAULT_KID = \'cenc:default_KID\';\n this.DVB_PRIORITY = \'dvb:priority\';\n this.DVB_WEIGHT = \'dvb:weight\';\n this.SUGGESTED_PRESENTATION_DELAY = \'suggestedPresentationDelay\';\n this.SERVICE_DESCRIPTION = \'ServiceDescription\';\n this.SERVICE_DESCRIPTION_SCOPE = \'Scope\';\n this.SERVICE_DESCRIPTION_LATENCY = \'Latency\';\n this.SERVICE_DESCRIPTION_PLAYBACK_RATE = \'PlaybackRate\';\n this.PATCH_LOCATION = \'PatchLocation\';\n this.PUBLISH_TIME = \'publishTime\';\n this.ORIGINAL_PUBLISH_TIME = \'originalPublishTime\';\n this.ORIGINAL_MPD_ID = \'mpdId\';\n }\n }]);\n\n return DashConstants;\n}();\n\nvar constants = new DashConstants();\n/* harmony default export */ __nested_webpack_exports__["default"] = (constants);\n\n/***/ }),\n\n/***/ "./src/dash/controllers/RepresentationController.js":\n/*!**********************************************************!*\\\n !*** ./src/dash/controllers/RepresentationController.js ***!\n \\**********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_746902__) {\n__nested_webpack_require_746902__.r(__nested_webpack_exports__);\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_746902__(/*! ../../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_746902__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_746902__(/*! ../../streaming/MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_746902__(/*! ../utils/SegmentsUtils */ "./src/dash/utils/SegmentsUtils.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\nfunction RepresentationController(config) {\n config = config || {};\n var eventBus = config.eventBus;\n var events = config.events;\n var abrController = config.abrController;\n var dashMetrics = config.dashMetrics;\n var playbackController = config.playbackController;\n var timelineConverter = config.timelineConverter;\n var type = config.type;\n var streamInfo = config.streamInfo;\n var dashConstants = config.dashConstants;\n var segmentsController = config.segmentsController;\n var isDynamic = config.isDynamic;\n var instance, realAdaptation, updating, voAvailableRepresentations, currentVoRepresentation;\n\n function setup() {\n resetInitialSettings();\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_2__["default"].MANIFEST_VALIDITY_CHANGED, onManifestValidityChanged, instance);\n }\n\n function getStreamId() {\n return streamInfo.id;\n }\n\n function getType() {\n return type;\n }\n\n function checkConfig() {\n if (!abrController || !dashMetrics || !playbackController || !timelineConverter) {\n throw new Error(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].MISSING_CONFIG_ERROR);\n }\n }\n\n function getData() {\n return realAdaptation;\n }\n\n function isUpdating() {\n return updating;\n }\n\n function getCurrentRepresentation() {\n return currentVoRepresentation;\n }\n\n function resetInitialSettings() {\n realAdaptation = null;\n updating = true;\n voAvailableRepresentations = [];\n }\n\n function reset() {\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_2__["default"].MANIFEST_VALIDITY_CHANGED, onManifestValidityChanged, instance);\n resetInitialSettings();\n }\n\n function updateData(newRealAdaptation, availableRepresentations, type, isFragmented, quality) {\n checkConfig();\n updating = true;\n voAvailableRepresentations = availableRepresentations;\n var rep = getRepresentationForQuality(quality);\n\n _setCurrentVoRepresentation(rep);\n\n realAdaptation = newRealAdaptation;\n\n if (type !== _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO && type !== _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO && (type !== _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT || !isFragmented)) {\n endDataUpdate();\n return Promise.resolve();\n }\n\n var promises = [];\n\n for (var i = 0, ln = voAvailableRepresentations.length; i < ln; i++) {\n var currentRep = voAvailableRepresentations[i];\n promises.push(_updateRepresentation(currentRep));\n }\n\n return Promise.all(promises);\n }\n\n function _updateRepresentation(currentRep) {\n return new Promise(function (resolve, reject) {\n var hasInitialization = currentRep.hasInitialization();\n var hasSegments = currentRep.hasSegments(); // If representation has initialization and segments information we are done\n // otherwise, it means that a request has to be made to get initialization and/or segments information\n\n var promises = [];\n promises.push(segmentsController.updateInitData(currentRep, hasInitialization));\n promises.push(segmentsController.updateSegmentData(currentRep, hasSegments));\n Promise.all(promises).then(function (data) {\n if (data[0] && !data[0].error) {\n currentRep = _onInitLoaded(currentRep, data[0]);\n }\n\n if (data[1] && !data[1].error) {\n currentRep = _onSegmentsLoaded(currentRep, data[1]);\n }\n\n _setMediaFinishedInformation(currentRep);\n\n _onRepresentationUpdated(currentRep);\n\n resolve();\n })["catch"](function (e) {\n reject(e);\n });\n });\n }\n\n function _setMediaFinishedInformation(representation) {\n representation.mediaFinishedInformation = segmentsController.getMediaFinishedInformation(representation);\n }\n\n function _onInitLoaded(representation, e) {\n if (!e || e.error || !e.representation) {\n return representation;\n }\n\n return e.representation;\n }\n\n function _onSegmentsLoaded(representation, e) {\n if (!e || e.error) return;\n var fragments = e.segments;\n var segments = [];\n var count = 0;\n var i, len, s, seg;\n\n for (i = 0, len = fragments ? fragments.length : 0; i < len; i++) {\n s = fragments[i];\n seg = Object(_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_3__["getTimeBasedSegment"])(timelineConverter, isDynamic, representation, s.startTime, s.duration, s.timescale, s.media, s.mediaRange, count);\n\n if (seg) {\n segments.push(seg);\n seg = null;\n count++;\n }\n }\n\n if (segments.length > 0) {\n representation.segments = segments;\n }\n\n return representation;\n }\n\n function _addRepresentationSwitch() {\n checkConfig();\n var now = new Date();\n var currentRepresentation = getCurrentRepresentation();\n var currentVideoTimeMs = playbackController.getTime() * 1000;\n\n if (currentRepresentation) {\n dashMetrics.addRepresentationSwitch(currentRepresentation.adaptation.type, now, currentVideoTimeMs, currentRepresentation.id);\n }\n\n eventBus.trigger(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_2__["default"].REPRESENTATION_SWITCH, {\n mediaType: type,\n streamId: streamInfo.id,\n currentRepresentation: currentRepresentation,\n numberOfRepresentations: voAvailableRepresentations.length\n }, {\n streamId: streamInfo.id,\n mediaType: type\n });\n }\n\n function getRepresentationForQuality(quality) {\n return quality === null || quality === undefined || quality >= voAvailableRepresentations.length ? null : voAvailableRepresentations[quality];\n }\n\n function getQualityForRepresentation(voRepresentation) {\n return voAvailableRepresentations.indexOf(voRepresentation);\n }\n\n function isAllRepresentationsUpdated() {\n for (var i = 0, ln = voAvailableRepresentations.length; i < ln; i++) {\n var segmentInfoType = voAvailableRepresentations[i].segmentInfoType;\n\n if (!voAvailableRepresentations[i].hasInitialization() || (segmentInfoType === dashConstants.SEGMENT_BASE || segmentInfoType === dashConstants.BASE_URL) && !voAvailableRepresentations[i].segments) {\n return false;\n }\n }\n\n return true;\n }\n\n function endDataUpdate(error) {\n updating = false;\n eventBus.trigger(events.DATA_UPDATE_COMPLETED, {\n data: realAdaptation,\n currentRepresentation: currentVoRepresentation,\n error: error\n }, {\n streamId: streamInfo.id,\n mediaType: type\n });\n }\n\n function _onRepresentationUpdated(r) {\n if (!isUpdating()) return;\n var manifestUpdateInfo = dashMetrics.getCurrentManifestUpdate();\n var alreadyAdded = false;\n var repInfo, repSwitch;\n\n if (manifestUpdateInfo) {\n for (var i = 0; i < manifestUpdateInfo.representationInfo.length; i++) {\n repInfo = manifestUpdateInfo.representationInfo[i];\n\n if (repInfo.index === r.index && repInfo.mediaType === getType()) {\n alreadyAdded = true;\n break;\n }\n }\n\n if (!alreadyAdded) {\n dashMetrics.addManifestUpdateRepresentationInfo(r, getType());\n }\n }\n\n if (isAllRepresentationsUpdated()) {\n abrController.setPlaybackQuality(type, streamInfo, getQualityForRepresentation(currentVoRepresentation));\n var dvrInfo = dashMetrics.getCurrentDVRInfo(type);\n\n if (dvrInfo) {\n dashMetrics.updateManifestUpdateInfo({\n latency: dvrInfo.range.end - playbackController.getTime()\n });\n }\n\n repSwitch = dashMetrics.getCurrentRepresentationSwitch(getCurrentRepresentation().adaptation.type);\n\n if (!repSwitch) {\n _addRepresentationSwitch();\n }\n\n endDataUpdate();\n }\n }\n\n function prepareQualityChange(newQuality) {\n var newRep = getRepresentationForQuality(newQuality);\n\n _setCurrentVoRepresentation(newRep);\n\n _addRepresentationSwitch();\n }\n\n function _setCurrentVoRepresentation(value) {\n currentVoRepresentation = value;\n }\n\n function onManifestValidityChanged(e) {\n if (e.newDuration) {\n var representation = getCurrentRepresentation();\n\n if (representation && representation.adaptation.period) {\n var period = representation.adaptation.period;\n period.duration = e.newDuration;\n }\n }\n }\n\n instance = {\n getStreamId: getStreamId,\n getType: getType,\n getData: getData,\n isUpdating: isUpdating,\n updateData: updateData,\n getCurrentRepresentation: getCurrentRepresentation,\n getRepresentationForQuality: getRepresentationForQuality,\n prepareQualityChange: prepareQualityChange,\n reset: reset\n };\n setup();\n return instance;\n}\n\nRepresentationController.__dashjs_factory_name = \'RepresentationController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"].getClassFactory(RepresentationController));\n\n/***/ }),\n\n/***/ "./src/dash/controllers/SegmentBaseController.js":\n/*!*******************************************************!*\\\n !*** ./src/dash/controllers/SegmentBaseController.js ***!\n \\*******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_758764__) {\n__nested_webpack_require_758764__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_758764__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _SegmentBaseLoader__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_758764__(/*! ../SegmentBaseLoader */ "./src/dash/SegmentBaseLoader.js");\n/* harmony import */ var _WebmSegmentBaseLoader__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_758764__(/*! ../WebmSegmentBaseLoader */ "./src/dash/WebmSegmentBaseLoader.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\nfunction SegmentBaseController(config) {\n config = config || {};\n var context = this.context;\n var eventBus = config.eventBus;\n var events = config.events;\n var dashMetrics = config.dashMetrics;\n var mediaPlayerModel = config.mediaPlayerModel;\n var errHandler = config.errHandler;\n var baseURLController = config.baseURLController;\n var debug = config.debug;\n var boxParser = config.boxParser;\n var requestModifier = config.requestModifier;\n var errors = config.errors;\n var instance, segmentBaseLoader, webmSegmentBaseLoader;\n\n function setup() {\n segmentBaseLoader = Object(_SegmentBaseLoader__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance();\n webmSegmentBaseLoader = Object(_WebmSegmentBaseLoader__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance();\n segmentBaseLoader.setConfig({\n baseURLController: baseURLController,\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n errHandler: errHandler,\n eventBus: eventBus,\n events: events,\n errors: errors,\n debug: debug,\n boxParser: boxParser,\n requestModifier: requestModifier\n });\n webmSegmentBaseLoader.setConfig({\n baseURLController: baseURLController,\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n errHandler: errHandler,\n eventBus: eventBus,\n events: events,\n errors: errors,\n debug: debug,\n requestModifier: requestModifier\n });\n }\n\n function isWebM(mimeType) {\n var type = mimeType ? mimeType.split(\'/\')[1] : \'\';\n return \'webm\' === type.toLowerCase();\n }\n\n function initialize() {\n segmentBaseLoader.initialize();\n webmSegmentBaseLoader.initialize();\n }\n\n function getSegmentBaseInitSegment(data) {\n if (isWebM(data.representation.mimeType)) {\n return webmSegmentBaseLoader.loadInitialization(data.representation, data.mediaType);\n } else {\n return segmentBaseLoader.loadInitialization(data.representation, data.mediaType);\n }\n }\n\n function getSegmentList(e) {\n if (isWebM(e.mimeType)) {\n return webmSegmentBaseLoader.loadSegments(e.representation, e.mediaType, e.representation ? e.representation.indexRange : null);\n } else {\n return segmentBaseLoader.loadSegments(e.representation, e.mediaType, e.representation ? e.representation.indexRange : null);\n }\n }\n\n function reset() {\n segmentBaseLoader.reset();\n webmSegmentBaseLoader.reset();\n }\n\n instance = {\n initialize: initialize,\n getSegmentBaseInitSegment: getSegmentBaseInitSegment,\n getSegmentList: getSegmentList,\n reset: reset\n };\n setup();\n return instance;\n}\n\nSegmentBaseController.__dashjs_factory_name = \'SegmentBaseController\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(SegmentBaseController);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/dash/controllers/SegmentsController.js":\n/*!****************************************************!*\\\n !*** ./src/dash/controllers/SegmentsController.js ***!\n \\****************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_764380__) {\n__nested_webpack_require_764380__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_764380__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _utils_TimelineSegmentsGetter__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_764380__(/*! ../utils/TimelineSegmentsGetter */ "./src/dash/utils/TimelineSegmentsGetter.js");\n/* harmony import */ var _utils_TemplateSegmentsGetter__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_764380__(/*! ../utils/TemplateSegmentsGetter */ "./src/dash/utils/TemplateSegmentsGetter.js");\n/* harmony import */ var _utils_ListSegmentsGetter__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_764380__(/*! ../utils/ListSegmentsGetter */ "./src/dash/utils/ListSegmentsGetter.js");\n/* harmony import */ var _utils_SegmentBaseGetter__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_764380__(/*! ../utils/SegmentBaseGetter */ "./src/dash/utils/SegmentBaseGetter.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\nfunction SegmentsController(config) {\n config = config || {};\n var context = this.context;\n var dashConstants = config.dashConstants;\n var type = config.type;\n var segmentBaseController = config.segmentBaseController;\n var instance, getters;\n\n function setup() {\n getters = {};\n }\n\n function initialize(isDynamic) {\n getters[dashConstants.SEGMENT_TIMELINE] = Object(_utils_TimelineSegmentsGetter__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create(config, isDynamic);\n getters[dashConstants.SEGMENT_TEMPLATE] = Object(_utils_TemplateSegmentsGetter__WEBPACK_IMPORTED_MODULE_2__["default"])(context).create(config, isDynamic);\n getters[dashConstants.SEGMENT_LIST] = Object(_utils_ListSegmentsGetter__WEBPACK_IMPORTED_MODULE_3__["default"])(context).create(config, isDynamic);\n getters[dashConstants.SEGMENT_BASE] = Object(_utils_SegmentBaseGetter__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create(config, isDynamic);\n }\n\n function updateInitData(voRepresentation, hasInitialization) {\n if (hasInitialization) {\n return Promise.resolve();\n }\n\n return segmentBaseController.getSegmentBaseInitSegment({\n representation: voRepresentation,\n mediaType: type\n });\n }\n\n function updateSegmentData(voRepresentation, hasSegments) {\n if (hasSegments) {\n return Promise.resolve();\n }\n\n return segmentBaseController.getSegmentList({\n mimeType: voRepresentation.mimeType,\n representation: voRepresentation,\n mediaType: type\n });\n }\n\n function getSegmentsGetter(representation) {\n return representation ? representation.segments ? getters[dashConstants.SEGMENT_BASE] : getters[representation.segmentInfoType] : null;\n }\n\n function getSegmentByIndex(representation, index, lastSegmentTime) {\n var getter = getSegmentsGetter(representation);\n return getter ? getter.getSegmentByIndex(representation, index, lastSegmentTime) : null;\n }\n\n function getSegmentByTime(representation, time) {\n var getter = getSegmentsGetter(representation);\n return getter ? getter.getSegmentByTime(representation, time) : null;\n }\n\n function getMediaFinishedInformation(representation) {\n var getter = getSegmentsGetter(representation);\n return getter ? getter.getMediaFinishedInformation(representation) : {\n numberOfSegments: 0,\n mediaTimeOfLastSignaledSegment: NaN\n };\n }\n\n instance = {\n initialize: initialize,\n updateInitData: updateInitData,\n updateSegmentData: updateSegmentData,\n getSegmentByIndex: getSegmentByIndex,\n getSegmentByTime: getSegmentByTime,\n getMediaFinishedInformation: getMediaFinishedInformation\n };\n setup();\n return instance;\n}\n\nSegmentsController.__dashjs_factory_name = \'SegmentsController\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(SegmentsController);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/dash/models/DashManifestModel.js":\n/*!**********************************************!*\\\n !*** ./src/dash/models/DashManifestModel.js ***!\n \\**********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_770406__) {\n__nested_webpack_require_770406__.r(__nested_webpack_exports__);\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_770406__(/*! ../../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_770406__(/*! ../constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/* harmony import */ var _vo_Representation__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_770406__(/*! ../vo/Representation */ "./src/dash/vo/Representation.js");\n/* harmony import */ var _vo_AdaptationSet__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_770406__(/*! ../vo/AdaptationSet */ "./src/dash/vo/AdaptationSet.js");\n/* harmony import */ var _vo_Period__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_770406__(/*! ../vo/Period */ "./src/dash/vo/Period.js");\n/* harmony import */ var _vo_Mpd__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_770406__(/*! ../vo/Mpd */ "./src/dash/vo/Mpd.js");\n/* harmony import */ var _vo_UTCTiming__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_770406__(/*! ../vo/UTCTiming */ "./src/dash/vo/UTCTiming.js");\n/* harmony import */ var _vo_Event__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_770406__(/*! ../vo/Event */ "./src/dash/vo/Event.js");\n/* harmony import */ var _vo_BaseURL__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_770406__(/*! ../vo/BaseURL */ "./src/dash/vo/BaseURL.js");\n/* harmony import */ var _vo_EventStream__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_770406__(/*! ../vo/EventStream */ "./src/dash/vo/EventStream.js");\n/* harmony import */ var _streaming_utils_ObjectUtils__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_770406__(/*! ../../streaming/utils/ObjectUtils */ "./src/streaming/utils/ObjectUtils.js");\n/* harmony import */ var _streaming_utils_URLUtils__WEBPACK_IMPORTED_MODULE_11__ = __nested_webpack_require_770406__(/*! ../../streaming/utils/URLUtils */ "./src/streaming/utils/URLUtils.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_12__ = __nested_webpack_require_770406__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_13__ = __nested_webpack_require_770406__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _streaming_vo_DashJSError__WEBPACK_IMPORTED_MODULE_14__ = __nested_webpack_require_770406__(/*! ../../streaming/vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_15__ = __nested_webpack_require_770406__(/*! ../../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _streaming_thumbnail_ThumbnailTracks__WEBPACK_IMPORTED_MODULE_16__ = __nested_webpack_require_770406__(/*! ../../streaming/thumbnail/ThumbnailTracks */ "./src/streaming/thumbnail/ThumbnailTracks.js");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction DashManifestModel() {\n var instance, logger, errHandler, BASE64;\n var context = this.context;\n var urlUtils = Object(_streaming_utils_URLUtils__WEBPACK_IMPORTED_MODULE_11__["default"])(context).getInstance();\n\n var isInteger = Number.isInteger || function (value) {\n return typeof value === \'number\' && isFinite(value) && Math.floor(value) === value;\n };\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_13__["default"])(context).getInstance().getLogger(instance);\n }\n\n function getIsTypeOf(adaptation, type) {\n if (!adaptation) {\n throw new Error(\'adaptation is not defined\');\n }\n\n if (!type) {\n throw new Error(\'type is not defined\');\n } // Check for thumbnail images\n\n\n if (adaptation.Representation_asArray && adaptation.Representation_asArray.length) {\n var essentialProperties = getEssentialPropertiesForRepresentation(adaptation.Representation_asArray[0]);\n\n if (essentialProperties && essentialProperties.length > 0 && _streaming_thumbnail_ThumbnailTracks__WEBPACK_IMPORTED_MODULE_16__["THUMBNAILS_SCHEME_ID_URIS"].indexOf(essentialProperties[0].schemeIdUri) >= 0) {\n return type === _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].IMAGE;\n }\n } // Check ContentComponent.contentType\n\n\n if (adaptation.ContentComponent_asArray && adaptation.ContentComponent_asArray.length > 0) {\n if (adaptation.ContentComponent_asArray.length > 1) {\n return type === _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].MUXED;\n } else if (adaptation.ContentComponent_asArray[0].contentType === type) {\n return true;\n }\n }\n\n var mimeTypeRegEx = type === _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT ? new RegExp(\'(ttml|vtt|wvtt|stpp)\') : new RegExp(type); // Check codecs\n\n if (adaptation.Representation_asArray && adaptation.Representation_asArray.length) {\n var codecs = adaptation.Representation_asArray[0].codecs;\n\n if (mimeTypeRegEx.test(codecs)) {\n return true;\n }\n } // Check Adaptation\'s mimeType\n\n\n if (adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MIME_TYPE)) {\n return mimeTypeRegEx.test(adaptation.mimeType);\n } // Check Representation\'s mimeType\n\n\n if (adaptation.Representation_asArray) {\n var representation;\n\n for (var i = 0; i < adaptation.Representation_asArray.length; i++) {\n representation = adaptation.Representation_asArray[i];\n\n if (representation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MIME_TYPE)) {\n return mimeTypeRegEx.test(representation.mimeType);\n }\n }\n }\n\n return false;\n }\n\n function getIsFragmented(adaptation) {\n if (!adaptation) {\n throw new Error(\'adaptation is not defined\');\n }\n\n if (adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TEMPLATE) || adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TIMELINE) || adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_LIST) || adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_BASE)) {\n return true;\n }\n\n if (adaptation.Representation_asArray && adaptation.Representation_asArray.length > 0) {\n var representation = adaptation.Representation_asArray[0];\n\n if (representation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TEMPLATE) || representation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TIMELINE) || representation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_LIST) || representation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_BASE)) {\n return true;\n }\n }\n\n return false;\n }\n\n function getIsAudio(adaptation) {\n return getIsTypeOf(adaptation, _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO);\n }\n\n function getIsVideo(adaptation) {\n return getIsTypeOf(adaptation, _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO);\n }\n\n function getIsText(adaptation) {\n return getIsTypeOf(adaptation, _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT);\n }\n\n function getIsMuxed(adaptation) {\n return getIsTypeOf(adaptation, _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].MUXED);\n }\n\n function getIsImage(adaptation) {\n return getIsTypeOf(adaptation, _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].IMAGE);\n }\n\n function getLanguageForAdaptation(adaptation) {\n var lang = \'\';\n\n if (adaptation && adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].LANG)) {\n //Filter out any other characters not allowed according to RFC5646\n lang = adaptation.lang.replace(/[^A-Za-z0-9-]/g, \'\');\n }\n\n return lang;\n }\n\n function getViewpointForAdaptation(adaptation) {\n return adaptation && adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VIEWPOINT) ? adaptation.Viewpoint : null;\n }\n\n function getRolesForAdaptation(adaptation) {\n return adaptation && adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ROLE_ASARRAY) ? adaptation.Role_asArray : [];\n }\n\n function getAccessibilityForAdaptation(adaptation) {\n return adaptation && adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ACCESSIBILITY_ASARRAY) ? adaptation.Accessibility_asArray : [];\n }\n\n function getAudioChannelConfigurationForAdaptation(adaptation) {\n return adaptation && adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIOCHANNELCONFIGURATION_ASARRAY) ? adaptation.AudioChannelConfiguration_asArray : [];\n }\n\n function getAudioChannelConfigurationForRepresentation(representation) {\n return representation && representation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIOCHANNELCONFIGURATION_ASARRAY) ? representation.AudioChannelConfiguration_asArray : [];\n }\n\n function getRepresentationSortFunction() {\n return function (a, b) {\n return a.bandwidth - b.bandwidth;\n };\n }\n\n function processAdaptation(realAdaptation) {\n if (realAdaptation && Array.isArray(realAdaptation.Representation_asArray)) {\n realAdaptation.Representation_asArray.sort(getRepresentationSortFunction());\n }\n\n return realAdaptation;\n }\n\n function getRealAdaptations(manifest, periodIndex) {\n return manifest && manifest.Period_asArray && isInteger(periodIndex) ? manifest.Period_asArray[periodIndex] ? manifest.Period_asArray[periodIndex].AdaptationSet_asArray : [] : [];\n }\n\n function getRealPeriods(manifest) {\n return manifest && manifest.Period_asArray ? manifest.Period_asArray : [];\n }\n\n function getRealPeriodForIndex(index, manifest) {\n var realPeriods = getRealPeriods(manifest);\n\n if (realPeriods.length > 0 && isInteger(index)) {\n return realPeriods[index];\n } else {\n return null;\n }\n }\n\n function getAdaptationForId(id, manifest, periodIndex) {\n var realAdaptations = getRealAdaptations(manifest, periodIndex);\n var i, len;\n\n for (i = 0, len = realAdaptations.length; i < len; i++) {\n if (realAdaptations[i].hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID) && realAdaptations[i].id === id) {\n return realAdaptations[i];\n }\n }\n\n return null;\n }\n\n function getAdaptationForIndex(index, manifest, periodIndex) {\n var realAdaptations = getRealAdaptations(manifest, periodIndex);\n\n if (realAdaptations.length > 0 && isInteger(index)) {\n return realAdaptations[index];\n } else {\n return null;\n }\n }\n\n function getIndexForAdaptation(realAdaptation, manifest, periodIndex) {\n if (!realAdaptation) {\n return -1;\n }\n\n var realAdaptations = getRealAdaptations(manifest, periodIndex);\n\n for (var i = 0; i < realAdaptations.length; i++) {\n var objectUtils = Object(_streaming_utils_ObjectUtils__WEBPACK_IMPORTED_MODULE_10__["default"])(context).getInstance();\n\n if (objectUtils.areEqual(realAdaptations[i], realAdaptation)) {\n return i;\n }\n }\n\n return -1;\n }\n\n function getAdaptationsForType(manifest, periodIndex, type) {\n var realAdaptations = getRealAdaptations(manifest, periodIndex);\n var i, len;\n var adaptations = [];\n\n for (i = 0, len = realAdaptations.length; i < len; i++) {\n if (getIsTypeOf(realAdaptations[i], type)) {\n adaptations.push(processAdaptation(realAdaptations[i]));\n }\n }\n\n return adaptations;\n }\n\n function getCodec(adaptation, representationId, addResolutionInfo) {\n var codec = null;\n\n if (adaptation && adaptation.Representation_asArray && adaptation.Representation_asArray.length > 0) {\n var representation = isInteger(representationId) && representationId >= 0 && representationId < adaptation.Representation_asArray.length ? adaptation.Representation_asArray[representationId] : adaptation.Representation_asArray[0];\n\n if (representation) {\n codec = representation.mimeType + \';codecs="\' + representation.codecs + \'"\';\n\n if (addResolutionInfo && representation.width !== undefined) {\n codec += \';width="\' + representation.width + \'";height="\' + representation.height + \'"\';\n }\n }\n } // If the codec contains a profiles parameter we remove it. Otherwise it will cause problems when checking for codec capabilities of the platform\n\n\n if (codec) {\n codec = codec.replace(/\\sprofiles=[^;]*/g, \'\');\n }\n\n return codec;\n }\n\n function getMimeType(adaptation) {\n return adaptation && adaptation.Representation_asArray && adaptation.Representation_asArray.length > 0 ? adaptation.Representation_asArray[0].mimeType : null;\n }\n\n function getKID(adaptation) {\n if (!adaptation || !adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CENC_DEFAULT_KID)) {\n return null;\n }\n\n return adaptation[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CENC_DEFAULT_KID];\n }\n\n function getLabelsForAdaptation(adaptation) {\n if (!adaptation || !Array.isArray(adaptation.Label_asArray)) {\n return [];\n }\n\n var labelArray = [];\n\n for (var i = 0; i < adaptation.Label_asArray.length; i++) {\n labelArray.push({\n lang: adaptation.Label_asArray[i].lang,\n text: adaptation.Label_asArray[i].__text || adaptation.Label_asArray[i]\n });\n }\n\n return labelArray;\n }\n\n function getContentProtectionData(adaptation) {\n if (!adaptation || !adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CONTENTPROTECTION_ASARRAY) || adaptation.ContentProtection_asArray.length === 0) {\n return null;\n }\n\n return adaptation.ContentProtection_asArray;\n }\n\n function getIsDynamic(manifest) {\n var isDynamic = false;\n\n if (manifest && manifest.hasOwnProperty(\'type\')) {\n isDynamic = manifest.type === _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DYNAMIC;\n }\n\n return isDynamic;\n }\n\n function getId(manifest) {\n return manifest && manifest[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID] || null;\n }\n\n function hasProfile(manifest, profile) {\n var has = false;\n\n if (manifest && manifest.profiles && manifest.profiles.length > 0) {\n has = manifest.profiles.indexOf(profile) !== -1;\n }\n\n return has;\n }\n\n function getDuration(manifest) {\n var mpdDuration; //@mediaPresentationDuration specifies the duration of the entire Media Presentation.\n //If the attribute is not present, the duration of the Media Presentation is unknown.\n\n if (manifest && manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MEDIA_PRESENTATION_DURATION)) {\n mpdDuration = manifest.mediaPresentationDuration;\n } else if (manifest && manifest.type == \'dynamic\') {\n mpdDuration = Number.POSITIVE_INFINITY;\n } else {\n mpdDuration = Number.MAX_SAFE_INTEGER || Number.MAX_VALUE;\n }\n\n return mpdDuration;\n }\n\n function getBandwidth(representation) {\n return representation && representation.bandwidth ? representation.bandwidth : NaN;\n }\n\n function getManifestUpdatePeriod(manifest) {\n var latencyOfLastUpdate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var delay = NaN;\n\n if (manifest && manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MINIMUM_UPDATE_PERIOD)) {\n delay = manifest.minimumUpdatePeriod;\n }\n\n return isNaN(delay) ? delay : Math.max(delay - latencyOfLastUpdate, 1);\n }\n\n function getPublishTime(manifest) {\n return manifest && manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PUBLISH_TIME) ? new Date(manifest[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PUBLISH_TIME]) : null;\n }\n\n function getRepresentationCount(adaptation) {\n return adaptation && Array.isArray(adaptation.Representation_asArray) ? adaptation.Representation_asArray.length : 0;\n }\n\n function getBitrateListForAdaptation(realAdaptation) {\n var processedRealAdaptation = processAdaptation(realAdaptation);\n var realRepresentations = processedRealAdaptation && Array.isArray(processedRealAdaptation.Representation_asArray) ? processedRealAdaptation.Representation_asArray : [];\n return realRepresentations.map(function (realRepresentation) {\n return {\n bandwidth: realRepresentation.bandwidth,\n width: realRepresentation.width || 0,\n height: realRepresentation.height || 0,\n scanType: realRepresentation.scanType || null,\n id: realRepresentation.id || null\n };\n });\n }\n\n function getSelectionPriority(realAdaption) {\n try {\n var priority = realAdaption && typeof realAdaption.selectionPriority !== \'undefined\' ? parseInt(realAdaption.selectionPriority) : 1;\n return isNaN(priority) ? 1 : priority;\n } catch (e) {\n return 1;\n }\n }\n\n function getEssentialPropertiesForRepresentation(realRepresentation) {\n if (!realRepresentation || !realRepresentation.EssentialProperty_asArray || !realRepresentation.EssentialProperty_asArray.length) return null;\n return realRepresentation.EssentialProperty_asArray.map(function (prop) {\n return {\n schemeIdUri: prop.schemeIdUri,\n value: prop.value\n };\n });\n }\n\n function getRepresentationFor(index, adaptation) {\n return adaptation && adaptation.Representation_asArray && adaptation.Representation_asArray.length > 0 && isInteger(index) ? adaptation.Representation_asArray[index] : null;\n }\n\n function getRealAdaptationFor(voAdaptation) {\n if (voAdaptation && voAdaptation.period && isInteger(voAdaptation.period.index)) {\n var periodArray = voAdaptation.period.mpd.manifest.Period_asArray[voAdaptation.period.index];\n\n if (periodArray && periodArray.AdaptationSet_asArray && isInteger(voAdaptation.index)) {\n return processAdaptation(periodArray.AdaptationSet_asArray[voAdaptation.index]);\n }\n }\n }\n\n function getRepresentationsForAdaptation(voAdaptation) {\n var voRepresentations = [];\n var processedRealAdaptation = getRealAdaptationFor(voAdaptation);\n var segmentInfo, baseUrl;\n\n if (processedRealAdaptation && processedRealAdaptation.Representation_asArray) {\n // TODO: TO BE REMOVED. We should get just the baseUrl elements that affects to the representations\n // that we are processing. Making it works properly will require much further changes and given\n // parsing base Urls parameters is needed for our ultra low latency examples, we will\n // keep this "tricky" code until the real (and good) solution comes\n if (voAdaptation && voAdaptation.period && isInteger(voAdaptation.period.index)) {\n var baseUrls = getBaseURLsFromElement(voAdaptation.period.mpd.manifest);\n\n if (baseUrls) {\n baseUrl = baseUrls[0];\n }\n }\n\n for (var i = 0, len = processedRealAdaptation.Representation_asArray.length; i < len; ++i) {\n var realRepresentation = processedRealAdaptation.Representation_asArray[i];\n var voRepresentation = new _vo_Representation__WEBPACK_IMPORTED_MODULE_2__["default"]();\n voRepresentation.index = i;\n voRepresentation.adaptation = voAdaptation;\n\n if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID)) {\n voRepresentation.id = realRepresentation.id;\n }\n\n if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CODECS)) {\n voRepresentation.codecs = realRepresentation.codecs;\n }\n\n if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MIME_TYPE)) {\n voRepresentation.mimeType = realRepresentation[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MIME_TYPE];\n }\n\n if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CODEC_PRIVATE_DATA)) {\n voRepresentation.codecPrivateData = realRepresentation.codecPrivateData;\n }\n\n if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BANDWITH)) {\n voRepresentation.bandwidth = realRepresentation.bandwidth;\n }\n\n if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].WIDTH)) {\n voRepresentation.width = realRepresentation.width;\n }\n\n if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].HEIGHT)) {\n voRepresentation.height = realRepresentation.height;\n }\n\n if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SCAN_TYPE)) {\n voRepresentation.scanType = realRepresentation.scanType;\n }\n\n if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MAX_PLAYOUT_RATE)) {\n voRepresentation.maxPlayoutRate = realRepresentation.maxPlayoutRate;\n }\n\n if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_BASE)) {\n segmentInfo = realRepresentation.SegmentBase;\n voRepresentation.segmentInfoType = _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_BASE;\n } else if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_LIST)) {\n segmentInfo = realRepresentation.SegmentList;\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TIMELINE)) {\n voRepresentation.segmentInfoType = _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TIMELINE;\n } else {\n voRepresentation.segmentInfoType = _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_LIST;\n }\n } else if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TEMPLATE)) {\n segmentInfo = realRepresentation.SegmentTemplate;\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TIMELINE)) {\n voRepresentation.segmentInfoType = _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TIMELINE;\n } else {\n voRepresentation.segmentInfoType = _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TEMPLATE;\n }\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INITIALIZATION_MINUS)) {\n voRepresentation.initialization = segmentInfo.initialization.split(\'$Bandwidth$\').join(realRepresentation.bandwidth).split(\'$RepresentationID$\').join(realRepresentation.id);\n }\n } else {\n voRepresentation.segmentInfoType = _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BASE_URL;\n }\n\n voRepresentation.essentialProperties = getEssentialPropertiesForRepresentation(realRepresentation);\n\n if (segmentInfo) {\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INITIALIZATION)) {\n var initialization = segmentInfo.Initialization;\n\n if (initialization.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SOURCE_URL)) {\n voRepresentation.initialization = initialization.sourceURL;\n }\n\n if (initialization.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].RANGE)) {\n voRepresentation.range = initialization.range; // initialization source url will be determined from\n // BaseURL when resolved at load time.\n }\n } else if (getIsText(processedRealAdaptation) && getIsFragmented(processedRealAdaptation) && processedRealAdaptation.mimeType && processedRealAdaptation.mimeType.indexOf(\'application/mp4\') === -1) {\n voRepresentation.range = 0;\n }\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].TIMESCALE)) {\n voRepresentation.timescale = segmentInfo.timescale;\n }\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DURATION)) {\n // TODO according to the spec @maxSegmentDuration specifies the maximum duration of any Segment in any Representation in the Media Presentation\n // It is also said that for a SegmentTimeline any @d value shall not exceed the value of MPD@maxSegmentDuration, but nothing is said about\n // SegmentTemplate @duration attribute. We need to find out if @maxSegmentDuration should be used instead of calculated duration if the the duration\n // exceeds @maxSegmentDuration\n voRepresentation.segmentDuration = segmentInfo.duration / voRepresentation.timescale;\n } else if (realRepresentation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TEMPLATE)) {\n segmentInfo = realRepresentation.SegmentTemplate;\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TIMELINE)) {\n voRepresentation.segmentDuration = calcSegmentDuration(segmentInfo.SegmentTimeline) / voRepresentation.timescale;\n }\n }\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MEDIA)) {\n voRepresentation.media = segmentInfo.media;\n }\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].START_NUMBER)) {\n voRepresentation.startNumber = segmentInfo.startNumber;\n }\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INDEX_RANGE)) {\n voRepresentation.indexRange = segmentInfo.indexRange;\n }\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PRESENTATION_TIME_OFFSET)) {\n voRepresentation.presentationTimeOffset = segmentInfo.presentationTimeOffset / voRepresentation.timescale;\n }\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AVAILABILITY_TIME_OFFSET)) {\n voRepresentation.availabilityTimeOffset = segmentInfo.availabilityTimeOffset;\n } else if (baseUrl && baseUrl.availabilityTimeOffset !== undefined) {\n voRepresentation.availabilityTimeOffset = baseUrl.availabilityTimeOffset;\n }\n\n if (segmentInfo.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AVAILABILITY_TIME_COMPLETE)) {\n voRepresentation.availabilityTimeComplete = segmentInfo.availabilityTimeComplete !== \'false\';\n } else if (baseUrl && baseUrl.availabilityTimeComplete !== undefined) {\n voRepresentation.availabilityTimeComplete = baseUrl.availabilityTimeComplete;\n }\n }\n\n voRepresentation.MSETimeOffset = calcMSETimeOffset(voRepresentation);\n voRepresentation.path = [voAdaptation.period.index, voAdaptation.index, i];\n voRepresentations.push(voRepresentation);\n }\n }\n\n return voRepresentations;\n }\n\n function calcSegmentDuration(segmentTimeline) {\n if (!segmentTimeline || !segmentTimeline.S_asArray) {\n return NaN;\n }\n\n var s0 = segmentTimeline.S_asArray[0];\n var s1 = segmentTimeline.S_asArray[1];\n return s0.hasOwnProperty(\'d\') ? s0.d : s1.t - s0.t;\n }\n\n function calcMSETimeOffset(representation) {\n // The MSEOffset is offset from AST for media. It is Period@start - presentationTimeOffset\n var presentationOffset = representation.presentationTimeOffset;\n var periodStart = representation.adaptation.period.start;\n return periodStart - presentationOffset;\n }\n\n function getAdaptationsForPeriod(voPeriod) {\n var realPeriod = voPeriod && isInteger(voPeriod.index) ? voPeriod.mpd.manifest.Period_asArray[voPeriod.index] : null;\n var voAdaptations = [];\n var voAdaptationSet, realAdaptationSet, i;\n\n if (realPeriod && realPeriod.AdaptationSet_asArray) {\n for (i = 0; i < realPeriod.AdaptationSet_asArray.length; i++) {\n realAdaptationSet = realPeriod.AdaptationSet_asArray[i];\n voAdaptationSet = new _vo_AdaptationSet__WEBPACK_IMPORTED_MODULE_3__["default"]();\n\n if (realAdaptationSet.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID)) {\n voAdaptationSet.id = realAdaptationSet.id;\n }\n\n voAdaptationSet.index = i;\n voAdaptationSet.period = voPeriod;\n\n if (getIsMuxed(realAdaptationSet)) {\n voAdaptationSet.type = _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].MUXED;\n } else if (getIsAudio(realAdaptationSet)) {\n voAdaptationSet.type = _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO;\n } else if (getIsVideo(realAdaptationSet)) {\n voAdaptationSet.type = _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO;\n } else if (getIsText(realAdaptationSet)) {\n voAdaptationSet.type = _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT;\n } else if (getIsImage(realAdaptationSet)) {\n voAdaptationSet.type = _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].IMAGE;\n } else {\n logger.warn(\'Unknown Adaptation stream type\');\n }\n\n voAdaptations.push(voAdaptationSet);\n }\n }\n\n return voAdaptations;\n }\n\n function getRegularPeriods(mpd) {\n var isDynamic = mpd ? getIsDynamic(mpd.manifest) : false;\n var voPeriods = [];\n var realPreviousPeriod = null;\n var realPeriod = null;\n var voPreviousPeriod = null;\n var voPeriod = null;\n var len, i;\n\n for (i = 0, len = mpd && mpd.manifest && mpd.manifest.Period_asArray ? mpd.manifest.Period_asArray.length : 0; i < len; i++) {\n realPeriod = mpd.manifest.Period_asArray[i]; // If the attribute @start is present in the Period, then the\n // Period is a regular Period and the PeriodStart is equal\n // to the value of this attribute.\n\n if (realPeriod.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].START)) {\n voPeriod = new _vo_Period__WEBPACK_IMPORTED_MODULE_4__["default"]();\n voPeriod.start = realPeriod.start;\n } // If the @start attribute is absent, but the previous Period\n // element contains a @duration attribute then then this new\n // Period is also a regular Period. The start time of the new\n // Period PeriodStart is the sum of the start time of the previous\n // Period PeriodStart and the value of the attribute @duration\n // of the previous Period.\n else if (realPreviousPeriod !== null && realPreviousPeriod.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DURATION) && voPreviousPeriod !== null) {\n voPeriod = new _vo_Period__WEBPACK_IMPORTED_MODULE_4__["default"]();\n voPeriod.start = parseFloat((voPreviousPeriod.start + voPreviousPeriod.duration).toFixed(5));\n } // If (i) @start attribute is absent, and (ii) the Period element\n // is the first in the MPD, and (iii) the MPD@type is \'static\',\n // then the PeriodStart time shall be set to zero.\n else if (i === 0 && !isDynamic) {\n voPeriod = new _vo_Period__WEBPACK_IMPORTED_MODULE_4__["default"]();\n voPeriod.start = 0;\n } // The Period extends until the PeriodStart of the next Period.\n // The difference between the PeriodStart time of a Period and\n // the PeriodStart time of the following Period.\n\n\n if (voPreviousPeriod !== null && isNaN(voPreviousPeriod.duration)) {\n if (voPeriod !== null) {\n voPreviousPeriod.duration = parseFloat((voPeriod.start - voPreviousPeriod.start).toFixed(5));\n } else {\n logger.warn(\'First period duration could not be calculated because lack of start and duration period properties. This will cause timing issues during playback\');\n }\n }\n\n if (voPeriod !== null) {\n voPeriod.id = getPeriodId(realPeriod, i);\n voPeriod.index = i;\n voPeriod.mpd = mpd;\n\n if (realPeriod.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DURATION)) {\n voPeriod.duration = realPeriod.duration;\n }\n\n if (voPreviousPeriod) {\n voPreviousPeriod.nextPeriodId = voPeriod.id;\n }\n\n voPeriods.push(voPeriod);\n realPreviousPeriod = realPeriod;\n voPreviousPeriod = voPeriod;\n }\n\n realPeriod = null;\n voPeriod = null;\n }\n\n if (voPeriods.length === 0) {\n return voPeriods;\n } // The last Period extends until the end of the Media Presentation.\n // The difference between the PeriodStart time of the last Period\n // and the mpd duration\n\n\n if (voPreviousPeriod !== null && isNaN(voPreviousPeriod.duration)) {\n voPreviousPeriod.duration = parseFloat((getEndTimeForLastPeriod(voPreviousPeriod) - voPreviousPeriod.start).toFixed(5));\n }\n\n return voPeriods;\n }\n\n function getPeriodId(realPeriod, i) {\n if (!realPeriod) {\n throw new Error(\'Period cannot be null or undefined\');\n }\n\n var id = _vo_Period__WEBPACK_IMPORTED_MODULE_4__["default"].DEFAULT_ID + \'_\' + i;\n\n if (realPeriod.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID) && realPeriod.id.length > 0 && realPeriod.id !== \'__proto__\') {\n id = realPeriod.id;\n }\n\n return id;\n }\n\n function getMpd(manifest) {\n var mpd = new _vo_Mpd__WEBPACK_IMPORTED_MODULE_5__["default"]();\n\n if (manifest) {\n mpd.manifest = manifest;\n\n if (manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AVAILABILITY_START_TIME)) {\n mpd.availabilityStartTime = new Date(manifest.availabilityStartTime.getTime());\n } else {\n if (manifest.loadedTime) {\n mpd.availabilityStartTime = new Date(manifest.loadedTime.getTime());\n }\n }\n\n if (manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AVAILABILITY_END_TIME)) {\n mpd.availabilityEndTime = new Date(manifest.availabilityEndTime.getTime());\n }\n\n if (manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MINIMUM_UPDATE_PERIOD)) {\n mpd.minimumUpdatePeriod = manifest.minimumUpdatePeriod;\n }\n\n if (manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MEDIA_PRESENTATION_DURATION)) {\n mpd.mediaPresentationDuration = manifest.mediaPresentationDuration;\n }\n\n if (manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SUGGESTED_PRESENTATION_DELAY)) {\n mpd.suggestedPresentationDelay = manifest.suggestedPresentationDelay;\n }\n\n if (manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].TIMESHIFT_BUFFER_DEPTH)) {\n mpd.timeShiftBufferDepth = manifest.timeShiftBufferDepth;\n }\n\n if (manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MAX_SEGMENT_DURATION)) {\n mpd.maxSegmentDuration = manifest.maxSegmentDuration;\n }\n\n if (manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PUBLISH_TIME)) {\n mpd.publishTime = new Date(manifest.publishTime);\n }\n }\n\n return mpd;\n }\n\n function checkConfig() {\n if (!errHandler || !errHandler.hasOwnProperty(\'error\')) {\n throw new Error(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].MISSING_CONFIG_ERROR);\n }\n }\n\n function getEndTimeForLastPeriod(voPeriod) {\n checkConfig();\n var isDynamic = getIsDynamic(voPeriod.mpd.manifest);\n var periodEnd;\n\n if (voPeriod.mpd.manifest.mediaPresentationDuration) {\n periodEnd = voPeriod.mpd.manifest.mediaPresentationDuration;\n } else if (voPeriod.duration) {\n periodEnd = voPeriod.duration;\n } else if (isDynamic) {\n periodEnd = Number.POSITIVE_INFINITY;\n } else {\n errHandler.error(new _streaming_vo_DashJSError__WEBPACK_IMPORTED_MODULE_14__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_15__["default"].MANIFEST_ERROR_ID_PARSE_CODE, \'Must have @mediaPresentationDuration on MPD or an explicit @duration on the last period.\', voPeriod));\n }\n\n return periodEnd;\n }\n\n function getEventsForPeriod(period) {\n var manifest = period && period.mpd && period.mpd.manifest ? period.mpd.manifest : null;\n var periodArray = manifest ? manifest.Period_asArray : null;\n var eventStreams = periodArray && period && isInteger(period.index) ? periodArray[period.index].EventStream_asArray : null;\n var events = [];\n var i, j;\n\n if (eventStreams) {\n for (i = 0; i < eventStreams.length; i++) {\n var eventStream = new _vo_EventStream__WEBPACK_IMPORTED_MODULE_9__["default"]();\n eventStream.period = period;\n eventStream.timescale = 1;\n\n if (eventStreams[i].hasOwnProperty(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCHEME_ID_URI)) {\n eventStream.schemeIdUri = eventStreams[i][_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCHEME_ID_URI];\n } else {\n throw new Error(\'Invalid EventStream. SchemeIdUri has to be set\');\n }\n\n if (eventStreams[i].hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].TIMESCALE)) {\n eventStream.timescale = eventStreams[i][_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].TIMESCALE];\n }\n\n if (eventStreams[i].hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE)) {\n eventStream.value = eventStreams[i][_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE];\n }\n\n if (eventStreams[i].hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PRESENTATION_TIME_OFFSET)) {\n eventStream.presentationTimeOffset = eventStreams[i][_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PRESENTATION_TIME_OFFSET];\n }\n\n for (j = 0; eventStreams[i].Event_asArray && j < eventStreams[i].Event_asArray.length; j++) {\n var currentMpdEvent = eventStreams[i].Event_asArray[j];\n var event = new _vo_Event__WEBPACK_IMPORTED_MODULE_7__["default"]();\n event.presentationTime = 0;\n event.eventStream = eventStream;\n\n if (currentMpdEvent.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PRESENTATION_TIME)) {\n event.presentationTime = currentMpdEvent.presentationTime;\n var presentationTimeOffset = eventStream.presentationTimeOffset ? eventStream.presentationTimeOffset / eventStream.timescale : 0;\n event.calculatedPresentationTime = event.presentationTime / eventStream.timescale + period.start - presentationTimeOffset;\n }\n\n if (currentMpdEvent.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DURATION)) {\n event.duration = currentMpdEvent.duration / eventStream.timescale;\n }\n\n if (currentMpdEvent.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID)) {\n event.id = currentMpdEvent.id;\n }\n\n if (currentMpdEvent.Signal && currentMpdEvent.Signal.Binary) {\n // toString is used to manage both regular and namespaced tags\n event.messageData = BASE64.decodeArray(currentMpdEvent.Signal.Binary.toString());\n } else {\n // From Cor.1: \'NOTE: this attribute is an alternative\n // to specifying a complete XML element(s) in the Event.\n // It is useful when an event leans itself to a compact\n // string representation\'.\n event.messageData = currentMpdEvent.messageData || currentMpdEvent.__text;\n }\n\n events.push(event);\n }\n }\n }\n\n return events;\n }\n\n function getEventStreams(inbandStreams, representation) {\n var eventStreams = [];\n var i;\n if (!inbandStreams) return eventStreams;\n\n for (i = 0; i < inbandStreams.length; i++) {\n var eventStream = new _vo_EventStream__WEBPACK_IMPORTED_MODULE_9__["default"]();\n eventStream.timescale = 1;\n eventStream.representation = representation;\n\n if (inbandStreams[i].hasOwnProperty(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCHEME_ID_URI)) {\n eventStream.schemeIdUri = inbandStreams[i].schemeIdUri;\n } else {\n throw new Error(\'Invalid EventStream. SchemeIdUri has to be set\');\n }\n\n if (inbandStreams[i].hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].TIMESCALE)) {\n eventStream.timescale = inbandStreams[i].timescale;\n }\n\n if (inbandStreams[i].hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE)) {\n eventStream.value = inbandStreams[i].value;\n }\n\n eventStreams.push(eventStream);\n }\n\n return eventStreams;\n }\n\n function getEventStreamForAdaptationSet(manifest, adaptation) {\n var inbandStreams, periodArray, adaptationArray;\n\n if (manifest && manifest.Period_asArray && adaptation && adaptation.period && isInteger(adaptation.period.index)) {\n periodArray = manifest.Period_asArray[adaptation.period.index];\n\n if (periodArray && periodArray.AdaptationSet_asArray && isInteger(adaptation.index)) {\n adaptationArray = periodArray.AdaptationSet_asArray[adaptation.index];\n\n if (adaptationArray) {\n inbandStreams = adaptationArray.InbandEventStream_asArray;\n }\n }\n }\n\n return getEventStreams(inbandStreams, null);\n }\n\n function getEventStreamForRepresentation(manifest, representation) {\n var inbandStreams, periodArray, adaptationArray, representationArray;\n\n if (manifest && manifest.Period_asArray && representation && representation.adaptation && representation.adaptation.period && isInteger(representation.adaptation.period.index)) {\n periodArray = manifest.Period_asArray[representation.adaptation.period.index];\n\n if (periodArray && periodArray.AdaptationSet_asArray && isInteger(representation.adaptation.index)) {\n adaptationArray = periodArray.AdaptationSet_asArray[representation.adaptation.index];\n\n if (adaptationArray && adaptationArray.Representation_asArray && isInteger(representation.index)) {\n representationArray = adaptationArray.Representation_asArray[representation.index];\n\n if (representationArray) {\n inbandStreams = representationArray.InbandEventStream_asArray;\n }\n }\n }\n }\n\n return getEventStreams(inbandStreams, representation);\n }\n\n function getUTCTimingSources(manifest) {\n var isDynamic = getIsDynamic(manifest);\n var hasAST = manifest ? manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AVAILABILITY_START_TIME) : false;\n var utcTimingsArray = manifest ? manifest.UTCTiming_asArray : null;\n var utcTimingEntries = []; // do not bother synchronizing the clock unless MPD is live,\n // or it is static and has availabilityStartTime attribute\n\n if (isDynamic || hasAST) {\n if (utcTimingsArray) {\n // the order is important here - 23009-1 states that the order\n // in the manifest "indicates relative preference, first having\n // the highest, and the last the lowest priority".\n utcTimingsArray.forEach(function (utcTiming) {\n var entry = new _vo_UTCTiming__WEBPACK_IMPORTED_MODULE_6__["default"]();\n\n if (utcTiming.hasOwnProperty(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCHEME_ID_URI)) {\n entry.schemeIdUri = utcTiming.schemeIdUri;\n } else {\n // entries of type DescriptorType with no schemeIdUri\n // are meaningless. let\'s just ignore this entry and\n // move on.\n return;\n } // this is (incorrectly) interpreted as a number - schema\n // defines it as a string\n\n\n if (utcTiming.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE)) {\n entry.value = utcTiming.value.toString();\n } else {\n // without a value, there\'s not a lot we can do with\n // this entry. let\'s just ignore this one and move on\n return;\n } // we\'re not interested in the optional id or any other\n // attributes which might be attached to the entry\n\n\n utcTimingEntries.push(entry);\n });\n }\n }\n\n return utcTimingEntries;\n }\n\n function getBaseURLsFromElement(node) {\n var baseUrls = []; // if node.BaseURL_asArray and node.baseUri are undefined entries\n // will be [undefined] which entries.some will just skip\n\n var entries = node.BaseURL_asArray || [node.baseUri];\n var earlyReturn = false;\n entries.some(function (entry) {\n if (entry) {\n var baseUrl = new _vo_BaseURL__WEBPACK_IMPORTED_MODULE_8__["default"]();\n var text = entry.__text || entry;\n\n if (urlUtils.isRelative(text)) {\n // it doesn\'t really make sense to have relative and\n // absolute URLs at the same level, or multiple\n // relative URLs at the same level, so assume we are\n // done from this level of the MPD\n earlyReturn = true; // deal with the specific case where the MPD@BaseURL\n // is specified and is relative. when no MPD@BaseURL\n // entries exist, that case is handled by the\n // [node.baseUri] in the entries definition.\n\n if (node.baseUri) {\n text = urlUtils.resolve(text, node.baseUri);\n }\n }\n\n baseUrl.url = text; // serviceLocation is optional, but we need it in order\n // to blacklist correctly. if it\'s not available, use\n // anything unique since there\'s no relationship to any\n // other BaseURL and, in theory, the url should be\n // unique so use this instead.\n\n if (entry.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SERVICE_LOCATION) && entry.serviceLocation.length) {\n baseUrl.serviceLocation = entry.serviceLocation;\n } else {\n baseUrl.serviceLocation = text;\n }\n\n if (entry.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DVB_PRIORITY)) {\n baseUrl.dvb_priority = entry[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DVB_PRIORITY];\n }\n\n if (entry.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DVB_WEIGHT)) {\n baseUrl.dvb_weight = entry[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DVB_WEIGHT];\n }\n\n if (entry.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AVAILABILITY_TIME_OFFSET)) {\n baseUrl.availabilityTimeOffset = entry[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AVAILABILITY_TIME_OFFSET];\n }\n\n if (entry.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AVAILABILITY_TIME_COMPLETE)) {\n baseUrl.availabilityTimeComplete = entry[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AVAILABILITY_TIME_COMPLETE] !== \'false\';\n }\n /* NOTE: byteRange currently unused\n */\n\n\n baseUrls.push(baseUrl);\n return earlyReturn;\n }\n });\n return baseUrls;\n }\n\n function getLocation(manifest) {\n if (manifest && manifest.hasOwnProperty(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].LOCATION)) {\n // for now, do not support multiple Locations -\n // just set Location to the first Location.\n manifest.Location = manifest.Location_asArray[0];\n return manifest.Location;\n } // may well be undefined\n\n\n return undefined;\n }\n\n function getPatchLocation(manifest) {\n if (manifest && manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PATCH_LOCATION)) {\n // only include support for single patch location currently\n manifest.PatchLocation = manifest.PatchLocation_asArray[0];\n return manifest.PatchLocation;\n } // no patch location provided\n\n\n return undefined;\n }\n\n function getSuggestedPresentationDelay(mpd) {\n return mpd && mpd.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SUGGESTED_PRESENTATION_DELAY) ? mpd.suggestedPresentationDelay : null;\n }\n\n function getAvailabilityStartTime(mpd) {\n return mpd && mpd.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AVAILABILITY_START_TIME) && mpd.availabilityStartTime !== null ? mpd.availabilityStartTime.getTime() : null;\n }\n\n function getServiceDescriptions(manifest) {\n var serviceDescriptions = [];\n\n if (manifest && manifest.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SERVICE_DESCRIPTION)) {\n var _iterator = _createForOfIteratorHelper(manifest.ServiceDescription_asArray),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var sd = _step.value;\n // Convert each of the properties defined in\n var id = void 0,\n schemeIdUri = void 0,\n latency = void 0,\n playbackRate = void 0;\n\n for (var prop in sd) {\n if (sd.hasOwnProperty(prop)) {\n if (prop === _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID) {\n id = sd[prop];\n } else if (prop === _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SERVICE_DESCRIPTION_SCOPE) {\n schemeIdUri = sd[prop].schemeIdUri;\n } else if (prop === _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SERVICE_DESCRIPTION_LATENCY) {\n latency = {\n target: sd[prop].target,\n max: sd[prop].max,\n min: sd[prop].min\n };\n } else if (prop === _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SERVICE_DESCRIPTION_PLAYBACK_RATE) {\n playbackRate = {\n max: sd[prop].max,\n min: sd[prop].min\n };\n }\n }\n } // we have a ServiceDescription for low latency. Add it if it really has parameters defined\n\n\n if (schemeIdUri === _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].SERVICE_DESCRIPTION_LL_SCHEME && (latency || playbackRate)) {\n serviceDescriptions.push({\n id: id,\n schemeIdUri: schemeIdUri,\n latency: latency,\n playbackRate: playbackRate\n });\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n }\n\n return serviceDescriptions;\n }\n\n function getSupplementalProperties(adaptation) {\n var supplementalProperties = {};\n\n if (adaptation && adaptation.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SUPPLEMENTAL_PROPERTY)) {\n var _iterator2 = _createForOfIteratorHelper(adaptation.SupplementalProperty_asArray),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var sp = _step2.value;\n\n if (sp.hasOwnProperty(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCHEME_ID_URI) && sp.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE)) {\n supplementalProperties[sp[_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCHEME_ID_URI]] = sp[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE];\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n\n return supplementalProperties;\n }\n\n function setConfig(config) {\n if (!config) return;\n\n if (config.errHandler) {\n errHandler = config.errHandler;\n }\n\n if (config.BASE64) {\n BASE64 = config.BASE64;\n }\n }\n\n instance = {\n getIsTypeOf: getIsTypeOf,\n getIsText: getIsText,\n getIsFragmented: getIsFragmented,\n getLanguageForAdaptation: getLanguageForAdaptation,\n getViewpointForAdaptation: getViewpointForAdaptation,\n getRolesForAdaptation: getRolesForAdaptation,\n getAccessibilityForAdaptation: getAccessibilityForAdaptation,\n getAudioChannelConfigurationForAdaptation: getAudioChannelConfigurationForAdaptation,\n getAudioChannelConfigurationForRepresentation: getAudioChannelConfigurationForRepresentation,\n getAdaptationForIndex: getAdaptationForIndex,\n getIndexForAdaptation: getIndexForAdaptation,\n getAdaptationForId: getAdaptationForId,\n getAdaptationsForType: getAdaptationsForType,\n getRealPeriods: getRealPeriods,\n getRealPeriodForIndex: getRealPeriodForIndex,\n getCodec: getCodec,\n getSelectionPriority: getSelectionPriority,\n getMimeType: getMimeType,\n getKID: getKID,\n getLabelsForAdaptation: getLabelsForAdaptation,\n getContentProtectionData: getContentProtectionData,\n getIsDynamic: getIsDynamic,\n getId: getId,\n hasProfile: hasProfile,\n getDuration: getDuration,\n getBandwidth: getBandwidth,\n getManifestUpdatePeriod: getManifestUpdatePeriod,\n getPublishTime: getPublishTime,\n getRepresentationCount: getRepresentationCount,\n getBitrateListForAdaptation: getBitrateListForAdaptation,\n getRepresentationFor: getRepresentationFor,\n getRepresentationsForAdaptation: getRepresentationsForAdaptation,\n getAdaptationsForPeriod: getAdaptationsForPeriod,\n getRegularPeriods: getRegularPeriods,\n getMpd: getMpd,\n getEventsForPeriod: getEventsForPeriod,\n getEssentialPropertiesForRepresentation: getEssentialPropertiesForRepresentation,\n getEventStreamForAdaptationSet: getEventStreamForAdaptationSet,\n getEventStreamForRepresentation: getEventStreamForRepresentation,\n getUTCTimingSources: getUTCTimingSources,\n getBaseURLsFromElement: getBaseURLsFromElement,\n getRepresentationSortFunction: getRepresentationSortFunction,\n getLocation: getLocation,\n getPatchLocation: getPatchLocation,\n getSuggestedPresentationDelay: getSuggestedPresentationDelay,\n getAvailabilityStartTime: getAvailabilityStartTime,\n getServiceDescriptions: getServiceDescriptions,\n getSupplementalProperties: getSupplementalProperties,\n setConfig: setConfig\n };\n setup();\n return instance;\n}\n\nDashManifestModel.__dashjs_factory_name = \'DashManifestModel\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_12__["default"].getSingletonFactory(DashManifestModel));\n\n/***/ }),\n\n/***/ "./src/dash/models/PatchManifestModel.js":\n/*!***********************************************!*\\\n !*** ./src/dash/models/PatchManifestModel.js ***!\n \\***********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_830231__) {\n__nested_webpack_require_830231__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_830231__(/*! ../constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_830231__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_830231__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _vo_SimpleXPath__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_830231__(/*! ../vo/SimpleXPath */ "./src/dash/vo/SimpleXPath.js");\n/* harmony import */ var _vo_PatchOperation__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_830231__(/*! ../vo/PatchOperation */ "./src/dash/vo/PatchOperation.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\nfunction PatchManifestModel() {\n var instance, logger;\n var context = this.context;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance().getLogger(instance);\n }\n\n function getIsPatch(patch) {\n return patch && patch.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__["default"].ORIGINAL_MPD_ID) || false;\n }\n\n function getPublishTime(patch) {\n return patch && patch.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__["default"].PUBLISH_TIME) ? new Date(patch[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__["default"].PUBLISH_TIME]) : null;\n }\n\n function getOriginalPublishTime(patch) {\n return patch && patch.hasOwnProperty(_constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__["default"].ORIGINAL_PUBLISH_TIME) ? new Date(patch[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__["default"].ORIGINAL_PUBLISH_TIME]) : null;\n }\n\n function getMpdId(patch) {\n return patch && patch[_constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__["default"].ORIGINAL_MPD_ID] || null;\n }\n\n function getPatchOperations(patch) {\n if (!patch) {\n return [];\n } // Go through the patch operations in order and parse their actions out for usage\n\n\n return (patch.__children || []).map(function (nodeContainer) {\n var action = Object.keys(nodeContainer)[0]; // we only look add add/remove/replace actions\n\n if (action !== \'add\' && action !== \'remove\' && action !== \'replace\') {\n logger.warn("Ignoring node of invalid action: ".concat(action));\n return null;\n }\n\n var node = nodeContainer[action];\n var selector = node.sel; // add action can have special targeting via the \'type\' attribute\n\n if (action === \'add\' && node.type) {\n if (!node.type.startsWith(\'@\')) {\n logger.warn("Ignoring add action for prefixed namespace declaration: ".concat(node.type, "=").concat(node.__text));\n return null;\n } // for our purposes adding/replacing attribute are equivalent and we can normalize\n // our processing logic by appending the attribute to the selector path\n\n\n selector = "".concat(selector, "/").concat(node.type);\n }\n\n var xpath = new _vo_SimpleXPath__WEBPACK_IMPORTED_MODULE_3__["default"](selector);\n\n if (!xpath.isValid()) {\n logger.warn("Ignoring action with invalid selector: ".concat(action, " - ").concat(selector));\n return null;\n }\n\n var value = null;\n\n if (xpath.findsAttribute()) {\n value = node.__text || \'\';\n } else if (action !== \'remove\') {\n value = node.__children.reduce(function (groups, child) {\n // note that this is informed by xml2js parse structure for the __children array\n // which will be something like this for each child:\n // {\n // "<node-name>": { <xml2js-node-object> }\n // }\n var key = Object.keys(child)[0]; // we also ignore\n\n if (key !== \'#text\') {\n groups[key] = groups[key] || [];\n groups[key].push(child[key]);\n }\n\n return groups;\n }, {});\n }\n\n var operation = new _vo_PatchOperation__WEBPACK_IMPORTED_MODULE_4__["default"](action, xpath, value);\n\n if (action === \'add\') {\n operation.position = node.pos;\n }\n\n return operation;\n }).filter(function (operation) {\n return !!operation;\n });\n }\n\n instance = {\n getIsPatch: getIsPatch,\n getPublishTime: getPublishTime,\n getOriginalPublishTime: getOriginalPublishTime,\n getMpdId: getMpdId,\n getPatchOperations: getPatchOperations\n };\n setup();\n return instance;\n}\n\nPatchManifestModel.__dashjs_factory_name = \'PatchManifestModel\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"].getSingletonFactory(PatchManifestModel));\n\n/***/ }),\n\n/***/ "./src/dash/parser/DashParser.js":\n/*!***************************************!*\\\n !*** ./src/dash/parser/DashParser.js ***!\n \\***************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_837109__) {\n__nested_webpack_require_837109__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_837109__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _objectiron__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_837109__(/*! ./objectiron */ "./src/dash/parser/objectiron.js");\n/* harmony import */ var _externals_xml2json__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_837109__(/*! ../../../externals/xml2json */ "./externals/xml2json.js");\n/* harmony import */ var _matchers_StringMatcher__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_837109__(/*! ./matchers/StringMatcher */ "./src/dash/parser/matchers/StringMatcher.js");\n/* harmony import */ var _matchers_DurationMatcher__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_837109__(/*! ./matchers/DurationMatcher */ "./src/dash/parser/matchers/DurationMatcher.js");\n/* harmony import */ var _matchers_DateTimeMatcher__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_837109__(/*! ./matchers/DateTimeMatcher */ "./src/dash/parser/matchers/DateTimeMatcher.js");\n/* harmony import */ var _matchers_NumericMatcher__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_837109__(/*! ./matchers/NumericMatcher */ "./src/dash/parser/matchers/NumericMatcher.js");\n/* harmony import */ var _maps_RepresentationBaseValuesMap__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_837109__(/*! ./maps/RepresentationBaseValuesMap */ "./src/dash/parser/maps/RepresentationBaseValuesMap.js");\n/* harmony import */ var _maps_SegmentValuesMap__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_837109__(/*! ./maps/SegmentValuesMap */ "./src/dash/parser/maps/SegmentValuesMap.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\nfunction DashParser(config) {\n config = config || {};\n var context = this.context;\n var debug = config.debug;\n var instance, logger, matchers, converter, objectIron;\n\n function setup() {\n logger = debug.getLogger(instance);\n matchers = [new _matchers_DurationMatcher__WEBPACK_IMPORTED_MODULE_4__["default"](), new _matchers_DateTimeMatcher__WEBPACK_IMPORTED_MODULE_5__["default"](), new _matchers_NumericMatcher__WEBPACK_IMPORTED_MODULE_6__["default"](), new _matchers_StringMatcher__WEBPACK_IMPORTED_MODULE_3__["default"]() // last in list to take precedence over NumericMatcher\n ];\n converter = new _externals_xml2json__WEBPACK_IMPORTED_MODULE_2__["default"]({\n escapeMode: false,\n attributePrefix: \'\',\n arrayAccessForm: \'property\',\n emptyNodeForm: \'object\',\n stripWhitespaces: false,\n enableToStringFunc: true,\n ignoreRoot: false,\n matchers: matchers\n });\n objectIron = Object(_objectiron__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create({\n adaptationset: new _maps_RepresentationBaseValuesMap__WEBPACK_IMPORTED_MODULE_7__["default"](),\n period: new _maps_SegmentValuesMap__WEBPACK_IMPORTED_MODULE_8__["default"]()\n });\n }\n\n function getMatchers() {\n return matchers;\n }\n\n function getIron() {\n return objectIron;\n }\n\n function parse(data) {\n var manifest;\n var startTime = window.performance.now();\n manifest = converter.xml_str2json(data);\n\n if (!manifest) {\n throw new Error(\'parsing the manifest failed\');\n }\n\n var jsonTime = window.performance.now(); // handle full MPD and Patch ironing separately\n\n if (manifest.Patch) {\n manifest = manifest.Patch; // drop root reference\n // apply iron to patch operations individually\n\n if (manifest.add_asArray) {\n manifest.add_asArray.forEach(function (operand) {\n return objectIron.run(operand);\n });\n }\n\n if (manifest.replace_asArray) {\n manifest.replace_asArray.forEach(function (operand) {\n return objectIron.run(operand);\n });\n } // note that we don\'t need to iron remove as they contain no children\n\n } else {\n manifest = manifest.MPD; // drop root reference\n\n objectIron.run(manifest);\n }\n\n var ironedTime = window.performance.now();\n logger.info(\'Parsing complete: ( xml2json: \' + (jsonTime - startTime).toPrecision(3) + \'ms, objectiron: \' + (ironedTime - jsonTime).toPrecision(3) + \'ms, total: \' + ((ironedTime - startTime) / 1000).toPrecision(3) + \'s)\');\n manifest.protocol = \'DASH\';\n return manifest;\n }\n\n instance = {\n parse: parse,\n getMatchers: getMatchers,\n getIron: getIron\n };\n setup();\n return instance;\n}\n\nDashParser.__dashjs_factory_name = \'DashParser\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(DashParser));\n\n/***/ }),\n\n/***/ "./src/dash/parser/maps/CommonProperty.js":\n/*!************************************************!*\\\n !*** ./src/dash/parser/maps/CommonProperty.js ***!\n \\************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_843816__) {\n__nested_webpack_require_843816__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc a property belonging to a MapNode\n * @ignore\n */\nvar CommonProperty = /*#__PURE__*/function () {\n function CommonProperty(name) {\n _classCallCheck(this, CommonProperty);\n\n var getDefaultMergeForName = function getDefaultMergeForName(n) {\n return n && n.length && n.charAt(0) === n.charAt(0).toUpperCase();\n };\n\n this._name = name;\n this._merge = getDefaultMergeForName(name);\n }\n\n _createClass(CommonProperty, [{\n key: "name",\n get: function get() {\n return this._name;\n }\n }, {\n key: "merge",\n get: function get() {\n return this._merge;\n }\n }]);\n\n return CommonProperty;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (CommonProperty);\n\n/***/ }),\n\n/***/ "./src/dash/parser/maps/MapNode.js":\n/*!*****************************************!*\\\n !*** ./src/dash/parser/maps/MapNode.js ***!\n \\*****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_847412__) {\n__nested_webpack_require_847412__.r(__nested_webpack_exports__);\n/* harmony import */ var _CommonProperty__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_847412__(/*! ./CommonProperty */ "./src/dash/parser/maps/CommonProperty.js");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc a node at some level in a ValueMap\n */\n\n\nvar MapNode = /*#__PURE__*/function () {\n function MapNode(name, properties, children) {\n var _this = this;\n\n _classCallCheck(this, MapNode);\n\n this._name = name || \'\';\n this._properties = [];\n this._children = children || [];\n\n if (Array.isArray(properties)) {\n properties.forEach(function (p) {\n _this._properties.push(new _CommonProperty__WEBPACK_IMPORTED_MODULE_0__["default"](p));\n });\n }\n }\n\n _createClass(MapNode, [{\n key: "name",\n get: function get() {\n return this._name;\n }\n }, {\n key: "children",\n get: function get() {\n return this._children;\n }\n }, {\n key: "properties",\n get: function get() {\n return this._properties;\n }\n }]);\n\n return MapNode;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (MapNode);\n\n/***/ }),\n\n/***/ "./src/dash/parser/maps/RepresentationBaseValuesMap.js":\n/*!*************************************************************!*\\\n !*** ./src/dash/parser/maps/RepresentationBaseValuesMap.js ***!\n \\*************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_851404__) {\n__nested_webpack_require_851404__.r(__nested_webpack_exports__);\n/* harmony import */ var _MapNode__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_851404__(/*! ./MapNode */ "./src/dash/parser/maps/MapNode.js");\n/* harmony import */ var _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_851404__(/*! ../../constants/DashConstants */ "./src/dash/constants/DashConstants.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc a RepresentationBaseValuesMap type for input to objectiron\n */\n\n\n\nvar RepresentationBaseValuesMap = /*#__PURE__*/function (_MapNode) {\n _inherits(RepresentationBaseValuesMap, _MapNode);\n\n var _super = _createSuper(RepresentationBaseValuesMap);\n\n function RepresentationBaseValuesMap() {\n _classCallCheck(this, RepresentationBaseValuesMap);\n\n var commonProperties = [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PROFILES, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].WIDTH, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].HEIGHT, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SAR, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].FRAMERATE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO_SAMPLING_RATE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MIME_TYPE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_PROFILES, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CODECS, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MAXIMUM_SAP_PERIOD, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].START_WITH_SAP, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MAX_PLAYOUT_RATE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CODING_DEPENDENCY, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SCAN_TYPE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].FRAME_PACKING, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO_CHANNEL_CONFIGURATION, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CONTENT_PROTECTION, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ESSENTIAL_PROPERTY, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SUPPLEMENTAL_PROPERTY, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INBAND_EVENT_STREAM];\n return _super.call(this, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ADAPTATION_SET, commonProperties, [new _MapNode__WEBPACK_IMPORTED_MODULE_0__["default"](_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].REPRESENTATION, commonProperties, [new _MapNode__WEBPACK_IMPORTED_MODULE_0__["default"](_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SUB_REPRESENTATION, commonProperties)])]);\n }\n\n return RepresentationBaseValuesMap;\n}(_MapNode__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (RepresentationBaseValuesMap);\n\n/***/ }),\n\n/***/ "./src/dash/parser/maps/SegmentValuesMap.js":\n/*!**************************************************!*\\\n !*** ./src/dash/parser/maps/SegmentValuesMap.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_858979__) {\n__nested_webpack_require_858979__.r(__nested_webpack_exports__);\n/* harmony import */ var _MapNode__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_858979__(/*! ./MapNode */ "./src/dash/parser/maps/MapNode.js");\n/* harmony import */ var _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_858979__(/*! ../../constants/DashConstants */ "./src/dash/constants/DashConstants.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc a SegmentValuesMap type for input to objectiron\n */\n\n\n\nvar SegmentValuesMap = /*#__PURE__*/function (_MapNode) {\n _inherits(SegmentValuesMap, _MapNode);\n\n var _super = _createSuper(SegmentValuesMap);\n\n function SegmentValuesMap() {\n _classCallCheck(this, SegmentValuesMap);\n\n var commonProperties = [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_BASE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TEMPLATE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_LIST];\n return _super.call(this, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PERIOD, commonProperties, [new _MapNode__WEBPACK_IMPORTED_MODULE_0__["default"](_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ADAPTATION_SET, commonProperties, [new _MapNode__WEBPACK_IMPORTED_MODULE_0__["default"](_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].REPRESENTATION, commonProperties)])]);\n }\n\n return SegmentValuesMap;\n}(_MapNode__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (SegmentValuesMap);\n\n/***/ }),\n\n/***/ "./src/dash/parser/matchers/BaseMatcher.js":\n/*!*************************************************!*\\\n !*** ./src/dash/parser/matchers/BaseMatcher.js ***!\n \\*************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_865080__) {\n__nested_webpack_require_865080__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc a base type for matching and converting types in manifest to\n * something more useful\n * @ignore\n */\nvar BaseMatcher = /*#__PURE__*/function () {\n function BaseMatcher(test, converter) {\n _classCallCheck(this, BaseMatcher);\n\n this._test = test;\n this._converter = converter;\n }\n\n _createClass(BaseMatcher, [{\n key: "test",\n get: function get() {\n return this._test;\n }\n }, {\n key: "converter",\n get: function get() {\n return this._converter;\n }\n }]);\n\n return BaseMatcher;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (BaseMatcher);\n\n/***/ }),\n\n/***/ "./src/dash/parser/matchers/DateTimeMatcher.js":\n/*!*****************************************************!*\\\n !*** ./src/dash/parser/matchers/DateTimeMatcher.js ***!\n \\*****************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_868611__) {\n__nested_webpack_require_868611__.r(__nested_webpack_exports__);\n/* harmony import */ var _BaseMatcher__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_868611__(/*! ./BaseMatcher */ "./src/dash/parser/matchers/BaseMatcher.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc matches and converts xs:datetime to Date\n */\n\nvar SECONDS_IN_MIN = 60;\nvar MINUTES_IN_HOUR = 60;\nvar MILLISECONDS_IN_SECONDS = 1000;\nvar datetimeRegex = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\\.[0-9]*)?)?(?:([+-])([0-9]{2})(?::?)([0-9]{2}))?/;\n\nvar DateTimeMatcher = /*#__PURE__*/function (_BaseMatcher) {\n _inherits(DateTimeMatcher, _BaseMatcher);\n\n var _super = _createSuper(DateTimeMatcher);\n\n function DateTimeMatcher() {\n _classCallCheck(this, DateTimeMatcher);\n\n return _super.call(this, function (attr) {\n return datetimeRegex.test(attr.value);\n }, function (str) {\n var match = datetimeRegex.exec(str);\n var utcDate; // If the string does not contain a timezone offset different browsers can interpret it either\n // as UTC or as a local time so we have to parse the string manually to normalize the given date value for\n // all browsers\n\n utcDate = Date.UTC(parseInt(match[1], 10), parseInt(match[2], 10) - 1, // months start from zero\n parseInt(match[3], 10), parseInt(match[4], 10), parseInt(match[5], 10), match[6] && parseInt(match[6], 10) || 0, match[7] && parseFloat(match[7]) * MILLISECONDS_IN_SECONDS || 0); // If the date has timezone offset take it into account as well\n\n if (match[9] && match[10]) {\n var timezoneOffset = parseInt(match[9], 10) * MINUTES_IN_HOUR + parseInt(match[10], 10);\n utcDate += (match[8] === \'+\' ? -1 : +1) * timezoneOffset * SECONDS_IN_MIN * MILLISECONDS_IN_SECONDS;\n }\n\n return new Date(utcDate);\n });\n }\n\n return DateTimeMatcher;\n}(_BaseMatcher__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (DateTimeMatcher);\n\n/***/ }),\n\n/***/ "./src/dash/parser/matchers/DurationMatcher.js":\n/*!*****************************************************!*\\\n !*** ./src/dash/parser/matchers/DurationMatcher.js ***!\n \\*****************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_875140__) {\n__nested_webpack_require_875140__.r(__nested_webpack_exports__);\n/* harmony import */ var _BaseMatcher__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_875140__(/*! ./BaseMatcher */ "./src/dash/parser/matchers/BaseMatcher.js");\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_875140__(/*! ../../../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_875140__(/*! ../../constants/DashConstants */ "./src/dash/constants/DashConstants.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc matches and converts xs:duration to seconds\n */\n\n\n\nvar durationRegex = /^([-])?P(([\\d.]*)Y)?(([\\d.]*)M)?(([\\d.]*)D)?T?(([\\d.]*)H)?(([\\d.]*)M)?(([\\d.]*)S)?/;\nvar SECONDS_IN_YEAR = 365 * 24 * 60 * 60;\nvar SECONDS_IN_MONTH = 30 * 24 * 60 * 60;\nvar SECONDS_IN_DAY = 24 * 60 * 60;\nvar SECONDS_IN_HOUR = 60 * 60;\nvar SECONDS_IN_MIN = 60;\n\nvar DurationMatcher = /*#__PURE__*/function (_BaseMatcher) {\n _inherits(DurationMatcher, _BaseMatcher);\n\n var _super = _createSuper(DurationMatcher);\n\n function DurationMatcher() {\n _classCallCheck(this, DurationMatcher);\n\n return _super.call(this, function (attr) {\n var attributeList = [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__["default"].MIN_BUFFER_TIME, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__["default"].MEDIA_PRESENTATION_DURATION, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__["default"].MINIMUM_UPDATE_PERIOD, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__["default"].TIMESHIFT_BUFFER_DEPTH, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__["default"].MAX_SEGMENT_DURATION, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__["default"].MAX_SUBSEGMENT_DURATION, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__["default"].SUGGESTED_PRESENTATION_DELAY, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__["default"].START, _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].START_TIME, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__["default"].DURATION];\n var len = attributeList.length;\n\n for (var i = 0; i < len; i++) {\n if (attr.nodeName === attributeList[i]) {\n return durationRegex.test(attr.value);\n }\n }\n\n return false;\n }, function (str) {\n //str = "P10Y10M10DT10H10M10.1S";\n var match = durationRegex.exec(str);\n var result = parseFloat(match[3] || 0) * SECONDS_IN_YEAR + parseFloat(match[5] || 0) * SECONDS_IN_MONTH + parseFloat(match[7] || 0) * SECONDS_IN_DAY + parseFloat(match[9] || 0) * SECONDS_IN_HOUR + parseFloat(match[11] || 0) * SECONDS_IN_MIN + parseFloat(match[13] || 0);\n\n if (match[1] !== undefined) {\n result = -result;\n }\n\n return result;\n });\n }\n\n return DurationMatcher;\n}(_BaseMatcher__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (DurationMatcher);\n\n/***/ }),\n\n/***/ "./src/dash/parser/matchers/NumericMatcher.js":\n/*!****************************************************!*\\\n !*** ./src/dash/parser/matchers/NumericMatcher.js ***!\n \\****************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_882677__) {\n__nested_webpack_require_882677__.r(__nested_webpack_exports__);\n/* harmony import */ var _BaseMatcher__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_882677__(/*! ./BaseMatcher */ "./src/dash/parser/matchers/BaseMatcher.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc Matches and converts xs:numeric to float\n */\n\nvar numericRegex = /^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/;\n\nvar NumericMatcher = /*#__PURE__*/function (_BaseMatcher) {\n _inherits(NumericMatcher, _BaseMatcher);\n\n var _super = _createSuper(NumericMatcher);\n\n function NumericMatcher() {\n _classCallCheck(this, NumericMatcher);\n\n return _super.call(this, function (attr) {\n return numericRegex.test(attr.value);\n }, function (str) {\n return parseFloat(str);\n });\n }\n\n return NumericMatcher;\n}(_BaseMatcher__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (NumericMatcher);\n\n/***/ }),\n\n/***/ "./src/dash/parser/matchers/StringMatcher.js":\n/*!***************************************************!*\\\n !*** ./src/dash/parser/matchers/StringMatcher.js ***!\n \\***************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_888128__) {\n__nested_webpack_require_888128__.r(__nested_webpack_exports__);\n/* harmony import */ var _BaseMatcher__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_888128__(/*! ./BaseMatcher */ "./src/dash/parser/matchers/BaseMatcher.js");\n/* harmony import */ var _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_888128__(/*! ../../constants/DashConstants */ "./src/dash/constants/DashConstants.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc Matches and converts xs:string to string, but only for specific attributes on specific nodes\n */\n\n\n\nvar StringMatcher = /*#__PURE__*/function (_BaseMatcher) {\n _inherits(StringMatcher, _BaseMatcher);\n\n var _super = _createSuper(StringMatcher);\n\n function StringMatcher() {\n _classCallCheck(this, StringMatcher);\n\n return _super.call(this, function (attr, nodeName) {\n var _stringAttrsInElement;\n\n var stringAttrsInElements = (_stringAttrsInElement = {}, _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MPD, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PROFILES]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PERIOD, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BASE_URL, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SERVICE_LOCATION, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BYTE_RANGE]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_BASE, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INDEX_RANGE]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INITIALIZATION, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].RANGE]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].REPRESENTATION_INDEX, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].RANGE]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_LIST, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INDEX_RANGE]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BITSTREAM_SWITCHING, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].RANGE]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_URL, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MEDIA_RANGE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INDEX_RANGE]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TEMPLATE, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INDEX_RANGE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MEDIA, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INDEX, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INITIALIZATION_MINUS, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BITSTREAM_SWITCHING_MINUS]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ASSET_IDENTIFIER, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].EVENT_STREAM, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ADAPTATION_SET, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PROFILES, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MIME_TYPE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_PROFILES, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CODECS, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CONTENT_TYPE]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].FRAME_PACKING, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO_CHANNEL_CONFIGURATION, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CONTENT_PROTECTION, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ESSENTIAL_PROPERTY, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SUPPLEMENTAL_PROPERTY, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].INBAND_EVENT_STREAM, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ACCESSIBILITY, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ROLE, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].RATING, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VIEWPOINT, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CONTENT_COMPONENT, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].CONTENT_TYPE]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].REPRESENTATION, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DEPENDENCY_ID, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MEDIA_STREAM_STRUCTURE_ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SUBSET, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].METRICS, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].METRICS_MINUS]), _defineProperty(_stringAttrsInElement, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].REPORTING, [_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].VALUE, _constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].ID]), _stringAttrsInElement);\n\n if (stringAttrsInElements.hasOwnProperty(nodeName)) {\n var attrNames = stringAttrsInElements[nodeName];\n\n if (attrNames !== undefined) {\n return attrNames.indexOf(attr.name) >= 0;\n } else {\n return false;\n }\n }\n\n return false;\n }, function (str) {\n return String(str);\n });\n }\n\n return StringMatcher;\n}(_BaseMatcher__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (StringMatcher);\n\n/***/ }),\n\n/***/ "./src/dash/parser/objectiron.js":\n/*!***************************************!*\\\n !*** ./src/dash/parser/objectiron.js ***!\n \\***************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_901614__) {\n__nested_webpack_require_901614__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_901614__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction ObjectIron(mappers) {\n function mergeValues(parentItem, childItem) {\n for (var name in parentItem) {\n if (!childItem.hasOwnProperty(name)) {\n childItem[name] = parentItem[name];\n }\n }\n }\n\n function mapProperties(properties, parent, child) {\n for (var i = 0, len = properties.length; i < len; ++i) {\n var property = properties[i];\n\n if (parent[property.name]) {\n if (child[property.name]) {\n // check to see if we should merge\n if (property.merge) {\n var parentValue = parent[property.name];\n var childValue = child[property.name]; // complex objects; merge properties\n\n if (_typeof(parentValue) === \'object\' && _typeof(childValue) === \'object\') {\n mergeValues(parentValue, childValue);\n } // simple objects; merge them together\n else {\n child[property.name] = parentValue + childValue;\n }\n }\n } else {\n // just add the property\n child[property.name] = parent[property.name];\n }\n }\n }\n }\n\n function mapItem(item, node) {\n for (var i = 0, len = item.children.length; i < len; ++i) {\n var childItem = item.children[i];\n var array = node[childItem.name + \'_asArray\'];\n\n if (array) {\n for (var v = 0, len2 = array.length; v < len2; ++v) {\n var childNode = array[v];\n mapProperties(item.properties, node, childNode);\n mapItem(childItem, childNode);\n }\n }\n }\n }\n\n function run(source) {\n if (source === null || _typeof(source) !== \'object\') {\n return source;\n }\n\n if (source.Period_asArray && \'period\' in mappers) {\n var periodMapper = mappers.period;\n var periods = source.Period_asArray;\n\n for (var i = 0, len = periods.length; i < len; ++i) {\n var period = periods[i];\n mapItem(periodMapper, period);\n\n if (\'adaptationset\' in mappers) {\n var adaptationSets = period.AdaptationSet_asArray;\n\n if (adaptationSets) {\n var adaptationSetMapper = mappers.adaptationset;\n\n for (var _i = 0, _len = adaptationSets.length; _i < _len; ++_i) {\n mapItem(adaptationSetMapper, adaptationSets[_i]);\n }\n }\n }\n }\n }\n\n return source;\n }\n\n return {\n run: run\n };\n}\n\nObjectIron.__dashjs_factory_name = \'ObjectIron\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(ObjectIron);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/dash/utils/ListSegmentsGetter.js":\n/*!**********************************************!*\\\n !*** ./src/dash/utils/ListSegmentsGetter.js ***!\n \\**********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_906948__) {\n__nested_webpack_require_906948__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_906948__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_906948__(/*! ../../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _SegmentsUtils__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_906948__(/*! ./SegmentsUtils */ "./src/dash/utils/SegmentsUtils.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\nfunction ListSegmentsGetter(config, isDynamic) {\n config = config || {};\n var timelineConverter = config.timelineConverter;\n var instance;\n\n function checkConfig() {\n if (!timelineConverter || !timelineConverter.hasOwnProperty(\'calcPeriodRelativeTimeFromMpdRelativeTime\')) {\n throw new Error(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].MISSING_CONFIG_ERROR);\n }\n }\n\n function getMediaFinishedInformation(representation) {\n var mediaFinishedInformation = {\n numberOfSegments: 0,\n mediaTimeOfLastSignaledSegment: NaN\n };\n\n if (!representation) {\n return mediaFinishedInformation;\n }\n\n var list = representation.adaptation.period.mpd.manifest.Period_asArray[representation.adaptation.period.index].AdaptationSet_asArray[representation.adaptation.index].Representation_asArray[representation.index].SegmentList;\n var startNumber = representation && !isNaN(representation.startNumber) ? representation.startNumber : 1;\n var offset = Math.max(startNumber - 1, 0);\n mediaFinishedInformation.numberOfSegments = offset + list.SegmentURL_asArray.length;\n return mediaFinishedInformation;\n }\n\n function getSegmentByIndex(representation, index) {\n checkConfig();\n\n if (!representation) {\n return null;\n }\n\n var list = representation.adaptation.period.mpd.manifest.Period_asArray[representation.adaptation.period.index].AdaptationSet_asArray[representation.adaptation.index].Representation_asArray[representation.index].SegmentList;\n var len = list.SegmentURL_asArray.length;\n var startNumber = representation && !isNaN(representation.startNumber) ? representation.startNumber : 1;\n var offsetToSubtract = Math.max(startNumber - 1, 0);\n var relativeIndex = Math.max(index - offsetToSubtract, 0);\n var segment = null;\n\n if (relativeIndex < len) {\n var s = list.SegmentURL_asArray[relativeIndex];\n segment = Object(_SegmentsUtils__WEBPACK_IMPORTED_MODULE_2__["getIndexBasedSegment"])(timelineConverter, isDynamic, representation, index);\n\n if (segment) {\n segment.replacementTime = (startNumber + index - 1) * representation.segmentDuration;\n segment.media = s.media ? s.media : \'\';\n segment.mediaRange = s.mediaRange;\n segment.indexRange = s.indexRange;\n }\n }\n\n return segment;\n }\n\n function getSegmentByTime(representation, requestedTime) {\n checkConfig();\n\n if (!representation) {\n return null;\n }\n\n var duration = representation.segmentDuration;\n\n if (isNaN(duration)) {\n return null;\n }\n\n var periodTime = timelineConverter.calcPeriodRelativeTimeFromMpdRelativeTime(representation, requestedTime);\n var index = Math.floor(periodTime / duration);\n return getSegmentByIndex(representation, index);\n }\n\n instance = {\n getSegmentByIndex: getSegmentByIndex,\n getSegmentByTime: getSegmentByTime,\n getMediaFinishedInformation: getMediaFinishedInformation\n };\n return instance;\n}\n\nListSegmentsGetter.__dashjs_factory_name = \'ListSegmentsGetter\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(ListSegmentsGetter);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/dash/utils/Round10.js":\n/*!***********************************!*\\\n !*** ./src/dash/utils/Round10.js ***!\n \\***********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_912844__) {\n__nested_webpack_require_912844__.r(__nested_webpack_exports__);\n/* harmony export (binding) */ __nested_webpack_require_912844__.d(__nested_webpack_exports__, "default", function() { return Round10; });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Static methods for rounding decimals\n *\n * Modified version of the CC0-licenced example at:\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round\n *\n * @export\n * @class Round10\n * @ignore\n */\nvar Round10 = /*#__PURE__*/function () {\n function Round10() {\n _classCallCheck(this, Round10);\n }\n\n _createClass(Round10, null, [{\n key: "round10",\n value:\n /**\n * Decimal round.\n *\n * @param {Number} value The number.\n * @param {Integer} exp The exponent (the 10 logarithm of the adjustment base).\n * @returns {Number} The adjusted value.\n * @ignore\n */\n function round10(value, exp) {\n return _decimalAdjust(\'round\', value, exp);\n }\n }]);\n\n return Round10;\n}();\n/**\n * Decimal adjustment of a number.\n *\n * @param {String} type The type of adjustment.\n * @param {Number} value The number.\n * @param {Integer} exp The exponent (the 10 logarithm of the adjustment base).\n * @returns {Number} The adjusted value.\n * @ignore\n */\n\n\n\n\nfunction _decimalAdjust(type, value, exp) {\n // If the exp is undefined or zero...\n if (typeof exp === \'undefined\' || +exp === 0) {\n return Math[type](value);\n }\n\n value = +value;\n exp = +exp; // If the value is not a number or the exp is not an integer...\n\n if (value === null || isNaN(value) || !(typeof exp === \'number\' && exp % 1 === 0)) {\n return NaN;\n } // Shift\n\n\n value = value.toString().split(\'e\');\n value = Math[type](+(value[0] + \'e\' + (value[1] ? +value[1] - exp : -exp))); // Shift back\n\n value = value.toString().split(\'e\');\n return +(value[0] + \'e\' + (value[1] ? +value[1] + exp : exp));\n}\n\n/***/ }),\n\n/***/ "./src/dash/utils/SegmentBaseGetter.js":\n/*!*********************************************!*\\\n !*** ./src/dash/utils/SegmentBaseGetter.js ***!\n \\*********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_917497__) {\n__nested_webpack_require_917497__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_917497__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_917497__(/*! ../../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\nfunction SegmentBaseGetter(config) {\n config = config || {};\n var timelineConverter = config.timelineConverter;\n var instance;\n\n function checkConfig() {\n if (!timelineConverter || !timelineConverter.hasOwnProperty(\'calcPeriodRelativeTimeFromMpdRelativeTime\')) {\n throw new Error(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].MISSING_CONFIG_ERROR);\n }\n }\n\n function getMediaFinishedInformation(representation) {\n var mediaFinishedInformation = {\n numberOfSegments: 0,\n mediaTimeOfLastSignaledSegment: NaN\n };\n\n if (!representation || !representation.segments) {\n return mediaFinishedInformation;\n }\n\n mediaFinishedInformation.numberOfSegments = representation.segments.length;\n return mediaFinishedInformation;\n }\n\n function getSegmentByIndex(representation, index) {\n checkConfig();\n\n if (!representation) {\n return null;\n }\n\n var len = representation.segments ? representation.segments.length : -1;\n var seg;\n\n if (index < len) {\n seg = representation.segments[index];\n\n if (seg && seg.index === index) {\n return seg;\n }\n }\n\n for (var i = 0; i < len; i++) {\n seg = representation.segments[i];\n\n if (seg && seg.index === index) {\n return seg;\n }\n }\n\n return null;\n }\n\n function getSegmentByTime(representation, requestedTime) {\n checkConfig();\n var index = getIndexByTime(representation, requestedTime);\n return getSegmentByIndex(representation, index);\n }\n\n function getIndexByTime(representation, time) {\n if (!representation) {\n return -1;\n }\n\n var segments = representation.segments;\n var ln = segments ? segments.length : null;\n var idx = -1;\n var epsilon, seg, ft, fd, i;\n\n if (segments && ln > 0) {\n for (i = 0; i < ln; i++) {\n seg = segments[i];\n ft = seg.presentationStartTime;\n fd = seg.duration;\n epsilon = fd / 2;\n\n if (time + epsilon >= ft && time - epsilon < ft + fd) {\n idx = seg.index;\n break;\n }\n }\n }\n\n return idx;\n }\n\n instance = {\n getSegmentByIndex: getSegmentByIndex,\n getSegmentByTime: getSegmentByTime,\n getMediaFinishedInformation: getMediaFinishedInformation\n };\n return instance;\n}\n\nSegmentBaseGetter.__dashjs_factory_name = \'SegmentBaseGetter\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(SegmentBaseGetter);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/dash/utils/SegmentsUtils.js":\n/*!*****************************************!*\\\n !*** ./src/dash/utils/SegmentsUtils.js ***!\n \\*****************************************/\n/*! exports provided: unescapeDollarsInTemplate, replaceIDForTemplate, replaceTokenForTemplate, getIndexBasedSegment, getTimeBasedSegment */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_922672__) {\n__nested_webpack_require_922672__.r(__nested_webpack_exports__);\n/* harmony export (binding) */ __nested_webpack_require_922672__.d(__nested_webpack_exports__, "unescapeDollarsInTemplate", function() { return unescapeDollarsInTemplate; });\n/* harmony export (binding) */ __nested_webpack_require_922672__.d(__nested_webpack_exports__, "replaceIDForTemplate", function() { return replaceIDForTemplate; });\n/* harmony export (binding) */ __nested_webpack_require_922672__.d(__nested_webpack_exports__, "replaceTokenForTemplate", function() { return replaceTokenForTemplate; });\n/* harmony export (binding) */ __nested_webpack_require_922672__.d(__nested_webpack_exports__, "getIndexBasedSegment", function() { return getIndexBasedSegment; });\n/* harmony export (binding) */ __nested_webpack_require_922672__.d(__nested_webpack_exports__, "getTimeBasedSegment", function() { return getTimeBasedSegment; });\n/* harmony import */ var _vo_Segment__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_922672__(/*! ./../vo/Segment */ "./src/dash/vo/Segment.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction zeroPadToLength(numStr, minStrLength) {\n while (numStr.length < minStrLength) {\n numStr = \'0\' + numStr;\n }\n\n return numStr;\n}\n\nfunction getNumberForSegment(segment, segmentIndex) {\n return segment.representation.startNumber + segmentIndex;\n}\n\nfunction unescapeDollarsInTemplate(url) {\n return url ? url.split(\'$$\').join(\'$\') : url;\n}\nfunction replaceIDForTemplate(url, value) {\n if (!value || !url || url.indexOf(\'$RepresentationID$\') === -1) {\n return url;\n }\n\n var v = value.toString();\n return url.split(\'$RepresentationID$\').join(v);\n}\nfunction replaceTokenForTemplate(url, token, value) {\n var formatTag = \'%0\';\n var startPos, endPos, formatTagPos, specifier, width, paddedValue;\n var tokenLen = token.length;\n var formatTagLen = formatTag.length;\n\n if (!url) {\n return url;\n } // keep looping round until all instances of <token> have been\n // replaced. once that has happened, startPos below will be -1\n // and the completed url will be returned.\n\n\n while (true) {\n // check if there is a valid $<token>...$ identifier\n // if not, return the url as is.\n startPos = url.indexOf(\'$\' + token);\n\n if (startPos < 0) {\n return url;\n } // the next \'$\' must be the end of the identifier\n // if there isn\'t one, return the url as is.\n\n\n endPos = url.indexOf(\'$\', startPos + tokenLen);\n\n if (endPos < 0) {\n return url;\n } // now see if there is an additional format tag suffixed to\n // the identifier within the enclosing \'$\' characters\n\n\n formatTagPos = url.indexOf(formatTag, startPos + tokenLen);\n\n if (formatTagPos > startPos && formatTagPos < endPos) {\n specifier = url.charAt(endPos - 1);\n width = parseInt(url.substring(formatTagPos + formatTagLen, endPos - 1), 10); // support the minimum specifiers required by IEEE 1003.1\n // (d, i , o, u, x, and X) for completeness\n\n switch (specifier) {\n // treat all int types as uint,\n // hence deliberate fallthrough\n case \'d\':\n case \'i\':\n case \'u\':\n paddedValue = zeroPadToLength(value.toString(), width);\n break;\n\n case \'x\':\n paddedValue = zeroPadToLength(value.toString(16), width);\n break;\n\n case \'X\':\n paddedValue = zeroPadToLength(value.toString(16), width).toUpperCase();\n break;\n\n case \'o\':\n paddedValue = zeroPadToLength(value.toString(8), width);\n break;\n\n default:\n return url;\n }\n } else {\n paddedValue = value;\n }\n\n url = url.substring(0, startPos) + paddedValue + url.substring(endPos + 1);\n }\n}\n\nfunction getSegment(representation, duration, presentationStartTime, mediaStartTime, timelineConverter, presentationEndTime, isDynamic, index) {\n var seg = new _vo_Segment__WEBPACK_IMPORTED_MODULE_0__["default"]();\n seg.representation = representation;\n seg.duration = duration;\n seg.presentationStartTime = presentationStartTime;\n seg.mediaStartTime = mediaStartTime;\n seg.availabilityStartTime = timelineConverter.calcAvailabilityStartTimeFromPresentationTime(presentationEndTime, representation, isDynamic);\n seg.availabilityEndTime = timelineConverter.calcAvailabilityEndTimeFromPresentationTime(presentationEndTime + duration, representation, isDynamic);\n seg.wallStartTime = timelineConverter.calcWallTimeForSegment(seg, isDynamic);\n seg.replacementNumber = getNumberForSegment(seg, index);\n seg.index = index;\n return seg;\n}\n\nfunction isSegmentAvailable(timelineConverter, representation, segment, isDynamic) {\n var voPeriod = representation.adaptation.period; // Avoid requesting segments that overlap the period boundary\n\n if (isFinite(voPeriod.duration) && voPeriod.start + voPeriod.duration <= segment.presentationStartTime) {\n return false;\n }\n\n if (isDynamic) {\n if (representation.availabilityTimeOffset === \'INF\') {\n return true;\n } // For dynamic manifests we check if the presentation start time + duration is included in the availability window\n // SAST = Period@start + seg@presentationStartTime + seg@duration\n // ASAST = SAST - ATO\n // SAET = SAST + TSBD + seg@duration\n // refTime serves as an anchor time to compare the availability time of the segments against.\n\n\n var refTime = timelineConverter.getClientReferenceTime();\n return segment.availabilityStartTime.getTime() <= refTime && (!isFinite(segment.availabilityEndTime) || segment.availabilityEndTime.getTime() >= refTime);\n }\n\n return true;\n}\n\nfunction getIndexBasedSegment(timelineConverter, isDynamic, representation, index) {\n var duration, presentationStartTime, presentationEndTime;\n duration = representation.segmentDuration;\n /*\n * From spec - If neither @duration attribute nor SegmentTimeline element is present, then the Representation\n * shall contain exactly one Media Segment. The MPD start time is 0 and the MPD duration is obtained\n * in the same way as for the last Media Segment in the Representation.\n */\n\n if (isNaN(duration)) {\n duration = representation.adaptation.period.duration;\n }\n\n presentationStartTime = parseFloat((representation.adaptation.period.start + index * duration).toFixed(5));\n presentationEndTime = parseFloat((presentationStartTime + duration).toFixed(5));\n var mediaTime = timelineConverter.calcMediaTimeFromPresentationTime(presentationStartTime, representation);\n var segment = getSegment(representation, duration, presentationStartTime, mediaTime, timelineConverter, presentationEndTime, isDynamic, index);\n\n if (!isSegmentAvailable(timelineConverter, representation, segment, isDynamic)) {\n return null;\n }\n\n return segment;\n}\nfunction getTimeBasedSegment(timelineConverter, isDynamic, representation, time, duration, fTimescale, url, range, index, tManifest) {\n var scaledTime = time / fTimescale;\n var scaledDuration = duration / fTimescale;\n var presentationStartTime, presentationEndTime, seg;\n presentationStartTime = timelineConverter.calcPresentationTimeFromMediaTime(scaledTime, representation);\n presentationEndTime = presentationStartTime + scaledDuration;\n seg = getSegment(representation, scaledDuration, presentationStartTime, scaledTime, timelineConverter, presentationEndTime, isDynamic, index);\n\n if (!isSegmentAvailable(timelineConverter, representation, seg, isDynamic)) {\n return null;\n }\n\n seg.replacementTime = tManifest ? tManifest : time;\n url = replaceTokenForTemplate(url, \'Number\', seg.replacementNumber);\n url = replaceTokenForTemplate(url, \'Time\', seg.replacementTime);\n seg.media = url;\n seg.mediaRange = range;\n return seg;\n}\n\n/***/ }),\n\n/***/ "./src/dash/utils/TemplateSegmentsGetter.js":\n/*!**************************************************!*\\\n !*** ./src/dash/utils/TemplateSegmentsGetter.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_932355__) {\n__nested_webpack_require_932355__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_932355__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_932355__(/*! ../../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _SegmentsUtils__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_932355__(/*! ./SegmentsUtils */ "./src/dash/utils/SegmentsUtils.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\nfunction TemplateSegmentsGetter(config, isDynamic) {\n config = config || {};\n var timelineConverter = config.timelineConverter;\n var instance;\n\n function checkConfig() {\n if (!timelineConverter || !timelineConverter.hasOwnProperty(\'calcPeriodRelativeTimeFromMpdRelativeTime\')) {\n throw new Error(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].MISSING_CONFIG_ERROR);\n }\n }\n\n function getMediaFinishedInformation(representation) {\n var mediaFinishedInformation = {\n numberOfSegments: 0,\n mediaTimeOfLastSignaledSegment: NaN\n };\n\n if (!representation) {\n return mediaFinishedInformation;\n }\n\n var duration = representation.segmentDuration;\n\n if (isNaN(duration)) {\n mediaFinishedInformation.numberOfSegments = 1;\n } else {\n mediaFinishedInformation.numberOfSegments = Math.ceil(representation.adaptation.period.duration / duration);\n }\n\n return mediaFinishedInformation;\n }\n\n function getSegmentByIndex(representation, index) {\n checkConfig();\n\n if (!representation) {\n return null;\n }\n\n var template = representation.adaptation.period.mpd.manifest.Period_asArray[representation.adaptation.period.index].AdaptationSet_asArray[representation.adaptation.index].Representation_asArray[representation.index].SegmentTemplate; // This is the index without @startNumber\n\n index = Math.max(index, 0);\n var seg = Object(_SegmentsUtils__WEBPACK_IMPORTED_MODULE_2__["getIndexBasedSegment"])(timelineConverter, isDynamic, representation, index);\n\n if (seg) {\n seg.replacementTime = Math.round((index - 1) * representation.segmentDuration * representation.timescale, 10);\n var url = template.media;\n url = Object(_SegmentsUtils__WEBPACK_IMPORTED_MODULE_2__["replaceTokenForTemplate"])(url, \'Number\', seg.replacementNumber);\n url = Object(_SegmentsUtils__WEBPACK_IMPORTED_MODULE_2__["replaceTokenForTemplate"])(url, \'Time\', seg.replacementTime);\n seg.media = url;\n }\n\n return seg;\n }\n\n function getSegmentByTime(representation, requestedTime) {\n checkConfig();\n\n if (!representation) {\n return null;\n }\n\n var duration = representation.segmentDuration;\n\n if (isNaN(duration)) {\n return null;\n } // Calculate the relative time for the requested time in this period\n\n\n var periodTime = timelineConverter.calcPeriodRelativeTimeFromMpdRelativeTime(representation, requestedTime);\n var index = Math.floor(periodTime / duration);\n return getSegmentByIndex(representation, index);\n }\n\n instance = {\n getSegmentByIndex: getSegmentByIndex,\n getSegmentByTime: getSegmentByTime,\n getMediaFinishedInformation: getMediaFinishedInformation\n };\n return instance;\n}\n\nTemplateSegmentsGetter.__dashjs_factory_name = \'TemplateSegmentsGetter\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(TemplateSegmentsGetter);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/dash/utils/TimelineConverter.js":\n/*!*********************************************!*\\\n !*** ./src/dash/utils/TimelineConverter.js ***!\n \\*********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_938048__) {\n__nested_webpack_require_938048__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_938048__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_938048__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_938048__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _constants_DashConstants__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_938048__(/*! ../constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/* harmony import */ var _models_DashManifestModel__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_938048__(/*! ../models/DashManifestModel */ "./src/dash/models/DashManifestModel.js");\n/* harmony import */ var _core_Settings__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_938048__(/*! ../../core/Settings */ "./src/core/Settings.js");\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_938048__(/*! ../../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_938048__(/*! ../../streaming/MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _streaming_constants_ConformanceViolationConstants__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_938048__(/*! ../../streaming/constants/ConformanceViolationConstants */ "./src/streaming/constants/ConformanceViolationConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\nfunction TimelineConverter() {\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n var settings = Object(_core_Settings__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance();\n var instance, dashManifestModel, timelineAnchorAvailabilityOffset, // In case we calculate the TSBD using _calcTimeShiftBufferWindowForDynamicTimelineManifest we use the segments as anchor times. We apply this offset when calculating if a segment is available or not.\n clientServerTimeShift;\n\n function setup() {\n dashManifestModel = Object(_models_DashManifestModel__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n reset();\n }\n\n function initialize() {\n resetInitialSettings();\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].UPDATE_TIME_SYNC_OFFSET, _onUpdateTimeSyncOffset, this);\n }\n\n function getClientTimeOffset() {\n return clientServerTimeShift;\n }\n\n function setClientTimeOffset(value) {\n clientServerTimeShift = value;\n }\n /**\n * Returns a "now" reference time for the client to compare the availability time of a segment against.\n * Takes the client/server drift into account\n */\n\n\n function getClientReferenceTime() {\n return Date.now() - timelineAnchorAvailabilityOffset * 1000 + clientServerTimeShift * 1000;\n }\n\n function _calcAvailabilityTimeFromPresentationTime(presentationEndTime, representation, isDynamic, calculateAvailabilityEndTime) {\n var availabilityTime;\n var mpd = representation.adaptation.period.mpd;\n var availabilityStartTime = mpd.availabilityStartTime;\n\n if (calculateAvailabilityEndTime) {\n //@timeShiftBufferDepth specifies the duration of the time shifting buffer that is guaranteed\n // to be available for a Media Presentation with type \'dynamic\'.\n // When not present, the value is infinite.\n if (isDynamic && mpd.timeShiftBufferDepth !== Number.POSITIVE_INFINITY) {\n // SAET = SAST + TSBD + seg@duration\n availabilityTime = new Date(availabilityStartTime.getTime() + (presentationEndTime + mpd.timeShiftBufferDepth) * 1000);\n } else {\n availabilityTime = mpd.availabilityEndTime;\n }\n } else {\n if (isDynamic) {\n // SAST = Period@start + seg@presentationStartTime + seg@duration\n // ASAST = SAST - ATO\n var availabilityTimeOffset = representation.availabilityTimeOffset; // presentationEndTime = Period@start + seg@presentationStartTime + Segment@duration\n\n availabilityTime = new Date(availabilityStartTime.getTime() + (presentationEndTime - availabilityTimeOffset) * 1000);\n } else {\n // in static mpd, all segments are available at the same time\n availabilityTime = availabilityStartTime;\n }\n }\n\n return availabilityTime;\n }\n\n function calcAvailabilityStartTimeFromPresentationTime(presentationEndTime, representation, isDynamic) {\n return _calcAvailabilityTimeFromPresentationTime(presentationEndTime, representation, isDynamic);\n }\n\n function calcAvailabilityEndTimeFromPresentationTime(presentationEndTime, representation, isDynamic) {\n return _calcAvailabilityTimeFromPresentationTime(presentationEndTime, representation, isDynamic, true);\n }\n\n function calcPresentationTimeFromWallTime(wallTime, period) {\n return (wallTime.getTime() - period.mpd.availabilityStartTime.getTime() + clientServerTimeShift * 1000) / 1000;\n }\n\n function calcPresentationTimeFromMediaTime(mediaTime, representation) {\n var periodStart = representation.adaptation.period.start;\n var presentationOffset = representation.presentationTimeOffset;\n return mediaTime + (periodStart - presentationOffset);\n }\n\n function calcMediaTimeFromPresentationTime(presentationTime, representation) {\n var periodStart = representation.adaptation.period.start;\n var presentationOffset = representation.presentationTimeOffset;\n return presentationTime - periodStart + presentationOffset;\n }\n\n function calcWallTimeForSegment(segment, isDynamic) {\n var suggestedPresentationDelay, displayStartTime, wallTime;\n\n if (isDynamic) {\n suggestedPresentationDelay = segment.representation.adaptation.period.mpd.suggestedPresentationDelay;\n displayStartTime = segment.presentationStartTime + suggestedPresentationDelay;\n wallTime = new Date(segment.availabilityStartTime.getTime() + displayStartTime * 1000);\n }\n\n return wallTime;\n }\n /**\n * Calculates the timeshiftbuffer range. This range might overlap multiple periods and is not limited to period boundaries. However, we make sure that the range is potentially covered by period.\n * @param {Array} streams\n * @param {boolean} isDynamic\n * @return {}\n */\n\n\n function calcTimeShiftBufferWindow(streams, isDynamic) {\n // Static manifests. The availability window is equal to the DVR window\n if (!isDynamic) {\n return _calcTimeshiftBufferForStaticManifest(streams);\n } // Specific use case of SegmentTimeline\n\n\n if (settings.get().streaming.timeShiftBuffer.calcFromSegmentTimeline) {\n var data = _calcTimeShiftBufferWindowForDynamicTimelineManifest(streams);\n\n _adjustTimelineAnchorAvailabilityOffset(data.now, data.range);\n\n return data.range;\n }\n\n return _calcTimeShiftBufferWindowForDynamicManifest(streams);\n }\n\n function _calcTimeshiftBufferForStaticManifest(streams) {\n // Static Range Finder. We iterate over all periods and return the total duration\n var range = {\n start: NaN,\n end: NaN\n };\n var duration = 0;\n var start = NaN;\n streams.forEach(function (stream) {\n var streamInfo = stream.getStreamInfo();\n duration += streamInfo.duration;\n\n if (isNaN(start) || streamInfo.start < start) {\n start = streamInfo.start;\n }\n });\n range.start = start;\n range.end = start + duration;\n return range;\n }\n\n function _calcTimeShiftBufferWindowForDynamicManifest(streams) {\n var range = {\n start: NaN,\n end: NaN\n };\n\n if (!streams || streams.length === 0) {\n return range;\n }\n\n var voPeriod = streams[0].getAdapter().getRegularPeriods()[0];\n var now = calcPresentationTimeFromWallTime(new Date(), voPeriod);\n var timeShiftBufferDepth = voPeriod.mpd.timeShiftBufferDepth;\n var start = !isNaN(timeShiftBufferDepth) ? now - timeShiftBufferDepth : 0; // check if we find a suitable period for that starttime. Otherwise we use the time closest to that\n\n range.start = _adjustTimeBasedOnPeriodRanges(streams, start);\n range.end = !isNaN(range.start) && now < range.start ? now : _adjustTimeBasedOnPeriodRanges(streams, now, true);\n\n if (!isNaN(timeShiftBufferDepth) && range.end < now - timeShiftBufferDepth) {\n range.end = NaN;\n } // If we have SegmentTimeline as a reference we can verify that the calculated DVR window is at least partially included in the DVR window exposed by the timeline.\n // If that is not the case we stick to the DVR window defined by SegmentTimeline\n\n\n if (settings.get().streaming.timeShiftBuffer.fallbackToSegmentTimeline) {\n var timelineRefData = _calcTimeShiftBufferWindowForDynamicTimelineManifest(streams);\n\n if (timelineRefData.range.end < range.start) {\n eventBus.trigger(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].CONFORMANCE_VIOLATION, {\n level: _streaming_constants_ConformanceViolationConstants__WEBPACK_IMPORTED_MODULE_8__["default"].LEVELS.WARNING,\n event: _streaming_constants_ConformanceViolationConstants__WEBPACK_IMPORTED_MODULE_8__["default"].EVENTS.INVALID_DVR_WINDOW\n });\n\n _adjustTimelineAnchorAvailabilityOffset(timelineRefData.now, timelineRefData.range);\n\n return timelineRefData.range;\n }\n }\n\n return range;\n }\n\n function _calcTimeShiftBufferWindowForDynamicTimelineManifest(streams) {\n var range = {\n start: NaN,\n end: NaN\n };\n var voPeriod = streams[0].getAdapter().getRegularPeriods()[0];\n var now = calcPresentationTimeFromWallTime(new Date(), voPeriod);\n\n if (!streams || streams.length === 0) {\n return {\n range: range,\n now: now\n };\n }\n\n streams.forEach(function (stream) {\n var adapter = stream.getAdapter();\n var mediaInfo = adapter.getMediaInfoForType(stream.getStreamInfo(), _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_6__["default"].VIDEO) || adapter.getMediaInfoForType(stream.getStreamInfo(), _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_6__["default"].AUDIO);\n var voRepresentations = adapter.getVoRepresentations(mediaInfo);\n var voRepresentation = voRepresentations[0];\n var periodRange = {\n start: NaN,\n end: NaN\n };\n\n if (voRepresentation) {\n if (voRepresentation.segmentInfoType === _constants_DashConstants__WEBPACK_IMPORTED_MODULE_3__["default"].SEGMENT_TIMELINE) {\n periodRange = _calcRangeForTimeline(voRepresentation);\n } else {\n var currentVoPeriod = voRepresentation.adaptation.period;\n periodRange.start = currentVoPeriod.start;\n periodRange.end = Math.max(now, currentVoPeriod.start + currentVoPeriod.duration);\n }\n }\n\n if (!isNaN(periodRange.start) && (isNaN(range.start) || range.start > periodRange.start)) {\n range.start = periodRange.start;\n }\n\n if (!isNaN(periodRange.end) && (isNaN(range.end) || range.end < periodRange.end)) {\n range.end = periodRange.end;\n }\n });\n range.end = Math.min(now, range.end);\n\n var adjustedEndTime = _adjustTimeBasedOnPeriodRanges(streams, range.end, true); // if range is NaN all periods are in the future. we should return range.start > range.end in this case\n\n\n range.end = isNaN(adjustedEndTime) ? range.end : adjustedEndTime;\n range.start = voPeriod && voPeriod.mpd && voPeriod.mpd.timeShiftBufferDepth && !isNaN(voPeriod.mpd.timeShiftBufferDepth) && !isNaN(range.end) ? Math.max(range.end - voPeriod.mpd.timeShiftBufferDepth, range.start) : range.start;\n range.start = _adjustTimeBasedOnPeriodRanges(streams, range.start);\n return {\n range: range,\n now: now\n };\n }\n\n function _adjustTimelineAnchorAvailabilityOffset(now, range) {\n timelineAnchorAvailabilityOffset = now - range.end;\n }\n\n function _adjustTimeBasedOnPeriodRanges(streams, time) {\n var isEndOfDvrWindow = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n try {\n var i = 0;\n var found = false;\n var adjustedTime = NaN;\n\n while (!found && i < streams.length) {\n var streamInfo = streams[i].getStreamInfo(); // We found a period which contains the target time.\n\n if (streamInfo.start <= time && (!isFinite(streamInfo.duration) || streamInfo.start + streamInfo.duration >= time)) {\n adjustedTime = time;\n found = true;\n } // Adjust the time for the start of the DVR window. The current period starts after the target time. We use the starttime of this period as adjusted time\n else if (!isEndOfDvrWindow && streamInfo.start > time && (isNaN(adjustedTime) || streamInfo.start < adjustedTime)) {\n adjustedTime = streamInfo.start;\n } // Adjust the time for the end of the DVR window. The current period ends before the targettime. We use the end time of this period as the adjusted time\n else if (isEndOfDvrWindow && streamInfo.start + streamInfo.duration < time && (isNaN(adjustedTime) || streamInfo.start + streamInfo.duration > adjustedTime)) {\n adjustedTime = streamInfo.start + streamInfo.duration;\n }\n\n i += 1;\n }\n\n return adjustedTime;\n } catch (e) {\n return time;\n }\n }\n\n function _calcRangeForTimeline(voRepresentation) {\n var adaptation = voRepresentation.adaptation.period.mpd.manifest.Period_asArray[voRepresentation.adaptation.period.index].AdaptationSet_asArray[voRepresentation.adaptation.index];\n var representation = dashManifestModel.getRepresentationFor(voRepresentation.index, adaptation);\n var timeline = representation.SegmentTemplate.SegmentTimeline;\n var timescale = representation.SegmentTemplate.timescale;\n var segments = timeline.S_asArray;\n var range = {\n start: 0,\n end: 0\n };\n var d = 0;\n var segment, repeat, i, len;\n range.start = calcPresentationTimeFromMediaTime(segments[0].t / timescale, voRepresentation);\n\n for (i = 0, len = segments.length; i < len; i++) {\n segment = segments[i];\n repeat = 0;\n\n if (segment.hasOwnProperty(\'r\')) {\n repeat = segment.r;\n }\n\n d += segment.d / timescale * (1 + repeat);\n }\n\n range.end = range.start + d;\n return range;\n }\n\n function calcPeriodRelativeTimeFromMpdRelativeTime(representation, mpdRelativeTime) {\n var periodStartTime = representation.adaptation.period.start;\n return mpdRelativeTime - periodStartTime;\n }\n\n function _onUpdateTimeSyncOffset(e) {\n if (e.offset !== undefined && !isNaN(e.offset)) {\n setClientTimeOffset(e.offset / 1000);\n }\n }\n\n function resetInitialSettings() {\n clientServerTimeShift = 0;\n timelineAnchorAvailabilityOffset = 0;\n }\n\n function reset() {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].UPDATE_TIME_SYNC_OFFSET, _onUpdateTimeSyncOffset, this);\n resetInitialSettings();\n }\n\n instance = {\n initialize: initialize,\n getClientTimeOffset: getClientTimeOffset,\n setClientTimeOffset: setClientTimeOffset,\n getClientReferenceTime: getClientReferenceTime,\n calcAvailabilityStartTimeFromPresentationTime: calcAvailabilityStartTimeFromPresentationTime,\n calcAvailabilityEndTimeFromPresentationTime: calcAvailabilityEndTimeFromPresentationTime,\n calcPresentationTimeFromWallTime: calcPresentationTimeFromWallTime,\n calcPresentationTimeFromMediaTime: calcPresentationTimeFromMediaTime,\n calcPeriodRelativeTimeFromMpdRelativeTime: calcPeriodRelativeTimeFromMpdRelativeTime,\n calcMediaTimeFromPresentationTime: calcMediaTimeFromPresentationTime,\n calcWallTimeForSegment: calcWallTimeForSegment,\n calcTimeShiftBufferWindow: calcTimeShiftBufferWindow,\n reset: reset\n };\n setup();\n return instance;\n}\n\nTimelineConverter.__dashjs_factory_name = \'TimelineConverter\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getSingletonFactory(TimelineConverter));\n\n/***/ }),\n\n/***/ "./src/dash/utils/TimelineSegmentsGetter.js":\n/*!**************************************************!*\\\n !*** ./src/dash/utils/TimelineSegmentsGetter.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_956370__) {\n__nested_webpack_require_956370__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_956370__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_956370__(/*! ../../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _SegmentsUtils__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_956370__(/*! ./SegmentsUtils */ "./src/dash/utils/SegmentsUtils.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\nfunction TimelineSegmentsGetter(config, isDynamic) {\n config = config || {};\n var timelineConverter = config.timelineConverter;\n var dashMetrics = config.dashMetrics;\n var instance;\n\n function checkConfig() {\n if (!timelineConverter) {\n throw new Error(_streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].MISSING_CONFIG_ERROR);\n }\n }\n\n function getMediaFinishedInformation(representation) {\n if (!representation) {\n return 0;\n }\n\n var base = representation.adaptation.period.mpd.manifest.Period_asArray[representation.adaptation.period.index].AdaptationSet_asArray[representation.adaptation.index].Representation_asArray[representation.index].SegmentTemplate || representation.adaptation.period.mpd.manifest.Period_asArray[representation.adaptation.period.index].AdaptationSet_asArray[representation.adaptation.index].Representation_asArray[representation.index].SegmentList;\n var timeline = base.SegmentTimeline;\n var time = 0;\n var scaledTime = 0;\n var availableSegments = 0;\n var fragments, frag, i, len, j, repeat, fTimescale;\n fTimescale = representation.timescale;\n fragments = timeline.S_asArray;\n len = fragments.length;\n\n for (i = 0; i < len; i++) {\n frag = fragments[i];\n repeat = 0;\n\n if (frag.hasOwnProperty(\'r\')) {\n repeat = frag.r;\n } // For a repeated S element, t belongs only to the first segment\n\n\n if (frag.hasOwnProperty(\'t\')) {\n time = frag.t;\n scaledTime = time / fTimescale;\n } // This is a special case: "A negative value of the @r attribute of the S element indicates that the duration indicated in @d attribute repeats until the start of the next S element, the end of the Period or until the\n // next MPD update."\n\n\n if (repeat < 0) {\n var nextFrag = fragments[i + 1];\n repeat = _calculateRepeatCountForNegativeR(representation, nextFrag, frag, fTimescale, scaledTime);\n }\n\n for (j = 0; j <= repeat; j++) {\n availableSegments++;\n time += frag.d;\n scaledTime = time / fTimescale;\n }\n } // We need to account for the index of the segments starting at 0. We subtract 1\n\n\n return {\n numberOfSegments: availableSegments,\n mediaTimeOfLastSignaledSegment: scaledTime\n };\n }\n\n function iterateSegments(representation, iterFunc) {\n var base = representation.adaptation.period.mpd.manifest.Period_asArray[representation.adaptation.period.index].AdaptationSet_asArray[representation.adaptation.index].Representation_asArray[representation.index].SegmentTemplate || representation.adaptation.period.mpd.manifest.Period_asArray[representation.adaptation.period.index].AdaptationSet_asArray[representation.adaptation.index].Representation_asArray[representation.index].SegmentList;\n var timeline = base.SegmentTimeline;\n var list = base.SegmentURL_asArray;\n var time = 0;\n var scaledTime = 0;\n var relativeIdx = -1;\n var fragments, frag, i, len, j, repeat, fTimescale;\n fTimescale = representation.timescale;\n fragments = timeline.S_asArray;\n var breakIterator = false;\n\n for (i = 0, len = fragments.length; i < len && !breakIterator; i++) {\n frag = fragments[i];\n repeat = 0;\n\n if (frag.hasOwnProperty(\'r\')) {\n repeat = frag.r;\n } // For a repeated S element, t belongs only to the first segment\n\n\n if (frag.hasOwnProperty(\'t\')) {\n time = frag.t;\n scaledTime = time / fTimescale;\n } // This is a special case: "A negative value of the @r attribute of the S element indicates that the duration indicated in @d attribute repeats until the start of the next S element, the end of the Period or until the\n // next MPD update."\n\n\n if (repeat < 0) {\n var nextFrag = fragments[i + 1];\n repeat = _calculateRepeatCountForNegativeR(representation, nextFrag, frag, fTimescale, scaledTime);\n }\n\n for (j = 0; j <= repeat && !breakIterator; j++) {\n relativeIdx++;\n breakIterator = iterFunc(time, scaledTime, base, list, frag, fTimescale, relativeIdx, i);\n\n if (breakIterator) {\n representation.segmentDuration = frag.d / fTimescale;\n }\n\n time += frag.d;\n scaledTime = time / fTimescale;\n }\n }\n }\n\n function _calculateRepeatCountForNegativeR(representation, nextFrag, frag, fTimescale, scaledTime) {\n var repeatEndTime;\n\n if (nextFrag && nextFrag.hasOwnProperty(\'t\')) {\n repeatEndTime = nextFrag.t / fTimescale;\n } else {\n try {\n var availabilityEnd = 0;\n\n if (!isNaN(representation.adaptation.period.start) && !isNaN(representation.adaptation.period.duration) && isFinite(representation.adaptation.period.duration)) {\n // use end of the Period\n availabilityEnd = representation.adaptation.period.start + representation.adaptation.period.duration;\n } else {\n // use DVR window\n var dvrWindow = dashMetrics.getCurrentDVRInfo();\n availabilityEnd = !isNaN(dvrWindow.end) ? dvrWindow.end : 0;\n }\n\n repeatEndTime = timelineConverter.calcMediaTimeFromPresentationTime(availabilityEnd, representation);\n representation.segmentDuration = frag.d / fTimescale;\n } catch (e) {\n repeatEndTime = 0;\n }\n }\n\n return Math.max(Math.ceil((repeatEndTime - scaledTime) / (frag.d / fTimescale)) - 1, 0);\n }\n\n function getSegmentByIndex(representation, index, lastSegmentTime) {\n checkConfig();\n\n if (!representation) {\n return null;\n }\n\n var segment = null;\n var found = false;\n iterateSegments(representation, function (time, scaledTime, base, list, frag, fTimescale, relativeIdx, i) {\n if (found || lastSegmentTime < 0) {\n var media = base.media;\n var mediaRange = frag.mediaRange;\n\n if (list) {\n media = list[i].media || \'\';\n mediaRange = list[i].mediaRange;\n }\n\n segment = Object(_SegmentsUtils__WEBPACK_IMPORTED_MODULE_2__["getTimeBasedSegment"])(timelineConverter, isDynamic, representation, time, frag.d, fTimescale, media, mediaRange, relativeIdx, frag.tManifest);\n return true;\n } else if (scaledTime >= lastSegmentTime - frag.d * 0.5 / fTimescale) {\n // same logic, if deviation is\n // 50% of segment duration, segment is found if scaledTime is greater than or equal to (startTime of previous segment - half of the previous segment duration)\n found = true;\n }\n\n return false;\n });\n return segment;\n }\n\n function getSegmentByTime(representation, requestedTime) {\n checkConfig();\n\n if (!representation) {\n return null;\n }\n\n if (requestedTime === undefined) {\n requestedTime = null;\n }\n\n var segment = null;\n var requiredMediaTime = timelineConverter.calcMediaTimeFromPresentationTime(requestedTime, representation);\n iterateSegments(representation, function (time, scaledTime, base, list, frag, fTimescale, relativeIdx, i) {\n // In some cases when requiredMediaTime = actual end time of the last segment\n // it is possible that this time a bit exceeds the declared end time of the last segment.\n // in this case we still need to include the last segment in the segment list.\n if (requiredMediaTime < scaledTime + frag.d / fTimescale) {\n var media = base.media;\n var mediaRange = frag.mediaRange;\n\n if (list) {\n media = list[i].media || \'\';\n mediaRange = list[i].mediaRange;\n }\n\n segment = Object(_SegmentsUtils__WEBPACK_IMPORTED_MODULE_2__["getTimeBasedSegment"])(timelineConverter, isDynamic, representation, time, frag.d, fTimescale, media, mediaRange, relativeIdx, frag.tManifest);\n return true;\n }\n\n return false;\n });\n return segment;\n }\n\n instance = {\n getSegmentByIndex: getSegmentByIndex,\n getSegmentByTime: getSegmentByTime,\n getMediaFinishedInformation: getMediaFinishedInformation\n };\n return instance;\n}\n\nTimelineSegmentsGetter.__dashjs_factory_name = \'TimelineSegmentsGetter\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(TimelineSegmentsGetter);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/dash/vo/AdaptationSet.js":\n/*!**************************************!*\\\n !*** ./src/dash/vo/AdaptationSet.js ***!\n \\**************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_967296__) {\n__nested_webpack_require_967296__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar AdaptationSet = function AdaptationSet() {\n _classCallCheck(this, AdaptationSet);\n\n this.period = null;\n this.index = -1;\n this.type = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (AdaptationSet);\n\n/***/ }),\n\n/***/ "./src/dash/vo/BaseURL.js":\n/*!********************************!*\\\n !*** ./src/dash/vo/BaseURL.js ***!\n \\********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_969851__) {\n__nested_webpack_require_969851__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar DEFAULT_DVB_PRIORITY = 1;\nvar DEFAULT_DVB_WEIGHT = 1;\n\nvar BaseURL = function BaseURL(url, serviceLocation, priority, weight) {\n _classCallCheck(this, BaseURL);\n\n this.url = url || \'\';\n this.serviceLocation = serviceLocation || url || \'\'; // DVB extensions\n\n this.dvb_priority = priority || DEFAULT_DVB_PRIORITY;\n this.dvb_weight = weight || DEFAULT_DVB_WEIGHT;\n this.availabilityTimeOffset = 0;\n this.availabilityTimeComplete = true;\n /* currently unused:\n * byteRange,\n */\n};\n\nBaseURL.DEFAULT_DVB_PRIORITY = DEFAULT_DVB_PRIORITY;\nBaseURL.DEFAULT_DVB_WEIGHT = DEFAULT_DVB_WEIGHT;\n/* harmony default export */ __nested_webpack_exports__["default"] = (BaseURL);\n\n/***/ }),\n\n/***/ "./src/dash/vo/Event.js":\n/*!******************************!*\\\n !*** ./src/dash/vo/Event.js ***!\n \\******************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_972836__) {\n__nested_webpack_require_972836__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar Event = function Event() {\n _classCallCheck(this, Event);\n\n this.duration = NaN;\n this.presentationTime = NaN;\n this.id = NaN;\n this.messageData = \'\';\n this.eventStream = null;\n this.presentationTimeDelta = NaN; // Specific EMSG Box parameter\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (Event);\n\n/***/ }),\n\n/***/ "./src/dash/vo/EventStream.js":\n/*!************************************!*\\\n !*** ./src/dash/vo/EventStream.js ***!\n \\************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_975504__) {\n__nested_webpack_require_975504__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar EventStream = function EventStream() {\n _classCallCheck(this, EventStream);\n\n this.adaptionSet = null;\n this.representation = null;\n this.period = null;\n this.timescale = 1;\n this.value = \'\';\n this.schemeIdUri = \'\';\n this.presentationTimeOffset = 0;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (EventStream);\n\n/***/ }),\n\n/***/ "./src/dash/vo/ManifestInfo.js":\n/*!*************************************!*\\\n !*** ./src/dash/vo/ManifestInfo.js ***!\n \\*************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_978190__) {\n__nested_webpack_require_978190__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar ManifestInfo = function ManifestInfo() {\n _classCallCheck(this, ManifestInfo);\n\n this.dvrWindowSize = NaN;\n this.loadedTime = null;\n this.availableFrom = null;\n this.minBufferTime = NaN;\n this.duration = NaN;\n this.isDynamic = false;\n this.maxFragmentDuration = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (ManifestInfo);\n\n/***/ }),\n\n/***/ "./src/dash/vo/MediaInfo.js":\n/*!**********************************!*\\\n !*** ./src/dash/vo/MediaInfo.js ***!\n \\**********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_980883__) {\n__nested_webpack_require_980883__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar MediaInfo = function MediaInfo() {\n _classCallCheck(this, MediaInfo);\n\n this.id = null;\n this.index = null;\n this.type = null;\n this.streamInfo = null;\n this.representationCount = 0;\n this.labels = null;\n this.lang = null;\n this.viewpoint = null;\n this.accessibility = null;\n this.audioChannelConfiguration = null;\n this.roles = null;\n this.codec = null;\n this.mimeType = null;\n this.contentProtection = null;\n this.KID = null;\n this.bitrateList = null;\n this.isFragmented = null;\n this.isEmbedded = null;\n this.selectionPriority = 1;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (MediaInfo);\n\n/***/ }),\n\n/***/ "./src/dash/vo/Mpd.js":\n/*!****************************!*\\\n !*** ./src/dash/vo/Mpd.js ***!\n \\****************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_983828__) {\n__nested_webpack_require_983828__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar Mpd = function Mpd() {\n _classCallCheck(this, Mpd);\n\n this.manifest = null;\n this.suggestedPresentationDelay = 0;\n this.availabilityStartTime = null;\n this.availabilityEndTime = Number.POSITIVE_INFINITY;\n this.timeShiftBufferDepth = Number.POSITIVE_INFINITY;\n this.maxSegmentDuration = Number.POSITIVE_INFINITY;\n this.publishTime = null;\n this.minimumUpdatePeriod = NaN;\n this.mediaPresentationDuration = NaN;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (Mpd);\n\n/***/ }),\n\n/***/ "./src/dash/vo/PatchOperation.js":\n/*!***************************************!*\\\n !*** ./src/dash/vo/PatchOperation.js ***!\n \\***************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_986676__) {\n__nested_webpack_require_986676__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar PatchOperation = /*#__PURE__*/function () {\n function PatchOperation(action, xpath, value) {\n _classCallCheck(this, PatchOperation);\n\n this.action = action;\n this.xpath = xpath;\n this.value = value;\n this.position = null;\n }\n\n _createClass(PatchOperation, [{\n key: "getMpdTarget",\n value: function getMpdTarget(root) {\n var isSiblingOperation = this.action === \'remove\' || this.action === \'replace\' || this.position === \'before\' || this.position === \'after\';\n return this.xpath.getMpdTarget(root, isSiblingOperation);\n }\n }]);\n\n return PatchOperation;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (PatchOperation);\n\n/***/ }),\n\n/***/ "./src/dash/vo/Period.js":\n/*!*******************************!*\\\n !*** ./src/dash/vo/Period.js ***!\n \\*******************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_990212__) {\n__nested_webpack_require_990212__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar Period = function Period() {\n _classCallCheck(this, Period);\n\n this.id = null;\n this.index = -1;\n this.duration = NaN;\n this.start = NaN;\n this.mpd = null;\n this.nextPeriodId = null;\n};\n\nPeriod.DEFAULT_ID = \'defaultId\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (Period);\n\n/***/ }),\n\n/***/ "./src/dash/vo/Representation.js":\n/*!***************************************!*\\\n !*** ./src/dash/vo/Representation.js ***!\n \\***************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_992866__) {\n__nested_webpack_require_992866__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_992866__(/*! ../constants/DashConstants */ "./src/dash/constants/DashConstants.js");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\n\n\nvar Representation = /*#__PURE__*/function () {\n function Representation() {\n _classCallCheck(this, Representation);\n\n this.id = null;\n this.index = -1;\n this.adaptation = null;\n this.segmentInfoType = null;\n this.initialization = null;\n this.codecs = null;\n this.mimeType = null;\n this.codecPrivateData = null;\n this.segmentDuration = NaN;\n this.timescale = 1;\n this.startNumber = 1;\n this.indexRange = null;\n this.range = null;\n this.presentationTimeOffset = 0; // Set the source buffer timeOffset to this\n\n this.MSETimeOffset = NaN; // The information we need in the DashHandler to determine whether the last segment has been loaded\n\n this.mediaFinishedInformation = {\n numberOfSegments: 0,\n mediaTimeOfLastSignaledSegment: NaN\n };\n this.bandwidth = NaN;\n this.width = NaN;\n this.height = NaN;\n this.scanType = null;\n this.maxPlayoutRate = NaN;\n this.availabilityTimeOffset = 0;\n this.availabilityTimeComplete = true;\n }\n\n _createClass(Representation, [{\n key: "hasInitialization",\n value: function hasInitialization() {\n return this.initialization !== null || this.range !== null;\n }\n }, {\n key: "hasSegments",\n value: function hasSegments() {\n return this.segmentInfoType !== _constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__["default"].BASE_URL && this.segmentInfoType !== _constants_DashConstants__WEBPACK_IMPORTED_MODULE_0__["default"].SEGMENT_BASE && !this.indexRange;\n }\n }]);\n\n return Representation;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (Representation);\n\n/***/ }),\n\n/***/ "./src/dash/vo/RepresentationInfo.js":\n/*!*******************************************!*\\\n !*** ./src/dash/vo/RepresentationInfo.js ***!\n \\*******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_997569__) {\n__nested_webpack_require_997569__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar RepresentationInfo = function RepresentationInfo() {\n _classCallCheck(this, RepresentationInfo);\n\n this.id = null;\n this.quality = null;\n this.fragmentDuration = null;\n this.mediaInfo = null;\n this.MSETimeOffset = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (RepresentationInfo);\n\n/***/ }),\n\n/***/ "./src/dash/vo/Segment.js":\n/*!********************************!*\\\n !*** ./src/dash/vo/Segment.js ***!\n \\********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1000210__) {\n__nested_webpack_require_1000210__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar Segment = function Segment() {\n _classCallCheck(this, Segment);\n\n this.indexRange = null; // The index of the segment in the list of segments. We start at 0\n\n this.index = null;\n this.mediaRange = null;\n this.media = null;\n this.duration = NaN; // this is the time that should be inserted into the media url\n\n this.replacementTime = null; // this is the number that should be inserted into the media url\n\n this.replacementNumber = NaN; // This is supposed to match the time encoded in the media Segment\n\n this.mediaStartTime = NaN; // When the source buffer timeOffset is set to MSETimeOffset this is the\n // time that will match the seekTarget and video.currentTime\n\n this.presentationStartTime = NaN; // Do not schedule this segment until\n\n this.availabilityStartTime = NaN; // Ignore and discard this segment after\n\n this.availabilityEndTime = NaN; // For dynamic mpd\'s, this is the wall clock time that the video\n // element currentTime should be presentationStartTime\n\n this.wallStartTime = NaN;\n this.representation = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (Segment);\n\n/***/ }),\n\n/***/ "./src/dash/vo/SimpleXPath.js":\n/*!************************************!*\\\n !*** ./src/dash/vo/SimpleXPath.js ***!\n \\************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1003677__) {\n__nested_webpack_require_1003677__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar SimpleXPath = /*#__PURE__*/function () {\n function SimpleXPath(selector) {\n var _this = this;\n\n _classCallCheck(this, SimpleXPath);\n\n // establish validation of the path, to catch unsupported cases\n this.valid = selector[0] == \'/\'; // first check, we only support absolute addressing\n // establish parsed path, example:\n // /MPD/Period[@id="foobar"]/AdaptationSet[@id="2"]/SegmentTemplate/SegmentTimeline\n\n this.path = selector.split(\'/\').filter(function (component) {\n return component.length !== 0;\n }) // remove excess empty components\n .map(function (component) {\n var parsed = {\n name: component\n };\n var qualifierPoint = component.indexOf(\'[\');\n\n if (qualifierPoint != -1) {\n parsed.name = component.substring(0, qualifierPoint);\n var qualifier = component.substring(qualifierPoint + 1, component.length - 1); // quick sanity check are there additional qualifiers making this invalid\n\n _this.valid = _this.valid && qualifier.indexOf(\'[\') == -1;\n var equalityPoint = qualifier.indexOf(\'=\');\n\n if (equalityPoint != -1) {\n parsed.attribute = {\n name: qualifier.substring(1, equalityPoint),\n // skip the @\n value: qualifier.substring(equalityPoint + 1)\n }; // check for single and double quoted attribute values\n\n if ([\'\\\'\', \'"\'].indexOf(parsed.attribute.value[0]) != -1) {\n parsed.attribute.value = parsed.attribute.value.substring(1, parsed.attribute.value.length - 1);\n }\n } else {\n // positional access in xpath is 1-based index\n // internal processes will assume 0-based so we normalize that here\n parsed.position = parseInt(qualifier, 10) - 1;\n }\n }\n\n return parsed;\n });\n }\n\n _createClass(SimpleXPath, [{\n key: "isValid",\n value: function isValid() {\n return this.valid;\n }\n }, {\n key: "findsElement",\n value: function findsElement() {\n return !this.findsAttribute();\n }\n }, {\n key: "findsAttribute",\n value: function findsAttribute() {\n return this.path[this.path.length - 1].name.startsWith(\'@\');\n }\n }, {\n key: "getMpdTarget",\n value: function getMpdTarget(root, isSiblingOperation) {\n var parent = null;\n var leaf = root; // assume root is MPD and we start at next level match\n\n var level = 1;\n var name = \'MPD\';\n\n while (level < this.path.length && leaf !== null) {\n // set parent to current\n parent = leaf; // select next leaf based on component\n\n var component = this.path[level];\n name = component.name; // stop one early if this is the last element and an attribute\n\n if (level !== this.path.length - 1 || !name.startsWith(\'@\')) {\n var children = parent[name + \'_asArray\'] || [];\n\n if (children.length === 0 && parent[name]) {\n children.push(parent[name]);\n }\n\n if (component.position) {\n leaf = children[component.position] || null;\n } else if (component.attribute) {\n (function () {\n var attr = component.attribute;\n leaf = children.filter(function (elm) {\n return elm[attr.name] == attr.value;\n })[0] || null;\n })();\n } else {\n // default case, select first\n leaf = children[0] || null;\n }\n }\n\n level++;\n }\n\n if (leaf === null) {\n // given path not found in root\n return null;\n } // attributes the target is the leaf node, the name is the attribute\n\n\n if (name.startsWith(\'@\')) {\n return {\n name: name.substring(1),\n leaf: leaf,\n target: leaf\n };\n } // otherwise we target the parent for sibling operations and leaf for child operations\n\n\n return {\n name: name,\n leaf: leaf,\n target: isSiblingOperation ? parent : leaf\n };\n }\n }]);\n\n return SimpleXPath;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (SimpleXPath);\n\n/***/ }),\n\n/***/ "./src/dash/vo/StreamInfo.js":\n/*!***********************************!*\\\n !*** ./src/dash/vo/StreamInfo.js ***!\n \\***********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1010665__) {\n__nested_webpack_require_1010665__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar StreamInfo = function StreamInfo() {\n _classCallCheck(this, StreamInfo);\n\n this.id = null;\n this.index = null;\n this.start = NaN;\n this.duration = NaN;\n this.manifestInfo = null;\n this.isLast = true;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (StreamInfo);\n\n/***/ }),\n\n/***/ "./src/dash/vo/UTCTiming.js":\n/*!**********************************!*\\\n !*** ./src/dash/vo/UTCTiming.js ***!\n \\**********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1013287__) {\n__nested_webpack_require_1013287__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar UTCTiming = function UTCTiming() {\n _classCallCheck(this, UTCTiming);\n\n // UTCTiming is a DescriptorType and doesn\'t have any additional fields\n this.schemeIdUri = \'\';\n this.value = \'\';\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (UTCTiming);\n\n/***/ }),\n\n/***/ "./src/streaming/FragmentLoader.js":\n/*!*****************************************!*\\\n !*** ./src/streaming/FragmentLoader.js ***!\n \\*****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1015919__) {\n__nested_webpack_require_1015919__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1015919__(/*! ./constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _net_URLLoader__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1015919__(/*! ./net/URLLoader */ "./src/streaming/net/URLLoader.js");\n/* harmony import */ var _vo_HeadRequest__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1015919__(/*! ./vo/HeadRequest */ "./src/streaming/vo/HeadRequest.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1015919__(/*! ./vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1015919__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\nfunction FragmentLoader(config) {\n config = config || {};\n var context = this.context;\n var eventBus = config.eventBus;\n var events = config.events;\n var urlUtils = config.urlUtils;\n var errors = config.errors;\n var streamId = config.streamId;\n var instance, urlLoader;\n\n function setup() {\n urlLoader = Object(_net_URLLoader__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create({\n errHandler: config.errHandler,\n errors: errors,\n dashMetrics: config.dashMetrics,\n mediaPlayerModel: config.mediaPlayerModel,\n requestModifier: config.requestModifier,\n urlUtils: urlUtils,\n constants: _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"],\n boxParser: config.boxParser,\n dashConstants: config.dashConstants,\n requestTimeout: config.settings.get().streaming.fragmentRequestTimeout\n });\n }\n\n function checkForExistence(request) {\n var report = function report(success) {\n eventBus.trigger(events.CHECK_FOR_EXISTENCE_COMPLETED, {\n request: request,\n exists: success\n });\n };\n\n if (request) {\n var headRequest = new _vo_HeadRequest__WEBPACK_IMPORTED_MODULE_2__["default"](request.url);\n urlLoader.load({\n request: headRequest,\n success: function success() {\n report(true);\n },\n error: function error() {\n report(false);\n }\n });\n } else {\n report(false);\n }\n }\n\n function load(request) {\n var report = function report(data, error) {\n eventBus.trigger(events.LOADING_COMPLETED, {\n request: request,\n response: data || null,\n error: error || null,\n sender: instance\n });\n };\n\n if (request) {\n urlLoader.load({\n request: request,\n progress: function progress(event) {\n eventBus.trigger(events.LOADING_PROGRESS, {\n request: request,\n stream: event.stream,\n streamId: streamId\n });\n\n if (event.data) {\n eventBus.trigger(events.LOADING_DATA_PROGRESS, {\n request: request,\n response: event.data || null,\n error: null,\n sender: instance\n });\n }\n },\n success: function success(data) {\n report(data);\n },\n error: function error(request, statusText, errorText) {\n report(undefined, new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_3__["default"](errors.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE, errorText, statusText));\n },\n abort: function abort(request) {\n if (request) {\n eventBus.trigger(events.LOADING_ABANDONED, {\n mediaType: request.mediaType,\n request: request,\n sender: instance\n });\n }\n }\n });\n } else {\n report(undefined, new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_3__["default"](errors.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE, errors.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE));\n }\n }\n\n function abort() {\n if (urlLoader) {\n urlLoader.abort();\n }\n }\n\n function reset() {\n if (urlLoader) {\n urlLoader.abort();\n urlLoader = null;\n }\n }\n\n instance = {\n checkForExistence: checkForExistence,\n load: load,\n abort: abort,\n reset: reset\n };\n setup();\n return instance;\n}\n\nFragmentLoader.__dashjs_factory_name = \'FragmentLoader\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_4__["default"].getClassFactory(FragmentLoader));\n\n/***/ }),\n\n/***/ "./src/streaming/ManifestLoader.js":\n/*!*****************************************!*\\\n !*** ./src/streaming/ManifestLoader.js ***!\n \\*****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1022465__) {\n__nested_webpack_require_1022465__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1022465__(/*! ./constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1022465__(/*! ../dash/constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/* harmony import */ var _controllers_XlinkController__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1022465__(/*! ./controllers/XlinkController */ "./src/streaming/controllers/XlinkController.js");\n/* harmony import */ var _net_URLLoader__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1022465__(/*! ./net/URLLoader */ "./src/streaming/net/URLLoader.js");\n/* harmony import */ var _utils_URLUtils__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1022465__(/*! ./utils/URLUtils */ "./src/streaming/utils/URLUtils.js");\n/* harmony import */ var _vo_TextRequest__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1022465__(/*! ./vo/TextRequest */ "./src/streaming/vo/TextRequest.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1022465__(/*! ./vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1022465__(/*! ./vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1022465__(/*! ../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1022465__(/*! ../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_1022465__(/*! ../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_11__ = __nested_webpack_require_1022465__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _dash_parser_DashParser__WEBPACK_IMPORTED_MODULE_12__ = __nested_webpack_require_1022465__(/*! ../dash/parser/DashParser */ "./src/dash/parser/DashParser.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction ManifestLoader(config) {\n config = config || {};\n var context = this.context;\n var debug = config.debug;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_8__["default"])(context).getInstance();\n var urlUtils = Object(_utils_URLUtils__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n var instance, logger, urlLoader, xlinkController, parser;\n var mssHandler = config.mssHandler;\n var errHandler = config.errHandler;\n\n function setup() {\n logger = debug.getLogger(instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_9__["default"].XLINK_READY, onXlinkReady, instance);\n urlLoader = Object(_net_URLLoader__WEBPACK_IMPORTED_MODULE_3__["default"])(context).create({\n errHandler: config.errHandler,\n dashMetrics: config.dashMetrics,\n mediaPlayerModel: config.mediaPlayerModel,\n requestModifier: config.requestModifier,\n urlUtils: urlUtils,\n constants: _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"],\n dashConstants: _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"],\n errors: _core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__["default"]\n });\n xlinkController = Object(_controllers_XlinkController__WEBPACK_IMPORTED_MODULE_2__["default"])(context).create({\n errHandler: errHandler,\n dashMetrics: config.dashMetrics,\n mediaPlayerModel: config.mediaPlayerModel,\n requestModifier: config.requestModifier,\n settings: config.settings\n });\n parser = null;\n }\n\n function onXlinkReady(event) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_9__["default"].INTERNAL_MANIFEST_LOADED, {\n manifest: event.manifest\n });\n }\n\n function createParser(data) {\n var parser = null; // Analyze manifest content to detect protocol and select appropriate parser\n\n if (data.indexOf(\'SmoothStreamingMedia\') > -1) {\n //do some business to transform it into a Dash Manifest\n if (mssHandler) {\n parser = mssHandler.createMssParser();\n mssHandler.registerEvents();\n }\n\n return parser;\n } else if (data.indexOf(\'MPD\') > -1 || data.indexOf(\'Patch\') > -1) {\n return Object(_dash_parser_DashParser__WEBPACK_IMPORTED_MODULE_12__["default"])(context).create({\n debug: debug\n });\n } else {\n return parser;\n }\n }\n\n function load(url) {\n var request = new _vo_TextRequest__WEBPACK_IMPORTED_MODULE_5__["default"](url, _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_7__["HTTPRequest"].MPD_TYPE);\n urlLoader.load({\n request: request,\n success: function success(data, textStatus, responseURL) {\n // Manage situations in which success is called after calling reset\n if (!xlinkController) return;\n var actualUrl, baseUri, manifest; // Handle redirects for the MPD - as per RFC3986 Section 5.1.3\n // also handily resolves relative MPD URLs to absolute\n\n if (responseURL && responseURL !== url) {\n baseUri = urlUtils.parseBaseUrl(responseURL);\n actualUrl = responseURL;\n } else {\n // usually this case will be caught and resolved by\n // responseURL above but it is not available for IE11 and Edge/12 and Edge/13\n // baseUri must be absolute for BaseURL resolution later\n if (urlUtils.isRelative(url)) {\n url = urlUtils.resolve(url, window.location.href);\n }\n\n baseUri = urlUtils.parseBaseUrl(url);\n } // A response of no content implies in-memory is properly up to date\n\n\n if (textStatus == \'No Content\') {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_9__["default"].INTERNAL_MANIFEST_LOADED, {\n manifest: null\n });\n return;\n } // Create parser according to manifest type\n\n\n if (parser === null) {\n parser = createParser(data);\n }\n\n if (parser === null) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_9__["default"].INTERNAL_MANIFEST_LOADED, {\n manifest: null,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_6__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__["default"].MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__["default"].MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE + "".concat(url))\n });\n return;\n } // init xlinkcontroller with matchers and iron object from created parser\n\n\n xlinkController.setMatchers(parser.getMatchers());\n xlinkController.setIron(parser.getIron());\n\n try {\n manifest = parser.parse(data);\n } catch (e) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_9__["default"].INTERNAL_MANIFEST_LOADED, {\n manifest: null,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_6__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__["default"].MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__["default"].MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE + "".concat(url))\n });\n return;\n }\n\n if (manifest) {\n manifest.url = actualUrl || url; // URL from which the MPD was originally retrieved (MPD updates will not change this value)\n\n if (!manifest.originalUrl) {\n manifest.originalUrl = manifest.url;\n } // In the following, we only use the first Location entry even if many are available\n // Compare with ManifestUpdater/DashManifestModel\n\n\n if (manifest.hasOwnProperty(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].LOCATION)) {\n baseUri = urlUtils.parseBaseUrl(manifest.Location_asArray[0]);\n logger.debug(\'BaseURI set by Location to: \' + baseUri);\n }\n\n manifest.baseUri = baseUri;\n manifest.loadedTime = new Date();\n xlinkController.resolveManifestOnLoad(manifest);\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_9__["default"].ORIGINAL_MANIFEST_LOADED, {\n originalManifest: data\n });\n } else {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_9__["default"].INTERNAL_MANIFEST_LOADED, {\n manifest: null,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_6__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__["default"].MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__["default"].MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE + "".concat(url))\n });\n }\n },\n error: function error(request, statusText, errorText) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_9__["default"].INTERNAL_MANIFEST_LOADED, {\n manifest: null,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_6__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__["default"].MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__["default"].MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE + "".concat(url, ", ").concat(errorText))\n });\n }\n });\n }\n\n function reset() {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_9__["default"].XLINK_READY, onXlinkReady, instance);\n\n if (mssHandler) {\n mssHandler.reset();\n }\n\n if (xlinkController) {\n xlinkController.reset();\n xlinkController = null;\n }\n\n if (urlLoader) {\n urlLoader.abort();\n urlLoader = null;\n }\n }\n\n instance = {\n load: load,\n reset: reset\n };\n setup();\n return instance;\n}\n\nManifestLoader.__dashjs_factory_name = \'ManifestLoader\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_11__["default"].getClassFactory(ManifestLoader);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/ManifestUpdater.js":\n/*!******************************************!*\\\n !*** ./src/streaming/ManifestUpdater.js ***!\n \\******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1034712__) {\n__nested_webpack_require_1034712__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1034712__(/*! ../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1034712__(/*! ../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1034712__(/*! ../streaming/MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1034712__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1034712__(/*! ../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1034712__(/*! ../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1034712__(/*! ../dash/constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/* harmony import */ var _utils_URLUtils__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1034712__(/*! ./utils/URLUtils */ "./src/streaming/utils/URLUtils.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\nfunction ManifestUpdater() {\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n var urlUtils = Object(_utils_URLUtils__WEBPACK_IMPORTED_MODULE_7__["default"])(context).getInstance();\n var instance, logger, refreshDelay, refreshTimer, isPaused, isStopped, isUpdating, manifestLoader, manifestModel, adapter, errHandler, settings;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance().getLogger(instance);\n }\n\n function setConfig(config) {\n if (!config) return;\n\n if (config.manifestModel) {\n manifestModel = config.manifestModel;\n }\n\n if (config.adapter) {\n adapter = config.adapter;\n }\n\n if (config.manifestLoader) {\n manifestLoader = config.manifestLoader;\n }\n\n if (config.errHandler) {\n errHandler = config.errHandler;\n }\n\n if (config.settings) {\n settings = config.settings;\n }\n }\n\n function initialize() {\n resetInitialSettings();\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].STREAMS_COMPOSED, onStreamsComposed, this);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_2__["default"].PLAYBACK_STARTED, onPlaybackStarted, this);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_2__["default"].PLAYBACK_PAUSED, onPlaybackPaused, this);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].INTERNAL_MANIFEST_LOADED, onManifestLoaded, this);\n }\n\n function setManifest(manifest) {\n update(manifest);\n }\n\n function resetInitialSettings() {\n refreshDelay = NaN;\n isUpdating = false;\n isPaused = true;\n isStopped = false;\n stopManifestRefreshTimer();\n }\n\n function reset() {\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_2__["default"].PLAYBACK_STARTED, onPlaybackStarted, this);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_2__["default"].PLAYBACK_PAUSED, onPlaybackPaused, this);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].STREAMS_COMPOSED, onStreamsComposed, this);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].INTERNAL_MANIFEST_LOADED, onManifestLoaded, this);\n resetInitialSettings();\n }\n\n function stopManifestRefreshTimer() {\n if (refreshTimer !== null) {\n clearTimeout(refreshTimer);\n refreshTimer = null;\n }\n }\n\n function startManifestRefreshTimer(delay) {\n stopManifestRefreshTimer();\n\n if (isStopped) {\n return;\n }\n\n if (isNaN(delay) && !isNaN(refreshDelay)) {\n delay = refreshDelay * 1000;\n }\n\n if (!isNaN(delay)) {\n logger.debug(\'Refresh manifest in \' + delay + \' milliseconds.\');\n refreshTimer = setTimeout(onRefreshTimer, delay);\n }\n }\n\n function refreshManifest() {\n var ignorePatch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n isUpdating = true;\n var manifest = manifestModel.getValue(); // default to the original url in the manifest\n\n var url = manifest.url; // Check for PatchLocation and Location alternatives\n\n var patchLocation = adapter.getPatchLocation(manifest);\n var location = adapter.getLocation(manifest);\n\n if (patchLocation && !ignorePatch) {\n url = patchLocation;\n } else if (location) {\n url = location;\n } // if one of the alternatives was relative, convert to absolute\n\n\n if (urlUtils.isRelative(url)) {\n url = urlUtils.resolve(url, manifest.url);\n }\n\n manifestLoader.load(url);\n }\n\n function update(manifest) {\n if (!manifest) {\n // successful update with no content implies existing manifest remains valid\n manifest = manifestModel.getValue(); // override load time to avoid invalid latency tracking and ensure update cadence\n\n manifest.loadedTime = new Date();\n } else if (adapter.getIsPatch(manifest)) {\n // with patches the in-memory manifest is our base\n var patch = manifest;\n manifest = manifestModel.getValue(); // check for patch validity\n\n var isPatchValid = adapter.isPatchValid(manifest, patch);\n var patchSuccessful = isPatchValid;\n\n if (isPatchValid) {\n // grab publish time before update\n var publishTime = adapter.getPublishTime(manifest); // apply validated patch to manifest\n\n patchSuccessful = adapter.applyPatchToManifest(manifest, patch); // get the updated publish time\n\n var updatedPublishTime = adapter.getPublishTime(manifest); // ensure the patch properly updated the in-memory publish time\n\n patchSuccessful = publishTime.getTime() != updatedPublishTime.getTime();\n } // if the patch failed to apply, force a full manifest refresh\n\n\n if (!patchSuccessful) {\n logger.debug(\'Patch provided is invalid, performing full manifest refresh\');\n refreshManifest(true);\n return;\n } // override load time to avoid invalid latency tracking and ensure update cadence\n\n\n manifest.loadedTime = new Date();\n } // See DASH-IF IOP v4.3 section 4.6.4 "Transition Phase between Live and On-Demand"\n // Stop manifest update, ignore static manifest and signal end of dynamic stream to detect end of stream\n\n\n if (manifestModel.getValue() && manifestModel.getValue().type === _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].DYNAMIC && manifest.type === _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].STATIC) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].DYNAMIC_TO_STATIC);\n isUpdating = false;\n isStopped = true;\n return;\n }\n\n manifestModel.setValue(manifest);\n var date = new Date();\n var latencyOfLastUpdate = (date.getTime() - manifest.loadedTime.getTime()) / 1000;\n refreshDelay = adapter.getManifestUpdatePeriod(manifest, latencyOfLastUpdate); // setTimeout uses a 32 bit number to store the delay. Any number greater than it\n // will cause event associated with setTimeout to trigger immediately\n\n if (refreshDelay * 1000 > 0x7FFFFFFF) {\n refreshDelay = 0x7FFFFFFF / 1000;\n }\n\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].MANIFEST_UPDATED, {\n manifest: manifest\n });\n logger.info(\'Manifest has been refreshed at \' + date + \'[\' + date.getTime() / 1000 + \'] \');\n\n if (!isPaused) {\n startManifestRefreshTimer();\n }\n }\n\n function onRefreshTimer() {\n if (isPaused) {\n return;\n }\n\n if (isUpdating) {\n startManifestRefreshTimer(settings.get().streaming.manifestUpdateRetryInterval);\n return;\n }\n\n refreshManifest();\n }\n\n function onManifestLoaded(e) {\n if (!e.error) {\n update(e.manifest);\n } else if (e.error.code === _core_errors_Errors__WEBPACK_IMPORTED_MODULE_5__["default"].MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE) {\n errHandler.error(e.error);\n }\n }\n\n function onPlaybackStarted()\n /*e*/\n {\n isPaused = false;\n startManifestRefreshTimer();\n }\n\n function onPlaybackPaused()\n /*e*/\n {\n isPaused = !settings.get().streaming.scheduling.scheduleWhilePaused;\n\n if (isPaused) {\n stopManifestRefreshTimer();\n }\n }\n\n function onStreamsComposed()\n /*e*/\n {\n // When streams are ready we can consider manifest update completed. Resolve the update promise.\n isUpdating = false;\n }\n\n function getIsUpdating() {\n return isUpdating;\n }\n\n instance = {\n initialize: initialize,\n setManifest: setManifest,\n refreshManifest: refreshManifest,\n getIsUpdating: getIsUpdating,\n setConfig: setConfig,\n reset: reset\n };\n setup();\n return instance;\n}\n\nManifestUpdater.__dashjs_factory_name = \'ManifestUpdater\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_3__["default"].getClassFactory(ManifestUpdater));\n\n/***/ }),\n\n/***/ "./src/streaming/MediaPlayer.js":\n/*!**************************************!*\\\n !*** ./src/streaming/MediaPlayer.js ***!\n \\**************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1046084__) {\n__nested_webpack_require_1046084__.r(__nested_webpack_exports__);\n/* harmony import */ var _externals_cea608_parser__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1046084__(/*! ../../externals/cea608-parser */ "./externals/cea608-parser.js");\n/* harmony import */ var _externals_cea608_parser__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_1046084__.n(_externals_cea608_parser__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1046084__(/*! ./constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1046084__(/*! ../dash/constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1046084__(/*! ./constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _controllers_PlaybackController__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1046084__(/*! ./controllers/PlaybackController */ "./src/streaming/controllers/PlaybackController.js");\n/* harmony import */ var _controllers_StreamController__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1046084__(/*! ./controllers/StreamController */ "./src/streaming/controllers/StreamController.js");\n/* harmony import */ var _controllers_GapController__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1046084__(/*! ./controllers/GapController */ "./src/streaming/controllers/GapController.js");\n/* harmony import */ var _controllers_MediaController__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1046084__(/*! ./controllers/MediaController */ "./src/streaming/controllers/MediaController.js");\n/* harmony import */ var _controllers_BaseURLController__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1046084__(/*! ./controllers/BaseURLController */ "./src/streaming/controllers/BaseURLController.js");\n/* harmony import */ var _ManifestLoader__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1046084__(/*! ./ManifestLoader */ "./src/streaming/ManifestLoader.js");\n/* harmony import */ var _utils_ErrorHandler__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_1046084__(/*! ./utils/ErrorHandler */ "./src/streaming/utils/ErrorHandler.js");\n/* harmony import */ var _utils_Capabilities__WEBPACK_IMPORTED_MODULE_11__ = __nested_webpack_require_1046084__(/*! ./utils/Capabilities */ "./src/streaming/utils/Capabilities.js");\n/* harmony import */ var _utils_CapabilitiesFilter__WEBPACK_IMPORTED_MODULE_12__ = __nested_webpack_require_1046084__(/*! ./utils/CapabilitiesFilter */ "./src/streaming/utils/CapabilitiesFilter.js");\n/* harmony import */ var _utils_RequestModifier__WEBPACK_IMPORTED_MODULE_13__ = __nested_webpack_require_1046084__(/*! ./utils/RequestModifier */ "./src/streaming/utils/RequestModifier.js");\n/* harmony import */ var _models_URIFragmentModel__WEBPACK_IMPORTED_MODULE_14__ = __nested_webpack_require_1046084__(/*! ./models/URIFragmentModel */ "./src/streaming/models/URIFragmentModel.js");\n/* harmony import */ var _models_ManifestModel__WEBPACK_IMPORTED_MODULE_15__ = __nested_webpack_require_1046084__(/*! ./models/ManifestModel */ "./src/streaming/models/ManifestModel.js");\n/* harmony import */ var _models_MediaPlayerModel__WEBPACK_IMPORTED_MODULE_16__ = __nested_webpack_require_1046084__(/*! ./models/MediaPlayerModel */ "./src/streaming/models/MediaPlayerModel.js");\n/* harmony import */ var _controllers_AbrController__WEBPACK_IMPORTED_MODULE_17__ = __nested_webpack_require_1046084__(/*! ./controllers/AbrController */ "./src/streaming/controllers/AbrController.js");\n/* harmony import */ var _net_SchemeLoaderFactory__WEBPACK_IMPORTED_MODULE_18__ = __nested_webpack_require_1046084__(/*! ./net/SchemeLoaderFactory */ "./src/streaming/net/SchemeLoaderFactory.js");\n/* harmony import */ var _models_VideoModel__WEBPACK_IMPORTED_MODULE_19__ = __nested_webpack_require_1046084__(/*! ./models/VideoModel */ "./src/streaming/models/VideoModel.js");\n/* harmony import */ var _models_CmcdModel__WEBPACK_IMPORTED_MODULE_20__ = __nested_webpack_require_1046084__(/*! ./models/CmcdModel */ "./src/streaming/models/CmcdModel.js");\n/* harmony import */ var _utils_DOMStorage__WEBPACK_IMPORTED_MODULE_21__ = __nested_webpack_require_1046084__(/*! ./utils/DOMStorage */ "./src/streaming/utils/DOMStorage.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_22__ = __nested_webpack_require_1046084__(/*! ./../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_23__ = __nested_webpack_require_1046084__(/*! ./../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_24__ = __nested_webpack_require_1046084__(/*! ./../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_25__ = __nested_webpack_require_1046084__(/*! ./../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_26__ = __nested_webpack_require_1046084__(/*! ./MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_27__ = __nested_webpack_require_1046084__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Settings__WEBPACK_IMPORTED_MODULE_28__ = __nested_webpack_require_1046084__(/*! ../core/Settings */ "./src/core/Settings.js");\n/* harmony import */ var _core_Version__WEBPACK_IMPORTED_MODULE_29__ = __nested_webpack_require_1046084__(/*! ../core/Version */ "./src/core/Version.js");\n/* harmony import */ var _dash_controllers_SegmentBaseController__WEBPACK_IMPORTED_MODULE_30__ = __nested_webpack_require_1046084__(/*! ../dash/controllers/SegmentBaseController */ "./src/dash/controllers/SegmentBaseController.js");\n/* harmony import */ var _dash_DashAdapter__WEBPACK_IMPORTED_MODULE_31__ = __nested_webpack_require_1046084__(/*! ../dash/DashAdapter */ "./src/dash/DashAdapter.js");\n/* harmony import */ var _dash_DashMetrics__WEBPACK_IMPORTED_MODULE_32__ = __nested_webpack_require_1046084__(/*! ../dash/DashMetrics */ "./src/dash/DashMetrics.js");\n/* harmony import */ var _dash_utils_TimelineConverter__WEBPACK_IMPORTED_MODULE_33__ = __nested_webpack_require_1046084__(/*! ../dash/utils/TimelineConverter */ "./src/dash/utils/TimelineConverter.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_34__ = __nested_webpack_require_1046084__(/*! ./vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _externals_base64__WEBPACK_IMPORTED_MODULE_35__ = __nested_webpack_require_1046084__(/*! ../../externals/base64 */ "./externals/base64.js");\n/* harmony import */ var _externals_base64__WEBPACK_IMPORTED_MODULE_35___default = /*#__PURE__*/__nested_webpack_require_1046084__.n(_externals_base64__WEBPACK_IMPORTED_MODULE_35__);\n/* harmony import */ var codem_isoboxer__WEBPACK_IMPORTED_MODULE_36__ = __nested_webpack_require_1046084__(/*! codem-isoboxer */ "./node_modules/codem-isoboxer/dist/iso_boxer.js");\n/* harmony import */ var codem_isoboxer__WEBPACK_IMPORTED_MODULE_36___default = /*#__PURE__*/__nested_webpack_require_1046084__.n(codem_isoboxer__WEBPACK_IMPORTED_MODULE_36__);\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_37__ = __nested_webpack_require_1046084__(/*! ./vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_38__ = __nested_webpack_require_1046084__(/*! ./utils/SupervisorTools */ "./src/streaming/utils/SupervisorTools.js");\n/* harmony import */ var _ManifestUpdater__WEBPACK_IMPORTED_MODULE_39__ = __nested_webpack_require_1046084__(/*! ./ManifestUpdater */ "./src/streaming/ManifestUpdater.js");\n/* harmony import */ var _streaming_utils_URLUtils__WEBPACK_IMPORTED_MODULE_40__ = __nested_webpack_require_1046084__(/*! ../streaming/utils/URLUtils */ "./src/streaming/utils/URLUtils.js");\n/* harmony import */ var _utils_BoxParser__WEBPACK_IMPORTED_MODULE_41__ = __nested_webpack_require_1046084__(/*! ./utils/BoxParser */ "./src/streaming/utils/BoxParser.js");\n/* harmony import */ var _text_TextController__WEBPACK_IMPORTED_MODULE_42__ = __nested_webpack_require_1046084__(/*! ./text/TextController */ "./src/streaming/text/TextController.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n //Dash\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * The media types\n * @typedef {("video" | "audio" | "text" | "image")} MediaType\n */\n\n/**\n * @module MediaPlayer\n * @description The MediaPlayer is the primary dash.js Module and a Facade to build your player around.\n * It will allow you access to all the important dash.js properties/methods via the public API and all the\n * events to build a robust DASH media player.\n */\n\nfunction MediaPlayer() {\n /**\n * @constant {string} STREAMING_NOT_INITIALIZED_ERROR error string thrown when a function is called before the dash.js has been fully initialized\n * @inner\n */\n var STREAMING_NOT_INITIALIZED_ERROR = \'You must first call initialize() and set a source before calling this method\';\n /**\n * @constant {string} PLAYBACK_NOT_INITIALIZED_ERROR error string thrown when a function is called before the dash.js has been fully initialized\n * @inner\n */\n\n var PLAYBACK_NOT_INITIALIZED_ERROR = \'You must first call initialize() and set a valid source and view before calling this method\';\n /**\n * @constant {string} ELEMENT_NOT_ATTACHED_ERROR error string thrown when a function is called before the dash.js has received a reference of an HTML5 video element\n * @inner\n */\n\n var ELEMENT_NOT_ATTACHED_ERROR = \'You must first call attachView() to set the video element before calling this method\';\n /**\n * @constant {string} SOURCE_NOT_ATTACHED_ERROR error string thrown when a function is called before the dash.js has received a valid source stream.\n * @inner\n */\n\n var SOURCE_NOT_ATTACHED_ERROR = \'You must first call attachSource() with a valid source before calling this method\';\n /**\n * @constant {string} MEDIA_PLAYER_NOT_INITIALIZED_ERROR error string thrown when a function is called before the dash.js has been fully initialized.\n * @inner\n */\n\n var MEDIA_PLAYER_NOT_INITIALIZED_ERROR = \'MediaPlayer not initialized!\';\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_24__["default"])(context).getInstance();\n var settings = Object(_core_Settings__WEBPACK_IMPORTED_MODULE_28__["default"])(context).getInstance();\n var debug = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_22__["default"])(context).getInstance({\n settings: settings\n });\n var instance, logger, source, protectionData, mediaPlayerInitialized, streamingInitialized, playbackInitialized, autoPlay, abrController, schemeLoaderFactory, timelineConverter, mediaController, protectionController, metricsReportingController, mssHandler, offlineController, adapter, mediaPlayerModel, errHandler, baseURLController, capabilities, capabilitiesFilter, streamController, textController, gapController, playbackController, dashMetrics, manifestModel, cmcdModel, videoModel, uriFragmentModel, domStorage, segmentBaseController, licenseRequestFilters, licenseResponseFilters, customCapabilitiesFilters;\n /*\n ---------------------------------------------------------------------------\n INIT FUNCTIONS\n ---------------------------------------------------------------------------\n */\n\n function setup() {\n logger = debug.getLogger(instance);\n mediaPlayerInitialized = false;\n playbackInitialized = false;\n streamingInitialized = false;\n autoPlay = true;\n protectionController = null;\n offlineController = null;\n protectionData = null;\n adapter = null;\n segmentBaseController = null;\n _core_events_Events__WEBPACK_IMPORTED_MODULE_25__["default"].extend(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_26__["default"]);\n mediaPlayerModel = Object(_models_MediaPlayerModel__WEBPACK_IMPORTED_MODULE_16__["default"])(context).getInstance();\n videoModel = Object(_models_VideoModel__WEBPACK_IMPORTED_MODULE_19__["default"])(context).getInstance();\n uriFragmentModel = Object(_models_URIFragmentModel__WEBPACK_IMPORTED_MODULE_14__["default"])(context).getInstance();\n licenseRequestFilters = [];\n licenseResponseFilters = [];\n customCapabilitiesFilters = [];\n }\n /**\n * Configure media player with customs controllers. Helpful for tests\n *\n * @param {object=} config controllers configuration\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function setConfig(config) {\n if (!config) {\n return;\n }\n\n if (config.capabilities) {\n capabilities = config.capabilities;\n }\n\n if (config.capabilitiesFilter) {\n capabilitiesFilter = config.capabilitiesFilter;\n }\n\n if (config.streamController) {\n streamController = config.streamController;\n }\n\n if (config.textController) {\n textController = config.textController;\n }\n\n if (config.gapController) {\n gapController = config.gapController;\n }\n\n if (config.playbackController) {\n playbackController = config.playbackController;\n }\n\n if (config.mediaPlayerModel) {\n mediaPlayerModel = config.mediaPlayerModel;\n }\n\n if (config.abrController) {\n abrController = config.abrController;\n }\n\n if (config.schemeLoaderFactory) {\n schemeLoaderFactory = config.schemeLoaderFactory;\n }\n\n if (config.mediaController) {\n mediaController = config.mediaController;\n }\n\n if (config.settings) {\n settings = config.settings;\n }\n }\n /**\n * Upon creating the MediaPlayer you must call initialize before you call anything else.\n * There is one exception to this rule. It is crucial to call {@link module:MediaPlayer#extend extend()}\n * with all your extensions prior to calling initialize.\n *\n * ALL arguments are optional and there are individual methods to set each argument later on.\n * The args in this method are just for convenience and should only be used for a simple player setup.\n *\n * @param {HTML5MediaElement=} view - Optional arg to set the video element. {@link module:MediaPlayer#attachView attachView()}\n * @param {string=} source - Optional arg to set the media source. {@link module:MediaPlayer#attachSource attachSource()}\n * @param {boolean=} AutoPlay - Optional arg to set auto play. {@link module:MediaPlayer#setAutoPlay setAutoPlay()}\n * @see {@link module:MediaPlayer#attachView attachView()}\n * @see {@link module:MediaPlayer#attachSource attachSource()}\n * @see {@link module:MediaPlayer#setAutoPlay setAutoPlay()}\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function initialize(view, source, AutoPlay) {\n if (!capabilities) {\n capabilities = Object(_utils_Capabilities__WEBPACK_IMPORTED_MODULE_11__["default"])(context).getInstance();\n capabilities.setConfig({\n settings: settings\n });\n }\n\n if (!errHandler) {\n errHandler = Object(_utils_ErrorHandler__WEBPACK_IMPORTED_MODULE_10__["default"])(context).getInstance();\n }\n\n if (!capabilities.supportsMediaSource()) {\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_37__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_23__["default"].CAPABILITY_MEDIASOURCE_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_23__["default"].CAPABILITY_MEDIASOURCE_ERROR_MESSAGE));\n return;\n }\n\n if (!mediaPlayerInitialized) {\n mediaPlayerInitialized = true; // init some controllers and models\n\n timelineConverter = Object(_dash_utils_TimelineConverter__WEBPACK_IMPORTED_MODULE_33__["default"])(context).getInstance();\n\n if (!abrController) {\n abrController = Object(_controllers_AbrController__WEBPACK_IMPORTED_MODULE_17__["default"])(context).getInstance();\n abrController.setConfig({\n settings: settings\n });\n }\n\n if (!schemeLoaderFactory) {\n schemeLoaderFactory = Object(_net_SchemeLoaderFactory__WEBPACK_IMPORTED_MODULE_18__["default"])(context).getInstance();\n }\n\n if (!playbackController) {\n playbackController = Object(_controllers_PlaybackController__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n }\n\n if (!mediaController) {\n mediaController = Object(_controllers_MediaController__WEBPACK_IMPORTED_MODULE_7__["default"])(context).getInstance();\n }\n\n if (!streamController) {\n streamController = Object(_controllers_StreamController__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance();\n }\n\n if (!gapController) {\n gapController = Object(_controllers_GapController__WEBPACK_IMPORTED_MODULE_6__["default"])(context).getInstance();\n }\n\n if (!capabilitiesFilter) {\n capabilitiesFilter = Object(_utils_CapabilitiesFilter__WEBPACK_IMPORTED_MODULE_12__["default"])(context).getInstance();\n }\n\n adapter = Object(_dash_DashAdapter__WEBPACK_IMPORTED_MODULE_31__["default"])(context).getInstance();\n manifestModel = Object(_models_ManifestModel__WEBPACK_IMPORTED_MODULE_15__["default"])(context).getInstance();\n cmcdModel = Object(_models_CmcdModel__WEBPACK_IMPORTED_MODULE_20__["default"])(context).getInstance();\n dashMetrics = Object(_dash_DashMetrics__WEBPACK_IMPORTED_MODULE_32__["default"])(context).getInstance({\n settings: settings\n });\n domStorage = Object(_utils_DOMStorage__WEBPACK_IMPORTED_MODULE_21__["default"])(context).getInstance({\n settings: settings\n });\n adapter.setConfig({\n constants: _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"],\n cea608parser: _externals_cea608_parser__WEBPACK_IMPORTED_MODULE_0___default.a,\n errHandler: errHandler,\n BASE64: _externals_base64__WEBPACK_IMPORTED_MODULE_35___default.a\n });\n\n if (!baseURLController) {\n baseURLController = Object(_controllers_BaseURLController__WEBPACK_IMPORTED_MODULE_8__["default"])(context).create();\n }\n\n baseURLController.setConfig({\n adapter: adapter\n });\n\n if (!segmentBaseController) {\n segmentBaseController = Object(_dash_controllers_SegmentBaseController__WEBPACK_IMPORTED_MODULE_30__["default"])(context).getInstance({\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n errHandler: errHandler,\n baseURLController: baseURLController,\n events: _core_events_Events__WEBPACK_IMPORTED_MODULE_25__["default"],\n eventBus: eventBus,\n debug: debug,\n boxParser: Object(_utils_BoxParser__WEBPACK_IMPORTED_MODULE_41__["default"])(context).getInstance(),\n requestModifier: Object(_utils_RequestModifier__WEBPACK_IMPORTED_MODULE_13__["default"])(context).getInstance(),\n errors: _core_errors_Errors__WEBPACK_IMPORTED_MODULE_23__["default"]\n });\n } // configure controllers\n\n\n mediaController.setConfig({\n domStorage: domStorage,\n settings: settings\n });\n restoreDefaultUTCTimingSources();\n setAutoPlay(AutoPlay !== undefined ? AutoPlay : true); // Detect and initialize offline module to support offline contents playback\n\n _detectOffline();\n }\n\n if (view) {\n attachView(view);\n }\n\n if (source) {\n attachSource(source);\n }\n\n logger.info(\'[dash.js \' + getVersion() + \'] \' + \'MediaPlayer has been initialized\');\n }\n /**\n * Sets the MPD source and the video element to null. You can also reset the MediaPlayer by\n * calling attachSource with a new source file.\n *\n * This call does not destroy the MediaPlayer. To destroy the MediaPlayer and free all of its\n * memory, call destroy().\n *\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function reset() {\n attachSource(null);\n attachView(null);\n protectionData = null;\n\n if (protectionController) {\n protectionController.reset();\n protectionController = null;\n }\n\n if (metricsReportingController) {\n metricsReportingController.reset();\n metricsReportingController = null;\n }\n\n settings.reset();\n\n if (offlineController) {\n offlineController.reset();\n offlineController = null;\n }\n }\n /**\n * Completely destroys the media player and frees all memory.\n *\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function destroy() {\n reset();\n licenseRequestFilters = [];\n licenseResponseFilters = [];\n customCapabilitiesFilters = [];\n _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_27__["default"].deleteSingletonInstances(context);\n }\n /**\n * The ready state of the MediaPlayer based on both the video element and MPD source being defined.\n *\n * @returns {boolean} The current ready state of the MediaPlayer\n * @see {@link module:MediaPlayer#attachView attachView()}\n * @see {@link module:MediaPlayer#attachSource attachSource()}\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function isReady() {\n return !!source && !!videoModel.getElement();\n }\n /**\n * Use the on method to listen for public events found in MediaPlayer.events. {@link MediaPlayerEvents}\n *\n * @param {string} type - {@link MediaPlayerEvents}\n * @param {Function} listener - callback method when the event fires.\n * @param {Object} scope - context of the listener so it can be removed properly.\n * @param {Object} options - object to define various options such as priority and mode\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function on(type, listener, scope, options) {\n eventBus.on(type, listener, scope, options);\n }\n /**\n * Use the off method to remove listeners for public events found in MediaPlayer.events. {@link MediaPlayerEvents}\n *\n * @param {string} type - {@link MediaPlayerEvents}\n * @param {Function} listener - callback method when the event fires.\n * @param {Object} scope - context of the listener so it can be removed properly.\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function off(type, listener, scope) {\n eventBus.off(type, listener, scope);\n }\n /**\n * Current version of Dash.js\n * @returns {string} the current dash.js version string.\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getVersion() {\n return Object(_core_Version__WEBPACK_IMPORTED_MODULE_29__["getVersionString"])();\n }\n /**\n * Use this method to access the dash.js logging class.\n *\n * @returns {Debug}\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getDebug() {\n return debug;\n }\n /*\n ---------------------------------------------------------------------------\n PLAYBACK FUNCTIONS\n ---------------------------------------------------------------------------\n */\n\n /**\n * The play method initiates playback of the media defined by the {@link module:MediaPlayer#attachSource attachSource()} method.\n * This method will call play on the native Video Element.\n *\n * @see {@link module:MediaPlayer#attachSource attachSource()}\n * @throws {@link module:MediaPlayer~PLAYBACK_NOT_INITIALIZED_ERROR PLAYBACK_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function play() {\n if (!playbackInitialized) {\n throw PLAYBACK_NOT_INITIALIZED_ERROR;\n }\n\n if (!autoPlay || isPaused() && playbackInitialized) {\n playbackController.play();\n }\n }\n /**\n * This method will call pause on the native Video Element.\n *\n * @throws {@link module:MediaPlayer~PLAYBACK_NOT_INITIALIZED_ERROR PLAYBACK_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function pause() {\n if (!playbackInitialized) {\n throw PLAYBACK_NOT_INITIALIZED_ERROR;\n }\n\n playbackController.pause();\n }\n /**\n * Returns a Boolean that indicates whether the Video Element is paused.\n * @return {boolean}\n * @throws {@link module:MediaPlayer~PLAYBACK_NOT_INITIALIZED_ERROR PLAYBACK_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function isPaused() {\n if (!playbackInitialized) {\n throw PLAYBACK_NOT_INITIALIZED_ERROR;\n }\n\n return playbackController.isPaused();\n }\n /**\n * Sets the currentTime property of the attached video element. If it is a live stream with a\n * timeShiftBufferLength, then the DVR window offset will be automatically calculated.\n *\n * @param {number} value - A relative time, in seconds, based on the return value of the {@link module:MediaPlayer#duration duration()} method is expected\n * @see {@link module:MediaPlayer#getDVRSeekOffset getDVRSeekOffset()}\n * @throws {@link module:MediaPlayer~PLAYBACK_NOT_INITIALIZED_ERROR PLAYBACK_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @throws {@link Constants#BAD_ARGUMENT_ERROR BAD_ARGUMENT_ERROR} if called with an invalid argument, not number type or is NaN.\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function seek(value) {\n if (!playbackInitialized) {\n throw PLAYBACK_NOT_INITIALIZED_ERROR;\n }\n\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_38__["checkParameterType"])(value, \'number\');\n\n if (isNaN(value)) {\n throw _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].BAD_ARGUMENT_ERROR;\n }\n\n var s = playbackController.getIsDynamic() ? getDVRSeekOffset(value) : value;\n playbackController.seek(s);\n }\n /**\n * Returns a Boolean that indicates whether the media is in the process of seeking to a new position.\n * @return {boolean}\n * @throws {@link module:MediaPlayer~PLAYBACK_NOT_INITIALIZED_ERROR PLAYBACK_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function isSeeking() {\n if (!playbackInitialized) {\n throw PLAYBACK_NOT_INITIALIZED_ERROR;\n }\n\n return playbackController.isSeeking();\n }\n /**\n * Returns a Boolean that indicates whether the media is in the process of dynamic.\n * @return {boolean}\n * @throws {@link module:MediaPlayer~PLAYBACK_NOT_INITIALIZED_ERROR PLAYBACK_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function isDynamic() {\n if (!playbackInitialized) {\n throw PLAYBACK_NOT_INITIALIZED_ERROR;\n }\n\n return playbackController.getIsDynamic();\n }\n /**\n * Use this method to set the native Video Element\'s playback rate.\n * @param {number} value\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function setPlaybackRate(value) {\n getVideoElement().playbackRate = value;\n }\n /**\n * Returns the current playback rate.\n * @returns {number}\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getPlaybackRate() {\n return getVideoElement().playbackRate;\n }\n /**\n * Use this method to set the native Video Element\'s muted state. Takes a Boolean that determines whether audio is muted. true if the audio is muted and false otherwise.\n * @param {boolean} value\n * @memberof module:MediaPlayer\n * @throws {@link Constants#BAD_ARGUMENT_ERROR BAD_ARGUMENT_ERROR} if called with an invalid argument, not boolean type.\n * @instance\n */\n\n\n function setMute(value) {\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_38__["checkParameterType"])(value, \'boolean\');\n getVideoElement().muted = value;\n }\n /**\n * A Boolean that determines whether audio is muted.\n * @returns {boolean}\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function isMuted() {\n return getVideoElement().muted;\n }\n /**\n * A double indicating the audio volume, from 0.0 (silent) to 1.0 (loudest).\n * @param {number} value\n * @memberof module:MediaPlayer\n * @throws {@link Constants#BAD_ARGUMENT_ERROR BAD_ARGUMENT_ERROR} if called with an invalid argument, not number type, or is NaN or not between 0 and 1.\n * @instance\n */\n\n\n function setVolume(value) {\n if (typeof value !== \'number\' || isNaN(value) || value < 0.0 || value > 1.0) {\n throw _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].BAD_ARGUMENT_ERROR;\n }\n\n getVideoElement().volume = value;\n }\n /**\n * Returns the current audio volume, from 0.0 (silent) to 1.0 (loudest).\n * @returns {number}\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getVolume() {\n return getVideoElement().volume;\n }\n /**\n * The length of the buffer for a given media type, in seconds. Valid media\n * types are "video", "audio" and "text". If no type is passed\n * in, then the minimum of video, audio and text buffer length is\n * returned. NaN is returned if an invalid type is requested, the\n * presentation does not contain that type, or if no arguments are passed\n * and the presentation does not include any adaption sets of valid media\n * type.\n *\n * @param {MediaType} type - \'video\', \'audio\' or \'text\'\n * @returns {number} The length of the buffer for the given media type, in\n * seconds, or NaN\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getBufferLength(type) {\n var types = [_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO, _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO, _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].TEXT];\n\n if (!type) {\n var buffer = types.map(function (t) {\n return getTracksFor(t).length > 0 ? getDashMetrics().getCurrentBufferLevel(t) : Number.MAX_VALUE;\n }).reduce(function (p, c) {\n return Math.min(p, c);\n });\n return buffer === Number.MAX_VALUE ? NaN : buffer;\n } else {\n if (types.indexOf(type) !== -1) {\n var _buffer = getDashMetrics().getCurrentBufferLevel(type);\n\n return _buffer ? _buffer : NaN;\n } else {\n logger.warn(\'getBufferLength requested for invalid type\');\n return NaN;\n }\n }\n }\n /**\n * The timeShiftBufferLength (DVR Window), in seconds.\n *\n * @returns {number} The window of allowable play time behind the live point of a live stream as defined in the manifest.\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getDVRWindowSize() {\n var type = streamController && streamController.hasVideoTrack() ? _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO : _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO;\n var metric = dashMetrics.getCurrentDVRInfo(type);\n\n if (!metric) {\n return 0;\n }\n\n return metric.manifestInfo.dvrWindowSize;\n }\n /**\n * This method should only be used with a live stream that has a valid timeShiftBufferLength (DVR Window).\n * NOTE - If you do not need the raw offset value (i.e. media analytics, tracking, etc) consider using the {@link module:MediaPlayer#seek seek()} method\n * which will calculate this value for you and set the video element\'s currentTime property all in one simple call.\n *\n * @param {number} value - A relative time, in seconds, based on the return value of the {@link module:MediaPlayer#duration duration()} method is expected.\n * @returns {number} A value that is relative the available range within the timeShiftBufferLength (DVR Window).\n * @see {@link module:MediaPlayer#seek seek()}\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getDVRSeekOffset(value) {\n var type = streamController && streamController.hasVideoTrack() ? _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO : _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO;\n var metric = dashMetrics.getCurrentDVRInfo(type);\n\n if (!metric) {\n return 0;\n }\n\n var liveDelay = playbackController.getLiveDelay();\n var val = metric.range.start + value;\n\n if (val > metric.range.end - liveDelay) {\n val = metric.range.end - liveDelay;\n }\n\n return val;\n }\n /**\n * Current time of the playhead, in seconds.\n *\n * If called with no arguments then the returned time value is time elapsed since the start point of the first stream, or if it is a live stream, then the time will be based on the return value of the {@link module:MediaPlayer#duration duration()} method.\n * However if a stream ID is supplied then time is relative to the start of that stream, or is null if there is no such stream id in the manifest.\n *\n * @param {string} streamId - The ID of a stream that the returned playhead time must be relative to the start of. If undefined, then playhead time is relative to the first stream.\n * @returns {number} The current playhead time of the media, or null.\n * @throws {@link module:MediaPlayer~PLAYBACK_NOT_INITIALIZED_ERROR PLAYBACK_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function time(streamId) {\n if (!playbackInitialized) {\n throw PLAYBACK_NOT_INITIALIZED_ERROR;\n }\n\n var t = getVideoElement().currentTime;\n\n if (streamId !== undefined) {\n t = streamController.getTimeRelativeToStreamId(t, streamId);\n } else if (playbackController.getIsDynamic()) {\n var type = streamController && streamController.hasVideoTrack() ? _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO : _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO;\n var metric = dashMetrics.getCurrentDVRInfo(type);\n t = metric === null || t === 0 ? 0 : Math.max(0, t - metric.range.start);\n }\n\n return t;\n }\n /**\n * Duration of the media\'s playback, in seconds.\n *\n * @returns {number} The current duration of the media. For a dynamic stream this will return DVRWindow.end - DVRWindow.start\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~PLAYBACK_NOT_INITIALIZED_ERROR PLAYBACK_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @instance\n */\n\n\n function duration() {\n if (!playbackInitialized) {\n throw PLAYBACK_NOT_INITIALIZED_ERROR;\n }\n\n var d = getVideoElement().duration;\n\n if (playbackController.getIsDynamic()) {\n var type = streamController && streamController.hasVideoTrack() ? _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO : _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO;\n var metric = dashMetrics.getCurrentDVRInfo(type);\n d = metric ? metric.range.end - metric.range.start : 0;\n }\n\n return d;\n }\n /**\n * Use this method to get the current playhead time as an absolute value, the time in seconds since midnight UTC, Jan 1 1970.\n * Note - this property only has meaning for live streams. If called before play() has begun, it will return a value of NaN.\n *\n * @returns {number} The current playhead time as UTC timestamp.\n * @throws {@link module:MediaPlayer~PLAYBACK_NOT_INITIALIZED_ERROR PLAYBACK_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function timeAsUTC() {\n if (!playbackInitialized) {\n throw PLAYBACK_NOT_INITIALIZED_ERROR;\n }\n\n if (time() < 0) {\n return NaN;\n }\n\n return _getAsUTC(time());\n }\n /**\n * Use this method to get the current duration as an absolute value, the time in seconds since midnight UTC, Jan 1 1970.\n * Note - this property only has meaning for live streams.\n *\n * @returns {number} The current duration as UTC timestamp.\n * @throws {@link module:MediaPlayer~PLAYBACK_NOT_INITIALIZED_ERROR PLAYBACK_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function durationAsUTC() {\n if (!playbackInitialized) {\n throw PLAYBACK_NOT_INITIALIZED_ERROR;\n }\n\n return _getAsUTC(duration());\n }\n /*\n ---------------------------------------------------------------------------\n AUTO BITRATE\n ---------------------------------------------------------------------------\n */\n\n /**\n * Gets the top quality BitrateInfo checking portal limit and max allowed.\n * It calls getMaxAllowedIndexFor internally\n *\n * @param {MediaType} type - \'video\' or \'audio\'\n * @memberof module:MediaPlayer\n * @returns {BitrateInfo | null}\n * @throws {@link module:MediaPlayer~STREAMING_NOT_INITIALIZED_ERROR STREAMING_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @instance\n */\n\n\n function getTopBitrateInfoFor(type) {\n if (!streamingInitialized) {\n throw STREAMING_NOT_INITIALIZED_ERROR;\n }\n\n return abrController.getTopBitrateInfoFor(type);\n }\n /**\n * Gets the current download quality for media type video, audio or images. For video and audio types the ABR\n * rules update this value before every new download unless autoSwitchBitrate is set to false. For \'image\'\n * type, thumbnails, there is no ABR algorithm and quality is set manually.\n *\n * @param {MediaType} type - \'video\', \'audio\' or \'image\' (thumbnails)\n * @returns {number} the quality index, 0 corresponding to the lowest bitrate\n * @memberof module:MediaPlayer\n * @see {@link module:MediaPlayer#setQualityFor setQualityFor()}\n * @throws {@link module:MediaPlayer~STREAMING_NOT_INITIALIZED_ERROR STREAMING_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @instance\n */\n\n\n function getQualityFor(type) {\n if (!streamingInitialized) {\n throw STREAMING_NOT_INITIALIZED_ERROR;\n }\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].IMAGE) {\n var activeStream = getActiveStream();\n\n if (!activeStream) {\n return -1;\n }\n\n var thumbnailController = activeStream.getThumbnailController();\n return !thumbnailController ? -1 : thumbnailController.getCurrentTrackIndex();\n }\n\n return abrController.getQualityFor(type);\n }\n /**\n * Sets the current quality for media type instead of letting the ABR Heuristics automatically selecting it.\n * This value will be overwritten by the ABR rules unless autoSwitchBitrate is set to false.\n *\n * @param {MediaType} type - \'video\', \'audio\' or \'image\'\n * @param {number} value - the quality index, 0 corresponding to the lowest bitrate\n * @param {boolean} forceReplace - true if segments have to be replaced by segments of the new quality\n * @memberof module:MediaPlayer\n * @see {@link module:MediaPlayer#getQualityFor getQualityFor()}\n * @throws {@link module:MediaPlayer~STREAMING_NOT_INITIALIZED_ERROR STREAMING_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @instance\n */\n\n\n function setQualityFor(type, value) {\n var forceReplace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n\n if (!streamingInitialized) {\n throw STREAMING_NOT_INITIALIZED_ERROR;\n }\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].IMAGE) {\n var activeStream = getActiveStream();\n\n if (!activeStream) {\n return;\n }\n\n var thumbnailController = activeStream.getThumbnailController();\n\n if (thumbnailController) {\n thumbnailController.setTrackByIndex(value);\n }\n }\n\n abrController.setPlaybackQuality(type, streamController.getActiveStreamInfo(), value, {\n forceReplace: forceReplace\n });\n }\n /**\n * Update the video element size variables\n * Should be called on window resize (or any other time player is resized). Fullscreen does trigger a window resize event.\n *\n * Once windowResizeEventCalled = true, abrController.checkPortalSize() will use element size variables rather than querying clientWidth every time.\n *\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function updatePortalSize() {\n abrController.setElementSize();\n abrController.setWindowResizeEventCalled(true);\n }\n /*\n ---------------------------------------------------------------------------\n MEDIA PLAYER CONFIGURATION\n ---------------------------------------------------------------------------\n */\n\n /**\n * <p>Set to false to prevent stream from auto-playing when the view is attached.</p>\n *\n * @param {boolean} value\n * @default true\n * @memberof module:MediaPlayer\n * @see {@link module:MediaPlayer#attachView attachView()}\n * @throws {@link Constants#BAD_ARGUMENT_ERROR BAD_ARGUMENT_ERROR} if called with an invalid argument, not boolean type.\n * @instance\n *\n */\n\n\n function setAutoPlay(value) {\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_38__["checkParameterType"])(value, \'boolean\');\n autoPlay = value;\n }\n /**\n * @returns {boolean} The current autoPlay state.\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getAutoPlay() {\n return autoPlay;\n }\n /**\n * @memberof module:MediaPlayer\n * @instance\n * @returns {number|NaN} Current live stream latency in seconds. It is the difference between now time and time position at the playback head.\n * @throws {@link module:MediaPlayer~MEDIA_PLAYER_NOT_INITIALIZED_ERROR MEDIA_PLAYER_NOT_INITIALIZED_ERROR} if called before initialize function\n */\n\n\n function getCurrentLiveLatency() {\n if (!mediaPlayerInitialized) {\n throw MEDIA_PLAYER_NOT_INITIALIZED_ERROR;\n }\n\n if (!playbackInitialized) {\n return NaN;\n }\n\n return playbackController.getCurrentLiveLatency();\n }\n /**\n * Add a custom ABR Rule\n * Rule will be apply on next stream if a stream is being played\n *\n * @param {string} type - rule type (one of [\'qualitySwitchRules\',\'abandonFragmentRules\'])\n * @param {string} rulename - name of rule (used to identify custom rule). If one rule of same name has been added, then existing rule will be updated\n * @param {object} rule - the rule object instance\n * @memberof module:MediaPlayer\n * @throws {@link Constants#BAD_ARGUMENT_ERROR BAD_ARGUMENT_ERROR} if called with invalid arguments.\n * @instance\n */\n\n\n function addABRCustomRule(type, rulename, rule) {\n mediaPlayerModel.addABRCustomRule(type, rulename, rule);\n }\n /**\n * Remove a custom ABR Rule\n *\n * @param {string} rulename - name of the rule to be removed\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function removeABRCustomRule(rulename) {\n mediaPlayerModel.removeABRCustomRule(rulename);\n }\n /**\n * Remove all custom rules\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function removeAllABRCustomRule() {\n mediaPlayerModel.removeABRCustomRule();\n }\n /**\n * <p>Allows you to set a scheme and server source for UTC live edge detection for dynamic streams.\n * If UTCTiming is defined in the manifest, it will take precedence over any time source manually added.</p>\n * <p>If you have exposed the Date header, use the method {@link module:MediaPlayer#clearDefaultUTCTimingSources clearDefaultUTCTimingSources()}.\n * This will allow the date header on the manifest to be used instead of a time server</p>\n * @param {string} schemeIdUri - <ul>\n * <li>urn:mpeg:dash:utc:http-head:2014</li>\n * <li>urn:mpeg:dash:utc:http-xsdate:2014</li>\n * <li>urn:mpeg:dash:utc:http-iso:2014</li>\n * <li>urn:mpeg:dash:utc:direct:2014</li>\n * </ul>\n * <p>Some specs referencing early ISO23009-1 drafts incorrectly use\n * 2012 in the URI, rather than 2014. support these for now.</p>\n * <ul>\n * <li>urn:mpeg:dash:utc:http-head:2012</li>\n * <li>urn:mpeg:dash:utc:http-xsdate:2012</li>\n * <li>urn:mpeg:dash:utc:http-iso:2012</li>\n * <li>urn:mpeg:dash:utc:direct:2012</li>\n * </ul>\n * @param {string} value - Path to a time source.\n * @default\n * <ul>\n * <li>schemeIdUri:urn:mpeg:dash:utc:http-xsdate:2014</li>\n * <li>value:http://time.akamai.com/?iso&ms/li>\n * </ul>\n * @memberof module:MediaPlayer\n * @see {@link module:MediaPlayer#removeUTCTimingSource removeUTCTimingSource()}\n * @instance\n */\n\n\n function addUTCTimingSource(schemeIdUri, value) {\n mediaPlayerModel.addUTCTimingSource(schemeIdUri, value);\n }\n /**\n * <p>Allows you to remove a UTC time source. Both schemeIdUri and value need to match the Dash.vo.UTCTiming properties in order for the\n * entry to be removed from the array</p>\n * @param {string} schemeIdUri - see {@link module:MediaPlayer#addUTCTimingSource addUTCTimingSource()}\n * @param {string} value - see {@link module:MediaPlayer#addUTCTimingSource addUTCTimingSource()}\n * @memberof module:MediaPlayer\n * @see {@link module:MediaPlayer#clearDefaultUTCTimingSources clearDefaultUTCTimingSources()}\n * @throws {@link Constants#BAD_ARGUMENT_ERROR BAD_ARGUMENT_ERROR} if called with invalid arguments, schemeIdUri and value are not string type.\n * @instance\n */\n\n\n function removeUTCTimingSource(schemeIdUri, value) {\n mediaPlayerModel.removeUTCTimingSource(schemeIdUri, value);\n }\n /**\n * <p>Allows you to clear the stored array of time sources.</p>\n * <p>Example use: If you have exposed the Date header, calling this method\n * will allow the date header on the manifest to be used instead of the time server.</p>\n * <p>Example use: Calling this method, assuming there is not an exposed date header on the manifest, will default back\n * to using a binary search to discover the live edge</p>\n *\n * @memberof module:MediaPlayer\n * @see {@link module:MediaPlayer#restoreDefaultUTCTimingSources restoreDefaultUTCTimingSources()}\n * @instance\n */\n\n\n function clearDefaultUTCTimingSources() {\n mediaPlayerModel.clearDefaultUTCTimingSources();\n }\n /**\n * <p>Allows you to restore the default time sources after calling {@link module:MediaPlayer#clearDefaultUTCTimingSources clearDefaultUTCTimingSources()}</p>\n *\n * @default\n * <ul>\n * <li>schemeIdUri:urn:mpeg:dash:utc:http-xsdate:2014</li>\n * <li>value:http://time.akamai.com/?iso&ms</li>\n * </ul>\n *\n * @memberof module:MediaPlayer\n * @see {@link module:MediaPlayer#addUTCTimingSource addUTCTimingSource()}\n * @instance\n */\n\n\n function restoreDefaultUTCTimingSources() {\n mediaPlayerModel.restoreDefaultUTCTimingSources();\n }\n /**\n * Returns the average throughput computed in the ABR logic\n *\n * @param {MediaType} type\n * @return {number} value\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getAverageThroughput(type) {\n var throughputHistory = abrController.getThroughputHistory();\n var isDynamic = playbackController.getIsDynamic();\n return throughputHistory ? throughputHistory.getAverageThroughput(type, isDynamic) : 0;\n }\n /**\n * Sets whether withCredentials on XHR requests for a particular request\n * type is true or false\n *\n * @default false\n * @param {string} type - one of HTTPRequest.*_TYPE\n * @param {boolean} value\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function setXHRWithCredentialsForType(type, value) {\n mediaPlayerModel.setXHRWithCredentialsForType(type, value);\n }\n /**\n * Gets whether withCredentials on XHR requests for a particular request\n * type is true or false\n *\n * @param {string} type - one of HTTPRequest.*_TYPE\n * @return {boolean}\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getXHRWithCredentialsForType(type) {\n return mediaPlayerModel.getXHRWithCredentialsForType(type);\n }\n /*\n ---------------------------------------------------------------------------\n OFFLINE\n ---------------------------------------------------------------------------\n */\n\n /**\n * Detects if Offline is included and returns an instance of OfflineController.js\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getOfflineController() {\n return _detectOffline();\n }\n /*\n ---------------------------------------------------------------------------\n METRICS\n ---------------------------------------------------------------------------\n */\n\n /**\n * Returns the DashMetrics.js Module. You use this Module to get access to all the public metrics\n * stored in dash.js\n *\n * @see {@link module:DashMetrics}\n * @returns {Object}\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getDashMetrics() {\n return dashMetrics;\n }\n /*\n ---------------------------------------------------------------------------\n TEXT MANAGEMENT\n ---------------------------------------------------------------------------\n */\n\n /**\n * Enable/disable text\n * When enabling text, dash will choose the previous selected text track\n *\n * @param {boolean} enable - true to enable text, false otherwise (same as setTextTrack(-1))\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function enableText(enable) {\n var activeStreamInfo = streamController.getActiveStreamInfo();\n\n if (!activeStreamInfo || !textController) {\n return false;\n }\n\n return textController.enableText(activeStreamInfo.id, enable);\n }\n /**\n * Enable/disable text\n * When enabling dash will keep downloading and process fragmented text tracks even if all tracks are in mode "hidden"\n *\n * @param {boolean} enable - true to enable text streaming even if all text tracks are hidden.\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function enableForcedTextStreaming(enable) {\n var activeStreamInfo = streamController.getActiveStreamInfo();\n\n if (!activeStreamInfo || !textController) {\n return false;\n }\n\n return textController.enableForcedTextStreaming(enable);\n }\n /**\n * Return if text is enabled\n *\n * @return {boolean} return true if text is enabled, false otherwise\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function isTextEnabled() {\n var activeStreamInfo = streamController.getActiveStreamInfo();\n\n if (!activeStreamInfo || !textController) {\n return false;\n }\n\n return textController.isTextEnabled(activeStreamInfo);\n }\n /**\n * Use this method to change the current text track for both external time text files and fragmented text tracks. There is no need to\n * set the track mode on the video object to switch a track when using this method.\n * @param {number} idx - Index of track based on the order of the order the tracks are added Use -1 to disable all tracks. (turn captions off). Use module:MediaPlayer#dashjs.MediaPlayer.events.TEXT_TRACK_ADDED.\n * @see {@link MediaPlayerEvents#event:TEXT_TRACK_ADDED dashjs.MediaPlayer.events.TEXT_TRACK_ADDED}\n * @throws {@link module:MediaPlayer~PLAYBACK_NOT_INITIALIZED_ERROR PLAYBACK_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function setTextTrack(idx) {\n if (!playbackInitialized) {\n throw PLAYBACK_NOT_INITIALIZED_ERROR;\n }\n\n var activeStreamInfo = streamController.getActiveStreamInfo();\n\n if (!activeStreamInfo || !textController) {\n return;\n }\n\n textController.setTextTrack(activeStreamInfo.id, idx);\n }\n\n function getCurrentTextTrackIndex() {\n var idx = NaN;\n var activeStreamInfo = streamController.getActiveStreamInfo();\n\n if (!activeStreamInfo || !textController) {\n return;\n }\n\n idx = textController.getCurrentTrackIdx(activeStreamInfo.id);\n return idx;\n }\n /*\n ---------------------------------------------------------------------------\n VIDEO ELEMENT MANAGEMENT\n ---------------------------------------------------------------------------\n */\n\n /**\n * Returns instance of Video Element that was attached by calling attachView()\n * @returns {Object}\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~ELEMENT_NOT_ATTACHED_ERROR ELEMENT_NOT_ATTACHED_ERROR} if called before attachView function\n * @instance\n */\n\n\n function getVideoElement() {\n if (!videoModel.getElement()) {\n throw ELEMENT_NOT_ATTACHED_ERROR;\n }\n\n return videoModel.getElement();\n }\n /**\n * Use this method to attach an HTML5 VideoElement for dash.js to operate upon.\n *\n * @param {Object} element - An HTMLMediaElement that has already been defined in the DOM (or equivalent stub).\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~MEDIA_PLAYER_NOT_INITIALIZED_ERROR MEDIA_PLAYER_NOT_INITIALIZED_ERROR} if called before initialize function\n * @instance\n */\n\n\n function attachView(element) {\n if (!mediaPlayerInitialized) {\n throw MEDIA_PLAYER_NOT_INITIALIZED_ERROR;\n }\n\n videoModel.setElement(element);\n\n if (element) {\n _detectProtection();\n\n _detectMetricsReporting();\n\n _detectMss();\n\n if (streamController) {\n streamController.switchToVideoElement();\n }\n }\n\n if (playbackInitialized) {\n //Reset if we have been playing before, so this is a new element.\n _resetPlaybackControllers();\n }\n\n _initializePlayback();\n }\n /**\n * Returns instance of Div that was attached by calling attachTTMLRenderingDiv()\n * @returns {Object}\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getTTMLRenderingDiv() {\n return videoModel ? videoModel.getTTMLRenderingDiv() : null;\n }\n /**\n * Use this method to attach an HTML5 div for dash.js to render rich TTML subtitles.\n *\n * @param {HTMLDivElement} div - An unstyled div placed after the video element. It will be styled to match the video size and overlay z-order.\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~ELEMENT_NOT_ATTACHED_ERROR ELEMENT_NOT_ATTACHED_ERROR} if called before attachView function\n * @instance\n */\n\n\n function attachTTMLRenderingDiv(div) {\n if (!videoModel.getElement()) {\n throw ELEMENT_NOT_ATTACHED_ERROR;\n }\n\n videoModel.setTTMLRenderingDiv(div);\n }\n /*\n ---------------------------------------------------------------------------\n STREAM AND TRACK MANAGEMENT\n ---------------------------------------------------------------------------\n */\n\n /**\n * @param {MediaType} type\n * @returns {Array}\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~STREAMING_NOT_INITIALIZED_ERROR STREAMING_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @instance\n */\n\n\n function getBitrateInfoListFor(type) {\n if (!streamingInitialized) {\n throw STREAMING_NOT_INITIALIZED_ERROR;\n }\n\n var stream = getActiveStream();\n return stream ? stream.getBitrateListFor(type) : [];\n }\n /**\n * This method returns the list of all available streams from a given manifest\n * @param {Object} manifest\n * @returns {Array} list of {@link StreamInfo}\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~STREAMING_NOT_INITIALIZED_ERROR STREAMING_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @instance\n */\n\n\n function getStreamsFromManifest(manifest) {\n if (!streamingInitialized) {\n throw STREAMING_NOT_INITIALIZED_ERROR;\n }\n\n return adapter.getStreamsInfo(manifest);\n }\n /**\n * This method returns the list of all available tracks for a given media type\n * @param {MediaType} type\n * @returns {Array} list of {@link MediaInfo}\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~STREAMING_NOT_INITIALIZED_ERROR STREAMING_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @instance\n */\n\n\n function getTracksFor(type) {\n if (!streamingInitialized) {\n throw STREAMING_NOT_INITIALIZED_ERROR;\n }\n\n var streamInfo = streamController.getActiveStreamInfo();\n\n if (!streamInfo) {\n return [];\n }\n\n return mediaController.getTracksFor(type, streamInfo.id);\n }\n /**\n * This method returns the list of all available tracks for a given media type and streamInfo from a given manifest\n * @param {MediaType} type\n * @param {Object} manifest\n * @param {Object} streamInfo\n * @returns {Array} list of {@link MediaInfo}\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~STREAMING_NOT_INITIALIZED_ERROR STREAMING_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @instance\n */\n\n\n function getTracksForTypeFromManifest(type, manifest, streamInfo) {\n if (!streamingInitialized) {\n throw STREAMING_NOT_INITIALIZED_ERROR;\n }\n\n streamInfo = streamInfo || adapter.getStreamsInfo(manifest, 1)[0];\n return streamInfo ? adapter.getAllMediaInfoForType(streamInfo, type, manifest) : [];\n }\n /**\n * @param {MediaType} type\n * @returns {Object|null} {@link MediaInfo}\n *\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~STREAMING_NOT_INITIALIZED_ERROR STREAMING_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @instance\n */\n\n\n function getCurrentTrackFor(type) {\n if (!streamingInitialized) {\n throw STREAMING_NOT_INITIALIZED_ERROR;\n }\n\n var streamInfo = streamController.getActiveStreamInfo();\n return mediaController.getCurrentTrackFor(type, streamInfo.id);\n }\n /**\n * This method allows to set media settings that will be used to pick the initial track. Format of the settings\n * is following: <br />\n * {lang: langValue (can be either a string or a regex to match),\n * index: indexValue,\n * viewpoint: viewpointValue,\n * audioChannelConfiguration: audioChannelConfigurationValue,\n * accessibility: accessibilityValue,\n * role: roleValue}\n *\n * @param {MediaType} type\n * @param {Object} value\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~MEDIA_PLAYER_NOT_INITIALIZED_ERROR MEDIA_PLAYER_NOT_INITIALIZED_ERROR} if called before initialize function\n * @instance\n */\n\n\n function setInitialMediaSettingsFor(type, value) {\n if (!mediaPlayerInitialized) {\n throw MEDIA_PLAYER_NOT_INITIALIZED_ERROR;\n }\n\n mediaController.setInitialSettings(type, value);\n }\n /**\n * This method returns media settings that is used to pick the initial track. Format of the settings\n * is following:\n * {lang: langValue,\n * index: indexValue,\n * viewpoint: viewpointValue,\n * audioChannelConfiguration: audioChannelConfigurationValue,\n * accessibility: accessibilityValue,\n * role: roleValue}\n * @param {MediaType} type\n * @returns {Object}\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~MEDIA_PLAYER_NOT_INITIALIZED_ERROR MEDIA_PLAYER_NOT_INITIALIZED_ERROR} if called before initialize function\n * @instance\n */\n\n\n function getInitialMediaSettingsFor(type) {\n if (!mediaPlayerInitialized) {\n throw MEDIA_PLAYER_NOT_INITIALIZED_ERROR;\n }\n\n return mediaController.getInitialSettings(type);\n }\n /**\n * @param {MediaInfo} track - instance of {@link MediaInfo}\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~STREAMING_NOT_INITIALIZED_ERROR STREAMING_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @instance\n */\n\n\n function setCurrentTrack(track) {\n if (!streamingInitialized) {\n throw STREAMING_NOT_INITIALIZED_ERROR;\n }\n\n mediaController.setTrack(track);\n }\n /*\n ---------------------------------------------------------------------------\n PROTECTION MANAGEMENT\n ---------------------------------------------------------------------------\n */\n\n /**\n * Detects if Protection is included and returns an instance of ProtectionController.js\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getProtectionController() {\n return _detectProtection();\n }\n /**\n * Will override dash.js protection controller.\n * @param {ProtectionController} value - valid protection controller instance.\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function attachProtectionController(value) {\n protectionController = value;\n }\n /**\n * Sets Protection Data required to setup the Protection Module (DRM). Protection Data must\n * be set before initializing MediaPlayer or, once initialized, before PROTECTION_CREATED event is fired.\n * @see {@link module:MediaPlayer#initialize initialize()}\n * @see {@link ProtectionEvents#event:PROTECTION_CREATED dashjs.Protection.events.PROTECTION_CREATED}\n * @param {ProtectionDataSet} value - object containing\n * property names corresponding to key system name strings and associated\n * values being instances of.\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function setProtectionData(value) {\n protectionData = value; // Propagate changes in case StreamController is already created\n\n if (streamController) {\n streamController.setProtectionData(protectionData);\n }\n }\n /**\n * Registers a license request filter. This enables application to manipulate/overwrite any request parameter and/or request data.\n * The provided callback function shall return a promise that shall be resolved once the filter process is completed.\n * The filters are applied in the order they are registered.\n * @param {function} filter - the license request filter callback\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function registerLicenseRequestFilter(filter) {\n licenseRequestFilters.push(filter);\n\n if (protectionController) {\n protectionController.setLicenseRequestFilters(licenseRequestFilters);\n }\n }\n /**\n * Registers a license response filter. This enables application to manipulate/overwrite the response data\n * The provided callback function shall return a promise that shall be resolved once the filter process is completed.\n * The filters are applied in the order they are registered.\n * @param {function} filter - the license response filter callback\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function registerLicenseResponseFilter(filter) {\n licenseResponseFilters.push(filter);\n\n if (protectionController) {\n protectionController.setLicenseResponseFilters(licenseResponseFilters);\n }\n }\n /**\n * Unregisters a license request filter.\n * @param {function} filter - the license request filter callback\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function unregisterLicenseRequestFilter(filter) {\n unregisterFilter(licenseRequestFilters, filter);\n\n if (protectionController) {\n protectionController.setLicenseRequestFilters(licenseRequestFilters);\n }\n }\n /**\n * Unregisters a license response filter.\n * @param {function} filter - the license response filter callback\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function unregisterLicenseResponseFilter(filter) {\n unregisterFilter(licenseResponseFilters, filter);\n\n if (protectionController) {\n protectionController.setLicenseResponseFilters(licenseResponseFilters);\n }\n }\n /**\n * Registers a custom capabilities filter. This enables application to filter representations to use.\n * The provided callback function shall return a boolean based on whether or not to use the representation.\n * The filters are applied in the order they are registered.\n * @param {function} filter - the custom capabilities filter callback\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function registerCustomCapabilitiesFilter(filter) {\n customCapabilitiesFilters.push(filter);\n\n if (capabilitiesFilter) {\n capabilitiesFilter.setCustomCapabilitiesFilters(customCapabilitiesFilters);\n }\n }\n /**\n * Unregisters a custom capabilities filter.\n * @param {function} filter - the custom capabilities filter callback\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function unregisterCustomCapabilitiesFilter(filter) {\n unregisterFilter(customCapabilitiesFilters, filter);\n\n if (capabilitiesFilter) {\n capabilitiesFilter.setCustomCapabilitiesFilters(customCapabilitiesFilters);\n }\n }\n\n function unregisterFilter(filters, filter) {\n var index = -1;\n filters.some(function (item, i) {\n if (item === filter) {\n index = i;\n return true;\n }\n });\n if (index < 0) return;\n filters.splice(index, 1);\n }\n /**\n * Registers a custom initial track selection function. Only one function is allowed. Calling this method will overwrite a potentially existing function.\n * @param {function} customFunc - the custom function that returns the initial track\n */\n\n\n function setCustomInitialTrackSelectionFunction(customFunc) {\n if (mediaController) {\n mediaController.setCustomInitialTrackSelectionFunction(customFunc);\n }\n }\n /**\n * Resets the custom initial track selection\n */\n\n\n function resetCustomInitialTrackSelectionFunction() {\n if (mediaController) {\n mediaController.setCustomInitialTrackSelectionFunction(null);\n }\n }\n /*\n ---------------------------------------------------------------------------\n THUMBNAILS MANAGEMENT\n ---------------------------------------------------------------------------\n */\n\n /**\n * Provide the thumbnail at time position. This can be asynchronous, so you must provide a callback ro retrieve thumbnails informations\n * @param {number} time - A relative time, in seconds, based on the return value of the {@link module:MediaPlayer#duration duration()} method is expected\n * @param {function} callback - A Callback function provided when retrieving thumbnail the given time position. Thumbnail object is null in case there are is not a thumbnails representation or\n * if it doesn\'t contain a thumbnail for the given time position.\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function provideThumbnail(time, callback) {\n if (typeof callback !== \'function\') {\n return;\n }\n\n if (time < 0) {\n callback(null);\n return;\n }\n\n var s = playbackController.getIsDynamic() ? getDVRSeekOffset(time) : time;\n var stream = streamController.getStreamForTime(s);\n\n if (stream === null) {\n callback(null);\n return;\n }\n\n var thumbnailController = stream.getThumbnailController();\n\n if (!thumbnailController) {\n callback(null);\n return;\n }\n\n var timeInPeriod = streamController.getTimeRelativeToStreamId(s, stream.getId());\n return thumbnailController.provide(timeInPeriod, callback);\n }\n /*\n ---------------------------------------------------------------------------\n TOOLS AND OTHERS FUNCTIONS\n ---------------------------------------------------------------------------\n */\n\n /**\n * Allows application to retrieve a manifest. Manifest loading is asynchro\n * nous and\n * requires the app-provided callback function\n *\n * @param {string} url - url the manifest url\n * @param {function} callback - A Callback function provided when retrieving manifests\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function retrieveManifest(url, callback) {\n var manifestLoader = _createManifestLoader();\n\n var self = this;\n\n var handler = function handler(e) {\n if (!e.error) {\n callback(e.manifest);\n } else {\n callback(null, e.error);\n }\n\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_25__["default"].INTERNAL_MANIFEST_LOADED, handler, self);\n manifestLoader.reset();\n };\n\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_25__["default"].INTERNAL_MANIFEST_LOADED, handler, self);\n uriFragmentModel.initialize(url);\n manifestLoader.load(url);\n }\n /**\n * Returns the source string or manifest that was attached by calling attachSource()\n * @returns {string | manifest}\n * @memberof module:MediaPlayer\n * @throws {@link module:MediaPlayer~SOURCE_NOT_ATTACHED_ERROR SOURCE_NOT_ATTACHED_ERROR} if called before attachSource function\n * @instance\n */\n\n\n function getSource() {\n if (!source) {\n throw SOURCE_NOT_ATTACHED_ERROR;\n }\n\n return source;\n }\n /**\n * Use this method to set a source URL to a valid MPD manifest file OR\n * a previously downloaded and parsed manifest object. Optionally, can\n * also provide protection information\n *\n * @param {string|Object} urlOrManifest - A URL to a valid MPD manifest file, or a\n * parsed manifest object.\n *\n *\n * @throws {@link module:MediaPlayer~MEDIA_PLAYER_NOT_INITIALIZED_ERROR MEDIA_PLAYER_NOT_INITIALIZED_ERROR} if called before initialize function\n *\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function attachSource(urlOrManifest) {\n if (!mediaPlayerInitialized) {\n throw MEDIA_PLAYER_NOT_INITIALIZED_ERROR;\n }\n\n if (typeof urlOrManifest === \'string\') {\n uriFragmentModel.initialize(urlOrManifest);\n }\n\n source = urlOrManifest;\n\n if (streamingInitialized || playbackInitialized) {\n _resetPlaybackControllers();\n }\n\n if (isReady()) {\n _initializePlayback();\n }\n }\n /**\n * Get the current settings object being used on the player.\n * @returns {PlayerSettings} The settings object being used.\n *\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getSettings() {\n return settings.get();\n }\n /**\n * @summary Update the current settings object being used on the player. Anything left unspecified is not modified.\n * @param {PlayerSettings} settingsObj - An object corresponding to the settings definition.\n * @description This function does not update the entire object, only properties in the passed in object are updated.\n *\n * This means that updateSettings({a: x}) and updateSettings({b: y}) are functionally equivalent to\n * updateSettings({a: x, b: y}). If the default values are required again, @see{@link resetSettings}.\n * @example\n * player.updateSettings({\n * streaming: {\n * lowLatencyEnabled: false,\n * abr: {\n * maxBitrate: { audio: 100, video: 1000 }\n * }\n * }\n * });\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function updateSettings(settingsObj) {\n settings.update(settingsObj);\n }\n /**\n * Resets the settings object back to the default.\n *\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function resetSettings() {\n settings.reset();\n }\n /**\n * A utility methods which converts UTC timestamp value into a valid time and date string.\n *\n * @param {number} time - UTC timestamp to be converted into date and time.\n * @param {string} locales - a region identifier (i.e. en_US).\n * @param {boolean} hour12 - 12 vs 24 hour. Set to true for 12 hour time formatting.\n * @param {boolean} withDate - default is false. Set to true to append current date to UTC time format.\n * @returns {string} A formatted time and date string.\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function formatUTC(time, locales, hour12) {\n var withDate = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n var dt = new Date(time * 1000);\n var d = dt.toLocaleDateString(locales);\n var t = dt.toLocaleTimeString(locales, {\n hour12: hour12\n });\n return withDate ? t + \' \' + d : t;\n }\n /**\n * A utility method which converts seconds into TimeCode (i.e. 300 --\x3e 05:00).\n *\n * @param {number} value - A number in seconds to be converted into a formatted time code.\n * @returns {string} A formatted time code string.\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function convertToTimeCode(value) {\n value = Math.max(value, 0);\n var h = Math.floor(value / 3600);\n var m = Math.floor(value % 3600 / 60);\n var s = Math.floor(value % 3600 % 60);\n return (h === 0 ? \'\' : h < 10 ? \'0\' + h.toString() + \':\' : h.toString() + \':\') + (m < 10 ? \'0\' + m.toString() : m.toString()) + \':\' + (s < 10 ? \'0\' + s.toString() : s.toString());\n }\n /**\n * This method should be used to extend or replace internal dash.js objects.\n * There are two ways to extend dash.js (determined by the override argument):\n * <ol>\n * <li>If you set override to true any public method or property in your custom object will\n * override the dash.js parent object\'s property(ies) and will be used instead but the\n * dash.js parent module will still be created.</li>\n *\n * <li>If you set override to false your object will completely replace the dash.js object.\n * (Note: This is how it was in 1.x of Dash.js with Dijon).</li>\n * </ol>\n * <b>When you extend you get access to this.context, this.factory and this.parent to operate with in your custom object.</b>\n * <ul>\n * <li><b>this.context</b> - can be used to pass context for singleton access.</li>\n * <li><b>this.factory</b> - can be used to call factory.getSingletonInstance().</li>\n * <li><b>this.parent</b> - is the reference of the parent object to call other public methods. (this.parent is excluded if you extend with override set to false or option 2)</li>\n * </ul>\n * <b>You must call extend before you call initialize</b>\n * @see {@link module:MediaPlayer#initialize initialize()}\n * @param {string} parentNameString - name of parent module\n * @param {Object} childInstance - overriding object\n * @param {boolean} override - replace only some methods (true) or the whole object (false)\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function extend(parentNameString, childInstance, override) {\n _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_27__["default"].extend(parentNameString, childInstance, override, context);\n }\n /**\n * This method returns the active stream\n *\n * @throws {@link module:MediaPlayer~STREAMING_NOT_INITIALIZED_ERROR STREAMING_NOT_INITIALIZED_ERROR} if called before initializePlayback function\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getActiveStream() {\n if (!streamingInitialized) {\n throw STREAMING_NOT_INITIALIZED_ERROR;\n }\n\n var streamInfo = streamController.getActiveStreamInfo();\n return streamInfo ? streamController.getStreamById(streamInfo.id) : null;\n }\n /**\n * Returns the DashAdapter.js Module.\n *\n * @see {@link module:DashAdapter}\n * @returns {Object}\n * @memberof module:MediaPlayer\n * @instance\n */\n\n\n function getDashAdapter() {\n return adapter;\n } //***********************************\n // PRIVATE METHODS\n //***********************************\n\n\n function _resetPlaybackControllers() {\n playbackInitialized = false;\n streamingInitialized = false;\n adapter.reset();\n streamController.reset();\n gapController.reset();\n playbackController.reset();\n abrController.reset();\n mediaController.reset();\n segmentBaseController.reset();\n\n if (protectionController) {\n if (settings.get().streaming.protection.keepProtectionMediaKeys) {\n protectionController.stop();\n } else {\n protectionController.reset();\n protectionController = null;\n\n _detectProtection();\n }\n }\n\n textController.reset();\n cmcdModel.reset();\n }\n\n function _createPlaybackControllers() {\n // creates or get objects instances\n var manifestLoader = _createManifestLoader();\n\n if (!streamController) {\n streamController = Object(_controllers_StreamController__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance();\n }\n\n if (!textController) {\n textController = Object(_text_TextController__WEBPACK_IMPORTED_MODULE_42__["default"])(context).create({\n errHandler: errHandler,\n manifestModel: manifestModel,\n adapter: adapter,\n mediaController: mediaController,\n videoModel: videoModel,\n settings: settings\n });\n }\n\n capabilitiesFilter.setConfig({\n capabilities: capabilities,\n adapter: adapter,\n settings: settings,\n manifestModel: manifestModel,\n errHandler: errHandler\n });\n capabilitiesFilter.setCustomCapabilitiesFilters(customCapabilitiesFilters);\n streamController.setConfig({\n capabilities: capabilities,\n capabilitiesFilter: capabilitiesFilter,\n manifestLoader: manifestLoader,\n manifestModel: manifestModel,\n mediaPlayerModel: mediaPlayerModel,\n protectionController: protectionController,\n textController: textController,\n adapter: adapter,\n dashMetrics: dashMetrics,\n errHandler: errHandler,\n timelineConverter: timelineConverter,\n videoModel: videoModel,\n playbackController: playbackController,\n abrController: abrController,\n mediaController: mediaController,\n settings: settings,\n baseURLController: baseURLController,\n uriFragmentModel: uriFragmentModel,\n segmentBaseController: segmentBaseController\n });\n gapController.setConfig({\n settings: settings,\n playbackController: playbackController,\n streamController: streamController,\n videoModel: videoModel,\n timelineConverter: timelineConverter,\n adapter: adapter\n });\n playbackController.setConfig({\n streamController: streamController,\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n adapter: adapter,\n videoModel: videoModel,\n timelineConverter: timelineConverter,\n settings: settings\n });\n abrController.setConfig({\n streamController: streamController,\n domStorage: domStorage,\n mediaPlayerModel: mediaPlayerModel,\n dashMetrics: dashMetrics,\n adapter: adapter,\n videoModel: videoModel,\n settings: settings\n });\n cmcdModel.setConfig({\n abrController: abrController,\n dashMetrics: dashMetrics,\n playbackController: playbackController\n }); // initialises controller\n\n abrController.initialize();\n streamController.initialize(autoPlay, protectionData);\n textController.initialize();\n gapController.initialize();\n cmcdModel.initialize();\n segmentBaseController.initialize();\n }\n\n function _createManifestLoader() {\n return Object(_ManifestLoader__WEBPACK_IMPORTED_MODULE_9__["default"])(context).create({\n debug: debug,\n errHandler: errHandler,\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n requestModifier: Object(_utils_RequestModifier__WEBPACK_IMPORTED_MODULE_13__["default"])(context).getInstance(),\n mssHandler: mssHandler,\n settings: settings\n });\n }\n\n function _detectProtection() {\n if (protectionController) {\n return protectionController;\n } // do not require Protection as dependencies as this is optional and intended to be loaded separately\n\n\n var Protection = dashjs.Protection;\n /* jshint ignore:line */\n\n if (typeof Protection === \'function\') {\n //TODO need a better way to register/detect plugin components\n var protection = Protection(context).create();\n _core_events_Events__WEBPACK_IMPORTED_MODULE_25__["default"].extend(Protection.events);\n _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_26__["default"].extend(Protection.events, {\n publicOnly: true\n });\n _core_errors_Errors__WEBPACK_IMPORTED_MODULE_23__["default"].extend(Protection.errors);\n\n if (!capabilities) {\n capabilities = Object(_utils_Capabilities__WEBPACK_IMPORTED_MODULE_11__["default"])(context).getInstance();\n }\n\n protectionController = protection.createProtectionSystem({\n debug: debug,\n errHandler: errHandler,\n videoModel: videoModel,\n capabilities: capabilities,\n eventBus: eventBus,\n events: _core_events_Events__WEBPACK_IMPORTED_MODULE_25__["default"],\n BASE64: _externals_base64__WEBPACK_IMPORTED_MODULE_35___default.a,\n constants: _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"],\n cmcdModel: cmcdModel,\n settings: settings\n });\n\n if (protectionController) {\n protectionController.setLicenseRequestFilters(licenseRequestFilters);\n protectionController.setLicenseResponseFilters(licenseResponseFilters);\n }\n\n return protectionController;\n }\n\n return null;\n }\n\n function _detectMetricsReporting() {\n if (metricsReportingController) {\n return;\n } // do not require MetricsReporting as dependencies as this is optional and intended to be loaded separately\n\n\n var MetricsReporting = dashjs.MetricsReporting;\n /* jshint ignore:line */\n\n if (typeof MetricsReporting === \'function\') {\n //TODO need a better way to register/detect plugin components\n var metricsReporting = MetricsReporting(context).create();\n metricsReportingController = metricsReporting.createMetricsReporting({\n debug: debug,\n eventBus: eventBus,\n mediaElement: getVideoElement(),\n adapter: adapter,\n dashMetrics: dashMetrics,\n events: _core_events_Events__WEBPACK_IMPORTED_MODULE_25__["default"],\n constants: _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"],\n metricsConstants: _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__["default"]\n });\n }\n }\n\n function _detectMss() {\n if (mssHandler) {\n return;\n } // do not require MssHandler as dependencies as this is optional and intended to be loaded separately\n\n\n var MssHandler = dashjs.MssHandler;\n /* jshint ignore:line */\n\n if (typeof MssHandler === \'function\') {\n //TODO need a better way to register/detect plugin components\n _core_errors_Errors__WEBPACK_IMPORTED_MODULE_23__["default"].extend(MssHandler.errors);\n mssHandler = MssHandler(context).create({\n eventBus: eventBus,\n mediaPlayerModel: mediaPlayerModel,\n dashMetrics: dashMetrics,\n manifestModel: manifestModel,\n playbackController: playbackController,\n streamController: streamController,\n protectionController: protectionController,\n baseURLController: baseURLController,\n errHandler: errHandler,\n events: _core_events_Events__WEBPACK_IMPORTED_MODULE_25__["default"],\n constants: _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"],\n debug: debug,\n initSegmentType: _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_34__["HTTPRequest"].INIT_SEGMENT_TYPE,\n BASE64: _externals_base64__WEBPACK_IMPORTED_MODULE_35___default.a,\n ISOBoxer: codem_isoboxer__WEBPACK_IMPORTED_MODULE_36___default.a,\n settings: settings\n });\n }\n }\n\n function _detectOffline() {\n if (!mediaPlayerInitialized) {\n throw MEDIA_PLAYER_NOT_INITIALIZED_ERROR;\n }\n\n if (offlineController) {\n return offlineController;\n } // do not require Offline as dependencies as this is optional and intended to be loaded separately\n\n\n var OfflineController = dashjs.OfflineController;\n /* jshint ignore:line */\n\n if (typeof OfflineController === \'function\') {\n //TODO need a better way to register/detect plugin components\n _core_events_Events__WEBPACK_IMPORTED_MODULE_25__["default"].extend(OfflineController.events);\n _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_26__["default"].extend(OfflineController.events, {\n publicOnly: true\n });\n _core_errors_Errors__WEBPACK_IMPORTED_MODULE_23__["default"].extend(OfflineController.errors);\n\n var manifestLoader = _createManifestLoader();\n\n var manifestUpdater = Object(_ManifestUpdater__WEBPACK_IMPORTED_MODULE_39__["default"])(context).create();\n manifestUpdater.setConfig({\n manifestModel: manifestModel,\n adapter: adapter,\n manifestLoader: manifestLoader,\n errHandler: errHandler\n });\n offlineController = OfflineController(context).create({\n debug: debug,\n manifestUpdater: manifestUpdater,\n baseURLController: baseURLController,\n manifestLoader: manifestLoader,\n manifestModel: manifestModel,\n mediaPlayerModel: mediaPlayerModel,\n abrController: abrController,\n playbackController: playbackController,\n adapter: adapter,\n errHandler: errHandler,\n dashMetrics: dashMetrics,\n timelineConverter: timelineConverter,\n segmentBaseController: segmentBaseController,\n schemeLoaderFactory: schemeLoaderFactory,\n eventBus: eventBus,\n events: _core_events_Events__WEBPACK_IMPORTED_MODULE_25__["default"],\n errors: _core_errors_Errors__WEBPACK_IMPORTED_MODULE_23__["default"],\n constants: _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"],\n settings: settings,\n dashConstants: _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_2__["default"],\n urlUtils: Object(_streaming_utils_URLUtils__WEBPACK_IMPORTED_MODULE_40__["default"])(context).getInstance()\n });\n return offlineController;\n }\n\n return null;\n }\n\n function _getAsUTC(valToConvert) {\n var type = streamController && streamController.hasVideoTrack() ? _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO : _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO;\n var metric = dashMetrics.getCurrentDVRInfo(type);\n var availableFrom, utcValue;\n\n if (!metric) {\n return 0;\n }\n\n availableFrom = metric.manifestInfo.availableFrom.getTime() / 1000;\n utcValue = valToConvert + (availableFrom + metric.range.start);\n return utcValue;\n }\n\n function _initializePlayback() {\n if (offlineController) {\n offlineController.resetRecords();\n }\n\n if (!streamingInitialized && source) {\n streamingInitialized = true;\n logger.info(\'Streaming Initialized\');\n\n _createPlaybackControllers();\n\n if (typeof source === \'string\') {\n streamController.load(source);\n } else {\n streamController.loadWithManifest(source);\n }\n }\n\n if (!playbackInitialized && isReady()) {\n playbackInitialized = true;\n logger.info(\'Playback Initialized\');\n }\n }\n\n instance = {\n initialize: initialize,\n setConfig: setConfig,\n on: on,\n off: off,\n extend: extend,\n attachView: attachView,\n attachSource: attachSource,\n isReady: isReady,\n play: play,\n isPaused: isPaused,\n pause: pause,\n isSeeking: isSeeking,\n isDynamic: isDynamic,\n seek: seek,\n setPlaybackRate: setPlaybackRate,\n getPlaybackRate: getPlaybackRate,\n setMute: setMute,\n isMuted: isMuted,\n setVolume: setVolume,\n getVolume: getVolume,\n time: time,\n duration: duration,\n timeAsUTC: timeAsUTC,\n durationAsUTC: durationAsUTC,\n getActiveStream: getActiveStream,\n getDVRWindowSize: getDVRWindowSize,\n getDVRSeekOffset: getDVRSeekOffset,\n convertToTimeCode: convertToTimeCode,\n formatUTC: formatUTC,\n getVersion: getVersion,\n getDebug: getDebug,\n getBufferLength: getBufferLength,\n getTTMLRenderingDiv: getTTMLRenderingDiv,\n getVideoElement: getVideoElement,\n getSource: getSource,\n getCurrentLiveLatency: getCurrentLiveLatency,\n getTopBitrateInfoFor: getTopBitrateInfoFor,\n setAutoPlay: setAutoPlay,\n getAutoPlay: getAutoPlay,\n getDashMetrics: getDashMetrics,\n getQualityFor: getQualityFor,\n setQualityFor: setQualityFor,\n updatePortalSize: updatePortalSize,\n enableText: enableText,\n enableForcedTextStreaming: enableForcedTextStreaming,\n isTextEnabled: isTextEnabled,\n setTextTrack: setTextTrack,\n getBitrateInfoListFor: getBitrateInfoListFor,\n getStreamsFromManifest: getStreamsFromManifest,\n getTracksFor: getTracksFor,\n getTracksForTypeFromManifest: getTracksForTypeFromManifest,\n getCurrentTrackFor: getCurrentTrackFor,\n setInitialMediaSettingsFor: setInitialMediaSettingsFor,\n getInitialMediaSettingsFor: getInitialMediaSettingsFor,\n setCurrentTrack: setCurrentTrack,\n addABRCustomRule: addABRCustomRule,\n removeABRCustomRule: removeABRCustomRule,\n removeAllABRCustomRule: removeAllABRCustomRule,\n getAverageThroughput: getAverageThroughput,\n retrieveManifest: retrieveManifest,\n addUTCTimingSource: addUTCTimingSource,\n removeUTCTimingSource: removeUTCTimingSource,\n clearDefaultUTCTimingSources: clearDefaultUTCTimingSources,\n restoreDefaultUTCTimingSources: restoreDefaultUTCTimingSources,\n setXHRWithCredentialsForType: setXHRWithCredentialsForType,\n getXHRWithCredentialsForType: getXHRWithCredentialsForType,\n getProtectionController: getProtectionController,\n attachProtectionController: attachProtectionController,\n setProtectionData: setProtectionData,\n registerLicenseRequestFilter: registerLicenseRequestFilter,\n registerLicenseResponseFilter: registerLicenseResponseFilter,\n unregisterLicenseRequestFilter: unregisterLicenseRequestFilter,\n unregisterLicenseResponseFilter: unregisterLicenseResponseFilter,\n registerCustomCapabilitiesFilter: registerCustomCapabilitiesFilter,\n unregisterCustomCapabilitiesFilter: unregisterCustomCapabilitiesFilter,\n setCustomInitialTrackSelectionFunction: setCustomInitialTrackSelectionFunction,\n resetCustomInitialTrackSelectionFunction: resetCustomInitialTrackSelectionFunction,\n attachTTMLRenderingDiv: attachTTMLRenderingDiv,\n getCurrentTextTrackIndex: getCurrentTextTrackIndex,\n provideThumbnail: provideThumbnail,\n getDashAdapter: getDashAdapter,\n getOfflineController: getOfflineController,\n getSettings: getSettings,\n updateSettings: updateSettings,\n resetSettings: resetSettings,\n reset: reset,\n destroy: destroy\n };\n setup();\n return instance;\n}\n\nMediaPlayer.__dashjs_factory_name = \'MediaPlayer\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_27__["default"].getClassFactory(MediaPlayer);\nfactory.events = _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_26__["default"];\nfactory.errors = _core_errors_Errors__WEBPACK_IMPORTED_MODULE_23__["default"];\n_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_27__["default"].updateClassFactory(MediaPlayer.__dashjs_factory_name, factory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/MediaPlayerEvents.js":\n/*!********************************************!*\\\n !*** ./src/streaming/MediaPlayerEvents.js ***!\n \\********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1137392__) {\n__nested_webpack_require_1137392__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_events_EventsBase__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1137392__(/*! ../core/events/EventsBase */ "./src/core/events/EventsBase.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @implements EventsBase\n */\n\nvar MediaPlayerEvents = /*#__PURE__*/function (_EventsBase) {\n _inherits(MediaPlayerEvents, _EventsBase);\n\n var _super = _createSuper(MediaPlayerEvents);\n\n /**\n * @description Public facing external events to be used when developing a player that implements dash.js.\n */\n function MediaPlayerEvents() {\n var _this;\n\n _classCallCheck(this, MediaPlayerEvents);\n\n _this = _super.call(this);\n /**\n * Triggered when playback will not start yet\n * as the MPD\'s availabilityStartTime is in the future.\n * Check delay property in payload to determine time before playback will start.\n * @event MediaPlayerEvents#AST_IN_FUTURE\n */\n\n _this.AST_IN_FUTURE = \'astInFuture\';\n /**\n * Triggered when the video element\'s buffer state changes to stalled.\n * Check mediaType in payload to determine type (Video, Audio, FragmentedText).\n * @event MediaPlayerEvents#BUFFER_EMPTY\n */\n\n _this.BUFFER_EMPTY = \'bufferStalled\';\n /**\n * Triggered when the video element\'s buffer state changes to loaded.\n * Check mediaType in payload to determine type (Video, Audio, FragmentedText).\n * @event MediaPlayerEvents#BUFFER_LOADED\n */\n\n _this.BUFFER_LOADED = \'bufferLoaded\';\n /**\n * Triggered when the video element\'s buffer state changes, either stalled or loaded. Check payload for state.\n * @event MediaPlayerEvents#BUFFER_LEVEL_STATE_CHANGED\n */\n\n _this.BUFFER_LEVEL_STATE_CHANGED = \'bufferStateChanged\';\n /**\n * Triggered when the buffer level of a media type has been updated\n * @event MediaPlayerEvents#BUFFER_LEVEL_UPDATED\n */\n\n _this.BUFFER_LEVEL_UPDATED = \'bufferLevelUpdated\';\n /**\n * Triggered when a dynamic stream changed to static (transition phase between Live and On-Demand).\n * @event MediaPlayerEvents#DYNAMIC_TO_STATIC\n */\n\n _this.DYNAMIC_TO_STATIC = \'dynamicToStatic\';\n /**\n * Triggered when there is an error from the element or MSE source buffer.\n * @event MediaPlayerEvents#ERROR\n */\n\n _this.ERROR = \'error\';\n /**\n * Triggered when a fragment download has completed.\n * @event MediaPlayerEvents#FRAGMENT_LOADING_COMPLETED\n */\n\n _this.FRAGMENT_LOADING_COMPLETED = \'fragmentLoadingCompleted\';\n /**\n * Triggered when a partial fragment download has completed.\n * @event MediaPlayerEvents#FRAGMENT_LOADING_PROGRESS\n */\n\n _this.FRAGMENT_LOADING_PROGRESS = \'fragmentLoadingProgress\';\n /**\n * Triggered when a fragment download has started.\n * @event MediaPlayerEvents#FRAGMENT_LOADING_STARTED\n */\n\n _this.FRAGMENT_LOADING_STARTED = \'fragmentLoadingStarted\';\n /**\n * Triggered when a fragment download is abandoned due to detection of slow download base on the ABR abandon rule..\n * @event MediaPlayerEvents#FRAGMENT_LOADING_ABANDONED\n */\n\n _this.FRAGMENT_LOADING_ABANDONED = \'fragmentLoadingAbandoned\';\n /**\n * Triggered when {@link module:Debug} logger methods are called.\n * @event MediaPlayerEvents#LOG\n */\n\n _this.LOG = \'log\';\n /**\n * Triggered when the manifest load is complete\n * @event MediaPlayerEvents#MANIFEST_LOADED\n */\n\n _this.MANIFEST_LOADED = \'manifestLoaded\';\n /**\n * Triggered anytime there is a change to the overall metrics.\n * @event MediaPlayerEvents#METRICS_CHANGED\n */\n\n _this.METRICS_CHANGED = \'metricsChanged\';\n /**\n * Triggered when an individual metric is added, updated or cleared.\n * @event MediaPlayerEvents#METRIC_CHANGED\n */\n\n _this.METRIC_CHANGED = \'metricChanged\';\n /**\n * Triggered every time a new metric is added.\n * @event MediaPlayerEvents#METRIC_ADDED\n */\n\n _this.METRIC_ADDED = \'metricAdded\';\n /**\n * Triggered every time a metric is updated.\n * @event MediaPlayerEvents#METRIC_UPDATED\n */\n\n _this.METRIC_UPDATED = \'metricUpdated\';\n /**\n * Triggered when a new stream (period) starts.\n * @event MediaPlayerEvents#PERIOD_SWITCH_STARTED\n */\n\n _this.PERIOD_SWITCH_STARTED = \'periodSwitchStarted\';\n /**\n * Triggered at the stream end of a period.\n * @event MediaPlayerEvents#PERIOD_SWITCH_COMPLETED\n */\n\n _this.PERIOD_SWITCH_COMPLETED = \'periodSwitchCompleted\';\n /**\n * Triggered when an ABR up /down switch is initiated; either by user in manual mode or auto mode via ABR rules.\n * @event MediaPlayerEvents#QUALITY_CHANGE_REQUESTED\n */\n\n _this.QUALITY_CHANGE_REQUESTED = \'qualityChangeRequested\';\n /**\n * Triggered when the new ABR quality is being rendered on-screen.\n * @event MediaPlayerEvents#QUALITY_CHANGE_RENDERED\n */\n\n _this.QUALITY_CHANGE_RENDERED = \'qualityChangeRendered\';\n /**\n * Triggered when the new track is being rendered.\n * @event MediaPlayerEvents#TRACK_CHANGE_RENDERED\n */\n\n _this.TRACK_CHANGE_RENDERED = \'trackChangeRendered\';\n /**\n * Triggered when a stream (period) is being loaded\n * @event MediaPlayerEvents#STREAM_INITIALIZING\n */\n\n _this.STREAM_INITIALIZING = \'streamInitializing\';\n /**\n * Triggered when a stream (period) is loaded\n * @event MediaPlayerEvents#STREAM_UPDATED\n */\n\n _this.STREAM_UPDATED = \'streamUpdated\';\n /**\n * Triggered when a stream (period) is activated\n * @event MediaPlayerEvents#STREAM_ACTIVATED\n */\n\n _this.STREAM_ACTIVATED = \'streamActivated\';\n /**\n * Triggered when a stream (period) is deactivated\n * @event MediaPlayerEvents#STREAM_DEACTIVATED\n */\n\n _this.STREAM_DEACTIVATED = \'streamDeactivated\';\n /**\n * Triggered when a stream (period) is activated\n * @event MediaPlayerEvents#STREAM_INITIALIZED\n */\n\n _this.STREAM_INITIALIZED = \'streamInitialized\';\n /**\n * Triggered when the player has been reset.\n * @event MediaPlayerEvents#STREAM_TEARDOWN_COMPLETE\n */\n\n _this.STREAM_TEARDOWN_COMPLETE = \'streamTeardownComplete\';\n /**\n * Triggered once all text tracks detected in the MPD are added to the video element.\n * @event MediaPlayerEvents#TEXT_TRACKS_ADDED\n */\n\n _this.TEXT_TRACKS_ADDED = \'allTextTracksAdded\';\n /**\n * Triggered when a text track is added to the video element\'s TextTrackList\n * @event MediaPlayerEvents#TEXT_TRACK_ADDED\n */\n\n _this.TEXT_TRACK_ADDED = \'textTrackAdded\';\n /**\n * Triggered when a ttml chunk is parsed.\n * @event MediaPlayerEvents#TTML_PARSED\n */\n\n _this.TTML_PARSED = \'ttmlParsed\';\n /**\n * Triggered when a ttml chunk has to be parsed.\n * @event MediaPlayerEvents#TTML_TO_PARSE\n */\n\n _this.TTML_TO_PARSE = \'ttmlToParse\';\n /**\n * Triggered when a caption is rendered.\n * @event MediaPlayerEvents#CAPTION_RENDERED\n */\n\n _this.CAPTION_RENDERED = \'captionRendered\';\n /**\n * Triggered when the caption container is resized.\n * @event MediaPlayerEvents#CAPTION_CONTAINER_RESIZE\n */\n\n _this.CAPTION_CONTAINER_RESIZE = \'captionContainerResize\';\n /**\n * Sent when enough data is available that the media can be played,\n * at least for a couple of frames. This corresponds to the\n * HAVE_ENOUGH_DATA readyState.\n * @event MediaPlayerEvents#CAN_PLAY\n */\n\n _this.CAN_PLAY = \'canPlay\';\n /**\n * This corresponds to the CAN_PLAY_THROUGH readyState.\n * @event MediaPlayerEvents#CAN_PLAY_THROUGH\n */\n\n _this.CAN_PLAY_THROUGH = \'canPlayThrough\';\n /**\n * Sent when playback completes.\n * @event MediaPlayerEvents#PLAYBACK_ENDED\n */\n\n _this.PLAYBACK_ENDED = \'playbackEnded\';\n /**\n * Sent when an error occurs. The element\'s error\n * attribute contains more information.\n * @event MediaPlayerEvents#PLAYBACK_ERROR\n */\n\n _this.PLAYBACK_ERROR = \'playbackError\';\n /**\n * Sent when playback is not allowed (for example if user gesture is needed).\n * @event MediaPlayerEvents#PLAYBACK_NOT_ALLOWED\n */\n\n _this.PLAYBACK_NOT_ALLOWED = \'playbackNotAllowed\';\n /**\n * The media\'s metadata has finished loading; all attributes now\n * contain as much useful information as they\'re going to.\n * @event MediaPlayerEvents#PLAYBACK_METADATA_LOADED\n */\n\n _this.PLAYBACK_METADATA_LOADED = \'playbackMetaDataLoaded\';\n /**\n * The media\'s metadata has finished loading; all attributes now\n * contain as much useful information as they\'re going to.\n * @event MediaPlayerEvents#PLAYBACK_METADATA_LOADED\n */\n\n _this.PLAYBACK_LOADED_DATA = \'playbackLoadedData\';\n /**\n * Sent when playback is paused.\n * @event MediaPlayerEvents#PLAYBACK_PAUSED\n */\n\n _this.PLAYBACK_PAUSED = \'playbackPaused\';\n /**\n * Sent when the media begins to play (either for the first time, after having been paused,\n * or after ending and then restarting).\n *\n * @event MediaPlayerEvents#PLAYBACK_PLAYING\n */\n\n _this.PLAYBACK_PLAYING = \'playbackPlaying\';\n /**\n * Sent periodically to inform interested parties of progress downloading\n * the media. Information about the current amount of the media that has\n * been downloaded is available in the media element\'s buffered attribute.\n * @event MediaPlayerEvents#PLAYBACK_PROGRESS\n */\n\n _this.PLAYBACK_PROGRESS = \'playbackProgress\';\n /**\n * Sent when the playback speed changes.\n * @event MediaPlayerEvents#PLAYBACK_RATE_CHANGED\n */\n\n _this.PLAYBACK_RATE_CHANGED = \'playbackRateChanged\';\n /**\n * Sent when a seek operation completes.\n * @event MediaPlayerEvents#PLAYBACK_SEEKED\n */\n\n _this.PLAYBACK_SEEKED = \'playbackSeeked\';\n /**\n * Sent when a seek operation begins.\n * @event MediaPlayerEvents#PLAYBACK_SEEKING\n */\n\n _this.PLAYBACK_SEEKING = \'playbackSeeking\';\n /**\n * Sent when a seek operation has been asked.\n * @event MediaPlayerEvents#PLAYBACK_SEEK_ASKED\n */\n\n _this.PLAYBACK_SEEK_ASKED = \'playbackSeekAsked\';\n /**\n * Sent when the video element reports stalled\n * @event MediaPlayerEvents#PLAYBACK_STALLED\n */\n\n _this.PLAYBACK_STALLED = \'playbackStalled\';\n /**\n * Sent when playback of the media starts after having been paused;\n * that is, when playback is resumed after a prior pause event.\n *\n * @event MediaPlayerEvents#PLAYBACK_STARTED\n */\n\n _this.PLAYBACK_STARTED = \'playbackStarted\';\n /**\n * The time indicated by the element\'s currentTime attribute has changed.\n * @event MediaPlayerEvents#PLAYBACK_TIME_UPDATED\n */\n\n _this.PLAYBACK_TIME_UPDATED = \'playbackTimeUpdated\';\n /**\n * Sent when the media playback has stopped because of a temporary lack of data.\n *\n * @event MediaPlayerEvents#PLAYBACK_WAITING\n */\n\n _this.PLAYBACK_WAITING = \'playbackWaiting\';\n /**\n * Manifest validity changed - As a result of an MPD validity expiration event.\n * @event MediaPlayerEvents#MANIFEST_VALIDITY_CHANGED\n */\n\n _this.MANIFEST_VALIDITY_CHANGED = \'manifestValidityChanged\';\n /**\n * Dash events are triggered at their respective start points on the timeline.\n * @event MediaPlayerEvents#EVENT_MODE_ON_START\n */\n\n _this.EVENT_MODE_ON_START = \'eventModeOnStart\';\n /**\n * Dash events are triggered as soon as they were parsed.\n * @event MediaPlayerEvents#EVENT_MODE_ON_RECEIVE\n */\n\n _this.EVENT_MODE_ON_RECEIVE = \'eventModeOnReceive\';\n /**\n * Event that is dispatched whenever the player encounters a potential conformance validation that might lead to unexpected/not optimal behavior\n * @event MediaPlayerEvents#CONFORMANCE_VIOLATION\n */\n\n _this.CONFORMANCE_VIOLATION = \'conformanceViolation\';\n /**\n * Event that is dispatched whenever the player switches to a different representation\n * @event MediaPlayerEvents#REPRESENTATION_SWITCH\n */\n\n _this.REPRESENTATION_SWITCH = \'representationSwitch\';\n return _this;\n }\n\n return MediaPlayerEvents;\n}(_core_events_EventsBase__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\nvar mediaPlayerEvents = new MediaPlayerEvents();\n/* harmony default export */ __nested_webpack_exports__["default"] = (mediaPlayerEvents);\n\n/***/ }),\n\n/***/ "./src/streaming/MediaPlayerFactory.js":\n/*!*********************************************!*\\\n !*** ./src/streaming/MediaPlayerFactory.js ***!\n \\*********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1154348__) {\n__nested_webpack_require_1154348__.r(__nested_webpack_exports__);\n/* harmony import */ var _MediaPlayer__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1154348__(/*! ./MediaPlayer */ "./src/streaming/MediaPlayer.js");\n\n\nfunction MediaPlayerFactory() {\n /**\n * mime-type identifier for any source content to be accepted as a dash manifest by the create() method.\n * @type {string}\n */\n var SUPPORTED_MIME_TYPE = \'application/dash+xml\';\n var logger;\n /**\n * A new MediaPlayer is instantiated for the supplied videoElement and optional source and context. If no context is provided,\n * a default DashContext is used. If no source is provided, the videoElement is interrogated to extract the first source whose\n * type is application/dash+xml.\n * The autoplay property of the videoElement is preserved. Any preload attribute is ignored. This method should be called after the page onLoad event is dispatched.\n * @param {HTMLMediaElement} video\n * @param {HTMLSourceElement} source\n * @param {Object} context\n * @returns {MediaPlayer|null}\n */\n\n function create(video, source, context) {\n if (!video || !/^VIDEO$/i.test(video.nodeName)) return null;\n if (video._dashjs_player) return video._dashjs_player;\n var player;\n var videoID = video.id || video.name || \'video element\';\n source = source || [].slice.call(video.querySelectorAll(\'source\')).filter(function (s) {\n return s.type == SUPPORTED_MIME_TYPE;\n })[0];\n\n if (!source && video.src) {\n source = document.createElement(\'source\');\n source.src = video.src;\n } else if (!source && !video.src) {\n return null;\n }\n\n context = context || {};\n player = Object(_MediaPlayer__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create();\n player.initialize(video, source.src, video.autoplay);\n\n if (!logger) {\n logger = player.getDebug().getLogger();\n }\n\n logger.debug(\'Converted \' + videoID + \' to dash.js player and added content: \' + source.src); // Store a reference to the player on the video element so it can be gotten at for debugging and so we know its\n // already been setup.\n\n video._dashjs_player = player;\n return player;\n }\n /**\n * Searches the provided scope for all instances of the indicated selector. If no scope is provided, document is used. If no selector is\n * specified, [data-dashjs-player] is used. The declarative setup also looks for source elements with the type attribute set to \'application/dash+xml\'.\n * It then looks for those video elements which have a source element defined with a type matching \'application/dash+xml\'.\n * A new MediaPlayer is instantiated for each matching video element and the appropriate source is assigned.\n * The autoplay property of the video element is preserved. Any preload attribute is ignored. This method should be called after the page onLoad event is dispatched.\n * Returns an array holding all the MediaPlayer instances that were added by this method.\n * @param {string} selector - CSS selector\n * @param {Object} scope\n * @returns {Array} an array of MediaPlayer objects\n */\n\n\n function createAll(selector, scope) {\n var aPlayers = [];\n selector = selector || \'[data-dashjs-player]\';\n scope = scope || document;\n var videos = scope.querySelectorAll(selector);\n\n for (var i = 0; i < videos.length; i++) {\n var player = create(videos[i], null);\n aPlayers.push(player);\n }\n\n var sources = scope.querySelectorAll(\'source[type="\' + SUPPORTED_MIME_TYPE + \'"]\');\n\n for (var _i = 0; _i < sources.length; _i++) {\n var video = findVideo(sources[_i]);\n\n var _player = create(video, null);\n\n aPlayers.push(_player);\n }\n\n return aPlayers;\n }\n\n function findVideo(el) {\n if (/^VIDEO$/i.test(el.nodeName)) {\n return el;\n } else {\n return findVideo(el.parentNode);\n }\n }\n\n return {\n create: create,\n createAll: createAll\n };\n}\n\nvar instance = MediaPlayerFactory();\nvar loadInterval;\n\nfunction loadHandler() {\n window.removeEventListener(\'load\', loadHandler);\n instance.createAll();\n}\n\nfunction loadIntervalHandler() {\n if (window.dashjs) {\n window.clearInterval(loadInterval);\n instance.createAll();\n }\n}\n\nvar avoidAutoCreate = typeof window !== \'undefined\' && window && window.dashjs && window.dashjs.skipAutoCreate;\n\nif (!avoidAutoCreate && typeof window !== \'undefined\' && window && window.addEventListener) {\n if (window.document.readyState === \'complete\') {\n if (window.dashjs) {\n instance.createAll();\n } else {\n // If loaded asynchronously, window.readyState may be \'complete\' even if dashjs hasn\'t loaded yet\n loadInterval = window.setInterval(loadIntervalHandler, 500);\n }\n } else {\n window.addEventListener(\'load\', loadHandler);\n }\n}\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (instance);\n\n/***/ }),\n\n/***/ "./src/streaming/SourceBufferSink.js":\n/*!*******************************************!*\\\n !*** ./src/streaming/SourceBufferSink.js ***!\n \\*******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1159496__) {\n__nested_webpack_require_1159496__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1159496__(/*! ../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1159496__(/*! ./vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1159496__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1159496__(/*! ../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _core_Settings__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1159496__(/*! ../core/Settings */ "./src/core/Settings.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1159496__(/*! ./constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1159496__(/*! ./vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1159496__(/*! ../core/events/Events */ "./src/core/events/Events.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\nvar APPEND_WINDOW_START_OFFSET = 0.1;\nvar APPEND_WINDOW_END_OFFSET = 0.01;\n/**\n * @class SourceBufferSink\n * @ignore\n * @implements FragmentSink\n */\n\nvar CHECK_INTERVAL = 50;\n\nfunction SourceBufferSink(config) {\n var context = this.context;\n var settings = Object(_core_Settings__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n var textController = config.textController;\n var eventBus = config.eventBus;\n var instance, type, logger, buffer, mediaInfo, intervalId;\n var callbacks = [];\n var appendQueue = [];\n var isAppendingInProgress = false;\n var mediaSource = config.mediaSource;\n var lastRequestAppended = null;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance().getLogger(instance);\n }\n\n function initializeForStreamSwitch(mInfo, selectedRepresentation, oldSourceBufferSink) {\n mediaInfo = mInfo;\n type = mediaInfo.type;\n var codec = mediaInfo.codec;\n\n _copyPreviousSinkData(oldSourceBufferSink);\n\n _addEventListeners();\n\n var promises = [];\n promises.push(_abortBeforeAppend);\n promises.push(updateAppendWindow(mediaInfo.streamInfo));\n promises.push(changeType(codec));\n\n if (selectedRepresentation && selectedRepresentation.MSETimeOffset !== undefined) {\n promises.push(updateTimestampOffset(selectedRepresentation.MSETimeOffset));\n }\n\n return Promise.all(promises);\n }\n\n function changeType(codec) {\n return new Promise(function (resolve) {\n _waitForUpdateEnd(function () {\n if (buffer.changeType) {\n buffer.changeType(codec);\n }\n\n resolve();\n });\n });\n }\n\n function _copyPreviousSinkData(oldSourceBufferSink) {\n buffer = oldSourceBufferSink.getBuffer();\n }\n\n function initializeForFirstUse(streamInfo, mInfo, selectedRepresentation) {\n mediaInfo = mInfo;\n type = mediaInfo.type;\n var codec = mediaInfo.codec;\n\n try {\n // Safari claims to support anything starting \'application/mp4\'.\n // it definitely doesn\'t understand \'application/mp4;codecs="stpp"\'\n // - currently no browser does, so check for it and use our own\n // implementation. The same is true for codecs="wvtt".\n if (codec.match(/application\\/mp4;\\s*codecs="(stpp|wvtt).*"/i)) {\n return _initializeForText(streamInfo);\n }\n\n buffer = mediaSource.addSourceBuffer(codec);\n\n _addEventListeners();\n\n var promises = [];\n promises.push(updateAppendWindow(mediaInfo.streamInfo));\n\n if (selectedRepresentation && selectedRepresentation.MSETimeOffset !== undefined) {\n promises.push(updateTimestampOffset(selectedRepresentation.MSETimeOffset));\n }\n\n return Promise.all(promises);\n } catch (e) {\n // Note that in the following, the quotes are open to allow for extra text after stpp and wvtt\n if (mediaInfo.type == _constants_Constants__WEBPACK_IMPORTED_MODULE_5__["default"].TEXT && !mediaInfo.isFragmented || codec.indexOf(\'codecs="stpp\') !== -1 || codec.indexOf(\'codecs="vtt\') !== -1) {\n return _initializeForText(streamInfo);\n }\n\n return Promise.reject(e);\n }\n }\n\n function _initializeForText(streamInfo) {\n buffer = textController.getTextSourceBuffer(streamInfo);\n return Promise.resolve();\n }\n\n function _addEventListeners() {\n // use updateend event if possible\n if (typeof buffer.addEventListener === \'function\') {\n try {\n buffer.addEventListener(\'updateend\', _updateEndHandler, false);\n buffer.addEventListener(\'error\', _errHandler, false);\n buffer.addEventListener(\'abort\', _errHandler, false);\n } catch (err) {\n // use setInterval to periodically check if updating has been completed\n intervalId = setInterval(_updateEndHandler, CHECK_INTERVAL);\n }\n } else {\n // use setInterval to periodically check if updating has been completed\n intervalId = setInterval(_updateEndHandler, CHECK_INTERVAL);\n }\n }\n\n function getType() {\n return type;\n }\n\n function _removeEventListeners() {\n try {\n if (typeof buffer.removeEventListener === \'function\') {\n buffer.removeEventListener(\'updateend\', _updateEndHandler, false);\n buffer.removeEventListener(\'error\', _errHandler, false);\n buffer.removeEventListener(\'abort\', _errHandler, false);\n }\n\n clearInterval(intervalId);\n } catch (e) {\n logger.error(e);\n }\n }\n\n function updateAppendWindow(sInfo) {\n return new Promise(function (resolve) {\n if (!buffer || !settings.get().streaming.buffer.useAppendWindow) {\n resolve();\n return;\n }\n\n _waitForUpdateEnd(function () {\n try {\n if (!buffer) {\n resolve();\n return;\n }\n\n var appendWindowEnd = mediaSource.duration;\n var appendWindowStart = 0;\n\n if (sInfo && !isNaN(sInfo.start) && !isNaN(sInfo.duration) && isFinite(sInfo.duration)) {\n appendWindowEnd = sInfo.start + sInfo.duration;\n }\n\n if (sInfo && !isNaN(sInfo.start)) {\n appendWindowStart = sInfo.start;\n }\n\n if (buffer.appendWindowEnd !== appendWindowEnd || buffer.appendWindowStart !== appendWindowStart) {\n buffer.appendWindowStart = 0;\n buffer.appendWindowEnd = appendWindowEnd + APPEND_WINDOW_END_OFFSET;\n buffer.appendWindowStart = Math.max(appendWindowStart - APPEND_WINDOW_START_OFFSET, 0);\n logger.debug("Updated append window for ".concat(mediaInfo.type, ". Set start to ").concat(buffer.appendWindowStart, " and end to ").concat(buffer.appendWindowEnd));\n }\n\n resolve();\n } catch (e) {\n logger.warn("Failed to set append window");\n resolve();\n }\n });\n });\n }\n\n function updateTimestampOffset(MSETimeOffset) {\n return new Promise(function (resolve) {\n if (!buffer) {\n resolve();\n return;\n }\n\n _waitForUpdateEnd(function () {\n try {\n if (buffer.timestampOffset !== MSETimeOffset && !isNaN(MSETimeOffset)) {\n buffer.timestampOffset = MSETimeOffset;\n logger.debug("Set MSE timestamp offset to ".concat(MSETimeOffset));\n }\n\n resolve();\n } catch (e) {\n resolve();\n }\n });\n });\n }\n\n function reset() {\n if (buffer) {\n try {\n callbacks = [];\n\n _removeEventListeners();\n\n isAppendingInProgress = false;\n appendQueue = [];\n\n if (!buffer.getClassName || buffer.getClassName() !== \'TextSourceBuffer\') {\n logger.debug("Removing sourcebuffer from media source");\n mediaSource.removeSourceBuffer(buffer);\n }\n } catch (e) {}\n\n buffer = null;\n }\n\n lastRequestAppended = null;\n }\n\n function getBuffer() {\n return buffer;\n }\n\n function getAllBufferRanges() {\n try {\n return buffer.buffered;\n } catch (e) {\n logger.error(\'getAllBufferRanges exception: \' + e.message);\n return null;\n }\n }\n\n function append(chunk) {\n var _this = this;\n\n var request = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return new Promise(function (resolve, reject) {\n if (!chunk) {\n reject({\n chunk: chunk,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_1__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_3__["default"].APPEND_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_3__["default"].APPEND_ERROR_MESSAGE)\n });\n return;\n }\n\n appendQueue.push({\n data: chunk,\n promise: {\n resolve: resolve,\n reject: reject\n },\n request: request\n });\n\n _waitForUpdateEnd(_appendNextInQueue.bind(_this));\n });\n }\n\n function _abortBeforeAppend() {\n return new Promise(function (resolve) {\n _waitForUpdateEnd(function () {\n // Save the append window, which is reset on abort().\n var appendWindowStart = buffer.appendWindowStart;\n var appendWindowEnd = buffer.appendWindowEnd;\n\n if (buffer) {\n buffer.abort();\n buffer.appendWindowStart = appendWindowStart;\n buffer.appendWindowEnd = appendWindowEnd;\n }\n\n resolve();\n });\n });\n }\n\n function remove(range) {\n return new Promise(function (resolve, reject) {\n var start = range.start;\n var end = range.end; // make sure that the given time range is correct. Otherwise we will get InvalidAccessError\n\n if (!(start >= 0 && end > start)) {\n resolve();\n return;\n }\n\n _waitForUpdateEnd(function () {\n try {\n buffer.remove(start, end); // updating is in progress, we should wait for it to complete before signaling that this operation is done\n\n _waitForUpdateEnd(function () {\n resolve({\n from: start,\n to: end,\n unintended: false\n });\n\n if (range.resolve) {\n range.resolve();\n }\n });\n } catch (err) {\n reject({\n from: start,\n to: end,\n unintended: false,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_1__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_3__["default"].REMOVE_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_3__["default"].REMOVE_ERROR_MESSAGE)\n });\n\n if (range.reject) {\n range.reject(err);\n }\n }\n });\n });\n }\n\n function _appendNextInQueue() {\n if (isAppendingInProgress) {\n return;\n }\n\n if (appendQueue.length > 0) {\n isAppendingInProgress = true;\n var nextChunk = appendQueue[0];\n appendQueue.splice(0, 1);\n\n var afterSuccess = function afterSuccess() {\n isAppendingInProgress = false;\n\n if (appendQueue.length > 0) {\n _appendNextInQueue.call(this);\n } // Init segments are cached. In any other case we dont need the chunk bytes anymore and can free the memory\n\n\n if (nextChunk && nextChunk.data && nextChunk.data.segmentType && nextChunk.data.segmentType !== _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_6__["HTTPRequest"].INIT_SEGMENT_TYPE) {\n delete nextChunk.data.bytes;\n }\n\n nextChunk.promise.resolve({\n chunk: nextChunk.data\n });\n };\n\n try {\n lastRequestAppended = nextChunk.request;\n\n if (nextChunk.data.bytes.byteLength === 0) {\n afterSuccess.call(this);\n } else {\n if (buffer.appendBuffer) {\n buffer.appendBuffer(nextChunk.data.bytes);\n } else {\n buffer.append(nextChunk.data.bytes, nextChunk.data);\n } // updating is in progress, we should wait for it to complete before signaling that this operation is done\n\n\n _waitForUpdateEnd(afterSuccess.bind(this));\n }\n } catch (err) {\n logger.fatal(\'SourceBuffer append failed "\' + err + \'"\');\n\n if (appendQueue.length > 0) {\n _appendNextInQueue();\n } else {\n isAppendingInProgress = false;\n }\n\n delete nextChunk.data.bytes;\n nextChunk.promise.reject({\n chunk: nextChunk.data,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_1__["default"](err.code, err.message)\n });\n }\n }\n }\n\n function abort() {\n return new Promise(function (resolve) {\n try {\n appendQueue = [];\n\n if (mediaSource.readyState === \'open\') {\n _waitForUpdateEnd(function () {\n try {\n if (buffer) {\n buffer.abort();\n }\n\n resolve();\n } catch (e) {\n resolve();\n }\n });\n } else if (buffer && buffer.setTextTrack && mediaSource.readyState === \'ended\') {\n buffer.abort(); //The cues need to be removed from the TextSourceBuffer via a call to abort()\n\n resolve();\n } else {\n resolve();\n }\n } catch (e) {\n resolve();\n }\n });\n }\n\n function _executeCallback() {\n if (callbacks.length > 0) {\n if (!buffer.updating) {\n var cb = callbacks.shift();\n cb(); // Try to execute next callback if still not updating\n\n _executeCallback();\n }\n }\n }\n\n function _updateEndHandler() {\n // if updating is still in progress do nothing and wait for the next check again.\n if (buffer.updating) {\n return;\n } // updating is completed, now we can stop checking and resolve the promise\n\n\n _executeCallback();\n }\n\n function _errHandler(e) {\n var error = e.target || {};\n\n _triggerEvent(_core_events_Events__WEBPACK_IMPORTED_MODULE_7__["default"].SOURCE_BUFFER_ERROR, {\n error: error,\n lastRequestAppended: lastRequestAppended\n });\n }\n\n function _triggerEvent(eventType, data) {\n var payload = data || {};\n eventBus.trigger(eventType, payload, {\n streamId: mediaInfo.streamInfo.id,\n mediaType: type\n });\n }\n\n function _waitForUpdateEnd(callback) {\n callbacks.push(callback);\n\n if (!buffer.updating) {\n _executeCallback();\n }\n }\n\n instance = {\n getType: getType,\n getAllBufferRanges: getAllBufferRanges,\n getBuffer: getBuffer,\n append: append,\n remove: remove,\n abort: abort,\n reset: reset,\n updateTimestampOffset: updateTimestampOffset,\n initializeForStreamSwitch: initializeForStreamSwitch,\n initializeForFirstUse: initializeForFirstUse,\n updateAppendWindow: updateAppendWindow,\n changeType: changeType\n };\n setup();\n return instance;\n}\n\nSourceBufferSink.__dashjs_factory_name = \'SourceBufferSink\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getClassFactory(SourceBufferSink);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/Stream.js":\n/*!*********************************!*\\\n !*** ./src/streaming/Stream.js ***!\n \\*********************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1176796__) {\n__nested_webpack_require_1176796__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1176796__(/*! ./constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1176796__(/*! ../dash/constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/* harmony import */ var _StreamProcessor__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1176796__(/*! ./StreamProcessor */ "./src/streaming/StreamProcessor.js");\n/* harmony import */ var _controllers_FragmentController__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1176796__(/*! ./controllers/FragmentController */ "./src/streaming/controllers/FragmentController.js");\n/* harmony import */ var _thumbnail_ThumbnailController__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1176796__(/*! ./thumbnail/ThumbnailController */ "./src/streaming/thumbnail/ThumbnailController.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1176796__(/*! ../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1176796__(/*! ../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1176796__(/*! ../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1176796__(/*! ../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1176796__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_1176796__(/*! ./vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _utils_BoxParser__WEBPACK_IMPORTED_MODULE_11__ = __nested_webpack_require_1176796__(/*! ./utils/BoxParser */ "./src/streaming/utils/BoxParser.js");\n/* harmony import */ var _utils_URLUtils__WEBPACK_IMPORTED_MODULE_12__ = __nested_webpack_require_1176796__(/*! ./utils/URLUtils */ "./src/streaming/utils/URLUtils.js");\n/* harmony import */ var _controllers_BlacklistController__WEBPACK_IMPORTED_MODULE_13__ = __nested_webpack_require_1176796__(/*! ./controllers/BlacklistController */ "./src/streaming/controllers/BlacklistController.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar MEDIA_TYPES = [_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].MUXED, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].IMAGE];\n\nfunction Stream(config) {\n config = config || {};\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance();\n var urlUtils = Object(_utils_URLUtils__WEBPACK_IMPORTED_MODULE_12__["default"])(context).getInstance();\n var manifestModel = config.manifestModel;\n var mediaPlayerModel = config.mediaPlayerModel;\n var dashMetrics = config.dashMetrics;\n var manifestUpdater = config.manifestUpdater;\n var adapter = config.adapter;\n var timelineConverter = config.timelineConverter;\n var capabilities = config.capabilities;\n var errHandler = config.errHandler;\n var abrController = config.abrController;\n var playbackController = config.playbackController;\n var eventController = config.eventController;\n var mediaController = config.mediaController;\n var protectionController = config.protectionController;\n var textController = config.textController;\n var videoModel = config.videoModel;\n var streamInfo = config.streamInfo;\n var settings = config.settings;\n var instance, logger, streamProcessors, isInitialized, isActive, hasFinishedBuffering, hasVideoTrack, hasAudioTrack, updateError, isUpdating, fragmentController, thumbnailController, segmentBlacklistController, preloaded, boxParser, debug, isEndedEventSignaled, trackChangedEvents;\n /**\n * Setup the stream\n */\n\n function setup() {\n try {\n debug = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_7__["default"])(context).getInstance();\n logger = debug.getLogger(instance);\n resetInitialSettings();\n boxParser = Object(_utils_BoxParser__WEBPACK_IMPORTED_MODULE_11__["default"])(context).getInstance();\n segmentBlacklistController = Object(_controllers_BlacklistController__WEBPACK_IMPORTED_MODULE_13__["default"])(context).create({\n updateEventName: _core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].SEGMENT_LOCATION_BLACKLIST_CHANGED,\n addBlacklistEventName: _core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].SEGMENT_LOCATION_BLACKLIST_ADD\n });\n fragmentController = Object(_controllers_FragmentController__WEBPACK_IMPORTED_MODULE_3__["default"])(context).create({\n streamInfo: streamInfo,\n mediaPlayerModel: mediaPlayerModel,\n dashMetrics: dashMetrics,\n errHandler: errHandler,\n settings: settings,\n boxParser: boxParser,\n dashConstants: _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"],\n urlUtils: urlUtils\n });\n } catch (e) {\n throw e;\n }\n }\n /**\n * Initialize the events\n */\n\n\n function initialize() {\n registerEvents();\n registerProtectionEvents();\n textController.initializeForStream(streamInfo);\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].STREAM_UPDATED, {\n streamInfo: streamInfo\n });\n }\n /**\n * Register the streaming events\n */\n\n\n function registerEvents() {\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].BUFFERING_COMPLETED, onBufferingCompleted, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].DATA_UPDATE_COMPLETED, onDataUpdateCompleted, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].INBAND_EVENTS, onInbandEvents, instance);\n }\n /**\n * Unregister the streaming events\n */\n\n\n function unRegisterEvents() {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].DATA_UPDATE_COMPLETED, onDataUpdateCompleted, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].BUFFERING_COMPLETED, onBufferingCompleted, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].INBAND_EVENTS, onInbandEvents, instance);\n }\n /**\n * Register the protection events\n */\n\n\n function registerProtectionEvents() {\n if (protectionController) {\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].KEY_ERROR, onProtectionError, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].SERVER_CERTIFICATE_UPDATED, onProtectionError, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].LICENSE_REQUEST_COMPLETE, onProtectionError, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].KEY_SYSTEM_SELECTED, onProtectionError, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].KEY_SESSION_CREATED, onProtectionError, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].KEY_STATUSES_CHANGED, onProtectionError, instance);\n }\n }\n /**\n * Unregister the protection events\n */\n\n\n function unRegisterProtectionEvents() {\n if (protectionController) {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].KEY_ERROR, onProtectionError, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].SERVER_CERTIFICATE_UPDATED, onProtectionError, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].LICENSE_REQUEST_COMPLETE, onProtectionError, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].KEY_SYSTEM_SELECTED, onProtectionError, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].KEY_SESSION_CREATED, onProtectionError, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].KEY_STATUSES_CHANGED, onProtectionError, instance);\n }\n }\n /**\n * Returns the stream id\n * @return {*|null}\n */\n\n\n function getStreamId() {\n return streamInfo ? streamInfo.id : null;\n }\n /**\n * Activates Stream by re-initializing some of its components\n * @param {MediaSource} mediaSource\n * @param {array} previousBufferSinks\n * @memberof Stream#\n */\n\n\n function activate(mediaSource, previousBufferSinks) {\n return new Promise(function (resolve, reject) {\n if (isActive) {\n resolve(previousBufferSinks);\n return;\n }\n\n if (getPreloaded()) {\n isActive = true;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].STREAM_ACTIVATED, {\n streamInfo: streamInfo\n });\n resolve(previousBufferSinks);\n return;\n }\n\n _initializeMedia(mediaSource, previousBufferSinks).then(function (bufferSinks) {\n isActive = true;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].STREAM_ACTIVATED, {\n streamInfo: streamInfo\n });\n resolve(bufferSinks);\n })["catch"](function (e) {\n reject(e);\n });\n });\n }\n /**\n *\n * @param {object} mediaSource\n * @param {array} previousBufferSinks\n * @return {Promise<Array>}\n * @private\n */\n\n\n function _initializeMedia(mediaSource, previousBufferSinks) {\n return _commonMediaInitialization(mediaSource, previousBufferSinks);\n }\n\n function startPreloading(mediaSource, previousBuffers) {\n return new Promise(function (resolve, reject) {\n if (getPreloaded()) {\n reject();\n return;\n }\n\n logger.info("[startPreloading] Preloading next stream with id ".concat(getId()));\n setPreloaded(true);\n\n _commonMediaInitialization(mediaSource, previousBuffers).then(function () {\n for (var i = 0; i < streamProcessors.length && streamProcessors[i]; i++) {\n streamProcessors[i].setExplicitBufferingTime(getStartTime());\n streamProcessors[i].getScheduleController().startScheduleTimer();\n }\n\n resolve();\n })["catch"](function () {\n setPreloaded(false);\n reject();\n });\n });\n }\n /**\n *\n * @param {object} mediaSource\n * @param {array} previousBufferSinks\n * @return {Promise<array>}\n * @private\n */\n\n\n function _commonMediaInitialization(mediaSource, previousBufferSinks) {\n return new Promise(function (resolve, reject) {\n checkConfig();\n isUpdating = true;\n addInlineEvents();\n var element = videoModel.getElement();\n MEDIA_TYPES.forEach(function (mediaType) {\n if (mediaType !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO || !element || element && /^VIDEO$/i.test(element.nodeName)) {\n _initializeMediaForType(mediaType, mediaSource);\n }\n });\n\n _createBufferSinks(previousBufferSinks).then(function (bufferSinks) {\n isUpdating = false;\n\n if (streamProcessors.length === 0) {\n var msg = \'No streams to play.\';\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_10__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_8__["default"].MANIFEST_ERROR_ID_NOSTREAMS_CODE, msg, manifestModel.getValue()));\n logger.fatal(msg);\n } else {\n _checkIfInitializationCompleted();\n } // All mediaInfos for texttracks are added to the TextSourceBuffer by now. We can start creating the tracks\n\n\n textController.createTracks(streamInfo);\n resolve(bufferSinks);\n })["catch"](function (e) {\n reject(e);\n });\n });\n }\n /**\n * Initialize for a given media type. Creates a corresponding StreamProcessor\n * @param {string} type\n * @param {object} mediaSource\n * @private\n */\n\n\n function _initializeMediaForType(type, mediaSource) {\n var allMediaForType = adapter.getAllMediaInfoForType(streamInfo, type);\n var embeddedMediaInfos = [];\n var mediaInfo = null;\n var initialMediaInfo;\n\n if (!allMediaForType || allMediaForType.length === 0) {\n logger.info(\'No \' + type + \' data.\');\n return;\n }\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO) {\n hasVideoTrack = true;\n }\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO) {\n hasAudioTrack = true;\n }\n\n for (var i = 0, ln = allMediaForType.length; i < ln; i++) {\n mediaInfo = allMediaForType[i];\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT && !!mediaInfo.isEmbedded) {\n textController.addEmbeddedTrack(streamInfo, mediaInfo);\n embeddedMediaInfos.push(mediaInfo);\n }\n\n if (_isMediaSupported(mediaInfo)) {\n mediaController.addTrack(mediaInfo);\n }\n }\n\n if (embeddedMediaInfos.length > 0) {\n mediaController.setInitialMediaSettingsForType(type, streamInfo);\n textController.setInitialSettings(mediaController.getInitialSettings(type));\n textController.addMediaInfosToBuffer(streamInfo, type, embeddedMediaInfos);\n } // Filter out embedded text track before creating StreamProcessor\n\n\n allMediaForType = allMediaForType.filter(function (mediaInfo) {\n return !mediaInfo.isEmbedded;\n });\n\n if (allMediaForType.length === 0) {\n return;\n }\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].IMAGE) {\n thumbnailController = Object(_thumbnail_ThumbnailController__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create({\n streamInfo: streamInfo,\n adapter: adapter,\n baseURLController: config.baseURLController,\n timelineConverter: config.timelineConverter,\n debug: debug,\n eventBus: eventBus,\n events: _core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"],\n dashConstants: _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"],\n dashMetrics: config.dashMetrics,\n segmentBaseController: config.segmentBaseController\n });\n thumbnailController.initialize();\n return;\n }\n\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].STREAM_INITIALIZING, {\n streamInfo: streamInfo,\n mediaInfo: mediaInfo\n });\n mediaController.setInitialMediaSettingsForType(type, streamInfo);\n\n var streamProcessor = _createStreamProcessor(allMediaForType, mediaSource);\n\n initialMediaInfo = mediaController.getCurrentTrackFor(type, streamInfo.id);\n\n if (initialMediaInfo) {\n abrController.updateTopQualityIndex(initialMediaInfo); // In case of mixed fragmented and embedded text tracks, check if initial selected text track is not an embedded track\n\n streamProcessor.selectMediaInfo(type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT || !initialMediaInfo.isEmbedded ? initialMediaInfo : allMediaForType[0]);\n }\n }\n\n function _isMediaSupported(mediaInfo) {\n var type = mediaInfo ? mediaInfo.type : null;\n var msg;\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].MUXED) {\n msg = \'Multiplexed representations are intentionally not supported, as they are not compliant with the DASH-AVC/264 guidelines\';\n logger.fatal(msg);\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_10__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_8__["default"].MANIFEST_ERROR_ID_MULTIPLEXED_CODE, msg, manifestModel.getValue()));\n return false;\n }\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].IMAGE) {\n return true;\n }\n\n if (!!mediaInfo.contentProtection && !capabilities.supportsEncryptedMedia()) {\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_10__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_8__["default"].CAPABILITY_MEDIAKEYS_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_8__["default"].CAPABILITY_MEDIAKEYS_ERROR_MESSAGE));\n return false;\n }\n\n return true;\n }\n /**\n * Creates the StreamProcessor for a given media type.\n * @param {object} initialMediaInfo\n * @param {array} allMediaForType\n * @param {object} mediaSource\n * @private\n */\n\n\n function _createStreamProcessor(allMediaForType, mediaSource) {\n var mediaInfo = allMediaForType && allMediaForType.length > 0 ? allMediaForType[0] : null;\n var fragmentModel = fragmentController.getModel(mediaInfo ? mediaInfo.type : null);\n var type = mediaInfo ? mediaInfo.type : null;\n var mimeType = mediaInfo ? mediaInfo.mimeType : null;\n var isFragmented = mediaInfo ? mediaInfo.isFragmented : null;\n var streamProcessor = Object(_StreamProcessor__WEBPACK_IMPORTED_MODULE_2__["default"])(context).create({\n streamInfo: streamInfo,\n type: type,\n mimeType: mimeType,\n timelineConverter: timelineConverter,\n adapter: adapter,\n manifestModel: manifestModel,\n mediaPlayerModel: mediaPlayerModel,\n fragmentModel: fragmentModel,\n dashMetrics: config.dashMetrics,\n baseURLController: config.baseURLController,\n segmentBaseController: config.segmentBaseController,\n abrController: abrController,\n playbackController: playbackController,\n mediaController: mediaController,\n textController: textController,\n errHandler: errHandler,\n settings: settings,\n boxParser: boxParser,\n segmentBlacklistController: segmentBlacklistController\n });\n streamProcessor.initialize(mediaSource, hasVideoTrack, isFragmented);\n streamProcessors.push(streamProcessor);\n\n for (var i = 0; i < allMediaForType.length; i++) {\n streamProcessor.addMediaInfo(allMediaForType[i]);\n }\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT) {\n textController.addMediaInfosToBuffer(streamInfo, type, allMediaForType, fragmentModel);\n }\n\n return streamProcessor;\n }\n /**\n * Creates the SourceBufferSink objects for all StreamProcessors\n * @param {array} previousBuffersSinks\n * @return {Promise<object>}\n * @private\n */\n\n\n function _createBufferSinks(previousBuffersSinks) {\n return new Promise(function (resolve) {\n var buffers = {};\n var promises = streamProcessors.map(function (sp) {\n return sp.createBufferSinks(previousBuffersSinks);\n });\n Promise.all(promises).then(function (bufferSinks) {\n bufferSinks.forEach(function (sink) {\n if (sink) {\n buffers[sink.getType()] = sink;\n }\n });\n resolve(buffers);\n })["catch"](function () {\n resolve(buffers);\n });\n });\n }\n /**\n * Partially resets some of the Stream elements. This function is called when preloading of streams is canceled or a stream switch occurs.\n * @memberof Stream#\n * @param {boolean} keepBuffers\n */\n\n\n function deactivate(keepBuffers) {\n var ln = streamProcessors ? streamProcessors.length : 0;\n var errored = false;\n\n for (var i = 0; i < ln; i++) {\n var fragmentModel = streamProcessors[i].getFragmentModel();\n fragmentModel.abortRequests();\n fragmentModel.resetInitialSettings();\n streamProcessors[i].reset(errored, keepBuffers);\n }\n\n if (textController) {\n textController.deactivateStream(streamInfo);\n }\n\n streamProcessors = [];\n isActive = false;\n hasFinishedBuffering = false;\n setPreloaded(false);\n setIsEndedEventSignaled(false);\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].STREAM_DEACTIVATED, {\n streamInfo: streamInfo\n });\n }\n\n function getIsActive() {\n return isActive;\n }\n\n function setMediaSource(mediaSource) {\n for (var i = 0; i < streamProcessors.length;) {\n if (_isMediaSupported(streamProcessors[i].getMediaInfo())) {\n streamProcessors[i].setMediaSource(mediaSource);\n i++;\n } else {\n streamProcessors[i].reset();\n streamProcessors.splice(i, 1);\n }\n }\n\n if (streamProcessors.length === 0) {\n var msg = \'No streams to play.\';\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_10__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_8__["default"].MANIFEST_ERROR_ID_NOSTREAMS_CODE, msg + \'nostreams\', manifestModel.getValue()));\n logger.fatal(msg);\n }\n }\n\n function resetInitialSettings(keepBuffers) {\n deactivate(keepBuffers);\n isInitialized = false;\n hasVideoTrack = false;\n hasAudioTrack = false;\n updateError = {};\n isUpdating = false;\n isEndedEventSignaled = false;\n trackChangedEvents = [];\n }\n\n function reset(keepBuffers) {\n if (fragmentController) {\n fragmentController.reset();\n fragmentController = null;\n }\n\n if (abrController && streamInfo) {\n abrController.clearDataForStream(streamInfo.id);\n }\n\n if (segmentBlacklistController) {\n segmentBlacklistController.reset();\n segmentBlacklistController = null;\n }\n\n resetInitialSettings(keepBuffers);\n streamInfo = null;\n unRegisterEvents();\n unRegisterProtectionEvents();\n }\n\n function getDuration() {\n return streamInfo ? streamInfo.duration : NaN;\n }\n\n function getIsEndedEventSignaled() {\n return isEndedEventSignaled;\n }\n\n function setIsEndedEventSignaled(value) {\n isEndedEventSignaled = value;\n }\n\n function getStartTime() {\n return streamInfo ? streamInfo.start : NaN;\n }\n\n function getId() {\n return streamInfo ? streamInfo.id : null;\n }\n\n function getStreamInfo() {\n return streamInfo;\n }\n\n function getHasAudioTrack() {\n return hasAudioTrack;\n }\n\n function getHasVideoTrack() {\n return hasVideoTrack;\n }\n\n function getThumbnailController() {\n return thumbnailController;\n }\n\n function checkConfig() {\n if (!videoModel || !abrController) {\n throw new Error(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].MISSING_CONFIG_ERROR);\n }\n }\n /**\n * @param {string} type\n * @returns {Array}\n * @memberof Stream#\n */\n\n\n function getBitrateListFor(type) {\n checkConfig();\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].IMAGE) {\n if (!thumbnailController) {\n return [];\n }\n\n return thumbnailController.getBitrateList();\n }\n\n var mediaInfo = getMediaInfo(type);\n return abrController.getBitrateList(mediaInfo);\n }\n\n function onProtectionError(event) {\n if (event.error) {\n errHandler.error(event.error);\n logger.fatal(event.error.message);\n }\n }\n\n function prepareTrackChange(e) {\n if (!isActive || !streamInfo) {\n return;\n }\n\n hasFinishedBuffering = false;\n var mediaInfo = e.newMediaInfo;\n var manifest = manifestModel.getValue();\n adapter.setCurrentMediaInfo(streamInfo.id, mediaInfo.type, mediaInfo);\n var processor = getProcessorForMediaInfo(mediaInfo);\n if (!processor) return;\n var currentTime = playbackController.getTime();\n logger.info(\'Stream - Process track changed at current time \' + currentTime); // Applies only for MSS streams\n\n if (manifest.refreshManifestOnSwitchTrack) {\n trackChangedEvents.push(e);\n\n if (!manifestUpdater.getIsUpdating()) {\n logger.debug(\'Stream - Refreshing manifest for switch track\');\n manifestUpdater.refreshManifest();\n }\n } else {\n processor.selectMediaInfo(mediaInfo).then(function () {\n if (mediaInfo.type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO || mediaInfo.type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO) {\n abrController.updateTopQualityIndex(mediaInfo);\n }\n\n processor.prepareTrackSwitch();\n });\n }\n }\n\n function prepareQualityChange(e) {\n var processor = _getProcessorByType(e.mediaType);\n\n if (processor) {\n processor.prepareQualityChange(e);\n }\n }\n\n function addInlineEvents() {\n if (eventController) {\n var events = adapter.getEventsFor(streamInfo);\n eventController.addInlineEvents(events);\n }\n }\n\n function _checkIfInitializationCompleted() {\n var ln = streamProcessors.length;\n var hasError = !!updateError.audio || !!updateError.video;\n var error = hasError ? new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_10__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_8__["default"].DATA_UPDATE_FAILED_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_8__["default"].DATA_UPDATE_FAILED_ERROR_MESSAGE) : null;\n\n for (var i = 0; i < ln; i++) {\n if (streamProcessors[i].isUpdating() || isUpdating) {\n return;\n }\n }\n\n if (protectionController) {\n // Need to check if streamProcessors exists because streamProcessors\n // could be cleared in case an error is detected while initializing DRM keysystem\n protectionController.clearMediaInfoArray();\n\n for (var _i = 0; _i < ln && streamProcessors[_i]; _i++) {\n var type = streamProcessors[_i].getType();\n\n var mediaInfo = streamProcessors[_i].getMediaInfo();\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT && mediaInfo.isFragmented) {\n var _mediaInfo = streamProcessors[_i].getMediaInfo();\n\n if (_mediaInfo) {\n protectionController.initializeForMedia(_mediaInfo);\n }\n }\n }\n }\n\n if (error) {\n errHandler.error(error);\n } else if (!isInitialized) {\n isInitialized = true;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].STREAM_INITIALIZED, {\n streamInfo: streamInfo\n });\n }\n }\n\n function getMediaInfo(type) {\n var streamProcessor = null;\n\n for (var i = 0; i < streamProcessors.length; i++) {\n streamProcessor = streamProcessors[i];\n\n if (streamProcessor.getType() === type) {\n return streamProcessor.getMediaInfo();\n }\n }\n\n return null;\n }\n\n function onBufferingCompleted() {\n var processors = getProcessors();\n var ln = processors.length;\n\n if (ln === 0) {\n logger.warn(\'onBufferingCompleted - can\\\'t trigger STREAM_BUFFERING_COMPLETED because no streamProcessor is defined\');\n return;\n } // if there is at least one buffer controller that has not completed buffering yet do nothing\n\n\n for (var i = 0; i < ln; i++) {\n //if audio or video buffer is not buffering completed state, do not send STREAM_BUFFERING_COMPLETED\n if (!processors[i].isBufferingCompleted() && (processors[i].getType() === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO || processors[i].getType() === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO)) {\n logger.debug(\'onBufferingCompleted - One streamProcessor has finished but\', processors[i].getType(), \'one is not buffering completed\');\n return;\n }\n }\n\n logger.debug(\'onBufferingCompleted - trigger STREAM_BUFFERING_COMPLETED\');\n hasFinishedBuffering = true;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].STREAM_BUFFERING_COMPLETED, {\n streamInfo: streamInfo\n }, {\n streamInfo: streamInfo\n });\n }\n\n function onDataUpdateCompleted(e) {\n updateError[e.mediaType] = e.error;\n\n _checkIfInitializationCompleted();\n }\n\n function onInbandEvents(e) {\n if (eventController) {\n eventController.addInbandEvents(e.events);\n }\n }\n\n function getProcessorForMediaInfo(mediaInfo) {\n if (!mediaInfo || !mediaInfo.type) {\n return null;\n }\n\n return _getProcessorByType(mediaInfo.type);\n }\n\n function _getProcessorByType(type) {\n if (!type) {\n return null;\n }\n\n var processors = getProcessors();\n return processors.filter(function (processor) {\n return processor.getType() === type;\n })[0];\n }\n\n function getProcessors() {\n var arr = [];\n var type, streamProcessor;\n\n for (var i = 0; i < streamProcessors.length; i++) {\n streamProcessor = streamProcessors[i];\n type = streamProcessor.getType();\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT) {\n arr.push(streamProcessor);\n }\n }\n\n return arr;\n }\n\n function startScheduleControllers() {\n var ln = streamProcessors.length;\n\n for (var i = 0; i < ln && streamProcessors[i]; i++) {\n streamProcessors[i].getScheduleController().startScheduleTimer();\n }\n }\n\n function updateData(updatedStreamInfo) {\n return new Promise(function (resolve) {\n isUpdating = true;\n streamInfo = updatedStreamInfo;\n\n if (eventController) {\n addInlineEvents();\n }\n\n var promises = [];\n\n for (var i = 0, ln = streamProcessors.length; i < ln; i++) {\n var streamProcessor = streamProcessors[i];\n var currentMediaInfo = streamProcessor.getMediaInfo();\n promises.push(streamProcessor.updateStreamInfo(streamInfo));\n var allMediaForType = adapter.getAllMediaInfoForType(streamInfo, streamProcessor.getType()); // Check if AdaptationSet has not been removed in MPD update\n\n if (allMediaForType) {\n // Remove the current mediaInfo objects before adding the updated ones\n streamProcessor.clearMediaInfoArray();\n\n for (var j = 0; j < allMediaForType.length; j++) {\n var mInfo = allMediaForType[j];\n streamProcessor.addMediaInfo(allMediaForType[j]);\n\n if (adapter.areMediaInfosEqual(currentMediaInfo, mInfo)) {\n abrController.updateTopQualityIndex(mInfo);\n promises.push(streamProcessor.selectMediaInfo(mInfo));\n }\n }\n }\n }\n\n Promise.all(promises).then(function () {\n promises = [];\n\n while (trackChangedEvents.length > 0) {\n var trackChangedEvent = trackChangedEvents.pop();\n var mediaInfo = trackChangedEvent.newMediaInfo;\n var processor = getProcessorForMediaInfo(trackChangedEvent.oldMediaInfo);\n if (!processor) return;\n promises.push(processor.prepareTrackSwitch());\n processor.selectMediaInfo(mediaInfo);\n }\n\n return Promise.all(promises);\n }).then(function () {\n isUpdating = false;\n\n _checkIfInitializationCompleted();\n\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].STREAM_UPDATED, {\n streamInfo: streamInfo\n });\n resolve();\n });\n });\n }\n\n function isMediaCodecCompatible(newStream) {\n var previousStream = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n return compareCodecs(newStream, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO, previousStream) && compareCodecs(newStream, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO, previousStream);\n }\n\n function isProtectionCompatible(newStream) {\n if (!newStream) {\n return true;\n }\n\n return _compareProtectionConfig(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO, newStream) && _compareProtectionConfig(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO, newStream);\n }\n\n function _compareProtectionConfig(type, newStream) {\n var currentStreamInfo = getStreamInfo();\n var newStreamInfo = newStream.getStreamInfo();\n\n if (!newStreamInfo || !currentStreamInfo) {\n return true;\n }\n\n var newAdaptation = adapter.getAdaptationForType(newStreamInfo.index, type, newStreamInfo);\n var currentAdaptation = adapter.getAdaptationForType(currentStreamInfo.index, type, currentStreamInfo);\n\n if (!newAdaptation || !currentAdaptation) {\n // If there is no adaptation for neither the old or the new stream they\'re compatible\n return !newAdaptation && !currentAdaptation;\n } // If the current period is unencrypted and the upcoming one is encrypted we need to reset sourcebuffers.\n\n\n return !(!_isAdaptationDrmProtected(currentAdaptation) && _isAdaptationDrmProtected(newAdaptation));\n }\n\n function _isAdaptationDrmProtected(adaptation) {\n if (!adaptation) {\n // If there is no adaptation for neither the old or the new stream they\'re compatible\n return false;\n } // If the current period is unencrypted and the upcoming one is encrypted we need to reset sourcebuffers.\n\n\n return !!(adaptation.ContentProtection || adaptation.Representation && adaptation.Representation.length > 0 && adaptation.Representation[0].ContentProtection);\n }\n\n function compareCodecs(newStream, type) {\n var previousStream = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n if (!newStream || !newStream.hasOwnProperty(\'getStreamInfo\')) {\n return false;\n }\n\n var newStreamInfo = newStream.getStreamInfo();\n var currentStreamInfo = previousStream ? previousStream.getStreamInfo() : getStreamInfo();\n\n if (!newStreamInfo || !currentStreamInfo) {\n return false;\n }\n\n var newAdaptation = adapter.getAdaptationForType(newStreamInfo.index, type, newStreamInfo);\n var currentAdaptation = adapter.getAdaptationForType(currentStreamInfo.index, type, currentStreamInfo);\n\n if (!newAdaptation || !currentAdaptation) {\n // If there is no adaptation for neither the old or the new stream they\'re compatible\n return !newAdaptation && !currentAdaptation;\n }\n\n var sameMimeType = newAdaptation && currentAdaptation && newAdaptation.mimeType === currentAdaptation.mimeType;\n var oldCodecs = currentAdaptation.Representation_asArray.map(function (representation) {\n return representation.codecs;\n });\n var newCodecs = newAdaptation.Representation_asArray.map(function (representation) {\n return representation.codecs;\n });\n var codecMatch = newCodecs.some(function (newCodec) {\n return oldCodecs.indexOf(newCodec) > -1;\n });\n var partialCodecMatch = newCodecs.some(function (newCodec) {\n return oldCodecs.some(function (oldCodec) {\n return capabilities.codecRootCompatibleWithCodec(oldCodec, newCodec);\n });\n });\n return codecMatch || partialCodecMatch && sameMimeType;\n }\n\n function setPreloaded(value) {\n preloaded = value;\n }\n\n function getPreloaded() {\n return preloaded;\n }\n\n function getHasFinishedBuffering() {\n return hasFinishedBuffering;\n }\n\n function getAdapter() {\n return adapter;\n }\n\n instance = {\n initialize: initialize,\n getStreamId: getStreamId,\n activate: activate,\n deactivate: deactivate,\n getIsActive: getIsActive,\n getDuration: getDuration,\n getStartTime: getStartTime,\n getId: getId,\n getStreamInfo: getStreamInfo,\n getHasAudioTrack: getHasAudioTrack,\n getHasVideoTrack: getHasVideoTrack,\n startPreloading: startPreloading,\n getThumbnailController: getThumbnailController,\n getBitrateListFor: getBitrateListFor,\n updateData: updateData,\n reset: reset,\n getProcessors: getProcessors,\n setMediaSource: setMediaSource,\n isMediaCodecCompatible: isMediaCodecCompatible,\n isProtectionCompatible: isProtectionCompatible,\n getPreloaded: getPreloaded,\n getIsEndedEventSignaled: getIsEndedEventSignaled,\n setIsEndedEventSignaled: setIsEndedEventSignaled,\n getAdapter: getAdapter,\n getHasFinishedBuffering: getHasFinishedBuffering,\n setPreloaded: setPreloaded,\n startScheduleControllers: startScheduleControllers,\n prepareTrackChange: prepareTrackChange,\n prepareQualityChange: prepareQualityChange\n };\n setup();\n return instance;\n}\n\nStream.__dashjs_factory_name = \'Stream\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_9__["default"].getClassFactory(Stream));\n\n/***/ }),\n\n/***/ "./src/streaming/StreamProcessor.js":\n/*!******************************************!*\\\n !*** ./src/streaming/StreamProcessor.js ***!\n \\******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1215317__) {\n__nested_webpack_require_1215317__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1215317__(/*! ./constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1215317__(/*! ../dash/constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1215317__(/*! ./constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _models_FragmentModel__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1215317__(/*! ./models/FragmentModel */ "./src/streaming/models/FragmentModel.js");\n/* harmony import */ var _controllers_BufferController__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1215317__(/*! ./controllers/BufferController */ "./src/streaming/controllers/BufferController.js");\n/* harmony import */ var _text_NotFragmentedTextBufferController__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1215317__(/*! ./text/NotFragmentedTextBufferController */ "./src/streaming/text/NotFragmentedTextBufferController.js");\n/* harmony import */ var _controllers_ScheduleController__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1215317__(/*! ./controllers/ScheduleController */ "./src/streaming/controllers/ScheduleController.js");\n/* harmony import */ var _dash_controllers_RepresentationController__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1215317__(/*! ../dash/controllers/RepresentationController */ "./src/dash/controllers/RepresentationController.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1215317__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1215317__(/*! ./utils/SupervisorTools */ "./src/streaming/utils/SupervisorTools.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_1215317__(/*! ../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_11__ = __nested_webpack_require_1215317__(/*! ../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _dash_DashHandler__WEBPACK_IMPORTED_MODULE_12__ = __nested_webpack_require_1215317__(/*! ../dash/DashHandler */ "./src/dash/DashHandler.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_13__ = __nested_webpack_require_1215317__(/*! ../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_14__ = __nested_webpack_require_1215317__(/*! ./vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_15__ = __nested_webpack_require_1215317__(/*! ../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _utils_RequestModifier__WEBPACK_IMPORTED_MODULE_16__ = __nested_webpack_require_1215317__(/*! ./utils/RequestModifier */ "./src/streaming/utils/RequestModifier.js");\n/* harmony import */ var _streaming_utils_URLUtils__WEBPACK_IMPORTED_MODULE_17__ = __nested_webpack_require_1215317__(/*! ../streaming/utils/URLUtils */ "./src/streaming/utils/URLUtils.js");\n/* harmony import */ var _utils_BoxParser__WEBPACK_IMPORTED_MODULE_18__ = __nested_webpack_require_1215317__(/*! ./utils/BoxParser */ "./src/streaming/utils/BoxParser.js");\n/* harmony import */ var _vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_19__ = __nested_webpack_require_1215317__(/*! ./vo/metrics/PlayList */ "./src/streaming/vo/metrics/PlayList.js");\n/* harmony import */ var _dash_controllers_SegmentsController__WEBPACK_IMPORTED_MODULE_20__ = __nested_webpack_require_1215317__(/*! ../dash/controllers/SegmentsController */ "./src/dash/controllers/SegmentsController.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_21__ = __nested_webpack_require_1215317__(/*! ./vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction StreamProcessor(config) {\n config = config || {};\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_10__["default"])(context).getInstance();\n var streamInfo = config.streamInfo;\n var type = config.type;\n var errHandler = config.errHandler;\n var mimeType = config.mimeType;\n var timelineConverter = config.timelineConverter;\n var adapter = config.adapter;\n var manifestModel = config.manifestModel;\n var mediaPlayerModel = config.mediaPlayerModel;\n var fragmentModel = config.fragmentModel;\n var abrController = config.abrController;\n var playbackController = config.playbackController;\n var mediaController = config.mediaController;\n var textController = config.textController;\n var dashMetrics = config.dashMetrics;\n var settings = config.settings;\n var boxParser = config.boxParser;\n var segmentBlacklistController = config.segmentBlacklistController;\n var instance, logger, isDynamic, mediaInfo, mediaInfoArr, bufferController, scheduleController, representationController, shouldUseExplicitTimeForRequest, qualityChangeInProgress, dashHandler, segmentsController, bufferingTime;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_15__["default"])(context).getInstance().getLogger(instance);\n resetInitialSettings();\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].DATA_UPDATE_COMPLETED, _onDataUpdateCompleted, instance, {\n priority: _core_EventBus__WEBPACK_IMPORTED_MODULE_10__["default"].EVENT_PRIORITY_HIGH\n }); // High priority to be notified before Stream\n\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].INIT_FRAGMENT_NEEDED, _onInitFragmentNeeded, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].MEDIA_FRAGMENT_NEEDED, _onMediaFragmentNeeded, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].MEDIA_FRAGMENT_LOADED, _onMediaFragmentLoaded, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFER_LEVEL_STATE_CHANGED, _onBufferLevelStateChanged, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFER_CLEARED, _onBufferCleared, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].SEEK_TARGET, _onSeekTarget, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].FRAGMENT_LOADING_ABANDONED, _onFragmentLoadingAbandoned, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].FRAGMENT_LOADING_COMPLETED, _onFragmentLoadingCompleted, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].QUOTA_EXCEEDED, _onQuotaExceeded, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].SET_FRAGMENTED_TEXT_AFTER_DISABLED, _onSetFragmentedTextAfterDisabled, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].SET_NON_FRAGMENTED_TEXT, _onSetNonFragmentedText, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].SOURCE_BUFFER_ERROR, _onSourceBufferError, instance);\n }\n\n function initialize(mediaSource, hasVideoTrack, isFragmented) {\n segmentsController = Object(_dash_controllers_SegmentsController__WEBPACK_IMPORTED_MODULE_20__["default"])(context).create({\n events: _core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"],\n eventBus: eventBus,\n streamInfo: streamInfo,\n timelineConverter: timelineConverter,\n dashConstants: _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"],\n segmentBaseController: config.segmentBaseController,\n type: type\n });\n dashHandler = Object(_dash_DashHandler__WEBPACK_IMPORTED_MODULE_12__["default"])(context).create({\n streamInfo: streamInfo,\n type: type,\n timelineConverter: timelineConverter,\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n baseURLController: config.baseURLController,\n errHandler: errHandler,\n segmentsController: segmentsController,\n settings: settings,\n boxParser: boxParser,\n events: _core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"],\n eventBus: eventBus,\n errors: _core_errors_Errors__WEBPACK_IMPORTED_MODULE_13__["default"],\n debug: Object(_core_Debug__WEBPACK_IMPORTED_MODULE_15__["default"])(context).getInstance(),\n requestModifier: Object(_utils_RequestModifier__WEBPACK_IMPORTED_MODULE_16__["default"])(context).getInstance(),\n dashConstants: _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"],\n constants: _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"],\n urlUtils: Object(_streaming_utils_URLUtils__WEBPACK_IMPORTED_MODULE_17__["default"])(context).getInstance()\n });\n isDynamic = streamInfo.manifestInfo.isDynamic; // Create/initialize controllers\n\n dashHandler.initialize(isDynamic);\n abrController.registerStreamType(type, instance);\n representationController = Object(_dash_controllers_RepresentationController__WEBPACK_IMPORTED_MODULE_7__["default"])(context).create({\n streamInfo: streamInfo,\n type: type,\n abrController: abrController,\n dashMetrics: dashMetrics,\n playbackController: playbackController,\n timelineConverter: timelineConverter,\n dashConstants: _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"],\n events: _core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"],\n eventBus: eventBus,\n errors: _core_errors_Errors__WEBPACK_IMPORTED_MODULE_13__["default"],\n isDynamic: isDynamic,\n segmentsController: segmentsController\n });\n bufferController = _createBufferControllerForType(type, isFragmented);\n\n if (bufferController) {\n bufferController.initialize(mediaSource);\n }\n\n scheduleController = Object(_controllers_ScheduleController__WEBPACK_IMPORTED_MODULE_6__["default"])(context).create({\n streamInfo: streamInfo,\n type: type,\n mimeType: mimeType,\n adapter: adapter,\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n fragmentModel: fragmentModel,\n abrController: abrController,\n playbackController: playbackController,\n textController: textController,\n mediaController: mediaController,\n bufferController: bufferController,\n settings: settings\n });\n scheduleController.initialize(hasVideoTrack);\n bufferingTime = 0;\n shouldUseExplicitTimeForRequest = false;\n }\n\n function getStreamId() {\n return streamInfo.id;\n }\n\n function getType() {\n return type;\n }\n\n function getIsTextTrack() {\n return adapter.getIsTextTrack(representationController.getData());\n }\n\n function resetInitialSettings() {\n mediaInfoArr = [];\n mediaInfo = null;\n bufferingTime = 0;\n shouldUseExplicitTimeForRequest = false;\n qualityChangeInProgress = false;\n }\n\n function reset(errored, keepBuffers) {\n if (dashHandler) {\n dashHandler.reset();\n }\n\n if (bufferController) {\n bufferController.reset(errored, keepBuffers);\n bufferController = null;\n }\n\n if (scheduleController) {\n scheduleController.reset();\n scheduleController = null;\n }\n\n if (representationController) {\n representationController.reset();\n representationController = null;\n }\n\n if (segmentsController) {\n segmentsController = null;\n }\n\n if (abrController) {\n abrController.unRegisterStreamType(getStreamId(), type);\n }\n\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].DATA_UPDATE_COMPLETED, _onDataUpdateCompleted, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].INIT_FRAGMENT_NEEDED, _onInitFragmentNeeded, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].MEDIA_FRAGMENT_NEEDED, _onMediaFragmentNeeded, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].MEDIA_FRAGMENT_LOADED, _onMediaFragmentLoaded, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFER_LEVEL_STATE_CHANGED, _onBufferLevelStateChanged, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFER_CLEARED, _onBufferCleared, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].SEEK_TARGET, _onSeekTarget, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].FRAGMENT_LOADING_ABANDONED, _onFragmentLoadingAbandoned, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].FRAGMENT_LOADING_COMPLETED, _onFragmentLoadingCompleted, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].SET_FRAGMENTED_TEXT_AFTER_DISABLED, _onSetFragmentedTextAfterDisabled, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].SET_NON_FRAGMENTED_TEXT, _onSetNonFragmentedText, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].QUOTA_EXCEEDED, _onQuotaExceeded, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].SOURCE_BUFFER_ERROR, _onSourceBufferError, instance);\n resetInitialSettings();\n type = null;\n streamInfo = null;\n }\n\n function isUpdating() {\n return representationController ? representationController.isUpdating() : false;\n }\n /**\n * When a seek within the corresponding period occurs this function initiates the clearing of the buffer and sets the correct buffering time.\n * @param {object} e\n * @private\n */\n\n\n function prepareInnerPeriodPlaybackSeeking(e) {\n return new Promise(function (resolve) {\n // Stop segment requests until we have figured out for which time we need to request a segment. We don\'t want to replace existing segments.\n scheduleController.clearScheduleTimer();\n fragmentModel.abortRequests(); // Abort operations to the SourceBuffer Sink and reset the BufferControllers isBufferingCompleted state.\n\n bufferController.prepareForPlaybackSeek().then(function () {\n // Clear the buffer. We need to prune everything which is not in the target interval.\n var clearRanges = bufferController.getAllRangesWithSafetyFactor(e.seekTime); // When everything has been pruned go on\n\n return bufferController.clearBuffers(clearRanges);\n }).then(function () {\n // Figure out the correct segment request time.\n var targetTime = bufferController.getContinuousBufferTimeForTargetTime(e.seekTime); // If the buffer is continuous and exceeds the duration of the period we are still done buffering. We need to trigger the buffering completed event in order to start prebuffering upcoming periods again\n\n if (!isNaN(streamInfo.duration) && isFinite(streamInfo.duration) && targetTime >= streamInfo.start + streamInfo.duration) {\n bufferController.setIsBufferingCompleted(true);\n resolve();\n } else {\n setExplicitBufferingTime(targetTime);\n bufferController.setSeekTarget(targetTime);\n var promises = []; // append window has been reset by abort() operation. Set the correct values again\n\n promises.push(bufferController.updateAppendWindow()); // Timestamp offset couldve been changed by preloading period\n\n var representationInfo = getRepresentationInfo();\n promises.push(bufferController.updateBufferTimestampOffset(representationInfo));\n Promise.all(promises).then(function () {\n // We might have aborted the append operation of an init segment. Append init segment again.\n scheduleController.setInitSegmentRequired(true); // Right after a seek we should not immediately check the playback quality\n\n scheduleController.setCheckPlaybackQuality(false);\n scheduleController.startScheduleTimer();\n resolve();\n });\n }\n })["catch"](function (e) {\n logger.error(e);\n });\n });\n }\n /**\n * Seek outside of the current period.\n * @return {Promise<unknown>}\n */\n\n\n function prepareOuterPeriodPlaybackSeeking() {\n return new Promise(function (resolve, reject) {\n try {\n // Stop scheduling\n scheduleController.clearScheduleTimer(); // Abort all ongoing requests\n\n fragmentModel.abortRequests(); // buffering not complete anymore and abort current append operation to SourceBuffer\n\n bufferController.prepareForPlaybackSeek().then(function () {\n // Clear the buffers completely.\n return bufferController.pruneAllSafely();\n }).then(function () {\n resolve();\n });\n } catch (e) {\n reject(e);\n }\n });\n }\n /**\n * ScheduleController indicates that an init segment needs to be fetched.\n * @param {object} e\n * @param {boolean} rescheduleIfNoRequest - Defines whether we reschedule in case no valid request could be generated\n * @private\n */\n\n\n function _onInitFragmentNeeded(e) {\n var rescheduleIfNoRequest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n // Event propagation may have been stopped (see MssHandler)\n if (!e.sender) return;\n\n if (playbackController.getIsManifestUpdateInProgress()) {\n _noValidRequest();\n\n return;\n }\n\n if (getIsTextTrack() && !textController.isTextEnabled()) return;\n\n if (bufferController && e.representationId) {\n if (!bufferController.appendInitSegmentFromCache(e.representationId)) {\n var rep = representationController.getCurrentRepresentation(); // Dummy init segment (fragmented tracks without initialization segment)\n\n if (rep.range === 0) {\n _onMediaFragmentNeeded();\n\n return;\n } // Init segment not in cache, send new request\n\n\n var request = dashHandler ? dashHandler.getInitRequest(mediaInfo, rep) : null;\n\n if (request) {\n fragmentModel.executeRequest(request);\n } else if (rescheduleIfNoRequest) {\n scheduleController.setInitSegmentRequired(true);\n\n _noValidRequest();\n }\n }\n }\n }\n /**\n * ScheduleController indicates that a media segment is needed\n * @param {boolean} rescheduleIfNoRequest - Defines whether we reschedule in case no valid request could be generated\n * @private\n */\n\n\n function _onMediaFragmentNeeded(e) {\n var rescheduleIfNoRequest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n\n // Don\'t schedule next fragments while updating manifest or pruning to avoid buffer inconsistencies\n if (playbackController.getIsManifestUpdateInProgress() || bufferController.getIsPruningInProgress()) {\n _noValidRequest();\n\n return;\n }\n\n var request = _getFragmentRequest();\n\n if (request) {\n shouldUseExplicitTimeForRequest = false;\n\n _mediaRequestGenerated(request);\n } else {\n _noMediaRequestGenerated(rescheduleIfNoRequest);\n }\n }\n /**\n * If we generated a valid media request we can execute the request. In some cases the segment might be blacklisted.\n * @param {object} request\n * @private\n */\n\n\n function _mediaRequestGenerated(request) {\n if (!isNaN(request.startTime + request.duration)) {\n bufferingTime = request.startTime + request.duration;\n }\n\n request.delayLoadingTime = new Date().getTime() + scheduleController.getTimeToLoadDelay();\n scheduleController.setTimeToLoadDelay(0);\n\n if (!_shouldIgnoreRequest(request)) {\n logger.debug("Next fragment request url for stream id ".concat(streamInfo.id, " and media type ").concat(type, " is ").concat(request.url));\n fragmentModel.executeRequest(request);\n } else {\n logger.warn("Fragment request url ".concat(request.url, " for stream id ").concat(streamInfo.id, " and media type ").concat(type, " is on the ignore list and will be skipped"));\n\n _noValidRequest();\n }\n }\n /**\n * We could not generate a valid request. Check if the media is finished, we are stuck in a gap or simply need to wait for the next segment to be available.\n * @param {boolean} rescheduleIfNoRequest\n * @private\n */\n\n\n function _noMediaRequestGenerated(rescheduleIfNoRequest) {\n var representation = representationController.getCurrentRepresentation(); // If this statement is true we are stuck. A static manifest does not change and we did not find a valid request for the target time\n // There is no point in trying again. We need to adjust the time in order to find a valid request. This can happen if the user/app seeked into a gap.\n\n if (settings.get().streaming.gaps.enableSeekFix && !isDynamic && shouldUseExplicitTimeForRequest && playbackController.isSeeking()) {\n var adjustedTime = dashHandler.getValidSeekTimeCloseToTargetTime(bufferingTime, mediaInfo, representation, settings.get().streaming.gaps.threshold);\n\n if (!isNaN(adjustedTime)) {\n playbackController.seek(adjustedTime, false, false);\n return;\n }\n } // Check if the media is finished. If so, no need to schedule another request\n\n\n var isLastSegmentRequested = dashHandler.isLastSegmentRequested(representation, bufferingTime);\n\n if (isLastSegmentRequested) {\n var segmentIndex = dashHandler.getCurrentIndex();\n logger.debug("Segment requesting for stream ".concat(streamInfo.id, " has finished"));\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].STREAM_REQUESTING_COMPLETED, {\n segmentIndex: segmentIndex\n }, {\n streamId: streamInfo.id,\n mediaType: type\n });\n bufferController.segmentRequestingCompleted(segmentIndex);\n scheduleController.clearScheduleTimer();\n return;\n }\n\n if (rescheduleIfNoRequest) {\n _noValidRequest();\n }\n }\n /**\n * In certain situations we need to ignore a request. For instance, if a segment is blacklisted because it caused an MSE error.\n * @private\n */\n\n\n function _shouldIgnoreRequest(request) {\n var blacklistUrl = request.url;\n\n if (request.range) {\n blacklistUrl = blacklistUrl.concat(\'_\', request.range);\n }\n\n return segmentBlacklistController.contains(blacklistUrl);\n }\n /**\n * Get the init or media segment request using the DashHandler.\n * @return {null|FragmentRequest|null}\n * @private\n */\n\n\n function _getFragmentRequest() {\n var representationInfo = getRepresentationInfo();\n var request;\n\n if (isNaN(bufferingTime) || getType() === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT && !textController.isTextEnabled()) {\n return null;\n } // Use time just whenever is strictly needed\n\n\n var useTime = shouldUseExplicitTimeForRequest;\n\n if (dashHandler) {\n var representation = representationController && representationInfo ? representationController.getRepresentationForQuality(representationInfo.quality) : null;\n\n if (useTime) {\n request = dashHandler.getSegmentRequestForTime(mediaInfo, representation, bufferingTime);\n } else {\n request = dashHandler.getNextSegmentRequest(mediaInfo, representation);\n }\n }\n\n return request;\n }\n /**\n * Whenever we can not generate a valid request we restart scheduling according to the timeouts defined in the settings.\n * @private\n */\n\n\n function _noValidRequest() {\n scheduleController.startScheduleTimer(settings.get().streaming.lowLatencyEnabled ? settings.get().streaming.scheduling.lowLatencyTimeout : settings.get().streaming.scheduling.defaultTimeout);\n }\n\n function _onDataUpdateCompleted(e) {\n if (!e.error) {\n // Update representation if no error\n scheduleController.setCurrentRepresentation(adapter.convertRepresentationToRepresentationInfo(e.currentRepresentation));\n\n if (!bufferController.getIsBufferingCompleted()) {\n bufferController.updateBufferTimestampOffset(e.currentRepresentation);\n }\n }\n }\n\n function _onBufferLevelStateChanged(e) {\n dashMetrics.addBufferState(type, e.state, scheduleController.getBufferTarget());\n\n if (e.state === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_2__["default"].BUFFER_EMPTY && !playbackController.isSeeking()) {\n logger.info(\'Buffer is empty! Stalling!\');\n dashMetrics.pushPlayListTraceMetrics(new Date(), _vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_19__["PlayListTrace"].REBUFFERING_REASON);\n }\n }\n\n function _onBufferCleared(e) {\n // Remove executed requests not buffered anymore\n fragmentModel.syncExecutedRequestsWithBufferedRange(bufferController.getBuffer().getAllBufferRanges(), streamInfo.duration); // If buffer removed ahead current time (QuotaExceededError or automatic buffer pruning) then adjust current index handler time\n\n if (e.quotaExceeded && e.from > playbackController.getTime()) {\n setExplicitBufferingTime(e.from);\n } // (Re)start schedule once buffer has been pruned after a QuotaExceededError\n\n\n if (e.hasEnoughSpaceToAppend && e.quotaExceeded) {\n scheduleController.startScheduleTimer();\n }\n }\n /**\n * This function is called when the corresponding SourceBuffer encountered an error.\n * We blacklist the last segment assuming it caused the error\n * @param {object} e\n * @private\n */\n\n\n function _onSourceBufferError(e) {\n if (!e || !e.lastRequestAppended || !e.lastRequestAppended.url) {\n return;\n }\n\n var blacklistUrl = e.lastRequestAppended.url;\n\n if (e.lastRequestAppended.range) {\n blacklistUrl = blacklistUrl.concat(\'_\', e.lastRequestAppended.range);\n }\n\n logger.warn("Blacklisting segment with url ".concat(blacklistUrl));\n segmentBlacklistController.add(blacklistUrl);\n }\n /**\n * The quality has changed which means we have switched to a different representation.\n * If we want to aggressively replace existing parts in the buffer we need to make sure that the new quality is higher than the already buffered one.\n * @param {object} e\n * @private\n */\n\n\n function prepareQualityChange(e) {\n logger.debug("Preparing quality switch for type ".concat(type));\n var newQuality = e.newQuality;\n qualityChangeInProgress = true; // Stop scheduling until we are done with preparing the quality switch\n\n scheduleController.clearScheduleTimer();\n var representationInfo = getRepresentationInfo(newQuality);\n scheduleController.setCurrentRepresentation(representationInfo);\n representationController.prepareQualityChange(newQuality); // Abort the current request to avoid inconsistencies. A quality switch can also be triggered manually by the application.\n // If we update the buffer values now, or initialize a request to the new init segment, the currently downloading media segment might "work" with wrong values.\n // Everything that is already in the buffer queue is ok and will be handled by the corresponding function below depending on the switch mode.\n\n fragmentModel.abortRequests(); // In any case we need to update the MSE.timeOffset\n\n bufferController.updateBufferTimestampOffset(representationInfo).then(function () {\n // If the switch should occur immediately we need to replace existing stuff in the buffer\n if (e.reason && e.reason.forceReplace) {\n _prepareReplacementQualitySwitch();\n } // If fast switch is enabled we check if we are supposed to replace existing stuff in the buffer\n else if (settings.get().streaming.buffer.fastSwitchEnabled) {\n _prepareForFastQualitySwitch(representationInfo);\n } // Default quality switch. We append the new quality to the already buffered stuff\n else {\n _prepareForDefaultQualitySwitch();\n }\n\n dashMetrics.pushPlayListTraceMetrics(new Date(), _vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_19__["PlayListTrace"].REPRESENTATION_SWITCH_STOP_REASON);\n dashMetrics.createPlaylistTraceMetrics(representationInfo.id, playbackController.getTime() * 1000, playbackController.getPlaybackRate());\n });\n }\n\n function _prepareReplacementQualitySwitch() {\n // Inform other classes like the GapController that we are replacing existing stuff\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFER_REPLACEMENT_STARTED, {\n mediaType: type,\n streamId: streamInfo.id\n }, {\n mediaType: type,\n streamId: streamInfo.id\n }); // Abort appending segments to the buffer. Also adjust the appendWindow as we might have been in the progress of prebuffering stuff.\n\n bufferController.prepareForReplacementQualitySwitch().then(function () {\n _bufferClearedForReplacement();\n\n qualityChangeInProgress = false;\n })["catch"](function () {\n _bufferClearedForReplacement();\n\n qualityChangeInProgress = false;\n });\n }\n\n function _prepareForFastQualitySwitch(representationInfo) {\n // if we switch up in quality and need to replace existing parts in the buffer we need to adjust the buffer target\n var time = playbackController.getTime();\n var safeBufferLevel = 1.5;\n var request = fragmentModel.getRequests({\n state: _models_FragmentModel__WEBPACK_IMPORTED_MODULE_3__["default"].FRAGMENT_MODEL_EXECUTED,\n time: time + safeBufferLevel,\n threshold: 0\n })[0];\n\n if (request && !getIsTextTrack()) {\n var bufferLevel = bufferController.getBufferLevel();\n var abandonmentState = abrController.getAbandonmentStateFor(streamInfo.id, type);\n\n if (request.quality < representationInfo.quality && bufferLevel >= safeBufferLevel && abandonmentState !== _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_2__["default"].ABANDON_LOAD) {\n var targetTime = time + safeBufferLevel;\n setExplicitBufferingTime(targetTime);\n scheduleController.setCheckPlaybackQuality(false);\n scheduleController.startScheduleTimer();\n } else {\n _prepareForDefaultQualitySwitch();\n }\n } else {\n scheduleController.startScheduleTimer();\n }\n\n qualityChangeInProgress = false;\n }\n\n function _prepareForDefaultQualitySwitch() {\n // We might have aborted the current request. We need to set an explicit buffer time based on what we already have in the buffer.\n _bufferClearedForNonReplacement();\n\n qualityChangeInProgress = false;\n }\n /**\n * We have canceled the download of a fragment and need to adjust the buffer time or reload an init segment\n * @param {object} e\n */\n\n\n function _onFragmentLoadingAbandoned(e) {\n logger.info(\'onFragmentLoadingAbandoned request: \' + e.request.url + \' has been aborted\'); // we only need to handle this if we are not seeking, not switching the tracks and not switching the quality\n\n if (!playbackController.isSeeking() && !scheduleController.getSwitchStrack() && !qualityChangeInProgress) {\n logger.info(\'onFragmentLoadingAbandoned request: \' + e.request.url + \' has to be downloaded again, origin is not seeking process or switch track call\'); // in case of an init segment we force the download of an init segment\n\n if (e.request && e.request.isInitializationRequest()) {\n scheduleController.setInitSegmentRequired(true);\n } // in case of a media segment we reset the buffering time\n else {\n setExplicitBufferingTime(e.request.startTime + e.request.duration / 2);\n } // In case of a seek the schedule controller was stopped and will be started once the buffer has been pruned.\n\n\n scheduleController.startScheduleTimer(0);\n }\n }\n /**\n * When a fragment has been loaded we need to start the schedule timer again in case of an error.\n * @param {object} e\n */\n\n\n function _onFragmentLoadingCompleted(e) {\n logger.info(\'OnFragmentLoadingCompleted for stream id \' + streamInfo.id + \' and media type \' + type + \' - Url:\', e.request ? e.request.url : \'undefined\', e.request.range ? \', Range:\' + e.request.range : \'\');\n\n if (getIsTextTrack()) {\n scheduleController.startScheduleTimer(0);\n }\n\n if (e.error && e.request.serviceLocation) {\n _handleFragmentLoadingError(e);\n }\n }\n /**\n * If we encountered an error when loading the fragment we need to handle it according to the segment type\n * @private\n */\n\n\n function _handleFragmentLoadingError(e) {\n logger.info("Fragment loading completed with an error");\n\n if (!e || !e.request || !e.request.type) {\n return;\n } // In case there are baseUrls that can still be tried a valid request can be generated. If no valid request can be generated we ran out of baseUrls.\n // Consequently, we need to signal that we dont want to retry in case no valid request could be generated otherwise we keep trying with the same url infinitely.\n // Init segment could not be loaded. If we have multiple baseUrls we still have a chance to get a valid segment.\n\n\n if (e.request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_21__["HTTPRequest"].INIT_SEGMENT_TYPE) {\n _onInitFragmentNeeded({\n representationId: e.request.representationId,\n sender: {}\n }, false);\n } // Media segment could not be loaded\n else if (e.request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_21__["HTTPRequest"].MEDIA_SEGMENT_TYPE) {\n setExplicitBufferingTime(e.request.startTime + e.request.duration / 2);\n\n _onMediaFragmentNeeded({}, false);\n }\n }\n /**\n * Callback function triggered by the TextController whenever a track is changed for fragmented text. Will only be triggered if textracks have previously been disabled.\n * @private\n */\n\n\n function _onSetFragmentedTextAfterDisabled() {\n setExplicitBufferingTime(playbackController.getTime());\n getScheduleController().startScheduleTimer();\n }\n /**\n * Callback function triggered by the TextController whenever a track is changed for non fragmented text\n * @param {object} e\n * @private\n */\n\n\n function _onSetNonFragmentedText(e) {\n var currentTrackInfo = e.currentTrackInfo;\n\n if (!currentTrackInfo) {\n return;\n }\n\n var mInfo = mediaInfoArr.find(function (info) {\n return info.index === currentTrackInfo.index && info.lang === currentTrackInfo.lang;\n });\n\n if (mInfo) {\n selectMediaInfo(mInfo).then(function () {\n bufferController.setIsBufferingCompleted(false);\n setExplicitBufferingTime(playbackController.getTime());\n scheduleController.setInitSegmentRequired(true);\n scheduleController.startScheduleTimer();\n });\n }\n }\n\n function _onQuotaExceeded(e) {\n // Stop scheduler (will be restarted once buffer is pruned)\n setExplicitBufferingTime(e.quotaExceededTime);\n scheduleController.clearScheduleTimer();\n }\n\n function getRepresentationController() {\n return representationController;\n }\n\n function getBuffer() {\n return bufferController ? bufferController.getBuffer() : null;\n }\n\n function getBufferController() {\n return bufferController;\n }\n\n function getFragmentModel() {\n return fragmentModel;\n }\n\n function updateStreamInfo(newStreamInfo) {\n streamInfo = newStreamInfo;\n\n if (!isBufferingCompleted()) {\n return bufferController.updateAppendWindow();\n }\n\n return Promise.resolve();\n }\n\n function getStreamInfo() {\n return streamInfo;\n }\n /**\n * Called once the StreamProcessor is initialized and when the track is switched. We only have one StreamProcessor per media type. So we need to adjust the mediaInfo once we switch/select a track.\n * @param {object} newMediaInfo\n */\n\n\n function selectMediaInfo(newMediaInfo) {\n if (newMediaInfo !== mediaInfo && (!newMediaInfo || !mediaInfo || newMediaInfo.type === mediaInfo.type)) {\n mediaInfo = newMediaInfo;\n }\n\n var newRealAdaptation = adapter.getRealAdaptation(streamInfo, mediaInfo);\n var voRepresentations = adapter.getVoRepresentations(mediaInfo);\n\n if (representationController) {\n var realAdaptation = representationController.getData();\n var maxQuality = abrController.getMaxAllowedIndexFor(type, streamInfo.id);\n var minIdx = abrController.getMinAllowedIndexFor(type, streamInfo.id);\n var quality, averageThroughput;\n var bitrate = null;\n\n if ((realAdaptation === null || realAdaptation.id !== newRealAdaptation.id) && type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT) {\n averageThroughput = abrController.getThroughputHistory().getAverageThroughput(type, isDynamic);\n bitrate = averageThroughput || abrController.getInitialBitrateFor(type, streamInfo.id);\n quality = abrController.getQualityForBitrate(mediaInfo, bitrate, streamInfo.id);\n } else {\n quality = abrController.getQualityFor(type, streamInfo.id);\n }\n\n if (minIdx !== undefined && quality < minIdx) {\n quality = minIdx;\n }\n\n if (quality > maxQuality) {\n quality = maxQuality;\n }\n\n return representationController.updateData(newRealAdaptation, voRepresentations, type, mediaInfo.isFragmented, quality);\n } else {\n return Promise.resolve();\n }\n }\n\n function addMediaInfo(newMediaInfo) {\n if (mediaInfoArr.indexOf(newMediaInfo) === -1) {\n mediaInfoArr.push(newMediaInfo);\n }\n }\n\n function clearMediaInfoArray() {\n mediaInfoArr = [];\n }\n\n function getMediaInfo() {\n return mediaInfo;\n }\n\n function getMediaSource() {\n return bufferController.getMediaSource();\n }\n\n function setMediaSource(mediaSource) {\n bufferController.setMediaSource(mediaSource);\n }\n\n function getScheduleController() {\n return scheduleController;\n }\n /**\n * Get a specific voRepresentation. If quality parameter is defined, this function will return the voRepresentation for this quality.\n * Otherwise, this function will return the current voRepresentation used by the representationController.\n * @param {number} quality - quality index of the voRepresentaion expected.\n */\n\n\n function getRepresentationInfo(quality) {\n var voRepresentation;\n\n if (quality !== undefined) {\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_9__["checkInteger"])(quality);\n voRepresentation = representationController ? representationController.getRepresentationForQuality(quality) : null;\n } else {\n voRepresentation = representationController ? representationController.getCurrentRepresentation() : null;\n }\n\n return adapter.convertRepresentationToRepresentationInfo(voRepresentation);\n }\n\n function isBufferingCompleted() {\n return bufferController ? bufferController.getIsBufferingCompleted() : false;\n }\n\n function getBufferLevel() {\n return bufferController ? bufferController.getBufferLevel() : 0;\n }\n /**\n * Probe the next request. This is used in the CMCD model to get information about the upcoming request. Note: No actual request is performed here.\n * @return {FragmentRequest|null}\n */\n\n\n function probeNextRequest() {\n var representationInfo = getRepresentationInfo();\n var representation = representationController && representationInfo ? representationController.getRepresentationForQuality(representationInfo.quality) : null;\n var request = dashHandler.getNextSegmentRequestIdempotent(mediaInfo, representation);\n return request;\n }\n\n function _onMediaFragmentLoaded(e) {\n var chunk = e.chunk;\n var bytes = chunk.bytes;\n var quality = chunk.quality;\n var currentRepresentation = getRepresentationInfo(quality);\n var voRepresentation = representationController && currentRepresentation ? representationController.getRepresentationForQuality(currentRepresentation.quality) : null; // If we switch tracks this event might be fired after the representations in the RepresentationController have been updated according to the new MediaInfo.\n // In this case there will be no currentRepresentation and voRepresentation matching the "old" quality\n\n if (currentRepresentation && voRepresentation) {\n var eventStreamMedia = adapter.getEventsFor(currentRepresentation.mediaInfo);\n var eventStreamTrack = adapter.getEventsFor(currentRepresentation, voRepresentation);\n\n if (eventStreamMedia && eventStreamMedia.length > 0 || eventStreamTrack && eventStreamTrack.length > 0) {\n var request = fragmentModel.getRequests({\n state: _models_FragmentModel__WEBPACK_IMPORTED_MODULE_3__["default"].FRAGMENT_MODEL_EXECUTED,\n quality: quality,\n index: chunk.index\n })[0];\n\n var events = _handleInbandEvents(bytes, request, eventStreamMedia, eventStreamTrack);\n\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].INBAND_EVENTS, {\n events: events\n }, {\n streamId: streamInfo.id\n });\n }\n }\n }\n\n function _handleInbandEvents(data, request, mediaInbandEvents, trackInbandEvents) {\n try {\n var eventStreams = {};\n var events = [];\n /* Extract the possible schemeIdUri : If a DASH client detects an event message box with a scheme that is not defined in MPD, the client is expected to ignore it */\n\n var inbandEvents = mediaInbandEvents.concat(trackInbandEvents);\n\n for (var i = 0, ln = inbandEvents.length; i < ln; i++) {\n eventStreams[inbandEvents[i].schemeIdUri + \'/\' + inbandEvents[i].value] = inbandEvents[i];\n }\n\n var isoFile = Object(_utils_BoxParser__WEBPACK_IMPORTED_MODULE_18__["default"])(context).getInstance().parse(data);\n var eventBoxes = isoFile.getBoxes(\'emsg\');\n\n if (!eventBoxes || eventBoxes.length === 0) {\n return events;\n }\n\n var sidx = isoFile.getBox(\'sidx\');\n var mediaAnchorTime = sidx && !isNaN(sidx.earliest_presentation_time) && !isNaN(sidx.timescale) ? sidx.earliest_presentation_time / sidx.timescale : request && !isNaN(request.mediaStartTime) ? request.mediaStartTime : 0;\n var fragmentMediaStartTime = Math.max(mediaAnchorTime, 0);\n var voRepresentation = representationController.getCurrentRepresentation();\n\n for (var _i = 0, _ln = eventBoxes.length; _i < _ln; _i++) {\n var event = adapter.getEvent(eventBoxes[_i], eventStreams, fragmentMediaStartTime, voRepresentation);\n\n if (event) {\n events.push(event);\n }\n }\n\n return events;\n } catch (e) {\n return [];\n }\n }\n\n function createBufferSinks(previousBufferSinks) {\n var buffer = getBuffer();\n\n if (buffer) {\n return Promise.resolve(buffer);\n }\n\n return bufferController ? bufferController.createBufferSink(mediaInfo, previousBufferSinks) : Promise.resolve(null);\n }\n\n function prepareTrackSwitch() {\n return new Promise(function (resolve) {\n logger.debug("Preparing track switch for type ".concat(type));\n var shouldReplace = type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT || settings.get().streaming.trackSwitchMode[type] === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TRACK_SWITCH_MODE_ALWAYS_REPLACE && playbackController.getTimeToStreamEnd(streamInfo) > settings.get().streaming.buffer.stallThreshold; // when buffering is completed and we are not supposed to replace anything do nothing.\n // Still we need to trigger preloading again and call change type in case user seeks back before transitioning to next period\n\n if (bufferController.getIsBufferingCompleted() && !shouldReplace) {\n bufferController.prepareForNonReplacementTrackSwitch(mediaInfo.codec).then(function () {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFERING_COMPLETED, {}, {\n streamId: streamInfo.id,\n mediaType: type\n });\n })["catch"](function () {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFERING_COMPLETED, {}, {\n streamId: streamInfo.id,\n mediaType: type\n });\n });\n resolve();\n return;\n } // We stop the schedule controller and signal a track switch. That way we request a new init segment next\n\n\n scheduleController.clearScheduleTimer();\n scheduleController.setSwitchTrack(true); // when we are supposed to replace it does not matter if buffering is already completed\n\n if (shouldReplace) {\n // Inform other classes like the GapController that we are replacing existing stuff\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFER_REPLACEMENT_STARTED, {\n mediaType: type,\n streamId: streamInfo.id\n }, {\n mediaType: type,\n streamId: streamInfo.id\n }); // Abort the current request it will be removed from the buffer anyways\n\n fragmentModel.abortRequests(); // Abort appending segments to the buffer. Also adjust the appendWindow as we might have been in the progress of prebuffering stuff.\n\n bufferController.prepareForReplacementTrackSwitch(mediaInfo.codec).then(function () {\n // Timestamp offset couldve been changed by preloading period\n var representationInfo = getRepresentationInfo();\n return bufferController.updateBufferTimestampOffset(representationInfo);\n }).then(function () {\n _bufferClearedForReplacement();\n\n resolve();\n })["catch"](function () {\n _bufferClearedForReplacement();\n\n resolve();\n });\n } else {\n // We do not replace anything that is already in the buffer. Still we need to prepare the buffer for the track switch\n bufferController.prepareForNonReplacementTrackSwitch(mediaInfo.codec).then(function () {\n _bufferClearedForNonReplacement();\n\n resolve();\n })["catch"](function () {\n _bufferClearedForNonReplacement();\n\n resolve();\n });\n }\n });\n }\n /**\n * For an instant track switch we need to adjust the buffering time after the buffer has been pruned.\n * @private\n */\n\n\n function _bufferClearedForReplacement() {\n var targetTime = playbackController.getTime();\n\n if (settings.get().streaming.buffer.flushBufferAtTrackSwitch) {\n // For some devices (like chromecast) it is necessary to seek the video element to reset the internal decoding buffer,\n // otherwise audio track switch will be effective only once after previous buffered track is consumed\n playbackController.seek(targetTime + 0.001, false, true);\n }\n\n setExplicitBufferingTime(targetTime);\n bufferController.setSeekTarget(targetTime);\n scheduleController.startScheduleTimer();\n }\n\n function _bufferClearedForNonReplacement() {\n var time = playbackController.getTime();\n var targetTime = bufferController.getContinuousBufferTimeForTargetTime(time);\n setExplicitBufferingTime(targetTime);\n scheduleController.startScheduleTimer();\n }\n\n function _createBufferControllerForType(type, isFragmented) {\n var controller = null;\n\n if (!type) {\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_14__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_13__["default"].MEDIASOURCE_TYPE_UNSUPPORTED_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_13__["default"].MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE + \'not properly defined\'));\n return null;\n }\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT && !isFragmented) {\n controller = Object(_text_NotFragmentedTextBufferController__WEBPACK_IMPORTED_MODULE_5__["default"])(context).create({\n streamInfo: streamInfo,\n type: type,\n mimeType: mimeType,\n fragmentModel: fragmentModel,\n textController: textController,\n errHandler: errHandler,\n settings: settings\n });\n } else {\n controller = Object(_controllers_BufferController__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create({\n streamInfo: streamInfo,\n type: type,\n mediaPlayerModel: mediaPlayerModel,\n manifestModel: manifestModel,\n fragmentModel: fragmentModel,\n errHandler: errHandler,\n mediaController: mediaController,\n representationController: representationController,\n adapter: adapter,\n textController: textController,\n abrController: abrController,\n playbackController: playbackController,\n settings: settings\n });\n }\n\n return controller;\n }\n\n function _onSeekTarget(e) {\n if (e && !isNaN(e.time)) {\n setExplicitBufferingTime(e.time);\n bufferController.setSeekTarget(e.time);\n }\n }\n\n function setExplicitBufferingTime(value) {\n bufferingTime = value;\n shouldUseExplicitTimeForRequest = true;\n }\n\n function finalisePlayList(time, reason) {\n dashMetrics.pushPlayListTraceMetrics(time, reason);\n }\n\n instance = {\n initialize: initialize,\n getStreamId: getStreamId,\n getType: getType,\n isUpdating: isUpdating,\n getBufferController: getBufferController,\n getFragmentModel: getFragmentModel,\n getScheduleController: getScheduleController,\n getRepresentationController: getRepresentationController,\n getRepresentationInfo: getRepresentationInfo,\n getBufferLevel: getBufferLevel,\n isBufferingCompleted: isBufferingCompleted,\n createBufferSinks: createBufferSinks,\n updateStreamInfo: updateStreamInfo,\n getStreamInfo: getStreamInfo,\n selectMediaInfo: selectMediaInfo,\n clearMediaInfoArray: clearMediaInfoArray,\n addMediaInfo: addMediaInfo,\n prepareTrackSwitch: prepareTrackSwitch,\n prepareQualityChange: prepareQualityChange,\n getMediaInfo: getMediaInfo,\n getMediaSource: getMediaSource,\n setMediaSource: setMediaSource,\n getBuffer: getBuffer,\n setExplicitBufferingTime: setExplicitBufferingTime,\n finalisePlayList: finalisePlayList,\n probeNextRequest: probeNextRequest,\n prepareInnerPeriodPlaybackSeeking: prepareInnerPeriodPlaybackSeeking,\n prepareOuterPeriodPlaybackSeeking: prepareOuterPeriodPlaybackSeeking,\n reset: reset\n };\n setup();\n return instance;\n}\n\nStreamProcessor.__dashjs_factory_name = \'StreamProcessor\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_8__["default"].getClassFactory(StreamProcessor));\n\n/***/ }),\n\n/***/ "./src/streaming/XlinkLoader.js":\n/*!**************************************!*\\\n !*** ./src/streaming/XlinkLoader.js ***!\n \\**************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1267704__) {\n__nested_webpack_require_1267704__.r(__nested_webpack_exports__);\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1267704__(/*! ./vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _net_URLLoader__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1267704__(/*! ./net/URLLoader */ "./src/streaming/net/URLLoader.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1267704__(/*! ./vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _vo_TextRequest__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1267704__(/*! ./vo/TextRequest */ "./src/streaming/vo/TextRequest.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1267704__(/*! ../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1267704__(/*! ../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1267704__(/*! ../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1267704__(/*! ../core/errors/Errors */ "./src/core/errors/Errors.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\nfunction XlinkLoader(config) {\n config = config || {};\n var RESOLVE_TO_ZERO = \'urn:mpeg:dash:resolve-to-zero:2013\';\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n var urlLoader = Object(_net_URLLoader__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create({\n errHandler: config.errHandler,\n dashMetrics: config.dashMetrics,\n mediaPlayerModel: config.mediaPlayerModel,\n requestModifier: config.requestModifier,\n errors: _core_errors_Errors__WEBPACK_IMPORTED_MODULE_7__["default"]\n });\n var instance;\n\n function load(url, element, resolveObject) {\n var report = function report(content, resolveToZero) {\n element.resolved = true;\n element.resolvedContent = content ? content : null;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].XLINK_ELEMENT_LOADED, {\n element: element,\n resolveObject: resolveObject,\n error: content || resolveToZero ? null : new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_0__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_7__["default"].XLINK_LOADER_LOADING_FAILURE_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_7__["default"].XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE + url)\n });\n };\n\n if (url === RESOLVE_TO_ZERO) {\n report(null, true);\n } else {\n var request = new _vo_TextRequest__WEBPACK_IMPORTED_MODULE_3__["default"](url, _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].XLINK_EXPANSION_TYPE);\n urlLoader.load({\n request: request,\n success: function success(data) {\n report(data);\n },\n error: function error() {\n report(null);\n }\n });\n }\n }\n\n function reset() {\n if (urlLoader) {\n urlLoader.abort();\n urlLoader = null;\n }\n }\n\n instance = {\n load: load,\n reset: reset\n };\n return instance;\n}\n\nXlinkLoader.__dashjs_factory_name = \'XlinkLoader\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_6__["default"].getClassFactory(XlinkLoader));\n\n/***/ }),\n\n/***/ "./src/streaming/constants/ConformanceViolationConstants.js":\n/*!******************************************************************!*\\\n !*** ./src/streaming/constants/ConformanceViolationConstants.js ***!\n \\******************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1273394__) {\n__nested_webpack_require_1273394__.r(__nested_webpack_exports__);\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n/* harmony default export */ __nested_webpack_exports__["default"] = ({\n LEVELS: {\n SUGGESTION: \'Suggestion\',\n WARNING: \'Warning\',\n ERROR: \'Error\'\n },\n EVENTS: {\n NO_UTC_TIMING_ELEMENT: {\n key: \'NO_UTC_TIMING_ELEMENT\',\n message: \'No UTCTiming element is present in the manifest. You may experience playback failures. For a detailed validation use https://conformance.dashif.org/\'\n },\n NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE: {\n key: \'NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE\',\n message: \'SMPTE 2052-1:2013 defines the attribute name as "imageType" and does not define "imagetype"\'\n },\n INVALID_DVR_WINDOW: {\n key: \'INVALID_DVR_WINDOW\',\n message: \'No valid segment found when applying a specification compliant DVR window calculation. Using SegmentTimeline entries as a fallback.\'\n }\n }\n});\n\n/***/ }),\n\n/***/ "./src/streaming/constants/Constants.js":\n/*!**********************************************!*\\\n !*** ./src/streaming/constants/Constants.js ***!\n \\**********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1276424__) {\n__nested_webpack_require_1276424__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Constants declaration\n * @class\n * @ignore\n * @hideconstructor\n */\nvar Constants = /*#__PURE__*/function () {\n function Constants() {\n _classCallCheck(this, Constants);\n\n this.init();\n }\n\n _createClass(Constants, [{\n key: "init",\n value: function init() {\n /**\n * @constant {string} STREAM Stream media type. Mainly used to report metrics relative to the full stream\n * @memberof Constants#\n * @static\n */\n this.STREAM = \'stream\';\n /**\n * @constant {string} VIDEO Video media type\n * @memberof Constants#\n * @static\n */\n\n this.VIDEO = \'video\';\n /**\n * @constant {string} AUDIO Audio media type\n * @memberof Constants#\n * @static\n */\n\n this.AUDIO = \'audio\';\n /**\n * @constant {string} TEXT Text media type\n * @memberof Constants#\n * @static\n */\n\n this.TEXT = \'text\';\n /**\n * @constant {string} MUXED Muxed (video/audio in the same chunk) media type\n * @memberof Constants#\n * @static\n */\n\n this.MUXED = \'muxed\';\n /**\n * @constant {string} IMAGE Image media type\n * @memberof Constants#\n * @static\n */\n\n this.IMAGE = \'image\';\n /**\n * @constant {string} STPP STTP Subtitles format\n * @memberof Constants#\n * @static\n */\n\n this.STPP = \'stpp\';\n /**\n * @constant {string} TTML STTP Subtitles format\n * @memberof Constants#\n * @static\n */\n\n this.TTML = \'ttml\';\n /**\n * @constant {string} VTT STTP Subtitles format\n * @memberof Constants#\n * @static\n */\n\n this.VTT = \'vtt\';\n /**\n * @constant {string} WVTT STTP Subtitles format\n * @memberof Constants#\n * @static\n */\n\n this.WVTT = \'wvtt\';\n /**\n * @constant {string} ABR_STRATEGY_DYNAMIC Dynamic Adaptive bitrate algorithm\n * @memberof Constants#\n * @static\n */\n\n this.ABR_STRATEGY_DYNAMIC = \'abrDynamic\';\n /**\n * @constant {string} ABR_STRATEGY_BOLA Adaptive bitrate algorithm based on Bola (buffer level)\n * @memberof Constants#\n * @static\n */\n\n this.ABR_STRATEGY_BOLA = \'abrBola\';\n /**\n * @constant {string} ABR_STRATEGY_L2A Adaptive bitrate algorithm based on L2A (online learning)\n * @memberof Constants#\n * @static\n */\n\n this.ABR_STRATEGY_L2A = \'abrL2A\';\n /**\n * @constant {string} ABR_STRATEGY_LoLP Adaptive bitrate algorithm based on LoL+\n * @memberof Constants#\n * @static\n */\n\n this.ABR_STRATEGY_LoLP = \'abrLoLP\';\n /**\n * @constant {string} ABR_STRATEGY_THROUGHPUT Adaptive bitrate algorithm based on throughput\n * @memberof Constants#\n * @static\n */\n\n this.ABR_STRATEGY_THROUGHPUT = \'abrThroughput\';\n /**\n * @constant {string} ABR_FETCH_THROUGHPUT_CALUCUALTION_DOWNLOADED_DATA Throughput calculation based on downloaded data array\n * @memberof Constants#\n * @static\n */\n\n this.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA = \'abrFetchThroughputCalculationDownloadedData\';\n /**\n * @constant {string} ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING Throughput calculation based on moof parsing\n * @memberof Constants#\n * @static\n */\n\n this.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING = \'abrFetchThroughputCalculationMoofParsing\';\n /**\n * @constant {string} ABR_FETCH_THROUGHPUT_CALCULATION_AAST Throughput calculation based on adjusted availability start time in low latency mode\n * @memberof Constants#\n * @static\n */\n\n this.ABR_FETCH_THROUGHPUT_CALCULATION_AAST = \'abrFetchThroughputCalculationAAST\';\n /**\n * @constant {string} LIVE_CATCHUP_MODE_DEFAULT Throughput calculation based on moof parsing\n * @memberof Constants#\n * @static\n */\n\n this.LIVE_CATCHUP_MODE_DEFAULT = \'liveCatchupModeDefault\';\n /**\n * @constant {string} LIVE_CATCHUP_MODE_LOLP Throughput calculation based on moof parsing\n * @memberof Constants#\n * @static\n */\n\n this.LIVE_CATCHUP_MODE_LOLP = \'liveCatchupModeLoLP\';\n /**\n * @constant {string} MOVING_AVERAGE_SLIDING_WINDOW Moving average sliding window\n * @memberof Constants#\n * @static\n */\n\n this.MOVING_AVERAGE_SLIDING_WINDOW = \'slidingWindow\';\n /**\n * @constant {string} EWMA Exponential moving average\n * @memberof Constants#\n * @static\n */\n\n this.MOVING_AVERAGE_EWMA = \'ewma\';\n /**\n * @constant {string} BAD_ARGUMENT_ERROR Invalid Arguments type of error\n * @memberof Constants#\n * @static\n */\n\n this.BAD_ARGUMENT_ERROR = \'Invalid Arguments\';\n /**\n * @constant {string} MISSING_CONFIG_ERROR Missing configuration parameters type of error\n * @memberof Constants#\n * @static\n */\n\n this.MISSING_CONFIG_ERROR = \'Missing config parameter(s)\';\n /**\n * @constant {string} TRACK_SWITCH_MODE_ALWAYS_REPLACE used to clear the buffered data (prior to current playback position) after track switch. Default for audio\n * @memberof Constants#\n * @static\n */\n\n this.TRACK_SWITCH_MODE_ALWAYS_REPLACE = \'alwaysReplace\';\n /**\n * @constant {string} TRACK_SWITCH_MODE_NEVER_REPLACE used to forbid clearing the buffered data (prior to current playback position) after track switch. Defers to fastSwitchEnabled for placement of new data. Default for video\n * @memberof Constants#\n * @static\n */\n\n this.TRACK_SWITCH_MODE_NEVER_REPLACE = \'neverReplace\';\n /**\n * @constant {string} TRACK_SELECTION_MODE_FIRST_TRACK makes the player select the first track found in the manifest.\n * @memberof Constants#\n * @static\n */\n\n this.TRACK_SELECTION_MODE_FIRST_TRACK = \'firstTrack\';\n /**\n * @constant {string} TRACK_SELECTION_MODE_HIGHEST_BITRATE makes the player select the track with a highest bitrate. This mode is a default mode.\n * @memberof Constants#\n * @static\n */\n\n this.TRACK_SELECTION_MODE_HIGHEST_BITRATE = \'highestBitrate\';\n /**\n * @constant {string} TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY makes the player select the track with the lowest bitrate per pixel average.\n * @memberof Constants#\n * @static\n */\n\n this.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY = \'highestEfficiency\';\n /**\n * @constant {string} TRACK_SELECTION_MODE_WIDEST_RANGE makes the player select the track with a widest range of bitrates.\n * @memberof Constants#\n * @static\n */\n\n this.TRACK_SELECTION_MODE_WIDEST_RANGE = \'widestRange\';\n /**\n * @constant {string} TRACK_SELECTION_MODE_WIDEST_RANGE makes the player select the track with the highest selectionPriority as defined in the manifest\n * @memberof Constants#\n * @static\n */\n\n this.TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY = \'highestSelectionPriority\';\n /**\n * @constant {string} CMCD_MODE_QUERY specifies to attach CMCD metrics as query parameters.\n * @memberof Constants#\n * @static\n */\n\n this.CMCD_MODE_QUERY = \'query\';\n /**\n * @constant {string} CMCD_MODE_HEADER specifies to attach CMCD metrics as HTTP headers.\n * @memberof Constants#\n * @static\n */\n\n this.CMCD_MODE_HEADER = \'header\';\n this.LOCATION = \'Location\';\n this.INITIALIZE = \'initialize\';\n this.TEXT_SHOWING = \'showing\';\n this.TEXT_HIDDEN = \'hidden\';\n this.CC1 = \'CC1\';\n this.CC3 = \'CC3\';\n this.UTF8 = \'utf-8\';\n this.SCHEME_ID_URI = \'schemeIdUri\';\n this.START_TIME = \'starttime\';\n this.SERVICE_DESCRIPTION_LL_SCHEME = \'urn:dvb:dash:lowlatency:scope:2019\';\n this.SUPPLEMENTAL_PROPERTY_LL_SCHEME = \'urn:dvb:dash:lowlatency:critical:2019\';\n this.XML = \'XML\';\n this.ARRAY_BUFFER = \'ArrayBuffer\';\n this.DVB_REPORTING_URL = \'dvb:reportingUrl\';\n this.DVB_PROBABILITY = \'dvb:probability\';\n this.VIDEO_ELEMENT_READY_STATES = {\n HAVE_NOTHING: 0,\n HAVE_METADATA: 1,\n HAVE_CURRENT_DATA: 2,\n HAVE_FUTURE_DATA: 3,\n HAVE_ENOUGH_DATA: 4\n };\n }\n }]);\n\n return Constants;\n}();\n\nvar constants = new Constants();\n/* harmony default export */ __nested_webpack_exports__["default"] = (constants);\n\n/***/ }),\n\n/***/ "./src/streaming/constants/MetricsConstants.js":\n/*!*****************************************************!*\\\n !*** ./src/streaming/constants/MetricsConstants.js ***!\n \\*****************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1287926__) {\n__nested_webpack_require_1287926__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Metrics Constants declaration\n * @class\n * @ignore\n */\nvar MetricsConstants = /*#__PURE__*/function () {\n function MetricsConstants() {\n _classCallCheck(this, MetricsConstants);\n\n this.init();\n }\n\n _createClass(MetricsConstants, [{\n key: "init",\n value: function init() {\n this.TCP_CONNECTION = \'TcpList\';\n this.HTTP_REQUEST = \'HttpList\';\n this.TRACK_SWITCH = \'RepSwitchList\';\n this.BUFFER_LEVEL = \'BufferLevel\';\n this.BUFFER_LOADED = \'bufferLoaded\';\n this.ABANDON_LOAD = \'abandonload\';\n this.ALLOW_LOAD = \'allowload\';\n this.BUFFER_EMPTY = \'bufferStalled\';\n this.BUFFER_STATE = \'BufferState\';\n this.DVR_INFO = \'DVRInfo\';\n this.DROPPED_FRAMES = \'DroppedFrames\';\n this.SCHEDULING_INFO = \'SchedulingInfo\';\n this.REQUESTS_QUEUE = \'RequestsQueue\';\n this.MANIFEST_UPDATE = \'ManifestUpdate\';\n this.MANIFEST_UPDATE_STREAM_INFO = \'ManifestUpdatePeriodInfo\';\n this.MANIFEST_UPDATE_TRACK_INFO = \'ManifestUpdateRepresentationInfo\';\n this.PLAY_LIST = \'PlayList\';\n this.DVB_ERRORS = \'DVBErrors\';\n }\n }]);\n\n return MetricsConstants;\n}();\n\nvar constants = new MetricsConstants();\n/* harmony default export */ __nested_webpack_exports__["default"] = (constants);\n\n/***/ }),\n\n/***/ "./src/streaming/constants/ProtectionConstants.js":\n/*!********************************************************!*\\\n !*** ./src/streaming/constants/ProtectionConstants.js ***!\n \\********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1292108__) {\n__nested_webpack_require_1292108__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Protection Constants declaration\n * @class\n * @ignore\n */\nvar ProtectionConstants = /*#__PURE__*/function () {\n function ProtectionConstants() {\n _classCallCheck(this, ProtectionConstants);\n\n this.init();\n }\n\n _createClass(ProtectionConstants, [{\n key: "init",\n value: function init() {\n this.CLEARKEY_KEYSTEM_STRING = \'org.w3.clearkey\';\n this.WIDEVINE_KEYSTEM_STRING = \'com.widevine.alpha\';\n this.PLAYREADY_KEYSTEM_STRING = \'com.microsoft.playready\';\n this.INITIALIZATION_DATA_TYPE_CENC = \'cenc\';\n this.INITIALIZATION_DATA_TYPE_KEYIDS = \'keyids\';\n this.INITIALIZATION_DATA_TYPE_WEBM = \'webm\';\n }\n }]);\n\n return ProtectionConstants;\n}();\n\nvar constants = new ProtectionConstants();\n/* harmony default export */ __nested_webpack_exports__["default"] = (constants);\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/AbrController.js":\n/*!****************************************************!*\\\n !*** ./src/streaming/controllers/AbrController.js ***!\n \\****************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1295832__) {\n__nested_webpack_require_1295832__.r(__nested_webpack_exports__);\n/* harmony import */ var _rules_abr_ABRRulesCollection__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1295832__(/*! ../rules/abr/ABRRulesCollection */ "./src/streaming/rules/abr/ABRRulesCollection.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1295832__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1295832__(/*! ../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _vo_BitrateInfo__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1295832__(/*! ../vo/BitrateInfo */ "./src/streaming/vo/BitrateInfo.js");\n/* harmony import */ var _models_FragmentModel__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1295832__(/*! ../models/FragmentModel */ "./src/streaming/models/FragmentModel.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1295832__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1295832__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1295832__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _rules_RulesContext__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1295832__(/*! ../rules/RulesContext */ "./src/streaming/rules/RulesContext.js");\n/* harmony import */ var _rules_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1295832__(/*! ../rules/SwitchRequest */ "./src/streaming/rules/SwitchRequest.js");\n/* harmony import */ var _rules_SwitchRequestHistory__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_1295832__(/*! ../rules/SwitchRequestHistory */ "./src/streaming/rules/SwitchRequestHistory.js");\n/* harmony import */ var _rules_DroppedFramesHistory__WEBPACK_IMPORTED_MODULE_11__ = __nested_webpack_require_1295832__(/*! ../rules/DroppedFramesHistory */ "./src/streaming/rules/DroppedFramesHistory.js");\n/* harmony import */ var _rules_ThroughputHistory__WEBPACK_IMPORTED_MODULE_12__ = __nested_webpack_require_1295832__(/*! ../rules/ThroughputHistory */ "./src/streaming/rules/ThroughputHistory.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_13__ = __nested_webpack_require_1295832__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_14__ = __nested_webpack_require_1295832__(/*! ../vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_15__ = __nested_webpack_require_1295832__(/*! ../utils/SupervisorTools */ "./src/streaming/utils/SupervisorTools.js");\n/* harmony import */ var _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_16__ = __nested_webpack_require_1295832__(/*! ../MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar DEFAULT_VIDEO_BITRATE = 1000;\nvar DEFAULT_AUDIO_BITRATE = 100;\nvar QUALITY_DEFAULT = 0;\n\nfunction AbrController() {\n var context = this.context;\n var debug = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_13__["default"])(context).getInstance();\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance();\n var instance, logger, abrRulesCollection, streamController, topQualities, qualityDict, streamProcessorDict, abandonmentStateDict, abandonmentTimeout, windowResizeEventCalled, elementWidth, elementHeight, adapter, videoModel, mediaPlayerModel, domStorage, playbackIndex, switchHistoryDict, droppedFramesHistory, throughputHistory, isUsingBufferOccupancyAbrDict, isUsingL2AAbrDict, isUsingLoLPAbrDict, dashMetrics, settings;\n\n function setup() {\n logger = debug.getLogger(instance);\n resetInitialSettings();\n }\n /**\n * Initialize everything that is not Stream specific. We only have one instance of the ABR Controller for all periods.\n */\n\n\n function initialize() {\n droppedFramesHistory = Object(_rules_DroppedFramesHistory__WEBPACK_IMPORTED_MODULE_11__["default"])(context).create();\n throughputHistory = Object(_rules_ThroughputHistory__WEBPACK_IMPORTED_MODULE_12__["default"])(context).create({\n settings: settings\n });\n abrRulesCollection = Object(_rules_abr_ABRRulesCollection__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create({\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n settings: settings\n });\n abrRulesCollection.initialize();\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_16__["default"].QUALITY_CHANGE_RENDERED, _onQualityChangeRendered, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_16__["default"].METRIC_ADDED, _onMetricAdded, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].LOADING_PROGRESS, _onFragmentLoadProgress, instance);\n }\n /**\n * Whenever a StreamProcessor is created it is added to the list of streamProcessorDict\n * In addition, the corresponding objects for this object and its stream id are created\n * @param {object} type\n * @param {object} streamProcessor\n */\n\n\n function registerStreamType(type, streamProcessor) {\n var streamId = streamProcessor.getStreamInfo().id;\n\n if (!streamProcessorDict[streamId]) {\n streamProcessorDict[streamId] = {};\n }\n\n if (!switchHistoryDict[streamId]) {\n switchHistoryDict[streamId] = {};\n }\n\n if (!abandonmentStateDict[streamId]) {\n abandonmentStateDict[streamId] = {};\n }\n\n switchHistoryDict[streamId][type] = Object(_rules_SwitchRequestHistory__WEBPACK_IMPORTED_MODULE_10__["default"])(context).create();\n streamProcessorDict[streamId][type] = streamProcessor;\n abandonmentStateDict[streamId][type] = {};\n abandonmentStateDict[streamId][type].state = _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_2__["default"].ALLOW_LOAD;\n\n _initializeAbrStrategy(type);\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO) {\n setElementSize();\n }\n }\n\n function _initializeAbrStrategy(type) {\n var strategy = settings.get().streaming.abr.ABRStrategy;\n\n if (strategy === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].ABR_STRATEGY_L2A) {\n isUsingBufferOccupancyAbrDict[type] = false;\n isUsingLoLPAbrDict[type] = false;\n isUsingL2AAbrDict[type] = true;\n } else if (strategy === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].ABR_STRATEGY_LoLP) {\n isUsingBufferOccupancyAbrDict[type] = false;\n isUsingLoLPAbrDict[type] = true;\n isUsingL2AAbrDict[type] = false;\n } else if (strategy === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].ABR_STRATEGY_BOLA) {\n isUsingBufferOccupancyAbrDict[type] = true;\n isUsingLoLPAbrDict[type] = false;\n isUsingL2AAbrDict[type] = false;\n } else if (strategy === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].ABR_STRATEGY_THROUGHPUT) {\n isUsingBufferOccupancyAbrDict[type] = false;\n isUsingLoLPAbrDict[type] = false;\n isUsingL2AAbrDict[type] = false;\n } else if (strategy === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].ABR_STRATEGY_DYNAMIC) {\n isUsingBufferOccupancyAbrDict[type] = isUsingBufferOccupancyAbrDict && isUsingBufferOccupancyAbrDict[type] ? isUsingBufferOccupancyAbrDict[type] : false;\n isUsingLoLPAbrDict[type] = false;\n isUsingL2AAbrDict[type] = false;\n }\n }\n\n function unRegisterStreamType(streamId, type) {\n try {\n if (streamProcessorDict[streamId] && streamProcessorDict[streamId][type]) {\n delete streamProcessorDict[streamId][type];\n }\n\n if (switchHistoryDict[streamId] && switchHistoryDict[streamId][type]) {\n delete switchHistoryDict[streamId][type];\n }\n\n if (abandonmentStateDict[streamId] && abandonmentStateDict[streamId][type]) {\n delete abandonmentStateDict[streamId][type];\n }\n } catch (e) {}\n }\n\n function resetInitialSettings() {\n topQualities = {};\n qualityDict = {};\n abandonmentStateDict = {};\n streamProcessorDict = {};\n switchHistoryDict = {};\n isUsingBufferOccupancyAbrDict = {};\n isUsingL2AAbrDict = {};\n isUsingLoLPAbrDict = {};\n\n if (windowResizeEventCalled === undefined) {\n windowResizeEventCalled = false;\n }\n\n if (droppedFramesHistory) {\n droppedFramesHistory.reset();\n }\n\n playbackIndex = undefined;\n droppedFramesHistory = undefined;\n throughputHistory = undefined;\n clearTimeout(abandonmentTimeout);\n abandonmentTimeout = null;\n }\n\n function reset() {\n resetInitialSettings();\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].LOADING_PROGRESS, _onFragmentLoadProgress, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_16__["default"].QUALITY_CHANGE_RENDERED, _onQualityChangeRendered, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_16__["default"].METRIC_ADDED, _onMetricAdded, instance);\n\n if (abrRulesCollection) {\n abrRulesCollection.reset();\n }\n }\n\n function setConfig(config) {\n if (!config) return;\n\n if (config.streamController) {\n streamController = config.streamController;\n }\n\n if (config.domStorage) {\n domStorage = config.domStorage;\n }\n\n if (config.mediaPlayerModel) {\n mediaPlayerModel = config.mediaPlayerModel;\n }\n\n if (config.dashMetrics) {\n dashMetrics = config.dashMetrics;\n }\n\n if (config.adapter) {\n adapter = config.adapter;\n }\n\n if (config.videoModel) {\n videoModel = config.videoModel;\n }\n\n if (config.settings) {\n settings = config.settings;\n }\n }\n\n function checkConfig() {\n if (!domStorage || !domStorage.hasOwnProperty(\'getSavedBitrateSettings\')) {\n throw new Error(_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].MISSING_CONFIG_ERROR);\n }\n }\n /**\n * While fragment loading is in progress we check if we might need to abort the request\n * @param {object} e\n * @private\n */\n\n\n function _onFragmentLoadProgress(e) {\n var type = e.request.mediaType;\n var streamId = e.streamId;\n\n if (!type || !streamId || !streamProcessorDict[streamId] || !settings.get().streaming.abr.autoSwitchBitrate[type]) {\n return;\n }\n\n var streamProcessor = streamProcessorDict[streamId][type];\n\n if (!streamProcessor) {\n return;\n }\n\n var rulesContext = Object(_rules_RulesContext__WEBPACK_IMPORTED_MODULE_8__["default"])(context).create({\n abrController: instance,\n streamProcessor: streamProcessor,\n currentRequest: e.request,\n useBufferOccupancyABR: isUsingBufferOccupancyAbrDict[type],\n useL2AABR: isUsingL2AAbrDict[type],\n useLoLPABR: isUsingLoLPAbrDict[type],\n videoModel: videoModel\n });\n var switchRequest = abrRulesCollection.shouldAbandonFragment(rulesContext, streamId);\n\n if (switchRequest.quality > _rules_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE) {\n var fragmentModel = streamProcessor.getFragmentModel();\n var request = fragmentModel.getRequests({\n state: _models_FragmentModel__WEBPACK_IMPORTED_MODULE_4__["default"].FRAGMENT_MODEL_LOADING,\n index: e.request.index\n })[0];\n\n if (request) {\n fragmentModel.abortRequests();\n abandonmentStateDict[streamId][type].state = _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_2__["default"].ABANDON_LOAD;\n switchHistoryDict[streamId][type].reset();\n switchHistoryDict[streamId][type].push({\n oldValue: getQualityFor(type, streamId),\n newValue: switchRequest.quality,\n confidence: 1,\n reason: switchRequest.reason\n });\n setPlaybackQuality(type, streamController.getActiveStreamInfo(), switchRequest.quality, switchRequest.reason);\n clearTimeout(abandonmentTimeout);\n abandonmentTimeout = setTimeout(function () {\n abandonmentStateDict[streamId][type].state = _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_2__["default"].ALLOW_LOAD;\n abandonmentTimeout = null;\n }, settings.get().streaming.abandonLoadTimeout);\n }\n }\n }\n /**\n * Update dropped frames history when the quality was changed\n * @param {object} e\n * @private\n */\n\n\n function _onQualityChangeRendered(e) {\n if (e.mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO) {\n if (playbackIndex !== undefined) {\n droppedFramesHistory.push(e.streamId, playbackIndex, videoModel.getPlaybackQuality());\n }\n\n playbackIndex = e.newQuality;\n }\n }\n /**\n * When the buffer level is updated we check if we need to change the ABR strategy\n * @param e\n * @private\n */\n\n\n function _onMetricAdded(e) {\n if (e.metric === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_2__["default"].HTTP_REQUEST && e.value && e.value.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_14__["HTTPRequest"].MEDIA_SEGMENT_TYPE && (e.mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO || e.mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO)) {\n throughputHistory.push(e.mediaType, e.value, settings.get().streaming.abr.useDeadTimeLatency);\n }\n\n if (e.metric === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_2__["default"].BUFFER_LEVEL && (e.mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO || e.mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO)) {\n _updateAbrStrategy(e.mediaType, 0.001 * e.value.level);\n }\n }\n /**\n * Returns the highest possible index taking limitations like maxBitrate, representationRatio and portal size into account.\n * @param {string} type\n * @param {string} streamId\n * @return {number}\n */\n\n\n function getMaxAllowedIndexFor(type, streamId) {\n try {\n var idx;\n topQualities[streamId] = topQualities[streamId] || {};\n\n if (!topQualities[streamId].hasOwnProperty(type)) {\n topQualities[streamId][type] = 0;\n }\n\n idx = _checkMaxBitrate(type, streamId);\n idx = _checkMaxRepresentationRatio(idx, type, streamId);\n idx = _checkPortalSize(idx, type, streamId);\n return idx;\n } catch (e) {\n return undefined;\n }\n }\n /**\n * Returns the minimum allowed index. We consider thresholds defined in the settings, i.e. minBitrate for the corresponding media type.\n * @param {string} type\n * @param {string} streamId\n * @return {undefined|number}\n */\n\n\n function getMinAllowedIndexFor(type, streamId) {\n try {\n return _getMinIndexBasedOnBitrateFor(type, streamId);\n } catch (e) {\n return undefined;\n }\n }\n /**\n * Returns the maximum allowed index.\n * @param {string} type\n * @param {string} streamId\n * @return {undefined|number}\n */\n\n\n function _getMaxIndexBasedOnBitrateFor(type, streamId) {\n try {\n var maxBitrate = settings.get().streaming.abr.maxBitrate[type];\n\n if (maxBitrate > -1) {\n return getQualityForBitrate(streamProcessorDict[streamId][type].getMediaInfo(), maxBitrate, streamId);\n } else {\n return undefined;\n }\n } catch (e) {\n return undefined;\n }\n }\n /**\n * Returns the minimum allowed index.\n * @param {string} type\n * @param {string} streamId\n * @return {undefined|number}\n */\n\n\n function _getMinIndexBasedOnBitrateFor(type, streamId) {\n try {\n var minBitrate = settings.get().streaming.abr.minBitrate[type];\n\n if (minBitrate > -1) {\n var mediaInfo = streamProcessorDict[streamId][type].getMediaInfo();\n var bitrateList = getBitrateList(mediaInfo); // This returns the quality index <= for the given bitrate\n\n var minIdx = getQualityForBitrate(mediaInfo, minBitrate, streamId);\n\n if (bitrateList[minIdx] && minIdx < bitrateList.length - 1 && bitrateList[minIdx].bitrate < minBitrate * 1000) {\n minIdx++; // Go to the next bitrate\n }\n\n return minIdx;\n } else {\n return undefined;\n }\n } catch (e) {\n return undefined;\n }\n }\n /**\n * Returns the maximum possible index\n * @param type\n * @param streamId\n * @return {number|*}\n */\n\n\n function _checkMaxBitrate(type, streamId) {\n var idx = topQualities[streamId][type];\n var newIdx = idx;\n\n if (!streamProcessorDict[streamId] || !streamProcessorDict[streamId][type]) {\n return newIdx;\n }\n\n var minIdx = getMinAllowedIndexFor(type, streamId);\n\n if (minIdx !== undefined) {\n newIdx = Math.max(idx, minIdx);\n }\n\n var maxIdx = _getMaxIndexBasedOnBitrateFor(type, streamId);\n\n if (maxIdx !== undefined) {\n newIdx = Math.min(newIdx, maxIdx);\n }\n\n return newIdx;\n }\n /**\n * Returns the maximum index according to maximum representation ratio\n * @param idx\n * @param type\n * @param streamId\n * @return {number|*}\n * @private\n */\n\n\n function _checkMaxRepresentationRatio(idx, type, streamId) {\n var maxIdx = topQualities[streamId][type];\n var maxRepresentationRatio = settings.get().streaming.abr.maxRepresentationRatio[type];\n\n if (isNaN(maxRepresentationRatio) || maxRepresentationRatio >= 1 || maxRepresentationRatio < 0) {\n return idx;\n }\n\n return Math.min(idx, Math.round(maxIdx * maxRepresentationRatio));\n }\n /**\n * Returns the maximum index according to the portal size\n * @param idx\n * @param type\n * @param streamId\n * @return {number|*}\n * @private\n */\n\n\n function _checkPortalSize(idx, type, streamId) {\n if (type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO || !settings.get().streaming.abr.limitBitrateByPortal || !streamProcessorDict[streamId] || !streamProcessorDict[streamId][type]) {\n return idx;\n }\n\n if (!windowResizeEventCalled) {\n setElementSize();\n }\n\n var streamInfo = streamProcessorDict[streamId][type].getStreamInfo();\n var representation = adapter.getAdaptationForType(streamInfo.index, type, streamInfo).Representation;\n var newIdx = idx;\n\n if (elementWidth > 0 && elementHeight > 0) {\n while (newIdx > 0 && representation[newIdx] && elementWidth < representation[newIdx].width && elementWidth - representation[newIdx - 1].width < representation[newIdx].width - elementWidth) {\n newIdx = newIdx - 1;\n } // Make sure that in case of multiple representation elements have same\n // resolution, every such element is included\n\n\n while (newIdx < representation.length - 1 && representation[newIdx].width === representation[newIdx + 1].width) {\n newIdx = newIdx + 1;\n }\n }\n\n return newIdx;\n }\n /**\n * Gets top BitrateInfo for the player\n * @param {string} type - \'video\' or \'audio\' are the type options.\n * @param {string} streamId - Id of the stream\n * @returns {BitrateInfo | null}\n */\n\n\n function getTopBitrateInfoFor(type) {\n var streamId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n if (!streamId) {\n streamId = streamController.getActiveStreamInfo().id;\n }\n\n if (type && streamProcessorDict && streamProcessorDict[streamId] && streamProcessorDict[streamId][type]) {\n var idx = getMaxAllowedIndexFor(type, streamId);\n var bitrates = getBitrateList(streamProcessorDict[streamId][type].getMediaInfo());\n return bitrates[idx] ? bitrates[idx] : null;\n }\n\n return null;\n }\n /**\n * Returns the initial bitrate for a specific media type and stream id\n * @param {string} type\n * @param {string} streamId\n * @returns {number} A value of the initial bitrate, kbps\n * @memberof AbrController#\n */\n\n\n function getInitialBitrateFor(type, streamId) {\n checkConfig();\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].TEXT) {\n return NaN;\n }\n\n var savedBitrate = domStorage.getSavedBitrateSettings(type);\n var configBitrate = settings.get().streaming.abr.initialBitrate[type];\n var configRatio = settings.get().streaming.abr.initialRepresentationRatio[type];\n\n if (configBitrate === -1) {\n if (configRatio > -1) {\n var streamInfo = streamProcessorDict[streamId][type].getStreamInfo();\n var representation = adapter.getAdaptationForType(streamInfo.index, type, streamInfo).Representation;\n\n if (Array.isArray(representation)) {\n var repIdx = Math.max(Math.round(representation.length * configRatio) - 1, 0);\n configBitrate = representation[repIdx].bandwidth / 1000;\n } else {\n configBitrate = 0;\n }\n } else if (!isNaN(savedBitrate)) {\n configBitrate = savedBitrate;\n } else {\n configBitrate = type === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO ? DEFAULT_VIDEO_BITRATE : DEFAULT_AUDIO_BITRATE;\n }\n }\n\n return configBitrate;\n }\n /**\n * This function is called by the scheduleControllers to check if the quality should be changed.\n * Consider this the main entry point for the ABR decision logic\n * @param {string} type\n * @param {string} streamId\n */\n\n\n function checkPlaybackQuality(type, streamId) {\n try {\n if (!type || !streamProcessorDict || !streamProcessorDict[streamId] || !streamProcessorDict[streamId][type]) {\n return false;\n }\n\n if (droppedFramesHistory) {\n var playbackQuality = videoModel.getPlaybackQuality();\n\n if (playbackQuality) {\n droppedFramesHistory.push(streamId, playbackIndex, playbackQuality);\n }\n } // ABR is turned off, do nothing\n\n\n if (!settings.get().streaming.abr.autoSwitchBitrate[type]) {\n return false;\n }\n\n var oldQuality = getQualityFor(type, streamId);\n var rulesContext = Object(_rules_RulesContext__WEBPACK_IMPORTED_MODULE_8__["default"])(context).create({\n abrController: instance,\n switchHistory: switchHistoryDict[streamId][type],\n droppedFramesHistory: droppedFramesHistory,\n streamProcessor: streamProcessorDict[streamId][type],\n currentValue: oldQuality,\n useBufferOccupancyABR: isUsingBufferOccupancyAbrDict[type],\n useL2AABR: isUsingL2AAbrDict[type],\n useLoLPABR: isUsingLoLPAbrDict[type],\n videoModel: videoModel\n });\n var minIdx = getMinAllowedIndexFor(type, streamId);\n var maxIdx = getMaxAllowedIndexFor(type, streamId);\n var switchRequest = abrRulesCollection.getMaxQuality(rulesContext);\n var newQuality = switchRequest.quality;\n\n if (minIdx !== undefined && (newQuality > _rules_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE ? newQuality : oldQuality) < minIdx) {\n newQuality = minIdx;\n }\n\n if (newQuality > maxIdx) {\n newQuality = maxIdx;\n }\n\n switchHistoryDict[streamId][type].push({\n oldValue: oldQuality,\n newValue: newQuality\n });\n\n if (newQuality > _rules_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE && newQuality !== oldQuality && (abandonmentStateDict[streamId][type].state === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_2__["default"].ALLOW_LOAD || newQuality > oldQuality)) {\n _changeQuality(type, oldQuality, newQuality, maxIdx, switchRequest.reason, streamId);\n\n return true;\n }\n\n return false;\n } catch (e) {\n return false;\n }\n }\n /**\n * Returns the current quality for a specific media type and a specific streamId\n * @param {string} type\n * @param {string} streamId\n * @return {number|*}\n */\n\n\n function getQualityFor(type) {\n var streamId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n try {\n if (!streamId) {\n streamId = streamController.getActiveStreamInfo().id;\n }\n\n if (type && streamProcessorDict[streamId] && streamProcessorDict[streamId][type]) {\n var quality;\n\n if (streamId) {\n qualityDict[streamId] = qualityDict[streamId] || {};\n\n if (!qualityDict[streamId].hasOwnProperty(type)) {\n qualityDict[streamId][type] = QUALITY_DEFAULT;\n }\n\n quality = qualityDict[streamId][type];\n return quality;\n }\n }\n\n return QUALITY_DEFAULT;\n } catch (e) {\n return QUALITY_DEFAULT;\n }\n }\n /**\n * Sets the new playback quality. Starts from index 0.\n * If the index of the new quality is the same as the old one changeQuality will not be called.\n * @param {string} type\n * @param {object} streamInfo\n * @param {number} newQuality\n * @param {string} reason\n */\n\n\n function setPlaybackQuality(type, streamInfo, newQuality) {\n var reason = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n\n if (!streamInfo || !streamInfo.id || !type) {\n return;\n }\n\n var streamId = streamInfo.id;\n var oldQuality = getQualityFor(type, streamId);\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_15__["checkInteger"])(newQuality);\n var topQualityIdx = getMaxAllowedIndexFor(type, streamId);\n\n if (newQuality !== oldQuality && newQuality >= 0 && newQuality <= topQualityIdx) {\n _changeQuality(type, oldQuality, newQuality, topQualityIdx, reason, streamId);\n }\n }\n /**\n *\n * @param {string} streamId\n * @param {type} type\n * @return {*|null}\n */\n\n\n function getAbandonmentStateFor(streamId, type) {\n return abandonmentStateDict[streamId] && abandonmentStateDict[streamId][type] ? abandonmentStateDict[streamId][type].state : null;\n }\n /**\n * Changes the internal qualityDict values according to the new quality\n * @param {string} type\n * @param {number} oldQuality\n * @param {number} newQuality\n * @param {number} maxIdx\n * @param {string} reason\n * @param {object} streamId\n * @private\n */\n\n\n function _changeQuality(type, oldQuality, newQuality, maxIdx, reason, streamId) {\n if (type && streamProcessorDict[streamId] && streamProcessorDict[streamId][type]) {\n var streamInfo = streamProcessorDict[streamId][type].getStreamInfo();\n var isDynamic = streamInfo && streamInfo.manifestInfo && streamInfo.manifestInfo.isDynamic;\n var bufferLevel = dashMetrics.getCurrentBufferLevel(type);\n logger.info(\'Stream ID: \' + streamId + \' [\' + type + \'] switch from \' + oldQuality + \' to \' + newQuality + \'/\' + maxIdx + \' (buffer: \' + bufferLevel + \') \' + (reason ? JSON.stringify(reason) : \'.\'));\n qualityDict[streamId] = qualityDict[streamId] || {};\n qualityDict[streamId][type] = newQuality;\n\n var bitrateInfo = _getBitrateInfoForQuality(streamId, type, newQuality);\n\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].QUALITY_CHANGE_REQUESTED, {\n oldQuality: oldQuality,\n newQuality: newQuality,\n reason: reason,\n streamInfo: streamInfo,\n bitrateInfo: bitrateInfo,\n maxIdx: maxIdx,\n mediaType: type\n }, {\n streamId: streamInfo.id,\n mediaType: type\n });\n var bitrate = throughputHistory.getAverageThroughput(type, isDynamic);\n\n if (!isNaN(bitrate)) {\n domStorage.setSavedBitrateSettings(type, bitrate);\n }\n }\n }\n\n function _getBitrateInfoForQuality(streamId, type, idx) {\n if (type && streamProcessorDict && streamProcessorDict[streamId] && streamProcessorDict[streamId][type]) {\n var bitrates = getBitrateList(streamProcessorDict[streamId][type].getMediaInfo());\n return bitrates[idx] ? bitrates[idx] : null;\n }\n\n return null;\n }\n /**\n * @param {MediaInfo} mediaInfo\n * @param {number} bitrate A bitrate value, kbps\n * @param {String} streamId Period ID\n * @param {number|null} latency Expected latency of connection, ms\n * @returns {number} A quality index <= for the given bitrate\n * @memberof AbrController#\n */\n\n\n function getQualityForBitrate(mediaInfo, bitrate, streamId) {\n var latency = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n var voRepresentation = mediaInfo && mediaInfo.type ? streamProcessorDict[streamId][mediaInfo.type].getRepresentationInfo() : null;\n\n if (settings.get().streaming.abr.useDeadTimeLatency && latency && voRepresentation && voRepresentation.fragmentDuration) {\n latency = latency / 1000;\n var fragmentDuration = voRepresentation.fragmentDuration;\n\n if (latency > fragmentDuration) {\n return 0;\n } else {\n var deadTimeRatio = latency / fragmentDuration;\n bitrate = bitrate * (1 - deadTimeRatio);\n }\n }\n\n var bitrateList = getBitrateList(mediaInfo);\n\n for (var i = bitrateList.length - 1; i >= 0; i--) {\n var bitrateInfo = bitrateList[i];\n\n if (bitrate * 1000 >= bitrateInfo.bitrate) {\n return i;\n }\n }\n\n return QUALITY_DEFAULT;\n }\n /**\n * @param {MediaInfo} mediaInfo\n * @returns {Array|null} A list of {@link BitrateInfo} objects\n * @memberof AbrController#\n */\n\n\n function getBitrateList(mediaInfo) {\n var infoList = [];\n if (!mediaInfo || !mediaInfo.bitrateList) return infoList;\n var bitrateList = mediaInfo.bitrateList;\n var type = mediaInfo.type;\n var bitrateInfo;\n\n for (var i = 0, ln = bitrateList.length; i < ln; i++) {\n bitrateInfo = new _vo_BitrateInfo__WEBPACK_IMPORTED_MODULE_3__["default"]();\n bitrateInfo.mediaType = type;\n bitrateInfo.qualityIndex = i;\n bitrateInfo.bitrate = bitrateList[i].bandwidth;\n bitrateInfo.width = bitrateList[i].width;\n bitrateInfo.height = bitrateList[i].height;\n bitrateInfo.scanType = bitrateList[i].scanType;\n infoList.push(bitrateInfo);\n }\n\n return infoList;\n }\n\n function _updateAbrStrategy(mediaType, bufferLevel) {\n // else ABR_STRATEGY_DYNAMIC\n var strategy = settings.get().streaming.abr.ABRStrategy;\n\n if (strategy === _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].ABR_STRATEGY_DYNAMIC) {\n _updateDynamicAbrStrategy(mediaType, bufferLevel);\n }\n }\n\n function _updateDynamicAbrStrategy(mediaType, bufferLevel) {\n var stableBufferTime = mediaPlayerModel.getStableBufferTime();\n var switchOnThreshold = stableBufferTime;\n var switchOffThreshold = 0.5 * stableBufferTime;\n var useBufferABR = isUsingBufferOccupancyAbrDict[mediaType];\n var newUseBufferABR = bufferLevel > (useBufferABR ? switchOffThreshold : switchOnThreshold); // use hysteresis to avoid oscillating rules\n\n isUsingBufferOccupancyAbrDict[mediaType] = newUseBufferABR;\n\n if (newUseBufferABR !== useBufferABR) {\n if (newUseBufferABR) {\n logger.info(\'[\' + mediaType + \'] switching from throughput to buffer occupancy ABR rule (buffer: \' + bufferLevel.toFixed(3) + \').\');\n } else {\n logger.info(\'[\' + mediaType + \'] switching from buffer occupancy to throughput ABR rule (buffer: \' + bufferLevel.toFixed(3) + \').\');\n }\n }\n }\n\n function getThroughputHistory() {\n return throughputHistory;\n }\n\n function updateTopQualityIndex(mediaInfo) {\n var type = mediaInfo.type;\n var streamId = mediaInfo.streamInfo.id;\n var max = mediaInfo.representationCount - 1;\n topQualities[streamId] = topQualities[streamId] || {};\n topQualities[streamId][type] = max;\n return max;\n }\n\n function isPlayingAtTopQuality(streamInfo) {\n var streamId = streamInfo ? streamInfo.id : null;\n var audioQuality = getQualityFor(_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO, streamId);\n var videoQuality = getQualityFor(_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO, streamId);\n var isAtTop = audioQuality === getMaxAllowedIndexFor(_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].AUDIO, streamId) && videoQuality === getMaxAllowedIndexFor(_constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].VIDEO, streamId);\n return isAtTop;\n }\n\n function setWindowResizeEventCalled(value) {\n windowResizeEventCalled = value;\n }\n\n function setElementSize() {\n if (videoModel) {\n var hasPixelRatio = settings.get().streaming.abr.usePixelRatioInLimitBitrateByPortal && window.hasOwnProperty(\'devicePixelRatio\');\n var pixelRatio = hasPixelRatio ? window.devicePixelRatio : 1;\n elementWidth = videoModel.getClientWidth() * pixelRatio;\n elementHeight = videoModel.getClientHeight() * pixelRatio;\n }\n }\n\n function clearDataForStream(streamId) {\n if (droppedFramesHistory) {\n droppedFramesHistory.clearForStream(streamId);\n }\n\n if (streamProcessorDict[streamId]) {\n delete streamProcessorDict[streamId];\n }\n\n if (switchHistoryDict[streamId]) {\n delete switchHistoryDict[streamId];\n }\n\n if (abandonmentStateDict[streamId]) {\n delete abandonmentStateDict[streamId];\n }\n }\n\n instance = {\n initialize: initialize,\n isPlayingAtTopQuality: isPlayingAtTopQuality,\n updateTopQualityIndex: updateTopQualityIndex,\n clearDataForStream: clearDataForStream,\n getThroughputHistory: getThroughputHistory,\n getBitrateList: getBitrateList,\n getQualityForBitrate: getQualityForBitrate,\n getTopBitrateInfoFor: getTopBitrateInfoFor,\n getMinAllowedIndexFor: getMinAllowedIndexFor,\n getMaxAllowedIndexFor: getMaxAllowedIndexFor,\n getInitialBitrateFor: getInitialBitrateFor,\n getQualityFor: getQualityFor,\n getAbandonmentStateFor: getAbandonmentStateFor,\n setPlaybackQuality: setPlaybackQuality,\n checkPlaybackQuality: checkPlaybackQuality,\n setElementSize: setElementSize,\n setWindowResizeEventCalled: setWindowResizeEventCalled,\n registerStreamType: registerStreamType,\n unRegisterStreamType: unRegisterStreamType,\n setConfig: setConfig,\n reset: reset\n };\n setup();\n return instance;\n}\n\nAbrController.__dashjs_factory_name = \'AbrController\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_7__["default"].getSingletonFactory(AbrController);\nfactory.QUALITY_DEFAULT = QUALITY_DEFAULT;\n_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_7__["default"].updateSingletonFactory(AbrController.__dashjs_factory_name, factory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/BaseURLController.js":\n/*!********************************************************!*\\\n !*** ./src/streaming/controllers/BaseURLController.js ***!\n \\********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1332243__) {\n__nested_webpack_require_1332243__.r(__nested_webpack_exports__);\n/* harmony import */ var _models_BaseURLTreeModel__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1332243__(/*! ../models/BaseURLTreeModel */ "./src/streaming/models/BaseURLTreeModel.js");\n/* harmony import */ var _utils_BaseURLSelector__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1332243__(/*! ../utils/BaseURLSelector */ "./src/streaming/utils/BaseURLSelector.js");\n/* harmony import */ var _utils_URLUtils__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1332243__(/*! ../utils/URLUtils */ "./src/streaming/utils/URLUtils.js");\n/* harmony import */ var _dash_vo_BaseURL__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1332243__(/*! ../../dash/vo/BaseURL */ "./src/dash/vo/BaseURL.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1332243__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1332243__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1332243__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\nfunction BaseURLController() {\n var instance, adapter;\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance();\n var urlUtils = Object(_utils_URLUtils__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance();\n var baseURLTreeModel, baseURLSelector;\n\n function onBlackListChanged(e) {\n baseURLTreeModel.invalidateSelectedIndexes(e.entry);\n }\n\n function setup() {\n baseURLTreeModel = Object(_models_BaseURLTreeModel__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create();\n baseURLSelector = Object(_utils_BaseURLSelector__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create();\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].SERVICE_LOCATION_BLACKLIST_CHANGED, onBlackListChanged, instance);\n }\n\n function setConfig(config) {\n if (config.baseURLTreeModel) {\n baseURLTreeModel = config.baseURLTreeModel;\n }\n\n if (config.baseURLSelector) {\n baseURLSelector = config.baseURLSelector;\n }\n\n if (config.adapter) {\n adapter = config.adapter;\n }\n }\n\n function update(manifest) {\n baseURLTreeModel.update(manifest);\n baseURLSelector.chooseSelector(adapter.getIsDVB(manifest));\n }\n\n function resolve(path) {\n var baseUrls = baseURLTreeModel.getForPath(path);\n var baseUrl = baseUrls.reduce(function (p, c) {\n var b = baseURLSelector.select(c);\n\n if (b) {\n if (!urlUtils.isRelative(b.url)) {\n p.url = b.url;\n p.serviceLocation = b.serviceLocation;\n } else {\n p.url = urlUtils.resolve(b.url, p.url);\n }\n\n p.availabilityTimeOffset = b.availabilityTimeOffset;\n p.availabilityTimeComplete = b.availabilityTimeComplete;\n } else {\n return new _dash_vo_BaseURL__WEBPACK_IMPORTED_MODULE_3__["default"]();\n }\n\n return p;\n }, new _dash_vo_BaseURL__WEBPACK_IMPORTED_MODULE_3__["default"]());\n\n if (!urlUtils.isRelative(baseUrl.url)) {\n return baseUrl;\n }\n }\n\n function reset() {\n baseURLTreeModel.reset();\n baseURLSelector.reset();\n }\n\n function initialize(data) {\n // report config to baseURLTreeModel and baseURLSelector\n baseURLTreeModel.setConfig({\n adapter: adapter\n });\n update(data);\n }\n\n instance = {\n reset: reset,\n initialize: initialize,\n resolve: resolve,\n setConfig: setConfig\n };\n setup();\n return instance;\n}\n\nBaseURLController.__dashjs_factory_name = \'BaseURLController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_4__["default"].getClassFactory(BaseURLController));\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/BlacklistController.js":\n/*!**********************************************************!*\\\n !*** ./src/streaming/controllers/BlacklistController.js ***!\n \\**********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1338280__) {\n__nested_webpack_require_1338280__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1338280__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1338280__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\nfunction BlackListController(config) {\n config = config || {};\n var instance;\n var blacklist = [];\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_1__["default"])(this.context).getInstance();\n var updateEventName = config.updateEventName;\n var addBlacklistEventName = config.addBlacklistEventName;\n\n function contains(query) {\n if (!blacklist.length || !query || !query.length) {\n return false;\n }\n\n return blacklist.indexOf(query) !== -1;\n }\n\n function add(entry) {\n if (blacklist.indexOf(entry) !== -1) {\n return;\n }\n\n blacklist.push(entry);\n eventBus.trigger(updateEventName, {\n entry: entry\n });\n }\n\n function onAddBlackList(e) {\n add(e.entry);\n }\n\n function setup() {\n if (addBlacklistEventName) {\n eventBus.on(addBlacklistEventName, onAddBlackList, instance);\n }\n }\n\n function reset() {\n blacklist = [];\n }\n\n instance = {\n add: add,\n contains: contains,\n reset: reset\n };\n setup();\n return instance;\n}\n\nBlackListController.__dashjs_factory_name = \'BlackListController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(BlackListController));\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/BufferController.js":\n/*!*******************************************************!*\\\n !*** ./src/streaming/controllers/BufferController.js ***!\n \\*******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1342052__) {\n__nested_webpack_require_1342052__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1342052__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1342052__(/*! ../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _models_FragmentModel__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1342052__(/*! ../models/FragmentModel */ "./src/streaming/models/FragmentModel.js");\n/* harmony import */ var _SourceBufferSink__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1342052__(/*! ../SourceBufferSink */ "./src/streaming/SourceBufferSink.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1342052__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1342052__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1342052__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1342052__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _utils_InitCache__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1342052__(/*! ../utils/InitCache */ "./src/streaming/utils/InitCache.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1342052__(/*! ../vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_1342052__(/*! ../../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_11__ = __nested_webpack_require_1342052__(/*! ../vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_12__ = __nested_webpack_require_1342052__(/*! ../../streaming/MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar BUFFER_END_THRESHOLD = 0.5;\nvar BUFFER_RANGE_CALCULATION_THRESHOLD = 0.01;\nvar QUOTA_EXCEEDED_ERROR_CODE = 22;\nvar BUFFER_CONTROLLER_TYPE = \'BufferController\';\n\nfunction BufferController(config) {\n config = config || {};\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n var errHandler = config.errHandler;\n var fragmentModel = config.fragmentModel;\n var representationController = config.representationController;\n var adapter = config.adapter;\n var textController = config.textController;\n var abrController = config.abrController;\n var playbackController = config.playbackController;\n var streamInfo = config.streamInfo;\n var type = config.type;\n var settings = config.settings;\n var instance, logger, isBufferingCompleted, bufferLevel, criticalBufferLevel, mediaSource, maxAppendedIndex, maximumIndex, sourceBufferSink, bufferState, appendedBytesInfo, wallclockTicked, isPruningInProgress, isQuotaExceeded, initCache, pendingPruningRanges, replacingBuffer, seekTarget;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_7__["default"])(context).getInstance().getLogger(instance);\n initCache = Object(_utils_InitCache__WEBPACK_IMPORTED_MODULE_8__["default"])(context).getInstance();\n resetInitialSettings();\n }\n /**\n * Initialize the BufferController. Sets the media source and registers the event handlers.\n * @param {object} mediaSource\n */\n\n\n function initialize(mediaSource) {\n setMediaSource(mediaSource);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].INIT_FRAGMENT_LOADED, _onInitFragmentLoaded, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].MEDIA_FRAGMENT_LOADED, _onMediaFragmentLoaded, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].WALLCLOCK_TIME_UPDATED, _onWallclockTimeUpdated, instance);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_12__["default"].PLAYBACK_PLAYING, _onPlaybackPlaying, instance);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_12__["default"].PLAYBACK_PROGRESS, _onPlaybackProgression, instance);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_12__["default"].PLAYBACK_TIME_UPDATED, _onPlaybackProgression, instance);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_12__["default"].PLAYBACK_RATE_CHANGED, _onPlaybackRateChanged, instance);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_12__["default"].PLAYBACK_STALLED, _onPlaybackStalled, instance);\n }\n /**\n * Returns the stream id\n * @return {string}\n */\n\n\n function getStreamId() {\n return streamInfo.id;\n }\n /**\n * Returns the media type\n * @return {type}\n */\n\n\n function getType() {\n return type;\n }\n /**\n * Returns the type of the BufferController. We distinguish between standard buffer controllers and buffer controllers related to texttracks.\n * @return {string}\n */\n\n\n function getBufferControllerType() {\n return BUFFER_CONTROLLER_TYPE;\n }\n /**\n * Sets the mediasource.\n * @param {object} value\n */\n\n\n function setMediaSource(value) {\n mediaSource = value;\n }\n /**\n * Get the RepresentationInfo for a certain quality.\n * @param {number} quality\n * @return {object}\n * @private\n */\n\n\n function _getRepresentationInfo(quality) {\n return adapter.convertRepresentationToRepresentationInfo(representationController.getRepresentationForQuality(quality));\n }\n /**\n * Creates a SourceBufferSink object\n * @param {object} mediaInfo\n * @param {array} oldBufferSinks\n * @return {object|null} SourceBufferSink\n */\n\n\n function createBufferSink(mediaInfo) {\n var oldBufferSinks = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n return new Promise(function (resolve, reject) {\n if (!initCache || !mediaInfo || !mediaSource) {\n resolve(null);\n return;\n }\n\n var requiredQuality = abrController.getQualityFor(type, streamInfo.id);\n sourceBufferSink = Object(_SourceBufferSink__WEBPACK_IMPORTED_MODULE_3__["default"])(context).create({\n mediaSource: mediaSource,\n textController: textController,\n eventBus: eventBus\n });\n\n _initializeSink(mediaInfo, oldBufferSinks, requiredQuality).then(function () {\n return updateBufferTimestampOffset(_getRepresentationInfo(requiredQuality));\n }).then(function () {\n resolve(sourceBufferSink);\n })["catch"](function (e) {\n logger.fatal(\'Caught error on create SourceBuffer: \' + e);\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_9__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__["default"].MEDIASOURCE_TYPE_UNSUPPORTED_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_10__["default"].MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE + type));\n reject(e);\n });\n });\n }\n\n function _initializeSink(mediaInfo, oldBufferSinks, requiredQuality) {\n var selectedRepresentation = _getRepresentationInfo(requiredQuality);\n\n if (oldBufferSinks && oldBufferSinks[type] && (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO)) {\n return sourceBufferSink.initializeForStreamSwitch(mediaInfo, selectedRepresentation, oldBufferSinks[type]);\n } else {\n return sourceBufferSink.initializeForFirstUse(streamInfo, mediaInfo, selectedRepresentation);\n }\n }\n /**\n * Callback handler when init segment has been loaded. Based on settings, the init segment is saved to the cache, and appended to the buffer.\n * @param {object} e\n * @private\n */\n\n\n function _onInitFragmentLoaded(e) {\n if (settings.get().streaming.cacheInitSegments) {\n logger.info(\'Init fragment finished loading saving to\', type + \'\\\'s init cache\');\n initCache.save(e.chunk);\n }\n\n logger.debug(\'Append Init fragment\', type, \' with representationId:\', e.chunk.representationId, \' and quality:\', e.chunk.quality, \', data size:\', e.chunk.bytes.byteLength);\n\n _appendToBuffer(e.chunk);\n }\n /**\n * Append the init segment for a certain representation to the buffer. If the init segment is cached we take the one from the cache. Otherwise the function returns false and the segment has to be requested again.\n * @param {string} representationId\n * @return {boolean}\n */\n\n\n function appendInitSegmentFromCache(representationId) {\n // Get init segment from cache\n var chunk = initCache.extract(streamInfo.id, representationId);\n\n if (!chunk) {\n // Init segment not in cache, shall be requested\n return false;\n } // Append init segment into buffer\n\n\n logger.info(\'Append Init fragment\', type, \' with representationId:\', chunk.representationId, \' and quality:\', chunk.quality, \', data size:\', chunk.bytes.byteLength);\n\n _appendToBuffer(chunk);\n\n return true;\n }\n /**\n * Calls the _appendToBuffer function to append the segment to the buffer. In case of a track switch the buffer might be cleared.\n * @param {object} e\n */\n\n\n function _onMediaFragmentLoaded(e) {\n _appendToBuffer(e.chunk, e.request);\n }\n /**\n * Append data to the MSE buffer using the SourceBufferSink\n * @param {object} chunk\n * @private\n */\n\n\n function _appendToBuffer(chunk) {\n var request = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n sourceBufferSink.append(chunk, request).then(function (e) {\n _onAppended(e);\n })["catch"](function (e) {\n _onAppended(e);\n });\n\n if (chunk.mediaInfo.type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO) {\n _triggerEvent(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].VIDEO_CHUNK_RECEIVED, {\n chunk: chunk\n });\n }\n }\n\n function _showBufferRanges(ranges) {\n if (ranges && ranges.length > 0) {\n for (var i = 0, len = ranges.length; i < len; i++) {\n logger.debug(\'Buffered range: \' + ranges.start(i) + \' - \' + ranges.end(i) + \', currentTime = \', playbackController.getTime());\n }\n }\n }\n\n function _onAppended(e) {\n if (e.error) {\n // If we receive a QUOTA_EXCEEDED_ERROR_CODE we should adjust the target buffer times to avoid this error in the future.\n if (e.error.code === QUOTA_EXCEEDED_ERROR_CODE) {\n _handleQuotaExceededError();\n }\n\n if (e.error.code === QUOTA_EXCEEDED_ERROR_CODE || !hasEnoughSpaceToAppend()) {\n logger.warn(\'Clearing playback buffer to overcome quota exceed situation\'); // Notify ScheduleController to stop scheduling until buffer has been pruned\n\n _triggerEvent(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].QUOTA_EXCEEDED, {\n criticalBufferLevel: criticalBufferLevel,\n quotaExceededTime: e.chunk.start\n });\n\n clearBuffers(getClearRanges());\n }\n\n return;\n } // Check if session has not been stopped in the meantime (while last segment was being appended)\n\n\n if (!sourceBufferSink) return;\n\n _updateBufferLevel();\n\n isQuotaExceeded = false;\n appendedBytesInfo = e.chunk;\n\n if (!appendedBytesInfo || !appendedBytesInfo.endFragment) {\n return;\n }\n\n if (appendedBytesInfo && !isNaN(appendedBytesInfo.index)) {\n maxAppendedIndex = Math.max(appendedBytesInfo.index, maxAppendedIndex);\n\n _checkIfBufferingCompleted();\n }\n\n var ranges = sourceBufferSink.getAllBufferRanges();\n\n if (appendedBytesInfo.segmentType === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_11__["HTTPRequest"].MEDIA_SEGMENT_TYPE) {\n _showBufferRanges(ranges);\n\n _onPlaybackProgression();\n\n _adjustSeekTarget();\n }\n\n if (appendedBytesInfo) {\n _triggerEvent(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].BYTES_APPENDED_END_FRAGMENT, {\n quality: appendedBytesInfo.quality,\n startTime: appendedBytesInfo.start,\n index: appendedBytesInfo.index,\n bufferedRanges: ranges,\n segmentType: appendedBytesInfo.segmentType,\n mediaType: type\n });\n }\n }\n /**\n * In some cases the segment we requested might start at a different time than we initially aimed for. segments timeline/template tolerance.\n * We might need to do an internal seek if there is drift.\n * @private\n */\n\n\n function _adjustSeekTarget() {\n if (isNaN(seekTarget)) return; // Check buffered data only for audio and video\n\n if (type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO && type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO) {\n seekTarget = NaN;\n return;\n } // Check if current buffered range already contains seek target (and current video element time)\n\n\n var currentTime = playbackController.getTime();\n var range = getRangeAt(seekTarget, 0);\n\n if (currentTime === seekTarget && range) {\n seekTarget = NaN;\n return;\n } // Get buffered range corresponding to the seek target\n\n\n var segmentDuration = representationController.getCurrentRepresentation().segmentDuration;\n range = getRangeAt(seekTarget, segmentDuration);\n if (!range) return;\n\n if (settings.get().streaming.buffer.enableSeekDecorrelationFix && Math.abs(currentTime - seekTarget) > segmentDuration) {\n // If current video model time is decorrelated from seek target (and appended buffer) then seek video element\n // (in case of live streams on some browsers/devices for which we can\'t set video element time at unavalaible range)\n // Check if appended segment is not anterior from seek target (segments timeline/template tolerance)\n if (seekTarget <= range.end) {\n // Seek video element to seek target or range start if appended buffer starts after seek target (segments timeline/template tolerance)\n playbackController.seek(Math.max(seekTarget, range.start), false, true);\n seekTarget = NaN;\n }\n } else if (currentTime < range.start) {\n // If appended buffer starts after seek target (segments timeline/template tolerance) then seek to range start\n playbackController.seek(range.start, false, true);\n seekTarget = NaN;\n }\n }\n\n function _handleQuotaExceededError() {\n isQuotaExceeded = true;\n criticalBufferLevel = getTotalBufferedTime() * 0.8;\n logger.warn(\'Quota exceeded, Critical Buffer: \' + criticalBufferLevel);\n\n if (criticalBufferLevel > 0) {\n // recalculate buffer lengths according to criticalBufferLevel\n var bufferToKeep = Math.max(0.2 * criticalBufferLevel, 1);\n var bufferAhead = criticalBufferLevel - bufferToKeep;\n var bufferTimeAtTopQuality = Math.min(settings.get().streaming.buffer.bufferTimeAtTopQuality, bufferAhead * 0.9);\n var bufferTimeAtTopQualityLongForm = Math.min(settings.get().streaming.buffer.bufferTimeAtTopQualityLongForm, bufferAhead * 0.9);\n var s = {\n streaming: {\n buffer: {\n bufferToKeep: parseFloat(bufferToKeep.toFixed(5)),\n bufferTimeAtTopQuality: parseFloat(bufferTimeAtTopQuality.toFixed(5)),\n bufferTimeAtTopQualityLongForm: parseFloat(bufferTimeAtTopQualityLongForm.toFixed(5))\n }\n }\n };\n settings.update(s);\n }\n } //**********************************************************************\n // START Buffer Level, State & Sufficiency Handling.\n //**********************************************************************\n\n\n function prepareForPlaybackSeek() {\n if (isBufferingCompleted) {\n setIsBufferingCompleted(false);\n } // Abort the current request and empty all possible segments to be appended\n\n\n return sourceBufferSink.abort();\n }\n\n function prepareForReplacementTrackSwitch(codec) {\n return new Promise(function (resolve, reject) {\n sourceBufferSink.abort().then(function () {\n return updateAppendWindow();\n }).then(function () {\n return sourceBufferSink.changeType(codec);\n }).then(function () {\n return pruneAllSafely();\n }).then(function () {\n setIsBufferingCompleted(false);\n resolve();\n })["catch"](function (e) {\n reject(e);\n });\n });\n }\n\n function prepareForReplacementQualitySwitch() {\n return new Promise(function (resolve, reject) {\n sourceBufferSink.abort().then(function () {\n return updateAppendWindow();\n }).then(function () {\n return pruneAllSafely();\n }).then(function () {\n setIsBufferingCompleted(false);\n resolve();\n })["catch"](function (e) {\n reject(e);\n });\n });\n }\n\n function prepareForNonReplacementTrackSwitch(codec) {\n return new Promise(function (resolve, reject) {\n updateAppendWindow().then(function () {\n return sourceBufferSink.changeType(codec);\n }).then(function () {\n resolve();\n })["catch"](function (e) {\n reject(e);\n });\n });\n }\n\n function pruneAllSafely() {\n return new Promise(function (resolve, reject) {\n var ranges = getAllRangesWithSafetyFactor();\n\n if (!ranges || ranges.length === 0) {\n _onPlaybackProgression();\n\n resolve();\n return;\n }\n\n clearBuffers(ranges).then(function () {\n resolve();\n })["catch"](function (e) {\n reject(e);\n });\n });\n }\n\n function getAllRangesWithSafetyFactor(seekTime) {\n var clearRanges = [];\n var ranges = sourceBufferSink.getAllBufferRanges(); // no valid ranges\n\n if (!ranges || ranges.length === 0) {\n return clearRanges;\n } // if no target time is provided we clear everyhing\n\n\n if (!seekTime && seekTime !== 0 || isNaN(seekTime)) {\n clearRanges.push({\n start: ranges.start(0),\n end: ranges.end(ranges.length - 1) + BUFFER_END_THRESHOLD\n });\n } // otherwise we need to calculate the correct pruning range\n else {\n var behindPruningRange = _getRangeBehindForPruning(seekTime, ranges);\n\n var aheadPruningRange = _getRangeAheadForPruning(seekTime, ranges);\n\n if (behindPruningRange) {\n clearRanges.push(behindPruningRange);\n }\n\n if (aheadPruningRange) {\n clearRanges.push(aheadPruningRange);\n }\n }\n\n return clearRanges;\n }\n\n function _getRangeBehindForPruning(targetTime, ranges) {\n var bufferToKeepBehind = settings.get().streaming.buffer.bufferToKeep;\n var startOfBuffer = ranges.start(0); // if we do a seek ahead of the current play position we do need to prune behind the new play position\n\n var behindDiff = targetTime - startOfBuffer;\n\n if (behindDiff > bufferToKeepBehind) {\n var rangeEnd = Math.max(0, targetTime - bufferToKeepBehind); // Ensure we keep full range of current fragment\n\n var currentTimeRequest = fragmentModel.getRequests({\n state: _models_FragmentModel__WEBPACK_IMPORTED_MODULE_2__["default"].FRAGMENT_MODEL_EXECUTED,\n time: targetTime,\n threshold: BUFFER_RANGE_CALCULATION_THRESHOLD\n })[0];\n\n if (currentTimeRequest) {\n rangeEnd = Math.min(currentTimeRequest.startTime, rangeEnd);\n }\n\n if (rangeEnd > 0) {\n return {\n start: startOfBuffer,\n end: rangeEnd\n };\n }\n }\n\n return null;\n }\n\n function _getRangeAheadForPruning(targetTime, ranges) {\n // if we do a seek behind the current play position we do need to prune ahead of the new play position\n var endOfBuffer = ranges.end(ranges.length - 1) + BUFFER_END_THRESHOLD;\n var isLongFormContent = streamInfo.manifestInfo.duration >= settings.get().streaming.buffer.longFormContentDurationThreshold;\n var bufferToKeepAhead = isLongFormContent ? settings.get().streaming.buffer.bufferTimeAtTopQualityLongForm : settings.get().streaming.buffer.bufferTimeAtTopQuality;\n var aheadDiff = endOfBuffer - targetTime;\n\n if (aheadDiff > bufferToKeepAhead) {\n var rangeStart = targetTime + bufferToKeepAhead; // Ensure we keep full range of current fragment\n\n var currentTimeRequest = fragmentModel.getRequests({\n state: _models_FragmentModel__WEBPACK_IMPORTED_MODULE_2__["default"].FRAGMENT_MODEL_EXECUTED,\n time: targetTime,\n threshold: BUFFER_RANGE_CALCULATION_THRESHOLD\n })[0];\n\n if (currentTimeRequest) {\n rangeStart = Math.max(currentTimeRequest.startTime + currentTimeRequest.duration, rangeStart);\n }\n\n if (rangeStart < endOfBuffer) {\n return {\n start: rangeStart,\n end: endOfBuffer\n };\n }\n }\n\n return null;\n }\n\n function _onPlaybackProgression() {\n if (!replacingBuffer || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT && textController.isTextEnabled()) {\n _updateBufferLevel();\n }\n }\n\n function _onPlaybackStalled() {\n checkIfSufficientBuffer();\n }\n\n function _onPlaybackPlaying() {\n checkIfSufficientBuffer();\n seekTarget = NaN;\n }\n\n function getRangeAt(time, tolerance) {\n var ranges = sourceBufferSink.getAllBufferRanges();\n var start = 0;\n var end = 0;\n var firstStart = null;\n var lastEnd = null;\n var gap = 0;\n var len, i;\n var toler = !isNaN(tolerance) ? tolerance : 0.15;\n\n if (ranges !== null && ranges !== undefined) {\n for (i = 0, len = ranges.length; i < len; i++) {\n start = ranges.start(i);\n end = ranges.end(i);\n\n if (firstStart === null) {\n gap = Math.abs(start - time);\n\n if (time >= start && time < end) {\n // start the range\n firstStart = start;\n lastEnd = end;\n } else if (gap <= toler) {\n // start the range even though the buffer does not contain time 0\n firstStart = start;\n lastEnd = end;\n }\n } else {\n gap = start - lastEnd;\n\n if (gap <= toler) {\n // the discontinuity is smaller than the tolerance, combine the ranges\n lastEnd = end;\n } else {\n break;\n }\n }\n }\n\n if (firstStart !== null) {\n return {\n start: firstStart,\n end: lastEnd\n };\n }\n }\n\n return null;\n }\n\n function getBufferLength(time, tolerance) {\n var range, length; // Consider gap/discontinuity limit as tolerance\n\n if (settings.get().streaming.gaps.jumpGaps) {\n tolerance = settings.get().streaming.gaps.smallGapLimit;\n }\n\n range = getRangeAt(time, tolerance);\n\n if (range === null) {\n length = 0;\n } else {\n length = range.end - time;\n }\n\n return length;\n }\n\n function _updateBufferLevel() {\n if (playbackController) {\n var tolerance = settings.get().streaming.gaps.jumpGaps && !isNaN(settings.get().streaming.gaps.smallGapLimit) ? settings.get().streaming.gaps.smallGapLimit : NaN;\n bufferLevel = Math.max(getBufferLength(playbackController.getTime() || 0, tolerance), 0);\n\n _triggerEvent(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].BUFFER_LEVEL_UPDATED, {\n mediaType: type,\n bufferLevel: bufferLevel\n });\n\n checkIfSufficientBuffer();\n }\n }\n\n function _checkIfBufferingCompleted() {\n var isLastIdxAppended = maxAppendedIndex >= maximumIndex - 1; // Handles 0 and non 0 based request index\n\n var periodBuffered = playbackController.getTimeToStreamEnd(streamInfo) - bufferLevel <= 0;\n\n if ((isLastIdxAppended || periodBuffered) && !isBufferingCompleted) {\n setIsBufferingCompleted(true);\n logger.debug("checkIfBufferingCompleted trigger BUFFERING_COMPLETED for stream id ".concat(streamInfo.id, " and type ").concat(type));\n }\n }\n\n function checkIfSufficientBuffer() {\n // No need to check buffer if type is not audio or video (for example if several errors occur during text parsing, so that the buffer cannot be filled, no error must occur on video playback)\n if (type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO && type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO) return; // When the player is working in low latency mode, the buffer is often below STALL_THRESHOLD.\n // So, when in low latency mode, change dash.js behavior so it notifies a stall just when\n // buffer reach 0 seconds\n\n if ((!settings.get().streaming.lowLatencyEnabled && bufferLevel < settings.get().streaming.buffer.stallThreshold || bufferLevel === 0) && !isBufferingCompleted) {\n _notifyBufferStateChanged(_constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_EMPTY);\n } else {\n if (isBufferingCompleted || bufferLevel >= settings.get().streaming.buffer.stallThreshold || settings.get().streaming.lowLatencyEnabled && bufferLevel > 0) {\n _notifyBufferStateChanged(_constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_LOADED);\n }\n }\n }\n\n function _notifyBufferStateChanged(state) {\n if (bufferState === state || state === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_EMPTY && playbackController.getTime() === 0 || // Don\'t trigger BUFFER_EMPTY if it\'s initial loading\n type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT && !textController.isTextEnabled()) {\n return;\n }\n\n bufferState = state;\n\n _triggerEvent(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].BUFFER_LEVEL_STATE_CHANGED, {\n state: state\n });\n\n _triggerEvent(state === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_LOADED ? _core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].BUFFER_LOADED : _core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].BUFFER_EMPTY);\n\n logger.debug(state === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_LOADED ? \'Got enough buffer to start\' : \'Waiting for more buffer before starting playback\');\n }\n /* prune buffer on our own in background to avoid browsers pruning buffer silently */\n\n\n function pruneBuffer() {\n if (!sourceBufferSink || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT) {\n return;\n }\n\n if (!isBufferingCompleted) {\n clearBuffers(getClearRanges());\n }\n }\n\n function getClearRanges() {\n var clearRanges = [];\n var ranges = sourceBufferSink.getAllBufferRanges();\n\n if (!ranges || ranges.length === 0) {\n return clearRanges;\n }\n\n var currentTime = playbackController.getTime();\n var startRangeToKeep = Math.max(0, currentTime - settings.get().streaming.buffer.bufferToKeep);\n var currentTimeRequest = fragmentModel.getRequests({\n state: _models_FragmentModel__WEBPACK_IMPORTED_MODULE_2__["default"].FRAGMENT_MODEL_EXECUTED,\n time: currentTime,\n threshold: BUFFER_RANGE_CALCULATION_THRESHOLD\n })[0]; // Ensure we keep full range of current fragment\n\n if (currentTimeRequest) {\n startRangeToKeep = Math.min(currentTimeRequest.startTime, startRangeToKeep);\n } else if (currentTime === 0 && playbackController.getIsDynamic()) {\n // Don\'t prune before the live stream starts, it messes with low latency\n return [];\n }\n\n if (ranges.start(0) <= startRangeToKeep) {\n var behindRange = {\n start: 0,\n end: startRangeToKeep\n };\n\n for (var i = 0; i < ranges.length && ranges.end(i) <= startRangeToKeep; i++) {\n behindRange.end = ranges.end(i);\n }\n\n if (behindRange.start < behindRange.end) {\n clearRanges.push(behindRange);\n }\n }\n\n return clearRanges;\n }\n\n function clearBuffers(ranges) {\n return new Promise(function (resolve, reject) {\n if (!ranges || !sourceBufferSink || ranges.length === 0) {\n resolve();\n return;\n }\n\n var promises = [];\n ranges.forEach(function (range) {\n promises.push(_addClearRangeWithPromise(range));\n });\n\n if (!isPruningInProgress) {\n clearNextRange();\n }\n\n Promise.all(promises).then(function () {\n resolve();\n })["catch"](function (e) {\n reject(e);\n });\n });\n }\n\n function _addClearRangeWithPromise(range) {\n return new Promise(function (resolve, reject) {\n range.resolve = resolve;\n range.reject = reject;\n pendingPruningRanges.push(range);\n });\n }\n\n function clearNextRange() {\n try {\n // If there\'s nothing to prune reset state\n if (pendingPruningRanges.length === 0 || !sourceBufferSink) {\n logger.debug(\'Nothing to prune, halt pruning\');\n pendingPruningRanges = [];\n isPruningInProgress = false;\n return;\n }\n\n var sourceBuffer = sourceBufferSink.getBuffer(); // If there\'s nothing buffered any pruning is invalid, so reset our state\n\n if (!sourceBuffer || !sourceBuffer.buffered || sourceBuffer.buffered.length === 0) {\n logger.debug(\'SourceBuffer is empty (or does not exist), halt pruning\');\n pendingPruningRanges = [];\n isPruningInProgress = false;\n return;\n }\n\n var range = pendingPruningRanges.shift();\n logger.debug("".concat(type, ": Removing buffer from: ").concat(range.start, " to ").concat(range.end));\n isPruningInProgress = true; // If removing buffer ahead current playback position, update maxAppendedIndex\n\n var currentTime = playbackController.getTime();\n\n if (currentTime < range.end) {\n setIsBufferingCompleted(false);\n }\n\n sourceBufferSink.remove(range).then(function (e) {\n _onRemoved(e);\n })["catch"](function (e) {\n _onRemoved(e);\n });\n } catch (e) {\n isPruningInProgress = false;\n }\n }\n\n function _onRemoved(e) {\n logger.debug(\'onRemoved buffer from:\', e.from, \'to\', e.to);\n var ranges = sourceBufferSink.getAllBufferRanges();\n\n _showBufferRanges(ranges);\n\n if (pendingPruningRanges.length === 0) {\n isPruningInProgress = false;\n\n _updateBufferLevel();\n }\n\n if (e.unintended) {\n logger.warn(\'Detected unintended removal from:\', e.from, \'to\', e.to, \'setting streamprocessor time to\', e.from);\n\n _triggerEvent(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].SEEK_TARGET, {\n time: e.from\n });\n }\n\n if (isPruningInProgress) {\n clearNextRange();\n } else {\n if (!replacingBuffer) {\n _updateBufferLevel();\n } else {\n replacingBuffer = false;\n }\n\n _triggerEvent(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].BUFFER_CLEARED, {\n from: e.from,\n to: e.to,\n unintended: e.unintended,\n hasEnoughSpaceToAppend: hasEnoughSpaceToAppend(),\n quotaExceeded: isQuotaExceeded\n });\n }\n }\n\n function updateBufferTimestampOffset(representationInfo) {\n return new Promise(function (resolve) {\n if (!representationInfo || representationInfo.MSETimeOffset === undefined || !sourceBufferSink || !sourceBufferSink.updateTimestampOffset) {\n resolve();\n return;\n } // Each track can have its own @presentationTimeOffset, so we should set the offset\n // if it has changed after switching the quality or updating an mpd\n\n\n sourceBufferSink.updateTimestampOffset(representationInfo.MSETimeOffset).then(function () {\n resolve();\n })["catch"](function () {\n resolve();\n });\n });\n }\n\n function updateAppendWindow() {\n if (sourceBufferSink && !isBufferingCompleted) {\n return sourceBufferSink.updateAppendWindow(streamInfo);\n }\n\n return Promise.resolve();\n }\n\n function segmentRequestingCompleted(segmentIndex) {\n if (!isNaN(segmentIndex)) {\n maximumIndex = segmentIndex;\n\n _checkIfBufferingCompleted();\n }\n }\n\n function _onWallclockTimeUpdated() {\n wallclockTicked++;\n var secondsElapsed = wallclockTicked * (settings.get().streaming.wallclockTimeUpdateInterval / 1000);\n\n if (secondsElapsed >= settings.get().streaming.buffer.bufferPruningInterval) {\n wallclockTicked = 0;\n pruneBuffer();\n }\n }\n\n function _onPlaybackRateChanged() {\n checkIfSufficientBuffer();\n }\n\n function getBuffer() {\n return sourceBufferSink;\n }\n\n function getBufferLevel() {\n return bufferLevel;\n }\n\n function getMediaSource() {\n return mediaSource;\n }\n\n function getIsBufferingCompleted() {\n return isBufferingCompleted;\n }\n\n function setIsBufferingCompleted(value) {\n if (isBufferingCompleted === value) {\n return;\n }\n\n isBufferingCompleted = value;\n\n if (isBufferingCompleted) {\n _triggerEvent(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].BUFFERING_COMPLETED);\n } else {\n maximumIndex = Number.POSITIVE_INFINITY;\n }\n }\n\n function getIsPruningInProgress() {\n return isPruningInProgress;\n }\n\n function getTotalBufferedTime() {\n try {\n var ranges = sourceBufferSink.getAllBufferRanges();\n var totalBufferedTime = 0;\n var ln, i;\n if (!ranges) return totalBufferedTime;\n\n for (i = 0, ln = ranges.length; i < ln; i++) {\n totalBufferedTime += ranges.end(i) - ranges.start(i);\n }\n\n return totalBufferedTime;\n } catch (e) {\n return 0;\n }\n }\n /**\n * This function returns the maximum time for which the buffer is continuous starting from a target time.\n * As soon as there is a gap we return the time before the gap starts\n * @param {number} targetTime\n */\n\n\n function getContinuousBufferTimeForTargetTime(targetTime) {\n try {\n var adjustedTime = targetTime;\n var ranges = sourceBufferSink.getAllBufferRanges();\n\n if (!ranges || ranges.length === 0) {\n return targetTime;\n }\n\n var i = 0;\n\n while (adjustedTime === targetTime && i < ranges.length) {\n var start = ranges.start(i);\n var end = ranges.end(i);\n\n if (adjustedTime >= start && adjustedTime <= end) {\n adjustedTime = end;\n }\n\n i += 1;\n }\n\n return adjustedTime;\n } catch (e) {}\n }\n\n function hasEnoughSpaceToAppend() {\n var totalBufferedTime = getTotalBufferedTime();\n return isNaN(totalBufferedTime) || totalBufferedTime < criticalBufferLevel;\n }\n\n function setSeekTarget(value) {\n seekTarget = value;\n }\n\n function _triggerEvent(eventType, data) {\n var payload = data || {};\n eventBus.trigger(eventType, payload, {\n streamId: streamInfo.id,\n mediaType: type\n });\n }\n\n function resetInitialSettings(errored, keepBuffers) {\n criticalBufferLevel = Number.POSITIVE_INFINITY;\n bufferState = undefined;\n maximumIndex = Number.POSITIVE_INFINITY;\n maxAppendedIndex = 0;\n appendedBytesInfo = null;\n isBufferingCompleted = false;\n isPruningInProgress = false;\n isQuotaExceeded = false;\n bufferLevel = 0;\n wallclockTicked = 0;\n pendingPruningRanges = [];\n seekTarget = NaN;\n\n if (sourceBufferSink) {\n if (!errored && !keepBuffers) {\n sourceBufferSink.abort().then(function () {\n sourceBufferSink.reset(keepBuffers);\n sourceBufferSink = null;\n });\n } else {\n sourceBufferSink = null;\n }\n }\n\n replacingBuffer = false;\n }\n\n function reset(errored, keepBuffers) {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].INIT_FRAGMENT_LOADED, _onInitFragmentLoaded, this);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].MEDIA_FRAGMENT_LOADED, _onMediaFragmentLoaded, this);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].WALLCLOCK_TIME_UPDATED, _onWallclockTimeUpdated, this);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_12__["default"].PLAYBACK_PLAYING, _onPlaybackPlaying, this);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_12__["default"].PLAYBACK_PROGRESS, _onPlaybackProgression, this);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_12__["default"].PLAYBACK_TIME_UPDATED, _onPlaybackProgression, this);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_12__["default"].PLAYBACK_RATE_CHANGED, _onPlaybackRateChanged, this);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_12__["default"].PLAYBACK_STALLED, _onPlaybackStalled, this);\n resetInitialSettings(errored, keepBuffers);\n }\n\n instance = {\n initialize: initialize,\n getStreamId: getStreamId,\n getType: getType,\n getBufferControllerType: getBufferControllerType,\n createBufferSink: createBufferSink,\n getBuffer: getBuffer,\n getBufferLevel: getBufferLevel,\n getRangeAt: getRangeAt,\n setMediaSource: setMediaSource,\n getMediaSource: getMediaSource,\n appendInitSegmentFromCache: appendInitSegmentFromCache,\n getIsBufferingCompleted: getIsBufferingCompleted,\n setIsBufferingCompleted: setIsBufferingCompleted,\n getIsPruningInProgress: getIsPruningInProgress,\n reset: reset,\n prepareForPlaybackSeek: prepareForPlaybackSeek,\n prepareForReplacementTrackSwitch: prepareForReplacementTrackSwitch,\n prepareForNonReplacementTrackSwitch: prepareForNonReplacementTrackSwitch,\n prepareForReplacementQualitySwitch: prepareForReplacementQualitySwitch,\n updateAppendWindow: updateAppendWindow,\n getAllRangesWithSafetyFactor: getAllRangesWithSafetyFactor,\n getContinuousBufferTimeForTargetTime: getContinuousBufferTimeForTargetTime,\n clearBuffers: clearBuffers,\n pruneAllSafely: pruneAllSafely,\n updateBufferTimestampOffset: updateBufferTimestampOffset,\n setSeekTarget: setSeekTarget,\n segmentRequestingCompleted: segmentRequestingCompleted\n };\n setup();\n return instance;\n}\n\nBufferController.__dashjs_factory_name = BUFFER_CONTROLLER_TYPE;\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_6__["default"].getClassFactory(BufferController));\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/EventController.js":\n/*!******************************************************!*\\\n !*** ./src/streaming/controllers/EventController.js ***!\n \\******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1382329__) {\n__nested_webpack_require_1382329__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1382329__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1382329__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1382329__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1382329__(/*! ../../streaming/MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _net_XHRLoader__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1382329__(/*! ../net/XHRLoader */ "./src/streaming/net/XHRLoader.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\nfunction EventController() {\n var MPD_RELOAD_SCHEME = \'urn:mpeg:dash:event:2012\';\n var MPD_RELOAD_VALUE = 1;\n var MPD_CALLBACK_SCHEME = \'urn:mpeg:dash:event:callback:2015\';\n var MPD_CALLBACK_VALUE = 1;\n var REMAINING_EVENTS_THRESHOLD = 300;\n var EVENT_HANDLED_STATES = {\n DISCARDED: \'discarded\',\n UPDATED: \'updated\',\n ADDED: \'added\'\n };\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance();\n var instance, logger, inlineEvents, // Holds all Inline Events not triggered yet\n inbandEvents, // Holds all Inband Events not triggered yet\n eventInterval, // variable holding the setInterval\n lastEventTimerCall, manifestUpdater, playbackController, settings, eventHandlingInProgress, isStarted;\n /**\n * Internal setup when class is instanced\n */\n\n function _setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance().getLogger(instance);\n\n _resetInitialSettings();\n }\n /**\n * Checks if the provded configuration is valid\n */\n\n\n function checkConfig() {\n if (!manifestUpdater || !playbackController) {\n throw new Error(\'setConfig function has to be called previously\');\n }\n }\n /**\n * Reset to initial settings\n */\n\n\n function _resetInitialSettings() {\n isStarted = false;\n inlineEvents = {}; // Format inlineEvents[schemeIdUri]\n\n inbandEvents = {}; // Format inlineEvents[schemeIdUri]\n\n eventInterval = null;\n eventHandlingInProgress = false;\n lastEventTimerCall = Date.now() / 1000;\n }\n /**\n * Stops the EventController by clearing the event interval\n */\n\n\n function _stop() {\n try {\n if (eventInterval !== null && isStarted) {\n clearInterval(eventInterval);\n eventInterval = null;\n isStarted = false;\n\n _onStopEventController();\n }\n } catch (e) {\n throw e;\n }\n }\n /**\n * Starts the interval function of the EventController\n */\n\n\n function start() {\n try {\n checkConfig();\n logger.debug(\'Start Event Controller\');\n var refreshDelay = settings.get().streaming.eventControllerRefreshDelay;\n\n if (!isStarted && !isNaN(refreshDelay)) {\n isStarted = true;\n eventInterval = setInterval(_onEventTimer, refreshDelay);\n }\n } catch (e) {\n throw e;\n }\n }\n /**\n * Add MPD events to the list of events.\n * Events that are not in the MPD anymore but not triggered yet will still be deleted.\n * Existing events might get updated.\n * @param {Array.<Object>} values\n */\n\n\n function addInlineEvents(values) {\n try {\n checkConfig();\n\n if (values) {\n for (var i = 0; i < values.length; i++) {\n var event = values[i];\n\n var result = _addOrUpdateEvent(event, inlineEvents, true);\n\n if (result === EVENT_HANDLED_STATES.ADDED) {\n logger.debug("Added inline event with id ".concat(event.id)); // If we see the event for the first time we trigger it in onReceive mode\n\n _startEvent(event, values, _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].EVENT_MODE_ON_RECEIVE);\n } else if (result === EVENT_HANDLED_STATES.UPDATED) {\n logger.debug("Updated inline event with id ".concat(event.id));\n }\n }\n }\n } catch (e) {\n throw e;\n }\n }\n /**\n * Add EMSG events to the list of events\n * Messages with the same id within the scope of the same scheme_id_uri and value pair are equivalent , i.e. processing of any one event message box with the same id is sufficient.\n * @param {Array.<Object>} values\n */\n\n\n function addInbandEvents(values) {\n try {\n checkConfig();\n\n for (var i = 0; i < values.length; i++) {\n var event = values[i];\n\n var result = _addOrUpdateEvent(event, inbandEvents, false);\n\n if (result === EVENT_HANDLED_STATES.ADDED) {\n if (event.eventStream.schemeIdUri === MPD_RELOAD_SCHEME && inbandEvents[event.id] === undefined) {\n _handleManifestReloadEvent(event);\n }\n\n logger.debug(\'Added inband event with id \' + event.id);\n\n _startEvent(event, values, _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].EVENT_MODE_ON_RECEIVE);\n } else {\n logger.debug("Inband event with scheme_id_uri ".concat(event.eventStream.schemeIdUri, ", value ").concat(event.eventStream.value, " and id ").concat(event.id, " was ignored because it has been added before."));\n }\n }\n\n _onEventTimer();\n } catch (e) {\n throw e;\n }\n }\n /**\n * Adds or updates an event to/in the list of events\n * @param {object} event\n * @param {object} events\n * @param {boolean} shouldOverwriteExistingEvents\n * @return {string}\n * @private\n */\n\n\n function _addOrUpdateEvent(event, events) {\n var shouldOverwriteExistingEvents = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var schemeIdUri = event.eventStream.schemeIdUri;\n var value = event.eventStream.value;\n var id = event.id;\n var eventState = EVENT_HANDLED_STATES.DISCARDED;\n\n if (!events[schemeIdUri]) {\n events[schemeIdUri] = [];\n }\n\n var indexOfExistingEvent = events[schemeIdUri].findIndex(function (e) {\n return (!value || e.eventStream.value && e.eventStream.value === value) && e.id === id;\n });\n\n if (indexOfExistingEvent === -1) {\n events[schemeIdUri].push(event);\n eventState = EVENT_HANDLED_STATES.ADDED;\n } else if (shouldOverwriteExistingEvents) {\n events[schemeIdUri][indexOfExistingEvent] = event;\n eventState = EVENT_HANDLED_STATES.UPDATED;\n }\n\n return eventState;\n }\n /**\n * Triggers an MPD reload\n * @param {object} event\n * @private\n */\n\n\n function _handleManifestReloadEvent(event) {\n try {\n if (event.eventStream.value == MPD_RELOAD_VALUE) {\n var validUntil = event.calculatedPresentationTime;\n var newDuration;\n\n if (event.calculatedPresentationTime == 0xFFFFFFFF) {\n //0xFF... means remaining duration unknown\n newDuration = NaN;\n } else {\n newDuration = event.calculatedPresentationTime + event.duration;\n } //logger.info(\'Manifest validity changed: Valid until: \' + validUntil + \'; remaining duration: \' + newDuration);\n\n\n eventBus.trigger(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].MANIFEST_VALIDITY_CHANGED, {\n id: event.id,\n validUntil: validUntil,\n newDuration: newDuration,\n newManifestValidAfter: NaN //event.message_data - this is an arraybuffer with a timestring in it, but not used yet\n\n }, {\n mode: _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].EVENT_MODE_ON_START\n });\n }\n } catch (e) {}\n }\n /**\n * Iterate through the eventList and trigger the events\n */\n\n\n function _onEventTimer() {\n try {\n if (!eventHandlingInProgress) {\n eventHandlingInProgress = true;\n var currentVideoTime = playbackController.getTime();\n var presentationTimeThreshold = currentVideoTime - lastEventTimerCall; // For dynamic streams lastEventTimeCall will be large in the first iteration. Avoid firing all events at once.\n\n presentationTimeThreshold = lastEventTimerCall > 0 ? Math.max(0, presentationTimeThreshold) : 0;\n\n _triggerEvents(inbandEvents, presentationTimeThreshold, currentVideoTime);\n\n _triggerEvents(inlineEvents, presentationTimeThreshold, currentVideoTime);\n\n lastEventTimerCall = currentVideoTime;\n eventHandlingInProgress = false;\n }\n } catch (e) {\n eventHandlingInProgress = false;\n }\n }\n /**\n * When the EventController is stopped this callback is triggered. Starts the remaining events.\n * @private\n */\n\n\n function _onStopEventController() {\n try {\n // EventController might be stopped before the period is over. Before we stop the event controller we check for events that needs to be triggered at the period boundary.\n _triggerRemainingEvents(inbandEvents);\n\n _triggerRemainingEvents(inlineEvents);\n } catch (e) {}\n }\n /**\n * Iterate over a list of events and trigger the ones for which the presentation time is within the current timing interval\n * @param {object} events\n * @param {number} presentationTimeThreshold\n * @param {number} currentVideoTime\n * @private\n */\n\n\n function _triggerEvents(events, presentationTimeThreshold, currentVideoTime) {\n try {\n var callback = function callback(event) {\n if (event !== undefined) {\n var duration = !isNaN(event.duration) ? event.duration : 0; // The event is either about to start or has already been started and we are within its duration\n\n if (event.calculatedPresentationTime <= currentVideoTime && event.calculatedPresentationTime + presentationTimeThreshold + duration >= currentVideoTime) {\n _startEvent(event, events, _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].EVENT_MODE_ON_START);\n } else if (_eventHasExpired(currentVideoTime, duration + presentationTimeThreshold, event.calculatedPresentationTime) || _eventIsInvalid(event)) {\n logger.debug("Deleting event ".concat(event.id, " as it is expired or invalid"));\n\n _removeEvent(events, event);\n }\n }\n };\n\n _iterateAndTriggerCallback(events, callback);\n } catch (e) {}\n }\n /**\n * Triggers the remaining events after the EventController has been stopped\n * @param {object} events\n * @private\n */\n\n\n function _triggerRemainingEvents(events) {\n try {\n var currentTime = playbackController.getTime();\n\n var callback = function callback(event) {\n var periodDuration = event.eventStream && event.eventStream.period && !isNaN(event.eventStream.period.duration) ? event.eventStream.period.duration : NaN;\n var periodStart = event.eventStream && event.eventStream.period && !isNaN(event.eventStream.period.start) ? event.eventStream.period.start : NaN;\n\n if (isNaN(periodDuration) || isNaN(periodStart)) {\n return;\n }\n\n var calculatedPresentationTimeInSeconds = event.calculatedPresentationTime;\n\n if (Math.abs(calculatedPresentationTimeInSeconds - currentTime) < REMAINING_EVENTS_THRESHOLD) {\n _startEvent(event, events, _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].EVENT_MODE_ON_START);\n }\n };\n\n _iterateAndTriggerCallback(events, callback);\n } catch (e) {}\n }\n /**\n * Iterates over the inline/inband event object and triggers a callback for each event\n * @param {object} events\n * @param {function} callback\n * @private\n */\n\n\n function _iterateAndTriggerCallback(events, callback) {\n try {\n if (events) {\n var schemeIdUris = Object.keys(events);\n\n for (var i = 0; i < schemeIdUris.length; i++) {\n var schemeIdEvents = events[schemeIdUris[i]];\n schemeIdEvents.forEach(function (event) {\n if (event !== undefined) {\n callback(event);\n }\n });\n }\n }\n } catch (e) {}\n }\n /**\n * Checks if an event is expired. For instance if the presentationTime + the duration of an event are smaller than the current video time.\n * @param {number} currentVideoTime\n * @param {number} threshold\n * @param {number} calculatedPresentationTimeInSeconds\n * @return {boolean}\n * @private\n */\n\n\n function _eventHasExpired(currentVideoTime, threshold, calculatedPresentationTimeInSeconds) {\n try {\n return currentVideoTime - threshold > calculatedPresentationTimeInSeconds;\n } catch (e) {\n return false;\n }\n }\n /**\n * Checks if an event is invalid. This is the case if the end time of the parent period is smaller than the presentation time of the event.\n * @param {object} event\n * @return {boolean}\n * @private\n */\n\n\n function _eventIsInvalid(event) {\n try {\n var periodEndTime = event.eventStream.period.start + event.eventStream.period.duration;\n return event.calculatedPresentationTime > periodEndTime;\n } catch (e) {\n return false;\n }\n }\n /**\n * Starts an event. Depending on the schemeIdUri we distinguis between\n * - MPD Reload events\n * - MPD Callback events\n * - Events to be dispatched to the application\n * Events should be removed from the list before beeing triggered. Otherwise the event handler might cause an error and the remove function will not be called.\n * @param {object} event\n * @param {object} events\n * @param {String} mode\n * @private\n */\n\n\n function _startEvent(event, events, mode) {\n try {\n var currentVideoTime = playbackController.getTime();\n var eventId = event.id;\n\n if (mode === _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].EVENT_MODE_ON_RECEIVE) {\n logger.debug("Received event ".concat(eventId));\n eventBus.trigger(event.eventStream.schemeIdUri, {\n event: event\n }, {\n mode: mode\n });\n return;\n }\n\n if (event.eventStream.schemeIdUri === MPD_RELOAD_SCHEME && event.eventStream.value == MPD_RELOAD_VALUE) {\n if (event.duration !== 0 || event.presentationTimeDelta !== 0) {\n //If both are set to zero, it indicates the media is over at this point. Don\'t reload the manifest.\n logger.debug("Starting manifest refresh event ".concat(eventId, " at ").concat(currentVideoTime));\n\n _removeEvent(events, event);\n\n _refreshManifest();\n }\n } else if (event.eventStream.schemeIdUri === MPD_CALLBACK_SCHEME && event.eventStream.value == MPD_CALLBACK_VALUE) {\n logger.debug("Starting callback event ".concat(eventId, " at ").concat(currentVideoTime));\n\n _removeEvent(events, event);\n\n _sendCallbackRequest(event.messageData);\n } else {\n logger.debug("Starting event ".concat(eventId, " at ").concat(currentVideoTime));\n\n _removeEvent(events, event);\n\n eventBus.trigger(event.eventStream.schemeIdUri, {\n event: event\n }, {\n mode: mode\n });\n }\n } catch (e) {}\n }\n /**\n * Removes an event from the list. If this is the last event of type "schemeIdUri" the corresponding schemeIdUri Object in the list of events is deleted.\n * @param {object} events\n * @param {object} event\n * @private\n */\n\n\n function _removeEvent(events, event) {\n var schemeIdUri = event.eventStream.schemeIdUri;\n var value = event.eventStream.value;\n var id = event.id;\n events[schemeIdUri] = events[schemeIdUri].filter(function (e) {\n return value && e.eventStream.value && e.eventStream.value !== value || e.id !== id;\n });\n\n if (events[schemeIdUri].length === 0) {\n delete events[schemeIdUri];\n }\n }\n /**\n * Refresh the manifest\n * @private\n */\n\n\n function _refreshManifest() {\n try {\n checkConfig();\n manifestUpdater.refreshManifest();\n } catch (e) {}\n }\n /**\n * Send a callback request\n * @param {String} url\n * @private\n */\n\n\n function _sendCallbackRequest(url) {\n try {\n var loader = Object(_net_XHRLoader__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create({});\n loader.load({\n method: \'get\',\n url: url,\n request: {\n responseType: \'arraybuffer\'\n }\n });\n } catch (e) {\n throw e;\n }\n }\n /**\n * Set the config of the EventController\n * @param {object} config\n */\n\n\n function setConfig(config) {\n try {\n if (!config) {\n return;\n }\n\n if (config.manifestUpdater) {\n manifestUpdater = config.manifestUpdater;\n }\n\n if (config.playbackController) {\n playbackController = config.playbackController;\n }\n\n if (config.settings) {\n settings = config.settings;\n }\n } catch (e) {\n throw e;\n }\n }\n /**\n * Returns all inline events that have not been triggered yet\n * @return {object}\n */\n\n\n function getInlineEvents() {\n return inlineEvents;\n }\n /**\n * Returns all inband events that have not been triggered yet\n * @return {object}\n */\n\n\n function getInbandEvents() {\n return inbandEvents;\n }\n /**\n * Stop the EventController and reset all initial settings\n */\n\n\n function reset() {\n _stop();\n\n _resetInitialSettings();\n }\n\n instance = {\n addInlineEvents: addInlineEvents,\n addInbandEvents: addInbandEvents,\n getInbandEvents: getInbandEvents,\n getInlineEvents: getInlineEvents,\n start: start,\n setConfig: setConfig,\n reset: reset\n };\n\n _setup();\n\n return instance;\n}\n\nEventController.__dashjs_factory_name = \'EventController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(EventController));\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/FragmentController.js":\n/*!*********************************************************!*\\\n !*** ./src/streaming/controllers/FragmentController.js ***!\n \\*********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1402310__) {\n__nested_webpack_require_1402310__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1402310__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _vo_DataChunk__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1402310__(/*! ../vo/DataChunk */ "./src/streaming/vo/DataChunk.js");\n/* harmony import */ var _models_FragmentModel__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1402310__(/*! ../models/FragmentModel */ "./src/streaming/models/FragmentModel.js");\n/* harmony import */ var _FragmentLoader__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1402310__(/*! ../FragmentLoader */ "./src/streaming/FragmentLoader.js");\n/* harmony import */ var _utils_RequestModifier__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1402310__(/*! ../utils/RequestModifier */ "./src/streaming/utils/RequestModifier.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1402310__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1402310__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1402310__(/*! ../MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1402310__(/*! ../../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1402310__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_1402310__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\nfunction FragmentController(config) {\n config = config || {};\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance();\n var errHandler = config.errHandler;\n var mediaPlayerModel = config.mediaPlayerModel;\n var dashMetrics = config.dashMetrics;\n var debug = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_10__["default"])(context).getInstance();\n var streamInfo = config.streamInfo;\n var instance, logger, fragmentModels;\n\n function setup() {\n logger = debug.getLogger(instance);\n resetInitialSettings();\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].FRAGMENT_LOADING_COMPLETED, onFragmentLoadingCompleted, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].FRAGMENT_LOADING_PROGRESS, onFragmentLoadingCompleted, instance);\n }\n\n function getStreamId() {\n return streamInfo.id;\n }\n\n function getModel(type) {\n var model = fragmentModels[type];\n\n if (!model) {\n model = Object(_models_FragmentModel__WEBPACK_IMPORTED_MODULE_2__["default"])(context).create({\n streamInfo: streamInfo,\n type: type,\n dashMetrics: dashMetrics,\n fragmentLoader: Object(_FragmentLoader__WEBPACK_IMPORTED_MODULE_3__["default"])(context).create({\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n errHandler: errHandler,\n requestModifier: Object(_utils_RequestModifier__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance(),\n settings: config.settings,\n boxParser: config.boxParser,\n eventBus: eventBus,\n events: _core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"],\n errors: _core_errors_Errors__WEBPACK_IMPORTED_MODULE_8__["default"],\n dashConstants: config.dashConstants,\n urlUtils: config.urlUtils,\n streamId: getStreamId()\n }),\n debug: debug,\n eventBus: eventBus,\n events: _core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"]\n });\n fragmentModels[type] = model;\n }\n\n return model;\n }\n\n function resetInitialSettings() {\n for (var model in fragmentModels) {\n fragmentModels[model].reset();\n }\n\n fragmentModels = {};\n }\n\n function reset() {\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].FRAGMENT_LOADING_COMPLETED, onFragmentLoadingCompleted, this);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].FRAGMENT_LOADING_PROGRESS, onFragmentLoadingCompleted, this);\n resetInitialSettings();\n }\n\n function createDataChunk(bytes, request, streamId, endFragment) {\n var chunk = new _vo_DataChunk__WEBPACK_IMPORTED_MODULE_1__["default"]();\n chunk.streamId = streamId;\n chunk.mediaInfo = request.mediaInfo;\n chunk.segmentType = request.type;\n chunk.start = request.startTime;\n chunk.duration = request.duration;\n chunk.end = chunk.start + chunk.duration;\n chunk.bytes = bytes;\n chunk.index = request.index;\n chunk.quality = request.quality;\n chunk.representationId = request.representationId;\n chunk.endFragment = endFragment;\n return chunk;\n }\n\n function onFragmentLoadingCompleted(e) {\n // Event propagation may have been stopped (see MssHandler)\n if (!e.sender) return;\n var request = e.request;\n var bytes = e.response;\n var isInit = request.isInitializationRequest();\n var strInfo = request.mediaInfo.streamInfo;\n\n if (e.error) {\n if (request.mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO || request.mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO || request.mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT && request.mediaInfo.isFragmented) {\n // add service location to blacklist controller - only for audio or video. text should not set errors\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].SERVICE_LOCATION_BLACKLIST_ADD, {\n entry: e.request.serviceLocation\n });\n }\n }\n\n if (!bytes || !strInfo) {\n logger.warn(\'No \' + request.mediaType + \' bytes to push or stream is inactive.\');\n return;\n }\n\n var chunk = createDataChunk(bytes, request, streamInfo.id, e.type !== _core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].FRAGMENT_LOADING_PROGRESS);\n eventBus.trigger(isInit ? _core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].INIT_FRAGMENT_LOADED : _core_events_Events__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_FRAGMENT_LOADED, {\n chunk: chunk,\n request: request\n }, {\n streamId: strInfo.id,\n mediaType: request.mediaType\n });\n }\n\n instance = {\n getStreamId: getStreamId,\n getModel: getModel,\n reset: reset\n };\n setup();\n return instance;\n}\n\nFragmentController.__dashjs_factory_name = \'FragmentController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_9__["default"].getClassFactory(FragmentController));\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/GapController.js":\n/*!****************************************************!*\\\n !*** ./src/streaming/controllers/GapController.js ***!\n \\****************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1411410__) {\n__nested_webpack_require_1411410__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1411410__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1411410__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1411410__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1411410__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\nvar GAP_HANDLER_INTERVAL = 100;\nvar THRESHOLD_TO_STALLS = 10;\nvar GAP_JUMP_WAITING_TIME_OFFSET = 0.1;\n\nfunction GapController() {\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_3__["default"])(context).getInstance();\n var instance, lastPlaybackTime, settings, wallclockTicked, gapHandlerInterval, lastGapJumpPosition, playbackController, streamController, videoModel, jumpTimeoutHandler, trackSwitchByMediaType, logger;\n\n function initialize() {\n _registerEvents();\n }\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance().getLogger(instance);\n reset();\n }\n\n function reset() {\n _stopGapHandler();\n\n _unregisterEvents();\n\n resetInitialSettings();\n }\n\n function resetInitialSettings() {\n gapHandlerInterval = null;\n lastGapJumpPosition = NaN;\n wallclockTicked = 0;\n jumpTimeoutHandler = null;\n trackSwitchByMediaType = {};\n }\n\n function setConfig(config) {\n if (!config) {\n return;\n }\n\n if (config.settings) {\n settings = config.settings;\n }\n\n if (config.playbackController) {\n playbackController = config.playbackController;\n }\n\n if (config.streamController) {\n streamController = config.streamController;\n }\n\n if (config.videoModel) {\n videoModel = config.videoModel;\n }\n }\n\n function _registerEvents() {\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].WALLCLOCK_TIME_UPDATED, _onWallclockTimeUpdated, this);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].INITIAL_STREAM_SWITCH, _onInitialStreamSwitch, this);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].PLAYBACK_SEEKING, _onPlaybackSeeking, this);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].BUFFER_REPLACEMENT_STARTED, _onBufferReplacementStarted, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].TRACK_CHANGE_RENDERED, _onBufferReplacementEnded, instance);\n }\n\n function _unregisterEvents() {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].WALLCLOCK_TIME_UPDATED, _onWallclockTimeUpdated, this);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].INITIAL_STREAM_SWITCH, _onInitialStreamSwitch, this);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].PLAYBACK_SEEKING, _onPlaybackSeeking, this);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].BUFFER_REPLACEMENT_STARTED, _onBufferReplacementStarted, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].TRACK_CHANGE_RENDERED, _onBufferReplacementEnded, instance);\n }\n /**\n * Clear scheduled gap jump when seeking\n * @private\n */\n\n\n function _onPlaybackSeeking() {\n if (jumpTimeoutHandler) {\n clearTimeout(jumpTimeoutHandler);\n jumpTimeoutHandler = null;\n }\n }\n /**\n * If the track was changed in the current active period and the player might aggressively replace segments the buffer will be empty for a short period of time. Avoid gap jumping at that time.\n * We wait until the next media fragment of the target type has been appended before activating again\n * @param {object} e\n * @private\n */\n\n\n function _onBufferReplacementStarted(e) {\n try {\n if (e.streamId !== streamController.getActiveStreamInfo().id || !e.mediaType) {\n return;\n }\n\n if (e.streamId === streamController.getActiveStreamInfo().id) {\n trackSwitchByMediaType[e.mediaType] = true;\n }\n } catch (e) {\n logger.error(e);\n }\n }\n /**\n * Activate gap jumping again once segment of target type has been appended\n * @param {object} e\n * @private\n */\n\n\n function _onBufferReplacementEnded(e) {\n if (!e || !e.mediaType) {\n return;\n }\n\n trackSwitchByMediaType[e.mediaType] = false;\n }\n /**\n * Activate the gap handler after the first stream switch\n * @private\n */\n\n\n function _onInitialStreamSwitch() {\n if (!gapHandlerInterval) {\n _startGapHandler();\n }\n }\n /**\n * Callback handler for when the wallclock time has been updated\n * @private\n */\n\n\n function _onWallclockTimeUpdated()\n /*e*/\n {\n if (!_shouldCheckForGaps(settings.get().streaming.gaps.enableSeekFix)) {\n return;\n }\n\n wallclockTicked++;\n\n if (wallclockTicked >= THRESHOLD_TO_STALLS) {\n var currentTime = playbackController.getTime();\n\n if (lastPlaybackTime === currentTime) {\n _jumpGap(currentTime, true);\n } else {\n lastPlaybackTime = currentTime;\n lastGapJumpPosition = NaN;\n }\n\n wallclockTicked = 0;\n }\n }\n /**\n * Returns if we are supposed to check for gaps\n * @param {boolean} checkSeekingState - Usually we are not checking for gaps in the videolement is in seeking state. If this flag is set to true we check for a potential exceptions of this rule.\n * @return {boolean}\n * @private\n */\n\n\n function _shouldCheckForGaps() {\n var checkSeekingState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var trackSwitchInProgress = Object.keys(trackSwitchByMediaType).some(function (key) {\n return trackSwitchByMediaType[key];\n });\n var shouldIgnoreSeekingState = checkSeekingState ? _shouldIgnoreSeekingState() : false;\n return !trackSwitchInProgress && settings.get().streaming.gaps.jumpGaps && streamController.getActiveStreamProcessors().length > 0 && (!playbackController.isSeeking() || shouldIgnoreSeekingState) && !playbackController.isPaused() && !streamController.getIsStreamSwitchInProgress() && !streamController.getHasMediaOrInitialisationError();\n }\n /**\n * There are cases in which we never transition out of the seeking state and still need to jump a gap. For instance if the user seeks right before a gap and video element will not transition out of the seeking state.\n * For now limit this to period boundaries. In this case the current period is completely buffered and we are right before the end of the period.\n * @private\n */\n\n\n function _shouldIgnoreSeekingState() {\n var activeStream = streamController.getActiveStream();\n var streamEnd = parseFloat((activeStream.getStartTime() + activeStream.getDuration()).toFixed(5));\n return playbackController.getTime() + settings.get().streaming.gaps.threshold >= streamEnd;\n }\n /**\n * Returns the index of the range object that comes after the current time\n * @param {object} ranges\n * @param {number} currentTime\n * @private\n * @return {null|number}\n */\n\n\n function _getNextRangeIndex(ranges, currentTime) {\n try {\n if (!ranges || ranges.length <= 1 && currentTime > 0) {\n return NaN;\n }\n\n var nextRangeIndex = NaN;\n var j = 0;\n\n while (isNaN(nextRangeIndex) && j < ranges.length) {\n var rangeEnd = j > 0 ? ranges.end(j - 1) : 0;\n\n if (currentTime < ranges.start(j) && rangeEnd - currentTime < settings.get().streaming.gaps.threshold) {\n nextRangeIndex = j;\n }\n\n j += 1;\n }\n\n return nextRangeIndex;\n } catch (e) {\n return null;\n }\n }\n /**\n * Starts the interval that checks for gaps\n * @private\n */\n\n\n function _startGapHandler() {\n try {\n if (!gapHandlerInterval) {\n logger.debug(\'Starting the gap controller\');\n gapHandlerInterval = setInterval(function () {\n if (!_shouldCheckForGaps()) {\n return;\n }\n\n var currentTime = playbackController.getTime();\n\n _jumpGap(currentTime);\n }, GAP_HANDLER_INTERVAL);\n }\n } catch (e) {}\n }\n /**\n * Clears the gap interval handler\n * @private\n */\n\n\n function _stopGapHandler() {\n logger.debug(\'Stopping the gap controller\');\n\n if (gapHandlerInterval) {\n clearInterval(gapHandlerInterval);\n gapHandlerInterval = null;\n }\n }\n /**\n * Jump a gap\n * @param {number} currentTime\n * @param {boolean} playbackStalled\n * @private\n */\n\n\n function _jumpGap(currentTime) {\n var playbackStalled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var smallGapLimit = settings.get().streaming.gaps.smallGapLimit;\n var jumpLargeGaps = settings.get().streaming.gaps.jumpLargeGaps;\n var ranges = videoModel.getBufferRange();\n var nextRangeIndex;\n var seekToPosition = NaN;\n var jumpToStreamEnd = false; // Get the range just after current time position\n\n nextRangeIndex = _getNextRangeIndex(ranges, currentTime);\n\n if (!isNaN(nextRangeIndex)) {\n var start = ranges.start(nextRangeIndex);\n var gap = start - currentTime;\n\n if (gap > 0 && (gap <= smallGapLimit || jumpLargeGaps)) {\n seekToPosition = start;\n }\n } // Playback has stalled before period end. We seek to the end of the period\n\n\n var timeToStreamEnd = playbackController.getTimeToStreamEnd();\n\n if (isNaN(seekToPosition) && playbackStalled && isFinite(timeToStreamEnd) && !isNaN(timeToStreamEnd) && timeToStreamEnd < smallGapLimit) {\n seekToPosition = parseFloat(playbackController.getStreamEndTime().toFixed(5));\n jumpToStreamEnd = true;\n }\n\n if (seekToPosition > 0 && lastGapJumpPosition !== seekToPosition && seekToPosition > currentTime && !jumpTimeoutHandler) {\n var timeUntilGapEnd = seekToPosition - currentTime;\n\n if (jumpToStreamEnd) {\n var nextStream = streamController.getStreamForTime(seekToPosition);\n var internalSeek = nextStream && !!nextStream.getPreloaded();\n logger.warn("Jumping to end of stream because of gap from ".concat(currentTime, " to ").concat(seekToPosition, ". Gap duration: ").concat(timeUntilGapEnd));\n playbackController.seek(seekToPosition, true, internalSeek);\n } else {\n var isDynamic = playbackController.getIsDynamic();\n\n var _start = nextRangeIndex > 0 ? ranges.end(nextRangeIndex - 1) : currentTime;\n\n var timeToWait = !isDynamic ? 0 : Math.max(0, timeUntilGapEnd - GAP_JUMP_WAITING_TIME_OFFSET) * 1000;\n jumpTimeoutHandler = window.setTimeout(function () {\n playbackController.seek(seekToPosition, true, true);\n logger.warn("Jumping gap occuring in period ".concat(streamController.getActiveStream().getStreamId(), " starting at ").concat(_start, " and ending at ").concat(seekToPosition, ". Jumping by: ").concat(timeUntilGapEnd - timeToWait / 1000));\n jumpTimeoutHandler = null;\n }, timeToWait);\n }\n\n lastGapJumpPosition = seekToPosition;\n }\n }\n\n instance = {\n reset: reset,\n setConfig: setConfig,\n initialize: initialize\n };\n setup();\n return instance;\n}\n\nGapController.__dashjs_factory_name = \'GapController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(GapController));\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/MediaController.js":\n/*!******************************************************!*\\\n !*** ./src/streaming/controllers/MediaController.js ***!\n \\******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1425209__) {\n__nested_webpack_require_1425209__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1425209__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1425209__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1425209__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1425209__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1425209__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\nfunction MediaController() {\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance();\n var instance, logger, tracks, settings, initialSettings, lastSelectedTracks, domStorage, customInitialTrackSelectionFunction;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance().getLogger(instance);\n reset();\n }\n /**\n * @param {string} type\n * @param {StreamInfo} streamInfo\n * @memberof MediaController#\n */\n\n\n function setInitialMediaSettingsForType(type, streamInfo) {\n var settings = lastSelectedTracks[type] || getInitialSettings(type);\n var tracksForType = getTracksFor(type, streamInfo.id);\n var tracks = [];\n\n if (!settings) {\n settings = domStorage.getSavedMediaSettings(type);\n setInitialSettings(type, settings);\n }\n\n if (!tracksForType || tracksForType.length === 0) return;\n\n if (settings) {\n tracksForType.forEach(function (track) {\n if (matchSettings(settings, track, !!lastSelectedTracks[type])) {\n tracks.push(track);\n }\n });\n }\n\n if (tracks.length === 0) {\n setTrack(selectInitialTrack(type, tracksForType), true);\n } else {\n if (tracks.length > 1) {\n setTrack(selectInitialTrack(type, tracks, !!lastSelectedTracks[type]));\n } else {\n setTrack(tracks[0]);\n }\n }\n }\n /**\n * @param {MediaInfo} track\n * @memberof MediaController#\n */\n\n\n function addTrack(track) {\n if (!track) return;\n var mediaType = track.type;\n if (!_isMultiTrackSupportedByType(mediaType)) return;\n var streamId = track.streamInfo.id;\n\n if (!tracks[streamId]) {\n tracks[streamId] = createTrackInfo();\n }\n\n var mediaTracks = tracks[streamId][mediaType].list;\n\n for (var i = 0, len = mediaTracks.length; i < len; ++i) {\n //track is already set.\n if (isTracksEqual(mediaTracks[i], track)) {\n return;\n }\n }\n\n mediaTracks.push(track);\n }\n /**\n * @param {string} type\n * @param {string} streamId\n * @returns {Array}\n * @memberof MediaController#\n */\n\n\n function getTracksFor(type, streamId) {\n if (!type) return [];\n if (!tracks[streamId] || !tracks[streamId][type]) return [];\n return tracks[streamId][type].list;\n }\n /**\n * @param {string} type\n * @param {string} streamId\n * @returns {Object|null}\n * @memberof MediaController#\n */\n\n\n function getCurrentTrackFor(type, streamId) {\n if (!type || !tracks[streamId] || !tracks[streamId][type]) return null;\n return tracks[streamId][type].current;\n }\n /**\n * @param {MediaInfo} track\n * @returns {boolean}\n * @memberof MediaController#\n */\n\n\n function isCurrentTrack(track) {\n if (!track) {\n return false;\n }\n\n var type = track.type;\n var id = track.streamInfo.id;\n return tracks[id] && tracks[id][type] && isTracksEqual(tracks[id][type].current, track);\n }\n /**\n * @param {MediaInfo} track\n * @param {boolean} noSettingsSave specify if settings must be not be saved\n * @memberof MediaController#\n */\n\n\n function setTrack(track) {\n var noSettingsSave = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (!track || !track.streamInfo) return;\n var type = track.type;\n var streamInfo = track.streamInfo;\n var id = streamInfo.id;\n var current = getCurrentTrackFor(type, id);\n if (!tracks[id] || !tracks[id][type] || isTracksEqual(track, current)) return;\n tracks[id][type].current = track;\n\n if (tracks[id][type].current && (type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT && track.isFragmented)) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].CURRENT_TRACK_CHANGED, {\n oldMediaInfo: current,\n newMediaInfo: track,\n switchMode: settings.get().streaming.trackSwitchMode[type]\n }, {\n streamId: id\n });\n }\n\n if (!noSettingsSave) {\n var _settings = extractSettings(track);\n\n if (!_settings || !tracks[id][type].storeLastSettings) return;\n\n if (_settings.roles) {\n _settings.role = _settings.roles[0];\n delete _settings.roles;\n }\n\n if (_settings.accessibility) {\n _settings.accessibility = _settings.accessibility[0];\n }\n\n if (_settings.audioChannelConfiguration) {\n _settings.audioChannelConfiguration = _settings.audioChannelConfiguration[0];\n }\n\n lastSelectedTracks[type] = _settings;\n domStorage.setSavedMediaSettings(type, _settings);\n }\n }\n /**\n * @param {string} type\n * @param {Object} value\n * @memberof MediaController#\n */\n\n\n function setInitialSettings(type, value) {\n if (!type || !value) return;\n initialSettings[type] = value;\n }\n /**\n * @param {string} type\n * @returns {Object|null}\n * @memberof MediaController#\n */\n\n\n function getInitialSettings(type) {\n if (!type) return null;\n return initialSettings[type];\n }\n /**\n * @memberof MediaController#\n */\n\n\n function saveTextSettingsDisabled() {\n domStorage.setSavedMediaSettings(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT, null);\n }\n /**\n * @param {string} type\n * @returns {boolean}\n * @memberof MediaController#\n */\n\n\n function _isMultiTrackSupportedByType(type) {\n return type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].IMAGE;\n }\n /**\n * @param {MediaInfo} t1 - first track to compare\n * @param {MediaInfo} t2 - second track to compare\n * @returns {boolean}\n * @memberof MediaController#\n */\n\n\n function isTracksEqual(t1, t2) {\n if (!t1 && !t2) {\n return true;\n }\n\n if (!t1 || !t2) {\n return false;\n }\n\n var sameId = t1.id === t2.id;\n var sameViewpoint = t1.viewpoint === t2.viewpoint;\n var sameLang = t1.lang === t2.lang;\n var sameCodec = t1.codec === t2.codec;\n var sameRoles = t1.roles.toString() === t2.roles.toString();\n var sameAccessibility = t1.accessibility.toString() === t2.accessibility.toString();\n var sameAudioChannelConfiguration = t1.audioChannelConfiguration.toString() === t2.audioChannelConfiguration.toString();\n return sameId && sameCodec && sameViewpoint && sameLang && sameRoles && sameAccessibility && sameAudioChannelConfiguration;\n }\n\n function setConfig(config) {\n if (!config) return;\n\n if (config.domStorage) {\n domStorage = config.domStorage;\n }\n\n if (config.settings) {\n settings = config.settings;\n }\n }\n /**\n * @memberof MediaController#\n */\n\n\n function reset() {\n tracks = {};\n lastSelectedTracks = {};\n customInitialTrackSelectionFunction = null;\n resetInitialSettings();\n }\n\n function extractSettings(mediaInfo) {\n var settings = {\n lang: mediaInfo.lang,\n viewpoint: mediaInfo.viewpoint,\n roles: mediaInfo.roles,\n accessibility: mediaInfo.accessibility,\n audioChannelConfiguration: mediaInfo.audioChannelConfiguration\n };\n var notEmpty = settings.lang || settings.viewpoint || settings.role && settings.role.length > 0 || settings.accessibility && settings.accessibility.length > 0 || settings.audioChannelConfiguration && settings.audioChannelConfiguration.length > 0;\n return notEmpty ? settings : null;\n }\n\n function matchSettings(settings, track) {\n var isTrackActive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var matchLang = !settings.lang || track.lang.match(settings.lang);\n var matchIndex = settings.index === undefined || settings.index === null || track.index === settings.index;\n var matchViewPoint = !settings.viewpoint || settings.viewpoint === track.viewpoint;\n var matchRole = !settings.role || !!track.roles.filter(function (item) {\n return item === settings.role;\n })[0];\n var matchAccessibility = !settings.accessibility || !!track.accessibility.filter(function (item) {\n return item === settings.accessibility;\n })[0];\n var matchAudioChannelConfiguration = !settings.audioChannelConfiguration || !!track.audioChannelConfiguration.filter(function (item) {\n return item === settings.audioChannelConfiguration;\n })[0];\n return matchLang && matchIndex && matchViewPoint && (matchRole || track.type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO && isTrackActive) && matchAccessibility && matchAudioChannelConfiguration;\n }\n\n function resetInitialSettings() {\n initialSettings = {\n audio: null,\n video: null,\n text: null\n };\n }\n\n function getTracksWithHighestSelectionPriority(trackArr) {\n var max = 0;\n var result = [];\n trackArr.forEach(function (track) {\n if (!isNaN(track.selectionPriority)) {\n // Higher max value. Reset list and add new entry\n if (track.selectionPriority > max) {\n max = track.selectionPriority;\n result = [track];\n } // Same max value add to list\n else if (track.selectionPriority === max) {\n result.push(track);\n }\n }\n });\n return result;\n }\n\n function getTracksWithHighestBitrate(trackArr) {\n var max = 0;\n var result = [];\n var tmp;\n trackArr.forEach(function (track) {\n tmp = Math.max.apply(Math, track.bitrateList.map(function (obj) {\n return obj.bandwidth;\n }));\n\n if (tmp > max) {\n max = tmp;\n result = [track];\n } else if (tmp === max) {\n result.push(track);\n }\n });\n return result;\n }\n\n function getTracksWithHighestEfficiency(trackArr) {\n var min = Infinity;\n var result = [];\n var tmp;\n trackArr.forEach(function (track) {\n var sum = track.bitrateList.reduce(function (acc, obj) {\n var resolution = Math.max(1, obj.width * obj.height);\n var efficiency = obj.bandwidth / resolution;\n return acc + efficiency;\n }, 0);\n tmp = sum / track.bitrateList.length;\n\n if (tmp < min) {\n min = tmp;\n result = [track];\n } else if (tmp === min) {\n result.push(track);\n }\n });\n return result;\n }\n\n function getTracksWithWidestRange(trackArr) {\n var max = 0;\n var result = [];\n var tmp;\n trackArr.forEach(function (track) {\n tmp = track.representationCount;\n\n if (tmp > max) {\n max = tmp;\n result = [track];\n } else if (tmp === max) {\n result.push(track);\n }\n });\n return result;\n }\n\n function setCustomInitialTrackSelectionFunction(customFunc) {\n customInitialTrackSelectionFunction = customFunc;\n }\n\n function selectInitialTrack(type, tracks) {\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT) return tracks[0];\n var mode = settings.get().streaming.selectionModeForInitialTrack;\n var tmpArr;\n\n if (customInitialTrackSelectionFunction && typeof customInitialTrackSelectionFunction === \'function\') {\n tmpArr = customInitialTrackSelectionFunction(tracks);\n } else {\n switch (mode) {\n case _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TRACK_SELECTION_MODE_HIGHEST_SELECTION_PRIORITY:\n tmpArr = _trackSelectionModeHighestSelectionPriority(tracks);\n break;\n\n case _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TRACK_SELECTION_MODE_HIGHEST_BITRATE:\n tmpArr = _trackSelectionModeHighestBitrate(tracks);\n break;\n\n case _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TRACK_SELECTION_MODE_FIRST_TRACK:\n tmpArr = _trackSelectionModeFirstTrack(tracks);\n break;\n\n case _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:\n tmpArr = _trackSelectionModeHighestEfficiency(tracks);\n break;\n\n case _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TRACK_SELECTION_MODE_WIDEST_RANGE:\n tmpArr = _trackSelectionModeWidestRange(tracks);\n break;\n\n default:\n logger.warn("Track selection mode ".concat(mode, " is not supported. Falling back to TRACK_SELECTION_MODE_FIRST_TRACK"));\n tmpArr = _trackSelectionModeFirstTrack(tracks);\n break;\n }\n }\n\n return tmpArr.length > 0 ? tmpArr[0] : tracks[0];\n }\n\n function _trackSelectionModeHighestSelectionPriority(tracks) {\n var tmpArr = getTracksWithHighestSelectionPriority(tracks);\n\n if (tmpArr.length > 1) {\n tmpArr = getTracksWithHighestBitrate(tmpArr);\n }\n\n if (tmpArr.length > 1) {\n tmpArr = getTracksWithWidestRange(tmpArr);\n }\n\n return tmpArr;\n }\n\n function _trackSelectionModeHighestBitrate(tracks) {\n var tmpArr = getTracksWithHighestBitrate(tracks);\n\n if (tmpArr.length > 1) {\n tmpArr = getTracksWithWidestRange(tmpArr);\n }\n\n return tmpArr;\n }\n\n function _trackSelectionModeFirstTrack(tracks) {\n return tracks[0];\n }\n\n function _trackSelectionModeHighestEfficiency(tracks) {\n var tmpArr = getTracksWithHighestEfficiency(tracks);\n\n if (tmpArr.length > 1) {\n tmpArr = getTracksWithHighestBitrate(tmpArr);\n }\n\n return tmpArr;\n }\n\n function _trackSelectionModeWidestRange(tracks) {\n var tmpArr = getTracksWithWidestRange(tracks);\n\n if (tmpArr.length > 1) {\n tmpArr = getTracksWithHighestBitrate(tracks);\n }\n\n return tmpArr;\n }\n\n function createTrackInfo() {\n return {\n audio: {\n list: [],\n storeLastSettings: true,\n current: null\n },\n video: {\n list: [],\n storeLastSettings: true,\n current: null\n },\n text: {\n list: [],\n storeLastSettings: true,\n current: null\n },\n image: {\n list: [],\n storeLastSettings: true,\n current: null\n }\n };\n }\n\n instance = {\n setInitialMediaSettingsForType: setInitialMediaSettingsForType,\n addTrack: addTrack,\n getTracksFor: getTracksFor,\n getCurrentTrackFor: getCurrentTrackFor,\n isCurrentTrack: isCurrentTrack,\n setTrack: setTrack,\n selectInitialTrack: selectInitialTrack,\n setCustomInitialTrackSelectionFunction: setCustomInitialTrackSelectionFunction,\n setInitialSettings: setInitialSettings,\n getInitialSettings: getInitialSettings,\n getTracksWithHighestBitrate: getTracksWithHighestBitrate,\n getTracksWithHighestEfficiency: getTracksWithHighestEfficiency,\n getTracksWithWidestRange: getTracksWithWidestRange,\n isTracksEqual: isTracksEqual,\n matchSettings: matchSettings,\n saveTextSettingsDisabled: saveTextSettingsDisabled,\n setConfig: setConfig,\n reset: reset\n };\n setup();\n return instance;\n}\n\nMediaController.__dashjs_factory_name = \'MediaController\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_3__["default"].getSingletonFactory(MediaController);\n_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_3__["default"].updateSingletonFactory(MediaController.__dashjs_factory_name, factory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/MediaSourceController.js":\n/*!************************************************************!*\\\n !*** ./src/streaming/controllers/MediaSourceController.js ***!\n \\************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1443607__) {\n__nested_webpack_require_1443607__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1443607__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1443607__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\nfunction MediaSourceController() {\n var instance, mediaSource, logger;\n var context = this.context;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance().getLogger(instance);\n }\n\n function createMediaSource() {\n var hasWebKit = (\'WebKitMediaSource\' in window);\n var hasMediaSource = (\'MediaSource\' in window);\n\n if (hasMediaSource) {\n mediaSource = new MediaSource();\n } else if (hasWebKit) {\n mediaSource = new WebKitMediaSource();\n }\n\n return mediaSource;\n }\n\n function attachMediaSource(videoModel) {\n var objectURL = window.URL.createObjectURL(mediaSource);\n videoModel.setSource(objectURL);\n return objectURL;\n }\n\n function detachMediaSource(videoModel) {\n videoModel.setSource(null);\n }\n\n function setDuration(value) {\n if (!mediaSource || mediaSource.readyState !== \'open\') return;\n if (value === null && isNaN(value)) return;\n if (mediaSource.duration === value) return;\n\n if (!isBufferUpdating(mediaSource)) {\n logger.info(\'Set MediaSource duration:\' + value);\n mediaSource.duration = value;\n } else {\n setTimeout(setDuration.bind(null, value), 50);\n }\n }\n\n function setSeekable(start, end) {\n if (mediaSource && typeof mediaSource.setLiveSeekableRange === \'function\' && typeof mediaSource.clearLiveSeekableRange === \'function\' && mediaSource.readyState === \'open\' && start >= 0 && start < end) {\n mediaSource.clearLiveSeekableRange();\n mediaSource.setLiveSeekableRange(start, end);\n }\n }\n\n function signalEndOfStream(source) {\n if (!source || source.readyState !== \'open\') {\n return;\n }\n\n var buffers = source.sourceBuffers;\n\n for (var i = 0; i < buffers.length; i++) {\n if (buffers[i].updating) {\n return;\n }\n\n if (buffers[i].buffered.length === 0) {\n return;\n }\n }\n\n logger.info(\'call to mediaSource endOfStream\');\n source.endOfStream();\n }\n\n function isBufferUpdating(source) {\n var buffers = source.sourceBuffers;\n\n for (var i = 0; i < buffers.length; i++) {\n if (buffers[i].updating) {\n return true;\n }\n }\n\n return false;\n }\n\n instance = {\n createMediaSource: createMediaSource,\n attachMediaSource: attachMediaSource,\n detachMediaSource: detachMediaSource,\n setDuration: setDuration,\n setSeekable: setSeekable,\n signalEndOfStream: signalEndOfStream\n };\n setup();\n return instance;\n}\n\nMediaSourceController.__dashjs_factory_name = \'MediaSourceController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(MediaSourceController));\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/PlaybackController.js":\n/*!*********************************************************!*\\\n !*** ./src/streaming/controllers/PlaybackController.js ***!\n \\*********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1448859__) {\n__nested_webpack_require_1448859__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1448859__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1448859__(/*! ../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1448859__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1448859__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1448859__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1448859__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1448859__(/*! ../../streaming/MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\nvar LIVE_UPDATE_PLAYBACK_TIME_INTERVAL_MS = 500;\n\nfunction PlaybackController() {\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance();\n var instance, logger, streamController, dashMetrics, adapter, videoModel, timelineConverter, wallclockTimeIntervalId, liveDelay, streamInfo, isDynamic, mediaPlayerModel, playOnceInitialized, lastLivePlaybackTime, availabilityStartTime, seekTarget, internalSeek, isLowLatencySeekingInProgress, playbackStalled, minPlaybackRateChange, manifestUpdateInProgress, settings;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance().getLogger(instance);\n reset();\n }\n /**\n * Initializes the PlaybackController. This function is called whenever the stream is switched.\n * @param {object} sInfo\n * @param {boolean} periodSwitch\n */\n\n\n function initialize(sInfo, periodSwitch) {\n streamInfo = sInfo;\n\n if (periodSwitch !== true) {\n _initializeForFirstStream();\n }\n }\n /**\n * Initializes the PlaybackController when the first stream is to be played.\n * @private\n */\n\n\n function _initializeForFirstStream() {\n addAllListeners();\n isDynamic = streamInfo.manifestInfo.isDynamic;\n isLowLatencySeekingInProgress = false;\n playbackStalled = false;\n internalSeek = false; // Detect safari browser (special behavior for low latency streams)\n\n var ua = typeof navigator !== \'undefined\' ? navigator.userAgent.toLowerCase() : \'\';\n var isSafari = /safari/.test(ua) && !/chrome/.test(ua);\n minPlaybackRateChange = isSafari ? 0.25 : 0.02;\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].DATA_UPDATE_COMPLETED, _onDataUpdateCompleted, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].LOADING_PROGRESS, _onFragmentLoadProgress, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].MANIFEST_UPDATED, _onManifestUpdated, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].STREAMS_COMPOSED, _onStreamsComposed, instance);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].BUFFER_LEVEL_STATE_CHANGED, _onBufferLevelStateChanged, instance);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].PLAYBACK_PROGRESS, _onPlaybackProgression, instance);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].PLAYBACK_TIME_UPDATED, _onPlaybackProgression, instance);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].PLAYBACK_ENDED, _onPlaybackEnded, instance, {\n priority: _core_EventBus__WEBPACK_IMPORTED_MODULE_2__["default"].EVENT_PRIORITY_HIGH\n });\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].STREAM_INITIALIZING, _onStreamInitializing, instance);\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].REPRESENTATION_SWITCH, _onRepresentationSwitch, instance);\n\n if (playOnceInitialized) {\n playOnceInitialized = false;\n play();\n }\n }\n\n function getTimeToStreamEnd() {\n var sInfo = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n return parseFloat((getStreamEndTime(sInfo) - getTime()).toFixed(5));\n }\n\n function getStreamEndTime(sInfo) {\n var refInfo = sInfo ? sInfo : streamInfo;\n return refInfo.start + refInfo.duration;\n }\n\n function play() {\n if (streamInfo && videoModel && videoModel.getElement()) {\n videoModel.play();\n } else {\n playOnceInitialized = true;\n }\n }\n\n function isPaused() {\n return streamInfo && videoModel ? videoModel.isPaused() : null;\n }\n\n function pause() {\n if (streamInfo && videoModel) {\n videoModel.pause();\n }\n }\n\n function isSeeking() {\n return streamInfo && videoModel ? videoModel.isSeeking() : null;\n }\n\n function isStalled() {\n return streamInfo && videoModel ? videoModel.isStalled() : null;\n }\n\n function seek(time, stickToBuffered, internal) {\n if (!streamInfo || !videoModel) return;\n var currentTime = !isNaN(seekTarget) ? seekTarget : videoModel.getTime();\n if (time === currentTime) return;\n internalSeek = internal === true;\n\n if (!internalSeek) {\n seekTarget = time;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_SEEK_ASKED);\n }\n\n logger.info(\'Requesting seek to time: \' + time + (internalSeek ? \' (internal)\' : \'\'));\n videoModel.setCurrentTime(time, stickToBuffered);\n }\n\n function seekToLive() {\n var type = streamController && streamController.hasVideoTrack() ? _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO : _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO;\n var DVRMetrics = dashMetrics.getCurrentDVRInfo(type);\n var DVRWindow = DVRMetrics ? DVRMetrics.range : null;\n\n if (DVRWindow && !isNaN(DVRWindow.end)) {\n seek(DVRWindow.end - mediaPlayerModel.getLiveDelay(), true, false);\n }\n }\n\n function getTime() {\n return streamInfo && videoModel ? videoModel.getTime() : null;\n }\n\n function getNormalizedTime() {\n var t = getTime();\n\n if (isDynamic && !isNaN(availabilityStartTime)) {\n var timeOffset = availabilityStartTime / 1000; // Fix current time for firefox and safari (returned as an absolute time)\n\n if (t > timeOffset) {\n t -= timeOffset;\n }\n }\n\n return t;\n }\n\n function getPlaybackRate() {\n return streamInfo && videoModel ? videoModel.getPlaybackRate() : null;\n }\n\n function getPlayedRanges() {\n return streamInfo && videoModel ? videoModel.getPlayedRanges() : null;\n }\n\n function getEnded() {\n return streamInfo && videoModel ? videoModel.getEnded() : null;\n }\n\n function getIsDynamic() {\n return isDynamic;\n }\n\n function getStreamController() {\n return streamController;\n }\n\n function getIsManifestUpdateInProgress() {\n return manifestUpdateInProgress;\n }\n /**\n * Computes the desirable delay for the live edge to avoid a risk of getting 404 when playing at the bleeding edge\n * @param {number} fragmentDuration - seconds?\n * @param {object} manifestInfo\n * @returns {number} object\n * @memberof PlaybackController#\n */\n\n\n function computeAndSetLiveDelay(fragmentDuration, manifestInfo) {\n var delay, ret, startTime;\n var END_OF_PLAYLIST_PADDING = 10;\n var MIN_BUFFER_TIME_FACTOR = 4;\n var FRAGMENT_DURATION_FACTOR = 4;\n var adjustedFragmentDuration = !isNaN(fragmentDuration) && isFinite(fragmentDuration) ? fragmentDuration : NaN;\n var suggestedPresentationDelay = adapter.getSuggestedPresentationDelay(); // Apply live delay from ServiceDescription\n\n if (settings.get().streaming.delay.applyServiceDescription && isNaN(settings.get().streaming.delay.liveDelay) && isNaN(settings.get().streaming.delay.liveDelayFragmentCount)) {\n _applyServiceDescription(manifestInfo);\n }\n\n if (mediaPlayerModel.getLiveDelay()) {\n delay = mediaPlayerModel.getLiveDelay(); // If set by user, this value takes precedence\n } else if (settings.get().streaming.delay.liveDelayFragmentCount !== null && !isNaN(settings.get().streaming.delay.liveDelayFragmentCount) && !isNaN(adjustedFragmentDuration)) {\n delay = adjustedFragmentDuration * settings.get().streaming.delay.liveDelayFragmentCount;\n } else if (settings.get().streaming.delay.useSuggestedPresentationDelay === true && suggestedPresentationDelay !== null && !isNaN(suggestedPresentationDelay) && suggestedPresentationDelay > 0) {\n delay = suggestedPresentationDelay;\n } else if (!isNaN(adjustedFragmentDuration)) {\n delay = adjustedFragmentDuration * FRAGMENT_DURATION_FACTOR;\n } else {\n delay = manifestInfo && !isNaN(manifestInfo.minBufferTime) ? manifestInfo.minBufferTime * MIN_BUFFER_TIME_FACTOR : streamInfo.manifestInfo.minBufferTime * MIN_BUFFER_TIME_FACTOR;\n }\n\n startTime = adapter.getAvailabilityStartTime();\n\n if (startTime !== null) {\n availabilityStartTime = startTime;\n }\n\n if (manifestInfo && manifestInfo.dvrWindowSize > 0) {\n // cap target latency to:\n // - dvrWindowSize / 2 for short playlists\n // - dvrWindowSize - END_OF_PLAYLIST_PADDING for longer playlists\n var targetDelayCapping = Math.max(manifestInfo.dvrWindowSize - END_OF_PLAYLIST_PADDING, manifestInfo.dvrWindowSize / 2);\n ret = Math.min(delay, targetDelayCapping);\n } else {\n ret = delay;\n }\n\n liveDelay = ret;\n return ret;\n }\n\n function _applyServiceDescription(manifestInfo) {\n if (!manifestInfo || !manifestInfo.serviceDescriptions) {\n return;\n }\n\n var llsd = null;\n\n for (var i = 0; i < manifestInfo.serviceDescriptions.length; i++) {\n var sd = manifestInfo.serviceDescriptions[i];\n\n if (sd.schemeIdUri === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].SERVICE_DESCRIPTION_LL_SCHEME) {\n llsd = sd;\n break;\n }\n }\n\n if (llsd) {\n if (llsd.latency && llsd.latency.target > 0) {\n logger.debug(\'Apply LL properties coming from service description. Target Latency (ms):\', llsd.latency.target);\n settings.update({\n streaming: {\n delay: {\n liveDelay: llsd.latency.target / 1000\n },\n liveCatchup: {\n minDrift: (llsd.latency.target + 500) / 1000,\n maxDrift: llsd.latency.max > llsd.latency.target ? (llsd.latency.max - llsd.latency.target + 500) / 1000 : undefined\n }\n }\n });\n }\n\n if (llsd.playbackRate && llsd.playbackRate.max > 1.0) {\n logger.debug(\'Apply LL properties coming from service description. Max PlaybackRate:\', llsd.playbackRate.max);\n settings.update({\n streaming: {\n liveCatchup: {\n playbackRate: llsd.playbackRate.max - 1.0\n }\n }\n });\n }\n }\n }\n\n function getAvailabilityStartTime() {\n return availabilityStartTime;\n }\n\n function getLiveDelay() {\n return liveDelay;\n }\n\n function getCurrentLiveLatency() {\n if (!isDynamic || isNaN(availabilityStartTime)) {\n return NaN;\n }\n\n var currentTime = getNormalizedTime();\n\n if (isNaN(currentTime) || currentTime === 0) {\n return 0;\n }\n\n var now = new Date().getTime() + timelineConverter.getClientTimeOffset() * 1000;\n return Math.max(((now - availabilityStartTime - currentTime * 1000) / 1000).toFixed(3), 0);\n }\n\n function reset() {\n pause();\n playOnceInitialized = false;\n liveDelay = 0;\n availabilityStartTime = 0;\n manifestUpdateInProgress = false;\n seekTarget = NaN;\n\n if (videoModel) {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].DATA_UPDATE_COMPLETED, _onDataUpdateCompleted, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].LOADING_PROGRESS, _onFragmentLoadProgress, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].MANIFEST_UPDATED, _onManifestUpdated, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].STREAMS_COMPOSED, _onStreamsComposed, instance);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].BUFFER_LEVEL_STATE_CHANGED, _onBufferLevelStateChanged, instance);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].PLAYBACK_PROGRESS, _onPlaybackProgression, instance);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].PLAYBACK_TIME_UPDATED, _onPlaybackProgression, instance);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].PLAYBACK_ENDED, _onPlaybackEnded, instance);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].STREAM_INITIALIZING, _onStreamInitializing, instance);\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_6__["default"].REPRESENTATION_SWITCH, _onRepresentationSwitch, instance);\n videoModel.setPlaybackRate(1.0, true);\n stopUpdatingWallclockTime();\n removeAllListeners();\n }\n\n wallclockTimeIntervalId = null;\n videoModel = null;\n streamInfo = null;\n isDynamic = null;\n }\n\n function setConfig(config) {\n if (!config) return;\n\n if (config.streamController) {\n streamController = config.streamController;\n }\n\n if (config.dashMetrics) {\n dashMetrics = config.dashMetrics;\n }\n\n if (config.mediaPlayerModel) {\n mediaPlayerModel = config.mediaPlayerModel;\n }\n\n if (config.adapter) {\n adapter = config.adapter;\n }\n\n if (config.videoModel) {\n videoModel = config.videoModel;\n }\n\n if (config.timelineConverter) {\n timelineConverter = config.timelineConverter;\n }\n\n if (config.settings) {\n settings = config.settings;\n }\n }\n\n function getActualPresentationTime(currentTime, mediatype) {\n var DVRMetrics = dashMetrics.getCurrentDVRInfo(mediatype);\n var DVRWindow = DVRMetrics ? DVRMetrics.range : null;\n var actualTime;\n\n if (!DVRWindow) {\n return NaN;\n }\n\n if (currentTime > DVRWindow.end) {\n actualTime = Math.max(DVRWindow.end - liveDelay, DVRWindow.start);\n } else if (currentTime > 0 && currentTime + 0.250 < DVRWindow.start && Math.abs(currentTime - DVRWindow.start) < 315360000) {\n // Checking currentTime plus 250ms as the \'timeupdate\' is fired with a frequency between 4Hz and 66Hz\n // https://developer.mozilla.org/en-US/docs/Web/Events/timeupdate\n // http://w3c.github.io/html/single-page.html#offsets-into-the-media-resource\n // Checking also duration of the DVR makes sense. We detected temporary situations in which currentTime\n // is bad reported by the browser which causes playback to jump to start (315360000 = 1 year)\n if (settings.get().streaming.lowLatencyEnabled) {\n actualTime = Math.max(DVRWindow.end - liveDelay, DVRWindow.start);\n } else {\n actualTime = DVRWindow.start;\n }\n } else {\n actualTime = currentTime;\n }\n\n return actualTime;\n }\n\n function startUpdatingWallclockTime() {\n if (wallclockTimeIntervalId !== null) return;\n\n var tick = function tick() {\n _onWallclockTime();\n };\n\n wallclockTimeIntervalId = setInterval(tick, settings.get().streaming.wallclockTimeUpdateInterval);\n }\n\n function stopUpdatingWallclockTime() {\n clearInterval(wallclockTimeIntervalId);\n wallclockTimeIntervalId = null;\n }\n /**\n * Compare the current time of the video against the DVR window. If we are out of the DVR window we need to seek.\n * @param {object} mediaType\n */\n\n\n function updateCurrentTime() {\n var mediaType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n if (isPaused() || !isDynamic || videoModel.getReadyState() === 0 || isSeeking() || manifestUpdateInProgress) return; // Note: In some cases we filter certain media types completely (for instance due to an unsupported video codec). This happens after the first entry to the DVR metric has been added.\n // Now the DVR window for the filtered media type is not updated anymore. Consequently, always use a mediaType that is available to get a valid DVR window.\n\n if (!mediaType) {\n mediaType = streamController.hasVideoTrack() ? _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO : _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO;\n } // Compare the current time of the video element against the range defined in the DVR window.\n\n\n var currentTime = getNormalizedTime();\n var actualTime = getActualPresentationTime(currentTime, mediaType);\n var timeChanged = !isNaN(actualTime) && actualTime !== currentTime;\n\n if (timeChanged && !isSeeking() && (isStalled() || playbackStalled || videoModel.getReadyState() === 1)) {\n logger.debug("UpdateCurrentTime: Seek to actual time: ".concat(actualTime, " from currentTime: ").concat(currentTime));\n seek(actualTime);\n }\n }\n\n function _onDataUpdateCompleted(e) {\n var representationInfo = adapter.convertRepresentationToRepresentationInfo(e.currentRepresentation);\n var info = representationInfo ? representationInfo.mediaInfo.streamInfo : null;\n if (info === null || streamInfo.id !== info.id) return;\n streamInfo = info;\n }\n\n function _onCanPlay() {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].CAN_PLAY);\n }\n\n function _onCanPlayThrough() {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].CAN_PLAY_THROUGH);\n }\n\n function _onPlaybackStart() {\n logger.info(\'Native video element event: play\');\n updateCurrentTime();\n startUpdatingWallclockTime();\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_STARTED, {\n startTime: getTime()\n });\n }\n\n function _onPlaybackWaiting() {\n logger.info(\'Native video element event: waiting\');\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_WAITING, {\n playingTime: getTime()\n });\n }\n\n function _onPlaybackPlaying() {\n logger.info(\'Native video element event: playing\');\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_PLAYING, {\n playingTime: getTime()\n });\n }\n\n function _onPlaybackPaused() {\n logger.info(\'Native video element event: pause\');\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_PAUSED, {\n ended: getEnded()\n });\n }\n\n function _onPlaybackSeeking() {\n // Check if internal seeking to be ignored\n if (internalSeek) {\n internalSeek = false;\n return;\n }\n\n var seekTime = getTime(); // On some browsers/devices, in case of live streams, setting current time on video element fails when there is no buffered data at requested time\n // Then re-set seek target time and video element will be seeked afterwhile once data is buffered (see BufferContoller)\n\n if (!isNaN(seekTarget) && seekTarget !== seekTime) {\n seekTime = seekTarget;\n }\n\n seekTarget = NaN;\n logger.info(\'Seeking to: \' + seekTime);\n startUpdatingWallclockTime();\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_SEEKING, {\n seekTime: seekTime,\n streamId: streamInfo.id\n });\n }\n\n function _onPlaybackSeeked() {\n logger.info(\'Native video element event: seeked\');\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_SEEKED);\n }\n\n function _onPlaybackTimeUpdated() {\n if (streamInfo) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_TIME_UPDATED, {\n timeToEnd: getTimeToStreamEnd(),\n time: getTime(),\n streamId: streamInfo.id\n });\n }\n }\n\n function _onPlaybackProgress() {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_PROGRESS, {\n streamId: streamInfo.id\n });\n }\n\n function _onPlaybackRateChanged() {\n var rate = getPlaybackRate();\n logger.info(\'Native video element event: ratechange: \', rate);\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_RATE_CHANGED, {\n playbackRate: rate\n });\n }\n\n function _onPlaybackMetaDataLoaded() {\n logger.info(\'Native video element event: loadedmetadata\');\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_METADATA_LOADED);\n startUpdatingWallclockTime();\n }\n\n function _onPlaybackLoadedData() {\n logger.info(\'Native video element event: loadeddata\');\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_LOADED_DATA);\n } // Event to handle the native video element ended event\n\n\n function _onNativePlaybackEnded() {\n logger.info(\'Native video element event: ended\');\n pause();\n stopUpdatingWallclockTime();\n var streamInfo = streamController ? streamController.getActiveStreamInfo() : null;\n if (!streamInfo) return;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_ENDED, {\n \'isLast\': streamInfo.isLast\n });\n } // Handle DASH PLAYBACK_ENDED event\n\n\n function _onPlaybackEnded(e) {\n if (wallclockTimeIntervalId && e.isLast) {\n // PLAYBACK_ENDED was triggered elsewhere, react.\n logger.info(\'onPlaybackEnded -- PLAYBACK_ENDED but native video element didn\\\'t fire ended\');\n var seekTime = e.seekTime ? e.seekTime : getStreamEndTime();\n videoModel.setCurrentTime(seekTime);\n pause();\n stopUpdatingWallclockTime();\n }\n }\n\n function _onPlaybackError(event) {\n var target = event.target || event.srcElement;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_ERROR, {\n error: target.error\n });\n }\n\n function _onWallclockTime() {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].WALLCLOCK_TIME_UPDATED, {\n isDynamic: isDynamic,\n time: new Date()\n }); // Updates playback time for paused dynamic streams\n // (video element doesn\'t call timeupdate when the playback is paused)\n\n if (getIsDynamic()) {\n streamController.addDVRMetric();\n\n if (isPaused()) {\n _updateLivePlaybackTime();\n } else {\n updateCurrentTime();\n }\n }\n }\n\n function _updateLivePlaybackTime() {\n var now = Date.now();\n\n if (!lastLivePlaybackTime || now > lastLivePlaybackTime + LIVE_UPDATE_PLAYBACK_TIME_INTERVAL_MS) {\n lastLivePlaybackTime = now;\n\n _onPlaybackTimeUpdated();\n }\n }\n\n function _onPlaybackProgression() {\n if (isDynamic && _isCatchupEnabled() && settings.get().streaming.liveCatchup.playbackRate > 0 && !isPaused() && !isSeeking()) {\n if (_needToCatchUp()) {\n startPlaybackCatchUp();\n } else {\n stopPlaybackCatchUp();\n }\n }\n }\n\n function _isCatchupEnabled() {\n return settings.get().streaming.liveCatchup.enabled || settings.get().streaming.lowLatencyEnabled;\n }\n\n function getBufferLevel() {\n var bufferLevel = null;\n streamController.getActiveStreamProcessors().forEach(function (p) {\n var bl = p.getBufferLevel();\n\n if (bufferLevel === null) {\n bufferLevel = bl;\n } else {\n bufferLevel = Math.min(bufferLevel, bl);\n }\n });\n return bufferLevel;\n }\n /**\n * Returns the mode for live playback catchup.\n * @return {String}\n * @private\n */\n\n\n function _getCatchupMode() {\n var playbackBufferMin = settings.get().streaming.liveCatchup.playbackBufferMin;\n return settings.get().streaming.liveCatchup.mode === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].LIVE_CATCHUP_MODE_LOLP && playbackBufferMin !== null && !isNaN(playbackBufferMin) ? _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].LIVE_CATCHUP_MODE_LOLP : _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].LIVE_CATCHUP_MODE_DEFAULT;\n }\n /**\n * Checks whether the catchup mechanism should be enabled\n * @return {boolean}\n */\n\n\n function _needToCatchUp() {\n try {\n if (_isCatchupEnabled() && settings.get().streaming.liveCatchup.playbackRate > 0 && getTime() > 0) {\n var catchupMode = _getCatchupMode();\n\n var currentLiveLatency = getCurrentLiveLatency();\n\n var _liveDelay = mediaPlayerModel.getLiveDelay();\n\n var liveCatchupLatencyThreshold = mediaPlayerModel.getLiveCatchupLatencyThreshold();\n var liveCatchUpMinDrift = settings.get().streaming.liveCatchup.minDrift;\n\n if (catchupMode === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].LIVE_CATCHUP_MODE_LOLP) {\n var currentBuffer = getBufferLevel();\n var playbackBufferMin = settings.get().streaming.liveCatchup.playbackBufferMin;\n return _lolpNeedToCatchUpCustom(currentLiveLatency, _liveDelay, liveCatchUpMinDrift, currentBuffer, playbackBufferMin, liveCatchupLatencyThreshold);\n } else {\n return _defaultNeedToCatchUp(currentLiveLatency, _liveDelay, liveCatchupLatencyThreshold, liveCatchUpMinDrift);\n }\n }\n } catch (e) {\n return false;\n }\n }\n /**\n * Default algorithm to determine if catchup mode should be enabled\n * @param {number} currentLiveLatency\n * @param {number} liveDelay\n * @param {number} liveCatchupLatencyThreshold\n * @param {number} minDrift\n * @return {boolean}\n * @private\n */\n\n\n function _defaultNeedToCatchUp(currentLiveLatency, liveDelay, liveCatchupLatencyThreshold, minDrift) {\n try {\n var latencyDrift = Math.abs(currentLiveLatency - liveDelay);\n return latencyDrift > minDrift && (isNaN(liveCatchupLatencyThreshold) || currentLiveLatency <= liveCatchupLatencyThreshold);\n } catch (e) {\n return false;\n }\n }\n /**\n * LoL+ logic to determine if catchup mode should be enabled\n * @param {number} currentLiveLatency\n * @param {number} liveDelay\n * @param {number} minDrift\n * @param {number} currentBuffer\n * @param {number} playbackBufferMin\n * @param {number} liveCatchupLatencyThreshold\n * @return {boolean}\n * @private\n */\n\n\n function _lolpNeedToCatchUpCustom(currentLiveLatency, liveDelay, minDrift, currentBuffer, playbackBufferMin, liveCatchupLatencyThreshold) {\n try {\n var latencyDrift = Math.abs(currentLiveLatency - liveDelay);\n return (isNaN(liveCatchupLatencyThreshold) || currentLiveLatency <= liveCatchupLatencyThreshold) && (latencyDrift > minDrift || currentBuffer < playbackBufferMin);\n } catch (e) {\n return false;\n }\n }\n /**\n * Apply catchup mode\n */\n\n\n function startPlaybackCatchUp() {\n if (videoModel) {\n var results;\n var currentPlaybackRate = videoModel.getPlaybackRate();\n var liveCatchupPlaybackRate = settings.get().streaming.liveCatchup.playbackRate;\n var currentLiveLatency = getCurrentLiveLatency();\n\n var _liveDelay2 = mediaPlayerModel.getLiveDelay();\n\n var bufferLevel = getBufferLevel(); // Custom playback control: Based on buffer level\n\n if (_getCatchupMode() === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].LIVE_CATCHUP_MODE_LOLP) {\n var liveCatchUpMinDrift = settings.get().streaming.liveCatchup.minDrift;\n var playbackBufferMin = settings.get().streaming.liveCatchup.playbackBufferMin;\n results = _calculateNewPlaybackRateLolP(liveCatchupPlaybackRate, currentLiveLatency, _liveDelay2, liveCatchUpMinDrift, playbackBufferMin, bufferLevel, currentPlaybackRate);\n } else {\n // Default playback control: Based on target and current latency\n results = _calculateNewPlaybackRateDefault(liveCatchupPlaybackRate, currentLiveLatency, _liveDelay2, bufferLevel, currentPlaybackRate);\n } // Obtain newRate and apply to video model\n\n\n var newRate = results.newRate;\n\n if (newRate) {\n // non-null\n videoModel.setPlaybackRate(newRate);\n }\n\n var deltaLatency = currentLiveLatency - _liveDelay2;\n\n if (settings.get().streaming.liveCatchup.maxDrift > 0 && !isLowLatencySeekingInProgress && deltaLatency > settings.get().streaming.liveCatchup.maxDrift) {\n logger.info(\'Low Latency catchup mechanism. Latency too high, doing a seek to live point\');\n isLowLatencySeekingInProgress = true;\n seekToLive();\n } else {\n isLowLatencySeekingInProgress = false;\n }\n }\n }\n /**\n * Default algorithm to calculate the new playback rate\n * @param {number} liveCatchUpPlaybackRate\n * @param {number} currentLiveLatency\n * @param {number} liveDelay\n * @param {number} bufferLevel\n * @param {number} currentPlaybackRate\n * @return {{newRate: number}}\n * @private\n */\n\n\n function _calculateNewPlaybackRateDefault(liveCatchUpPlaybackRate, currentLiveLatency, liveDelay, bufferLevel, currentPlaybackRate) {\n var cpr = liveCatchUpPlaybackRate;\n var deltaLatency = currentLiveLatency - liveDelay;\n var d = deltaLatency * 5; // Playback rate must be between (1 - cpr) - (1 + cpr)\n // ex: if cpr is 0.5, it can have values between 0.5 - 1.5\n\n var s = cpr * 2 / (1 + Math.pow(Math.E, -d));\n var newRate = 1 - cpr + s; // take into account situations in which there are buffer stalls,\n // in which increasing playbackRate to reach target latency will\n // just cause more and more stall situations\n\n if (playbackStalled) {\n // const bufferLevel = getBufferLevel();\n if (bufferLevel > liveDelay / 2) {\n // playbackStalled = false;\n playbackStalled = false;\n } else if (deltaLatency > 0) {\n newRate = 1.0;\n }\n } // don\'t change playbackrate for small variations (don\'t overload element with playbackrate changes)\n\n\n if (Math.abs(currentPlaybackRate - newRate) <= minPlaybackRateChange) {\n newRate = null;\n }\n\n return {\n newRate: newRate\n };\n }\n /**\n * Lol+ algorithm to calculate the new playback rate\n * @param {number} liveCatchUpPlaybackRate\n * @param {number} currentLiveLatency\n * @param {number} liveDelay\n * @param {number} minDrift\n * @param {number} playbackBufferMin\n * @param {number} bufferLevel\n * @param {number} currentPlaybackRate\n * @return {{newRate: number}}\n * @private\n */\n\n\n function _calculateNewPlaybackRateLolP(liveCatchUpPlaybackRate, currentLiveLatency, liveDelay, minDrift, playbackBufferMin, bufferLevel, currentPlaybackRate) {\n var cpr = liveCatchUpPlaybackRate;\n var newRate; // Hybrid: Buffer-based\n\n if (bufferLevel < playbackBufferMin) {\n // Buffer in danger, slow down\n var deltaBuffer = bufferLevel - playbackBufferMin; // -ve value\n\n var d = deltaBuffer * 5; // Playback rate must be between (1 - cpr) - (1 + cpr)\n // ex: if cpr is 0.5, it can have values between 0.5 - 1.5\n\n var s = cpr * 2 / (1 + Math.pow(Math.E, -d));\n newRate = 1 - cpr + s;\n logger.debug(\'[LoL+ playback control_buffer-based] bufferLevel: \' + bufferLevel + \', newRate: \' + newRate);\n } else {\n // Hybrid: Latency-based\n // Buffer is safe, vary playback rate based on latency\n // Check if latency is within range of target latency\n var minDifference = 0.02;\n\n if (Math.abs(currentLiveLatency - liveDelay) <= minDifference * liveDelay) {\n newRate = 1;\n } else {\n var deltaLatency = currentLiveLatency - liveDelay;\n\n var _d = deltaLatency * 5; // Playback rate must be between (1 - cpr) - (1 + cpr)\n // ex: if cpr is 0.5, it can have values between 0.5 - 1.5\n\n\n var _s = cpr * 2 / (1 + Math.pow(Math.E, -_d));\n\n newRate = 1 - cpr + _s;\n }\n\n logger.debug(\'[LoL+ playback control_latency-based] latency: \' + currentLiveLatency + \', newRate: \' + newRate);\n }\n\n if (playbackStalled) {\n if (bufferLevel > liveDelay / 2) {\n playbackStalled = false;\n }\n } // don\'t change playbackrate for small variations (don\'t overload element with playbackrate changes)\n\n\n if (Math.abs(currentPlaybackRate - newRate) <= minPlaybackRateChange) {\n newRate = null;\n }\n\n return {\n newRate: newRate\n };\n }\n\n function stopPlaybackCatchUp() {\n if (videoModel) {\n videoModel.setPlaybackRate(1.0);\n }\n }\n\n function _onFragmentLoadProgress(e) {\n // If using fetch and stream mode is not available, readjust live latency so it is 20% higher than segment duration\n if (e.stream === false && settings.get().streaming.lowLatencyEnabled && !isNaN(e.request.duration)) {\n var minDelay = 1.2 * e.request.duration;\n\n if (minDelay > mediaPlayerModel.getLiveDelay()) {\n logger.warn(\'Browser does not support fetch API with StreamReader. Increasing live delay to be 20% higher than segment duration:\', minDelay.toFixed(2));\n settings.update({\n streaming: {\n delay: {\n liveDelay: minDelay\n }\n }\n });\n }\n }\n }\n\n function _onBufferLevelStateChanged(e) {\n // do not stall playback when get an event from Stream that is not active\n if (e.streamId !== streamInfo.id) return;\n\n if (_isCatchupEnabled()) {\n if (e.state === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_EMPTY && !isSeeking()) {\n if (!playbackStalled) {\n playbackStalled = true;\n stopPlaybackCatchUp();\n }\n }\n } else {\n if (settings.get().streaming.buffer.setStallState) {\n videoModel.setStallState(e.mediaType, e.state === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_EMPTY);\n }\n }\n }\n\n function onPlaybackStalled(e) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_STALLED, {\n e: e\n });\n }\n\n function _onStreamInitializing(e) {\n _checkEnableLowLatency(e.mediaInfo);\n }\n /**\n * We enable low latency playback if for the current representation availabilityTimeComplete is set to false\n * @param e\n * @private\n */\n\n\n function _onRepresentationSwitch(e) {\n var activeStreamInfo = streamController.getActiveStreamInfo();\n\n if (!settings.get().streaming.lowLatencyEnabledByManifest || !e || !activeStreamInfo || !e.currentRepresentation || !e.streamId || e.streamId !== activeStreamInfo.id || !e.mediaType || e.mediaType !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO && e.mediaType !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO) {\n return;\n }\n\n var lowLatencyEnabled = !e.currentRepresentation.availabilityTimeComplete;\n\n if (lowLatencyEnabled) {\n settings.update({\n streaming: {\n lowLatencyEnabled: lowLatencyEnabled\n }\n });\n }\n }\n /**\n * A new manifest has been loaded, updating is still in progress.\n * @private\n */\n\n\n function _onManifestUpdated() {\n manifestUpdateInProgress = true;\n }\n /**\n * Manifest update was completed\n * @private\n */\n\n\n function _onStreamsComposed() {\n manifestUpdateInProgress = false;\n }\n\n function _checkEnableLowLatency(mediaInfo) {\n if (mediaInfo && mediaInfo.supplementalProperties && mediaInfo.supplementalProperties[_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].SUPPLEMENTAL_PROPERTY_LL_SCHEME] === \'true\') {\n logger.debug(\'Low Latency critical SupplementalProperty set: Enabling low Latency\');\n settings.update({\n streaming: {\n lowLatencyEnabled: true\n }\n });\n }\n }\n\n function addAllListeners() {\n videoModel.addEventListener(\'canplay\', _onCanPlay);\n videoModel.addEventListener(\'canplaythrough\', _onCanPlayThrough);\n videoModel.addEventListener(\'play\', _onPlaybackStart);\n videoModel.addEventListener(\'waiting\', _onPlaybackWaiting);\n videoModel.addEventListener(\'playing\', _onPlaybackPlaying);\n videoModel.addEventListener(\'pause\', _onPlaybackPaused);\n videoModel.addEventListener(\'error\', _onPlaybackError);\n videoModel.addEventListener(\'seeking\', _onPlaybackSeeking);\n videoModel.addEventListener(\'seeked\', _onPlaybackSeeked);\n videoModel.addEventListener(\'timeupdate\', _onPlaybackTimeUpdated);\n videoModel.addEventListener(\'progress\', _onPlaybackProgress);\n videoModel.addEventListener(\'ratechange\', _onPlaybackRateChanged);\n videoModel.addEventListener(\'loadedmetadata\', _onPlaybackMetaDataLoaded);\n videoModel.addEventListener(\'loadeddata\', _onPlaybackLoadedData);\n videoModel.addEventListener(\'stalled\', onPlaybackStalled);\n videoModel.addEventListener(\'ended\', _onNativePlaybackEnded);\n }\n\n function removeAllListeners() {\n videoModel.removeEventListener(\'canplay\', _onCanPlay);\n videoModel.removeEventListener(\'canplaythrough\', _onCanPlayThrough);\n videoModel.removeEventListener(\'play\', _onPlaybackStart);\n videoModel.removeEventListener(\'waiting\', _onPlaybackWaiting);\n videoModel.removeEventListener(\'playing\', _onPlaybackPlaying);\n videoModel.removeEventListener(\'pause\', _onPlaybackPaused);\n videoModel.removeEventListener(\'error\', _onPlaybackError);\n videoModel.removeEventListener(\'seeking\', _onPlaybackSeeking);\n videoModel.removeEventListener(\'seeked\', _onPlaybackSeeked);\n videoModel.removeEventListener(\'timeupdate\', _onPlaybackTimeUpdated);\n videoModel.removeEventListener(\'progress\', _onPlaybackProgress);\n videoModel.removeEventListener(\'ratechange\', _onPlaybackRateChanged);\n videoModel.removeEventListener(\'loadedmetadata\', _onPlaybackMetaDataLoaded);\n videoModel.removeEventListener(\'loadeddata\', _onPlaybackLoadedData);\n videoModel.removeEventListener(\'stalled\', onPlaybackStalled);\n videoModel.removeEventListener(\'ended\', _onNativePlaybackEnded);\n }\n\n instance = {\n initialize: initialize,\n setConfig: setConfig,\n getTimeToStreamEnd: getTimeToStreamEnd,\n getBufferLevel: getBufferLevel,\n getTime: getTime,\n getNormalizedTime: getNormalizedTime,\n getIsManifestUpdateInProgress: getIsManifestUpdateInProgress,\n getPlaybackRate: getPlaybackRate,\n getPlayedRanges: getPlayedRanges,\n getEnded: getEnded,\n getIsDynamic: getIsDynamic,\n getStreamController: getStreamController,\n computeAndSetLiveDelay: computeAndSetLiveDelay,\n getLiveDelay: getLiveDelay,\n getCurrentLiveLatency: getCurrentLiveLatency,\n play: play,\n isPaused: isPaused,\n pause: pause,\n isSeeking: isSeeking,\n getStreamEndTime: getStreamEndTime,\n seek: seek,\n reset: reset,\n updateCurrentTime: updateCurrentTime,\n getAvailabilityStartTime: getAvailabilityStartTime\n };\n setup();\n return instance;\n}\n\nPlaybackController.__dashjs_factory_name = \'PlaybackController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_4__["default"].getSingletonFactory(PlaybackController));\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/ScheduleController.js":\n/*!*********************************************************!*\\\n !*** ./src/streaming/controllers/ScheduleController.js ***!\n \\*********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1490290__) {\n__nested_webpack_require_1490290__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1490290__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _models_FragmentModel__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1490290__(/*! ../models/FragmentModel */ "./src/streaming/models/FragmentModel.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1490290__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1490290__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1490290__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1490290__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1490290__(/*! ../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1490290__(/*! ../MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\nfunction ScheduleController(config) {\n config = config || {};\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance();\n var dashMetrics = config.dashMetrics;\n var mediaPlayerModel = config.mediaPlayerModel;\n var fragmentModel = config.fragmentModel;\n var abrController = config.abrController;\n var playbackController = config.playbackController;\n var textController = config.textController;\n var type = config.type;\n var bufferController = config.bufferController;\n var settings = config.settings;\n var instance, streamInfo, logger, currentRepresentationInfo, timeToLoadDelay, scheduleTimeout, hasVideoTrack, lastFragmentRequest, topQualityIndex, lastInitializedQuality, switchTrack, initSegmentRequired, checkPlaybackQuality;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance().getLogger(instance);\n resetInitialSettings();\n streamInfo = config.streamInfo;\n }\n\n function initialize(_hasVideoTrack) {\n hasVideoTrack = _hasVideoTrack;\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].BYTES_APPENDED_END_FRAGMENT, _onBytesAppended, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].URL_RESOLUTION_FAILED, _onURLResolutionFailed, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].PLAYBACK_STARTED, _onPlaybackStarted, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].PLAYBACK_RATE_CHANGED, _onPlaybackRateChanged, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].PLAYBACK_TIME_UPDATED, _onPlaybackTimeUpdated, instance);\n }\n\n function getType() {\n return type;\n }\n\n function getStreamId() {\n return streamInfo.id;\n }\n\n function setCurrentRepresentation(representationInfo) {\n currentRepresentationInfo = representationInfo;\n }\n\n function startScheduleTimer(value) {\n if (bufferController.getIsBufferingCompleted()) return;\n clearScheduleTimer();\n var timeoutValue = !isNaN(value) ? value : 0;\n scheduleTimeout = setTimeout(schedule, timeoutValue);\n }\n\n function clearScheduleTimer() {\n if (scheduleTimeout) {\n clearTimeout(scheduleTimeout);\n scheduleTimeout = null;\n }\n }\n\n function hasTopQualityChanged() {\n var streamId = streamInfo.id;\n var newTopQualityIndex = abrController.getMaxAllowedIndexFor(type, streamId);\n\n if (isNaN(topQualityIndex) || topQualityIndex != newTopQualityIndex) {\n logger.info(\'Top quality \' + type + \' index has changed from \' + topQualityIndex + \' to \' + newTopQualityIndex);\n topQualityIndex = newTopQualityIndex;\n return true;\n }\n\n return false;\n }\n /**\n * Schedule the request for an init or a media segment\n */\n\n\n function schedule() {\n try {\n // Check if we are supposed to stop scheduling\n if (_shouldClearScheduleTimer()) {\n clearScheduleTimer();\n return;\n }\n\n if (_shouldScheduleNextRequest()) {\n var qualityChange = false;\n\n if (checkPlaybackQuality) {\n // in case the playback quality is supposed to be changed, the corresponding StreamProcessor will update the currentRepresentation.\n // The StreamProcessor will also start the schedule timer again once the quality switch has beeen prepared. Consequently, we only call _getNextFragment if the quality is not changed.\n qualityChange = abrController.checkPlaybackQuality(type, streamInfo.id);\n }\n\n if (!qualityChange) {\n _getNextFragment();\n }\n } else {\n startScheduleTimer(settings.get().streaming.lowLatencyEnabled ? settings.get().streaming.scheduling.lowLatencyTimeout : settings.get().streaming.scheduling.defaultTimeout);\n }\n } catch (e) {\n startScheduleTimer(settings.get().streaming.lowLatencyEnabled ? settings.get().streaming.scheduling.lowLatencyTimeout : settings.get().streaming.scheduling.defaultTimeout);\n }\n }\n /**\n * Triggers the events to start requesting an init or a media segment. This will be picked up by the corresponding StreamProcessor.\n * @private\n */\n\n\n function _getNextFragment() {\n // A quality changed occured or we are switching the AdaptationSet. In that case we need to load a new init segment\n if (initSegmentRequired || currentRepresentationInfo.quality !== lastInitializedQuality || switchTrack) {\n if (switchTrack) {\n logger.debug(\'Switch track for \' + type + \', representation id = \' + currentRepresentationInfo.id);\n switchTrack = false;\n } else {\n logger.debug(\'Quality has changed, get init request for representationid = \' + currentRepresentationInfo.id);\n }\n\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].INIT_FRAGMENT_NEEDED, {\n representationId: currentRepresentationInfo.id,\n sender: instance\n }, {\n streamId: streamInfo.id,\n mediaType: type\n });\n checkPlaybackQuality = false;\n initSegmentRequired = false;\n } // Request a media segment instead\n else {\n logger.debug("Media segment needed for ".concat(type, " and stream id ").concat(streamInfo.id));\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_FRAGMENT_NEEDED, {}, {\n streamId: streamInfo.id,\n mediaType: type\n });\n checkPlaybackQuality = true;\n }\n }\n /**\n * Check if we need to stop scheduling for now.\n * @return {boolean}\n * @private\n */\n\n\n function _shouldClearScheduleTimer() {\n try {\n return type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT && !textController.isTextEnabled() || playbackController.isPaused() && (!playbackController.getStreamController().getInitialPlayback() || !playbackController.getStreamController().getAutoPlay()) && !settings.get().streaming.scheduling.scheduleWhilePaused;\n } catch (e) {\n return false;\n }\n }\n /**\n * Check if we can start scheduling the next request\n * @return {boolean}\n * @private\n */\n\n\n function _shouldScheduleNextRequest() {\n try {\n return currentRepresentationInfo && (isNaN(lastInitializedQuality) || switchTrack || hasTopQualityChanged() || _shouldBuffer());\n } catch (e) {\n return false;\n }\n }\n /**\n * Check if the current buffer level is below our buffer target.\n * @return {boolean}\n * @private\n */\n\n\n function _shouldBuffer() {\n if (!type || !currentRepresentationInfo) {\n return true;\n }\n\n var bufferLevel = dashMetrics.getCurrentBufferLevel(type);\n return bufferLevel < getBufferTarget();\n }\n /**\n * Determine the buffer target depending on the type and whether we have audio and video AdaptationSets available\n * @return {number}\n */\n\n\n function getBufferTarget() {\n var bufferTarget = NaN;\n\n if (!type || !currentRepresentationInfo) {\n return bufferTarget;\n }\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT) {\n bufferTarget = _getBufferTargetForFragmentedText();\n } else if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO && hasVideoTrack) {\n bufferTarget = _getBufferTargetForAudio();\n } else {\n bufferTarget = _getGenericBufferTarget();\n }\n\n return bufferTarget;\n }\n /**\n * Returns the buffer target for fragmented text tracks\n * @return {number}\n * @private\n */\n\n\n function _getBufferTargetForFragmentedText() {\n try {\n if (textController.isTextEnabled()) {\n if (isNaN(currentRepresentationInfo.fragmentDuration)) {\n //fragmentDuration of currentRepresentationInfo is not defined,\n // call metrics function to have data in the latest scheduling info...\n // if no metric, returns 0. In this case, rule will return false.\n var schedulingInfo = dashMetrics.getCurrentSchedulingInfo(_constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_6__["default"].SCHEDULING_INFO);\n return schedulingInfo ? schedulingInfo.duration : 0;\n } else {\n return currentRepresentationInfo.fragmentDuration;\n }\n } else {\n // text is disabled, rule will return false\n return 0;\n }\n } catch (e) {\n return 0;\n }\n }\n /**\n * Returns the buffer target for audio tracks in case we have a video track available as well\n * @return {number}\n * @private\n */\n\n\n function _getBufferTargetForAudio() {\n try {\n var videoBufferLevel = dashMetrics.getCurrentBufferLevel(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO); // For multiperiod we need to consider that audio and video segments might have different durations.\n // This can lead to scenarios in which we completely buffered the video segments and the video buffer level for the current period is not changing anymore. However we might still need a small audio segment to finish buffering audio as well.\n // If we set the buffer time of audio equal to the video buffer time scheduling for the remaining audio segment will only be triggered when audio fragmentDuration > videoBufferLevel. That will delay preloading of the upcoming period.\n // Should find a better solution than just adding 1\n\n if (isNaN(currentRepresentationInfo.fragmentDuration)) {\n return videoBufferLevel + 1;\n } else {\n return Math.max(videoBufferLevel + 1, currentRepresentationInfo.fragmentDuration);\n }\n } catch (e) {\n return 0;\n }\n }\n /**\n * Determines the generic buffer target, for instance for video tracks\n * @return {number}\n * @private\n */\n\n\n function _getGenericBufferTarget() {\n try {\n var _streamInfo = currentRepresentationInfo.mediaInfo.streamInfo;\n\n if (abrController.isPlayingAtTopQuality(_streamInfo)) {\n var isLongFormContent = _streamInfo.manifestInfo.duration >= settings.get().streaming.buffer.longFormContentDurationThreshold;\n return isLongFormContent ? settings.get().streaming.buffer.bufferTimeAtTopQualityLongForm : settings.get().streaming.buffer.bufferTimeAtTopQuality;\n } else {\n return mediaPlayerModel.getStableBufferTime();\n }\n } catch (e) {\n return mediaPlayerModel.getStableBufferTime();\n }\n }\n\n function setSwitchTrack(value) {\n switchTrack = value;\n }\n\n function getSwitchStrack() {\n return switchTrack;\n }\n\n function _onPlaybackTimeUpdated() {\n _completeQualityChange(true);\n }\n\n function _completeQualityChange(trigger) {\n if (playbackController && fragmentModel) {\n var item = fragmentModel.getRequests({\n state: _models_FragmentModel__WEBPACK_IMPORTED_MODULE_1__["default"].FRAGMENT_MODEL_EXECUTED,\n time: playbackController.getTime(),\n threshold: 0\n })[0];\n\n if (item && playbackController.getTime() >= item.startTime) {\n if ((!lastFragmentRequest.mediaInfo || item.mediaInfo.type === lastFragmentRequest.mediaInfo.type && item.mediaInfo.id !== lastFragmentRequest.mediaInfo.id) && trigger) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].TRACK_CHANGE_RENDERED, {\n mediaType: type,\n oldMediaInfo: lastFragmentRequest.mediaInfo,\n newMediaInfo: item.mediaInfo,\n streamId: streamInfo.id\n });\n }\n\n if ((item.quality !== lastFragmentRequest.quality || item.adaptationIndex !== lastFragmentRequest.adaptationIndex) && trigger) {\n logger.debug("Quality change rendered for streamId ".concat(streamInfo.id, " and type ").concat(type));\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].QUALITY_CHANGE_RENDERED, {\n mediaType: type,\n oldQuality: lastFragmentRequest.quality,\n newQuality: item.quality,\n streamId: streamInfo.id\n });\n }\n\n lastFragmentRequest = {\n mediaInfo: item.mediaInfo,\n quality: item.quality,\n adaptationIndex: item.adaptationIndex\n };\n }\n }\n }\n\n function _onBytesAppended(e) {\n logger.debug("Appended bytes for ".concat(e.mediaType, " and stream id ").concat(streamInfo.id)); // we save the last initialized quality. That way we make sure that the media fragments we are about to append match the init segment\n\n if (isNaN(e.index) || isNaN(lastInitializedQuality)) {\n lastInitializedQuality = e.quality;\n logger.info(\'[\' + type + \'] \' + \'lastInitializedRepresentationInfo changed to \' + e.quality);\n }\n\n startScheduleTimer(0);\n }\n\n function _onURLResolutionFailed() {\n fragmentModel.abortRequests();\n clearScheduleTimer();\n }\n\n function _onPlaybackStarted() {\n if (!settings.get().streaming.scheduling.scheduleWhilePaused) {\n startScheduleTimer();\n }\n }\n\n function _onPlaybackRateChanged(e) {\n dashMetrics.updatePlayListTraceMetrics({\n playbackspeed: e.playbackRate.toString()\n });\n }\n\n function setTimeToLoadDelay(value) {\n timeToLoadDelay = value;\n }\n\n function getTimeToLoadDelay() {\n return timeToLoadDelay;\n }\n\n function setCheckPlaybackQuality(value) {\n checkPlaybackQuality = value;\n }\n\n function setInitSegmentRequired(value) {\n initSegmentRequired = value;\n }\n\n function resetInitialSettings() {\n checkPlaybackQuality = true;\n timeToLoadDelay = 0;\n lastInitializedQuality = NaN;\n lastFragmentRequest = {\n mediaInfo: undefined,\n quality: NaN,\n adaptationIndex: NaN\n };\n topQualityIndex = NaN;\n switchTrack = false;\n initSegmentRequired = false;\n }\n\n function reset() {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].BYTES_APPENDED_END_FRAGMENT, _onBytesAppended, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].URL_RESOLUTION_FAILED, _onURLResolutionFailed, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].PLAYBACK_STARTED, _onPlaybackStarted, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].PLAYBACK_RATE_CHANGED, _onPlaybackRateChanged, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].PLAYBACK_TIME_UPDATED, _onPlaybackTimeUpdated, instance);\n clearScheduleTimer();\n\n _completeQualityChange(false);\n\n resetInitialSettings();\n streamInfo = null;\n }\n\n function getPlaybackController() {\n return playbackController;\n }\n\n instance = {\n initialize: initialize,\n getType: getType,\n getStreamId: getStreamId,\n setCurrentRepresentation: setCurrentRepresentation,\n setTimeToLoadDelay: setTimeToLoadDelay,\n getTimeToLoadDelay: getTimeToLoadDelay,\n setSwitchTrack: setSwitchTrack,\n getSwitchStrack: getSwitchStrack,\n startScheduleTimer: startScheduleTimer,\n clearScheduleTimer: clearScheduleTimer,\n reset: reset,\n getBufferTarget: getBufferTarget,\n getPlaybackController: getPlaybackController,\n setCheckPlaybackQuality: setCheckPlaybackQuality,\n setInitSegmentRequired: setInitSegmentRequired\n };\n setup();\n return instance;\n}\n\nScheduleController.__dashjs_factory_name = \'ScheduleController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_4__["default"].getClassFactory(ScheduleController));\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/StreamController.js":\n/*!*******************************************************!*\\\n !*** ./src/streaming/controllers/StreamController.js ***!\n \\*******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1509283__) {\n__nested_webpack_require_1509283__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1509283__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1509283__(/*! ../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _Stream__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1509283__(/*! ../Stream */ "./src/streaming/Stream.js");\n/* harmony import */ var _ManifestUpdater__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1509283__(/*! ../ManifestUpdater */ "./src/streaming/ManifestUpdater.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1509283__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1509283__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1509283__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1509283__(/*! ../vo/metrics/PlayList */ "./src/streaming/vo/metrics/PlayList.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1509283__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _utils_InitCache__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1509283__(/*! ../utils/InitCache */ "./src/streaming/utils/InitCache.js");\n/* harmony import */ var _utils_URLUtils__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_1509283__(/*! ../utils/URLUtils */ "./src/streaming/utils/URLUtils.js");\n/* harmony import */ var _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__ = __nested_webpack_require_1509283__(/*! ../MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _TimeSyncController__WEBPACK_IMPORTED_MODULE_12__ = __nested_webpack_require_1509283__(/*! ./TimeSyncController */ "./src/streaming/controllers/TimeSyncController.js");\n/* harmony import */ var _MediaSourceController__WEBPACK_IMPORTED_MODULE_13__ = __nested_webpack_require_1509283__(/*! ./MediaSourceController */ "./src/streaming/controllers/MediaSourceController.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_14__ = __nested_webpack_require_1509283__(/*! ../vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_15__ = __nested_webpack_require_1509283__(/*! ../../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _EventController__WEBPACK_IMPORTED_MODULE_16__ = __nested_webpack_require_1509283__(/*! ./EventController */ "./src/streaming/controllers/EventController.js");\n/* harmony import */ var _constants_ConformanceViolationConstants__WEBPACK_IMPORTED_MODULE_17__ = __nested_webpack_require_1509283__(/*! ../constants/ConformanceViolationConstants */ "./src/streaming/constants/ConformanceViolationConstants.js");\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar PLAYBACK_ENDED_TIMER_INTERVAL = 200;\nvar DVR_WAITING_OFFSET = 2;\n\nfunction StreamController() {\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n var instance, logger, capabilities, capabilitiesFilter, manifestUpdater, manifestLoader, manifestModel, adapter, dashMetrics, mediaSourceController, timeSyncController, baseURLController, segmentBaseController, uriFragmentModel, abrController, mediaController, eventController, initCache, urlUtils, errHandler, timelineConverter, streams, activeStream, protectionController, textController, protectionData, autoPlay, isStreamSwitchingInProgress, hasMediaError, hasInitialisationError, mediaSource, videoModel, playbackController, mediaPlayerModel, isPaused, initialPlayback, playbackEndedTimerInterval, bufferSinks, preloadingStreams, supportsChangeType, settings, firstLicenseIsFetched, waitForPlaybackStartTimeout, errorInformation;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_8__["default"])(context).getInstance().getLogger(instance);\n timeSyncController = Object(_TimeSyncController__WEBPACK_IMPORTED_MODULE_12__["default"])(context).getInstance();\n mediaSourceController = Object(_MediaSourceController__WEBPACK_IMPORTED_MODULE_13__["default"])(context).getInstance();\n initCache = Object(_utils_InitCache__WEBPACK_IMPORTED_MODULE_9__["default"])(context).getInstance();\n urlUtils = Object(_utils_URLUtils__WEBPACK_IMPORTED_MODULE_10__["default"])(context).getInstance();\n resetInitialSettings();\n }\n\n function initialize(autoPl, protData) {\n _checkConfig();\n\n autoPlay = autoPl;\n protectionData = protData;\n timelineConverter.initialize();\n manifestUpdater = Object(_ManifestUpdater__WEBPACK_IMPORTED_MODULE_3__["default"])(context).create();\n manifestUpdater.setConfig({\n manifestModel: manifestModel,\n adapter: adapter,\n manifestLoader: manifestLoader,\n errHandler: errHandler,\n settings: settings\n });\n manifestUpdater.initialize();\n eventController = Object(_EventController__WEBPACK_IMPORTED_MODULE_16__["default"])(context).getInstance();\n eventController.setConfig({\n manifestUpdater: manifestUpdater,\n playbackController: playbackController,\n settings: settings\n });\n eventController.start();\n timeSyncController.setConfig({\n dashMetrics: dashMetrics,\n baseURLController: baseURLController,\n errHandler: errHandler,\n settings: settings\n });\n timeSyncController.initialize();\n\n if (protectionController) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].PROTECTION_CREATED, {\n controller: protectionController\n });\n protectionController.setMediaElement(videoModel.getElement());\n\n if (protectionData) {\n protectionController.setProtectionData(protectionData);\n }\n }\n\n registerEvents();\n }\n\n function registerEvents() {\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_TIME_UPDATED, _onPlaybackTimeUpdated, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_SEEKING, _onPlaybackSeeking, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_ERROR, _onPlaybackError, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_STARTED, _onPlaybackStarted, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_PAUSED, _onPlaybackPaused, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_ENDED, _onPlaybackEnded, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].METRIC_ADDED, _onMetricAdded, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].MANIFEST_VALIDITY_CHANGED, _onManifestValidityChanged, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFER_LEVEL_UPDATED, _onBufferLevelUpdated, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].QUALITY_CHANGE_REQUESTED, _onQualityChanged, instance);\n\n if (_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].KEY_SESSION_UPDATED) {\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].KEY_SESSION_UPDATED, _onKeySessionUpdated, instance);\n }\n\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].MANIFEST_UPDATED, _onManifestUpdated, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].STREAM_BUFFERING_COMPLETED, _onStreamBufferingCompleted, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].TIME_SYNCHRONIZATION_COMPLETED, _onTimeSyncCompleted, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].CURRENT_TRACK_CHANGED, _onCurrentTrackChanged, instance);\n }\n\n function unRegisterEvents() {\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_TIME_UPDATED, _onPlaybackTimeUpdated, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_SEEKING, _onPlaybackSeeking, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_ERROR, _onPlaybackError, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_STARTED, _onPlaybackStarted, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_PAUSED, _onPlaybackPaused, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].PLAYBACK_ENDED, _onPlaybackEnded, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].METRIC_ADDED, _onMetricAdded, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].MANIFEST_VALIDITY_CHANGED, _onManifestValidityChanged, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFER_LEVEL_UPDATED, _onBufferLevelUpdated, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].QUALITY_CHANGE_REQUESTED, _onQualityChanged, instance);\n\n if (_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].KEY_SESSION_UPDATED) {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].KEY_SESSION_UPDATED, _onKeySessionUpdated, instance);\n }\n\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].MANIFEST_UPDATED, _onManifestUpdated, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].STREAM_BUFFERING_COMPLETED, _onStreamBufferingCompleted, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].TIME_SYNCHRONIZATION_COMPLETED, _onTimeSyncCompleted, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].CURRENT_TRACK_CHANGED, _onCurrentTrackChanged, instance);\n }\n /**\n * When the UTC snychronization is completed we can compose the streams\n * @private\n */\n\n\n function _onTimeSyncCompleted()\n /*e*/\n {\n _composeStreams();\n }\n /**\n *\n * @private\n */\n\n\n function _onKeySessionUpdated() {\n firstLicenseIsFetched = true;\n }\n /**\n * Setup the stream objects after the stream start and each MPD reload. This function is called after the UTC sync has been done (TIME_SYNCHRONIZATION_COMPLETED)\n * @private\n */\n\n\n function _composeStreams() {\n try {\n var streamsInfo = adapter.getStreamsInfo();\n\n if (!activeStream && streamsInfo.length === 0) {\n throw new Error(\'There are no streams\');\n }\n\n if (activeStream) {\n dashMetrics.updateManifestUpdateInfo({\n currentTime: playbackController.getTime(),\n buffered: videoModel.getBufferRange(),\n presentationStartTime: streamsInfo[0].start,\n clientTimeOffset: timelineConverter.getClientTimeOffset()\n });\n } // Filter streams that are outdated and not included in the MPD anymore\n\n\n if (streams.length > 0) {\n _filterOutdatedStreams(streamsInfo);\n }\n\n var promises = [];\n\n for (var i = 0, ln = streamsInfo.length; i < ln; i++) {\n var streamInfo = streamsInfo[i];\n promises.push(_initializeOrUpdateStream(streamInfo));\n dashMetrics.addManifestUpdateStreamInfo(streamInfo);\n }\n\n Promise.all(promises).then(function () {\n if (!activeStream) {\n _initializeForFirstStream(streamsInfo);\n }\n\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].STREAMS_COMPOSED); // Additional periods might have been added after an MPD update. Check again if we can start prebuffering.\n\n _checkIfPrebufferingCanStart();\n })["catch"](function (e) {\n throw e;\n });\n } catch (e) {\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_14__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_15__["default"].MANIFEST_ERROR_ID_NOSTREAMS_CODE, e.message + \'nostreamscomposed\', manifestModel.getValue()));\n hasInitialisationError = true;\n reset();\n }\n }\n /**\n * Called for each stream when composition is performed. Either a new instance of Stream is created or the existing one is updated.\n * @param {object} streamInfo\n * @private\n */\n\n\n function _initializeOrUpdateStream(streamInfo) {\n var stream = getStreamById(streamInfo.id); // If the Stream object does not exist we probably loaded the manifest the first time or it was\n // introduced in the updated manifest, so we need to create a new Stream and perform all the initialization operations\n\n if (!stream) {\n stream = Object(_Stream__WEBPACK_IMPORTED_MODULE_2__["default"])(context).create({\n manifestModel: manifestModel,\n mediaPlayerModel: mediaPlayerModel,\n dashMetrics: dashMetrics,\n manifestUpdater: manifestUpdater,\n adapter: adapter,\n timelineConverter: timelineConverter,\n capabilities: capabilities,\n capabilitiesFilter: capabilitiesFilter,\n errHandler: errHandler,\n baseURLController: baseURLController,\n segmentBaseController: segmentBaseController,\n textController: textController,\n abrController: abrController,\n playbackController: playbackController,\n eventController: eventController,\n mediaController: mediaController,\n protectionController: protectionController,\n videoModel: videoModel,\n streamInfo: streamInfo,\n settings: settings\n });\n streams.push(stream);\n stream.initialize();\n return Promise.resolve();\n } else {\n return stream.updateData(streamInfo);\n }\n }\n /**\n * Initialize playback for the first period.\n * @param {object} streamsInfo\n * @private\n */\n\n\n function _initializeForFirstStream(streamsInfo) {\n // Add the DVR window so we can calculate the right starting point\n addDVRMetric(); // If the start is in the future we need to wait\n\n var dvrRange = dashMetrics.getCurrentDVRInfo().range;\n\n if (dvrRange.end < dvrRange.start) {\n if (waitForPlaybackStartTimeout) {\n clearTimeout(waitForPlaybackStartTimeout);\n }\n\n var waitingTime = Math.min(((dvrRange.end - dvrRange.start) * -1 + DVR_WAITING_OFFSET) * 1000, 2147483647);\n logger.debug("Waiting for ".concat(waitingTime, " ms before playback can start"));\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].AST_IN_FUTURE, {\n delay: waitingTime\n });\n waitForPlaybackStartTimeout = setTimeout(function () {\n _initializeForFirstStream(streamsInfo);\n }, waitingTime);\n return;\n } // Compute and set the live delay\n\n\n if (adapter.getIsDynamic() && streams.length) {\n var manifestInfo = streamsInfo[0].manifestInfo;\n\n var fragmentDuration = _getFragmentDurationForLiveDelayCalculation(streamsInfo, manifestInfo);\n\n playbackController.computeAndSetLiveDelay(fragmentDuration, manifestInfo);\n } // Figure out the correct start time and the correct start period\n\n\n var startTime = _getInitialStartTime();\n\n var initialStream = getStreamForTime(startTime);\n var startStream = initialStream !== null ? initialStream : streams[0];\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].INITIAL_STREAM_SWITCH, {\n startTime: startTime\n });\n\n _switchStream(startStream, null, startTime);\n\n _startPlaybackEndedTimerInterval();\n }\n /**\n * Switch from the current stream (period) to the next stream (period).\n * @param {object} stream\n * @param {object} previousStream\n * @param {number} seekTime\n * @private\n */\n\n\n function _switchStream(stream, previousStream, seekTime) {\n try {\n if (isStreamSwitchingInProgress || !stream || previousStream === stream && stream.getIsActive()) {\n return;\n }\n\n isStreamSwitchingInProgress = true;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].PERIOD_SWITCH_STARTED, {\n fromStreamInfo: previousStream ? previousStream.getStreamInfo() : null,\n toStreamInfo: stream.getStreamInfo()\n });\n var keepBuffers = false;\n activeStream = stream;\n\n if (previousStream) {\n keepBuffers = _canSourceBuffersBeReused(stream, previousStream);\n previousStream.deactivate(keepBuffers);\n } // Determine seek time when switching to new period\n // - seek at given seek time\n // - or seek at period start if upcoming period is not prebuffered\n\n\n seekTime = !isNaN(seekTime) ? seekTime : !keepBuffers && previousStream ? stream.getStreamInfo().start : NaN;\n logger.info("Switch to stream ".concat(stream.getId(), ". Seektime is ").concat(seekTime, ", current playback time is ").concat(playbackController.getTime(), ". Seamless period switch is set to ").concat(keepBuffers));\n preloadingStreams = preloadingStreams.filter(function (s) {\n return s.getId() !== activeStream.getId();\n });\n playbackController.initialize(getActiveStreamInfo(), !!previousStream);\n\n if (videoModel.getElement()) {\n _openMediaSource(seekTime, keepBuffers);\n }\n } catch (e) {\n isStreamSwitchingInProgress = false;\n }\n }\n /**\n * Setup the Media Source. Open MSE and attach event listeners\n * @param {number} seekTime\n * @param {boolean} keepBuffers\n * @private\n */\n\n\n function _openMediaSource(seekTime, keepBuffers) {\n var sourceUrl;\n\n function _onMediaSourceOpen() {\n // Manage situations in which a call to reset happens while MediaSource is being opened\n if (!mediaSource || mediaSource.readyState !== \'open\') return;\n logger.debug(\'MediaSource is open!\');\n window.URL.revokeObjectURL(sourceUrl);\n mediaSource.removeEventListener(\'sourceopen\', _onMediaSourceOpen);\n mediaSource.removeEventListener(\'webkitsourceopen\', _onMediaSourceOpen);\n\n _setMediaDuration();\n\n var dvrInfo = dashMetrics.getCurrentDVRInfo();\n mediaSourceController.setSeekable(dvrInfo.range.start, dvrInfo.range.end);\n\n _activateStream(seekTime, keepBuffers);\n }\n\n function _open() {\n mediaSource.addEventListener(\'sourceopen\', _onMediaSourceOpen, false);\n mediaSource.addEventListener(\'webkitsourceopen\', _onMediaSourceOpen, false);\n sourceUrl = mediaSourceController.attachMediaSource(videoModel);\n logger.debug(\'MediaSource attached to element. Waiting on open...\');\n }\n\n if (!mediaSource) {\n mediaSource = mediaSourceController.createMediaSource();\n\n _open();\n } else {\n if (keepBuffers) {\n _activateStream(seekTime, keepBuffers);\n } else {\n mediaSourceController.detachMediaSource(videoModel);\n\n _open();\n }\n }\n }\n /**\n * Activates a new stream.\n * @param {number} seekTime\n * @param {boolean} keepBuffers\n */\n\n\n function _activateStream(seekTime, keepBuffers) {\n activeStream.activate(mediaSource, keepBuffers ? bufferSinks : undefined, seekTime).then(function (sinks) {\n // check if change type is supported by the browser\n if (sinks) {\n var keys = Object.keys(sinks);\n\n if (keys.length > 0 && sinks[keys[0]].getBuffer().changeType) {\n supportsChangeType = true;\n }\n\n bufferSinks = sinks;\n } // Set the initial time for this stream in the StreamProcessor\n\n\n if (!isNaN(seekTime)) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].SEEK_TARGET, {\n time: seekTime\n }, {\n streamId: activeStream.getId()\n });\n playbackController.seek(seekTime, false, true);\n activeStream.startScheduleControllers();\n }\n\n isStreamSwitchingInProgress = false;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].PERIOD_SWITCH_COMPLETED, {\n toStreamInfo: getActiveStreamInfo()\n });\n });\n }\n /**\n * A playback seeking event was triggered. We need to disable the preloading streams and call the respective seeking handler.\n * We distinguish between inner period seeks and outer period seeks\n * @param {object} e\n * @private\n */\n\n\n function _onPlaybackSeeking(e) {\n var oldTime = playbackController.getTime();\n var newTime = e.seekTime;\n var seekToStream = getStreamForTime(newTime);\n\n if (!seekToStream || seekToStream === activeStream) {\n _cancelPreloading(oldTime, newTime);\n\n _handleInnerPeriodSeek(e);\n } else if (seekToStream && seekToStream !== activeStream) {\n _cancelPreloading(oldTime, newTime, seekToStream);\n\n _handleOuterPeriodSeek(e, seekToStream);\n }\n\n _createPlaylistMetrics(_vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__["PlayList"].SEEK_START_REASON);\n }\n /**\n * Cancels the preloading of certain streams based on the position we are seeking to.\n * @param {number} oldTime\n * @param {number} newTime\n * @param {boolean} isInnerPeriodSeek\n * @private\n */\n\n\n function _cancelPreloading(oldTime, newTime) {\n var seekToStream = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n // Inner period seek forward\n if (oldTime <= newTime && !seekToStream) {\n _deactivateAllPreloadingStreams();\n } // Inner period seek: If we seek backwards we might need to prune the period(s) that are currently being prebuffered. For now deactivate everything\n else if (oldTime > newTime && !seekToStream) {\n _deactivateAllPreloadingStreams();\n } // Outer period seek: Deactivate everything for now\n else {\n _deactivateAllPreloadingStreams();\n }\n }\n /**\n * Deactivates all preloading streams\n * @private\n */\n\n\n function _deactivateAllPreloadingStreams() {\n if (preloadingStreams && preloadingStreams.length > 0) {\n preloadingStreams.forEach(function (s) {\n s.deactivate(true);\n });\n preloadingStreams = [];\n }\n }\n /**\n * Handle an inner period seek. Prepare all StreamProcessors for the seek.\n * @param {object} e\n * @private\n */\n\n\n function _handleInnerPeriodSeek(e) {\n var streamProcessors = activeStream.getProcessors();\n streamProcessors.forEach(function (sp) {\n return sp.prepareInnerPeriodPlaybackSeeking(e);\n });\n\n _flushPlaylistMetrics(_vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__["PlayListTrace"].USER_REQUEST_STOP_REASON);\n }\n /**\n * Handle an outer period seek. Dispatch the corresponding event to be handled in the BufferControllers and the ScheduleControllers\n * @param {object} e\n * @param {object} seekToStream\n * @private\n */\n\n\n function _handleOuterPeriodSeek(e, seekToStream) {\n // Stop segment requests\n var seekTime = e && !isNaN(e.seekTime) ? e.seekTime : NaN;\n var streamProcessors = activeStream.getProcessors();\n var promises = streamProcessors.map(function (sp) {\n // Cancel everything in case the active stream is still buffering\n return sp.prepareOuterPeriodPlaybackSeeking(e);\n });\n Promise.all(promises).then(function () {\n _switchStream(seekToStream, activeStream, seekTime);\n })["catch"](function (e) {\n errHandler.error(e);\n });\n }\n /**\n * A track change occured. We deactivate the preloading streams\n * @param {object} e\n * @private\n */\n\n\n function _onCurrentTrackChanged(e) {\n // Track was changed in non active stream. No need to do anything, this only happens when a stream starts preloading\n if (e.newMediaInfo.streamInfo.id !== activeStream.getId()) {\n return;\n } // If the track was changed in the active stream we need to stop preloading and remove the already prebuffered stuff. Since we do not support preloading specific handling of specific AdaptationSets yet.\n\n\n _deactivateAllPreloadingStreams();\n\n activeStream.prepareTrackChange(e);\n }\n /**\n * If the source buffer can be reused we can potentially start buffering the next period\n * @param {object} nextStream\n * @param {object} previousStream\n * @return {boolean}\n * @private\n */\n\n\n function _canSourceBuffersBeReused(nextStream, previousStream) {\n try {\n // Seamless period switch allowed only if:\n // - none of the periods uses contentProtection.\n // - AND changeType method implemented by browser or periods use the same codec.\n return settings.get().streaming.buffer.reuseExistingSourceBuffers && (previousStream.isProtectionCompatible(nextStream) || firstLicenseIsFetched) && (supportsChangeType || previousStream.isMediaCodecCompatible(nextStream, previousStream));\n } catch (e) {\n return false;\n }\n }\n /**\n * Initiate the preloading of the next stream\n * @param {object} nextStream\n * @param {object} previousStream\n * @private\n */\n\n\n function _onStreamCanLoadNext(nextStream) {\n var previousStream = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n if (mediaSource && !nextStream.getPreloaded()) {\n var seamlessPeriodSwitch = _canSourceBuffersBeReused(nextStream, previousStream);\n\n if (seamlessPeriodSwitch) {\n nextStream.startPreloading(mediaSource, bufferSinks).then(function () {\n preloadingStreams.push(nextStream);\n });\n }\n }\n }\n /**\n * Returns the corresponding stream object for a specific presentation time.\n * @param {number} time\n * @return {null|object}\n */\n\n\n function getStreamForTime(time) {\n if (isNaN(time)) {\n return null;\n }\n\n var ln = streams.length;\n\n for (var i = 0; i < ln; i++) {\n var stream = streams[i];\n var streamEnd = parseFloat((stream.getStartTime() + stream.getDuration()).toFixed(5));\n\n if (time < streamEnd) {\n return stream;\n }\n }\n\n return null;\n }\n /**\n * Add the DVR window to the metric list. We need the DVR window to restrict the seeking and calculate the right start time.\n */\n\n\n function addDVRMetric() {\n try {\n var isDynamic = adapter.getIsDynamic();\n var streamsInfo = adapter.getStreamsInfo();\n var manifestInfo = streamsInfo[0].manifestInfo;\n var time = playbackController.getTime();\n var range = timelineConverter.calcTimeShiftBufferWindow(streams, isDynamic);\n var activeStreamProcessors = getActiveStreamProcessors();\n\n if (typeof range.start === \'undefined\' || typeof range.end === \'undefined\') {\n return;\n }\n\n if (!activeStreamProcessors || activeStreamProcessors.length === 0) {\n dashMetrics.addDVRInfo(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO, time, manifestInfo, range);\n } else {\n activeStreamProcessors.forEach(function (sp) {\n dashMetrics.addDVRInfo(sp.getType(), time, manifestInfo, range);\n });\n }\n } catch (e) {}\n }\n /**\n * The buffer level for a certain media type has been updated. If this is the initial playback and we want to autoplay the content we check if we can start playback now.\n * For livestreams we might have a drift of the target live delay compared to the current live delay because reaching the initial buffer level took time.\n * @param {object} e\n * @private\n */\n\n\n function _onBufferLevelUpdated(e) {\n // check if this is the initial playback and we reached the buffer target. If autoplay is true we start playback\n if (initialPlayback && autoPlay) {\n var initialBufferLevel = mediaPlayerModel.getInitialBufferLevel();\n\n if (isNaN(initialBufferLevel) || initialBufferLevel <= playbackController.getBufferLevel() || adapter.getIsDynamic() && initialBufferLevel > playbackController.getLiveDelay()) {\n initialPlayback = false;\n\n _createPlaylistMetrics(_vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__["PlayList"].INITIAL_PLAYOUT_START_REASON);\n\n playbackController.play();\n }\n }\n\n if (e && e.mediaType) {\n dashMetrics.addBufferLevel(e.mediaType, new Date(), e.bufferLevel * 1000);\n }\n }\n /**\n * When the quality is changed in the currently active stream and we do an aggressive replacement we must stop prebuffering. This is similar to a replacing track switch\n * Otherwise preloading can go on.\n * @param e\n * @private\n */\n\n\n function _onQualityChanged(e) {\n if (e.streamInfo.id === activeStream.getId() && e.reason && e.reason.forceReplace) {\n _deactivateAllPreloadingStreams();\n }\n\n var stream = getStreamById(e.streamInfo.id);\n stream.prepareQualityChange(e);\n }\n /**\n * When the playback time is updated we add the droppedFrames metric to the dash metric object\n * @private\n */\n\n\n function _onPlaybackTimeUpdated()\n /*e*/\n {\n if (hasVideoTrack()) {\n var playbackQuality = videoModel.getPlaybackQuality();\n\n if (playbackQuality) {\n dashMetrics.addDroppedFrames(playbackQuality);\n }\n }\n }\n /**\n * Once playback starts add playlist metrics depending on whether this was the first playback or playback resumed after pause\n * @private\n */\n\n\n function _onPlaybackStarted()\n /*e*/\n {\n logger.debug(\'[onPlaybackStarted]\');\n\n if (!initialPlayback && isPaused) {\n _createPlaylistMetrics(_vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__["PlayList"].RESUME_FROM_PAUSE_START_REASON);\n }\n\n if (initialPlayback) {\n initialPlayback = false;\n }\n\n isPaused = false;\n }\n /**\n * Once playback is paused flush metrics\n * @param {object} e\n * @private\n */\n\n\n function _onPlaybackPaused(e) {\n logger.debug(\'[onPlaybackPaused]\');\n\n if (!e.ended) {\n isPaused = true;\n\n _flushPlaylistMetrics(_vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__["PlayListTrace"].USER_REQUEST_STOP_REASON);\n }\n }\n /**\n * Callback once a stream/period is completely buffered. We can either signal the end of the stream or start prebuffering the next period.\n * @param {object} e\n * @private\n */\n\n\n function _onStreamBufferingCompleted(e) {\n logger.debug("Stream with id ".concat(e.streamInfo.id, " finished buffering"));\n var isLast = e.streamInfo.isLast;\n\n if (mediaSource && isLast) {\n logger.info(\'[onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController.\');\n mediaSourceController.signalEndOfStream(mediaSource);\n } else {\n _checkIfPrebufferingCanStart();\n }\n }\n /**\n * Check if we can start prebuffering the next period.\n * @private\n */\n\n\n function _checkIfPrebufferingCanStart() {\n // In multiperiod situations, we can start buffering the next stream\n if (!activeStream || !activeStream.getHasFinishedBuffering()) {\n return;\n }\n\n var upcomingStreams = _getNextStreams(activeStream);\n\n var i = 0;\n\n while (i < upcomingStreams.length) {\n var stream = upcomingStreams[i];\n var previousStream = i === 0 ? activeStream : upcomingStreams[i - 1]; // If the preloading for the current stream is not scheduled, but its predecessor has finished buffering we can start prebuffering this stream\n\n if (!stream.getPreloaded() && previousStream.getHasFinishedBuffering()) {\n if (mediaSource) {\n _onStreamCanLoadNext(stream, previousStream);\n }\n }\n\n i += 1;\n }\n }\n /**\n * In some cases we need to fire the playback ended event manually\n * @private\n */\n\n\n function _startPlaybackEndedTimerInterval() {\n if (!playbackEndedTimerInterval) {\n playbackEndedTimerInterval = setInterval(function () {\n if (!isStreamSwitchingInProgress && playbackController.getTimeToStreamEnd() <= 0 && !playbackController.isSeeking()) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].PLAYBACK_ENDED, {\n \'isLast\': getActiveStreamInfo().isLast\n });\n }\n }, PLAYBACK_ENDED_TIMER_INTERVAL);\n }\n }\n /**\n * Stop the check if the playback has ended\n * @private\n */\n\n\n function _stopPlaybackEndedTimerInterval() {\n if (playbackEndedTimerInterval) {\n clearInterval(playbackEndedTimerInterval);\n playbackEndedTimerInterval = null;\n }\n }\n /**\n * Returns a playhead time, in seconds, converted to be relative\n * to the start of an identified stream/period or null if no such stream\n * @param {number} time\n * @param {string} id\n * @returns {number|null}\n */\n\n\n function getTimeRelativeToStreamId(time, id) {\n var stream = null;\n var baseStart = 0;\n var streamStart = 0;\n var streamDur = null;\n\n for (var i = 0; i < streams.length; i++) {\n stream = streams[i];\n streamStart = stream.getStartTime();\n streamDur = stream.getDuration(); // use start time, if not undefined or NaN or similar\n\n if (Number.isFinite(streamStart)) {\n baseStart = streamStart;\n }\n\n if (stream.getId() === id) {\n return time - baseStart;\n } else {\n // use duration if not undefined or NaN or similar\n if (Number.isFinite(streamDur)) {\n baseStart += streamDur;\n }\n }\n }\n\n return null;\n }\n /**\n * Returns the streamProcessors of the active stream.\n * @return {array}\n */\n\n\n function getActiveStreamProcessors() {\n return activeStream ? activeStream.getProcessors() : [];\n }\n /**\n * Once playback has ended we switch to the next stream\n * @param {object} e\n */\n\n\n function _onPlaybackEnded(e) {\n if (activeStream && !activeStream.getIsEndedEventSignaled()) {\n activeStream.setIsEndedEventSignaled(true);\n\n var nextStream = _getNextStream();\n\n if (nextStream) {\n logger.debug("StreamController onEnded, found next stream with id ".concat(nextStream.getStreamInfo().id, ". Switching from ").concat(activeStream.getStreamInfo().id, " to ").concat(nextStream.getStreamInfo().id));\n\n _switchStream(nextStream, activeStream, NaN);\n } else {\n logger.debug(\'StreamController no next stream found\');\n activeStream.setIsEndedEventSignaled(false);\n }\n\n _flushPlaylistMetrics(nextStream ? _vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__["PlayListTrace"].END_OF_PERIOD_STOP_REASON : _vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__["PlayListTrace"].END_OF_CONTENT_STOP_REASON);\n }\n\n if (e && e.isLast) {\n _stopPlaybackEndedTimerInterval();\n }\n }\n /**\n * Returns the next stream to be played relative to the stream provided. If no stream is provided we use the active stream.\n * In order to avoid rounding issues we should not use the duration of the periods. Instead find the stream with starttime closest to startTime of the previous stream.\n * @param {object} stream\n * @return {null|object}\n */\n\n\n function _getNextStream() {\n var stream = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var refStream = stream ? stream : activeStream ? activeStream : null;\n\n if (!refStream) {\n return null;\n }\n\n var refStreamInfo = refStream.getStreamInfo();\n var start = refStreamInfo.start;\n var i = 0;\n var targetIndex = -1;\n var lastDiff = NaN;\n\n while (i < streams.length) {\n var s = streams[i];\n var sInfo = s.getStreamInfo();\n var diff = sInfo.start - start;\n\n if (diff > 0 && (isNaN(lastDiff) || diff < lastDiff) && refStreamInfo.id !== sInfo.id) {\n lastDiff = diff;\n targetIndex = i;\n }\n\n i += 1;\n }\n\n if (targetIndex >= 0) {\n return streams[targetIndex];\n }\n\n return null;\n }\n /**\n * Returns all upcoming streams relative to the provided stream. If no stream is provided we use the active stream.\n * @param {object} stream\n * @return {array}\n */\n\n\n function _getNextStreams() {\n var stream = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n try {\n var refStream = stream ? stream : activeStream ? activeStream : null;\n\n if (refStream) {\n var refStreamInfo = refStream.getStreamInfo();\n return streams.filter(function (stream) {\n var sInfo = stream.getStreamInfo();\n return sInfo.start > refStreamInfo.start && refStreamInfo.id !== sInfo.id;\n });\n }\n } catch (e) {\n return [];\n }\n }\n /**\n * Sets the duration attribute of the MediaSource using the MediaSourceController.\n * @param {number} duration\n * @private\n */\n\n\n function _setMediaDuration(duration) {\n var manifestDuration = duration ? duration : getActiveStreamInfo().manifestInfo.duration;\n mediaSourceController.setDuration(manifestDuration);\n }\n /**\n * Returns the active stream\n * @return {object}\n */\n\n\n function getActiveStream() {\n return activeStream;\n }\n /**\n * Initial playback indicates if we have called play() for the first time yet.\n * @return {*}\n */\n\n\n function getInitialPlayback() {\n return initialPlayback;\n }\n /**\n * Auto Play indicates if the stream starts automatically as soon as it is initialized.\n * @return {boolean}\n */\n\n\n function getAutoPlay() {\n return autoPlay;\n }\n /**\n * Called once the first stream has been initialized. We only use this function to seek to the right start time.\n * @return {number}\n * @private\n */\n\n\n function _getInitialStartTime() {\n // Seek new stream in priority order:\n // - at start time provided in URI parameters\n // - at stream/period start time (for static streams) or live start time (for dynamic streams)\n var startTime;\n\n if (adapter.getIsDynamic()) {\n // For dynamic stream, start by default at (live edge - live delay)\n var dvrInfo = dashMetrics.getCurrentDVRInfo();\n var liveEdge = dvrInfo && dvrInfo.range ? dvrInfo.range.end : 0; // we are already in the right start period. so time should not be smaller than period@start and should not be larger than period@end\n\n startTime = liveEdge - playbackController.getLiveDelay(); // If start time in URI, take min value between live edge time and time from URI (capped by DVR window range)\n\n var dvrWindow = dvrInfo ? dvrInfo.range : null;\n\n if (dvrWindow) {\n // #t shall be relative to period start\n var startTimeFromUri = _getStartTimeFromUriParameters(true);\n\n if (!isNaN(startTimeFromUri)) {\n logger.info(\'Start time from URI parameters: \' + startTimeFromUri);\n startTime = Math.max(Math.min(startTime, startTimeFromUri), dvrWindow.start);\n }\n }\n } else {\n // For static stream, start by default at period start\n var _streams = getStreams();\n\n var streamInfo = _streams[0].getStreamInfo();\n\n startTime = streamInfo.start; // If start time in URI, take max value between period start and time from URI (if in period range)\n\n var _startTimeFromUri = _getStartTimeFromUriParameters(false);\n\n if (!isNaN(_startTimeFromUri)) {\n logger.info(\'Start time from URI parameters: \' + _startTimeFromUri);\n startTime = Math.max(startTime, _startTimeFromUri);\n }\n }\n\n return startTime;\n }\n /**\n * 23009-1 Annex C.4 defines MPD anchors to use URI fragment syntax to start a presentation at a given time and a given state\n * @param {boolean} isDynamic\n * @return {number}\n * @private\n */\n\n\n function _getStartTimeFromUriParameters(isDynamic) {\n var fragData = uriFragmentModel.getURIFragmentData();\n\n if (!fragData || !fragData.t) {\n return NaN;\n }\n\n var refStream = getStreams()[0];\n var refStreamStartTime = refStream.getStreamInfo().start; // Consider only start time of MediaRange\n // TODO: consider end time of MediaRange to stop playback at provided end time\n\n fragData.t = fragData.t.split(\',\')[0]; // "t=<time>" : time is relative to 1st period start\n // "t=posix:<time>" : time is absolute start time as number of seconds since 01-01-1970\n\n var posix = fragData.t.indexOf(\'posix:\') !== -1 ? fragData.t.substring(6) === \'now\' ? Date.now() / 1000 : parseInt(fragData.t.substring(6)) : NaN;\n var startTime = isDynamic && !isNaN(posix) ? posix - playbackController.getAvailabilityStartTime() / 1000 : parseInt(fragData.t) + refStreamStartTime;\n return startTime;\n }\n /**\n * Streams that are no longer in the manifest can be filtered\n * @param {object} streamsInfo\n * @private\n */\n\n\n function _filterOutdatedStreams(streamsInfo) {\n streams = streams.filter(function (stream) {\n var isStillIncluded = streamsInfo.filter(function (sInfo) {\n return sInfo.id === stream.getId();\n }).length > 0;\n var shouldKeepStream = isStillIncluded || stream.getId() === activeStream.getId();\n\n if (!shouldKeepStream) {\n logger.debug("Removing stream ".concat(stream.getId()));\n stream.reset(true);\n }\n\n return shouldKeepStream;\n });\n }\n /**\n * In order to calculate the initial live delay we might required the duration of the segments.\n * @param {array} streamInfos\n * @param {object} manifestInfo\n * @return {number}\n * @private\n */\n\n\n function _getFragmentDurationForLiveDelayCalculation(streamInfos, manifestInfo) {\n try {\n var fragmentDuration = NaN; // We use the maxFragmentDuration attribute if present\n\n if (manifestInfo && !isNaN(manifestInfo.maxFragmentDuration) && isFinite(manifestInfo.maxFragmentDuration)) {\n return manifestInfo.maxFragmentDuration;\n } // For single period manifests we can iterate over all AS and use the maximum segment length\n\n\n if (streamInfos && streamInfos.length === 1) {\n var streamInfo = streamInfos[0];\n var mediaTypes = [_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT];\n var fragmentDurations = mediaTypes.reduce(function (acc, mediaType) {\n var mediaInfo = adapter.getMediaInfoForType(streamInfo, mediaType);\n\n if (mediaInfo && mediaInfo.isFragmented !== false) {\n acc.push(mediaInfo);\n }\n\n return acc;\n }, []).reduce(function (acc, mediaInfo) {\n var voRepresentations = adapter.getVoRepresentations(mediaInfo);\n\n if (voRepresentations && voRepresentations.length > 0) {\n voRepresentations.forEach(function (voRepresentation) {\n if (voRepresentation) {\n acc.push(voRepresentation);\n }\n });\n }\n\n return acc;\n }, []).reduce(function (acc, voRepresentation) {\n var representation = adapter.convertRepresentationToRepresentationInfo(voRepresentation);\n\n if (representation && representation.fragmentDuration && !isNaN(representation.fragmentDuration)) {\n acc.push(representation.fragmentDuration);\n }\n\n return acc;\n }, []);\n fragmentDuration = Math.max.apply(Math, _toConsumableArray(fragmentDurations));\n }\n\n return isFinite(fragmentDuration) ? fragmentDuration : NaN;\n } catch (e) {\n return NaN;\n }\n }\n /**\n * Callback handler after the manifest has been updated. Trigger an update in the adapter and filter unsupported stuff.\n * Finally attempt UTC sync\n * @param {object} e\n * @private\n */\n\n\n function _onManifestUpdated(e) {\n if (!e.error) {\n logger.info(\'Manifest updated... updating data system wide.\'); //Since streams are not composed yet , need to manually look up useCalculatedLiveEdgeTime to detect if stream\n //is SegmentTimeline to avoid using time source\n\n var manifest = e.manifest;\n adapter.updatePeriods(manifest);\n var manifestUTCTimingSources = adapter.getUTCTimingSources();\n\n if (adapter.getIsDynamic() && (!manifestUTCTimingSources || manifestUTCTimingSources.length === 0)) {\n eventBus.trigger(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_11__["default"].CONFORMANCE_VIOLATION, {\n level: _constants_ConformanceViolationConstants__WEBPACK_IMPORTED_MODULE_17__["default"].LEVELS.WARNING,\n event: _constants_ConformanceViolationConstants__WEBPACK_IMPORTED_MODULE_17__["default"].EVENTS.NO_UTC_TIMING_ELEMENT\n });\n }\n\n var allUTCTimingSources = !adapter.getIsDynamic() ? manifestUTCTimingSources : manifestUTCTimingSources.concat(mediaPlayerModel.getUTCTimingSources());\n var isHTTPS = urlUtils.isHTTPS(e.manifest.url); //If https is detected on manifest then lets apply that protocol to only the default time source(s). In the future we may find the need to apply this to more then just default so left code at this level instead of in MediaPlayer.\n\n allUTCTimingSources.forEach(function (item) {\n if (item.value.replace(/.*?:\\/\\//g, \'\') === mediaPlayerModel.getDefaultUtcTimingSource().value.replace(/.*?:\\/\\//g, \'\')) {\n item.value = item.value.replace(isHTTPS ? new RegExp(/^(http:)?\\/\\//i) : new RegExp(/^(https:)?\\/\\//i), isHTTPS ? \'https://\' : \'http://\');\n logger.debug(\'Matching default timing source protocol to manifest protocol: \', item.value);\n }\n }); // It is important to filter before initializing the baseUrlController. Otherwise we might end up with wrong references in case we remove AdaptationSets.\n\n capabilitiesFilter.filterUnsupportedFeatures(manifest).then(function () {\n baseURLController.initialize(manifest);\n timeSyncController.attemptSync(allUTCTimingSources, adapter.getIsDynamic());\n });\n } else {\n hasInitialisationError = true;\n reset();\n }\n }\n /**\n * Check if the stream has a video track\n * @return {boolean}\n */\n\n\n function hasVideoTrack() {\n return activeStream ? activeStream.getHasVideoTrack() : false;\n }\n /**\n * Check if the stream has an audio track\n * @return {boolean}\n */\n\n\n function hasAudioTrack() {\n return activeStream ? activeStream.getHasAudioTrack() : false;\n }\n\n function switchToVideoElement(seekTime) {\n if (activeStream) {\n playbackController.initialize(getActiveStreamInfo());\n\n _openMediaSource(seekTime, false);\n }\n }\n\n function _flushPlaylistMetrics(reason, time) {\n time = time || new Date();\n getActiveStreamProcessors().forEach(function (p) {\n p.finalisePlayList(time, reason);\n });\n dashMetrics.addPlayList();\n }\n\n function _createPlaylistMetrics(startReason) {\n dashMetrics.createPlaylistMetrics(playbackController.getTime() * 1000, startReason);\n }\n\n function _onPlaybackError(e) {\n if (!e.error) return;\n var msg = \'\';\n\n switch (e.error.code) {\n case 1:\n msg = \'MEDIA_ERR_ABORTED\';\n break;\n\n case 2:\n msg = \'MEDIA_ERR_NETWORK\';\n break;\n\n case 3:\n msg = \'MEDIA_ERR_DECODE\';\n errorInformation.counts.mediaErrorDecode += 1;\n break;\n\n case 4:\n msg = \'MEDIA_ERR_SRC_NOT_SUPPORTED\';\n break;\n\n case 5:\n msg = \'MEDIA_ERR_ENCRYPTED\';\n break;\n\n default:\n msg = \'UNKNOWN\';\n break;\n }\n\n if (msg === \'MEDIA_ERR_DECODE\' && settings.get().errors.recoverAttempts.mediaErrorDecode >= errorInformation.counts.mediaErrorDecode) {\n _handleMediaErrorDecode();\n\n return;\n }\n\n hasMediaError = true;\n\n if (e.error.message) {\n msg += \' (\' + e.error.message + \')\';\n }\n\n if (e.error.msExtendedCode) {\n msg += \' (0x\' + (e.error.msExtendedCode >>> 0).toString(16).toUpperCase() + \')\';\n }\n\n logger.fatal(\'Video Element Error: \' + msg);\n\n if (e.error) {\n logger.fatal(e.error);\n }\n\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_14__["default"](e.error.code, msg));\n reset();\n }\n /**\n * Handles mediaError\n * @private\n */\n\n\n function _handleMediaErrorDecode() {\n logger.warn(\'A MEDIA_ERR_DECODE occured: Resetting the MediaSource\');\n var time = playbackController.getTime(); // Deactivate the current stream.\n\n activeStream.deactivate(false); // Reset MSE\n\n logger.warn("MediaSource has been resetted. Resuming playback from time ".concat(time));\n\n _openMediaSource(time, false);\n }\n\n function getActiveStreamInfo() {\n return activeStream ? activeStream.getStreamInfo() : null;\n }\n\n function getIsStreamSwitchInProgress() {\n return isStreamSwitchingInProgress;\n }\n\n function getHasMediaOrInitialisationError() {\n return hasMediaError || hasInitialisationError;\n }\n\n function getStreamById(id) {\n for (var i = 0, ln = streams.length; i < ln; i++) {\n if (streams[i].getId() === id) {\n return streams[i];\n }\n }\n\n return null;\n }\n\n function _checkConfig() {\n if (!manifestLoader || !manifestLoader.hasOwnProperty(\'load\') || !timelineConverter || !timelineConverter.hasOwnProperty(\'initialize\') || !timelineConverter.hasOwnProperty(\'reset\') || !timelineConverter.hasOwnProperty(\'getClientTimeOffset\') || !manifestModel || !errHandler || !dashMetrics || !playbackController) {\n throw new Error(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].MISSING_CONFIG_ERROR);\n }\n }\n\n function _checkInitialize() {\n if (!manifestUpdater || !manifestUpdater.hasOwnProperty(\'setManifest\')) {\n throw new Error(\'initialize function has to be called previously\');\n }\n }\n\n function load(url) {\n _checkConfig();\n\n manifestLoader.load(url);\n }\n\n function loadWithManifest(manifest) {\n _checkInitialize();\n\n manifestUpdater.setManifest(manifest);\n }\n\n function _onManifestValidityChanged(e) {\n if (!isNaN(e.newDuration)) {\n _setMediaDuration(e.newDuration);\n }\n }\n\n function setConfig(config) {\n if (!config) return;\n\n if (config.capabilities) {\n capabilities = config.capabilities;\n }\n\n if (config.capabilitiesFilter) {\n capabilitiesFilter = config.capabilitiesFilter;\n }\n\n if (config.manifestLoader) {\n manifestLoader = config.manifestLoader;\n }\n\n if (config.manifestModel) {\n manifestModel = config.manifestModel;\n }\n\n if (config.mediaPlayerModel) {\n mediaPlayerModel = config.mediaPlayerModel;\n }\n\n if (config.protectionController) {\n protectionController = config.protectionController;\n }\n\n if (config.adapter) {\n adapter = config.adapter;\n }\n\n if (config.dashMetrics) {\n dashMetrics = config.dashMetrics;\n }\n\n if (config.errHandler) {\n errHandler = config.errHandler;\n }\n\n if (config.timelineConverter) {\n timelineConverter = config.timelineConverter;\n }\n\n if (config.videoModel) {\n videoModel = config.videoModel;\n }\n\n if (config.playbackController) {\n playbackController = config.playbackController;\n }\n\n if (config.textController) {\n textController = config.textController;\n }\n\n if (config.abrController) {\n abrController = config.abrController;\n }\n\n if (config.mediaController) {\n mediaController = config.mediaController;\n }\n\n if (config.settings) {\n settings = config.settings;\n }\n\n if (config.baseURLController) {\n baseURLController = config.baseURLController;\n }\n\n if (config.uriFragmentModel) {\n uriFragmentModel = config.uriFragmentModel;\n }\n\n if (config.segmentBaseController) {\n segmentBaseController = config.segmentBaseController;\n }\n }\n\n function setProtectionData(protData) {\n protectionData = protData;\n\n if (protectionController) {\n protectionController.setProtectionData(protectionData);\n }\n }\n\n function resetInitialSettings() {\n streams = [];\n protectionController = null;\n isStreamSwitchingInProgress = false;\n activeStream = null;\n hasMediaError = false;\n hasInitialisationError = false;\n initialPlayback = true;\n isPaused = false;\n autoPlay = true;\n playbackEndedTimerInterval = null;\n firstLicenseIsFetched = false;\n supportsChangeType = false;\n preloadingStreams = [];\n waitForPlaybackStartTimeout = null;\n errorInformation = {\n counts: {\n mediaErrorDecode: 0\n }\n };\n }\n\n function reset() {\n _checkConfig();\n\n timeSyncController.reset();\n\n _flushPlaylistMetrics(hasMediaError || hasInitialisationError ? _vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__["PlayListTrace"].FAILURE_STOP_REASON : _vo_metrics_PlayList__WEBPACK_IMPORTED_MODULE_7__["PlayListTrace"].USER_REQUEST_STOP_REASON);\n\n for (var i = 0, ln = streams ? streams.length : 0; i < ln; i++) {\n var stream = streams[i];\n stream.reset(hasMediaError);\n }\n\n unRegisterEvents();\n baseURLController.reset();\n manifestUpdater.reset();\n eventController.reset();\n dashMetrics.clearAllCurrentMetrics();\n manifestModel.setValue(null);\n manifestLoader.reset();\n timelineConverter.reset();\n initCache.reset();\n\n if (mediaSource) {\n mediaSourceController.detachMediaSource(videoModel);\n mediaSource = null;\n }\n\n videoModel = null;\n\n if (protectionController) {\n protectionController = null;\n protectionData = null;\n\n if (manifestModel.getValue()) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].PROTECTION_DESTROYED, {\n data: manifestModel.getValue().url\n });\n }\n }\n\n _stopPlaybackEndedTimerInterval();\n\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].STREAM_TEARDOWN_COMPLETE);\n resetInitialSettings();\n }\n\n function _onMetricAdded(e) {\n if (e.metric === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DVR_INFO) {\n //Match media type? How can DVR window be different for media types?\n //Should we normalize and union the two?\n var targetMediaType = hasAudioTrack() ? _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO : _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO;\n\n if (e.mediaType === targetMediaType) {\n mediaSourceController.setSeekable(e.value.range.start, e.value.range.end);\n }\n }\n }\n\n function getStreams() {\n return streams;\n }\n\n instance = {\n initialize: initialize,\n getActiveStreamInfo: getActiveStreamInfo,\n addDVRMetric: addDVRMetric,\n hasVideoTrack: hasVideoTrack,\n hasAudioTrack: hasAudioTrack,\n getStreamById: getStreamById,\n getStreamForTime: getStreamForTime,\n getTimeRelativeToStreamId: getTimeRelativeToStreamId,\n load: load,\n loadWithManifest: loadWithManifest,\n getActiveStreamProcessors: getActiveStreamProcessors,\n setConfig: setConfig,\n setProtectionData: setProtectionData,\n getIsStreamSwitchInProgress: getIsStreamSwitchInProgress,\n switchToVideoElement: switchToVideoElement,\n getHasMediaOrInitialisationError: getHasMediaOrInitialisationError,\n getStreams: getStreams,\n getActiveStream: getActiveStream,\n getInitialPlayback: getInitialPlayback,\n getAutoPlay: getAutoPlay,\n reset: reset\n };\n setup();\n return instance;\n}\n\nStreamController.__dashjs_factory_name = \'StreamController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_6__["default"].getSingletonFactory(StreamController));\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/TimeSyncController.js":\n/*!*********************************************************!*\\\n !*** ./src/streaming/controllers/TimeSyncController.js ***!\n \\*********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1567833__) {\n__nested_webpack_require_1567833__.r(__nested_webpack_exports__);\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1567833__(/*! ./../vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1567833__(/*! ../vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1567833__(/*! ./../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1567833__(/*! ./../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1567833__(/*! ./../../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1567833__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1567833__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _utils_URLUtils__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1567833__(/*! ../utils/URLUtils */ "./src/streaming/utils/URLUtils.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\nvar HTTP_TIMEOUT_MS = 5000;\nvar DEFAULT_MAXIMUM_ALLOWED_DRIFT = 100;\nvar DEFAULT_TIME_BETWEEN_SYNC_ATTEMPTS_ADJUSTMENT_FACTOR = 2;\nvar DEFAULT_BACKGROUND_ATTEMPTS = 2;\nvar DEFAULT_TIME_BETWEEN_SYNC_ATTEMPTS = 30;\nvar DEFAULT_MINIMUM_TIME_BETWEEN_BACKGROUND_SYNC_ATTEMPTS = 30;\nvar DEFAULT_MAXIMUM_TIME_BETWEEN_SYNC = 600;\nvar DEFAULT_MINIMUM_TIME_BETWEEN_SYNC = 2;\n\nfunction TimeSyncController() {\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance();\n var urlUtils = Object(_utils_URLUtils__WEBPACK_IMPORTED_MODULE_7__["default"])(context).getInstance();\n var instance, logger, isSynchronizing, isBackgroundSynchronizing, settings, handlers, dashMetrics, backgroundSyncTimeOffsets, timingSources, timeOfLastSync, timeOfLastBackgroundSync, lastOffset, lastTimingSource, internalTimeBetweenSyncAttempts, errHandler, baseURLController;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_6__["default"])(context).getInstance().getLogger(instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].ATTEMPT_BACKGROUND_SYNC, _onAttemptBackgroundSync, instance);\n }\n\n function setConfig(config) {\n if (!config) return;\n\n if (config.dashMetrics) {\n dashMetrics = config.dashMetrics;\n }\n\n if (config.baseURLController) {\n baseURLController = config.baseURLController;\n }\n\n if (config.errHandler) {\n errHandler = config.errHandler;\n }\n\n if (config.settings) {\n settings = config.settings;\n }\n }\n\n function _resetInitialSettings() {\n backgroundSyncTimeOffsets = [];\n timingSources = [];\n timeOfLastSync = null;\n timeOfLastBackgroundSync = null;\n lastTimingSource = null;\n lastOffset = NaN;\n isSynchronizing = false;\n isBackgroundSynchronizing = false;\n internalTimeBetweenSyncAttempts = settings.get().streaming.utcSynchronization.timeBetweenSyncAttempts;\n }\n /**\n * Register the timing handler depending on the schemeIdUris. This method is called once when the StreamController is initialized\n */\n\n\n function initialize() {\n _resetInitialSettings(); // a list of known schemeIdUris and a method to call with @value\n\n\n handlers = {\n \'urn:mpeg:dash:utc:http-head:2014\': _httpHeadHandler,\n \'urn:mpeg:dash:utc:http-xsdate:2014\': _httpHandler.bind(null, _xsdatetimeDecoder),\n \'urn:mpeg:dash:utc:http-iso:2014\': _httpHandler.bind(null, _iso8601Decoder),\n \'urn:mpeg:dash:utc:direct:2014\': _directHandler,\n // some specs referencing early ISO23009-1 drafts incorrectly use\n // 2012 in the URI, rather than 2014. support these for now.\n \'urn:mpeg:dash:utc:http-head:2012\': _httpHeadHandler,\n \'urn:mpeg:dash:utc:http-xsdate:2012\': _httpHandler.bind(null, _xsdatetimeDecoder),\n \'urn:mpeg:dash:utc:http-iso:2012\': _httpHandler.bind(null, _iso8601Decoder),\n \'urn:mpeg:dash:utc:direct:2012\': _directHandler,\n // it isn\'t clear how the data returned would be formatted, and\n // no public examples available so http-ntp not supported for now.\n // presumably you would do an arraybuffer type xhr and decode the\n // binary data returned but I would want to see a sample first.\n \'urn:mpeg:dash:utc:http-ntp:2014\': _notSupportedHandler,\n // not clear how this would be supported in javascript (in browser)\n \'urn:mpeg:dash:utc:ntp:2014\': _notSupportedHandler,\n \'urn:mpeg:dash:utc:sntp:2014\': _notSupportedHandler\n };\n }\n /**\n * Sync against a timing source. T\n * @param {array} tSources\n * @param {boolean} isDynamic\n */\n\n\n function attemptSync(tSources, isDynamic) {\n timingSources = tSources; // Stop if we are already synchronizing\n\n if (isSynchronizing) {\n return;\n } // No synchronization required we can signal the completion immediately\n\n\n if (!_shouldPerformSynchronization(isDynamic)) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].TIME_SYNCHRONIZATION_COMPLETED);\n return;\n }\n\n isSynchronizing = true;\n\n _attemptRecursiveSync();\n }\n /**\n * Does a synchronization in the background in case the last offset should be verified or a 404 occurs\n */\n\n\n function _onAttemptBackgroundSync() {\n if (!settings.get().streaming.utcSynchronization.enabled || isSynchronizing || isBackgroundSynchronizing || !lastTimingSource || !lastTimingSource.value || !lastTimingSource.schemeIdUri || isNaN(lastOffset) || isNaN(settings.get().streaming.utcSynchronization.backgroundAttempts)) {\n return;\n }\n\n if (timeOfLastBackgroundSync && (Date.now() - timeOfLastBackgroundSync) / 1000 < DEFAULT_MINIMUM_TIME_BETWEEN_BACKGROUND_SYNC_ATTEMPTS) {\n return;\n }\n\n backgroundSyncTimeOffsets = [];\n isBackgroundSynchronizing = true;\n var backgroundAttempts = !isNaN(settings.get().streaming.utcSynchronization.backgroundAttempts) ? settings.get().streaming.utcSynchronization.backgroundAttempts : DEFAULT_BACKGROUND_ATTEMPTS;\n\n _attemptBackgroundSync(backgroundAttempts);\n }\n /**\n * Perform a defined number of background attempts\n * @param {number} attempts\n * @private\n */\n\n\n function _attemptBackgroundSync(attempts) {\n try {\n if (attempts <= 0) {\n _completeBackgroundTimeSyncSequence();\n\n return;\n }\n\n var deviceTimeBeforeSync = Date.now();\n handlers[lastTimingSource.schemeIdUri](lastTimingSource.value, function (serverTime) {\n // the timing source returned something useful\n var deviceTimeAfterSync = Date.now();\n\n var offset = _calculateOffset(deviceTimeBeforeSync, deviceTimeAfterSync, serverTime);\n\n backgroundSyncTimeOffsets.push(offset);\n\n _attemptBackgroundSync(attempts - 1);\n }, function () {\n _completeBackgroundTimeSyncSequence();\n });\n } catch (e) {\n _completeBackgroundTimeSyncSequence();\n }\n }\n /**\n * Sync against a timing source. This method is called recursively if the time sync for the first entry in timingSources fails.\n * @param {number} sourceIndex\n */\n\n\n function _attemptRecursiveSync() {\n var sourceIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n // if called with no sourceIndex, use zero (highest priority)\n var index = sourceIndex || 0; // the sources should be ordered in priority from the manifest.\n // try each in turn, from the top, until either something\n // sensible happens, or we run out of sources to try.\n\n if (!timingSources || timingSources.length === 0 || index >= timingSources.length) {\n _onComplete();\n\n return;\n }\n\n var source = timingSources[index];\n\n if (source) {\n // check if there is a handler for this @schemeIdUri\n if (handlers.hasOwnProperty(source.schemeIdUri)) {\n // if so, call it with its @value\n var deviceTimeBeforeSync = new Date().getTime();\n handlers[source.schemeIdUri](source.value, function (serverTime) {\n // the timing source returned something useful\n var deviceTimeAfterSync = new Date().getTime();\n\n var offset = _calculateOffset(deviceTimeBeforeSync, deviceTimeAfterSync, serverTime);\n\n lastTimingSource = source;\n\n _onComplete(offset);\n }, function () {\n // the timing source was probably uncontactable\n // or returned something we can\'t use - try again\n // with the remaining sources\n _attemptRecursiveSync(index + 1);\n });\n } else {\n // an unknown schemeIdUri must have been found\n // try again with the remaining sources\n _attemptRecursiveSync(index + 1);\n }\n } else {\n // no valid time source could be found, just use device time\n _onComplete();\n }\n }\n /**\n * Calculate the offset between client and server. Account for the roundtrip time\n * @param {number} deviceTimeBeforeSync\n * @param {number} deviceTimeAfterSync\n * @param {number} serverTime\n * @return {number}\n * @private\n */\n\n\n function _calculateOffset(deviceTimeBeforeSync, deviceTimeAfterSync, serverTime) {\n var deviceReferenceTime = deviceTimeAfterSync - (deviceTimeAfterSync - deviceTimeBeforeSync) / 2;\n return serverTime - deviceReferenceTime;\n }\n /**\n * Checks if a synchronization is required\n * @param {boolean} isDynamic\n * @return {boolean}\n * @private\n */\n\n\n function _shouldPerformSynchronization(isDynamic) {\n try {\n if (!isDynamic || !settings.get().streaming.utcSynchronization.enabled) {\n return false;\n }\n\n var timeBetweenSyncAttempts = !isNaN(internalTimeBetweenSyncAttempts) ? internalTimeBetweenSyncAttempts : DEFAULT_TIME_BETWEEN_SYNC_ATTEMPTS;\n\n if (!timeOfLastSync || !timeBetweenSyncAttempts || isNaN(timeBetweenSyncAttempts)) {\n return true;\n }\n\n return (Date.now() - timeOfLastSync) / 1000 >= timeBetweenSyncAttempts;\n } catch (e) {\n return true;\n }\n }\n /**\n * Callback after sync has been completed\n * @param {number} offset\n * @private\n */\n\n\n function _onComplete() {\n var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : NaN;\n var failed = isNaN(offset);\n\n if (failed && settings.get().streaming.utcSynchronization.useManifestDateHeaderTimeSource) {\n //Before falling back to binary search , check if date header exists on MPD. if so, use for a time source.\n _checkForDateHeader();\n } else {\n _completeTimeSyncSequence(failed, offset);\n }\n }\n /**\n * Takes xsdatetime and returns milliseconds since UNIX epoch. May not be necessary as xsdatetime is very similar to ISO 8601 which is natively understood by javascript Date parser\n * @param {string} xsdatetimeStr\n * @return {number}\n * @private\n */\n\n\n function _alternateXsdatetimeDecoder(xsdatetimeStr) {\n // taken from DashParser - should probably refactor both uses\n var SECONDS_IN_MIN = 60;\n var MINUTES_IN_HOUR = 60;\n var MILLISECONDS_IN_SECONDS = 1000;\n var datetimeRegex = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\\.[0-9]*)?)?(?:([+\\-])([0-9]{2})([0-9]{2}))?/;\n var utcDate, timezoneOffset;\n var match = datetimeRegex.exec(xsdatetimeStr); // If the string does not contain a timezone offset different browsers can interpret it either\n // as UTC or as a local time so we have to parse the string manually to normalize the given date value for\n // all browsers\n\n utcDate = Date.UTC(parseInt(match[1], 10), parseInt(match[2], 10) - 1, // months start from zero\n parseInt(match[3], 10), parseInt(match[4], 10), parseInt(match[5], 10), match[6] && (parseInt(match[6], 10) || 0), match[7] && parseFloat(match[7]) * MILLISECONDS_IN_SECONDS || 0); // If the date has timezone offset take it into account as well\n\n if (match[9] && match[10]) {\n timezoneOffset = parseInt(match[9], 10) * MINUTES_IN_HOUR + parseInt(match[10], 10);\n utcDate += (match[8] === \'+\' ? -1 : +1) * timezoneOffset * SECONDS_IN_MIN * MILLISECONDS_IN_SECONDS;\n }\n\n return new Date(utcDate).getTime();\n }\n /**\n * Try to use the built in parser, since xsdate is a constrained ISO8601 which is supported natively by Date.parse. if that fails, try a regex-based version used elsewhere in this application.\n * @param {string} xsdatetimeStr\n * @return {number}\n */\n\n\n function _xsdatetimeDecoder(xsdatetimeStr) {\n var parsedDate = Date.parse(xsdatetimeStr);\n\n if (isNaN(parsedDate)) {\n parsedDate = _alternateXsdatetimeDecoder(xsdatetimeStr);\n }\n\n return parsedDate;\n }\n /**\n * Takes ISO 8601 timestamp and returns milliseconds since UNIX epoch\n * @param {string} isoStr\n * @return {number}\n */\n\n\n function _iso8601Decoder(isoStr) {\n return Date.parse(isoStr);\n }\n /**\n * Takes RFC 1123 timestamp (which is same as ISO8601) and returns milliseconds since UNIX epoch\n * @param {string} dateStr\n * @return {number}\n */\n\n\n function _rfc1123Decoder(dateStr) {\n return Date.parse(dateStr);\n }\n /**\n * Handler for unsupported scheme ids.\n * @param {string} url\n * @param {function} onSuccessCB\n * @param {function} onFailureCB\n * @private\n */\n\n\n function _notSupportedHandler(url, onSuccessCB, onFailureCB) {\n onFailureCB();\n }\n /**\n * Direct handler\n * @param {string} xsdatetimeStr\n * @param {function} onSuccessCB\n * @param {function} onFailureCB\n */\n\n\n function _directHandler(xsdatetimeStr, onSuccessCB, onFailureCB) {\n var time = _xsdatetimeDecoder(xsdatetimeStr);\n\n if (!isNaN(time)) {\n onSuccessCB(time);\n return;\n }\n\n onFailureCB();\n }\n /**\n * Generic http handler\n * @param {function} decoder\n * @param {string} url\n * @param {function} onSuccessCB\n * @param {function} onFailureCB\n * @param {boolean} isHeadRequest\n * @private\n */\n\n\n function _httpHandler(decoder, url, onSuccessCB, onFailureCB, isHeadRequest) {\n var oncomplete, onload;\n var complete = false;\n var req = new XMLHttpRequest();\n var verb = isHeadRequest ? _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_1__["HTTPRequest"].HEAD : _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_1__["HTTPRequest"].GET;\n var urls = url.match(/\\S+/g); // according to ISO 23009-1, url could be a white-space\n // separated list of URLs. just handle one at a time.\n\n url = urls.shift();\n\n oncomplete = function oncomplete() {\n if (complete) {\n return;\n } // we only want to pass through here once per xhr,\n // regardless of whether the load was successful.\n\n\n complete = true; // if there are more urls to try, call self.\n\n if (urls.length) {\n _httpHandler(decoder, urls.join(\' \'), onSuccessCB, onFailureCB, isHeadRequest);\n } else {\n onFailureCB();\n }\n };\n\n onload = function onload() {\n var time, result;\n\n if (req.status === 200) {\n time = isHeadRequest ? req.getResponseHeader(\'Date\') : req.response;\n result = decoder(time); // decoder returns NaN if non-standard input\n\n if (!isNaN(result)) {\n onSuccessCB(result);\n complete = true;\n }\n }\n };\n\n if (urlUtils.isRelative(url)) {\n // passing no path to resolve will return just MPD BaseURL/baseUri\n var baseUrl = baseURLController.resolve();\n\n if (baseUrl) {\n url = urlUtils.resolve(url, baseUrl.url);\n }\n }\n\n req.open(verb, url);\n req.timeout = HTTP_TIMEOUT_MS;\n req.onload = onload;\n req.onloadend = oncomplete;\n req.send();\n }\n /**\n * Handler for http-head schemeIdUri\n * @param {string} url\n * @param {function} onSuccessCB\n * @param {function} onFailureCB\n * @private\n */\n\n\n function _httpHeadHandler(url, onSuccessCB, onFailureCB) {\n _httpHandler(_rfc1123Decoder, url, onSuccessCB, onFailureCB, true);\n }\n /**\n * Checks if a date header is present in the MPD response and calculates the offset based on the header\n * @private\n */\n\n\n function _checkForDateHeader() {\n var dateHeaderValue = dashMetrics.getLatestMPDRequestHeaderValueByID(\'Date\');\n var dateHeaderTime = dateHeaderValue !== null ? new Date(dateHeaderValue).getTime() : Number.NaN;\n\n if (!isNaN(dateHeaderTime)) {\n var offsetToDeviceTimeMs = dateHeaderTime - Date.now();\n\n _completeTimeSyncSequence(false, offsetToDeviceTimeMs);\n } else {\n _completeTimeSyncSequence(true);\n }\n }\n /**\n * Triggers the event to signal that the time synchronization was completed\n * @param {boolean} failed\n * @param {number} offset\n * @private\n */\n\n\n function _completeTimeSyncSequence(failed, offset) {\n // Adjust the time of the next sync based on the drift between current offset and last offset\n if (!isNaN(lastOffset) && !isNaN(offset) && !failed) {\n _adjustTimeBetweenSyncAttempts(offset);\n } // Update the internal data\n\n\n if (!failed && !isNaN(offset)) {\n timeOfLastSync = Date.now();\n isSynchronizing = false; // if this is the first sync we are doing perform background syncs as well to confirm current offset\n\n var shouldAttemptBackgroundSync = isNaN(lastOffset);\n lastOffset = offset;\n\n if (shouldAttemptBackgroundSync) {\n _onAttemptBackgroundSync();\n }\n\n logger.debug("Completed UTC sync. Setting client - server offset to ".concat(offset));\n }\n\n if (failed) {\n lastTimingSource = null;\n isSynchronizing = false;\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_0__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_4__["default"].TIME_SYNC_FAILED_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_4__["default"].TIME_SYNC_FAILED_ERROR_MESSAGE));\n } // Notify other classes\n\n\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].UPDATE_TIME_SYNC_OFFSET, {\n offset: offset\n });\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].TIME_SYNCHRONIZATION_COMPLETED);\n }\n\n function _adjustTimeBetweenSyncAttempts(offset) {\n try {\n var isOffsetDriftWithinThreshold = _isOffsetDriftWithinThreshold(offset);\n\n var timeBetweenSyncAttempts = !isNaN(internalTimeBetweenSyncAttempts) ? internalTimeBetweenSyncAttempts : DEFAULT_TIME_BETWEEN_SYNC_ATTEMPTS;\n var timeBetweenSyncAttemptsAdjustmentFactor = !isNaN(settings.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor) ? settings.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor : DEFAULT_TIME_BETWEEN_SYNC_ATTEMPTS_ADJUSTMENT_FACTOR;\n var maximumTimeBetweenSyncAttempts = !isNaN(settings.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts) ? settings.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts : DEFAULT_MAXIMUM_TIME_BETWEEN_SYNC;\n var minimumTimeBetweenSyncAttempts = !isNaN(settings.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts) ? settings.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts : DEFAULT_MINIMUM_TIME_BETWEEN_SYNC;\n var adjustedTimeBetweenSyncAttempts;\n\n if (isOffsetDriftWithinThreshold) {\n // The drift between the current offset and the last offset is within the allowed threshold. Increase sync time\n adjustedTimeBetweenSyncAttempts = Math.min(timeBetweenSyncAttempts * timeBetweenSyncAttemptsAdjustmentFactor, maximumTimeBetweenSyncAttempts);\n logger.debug("Increasing timeBetweenSyncAttempts to ".concat(adjustedTimeBetweenSyncAttempts));\n } else {\n // Drift between the current offset and the last offset is not within the allowed threshold. Decrease sync time\n adjustedTimeBetweenSyncAttempts = Math.max(timeBetweenSyncAttempts / timeBetweenSyncAttemptsAdjustmentFactor, minimumTimeBetweenSyncAttempts);\n logger.debug("Decreasing timeBetweenSyncAttempts to ".concat(adjustedTimeBetweenSyncAttempts));\n }\n\n internalTimeBetweenSyncAttempts = adjustedTimeBetweenSyncAttempts;\n } catch (e) {}\n }\n /**\n * Callback after all background syncs have been completed.\n * @private\n */\n\n\n function _completeBackgroundTimeSyncSequence() {\n if (!backgroundSyncTimeOffsets || backgroundSyncTimeOffsets.length === 0) {\n return;\n }\n\n var averageOffset = backgroundSyncTimeOffsets.reduce(function (acc, curr) {\n return acc + curr;\n }, 0) / backgroundSyncTimeOffsets.length;\n\n if (!_isOffsetDriftWithinThreshold(averageOffset)) {\n logger.debug("Completed background UTC sync. Setting client - server offset to ".concat(averageOffset));\n lastOffset = averageOffset;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].UPDATE_TIME_SYNC_OFFSET, {\n offset: lastOffset\n });\n } else {\n logger.debug("Completed background UTC sync. Offset is within allowed threshold and is not adjusted.");\n }\n\n isBackgroundSynchronizing = false;\n timeOfLastBackgroundSync = Date.now();\n }\n\n function _isOffsetDriftWithinThreshold(offset) {\n try {\n if (isNaN(lastOffset)) {\n return true;\n }\n\n var maxAllowedDrift = settings.get().streaming.utcSynchronization.maximumAllowedDrift && !isNaN(settings.get().streaming.utcSynchronization.maximumAllowedDrift) ? settings.get().streaming.utcSynchronization.maximumAllowedDrift : DEFAULT_MAXIMUM_ALLOWED_DRIFT;\n var lowerBound = lastOffset - maxAllowedDrift;\n var upperBound = lastOffset + maxAllowedDrift;\n return offset >= lowerBound && offset <= upperBound;\n } catch (e) {\n return true;\n }\n }\n\n function reset() {\n _resetInitialSettings();\n\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].ATTEMPT_BACKGROUND_SYNC, _onAttemptBackgroundSync, instance);\n }\n\n instance = {\n initialize: initialize,\n attemptSync: attemptSync,\n setConfig: setConfig,\n reset: reset\n };\n setup();\n return instance;\n}\n\nTimeSyncController.__dashjs_factory_name = \'TimeSyncController\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_5__["default"].getSingletonFactory(TimeSyncController);\nfactory.HTTP_TIMEOUT_MS = HTTP_TIMEOUT_MS;\n_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_5__["default"].updateSingletonFactory(TimeSyncController.__dashjs_factory_name, factory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/controllers/XlinkController.js":\n/*!******************************************************!*\\\n !*** ./src/streaming/controllers/XlinkController.js ***!\n \\******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1592676__) {\n__nested_webpack_require_1592676__.r(__nested_webpack_exports__);\n/* harmony import */ var _XlinkLoader__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1592676__(/*! ../XlinkLoader */ "./src/streaming/XlinkLoader.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1592676__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1592676__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1592676__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _externals_xml2json__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1592676__(/*! ../../../externals/xml2json */ "./externals/xml2json.js");\n/* harmony import */ var _utils_URLUtils__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1592676__(/*! ../utils/URLUtils */ "./src/streaming/utils/URLUtils.js");\n/* harmony import */ var _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1592676__(/*! ../../dash/constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\nvar RESOLVE_TYPE_ONLOAD = \'onLoad\';\nvar RESOLVE_TYPE_ONACTUATE = \'onActuate\';\nvar RESOLVE_TO_ZERO = \'urn:mpeg:dash:resolve-to-zero:2013\';\n\nfunction XlinkController(config) {\n config = config || {};\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance();\n var urlUtils = Object(_utils_URLUtils__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance();\n var instance, matchers, iron, manifest, converter, xlinkLoader;\n\n function setup() {\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].XLINK_ELEMENT_LOADED, onXlinkElementLoaded, instance);\n xlinkLoader = Object(_XlinkLoader__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create({\n errHandler: config.errHandler,\n dashMetrics: config.dashMetrics,\n mediaPlayerModel: config.mediaPlayerModel,\n requestModifier: config.requestModifier,\n settings: config.settings\n });\n }\n\n function setMatchers(value) {\n if (value) {\n matchers = value;\n }\n }\n\n function setIron(value) {\n if (value) {\n iron = value;\n }\n }\n /**\n * <p>Triggers the resolution of the xlink.onLoad attributes in the manifest file </p>\n * @param {Object} mpd - the manifest\n */\n\n\n function resolveManifestOnLoad(mpd) {\n var elements; // First resolve all periods, so unnecessary requests inside onLoad Periods with Default content are avoided\n\n converter = new _externals_xml2json__WEBPACK_IMPORTED_MODULE_4__["default"]({\n escapeMode: false,\n attributePrefix: \'\',\n arrayAccessForm: \'property\',\n emptyNodeForm: \'object\',\n stripWhitespaces: false,\n enableToStringFunc: false,\n ignoreRoot: true,\n matchers: matchers\n });\n manifest = mpd;\n\n if (manifest.Period_asArray) {\n elements = getElementsToResolve(manifest.Period_asArray, manifest, _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].PERIOD, RESOLVE_TYPE_ONLOAD);\n resolve(elements, _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].PERIOD, RESOLVE_TYPE_ONLOAD);\n } else {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].XLINK_READY, {\n manifest: manifest\n });\n }\n }\n\n function reset() {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].XLINK_ELEMENT_LOADED, onXlinkElementLoaded, instance);\n\n if (xlinkLoader) {\n xlinkLoader.reset();\n xlinkLoader = null;\n }\n }\n\n function resolve(elements, type, resolveType) {\n var resolveObject = {};\n var element, url;\n resolveObject.elements = elements;\n resolveObject.type = type;\n resolveObject.resolveType = resolveType; // If nothing to resolve, directly call allElementsLoaded\n\n if (resolveObject.elements.length === 0) {\n onXlinkAllElementsLoaded(resolveObject);\n }\n\n for (var i = 0; i < resolveObject.elements.length; i++) {\n element = resolveObject.elements[i];\n\n if (urlUtils.isHTTPURL(element.url)) {\n url = element.url;\n } else {\n url = element.originalContent.BaseURL + element.url;\n }\n\n xlinkLoader.load(url, element, resolveObject);\n }\n }\n\n function onXlinkElementLoaded(event) {\n var element, resolveObject;\n var openingTag = \'<response>\';\n var closingTag = \'</response>\';\n var mergedContent = \'\';\n element = event.element;\n resolveObject = event.resolveObject; // if the element resolved into content parse the content\n\n if (element.resolvedContent) {\n var index = 0; // we add a parent elements so the converter is able to parse multiple elements of the same type which are not wrapped inside a container\n\n if (element.resolvedContent.indexOf(\'<?xml\') === 0) {\n index = element.resolvedContent.indexOf(\'?>\') + 2; //find the closing position of the xml declaration, if it exists.\n }\n\n mergedContent = element.resolvedContent.substr(0, index) + openingTag + element.resolvedContent.substr(index) + closingTag;\n element.resolvedContent = converter.xml_str2json(mergedContent);\n }\n\n if (isResolvingFinished(resolveObject)) {\n onXlinkAllElementsLoaded(resolveObject);\n }\n } // We got to wait till all elements of the current queue are resolved before merging back\n\n\n function onXlinkAllElementsLoaded(resolveObject) {\n var elements = [];\n var i, obj;\n mergeElementsBack(resolveObject);\n\n if (resolveObject.resolveType === RESOLVE_TYPE_ONACTUATE) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].XLINK_READY, {\n manifest: manifest\n });\n }\n\n if (resolveObject.resolveType === RESOLVE_TYPE_ONLOAD) {\n switch (resolveObject.type) {\n // Start resolving the other elements. We can do Adaptation Set and EventStream in parallel\n case _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].PERIOD:\n for (i = 0; i < manifest[_dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].PERIOD + \'_asArray\'].length; i++) {\n obj = manifest[_dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].PERIOD + \'_asArray\'][i];\n\n if (obj.hasOwnProperty(_dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].ADAPTATION_SET + \'_asArray\')) {\n elements = elements.concat(getElementsToResolve(obj[_dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].ADAPTATION_SET + \'_asArray\'], obj, _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].ADAPTATION_SET, RESOLVE_TYPE_ONLOAD));\n }\n\n if (obj.hasOwnProperty(_dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].EVENT_STREAM + \'_asArray\')) {\n elements = elements.concat(getElementsToResolve(obj[_dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].EVENT_STREAM + \'_asArray\'], obj, _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].EVENT_STREAM, RESOLVE_TYPE_ONLOAD));\n }\n }\n\n resolve(elements, _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].ADAPTATION_SET, RESOLVE_TYPE_ONLOAD);\n break;\n\n case _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_6__["default"].ADAPTATION_SET:\n // TODO: Resolve SegmentList here\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].XLINK_READY, {\n manifest: manifest\n });\n break;\n }\n }\n } // Returns the elements with the specific resolve Type\n\n\n function getElementsToResolve(elements, parentElement, type, resolveType) {\n var toResolve = [];\n var element, i, xlinkObject; // first remove all the resolve-to-zero elements\n\n for (i = elements.length - 1; i >= 0; i--) {\n element = elements[i];\n\n if (element.hasOwnProperty(\'xlink:href\') && element[\'xlink:href\'] === RESOLVE_TO_ZERO) {\n elements.splice(i, 1);\n }\n } // now get the elements with the right resolve type\n\n\n for (i = 0; i < elements.length; i++) {\n element = elements[i];\n\n if (element.hasOwnProperty(\'xlink:href\') && element.hasOwnProperty(\'xlink:actuate\') && element[\'xlink:actuate\'] === resolveType) {\n xlinkObject = createXlinkObject(element[\'xlink:href\'], parentElement, type, i, resolveType, element);\n toResolve.push(xlinkObject);\n }\n }\n\n return toResolve;\n }\n\n function mergeElementsBack(resolveObject) {\n var resolvedElements = [];\n var element, type, obj, i, j, k; // Start merging back from the end because of index shifting. Note that the elements with the same parent have to be ordered by index ascending\n\n for (i = resolveObject.elements.length - 1; i >= 0; i--) {\n element = resolveObject.elements[i];\n type = element.type + \'_asArray\'; // Element couldn\'t be resolved or is TODO Inappropriate target: Remove all Xlink attributes\n\n if (!element.resolvedContent || isInappropriateTarget()) {\n delete element.originalContent[\'xlink:actuate\'];\n delete element.originalContent[\'xlink:href\'];\n resolvedElements.push(element.originalContent);\n } // Element was successfully resolved\n else if (element.resolvedContent) {\n for (j = 0; j < element.resolvedContent[type].length; j++) {\n //TODO Contains another Xlink attribute with xlink:actuate set to onload. Remove all xLink attributes\n obj = element.resolvedContent[type][j];\n resolvedElements.push(obj);\n }\n } // Replace the old elements in the parent with the resolved ones\n\n\n element.parentElement[type].splice(element.index, 1);\n\n for (k = 0; k < resolvedElements.length; k++) {\n element.parentElement[type].splice(element.index + k, 0, resolvedElements[k]);\n }\n\n resolvedElements = [];\n }\n\n if (resolveObject.elements.length > 0) {\n iron.run(manifest);\n }\n }\n\n function createXlinkObject(url, parentElement, type, index, resolveType, originalContent) {\n return {\n url: url,\n parentElement: parentElement,\n type: type,\n index: index,\n resolveType: resolveType,\n originalContent: originalContent,\n resolvedContent: null,\n resolved: false\n };\n } // Check if all pending requests are finished\n\n\n function isResolvingFinished(elementsToResolve) {\n var i, obj;\n\n for (i = 0; i < elementsToResolve.elements.length; i++) {\n obj = elementsToResolve.elements[i];\n\n if (obj.resolved === false) {\n return false;\n }\n }\n\n return true;\n } // TODO : Do some syntax check here if the target is valid or not\n\n\n function isInappropriateTarget() {\n return false;\n }\n\n instance = {\n resolveManifestOnLoad: resolveManifestOnLoad,\n setMatchers: setMatchers,\n setIron: setIron,\n reset: reset\n };\n setup();\n return instance;\n}\n\nXlinkController.__dashjs_factory_name = \'XlinkController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_3__["default"].getClassFactory(XlinkController));\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/MetricsReporting.js":\n/*!***************************************************!*\\\n !*** ./src/streaming/metrics/MetricsReporting.js ***!\n \\***************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1606149__) {\n__nested_webpack_require_1606149__.r(__nested_webpack_exports__);\n/* harmony import */ var _utils_DVBErrorsTranslator__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1606149__(/*! ./utils/DVBErrorsTranslator */ "./src/streaming/metrics/utils/DVBErrorsTranslator.js");\n/* harmony import */ var _MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1606149__(/*! ./MetricsReportingEvents */ "./src/streaming/metrics/MetricsReportingEvents.js");\n/* harmony import */ var _controllers_MetricsCollectionController__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1606149__(/*! ./controllers/MetricsCollectionController */ "./src/streaming/metrics/controllers/MetricsCollectionController.js");\n/* harmony import */ var _metrics_MetricsHandlerFactory__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1606149__(/*! ./metrics/MetricsHandlerFactory */ "./src/streaming/metrics/metrics/MetricsHandlerFactory.js");\n/* harmony import */ var _reporting_ReportingFactory__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1606149__(/*! ./reporting/ReportingFactory */ "./src/streaming/metrics/reporting/ReportingFactory.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\nfunction MetricsReporting() {\n var context = this.context;\n var instance, dvbErrorsTranslator;\n /**\n * Create a MetricsCollectionController, and a DVBErrorsTranslator\n * @param {Object} config - dependancies from owner\n * @return {MetricsCollectionController} Metrics Collection Controller\n */\n\n function createMetricsReporting(config) {\n dvbErrorsTranslator = Object(_utils_DVBErrorsTranslator__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance({\n eventBus: config.eventBus,\n dashMetrics: config.dashMetrics,\n metricsConstants: config.metricsConstants,\n events: config.events\n });\n dvbErrorsTranslator.initialise();\n return Object(_controllers_MetricsCollectionController__WEBPACK_IMPORTED_MODULE_2__["default"])(context).create(config);\n }\n /**\n * Get the ReportingFactory to allow new reporters to be registered\n * @return {ReportingFactory} Reporting Factory\n */\n\n\n function getReportingFactory() {\n return Object(_reporting_ReportingFactory__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n }\n /**\n * Get the MetricsHandlerFactory to allow new handlers to be registered\n * @return {MetricsHandlerFactory} Metrics Handler Factory\n */\n\n\n function getMetricsHandlerFactory() {\n return Object(_metrics_MetricsHandlerFactory__WEBPACK_IMPORTED_MODULE_3__["default"])(context).getInstance();\n }\n\n instance = {\n createMetricsReporting: createMetricsReporting,\n getReportingFactory: getReportingFactory,\n getMetricsHandlerFactory: getMetricsHandlerFactory\n };\n return instance;\n}\n\nMetricsReporting.__dashjs_factory_name = \'MetricsReporting\';\nvar factory = dashjs.FactoryMaker.getClassFactory(MetricsReporting);\n/* jshint ignore:line */\n\nfactory.events = _MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_1__["default"];\ndashjs.FactoryMaker.updateClassFactory(MetricsReporting.__dashjs_factory_name, factory);\n/* jshint ignore:line */\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/MetricsReportingEvents.js":\n/*!*********************************************************!*\\\n !*** ./src/streaming/metrics/MetricsReportingEvents.js ***!\n \\*********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1611427__) {\n__nested_webpack_require_1611427__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_events_EventsBase__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1611427__(/*! ../../core/events/EventsBase */ "./src/core/events/EventsBase.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @implements EventsBase\n */\n\nvar MetricsReportingEvents = /*#__PURE__*/function (_EventsBase) {\n _inherits(MetricsReportingEvents, _EventsBase);\n\n var _super = _createSuper(MetricsReportingEvents);\n\n function MetricsReportingEvents() {\n var _this;\n\n _classCallCheck(this, MetricsReportingEvents);\n\n _this = _super.call(this);\n _this.METRICS_INITIALISATION_COMPLETE = \'internal_metricsReportingInitialized\';\n _this.BECAME_REPORTING_PLAYER = \'internal_becameReportingPlayer\';\n /**\n * Triggered when CMCD data was generated for a HTTP request\n * @event MetricsReportingEvents#CMCD_DATA_GENERATED\n */\n\n _this.CMCD_DATA_GENERATED = \'cmcdDataGenerated\';\n return _this;\n }\n\n return MetricsReportingEvents;\n}(_core_events_EventsBase__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\nvar metricsReportingEvents = new MetricsReportingEvents();\n/* harmony default export */ __nested_webpack_exports__["default"] = (metricsReportingEvents);\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/controllers/MetricsCollectionController.js":\n/*!**************************************************************************!*\\\n !*** ./src/streaming/metrics/controllers/MetricsCollectionController.js ***!\n \\**************************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1617284__) {\n__nested_webpack_require_1617284__.r(__nested_webpack_exports__);\n/* harmony import */ var _MetricsController__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1617284__(/*! ./MetricsController */ "./src/streaming/metrics/controllers/MetricsController.js");\n/* harmony import */ var _utils_ManifestParsing__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1617284__(/*! ../utils/ManifestParsing */ "./src/streaming/metrics/utils/ManifestParsing.js");\n/* harmony import */ var _MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1617284__(/*! ../MetricsReportingEvents */ "./src/streaming/metrics/MetricsReportingEvents.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\nfunction MetricsCollectionController(config) {\n config = config || {};\n var instance;\n var metricsControllers = {};\n var context = this.context;\n var eventBus = config.eventBus;\n var events = config.events;\n\n function update(e) {\n if (e.error) {\n return;\n } // start by assuming all existing controllers need removing\n\n\n var controllersToRemove = Object.keys(metricsControllers);\n var metrics = Object(_utils_ManifestParsing__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance({\n adapter: config.adapter,\n constants: config.constants\n }).getMetrics(e.manifest);\n metrics.forEach(function (m) {\n var key = JSON.stringify(m);\n\n if (!metricsControllers.hasOwnProperty(key)) {\n try {\n var controller = Object(_MetricsController__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create(config);\n controller.initialize(m);\n metricsControllers[key] = controller;\n } catch (e) {// fail quietly\n }\n } else {\n // we still need this controller - delete from removal list\n controllersToRemove.splice(key, 1);\n }\n }); // now remove the unwanted controllers\n\n controllersToRemove.forEach(function (c) {\n metricsControllers[c].reset();\n delete metricsControllers[c];\n });\n eventBus.trigger(_MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_2__["default"].METRICS_INITIALISATION_COMPLETE);\n }\n\n function resetMetricsControllers() {\n Object.keys(metricsControllers).forEach(function (key) {\n metricsControllers[key].reset();\n });\n metricsControllers = {};\n }\n\n function setup() {\n eventBus.on(events.MANIFEST_UPDATED, update, instance);\n eventBus.on(events.STREAM_TEARDOWN_COMPLETE, resetMetricsControllers, instance);\n }\n\n function reset() {\n eventBus.off(events.MANIFEST_UPDATED, update, instance);\n eventBus.off(events.STREAM_TEARDOWN_COMPLETE, resetMetricsControllers, instance);\n }\n\n instance = {\n reset: reset\n };\n setup();\n return instance;\n}\n\nMetricsCollectionController.__dashjs_factory_name = \'MetricsCollectionController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(MetricsCollectionController));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/controllers/MetricsController.js":\n/*!****************************************************************!*\\\n !*** ./src/streaming/metrics/controllers/MetricsController.js ***!\n \\****************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1622373__) {\n__nested_webpack_require_1622373__.r(__nested_webpack_exports__);\n/* harmony import */ var _RangeController__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1622373__(/*! ./RangeController */ "./src/streaming/metrics/controllers/RangeController.js");\n/* harmony import */ var _ReportingController__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1622373__(/*! ./ReportingController */ "./src/streaming/metrics/controllers/ReportingController.js");\n/* harmony import */ var _MetricsHandlersController__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1622373__(/*! ./MetricsHandlersController */ "./src/streaming/metrics/controllers/MetricsHandlersController.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\nfunction MetricsController(config) {\n config = config || {};\n var metricsHandlersController, reportingController, rangeController, instance;\n var context = this.context;\n\n function initialize(metricsEntry) {\n try {\n rangeController = Object(_RangeController__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create({\n mediaElement: config.mediaElement\n });\n rangeController.initialize(metricsEntry.Range);\n reportingController = Object(_ReportingController__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create({\n debug: config.debug,\n metricsConstants: config.metricsConstants\n });\n reportingController.initialize(metricsEntry.Reporting, rangeController);\n metricsHandlersController = Object(_MetricsHandlersController__WEBPACK_IMPORTED_MODULE_2__["default"])(context).create({\n debug: config.debug,\n eventBus: config.eventBus,\n metricsConstants: config.metricsConstants,\n events: config.events\n });\n metricsHandlersController.initialize(metricsEntry.metrics, reportingController);\n } catch (e) {\n reset();\n throw e;\n }\n }\n\n function reset() {\n if (metricsHandlersController) {\n metricsHandlersController.reset();\n }\n\n if (reportingController) {\n reportingController.reset();\n }\n\n if (rangeController) {\n rangeController.reset();\n }\n }\n\n instance = {\n initialize: initialize,\n reset: reset\n };\n return instance;\n}\n\nMetricsController.__dashjs_factory_name = \'MetricsController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(MetricsController));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/controllers/MetricsHandlersController.js":\n/*!************************************************************************!*\\\n !*** ./src/streaming/metrics/controllers/MetricsHandlersController.js ***!\n \\************************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1626937__) {\n__nested_webpack_require_1626937__.r(__nested_webpack_exports__);\n/* harmony import */ var _metrics_MetricsHandlerFactory__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1626937__(/*! ../metrics/MetricsHandlerFactory */ "./src/streaming/metrics/metrics/MetricsHandlerFactory.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction MetricsHandlersController(config) {\n config = config || {};\n var handlers = [];\n var instance;\n var context = this.context;\n var eventBus = config.eventBus;\n var Events = config.events;\n var metricsHandlerFactory = Object(_metrics_MetricsHandlerFactory__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance({\n debug: config.debug,\n eventBus: config.eventBus,\n metricsConstants: config.metricsConstants\n });\n\n function handle(e) {\n handlers.forEach(function (handler) {\n handler.handleNewMetric(e.metric, e.value, e.mediaType);\n });\n }\n\n function initialize(metrics, reportingController) {\n metrics.split(\',\').forEach(function (m, midx, ms) {\n var handler; // there is a bug in ISO23009-1 where the metrics attribute\n // is a comma-separated list but HttpList key can contain a\n // comma enclosed by ().\n\n if (m.indexOf(\'(\') !== -1 && m.indexOf(\')\') === -1) {\n var nextm = ms[midx + 1];\n\n if (nextm && nextm.indexOf(\'(\') === -1 && nextm.indexOf(\')\') !== -1) {\n m += \',\' + nextm; // delete the next metric so forEach does not visit.\n\n delete ms[midx + 1];\n }\n }\n\n handler = metricsHandlerFactory.create(m, reportingController);\n\n if (handler) {\n handlers.push(handler);\n }\n });\n eventBus.on(Events.METRIC_ADDED, handle, instance);\n eventBus.on(Events.METRIC_UPDATED, handle, instance);\n }\n\n function reset() {\n eventBus.off(Events.METRIC_ADDED, handle, instance);\n eventBus.off(Events.METRIC_UPDATED, handle, instance);\n handlers.forEach(function (handler) {\n return handler.reset();\n });\n handlers = [];\n }\n\n instance = {\n initialize: initialize,\n reset: reset\n };\n return instance;\n}\n\nMetricsHandlersController.__dashjs_factory_name = \'MetricsHandlersController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(MetricsHandlersController));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/controllers/RangeController.js":\n/*!**************************************************************!*\\\n !*** ./src/streaming/metrics/controllers/RangeController.js ***!\n \\**************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1631400__) {\n__nested_webpack_require_1631400__.r(__nested_webpack_exports__);\n/* harmony import */ var _utils_CustomTimeRanges__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1631400__(/*! ../../utils/CustomTimeRanges */ "./src/streaming/utils/CustomTimeRanges.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction RangeController(config) {\n config = config || {};\n var useWallClockTime = false;\n var context = this.context;\n var instance, ranges;\n var mediaElement = config.mediaElement;\n\n function initialize(rs) {\n if (rs && rs.length) {\n rs.forEach(function (r) {\n var start = r.starttime;\n var end = start + r.duration;\n ranges.add(start, end);\n });\n useWallClockTime = !!rs[0]._useWallClockTime;\n }\n }\n\n function reset() {\n ranges.clear();\n }\n\n function setup() {\n ranges = Object(_utils_CustomTimeRanges__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create();\n }\n\n function isEnabled() {\n var numRanges = ranges.length;\n var time;\n\n if (!numRanges) {\n return true;\n } // When not present, DASH Metrics reporting is requested\n // for the whole duration of the content.\n\n\n time = useWallClockTime ? new Date().getTime() / 1000 : mediaElement.currentTime;\n\n for (var i = 0; i < numRanges; i += 1) {\n var start = ranges.start(i);\n var end = ranges.end(i);\n\n if (start <= time && time < end) {\n return true;\n }\n }\n\n return false;\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n isEnabled: isEnabled\n };\n setup();\n return instance;\n}\n\nRangeController.__dashjs_factory_name = \'RangeController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(RangeController));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/controllers/ReportingController.js":\n/*!******************************************************************!*\\\n !*** ./src/streaming/metrics/controllers/ReportingController.js ***!\n \\******************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1635338__) {\n__nested_webpack_require_1635338__.r(__nested_webpack_exports__);\n/* harmony import */ var _reporting_ReportingFactory__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1635338__(/*! ../reporting/ReportingFactory */ "./src/streaming/metrics/reporting/ReportingFactory.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction ReportingController(config) {\n var reporters = [];\n var instance;\n var reportingFactory = Object(_reporting_ReportingFactory__WEBPACK_IMPORTED_MODULE_0__["default"])(this.context).getInstance(config);\n\n function initialize(reporting, rangeController) {\n // "if multiple Reporting elements are present, it is expected that\n // the client processes one of the recognized reporting schemes."\n // to ignore this, and support multiple Reporting per Metric,\n // simply change the \'some\' below to \'forEach\'\n reporting.some(function (r) {\n var reporter = reportingFactory.create(r, rangeController);\n\n if (reporter) {\n reporters.push(reporter);\n return true;\n }\n });\n }\n\n function reset() {\n reporters.forEach(function (r) {\n return r.reset();\n });\n reporters = [];\n }\n\n function report(type, vos) {\n reporters.forEach(function (r) {\n return r.report(type, vos);\n });\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n report: report\n };\n return instance;\n}\n\nReportingController.__dashjs_factory_name = \'ReportingController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(ReportingController));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/metrics/MetricsHandlerFactory.js":\n/*!****************************************************************!*\\\n !*** ./src/streaming/metrics/metrics/MetricsHandlerFactory.js ***!\n \\****************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1639080__) {\n__nested_webpack_require_1639080__.r(__nested_webpack_exports__);\n/* harmony import */ var _handlers_BufferLevelHandler__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1639080__(/*! ./handlers/BufferLevelHandler */ "./src/streaming/metrics/metrics/handlers/BufferLevelHandler.js");\n/* harmony import */ var _handlers_DVBErrorsHandler__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1639080__(/*! ./handlers/DVBErrorsHandler */ "./src/streaming/metrics/metrics/handlers/DVBErrorsHandler.js");\n/* harmony import */ var _handlers_HttpListHandler__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1639080__(/*! ./handlers/HttpListHandler */ "./src/streaming/metrics/metrics/handlers/HttpListHandler.js");\n/* harmony import */ var _handlers_GenericMetricHandler__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1639080__(/*! ./handlers/GenericMetricHandler */ "./src/streaming/metrics/metrics/handlers/GenericMetricHandler.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\nfunction MetricsHandlerFactory(config) {\n config = config || {};\n var instance;\n var logger = config.debug ? config.debug.getLogger(instance) : {}; // group 1: key, [group 3: n [, group 5: type]]\n\n var keyRegex = /([a-zA-Z]*)(\\(([0-9]*)(\\,\\s*([a-zA-Z]*))?\\))?/;\n var context = this.context;\n var knownFactoryProducts = {\n BufferLevel: _handlers_BufferLevelHandler__WEBPACK_IMPORTED_MODULE_0__["default"],\n DVBErrors: _handlers_DVBErrorsHandler__WEBPACK_IMPORTED_MODULE_1__["default"],\n HttpList: _handlers_HttpListHandler__WEBPACK_IMPORTED_MODULE_2__["default"],\n PlayList: _handlers_GenericMetricHandler__WEBPACK_IMPORTED_MODULE_3__["default"],\n RepSwitchList: _handlers_GenericMetricHandler__WEBPACK_IMPORTED_MODULE_3__["default"],\n TcpList: _handlers_GenericMetricHandler__WEBPACK_IMPORTED_MODULE_3__["default"]\n };\n\n function create(listType, reportingController) {\n var matches = listType.match(keyRegex);\n var handler;\n\n if (!matches) {\n return;\n }\n\n try {\n handler = knownFactoryProducts[matches[1]](context).create({\n eventBus: config.eventBus,\n metricsConstants: config.metricsConstants\n });\n handler.initialize(matches[1], reportingController, matches[3], matches[5]);\n } catch (e) {\n handler = null;\n logger.error("MetricsHandlerFactory: Could not create handler for type ".concat(matches[1], " with args ").concat(matches[3], ", ").concat(matches[5], " (").concat(e.message, ")"));\n }\n\n return handler;\n }\n\n function register(key, handler) {\n knownFactoryProducts[key] = handler;\n }\n\n function unregister(key) {\n delete knownFactoryProducts[key];\n }\n\n instance = {\n create: create,\n register: register,\n unregister: unregister\n };\n return instance;\n}\n\nMetricsHandlerFactory.__dashjs_factory_name = \'MetricsHandlerFactory\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(MetricsHandlerFactory));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/metrics/handlers/BufferLevelHandler.js":\n/*!**********************************************************************!*\\\n !*** ./src/streaming/metrics/metrics/handlers/BufferLevelHandler.js ***!\n \\**********************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1644207__) {\n__nested_webpack_require_1644207__.r(__nested_webpack_exports__);\n/* harmony import */ var _utils_HandlerHelpers__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1644207__(/*! ../../utils/HandlerHelpers */ "./src/streaming/metrics/utils/HandlerHelpers.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction BufferLevelHandler(config) {\n config = config || {};\n var instance, reportingController, n, name, interval, lastReportedTime;\n var context = this.context;\n var handlerHelpers = Object(_utils_HandlerHelpers__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n var storedVOs = [];\n var metricsConstants = config.metricsConstants;\n\n function getLowestBufferLevelVO() {\n try {\n return Object.keys(storedVOs).map(function (key) {\n return storedVOs[key];\n }).reduce(function (a, b) {\n return a.level < b.level ? a : b;\n });\n } catch (e) {\n return;\n }\n }\n\n function intervalCallback() {\n var vo = getLowestBufferLevelVO();\n\n if (vo) {\n if (lastReportedTime !== vo.t) {\n lastReportedTime = vo.t;\n reportingController.report(name, vo);\n }\n }\n }\n\n function initialize(basename, rc, n_ms) {\n if (rc) {\n // this will throw if n is invalid, to be\n // caught by the initialize caller.\n n = handlerHelpers.validateN(n_ms);\n reportingController = rc;\n name = handlerHelpers.reconstructFullMetricName(basename, n_ms);\n interval = setInterval(intervalCallback, n);\n }\n }\n\n function reset() {\n clearInterval(interval);\n interval = null;\n n = 0;\n reportingController = null;\n lastReportedTime = null;\n }\n\n function handleNewMetric(metric, vo, type) {\n if (metric === metricsConstants.BUFFER_LEVEL) {\n storedVOs[type] = vo;\n }\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n handleNewMetric: handleNewMetric\n };\n return instance;\n}\n\nBufferLevelHandler.__dashjs_factory_name = \'BufferLevelHandler\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(BufferLevelHandler));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/metrics/handlers/DVBErrorsHandler.js":\n/*!********************************************************************!*\\\n !*** ./src/streaming/metrics/metrics/handlers/DVBErrorsHandler.js ***!\n \\********************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1648497__) {\n__nested_webpack_require_1648497__.r(__nested_webpack_exports__);\n/* harmony import */ var _MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1648497__(/*! ../../MetricsReportingEvents */ "./src/streaming/metrics/MetricsReportingEvents.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction DVBErrorsHandler(config) {\n config = config || {};\n var instance, reportingController;\n var eventBus = config.eventBus;\n var metricsConstants = config.metricsConstants;\n\n function onInitialisationComplete() {\n // we only want to report this once per call to initialize\n eventBus.off(_MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_0__["default"].METRICS_INITIALISATION_COMPLETE, onInitialisationComplete, this); // Note: A Player becoming a reporting Player is itself\n // something which is recorded by the DVBErrors metric.\n\n eventBus.trigger(_MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_0__["default"].BECAME_REPORTING_PLAYER);\n }\n\n function initialize(unused, rc) {\n if (rc) {\n reportingController = rc;\n eventBus.on(_MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_0__["default"].METRICS_INITIALISATION_COMPLETE, onInitialisationComplete, this);\n }\n }\n\n function reset() {\n reportingController = null;\n }\n\n function handleNewMetric(metric, vo) {\n // simply pass metric straight through\n if (metric === metricsConstants.DVB_ERRORS) {\n if (reportingController) {\n reportingController.report(metric, vo);\n }\n }\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n handleNewMetric: handleNewMetric\n };\n return instance;\n}\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(DVBErrorsHandler));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/metrics/handlers/GenericMetricHandler.js":\n/*!************************************************************************!*\\\n !*** ./src/streaming/metrics/metrics/handlers/GenericMetricHandler.js ***!\n \\************************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1652455__) {\n__nested_webpack_require_1652455__.r(__nested_webpack_exports__);\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @ignore\n */\nfunction GenericMetricHandler() {\n var instance, metricName, reportingController;\n\n function initialize(name, rc) {\n metricName = name;\n reportingController = rc;\n }\n\n function reset() {\n reportingController = null;\n metricName = undefined;\n }\n\n function handleNewMetric(metric, vo) {\n // simply pass metric straight through\n if (metric === metricName) {\n if (reportingController) {\n reportingController.report(metricName, vo);\n }\n }\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n handleNewMetric: handleNewMetric\n };\n return instance;\n}\n\nGenericMetricHandler.__dashjs_factory_name = \'GenericMetricHandler\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(GenericMetricHandler));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/metrics/handlers/HttpListHandler.js":\n/*!*******************************************************************!*\\\n !*** ./src/streaming/metrics/metrics/handlers/HttpListHandler.js ***!\n \\*******************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1655578__) {\n__nested_webpack_require_1655578__.r(__nested_webpack_exports__);\n/* harmony import */ var _utils_HandlerHelpers__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1655578__(/*! ../../utils/HandlerHelpers */ "./src/streaming/metrics/utils/HandlerHelpers.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction HttpListHandler(config) {\n config = config || {};\n var instance, reportingController, n, type, name, interval;\n var storedVos = [];\n var handlerHelpers = Object(_utils_HandlerHelpers__WEBPACK_IMPORTED_MODULE_0__["default"])(this.context).getInstance();\n var metricsConstants = config.metricsConstants;\n\n function intervalCallback() {\n var vos = storedVos;\n\n if (vos.length) {\n if (reportingController) {\n reportingController.report(name, vos);\n }\n }\n\n storedVos = [];\n }\n\n function initialize(basename, rc, n_ms, requestType) {\n if (rc) {\n // this will throw if n is invalid, to be\n // caught by the initialize caller.\n n = handlerHelpers.validateN(n_ms);\n reportingController = rc;\n\n if (requestType && requestType.length) {\n type = requestType;\n }\n\n name = handlerHelpers.reconstructFullMetricName(basename, n_ms, requestType);\n interval = setInterval(intervalCallback, n);\n }\n }\n\n function reset() {\n clearInterval(interval);\n interval = null;\n n = null;\n type = null;\n storedVos = [];\n reportingController = null;\n }\n\n function handleNewMetric(metric, vo) {\n if (metric === metricsConstants.HTTP_REQUEST) {\n if (!type || type === vo.type) {\n storedVos.push(vo);\n }\n }\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n handleNewMetric: handleNewMetric\n };\n return instance;\n}\n\nHttpListHandler.__dashjs_factory_name = \'HttpListHandler\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(HttpListHandler));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/reporting/ReportingFactory.js":\n/*!*************************************************************!*\\\n !*** ./src/streaming/metrics/reporting/ReportingFactory.js ***!\n \\*************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1659666__) {\n__nested_webpack_require_1659666__.r(__nested_webpack_exports__);\n/* harmony import */ var _reporters_DVBReporting__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1659666__(/*! ./reporters/DVBReporting */ "./src/streaming/metrics/reporting/reporters/DVBReporting.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction ReportingFactory(config) {\n config = config || {};\n var knownReportingSchemeIdUris = {\n \'urn:dvb:dash:reporting:2014\': _reporters_DVBReporting__WEBPACK_IMPORTED_MODULE_0__["default"]\n };\n var context = this.context;\n var instance;\n var logger = config.debug ? config.debug.getLogger(instance) : {};\n var metricsConstants = config.metricsConstants;\n\n function create(entry, rangeController) {\n var reporting;\n\n try {\n reporting = knownReportingSchemeIdUris[entry.schemeIdUri](context).create({\n metricsConstants: metricsConstants\n });\n reporting.initialize(entry, rangeController);\n } catch (e) {\n reporting = null;\n logger.error("ReportingFactory: could not create Reporting with schemeIdUri ".concat(entry.schemeIdUri, " (").concat(e.message, ")"));\n }\n\n return reporting;\n }\n\n function register(schemeIdUri, moduleName) {\n knownReportingSchemeIdUris[schemeIdUri] = moduleName;\n }\n\n function unregister(schemeIdUri) {\n delete knownReportingSchemeIdUris[schemeIdUri];\n }\n\n instance = {\n create: create,\n register: register,\n unregister: unregister\n };\n return instance;\n}\n\nReportingFactory.__dashjs_factory_name = \'ReportingFactory\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(ReportingFactory));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/reporting/reporters/DVBReporting.js":\n/*!*******************************************************************!*\\\n !*** ./src/streaming/metrics/reporting/reporters/DVBReporting.js ***!\n \\*******************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1663514__) {\n__nested_webpack_require_1663514__.r(__nested_webpack_exports__);\n/* harmony import */ var _utils_MetricSerialiser__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1663514__(/*! ../../utils/MetricSerialiser */ "./src/streaming/metrics/utils/MetricSerialiser.js");\n/* harmony import */ var _utils_RNG__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1663514__(/*! ../../utils/RNG */ "./src/streaming/metrics/utils/RNG.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\nfunction DVBReporting(config) {\n config = config || {};\n var instance;\n var context = this.context;\n var metricSerialiser, randomNumberGenerator, reportingPlayerStatusDecided, isReportingPlayer, reportingUrl, rangeController;\n var pendingRequests = [];\n var metricsConstants = config.metricsConstants;\n\n function setup() {\n metricSerialiser = Object(_utils_MetricSerialiser__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n randomNumberGenerator = Object(_utils_RNG__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance();\n resetInitialSettings();\n }\n\n function doGetRequest(url, successCB, failureCB) {\n var req = new XMLHttpRequest();\n\n var oncomplete = function oncomplete() {\n var reqIndex = pendingRequests.indexOf(req);\n\n if (reqIndex === -1) {\n return;\n } else {\n pendingRequests.splice(reqIndex, 1);\n }\n\n if (req.status >= 200 && req.status < 300) {\n if (successCB) {\n successCB();\n }\n } else {\n if (failureCB) {\n failureCB();\n }\n }\n };\n\n pendingRequests.push(req);\n\n try {\n req.open(\'GET\', url);\n req.onloadend = oncomplete;\n req.onerror = oncomplete;\n req.send();\n } catch (e) {\n req.onerror();\n }\n }\n\n function report(type, vos) {\n if (!Array.isArray(vos)) {\n vos = [vos];\n } // If the Player is not a reporting Player, then the Player shall\n // not report any errors.\n // ... In addition to any time restrictions specified by a Range\n // element within the Metrics element.\n\n\n if (isReportingPlayer && rangeController.isEnabled()) {\n // This reporting mechanism operates by creating one HTTP GET\n // request for every entry in the top level list of the metric.\n vos.forEach(function (vo) {\n var url = metricSerialiser.serialise(vo); // this has been proposed for errata\n\n if (type !== metricsConstants.DVB_ERRORS) {\n url = "metricname=".concat(type, "&").concat(url);\n } // Take the value of the @reportingUrl attribute, append a\n // question mark (\'?\') character and then append the string\n // created in the previous step.\n\n\n url = "".concat(reportingUrl, "?").concat(url); // Make an HTTP GET request to the URL contained within the\n // string created in the previous step.\n\n doGetRequest(url, null, function () {\n // If the Player is unable to make the report, for\n // example because the @reportingUrl is invalid, the\n // host cannot be reached, or an HTTP status code other\n // than one in the 200 series is received, the Player\n // shall cease being a reporting Player for the\n // duration of the MPD.\n isReportingPlayer = false;\n });\n });\n }\n }\n\n function initialize(entry, rc) {\n var probability;\n rangeController = rc;\n reportingUrl = entry.dvb_reportingUrl; // If a required attribute is missing, the Reporting descriptor may\n // be ignored by the Player\n\n if (!reportingUrl) {\n throw new Error(\'required parameter missing (dvb:reportingUrl)\');\n } // A Player\'s status, as a reporting Player or not, shall remain\n // static for the duration of the MPD, regardless of MPD updates.\n // (i.e. only calling reset (or failure) changes this state)\n\n\n if (!reportingPlayerStatusDecided) {\n probability = entry.dvb_probability; // TS 103 285 Clause 10.12.3.4\n // If the @probability attribute is set to 1000, it shall be a reporting Player.\n // If the @probability attribute is absent it will take the default value of 1000.\n // For any other value of the @probability attribute, it shall decide at random whether to be a\n // reporting Player, such that the probability of being one is @probability/1000.\n\n if (probability && (probability === 1000 || probability / 1000 >= randomNumberGenerator.random())) {\n isReportingPlayer = true;\n }\n\n reportingPlayerStatusDecided = true;\n }\n }\n\n function resetInitialSettings() {\n reportingPlayerStatusDecided = false;\n isReportingPlayer = false;\n reportingUrl = null;\n rangeController = null;\n }\n\n function reset() {\n\n resetInitialSettings();\n }\n\n instance = {\n report: report,\n initialize: initialize,\n reset: reset\n };\n setup();\n return instance;\n}\n\nDVBReporting.__dashjs_factory_name = \'DVBReporting\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(DVBReporting));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/utils/DVBErrorsTranslator.js":\n/*!************************************************************!*\\\n !*** ./src/streaming/metrics/utils/DVBErrorsTranslator.js ***!\n \\************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1670691__) {\n__nested_webpack_require_1670691__.r(__nested_webpack_exports__);\n/* harmony import */ var _vo_DVBErrors__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1670691__(/*! ../vo/DVBErrors */ "./src/streaming/metrics/vo/DVBErrors.js");\n/* harmony import */ var _MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1670691__(/*! ../MetricsReportingEvents */ "./src/streaming/metrics/MetricsReportingEvents.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\nfunction DVBErrorsTranslator(config) {\n config = config || {};\n var instance, mpd;\n var eventBus = config.eventBus;\n var dashMetrics = config.dashMetrics;\n var metricsConstants = config.metricsConstants; //MediaPlayerEvents have been added to Events in MediaPlayer class\n\n var Events = config.events;\n\n function report(vo) {\n var o = new _vo_DVBErrors__WEBPACK_IMPORTED_MODULE_0__["default"]();\n\n if (!mpd) {\n return;\n }\n\n for (var key in vo) {\n if (vo.hasOwnProperty(key)) {\n o[key] = vo[key];\n }\n }\n\n if (!o.mpdurl) {\n o.mpdurl = mpd.originalUrl || mpd.url;\n }\n\n if (!o.terror) {\n o.terror = new Date();\n }\n\n dashMetrics.addDVBErrors(o);\n }\n\n function onManifestUpdate(e) {\n if (e.error) {\n return;\n }\n\n mpd = e.manifest;\n }\n\n function onServiceLocationChanged(e) {\n report({\n errorcode: _vo_DVBErrors__WEBPACK_IMPORTED_MODULE_0__["default"].BASE_URL_CHANGED,\n servicelocation: e.entry\n });\n }\n\n function onBecameReporter() {\n report({\n errorcode: _vo_DVBErrors__WEBPACK_IMPORTED_MODULE_0__["default"].BECAME_REPORTER\n });\n }\n\n function handleHttpMetric(vo) {\n if (vo.responsecode === 0 || // connection failure - unknown\n vo.responsecode == null || // Generated on .catch() and when uninitialised\n vo.responsecode >= 400 || // HTTP error status code\n vo.responsecode < 100 || // unknown status codes\n vo.responsecode >= 600) {\n // unknown status codes\n report({\n errorcode: vo.responsecode || _vo_DVBErrors__WEBPACK_IMPORTED_MODULE_0__["default"].CONNECTION_ERROR,\n url: vo.url,\n terror: vo.tresponse,\n servicelocation: vo._serviceLocation\n });\n }\n }\n\n function onMetricEvent(e) {\n switch (e.metric) {\n case metricsConstants.HTTP_REQUEST:\n handleHttpMetric(e.value);\n break;\n\n default:\n break;\n }\n }\n\n function onPlaybackError(e) {\n var reason = e.error ? e.error.code : 0;\n var errorcode;\n\n switch (reason) {\n case MediaError.MEDIA_ERR_NETWORK:\n errorcode = _vo_DVBErrors__WEBPACK_IMPORTED_MODULE_0__["default"].CONNECTION_ERROR;\n break;\n\n case MediaError.MEDIA_ERR_DECODE:\n errorcode = _vo_DVBErrors__WEBPACK_IMPORTED_MODULE_0__["default"].CORRUPT_MEDIA_OTHER;\n break;\n\n default:\n return;\n }\n\n report({\n errorcode: errorcode\n });\n }\n\n function initialise() {\n eventBus.on(Events.MANIFEST_UPDATED, onManifestUpdate, instance);\n eventBus.on(Events.SERVICE_LOCATION_BLACKLIST_CHANGED, onServiceLocationChanged, instance);\n eventBus.on(Events.METRIC_ADDED, onMetricEvent, instance);\n eventBus.on(Events.METRIC_UPDATED, onMetricEvent, instance);\n eventBus.on(Events.PLAYBACK_ERROR, onPlaybackError, instance);\n eventBus.on(_MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_1__["default"].BECAME_REPORTING_PLAYER, onBecameReporter, instance);\n }\n\n function reset() {\n eventBus.off(Events.MANIFEST_UPDATED, onManifestUpdate, instance);\n eventBus.off(Events.SERVICE_LOCATION_BLACKLIST_CHANGED, onServiceLocationChanged, instance);\n eventBus.off(Events.METRIC_ADDED, onMetricEvent, instance);\n eventBus.off(Events.METRIC_UPDATED, onMetricEvent, instance);\n eventBus.off(Events.PLAYBACK_ERROR, onPlaybackError, instance);\n eventBus.off(_MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_1__["default"].BECAME_REPORTING_PLAYER, onBecameReporter, instance);\n }\n\n instance = {\n initialise: initialise,\n reset: reset\n };\n return instance;\n}\n\nDVBErrorsTranslator.__dashjs_factory_name = \'DVBErrorsTranslator\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(DVBErrorsTranslator));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/utils/HandlerHelpers.js":\n/*!*******************************************************!*\\\n !*** ./src/streaming/metrics/utils/HandlerHelpers.js ***!\n \\*******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1677059__) {\n__nested_webpack_require_1677059__.r(__nested_webpack_exports__);\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @ignore\n */\nfunction HandlerHelpers() {\n return {\n reconstructFullMetricName: function reconstructFullMetricName(key, n, type) {\n var mn = key;\n\n if (n) {\n mn += \'(\' + n;\n\n if (type && type.length) {\n mn += \',\' + type;\n }\n\n mn += \')\';\n }\n\n return mn;\n },\n validateN: function validateN(n_ms) {\n if (!n_ms) {\n throw new Error(\'missing n\');\n }\n\n if (isNaN(n_ms)) {\n throw new Error(\'n is NaN\');\n } // n is a positive integer is defined to refer to the metric\n // in which the buffer level is recorded every n ms.\n\n\n if (n_ms < 0) {\n throw new Error(\'n must be positive\');\n }\n\n return n_ms;\n }\n };\n}\n\nHandlerHelpers.__dashjs_factory_name = \'HandlerHelpers\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(HandlerHelpers));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/utils/ManifestParsing.js":\n/*!********************************************************!*\\\n !*** ./src/streaming/metrics/utils/ManifestParsing.js ***!\n \\********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1680234__) {\n__nested_webpack_require_1680234__.r(__nested_webpack_exports__);\n/* harmony import */ var _vo_Metrics__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1680234__(/*! ../vo/Metrics */ "./src/streaming/metrics/vo/Metrics.js");\n/* harmony import */ var _vo_Range__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1680234__(/*! ../vo/Range */ "./src/streaming/metrics/vo/Range.js");\n/* harmony import */ var _vo_Reporting__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1680234__(/*! ../vo/Reporting */ "./src/streaming/metrics/vo/Reporting.js");\n\n\n\n\nfunction ManifestParsing(config) {\n config = config || {};\n var instance;\n var adapter = config.adapter;\n var constants = config.constants;\n\n function getMetricsRangeStartTime(manifest, dynamic, range) {\n var voPeriods, reportingStartTime;\n var presentationStartTime = 0;\n\n if (dynamic) {\n // For services with MPD@type=\'dynamic\', the start time is\n // indicated in wall clock time by adding the value of this\n // attribute to the value of the MPD@availabilityStartTime\n // attribute.\n presentationStartTime = adapter.getAvailabilityStartTime(manifest) / 1000;\n } else {\n // For services with MPD@type=\'static\', the start time is indicated\n // in Media Presentation time and is relative to the PeriodStart\n // time of the first Period in this MPD.\n voPeriods = adapter.getRegularPeriods(manifest);\n\n if (voPeriods.length) {\n presentationStartTime = voPeriods[0].start;\n }\n } // When not present, DASH Metrics collection is\n // requested from the beginning of content\n // consumption.\n\n\n reportingStartTime = presentationStartTime;\n\n if (range && range.hasOwnProperty(constants.START_TIME)) {\n reportingStartTime += range.starttime;\n }\n\n return reportingStartTime;\n }\n\n function getMetrics(manifest) {\n var metrics = [];\n\n if (manifest && manifest.Metrics_asArray) {\n manifest.Metrics_asArray.forEach(function (metric) {\n var metricEntry = new _vo_Metrics__WEBPACK_IMPORTED_MODULE_0__["default"]();\n var isDynamic = adapter.getIsDynamic(manifest);\n\n if (metric.hasOwnProperty(\'metrics\')) {\n metricEntry.metrics = metric.metrics;\n } else {\n return;\n }\n\n if (metric.Range_asArray) {\n metric.Range_asArray.forEach(function (range) {\n var rangeEntry = new _vo_Range__WEBPACK_IMPORTED_MODULE_1__["default"]();\n rangeEntry.starttime = getMetricsRangeStartTime(manifest, isDynamic, range);\n\n if (range.hasOwnProperty(\'duration\')) {\n rangeEntry.duration = range.duration;\n } else {\n // if not present, the value is identical to the\n // Media Presentation duration.\n rangeEntry.duration = adapter.getDuration(manifest);\n }\n\n rangeEntry._useWallClockTime = isDynamic;\n metricEntry.Range.push(rangeEntry);\n });\n }\n\n if (metric.Reporting_asArray) {\n metric.Reporting_asArray.forEach(function (reporting) {\n var reportingEntry = new _vo_Reporting__WEBPACK_IMPORTED_MODULE_2__["default"]();\n\n if (reporting.hasOwnProperty(constants.SCHEME_ID_URI)) {\n reportingEntry.schemeIdUri = reporting.schemeIdUri;\n } else {\n // Invalid Reporting. schemeIdUri must be set. Ignore.\n return;\n }\n\n if (reporting.hasOwnProperty(\'value\')) {\n reportingEntry.value = reporting.value;\n }\n\n if (reporting.hasOwnProperty(constants.DVB_REPORTING_URL)) {\n reportingEntry.dvb_reportingUrl = reporting[constants.DVB_REPORTING_URL];\n }\n\n if (reporting.hasOwnProperty(constants.DVB_PROBABILITY)) {\n reportingEntry.dvb_probability = reporting[constants.DVB_PROBABILITY];\n }\n\n metricEntry.Reporting.push(reportingEntry);\n });\n } else {\n // Invalid Metrics. At least one reporting must be present. Ignore\n return;\n }\n\n metrics.push(metricEntry);\n });\n }\n\n return metrics;\n }\n\n instance = {\n getMetrics: getMetrics\n };\n return instance;\n}\n\nManifestParsing.__dashjs_factory_name = \'ManifestParsing\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(ManifestParsing));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/utils/MetricSerialiser.js":\n/*!*********************************************************!*\\\n !*** ./src/streaming/metrics/utils/MetricSerialiser.js ***!\n \\*********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1685007__) {\n__nested_webpack_require_1685007__.r(__nested_webpack_exports__);\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @ignore\n */\nfunction MetricSerialiser() {\n // For each entry in the top level list within the metric (in the case\n // of the DVBErrors metric each entry corresponds to an "error event"\n // described in clause 10.8.4) the Player shall:\n function serialise(metric) {\n var pairs = [];\n var obj = [];\n var key, value; // Take each (key, value) pair from the metric entry and create a\n // string consisting of the name of the key, followed by an equals\n // (\'=\') character, followed by the string representation of the\n // value. The string representation of the value is created based\n // on the type of the value following the instructions in Table 22.\n\n for (key in metric) {\n if (metric.hasOwnProperty(key) && key.indexOf(\'_\') !== 0) {\n value = metric[key]; // we want to ensure that keys still end up in the report\n // even if there is no value\n\n if (value === undefined || value === null) {\n value = \'\';\n } // DVB A168 10.12.4 Table 22\n\n\n if (Array.isArray(value)) {\n // if trace or similar is null, do not include in output\n if (!value.length) {\n continue;\n }\n\n obj = [];\n value.forEach(function (v) {\n var isBuiltIn = Object.prototype.toString.call(v).slice(8, -1) !== \'Object\';\n obj.push(isBuiltIn ? v : serialise(v));\n });\n value = obj.map(encodeURIComponent).join(\',\');\n } else if (typeof value === \'string\') {\n value = encodeURIComponent(value);\n } else if (value instanceof Date) {\n value = value.toISOString();\n } else if (typeof value === \'number\') {\n value = Math.round(value);\n }\n\n pairs.push(key + \'=\' + value);\n }\n } // Concatenate the strings created in the previous step with an\n // ampersand (\'&\') character between each one.\n\n\n return pairs.join(\'&\');\n }\n\n return {\n serialise: serialise\n };\n}\n\nMetricSerialiser.__dashjs_factory_name = \'MetricSerialiser\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(MetricSerialiser));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/utils/RNG.js":\n/*!********************************************!*\\\n !*** ./src/streaming/metrics/utils/RNG.js ***!\n \\********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1689378__) {\n__nested_webpack_require_1689378__.r(__nested_webpack_exports__);\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @ignore\n */\nfunction RNG() {\n // check whether secure random numbers are available. if not, revert to\n // using Math.random\n var crypto = window.crypto || window.msCrypto; // could just as easily use any other array type by changing line below\n\n var ArrayType = Uint32Array;\n var MAX_VALUE = Math.pow(2, ArrayType.BYTES_PER_ELEMENT * 8) - 1; // currently there is only one client for this code, and that only uses\n // a single random number per initialisation. may want to increase this\n // number if more consumers in the future\n\n var NUM_RANDOM_NUMBERS = 10;\n var randomNumbers, index, instance;\n\n function initialise() {\n if (crypto) {\n if (!randomNumbers) {\n randomNumbers = new ArrayType(NUM_RANDOM_NUMBERS);\n }\n\n crypto.getRandomValues(randomNumbers);\n index = 0;\n }\n }\n\n function rand(min, max) {\n var r;\n\n if (!min) {\n min = 0;\n }\n\n if (!max) {\n max = 1;\n }\n\n if (crypto) {\n if (index === randomNumbers.length) {\n initialise();\n }\n\n r = randomNumbers[index] / MAX_VALUE;\n index += 1;\n } else {\n r = Math.random();\n }\n\n return r * (max - min) + min;\n }\n\n instance = {\n random: rand\n };\n initialise();\n return instance;\n}\n\nRNG.__dashjs_factory_name = \'RNG\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(RNG));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/vo/DVBErrors.js":\n/*!***********************************************!*\\\n !*** ./src/streaming/metrics/vo/DVBErrors.js ***!\n \\***********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1693005__) {\n__nested_webpack_require_1693005__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar DVBErrors = function DVBErrors() {\n _classCallCheck(this, DVBErrors);\n\n this.mpdurl = null; // String - Absolute URL from which the MPD was originally\n // retrieved (MPD updates will not change this value).\n\n this.errorcode = null; // String - The value of errorcode depends upon the type\n // of error being reported. For an error listed in the\n // ErrorType column below the value is as described in the\n // Value column.\n //\n // ErrorType Value\n // --------- -----\n // HTTP error status code HTTP status code\n // Unknown HTTP status code HTTP status code\n // SSL connection failed "SSL" followed by SSL alert value\n // DNS resolution failed "C00"\n // Host unreachable "C01"\n // Connection refused "C02"\n // Connection error – Not otherwise specified "C03"\n // Corrupt media – ISO BMFF container cannot be parsed "M00"\n // Corrupt media – Not otherwise specified "M01"\n // Changing Base URL in use due to errors "F00"\n // Becoming an error reporting Player "S00"\n\n this.terror = null; // Real-Time - Date and time at which error occurred in UTC,\n // formatted as a combined date and time according to ISO 8601.\n\n this.url = null; // String - Absolute URL from which data was being requested\n // when this error occurred. If the error report is in relation\n // to corrupt media or changing BaseURL, this may be a null\n // string if the URL from which the media was obtained or\n // which led to the change of BaseURL is no longer known.\n\n this.ipaddress = null; // String - IP Address which the host name in "url" resolved to.\n // If the error report is in relation to corrupt media or\n // changing BaseURL, this may be a null string if the URL\n // from which the media was obtained or which led to the\n // change of BaseURL is no longer known.\n\n this.servicelocation = null; // String - The value of the serviceLocation field in the\n // BaseURL being used. In the event of this report indicating\n // a change of BaseURL this is the value from the BaseURL\n // being moved from.\n};\n\nDVBErrors.SSL_CONNECTION_FAILED_PREFIX = \'SSL\';\nDVBErrors.DNS_RESOLUTION_FAILED = \'C00\';\nDVBErrors.HOST_UNREACHABLE = \'C01\';\nDVBErrors.CONNECTION_REFUSED = \'C02\';\nDVBErrors.CONNECTION_ERROR = \'C03\';\nDVBErrors.CORRUPT_MEDIA_ISOBMFF = \'M00\';\nDVBErrors.CORRUPT_MEDIA_OTHER = \'M01\';\nDVBErrors.BASE_URL_CHANGED = \'F00\';\nDVBErrors.BECAME_REPORTER = \'S00\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (DVBErrors);\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/vo/Metrics.js":\n/*!*********************************************!*\\\n !*** ./src/streaming/metrics/vo/Metrics.js ***!\n \\*********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1698159__) {\n__nested_webpack_require_1698159__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar Metrics = function Metrics() {\n _classCallCheck(this, Metrics);\n\n this.metrics = \'\';\n this.Range = [];\n this.Reporting = [];\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (Metrics);\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/vo/Range.js":\n/*!*******************************************!*\\\n !*** ./src/streaming/metrics/vo/Range.js ***!\n \\*******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1700736__) {\n__nested_webpack_require_1700736__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar Range = function Range() {\n _classCallCheck(this, Range);\n\n // as defined in ISO23009-1\n this.starttime = 0;\n this.duration = Infinity; // for internal use\n\n this._useWallClockTime = false;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (Range);\n\n/***/ }),\n\n/***/ "./src/streaming/metrics/vo/Reporting.js":\n/*!***********************************************!*\\\n !*** ./src/streaming/metrics/vo/Reporting.js ***!\n \\***********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1703393__) {\n__nested_webpack_require_1703393__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\n// TS 103 285 Clause 10.12.3.3\nvar DEFAULT_DVB_PROBABILITY = 1000;\n\nvar Reporting = function Reporting() {\n _classCallCheck(this, Reporting);\n\n this.schemeIdUri = \'\';\n this.value = \'\'; // DVB Extensions\n\n this.dvb_reportingUrl = \'\';\n this.dvb_probability = DEFAULT_DVB_PROBABILITY;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (Reporting);\n\n/***/ }),\n\n/***/ "./src/streaming/models/BaseURLTreeModel.js":\n/*!**************************************************!*\\\n !*** ./src/streaming/models/BaseURLTreeModel.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1706154__) {\n__nested_webpack_require_1706154__.r(__nested_webpack_exports__);\n/* harmony import */ var _utils_ObjectUtils__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1706154__(/*! ../utils/ObjectUtils */ "./src/streaming/utils/ObjectUtils.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1706154__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nvar DEFAULT_INDEX = NaN;\n\nvar Node = function Node(_baseUrls, _selectedIdx) {\n _classCallCheck(this, Node);\n\n this.data = {\n baseUrls: _baseUrls || null,\n selectedIdx: _selectedIdx || DEFAULT_INDEX\n };\n this.children = [];\n};\n\nfunction BaseURLTreeModel() {\n var instance, root, adapter;\n var context = this.context;\n var objectUtils = Object(_utils_ObjectUtils__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n\n function setup() {\n reset();\n }\n\n function setConfig(config) {\n if (config.adapter) {\n adapter = config.adapter;\n }\n }\n\n function checkConfig() {\n if (!adapter || !adapter.hasOwnProperty(\'getBaseURLsFromElement\') || !adapter.hasOwnProperty(\'getRepresentationSortFunction\')) {\n throw new Error(\'setConfig function has to be called previously\');\n }\n }\n\n function updateChildData(node, index, element) {\n var baseUrls = adapter.getBaseURLsFromElement(element);\n\n if (!node[index]) {\n node[index] = new Node(baseUrls);\n } else {\n if (!objectUtils.areEqual(baseUrls, node[index].data.baseUrls)) {\n node[index].data.baseUrls = baseUrls;\n node[index].data.selectedIdx = DEFAULT_INDEX;\n }\n }\n }\n\n function getBaseURLCollectionsFromManifest(manifest) {\n checkConfig();\n var baseUrls = adapter.getBaseURLsFromElement(manifest);\n\n if (!objectUtils.areEqual(baseUrls, root.data.baseUrls)) {\n root.data.baseUrls = baseUrls;\n root.data.selectedIdx = DEFAULT_INDEX;\n }\n\n if (manifest && manifest.Period_asArray) {\n manifest.Period_asArray.forEach(function (p, pi) {\n updateChildData(root.children, pi, p);\n\n if (p.AdaptationSet_asArray) {\n p.AdaptationSet_asArray.forEach(function (a, ai) {\n updateChildData(root.children[pi].children, ai, a);\n\n if (a.Representation_asArray) {\n a.Representation_asArray.sort(adapter.getRepresentationSortFunction()).forEach(function (r, ri) {\n updateChildData(root.children[pi].children[ai].children, ri, r);\n });\n }\n });\n }\n });\n }\n }\n\n function walk(callback, node) {\n var target = node || root;\n callback(target.data);\n\n if (target.children) {\n target.children.forEach(function (child) {\n return walk(callback, child);\n });\n }\n }\n\n function invalidateSelectedIndexes(serviceLocation) {\n walk(function (data) {\n if (!isNaN(data.selectedIdx)) {\n if (serviceLocation === data.baseUrls[data.selectedIdx].serviceLocation) {\n data.selectedIdx = DEFAULT_INDEX;\n }\n }\n });\n }\n\n function update(manifest) {\n getBaseURLCollectionsFromManifest(manifest);\n }\n\n function reset() {\n root = new Node();\n }\n\n function getForPath(path) {\n var target = root;\n var nodes = [target.data];\n\n if (path) {\n path.forEach(function (p) {\n target = target.children[p];\n\n if (target) {\n nodes.push(target.data);\n }\n });\n }\n\n return nodes.filter(function (n) {\n return n.baseUrls.length;\n });\n }\n\n instance = {\n reset: reset,\n update: update,\n getForPath: getForPath,\n invalidateSelectedIndexes: invalidateSelectedIndexes,\n setConfig: setConfig\n };\n setup();\n return instance;\n}\n\nBaseURLTreeModel.__dashjs_factory_name = \'BaseURLTreeModel\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"].getClassFactory(BaseURLTreeModel));\n\n/***/ }),\n\n/***/ "./src/streaming/models/CmcdModel.js":\n/*!*******************************************!*\\\n !*** ./src/streaming/models/CmcdModel.js ***!\n \\*******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1712340__) {\n__nested_webpack_require_1712340__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1712340__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1712340__(/*! ../MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _metrics_MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1712340__(/*! ../metrics/MetricsReportingEvents */ "./src/streaming/metrics/MetricsReportingEvents.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1712340__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Settings__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1712340__(/*! ../../core/Settings */ "./src/core/Settings.js");\n/* harmony import */ var _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1712340__(/*! ../../streaming/constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1712340__(/*! ../vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _dash_models_DashManifestModel__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1712340__(/*! ../../dash/models/DashManifestModel */ "./src/dash/models/DashManifestModel.js");\n/* harmony import */ var _core_Utils__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1712340__(/*! ../../core/Utils */ "./src/core/Utils.js");\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\nvar CMCD_REQUEST_FIELD_NAME = \'CMCD\';\nvar CMCD_VERSION = 1;\nvar OBJECT_TYPES = {\n MANIFEST: \'m\',\n AUDIO: \'a\',\n VIDEO: \'v\',\n INIT: \'i\',\n CAPTION: \'c\',\n ISOBMFF_TEXT_TRACK: \'tt\',\n ENCRYPTION_KEY: \'k\',\n OTHER: \'o\'\n};\nvar STREAMING_FORMATS = {\n DASH: \'d\',\n MSS: \'s\'\n};\nvar STREAM_TYPES = {\n VOD: \'v\',\n LIVE: \'l\'\n};\nvar RTP_SAFETY_FACTOR = 5;\n\nfunction CmcdModel() {\n var dashManifestModel, instance, internalData, abrController, dashMetrics, playbackController, streamProcessors, _isStartup, _bufferLevelStarved, _initialMediaRequestsDone;\n\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n var settings = Object(_core_Settings__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n\n function setup() {\n dashManifestModel = Object(_dash_models_DashManifestModel__WEBPACK_IMPORTED_MODULE_7__["default"])(context).getInstance();\n\n _resetInitialSettings();\n }\n\n function initialize() {\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__["default"].PLAYBACK_RATE_CHANGED, _onPlaybackRateChanged, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__["default"].MANIFEST_LOADED, _onManifestLoaded, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_LEVEL_STATE_CHANGED, _onBufferLevelStateChanged, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__["default"].PLAYBACK_SEEKED, _onPlaybackSeeked, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__["default"].PERIOD_SWITCH_COMPLETED, _onPeriodSwitchComplete, instance);\n }\n\n function setConfig(config) {\n if (!config) return;\n\n if (config.abrController) {\n abrController = config.abrController;\n }\n\n if (config.dashMetrics) {\n dashMetrics = config.dashMetrics;\n }\n\n if (config.playbackController) {\n playbackController = config.playbackController;\n }\n }\n\n function _resetInitialSettings() {\n internalData = {\n pr: 1,\n nor: null,\n st: null,\n sf: null,\n sid: "".concat(_core_Utils__WEBPACK_IMPORTED_MODULE_8__["default"].generateUuid()),\n cid: null\n };\n _bufferLevelStarved = {};\n _isStartup = {};\n _initialMediaRequestsDone = {};\n\n _updateStreamProcessors();\n }\n\n function _onPeriodSwitchComplete() {\n _updateStreamProcessors();\n }\n\n function _updateStreamProcessors() {\n if (!playbackController) return;\n var streamController = playbackController.getStreamController();\n if (!streamController) return;\n if (typeof streamController.getActiveStream !== \'function\') return;\n var activeStream = streamController.getActiveStream();\n if (!activeStream) return;\n streamProcessors = activeStream.getProcessors();\n }\n\n function getQueryParameter(request) {\n try {\n if (settings.get().streaming.cmcd && settings.get().streaming.cmcd.enabled) {\n var cmcdData = _getCmcdData(request);\n\n var finalPayloadString = _buildFinalString(cmcdData);\n\n eventBus.trigger(_metrics_MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_2__["default"].CMCD_DATA_GENERATED, {\n url: request.url,\n mediaType: request.mediaType,\n cmcdData: cmcdData,\n cmcdString: finalPayloadString\n });\n return {\n key: CMCD_REQUEST_FIELD_NAME,\n value: finalPayloadString\n };\n }\n\n return null;\n } catch (e) {\n return null;\n }\n }\n\n function _copyParameters(data, parameterNames) {\n var copiedData = {};\n\n var _iterator = _createForOfIteratorHelper(parameterNames),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var name = _step.value;\n\n if (data[name]) {\n copiedData[name] = data[name];\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n return copiedData;\n }\n\n function getHeaderParameters(request) {\n try {\n if (settings.get().streaming.cmcd && settings.get().streaming.cmcd.enabled) {\n var cmcdData = _getCmcdData(request);\n\n var cmcdObjectHeader = _copyParameters(cmcdData, [\'br\', \'d\', \'ot\', \'tb\']);\n\n var cmcdRequestHeader = _copyParameters(cmcdData, [\'bl\', \'dl\', \'mtp\', \'nor\', \'nrr\', \'su\']);\n\n var cmcdStatusHeader = _copyParameters(cmcdData, [\'bs\', \'rtp\']);\n\n var cmcdSessionHeader = _copyParameters(cmcdData, [\'cid\', \'pr\', \'sf\', \'sid\', \'st\', \'v\']);\n\n var headers = {\n \'CMCD-Object\': _buildFinalString(cmcdObjectHeader),\n \'CMCD-Request\': _buildFinalString(cmcdRequestHeader),\n \'CMCD-Status\': _buildFinalString(cmcdStatusHeader),\n \'CMCD-Session\': _buildFinalString(cmcdSessionHeader)\n };\n eventBus.trigger(_metrics_MetricsReportingEvents__WEBPACK_IMPORTED_MODULE_2__["default"].CMCD_DATA_GENERATED, {\n url: request.url,\n mediaType: request.mediaType,\n cmcdData: cmcdData,\n headers: headers\n });\n return headers;\n }\n\n return null;\n } catch (e) {\n return null;\n }\n }\n\n function _getCmcdData(request) {\n try {\n var cmcdData = null;\n\n if (request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_6__["HTTPRequest"].MPD_TYPE) {\n return _getCmcdDataForMpd(request);\n } else if (request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_6__["HTTPRequest"].MEDIA_SEGMENT_TYPE) {\n _initForMediaType(request.mediaType);\n\n return _getCmcdDataForMediaSegment(request);\n } else if (request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_6__["HTTPRequest"].INIT_SEGMENT_TYPE) {\n return _getCmcdDataForInitSegment(request);\n } else if (request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_6__["HTTPRequest"].OTHER_TYPE || request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_6__["HTTPRequest"].XLINK_EXPANSION_TYPE) {\n return _getCmcdDataForOther(request);\n } else if (request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_6__["HTTPRequest"].LICENSE) {\n return _getCmcdDataForLicense(request);\n }\n\n return cmcdData;\n } catch (e) {\n return null;\n }\n }\n\n function _getCmcdDataForLicense(request) {\n var data = _getGenericCmcdData(request);\n\n data.ot = OBJECT_TYPES.ENCRYPTION_KEY;\n return data;\n }\n\n function _getCmcdDataForMpd() {\n var data = _getGenericCmcdData();\n\n data.ot = OBJECT_TYPES.MANIFEST;\n return data;\n }\n\n function _getCmcdDataForMediaSegment(request) {\n var data = _getGenericCmcdData();\n\n var encodedBitrate = _getBitrateByRequest(request);\n\n var d = _getObjectDurationByRequest(request);\n\n var mtp = _getMeasuredThroughputByType(request.mediaType);\n\n var dl = _getDeadlineByType(request.mediaType);\n\n var bl = _getBufferLevelByType(request.mediaType);\n\n var tb = _getTopBitrateByType(request.mediaType);\n\n var pr = internalData.pr;\n\n var nextRequest = _probeNextRequest(request.mediaType);\n\n var ot;\n if (request.mediaType === _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_5__["default"].VIDEO) ot = OBJECT_TYPES.VIDEO;\n if (request.mediaType === _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_5__["default"].AUDIO) ot = OBJECT_TYPES.AUDIO;\n\n if (request.mediaType === _streaming_constants_Constants__WEBPACK_IMPORTED_MODULE_5__["default"].TEXT) {\n if (request.mediaInfo.mimeType === \'application/mp4\') {\n ot = OBJECT_TYPES.ISOBMFF_TEXT_TRACK;\n } else {\n ot = OBJECT_TYPES.CAPTION;\n }\n }\n\n var rtp = settings.get().streaming.cmcd.rtp;\n\n if (!rtp) {\n rtp = _calculateRtp(request);\n }\n\n data.rtp = rtp;\n\n if (nextRequest) {\n if (request.url !== nextRequest.url) {\n data.nor = encodeURIComponent(_core_Utils__WEBPACK_IMPORTED_MODULE_8__["default"].getRelativeUrl(request.url, nextRequest.url));\n } else if (nextRequest.range) {\n data.nrr = nextRequest.range;\n }\n }\n\n if (encodedBitrate) {\n data.br = encodedBitrate;\n }\n\n if (ot) {\n data.ot = ot;\n }\n\n if (!isNaN(d)) {\n data.d = d;\n }\n\n if (!isNaN(mtp)) {\n data.mtp = mtp;\n }\n\n if (!isNaN(dl)) {\n data.dl = dl;\n }\n\n if (!isNaN(bl)) {\n data.bl = bl;\n }\n\n if (!isNaN(tb)) {\n data.tb = tb;\n }\n\n if (!isNaN(pr) && pr !== 1) {\n data.pr = pr;\n }\n\n if (_bufferLevelStarved[request.mediaType]) {\n data.bs = true;\n _bufferLevelStarved[request.mediaType] = false;\n }\n\n if (_isStartup[request.mediaType] || !_initialMediaRequestsDone[request.mediaType]) {\n data.su = true;\n _isStartup[request.mediaType] = false;\n _initialMediaRequestsDone[request.mediaType] = true;\n }\n\n return data;\n }\n\n function _initForMediaType(mediaType) {\n if (!_initialMediaRequestsDone.hasOwnProperty(mediaType)) {\n _initialMediaRequestsDone[mediaType] = false;\n }\n\n if (!_isStartup.hasOwnProperty(mediaType)) {\n _isStartup[mediaType] = false;\n }\n\n if (!_bufferLevelStarved.hasOwnProperty(mediaType)) {\n _bufferLevelStarved[mediaType] = false;\n }\n }\n\n function _getCmcdDataForInitSegment() {\n var data = _getGenericCmcdData();\n\n data.ot = OBJECT_TYPES.INIT;\n data.su = true;\n return data;\n }\n\n function _getCmcdDataForOther() {\n var data = _getGenericCmcdData();\n\n data.ot = OBJECT_TYPES.OTHER;\n return data;\n }\n\n function _getGenericCmcdData() {\n var data = {};\n var cid = settings.get().streaming.cmcd.cid ? settings.get().streaming.cmcd.cid : internalData.cid;\n data.v = CMCD_VERSION;\n data.sid = settings.get().streaming.cmcd.sid ? settings.get().streaming.cmcd.sid : internalData.sid;\n data.sid = "".concat(data.sid);\n\n if (cid) {\n data.cid = "".concat(cid);\n }\n\n if (!isNaN(internalData.pr) && internalData.pr !== 1 && internalData.pr !== null) {\n data.pr = internalData.pr;\n }\n\n if (internalData.st) {\n data.st = internalData.st;\n }\n\n if (internalData.sf) {\n data.sf = internalData.sf;\n }\n\n return data;\n }\n\n function _getBitrateByRequest(request) {\n try {\n var quality = request.quality;\n var bitrateList = request.mediaInfo.bitrateList;\n return parseInt(bitrateList[quality].bandwidth / 1000);\n } catch (e) {\n return null;\n }\n }\n\n function _getTopBitrateByType(mediaType) {\n try {\n var info = abrController.getTopBitrateInfoFor(mediaType);\n return Math.round(info.bitrate / 1000);\n } catch (e) {\n return null;\n }\n }\n\n function _getObjectDurationByRequest(request) {\n try {\n return !isNaN(request.duration) ? Math.round(request.duration * 1000) : null;\n } catch (e) {\n return null;\n }\n }\n\n function _getMeasuredThroughputByType(mediaType) {\n try {\n return parseInt(abrController.getThroughputHistory().getSafeAverageThroughput(mediaType) / 100) * 100;\n } catch (e) {\n return null;\n }\n }\n\n function _getDeadlineByType(mediaType) {\n try {\n var playbackRate = internalData.pr;\n var bufferLevel = dashMetrics.getCurrentBufferLevel(mediaType);\n\n if (!isNaN(playbackRate) && !isNaN(bufferLevel)) {\n return parseInt(bufferLevel / playbackRate * 10) * 100;\n }\n\n return null;\n } catch (e) {\n return null;\n }\n }\n\n function _getBufferLevelByType(mediaType) {\n try {\n var bufferLevel = dashMetrics.getCurrentBufferLevel(mediaType);\n\n if (!isNaN(bufferLevel)) {\n return parseInt(bufferLevel * 10) * 100;\n }\n\n return null;\n } catch (e) {\n return null;\n }\n }\n\n function _onPlaybackRateChanged(data) {\n try {\n internalData.pr = data.playbackRate;\n } catch (e) {}\n }\n\n function _onManifestLoaded(data) {\n try {\n var isDynamic = dashManifestModel.getIsDynamic(data.data);\n var st = isDynamic ? STREAM_TYPES.LIVE : STREAM_TYPES.VOD;\n var sf = data.protocol && data.protocol === \'MSS\' ? STREAMING_FORMATS.MSS : STREAMING_FORMATS.DASH;\n internalData.st = "".concat(st);\n internalData.sf = "".concat(sf);\n } catch (e) {}\n }\n\n function _onBufferLevelStateChanged(data) {\n try {\n if (data.state && data.mediaType) {\n if (data.state === _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_EMPTY) {\n if (!_bufferLevelStarved[data.mediaType]) {\n _bufferLevelStarved[data.mediaType] = true;\n }\n\n if (!_isStartup[data.mediaType]) {\n _isStartup[data.mediaType] = true;\n }\n }\n }\n } catch (e) {}\n }\n\n function _onPlaybackSeeked() {\n for (var key in _bufferLevelStarved) {\n if (_bufferLevelStarved.hasOwnProperty(key)) {\n _bufferLevelStarved[key] = true;\n }\n }\n\n for (var _key in _isStartup) {\n if (_isStartup.hasOwnProperty(_key)) {\n _isStartup[_key] = true;\n }\n }\n }\n\n function _buildFinalString(cmcdData) {\n try {\n if (!cmcdData) {\n return null;\n }\n\n var keys = Object.keys(cmcdData).sort(function (a, b) {\n return a.localeCompare(b);\n });\n var length = keys.length;\n var cmcdString = keys.reduce(function (acc, key, index) {\n if (key === \'v\' && cmcdData[key] === 1) return acc; // Version key should only be reported if it is != 1\n\n if (typeof cmcdData[key] === \'string\' && key !== \'ot\' && key !== \'sf\' && key !== \'st\') {\n var string = cmcdData[key].replace(/"/g, \'\\"\');\n acc += "".concat(key, "=\\"").concat(string, "\\"");\n } else {\n acc += "".concat(key, "=").concat(cmcdData[key]);\n }\n\n if (index < length - 1) {\n acc += \',\';\n }\n\n return acc;\n }, \'\');\n cmcdString = cmcdString.replace(/=true/g, \'\'); // Remove last comma at the end\n\n cmcdString = cmcdString.replace(/,\\s*$/, \'\');\n return cmcdString;\n } catch (e) {\n return null;\n }\n }\n\n function _probeNextRequest(mediaType) {\n if (!streamProcessors || streamProcessors.length === 0) return;\n\n var _iterator2 = _createForOfIteratorHelper(streamProcessors),\n _step2;\n\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var streamProcessor = _step2.value;\n\n if (streamProcessor.getType() === mediaType) {\n return streamProcessor.probeNextRequest();\n }\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n\n function _calculateRtp(request) {\n // Get the values we need\n var playbackRate = playbackController.getPlaybackRate();\n if (!playbackRate) playbackRate = 1;\n var quality = request.quality,\n mediaType = request.mediaType,\n mediaInfo = request.mediaInfo,\n duration = request.duration;\n\n var currentBufferLevel = _getBufferLevelByType(mediaType);\n\n if (currentBufferLevel === 0) currentBufferLevel = 500;\n var bitrate = mediaInfo.bitrateList[quality].bandwidth; // Calculate RTP\n\n var segmentSize = bitrate * duration / 1000; // Calculate file size in kilobits\n\n var timeToLoad = currentBufferLevel / playbackRate / 1000; // Calculate time available to load file in seconds\n\n var minBandwidth = segmentSize / timeToLoad; // Calculate the exact bandwidth required\n\n var rtpSafetyFactor = settings.get().streaming.cmcd.rtpSafetyFactor && !isNaN(settings.get().streaming.cmcd.rtpSafetyFactor) ? settings.get().streaming.cmcd.rtpSafetyFactor : RTP_SAFETY_FACTOR;\n var maxBandwidth = minBandwidth * rtpSafetyFactor; // Include a safety buffer\n\n var rtp = (parseInt(maxBandwidth / 100) + 1) * 100; // Round to the next multiple of 100\n\n return rtp;\n }\n\n function reset() {\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__["default"].PLAYBACK_RATE_CHANGED, _onPlaybackRateChanged, this);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__["default"].MANIFEST_LOADED, _onManifestLoaded, this);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_LEVEL_STATE_CHANGED, _onBufferLevelStateChanged, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_1__["default"].PLAYBACK_SEEKED, _onPlaybackSeeked, instance);\n\n _resetInitialSettings();\n }\n\n instance = {\n getQueryParameter: getQueryParameter,\n getHeaderParameters: getHeaderParameters,\n setConfig: setConfig,\n reset: reset,\n initialize: initialize\n };\n setup();\n return instance;\n}\n\nCmcdModel.__dashjs_factory_name = \'CmcdModel\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_3__["default"].getSingletonFactory(CmcdModel));\n\n/***/ }),\n\n/***/ "./src/streaming/models/FragmentModel.js":\n/*!***********************************************!*\\\n !*** ./src/streaming/models/FragmentModel.js ***!\n \\***********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1734439__) {\n__nested_webpack_require_1734439__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1734439__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _vo_FragmentRequest__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1734439__(/*! ../vo/FragmentRequest */ "./src/streaming/vo/FragmentRequest.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nvar FRAGMENT_MODEL_LOADING = \'loading\';\nvar FRAGMENT_MODEL_EXECUTED = \'executed\';\nvar FRAGMENT_MODEL_CANCELED = \'canceled\';\nvar FRAGMENT_MODEL_FAILED = \'failed\';\n\nfunction FragmentModel(config) {\n config = config || {};\n var eventBus = config.eventBus;\n var events = config.events;\n var dashMetrics = config.dashMetrics;\n var fragmentLoader = config.fragmentLoader;\n var debug = config.debug;\n var streamInfo = config.streamInfo;\n var type = config.type;\n var instance, logger, executedRequests, loadingRequests;\n\n function setup() {\n logger = debug.getLogger(instance);\n resetInitialSettings();\n eventBus.on(events.LOADING_COMPLETED, onLoadingCompleted, instance);\n eventBus.on(events.LOADING_DATA_PROGRESS, onLoadingInProgress, instance);\n eventBus.on(events.LOADING_ABANDONED, onLoadingAborted, instance);\n }\n\n function getStreamId() {\n return streamInfo.id;\n }\n\n function getType() {\n return type;\n }\n\n function isFragmentLoaded(request) {\n var isEqualComplete = function isEqualComplete(req1, req2) {\n return req1.action === _vo_FragmentRequest__WEBPACK_IMPORTED_MODULE_1__["default"].ACTION_COMPLETE && req1.action === req2.action;\n };\n\n var isEqualMedia = function isEqualMedia(req1, req2) {\n return !isNaN(req1.index) && req1.startTime === req2.startTime && req1.adaptationIndex === req2.adaptationIndex && req1.type === req2.type;\n };\n\n var isEqualInit = function isEqualInit(req1, req2) {\n return isNaN(req1.index) && isNaN(req2.index) && req1.quality === req2.quality;\n };\n\n var check = function check(requests) {\n var isLoaded = false;\n requests.some(function (req) {\n if (isEqualMedia(request, req) || isEqualInit(request, req) || isEqualComplete(request, req)) {\n isLoaded = true;\n return isLoaded;\n }\n });\n return isLoaded;\n };\n\n if (!request) {\n return false;\n }\n\n return check(executedRequests);\n }\n\n function isFragmentLoadedOrPending(request) {\n var isLoaded = false;\n var i = 0;\n var req; // First, check if the fragment has already been loaded\n\n isLoaded = isFragmentLoaded(request); // Then, check if the fragment is about to be loeaded\n\n if (!isLoaded) {\n for (i = 0; i < loadingRequests.length; i++) {\n req = loadingRequests[i];\n\n if (request.url === req.url && request.startTime === req.startTime) {\n isLoaded = true;\n }\n }\n }\n\n return isLoaded;\n }\n /**\n *\n * Gets an array of {@link FragmentRequest} objects\n *\n * @param {Object} filter The object with properties by which the method filters the requests to be returned.\n * the only mandatory property is state, which must be a value from\n * other properties should match the properties of {@link FragmentRequest}. E.g.:\n * getRequests({state: FragmentModel.FRAGMENT_MODEL_EXECUTED, quality: 0}) - returns\n * all the requests from executedRequests array where requests.quality = filter.quality\n *\n * @returns {Array}\n * @memberof FragmentModel#\n */\n\n\n function getRequests(filter) {\n var states = filter ? filter.state instanceof Array ? filter.state : [filter.state] : [];\n var filteredRequests = [];\n states.forEach(function (state) {\n var requests = getRequestsForState(state);\n filteredRequests = filteredRequests.concat(filterRequests(requests, filter));\n });\n return filteredRequests;\n }\n\n function getRequestThreshold(req) {\n return isNaN(req.duration) ? 0.25 : Math.min(req.duration / 8, 0.5);\n }\n\n function removeExecutedRequestsBeforeTime(time) {\n executedRequests = executedRequests.filter(function (req) {\n var threshold = getRequestThreshold(req);\n return isNaN(req.startTime) || (time !== undefined ? req.startTime >= time - threshold : false);\n });\n }\n\n function removeExecutedRequestsAfterTime(time) {\n executedRequests = executedRequests.filter(function (req) {\n return isNaN(req.startTime) || (time !== undefined ? req.startTime < time : false);\n });\n }\n\n function removeExecutedRequestsInTimeRange(start, end) {\n if (end <= start + 0.5) {\n return;\n }\n\n executedRequests = executedRequests.filter(function (req) {\n var threshold = getRequestThreshold(req);\n return isNaN(req.startTime) || req.startTime >= end - threshold || isNaN(req.duration) || req.startTime + req.duration <= start + threshold;\n });\n } // Remove requests that are not "represented" by any of buffered ranges\n\n\n function syncExecutedRequestsWithBufferedRange(bufferedRanges, streamDuration) {\n if (!bufferedRanges || bufferedRanges.length === 0) {\n removeExecutedRequestsBeforeTime();\n return;\n }\n\n var start = 0;\n\n for (var i = 0, ln = bufferedRanges.length; i < ln; i++) {\n removeExecutedRequestsInTimeRange(start, bufferedRanges.start(i));\n start = bufferedRanges.end(i);\n }\n\n if (streamDuration > 0) {\n removeExecutedRequestsInTimeRange(start, streamDuration);\n }\n }\n\n function abortRequests() {\n logger.debug(\'abort requests\');\n fragmentLoader.abort();\n loadingRequests = [];\n }\n\n function executeRequest(request) {\n switch (request.action) {\n case _vo_FragmentRequest__WEBPACK_IMPORTED_MODULE_1__["default"].ACTION_DOWNLOAD:\n addSchedulingInfoMetrics(request, FRAGMENT_MODEL_LOADING);\n loadingRequests.push(request);\n loadCurrentFragment(request);\n break;\n\n default:\n logger.warn(\'Unknown request action.\');\n }\n }\n\n function loadCurrentFragment(request) {\n eventBus.trigger(events.FRAGMENT_LOADING_STARTED, {\n request: request\n }, {\n streamId: streamInfo.id,\n mediaType: type\n });\n fragmentLoader.load(request);\n }\n\n function getRequestForTime(arr, time, threshold) {\n // loop through the executed requests and pick the one for which the playback interval matches the given time\n var lastIdx = arr.length - 1;\n\n for (var i = lastIdx; i >= 0; i--) {\n var req = arr[i];\n var start = req.startTime;\n var end = start + req.duration;\n threshold = !isNaN(threshold) ? threshold : getRequestThreshold(req);\n\n if (!isNaN(start) && !isNaN(end) && time + threshold >= start && time - threshold < end || isNaN(start) && isNaN(time)) {\n return req;\n }\n }\n\n return null;\n }\n\n function filterRequests(arr, filter) {\n // for time use a specific filtration function\n if (filter.hasOwnProperty(\'time\')) {\n return [getRequestForTime(arr, filter.time, filter.threshold)];\n }\n\n return arr.filter(function (request) {\n for (var prop in filter) {\n if (prop === \'state\') continue;\n if (filter.hasOwnProperty(prop) && request[prop] != filter[prop]) return false;\n }\n\n return true;\n });\n }\n\n function getRequestsForState(state) {\n var requests;\n\n switch (state) {\n case FRAGMENT_MODEL_LOADING:\n requests = loadingRequests;\n break;\n\n case FRAGMENT_MODEL_EXECUTED:\n requests = executedRequests;\n break;\n\n default:\n requests = [];\n }\n\n return requests;\n }\n\n function addSchedulingInfoMetrics(request, state) {\n dashMetrics.addSchedulingInfo(request, state);\n dashMetrics.addRequestsQueue(request.mediaType, loadingRequests, executedRequests);\n }\n\n function onLoadingCompleted(e) {\n if (e.sender !== fragmentLoader) return;\n loadingRequests.splice(loadingRequests.indexOf(e.request), 1);\n\n if (e.response && !e.error) {\n executedRequests.push(e.request);\n }\n\n addSchedulingInfoMetrics(e.request, e.error ? FRAGMENT_MODEL_FAILED : FRAGMENT_MODEL_EXECUTED);\n eventBus.trigger(events.FRAGMENT_LOADING_COMPLETED, {\n request: e.request,\n response: e.response,\n error: e.error,\n sender: this\n }, {\n streamId: streamInfo.id,\n mediaType: type\n });\n }\n\n function onLoadingInProgress(e) {\n if (e.sender !== fragmentLoader) return;\n eventBus.trigger(events.FRAGMENT_LOADING_PROGRESS, {\n request: e.request,\n response: e.response,\n error: e.error,\n sender: this\n }, {\n streamId: streamInfo.id,\n mediaType: type\n });\n }\n\n function onLoadingAborted(e) {\n if (e.sender !== fragmentLoader) return;\n eventBus.trigger(events.FRAGMENT_LOADING_ABANDONED, {\n request: e.request\n }, {\n streamId: streamInfo.id,\n mediaType: type\n });\n }\n\n function resetInitialSettings() {\n executedRequests = [];\n loadingRequests = [];\n }\n\n function reset() {\n eventBus.off(events.LOADING_COMPLETED, onLoadingCompleted, this);\n eventBus.off(events.LOADING_DATA_PROGRESS, onLoadingInProgress, this);\n eventBus.off(events.LOADING_ABANDONED, onLoadingAborted, this);\n\n if (fragmentLoader) {\n fragmentLoader.reset();\n }\n\n resetInitialSettings();\n }\n\n function addExecutedRequest(request) {\n executedRequests.push(request);\n }\n\n instance = {\n getStreamId: getStreamId,\n getType: getType,\n getRequests: getRequests,\n isFragmentLoaded: isFragmentLoaded,\n isFragmentLoadedOrPending: isFragmentLoadedOrPending,\n removeExecutedRequestsBeforeTime: removeExecutedRequestsBeforeTime,\n removeExecutedRequestsAfterTime: removeExecutedRequestsAfterTime,\n syncExecutedRequestsWithBufferedRange: syncExecutedRequestsWithBufferedRange,\n abortRequests: abortRequests,\n executeRequest: executeRequest,\n reset: reset,\n resetInitialSettings: resetInitialSettings,\n addExecutedRequest: addExecutedRequest\n };\n setup();\n return instance;\n}\n\nFragmentModel.__dashjs_factory_name = \'FragmentModel\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(FragmentModel);\nfactory.FRAGMENT_MODEL_LOADING = FRAGMENT_MODEL_LOADING;\nfactory.FRAGMENT_MODEL_EXECUTED = FRAGMENT_MODEL_EXECUTED;\nfactory.FRAGMENT_MODEL_CANCELED = FRAGMENT_MODEL_CANCELED;\nfactory.FRAGMENT_MODEL_FAILED = FRAGMENT_MODEL_FAILED;\n_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].updateClassFactory(FragmentModel.__dashjs_factory_name, factory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/models/LowLatencyThroughputModel.js":\n/*!***********************************************************!*\\\n !*** ./src/streaming/models/LowLatencyThroughputModel.js ***!\n \\***********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1747177__) {\n__nested_webpack_require_1747177__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1747177__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1747177__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\nfunction LowLatencyThroughputModel() {\n var LLTM_MAX_MEASUREMENTS = 10; // factor (<1) is used to reduce the real needed download time when at very bleeding live edge\n\n var LLTM_SEMI_OPTIMISTIC_ESTIMATE_FACTOR = 0.8;\n var LLTM_OPTIMISTIC_ESTIMATE_FACTOR = 0.6;\n var LLTM_SLOW_SEGMENT_DOWNLOAD_TOLERANCE = 1.05;\n var LLTM_MAX_DELAY_MS = 250;\n var context = this.context;\n var instance;\n var logger;\n var measurements = {};\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance().getLogger(instance);\n }\n /**\n * Linear regression with least squares method to get a trend function for buffer lavel at chunk receive timestamps\n * @param {*} chunkMeasurements\n * @returns linear trend function\n */\n\n\n function createBufferLevelTrendFunction(chunkMeasurements) {\n var result = {};\n var sumX = 0;\n var sumY = 0;\n var sumXY = 0;\n var sumXSq = 0;\n var N = chunkMeasurements.length;\n\n for (var i = 0; i < N; ++i) {\n sumX += chunkMeasurements[i].chunkDownloadTimeRelativeMS;\n sumY += chunkMeasurements[i].bufferLevel;\n sumXY += chunkMeasurements[i].chunkDownloadTimeRelativeMS * chunkMeasurements[i].bufferLevel;\n sumXSq += chunkMeasurements[i].chunkDownloadTimeRelativeMS * chunkMeasurements[i].chunkDownloadTimeRelativeMS;\n }\n\n result.m = (sumXY - sumX * sumY / N) / (sumXSq - sumX * sumX / N);\n result.b = sumY / N - result.m * sumX / N;\n return function (x) {\n return result.m * x + result.b;\n };\n }\n\n function isBufferSafeAndStable(lastMeasurements) {\n var isBufferSafeAndStable = true;\n var lastBitrate;\n var aveBufferLevelLastSegements = lastMeasurements.reduce(function (prev, curr) {\n return prev + curr.bufferLevelAtSegmentEnd;\n }, 0) / lastMeasurements.length;\n lastMeasurements.forEach(function (m) {\n // inner segment buffer stability\n if (Math.abs(m.bufferLevelAtSegmentEnd / m.bufferLevelAtSegmentStart) < 0.95) {\n isBufferSafeAndStable = false;\n } // inter segment buffer stability\n\n\n if (m.bufferLevelAtSegmentEnd / aveBufferLevelLastSegements < 0.8) {\n isBufferSafeAndStable = false;\n } // representation bitrate remained at least constant\n\n\n if (!lastBitrate) {\n lastBitrate = m.bitrate;\n } else if (lastBitrate > m.bitrate) {\n isBufferSafeAndStable = false;\n }\n });\n return isBufferSafeAndStable;\n }\n /**\n * Based on the MPD, timing and buffer information of the last recent segments and their chunks\n * the most stable download time (in milliseconds) is calculated.\n * @param {*} request HTTPLoader request object\n * @returns download time in milliseconds of last fetched segment\n */\n\n\n function getEstimatedDownloadDurationMS(request) {\n var lastMeasurement = measurements[request.mediaType].slice(-1).pop();\n var lastThreeMeasurements = measurements[request.mediaType].slice(-3); // calculate and remember the buffer level trend during the last fetched segment\n\n var lastChunkRelativeTimeMS = lastMeasurement.chunkMeasurements.slice(-1).pop().chunkDownloadTimeRelativeMS;\n lastMeasurement.bufferLevelAtSegmentStart = lastMeasurement.getEstimatedBufferLevel(lastChunkRelativeTimeMS / 2);\n lastMeasurement.bufferLevelAtSegmentEnd = lastMeasurement.getEstimatedBufferLevel(lastChunkRelativeTimeMS);\n var isBufferStable = isBufferSafeAndStable(lastThreeMeasurements);\n var selectedOptimisticFactor = isBufferStable ? LLTM_OPTIMISTIC_ESTIMATE_FACTOR : LLTM_SEMI_OPTIMISTIC_ESTIMATE_FACTOR; // fetch duration was longer than segment duration, but buffer was stable\n\n if (lastMeasurement.isBufferStable && lastMeasurement.segDurationMS * LLTM_SLOW_SEGMENT_DOWNLOAD_TOLERANCE < lastMeasurement.fetchDownloadDurationMS) {\n return lastMeasurement.fetchDownloadDurationMS;\n } // buffer is drying or fetch took too long\n\n\n if (!isBufferStable || lastMeasurement.segDurationMS < lastMeasurement.fetchDownloadDurationMS) {\n return lastMeasurement.fetchDownloadDurationMS * LLTM_SEMI_OPTIMISTIC_ESTIMATE_FACTOR;\n } // did we requested a fully available segment? -> most accurate throughput calculation\n // we use adjusted availability start time to decide\n // Note: this "download mode" usually happens at startup and if requests are delayed artificially\n\n\n if (lastMeasurement.adjustedAvailabilityStartTimeMS <= lastMeasurement.requestTimeMS + lastMeasurement.throughputCapacityDelayMS - lastMeasurement.segDurationMS) {\n return lastMeasurement.fetchDownloadDurationMS * LLTM_SEMI_OPTIMISTIC_ESTIMATE_FACTOR;\n } // get all chunks that have been downloaded before fetch reached bleeding live edge\n // the remaining chunks loaded at production rate we will approximated\n\n\n var chunkAvailablePeriod = lastMeasurement.requestTimeMS + lastMeasurement.throughputCapacityDelayMS - lastMeasurement.adjustedAvailabilityStartTimeMS;\n var chunkBytesBBLE = 0; // BBLE -> Before bleeding live edge\n\n var chunkDownloadtimeMSBBLE = 0;\n var chunkCount = 0;\n\n for (var index = 0; index < lastMeasurement.chunkMeasurements.length; index++) {\n var chunk = lastMeasurement.chunkMeasurements[index];\n\n if (chunkAvailablePeriod < chunkDownloadtimeMSBBLE + chunk.chunkDownloadDurationMS) {\n break;\n }\n\n chunkDownloadtimeMSBBLE += chunk.chunkDownloadDurationMS;\n chunkBytesBBLE += chunk.chunkBytes;\n chunkCount++;\n }\n\n if (chunkAvailablePeriod < 0) {\n logger.warn(\'request time was before adjusted availibitly start time\');\n } // there have to be some chunks available (20% of max count)\n // otherwise we are at bleeding live edge and the few chunks are insufficient to estimate correctly\n\n\n if (chunkBytesBBLE && chunkDownloadtimeMSBBLE && chunkCount > lastMeasurement.chunkMeasurements.length * 0.2) {\n var downloadThroughput = chunkBytesBBLE / chunkDownloadtimeMSBBLE; // bytes per millesecond\n\n var estimatedDownloadtimeMS = lastMeasurement.segmentBytes / downloadThroughput; // if real download was shorter then report this incl. semi optimistical estimate factor\n\n if (lastMeasurement.fetchDownloadDurationMS < estimatedDownloadtimeMS) {\n return lastMeasurement.fetchDownloadDurationMS * selectedOptimisticFactor;\n }\n\n return estimatedDownloadtimeMS * selectedOptimisticFactor;\n } // when we are to tight at live edge and it\'s stable then\n // we start to optimistically estimate download time\n // in such a way that a switch to next rep will be possible\n // optimistical estimate: assume download was fast enough for next higher rendition\n\n\n var nextHigherBitrate = lastMeasurement.bitrate;\n lastMeasurement.bitrateList.some(function (b) {\n if (b.bandwidth > lastMeasurement.bitrate) {\n nextHigherBitrate = b.bandwidth;\n return true;\n }\n }); // already highest bitrate?\n\n if (nextHigherBitrate === lastMeasurement.bitrate) {\n return lastMeasurement.fetchDownloadDurationMS * selectedOptimisticFactor;\n }\n\n return selectedOptimisticFactor * lastMeasurement.segmentBytes * 8 * 1000 / nextHigherBitrate;\n }\n /**\n * Get calculated value for a safe artificial delay of the next request to allow to accumulate some chunks.\n * This allows better line throughput measurement.\n * @param {*} request\n * @param {*} currentBufferLevel current buffer level in milliseconds\n * @returns delay in milliseconds\n */\n\n\n function getThroughputCapacityDelayMS(request, currentBufferLevelMS) {\n var lastThreeMeasurements = measurements[request.mediaType] && measurements[request.mediaType].slice(-3);\n\n if (!lastThreeMeasurements || lastThreeMeasurements.length < 3) {\n return 0;\n } // in case not stable buffer, no artificially delay for the next request\n\n\n if (!isBufferSafeAndStable(lastThreeMeasurements)) {\n return 0;\n } // allowed artificial delay is the min of quater of buffer level in milliseconds and LLTM_MAX_DELAY_MS\n\n\n return currentBufferLevelMS / 4 > LLTM_MAX_DELAY_MS ? LLTM_MAX_DELAY_MS : currentBufferLevelMS / 4;\n }\n /**\n * Add some measurement data for bookkeeping and being able to derive decisions on estimated throughput.\n * @param {*} request HTTPLoader object to get MPD and media info from\n * @param {*} fetchDownloadDurationMS Duration how long the fetch actually took\n * @param {*} chunkMeasurements Array containing chunk timings and buffer levels\n * @param {*} requestTimeMS Timestamp at which the fetch was initiated\n * @param {*} throughputCapacityDelayMS An artificial delay that was used for this request\n */\n\n\n function addMeasurement(request, fetchDownloadDurationMS, chunkMeasurements, requestTimeMS, throughputCapacityDelayMS) {\n if (request && request.mediaType && !measurements[request.mediaType]) {\n measurements[request.mediaType] = [];\n }\n\n var bitrateEntry = request.mediaInfo.bitrateList.find(function (item) {\n return item.id === request.representationId;\n });\n measurements[request.mediaType].push({\n index: request.index,\n repId: request.representationId,\n mediaType: request.mediaType,\n requestTimeMS: requestTimeMS,\n adjustedAvailabilityStartTimeMS: request.availabilityStartTime.getTime(),\n segDurationMS: request.duration * 1000,\n chunksDurationMS: chunkMeasurements.reduce(function (prev, curr) {\n return prev + curr.chunkDownloadDurationMS;\n }, 0),\n segmentBytes: chunkMeasurements.reduce(function (prev, curr) {\n return prev + curr.chunkBytes;\n }, 0),\n bitrate: bitrateEntry && bitrateEntry.bandwidth,\n bitrateList: request.mediaInfo.bitrateList,\n chunkMeasurements: chunkMeasurements,\n fetchDownloadDurationMS: fetchDownloadDurationMS,\n throughputCapacityDelayMS: throughputCapacityDelayMS,\n getEstimatedBufferLevel: createBufferLevelTrendFunction(chunkMeasurements.slice(1)) // don\'t use first chunk\'s buffer level\n\n }); // maintain only a maximum amount of most recent measurements\n\n if (measurements[request.mediaType].length > LLTM_MAX_MEASUREMENTS) {\n measurements[request.mediaType].shift();\n }\n }\n\n instance = {\n setup: setup,\n addMeasurement: addMeasurement,\n getThroughputCapacityDelayMS: getThroughputCapacityDelayMS,\n getEstimatedDownloadDurationMS: getEstimatedDownloadDurationMS\n };\n setup();\n return instance;\n}\n\nLowLatencyThroughputModel.__dashjs_factory_name = \'LowLatencyThroughputModel\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"].getSingletonFactory(LowLatencyThroughputModel));\n\n/***/ }),\n\n/***/ "./src/streaming/models/ManifestModel.js":\n/*!***********************************************!*\\\n !*** ./src/streaming/models/ManifestModel.js ***!\n \\***********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1760350__) {\n__nested_webpack_require_1760350__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1760350__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1760350__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1760350__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\nfunction ManifestModel() {\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n var instance, manifest;\n\n function getValue() {\n return manifest;\n }\n\n function setValue(value) {\n manifest = value;\n\n if (value) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].MANIFEST_LOADED, {\n data: value\n });\n }\n }\n\n instance = {\n getValue: getValue,\n setValue: setValue\n };\n return instance;\n}\n\nManifestModel.__dashjs_factory_name = \'ManifestModel\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getSingletonFactory(ManifestModel));\n\n/***/ }),\n\n/***/ "./src/streaming/models/MediaPlayerModel.js":\n/*!**************************************************!*\\\n !*** ./src/streaming/models/MediaPlayerModel.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1763779__) {\n__nested_webpack_require_1763779__.r(__nested_webpack_exports__);\n/* harmony import */ var _dash_vo_UTCTiming__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1763779__(/*! ../../dash/vo/UTCTiming */ "./src/dash/vo/UTCTiming.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1763779__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1763779__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _rules_abr_ABRRulesCollection__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1763779__(/*! ../rules/abr/ABRRulesCollection */ "./src/streaming/rules/abr/ABRRulesCollection.js");\n/* harmony import */ var _core_Settings__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1763779__(/*! ../../core/Settings */ "./src/core/Settings.js");\n/* harmony import */ var _utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1763779__(/*! ../utils/SupervisorTools */ "./src/streaming/utils/SupervisorTools.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\nvar DEFAULT_MIN_BUFFER_TIME = 12;\nvar DEFAULT_MIN_BUFFER_TIME_FAST_SWITCH = 20;\nvar DEFAULT_LOW_LATENCY_LIVE_DELAY = 3.0;\nvar LOW_LATENCY_REDUCTION_FACTOR = 10;\nvar LOW_LATENCY_MULTIPLY_FACTOR = 5;\nvar DEFAULT_LIVE_LATENCY_CATCHUP_THRESHOLD_FACTOR = 4;\nvar MINIMUM_LIVE_LATENCY_CATCHUP = 5;\nvar DEFAULT_XHR_WITH_CREDENTIALS = false;\n\nfunction MediaPlayerModel() {\n var instance, UTCTimingSources, xhrWithCredentials, customABRRule;\n var context = this.context;\n var settings = Object(_core_Settings__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n\n function setup() {\n UTCTimingSources = [];\n xhrWithCredentials = {\n "default": DEFAULT_XHR_WITH_CREDENTIALS\n };\n customABRRule = [];\n } //TODO Should we use Object.define to have setters/getters? makes more readable code on other side.\n\n\n function findABRCustomRuleIndex(rulename) {\n var i;\n\n for (i = 0; i < customABRRule.length; i++) {\n if (customABRRule[i].rulename === rulename) {\n return i;\n }\n }\n\n return -1;\n }\n\n function getABRCustomRules() {\n return customABRRule;\n }\n\n function addABRCustomRule(type, rulename, rule) {\n if (typeof type !== \'string\' || type !== _rules_abr_ABRRulesCollection__WEBPACK_IMPORTED_MODULE_3__["default"].ABANDON_FRAGMENT_RULES && type !== _rules_abr_ABRRulesCollection__WEBPACK_IMPORTED_MODULE_3__["default"].QUALITY_SWITCH_RULES || typeof rulename !== \'string\') {\n throw _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].BAD_ARGUMENT_ERROR;\n }\n\n var index = findABRCustomRuleIndex(rulename);\n\n if (index === -1) {\n // add rule\n customABRRule.push({\n type: type,\n rulename: rulename,\n rule: rule\n });\n } else {\n // update rule\n customABRRule[index].type = type;\n customABRRule[index].rule = rule;\n }\n }\n\n function removeABRCustomRule(rulename) {\n if (rulename) {\n var index = findABRCustomRuleIndex(rulename); //if no rulename custom rule has been found, do nothing\n\n if (index !== -1) {\n // remove rule\n customABRRule.splice(index, 1);\n }\n } else {\n //if no rulename is defined, remove all ABR custome rules\n customABRRule = [];\n }\n }\n\n function getInitialBufferLevel() {\n var initialBufferLevel = settings.get().streaming.buffer.initialBufferLevel;\n\n if (isNaN(initialBufferLevel) || initialBufferLevel < 0) {\n return 0;\n }\n\n return Math.min(getStableBufferTime(), initialBufferLevel);\n }\n\n function getStableBufferTime() {\n if (settings.get().streaming.lowLatencyEnabled) {\n return getLiveDelay();\n }\n\n var stableBufferTime = settings.get().streaming.buffer.stableBufferTime;\n return stableBufferTime > 0 ? stableBufferTime : settings.get().streaming.buffer.fastSwitchEnabled ? DEFAULT_MIN_BUFFER_TIME_FAST_SWITCH : DEFAULT_MIN_BUFFER_TIME;\n }\n\n function getRetryAttemptsForType(type) {\n var lowLatencyMultiplyFactor = !isNaN(settings.get().streaming.retryAttempts.lowLatencyMultiplyFactor) ? settings.get().streaming.retryAttempts.lowLatencyMultiplyFactor : LOW_LATENCY_MULTIPLY_FACTOR;\n return settings.get().streaming.lowLatencyEnabled ? settings.get().streaming.retryAttempts[type] * lowLatencyMultiplyFactor : settings.get().streaming.retryAttempts[type];\n }\n\n function getRetryIntervalsForType(type) {\n var lowLatencyReductionFactor = !isNaN(settings.get().streaming.retryIntervals.lowLatencyReductionFactor) ? settings.get().streaming.retryIntervals.lowLatencyReductionFactor : LOW_LATENCY_REDUCTION_FACTOR;\n return settings.get().streaming.lowLatencyEnabled ? settings.get().streaming.retryIntervals[type] / lowLatencyReductionFactor : settings.get().streaming.retryIntervals[type];\n }\n\n function getLiveDelay() {\n if (settings.get().streaming.lowLatencyEnabled) {\n return settings.get().streaming.delay.liveDelay || DEFAULT_LOW_LATENCY_LIVE_DELAY;\n }\n\n return settings.get().streaming.delay.liveDelay;\n }\n\n function getLiveCatchupLatencyThreshold() {\n try {\n var liveCatchupLatencyThreshold = settings.get().streaming.liveCatchup.latencyThreshold;\n var liveDelay = getLiveDelay();\n\n if (liveCatchupLatencyThreshold !== null && !isNaN(liveCatchupLatencyThreshold)) {\n return Math.max(liveCatchupLatencyThreshold, liveDelay);\n }\n\n var liveCatchupMinDrift = settings.get().streaming.liveCatchup.minDrift;\n var maximumLiveDelay = !isNaN(liveDelay) && liveDelay ? !isNaN(liveCatchupMinDrift) ? settings.get().streaming.liveCatchup.minDrift + getLiveDelay() : getLiveDelay() : NaN;\n\n if (maximumLiveDelay && !isNaN(maximumLiveDelay)) {\n return Math.max(maximumLiveDelay * DEFAULT_LIVE_LATENCY_CATCHUP_THRESHOLD_FACTOR, MINIMUM_LIVE_LATENCY_CATCHUP);\n }\n\n return NaN;\n } catch (e) {\n return NaN;\n }\n }\n\n function addUTCTimingSource(schemeIdUri, value) {\n removeUTCTimingSource(schemeIdUri, value); //check if it already exists and remove if so.\n\n var vo = new _dash_vo_UTCTiming__WEBPACK_IMPORTED_MODULE_0__["default"]();\n vo.schemeIdUri = schemeIdUri;\n vo.value = value;\n UTCTimingSources.push(vo);\n }\n\n function getUTCTimingSources() {\n return UTCTimingSources;\n }\n\n function removeUTCTimingSource(schemeIdUri, value) {\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_5__["checkParameterType"])(schemeIdUri, \'string\');\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_5__["checkParameterType"])(value, \'string\');\n UTCTimingSources.forEach(function (obj, idx) {\n if (obj.schemeIdUri === schemeIdUri && obj.value === value) {\n UTCTimingSources.splice(idx, 1);\n }\n });\n }\n\n function clearDefaultUTCTimingSources() {\n UTCTimingSources = [];\n }\n\n function restoreDefaultUTCTimingSources() {\n var defaultUtcTimingSource = settings.get().streaming.utcSynchronization.defaultTimingSource;\n addUTCTimingSource(defaultUtcTimingSource.scheme, defaultUtcTimingSource.value);\n }\n\n function setXHRWithCredentialsForType(type, value) {\n if (!type) {\n Object.keys(xhrWithCredentials).forEach(function (key) {\n setXHRWithCredentialsForType(key, value);\n });\n } else {\n xhrWithCredentials[type] = !!value;\n }\n }\n\n function getXHRWithCredentialsForType(type) {\n var useCreds = xhrWithCredentials[type];\n return useCreds === undefined ? xhrWithCredentials["default"] : useCreds;\n }\n\n function getDefaultUtcTimingSource() {\n return settings.get().streaming.utcSynchronization.defaultTimingSource;\n }\n\n function reset() {//TODO need to figure out what props to persist across sessions and which to reset if any.\n //setup();\n }\n\n instance = {\n getABRCustomRules: getABRCustomRules,\n addABRCustomRule: addABRCustomRule,\n removeABRCustomRule: removeABRCustomRule,\n getStableBufferTime: getStableBufferTime,\n getInitialBufferLevel: getInitialBufferLevel,\n getRetryAttemptsForType: getRetryAttemptsForType,\n getRetryIntervalsForType: getRetryIntervalsForType,\n getLiveDelay: getLiveDelay,\n getLiveCatchupLatencyThreshold: getLiveCatchupLatencyThreshold,\n addUTCTimingSource: addUTCTimingSource,\n removeUTCTimingSource: removeUTCTimingSource,\n getUTCTimingSources: getUTCTimingSources,\n clearDefaultUTCTimingSources: clearDefaultUTCTimingSources,\n restoreDefaultUTCTimingSources: restoreDefaultUTCTimingSources,\n setXHRWithCredentialsForType: setXHRWithCredentialsForType,\n getXHRWithCredentialsForType: getXHRWithCredentialsForType,\n getDefaultUtcTimingSource: getDefaultUtcTimingSource,\n reset: reset\n };\n setup();\n return instance;\n} //TODO see if you can move this and not export and just getter to get default value.\n\n\nMediaPlayerModel.__dashjs_factory_name = \'MediaPlayerModel\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"].getSingletonFactory(MediaPlayerModel));\n\n/***/ }),\n\n/***/ "./src/streaming/models/MetricsModel.js":\n/*!**********************************************!*\\\n !*** ./src/streaming/models/MetricsModel.js ***!\n \\**********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1774940__) {\n__nested_webpack_require_1774940__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1774940__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1774940__(/*! ../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _vo_MetricsList__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1774940__(/*! ../vo/MetricsList */ "./src/streaming/vo/MetricsList.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1774940__(/*! ../vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _vo_metrics_RepresentationSwitch__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1774940__(/*! ../vo/metrics/RepresentationSwitch */ "./src/streaming/vo/metrics/RepresentationSwitch.js");\n/* harmony import */ var _vo_metrics_BufferLevel__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1774940__(/*! ../vo/metrics/BufferLevel */ "./src/streaming/vo/metrics/BufferLevel.js");\n/* harmony import */ var _vo_metrics_BufferState__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1774940__(/*! ../vo/metrics/BufferState */ "./src/streaming/vo/metrics/BufferState.js");\n/* harmony import */ var _vo_metrics_DVRInfo__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1774940__(/*! ../vo/metrics/DVRInfo */ "./src/streaming/vo/metrics/DVRInfo.js");\n/* harmony import */ var _vo_metrics_DroppedFrames__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1774940__(/*! ../vo/metrics/DroppedFrames */ "./src/streaming/vo/metrics/DroppedFrames.js");\n/* harmony import */ var _vo_metrics_ManifestUpdate__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1774940__(/*! ../vo/metrics/ManifestUpdate */ "./src/streaming/vo/metrics/ManifestUpdate.js");\n/* harmony import */ var _vo_metrics_SchedulingInfo__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_1774940__(/*! ../vo/metrics/SchedulingInfo */ "./src/streaming/vo/metrics/SchedulingInfo.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_11__ = __nested_webpack_require_1774940__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _vo_metrics_RequestsQueue__WEBPACK_IMPORTED_MODULE_12__ = __nested_webpack_require_1774940__(/*! ../vo/metrics/RequestsQueue */ "./src/streaming/vo/metrics/RequestsQueue.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_13__ = __nested_webpack_require_1774940__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_14__ = __nested_webpack_require_1774940__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction MetricsModel(config) {\n config = config || {};\n var settings = config.settings;\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_11__["default"])(context).getInstance();\n var instance, streamMetrics;\n\n function setup() {\n streamMetrics = {};\n }\n\n function metricsChanged() {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_13__["default"].METRICS_CHANGED);\n }\n\n function metricChanged(mediaType) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_13__["default"].METRIC_CHANGED, {\n mediaType: mediaType\n });\n metricsChanged();\n }\n\n function metricUpdated(mediaType, metricType, vo) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_13__["default"].METRIC_UPDATED, {\n mediaType: mediaType,\n metric: metricType,\n value: vo\n });\n metricChanged(mediaType);\n }\n\n function metricAdded(mediaType, metricType, vo) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_13__["default"].METRIC_ADDED, {\n mediaType: mediaType,\n metric: metricType,\n value: vo\n });\n metricChanged(mediaType);\n }\n\n function clearCurrentMetricsForType(type) {\n delete streamMetrics[type];\n metricChanged(type);\n }\n\n function clearAllCurrentMetrics() {\n streamMetrics = {};\n metricsChanged();\n }\n\n function getMetricsFor(type, readOnly) {\n var metrics = null;\n\n if (!type) {\n return metrics;\n }\n\n if (streamMetrics.hasOwnProperty(type)) {\n metrics = streamMetrics[type];\n } else if (!readOnly) {\n metrics = new _vo_MetricsList__WEBPACK_IMPORTED_MODULE_2__["default"]();\n streamMetrics[type] = metrics;\n }\n\n return metrics;\n }\n\n function pushMetrics(type, list, value) {\n var metrics = getMetricsFor(type);\n\n if (metrics !== null) {\n metrics[list].push(value);\n\n if (metrics[list].length > settings.get().streaming.metrics.maxListDepth) {\n metrics[list].shift();\n }\n }\n }\n\n function appendHttpTrace(httpRequest, s, d, b, t) {\n var vo = new _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_3__["HTTPRequestTrace"]();\n vo.s = s;\n vo.d = d;\n vo.b = b;\n vo.t = t;\n httpRequest.trace.push(vo);\n\n if (!httpRequest.interval) {\n httpRequest.interval = 0;\n }\n\n httpRequest.interval += d;\n return vo;\n }\n\n function addHttpRequest(mediaType, tcpid, type, url, quality, actualurl, serviceLocation, range, trequest, tresponse, tfinish, responsecode, mediaduration, responseHeaders, traces) {\n var vo = new _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_3__["HTTPRequest"](); // ISO 23009-1 D.4.3 NOTE 2:\n // All entries for a given object will have the same URL and range\n // and so can easily be correlated. If there were redirects or\n // failures there will be one entry for each redirect/failure.\n // The redirect-to URL or alternative url (where multiple have been\n // provided in the MPD) will appear as the actualurl of the next\n // entry with the same url value.\n\n if (actualurl && actualurl !== url) {\n // given the above, add an entry for the original request\n addHttpRequest(mediaType, null, type, url, quality, null, null, range, trequest, null, // unknown\n null, // unknown\n null, // unknown, probably a 302\n mediaduration, null, null);\n vo.actualurl = actualurl;\n }\n\n vo.tcpid = tcpid;\n vo.type = type;\n vo.url = url;\n vo.range = range;\n vo.trequest = trequest;\n vo.tresponse = tresponse;\n vo.responsecode = responsecode;\n vo._tfinish = tfinish;\n vo._stream = mediaType;\n vo._mediaduration = mediaduration;\n vo._quality = quality;\n vo._responseHeaders = responseHeaders;\n vo._serviceLocation = serviceLocation;\n\n if (traces) {\n traces.forEach(function (trace) {\n appendHttpTrace(vo, trace.s, trace.d, trace.b, trace.t);\n });\n } else {\n // The interval and trace shall be absent for redirect and failure records.\n delete vo.interval;\n delete vo.trace;\n }\n\n pushAndNotify(mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].HTTP_REQUEST, vo);\n }\n\n function addRepresentationSwitch(mediaType, t, mt, to, lto) {\n var vo = new _vo_metrics_RepresentationSwitch__WEBPACK_IMPORTED_MODULE_4__["default"]();\n vo.t = t;\n vo.mt = mt;\n vo.to = to;\n\n if (lto) {\n vo.lto = lto;\n } else {\n delete vo.lto;\n }\n\n pushAndNotify(mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].TRACK_SWITCH, vo);\n }\n\n function pushAndNotify(mediaType, metricType, metricObject) {\n pushMetrics(mediaType, metricType, metricObject);\n metricAdded(mediaType, metricType, metricObject);\n }\n\n function addBufferLevel(mediaType, t, level) {\n var vo = new _vo_metrics_BufferLevel__WEBPACK_IMPORTED_MODULE_5__["default"]();\n vo.t = t;\n vo.level = level;\n pushAndNotify(mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_LEVEL, vo);\n }\n\n function addBufferState(mediaType, state, target) {\n var vo = new _vo_metrics_BufferState__WEBPACK_IMPORTED_MODULE_6__["default"]();\n vo.target = target;\n vo.state = state;\n pushAndNotify(mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFER_STATE, vo);\n }\n\n function addDVRInfo(mediaType, currentTime, mpd, range) {\n var vo = new _vo_metrics_DVRInfo__WEBPACK_IMPORTED_MODULE_7__["default"]();\n vo.time = currentTime;\n vo.range = range;\n vo.manifestInfo = mpd;\n pushAndNotify(mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DVR_INFO, vo);\n }\n\n function addDroppedFrames(mediaType, quality) {\n var vo = new _vo_metrics_DroppedFrames__WEBPACK_IMPORTED_MODULE_8__["default"]();\n var list = getMetricsFor(mediaType).DroppedFrames;\n\n if (!quality) {\n return;\n }\n\n vo.time = quality.creationTime;\n vo.droppedFrames = quality.droppedVideoFrames;\n\n if (list.length > 0 && list[list.length - 1] == vo) {\n return;\n }\n\n pushAndNotify(mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DROPPED_FRAMES, vo);\n }\n\n function addSchedulingInfo(mediaType, t, type, startTime, availabilityStartTime, duration, quality, range, state) {\n var vo = new _vo_metrics_SchedulingInfo__WEBPACK_IMPORTED_MODULE_10__["default"]();\n vo.mediaType = mediaType;\n vo.t = t;\n vo.type = type;\n vo.startTime = startTime;\n vo.availabilityStartTime = availabilityStartTime;\n vo.duration = duration;\n vo.quality = quality;\n vo.range = range;\n vo.state = state;\n pushAndNotify(mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SCHEDULING_INFO, vo);\n }\n\n function addRequestsQueue(mediaType, loadingRequests, executedRequests) {\n var vo = new _vo_metrics_RequestsQueue__WEBPACK_IMPORTED_MODULE_12__["default"]();\n vo.loadingRequests = loadingRequests;\n vo.executedRequests = executedRequests;\n getMetricsFor(mediaType).RequestsQueue = vo;\n metricAdded(mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].REQUESTS_QUEUE, vo);\n }\n\n function addManifestUpdate(mediaType, type, requestTime, fetchTime, availabilityStartTime, presentationStartTime, clientTimeOffset, currentTime, buffered, latency) {\n var vo = new _vo_metrics_ManifestUpdate__WEBPACK_IMPORTED_MODULE_9__["ManifestUpdate"]();\n vo.mediaType = mediaType;\n vo.type = type;\n vo.requestTime = requestTime; // when this manifest update was requested\n\n vo.fetchTime = fetchTime; // when this manifest update was received\n\n vo.availabilityStartTime = availabilityStartTime;\n vo.presentationStartTime = presentationStartTime; // the seek point (liveEdge for dynamic, Stream[0].startTime for static)\n\n vo.clientTimeOffset = clientTimeOffset; // the calculated difference between the server and client wall clock time\n\n vo.currentTime = currentTime; // actual element.currentTime\n\n vo.buffered = buffered; // actual element.ranges\n\n vo.latency = latency; // (static is fixed value of zero. dynamic should be ((Now-@availabilityStartTime) - currentTime)\n\n pushMetrics(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].STREAM, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MANIFEST_UPDATE, vo);\n metricAdded(mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MANIFEST_UPDATE, vo);\n }\n\n function updateManifestUpdateInfo(manifestUpdate, updatedFields) {\n if (manifestUpdate) {\n for (var field in updatedFields) {\n manifestUpdate[field] = updatedFields[field];\n }\n\n metricUpdated(manifestUpdate.mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MANIFEST_UPDATE, manifestUpdate);\n }\n }\n\n function addManifestUpdateStreamInfo(manifestUpdate, id, index, start, duration) {\n if (manifestUpdate) {\n var vo = new _vo_metrics_ManifestUpdate__WEBPACK_IMPORTED_MODULE_9__["ManifestUpdateStreamInfo"]();\n vo.id = id;\n vo.index = index;\n vo.start = start;\n vo.duration = duration;\n manifestUpdate.streamInfo.push(vo);\n metricUpdated(manifestUpdate.mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MANIFEST_UPDATE_STREAM_INFO, manifestUpdate);\n }\n }\n\n function addManifestUpdateRepresentationInfo(manifestUpdate, id, index, streamIndex, mediaType, presentationTimeOffset, startNumber, fragmentInfoType) {\n if (manifestUpdate && manifestUpdate.representationInfo) {\n var vo = new _vo_metrics_ManifestUpdate__WEBPACK_IMPORTED_MODULE_9__["ManifestUpdateRepresentationInfo"]();\n vo.id = id;\n vo.index = index;\n vo.streamIndex = streamIndex;\n vo.mediaType = mediaType;\n vo.startNumber = startNumber;\n vo.fragmentInfoType = fragmentInfoType;\n vo.presentationTimeOffset = presentationTimeOffset;\n manifestUpdate.representationInfo.push(vo);\n metricUpdated(manifestUpdate.mediaType, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].MANIFEST_UPDATE_TRACK_INFO, manifestUpdate);\n }\n }\n\n function addPlayList(vo) {\n if (vo.trace && Array.isArray(vo.trace)) {\n vo.trace.forEach(function (trace) {\n if (trace.hasOwnProperty(\'subreplevel\') && !trace.subreplevel) {\n delete trace.subreplevel;\n }\n });\n } else {\n delete vo.trace;\n }\n\n pushAndNotify(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].STREAM, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PLAY_LIST, vo);\n }\n\n function addDVBErrors(vo) {\n pushAndNotify(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].STREAM, _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_1__["default"].DVB_ERRORS, vo);\n }\n\n instance = {\n clearCurrentMetricsForType: clearCurrentMetricsForType,\n clearAllCurrentMetrics: clearAllCurrentMetrics,\n getMetricsFor: getMetricsFor,\n addHttpRequest: addHttpRequest,\n addRepresentationSwitch: addRepresentationSwitch,\n addBufferLevel: addBufferLevel,\n addBufferState: addBufferState,\n addDVRInfo: addDVRInfo,\n addDroppedFrames: addDroppedFrames,\n addSchedulingInfo: addSchedulingInfo,\n addRequestsQueue: addRequestsQueue,\n addManifestUpdate: addManifestUpdate,\n updateManifestUpdateInfo: updateManifestUpdateInfo,\n addManifestUpdateStreamInfo: addManifestUpdateStreamInfo,\n addManifestUpdateRepresentationInfo: addManifestUpdateRepresentationInfo,\n addPlayList: addPlayList,\n addDVBErrors: addDVBErrors\n };\n setup();\n return instance;\n}\n\nMetricsModel.__dashjs_factory_name = \'MetricsModel\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_14__["default"].getSingletonFactory(MetricsModel));\n\n/***/ }),\n\n/***/ "./src/streaming/models/URIFragmentModel.js":\n/*!**************************************************!*\\\n !*** ./src/streaming/models/URIFragmentModel.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1791717__) {\n__nested_webpack_require_1791717__.r(__nested_webpack_exports__);\n/* harmony import */ var _vo_URIFragmentData__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1791717__(/*! ../vo/URIFragmentData */ "./src/streaming/vo/URIFragmentData.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1791717__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n/**\n * Model class managing URI fragments.\n * @ignore\n */\n\nfunction URIFragmentModel() {\n var instance, URIFragmentDataVO;\n /**\n * @param {string} uri The URI to parse for fragment extraction\n * @memberof module:URIFragmentModel\n * @instance\n */\n\n function initialize(uri) {\n URIFragmentDataVO = new _vo_URIFragmentData__WEBPACK_IMPORTED_MODULE_0__["default"]();\n if (!uri) return null;\n var hashIndex = uri.indexOf(\'#\');\n\n if (hashIndex !== -1) {\n var fragments = uri.substr(hashIndex + 1).split(\'&\');\n\n for (var i = 0, len = fragments.length; i < len; ++i) {\n var fragment = fragments[i];\n var equalIndex = fragment.indexOf(\'=\');\n\n if (equalIndex !== -1) {\n var key = fragment.substring(0, equalIndex);\n\n if (URIFragmentDataVO.hasOwnProperty(key)) {\n URIFragmentDataVO[key] = fragment.substr(equalIndex + 1);\n }\n }\n }\n }\n }\n /**\n * @returns {URIFragmentData} Object containing supported URI fragments\n * @memberof module:URIFragmentModel\n * @instance\n */\n\n\n function getURIFragmentData() {\n return URIFragmentDataVO;\n }\n\n instance = {\n initialize: initialize,\n getURIFragmentData: getURIFragmentData\n };\n return instance;\n}\n\nURIFragmentModel.__dashjs_factory_name = \'URIFragmentModel\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"].getSingletonFactory(URIFragmentModel));\n\n/***/ }),\n\n/***/ "./src/streaming/models/VideoModel.js":\n/*!********************************************!*\\\n !*** ./src/streaming/models/VideoModel.js ***!\n \\********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1795710__) {\n__nested_webpack_require_1795710__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1795710__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1795710__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1795710__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1795710__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1795710__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\nvar READY_STATES_TO_EVENT_NAMES = new Map([[_constants_Constants__WEBPACK_IMPORTED_MODULE_4__["default"].VIDEO_ELEMENT_READY_STATES.HAVE_METADATA, \'loadedmetadata\'], [_constants_Constants__WEBPACK_IMPORTED_MODULE_4__["default"].VIDEO_ELEMENT_READY_STATES.HAVE_CURRENT_DATA, \'loadeddata\'], [_constants_Constants__WEBPACK_IMPORTED_MODULE_4__["default"].VIDEO_ELEMENT_READY_STATES.HAVE_FUTURE_DATA, \'canplay\'], [_constants_Constants__WEBPACK_IMPORTED_MODULE_4__["default"].VIDEO_ELEMENT_READY_STATES.HAVE_ENOUGH_DATA, \'canplaythrough\']]);\n\nfunction VideoModel() {\n var instance, logger, element, TTMLRenderingDiv;\n var VIDEO_MODEL_WRONG_ELEMENT_TYPE = \'element is not video or audio DOM type!\';\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance();\n var stalledStreams = [];\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_3__["default"])(context).getInstance().getLogger(instance);\n }\n\n function initialize() {\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].PLAYBACK_PLAYING, onPlaying, this);\n }\n\n function reset() {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].PLAYBACK_PLAYING, onPlaying, this);\n }\n\n function onPlaybackCanPlay() {\n if (element) {\n element.playbackRate = 1;\n element.removeEventListener(\'canplay\', onPlaybackCanPlay);\n }\n }\n\n function setPlaybackRate(value) {\n var ignoreReadyState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (!element) return;\n\n if (!ignoreReadyState && element.readyState <= 2 && value > 0) {\n // If media element hasn\'t loaded enough data to play yet, wait until it has\n element.addEventListener(\'canplay\', onPlaybackCanPlay);\n } else {\n element.playbackRate = value;\n }\n } //TODO Move the DVR window calculations from MediaPlayer to Here.\n\n\n function setCurrentTime(currentTime, stickToBuffered) {\n waitForReadyState(_constants_Constants__WEBPACK_IMPORTED_MODULE_4__["default"].VIDEO_ELEMENT_READY_STATES.HAVE_METADATA, function () {\n if (element) {\n //_currentTime = currentTime;\n // We don\'t set the same currentTime because it can cause firing unexpected Pause event in IE11\n // providing playbackRate property equals to zero.\n if (element.currentTime === currentTime) {\n return;\n } // TODO Despite the fact that MediaSource \'open\' event has been fired IE11 cannot set videoElement.currentTime\n // immediately (it throws InvalidStateError). It seems that this is related to videoElement.readyState property\n // Initially it is 0, but soon after \'open\' event it goes to 1 and setting currentTime is allowed. Chrome allows to\n // set currentTime even if readyState = 0.\n // setTimeout is used to workaround InvalidStateError in IE11\n\n\n try {\n currentTime = stickToBuffered ? stickTimeToBuffered(currentTime) : currentTime;\n element.currentTime = currentTime;\n } catch (e) {\n if (element.readyState === 0 && e.code === e.INVALID_STATE_ERR) {\n setTimeout(function () {\n element.currentTime = currentTime;\n }, 400);\n }\n }\n }\n });\n }\n\n function stickTimeToBuffered(time) {\n var buffered = getBufferRange();\n var closestTime = time;\n var closestDistance = 9999999999;\n\n if (buffered) {\n for (var i = 0; i < buffered.length; i++) {\n var start = buffered.start(i);\n var end = buffered.end(i);\n var distanceToStart = Math.abs(start - time);\n var distanceToEnd = Math.abs(end - time);\n\n if (time >= start && time <= end) {\n return time;\n }\n\n if (distanceToStart < closestDistance) {\n closestDistance = distanceToStart;\n closestTime = start;\n }\n\n if (distanceToEnd < closestDistance) {\n closestDistance = distanceToEnd;\n closestTime = end;\n }\n }\n }\n\n return closestTime;\n }\n\n function getElement() {\n return element;\n }\n\n function setElement(value) {\n //add check of value type\n if (value === null || value === undefined || value && /^(VIDEO|AUDIO)$/i.test(value.nodeName)) {\n element = value; // Workaround to force Firefox to fire the canplay event.\n\n if (element) {\n element.preload = \'auto\';\n }\n } else {\n throw VIDEO_MODEL_WRONG_ELEMENT_TYPE;\n }\n }\n\n function setSource(source) {\n if (element) {\n if (source) {\n element.src = source;\n } else {\n element.removeAttribute(\'src\');\n element.load();\n }\n }\n }\n\n function getSource() {\n return element ? element.src : null;\n }\n\n function getTTMLRenderingDiv() {\n return TTMLRenderingDiv;\n }\n\n function setTTMLRenderingDiv(div) {\n TTMLRenderingDiv = div; // The styling will allow the captions to match the video window size and position.\n\n TTMLRenderingDiv.style.position = \'absolute\';\n TTMLRenderingDiv.style.display = \'flex\';\n TTMLRenderingDiv.style.overflow = \'hidden\';\n TTMLRenderingDiv.style.pointerEvents = \'none\';\n TTMLRenderingDiv.style.top = 0;\n TTMLRenderingDiv.style.left = 0;\n }\n\n function setStallState(type, state) {\n stallStream(type, state);\n }\n\n function isStalled() {\n return stalledStreams.length > 0;\n }\n\n function addStalledStream(type) {\n if (type === null || !element || element.seeking || stalledStreams.indexOf(type) !== -1) {\n return;\n }\n\n stalledStreams.push(type);\n }\n\n function removeStalledStream(type) {\n var index = stalledStreams.indexOf(type);\n\n if (type === null) {\n return;\n }\n\n if (index !== -1) {\n stalledStreams.splice(index, 1);\n }\n }\n\n function stallStream(type, isStalled) {\n if (isStalled) {\n addStalledStream(type);\n } else {\n removeStalledStream(type);\n }\n } //Calling play on the element will emit playing - even if the stream is stalled. If the stream is stalled, emit a waiting event.\n\n\n function onPlaying() {\n if (element && isStalled() && element.playbackRate === 0) {\n var event = document.createEvent(\'Event\');\n event.initEvent(\'waiting\', true, false);\n element.dispatchEvent(event);\n }\n }\n\n function getPlaybackQuality() {\n if (!element) {\n return null;\n }\n\n var hasWebKit = \'webkitDroppedFrameCount\' in element && \'webkitDecodedFrameCount\' in element;\n var hasQuality = (\'getVideoPlaybackQuality\' in element);\n var result = null;\n\n if (hasQuality) {\n result = element.getVideoPlaybackQuality();\n } else if (hasWebKit) {\n result = {\n droppedVideoFrames: element.webkitDroppedFrameCount,\n totalVideoFrames: element.webkitDroppedFrameCount + element.webkitDecodedFrameCount,\n creationTime: new Date()\n };\n }\n\n return result;\n }\n\n function play() {\n if (element) {\n element.autoplay = true;\n var p = element.play();\n\n if (p && p["catch"] && typeof Promise !== \'undefined\') {\n p["catch"](function (e) {\n if (e.name === \'NotAllowedError\') {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].PLAYBACK_NOT_ALLOWED);\n }\n\n logger.warn("Caught pending play exception - continuing (".concat(e, ")"));\n });\n }\n }\n }\n\n function isPaused() {\n return element ? element.paused : null;\n }\n\n function pause() {\n if (element) {\n element.pause();\n element.autoplay = false;\n }\n }\n\n function isSeeking() {\n return element ? element.seeking : null;\n }\n\n function getTime() {\n return element ? element.currentTime : null;\n }\n\n function getPlaybackRate() {\n return element ? element.playbackRate : null;\n }\n\n function getPlayedRanges() {\n return element ? element.played : null;\n }\n\n function getEnded() {\n return element ? element.ended : null;\n }\n\n function addEventListener(eventName, eventCallBack) {\n if (element) {\n element.addEventListener(eventName, eventCallBack);\n }\n }\n\n function removeEventListener(eventName, eventCallBack) {\n if (element) {\n element.removeEventListener(eventName, eventCallBack);\n }\n }\n\n function getReadyState() {\n return element ? element.readyState : NaN;\n }\n\n function getBufferRange() {\n return element ? element.buffered : null;\n }\n\n function getClientWidth() {\n return element ? element.clientWidth : NaN;\n }\n\n function getClientHeight() {\n return element ? element.clientHeight : NaN;\n }\n\n function getVideoWidth() {\n return element ? element.videoWidth : NaN;\n }\n\n function getVideoHeight() {\n return element ? element.videoHeight : NaN;\n }\n\n function getVideoRelativeOffsetTop() {\n var parentElement = element.parentNode.host || element.parentNode;\n return parentElement ? element.getBoundingClientRect().top - parentElement.getBoundingClientRect().top : NaN;\n }\n\n function getVideoRelativeOffsetLeft() {\n var parentElement = element.parentNode.host || element.parentNode;\n return parentElement ? element.getBoundingClientRect().left - parentElement.getBoundingClientRect().left : NaN;\n }\n\n function getTextTracks() {\n return element ? element.textTracks : [];\n }\n\n function getTextTrack(kind, label, lang, isTTML, isEmbedded) {\n if (element) {\n for (var i = 0; i < element.textTracks.length; i++) {\n //label parameter could be a number (due to adaptationSet), but label, the attribute of textTrack, is a string => to modify...\n //label could also be undefined (due to adaptationSet)\n if (element.textTracks[i].kind === kind && (label ? element.textTracks[i].label == label : true) && element.textTracks[i].language === lang && element.textTracks[i].isTTML === isTTML && element.textTracks[i].isEmbedded === isEmbedded) {\n return element.textTracks[i];\n }\n }\n }\n\n return null;\n }\n\n function addTextTrack(kind, label, lang, isTTML, isEmbedded) {\n if (!element) {\n return null;\n } // check if track of same type has not been already created for previous stream\n // then use it (no way to remove existing text track from video element)\n\n\n var track = getTextTrack(kind, label, lang, isTTML, isEmbedded);\n\n if (!track) {\n track = element.addTextTrack(kind, label, lang);\n track.isEmbedded = isEmbedded;\n track.isTTML = isTTML;\n }\n\n return track;\n }\n\n function appendChild(childElement) {\n if (element) {\n element.appendChild(childElement); //in Chrome, we need to differenciate textTrack with same lang, kind and label but different format (vtt, ttml, etc...)\n\n if (childElement.isTTML !== undefined) {\n element.textTracks[element.textTracks.length - 1].isTTML = childElement.isTTML;\n element.textTracks[element.textTracks.length - 1].isEmbedded = childElement.isEmbedded;\n }\n }\n }\n\n function removeChild(childElement) {\n if (element) {\n element.removeChild(childElement);\n }\n }\n\n function waitForReadyState(targetReadyState, callback) {\n if (targetReadyState === _constants_Constants__WEBPACK_IMPORTED_MODULE_4__["default"].VIDEO_ELEMENT_READY_STATES.HAVE_NOTHING || getReadyState() >= targetReadyState) {\n callback();\n } else {\n // wait for the appropriate callback before checking again\n var event = READY_STATES_TO_EVENT_NAMES.get(targetReadyState);\n\n _listenOnce(event, callback);\n }\n }\n\n function _listenOnce(event, callback) {\n var func = function func() {\n // Stop listening to this event.\n removeEventListener(event, func); // Call the original listener.\n\n callback(event);\n };\n\n addEventListener(event, func);\n }\n\n instance = {\n initialize: initialize,\n setCurrentTime: setCurrentTime,\n play: play,\n isPaused: isPaused,\n pause: pause,\n isStalled: isStalled,\n isSeeking: isSeeking,\n getTime: getTime,\n getPlaybackRate: getPlaybackRate,\n setPlaybackRate: setPlaybackRate,\n getPlayedRanges: getPlayedRanges,\n getEnded: getEnded,\n setStallState: setStallState,\n getElement: getElement,\n setElement: setElement,\n setSource: setSource,\n getSource: getSource,\n getTTMLRenderingDiv: getTTMLRenderingDiv,\n setTTMLRenderingDiv: setTTMLRenderingDiv,\n getPlaybackQuality: getPlaybackQuality,\n addEventListener: addEventListener,\n removeEventListener: removeEventListener,\n getReadyState: getReadyState,\n getBufferRange: getBufferRange,\n getClientWidth: getClientWidth,\n getClientHeight: getClientHeight,\n getTextTracks: getTextTracks,\n getTextTrack: getTextTrack,\n addTextTrack: addTextTrack,\n appendChild: appendChild,\n removeChild: removeChild,\n getVideoWidth: getVideoWidth,\n getVideoHeight: getVideoHeight,\n getVideoRelativeOffsetTop: getVideoRelativeOffsetTop,\n getVideoRelativeOffsetLeft: getVideoRelativeOffsetLeft,\n reset: reset\n };\n setup();\n return instance;\n}\n\nVideoModel.__dashjs_factory_name = \'VideoModel\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(VideoModel));\n\n/***/ }),\n\n/***/ "./src/streaming/net/FetchLoader.js":\n/*!******************************************!*\\\n !*** ./src/streaming/net/FetchLoader.js ***!\n \\******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1811917__) {\n__nested_webpack_require_1811917__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1811917__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Settings__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1811917__(/*! ../../core/Settings */ "./src/core/Settings.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1811917__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }\n\nfunction _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n/**\n * @module FetchLoader\n * @ignore\n * @description Manages download of resources via HTTP using fetch.\n * @param {Object} cfg - dependencies from parent\n */\n\nfunction FetchLoader(cfg) {\n cfg = cfg || {};\n var context = this.context;\n var requestModifier = cfg.requestModifier;\n var lowLatencyThroughputModel = cfg.lowLatencyThroughputModel;\n var boxParser = cfg.boxParser;\n var settings = Object(_core_Settings__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance();\n var instance, dashMetrics;\n\n function setup(cfg) {\n dashMetrics = cfg.dashMetrics;\n }\n\n function load(httpRequest) {\n // Variables will be used in the callback functions\n var requestStartTime = new Date();\n var request = httpRequest.request;\n var headers = new Headers();\n /*jshint ignore:line*/\n\n if (request.range) {\n headers.append(\'Range\', \'bytes=\' + request.range);\n }\n\n if (httpRequest.headers) {\n for (var header in httpRequest.headers) {\n var value = httpRequest.headers[header];\n\n if (value) {\n headers.append(header, value);\n }\n }\n }\n\n if (!request.requestStartDate) {\n request.requestStartDate = requestStartTime;\n }\n\n if (requestModifier) {\n // modifyRequestHeader expects a XMLHttpRequest object so,\n // to keep backward compatibility, we should expose a setRequestHeader method\n // TODO: Remove RequestModifier dependency on XMLHttpRequest object and define\n // a more generic way to intercept/modify requests\n requestModifier.modifyRequestHeader({\n setRequestHeader: function setRequestHeader(header, value) {\n headers.append(header, value);\n }\n });\n }\n\n var abortController;\n\n if (typeof window.AbortController === \'function\') {\n abortController = new AbortController();\n /*jshint ignore:line*/\n\n httpRequest.abortController = abortController;\n abortController.signal.onabort = httpRequest.onabort;\n }\n\n var reqOptions = {\n method: httpRequest.method,\n headers: headers,\n credentials: httpRequest.withCredentials ? \'include\' : undefined,\n signal: abortController ? abortController.signal : undefined\n };\n var calculationMode = settings.get().streaming.abr.fetchThroughputCalculationMode;\n var requestTime = Date.now();\n var throughputCapacityDelayMS = 0;\n new Promise(function (resolve) {\n if (calculationMode === _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].ABR_FETCH_THROUGHPUT_CALCULATION_AAST && lowLatencyThroughputModel) {\n throughputCapacityDelayMS = lowLatencyThroughputModel.getThroughputCapacityDelayMS(request, dashMetrics.getCurrentBufferLevel(request.mediaType) * 1000);\n\n if (throughputCapacityDelayMS) {\n // safely delay the "fetch" call a bit to be able to meassure the throughput capacity of the line.\n // this will lead to first few chunks downloaded at max network speed\n return setTimeout(resolve, throughputCapacityDelayMS);\n }\n }\n\n resolve();\n }).then(function () {\n var markBeforeFetch = Date.now();\n fetch(httpRequest.url, reqOptions).then(function (response) {\n if (!httpRequest.response) {\n httpRequest.response = {};\n }\n\n httpRequest.response.status = response.status;\n httpRequest.response.statusText = response.statusText;\n httpRequest.response.responseURL = response.url;\n\n if (!response.ok) {\n httpRequest.onerror();\n }\n\n var responseHeaders = \'\';\n\n var _iterator = _createForOfIteratorHelper(response.headers.keys()),\n _step;\n\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var key = _step.value;\n responseHeaders += key + \': \' + response.headers.get(key) + \'\\r\\n\';\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n\n httpRequest.response.responseHeaders = responseHeaders;\n\n if (!response.body) {\n // Fetch returning a ReadableStream response body is not currently supported by all browsers.\n // Browser compatibility: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API\n // If it is not supported, returning the whole segment when it\'s ready (as xhr)\n return response.arrayBuffer().then(function (buffer) {\n httpRequest.response.response = buffer;\n var event = {\n loaded: buffer.byteLength,\n total: buffer.byteLength,\n stream: false\n };\n httpRequest.progress(event);\n httpRequest.onload();\n httpRequest.onend();\n return;\n });\n }\n\n var totalBytes = parseInt(response.headers.get(\'Content-Length\'), 10);\n var bytesReceived = 0;\n var signaledFirstByte = false;\n var remaining = new Uint8Array();\n var offset = 0;\n\n if (calculationMode === _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].ABR_FETCH_THROUGHPUT_CALCULATION_AAST && lowLatencyThroughputModel) {\n var fetchMeassurement = function fetchMeassurement(stream) {\n var reader = stream.getReader();\n var measurement = [];\n reader.read().then(function processFetch(args) {\n var value = args.value;\n var done = args.done;\n markB = Date.now();\n\n if (value && value.length) {\n var chunkDownloadDurationMS = markB - markA;\n var chunkBytes = value.length;\n measurement.push({\n chunkDownloadTimeRelativeMS: markB - markBeforeFetch,\n chunkDownloadDurationMS: chunkDownloadDurationMS,\n chunkBytes: chunkBytes,\n kbps: Math.round(8 * chunkBytes / (chunkDownloadDurationMS / 1000)),\n bufferLevel: dashMetrics.getCurrentBufferLevel(request.mediaType)\n });\n }\n\n if (done) {\n var fetchDuration = markB - markBeforeFetch;\n var bytesAllChunks = measurement.reduce(function (prev, curr) {\n return prev + curr.chunkBytes;\n }, 0);\n lowLatencyThroughputModel.addMeasurement(request, fetchDuration, measurement, requestTime, throughputCapacityDelayMS, responseHeaders);\n httpRequest.progress({\n loaded: bytesAllChunks,\n total: bytesAllChunks,\n lengthComputable: true,\n time: lowLatencyThroughputModel.getEstimatedDownloadDurationMS(request),\n stream: true\n });\n return;\n }\n\n markA = Date.now();\n return reader.read().then(processFetch);\n });\n }; // tee\'ing streams is supported by all current major browsers\n // https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/tee\n\n\n var markA = markBeforeFetch;\n var markB = 0;\n\n var _response$body$tee = response.body.tee(),\n _response$body$tee2 = _slicedToArray(_response$body$tee, 2),\n forMeasure = _response$body$tee2[0],\n forConsumer = _response$body$tee2[1];\n\n fetchMeassurement(forMeasure);\n httpRequest.reader = forConsumer.getReader();\n } else {\n httpRequest.reader = response.body.getReader();\n }\n\n var downloadedData = [];\n var startTimeData = [];\n var endTimeData = [];\n var lastChunkWasFinished = true;\n\n var processResult = function processResult(_ref) {\n var value = _ref.value,\n done = _ref.done;\n\n // Bug fix Parse whenever data is coming [value] better than 1ms looking that increase CPU\n if (done) {\n if (remaining) {\n if (calculationMode !== _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].ABR_FETCH_THROUGHPUT_CALCULATION_AAST) {\n // If there is pending data, call progress so network metrics\n // are correctly generated\n // Same structure as https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequestEventTarget/\n var calculatedThroughput = null;\n\n if (calculationMode === _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING) {\n calculatedThroughput = calculateThroughputByChunkData(startTimeData, endTimeData);\n }\n\n httpRequest.progress({\n loaded: bytesReceived,\n total: isNaN(totalBytes) ? bytesReceived : totalBytes,\n lengthComputable: true,\n time: calculateDownloadedTime(downloadedData, bytesReceived),\n throughput: calculatedThroughput,\n stream: true\n });\n }\n\n httpRequest.response.response = remaining.buffer;\n }\n\n httpRequest.onload();\n httpRequest.onend();\n return;\n }\n\n if (value && value.length > 0) {\n remaining = concatTypedArray(remaining, value);\n bytesReceived += value.length;\n downloadedData.push({\n ts: Date.now(),\n bytes: value.length\n });\n\n if (calculationMode === _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING && lastChunkWasFinished) {\n // Parse the payload and capture the the \'moof\' box\n var _boxesInfo = boxParser.findLastTopIsoBoxCompleted([\'moof\'], remaining, offset);\n\n if (_boxesInfo.found) {\n // Store the beginning time of each chunk download in array StartTimeData\n lastChunkWasFinished = false;\n startTimeData.push({\n ts: performance.now(),\n\n /* jshint ignore:line */\n bytes: value.length\n });\n }\n }\n\n var boxesInfo = boxParser.findLastTopIsoBoxCompleted([\'moov\', \'mdat\'], remaining, offset);\n\n if (boxesInfo.found) {\n var end = boxesInfo.lastCompletedOffset + boxesInfo.size; // Store the end time of each chunk download with its size in array EndTimeData\n\n if (calculationMode === _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING && !lastChunkWasFinished) {\n lastChunkWasFinished = true;\n endTimeData.push({\n ts: performance.now(),\n\n /* jshint ignore:line */\n bytes: remaining.length\n });\n } // If we are going to pass full buffer, avoid copying it and pass\n // complete buffer. Otherwise clone the part of the buffer that is completed\n // and adjust remaining buffer. A clone is needed because ArrayBuffer of a typed-array\n // keeps a reference to the original data\n\n\n var data;\n\n if (end === remaining.length) {\n data = remaining;\n remaining = new Uint8Array();\n } else {\n data = new Uint8Array(remaining.subarray(0, end));\n remaining = remaining.subarray(end);\n } // Announce progress but don\'t track traces. Throughput measures are quite unstable\n // when they are based in small amount of data\n\n\n httpRequest.progress({\n data: data.buffer,\n lengthComputable: false,\n noTrace: true\n });\n offset = 0;\n } else {\n offset = boxesInfo.lastCompletedOffset; // Call progress so it generates traces that will be later used to know when the first byte\n // were received\n\n if (!signaledFirstByte) {\n httpRequest.progress({\n lengthComputable: false,\n noTrace: true\n });\n signaledFirstByte = true;\n }\n }\n }\n\n read(httpRequest, processResult);\n };\n\n read(httpRequest, processResult);\n })["catch"](function (e) {\n if (httpRequest.onerror) {\n httpRequest.onerror(e);\n }\n });\n });\n }\n\n function read(httpRequest, processResult) {\n httpRequest.reader.read().then(processResult)["catch"](function (e) {\n if (httpRequest.onerror && httpRequest.response.status === 200) {\n // Error, but response code is 200, trigger error\n httpRequest.onerror(e);\n }\n });\n }\n\n function concatTypedArray(remaining, data) {\n if (remaining.length === 0) {\n return data;\n }\n\n var result = new Uint8Array(remaining.length + data.length);\n result.set(remaining);\n result.set(data, remaining.length);\n return result;\n }\n\n function abort(request) {\n if (request.abortController) {\n // For firefox and edge\n request.abortController.abort();\n } else if (request.reader) {\n // For Chrome\n try {\n request.reader.cancel();\n request.onabort();\n } catch (e) {// throw exceptions (TypeError) when reader was previously closed,\n // for example, because a network issue\n }\n }\n }\n\n function calculateDownloadedTime(downloadedData, bytesReceived) {\n try {\n downloadedData = downloadedData.filter(function (data) {\n return data.bytes > bytesReceived / 4 / downloadedData.length;\n });\n\n if (downloadedData.length > 1) {\n var time = 0;\n var avgTimeDistance = (downloadedData[downloadedData.length - 1].ts - downloadedData[0].ts) / downloadedData.length;\n downloadedData.forEach(function (data, index) {\n // To be counted the data has to be over a threshold\n var next = downloadedData[index + 1];\n\n if (next) {\n var distance = next.ts - data.ts;\n time += distance < avgTimeDistance ? distance : 0;\n }\n });\n return time;\n }\n\n return null;\n } catch (e) {\n return null;\n }\n }\n\n function calculateThroughputByChunkData(startTimeData, endTimeData) {\n try {\n var datum, datumE; // Filter the last chunks in a segment in both arrays [StartTimeData and EndTimeData]\n\n datum = startTimeData.filter(function (data, i) {\n return i < startTimeData.length - 1;\n });\n datumE = endTimeData.filter(function (dataE, i) {\n return i < endTimeData.length - 1;\n });\n var chunkThroughputs = []; // Compute the average throughput of the filtered chunk data\n\n if (datum.length > 1) {\n var shortDurationBytesReceived = 0;\n var shortDurationStartTime = 0;\n\n for (var i = 0; i < datum.length; i++) {\n if (datum[i] && datumE[i]) {\n var chunkDownloadTime = datumE[i].ts - datum[i].ts;\n\n if (chunkDownloadTime > 1) {\n chunkThroughputs.push(8 * datumE[i].bytes / chunkDownloadTime);\n } else {\n if (shortDurationStartTime === 0) {\n shortDurationStartTime = datum[i].ts;\n }\n\n var cumulatedChunkDownloadTime = datumE[i].ts - shortDurationStartTime;\n\n if (cumulatedChunkDownloadTime > 1) {\n chunkThroughputs.push(8 * shortDurationBytesReceived / cumulatedChunkDownloadTime);\n shortDurationBytesReceived = 0;\n shortDurationStartTime = 0;\n } else {\n // continue cumulating short duration data\n shortDurationBytesReceived += datumE[i].bytes;\n }\n }\n }\n }\n\n if (chunkThroughputs.length > 0) {\n var sumOfChunkThroughputs = chunkThroughputs.reduce(function (a, b) {\n return a + b;\n }, 0);\n return sumOfChunkThroughputs / chunkThroughputs.length;\n }\n }\n\n return null;\n } catch (e) {\n return null;\n }\n }\n\n instance = {\n load: load,\n abort: abort,\n calculateDownloadedTime: calculateDownloadedTime,\n setup: setup\n };\n return instance;\n}\n\nFetchLoader.__dashjs_factory_name = \'FetchLoader\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(FetchLoader);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/net/HTTPLoader.js":\n/*!*****************************************!*\\\n !*** ./src/streaming/net/HTTPLoader.js ***!\n \\*****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1833712__) {\n__nested_webpack_require_1833712__.r(__nested_webpack_exports__);\n/* harmony import */ var _XHRLoader__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1833712__(/*! ./XHRLoader */ "./src/streaming/net/XHRLoader.js");\n/* harmony import */ var _FetchLoader__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1833712__(/*! ./FetchLoader */ "./src/streaming/net/FetchLoader.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1833712__(/*! ../vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1833712__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1833712__(/*! ../vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _models_CmcdModel__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1833712__(/*! ../models/CmcdModel */ "./src/streaming/models/CmcdModel.js");\n/* harmony import */ var _core_Utils__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1833712__(/*! ../../core/Utils */ "./src/core/Utils.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1833712__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1833712__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1833712__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_Settings__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_1833712__(/*! ../../core/Settings */ "./src/core/Settings.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_11__ = __nested_webpack_require_1833712__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _models_LowLatencyThroughputModel__WEBPACK_IMPORTED_MODULE_12__ = __nested_webpack_require_1833712__(/*! ../models/LowLatencyThroughputModel */ "./src/streaming/models/LowLatencyThroughputModel.js");\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n/**\n * @module HTTPLoader\n * @ignore\n * @description Manages download of resources via HTTP.\n * @param {Object} cfg - dependancies from parent\n */\n\nfunction HTTPLoader(cfg) {\n cfg = cfg || {};\n var context = this.context;\n var errHandler = cfg.errHandler;\n var dashMetrics = cfg.dashMetrics;\n var mediaPlayerModel = cfg.mediaPlayerModel;\n var requestModifier = cfg.requestModifier;\n var boxParser = cfg.boxParser;\n var errors = cfg.errors;\n var requestTimeout = cfg.requestTimeout || 0;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_8__["default"])(context).getInstance();\n var settings = Object(_core_Settings__WEBPACK_IMPORTED_MODULE_10__["default"])(context).getInstance();\n var instance, requests, delayedRequests, retryRequests, downloadErrorToRequestTypeMap, cmcdModel, lowLatencyThroughputModel, logger;\n\n function setup() {\n var _downloadErrorToReque;\n\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_7__["default"])(context).getInstance().getLogger(instance);\n requests = [];\n delayedRequests = [];\n retryRequests = [];\n cmcdModel = Object(_models_CmcdModel__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance();\n lowLatencyThroughputModel = Object(_models_LowLatencyThroughputModel__WEBPACK_IMPORTED_MODULE_12__["default"])(context).getInstance();\n downloadErrorToRequestTypeMap = (_downloadErrorToReque = {}, _defineProperty(_downloadErrorToReque, _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].MPD_TYPE, errors.DOWNLOAD_ERROR_ID_MANIFEST_CODE), _defineProperty(_downloadErrorToReque, _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].XLINK_EXPANSION_TYPE, errors.DOWNLOAD_ERROR_ID_XLINK_CODE), _defineProperty(_downloadErrorToReque, _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].INIT_SEGMENT_TYPE, errors.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE), _defineProperty(_downloadErrorToReque, _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].MEDIA_SEGMENT_TYPE, errors.DOWNLOAD_ERROR_ID_CONTENT_CODE), _defineProperty(_downloadErrorToReque, _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].INDEX_SEGMENT_TYPE, errors.DOWNLOAD_ERROR_ID_CONTENT_CODE), _defineProperty(_downloadErrorToReque, _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].BITSTREAM_SWITCHING_SEGMENT_TYPE, errors.DOWNLOAD_ERROR_ID_CONTENT_CODE), _defineProperty(_downloadErrorToReque, _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].OTHER_TYPE, errors.DOWNLOAD_ERROR_ID_CONTENT_CODE), _downloadErrorToReque);\n }\n\n function internalLoad(config, remainingAttempts) {\n var request = config.request;\n var traces = [];\n var firstProgress = true;\n var needFailureReport = true;\n var requestStartTime = new Date();\n var lastTraceTime = requestStartTime;\n var lastTraceReceivedCount = 0;\n var httpRequest;\n\n if (!requestModifier || !dashMetrics || !errHandler) {\n throw new Error(\'config object is not correct or missing\');\n }\n\n var handleLoaded = function handleLoaded(success) {\n needFailureReport = false;\n request.requestStartDate = requestStartTime;\n request.requestEndDate = new Date();\n request.firstByteDate = request.firstByteDate || requestStartTime;\n\n if (!request.checkExistenceOnly) {\n var responseUrl = httpRequest.response ? httpRequest.response.responseURL : null;\n var responseStatus = httpRequest.response ? httpRequest.response.status : null;\n var responseHeaders = httpRequest.response && httpRequest.response.getAllResponseHeaders ? httpRequest.response.getAllResponseHeaders() : httpRequest.response ? httpRequest.response.responseHeaders : [];\n dashMetrics.addHttpRequest(request, responseUrl, responseStatus, responseHeaders, success ? traces : null);\n\n if (request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].MPD_TYPE) {\n dashMetrics.addManifestUpdate(request);\n }\n }\n };\n\n var onloadend = function onloadend() {\n if (requests.indexOf(httpRequest) === -1) {\n return;\n } else {\n requests.splice(requests.indexOf(httpRequest), 1);\n }\n\n if (needFailureReport) {\n handleLoaded(false);\n\n if (remainingAttempts > 0) {\n // If we get a 404 to a media segment we should check the client clock again and perform a UTC sync in the background.\n try {\n if (settings.get().streaming.utcSynchronization.enableBackgroundSyncAfterSegmentDownloadError && request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].MEDIA_SEGMENT_TYPE) {\n // Only trigger a sync if the loading failed for the first time\n var initialNumberOfAttempts = mediaPlayerModel.getRetryAttemptsForType(_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].MEDIA_SEGMENT_TYPE);\n\n if (initialNumberOfAttempts === remainingAttempts) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_9__["default"].ATTEMPT_BACKGROUND_SYNC);\n }\n }\n } catch (e) {}\n\n remainingAttempts--;\n var retryRequest = {\n config: config\n };\n retryRequests.push(retryRequest);\n retryRequest.timeout = setTimeout(function () {\n if (retryRequests.indexOf(retryRequest) === -1) {\n return;\n } else {\n retryRequests.splice(retryRequests.indexOf(retryRequest), 1);\n }\n\n internalLoad(config, remainingAttempts);\n }, mediaPlayerModel.getRetryIntervalsForType(request.type));\n } else {\n if (request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].MSS_FRAGMENT_INFO_SEGMENT_TYPE) {\n return;\n }\n\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_4__["default"](downloadErrorToRequestTypeMap[request.type], request.url + \' is not available\', {\n request: request,\n response: httpRequest.response\n }));\n\n if (config.error) {\n config.error(request, \'error\', httpRequest.response.statusText);\n }\n\n if (config.complete) {\n config.complete(request, httpRequest.response.statusText);\n }\n }\n }\n };\n\n var progress = function progress(event) {\n var currentTime = new Date();\n\n if (firstProgress) {\n firstProgress = false;\n\n if (!event.lengthComputable || event.lengthComputable && event.total !== event.loaded) {\n request.firstByteDate = currentTime;\n }\n }\n\n if (event.lengthComputable) {\n request.bytesLoaded = event.loaded;\n request.bytesTotal = event.total;\n }\n\n if (!event.noTrace) {\n traces.push({\n s: lastTraceTime,\n d: event.time ? event.time : currentTime.getTime() - lastTraceTime.getTime(),\n b: [event.loaded ? event.loaded - lastTraceReceivedCount : 0],\n t: event.throughput\n });\n lastTraceTime = currentTime;\n lastTraceReceivedCount = event.loaded;\n }\n\n if (config.progress && event) {\n config.progress(event);\n }\n };\n\n var onload = function onload() {\n if (httpRequest.response.status >= 200 && httpRequest.response.status <= 299) {\n handleLoaded(true);\n\n if (config.success) {\n config.success(httpRequest.response.response, httpRequest.response.statusText, httpRequest.response.responseURL);\n }\n\n if (config.complete) {\n config.complete(request, httpRequest.response.statusText);\n }\n }\n };\n\n var onabort = function onabort() {\n if (config.abort) {\n config.abort(request);\n }\n };\n\n var ontimeout = function ontimeout(event) {\n var timeoutMessage;\n\n if (event.lengthComputable) {\n var percentageComplete = event.loaded / event.total * 100;\n timeoutMessage = \'Request timeout: loaded: \' + event.loaded + \', out of: \' + event.total + \' : \' + percentageComplete.toFixed(3) + \'% Completed\';\n } else {\n timeoutMessage = \'Request timeout: non-computable download size\';\n }\n\n logger.warn(timeoutMessage);\n };\n\n var loader;\n\n if (settings.get().streaming.lowLatencyEnabled && window.fetch && request.responseType === \'arraybuffer\' && request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].MEDIA_SEGMENT_TYPE) {\n loader = Object(_FetchLoader__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create({\n requestModifier: requestModifier,\n lowLatencyThroughputModel: lowLatencyThroughputModel,\n boxParser: boxParser\n });\n loader.setup({\n dashMetrics: dashMetrics\n });\n } else {\n loader = Object(_XHRLoader__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create({\n requestModifier: requestModifier\n });\n }\n\n var headers = null;\n var modifiedUrl = requestModifier.modifyRequestURL(request.url);\n\n if (settings.get().streaming.cmcd && settings.get().streaming.cmcd.enabled) {\n var cmcdMode = settings.get().streaming.cmcd.mode;\n\n if (cmcdMode === _constants_Constants__WEBPACK_IMPORTED_MODULE_11__["default"].CMCD_MODE_QUERY) {\n var additionalQueryParameter = _getAdditionalQueryParameter(request);\n\n modifiedUrl = _core_Utils__WEBPACK_IMPORTED_MODULE_6__["default"].addAditionalQueryParameterToUrl(modifiedUrl, additionalQueryParameter);\n } else if (cmcdMode === _constants_Constants__WEBPACK_IMPORTED_MODULE_11__["default"].CMCD_MODE_HEADER) {\n headers = cmcdModel.getHeaderParameters(request);\n }\n }\n\n request.url = modifiedUrl;\n var verb = request.checkExistenceOnly ? _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].HEAD : _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].GET;\n var withCredentials = mediaPlayerModel.getXHRWithCredentialsForType(request.type);\n httpRequest = {\n url: modifiedUrl,\n method: verb,\n withCredentials: withCredentials,\n request: request,\n onload: onload,\n onend: onloadend,\n onerror: onloadend,\n progress: progress,\n onabort: onabort,\n ontimeout: ontimeout,\n loader: loader,\n timeout: requestTimeout,\n headers: headers\n }; // Adds the ability to delay single fragment loading time to control buffer.\n\n var now = new Date().getTime();\n\n if (isNaN(request.delayLoadingTime) || now >= request.delayLoadingTime) {\n // no delay - just send\n requests.push(httpRequest);\n loader.load(httpRequest);\n } else {\n // delay\n var delayedRequest = {\n httpRequest: httpRequest\n };\n delayedRequests.push(delayedRequest);\n delayedRequest.delayTimeout = setTimeout(function () {\n if (delayedRequests.indexOf(delayedRequest) === -1) {\n return;\n } else {\n delayedRequests.splice(delayedRequests.indexOf(delayedRequest), 1);\n }\n\n try {\n requestStartTime = new Date();\n lastTraceTime = requestStartTime;\n requests.push(delayedRequest.httpRequest);\n loader.load(delayedRequest.httpRequest);\n } catch (e) {\n delayedRequest.httpRequest.onerror();\n }\n }, request.delayLoadingTime - now);\n }\n }\n\n function _getAdditionalQueryParameter(request) {\n try {\n var additionalQueryParameter = [];\n var cmcdQueryParameter = cmcdModel.getQueryParameter(request);\n\n if (cmcdQueryParameter) {\n additionalQueryParameter.push(cmcdQueryParameter);\n }\n\n return additionalQueryParameter;\n } catch (e) {\n return [];\n }\n }\n /**\n * Initiates a download of the resource described by config.request\n * @param {Object} config - contains request (FragmentRequest or derived type), and callbacks\n * @memberof module:HTTPLoader\n * @instance\n */\n\n\n function load(config) {\n if (config.request) {\n internalLoad(config, mediaPlayerModel.getRetryAttemptsForType(config.request.type));\n } else {\n if (config.error) {\n config.error(config.request, \'error\');\n }\n }\n }\n /**\n * Aborts any inflight downloads\n * @memberof module:HTTPLoader\n * @instance\n */\n\n\n function abort() {\n retryRequests.forEach(function (t) {\n clearTimeout(t.timeout); // abort request in order to trigger LOADING_ABANDONED event\n\n if (t.config.request && t.config.abort) {\n t.config.abort(t.config.request);\n }\n });\n retryRequests = [];\n delayedRequests.forEach(function (x) {\n return clearTimeout(x.delayTimeout);\n });\n delayedRequests = [];\n requests.forEach(function (x) {\n // MSS patch: ignore FragmentInfo requests\n if (x.request.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_2__["HTTPRequest"].MSS_FRAGMENT_INFO_SEGMENT_TYPE) {\n return;\n } // abort will trigger onloadend which we don\'t want\n // when deliberately aborting inflight requests -\n // set them to undefined so they are not called\n\n\n x.onloadend = x.onerror = x.onprogress = undefined;\n x.loader.abort(x);\n });\n requests = [];\n }\n\n instance = {\n load: load,\n abort: abort\n };\n setup();\n return instance;\n}\n\nHTTPLoader.__dashjs_factory_name = \'HTTPLoader\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_3__["default"].getClassFactory(HTTPLoader);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/net/SchemeLoaderFactory.js":\n/*!**************************************************!*\\\n !*** ./src/streaming/net/SchemeLoaderFactory.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1851811__) {\n__nested_webpack_require_1851811__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1851811__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _streaming_net_HTTPLoader__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1851811__(/*! ../../streaming/net/HTTPLoader */ "./src/streaming/net/HTTPLoader.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n/**\n * @module\n * @description Choose right url loader for scheme\n * @ignore\n */\n\nfunction SchemeLoaderFactory() {\n var instance;\n var schemeLoaderMap;\n\n function registerLoader(scheme, loader) {\n schemeLoaderMap[scheme] = loader;\n }\n\n function unregisterLoader(scheme) {\n if (schemeLoaderMap[scheme]) {\n delete schemeLoaderMap[scheme];\n }\n }\n\n function unregisterAllLoader() {\n schemeLoaderMap = {};\n }\n\n function getLoader(url) {\n // iterates through schemeLoaderMap to find a loader for the scheme\n for (var scheme in schemeLoaderMap) {\n if (schemeLoaderMap.hasOwnProperty(scheme) && url.startsWith(scheme)) {\n return schemeLoaderMap[scheme];\n }\n }\n\n return _streaming_net_HTTPLoader__WEBPACK_IMPORTED_MODULE_1__["default"];\n }\n\n function reset() {\n unregisterAllLoader();\n }\n\n function setup() {\n reset();\n }\n\n setup();\n instance = {\n getLoader: getLoader,\n registerLoader: registerLoader,\n unregisterLoader: unregisterLoader,\n unregisterAllLoader: unregisterAllLoader,\n reset: reset\n };\n return instance;\n}\n\nSchemeLoaderFactory.__dashjs_factory_name = \'SchemeLoaderFactory\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(SchemeLoaderFactory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/net/URLLoader.js":\n/*!****************************************!*\\\n !*** ./src/streaming/net/URLLoader.js ***!\n \\****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1855671__) {\n__nested_webpack_require_1855671__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1855671__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _streaming_net_SchemeLoaderFactory__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1855671__(/*! ../../streaming/net/SchemeLoaderFactory */ "./src/streaming/net/SchemeLoaderFactory.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n/**\n * @class URLLoader\n * @description Call Offline Loader or Online Loader dependaing on URL\n * @param {Object} cfg - dependances\n * @ignore\n*/\n\nfunction URLLoader(cfg) {\n cfg = cfg || {};\n var context = this.context;\n var instance, schemeLoaderFactory, loader;\n schemeLoaderFactory = Object(_streaming_net_SchemeLoaderFactory__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance();\n\n function load(config) {\n if (!loader) {\n var loaderFactory = schemeLoaderFactory.getLoader(config && config.request ? config.request.url : null);\n loader = loaderFactory(context).create({\n errHandler: cfg.errHandler,\n mediaPlayerModel: cfg.mediaPlayerModel,\n requestModifier: cfg.requestModifier,\n dashMetrics: cfg.dashMetrics,\n boxParser: cfg.boxParser ? cfg.boxParser : null,\n constants: cfg.constants ? cfg.constants : null,\n dashConstants: cfg.dashConstants ? cfg.dashConstants : null,\n urlUtils: cfg.urlUtils ? cfg.urlUtils : null,\n requestTimeout: !isNaN(cfg.requestTimeout) ? cfg.requestTimeout : 0,\n errors: cfg.errors\n });\n }\n\n loader.load(config);\n }\n\n function abort() {\n if (loader) {\n loader.abort();\n }\n }\n\n instance = {\n load: load,\n abort: abort\n };\n return instance;\n}\n\nURLLoader.__dashjs_factory_name = \'URLLoader\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(URLLoader);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/net/XHRLoader.js":\n/*!****************************************!*\\\n !*** ./src/streaming/net/XHRLoader.js ***!\n \\****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1859732__) {\n__nested_webpack_require_1859732__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1859732__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @module XHRLoader\n * @ignore\n * @description Manages download of resources via HTTP.\n * @param {Object} cfg - dependencies from parent\n */\n\nfunction XHRLoader(cfg) {\n cfg = cfg || {};\n var requestModifier = cfg.requestModifier;\n var instance;\n\n function load(httpRequest) {\n // Variables will be used in the callback functions\n var requestStartTime = new Date();\n var request = httpRequest.request;\n var xhr = new XMLHttpRequest();\n xhr.open(httpRequest.method, httpRequest.url, true);\n\n if (request.responseType) {\n xhr.responseType = request.responseType;\n }\n\n if (request.range) {\n xhr.setRequestHeader(\'Range\', \'bytes=\' + request.range);\n }\n\n if (!request.requestStartDate) {\n request.requestStartDate = requestStartTime;\n }\n\n if (requestModifier) {\n xhr = requestModifier.modifyRequestHeader(xhr);\n }\n\n if (httpRequest.headers) {\n for (var header in httpRequest.headers) {\n var value = httpRequest.headers[header];\n\n if (value) {\n xhr.setRequestHeader(header, value);\n }\n }\n }\n\n xhr.withCredentials = httpRequest.withCredentials;\n xhr.onload = httpRequest.onload;\n xhr.onloadend = httpRequest.onend;\n xhr.onerror = httpRequest.onerror;\n xhr.onprogress = httpRequest.progress;\n xhr.onabort = httpRequest.onabort;\n xhr.ontimeout = httpRequest.ontimeout;\n xhr.timeout = httpRequest.timeout;\n xhr.send();\n httpRequest.response = xhr;\n }\n\n function abort(request) {\n var x = request.response;\n x.onloadend = x.onerror = x.onprogress = undefined; //Ignore events from aborted requests.\n\n x.abort();\n }\n\n instance = {\n load: load,\n abort: abort\n };\n return instance;\n}\n\nXHRLoader.__dashjs_factory_name = \'XHRLoader\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(XHRLoader);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/CommonEncryption.js":\n/*!******************************************************!*\\\n !*** ./src/streaming/protection/CommonEncryption.js ***!\n \\******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1864072__) {\n__nested_webpack_require_1864072__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\nvar LICENSE_SERVER_MANIFEST_CONFIGURATIONS = {\n attributes: [\'Laurl\', \'laurl\'],\n prefixes: [\'clearkey\', \'dashif\']\n};\n/**\n * @class\n * @ignore\n */\n\nvar CommonEncryption = /*#__PURE__*/function () {\n function CommonEncryption() {\n _classCallCheck(this, CommonEncryption);\n }\n\n _createClass(CommonEncryption, null, [{\n key: "findCencContentProtection",\n value:\n /**\n * Find and return the ContentProtection element in the given array\n * that indicates support for MPEG Common Encryption\n *\n * @param {Array} cpArray array of content protection elements\n * @returns {Object|null} the Common Encryption content protection element or\n * null if one was not found\n */\n function findCencContentProtection(cpArray) {\n var retVal = null;\n\n for (var i = 0; i < cpArray.length; ++i) {\n var cp = cpArray[i];\n if (cp.schemeIdUri.toLowerCase() === \'urn:mpeg:dash:mp4protection:2011\' && (cp.value.toLowerCase() === \'cenc\' || cp.value.toLowerCase() === \'cbcs\')) retVal = cp;\n }\n\n return retVal;\n }\n /**\n * Returns just the data portion of a single PSSH\n *\n * @param {ArrayBuffer} pssh - the PSSH\n * @return {ArrayBuffer} data portion of the PSSH\n */\n\n }, {\n key: "getPSSHData",\n value: function getPSSHData(pssh) {\n var offset = 8; // Box size and type fields\n\n var view = new DataView(pssh); // Read version\n\n var version = view.getUint8(offset);\n offset += 20; // Version (1), flags (3), system ID (16)\n\n if (version > 0) {\n offset += 4 + 16 * view.getUint32(offset); // Key ID count (4) and All key IDs (16*count)\n }\n\n offset += 4; // Data size\n\n return pssh.slice(offset);\n }\n /**\n * Returns the PSSH associated with the given key system from the concatenated\n * list of PSSH boxes in the given initData\n *\n * @param {KeySystem} keySystem the desired\n * key system\n * @param {ArrayBuffer} initData \'cenc\' initialization data. Concatenated list of PSSH.\n * @returns {ArrayBuffer|null} The PSSH box data corresponding to the given key system, null if not found\n * or null if a valid association could not be found.\n */\n\n }, {\n key: "getPSSHForKeySystem",\n value: function getPSSHForKeySystem(keySystem, initData) {\n var psshList = CommonEncryption.parsePSSHList(initData);\n\n if (keySystem && psshList.hasOwnProperty(keySystem.uuid.toLowerCase())) {\n return psshList[keySystem.uuid.toLowerCase()];\n }\n\n return null;\n }\n /**\n * Parse a standard common encryption PSSH which contains a simple\n * base64-encoding of the init data\n *\n * @param {Object} cpData the ContentProtection element\n * @param {BASE64} BASE64 reference\n * @returns {ArrayBuffer|null} the init data or null if not found\n */\n\n }, {\n key: "parseInitDataFromContentProtection",\n value: function parseInitDataFromContentProtection(cpData, BASE64) {\n if (\'pssh\' in cpData) {\n // Remove whitespaces and newlines from pssh text\n cpData.pssh.__text = cpData.pssh.__text.replace(/\\r?\\n|\\r/g, \'\').replace(/\\s+/g, \'\');\n return BASE64.decodeArray(cpData.pssh.__text).buffer;\n }\n\n return null;\n }\n /**\n * Parses list of PSSH boxes into keysystem-specific PSSH data\n *\n * @param {ArrayBuffer} data - the concatenated list of PSSH boxes as provided by\n * CDM as initialization data when CommonEncryption content is detected\n * @returns {Object|Array} an object that has a property named according to each of\n * the detected key system UUIDs (e.g. 00000000-0000-0000-0000-0000000000)\n * and a ArrayBuffer (the entire PSSH box) as the property value\n */\n\n }, {\n key: "parsePSSHList",\n value: function parsePSSHList(data) {\n if (data === null || data === undefined) return [];\n var dv = new DataView(data.buffer || data); // data.buffer first for Uint8Array support\n\n var done = false;\n var pssh = {}; // TODO: Need to check every data read for end of buffer\n\n var byteCursor = 0;\n\n while (!done) {\n var size = void 0,\n nextBox = void 0,\n version = void 0,\n systemID = void 0;\n var boxStart = byteCursor;\n if (byteCursor >= dv.buffer.byteLength) break;\n /* Box size */\n\n size = dv.getUint32(byteCursor);\n nextBox = byteCursor + size;\n byteCursor += 4;\n /* Verify PSSH */\n\n if (dv.getUint32(byteCursor) !== 0x70737368) {\n byteCursor = nextBox;\n continue;\n }\n\n byteCursor += 4;\n /* Version must be 0 or 1 */\n\n version = dv.getUint8(byteCursor);\n\n if (version !== 0 && version !== 1) {\n byteCursor = nextBox;\n continue;\n }\n\n byteCursor++;\n byteCursor += 3;\n /* skip flags */\n // 16-byte UUID/SystemID\n\n systemID = \'\';\n var i = void 0,\n val = void 0;\n\n for (i = 0; i < 4; i++) {\n val = dv.getUint8(byteCursor + i).toString(16);\n systemID += val.length === 1 ? \'0\' + val : val;\n }\n\n byteCursor += 4;\n systemID += \'-\';\n\n for (i = 0; i < 2; i++) {\n val = dv.getUint8(byteCursor + i).toString(16);\n systemID += val.length === 1 ? \'0\' + val : val;\n }\n\n byteCursor += 2;\n systemID += \'-\';\n\n for (i = 0; i < 2; i++) {\n val = dv.getUint8(byteCursor + i).toString(16);\n systemID += val.length === 1 ? \'0\' + val : val;\n }\n\n byteCursor += 2;\n systemID += \'-\';\n\n for (i = 0; i < 2; i++) {\n val = dv.getUint8(byteCursor + i).toString(16);\n systemID += val.length === 1 ? \'0\' + val : val;\n }\n\n byteCursor += 2;\n systemID += \'-\';\n\n for (i = 0; i < 6; i++) {\n val = dv.getUint8(byteCursor + i).toString(16);\n systemID += val.length === 1 ? \'0\' + val : val;\n }\n\n byteCursor += 6;\n systemID = systemID.toLowerCase();\n /* PSSH Data Size */\n\n byteCursor += 4;\n /* PSSH Data */\n\n pssh[systemID] = dv.buffer.slice(boxStart, nextBox);\n byteCursor = nextBox;\n }\n\n return pssh;\n }\n }, {\n key: "getLicenseServerUrlFromMediaInfo",\n value: function getLicenseServerUrlFromMediaInfo(mediaInfo, schemeIdUri) {\n try {\n if (!mediaInfo || mediaInfo.length === 0) {\n return null;\n }\n\n var i = 0;\n var licenseServer = null;\n\n while (i < mediaInfo.length && !licenseServer) {\n var info = mediaInfo[i];\n\n if (info && info.contentProtection && info.contentProtection.length > 0) {\n var targetProtectionData = info.contentProtection.filter(function (cp) {\n return cp.schemeIdUri && cp.schemeIdUri === schemeIdUri;\n });\n\n if (targetProtectionData && targetProtectionData.length > 0) {\n var j = 0;\n\n while (j < targetProtectionData.length && !licenseServer) {\n var ckData = targetProtectionData[j];\n var k = 0;\n\n while (k < LICENSE_SERVER_MANIFEST_CONFIGURATIONS.attributes.length && !licenseServer) {\n var l = 0;\n var attribute = LICENSE_SERVER_MANIFEST_CONFIGURATIONS.attributes[k];\n\n while (l < LICENSE_SERVER_MANIFEST_CONFIGURATIONS.prefixes.length && !licenseServer) {\n var prefix = LICENSE_SERVER_MANIFEST_CONFIGURATIONS.prefixes[l];\n\n if (ckData[attribute] && ckData[attribute].__prefix && ckData[attribute].__prefix === prefix && ckData[attribute].__text) {\n licenseServer = ckData[attribute].__text;\n }\n\n l += 1;\n }\n\n k += 1;\n }\n\n j += 1;\n }\n }\n }\n\n i += 1;\n }\n\n return licenseServer;\n } catch (e) {\n return null;\n }\n }\n }]);\n\n return CommonEncryption;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (CommonEncryption);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/Protection.js":\n/*!************************************************!*\\\n !*** ./src/streaming/protection/Protection.js ***!\n \\************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1875181__) {\n__nested_webpack_require_1875181__.r(__nested_webpack_exports__);\n/* harmony import */ var _controllers_ProtectionController__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1875181__(/*! ./controllers/ProtectionController */ "./src/streaming/protection/controllers/ProtectionController.js");\n/* harmony import */ var _controllers_ProtectionKeyController__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1875181__(/*! ./controllers/ProtectionKeyController */ "./src/streaming/protection/controllers/ProtectionKeyController.js");\n/* harmony import */ var _ProtectionEvents__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1875181__(/*! ./ProtectionEvents */ "./src/streaming/protection/ProtectionEvents.js");\n/* harmony import */ var _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1875181__(/*! ./errors/ProtectionErrors */ "./src/streaming/protection/errors/ProtectionErrors.js");\n/* harmony import */ var _models_ProtectionModel_21Jan2015__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1875181__(/*! ./models/ProtectionModel_21Jan2015 */ "./src/streaming/protection/models/ProtectionModel_21Jan2015.js");\n/* harmony import */ var _models_ProtectionModel_3Feb2014__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1875181__(/*! ./models/ProtectionModel_3Feb2014 */ "./src/streaming/protection/models/ProtectionModel_3Feb2014.js");\n/* harmony import */ var _models_ProtectionModel_01b__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1875181__(/*! ./models/ProtectionModel_01b */ "./src/streaming/protection/models/ProtectionModel_01b.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\nvar APIS_ProtectionModel_01b = [// Un-prefixed as per spec\n{\n // Video Element\n generateKeyRequest: \'generateKeyRequest\',\n addKey: \'addKey\',\n cancelKeyRequest: \'cancelKeyRequest\',\n // Events\n needkey: \'needkey\',\n keyerror: \'keyerror\',\n keyadded: \'keyadded\',\n keymessage: \'keymessage\'\n}, // Webkit-prefixed (early Chrome versions and Chrome with EME disabled in chrome://flags)\n{\n // Video Element\n generateKeyRequest: \'webkitGenerateKeyRequest\',\n addKey: \'webkitAddKey\',\n cancelKeyRequest: \'webkitCancelKeyRequest\',\n // Events\n needkey: \'webkitneedkey\',\n keyerror: \'webkitkeyerror\',\n keyadded: \'webkitkeyadded\',\n keymessage: \'webkitkeymessage\'\n}];\nvar APIS_ProtectionModel_3Feb2014 = [// Un-prefixed as per spec\n// Chrome 38-39 (and some earlier versions) with chrome://flags -- Enable Encrypted Media Extensions\n{\n // Video Element\n setMediaKeys: \'setMediaKeys\',\n // MediaKeys\n MediaKeys: \'MediaKeys\',\n // MediaKeySession\n release: \'close\',\n // Events\n needkey: \'needkey\',\n error: \'keyerror\',\n message: \'keymessage\',\n ready: \'keyadded\',\n close: \'keyclose\'\n}, // MS-prefixed (IE11, Windows 8.1)\n{\n // Video Element\n setMediaKeys: \'msSetMediaKeys\',\n // MediaKeys\n MediaKeys: \'MSMediaKeys\',\n // MediaKeySession\n release: \'close\',\n // Events\n needkey: \'msneedkey\',\n error: \'mskeyerror\',\n message: \'mskeymessage\',\n ready: \'mskeyadded\',\n close: \'mskeyclose\'\n}];\n\nfunction Protection() {\n var instance;\n var context = this.context;\n /**\n * Create a ProtectionController and associated ProtectionModel for use with\n * a single piece of content.\n *\n * @param {Object} config\n * @return {ProtectionController} protection controller\n *\n */\n\n function createProtectionSystem(config) {\n var controller = null;\n var protectionKeyController = Object(_controllers_ProtectionKeyController__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance();\n protectionKeyController.setConfig({\n debug: config.debug,\n BASE64: config.BASE64\n });\n protectionKeyController.initialize();\n\n var protectionModel = _getProtectionModel(config);\n\n if (!controller && protectionModel) {\n //TODO add ability to set external controller if still needed at all?\n controller = Object(_controllers_ProtectionController__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create({\n protectionModel: protectionModel,\n protectionKeyController: protectionKeyController,\n eventBus: config.eventBus,\n debug: config.debug,\n events: config.events,\n BASE64: config.BASE64,\n constants: config.constants,\n cmcdModel: config.cmcdModel,\n settings: config.settings\n });\n config.capabilities.setEncryptedMediaSupported(true);\n }\n\n return controller;\n }\n\n function _getProtectionModel(config) {\n var debug = config.debug;\n var logger = debug.getLogger(instance);\n var eventBus = config.eventBus;\n var errHandler = config.errHandler;\n var videoElement = config.videoModel ? config.videoModel.getElement() : null;\n\n if ((!videoElement || videoElement.onencrypted !== undefined) && (!videoElement || videoElement.mediaKeys !== undefined)) {\n logger.info(\'EME detected on this user agent! (ProtectionModel_21Jan2015)\');\n return Object(_models_ProtectionModel_21Jan2015__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create({\n debug: debug,\n eventBus: eventBus,\n events: config.events\n });\n } else if (_getAPI(videoElement, APIS_ProtectionModel_3Feb2014)) {\n logger.info(\'EME detected on this user agent! (ProtectionModel_3Feb2014)\');\n return Object(_models_ProtectionModel_3Feb2014__WEBPACK_IMPORTED_MODULE_5__["default"])(context).create({\n debug: debug,\n eventBus: eventBus,\n events: config.events,\n api: _getAPI(videoElement, APIS_ProtectionModel_3Feb2014)\n });\n } else if (_getAPI(videoElement, APIS_ProtectionModel_01b)) {\n logger.info(\'EME detected on this user agent! (ProtectionModel_01b)\');\n return Object(_models_ProtectionModel_01b__WEBPACK_IMPORTED_MODULE_6__["default"])(context).create({\n debug: debug,\n eventBus: eventBus,\n errHandler: errHandler,\n events: config.events,\n api: _getAPI(videoElement, APIS_ProtectionModel_01b)\n });\n } else {\n logger.warn(\'No supported version of EME detected on this user agent! - Attempts to play encrypted content will fail!\');\n return null;\n }\n }\n\n function _getAPI(videoElement, apis) {\n for (var i = 0; i < apis.length; i++) {\n var api = apis[i]; // detect if api is supported by browser\n // check only first function in api -> should be fine\n\n if (typeof videoElement[api[Object.keys(api)[0]]] !== \'function\') {\n continue;\n }\n\n return api;\n }\n\n return null;\n }\n\n instance = {\n createProtectionSystem: createProtectionSystem\n };\n return instance;\n}\n\nProtection.__dashjs_factory_name = \'Protection\';\nvar factory = dashjs.FactoryMaker.getClassFactory(Protection);\n/* jshint ignore:line */\n\nfactory.events = _ProtectionEvents__WEBPACK_IMPORTED_MODULE_2__["default"];\nfactory.errors = _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"];\ndashjs.FactoryMaker.updateClassFactory(Protection.__dashjs_factory_name, factory);\n/* jshint ignore:line */\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/ProtectionEvents.js":\n/*!******************************************************!*\\\n !*** ./src/streaming/protection/ProtectionEvents.js ***!\n \\******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1884288__) {\n__nested_webpack_require_1884288__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_events_EventsBase__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1884288__(/*! ../../core/events/EventsBase */ "./src/core/events/EventsBase.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n */\n\nvar ProtectionEvents = /*#__PURE__*/function (_EventsBase) {\n _inherits(ProtectionEvents, _EventsBase);\n\n var _super = _createSuper(ProtectionEvents);\n\n /**\n * @description Public facing external events to be used when including protection package.\n * All public events will be aggregated into the MediaPlayerEvents Class and can be accessed\n * via MediaPlayer.events. public_ is the prefix that we use to move event names to MediaPlayerEvents.\n */\n function ProtectionEvents() {\n var _this;\n\n _classCallCheck(this, ProtectionEvents);\n\n _this = _super.call(this);\n /**\n * Event ID for events delivered when the protection set receives\n * a key message from the CDM\n *\n * @ignore\n */\n\n _this.INTERNAL_KEY_MESSAGE = \'internalKeyMessage\';\n /**\n * Event ID for events delivered when the status of one decryption keys has changed\n * @ignore\n */\n\n _this.INTERNAL_KEY_STATUS_CHANGED = \'internalkeyStatusChanged\';\n /**\n * Event ID for events delivered when a new key has been added\n *\n * @constant\n * @deprecated The latest versions of the EME specification no longer\n * use this event. {@MediaPlayer.models.protectionModel.eventList.KEY_STATUSES_CHANGED}\n * is preferred.\n * @event ProtectionEvents#KEY_ADDED\n */\n\n _this.KEY_ADDED = \'public_keyAdded\';\n /**\n * Event ID for events delivered when an error is encountered by the CDM\n * while processing a license server response message\n * @event ProtectionEvents#KEY_ERROR\n */\n\n _this.KEY_ERROR = \'public_keyError\';\n /**\n * Event ID for events delivered when the protection set receives\n * a key message from the CDM\n * @event ProtectionEvents#KEY_MESSAGE\n */\n\n _this.KEY_MESSAGE = \'public_keyMessage\';\n /**\n * Event ID for events delivered when a key session close\n * process has completed\n * @event ProtectionEvents#KEY_SESSION_CLOSED\n */\n\n _this.KEY_SESSION_CLOSED = \'public_keySessionClosed\';\n /**\n * Event ID for events delivered when a new key sessions creation\n * process has completed\n * @event ProtectionEvents#KEY_SESSION_CREATED\n */\n\n _this.KEY_SESSION_CREATED = \'public_keySessionCreated\';\n /**\n * Event ID for events delivered when a key session removal\n * process has completed\n * @event ProtectionEvents#KEY_SESSION_REMOVED\n */\n\n _this.KEY_SESSION_REMOVED = \'public_keySessionRemoved\';\n /**\n * Event ID for events delivered when the status of one or more\n * decryption keys has changed\n * @event ProtectionEvents#KEY_STATUSES_CHANGED\n */\n\n _this.KEY_STATUSES_CHANGED = \'public_keyStatusesChanged\';\n /**\n * Event ID for events delivered when a key system access procedure\n * has completed\n * @ignore\n */\n\n _this.KEY_SYSTEM_ACCESS_COMPLETE = \'public_keySystemAccessComplete\';\n /**\n * Event ID for events delivered when a key system selection procedure\n * completes\n * @event ProtectionEvents#KEY_SYSTEM_SELECTED\n */\n\n _this.KEY_SYSTEM_SELECTED = \'public_keySystemSelected\';\n /**\n * Event ID for events delivered when a license request procedure\n * has completed\n * @event ProtectionEvents#LICENSE_REQUEST_COMPLETE\n */\n\n _this.LICENSE_REQUEST_COMPLETE = \'public_licenseRequestComplete\';\n /**\n * Sending a license rquest\n * @event ProtectionEvents#LICENSE_REQUEST_SENDING\n */\n\n _this.LICENSE_REQUEST_SENDING = \'public_licenseRequestSending\';\n /**\n * Event ID for needkey/encrypted events\n * @ignore\n */\n\n _this.NEED_KEY = \'needkey\';\n /**\n * Event ID for events delivered when the Protection system is detected and created.\n * @event ProtectionEvents#PROTECTION_CREATED\n */\n\n _this.PROTECTION_CREATED = \'public_protectioncreated\';\n /**\n * Event ID for events delivered when the Protection system is destroyed.\n * @event ProtectionEvents#PROTECTION_DESTROYED\n */\n\n _this.PROTECTION_DESTROYED = \'public_protectiondestroyed\';\n /**\n * Event ID for events delivered when a new server certificate has\n * been delivered to the CDM\n * @ignore\n */\n\n _this.SERVER_CERTIFICATE_UPDATED = \'serverCertificateUpdated\';\n /**\n * Event ID for events delivered when the process of shutting down\n * a protection set has completed\n * @ignore\n */\n\n _this.TEARDOWN_COMPLETE = \'protectionTeardownComplete\';\n /**\n * Event ID for events delivered when a HTMLMediaElement has been\n * associated with the protection set\n * @ignore\n */\n\n _this.VIDEO_ELEMENT_SELECTED = \'videoElementSelected\';\n /**\n * Triggered when the key session has been updated successfully\n * @ignore\n */\n\n _this.KEY_SESSION_UPDATED = \'public_keySessionUpdated\';\n return _this;\n }\n\n return ProtectionEvents;\n}(_core_events_EventsBase__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\nvar protectionEvents = new ProtectionEvents();\n/* harmony default export */ __nested_webpack_exports__["default"] = (protectionEvents);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/controllers/ProtectionController.js":\n/*!**********************************************************************!*\\\n !*** ./src/streaming/protection/controllers/ProtectionController.js ***!\n \\**********************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1894241__) {\n__nested_webpack_require_1894241__.r(__nested_webpack_exports__);\n/* harmony import */ var _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1894241__(/*! ../CommonEncryption */ "./src/streaming/protection/CommonEncryption.js");\n/* harmony import */ var _vo_MediaCapability__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1894241__(/*! ../vo/MediaCapability */ "./src/streaming/protection/vo/MediaCapability.js");\n/* harmony import */ var _vo_KeySystemConfiguration__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1894241__(/*! ../vo/KeySystemConfiguration */ "./src/streaming/protection/vo/KeySystemConfiguration.js");\n/* harmony import */ var _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1894241__(/*! ../errors/ProtectionErrors */ "./src/streaming/protection/errors/ProtectionErrors.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1894241__(/*! ../../vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _vo_LicenseRequest__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1894241__(/*! ../vo/LicenseRequest */ "./src/streaming/protection/vo/LicenseRequest.js");\n/* harmony import */ var _vo_LicenseResponse__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1894241__(/*! ../vo/LicenseResponse */ "./src/streaming/protection/vo/LicenseResponse.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1894241__(/*! ../../vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _core_Utils__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1894241__(/*! ../../../core/Utils */ "./src/core/Utils.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1894241__(/*! ../../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_1894241__(/*! ../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\nvar NEEDKEY_BEFORE_INITIALIZE_RETRIES = 5;\nvar NEEDKEY_BEFORE_INITIALIZE_TIMEOUT = 500;\nvar LICENSE_SERVER_REQUEST_RETRIES = 3;\nvar LICENSE_SERVER_REQUEST_RETRY_INTERVAL = 1000;\nvar LICENSE_SERVER_REQUEST_DEFAULT_TIMEOUT = 8000;\n/**\n * @module ProtectionController\n * @description Provides access to media protection information and functionality. Each\n * ProtectionController manages a single {@link MediaPlayer.models.ProtectionModel}\n * which encapsulates a set of protection information (EME APIs, selected key system,\n * key sessions). The APIs of ProtectionController mostly align with the latest EME\n * APIs. Key system selection is mostly automated when combined with app-overrideable\n * functionality provided in {@link ProtectionKeyController}.\n * @todo ProtectionController does almost all of its tasks automatically after init() is\n * called. Applications might want more control over this process and want to go through\n * each step manually (key system selection, session creation, session maintenance).\n * This module can be accessed using the MediaPlayer API getProtectionController()\n * @param {Object} config\n */\n\nfunction ProtectionController(config) {\n config = config || {};\n var protectionKeyController = config.protectionKeyController;\n var protectionModel = config.protectionModel;\n var eventBus = config.eventBus;\n var events = config.events;\n var debug = config.debug;\n var BASE64 = config.BASE64;\n var constants = config.constants;\n var needkeyRetries = [];\n var cmcdModel = config.cmcdModel;\n var settings = config.settings;\n var instance, logger, pendingKeySystemData, mediaInfoArr, protDataSet, sessionType, robustnessLevel, selectedKeySystem, keySystemSelectionInProgress, licenseRequestFilters, licenseResponseFilters;\n\n function setup() {\n logger = debug.getLogger(instance);\n pendingKeySystemData = [];\n mediaInfoArr = [];\n sessionType = \'temporary\';\n robustnessLevel = \'\';\n licenseRequestFilters = [];\n licenseResponseFilters = [];\n eventBus.on(events.INTERNAL_KEY_MESSAGE, _onKeyMessage, instance);\n eventBus.on(events.INTERNAL_KEY_STATUS_CHANGED, _onKeyStatusChanged, instance);\n }\n\n function checkConfig() {\n if (!eventBus || !eventBus.hasOwnProperty(\'on\') || !protectionKeyController || !protectionKeyController.hasOwnProperty(\'getSupportedKeySystemsFromContentProtection\')) {\n throw new Error(\'Missing config parameter(s)\');\n }\n }\n /**\n * Initialize this protection system for a given media type.\n *\n * @param {StreamInfo} [mediaInfo] Media information\n * @memberof module:ProtectionController\n * @instance\n */\n\n\n function initializeForMedia(mediaInfo) {\n // Not checking here if a session for similar KS/KID combination is already created\n // because still don\'t know which keysystem will be selected.\n // Once Keysystem is selected and before creating the session, we will do that check\n // so we create the strictly necessary DRM sessions\n if (!mediaInfo) {\n throw new Error(\'mediaInfo can not be null or undefined\');\n }\n\n checkConfig();\n mediaInfoArr.push(mediaInfo); // ContentProtection elements are specified at the AdaptationSet level, so the CP for audio\n // and video will be the same. Just use one valid MediaInfo object\n\n var supportedKS = protectionKeyController.getSupportedKeySystemsFromContentProtection(mediaInfo.contentProtection, protDataSet, sessionType); // Reorder key systems according to priority order provided in protectionData\n\n supportedKS = supportedKS.sort(function (ksA, ksB) {\n var indexA = protDataSet && protDataSet[ksA.ks.systemString] && protDataSet[ksA.ks.systemString].priority >= 0 ? protDataSet[ksA.ks.systemString].priority : supportedKS.length;\n var indexB = protDataSet && protDataSet[ksB.ks.systemString] && protDataSet[ksB.ks.systemString].priority >= 0 ? protDataSet[ksB.ks.systemString].priority : supportedKS.length;\n return indexA - indexB;\n });\n\n if (supportedKS && supportedKS.length > 0) {\n _selectKeySystem(supportedKS, true);\n }\n }\n /**\n * Selects a key system if we dont have any one yet. Otherwise we use the existing key system and trigger a new license request if the initdata has changed\n * @param {array} supportedKS\n * @param {boolean} fromManifest\n * @private\n */\n\n\n function _selectKeySystem(supportedKS, fromManifest) {\n // We are in the process of selecting a key system, so just save the data which might be coming from additional AdaptationSets.\n if (keySystemSelectionInProgress) {\n pendingKeySystemData.push(supportedKS);\n } // First time, so we need to select a key system\n else if (!selectedKeySystem) {\n _selectInitialKeySystem(supportedKS, fromManifest);\n } // We already selected a key system. We only need to trigger a new license exchange if the init data has changed\n else if (selectedKeySystem) {\n _initiateWithExistingKeySystem(supportedKS);\n }\n }\n /**\n * We do not have a key system yet. Select one\n * @param {array} supportedKS\n * @param {boolean} fromManifest\n * @private\n */\n\n\n function _selectInitialKeySystem(supportedKS, fromManifest) {\n keySystemSelectionInProgress = true;\n var requestedKeySystems = [];\n pendingKeySystemData.push(supportedKS); // Add all key systems to our request list since we have yet to select a key system\n\n for (var i = 0; i < supportedKS.length; i++) {\n var keySystemConfiguration = _getKeySystemConfiguration(supportedKS[i]);\n\n requestedKeySystems.push({\n ks: supportedKS[i].ks,\n configs: [keySystemConfiguration]\n });\n }\n\n var keySystemAccess;\n protectionModel.requestKeySystemAccess(requestedKeySystems).then(function (event) {\n keySystemAccess = event.data;\n logger.info(\'DRM: KeySystem Access Granted (\' + keySystemAccess.keySystem.systemString + \')! Selecting key system...\');\n return protectionModel.selectKeySystem(keySystemAccess);\n }).then(function (keySystem) {\n selectedKeySystem = keySystem;\n keySystemSelectionInProgress = false;\n\n if (!protectionModel) {\n return;\n }\n\n eventBus.trigger(events.KEY_SYSTEM_SELECTED, {\n data: keySystemAccess\n }); // Set server certificate from protData\n\n var protData = _getProtDataForKeySystem(selectedKeySystem);\n\n if (protData && protData.serverCertificate && protData.serverCertificate.length > 0) {\n protectionModel.setServerCertificate(BASE64.decodeArray(protData.serverCertificate).buffer);\n } // Create key sessions for the different AdaptationSets\n\n\n var ksIdx;\n\n for (var _i = 0; _i < pendingKeySystemData.length; _i++) {\n for (ksIdx = 0; ksIdx < pendingKeySystemData[_i].length; ksIdx++) {\n if (selectedKeySystem === pendingKeySystemData[_i][ksIdx].ks) {\n var current = pendingKeySystemData[_i][ksIdx];\n\n _loadOrCreateKeySession(current);\n\n break;\n }\n }\n }\n })["catch"](function (event) {\n selectedKeySystem = null;\n keySystemSelectionInProgress = false;\n\n if (!fromManifest) {\n eventBus.trigger(events.KEY_SYSTEM_SELECTED, {\n data: null,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_4__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE + \'Error selecting key system! -- \' + event.error)\n });\n }\n });\n }\n /**\n * If we have already selected a keysytem we only need to create a new key session and issue a new license request if the init data has changed.\n * @param {array} supportedKS\n * @private\n */\n\n\n function _initiateWithExistingKeySystem(supportedKS) {\n var ksIdx = supportedKS.findIndex(function (entry) {\n return entry.ks === selectedKeySystem;\n });\n var current = supportedKS[ksIdx];\n\n if (ksIdx === -1 || !current.initData) {\n return;\n }\n\n _loadOrCreateKeySession(current);\n }\n /**\n * Loads an existing key session if we already have a session id. Otherwise we create a new key session\n * @param {object} keySystemInfo\n * @private\n */\n\n\n function _loadOrCreateKeySession(keySystemInfo) {\n // Clearkey\n if (protectionKeyController.isClearKey(selectedKeySystem)) {\n // For Clearkey: if parameters for generating init data was provided by the user, use them for generating\n // initData and overwrite possible initData indicated in encrypted event (EME)\n if (keySystemInfo.protData && keySystemInfo.protData.hasOwnProperty(\'clearkeys\')) {\n var initData = {\n kids: Object.keys(keySystemInfo.protData.clearkeys)\n };\n keySystemInfo.initData = new TextEncoder().encode(JSON.stringify(initData));\n }\n } // Reuse existing KeySession\n\n\n if (keySystemInfo.sessionId) {\n // Load MediaKeySession with sessionId\n loadKeySession(keySystemInfo);\n } // Create a new KeySession\n else if (keySystemInfo.initData !== null) {\n // Create new MediaKeySession with initData\n createKeySession(keySystemInfo);\n }\n }\n /**\n * Loads a key session with the given session ID from persistent storage. This essentially creates a new key session\n *\n * @param {object} ksInfo\n * @memberof module:ProtectionController\n * @instance\n * @fires ProtectionController#KeySessionCreated\n * @ignore\n */\n\n\n function loadKeySession(keySystemInfo) {\n checkConfig();\n protectionModel.loadKeySession(keySystemInfo);\n }\n /**\n * Create a new key session associated with the given initialization data from the MPD or from the PSSH box in the media\n * For the latest version of the EME a request is generated. Once this request is ready we get notified via the INTERNAL_KEY_MESSAGE event\n * @param {ArrayBuffer} initData the initialization data\n * @param {Uint8Array} cdmData the custom data to provide to licenser\n * @memberof module:ProtectionController\n * @instance\n * @fires ProtectionController#KeySessionCreated\n * @ignore\n */\n\n\n function createKeySession(keySystemInfo) {\n var initDataForKS = _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__["default"].getPSSHForKeySystem(selectedKeySystem, keySystemInfo ? keySystemInfo.initData : null);\n\n if (initDataForKS) {\n // Check for duplicate key id\n if (_isKeyIdDuplicate(keySystemInfo.keyId)) {\n return;\n } // Check for duplicate initData\n\n\n if (_isInitDataDuplicate(initDataForKS)) {\n return;\n }\n\n try {\n keySystemInfo.initData = initDataForKS;\n protectionModel.createKeySession(keySystemInfo);\n } catch (error) {\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: null,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_4__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].KEY_SESSION_CREATED_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].KEY_SESSION_CREATED_ERROR_MESSAGE + error.message)\n });\n }\n } else if (keySystemInfo && keySystemInfo.initData) {\n protectionModel.createKeySession(keySystemInfo);\n } else {\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: null,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_4__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].KEY_SESSION_CREATED_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].KEY_SESSION_CREATED_ERROR_MESSAGE + \'Selected key system is \' + (selectedKeySystem ? selectedKeySystem.systemString : null) + \'. needkey/encrypted event contains no initData corresponding to that key system!\')\n });\n }\n }\n /**\n * Returns the protectionData for a specific keysystem as specified by the application.\n * @param {object} keySystem\n * @return {object | null}\n * @private\n */\n\n\n function _getProtDataForKeySystem(keySystem) {\n if (keySystem) {\n var keySystemString = keySystem.systemString;\n\n if (protDataSet) {\n return keySystemString in protDataSet ? protDataSet[keySystemString] : null;\n }\n }\n\n return null;\n }\n /**\n * Removes all entries from the mediaInfoArr\n */\n\n\n function clearMediaInfoArray() {\n mediaInfoArr = [];\n }\n /**\n * Returns a set of supported key systems and CENC initialization data\n * from the given array of ContentProtection elements. Only\n * key systems that are supported by this player will be returned.\n * Key systems are returned in priority order (highest first).\n *\n * @param {Array.<Object>} cps - array of content protection elements parsed\n * from the manifest\n * @returns {Array.<Object>} array of objects indicating which supported key\n * systems were found. Empty array is returned if no\n * supported key systems were found\n * @memberof module:ProtectionKeyController\n * @instance\n * @ignore\n */\n\n\n function getSupportedKeySystemsFromContentProtection(cps) {\n checkConfig();\n return protectionKeyController.getSupportedKeySystemsFromContentProtection(cps, protDataSet, sessionType);\n }\n /**\n * Checks if a session has already created for the provided key id\n * @param {string} keyId\n * @return {boolean}\n * @private\n */\n\n\n function _isKeyIdDuplicate(keyId) {\n if (!keyId) {\n return false;\n }\n\n try {\n var sessions = protectionModel.getSessions();\n\n for (var i = 0; i < sessions.length; i++) {\n if (sessions[i].getKeyId() === keyId) {\n return true;\n }\n }\n\n return false;\n } catch (e) {\n return false;\n }\n }\n /**\n * Checks if the provided init data is equal to one of the existing init data values\n * @param {any} initDataForKS\n * @return {boolean}\n * @private\n */\n\n\n function _isInitDataDuplicate(initDataForKS) {\n if (!initDataForKS) {\n return false;\n }\n\n try {\n var currentInitData = protectionModel.getAllInitData();\n\n for (var i = 0; i < currentInitData.length; i++) {\n if (protectionKeyController.initDataEquals(initDataForKS, currentInitData[i])) {\n logger.debug(\'DRM: Ignoring initData because we have already seen it!\');\n return true;\n }\n }\n\n return false;\n } catch (e) {\n return false;\n }\n }\n /**\n * Removes the given key session from persistent storage and closes the session\n * as if {@link ProtectionController#closeKeySession}\n * was called\n *\n * @param {SessionToken} sessionToken the session\n * token\n * @memberof module:ProtectionController\n * @instance\n * @fires ProtectionController#KeySessionRemoved\n * @fires ProtectionController#KeySessionClosed\n * @ignore\n */\n\n\n function removeKeySession(sessionToken) {\n checkConfig();\n protectionModel.removeKeySession(sessionToken);\n }\n /**\n * Closes the key session and releases all associated decryption keys. These\n * keys will no longer be available for decrypting media\n *\n * @param {SessionToken} sessionToken the session\n * token\n * @memberof module:ProtectionController\n * @instance\n * @fires ProtectionController#KeySessionClosed\n * @ignore\n */\n\n\n function closeKeySession(sessionToken) {\n checkConfig();\n protectionModel.closeKeySession(sessionToken);\n }\n /**\n * Sets a server certificate for use by the CDM when signing key messages\n * intended for a particular license server. This will fire\n * an error event if a key system has not yet been selected.\n *\n * @param {ArrayBuffer} serverCertificate a CDM-specific license server\n * certificate\n * @memberof module:ProtectionController\n * @instance\n * @fires ProtectionController#ServerCertificateUpdated\n */\n\n\n function setServerCertificate(serverCertificate) {\n checkConfig();\n protectionModel.setServerCertificate(serverCertificate);\n }\n /**\n * Associate this protection system with the given HTMLMediaElement. This\n * causes the system to register for needkey/encrypted events from the given\n * element and provides a destination for setting of MediaKeys\n *\n * @param {HTMLMediaElement} element the media element to which the protection\n * system should be associated\n * @memberof module:ProtectionController\n * @instance\n */\n\n\n function setMediaElement(element) {\n checkConfig();\n\n if (element) {\n protectionModel.setMediaElement(element);\n eventBus.on(events.NEED_KEY, _onNeedKey, instance);\n } else if (element === null) {\n protectionModel.setMediaElement(element);\n eventBus.off(events.NEED_KEY, _onNeedKey, instance);\n }\n }\n /**\n * Sets the session type to use when creating key sessions. Either "temporary" or\n * "persistent-license". Default is "temporary".\n *\n * @param {string} value the session type\n * @memberof module:ProtectionController\n * @instance\n */\n\n\n function setSessionType(value) {\n sessionType = value;\n }\n /**\n * Sets the robustness level for video and audio capabilities. Optional to remove Chrome warnings.\n * Possible values are SW_SECURE_CRYPTO, SW_SECURE_DECODE, HW_SECURE_CRYPTO, HW_SECURE_CRYPTO, HW_SECURE_DECODE, HW_SECURE_ALL.\n *\n * @param {string} level the robustness level\n * @memberof module:ProtectionController\n * @instance\n */\n\n\n function setRobustnessLevel(level) {\n robustnessLevel = level;\n }\n /**\n * Attach KeySystem-specific data to use for license acquisition with EME\n *\n * @param {Object} data an object containing property names corresponding to\n * key system name strings (e.g. "org.w3.clearkey") and associated values\n * being instances of {@link ProtectionData}\n * @memberof module:ProtectionController\n * @instance\n * @ignore\n */\n\n\n function setProtectionData(data) {\n protDataSet = data;\n protectionKeyController.setProtectionData(data);\n }\n /**\n * Stop method is called when current playback is stopped/resetted.\n *\n * @memberof module:ProtectionController\n * @instance\n */\n\n\n function stop() {\n if (protectionModel) {\n protectionModel.stop();\n }\n }\n /**\n * Destroys all protection data associated with this protection set. This includes\n * deleting all key sessions. In the case of persistent key sessions, the sessions\n * will simply be unloaded and not deleted. Additionally, if this protection set is\n * associated with a HTMLMediaElement, it will be detached from that element.\n *\n * @memberof module:ProtectionController\n * @instance\n * @ignore\n */\n\n\n function reset() {\n eventBus.off(events.INTERNAL_KEY_MESSAGE, _onKeyMessage, instance);\n eventBus.off(events.INTERNAL_KEY_STATUS_CHANGED, _onKeyStatusChanged, instance);\n checkConfig();\n licenseRequestFilters = [];\n licenseResponseFilters = [];\n setMediaElement(null);\n selectedKeySystem = null;\n keySystemSelectionInProgress = false;\n\n if (protectionModel) {\n protectionModel.reset();\n protectionModel = null;\n }\n\n needkeyRetries.forEach(function (retryTimeout) {\n return clearTimeout(retryTimeout);\n });\n needkeyRetries = [];\n mediaInfoArr = [];\n pendingKeySystemData = [];\n }\n /**\n * Returns an object corresponding to the EME MediaKeySystemConfiguration dictionary\n * @param {object} keySystem\n * @return {KeySystemConfiguration}\n * @private\n */\n\n\n function _getKeySystemConfiguration(keySystemData) {\n var protData = keySystemData.protData;\n var audioCapabilities = [];\n var videoCapabilities = [];\n var audioRobustness = protData && protData.audioRobustness && protData.audioRobustness.length > 0 ? protData.audioRobustness : robustnessLevel;\n var videoRobustness = protData && protData.videoRobustness && protData.videoRobustness.length > 0 ? protData.videoRobustness : robustnessLevel;\n var ksSessionType = keySystemData.sessionType;\n var distinctiveIdentifier = protData && protData.distinctiveIdentifier ? protData.distinctiveIdentifier : \'optional\';\n var persistentState = protData && protData.persistentState ? protData.persistentState : ksSessionType === \'temporary\' ? \'optional\' : \'required\';\n mediaInfoArr.forEach(function (media) {\n if (media.type === constants.AUDIO) {\n audioCapabilities.push(new _vo_MediaCapability__WEBPACK_IMPORTED_MODULE_1__["default"](media.codec, audioRobustness));\n } else if (media.type === constants.VIDEO) {\n videoCapabilities.push(new _vo_MediaCapability__WEBPACK_IMPORTED_MODULE_1__["default"](media.codec, videoRobustness));\n }\n });\n return new _vo_KeySystemConfiguration__WEBPACK_IMPORTED_MODULE_2__["default"](audioCapabilities, videoCapabilities, distinctiveIdentifier, persistentState, [ksSessionType]);\n }\n /**\n * Event handler for when the status of the key has changed\n * @param {object} e\n * @private\n */\n\n\n function _onKeyStatusChanged(e) {\n if (e.error) {\n eventBus.trigger(events.KEY_STATUSES_CHANGED, {\n data: null,\n error: e.error\n });\n } else {\n logger.debug(\'DRM: key status = \' + e.status);\n }\n }\n /**\n * Event handler for the key message event. Once we have a key message we can issue a license request\n * @param {object} e\n * @private\n */\n\n\n function _onKeyMessage(e) {\n logger.debug(\'DRM: onKeyMessage\'); // Dispatch event to applications indicating we received a key message\n\n var keyMessage = e.data;\n eventBus.trigger(events.KEY_MESSAGE, {\n data: keyMessage\n });\n var messageType = keyMessage.messageType ? keyMessage.messageType : \'license-request\';\n var message = keyMessage.message;\n var sessionToken = keyMessage.sessionToken;\n\n var protData = _getProtDataForKeySystem(selectedKeySystem);\n\n var licenseServerModelInstance = protectionKeyController.getLicenseServerModelInstance(selectedKeySystem, protData, messageType);\n var eventData = {\n sessionToken: sessionToken,\n messageType: messageType\n }; // Ensure message from CDM is not empty\n\n if (!message || message.byteLength === 0) {\n _sendLicenseRequestCompleteEvent(eventData, new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_4__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE));\n\n return;\n } // Message not destined for license server\n\n\n if (!licenseServerModelInstance) {\n logger.debug(\'DRM: License server request not required for this message (type = \' + e.data.messageType + \'). Session ID = \' + sessionToken.getSessionId());\n\n _sendLicenseRequestCompleteEvent(eventData);\n\n return;\n } // Perform any special handling for ClearKey\n\n\n if (protectionKeyController.isClearKey(selectedKeySystem)) {\n var clearkeys = protectionKeyController.processClearKeyLicenseRequest(selectedKeySystem, protData, message);\n\n if (clearkeys) {\n logger.debug(\'DRM: ClearKey license request handled by application!\');\n\n _sendLicenseRequestCompleteEvent(eventData);\n\n protectionModel.updateKeySession(sessionToken, clearkeys);\n return;\n }\n } // In all other cases we have to make a license request\n\n\n _issueLicenseRequest(keyMessage, licenseServerModelInstance, protData);\n }\n /**\n * Notify other classes that the license request was completed\n * @param {object} data\n * @param {object} error\n * @private\n */\n\n\n function _sendLicenseRequestCompleteEvent(data, error) {\n eventBus.trigger(events.LICENSE_REQUEST_COMPLETE, {\n data: data,\n error: error\n });\n }\n /**\n * Start issuing a license request\n * @param {object} keyMessage\n * @param {object} licenseServerData\n * @param {object} protData\n * @private\n */\n\n\n function _issueLicenseRequest(keyMessage, licenseServerData, protData) {\n var sessionToken = keyMessage.sessionToken;\n var messageType = keyMessage.messageType ? keyMessage.messageType : \'license-request\';\n var eventData = {\n sessionToken: sessionToken,\n messageType: messageType\n };\n var keySystemString = selectedKeySystem ? selectedKeySystem.systemString : null; // Determine license server URL\n\n var url = _getLicenseServerUrl(protData, messageType, sessionToken, keyMessage, licenseServerData); // Ensure valid license server URL\n\n\n if (!url) {\n _sendLicenseRequestCompleteEvent(eventData, new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_4__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE));\n\n return;\n } // Set optional XMLHttpRequest headers from protection data and message\n\n\n var reqHeaders = {};\n var withCredentials = false;\n\n if (protData) {\n _updateHeaders(reqHeaders, protData.httpRequestHeaders);\n }\n\n var message = keyMessage.message;\n var headersFromMessage = selectedKeySystem.getRequestHeadersFromMessage(message);\n\n _updateHeaders(reqHeaders, headersFromMessage);\n\n Object.keys(reqHeaders).forEach(function (key) {\n if (\'authorization\' === key.toLowerCase()) {\n withCredentials = true;\n }\n }); // Overwrite withCredentials property from protData if present\n\n if (protData && typeof protData.withCredentials == \'boolean\') {\n withCredentials = protData.withCredentials;\n }\n\n var onLoad = function onLoad(xhr) {\n if (!protectionModel) {\n return;\n }\n\n if (xhr.status >= 200 && xhr.status <= 299) {\n var responseHeaders = _core_Utils__WEBPACK_IMPORTED_MODULE_8__["default"].parseHttpHeaders(xhr.getAllResponseHeaders ? xhr.getAllResponseHeaders() : null);\n var licenseResponse = new _vo_LicenseResponse__WEBPACK_IMPORTED_MODULE_6__["default"](xhr.responseURL, responseHeaders, xhr.response);\n\n _applyFilters(licenseResponseFilters, licenseResponse).then(function () {\n var licenseMessage = licenseServerData.getLicenseMessage(licenseResponse.data, keySystemString, messageType);\n\n if (licenseMessage !== null) {\n _sendLicenseRequestCompleteEvent(eventData);\n\n protectionModel.updateKeySession(sessionToken, licenseMessage);\n } else {\n _reportError(xhr, eventData, keySystemString, messageType, licenseServerData);\n }\n });\n } else {\n _reportError(xhr, eventData, keySystemString, messageType, licenseServerData);\n }\n };\n\n var onAbort = function onAbort(xhr) {\n _sendLicenseRequestCompleteEvent(eventData, new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_4__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE + keySystemString + \' update, XHR aborted. status is "\' + xhr.statusText + \'" (\' + xhr.status + \'), readyState is \' + xhr.readyState));\n };\n\n var onError = function onError(xhr) {\n _sendLicenseRequestCompleteEvent(eventData, new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_4__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE + keySystemString + \' update, XHR error. status is "\' + xhr.statusText + \'" (\' + xhr.status + \'), readyState is \' + xhr.readyState));\n };\n\n var reqPayload = selectedKeySystem.getLicenseRequestFromMessage(message);\n var reqMethod = licenseServerData.getHTTPMethod(messageType);\n var responseType = licenseServerData.getResponseType(keySystemString, messageType);\n var timeout = protData && !isNaN(protData.httpTimeout) ? protData.httpTimeout : LICENSE_SERVER_REQUEST_DEFAULT_TIMEOUT;\n var sessionId = sessionToken.getSessionId() || null;\n var licenseRequest = new _vo_LicenseRequest__WEBPACK_IMPORTED_MODULE_5__["default"](url, reqMethod, responseType, reqHeaders, withCredentials, messageType, sessionId, reqPayload);\n var retryAttempts = !isNaN(settings.get().streaming.retryAttempts[_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_7__["HTTPRequest"].LICENSE]) ? settings.get().streaming.retryAttempts[_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_7__["HTTPRequest"].LICENSE] : LICENSE_SERVER_REQUEST_RETRIES;\n\n _applyFilters(licenseRequestFilters, licenseRequest).then(function () {\n _doLicenseRequest(licenseRequest, retryAttempts, timeout, onLoad, onAbort, onError);\n });\n }\n /**\n * Implement license requests with a retry mechanism to avoid temporary network issues to affect playback experience\n * @param {object} request\n * @param {number} retriesCount\n * @param {number} timeout\n * @param {function} onLoad\n * @param {function} onAbort\n * @param {function} onError\n * @private\n */\n\n\n function _doLicenseRequest(request, retriesCount, timeout, onLoad, onAbort, onError) {\n var xhr = new XMLHttpRequest();\n\n if (settings.get().streaming.cmcd && settings.get().streaming.cmcd.enabled) {\n var cmcdMode = settings.get().streaming.cmcd.mode;\n\n if (cmcdMode === _constants_Constants__WEBPACK_IMPORTED_MODULE_9__["default"].CMCD_MODE_QUERY) {\n var cmcdParams = cmcdModel.getQueryParameter({\n url: request.url,\n type: _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_7__["HTTPRequest"].LICENSE\n });\n\n if (cmcdParams) {\n request.url = _core_Utils__WEBPACK_IMPORTED_MODULE_8__["default"].addAditionalQueryParameterToUrl(request.url, [cmcdParams]);\n }\n }\n }\n\n xhr.open(request.method, request.url, true);\n xhr.responseType = request.responseType;\n xhr.withCredentials = request.withCredentials;\n\n if (timeout > 0) {\n xhr.timeout = timeout;\n }\n\n for (var key in request.headers) {\n xhr.setRequestHeader(key, request.headers[key]);\n }\n\n if (settings.get().streaming.cmcd && settings.get().streaming.cmcd.enabled) {\n var _cmcdMode = settings.get().streaming.cmcd.mode;\n\n if (_cmcdMode === _constants_Constants__WEBPACK_IMPORTED_MODULE_9__["default"].CMCD_MODE_HEADER) {\n var cmcdHeaders = cmcdModel.getHeaderParameters({\n url: request.url,\n type: _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_7__["HTTPRequest"].LICENSE\n });\n\n if (cmcdHeaders) {\n for (var header in cmcdHeaders) {\n var value = cmcdHeaders[header];\n\n if (value) {\n xhr.setRequestHeader(header, value);\n }\n }\n }\n }\n }\n\n var _retryRequest = function _retryRequest() {\n // fail silently and retry\n retriesCount--;\n var retryInterval = !isNaN(settings.get().streaming.retryIntervals[_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_7__["HTTPRequest"].LICENSE]) ? settings.get().streaming.retryIntervals[_vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_7__["HTTPRequest"].LICENSE] : LICENSE_SERVER_REQUEST_RETRY_INTERVAL;\n setTimeout(function () {\n _doLicenseRequest(request, retriesCount, timeout, onLoad, onAbort, onError);\n }, retryInterval);\n };\n\n xhr.onload = function () {\n if (this.status >= 200 && this.status <= 299 || retriesCount <= 0) {\n onLoad(this);\n } else {\n logger.warn(\'License request failed (\' + this.status + \'). Retrying it... Pending retries: \' + retriesCount);\n\n _retryRequest();\n }\n };\n\n xhr.ontimeout = xhr.onerror = function () {\n if (retriesCount <= 0) {\n onError(this);\n } else {\n logger.warn(\'License request network request failed . Retrying it... Pending retries: \' + retriesCount);\n\n _retryRequest();\n }\n };\n\n xhr.onabort = function () {\n onAbort(this);\n }; // deprecated, to be removed\n\n\n eventBus.trigger(events.LICENSE_REQUEST_SENDING, {\n url: request.url,\n headers: request.headers,\n payload: request.data,\n sessionId: request.sessionId\n });\n xhr.send(request.data);\n }\n /**\n * Returns the url of the license server\n * @param {object} protData\n * @param {string} messageType\n * @param {object} sessionToken\n * @param {object} keyMessage\n * @param {object} licenseServerData\n * @return {*}\n * @private\n */\n\n\n function _getLicenseServerUrl(protData, messageType, sessionToken, keyMessage, licenseServerData) {\n var url = null;\n var message = keyMessage.message; // Check if the url is defined by the application\n\n if (protData && protData.serverURL) {\n var serverURL = protData.serverURL;\n\n if (typeof serverURL === \'string\' && serverURL !== \'\') {\n url = serverURL;\n } else if (_typeof(serverURL) === \'object\' && serverURL.hasOwnProperty(messageType)) {\n url = serverURL[messageType];\n }\n } // This is the old way of providing the url\n else if (protData && protData.laURL && protData.laURL !== \'\') {\n url = protData.laURL;\n } // No url provided by the app. Check the manifest and the pssh\n else {\n // Check for url defined in the manifest\n url = _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__["default"].getLicenseServerUrlFromMediaInfo(mediaInfoArr, selectedKeySystem.schemeIdURI); // In case we are not using Clearky we can still get a url from the pssh.\n\n if (!url && !protectionKeyController.isClearKey(selectedKeySystem)) {\n var psshData = _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__["default"].getPSSHData(sessionToken.initData);\n url = selectedKeySystem.getLicenseServerURLFromInitData(psshData); // Still no url, check the keymessage\n\n if (!url) {\n url = keyMessage.laURL;\n }\n }\n } // Possibly update or override the URL based on the message\n\n\n url = licenseServerData.getServerURLFromMessage(url, message, messageType);\n return url;\n }\n /**\n * Add new headers to the existing ones\n * @param {array} reqHeaders\n * @param {object} headers\n * @private\n */\n\n\n function _updateHeaders(reqHeaders, headers) {\n if (headers) {\n for (var key in headers) {\n reqHeaders[key] = headers[key];\n }\n }\n }\n /**\n * Reports an error that might have occured during the license request\n * @param {object} xhr\n * @param {object} eventData\n * @param {string} keySystemString\n * @param {string} messageType\n * @param {object} licenseServerData\n * @private\n */\n\n\n function _reportError(xhr, eventData, keySystemString, messageType, licenseServerData) {\n var errorMsg = xhr.response ? licenseServerData.getErrorResponse(xhr.response, keySystemString, messageType) : \'NONE\';\n\n _sendLicenseRequestCompleteEvent(eventData, new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_4__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE + keySystemString + \' update, XHR complete. status is "\' + xhr.statusText + \'" (\' + xhr.status + \'), readyState is \' + xhr.readyState + \'. Response is \' + errorMsg));\n }\n /**\n * Applies custom filters defined by the application\n * @param {array} filters\n * @param {object} param\n * @return {Promise<void>|*}\n * @private\n */\n\n\n function _applyFilters(filters, param) {\n if (!filters) return Promise.resolve();\n return filters.reduce(function (prev, next) {\n return prev.then(function () {\n return next(param);\n });\n }, Promise.resolve());\n }\n /**\n * Event handler for "needkey" and "encrypted" events\n * @param {object} event\n * @param {number} retry\n */\n\n\n function _onNeedKey(event, retry) {\n if (!settings.get().streaming.protection.ignoreEmeEncryptedEvent) {\n logger.debug(\'DRM: onNeedKey\'); // Ignore non-cenc initData\n\n if (event.key.initDataType !== \'cenc\') {\n logger.warn(\'DRM: Only \\\'cenc\\\' initData is supported! Ignoring initData of type: \' + event.key.initDataType);\n return;\n }\n\n if (mediaInfoArr.length === 0) {\n logger.warn(\'DRM: onNeedKey called before initializeForMedia, wait until initialized\');\n retry = typeof retry === \'undefined\' ? 1 : retry + 1;\n\n if (retry < NEEDKEY_BEFORE_INITIALIZE_RETRIES) {\n needkeyRetries.push(setTimeout(function () {\n _onNeedKey(event, retry);\n }, NEEDKEY_BEFORE_INITIALIZE_TIMEOUT));\n return;\n }\n } // Some browsers return initData as Uint8Array (IE), some as ArrayBuffer (Chrome).\n // Convert to ArrayBuffer\n\n\n var abInitData = event.key.initData;\n\n if (ArrayBuffer.isView(abInitData)) {\n abInitData = abInitData.buffer;\n } // If key system has already been selected and initData already seen, then do nothing\n\n\n if (selectedKeySystem) {\n var initDataForKS = _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__["default"].getPSSHForKeySystem(selectedKeySystem, abInitData);\n\n if (initDataForKS) {\n // Check for duplicate initData\n if (_isInitDataDuplicate(initDataForKS)) {\n return;\n }\n }\n }\n\n logger.debug(\'DRM: initData:\', String.fromCharCode.apply(null, new Uint8Array(abInitData)));\n var supportedKS = protectionKeyController.getSupportedKeySystemsFromSegmentPssh(abInitData, protDataSet, sessionType);\n\n if (supportedKS.length === 0) {\n logger.debug(\'DRM: Received needkey event with initData, but we don\\\'t support any of the key systems!\');\n return;\n }\n\n _selectKeySystem(supportedKS, false);\n }\n }\n /**\n * Returns all available key systems\n * @return {array}\n */\n\n\n function getKeySystems() {\n return protectionKeyController ? protectionKeyController.getKeySystems() : [];\n }\n /**\n * Sets all available key systems\n * @param {array} keySystems\n */\n\n\n function setKeySystems(keySystems) {\n if (protectionKeyController) {\n protectionKeyController.setKeySystems(keySystems);\n }\n }\n /**\n * Sets the request filters to be applied before the license request is made\n * @param {array} filters\n */\n\n\n function setLicenseRequestFilters(filters) {\n licenseRequestFilters = filters;\n }\n /**\n * Sets the response filters to be applied after the license response has been received.\n * @param {array} filters\n */\n\n\n function setLicenseResponseFilters(filters) {\n licenseResponseFilters = filters;\n }\n\n instance = {\n initializeForMedia: initializeForMedia,\n clearMediaInfoArray: clearMediaInfoArray,\n createKeySession: createKeySession,\n loadKeySession: loadKeySession,\n removeKeySession: removeKeySession,\n closeKeySession: closeKeySession,\n setServerCertificate: setServerCertificate,\n setMediaElement: setMediaElement,\n setSessionType: setSessionType,\n setRobustnessLevel: setRobustnessLevel,\n setProtectionData: setProtectionData,\n getSupportedKeySystemsFromContentProtection: getSupportedKeySystemsFromContentProtection,\n getKeySystems: getKeySystems,\n setKeySystems: setKeySystems,\n setLicenseRequestFilters: setLicenseRequestFilters,\n setLicenseResponseFilters: setLicenseResponseFilters,\n stop: stop,\n reset: reset\n };\n setup();\n return instance;\n}\n\nProtectionController.__dashjs_factory_name = \'ProtectionController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_10__["default"].getClassFactory(ProtectionController));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/controllers/ProtectionKeyController.js":\n/*!*************************************************************************!*\\\n !*** ./src/streaming/protection/controllers/ProtectionKeyController.js ***!\n \\*************************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1938617__) {\n__nested_webpack_require_1938617__.r(__nested_webpack_exports__);\n/* harmony import */ var _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1938617__(/*! ./../CommonEncryption */ "./src/streaming/protection/CommonEncryption.js");\n/* harmony import */ var _drm_KeySystemClearKey__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1938617__(/*! ./../drm/KeySystemClearKey */ "./src/streaming/protection/drm/KeySystemClearKey.js");\n/* harmony import */ var _drm_KeySystemW3CClearKey__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1938617__(/*! ./../drm/KeySystemW3CClearKey */ "./src/streaming/protection/drm/KeySystemW3CClearKey.js");\n/* harmony import */ var _drm_KeySystemWidevine__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1938617__(/*! ./../drm/KeySystemWidevine */ "./src/streaming/protection/drm/KeySystemWidevine.js");\n/* harmony import */ var _drm_KeySystemPlayReady__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1938617__(/*! ./../drm/KeySystemPlayReady */ "./src/streaming/protection/drm/KeySystemPlayReady.js");\n/* harmony import */ var _servers_DRMToday__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1938617__(/*! ./../servers/DRMToday */ "./src/streaming/protection/servers/DRMToday.js");\n/* harmony import */ var _servers_PlayReady__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1938617__(/*! ./../servers/PlayReady */ "./src/streaming/protection/servers/PlayReady.js");\n/* harmony import */ var _servers_Widevine__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_1938617__(/*! ./../servers/Widevine */ "./src/streaming/protection/servers/Widevine.js");\n/* harmony import */ var _servers_ClearKey__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_1938617__(/*! ./../servers/ClearKey */ "./src/streaming/protection/servers/ClearKey.js");\n/* harmony import */ var _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_1938617__(/*! ../../constants/ProtectionConstants */ "./src/streaming/constants/ProtectionConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n/**\n * @module ProtectionKeyController\n * @ignore\n * @description Media protection key system functionality that can be modified/overridden by applications\n */\n\nfunction ProtectionKeyController() {\n var context = this.context;\n var instance, debug, logger, keySystems, BASE64, clearkeyKeySystem, clearkeyW3CKeySystem;\n\n function setConfig(config) {\n if (!config) return;\n\n if (config.debug) {\n debug = config.debug;\n logger = debug.getLogger(instance);\n }\n\n if (config.BASE64) {\n BASE64 = config.BASE64;\n }\n }\n\n function initialize() {\n keySystems = [];\n var keySystem; // PlayReady\n\n keySystem = Object(_drm_KeySystemPlayReady__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance({\n BASE64: BASE64\n });\n keySystems.push(keySystem); // Widevine\n\n keySystem = Object(_drm_KeySystemWidevine__WEBPACK_IMPORTED_MODULE_3__["default"])(context).getInstance({\n BASE64: BASE64\n });\n keySystems.push(keySystem); // ClearKey\n\n keySystem = Object(_drm_KeySystemClearKey__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance({\n BASE64: BASE64\n });\n keySystems.push(keySystem);\n clearkeyKeySystem = keySystem; // W3C ClearKey\n\n keySystem = Object(_drm_KeySystemW3CClearKey__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance({\n BASE64: BASE64,\n debug: debug\n });\n keySystems.push(keySystem);\n clearkeyW3CKeySystem = keySystem;\n }\n /**\n * Returns a prioritized list of key systems supported\n * by this player (not necessarily those supported by the\n * user agent)\n *\n * @returns {Array.<KeySystem>} a prioritized\n * list of key systems\n * @memberof module:ProtectionKeyController\n * @instance\n */\n\n\n function getKeySystems() {\n return keySystems;\n }\n /**\n * Sets the prioritized list of key systems to be supported\n * by this player.\n *\n * @param {Array.<KeySystem>} newKeySystems the new prioritized\n * list of key systems\n * @memberof module:ProtectionKeyController\n * @instance\n */\n\n\n function setKeySystems(newKeySystems) {\n keySystems = newKeySystems;\n }\n /**\n * Returns the key system associated with the given key system string\n * name (i.e. \'org.w3.clearkey\')\n *\n * @param {string} systemString the system string\n * @returns {KeySystem|null} the key system\n * or null if no supported key system is associated with the given key\n * system string\n * @memberof module:ProtectionKeyController\n * @instance\n */\n\n\n function getKeySystemBySystemString(systemString) {\n for (var i = 0; i < keySystems.length; i++) {\n if (keySystems[i].systemString === systemString) {\n return keySystems[i];\n }\n }\n\n return null;\n }\n /**\n * Determines whether the given key system is ClearKey. This is\n * necessary because the EME spec defines ClearKey and its method\n * for providing keys to the key session; and this method has changed\n * between the various API versions. Our EME-specific ProtectionModels\n * must know if the system is ClearKey so that it can format the keys\n * according to the particular spec version.\n *\n * @param {Object} keySystem the key\n * @returns {boolean} true if this is the ClearKey key system, false\n * otherwise\n * @memberof module:ProtectionKeyController\n * @instance\n */\n\n\n function isClearKey(keySystem) {\n return keySystem === clearkeyKeySystem || keySystem === clearkeyW3CKeySystem;\n }\n /**\n * Check equality of initData array buffers.\n *\n * @param {ArrayBuffer} initData1 - first initData\n * @param {ArrayBuffer} initData2 - second initData\n * @returns {boolean} true if the initData arrays are equal in size and\n * contents, false otherwise\n * @memberof module:ProtectionKeyController\n * @instance\n */\n\n\n function initDataEquals(initData1, initData2) {\n if (initData1.byteLength === initData2.byteLength) {\n var data1 = new Uint8Array(initData1);\n var data2 = new Uint8Array(initData2);\n\n for (var j = 0; j < data1.length; j++) {\n if (data1[j] !== data2[j]) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n }\n /**\n * Returns a set of supported key systems and CENC initialization data\n * from the given array of ContentProtection elements. Only\n * key systems that are supported by this player will be returned.\n * Key systems are returned in priority order (highest first).\n *\n * @param {Array.<Object>} cps - array of content protection elements parsed\n * from the manifest\n * @param {ProtectionData} protDataSet user specified protection data - license server url etc\n * supported by the content\n * @param {string} default session type\n * @returns {Array.<Object>} array of objects indicating which supported key\n * systems were found. Empty array is returned if no\n * supported key systems were found\n * @memberof module:ProtectionKeyController\n * @instance\n */\n\n\n function getSupportedKeySystemsFromContentProtection(cps, protDataSet, sessionType) {\n var cp, ks, ksIdx, cpIdx;\n var supportedKS = [];\n\n if (cps) {\n var cencContentProtection = _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__["default"].findCencContentProtection(cps);\n\n for (ksIdx = 0; ksIdx < keySystems.length; ++ksIdx) {\n ks = keySystems[ksIdx]; // Get protection data that applies for current key system\n\n var protData = _getProtDataForKeySystem(ks.systemString, protDataSet);\n\n for (cpIdx = 0; cpIdx < cps.length; ++cpIdx) {\n cp = cps[cpIdx];\n\n if (cp.schemeIdUri.toLowerCase() === ks.schemeIdURI) {\n // Look for DRM-specific ContentProtection\n var initData = ks.getInitData(cp, cencContentProtection);\n supportedKS.push({\n ks: keySystems[ksIdx],\n keyId: cp.keyId,\n initData: initData,\n protData: protData,\n cdmData: ks.getCDMData(protData ? protData.cdmData : null),\n sessionId: _getSessionId(protData, cp),\n sessionType: _getSessionType(protData, sessionType)\n });\n }\n }\n }\n }\n\n return supportedKS;\n }\n /**\n * Returns key systems supported by this player for the given PSSH\n * initializationData. Key systems are returned in priority order\n * (highest priority first)\n *\n * @param {ArrayBuffer} initData Concatenated PSSH data for all DRMs\n * supported by the content\n * @param {ProtectionData} protDataSet user specified protection data - license server url etc\n * supported by the content\n * @param {string} default session type\n * @returns {Array.<Object>} array of objects indicating which supported key\n * systems were found. Empty array is returned if no\n * supported key systems were found\n * @memberof module:ProtectionKeyController\n * @instance\n */\n\n\n function getSupportedKeySystemsFromSegmentPssh(initData, protDataSet, sessionType) {\n var supportedKS = [];\n var pssh = _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__["default"].parsePSSHList(initData);\n var ks, keySystemString;\n\n for (var ksIdx = 0; ksIdx < keySystems.length; ++ksIdx) {\n ks = keySystems[ksIdx];\n keySystemString = ks.systemString; // Get protection data that applies for current key system\n\n var protData = _getProtDataForKeySystem(keySystemString, protDataSet);\n\n if (ks.uuid in pssh) {\n supportedKS.push({\n ks: ks,\n initData: pssh[ks.uuid],\n protData: protData,\n cdmData: ks.getCDMData(protData ? protData.cdmData : null),\n sessionId: _getSessionId(protData),\n sessionType: _getSessionType(protData, sessionType)\n });\n }\n }\n\n return supportedKS;\n }\n /**\n * Returns the license server implementation data that should be used for this request.\n *\n * @param {KeySystem} keySystem the key system\n * associated with this license request\n * @param {ProtectionData} protData protection data to use for the\n * request\n * @param {string} [messageType="license-request"] the message type associated with this\n * request. Supported message types can be found\n * {@link https://w3c.github.io/encrypted-media/#idl-def-MediaKeyMessageType|here}.\n * @returns {LicenseServer|null} the license server\n * implementation that should be used for this request or null if the player should not\n * pass messages of the given type to a license server\n * @memberof module:ProtectionKeyController\n * @instance\n *\n */\n\n\n function getLicenseServerModelInstance(keySystem, protData, messageType) {\n // Our default server implementations do not do anything with "license-release" or\n // "individualization-request" messages, so we just send a success event\n if (messageType === \'license-release\' || messageType === \'individualization-request\') {\n return null;\n }\n\n var licenseServerData = null;\n\n if (protData && protData.hasOwnProperty(\'drmtoday\')) {\n licenseServerData = Object(_servers_DRMToday__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance({\n BASE64: BASE64\n });\n } else if (keySystem.systemString === _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_9__["default"].WIDEVINE_KEYSTEM_STRING) {\n licenseServerData = Object(_servers_Widevine__WEBPACK_IMPORTED_MODULE_7__["default"])(context).getInstance();\n } else if (keySystem.systemString === _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_9__["default"].PLAYREADY_KEYSTEM_STRING) {\n licenseServerData = Object(_servers_PlayReady__WEBPACK_IMPORTED_MODULE_6__["default"])(context).getInstance();\n } else if (keySystem.systemString === _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_9__["default"].CLEARKEY_KEYSTEM_STRING) {\n licenseServerData = Object(_servers_ClearKey__WEBPACK_IMPORTED_MODULE_8__["default"])(context).getInstance();\n }\n\n return licenseServerData;\n }\n /**\n * Allows application-specific retrieval of ClearKey keys.\n *\n * @param {KeySystem} clearkeyKeySystem They exact ClearKey System to be used\n * @param {ProtectionData} protData protection data to use for the\n * request\n * @param {ArrayBuffer} message the key message from the CDM\n * @return {ClearKeyKeySet|null} the clear keys associated with\n * the request or null if no keys can be returned by this function\n * @memberof module:ProtectionKeyController\n * @instance\n */\n\n\n function processClearKeyLicenseRequest(clearkeyKeySystem, protData, message) {\n try {\n return clearkeyKeySystem.getClearKeysFromProtectionData(protData, message);\n } catch (error) {\n logger.error(\'Failed to retrieve clearkeys from ProtectionData\');\n return null;\n }\n }\n\n function setProtectionData(protectionDataSet) {\n var getProtectionData = function getProtectionData(keySystemString) {\n var protData = null;\n\n if (protectionDataSet) {\n protData = keySystemString in protectionDataSet ? protectionDataSet[keySystemString] : null;\n }\n\n return protData;\n };\n\n for (var i = 0; i < keySystems.length; i++) {\n var keySystem = keySystems[i];\n\n if (keySystem.hasOwnProperty(\'init\')) {\n keySystem.init(getProtectionData(keySystem.systemString));\n }\n }\n }\n\n function _getProtDataForKeySystem(systemString, protDataSet) {\n if (!protDataSet) return null;\n return systemString in protDataSet ? protDataSet[systemString] : null;\n }\n\n function _getSessionId(protData, cp) {\n // Get sessionId from protectionData or from manifest (ContentProtection)\n if (protData && protData.sessionId) {\n return protData.sessionId;\n } else if (cp && cp.sessionId) {\n return cp.sessionId;\n }\n\n return null;\n }\n\n function _getSessionType(protData, sessionType) {\n return protData && protData.sessionType ? protData.sessionType : sessionType;\n }\n\n instance = {\n initialize: initialize,\n setProtectionData: setProtectionData,\n isClearKey: isClearKey,\n initDataEquals: initDataEquals,\n getKeySystems: getKeySystems,\n setKeySystems: setKeySystems,\n getKeySystemBySystemString: getKeySystemBySystemString,\n getSupportedKeySystemsFromContentProtection: getSupportedKeySystemsFromContentProtection,\n getSupportedKeySystemsFromSegmentPssh: getSupportedKeySystemsFromSegmentPssh,\n getLicenseServerModelInstance: getLicenseServerModelInstance,\n processClearKeyLicenseRequest: processClearKeyLicenseRequest,\n setConfig: setConfig\n };\n return instance;\n}\n\nProtectionKeyController.__dashjs_factory_name = \'ProtectionKeyController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(ProtectionKeyController));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/drm/KeySystemClearKey.js":\n/*!***********************************************************!*\\\n !*** ./src/streaming/protection/drm/KeySystemClearKey.js ***!\n \\***********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1955492__) {\n__nested_webpack_require_1955492__.r(__nested_webpack_exports__);\n/* harmony import */ var _vo_KeyPair__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1955492__(/*! ../vo/KeyPair */ "./src/streaming/protection/vo/KeyPair.js");\n/* harmony import */ var _vo_ClearKeyKeySet__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1955492__(/*! ../vo/ClearKeyKeySet */ "./src/streaming/protection/vo/ClearKeyKeySet.js");\n/* harmony import */ var _CommonEncryption__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1955492__(/*! ../CommonEncryption */ "./src/streaming/protection/CommonEncryption.js");\n/* harmony import */ var _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1955492__(/*! ../../constants/ProtectionConstants */ "./src/streaming/constants/ProtectionConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\nvar uuid = \'e2719d58-a985-b3c9-781a-b030af78d30e\';\nvar systemString = _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_3__["default"].CLEARKEY_KEYSTEM_STRING;\nvar schemeIdURI = \'urn:uuid:\' + uuid;\n\nfunction KeySystemClearKey(config) {\n config = config || {};\n var instance;\n var BASE64 = config.BASE64;\n /**\n * Returns desired clearkeys (as specified in the CDM message) from protection data\n *\n * @param {ProtectionData} protectionData the protection data\n * @param {ArrayBuffer} message the ClearKey CDM message\n * @returns {ClearKeyKeySet} the key set or null if none found\n * @throws {Error} if a keyID specified in the CDM message was not found in the\n * protection data\n * @memberof KeySystemClearKey\n */\n\n function getClearKeysFromProtectionData(protectionData, message) {\n var clearkeySet = null;\n\n if (protectionData) {\n // ClearKey is the only system that does not require a license server URL, so we\n // handle it here when keys are specified in protection data\n var jsonMsg = JSON.parse(String.fromCharCode.apply(null, new Uint8Array(message)));\n var keyPairs = [];\n\n for (var i = 0; i < jsonMsg.kids.length; i++) {\n var clearkeyID = jsonMsg.kids[i];\n var clearkey = protectionData.clearkeys && protectionData.clearkeys.hasOwnProperty(clearkeyID) ? protectionData.clearkeys[clearkeyID] : null;\n\n if (!clearkey) {\n throw new Error(\'DRM: ClearKey keyID (\' + clearkeyID + \') is not known!\');\n } // KeyIDs from CDM are not base64 padded. Keys may or may not be padded\n\n\n keyPairs.push(new _vo_KeyPair__WEBPACK_IMPORTED_MODULE_0__["default"](clearkeyID, clearkey));\n }\n\n clearkeySet = new _vo_ClearKeyKeySet__WEBPACK_IMPORTED_MODULE_1__["default"](keyPairs);\n }\n\n return clearkeySet;\n }\n\n function getInitData(cp, cencContentProtection) {\n try {\n var initData = _CommonEncryption__WEBPACK_IMPORTED_MODULE_2__["default"].parseInitDataFromContentProtection(cp, BASE64);\n\n if (!initData && cencContentProtection) {\n var cencDefaultKid = cencDefaultKidToBase64Representation(cencContentProtection[\'cenc:default_KID\']);\n var data = {\n kids: [cencDefaultKid]\n };\n initData = new TextEncoder().encode(JSON.stringify(data));\n }\n\n return initData;\n } catch (e) {\n return null;\n }\n }\n\n function cencDefaultKidToBase64Representation(cencDefaultKid) {\n try {\n var kid = cencDefaultKid.replace(/-/g, \'\');\n kid = btoa(kid.match(/\\w{2}/g).map(function (a) {\n return String.fromCharCode(parseInt(a, 16));\n }).join(\'\'));\n return kid.replace(/=/g, \'\');\n } catch (e) {\n return null;\n }\n }\n\n function getRequestHeadersFromMessage()\n /*message*/\n {\n // Set content type to application/json by default\n return {\n \'Content-Type\': \'application/json\'\n };\n }\n\n function getLicenseRequestFromMessage(message) {\n return JSON.parse(String.fromCharCode.apply(null, new Uint8Array(message)));\n }\n\n function getLicenseServerURLFromInitData()\n /*initData*/\n {\n return null;\n }\n\n function getCDMData()\n /*cdmData*/\n {\n return null;\n }\n\n instance = {\n uuid: uuid,\n schemeIdURI: schemeIdURI,\n systemString: systemString,\n getInitData: getInitData,\n getRequestHeadersFromMessage: getRequestHeadersFromMessage,\n getLicenseRequestFromMessage: getLicenseRequestFromMessage,\n getLicenseServerURLFromInitData: getLicenseServerURLFromInitData,\n getCDMData: getCDMData,\n getClearKeysFromProtectionData: getClearKeysFromProtectionData\n };\n return instance;\n}\n\nKeySystemClearKey.__dashjs_factory_name = \'KeySystemClearKey\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(KeySystemClearKey));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/drm/KeySystemPlayReady.js":\n/*!************************************************************!*\\\n !*** ./src/streaming/protection/drm/KeySystemPlayReady.js ***!\n \\************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1962290__) {\n__nested_webpack_require_1962290__.r(__nested_webpack_exports__);\n/* harmony import */ var _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1962290__(/*! ../CommonEncryption */ "./src/streaming/protection/CommonEncryption.js");\n/* harmony import */ var _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1962290__(/*! ../../constants/ProtectionConstants */ "./src/streaming/constants/ProtectionConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Microsoft PlayReady DRM\n *\n * @class\n * @implements KeySystem\n */\n\n\nvar uuid = \'9a04f079-9840-4286-ab92-e65be0885f95\';\nvar systemString = _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_1__["default"].PLAYREADY_KEYSTEM_STRING;\nvar schemeIdURI = \'urn:uuid:\' + uuid;\nvar PRCDMData = \'<PlayReadyCDMData type="LicenseAcquisition"><LicenseAcquisition version="1.0" Proactive="false"><CustomData encoding="base64encoded">%CUSTOMDATA%</CustomData></LicenseAcquisition></PlayReadyCDMData>\';\n\nfunction KeySystemPlayReady(config) {\n config = config || {};\n var instance;\n var messageFormat = \'utf-16\';\n var BASE64 = config.BASE64;\n\n function checkConfig() {\n if (!BASE64 || !BASE64.hasOwnProperty(\'decodeArray\') || !BASE64.hasOwnProperty(\'decodeArray\')) {\n throw new Error(\'Missing config parameter(s)\');\n }\n }\n\n function getRequestHeadersFromMessage(message) {\n var msg, xmlDoc;\n var headers = {};\n var parser = new DOMParser();\n var dataview = messageFormat === \'utf-16\' ? new Uint16Array(message) : new Uint8Array(message);\n msg = String.fromCharCode.apply(null, dataview);\n xmlDoc = parser.parseFromString(msg, \'application/xml\');\n var headerNameList = xmlDoc.getElementsByTagName(\'name\');\n var headerValueList = xmlDoc.getElementsByTagName(\'value\');\n\n for (var i = 0; i < headerNameList.length; i++) {\n headers[headerNameList[i].childNodes[0].nodeValue] = headerValueList[i].childNodes[0].nodeValue;\n } // Some versions of the PlayReady CDM return \'Content\' instead of \'Content-Type\'.\n // this is NOT w3c conform and license servers may reject the request!\n // -> rename it to proper w3c definition!\n\n\n if (headers.hasOwnProperty(\'Content\')) {\n headers[\'Content-Type\'] = headers.Content;\n delete headers.Content;\n } // Set Content-Type header by default if not provided in the the CDM message (<PlayReadyKeyMessage/>)\n // or if the message contains directly the challenge itself (Ex: LG SmartTVs)\n\n\n if (!headers.hasOwnProperty(\'Content-Type\')) {\n headers[\'Content-Type\'] = \'text/xml; charset=utf-8\';\n }\n\n return headers;\n }\n\n function getLicenseRequestFromMessage(message) {\n var licenseRequest = null;\n var parser = new DOMParser();\n var dataview = messageFormat === \'utf-16\' ? new Uint16Array(message) : new Uint8Array(message);\n checkConfig();\n var msg = String.fromCharCode.apply(null, dataview);\n var xmlDoc = parser.parseFromString(msg, \'application/xml\');\n\n if (xmlDoc.getElementsByTagName(\'PlayReadyKeyMessage\')[0]) {\n var Challenge = xmlDoc.getElementsByTagName(\'Challenge\')[0].childNodes[0].nodeValue;\n\n if (Challenge) {\n licenseRequest = BASE64.decode(Challenge);\n }\n } else {\n // The message from CDM is not a wrapped message as on IE11 and Edge,\n // thus it contains direclty the challenge itself\n // (note that the xmlDoc at this point may be unreadable since it may have been interpreted as UTF-16)\n return message;\n }\n\n return licenseRequest;\n }\n\n function getLicenseServerURLFromInitData(initData) {\n if (initData) {\n var data = new DataView(initData);\n var numRecords = data.getUint16(4, true);\n var offset = 6;\n var parser = new DOMParser();\n\n for (var i = 0; i < numRecords; i++) {\n // Parse the PlayReady Record header\n var recordType = data.getUint16(offset, true);\n offset += 2;\n var recordLength = data.getUint16(offset, true);\n offset += 2;\n\n if (recordType !== 0x0001) {\n offset += recordLength;\n continue;\n }\n\n var recordData = initData.slice(offset, offset + recordLength);\n var record = String.fromCharCode.apply(null, new Uint16Array(recordData));\n var xmlDoc = parser.parseFromString(record, \'application/xml\'); // First try <LA_URL>\n\n if (xmlDoc.getElementsByTagName(\'LA_URL\')[0]) {\n var laurl = xmlDoc.getElementsByTagName(\'LA_URL\')[0].childNodes[0].nodeValue;\n\n if (laurl) {\n return laurl;\n }\n } // Optionally, try <LUI_URL>\n\n\n if (xmlDoc.getElementsByTagName(\'LUI_URL\')[0]) {\n var luiurl = xmlDoc.getElementsByTagName(\'LUI_URL\')[0].childNodes[0].nodeValue;\n\n if (luiurl) {\n return luiurl;\n }\n }\n }\n }\n\n return null;\n }\n\n function getInitData(cpData) {\n // * desc@ getInitData\n // * generate PSSH data from PROHeader defined in MPD file\n // * PSSH format:\n // * size (4)\n // * box type(PSSH) (8)\n // * Protection SystemID (16)\n // * protection system data size (4) - length of decoded PROHeader\n // * decoded PROHeader data from MPD file\n var PSSHBoxType = new Uint8Array([0x70, 0x73, 0x73, 0x68, 0x00, 0x00, 0x00, 0x00]); //\'PSSH\' 8 bytes\n\n var playreadySystemID = new Uint8Array([0x9a, 0x04, 0xf0, 0x79, 0x98, 0x40, 0x42, 0x86, 0xab, 0x92, 0xe6, 0x5b, 0xe0, 0x88, 0x5f, 0x95]);\n var byteCursor = 0;\n var uint8arraydecodedPROHeader = null;\n var PROSize, PSSHSize, PSSHBoxBuffer, PSSHBox, PSSHData;\n checkConfig();\n\n if (!cpData) {\n return null;\n } // Handle common encryption PSSH\n\n\n if (\'pssh\' in cpData) {\n return _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__["default"].parseInitDataFromContentProtection(cpData, BASE64);\n } // Handle native MS PlayReady ContentProtection elements\n\n\n if (\'pro\' in cpData) {\n uint8arraydecodedPROHeader = BASE64.decodeArray(cpData.pro.__text);\n } else if (\'prheader\' in cpData) {\n uint8arraydecodedPROHeader = BASE64.decodeArray(cpData.prheader.__text);\n } else {\n return null;\n }\n\n PROSize = uint8arraydecodedPROHeader.length;\n PSSHSize = 0x4 + PSSHBoxType.length + playreadySystemID.length + 0x4 + PROSize;\n PSSHBoxBuffer = new ArrayBuffer(PSSHSize);\n PSSHBox = new Uint8Array(PSSHBoxBuffer);\n PSSHData = new DataView(PSSHBoxBuffer);\n PSSHData.setUint32(byteCursor, PSSHSize);\n byteCursor += 0x4;\n PSSHBox.set(PSSHBoxType, byteCursor);\n byteCursor += PSSHBoxType.length;\n PSSHBox.set(playreadySystemID, byteCursor);\n byteCursor += playreadySystemID.length;\n PSSHData.setUint32(byteCursor, PROSize);\n byteCursor += 0x4;\n PSSHBox.set(uint8arraydecodedPROHeader, byteCursor);\n byteCursor += PROSize;\n return PSSHBox.buffer;\n }\n /**\n * It seems that some PlayReady implementations return their XML-based CDM\n * messages using UTF16, while others return them as UTF8. Use this function\n * to modify the message format to expect when parsing CDM messages.\n *\n * @param {string} format the expected message format. Either "utf-8" or "utf-16".\n * @throws {Error} Specified message format is not one of "utf8" or "utf16"\n */\n\n\n function setPlayReadyMessageFormat(format) {\n if (format !== \'utf-8\' && format !== \'utf-16\') {\n throw new Error(\'Specified message format is not one of "utf-8" or "utf-16"\');\n }\n\n messageFormat = format;\n }\n /**\n * Get Playready Custom data\n */\n\n\n function getCDMData(_cdmData) {\n var customData, cdmData, cdmDataBytes, i;\n checkConfig();\n if (!_cdmData) return null; // Convert custom data into multibyte string\n\n customData = [];\n\n for (i = 0; i < _cdmData.length; ++i) {\n customData.push(_cdmData.charCodeAt(i));\n customData.push(0);\n }\n\n customData = String.fromCharCode.apply(null, customData); // Encode in Base 64 the custom data string\n\n customData = BASE64.encode(customData); // Initialize CDM data with Base 64 encoded custom data\n // (see https://msdn.microsoft.com/en-us/library/dn457361.aspx)\n\n cdmData = PRCDMData.replace(\'%CUSTOMDATA%\', customData); // Convert CDM data into multibyte characters\n\n cdmDataBytes = [];\n\n for (i = 0; i < cdmData.length; ++i) {\n cdmDataBytes.push(cdmData.charCodeAt(i));\n cdmDataBytes.push(0);\n }\n\n return new Uint8Array(cdmDataBytes).buffer;\n }\n\n instance = {\n uuid: uuid,\n schemeIdURI: schemeIdURI,\n systemString: systemString,\n getInitData: getInitData,\n getRequestHeadersFromMessage: getRequestHeadersFromMessage,\n getLicenseRequestFromMessage: getLicenseRequestFromMessage,\n getLicenseServerURLFromInitData: getLicenseServerURLFromInitData,\n getCDMData: getCDMData,\n setPlayReadyMessageFormat: setPlayReadyMessageFormat\n };\n return instance;\n}\n\nKeySystemPlayReady.__dashjs_factory_name = \'KeySystemPlayReady\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(KeySystemPlayReady));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/drm/KeySystemW3CClearKey.js":\n/*!**************************************************************!*\\\n !*** ./src/streaming/protection/drm/KeySystemW3CClearKey.js ***!\n \\**************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1973526__) {\n__nested_webpack_require_1973526__.r(__nested_webpack_exports__);\n/* harmony import */ var _vo_KeyPair__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1973526__(/*! ../vo/KeyPair */ "./src/streaming/protection/vo/KeyPair.js");\n/* harmony import */ var _vo_ClearKeyKeySet__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1973526__(/*! ../vo/ClearKeyKeySet */ "./src/streaming/protection/vo/ClearKeyKeySet.js");\n/* harmony import */ var _CommonEncryption__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1973526__(/*! ../CommonEncryption */ "./src/streaming/protection/CommonEncryption.js");\n/* harmony import */ var _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1973526__(/*! ../../constants/ProtectionConstants */ "./src/streaming/constants/ProtectionConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\nvar uuid = \'1077efec-c0b2-4d02-ace3-3c1e52e2fb4b\';\nvar systemString = _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_3__["default"].CLEARKEY_KEYSTEM_STRING;\nvar schemeIdURI = \'urn:uuid:\' + uuid;\n\nfunction KeySystemW3CClearKey(config) {\n var instance;\n var BASE64 = config.BASE64;\n var logger = config.debug.getLogger(instance);\n /**\n * Returns desired clearkeys (as specified in the CDM message) from protection data\n *\n * @param {ProtectionDataSet} protectionData the protection data\n * @param {ArrayBuffer} message the ClearKey CDM message\n * @returns {ClearKeyKeySet} the key set or null if none found\n * @throws {Error} if a keyID specified in the CDM message was not found in the\n * protection data\n * @memberof KeySystemClearKey\n */\n\n function getClearKeysFromProtectionData(protectionData, message) {\n var clearkeySet = null;\n\n if (protectionData) {\n // ClearKey is the only system that does not require a license server URL, so we\n // handle it here when keys are specified in protection data\n var jsonMsg = JSON.parse(String.fromCharCode.apply(null, new Uint8Array(message)));\n var keyPairs = [];\n\n for (var i = 0; i < jsonMsg.kids.length; i++) {\n var clearkeyID = jsonMsg.kids[i];\n var clearkey = protectionData.clearkeys && protectionData.clearkeys.hasOwnProperty(clearkeyID) ? protectionData.clearkeys[clearkeyID] : null;\n\n if (!clearkey) {\n throw new Error(\'DRM: ClearKey keyID (\' + clearkeyID + \') is not known!\');\n } // KeyIDs from CDM are not base64 padded. Keys may or may not be padded\n\n\n keyPairs.push(new _vo_KeyPair__WEBPACK_IMPORTED_MODULE_0__["default"](clearkeyID, clearkey));\n }\n\n clearkeySet = new _vo_ClearKeyKeySet__WEBPACK_IMPORTED_MODULE_1__["default"](keyPairs);\n logger.warn(\'ClearKey schemeIdURI is using W3C Common PSSH systemID (1077efec-c0b2-4d02-ace3-3c1e52e2fb4b) in Content Protection. See DASH-IF IOP v4.1 section 7.6.2.4\');\n }\n\n return clearkeySet;\n }\n\n function getInitData(cp) {\n return _CommonEncryption__WEBPACK_IMPORTED_MODULE_2__["default"].parseInitDataFromContentProtection(cp, BASE64);\n }\n\n function getRequestHeadersFromMessage()\n /*message*/\n {\n return null;\n }\n\n function getLicenseRequestFromMessage(message) {\n return new Uint8Array(message);\n }\n\n function getLicenseServerURLFromInitData()\n /*initData*/\n {\n return null;\n }\n\n function getCDMData()\n /*cdmData*/\n {\n return null;\n }\n\n instance = {\n uuid: uuid,\n schemeIdURI: schemeIdURI,\n systemString: systemString,\n getInitData: getInitData,\n getRequestHeadersFromMessage: getRequestHeadersFromMessage,\n getLicenseRequestFromMessage: getLicenseRequestFromMessage,\n getLicenseServerURLFromInitData: getLicenseServerURLFromInitData,\n getCDMData: getCDMData,\n getClearKeysFromProtectionData: getClearKeysFromProtectionData\n };\n return instance;\n}\n\nKeySystemW3CClearKey.__dashjs_factory_name = \'KeySystemW3CClearKey\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(KeySystemW3CClearKey));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/drm/KeySystemWidevine.js":\n/*!***********************************************************!*\\\n !*** ./src/streaming/protection/drm/KeySystemWidevine.js ***!\n \\***********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1979643__) {\n__nested_webpack_require_1979643__.r(__nested_webpack_exports__);\n/* harmony import */ var _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1979643__(/*! ../CommonEncryption */ "./src/streaming/protection/CommonEncryption.js");\n/* harmony import */ var _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1979643__(/*! ../../constants/ProtectionConstants */ "./src/streaming/constants/ProtectionConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Google Widevine DRM\n *\n * @class\n * @implements MediaPlayer.dependencies.protection.KeySystem\n */\n\n\nvar uuid = \'edef8ba9-79d6-4ace-a3c8-27dcd51d21ed\';\nvar systemString = _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_1__["default"].WIDEVINE_KEYSTEM_STRING;\nvar schemeIdURI = \'urn:uuid:\' + uuid;\n\nfunction KeySystemWidevine(config) {\n config = config || {};\n var instance;\n var BASE64 = config.BASE64;\n\n function getInitData(cp) {\n return _CommonEncryption__WEBPACK_IMPORTED_MODULE_0__["default"].parseInitDataFromContentProtection(cp, BASE64);\n }\n\n function getRequestHeadersFromMessage()\n /*message*/\n {\n return null;\n }\n\n function getLicenseRequestFromMessage(message) {\n return new Uint8Array(message);\n }\n\n function getLicenseServerURLFromInitData()\n /*initData*/\n {\n return null;\n }\n\n function getCDMData()\n /*cdmData*/\n {\n return null;\n }\n\n instance = {\n uuid: uuid,\n schemeIdURI: schemeIdURI,\n systemString: systemString,\n getInitData: getInitData,\n getRequestHeadersFromMessage: getRequestHeadersFromMessage,\n getLicenseRequestFromMessage: getLicenseRequestFromMessage,\n getLicenseServerURLFromInitData: getLicenseServerURLFromInitData,\n getCDMData: getCDMData\n };\n return instance;\n}\n\nKeySystemWidevine.__dashjs_factory_name = \'KeySystemWidevine\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(KeySystemWidevine));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/errors/ProtectionErrors.js":\n/*!*************************************************************!*\\\n !*** ./src/streaming/protection/errors/ProtectionErrors.js ***!\n \\*************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1983756__) {\n__nested_webpack_require_1983756__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_errors_ErrorsBase__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1983756__(/*! ../../../core/errors/ErrorsBase */ "./src/core/errors/ErrorsBase.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n */\n\nvar ProtectionErrors = /*#__PURE__*/function (_ErrorsBase) {\n _inherits(ProtectionErrors, _ErrorsBase);\n\n var _super = _createSuper(ProtectionErrors);\n\n function ProtectionErrors() {\n var _this;\n\n _classCallCheck(this, ProtectionErrors);\n\n _this = _super.call(this);\n /**\n * Generid key Error code\n */\n\n _this.MEDIA_KEYERR_CODE = 100;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n\n _this.MEDIA_KEYERR_UNKNOWN_CODE = 101;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n\n _this.MEDIA_KEYERR_CLIENT_CODE = 102;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n\n _this.MEDIA_KEYERR_SERVICE_CODE = 103;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n\n _this.MEDIA_KEYERR_OUTPUT_CODE = 104;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n\n _this.MEDIA_KEYERR_HARDWARECHANGE_CODE = 105;\n /**\n * Error code returned by keyerror api for ProtectionModel_01b\n */\n\n _this.MEDIA_KEYERR_DOMAIN_CODE = 106;\n /**\n * Error code returned when an error occured in keymessage event for ProtectionModel_01b\n */\n\n _this.MEDIA_KEY_MESSAGE_ERROR_CODE = 107;\n /**\n * Error code returned when challenge is invalid in keymessage event (event triggered by CDM)\n */\n\n _this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE = 108;\n /**\n * Error code returned when License server certificate has not been successfully updated\n */\n\n _this.SERVER_CERTIFICATE_UPDATED_ERROR_CODE = 109;\n /**\n * Error code returned when license validity has expired\n */\n\n _this.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE = 110;\n /**\n * Error code returned when no licenser url is defined\n */\n\n _this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE = 111;\n /**\n * Error code returned when key system access is denied\n */\n\n _this.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE = 112;\n /**\n * Error code returned when key session has not been successfully created\n */\n\n _this.KEY_SESSION_CREATED_ERROR_CODE = 113;\n /**\n * Error code returned when license request failed after a keymessage event has been triggered\n */\n\n _this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE = 114;\n _this.MEDIA_KEYERR_UNKNOWN_MESSAGE = \'An unspecified error occurred. This value is used for errors that don\\\'t match any of the other codes.\';\n _this.MEDIA_KEYERR_CLIENT_MESSAGE = \'The Key System could not be installed or updated.\';\n _this.MEDIA_KEYERR_SERVICE_MESSAGE = \'The message passed into update indicated an error from the license service.\';\n _this.MEDIA_KEYERR_OUTPUT_MESSAGE = \'There is no available output device with the required characteristics for the content protection system.\';\n _this.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE = \'A hardware configuration change caused a content protection error.\';\n _this.MEDIA_KEYERR_DOMAIN_MESSAGE = \'An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain.\';\n _this.MEDIA_KEY_MESSAGE_ERROR_MESSAGE = \'Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!\';\n _this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE = \'DRM: Empty key message from CDM\';\n _this.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE = \'Error updating server certificate -- \';\n _this.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE = \'DRM: KeyStatusChange error! -- License has expired\';\n _this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE = \'DRM: No license server URL specified!\';\n _this.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE = \'DRM: KeySystem Access Denied! -- \';\n _this.KEY_SESSION_CREATED_ERROR_MESSAGE = \'DRM: unable to create session! --\';\n _this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE = \'DRM: licenser error! --\';\n return _this;\n }\n\n return ProtectionErrors;\n}(_core_errors_ErrorsBase__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\nvar protectionErrors = new ProtectionErrors();\n/* harmony default export */ __nested_webpack_exports__["default"] = (protectionErrors);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/models/ProtectionModel_01b.js":\n/*!****************************************************************!*\\\n !*** ./src/streaming/protection/models/ProtectionModel_01b.js ***!\n \\****************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_1992837__) {\n__nested_webpack_require_1992837__.r(__nested_webpack_exports__);\n/* harmony import */ var _controllers_ProtectionKeyController__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1992837__(/*! ../controllers/ProtectionKeyController */ "./src/streaming/protection/controllers/ProtectionKeyController.js");\n/* harmony import */ var _vo_NeedKey__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_1992837__(/*! ../vo/NeedKey */ "./src/streaming/protection/vo/NeedKey.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_1992837__(/*! ../../vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _vo_KeyMessage__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_1992837__(/*! ../vo/KeyMessage */ "./src/streaming/protection/vo/KeyMessage.js");\n/* harmony import */ var _vo_KeySystemConfiguration__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_1992837__(/*! ../vo/KeySystemConfiguration */ "./src/streaming/protection/vo/KeySystemConfiguration.js");\n/* harmony import */ var _vo_KeySystemAccess__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_1992837__(/*! ../vo/KeySystemAccess */ "./src/streaming/protection/vo/KeySystemAccess.js");\n/* harmony import */ var _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_1992837__(/*! ../errors/ProtectionErrors */ "./src/streaming/protection/errors/ProtectionErrors.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Initial implementation of EME\n *\n * Implemented by Google Chrome prior to v36\n *\n * @implements ProtectionModel\n * @class\n */\n\n\n\n\n\n\n\n\nfunction ProtectionModel_01b(config) {\n config = config || {};\n var context = this.context;\n var eventBus = config.eventBus; //Need to pass in here so we can use same instance since this is optional module\n\n var events = config.events;\n var debug = config.debug;\n var api = config.api;\n var errHandler = config.errHandler;\n var instance, logger, videoElement, keySystem, protectionKeyController, // With this version of the EME APIs, sessionIds are not assigned to\n // sessions until the first key message is received. We are assuming\n // that in the case of multiple sessions, key messages will be received\n // in the order that generateKeyRequest() is called.\n // Holding spot for newly-created sessions until we determine whether or\n // not the CDM supports sessionIds\n pendingSessions, // List of sessions that have been initialized. Only the first position will\n // be used in the case that the CDM does not support sessionIds\n sessions, // Not all CDMs support the notion of sessionIds. Without sessionIds\n // there is no way for us to differentiate between sessions, therefore\n // we must only allow a single session. Once we receive the first key\n // message we can set this flag to determine if more sessions are allowed\n moreSessionsAllowed, // This is our main event handler for all desired HTMLMediaElement events\n // related to EME. These events are translated into our API-independent\n // versions of the same events\n eventHandler;\n\n function setup() {\n logger = debug.getLogger(instance);\n videoElement = null;\n keySystem = null;\n pendingSessions = [];\n sessions = [];\n protectionKeyController = Object(_controllers_ProtectionKeyController__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n eventHandler = createEventHandler();\n }\n\n function reset() {\n if (videoElement) {\n removeEventListeners();\n }\n\n for (var i = 0; i < sessions.length; i++) {\n closeKeySession(sessions[i]);\n }\n\n eventBus.trigger(events.TEARDOWN_COMPLETE);\n }\n\n function getAllInitData() {\n var retVal = [];\n\n for (var i = 0; i < pendingSessions.length; i++) {\n retVal.push(pendingSessions[i].initData);\n }\n\n for (var _i = 0; _i < sessions.length; _i++) {\n retVal.push(sessions[_i].initData);\n }\n\n return retVal;\n }\n\n function getSessions() {\n return sessions.concat(pendingSessions);\n }\n\n function requestKeySystemAccess(ksConfigurations) {\n return new Promise(function (resolve, reject) {\n var ve = videoElement;\n\n if (!ve) {\n // Must have a video element to do this capability tests\n ve = document.createElement(\'video\');\n } // Try key systems in order, first one with supported key system configuration\n // is used\n\n\n var found = false;\n\n for (var ksIdx = 0; ksIdx < ksConfigurations.length; ksIdx++) {\n var systemString = ksConfigurations[ksIdx].ks.systemString;\n var configs = ksConfigurations[ksIdx].configs;\n var supportedAudio = null;\n var supportedVideo = null; // Try key system configs in order, first one with supported audio/video\n // is used\n\n for (var configIdx = 0; configIdx < configs.length; configIdx++) {\n //let audios = configs[configIdx].audioCapabilities;\n var videos = configs[configIdx].videoCapabilities; // Look for supported video container/codecs\n\n if (videos && videos.length !== 0) {\n supportedVideo = []; // Indicates that we have a requested video config\n\n for (var videoIdx = 0; videoIdx < videos.length; videoIdx++) {\n if (ve.canPlayType(videos[videoIdx].contentType, systemString) !== \'\') {\n supportedVideo.push(videos[videoIdx]);\n }\n }\n } // No supported audio or video in this configuration OR we have\n // requested audio or video configuration that is not supported\n\n\n if (!supportedVideo || supportedAudio && supportedAudio.length === 0 || supportedVideo && supportedVideo.length === 0) {\n continue;\n } // This configuration is supported\n\n\n found = true;\n var ksConfig = new _vo_KeySystemConfiguration__WEBPACK_IMPORTED_MODULE_4__["default"](supportedAudio, supportedVideo);\n var ks = protectionKeyController.getKeySystemBySystemString(systemString);\n var keySystemAccess = new _vo_KeySystemAccess__WEBPACK_IMPORTED_MODULE_5__["default"](ks, ksConfig);\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, {\n data: keySystemAccess\n });\n resolve({\n data: keySystemAccess\n });\n break;\n }\n }\n\n if (!found) {\n var errorMessage = \'Key system access denied! -- No valid audio/video content configurations detected!\';\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, {\n error: errorMessage\n });\n reject({\n error: errorMessage\n });\n }\n });\n }\n\n function selectKeySystem(keySystemAccess) {\n keySystem = keySystemAccess.keySystem;\n return Promise.resolve(keySystem);\n }\n\n function setMediaElement(mediaElement) {\n if (videoElement === mediaElement) {\n return;\n } // Replacing the previous element\n\n\n if (videoElement) {\n removeEventListeners(); // Close any open sessions - avoids memory leak on LG webOS 2016/2017 TVs\n\n for (var i = 0; i < sessions.length; i++) {\n closeKeySession(sessions[i]);\n }\n\n sessions = [];\n }\n\n videoElement = mediaElement; // Only if we are not detaching from the existing element\n\n if (videoElement) {\n videoElement.addEventListener(api.keyerror, eventHandler);\n videoElement.addEventListener(api.needkey, eventHandler);\n videoElement.addEventListener(api.keymessage, eventHandler);\n videoElement.addEventListener(api.keyadded, eventHandler);\n eventBus.trigger(events.VIDEO_ELEMENT_SELECTED);\n }\n }\n\n function createKeySession(ksInfo) {\n if (!keySystem) {\n throw new Error(\'Can not create sessions until you have selected a key system\');\n } // Determine if creating a new session is allowed\n\n\n if (moreSessionsAllowed || sessions.length === 0) {\n var newSession = {\n // Implements SessionToken\n sessionId: null,\n keyId: ksInfo.keyId,\n initData: ksInfo.initData,\n getKeyId: function getKeyId() {\n return this.keyId;\n },\n getSessionId: function getSessionId() {\n return this.sessionId;\n },\n getExpirationTime: function getExpirationTime() {\n return NaN;\n },\n getSessionType: function getSessionType() {\n return \'temporary\';\n }\n };\n pendingSessions.push(newSession); // Send our request to the CDM\n\n videoElement[api.generateKeyRequest](keySystem.systemString, new Uint8Array(ksInfo.initData));\n return newSession;\n } else {\n throw new Error(\'Multiple sessions not allowed!\');\n }\n }\n\n function updateKeySession(sessionToken, message) {\n var sessionId = sessionToken.sessionId;\n\n if (!protectionKeyController.isClearKey(keySystem)) {\n // Send our request to the CDM\n videoElement[api.addKey](keySystem.systemString, new Uint8Array(message), new Uint8Array(sessionToken.initData), sessionId);\n } else {\n // For clearkey, message is a ClearKeyKeySet\n for (var i = 0; i < message.keyPairs.length; i++) {\n videoElement[api.addKey](keySystem.systemString, message.keyPairs[i].key, message.keyPairs[i].keyID, sessionId);\n }\n }\n\n eventBus.trigger(events.KEY_SESSION_UPDATED);\n }\n\n function closeKeySession(sessionToken) {\n // Send our request to the CDM\n try {\n videoElement[api.cancelKeyRequest](keySystem.systemString, sessionToken.sessionId);\n } catch (error) {\n eventBus.trigger(events.KEY_SESSION_CLOSED, {\n data: null,\n error: \'Error closing session (\' + sessionToken.sessionId + \') \' + error.message\n });\n }\n }\n\n function setServerCertificate()\n /*serverCertificate*/\n {\n /* Not supported */\n }\n\n function loadKeySession()\n /*ksInfo*/\n {\n /* Not supported */\n }\n\n function removeKeySession()\n /*sessionToken*/\n {\n /* Not supported */\n }\n\n function createEventHandler() {\n return {\n handleEvent: function handleEvent(event) {\n var sessionToken = null;\n\n switch (event.type) {\n case api.needkey:\n var initData = ArrayBuffer.isView(event.initData) ? event.initData.buffer : event.initData;\n eventBus.trigger(events.NEED_KEY, {\n key: new _vo_NeedKey__WEBPACK_IMPORTED_MODULE_1__["default"](initData, \'cenc\')\n });\n break;\n\n case api.keyerror:\n sessionToken = findSessionByID(sessions, event.sessionId);\n\n if (!sessionToken) {\n sessionToken = findSessionByID(pendingSessions, event.sessionId);\n }\n\n if (sessionToken) {\n var code = _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_CODE;\n var msg = \'\';\n\n switch (event.errorCode.code) {\n case 1:\n code = _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_UNKNOWN_CODE;\n msg += \'MEDIA_KEYERR_UNKNOWN - \' + _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_UNKNOWN_MESSAGE;\n break;\n\n case 2:\n code = _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_CLIENT_CODE;\n msg += \'MEDIA_KEYERR_CLIENT - \' + _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_CLIENT_MESSAGE;\n break;\n\n case 3:\n code = _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_SERVICE_CODE;\n msg += \'MEDIA_KEYERR_SERVICE - \' + _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_SERVICE_MESSAGE;\n break;\n\n case 4:\n code = _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_OUTPUT_CODE;\n msg += \'MEDIA_KEYERR_OUTPUT - \' + _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_OUTPUT_MESSAGE;\n break;\n\n case 5:\n code = _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_HARDWARECHANGE_CODE;\n msg += \'MEDIA_KEYERR_HARDWARECHANGE - \' + _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_HARDWARECHANGE_MESSAGE;\n break;\n\n case 6:\n code = _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_DOMAIN_CODE;\n msg += \'MEDIA_KEYERR_DOMAIN - \' + _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEYERR_DOMAIN_MESSAGE;\n break;\n }\n\n msg += \' System Code = \' + event.systemCode; // TODO: Build error string based on key error\n\n eventBus.trigger(events.KEY_ERROR, {\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_2__["default"](code, msg, sessionToken)\n });\n } else {\n logger.error(\'No session token found for key error\');\n }\n\n break;\n\n case api.keyadded:\n sessionToken = findSessionByID(sessions, event.sessionId);\n\n if (!sessionToken) {\n sessionToken = findSessionByID(pendingSessions, event.sessionId);\n }\n\n if (sessionToken) {\n logger.debug(\'DRM: Key added.\');\n eventBus.trigger(events.KEY_ADDED, {\n data: sessionToken\n }); //TODO not sure anything is using sessionToken? why there?\n } else {\n logger.debug(\'No session token found for key added\');\n }\n\n break;\n\n case api.keymessage:\n // If this CDM does not support session IDs, we will be limited\n // to a single session\n moreSessionsAllowed = event.sessionId !== null && event.sessionId !== undefined; // SessionIDs supported\n\n if (moreSessionsAllowed) {\n // Attempt to find an uninitialized token with this sessionId\n sessionToken = findSessionByID(sessions, event.sessionId);\n\n if (!sessionToken && pendingSessions.length > 0) {\n // This is the first message for our latest session, so set the\n // sessionId and add it to our list\n sessionToken = pendingSessions.shift();\n sessions.push(sessionToken);\n sessionToken.sessionId = event.sessionId;\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: sessionToken\n });\n }\n } else if (pendingSessions.length > 0) {\n // SessionIDs not supported\n sessionToken = pendingSessions.shift();\n sessions.push(sessionToken);\n\n if (pendingSessions.length !== 0) {\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_2__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEY_MESSAGE_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIA_KEY_MESSAGE_ERROR_MESSAGE));\n }\n }\n\n if (sessionToken) {\n var message = ArrayBuffer.isView(event.message) ? event.message.buffer : event.message; // For ClearKey, the spec mandates that you pass this message to the\n // addKey method, so we always save it to the token since there is no\n // way to tell which key system is in use\n\n sessionToken.keyMessage = message;\n eventBus.trigger(events.INTERNAL_KEY_MESSAGE, {\n data: new _vo_KeyMessage__WEBPACK_IMPORTED_MODULE_3__["default"](sessionToken, message, event.defaultURL)\n });\n } else {\n logger.warn(\'No session token found for key message\');\n }\n\n break;\n }\n }\n };\n }\n /**\n * Helper function to retrieve the stored session token based on a given\n * sessionId value\n *\n * @param {Array} sessionArray - the array of sessions to search\n * @param {*} sessionId - the sessionId to search for\n * @returns {*} the session token with the given sessionId\n */\n\n\n function findSessionByID(sessionArray, sessionId) {\n if (!sessionId || !sessionArray) {\n return null;\n } else {\n var len = sessionArray.length;\n\n for (var i = 0; i < len; i++) {\n if (sessionArray[i].sessionId == sessionId) {\n return sessionArray[i];\n }\n }\n\n return null;\n }\n }\n\n function removeEventListeners() {\n videoElement.removeEventListener(api.keyerror, eventHandler);\n videoElement.removeEventListener(api.needkey, eventHandler);\n videoElement.removeEventListener(api.keymessage, eventHandler);\n videoElement.removeEventListener(api.keyadded, eventHandler);\n }\n\n instance = {\n getAllInitData: getAllInitData,\n getSessions: getSessions,\n requestKeySystemAccess: requestKeySystemAccess,\n selectKeySystem: selectKeySystem,\n setMediaElement: setMediaElement,\n createKeySession: createKeySession,\n updateKeySession: updateKeySession,\n closeKeySession: closeKeySession,\n setServerCertificate: setServerCertificate,\n loadKeySession: loadKeySession,\n removeKeySession: removeKeySession,\n stop: reset,\n reset: reset\n };\n setup();\n return instance;\n}\n\nProtectionModel_01b.__dashjs_factory_name = \'ProtectionModel_01b\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(ProtectionModel_01b));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/models/ProtectionModel_21Jan2015.js":\n/*!**********************************************************************!*\\\n !*** ./src/streaming/protection/models/ProtectionModel_21Jan2015.js ***!\n \\**********************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2012613__) {\n__nested_webpack_require_2012613__.r(__nested_webpack_exports__);\n/* harmony import */ var _controllers_ProtectionKeyController__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2012613__(/*! ../controllers/ProtectionKeyController */ "./src/streaming/protection/controllers/ProtectionKeyController.js");\n/* harmony import */ var _vo_NeedKey__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2012613__(/*! ../vo/NeedKey */ "./src/streaming/protection/vo/NeedKey.js");\n/* harmony import */ var _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2012613__(/*! ../errors/ProtectionErrors */ "./src/streaming/protection/errors/ProtectionErrors.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2012613__(/*! ../../vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _vo_KeyMessage__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2012613__(/*! ../vo/KeyMessage */ "./src/streaming/protection/vo/KeyMessage.js");\n/* harmony import */ var _vo_KeySystemAccess__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2012613__(/*! ../vo/KeySystemAccess */ "./src/streaming/protection/vo/KeySystemAccess.js");\n/* harmony import */ var _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2012613__(/*! ../../constants/ProtectionConstants */ "./src/streaming/constants/ProtectionConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Most recent EME implementation\n *\n * Implemented by Google Chrome v36+ (Windows, OSX, Linux)\n *\n * @implements ProtectionModel\n * @class\n */\n\n\n\n\n\n\n\n\nfunction ProtectionModel_21Jan2015(config) {\n config = config || {};\n var context = this.context;\n var eventBus = config.eventBus; //Need to pass in here so we can use same instance since this is optional module\n\n var events = config.events;\n var debug = config.debug;\n var instance, logger, keySystem, videoElement, mediaKeys, sessions, eventHandler, protectionKeyController;\n\n function setup() {\n logger = debug.getLogger(instance);\n keySystem = null;\n videoElement = null;\n mediaKeys = null;\n sessions = [];\n protectionKeyController = Object(_controllers_ProtectionKeyController__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n eventHandler = createEventHandler();\n }\n\n function reset() {\n var numSessions = sessions.length;\n var session;\n\n if (numSessions !== 0) {\n (function () {\n // Called when we are done closing a session. Success or fail\n var done = function done(session) {\n removeSession(session);\n\n if (sessions.length === 0) {\n if (videoElement) {\n videoElement.removeEventListener(\'encrypted\', eventHandler);\n videoElement.setMediaKeys(null).then(function () {\n eventBus.trigger(events.TEARDOWN_COMPLETE);\n });\n } else {\n eventBus.trigger(events.TEARDOWN_COMPLETE);\n }\n }\n };\n\n for (var i = 0; i < numSessions; i++) {\n session = sessions[i];\n\n (function (s) {\n // Override closed promise resolver\n session.session.closed.then(function () {\n done(s);\n }); // Close the session and handle errors, otherwise promise\n // resolver above will be called\n\n _closeKeySessionInternal(session)["catch"](function () {\n done(s);\n });\n })(session);\n }\n })();\n } else {\n eventBus.trigger(events.TEARDOWN_COMPLETE);\n }\n }\n\n function stop() {\n // Close and remove not usable sessions\n var session;\n\n for (var i = 0; i < sessions.length; i++) {\n session = sessions[i];\n\n if (!session.getUsable()) {\n _closeKeySessionInternal(session)["catch"](function () {\n removeSession(session);\n });\n }\n }\n }\n\n function getAllInitData() {\n var retVal = [];\n\n for (var i = 0; i < sessions.length; i++) {\n if (sessions[i].initData) {\n retVal.push(sessions[i].initData);\n }\n }\n\n return retVal;\n }\n\n function getSessions() {\n return sessions;\n }\n\n function requestKeySystemAccess(ksConfigurations) {\n return new Promise(function (resolve, reject) {\n _requestKeySystemAccessInternal(ksConfigurations, 0, resolve, reject);\n });\n }\n /**\n * Initializes access to a key system. Once we found a valid configuration we get a mediaKeySystemAccess object\n * @param ksConfigurations\n * @param idx\n * @param resolve\n * @param reject\n * @private\n */\n\n\n function _requestKeySystemAccessInternal(ksConfigurations, idx, resolve, reject) {\n if (navigator.requestMediaKeySystemAccess === undefined || typeof navigator.requestMediaKeySystemAccess !== \'function\') {\n var msg = \'Insecure origins are not allowed\';\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, {\n error: msg\n });\n reject({\n error: msg\n });\n return;\n }\n\n var keySystem = ksConfigurations[idx].ks;\n var configs = ksConfigurations[idx].configs;\n var systemString = keySystem.systemString; // Patch to support persistent licenses on Edge browser (see issue #2658)\n\n if (systemString === _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_6__["default"].PLAYREADY_KEYSTEM_STRING && configs[0].persistentState === \'required\') {\n systemString += \'.recommendation\';\n }\n\n navigator.requestMediaKeySystemAccess(systemString, configs).then(function (mediaKeySystemAccess) {\n var configuration = typeof mediaKeySystemAccess.getConfiguration === \'function\' ? mediaKeySystemAccess.getConfiguration() : null;\n var keySystemAccess = new _vo_KeySystemAccess__WEBPACK_IMPORTED_MODULE_5__["default"](keySystem, configuration);\n keySystemAccess.mksa = mediaKeySystemAccess;\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, {\n data: keySystemAccess\n });\n resolve({\n data: keySystemAccess\n });\n })["catch"](function (error) {\n if (idx + 1 < ksConfigurations.length) {\n _requestKeySystemAccessInternal(ksConfigurations, idx + 1, resolve, reject);\n } else {\n var errorMessage = \'Key system access denied! \';\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, {\n error: errorMessage + error.message\n });\n reject({\n error: errorMessage + error.message\n });\n }\n });\n }\n /**\n * Selects a key system by creating the mediaKeys and adding them to the video element\n * @param keySystemAccess\n * @return {Promise<unknown>}\n */\n\n\n function selectKeySystem(keySystemAccess) {\n return new Promise(function (resolve, reject) {\n keySystemAccess.mksa.createMediaKeys().then(function (mkeys) {\n keySystem = keySystemAccess.keySystem;\n mediaKeys = mkeys;\n\n if (videoElement) {\n return videoElement.setMediaKeys(mediaKeys);\n } else {\n return Promise.resolve();\n }\n }).then(function () {\n resolve(keySystem);\n })["catch"](function () {\n reject({\n error: \'Error selecting keys system (\' + keySystemAccess.keySystem.systemString + \')! Could not create MediaKeys -- TODO\'\n });\n });\n });\n }\n\n function setMediaElement(mediaElement) {\n if (videoElement === mediaElement) return; // Replacing the previous element\n\n if (videoElement) {\n videoElement.removeEventListener(\'encrypted\', eventHandler);\n\n if (videoElement.setMediaKeys) {\n videoElement.setMediaKeys(null);\n }\n }\n\n videoElement = mediaElement; // Only if we are not detaching from the existing element\n\n if (videoElement) {\n videoElement.addEventListener(\'encrypted\', eventHandler);\n\n if (videoElement.setMediaKeys && mediaKeys) {\n videoElement.setMediaKeys(mediaKeys);\n }\n }\n }\n\n function setServerCertificate(serverCertificate) {\n if (!keySystem || !mediaKeys) {\n throw new Error(\'Can not set server certificate until you have selected a key system\');\n }\n\n mediaKeys.setServerCertificate(serverCertificate).then(function () {\n logger.info(\'DRM: License server certificate successfully updated.\');\n eventBus.trigger(events.SERVER_CERTIFICATE_UPDATED);\n })["catch"](function (error) {\n eventBus.trigger(events.SERVER_CERTIFICATE_UPDATED, {\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_3__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__["default"].SERVER_CERTIFICATE_UPDATED_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__["default"].SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE + error.name)\n });\n });\n }\n /**\n * Create a key session, a session token and initialize a request by calling generateRequest\n * @param ksInfo\n */\n\n\n function createKeySession(ksInfo) {\n if (!keySystem || !mediaKeys) {\n throw new Error(\'Can not create sessions until you have selected a key system\');\n }\n\n var session = mediaKeys.createSession(ksInfo.sessionType);\n var sessionToken = createSessionToken(session, ksInfo); // The "keyids" type is used for Clearkey when keys are provided directly in the protection data and a request to a license server is not needed\n\n var dataType = keySystem.systemString === _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_6__["default"].CLEARKEY_KEYSTEM_STRING && (ksInfo.initData || ksInfo.protData && ksInfo.protData.clearkeys) ? _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_6__["default"].INITIALIZATION_DATA_TYPE_KEYIDS : _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_6__["default"].INITIALIZATION_DATA_TYPE_CENC;\n session.generateRequest(dataType, ksInfo.initData).then(function () {\n logger.debug(\'DRM: Session created. SessionID = \' + sessionToken.getSessionId());\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: sessionToken\n });\n })["catch"](function (error) {\n removeSession(sessionToken);\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: null,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_3__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__["default"].KEY_SESSION_CREATED_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__["default"].KEY_SESSION_CREATED_ERROR_MESSAGE + \'Error generating key request -- \' + error.name)\n });\n });\n }\n\n function updateKeySession(sessionToken, message) {\n var session = sessionToken.session; // Send our request to the key session\n\n if (protectionKeyController.isClearKey(keySystem)) {\n message = message.toJWK();\n }\n\n session.update(message).then(function () {\n eventBus.trigger(events.KEY_SESSION_UPDATED);\n })["catch"](function (error) {\n eventBus.trigger(events.KEY_ERROR, {\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_3__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__["default"].MEDIA_KEYERR_CODE, \'Error sending update() message! \' + error.name, sessionToken)\n });\n });\n }\n\n function loadKeySession(ksInfo) {\n if (!keySystem || !mediaKeys) {\n throw new Error(\'Can not load sessions until you have selected a key system\');\n }\n\n var sessionId = ksInfo.sessionId; // Check if session Id is not already loaded or loading\n\n for (var i = 0; i < sessions.length; i++) {\n if (sessionId === sessions[i].sessionId) {\n logger.warn(\'DRM: Ignoring session ID because we have already seen it!\');\n return;\n }\n }\n\n var session = mediaKeys.createSession(ksInfo.sessionType);\n var sessionToken = createSessionToken(session, ksInfo); // Load persisted session data into our newly created session object\n\n session.load(sessionId).then(function (success) {\n if (success) {\n logger.debug(\'DRM: Session loaded. SessionID = \' + sessionToken.getSessionId());\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: sessionToken\n });\n } else {\n removeSession(sessionToken);\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: null,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_3__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__["default"].KEY_SESSION_CREATED_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__["default"].KEY_SESSION_CREATED_ERROR_MESSAGE + \'Could not load session! Invalid Session ID (\' + sessionId + \')\')\n });\n }\n })["catch"](function (error) {\n removeSession(sessionToken);\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: null,\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_3__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__["default"].KEY_SESSION_CREATED_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__["default"].KEY_SESSION_CREATED_ERROR_MESSAGE + \'Could not load session (\' + sessionId + \')! \' + error.name)\n });\n });\n }\n\n function removeKeySession(sessionToken) {\n var session = sessionToken.session;\n session.remove().then(function () {\n logger.debug(\'DRM: Session removed. SessionID = \' + sessionToken.getSessionId());\n eventBus.trigger(events.KEY_SESSION_REMOVED, {\n data: sessionToken.getSessionId()\n });\n }, function (error) {\n eventBus.trigger(events.KEY_SESSION_REMOVED, {\n data: null,\n error: \'Error removing session (\' + sessionToken.getSessionId() + \'). \' + error.name\n });\n });\n }\n\n function closeKeySession(sessionToken) {\n // Send our request to the key session\n _closeKeySessionInternal(sessionToken)["catch"](function (error) {\n removeSession(sessionToken);\n eventBus.trigger(events.KEY_SESSION_CLOSED, {\n data: null,\n error: \'Error closing session (\' + sessionToken.getSessionId() + \') \' + error.name\n });\n });\n }\n\n function _closeKeySessionInternal(sessionToken) {\n var session = sessionToken.session; // Remove event listeners\n\n session.removeEventListener(\'keystatuseschange\', sessionToken);\n session.removeEventListener(\'message\', sessionToken); // Send our request to the key session\n\n return session.close();\n } // This is our main event handler for all desired HTMLMediaElement events\n // related to EME. These events are translated into our API-independent\n // versions of the same events\n\n\n function createEventHandler() {\n return {\n handleEvent: function handleEvent(event) {\n switch (event.type) {\n case \'encrypted\':\n if (event.initData) {\n var initData = ArrayBuffer.isView(event.initData) ? event.initData.buffer : event.initData;\n eventBus.trigger(events.NEED_KEY, {\n key: new _vo_NeedKey__WEBPACK_IMPORTED_MODULE_1__["default"](initData, event.initDataType)\n });\n }\n\n break;\n }\n }\n };\n }\n\n function removeSession(token) {\n // Remove from our session list\n for (var i = 0; i < sessions.length; i++) {\n if (sessions[i] === token) {\n sessions.splice(i, 1);\n break;\n }\n }\n }\n\n function parseKeyStatus(args) {\n // Edge and Chrome implement different version of keystatues, param are not on same order\n var status, keyId;\n\n if (args && args.length > 0) {\n if (args[0]) {\n if (typeof args[0] === \'string\') {\n status = args[0];\n } else {\n keyId = args[0];\n }\n }\n\n if (args[1]) {\n if (typeof args[1] === \'string\') {\n status = args[1];\n } else {\n keyId = args[1];\n }\n }\n }\n\n return {\n status: status,\n keyId: keyId\n };\n } // Function to create our session token objects which manage the EME\n // MediaKeySession and session-specific event handler\n\n\n function createSessionToken(session, ksInfo) {\n var token = {\n // Implements SessionToken\n session: session,\n keyId: ksInfo.keyId,\n initData: ksInfo.initData,\n sessionId: ksInfo.sessionId,\n sessionType: ksInfo.sessionType,\n // This is our main event handler for all desired MediaKeySession events\n // These events are translated into our API-independent versions of the\n // same events\n handleEvent: function handleEvent(event) {\n switch (event.type) {\n case \'keystatuseschange\':\n eventBus.trigger(events.KEY_STATUSES_CHANGED, {\n data: this\n });\n event.target.keyStatuses.forEach(function () {\n var keyStatus = parseKeyStatus(arguments);\n\n switch (keyStatus.status) {\n case \'expired\':\n eventBus.trigger(events.INTERNAL_KEY_STATUS_CHANGED, {\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_3__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__["default"].KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE, _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_2__["default"].KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE)\n });\n break;\n\n default:\n eventBus.trigger(events.INTERNAL_KEY_STATUS_CHANGED, keyStatus);\n break;\n }\n });\n break;\n\n case \'message\':\n var message = ArrayBuffer.isView(event.message) ? event.message.buffer : event.message;\n eventBus.trigger(events.INTERNAL_KEY_MESSAGE, {\n data: new _vo_KeyMessage__WEBPACK_IMPORTED_MODULE_4__["default"](this, message, undefined, event.messageType)\n });\n break;\n }\n },\n getKeyId: function getKeyId() {\n return this.keyId;\n },\n getSessionId: function getSessionId() {\n return session.sessionId;\n },\n getSessionType: function getSessionType() {\n return this.sessionType;\n },\n getExpirationTime: function getExpirationTime() {\n return session.expiration;\n },\n getKeyStatuses: function getKeyStatuses() {\n return session.keyStatuses;\n },\n getUsable: function getUsable() {\n var usable = false;\n session.keyStatuses.forEach(function () {\n var keyStatus = parseKeyStatus(arguments);\n\n if (keyStatus.status === \'usable\') {\n usable = true;\n }\n });\n return usable;\n }\n }; // Add all event listeners\n\n session.addEventListener(\'keystatuseschange\', token);\n session.addEventListener(\'message\', token); // Register callback for session closed Promise\n\n session.closed.then(function () {\n removeSession(token);\n logger.debug(\'DRM: Session closed. SessionID = \' + token.getSessionId());\n eventBus.trigger(events.KEY_SESSION_CLOSED, {\n data: token.getSessionId()\n });\n }); // Add to our session list\n\n sessions.push(token);\n return token;\n }\n\n instance = {\n getAllInitData: getAllInitData,\n getSessions: getSessions,\n requestKeySystemAccess: requestKeySystemAccess,\n selectKeySystem: selectKeySystem,\n setMediaElement: setMediaElement,\n setServerCertificate: setServerCertificate,\n createKeySession: createKeySession,\n updateKeySession: updateKeySession,\n loadKeySession: loadKeySession,\n removeKeySession: removeKeySession,\n closeKeySession: closeKeySession,\n stop: stop,\n reset: reset\n };\n setup();\n return instance;\n}\n\nProtectionModel_21Jan2015.__dashjs_factory_name = \'ProtectionModel_21Jan2015\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(ProtectionModel_21Jan2015));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/models/ProtectionModel_3Feb2014.js":\n/*!*********************************************************************!*\\\n !*** ./src/streaming/protection/models/ProtectionModel_3Feb2014.js ***!\n \\*********************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2034431__) {\n__nested_webpack_require_2034431__.r(__nested_webpack_exports__);\n/* harmony import */ var _controllers_ProtectionKeyController__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2034431__(/*! ../controllers/ProtectionKeyController */ "./src/streaming/protection/controllers/ProtectionKeyController.js");\n/* harmony import */ var _vo_NeedKey__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2034431__(/*! ../vo/NeedKey */ "./src/streaming/protection/vo/NeedKey.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2034431__(/*! ../../vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2034431__(/*! ../errors/ProtectionErrors */ "./src/streaming/protection/errors/ProtectionErrors.js");\n/* harmony import */ var _vo_KeyMessage__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2034431__(/*! ../vo/KeyMessage */ "./src/streaming/protection/vo/KeyMessage.js");\n/* harmony import */ var _vo_KeySystemConfiguration__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2034431__(/*! ../vo/KeySystemConfiguration */ "./src/streaming/protection/vo/KeySystemConfiguration.js");\n/* harmony import */ var _vo_KeySystemAccess__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2034431__(/*! ../vo/KeySystemAccess */ "./src/streaming/protection/vo/KeySystemAccess.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Implementation of the EME APIs as of the 3 Feb 2014 state of the specification.\n *\n * Implemented by Internet Explorer 11 (Windows 8.1)\n *\n * @implements ProtectionModel\n * @class\n */\n\n\n\n\n\n\n\n\nfunction ProtectionModel_3Feb2014(config) {\n config = config || {};\n var context = this.context;\n var eventBus = config.eventBus; //Need to pass in here so we can use same instance since this is optional module\n\n var events = config.events;\n var debug = config.debug;\n var api = config.api;\n var instance, logger, videoElement, keySystem, mediaKeys, keySystemAccess, sessions, eventHandler, protectionKeyController;\n\n function setup() {\n logger = debug.getLogger(instance);\n videoElement = null;\n keySystem = null;\n mediaKeys = null;\n keySystemAccess = null;\n sessions = [];\n protectionKeyController = Object(_controllers_ProtectionKeyController__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n eventHandler = createEventHandler();\n }\n\n function reset() {\n try {\n for (var i = 0; i < sessions.length; i++) {\n closeKeySession(sessions[i]);\n }\n\n if (videoElement) {\n videoElement.removeEventListener(api.needkey, eventHandler);\n }\n\n eventBus.trigger(events.TEARDOWN_COMPLETE);\n } catch (error) {\n eventBus.trigger(events.TEARDOWN_COMPLETE, {\n error: \'Error tearing down key sessions and MediaKeys! -- \' + error.message\n });\n }\n }\n\n function getAllInitData() {\n var retVal = [];\n\n for (var i = 0; i < sessions.length; i++) {\n retVal.push(sessions[i].initData);\n }\n\n return retVal;\n }\n\n function getSessions() {\n return sessions;\n }\n\n function requestKeySystemAccess(ksConfigurations) {\n return new Promise(function (resolve, reject) {\n // Try key systems in order, first one with supported key system configuration\n // is used\n var found = false;\n\n for (var ksIdx = 0; ksIdx < ksConfigurations.length; ksIdx++) {\n var systemString = ksConfigurations[ksIdx].ks.systemString;\n var configs = ksConfigurations[ksIdx].configs;\n var supportedAudio = null;\n var supportedVideo = null; // Try key system configs in order, first one with supported audio/video\n // is used\n\n for (var configIdx = 0; configIdx < configs.length; configIdx++) {\n var audios = configs[configIdx].audioCapabilities;\n var videos = configs[configIdx].videoCapabilities; // Look for supported audio container/codecs\n\n if (audios && audios.length !== 0) {\n supportedAudio = []; // Indicates that we have a requested audio config\n\n for (var audioIdx = 0; audioIdx < audios.length; audioIdx++) {\n if (window[api.MediaKeys].isTypeSupported(systemString, audios[audioIdx].contentType)) {\n supportedAudio.push(audios[audioIdx]);\n }\n }\n } // Look for supported video container/codecs\n\n\n if (videos && videos.length !== 0) {\n supportedVideo = []; // Indicates that we have a requested video config\n\n for (var videoIdx = 0; videoIdx < videos.length; videoIdx++) {\n if (window[api.MediaKeys].isTypeSupported(systemString, videos[videoIdx].contentType)) {\n supportedVideo.push(videos[videoIdx]);\n }\n }\n } // No supported audio or video in this configuration OR we have\n // requested audio or video configuration that is not supported\n\n\n if (!supportedAudio && !supportedVideo || supportedAudio && supportedAudio.length === 0 || supportedVideo && supportedVideo.length === 0) {\n continue;\n } // This configuration is supported\n\n\n found = true;\n var ksConfig = new _vo_KeySystemConfiguration__WEBPACK_IMPORTED_MODULE_5__["default"](supportedAudio, supportedVideo);\n var ks = protectionKeyController.getKeySystemBySystemString(systemString);\n\n var _keySystemAccess = new _vo_KeySystemAccess__WEBPACK_IMPORTED_MODULE_6__["default"](ks, ksConfig);\n\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, {\n data: _keySystemAccess\n });\n resolve({\n data: _keySystemAccess\n });\n break;\n }\n }\n\n if (!found) {\n var errorMessage = \'Key system access denied! -- No valid audio/video content configurations detected!\';\n eventBus.trigger(events.KEY_SYSTEM_ACCESS_COMPLETE, {\n error: errorMessage\n });\n reject({\n error: errorMessage\n });\n }\n });\n }\n\n function selectKeySystem(ksAccess) {\n return new Promise(function (resolve, reject) {\n try {\n mediaKeys = ksAccess.mediaKeys = new window[api.MediaKeys](ksAccess.keySystem.systemString);\n keySystem = ksAccess.keySystem;\n keySystemAccess = ksAccess;\n\n if (videoElement) {\n setMediaKeys();\n }\n\n resolve(keySystem);\n } catch (error) {\n reject({\n error: \'Error selecting keys system (\' + keySystem.systemString + \')! Could not create MediaKeys -- TODO\'\n });\n }\n });\n }\n\n function setMediaElement(mediaElement) {\n if (videoElement === mediaElement) return; // Replacing the previous element\n\n if (videoElement) {\n videoElement.removeEventListener(api.needkey, eventHandler);\n }\n\n videoElement = mediaElement; // Only if we are not detaching from the existing element\n\n if (videoElement) {\n videoElement.addEventListener(api.needkey, eventHandler);\n\n if (mediaKeys) {\n setMediaKeys();\n }\n }\n }\n\n function createKeySession(ksInfo) {\n if (!keySystem || !mediaKeys || !keySystemAccess) {\n throw new Error(\'Can not create sessions until you have selected a key system\');\n } // Use the first video capability for the contentType.\n // TODO: Not sure if there is a way to concatenate all capability data into a RFC6386-compatible format\n // If player is trying to playback Audio only stream - don\'t error out.\n\n\n var capabilities = null;\n\n if (keySystemAccess.ksConfiguration.videoCapabilities && keySystemAccess.ksConfiguration.videoCapabilities.length > 0) {\n capabilities = keySystemAccess.ksConfiguration.videoCapabilities[0];\n }\n\n if (capabilities === null && keySystemAccess.ksConfiguration.audioCapabilities && keySystemAccess.ksConfiguration.audioCapabilities.length > 0) {\n capabilities = keySystemAccess.ksConfiguration.audioCapabilities[0];\n }\n\n if (capabilities === null) {\n throw new Error(\'Can not create sessions for unknown content types.\');\n }\n\n var contentType = capabilities.contentType;\n var session = mediaKeys.createSession(contentType, new Uint8Array(ksInfo.initData), ksInfo.cdmData ? new Uint8Array(ksInfo.cdmData) : null);\n var sessionToken = createSessionToken(session, ksInfo); // Add all event listeners\n\n session.addEventListener(api.error, sessionToken);\n session.addEventListener(api.message, sessionToken);\n session.addEventListener(api.ready, sessionToken);\n session.addEventListener(api.close, sessionToken); // Add to our session list\n\n sessions.push(sessionToken);\n logger.debug(\'DRM: Session created. SessionID = \' + sessionToken.getSessionId());\n eventBus.trigger(events.KEY_SESSION_CREATED, {\n data: sessionToken\n });\n }\n\n function updateKeySession(sessionToken, message) {\n var session = sessionToken.session;\n\n if (!protectionKeyController.isClearKey(keySystem)) {\n // Send our request to the key session\n session.update(new Uint8Array(message));\n } else {\n // For clearkey, message is a ClearKeyKeySet\n session.update(new Uint8Array(message.toJWK()));\n }\n\n eventBus.trigger(events.KEY_SESSION_UPDATED);\n }\n /**\n * Close the given session and release all associated keys. Following\n * this call, the sessionToken becomes invalid\n *\n * @param {Object} sessionToken - the session token\n */\n\n\n function closeKeySession(sessionToken) {\n var session = sessionToken.session; // Remove event listeners\n\n session.removeEventListener(api.error, sessionToken);\n session.removeEventListener(api.message, sessionToken);\n session.removeEventListener(api.ready, sessionToken);\n session.removeEventListener(api.close, sessionToken); // Remove from our session list\n\n for (var i = 0; i < sessions.length; i++) {\n if (sessions[i] === sessionToken) {\n sessions.splice(i, 1);\n break;\n }\n } // Send our request to the key session\n\n\n session[api.release]();\n }\n\n function setServerCertificate()\n /*serverCertificate*/\n {\n /* Not supported */\n }\n\n function loadKeySession()\n /*ksInfo*/\n {\n /* Not supported */\n }\n\n function removeKeySession()\n /*sessionToken*/\n {\n /* Not supported */\n }\n\n function createEventHandler() {\n return {\n handleEvent: function handleEvent(event) {\n switch (event.type) {\n case api.needkey:\n if (event.initData) {\n var initData = ArrayBuffer.isView(event.initData) ? event.initData.buffer : event.initData;\n eventBus.trigger(events.NEED_KEY, {\n key: new _vo_NeedKey__WEBPACK_IMPORTED_MODULE_1__["default"](initData, \'cenc\')\n });\n }\n\n break;\n }\n }\n };\n } // IE11 does not let you set MediaKeys until it has entered a certain\n // readyState, so we need this logic to ensure we don\'t set the keys\n // too early\n\n\n function setMediaKeys() {\n var boundDoSetKeys = null;\n\n var doSetKeys = function doSetKeys() {\n videoElement.removeEventListener(\'loadedmetadata\', boundDoSetKeys);\n videoElement[api.setMediaKeys](mediaKeys);\n eventBus.trigger(events.VIDEO_ELEMENT_SELECTED);\n };\n\n if (videoElement.readyState >= 1) {\n doSetKeys();\n } else {\n boundDoSetKeys = doSetKeys.bind(this);\n videoElement.addEventListener(\'loadedmetadata\', boundDoSetKeys);\n }\n } // Function to create our session token objects which manage the EME\n // MediaKeySession and session-specific event handler\n\n\n function createSessionToken(keySession, ksInfo) {\n return {\n // Implements SessionToken\n session: keySession,\n keyId: ksInfo.keyId,\n initData: ksInfo.initData,\n getKeyId: function getKeyId() {\n return this.keyId;\n },\n getSessionId: function getSessionId() {\n return this.session.sessionId;\n },\n getExpirationTime: function getExpirationTime() {\n return NaN;\n },\n getSessionType: function getSessionType() {\n return \'temporary\';\n },\n // This is our main event handler for all desired MediaKeySession events\n // These events are translated into our API-independent versions of the\n // same events\n handleEvent: function handleEvent(event) {\n switch (event.type) {\n case api.error:\n var errorStr = \'KeyError\'; // TODO: Make better string from event\n\n eventBus.trigger(events.KEY_ERROR, {\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_2__["default"](_errors_ProtectionErrors__WEBPACK_IMPORTED_MODULE_3__["default"].MEDIA_KEYERR_CODE, errorStr, this)\n });\n break;\n\n case api.message:\n var message = ArrayBuffer.isView(event.message) ? event.message.buffer : event.message;\n eventBus.trigger(events.INTERNAL_KEY_MESSAGE, {\n data: new _vo_KeyMessage__WEBPACK_IMPORTED_MODULE_4__["default"](this, message, event.destinationURL)\n });\n break;\n\n case api.ready:\n logger.debug(\'DRM: Key added.\');\n eventBus.trigger(events.KEY_ADDED);\n break;\n\n case api.close:\n logger.debug(\'DRM: Session closed. SessionID = \' + this.getSessionId());\n eventBus.trigger(events.KEY_SESSION_CLOSED, {\n data: this.getSessionId()\n });\n break;\n }\n }\n };\n }\n\n instance = {\n getAllInitData: getAllInitData,\n getSessions: getSessions,\n requestKeySystemAccess: requestKeySystemAccess,\n selectKeySystem: selectKeySystem,\n setMediaElement: setMediaElement,\n createKeySession: createKeySession,\n updateKeySession: updateKeySession,\n closeKeySession: closeKeySession,\n setServerCertificate: setServerCertificate,\n loadKeySession: loadKeySession,\n removeKeySession: removeKeySession,\n stop: reset,\n reset: reset\n };\n setup();\n return instance;\n}\n\nProtectionModel_3Feb2014.__dashjs_factory_name = \'ProtectionModel_3Feb2014\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getClassFactory(ProtectionModel_3Feb2014));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/servers/ClearKey.js":\n/*!******************************************************!*\\\n !*** ./src/streaming/protection/servers/ClearKey.js ***!\n \\******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2050751__) {\n__nested_webpack_require_2050751__.r(__nested_webpack_exports__);\n/* harmony import */ var _vo_KeyPair__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2050751__(/*! ../vo/KeyPair */ "./src/streaming/protection/vo/KeyPair.js");\n/* harmony import */ var _vo_ClearKeyKeySet__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2050751__(/*! ../vo/ClearKeyKeySet */ "./src/streaming/protection/vo/ClearKeyKeySet.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * CableLabs ClearKey license server implementation\n *\n * For testing purposes and evaluating potential uses for ClearKey, we have developed\n * a dirt-simple API for requesting ClearKey licenses from a remote server.\n *\n * @implements LicenseServer\n * @class\n */\n\n\n\nfunction ClearKey() {\n var instance;\n\n function getServerURLFromMessage(url\n /* message, messageType*/\n ) {\n return url;\n }\n\n function getHTTPMethod()\n /*messageType*/\n {\n return \'POST\';\n }\n\n function getResponseType()\n /*keySystemStr*/\n {\n return \'json\';\n }\n\n function getLicenseMessage(serverResponse\n /*, keySystemStr, messageType*/\n ) {\n if (!serverResponse.hasOwnProperty(\'keys\')) {\n return null;\n }\n\n var keyPairs = [];\n\n for (var i = 0; i < serverResponse.keys.length; i++) {\n var keypair = serverResponse.keys[i];\n var keyid = keypair.kid.replace(/=/g, \'\');\n var key = keypair.k.replace(/=/g, \'\');\n keyPairs.push(new _vo_KeyPair__WEBPACK_IMPORTED_MODULE_0__["default"](keyid, key));\n }\n\n return new _vo_ClearKeyKeySet__WEBPACK_IMPORTED_MODULE_1__["default"](keyPairs);\n }\n\n function getErrorResponse(serverResponse\n /*, keySystemStr, messageType*/\n ) {\n return String.fromCharCode.apply(null, new Uint8Array(serverResponse));\n }\n\n instance = {\n getServerURLFromMessage: getServerURLFromMessage,\n getHTTPMethod: getHTTPMethod,\n getResponseType: getResponseType,\n getLicenseMessage: getLicenseMessage,\n getErrorResponse: getErrorResponse\n };\n return instance;\n}\n\nClearKey.__dashjs_factory_name = \'ClearKey\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(ClearKey));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/servers/DRMToday.js":\n/*!******************************************************!*\\\n !*** ./src/streaming/protection/servers/DRMToday.js ***!\n \\******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2055025__) {\n__nested_webpack_require_2055025__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2055025__(/*! ../../constants/ProtectionConstants */ "./src/streaming/constants/ProtectionConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * CastLabs DRMToday License Server implementation\n *\n * @implements LicenseServer\n * @class\n */\n\n\nfunction DRMToday(config) {\n config = config || {};\n var BASE64 = config.BASE64;\n var keySystems = {};\n keySystems[_constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_0__["default"].WIDEVINE_KEYSTEM_STRING] = {\n responseType: \'json\',\n getLicenseMessage: function getLicenseMessage(response) {\n return BASE64.decodeArray(response.license);\n },\n getErrorResponse: function getErrorResponse(response) {\n return response;\n }\n };\n keySystems[_constants_ProtectionConstants__WEBPACK_IMPORTED_MODULE_0__["default"].PLAYREADY_KEYSTEM_STRING] = {\n responseType: \'arraybuffer\',\n getLicenseMessage: function getLicenseMessage(response) {\n return response;\n },\n getErrorResponse: function getErrorResponse(response) {\n return String.fromCharCode.apply(null, new Uint8Array(response));\n }\n };\n var instance;\n\n function checkConfig() {\n if (!BASE64 || !BASE64.hasOwnProperty(\'decodeArray\')) {\n throw new Error(\'Missing config parameter(s)\');\n }\n }\n\n function getServerURLFromMessage(url\n /*, message, messageType*/\n ) {\n return url;\n }\n\n function getHTTPMethod()\n /*messageType*/\n {\n return \'POST\';\n }\n\n function getResponseType(keySystemStr\n /*, messageType*/\n ) {\n return keySystems[keySystemStr].responseType;\n }\n\n function getLicenseMessage(serverResponse, keySystemStr\n /*, messageType*/\n ) {\n checkConfig();\n return keySystems[keySystemStr].getLicenseMessage(serverResponse);\n }\n\n function getErrorResponse(serverResponse, keySystemStr\n /*, messageType*/\n ) {\n return keySystems[keySystemStr].getErrorResponse(serverResponse);\n }\n\n instance = {\n getServerURLFromMessage: getServerURLFromMessage,\n getHTTPMethod: getHTTPMethod,\n getResponseType: getResponseType,\n getLicenseMessage: getLicenseMessage,\n getErrorResponse: getErrorResponse\n };\n return instance;\n}\n\nDRMToday.__dashjs_factory_name = \'DRMToday\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(DRMToday));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/servers/PlayReady.js":\n/*!*******************************************************!*\\\n !*** ./src/streaming/protection/servers/PlayReady.js ***!\n \\*******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2059632__) {\n__nested_webpack_require_2059632__.r(__nested_webpack_exports__);\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* global escape: true */\n\n/**\n * Microsoft PlayReady Test License Server\n *\n * For testing content that uses the PlayReady test server at\n *\n * @implements LicenseServer\n * @class\n * @ignore\n */\nfunction PlayReady() {\n var instance;\n var soap = \'http://schemas.xmlsoap.org/soap/envelope/\';\n\n function uintToString(arrayBuffer) {\n var encodedString = String.fromCharCode.apply(null, new Uint8Array(arrayBuffer));\n var decodedString = decodeURIComponent(escape(encodedString));\n return decodedString;\n }\n\n function parseServerResponse(serverResponse) {\n if (window.DOMParser) {\n var stringResponse = uintToString(serverResponse);\n var parser = new window.DOMParser();\n var xmlDoc = parser.parseFromString(stringResponse, \'text/xml\');\n var envelope = xmlDoc ? xmlDoc.getElementsByTagNameNS(soap, \'Envelope\')[0] : null;\n var body = envelope ? envelope.getElementsByTagNameNS(soap, \'Body\')[0] : null;\n var fault = body ? body.getElementsByTagNameNS(soap, \'Fault\')[0] : null;\n\n if (fault) {\n return null;\n }\n }\n\n return serverResponse;\n }\n\n function parseErrorResponse(serverResponse) {\n var faultstring = \'\';\n var statusCode = \'\';\n var message = \'\';\n var idStart = -1;\n var idEnd = -1;\n\n if (window.DOMParser) {\n var stringResponse = uintToString(serverResponse);\n var parser = new window.DOMParser();\n var xmlDoc = parser.parseFromString(stringResponse, \'text/xml\');\n var envelope = xmlDoc ? xmlDoc.getElementsByTagNameNS(soap, \'Envelope\')[0] : null;\n var body = envelope ? envelope.getElementsByTagNameNS(soap, \'Body\')[0] : null;\n var fault = body ? body.getElementsByTagNameNS(soap, \'Fault\')[0] : null;\n var detail = fault ? fault.getElementsByTagName(\'detail\')[0] : null;\n var exception = detail ? detail.getElementsByTagName(\'Exception\')[0] : null;\n var node = null;\n\n if (fault === null) {\n return stringResponse;\n }\n\n node = fault.getElementsByTagName(\'faultstring\')[0].firstChild;\n faultstring = node ? node.nodeValue : null;\n\n if (exception !== null) {\n node = exception.getElementsByTagName(\'StatusCode\')[0];\n statusCode = node ? node.firstChild.nodeValue : null;\n node = exception.getElementsByTagName(\'Message\')[0];\n message = node ? node.firstChild.nodeValue : null;\n idStart = message ? message.lastIndexOf(\'[\') + 1 : -1;\n idEnd = message ? message.indexOf(\']\') : -1;\n message = message ? message.substring(idStart, idEnd) : \'\';\n }\n }\n\n var errorString = "code: ".concat(statusCode, ", name: ").concat(faultstring);\n\n if (message) {\n errorString += ", message: ".concat(message);\n }\n\n return errorString;\n }\n\n function getServerURLFromMessage(url\n /*, message, messageType*/\n ) {\n return url;\n }\n\n function getHTTPMethod()\n /*messageType*/\n {\n return \'POST\';\n }\n\n function getResponseType()\n /*keySystemStr, messageType*/\n {\n return \'arraybuffer\';\n }\n\n function getLicenseMessage(serverResponse\n /*, keySystemStr, messageType*/\n ) {\n return parseServerResponse.call(this, serverResponse);\n }\n\n function getErrorResponse(serverResponse\n /*, keySystemStr, messageType*/\n ) {\n return parseErrorResponse.call(this, serverResponse);\n }\n\n instance = {\n getServerURLFromMessage: getServerURLFromMessage,\n getHTTPMethod: getHTTPMethod,\n getResponseType: getResponseType,\n getLicenseMessage: getLicenseMessage,\n getErrorResponse: getErrorResponse\n };\n return instance;\n}\n\nPlayReady.__dashjs_factory_name = \'PlayReady\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(PlayReady));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/servers/Widevine.js":\n/*!******************************************************!*\\\n !*** ./src/streaming/protection/servers/Widevine.js ***!\n \\******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2065615__) {\n__nested_webpack_require_2065615__.r(__nested_webpack_exports__);\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @ignore\n */\nfunction Widevine() {\n var instance;\n\n function getServerURLFromMessage(url\n /*, message, messageType*/\n ) {\n return url;\n }\n\n function getHTTPMethod()\n /*messageType*/\n {\n return \'POST\';\n }\n\n function getResponseType()\n /*keySystemStr, messageType*/\n {\n return \'arraybuffer\';\n }\n\n function getLicenseMessage(serverResponse\n /*, keySystemStr, messageType*/\n ) {\n return serverResponse;\n }\n\n function getErrorResponse(serverResponse\n /*, keySystemStr, messageType*/\n ) {\n return String.fromCharCode.apply(null, new Uint8Array(serverResponse));\n }\n\n instance = {\n getServerURLFromMessage: getServerURLFromMessage,\n getHTTPMethod: getHTTPMethod,\n getResponseType: getResponseType,\n getLicenseMessage: getLicenseMessage,\n getErrorResponse: getErrorResponse\n };\n return instance;\n}\n\nWidevine.__dashjs_factory_name = \'Widevine\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (dashjs.FactoryMaker.getSingletonFactory(Widevine));\n/* jshint ignore:line */\n\n/***/ }),\n\n/***/ "./src/streaming/protection/vo/ClearKeyKeySet.js":\n/*!*******************************************************!*\\\n !*** ./src/streaming/protection/vo/ClearKeyKeySet.js ***!\n \\*******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2068882__) {\n__nested_webpack_require_2068882__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc A collection of ClearKey encryption keys with an (optional) associated\n * type\n * @ignore\n */\nvar ClearKeyKeySet = /*#__PURE__*/function () {\n /**\n * @param {Array.<KeyPair>} keyPairs\n * @param {string} type the type of keys in this set. One of either \'persistent\'\n * or \'temporary\'. Can also be null or undefined.\n * @class\n * @ignore\n */\n function ClearKeyKeySet(keyPairs, type) {\n _classCallCheck(this, ClearKeyKeySet);\n\n if (type && type !== \'persistent\' && type !== \'temporary\') throw new Error(\'Invalid ClearKey key set type! Must be one of \\\'persistent\\\' or \\\'temporary\\\'\');\n this.keyPairs = keyPairs;\n this.type = type;\n }\n /**\n * Convert this key set to its JSON Web Key (JWK) representation\n *\n * @return {ArrayBuffer} JWK object UTF-8 encoded as ArrayBuffer\n */\n\n\n _createClass(ClearKeyKeySet, [{\n key: "toJWK",\n value: function toJWK() {\n var i;\n var numKeys = this.keyPairs.length;\n var jwk = {\n keys: []\n };\n\n for (i = 0; i < numKeys; i++) {\n var key = {\n kty: \'oct\',\n alg: \'A128KW\',\n kid: this.keyPairs[i].keyID,\n k: this.keyPairs[i].key\n };\n jwk.keys.push(key);\n }\n\n if (this.type) {\n jwk.type = this.type;\n }\n\n var jwkString = JSON.stringify(jwk);\n var len = jwkString.length; // Convert JSON string to ArrayBuffer\n\n var buf = new ArrayBuffer(len);\n var bView = new Uint8Array(buf);\n\n for (i = 0; i < len; i++) {\n bView[i] = jwkString.charCodeAt(i);\n }\n\n return buf;\n }\n }]);\n\n return ClearKeyKeySet;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (ClearKeyKeySet);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/vo/KeyMessage.js":\n/*!***************************************************!*\\\n !*** ./src/streaming/protection/vo/KeyMessage.js ***!\n \\***************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2073515__) {\n__nested_webpack_require_2073515__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc EME-independent KeyMessage\n * @ignore\n */\nvar KeyMessage =\n/**\n * @param {SessionToken} sessionToken the session\n * to which the key message is associated\n * @param {ArrayBuffer} message the key message\n * @param {string} defaultURL license acquisition URL provided by the CDM\n * @param {string} messageType Supported message types can be found\n * {@link https://w3c.github.io/encrypted-media/#idl-def-MediaKeyMessageType|here}.\n * @class\n */\nfunction KeyMessage(sessionToken, message, defaultURL, messageType) {\n _classCallCheck(this, KeyMessage);\n\n this.sessionToken = sessionToken;\n this.message = message;\n this.defaultURL = defaultURL;\n this.messageType = messageType ? messageType : \'license-request\';\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (KeyMessage);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/vo/KeyPair.js":\n/*!************************************************!*\\\n !*** ./src/streaming/protection/vo/KeyPair.js ***!\n \\************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2076684__) {\n__nested_webpack_require_2076684__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc Represents a 128-bit keyID and 128-bit encryption key\n * @ignore\n */\nvar KeyPair =\n/**\n * @param {string} keyID 128-bit key ID, base64 encoded, with no padding\n * @param {string} key 128-bit encryption key, base64 encoded, with no padding\n * @class\n * @ignore\n */\nfunction KeyPair(keyID, key) {\n _classCallCheck(this, KeyPair);\n\n this.keyID = keyID;\n this.key = key;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (KeyPair);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/vo/KeySystemAccess.js":\n/*!********************************************************!*\\\n !*** ./src/streaming/protection/vo/KeySystemAccess.js ***!\n \\********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2079539__) {\n__nested_webpack_require_2079539__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc Creates a new key system access token. Represents a valid key system for\n * given piece of content and key system requirements. Used to initialize license\n * acquisition operations.\n * @ignore\n */\nvar KeySystemAccess =\n/**\n * @param {MediaPlayer.dependencies.protection.KeySystem} keySystem the key system\n * @param {KeySystemConfiguration} ksConfiguration the\n * subset of configurations passed to the key system access request that are supported\n * by this user agent\n * @class\n * @ignore\n */\nfunction KeySystemAccess(keySystem, ksConfiguration) {\n _classCallCheck(this, KeySystemAccess);\n\n this.keySystem = keySystem;\n this.ksConfiguration = ksConfiguration;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (KeySystemAccess);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/vo/KeySystemConfiguration.js":\n/*!***************************************************************!*\\\n !*** ./src/streaming/protection/vo/KeySystemConfiguration.js ***!\n \\***************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2082727__) {\n__nested_webpack_require_2082727__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc Represents a set of configurations that describe the capabilities desired for\n * support by a given CDM\n * @ignore\n */\nvar KeySystemConfiguration =\n/**\n * @param {Array.<MediaCapability>} audioCapabilities array of\n * desired audio capabilities. Higher preference capabilities should be placed earlier\n * in the array.\n * @param {Array.<MediaCapability>} videoCapabilities array of\n * desired video capabilities. Higher preference capabilities should be placed earlier\n * in the array.\n * @param {string} distinctiveIdentifier desired use of distinctive identifiers.\n * One of "required", "optional", or "not-allowed"\n * @param {string} persistentState desired support for persistent storage of\n * key systems. One of "required", "optional", or "not-allowed"\n * @param {Array.<string>} sessionTypes List of session types that must\n * be supported by the key system\n * @class\n */\nfunction KeySystemConfiguration(audioCapabilities, videoCapabilities, distinctiveIdentifier, persistentState, sessionTypes) {\n _classCallCheck(this, KeySystemConfiguration);\n\n this.initDataTypes = [\'cenc\'];\n\n if (audioCapabilities && audioCapabilities.length) {\n this.audioCapabilities = audioCapabilities;\n }\n\n if (videoCapabilities && videoCapabilities.length) {\n this.videoCapabilities = videoCapabilities;\n }\n\n this.distinctiveIdentifier = distinctiveIdentifier;\n this.persistentState = persistentState;\n this.sessionTypes = sessionTypes;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (KeySystemConfiguration);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/vo/LicenseRequest.js":\n/*!*******************************************************!*\\\n !*** ./src/streaming/protection/vo/LicenseRequest.js ***!\n \\*******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2086664__) {\n__nested_webpack_require_2086664__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc Defines a license request\n * @ignore\n */\nvar LicenseRequest =\n/**\n * Defines a license request\n *\n * @class\n */\nfunction LicenseRequest(url, method, responseType, headers, withCredentials, messageType, sessionId, data) {\n _classCallCheck(this, LicenseRequest);\n\n /**\n * The license request url\n */\n this.url = url;\n /**\n * The HTTP method\n */\n\n this.method = method;\n /**\n * The HTTP response type\n */\n\n this.responseType = responseType;\n /**\n * The HTP request headers\n */\n\n this.headers = headers;\n /**\n * Wether request is done using credentials (cross-site cookies)\n */\n\n this.withCredentials = withCredentials;\n /**\n * The license request message type (see https://www.w3.org/TR/encrypted-media/#dom-mediakeymessagetype)\n */\n\n this.messageType = messageType;\n /**\n * The corresponding EME session ID\n */\n\n this.sessionId = sessionId;\n /**\n * The license request data\n */\n\n this.data = data;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (LicenseRequest);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/vo/LicenseResponse.js":\n/*!********************************************************!*\\\n !*** ./src/streaming/protection/vo/LicenseResponse.js ***!\n \\********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2090101__) {\n__nested_webpack_require_2090101__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc Defines a license response\n */\nvar LicenseResponse =\n/**\n * Defines a license request\n *\n * @class\n * @ignore\n */\nfunction LicenseResponse(url, headers, data) {\n _classCallCheck(this, LicenseResponse);\n\n /**\n * The url that was loaded, that can be redirected from original request url\n */\n this.url = url;\n /**\n * The HTP response headers\n */\n\n this.headers = headers;\n /**\n * The license response data\n */\n\n this.data = data;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (LicenseResponse);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/vo/MediaCapability.js":\n/*!********************************************************!*\\\n !*** ./src/streaming/protection/vo/MediaCapability.js ***!\n \\********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2093040__) {\n__nested_webpack_require_2093040__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc A media capability\n * @ignore\n */\nvar MediaCapability =\n/**\n * @param {string} contentType MIME type and codecs (RFC6386)\n * @param {string} robustness\n * @class\n * @ignore\n */\nfunction MediaCapability(contentType, robustness) {\n _classCallCheck(this, MediaCapability);\n\n this.contentType = contentType;\n this.robustness = robustness;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (MediaCapability);\n\n/***/ }),\n\n/***/ "./src/streaming/protection/vo/NeedKey.js":\n/*!************************************************!*\\\n !*** ./src/streaming/protection/vo/NeedKey.js ***!\n \\************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2095839__) {\n__nested_webpack_require_2095839__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc NeedKey\n * @ignore\n */\nvar NeedKey =\n/**\n * @param {ArrayBuffer} initData the initialization data\n * @param {string} initDataType initialization data type\n * @class\n */\nfunction NeedKey(initData, initDataType) {\n _classCallCheck(this, NeedKey);\n\n this.initData = initData;\n this.initDataType = initDataType;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (NeedKey);\n\n/***/ }),\n\n/***/ "./src/streaming/rules/DroppedFramesHistory.js":\n/*!*****************************************************!*\\\n !*** ./src/streaming/rules/DroppedFramesHistory.js ***!\n \\*****************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2098623__) {\n__nested_webpack_require_2098623__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2098623__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n\n\nfunction DroppedFramesHistory() {\n var values = {};\n var lastDroppedFrames = {};\n var lastTotalFrames = {};\n\n function push(streamId, index, playbackQuality) {\n if (!index) {\n return;\n }\n\n if (!values[streamId]) {\n values[streamId] = [];\n lastDroppedFrames[streamId] = 0;\n lastTotalFrames[streamId] = 0;\n }\n\n var droppedVideoFrames = playbackQuality && playbackQuality.droppedVideoFrames ? playbackQuality.droppedVideoFrames : 0;\n var totalVideoFrames = playbackQuality && playbackQuality.totalVideoFrames ? playbackQuality.totalVideoFrames : 0;\n var intervalDroppedFrames = droppedVideoFrames - lastDroppedFrames;\n lastDroppedFrames[streamId] = droppedVideoFrames;\n var intervalTotalFrames = totalVideoFrames - lastTotalFrames;\n lastTotalFrames[streamId] = totalVideoFrames;\n var current = values[streamId];\n\n if (!isNaN(index)) {\n if (!current[index]) {\n current[index] = {\n droppedVideoFrames: intervalDroppedFrames,\n totalVideoFrames: intervalTotalFrames\n };\n } else {\n current[index].droppedVideoFrames += intervalDroppedFrames;\n current[index].totalVideoFrames += intervalTotalFrames;\n }\n }\n }\n\n function getFrameHistory(streamId) {\n return values[streamId];\n }\n\n function clearForStream(streamId) {\n try {\n delete values[streamId];\n delete lastDroppedFrames[streamId];\n delete lastTotalFrames[streamId];\n } catch (e) {}\n }\n\n function reset() {\n values = {};\n lastDroppedFrames = {};\n lastTotalFrames = {};\n }\n\n return {\n push: push,\n getFrameHistory: getFrameHistory,\n clearForStream: clearForStream,\n reset: reset\n };\n}\n\nDroppedFramesHistory.__dashjs_factory_name = \'DroppedFramesHistory\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(DroppedFramesHistory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/rules/RulesContext.js":\n/*!*********************************************!*\\\n !*** ./src/streaming/rules/RulesContext.js ***!\n \\*********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2101099__) {\n__nested_webpack_require_2101099__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2101099__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction RulesContext(config) {\n config = config || {};\n var instance;\n var abrController = config.abrController;\n var switchHistory = config.switchHistory;\n var droppedFramesHistory = config.droppedFramesHistory;\n var currentRequest = config.currentRequest;\n var bufferOccupancyABR = config.useBufferOccupancyABR;\n var l2AABR = config.useL2AABR;\n var loLP = config.useLoLPABR;\n var scheduleController = config.streamProcessor ? config.streamProcessor.getScheduleController() : null;\n var representationInfo = config.streamProcessor ? config.streamProcessor.getRepresentationInfo() : null;\n var videoModel = config.videoModel ? config.videoModel : null;\n\n function getMediaType() {\n var mediaInfo = getMediaInfo();\n return mediaInfo ? mediaInfo.type : null;\n }\n\n function getStreamInfo() {\n var mediaInfo = getMediaInfo();\n return mediaInfo ? mediaInfo.streamInfo : null;\n }\n\n function getMediaInfo() {\n return representationInfo ? representationInfo.mediaInfo : null;\n }\n\n function getRepresentationInfo() {\n return representationInfo;\n }\n\n function getScheduleController() {\n return scheduleController;\n }\n\n function getAbrController() {\n return abrController;\n }\n\n function getSwitchHistory() {\n return switchHistory;\n }\n\n function getVideoModel() {\n return videoModel;\n }\n\n function getDroppedFramesHistory() {\n return droppedFramesHistory;\n }\n\n function getCurrentRequest() {\n return currentRequest;\n }\n\n function useBufferOccupancyABR() {\n return bufferOccupancyABR;\n }\n\n function useL2AABR() {\n return l2AABR;\n }\n\n function useLoLPABR() {\n return loLP;\n }\n\n instance = {\n getMediaType: getMediaType,\n getMediaInfo: getMediaInfo,\n getDroppedFramesHistory: getDroppedFramesHistory,\n getCurrentRequest: getCurrentRequest,\n getSwitchHistory: getSwitchHistory,\n getStreamInfo: getStreamInfo,\n getScheduleController: getScheduleController,\n getAbrController: getAbrController,\n getRepresentationInfo: getRepresentationInfo,\n useBufferOccupancyABR: useBufferOccupancyABR,\n useL2AABR: useL2AABR,\n useLoLPABR: useLoLPABR,\n getVideoModel: getVideoModel\n };\n return instance;\n}\n\nRulesContext.__dashjs_factory_name = \'RulesContext\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(RulesContext));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/SwitchRequest.js":\n/*!**********************************************!*\\\n !*** ./src/streaming/rules/SwitchRequest.js ***!\n \\**********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2105859__) {\n__nested_webpack_require_2105859__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2105859__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nvar NO_CHANGE = -1;\nvar PRIORITY = {\n DEFAULT: 0.5,\n STRONG: 1,\n WEAK: 0\n};\n\nfunction SwitchRequest(q, r, p) {\n //TODO refactor all the calls to this to use config to be like everything else.\n var instance, quality, priority, reason; // check priority value\n\n function getPriority(p) {\n var ret = PRIORITY.DEFAULT; // check that p is one of declared priority value\n\n if (p === PRIORITY.DEFAULT || p === PRIORITY.STRONG || p === PRIORITY.WEAK) {\n ret = p;\n }\n\n return ret;\n } // init attributes\n\n\n quality = q === undefined ? NO_CHANGE : q;\n priority = getPriority(p);\n reason = r === undefined ? null : r;\n instance = {\n quality: quality,\n reason: reason,\n priority: priority\n };\n return instance;\n}\n\nSwitchRequest.__dashjs_factory_name = \'SwitchRequest\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(SwitchRequest);\nfactory.NO_CHANGE = NO_CHANGE;\nfactory.PRIORITY = PRIORITY;\n_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].updateClassFactory(SwitchRequest.__dashjs_factory_name, factory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/rules/SwitchRequestHistory.js":\n/*!*****************************************************!*\\\n !*** ./src/streaming/rules/SwitchRequestHistory.js ***!\n \\*****************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2109397__) {\n__nested_webpack_require_2109397__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2109397__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _SwitchRequest__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2109397__(/*! ./SwitchRequest */ "./src/streaming/rules/SwitchRequest.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nvar SWITCH_REQUEST_HISTORY_DEPTH = 8; // must be > SwitchHistoryRule SAMPLE_SIZE to enable rule\n\nfunction SwitchRequestHistory() {\n var switchRequests = []; // running total\n\n var srHistory = []; // history of each switch\n\n function push(switchRequest) {\n if (switchRequest.newValue === _SwitchRequest__WEBPACK_IMPORTED_MODULE_1__["default"].NO_CHANGE) {\n switchRequest.newValue = switchRequest.oldValue;\n }\n\n if (!switchRequests[switchRequest.oldValue]) {\n switchRequests[switchRequest.oldValue] = {\n noDrops: 0,\n drops: 0,\n dropSize: 0\n };\n } // Set switch details\n\n\n var indexDiff = switchRequest.newValue - switchRequest.oldValue;\n var drop = indexDiff < 0 ? 1 : 0;\n var dropSize = drop ? -indexDiff : 0;\n var noDrop = drop ? 0 : 1; // Update running totals\n\n switchRequests[switchRequest.oldValue].drops += drop;\n switchRequests[switchRequest.oldValue].dropSize += dropSize;\n switchRequests[switchRequest.oldValue].noDrops += noDrop; // Save to history\n\n srHistory.push({\n idx: switchRequest.oldValue,\n noDrop: noDrop,\n drop: drop,\n dropSize: dropSize\n }); // Shift earliest switch off srHistory and readjust to keep depth of running totals constant\n\n if (srHistory.length > SWITCH_REQUEST_HISTORY_DEPTH) {\n var srHistoryFirst = srHistory.shift();\n switchRequests[srHistoryFirst.idx].drops -= srHistoryFirst.drop;\n switchRequests[srHistoryFirst.idx].dropSize -= srHistoryFirst.dropSize;\n switchRequests[srHistoryFirst.idx].noDrops -= srHistoryFirst.noDrop;\n }\n }\n\n function getSwitchRequests() {\n return switchRequests;\n }\n\n function reset() {\n switchRequests = [];\n srHistory = [];\n }\n\n return {\n push: push,\n getSwitchRequests: getSwitchRequests,\n reset: reset\n };\n}\n\nSwitchRequestHistory.__dashjs_factory_name = \'SwitchRequestHistory\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(SwitchRequestHistory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/rules/ThroughputHistory.js":\n/*!**************************************************!*\\\n !*** ./src/streaming/rules/ThroughputHistory.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2114001__) {\n__nested_webpack_require_2114001__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2114001__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2114001__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2017, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n // throughput generally stored in kbit/s\n// latency generally stored in ms\n\nfunction ThroughputHistory(config) {\n config = config || {}; // sliding window constants\n\n var MAX_MEASUREMENTS_TO_KEEP = 20;\n var AVERAGE_THROUGHPUT_SAMPLE_AMOUNT_LIVE = 3;\n var AVERAGE_THROUGHPUT_SAMPLE_AMOUNT_VOD = 4;\n var AVERAGE_LATENCY_SAMPLE_AMOUNT = 4;\n var THROUGHPUT_DECREASE_SCALE = 1.3;\n var THROUGHPUT_INCREASE_SCALE = 1.3; // EWMA constants\n\n var EWMA_THROUGHPUT_SLOW_HALF_LIFE_SECONDS = 8;\n var EWMA_THROUGHPUT_FAST_HALF_LIFE_SECONDS = 3;\n var EWMA_LATENCY_SLOW_HALF_LIFE_COUNT = 2;\n var EWMA_LATENCY_FAST_HALF_LIFE_COUNT = 1;\n var settings = config.settings;\n var throughputDict, latencyDict, ewmaThroughputDict, ewmaLatencyDict, ewmaHalfLife;\n\n function setup() {\n ewmaHalfLife = {\n throughputHalfLife: {\n fast: EWMA_THROUGHPUT_FAST_HALF_LIFE_SECONDS,\n slow: EWMA_THROUGHPUT_SLOW_HALF_LIFE_SECONDS\n },\n latencyHalfLife: {\n fast: EWMA_LATENCY_FAST_HALF_LIFE_COUNT,\n slow: EWMA_LATENCY_SLOW_HALF_LIFE_COUNT\n }\n };\n reset();\n }\n\n function isCachedResponse(mediaType, latencyMs, downloadTimeMs) {\n if (mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO) {\n return downloadTimeMs < settings.get().streaming.cacheLoadThresholds[_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO];\n } else if (mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO) {\n return downloadTimeMs < settings.get().streaming.cacheLoadThresholds[_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO];\n }\n }\n\n function push(mediaType, httpRequest, useDeadTimeLatency) {\n if (!httpRequest.trace || !httpRequest.trace.length) {\n return;\n }\n\n var latencyTimeInMilliseconds = httpRequest.tresponse.getTime() - httpRequest.trequest.getTime() || 1;\n var downloadTimeInMilliseconds = httpRequest._tfinish.getTime() - httpRequest.tresponse.getTime() || 1; //Make sure never 0 we divide by this value. Avoid infinity!\n\n var downloadBytes = httpRequest.trace.reduce(function (a, b) {\n return a + b.b[0];\n }, 0);\n var throughputMeasureTime = 0,\n throughput = 0;\n\n if (settings.get().streaming.lowLatencyEnabled) {\n var calculationMode = settings.get().streaming.abr.fetchThroughputCalculationMode;\n\n if (calculationMode === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING) {\n var sumOfThroughputValues = httpRequest.trace.reduce(function (a, b) {\n return a + b.t;\n }, 0);\n throughput = Math.round(sumOfThroughputValues / httpRequest.trace.length);\n }\n\n if (throughput === 0) {\n throughputMeasureTime = httpRequest.trace.reduce(function (a, b) {\n return a + b.d;\n }, 0);\n }\n } else {\n throughputMeasureTime = useDeadTimeLatency ? downloadTimeInMilliseconds : latencyTimeInMilliseconds + downloadTimeInMilliseconds;\n }\n\n if (throughputMeasureTime !== 0) {\n throughput = Math.round(8 * downloadBytes / throughputMeasureTime); // bits/ms = kbits/s\n }\n\n checkSettingsForMediaType(mediaType);\n\n if (isCachedResponse(mediaType, latencyTimeInMilliseconds, downloadTimeInMilliseconds)) {\n if (throughputDict[mediaType].length > 0 && !throughputDict[mediaType].hasCachedEntries) {\n // already have some entries which are not cached entries\n // prevent cached fragment loads from skewing the average values\n return;\n } else {\n // have no entries || have cached entries\n // no uncached entries yet, rely on cached entries because ABR rules need something to go by\n throughputDict[mediaType].hasCachedEntries = true;\n }\n } else if (throughputDict[mediaType] && throughputDict[mediaType].hasCachedEntries) {\n // if we are here then we have some entries already, but they are cached, and now we have a new uncached entry\n clearSettingsForMediaType(mediaType);\n }\n\n throughputDict[mediaType].push(throughput);\n\n if (throughputDict[mediaType].length > MAX_MEASUREMENTS_TO_KEEP) {\n throughputDict[mediaType].shift();\n }\n\n latencyDict[mediaType].push(latencyTimeInMilliseconds);\n\n if (latencyDict[mediaType].length > MAX_MEASUREMENTS_TO_KEEP) {\n latencyDict[mediaType].shift();\n }\n\n updateEwmaEstimate(ewmaThroughputDict[mediaType], throughput, 0.001 * downloadTimeInMilliseconds, ewmaHalfLife.throughputHalfLife);\n updateEwmaEstimate(ewmaLatencyDict[mediaType], latencyTimeInMilliseconds, 1, ewmaHalfLife.latencyHalfLife);\n }\n\n function updateEwmaEstimate(ewmaObj, value, weight, halfLife) {\n // Note about startup:\n // Estimates start at 0, so early values are underestimated.\n // This effect is countered in getAverageEwma() by dividing the estimates by:\n // 1 - Math.pow(0.5, ewmaObj.totalWeight / halfLife)\n var fastAlpha = Math.pow(0.5, weight / halfLife.fast);\n ewmaObj.fastEstimate = (1 - fastAlpha) * value + fastAlpha * ewmaObj.fastEstimate;\n var slowAlpha = Math.pow(0.5, weight / halfLife.slow);\n ewmaObj.slowEstimate = (1 - slowAlpha) * value + slowAlpha * ewmaObj.slowEstimate;\n ewmaObj.totalWeight += weight;\n }\n\n function getSampleSize(isThroughput, mediaType, isDynamic) {\n var arr, sampleSize;\n\n if (isThroughput) {\n arr = throughputDict[mediaType];\n sampleSize = isDynamic ? AVERAGE_THROUGHPUT_SAMPLE_AMOUNT_LIVE : AVERAGE_THROUGHPUT_SAMPLE_AMOUNT_VOD;\n } else {\n arr = latencyDict[mediaType];\n sampleSize = AVERAGE_LATENCY_SAMPLE_AMOUNT;\n }\n\n if (!arr) {\n sampleSize = 0;\n } else if (sampleSize >= arr.length) {\n sampleSize = arr.length;\n } else if (isThroughput) {\n // if throughput samples vary a lot, average over a wider sample\n for (var i = 1; i < sampleSize; ++i) {\n var ratio = arr[arr.length - i] / arr[arr.length - i - 1];\n\n if (ratio >= THROUGHPUT_INCREASE_SCALE || ratio <= 1 / THROUGHPUT_DECREASE_SCALE) {\n sampleSize += 1;\n\n if (sampleSize === arr.length) {\n // cannot increase sampleSize beyond arr.length\n break;\n }\n }\n }\n }\n\n return sampleSize;\n }\n\n function getAverage(isThroughput, mediaType, isDynamic) {\n // only two moving average methods defined at the moment\n return settings.get().streaming.abr.movingAverageMethod !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].MOVING_AVERAGE_SLIDING_WINDOW ? getAverageEwma(isThroughput, mediaType) : getAverageSlidingWindow(isThroughput, mediaType, isDynamic);\n }\n\n function getAverageSlidingWindow(isThroughput, mediaType, isDynamic) {\n var sampleSize = getSampleSize(isThroughput, mediaType, isDynamic);\n var dict = isThroughput ? throughputDict : latencyDict;\n var arr = dict[mediaType];\n\n if (sampleSize === 0 || !arr || arr.length === 0) {\n return NaN;\n }\n\n arr = arr.slice(-sampleSize); // still works if sampleSize too large\n // arr.length >= 1\n\n return arr.reduce(function (total, elem) {\n return total + elem;\n }) / arr.length;\n }\n\n function getAverageEwma(isThroughput, mediaType) {\n var halfLife = isThroughput ? ewmaHalfLife.throughputHalfLife : ewmaHalfLife.latencyHalfLife;\n var ewmaObj = isThroughput ? ewmaThroughputDict[mediaType] : ewmaLatencyDict[mediaType];\n\n if (!ewmaObj || ewmaObj.totalWeight <= 0) {\n return NaN;\n } // to correct for startup, divide by zero factor = 1 - Math.pow(0.5, ewmaObj.totalWeight / halfLife)\n\n\n var fastEstimate = ewmaObj.fastEstimate / (1 - Math.pow(0.5, ewmaObj.totalWeight / halfLife.fast));\n var slowEstimate = ewmaObj.slowEstimate / (1 - Math.pow(0.5, ewmaObj.totalWeight / halfLife.slow));\n return isThroughput ? Math.min(fastEstimate, slowEstimate) : Math.max(fastEstimate, slowEstimate);\n }\n\n function getAverageThroughput(mediaType, isDynamic) {\n return getAverage(true, mediaType, isDynamic);\n }\n\n function getSafeAverageThroughput(mediaType, isDynamic) {\n var average = getAverageThroughput(mediaType, isDynamic);\n\n if (!isNaN(average)) {\n average *= settings.get().streaming.abr.bandwidthSafetyFactor;\n }\n\n return average;\n }\n\n function getAverageLatency(mediaType) {\n return getAverage(false, mediaType);\n }\n\n function checkSettingsForMediaType(mediaType) {\n throughputDict[mediaType] = throughputDict[mediaType] || [];\n latencyDict[mediaType] = latencyDict[mediaType] || [];\n ewmaThroughputDict[mediaType] = ewmaThroughputDict[mediaType] || {\n fastEstimate: 0,\n slowEstimate: 0,\n totalWeight: 0\n };\n ewmaLatencyDict[mediaType] = ewmaLatencyDict[mediaType] || {\n fastEstimate: 0,\n slowEstimate: 0,\n totalWeight: 0\n };\n }\n\n function clearSettingsForMediaType(mediaType) {\n delete throughputDict[mediaType];\n delete latencyDict[mediaType];\n delete ewmaThroughputDict[mediaType];\n delete ewmaLatencyDict[mediaType];\n checkSettingsForMediaType(mediaType);\n }\n\n function reset() {\n throughputDict = {};\n latencyDict = {};\n ewmaThroughputDict = {};\n ewmaLatencyDict = {};\n }\n\n var instance = {\n push: push,\n getAverageThroughput: getAverageThroughput,\n getSafeAverageThroughput: getSafeAverageThroughput,\n getAverageLatency: getAverageLatency,\n reset: reset\n };\n setup();\n return instance;\n}\n\nThroughputHistory.__dashjs_factory_name = \'ThroughputHistory\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"].getClassFactory(ThroughputHistory));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/ABRRulesCollection.js":\n/*!*******************************************************!*\\\n !*** ./src/streaming/rules/abr/ABRRulesCollection.js ***!\n \\*******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2126235__) {\n__nested_webpack_require_2126235__.r(__nested_webpack_exports__);\n/* harmony import */ var _ThroughputRule__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2126235__(/*! ./ThroughputRule */ "./src/streaming/rules/abr/ThroughputRule.js");\n/* harmony import */ var _InsufficientBufferRule__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2126235__(/*! ./InsufficientBufferRule */ "./src/streaming/rules/abr/InsufficientBufferRule.js");\n/* harmony import */ var _AbandonRequestsRule__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2126235__(/*! ./AbandonRequestsRule */ "./src/streaming/rules/abr/AbandonRequestsRule.js");\n/* harmony import */ var _DroppedFramesRule__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2126235__(/*! ./DroppedFramesRule */ "./src/streaming/rules/abr/DroppedFramesRule.js");\n/* harmony import */ var _SwitchHistoryRule__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2126235__(/*! ./SwitchHistoryRule */ "./src/streaming/rules/abr/SwitchHistoryRule.js");\n/* harmony import */ var _BolaRule__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2126235__(/*! ./BolaRule */ "./src/streaming/rules/abr/BolaRule.js");\n/* harmony import */ var _L2ARule_js__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2126235__(/*! ./L2ARule.js */ "./src/streaming/rules/abr/L2ARule.js");\n/* harmony import */ var _lolp_LoLpRule_js__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_2126235__(/*! ./lolp/LoLpRule.js */ "./src/streaming/rules/abr/lolp/LoLpRule.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_2126235__(/*! ../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _SwitchRequest__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_2126235__(/*! ../SwitchRequest */ "./src/streaming/rules/SwitchRequest.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_2126235__(/*! ../../constants/Constants */ "./src/streaming/constants/Constants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\nvar QUALITY_SWITCH_RULES = \'qualitySwitchRules\';\nvar ABANDON_FRAGMENT_RULES = \'abandonFragmentRules\';\n\nfunction ABRRulesCollection(config) {\n config = config || {};\n var context = this.context;\n var mediaPlayerModel = config.mediaPlayerModel;\n var dashMetrics = config.dashMetrics;\n var settings = config.settings;\n var instance, qualitySwitchRules, abandonFragmentRules;\n\n function initialize() {\n qualitySwitchRules = [];\n abandonFragmentRules = [];\n\n if (settings.get().streaming.abr.useDefaultABRRules) {\n // If L2A is used we only need this one rule\n if (settings.get().streaming.abr.ABRStrategy === _constants_Constants__WEBPACK_IMPORTED_MODULE_10__["default"].ABR_STRATEGY_L2A) {\n qualitySwitchRules.push(Object(_L2ARule_js__WEBPACK_IMPORTED_MODULE_6__["default"])(context).create({\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n settings: settings\n }));\n } // If LoLP is used we only need this one rule\n else if (settings.get().streaming.abr.ABRStrategy === _constants_Constants__WEBPACK_IMPORTED_MODULE_10__["default"].ABR_STRATEGY_LoLP) {\n qualitySwitchRules.push(Object(_lolp_LoLpRule_js__WEBPACK_IMPORTED_MODULE_7__["default"])(context).create({\n dashMetrics: dashMetrics\n }));\n } else {\n // Only one of BolaRule and ThroughputRule will give a switchRequest.quality !== SwitchRequest.NO_CHANGE.\n // This is controlled by useBufferOccupancyABR mechanism in AbrController.\n qualitySwitchRules.push(Object(_BolaRule__WEBPACK_IMPORTED_MODULE_5__["default"])(context).create({\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n settings: settings\n }));\n qualitySwitchRules.push(Object(_ThroughputRule__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create({\n dashMetrics: dashMetrics\n }));\n\n if (settings.get().streaming.abr.additionalAbrRules.insufficientBufferRule) {\n qualitySwitchRules.push(Object(_InsufficientBufferRule__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create({\n dashMetrics: dashMetrics,\n settings: settings\n }));\n }\n\n if (settings.get().streaming.abr.additionalAbrRules.switchHistoryRule) {\n qualitySwitchRules.push(Object(_SwitchHistoryRule__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create());\n }\n\n if (settings.get().streaming.abr.additionalAbrRules.droppedFramesRule) {\n qualitySwitchRules.push(Object(_DroppedFramesRule__WEBPACK_IMPORTED_MODULE_3__["default"])(context).create());\n }\n\n if (settings.get().streaming.abr.additionalAbrRules.abandonRequestsRule) {\n abandonFragmentRules.push(Object(_AbandonRequestsRule__WEBPACK_IMPORTED_MODULE_2__["default"])(context).create({\n dashMetrics: dashMetrics,\n mediaPlayerModel: mediaPlayerModel,\n settings: settings\n }));\n }\n }\n } // add custom ABR rules if any\n\n\n var customRules = mediaPlayerModel.getABRCustomRules();\n customRules.forEach(function (rule) {\n if (rule.type === QUALITY_SWITCH_RULES) {\n qualitySwitchRules.push(rule.rule(context).create());\n }\n\n if (rule.type === ABANDON_FRAGMENT_RULES) {\n abandonFragmentRules.push(rule.rule(context).create());\n }\n });\n }\n\n function _getRulesWithChange(srArray) {\n return srArray.filter(function (sr) {\n return sr.quality > _SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE;\n });\n }\n /**\n *\n * @param {array} srArray\n * @return {object} SwitchRequest\n */\n\n\n function getMinSwitchRequest(srArray) {\n var values = {};\n var newSwitchReq = null;\n var i, len, req, quality, reason;\n\n if (srArray.length === 0) {\n return;\n }\n\n values[_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].PRIORITY.STRONG] = {\n quality: _SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE,\n reason: null\n };\n values[_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].PRIORITY.WEAK] = {\n quality: _SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE,\n reason: null\n };\n values[_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].PRIORITY.DEFAULT] = {\n quality: _SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE,\n reason: null\n };\n\n for (i = 0, len = srArray.length; i < len; i += 1) {\n req = srArray[i];\n\n if (req.quality !== _SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE) {\n // We only use the new quality in case it is lower than the already saved one or if no new quality has been selected for the respective priority\n if (values[req.priority].quality === _SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE || values[req.priority].quality > req.quality) {\n values[req.priority].quality = req.quality;\n values[req.priority].reason = req.reason || null;\n }\n }\n }\n\n if (values[_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].PRIORITY.WEAK].quality !== _SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE) {\n newSwitchReq = values[_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].PRIORITY.WEAK];\n }\n\n if (values[_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].PRIORITY.DEFAULT].quality !== _SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE) {\n newSwitchReq = values[_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].PRIORITY.DEFAULT];\n }\n\n if (values[_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].PRIORITY.STRONG].quality !== _SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].NO_CHANGE) {\n newSwitchReq = values[_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"].PRIORITY.STRONG];\n }\n\n if (newSwitchReq) {\n quality = newSwitchReq.quality;\n reason = newSwitchReq.reason;\n }\n\n return Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"])(context).create(quality, reason);\n }\n\n function getMaxQuality(rulesContext) {\n var switchRequestArray = qualitySwitchRules.map(function (rule) {\n return rule.getMaxIndex(rulesContext);\n });\n\n var activeRules = _getRulesWithChange(switchRequestArray);\n\n var maxQuality = getMinSwitchRequest(activeRules);\n return maxQuality || Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"])(context).create();\n }\n\n function shouldAbandonFragment(rulesContext, streamId) {\n var abandonRequestArray = abandonFragmentRules.map(function (rule) {\n return rule.shouldAbandon(rulesContext, streamId);\n });\n\n var activeRules = _getRulesWithChange(abandonRequestArray);\n\n var shouldAbandon = getMinSwitchRequest(activeRules);\n return shouldAbandon || Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_9__["default"])(context).create();\n }\n\n function reset() {\n [qualitySwitchRules, abandonFragmentRules].forEach(function (rules) {\n if (rules && rules.length) {\n rules.forEach(function (rule) {\n return rule.reset && rule.reset();\n });\n }\n });\n qualitySwitchRules = [];\n abandonFragmentRules = [];\n }\n\n function getQualitySwitchRules() {\n return qualitySwitchRules;\n }\n\n instance = {\n initialize: initialize,\n reset: reset,\n getMaxQuality: getMaxQuality,\n getMinSwitchRequest: getMinSwitchRequest,\n shouldAbandonFragment: shouldAbandonFragment,\n getQualitySwitchRules: getQualitySwitchRules\n };\n return instance;\n}\n\nABRRulesCollection.__dashjs_factory_name = \'ABRRulesCollection\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_8__["default"].getClassFactory(ABRRulesCollection);\nfactory.QUALITY_SWITCH_RULES = QUALITY_SWITCH_RULES;\nfactory.ABANDON_FRAGMENT_RULES = ABANDON_FRAGMENT_RULES;\n_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_8__["default"].updateSingletonFactory(ABRRulesCollection.__dashjs_factory_name, factory);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/AbandonRequestsRule.js":\n/*!********************************************************!*\\\n !*** ./src/streaming/rules/abr/AbandonRequestsRule.js ***!\n \\********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2138453__) {\n__nested_webpack_require_2138453__.r(__nested_webpack_exports__);\n/* harmony import */ var _SwitchRequest__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2138453__(/*! ../SwitchRequest */ "./src/streaming/rules/SwitchRequest.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2138453__(/*! ../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2138453__(/*! ../../../core/Debug */ "./src/core/Debug.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\nfunction AbandonRequestsRule(config) {\n config = config || {};\n var ABANDON_MULTIPLIER = 1.8;\n var GRACE_TIME_THRESHOLD = 500;\n var MIN_LENGTH_TO_AVERAGE = 5;\n var context = this.context;\n var mediaPlayerModel = config.mediaPlayerModel;\n var dashMetrics = config.dashMetrics;\n var settings = config.settings;\n var instance, logger, fragmentDict, abandonDict, throughputArray;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance().getLogger(instance);\n reset();\n }\n\n function setFragmentRequestDict(type, id) {\n fragmentDict[type] = fragmentDict[type] || {};\n fragmentDict[type][id] = fragmentDict[type][id] || {};\n }\n\n function storeLastRequestThroughputByType(type, throughput) {\n throughputArray[type] = throughputArray[type] || [];\n throughputArray[type].push(throughput);\n }\n\n function shouldAbandon(rulesContext) {\n var switchRequest = Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_0__["default"])(context).create(_SwitchRequest__WEBPACK_IMPORTED_MODULE_0__["default"].NO_CHANGE, {\n name: AbandonRequestsRule.__dashjs_factory_name\n });\n\n if (!rulesContext || !rulesContext.hasOwnProperty(\'getMediaInfo\') || !rulesContext.hasOwnProperty(\'getMediaType\') || !rulesContext.hasOwnProperty(\'getCurrentRequest\') || !rulesContext.hasOwnProperty(\'getRepresentationInfo\') || !rulesContext.hasOwnProperty(\'getAbrController\')) {\n return switchRequest;\n }\n\n var mediaInfo = rulesContext.getMediaInfo();\n var mediaType = rulesContext.getMediaType();\n var streamInfo = rulesContext.getStreamInfo();\n var streamId = streamInfo ? streamInfo.id : null;\n var req = rulesContext.getCurrentRequest();\n\n if (!isNaN(req.index)) {\n setFragmentRequestDict(mediaType, req.index);\n var stableBufferTime = mediaPlayerModel.getStableBufferTime();\n var bufferLevel = dashMetrics.getCurrentBufferLevel(mediaType);\n\n if (bufferLevel > stableBufferTime) {\n return switchRequest;\n }\n\n var fragmentInfo = fragmentDict[mediaType][req.index];\n\n if (fragmentInfo === null || req.firstByteDate === null || abandonDict.hasOwnProperty(fragmentInfo.id)) {\n return switchRequest;\n } //setup some init info based on first progress event\n\n\n if (fragmentInfo.firstByteTime === undefined) {\n throughputArray[mediaType] = [];\n fragmentInfo.firstByteTime = req.firstByteDate.getTime();\n fragmentInfo.segmentDuration = req.duration;\n fragmentInfo.bytesTotal = req.bytesTotal;\n fragmentInfo.id = req.index;\n }\n\n fragmentInfo.bytesLoaded = req.bytesLoaded;\n fragmentInfo.elapsedTime = new Date().getTime() - fragmentInfo.firstByteTime;\n\n if (fragmentInfo.bytesLoaded > 0 && fragmentInfo.elapsedTime > 0) {\n storeLastRequestThroughputByType(mediaType, Math.round(fragmentInfo.bytesLoaded * 8 / fragmentInfo.elapsedTime));\n }\n\n if (throughputArray[mediaType].length >= MIN_LENGTH_TO_AVERAGE && fragmentInfo.elapsedTime > GRACE_TIME_THRESHOLD && fragmentInfo.bytesLoaded < fragmentInfo.bytesTotal) {\n var totalSampledValue = throughputArray[mediaType].reduce(function (a, b) {\n return a + b;\n }, 0);\n fragmentInfo.measuredBandwidthInKbps = Math.round(totalSampledValue / throughputArray[mediaType].length);\n fragmentInfo.estimatedTimeOfDownload = +(fragmentInfo.bytesTotal * 8 / fragmentInfo.measuredBandwidthInKbps / 1000).toFixed(2);\n\n if (fragmentInfo.estimatedTimeOfDownload < fragmentInfo.segmentDuration * ABANDON_MULTIPLIER || rulesContext.getRepresentationInfo().quality === 0) {\n return switchRequest;\n } else if (!abandonDict.hasOwnProperty(fragmentInfo.id)) {\n var abrController = rulesContext.getAbrController();\n var bytesRemaining = fragmentInfo.bytesTotal - fragmentInfo.bytesLoaded;\n var bitrateList = abrController.getBitrateList(mediaInfo);\n var quality = abrController.getQualityForBitrate(mediaInfo, fragmentInfo.measuredBandwidthInKbps * settings.get().streaming.abr.bandwidthSafetyFactor, streamId);\n var minQuality = abrController.getMinAllowedIndexFor(mediaType, streamId);\n var newQuality = minQuality !== undefined ? Math.max(minQuality, quality) : quality;\n var estimateOtherBytesTotal = fragmentInfo.bytesTotal * bitrateList[newQuality].bitrate / bitrateList[abrController.getQualityFor(mediaType, streamId)].bitrate;\n\n if (bytesRemaining > estimateOtherBytesTotal) {\n switchRequest.quality = newQuality;\n switchRequest.reason.throughput = fragmentInfo.measuredBandwidthInKbps;\n switchRequest.reason.fragmentID = fragmentInfo.id;\n abandonDict[fragmentInfo.id] = fragmentInfo;\n logger.debug(\'[\' + mediaType + \'] frag id\', fragmentInfo.id, \' is asking to abandon and switch to quality to \', newQuality, \' measured bandwidth was\', fragmentInfo.measuredBandwidthInKbps);\n delete fragmentDict[mediaType][fragmentInfo.id];\n }\n }\n } else if (fragmentInfo.bytesLoaded === fragmentInfo.bytesTotal) {\n delete fragmentDict[mediaType][fragmentInfo.id];\n }\n }\n\n return switchRequest;\n }\n\n function reset() {\n fragmentDict = {};\n abandonDict = {};\n throughputArray = [];\n }\n\n instance = {\n shouldAbandon: shouldAbandon,\n reset: reset\n };\n setup();\n return instance;\n}\n\nAbandonRequestsRule.__dashjs_factory_name = \'AbandonRequestsRule\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"].getClassFactory(AbandonRequestsRule));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/BolaRule.js":\n/*!*********************************************!*\\\n !*** ./src/streaming/rules/abr/BolaRule.js ***!\n \\*********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2146790__) {\n__nested_webpack_require_2146790__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2146790__(/*! ../../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _SwitchRequest__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2146790__(/*! ../SwitchRequest */ "./src/streaming/rules/SwitchRequest.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2146790__(/*! ../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2146790__(/*! ../../vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2146790__(/*! ../../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2146790__(/*! ../../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2146790__(/*! ../../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_2146790__(/*! ../../MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2016, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n// For a description of the BOLA adaptive bitrate (ABR) algorithm, see http://arxiv.org/abs/1601.06748\n\n\n\n\n\n\n\n // BOLA_STATE_ONE_BITRATE : If there is only one bitrate (or initialization failed), always return NO_CHANGE.\n// BOLA_STATE_STARTUP : Set placeholder buffer such that we download fragments at most recently measured throughput.\n// BOLA_STATE_STEADY : Buffer primed, we switch to steady operation.\n// TODO: add BOLA_STATE_SEEK and tune BOLA behavior on seeking\n\nvar BOLA_STATE_ONE_BITRATE = 0;\nvar BOLA_STATE_STARTUP = 1;\nvar BOLA_STATE_STEADY = 2;\nvar MINIMUM_BUFFER_S = 10; // BOLA should never add artificial delays if buffer is less than MINIMUM_BUFFER_S.\n\nvar MINIMUM_BUFFER_PER_BITRATE_LEVEL_S = 2; // E.g. if there are 5 bitrates, BOLA switches to top bitrate at buffer = 10 + 5 * 2 = 20s.\n// If Schedule Controller does not allow buffer to reach that level, it can be achieved through the placeholder buffer level.\n\nvar PLACEHOLDER_BUFFER_DECAY = 0.99; // Make sure placeholder buffer does not stick around too long.\n\nfunction BolaRule(config) {\n config = config || {};\n var context = this.context;\n var dashMetrics = config.dashMetrics;\n var mediaPlayerModel = config.mediaPlayerModel;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n var instance, logger, bolaStateDict;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_6__["default"])(context).getInstance().getLogger(instance);\n resetInitialSettings();\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].BUFFER_EMPTY, onBufferEmpty, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].PLAYBACK_SEEKING, onPlaybackSeeking, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].METRIC_ADDED, onMetricAdded, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].QUALITY_CHANGE_REQUESTED, onQualityChangeRequested, instance);\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].FRAGMENT_LOADING_ABANDONED, onFragmentLoadingAbandoned, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].MEDIA_FRAGMENT_LOADED, onMediaFragmentLoaded, instance);\n }\n\n function utilitiesFromBitrates(bitrates) {\n return bitrates.map(function (b) {\n return Math.log(b);\n }); // no need to worry about offset, utilities will be offset (uniformly) anyway later\n } // NOTE: in live streaming, the real buffer level can drop below minimumBufferS, but bola should not stick to lowest bitrate by using a placeholder buffer level\n\n\n function calculateBolaParameters(stableBufferTime, bitrates, utilities) {\n var highestUtilityIndex = utilities.reduce(function (highestIndex, u, uIndex) {\n return u > utilities[highestIndex] ? uIndex : highestIndex;\n }, 0);\n\n if (highestUtilityIndex === 0) {\n // if highestUtilityIndex === 0, then always use lowest bitrate\n return null;\n }\n\n var bufferTime = Math.max(stableBufferTime, MINIMUM_BUFFER_S + MINIMUM_BUFFER_PER_BITRATE_LEVEL_S * bitrates.length); // TODO: Investigate if following can be better if utilities are not the default Math.log utilities.\n // If using Math.log utilities, we can choose Vp and gp to always prefer bitrates[0] at minimumBufferS and bitrates[max] at bufferTarget.\n // (Vp * (utility + gp) - bufferLevel) / bitrate has the maxima described when:\n // Vp * (utilities[0] + gp - 1) === minimumBufferS and Vp * (utilities[max] + gp - 1) === bufferTarget\n // giving:\n\n var gp = (utilities[highestUtilityIndex] - 1) / (bufferTime / MINIMUM_BUFFER_S - 1);\n var Vp = MINIMUM_BUFFER_S / gp; // note that expressions for gp and Vp assume utilities[0] === 1, which is true because of normalization\n\n return {\n gp: gp,\n Vp: Vp\n };\n }\n\n function getInitialBolaState(rulesContext) {\n var initialState = {};\n var mediaInfo = rulesContext.getMediaInfo();\n var bitrates = mediaInfo.bitrateList.map(function (b) {\n return b.bandwidth;\n });\n var utilities = utilitiesFromBitrates(bitrates);\n utilities = utilities.map(function (u) {\n return u - utilities[0] + 1;\n }); // normalize\n\n var stableBufferTime = mediaPlayerModel.getStableBufferTime();\n var params = calculateBolaParameters(stableBufferTime, bitrates, utilities);\n\n if (!params) {\n // only happens when there is only one bitrate level\n initialState.state = BOLA_STATE_ONE_BITRATE;\n } else {\n initialState.state = BOLA_STATE_STARTUP;\n initialState.bitrates = bitrates;\n initialState.utilities = utilities;\n initialState.stableBufferTime = stableBufferTime;\n initialState.Vp = params.Vp;\n initialState.gp = params.gp;\n initialState.lastQuality = 0;\n clearBolaStateOnSeek(initialState);\n }\n\n return initialState;\n }\n\n function clearBolaStateOnSeek(bolaState) {\n bolaState.placeholderBuffer = 0;\n bolaState.mostAdvancedSegmentStart = NaN;\n bolaState.lastSegmentWasReplacement = false;\n bolaState.lastSegmentStart = NaN;\n bolaState.lastSegmentDurationS = NaN;\n bolaState.lastSegmentRequestTimeMs = NaN;\n bolaState.lastSegmentFinishTimeMs = NaN;\n } // If the buffer target is changed (can this happen mid-stream?), then adjust BOLA parameters accordingly.\n\n\n function checkBolaStateStableBufferTime(bolaState, mediaType) {\n var stableBufferTime = mediaPlayerModel.getStableBufferTime();\n\n if (bolaState.stableBufferTime !== stableBufferTime) {\n var params = calculateBolaParameters(stableBufferTime, bolaState.bitrates, bolaState.utilities);\n\n if (params.Vp !== bolaState.Vp || params.gp !== bolaState.gp) {\n // correct placeholder buffer using two criteria:\n // 1. do not change effective buffer level at effectiveBufferLevel === MINIMUM_BUFFER_S ( === Vp * gp )\n // 2. scale placeholder buffer by Vp subject to offset indicated in 1.\n var bufferLevel = dashMetrics.getCurrentBufferLevel(mediaType);\n var effectiveBufferLevel = bufferLevel + bolaState.placeholderBuffer;\n effectiveBufferLevel -= MINIMUM_BUFFER_S;\n effectiveBufferLevel *= params.Vp / bolaState.Vp;\n effectiveBufferLevel += MINIMUM_BUFFER_S;\n bolaState.stableBufferTime = stableBufferTime;\n bolaState.Vp = params.Vp;\n bolaState.gp = params.gp;\n bolaState.placeholderBuffer = Math.max(0, effectiveBufferLevel - bufferLevel);\n }\n }\n }\n\n function getBolaState(rulesContext) {\n var mediaType = rulesContext.getMediaType();\n var bolaState = bolaStateDict[mediaType];\n\n if (!bolaState) {\n bolaState = getInitialBolaState(rulesContext);\n bolaStateDict[mediaType] = bolaState;\n } else if (bolaState.state !== BOLA_STATE_ONE_BITRATE) {\n checkBolaStateStableBufferTime(bolaState, mediaType);\n }\n\n return bolaState;\n } // The core idea of BOLA.\n\n\n function getQualityFromBufferLevel(bolaState, bufferLevel) {\n var bitrateCount = bolaState.bitrates.length;\n var quality = NaN;\n var score = NaN;\n\n for (var i = 0; i < bitrateCount; ++i) {\n var s = (bolaState.Vp * (bolaState.utilities[i] + bolaState.gp) - bufferLevel) / bolaState.bitrates[i];\n\n if (isNaN(score) || s >= score) {\n score = s;\n quality = i;\n }\n }\n\n return quality;\n } // maximum buffer level which prefers to download at quality rather than wait\n\n\n function maxBufferLevelForQuality(bolaState, quality) {\n return bolaState.Vp * (bolaState.utilities[quality] + bolaState.gp);\n } // the minimum buffer level that would cause BOLA to choose quality rather than a lower bitrate\n\n\n function minBufferLevelForQuality(bolaState, quality) {\n var qBitrate = bolaState.bitrates[quality];\n var qUtility = bolaState.utilities[quality];\n var min = 0;\n\n for (var i = quality - 1; i >= 0; --i) {\n // for each bitrate less than bitrates[quality], BOLA should prefer quality (unless other bitrate has higher utility)\n if (bolaState.utilities[i] < bolaState.utilities[quality]) {\n var iBitrate = bolaState.bitrates[i];\n var iUtility = bolaState.utilities[i];\n var level = bolaState.Vp * (bolaState.gp + (qBitrate * iUtility - iBitrate * qUtility) / (qBitrate - iBitrate));\n min = Math.max(min, level); // we want min to be small but at least level(i) for all i\n }\n }\n\n return min;\n }\n /*\n * The placeholder buffer increases the effective buffer that is used to calculate the bitrate.\n * There are two main reasons we might want to increase the placeholder buffer:\n *\n * 1. When a segment finishes downloading, we would expect to get a call on getMaxIndex() regarding the quality for\n * the next segment. However, there might be a delay before the next call. E.g. when streaming live content, the\n * next segment might not be available yet. If the call to getMaxIndex() does happens after a delay, we don\'t\n * want the delay to change the BOLA decision - we only want to factor download time to decide on bitrate level.\n *\n * 2. It is possible to get a call to getMaxIndex() without having a segment download. The buffer target in dash.js\n * is different for top-quality segments and lower-quality segments. If getMaxIndex() returns a lower-than-top\n * quality, then the buffer controller might decide not to download a segment. When dash.js is ready for the next\n * segment, getMaxIndex() will be called again. We don\'t want this extra delay to factor in the bitrate decision.\n */\n\n\n function updatePlaceholderBuffer(bolaState, mediaType) {\n var nowMs = Date.now();\n\n if (!isNaN(bolaState.lastSegmentFinishTimeMs)) {\n // compensate for non-bandwidth-derived delays, e.g., live streaming availability, buffer controller\n var delay = 0.001 * (nowMs - bolaState.lastSegmentFinishTimeMs);\n bolaState.placeholderBuffer += Math.max(0, delay);\n } else if (!isNaN(bolaState.lastCallTimeMs)) {\n // no download after last call, compensate for delay between calls\n var _delay = 0.001 * (nowMs - bolaState.lastCallTimeMs);\n\n bolaState.placeholderBuffer += Math.max(0, _delay);\n }\n\n bolaState.lastCallTimeMs = nowMs;\n bolaState.lastSegmentStart = NaN;\n bolaState.lastSegmentRequestTimeMs = NaN;\n bolaState.lastSegmentFinishTimeMs = NaN;\n checkBolaStateStableBufferTime(bolaState, mediaType);\n }\n\n function onBufferEmpty() {\n // if we rebuffer, we don\'t want the placeholder buffer to artificially raise BOLA quality\n for (var mediaType in bolaStateDict) {\n if (bolaStateDict.hasOwnProperty(mediaType) && bolaStateDict[mediaType].state === BOLA_STATE_STEADY) {\n bolaStateDict[mediaType].placeholderBuffer = 0;\n }\n }\n }\n\n function onPlaybackSeeking() {\n // TODO: 1. Verify what happens if we seek mid-fragment.\n // TODO: 2. If e.g. we have 10s fragments and seek, we might want to download the first fragment at a lower quality to restart playback quickly.\n for (var mediaType in bolaStateDict) {\n if (bolaStateDict.hasOwnProperty(mediaType)) {\n var bolaState = bolaStateDict[mediaType];\n\n if (bolaState.state !== BOLA_STATE_ONE_BITRATE) {\n bolaState.state = BOLA_STATE_STARTUP; // TODO: BOLA_STATE_SEEK?\n\n clearBolaStateOnSeek(bolaState);\n }\n }\n }\n }\n\n function onMediaFragmentLoaded(e) {\n if (e && e.chunk && e.chunk.mediaInfo) {\n var bolaState = bolaStateDict[e.chunk.mediaInfo.type];\n\n if (bolaState && bolaState.state !== BOLA_STATE_ONE_BITRATE) {\n var start = e.chunk.start;\n\n if (isNaN(bolaState.mostAdvancedSegmentStart) || start > bolaState.mostAdvancedSegmentStart) {\n bolaState.mostAdvancedSegmentStart = start;\n bolaState.lastSegmentWasReplacement = false;\n } else {\n bolaState.lastSegmentWasReplacement = true;\n }\n\n bolaState.lastSegmentStart = start;\n bolaState.lastSegmentDurationS = e.chunk.duration;\n bolaState.lastQuality = e.chunk.quality;\n checkNewSegment(bolaState, e.chunk.mediaInfo.type);\n }\n }\n }\n\n function onMetricAdded(e) {\n if (e && e.metric === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_0__["default"].HTTP_REQUEST && e.value && e.value.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_3__["HTTPRequest"].MEDIA_SEGMENT_TYPE && e.value.trace && e.value.trace.length) {\n var bolaState = bolaStateDict[e.mediaType];\n\n if (bolaState && bolaState.state !== BOLA_STATE_ONE_BITRATE) {\n bolaState.lastSegmentRequestTimeMs = e.value.trequest.getTime();\n bolaState.lastSegmentFinishTimeMs = e.value._tfinish.getTime();\n checkNewSegment(bolaState, e.mediaType);\n }\n }\n }\n /*\n * When a new segment is downloaded, we get two notifications: onMediaFragmentLoaded() and onMetricAdded(). It is\n * possible that the quality for the downloaded segment was lower (not higher) than the quality indicated by BOLA.\n * This might happen because of other rules such as the DroppedFramesRule. When this happens, we trim the\n * placeholder buffer to make BOLA more stable. This mechanism also avoids inflating the buffer when BOLA itself\n * decides not to increase the quality to avoid oscillations.\n *\n * We should also check for replacement segments (fast switching). In this case, a segment is downloaded but does\n * not grow the actual buffer. Fast switching might cause the buffer to deplete, causing BOLA to drop the bitrate.\n * We avoid this by growing the placeholder buffer.\n */\n\n\n function checkNewSegment(bolaState, mediaType) {\n if (!isNaN(bolaState.lastSegmentStart) && !isNaN(bolaState.lastSegmentRequestTimeMs) && !isNaN(bolaState.placeholderBuffer)) {\n bolaState.placeholderBuffer *= PLACEHOLDER_BUFFER_DECAY; // Find what maximum buffer corresponding to last segment was, and ensure placeholder is not relatively larger.\n\n if (!isNaN(bolaState.lastSegmentFinishTimeMs)) {\n var bufferLevel = dashMetrics.getCurrentBufferLevel(mediaType);\n var bufferAtLastSegmentRequest = bufferLevel + 0.001 * (bolaState.lastSegmentFinishTimeMs - bolaState.lastSegmentRequestTimeMs); // estimate\n\n var maxEffectiveBufferForLastSegment = maxBufferLevelForQuality(bolaState, bolaState.lastQuality);\n var maxPlaceholderBuffer = Math.max(0, maxEffectiveBufferForLastSegment - bufferAtLastSegmentRequest);\n bolaState.placeholderBuffer = Math.min(maxPlaceholderBuffer, bolaState.placeholderBuffer);\n } // then see if we should grow placeholder buffer\n\n\n if (bolaState.lastSegmentWasReplacement && !isNaN(bolaState.lastSegmentDurationS)) {\n // compensate for segments that were downloaded but did not grow the buffer\n bolaState.placeholderBuffer += bolaState.lastSegmentDurationS;\n }\n\n bolaState.lastSegmentStart = NaN;\n bolaState.lastSegmentRequestTimeMs = NaN;\n }\n }\n\n function onQualityChangeRequested(e) {\n // Useful to store change requests when abandoning a download.\n if (e) {\n var bolaState = bolaStateDict[e.mediaType];\n\n if (bolaState && bolaState.state !== BOLA_STATE_ONE_BITRATE) {\n bolaState.abrQuality = e.newQuality;\n }\n }\n }\n\n function onFragmentLoadingAbandoned(e) {\n if (e) {\n var bolaState = bolaStateDict[e.mediaType];\n\n if (bolaState && bolaState.state !== BOLA_STATE_ONE_BITRATE) {\n // deflate placeholderBuffer - note that we want to be conservative when abandoning\n var bufferLevel = dashMetrics.getCurrentBufferLevel(e.mediaType);\n var wantEffectiveBufferLevel;\n\n if (bolaState.abrQuality > 0) {\n // deflate to point where BOLA just chooses newQuality over newQuality-1\n wantEffectiveBufferLevel = minBufferLevelForQuality(bolaState, bolaState.abrQuality);\n } else {\n wantEffectiveBufferLevel = MINIMUM_BUFFER_S;\n }\n\n var maxPlaceholderBuffer = Math.max(0, wantEffectiveBufferLevel - bufferLevel);\n bolaState.placeholderBuffer = Math.min(bolaState.placeholderBuffer, maxPlaceholderBuffer);\n }\n }\n }\n\n function getMaxIndex(rulesContext) {\n var switchRequest = Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create();\n\n if (!rulesContext || !rulesContext.hasOwnProperty(\'getMediaInfo\') || !rulesContext.hasOwnProperty(\'getMediaType\') || !rulesContext.hasOwnProperty(\'getScheduleController\') || !rulesContext.hasOwnProperty(\'getStreamInfo\') || !rulesContext.hasOwnProperty(\'getAbrController\') || !rulesContext.hasOwnProperty(\'useBufferOccupancyABR\')) {\n return switchRequest;\n }\n\n var mediaInfo = rulesContext.getMediaInfo();\n var mediaType = rulesContext.getMediaType();\n var scheduleController = rulesContext.getScheduleController();\n var streamInfo = rulesContext.getStreamInfo();\n var abrController = rulesContext.getAbrController();\n var throughputHistory = abrController.getThroughputHistory();\n var streamId = streamInfo ? streamInfo.id : null;\n var isDynamic = streamInfo && streamInfo.manifestInfo && streamInfo.manifestInfo.isDynamic;\n var useBufferOccupancyABR = rulesContext.useBufferOccupancyABR();\n switchRequest.reason = switchRequest.reason || {};\n\n if (!useBufferOccupancyABR) {\n return switchRequest;\n }\n\n scheduleController.setTimeToLoadDelay(0);\n var bolaState = getBolaState(rulesContext);\n\n if (bolaState.state === BOLA_STATE_ONE_BITRATE) {\n // shouldn\'t even have been called\n return switchRequest;\n }\n\n var bufferLevel = dashMetrics.getCurrentBufferLevel(mediaType);\n var throughput = throughputHistory.getAverageThroughput(mediaType, isDynamic);\n var safeThroughput = throughputHistory.getSafeAverageThroughput(mediaType, isDynamic);\n var latency = throughputHistory.getAverageLatency(mediaType);\n var quality;\n switchRequest.reason.state = bolaState.state;\n switchRequest.reason.throughput = throughput;\n switchRequest.reason.latency = latency;\n\n if (isNaN(throughput)) {\n // isNaN(throughput) === isNaN(safeThroughput) === isNaN(latency)\n // still starting up - not enough information\n return switchRequest;\n }\n\n switch (bolaState.state) {\n case BOLA_STATE_STARTUP:\n quality = abrController.getQualityForBitrate(mediaInfo, safeThroughput, streamId, latency);\n switchRequest.quality = quality;\n switchRequest.reason.throughput = safeThroughput;\n bolaState.placeholderBuffer = Math.max(0, minBufferLevelForQuality(bolaState, quality) - bufferLevel);\n bolaState.lastQuality = quality;\n\n if (!isNaN(bolaState.lastSegmentDurationS) && bufferLevel >= bolaState.lastSegmentDurationS) {\n bolaState.state = BOLA_STATE_STEADY;\n }\n\n break;\n // BOLA_STATE_STARTUP\n\n case BOLA_STATE_STEADY:\n // NB: The placeholder buffer is added to bufferLevel to come up with a bitrate.\n // This might lead BOLA to be too optimistic and to choose a bitrate that would lead to rebuffering -\n // if the real buffer bufferLevel runs out, the placeholder buffer cannot prevent rebuffering.\n // However, the InsufficientBufferRule takes care of this scenario.\n updatePlaceholderBuffer(bolaState, mediaType);\n quality = getQualityFromBufferLevel(bolaState, bufferLevel + bolaState.placeholderBuffer); // we want to avoid oscillations\n // We implement the "BOLA-O" variant: when network bandwidth lies between two encoded bitrate levels, stick to the lowest level.\n\n var qualityForThroughput = abrController.getQualityForBitrate(mediaInfo, safeThroughput, streamId, latency);\n\n if (quality > bolaState.lastQuality && quality > qualityForThroughput) {\n // only intervene if we are trying to *increase* quality to an *unsustainable* level\n // we are only avoid oscillations - do not drop below last quality\n quality = Math.max(qualityForThroughput, bolaState.lastQuality);\n } // We do not want to overfill buffer with low quality chunks.\n // Note that there will be no delay if buffer level is below MINIMUM_BUFFER_S, probably even with some margin higher than MINIMUM_BUFFER_S.\n\n\n var delayS = Math.max(0, bufferLevel + bolaState.placeholderBuffer - maxBufferLevelForQuality(bolaState, quality)); // First reduce placeholder buffer, then tell schedule controller to pause.\n\n if (delayS <= bolaState.placeholderBuffer) {\n bolaState.placeholderBuffer -= delayS;\n delayS = 0;\n } else {\n delayS -= bolaState.placeholderBuffer;\n bolaState.placeholderBuffer = 0;\n\n if (quality < abrController.getMaxAllowedIndexFor(mediaType, streamId)) {\n // At top quality, allow schedule controller to decide how far to fill buffer.\n scheduleController.setTimeToLoadDelay(1000 * delayS);\n } else {\n delayS = 0;\n }\n }\n\n switchRequest.quality = quality;\n switchRequest.reason.throughput = throughput;\n switchRequest.reason.latency = latency;\n switchRequest.reason.bufferLevel = bufferLevel;\n switchRequest.reason.placeholderBuffer = bolaState.placeholderBuffer;\n switchRequest.reason.delay = delayS;\n bolaState.lastQuality = quality; // keep bolaState.state === BOLA_STATE_STEADY\n\n break;\n // BOLA_STATE_STEADY\n\n default:\n logger.debug(\'BOLA ABR rule invoked in bad state.\'); // should not arrive here, try to recover\n\n switchRequest.quality = abrController.getQualityForBitrate(mediaInfo, safeThroughput, streamId, latency);\n switchRequest.reason.state = bolaState.state;\n switchRequest.reason.throughput = safeThroughput;\n switchRequest.reason.latency = latency;\n bolaState.state = BOLA_STATE_STARTUP;\n clearBolaStateOnSeek(bolaState);\n }\n\n return switchRequest;\n }\n\n function resetInitialSettings() {\n bolaStateDict = {};\n }\n\n function reset() {\n resetInitialSettings();\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].BUFFER_EMPTY, onBufferEmpty, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].PLAYBACK_SEEKING, onPlaybackSeeking, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].METRIC_ADDED, onMetricAdded, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].QUALITY_CHANGE_REQUESTED, onQualityChangeRequested, instance);\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].FRAGMENT_LOADING_ABANDONED, onFragmentLoadingAbandoned, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].MEDIA_FRAGMENT_LOADED, onMediaFragmentLoaded, instance);\n }\n\n instance = {\n getMaxIndex: getMaxIndex,\n reset: reset\n };\n setup();\n return instance;\n}\n\nBolaRule.__dashjs_factory_name = \'BolaRule\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getClassFactory(BolaRule));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/DroppedFramesRule.js":\n/*!******************************************************!*\\\n !*** ./src/streaming/rules/abr/DroppedFramesRule.js ***!\n \\******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2173563__) {\n__nested_webpack_require_2173563__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2173563__(/*! ../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _SwitchRequest__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2173563__(/*! ../SwitchRequest */ "./src/streaming/rules/SwitchRequest.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2173563__(/*! ../../../core/Debug */ "./src/core/Debug.js");\n\n\n\n\nfunction DroppedFramesRule() {\n var context = this.context;\n var instance, logger;\n var DROPPED_PERCENTAGE_FORBID = 0.15;\n var GOOD_SAMPLE_SIZE = 375; //Don\'t apply the rule until this many frames have been rendered(and counted under those indices).\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance().getLogger(instance);\n }\n\n function getMaxIndex(rulesContext) {\n var switchRequest = Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create();\n\n if (!rulesContext || !rulesContext.hasOwnProperty(\'getDroppedFramesHistory\')) {\n return switchRequest;\n }\n\n var droppedFramesHistory = rulesContext.getDroppedFramesHistory();\n var streamId = rulesContext.getStreamInfo().id;\n\n if (droppedFramesHistory) {\n var dfh = droppedFramesHistory.getFrameHistory(streamId);\n\n if (!dfh || dfh.length === 0) {\n return switchRequest;\n }\n\n var droppedFrames = 0;\n var totalFrames = 0;\n var maxIndex = _SwitchRequest__WEBPACK_IMPORTED_MODULE_1__["default"].NO_CHANGE; //No point in measuring dropped frames for the zeroeth index.\n\n for (var i = 1; i < dfh.length; i++) {\n if (dfh[i]) {\n droppedFrames = dfh[i].droppedVideoFrames;\n totalFrames = dfh[i].totalVideoFrames;\n\n if (totalFrames > GOOD_SAMPLE_SIZE && droppedFrames / totalFrames > DROPPED_PERCENTAGE_FORBID) {\n maxIndex = i - 1;\n logger.debug(\'index: \' + maxIndex + \' Dropped Frames: \' + droppedFrames + \' Total Frames: \' + totalFrames);\n break;\n }\n }\n }\n\n return Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create(maxIndex, {\n droppedFrames: droppedFrames\n });\n }\n\n return switchRequest;\n }\n\n instance = {\n getMaxIndex: getMaxIndex\n };\n setup();\n return instance;\n}\n\nDroppedFramesRule.__dashjs_factory_name = \'DroppedFramesRule\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(DroppedFramesRule));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/InsufficientBufferRule.js":\n/*!***********************************************************!*\\\n !*** ./src/streaming/rules/abr/InsufficientBufferRule.js ***!\n \\***********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2176573__) {\n__nested_webpack_require_2176573__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2176573__(/*! ../../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2176573__(/*! ../../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2176573__(/*! ../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2176573__(/*! ../../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _SwitchRequest__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2176573__(/*! ../SwitchRequest */ "./src/streaming/rules/SwitchRequest.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2176573__(/*! ../../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2176573__(/*! ../../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_2176573__(/*! ../../MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\nfunction InsufficientBufferRule(config) {\n config = config || {};\n var INSUFFICIENT_BUFFER_SAFETY_FACTOR = 0.5;\n var SEGMENT_IGNORE_COUNT = 2;\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n var dashMetrics = config.dashMetrics;\n var settings = config.settings;\n var instance, logger, bufferStateDict;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_3__["default"])(context).getInstance().getLogger(instance);\n resetInitialSettings();\n eventBus.on(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].PLAYBACK_SEEKING, _onPlaybackSeeking, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].BYTES_APPENDED_END_FRAGMENT, _onBytesAppended, instance);\n }\n\n function checkConfig() {\n if (!dashMetrics || !dashMetrics.hasOwnProperty(\'getCurrentBufferLevel\') || !dashMetrics.hasOwnProperty(\'getCurrentBufferState\')) {\n throw new Error(_constants_Constants__WEBPACK_IMPORTED_MODULE_5__["default"].MISSING_CONFIG_ERROR);\n }\n }\n /**\n * If a BUFFER_EMPTY event happens, then InsufficientBufferRule returns switchRequest.quality=0 until BUFFER_LOADED happens.\n * Otherwise InsufficientBufferRule gives a maximum bitrate depending on throughput and bufferLevel such that\n * a whole fragment can be downloaded before the buffer runs out, subject to a conservative safety factor of 0.5.\n * If the bufferLevel is low, then InsufficientBufferRule avoids rebuffering risk.\n * If the bufferLevel is high, then InsufficientBufferRule give a high MaxIndex allowing other rules to take over.\n * @param rulesContext\n * @return {object}\n */\n\n\n function getMaxIndex(rulesContext) {\n var switchRequest = Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create();\n\n if (!rulesContext || !rulesContext.hasOwnProperty(\'getMediaType\')) {\n return switchRequest;\n }\n\n checkConfig();\n var mediaType = rulesContext.getMediaType();\n var currentBufferState = dashMetrics.getCurrentBufferState(mediaType);\n var representationInfo = rulesContext.getRepresentationInfo();\n var fragmentDuration = representationInfo.fragmentDuration;\n var streamInfo = rulesContext.getStreamInfo();\n var streamId = streamInfo ? streamInfo.id : null;\n var isDynamic = streamInfo && streamInfo.manifestInfo && streamInfo.manifestInfo.isDynamic; // Don\'t ask for a bitrate change if there is not info about buffer state or if fragmentDuration is not defined\n\n if (shouldIgnore(mediaType) || !fragmentDuration) {\n return switchRequest;\n }\n\n if (currentBufferState && currentBufferState.state === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_6__["default"].BUFFER_EMPTY) {\n logger.debug(\'[\' + mediaType + \'] Switch to index 0; buffer is empty.\');\n switchRequest.quality = 0;\n switchRequest.reason = \'InsufficientBufferRule: Buffer is empty\';\n } else {\n var mediaInfo = rulesContext.getMediaInfo();\n var abrController = rulesContext.getAbrController();\n var throughputHistory = abrController.getThroughputHistory();\n var bufferLevel = dashMetrics.getCurrentBufferLevel(mediaType);\n var throughput = throughputHistory.getAverageThroughput(mediaType, isDynamic);\n var latency = throughputHistory.getAverageLatency(mediaType);\n var bitrate = throughput * (bufferLevel / fragmentDuration) * INSUFFICIENT_BUFFER_SAFETY_FACTOR;\n switchRequest.quality = abrController.getQualityForBitrate(mediaInfo, bitrate, streamId, latency);\n switchRequest.reason = \'InsufficientBufferRule: being conservative to avoid immediate rebuffering\';\n }\n\n return switchRequest;\n }\n\n function shouldIgnore(mediaType) {\n return !settings.get().streaming.lowLatencyEnabled && bufferStateDict[mediaType].ignoreCount > 0;\n }\n\n function resetInitialSettings() {\n bufferStateDict = {};\n bufferStateDict[_constants_Constants__WEBPACK_IMPORTED_MODULE_5__["default"].VIDEO] = {\n ignoreCount: SEGMENT_IGNORE_COUNT\n };\n bufferStateDict[_constants_Constants__WEBPACK_IMPORTED_MODULE_5__["default"].AUDIO] = {\n ignoreCount: SEGMENT_IGNORE_COUNT\n };\n }\n\n function _onPlaybackSeeking() {\n resetInitialSettings();\n }\n\n function _onBytesAppended(e) {\n if (!isNaN(e.startTime) && (e.mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_5__["default"].AUDIO || e.mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_5__["default"].VIDEO)) {\n if (bufferStateDict[e.mediaType].ignoreCount > 0) {\n bufferStateDict[e.mediaType].ignoreCount--;\n }\n }\n }\n\n function reset() {\n resetInitialSettings();\n eventBus.off(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_7__["default"].PLAYBACK_SEEKING, _onPlaybackSeeking, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].BYTES_APPENDED_END_FRAGMENT, _onBytesAppended, instance);\n }\n\n instance = {\n getMaxIndex: getMaxIndex,\n reset: reset\n };\n setup();\n return instance;\n}\n\nInsufficientBufferRule.__dashjs_factory_name = \'InsufficientBufferRule\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getClassFactory(InsufficientBufferRule));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/L2ARule.js":\n/*!********************************************!*\\\n !*** ./src/streaming/rules/abr/L2ARule.js ***!\n \\********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2185392__) {\n__nested_webpack_require_2185392__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2185392__(/*! ../../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _SwitchRequest__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2185392__(/*! ../SwitchRequest */ "./src/streaming/rules/SwitchRequest.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2185392__(/*! ../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2185392__(/*! ../../vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2185392__(/*! ../../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2185392__(/*! ../../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2185392__(/*! ../../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_2185392__(/*! ../../constants/Constants */ "./src/streaming/constants/Constants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2020, Unified Streaming.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n// For a description of the Learn2Adapt-LowLatency (L2A-LL) bitrate adaptation algorithm, see https://github.com/unifiedstreaming/Learn2Adapt-LowLatency/blob/master/Online_learning_for_bitrate_adaptation_in_low_latency_live_streaming_CR.pdf\n\n\n\n\n\n\n\n\nvar L2A_STATE_ONE_BITRATE = 0; // If there is only one bitrate (or initialization failed), always return NO_CHANGE.\n\nvar L2A_STATE_STARTUP = 1; // Set placeholder buffer such that we download fragments at most recently measured throughput.\n\nvar L2A_STATE_STEADY = 2; // Buffer primed, we switch to steady operation.\n\nfunction L2ARule(config) {\n config = config || {};\n var context = this.context;\n var dashMetrics = config.dashMetrics;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n var instance, l2AStateDict, l2AParameterDict, logger;\n /**\n * Setup function to initialize L2ARule\n */\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_6__["default"])(context).getInstance().getLogger(instance);\n\n _resetInitialSettings();\n\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].PLAYBACK_SEEKING, _onPlaybackSeeking, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].MEDIA_FRAGMENT_LOADED, _onMediaFragmentLoaded, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].METRIC_ADDED, _onMetricAdded, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].QUALITY_CHANGE_REQUESTED, _onQualityChangeRequested, instance);\n }\n /**\n * Sets the initial state of the algorithm. Calls the initialize function for the paramteters.\n * @param {object} rulesContext\n * @return {object} initialState\n * @private\n */\n\n\n function _getInitialL2AState(rulesContext) {\n var initialState = {};\n var mediaInfo = rulesContext.getMediaInfo();\n var bitrates = mediaInfo.bitrateList.map(function (b) {\n return b.bandwidth / 1000;\n });\n initialState.state = L2A_STATE_STARTUP;\n initialState.bitrates = bitrates;\n initialState.lastQuality = 0;\n\n _initializeL2AParameters(mediaInfo);\n\n _clearL2AStateOnSeek(initialState);\n\n return initialState;\n }\n /**\n * Initializes the parameters of the algorithm. This will be done once for each media type.\n * @param {object} mediaInfo\n * @private\n */\n\n\n function _initializeL2AParameters(mediaInfo) {\n if (!mediaInfo || !mediaInfo.type) {\n return;\n }\n\n l2AParameterDict[mediaInfo.type] = {};\n l2AParameterDict[mediaInfo.type].w = []; //Vector of probabilities associated with bitrate decisions\n\n l2AParameterDict[mediaInfo.type].prev_w = []; //Vector of probabilities associated with bitrate decisions calculated in the previous step\n\n l2AParameterDict[mediaInfo.type].Q = 0; //Initialization of Lagrangian multiplier (This keeps track of the buffer displacement)\n\n l2AParameterDict[mediaInfo.type].segment_request_start_s = 0;\n l2AParameterDict[mediaInfo.type].segment_download_finish_s = 0;\n l2AParameterDict[mediaInfo.type].B_target = 1.5; //Target buffer level\n }\n /**\n * Clears the state object\n * @param {object} l2AState\n * @private\n */\n\n\n function _clearL2AStateOnSeek(l2AState) {\n l2AState.placeholderBuffer = 0;\n l2AState.mostAdvancedSegmentStart = NaN;\n l2AState.lastSegmentWasReplacement = false;\n l2AState.lastSegmentStart = NaN;\n l2AState.lastSegmentDurationS = NaN;\n l2AState.lastSegmentRequestTimeMs = NaN;\n l2AState.lastSegmentFinishTimeMs = NaN;\n }\n /**\n * Returns the state object for a fiven media type. If the state object is not yet defined _getInitialL2AState is called\n * @param {object} rulesContext\n * @return {object} l2AState\n * @private\n */\n\n\n function _getL2AState(rulesContext) {\n var mediaType = rulesContext.getMediaType();\n var l2AState = l2AStateDict[mediaType];\n\n if (!l2AState) {\n l2AState = _getInitialL2AState(rulesContext);\n l2AStateDict[mediaType] = l2AState;\n }\n\n return l2AState;\n }\n /**\n * Event handler for the seeking event.\n * @private\n */\n\n\n function _onPlaybackSeeking() {\n for (var mediaType in l2AStateDict) {\n if (l2AStateDict.hasOwnProperty(mediaType)) {\n var l2aState = l2AStateDict[mediaType];\n\n if (l2aState.state !== L2A_STATE_ONE_BITRATE) {\n l2aState.state = L2A_STATE_STARTUP;\n\n _clearL2AStateOnSeek(l2aState);\n }\n }\n }\n }\n /**\n * Event handler for the mediaFragmentLoaded event\n * @param {object} e\n * @private\n */\n\n\n function _onMediaFragmentLoaded(e) {\n if (e && e.chunk && e.chunk.mediaInfo) {\n var l2AState = l2AStateDict[e.chunk.mediaInfo.type];\n var l2AParameters = l2AParameterDict[e.chunk.mediaInfo.type];\n\n if (l2AState && l2AState.state !== L2A_STATE_ONE_BITRATE) {\n var start = e.chunk.start;\n\n if (isNaN(l2AState.mostAdvancedSegmentStart) || start > l2AState.mostAdvancedSegmentStart) {\n l2AState.mostAdvancedSegmentStart = start;\n l2AState.lastSegmentWasReplacement = false;\n } else {\n l2AState.lastSegmentWasReplacement = true;\n }\n\n l2AState.lastSegmentStart = start;\n l2AState.lastSegmentDurationS = e.chunk.duration;\n l2AState.lastQuality = e.chunk.quality;\n\n _checkNewSegment(l2AState, l2AParameters);\n }\n }\n }\n /**\n * Event handler for the metricAdded event\n * @param {object} e\n * @private\n */\n\n\n function _onMetricAdded(e) {\n if (e && e.metric === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_0__["default"].HTTP_REQUEST && e.value && e.value.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_3__["HTTPRequest"].MEDIA_SEGMENT_TYPE && e.value.trace && e.value.trace.length) {\n var l2AState = l2AStateDict[e.mediaType];\n var l2AParameters = l2AParameterDict[e.mediaType];\n\n if (l2AState && l2AState.state !== L2A_STATE_ONE_BITRATE) {\n l2AState.lastSegmentRequestTimeMs = e.value.trequest.getTime();\n l2AState.lastSegmentFinishTimeMs = e.value._tfinish.getTime();\n\n _checkNewSegment(l2AState, l2AParameters);\n }\n }\n }\n /**\n * When a new metric has been added or a media fragment has been loaded the state is adjusted accordingly\n * @param {object} L2AState\n * @param {object} l2AParameters\n * @private\n */\n\n\n function _checkNewSegment(L2AState, l2AParameters) {\n if (!isNaN(L2AState.lastSegmentStart) && !isNaN(L2AState.lastSegmentRequestTimeMs)) {\n l2AParameters.segment_request_start_s = 0.001 * L2AState.lastSegmentRequestTimeMs;\n l2AParameters.segment_download_finish_s = 0.001 * L2AState.lastSegmentFinishTimeMs;\n L2AState.lastSegmentStart = NaN;\n L2AState.lastSegmentRequestTimeMs = NaN;\n }\n }\n /**\n * Event handler for the qualityChangeRequested event\n * @param {object} e\n * @private\n */\n\n\n function _onQualityChangeRequested(e) {\n // Useful to store change requests when abandoning a download.\n if (e && e.mediaType) {\n var L2AState = l2AStateDict[e.mediaType];\n\n if (L2AState && L2AState.state !== L2A_STATE_ONE_BITRATE) {\n L2AState.abrQuality = e.newQuality;\n }\n }\n }\n /**\n * Dot multiplication of two arrays\n * @param {array} arr1\n * @param {array} arr2\n * @return {number} sumdot\n * @private\n */\n\n\n function _dotmultiplication(arr1, arr2) {\n if (arr1.length !== arr2.length) {\n return -1;\n }\n\n var sumdot = 0;\n\n for (var i = 0; i < arr1.length; i++) {\n sumdot = sumdot + arr1[i] * arr2[i];\n }\n\n return sumdot;\n }\n /**\n * Project an n-dim vector y to the simplex Dn\n * Dn = { x : x n-dim, 1 >= x >= 0, sum(x) = 1}\n * Algorithm is explained at http://arxiv.org/abs/1101.6081\n * @param {array} arr\n * @return {array}\n */\n\n\n function euclideanProjection(arr) {\n var m = arr.length;\n var bget = false;\n var arr2 = [];\n\n for (var ii = 0; ii < m; ++ii) {\n arr2[ii] = arr[ii];\n }\n\n var s = arr.sort(function (a, b) {\n return b - a;\n });\n var tmpsum = 0;\n var tmax = 0;\n var x = [];\n\n for (var _ii = 0; _ii < m - 1; ++_ii) {\n tmpsum = tmpsum + s[_ii];\n tmax = (tmpsum - 1) / (_ii + 1);\n\n if (tmax >= s[_ii + 1]) {\n bget = true;\n break;\n }\n }\n\n if (!bget) {\n tmax = (tmpsum + s[m - 1] - 1) / m;\n }\n\n for (var _ii2 = 0; _ii2 < m; ++_ii2) {\n x[_ii2] = Math.max(arr2[_ii2] - tmax, 0);\n }\n\n return x;\n }\n /**\n * Returns a switch request object indicating which quality is to be played\n * @param {object} rulesContext\n * @return {object}\n */\n\n\n function getMaxIndex(rulesContext) {\n var switchRequest = Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create();\n var horizon = 4; // Optimization horizon (The amount of steps required to achieve convergence)\n\n var vl = Math.pow(horizon, 0.99); // Cautiousness parameter, used to control aggressiveness of the bitrate decision process.\n\n var alpha = Math.max(Math.pow(horizon, 1), vl * Math.sqrt(horizon)); // Step size, used for gradient descent exploration granularity\n\n var mediaInfo = rulesContext.getMediaInfo();\n var mediaType = rulesContext.getMediaType();\n var bitrates = mediaInfo.bitrateList.map(function (b) {\n return b.bandwidth;\n });\n var bitrateCount = bitrates.length;\n var scheduleController = rulesContext.getScheduleController();\n var streamInfo = rulesContext.getStreamInfo();\n var abrController = rulesContext.getAbrController();\n var throughputHistory = abrController.getThroughputHistory();\n var isDynamic = streamInfo && streamInfo.manifestInfo && streamInfo.manifestInfo.isDynamic;\n var useL2AABR = rulesContext.useL2AABR();\n var bufferLevel = dashMetrics.getCurrentBufferLevel(mediaType, true);\n var safeThroughput = throughputHistory.getSafeAverageThroughput(mediaType, isDynamic);\n var throughput = throughputHistory.getAverageThroughput(mediaType, isDynamic); // In kbits/s\n\n var react = 2; // Reactiveness to volatility (abrupt throughput drops), used to re-calibrate Lagrangian multiplier Q\n\n var latency = throughputHistory.getAverageLatency(mediaType);\n var videoModel = rulesContext.getVideoModel();\n var quality;\n var currentPlaybackRate = videoModel.getPlaybackRate();\n\n if (!rulesContext || !rulesContext.hasOwnProperty(\'getMediaInfo\') || !rulesContext.hasOwnProperty(\'getMediaType\') || !rulesContext.hasOwnProperty(\'getScheduleController\') || !rulesContext.hasOwnProperty(\'getStreamInfo\') || !rulesContext.hasOwnProperty(\'getAbrController\') || !rulesContext.hasOwnProperty(\'useL2AABR\')) {\n return switchRequest;\n }\n\n switchRequest.reason = switchRequest.reason || {};\n\n if (!useL2AABR || mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_7__["default"].AUDIO) {\n // L2A decides bitrate only for video. Audio to be included in decision process in a later stage\n return switchRequest;\n }\n\n scheduleController.setTimeToLoadDelay(0);\n\n var l2AState = _getL2AState(rulesContext);\n\n if (l2AState.state === L2A_STATE_ONE_BITRATE) {\n // shouldn\'t even have been called\n return switchRequest;\n }\n\n var l2AParameter = l2AParameterDict[mediaType];\n\n if (!l2AParameter) {\n return switchRequest;\n }\n\n switchRequest.reason.state = l2AState.state;\n switchRequest.reason.throughput = throughput;\n switchRequest.reason.latency = latency;\n\n if (isNaN(throughput)) {\n // still starting up - not enough information\n return switchRequest;\n }\n\n switch (l2AState.state) {\n case L2A_STATE_STARTUP:\n quality = abrController.getQualityForBitrate(mediaInfo, safeThroughput, streamInfo.id, latency); //During strat-up phase abr.controller is responsible for bitrate decisions.\n\n switchRequest.quality = quality;\n switchRequest.reason.throughput = safeThroughput;\n l2AState.lastQuality = quality;\n\n if (!isNaN(l2AState.lastSegmentDurationS) && bufferLevel >= l2AParameter.B_target) {\n l2AState.state = L2A_STATE_STEADY;\n l2AParameter.Q = vl; // Initialization of Q langrangian multiplier\n // Update of probability vector w, to be used in main adaptation logic of L2A below (steady state)\n\n for (var i = 0; i < bitrateCount; ++i) {\n if (i === l2AState.lastQuality) {\n l2AParameter.prev_w[i] = 1;\n } else {\n l2AParameter.prev_w[i] = 0;\n }\n }\n }\n\n break;\n // L2A_STATE_STARTUP\n\n case L2A_STATE_STEADY:\n var diff1 = []; //Used to calculate the difference between consecutive decisions (w-w_prev)\n // Manual calculation of latency and throughput during previous request\n\n var throughputMeasureTime = dashMetrics.getCurrentHttpRequest(mediaType).trace.reduce(function (a, b) {\n return a + b.d;\n }, 0);\n var downloadBytes = dashMetrics.getCurrentHttpRequest(mediaType).trace.reduce(function (a, b) {\n return a + b.b[0];\n }, 0);\n var lastthroughput = Math.round(8 * downloadBytes / throughputMeasureTime); // bits/ms = kbits/s\n\n if (lastthroughput < 1) {\n lastthroughput = 1;\n } //To avoid division with 0 (avoid infinity) in case of an absolute network outage\n\n\n var V = l2AState.lastSegmentDurationS;\n var sign = 1; //Main adaptation logic of L2A-LL\n\n for (var _i = 0; _i < bitrateCount; ++_i) {\n bitrates[_i] = bitrates[_i] / 1000; // Originally in bps, now in Kbps\n\n if (currentPlaybackRate * bitrates[_i] > lastthroughput) {\n // In this case buffer would deplete, leading to a stall, which increases latency and thus the particular probability of selsection of bitrate[i] should be decreased.\n sign = -1;\n } // The objective of L2A is to minimize the overall latency=request-response time + buffer length after download+ potential stalling (if buffer less than chunk downlad time)\n\n\n l2AParameter.w[_i] = l2AParameter.prev_w[_i] + sign * (V / (2 * alpha)) * ((l2AParameter.Q + vl) * (currentPlaybackRate * bitrates[_i] / lastthroughput)); //Lagrangian descent\n } // Apply euclidean projection on w to ensure w expresses a probability distribution\n\n\n l2AParameter.w = euclideanProjection(l2AParameter.w);\n\n for (var _i2 = 0; _i2 < bitrateCount; ++_i2) {\n diff1[_i2] = l2AParameter.w[_i2] - l2AParameter.prev_w[_i2];\n l2AParameter.prev_w[_i2] = l2AParameter.w[_i2];\n } // Lagrangian multiplier Q calculation:\n\n\n l2AParameter.Q = Math.max(0, l2AParameter.Q - V + V * currentPlaybackRate * ((_dotmultiplication(bitrates, l2AParameter.prev_w) + _dotmultiplication(bitrates, diff1)) / lastthroughput)); // Quality is calculated as argmin of the absolute difference between available bitrates (bitrates[i]) and bitrate estimation (dotmultiplication(w,bitrates)).\n\n var temp = [];\n\n for (var _i3 = 0; _i3 < bitrateCount; ++_i3) {\n temp[_i3] = Math.abs(bitrates[_i3] - _dotmultiplication(l2AParameter.w, bitrates));\n } // Quality is calculated based on the probability distribution w (the output of L2A)\n\n\n quality = temp.indexOf(Math.min.apply(Math, temp)); // We employ a cautious -stepwise- ascent\n\n if (quality > l2AState.lastQuality) {\n if (bitrates[l2AState.lastQuality + 1] <= lastthroughput) {\n quality = l2AState.lastQuality + 1;\n }\n } // Provision against bitrate over-estimation, by re-calibrating the Lagrangian multiplier Q, to be taken into account for the next chunk\n\n\n if (bitrates[quality] >= lastthroughput) {\n l2AParameter.Q = react * Math.max(vl, l2AParameter.Q);\n }\n\n switchRequest.quality = quality;\n switchRequest.reason.throughput = throughput;\n switchRequest.reason.latency = latency;\n switchRequest.reason.bufferLevel = bufferLevel;\n l2AState.lastQuality = switchRequest.quality;\n break;\n\n default:\n // should not arrive here, try to recover\n logger.debug(\'L2A ABR rule invoked in bad state.\');\n switchRequest.quality = abrController.getQualityForBitrate(mediaInfo, safeThroughput, streamInfo.id, latency);\n switchRequest.reason.state = l2AState.state;\n switchRequest.reason.throughput = safeThroughput;\n switchRequest.reason.latency = latency;\n l2AState.state = L2A_STATE_STARTUP;\n\n _clearL2AStateOnSeek(l2AState);\n\n }\n\n return switchRequest;\n }\n /**\n * Reset objects to their initial state\n * @private\n */\n\n\n function _resetInitialSettings() {\n l2AStateDict = {};\n l2AParameterDict = {};\n }\n /**\n * Reset the rule\n */\n\n\n function reset() {\n _resetInitialSettings();\n\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].PLAYBACK_SEEKING, _onPlaybackSeeking, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].MEDIA_FRAGMENT_LOADED, _onMediaFragmentLoaded, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].METRIC_ADDED, _onMetricAdded, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_5__["default"].QUALITY_CHANGE_REQUESTED, _onQualityChangeRequested, instance);\n }\n\n instance = {\n getMaxIndex: getMaxIndex,\n reset: reset\n };\n setup();\n return instance;\n}\n\nL2ARule.__dashjs_factory_name = \'L2ARule\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getClassFactory(L2ARule));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/SwitchHistoryRule.js":\n/*!******************************************************!*\\\n !*** ./src/streaming/rules/abr/SwitchHistoryRule.js ***!\n \\******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2206648__) {\n__nested_webpack_require_2206648__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2206648__(/*! ../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2206648__(/*! ../../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _SwitchRequest__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2206648__(/*! ../SwitchRequest */ "./src/streaming/rules/SwitchRequest.js");\n\n\n\n\nfunction SwitchHistoryRule() {\n var context = this.context;\n var instance, logger; //MAX_SWITCH is the number of drops made. It doesn\'t consider the size of the drop.\n\n var MAX_SWITCH = 0.075; //Before this number of switch requests(no switch or actual), don\'t apply the rule.\n //must be < SwitchRequestHistory SWITCH_REQUEST_HISTORY_DEPTH to enable rule\n\n var SAMPLE_SIZE = 6;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance().getLogger(instance);\n }\n\n function getMaxIndex(rulesContext) {\n var switchRequestHistory = rulesContext ? rulesContext.getSwitchHistory() : null;\n var switchRequests = switchRequestHistory ? switchRequestHistory.getSwitchRequests() : [];\n var drops = 0;\n var noDrops = 0;\n var dropSize = 0;\n var switchRequest = Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_2__["default"])(context).create();\n\n for (var i = 0; i < switchRequests.length; i++) {\n if (switchRequests[i] !== undefined) {\n drops += switchRequests[i].drops;\n noDrops += switchRequests[i].noDrops;\n dropSize += switchRequests[i].dropSize;\n\n if (drops + noDrops >= SAMPLE_SIZE && drops / noDrops > MAX_SWITCH) {\n switchRequest.quality = i > 0 && switchRequests[i].drops > 0 ? i - 1 : i;\n switchRequest.reason = {\n index: switchRequest.quality,\n drops: drops,\n noDrops: noDrops,\n dropSize: dropSize\n };\n logger.debug(\'Switch history rule index: \' + switchRequest.quality + \' samples: \' + (drops + noDrops) + \' drops: \' + drops);\n break;\n }\n }\n }\n\n return switchRequest;\n }\n\n instance = {\n getMaxIndex: getMaxIndex\n };\n setup();\n return instance;\n}\n\nSwitchHistoryRule.__dashjs_factory_name = \'SwitchHistoryRule\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(SwitchHistoryRule));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/ThroughputRule.js":\n/*!***************************************************!*\\\n !*** ./src/streaming/rules/abr/ThroughputRule.js ***!\n \\***************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2209492__) {\n__nested_webpack_require_2209492__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2209492__(/*! ../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _SwitchRequest__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2209492__(/*! ../SwitchRequest */ "./src/streaming/rules/SwitchRequest.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2209492__(/*! ../../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2209492__(/*! ../../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\nfunction ThroughputRule(config) {\n config = config || {};\n var context = this.context;\n var dashMetrics = config.dashMetrics;\n var instance;\n\n function checkConfig() {\n if (!dashMetrics || !dashMetrics.hasOwnProperty(\'getCurrentBufferState\')) {\n throw new Error(_constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].MISSING_CONFIG_ERROR);\n }\n }\n\n function getMaxIndex(rulesContext) {\n var switchRequest = Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create();\n\n if (!rulesContext || !rulesContext.hasOwnProperty(\'getMediaInfo\') || !rulesContext.hasOwnProperty(\'getMediaType\') || !rulesContext.hasOwnProperty(\'useBufferOccupancyABR\') || !rulesContext.hasOwnProperty(\'getAbrController\') || !rulesContext.hasOwnProperty(\'getScheduleController\')) {\n return switchRequest;\n }\n\n checkConfig();\n var mediaInfo = rulesContext.getMediaInfo();\n var mediaType = rulesContext.getMediaType();\n var currentBufferState = dashMetrics.getCurrentBufferState(mediaType);\n var scheduleController = rulesContext.getScheduleController();\n var abrController = rulesContext.getAbrController();\n var streamInfo = rulesContext.getStreamInfo();\n var streamId = streamInfo ? streamInfo.id : null;\n var isDynamic = streamInfo && streamInfo.manifestInfo ? streamInfo.manifestInfo.isDynamic : null;\n var throughputHistory = abrController.getThroughputHistory();\n var throughput = throughputHistory.getSafeAverageThroughput(mediaType, isDynamic);\n var latency = throughputHistory.getAverageLatency(mediaType);\n var useBufferOccupancyABR = rulesContext.useBufferOccupancyABR();\n\n if (isNaN(throughput) || !currentBufferState || useBufferOccupancyABR) {\n return switchRequest;\n }\n\n if (abrController.getAbandonmentStateFor(streamId, mediaType) !== _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__["default"].ABANDON_LOAD) {\n if (currentBufferState.state === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_3__["default"].BUFFER_LOADED || isDynamic) {\n switchRequest.quality = abrController.getQualityForBitrate(mediaInfo, throughput, streamId, latency);\n scheduleController.setTimeToLoadDelay(0);\n switchRequest.reason = {\n throughput: throughput,\n latency: latency\n };\n }\n }\n\n return switchRequest;\n }\n\n function reset() {// no persistent information to reset\n }\n\n instance = {\n getMaxIndex: getMaxIndex,\n reset: reset\n };\n return instance;\n}\n\nThroughputRule.__dashjs_factory_name = \'ThroughputRule\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(ThroughputRule));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/lolp/LearningAbrController.js":\n/*!***************************************************************!*\\\n !*** ./src/streaming/rules/abr/lolp/LearningAbrController.js ***!\n \\***************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2215174__) {\n__nested_webpack_require_2215174__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2215174__(/*! ../../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2215174__(/*! ../../../../core/Debug */ "./src/core/Debug.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Authors:\n * Abdelhak Bentaleb | National University of Singapore | bentaleb@comp.nus.edu.sg\n * Mehmet N. Akcay | Ozyegin University | necmettin.akcay@ozu.edu.tr\n * May Lim | National University of Singapore | maylim@comp.nus.edu.sg\n */\n\n\nvar WEIGHT_SELECTION_MODES = {\n MANUAL: \'manual_weight_selection\',\n RANDOM: \'random_weight_selection\',\n DYNAMIC: \'dynamic_weight_selection\'\n};\n\nfunction LearningAbrController() {\n var context = this.context;\n var instance, logger, somBitrateNeurons, bitrateNormalizationFactor, latencyNormalizationFactor, minBitrate, weights, sortedCenters, weightSelectionMode;\n /**\n * Setup the class\n */\n\n function _setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance().getLogger(instance);\n\n _resetInitialSettings();\n }\n /**\n * Reset all values\n */\n\n\n function reset() {\n _resetInitialSettings();\n }\n /**\n * Reset to initial settings\n * @private\n */\n\n\n function _resetInitialSettings() {\n somBitrateNeurons = null;\n bitrateNormalizationFactor = 1;\n latencyNormalizationFactor = 100;\n minBitrate = 0;\n weights = null;\n sortedCenters = null;\n weightSelectionMode = WEIGHT_SELECTION_MODES.DYNAMIC;\n }\n /**\n * Returns the maximum throughput\n * @return {number}\n * @private\n */\n\n\n function _getMaxThroughput() {\n var maxThroughput = 0;\n\n if (somBitrateNeurons) {\n for (var i = 0; i < somBitrateNeurons.length; i++) {\n var neuron = somBitrateNeurons[i];\n\n if (neuron.state.throughput > maxThroughput) {\n maxThroughput = neuron.state.throughput;\n }\n }\n }\n\n return maxThroughput;\n }\n /**\n *\n * @param {array} w\n * @return {number}\n * @private\n */\n\n\n function _getMagnitude(w) {\n var magnitude = w.map(function (x) {\n return Math.pow(x, 2);\n }).reduce(function (sum, now) {\n return sum + now;\n });\n return Math.sqrt(magnitude);\n }\n /**\n *\n * @param {array} a\n * @param {array} b\n * @param {array} w\n * @return {number}\n * @private\n */\n\n\n function _getDistance(a, b, w) {\n var sum = a.map(function (x, i) {\n return w[i] * Math.pow(x - b[i], 2);\n }) // square the difference*w\n .reduce(function (sum, now) {\n return sum + now;\n }); // sum\n\n var sign = sum < 0 ? -1 : 1;\n return sign * Math.sqrt(Math.abs(sum));\n }\n /**\n *\n * @param {object} a\n * @param {object} b\n * @return {number}\n * @private\n */\n\n\n function _getNeuronDistance(a, b) {\n var aState = [a.state.throughput, a.state.latency, a.state.rebuffer, a.state["switch"]];\n var bState = [b.state.throughput, b.state.latency, b.state.rebuffer, b.state["switch"]];\n return _getDistance(aState, bState, [1, 1, 1, 1]);\n }\n /**\n *\n * @param {object} winnerNeuron\n * @param {array} somElements\n * @param {array} x\n * @private\n */\n\n\n function _updateNeurons(winnerNeuron, somElements, x) {\n for (var i = 0; i < somElements.length; i++) {\n var somNeuron = somElements[i];\n var sigma = 0.1;\n\n var neuronDistance = _getNeuronDistance(somNeuron, winnerNeuron);\n\n var neighbourHood = Math.exp(-1 * Math.pow(neuronDistance, 2) / (2 * Math.pow(sigma, 2)));\n\n _updateNeuronState(somNeuron, x, neighbourHood);\n }\n }\n /**\n *\n * @param {object} neuron\n * @param {array} x\n * @param {object} neighbourHood\n * @private\n */\n\n\n function _updateNeuronState(neuron, x, neighbourHood) {\n var state = neuron.state;\n var w = [0.01, 0.01, 0.01, 0.01]; // learning rate\n\n state.throughput = state.throughput + (x[0] - state.throughput) * w[0] * neighbourHood;\n state.latency = state.latency + (x[1] - state.latency) * w[1] * neighbourHood;\n state.rebuffer = state.rebuffer + (x[2] - state.rebuffer) * w[2] * neighbourHood;\n state["switch"] = state["switch"] + (x[3] - state["switch"]) * w[3] * neighbourHood;\n }\n /**\n *\n * @param {object} currentNeuron\n * @param {number} currentThroughput\n * @return {object}\n * @private\n */\n\n\n function _getDownShiftNeuron(currentNeuron, currentThroughput) {\n var maxSuitableBitrate = 0;\n var result = currentNeuron;\n\n if (somBitrateNeurons) {\n for (var i = 0; i < somBitrateNeurons.length; i++) {\n var n = somBitrateNeurons[i];\n\n if (n.bitrate < currentNeuron.bitrate && n.bitrate > maxSuitableBitrate && currentThroughput > n.bitrate) {\n // possible downshiftable neuron\n maxSuitableBitrate = n.bitrate;\n result = n;\n }\n }\n }\n\n return result;\n }\n /**\n *\n * @param {object} mediaInfo\n * @param {number} throughput\n * @param {number} latency\n * @param {number} bufferSize\n * @param {number} playbackRate\n * @param {number} currentQualityIndex\n * @param {object} dynamicWeightsSelector\n * @return {null|*}\n */\n\n\n function getNextQuality(mediaInfo, throughput, latency, bufferSize, playbackRate, currentQualityIndex, dynamicWeightsSelector) {\n // For Dynamic Weights Selector\n var currentLatency = latency;\n var currentBuffer = bufferSize;\n var currentThroughput = throughput;\n\n var somElements = _getSomBitrateNeurons(mediaInfo); // normalize throughput\n\n\n var throughputNormalized = throughput / bitrateNormalizationFactor; // saturate values higher than 1\n\n if (throughputNormalized > 1) {\n throughputNormalized = _getMaxThroughput();\n } // normalize latency\n\n\n latency = latency / latencyNormalizationFactor;\n var targetLatency = 0;\n var targetRebufferLevel = 0;\n var targetSwitch = 0; // 10K + video encoding is the recommended throughput\n\n var throughputDelta = 10000;\n logger.debug("getNextQuality called throughput:".concat(throughputNormalized, " latency:").concat(latency, " bufferSize:").concat(bufferSize, " currentQualityIndex:").concat(currentQualityIndex, " playbackRate:").concat(playbackRate));\n var currentNeuron = somElements[currentQualityIndex];\n var downloadTime = currentNeuron.bitrate * dynamicWeightsSelector.getSegmentDuration() / currentThroughput;\n var rebuffer = Math.max(0, downloadTime - currentBuffer); // check buffer for possible stall\n\n if (currentBuffer - downloadTime < dynamicWeightsSelector.getMinBuffer()) {\n logger.debug("Buffer is low for bitrate= ".concat(currentNeuron.bitrate, " downloadTime=").concat(downloadTime, " currentBuffer=").concat(currentBuffer, " rebuffer=").concat(rebuffer));\n return _getDownShiftNeuron(currentNeuron, currentThroughput).qualityIndex;\n }\n\n switch (weightSelectionMode) {\n case WEIGHT_SELECTION_MODES.MANUAL:\n _manualWeightSelection();\n\n break;\n\n case WEIGHT_SELECTION_MODES.RANDOM:\n _randomWeightSelection(somElements);\n\n break;\n\n case WEIGHT_SELECTION_MODES.DYNAMIC:\n _dynamicWeightSelection(dynamicWeightsSelector, somElements, currentLatency, currentBuffer, rebuffer, currentThroughput, playbackRate);\n\n break;\n\n default:\n _dynamicWeightSelection(dynamicWeightsSelector, somElements, currentLatency, currentBuffer, rebuffer, currentThroughput, playbackRate);\n\n }\n\n var minDistance = null;\n var minIndex = null;\n var winnerNeuron = null;\n\n for (var i = 0; i < somElements.length; i++) {\n var somNeuron = somElements[i];\n var somNeuronState = somNeuron.state;\n var somData = [somNeuronState.throughput, somNeuronState.latency, somNeuronState.rebuffer, somNeuronState["switch"]];\n var distanceWeights = weights.slice();\n var nextBuffer = dynamicWeightsSelector.getNextBufferWithBitrate(somNeuron.bitrate, currentBuffer, currentThroughput);\n var isBufferLow = nextBuffer < dynamicWeightsSelector.getMinBuffer();\n\n if (isBufferLow) {\n logger.debug("Buffer is low for bitrate=".concat(somNeuron.bitrate, " downloadTime=").concat(downloadTime, " currentBuffer=").concat(currentBuffer, " nextBuffer=").concat(nextBuffer));\n } // special condition downshift immediately\n\n\n if (somNeuron.bitrate > throughput - throughputDelta || isBufferLow) {\n if (somNeuron.bitrate !== minBitrate) {\n // encourage to pick smaller bitrates throughputWeight=100\n distanceWeights[0] = 100;\n }\n } // calculate the distance with the target\n\n\n var distance = _getDistance(somData, [throughputNormalized, targetLatency, targetRebufferLevel, targetSwitch], distanceWeights);\n\n if (minDistance === null || distance < minDistance) {\n minDistance = distance;\n minIndex = somNeuron.qualityIndex;\n winnerNeuron = somNeuron;\n }\n } // update current neuron and the neighbourhood with the calculated QoE\n // will punish current if it is not picked\n\n\n var bitrateSwitch = Math.abs(currentNeuron.bitrate - winnerNeuron.bitrate) / bitrateNormalizationFactor;\n\n _updateNeurons(currentNeuron, somElements, [throughputNormalized, latency, rebuffer, bitrateSwitch]); // update bmu and neighbours with targetQoE=1, targetLatency=0\n\n\n _updateNeurons(winnerNeuron, somElements, [throughputNormalized, targetLatency, targetRebufferLevel, bitrateSwitch]);\n\n return minIndex;\n }\n /**\n * Option 1: Manual weights\n * @private\n */\n\n\n function _manualWeightSelection() {\n var throughputWeight = 0.4;\n var latencyWeight = 0.4;\n var bufferWeight = 0.4;\n var switchWeight = 0.4;\n weights = [throughputWeight, latencyWeight, bufferWeight, switchWeight]; // throughput, latency, buffer, switch\n }\n /**\n * Option 2: Random (Xavier) weights\n * @param {array} somElements\n * @private\n */\n\n\n function _randomWeightSelection(somElements) {\n weights = _getXavierWeights(somElements.length, 4);\n }\n /**\n * Dynamic Weight Selector weights\n * @param {object} dynamicWeightsSelector\n * @param {array} somElements\n * @param {number} currentLatency\n * @param {number} currentBuffer\n * @param {number} rebuffer\n * @param {number} currentThroughput\n * @param {number} playbackRate\n * @private\n */\n\n\n function _dynamicWeightSelection(dynamicWeightsSelector, somElements, currentLatency, currentBuffer, rebuffer, currentThroughput, playbackRate) {\n if (!weights) {\n weights = sortedCenters[sortedCenters.length - 1];\n } // Dynamic Weights Selector (step 2/2: find weights)\n\n\n var weightVector = dynamicWeightsSelector.findWeightVector(somElements, currentLatency, currentBuffer, rebuffer, currentThroughput, playbackRate);\n\n if (weightVector !== null && weightVector !== -1) {\n // null: something went wrong, -1: constraints not met\n weights = weightVector;\n }\n }\n /**\n *\n * @param {number }neuronCount\n * @param {number }weightCount\n * @return {array}\n * @private\n */\n\n\n function _getXavierWeights(neuronCount, weightCount) {\n var W = [];\n var upperBound = Math.sqrt(2 / neuronCount);\n\n for (var i = 0; i < weightCount; i++) {\n W.push(Math.random() * upperBound);\n }\n\n weights = W;\n return weights;\n }\n /**\n *\n * @param {object} mediaInfo\n * @return {array}\n * @private\n */\n\n\n function _getSomBitrateNeurons(mediaInfo) {\n if (!somBitrateNeurons) {\n somBitrateNeurons = [];\n var bitrateList = mediaInfo.bitrateList;\n var bitrateVector = [];\n minBitrate = bitrateList[0].bandwidth;\n bitrateList.forEach(function (element) {\n bitrateVector.push(element.bandwidth);\n\n if (element.bandwidth < minBitrate) {\n minBitrate = element.bandwidth;\n }\n });\n bitrateNormalizationFactor = _getMagnitude(bitrateVector);\n\n for (var i = 0; i < bitrateList.length; i++) {\n var neuron = {\n qualityIndex: i,\n bitrate: bitrateList[i].bandwidth,\n state: {\n // normalize throughputs\n throughput: bitrateList[i].bandwidth / bitrateNormalizationFactor,\n latency: 0,\n rebuffer: 0,\n "switch": 0\n }\n };\n somBitrateNeurons.push(neuron);\n }\n\n sortedCenters = _getInitialKmeansPlusPlusCenters(somBitrateNeurons);\n }\n\n return somBitrateNeurons;\n }\n /**\n *\n * @param {number} size\n * @return {array}\n * @private\n */\n\n\n function _getRandomData(size) {\n var dataArray = [];\n\n for (var i = 0; i < size; i++) {\n var data = [Math.random() * _getMaxThroughput(), //throughput\n Math.random(), //latency\n Math.random(), //buffersize\n Math.random() //switch\n ];\n dataArray.push(data);\n }\n\n return dataArray;\n }\n /**\n *\n * @param {array} somElements\n * @return {array}\n * @private\n */\n\n\n function _getInitialKmeansPlusPlusCenters(somElements) {\n var centers = [];\n\n var randomDataSet = _getRandomData(Math.pow(somElements.length, 2));\n\n centers.push(randomDataSet[0]);\n var distanceWeights = [1, 1, 1, 1];\n\n for (var k = 1; k < somElements.length; k++) {\n var nextPoint = null;\n var _maxDistance = null;\n\n for (var i = 0; i < randomDataSet.length; i++) {\n var currentPoint = randomDataSet[i];\n var minDistance = null;\n\n for (var j = 0; j < centers.length; j++) {\n var distance = _getDistance(currentPoint, centers[j], distanceWeights);\n\n if (minDistance === null || distance < minDistance) {\n minDistance = distance;\n }\n }\n\n if (_maxDistance === null || minDistance > _maxDistance) {\n nextPoint = currentPoint;\n _maxDistance = minDistance;\n }\n }\n\n centers.push(nextPoint);\n } // find the least similar center\n\n\n var maxDistance = null;\n var leastSimilarIndex = null;\n\n for (var _i = 0; _i < centers.length; _i++) {\n var _distance = 0;\n\n for (var _j = 0; _j < centers.length; _j++) {\n if (_i === _j) continue;\n _distance += _getDistance(centers[_i], centers[_j], distanceWeights);\n }\n\n if (maxDistance === null || _distance > maxDistance) {\n maxDistance = _distance;\n leastSimilarIndex = _i;\n }\n } // move centers to sortedCenters\n\n\n var sortedCenters = [];\n sortedCenters.push(centers[leastSimilarIndex]);\n centers.splice(leastSimilarIndex, 1);\n\n while (centers.length > 0) {\n var _minDistance = null;\n var minIndex = null;\n\n for (var _i2 = 0; _i2 < centers.length; _i2++) {\n var _distance2 = _getDistance(sortedCenters[0], centers[_i2], distanceWeights);\n\n if (_minDistance === null || _distance2 < _minDistance) {\n _minDistance = _distance2;\n minIndex = _i2;\n }\n }\n\n sortedCenters.push(centers[minIndex]);\n centers.splice(minIndex, 1);\n }\n\n return sortedCenters;\n }\n\n instance = {\n getNextQuality: getNextQuality,\n reset: reset\n };\n\n _setup();\n\n return instance;\n}\n\nLearningAbrController.__dashjs_factory_name = \'LearningAbrController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(LearningAbrController));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/lolp/LoLpQoEEvaluator.js":\n/*!**********************************************************!*\\\n !*** ./src/streaming/rules/abr/lolp/LoLpQoEEvaluator.js ***!\n \\**********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2232744__) {\n__nested_webpack_require_2232744__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2232744__(/*! ../../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _QoeInfo__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2232744__(/*! ./QoeInfo */ "./src/streaming/rules/abr/lolp/QoeInfo.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Authors:\n * Abdelhak Bentaleb | National University of Singapore | bentaleb@comp.nus.edu.sg\n * Mehmet N. Akcay | Ozyegin University | necmettin.akcay@ozu.edu.tr\n * May Lim | National University of Singapore | maylim@comp.nus.edu.sg\n */\n\n\n\nfunction LoLpQoeEvaluator() {\n var instance, voPerSegmentQoeInfo, segmentDuration, maxBitrateKbps, minBitrateKbps;\n\n function _setup() {\n _resetInitialSettings();\n }\n\n function _resetInitialSettings() {\n voPerSegmentQoeInfo = null;\n segmentDuration = null;\n maxBitrateKbps = null;\n minBitrateKbps = null;\n }\n\n function setupPerSegmentQoe(sDuration, maxBrKbps, minBrKbps) {\n // Set up Per Segment QoeInfo\n voPerSegmentQoeInfo = _createQoeInfo(\'segment\', sDuration, maxBrKbps, minBrKbps);\n segmentDuration = sDuration;\n maxBitrateKbps = maxBrKbps;\n minBitrateKbps = minBrKbps;\n }\n\n function _createQoeInfo(fragmentType, fragmentDuration, maxBitrateKbps, minBitrateKbps) {\n /*\n * [Weights][Source: Abdelhak Bentaleb, 2020 (last updated: 30 Mar 2020)]\n * bitrateReward: segment duration, e.g. 0.5s\n * bitrateSwitchPenalty: 0.02s or 1s if the bitrate switch is too important\n * rebufferPenalty: max encoding bitrate, e.g. 1000kbps\n * latencyPenalty: if L ≤ 1.1 seconds then = min encoding bitrate * 0.05, otherwise = max encoding bitrate * 0.1\n * playbackSpeedPenalty: min encoding bitrate, e.g. 200kbps\n */\n // Create new QoeInfo object\n var qoeInfo = new _QoeInfo__WEBPACK_IMPORTED_MODULE_1__["default"]();\n qoeInfo.type = fragmentType; // Set weight: bitrateReward\n // set some safe value, else consider throwing error\n\n if (!fragmentDuration) {\n qoeInfo.weights.bitrateReward = 1;\n } else {\n qoeInfo.weights.bitrateReward = fragmentDuration;\n } // Set weight: bitrateSwitchPenalty\n // qoeInfo.weights.bitrateSwitchPenalty = 0.02;\n\n\n qoeInfo.weights.bitrateSwitchPenalty = 1; // Set weight: rebufferPenalty\n // set some safe value, else consider throwing error\n\n if (!maxBitrateKbps) {\n qoeInfo.weights.rebufferPenalty = 1000;\n } else {\n qoeInfo.weights.rebufferPenalty = maxBitrateKbps;\n } // Set weight: latencyPenalty\n\n\n qoeInfo.weights.latencyPenalty = [];\n qoeInfo.weights.latencyPenalty.push({\n threshold: 1.1,\n penalty: minBitrateKbps * 0.05\n });\n qoeInfo.weights.latencyPenalty.push({\n threshold: 100000000,\n penalty: maxBitrateKbps * 0.1\n }); // Set weight: playbackSpeedPenalty\n\n if (!minBitrateKbps) qoeInfo.weights.playbackSpeedPenalty = 200; // set some safe value, else consider throwing error\n else qoeInfo.weights.playbackSpeedPenalty = minBitrateKbps;\n return qoeInfo;\n }\n\n function logSegmentMetrics(segmentBitrate, segmentRebufferTime, currentLatency, currentPlaybackSpeed) {\n if (voPerSegmentQoeInfo) {\n _logMetricsInQoeInfo(segmentBitrate, segmentRebufferTime, currentLatency, currentPlaybackSpeed, voPerSegmentQoeInfo);\n }\n }\n\n function _logMetricsInQoeInfo(bitrate, rebufferTime, latency, playbackSpeed, qoeInfo) {\n // Update: bitrate Weighted Sum value\n qoeInfo.bitrateWSum += qoeInfo.weights.bitrateReward * bitrate; // Update: bitrateSwitch Weighted Sum value\n\n if (qoeInfo.lastBitrate) {\n qoeInfo.bitrateSwitchWSum += qoeInfo.weights.bitrateSwitchPenalty * Math.abs(bitrate - qoeInfo.lastBitrate);\n }\n\n qoeInfo.lastBitrate = bitrate; // Update: rebuffer Weighted Sum value\n\n qoeInfo.rebufferWSum += qoeInfo.weights.rebufferPenalty * rebufferTime; // Update: latency Weighted Sum value\n\n for (var i = 0; i < qoeInfo.weights.latencyPenalty.length; i++) {\n var latencyRange = qoeInfo.weights.latencyPenalty[i];\n\n if (latency <= latencyRange.threshold) {\n qoeInfo.latencyWSum += latencyRange.penalty * latency;\n break;\n }\n } // Update: playbackSpeed Weighted Sum value\n\n\n qoeInfo.playbackSpeedWSum += qoeInfo.weights.playbackSpeedPenalty * Math.abs(1 - playbackSpeed); // Update: Total Qoe value\n\n qoeInfo.totalQoe = qoeInfo.bitrateWSum - qoeInfo.bitrateSwitchWSum - qoeInfo.rebufferWSum - qoeInfo.latencyWSum - qoeInfo.playbackSpeedWSum;\n } // Returns current Per Segment QoeInfo\n\n\n function getPerSegmentQoe() {\n return voPerSegmentQoeInfo;\n } // For one-time use only\n // Returns totalQoe based on a single set of metrics.\n\n\n function calculateSingleUseQoe(segmentBitrate, segmentRebufferTime, currentLatency, currentPlaybackSpeed) {\n var singleUseQoeInfo = null;\n\n if (segmentDuration && maxBitrateKbps && minBitrateKbps) {\n singleUseQoeInfo = _createQoeInfo(\'segment\', segmentDuration, maxBitrateKbps, minBitrateKbps);\n }\n\n if (singleUseQoeInfo) {\n _logMetricsInQoeInfo(segmentBitrate, segmentRebufferTime, currentLatency, currentPlaybackSpeed, singleUseQoeInfo);\n\n return singleUseQoeInfo.totalQoe;\n } else {\n // Something went wrong..\n return 0;\n }\n }\n\n function reset() {\n _resetInitialSettings();\n }\n\n instance = {\n setupPerSegmentQoe: setupPerSegmentQoe,\n logSegmentMetrics: logSegmentMetrics,\n getPerSegmentQoe: getPerSegmentQoe,\n calculateSingleUseQoe: calculateSingleUseQoe,\n reset: reset\n };\n\n _setup();\n\n return instance;\n}\n\nLoLpQoeEvaluator.__dashjs_factory_name = \'LoLpQoeEvaluator\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(LoLpQoeEvaluator));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/lolp/LoLpRule.js":\n/*!**************************************************!*\\\n !*** ./src/streaming/rules/abr/lolp/LoLpRule.js ***!\n \\**************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2240752__) {\n__nested_webpack_require_2240752__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2240752__(/*! ../../../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2240752__(/*! ../../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _LearningAbrController__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2240752__(/*! ./LearningAbrController */ "./src/streaming/rules/abr/lolp/LearningAbrController.js");\n/* harmony import */ var _LoLpQoEEvaluator__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2240752__(/*! ./LoLpQoEEvaluator */ "./src/streaming/rules/abr/lolp/LoLpQoEEvaluator.js");\n/* harmony import */ var _SwitchRequest__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2240752__(/*! ../../SwitchRequest */ "./src/streaming/rules/SwitchRequest.js");\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2240752__(/*! ../../../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\n/* harmony import */ var _LoLpWeightSelector__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2240752__(/*! ./LoLpWeightSelector */ "./src/streaming/rules/abr/lolp/LoLpWeightSelector.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_2240752__(/*! ../../../constants/Constants */ "./src/streaming/constants/Constants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Authors:\n * Abdelhak Bentaleb | National University of Singapore | bentaleb@comp.nus.edu.sg\n * Mehmet N. Akcay | Ozyegin University | necmettin.akcay@ozu.edu.tr\n * May Lim | National University of Singapore | maylim@comp.nus.edu.sg\n */\n\n\n\n\n\n\n\n\nvar DWS_TARGET_LATENCY = 1.5;\nvar DWS_BUFFER_MIN = 0.3;\n\nfunction LoLPRule(config) {\n config = config || {};\n var dashMetrics = config.dashMetrics;\n var context = this.context;\n var logger, instance, learningController, qoeEvaluator;\n\n function _setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance().getLogger(instance);\n learningController = Object(_LearningAbrController__WEBPACK_IMPORTED_MODULE_2__["default"])(context).create();\n qoeEvaluator = Object(_LoLpQoEEvaluator__WEBPACK_IMPORTED_MODULE_3__["default"])(context).create();\n }\n\n function getMaxIndex(rulesContext) {\n try {\n var switchRequest = Object(_SwitchRequest__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create();\n var mediaType = rulesContext.getMediaInfo().type;\n var abrController = rulesContext.getAbrController();\n var streamInfo = rulesContext.getStreamInfo();\n var currentQuality = abrController.getQualityFor(mediaType, streamInfo.id);\n var mediaInfo = rulesContext.getMediaInfo();\n var bufferStateVO = dashMetrics.getCurrentBufferState(mediaType);\n var scheduleController = rulesContext.getScheduleController();\n var currentBufferLevel = dashMetrics.getCurrentBufferLevel(mediaType, true);\n var isDynamic = streamInfo && streamInfo.manifestInfo ? streamInfo.manifestInfo.isDynamic : null;\n var playbackController = scheduleController.getPlaybackController();\n var latency = playbackController.getCurrentLiveLatency();\n\n if (!rulesContext.useLoLPABR() || mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_7__["default"].AUDIO) {\n return switchRequest;\n }\n\n if (!latency) {\n latency = 0;\n }\n\n var playbackRate = playbackController.getPlaybackRate();\n var throughputHistory = abrController.getThroughputHistory();\n var throughput = throughputHistory.getSafeAverageThroughput(mediaType, isDynamic);\n logger.debug("Throughput ".concat(Math.round(throughput), " kbps"));\n\n if (isNaN(throughput) || !bufferStateVO) {\n return switchRequest;\n }\n\n if (abrController.getAbandonmentStateFor(streamInfo.id, mediaType) === _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_5__["default"].ABANDON_LOAD) {\n return switchRequest;\n } // QoE parameters\n\n\n var bitrateList = mediaInfo.bitrateList; // [{bandwidth: 200000, width: 640, height: 360}, ...]\n\n var segmentDuration = rulesContext.getRepresentationInfo().fragmentDuration;\n var minBitrateKbps = bitrateList[0].bandwidth / 1000.0; // min bitrate level\n\n var maxBitrateKbps = bitrateList[bitrateList.length - 1].bandwidth / 1000.0; // max bitrate level\n\n for (var i = 0; i < bitrateList.length; i++) {\n // in case bitrateList is not sorted as expected\n var b = bitrateList[i].bandwidth / 1000.0;\n if (b > maxBitrateKbps) maxBitrateKbps = b;else if (b < minBitrateKbps) {\n minBitrateKbps = b;\n }\n } // Learning rule pre-calculations\n\n\n var currentBitrate = bitrateList[currentQuality].bandwidth;\n var currentBitrateKbps = currentBitrate / 1000.0;\n var httpRequest = dashMetrics.getCurrentHttpRequest(mediaType, true);\n var lastFragmentDownloadTime = (httpRequest.tresponse.getTime() - httpRequest.trequest.getTime()) / 1000;\n var segmentRebufferTime = lastFragmentDownloadTime > segmentDuration ? lastFragmentDownloadTime - segmentDuration : 0;\n qoeEvaluator.setupPerSegmentQoe(segmentDuration, maxBitrateKbps, minBitrateKbps);\n qoeEvaluator.logSegmentMetrics(currentBitrateKbps, segmentRebufferTime, latency, playbackRate);\n /*\n * Dynamic Weights Selector (step 1/2: initialization)\n */\n\n var dynamicWeightsSelector = Object(_LoLpWeightSelector__WEBPACK_IMPORTED_MODULE_6__["default"])(context).create({\n targetLatency: DWS_TARGET_LATENCY,\n bufferMin: DWS_BUFFER_MIN,\n segmentDuration: segmentDuration,\n qoeEvaluator: qoeEvaluator\n });\n /*\n * Select next quality\n */\n\n switchRequest.quality = learningController.getNextQuality(mediaInfo, throughput * 1000, latency, currentBufferLevel, playbackRate, currentQuality, dynamicWeightsSelector);\n switchRequest.reason = {\n throughput: throughput,\n latency: latency\n };\n switchRequest.priority = _SwitchRequest__WEBPACK_IMPORTED_MODULE_4__["default"].PRIORITY.STRONG;\n scheduleController.setTimeToLoadDelay(0);\n\n if (switchRequest.quality !== currentQuality) {\n console.log(\'[TgcLearningRule][\' + mediaType + \'] requesting switch to index: \', switchRequest.quality, \'Average throughput\', Math.round(throughput), \'kbps\');\n }\n\n return switchRequest;\n } catch (e) {\n throw e;\n }\n }\n /**\n * Reset objects to their initial state\n * @private\n */\n\n\n function _resetInitialSettings() {\n learningController.reset();\n qoeEvaluator.reset();\n }\n /**\n * Reset the rule\n */\n\n\n function reset() {\n _resetInitialSettings();\n }\n\n instance = {\n getMaxIndex: getMaxIndex,\n reset: reset\n };\n\n _setup();\n\n return instance;\n}\n\nLoLPRule.__dashjs_factory_name = \'LoLPRule\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"].getClassFactory(LoLPRule));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/lolp/LoLpWeightSelector.js":\n/*!************************************************************!*\\\n !*** ./src/streaming/rules/abr/lolp/LoLpWeightSelector.js ***!\n \\************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2250010__) {\n__nested_webpack_require_2250010__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2250010__(/*! ../../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Authors:\n * Abdelhak Bentaleb | National University of Singapore | bentaleb@comp.nus.edu.sg\n * Mehmet N. Akcay | Ozyegin University | necmettin.akcay@ozu.edu.tr\n * May Lim | National University of Singapore | maylim@comp.nus.edu.sg\n */\n\n\nfunction LoLpWeightSelector(config) {\n var targetLatency = config.targetLatency;\n var bufferMin = config.bufferMin;\n var segmentDuration = config.segmentDuration;\n var qoeEvaluator = config.qoeEvaluator;\n var instance, valueList, weightTypeCount, weightOptions, previousLatency;\n /**\n *\n * @private\n */\n\n function _setup() {\n _resetInitialSettings();\n }\n /**\n *\n * @private\n */\n\n\n function _resetInitialSettings() {\n valueList = [0.2, 0.4, 0.6, 0.8, 1];\n weightTypeCount = 4;\n weightOptions = _getPermutations(valueList, weightTypeCount);\n previousLatency = 0;\n }\n /**\n * Next, at each segment boundary, ABR to input current neurons and target state (only used in Method II) to find the desired weight vector\n * @param {array} neurons\n * @param {number} currentLatency\n * @param {number} currentBuffer\n * @param {number} currentRebuffer\n * @param {number} currentThroughput\n * @param {number} playbackRate\n * @return {null}\n * @private\n */\n\n\n function findWeightVector(neurons, currentLatency, currentBuffer, currentRebuffer, currentThroughput, playbackRate) {\n var maxQoE = null;\n var winnerWeights = null;\n var winnerBitrate = null;\n var deltaLatency = Math.abs(currentLatency - previousLatency); // For each neuron, m\n\n neurons.forEach(function (neuron) {\n // For each possible weight vector, z\n // E.g. For [ throughput, latency, buffer, playbackRate, QoE ]\n // Possible weightVector = [ 0.2, 0.4, 0.2, 0, 0.2 ]\n weightOptions.forEach(function (weightVector) {\n // Apply weightVector to neuron, compute utility and determine winnerWeights\n // Method I: Utility based on QoE given current state\n var weightsObj = {\n throughput: weightVector[0],\n latency: weightVector[1],\n buffer: weightVector[2],\n "switch": weightVector[3]\n };\n var downloadTime = neuron.bitrate * segmentDuration / currentThroughput;\n var nextBuffer = getNextBuffer(currentBuffer, downloadTime);\n var rebuffer = Math.max(0.00001, downloadTime - nextBuffer);\n var wt;\n\n if (weightsObj.buffer === 0) {\n wt = 10;\n } else {\n wt = 1 / weightsObj.buffer;\n }\n\n var weightedRebuffer = wt * rebuffer;\n\n if (weightsObj.latency === 0) {\n wt = 10;\n } else {\n wt = 1 / weightsObj.latency; // inverse the weight because wt and latency should have positive relationship, i.e., higher latency = higher wt\n }\n\n var weightedLatency = wt * neuron.state.latency;\n var totalQoE = qoeEvaluator.calculateSingleUseQoe(neuron.bitrate, weightedRebuffer, weightedLatency, playbackRate);\n\n if ((maxQoE === null || totalQoE > maxQoE) && _checkConstraints(currentLatency, nextBuffer, deltaLatency)) {\n maxQoE = totalQoE;\n winnerWeights = weightVector;\n winnerBitrate = neuron.bitrate;\n }\n });\n }); // winnerWeights was found, check if constraints are satisfied\n\n if (winnerWeights === null && winnerBitrate === null) {\n winnerWeights = -1;\n }\n\n previousLatency = currentLatency;\n return winnerWeights;\n }\n /**\n *\n * @param {number} nextLatency\n * @param {number} nextBuffer\n * @param {number} deltaLatency\n * @return {boolean}\n * @private\n */\n\n\n function _checkConstraints(nextLatency, nextBuffer, deltaLatency) {\n // A1\n // disabled till we find a better way of estimating latency\n // fails for all with current value\n if (nextLatency > targetLatency + deltaLatency) {\n return false;\n }\n\n return nextBuffer >= bufferMin;\n }\n /**\n *\n * @param {array} list\n * @param {number} length\n * @return {*}\n * @private\n */\n\n\n function _getPermutations(list, length) {\n // Copy initial values as arrays\n var perm = list.map(function (val) {\n return [val];\n }); // Our permutation generator\n\n var generate = function generate(perm, length, currLen) {\n // Reached desired length\n if (currLen === length) {\n return perm;\n } // For each existing permutation\n\n\n var len = perm.length;\n\n for (var i = 0; i < len; i++) {\n var currPerm = perm.shift(); // Create new permutation\n\n for (var k = 0; k < list.length; k++) {\n perm.push(currPerm.concat(list[k]));\n }\n } // Recurse\n\n\n return generate(perm, length, currLen + 1);\n }; // Start with size 1 because of initial values\n\n\n return generate(perm, length, 1);\n }\n /**\n *\n * @return {number}\n */\n\n\n function getMinBuffer() {\n return bufferMin;\n }\n /**\n *\n * @return {number}\n */\n\n\n function getSegmentDuration() {\n return segmentDuration;\n }\n /**\n *\n * @param {number} bitrateToDownload\n * @param {number} currentBuffer\n * @param {number} currentThroughput\n * @return {number}\n */\n\n\n function getNextBufferWithBitrate(bitrateToDownload, currentBuffer, currentThroughput) {\n var downloadTime = bitrateToDownload * segmentDuration / currentThroughput;\n return getNextBuffer(currentBuffer, downloadTime);\n }\n /**\n *\n * @param {number} currentBuffer\n * @param {number} downloadTime\n * @return {number}\n */\n\n\n function getNextBuffer(currentBuffer, downloadTime) {\n var segmentDuration = getSegmentDuration();\n var nextBuffer;\n\n if (downloadTime > segmentDuration) {\n nextBuffer = currentBuffer - segmentDuration;\n } else {\n nextBuffer = currentBuffer + segmentDuration - downloadTime;\n }\n\n return nextBuffer;\n }\n\n instance = {\n getMinBuffer: getMinBuffer,\n getSegmentDuration: getSegmentDuration,\n getNextBufferWithBitrate: getNextBufferWithBitrate,\n getNextBuffer: getNextBuffer,\n findWeightVector: findWeightVector\n };\n\n _setup();\n\n return instance;\n}\n\nLoLpWeightSelector.__dashjs_factory_name = \'LoLpWeightSelector\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(LoLpWeightSelector));\n\n/***/ }),\n\n/***/ "./src/streaming/rules/abr/lolp/QoeInfo.js":\n/*!*************************************************!*\\\n !*** ./src/streaming/rules/abr/lolp/QoeInfo.js ***!\n \\*************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2258685__) {\n__nested_webpack_require_2258685__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar QoeInfo = function QoeInfo() {\n _classCallCheck(this, QoeInfo);\n\n // Type e.g. \'segment\'\n this.type = null; // Store lastBitrate for calculation of bitrateSwitchWSum\n\n this.lastBitrate = null; // Weights for each Qoe factor\n\n this.weights = {};\n this.weights.bitrateReward = null;\n this.weights.bitrateSwitchPenalty = null;\n this.weights.rebufferPenalty = null;\n this.weights.latencyPenalty = null;\n this.weights.playbackSpeedPenalty = null; // Weighted Sum for each Qoe factor\n\n this.bitrateWSum = 0; // kbps\n\n this.bitrateSwitchWSum = 0; // kbps\n\n this.rebufferWSum = 0; // seconds\n\n this.latencyWSum = 0; // seconds\n\n this.playbackSpeedWSum = 0; // e.g. 0.95, 1.0, 1.05\n // Store total Qoe value based on current Weighted Sum values\n\n this.totalQoe = 0;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (QoeInfo);\n\n/***/ }),\n\n/***/ "./src/streaming/text/EmbeddedTextHtmlRender.js":\n/*!******************************************************!*\\\n !*** ./src/streaming/text/EmbeddedTextHtmlRender.js ***!\n \\******************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2261951__) {\n__nested_webpack_require_2261951__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2261951__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction EmbeddedTextHtmlRender() {\n var captionId = 0;\n var instance;\n /* HTML Rendering functions */\n\n function checkIndent(chars) {\n var line = \'\';\n\n for (var c = 0; c < chars.length; ++c) {\n var uc = chars[c];\n line += uc.uchar;\n }\n\n var l = line.length;\n var ll = line.replace(/^\\s+/, \'\').length;\n return l - ll;\n }\n\n function getRegionProperties(region) {\n return \'left: \' + region.x * 3.125 + \'%; top: \' + region.y1 * 6.66 + \'%; width: \' + (100 - region.x * 3.125) + \'%; height: \' + Math.max(region.y2 - 1 - region.y1, 1) * 6.66 + \'%; align-items: flex-start; overflow: visible; -webkit-writing-mode: horizontal-tb;\';\n }\n\n function createRGB(color) {\n if (color === \'red\') {\n return \'rgb(255, 0, 0)\';\n } else if (color === \'green\') {\n return \'rgb(0, 255, 0)\';\n } else if (color === \'blue\') {\n return \'rgb(0, 0, 255)\';\n } else if (color === \'cyan\') {\n return \'rgb(0, 255, 255)\';\n } else if (color === \'magenta\') {\n return \'rgb(255, 0, 255)\';\n } else if (color === \'yellow\') {\n return \'rgb(255, 255, 0)\';\n } else if (color === \'white\') {\n return \'rgb(255, 255, 255)\';\n } else if (color === \'black\') {\n return \'rgb(0, 0, 0)\';\n }\n\n return color;\n }\n\n function getStyle(videoElement, style) {\n var fontSize = videoElement.videoHeight / 15.0;\n\n if (style) {\n return \'font-size: \' + fontSize + \'px; font-family: Menlo, Consolas, \\\'Cutive Mono\\\', monospace; color: \' + (style.foreground ? createRGB(style.foreground) : \'rgb(255, 255, 255)\') + \'; font-style: \' + (style.italics ? \'italic\' : \'normal\') + \'; text-decoration: \' + (style.underline ? \'underline\' : \'none\') + \'; white-space: pre; background-color: \' + (style.background ? createRGB(style.background) : \'transparent\') + \';\';\n } else {\n return \'font-size: \' + fontSize + \'px; font-family: Menlo, Consolas, \\\'Cutive Mono\\\', monospace; justify-content: flex-start; text-align: left; color: rgb(255, 255, 255); font-style: normal; white-space: pre; line-height: normal; font-weight: normal; text-decoration: none; width: 100%; display: flex;\';\n }\n }\n\n function ltrim(s) {\n return s.replace(/^\\s+/g, \'\');\n }\n\n function rtrim(s) {\n return s.replace(/\\s+$/g, \'\');\n }\n\n function createHTMLCaptionsFromScreen(videoElement, startTime, endTime, captionScreen) {\n var currRegion = null;\n var existingRegion = null;\n var lastRowHasText = false;\n var lastRowIndentL = -1;\n var currP = {\n start: startTime,\n end: endTime,\n spans: []\n };\n var currentStyle = \'style_cea608_white_black\';\n var seenRegions = {};\n var styleStates = {};\n var regions = [];\n var r, s;\n\n for (r = 0; r < 15; ++r) {\n var row = captionScreen.rows[r];\n var line = \'\';\n var prevPenState = null;\n\n if (false === row.isEmpty()) {\n /* Row is not empty */\n\n /* Get indentation of this row */\n var rowIndent = checkIndent(row.chars);\n /* Create a new region is there is none */\n\n if (currRegion === null) {\n currRegion = {\n x: rowIndent,\n y1: r,\n y2: r + 1,\n p: []\n };\n }\n /* Check if indentation has changed and we had text of last row */\n\n\n if (rowIndent !== lastRowIndentL && lastRowHasText) {\n currRegion.p.push(currP);\n currP = {\n start: startTime,\n end: endTime,\n spans: []\n };\n currRegion.y2 = r;\n currRegion.name = \'region_\' + currRegion.x + \'_\' + currRegion.y1 + \'_\' + currRegion.y2;\n\n if (false === seenRegions.hasOwnProperty(currRegion.name)) {\n regions.push(currRegion);\n seenRegions[currRegion.name] = currRegion;\n } else {\n existingRegion = seenRegions[currRegion.name];\n existingRegion.p.contat(currRegion.p);\n }\n\n currRegion = {\n x: rowIndent,\n y1: r,\n y2: r + 1,\n p: []\n };\n }\n\n for (var c = 0; c < row.chars.length; ++c) {\n var uc = row.chars[c];\n var currPenState = uc.penState;\n\n if (prevPenState === null || !currPenState.equals(prevPenState)) {\n if (line.trim().length > 0) {\n currP.spans.push({\n name: currentStyle,\n line: line,\n row: r\n });\n line = \'\';\n }\n\n var currPenStateString = \'style_cea608_\' + currPenState.foreground + \'_\' + currPenState.background;\n\n if (currPenState.underline) {\n currPenStateString += \'_underline\';\n }\n\n if (currPenState.italics) {\n currPenStateString += \'_italics\';\n }\n\n if (!styleStates.hasOwnProperty(currPenStateString)) {\n styleStates[currPenStateString] = JSON.parse(JSON.stringify(currPenState));\n }\n\n prevPenState = currPenState;\n currentStyle = currPenStateString;\n }\n\n line += uc.uchar;\n }\n\n if (line.trim().length > 0) {\n currP.spans.push({\n name: currentStyle,\n line: line,\n row: r\n });\n }\n\n lastRowHasText = true;\n lastRowIndentL = rowIndent;\n } else {\n /* Row is empty */\n lastRowHasText = false;\n lastRowIndentL = -1;\n\n if (currRegion) {\n currRegion.p.push(currP);\n currP = {\n start: startTime,\n end: endTime,\n spans: []\n };\n currRegion.y2 = r;\n currRegion.name = \'region_\' + currRegion.x + \'_\' + currRegion.y1 + \'_\' + currRegion.y2;\n\n if (false === seenRegions.hasOwnProperty(currRegion.name)) {\n regions.push(currRegion);\n seenRegions[currRegion.name] = currRegion;\n } else {\n existingRegion = seenRegions[currRegion.name];\n existingRegion.p.contat(currRegion.p);\n }\n\n currRegion = null;\n }\n }\n }\n\n if (currRegion) {\n currRegion.p.push(currP);\n currRegion.y2 = r + 1;\n currRegion.name = \'region_\' + currRegion.x + \'_\' + currRegion.y1 + \'_\' + currRegion.y2;\n\n if (false === seenRegions.hasOwnProperty(currRegion.name)) {\n regions.push(currRegion);\n seenRegions[currRegion.name] = currRegion;\n } else {\n existingRegion = seenRegions[currRegion.name];\n existingRegion.p.contat(currRegion.p);\n }\n\n currRegion = null;\n }\n\n var captionsArray = [];\n /* Loop thru regions */\n\n for (r = 0; r < regions.length; ++r) {\n var region = regions[r];\n var cueID = \'sub_cea608_\' + captionId++;\n var finalDiv = document.createElement(\'div\');\n finalDiv.id = cueID;\n var cueRegionProperties = getRegionProperties(region);\n finalDiv.style.cssText = \'position: absolute; margin: 0; display: flex; box-sizing: border-box; pointer-events: none;\' + cueRegionProperties;\n var bodyDiv = document.createElement(\'div\');\n bodyDiv.className = \'paragraph bodyStyle\';\n bodyDiv.style.cssText = getStyle(videoElement);\n var cueUniWrapper = document.createElement(\'div\');\n cueUniWrapper.className = \'cueUniWrapper\';\n cueUniWrapper.style.cssText = \'unicode-bidi: normal; direction: ltr;\';\n\n for (var p = 0; p < region.p.length; ++p) {\n var ptag = region.p[p];\n var lastSpanRow = 0;\n\n for (s = 0; s < ptag.spans.length; ++s) {\n var span = ptag.spans[s];\n\n if (span.line.length > 0) {\n if (s !== 0 && lastSpanRow != span.row) {\n var brElement = document.createElement(\'br\');\n brElement.className = \'lineBreak\';\n cueUniWrapper.appendChild(brElement);\n }\n\n var sameRow = false;\n\n if (lastSpanRow === span.row) {\n sameRow = true;\n }\n\n lastSpanRow = span.row;\n var spanStyle = styleStates[span.name];\n var spanElement = document.createElement(\'span\');\n spanElement.className = \'spanPadding \' + span.name + \' customSpanColor\';\n spanElement.style.cssText = getStyle(videoElement, spanStyle);\n /* If this is not the first span, and it\'s on the same\n * row as the last one */\n\n if (s !== 0 && sameRow) {\n /* and it\'s the last span on this row */\n if (s === ptag.spans.length - 1) {\n /* trim only the right side */\n spanElement.textContent = rtrim(span.line);\n } else {\n /* don\'t trim at all */\n spanElement.textContent = span.line;\n }\n } else {\n /* if there is more than 1 span and this isn\'t the last span */\n if (ptag.spans.length > 1 && s < ptag.spans.length - 1) {\n /* Check if next text is on same row */\n if (span.row === ptag.spans[s + 1].row) {\n /* Next element on same row, trim start */\n spanElement.textContent = ltrim(span.line);\n } else {\n /* Different rows, trim both */\n spanElement.textContent = span.line.trim();\n }\n } else {\n spanElement.textContent = span.line.trim();\n }\n }\n\n cueUniWrapper.appendChild(spanElement);\n }\n }\n }\n\n bodyDiv.appendChild(cueUniWrapper);\n finalDiv.appendChild(bodyDiv);\n var fontSize = {\n \'bodyStyle\': [\'%\', 90]\n };\n\n for (var _s in styleStates) {\n if (styleStates.hasOwnProperty(_s)) {\n fontSize[_s] = [\'%\', 90];\n }\n }\n\n captionsArray.push({\n type: \'html\',\n start: startTime,\n end: endTime,\n cueHTMLElement: finalDiv,\n cueID: cueID,\n cellResolution: [32, 15],\n isFromCEA608: true,\n fontSize: fontSize,\n lineHeight: {},\n linePadding: {}\n });\n }\n\n return captionsArray;\n }\n\n instance = {\n createHTMLCaptionsFromScreen: createHTMLCaptionsFromScreen\n };\n return instance;\n}\n\nEmbeddedTextHtmlRender.__dashjs_factory_name = \'EmbeddedTextHtmlRender\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(EmbeddedTextHtmlRender));\n\n/***/ }),\n\n/***/ "./src/streaming/text/NotFragmentedTextBufferController.js":\n/*!*****************************************************************!*\\\n !*** ./src/streaming/text/NotFragmentedTextBufferController.js ***!\n \\*****************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2274900__) {\n__nested_webpack_require_2274900__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2274900__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2274900__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2274900__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _utils_InitCache__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2274900__(/*! ../utils/InitCache */ "./src/streaming/utils/InitCache.js");\n/* harmony import */ var _SourceBufferSink__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2274900__(/*! ../SourceBufferSink */ "./src/streaming/SourceBufferSink.js");\n/* harmony import */ var _streaming_vo_DashJSError__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2274900__(/*! ../../streaming/vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2274900__(/*! ../../core/errors/Errors */ "./src/core/errors/Errors.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\nvar BUFFER_CONTROLLER_TYPE = \'NotFragmentedTextBufferController\';\n\nfunction NotFragmentedTextBufferController(config) {\n config = config || {};\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n var textController = config.textController;\n var errHandler = config.errHandler;\n var streamInfo = config.streamInfo;\n var type = config.type;\n var instance, isBufferingCompleted, initialized, mediaSource, sourceBufferSink, initCache;\n\n function setup() {\n initialized = false;\n mediaSource = null;\n isBufferingCompleted = false;\n initCache = Object(_utils_InitCache__WEBPACK_IMPORTED_MODULE_3__["default"])(context).getInstance();\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].INIT_FRAGMENT_LOADED, _onInitFragmentLoaded, instance);\n }\n\n function getBufferControllerType() {\n return BUFFER_CONTROLLER_TYPE;\n }\n\n function initialize(source) {\n setMediaSource(source);\n }\n\n function createBufferSink(mediaInfo) {\n return new Promise(function (resolve, reject) {\n try {\n sourceBufferSink = Object(_SourceBufferSink__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create({\n mediaSource: mediaSource,\n textController: textController,\n eventBus: eventBus\n });\n sourceBufferSink.initializeForFirstUse(streamInfo, mediaInfo);\n\n if (!initialized) {\n if (sourceBufferSink.getBuffer() && typeof sourceBufferSink.getBuffer().initialize === \'function\') {\n sourceBufferSink.getBuffer().initialize();\n }\n\n initialized = true;\n }\n\n resolve(sourceBufferSink);\n } catch (e) {\n errHandler.error(new _streaming_vo_DashJSError__WEBPACK_IMPORTED_MODULE_5__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIASOURCE_TYPE_UNSUPPORTED_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_6__["default"].MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE + type));\n reject(e);\n }\n });\n }\n\n function getStreamId() {\n return streamInfo.id;\n }\n\n function getType() {\n return type;\n }\n\n function getBuffer() {\n return sourceBufferSink;\n }\n\n function setMediaSource(value) {\n mediaSource = value;\n }\n\n function getMediaSource() {\n return mediaSource;\n }\n\n function getIsPruningInProgress() {\n return false;\n }\n\n function getBufferLevel() {\n return 0;\n }\n\n function getIsBufferingCompleted() {\n return isBufferingCompleted;\n }\n\n function setIsBufferingCompleted(value) {\n if (isBufferingCompleted === value) {\n return;\n }\n\n isBufferingCompleted = value;\n\n if (isBufferingCompleted) {\n triggerEvent(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].BUFFERING_COMPLETED);\n }\n }\n\n function reset(errored) {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].INIT_FRAGMENT_LOADED, _onInitFragmentLoaded, instance);\n\n if (!errored && sourceBufferSink) {\n sourceBufferSink.abort();\n sourceBufferSink.reset();\n sourceBufferSink = null;\n }\n }\n\n function appendInitSegmentFromCache(representationId) {\n // If text data file already in cache then no need to append it again\n return initCache.extract(streamInfo.id, representationId) !== null;\n }\n\n function _onInitFragmentLoaded(e) {\n if (!e.chunk.bytes || isBufferingCompleted) return;\n initCache.save(e.chunk);\n sourceBufferSink.append(e.chunk);\n setIsBufferingCompleted(true);\n }\n\n function getRangeAt() {\n return null;\n }\n\n function getAllRangesWithSafetyFactor() {\n return [];\n }\n\n function getContinuousBufferTimeForTargetTime() {\n return Number.POSITIVE_INFINITY;\n }\n\n function clearBuffers() {\n return Promise.resolve();\n }\n\n function updateBufferTimestampOffset() {\n return Promise.resolve();\n }\n\n function prepareForPlaybackSeek() {\n return Promise.resolve();\n }\n\n function prepareForReplacementTrackSwitch() {\n isBufferingCompleted = false;\n return Promise.resolve();\n }\n\n function updateAppendWindow() {\n return Promise.resolve();\n }\n\n function setSeekTarget() {}\n\n function segmentRequestingCompleted() {}\n\n function pruneAllSafely() {\n return Promise.resolve();\n }\n\n function triggerEvent(eventType, data) {\n var payload = data || {};\n eventBus.trigger(eventType, payload, {\n streamId: streamInfo.id,\n mediaType: type\n });\n }\n\n instance = {\n initialize: initialize,\n getStreamId: getStreamId,\n getType: getType,\n getBufferControllerType: getBufferControllerType,\n createBufferSink: createBufferSink,\n getBuffer: getBuffer,\n getBufferLevel: getBufferLevel,\n getRangeAt: getRangeAt,\n getAllRangesWithSafetyFactor: getAllRangesWithSafetyFactor,\n getContinuousBufferTimeForTargetTime: getContinuousBufferTimeForTargetTime,\n setMediaSource: setMediaSource,\n getMediaSource: getMediaSource,\n appendInitSegmentFromCache: appendInitSegmentFromCache,\n getIsBufferingCompleted: getIsBufferingCompleted,\n setIsBufferingCompleted: setIsBufferingCompleted,\n getIsPruningInProgress: getIsPruningInProgress,\n reset: reset,\n clearBuffers: clearBuffers,\n prepareForPlaybackSeek: prepareForPlaybackSeek,\n prepareForReplacementTrackSwitch: prepareForReplacementTrackSwitch,\n setSeekTarget: setSeekTarget,\n updateAppendWindow: updateAppendWindow,\n pruneAllSafely: pruneAllSafely,\n updateBufferTimestampOffset: updateBufferTimestampOffset,\n segmentRequestingCompleted: segmentRequestingCompleted\n };\n setup();\n return instance;\n}\n\nNotFragmentedTextBufferController.__dashjs_factory_name = BUFFER_CONTROLLER_TYPE;\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getClassFactory(NotFragmentedTextBufferController));\n\n/***/ }),\n\n/***/ "./src/streaming/text/TextController.js":\n/*!**********************************************!*\\\n !*** ./src/streaming/text/TextController.js ***!\n \\**********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2284102__) {\n__nested_webpack_require_2284102__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2284102__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2284102__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _TextSourceBuffer__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2284102__(/*! ./TextSourceBuffer */ "./src/streaming/text/TextSourceBuffer.js");\n/* harmony import */ var _TextTracks__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2284102__(/*! ./TextTracks */ "./src/streaming/text/TextTracks.js");\n/* harmony import */ var _utils_VTTParser__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2284102__(/*! ../utils/VTTParser */ "./src/streaming/utils/VTTParser.js");\n/* harmony import */ var _utils_TTMLParser__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2284102__(/*! ../utils/TTMLParser */ "./src/streaming/utils/TTMLParser.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2284102__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_2284102__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_2284102__(/*! ../../streaming/MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_2284102__(/*! ../utils/SupervisorTools */ "./src/streaming/utils/SupervisorTools.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\nfunction TextController(config) {\n var context = this.context;\n var adapter = config.adapter;\n var errHandler = config.errHandler;\n var manifestModel = config.manifestModel;\n var mediaController = config.mediaController;\n var videoModel = config.videoModel;\n var settings = config.settings;\n var instance, streamData, textSourceBuffers, textTracks, vttParser, ttmlParser, eventBus, defaultSettings, initialSettingsSet, allTracksAreDisabled, forceTextStreaming, textTracksAdded, disableTextBeforeTextTracksAdded;\n\n function setup() {\n defaultSettings = null;\n forceTextStreaming = false;\n textTracksAdded = false;\n initialSettingsSet = false;\n disableTextBeforeTextTracksAdded = false;\n vttParser = Object(_utils_VTTParser__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n ttmlParser = Object(_utils_TTMLParser__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance();\n eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_6__["default"])(context).getInstance();\n resetInitialSettings();\n }\n\n function initialize() {\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_7__["default"].CURRENT_TRACK_CHANGED, _onCurrentTrackChanged, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_7__["default"].TEXT_TRACKS_QUEUE_INITIALIZED, _onTextTracksAdded, instance);\n }\n\n function initializeForStream(streamInfo) {\n var streamId = streamInfo.id;\n var tracks = Object(_TextTracks__WEBPACK_IMPORTED_MODULE_3__["default"])(context).create({\n videoModel: videoModel,\n streamInfo: streamInfo\n });\n tracks.initialize();\n textTracks[streamId] = tracks;\n var textSourceBuffer = Object(_TextSourceBuffer__WEBPACK_IMPORTED_MODULE_2__["default"])(context).create({\n errHandler: errHandler,\n adapter: adapter,\n manifestModel: manifestModel,\n mediaController: mediaController,\n videoModel: videoModel,\n textTracks: tracks,\n vttParser: vttParser,\n ttmlParser: ttmlParser,\n streamInfo: streamInfo\n });\n textSourceBuffer.initialize();\n textSourceBuffers[streamId] = textSourceBuffer;\n streamData[streamId] = {};\n streamData[streamId].lastEnabledIndex = -1;\n }\n /**\n * All media infos have been added. Start creating the track objects\n * @param {object} streamInfo\n */\n\n\n function createTracks(streamInfo) {\n var streamId = streamInfo.id;\n\n if (!textTracks[streamId]) {\n return;\n }\n\n textTracks[streamId].createTracks();\n }\n /**\n * Adds the new mediaInfo objects to the textSourceBuffer.\n * @param {object} streamInfo\n * @param {array} mInfos\n * @param {string|null} mimeType\n * @param {object} fragmentModel\n */\n\n\n function addMediaInfosToBuffer(streamInfo, type, mInfos) {\n var fragmentModel = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n var streamId = streamInfo.id;\n\n if (!textSourceBuffers[streamId]) {\n return;\n }\n\n textSourceBuffers[streamId].addMediaInfos(type, mInfos, fragmentModel);\n }\n\n function getTextSourceBuffer(streamInfo) {\n var streamId = streamInfo.id;\n\n if (textSourceBuffers && textSourceBuffers[streamId]) {\n return textSourceBuffers[streamId];\n }\n }\n\n function getAllTracksAreDisabled() {\n return allTracksAreDisabled;\n }\n\n function addEmbeddedTrack(streamInfo, mediaInfo) {\n var streamId = streamInfo.id;\n\n if (!textSourceBuffers[streamId]) {\n return;\n }\n\n textSourceBuffers[streamId].addEmbeddedTrack(mediaInfo);\n }\n\n function setInitialSettings(settings) {\n defaultSettings = settings;\n initialSettingsSet = true;\n }\n\n function _onTextTracksAdded(e) {\n var tracks = e.tracks;\n var index = e.index;\n var streamId = e.streamId;\n var textDefaultEnabled = settings.get().streaming.text.defaultEnabled;\n\n if (textDefaultEnabled === false && !isTextEnabled() || disableTextBeforeTextTracksAdded) {\n // disable text at startup if explicitly configured with setTextDefaultEnabled(false) or if there is no defaultSettings (configuration or from domStorage)\n setTextTrack(streamId, -1);\n } else {\n if (defaultSettings) {\n tracks.some(function (item, idx) {\n // matchSettings is compatible with setTextDefaultLanguage and setInitialSettings\n if (mediaController.matchSettings(defaultSettings, item)) {\n setTextTrack(streamId, idx);\n index = idx;\n return true;\n }\n });\n }\n\n allTracksAreDisabled = false;\n }\n\n streamData[streamId].lastEnabledIndex = index;\n eventBus.trigger(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_8__["default"].TEXT_TRACKS_ADDED, {\n enabled: isTextEnabled(),\n index: index,\n tracks: tracks,\n streamId: streamId\n });\n textTracksAdded = true;\n }\n\n function _onCurrentTrackChanged(event) {\n if (!initialSettingsSet && event && event.newMediaInfo) {\n var mediaInfo = event.newMediaInfo;\n\n if (mediaInfo.type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT) {\n defaultSettings = {\n lang: mediaInfo.lang,\n role: mediaInfo.roles[0],\n index: mediaInfo.index,\n codec: mediaInfo.codec,\n accessibility: mediaInfo.accessibility[0]\n };\n }\n }\n }\n\n function enableText(streamId, enable) {\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_9__["checkParameterType"])(enable, \'boolean\');\n\n if (isTextEnabled() !== enable) {\n // change track selection\n if (enable) {\n // apply last enabled track\n setTextTrack(streamId, streamData[streamId].lastEnabledIndex);\n }\n\n if (!enable) {\n // keep last index and disable text track\n streamData[streamId].lastEnabledIndex = getCurrentTrackIdx(streamId);\n\n if (!textTracksAdded) {\n disableTextBeforeTextTracksAdded = true;\n } else {\n setTextTrack(streamId, -1);\n }\n }\n }\n }\n\n function isTextEnabled() {\n var enabled = true;\n\n if (allTracksAreDisabled && !forceTextStreaming) {\n enabled = false;\n }\n\n return enabled;\n } // when set to true ScheduleController will allow schedule of chunks even if tracks are all disabled. Allowing streaming to hidden track for external players to work with.\n\n\n function enableForcedTextStreaming(enable) {\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_9__["checkParameterType"])(enable, \'boolean\');\n forceTextStreaming = enable;\n }\n\n function setTextTrack(streamId, idx) {\n // For external time text file, the only action needed to change a track is marking the track mode to showing.\n // Fragmented text tracks need the additional step of calling TextController.setTextTrack();\n allTracksAreDisabled = idx === -1;\n\n if (allTracksAreDisabled && mediaController) {\n mediaController.saveTextSettingsDisabled();\n }\n\n var oldTrackIdx = getCurrentTrackIdx(streamId); // No change, no action required\n\n if (oldTrackIdx === idx || !textTracks[streamId]) {\n return;\n }\n\n textTracks[streamId].setModeForTrackIdx(oldTrackIdx, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT_HIDDEN);\n textTracks[streamId].setCurrentTrackIdx(idx);\n textTracks[streamId].setModeForTrackIdx(idx, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT_SHOWING);\n var currentTrackInfo = textTracks[streamId].getCurrentTrackInfo();\n\n if (currentTrackInfo && currentTrackInfo.isFragmented && !currentTrackInfo.isEmbedded) {\n _setFragmentedTextTrack(streamId, currentTrackInfo, oldTrackIdx);\n } else if (currentTrackInfo && !currentTrackInfo.isFragmented) {\n _setNonFragmentedTextTrack(streamId, currentTrackInfo);\n }\n\n mediaController.setTrack(currentTrackInfo);\n }\n\n function _setFragmentedTextTrack(streamId, currentTrackInfo, oldTrackIdx) {\n if (!textSourceBuffers[streamId]) {\n return;\n }\n\n var config = textSourceBuffers[streamId].getConfig();\n var fragmentedTracks = config.fragmentedTracks;\n\n for (var i = 0; i < fragmentedTracks.length; i++) {\n var mediaInfo = fragmentedTracks[i];\n\n if (currentTrackInfo.lang === mediaInfo.lang && (mediaInfo.id ? currentTrackInfo.id === mediaInfo.id : currentTrackInfo.index === mediaInfo.index)) {\n var currentFragTrack = mediaController.getCurrentTrackFor(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT, streamId);\n\n if (mediaInfo.id ? currentFragTrack.id !== mediaInfo.id : currentFragTrack.index !== mediaInfo.index) {\n textTracks[streamId].deleteCuesFromTrackIdx(oldTrackIdx);\n textSourceBuffers[streamId].setCurrentFragmentedTrackIdx(i);\n } else if (oldTrackIdx === -1) {\n // in fragmented use case, if the user selects the older track (the one selected before disabled text track)\n // no CURRENT_TRACK_CHANGED event will be triggered because the mediaInfo in the StreamProcessor is equal to the one we are selecting\n // For that reason we reactivate the StreamProcessor and the ScheduleController\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_7__["default"].SET_FRAGMENTED_TEXT_AFTER_DISABLED, {}, {\n streamId: streamId,\n mediaType: _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT\n });\n }\n }\n }\n }\n\n function _setNonFragmentedTextTrack(streamId, currentTrackInfo) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_7__["default"].SET_NON_FRAGMENTED_TEXT, {\n currentTrackInfo: currentTrackInfo\n }, {\n streamId: streamId,\n mediaType: _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT\n });\n }\n\n function getCurrentTrackIdx(streamId) {\n return textTracks[streamId].getCurrentTrackIdx();\n }\n\n function deactivateStream(streamInfo) {\n if (!streamInfo) {\n return;\n }\n\n var streamId = streamInfo.id;\n\n if (textSourceBuffers[streamId]) {\n textSourceBuffers[streamId].resetMediaInfos();\n }\n\n if (textTracks[streamId]) {\n textTracks[streamId].deleteAllTextTracks();\n }\n }\n\n function resetInitialSettings() {\n textSourceBuffers = {};\n textTracks = {};\n streamData = {};\n allTracksAreDisabled = true;\n textTracksAdded = false;\n disableTextBeforeTextTracksAdded = false;\n }\n\n function reset() {\n resetInitialSettings();\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_7__["default"].CURRENT_TRACK_CHANGED, _onCurrentTrackChanged, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_7__["default"].TEXT_TRACKS_QUEUE_INITIALIZED, _onTextTracksAdded, instance);\n Object.keys(textSourceBuffers).forEach(function (key) {\n textSourceBuffers[key].resetEmbedded();\n textSourceBuffers[key].reset();\n });\n }\n\n instance = {\n deactivateStream: deactivateStream,\n initialize: initialize,\n initializeForStream: initializeForStream,\n createTracks: createTracks,\n getTextSourceBuffer: getTextSourceBuffer,\n getAllTracksAreDisabled: getAllTracksAreDisabled,\n addEmbeddedTrack: addEmbeddedTrack,\n setInitialSettings: setInitialSettings,\n enableText: enableText,\n isTextEnabled: isTextEnabled,\n setTextTrack: setTextTrack,\n getCurrentTrackIdx: getCurrentTrackIdx,\n enableForcedTextStreaming: enableForcedTextStreaming,\n addMediaInfosToBuffer: addMediaInfosToBuffer,\n reset: reset\n };\n setup();\n return instance;\n}\n\nTextController.__dashjs_factory_name = \'TextController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"].getClassFactory(TextController));\n\n/***/ }),\n\n/***/ "./src/streaming/text/TextSourceBuffer.js":\n/*!************************************************!*\\\n !*** ./src/streaming/text/TextSourceBuffer.js ***!\n \\************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2299688__) {\n__nested_webpack_require_2299688__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2299688__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2299688__(/*! ../vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\n/* harmony import */ var _vo_TextTrackInfo__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2299688__(/*! ../vo/TextTrackInfo */ "./src/streaming/vo/TextTrackInfo.js");\n/* harmony import */ var _utils_BoxParser__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2299688__(/*! ../utils/BoxParser */ "./src/streaming/utils/BoxParser.js");\n/* harmony import */ var _utils_CustomTimeRanges__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2299688__(/*! ../utils/CustomTimeRanges */ "./src/streaming/utils/CustomTimeRanges.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2299688__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2299688__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _EmbeddedTextHtmlRender__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_2299688__(/*! ./EmbeddedTextHtmlRender */ "./src/streaming/text/EmbeddedTextHtmlRender.js");\n/* harmony import */ var codem_isoboxer__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_2299688__(/*! codem-isoboxer */ "./node_modules/codem-isoboxer/dist/iso_boxer.js");\n/* harmony import */ var codem_isoboxer__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__nested_webpack_require_2299688__.n(codem_isoboxer__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _externals_cea608_parser__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_2299688__(/*! ../../../externals/cea608-parser */ "./externals/cea608-parser.js");\n/* harmony import */ var _externals_cea608_parser__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__nested_webpack_require_2299688__.n(_externals_cea608_parser__WEBPACK_IMPORTED_MODULE_9__);\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_10__ = __nested_webpack_require_2299688__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_11__ = __nested_webpack_require_2299688__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_12__ = __nested_webpack_require_2299688__(/*! ../vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_13__ = __nested_webpack_require_2299688__(/*! ../../core/errors/Errors */ "./src/core/errors/Errors.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction TextSourceBuffer(config) {\n var errHandler = config.errHandler;\n var manifestModel = config.manifestModel;\n var mediaController = config.mediaController;\n var videoModel = config.videoModel;\n var textTracks = config.textTracks;\n var vttParser = config.vttParser;\n var ttmlParser = config.ttmlParser;\n var streamInfo = config.streamInfo;\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_10__["default"])(context).getInstance();\n var embeddedInitialized = false;\n var instance, logger, boxParser, parser, mediaInfos, fragmentModel, initializationSegmentReceived, timescale, fragmentedTracks, firstFragmentedSubtitleStart, currFragmentedTrackIdx, embeddedTracks, embeddedTimescale, embeddedLastSequenceNumber, embeddedCea608FieldParsers, embeddedTextHtmlRender;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_6__["default"])(context).getInstance().getLogger(instance);\n boxParser = Object(_utils_BoxParser__WEBPACK_IMPORTED_MODULE_3__["default"])(context).getInstance();\n resetInitialSettings();\n }\n\n function getStreamId() {\n return streamInfo.id;\n }\n\n function _resetFragmented() {\n fragmentModel = null;\n timescale = NaN;\n fragmentedTracks = [];\n firstFragmentedSubtitleStart = null;\n initializationSegmentReceived = false;\n }\n\n function resetInitialSettings() {\n _resetFragmented();\n\n mediaInfos = [];\n parser = null;\n }\n\n function initialize() {\n if (!embeddedInitialized) {\n _initEmbedded();\n }\n }\n /**\n * There might be media infos of different types. For instance text and fragmentedText.\n * @param {string} type\n * @param {array} mInfos\n * @param {object} fModel\n */\n\n\n function addMediaInfos(type, mInfos, fModel) {\n mediaInfos = mediaInfos.concat(mInfos);\n\n if (type === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT && mInfos[0].isFragmented && !mInfos[0].isEmbedded) {\n fragmentModel = fModel;\n instance.buffered = Object(_utils_CustomTimeRanges__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create();\n fragmentedTracks = mediaController.getTracksFor(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT, streamInfo.id).filter(function (track) {\n return track.isFragmented;\n });\n var currFragTrack = mediaController.getCurrentTrackFor(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT, streamInfo.id);\n\n for (var i = 0; i < fragmentedTracks.length; i++) {\n if (fragmentedTracks[i] === currFragTrack) {\n setCurrentFragmentedTrackIdx(i);\n break;\n }\n }\n }\n\n for (var _i = 0; _i < mInfos.length; _i++) {\n _createTextTrackFromMediaInfo(mInfos[_i]);\n }\n }\n /**\n * Create a new track based on the mediaInfo information\n * @param {object} mediaInfo\n * @private\n */\n\n\n function _createTextTrackFromMediaInfo(mediaInfo) {\n var textTrackInfo = new _vo_TextTrackInfo__WEBPACK_IMPORTED_MODULE_2__["default"]();\n var trackKindMap = {\n subtitle: \'subtitles\',\n caption: \'captions\'\n }; //Dash Spec has no "s" on end of KIND but HTML needs plural.\n\n for (var key in mediaInfo) {\n textTrackInfo[key] = mediaInfo[key];\n }\n\n textTrackInfo.labels = mediaInfo.labels;\n textTrackInfo.defaultTrack = getIsDefault(mediaInfo);\n textTrackInfo.isFragmented = mediaInfo.isFragmented;\n textTrackInfo.isEmbedded = !!mediaInfo.isEmbedded;\n textTrackInfo.isTTML = _checkTtml(mediaInfo);\n textTrackInfo.kind = _getKind(mediaInfo, trackKindMap);\n textTracks.addTextTrack(textTrackInfo);\n }\n\n function abort() {}\n\n function reset() {\n resetInitialSettings();\n mediaInfos = [];\n boxParser = null;\n }\n\n function _onVideoChunkReceived(e) {\n var chunk = e.chunk;\n\n if (chunk.mediaInfo.embeddedCaptions) {\n append(chunk.bytes, chunk);\n }\n }\n\n function _initEmbedded() {\n embeddedTracks = [];\n currFragmentedTrackIdx = null;\n embeddedTimescale = 0;\n embeddedCea608FieldParsers = [];\n embeddedLastSequenceNumber = null;\n embeddedInitialized = true;\n embeddedTextHtmlRender = Object(_EmbeddedTextHtmlRender__WEBPACK_IMPORTED_MODULE_7__["default"])(context).getInstance();\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].VIDEO_CHUNK_RECEIVED, _onVideoChunkReceived, instance);\n eventBus.on(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFER_CLEARED, onVideoBufferCleared, instance);\n }\n\n function resetEmbedded() {\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].VIDEO_CHUNK_RECEIVED, _onVideoChunkReceived, instance);\n eventBus.off(_core_events_Events__WEBPACK_IMPORTED_MODULE_11__["default"].BUFFER_CLEARED, onVideoBufferCleared, instance);\n\n if (textTracks) {\n textTracks.deleteAllTextTracks();\n }\n\n embeddedInitialized = false;\n embeddedTracks = [];\n embeddedCea608FieldParsers = [null, null];\n embeddedLastSequenceNumber = null;\n }\n\n function addEmbeddedTrack(mediaInfo) {\n if (!embeddedInitialized) {\n return;\n }\n\n if (mediaInfo) {\n if (mediaInfo.id === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].CC1 || mediaInfo.id === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].CC3) {\n for (var i = 0; i < embeddedTracks.length; i++) {\n if (embeddedTracks[i].id === mediaInfo.id) {\n return;\n }\n }\n\n embeddedTracks.push(mediaInfo);\n } else {\n logger.warn(\'Embedded track \' + mediaInfo.id + \' not supported!\');\n }\n }\n }\n\n function getConfig() {\n var config = {\n fragmentModel: fragmentModel,\n fragmentedTracks: fragmentedTracks,\n videoModel: videoModel\n };\n return config;\n }\n\n function setCurrentFragmentedTrackIdx(idx) {\n currFragmentedTrackIdx = idx;\n }\n\n function _checkTtml(mediaInfo) {\n return mediaInfo.codec && mediaInfo.codec.search(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].STPP) >= 0 || mediaInfo.mimeType && mediaInfo.mimeType.search(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TTML) >= 0;\n }\n\n function _getKind(mediaInfo, trackKindMap) {\n var kind = mediaInfo.roles && mediaInfo.roles.length > 0 ? trackKindMap[mediaInfo.roles[0]] : trackKindMap.caption;\n kind = kind === trackKindMap.caption || kind === trackKindMap.subtitle ? kind : trackKindMap.caption;\n return kind;\n }\n\n function append(bytes, chunk) {\n var mediaInfo = chunk.mediaInfo;\n var mediaType = mediaInfo.type;\n var mimeType = mediaInfo.mimeType;\n var codecType = mediaInfo.codec || mimeType;\n\n if (!codecType) {\n logger.error(\'No text type defined\');\n return;\n }\n\n if (mediaInfo.codec.indexOf(\'application/mp4\') !== -1) {\n _appendFragmentedText(bytes, chunk, codecType);\n } else if (mediaType === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO) {\n _appendEmbeddedText(bytes, chunk);\n } else {\n _appendText(bytes, chunk, codecType);\n }\n }\n\n function _appendFragmentedText(bytes, chunk, codecType) {\n var sampleList, samplesInfo;\n\n if (chunk.segmentType === \'InitializationSegment\') {\n initializationSegmentReceived = true;\n timescale = boxParser.getMediaTimescaleFromMoov(bytes);\n } else {\n if (!initializationSegmentReceived) {\n return;\n }\n\n samplesInfo = boxParser.getSamplesInfo(bytes);\n sampleList = samplesInfo.sampleList;\n\n if (sampleList.length > 0) {\n firstFragmentedSubtitleStart = sampleList[0].cts - chunk.start * timescale;\n }\n\n if (codecType.search(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].STPP) >= 0) {\n _appendFragmentedSttp(bytes, sampleList, codecType);\n } else {\n _appendFragmentedWebVtt(bytes, sampleList);\n }\n }\n }\n\n function _appendFragmentedSttp(bytes, sampleList, codecType) {\n var i, j;\n parser = parser !== null ? parser : getParser(codecType);\n\n for (i = 0; i < sampleList.length; i++) {\n var sample = sampleList[i];\n var sampleStart = sample.cts;\n\n var timestampOffset = _getTimestampOffset();\n\n var start = timestampOffset + sampleStart / timescale;\n var end = start + sample.duration / timescale;\n instance.buffered.add(start, end);\n var dataView = new DataView(bytes, sample.offset, sample.subSizes[0]);\n var ccContent = codem_isoboxer__WEBPACK_IMPORTED_MODULE_8___default.a.Utils.dataViewToString(dataView, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].UTF8);\n var images = [];\n var subOffset = sample.offset + sample.subSizes[0];\n\n for (j = 1; j < sample.subSizes.length; j++) {\n var inData = new Uint8Array(bytes, subOffset, sample.subSizes[j]);\n var raw = String.fromCharCode.apply(null, inData);\n images.push(raw);\n subOffset += sample.subSizes[j];\n }\n\n try {\n var manifest = manifestModel.getValue(); // Only used for Miscrosoft Smooth Streaming support - caption time is relative to sample time. In this case, we apply an offset.\n\n var offsetTime = manifest.ttmlTimeIsRelative ? sampleStart / timescale : 0;\n var result = parser.parse(ccContent, offsetTime, sampleStart / timescale, (sampleStart + sample.duration) / timescale, images);\n textTracks.addCaptions(currFragmentedTrackIdx, timestampOffset, result);\n } catch (e) {\n fragmentModel.removeExecutedRequestsBeforeTime();\n this.remove();\n logger.error(\'TTML parser error: \' + e.message);\n }\n }\n }\n\n function _appendFragmentedWebVtt(bytes, sampleList) {\n var i, j, k;\n var captionArray = [];\n\n for (i = 0; i < sampleList.length; i++) {\n var sample = sampleList[i];\n sample.cts -= firstFragmentedSubtitleStart;\n\n var timestampOffset = _getTimestampOffset();\n\n var start = timestampOffset + sample.cts / timescale;\n var end = start + sample.duration / timescale;\n instance.buffered.add(start, end);\n var sampleData = bytes.slice(sample.offset, sample.offset + sample.size); // There are boxes inside the sampleData, so we need a ISOBoxer to get at it.\n\n var sampleBoxes = codem_isoboxer__WEBPACK_IMPORTED_MODULE_8___default.a.parseBuffer(sampleData);\n\n for (j = 0; j < sampleBoxes.boxes.length; j++) {\n var box1 = sampleBoxes.boxes[j];\n logger.debug(\'VTT box1: \' + box1.type);\n\n if (box1.type === \'vtte\') {\n continue; //Empty box\n }\n\n if (box1.type === \'vttc\') {\n logger.debug(\'VTT vttc boxes.length = \' + box1.boxes.length);\n\n for (k = 0; k < box1.boxes.length; k++) {\n var box2 = box1.boxes[k];\n logger.debug(\'VTT box2: \' + box2.type);\n\n if (box2.type === \'payl\') {\n var cue_text = box2.cue_text;\n logger.debug(\'VTT cue_text = \' + cue_text);\n var start_time = sample.cts / timescale;\n var end_time = (sample.cts + sample.duration) / timescale;\n captionArray.push({\n start: start_time,\n end: end_time,\n data: cue_text,\n styles: {}\n });\n logger.debug(\'VTT \' + start_time + \'-\' + end_time + \' : \' + cue_text);\n }\n }\n }\n }\n }\n\n if (captionArray.length > 0) {\n textTracks.addCaptions(currFragmentedTrackIdx, 0, captionArray);\n }\n }\n\n function _appendText(bytes, chunk, codecType) {\n var result, ccContent;\n var dataView = new DataView(bytes, 0, bytes.byteLength);\n ccContent = codem_isoboxer__WEBPACK_IMPORTED_MODULE_8___default.a.Utils.dataViewToString(dataView, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].UTF8);\n\n try {\n result = getParser(codecType).parse(ccContent, 0);\n textTracks.addCaptions(textTracks.getCurrentTrackIdx(), 0, result);\n\n if (instance.buffered) {\n instance.buffered.add(chunk.start, chunk.end);\n }\n } catch (e) {\n errHandler.error(new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_12__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_13__["default"].TIMED_TEXT_ERROR_ID_PARSE_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_13__["default"].TIMED_TEXT_ERROR_MESSAGE_PARSE + e.message, ccContent));\n }\n }\n\n function _appendEmbeddedText(bytes, chunk) {\n var i, samplesInfo; // Init segment\n\n if (chunk.segmentType === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_1__["HTTPRequest"].INIT_SEGMENT_TYPE) {\n if (embeddedTimescale === 0) {\n embeddedTimescale = boxParser.getMediaTimescaleFromMoov(bytes);\n }\n } // MediaSegment\n else if (chunk.segmentType === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_1__["HTTPRequest"].MEDIA_SEGMENT_TYPE) {\n if (embeddedTimescale === 0) {\n logger.warn(\'CEA-608: No timescale for embeddedTextTrack yet\');\n return;\n }\n\n samplesInfo = boxParser.getSamplesInfo(bytes);\n var sequenceNumber = samplesInfo.lastSequenceNumber;\n\n if (!embeddedCea608FieldParsers[0] && !embeddedCea608FieldParsers[1]) {\n _setupCeaParser();\n }\n\n if (embeddedTimescale) {\n if (embeddedLastSequenceNumber !== null && sequenceNumber !== embeddedLastSequenceNumber + samplesInfo.numSequences) {\n for (i = 0; i < embeddedCea608FieldParsers.length; i++) {\n if (embeddedCea608FieldParsers[i]) {\n embeddedCea608FieldParsers[i].reset();\n }\n }\n }\n\n var allCcData = _extractCea608Data(bytes, samplesInfo.sampleList);\n\n for (var fieldNr = 0; fieldNr < embeddedCea608FieldParsers.length; fieldNr++) {\n var ccData = allCcData.fields[fieldNr];\n var fieldParser = embeddedCea608FieldParsers[fieldNr];\n\n if (fieldParser) {\n for (i = 0; i < ccData.length; i++) {\n fieldParser.addData(ccData[i][0] / embeddedTimescale, ccData[i][1]);\n }\n }\n }\n\n embeddedLastSequenceNumber = sequenceNumber;\n }\n }\n }\n\n function _setupCeaParser() {\n // Time to setup the CEA-608 parsing\n var trackIdx;\n\n for (var i = 0; i < embeddedTracks.length; i++) {\n trackIdx = textTracks.getTrackIdxForId(embeddedTracks[i].id);\n\n if (trackIdx === -1) {\n logger.warn(\'CEA-608: data before track is ready.\');\n return;\n }\n\n var handler = _makeCueAdderForIndex(trackIdx);\n\n embeddedCea608FieldParsers[i] = new _externals_cea608_parser__WEBPACK_IMPORTED_MODULE_9___default.a.Cea608Parser(i + 1, {\n newCue: handler\n }, null);\n }\n }\n\n function _makeCueAdderForIndex(trackIndex) {\n function newCue(startTime, endTime, captionScreen) {\n var captionsArray;\n\n if (videoModel.getTTMLRenderingDiv()) {\n captionsArray = embeddedTextHtmlRender.createHTMLCaptionsFromScreen(videoModel.getElement(), startTime, endTime, captionScreen);\n } else {\n var text = captionScreen.getDisplayText();\n captionsArray = [{\n start: startTime,\n end: endTime,\n data: text,\n styles: {}\n }];\n }\n\n if (captionsArray) {\n textTracks.addCaptions(trackIndex, 0, captionsArray);\n }\n }\n\n return newCue;\n }\n /**\n * Extract CEA-608 data from a buffer of data.\n * @param {ArrayBuffer} data\n * @param {Array} samples cue information\n * @returns {Object|null} ccData corresponding to one segment.\n */\n\n\n function _extractCea608Data(data, samples) {\n if (samples.length === 0) {\n return null;\n }\n\n var allCcData = {\n splits: [],\n fields: [[], []]\n };\n var raw = new DataView(data);\n\n for (var i = 0; i < samples.length; i++) {\n var sample = samples[i];\n var cea608Ranges = _externals_cea608_parser__WEBPACK_IMPORTED_MODULE_9___default.a.findCea608Nalus(raw, sample.offset, sample.size);\n var lastSampleTime = null;\n var idx = 0;\n\n for (var j = 0; j < cea608Ranges.length; j++) {\n var ccData = _externals_cea608_parser__WEBPACK_IMPORTED_MODULE_9___default.a.extractCea608DataFromRange(raw, cea608Ranges[j]);\n\n for (var k = 0; k < 2; k++) {\n if (ccData[k].length > 0) {\n if (sample.cts !== lastSampleTime) {\n idx = 0;\n } else {\n idx += 1;\n }\n\n var timestampOffset = _getTimestampOffset();\n\n allCcData.fields[k].push([sample.cts + timestampOffset * embeddedTimescale, ccData[k], idx]);\n lastSampleTime = sample.cts;\n }\n }\n }\n } // Sort by sampleTime ascending order\n // If two packets have the same sampleTime, use them in the order\n // they were received\n\n\n allCcData.fields.forEach(function sortField(field) {\n field.sort(function (a, b) {\n if (a[0] === b[0]) {\n return a[2] - b[2];\n }\n\n return a[0] - b[0];\n });\n });\n return allCcData;\n }\n\n function _getTimestampOffset() {\n return !isNaN(instance.timestampOffset) ? instance.timestampOffset : 0;\n }\n\n function getIsDefault(mediaInfo) {\n //TODO How to tag default. currently same order as listed in manifest.\n // Is there a way to mark a text adaptation set as the default one? DASHIF meeting talk about using role which is being used for track KIND\n // Eg subtitles etc. You can have multiple role tags per adaptation Not defined in the spec yet.\n var isDefault = false;\n\n if (embeddedTracks.length > 1 && mediaInfo.isEmbedded) {\n isDefault = mediaInfo.id && mediaInfo.id === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].CC1; // CC1 if both CC1 and CC3 exist\n } else if (embeddedTracks.length === 1) {\n if (mediaInfo.id && typeof mediaInfo.id === \'string\' && mediaInfo.id.substring(0, 2) === \'CC\') {\n // Either CC1 or CC3\n isDefault = true;\n }\n } else if (embeddedTracks.length === 0) {\n isDefault = mediaInfo.index === mediaInfos[0].index;\n }\n\n return isDefault;\n }\n\n function getParser(codecType) {\n var parser;\n\n if (codecType.search(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VTT) >= 0) {\n parser = vttParser;\n } else if (codecType.search(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TTML) >= 0 || codecType.search(_constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].STPP) >= 0) {\n parser = ttmlParser;\n }\n\n return parser;\n }\n\n function remove(start, end) {\n //if start and end are not defined, remove all\n if (start === undefined && start === end) {\n start = instance.buffered.start(0);\n end = instance.buffered.end(instance.buffered.length - 1);\n }\n\n instance.buffered.remove(start, end);\n textTracks.deleteCuesFromTrackIdx(currFragmentedTrackIdx, start, end);\n }\n\n function onVideoBufferCleared(e) {\n embeddedTracks.forEach(function (track) {\n var trackIdx = textTracks.getTrackIdxForId(track.id);\n\n if (trackIdx >= 0) {\n textTracks.deleteCuesFromTrackIdx(trackIdx, e.from, e.to);\n }\n });\n }\n\n function resetMediaInfos() {\n mediaInfos = [];\n }\n\n instance = {\n initialize: initialize,\n addMediaInfos: addMediaInfos,\n resetMediaInfos: resetMediaInfos,\n getStreamId: getStreamId,\n append: append,\n abort: abort,\n addEmbeddedTrack: addEmbeddedTrack,\n resetEmbedded: resetEmbedded,\n getConfig: getConfig,\n setCurrentFragmentedTrackIdx: setCurrentFragmentedTrackIdx,\n remove: remove,\n reset: reset\n };\n setup();\n return instance;\n}\n\nTextSourceBuffer.__dashjs_factory_name = \'TextSourceBuffer\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_5__["default"].getClassFactory(TextSourceBuffer));\n\n/***/ }),\n\n/***/ "./src/streaming/text/TextTracks.js":\n/*!******************************************!*\\\n !*** ./src/streaming/text/TextTracks.js ***!\n \\******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2324423__) {\n__nested_webpack_require_2324423__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2324423__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2324423__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2324423__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2324423__(/*! ../../streaming/MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2324423__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2324423__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var imsc__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2324423__(/*! imsc */ "./node_modules/imsc/src/main/js/main.js");\n/* harmony import */ var imsc__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__nested_webpack_require_2324423__.n(imsc__WEBPACK_IMPORTED_MODULE_6__);\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\nfunction TextTracks(config) {\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance();\n var videoModel = config.videoModel;\n var streamInfo = config.streamInfo;\n var instance, logger, Cue, textTrackQueue, nativeTrackElementArr, currentTrackIdx, actualVideoLeft, actualVideoTop, actualVideoWidth, actualVideoHeight, captionContainer, videoSizeCheckInterval, fullscreenAttribute, displayCCOnTop, previousISDState, topZIndex, resizeObserver;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_5__["default"])(context).getInstance().getLogger(instance);\n }\n\n function initialize() {\n if (typeof window === \'undefined\' || typeof navigator === \'undefined\') {\n return;\n }\n\n Cue = window.VTTCue || window.TextTrackCue;\n textTrackQueue = [];\n nativeTrackElementArr = [];\n currentTrackIdx = -1;\n actualVideoLeft = 0;\n actualVideoTop = 0;\n actualVideoWidth = 0;\n actualVideoHeight = 0;\n captionContainer = null;\n videoSizeCheckInterval = null;\n displayCCOnTop = false;\n topZIndex = 2147483647;\n previousISDState = null;\n\n if (document.fullscreenElement !== undefined) {\n fullscreenAttribute = \'fullscreenElement\'; // Standard and Edge\n } else if (document.webkitIsFullScreen !== undefined) {\n fullscreenAttribute = \'webkitIsFullScreen\'; // Chrome and Safari (and Edge)\n } else if (document.msFullscreenElement) {\n // IE11\n fullscreenAttribute = \'msFullscreenElement\';\n } else if (document.mozFullScreen) {\n // Firefox\n fullscreenAttribute = \'mozFullScreen\';\n }\n }\n\n function getStreamId() {\n return streamInfo.id;\n }\n\n function _createTrackForUserAgent(element) {\n var kind = element.kind;\n var label = element.id !== undefined ? element.id : element.lang;\n var lang = element.lang;\n var isTTML = element.isTTML;\n var isEmbedded = element.isEmbedded;\n var track = videoModel.addTextTrack(kind, label, lang, isTTML, isEmbedded);\n return track;\n }\n\n function addTextTrack(textTrackInfoVO) {\n textTrackQueue.push(textTrackInfoVO);\n }\n\n function createTracks() {\n //Sort in same order as in manifest\n textTrackQueue.sort(function (a, b) {\n return a.index - b.index;\n });\n captionContainer = videoModel.getTTMLRenderingDiv();\n var defaultIndex = -1;\n\n for (var i = 0; i < textTrackQueue.length; i++) {\n var track = _createTrackForUserAgent(textTrackQueue[i]); //used to remove tracks from video element when added manually\n\n\n nativeTrackElementArr.push(track);\n\n if (textTrackQueue[i].defaultTrack) {\n // track.default is an object property identifier that is a reserved word\n // The following jshint directive is used to suppressed the warning "Expected an identifier and instead saw \'default\' (a reserved word)"\n\n /*jshint -W024 */\n track["default"] = true;\n defaultIndex = i;\n }\n\n var textTrack = getTrackByIdx(i);\n\n if (textTrack) {\n //each time a track is created, its mode should be showing by default\n //sometime, it\'s not on Chrome\n textTrack.mode = _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT_SHOWING;\n\n if (captionContainer && (textTrackQueue[i].isTTML || textTrackQueue[i].isEmbedded)) {\n textTrack.renderingType = \'html\';\n } else {\n textTrack.renderingType = \'default\';\n }\n }\n\n addCaptions(i, 0, textTrackQueue[i].captionData);\n eventBus.trigger(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].TEXT_TRACK_ADDED);\n } //set current track index in textTrackQueue array\n\n\n setCurrentTrackIdx.call(this, defaultIndex);\n\n if (defaultIndex >= 0) {\n var onMetadataLoaded = function onMetadataLoaded() {\n var track = getTrackByIdx(defaultIndex);\n\n if (track && track.renderingType === \'html\') {\n checkVideoSize.call(this, track, true);\n }\n\n eventBus.off(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_METADATA_LOADED, onMetadataLoaded, this);\n };\n\n eventBus.on(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].PLAYBACK_METADATA_LOADED, onMetadataLoaded, this);\n\n for (var idx = 0; idx < textTrackQueue.length; idx++) {\n var videoTextTrack = getTrackByIdx(idx);\n\n if (videoTextTrack) {\n videoTextTrack.mode = idx === defaultIndex ? _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT_SHOWING : _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT_HIDDEN;\n }\n }\n }\n\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].TEXT_TRACKS_QUEUE_INITIALIZED, {\n index: currentTrackIdx,\n tracks: textTrackQueue,\n streamId: streamInfo.id\n });\n }\n\n function getVideoVisibleVideoSize(viewWidth, viewHeight, videoWidth, videoHeight, aspectRatio, use80Percent) {\n var viewAspectRatio = viewWidth / viewHeight;\n var videoAspectRatio = videoWidth / videoHeight;\n var videoPictureWidth = 0;\n var videoPictureHeight = 0;\n\n if (viewAspectRatio > videoAspectRatio) {\n videoPictureHeight = viewHeight;\n videoPictureWidth = videoPictureHeight / videoHeight * videoWidth;\n } else {\n videoPictureWidth = viewWidth;\n videoPictureHeight = videoPictureWidth / videoWidth * videoHeight;\n }\n\n var videoPictureXAspect = 0;\n var videoPictureYAspect = 0;\n var videoPictureWidthAspect = 0;\n var videoPictureHeightAspect = 0;\n var videoPictureAspect = videoPictureWidth / videoPictureHeight;\n\n if (videoPictureAspect > aspectRatio) {\n videoPictureHeightAspect = videoPictureHeight;\n videoPictureWidthAspect = videoPictureHeight * aspectRatio;\n } else {\n videoPictureWidthAspect = videoPictureWidth;\n videoPictureHeightAspect = videoPictureWidth / aspectRatio;\n }\n\n videoPictureXAspect = (viewWidth - videoPictureWidthAspect) / 2;\n videoPictureYAspect = (viewHeight - videoPictureHeightAspect) / 2;\n\n if (use80Percent) {\n return {\n x: videoPictureXAspect + videoPictureWidthAspect * 0.1,\n y: videoPictureYAspect + videoPictureHeightAspect * 0.1,\n w: videoPictureWidthAspect * 0.8,\n h: videoPictureHeightAspect * 0.8\n };\n /* Maximal picture size in videos aspect ratio */\n } else {\n return {\n x: videoPictureXAspect,\n y: videoPictureYAspect,\n w: videoPictureWidthAspect,\n h: videoPictureHeightAspect\n };\n /* Maximal picture size in videos aspect ratio */\n }\n }\n\n function checkVideoSize(track, forceDrawing) {\n var clientWidth = videoModel.getClientWidth();\n var clientHeight = videoModel.getClientHeight();\n var videoWidth = videoModel.getVideoWidth();\n var videoHeight = videoModel.getVideoHeight();\n var videoOffsetTop = videoModel.getVideoRelativeOffsetTop();\n var videoOffsetLeft = videoModel.getVideoRelativeOffsetLeft();\n\n if (videoWidth !== 0 && videoHeight !== 0) {\n var aspectRatio = videoWidth / videoHeight;\n var use80Percent = false;\n\n if (track.isFromCEA608) {\n // If this is CEA608 then use predefined aspect ratio\n aspectRatio = 3.5 / 3.0;\n use80Percent = true;\n }\n\n var realVideoSize = getVideoVisibleVideoSize.call(this, clientWidth, clientHeight, videoWidth, videoHeight, aspectRatio, use80Percent);\n var newVideoWidth = realVideoSize.w;\n var newVideoHeight = realVideoSize.h;\n var newVideoLeft = realVideoSize.x;\n var newVideoTop = realVideoSize.y;\n\n if (newVideoWidth != actualVideoWidth || newVideoHeight != actualVideoHeight || newVideoLeft != actualVideoLeft || newVideoTop != actualVideoTop || forceDrawing) {\n actualVideoLeft = newVideoLeft + videoOffsetLeft;\n actualVideoTop = newVideoTop + videoOffsetTop;\n actualVideoWidth = newVideoWidth;\n actualVideoHeight = newVideoHeight;\n\n if (captionContainer) {\n var containerStyle = captionContainer.style;\n\n if (containerStyle) {\n containerStyle.left = actualVideoLeft + \'px\';\n containerStyle.top = actualVideoTop + \'px\';\n containerStyle.width = actualVideoWidth + \'px\';\n containerStyle.height = actualVideoHeight + \'px\';\n containerStyle.zIndex = fullscreenAttribute && document[fullscreenAttribute] || displayCCOnTop ? topZIndex : null;\n eventBus.trigger(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].CAPTION_CONTAINER_RESIZE);\n }\n } // Video view has changed size, so resize any active cues\n\n\n var activeCues = track.activeCues;\n\n if (activeCues) {\n var len = activeCues.length;\n\n for (var i = 0; i < len; ++i) {\n var cue = activeCues[i];\n cue.scaleCue(cue);\n }\n }\n }\n }\n }\n\n function scaleCue(activeCue) {\n var videoWidth = actualVideoWidth;\n var videoHeight = actualVideoHeight;\n var key, replaceValue, valueFontSize, valueLineHeight, elements;\n\n if (activeCue.cellResolution) {\n var cellUnit = [videoWidth / activeCue.cellResolution[0], videoHeight / activeCue.cellResolution[1]];\n\n if (activeCue.linePadding) {\n for (key in activeCue.linePadding) {\n if (activeCue.linePadding.hasOwnProperty(key)) {\n var valueLinePadding = activeCue.linePadding[key];\n replaceValue = (valueLinePadding * cellUnit[0]).toString(); // Compute the CellResolution unit in order to process properties using sizing (fontSize, linePadding, etc).\n\n var elementsSpan = document.getElementsByClassName(\'spanPadding\');\n\n for (var i = 0; i < elementsSpan.length; i++) {\n elementsSpan[i].style.cssText = elementsSpan[i].style.cssText.replace(/(padding-left\\s*:\\s*)[\\d.,]+(?=\\s*px)/gi, \'$1\' + replaceValue);\n elementsSpan[i].style.cssText = elementsSpan[i].style.cssText.replace(/(padding-right\\s*:\\s*)[\\d.,]+(?=\\s*px)/gi, \'$1\' + replaceValue);\n }\n }\n }\n }\n\n if (activeCue.fontSize) {\n for (key in activeCue.fontSize) {\n if (activeCue.fontSize.hasOwnProperty(key)) {\n if (activeCue.fontSize[key][0] === \'%\') {\n valueFontSize = activeCue.fontSize[key][1] / 100;\n } else if (activeCue.fontSize[key][0] === \'c\') {\n valueFontSize = activeCue.fontSize[key][1];\n }\n\n replaceValue = (valueFontSize * cellUnit[1]).toString();\n\n if (key !== \'defaultFontSize\') {\n elements = document.getElementsByClassName(key);\n } else {\n elements = document.getElementsByClassName(\'paragraph\');\n }\n\n for (var j = 0; j < elements.length; j++) {\n elements[j].style.cssText = elements[j].style.cssText.replace(/(font-size\\s*:\\s*)[\\d.,]+(?=\\s*px)/gi, \'$1\' + replaceValue);\n }\n }\n }\n\n if (activeCue.lineHeight) {\n for (key in activeCue.lineHeight) {\n if (activeCue.lineHeight.hasOwnProperty(key)) {\n if (activeCue.lineHeight[key][0] === \'%\') {\n valueLineHeight = activeCue.lineHeight[key][1] / 100;\n } else if (activeCue.fontSize[key][0] === \'c\') {\n valueLineHeight = activeCue.lineHeight[key][1];\n }\n\n replaceValue = (valueLineHeight * cellUnit[1]).toString();\n elements = document.getElementsByClassName(key);\n\n for (var k = 0; k < elements.length; k++) {\n elements[k].style.cssText = elements[k].style.cssText.replace(/(line-height\\s*:\\s*)[\\d.,]+(?=\\s*px)/gi, \'$1\' + replaceValue);\n }\n }\n }\n }\n }\n }\n\n if (activeCue.isd) {\n var htmlCaptionDiv = document.getElementById(activeCue.cueID);\n\n if (htmlCaptionDiv) {\n captionContainer.removeChild(htmlCaptionDiv);\n }\n\n renderCaption(activeCue);\n }\n }\n\n function renderCaption(cue) {\n if (captionContainer) {\n var finalCue = document.createElement(\'div\');\n captionContainer.appendChild(finalCue);\n previousISDState = Object(imsc__WEBPACK_IMPORTED_MODULE_6__["renderHTML"])(cue.isd, finalCue, function (uri) {\n var imsc1ImgUrnTester = /^(urn:)(mpeg:[a-z0-9][a-z0-9-]{0,31}:)(subs:)([0-9]+)$/;\n var smpteImgUrnTester = /^#(.*)$/;\n\n if (imsc1ImgUrnTester.test(uri)) {\n var match = imsc1ImgUrnTester.exec(uri);\n var imageId = parseInt(match[4], 10) - 1;\n var imageData = btoa(cue.images[imageId]);\n var dataUrl = \'data:image/png;base64,\' + imageData;\n return dataUrl;\n } else if (smpteImgUrnTester.test(uri)) {\n var _match = smpteImgUrnTester.exec(uri);\n\n var _imageId = _match[1];\n\n var _dataUrl = \'data:image/png;base64,\' + cue.embeddedImages[_imageId];\n\n return _dataUrl;\n } else {\n return null;\n }\n }, captionContainer.clientHeight, captionContainer.clientWidth, false\n /*displayForcedOnlyMode*/\n , function (err) {\n logger.info(\'renderCaption :\', err); //TODO add ErrorHandler management\n }, previousISDState, true\n /*enableRollUp*/\n );\n finalCue.id = cue.cueID;\n eventBus.trigger(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].CAPTION_RENDERED, {\n captionDiv: finalCue,\n currentTrackIdx: currentTrackIdx\n });\n }\n }\n /*\n * Add captions to track, store for later adding, or add captions added before\n */\n\n\n function addCaptions(trackIdx, timeOffset, captionData) {\n var track = getTrackByIdx(trackIdx);\n var self = this;\n\n if (!track) {\n return;\n }\n\n if (!Array.isArray(captionData) || captionData.length === 0) {\n return;\n }\n\n for (var item = 0; item < captionData.length; item++) {\n var cue = void 0;\n var currentItem = captionData[item];\n track.cellResolution = currentItem.cellResolution;\n track.isFromCEA608 = currentItem.isFromCEA608;\n\n if (currentItem.type === \'html\' && captionContainer && !isNaN(currentItem.start) && !isNaN(currentItem.end)) {\n cue = new Cue(currentItem.start + timeOffset, currentItem.end + timeOffset, \'\');\n cue.cueHTMLElement = currentItem.cueHTMLElement;\n cue.isd = currentItem.isd;\n cue.images = currentItem.images;\n cue.embeddedImages = currentItem.embeddedImages;\n cue.cueID = currentItem.cueID;\n cue.scaleCue = scaleCue.bind(self); //useful parameters for cea608 subtitles, not for TTML one.\n\n cue.cellResolution = currentItem.cellResolution;\n cue.lineHeight = currentItem.lineHeight;\n cue.linePadding = currentItem.linePadding;\n cue.fontSize = currentItem.fontSize;\n captionContainer.style.left = actualVideoLeft + \'px\';\n captionContainer.style.top = actualVideoTop + \'px\';\n captionContainer.style.width = actualVideoWidth + \'px\';\n captionContainer.style.height = actualVideoHeight + \'px\';\n\n cue.onenter = function () {\n if (track.mode === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT_SHOWING) {\n if (this.isd) {\n renderCaption(this);\n logger.debug(\'Cue enter id:\' + this.cueID);\n } else {\n captionContainer.appendChild(this.cueHTMLElement);\n scaleCue.call(self, this);\n eventBus.trigger(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].CAPTION_RENDERED, {\n captionDiv: this.cueHTMLElement,\n currentTrackIdx: currentTrackIdx\n });\n }\n }\n };\n\n cue.onexit = function () {\n if (captionContainer) {\n var divs = captionContainer.childNodes;\n\n for (var i = 0; i < divs.length; ++i) {\n if (divs[i].id === this.cueID) {\n logger.debug(\'Cue exit id:\' + divs[i].id);\n captionContainer.removeChild(divs[i]);\n --i;\n }\n }\n }\n };\n } else {\n if (currentItem.data && !isNaN(currentItem.start) && !isNaN(currentItem.end)) {\n cue = new Cue(currentItem.start - timeOffset, currentItem.end - timeOffset, currentItem.data);\n\n if (currentItem.styles) {\n if (currentItem.styles.align !== undefined && \'align\' in cue) {\n cue.align = currentItem.styles.align;\n }\n\n if (currentItem.styles.line !== undefined && \'line\' in cue) {\n cue.line = currentItem.styles.line;\n }\n\n if (currentItem.styles.position !== undefined && \'position\' in cue) {\n cue.position = currentItem.styles.position;\n }\n\n if (currentItem.styles.size !== undefined && \'size\' in cue) {\n cue.size = currentItem.styles.size;\n }\n }\n\n cue.onenter = function () {\n if (track.mode === _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXT_SHOWING) {\n eventBus.trigger(_streaming_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_3__["default"].CAPTION_RENDERED, {\n currentTrackIdx: currentTrackIdx\n });\n }\n };\n }\n }\n\n try {\n if (cue) {\n if (!cueInTrack(track, cue)) {\n track.addCue(cue);\n }\n } else {\n logger.error(\'impossible to display subtitles.\');\n }\n } catch (e) {\n // Edge crash, delete everything and start adding again\n // @see https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11979877/\n deleteTrackCues(track);\n track.addCue(cue);\n throw e;\n }\n }\n }\n\n function getTrackByIdx(idx) {\n return idx >= 0 && textTrackQueue[idx] ? videoModel.getTextTrack(textTrackQueue[idx].kind, textTrackQueue[idx].id, textTrackQueue[idx].lang, textTrackQueue[idx].isTTML, textTrackQueue[idx].isEmbedded) : null;\n }\n\n function getCurrentTrackIdx() {\n return currentTrackIdx;\n }\n\n function getTrackIdxForId(trackId) {\n var idx = -1;\n\n for (var i = 0; i < textTrackQueue.length; i++) {\n if (textTrackQueue[i].id === trackId) {\n idx = i;\n break;\n }\n }\n\n return idx;\n }\n\n function setCurrentTrackIdx(idx) {\n var _this = this;\n\n if (idx === currentTrackIdx) {\n return;\n }\n\n currentTrackIdx = idx;\n var track = getTrackByIdx(currentTrackIdx);\n setCueStyleOnTrack.call(this, track);\n\n if (videoSizeCheckInterval) {\n clearInterval(videoSizeCheckInterval);\n videoSizeCheckInterval = null;\n }\n\n if (track && track.renderingType === \'html\') {\n checkVideoSize.call(this, track, true);\n\n if (window.ResizeObserver) {\n resizeObserver = new window.ResizeObserver(function () {\n checkVideoSize.call(_this, track, true);\n });\n resizeObserver.observe(videoModel.getElement());\n } else {\n videoSizeCheckInterval = setInterval(checkVideoSize.bind(this, track), 500);\n }\n }\n }\n\n function setCueStyleOnTrack(track) {\n clearCaptionContainer.call(this);\n\n if (track) {\n if (track.renderingType === \'html\') {\n setNativeCueStyle.call(this);\n } else {\n removeNativeCueStyle.call(this);\n }\n } else {\n removeNativeCueStyle.call(this);\n }\n }\n\n function cueInTrack(track, cue) {\n if (!track.cues) return false;\n\n for (var i = 0; i < track.cues.length; i++) {\n if (track.cues[i].startTime === cue.startTime && track.cues[i].endTime === cue.endTime) {\n return true;\n }\n }\n\n return false;\n }\n\n function cueInRange(cue, start, end) {\n return (isNaN(start) || cue.startTime >= start) && (isNaN(end) || cue.endTime <= end);\n }\n\n function deleteTrackCues(track, start, end) {\n if (track.cues) {\n var cues = track.cues;\n var lastIdx = cues.length - 1;\n\n for (var r = lastIdx; r >= 0; r--) {\n if (cueInRange(cues[r], start, end)) {\n if (cues[r].onexit) {\n cues[r].onexit();\n }\n\n track.removeCue(cues[r]);\n }\n }\n }\n }\n\n function deleteCuesFromTrackIdx(trackIdx, start, end) {\n var track = getTrackByIdx(trackIdx);\n\n if (track) {\n deleteTrackCues(track, start, end);\n }\n }\n\n function deleteAllTextTracks() {\n var ln = nativeTrackElementArr ? nativeTrackElementArr.length : 0;\n\n for (var i = 0; i < ln; i++) {\n var track = getTrackByIdx(i);\n\n if (track) {\n deleteTrackCues.call(this, track, streamInfo.start, streamInfo.start + streamInfo.duration);\n }\n }\n\n nativeTrackElementArr = [];\n textTrackQueue = [];\n\n if (videoSizeCheckInterval) {\n clearInterval(videoSizeCheckInterval);\n videoSizeCheckInterval = null;\n }\n\n if (resizeObserver && videoModel) {\n resizeObserver.unobserve(videoModel.getElement());\n resizeObserver = null;\n }\n\n currentTrackIdx = -1;\n clearCaptionContainer.call(this);\n }\n\n function deleteTextTrack(idx) {\n videoModel.removeChild(nativeTrackElementArr[idx]);\n nativeTrackElementArr.splice(idx, 1);\n }\n /* Set native cue style to transparent background to avoid it being displayed. */\n\n\n function setNativeCueStyle() {\n var styleElement = document.getElementById(\'native-cue-style\');\n\n if (styleElement) {\n return; //Already set\n }\n\n styleElement = document.createElement(\'style\');\n styleElement.id = \'native-cue-style\';\n document.head.appendChild(styleElement);\n var stylesheet = styleElement.sheet;\n var video = videoModel.getElement();\n\n try {\n if (video) {\n if (video.id) {\n stylesheet.insertRule(\'#\' + video.id + \'::cue {background: transparent}\', 0);\n } else if (video.classList.length !== 0) {\n stylesheet.insertRule(\'.\' + video.className + \'::cue {background: transparent}\', 0);\n } else {\n stylesheet.insertRule(\'video::cue {background: transparent}\', 0);\n }\n }\n } catch (e) {\n logger.info(\'\' + e.message);\n }\n }\n /* Remove the extra cue style with transparent background for native cues. */\n\n\n function removeNativeCueStyle() {\n var styleElement = document.getElementById(\'native-cue-style\');\n\n if (styleElement) {\n document.head.removeChild(styleElement);\n }\n }\n\n function clearCaptionContainer() {\n if (captionContainer) {\n while (captionContainer.firstChild) {\n captionContainer.removeChild(captionContainer.firstChild);\n }\n }\n }\n\n function setModeForTrackIdx(idx, mode) {\n var track = getTrackByIdx(idx);\n\n if (track && track.mode !== mode) {\n track.mode = mode;\n }\n }\n\n function getCurrentTrackInfo() {\n return textTrackQueue[currentTrackIdx];\n }\n\n instance = {\n initialize: initialize,\n getStreamId: getStreamId,\n addTextTrack: addTextTrack,\n addCaptions: addCaptions,\n createTracks: createTracks,\n getCurrentTrackIdx: getCurrentTrackIdx,\n setCurrentTrackIdx: setCurrentTrackIdx,\n getTrackIdxForId: getTrackIdxForId,\n getCurrentTrackInfo: getCurrentTrackInfo,\n setModeForTrackIdx: setModeForTrackIdx,\n deleteCuesFromTrackIdx: deleteCuesFromTrackIdx,\n deleteAllTextTracks: deleteAllTextTracks,\n deleteTextTrack: deleteTextTrack\n };\n setup();\n return instance;\n}\n\nTextTracks.__dashjs_factory_name = \'TextTracks\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_4__["default"].getClassFactory(TextTracks));\n\n/***/ }),\n\n/***/ "./src/streaming/thumbnail/ThumbnailController.js":\n/*!********************************************************!*\\\n !*** ./src/streaming/thumbnail/ThumbnailController.js ***!\n \\********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2351691__) {\n__nested_webpack_require_2351691__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2351691__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2351691__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _vo_Thumbnail__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2351691__(/*! ../vo/Thumbnail */ "./src/streaming/vo/Thumbnail.js");\n/* harmony import */ var _ThumbnailTracks__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2351691__(/*! ./ThumbnailTracks */ "./src/streaming/thumbnail/ThumbnailTracks.js");\n/* harmony import */ var _vo_BitrateInfo__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2351691__(/*! ../vo/BitrateInfo */ "./src/streaming/vo/BitrateInfo.js");\n/* harmony import */ var _dash_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2351691__(/*! ../../dash/utils/SegmentsUtils */ "./src/dash/utils/SegmentsUtils.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\nfunction ThumbnailController(config) {\n var context = this.context;\n var streamInfo = config.streamInfo;\n var instance, thumbnailTracks;\n\n function setup() {\n reset();\n thumbnailTracks = Object(_ThumbnailTracks__WEBPACK_IMPORTED_MODULE_3__["default"])(context).create({\n streamInfo: streamInfo,\n adapter: config.adapter,\n baseURLController: config.baseURLController,\n timelineConverter: config.timelineConverter,\n debug: config.debug,\n eventBus: config.eventBus,\n events: config.events,\n dashConstants: config.dashConstants,\n dashMetrics: config.dashMetrics,\n segmentBaseController: config.segmentBaseController\n });\n }\n\n function initialize() {\n thumbnailTracks.addTracks();\n var tracks = thumbnailTracks.getTracks();\n\n if (tracks && tracks.length > 0) {\n setTrackByIndex(0);\n }\n }\n\n function getStreamId() {\n return streamInfo.id;\n }\n\n function provide(time, callback) {\n if (typeof callback !== \'function\') {\n return;\n }\n\n var track = thumbnailTracks.getCurrentTrack();\n var offset, request;\n\n if (!track || track.segmentDuration <= 0 || time === undefined || time === null) {\n callback(null);\n return;\n }\n\n request = thumbnailTracks.getThumbnailRequestForTime(time);\n\n if (request) {\n track.segmentDuration = request.duration;\n }\n\n offset = time % track.segmentDuration;\n var thumbIndex = Math.floor(offset * track.tilesHor * track.tilesVert / track.segmentDuration); // Create and return the thumbnail\n\n var thumbnail = new _vo_Thumbnail__WEBPACK_IMPORTED_MODULE_2__["default"]();\n thumbnail.width = Math.floor(track.widthPerTile);\n thumbnail.height = Math.floor(track.heightPerTile);\n thumbnail.x = Math.floor(thumbIndex % track.tilesHor) * track.widthPerTile;\n thumbnail.y = Math.floor(thumbIndex / track.tilesHor) * track.heightPerTile;\n\n if (\'readThumbnail\' in track) {\n return track.readThumbnail(time, function (url) {\n thumbnail.url = url;\n callback(thumbnail);\n });\n } else {\n if (!request) {\n var seq = Math.floor(time / track.segmentDuration);\n thumbnail.url = _buildUrlFromTemplate(track, seq);\n } else {\n thumbnail.url = request.url;\n track.segmentDuration = NaN;\n }\n\n callback(thumbnail);\n }\n }\n\n function _buildUrlFromTemplate(track, seq) {\n var seqIdx = seq + track.startNumber;\n var url = Object(_dash_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_5__["replaceTokenForTemplate"])(track.templateUrl, \'Number\', seqIdx);\n url = Object(_dash_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_5__["replaceTokenForTemplate"])(url, \'Time\', (seqIdx - 1) * track.segmentDuration * track.timescale);\n url = Object(_dash_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_5__["replaceTokenForTemplate"])(url, \'Bandwidth\', track.bandwidth);\n return Object(_dash_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_5__["unescapeDollarsInTemplate"])(url);\n }\n\n function setTrackByIndex(index) {\n thumbnailTracks.setTrackByIndex(index);\n }\n\n function getCurrentTrackIndex() {\n return thumbnailTracks.getCurrentTrackIndex();\n }\n\n function getBitrateList() {\n var tracks = thumbnailTracks.getTracks();\n var i = 0;\n return tracks.map(function (t) {\n var bitrateInfo = new _vo_BitrateInfo__WEBPACK_IMPORTED_MODULE_4__["default"]();\n bitrateInfo.mediaType = _constants_Constants__WEBPACK_IMPORTED_MODULE_1__["default"].IMAGE;\n bitrateInfo.qualityIndex = i++;\n bitrateInfo.bitrate = t.bitrate;\n bitrateInfo.width = t.width;\n bitrateInfo.height = t.height;\n return bitrateInfo;\n });\n }\n\n function reset() {\n if (thumbnailTracks) {\n thumbnailTracks.reset();\n }\n }\n\n instance = {\n getStreamId: getStreamId,\n initialize: initialize,\n provide: provide,\n setTrackByIndex: setTrackByIndex,\n getCurrentTrackIndex: getCurrentTrackIndex,\n getBitrateList: getBitrateList,\n reset: reset\n };\n setup();\n return instance;\n}\n\nThumbnailController.__dashjs_factory_name = \'ThumbnailController\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(ThumbnailController));\n\n/***/ }),\n\n/***/ "./src/streaming/thumbnail/ThumbnailTracks.js":\n/*!****************************************************!*\\\n !*** ./src/streaming/thumbnail/ThumbnailTracks.js ***!\n \\****************************************************/\n/*! exports provided: THUMBNAILS_SCHEME_ID_URIS, default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2359191__) {\n__nested_webpack_require_2359191__.r(__nested_webpack_exports__);\n/* harmony export (binding) */ __nested_webpack_require_2359191__.d(__nested_webpack_exports__, "THUMBNAILS_SCHEME_ID_URIS", function() { return THUMBNAILS_SCHEME_ID_URIS; });\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2359191__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2359191__(/*! ../../dash/constants/DashConstants */ "./src/dash/constants/DashConstants.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2359191__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _vo_ThumbnailTrackInfo__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2359191__(/*! ../vo/ThumbnailTrackInfo */ "./src/streaming/vo/ThumbnailTrackInfo.js");\n/* harmony import */ var _streaming_utils_URLUtils__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2359191__(/*! ../../streaming/utils/URLUtils */ "./src/streaming/utils/URLUtils.js");\n/* harmony import */ var _dash_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2359191__(/*! ../../dash/utils/SegmentsUtils */ "./src/dash/utils/SegmentsUtils.js");\n/* harmony import */ var _streaming_utils_BoxParser__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2359191__(/*! ../../streaming/utils/BoxParser */ "./src/streaming/utils/BoxParser.js");\n/* harmony import */ var _streaming_net_XHRLoader__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_2359191__(/*! ../../streaming/net/XHRLoader */ "./src/streaming/net/XHRLoader.js");\n/* harmony import */ var _dash_DashHandler__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_2359191__(/*! ../../dash/DashHandler */ "./src/dash/DashHandler.js");\n/* harmony import */ var _dash_controllers_SegmentsController__WEBPACK_IMPORTED_MODULE_9__ = __nested_webpack_require_2359191__(/*! ../../dash/controllers/SegmentsController */ "./src/dash/controllers/SegmentsController.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\nvar THUMBNAILS_SCHEME_ID_URIS = [\'http://dashif.org/thumbnail_tile\', \'http://dashif.org/guidelines/thumbnail_tile\'];\n\nfunction ThumbnailTracks(config) {\n var context = this.context;\n var adapter = config.adapter;\n var baseURLController = config.baseURLController;\n var streamInfo = config.streamInfo;\n var timelineConverter = config.timelineConverter;\n var debug = config.debug;\n var eventBus = config.eventBus;\n var events = config.events;\n var dashConstants = config.dashConstants;\n var urlUtils = Object(_streaming_utils_URLUtils__WEBPACK_IMPORTED_MODULE_4__["default"])(context).getInstance();\n var instance, tracks, dashHandler, currentTrackIndex, mediaInfo, segmentsController, loader, boxParser;\n\n function setup() {\n reset();\n loader = Object(_streaming_net_XHRLoader__WEBPACK_IMPORTED_MODULE_7__["default"])(context).create({});\n boxParser = Object(_streaming_utils_BoxParser__WEBPACK_IMPORTED_MODULE_6__["default"])(context).getInstance();\n segmentsController = Object(_dash_controllers_SegmentsController__WEBPACK_IMPORTED_MODULE_9__["default"])(context).create({\n events: events,\n eventBus: eventBus,\n streamInfo: streamInfo,\n timelineConverter: timelineConverter,\n dashConstants: dashConstants,\n dashMetrics: config.dashMetrics,\n segmentBaseController: config.segmentBaseController,\n type: _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].IMAGE\n });\n dashHandler = Object(_dash_DashHandler__WEBPACK_IMPORTED_MODULE_8__["default"])(context).create({\n streamInfo: streamInfo,\n type: _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].IMAGE,\n timelineConverter: timelineConverter,\n segmentsController: segmentsController,\n baseURLController: baseURLController,\n debug: debug,\n eventBus: eventBus,\n events: events,\n dashConstants: dashConstants,\n urlUtils: urlUtils\n }); // initialize controllers\n\n dashHandler.initialize(adapter ? adapter.getIsDynamic() : false);\n }\n\n function addTracks() {\n if (!streamInfo || !adapter) {\n return;\n } // Extract thumbnail tracks\n\n\n mediaInfo = adapter.getMediaInfoForType(streamInfo, _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].IMAGE);\n\n if (!mediaInfo) {\n return;\n }\n\n var voReps = adapter.getVoRepresentations(mediaInfo);\n\n if (voReps && voReps.length > 0) {\n voReps.forEach(function (rep) {\n if (rep.segmentInfoType === _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TEMPLATE && rep.segmentDuration > 0 && rep.media || rep.segmentInfoType === _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_TIMELINE) {\n _createTrack(rep);\n }\n\n if (rep.segmentInfoType === _dash_constants_DashConstants__WEBPACK_IMPORTED_MODULE_1__["default"].SEGMENT_BASE) {\n _createTrack(rep, true);\n }\n });\n }\n\n if (tracks.length > 0) {\n // Sort bitrates and select the lowest bitrate rendition\n tracks.sort(function (a, b) {\n return a.bitrate - b.bitrate;\n });\n }\n }\n\n function _createTrack(representation, useSegmentBase) {\n var track = new _vo_ThumbnailTrackInfo__WEBPACK_IMPORTED_MODULE_3__["default"]();\n track.id = representation.id;\n track.bitrate = representation.bandwidth;\n track.width = representation.width;\n track.height = representation.height;\n track.tilesHor = 1;\n track.tilesVert = 1;\n\n if (representation.essentialProperties) {\n representation.essentialProperties.forEach(function (p) {\n if (THUMBNAILS_SCHEME_ID_URIS.indexOf(p.schemeIdUri) >= 0 && p.value) {\n var vars = p.value.split(\'x\');\n\n if (vars.length === 2 && !isNaN(vars[0]) && !isNaN(vars[1])) {\n track.tilesHor = parseInt(vars[0], 10);\n track.tilesVert = parseInt(vars[1], 10);\n }\n }\n });\n }\n\n if (useSegmentBase) {\n segmentsController.updateSegmentData(representation).then(function (data) {\n _handleUpdatedSegmentData(track, representation, data);\n });\n } else {\n track.startNumber = representation.startNumber;\n track.segmentDuration = representation.segmentDuration;\n track.timescale = representation.timescale;\n track.templateUrl = buildTemplateUrl(representation);\n }\n\n if (track.tilesHor > 0 && track.tilesVert > 0) {\n // Precalculate width and heigth per tile for perf reasons\n track.widthPerTile = track.width / track.tilesHor;\n track.heightPerTile = track.height / track.tilesVert;\n tracks.push(track);\n }\n }\n\n function _handleUpdatedSegmentData(track, representation, data) {\n var cache = [];\n\n var segments = _normalizeSegments(data, representation);\n\n representation.segments = segments;\n track.segmentDuration = representation.segments[0].duration; //assume all segments have the same duration\n\n track.readThumbnail = function (time, callback) {\n var cached = null;\n cache.some(function (el) {\n if (el.start <= time && el.end > time) {\n cached = el.url;\n return true;\n }\n });\n\n if (cached) {\n callback(cached);\n } else {\n representation.segments.some(function (ss) {\n if (ss.mediaStartTime <= time && ss.mediaStartTime + ss.duration > time) {\n var baseURL = baseURLController.resolve(representation.path);\n loader.load({\n method: \'get\',\n url: baseURL.url,\n request: {\n range: ss.mediaRange,\n responseType: \'arraybuffer\'\n },\n onload: function onload(e) {\n var info = boxParser.getSamplesInfo(e.target.response);\n var blob = new Blob([e.target.response.slice(info.sampleList[0].offset, info.sampleList[0].offset + info.sampleList[0].size)], {\n type: \'image/jpeg\'\n });\n var imageUrl = window.URL.createObjectURL(blob);\n cache.push({\n start: ss.mediaStartTime,\n end: ss.mediaStartTime + ss.duration,\n url: imageUrl\n });\n if (callback) callback(imageUrl);\n }\n });\n return true;\n }\n });\n }\n };\n }\n\n function _normalizeSegments(data, representation) {\n var segments = [];\n var count = 0;\n var i, len, s, seg;\n\n for (i = 0, len = data.segments.length; i < len; i++) {\n s = data.segments[i];\n seg = Object(_dash_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_5__["getTimeBasedSegment"])(timelineConverter, adapter.getIsDynamic(), representation, s.startTime, s.duration, s.timescale, s.media, s.mediaRange, count);\n\n if (seg) {\n segments.push(seg);\n seg = null;\n count++;\n }\n }\n\n return segments;\n }\n\n function buildTemplateUrl(representation) {\n var templateUrl = urlUtils.isRelative(representation.media) ? urlUtils.resolve(representation.media, baseURLController.resolve(representation.path).url) : representation.media;\n\n if (!templateUrl) {\n return \'\';\n }\n\n return Object(_dash_utils_SegmentsUtils__WEBPACK_IMPORTED_MODULE_5__["replaceIDForTemplate"])(templateUrl, representation.id);\n }\n\n function getTracks() {\n return tracks;\n }\n\n function getCurrentTrackIndex() {\n return currentTrackIndex;\n }\n\n function getCurrentTrack() {\n if (currentTrackIndex < 0) {\n return null;\n }\n\n return tracks[currentTrackIndex];\n }\n\n function setTrackByIndex(index) {\n if (!tracks || tracks.length === 0) {\n return;\n } // select highest bitrate in case selected index is higher than bitrate list length\n\n\n if (index >= tracks.length) {\n index = tracks.length - 1;\n }\n\n currentTrackIndex = index;\n }\n\n function getThumbnailRequestForTime(time) {\n var currentVoRep;\n var voReps = adapter.getVoRepresentations(mediaInfo);\n\n for (var i = 0; i < voReps.length; i++) {\n if (tracks[currentTrackIndex].id === voReps[i].id) {\n currentVoRep = voReps[i];\n break;\n }\n }\n\n return dashHandler.getSegmentRequestForTime(mediaInfo, currentVoRep, time);\n }\n\n function reset() {\n tracks = [];\n currentTrackIndex = -1;\n mediaInfo = null;\n }\n\n instance = {\n getTracks: getTracks,\n addTracks: addTracks,\n reset: reset,\n setTrackByIndex: setTrackByIndex,\n getCurrentTrack: getCurrentTrack,\n getCurrentTrackIndex: getCurrentTrackIndex,\n getThumbnailRequestForTime: getThumbnailRequestForTime\n };\n setup();\n return instance;\n}\n\nThumbnailTracks.__dashjs_factory_name = \'ThumbnailTracks\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getClassFactory(ThumbnailTracks));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/BaseURLSelector.js":\n/*!************************************************!*\\\n !*** ./src/streaming/utils/BaseURLSelector.js ***!\n \\************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2372211__) {\n__nested_webpack_require_2372211__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_errors_Errors__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2372211__(/*! ../../core/errors/Errors */ "./src/core/errors/Errors.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2372211__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2372211__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _controllers_BlacklistController__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2372211__(/*! ../controllers/BlacklistController */ "./src/streaming/controllers/BlacklistController.js");\n/* harmony import */ var _baseUrlResolution_DVBSelector__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2372211__(/*! ./baseUrlResolution/DVBSelector */ "./src/streaming/utils/baseUrlResolution/DVBSelector.js");\n/* harmony import */ var _baseUrlResolution_BasicSelector__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2372211__(/*! ./baseUrlResolution/BasicSelector */ "./src/streaming/utils/baseUrlResolution/BasicSelector.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2372211__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _vo_DashJSError__WEBPACK_IMPORTED_MODULE_7__ = __nested_webpack_require_2372211__(/*! ../vo/DashJSError */ "./src/streaming/vo/DashJSError.js");\n/* harmony import */ var _utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_8__ = __nested_webpack_require_2372211__(/*! ../utils/SupervisorTools */ "./src/streaming/utils/SupervisorTools.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\n\n\nfunction BaseURLSelector() {\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance();\n var instance, serviceLocationBlacklistController, basicSelector, dvbSelector, selector;\n\n function setup() {\n serviceLocationBlacklistController = Object(_controllers_BlacklistController__WEBPACK_IMPORTED_MODULE_3__["default"])(context).create({\n updateEventName: _core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].SERVICE_LOCATION_BLACKLIST_CHANGED,\n addBlacklistEventName: _core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].SERVICE_LOCATION_BLACKLIST_ADD\n });\n basicSelector = Object(_baseUrlResolution_BasicSelector__WEBPACK_IMPORTED_MODULE_5__["default"])(context).create({\n blacklistController: serviceLocationBlacklistController\n });\n dvbSelector = Object(_baseUrlResolution_DVBSelector__WEBPACK_IMPORTED_MODULE_4__["default"])(context).create({\n blacklistController: serviceLocationBlacklistController\n });\n selector = basicSelector;\n }\n\n function setConfig(config) {\n if (config.selector) {\n selector = config.selector;\n }\n }\n\n function chooseSelector(isDVB) {\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_8__["checkParameterType"])(isDVB, \'boolean\');\n selector = isDVB ? dvbSelector : basicSelector;\n }\n\n function select(data) {\n if (!data) {\n return;\n }\n\n var baseUrls = data.baseUrls;\n var selectedIdx = data.selectedIdx; // Once a random selection has been carried out amongst a group of BaseURLs with the same\n // @priority attribute value, then that choice should be re-used if the selection needs to be made again\n // unless the blacklist has been modified or the available BaseURLs have changed.\n\n if (!isNaN(selectedIdx)) {\n return baseUrls[selectedIdx];\n }\n\n var selectedBaseUrl = selector.select(baseUrls);\n\n if (!selectedBaseUrl) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_2__["default"].URL_RESOLUTION_FAILED, {\n error: new _vo_DashJSError__WEBPACK_IMPORTED_MODULE_7__["default"](_core_errors_Errors__WEBPACK_IMPORTED_MODULE_0__["default"].URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE, _core_errors_Errors__WEBPACK_IMPORTED_MODULE_0__["default"].URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE)\n });\n\n if (selector === basicSelector) {\n reset();\n }\n\n return;\n }\n\n data.selectedIdx = baseUrls.indexOf(selectedBaseUrl);\n return selectedBaseUrl;\n }\n\n function reset() {\n serviceLocationBlacklistController.reset();\n }\n\n instance = {\n chooseSelector: chooseSelector,\n select: select,\n reset: reset,\n setConfig: setConfig\n };\n setup();\n return instance;\n}\n\nBaseURLSelector.__dashjs_factory_name = \'BaseURLSelector\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_6__["default"].getClassFactory(BaseURLSelector));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/BoxParser.js":\n/*!******************************************!*\\\n !*** ./src/streaming/utils/BoxParser.js ***!\n \\******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2378946__) {\n__nested_webpack_require_2378946__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2378946__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _IsoFile__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2378946__(/*! ./IsoFile */ "./src/streaming/utils/IsoFile.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2378946__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var codem_isoboxer__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2378946__(/*! codem-isoboxer */ "./node_modules/codem-isoboxer/dist/iso_boxer.js");\n/* harmony import */ var codem_isoboxer__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__nested_webpack_require_2378946__.n(codem_isoboxer__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _vo_IsoBoxSearchInfo__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2378946__(/*! ../vo/IsoBoxSearchInfo */ "./src/streaming/vo/IsoBoxSearchInfo.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\nfunction BoxParser()\n/*config*/\n{\n var logger, instance;\n var context = this.context;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance().getLogger(instance);\n }\n /**\n * @param {ArrayBuffer} data\n * @returns {IsoFile|null}\n * @memberof BoxParser#\n */\n\n\n function parse(data) {\n if (!data) return null;\n\n if (data.fileStart === undefined) {\n data.fileStart = 0;\n }\n\n var parsedFile = codem_isoboxer__WEBPACK_IMPORTED_MODULE_3___default.a.parseBuffer(data);\n var dashIsoFile = Object(_IsoFile__WEBPACK_IMPORTED_MODULE_1__["default"])(context).create();\n dashIsoFile.setData(parsedFile);\n return dashIsoFile;\n }\n /**\n * From the list of type boxes to look for, returns the latest one that is fully completed (header + payload). This\n * method only looks into the list of top boxes and doesn\'t analyze nested boxes.\n * @param {string[]} types\n * @param {ArrayBuffer|uint8Array} buffer\n * @param {number} offset\n * @returns {IsoBoxSearchInfo}\n * @memberof BoxParser#\n */\n\n\n function findLastTopIsoBoxCompleted(types, buffer, offset) {\n if (offset === undefined) {\n offset = 0;\n } // 8 = size (uint32) + type (4 characters)\n\n\n if (!buffer || offset + 8 >= buffer.byteLength) {\n return new _vo_IsoBoxSearchInfo__WEBPACK_IMPORTED_MODULE_4__["default"](0, false);\n }\n\n var data = buffer instanceof ArrayBuffer ? new Uint8Array(buffer) : buffer;\n var boxInfo;\n var lastCompletedOffset = 0;\n\n while (offset < data.byteLength) {\n var boxSize = parseUint32(data, offset);\n var boxType = parseIsoBoxType(data, offset + 4);\n\n if (boxSize === 0) {\n break;\n }\n\n if (offset + boxSize <= data.byteLength) {\n if (types.indexOf(boxType) >= 0) {\n boxInfo = new _vo_IsoBoxSearchInfo__WEBPACK_IMPORTED_MODULE_4__["default"](offset, true, boxSize);\n } else {\n lastCompletedOffset = offset + boxSize;\n }\n }\n\n offset += boxSize;\n }\n\n if (!boxInfo) {\n return new _vo_IsoBoxSearchInfo__WEBPACK_IMPORTED_MODULE_4__["default"](lastCompletedOffset, false);\n }\n\n return boxInfo;\n }\n\n function getSamplesInfo(ab) {\n if (!ab || ab.byteLength === 0) {\n return {\n sampleList: [],\n lastSequenceNumber: NaN,\n totalDuration: NaN,\n numSequences: NaN\n };\n }\n\n var isoFile = parse(ab); // zero or more moofs\n\n var moofBoxes = isoFile.getBoxes(\'moof\'); // exactly one mfhd per moof\n\n var mfhdBoxes = isoFile.getBoxes(\'mfhd\');\n var sampleDuration, sampleCompositionTimeOffset, sampleCount, sampleSize, sampleDts, sampleList, sample, i, j, k, l, m, n, dataOffset, lastSequenceNumber, numSequences, totalDuration;\n numSequences = isoFile.getBoxes(\'moof\').length;\n lastSequenceNumber = mfhdBoxes[mfhdBoxes.length - 1].sequence_number;\n sampleCount = 0;\n sampleList = [];\n var subsIndex = -1;\n var nextSubsSample = -1;\n\n for (l = 0; l < moofBoxes.length; l++) {\n var moofBox = moofBoxes[l]; // zero or more trafs per moof\n\n var trafBoxes = moofBox.getChildBoxes(\'traf\');\n\n for (j = 0; j < trafBoxes.length; j++) {\n var trafBox = trafBoxes[j]; // exactly one tfhd per traf\n\n var tfhdBox = trafBox.getChildBox(\'tfhd\'); // zero or one tfdt per traf\n\n var tfdtBox = trafBox.getChildBox(\'tfdt\');\n sampleDts = tfdtBox.baseMediaDecodeTime; // zero or more truns per traf\n\n var trunBoxes = trafBox.getChildBoxes(\'trun\'); // zero or more subs per traf\n\n var subsBoxes = trafBox.getChildBoxes(\'subs\');\n\n for (k = 0; k < trunBoxes.length; k++) {\n var trunBox = trunBoxes[k];\n sampleCount = trunBox.sample_count;\n dataOffset = (tfhdBox.base_data_offset || 0) + (trunBox.data_offset || 0);\n\n for (i = 0; i < sampleCount; i++) {\n sample = trunBox.samples[i];\n sampleDuration = sample.sample_duration !== undefined ? sample.sample_duration : tfhdBox.default_sample_duration;\n sampleSize = sample.sample_size !== undefined ? sample.sample_size : tfhdBox.default_sample_size;\n sampleCompositionTimeOffset = sample.sample_composition_time_offset !== undefined ? sample.sample_composition_time_offset : 0;\n var sampleData = {\n \'dts\': sampleDts,\n \'cts\': sampleDts + sampleCompositionTimeOffset,\n \'duration\': sampleDuration,\n \'offset\': moofBox.offset + dataOffset,\n \'size\': sampleSize,\n \'subSizes\': [sampleSize]\n };\n\n if (subsBoxes) {\n for (m = 0; m < subsBoxes.length; m++) {\n var subsBox = subsBoxes[m];\n\n if (subsIndex < subsBox.entry_count - 1 && i > nextSubsSample) {\n subsIndex++;\n nextSubsSample += subsBox.entries[subsIndex].sample_delta;\n }\n\n if (i == nextSubsSample) {\n sampleData.subSizes = [];\n var entry = subsBox.entries[subsIndex];\n\n for (n = 0; n < entry.subsample_count; n++) {\n sampleData.subSizes.push(entry.subsamples[n].subsample_size);\n }\n }\n }\n }\n\n sampleList.push(sampleData);\n dataOffset += sampleSize;\n sampleDts += sampleDuration;\n }\n }\n\n totalDuration = sampleDts - tfdtBox.baseMediaDecodeTime;\n }\n }\n\n return {\n sampleList: sampleList,\n lastSequenceNumber: lastSequenceNumber,\n totalDuration: totalDuration,\n numSequences: numSequences\n };\n }\n\n function getMediaTimescaleFromMoov(ab) {\n var isoFile = parse(ab);\n var mdhdBox = isoFile ? isoFile.getBox(\'mdhd\') : undefined;\n return mdhdBox ? mdhdBox.timescale : NaN;\n }\n\n function parseUint32(data, offset) {\n return data[offset + 3] >>> 0 | data[offset + 2] << 8 >>> 0 | data[offset + 1] << 16 >>> 0 | data[offset] << 24 >>> 0;\n }\n\n function parseIsoBoxType(data, offset) {\n return String.fromCharCode(data[offset++]) + String.fromCharCode(data[offset++]) + String.fromCharCode(data[offset++]) + String.fromCharCode(data[offset]);\n }\n\n function findInitRange(data) {\n var initRange = null;\n var start, end;\n var isoFile = parse(data);\n\n if (!isoFile) {\n return initRange;\n }\n\n var ftyp = isoFile.getBox(\'ftyp\');\n var moov = isoFile.getBox(\'moov\');\n logger.debug(\'Searching for initialization.\');\n\n if (moov && moov.isComplete) {\n start = ftyp ? ftyp.offset : moov.offset;\n end = moov.offset + moov.size - 1;\n initRange = start + \'-\' + end;\n logger.debug(\'Found the initialization. Range: \' + initRange);\n }\n\n return initRange;\n }\n /**\n * Real-time parsing (whenever data is loaded in the buffer payload) of the payload to capture the moof of a chunk\n * @param {array} types\n * @param {ArrayBuffer} buffer\n * @param {number} offset\n * @return {IsoBoxSearchInfo}\n */\n\n\n function parsePayload(types, buffer, offset) {\n if (offset === undefined) {\n offset = 0;\n }\n\n if (!buffer || offset + 8 >= buffer.byteLength) {\n return new _vo_IsoBoxSearchInfo__WEBPACK_IMPORTED_MODULE_4__["default"](0, false);\n }\n\n var data = buffer instanceof ArrayBuffer ? new Uint8Array(buffer) : buffer;\n var boxInfo;\n var lastCompletedOffset = 0;\n\n while (offset < data.byteLength) {\n var boxSize = parseUint32(data, offset);\n var boxType = parseIsoBoxType(data, offset + 4);\n\n if (boxSize === 0) {\n break;\n }\n\n if (offset + boxSize <= data.byteLength) {\n if (types.indexOf(boxType) >= 0) {\n boxInfo = new _vo_IsoBoxSearchInfo__WEBPACK_IMPORTED_MODULE_4__["default"](offset, true, boxSize, boxType);\n } else {\n lastCompletedOffset = offset + boxSize;\n }\n }\n\n offset += boxSize;\n }\n\n if (!boxInfo) {\n return new _vo_IsoBoxSearchInfo__WEBPACK_IMPORTED_MODULE_4__["default"](lastCompletedOffset, false);\n }\n\n return boxInfo;\n }\n\n instance = {\n parse: parse,\n findLastTopIsoBoxCompleted: findLastTopIsoBoxCompleted,\n getMediaTimescaleFromMoov: getMediaTimescaleFromMoov,\n getSamplesInfo: getSamplesInfo,\n findInitRange: findInitRange,\n parsePayload: parsePayload\n };\n setup();\n return instance;\n}\n\nBoxParser.__dashjs_factory_name = \'BoxParser\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getSingletonFactory(BoxParser));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/Capabilities.js":\n/*!*********************************************!*\\\n !*** ./src/streaming/utils/Capabilities.js ***!\n \\*********************************************/\n/*! exports provided: supportsMediaSource, default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2390734__) {\n__nested_webpack_require_2390734__.r(__nested_webpack_exports__);\n/* harmony export (binding) */ __nested_webpack_require_2390734__.d(__nested_webpack_exports__, "supportsMediaSource", function() { return supportsMediaSource; });\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2390734__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _thumbnail_ThumbnailTracks__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2390734__(/*! ../thumbnail/ThumbnailTracks */ "./src/streaming/thumbnail/ThumbnailTracks.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2390734__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\nvar codecCompatibilityTable = [{\n \'codec\': \'avc1\',\n \'compatibleCodecs\': [\'avc3\']\n}, {\n \'codec\': \'avc3\',\n \'compatibleCodecs\': [\'avc1\']\n}];\nfunction supportsMediaSource() {\n var hasWebKit = (\'WebKitMediaSource\' in window);\n var hasMediaSource = (\'MediaSource\' in window);\n return hasWebKit || hasMediaSource;\n}\n\nfunction Capabilities() {\n var instance, settings, encryptedMediaSupported;\n\n function setup() {\n encryptedMediaSupported = false;\n }\n\n function setConfig(config) {\n if (!config) {\n return;\n }\n\n if (config.settings) {\n settings = config.settings;\n }\n }\n /**\n * Returns whether Encrypted Media Extensions are supported on this\n * user agent\n *\n * @return {boolean} true if EME is supported, false otherwise\n */\n\n\n function supportsEncryptedMedia() {\n return encryptedMediaSupported;\n }\n /**\n *\n * @param {boolean} value\n */\n\n\n function setEncryptedMediaSupported(value) {\n encryptedMediaSupported = value;\n }\n /**\n * Check if a codec is supported by the MediaSource. We use the MediaCapabilities API or the MSE to check.\n * @param {object} config\n * @param {string} type\n * @return {Promise<boolean>}\n */\n\n\n function supportsCodec(config, type) {\n if (type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].AUDIO && type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].VIDEO) {\n return Promise.resolve(true);\n }\n\n if (_canUseMediaCapabilitiesApi(config, type)) {\n return _checkCodecWithMediaCapabilities(config, type);\n }\n\n return _checkCodecWithMse(config);\n }\n /**\n * MediaCapabilitiesAPI throws an error if one of the attribute is missing. We only use it if we have all required information.\n * @param {object} config\n * @param {string} type\n * @return {*|boolean|boolean}\n * @private\n */\n\n\n function _canUseMediaCapabilitiesApi(config, type) {\n return settings.get().streaming.capabilities.useMediaCapabilitiesApi && navigator.mediaCapabilities && navigator.mediaCapabilities.decodingInfo && (config.codec && type === _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].AUDIO || type === _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].VIDEO && config.codec && config.width && config.height && config.bitrate && config.framerate);\n }\n /**\n * Check codec support using the MSE\n * @param {object} config\n * @return {Promise<void> | Promise<boolean>}\n * @private\n */\n\n\n function _checkCodecWithMse(config) {\n return new Promise(function (resolve) {\n if (!config || !config.codec) {\n resolve(false);\n return;\n }\n\n var codec = config.codec;\n\n if (config.width && config.height) {\n codec += \';width="\' + config.width + \'";height="\' + config.height + \'"\';\n }\n\n if (\'MediaSource\' in window && MediaSource.isTypeSupported(codec)) {\n resolve(true);\n return;\n } else if (\'WebKitMediaSource\' in window && WebKitMediaSource.isTypeSupported(codec)) {\n resolve(true);\n return;\n }\n\n resolve(false);\n });\n }\n /**\n * Check codec support using the MediaCapabilities API\n * @param {object} config\n * @param {string} type\n * @return {Promise<boolean>}\n * @private\n */\n\n\n function _checkCodecWithMediaCapabilities(config, type) {\n return new Promise(function (resolve) {\n if (!config || !config.codec) {\n resolve(false);\n return;\n }\n\n var configuration = {\n type: \'media-source\'\n };\n configuration[type] = {};\n configuration[type].contentType = config.codec;\n configuration[type].width = config.width;\n configuration[type].height = config.height;\n configuration[type].bitrate = parseInt(config.bitrate);\n configuration[type].framerate = parseFloat(config.framerate);\n navigator.mediaCapabilities.decodingInfo(configuration).then(function (result) {\n resolve(result.supported);\n })["catch"](function () {\n resolve(false);\n });\n });\n }\n /**\n * Check if a specific EssentialProperty is supported\n * @param {object} ep\n * @return {boolean}\n */\n\n\n function supportsEssentialProperty(ep) {\n try {\n return _thumbnail_ThumbnailTracks__WEBPACK_IMPORTED_MODULE_1__["THUMBNAILS_SCHEME_ID_URIS"].indexOf(ep.schemeIdUri) !== -1;\n } catch (e) {\n return true;\n }\n }\n /**\n * Check if the root of the old codec is the same as the new one, or if it\'s declared as compatible in the compat table\n * @param {string} codec1\n * @param {string} codec2\n * @return {boolean}\n */\n\n\n function codecRootCompatibleWithCodec(codec1, codec2) {\n var codecRoot = codec1.split(\'.\')[0];\n var rootCompatible = codec2.indexOf(codecRoot) === 0;\n var compatTableCodec;\n\n for (var i = 0; i < codecCompatibilityTable.length; i++) {\n if (codecCompatibilityTable[i].codec === codecRoot) {\n compatTableCodec = codecCompatibilityTable[i];\n break;\n }\n }\n\n if (compatTableCodec) {\n return rootCompatible || compatTableCodec.compatibleCodecs.some(function (compatibleCodec) {\n return codec2.indexOf(compatibleCodec) === 0;\n });\n }\n\n return rootCompatible;\n }\n\n instance = {\n setConfig: setConfig,\n supportsMediaSource: supportsMediaSource,\n supportsEncryptedMedia: supportsEncryptedMedia,\n supportsCodec: supportsCodec,\n setEncryptedMediaSupported: setEncryptedMediaSupported,\n supportsEssentialProperty: supportsEssentialProperty,\n codecRootCompatibleWithCodec: codecRootCompatibleWithCodec\n };\n setup();\n return instance;\n}\n\nCapabilities.__dashjs_factory_name = \'Capabilities\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(Capabilities));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/CapabilitiesFilter.js":\n/*!***************************************************!*\\\n !*** ./src/streaming/utils/CapabilitiesFilter.js ***!\n \\***************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2399430__) {\n__nested_webpack_require_2399430__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2399430__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2399430__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2399430__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n\n\n\n\nfunction CapabilitiesFilter() {\n var context = this.context;\n var instance, adapter, capabilities, settings, logger, customCapabilitiesFilters;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance().getLogger(instance);\n }\n\n function setConfig(config) {\n if (!config) {\n return;\n }\n\n if (config.adapter) {\n adapter = config.adapter;\n }\n\n if (config.capabilities) {\n capabilities = config.capabilities;\n }\n\n if (config.settings) {\n settings = config.settings;\n }\n }\n\n function filterUnsupportedFeatures(manifest) {\n return new Promise(function (resolve) {\n var promises = [];\n promises.push(_filterUnsupportedCodecs(_constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].VIDEO, manifest));\n promises.push(_filterUnsupportedCodecs(_constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].AUDIO, manifest));\n Promise.all(promises).then(function () {\n if (settings.get().streaming.capabilities.filterUnsupportedEssentialProperties) {\n _filterUnsupportedEssentialProperties(manifest);\n }\n\n _applyCustomFilters(manifest);\n\n resolve();\n })["catch"](function () {\n resolve();\n });\n });\n }\n\n function _filterUnsupportedCodecs(type, manifest) {\n if (!manifest || !manifest.Period_asArray || manifest.Period_asArray.length === 0) {\n return Promise.resolve();\n }\n\n var promises = [];\n manifest.Period_asArray.forEach(function (period) {\n promises.push(_filterUnsupportedAdaptationSetsOfPeriod(period, type));\n });\n return Promise.all(promises);\n }\n\n function _filterUnsupportedAdaptationSetsOfPeriod(period, type) {\n return new Promise(function (resolve) {\n if (!period || !period.AdaptationSet_asArray || period.AdaptationSet_asArray.length === 0) {\n resolve();\n return;\n }\n\n var promises = [];\n period.AdaptationSet_asArray.forEach(function (as) {\n if (adapter.getIsTypeOf(as, type)) {\n promises.push(_filterUnsupportedRepresentationsOfAdaptation(as, type));\n }\n });\n Promise.all(promises).then(function () {\n period.AdaptationSet_asArray = period.AdaptationSet_asArray.filter(function (as) {\n var supported = as.Representation_asArray && as.Representation_asArray.length > 0;\n\n if (!supported) {\n logger.warn("AdaptationSet has been removed because of no supported Representation");\n }\n\n return supported;\n });\n resolve();\n })["catch"](function () {\n resolve();\n });\n });\n }\n\n function _filterUnsupportedRepresentationsOfAdaptation(as, type) {\n return new Promise(function (resolve) {\n if (!as.Representation_asArray || as.Representation_asArray.length === 0) {\n resolve();\n return;\n }\n\n var promises = [];\n var configurations = [];\n as.Representation_asArray.forEach(function (rep, i) {\n var codec = adapter.getCodec(as, i, false);\n\n var config = _createConfiguration(type, rep, codec);\n\n configurations.push(config);\n promises.push(capabilities.supportsCodec(config, type));\n });\n Promise.all(promises).then(function (supported) {\n as.Representation_asArray = as.Representation_asArray.filter(function (_, i) {\n if (!supported[i]) {\n logger.debug("[Stream] Codec ".concat(configurations[i].codec, " not supported "));\n }\n\n return supported[i];\n });\n resolve();\n })["catch"](function () {\n resolve();\n });\n });\n }\n\n function _createConfiguration(type, rep, codec) {\n switch (type) {\n case _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].VIDEO:\n return _createVideoConfiguration(rep, codec);\n\n case _constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].AUDIO:\n return _createAudioConfiguration(rep, codec);\n\n default:\n return null;\n }\n }\n\n function _createVideoConfiguration(rep, codec) {\n var width = rep.width || null;\n var height = rep.height || null;\n var framerate = rep.frameRate || null;\n var bitrate = rep.bandwidth || null;\n return {\n codec: codec,\n width: width,\n height: height,\n framerate: framerate,\n bitrate: bitrate\n };\n }\n\n function _createAudioConfiguration(rep, codec) {\n var samplerate = rep.audioSamplingRate || null;\n var bitrate = rep.bandwidth || null;\n return {\n codec: codec,\n bitrate: bitrate,\n samplerate: samplerate\n };\n }\n\n function _filterUnsupportedEssentialProperties(manifest) {\n if (!manifest || !manifest.Period_asArray || manifest.Period_asArray.length === 0) {\n return;\n }\n\n manifest.Period_asArray.forEach(function (period) {\n period.AdaptationSet_asArray = period.AdaptationSet_asArray.filter(function (as) {\n if (!as.Representation_asArray || as.Representation_asArray.length === 0) {\n return true;\n }\n\n as.Representation_asArray = as.Representation_asArray.filter(function (rep) {\n var essentialProperties = adapter.getEssentialPropertiesForRepresentation(rep);\n\n if (essentialProperties && essentialProperties.length > 0) {\n var i = 0;\n\n while (i < essentialProperties.length) {\n if (!capabilities.supportsEssentialProperty(essentialProperties[i])) {\n logger.debug(\'[Stream] EssentialProperty not supported: \' + essentialProperties[i].schemeIdUri);\n return false;\n }\n\n i += 1;\n }\n }\n\n return true;\n });\n return as.Representation_asArray && as.Representation_asArray.length > 0;\n });\n });\n }\n\n function _applyCustomFilters(manifest) {\n if (!customCapabilitiesFilters || customCapabilitiesFilters.length === 0 || !manifest || !manifest.Period_asArray || manifest.Period_asArray.length === 0) {\n return;\n }\n\n manifest.Period_asArray.forEach(function (period) {\n period.AdaptationSet_asArray = period.AdaptationSet_asArray.filter(function (as) {\n if (!as.Representation_asArray || as.Representation_asArray.length === 0) {\n return true;\n }\n\n as.Representation_asArray = as.Representation_asArray.filter(function (representation) {\n return !customCapabilitiesFilters.some(function (customFilter) {\n return !customFilter(representation);\n });\n });\n return as.Representation_asArray && as.Representation_asArray.length > 0;\n });\n });\n }\n\n function setCustomCapabilitiesFilters(customFilters) {\n customCapabilitiesFilters = customFilters;\n }\n\n instance = {\n setConfig: setConfig,\n filterUnsupportedFeatures: filterUnsupportedFeatures,\n setCustomCapabilitiesFilters: setCustomCapabilitiesFilters\n };\n setup();\n return instance;\n}\n\nCapabilitiesFilter.__dashjs_factory_name = \'CapabilitiesFilter\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(CapabilitiesFilter));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/CustomTimeRanges.js":\n/*!*************************************************!*\\\n !*** ./src/streaming/utils/CustomTimeRanges.js ***!\n \\*************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2407477__) {\n__nested_webpack_require_2407477__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2407477__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2407477__(/*! ../utils/SupervisorTools */ "./src/streaming/utils/SupervisorTools.js");\n/**\n* The copyright in this software is being made available under the BSD License,\n* included below. This software may be subject to other third party and contributor\n* rights, including patent rights, and no such rights are granted under this license.\n*\n* Copyright (c) 2013, Dash Industry Forum.\n* All rights reserved.\n*\n* Redistribution and use in source and binary forms, with or without modification,\n* are permitted provided that the following conditions are met:\n* * Redistributions of source code must retain the above copyright notice, this\n* list of conditions and the following disclaimer.\n* * Redistributions in binary form must reproduce the above copyright notice,\n* this list of conditions and the following disclaimer in the documentation and/or\n* other materials provided with the distribution.\n* * Neither the name of Dash Industry Forum nor the names of its\n* contributors may be used to endorse or promote products derived from this software\n* without specific prior written permission.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n* POSSIBILITY OF SUCH DAMAGE.\n*/\n\n\n\nfunction CustomTimeRanges()\n/*config*/\n{\n var customTimeRangeArray = [];\n var length = 0;\n\n function add(start, end) {\n var i = 0;\n\n for (i = 0; i < this.customTimeRangeArray.length && start > this.customTimeRangeArray[i].start; i++) {\n }\n\n this.customTimeRangeArray.splice(i, 0, {\n start: start,\n end: end\n });\n\n for (i = 0; i < this.customTimeRangeArray.length - 1; i++) {\n if (this.mergeRanges(i, i + 1)) {\n i--;\n }\n }\n\n this.length = this.customTimeRangeArray.length;\n }\n\n function clear() {\n this.customTimeRangeArray = [];\n this.length = 0;\n }\n\n function remove(start, end) {\n for (var i = 0; i < this.customTimeRangeArray.length; i++) {\n if (start <= this.customTimeRangeArray[i].start && end >= this.customTimeRangeArray[i].end) {\n // |--------------Range i-------|\n //|---------------Range to remove ---------------|\n // or\n //|--------------Range i-------|\n //|--------------Range to remove ---------------|\n // or\n // |--------------Range i-------|\n //|--------------Range to remove ---------------|\n this.customTimeRangeArray.splice(i, 1);\n i--;\n } else if (start > this.customTimeRangeArray[i].start && end < this.customTimeRangeArray[i].end) {\n //|-----------------Range i----------------|\n // |-------Range to remove -----|\n this.customTimeRangeArray.splice(i + 1, 0, {\n start: end,\n end: this.customTimeRangeArray[i].end\n });\n this.customTimeRangeArray[i].end = start;\n break;\n } else if (start > this.customTimeRangeArray[i].start && start < this.customTimeRangeArray[i].end) {\n //|-----------Range i----------|\n // |---------Range to remove --------|\n // or\n //|-----------------Range i----------------|\n // |-------Range to remove -----|\n this.customTimeRangeArray[i].end = start;\n } else if (end > this.customTimeRangeArray[i].start && end < this.customTimeRangeArray[i].end) {\n // |-----------Range i----------|\n //|---------Range to remove --------|\n // or\n //|-----------------Range i----------------|\n //|-------Range to remove -----|\n this.customTimeRangeArray[i].start = end;\n }\n }\n\n this.length = this.customTimeRangeArray.length;\n }\n\n function mergeRanges(rangeIndex1, rangeIndex2) {\n var range1 = this.customTimeRangeArray[rangeIndex1];\n var range2 = this.customTimeRangeArray[rangeIndex2];\n\n if (range1.start <= range2.start && range2.start <= range1.end && range1.end <= range2.end) {\n //|-----------Range1----------|\n // |-----------Range2----------|\n range1.end = range2.end;\n this.customTimeRangeArray.splice(rangeIndex2, 1);\n return true;\n } else if (range2.start <= range1.start && range1.start <= range2.end && range2.end <= range1.end) {\n // |-----------Range1----------|\n //|-----------Range2----------|\n range1.start = range2.start;\n this.customTimeRangeArray.splice(rangeIndex2, 1);\n return true;\n } else if (range2.start <= range1.start && range1.start <= range2.end && range1.end <= range2.end) {\n // |--------Range1-------|\n //|---------------Range2--------------|\n this.customTimeRangeArray.splice(rangeIndex1, 1);\n return true;\n } else if (range1.start <= range2.start && range2.start <= range1.end && range2.end <= range1.end) {\n //|-----------------Range1--------------|\n // |-----------Range2----------|\n this.customTimeRangeArray.splice(rangeIndex2, 1);\n return true;\n }\n\n return false;\n }\n\n function start(index) {\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_1__["checkInteger"])(index);\n\n if (index >= this.customTimeRangeArray.length || index < 0) {\n return NaN;\n }\n\n return this.customTimeRangeArray[index].start;\n }\n\n function end(index) {\n Object(_utils_SupervisorTools__WEBPACK_IMPORTED_MODULE_1__["checkInteger"])(index);\n\n if (index >= this.customTimeRangeArray.length || index < 0) {\n return NaN;\n }\n\n return this.customTimeRangeArray[index].end;\n }\n\n return {\n customTimeRangeArray: customTimeRangeArray,\n length: length,\n add: add,\n clear: clear,\n remove: remove,\n mergeRanges: mergeRanges,\n start: start,\n end: end\n };\n}\n\nCustomTimeRanges.__dashjs_factory_name = \'CustomTimeRanges\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(CustomTimeRanges));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/DOMStorage.js":\n/*!*******************************************!*\\\n !*** ./src/streaming/utils/DOMStorage.js ***!\n \\*******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2414719__) {\n__nested_webpack_require_2414719__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2414719__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2414719__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2414719__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\nvar legacyKeysAndReplacements = [{\n oldKey: \'dashjs_vbitrate\',\n newKey: \'dashjs_video_bitrate\'\n}, {\n oldKey: \'dashjs_abitrate\',\n newKey: \'dashjs_audio_bitrate\'\n}, {\n oldKey: \'dashjs_vsettings\',\n newKey: \'dashjs_video_settings\'\n}, {\n oldKey: \'dashjs_asettings\',\n newKey: \'dashjs_audio_settings\'\n}];\nvar LOCAL_STORAGE_BITRATE_KEY_TEMPLATE = \'dashjs_?_bitrate\';\nvar LOCAL_STORAGE_SETTINGS_KEY_TEMPLATE = \'dashjs_?_settings\';\nvar STORAGE_TYPE_LOCAL = \'localStorage\';\nvar STORAGE_TYPE_SESSION = \'sessionStorage\';\nvar LAST_BITRATE = \'lastBitrate\';\nvar LAST_MEDIA_SETTINGS = \'lastMediaSettings\';\n\nfunction DOMStorage(config) {\n config = config || {};\n var context = this.context;\n var settings = config.settings;\n var instance, logger, supported;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance().getLogger(instance);\n translateLegacyKeys();\n } //type can be local, session\n\n\n function isSupported(type) {\n if (supported !== undefined) return supported;\n supported = false;\n var testKey = \'1\';\n var testValue = \'1\';\n var storage;\n\n try {\n if (typeof window !== \'undefined\') {\n storage = window[type];\n }\n } catch (error) {\n logger.warn(\'DOMStorage access denied: \' + error.message);\n return supported;\n }\n\n if (!storage || type !== STORAGE_TYPE_LOCAL && type !== STORAGE_TYPE_SESSION) {\n return supported;\n }\n /* When Safari (OS X or iOS) is in private browsing mode, it appears as though localStorage is available, but trying to call setItem throws an exception.\n http://stackoverflow.com/questions/14555347/html5-localstorage-error-with-safari-quota-exceeded-err-dom-exception-22-an\n Check if the storage can be used\n */\n\n\n try {\n storage.setItem(testKey, testValue);\n storage.removeItem(testKey);\n supported = true;\n } catch (error) {\n logger.warn(\'DOMStorage is supported, but cannot be used: \' + error.message);\n }\n\n return supported;\n }\n\n function translateLegacyKeys() {\n if (isSupported(STORAGE_TYPE_LOCAL)) {\n legacyKeysAndReplacements.forEach(function (entry) {\n var value = localStorage.getItem(entry.oldKey);\n\n if (value) {\n localStorage.removeItem(entry.oldKey);\n\n try {\n localStorage.setItem(entry.newKey, value);\n } catch (e) {\n logger.error(e.message);\n }\n }\n });\n }\n } // Return current epoch time, ms, rounded to the nearest 10m to avoid fingerprinting user\n\n\n function getTimestamp() {\n var ten_minutes_ms = 60 * 1000 * 10;\n return Math.round(new Date().getTime() / ten_minutes_ms) * ten_minutes_ms;\n }\n\n function canStore(storageType, key) {\n return isSupported(storageType) && settings.get().streaming[key + \'CachingInfo\'].enabled;\n }\n\n function checkConfig() {\n if (!settings) {\n throw new Error(_constants_Constants__WEBPACK_IMPORTED_MODULE_2__["default"].MISSING_CONFIG_ERROR);\n }\n }\n\n function getSavedMediaSettings(type) {\n var mediaSettings = null;\n checkConfig(); //Checks local storage to see if there is valid, non-expired media settings\n\n if (canStore(STORAGE_TYPE_LOCAL, LAST_MEDIA_SETTINGS)) {\n var key = LOCAL_STORAGE_SETTINGS_KEY_TEMPLATE.replace(/\\?/, type);\n\n try {\n var obj = JSON.parse(localStorage.getItem(key)) || {};\n var isExpired = new Date().getTime() - parseInt(obj.timestamp, 10) >= settings.get().streaming.lastMediaSettingsCachingInfo.ttl || false;\n mediaSettings = obj.settings;\n\n if (isExpired) {\n localStorage.removeItem(key);\n mediaSettings = null;\n }\n } catch (e) {\n return null;\n }\n }\n\n return mediaSettings;\n }\n\n function getSavedBitrateSettings(type) {\n var savedBitrate = NaN;\n checkConfig(); //Checks local storage to see if there is valid, non-expired bit rate\n //hinting from the last play session to use as a starting bit rate.\n\n if (canStore(STORAGE_TYPE_LOCAL, LAST_BITRATE)) {\n var key = LOCAL_STORAGE_BITRATE_KEY_TEMPLATE.replace(/\\?/, type);\n\n try {\n var obj = JSON.parse(localStorage.getItem(key)) || {};\n var isExpired = new Date().getTime() - parseInt(obj.timestamp, 10) >= settings.get().streaming.lastBitrateCachingInfo.ttl || false;\n var bitrate = parseFloat(obj.bitrate);\n\n if (!isNaN(bitrate) && !isExpired) {\n savedBitrate = bitrate;\n logger.debug(\'Last saved bitrate for \' + type + \' was \' + bitrate);\n } else if (isExpired) {\n localStorage.removeItem(key);\n }\n } catch (e) {\n return null;\n }\n }\n\n return savedBitrate;\n }\n\n function setSavedMediaSettings(type, value) {\n if (canStore(STORAGE_TYPE_LOCAL, LAST_MEDIA_SETTINGS)) {\n var key = LOCAL_STORAGE_SETTINGS_KEY_TEMPLATE.replace(/\\?/, type);\n\n try {\n localStorage.setItem(key, JSON.stringify({\n settings: value,\n timestamp: getTimestamp()\n }));\n } catch (e) {\n logger.error(e.message);\n }\n }\n }\n\n function setSavedBitrateSettings(type, bitrate) {\n if (canStore(STORAGE_TYPE_LOCAL, LAST_BITRATE) && bitrate) {\n var key = LOCAL_STORAGE_BITRATE_KEY_TEMPLATE.replace(/\\?/, type);\n\n try {\n localStorage.setItem(key, JSON.stringify({\n bitrate: bitrate.toFixed(3),\n timestamp: getTimestamp()\n }));\n } catch (e) {\n logger.error(e.message);\n }\n }\n }\n\n instance = {\n getSavedBitrateSettings: getSavedBitrateSettings,\n setSavedBitrateSettings: setSavedBitrateSettings,\n getSavedMediaSettings: getSavedMediaSettings,\n setSavedMediaSettings: setSavedMediaSettings\n };\n setup();\n return instance;\n}\n\nDOMStorage.__dashjs_factory_name = \'DOMStorage\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(DOMStorage);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/utils/DefaultURLUtils.js":\n/*!************************************************!*\\\n !*** ./src/streaming/utils/DefaultURLUtils.js ***!\n \\************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2423407__) {\n__nested_webpack_require_2423407__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2423407__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @module DefaultURLUtils\n * @description Provides utility functions for operating on URLs.\n * Initially this is simply a method to determine the Base URL of a URL, but\n * should probably include other things provided all over the place such as\n * determining whether a URL is relative/absolute, resolving two paths etc.\n * @ignore\n */\n\nfunction DefaultURLUtils() {\n var resolveFunction;\n var schemeRegex = /^[a-z][a-z0-9+\\-_.]*:/i;\n var httpUrlRegex = /^https?:\\/\\//i;\n var httpsUrlRegex = /^https:\\/\\//i;\n var originRegex = /^([a-z][a-z0-9+\\-_.]*:\\/\\/[^\\/]+)\\/?/i;\n /**\n * Resolves a url given an optional base url\n * Uses window.URL to do the resolution.\n *\n * @param {string} url\n * @param {string} [baseUrl]\n * @return {string}\n * @memberof module:DefaultURLUtils\n * @instance\n * @private\n */\n\n var nativeURLResolver = function nativeURLResolver(url, baseUrl) {\n try {\n return new window.URL(url, baseUrl).toString();\n } catch (e) {\n return url;\n }\n };\n /**\n * Resolves a url given an optional base url\n * Does not resolve ./, ../ etc but will do enough to construct something\n * which will satisfy XHR etc when window.URL is not available ie\n * IE11/node etc.\n *\n * @param {string} url\n * @param {string} [baseUrl]\n * @return {string}\n * @memberof module:DefaultURLUtils\n * @instance\n * @private\n */\n\n\n var dumbURLResolver = function dumbURLResolver(url, baseUrl) {\n var baseUrlParseFunc = parseBaseUrl;\n\n if (!baseUrl) {\n return url;\n }\n\n if (!isRelative(url)) {\n return url;\n }\n\n if (isPathAbsolute(url)) {\n baseUrlParseFunc = parseOrigin;\n }\n\n if (isSchemeRelative(url)) {\n baseUrlParseFunc = parseScheme;\n }\n\n var base = baseUrlParseFunc(baseUrl);\n var joinChar = base.charAt(base.length - 1) !== \'/\' && url.charAt(0) !== \'/\' ? \'/\' : \'\';\n return [base, url].join(joinChar);\n };\n\n function setup() {\n try {\n var u = new window.URL(\'x\', \'http://y\'); // eslint-disable-line\n\n resolveFunction = nativeURLResolver;\n } catch (e) {// must be IE11/Node etc\n } finally {\n resolveFunction = resolveFunction || dumbURLResolver;\n }\n }\n /**\n * Returns a string that contains the Base URL of a URL, if determinable.\n * @param {string} url - full url\n * @return {string}\n * @memberof module:DefaultURLUtils\n * @instance\n */\n\n\n function parseBaseUrl(url) {\n var slashIndex = url.indexOf(\'/\');\n var lastSlashIndex = url.lastIndexOf(\'/\');\n\n if (slashIndex !== -1) {\n // if there is only \'//\'\n if (lastSlashIndex === slashIndex + 1) {\n return url;\n }\n\n if (url.indexOf(\'?\') !== -1) {\n url = url.substring(0, url.indexOf(\'?\'));\n }\n\n return url.substring(0, lastSlashIndex + 1);\n }\n\n return \'\';\n }\n /**\n * Returns a string that contains the scheme and origin of a URL,\n * if determinable.\n * @param {string} url - full url\n * @return {string}\n * @memberof module:DefaultURLUtils\n * @instance\n */\n\n\n function parseOrigin(url) {\n var matches = url.match(originRegex);\n\n if (matches) {\n return matches[1];\n }\n\n return \'\';\n }\n /**\n * Returns a string that contains the fragment of a URL without scheme,\n * if determinable.\n * @param {string} url - full url\n * @return {string}\n * @memberof module:DefaultURLUtils\n * @instance\n */\n\n\n function removeHostname(url) {\n var urlParts = /^(?:\\w+\\:\\/\\/)?([^\\/]+)(.*)$/.exec(url); //[1] = host / [2] = path\n\n return urlParts[2].substring(1);\n }\n /**\n * Returns a string that contains the scheme of a URL, if determinable.\n * @param {string} url - full url\n * @return {string}\n * @memberof module:DefaultURLUtils\n * @instance\n */\n\n\n function parseScheme(url) {\n var matches = url.match(schemeRegex);\n\n if (matches) {\n return matches[0];\n }\n\n return \'\';\n }\n /**\n * Determines whether the url is relative.\n * @return {boolean}\n * @param {string} url\n * @memberof module:DefaultURLUtils\n * @instance\n */\n\n\n function isRelative(url) {\n return !schemeRegex.test(url);\n }\n /**\n * Determines whether the url is path-absolute.\n * @return {bool}\n * @param {string} url\n * @memberof module:DefaultURLUtils\n * @instance\n */\n\n\n function isPathAbsolute(url) {\n return isRelative(url) && url.charAt(0) === \'/\';\n }\n /**\n * Determines whether the url is scheme-relative.\n * @return {bool}\n * @param {string} url\n * @memberof module:DefaultURLUtils\n * @instance\n */\n\n\n function isSchemeRelative(url) {\n return url.indexOf(\'//\') === 0;\n }\n /**\n * Determines whether the url is an HTTP-URL as defined in ISO/IEC\n * 23009-1:2014 3.1.15. ie URL with a fixed scheme of http or https\n * @return {bool}\n * @param {string} url\n * @memberof module:DefaultURLUtils\n * @instance\n */\n\n\n function isHTTPURL(url) {\n return httpUrlRegex.test(url);\n }\n /**\n * Determines whether the supplied url has https scheme\n * @return {bool}\n * @param {string} url\n * @memberof module:DefaultURLUtils\n * @instance\n */\n\n\n function isHTTPS(url) {\n return httpsUrlRegex.test(url);\n }\n /**\n * Resolves a url given an optional base url\n * @return {string}\n * @param {string} url\n * @param {string} [baseUrl]\n * @memberof module:DefaultURLUtils\n * @instance\n */\n\n\n function resolve(url, baseUrl) {\n return resolveFunction(url, baseUrl);\n }\n\n setup();\n var instance = {\n parseBaseUrl: parseBaseUrl,\n parseOrigin: parseOrigin,\n parseScheme: parseScheme,\n isRelative: isRelative,\n isPathAbsolute: isPathAbsolute,\n isSchemeRelative: isSchemeRelative,\n isHTTPURL: isHTTPURL,\n isHTTPS: isHTTPS,\n removeHostname: removeHostname,\n resolve: resolve\n };\n return instance;\n}\n\nDefaultURLUtils.__dashjs_factory_name = \'DefaultURLUtils\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(DefaultURLUtils));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/EBMLParser.js":\n/*!*******************************************!*\\\n !*** ./src/streaming/utils/EBMLParser.js ***!\n \\*******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2431780__) {\n__nested_webpack_require_2431780__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2431780__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n\n/**\n * Creates an instance of an EBMLParser class which implements a large subset\n * of the functionality required to parse Matroska EBML\n *\n * @param {Object} config object with data member which is the buffer to parse\n * @ignore\n */\n\nfunction EBMLParser(config) {\n config = config || {};\n var instance;\n var data = new DataView(config.data);\n var pos = 0;\n\n function getPos() {\n return pos;\n }\n\n function setPos(value) {\n pos = value;\n }\n /**\n * Consumes an EBML tag from the data stream.\n *\n * @param {Object} tag to parse, A tag is an object with at least a {number} tag and\n * {boolean} required flag.\n * @param {boolean} test whether or not the function should throw if a required\n * tag is not found\n * @return {boolean} whether or not the tag was found\n * @throws will throw an exception if a required tag is not found and test\n * param is false or undefined, or if the stream is malformed.\n * @memberof EBMLParser\n */\n\n\n function consumeTag(tag, test) {\n var found = true;\n var bytesConsumed = 0;\n var p1, p2;\n\n if (test === undefined) {\n test = false;\n }\n\n if (tag.tag > 0xFFFFFF) {\n if (data.getUint32(pos) !== tag.tag) {\n found = false;\n }\n\n bytesConsumed = 4;\n } else if (tag.tag > 0xFFFF) {\n // 3 bytes\n p1 = data.getUint16(pos);\n p2 = data.getUint8(pos + 2); // shift p1 over a byte and add p2\n\n if (p1 * 256 + p2 !== tag.tag) {\n found = false;\n }\n\n bytesConsumed = 3;\n } else if (tag.tag > 0xFF) {\n if (data.getUint16(pos) !== tag.tag) {\n found = false;\n }\n\n bytesConsumed = 2;\n } else {\n if (data.getUint8(pos) !== tag.tag) {\n found = false;\n }\n\n bytesConsumed = 1;\n }\n\n if (!found && tag.required && !test) {\n throw new Error(\'required tag not found\');\n }\n\n if (found) {\n pos += bytesConsumed;\n }\n\n return found;\n }\n /**\n * Consumes an EBML tag from the data stream. If the tag is found then this\n * function will also remove the size field which follows the tag from the\n * data stream.\n *\n * @param {Object} tag to parse, A tag is an object with at least a {number} tag and\n * {boolean} required flag.\n * @param {boolean} test whether or not the function should throw if a required\n * tag is not found\n * @return {boolean} whether or not the tag was found\n * @throws will throw an exception if a required tag is not found and test\n * param is false or undefined, or if the stream is malformedata.\n * @memberof EBMLParser\n */\n\n\n function consumeTagAndSize(tag, test) {\n var found = consumeTag(tag, test);\n\n if (found) {\n getMatroskaCodedNum();\n }\n\n return found;\n }\n /**\n * Consumes an EBML tag from the data stream. If the tag is found then this\n * function will also remove the size field which follows the tag from the\n * data stream. It will use the value of the size field to parse a binary\n * field, using a parser defined in the tag itself\n *\n * @param {Object} tag to parse, A tag is an object with at least a {number} tag,\n * {boolean} required flag, and a parse function which takes a size parameter\n * @return {boolean} whether or not the tag was found\n * @throws will throw an exception if a required tag is not found,\n * or if the stream is malformed\n * @memberof EBMLParser\n */\n\n\n function parseTag(tag) {\n var size;\n consumeTag(tag);\n size = getMatroskaCodedNum();\n return instance[tag.parse](size);\n }\n /**\n * Consumes an EBML tag from the data stream. If the tag is found then this\n * function will also remove the size field which follows the tag from the\n * data stream. It will use the value of the size field to skip over the\n * entire section of EBML encapsulated by the tag.\n *\n * @param {Object} tag to parse, A tag is an object with at least a {number} tag, and\n * {boolean} required flag\n * @param {boolean} test a flag to indicate if an exception should be thrown\n * if a required tag is not found\n * @return {boolean} whether or not the tag was found\n * @throws will throw an exception if a required tag is not found and test is\n * false or undefined or if the stream is malformed\n * @memberof EBMLParser\n */\n\n\n function skipOverElement(tag, test) {\n var found = consumeTag(tag, test);\n var headerSize;\n\n if (found) {\n headerSize = getMatroskaCodedNum();\n pos += headerSize;\n }\n\n return found;\n }\n /**\n * Returns and consumes a number encoded according to the Matroska EBML\n * specification from the bitstream.\n *\n * @param {boolean} retainMSB whether or not to retain the Most Significant Bit (the\n * first 1). this is usually true when reading Tag IDs.\n * @return {number} the decoded number\n * @throws will throw an exception if the bit stream is malformed or there is\n * not enough data\n * @memberof EBMLParser\n */\n\n\n function getMatroskaCodedNum(retainMSB) {\n var bytesUsed = 1;\n var mask = 0x80;\n var maxBytes = 8;\n var extraBytes = -1;\n var num = 0;\n var ch = data.getUint8(pos);\n var i = 0;\n\n for (i = 0; i < maxBytes; i += 1) {\n if ((ch & mask) === mask) {\n num = retainMSB === undefined ? ch & ~mask : ch;\n extraBytes = i;\n break;\n }\n\n mask >>= 1;\n }\n\n for (i = 0; i < extraBytes; i += 1, bytesUsed += 1) {\n num = num << 8 | 0xff & data.getUint8(pos + bytesUsed);\n }\n\n pos += bytesUsed;\n return num;\n }\n /**\n * Returns and consumes a float from the bitstream.\n *\n * @param {number} size 4 or 8 byte floats are supported\n * @return {number} the decoded number\n * @throws will throw an exception if the bit stream is malformed or there is\n * not enough data\n * @memberof EBMLParser\n */\n\n\n function getMatroskaFloat(size) {\n var outFloat;\n\n switch (size) {\n case 4:\n outFloat = data.getFloat32(pos);\n pos += 4;\n break;\n\n case 8:\n outFloat = data.getFloat64(pos);\n pos += 8;\n break;\n }\n\n return outFloat;\n }\n /**\n * Consumes and returns an unsigned int from the bitstream.\n *\n * @param {number} size 1 to 8 bytes\n * @return {number} the decoded number\n * @throws will throw an exception if the bit stream is malformed or there is\n * not enough data\n * @memberof EBMLParser\n */\n\n\n function getMatroskaUint(size) {\n var val = 0;\n\n for (var i = 0; i < size; i += 1) {\n val <<= 8;\n val |= data.getUint8(pos + i) & 0xff;\n }\n\n pos += size;\n return val;\n }\n /**\n * Tests whether there is more data in the bitstream for parsing\n *\n * @return {boolean} whether there is more data to parse\n * @memberof EBMLParser\n */\n\n\n function moreData() {\n return pos < data.byteLength;\n }\n\n instance = {\n getPos: getPos,\n setPos: setPos,\n consumeTag: consumeTag,\n consumeTagAndSize: consumeTagAndSize,\n parseTag: parseTag,\n skipOverElement: skipOverElement,\n getMatroskaCodedNum: getMatroskaCodedNum,\n getMatroskaFloat: getMatroskaFloat,\n getMatroskaUint: getMatroskaUint,\n moreData: moreData\n };\n return instance;\n}\n\nEBMLParser.__dashjs_factory_name = \'EBMLParser\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(EBMLParser));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/ErrorHandler.js":\n/*!*********************************************!*\\\n !*** ./src/streaming/utils/ErrorHandler.js ***!\n \\*********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2439674__) {\n__nested_webpack_require_2439674__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2439674__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2439674__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2439674__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n/**\n * @module ErrorHandler\n * @ignore\n */\n\nfunction ErrorHandler() {\n var instance;\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_0__["default"])(context).getInstance();\n /**\n * @param {object} err DashJSError with code, message and data attributes\n * @memberof module:ErrorHandler\n */\n\n function error(err) {\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_1__["default"].ERROR, {\n error: err\n });\n }\n\n instance = {\n error: error\n };\n return instance;\n}\n\nErrorHandler.__dashjs_factory_name = \'ErrorHandler\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_2__["default"].getSingletonFactory(ErrorHandler));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/InitCache.js":\n/*!******************************************!*\\\n !*** ./src/streaming/utils/InitCache.js ***!\n \\******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2443075__) {\n__nested_webpack_require_2443075__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2443075__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * Represents data structure to keep and drive {DataChunk}\n */\n\n\nfunction InitCache() {\n var data = {};\n\n function save(chunk) {\n var id = chunk.streamId;\n var representationId = chunk.representationId;\n data[id] = data[id] || {};\n data[id][representationId] = chunk;\n }\n\n function extract(streamId, representationId) {\n if (data && data[streamId] && data[streamId][representationId]) {\n return data[streamId][representationId];\n } else {\n return null;\n }\n }\n\n function reset() {\n data = {};\n }\n\n var instance = {\n save: save,\n extract: extract,\n reset: reset\n };\n return instance;\n}\n\nInitCache.__dashjs_factory_name = \'InitCache\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(InitCache));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/IsoFile.js":\n/*!****************************************!*\\\n !*** ./src/streaming/utils/IsoFile.js ***!\n \\****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2446247__) {\n__nested_webpack_require_2446247__.r(__nested_webpack_exports__);\n/* harmony import */ var _vo_IsoBox__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2446247__(/*! ../vo/IsoBox */ "./src/streaming/vo/IsoBox.js");\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2446247__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\nfunction IsoFile() {\n var instance, parsedIsoFile;\n /**\n * @param {string} type\n * @returns {IsoBox|null}\n * @memberof IsoFile#\n */\n\n function getBox(type) {\n if (!type || !parsedIsoFile || !parsedIsoFile.boxes || parsedIsoFile.boxes.length === 0 || typeof parsedIsoFile.fetch !== \'function\') return null;\n return convertToDashIsoBox(parsedIsoFile.fetch(type));\n }\n /**\n * @param {string} type\n * @returns {Array|null} array of {@link IsoBox}\n * @memberof IsoFile#\n */\n\n\n function getBoxes(type) {\n var boxes = [];\n\n if (!type || !parsedIsoFile || typeof parsedIsoFile.fetchAll !== \'function\') {\n return boxes;\n }\n\n var boxData = parsedIsoFile.fetchAll(type);\n var box;\n\n for (var i = 0, ln = boxData.length; i < ln; i++) {\n box = convertToDashIsoBox(boxData[i]);\n\n if (box) {\n boxes.push(box);\n }\n }\n\n return boxes;\n }\n /**\n * @param {string} value\n * @memberof IsoFile#\n */\n\n\n function setData(value) {\n parsedIsoFile = value;\n }\n /**\n * @returns {IsoBox|null}\n * @memberof IsoFile#\n */\n\n\n function getLastBox() {\n if (!parsedIsoFile || !parsedIsoFile.boxes || !parsedIsoFile.boxes.length) return null;\n var type = parsedIsoFile.boxes[parsedIsoFile.boxes.length - 1].type;\n var boxes = getBoxes(type);\n return boxes.length > 0 ? boxes[boxes.length - 1] : null;\n }\n\n function convertToDashIsoBox(boxData) {\n if (!boxData) return null;\n var box = new _vo_IsoBox__WEBPACK_IMPORTED_MODULE_0__["default"](boxData);\n\n if (boxData.hasOwnProperty(\'_incomplete\')) {\n box.isComplete = !boxData._incomplete;\n }\n\n return box;\n }\n\n instance = {\n getBox: getBox,\n getBoxes: getBoxes,\n setData: setData,\n getLastBox: getLastBox\n };\n return instance;\n}\n\nIsoFile.__dashjs_factory_name = \'IsoFile\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_1__["default"].getClassFactory(IsoFile));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/ObjectUtils.js":\n/*!********************************************!*\\\n !*** ./src/streaming/utils/ObjectUtils.js ***!\n \\********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2450701__) {\n__nested_webpack_require_2450701__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2450701__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var fast_deep_equal__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2450701__(/*! fast-deep-equal */ "./node_modules/fast-deep-equal/index.js");\n/* harmony import */ var fast_deep_equal__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__nested_webpack_require_2450701__.n(fast_deep_equal__WEBPACK_IMPORTED_MODULE_1__);\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n/**\n * @module ObjectUtils\n * @ignore\n * @description Provides utility functions for objects\n */\n\nfunction ObjectUtils() {\n var instance;\n /**\n * Returns true if objects are equal\n * @return {boolean}\n * @param {object} obj1\n * @param {object} obj2\n * @memberof module:ObjectUtils\n * @instance\n */\n\n function areEqual(obj1, obj2) {\n return fast_deep_equal__WEBPACK_IMPORTED_MODULE_1___default()(obj1, obj2);\n }\n\n instance = {\n areEqual: areEqual\n };\n return instance;\n}\n\nObjectUtils.__dashjs_factory_name = \'ObjectUtils\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(ObjectUtils));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/RequestModifier.js":\n/*!************************************************!*\\\n !*** ./src/streaming/utils/RequestModifier.js ***!\n \\************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2454089__) {\n__nested_webpack_require_2454089__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2454089__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction RequestModifier() {\n var instance;\n\n function modifyRequestURL(url) {\n return url;\n }\n\n function modifyRequestHeader(request) {\n return request;\n }\n\n instance = {\n modifyRequestURL: modifyRequestURL,\n modifyRequestHeader: modifyRequestHeader\n };\n return instance;\n}\n\nRequestModifier.__dashjs_factory_name = \'RequestModifier\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(RequestModifier));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/SupervisorTools.js":\n/*!************************************************!*\\\n !*** ./src/streaming/utils/SupervisorTools.js ***!\n \\************************************************/\n/*! exports provided: checkParameterType, checkInteger, checkRange, checkIsVideoOrAudioType */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2457028__) {\n__nested_webpack_require_2457028__.r(__nested_webpack_exports__);\n/* harmony export (binding) */ __nested_webpack_require_2457028__.d(__nested_webpack_exports__, "checkParameterType", function() { return checkParameterType; });\n/* harmony export (binding) */ __nested_webpack_require_2457028__.d(__nested_webpack_exports__, "checkInteger", function() { return checkInteger; });\n/* harmony export (binding) */ __nested_webpack_require_2457028__.d(__nested_webpack_exports__, "checkRange", function() { return checkRange; });\n/* harmony export (binding) */ __nested_webpack_require_2457028__.d(__nested_webpack_exports__, "checkIsVideoOrAudioType", function() { return checkIsVideoOrAudioType; });\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2457028__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nfunction checkParameterType(parameter, type) {\n if (_typeof(parameter) !== type) {\n throw _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].BAD_ARGUMENT_ERROR;\n }\n}\nfunction checkInteger(parameter) {\n var isInt = parameter !== null && !isNaN(parameter) && parameter % 1 === 0;\n\n if (!isInt) {\n throw _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].BAD_ARGUMENT_ERROR + \' : argument is not an integer\';\n }\n}\nfunction checkRange(parameter, min, max) {\n if (parameter < min || parameter > max) {\n throw _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].BAD_ARGUMENT_ERROR + \' : argument out of range\';\n }\n}\nfunction checkIsVideoOrAudioType(type) {\n if (typeof type !== \'string\' || type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].AUDIO && type !== _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIDEO) {\n throw _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].BAD_ARGUMENT_ERROR;\n }\n}\n\n/***/ }),\n\n/***/ "./src/streaming/utils/TTMLParser.js":\n/*!*******************************************!*\\\n !*** ./src/streaming/utils/TTMLParser.js ***!\n \\*******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2461288__) {\n__nested_webpack_require_2461288__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2461288__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2461288__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/* harmony import */ var _core_EventBus__WEBPACK_IMPORTED_MODULE_2__ = __nested_webpack_require_2461288__(/*! ../../core/EventBus */ "./src/core/EventBus.js");\n/* harmony import */ var _core_events_Events__WEBPACK_IMPORTED_MODULE_3__ = __nested_webpack_require_2461288__(/*! ../../core/events/Events */ "./src/core/events/Events.js");\n/* harmony import */ var imsc__WEBPACK_IMPORTED_MODULE_4__ = __nested_webpack_require_2461288__(/*! imsc */ "./node_modules/imsc/src/main/js/main.js");\n/* harmony import */ var imsc__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__nested_webpack_require_2461288__.n(imsc__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_5__ = __nested_webpack_require_2461288__(/*! ../MediaPlayerEvents */ "./src/streaming/MediaPlayerEvents.js");\n/* harmony import */ var _constants_ConformanceViolationConstants__WEBPACK_IMPORTED_MODULE_6__ = __nested_webpack_require_2461288__(/*! ../constants/ConformanceViolationConstants */ "./src/streaming/constants/ConformanceViolationConstants.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n\n\n\n\n\n\nfunction TTMLParser() {\n var context = this.context;\n var eventBus = Object(_core_EventBus__WEBPACK_IMPORTED_MODULE_2__["default"])(context).getInstance();\n /*\n * This TTML parser follows "EBU-TT-D SUBTITLING DISTRIBUTION FORMAT - tech3380" spec - https://tech.ebu.ch/docs/tech/tech3380.pdf.\n * */\n\n var instance, logger;\n var cueCounter = 0; // Used to give every cue a unique ID.\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance().getLogger(instance);\n }\n\n function getCueID() {\n var id = \'cue_TTML_\' + cueCounter;\n cueCounter++;\n return id;\n }\n /**\n * Parse the raw data and process it to return the HTML element representing the cue.\n * Return the region to be processed and controlled (hide/show) by the caption controller.\n * @param {string} data - raw data received from the TextSourceBuffer\n * @param {number} offsetTime - offset time to apply to cue time\n * @param {integer} startTimeSegment - startTime for the current segment\n * @param {integer} endTimeSegment - endTime for the current segment\n * @param {Array} images - images array referenced by subs MP4 box\n */\n\n\n function parse(data, offsetTime, startTimeSegment, endTimeSegment, images) {\n var errorMsg = \'\';\n var captionArray = [];\n var startTime, endTime, i;\n var content = {};\n var embeddedImages = {};\n var currentImageId = \'\';\n var accumulated_image_data = \'\';\n var metadataHandler = {\n onOpenTag: function onOpenTag(ns, name, attrs) {\n // cope with existing non-compliant content\n if (attrs[\' imagetype\'] && !attrs[\' imageType\']) {\n eventBus.trigger(_MediaPlayerEvents__WEBPACK_IMPORTED_MODULE_5__["default"].CONFORMANCE_VIOLATION, {\n level: _constants_ConformanceViolationConstants__WEBPACK_IMPORTED_MODULE_6__["default"].LEVELS.ERROR,\n event: _constants_ConformanceViolationConstants__WEBPACK_IMPORTED_MODULE_6__["default"].EVENTS.NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE\n });\n attrs[\' imageType\'] = attrs[\' imagetype\'];\n }\n\n if (name === \'image\' && (ns === \'http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt\' || ns === \'http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt\')) {\n if (!attrs[\' imageType\'] || attrs[\' imageType\'].value !== \'PNG\') {\n logger.warn(\'smpte-tt imageType != PNG. Discarded\');\n return;\n }\n\n currentImageId = attrs[\'http://www.w3.org/XML/1998/namespace id\'].value;\n }\n },\n onCloseTag: function onCloseTag() {\n if (currentImageId) {\n embeddedImages[currentImageId] = accumulated_image_data.trim();\n }\n\n accumulated_image_data = \'\';\n currentImageId = \'\';\n },\n onText: function onText(contents) {\n if (currentImageId) {\n accumulated_image_data = accumulated_image_data + contents;\n }\n }\n };\n\n if (!data) {\n errorMsg = \'no ttml data to parse\';\n throw new Error(errorMsg);\n }\n\n content.data = data;\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].TTML_TO_PARSE, content);\n var imsc1doc = Object(imsc__WEBPACK_IMPORTED_MODULE_4__["fromXML"])(content.data, function (msg) {\n errorMsg = msg;\n }, metadataHandler);\n eventBus.trigger(_core_events_Events__WEBPACK_IMPORTED_MODULE_3__["default"].TTML_PARSED, {\n ttmlString: content.data,\n ttmlDoc: imsc1doc\n });\n var mediaTimeEvents = imsc1doc.getMediaTimeEvents();\n\n for (i = 0; i < mediaTimeEvents.length; i++) {\n var isd = Object(imsc__WEBPACK_IMPORTED_MODULE_4__["generateISD"])(imsc1doc, mediaTimeEvents[i], function (error) {\n errorMsg = error;\n });\n\n if (isd.contents.some(function (topLevelContents) {\n return topLevelContents.contents.length;\n })) {\n //be sure that mediaTimeEvents values are in the mp4 segment time ranges.\n startTime = mediaTimeEvents[i] + offsetTime < startTimeSegment ? startTimeSegment : mediaTimeEvents[i] + offsetTime;\n endTime = mediaTimeEvents[i + 1] + offsetTime > endTimeSegment ? endTimeSegment : mediaTimeEvents[i + 1] + offsetTime;\n\n if (startTime < endTime) {\n captionArray.push({\n start: startTime,\n end: endTime,\n type: \'html\',\n cueID: getCueID(),\n isd: isd,\n images: images,\n embeddedImages: embeddedImages\n });\n }\n }\n }\n\n if (errorMsg !== \'\') {\n logger.error(errorMsg);\n throw new Error(errorMsg);\n }\n\n return captionArray;\n }\n\n instance = {\n parse: parse\n };\n setup();\n return instance;\n}\n\nTTMLParser.__dashjs_factory_name = \'TTMLParser\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(TTMLParser));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/URLUtils.js":\n/*!*****************************************!*\\\n !*** ./src/streaming/utils/URLUtils.js ***!\n \\*****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2469655__) {\n__nested_webpack_require_2469655__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2469655__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _DefaultURLUtils__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2469655__(/*! ./DefaultURLUtils */ "./src/streaming/utils/DefaultURLUtils.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\n/**\n * @module URLUtils\n * @ignore\n * @description Provides utility functions for operating on URLs.\n * Initially this is simply a method to determine the Base URL of a URL, but\n * should probably include other things provided all over the place such as\n * determining whether a URL is relative/absolute, resolving two paths etc.\n */\n\nfunction URLUtils() {\n var instance;\n var defaultURLUtils;\n var regexUtils = [];\n var context = this.context;\n\n function getUtils(url) {\n var i;\n\n for (i = 0; i < regexUtils.length; i++) {\n var regex = regexUtils[i].regex;\n\n if (regex.test(url)) {\n return regexUtils[i].utils;\n }\n }\n\n return defaultURLUtils;\n }\n\n function setup() {\n defaultURLUtils = Object(_DefaultURLUtils__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance();\n }\n /**\n * Register a module to handle specific url.\n * @param {regex} regex - url regex\n * @param {object} utils - object that handles the regex\n * @memberof module:URLUtils\n * @instance\n */\n\n\n function registerUrlRegex(regex, utils) {\n regexUtils.push({\n regex: regex,\n utils: utils\n });\n }\n\n function internalCall(functionName, url, baseUrl) {\n var utils = getUtils(baseUrl || url);\n return utils && typeof utils[functionName] === \'function\' ? utils[functionName](url, baseUrl) : defaultURLUtils[functionName](url, baseUrl);\n }\n /**\n * Returns a string that contains the Base URL of a URL, if determinable.\n * @param {string} url - full url\n * @return {string}\n * @memberof module:URLUtils\n * @instance\n */\n\n\n function parseBaseUrl(url) {\n return internalCall(\'parseBaseUrl\', url);\n }\n /**\n * Returns a string that contains the scheme and origin of a URL,\n * if determinable.\n * @param {string} url - full url\n * @return {string}\n * @memberof module:URLUtils\n * @instance\n */\n\n\n function parseOrigin(url) {\n return internalCall(\'parseOrigin\', url);\n }\n /**\n * Returns a string that contains the fragment of a URL without scheme,\n * if determinable.\n * @param {string} url - full url\n * @return {string}\n * @memberof module:URLUtils\n * @instance\n */\n\n\n function removeHostname(url) {\n return internalCall(\'removeHostname\', url);\n }\n /**\n * Returns a string that contains the scheme of a URL, if determinable.\n * @param {string} url - full url\n * @return {string}\n * @memberof module:URLUtils\n * @instance\n */\n\n\n function parseScheme(url) {\n return internalCall(\'parseScheme\', url);\n }\n /**\n * Determines whether the url is relative.\n * @return {boolean}\n * @param {string} url\n * @memberof module:URLUtils\n * @instance\n */\n\n\n function isRelative(url) {\n return internalCall(\'isRelative\', url);\n }\n /**\n * Determines whether the url is path-absolute.\n * @return {bool}\n * @param {string} url\n * @memberof module:URLUtils\n * @instance\n */\n\n\n function isPathAbsolute(url) {\n return internalCall(\'isPathAbsolute\', url);\n }\n /**\n * Determines whether the url is scheme-relative.\n * @return {bool}\n * @param {string} url\n * @memberof module:URLUtils\n * @instance\n */\n\n\n function isSchemeRelative(url) {\n return internalCall(\'isSchemeRelative\', url);\n }\n /**\n * Determines whether the url is an HTTP-URL as defined in ISO/IEC\n * 23009-1:2014 3.1.15. ie URL with a fixed scheme of http or https\n * @return {bool}\n * @param {string} url\n * @memberof module:URLUtils\n * @instance\n */\n\n\n function isHTTPURL(url) {\n return internalCall(\'isHTTPURL\', url);\n }\n /**\n * Determines whether the supplied url has https scheme\n * @return {bool}\n * @param {string} url\n * @memberof module:URLUtils\n * @instance\n */\n\n\n function isHTTPS(url) {\n return internalCall(\'isHTTPS\', url);\n }\n /**\n * Resolves a url given an optional base url\n * @return {string}\n * @param {string} url\n * @param {string} [baseUrl]\n * @memberof module:URLUtils\n * @instance\n */\n\n\n function resolve(url, baseUrl) {\n return internalCall(\'resolve\', url, baseUrl);\n }\n\n setup();\n instance = {\n registerUrlRegex: registerUrlRegex,\n parseBaseUrl: parseBaseUrl,\n parseOrigin: parseOrigin,\n parseScheme: parseScheme,\n isRelative: isRelative,\n isPathAbsolute: isPathAbsolute,\n isSchemeRelative: isSchemeRelative,\n isHTTPURL: isHTTPURL,\n isHTTPS: isHTTPS,\n removeHostname: removeHostname,\n resolve: resolve\n };\n return instance;\n}\n\nURLUtils.__dashjs_factory_name = \'URLUtils\';\nvar factory = _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(URLUtils);\n/* harmony default export */ __nested_webpack_exports__["default"] = (factory);\n\n/***/ }),\n\n/***/ "./src/streaming/utils/VTTParser.js":\n/*!******************************************!*\\\n !*** ./src/streaming/utils/VTTParser.js ***!\n \\******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2476838__) {\n__nested_webpack_require_2476838__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2476838__(/*! ../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/* harmony import */ var _core_Debug__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2476838__(/*! ../../core/Debug */ "./src/core/Debug.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nvar WEBVTT = \'WEBVTT\';\n\nfunction VTTParser() {\n var context = this.context;\n var instance, logger, regExNewLine, regExToken, regExWhiteSpace, regExWhiteSpaceWordBoundary;\n\n function setup() {\n logger = Object(_core_Debug__WEBPACK_IMPORTED_MODULE_1__["default"])(context).getInstance().getLogger(instance);\n regExNewLine = /(?:\\r\\n|\\r|\\n)/gm;\n regExToken = /--\x3e/;\n regExWhiteSpace = /(^[\\s]+|[\\s]+$)/g;\n regExWhiteSpaceWordBoundary = /\\s\\b/g;\n }\n\n function parse(data) {\n var captionArray = [];\n var len, lastStartTime;\n\n if (!data) {\n return captionArray;\n }\n\n data = data.split(regExNewLine);\n len = data.length;\n lastStartTime = -1;\n\n for (var i = 0; i < len; i++) {\n var item = data[i];\n\n if (item.length > 0 && item !== WEBVTT) {\n if (item.match(regExToken)) {\n var attributes = parseItemAttributes(item);\n var cuePoints = attributes.cuePoints;\n var styles = attributes.styles;\n var text = getSublines(data, i + 1);\n var startTime = convertCuePointTimes(cuePoints[0].replace(regExWhiteSpace, \'\'));\n var endTime = convertCuePointTimes(cuePoints[1].replace(regExWhiteSpace, \'\'));\n\n if (!isNaN(startTime) && !isNaN(endTime) && startTime >= lastStartTime && endTime > startTime) {\n if (text !== \'\') {\n lastStartTime = startTime; //TODO Make VO external so other parsers can use.\n\n captionArray.push({\n start: startTime,\n end: endTime,\n data: text,\n styles: styles\n });\n } else {\n logger.error(\'Skipping cue due to empty/malformed cue text\');\n }\n } else {\n logger.error(\'Skipping cue due to incorrect cue timing\');\n }\n }\n }\n }\n\n return captionArray;\n }\n\n function convertCuePointTimes(time) {\n var timeArray = time.split(\':\');\n var len = timeArray.length - 1;\n time = parseInt(timeArray[len - 1], 10) * 60 + parseFloat(timeArray[len]);\n\n if (len === 2) {\n time += parseInt(timeArray[0], 10) * 3600;\n }\n\n return time;\n }\n\n function parseItemAttributes(data) {\n var vttCuePoints = data.split(regExToken);\n var arr = vttCuePoints[1].split(regExWhiteSpaceWordBoundary);\n arr.shift(); //remove first array index it is empty...\n\n vttCuePoints[1] = arr[0];\n arr.shift();\n return {\n cuePoints: vttCuePoints,\n styles: getCaptionStyles(arr)\n };\n }\n\n function getCaptionStyles(arr) {\n var styleObject = {};\n arr.forEach(function (element) {\n if (element.split(/:/).length > 1) {\n var val = element.split(/:/)[1];\n\n if (val && val.search(/%/) != -1) {\n val = parseInt(val.replace(/%/, \'\'), 10);\n }\n\n if (element.match(/align/) || element.match(/A/)) {\n styleObject.align = val;\n }\n\n if (element.match(/line/) || element.match(/L/)) {\n styleObject.line = val;\n }\n\n if (element.match(/position/) || element.match(/P/)) {\n styleObject.position = val;\n }\n\n if (element.match(/size/) || element.match(/S/)) {\n styleObject.size = val;\n }\n }\n });\n return styleObject;\n }\n /*\n * VTT can have multiple lines to display per cuepoint.\n */\n\n\n function getSublines(data, idx) {\n var i = idx;\n var subline = \'\';\n var lineData = \'\';\n var lineCount;\n\n while (data[i] !== \'\' && i < data.length) {\n i++;\n }\n\n lineCount = i - idx;\n\n if (lineCount > 1) {\n for (var j = 0; j < lineCount; j++) {\n lineData = data[idx + j];\n\n if (!lineData.match(regExToken)) {\n subline += lineData;\n\n if (j !== lineCount - 1) {\n subline += \'\\n\';\n }\n } else {\n // caption text should not have \'--\x3e\' in it\n subline = \'\';\n break;\n }\n }\n } else {\n lineData = data[idx];\n if (!lineData.match(regExToken)) subline = lineData;\n }\n\n return subline;\n }\n\n instance = {\n parse: parse\n };\n setup();\n return instance;\n}\n\nVTTParser.__dashjs_factory_name = \'VTTParser\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getSingletonFactory(VTTParser));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/baseUrlResolution/BasicSelector.js":\n/*!****************************************************************!*\\\n !*** ./src/streaming/utils/baseUrlResolution/BasicSelector.js ***!\n \\****************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2483746__) {\n__nested_webpack_require_2483746__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2483746__(/*! ../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction BasicSelector(config) {\n config = config || {};\n var instance;\n var blacklistController = config.blacklistController;\n\n function select(baseUrls) {\n var index = 0;\n var selectedBaseUrl;\n\n if (baseUrls && baseUrls.some(function (baseUrl, idx) {\n index = idx;\n return !blacklistController.contains(baseUrl.serviceLocation);\n })) {\n selectedBaseUrl = baseUrls[index];\n }\n\n return selectedBaseUrl;\n }\n\n instance = {\n select: select\n };\n return instance;\n}\n\nBasicSelector.__dashjs_factory_name = \'BasicSelector\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(BasicSelector));\n\n/***/ }),\n\n/***/ "./src/streaming/utils/baseUrlResolution/DVBSelector.js":\n/*!**************************************************************!*\\\n !*** ./src/streaming/utils/baseUrlResolution/DVBSelector.js ***!\n \\**************************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2486882__) {\n__nested_webpack_require_2486882__.r(__nested_webpack_exports__);\n/* harmony import */ var _core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2486882__(/*! ../../../core/FactoryMaker */ "./src/core/FactoryMaker.js");\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n\nfunction DVBSelector(config) {\n config = config || {};\n var instance;\n var blacklistController = config.blacklistController;\n\n function getNonBlacklistedBaseUrls(urls) {\n var removedPriorities = [];\n\n var samePrioritiesFilter = function samePrioritiesFilter(el) {\n if (removedPriorities.length) {\n if (el.dvb_priority && removedPriorities.indexOf(el.dvb_priority) !== -1) {\n return false;\n }\n }\n\n return true;\n };\n\n var serviceLocationFilter = function serviceLocationFilter(baseUrl) {\n if (blacklistController.contains(baseUrl.serviceLocation)) {\n // whenever a BaseURL is removed from the available list of\n // BaseURLs, any other BaseURL with the same @priority\n // value as the BaseURL being removed shall also be removed\n if (baseUrl.dvb_priority) {\n removedPriorities.push(baseUrl.dvb_priority);\n } // all URLs in the list which have a @serviceLocation\n // attribute matching an entry in the blacklist shall be\n // removed from the available list of BaseURLs\n\n\n return false;\n }\n\n return true;\n };\n\n return urls.filter(serviceLocationFilter).filter(samePrioritiesFilter);\n }\n\n function selectByWeight(availableUrls) {\n var prioritySorter = function prioritySorter(a, b) {\n var diff = a.dvb_priority - b.dvb_priority;\n return isNaN(diff) ? 0 : diff;\n };\n\n var topPriorityFilter = function topPriorityFilter(baseUrl, idx, arr) {\n return !idx || arr[0].dvb_priority && baseUrl.dvb_priority && arr[0].dvb_priority === baseUrl.dvb_priority;\n };\n\n var totalWeight = 0;\n var cumulWeights = [];\n var idx = 0;\n var rn, urls; // It shall begin by taking the set of resolved BaseURLs present or inherited at the current\n // position in the MPD, resolved and filtered as described in 10.8.2.1, that have the lowest\n // @priority attribute value.\n\n urls = availableUrls.sort(prioritySorter).filter(topPriorityFilter);\n\n if (urls.length) {\n if (urls.length > 1) {\n // If there is more than one BaseURL with this lowest @priority attribute value then the Player\n // shall select one of them at random such that the probability of each BaseURL being chosen\n // is proportional to the value of its @weight attribute. The method described in RFC 2782\n // [26] or picking from a number of weighted entries is suitable for this, but there may be other\n // algorithms which achieve the same effect.\n // add all the weights together, storing the accumulated weight per entry\n urls.forEach(function (baseUrl) {\n totalWeight += baseUrl.dvb_weight;\n cumulWeights.push(totalWeight);\n }); // pick a random number between zero and totalWeight\n\n rn = Math.floor(Math.random() * (totalWeight - 1)); // select the index for the range rn falls within\n\n cumulWeights.every(function (limit, index) {\n idx = index;\n\n if (rn < limit) {\n return false;\n }\n\n return true;\n });\n }\n\n return urls[idx];\n }\n }\n\n function select(baseUrls) {\n return baseUrls && selectByWeight(getNonBlacklistedBaseUrls(baseUrls));\n }\n\n instance = {\n select: select\n };\n return instance;\n}\n\nDVBSelector.__dashjs_factory_name = \'DVBSelector\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (_core_FactoryMaker__WEBPACK_IMPORTED_MODULE_0__["default"].getClassFactory(DVBSelector));\n\n/***/ }),\n\n/***/ "./src/streaming/vo/BitrateInfo.js":\n/*!*****************************************!*\\\n !*** ./src/streaming/vo/BitrateInfo.js ***!\n \\*****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2492722__) {\n__nested_webpack_require_2492722__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar BitrateInfo = function BitrateInfo() {\n _classCallCheck(this, BitrateInfo);\n\n this.mediaType = null;\n this.bitrate = null;\n this.width = null;\n this.height = null;\n this.scanType = null;\n this.qualityIndex = NaN;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (BitrateInfo);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/DashJSError.js":\n/*!*****************************************!*\\\n !*** ./src/streaming/vo/DashJSError.js ***!\n \\*****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2495386__) {\n__nested_webpack_require_2495386__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar DashJSError = function DashJSError(code, message, data) {\n _classCallCheck(this, DashJSError);\n\n this.code = code || null;\n this.message = message || null;\n this.data = data || null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (DashJSError);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/DataChunk.js":\n/*!***************************************!*\\\n !*** ./src/streaming/vo/DataChunk.js ***!\n \\***************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2498009__) {\n__nested_webpack_require_2498009__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar DataChunk = //Represents a data structure that keep all the necessary info about a single init/media segment\nfunction DataChunk() {\n _classCallCheck(this, DataChunk);\n\n this.streamId = null;\n this.mediaInfo = null;\n this.segmentType = null;\n this.quality = NaN;\n this.index = NaN;\n this.bytes = null;\n this.start = NaN;\n this.end = NaN;\n this.duration = NaN;\n this.representationId = null;\n this.endFragment = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (DataChunk);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/FragmentRequest.js":\n/*!*********************************************!*\\\n !*** ./src/streaming/vo/FragmentRequest.js ***!\n \\*********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2500895__) {\n__nested_webpack_require_2500895__.r(__nested_webpack_exports__);\n/* harmony import */ var _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2500895__(/*! ../vo/metrics/HTTPRequest */ "./src/streaming/vo/metrics/HTTPRequest.js");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\n\nvar FragmentRequest = /*#__PURE__*/function () {\n function FragmentRequest(url) {\n _classCallCheck(this, FragmentRequest);\n\n this.action = FragmentRequest.ACTION_DOWNLOAD;\n this.startTime = NaN;\n this.mediaStartTime = NaN;\n this.mediaType = null;\n this.mediaInfo = null;\n this.type = null;\n this.duration = NaN;\n this.timescale = NaN;\n this.range = null;\n this.url = url || null;\n this.serviceLocation = null;\n this.requestStartDate = null;\n this.firstByteDate = null;\n this.requestEndDate = null;\n this.quality = NaN;\n this.index = NaN;\n this.availabilityStartTime = null;\n this.availabilityEndTime = null;\n this.wallStartTime = null;\n this.bytesLoaded = NaN;\n this.bytesTotal = NaN;\n this.delayLoadingTime = NaN;\n this.responseType = \'arraybuffer\';\n this.representationId = null;\n }\n\n _createClass(FragmentRequest, [{\n key: "isInitializationRequest",\n value: function isInitializationRequest() {\n return this.type && this.type === _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_0__["HTTPRequest"].INIT_SEGMENT_TYPE;\n }\n }, {\n key: "setInfo",\n value: function setInfo(info) {\n this.type = info && info.init ? _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_0__["HTTPRequest"].INIT_SEGMENT_TYPE : _vo_metrics_HTTPRequest__WEBPACK_IMPORTED_MODULE_0__["HTTPRequest"].MEDIA_SEGMENT_TYPE;\n this.url = info && info.url ? info.url : null;\n this.range = info && info.range ? info.range.start + \'-\' + info.range.end : null;\n this.mediaType = info && info.mediaType ? info.mediaType : null;\n }\n }]);\n\n return FragmentRequest;\n}();\n\nFragmentRequest.ACTION_DOWNLOAD = \'download\';\nFragmentRequest.ACTION_COMPLETE = \'complete\';\n/* harmony default export */ __nested_webpack_exports__["default"] = (FragmentRequest);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/HeadRequest.js":\n/*!*****************************************!*\\\n !*** ./src/streaming/vo/HeadRequest.js ***!\n \\*****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2505793__) {\n__nested_webpack_require_2505793__.r(__nested_webpack_exports__);\n/* harmony import */ var _FragmentRequest__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2505793__(/*! ./FragmentRequest */ "./src/streaming/vo/FragmentRequest.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\n\n\nvar HeadRequest = /*#__PURE__*/function (_FragmentRequest) {\n _inherits(HeadRequest, _FragmentRequest);\n\n var _super = _createSuper(HeadRequest);\n\n function HeadRequest(url) {\n var _this;\n\n _classCallCheck(this, HeadRequest);\n\n _this = _super.call(this, url);\n _this.checkForExistenceOnly = true;\n return _this;\n }\n\n return HeadRequest;\n}(_FragmentRequest__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (HeadRequest);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/IsoBox.js":\n/*!************************************!*\\\n !*** ./src/streaming/vo/IsoBox.js ***!\n \\************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2511041__) {\n__nested_webpack_require_2511041__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar IsoBox = /*#__PURE__*/function () {\n function IsoBox(boxData) {\n _classCallCheck(this, IsoBox);\n\n this.offset = boxData._offset;\n this.type = boxData.type;\n this.size = boxData.size;\n this.boxes = [];\n\n if (boxData.boxes) {\n for (var i = 0; i < boxData.boxes.length; i++) {\n this.boxes.push(new IsoBox(boxData.boxes[i]));\n }\n }\n\n this.isComplete = true;\n\n switch (boxData.type) {\n case \'sidx\':\n this.timescale = boxData.timescale;\n this.earliest_presentation_time = boxData.earliest_presentation_time;\n this.first_offset = boxData.first_offset;\n this.references = boxData.references;\n\n if (boxData.references) {\n this.references = [];\n\n for (var _i = 0; _i < boxData.references.length; _i++) {\n var reference = {\n reference_type: boxData.references[_i].reference_type,\n referenced_size: boxData.references[_i].referenced_size,\n subsegment_duration: boxData.references[_i].subsegment_duration\n };\n this.references.push(reference);\n }\n }\n\n break;\n\n case \'emsg\':\n this.id = boxData.id;\n this.version = boxData.version === 1 ? 1 : 0;\n this.value = boxData.value;\n this.timescale = boxData.timescale;\n this.scheme_id_uri = boxData.scheme_id_uri;\n this.presentation_time_delta = boxData.version === 1 ? boxData.presentation_time : boxData.presentation_time_delta;\n this.event_duration = boxData.event_duration;\n this.message_data = boxData.message_data;\n break;\n\n case \'mdhd\':\n this.timescale = boxData.timescale;\n break;\n\n case \'mfhd\':\n this.sequence_number = boxData.sequence_number;\n break;\n\n case \'subs\':\n this.entry_count = boxData.entry_count;\n this.entries = boxData.entries;\n break;\n\n case \'tfhd\':\n this.base_data_offset = boxData.base_data_offset;\n this.sample_description_index = boxData.sample_description_index;\n this.default_sample_duration = boxData.default_sample_duration;\n this.default_sample_size = boxData.default_sample_size;\n this.default_sample_flags = boxData.default_sample_flags;\n this.flags = boxData.flags;\n break;\n\n case \'tfdt\':\n this.version = boxData.version;\n this.baseMediaDecodeTime = boxData.baseMediaDecodeTime;\n this.flags = boxData.flags;\n break;\n\n case \'trun\':\n this.sample_count = boxData.sample_count;\n this.first_sample_flags = boxData.first_sample_flags;\n this.data_offset = boxData.data_offset;\n this.flags = boxData.flags;\n this.samples = boxData.samples;\n\n if (boxData.samples) {\n this.samples = [];\n\n for (var _i2 = 0, ln = boxData.samples.length; _i2 < ln; _i2++) {\n var sample = {\n sample_size: boxData.samples[_i2].sample_size,\n sample_duration: boxData.samples[_i2].sample_duration,\n sample_composition_time_offset: boxData.samples[_i2].sample_composition_time_offset\n };\n this.samples.push(sample);\n }\n }\n\n break;\n }\n }\n\n _createClass(IsoBox, [{\n key: "getChildBox",\n value: function getChildBox(type) {\n for (var i = 0; i < this.boxes.length; i++) {\n if (this.boxes[i].type === type) {\n return this.boxes[i];\n }\n }\n }\n }, {\n key: "getChildBoxes",\n value: function getChildBoxes(type) {\n var boxes = [];\n\n for (var i = 0; i < this.boxes.length; i++) {\n if (this.boxes[i].type === type) {\n boxes.push(this.boxes[i]);\n }\n }\n\n return boxes;\n }\n }]);\n\n return IsoBox;\n}();\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (IsoBox);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/IsoBoxSearchInfo.js":\n/*!**********************************************!*\\\n !*** ./src/streaming/vo/IsoBoxSearchInfo.js ***!\n \\**********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2517826__) {\n__nested_webpack_require_2517826__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar IsoBoxSearchInfo = function IsoBoxSearchInfo(lastCompletedOffset, found, size) {\n _classCallCheck(this, IsoBoxSearchInfo);\n\n this.lastCompletedOffset = lastCompletedOffset;\n this.found = found;\n this.size = size;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (IsoBoxSearchInfo);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/MetricsList.js":\n/*!*****************************************!*\\\n !*** ./src/streaming/vo/MetricsList.js ***!\n \\*****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2520492__) {\n__nested_webpack_require_2520492__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar MetricsList = function MetricsList() {\n _classCallCheck(this, MetricsList);\n\n this.TcpList = [];\n this.HttpList = [];\n this.RepSwitchList = [];\n this.BufferLevel = [];\n this.BufferState = [];\n this.PlayList = [];\n this.DroppedFrames = [];\n this.SchedulingInfo = [];\n this.DVRInfo = [];\n this.ManifestUpdate = [];\n this.RequestsQueue = null;\n this.DVBErrors = [];\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (MetricsList);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/TextRequest.js":\n/*!*****************************************!*\\\n !*** ./src/streaming/vo/TextRequest.js ***!\n \\*****************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2523312__) {\n__nested_webpack_require_2523312__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_Constants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2523312__(/*! ../constants/Constants */ "./src/streaming/constants/Constants.js");\n/* harmony import */ var _FragmentRequest__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_2523312__(/*! ./FragmentRequest */ "./src/streaming/vo/FragmentRequest.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\n\n\n\nvar TextRequest = /*#__PURE__*/function (_FragmentRequest) {\n _inherits(TextRequest, _FragmentRequest);\n\n var _super = _createSuper(TextRequest);\n\n function TextRequest(url, type) {\n var _this;\n\n _classCallCheck(this, TextRequest);\n\n _this = _super.call(this);\n _this.url = url || null;\n _this.type = type || null;\n _this.mediaType = _constants_Constants__WEBPACK_IMPORTED_MODULE_0__["default"].STREAM;\n _this.responseType = \'\'; //\'text\' value returns a bad encoding response in Firefox\n\n return _this;\n }\n\n return TextRequest;\n}(_FragmentRequest__WEBPACK_IMPORTED_MODULE_1__["default"]);\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (TextRequest);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/TextTrackInfo.js":\n/*!*******************************************!*\\\n !*** ./src/streaming/vo/TextTrackInfo.js ***!\n \\*******************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2528959__) {\n__nested_webpack_require_2528959__.r(__nested_webpack_exports__);\n/* harmony import */ var _dash_vo_MediaInfo__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2528959__(/*! ./../../dash/vo/MediaInfo */ "./src/dash/vo/MediaInfo.js");\nfunction _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\n\nvar TextTrackInfo = /*#__PURE__*/function (_MediaInfo) {\n _inherits(TextTrackInfo, _MediaInfo);\n\n var _super = _createSuper(TextTrackInfo);\n\n function TextTrackInfo() {\n var _this;\n\n _classCallCheck(this, TextTrackInfo);\n\n _this = _super.call(this);\n _this.captionData = null;\n _this.label = null;\n _this.defaultTrack = false;\n _this.kind = null;\n _this.isFragmented = false;\n _this.isEmbedded = false;\n _this.isTTML = null;\n return _this;\n }\n\n return TextTrackInfo;\n}(_dash_vo_MediaInfo__WEBPACK_IMPORTED_MODULE_0__["default"]);\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (TextTrackInfo);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/Thumbnail.js":\n/*!***************************************!*\\\n !*** ./src/streaming/vo/Thumbnail.js ***!\n \\***************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2534369__) {\n__nested_webpack_require_2534369__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar Thumbnail = function Thumbnail() {\n _classCallCheck(this, Thumbnail);\n\n this.url = null;\n this.width = null;\n this.height = null;\n this.x = null;\n this.y = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (Thumbnail);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/ThumbnailTrackInfo.js":\n/*!************************************************!*\\\n !*** ./src/streaming/vo/ThumbnailTrackInfo.js ***!\n \\************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2537007__) {\n__nested_webpack_require_2537007__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar ThumbnailTrackInfo = function ThumbnailTrackInfo() {\n _classCallCheck(this, ThumbnailTrackInfo);\n\n this.bitrate = 0;\n this.width = 0;\n this.height = 0;\n this.tilesHor = 0;\n this.tilesVert = 0;\n this.widthPerTile = 0;\n this.heightPerTile = 0;\n this.startNumber = 0;\n this.segmentDuration = 0;\n this.timescale = 0;\n this.templateUrl = \'\';\n this.id = \'\';\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (ThumbnailTrackInfo);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/URIFragmentData.js":\n/*!*********************************************!*\\\n !*** ./src/streaming/vo/URIFragmentData.js ***!\n \\*********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2539839__) {\n__nested_webpack_require_2539839__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar URIFragmentData = function URIFragmentData() {\n _classCallCheck(this, URIFragmentData);\n\n this.t = null;\n this.xywh = null;\n this.track = null;\n this.id = null;\n this.s = null;\n this.r = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (URIFragmentData);\n/*\n From Spec http://www.w3.org/TR/media-frags/\n\n temporal (t) - This dimension denotes a specific time range in the original media, such as "starting at second 10, continuing until second 20";\n spatial (xywh) - this dimension denotes a specific range of pixels in the original media, such as "a rectangle with size (100,100) with its top-left at coordinate (10,10)";\n Media fragments support also addressing the media along two additional dimensions (in the advanced version defined in Media Fragments 1.0 URI (advanced)):\n track (track) - this dimension denotes one or more tracks in the original media, such as "the english audio and the video track";\n id (id) - this dimension denotes a named temporal fragment within the original media, such as "chapter 2", and can be seen as a convenient way of specifying a temporal fragment.\n\n\n ## Note\n Akamai is purposing to add #s=X to the ISO standard.\n - (X) Value would be a start time to seek to at startup instead of starting at 0 or live edge\n - Allows for seeking back before the start time unlike a temporal clipping.\n*/\n\n/***/ }),\n\n/***/ "./src/streaming/vo/metrics/BufferLevel.js":\n/*!*************************************************!*\\\n !*** ./src/streaming/vo/metrics/BufferLevel.js ***!\n \\*************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2543668__) {\n__nested_webpack_require_2543668__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar BufferLevel =\n/**\n * @description This Object holds reference to the current buffer level and the time it was recorded.\n */\nfunction BufferLevel() {\n _classCallCheck(this, BufferLevel);\n\n /**\n * Real-Time | Time of the measurement of the buffer level.\n * @public\n */\n this.t = null;\n /**\n * Level of the buffer in milliseconds. Indicates the playout duration for which\n * media data of all active media components is available starting from the\n * current playout time.\n * @public\n */\n\n this.level = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (BufferLevel);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/metrics/BufferState.js":\n/*!*************************************************!*\\\n !*** ./src/streaming/vo/metrics/BufferState.js ***!\n \\*************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2546671__) {\n__nested_webpack_require_2546671__.r(__nested_webpack_exports__);\n/* harmony import */ var _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_2546671__(/*! ../../constants/MetricsConstants */ "./src/streaming/constants/MetricsConstants.js");\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\n\nvar BufferState =\n/**\n * @description This Object holds reference to the current buffer state of the video element.\n */\nfunction BufferState() {\n _classCallCheck(this, BufferState);\n\n /**\n * The Buffer Level Target determined by the BufferLevelRule.\n * @public\n */\n this.target = null;\n /**\n * Current buffer state. Will be MetricsConstants.BUFFER_EMPTY or MetricsConstants.BUFFER_LOADED.\n * @public\n */\n\n this.state = _constants_MetricsConstants__WEBPACK_IMPORTED_MODULE_0__["default"].BUFFER_EMPTY;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (BufferState);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/metrics/DVRInfo.js":\n/*!*********************************************!*\\\n !*** ./src/streaming/vo/metrics/DVRInfo.js ***!\n \\*********************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2549840__) {\n__nested_webpack_require_2549840__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar DVRInfo =\n/**\n * @description This Object holds reference to DVR availability window information.\n */\nfunction DVRInfo() {\n _classCallCheck(this, DVRInfo);\n\n /**\n * The current time of the video element when this was created.\n * @public\n */\n this.time = null;\n /**\n * The current Segment Availability Range as an object with start and end properties.\n * It\'s delta defined by the timeShiftBufferDepth MPD attribute.\n * @public\n */\n\n this.range = null;\n /**\n * Reference to the internal ManifestInfo.js VO.\n * @public\n */\n\n this.manifestInfo = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (DVRInfo);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/metrics/DroppedFrames.js":\n/*!***************************************************!*\\\n !*** ./src/streaming/vo/metrics/DroppedFrames.js ***!\n \\***************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2552896__) {\n__nested_webpack_require_2552896__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar DroppedFrames =\n/**\n * @description This Object holds reference to DroppedFrames count and the time it was recorded.\n */\nfunction DroppedFrames() {\n _classCallCheck(this, DroppedFrames);\n\n /**\n * Real-Time | Time of the measurement of the dropped frames.\n * @public\n */\n this.time = null;\n /**\n * Number of dropped frames\n * @public\n */\n\n this.droppedFrames = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (DroppedFrames);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/metrics/HTTPRequest.js":\n/*!*************************************************!*\\\n !*** ./src/streaming/vo/metrics/HTTPRequest.js ***!\n \\*************************************************/\n/*! exports provided: HTTPRequest, HTTPRequestTrace */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2555779__) {\n__nested_webpack_require_2555779__.r(__nested_webpack_exports__);\n/* harmony export (binding) */ __nested_webpack_require_2555779__.d(__nested_webpack_exports__, "HTTPRequest", function() { return HTTPRequest; });\n/* harmony export (binding) */ __nested_webpack_require_2555779__.d(__nested_webpack_exports__, "HTTPRequestTrace", function() { return HTTPRequestTrace; });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc This Object holds reference to the HTTPRequest for manifest, fragment and xlink loading.\n * Members which are not defined in ISO23009-1 Annex D should be prefixed by a _ so that they are ignored\n * by Metrics Reporting code.\n * @ignore\n */\nvar HTTPRequest =\n/**\n * @class\n */\nfunction HTTPRequest() {\n _classCallCheck(this, HTTPRequest);\n\n /**\n * Identifier of the TCP connection on which the HTTP request was sent.\n * @public\n */\n this.tcpid = null;\n /**\n * This is an optional parameter and should not be included in HTTP request/response transactions for progressive download.\n * The type of the request:\n * - MPD\n * - XLink expansion\n * - Initialization Fragment\n * - Index Fragment\n * - Media Fragment\n * - Bitstream Switching Fragment\n * - other\n * @public\n */\n\n this.type = null;\n /**\n * The original URL (before any redirects or failures)\n * @public\n */\n\n this.url = null;\n /**\n * The actual URL requested, if different from above\n * @public\n */\n\n this.actualurl = null;\n /**\n * The contents of the byte-range-spec part of the HTTP Range header.\n * @public\n */\n\n this.range = null;\n /**\n * Real-Time | The real time at which the request was sent.\n * @public\n */\n\n this.trequest = null;\n /**\n * Real-Time | The real time at which the first byte of the response was received.\n * @public\n */\n\n this.tresponse = null;\n /**\n * The HTTP response code.\n * @public\n */\n\n this.responsecode = null;\n /**\n * The duration of the throughput trace intervals (ms), for successful requests only.\n * @public\n */\n\n this.interval = null;\n /**\n * Throughput traces, for successful requests only.\n * @public\n */\n\n this.trace = [];\n /**\n * Type of stream ("audio" | "video" etc..)\n * @public\n */\n\n this._stream = null;\n /**\n * Real-Time | The real time at which the request finished.\n * @public\n */\n\n this._tfinish = null;\n /**\n * The duration of the media requests, if available, in seconds.\n * @public\n */\n\n this._mediaduration = null;\n /**\n * The media segment quality\n * @public\n */\n\n this._quality = null;\n /**\n * all the response headers from request.\n * @public\n */\n\n this._responseHeaders = null;\n /**\n * The selected service location for the request. string.\n * @public\n */\n\n this._serviceLocation = null;\n};\n/**\n * @classdesc This Object holds reference to the progress of the HTTPRequest.\n * @ignore\n */\n\n\nvar HTTPRequestTrace =\n/**\n* @class\n*/\nfunction HTTPRequestTrace() {\n _classCallCheck(this, HTTPRequestTrace);\n\n /**\n * Real-Time | Measurement stream start.\n * @public\n */\n this.s = null;\n /**\n * Measurement stream duration (ms).\n * @public\n */\n\n this.d = null;\n /**\n * List of integers counting the bytes received in each trace interval within the measurement stream.\n * @public\n */\n\n this.b = [];\n /**\n * Measurement throughput in kbits/s\n * @public\n */\n\n this.t = null;\n};\n\nHTTPRequest.GET = \'GET\';\nHTTPRequest.HEAD = \'HEAD\';\nHTTPRequest.MPD_TYPE = \'MPD\';\nHTTPRequest.XLINK_EXPANSION_TYPE = \'XLinkExpansion\';\nHTTPRequest.INIT_SEGMENT_TYPE = \'InitializationSegment\';\nHTTPRequest.INDEX_SEGMENT_TYPE = \'IndexSegment\';\nHTTPRequest.MEDIA_SEGMENT_TYPE = \'MediaSegment\';\nHTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE = \'BitstreamSwitchingSegment\';\nHTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE = \'FragmentInfoSegment\';\nHTTPRequest.LICENSE = \'license\';\nHTTPRequest.OTHER_TYPE = \'other\';\n\n\n/***/ }),\n\n/***/ "./src/streaming/vo/metrics/ManifestUpdate.js":\n/*!****************************************************!*\\\n !*** ./src/streaming/vo/metrics/ManifestUpdate.js ***!\n \\****************************************************/\n/*! exports provided: ManifestUpdate, ManifestUpdateStreamInfo, ManifestUpdateRepresentationInfo */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2561961__) {\n__nested_webpack_require_2561961__.r(__nested_webpack_exports__);\n/* harmony export (binding) */ __nested_webpack_require_2561961__.d(__nested_webpack_exports__, "ManifestUpdate", function() { return ManifestUpdate; });\n/* harmony export (binding) */ __nested_webpack_require_2561961__.d(__nested_webpack_exports__, "ManifestUpdateStreamInfo", function() { return ManifestUpdateStreamInfo; });\n/* harmony export (binding) */ __nested_webpack_require_2561961__.d(__nested_webpack_exports__, "ManifestUpdateRepresentationInfo", function() { return ManifestUpdateRepresentationInfo; });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc This Object holds reference to the manifest update information.\n * @ignore\n */\nvar ManifestUpdate =\n/**\n * @class\n */\nfunction ManifestUpdate() {\n _classCallCheck(this, ManifestUpdate);\n\n /**\n * Media Type Video | Audio | FragmentedText\n * @public\n */\n this.mediaType = null;\n /**\n * MPD Type static | dynamic\n * @public\n */\n\n this.type = null;\n /**\n * When this manifest update was requested\n * @public\n */\n\n this.requestTime = null;\n /**\n * When this manifest update was received\n * @public\n */\n\n this.fetchTime = null;\n /**\n * Calculated Availability Start time of the stream.\n * @public\n */\n\n this.availabilityStartTime = null;\n /**\n * the seek point (liveEdge for dynamic, Stream[0].startTime for static)\n * @public\n */\n\n this.presentationStartTime = 0;\n /**\n * The calculated difference between the server and client wall clock time\n * @public\n */\n\n this.clientTimeOffset = 0;\n /**\n * Actual element.currentTime\n * @public\n */\n\n this.currentTime = null;\n /**\n * Actual element.ranges\n * @public\n */\n\n this.buffered = null;\n /**\n * Static is fixed value of zero. dynamic should be ((Now-@availabilityStartTime) - elementCurrentTime)\n * @public\n */\n\n this.latency = 0;\n /**\n * Array holding list of StreamInfo VO Objects\n * @public\n */\n\n this.streamInfo = [];\n /**\n * Array holding list of RepresentationInfo VO Objects\n * @public\n */\n\n this.representationInfo = [];\n};\n/**\n * @classdesc This Object holds reference to the current period\'s stream information when the manifest was updated.\n * @ignore\n */\n\n\nvar ManifestUpdateStreamInfo =\n/**\n * @class\n */\nfunction ManifestUpdateStreamInfo() {\n _classCallCheck(this, ManifestUpdateStreamInfo);\n\n /**\n * Stream@id\n * @public\n */\n this.id = null;\n /**\n * Period Index\n * @public\n */\n\n this.index = null;\n /**\n * Stream@start\n * @public\n */\n\n this.start = null;\n /**\n * Stream@duration\n * @public\n */\n\n this.duration = null;\n};\n/**\n * @classdesc This Object holds reference to the current representation\'s info when the manifest was updated.\n * @ignore\n */\n\n\nvar ManifestUpdateRepresentationInfo =\n/**\n * @class\n */\nfunction ManifestUpdateRepresentationInfo() {\n _classCallCheck(this, ManifestUpdateRepresentationInfo);\n\n /**\n * Track@id\n * @public\n */\n this.id = null;\n /**\n * Representation Index\n * @public\n */\n\n this.index = null;\n /**\n * Media Type Video | Audio | FragmentedText\n * @public\n */\n\n this.mediaType = null;\n /**\n * Which representation\n * @public\n */\n\n this.streamIndex = null;\n /**\n * Holds reference to @presentationTimeOffset\n * @public\n */\n\n this.presentationTimeOffset = null;\n /**\n * Holds reference to @startNumber\n * @public\n */\n\n this.startNumber = null;\n /**\n * list|template|timeline\n * @public\n */\n\n this.fragmentInfoType = null;\n};\n\n\n\n/***/ }),\n\n/***/ "./src/streaming/vo/metrics/PlayList.js":\n/*!**********************************************!*\\\n !*** ./src/streaming/vo/metrics/PlayList.js ***!\n \\**********************************************/\n/*! exports provided: PlayList, PlayListTrace */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2567700__) {\n__nested_webpack_require_2567700__.r(__nested_webpack_exports__);\n/* harmony export (binding) */ __nested_webpack_require_2567700__.d(__nested_webpack_exports__, "PlayList", function() { return PlayList; });\n/* harmony export (binding) */ __nested_webpack_require_2567700__.d(__nested_webpack_exports__, "PlayListTrace", function() { return PlayListTrace; });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @classdesc a PlayList from ISO23009-1 Annex D, this Object holds reference to the playback session information\n * @ignore\n */\nvar PlayList =\n/**\n * @class\n */\nfunction PlayList() {\n _classCallCheck(this, PlayList);\n\n /**\n * Timestamp of the user action that starts the playback stream...\n * @public\n */\n this.start = null;\n /**\n * Presentation time at which playout was requested by the user...\n * @public\n */\n\n this.mstart = null;\n /**\n * Type of user action which triggered playout\n * - New playout request (e.g. initial playout or seeking)\n * - Resume from pause\n * - Other user request (e.g. user-requested quality change)\n * - Start of a metrics collection stream (hence earlier entries in the play list not collected)\n * @public\n */\n\n this.starttype = null;\n /**\n * List of streams of continuous rendering of decoded samples.\n * @public\n */\n\n this.trace = [];\n};\n/* Public Static Constants */\n\n\nPlayList.INITIAL_PLAYOUT_START_REASON = \'initial_playout\';\nPlayList.SEEK_START_REASON = \'seek\';\nPlayList.RESUME_FROM_PAUSE_START_REASON = \'resume\';\nPlayList.METRICS_COLLECTION_START_REASON = \'metrics_collection_start\';\n/**\n * @classdesc a PlayList.Trace from ISO23009-1 Annex D\n * @ignore\n */\n\nvar PlayListTrace =\n/**\n * @class\n */\nfunction PlayListTrace() {\n _classCallCheck(this, PlayListTrace);\n\n /**\n * The value of the Representation@id of the Representation from which the samples were taken.\n * @type {string}\n * @public\n */\n this.representationid = null;\n /**\n * If not present, this metrics concerns the Representation as a whole.\n * If present, subreplevel indicates the greatest value of any\n * Subrepresentation@level being rendered.\n * @type {number}\n * @public\n */\n\n this.subreplevel = null;\n /**\n * The time at which the first sample was rendered\n * @type {number}\n * @public\n */\n\n this.start = null;\n /**\n * The presentation time of the first sample rendered.\n * @type {number}\n * @public\n */\n\n this.mstart = null;\n /**\n * The duration of the continuously presented samples (which is the same in real time and media time). "Continuously presented" means that the media clock continued to advance at the playout speed throughout the interval. NOTE: the spec does not call out the units, but all other durations etc are in ms, and we use ms too.\n * @type {number}\n * @public\n */\n\n this.duration = null;\n /**\n * The playback speed relative to normal playback speed (i.e.normal forward playback speed is 1.0).\n * @type {number}\n * @public\n */\n\n this.playbackspeed = null;\n /**\n * The reason why continuous presentation of this Representation was stopped.\n * representation switch\n * rebuffering\n * user request\n * end of Period\n * end of Stream\n * end of content\n * end of a metrics collection period\n *\n * @type {string}\n * @public\n */\n\n this.stopreason = null;\n};\n\nPlayListTrace.REPRESENTATION_SWITCH_STOP_REASON = \'representation_switch\';\nPlayListTrace.REBUFFERING_REASON = \'rebuffering\';\nPlayListTrace.USER_REQUEST_STOP_REASON = \'user_request\';\nPlayListTrace.END_OF_PERIOD_STOP_REASON = \'end_of_period\';\nPlayListTrace.END_OF_CONTENT_STOP_REASON = \'end_of_content\';\nPlayListTrace.METRICS_COLLECTION_STOP_REASON = \'metrics_collection_end\';\nPlayListTrace.FAILURE_STOP_REASON = \'failure\';\n\n\n/***/ }),\n\n/***/ "./src/streaming/vo/metrics/RepresentationSwitch.js":\n/*!**********************************************************!*\\\n !*** ./src/streaming/vo/metrics/RepresentationSwitch.js ***!\n \\**********************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2573690__) {\n__nested_webpack_require_2573690__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar RepresentationSwitch =\n/**\n * @description This Object holds reference to the info at quality switch between two representations.\n */\nfunction RepresentationSwitch() {\n _classCallCheck(this, RepresentationSwitch);\n\n /**\n * Time of the switch event.\n * @public\n */\n this.t = null;\n /**\n * The media presentation time of the earliest access unit\n * (out of all media content components) played out from\n * the Representation.\n *\n * @public\n */\n\n this.mt = null;\n /**\n * Value of Representation@id identifying the switch-to Representation.\n * @public\n */\n\n this.to = null;\n /**\n * If not present, this metrics concerns the Representation as a whole.\n * If present, lto indicates the value of SubRepresentation@level within\n * Representation identifying the switch-to level of the Representation.\n *\n * @public\n */\n\n this.lto = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (RepresentationSwitch);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/metrics/RequestsQueue.js":\n/*!***************************************************!*\\\n !*** ./src/streaming/vo/metrics/RequestsQueue.js ***!\n \\***************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2577058__) {\n__nested_webpack_require_2577058__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar RequestsQueue =\n/**\n * @description This Object holds reference to Fragment Model\'s request queues\n */\nfunction RequestsQueue() {\n _classCallCheck(this, RequestsQueue);\n\n /**\n * Array of all of the requests that have begun to load\n * This request may not make it into the executed queue if it is abandon due to ABR rules for example.\n * @public\n */\n this.loadingRequests = [];\n /**\n * Array of the The requests that have completed\n * @public\n */\n\n this.executedRequests = [];\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (RequestsQueue);\n\n/***/ }),\n\n/***/ "./src/streaming/vo/metrics/SchedulingInfo.js":\n/*!****************************************************!*\\\n !*** ./src/streaming/vo/metrics/SchedulingInfo.js ***!\n \\****************************************************/\n/*! exports provided: default */\n/***/ (function(module, __nested_webpack_exports__, __nested_webpack_require_2580043__) {\n__nested_webpack_require_2580043__.r(__nested_webpack_exports__);\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }\n\n/**\n * The copyright in this software is being made available under the BSD License,\n * included below. This software may be subject to other third party and contributor\n * rights, including patent rights, and no such rights are granted under this license.\n *\n * Copyright (c) 2013, Dash Industry Forum.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * * Neither the name of Dash Industry Forum nor the names of its\n * contributors may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @class\n * @ignore\n */\nvar SchedulingInfo =\n/**\n * @description This Object holds reference to the index handling of the current fragment being loaded or executed.\n */\nfunction SchedulingInfo() {\n _classCallCheck(this, SchedulingInfo);\n\n /**\n * Type of stream Audio | Video | FragmentedText\n * @public\n */\n this.mediaType = null;\n /**\n * Time of the scheduling event.\n * @public\n */\n\n this.t = null;\n /**\n * Type of fragment (initialization | media)\n * @public\n */\n\n this.type = null;\n /**\n * Presentation start time of fragment\n * @public\n */\n\n this.startTime = null;\n /**\n * Availability start time of fragment\n * @public\n */\n\n this.availabilityStartTime = null;\n /**\n * Duration of fragment\n * @public\n */\n\n this.duration = null;\n /**\n * Bit Rate Quality of fragment\n * @public\n */\n\n this.quality = null;\n /**\n * Range of fragment\n * @public\n */\n\n this.range = null;\n /**\n * Current state of fragment\n * @public\n */\n\n this.state = null;\n};\n\n/* harmony default export */ __nested_webpack_exports__["default"] = (SchedulingInfo);\n\n/***/ }),\n\n/***/ 0:\n/*!**********************!*\\\n !*** util (ignored) ***!\n \\**********************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n/* (ignored) */\n\n/***/ }),\n\n/***/ 1:\n/*!**********************!*\\\n !*** util (ignored) ***!\n \\**********************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n/* (ignored) */\n\n/***/ })\n\n/******/ })["default"];\n});\n\n});\n\nvar dashjs$1 = unwrapExports(dash_all_debug);\n\n/**\n * Setup audio tracks. Take the tracks from dash and add the tracks to videojs. Listen for when\n * videojs changes tracks and apply that to the dash player because videojs doesn\'t do this\n * natively.\n *\n * @private\n * @param {videojs} player the videojs player instance\n * @param {videojs.tech} tech the videojs tech being used\n */\n\nfunction handlePlaybackMetadataLoaded(player, tech) {\n var mediaPlayer = player.dash.mediaPlayer;\n var dashAudioTracks = mediaPlayer.getTracksFor(\'audio\');\n var videojsAudioTracks = player.audioTracks();\n\n function generateIdFromTrackIndex(index) {\n return "dash-audio-" + index;\n }\n\n function findDashAudioTrack(subDashAudioTracks, videojsAudioTrack) {\n return subDashAudioTracks.find(function (_ref) {\n var index = _ref.index;\n return generateIdFromTrackIndex(index) === videojsAudioTrack.id;\n });\n } // Safari creates a single native `AudioTrack` (not `videojs.AudioTrack`) when loading. Clear all\n // automatically generated audio tracks so we can create them all ourself.\n\n\n if (videojsAudioTracks.length) {\n tech.clearTracks([\'audio\']);\n }\n\n var currentAudioTrack = mediaPlayer.getCurrentTrackFor(\'audio\');\n dashAudioTracks.forEach(function (dashTrack) {\n var localizedLabel;\n\n if (Array.isArray(dashTrack.labels)) {\n for (var i = 0; i < dashTrack.labels.length; i++) {\n if (dashTrack.labels[i].lang && player.language().indexOf(dashTrack.labels[i].lang.toLowerCase()) !== -1) {\n localizedLabel = dashTrack.labels[i];\n break;\n }\n }\n }\n\n var label;\n\n if (localizedLabel) {\n label = localizedLabel.text;\n } else if (Array.isArray(dashTrack.labels) && dashTrack.labels.length === 1) {\n label = dashTrack.labels[0].text;\n } else {\n label = dashTrack.lang;\n\n if (dashTrack.roles && dashTrack.roles.length) {\n label += \' (\' + dashTrack.roles.join(\', \') + \')\';\n }\n } // Add the track to the player\'s audio track list.\n\n\n videojsAudioTracks.addTrack(new video_js__WEBPACK_IMPORTED_MODULE_0__["default"].AudioTrack({\n enabled: dashTrack === currentAudioTrack,\n id: generateIdFromTrackIndex(dashTrack.index),\n kind: dashTrack.kind || \'main\',\n label: label,\n language: dashTrack.lang\n }));\n });\n\n var audioTracksChangeHandler = function audioTracksChangeHandler() {\n for (var i = 0; i < videojsAudioTracks.length; i++) {\n var track = videojsAudioTracks[i];\n\n if (track.enabled) {\n // Find the audio track we just selected by the id\n var dashAudioTrack = findDashAudioTrack(dashAudioTracks, track); // Set is as the current track\n\n mediaPlayer.setCurrentTrack(dashAudioTrack); // Stop looping\n\n continue;\n }\n }\n };\n\n videojsAudioTracks.addEventListener(\'change\', audioTracksChangeHandler);\n player.dash.mediaPlayer.on(dashjs$1.MediaPlayer.events.STREAM_TEARDOWN_COMPLETE, function () {\n videojsAudioTracks.removeEventListener(\'change\', audioTracksChangeHandler);\n });\n}\n/*\n * Call `handlePlaybackMetadataLoaded` when `mediaPlayer` emits\n * `dashjs.MediaPlayer.events.PLAYBACK_METADATA_LOADED`.\n */\n\n\nfunction setupAudioTracks(player, tech) {\n // When `dashjs` finishes loading metadata, create audio tracks for `video.js`.\n player.dash.mediaPlayer.on(dashjs$1.MediaPlayer.events.PLAYBACK_METADATA_LOADED, handlePlaybackMetadataLoaded.bind(null, player, tech));\n}\n\nfunction find(l, f) {\n for (var i = 0; i < l.length; i++) {\n if (f(l[i])) {\n return l[i];\n }\n }\n}\n/*\n * Attach text tracks from dash.js to videojs\n *\n * @param {videojs} player the videojs player instance\n * @param {array} tracks the tracks loaded by dash.js to attach to videojs\n *\n * @private\n */\n\n\nfunction attachDashTextTracksToVideojs(player, tech, tracks) {\n var trackDictionary = []; // Add remote tracks\n\n var tracksAttached = tracks // Map input data to match HTMLTrackElement spec\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLTrackElement\n .map(function (track) {\n var localizedLabel;\n\n if (Array.isArray(track.labels)) {\n for (var i = 0; i < track.labels.length; i++) {\n if (track.labels[i].lang && player.language().indexOf(track.labels[i].lang.toLowerCase()) !== -1) {\n localizedLabel = track.labels[i];\n break;\n }\n }\n }\n\n var label;\n\n if (localizedLabel) {\n label = localizedLabel.text;\n } else if (Array.isArray(track.labels) && track.labels.length === 1) {\n label = track.labels[0].text;\n } else {\n label = track.lang || track.label;\n }\n\n return {\n dashTrack: track,\n trackConfig: {\n label: label,\n language: track.lang,\n srclang: track.lang,\n kind: track.kind\n }\n };\n }) // Add track to videojs track list\n .map(function (_ref) {\n var trackConfig = _ref.trackConfig,\n dashTrack = _ref.dashTrack;\n\n if (dashTrack.isTTML && !player.getChild(\'TTMLTextTrackDisplay\')) {\n return null;\n }\n\n var remoteTextTrack = player.addRemoteTextTrack(trackConfig, false);\n trackDictionary.push({\n textTrack: remoteTextTrack.track,\n dashTrack: dashTrack\n }); // Don\'t add the cues becuase we\'re going to let dash handle it natively. This will ensure\n // that dash handle external time text files and fragmented text tracks.\n //\n // Example file with external time text files:\n // https://storage.googleapis.com/shaka-demo-assets/sintel-mp4-wvtt/dash.mpd\n\n return remoteTextTrack;\n }).filter(function (el) {\n return el !== null;\n });\n /*\n * Scan `videojs.textTracks()` to find one that is showing. Set the dash text track.\n */\n\n function updateActiveDashTextTrack() {\n var dashMediaPlayer = player.dash.mediaPlayer;\n var textTracks = player.textTracks();\n var activeTextTrackIndex = -1; // Iterate through the tracks and find the one marked as showing. If none are showing,\n // `activeTextTrackIndex` will be set to `-1`, disabling text tracks.\n\n var _loop = function _loop(i) {\n var textTrack = textTracks[i];\n\n if (textTrack.mode === \'showing\') {\n // Find the dash track we want to use\n\n /* jshint loopfunc: true */\n var dictionaryLookupResult = find(trackDictionary, function (track) {\n return track.textTrack === textTrack;\n });\n /* jshint loopfunc: false */\n\n var dashTrackToActivate = dictionaryLookupResult ? dictionaryLookupResult.dashTrack : null; // If we found a track, get it\'s index.\n\n if (dashTrackToActivate) {\n activeTextTrackIndex = tracks.indexOf(dashTrackToActivate);\n }\n }\n };\n\n for (var i = 0; i < textTracks.length; i += 1) {\n _loop(i);\n } // If the text track has changed, then set it in dash\n\n\n if (activeTextTrackIndex !== dashMediaPlayer.getCurrentTextTrackIndex()) {\n dashMediaPlayer.setTextTrack(activeTextTrackIndex);\n }\n } // Update dash when videojs\'s selected text track changes.\n\n\n player.textTracks().on(\'change\', updateActiveDashTextTrack); // Cleanup event listeners whenever we start loading a new source\n\n player.dash.mediaPlayer.on(dashjs$1.MediaPlayer.events.STREAM_TEARDOWN_COMPLETE, function () {\n player.textTracks().off(\'change\', updateActiveDashTextTrack);\n }); // Initialize the text track on our first run-through\n\n updateActiveDashTextTrack();\n return tracksAttached;\n}\n/*\n * Wait for dash to emit `TEXT_TRACKS_ADDED` and then attach the text tracks loaded by dash if\n * we\'re not using native text tracks.\n *\n * @param {videojs} player the videojs player instance\n * @private\n */\n\n\nfunction setupTextTracks(player, tech, options) {\n // Clear VTTCue if it was shimmed by vttjs and let dash.js use TextTrackCue.\n // This is necessary because dash.js creates text tracks\n // using addTextTrack which is incompatible with vttjs.VTTCue in IE11\n if ((global_window__WEBPACK_IMPORTED_MODULE_1___default().VTTCue) && !/\\[native code\\]/.test(global_window__WEBPACK_IMPORTED_MODULE_1___default().VTTCue.toString())) {\n (global_window__WEBPACK_IMPORTED_MODULE_1___default().VTTCue) = false;\n } // Store the tracks that we\'ve added so we can remove them later.\n\n\n var dashTracksAttachedToVideoJs = []; // We\'re relying on the user to disable native captions. Show an error if they didn\'t do so.\n\n if (tech.featuresNativeTextTracks) {\n video_js__WEBPACK_IMPORTED_MODULE_0__["default"].log.error(\'You must pass {html: {nativeCaptions: false}} in the videojs constructor \' + \'to use text tracks in videojs-contrib-dash\');\n return;\n }\n\n var mediaPlayer = player.dash.mediaPlayer; // Clear the tracks that we added. We don\'t clear them all because someone else can add tracks.\n\n function clearDashTracks() {\n dashTracksAttachedToVideoJs.forEach(player.removeRemoteTextTrack.bind(player));\n dashTracksAttachedToVideoJs = [];\n }\n\n function handleTextTracksAdded(_ref2) {\n var index = _ref2.index,\n tracks = _ref2.tracks;\n // Stop listening for this event. We only want to hear it once.\n mediaPlayer.off(dashjs$1.MediaPlayer.events.TEXT_TRACKS_ADDED, handleTextTracksAdded); // Cleanup old tracks\n\n clearDashTracks();\n\n if (!tracks.length) {\n // Don\'t try to add text tracks if there aren\'t any\n return;\n } // Save the tracks so we can remove them later\n\n\n dashTracksAttachedToVideoJs = attachDashTextTracksToVideojs(player, tech, tracks, options);\n } // Attach dash text tracks whenever we dash emits `TEXT_TRACKS_ADDED`.\n\n\n mediaPlayer.on(dashjs$1.MediaPlayer.events.TEXT_TRACKS_ADDED, handleTextTracksAdded); // When the player can play, remove the initialization events. We might not have received\n // TEXT_TRACKS_ADDED` so we have to stop listening for it or we\'ll get errors when we load new\n // videos and are listening for the same event in multiple places, including cleaned up\n // mediaPlayers.\n\n mediaPlayer.on(dashjs$1.MediaPlayer.events.CAN_PLAY, function () {\n mediaPlayer.off(dashjs$1.MediaPlayer.events.TEXT_TRACKS_ADDED, handleTextTracksAdded);\n });\n}\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n\n _setPrototypeOf(subClass, superClass);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");\n }\n\n return self;\n}\n\nvar Component = video_js__WEBPACK_IMPORTED_MODULE_0__["default"].getComponent(\'Component\');\nvar darkGray = \'#222\';\nvar lightGray = \'#ccc\';\nvar fontMap = {\n monospace: \'monospace\',\n sansSerif: \'sans-serif\',\n serif: \'serif\',\n monospaceSansSerif: \'"Andale Mono", "Lucida Console", monospace\',\n monospaceSerif: \'"Courier New", monospace\',\n proportionalSansSerif: \'sans-serif\',\n proportionalSerif: \'serif\',\n casual: \'"Comic Sans MS", Impact, fantasy\',\n script: \'"Monotype Corsiva", cursive\',\n smallcaps: \'"Andale Mono", "Lucida Console", monospace, sans-serif\'\n};\n/**\n * Try to update the style of a DOM element. Some style changes will throw an error,\n * particularly in IE8. Those should be noops.\n *\n * @param {Element} el\n * The DOM element to be styled.\n *\n * @param {string} style\n * The CSS property on the element that should be styled.\n *\n * @param {string} rule\n * The style rule that should be applied to the property.\n *\n * @private\n */\n\nfunction tryUpdateStyle(el, style, rule) {\n try {\n el.style[style] = rule;\n } catch (e) {\n // Satisfies linter.\n return;\n }\n}\n\nfunction removeStyle(el) {\n if (el.style) {\n el.style.left = null;\n el.style.width = \'100%\';\n }\n\n for (var i in el.children) {\n removeStyle(el.children[i]);\n }\n}\n/**\n * Construct an rgba color from a given hex color code.\n *\n * @param {number} color\n * Hex number for color, like #f0e or #f604e2.\n *\n * @param {number} opacity\n * Value for opacity, 0.0 - 1.0.\n *\n * @return {string}\n * The rgba color that was created, like \'rgba(255, 0, 0, 0.3)\'.\n */\n\n\nfunction constructColor(color, opacity) {\n var hex;\n\n if (color.length === 4) {\n // color looks like "#f0e"\n hex = color[1] + color[1] + color[2] + color[2] + color[3] + color[3];\n } else if (color.length === 7) {\n // color looks like "#f604e2"\n hex = color.slice(1);\n } else {\n throw new Error(\'Invalid color code provided, \' + color + \'; must be formatted as e.g. #f0e or #f604e2.\');\n }\n\n return \'rgba(\' + parseInt(hex.slice(0, 2), 16) + \',\' + parseInt(hex.slice(2, 4), 16) + \',\' + parseInt(hex.slice(4, 6), 16) + \',\' + opacity + \')\';\n}\n/**\n * The component for displaying text track cues.\n *\n * @extends Component\n */\n\nvar TTMLTextTrackDisplay = /*#__PURE__*/function (_Component) {\n _inheritsLoose(TTMLTextTrackDisplay, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} [ready]\n * The function to call when `TextTrackDisplay` is ready.\n */\n function TTMLTextTrackDisplay(player, options, ready) {\n var _this;\n\n _this = _Component.call(this, player, video_js__WEBPACK_IMPORTED_MODULE_0__["default"].mergeOptions(options, {\n playerOptions: {}\n }), ready) || this;\n var selects = player.getChild(\'TextTrackSettings\').$$(\'select\');\n\n for (var i = 0; i < selects.length; i++) {\n _this.on(selects[i], \'change\', _this.updateStyle.bind(_assertThisInitialized(_this)));\n }\n\n player.dash.mediaPlayer.on(dashjs$1.MediaPlayer.events.CAPTION_RENDERED, _this.updateStyle.bind(_assertThisInitialized(_this)));\n return _this;\n }\n /**\n * Create the {@link Component}\'s DOM element.\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = TTMLTextTrackDisplay.prototype;\n\n _proto.createEl = function createEl() {\n var newEl = _Component.prototype.createEl.call(this, \'div\', {\n className: \'vjs-text-track-display-ttml\'\n }, {\n \'aria-live\': \'off\',\n \'aria-atomic\': \'true\'\n });\n\n newEl.style.position = \'absolute\';\n newEl.style.left = \'0\';\n newEl.style.right = \'0\';\n newEl.style.top = \'0\';\n newEl.style.bottom = \'0\';\n newEl.style.margin = \'1.5%\';\n return newEl;\n };\n\n _proto.updateStyle = function updateStyle(_ref) {\n var captionDiv = _ref.captionDiv;\n\n if (!this.player_.textTrackSettings) {\n return;\n }\n\n var overrides = this.player_.textTrackSettings.getValues();\n captionDiv = captionDiv || this.player_.getChild(\'TTMLTextTrackDisplay\').el().firstChild;\n\n if (!captionDiv) {\n return;\n }\n\n removeStyle(captionDiv);\n var spans = captionDiv.getElementsByTagName(\'span\');\n\n for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n span.parentNode.style.textAlign = \'center\';\n\n if (overrides.color) {\n span.style.color = overrides.color;\n }\n\n if (overrides.textOpacity) {\n tryUpdateStyle(span, \'color\', constructColor(overrides.color || \'#fff\', overrides.textOpacity));\n }\n\n if (overrides.backgroundColor) {\n span.style.backgroundColor = overrides.backgroundColor;\n }\n\n if (overrides.backgroundOpacity) {\n tryUpdateStyle(span, \'backgroundColor\', constructColor(overrides.backgroundColor || \'#000\', overrides.backgroundOpacity));\n }\n\n if (overrides.windowColor) {\n if (overrides.windowOpacity) {\n tryUpdateStyle(span.parentNode, \'backgroundColor\', constructColor(overrides.windowColor, overrides.windowOpacity));\n } else {\n span.parent.style.backgroundColor = overrides.windowColor;\n }\n }\n\n if (overrides.edgeStyle) {\n if (overrides.edgeStyle === \'dropshadow\') {\n span.style.textShadow = "2px 2px 3px " + darkGray + ", 2px 2px 4px " + darkGray + ", 2px 2px 5px " + darkGray;\n } else if (overrides.edgeStyle === \'raised\') {\n span.style.textShadow = "1px 1px " + darkGray + ", 2px 2px " + darkGray + ", 3px 3px " + darkGray;\n } else if (overrides.edgeStyle === \'depressed\') {\n span.style.textShadow = "1px 1px " + lightGray + ", 0 1px " + lightGray + ", -1px -1px " + darkGray + ", 0 -1px " + darkGray;\n } else if (overrides.edgeStyle === \'uniform\') {\n span.style.textShadow = "0 0 4px " + darkGray + ", 0 0 4px " + darkGray + ", 0 0 4px " + darkGray + ", 0 0 4px " + darkGray;\n }\n }\n\n if (overrides.fontPercent && overrides.fontPercent !== 1) {\n var fontSize = global_window__WEBPACK_IMPORTED_MODULE_1___default().parseFloat(span.style.fontSize);\n span.style.fontSize = fontSize * overrides.fontPercent + \'px\';\n span.style.height = \'auto\';\n span.style.top = \'auto\';\n span.style.bottom = \'2px\';\n }\n\n if (overrides.fontFamily && overrides.fontFamily !== \'default\') {\n if (overrides.fontFamily === \'small-caps\') {\n span.style.fontVariant = \'small-caps\';\n } else {\n span.style.fontFamily = fontMap[overrides.fontFamily];\n }\n }\n }\n };\n\n return TTMLTextTrackDisplay;\n}(Component);\n\nvideo_js__WEBPACK_IMPORTED_MODULE_0__["default"].registerComponent(\'TTMLTextTrackDisplay\', TTMLTextTrackDisplay);\n\n/**\n * videojs-contrib-dash\n *\n * Use Dash.js to playback DASH content inside of Video.js via a SourceHandler\n */\n\nvar Html5DashJS = /*#__PURE__*/function () {\n function Html5DashJS(source, tech, options) {\n var _this = this;\n\n // Get options from tech if not provided for backwards compatibility\n options = options || tech.options_;\n this.player = (0,video_js__WEBPACK_IMPORTED_MODULE_0__["default"])(options.playerId);\n this.player.dash = this.player.dash || {};\n this.tech_ = tech;\n this.el_ = tech.el();\n this.elParent_ = this.el_.parentNode;\n this.hasFiniteDuration_ = false; // Do nothing if the src is falsey\n\n if (!source.src) {\n return;\n } // While the manifest is loading and Dash.js has not finished initializing\n // we must defer events and functions calls with isReady_ and then `triggerReady`\n // again later once everything is setup\n\n\n tech.isReady_ = false;\n\n if (Html5DashJS.updateSourceData) {\n video_js__WEBPACK_IMPORTED_MODULE_0__["default"].log.warn(\'updateSourceData has been deprecated.\' + \' Please switch to using hook("updatesource", callback).\');\n source = Html5DashJS.updateSourceData(source);\n } // call updatesource hooks\n\n\n Html5DashJS.hooks(\'updatesource\').forEach(function (hook) {\n source = hook(source);\n });\n var manifestSource = source.src;\n this.keySystemOptions_ = Html5DashJS.buildDashJSProtData(source.keySystemOptions);\n this.player.dash.mediaPlayer = dashjs$1.MediaPlayer().create();\n this.mediaPlayer_ = this.player.dash.mediaPlayer; // Log MedaPlayer messages through video.js\n\n if (Html5DashJS.useVideoJSDebug) {\n video_js__WEBPACK_IMPORTED_MODULE_0__["default"].log.warn(\'useVideoJSDebug has been deprecated.\' + \' Please switch to using hook("beforeinitialize", callback).\');\n Html5DashJS.useVideoJSDebug(this.mediaPlayer_);\n }\n\n if (Html5DashJS.beforeInitialize) {\n video_js__WEBPACK_IMPORTED_MODULE_0__["default"].log.warn(\'beforeInitialize has been deprecated.\' + \' Please switch to using hook("beforeinitialize", callback).\');\n Html5DashJS.beforeInitialize(this.player, this.mediaPlayer_);\n }\n\n Html5DashJS.hooks(\'beforeinitialize\').forEach(function (hook) {\n hook(_this.player, _this.mediaPlayer_);\n }); // Must run controller before these two lines or else there is no\n // element to bind to.\n\n this.mediaPlayer_.initialize(); // Retrigger a dash.js-specific error event as a player error\n // See src/streaming/utils/ErrorHandler.js in dash.js code\n // Handled with error (playback is stopped):\n // - capabilityError\n // - downloadError\n // - manifestError\n // - mediaSourceError\n // - mediaKeySessionError\n // Not handled:\n // - timedTextError (video can still play)\n // - mediaKeyMessageError (only fires under \'might not work\' circumstances)\n\n this.retriggerError_ = function (event) {\n if (event.error === \'capability\' && event.event === \'mediasource\') {\n // No support for MSE\n _this.player.error({\n code: 4,\n message: \'The media cannot be played because it requires a feature \' + \'that your browser does not support.\'\n });\n } else if (event.error === \'manifestError\' && ( // Manifest type not supported\n event.event.id === \'createParser\' || // Codec(s) not supported\n event.event.id === \'codec\' || // No streams available to stream\n event.event.id === \'nostreams\' || // Error creating Stream object\n event.event.id === \'nostreamscomposed\' || // syntax error parsing the manifest\n event.event.id === \'parse\' || // a stream has multiplexed audio+video\n event.event.id === \'multiplexedrep\')) {\n // These errors have useful error messages, so we forward it on\n _this.player.error({\n code: 4,\n message: event.event.message\n });\n } else if (event.error === \'mediasource\') {\n // This error happens when dash.js fails to allocate a SourceBuffer\n // OR the underlying video element throws a `MediaError`.\n // If it\'s a buffer allocation fail, the message states which buffer\n // (audio/video/text) failed allocation.\n // If it\'s a `MediaError`, dash.js inspects the error object for\n // additional information to append to the error type.\n if (event.event.match(\'MEDIA_ERR_ABORTED\')) {\n _this.player.error({\n code: 1,\n message: event.event\n });\n } else if (event.event.match(\'MEDIA_ERR_NETWORK\')) {\n _this.player.error({\n code: 2,\n message: event.event\n });\n } else if (event.event.match(\'MEDIA_ERR_DECODE\')) {\n _this.player.error({\n code: 3,\n message: event.event\n });\n } else if (event.event.match(\'MEDIA_ERR_SRC_NOT_SUPPORTED\')) {\n _this.player.error({\n code: 4,\n message: event.event\n });\n } else if (event.event.match(\'MEDIA_ERR_ENCRYPTED\')) {\n _this.player.error({\n code: 5,\n message: event.event\n });\n } else if (event.event.match(\'UNKNOWN\')) {\n // We shouldn\'t ever end up here, since this would mean a\n // `MediaError` thrown by the video element that doesn\'t comply\n // with the W3C spec. But, since we should handle the error,\n // throwing a MEDIA_ERR_SRC_NOT_SUPPORTED is probably the\n // most reasonable thing to do.\n _this.player.error({\n code: 4,\n message: event.event\n });\n } else {\n // Buffer allocation error\n _this.player.error({\n code: 4,\n message: event.event\n });\n }\n } else if (event.error === \'capability\' && event.event === \'encryptedmedia\') {\n // Browser doesn\'t support EME\n _this.player.error({\n code: 5,\n message: \'The media cannot be played because it requires encryption \' + \'features that your browser does not support.\'\n });\n } else if (event.error === \'key_session\') {\n // This block handles pretty much all errors thrown by the\n // encryption subsystem\n _this.player.error({\n code: 5,\n message: event.event\n });\n } else if (event.error === \'download\') {\n _this.player.error({\n code: 2,\n message: \'The media playback was aborted because too many consecutive \' + \'download errors occurred.\'\n });\n } else if (event.error === \'mssError\') {\n _this.player.error({\n code: 3,\n message: event.event\n });\n } else {\n // ignore the error\n return;\n } // only reset the dash player in 10ms async, so that the rest of the\n // calling function finishes\n\n\n setTimeout(function () {\n _this.mediaPlayer_.reset();\n }, 10);\n };\n\n this.mediaPlayer_.on(dashjs$1.MediaPlayer.events.ERROR, this.retriggerError_);\n\n this.getDuration_ = function (event) {\n var periods = event.data.Period_asArray;\n var oldHasFiniteDuration = _this.hasFiniteDuration_;\n\n if (event.data.mediaPresentationDuration || periods[periods.length - 1].duration) {\n _this.hasFiniteDuration_ = true;\n } else {\n // in case we run into a weird situation where we\'re VOD but then\n // switch to live\n _this.hasFiniteDuration_ = false;\n }\n\n if (_this.hasFiniteDuration_ !== oldHasFiniteDuration) {\n _this.player.trigger(\'durationchange\');\n }\n };\n\n this.mediaPlayer_.on(dashjs$1.MediaPlayer.events.MANIFEST_LOADED, this.getDuration_); // Apply all dash options that are set\n\n if (options.dash) {\n Object.keys(options.dash).forEach(function (key) {\n var _this$mediaPlayer_;\n\n if (key === \'useTTML\') {\n return;\n }\n\n var dashOptionsKey = \'set\' + key.charAt(0).toUpperCase() + key.slice(1);\n var value = options.dash[key];\n\n if (_this.mediaPlayer_.hasOwnProperty(dashOptionsKey)) {\n // Providing a key without `set` prefix is now deprecated.\n video_js__WEBPACK_IMPORTED_MODULE_0__["default"].log.warn(\'Using dash options in videojs-contrib-dash without the set prefix \' + ("has been deprecated. Change \'" + key + "\' to \'" + dashOptionsKey + "\'")); // Set key so it will still work\n\n key = dashOptionsKey;\n }\n\n if (!_this.mediaPlayer_.hasOwnProperty(key)) {\n video_js__WEBPACK_IMPORTED_MODULE_0__["default"].log.warn("Warning: dash configuration option unrecognized: " + key);\n return;\n } // Guarantee `value` is an array\n\n\n if (!Array.isArray(value)) {\n value = [value];\n }\n\n (_this$mediaPlayer_ = _this.mediaPlayer_)[key].apply(_this$mediaPlayer_, value);\n });\n }\n\n this.mediaPlayer_.attachView(this.el_);\n\n if (options.dash && options.dash.useTTML) {\n this.ttmlContainer_ = this.player.addChild(\'TTMLTextTrackDisplay\');\n this.mediaPlayer_.attachTTMLRenderingDiv(this.ttmlContainer_.el());\n } // Dash.js autoplays by default, video.js will handle autoplay\n\n\n this.mediaPlayer_.setAutoPlay(false); // Setup audio tracks\n\n setupAudioTracks.call(null, this.player, tech); // Setup text tracks\n\n setupTextTracks.call(null, this.player, tech, options); // Attach the source with any protection data\n\n this.mediaPlayer_.setProtectionData(this.keySystemOptions_);\n this.mediaPlayer_.attachSource(manifestSource);\n this.tech_.triggerReady();\n }\n /*\n * Iterate over the `keySystemOptions` array and convert each object into\n * the type of object Dash.js expects in the `protData` argument.\n *\n * Also rename \'licenseUrl\' property in the options to an \'serverURL\' property\n */\n\n\n Html5DashJS.buildDashJSProtData = function buildDashJSProtData(keySystemOptions) {\n var output = {};\n\n if (!keySystemOptions || !Array.isArray(keySystemOptions)) {\n return null;\n }\n\n for (var i = 0; i < keySystemOptions.length; i++) {\n var keySystem = keySystemOptions[i];\n var options = video_js__WEBPACK_IMPORTED_MODULE_0__["default"].mergeOptions({}, keySystem.options);\n\n if (options.licenseUrl) {\n options.serverURL = options.licenseUrl;\n delete options.licenseUrl;\n }\n\n output[keySystem.name] = options;\n }\n\n return output;\n };\n\n var _proto = Html5DashJS.prototype;\n\n _proto.dispose = function dispose() {\n if (this.mediaPlayer_) {\n this.mediaPlayer_.off(dashjs$1.MediaPlayer.events.ERROR, this.retriggerError_);\n this.mediaPlayer_.off(dashjs$1.MediaPlayer.events.MANIFEST_LOADED, this.getDuration_);\n this.mediaPlayer_.reset();\n }\n\n if (this.player.dash) {\n delete this.player.dash;\n }\n\n if (this.ttmlContainer_) {\n this.ttmlContainer_.dispose();\n this.player.removeChild(\'TTMLTextTrackDisplay\');\n }\n };\n\n _proto.duration = function duration() {\n if (this.mediaPlayer_.isDynamic() && !this.hasFiniteDuration_) {\n return Infinity;\n }\n\n return this.mediaPlayer_.duration();\n }\n /**\n * Get a list of hooks for a specific lifecycle\n *\n * @param {string} type the lifecycle to get hooks from\n * @param {Function|Function[]} [hook] Optionally add a hook tothe lifecycle\n * @return {Array} an array of hooks or epty if none\n * @method hooks\n */\n ;\n\n Html5DashJS.hooks = function hooks(type, hook) {\n Html5DashJS.hooks_[type] = Html5DashJS.hooks_[type] || [];\n\n if (hook) {\n Html5DashJS.hooks_[type] = Html5DashJS.hooks_[type].concat(hook);\n }\n\n return Html5DashJS.hooks_[type];\n }\n /**\n * Add a function hook to a specific dash lifecycle\n *\n * @param {string} type the lifecycle to hook the function to\n * @param {Function|Function[]} hook the function or array of functions to attach\n * @method hook\n */\n ;\n\n Html5DashJS.hook = function hook(type, _hook) {\n Html5DashJS.hooks(type, _hook);\n }\n /**\n * Remove a hook from a specific dash lifecycle.\n *\n * @param {string} type the lifecycle that the function hooked to\n * @param {Function} hook The hooked function to remove\n * @return {boolean} True if the function was removed, false if not found\n * @method removeHook\n */\n ;\n\n Html5DashJS.removeHook = function removeHook(type, hook) {\n var index = Html5DashJS.hooks(type).indexOf(hook);\n\n if (index === -1) {\n return false;\n }\n\n Html5DashJS.hooks_[type] = Html5DashJS.hooks_[type].slice();\n Html5DashJS.hooks_[type].splice(index, 1);\n return true;\n };\n\n return Html5DashJS;\n}();\n\nHtml5DashJS.hooks_ = {};\n\nvar canHandleKeySystems = function canHandleKeySystems(source) {\n // copy the source\n source = JSON.parse(JSON.stringify(source));\n\n if (Html5DashJS.updateSourceData) {\n video_js__WEBPACK_IMPORTED_MODULE_0__["default"].log.warn(\'updateSourceData has been deprecated.\' + \' Please switch to using hook("updatesource", callback).\');\n source = Html5DashJS.updateSourceData(source);\n } // call updatesource hooks\n\n\n Html5DashJS.hooks(\'updatesource\').forEach(function (hook) {\n source = hook(source);\n });\n var videoEl = global_document__WEBPACK_IMPORTED_MODULE_2___default().createElement(\'video\');\n\n if (source.keySystemOptions && !((global_window__WEBPACK_IMPORTED_MODULE_1___default().navigator).requestMediaKeySystemAccess || // IE11 Win 8.1\n videoEl.msSetMediaKeys)) {\n return false;\n }\n\n return true;\n};\n\nvideo_js__WEBPACK_IMPORTED_MODULE_0__["default"].DashSourceHandler = function () {\n return {\n canHandleSource: function canHandleSource(source) {\n var dashExtRE = /\\.mpd/i;\n\n if (!canHandleKeySystems(source)) {\n return \'\';\n }\n\n if (video_js__WEBPACK_IMPORTED_MODULE_0__["default"].DashSourceHandler.canPlayType(source.type)) {\n return \'probably\';\n } else if (dashExtRE.test(source.src)) {\n return \'maybe\';\n }\n\n return \'\';\n },\n handleSource: function handleSource(source, tech, options) {\n return new Html5DashJS(source, tech, options);\n },\n canPlayType: function canPlayType(type) {\n return video_js__WEBPACK_IMPORTED_MODULE_0__["default"].DashSourceHandler.canPlayType(type);\n }\n };\n};\n\nvideo_js__WEBPACK_IMPORTED_MODULE_0__["default"].DashSourceHandler.canPlayType = function (type) {\n var dashTypeRE = /^application\\/dash\\+xml/i;\n\n if (dashTypeRE.test(type)) {\n return \'probably\';\n }\n\n return \'\';\n}; // Only add the SourceHandler if the browser supports MediaSourceExtensions\n\n\nif ((global_window__WEBPACK_IMPORTED_MODULE_1___default().MediaSource)) {\n video_js__WEBPACK_IMPORTED_MODULE_0__["default"].getTech(\'Html5\').registerSourceHandler(video_js__WEBPACK_IMPORTED_MODULE_0__["default"].DashSourceHandler(), 0);\n}\n\nvideo_js__WEBPACK_IMPORTED_MODULE_0__["default"].Html5DashJS = Html5DashJS;\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Html5DashJS);\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/dist/videojs-dash.es.js?')},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/byte-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ENDIANNESS: () => (/* binding */ ENDIANNESS),\n/* harmony export */ IS_BIG_ENDIAN: () => (/* binding */ IS_BIG_ENDIAN),\n/* harmony export */ IS_LITTLE_ENDIAN: () => (/* binding */ IS_LITTLE_ENDIAN),\n/* harmony export */ bytesMatch: () => (/* binding */ bytesMatch),\n/* harmony export */ bytesToNumber: () => (/* binding */ bytesToNumber),\n/* harmony export */ bytesToString: () => (/* binding */ bytesToString),\n/* harmony export */ concatTypedArrays: () => (/* binding */ concatTypedArrays),\n/* harmony export */ countBits: () => (/* binding */ countBits),\n/* harmony export */ countBytes: () => (/* binding */ countBytes),\n/* harmony export */ isArrayBufferView: () => (/* binding */ isArrayBufferView),\n/* harmony export */ isTypedArray: () => (/* binding */ isTypedArray),\n/* harmony export */ numberToBytes: () => (/* binding */ numberToBytes),\n/* harmony export */ padStart: () => (/* binding */ padStart),\n/* harmony export */ reverseBytes: () => (/* binding */ reverseBytes),\n/* harmony export */ sliceBytes: () => (/* binding */ sliceBytes),\n/* harmony export */ stringToBytes: () => (/* binding */ stringToBytes),\n/* harmony export */ toBinaryString: () => (/* binding */ toBinaryString),\n/* harmony export */ toHexString: () => (/* binding */ toHexString),\n/* harmony export */ toUint8: () => (/* binding */ toUint8)\n/* harmony export */ });\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__);\n // const log2 = Math.log2 ? Math.log2 : (x) => (Math.log(x) / Math.log(2));\n\nvar repeat = function repeat(str, len) {\n var acc = '';\n\n while (len--) {\n acc += str;\n }\n\n return acc;\n}; // count the number of bits it would take to represent a number\n// we used to do this with log2 but BigInt does not support builtin math\n// Math.ceil(log2(x));\n\n\nvar countBits = function countBits(x) {\n return x.toString(2).length;\n}; // count the number of whole bytes it would take to represent a number\n\nvar countBytes = function countBytes(x) {\n return Math.ceil(countBits(x) / 8);\n};\nvar padStart = function padStart(b, len, str) {\n if (str === void 0) {\n str = ' ';\n }\n\n return (repeat(str, len) + b.toString()).slice(-len);\n};\nvar isArrayBufferView = function isArrayBufferView(obj) {\n if (ArrayBuffer.isView === 'function') {\n return ArrayBuffer.isView(obj);\n }\n\n return obj && obj.buffer instanceof ArrayBuffer;\n};\nvar isTypedArray = function isTypedArray(obj) {\n return isArrayBufferView(obj);\n};\nvar toUint8 = function toUint8(bytes) {\n if (bytes instanceof Uint8Array) {\n return bytes;\n }\n\n if (!Array.isArray(bytes) && !isTypedArray(bytes) && !(bytes instanceof ArrayBuffer)) {\n // any non-number or NaN leads to empty uint8array\n // eslint-disable-next-line\n if (typeof bytes !== 'number' || typeof bytes === 'number' && bytes !== bytes) {\n bytes = 0;\n } else {\n bytes = [bytes];\n }\n }\n\n return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0);\n};\nvar toHexString = function toHexString(bytes) {\n bytes = toUint8(bytes);\n var str = '';\n\n for (var i = 0; i < bytes.length; i++) {\n str += padStart(bytes[i].toString(16), 2, '0');\n }\n\n return str;\n};\nvar toBinaryString = function toBinaryString(bytes) {\n bytes = toUint8(bytes);\n var str = '';\n\n for (var i = 0; i < bytes.length; i++) {\n str += padStart(bytes[i].toString(2), 8, '0');\n }\n\n return str;\n};\nvar BigInt = (global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt) || Number;\nvar BYTE_TABLE = [BigInt('0x1'), BigInt('0x100'), BigInt('0x10000'), BigInt('0x1000000'), BigInt('0x100000000'), BigInt('0x10000000000'), BigInt('0x1000000000000'), BigInt('0x100000000000000'), BigInt('0x10000000000000000')];\nvar ENDIANNESS = function () {\n var a = new Uint16Array([0xFFCC]);\n var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);\n\n if (b[0] === 0xFF) {\n return 'big';\n }\n\n if (b[0] === 0xCC) {\n return 'little';\n }\n\n return 'unknown';\n}();\nvar IS_BIG_ENDIAN = ENDIANNESS === 'big';\nvar IS_LITTLE_ENDIAN = ENDIANNESS === 'little';\nvar bytesToNumber = function bytesToNumber(bytes, _temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$signed = _ref.signed,\n signed = _ref$signed === void 0 ? false : _ref$signed,\n _ref$le = _ref.le,\n le = _ref$le === void 0 ? false : _ref$le;\n\n bytes = toUint8(bytes);\n var fn = le ? 'reduce' : 'reduceRight';\n var obj = bytes[fn] ? bytes[fn] : Array.prototype[fn];\n var number = obj.call(bytes, function (total, byte, i) {\n var exponent = le ? i : Math.abs(i + 1 - bytes.length);\n return total + BigInt(byte) * BYTE_TABLE[exponent];\n }, BigInt(0));\n\n if (signed) {\n var max = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1);\n number = BigInt(number);\n\n if (number > max) {\n number -= max;\n number -= max;\n number -= BigInt(2);\n }\n }\n\n return Number(number);\n};\nvar numberToBytes = function numberToBytes(number, _temp2) {\n var _ref2 = _temp2 === void 0 ? {} : _temp2,\n _ref2$le = _ref2.le,\n le = _ref2$le === void 0 ? false : _ref2$le;\n\n // eslint-disable-next-line\n if (typeof number !== 'bigint' && typeof number !== 'number' || typeof number === 'number' && number !== number) {\n number = 0;\n }\n\n number = BigInt(number);\n var byteCount = countBytes(number);\n var bytes = new Uint8Array(new ArrayBuffer(byteCount));\n\n for (var i = 0; i < byteCount; i++) {\n var byteIndex = le ? i : Math.abs(i + 1 - bytes.length);\n bytes[byteIndex] = Number(number / BYTE_TABLE[i] & BigInt(0xFF));\n\n if (number < 0) {\n bytes[byteIndex] = Math.abs(~bytes[byteIndex]);\n bytes[byteIndex] -= i === 0 ? 1 : 2;\n }\n }\n\n return bytes;\n};\nvar bytesToString = function bytesToString(bytes) {\n if (!bytes) {\n return '';\n } // TODO: should toUint8 handle cases where we only have 8 bytes\n // but report more since this is a Uint16+ Array?\n\n\n bytes = Array.prototype.slice.call(bytes);\n var string = String.fromCharCode.apply(null, toUint8(bytes));\n\n try {\n return decodeURIComponent(escape(string));\n } catch (e) {// if decodeURIComponent/escape fails, we are dealing with partial\n // or full non string data. Just return the potentially garbled string.\n }\n\n return string;\n};\nvar stringToBytes = function stringToBytes(string, stringIsBytes) {\n if (typeof string !== 'string' && string && typeof string.toString === 'function') {\n string = string.toString();\n }\n\n if (typeof string !== 'string') {\n return new Uint8Array();\n } // If the string already is bytes, we don't have to do this\n // otherwise we do this so that we split multi length characters\n // into individual bytes\n\n\n if (!stringIsBytes) {\n string = unescape(encodeURIComponent(string));\n }\n\n var view = new Uint8Array(string.length);\n\n for (var i = 0; i < string.length; i++) {\n view[i] = string.charCodeAt(i);\n }\n\n return view;\n};\nvar concatTypedArrays = function concatTypedArrays() {\n for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) {\n buffers[_key] = arguments[_key];\n }\n\n buffers = buffers.filter(function (b) {\n return b && (b.byteLength || b.length) && typeof b !== 'string';\n });\n\n if (buffers.length <= 1) {\n // for 0 length we will return empty uint8\n // for 1 length we return the first uint8\n return toUint8(buffers[0]);\n }\n\n var totalLen = buffers.reduce(function (total, buf, i) {\n return total + (buf.byteLength || buf.length);\n }, 0);\n var tempBuffer = new Uint8Array(totalLen);\n var offset = 0;\n buffers.forEach(function (buf) {\n buf = toUint8(buf);\n tempBuffer.set(buf, offset);\n offset += buf.byteLength;\n });\n return tempBuffer;\n};\n/**\n * Check if the bytes \"b\" are contained within bytes \"a\".\n *\n * @param {Uint8Array|Array} a\n * Bytes to check in\n *\n * @param {Uint8Array|Array} b\n * Bytes to check for\n *\n * @param {Object} options\n * options\n *\n * @param {Array|Uint8Array} [offset=0]\n * offset to use when looking at bytes in a\n *\n * @param {Array|Uint8Array} [mask=[]]\n * mask to use on bytes before comparison.\n *\n * @return {boolean}\n * If all bytes in b are inside of a, taking into account\n * bit masks.\n */\n\nvar bytesMatch = function bytesMatch(a, b, _temp3) {\n var _ref3 = _temp3 === void 0 ? {} : _temp3,\n _ref3$offset = _ref3.offset,\n offset = _ref3$offset === void 0 ? 0 : _ref3$offset,\n _ref3$mask = _ref3.mask,\n mask = _ref3$mask === void 0 ? [] : _ref3$mask;\n\n a = toUint8(a);\n b = toUint8(b); // ie 11 does not support uint8 every\n\n var fn = b.every ? b.every : Array.prototype.every;\n return b.length && a.length - offset >= b.length && // ie 11 doesn't support every on uin8\n fn.call(b, function (bByte, i) {\n var aByte = mask[i] ? mask[i] & a[offset + i] : a[offset + i];\n return bByte === aByte;\n });\n};\nvar sliceBytes = function sliceBytes(src, start, end) {\n if (Uint8Array.prototype.slice) {\n return Uint8Array.prototype.slice.call(src, start, end);\n }\n\n return new Uint8Array(Array.prototype.slice.call(src, start, end));\n};\nvar reverseBytes = function reverseBytes(src) {\n if (src.reverse) {\n return src.reverse();\n }\n\n return Array.prototype.reverse.call(src);\n};\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/byte-helpers.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/codec-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getAv1Codec: () => (/* binding */ getAv1Codec),\n/* harmony export */ getAvcCodec: () => (/* binding */ getAvcCodec),\n/* harmony export */ getHvcCodec: () => (/* binding */ getHvcCodec)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n // https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-syntax\n// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/codecs_parameter#AV1\n\nvar getAv1Codec = function getAv1Codec(bytes) {\n var codec = '';\n var profile = bytes[1] >>> 3;\n var level = bytes[1] & 0x1F;\n var tier = bytes[2] >>> 7;\n var highBitDepth = (bytes[2] & 0x40) >> 6;\n var twelveBit = (bytes[2] & 0x20) >> 5;\n var monochrome = (bytes[2] & 0x10) >> 4;\n var chromaSubsamplingX = (bytes[2] & 0x08) >> 3;\n var chromaSubsamplingY = (bytes[2] & 0x04) >> 2;\n var chromaSamplePosition = bytes[2] & 0x03;\n codec += profile + \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(level, 2, '0');\n\n if (tier === 0) {\n codec += 'M';\n } else if (tier === 1) {\n codec += 'H';\n }\n\n var bitDepth;\n\n if (profile === 2 && highBitDepth) {\n bitDepth = twelveBit ? 12 : 10;\n } else {\n bitDepth = highBitDepth ? 10 : 8;\n }\n\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(bitDepth, 2, '0'); // TODO: can we parse color range??\n\n codec += \".\" + monochrome;\n codec += \".\" + chromaSubsamplingX + chromaSubsamplingY + chromaSamplePosition;\n return codec;\n};\nvar getAvcCodec = function getAvcCodec(bytes) {\n var profileId = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toHexString)(bytes[1]);\n var constraintFlags = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toHexString)(bytes[2] & 0xFC);\n var levelId = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toHexString)(bytes[3]);\n return \"\" + profileId + constraintFlags + levelId;\n};\nvar getHvcCodec = function getHvcCodec(bytes) {\n var codec = '';\n var profileSpace = bytes[1] >> 6;\n var profileId = bytes[1] & 0x1F;\n var tierFlag = (bytes[1] & 0x20) >> 5;\n var profileCompat = bytes.subarray(2, 6);\n var constraintIds = bytes.subarray(6, 12);\n var levelId = bytes[12];\n\n if (profileSpace === 1) {\n codec += 'A';\n } else if (profileSpace === 2) {\n codec += 'B';\n } else if (profileSpace === 3) {\n codec += 'C';\n }\n\n codec += profileId + \".\"; // ffmpeg does this in big endian\n\n var profileCompatVal = parseInt((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toBinaryString)(profileCompat).split('').reverse().join(''), 2); // apple does this in little endian...\n\n if (profileCompatVal > 255) {\n profileCompatVal = parseInt((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toBinaryString)(profileCompat), 2);\n }\n\n codec += profileCompatVal.toString(16) + \".\";\n\n if (tierFlag === 0) {\n codec += 'L';\n } else {\n codec += 'H';\n }\n\n codec += levelId;\n var constraints = '';\n\n for (var i = 0; i < constraintIds.length; i++) {\n var v = constraintIds[i];\n\n if (v) {\n if (constraints) {\n constraints += '.';\n }\n\n constraints += v.toString(16);\n }\n }\n\n if (constraints) {\n codec += \".\" + constraints;\n }\n\n return codec;\n};\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/codec-helpers.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/codecs.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DEFAULT_AUDIO_CODEC: () => (/* binding */ DEFAULT_AUDIO_CODEC),\n/* harmony export */ DEFAULT_VIDEO_CODEC: () => (/* binding */ DEFAULT_VIDEO_CODEC),\n/* harmony export */ browserSupportsCodec: () => (/* binding */ browserSupportsCodec),\n/* harmony export */ codecsFromDefault: () => (/* binding */ codecsFromDefault),\n/* harmony export */ getMimeForCodec: () => (/* binding */ getMimeForCodec),\n/* harmony export */ isAudioCodec: () => (/* binding */ isAudioCodec),\n/* harmony export */ isTextCodec: () => (/* binding */ isTextCodec),\n/* harmony export */ isVideoCodec: () => (/* binding */ isVideoCodec),\n/* harmony export */ mapLegacyAvcCodecs: () => (/* binding */ mapLegacyAvcCodecs),\n/* harmony export */ muxerSupportsCodec: () => (/* binding */ muxerSupportsCodec),\n/* harmony export */ parseCodecs: () => (/* binding */ parseCodecs),\n/* harmony export */ translateLegacyCodec: () => (/* binding */ translateLegacyCodec),\n/* harmony export */ translateLegacyCodecs: () => (/* binding */ translateLegacyCodecs)\n/* harmony export */ });\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__);\n\nvar regexs = {\n // to determine mime types\n mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,\n webm: /^(vp0?[89]|av0?1|opus|vorbis)/,\n ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/,\n // to determine if a codec is audio or video\n video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,\n audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,\n text: /^(stpp.ttml.im1t)/,\n // mux.js support regex\n muxerVideo: /^(avc0?1)/,\n muxerAudio: /^(mp4a)/,\n // match nothing as muxer does not support text right now.\n // there cannot never be a character before the start of a string\n // so this matches nothing.\n muxerText: /a^/\n};\nvar mediaTypes = ['video', 'audio', 'text'];\nvar upperMediaTypes = ['Video', 'Audio', 'Text'];\n/**\n * Replace the old apple-style `avc1.<dd>.<dd>` codec string with the standard\n * `avc1.<hhhhhh>`\n *\n * @param {string} codec\n * Codec string to translate\n * @return {string}\n * The translated codec string\n */\n\nvar translateLegacyCodec = function translateLegacyCodec(codec) {\n if (!codec) {\n return codec;\n }\n\n return codec.replace(/avc1\\.(\\d+)\\.(\\d+)/i, function (orig, profile, avcLevel) {\n var profileHex = ('00' + Number(profile).toString(16)).slice(-2);\n var avcLevelHex = ('00' + Number(avcLevel).toString(16)).slice(-2);\n return 'avc1.' + profileHex + '00' + avcLevelHex;\n });\n};\n/**\n * Replace the old apple-style `avc1.<dd>.<dd>` codec strings with the standard\n * `avc1.<hhhhhh>`\n *\n * @param {string[]} codecs\n * An array of codec strings to translate\n * @return {string[]}\n * The translated array of codec strings\n */\n\nvar translateLegacyCodecs = function translateLegacyCodecs(codecs) {\n return codecs.map(translateLegacyCodec);\n};\n/**\n * Replace codecs in the codec string with the old apple-style `avc1.<dd>.<dd>` to the\n * standard `avc1.<hhhhhh>`.\n *\n * @param {string} codecString\n * The codec string\n * @return {string}\n * The codec string with old apple-style codecs replaced\n *\n * @private\n */\n\nvar mapLegacyAvcCodecs = function mapLegacyAvcCodecs(codecString) {\n return codecString.replace(/avc1\\.(\\d+)\\.(\\d+)/i, function (match) {\n return translateLegacyCodecs([match])[0];\n });\n};\n/**\n * @typedef {Object} ParsedCodecInfo\n * @property {number} codecCount\n * Number of codecs parsed\n * @property {string} [videoCodec]\n * Parsed video codec (if found)\n * @property {string} [videoObjectTypeIndicator]\n * Video object type indicator (if found)\n * @property {string|null} audioProfile\n * Audio profile\n */\n\n/**\n * Parses a codec string to retrieve the number of codecs specified, the video codec and\n * object type indicator, and the audio profile.\n *\n * @param {string} [codecString]\n * The codec string to parse\n * @return {ParsedCodecInfo}\n * Parsed codec info\n */\n\nvar parseCodecs = function parseCodecs(codecString) {\n if (codecString === void 0) {\n codecString = '';\n }\n\n var codecs = codecString.split(',');\n var result = [];\n codecs.forEach(function (codec) {\n codec = codec.trim();\n var codecType;\n mediaTypes.forEach(function (name) {\n var match = regexs[name].exec(codec.toLowerCase());\n\n if (!match || match.length <= 1) {\n return;\n }\n\n codecType = name; // maintain codec case\n\n var type = codec.substring(0, match[1].length);\n var details = codec.replace(type, '');\n result.push({\n type: type,\n details: details,\n mediaType: name\n });\n });\n\n if (!codecType) {\n result.push({\n type: codec,\n details: '',\n mediaType: 'unknown'\n });\n }\n });\n return result;\n};\n/**\n * Returns a ParsedCodecInfo object for the default alternate audio playlist if there is\n * a default alternate audio playlist for the provided audio group.\n *\n * @param {Object} master\n * The master playlist\n * @param {string} audioGroupId\n * ID of the audio group for which to find the default codec info\n * @return {ParsedCodecInfo}\n * Parsed codec info\n */\n\nvar codecsFromDefault = function codecsFromDefault(master, audioGroupId) {\n if (!master.mediaGroups.AUDIO || !audioGroupId) {\n return null;\n }\n\n var audioGroup = master.mediaGroups.AUDIO[audioGroupId];\n\n if (!audioGroup) {\n return null;\n }\n\n for (var name in audioGroup) {\n var audioType = audioGroup[name];\n\n if (audioType.default && audioType.playlists) {\n // codec should be the same for all playlists within the audio type\n return parseCodecs(audioType.playlists[0].attributes.CODECS);\n }\n }\n\n return null;\n};\nvar isVideoCodec = function isVideoCodec(codec) {\n if (codec === void 0) {\n codec = '';\n }\n\n return regexs.video.test(codec.trim().toLowerCase());\n};\nvar isAudioCodec = function isAudioCodec(codec) {\n if (codec === void 0) {\n codec = '';\n }\n\n return regexs.audio.test(codec.trim().toLowerCase());\n};\nvar isTextCodec = function isTextCodec(codec) {\n if (codec === void 0) {\n codec = '';\n }\n\n return regexs.text.test(codec.trim().toLowerCase());\n};\nvar getMimeForCodec = function getMimeForCodec(codecString) {\n if (!codecString || typeof codecString !== 'string') {\n return;\n }\n\n var codecs = codecString.toLowerCase().split(',').map(function (c) {\n return translateLegacyCodec(c.trim());\n }); // default to video type\n\n var type = 'video'; // only change to audio type if the only codec we have is\n // audio\n\n if (codecs.length === 1 && isAudioCodec(codecs[0])) {\n type = 'audio';\n } else if (codecs.length === 1 && isTextCodec(codecs[0])) {\n // text uses application/<container> for now\n type = 'application';\n } // default the container to mp4\n\n\n var container = 'mp4'; // every codec must be able to go into the container\n // for that container to be the correct one\n\n if (codecs.every(function (c) {\n return regexs.mp4.test(c);\n })) {\n container = 'mp4';\n } else if (codecs.every(function (c) {\n return regexs.webm.test(c);\n })) {\n container = 'webm';\n } else if (codecs.every(function (c) {\n return regexs.ogg.test(c);\n })) {\n container = 'ogg';\n }\n\n return type + \"/\" + container + \";codecs=\\\"\" + codecString + \"\\\"\";\n};\nvar browserSupportsCodec = function browserSupportsCodec(codecString) {\n if (codecString === void 0) {\n codecString = '';\n }\n\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource).isTypeSupported && global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource.isTypeSupported(getMimeForCodec(codecString)) || false;\n};\nvar muxerSupportsCodec = function muxerSupportsCodec(codecString) {\n if (codecString === void 0) {\n codecString = '';\n }\n\n return codecString.toLowerCase().split(',').every(function (codec) {\n codec = codec.trim(); // any match is supported.\n\n for (var i = 0; i < upperMediaTypes.length; i++) {\n var type = upperMediaTypes[i];\n\n if (regexs[\"muxer\" + type].test(codec)) {\n return true;\n }\n }\n\n return false;\n });\n};\nvar DEFAULT_AUDIO_CODEC = 'mp4a.40.2';\nvar DEFAULT_VIDEO_CODEC = 'avc1.4d400d';\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/codecs.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/containers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ detectContainerForBytes: () => (/* binding */ detectContainerForBytes),\n/* harmony export */ isLikely: () => (/* binding */ isLikely),\n/* harmony export */ isLikelyFmp4MediaSegment: () => (/* binding */ isLikelyFmp4MediaSegment)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n/* harmony import */ var _mp4_helpers_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./mp4-helpers.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/mp4-helpers.js\");\n/* harmony import */ var _ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ebml-helpers.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/ebml-helpers.js\");\n/* harmony import */ var _id3_helpers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./id3-helpers.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/id3-helpers.js\");\n/* harmony import */ var _nal_helpers_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nal-helpers.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/nal-helpers.js\");\n\n\n\n\n\nvar CONSTANTS = {\n // \"webm\" string literal in hex\n 'webm': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x77, 0x65, 0x62, 0x6d]),\n // \"matroska\" string literal in hex\n 'matroska': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61]),\n // \"fLaC\" string literal in hex\n 'flac': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x66, 0x4c, 0x61, 0x43]),\n // \"OggS\" string literal in hex\n 'ogg': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x4f, 0x67, 0x67, 0x53]),\n // ac-3 sync byte, also works for ec-3 as that is simply a codec\n // of ac-3\n 'ac3': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x0b, 0x77]),\n // \"RIFF\" string literal in hex used for wav and avi\n 'riff': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x52, 0x49, 0x46, 0x46]),\n // \"AVI\" string literal in hex\n 'avi': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x41, 0x56, 0x49]),\n // \"WAVE\" string literal in hex\n 'wav': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x57, 0x41, 0x56, 0x45]),\n // \"ftyp3g\" string literal in hex\n '3gp': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x66, 0x74, 0x79, 0x70, 0x33, 0x67]),\n // \"ftyp\" string literal in hex\n 'mp4': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x66, 0x74, 0x79, 0x70]),\n // \"styp\" string literal in hex\n 'fmp4': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x73, 0x74, 0x79, 0x70]),\n // \"ftypqt\" string literal in hex\n 'mov': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x66, 0x74, 0x79, 0x70, 0x71, 0x74]),\n // moov string literal in hex\n 'moov': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x6D, 0x6F, 0x6F, 0x76]),\n // moof string literal in hex\n 'moof': (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x6D, 0x6F, 0x6F, 0x66])\n};\nvar _isLikely = {\n aac: function aac(bytes) {\n var offset = (0,_id3_helpers_js__WEBPACK_IMPORTED_MODULE_3__.getId3Offset)(bytes);\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, [0xFF, 0x10], {\n offset: offset,\n mask: [0xFF, 0x16]\n });\n },\n mp3: function mp3(bytes) {\n var offset = (0,_id3_helpers_js__WEBPACK_IMPORTED_MODULE_3__.getId3Offset)(bytes);\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, [0xFF, 0x02], {\n offset: offset,\n mask: [0xFF, 0x06]\n });\n },\n webm: function webm(bytes) {\n var docType = (0,_ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.findEbml)(bytes, [_ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.EBML_TAGS.EBML, _ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.EBML_TAGS.DocType])[0]; // check if DocType EBML tag is webm\n\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(docType, CONSTANTS.webm);\n },\n mkv: function mkv(bytes) {\n var docType = (0,_ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.findEbml)(bytes, [_ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.EBML_TAGS.EBML, _ebml_helpers_js__WEBPACK_IMPORTED_MODULE_2__.EBML_TAGS.DocType])[0]; // check if DocType EBML tag is matroska\n\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(docType, CONSTANTS.matroska);\n },\n mp4: function mp4(bytes) {\n // if this file is another base media file format, it is not mp4\n if (_isLikely['3gp'](bytes) || _isLikely.mov(bytes)) {\n return false;\n } // if this file starts with a ftyp or styp box its mp4\n\n\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.mp4, {\n offset: 4\n }) || (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.fmp4, {\n offset: 4\n })) {\n return true;\n } // if this file starts with a moof/moov box its mp4\n\n\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.moof, {\n offset: 4\n }) || (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.moov, {\n offset: 4\n })) {\n return true;\n }\n },\n mov: function mov(bytes) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.mov, {\n offset: 4\n });\n },\n '3gp': function gp(bytes) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS['3gp'], {\n offset: 4\n });\n },\n ac3: function ac3(bytes) {\n var offset = (0,_id3_helpers_js__WEBPACK_IMPORTED_MODULE_3__.getId3Offset)(bytes);\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.ac3, {\n offset: offset\n });\n },\n ts: function ts(bytes) {\n if (bytes.length < 189 && bytes.length >= 1) {\n return bytes[0] === 0x47;\n }\n\n var i = 0; // check the first 376 bytes for two matching sync bytes\n\n while (i + 188 < bytes.length && i < 188) {\n if (bytes[i] === 0x47 && bytes[i + 188] === 0x47) {\n return true;\n }\n\n i += 1;\n }\n\n return false;\n },\n flac: function flac(bytes) {\n var offset = (0,_id3_helpers_js__WEBPACK_IMPORTED_MODULE_3__.getId3Offset)(bytes);\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.flac, {\n offset: offset\n });\n },\n ogg: function ogg(bytes) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.ogg);\n },\n avi: function avi(bytes) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.riff) && (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.avi, {\n offset: 8\n });\n },\n wav: function wav(bytes) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.riff) && (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, CONSTANTS.wav, {\n offset: 8\n });\n },\n 'h264': function h264(bytes) {\n // find seq_parameter_set_rbsp\n return (0,_nal_helpers_js__WEBPACK_IMPORTED_MODULE_4__.findH264Nal)(bytes, 7, 3).length;\n },\n 'h265': function h265(bytes) {\n // find video_parameter_set_rbsp or seq_parameter_set_rbsp\n return (0,_nal_helpers_js__WEBPACK_IMPORTED_MODULE_4__.findH265Nal)(bytes, [32, 33], 3).length;\n }\n}; // get all the isLikely functions\n// but make sure 'ts' is above h264 and h265\n// but below everything else as it is the least specific\n\nvar isLikelyTypes = Object.keys(_isLikely) // remove ts, h264, h265\n.filter(function (t) {\n return t !== 'ts' && t !== 'h264' && t !== 'h265';\n}) // add it back to the bottom\n.concat(['ts', 'h264', 'h265']); // make sure we are dealing with uint8 data.\n\nisLikelyTypes.forEach(function (type) {\n var isLikelyFn = _isLikely[type];\n\n _isLikely[type] = function (bytes) {\n return isLikelyFn((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes));\n };\n}); // export after wrapping\n\nvar isLikely = _isLikely; // A useful list of file signatures can be found here\n// https://en.wikipedia.org/wiki/List_of_file_signatures\n\nvar detectContainerForBytes = function detectContainerForBytes(bytes) {\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n\n for (var i = 0; i < isLikelyTypes.length; i++) {\n var type = isLikelyTypes[i];\n\n if (isLikely[type](bytes)) {\n return type;\n }\n }\n\n return '';\n}; // fmp4 is not a container\n\nvar isLikelyFmp4MediaSegment = function isLikelyFmp4MediaSegment(bytes) {\n return (0,_mp4_helpers_js__WEBPACK_IMPORTED_MODULE_1__.findBox)(bytes, ['moof']).length > 0;\n};\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/containers.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ decodeB64ToUint8Array)\n/* harmony export */ });\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__);\n\n\nvar atob = function atob(s) {\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default().atob) ? global_window__WEBPACK_IMPORTED_MODULE_0___default().atob(s) : Buffer.from(s, 'base64').toString('binary');\n};\n\nfunction decodeB64ToUint8Array(b64Text) {\n var decodedString = atob(b64Text);\n var array = new Uint8Array(decodedString.length);\n\n for (var i = 0; i < decodedString.length; i++) {\n array[i] = decodedString.charCodeAt(i);\n }\n\n return array;\n}\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/ebml-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EBML_TAGS: () => (/* binding */ EBML_TAGS),\n/* harmony export */ decodeBlock: () => (/* binding */ decodeBlock),\n/* harmony export */ findEbml: () => (/* binding */ findEbml),\n/* harmony export */ parseData: () => (/* binding */ parseData),\n/* harmony export */ parseTracks: () => (/* binding */ parseTracks)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n/* harmony import */ var _codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./codec-helpers.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/codec-helpers.js\");\n\n // relevant specs for this parser:\n// https://matroska-org.github.io/libebml/specs.html\n// https://www.matroska.org/technical/elements.html\n// https://www.webmproject.org/docs/container/\n\nvar EBML_TAGS = {\n EBML: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x1A, 0x45, 0xDF, 0xA3]),\n DocType: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x42, 0x82]),\n Segment: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x18, 0x53, 0x80, 0x67]),\n SegmentInfo: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x15, 0x49, 0xA9, 0x66]),\n Tracks: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x16, 0x54, 0xAE, 0x6B]),\n Track: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xAE]),\n TrackNumber: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xd7]),\n DefaultDuration: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x23, 0xe3, 0x83]),\n TrackEntry: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xAE]),\n TrackType: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x83]),\n FlagDefault: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x88]),\n CodecID: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x86]),\n CodecPrivate: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x63, 0xA2]),\n VideoTrack: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xe0]),\n AudioTrack: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xe1]),\n // Not used yet, but will be used for live webm/mkv\n // see https://www.matroska.org/technical/basics.html#block-structure\n // see https://www.matroska.org/technical/basics.html#simpleblock-structure\n Cluster: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x1F, 0x43, 0xB6, 0x75]),\n Timestamp: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xE7]),\n TimestampScale: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x2A, 0xD7, 0xB1]),\n BlockGroup: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xA0]),\n BlockDuration: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x9B]),\n Block: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xA1]),\n SimpleBlock: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0xA3])\n};\n/**\n * This is a simple table to determine the length\n * of things in ebml. The length is one based (starts at 1,\n * rather than zero) and for every zero bit before a one bit\n * we add one to length. We also need this table because in some\n * case we have to xor all the length bits from another value.\n */\n\nvar LENGTH_TABLE = [128, 64, 32, 16, 8, 4, 2, 1];\n\nvar getLength = function getLength(byte) {\n var len = 1;\n\n for (var i = 0; i < LENGTH_TABLE.length; i++) {\n if (byte & LENGTH_TABLE[i]) {\n break;\n }\n\n len++;\n }\n\n return len;\n}; // length in ebml is stored in the first 4 to 8 bits\n// of the first byte. 4 for the id length and 8 for the\n// data size length. Length is measured by converting the number to binary\n// then 1 + the number of zeros before a 1 is encountered starting\n// from the left.\n\n\nvar getvint = function getvint(bytes, offset, removeLength, signed) {\n if (removeLength === void 0) {\n removeLength = true;\n }\n\n if (signed === void 0) {\n signed = false;\n }\n\n var length = getLength(bytes[offset]);\n var valueBytes = bytes.subarray(offset, offset + length); // NOTE that we do **not** subarray here because we need to copy these bytes\n // as they will be modified below to remove the dataSizeLen bits and we do not\n // want to modify the original data. normally we could just call slice on\n // uint8array but ie 11 does not support that...\n\n if (removeLength) {\n valueBytes = Array.prototype.slice.call(bytes, offset, offset + length);\n valueBytes[0] ^= LENGTH_TABLE[length - 1];\n }\n\n return {\n length: length,\n value: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(valueBytes, {\n signed: signed\n }),\n bytes: valueBytes\n };\n};\n\nvar normalizePath = function normalizePath(path) {\n if (typeof path === 'string') {\n return path.match(/.{1,2}/g).map(function (p) {\n return normalizePath(p);\n });\n }\n\n if (typeof path === 'number') {\n return (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.numberToBytes)(path);\n }\n\n return path;\n};\n\nvar normalizePaths = function normalizePaths(paths) {\n if (!Array.isArray(paths)) {\n return [normalizePath(paths)];\n }\n\n return paths.map(function (p) {\n return normalizePath(p);\n });\n};\n\nvar getInfinityDataSize = function getInfinityDataSize(id, bytes, offset) {\n if (offset >= bytes.length) {\n return bytes.length;\n }\n\n var innerid = getvint(bytes, offset, false);\n\n if ((0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(id.bytes, innerid.bytes)) {\n return offset;\n }\n\n var dataHeader = getvint(bytes, offset + innerid.length);\n return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length);\n};\n/**\n * Notes on the EBLM format.\n *\n * EBLM uses \"vints\" tags. Every vint tag contains\n * two parts\n *\n * 1. The length from the first byte. You get this by\n * converting the byte to binary and counting the zeros\n * before a 1. Then you add 1 to that. Examples\n * 00011111 = length 4 because there are 3 zeros before a 1.\n * 00100000 = length 3 because there are 2 zeros before a 1.\n * 00000011 = length 7 because there are 6 zeros before a 1.\n *\n * 2. The bits used for length are removed from the first byte\n * Then all the bytes are merged into a value. NOTE: this\n * is not the case for id ebml tags as there id includes\n * length bits.\n *\n */\n\n\nvar findEbml = function findEbml(bytes, paths) {\n paths = normalizePaths(paths);\n bytes = (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var results = [];\n\n if (!paths.length) {\n return results;\n }\n\n var i = 0;\n\n while (i < bytes.length) {\n var id = getvint(bytes, i, false);\n var dataHeader = getvint(bytes, i + id.length);\n var dataStart = i + id.length + dataHeader.length; // dataSize is unknown or this is a live stream\n\n if (dataHeader.value === 0x7f) {\n dataHeader.value = getInfinityDataSize(id, bytes, dataStart);\n\n if (dataHeader.value !== bytes.length) {\n dataHeader.value -= dataStart;\n }\n }\n\n var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value;\n var data = bytes.subarray(dataStart, dataEnd);\n\n if ((0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(paths[0], id.bytes)) {\n if (paths.length === 1) {\n // this is the end of the paths and we've found the tag we were\n // looking for\n results.push(data);\n } else {\n // recursively search for the next tag inside of the data\n // of this one\n results = results.concat(findEbml(data, paths.slice(1)));\n }\n }\n\n var totalLength = id.length + dataHeader.length + data.length; // move past this tag entirely, we are not looking for it\n\n i += totalLength;\n }\n\n return results;\n}; // see https://www.matroska.org/technical/basics.html#block-structure\n\nvar decodeBlock = function decodeBlock(block, type, timestampScale, clusterTimestamp) {\n var duration;\n\n if (type === 'group') {\n duration = findEbml(block, [EBML_TAGS.BlockDuration])[0];\n\n if (duration) {\n duration = (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(duration);\n duration = 1 / timestampScale * duration * timestampScale / 1000;\n }\n\n block = findEbml(block, [EBML_TAGS.Block])[0];\n type = 'block'; // treat data as a block after this point\n }\n\n var dv = new DataView(block.buffer, block.byteOffset, block.byteLength);\n var trackNumber = getvint(block, 0);\n var timestamp = dv.getInt16(trackNumber.length, false);\n var flags = block[trackNumber.length + 2];\n var data = block.subarray(trackNumber.length + 3); // pts/dts in seconds\n\n var ptsdts = 1 / timestampScale * (clusterTimestamp + timestamp) * timestampScale / 1000; // return the frame\n\n var parsed = {\n duration: duration,\n trackNumber: trackNumber.value,\n keyframe: type === 'simple' && flags >> 7 === 1,\n invisible: (flags & 0x08) >> 3 === 1,\n lacing: (flags & 0x06) >> 1,\n discardable: type === 'simple' && (flags & 0x01) === 1,\n frames: [],\n pts: ptsdts,\n dts: ptsdts,\n timestamp: timestamp\n };\n\n if (!parsed.lacing) {\n parsed.frames.push(data);\n return parsed;\n }\n\n var numberOfFrames = data[0] + 1;\n var frameSizes = [];\n var offset = 1; // Fixed\n\n if (parsed.lacing === 2) {\n var sizeOfFrame = (data.length - offset) / numberOfFrames;\n\n for (var i = 0; i < numberOfFrames; i++) {\n frameSizes.push(sizeOfFrame);\n }\n } // xiph\n\n\n if (parsed.lacing === 1) {\n for (var _i = 0; _i < numberOfFrames - 1; _i++) {\n var size = 0;\n\n do {\n size += data[offset];\n offset++;\n } while (data[offset - 1] === 0xFF);\n\n frameSizes.push(size);\n }\n } // ebml\n\n\n if (parsed.lacing === 3) {\n // first vint is unsinged\n // after that vints are singed and\n // based on a compounding size\n var _size = 0;\n\n for (var _i2 = 0; _i2 < numberOfFrames - 1; _i2++) {\n var vint = _i2 === 0 ? getvint(data, offset) : getvint(data, offset, true, true);\n _size += vint.value;\n frameSizes.push(_size);\n offset += vint.length;\n }\n }\n\n frameSizes.forEach(function (size) {\n parsed.frames.push(data.subarray(offset, offset + size));\n offset += size;\n });\n return parsed;\n}; // VP9 Codec Feature Metadata (CodecPrivate)\n// https://www.webmproject.org/docs/container/\n\nvar parseVp9Private = function parseVp9Private(bytes) {\n var i = 0;\n var params = {};\n\n while (i < bytes.length) {\n var id = bytes[i] & 0x7f;\n var len = bytes[i + 1];\n var val = void 0;\n\n if (len === 1) {\n val = bytes[i + 2];\n } else {\n val = bytes.subarray(i + 2, i + 2 + len);\n }\n\n if (id === 1) {\n params.profile = val;\n } else if (id === 2) {\n params.level = val;\n } else if (id === 3) {\n params.bitDepth = val;\n } else if (id === 4) {\n params.chromaSubsampling = val;\n } else {\n params[id] = val;\n }\n\n i += 2 + len;\n }\n\n return params;\n};\n\nvar parseTracks = function parseTracks(bytes) {\n bytes = (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var decodedTracks = [];\n var tracks = findEbml(bytes, [EBML_TAGS.Segment, EBML_TAGS.Tracks, EBML_TAGS.Track]);\n\n if (!tracks.length) {\n tracks = findEbml(bytes, [EBML_TAGS.Tracks, EBML_TAGS.Track]);\n }\n\n if (!tracks.length) {\n tracks = findEbml(bytes, [EBML_TAGS.Track]);\n }\n\n if (!tracks.length) {\n return decodedTracks;\n }\n\n tracks.forEach(function (track) {\n var trackType = findEbml(track, EBML_TAGS.TrackType)[0];\n\n if (!trackType || !trackType.length) {\n return;\n } // 1 is video, 2 is audio, 17 is subtitle\n // other values are unimportant in this context\n\n\n if (trackType[0] === 1) {\n trackType = 'video';\n } else if (trackType[0] === 2) {\n trackType = 'audio';\n } else if (trackType[0] === 17) {\n trackType = 'subtitle';\n } else {\n return;\n } // todo parse language\n\n\n var decodedTrack = {\n rawCodec: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToString)(findEbml(track, [EBML_TAGS.CodecID])[0]),\n type: trackType,\n codecPrivate: findEbml(track, [EBML_TAGS.CodecPrivate])[0],\n number: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(findEbml(track, [EBML_TAGS.TrackNumber])[0]),\n defaultDuration: (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(findEbml(track, [EBML_TAGS.DefaultDuration])[0]),\n default: findEbml(track, [EBML_TAGS.FlagDefault])[0],\n rawData: track\n };\n var codec = '';\n\n if (/V_MPEG4\\/ISO\\/AVC/.test(decodedTrack.rawCodec)) {\n codec = \"avc1.\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getAvcCodec)(decodedTrack.codecPrivate);\n } else if (/V_MPEGH\\/ISO\\/HEVC/.test(decodedTrack.rawCodec)) {\n codec = \"hev1.\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getHvcCodec)(decodedTrack.codecPrivate);\n } else if (/V_MPEG4\\/ISO\\/ASP/.test(decodedTrack.rawCodec)) {\n if (decodedTrack.codecPrivate) {\n codec = 'mp4v.20.' + decodedTrack.codecPrivate[4].toString();\n } else {\n codec = 'mp4v.20.9';\n }\n } else if (/^V_THEORA/.test(decodedTrack.rawCodec)) {\n codec = 'theora';\n } else if (/^V_VP8/.test(decodedTrack.rawCodec)) {\n codec = 'vp8';\n } else if (/^V_VP9/.test(decodedTrack.rawCodec)) {\n if (decodedTrack.codecPrivate) {\n var _parseVp9Private = parseVp9Private(decodedTrack.codecPrivate),\n profile = _parseVp9Private.profile,\n level = _parseVp9Private.level,\n bitDepth = _parseVp9Private.bitDepth,\n chromaSubsampling = _parseVp9Private.chromaSubsampling;\n\n codec = 'vp09.';\n codec += (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(profile, 2, '0') + \".\";\n codec += (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(level, 2, '0') + \".\";\n codec += (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(bitDepth, 2, '0') + \".\";\n codec += \"\" + (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(chromaSubsampling, 2, '0'); // Video -> Colour -> Ebml name\n\n var matrixCoefficients = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xB1]])[0] || [];\n var videoFullRangeFlag = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xB9]])[0] || [];\n var transferCharacteristics = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xBA]])[0] || [];\n var colourPrimaries = findEbml(track, [0xE0, [0x55, 0xB0], [0x55, 0xBB]])[0] || []; // if we find any optional codec parameter specify them all.\n\n if (matrixCoefficients.length || videoFullRangeFlag.length || transferCharacteristics.length || colourPrimaries.length) {\n codec += \".\" + (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(colourPrimaries[0], 2, '0');\n codec += \".\" + (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(transferCharacteristics[0], 2, '0');\n codec += \".\" + (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(matrixCoefficients[0], 2, '0');\n codec += \".\" + (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.padStart)(videoFullRangeFlag[0], 2, '0');\n }\n } else {\n codec = 'vp9';\n }\n } else if (/^V_AV1/.test(decodedTrack.rawCodec)) {\n codec = \"av01.\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getAv1Codec)(decodedTrack.codecPrivate);\n } else if (/A_ALAC/.test(decodedTrack.rawCodec)) {\n codec = 'alac';\n } else if (/A_MPEG\\/L2/.test(decodedTrack.rawCodec)) {\n codec = 'mp2';\n } else if (/A_MPEG\\/L3/.test(decodedTrack.rawCodec)) {\n codec = 'mp3';\n } else if (/^A_AAC/.test(decodedTrack.rawCodec)) {\n if (decodedTrack.codecPrivate) {\n codec = 'mp4a.40.' + (decodedTrack.codecPrivate[0] >>> 3).toString();\n } else {\n codec = 'mp4a.40.2';\n }\n } else if (/^A_AC3/.test(decodedTrack.rawCodec)) {\n codec = 'ac-3';\n } else if (/^A_PCM/.test(decodedTrack.rawCodec)) {\n codec = 'pcm';\n } else if (/^A_MS\\/ACM/.test(decodedTrack.rawCodec)) {\n codec = 'speex';\n } else if (/^A_EAC3/.test(decodedTrack.rawCodec)) {\n codec = 'ec-3';\n } else if (/^A_VORBIS/.test(decodedTrack.rawCodec)) {\n codec = 'vorbis';\n } else if (/^A_FLAC/.test(decodedTrack.rawCodec)) {\n codec = 'flac';\n } else if (/^A_OPUS/.test(decodedTrack.rawCodec)) {\n codec = 'opus';\n }\n\n decodedTrack.codec = codec;\n decodedTracks.push(decodedTrack);\n });\n return decodedTracks.sort(function (a, b) {\n return a.number - b.number;\n });\n};\nvar parseData = function parseData(data, tracks) {\n var allBlocks = [];\n var segment = findEbml(data, [EBML_TAGS.Segment])[0];\n var timestampScale = findEbml(segment, [EBML_TAGS.SegmentInfo, EBML_TAGS.TimestampScale])[0]; // in nanoseconds, defaults to 1ms\n\n if (timestampScale && timestampScale.length) {\n timestampScale = (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(timestampScale);\n } else {\n timestampScale = 1000000;\n }\n\n var clusters = findEbml(segment, [EBML_TAGS.Cluster]);\n\n if (!tracks) {\n tracks = parseTracks(segment);\n }\n\n clusters.forEach(function (cluster, ci) {\n var simpleBlocks = findEbml(cluster, [EBML_TAGS.SimpleBlock]).map(function (b) {\n return {\n type: 'simple',\n data: b\n };\n });\n var blockGroups = findEbml(cluster, [EBML_TAGS.BlockGroup]).map(function (b) {\n return {\n type: 'group',\n data: b\n };\n });\n var timestamp = findEbml(cluster, [EBML_TAGS.Timestamp])[0] || 0;\n\n if (timestamp && timestamp.length) {\n timestamp = (0,_byte_helpers__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(timestamp);\n } // get all blocks then sort them into the correct order\n\n\n var blocks = simpleBlocks.concat(blockGroups).sort(function (a, b) {\n return a.data.byteOffset - b.data.byteOffset;\n });\n blocks.forEach(function (block, bi) {\n var decoded = decodeBlock(block.data, block.type, timestampScale, timestamp);\n allBlocks.push(decoded);\n });\n });\n return {\n tracks: tracks,\n blocks: allBlocks\n };\n};\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/ebml-helpers.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/id3-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getId3Offset: () => (/* binding */ getId3Offset),\n/* harmony export */ getId3Size: () => (/* binding */ getId3Size)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers.js */ "./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/byte-helpers.js");\n\nvar ID3 = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x49, 0x44, 0x33]);\nvar getId3Size = function getId3Size(bytes, offset) {\n if (offset === void 0) {\n offset = 0;\n }\n\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var flags = bytes[offset + 5];\n var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9];\n var footerPresent = (flags & 16) >> 4;\n\n if (footerPresent) {\n return returnSize + 20;\n }\n\n return returnSize + 10;\n};\nvar getId3Offset = function getId3Offset(bytes, offset) {\n if (offset === void 0) {\n offset = 0;\n }\n\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n\n if (bytes.length - offset < 10 || !(0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes, ID3, {\n offset: offset\n })) {\n return offset;\n }\n\n offset += getId3Size(bytes, offset); // recursive check for id3 tags as some files\n // have multiple ID3 tag sections even though\n // they should not.\n\n return getId3Offset(bytes, offset);\n};\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/id3-helpers.js?')},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/media-groups.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ forEachMediaGroup: () => (/* binding */ forEachMediaGroup)\n/* harmony export */ });\n/**\n * Loops through all supported media groups in master and calls the provided\n * callback for each group\n *\n * @param {Object} master\n * The parsed master manifest object\n * @param {string[]} groups\n * The media groups to call the callback for\n * @param {Function} callback\n * Callback to call for each media group\n */\nvar forEachMediaGroup = function forEachMediaGroup(master, groups, callback) {\n groups.forEach(function (mediaType) {\n for (var groupKey in master.mediaGroups[mediaType]) {\n for (var labelKey in master.mediaGroups[mediaType][groupKey]) {\n var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];\n callback(mediaProperties, mediaType, groupKey, labelKey);\n }\n }\n });\n};\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/media-groups.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/media-types.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ simpleTypeFromSourceType: () => (/* binding */ simpleTypeFromSourceType)\n/* harmony export */ });\nvar MPEGURL_REGEX = /^(audio|video|application)\\/(x-|vnd\\.apple\\.)?mpegurl/i;\nvar DASH_REGEX = /^application\\/dash\\+xml/i;\n/**\n * Returns a string that describes the type of source based on a video source object's\n * media type.\n *\n * @see {@link https://dev.w3.org/html5/pf-summary/video.html#dom-source-type|Source Type}\n *\n * @param {string} type\n * Video source object media type\n * @return {('hls'|'dash'|'vhs-json'|null)}\n * VHS source type string\n */\n\nvar simpleTypeFromSourceType = function simpleTypeFromSourceType(type) {\n if (MPEGURL_REGEX.test(type)) {\n return 'hls';\n }\n\n if (DASH_REGEX.test(type)) {\n return 'dash';\n } // Denotes the special case of a manifest object passed to http-streaming instead of a\n // source URL.\n //\n // See https://en.wikipedia.org/wiki/Media_type for details on specifying media types.\n //\n // In this case, vnd stands for vendor, video.js for the organization, VHS for this\n // project, and the +json suffix identifies the structure of the media type.\n\n\n if (type === 'application/vnd.videojs.vhs+json') {\n return 'vhs-json';\n }\n\n return null;\n};\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/media-types.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/mp4-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ addSampleDescription: () => (/* binding */ addSampleDescription),\n/* harmony export */ buildFrameTable: () => (/* binding */ buildFrameTable),\n/* harmony export */ findBox: () => (/* binding */ findBox),\n/* harmony export */ findNamedBox: () => (/* binding */ findNamedBox),\n/* harmony export */ parseDescriptors: () => (/* binding */ parseDescriptors),\n/* harmony export */ parseMediaInfo: () => (/* binding */ parseMediaInfo),\n/* harmony export */ parseTracks: () => (/* binding */ parseTracks)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n/* harmony import */ var _codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./codec-helpers.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/codec-helpers.js\");\n/* harmony import */ var _opus_helpers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./opus-helpers.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/opus-helpers.js\");\n\n\n\n\nvar normalizePath = function normalizePath(path) {\n if (typeof path === 'string') {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.stringToBytes)(path);\n }\n\n if (typeof path === 'number') {\n return path;\n }\n\n return path;\n};\n\nvar normalizePaths = function normalizePaths(paths) {\n if (!Array.isArray(paths)) {\n return [normalizePath(paths)];\n }\n\n return paths.map(function (p) {\n return normalizePath(p);\n });\n};\n\nvar DESCRIPTORS;\nvar parseDescriptors = function parseDescriptors(bytes) {\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var results = [];\n var i = 0;\n\n while (bytes.length > i) {\n var tag = bytes[i];\n var size = 0;\n var headerSize = 0; // tag\n\n headerSize++;\n var byte = bytes[headerSize]; // first byte\n\n headerSize++;\n\n while (byte & 0x80) {\n size = (byte & 0x7F) << 7;\n byte = bytes[headerSize];\n headerSize++;\n }\n\n size += byte & 0x7F;\n\n for (var z = 0; z < DESCRIPTORS.length; z++) {\n var _DESCRIPTORS$z = DESCRIPTORS[z],\n id = _DESCRIPTORS$z.id,\n parser = _DESCRIPTORS$z.parser;\n\n if (tag === id) {\n results.push(parser(bytes.subarray(headerSize, headerSize + size)));\n break;\n }\n }\n\n i += size + headerSize;\n }\n\n return results;\n};\nDESCRIPTORS = [{\n id: 0x03,\n parser: function parser(bytes) {\n var desc = {\n tag: 0x03,\n id: bytes[0] << 8 | bytes[1],\n flags: bytes[2],\n size: 3,\n dependsOnEsId: 0,\n ocrEsId: 0,\n descriptors: [],\n url: ''\n }; // depends on es id\n\n if (desc.flags & 0x80) {\n desc.dependsOnEsId = bytes[desc.size] << 8 | bytes[desc.size + 1];\n desc.size += 2;\n } // url\n\n\n if (desc.flags & 0x40) {\n var len = bytes[desc.size];\n desc.url = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToString)(bytes.subarray(desc.size + 1, desc.size + 1 + len));\n desc.size += len;\n } // ocr es id\n\n\n if (desc.flags & 0x20) {\n desc.ocrEsId = bytes[desc.size] << 8 | bytes[desc.size + 1];\n desc.size += 2;\n }\n\n desc.descriptors = parseDescriptors(bytes.subarray(desc.size)) || [];\n return desc;\n }\n}, {\n id: 0x04,\n parser: function parser(bytes) {\n // DecoderConfigDescriptor\n var desc = {\n tag: 0x04,\n oti: bytes[0],\n streamType: bytes[1],\n bufferSize: bytes[2] << 16 | bytes[3] << 8 | bytes[4],\n maxBitrate: bytes[5] << 24 | bytes[6] << 16 | bytes[7] << 8 | bytes[8],\n avgBitrate: bytes[9] << 24 | bytes[10] << 16 | bytes[11] << 8 | bytes[12],\n descriptors: parseDescriptors(bytes.subarray(13))\n };\n return desc;\n }\n}, {\n id: 0x05,\n parser: function parser(bytes) {\n // DecoderSpecificInfo\n return {\n tag: 0x05,\n bytes: bytes\n };\n }\n}, {\n id: 0x06,\n parser: function parser(bytes) {\n // SLConfigDescriptor\n return {\n tag: 0x06,\n bytes: bytes\n };\n }\n}];\n/**\n * find any number of boxes by name given a path to it in an iso bmff\n * such as mp4.\n *\n * @param {TypedArray} bytes\n * bytes for the iso bmff to search for boxes in\n *\n * @param {Uint8Array[]|string[]|string|Uint8Array} name\n * An array of paths or a single path representing the name\n * of boxes to search through in bytes. Paths may be\n * uint8 (character codes) or strings.\n *\n * @param {boolean} [complete=false]\n * Should we search only for complete boxes on the final path.\n * This is very useful when you do not want to get back partial boxes\n * in the case of streaming files.\n *\n * @return {Uint8Array[]}\n * An array of the end paths that we found.\n */\n\nvar findBox = function findBox(bytes, paths, complete) {\n if (complete === void 0) {\n complete = false;\n }\n\n paths = normalizePaths(paths);\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var results = [];\n\n if (!paths.length) {\n // short-circuit the search for empty paths\n return results;\n }\n\n var i = 0;\n\n while (i < bytes.length) {\n var size = (bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]) >>> 0;\n var type = bytes.subarray(i + 4, i + 8); // invalid box format.\n\n if (size === 0) {\n break;\n }\n\n var end = i + size;\n\n if (end > bytes.length) {\n // this box is bigger than the number of bytes we have\n // and complete is set, we cannot find any more boxes.\n if (complete) {\n break;\n }\n\n end = bytes.length;\n }\n\n var data = bytes.subarray(i + 8, end);\n\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(type, paths[0])) {\n if (paths.length === 1) {\n // this is the end of the path and we've found the box we were\n // looking for\n results.push(data);\n } else {\n // recursively search for the next box along the path\n results.push.apply(results, findBox(data, paths.slice(1), complete));\n }\n }\n\n i = end;\n } // we've finished searching all of bytes\n\n\n return results;\n};\n/**\n * Search for a single matching box by name in an iso bmff format like\n * mp4. This function is useful for finding codec boxes which\n * can be placed arbitrarily in sample descriptions depending\n * on the version of the file or file type.\n *\n * @param {TypedArray} bytes\n * bytes for the iso bmff to search for boxes in\n *\n * @param {string|Uint8Array} name\n * The name of the box to find.\n *\n * @return {Uint8Array[]}\n * a subarray of bytes representing the name boxed we found.\n */\n\nvar findNamedBox = function findNamedBox(bytes, name) {\n name = normalizePath(name);\n\n if (!name.length) {\n // short-circuit the search for empty paths\n return bytes.subarray(bytes.length);\n }\n\n var i = 0;\n\n while (i < bytes.length) {\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes.subarray(i, i + name.length), name)) {\n var size = (bytes[i - 4] << 24 | bytes[i - 3] << 16 | bytes[i - 2] << 8 | bytes[i - 1]) >>> 0;\n var end = size > 1 ? i + size : bytes.byteLength;\n return bytes.subarray(i + 4, end);\n }\n\n i++;\n } // we've finished searching all of bytes\n\n\n return bytes.subarray(bytes.length);\n};\n\nvar parseSamples = function parseSamples(data, entrySize, parseEntry) {\n if (entrySize === void 0) {\n entrySize = 4;\n }\n\n if (parseEntry === void 0) {\n parseEntry = function parseEntry(d) {\n return (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(d);\n };\n }\n\n var entries = [];\n\n if (!data || !data.length) {\n return entries;\n }\n\n var entryCount = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(data.subarray(4, 8));\n\n for (var i = 8; entryCount; i += entrySize, entryCount--) {\n entries.push(parseEntry(data.subarray(i, i + entrySize)));\n }\n\n return entries;\n};\n\nvar buildFrameTable = function buildFrameTable(stbl, timescale) {\n var keySamples = parseSamples(findBox(stbl, ['stss'])[0]);\n var chunkOffsets = parseSamples(findBox(stbl, ['stco'])[0]);\n var timeToSamples = parseSamples(findBox(stbl, ['stts'])[0], 8, function (entry) {\n return {\n sampleCount: (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(entry.subarray(0, 4)),\n sampleDelta: (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(entry.subarray(4, 8))\n };\n });\n var samplesToChunks = parseSamples(findBox(stbl, ['stsc'])[0], 12, function (entry) {\n return {\n firstChunk: (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(entry.subarray(0, 4)),\n samplesPerChunk: (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(entry.subarray(4, 8)),\n sampleDescriptionIndex: (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(entry.subarray(8, 12))\n };\n });\n var stsz = findBox(stbl, ['stsz'])[0]; // stsz starts with a 4 byte sampleSize which we don't need\n\n var sampleSizes = parseSamples(stsz && stsz.length && stsz.subarray(4) || null);\n var frames = [];\n\n for (var chunkIndex = 0; chunkIndex < chunkOffsets.length; chunkIndex++) {\n var samplesInChunk = void 0;\n\n for (var i = 0; i < samplesToChunks.length; i++) {\n var sampleToChunk = samplesToChunks[i];\n var isThisOne = chunkIndex + 1 >= sampleToChunk.firstChunk && (i + 1 >= samplesToChunks.length || chunkIndex + 1 < samplesToChunks[i + 1].firstChunk);\n\n if (isThisOne) {\n samplesInChunk = sampleToChunk.samplesPerChunk;\n break;\n }\n }\n\n var chunkOffset = chunkOffsets[chunkIndex];\n\n for (var _i = 0; _i < samplesInChunk; _i++) {\n var frameEnd = sampleSizes[frames.length]; // if we don't have key samples every frame is a keyframe\n\n var keyframe = !keySamples.length;\n\n if (keySamples.length && keySamples.indexOf(frames.length + 1) !== -1) {\n keyframe = true;\n }\n\n var frame = {\n keyframe: keyframe,\n start: chunkOffset,\n end: chunkOffset + frameEnd\n };\n\n for (var k = 0; k < timeToSamples.length; k++) {\n var _timeToSamples$k = timeToSamples[k],\n sampleCount = _timeToSamples$k.sampleCount,\n sampleDelta = _timeToSamples$k.sampleDelta;\n\n if (frames.length <= sampleCount) {\n // ms to ns\n var lastTimestamp = frames.length ? frames[frames.length - 1].timestamp : 0;\n frame.timestamp = lastTimestamp + sampleDelta / timescale * 1000;\n frame.duration = sampleDelta;\n break;\n }\n }\n\n frames.push(frame);\n chunkOffset += frameEnd;\n }\n }\n\n return frames;\n};\nvar addSampleDescription = function addSampleDescription(track, bytes) {\n var codec = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToString)(bytes.subarray(0, 4));\n\n if (track.type === 'video') {\n track.info = track.info || {};\n track.info.width = bytes[28] << 8 | bytes[29];\n track.info.height = bytes[30] << 8 | bytes[31];\n } else if (track.type === 'audio') {\n track.info = track.info || {};\n track.info.channels = bytes[20] << 8 | bytes[21];\n track.info.bitDepth = bytes[22] << 8 | bytes[23];\n track.info.sampleRate = bytes[28] << 8 | bytes[29];\n }\n\n if (codec === 'avc1') {\n var avcC = findNamedBox(bytes, 'avcC'); // AVCDecoderConfigurationRecord\n\n codec += \".\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getAvcCodec)(avcC);\n track.info.avcC = avcC; // TODO: do we need to parse all this?\n\n /* {\n configurationVersion: avcC[0],\n profile: avcC[1],\n profileCompatibility: avcC[2],\n level: avcC[3],\n lengthSizeMinusOne: avcC[4] & 0x3\n };\n let spsNalUnitCount = avcC[5] & 0x1F;\n const spsNalUnits = track.info.avc.spsNalUnits = [];\n // past spsNalUnitCount\n let offset = 6;\n while (spsNalUnitCount--) {\n const nalLen = avcC[offset] << 8 | avcC[offset + 1];\n spsNalUnits.push(avcC.subarray(offset + 2, offset + 2 + nalLen));\n offset += nalLen + 2;\n }\n let ppsNalUnitCount = avcC[offset];\n const ppsNalUnits = track.info.avc.ppsNalUnits = [];\n // past ppsNalUnitCount\n offset += 1;\n while (ppsNalUnitCount--) {\n const nalLen = avcC[offset] << 8 | avcC[offset + 1];\n ppsNalUnits.push(avcC.subarray(offset + 2, offset + 2 + nalLen));\n offset += nalLen + 2;\n }*/\n // HEVCDecoderConfigurationRecord\n } else if (codec === 'hvc1' || codec === 'hev1') {\n codec += \".\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getHvcCodec)(findNamedBox(bytes, 'hvcC'));\n } else if (codec === 'mp4a' || codec === 'mp4v') {\n var esds = findNamedBox(bytes, 'esds');\n var esDescriptor = parseDescriptors(esds.subarray(4))[0];\n var decoderConfig = esDescriptor && esDescriptor.descriptors.filter(function (_ref) {\n var tag = _ref.tag;\n return tag === 0x04;\n })[0];\n\n if (decoderConfig) {\n // most codecs do not have a further '.'\n // such as 0xa5 for ac-3 and 0xa6 for e-ac-3\n codec += '.' + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toHexString)(decoderConfig.oti);\n\n if (decoderConfig.oti === 0x40) {\n codec += '.' + (decoderConfig.descriptors[0].bytes[0] >> 3).toString();\n } else if (decoderConfig.oti === 0x20) {\n codec += '.' + decoderConfig.descriptors[0].bytes[4].toString();\n } else if (decoderConfig.oti === 0xdd) {\n codec = 'vorbis';\n }\n } else if (track.type === 'audio') {\n codec += '.40.2';\n } else {\n codec += '.20.9';\n }\n } else if (codec === 'av01') {\n // AV1DecoderConfigurationRecord\n codec += \".\" + (0,_codec_helpers_js__WEBPACK_IMPORTED_MODULE_1__.getAv1Codec)(findNamedBox(bytes, 'av1C'));\n } else if (codec === 'vp09') {\n // VPCodecConfigurationRecord\n var vpcC = findNamedBox(bytes, 'vpcC'); // https://www.webmproject.org/vp9/mp4/\n\n var profile = vpcC[0];\n var level = vpcC[1];\n var bitDepth = vpcC[2] >> 4;\n var chromaSubsampling = (vpcC[2] & 0x0F) >> 1;\n var videoFullRangeFlag = (vpcC[2] & 0x0F) >> 3;\n var colourPrimaries = vpcC[3];\n var transferCharacteristics = vpcC[4];\n var matrixCoefficients = vpcC[5];\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(profile, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(level, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(bitDepth, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(chromaSubsampling, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(colourPrimaries, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(transferCharacteristics, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(matrixCoefficients, 2, '0');\n codec += \".\" + (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.padStart)(videoFullRangeFlag, 2, '0');\n } else if (codec === 'theo') {\n codec = 'theora';\n } else if (codec === 'spex') {\n codec = 'speex';\n } else if (codec === '.mp3') {\n codec = 'mp4a.40.34';\n } else if (codec === 'msVo') {\n codec = 'vorbis';\n } else if (codec === 'Opus') {\n codec = 'opus';\n var dOps = findNamedBox(bytes, 'dOps');\n track.info.opus = (0,_opus_helpers_js__WEBPACK_IMPORTED_MODULE_2__.parseOpusHead)(dOps); // TODO: should this go into the webm code??\n // Firefox requires a codecDelay for opus playback\n // see https://bugzilla.mozilla.org/show_bug.cgi?id=1276238\n\n track.info.codecDelay = 6500000;\n } else {\n codec = codec.toLowerCase();\n }\n /* eslint-enable */\n // flac, ac-3, ec-3, opus\n\n\n track.codec = codec;\n};\nvar parseTracks = function parseTracks(bytes, frameTable) {\n if (frameTable === void 0) {\n frameTable = true;\n }\n\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n var traks = findBox(bytes, ['moov', 'trak'], true);\n var tracks = [];\n traks.forEach(function (trak) {\n var track = {\n bytes: trak\n };\n var mdia = findBox(trak, ['mdia'])[0];\n var hdlr = findBox(mdia, ['hdlr'])[0];\n var trakType = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToString)(hdlr.subarray(8, 12));\n\n if (trakType === 'soun') {\n track.type = 'audio';\n } else if (trakType === 'vide') {\n track.type = 'video';\n } else {\n track.type = trakType;\n }\n\n var tkhd = findBox(trak, ['tkhd'])[0];\n\n if (tkhd) {\n var view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength);\n var tkhdVersion = view.getUint8(0);\n track.number = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20);\n }\n\n var mdhd = findBox(mdia, ['mdhd'])[0];\n\n if (mdhd) {\n // mdhd is a FullBox, meaning it will have its own version as the first byte\n var version = mdhd[0];\n var index = version === 0 ? 12 : 20;\n track.timescale = (mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]) >>> 0;\n }\n\n var stbl = findBox(mdia, ['minf', 'stbl'])[0];\n var stsd = findBox(stbl, ['stsd'])[0];\n var descriptionCount = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(stsd.subarray(4, 8));\n var offset = 8; // add codec and codec info\n\n while (descriptionCount--) {\n var len = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(stsd.subarray(offset, offset + 4));\n var sampleDescriptor = stsd.subarray(offset + 4, offset + 4 + len);\n addSampleDescription(track, sampleDescriptor);\n offset += 4 + len;\n }\n\n if (frameTable) {\n track.frameTable = buildFrameTable(stbl, track.timescale);\n } // codec has no sub parameters\n\n\n tracks.push(track);\n });\n return tracks;\n};\nvar parseMediaInfo = function parseMediaInfo(bytes) {\n var mvhd = findBox(bytes, ['moov', 'mvhd'], true)[0];\n\n if (!mvhd || !mvhd.length) {\n return;\n }\n\n var info = {}; // ms to ns\n // mvhd v1 has 8 byte duration and other fields too\n\n if (mvhd[0] === 1) {\n info.timestampScale = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(mvhd.subarray(20, 24));\n info.duration = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(mvhd.subarray(24, 32));\n } else {\n info.timestampScale = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(mvhd.subarray(12, 16));\n info.duration = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumber)(mvhd.subarray(16, 20));\n }\n\n info.bytes = mvhd;\n return info;\n};\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/mp4-helpers.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/nal-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ EMULATION_PREVENTION: () => (/* binding */ EMULATION_PREVENTION),\n/* harmony export */ NAL_TYPE_ONE: () => (/* binding */ NAL_TYPE_ONE),\n/* harmony export */ NAL_TYPE_TWO: () => (/* binding */ NAL_TYPE_TWO),\n/* harmony export */ discardEmulationPreventionBytes: () => (/* binding */ discardEmulationPreventionBytes),\n/* harmony export */ findH264Nal: () => (/* binding */ findH264Nal),\n/* harmony export */ findH265Nal: () => (/* binding */ findH265Nal),\n/* harmony export */ findNal: () => (/* binding */ findNal)\n/* harmony export */ });\n/* harmony import */ var _byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-helpers.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n\nvar NAL_TYPE_ONE = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x00, 0x00, 0x00, 0x01]);\nvar NAL_TYPE_TWO = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x00, 0x00, 0x01]);\nvar EMULATION_PREVENTION = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)([0x00, 0x00, 0x03]);\n/**\n * Expunge any \"Emulation Prevention\" bytes from a \"Raw Byte\n * Sequence Payload\"\n *\n * @param data {Uint8Array} the bytes of a RBSP from a NAL\n * unit\n * @return {Uint8Array} the RBSP without any Emulation\n * Prevention Bytes\n */\n\nvar discardEmulationPreventionBytes = function discardEmulationPreventionBytes(bytes) {\n var positions = [];\n var i = 1; // Find all `Emulation Prevention Bytes`\n\n while (i < bytes.length - 2) {\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes.subarray(i, i + 3), EMULATION_PREVENTION)) {\n positions.push(i + 2);\n i++;\n }\n\n i++;\n } // If no Emulation Prevention Bytes were found just return the original\n // array\n\n\n if (positions.length === 0) {\n return bytes;\n } // Create a new array to hold the NAL unit data\n\n\n var newLength = bytes.length - positions.length;\n var newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === positions[0]) {\n // Skip this byte\n sourceIndex++; // Remove this position index\n\n positions.shift();\n }\n\n newData[i] = bytes[sourceIndex];\n }\n\n return newData;\n};\nvar findNal = function findNal(bytes, dataType, types, nalLimit) {\n if (nalLimit === void 0) {\n nalLimit = Infinity;\n }\n\n bytes = (0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.toUint8)(bytes);\n types = [].concat(types);\n var i = 0;\n var nalStart;\n var nalsFound = 0; // keep searching until:\n // we reach the end of bytes\n // we reach the maximum number of nals they want to seach\n // NOTE: that we disregard nalLimit when we have found the start\n // of the nal we want so that we can find the end of the nal we want.\n\n while (i < bytes.length && (nalsFound < nalLimit || nalStart)) {\n var nalOffset = void 0;\n\n if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes.subarray(i), NAL_TYPE_ONE)) {\n nalOffset = 4;\n } else if ((0,_byte_helpers_js__WEBPACK_IMPORTED_MODULE_0__.bytesMatch)(bytes.subarray(i), NAL_TYPE_TWO)) {\n nalOffset = 3;\n } // we are unsynced,\n // find the next nal unit\n\n\n if (!nalOffset) {\n i++;\n continue;\n }\n\n nalsFound++;\n\n if (nalStart) {\n return discardEmulationPreventionBytes(bytes.subarray(nalStart, i));\n }\n\n var nalType = void 0;\n\n if (dataType === 'h264') {\n nalType = bytes[i + nalOffset] & 0x1f;\n } else if (dataType === 'h265') {\n nalType = bytes[i + nalOffset] >> 1 & 0x3f;\n }\n\n if (types.indexOf(nalType) !== -1) {\n nalStart = i + nalOffset;\n } // nal header is 1 length for h264, and 2 for h265\n\n\n i += nalOffset + (dataType === 'h264' ? 1 : 2);\n }\n\n return bytes.subarray(0, 0);\n};\nvar findH264Nal = function findH264Nal(bytes, type, nalLimit) {\n return findNal(bytes, 'h264', type, nalLimit);\n};\nvar findH265Nal = function findH265Nal(bytes, type, nalLimit) {\n return findNal(bytes, 'h265', type, nalLimit);\n};\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/nal-helpers.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/opus-helpers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ OPUS_HEAD: () => (/* binding */ OPUS_HEAD),\n/* harmony export */ parseOpusHead: () => (/* binding */ parseOpusHead),\n/* harmony export */ setOpusHead: () => (/* binding */ setOpusHead)\n/* harmony export */ });\nvar OPUS_HEAD = new Uint8Array([// O, p, u, s\n0x4f, 0x70, 0x75, 0x73, // H, e, a, d\n0x48, 0x65, 0x61, 0x64]); // https://wiki.xiph.org/OggOpus\n// https://vfrmaniac.fushizen.eu/contents/opus_in_isobmff.html\n// https://opus-codec.org/docs/opusfile_api-0.7/structOpusHead.html\n\nvar parseOpusHead = function parseOpusHead(bytes) {\n var view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n var version = view.getUint8(0); // version 0, from mp4, does not use littleEndian.\n\n var littleEndian = version !== 0;\n var config = {\n version: version,\n channels: view.getUint8(1),\n preSkip: view.getUint16(2, littleEndian),\n sampleRate: view.getUint32(4, littleEndian),\n outputGain: view.getUint16(8, littleEndian),\n channelMappingFamily: view.getUint8(10)\n };\n\n if (config.channelMappingFamily > 0 && bytes.length > 10) {\n config.streamCount = view.getUint8(11);\n config.twoChannelStreamCount = view.getUint8(12);\n config.channelMapping = [];\n\n for (var c = 0; c < config.channels; c++) {\n config.channelMapping.push(view.getUint8(13 + c));\n }\n }\n\n return config;\n};\nvar setOpusHead = function setOpusHead(config) {\n var size = config.channelMappingFamily <= 0 ? 11 : 12 + config.channels;\n var view = new DataView(new ArrayBuffer(size));\n var littleEndian = config.version !== 0;\n view.setUint8(0, config.version);\n view.setUint8(1, config.channels);\n view.setUint16(2, config.preSkip, littleEndian);\n view.setUint32(4, config.sampleRate, littleEndian);\n view.setUint16(8, config.outputGain, littleEndian);\n view.setUint8(10, config.channelMappingFamily);\n\n if (config.channelMappingFamily > 0) {\n view.setUint8(11, config.streamCount);\n config.channelMapping.foreach(function (cm, i) {\n view.setUint8(12 + i, cm);\n });\n }\n\n return new Uint8Array(view.buffer);\n};\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/opus-helpers.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/resolve-url.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var url_toolkit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! url-toolkit */ \"./node_modules/url-toolkit/src/url-toolkit.js\");\n/* harmony import */ var url_toolkit__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(url_toolkit__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_1__);\n\n\nvar DEFAULT_LOCATION = 'http://example.com';\n\nvar resolveUrl = function resolveUrl(baseUrl, relativeUrl) {\n // return early if we don't need to resolve\n if (/^[a-z]+:/i.test(relativeUrl)) {\n return relativeUrl;\n } // if baseUrl is a data URI, ignore it and resolve everything relative to window.location\n\n\n if (/^data:/.test(baseUrl)) {\n baseUrl = (global_window__WEBPACK_IMPORTED_MODULE_1___default().location) && (global_window__WEBPACK_IMPORTED_MODULE_1___default().location).href || '';\n } // IE11 supports URL but not the URL constructor\n // feature detect the behavior we want\n\n\n var nativeURL = typeof (global_window__WEBPACK_IMPORTED_MODULE_1___default().URL) === 'function';\n var protocolLess = /^\\/\\//.test(baseUrl); // remove location if window.location isn't available (i.e. we're in node)\n // and if baseUrl isn't an absolute url\n\n var removeLocation = !(global_window__WEBPACK_IMPORTED_MODULE_1___default().location) && !/\\/\\//i.test(baseUrl); // if the base URL is relative then combine with the current location\n\n if (nativeURL) {\n baseUrl = new (global_window__WEBPACK_IMPORTED_MODULE_1___default().URL)(baseUrl, (global_window__WEBPACK_IMPORTED_MODULE_1___default().location) || DEFAULT_LOCATION);\n } else if (!/\\/\\//i.test(baseUrl)) {\n baseUrl = url_toolkit__WEBPACK_IMPORTED_MODULE_0___default().buildAbsoluteURL((global_window__WEBPACK_IMPORTED_MODULE_1___default().location) && (global_window__WEBPACK_IMPORTED_MODULE_1___default().location).href || '', baseUrl);\n }\n\n if (nativeURL) {\n var newUrl = new URL(relativeUrl, baseUrl); // if we're a protocol-less url, remove the protocol\n // and if we're location-less, remove the location\n // otherwise, return the url unmodified\n\n if (removeLocation) {\n return newUrl.href.slice(DEFAULT_LOCATION.length);\n } else if (protocolLess) {\n return newUrl.href.slice(newUrl.protocol.length);\n }\n\n return newUrl.href;\n }\n\n return url_toolkit__WEBPACK_IMPORTED_MODULE_0___default().buildAbsoluteURL(baseUrl, relativeUrl);\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (resolveUrl);\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/resolve-url.js?")},"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/stream.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ Stream)\n/* harmony export */ });\n/**\n * @file stream.js\n */\n\n/**\n * A lightweight readable stream implemention that handles event dispatching.\n *\n * @class Stream\n */\nvar Stream = /*#__PURE__*/function () {\n function Stream() {\n this.listeners = {};\n }\n /**\n * Add a listener for a specified event type.\n *\n * @param {string} type the event name\n * @param {Function} listener the callback to be invoked when an event of\n * the specified type occurs\n */\n\n\n var _proto = Stream.prototype;\n\n _proto.on = function on(type, listener) {\n if (!this.listeners[type]) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push(listener);\n }\n /**\n * Remove a listener for a specified event type.\n *\n * @param {string} type the event name\n * @param {Function} listener a function previously registered for this\n * type of event through `on`\n * @return {boolean} if we could turn it off or not\n */\n ;\n\n _proto.off = function off(type, listener) {\n if (!this.listeners[type]) {\n return false;\n }\n\n var index = this.listeners[type].indexOf(listener); // TODO: which is better?\n // In Video.js we slice listener functions\n // on trigger so that it does not mess up the order\n // while we loop through.\n //\n // Here we slice on off so that the loop in trigger\n // can continue using it's old reference to loop without\n // messing up the order.\n\n this.listeners[type] = this.listeners[type].slice(0);\n this.listeners[type].splice(index, 1);\n return index > -1;\n }\n /**\n * Trigger an event of the specified type on this stream. Any additional\n * arguments to this function are passed as parameters to event listeners.\n *\n * @param {string} type the event name\n */\n ;\n\n _proto.trigger = function trigger(type) {\n var callbacks = this.listeners[type];\n\n if (!callbacks) {\n return;\n } // Slicing the arguments on every invocation of this method\n // can add a significant amount of overhead. Avoid the\n // intermediate object creation for the common case of a\n // single callback argument\n\n\n if (arguments.length === 2) {\n var length = callbacks.length;\n\n for (var i = 0; i < length; ++i) {\n callbacks[i].call(this, arguments[1]);\n }\n } else {\n var args = Array.prototype.slice.call(arguments, 1);\n var _length = callbacks.length;\n\n for (var _i = 0; _i < _length; ++_i) {\n callbacks[_i].apply(this, args);\n }\n }\n }\n /**\n * Destroys the stream and cleans up.\n */\n ;\n\n _proto.dispose = function dispose() {\n this.listeners = {};\n }\n /**\n * Forwards all `data` events on this stream to the destination stream. The\n * destination stream should provide a method `push` to receive the data\n * events as they arrive.\n *\n * @param {Stream} destination the stream that will receive all `data` events\n * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options\n */\n ;\n\n _proto.pipe = function pipe(destination) {\n this.on('data', function (data) {\n destination.push(data);\n });\n };\n\n return Stream;\n}();\n\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/stream.js?")},"./node_modules/videojs-contrib-dash/node_modules/m3u8-parser/dist/m3u8-parser.es.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ LineStream: () => (/* binding */ LineStream),\n/* harmony export */ ParseStream: () => (/* binding */ ParseStream),\n/* harmony export */ Parser: () => (/* binding */ Parser)\n/* harmony export */ });\n/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/inheritsLoose */ \"./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js\");\n/* harmony import */ var _videojs_vhs_utils_es_stream_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @videojs/vhs-utils/es/stream.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/stream.js\");\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ \"./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js\");\n/* harmony import */ var _videojs_vhs_utils_es_decode_b64_to_uint8_array_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @videojs/vhs-utils/es/decode-b64-to-uint8-array.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js\");\n/*! @name m3u8-parser @version 4.8.0 @license Apache-2.0 */\n\n\n\n\n\n\n/**\n * A stream that buffers string input and generates a `data` event for each\n * line.\n *\n * @class LineStream\n * @extends Stream\n */\n\nvar LineStream = /*#__PURE__*/function (_Stream) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(LineStream, _Stream);\n\n function LineStream() {\n var _this;\n\n _this = _Stream.call(this) || this;\n _this.buffer = '';\n return _this;\n }\n /**\n * Add new data to be parsed.\n *\n * @param {string} data the text to process\n */\n\n\n var _proto = LineStream.prototype;\n\n _proto.push = function push(data) {\n var nextNewline;\n this.buffer += data;\n nextNewline = this.buffer.indexOf('\\n');\n\n for (; nextNewline > -1; nextNewline = this.buffer.indexOf('\\n')) {\n this.trigger('data', this.buffer.substring(0, nextNewline));\n this.buffer = this.buffer.substring(nextNewline + 1);\n }\n };\n\n return LineStream;\n}(_videojs_vhs_utils_es_stream_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n\nvar TAB = String.fromCharCode(0x09);\n\nvar parseByterange = function parseByterange(byterangeString) {\n // optionally match and capture 0+ digits before `@`\n // optionally match and capture 0+ digits after `@`\n var match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || '');\n var result = {};\n\n if (match[1]) {\n result.length = parseInt(match[1], 10);\n }\n\n if (match[2]) {\n result.offset = parseInt(match[2], 10);\n }\n\n return result;\n};\n/**\n * \"forgiving\" attribute list psuedo-grammar:\n * attributes -> keyvalue (',' keyvalue)*\n * keyvalue -> key '=' value\n * key -> [^=]*\n * value -> '\"' [^\"]* '\"' | [^,]*\n */\n\n\nvar attributeSeparator = function attributeSeparator() {\n var key = '[^=]*';\n var value = '\"[^\"]*\"|[^,]*';\n var keyvalue = '(?:' + key + ')=(?:' + value + ')';\n return new RegExp('(?:^|,)(' + keyvalue + ')');\n};\n/**\n * Parse attributes from a line given the separator\n *\n * @param {string} attributes the attribute line to parse\n */\n\n\nvar parseAttributes = function parseAttributes(attributes) {\n // split the string using attributes as the separator\n var attrs = attributes.split(attributeSeparator());\n var result = {};\n var i = attrs.length;\n var attr;\n\n while (i--) {\n // filter out unmatched portions of the string\n if (attrs[i] === '') {\n continue;\n } // split the key and value\n\n\n attr = /([^=]*)=(.*)/.exec(attrs[i]).slice(1); // trim whitespace and remove optional quotes around the value\n\n attr[0] = attr[0].replace(/^\\s+|\\s+$/g, '');\n attr[1] = attr[1].replace(/^\\s+|\\s+$/g, '');\n attr[1] = attr[1].replace(/^['\"](.*)['\"]$/g, '$1');\n result[attr[0]] = attr[1];\n }\n\n return result;\n};\n/**\n * A line-level M3U8 parser event stream. It expects to receive input one\n * line at a time and performs a context-free parse of its contents. A stream\n * interpretation of a manifest can be useful if the manifest is expected to\n * be too large to fit comfortably into memory or the entirety of the input\n * is not immediately available. Otherwise, it's probably much easier to work\n * with a regular `Parser` object.\n *\n * Produces `data` events with an object that captures the parser's\n * interpretation of the input. That object has a property `tag` that is one\n * of `uri`, `comment`, or `tag`. URIs only have a single additional\n * property, `line`, which captures the entirety of the input without\n * interpretation. Comments similarly have a single additional property\n * `text` which is the input without the leading `#`.\n *\n * Tags always have a property `tagType` which is the lower-cased version of\n * the M3U8 directive without the `#EXT` or `#EXT-X-` prefix. For instance,\n * `#EXT-X-MEDIA-SEQUENCE` becomes `media-sequence` when parsed. Unrecognized\n * tags are given the tag type `unknown` and a single additional property\n * `data` with the remainder of the input.\n *\n * @class ParseStream\n * @extends Stream\n */\n\n\nvar ParseStream = /*#__PURE__*/function (_Stream) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(ParseStream, _Stream);\n\n function ParseStream() {\n var _this;\n\n _this = _Stream.call(this) || this;\n _this.customParsers = [];\n _this.tagMappers = [];\n return _this;\n }\n /**\n * Parses an additional line of input.\n *\n * @param {string} line a single line of an M3U8 file to parse\n */\n\n\n var _proto = ParseStream.prototype;\n\n _proto.push = function push(line) {\n var _this2 = this;\n\n var match;\n var event; // strip whitespace\n\n line = line.trim();\n\n if (line.length === 0) {\n // ignore empty lines\n return;\n } // URIs\n\n\n if (line[0] !== '#') {\n this.trigger('data', {\n type: 'uri',\n uri: line\n });\n return;\n } // map tags\n\n\n var newLines = this.tagMappers.reduce(function (acc, mapper) {\n var mappedLine = mapper(line); // skip if unchanged\n\n if (mappedLine === line) {\n return acc;\n }\n\n return acc.concat([mappedLine]);\n }, [line]);\n newLines.forEach(function (newLine) {\n for (var i = 0; i < _this2.customParsers.length; i++) {\n if (_this2.customParsers[i].call(_this2, newLine)) {\n return;\n }\n } // Comments\n\n\n if (newLine.indexOf('#EXT') !== 0) {\n _this2.trigger('data', {\n type: 'comment',\n text: newLine.slice(1)\n });\n\n return;\n } // strip off any carriage returns here so the regex matching\n // doesn't have to account for them.\n\n\n newLine = newLine.replace('\\r', ''); // Tags\n\n match = /^#EXTM3U/.exec(newLine);\n\n if (match) {\n _this2.trigger('data', {\n type: 'tag',\n tagType: 'm3u'\n });\n\n return;\n }\n\n match = /^#EXTINF:?([0-9\\.]*)?,?(.*)?$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'inf'\n };\n\n if (match[1]) {\n event.duration = parseFloat(match[1]);\n }\n\n if (match[2]) {\n event.title = match[2];\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'targetduration'\n };\n\n if (match[1]) {\n event.duration = parseInt(match[1], 10);\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'version'\n };\n\n if (match[1]) {\n event.version = parseInt(match[1], 10);\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-MEDIA-SEQUENCE:?(\\-?[0-9.]*)?/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'media-sequence'\n };\n\n if (match[1]) {\n event.number = parseInt(match[1], 10);\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\\-?[0-9.]*)?/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'discontinuity-sequence'\n };\n\n if (match[1]) {\n event.number = parseInt(match[1], 10);\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'playlist-type'\n };\n\n if (match[1]) {\n event.playlistType = match[1];\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-BYTERANGE:?(.*)?$/.exec(newLine);\n\n if (match) {\n event = (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(parseByterange(match[1]), {\n type: 'tag',\n tagType: 'byterange'\n });\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'allow-cache'\n };\n\n if (match[1]) {\n event.allowed = !/NO/.test(match[1]);\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-MAP:?(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'map'\n };\n\n if (match[1]) {\n var attributes = parseAttributes(match[1]);\n\n if (attributes.URI) {\n event.uri = attributes.URI;\n }\n\n if (attributes.BYTERANGE) {\n event.byterange = parseByterange(attributes.BYTERANGE);\n }\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-STREAM-INF:?(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'stream-inf'\n };\n\n if (match[1]) {\n event.attributes = parseAttributes(match[1]);\n\n if (event.attributes.RESOLUTION) {\n var split = event.attributes.RESOLUTION.split('x');\n var resolution = {};\n\n if (split[0]) {\n resolution.width = parseInt(split[0], 10);\n }\n\n if (split[1]) {\n resolution.height = parseInt(split[1], 10);\n }\n\n event.attributes.RESOLUTION = resolution;\n }\n\n if (event.attributes.BANDWIDTH) {\n event.attributes.BANDWIDTH = parseInt(event.attributes.BANDWIDTH, 10);\n }\n\n if (event.attributes['FRAME-RATE']) {\n event.attributes['FRAME-RATE'] = parseFloat(event.attributes['FRAME-RATE']);\n }\n\n if (event.attributes['PROGRAM-ID']) {\n event.attributes['PROGRAM-ID'] = parseInt(event.attributes['PROGRAM-ID'], 10);\n }\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-MEDIA:?(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'media'\n };\n\n if (match[1]) {\n event.attributes = parseAttributes(match[1]);\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-ENDLIST/.exec(newLine);\n\n if (match) {\n _this2.trigger('data', {\n type: 'tag',\n tagType: 'endlist'\n });\n\n return;\n }\n\n match = /^#EXT-X-DISCONTINUITY/.exec(newLine);\n\n if (match) {\n _this2.trigger('data', {\n type: 'tag',\n tagType: 'discontinuity'\n });\n\n return;\n }\n\n match = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'program-date-time'\n };\n\n if (match[1]) {\n event.dateTimeString = match[1];\n event.dateTimeObject = new Date(match[1]);\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-KEY:?(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'key'\n };\n\n if (match[1]) {\n event.attributes = parseAttributes(match[1]); // parse the IV string into a Uint32Array\n\n if (event.attributes.IV) {\n if (event.attributes.IV.substring(0, 2).toLowerCase() === '0x') {\n event.attributes.IV = event.attributes.IV.substring(2);\n }\n\n event.attributes.IV = event.attributes.IV.match(/.{8}/g);\n event.attributes.IV[0] = parseInt(event.attributes.IV[0], 16);\n event.attributes.IV[1] = parseInt(event.attributes.IV[1], 16);\n event.attributes.IV[2] = parseInt(event.attributes.IV[2], 16);\n event.attributes.IV[3] = parseInt(event.attributes.IV[3], 16);\n event.attributes.IV = new Uint32Array(event.attributes.IV);\n }\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-START:?(.*)$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'start'\n };\n\n if (match[1]) {\n event.attributes = parseAttributes(match[1]);\n event.attributes['TIME-OFFSET'] = parseFloat(event.attributes['TIME-OFFSET']);\n event.attributes.PRECISE = /YES/.test(event.attributes.PRECISE);\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'cue-out-cont'\n };\n\n if (match[1]) {\n event.data = match[1];\n } else {\n event.data = '';\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'cue-out'\n };\n\n if (match[1]) {\n event.data = match[1];\n } else {\n event.data = '';\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-CUE-IN:?(.*)?$/.exec(newLine);\n\n if (match) {\n event = {\n type: 'tag',\n tagType: 'cue-in'\n };\n\n if (match[1]) {\n event.data = match[1];\n } else {\n event.data = '';\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-SKIP:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'skip'\n };\n event.attributes = parseAttributes(match[1]);\n\n if (event.attributes.hasOwnProperty('SKIPPED-SEGMENTS')) {\n event.attributes['SKIPPED-SEGMENTS'] = parseInt(event.attributes['SKIPPED-SEGMENTS'], 10);\n }\n\n if (event.attributes.hasOwnProperty('RECENTLY-REMOVED-DATERANGES')) {\n event.attributes['RECENTLY-REMOVED-DATERANGES'] = event.attributes['RECENTLY-REMOVED-DATERANGES'].split(TAB);\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-PART:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'part'\n };\n event.attributes = parseAttributes(match[1]);\n ['DURATION'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = parseFloat(event.attributes[key]);\n }\n });\n ['INDEPENDENT', 'GAP'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = /YES/.test(event.attributes[key]);\n }\n });\n\n if (event.attributes.hasOwnProperty('BYTERANGE')) {\n event.attributes.byterange = parseByterange(event.attributes.BYTERANGE);\n }\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'server-control'\n };\n event.attributes = parseAttributes(match[1]);\n ['CAN-SKIP-UNTIL', 'PART-HOLD-BACK', 'HOLD-BACK'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = parseFloat(event.attributes[key]);\n }\n });\n ['CAN-SKIP-DATERANGES', 'CAN-BLOCK-RELOAD'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = /YES/.test(event.attributes[key]);\n }\n });\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'part-inf'\n };\n event.attributes = parseAttributes(match[1]);\n ['PART-TARGET'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = parseFloat(event.attributes[key]);\n }\n });\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'preload-hint'\n };\n event.attributes = parseAttributes(match[1]);\n ['BYTERANGE-START', 'BYTERANGE-LENGTH'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = parseInt(event.attributes[key], 10);\n var subkey = key === 'BYTERANGE-LENGTH' ? 'length' : 'offset';\n event.attributes.byterange = event.attributes.byterange || {};\n event.attributes.byterange[subkey] = event.attributes[key]; // only keep the parsed byterange object.\n\n delete event.attributes[key];\n }\n });\n\n _this2.trigger('data', event);\n\n return;\n }\n\n match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine);\n\n if (match && match[1]) {\n event = {\n type: 'tag',\n tagType: 'rendition-report'\n };\n event.attributes = parseAttributes(match[1]);\n ['LAST-MSN', 'LAST-PART'].forEach(function (key) {\n if (event.attributes.hasOwnProperty(key)) {\n event.attributes[key] = parseInt(event.attributes[key], 10);\n }\n });\n\n _this2.trigger('data', event);\n\n return;\n } // unknown tag type\n\n\n _this2.trigger('data', {\n type: 'tag',\n data: newLine.slice(4)\n });\n });\n }\n /**\n * Add a parser for custom headers\n *\n * @param {Object} options a map of options for the added parser\n * @param {RegExp} options.expression a regular expression to match the custom header\n * @param {string} options.customType the custom type to register to the output\n * @param {Function} [options.dataParser] function to parse the line into an object\n * @param {boolean} [options.segment] should tag data be attached to the segment object\n */\n ;\n\n _proto.addParser = function addParser(_ref) {\n var _this3 = this;\n\n var expression = _ref.expression,\n customType = _ref.customType,\n dataParser = _ref.dataParser,\n segment = _ref.segment;\n\n if (typeof dataParser !== 'function') {\n dataParser = function dataParser(line) {\n return line;\n };\n }\n\n this.customParsers.push(function (line) {\n var match = expression.exec(line);\n\n if (match) {\n _this3.trigger('data', {\n type: 'custom',\n data: dataParser(line),\n customType: customType,\n segment: segment\n });\n\n return true;\n }\n });\n }\n /**\n * Add a custom header mapper\n *\n * @param {Object} options\n * @param {RegExp} options.expression a regular expression to match the custom header\n * @param {Function} options.map function to translate tag into a different tag\n */\n ;\n\n _proto.addTagMapper = function addTagMapper(_ref2) {\n var expression = _ref2.expression,\n map = _ref2.map;\n\n var mapFn = function mapFn(line) {\n if (expression.test(line)) {\n return map(line);\n }\n\n return line;\n };\n\n this.tagMappers.push(mapFn);\n };\n\n return ParseStream;\n}(_videojs_vhs_utils_es_stream_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n\nvar camelCase = function camelCase(str) {\n return str.toLowerCase().replace(/-(\\w)/g, function (a) {\n return a[1].toUpperCase();\n });\n};\n\nvar camelCaseKeys = function camelCaseKeys(attributes) {\n var result = {};\n Object.keys(attributes).forEach(function (key) {\n result[camelCase(key)] = attributes[key];\n });\n return result;\n}; // set SERVER-CONTROL hold back based upon targetDuration and partTargetDuration\n// we need this helper because defaults are based upon targetDuration and\n// partTargetDuration being set, but they may not be if SERVER-CONTROL appears before\n// target durations are set.\n\n\nvar setHoldBack = function setHoldBack(manifest) {\n var serverControl = manifest.serverControl,\n targetDuration = manifest.targetDuration,\n partTargetDuration = manifest.partTargetDuration;\n\n if (!serverControl) {\n return;\n }\n\n var tag = '#EXT-X-SERVER-CONTROL';\n var hb = 'holdBack';\n var phb = 'partHoldBack';\n var minTargetDuration = targetDuration && targetDuration * 3;\n var minPartDuration = partTargetDuration && partTargetDuration * 2;\n\n if (targetDuration && !serverControl.hasOwnProperty(hb)) {\n serverControl[hb] = minTargetDuration;\n this.trigger('info', {\n message: tag + \" defaulting HOLD-BACK to targetDuration * 3 (\" + minTargetDuration + \").\"\n });\n }\n\n if (minTargetDuration && serverControl[hb] < minTargetDuration) {\n this.trigger('warn', {\n message: tag + \" clamping HOLD-BACK (\" + serverControl[hb] + \") to targetDuration * 3 (\" + minTargetDuration + \")\"\n });\n serverControl[hb] = minTargetDuration;\n } // default no part hold back to part target duration * 3\n\n\n if (partTargetDuration && !serverControl.hasOwnProperty(phb)) {\n serverControl[phb] = partTargetDuration * 3;\n this.trigger('info', {\n message: tag + \" defaulting PART-HOLD-BACK to partTargetDuration * 3 (\" + serverControl[phb] + \").\"\n });\n } // if part hold back is too small default it to part target duration * 2\n\n\n if (partTargetDuration && serverControl[phb] < minPartDuration) {\n this.trigger('warn', {\n message: tag + \" clamping PART-HOLD-BACK (\" + serverControl[phb] + \") to partTargetDuration * 2 (\" + minPartDuration + \").\"\n });\n serverControl[phb] = minPartDuration;\n }\n};\n/**\n * A parser for M3U8 files. The current interpretation of the input is\n * exposed as a property `manifest` on parser objects. It's just two lines to\n * create and parse a manifest once you have the contents available as a string:\n *\n * ```js\n * var parser = new m3u8.Parser();\n * parser.push(xhr.responseText);\n * ```\n *\n * New input can later be applied to update the manifest object by calling\n * `push` again.\n *\n * The parser attempts to create a usable manifest object even if the\n * underlying input is somewhat nonsensical. It emits `info` and `warning`\n * events during the parse if it encounters input that seems invalid or\n * requires some property of the manifest object to be defaulted.\n *\n * @class Parser\n * @extends Stream\n */\n\n\nvar Parser = /*#__PURE__*/function (_Stream) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(Parser, _Stream);\n\n function Parser() {\n var _this;\n\n _this = _Stream.call(this) || this;\n _this.lineStream = new LineStream();\n _this.parseStream = new ParseStream();\n\n _this.lineStream.pipe(_this.parseStream);\n /* eslint-disable consistent-this */\n\n\n var self = (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(_this);\n /* eslint-enable consistent-this */\n\n\n var uris = [];\n var currentUri = {}; // if specified, the active EXT-X-MAP definition\n\n var currentMap; // if specified, the active decryption key\n\n var _key;\n\n var hasParts = false;\n\n var noop = function noop() {};\n\n var defaultMediaGroups = {\n 'AUDIO': {},\n 'VIDEO': {},\n 'CLOSED-CAPTIONS': {},\n 'SUBTITLES': {}\n }; // This is the Widevine UUID from DASH IF IOP. The same exact string is\n // used in MPDs with Widevine encrypted streams.\n\n var widevineUuid = 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'; // group segments into numbered timelines delineated by discontinuities\n\n var currentTimeline = 0; // the manifest is empty until the parse stream begins delivering data\n\n _this.manifest = {\n allowCache: true,\n discontinuityStarts: [],\n segments: []\n }; // keep track of the last seen segment's byte range end, as segments are not required\n // to provide the offset, in which case it defaults to the next byte after the\n // previous segment\n\n var lastByterangeEnd = 0; // keep track of the last seen part's byte range end.\n\n var lastPartByterangeEnd = 0;\n\n _this.on('end', function () {\n // only add preloadSegment if we don't yet have a uri for it.\n // and we actually have parts/preloadHints\n if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) {\n return;\n }\n\n if (!currentUri.map && currentMap) {\n currentUri.map = currentMap;\n }\n\n if (!currentUri.key && _key) {\n currentUri.key = _key;\n }\n\n if (!currentUri.timeline && typeof currentTimeline === 'number') {\n currentUri.timeline = currentTimeline;\n }\n\n _this.manifest.preloadSegment = currentUri;\n }); // update the manifest with the m3u8 entry from the parse stream\n\n\n _this.parseStream.on('data', function (entry) {\n var mediaGroup;\n var rendition;\n ({\n tag: function tag() {\n // switch based on the tag type\n (({\n version: function version() {\n if (entry.version) {\n this.manifest.version = entry.version;\n }\n },\n 'allow-cache': function allowCache() {\n this.manifest.allowCache = entry.allowed;\n\n if (!('allowed' in entry)) {\n this.trigger('info', {\n message: 'defaulting allowCache to YES'\n });\n this.manifest.allowCache = true;\n }\n },\n byterange: function byterange() {\n var byterange = {};\n\n if ('length' in entry) {\n currentUri.byterange = byterange;\n byterange.length = entry.length;\n\n if (!('offset' in entry)) {\n /*\n * From the latest spec (as of this writing):\n * https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.2\n *\n * Same text since EXT-X-BYTERANGE's introduction in draft 7:\n * https://tools.ietf.org/html/draft-pantos-http-live-streaming-07#section-3.3.1)\n *\n * \"If o [offset] is not present, the sub-range begins at the next byte\n * following the sub-range of the previous media segment.\"\n */\n entry.offset = lastByterangeEnd;\n }\n }\n\n if ('offset' in entry) {\n currentUri.byterange = byterange;\n byterange.offset = entry.offset;\n }\n\n lastByterangeEnd = byterange.offset + byterange.length;\n },\n endlist: function endlist() {\n this.manifest.endList = true;\n },\n inf: function inf() {\n if (!('mediaSequence' in this.manifest)) {\n this.manifest.mediaSequence = 0;\n this.trigger('info', {\n message: 'defaulting media sequence to zero'\n });\n }\n\n if (!('discontinuitySequence' in this.manifest)) {\n this.manifest.discontinuitySequence = 0;\n this.trigger('info', {\n message: 'defaulting discontinuity sequence to zero'\n });\n }\n\n if (entry.duration > 0) {\n currentUri.duration = entry.duration;\n }\n\n if (entry.duration === 0) {\n currentUri.duration = 0.01;\n this.trigger('info', {\n message: 'updating zero segment duration to a small value'\n });\n }\n\n this.manifest.segments = uris;\n },\n key: function key() {\n if (!entry.attributes) {\n this.trigger('warn', {\n message: 'ignoring key declaration without attribute list'\n });\n return;\n } // clear the active encryption key\n\n\n if (entry.attributes.METHOD === 'NONE') {\n _key = null;\n return;\n }\n\n if (!entry.attributes.URI) {\n this.trigger('warn', {\n message: 'ignoring key declaration without URI'\n });\n return;\n }\n\n if (entry.attributes.KEYFORMAT === 'com.apple.streamingkeydelivery') {\n this.manifest.contentProtection = this.manifest.contentProtection || {}; // TODO: add full support for this.\n\n this.manifest.contentProtection['com.apple.fps.1_0'] = {\n attributes: entry.attributes\n };\n return;\n }\n\n if (entry.attributes.KEYFORMAT === 'com.microsoft.playready') {\n this.manifest.contentProtection = this.manifest.contentProtection || {}; // TODO: add full support for this.\n\n this.manifest.contentProtection['com.microsoft.playready'] = {\n uri: entry.attributes.URI\n };\n return;\n } // check if the content is encrypted for Widevine\n // Widevine/HLS spec: https://storage.googleapis.com/wvdocs/Widevine_DRM_HLS.pdf\n\n\n if (entry.attributes.KEYFORMAT === widevineUuid) {\n var VALID_METHODS = ['SAMPLE-AES', 'SAMPLE-AES-CTR', 'SAMPLE-AES-CENC'];\n\n if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) {\n this.trigger('warn', {\n message: 'invalid key method provided for Widevine'\n });\n return;\n }\n\n if (entry.attributes.METHOD === 'SAMPLE-AES-CENC') {\n this.trigger('warn', {\n message: 'SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead'\n });\n }\n\n if (entry.attributes.URI.substring(0, 23) !== 'data:text/plain;base64,') {\n this.trigger('warn', {\n message: 'invalid key URI provided for Widevine'\n });\n return;\n }\n\n if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === '0x')) {\n this.trigger('warn', {\n message: 'invalid key ID provided for Widevine'\n });\n return;\n } // if Widevine key attributes are valid, store them as `contentProtection`\n // on the manifest to emulate Widevine tag structure in a DASH mpd\n\n\n this.manifest.contentProtection = this.manifest.contentProtection || {};\n this.manifest.contentProtection['com.widevine.alpha'] = {\n attributes: {\n schemeIdUri: entry.attributes.KEYFORMAT,\n // remove '0x' from the key id string\n keyId: entry.attributes.KEYID.substring(2)\n },\n // decode the base64-encoded PSSH box\n pssh: (0,_videojs_vhs_utils_es_decode_b64_to_uint8_array_js__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(entry.attributes.URI.split(',')[1])\n };\n return;\n }\n\n if (!entry.attributes.METHOD) {\n this.trigger('warn', {\n message: 'defaulting key method to AES-128'\n });\n } // setup an encryption key for upcoming segments\n\n\n _key = {\n method: entry.attributes.METHOD || 'AES-128',\n uri: entry.attributes.URI\n };\n\n if (typeof entry.attributes.IV !== 'undefined') {\n _key.iv = entry.attributes.IV;\n }\n },\n 'media-sequence': function mediaSequence() {\n if (!isFinite(entry.number)) {\n this.trigger('warn', {\n message: 'ignoring invalid media sequence: ' + entry.number\n });\n return;\n }\n\n this.manifest.mediaSequence = entry.number;\n },\n 'discontinuity-sequence': function discontinuitySequence() {\n if (!isFinite(entry.number)) {\n this.trigger('warn', {\n message: 'ignoring invalid discontinuity sequence: ' + entry.number\n });\n return;\n }\n\n this.manifest.discontinuitySequence = entry.number;\n currentTimeline = entry.number;\n },\n 'playlist-type': function playlistType() {\n if (!/VOD|EVENT/.test(entry.playlistType)) {\n this.trigger('warn', {\n message: 'ignoring unknown playlist type: ' + entry.playlist\n });\n return;\n }\n\n this.manifest.playlistType = entry.playlistType;\n },\n map: function map() {\n currentMap = {};\n\n if (entry.uri) {\n currentMap.uri = entry.uri;\n }\n\n if (entry.byterange) {\n currentMap.byterange = entry.byterange;\n }\n\n if (_key) {\n currentMap.key = _key;\n }\n },\n 'stream-inf': function streamInf() {\n this.manifest.playlists = uris;\n this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;\n\n if (!entry.attributes) {\n this.trigger('warn', {\n message: 'ignoring empty stream-inf attributes'\n });\n return;\n }\n\n if (!currentUri.attributes) {\n currentUri.attributes = {};\n }\n\n (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(currentUri.attributes, entry.attributes);\n },\n media: function media() {\n this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;\n\n if (!(entry.attributes && entry.attributes.TYPE && entry.attributes['GROUP-ID'] && entry.attributes.NAME)) {\n this.trigger('warn', {\n message: 'ignoring incomplete or missing media group'\n });\n return;\n } // find the media group, creating defaults as necessary\n\n\n var mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE];\n mediaGroupType[entry.attributes['GROUP-ID']] = mediaGroupType[entry.attributes['GROUP-ID']] || {};\n mediaGroup = mediaGroupType[entry.attributes['GROUP-ID']]; // collect the rendition metadata\n\n rendition = {\n default: /yes/i.test(entry.attributes.DEFAULT)\n };\n\n if (rendition.default) {\n rendition.autoselect = true;\n } else {\n rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT);\n }\n\n if (entry.attributes.LANGUAGE) {\n rendition.language = entry.attributes.LANGUAGE;\n }\n\n if (entry.attributes.URI) {\n rendition.uri = entry.attributes.URI;\n }\n\n if (entry.attributes['INSTREAM-ID']) {\n rendition.instreamId = entry.attributes['INSTREAM-ID'];\n }\n\n if (entry.attributes.CHARACTERISTICS) {\n rendition.characteristics = entry.attributes.CHARACTERISTICS;\n }\n\n if (entry.attributes.FORCED) {\n rendition.forced = /yes/i.test(entry.attributes.FORCED);\n } // insert the new rendition\n\n\n mediaGroup[entry.attributes.NAME] = rendition;\n },\n discontinuity: function discontinuity() {\n currentTimeline += 1;\n currentUri.discontinuity = true;\n this.manifest.discontinuityStarts.push(uris.length);\n },\n 'program-date-time': function programDateTime() {\n if (typeof this.manifest.dateTimeString === 'undefined') {\n // PROGRAM-DATE-TIME is a media-segment tag, but for backwards\n // compatibility, we add the first occurence of the PROGRAM-DATE-TIME tag\n // to the manifest object\n // TODO: Consider removing this in future major version\n this.manifest.dateTimeString = entry.dateTimeString;\n this.manifest.dateTimeObject = entry.dateTimeObject;\n }\n\n currentUri.dateTimeString = entry.dateTimeString;\n currentUri.dateTimeObject = entry.dateTimeObject;\n },\n targetduration: function targetduration() {\n if (!isFinite(entry.duration) || entry.duration < 0) {\n this.trigger('warn', {\n message: 'ignoring invalid target duration: ' + entry.duration\n });\n return;\n }\n\n this.manifest.targetDuration = entry.duration;\n setHoldBack.call(this, this.manifest);\n },\n start: function start() {\n if (!entry.attributes || isNaN(entry.attributes['TIME-OFFSET'])) {\n this.trigger('warn', {\n message: 'ignoring start declaration without appropriate attribute list'\n });\n return;\n }\n\n this.manifest.start = {\n timeOffset: entry.attributes['TIME-OFFSET'],\n precise: entry.attributes.PRECISE\n };\n },\n 'cue-out': function cueOut() {\n currentUri.cueOut = entry.data;\n },\n 'cue-out-cont': function cueOutCont() {\n currentUri.cueOutCont = entry.data;\n },\n 'cue-in': function cueIn() {\n currentUri.cueIn = entry.data;\n },\n 'skip': function skip() {\n this.manifest.skip = camelCaseKeys(entry.attributes);\n this.warnOnMissingAttributes_('#EXT-X-SKIP', entry.attributes, ['SKIPPED-SEGMENTS']);\n },\n 'part': function part() {\n var _this2 = this;\n\n hasParts = true; // parts are always specifed before a segment\n\n var segmentIndex = this.manifest.segments.length;\n var part = camelCaseKeys(entry.attributes);\n currentUri.parts = currentUri.parts || [];\n currentUri.parts.push(part);\n\n if (part.byterange) {\n if (!part.byterange.hasOwnProperty('offset')) {\n part.byterange.offset = lastPartByterangeEnd;\n }\n\n lastPartByterangeEnd = part.byterange.offset + part.byterange.length;\n }\n\n var partIndex = currentUri.parts.length - 1;\n this.warnOnMissingAttributes_(\"#EXT-X-PART #\" + partIndex + \" for segment #\" + segmentIndex, entry.attributes, ['URI', 'DURATION']);\n\n if (this.manifest.renditionReports) {\n this.manifest.renditionReports.forEach(function (r, i) {\n if (!r.hasOwnProperty('lastPart')) {\n _this2.trigger('warn', {\n message: \"#EXT-X-RENDITION-REPORT #\" + i + \" lacks required attribute(s): LAST-PART\"\n });\n }\n });\n }\n },\n 'server-control': function serverControl() {\n var attrs = this.manifest.serverControl = camelCaseKeys(entry.attributes);\n\n if (!attrs.hasOwnProperty('canBlockReload')) {\n attrs.canBlockReload = false;\n this.trigger('info', {\n message: '#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false'\n });\n }\n\n setHoldBack.call(this, this.manifest);\n\n if (attrs.canSkipDateranges && !attrs.hasOwnProperty('canSkipUntil')) {\n this.trigger('warn', {\n message: '#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set'\n });\n }\n },\n 'preload-hint': function preloadHint() {\n // parts are always specifed before a segment\n var segmentIndex = this.manifest.segments.length;\n var hint = camelCaseKeys(entry.attributes);\n var isPart = hint.type && hint.type === 'PART';\n currentUri.preloadHints = currentUri.preloadHints || [];\n currentUri.preloadHints.push(hint);\n\n if (hint.byterange) {\n if (!hint.byterange.hasOwnProperty('offset')) {\n // use last part byterange end or zero if not a part.\n hint.byterange.offset = isPart ? lastPartByterangeEnd : 0;\n\n if (isPart) {\n lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length;\n }\n }\n }\n\n var index = currentUri.preloadHints.length - 1;\n this.warnOnMissingAttributes_(\"#EXT-X-PRELOAD-HINT #\" + index + \" for segment #\" + segmentIndex, entry.attributes, ['TYPE', 'URI']);\n\n if (!hint.type) {\n return;\n } // search through all preload hints except for the current one for\n // a duplicate type.\n\n\n for (var i = 0; i < currentUri.preloadHints.length - 1; i++) {\n var otherHint = currentUri.preloadHints[i];\n\n if (!otherHint.type) {\n continue;\n }\n\n if (otherHint.type === hint.type) {\n this.trigger('warn', {\n message: \"#EXT-X-PRELOAD-HINT #\" + index + \" for segment #\" + segmentIndex + \" has the same TYPE \" + hint.type + \" as preload hint #\" + i\n });\n }\n }\n },\n 'rendition-report': function renditionReport() {\n var report = camelCaseKeys(entry.attributes);\n this.manifest.renditionReports = this.manifest.renditionReports || [];\n this.manifest.renditionReports.push(report);\n var index = this.manifest.renditionReports.length - 1;\n var required = ['LAST-MSN', 'URI'];\n\n if (hasParts) {\n required.push('LAST-PART');\n }\n\n this.warnOnMissingAttributes_(\"#EXT-X-RENDITION-REPORT #\" + index, entry.attributes, required);\n },\n 'part-inf': function partInf() {\n this.manifest.partInf = camelCaseKeys(entry.attributes);\n this.warnOnMissingAttributes_('#EXT-X-PART-INF', entry.attributes, ['PART-TARGET']);\n\n if (this.manifest.partInf.partTarget) {\n this.manifest.partTargetDuration = this.manifest.partInf.partTarget;\n }\n\n setHoldBack.call(this, this.manifest);\n }\n })[entry.tagType] || noop).call(self);\n },\n uri: function uri() {\n currentUri.uri = entry.uri;\n uris.push(currentUri); // if no explicit duration was declared, use the target duration\n\n if (this.manifest.targetDuration && !('duration' in currentUri)) {\n this.trigger('warn', {\n message: 'defaulting segment duration to the target duration'\n });\n currentUri.duration = this.manifest.targetDuration;\n } // annotate with encryption information, if necessary\n\n\n if (_key) {\n currentUri.key = _key;\n }\n\n currentUri.timeline = currentTimeline; // annotate with initialization segment information, if necessary\n\n if (currentMap) {\n currentUri.map = currentMap;\n } // reset the last byterange end as it needs to be 0 between parts\n\n\n lastPartByterangeEnd = 0; // prepare for the next URI\n\n currentUri = {};\n },\n comment: function comment() {// comments are not important for playback\n },\n custom: function custom() {\n // if this is segment-level data attach the output to the segment\n if (entry.segment) {\n currentUri.custom = currentUri.custom || {};\n currentUri.custom[entry.customType] = entry.data; // if this is manifest-level data attach to the top level manifest object\n } else {\n this.manifest.custom = this.manifest.custom || {};\n this.manifest.custom[entry.customType] = entry.data;\n }\n }\n })[entry.type].call(self);\n });\n\n return _this;\n }\n\n var _proto = Parser.prototype;\n\n _proto.warnOnMissingAttributes_ = function warnOnMissingAttributes_(identifier, attributes, required) {\n var missing = [];\n required.forEach(function (key) {\n if (!attributes.hasOwnProperty(key)) {\n missing.push(key);\n }\n });\n\n if (missing.length) {\n this.trigger('warn', {\n message: identifier + \" lacks required attribute(s): \" + missing.join(', ')\n });\n }\n }\n /**\n * Parse the input string and update the manifest object.\n *\n * @param {string} chunk a potentially incomplete portion of the manifest\n */\n ;\n\n _proto.push = function push(chunk) {\n this.lineStream.push(chunk);\n }\n /**\n * Flush any remaining input. This can be handy if the last line of an M3U8\n * manifest did not contain a trailing newline but the file has been\n * completely received.\n */\n ;\n\n _proto.end = function end() {\n // flush any buffered input\n this.lineStream.push('\\n');\n this.trigger('end');\n }\n /**\n * Add an additional parser for non-standard tags\n *\n * @param {Object} options a map of options for the added parser\n * @param {RegExp} options.expression a regular expression to match the custom header\n * @param {string} options.type the type to register to the output\n * @param {Function} [options.dataParser] function to parse the line into an object\n * @param {boolean} [options.segment] should tag data be attached to the segment object\n */\n ;\n\n _proto.addParser = function addParser(options) {\n this.parseStream.addParser(options);\n }\n /**\n * Add a custom header mapper\n *\n * @param {Object} options\n * @param {RegExp} options.expression a regular expression to match the custom header\n * @param {Function} options.map function to translate tag into a different tag\n */\n ;\n\n _proto.addTagMapper = function addTagMapper(options) {\n this.parseStream.addTagMapper(options);\n };\n\n return Parser;\n}(_videojs_vhs_utils_es_stream_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n\n\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/m3u8-parser/dist/m3u8-parser.es.js?")},"./node_modules/videojs-contrib-dash/node_modules/mpd-parser/dist/mpd-parser.es.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ VERSION: () => (/* binding */ VERSION),\n/* harmony export */ addSidxSegmentsToPlaylist: () => (/* binding */ addSidxSegmentsToPlaylist$1),\n/* harmony export */ generateSidxKey: () => (/* binding */ generateSidxKey),\n/* harmony export */ inheritAttributes: () => (/* binding */ inheritAttributes),\n/* harmony export */ parse: () => (/* binding */ parse),\n/* harmony export */ parseUTCTiming: () => (/* binding */ parseUTCTiming),\n/* harmony export */ stringToMpdXml: () => (/* binding */ stringToMpdXml),\n/* harmony export */ toM3u8: () => (/* binding */ toM3u8),\n/* harmony export */ toPlaylists: () => (/* binding */ toPlaylists)\n/* harmony export */ });\n/* harmony import */ var _videojs_vhs_utils_es_resolve_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @videojs/vhs-utils/es/resolve-url */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/resolve-url.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _videojs_vhs_utils_es_media_groups__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @videojs/vhs-utils/es/media-groups */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/media-groups.js\");\n/* harmony import */ var _videojs_vhs_utils_es_decode_b64_to_uint8_array__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @videojs/vhs-utils/es/decode-b64-to-uint8-array */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js\");\n/* harmony import */ var _xmldom_xmldom__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @xmldom/xmldom */ \"./node_modules/@xmldom/xmldom/lib/index.js\");\n/*! @name mpd-parser @version 0.22.1 @license Apache-2.0 */\n\n\n\n\n\n\nvar version = \"0.22.1\";\n\nvar isObject = function isObject(obj) {\n return !!obj && typeof obj === 'object';\n};\n\nvar merge = function merge() {\n for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {\n objects[_key] = arguments[_key];\n }\n\n return objects.reduce(function (result, source) {\n if (typeof source !== 'object') {\n return result;\n }\n\n Object.keys(source).forEach(function (key) {\n if (Array.isArray(result[key]) && Array.isArray(source[key])) {\n result[key] = result[key].concat(source[key]);\n } else if (isObject(result[key]) && isObject(source[key])) {\n result[key] = merge(result[key], source[key]);\n } else {\n result[key] = source[key];\n }\n });\n return result;\n }, {});\n};\nvar values = function values(o) {\n return Object.keys(o).map(function (k) {\n return o[k];\n });\n};\n\nvar range = function range(start, end) {\n var result = [];\n\n for (var i = start; i < end; i++) {\n result.push(i);\n }\n\n return result;\n};\nvar flatten = function flatten(lists) {\n return lists.reduce(function (x, y) {\n return x.concat(y);\n }, []);\n};\nvar from = function from(list) {\n if (!list.length) {\n return [];\n }\n\n var result = [];\n\n for (var i = 0; i < list.length; i++) {\n result.push(list[i]);\n }\n\n return result;\n};\nvar findIndexes = function findIndexes(l, key) {\n return l.reduce(function (a, e, i) {\n if (e[key]) {\n a.push(i);\n }\n\n return a;\n }, []);\n};\n/**\n * Returns the first index that satisfies the matching function, or -1 if not found.\n *\n * Only necessary because of IE11 support.\n *\n * @param {Array} list - the list to search through\n * @param {Function} matchingFunction - the matching function\n *\n * @return {number} the matching index or -1 if not found\n */\n\nvar findIndex = function findIndex(list, matchingFunction) {\n for (var i = 0; i < list.length; i++) {\n if (matchingFunction(list[i])) {\n return i;\n }\n }\n\n return -1;\n};\n/**\n * Returns a union of the included lists provided each element can be identified by a key.\n *\n * @param {Array} list - list of lists to get the union of\n * @param {Function} keyFunction - the function to use as a key for each element\n *\n * @return {Array} the union of the arrays\n */\n\nvar union = function union(lists, keyFunction) {\n return values(lists.reduce(function (acc, list) {\n list.forEach(function (el) {\n acc[keyFunction(el)] = el;\n });\n return acc;\n }, {}));\n};\n\nvar errors = {\n INVALID_NUMBER_OF_PERIOD: 'INVALID_NUMBER_OF_PERIOD',\n DASH_EMPTY_MANIFEST: 'DASH_EMPTY_MANIFEST',\n DASH_INVALID_XML: 'DASH_INVALID_XML',\n NO_BASE_URL: 'NO_BASE_URL',\n MISSING_SEGMENT_INFORMATION: 'MISSING_SEGMENT_INFORMATION',\n SEGMENT_TIME_UNSPECIFIED: 'SEGMENT_TIME_UNSPECIFIED',\n UNSUPPORTED_UTC_TIMING_SCHEME: 'UNSUPPORTED_UTC_TIMING_SCHEME'\n};\n\n/**\n * @typedef {Object} SingleUri\n * @property {string} uri - relative location of segment\n * @property {string} resolvedUri - resolved location of segment\n * @property {Object} byterange - Object containing information on how to make byte range\n * requests following byte-range-spec per RFC2616.\n * @property {String} byterange.length - length of range request\n * @property {String} byterange.offset - byte offset of range request\n *\n * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35.1\n */\n\n/**\n * Converts a URLType node (5.3.9.2.3 Table 13) to a segment object\n * that conforms to how m3u8-parser is structured\n *\n * @see https://github.com/videojs/m3u8-parser\n *\n * @param {string} baseUrl - baseUrl provided by <BaseUrl> nodes\n * @param {string} source - source url for segment\n * @param {string} range - optional range used for range calls,\n * follows RFC 2616, Clause 14.35.1\n * @return {SingleUri} full segment information transformed into a format similar\n * to m3u8-parser\n */\n\nvar urlTypeToSegment = function urlTypeToSegment(_ref) {\n var _ref$baseUrl = _ref.baseUrl,\n baseUrl = _ref$baseUrl === void 0 ? '' : _ref$baseUrl,\n _ref$source = _ref.source,\n source = _ref$source === void 0 ? '' : _ref$source,\n _ref$range = _ref.range,\n range = _ref$range === void 0 ? '' : _ref$range,\n _ref$indexRange = _ref.indexRange,\n indexRange = _ref$indexRange === void 0 ? '' : _ref$indexRange;\n var segment = {\n uri: source,\n resolvedUri: (0,_videojs_vhs_utils_es_resolve_url__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(baseUrl || '', source)\n };\n\n if (range || indexRange) {\n var rangeStr = range ? range : indexRange;\n var ranges = rangeStr.split('-'); // default to parsing this as a BigInt if possible\n\n var startRange = (global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt) ? global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(ranges[0]) : parseInt(ranges[0], 10);\n var endRange = (global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt) ? global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(ranges[1]) : parseInt(ranges[1], 10); // convert back to a number if less than MAX_SAFE_INTEGER\n\n if (startRange < Number.MAX_SAFE_INTEGER && typeof startRange === 'bigint') {\n startRange = Number(startRange);\n }\n\n if (endRange < Number.MAX_SAFE_INTEGER && typeof endRange === 'bigint') {\n endRange = Number(endRange);\n }\n\n var length;\n\n if (typeof endRange === 'bigint' || typeof startRange === 'bigint') {\n length = global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(endRange) - global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(startRange) + global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(1);\n } else {\n length = endRange - startRange + 1;\n }\n\n if (typeof length === 'bigint' && length < Number.MAX_SAFE_INTEGER) {\n length = Number(length);\n } // byterange should be inclusive according to\n // RFC 2616, Clause 14.35.1\n\n\n segment.byterange = {\n length: length,\n offset: startRange\n };\n }\n\n return segment;\n};\nvar byteRangeToString = function byteRangeToString(byterange) {\n // `endRange` is one less than `offset + length` because the HTTP range\n // header uses inclusive ranges\n var endRange;\n\n if (typeof byterange.offset === 'bigint' || typeof byterange.length === 'bigint') {\n endRange = global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(byterange.offset) + global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(byterange.length) - global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(1);\n } else {\n endRange = byterange.offset + byterange.length - 1;\n }\n\n return byterange.offset + \"-\" + endRange;\n};\n\n/**\n * parse the end number attribue that can be a string\n * number, or undefined.\n *\n * @param {string|number|undefined} endNumber\n * The end number attribute.\n *\n * @return {number|null}\n * The result of parsing the end number.\n */\n\nvar parseEndNumber = function parseEndNumber(endNumber) {\n if (endNumber && typeof endNumber !== 'number') {\n endNumber = parseInt(endNumber, 10);\n }\n\n if (isNaN(endNumber)) {\n return null;\n }\n\n return endNumber;\n};\n/**\n * Functions for calculating the range of available segments in static and dynamic\n * manifests.\n */\n\n\nvar segmentRange = {\n /**\n * Returns the entire range of available segments for a static MPD\n *\n * @param {Object} attributes\n * Inheritied MPD attributes\n * @return {{ start: number, end: number }}\n * The start and end numbers for available segments\n */\n static: function _static(attributes) {\n var duration = attributes.duration,\n _attributes$timescale = attributes.timescale,\n timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale,\n sourceDuration = attributes.sourceDuration,\n periodDuration = attributes.periodDuration;\n var endNumber = parseEndNumber(attributes.endNumber);\n var segmentDuration = duration / timescale;\n\n if (typeof endNumber === 'number') {\n return {\n start: 0,\n end: endNumber\n };\n }\n\n if (typeof periodDuration === 'number') {\n return {\n start: 0,\n end: periodDuration / segmentDuration\n };\n }\n\n return {\n start: 0,\n end: sourceDuration / segmentDuration\n };\n },\n\n /**\n * Returns the current live window range of available segments for a dynamic MPD\n *\n * @param {Object} attributes\n * Inheritied MPD attributes\n * @return {{ start: number, end: number }}\n * The start and end numbers for available segments\n */\n dynamic: function dynamic(attributes) {\n var NOW = attributes.NOW,\n clientOffset = attributes.clientOffset,\n availabilityStartTime = attributes.availabilityStartTime,\n _attributes$timescale2 = attributes.timescale,\n timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2,\n duration = attributes.duration,\n _attributes$periodSta = attributes.periodStart,\n periodStart = _attributes$periodSta === void 0 ? 0 : _attributes$periodSta,\n _attributes$minimumUp = attributes.minimumUpdatePeriod,\n minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp,\n _attributes$timeShift = attributes.timeShiftBufferDepth,\n timeShiftBufferDepth = _attributes$timeShift === void 0 ? Infinity : _attributes$timeShift;\n var endNumber = parseEndNumber(attributes.endNumber); // clientOffset is passed in at the top level of mpd-parser and is an offset calculated\n // after retrieving UTC server time.\n\n var now = (NOW + clientOffset) / 1000; // WC stands for Wall Clock.\n // Convert the period start time to EPOCH.\n\n var periodStartWC = availabilityStartTime + periodStart; // Period end in EPOCH is manifest's retrieval time + time until next update.\n\n var periodEndWC = now + minimumUpdatePeriod;\n var periodDuration = periodEndWC - periodStartWC;\n var segmentCount = Math.ceil(periodDuration * timescale / duration);\n var availableStart = Math.floor((now - periodStartWC - timeShiftBufferDepth) * timescale / duration);\n var availableEnd = Math.floor((now - periodStartWC) * timescale / duration);\n return {\n start: Math.max(0, availableStart),\n end: typeof endNumber === 'number' ? endNumber : Math.min(segmentCount, availableEnd)\n };\n }\n};\n/**\n * Maps a range of numbers to objects with information needed to build the corresponding\n * segment list\n *\n * @name toSegmentsCallback\n * @function\n * @param {number} number\n * Number of the segment\n * @param {number} index\n * Index of the number in the range list\n * @return {{ number: Number, duration: Number, timeline: Number, time: Number }}\n * Object with segment timing and duration info\n */\n\n/**\n * Returns a callback for Array.prototype.map for mapping a range of numbers to\n * information needed to build the segment list.\n *\n * @param {Object} attributes\n * Inherited MPD attributes\n * @return {toSegmentsCallback}\n * Callback map function\n */\n\nvar toSegments = function toSegments(attributes) {\n return function (number) {\n var duration = attributes.duration,\n _attributes$timescale3 = attributes.timescale,\n timescale = _attributes$timescale3 === void 0 ? 1 : _attributes$timescale3,\n periodStart = attributes.periodStart,\n _attributes$startNumb = attributes.startNumber,\n startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb;\n return {\n number: startNumber + number,\n duration: duration / timescale,\n timeline: periodStart,\n time: number * duration\n };\n };\n};\n/**\n * Returns a list of objects containing segment timing and duration info used for\n * building the list of segments. This uses the @duration attribute specified\n * in the MPD manifest to derive the range of segments.\n *\n * @param {Object} attributes\n * Inherited MPD attributes\n * @return {{number: number, duration: number, time: number, timeline: number}[]}\n * List of Objects with segment timing and duration info\n */\n\nvar parseByDuration = function parseByDuration(attributes) {\n var type = attributes.type,\n duration = attributes.duration,\n _attributes$timescale4 = attributes.timescale,\n timescale = _attributes$timescale4 === void 0 ? 1 : _attributes$timescale4,\n periodDuration = attributes.periodDuration,\n sourceDuration = attributes.sourceDuration;\n\n var _segmentRange$type = segmentRange[type](attributes),\n start = _segmentRange$type.start,\n end = _segmentRange$type.end;\n\n var segments = range(start, end).map(toSegments(attributes));\n\n if (type === 'static') {\n var index = segments.length - 1; // section is either a period or the full source\n\n var sectionDuration = typeof periodDuration === 'number' ? periodDuration : sourceDuration; // final segment may be less than full segment duration\n\n segments[index].duration = sectionDuration - duration / timescale * index;\n }\n\n return segments;\n};\n\n/**\n * Translates SegmentBase into a set of segments.\n * (DASH SPEC Section 5.3.9.3.2) contains a set of <SegmentURL> nodes. Each\n * node should be translated into segment.\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @return {Object.<Array>} list of segments\n */\n\nvar segmentsFromBase = function segmentsFromBase(attributes) {\n var baseUrl = attributes.baseUrl,\n _attributes$initializ = attributes.initialization,\n initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ,\n sourceDuration = attributes.sourceDuration,\n _attributes$indexRang = attributes.indexRange,\n indexRange = _attributes$indexRang === void 0 ? '' : _attributes$indexRang,\n periodStart = attributes.periodStart,\n presentationTime = attributes.presentationTime,\n _attributes$number = attributes.number,\n number = _attributes$number === void 0 ? 0 : _attributes$number,\n duration = attributes.duration; // base url is required for SegmentBase to work, per spec (Section 5.3.9.2.1)\n\n if (!baseUrl) {\n throw new Error(errors.NO_BASE_URL);\n }\n\n var initSegment = urlTypeToSegment({\n baseUrl: baseUrl,\n source: initialization.sourceURL,\n range: initialization.range\n });\n var segment = urlTypeToSegment({\n baseUrl: baseUrl,\n source: baseUrl,\n indexRange: indexRange\n });\n segment.map = initSegment; // If there is a duration, use it, otherwise use the given duration of the source\n // (since SegmentBase is only for one total segment)\n\n if (duration) {\n var segmentTimeInfo = parseByDuration(attributes);\n\n if (segmentTimeInfo.length) {\n segment.duration = segmentTimeInfo[0].duration;\n segment.timeline = segmentTimeInfo[0].timeline;\n }\n } else if (sourceDuration) {\n segment.duration = sourceDuration;\n segment.timeline = periodStart;\n } // If presentation time is provided, these segments are being generated by SIDX\n // references, and should use the time provided. For the general case of SegmentBase,\n // there should only be one segment in the period, so its presentation time is the same\n // as its period start.\n\n\n segment.presentationTime = presentationTime || periodStart;\n segment.number = number;\n return [segment];\n};\n/**\n * Given a playlist, a sidx box, and a baseUrl, update the segment list of the playlist\n * according to the sidx information given.\n *\n * playlist.sidx has metadadata about the sidx where-as the sidx param\n * is the parsed sidx box itself.\n *\n * @param {Object} playlist the playlist to update the sidx information for\n * @param {Object} sidx the parsed sidx box\n * @return {Object} the playlist object with the updated sidx information\n */\n\nvar addSidxSegmentsToPlaylist$1 = function addSidxSegmentsToPlaylist(playlist, sidx, baseUrl) {\n // Retain init segment information\n var initSegment = playlist.sidx.map ? playlist.sidx.map : null; // Retain source duration from initial main manifest parsing\n\n var sourceDuration = playlist.sidx.duration; // Retain source timeline\n\n var timeline = playlist.timeline || 0;\n var sidxByteRange = playlist.sidx.byterange;\n var sidxEnd = sidxByteRange.offset + sidxByteRange.length; // Retain timescale of the parsed sidx\n\n var timescale = sidx.timescale; // referenceType 1 refers to other sidx boxes\n\n var mediaReferences = sidx.references.filter(function (r) {\n return r.referenceType !== 1;\n });\n var segments = [];\n var type = playlist.endList ? 'static' : 'dynamic';\n var periodStart = playlist.sidx.timeline;\n var presentationTime = periodStart;\n var number = playlist.mediaSequence || 0; // firstOffset is the offset from the end of the sidx box\n\n var startIndex; // eslint-disable-next-line\n\n if (typeof sidx.firstOffset === 'bigint') {\n startIndex = global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(sidxEnd) + sidx.firstOffset;\n } else {\n startIndex = sidxEnd + sidx.firstOffset;\n }\n\n for (var i = 0; i < mediaReferences.length; i++) {\n var reference = sidx.references[i]; // size of the referenced (sub)segment\n\n var size = reference.referencedSize; // duration of the referenced (sub)segment, in the timescale\n // this will be converted to seconds when generating segments\n\n var duration = reference.subsegmentDuration; // should be an inclusive range\n\n var endIndex = void 0; // eslint-disable-next-line\n\n if (typeof startIndex === 'bigint') {\n endIndex = startIndex + global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(size) - global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(1);\n } else {\n endIndex = startIndex + size - 1;\n }\n\n var indexRange = startIndex + \"-\" + endIndex;\n var attributes = {\n baseUrl: baseUrl,\n timescale: timescale,\n timeline: timeline,\n periodStart: periodStart,\n presentationTime: presentationTime,\n number: number,\n duration: duration,\n sourceDuration: sourceDuration,\n indexRange: indexRange,\n type: type\n };\n var segment = segmentsFromBase(attributes)[0];\n\n if (initSegment) {\n segment.map = initSegment;\n }\n\n segments.push(segment);\n\n if (typeof startIndex === 'bigint') {\n startIndex += global_window__WEBPACK_IMPORTED_MODULE_1___default().BigInt(size);\n } else {\n startIndex += size;\n }\n\n presentationTime += duration / timescale;\n number++;\n }\n\n playlist.segments = segments;\n return playlist;\n};\n\nvar SUPPORTED_MEDIA_TYPES = ['AUDIO', 'SUBTITLES']; // allow one 60fps frame as leniency (arbitrarily chosen)\n\nvar TIME_FUDGE = 1 / 60;\n/**\n * Given a list of timelineStarts, combines, dedupes, and sorts them.\n *\n * @param {TimelineStart[]} timelineStarts - list of timeline starts\n *\n * @return {TimelineStart[]} the combined and deduped timeline starts\n */\n\nvar getUniqueTimelineStarts = function getUniqueTimelineStarts(timelineStarts) {\n return union(timelineStarts, function (_ref) {\n var timeline = _ref.timeline;\n return timeline;\n }).sort(function (a, b) {\n return a.timeline > b.timeline ? 1 : -1;\n });\n};\n/**\n * Finds the playlist with the matching NAME attribute.\n *\n * @param {Array} playlists - playlists to search through\n * @param {string} name - the NAME attribute to search for\n *\n * @return {Object|null} the matching playlist object, or null\n */\n\nvar findPlaylistWithName = function findPlaylistWithName(playlists, name) {\n for (var i = 0; i < playlists.length; i++) {\n if (playlists[i].attributes.NAME === name) {\n return playlists[i];\n }\n }\n\n return null;\n};\n/**\n * Gets a flattened array of media group playlists.\n *\n * @param {Object} manifest - the main manifest object\n *\n * @return {Array} the media group playlists\n */\n\nvar getMediaGroupPlaylists = function getMediaGroupPlaylists(manifest) {\n var mediaGroupPlaylists = [];\n (0,_videojs_vhs_utils_es_media_groups__WEBPACK_IMPORTED_MODULE_2__.forEachMediaGroup)(manifest, SUPPORTED_MEDIA_TYPES, function (properties, type, group, label) {\n mediaGroupPlaylists = mediaGroupPlaylists.concat(properties.playlists || []);\n });\n return mediaGroupPlaylists;\n};\n/**\n * Updates the playlist's media sequence numbers.\n *\n * @param {Object} config - options object\n * @param {Object} config.playlist - the playlist to update\n * @param {number} config.mediaSequence - the mediaSequence number to start with\n */\n\nvar updateMediaSequenceForPlaylist = function updateMediaSequenceForPlaylist(_ref2) {\n var playlist = _ref2.playlist,\n mediaSequence = _ref2.mediaSequence;\n playlist.mediaSequence = mediaSequence;\n playlist.segments.forEach(function (segment, index) {\n segment.number = playlist.mediaSequence + index;\n });\n};\n/**\n * Updates the media and discontinuity sequence numbers of newPlaylists given oldPlaylists\n * and a complete list of timeline starts.\n *\n * If no matching playlist is found, only the discontinuity sequence number of the playlist\n * will be updated.\n *\n * Since early available timelines are not supported, at least one segment must be present.\n *\n * @param {Object} config - options object\n * @param {Object[]} oldPlaylists - the old playlists to use as a reference\n * @param {Object[]} newPlaylists - the new playlists to update\n * @param {Object} timelineStarts - all timelineStarts seen in the stream to this point\n */\n\nvar updateSequenceNumbers = function updateSequenceNumbers(_ref3) {\n var oldPlaylists = _ref3.oldPlaylists,\n newPlaylists = _ref3.newPlaylists,\n timelineStarts = _ref3.timelineStarts;\n newPlaylists.forEach(function (playlist) {\n playlist.discontinuitySequence = findIndex(timelineStarts, function (_ref4) {\n var timeline = _ref4.timeline;\n return timeline === playlist.timeline;\n }); // Playlists NAMEs come from DASH Representation IDs, which are mandatory\n // (see ISO_23009-1-2012 5.3.5.2).\n //\n // If the same Representation existed in a prior Period, it will retain the same NAME.\n\n var oldPlaylist = findPlaylistWithName(oldPlaylists, playlist.attributes.NAME);\n\n if (!oldPlaylist) {\n // Since this is a new playlist, the media sequence values can start from 0 without\n // consequence.\n return;\n } // TODO better support for live SIDX\n //\n // As of this writing, mpd-parser does not support multiperiod SIDX (in live or VOD).\n // This is evident by a playlist only having a single SIDX reference. In a multiperiod\n // playlist there would need to be multiple SIDX references. In addition, live SIDX is\n // not supported when the SIDX properties change on refreshes.\n //\n // In the future, if support needs to be added, the merging logic here can be called\n // after SIDX references are resolved. For now, exit early to prevent exceptions being\n // thrown due to undefined references.\n\n\n if (playlist.sidx) {\n return;\n } // Since we don't yet support early available timelines, we don't need to support\n // playlists with no segments.\n\n\n var firstNewSegment = playlist.segments[0];\n var oldMatchingSegmentIndex = findIndex(oldPlaylist.segments, function (oldSegment) {\n return Math.abs(oldSegment.presentationTime - firstNewSegment.presentationTime) < TIME_FUDGE;\n }); // No matching segment from the old playlist means the entire playlist was refreshed.\n // In this case the media sequence should account for this update, and the new segments\n // should be marked as discontinuous from the prior content, since the last prior\n // timeline was removed.\n\n if (oldMatchingSegmentIndex === -1) {\n updateMediaSequenceForPlaylist({\n playlist: playlist,\n mediaSequence: oldPlaylist.mediaSequence + oldPlaylist.segments.length\n });\n playlist.segments[0].discontinuity = true;\n playlist.discontinuityStarts.unshift(0); // No matching segment does not necessarily mean there's missing content.\n //\n // If the new playlist's timeline is the same as the last seen segment's timeline,\n // then a discontinuity can be added to identify that there's potentially missing\n // content. If there's no missing content, the discontinuity should still be rather\n // harmless. It's possible that if segment durations are accurate enough, that the\n // existence of a gap can be determined using the presentation times and durations,\n // but if the segment timing info is off, it may introduce more problems than simply\n // adding the discontinuity.\n //\n // If the new playlist's timeline is different from the last seen segment's timeline,\n // then a discontinuity can be added to identify that this is the first seen segment\n // of a new timeline. However, the logic at the start of this function that\n // determined the disconinuity sequence by timeline index is now off by one (the\n // discontinuity of the newest timeline hasn't yet fallen off the manifest...since\n // we added it), so the disconinuity sequence must be decremented.\n //\n // A period may also have a duration of zero, so the case of no segments is handled\n // here even though we don't yet support early available periods.\n\n if (!oldPlaylist.segments.length && playlist.timeline > oldPlaylist.timeline || oldPlaylist.segments.length && playlist.timeline > oldPlaylist.segments[oldPlaylist.segments.length - 1].timeline) {\n playlist.discontinuitySequence--;\n }\n\n return;\n } // If the first segment matched with a prior segment on a discontinuity (it's matching\n // on the first segment of a period), then the discontinuitySequence shouldn't be the\n // timeline's matching one, but instead should be the one prior, and the first segment\n // of the new manifest should be marked with a discontinuity.\n //\n // The reason for this special case is that discontinuity sequence shows how many\n // discontinuities have fallen off of the playlist, and discontinuities are marked on\n // the first segment of a new \"timeline.\" Because of this, while DASH will retain that\n // Period while the \"timeline\" exists, HLS keeps track of it via the discontinuity\n // sequence, and that first segment is an indicator, but can be removed before that\n // timeline is gone.\n\n\n var oldMatchingSegment = oldPlaylist.segments[oldMatchingSegmentIndex];\n\n if (oldMatchingSegment.discontinuity && !firstNewSegment.discontinuity) {\n firstNewSegment.discontinuity = true;\n playlist.discontinuityStarts.unshift(0);\n playlist.discontinuitySequence--;\n }\n\n updateMediaSequenceForPlaylist({\n playlist: playlist,\n mediaSequence: oldPlaylist.segments[oldMatchingSegmentIndex].number\n });\n });\n};\n/**\n * Given an old parsed manifest object and a new parsed manifest object, updates the\n * sequence and timing values within the new manifest to ensure that it lines up with the\n * old.\n *\n * @param {Array} oldManifest - the old main manifest object\n * @param {Array} newManifest - the new main manifest object\n *\n * @return {Object} the updated new manifest object\n */\n\nvar positionManifestOnTimeline = function positionManifestOnTimeline(_ref5) {\n var oldManifest = _ref5.oldManifest,\n newManifest = _ref5.newManifest;\n // Starting from v4.1.2 of the IOP, section 4.4.3.3 states:\n //\n // \"MPD@availabilityStartTime and Period@start shall not be changed over MPD updates.\"\n //\n // This was added from https://github.com/Dash-Industry-Forum/DASH-IF-IOP/issues/160\n //\n // Because of this change, and the difficulty of supporting periods with changing start\n // times, periods with changing start times are not supported. This makes the logic much\n // simpler, since periods with the same start time can be considerred the same period\n // across refreshes.\n //\n // To give an example as to the difficulty of handling periods where the start time may\n // change, if a single period manifest is refreshed with another manifest with a single\n // period, and both the start and end times are increased, then the only way to determine\n // if it's a new period or an old one that has changed is to look through the segments of\n // each playlist and determine the presentation time bounds to find a match. In addition,\n // if the period start changed to exceed the old period end, then there would be no\n // match, and it would not be possible to determine whether the refreshed period is a new\n // one or the old one.\n var oldPlaylists = oldManifest.playlists.concat(getMediaGroupPlaylists(oldManifest));\n var newPlaylists = newManifest.playlists.concat(getMediaGroupPlaylists(newManifest)); // Save all seen timelineStarts to the new manifest. Although this potentially means that\n // there's a \"memory leak\" in that it will never stop growing, in reality, only a couple\n // of properties are saved for each seen Period. Even long running live streams won't\n // generate too many Periods, unless the stream is watched for decades. In the future,\n // this can be optimized by mapping to discontinuity sequence numbers for each timeline,\n // but it may not become an issue, and the additional info can be useful for debugging.\n\n newManifest.timelineStarts = getUniqueTimelineStarts([oldManifest.timelineStarts, newManifest.timelineStarts]);\n updateSequenceNumbers({\n oldPlaylists: oldPlaylists,\n newPlaylists: newPlaylists,\n timelineStarts: newManifest.timelineStarts\n });\n return newManifest;\n};\n\nvar generateSidxKey = function generateSidxKey(sidx) {\n return sidx && sidx.uri + '-' + byteRangeToString(sidx.byterange);\n};\n\nvar mergeDiscontiguousPlaylists = function mergeDiscontiguousPlaylists(playlists) {\n var mergedPlaylists = values(playlists.reduce(function (acc, playlist) {\n // assuming playlist IDs are the same across periods\n // TODO: handle multiperiod where representation sets are not the same\n // across periods\n var name = playlist.attributes.id + (playlist.attributes.lang || '');\n\n if (!acc[name]) {\n // First Period\n acc[name] = playlist;\n acc[name].attributes.timelineStarts = [];\n } else {\n // Subsequent Periods\n if (playlist.segments) {\n var _acc$name$segments;\n\n // first segment of subsequent periods signal a discontinuity\n if (playlist.segments[0]) {\n playlist.segments[0].discontinuity = true;\n }\n\n (_acc$name$segments = acc[name].segments).push.apply(_acc$name$segments, playlist.segments);\n } // bubble up contentProtection, this assumes all DRM content\n // has the same contentProtection\n\n\n if (playlist.attributes.contentProtection) {\n acc[name].attributes.contentProtection = playlist.attributes.contentProtection;\n }\n }\n\n acc[name].attributes.timelineStarts.push({\n // Although they represent the same number, it's important to have both to make it\n // compatible with HLS potentially having a similar attribute.\n start: playlist.attributes.periodStart,\n timeline: playlist.attributes.periodStart\n });\n return acc;\n }, {}));\n return mergedPlaylists.map(function (playlist) {\n playlist.discontinuityStarts = findIndexes(playlist.segments || [], 'discontinuity');\n return playlist;\n });\n};\n\nvar addSidxSegmentsToPlaylist = function addSidxSegmentsToPlaylist(playlist, sidxMapping) {\n var sidxKey = generateSidxKey(playlist.sidx);\n var sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx;\n\n if (sidxMatch) {\n addSidxSegmentsToPlaylist$1(playlist, sidxMatch, playlist.sidx.resolvedUri);\n }\n\n return playlist;\n};\nvar addSidxSegmentsToPlaylists = function addSidxSegmentsToPlaylists(playlists, sidxMapping) {\n if (sidxMapping === void 0) {\n sidxMapping = {};\n }\n\n if (!Object.keys(sidxMapping).length) {\n return playlists;\n }\n\n for (var i in playlists) {\n playlists[i] = addSidxSegmentsToPlaylist(playlists[i], sidxMapping);\n }\n\n return playlists;\n};\nvar formatAudioPlaylist = function formatAudioPlaylist(_ref, isAudioOnly) {\n var _attributes;\n\n var attributes = _ref.attributes,\n segments = _ref.segments,\n sidx = _ref.sidx,\n mediaSequence = _ref.mediaSequence,\n discontinuitySequence = _ref.discontinuitySequence,\n discontinuityStarts = _ref.discontinuityStarts;\n var playlist = {\n attributes: (_attributes = {\n NAME: attributes.id,\n BANDWIDTH: attributes.bandwidth,\n CODECS: attributes.codecs\n }, _attributes['PROGRAM-ID'] = 1, _attributes),\n uri: '',\n endList: attributes.type === 'static',\n timeline: attributes.periodStart,\n resolvedUri: '',\n targetDuration: attributes.duration,\n discontinuitySequence: discontinuitySequence,\n discontinuityStarts: discontinuityStarts,\n timelineStarts: attributes.timelineStarts,\n mediaSequence: mediaSequence,\n segments: segments\n };\n\n if (attributes.contentProtection) {\n playlist.contentProtection = attributes.contentProtection;\n }\n\n if (sidx) {\n playlist.sidx = sidx;\n }\n\n if (isAudioOnly) {\n playlist.attributes.AUDIO = 'audio';\n playlist.attributes.SUBTITLES = 'subs';\n }\n\n return playlist;\n};\nvar formatVttPlaylist = function formatVttPlaylist(_ref2) {\n var _m3u8Attributes;\n\n var attributes = _ref2.attributes,\n segments = _ref2.segments,\n mediaSequence = _ref2.mediaSequence,\n discontinuityStarts = _ref2.discontinuityStarts,\n discontinuitySequence = _ref2.discontinuitySequence;\n\n if (typeof segments === 'undefined') {\n // vtt tracks may use single file in BaseURL\n segments = [{\n uri: attributes.baseUrl,\n timeline: attributes.periodStart,\n resolvedUri: attributes.baseUrl || '',\n duration: attributes.sourceDuration,\n number: 0\n }]; // targetDuration should be the same duration as the only segment\n\n attributes.duration = attributes.sourceDuration;\n }\n\n var m3u8Attributes = (_m3u8Attributes = {\n NAME: attributes.id,\n BANDWIDTH: attributes.bandwidth\n }, _m3u8Attributes['PROGRAM-ID'] = 1, _m3u8Attributes);\n\n if (attributes.codecs) {\n m3u8Attributes.CODECS = attributes.codecs;\n }\n\n return {\n attributes: m3u8Attributes,\n uri: '',\n endList: attributes.type === 'static',\n timeline: attributes.periodStart,\n resolvedUri: attributes.baseUrl || '',\n targetDuration: attributes.duration,\n timelineStarts: attributes.timelineStarts,\n discontinuityStarts: discontinuityStarts,\n discontinuitySequence: discontinuitySequence,\n mediaSequence: mediaSequence,\n segments: segments\n };\n};\nvar organizeAudioPlaylists = function organizeAudioPlaylists(playlists, sidxMapping, isAudioOnly) {\n if (sidxMapping === void 0) {\n sidxMapping = {};\n }\n\n if (isAudioOnly === void 0) {\n isAudioOnly = false;\n }\n\n var mainPlaylist;\n var formattedPlaylists = playlists.reduce(function (a, playlist) {\n var role = playlist.attributes.role && playlist.attributes.role.value || '';\n var language = playlist.attributes.lang || '';\n var label = playlist.attributes.label || 'main';\n\n if (language && !playlist.attributes.label) {\n var roleLabel = role ? \" (\" + role + \")\" : '';\n label = \"\" + playlist.attributes.lang + roleLabel;\n }\n\n if (!a[label]) {\n a[label] = {\n language: language,\n autoselect: true,\n default: role === 'main',\n playlists: [],\n uri: ''\n };\n }\n\n var formatted = addSidxSegmentsToPlaylist(formatAudioPlaylist(playlist, isAudioOnly), sidxMapping);\n a[label].playlists.push(formatted);\n\n if (typeof mainPlaylist === 'undefined' && role === 'main') {\n mainPlaylist = playlist;\n mainPlaylist.default = true;\n }\n\n return a;\n }, {}); // if no playlists have role \"main\", mark the first as main\n\n if (!mainPlaylist) {\n var firstLabel = Object.keys(formattedPlaylists)[0];\n formattedPlaylists[firstLabel].default = true;\n }\n\n return formattedPlaylists;\n};\nvar organizeVttPlaylists = function organizeVttPlaylists(playlists, sidxMapping) {\n if (sidxMapping === void 0) {\n sidxMapping = {};\n }\n\n return playlists.reduce(function (a, playlist) {\n var label = playlist.attributes.lang || 'text';\n\n if (!a[label]) {\n a[label] = {\n language: label,\n default: false,\n autoselect: false,\n playlists: [],\n uri: ''\n };\n }\n\n a[label].playlists.push(addSidxSegmentsToPlaylist(formatVttPlaylist(playlist), sidxMapping));\n return a;\n }, {});\n};\n\nvar organizeCaptionServices = function organizeCaptionServices(captionServices) {\n return captionServices.reduce(function (svcObj, svc) {\n if (!svc) {\n return svcObj;\n }\n\n svc.forEach(function (service) {\n var channel = service.channel,\n language = service.language;\n svcObj[language] = {\n autoselect: false,\n default: false,\n instreamId: channel,\n language: language\n };\n\n if (service.hasOwnProperty('aspectRatio')) {\n svcObj[language].aspectRatio = service.aspectRatio;\n }\n\n if (service.hasOwnProperty('easyReader')) {\n svcObj[language].easyReader = service.easyReader;\n }\n\n if (service.hasOwnProperty('3D')) {\n svcObj[language]['3D'] = service['3D'];\n }\n });\n return svcObj;\n }, {});\n};\n\nvar formatVideoPlaylist = function formatVideoPlaylist(_ref3) {\n var _attributes2;\n\n var attributes = _ref3.attributes,\n segments = _ref3.segments,\n sidx = _ref3.sidx,\n discontinuityStarts = _ref3.discontinuityStarts;\n var playlist = {\n attributes: (_attributes2 = {\n NAME: attributes.id,\n AUDIO: 'audio',\n SUBTITLES: 'subs',\n RESOLUTION: {\n width: attributes.width,\n height: attributes.height\n },\n CODECS: attributes.codecs,\n BANDWIDTH: attributes.bandwidth\n }, _attributes2['PROGRAM-ID'] = 1, _attributes2),\n uri: '',\n endList: attributes.type === 'static',\n timeline: attributes.periodStart,\n resolvedUri: '',\n targetDuration: attributes.duration,\n discontinuityStarts: discontinuityStarts,\n timelineStarts: attributes.timelineStarts,\n segments: segments\n };\n\n if (attributes.frameRate) {\n playlist.attributes['FRAME-RATE'] = attributes.frameRate;\n }\n\n if (attributes.contentProtection) {\n playlist.contentProtection = attributes.contentProtection;\n }\n\n if (sidx) {\n playlist.sidx = sidx;\n }\n\n return playlist;\n};\n\nvar videoOnly = function videoOnly(_ref4) {\n var attributes = _ref4.attributes;\n return attributes.mimeType === 'video/mp4' || attributes.mimeType === 'video/webm' || attributes.contentType === 'video';\n};\n\nvar audioOnly = function audioOnly(_ref5) {\n var attributes = _ref5.attributes;\n return attributes.mimeType === 'audio/mp4' || attributes.mimeType === 'audio/webm' || attributes.contentType === 'audio';\n};\n\nvar vttOnly = function vttOnly(_ref6) {\n var attributes = _ref6.attributes;\n return attributes.mimeType === 'text/vtt' || attributes.contentType === 'text';\n};\n/**\n * Contains start and timeline properties denoting a timeline start. For DASH, these will\n * be the same number.\n *\n * @typedef {Object} TimelineStart\n * @property {number} start - the start time of the timeline\n * @property {number} timeline - the timeline number\n */\n\n/**\n * Adds appropriate media and discontinuity sequence values to the segments and playlists.\n *\n * Throughout mpd-parser, the `number` attribute is used in relation to `startNumber`, a\n * DASH specific attribute used in constructing segment URI's from templates. However, from\n * an HLS perspective, the `number` attribute on a segment would be its `mediaSequence`\n * value, which should start at the original media sequence value (or 0) and increment by 1\n * for each segment thereafter. Since DASH's `startNumber` values are independent per\n * period, it doesn't make sense to use it for `number`. Instead, assume everything starts\n * from a 0 mediaSequence value and increment from there.\n *\n * Note that VHS currently doesn't use the `number` property, but it can be helpful for\n * debugging and making sense of the manifest.\n *\n * For live playlists, to account for values increasing in manifests when periods are\n * removed on refreshes, merging logic should be used to update the numbers to their\n * appropriate values (to ensure they're sequential and increasing).\n *\n * @param {Object[]} playlists - the playlists to update\n * @param {TimelineStart[]} timelineStarts - the timeline starts for the manifest\n */\n\n\nvar addMediaSequenceValues = function addMediaSequenceValues(playlists, timelineStarts) {\n // increment all segments sequentially\n playlists.forEach(function (playlist) {\n playlist.mediaSequence = 0;\n playlist.discontinuitySequence = findIndex(timelineStarts, function (_ref7) {\n var timeline = _ref7.timeline;\n return timeline === playlist.timeline;\n });\n\n if (!playlist.segments) {\n return;\n }\n\n playlist.segments.forEach(function (segment, index) {\n segment.number = index;\n });\n });\n};\n/**\n * Given a media group object, flattens all playlists within the media group into a single\n * array.\n *\n * @param {Object} mediaGroupObject - the media group object\n *\n * @return {Object[]}\n * The media group playlists\n */\n\nvar flattenMediaGroupPlaylists = function flattenMediaGroupPlaylists(mediaGroupObject) {\n if (!mediaGroupObject) {\n return [];\n }\n\n return Object.keys(mediaGroupObject).reduce(function (acc, label) {\n var labelContents = mediaGroupObject[label];\n return acc.concat(labelContents.playlists);\n }, []);\n};\nvar toM3u8 = function toM3u8(_ref8) {\n var _mediaGroups;\n\n var dashPlaylists = _ref8.dashPlaylists,\n locations = _ref8.locations,\n _ref8$sidxMapping = _ref8.sidxMapping,\n sidxMapping = _ref8$sidxMapping === void 0 ? {} : _ref8$sidxMapping,\n previousManifest = _ref8.previousManifest;\n\n if (!dashPlaylists.length) {\n return {};\n } // grab all main manifest attributes\n\n\n var _dashPlaylists$0$attr = dashPlaylists[0].attributes,\n duration = _dashPlaylists$0$attr.sourceDuration,\n type = _dashPlaylists$0$attr.type,\n suggestedPresentationDelay = _dashPlaylists$0$attr.suggestedPresentationDelay,\n minimumUpdatePeriod = _dashPlaylists$0$attr.minimumUpdatePeriod;\n var videoPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist);\n var audioPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly));\n var vttPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(vttOnly));\n var captions = dashPlaylists.map(function (playlist) {\n return playlist.attributes.captionServices;\n }).filter(Boolean);\n var manifest = {\n allowCache: true,\n discontinuityStarts: [],\n segments: [],\n endList: true,\n mediaGroups: (_mediaGroups = {\n AUDIO: {},\n VIDEO: {}\n }, _mediaGroups['CLOSED-CAPTIONS'] = {}, _mediaGroups.SUBTITLES = {}, _mediaGroups),\n uri: '',\n duration: duration,\n playlists: addSidxSegmentsToPlaylists(videoPlaylists, sidxMapping)\n };\n\n if (minimumUpdatePeriod >= 0) {\n manifest.minimumUpdatePeriod = minimumUpdatePeriod * 1000;\n }\n\n if (locations) {\n manifest.locations = locations;\n }\n\n if (type === 'dynamic') {\n manifest.suggestedPresentationDelay = suggestedPresentationDelay;\n }\n\n var isAudioOnly = manifest.playlists.length === 0;\n var organizedAudioGroup = audioPlaylists.length ? organizeAudioPlaylists(audioPlaylists, sidxMapping, isAudioOnly) : null;\n var organizedVttGroup = vttPlaylists.length ? organizeVttPlaylists(vttPlaylists, sidxMapping) : null;\n var formattedPlaylists = videoPlaylists.concat(flattenMediaGroupPlaylists(organizedAudioGroup), flattenMediaGroupPlaylists(organizedVttGroup));\n var playlistTimelineStarts = formattedPlaylists.map(function (_ref9) {\n var timelineStarts = _ref9.timelineStarts;\n return timelineStarts;\n });\n manifest.timelineStarts = getUniqueTimelineStarts(playlistTimelineStarts);\n addMediaSequenceValues(formattedPlaylists, manifest.timelineStarts);\n\n if (organizedAudioGroup) {\n manifest.mediaGroups.AUDIO.audio = organizedAudioGroup;\n }\n\n if (organizedVttGroup) {\n manifest.mediaGroups.SUBTITLES.subs = organizedVttGroup;\n }\n\n if (captions.length) {\n manifest.mediaGroups['CLOSED-CAPTIONS'].cc = organizeCaptionServices(captions);\n }\n\n if (previousManifest) {\n return positionManifestOnTimeline({\n oldManifest: previousManifest,\n newManifest: manifest\n });\n }\n\n return manifest;\n};\n\n/**\n * Calculates the R (repetition) value for a live stream (for the final segment\n * in a manifest where the r value is negative 1)\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {number} time\n * current time (typically the total time up until the final segment)\n * @param {number} duration\n * duration property for the given <S />\n *\n * @return {number}\n * R value to reach the end of the given period\n */\nvar getLiveRValue = function getLiveRValue(attributes, time, duration) {\n var NOW = attributes.NOW,\n clientOffset = attributes.clientOffset,\n availabilityStartTime = attributes.availabilityStartTime,\n _attributes$timescale = attributes.timescale,\n timescale = _attributes$timescale === void 0 ? 1 : _attributes$timescale,\n _attributes$periodSta = attributes.periodStart,\n periodStart = _attributes$periodSta === void 0 ? 0 : _attributes$periodSta,\n _attributes$minimumUp = attributes.minimumUpdatePeriod,\n minimumUpdatePeriod = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp;\n var now = (NOW + clientOffset) / 1000;\n var periodStartWC = availabilityStartTime + periodStart;\n var periodEndWC = now + minimumUpdatePeriod;\n var periodDuration = periodEndWC - periodStartWC;\n return Math.ceil((periodDuration * timescale - time) / duration);\n};\n/**\n * Uses information provided by SegmentTemplate.SegmentTimeline to determine segment\n * timing and duration\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {Object[]} segmentTimeline\n * List of objects representing the attributes of each S element contained within\n *\n * @return {{number: number, duration: number, time: number, timeline: number}[]}\n * List of Objects with segment timing and duration info\n */\n\n\nvar parseByTimeline = function parseByTimeline(attributes, segmentTimeline) {\n var type = attributes.type,\n _attributes$minimumUp2 = attributes.minimumUpdatePeriod,\n minimumUpdatePeriod = _attributes$minimumUp2 === void 0 ? 0 : _attributes$minimumUp2,\n _attributes$media = attributes.media,\n media = _attributes$media === void 0 ? '' : _attributes$media,\n sourceDuration = attributes.sourceDuration,\n _attributes$timescale2 = attributes.timescale,\n timescale = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2,\n _attributes$startNumb = attributes.startNumber,\n startNumber = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb,\n timeline = attributes.periodStart;\n var segments = [];\n var time = -1;\n\n for (var sIndex = 0; sIndex < segmentTimeline.length; sIndex++) {\n var S = segmentTimeline[sIndex];\n var duration = S.d;\n var repeat = S.r || 0;\n var segmentTime = S.t || 0;\n\n if (time < 0) {\n // first segment\n time = segmentTime;\n }\n\n if (segmentTime && segmentTime > time) {\n // discontinuity\n // TODO: How to handle this type of discontinuity\n // timeline++ here would treat it like HLS discontuity and content would\n // get appended without gap\n // E.G.\n // <S t=\"0\" d=\"1\" />\n // <S d=\"1\" />\n // <S d=\"1\" />\n // <S t=\"5\" d=\"1\" />\n // would have $Time$ values of [0, 1, 2, 5]\n // should this be appened at time positions [0, 1, 2, 3],(#EXT-X-DISCONTINUITY)\n // or [0, 1, 2, gap, gap, 5]? (#EXT-X-GAP)\n // does the value of sourceDuration consider this when calculating arbitrary\n // negative @r repeat value?\n // E.G. Same elements as above with this added at the end\n // <S d=\"1\" r=\"-1\" />\n // with a sourceDuration of 10\n // Would the 2 gaps be included in the time duration calculations resulting in\n // 8 segments with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9] or 10 segments\n // with $Time$ values of [0, 1, 2, 5, 6, 7, 8, 9, 10, 11] ?\n time = segmentTime;\n }\n\n var count = void 0;\n\n if (repeat < 0) {\n var nextS = sIndex + 1;\n\n if (nextS === segmentTimeline.length) {\n // last segment\n if (type === 'dynamic' && minimumUpdatePeriod > 0 && media.indexOf('$Number$') > 0) {\n count = getLiveRValue(attributes, time, duration);\n } else {\n // TODO: This may be incorrect depending on conclusion of TODO above\n count = (sourceDuration * timescale - time) / duration;\n }\n } else {\n count = (segmentTimeline[nextS].t - time) / duration;\n }\n } else {\n count = repeat + 1;\n }\n\n var end = startNumber + segments.length + count;\n var number = startNumber + segments.length;\n\n while (number < end) {\n segments.push({\n number: number,\n duration: duration / timescale,\n time: time,\n timeline: timeline\n });\n time += duration;\n number++;\n }\n }\n\n return segments;\n};\n\nvar identifierPattern = /\\$([A-z]*)(?:(%0)([0-9]+)d)?\\$/g;\n/**\n * Replaces template identifiers with corresponding values. To be used as the callback\n * for String.prototype.replace\n *\n * @name replaceCallback\n * @function\n * @param {string} match\n * Entire match of identifier\n * @param {string} identifier\n * Name of matched identifier\n * @param {string} format\n * Format tag string. Its presence indicates that padding is expected\n * @param {string} width\n * Desired length of the replaced value. Values less than this width shall be left\n * zero padded\n * @return {string}\n * Replacement for the matched identifier\n */\n\n/**\n * Returns a function to be used as a callback for String.prototype.replace to replace\n * template identifiers\n *\n * @param {Obect} values\n * Object containing values that shall be used to replace known identifiers\n * @param {number} values.RepresentationID\n * Value of the Representation@id attribute\n * @param {number} values.Number\n * Number of the corresponding segment\n * @param {number} values.Bandwidth\n * Value of the Representation@bandwidth attribute.\n * @param {number} values.Time\n * Timestamp value of the corresponding segment\n * @return {replaceCallback}\n * Callback to be used with String.prototype.replace to replace identifiers\n */\n\nvar identifierReplacement = function identifierReplacement(values) {\n return function (match, identifier, format, width) {\n if (match === '$$') {\n // escape sequence\n return '$';\n }\n\n if (typeof values[identifier] === 'undefined') {\n return match;\n }\n\n var value = '' + values[identifier];\n\n if (identifier === 'RepresentationID') {\n // Format tag shall not be present with RepresentationID\n return value;\n }\n\n if (!format) {\n width = 1;\n } else {\n width = parseInt(width, 10);\n }\n\n if (value.length >= width) {\n return value;\n }\n\n return \"\" + new Array(width - value.length + 1).join('0') + value;\n };\n};\n/**\n * Constructs a segment url from a template string\n *\n * @param {string} url\n * Template string to construct url from\n * @param {Obect} values\n * Object containing values that shall be used to replace known identifiers\n * @param {number} values.RepresentationID\n * Value of the Representation@id attribute\n * @param {number} values.Number\n * Number of the corresponding segment\n * @param {number} values.Bandwidth\n * Value of the Representation@bandwidth attribute.\n * @param {number} values.Time\n * Timestamp value of the corresponding segment\n * @return {string}\n * Segment url with identifiers replaced\n */\n\nvar constructTemplateUrl = function constructTemplateUrl(url, values) {\n return url.replace(identifierPattern, identifierReplacement(values));\n};\n/**\n * Generates a list of objects containing timing and duration information about each\n * segment needed to generate segment uris and the complete segment object\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {Object[]|undefined} segmentTimeline\n * List of objects representing the attributes of each S element contained within\n * the SegmentTimeline element\n * @return {{number: number, duration: number, time: number, timeline: number}[]}\n * List of Objects with segment timing and duration info\n */\n\nvar parseTemplateInfo = function parseTemplateInfo(attributes, segmentTimeline) {\n if (!attributes.duration && !segmentTimeline) {\n // if neither @duration or SegmentTimeline are present, then there shall be exactly\n // one media segment\n return [{\n number: attributes.startNumber || 1,\n duration: attributes.sourceDuration,\n time: 0,\n timeline: attributes.periodStart\n }];\n }\n\n if (attributes.duration) {\n return parseByDuration(attributes);\n }\n\n return parseByTimeline(attributes, segmentTimeline);\n};\n/**\n * Generates a list of segments using information provided by the SegmentTemplate element\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {Object[]|undefined} segmentTimeline\n * List of objects representing the attributes of each S element contained within\n * the SegmentTimeline element\n * @return {Object[]}\n * List of segment objects\n */\n\nvar segmentsFromTemplate = function segmentsFromTemplate(attributes, segmentTimeline) {\n var templateValues = {\n RepresentationID: attributes.id,\n Bandwidth: attributes.bandwidth || 0\n };\n var _attributes$initializ = attributes.initialization,\n initialization = _attributes$initializ === void 0 ? {\n sourceURL: '',\n range: ''\n } : _attributes$initializ;\n var mapSegment = urlTypeToSegment({\n baseUrl: attributes.baseUrl,\n source: constructTemplateUrl(initialization.sourceURL, templateValues),\n range: initialization.range\n });\n var segments = parseTemplateInfo(attributes, segmentTimeline);\n return segments.map(function (segment) {\n templateValues.Number = segment.number;\n templateValues.Time = segment.time;\n var uri = constructTemplateUrl(attributes.media || '', templateValues); // See DASH spec section 5.3.9.2.2\n // - if timescale isn't present on any level, default to 1.\n\n var timescale = attributes.timescale || 1; // - if presentationTimeOffset isn't present on any level, default to 0\n\n var presentationTimeOffset = attributes.presentationTimeOffset || 0;\n var presentationTime = // Even if the @t attribute is not specified for the segment, segment.time is\n // calculated in mpd-parser prior to this, so it's assumed to be available.\n attributes.periodStart + (segment.time - presentationTimeOffset) / timescale;\n var map = {\n uri: uri,\n timeline: segment.timeline,\n duration: segment.duration,\n resolvedUri: (0,_videojs_vhs_utils_es_resolve_url__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(attributes.baseUrl || '', uri),\n map: mapSegment,\n number: segment.number,\n presentationTime: presentationTime\n };\n return map;\n });\n};\n\n/**\n * Converts a <SegmentUrl> (of type URLType from the DASH spec 5.3.9.2 Table 14)\n * to an object that matches the output of a segment in videojs/mpd-parser\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {Object} segmentUrl\n * <SegmentURL> node to translate into a segment object\n * @return {Object} translated segment object\n */\n\nvar SegmentURLToSegmentObject = function SegmentURLToSegmentObject(attributes, segmentUrl) {\n var baseUrl = attributes.baseUrl,\n _attributes$initializ = attributes.initialization,\n initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ;\n var initSegment = urlTypeToSegment({\n baseUrl: baseUrl,\n source: initialization.sourceURL,\n range: initialization.range\n });\n var segment = urlTypeToSegment({\n baseUrl: baseUrl,\n source: segmentUrl.media,\n range: segmentUrl.mediaRange\n });\n segment.map = initSegment;\n return segment;\n};\n/**\n * Generates a list of segments using information provided by the SegmentList element\n * SegmentList (DASH SPEC Section 5.3.9.3.2) contains a set of <SegmentURL> nodes. Each\n * node should be translated into segment.\n *\n * @param {Object} attributes\n * Object containing all inherited attributes from parent elements with attribute\n * names as keys\n * @param {Object[]|undefined} segmentTimeline\n * List of objects representing the attributes of each S element contained within\n * the SegmentTimeline element\n * @return {Object.<Array>} list of segments\n */\n\n\nvar segmentsFromList = function segmentsFromList(attributes, segmentTimeline) {\n var duration = attributes.duration,\n _attributes$segmentUr = attributes.segmentUrls,\n segmentUrls = _attributes$segmentUr === void 0 ? [] : _attributes$segmentUr,\n periodStart = attributes.periodStart; // Per spec (5.3.9.2.1) no way to determine segment duration OR\n // if both SegmentTimeline and @duration are defined, it is outside of spec.\n\n if (!duration && !segmentTimeline || duration && segmentTimeline) {\n throw new Error(errors.SEGMENT_TIME_UNSPECIFIED);\n }\n\n var segmentUrlMap = segmentUrls.map(function (segmentUrlObject) {\n return SegmentURLToSegmentObject(attributes, segmentUrlObject);\n });\n var segmentTimeInfo;\n\n if (duration) {\n segmentTimeInfo = parseByDuration(attributes);\n }\n\n if (segmentTimeline) {\n segmentTimeInfo = parseByTimeline(attributes, segmentTimeline);\n }\n\n var segments = segmentTimeInfo.map(function (segmentTime, index) {\n if (segmentUrlMap[index]) {\n var segment = segmentUrlMap[index]; // See DASH spec section 5.3.9.2.2\n // - if timescale isn't present on any level, default to 1.\n\n var timescale = attributes.timescale || 1; // - if presentationTimeOffset isn't present on any level, default to 0\n\n var presentationTimeOffset = attributes.presentationTimeOffset || 0;\n segment.timeline = segmentTime.timeline;\n segment.duration = segmentTime.duration;\n segment.number = segmentTime.number;\n segment.presentationTime = periodStart + (segmentTime.time - presentationTimeOffset) / timescale;\n return segment;\n } // Since we're mapping we should get rid of any blank segments (in case\n // the given SegmentTimeline is handling for more elements than we have\n // SegmentURLs for).\n\n }).filter(function (segment) {\n return segment;\n });\n return segments;\n};\n\nvar generateSegments = function generateSegments(_ref) {\n var attributes = _ref.attributes,\n segmentInfo = _ref.segmentInfo;\n var segmentAttributes;\n var segmentsFn;\n\n if (segmentInfo.template) {\n segmentsFn = segmentsFromTemplate;\n segmentAttributes = merge(attributes, segmentInfo.template);\n } else if (segmentInfo.base) {\n segmentsFn = segmentsFromBase;\n segmentAttributes = merge(attributes, segmentInfo.base);\n } else if (segmentInfo.list) {\n segmentsFn = segmentsFromList;\n segmentAttributes = merge(attributes, segmentInfo.list);\n }\n\n var segmentsInfo = {\n attributes: attributes\n };\n\n if (!segmentsFn) {\n return segmentsInfo;\n }\n\n var segments = segmentsFn(segmentAttributes, segmentInfo.segmentTimeline); // The @duration attribute will be used to determin the playlist's targetDuration which\n // must be in seconds. Since we've generated the segment list, we no longer need\n // @duration to be in @timescale units, so we can convert it here.\n\n if (segmentAttributes.duration) {\n var _segmentAttributes = segmentAttributes,\n duration = _segmentAttributes.duration,\n _segmentAttributes$ti = _segmentAttributes.timescale,\n timescale = _segmentAttributes$ti === void 0 ? 1 : _segmentAttributes$ti;\n segmentAttributes.duration = duration / timescale;\n } else if (segments.length) {\n // if there is no @duration attribute, use the largest segment duration as\n // as target duration\n segmentAttributes.duration = segments.reduce(function (max, segment) {\n return Math.max(max, Math.ceil(segment.duration));\n }, 0);\n } else {\n segmentAttributes.duration = 0;\n }\n\n segmentsInfo.attributes = segmentAttributes;\n segmentsInfo.segments = segments; // This is a sidx box without actual segment information\n\n if (segmentInfo.base && segmentAttributes.indexRange) {\n segmentsInfo.sidx = segments[0];\n segmentsInfo.segments = [];\n }\n\n return segmentsInfo;\n};\nvar toPlaylists = function toPlaylists(representations) {\n return representations.map(generateSegments);\n};\n\nvar findChildren = function findChildren(element, name) {\n return from(element.childNodes).filter(function (_ref) {\n var tagName = _ref.tagName;\n return tagName === name;\n });\n};\nvar getContent = function getContent(element) {\n return element.textContent.trim();\n};\n\n/**\n * Converts the provided string that may contain a division operation to a number.\n *\n * @param {string} value - the provided string value\n *\n * @return {number} the parsed string value\n */\nvar parseDivisionValue = function parseDivisionValue(value) {\n return parseFloat(value.split('/').reduce(function (prev, current) {\n return prev / current;\n }));\n};\n\nvar parseDuration = function parseDuration(str) {\n var SECONDS_IN_YEAR = 365 * 24 * 60 * 60;\n var SECONDS_IN_MONTH = 30 * 24 * 60 * 60;\n var SECONDS_IN_DAY = 24 * 60 * 60;\n var SECONDS_IN_HOUR = 60 * 60;\n var SECONDS_IN_MIN = 60; // P10Y10M10DT10H10M10.1S\n\n var durationRegex = /P(?:(\\d*)Y)?(?:(\\d*)M)?(?:(\\d*)D)?(?:T(?:(\\d*)H)?(?:(\\d*)M)?(?:([\\d.]*)S)?)?/;\n var match = durationRegex.exec(str);\n\n if (!match) {\n return 0;\n }\n\n var _match$slice = match.slice(1),\n year = _match$slice[0],\n month = _match$slice[1],\n day = _match$slice[2],\n hour = _match$slice[3],\n minute = _match$slice[4],\n second = _match$slice[5];\n\n return parseFloat(year || 0) * SECONDS_IN_YEAR + parseFloat(month || 0) * SECONDS_IN_MONTH + parseFloat(day || 0) * SECONDS_IN_DAY + parseFloat(hour || 0) * SECONDS_IN_HOUR + parseFloat(minute || 0) * SECONDS_IN_MIN + parseFloat(second || 0);\n};\nvar parseDate = function parseDate(str) {\n // Date format without timezone according to ISO 8601\n // YYY-MM-DDThh:mm:ss.ssssss\n var dateRegex = /^\\d+-\\d+-\\d+T\\d+:\\d+:\\d+(\\.\\d+)?$/; // If the date string does not specifiy a timezone, we must specifiy UTC. This is\n // expressed by ending with 'Z'\n\n if (dateRegex.test(str)) {\n str += 'Z';\n }\n\n return Date.parse(str);\n};\n\nvar parsers = {\n /**\n * Specifies the duration of the entire Media Presentation. Format is a duration string\n * as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The duration in seconds\n */\n mediaPresentationDuration: function mediaPresentationDuration(value) {\n return parseDuration(value);\n },\n\n /**\n * Specifies the Segment availability start time for all Segments referred to in this\n * MPD. For a dynamic manifest, it specifies the anchor for the earliest availability\n * time. Format is a date string as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The date as seconds from unix epoch\n */\n availabilityStartTime: function availabilityStartTime(value) {\n return parseDate(value) / 1000;\n },\n\n /**\n * Specifies the smallest period between potential changes to the MPD. Format is a\n * duration string as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The duration in seconds\n */\n minimumUpdatePeriod: function minimumUpdatePeriod(value) {\n return parseDuration(value);\n },\n\n /**\n * Specifies the suggested presentation delay. Format is a\n * duration string as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The duration in seconds\n */\n suggestedPresentationDelay: function suggestedPresentationDelay(value) {\n return parseDuration(value);\n },\n\n /**\n * specifices the type of mpd. Can be either \"static\" or \"dynamic\"\n *\n * @param {string} value\n * value of attribute as a string\n *\n * @return {string}\n * The type as a string\n */\n type: function type(value) {\n return value;\n },\n\n /**\n * Specifies the duration of the smallest time shifting buffer for any Representation\n * in the MPD. Format is a duration string as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The duration in seconds\n */\n timeShiftBufferDepth: function timeShiftBufferDepth(value) {\n return parseDuration(value);\n },\n\n /**\n * Specifies the PeriodStart time of the Period relative to the availabilityStarttime.\n * Format is a duration string as specified in ISO 8601\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The duration in seconds\n */\n start: function start(value) {\n return parseDuration(value);\n },\n\n /**\n * Specifies the width of the visual presentation\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed width\n */\n width: function width(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the height of the visual presentation\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed height\n */\n height: function height(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the bitrate of the representation\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed bandwidth\n */\n bandwidth: function bandwidth(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the frame rate of the representation\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed frame rate\n */\n frameRate: function frameRate(value) {\n return parseDivisionValue(value);\n },\n\n /**\n * Specifies the number of the first Media Segment in this Representation in the Period\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed number\n */\n startNumber: function startNumber(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the timescale in units per seconds\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed timescale\n */\n timescale: function timescale(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the presentationTimeOffset.\n *\n * @param {string} value\n * value of the attribute as a string\n *\n * @return {number}\n * The parsed presentationTimeOffset\n */\n presentationTimeOffset: function presentationTimeOffset(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the constant approximate Segment duration\n * NOTE: The <Period> element also contains an @duration attribute. This duration\n * specifies the duration of the Period. This attribute is currently not\n * supported by the rest of the parser, however we still check for it to prevent\n * errors.\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed duration\n */\n duration: function duration(value) {\n var parsedValue = parseInt(value, 10);\n\n if (isNaN(parsedValue)) {\n return parseDuration(value);\n }\n\n return parsedValue;\n },\n\n /**\n * Specifies the Segment duration, in units of the value of the @timescale.\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed duration\n */\n d: function d(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the MPD start time, in @timescale units, the first Segment in the series\n * starts relative to the beginning of the Period\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed time\n */\n t: function t(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Specifies the repeat count of the number of following contiguous Segments with the\n * same duration expressed by the value of @d\n *\n * @param {string} value\n * value of attribute as a string\n * @return {number}\n * The parsed number\n */\n r: function r(value) {\n return parseInt(value, 10);\n },\n\n /**\n * Default parser for all other attributes. Acts as a no-op and just returns the value\n * as a string\n *\n * @param {string} value\n * value of attribute as a string\n * @return {string}\n * Unparsed value\n */\n DEFAULT: function DEFAULT(value) {\n return value;\n }\n};\n/**\n * Gets all the attributes and values of the provided node, parses attributes with known\n * types, and returns an object with attribute names mapped to values.\n *\n * @param {Node} el\n * The node to parse attributes from\n * @return {Object}\n * Object with all attributes of el parsed\n */\n\nvar parseAttributes = function parseAttributes(el) {\n if (!(el && el.attributes)) {\n return {};\n }\n\n return from(el.attributes).reduce(function (a, e) {\n var parseFn = parsers[e.name] || parsers.DEFAULT;\n a[e.name] = parseFn(e.value);\n return a;\n }, {});\n};\n\nvar keySystemsMap = {\n 'urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b': 'org.w3.clearkey',\n 'urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed': 'com.widevine.alpha',\n 'urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95': 'com.microsoft.playready',\n 'urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb': 'com.adobe.primetime'\n};\n/**\n * Builds a list of urls that is the product of the reference urls and BaseURL values\n *\n * @param {string[]} referenceUrls\n * List of reference urls to resolve to\n * @param {Node[]} baseUrlElements\n * List of BaseURL nodes from the mpd\n * @return {string[]}\n * List of resolved urls\n */\n\nvar buildBaseUrls = function buildBaseUrls(referenceUrls, baseUrlElements) {\n if (!baseUrlElements.length) {\n return referenceUrls;\n }\n\n return flatten(referenceUrls.map(function (reference) {\n return baseUrlElements.map(function (baseUrlElement) {\n return (0,_videojs_vhs_utils_es_resolve_url__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(reference, getContent(baseUrlElement));\n });\n }));\n};\n/**\n * Contains all Segment information for its containing AdaptationSet\n *\n * @typedef {Object} SegmentInformation\n * @property {Object|undefined} template\n * Contains the attributes for the SegmentTemplate node\n * @property {Object[]|undefined} segmentTimeline\n * Contains a list of atrributes for each S node within the SegmentTimeline node\n * @property {Object|undefined} list\n * Contains the attributes for the SegmentList node\n * @property {Object|undefined} base\n * Contains the attributes for the SegmentBase node\n */\n\n/**\n * Returns all available Segment information contained within the AdaptationSet node\n *\n * @param {Node} adaptationSet\n * The AdaptationSet node to get Segment information from\n * @return {SegmentInformation}\n * The Segment information contained within the provided AdaptationSet\n */\n\nvar getSegmentInformation = function getSegmentInformation(adaptationSet) {\n var segmentTemplate = findChildren(adaptationSet, 'SegmentTemplate')[0];\n var segmentList = findChildren(adaptationSet, 'SegmentList')[0];\n var segmentUrls = segmentList && findChildren(segmentList, 'SegmentURL').map(function (s) {\n return merge({\n tag: 'SegmentURL'\n }, parseAttributes(s));\n });\n var segmentBase = findChildren(adaptationSet, 'SegmentBase')[0];\n var segmentTimelineParentNode = segmentList || segmentTemplate;\n var segmentTimeline = segmentTimelineParentNode && findChildren(segmentTimelineParentNode, 'SegmentTimeline')[0];\n var segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate;\n var segmentInitialization = segmentInitializationParentNode && findChildren(segmentInitializationParentNode, 'Initialization')[0]; // SegmentTemplate is handled slightly differently, since it can have both\n // @initialization and an <Initialization> node. @initialization can be templated,\n // while the node can have a url and range specified. If the <SegmentTemplate> has\n // both @initialization and an <Initialization> subelement we opt to override with\n // the node, as this interaction is not defined in the spec.\n\n var template = segmentTemplate && parseAttributes(segmentTemplate);\n\n if (template && segmentInitialization) {\n template.initialization = segmentInitialization && parseAttributes(segmentInitialization);\n } else if (template && template.initialization) {\n // If it is @initialization we convert it to an object since this is the format that\n // later functions will rely on for the initialization segment. This is only valid\n // for <SegmentTemplate>\n template.initialization = {\n sourceURL: template.initialization\n };\n }\n\n var segmentInfo = {\n template: template,\n segmentTimeline: segmentTimeline && findChildren(segmentTimeline, 'S').map(function (s) {\n return parseAttributes(s);\n }),\n list: segmentList && merge(parseAttributes(segmentList), {\n segmentUrls: segmentUrls,\n initialization: parseAttributes(segmentInitialization)\n }),\n base: segmentBase && merge(parseAttributes(segmentBase), {\n initialization: parseAttributes(segmentInitialization)\n })\n };\n Object.keys(segmentInfo).forEach(function (key) {\n if (!segmentInfo[key]) {\n delete segmentInfo[key];\n }\n });\n return segmentInfo;\n};\n/**\n * Contains Segment information and attributes needed to construct a Playlist object\n * from a Representation\n *\n * @typedef {Object} RepresentationInformation\n * @property {SegmentInformation} segmentInfo\n * Segment information for this Representation\n * @property {Object} attributes\n * Inherited attributes for this Representation\n */\n\n/**\n * Maps a Representation node to an object containing Segment information and attributes\n *\n * @name inheritBaseUrlsCallback\n * @function\n * @param {Node} representation\n * Representation node from the mpd\n * @return {RepresentationInformation}\n * Representation information needed to construct a Playlist object\n */\n\n/**\n * Returns a callback for Array.prototype.map for mapping Representation nodes to\n * Segment information and attributes using inherited BaseURL nodes.\n *\n * @param {Object} adaptationSetAttributes\n * Contains attributes inherited by the AdaptationSet\n * @param {string[]} adaptationSetBaseUrls\n * Contains list of resolved base urls inherited by the AdaptationSet\n * @param {SegmentInformation} adaptationSetSegmentInfo\n * Contains Segment information for the AdaptationSet\n * @return {inheritBaseUrlsCallback}\n * Callback map function\n */\n\nvar inheritBaseUrls = function inheritBaseUrls(adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) {\n return function (representation) {\n var repBaseUrlElements = findChildren(representation, 'BaseURL');\n var repBaseUrls = buildBaseUrls(adaptationSetBaseUrls, repBaseUrlElements);\n var attributes = merge(adaptationSetAttributes, parseAttributes(representation));\n var representationSegmentInfo = getSegmentInformation(representation);\n return repBaseUrls.map(function (baseUrl) {\n return {\n segmentInfo: merge(adaptationSetSegmentInfo, representationSegmentInfo),\n attributes: merge(attributes, {\n baseUrl: baseUrl\n })\n };\n });\n };\n};\n/**\n * Tranforms a series of content protection nodes to\n * an object containing pssh data by key system\n *\n * @param {Node[]} contentProtectionNodes\n * Content protection nodes\n * @return {Object}\n * Object containing pssh data by key system\n */\n\nvar generateKeySystemInformation = function generateKeySystemInformation(contentProtectionNodes) {\n return contentProtectionNodes.reduce(function (acc, node) {\n var attributes = parseAttributes(node); // Although it could be argued that according to the UUID RFC spec the UUID string (a-f chars) should be generated\n // as a lowercase string it also mentions it should be treated as case-insensitive on input. Since the key system\n // UUIDs in the keySystemsMap are hardcoded as lowercase in the codebase there isn't any reason not to do\n // .toLowerCase() on the input UUID string from the manifest (at least I could not think of one).\n\n if (attributes.schemeIdUri) {\n attributes.schemeIdUri = attributes.schemeIdUri.toLowerCase();\n }\n\n var keySystem = keySystemsMap[attributes.schemeIdUri];\n\n if (keySystem) {\n acc[keySystem] = {\n attributes: attributes\n };\n var psshNode = findChildren(node, 'cenc:pssh')[0];\n\n if (psshNode) {\n var pssh = getContent(psshNode);\n acc[keySystem].pssh = pssh && (0,_videojs_vhs_utils_es_decode_b64_to_uint8_array__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(pssh);\n }\n }\n\n return acc;\n }, {});\n}; // defined in ANSI_SCTE 214-1 2016\n\n\nvar parseCaptionServiceMetadata = function parseCaptionServiceMetadata(service) {\n // 608 captions\n if (service.schemeIdUri === 'urn:scte:dash:cc:cea-608:2015') {\n var values = typeof service.value !== 'string' ? [] : service.value.split(';');\n return values.map(function (value) {\n var channel;\n var language; // default language to value\n\n language = value;\n\n if (/^CC\\d=/.test(value)) {\n var _value$split = value.split('=');\n\n channel = _value$split[0];\n language = _value$split[1];\n } else if (/^CC\\d$/.test(value)) {\n channel = value;\n }\n\n return {\n channel: channel,\n language: language\n };\n });\n } else if (service.schemeIdUri === 'urn:scte:dash:cc:cea-708:2015') {\n var _values = typeof service.value !== 'string' ? [] : service.value.split(';');\n\n return _values.map(function (value) {\n var flags = {\n // service or channel number 1-63\n 'channel': undefined,\n // language is a 3ALPHA per ISO 639.2/B\n // field is required\n 'language': undefined,\n // BIT 1/0 or ?\n // default value is 1, meaning 16:9 aspect ratio, 0 is 4:3, ? is unknown\n 'aspectRatio': 1,\n // BIT 1/0\n // easy reader flag indicated the text is tailed to the needs of beginning readers\n // default 0, or off\n 'easyReader': 0,\n // BIT 1/0\n // If 3d metadata is present (CEA-708.1) then 1\n // default 0\n '3D': 0\n };\n\n if (/=/.test(value)) {\n var _value$split2 = value.split('='),\n channel = _value$split2[0],\n _value$split2$ = _value$split2[1],\n opts = _value$split2$ === void 0 ? '' : _value$split2$;\n\n flags.channel = channel;\n flags.language = value;\n opts.split(',').forEach(function (opt) {\n var _opt$split = opt.split(':'),\n name = _opt$split[0],\n val = _opt$split[1];\n\n if (name === 'lang') {\n flags.language = val; // er for easyReadery\n } else if (name === 'er') {\n flags.easyReader = Number(val); // war for wide aspect ratio\n } else if (name === 'war') {\n flags.aspectRatio = Number(val);\n } else if (name === '3D') {\n flags['3D'] = Number(val);\n }\n });\n } else {\n flags.language = value;\n }\n\n if (flags.channel) {\n flags.channel = 'SERVICE' + flags.channel;\n }\n\n return flags;\n });\n }\n};\n/**\n * Maps an AdaptationSet node to a list of Representation information objects\n *\n * @name toRepresentationsCallback\n * @function\n * @param {Node} adaptationSet\n * AdaptationSet node from the mpd\n * @return {RepresentationInformation[]}\n * List of objects containing Representaion information\n */\n\n/**\n * Returns a callback for Array.prototype.map for mapping AdaptationSet nodes to a list of\n * Representation information objects\n *\n * @param {Object} periodAttributes\n * Contains attributes inherited by the Period\n * @param {string[]} periodBaseUrls\n * Contains list of resolved base urls inherited by the Period\n * @param {string[]} periodSegmentInfo\n * Contains Segment Information at the period level\n * @return {toRepresentationsCallback}\n * Callback map function\n */\n\nvar toRepresentations = function toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo) {\n return function (adaptationSet) {\n var adaptationSetAttributes = parseAttributes(adaptationSet);\n var adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls, findChildren(adaptationSet, 'BaseURL'));\n var role = findChildren(adaptationSet, 'Role')[0];\n var roleAttributes = {\n role: parseAttributes(role)\n };\n var attrs = merge(periodAttributes, adaptationSetAttributes, roleAttributes);\n var accessibility = findChildren(adaptationSet, 'Accessibility')[0];\n var captionServices = parseCaptionServiceMetadata(parseAttributes(accessibility));\n\n if (captionServices) {\n attrs = merge(attrs, {\n captionServices: captionServices\n });\n }\n\n var label = findChildren(adaptationSet, 'Label')[0];\n\n if (label && label.childNodes.length) {\n var labelVal = label.childNodes[0].nodeValue.trim();\n attrs = merge(attrs, {\n label: labelVal\n });\n }\n\n var contentProtection = generateKeySystemInformation(findChildren(adaptationSet, 'ContentProtection'));\n\n if (Object.keys(contentProtection).length) {\n attrs = merge(attrs, {\n contentProtection: contentProtection\n });\n }\n\n var segmentInfo = getSegmentInformation(adaptationSet);\n var representations = findChildren(adaptationSet, 'Representation');\n var adaptationSetSegmentInfo = merge(periodSegmentInfo, segmentInfo);\n return flatten(representations.map(inheritBaseUrls(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo)));\n };\n};\n/**\n * Contains all period information for mapping nodes onto adaptation sets.\n *\n * @typedef {Object} PeriodInformation\n * @property {Node} period.node\n * Period node from the mpd\n * @property {Object} period.attributes\n * Parsed period attributes from node plus any added\n */\n\n/**\n * Maps a PeriodInformation object to a list of Representation information objects for all\n * AdaptationSet nodes contained within the Period.\n *\n * @name toAdaptationSetsCallback\n * @function\n * @param {PeriodInformation} period\n * Period object containing necessary period information\n * @param {number} periodStart\n * Start time of the Period within the mpd\n * @return {RepresentationInformation[]}\n * List of objects containing Representaion information\n */\n\n/**\n * Returns a callback for Array.prototype.map for mapping Period nodes to a list of\n * Representation information objects\n *\n * @param {Object} mpdAttributes\n * Contains attributes inherited by the mpd\n * @param {string[]} mpdBaseUrls\n * Contains list of resolved base urls inherited by the mpd\n * @return {toAdaptationSetsCallback}\n * Callback map function\n */\n\nvar toAdaptationSets = function toAdaptationSets(mpdAttributes, mpdBaseUrls) {\n return function (period, index) {\n var periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period.node, 'BaseURL'));\n var periodAttributes = merge(mpdAttributes, {\n periodStart: period.attributes.start\n });\n\n if (typeof period.attributes.duration === 'number') {\n periodAttributes.periodDuration = period.attributes.duration;\n }\n\n var adaptationSets = findChildren(period.node, 'AdaptationSet');\n var periodSegmentInfo = getSegmentInformation(period.node);\n return flatten(adaptationSets.map(toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo)));\n };\n};\n/**\n * Gets Period@start property for a given period.\n *\n * @param {Object} options\n * Options object\n * @param {Object} options.attributes\n * Period attributes\n * @param {Object} [options.priorPeriodAttributes]\n * Prior period attributes (if prior period is available)\n * @param {string} options.mpdType\n * The MPD@type these periods came from\n * @return {number|null}\n * The period start, or null if it's an early available period or error\n */\n\nvar getPeriodStart = function getPeriodStart(_ref) {\n var attributes = _ref.attributes,\n priorPeriodAttributes = _ref.priorPeriodAttributes,\n mpdType = _ref.mpdType;\n\n // Summary of period start time calculation from DASH spec section 5.3.2.1\n //\n // A period's start is the first period's start + time elapsed after playing all\n // prior periods to this one. Periods continue one after the other in time (without\n // gaps) until the end of the presentation.\n //\n // The value of Period@start should be:\n // 1. if Period@start is present: value of Period@start\n // 2. if previous period exists and it has @duration: previous Period@start +\n // previous Period@duration\n // 3. if this is first period and MPD@type is 'static': 0\n // 4. in all other cases, consider the period an \"early available period\" (note: not\n // currently supported)\n // (1)\n if (typeof attributes.start === 'number') {\n return attributes.start;\n } // (2)\n\n\n if (priorPeriodAttributes && typeof priorPeriodAttributes.start === 'number' && typeof priorPeriodAttributes.duration === 'number') {\n return priorPeriodAttributes.start + priorPeriodAttributes.duration;\n } // (3)\n\n\n if (!priorPeriodAttributes && mpdType === 'static') {\n return 0;\n } // (4)\n // There is currently no logic for calculating the Period@start value if there is\n // no Period@start or prior Period@start and Period@duration available. This is not made\n // explicit by the DASH interop guidelines or the DASH spec, however, since there's\n // nothing about any other resolution strategies, it's implied. Thus, this case should\n // be considered an early available period, or error, and null should suffice for both\n // of those cases.\n\n\n return null;\n};\n/**\n * Traverses the mpd xml tree to generate a list of Representation information objects\n * that have inherited attributes from parent nodes\n *\n * @param {Node} mpd\n * The root node of the mpd\n * @param {Object} options\n * Available options for inheritAttributes\n * @param {string} options.manifestUri\n * The uri source of the mpd\n * @param {number} options.NOW\n * Current time per DASH IOP. Default is current time in ms since epoch\n * @param {number} options.clientOffset\n * Client time difference from NOW (in milliseconds)\n * @return {RepresentationInformation[]}\n * List of objects containing Representation information\n */\n\nvar inheritAttributes = function inheritAttributes(mpd, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$manifestUri = _options.manifestUri,\n manifestUri = _options$manifestUri === void 0 ? '' : _options$manifestUri,\n _options$NOW = _options.NOW,\n NOW = _options$NOW === void 0 ? Date.now() : _options$NOW,\n _options$clientOffset = _options.clientOffset,\n clientOffset = _options$clientOffset === void 0 ? 0 : _options$clientOffset;\n var periodNodes = findChildren(mpd, 'Period');\n\n if (!periodNodes.length) {\n throw new Error(errors.INVALID_NUMBER_OF_PERIOD);\n }\n\n var locations = findChildren(mpd, 'Location');\n var mpdAttributes = parseAttributes(mpd);\n var mpdBaseUrls = buildBaseUrls([manifestUri], findChildren(mpd, 'BaseURL')); // See DASH spec section 5.3.1.2, Semantics of MPD element. Default type to 'static'.\n\n mpdAttributes.type = mpdAttributes.type || 'static';\n mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0;\n mpdAttributes.NOW = NOW;\n mpdAttributes.clientOffset = clientOffset;\n\n if (locations.length) {\n mpdAttributes.locations = locations.map(getContent);\n }\n\n var periods = []; // Since toAdaptationSets acts on individual periods right now, the simplest approach to\n // adding properties that require looking at prior periods is to parse attributes and add\n // missing ones before toAdaptationSets is called. If more such properties are added, it\n // may be better to refactor toAdaptationSets.\n\n periodNodes.forEach(function (node, index) {\n var attributes = parseAttributes(node); // Use the last modified prior period, as it may contain added information necessary\n // for this period.\n\n var priorPeriod = periods[index - 1];\n attributes.start = getPeriodStart({\n attributes: attributes,\n priorPeriodAttributes: priorPeriod ? priorPeriod.attributes : null,\n mpdType: mpdAttributes.type\n });\n periods.push({\n node: node,\n attributes: attributes\n });\n });\n return {\n locations: mpdAttributes.locations,\n representationInfo: flatten(periods.map(toAdaptationSets(mpdAttributes, mpdBaseUrls)))\n };\n};\n\nvar stringToMpdXml = function stringToMpdXml(manifestString) {\n if (manifestString === '') {\n throw new Error(errors.DASH_EMPTY_MANIFEST);\n }\n\n var parser = new _xmldom_xmldom__WEBPACK_IMPORTED_MODULE_4__.DOMParser();\n var xml;\n var mpd;\n\n try {\n xml = parser.parseFromString(manifestString, 'application/xml');\n mpd = xml && xml.documentElement.tagName === 'MPD' ? xml.documentElement : null;\n } catch (e) {// ie 11 throwsw on invalid xml\n }\n\n if (!mpd || mpd && mpd.getElementsByTagName('parsererror').length > 0) {\n throw new Error(errors.DASH_INVALID_XML);\n }\n\n return mpd;\n};\n\n/**\n * Parses the manifest for a UTCTiming node, returning the nodes attributes if found\n *\n * @param {string} mpd\n * XML string of the MPD manifest\n * @return {Object|null}\n * Attributes of UTCTiming node specified in the manifest. Null if none found\n */\n\nvar parseUTCTimingScheme = function parseUTCTimingScheme(mpd) {\n var UTCTimingNode = findChildren(mpd, 'UTCTiming')[0];\n\n if (!UTCTimingNode) {\n return null;\n }\n\n var attributes = parseAttributes(UTCTimingNode);\n\n switch (attributes.schemeIdUri) {\n case 'urn:mpeg:dash:utc:http-head:2014':\n case 'urn:mpeg:dash:utc:http-head:2012':\n attributes.method = 'HEAD';\n break;\n\n case 'urn:mpeg:dash:utc:http-xsdate:2014':\n case 'urn:mpeg:dash:utc:http-iso:2014':\n case 'urn:mpeg:dash:utc:http-xsdate:2012':\n case 'urn:mpeg:dash:utc:http-iso:2012':\n attributes.method = 'GET';\n break;\n\n case 'urn:mpeg:dash:utc:direct:2014':\n case 'urn:mpeg:dash:utc:direct:2012':\n attributes.method = 'DIRECT';\n attributes.value = Date.parse(attributes.value);\n break;\n\n case 'urn:mpeg:dash:utc:http-ntp:2014':\n case 'urn:mpeg:dash:utc:ntp:2014':\n case 'urn:mpeg:dash:utc:sntp:2014':\n default:\n throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME);\n }\n\n return attributes;\n};\n\nvar VERSION = version;\n/*\n * Given a DASH manifest string and options, parses the DASH manifest into an object in the\n * form outputed by m3u8-parser and accepted by videojs/http-streaming.\n *\n * For live DASH manifests, if `previousManifest` is provided in options, then the newly\n * parsed DASH manifest will have its media sequence and discontinuity sequence values\n * updated to reflect its position relative to the prior manifest.\n *\n * @param {string} manifestString - the DASH manifest as a string\n * @param {options} [options] - any options\n *\n * @return {Object} the manifest object\n */\n\nvar parse = function parse(manifestString, options) {\n if (options === void 0) {\n options = {};\n }\n\n var parsedManifestInfo = inheritAttributes(stringToMpdXml(manifestString), options);\n var playlists = toPlaylists(parsedManifestInfo.representationInfo);\n return toM3u8({\n dashPlaylists: playlists,\n locations: parsedManifestInfo.locations,\n sidxMapping: options.sidxMapping,\n previousManifest: options.previousManifest\n });\n};\n/**\n * Parses the manifest for a UTCTiming node, returning the nodes attributes if found\n *\n * @param {string} manifestString\n * XML string of the MPD manifest\n * @return {Object|null}\n * Attributes of UTCTiming node specified in the manifest. Null if none found\n */\n\n\nvar parseUTCTiming = function parseUTCTiming(manifestString) {\n return parseUTCTimingScheme(stringToMpdXml(manifestString));\n};\n\n\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/mpd-parser/dist/mpd-parser.es.js?")},"./node_modules/videojs-contrib-dash/node_modules/mux.js/lib/tools/parse-sidx.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('var getUint64 = (__webpack_require__(/*! ../utils/numbers.js */ "./node_modules/videojs-contrib-dash/node_modules/mux.js/lib/utils/numbers.js").getUint64);\n\nvar parseSidx = function(data) {\n var view = new DataView(data.buffer, data.byteOffset, data.byteLength),\n result = {\n version: data[0],\n flags: new Uint8Array(data.subarray(1, 4)),\n references: [],\n referenceId: view.getUint32(4),\n timescale: view.getUint32(8)\n },\n i = 12;\n\n if (result.version === 0) {\n result.earliestPresentationTime = view.getUint32(i);\n result.firstOffset = view.getUint32(i + 4);\n i += 8;\n } else {\n // read 64 bits\n result.earliestPresentationTime = getUint64(data.subarray(i));\n result.firstOffset = getUint64(data.subarray(i + 8));\n i += 16;\n }\n\n i += 2; // reserved\n\n var referenceCount = view.getUint16(i);\n\n i += 2; // start of references\n\n for (; referenceCount > 0; i += 12, referenceCount--) {\n result.references.push({\n referenceType: (data[i] & 0x80) >>> 7,\n referencedSize: view.getUint32(i) & 0x7FFFFFFF,\n subsegmentDuration: view.getUint32(i + 4),\n startsWithSap: !!(data[i + 8] & 0x80),\n sapType: (data[i + 8] & 0x70) >>> 4,\n sapDeltaTime: view.getUint32(i + 8) & 0x0FFFFFFF\n });\n }\n\n return result;\n};\n\n\nmodule.exports = parseSidx;\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/mux.js/lib/tools/parse-sidx.js?')},"./node_modules/videojs-contrib-dash/node_modules/mux.js/lib/utils/clock.js":module=>{eval("/**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\nvar\n ONE_SECOND_IN_TS = 90000, // 90kHz clock\n secondsToVideoTs,\n secondsToAudioTs,\n videoTsToSeconds,\n audioTsToSeconds,\n audioTsToVideoTs,\n videoTsToAudioTs,\n metadataTsToSeconds;\n\nsecondsToVideoTs = function(seconds) {\n return seconds * ONE_SECOND_IN_TS;\n};\n\nsecondsToAudioTs = function(seconds, sampleRate) {\n return seconds * sampleRate;\n};\n\nvideoTsToSeconds = function(timestamp) {\n return timestamp / ONE_SECOND_IN_TS;\n};\n\naudioTsToSeconds = function(timestamp, sampleRate) {\n return timestamp / sampleRate;\n};\n\naudioTsToVideoTs = function(timestamp, sampleRate) {\n return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate));\n};\n\nvideoTsToAudioTs = function(timestamp, sampleRate) {\n return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate);\n};\n\n/**\n * Adjust ID3 tag or caption timing information by the timeline pts values\n * (if keepOriginalTimestamps is false) and convert to seconds\n */\nmetadataTsToSeconds = function(timestamp, timelineStartPts, keepOriginalTimestamps) {\n return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);\n};\n\nmodule.exports = {\n ONE_SECOND_IN_TS: ONE_SECOND_IN_TS,\n secondsToVideoTs: secondsToVideoTs,\n secondsToAudioTs: secondsToAudioTs,\n videoTsToSeconds: videoTsToSeconds,\n audioTsToSeconds: audioTsToSeconds,\n audioTsToVideoTs: audioTsToVideoTs,\n videoTsToAudioTs: videoTsToAudioTs,\n metadataTsToSeconds: metadataTsToSeconds\n};\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/mux.js/lib/utils/clock.js?")},"./node_modules/videojs-contrib-dash/node_modules/mux.js/lib/utils/numbers.js":module=>{eval("var MAX_UINT32 = Math.pow(2, 32);\n\nvar getUint64 = function(uint8) {\n var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);\n var value;\n\n if (dv.getBigUint64) {\n value = dv.getBigUint64(0);\n\n if (value < Number.MAX_SAFE_INTEGER) {\n return Number(value);\n }\n\n return value;\n }\n\n return (dv.getUint32(0) * MAX_UINT32) + dv.getUint32(4);\n};\n\nmodule.exports = {\n getUint64: getUint64,\n MAX_UINT32: MAX_UINT32\n};\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/mux.js/lib/utils/numbers.js?")},"./node_modules/videojs-contrib-dash/node_modules/video.js/dist/video.es.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! global/window */ \"./node_modules/global/window.js\");\n/* harmony import */ var global_window__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var global_document__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! global/document */ \"./node_modules/global/document.js\");\n/* harmony import */ var global_document__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(global_document__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/extends */ \"./node_modules/@babel/runtime/helpers/esm/extends.js\");\n/* harmony import */ var keycode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! keycode */ \"./node_modules/keycode/index.js\");\n/* harmony import */ var keycode__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(keycode__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ \"./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js\");\n/* harmony import */ var _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/inheritsLoose */ \"./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js\");\n/* harmony import */ var safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! safe-json-parse/tuple */ \"./node_modules/safe-json-parse/tuple.js\");\n/* harmony import */ var safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _videojs_xhr__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @videojs/xhr */ \"./node_modules/@videojs/xhr/lib/index.js\");\n/* harmony import */ var _videojs_xhr__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_videojs_xhr__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var videojs_vtt_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! videojs-vtt.js */ \"./node_modules/videojs-vtt.js/lib/browser-index.js\");\n/* harmony import */ var videojs_vtt_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(videojs_vtt_js__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _babel_runtime_helpers_construct__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! @babel/runtime/helpers/construct */ \"./node_modules/@babel/runtime/helpers/esm/construct.js\");\n/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! @babel/runtime/helpers/inherits */ \"./node_modules/@babel/runtime/helpers/esm/inherits.js\");\n/* harmony import */ var _videojs_vhs_utils_es_resolve_url_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @videojs/vhs-utils/es/resolve-url.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/resolve-url.js\");\n/* harmony import */ var m3u8_parser__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! m3u8-parser */ \"./node_modules/videojs-contrib-dash/node_modules/m3u8-parser/dist/m3u8-parser.es.js\");\n/* harmony import */ var _videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! @videojs/vhs-utils/es/codecs.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/codecs.js\");\n/* harmony import */ var _videojs_vhs_utils_es_media_types_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! @videojs/vhs-utils/es/media-types.js */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/media-types.js\");\n/* harmony import */ var _videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! @videojs/vhs-utils/es/byte-helpers */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/byte-helpers.js\");\n/* harmony import */ var mpd_parser__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! mpd-parser */ \"./node_modules/videojs-contrib-dash/node_modules/mpd-parser/dist/mpd-parser.es.js\");\n/* harmony import */ var mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! mux.js/lib/tools/parse-sidx */ \"./node_modules/videojs-contrib-dash/node_modules/mux.js/lib/tools/parse-sidx.js\");\n/* harmony import */ var mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_17__);\n/* harmony import */ var _videojs_vhs_utils_es_id3_helpers__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! @videojs/vhs-utils/es/id3-helpers */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/id3-helpers.js\");\n/* harmony import */ var _videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! @videojs/vhs-utils/es/containers */ \"./node_modules/videojs-contrib-dash/node_modules/@videojs/vhs-utils/es/containers.js\");\n/* harmony import */ var mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! mux.js/lib/utils/clock */ \"./node_modules/videojs-contrib-dash/node_modules/mux.js/lib/utils/clock.js\");\n/* harmony import */ var mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_20__);\n/* harmony import */ var _babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! @babel/runtime/helpers/wrapNativeSuper */ \"./node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js\");\n/**\n * @license\n * Video.js 7.21.5 <http://videojs.com/>\n * Copyright Brightcove, Inc. <https://www.brightcove.com/>\n * Available under Apache License Version 2.0\n * <https://github.com/videojs/video.js/blob/main/LICENSE>\n *\n * Includes vtt.js <https://github.com/mozilla/vtt.js>\n * Available under Apache License Version 2.0\n * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar version$5 = \"7.21.5\";\n\n/**\n * An Object that contains lifecycle hooks as keys which point to an array\n * of functions that are run when a lifecycle is triggered\n *\n * @private\n */\nvar hooks_ = {};\n/**\n * Get a list of hooks for a specific lifecycle\n *\n * @param {string} type\n * the lifecyle to get hooks from\n *\n * @param {Function|Function[]} [fn]\n * Optionally add a hook (or hooks) to the lifecycle that your are getting.\n *\n * @return {Array}\n * an array of hooks, or an empty array if there are none.\n */\n\nvar hooks = function hooks(type, fn) {\n hooks_[type] = hooks_[type] || [];\n\n if (fn) {\n hooks_[type] = hooks_[type].concat(fn);\n }\n\n return hooks_[type];\n};\n/**\n * Add a function hook to a specific videojs lifecycle.\n *\n * @param {string} type\n * the lifecycle to hook the function to.\n *\n * @param {Function|Function[]}\n * The function or array of functions to attach.\n */\n\n\nvar hook = function hook(type, fn) {\n hooks(type, fn);\n};\n/**\n * Remove a hook from a specific videojs lifecycle.\n *\n * @param {string} type\n * the lifecycle that the function hooked to\n *\n * @param {Function} fn\n * The hooked function to remove\n *\n * @return {boolean}\n * The function that was removed or undef\n */\n\n\nvar removeHook = function removeHook(type, fn) {\n var index = hooks(type).indexOf(fn);\n\n if (index <= -1) {\n return false;\n }\n\n hooks_[type] = hooks_[type].slice();\n hooks_[type].splice(index, 1);\n return true;\n};\n/**\n * Add a function hook that will only run once to a specific videojs lifecycle.\n *\n * @param {string} type\n * the lifecycle to hook the function to.\n *\n * @param {Function|Function[]}\n * The function or array of functions to attach.\n */\n\n\nvar hookOnce = function hookOnce(type, fn) {\n hooks(type, [].concat(fn).map(function (original) {\n var wrapper = function wrapper() {\n removeHook(type, wrapper);\n return original.apply(void 0, arguments);\n };\n\n return wrapper;\n }));\n};\n\n/**\n * @file fullscreen-api.js\n * @module fullscreen-api\n * @private\n */\n/**\n * Store the browser-specific methods for the fullscreen API.\n *\n * @type {Object}\n * @see [Specification]{@link https://fullscreen.spec.whatwg.org}\n * @see [Map Approach From Screenfull.js]{@link https://github.com/sindresorhus/screenfull.js}\n */\n\nvar FullscreenApi = {\n prefixed: true\n}; // browser API methods\n\nvar apiMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror', 'fullscreen'], // WebKit\n['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror', '-webkit-full-screen'], // Mozilla\n['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror', '-moz-full-screen'], // Microsoft\n['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError', '-ms-fullscreen']];\nvar specApi = apiMap[0];\nvar browserApi; // determine the supported set of functions\n\nfor (var i = 0; i < apiMap.length; i++) {\n // check for exitFullscreen function\n if (apiMap[i][1] in (global_document__WEBPACK_IMPORTED_MODULE_1___default())) {\n browserApi = apiMap[i];\n break;\n }\n} // map the browser API names to the spec API names\n\n\nif (browserApi) {\n for (var _i = 0; _i < browserApi.length; _i++) {\n FullscreenApi[specApi[_i]] = browserApi[_i];\n }\n\n FullscreenApi.prefixed = browserApi[0] !== specApi[0];\n}\n\n/**\n * @file create-logger.js\n * @module create-logger\n */\n\nvar history = [];\n/**\n * Log messages to the console and history based on the type of message\n *\n * @private\n * @param {string} type\n * The name of the console method to use.\n *\n * @param {Array} args\n * The arguments to be passed to the matching console method.\n */\n\nvar LogByTypeFactory = function LogByTypeFactory(name, log) {\n return function (type, level, args) {\n var lvl = log.levels[level];\n var lvlRegExp = new RegExp(\"^(\" + lvl + \")$\");\n\n if (type !== 'log') {\n // Add the type to the front of the message when it's not \"log\".\n args.unshift(type.toUpperCase() + ':');\n } // Add console prefix after adding to history.\n\n\n args.unshift(name + ':'); // Add a clone of the args at this point to history.\n\n if (history) {\n history.push([].concat(args)); // only store 1000 history entries\n\n var splice = history.length - 1000;\n history.splice(0, splice > 0 ? splice : 0);\n } // If there's no console then don't try to output messages, but they will\n // still be stored in history.\n\n\n if (!(global_window__WEBPACK_IMPORTED_MODULE_0___default().console)) {\n return;\n } // Was setting these once outside of this function, but containing them\n // in the function makes it easier to test cases where console doesn't exist\n // when the module is executed.\n\n\n var fn = (global_window__WEBPACK_IMPORTED_MODULE_0___default().console)[type];\n\n if (!fn && type === 'debug') {\n // Certain browsers don't have support for console.debug. For those, we\n // should default to the closest comparable log.\n fn = (global_window__WEBPACK_IMPORTED_MODULE_0___default().console).info || (global_window__WEBPACK_IMPORTED_MODULE_0___default().console).log;\n } // Bail out if there's no console or if this type is not allowed by the\n // current logging level.\n\n\n if (!fn || !lvl || !lvlRegExp.test(type)) {\n return;\n }\n\n fn[Array.isArray(args) ? 'apply' : 'call']((global_window__WEBPACK_IMPORTED_MODULE_0___default().console), args);\n };\n};\n\nfunction createLogger$1(name) {\n // This is the private tracking variable for logging level.\n var level = 'info'; // the curried logByType bound to the specific log and history\n\n var logByType;\n /**\n * Logs plain debug messages. Similar to `console.log`.\n *\n * Due to [limitations](https://github.com/jsdoc3/jsdoc/issues/955#issuecomment-313829149)\n * of our JSDoc template, we cannot properly document this as both a function\n * and a namespace, so its function signature is documented here.\n *\n * #### Arguments\n * ##### *args\n * Mixed[]\n *\n * Any combination of values that could be passed to `console.log()`.\n *\n * #### Return Value\n *\n * `undefined`\n *\n * @namespace\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged.\n */\n\n var log = function log() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n logByType('log', level, args);\n }; // This is the logByType helper that the logging methods below use\n\n\n logByType = LogByTypeFactory(name, log);\n /**\n * Create a new sublogger which chains the old name to the new name.\n *\n * For example, doing `videojs.log.createLogger('player')` and then using that logger will log the following:\n * ```js\n * mylogger('foo');\n * // > VIDEOJS: player: foo\n * ```\n *\n * @param {string} name\n * The name to add call the new logger\n * @return {Object}\n */\n\n log.createLogger = function (subname) {\n return createLogger$1(name + ': ' + subname);\n };\n /**\n * Enumeration of available logging levels, where the keys are the level names\n * and the values are `|`-separated strings containing logging methods allowed\n * in that logging level. These strings are used to create a regular expression\n * matching the function name being called.\n *\n * Levels provided by Video.js are:\n *\n * - `off`: Matches no calls. Any value that can be cast to `false` will have\n * this effect. The most restrictive.\n * - `all`: Matches only Video.js-provided functions (`debug`, `log`,\n * `log.warn`, and `log.error`).\n * - `debug`: Matches `log.debug`, `log`, `log.warn`, and `log.error` calls.\n * - `info` (default): Matches `log`, `log.warn`, and `log.error` calls.\n * - `warn`: Matches `log.warn` and `log.error` calls.\n * - `error`: Matches only `log.error` calls.\n *\n * @type {Object}\n */\n\n\n log.levels = {\n all: 'debug|log|warn|error',\n off: '',\n debug: 'debug|log|warn|error',\n info: 'log|warn|error',\n warn: 'warn|error',\n error: 'error',\n DEFAULT: level\n };\n /**\n * Get or set the current logging level.\n *\n * If a string matching a key from {@link module:log.levels} is provided, acts\n * as a setter.\n *\n * @param {string} [lvl]\n * Pass a valid level to set a new logging level.\n *\n * @return {string}\n * The current logging level.\n */\n\n log.level = function (lvl) {\n if (typeof lvl === 'string') {\n if (!log.levels.hasOwnProperty(lvl)) {\n throw new Error(\"\\\"\" + lvl + \"\\\" in not a valid log level\");\n }\n\n level = lvl;\n }\n\n return level;\n };\n /**\n * Returns an array containing everything that has been logged to the history.\n *\n * This array is a shallow clone of the internal history record. However, its\n * contents are _not_ cloned; so, mutating objects inside this array will\n * mutate them in history.\n *\n * @return {Array}\n */\n\n\n log.history = function () {\n return history ? [].concat(history) : [];\n };\n /**\n * Allows you to filter the history by the given logger name\n *\n * @param {string} fname\n * The name to filter by\n *\n * @return {Array}\n * The filtered list to return\n */\n\n\n log.history.filter = function (fname) {\n return (history || []).filter(function (historyItem) {\n // if the first item in each historyItem includes `fname`, then it's a match\n return new RegExp(\".*\" + fname + \".*\").test(historyItem[0]);\n });\n };\n /**\n * Clears the internal history tracking, but does not prevent further history\n * tracking.\n */\n\n\n log.history.clear = function () {\n if (history) {\n history.length = 0;\n }\n };\n /**\n * Disable history tracking if it is currently enabled.\n */\n\n\n log.history.disable = function () {\n if (history !== null) {\n history.length = 0;\n history = null;\n }\n };\n /**\n * Enable history tracking if it is currently disabled.\n */\n\n\n log.history.enable = function () {\n if (history === null) {\n history = [];\n }\n };\n /**\n * Logs error messages. Similar to `console.error`.\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged as an error\n */\n\n\n log.error = function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n return logByType('error', level, args);\n };\n /**\n * Logs warning messages. Similar to `console.warn`.\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged as a warning.\n */\n\n\n log.warn = function () {\n for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n return logByType('warn', level, args);\n };\n /**\n * Logs debug messages. Similar to `console.debug`, but may also act as a comparable\n * log if `console.debug` is not available\n *\n * @param {Mixed[]} args\n * One or more messages or objects that should be logged as debug.\n */\n\n\n log.debug = function () {\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n return logByType('debug', level, args);\n };\n\n return log;\n}\n\n/**\n * @file log.js\n * @module log\n */\nvar log$1 = createLogger$1('VIDEOJS');\nvar createLogger = log$1.createLogger;\n\n/**\n * @file obj.js\n * @module obj\n */\n\n/**\n * @callback obj:EachCallback\n *\n * @param {Mixed} value\n * The current key for the object that is being iterated over.\n *\n * @param {string} key\n * The current key-value for object that is being iterated over\n */\n\n/**\n * @callback obj:ReduceCallback\n *\n * @param {Mixed} accum\n * The value that is accumulating over the reduce loop.\n *\n * @param {Mixed} value\n * The current key for the object that is being iterated over.\n *\n * @param {string} key\n * The current key-value for object that is being iterated over\n *\n * @return {Mixed}\n * The new accumulated value.\n */\nvar toString = Object.prototype.toString;\n/**\n * Get the keys of an Object\n *\n * @param {Object}\n * The Object to get the keys from\n *\n * @return {string[]}\n * An array of the keys from the object. Returns an empty array if the\n * object passed in was invalid or had no keys.\n *\n * @private\n */\n\nvar keys = function keys(object) {\n return isObject(object) ? Object.keys(object) : [];\n};\n/**\n * Array-like iteration for objects.\n *\n * @param {Object} object\n * The object to iterate over\n *\n * @param {obj:EachCallback} fn\n * The callback function which is called for each key in the object.\n */\n\n\nfunction each(object, fn) {\n keys(object).forEach(function (key) {\n return fn(object[key], key);\n });\n}\n/**\n * Array-like reduce for objects.\n *\n * @param {Object} object\n * The Object that you want to reduce.\n *\n * @param {Function} fn\n * A callback function which is called for each key in the object. It\n * receives the accumulated value and the per-iteration value and key\n * as arguments.\n *\n * @param {Mixed} [initial = 0]\n * Starting value\n *\n * @return {Mixed}\n * The final accumulated value.\n */\n\nfunction reduce(object, fn, initial) {\n if (initial === void 0) {\n initial = 0;\n }\n\n return keys(object).reduce(function (accum, key) {\n return fn(accum, object[key], key);\n }, initial);\n}\n/**\n * Object.assign-style object shallow merge/extend.\n *\n * @param {Object} target\n * @param {Object} ...sources\n * @return {Object}\n */\n\nfunction assign(target) {\n for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n sources[_key - 1] = arguments[_key];\n }\n\n if (Object.assign) {\n return _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_2__[\"default\"].apply(void 0, [target].concat(sources));\n }\n\n sources.forEach(function (source) {\n if (!source) {\n return;\n }\n\n each(source, function (value, key) {\n target[key] = value;\n });\n });\n return target;\n}\n/**\n * Returns whether a value is an object of any kind - including DOM nodes,\n * arrays, regular expressions, etc. Not functions, though.\n *\n * This avoids the gotcha where using `typeof` on a `null` value\n * results in `'object'`.\n *\n * @param {Object} value\n * @return {boolean}\n */\n\nfunction isObject(value) {\n return !!value && typeof value === 'object';\n}\n/**\n * Returns whether an object appears to be a \"plain\" object - that is, a\n * direct instance of `Object`.\n *\n * @param {Object} value\n * @return {boolean}\n */\n\nfunction isPlain(value) {\n return isObject(value) && toString.call(value) === '[object Object]' && value.constructor === Object;\n}\n\n/**\n * @file computed-style.js\n * @module computed-style\n */\n/**\n * A safe getComputedStyle.\n *\n * This is needed because in Firefox, if the player is loaded in an iframe with\n * `display:none`, then `getComputedStyle` returns `null`, so, we do a\n * null-check to make sure that the player doesn't break in these cases.\n *\n * @function\n * @param {Element} el\n * The element you want the computed style of\n *\n * @param {string} prop\n * The property name you want\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397\n */\n\nfunction computedStyle(el, prop) {\n if (!el || !prop) {\n return '';\n }\n\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().getComputedStyle) === 'function') {\n var computedStyleValue;\n\n try {\n computedStyleValue = global_window__WEBPACK_IMPORTED_MODULE_0___default().getComputedStyle(el);\n } catch (e) {\n return '';\n }\n\n return computedStyleValue ? computedStyleValue.getPropertyValue(prop) || computedStyleValue[prop] : '';\n }\n\n return '';\n}\n\n/**\n * @file browser.js\n * @module browser\n */\nvar USER_AGENT = (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).userAgent || '';\nvar webkitVersionMap = /AppleWebKit\\/([\\d.]+)/i.exec(USER_AGENT);\nvar appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;\n/**\n * Whether or not this device is an iPod.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar IS_IPOD = /iPod/i.test(USER_AGENT);\n/**\n * The detected iOS version - or `null`.\n *\n * @static\n * @const\n * @type {string|null}\n */\n\nvar IOS_VERSION = function () {\n var match = USER_AGENT.match(/OS (\\d+)_/i);\n\n if (match && match[1]) {\n return match[1];\n }\n\n return null;\n}();\n/**\n * Whether or not this is an Android device.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar IS_ANDROID = /Android/i.test(USER_AGENT);\n/**\n * The detected Android version - or `null`.\n *\n * @static\n * @const\n * @type {number|string|null}\n */\n\nvar ANDROID_VERSION = function () {\n // This matches Android Major.Minor.Patch versions\n // ANDROID_VERSION is Major.Minor as a Number, if Minor isn't available, then only Major is returned\n var match = USER_AGENT.match(/Android (\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))*/i);\n\n if (!match) {\n return null;\n }\n\n var major = match[1] && parseFloat(match[1]);\n var minor = match[2] && parseFloat(match[2]);\n\n if (major && minor) {\n return parseFloat(match[1] + '.' + match[2]);\n } else if (major) {\n return major;\n }\n\n return null;\n}();\n/**\n * Whether or not this is a native Android browser.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar IS_NATIVE_ANDROID = IS_ANDROID && ANDROID_VERSION < 5 && appleWebkitVersion < 537;\n/**\n * Whether or not this is Mozilla Firefox.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar IS_FIREFOX = /Firefox/i.test(USER_AGENT);\n/**\n * Whether or not this is Microsoft Edge.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar IS_EDGE = /Edg/i.test(USER_AGENT);\n/**\n * Whether or not this is Google Chrome.\n *\n * This will also be `true` for Chrome on iOS, which will have different support\n * as it is actually Safari under the hood.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar IS_CHROME = !IS_EDGE && (/Chrome/i.test(USER_AGENT) || /CriOS/i.test(USER_AGENT));\n/**\n * The detected Google Chrome version - or `null`.\n *\n * @static\n * @const\n * @type {number|null}\n */\n\nvar CHROME_VERSION = function () {\n var match = USER_AGENT.match(/(Chrome|CriOS)\\/(\\d+)/);\n\n if (match && match[2]) {\n return parseFloat(match[2]);\n }\n\n return null;\n}();\n/**\n * The detected Internet Explorer version - or `null`.\n *\n * @static\n * @const\n * @type {number|null}\n */\n\nvar IE_VERSION = function () {\n var result = /MSIE\\s(\\d+)\\.\\d/.exec(USER_AGENT);\n var version = result && parseFloat(result[1]);\n\n if (!version && /Trident\\/7.0/i.test(USER_AGENT) && /rv:11.0/.test(USER_AGENT)) {\n // IE 11 has a different user agent string than other IE versions\n version = 11.0;\n }\n\n return version;\n}();\n/**\n * Whether or not this is desktop Safari.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar IS_SAFARI = /Safari/i.test(USER_AGENT) && !IS_CHROME && !IS_ANDROID && !IS_EDGE;\n/**\n * Whether or not this is a Windows machine.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar IS_WINDOWS = /Windows/i.test(USER_AGENT);\n/**\n * Whether or not this device is touch-enabled.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar TOUCH_ENABLED = Boolean(isReal() && (\"ontouchstart\" in (global_window__WEBPACK_IMPORTED_MODULE_0___default()) || (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).maxTouchPoints || (global_window__WEBPACK_IMPORTED_MODULE_0___default().DocumentTouch) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().document) instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().DocumentTouch)));\n/**\n * Whether or not this device is an iPad.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar IS_IPAD = /iPad/i.test(USER_AGENT) || IS_SAFARI && TOUCH_ENABLED && !/iPhone/i.test(USER_AGENT);\n/**\n * Whether or not this device is an iPhone.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n// The Facebook app's UIWebView identifies as both an iPhone and iPad, so\n// to identify iPhones, we need to exclude iPads.\n// http://artsy.github.io/blog/2012/10/18/the-perils-of-ios-user-agent-sniffing/\n\nvar IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD;\n/**\n * Whether or not this is an iOS device.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD;\n/**\n * Whether or not this is any flavor of Safari - including iOS.\n *\n * @static\n * @const\n * @type {Boolean}\n */\n\nvar IS_ANY_SAFARI = (IS_SAFARI || IS_IOS) && !IS_CHROME;\n\nvar browser = /*#__PURE__*/Object.freeze({\n __proto__: null,\n IS_IPOD: IS_IPOD,\n IOS_VERSION: IOS_VERSION,\n IS_ANDROID: IS_ANDROID,\n ANDROID_VERSION: ANDROID_VERSION,\n IS_NATIVE_ANDROID: IS_NATIVE_ANDROID,\n IS_FIREFOX: IS_FIREFOX,\n IS_EDGE: IS_EDGE,\n IS_CHROME: IS_CHROME,\n CHROME_VERSION: CHROME_VERSION,\n IE_VERSION: IE_VERSION,\n IS_SAFARI: IS_SAFARI,\n IS_WINDOWS: IS_WINDOWS,\n TOUCH_ENABLED: TOUCH_ENABLED,\n IS_IPAD: IS_IPAD,\n IS_IPHONE: IS_IPHONE,\n IS_IOS: IS_IOS,\n IS_ANY_SAFARI: IS_ANY_SAFARI\n});\n\n/**\n * @file dom.js\n * @module dom\n */\n/**\n * Detect if a value is a string with any non-whitespace characters.\n *\n * @private\n * @param {string} str\n * The string to check\n *\n * @return {boolean}\n * Will be `true` if the string is non-blank, `false` otherwise.\n *\n */\n\nfunction isNonBlankString(str) {\n // we use str.trim as it will trim any whitespace characters\n // from the front or back of non-whitespace characters. aka\n // Any string that contains non-whitespace characters will\n // still contain them after `trim` but whitespace only strings\n // will have a length of 0, failing this check.\n return typeof str === 'string' && Boolean(str.trim());\n}\n/**\n * Throws an error if the passed string has whitespace. This is used by\n * class methods to be relatively consistent with the classList API.\n *\n * @private\n * @param {string} str\n * The string to check for whitespace.\n *\n * @throws {Error}\n * Throws an error if there is whitespace in the string.\n */\n\n\nfunction throwIfWhitespace(str) {\n // str.indexOf instead of regex because str.indexOf is faster performance wise.\n if (str.indexOf(' ') >= 0) {\n throw new Error('class has illegal whitespace characters');\n }\n}\n/**\n * Produce a regular expression for matching a className within an elements className.\n *\n * @private\n * @param {string} className\n * The className to generate the RegExp for.\n *\n * @return {RegExp}\n * The RegExp that will check for a specific `className` in an elements\n * className.\n */\n\n\nfunction classRegExp(className) {\n return new RegExp('(^|\\\\s)' + className + '($|\\\\s)');\n}\n/**\n * Whether the current DOM interface appears to be real (i.e. not simulated).\n *\n * @return {boolean}\n * Will be `true` if the DOM appears to be real, `false` otherwise.\n */\n\n\nfunction isReal() {\n // Both document and window will never be undefined thanks to `global`.\n return (global_document__WEBPACK_IMPORTED_MODULE_1___default()) === (global_window__WEBPACK_IMPORTED_MODULE_0___default().document);\n}\n/**\n * Determines, via duck typing, whether or not a value is a DOM element.\n *\n * @param {Mixed} value\n * The value to check.\n *\n * @return {boolean}\n * Will be `true` if the value is a DOM element, `false` otherwise.\n */\n\nfunction isEl(value) {\n return isObject(value) && value.nodeType === 1;\n}\n/**\n * Determines if the current DOM is embedded in an iframe.\n *\n * @return {boolean}\n * Will be `true` if the DOM is embedded in an iframe, `false`\n * otherwise.\n */\n\nfunction isInFrame() {\n // We need a try/catch here because Safari will throw errors when attempting\n // to get either `parent` or `self`\n try {\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default().parent) !== (global_window__WEBPACK_IMPORTED_MODULE_0___default().self);\n } catch (x) {\n return true;\n }\n}\n/**\n * Creates functions to query the DOM using a given method.\n *\n * @private\n * @param {string} method\n * The method to create the query with.\n *\n * @return {Function}\n * The query method\n */\n\nfunction createQuerier(method) {\n return function (selector, context) {\n if (!isNonBlankString(selector)) {\n return (global_document__WEBPACK_IMPORTED_MODULE_1___default())[method](null);\n }\n\n if (isNonBlankString(context)) {\n context = global_document__WEBPACK_IMPORTED_MODULE_1___default().querySelector(context);\n }\n\n var ctx = isEl(context) ? context : (global_document__WEBPACK_IMPORTED_MODULE_1___default());\n return ctx[method] && ctx[method](selector);\n };\n}\n/**\n * Creates an element and applies properties, attributes, and inserts content.\n *\n * @param {string} [tagName='div']\n * Name of tag to be created.\n *\n * @param {Object} [properties={}]\n * Element properties to be applied.\n *\n * @param {Object} [attributes={}]\n * Element attributes to be applied.\n *\n * @param {module:dom~ContentDescriptor} content\n * A content descriptor object.\n *\n * @return {Element}\n * The element that was created.\n */\n\n\nfunction createEl(tagName, properties, attributes, content) {\n if (tagName === void 0) {\n tagName = 'div';\n }\n\n if (properties === void 0) {\n properties = {};\n }\n\n if (attributes === void 0) {\n attributes = {};\n }\n\n var el = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement(tagName);\n Object.getOwnPropertyNames(properties).forEach(function (propName) {\n var val = properties[propName]; // See #2176\n // We originally were accepting both properties and attributes in the\n // same object, but that doesn't work so well.\n\n if (propName.indexOf('aria-') !== -1 || propName === 'role' || propName === 'type') {\n log$1.warn('Setting attributes in the second argument of createEl()\\n' + 'has been deprecated. Use the third argument instead.\\n' + (\"createEl(type, properties, attributes). Attempting to set \" + propName + \" to \" + val + \".\"));\n el.setAttribute(propName, val); // Handle textContent since it's not supported everywhere and we have a\n // method for it.\n } else if (propName === 'textContent') {\n textContent(el, val);\n } else if (el[propName] !== val || propName === 'tabIndex') {\n el[propName] = val;\n }\n });\n Object.getOwnPropertyNames(attributes).forEach(function (attrName) {\n el.setAttribute(attrName, attributes[attrName]);\n });\n\n if (content) {\n appendContent(el, content);\n }\n\n return el;\n}\n/**\n * Injects text into an element, replacing any existing contents entirely.\n *\n * @param {Element} el\n * The element to add text content into\n *\n * @param {string} text\n * The text content to add.\n *\n * @return {Element}\n * The element with added text content.\n */\n\nfunction textContent(el, text) {\n if (typeof el.textContent === 'undefined') {\n el.innerText = text;\n } else {\n el.textContent = text;\n }\n\n return el;\n}\n/**\n * Insert an element as the first child node of another\n *\n * @param {Element} child\n * Element to insert\n *\n * @param {Element} parent\n * Element to insert child into\n */\n\nfunction prependTo(child, parent) {\n if (parent.firstChild) {\n parent.insertBefore(child, parent.firstChild);\n } else {\n parent.appendChild(child);\n }\n}\n/**\n * Check if an element has a class name.\n *\n * @param {Element} element\n * Element to check\n *\n * @param {string} classToCheck\n * Class name to check for\n *\n * @return {boolean}\n * Will be `true` if the element has a class, `false` otherwise.\n *\n * @throws {Error}\n * Throws an error if `classToCheck` has white space.\n */\n\nfunction hasClass(element, classToCheck) {\n throwIfWhitespace(classToCheck);\n\n if (element.classList) {\n return element.classList.contains(classToCheck);\n }\n\n return classRegExp(classToCheck).test(element.className);\n}\n/**\n * Add a class name to an element.\n *\n * @param {Element} element\n * Element to add class name to.\n *\n * @param {string} classToAdd\n * Class name to add.\n *\n * @return {Element}\n * The DOM element with the added class name.\n */\n\nfunction addClass(element, classToAdd) {\n if (element.classList) {\n element.classList.add(classToAdd); // Don't need to `throwIfWhitespace` here because `hasElClass` will do it\n // in the case of classList not being supported.\n } else if (!hasClass(element, classToAdd)) {\n element.className = (element.className + ' ' + classToAdd).trim();\n }\n\n return element;\n}\n/**\n * Remove a class name from an element.\n *\n * @param {Element} element\n * Element to remove a class name from.\n *\n * @param {string} classToRemove\n * Class name to remove\n *\n * @return {Element}\n * The DOM element with class name removed.\n */\n\nfunction removeClass(element, classToRemove) {\n // Protect in case the player gets disposed\n if (!element) {\n log$1.warn(\"removeClass was called with an element that doesn't exist\");\n return null;\n }\n\n if (element.classList) {\n element.classList.remove(classToRemove);\n } else {\n throwIfWhitespace(classToRemove);\n element.className = element.className.split(/\\s+/).filter(function (c) {\n return c !== classToRemove;\n }).join(' ');\n }\n\n return element;\n}\n/**\n * The callback definition for toggleClass.\n *\n * @callback module:dom~PredicateCallback\n * @param {Element} element\n * The DOM element of the Component.\n *\n * @param {string} classToToggle\n * The `className` that wants to be toggled\n *\n * @return {boolean|undefined}\n * If `true` is returned, the `classToToggle` will be added to the\n * `element`. If `false`, the `classToToggle` will be removed from\n * the `element`. If `undefined`, the callback will be ignored.\n */\n\n/**\n * Adds or removes a class name to/from an element depending on an optional\n * condition or the presence/absence of the class name.\n *\n * @param {Element} element\n * The element to toggle a class name on.\n *\n * @param {string} classToToggle\n * The class that should be toggled.\n *\n * @param {boolean|module:dom~PredicateCallback} [predicate]\n * See the return value for {@link module:dom~PredicateCallback}\n *\n * @return {Element}\n * The element with a class that has been toggled.\n */\n\nfunction toggleClass(element, classToToggle, predicate) {\n // This CANNOT use `classList` internally because IE11 does not support the\n // second parameter to the `classList.toggle()` method! Which is fine because\n // `classList` will be used by the add/remove functions.\n var has = hasClass(element, classToToggle);\n\n if (typeof predicate === 'function') {\n predicate = predicate(element, classToToggle);\n }\n\n if (typeof predicate !== 'boolean') {\n predicate = !has;\n } // If the necessary class operation matches the current state of the\n // element, no action is required.\n\n\n if (predicate === has) {\n return;\n }\n\n if (predicate) {\n addClass(element, classToToggle);\n } else {\n removeClass(element, classToToggle);\n }\n\n return element;\n}\n/**\n * Apply attributes to an HTML element.\n *\n * @param {Element} el\n * Element to add attributes to.\n *\n * @param {Object} [attributes]\n * Attributes to be applied.\n */\n\nfunction setAttributes(el, attributes) {\n Object.getOwnPropertyNames(attributes).forEach(function (attrName) {\n var attrValue = attributes[attrName];\n\n if (attrValue === null || typeof attrValue === 'undefined' || attrValue === false) {\n el.removeAttribute(attrName);\n } else {\n el.setAttribute(attrName, attrValue === true ? '' : attrValue);\n }\n });\n}\n/**\n * Get an element's attribute values, as defined on the HTML tag.\n *\n * Attributes are not the same as properties. They're defined on the tag\n * or with setAttribute.\n *\n * @param {Element} tag\n * Element from which to get tag attributes.\n *\n * @return {Object}\n * All attributes of the element. Boolean attributes will be `true` or\n * `false`, others will be strings.\n */\n\nfunction getAttributes(tag) {\n var obj = {}; // known boolean attributes\n // we can check for matching boolean properties, but not all browsers\n // and not all tags know about these attributes, so, we still want to check them manually\n\n var knownBooleans = ',' + 'autoplay,controls,playsinline,loop,muted,default,defaultMuted' + ',';\n\n if (tag && tag.attributes && tag.attributes.length > 0) {\n var attrs = tag.attributes;\n\n for (var i = attrs.length - 1; i >= 0; i--) {\n var attrName = attrs[i].name;\n var attrVal = attrs[i].value; // check for known booleans\n // the matching element property will return a value for typeof\n\n if (typeof tag[attrName] === 'boolean' || knownBooleans.indexOf(',' + attrName + ',') !== -1) {\n // the value of an included boolean attribute is typically an empty\n // string ('') which would equal false if we just check for a false value.\n // we also don't want support bad code like autoplay='false'\n attrVal = attrVal !== null ? true : false;\n }\n\n obj[attrName] = attrVal;\n }\n }\n\n return obj;\n}\n/**\n * Get the value of an element's attribute.\n *\n * @param {Element} el\n * A DOM element.\n *\n * @param {string} attribute\n * Attribute to get the value of.\n *\n * @return {string}\n * The value of the attribute.\n */\n\nfunction getAttribute(el, attribute) {\n return el.getAttribute(attribute);\n}\n/**\n * Set the value of an element's attribute.\n *\n * @param {Element} el\n * A DOM element.\n *\n * @param {string} attribute\n * Attribute to set.\n *\n * @param {string} value\n * Value to set the attribute to.\n */\n\nfunction setAttribute(el, attribute, value) {\n el.setAttribute(attribute, value);\n}\n/**\n * Remove an element's attribute.\n *\n * @param {Element} el\n * A DOM element.\n *\n * @param {string} attribute\n * Attribute to remove.\n */\n\nfunction removeAttribute(el, attribute) {\n el.removeAttribute(attribute);\n}\n/**\n * Attempt to block the ability to select text.\n */\n\nfunction blockTextSelection() {\n global_document__WEBPACK_IMPORTED_MODULE_1___default().body.focus();\n\n (global_document__WEBPACK_IMPORTED_MODULE_1___default().onselectstart) = function () {\n return false;\n };\n}\n/**\n * Turn off text selection blocking.\n */\n\nfunction unblockTextSelection() {\n (global_document__WEBPACK_IMPORTED_MODULE_1___default().onselectstart) = function () {\n return true;\n };\n}\n/**\n * Identical to the native `getBoundingClientRect` function, but ensures that\n * the method is supported at all (it is in all browsers we claim to support)\n * and that the element is in the DOM before continuing.\n *\n * This wrapper function also shims properties which are not provided by some\n * older browsers (namely, IE8).\n *\n * Additionally, some browsers do not support adding properties to a\n * `ClientRect`/`DOMRect` object; so, we shallow-copy it with the standard\n * properties (except `x` and `y` which are not widely supported). This helps\n * avoid implementations where keys are non-enumerable.\n *\n * @param {Element} el\n * Element whose `ClientRect` we want to calculate.\n *\n * @return {Object|undefined}\n * Always returns a plain object - or `undefined` if it cannot.\n */\n\nfunction getBoundingClientRect(el) {\n if (el && el.getBoundingClientRect && el.parentNode) {\n var rect = el.getBoundingClientRect();\n var result = {};\n ['bottom', 'height', 'left', 'right', 'top', 'width'].forEach(function (k) {\n if (rect[k] !== undefined) {\n result[k] = rect[k];\n }\n });\n\n if (!result.height) {\n result.height = parseFloat(computedStyle(el, 'height'));\n }\n\n if (!result.width) {\n result.width = parseFloat(computedStyle(el, 'width'));\n }\n\n return result;\n }\n}\n/**\n * Represents the position of a DOM element on the page.\n *\n * @typedef {Object} module:dom~Position\n *\n * @property {number} left\n * Pixels to the left.\n *\n * @property {number} top\n * Pixels from the top.\n */\n\n/**\n * Get the position of an element in the DOM.\n *\n * Uses `getBoundingClientRect` technique from John Resig.\n *\n * @see http://ejohn.org/blog/getboundingclientrect-is-awesome/\n *\n * @param {Element} el\n * Element from which to get offset.\n *\n * @return {module:dom~Position}\n * The position of the element that was passed in.\n */\n\nfunction findPosition(el) {\n if (!el || el && !el.offsetParent) {\n return {\n left: 0,\n top: 0,\n width: 0,\n height: 0\n };\n }\n\n var width = el.offsetWidth;\n var height = el.offsetHeight;\n var left = 0;\n var top = 0;\n\n while (el.offsetParent && el !== (global_document__WEBPACK_IMPORTED_MODULE_1___default())[FullscreenApi.fullscreenElement]) {\n left += el.offsetLeft;\n top += el.offsetTop;\n el = el.offsetParent;\n }\n\n return {\n left: left,\n top: top,\n width: width,\n height: height\n };\n}\n/**\n * Represents x and y coordinates for a DOM element or mouse pointer.\n *\n * @typedef {Object} module:dom~Coordinates\n *\n * @property {number} x\n * x coordinate in pixels\n *\n * @property {number} y\n * y coordinate in pixels\n */\n\n/**\n * Get the pointer position within an element.\n *\n * The base on the coordinates are the bottom left of the element.\n *\n * @param {Element} el\n * Element on which to get the pointer position on.\n *\n * @param {EventTarget~Event} event\n * Event object.\n *\n * @return {module:dom~Coordinates}\n * A coordinates object corresponding to the mouse position.\n *\n */\n\nfunction getPointerPosition(el, event) {\n var translated = {\n x: 0,\n y: 0\n };\n\n if (IS_IOS) {\n var item = el;\n\n while (item && item.nodeName.toLowerCase() !== 'html') {\n var transform = computedStyle(item, 'transform');\n\n if (/^matrix/.test(transform)) {\n var values = transform.slice(7, -1).split(/,\\s/).map(Number);\n translated.x += values[4];\n translated.y += values[5];\n } else if (/^matrix3d/.test(transform)) {\n var _values = transform.slice(9, -1).split(/,\\s/).map(Number);\n\n translated.x += _values[12];\n translated.y += _values[13];\n }\n\n item = item.parentNode;\n }\n }\n\n var position = {};\n var boxTarget = findPosition(event.target);\n var box = findPosition(el);\n var boxW = box.width;\n var boxH = box.height;\n var offsetY = event.offsetY - (box.top - boxTarget.top);\n var offsetX = event.offsetX - (box.left - boxTarget.left);\n\n if (event.changedTouches) {\n offsetX = event.changedTouches[0].pageX - box.left;\n offsetY = event.changedTouches[0].pageY + box.top;\n\n if (IS_IOS) {\n offsetX -= translated.x;\n offsetY -= translated.y;\n }\n }\n\n position.y = 1 - Math.max(0, Math.min(1, offsetY / boxH));\n position.x = Math.max(0, Math.min(1, offsetX / boxW));\n return position;\n}\n/**\n * Determines, via duck typing, whether or not a value is a text node.\n *\n * @param {Mixed} value\n * Check if this value is a text node.\n *\n * @return {boolean}\n * Will be `true` if the value is a text node, `false` otherwise.\n */\n\nfunction isTextNode(value) {\n return isObject(value) && value.nodeType === 3;\n}\n/**\n * Empties the contents of an element.\n *\n * @param {Element} el\n * The element to empty children from\n *\n * @return {Element}\n * The element with no children\n */\n\nfunction emptyEl(el) {\n while (el.firstChild) {\n el.removeChild(el.firstChild);\n }\n\n return el;\n}\n/**\n * This is a mixed value that describes content to be injected into the DOM\n * via some method. It can be of the following types:\n *\n * Type | Description\n * -----------|-------------\n * `string` | The value will be normalized into a text node.\n * `Element` | The value will be accepted as-is.\n * `TextNode` | The value will be accepted as-is.\n * `Array` | A one-dimensional array of strings, elements, text nodes, or functions. These functions should return a string, element, or text node (any other return value, like an array, will be ignored).\n * `Function` | A function, which is expected to return a string, element, text node, or array - any of the other possible values described above. This means that a content descriptor could be a function that returns an array of functions, but those second-level functions must return strings, elements, or text nodes.\n *\n * @typedef {string|Element|TextNode|Array|Function} module:dom~ContentDescriptor\n */\n\n/**\n * Normalizes content for eventual insertion into the DOM.\n *\n * This allows a wide range of content definition methods, but helps protect\n * from falling into the trap of simply writing to `innerHTML`, which could\n * be an XSS concern.\n *\n * The content for an element can be passed in multiple types and\n * combinations, whose behavior is as follows:\n *\n * @param {module:dom~ContentDescriptor} content\n * A content descriptor value.\n *\n * @return {Array}\n * All of the content that was passed in, normalized to an array of\n * elements or text nodes.\n */\n\nfunction normalizeContent(content) {\n // First, invoke content if it is a function. If it produces an array,\n // that needs to happen before normalization.\n if (typeof content === 'function') {\n content = content();\n } // Next up, normalize to an array, so one or many items can be normalized,\n // filtered, and returned.\n\n\n return (Array.isArray(content) ? content : [content]).map(function (value) {\n // First, invoke value if it is a function to produce a new value,\n // which will be subsequently normalized to a Node of some kind.\n if (typeof value === 'function') {\n value = value();\n }\n\n if (isEl(value) || isTextNode(value)) {\n return value;\n }\n\n if (typeof value === 'string' && /\\S/.test(value)) {\n return global_document__WEBPACK_IMPORTED_MODULE_1___default().createTextNode(value);\n }\n }).filter(function (value) {\n return value;\n });\n}\n/**\n * Normalizes and appends content to an element.\n *\n * @param {Element} el\n * Element to append normalized content to.\n *\n * @param {module:dom~ContentDescriptor} content\n * A content descriptor value.\n *\n * @return {Element}\n * The element with appended normalized content.\n */\n\nfunction appendContent(el, content) {\n normalizeContent(content).forEach(function (node) {\n return el.appendChild(node);\n });\n return el;\n}\n/**\n * Normalizes and inserts content into an element; this is identical to\n * `appendContent()`, except it empties the element first.\n *\n * @param {Element} el\n * Element to insert normalized content into.\n *\n * @param {module:dom~ContentDescriptor} content\n * A content descriptor value.\n *\n * @return {Element}\n * The element with inserted normalized content.\n */\n\nfunction insertContent(el, content) {\n return appendContent(emptyEl(el), content);\n}\n/**\n * Check if an event was a single left click.\n *\n * @param {EventTarget~Event} event\n * Event object.\n *\n * @return {boolean}\n * Will be `true` if a single left click, `false` otherwise.\n */\n\nfunction isSingleLeftClick(event) {\n // Note: if you create something draggable, be sure to\n // call it on both `mousedown` and `mousemove` event,\n // otherwise `mousedown` should be enough for a button\n if (event.button === undefined && event.buttons === undefined) {\n // Why do we need `buttons` ?\n // Because, middle mouse sometimes have this:\n // e.button === 0 and e.buttons === 4\n // Furthermore, we want to prevent combination click, something like\n // HOLD middlemouse then left click, that would be\n // e.button === 0, e.buttons === 5\n // just `button` is not gonna work\n // Alright, then what this block does ?\n // this is for chrome `simulate mobile devices`\n // I want to support this as well\n return true;\n }\n\n if (event.button === 0 && event.buttons === undefined) {\n // Touch screen, sometimes on some specific device, `buttons`\n // doesn't have anything (safari on ios, blackberry...)\n return true;\n } // `mouseup` event on a single left click has\n // `button` and `buttons` equal to 0\n\n\n if (event.type === 'mouseup' && event.button === 0 && event.buttons === 0) {\n return true;\n }\n\n if (event.button !== 0 || event.buttons !== 1) {\n // This is the reason we have those if else block above\n // if any special case we can catch and let it slide\n // we do it above, when get to here, this definitely\n // is-not-left-click\n return false;\n }\n\n return true;\n}\n/**\n * Finds a single DOM element matching `selector` within the optional\n * `context` of another DOM element (defaulting to `document`).\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelector`.\n *\n * @param {Element|String} [context=document]\n * A DOM element within which to query. Can also be a selector\n * string in which case the first matching element will be used\n * as context. If missing (or no element matches selector), falls\n * back to `document`.\n *\n * @return {Element|null}\n * The element that was found or null.\n */\n\nvar $ = createQuerier('querySelector');\n/**\n * Finds a all DOM elements matching `selector` within the optional\n * `context` of another DOM element (defaulting to `document`).\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelectorAll`.\n *\n * @param {Element|String} [context=document]\n * A DOM element within which to query. Can also be a selector\n * string in which case the first matching element will be used\n * as context. If missing (or no element matches selector), falls\n * back to `document`.\n *\n * @return {NodeList}\n * A element list of elements that were found. Will be empty if none\n * were found.\n *\n */\n\nvar $$ = createQuerier('querySelectorAll');\n\nvar Dom = /*#__PURE__*/Object.freeze({\n __proto__: null,\n isReal: isReal,\n isEl: isEl,\n isInFrame: isInFrame,\n createEl: createEl,\n textContent: textContent,\n prependTo: prependTo,\n hasClass: hasClass,\n addClass: addClass,\n removeClass: removeClass,\n toggleClass: toggleClass,\n setAttributes: setAttributes,\n getAttributes: getAttributes,\n getAttribute: getAttribute,\n setAttribute: setAttribute,\n removeAttribute: removeAttribute,\n blockTextSelection: blockTextSelection,\n unblockTextSelection: unblockTextSelection,\n getBoundingClientRect: getBoundingClientRect,\n findPosition: findPosition,\n getPointerPosition: getPointerPosition,\n isTextNode: isTextNode,\n emptyEl: emptyEl,\n normalizeContent: normalizeContent,\n appendContent: appendContent,\n insertContent: insertContent,\n isSingleLeftClick: isSingleLeftClick,\n $: $,\n $$: $$\n});\n\n/**\n * @file setup.js - Functions for setting up a player without\n * user interaction based on the data-setup `attribute` of the video tag.\n *\n * @module setup\n */\nvar _windowLoaded = false;\nvar videojs$1;\n/**\n * Set up any tags that have a data-setup `attribute` when the player is started.\n */\n\nvar autoSetup = function autoSetup() {\n if (videojs$1.options.autoSetup === false) {\n return;\n }\n\n var vids = Array.prototype.slice.call(global_document__WEBPACK_IMPORTED_MODULE_1___default().getElementsByTagName('video'));\n var audios = Array.prototype.slice.call(global_document__WEBPACK_IMPORTED_MODULE_1___default().getElementsByTagName('audio'));\n var divs = Array.prototype.slice.call(global_document__WEBPACK_IMPORTED_MODULE_1___default().getElementsByTagName('video-js'));\n var mediaEls = vids.concat(audios, divs); // Check if any media elements exist\n\n if (mediaEls && mediaEls.length > 0) {\n for (var i = 0, e = mediaEls.length; i < e; i++) {\n var mediaEl = mediaEls[i]; // Check if element exists, has getAttribute func.\n\n if (mediaEl && mediaEl.getAttribute) {\n // Make sure this player hasn't already been set up.\n if (mediaEl.player === undefined) {\n var options = mediaEl.getAttribute('data-setup'); // Check if data-setup attr exists.\n // We only auto-setup if they've added the data-setup attr.\n\n if (options !== null) {\n // Create new video.js instance.\n videojs$1(mediaEl);\n }\n } // If getAttribute isn't defined, we need to wait for the DOM.\n\n } else {\n autoSetupTimeout(1);\n break;\n }\n } // No videos were found, so keep looping unless page is finished loading.\n\n } else if (!_windowLoaded) {\n autoSetupTimeout(1);\n }\n};\n/**\n * Wait until the page is loaded before running autoSetup. This will be called in\n * autoSetup if `hasLoaded` returns false.\n *\n * @param {number} wait\n * How long to wait in ms\n *\n * @param {module:videojs} [vjs]\n * The videojs library function\n */\n\n\nfunction autoSetupTimeout(wait, vjs) {\n // Protect against breakage in non-browser environments\n if (!isReal()) {\n return;\n }\n\n if (vjs) {\n videojs$1 = vjs;\n }\n\n global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(autoSetup, wait);\n}\n/**\n * Used to set the internal tracking of window loaded state to true.\n *\n * @private\n */\n\n\nfunction setWindowLoaded() {\n _windowLoaded = true;\n global_window__WEBPACK_IMPORTED_MODULE_0___default().removeEventListener('load', setWindowLoaded);\n}\n\nif (isReal()) {\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default().readyState) === 'complete') {\n setWindowLoaded();\n } else {\n /**\n * Listen for the load event on window, and set _windowLoaded to true.\n *\n * We use a standard event listener here to avoid incrementing the GUID\n * before any players are created.\n *\n * @listens load\n */\n global_window__WEBPACK_IMPORTED_MODULE_0___default().addEventListener('load', setWindowLoaded);\n }\n}\n\n/**\n * @file stylesheet.js\n * @module stylesheet\n */\n/**\n * Create a DOM syle element given a className for it.\n *\n * @param {string} className\n * The className to add to the created style element.\n *\n * @return {Element}\n * The element that was created.\n */\n\nvar createStyleElement = function createStyleElement(className) {\n var style = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('style');\n style.className = className;\n return style;\n};\n/**\n * Add text to a DOM element.\n *\n * @param {Element} el\n * The Element to add text content to.\n *\n * @param {string} content\n * The text to add to the element.\n */\n\nvar setTextContent = function setTextContent(el, content) {\n if (el.styleSheet) {\n el.styleSheet.cssText = content;\n } else {\n el.textContent = content;\n }\n};\n\n/**\n * @file guid.js\n * @module guid\n */\n// Default value for GUIDs. This allows us to reset the GUID counter in tests.\n//\n// The initial GUID is 3 because some users have come to rely on the first\n// default player ID ending up as `vjs_video_3`.\n//\n// See: https://github.com/videojs/video.js/pull/6216\nvar _initialGuid = 3;\n/**\n * Unique ID for an element or function\n *\n * @type {Number}\n */\n\nvar _guid = _initialGuid;\n/**\n * Get a unique auto-incrementing ID by number that has not been returned before.\n *\n * @return {number}\n * A new unique ID.\n */\n\nfunction newGUID() {\n return _guid++;\n}\n\n/**\n * @file dom-data.js\n * @module dom-data\n */\nvar FakeWeakMap;\n\nif (!(global_window__WEBPACK_IMPORTED_MODULE_0___default().WeakMap)) {\n FakeWeakMap = /*#__PURE__*/function () {\n function FakeWeakMap() {\n this.vdata = 'vdata' + Math.floor((global_window__WEBPACK_IMPORTED_MODULE_0___default().performance) && global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now() || Date.now());\n this.data = {};\n }\n\n var _proto = FakeWeakMap.prototype;\n\n _proto.set = function set(key, value) {\n var access = key[this.vdata] || newGUID();\n\n if (!key[this.vdata]) {\n key[this.vdata] = access;\n }\n\n this.data[access] = value;\n return this;\n };\n\n _proto.get = function get(key) {\n var access = key[this.vdata]; // we have data, return it\n\n if (access) {\n return this.data[access];\n } // we don't have data, return nothing.\n // return undefined explicitly as that's the contract for this method\n\n\n log$1('We have no data for this element', key);\n return undefined;\n };\n\n _proto.has = function has(key) {\n var access = key[this.vdata];\n return access in this.data;\n };\n\n _proto[\"delete\"] = function _delete(key) {\n var access = key[this.vdata];\n\n if (access) {\n delete this.data[access];\n delete key[this.vdata];\n }\n };\n\n return FakeWeakMap;\n }();\n}\n/**\n * Element Data Store.\n *\n * Allows for binding data to an element without putting it directly on the\n * element. Ex. Event listeners are stored here.\n * (also from jsninja.com, slightly modified and updated for closure compiler)\n *\n * @type {Object}\n * @private\n */\n\n\nvar DomData = (global_window__WEBPACK_IMPORTED_MODULE_0___default().WeakMap) ? new WeakMap() : new FakeWeakMap();\n\n/**\n * @file events.js. An Event System (John Resig - Secrets of a JS Ninja http://jsninja.com/)\n * (Original book version wasn't completely usable, so fixed some things and made Closure Compiler compatible)\n * This should work very similarly to jQuery's events, however it's based off the book version which isn't as\n * robust as jquery's, so there's probably some differences.\n *\n * @file events.js\n * @module events\n */\n/**\n * Clean up the listener cache and dispatchers\n *\n * @param {Element|Object} elem\n * Element to clean up\n *\n * @param {string} type\n * Type of event to clean up\n */\n\nfunction _cleanUpEvents(elem, type) {\n if (!DomData.has(elem)) {\n return;\n }\n\n var data = DomData.get(elem); // Remove the events of a particular type if there are none left\n\n if (data.handlers[type].length === 0) {\n delete data.handlers[type]; // data.handlers[type] = null;\n // Setting to null was causing an error with data.handlers\n // Remove the meta-handler from the element\n\n if (elem.removeEventListener) {\n elem.removeEventListener(type, data.dispatcher, false);\n } else if (elem.detachEvent) {\n elem.detachEvent('on' + type, data.dispatcher);\n }\n } // Remove the events object if there are no types left\n\n\n if (Object.getOwnPropertyNames(data.handlers).length <= 0) {\n delete data.handlers;\n delete data.dispatcher;\n delete data.disabled;\n } // Finally remove the element data if there is no data left\n\n\n if (Object.getOwnPropertyNames(data).length === 0) {\n DomData[\"delete\"](elem);\n }\n}\n/**\n * Loops through an array of event types and calls the requested method for each type.\n *\n * @param {Function} fn\n * The event method we want to use.\n *\n * @param {Element|Object} elem\n * Element or object to bind listeners to\n *\n * @param {string} type\n * Type of event to bind to.\n *\n * @param {EventTarget~EventListener} callback\n * Event listener.\n */\n\n\nfunction _handleMultipleEvents(fn, elem, types, callback) {\n types.forEach(function (type) {\n // Call the event method for each one of the types\n fn(elem, type, callback);\n });\n}\n/**\n * Fix a native event to have standard property values\n *\n * @param {Object} event\n * Event object to fix.\n *\n * @return {Object}\n * Fixed event object.\n */\n\n\nfunction fixEvent(event) {\n if (event.fixed_) {\n return event;\n }\n\n function returnTrue() {\n return true;\n }\n\n function returnFalse() {\n return false;\n } // Test if fixing up is needed\n // Used to check if !event.stopPropagation instead of isPropagationStopped\n // But native events return true for stopPropagation, but don't have\n // other expected methods like isPropagationStopped. Seems to be a problem\n // with the Javascript Ninja code. So we're just overriding all events now.\n\n\n if (!event || !event.isPropagationStopped || !event.isImmediatePropagationStopped) {\n var old = event || (global_window__WEBPACK_IMPORTED_MODULE_0___default().event);\n event = {}; // Clone the old object so that we can modify the values event = {};\n // IE8 Doesn't like when you mess with native event properties\n // Firefox returns false for event.hasOwnProperty('type') and other props\n // which makes copying more difficult.\n // TODO: Probably best to create a whitelist of event props\n\n for (var key in old) {\n // Safari 6.0.3 warns you if you try to copy deprecated layerX/Y\n // Chrome warns you if you try to copy deprecated keyboardEvent.keyLocation\n // and webkitMovementX/Y\n // Lighthouse complains if Event.path is copied\n if (key !== 'layerX' && key !== 'layerY' && key !== 'keyLocation' && key !== 'webkitMovementX' && key !== 'webkitMovementY' && key !== 'path') {\n // Chrome 32+ warns if you try to copy deprecated returnValue, but\n // we still want to if preventDefault isn't supported (IE8).\n if (!(key === 'returnValue' && old.preventDefault)) {\n event[key] = old[key];\n }\n }\n } // The event occurred on this element\n\n\n if (!event.target) {\n event.target = event.srcElement || (global_document__WEBPACK_IMPORTED_MODULE_1___default());\n } // Handle which other element the event is related to\n\n\n if (!event.relatedTarget) {\n event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;\n } // Stop the default browser action\n\n\n event.preventDefault = function () {\n if (old.preventDefault) {\n old.preventDefault();\n }\n\n event.returnValue = false;\n old.returnValue = false;\n event.defaultPrevented = true;\n };\n\n event.defaultPrevented = false; // Stop the event from bubbling\n\n event.stopPropagation = function () {\n if (old.stopPropagation) {\n old.stopPropagation();\n }\n\n event.cancelBubble = true;\n old.cancelBubble = true;\n event.isPropagationStopped = returnTrue;\n };\n\n event.isPropagationStopped = returnFalse; // Stop the event from bubbling and executing other handlers\n\n event.stopImmediatePropagation = function () {\n if (old.stopImmediatePropagation) {\n old.stopImmediatePropagation();\n }\n\n event.isImmediatePropagationStopped = returnTrue;\n event.stopPropagation();\n };\n\n event.isImmediatePropagationStopped = returnFalse; // Handle mouse position\n\n if (event.clientX !== null && event.clientX !== undefined) {\n var doc = (global_document__WEBPACK_IMPORTED_MODULE_1___default().documentElement);\n var body = (global_document__WEBPACK_IMPORTED_MODULE_1___default().body);\n event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);\n event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);\n } // Handle key presses\n\n\n event.which = event.charCode || event.keyCode; // Fix button for mouse clicks:\n // 0 == left; 1 == middle; 2 == right\n\n if (event.button !== null && event.button !== undefined) {\n // The following is disabled because it does not pass videojs-standard\n // and... yikes.\n\n /* eslint-disable */\n event.button = event.button & 1 ? 0 : event.button & 4 ? 1 : event.button & 2 ? 2 : 0;\n /* eslint-enable */\n }\n }\n\n event.fixed_ = true; // Returns fixed-up instance\n\n return event;\n}\n/**\n * Whether passive event listeners are supported\n */\n\nvar _supportsPassive;\n\nvar supportsPassive = function supportsPassive() {\n if (typeof _supportsPassive !== 'boolean') {\n _supportsPassive = false;\n\n try {\n var opts = Object.defineProperty({}, 'passive', {\n get: function get() {\n _supportsPassive = true;\n }\n });\n global_window__WEBPACK_IMPORTED_MODULE_0___default().addEventListener('test', null, opts);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().removeEventListener('test', null, opts);\n } catch (e) {// disregard\n }\n }\n\n return _supportsPassive;\n};\n/**\n * Touch events Chrome expects to be passive\n */\n\n\nvar passiveEvents = ['touchstart', 'touchmove'];\n/**\n * Add an event listener to element\n * It stores the handler function in a separate cache object\n * and adds a generic handler to the element's event,\n * along with a unique id (guid) to the element.\n *\n * @param {Element|Object} elem\n * Element or object to bind listeners to\n *\n * @param {string|string[]} type\n * Type of event to bind to.\n *\n * @param {EventTarget~EventListener} fn\n * Event listener.\n */\n\nfunction on(elem, type, fn) {\n if (Array.isArray(type)) {\n return _handleMultipleEvents(on, elem, type, fn);\n }\n\n if (!DomData.has(elem)) {\n DomData.set(elem, {});\n }\n\n var data = DomData.get(elem); // We need a place to store all our handler data\n\n if (!data.handlers) {\n data.handlers = {};\n }\n\n if (!data.handlers[type]) {\n data.handlers[type] = [];\n }\n\n if (!fn.guid) {\n fn.guid = newGUID();\n }\n\n data.handlers[type].push(fn);\n\n if (!data.dispatcher) {\n data.disabled = false;\n\n data.dispatcher = function (event, hash) {\n if (data.disabled) {\n return;\n }\n\n event = fixEvent(event);\n var handlers = data.handlers[event.type];\n\n if (handlers) {\n // Copy handlers so if handlers are added/removed during the process it doesn't throw everything off.\n var handlersCopy = handlers.slice(0);\n\n for (var m = 0, n = handlersCopy.length; m < n; m++) {\n if (event.isImmediatePropagationStopped()) {\n break;\n } else {\n try {\n handlersCopy[m].call(elem, event, hash);\n } catch (e) {\n log$1.error(e);\n }\n }\n }\n }\n };\n }\n\n if (data.handlers[type].length === 1) {\n if (elem.addEventListener) {\n var options = false;\n\n if (supportsPassive() && passiveEvents.indexOf(type) > -1) {\n options = {\n passive: true\n };\n }\n\n elem.addEventListener(type, data.dispatcher, options);\n } else if (elem.attachEvent) {\n elem.attachEvent('on' + type, data.dispatcher);\n }\n }\n}\n/**\n * Removes event listeners from an element\n *\n * @param {Element|Object} elem\n * Object to remove listeners from.\n *\n * @param {string|string[]} [type]\n * Type of listener to remove. Don't include to remove all events from element.\n *\n * @param {EventTarget~EventListener} [fn]\n * Specific listener to remove. Don't include to remove listeners for an event\n * type.\n */\n\nfunction off(elem, type, fn) {\n // Don't want to add a cache object through getElData if not needed\n if (!DomData.has(elem)) {\n return;\n }\n\n var data = DomData.get(elem); // If no events exist, nothing to unbind\n\n if (!data.handlers) {\n return;\n }\n\n if (Array.isArray(type)) {\n return _handleMultipleEvents(off, elem, type, fn);\n } // Utility function\n\n\n var removeType = function removeType(el, t) {\n data.handlers[t] = [];\n\n _cleanUpEvents(el, t);\n }; // Are we removing all bound events?\n\n\n if (type === undefined) {\n for (var t in data.handlers) {\n if (Object.prototype.hasOwnProperty.call(data.handlers || {}, t)) {\n removeType(elem, t);\n }\n }\n\n return;\n }\n\n var handlers = data.handlers[type]; // If no handlers exist, nothing to unbind\n\n if (!handlers) {\n return;\n } // If no listener was provided, remove all listeners for type\n\n\n if (!fn) {\n removeType(elem, type);\n return;\n } // We're only removing a single handler\n\n\n if (fn.guid) {\n for (var n = 0; n < handlers.length; n++) {\n if (handlers[n].guid === fn.guid) {\n handlers.splice(n--, 1);\n }\n }\n }\n\n _cleanUpEvents(elem, type);\n}\n/**\n * Trigger an event for an element\n *\n * @param {Element|Object} elem\n * Element to trigger an event on\n *\n * @param {EventTarget~Event|string} event\n * A string (the type) or an event object with a type attribute\n *\n * @param {Object} [hash]\n * data hash to pass along with the event\n *\n * @return {boolean|undefined}\n * Returns the opposite of `defaultPrevented` if default was\n * prevented. Otherwise, returns `undefined`\n */\n\nfunction trigger(elem, event, hash) {\n // Fetches element data and a reference to the parent (for bubbling).\n // Don't want to add a data object to cache for every parent,\n // so checking hasElData first.\n var elemData = DomData.has(elem) ? DomData.get(elem) : {};\n var parent = elem.parentNode || elem.ownerDocument; // type = event.type || event,\n // handler;\n // If an event name was passed as a string, creates an event out of it\n\n if (typeof event === 'string') {\n event = {\n type: event,\n target: elem\n };\n } else if (!event.target) {\n event.target = elem;\n } // Normalizes the event properties.\n\n\n event = fixEvent(event); // If the passed element has a dispatcher, executes the established handlers.\n\n if (elemData.dispatcher) {\n elemData.dispatcher.call(elem, event, hash);\n } // Unless explicitly stopped or the event does not bubble (e.g. media events)\n // recursively calls this function to bubble the event up the DOM.\n\n\n if (parent && !event.isPropagationStopped() && event.bubbles === true) {\n trigger.call(null, parent, event, hash); // If at the top of the DOM, triggers the default action unless disabled.\n } else if (!parent && !event.defaultPrevented && event.target && event.target[event.type]) {\n if (!DomData.has(event.target)) {\n DomData.set(event.target, {});\n }\n\n var targetData = DomData.get(event.target); // Checks if the target has a default action for this event.\n\n if (event.target[event.type]) {\n // Temporarily disables event dispatching on the target as we have already executed the handler.\n targetData.disabled = true; // Executes the default action.\n\n if (typeof event.target[event.type] === 'function') {\n event.target[event.type]();\n } // Re-enables event dispatching.\n\n\n targetData.disabled = false;\n }\n } // Inform the triggerer if the default was prevented by returning false\n\n\n return !event.defaultPrevented;\n}\n/**\n * Trigger a listener only once for an event.\n *\n * @param {Element|Object} elem\n * Element or object to bind to.\n *\n * @param {string|string[]} type\n * Name/type of event\n *\n * @param {Event~EventListener} fn\n * Event listener function\n */\n\nfunction one(elem, type, fn) {\n if (Array.isArray(type)) {\n return _handleMultipleEvents(one, elem, type, fn);\n }\n\n var func = function func() {\n off(elem, type, func);\n fn.apply(this, arguments);\n }; // copy the guid to the new function so it can removed using the original function's ID\n\n\n func.guid = fn.guid = fn.guid || newGUID();\n on(elem, type, func);\n}\n/**\n * Trigger a listener only once and then turn if off for all\n * configured events\n *\n * @param {Element|Object} elem\n * Element or object to bind to.\n *\n * @param {string|string[]} type\n * Name/type of event\n *\n * @param {Event~EventListener} fn\n * Event listener function\n */\n\nfunction any(elem, type, fn) {\n var func = function func() {\n off(elem, type, func);\n fn.apply(this, arguments);\n }; // copy the guid to the new function so it can removed using the original function's ID\n\n\n func.guid = fn.guid = fn.guid || newGUID(); // multiple ons, but one off for everything\n\n on(elem, type, func);\n}\n\nvar Events = /*#__PURE__*/Object.freeze({\n __proto__: null,\n fixEvent: fixEvent,\n on: on,\n off: off,\n trigger: trigger,\n one: one,\n any: any\n});\n\n/**\n * @file fn.js\n * @module fn\n */\nvar UPDATE_REFRESH_INTERVAL = 30;\n/**\n * Bind (a.k.a proxy or context). A simple method for changing the context of\n * a function.\n *\n * It also stores a unique id on the function so it can be easily removed from\n * events.\n *\n * @function\n * @param {Mixed} context\n * The object to bind as scope.\n *\n * @param {Function} fn\n * The function to be bound to a scope.\n *\n * @param {number} [uid]\n * An optional unique ID for the function to be set\n *\n * @return {Function}\n * The new function that will be bound into the context given\n */\n\nvar bind = function bind(context, fn, uid) {\n // Make sure the function has a unique ID\n if (!fn.guid) {\n fn.guid = newGUID();\n } // Create the new function that changes the context\n\n\n var bound = fn.bind(context); // Allow for the ability to individualize this function\n // Needed in the case where multiple objects might share the same prototype\n // IF both items add an event listener with the same function, then you try to remove just one\n // it will remove both because they both have the same guid.\n // when using this, you need to use the bind method when you remove the listener as well.\n // currently used in text tracks\n\n bound.guid = uid ? uid + '_' + fn.guid : fn.guid;\n return bound;\n};\n/**\n * Wraps the given function, `fn`, with a new function that only invokes `fn`\n * at most once per every `wait` milliseconds.\n *\n * @function\n * @param {Function} fn\n * The function to be throttled.\n *\n * @param {number} wait\n * The number of milliseconds by which to throttle.\n *\n * @return {Function}\n */\n\nvar throttle = function throttle(fn, wait) {\n var last = global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now();\n\n var throttled = function throttled() {\n var now = global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now();\n\n if (now - last >= wait) {\n fn.apply(void 0, arguments);\n last = now;\n }\n };\n\n return throttled;\n};\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked.\n *\n * Inspired by lodash and underscore implementations.\n *\n * @function\n * @param {Function} func\n * The function to wrap with debounce behavior.\n *\n * @param {number} wait\n * The number of milliseconds to wait after the last invocation.\n *\n * @param {boolean} [immediate]\n * Whether or not to invoke the function immediately upon creation.\n *\n * @param {Object} [context=window]\n * The \"context\" in which the debounced function should debounce. For\n * example, if this function should be tied to a Video.js player,\n * the player can be passed here. Alternatively, defaults to the\n * global `window` object.\n *\n * @return {Function}\n * A debounced function.\n */\n\nvar debounce = function debounce(func, wait, immediate, context) {\n if (context === void 0) {\n context = (global_window__WEBPACK_IMPORTED_MODULE_0___default());\n }\n\n var timeout;\n\n var cancel = function cancel() {\n context.clearTimeout(timeout);\n timeout = null;\n };\n /* eslint-disable consistent-this */\n\n\n var debounced = function debounced() {\n var self = this;\n var args = arguments;\n\n var _later = function later() {\n timeout = null;\n _later = null;\n\n if (!immediate) {\n func.apply(self, args);\n }\n };\n\n if (!timeout && immediate) {\n func.apply(self, args);\n }\n\n context.clearTimeout(timeout);\n timeout = context.setTimeout(_later, wait);\n };\n /* eslint-enable consistent-this */\n\n\n debounced.cancel = cancel;\n return debounced;\n};\n\n/**\n * @file src/js/event-target.js\n */\n/**\n * `EventTarget` is a class that can have the same API as the DOM `EventTarget`. It\n * adds shorthand functions that wrap around lengthy functions. For example:\n * the `on` function is a wrapper around `addEventListener`.\n *\n * @see [EventTarget Spec]{@link https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget}\n * @class EventTarget\n */\n\nvar EventTarget$2 = function EventTarget() {};\n/**\n * A Custom DOM event.\n *\n * @typedef {Object} EventTarget~Event\n * @see [Properties]{@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent}\n */\n\n/**\n * All event listeners should follow the following format.\n *\n * @callback EventTarget~EventListener\n * @this {EventTarget}\n *\n * @param {EventTarget~Event} event\n * the event that triggered this function\n *\n * @param {Object} [hash]\n * hash of data sent during the event\n */\n\n/**\n * An object containing event names as keys and booleans as values.\n *\n * > NOTE: If an event name is set to a true value here {@link EventTarget#trigger}\n * will have extra functionality. See that function for more information.\n *\n * @property EventTarget.prototype.allowedEvents_\n * @private\n */\n\n\nEventTarget$2.prototype.allowedEvents_ = {};\n/**\n * Adds an `event listener` to an instance of an `EventTarget`. An `event listener` is a\n * function that will get called when an event with a certain name gets triggered.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to call with `EventTarget`s\n */\n\nEventTarget$2.prototype.on = function (type, fn) {\n // Remove the addEventListener alias before calling Events.on\n // so we don't get into an infinite type loop\n var ael = this.addEventListener;\n\n this.addEventListener = function () {};\n\n on(this, type, fn);\n this.addEventListener = ael;\n};\n/**\n * An alias of {@link EventTarget#on}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#on}\n */\n\n\nEventTarget$2.prototype.addEventListener = EventTarget$2.prototype.on;\n/**\n * Removes an `event listener` for a specific event from an instance of `EventTarget`.\n * This makes it so that the `event listener` will no longer get called when the\n * named event happens.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to remove.\n */\n\nEventTarget$2.prototype.off = function (type, fn) {\n off(this, type, fn);\n};\n/**\n * An alias of {@link EventTarget#off}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#off}\n */\n\n\nEventTarget$2.prototype.removeEventListener = EventTarget$2.prototype.off;\n/**\n * This function will add an `event listener` that gets triggered only once. After the\n * first trigger it will get removed. This is like adding an `event listener`\n * with {@link EventTarget#on} that calls {@link EventTarget#off} on itself.\n *\n * @param {string|string[]} type\n * An event name or an array of event names.\n *\n * @param {EventTarget~EventListener} fn\n * The function to be called once for each event name.\n */\n\nEventTarget$2.prototype.one = function (type, fn) {\n // Remove the addEventListener aliasing Events.on\n // so we don't get into an infinite type loop\n var ael = this.addEventListener;\n\n this.addEventListener = function () {};\n\n one(this, type, fn);\n this.addEventListener = ael;\n};\n\nEventTarget$2.prototype.any = function (type, fn) {\n // Remove the addEventListener aliasing Events.on\n // so we don't get into an infinite type loop\n var ael = this.addEventListener;\n\n this.addEventListener = function () {};\n\n any(this, type, fn);\n this.addEventListener = ael;\n};\n/**\n * This function causes an event to happen. This will then cause any `event listeners`\n * that are waiting for that event, to get called. If there are no `event listeners`\n * for an event then nothing will happen.\n *\n * If the name of the `Event` that is being triggered is in `EventTarget.allowedEvents_`.\n * Trigger will also call the `on` + `uppercaseEventName` function.\n *\n * Example:\n * 'click' is in `EventTarget.allowedEvents_`, so, trigger will attempt to call\n * `onClick` if it exists.\n *\n * @param {string|EventTarget~Event|Object} event\n * The name of the event, an `Event`, or an object with a key of type set to\n * an event name.\n */\n\n\nEventTarget$2.prototype.trigger = function (event) {\n var type = event.type || event; // deprecation\n // In a future version we should default target to `this`\n // similar to how we default the target to `elem` in\n // `Events.trigger`. Right now the default `target` will be\n // `document` due to the `Event.fixEvent` call.\n\n if (typeof event === 'string') {\n event = {\n type: type\n };\n }\n\n event = fixEvent(event);\n\n if (this.allowedEvents_[type] && this['on' + type]) {\n this['on' + type](event);\n }\n\n trigger(this, event);\n};\n/**\n * An alias of {@link EventTarget#trigger}. Allows `EventTarget` to mimic\n * the standard DOM API.\n *\n * @function\n * @see {@link EventTarget#trigger}\n */\n\n\nEventTarget$2.prototype.dispatchEvent = EventTarget$2.prototype.trigger;\nvar EVENT_MAP;\n\nEventTarget$2.prototype.queueTrigger = function (event) {\n var _this = this;\n\n // only set up EVENT_MAP if it'll be used\n if (!EVENT_MAP) {\n EVENT_MAP = new Map();\n }\n\n var type = event.type || event;\n var map = EVENT_MAP.get(this);\n\n if (!map) {\n map = new Map();\n EVENT_MAP.set(this, map);\n }\n\n var oldTimeout = map.get(type);\n map[\"delete\"](type);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(oldTimeout);\n var timeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n map[\"delete\"](type); // if we cleared out all timeouts for the current target, delete its map\n\n if (map.size === 0) {\n map = null;\n EVENT_MAP[\"delete\"](_this);\n }\n\n _this.trigger(event);\n }, 0);\n map.set(type, timeout);\n};\n\n/**\n * @file mixins/evented.js\n * @module evented\n */\n\nvar objName = function objName(obj) {\n if (typeof obj.name === 'function') {\n return obj.name();\n }\n\n if (typeof obj.name === 'string') {\n return obj.name;\n }\n\n if (obj.name_) {\n return obj.name_;\n }\n\n if (obj.constructor && obj.constructor.name) {\n return obj.constructor.name;\n }\n\n return typeof obj;\n};\n/**\n * Returns whether or not an object has had the evented mixin applied.\n *\n * @param {Object} object\n * An object to test.\n *\n * @return {boolean}\n * Whether or not the object appears to be evented.\n */\n\n\nvar isEvented = function isEvented(object) {\n return object instanceof EventTarget$2 || !!object.eventBusEl_ && ['on', 'one', 'off', 'trigger'].every(function (k) {\n return typeof object[k] === 'function';\n });\n};\n/**\n * Adds a callback to run after the evented mixin applied.\n *\n * @param {Object} object\n * An object to Add\n * @param {Function} callback\n * The callback to run.\n */\n\n\nvar addEventedCallback = function addEventedCallback(target, callback) {\n if (isEvented(target)) {\n callback();\n } else {\n if (!target.eventedCallbacks) {\n target.eventedCallbacks = [];\n }\n\n target.eventedCallbacks.push(callback);\n }\n};\n/**\n * Whether a value is a valid event type - non-empty string or array.\n *\n * @private\n * @param {string|Array} type\n * The type value to test.\n *\n * @return {boolean}\n * Whether or not the type is a valid event type.\n */\n\n\nvar isValidEventType = function isValidEventType(type) {\n return (// The regex here verifies that the `type` contains at least one non-\n // whitespace character.\n typeof type === 'string' && /\\S/.test(type) || Array.isArray(type) && !!type.length\n );\n};\n/**\n * Validates a value to determine if it is a valid event target. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the target does not appear to be a valid event target.\n *\n * @param {Object} target\n * The object to test.\n *\n * @param {Object} obj\n * The evented object we are validating for\n *\n * @param {string} fnName\n * The name of the evented mixin function that called this.\n */\n\n\nvar validateTarget = function validateTarget(target, obj, fnName) {\n if (!target || !target.nodeName && !isEvented(target)) {\n throw new Error(\"Invalid target for \" + objName(obj) + \"#\" + fnName + \"; must be a DOM node or evented object.\");\n }\n};\n/**\n * Validates a value to determine if it is a valid event target. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the type does not appear to be a valid event type.\n *\n * @param {string|Array} type\n * The type to test.\n *\n * @param {Object} obj\n* The evented object we are validating for\n *\n * @param {string} fnName\n * The name of the evented mixin function that called this.\n */\n\n\nvar validateEventType = function validateEventType(type, obj, fnName) {\n if (!isValidEventType(type)) {\n throw new Error(\"Invalid event type for \" + objName(obj) + \"#\" + fnName + \"; must be a non-empty string or array.\");\n }\n};\n/**\n * Validates a value to determine if it is a valid listener. Throws if not.\n *\n * @private\n * @throws {Error}\n * If the listener is not a function.\n *\n * @param {Function} listener\n * The listener to test.\n *\n * @param {Object} obj\n * The evented object we are validating for\n *\n * @param {string} fnName\n * The name of the evented mixin function that called this.\n */\n\n\nvar validateListener = function validateListener(listener, obj, fnName) {\n if (typeof listener !== 'function') {\n throw new Error(\"Invalid listener for \" + objName(obj) + \"#\" + fnName + \"; must be a function.\");\n }\n};\n/**\n * Takes an array of arguments given to `on()` or `one()`, validates them, and\n * normalizes them into an object.\n *\n * @private\n * @param {Object} self\n * The evented object on which `on()` or `one()` was called. This\n * object will be bound as the `this` value for the listener.\n *\n * @param {Array} args\n * An array of arguments passed to `on()` or `one()`.\n *\n * @param {string} fnName\n * The name of the evented mixin function that called this.\n *\n * @return {Object}\n * An object containing useful values for `on()` or `one()` calls.\n */\n\n\nvar normalizeListenArgs = function normalizeListenArgs(self, args, fnName) {\n // If the number of arguments is less than 3, the target is always the\n // evented object itself.\n var isTargetingSelf = args.length < 3 || args[0] === self || args[0] === self.eventBusEl_;\n var target;\n var type;\n var listener;\n\n if (isTargetingSelf) {\n target = self.eventBusEl_; // Deal with cases where we got 3 arguments, but we are still listening to\n // the evented object itself.\n\n if (args.length >= 3) {\n args.shift();\n }\n\n type = args[0];\n listener = args[1];\n } else {\n target = args[0];\n type = args[1];\n listener = args[2];\n }\n\n validateTarget(target, self, fnName);\n validateEventType(type, self, fnName);\n validateListener(listener, self, fnName);\n listener = bind(self, listener);\n return {\n isTargetingSelf: isTargetingSelf,\n target: target,\n type: type,\n listener: listener\n };\n};\n/**\n * Adds the listener to the event type(s) on the target, normalizing for\n * the type of target.\n *\n * @private\n * @param {Element|Object} target\n * A DOM node or evented object.\n *\n * @param {string} method\n * The event binding method to use (\"on\" or \"one\").\n *\n * @param {string|Array} type\n * One or more event type(s).\n *\n * @param {Function} listener\n * A listener function.\n */\n\n\nvar listen = function listen(target, method, type, listener) {\n validateTarget(target, target, method);\n\n if (target.nodeName) {\n Events[method](target, type, listener);\n } else {\n target[method](type, listener);\n }\n};\n/**\n * Contains methods that provide event capabilities to an object which is passed\n * to {@link module:evented|evented}.\n *\n * @mixin EventedMixin\n */\n\n\nvar EventedMixin = {\n /**\n * Add a listener to an event (or events) on this object or another evented\n * object.\n *\n * @param {string|Array|Element|Object} targetOrType\n * If this is a string or array, it represents the event type(s)\n * that will trigger the listener.\n *\n * Another evented object can be passed here instead, which will\n * cause the listener to listen for events on _that_ object.\n *\n * In either case, the listener's `this` value will be bound to\n * this object.\n *\n * @param {string|Array|Function} typeOrListener\n * If the first argument was a string or array, this should be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function.\n */\n on: function on() {\n var _this = this;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var _normalizeListenArgs = normalizeListenArgs(this, args, 'on'),\n isTargetingSelf = _normalizeListenArgs.isTargetingSelf,\n target = _normalizeListenArgs.target,\n type = _normalizeListenArgs.type,\n listener = _normalizeListenArgs.listener;\n\n listen(target, 'on', type, listener); // If this object is listening to another evented object.\n\n if (!isTargetingSelf) {\n // If this object is disposed, remove the listener.\n var removeListenerOnDispose = function removeListenerOnDispose() {\n return _this.off(target, type, listener);\n }; // Use the same function ID as the listener so we can remove it later it\n // using the ID of the original listener.\n\n\n removeListenerOnDispose.guid = listener.guid; // Add a listener to the target's dispose event as well. This ensures\n // that if the target is disposed BEFORE this object, we remove the\n // removal listener that was just added. Otherwise, we create a memory leak.\n\n var removeRemoverOnTargetDispose = function removeRemoverOnTargetDispose() {\n return _this.off('dispose', removeListenerOnDispose);\n }; // Use the same function ID as the listener so we can remove it later\n // it using the ID of the original listener.\n\n\n removeRemoverOnTargetDispose.guid = listener.guid;\n listen(this, 'on', 'dispose', removeListenerOnDispose);\n listen(target, 'on', 'dispose', removeRemoverOnTargetDispose);\n }\n },\n\n /**\n * Add a listener to an event (or events) on this object or another evented\n * object. The listener will be called once per event and then removed.\n *\n * @param {string|Array|Element|Object} targetOrType\n * If this is a string or array, it represents the event type(s)\n * that will trigger the listener.\n *\n * Another evented object can be passed here instead, which will\n * cause the listener to listen for events on _that_ object.\n *\n * In either case, the listener's `this` value will be bound to\n * this object.\n *\n * @param {string|Array|Function} typeOrListener\n * If the first argument was a string or array, this should be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function.\n */\n one: function one() {\n var _this2 = this;\n\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var _normalizeListenArgs2 = normalizeListenArgs(this, args, 'one'),\n isTargetingSelf = _normalizeListenArgs2.isTargetingSelf,\n target = _normalizeListenArgs2.target,\n type = _normalizeListenArgs2.type,\n listener = _normalizeListenArgs2.listener; // Targeting this evented object.\n\n\n if (isTargetingSelf) {\n listen(target, 'one', type, listener); // Targeting another evented object.\n } else {\n // TODO: This wrapper is incorrect! It should only\n // remove the wrapper for the event type that called it.\n // Instead all listners are removed on the first trigger!\n // see https://github.com/videojs/video.js/issues/5962\n var wrapper = function wrapper() {\n _this2.off(target, type, wrapper);\n\n for (var _len3 = arguments.length, largs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n largs[_key3] = arguments[_key3];\n }\n\n listener.apply(null, largs);\n }; // Use the same function ID as the listener so we can remove it later\n // it using the ID of the original listener.\n\n\n wrapper.guid = listener.guid;\n listen(target, 'one', type, wrapper);\n }\n },\n\n /**\n * Add a listener to an event (or events) on this object or another evented\n * object. The listener will only be called once for the first event that is triggered\n * then removed.\n *\n * @param {string|Array|Element|Object} targetOrType\n * If this is a string or array, it represents the event type(s)\n * that will trigger the listener.\n *\n * Another evented object can be passed here instead, which will\n * cause the listener to listen for events on _that_ object.\n *\n * In either case, the listener's `this` value will be bound to\n * this object.\n *\n * @param {string|Array|Function} typeOrListener\n * If the first argument was a string or array, this should be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function.\n */\n any: function any() {\n var _this3 = this;\n\n for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {\n args[_key4] = arguments[_key4];\n }\n\n var _normalizeListenArgs3 = normalizeListenArgs(this, args, 'any'),\n isTargetingSelf = _normalizeListenArgs3.isTargetingSelf,\n target = _normalizeListenArgs3.target,\n type = _normalizeListenArgs3.type,\n listener = _normalizeListenArgs3.listener; // Targeting this evented object.\n\n\n if (isTargetingSelf) {\n listen(target, 'any', type, listener); // Targeting another evented object.\n } else {\n var wrapper = function wrapper() {\n _this3.off(target, type, wrapper);\n\n for (var _len5 = arguments.length, largs = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {\n largs[_key5] = arguments[_key5];\n }\n\n listener.apply(null, largs);\n }; // Use the same function ID as the listener so we can remove it later\n // it using the ID of the original listener.\n\n\n wrapper.guid = listener.guid;\n listen(target, 'any', type, wrapper);\n }\n },\n\n /**\n * Removes listener(s) from event(s) on an evented object.\n *\n * @param {string|Array|Element|Object} [targetOrType]\n * If this is a string or array, it represents the event type(s).\n *\n * Another evented object can be passed here instead, in which case\n * ALL 3 arguments are _required_.\n *\n * @param {string|Array|Function} [typeOrListener]\n * If the first argument was a string or array, this may be the\n * listener function. Otherwise, this is a string or array of event\n * type(s).\n *\n * @param {Function} [listener]\n * If the first argument was another evented object, this will be\n * the listener function; otherwise, _all_ listeners bound to the\n * event type(s) will be removed.\n */\n off: function off$1(targetOrType, typeOrListener, listener) {\n // Targeting this evented object.\n if (!targetOrType || isValidEventType(targetOrType)) {\n off(this.eventBusEl_, targetOrType, typeOrListener); // Targeting another evented object.\n } else {\n var target = targetOrType;\n var type = typeOrListener; // Fail fast and in a meaningful way!\n\n validateTarget(target, this, 'off');\n validateEventType(type, this, 'off');\n validateListener(listener, this, 'off'); // Ensure there's at least a guid, even if the function hasn't been used\n\n listener = bind(this, listener); // Remove the dispose listener on this evented object, which was given\n // the same guid as the event listener in on().\n\n this.off('dispose', listener);\n\n if (target.nodeName) {\n off(target, type, listener);\n off(target, 'dispose', listener);\n } else if (isEvented(target)) {\n target.off(type, listener);\n target.off('dispose', listener);\n }\n }\n },\n\n /**\n * Fire an event on this evented object, causing its listeners to be called.\n *\n * @param {string|Object} event\n * An event type or an object with a type property.\n *\n * @param {Object} [hash]\n * An additional object to pass along to listeners.\n *\n * @return {boolean}\n * Whether or not the default behavior was prevented.\n */\n trigger: function trigger$1(event, hash) {\n validateTarget(this.eventBusEl_, this, 'trigger');\n var type = event && typeof event !== 'string' ? event.type : event;\n\n if (!isValidEventType(type)) {\n var error = \"Invalid event type for \" + objName(this) + \"#trigger; \" + 'must be a non-empty string or object with a type key that has a non-empty value.';\n\n if (event) {\n (this.log || log$1).error(error);\n } else {\n throw new Error(error);\n }\n }\n\n return trigger(this.eventBusEl_, event, hash);\n }\n};\n/**\n * Applies {@link module:evented~EventedMixin|EventedMixin} to a target object.\n *\n * @param {Object} target\n * The object to which to add event methods.\n *\n * @param {Object} [options={}]\n * Options for customizing the mixin behavior.\n *\n * @param {string} [options.eventBusKey]\n * By default, adds a `eventBusEl_` DOM element to the target object,\n * which is used as an event bus. If the target object already has a\n * DOM element that should be used, pass its key here.\n *\n * @return {Object}\n * The target object.\n */\n\nfunction evented(target, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n eventBusKey = _options.eventBusKey; // Set or create the eventBusEl_.\n\n if (eventBusKey) {\n if (!target[eventBusKey].nodeName) {\n throw new Error(\"The eventBusKey \\\"\" + eventBusKey + \"\\\" does not refer to an element.\");\n }\n\n target.eventBusEl_ = target[eventBusKey];\n } else {\n target.eventBusEl_ = createEl('span', {\n className: 'vjs-event-bus'\n });\n }\n\n assign(target, EventedMixin);\n\n if (target.eventedCallbacks) {\n target.eventedCallbacks.forEach(function (callback) {\n callback();\n });\n } // When any evented object is disposed, it removes all its listeners.\n\n\n target.on('dispose', function () {\n target.off();\n [target, target.el_, target.eventBusEl_].forEach(function (val) {\n if (val && DomData.has(val)) {\n DomData[\"delete\"](val);\n }\n });\n global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n target.eventBusEl_ = null;\n }, 0);\n });\n return target;\n}\n\n/**\n * @file mixins/stateful.js\n * @module stateful\n */\n/**\n * Contains methods that provide statefulness to an object which is passed\n * to {@link module:stateful}.\n *\n * @mixin StatefulMixin\n */\n\nvar StatefulMixin = {\n /**\n * A hash containing arbitrary keys and values representing the state of\n * the object.\n *\n * @type {Object}\n */\n state: {},\n\n /**\n * Set the state of an object by mutating its\n * {@link module:stateful~StatefulMixin.state|state} object in place.\n *\n * @fires module:stateful~StatefulMixin#statechanged\n * @param {Object|Function} stateUpdates\n * A new set of properties to shallow-merge into the plugin state.\n * Can be a plain object or a function returning a plain object.\n *\n * @return {Object|undefined}\n * An object containing changes that occurred. If no changes\n * occurred, returns `undefined`.\n */\n setState: function setState(stateUpdates) {\n var _this = this;\n\n // Support providing the `stateUpdates` state as a function.\n if (typeof stateUpdates === 'function') {\n stateUpdates = stateUpdates();\n }\n\n var changes;\n each(stateUpdates, function (value, key) {\n // Record the change if the value is different from what's in the\n // current state.\n if (_this.state[key] !== value) {\n changes = changes || {};\n changes[key] = {\n from: _this.state[key],\n to: value\n };\n }\n\n _this.state[key] = value;\n }); // Only trigger \"statechange\" if there were changes AND we have a trigger\n // function. This allows us to not require that the target object be an\n // evented object.\n\n if (changes && isEvented(this)) {\n /**\n * An event triggered on an object that is both\n * {@link module:stateful|stateful} and {@link module:evented|evented}\n * indicating that its state has changed.\n *\n * @event module:stateful~StatefulMixin#statechanged\n * @type {Object}\n * @property {Object} changes\n * A hash containing the properties that were changed and\n * the values they were changed `from` and `to`.\n */\n this.trigger({\n changes: changes,\n type: 'statechanged'\n });\n }\n\n return changes;\n }\n};\n/**\n * Applies {@link module:stateful~StatefulMixin|StatefulMixin} to a target\n * object.\n *\n * If the target object is {@link module:evented|evented} and has a\n * `handleStateChanged` method, that method will be automatically bound to the\n * `statechanged` event on itself.\n *\n * @param {Object} target\n * The object to be made stateful.\n *\n * @param {Object} [defaultState]\n * A default set of properties to populate the newly-stateful object's\n * `state` property.\n *\n * @return {Object}\n * Returns the `target`.\n */\n\nfunction stateful(target, defaultState) {\n assign(target, StatefulMixin); // This happens after the mixing-in because we need to replace the `state`\n // added in that step.\n\n target.state = assign({}, target.state, defaultState); // Auto-bind the `handleStateChanged` method of the target object if it exists.\n\n if (typeof target.handleStateChanged === 'function' && isEvented(target)) {\n target.on('statechanged', target.handleStateChanged);\n }\n\n return target;\n}\n\n/**\n * @file string-cases.js\n * @module to-lower-case\n */\n\n/**\n * Lowercase the first letter of a string.\n *\n * @param {string} string\n * String to be lowercased\n *\n * @return {string}\n * The string with a lowercased first letter\n */\nvar toLowerCase = function toLowerCase(string) {\n if (typeof string !== 'string') {\n return string;\n }\n\n return string.replace(/./, function (w) {\n return w.toLowerCase();\n });\n};\n/**\n * Uppercase the first letter of a string.\n *\n * @param {string} string\n * String to be uppercased\n *\n * @return {string}\n * The string with an uppercased first letter\n */\n\nvar toTitleCase$1 = function toTitleCase(string) {\n if (typeof string !== 'string') {\n return string;\n }\n\n return string.replace(/./, function (w) {\n return w.toUpperCase();\n });\n};\n/**\n * Compares the TitleCase versions of the two strings for equality.\n *\n * @param {string} str1\n * The first string to compare\n *\n * @param {string} str2\n * The second string to compare\n *\n * @return {boolean}\n * Whether the TitleCase versions of the strings are equal\n */\n\nvar titleCaseEquals = function titleCaseEquals(str1, str2) {\n return toTitleCase$1(str1) === toTitleCase$1(str2);\n};\n\n/**\n * @file merge-options.js\n * @module merge-options\n */\n/**\n * Merge two objects recursively.\n *\n * Performs a deep merge like\n * {@link https://lodash.com/docs/4.17.10#merge|lodash.merge}, but only merges\n * plain objects (not arrays, elements, or anything else).\n *\n * Non-plain object values will be copied directly from the right-most\n * argument.\n *\n * @static\n * @param {Object[]} sources\n * One or more objects to merge into a new object.\n *\n * @return {Object}\n * A new object that is the merged result of all sources.\n */\n\nfunction mergeOptions$3() {\n var result = {};\n\n for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {\n sources[_key] = arguments[_key];\n }\n\n sources.forEach(function (source) {\n if (!source) {\n return;\n }\n\n each(source, function (value, key) {\n if (!isPlain(value)) {\n result[key] = value;\n return;\n }\n\n if (!isPlain(result[key])) {\n result[key] = {};\n }\n\n result[key] = mergeOptions$3(result[key], value);\n });\n });\n return result;\n}\n\nvar MapSham = /*#__PURE__*/function () {\n function MapSham() {\n this.map_ = {};\n }\n\n var _proto = MapSham.prototype;\n\n _proto.has = function has(key) {\n return key in this.map_;\n };\n\n _proto[\"delete\"] = function _delete(key) {\n var has = this.has(key);\n delete this.map_[key];\n return has;\n };\n\n _proto.set = function set(key, value) {\n this.map_[key] = value;\n return this;\n };\n\n _proto.forEach = function forEach(callback, thisArg) {\n for (var key in this.map_) {\n callback.call(thisArg, this.map_[key], key, this);\n }\n };\n\n return MapSham;\n}();\n\nvar Map$1 = (global_window__WEBPACK_IMPORTED_MODULE_0___default().Map) ? (global_window__WEBPACK_IMPORTED_MODULE_0___default().Map) : MapSham;\n\nvar SetSham = /*#__PURE__*/function () {\n function SetSham() {\n this.set_ = {};\n }\n\n var _proto = SetSham.prototype;\n\n _proto.has = function has(key) {\n return key in this.set_;\n };\n\n _proto[\"delete\"] = function _delete(key) {\n var has = this.has(key);\n delete this.set_[key];\n return has;\n };\n\n _proto.add = function add(key) {\n this.set_[key] = 1;\n return this;\n };\n\n _proto.forEach = function forEach(callback, thisArg) {\n for (var key in this.set_) {\n callback.call(thisArg, key, key, this);\n }\n };\n\n return SetSham;\n}();\n\nvar Set$1 = (global_window__WEBPACK_IMPORTED_MODULE_0___default().Set) ? (global_window__WEBPACK_IMPORTED_MODULE_0___default().Set) : SetSham;\n\n/**\n * Player Component - Base class for all UI objects\n *\n * @file component.js\n */\n/**\n * Base class for all UI Components.\n * Components are UI objects which represent both a javascript object and an element\n * in the DOM. They can be children of other components, and can have\n * children themselves.\n *\n * Components can also use methods from {@link EventTarget}\n */\n\nvar Component$1 = /*#__PURE__*/function () {\n /**\n * A callback that is called when a component is ready. Does not have any\n * paramters and any callback value will be ignored.\n *\n * @callback Component~ReadyCallback\n * @this Component\n */\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of component options.\n *\n * @param {Object[]} [options.children]\n * An array of children objects to intialize this component with. Children objects have\n * a name property that will be used if more than one component of the same type needs to be\n * added.\n *\n * @param {string} [options.className]\n * A class or space separated list of classes to add the component\n *\n * @param {Component~ReadyCallback} [ready]\n * Function that gets called when the `Component` is ready.\n */\n function Component(player, options, ready) {\n var _this = this;\n\n // The component might be the player itself and we can't pass `this` to super\n if (!player && this.play) {\n this.player_ = player = this; // eslint-disable-line\n } else {\n this.player_ = player;\n }\n\n this.isDisposed_ = false; // Hold the reference to the parent component via `addChild` method\n\n this.parentComponent_ = null; // Make a copy of prototype.options_ to protect against overriding defaults\n\n this.options_ = mergeOptions$3({}, this.options_); // Updated options with supplied options\n\n options = this.options_ = mergeOptions$3(this.options_, options); // Get ID from options or options element if one is supplied\n\n this.id_ = options.id || options.el && options.el.id; // If there was no ID from the options, generate one\n\n if (!this.id_) {\n // Don't require the player ID function in the case of mock players\n var id = player && player.id && player.id() || 'no_player';\n this.id_ = id + \"_component_\" + newGUID();\n }\n\n this.name_ = options.name || null; // Create element if one wasn't provided in options\n\n if (options.el) {\n this.el_ = options.el;\n } else if (options.createEl !== false) {\n this.el_ = this.createEl();\n }\n\n if (options.className && this.el_) {\n options.className.split(' ').forEach(function (c) {\n return _this.addClass(c);\n });\n } // if evented is anything except false, we want to mixin in evented\n\n\n if (options.evented !== false) {\n // Make this an evented object and use `el_`, if available, as its event bus\n evented(this, {\n eventBusKey: this.el_ ? 'el_' : null\n });\n this.handleLanguagechange = this.handleLanguagechange.bind(this);\n this.on(this.player_, 'languagechange', this.handleLanguagechange);\n }\n\n stateful(this, this.constructor.defaultState);\n this.children_ = [];\n this.childIndex_ = {};\n this.childNameIndex_ = {};\n this.setTimeoutIds_ = new Set$1();\n this.setIntervalIds_ = new Set$1();\n this.rafIds_ = new Set$1();\n this.namedRafs_ = new Map$1();\n this.clearingTimersOnDispose_ = false; // Add any child components in options\n\n if (options.initChildren !== false) {\n this.initChildren();\n } // Don't want to trigger ready here or it will go before init is actually\n // finished for all children that run this constructor\n\n\n this.ready(ready);\n\n if (options.reportTouchActivity !== false) {\n this.enableTouchActivity();\n }\n }\n /**\n * Dispose of the `Component` and all child components.\n *\n * @fires Component#dispose\n *\n * @param {Object} options\n * @param {Element} options.originalEl element with which to replace player element\n */\n\n\n var _proto = Component.prototype;\n\n _proto.dispose = function dispose(options) {\n if (options === void 0) {\n options = {};\n }\n\n // Bail out if the component has already been disposed.\n if (this.isDisposed_) {\n return;\n }\n\n if (this.readyQueue_) {\n this.readyQueue_.length = 0;\n }\n /**\n * Triggered when a `Component` is disposed.\n *\n * @event Component#dispose\n * @type {EventTarget~Event}\n *\n * @property {boolean} [bubbles=false]\n * set to false so that the dispose event does not\n * bubble up\n */\n\n\n this.trigger({\n type: 'dispose',\n bubbles: false\n });\n this.isDisposed_ = true; // Dispose all children.\n\n if (this.children_) {\n for (var i = this.children_.length - 1; i >= 0; i--) {\n if (this.children_[i].dispose) {\n this.children_[i].dispose();\n }\n }\n } // Delete child references\n\n\n this.children_ = null;\n this.childIndex_ = null;\n this.childNameIndex_ = null;\n this.parentComponent_ = null;\n\n if (this.el_) {\n // Remove element from DOM\n if (this.el_.parentNode) {\n if (options.restoreEl) {\n this.el_.parentNode.replaceChild(options.restoreEl, this.el_);\n } else {\n this.el_.parentNode.removeChild(this.el_);\n }\n }\n\n this.el_ = null;\n } // remove reference to the player after disposing of the element\n\n\n this.player_ = null;\n }\n /**\n * Determine whether or not this component has been disposed.\n *\n * @return {boolean}\n * If the component has been disposed, will be `true`. Otherwise, `false`.\n */\n ;\n\n _proto.isDisposed = function isDisposed() {\n return Boolean(this.isDisposed_);\n }\n /**\n * Return the {@link Player} that the `Component` has attached to.\n *\n * @return {Player}\n * The player that this `Component` has attached to.\n */\n ;\n\n _proto.player = function player() {\n return this.player_;\n }\n /**\n * Deep merge of options objects with new options.\n * > Note: When both `obj` and `options` contain properties whose values are objects.\n * The two properties get merged using {@link module:mergeOptions}\n *\n * @param {Object} obj\n * The object that contains new options.\n *\n * @return {Object}\n * A new object of `this.options_` and `obj` merged together.\n */\n ;\n\n _proto.options = function options(obj) {\n if (!obj) {\n return this.options_;\n }\n\n this.options_ = mergeOptions$3(this.options_, obj);\n return this.options_;\n }\n /**\n * Get the `Component`s DOM element\n *\n * @return {Element}\n * The DOM element for this `Component`.\n */\n ;\n\n _proto.el = function el() {\n return this.el_;\n }\n /**\n * Create the `Component`s DOM element.\n *\n * @param {string} [tagName]\n * Element's DOM node type. e.g. 'div'\n *\n * @param {Object} [properties]\n * An object of properties that should be set.\n *\n * @param {Object} [attributes]\n * An object of attributes that should be set.\n *\n * @return {Element}\n * The element that gets created.\n */\n ;\n\n _proto.createEl = function createEl$1(tagName, properties, attributes) {\n return createEl(tagName, properties, attributes);\n }\n /**\n * Localize a string given the string in english.\n *\n * If tokens are provided, it'll try and run a simple token replacement on the provided string.\n * The tokens it looks for look like `{1}` with the index being 1-indexed into the tokens array.\n *\n * If a `defaultValue` is provided, it'll use that over `string`,\n * if a value isn't found in provided language files.\n * This is useful if you want to have a descriptive key for token replacement\n * but have a succinct localized string and not require `en.json` to be included.\n *\n * Currently, it is used for the progress bar timing.\n * ```js\n * {\n * \"progress bar timing: currentTime={1} duration={2}\": \"{1} of {2}\"\n * }\n * ```\n * It is then used like so:\n * ```js\n * this.localize('progress bar timing: currentTime={1} duration{2}',\n * [this.player_.currentTime(), this.player_.duration()],\n * '{1} of {2}');\n * ```\n *\n * Which outputs something like: `01:23 of 24:56`.\n *\n *\n * @param {string} string\n * The string to localize and the key to lookup in the language files.\n * @param {string[]} [tokens]\n * If the current item has token replacements, provide the tokens here.\n * @param {string} [defaultValue]\n * Defaults to `string`. Can be a default value to use for token replacement\n * if the lookup key is needed to be separate.\n *\n * @return {string}\n * The localized string or if no localization exists the english string.\n */\n ;\n\n _proto.localize = function localize(string, tokens, defaultValue) {\n if (defaultValue === void 0) {\n defaultValue = string;\n }\n\n var code = this.player_.language && this.player_.language();\n var languages = this.player_.languages && this.player_.languages();\n var language = languages && languages[code];\n var primaryCode = code && code.split('-')[0];\n var primaryLang = languages && languages[primaryCode];\n var localizedString = defaultValue;\n\n if (language && language[string]) {\n localizedString = language[string];\n } else if (primaryLang && primaryLang[string]) {\n localizedString = primaryLang[string];\n }\n\n if (tokens) {\n localizedString = localizedString.replace(/\\{(\\d+)\\}/g, function (match, index) {\n var value = tokens[index - 1];\n var ret = value;\n\n if (typeof value === 'undefined') {\n ret = match;\n }\n\n return ret;\n });\n }\n\n return localizedString;\n }\n /**\n * Handles language change for the player in components. Should be overriden by sub-components.\n *\n * @abstract\n */\n ;\n\n _proto.handleLanguagechange = function handleLanguagechange() {}\n /**\n * Return the `Component`s DOM element. This is where children get inserted.\n * This will usually be the the same as the element returned in {@link Component#el}.\n *\n * @return {Element}\n * The content element for this `Component`.\n */\n ;\n\n _proto.contentEl = function contentEl() {\n return this.contentEl_ || this.el_;\n }\n /**\n * Get this `Component`s ID\n *\n * @return {string}\n * The id of this `Component`\n */\n ;\n\n _proto.id = function id() {\n return this.id_;\n }\n /**\n * Get the `Component`s name. The name gets used to reference the `Component`\n * and is set during registration.\n *\n * @return {string}\n * The name of this `Component`.\n */\n ;\n\n _proto.name = function name() {\n return this.name_;\n }\n /**\n * Get an array of all child components\n *\n * @return {Array}\n * The children\n */\n ;\n\n _proto.children = function children() {\n return this.children_;\n }\n /**\n * Returns the child `Component` with the given `id`.\n *\n * @param {string} id\n * The id of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The child `Component` with the given `id` or undefined.\n */\n ;\n\n _proto.getChildById = function getChildById(id) {\n return this.childIndex_[id];\n }\n /**\n * Returns the child `Component` with the given `name`.\n *\n * @param {string} name\n * The name of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The child `Component` with the given `name` or undefined.\n */\n ;\n\n _proto.getChild = function getChild(name) {\n if (!name) {\n return;\n }\n\n return this.childNameIndex_[name];\n }\n /**\n * Returns the descendant `Component` following the givent\n * descendant `names`. For instance ['foo', 'bar', 'baz'] would\n * try to get 'foo' on the current component, 'bar' on the 'foo'\n * component and 'baz' on the 'bar' component and return undefined\n * if any of those don't exist.\n *\n * @param {...string[]|...string} names\n * The name of the child `Component` to get.\n *\n * @return {Component|undefined}\n * The descendant `Component` following the given descendant\n * `names` or undefined.\n */\n ;\n\n _proto.getDescendant = function getDescendant() {\n for (var _len = arguments.length, names = new Array(_len), _key = 0; _key < _len; _key++) {\n names[_key] = arguments[_key];\n }\n\n // flatten array argument into the main array\n names = names.reduce(function (acc, n) {\n return acc.concat(n);\n }, []);\n var currentChild = this;\n\n for (var i = 0; i < names.length; i++) {\n currentChild = currentChild.getChild(names[i]);\n\n if (!currentChild || !currentChild.getChild) {\n return;\n }\n }\n\n return currentChild;\n }\n /**\n * Add a child `Component` inside the current `Component`.\n *\n *\n * @param {string|Component} child\n * The name or instance of a child to add.\n *\n * @param {Object} [options={}]\n * The key/value store of options that will get passed to children of\n * the child.\n *\n * @param {number} [index=this.children_.length]\n * The index to attempt to add a child into.\n *\n * @return {Component}\n * The `Component` that gets added as a child. When using a string the\n * `Component` will get created by this process.\n */\n ;\n\n _proto.addChild = function addChild(child, options, index) {\n if (options === void 0) {\n options = {};\n }\n\n if (index === void 0) {\n index = this.children_.length;\n }\n\n var component;\n var componentName; // If child is a string, create component with options\n\n if (typeof child === 'string') {\n componentName = toTitleCase$1(child);\n var componentClassName = options.componentClass || componentName; // Set name through options\n\n options.name = componentName; // Create a new object & element for this controls set\n // If there's no .player_, this is a player\n\n var ComponentClass = Component.getComponent(componentClassName);\n\n if (!ComponentClass) {\n throw new Error(\"Component \" + componentClassName + \" does not exist\");\n } // data stored directly on the videojs object may be\n // misidentified as a component to retain\n // backwards-compatibility with 4.x. check to make sure the\n // component class can be instantiated.\n\n\n if (typeof ComponentClass !== 'function') {\n return null;\n }\n\n component = new ComponentClass(this.player_ || this, options); // child is a component instance\n } else {\n component = child;\n }\n\n if (component.parentComponent_) {\n component.parentComponent_.removeChild(component);\n }\n\n this.children_.splice(index, 0, component);\n component.parentComponent_ = this;\n\n if (typeof component.id === 'function') {\n this.childIndex_[component.id()] = component;\n } // If a name wasn't used to create the component, check if we can use the\n // name function of the component\n\n\n componentName = componentName || component.name && toTitleCase$1(component.name());\n\n if (componentName) {\n this.childNameIndex_[componentName] = component;\n this.childNameIndex_[toLowerCase(componentName)] = component;\n } // Add the UI object's element to the container div (box)\n // Having an element is not required\n\n\n if (typeof component.el === 'function' && component.el()) {\n // If inserting before a component, insert before that component's element\n var refNode = null;\n\n if (this.children_[index + 1]) {\n // Most children are components, but the video tech is an HTML element\n if (this.children_[index + 1].el_) {\n refNode = this.children_[index + 1].el_;\n } else if (isEl(this.children_[index + 1])) {\n refNode = this.children_[index + 1];\n }\n }\n\n this.contentEl().insertBefore(component.el(), refNode);\n } // Return so it can stored on parent object if desired.\n\n\n return component;\n }\n /**\n * Remove a child `Component` from this `Component`s list of children. Also removes\n * the child `Component`s element from this `Component`s element.\n *\n * @param {Component} component\n * The child `Component` to remove.\n */\n ;\n\n _proto.removeChild = function removeChild(component) {\n if (typeof component === 'string') {\n component = this.getChild(component);\n }\n\n if (!component || !this.children_) {\n return;\n }\n\n var childFound = false;\n\n for (var i = this.children_.length - 1; i >= 0; i--) {\n if (this.children_[i] === component) {\n childFound = true;\n this.children_.splice(i, 1);\n break;\n }\n }\n\n if (!childFound) {\n return;\n }\n\n component.parentComponent_ = null;\n this.childIndex_[component.id()] = null;\n this.childNameIndex_[toTitleCase$1(component.name())] = null;\n this.childNameIndex_[toLowerCase(component.name())] = null;\n var compEl = component.el();\n\n if (compEl && compEl.parentNode === this.contentEl()) {\n this.contentEl().removeChild(component.el());\n }\n }\n /**\n * Add and initialize default child `Component`s based upon options.\n */\n ;\n\n _proto.initChildren = function initChildren() {\n var _this2 = this;\n\n var children = this.options_.children;\n\n if (children) {\n // `this` is `parent`\n var parentOptions = this.options_;\n\n var handleAdd = function handleAdd(child) {\n var name = child.name;\n var opts = child.opts; // Allow options for children to be set at the parent options\n // e.g. videojs(id, { controlBar: false });\n // instead of videojs(id, { children: { controlBar: false });\n\n if (parentOptions[name] !== undefined) {\n opts = parentOptions[name];\n } // Allow for disabling default components\n // e.g. options['children']['posterImage'] = false\n\n\n if (opts === false) {\n return;\n } // Allow options to be passed as a simple boolean if no configuration\n // is necessary.\n\n\n if (opts === true) {\n opts = {};\n } // We also want to pass the original player options\n // to each component as well so they don't need to\n // reach back into the player for options later.\n\n\n opts.playerOptions = _this2.options_.playerOptions; // Create and add the child component.\n // Add a direct reference to the child by name on the parent instance.\n // If two of the same component are used, different names should be supplied\n // for each\n\n var newChild = _this2.addChild(name, opts);\n\n if (newChild) {\n _this2[name] = newChild;\n }\n }; // Allow for an array of children details to passed in the options\n\n\n var workingChildren;\n var Tech = Component.getComponent('Tech');\n\n if (Array.isArray(children)) {\n workingChildren = children;\n } else {\n workingChildren = Object.keys(children);\n }\n\n workingChildren // children that are in this.options_ but also in workingChildren would\n // give us extra children we do not want. So, we want to filter them out.\n .concat(Object.keys(this.options_).filter(function (child) {\n return !workingChildren.some(function (wchild) {\n if (typeof wchild === 'string') {\n return child === wchild;\n }\n\n return child === wchild.name;\n });\n })).map(function (child) {\n var name;\n var opts;\n\n if (typeof child === 'string') {\n name = child;\n opts = children[name] || _this2.options_[name] || {};\n } else {\n name = child.name;\n opts = child;\n }\n\n return {\n name: name,\n opts: opts\n };\n }).filter(function (child) {\n // we have to make sure that child.name isn't in the techOrder since\n // techs are registerd as Components but can't aren't compatible\n // See https://github.com/videojs/video.js/issues/2772\n var c = Component.getComponent(child.opts.componentClass || toTitleCase$1(child.name));\n return c && !Tech.isTech(c);\n }).forEach(handleAdd);\n }\n }\n /**\n * Builds the default DOM class name. Should be overriden by sub-components.\n *\n * @return {string}\n * The DOM class name for this object.\n *\n * @abstract\n */\n ;\n\n _proto.buildCSSClass = function buildCSSClass() {\n // Child classes can include a function that does:\n // return 'CLASS NAME' + this._super();\n return '';\n }\n /**\n * Bind a listener to the component's ready state.\n * Different from event listeners in that if the ready event has already happened\n * it will trigger the function immediately.\n *\n * @return {Component}\n * Returns itself; method can be chained.\n */\n ;\n\n _proto.ready = function ready(fn, sync) {\n if (sync === void 0) {\n sync = false;\n }\n\n if (!fn) {\n return;\n }\n\n if (!this.isReady_) {\n this.readyQueue_ = this.readyQueue_ || [];\n this.readyQueue_.push(fn);\n return;\n }\n\n if (sync) {\n fn.call(this);\n } else {\n // Call the function asynchronously by default for consistency\n this.setTimeout(fn, 1);\n }\n }\n /**\n * Trigger all the ready listeners for this `Component`.\n *\n * @fires Component#ready\n */\n ;\n\n _proto.triggerReady = function triggerReady() {\n this.isReady_ = true; // Ensure ready is triggered asynchronously\n\n this.setTimeout(function () {\n var readyQueue = this.readyQueue_; // Reset Ready Queue\n\n this.readyQueue_ = [];\n\n if (readyQueue && readyQueue.length > 0) {\n readyQueue.forEach(function (fn) {\n fn.call(this);\n }, this);\n } // Allow for using event listeners also\n\n /**\n * Triggered when a `Component` is ready.\n *\n * @event Component#ready\n * @type {EventTarget~Event}\n */\n\n\n this.trigger('ready');\n }, 1);\n }\n /**\n * Find a single DOM element matching a `selector`. This can be within the `Component`s\n * `contentEl()` or another custom context.\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelector`.\n *\n * @param {Element|string} [context=this.contentEl()]\n * A DOM element within which to query. Can also be a selector string in\n * which case the first matching element will get used as context. If\n * missing `this.contentEl()` gets used. If `this.contentEl()` returns\n * nothing it falls back to `document`.\n *\n * @return {Element|null}\n * the dom element that was found, or null\n *\n * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)\n */\n ;\n\n _proto.$ = function $$1(selector, context) {\n return $(selector, context || this.contentEl());\n }\n /**\n * Finds all DOM element matching a `selector`. This can be within the `Component`s\n * `contentEl()` or another custom context.\n *\n * @param {string} selector\n * A valid CSS selector, which will be passed to `querySelectorAll`.\n *\n * @param {Element|string} [context=this.contentEl()]\n * A DOM element within which to query. Can also be a selector string in\n * which case the first matching element will get used as context. If\n * missing `this.contentEl()` gets used. If `this.contentEl()` returns\n * nothing it falls back to `document`.\n *\n * @return {NodeList}\n * a list of dom elements that were found\n *\n * @see [Information on CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_Started/Selectors)\n */\n ;\n\n _proto.$$ = function $$$1(selector, context) {\n return $$(selector, context || this.contentEl());\n }\n /**\n * Check if a component's element has a CSS class name.\n *\n * @param {string} classToCheck\n * CSS class name to check.\n *\n * @return {boolean}\n * - True if the `Component` has the class.\n * - False if the `Component` does not have the class`\n */\n ;\n\n _proto.hasClass = function hasClass$1(classToCheck) {\n return hasClass(this.el_, classToCheck);\n }\n /**\n * Add a CSS class name to the `Component`s element.\n *\n * @param {string} classToAdd\n * CSS class name to add\n */\n ;\n\n _proto.addClass = function addClass$1(classToAdd) {\n addClass(this.el_, classToAdd);\n }\n /**\n * Remove a CSS class name from the `Component`s element.\n *\n * @param {string} classToRemove\n * CSS class name to remove\n */\n ;\n\n _proto.removeClass = function removeClass$1(classToRemove) {\n removeClass(this.el_, classToRemove);\n }\n /**\n * Add or remove a CSS class name from the component's element.\n * - `classToToggle` gets added when {@link Component#hasClass} would return false.\n * - `classToToggle` gets removed when {@link Component#hasClass} would return true.\n *\n * @param {string} classToToggle\n * The class to add or remove based on (@link Component#hasClass}\n *\n * @param {boolean|Dom~predicate} [predicate]\n * An {@link Dom~predicate} function or a boolean\n */\n ;\n\n _proto.toggleClass = function toggleClass$1(classToToggle, predicate) {\n toggleClass(this.el_, classToToggle, predicate);\n }\n /**\n * Show the `Component`s element if it is hidden by removing the\n * 'vjs-hidden' class name from it.\n */\n ;\n\n _proto.show = function show() {\n this.removeClass('vjs-hidden');\n }\n /**\n * Hide the `Component`s element if it is currently showing by adding the\n * 'vjs-hidden` class name to it.\n */\n ;\n\n _proto.hide = function hide() {\n this.addClass('vjs-hidden');\n }\n /**\n * Lock a `Component`s element in its visible state by adding the 'vjs-lock-showing'\n * class name to it. Used during fadeIn/fadeOut.\n *\n * @private\n */\n ;\n\n _proto.lockShowing = function lockShowing() {\n this.addClass('vjs-lock-showing');\n }\n /**\n * Unlock a `Component`s element from its visible state by removing the 'vjs-lock-showing'\n * class name from it. Used during fadeIn/fadeOut.\n *\n * @private\n */\n ;\n\n _proto.unlockShowing = function unlockShowing() {\n this.removeClass('vjs-lock-showing');\n }\n /**\n * Get the value of an attribute on the `Component`s element.\n *\n * @param {string} attribute\n * Name of the attribute to get the value from.\n *\n * @return {string|null}\n * - The value of the attribute that was asked for.\n * - Can be an empty string on some browsers if the attribute does not exist\n * or has no value\n * - Most browsers will return null if the attibute does not exist or has\n * no value.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute}\n */\n ;\n\n _proto.getAttribute = function getAttribute$1(attribute) {\n return getAttribute(this.el_, attribute);\n }\n /**\n * Set the value of an attribute on the `Component`'s element\n *\n * @param {string} attribute\n * Name of the attribute to set.\n *\n * @param {string} value\n * Value to set the attribute to.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute}\n */\n ;\n\n _proto.setAttribute = function setAttribute$1(attribute, value) {\n setAttribute(this.el_, attribute, value);\n }\n /**\n * Remove an attribute from the `Component`s element.\n *\n * @param {string} attribute\n * Name of the attribute to remove.\n *\n * @see [DOM API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Element/removeAttribute}\n */\n ;\n\n _proto.removeAttribute = function removeAttribute$1(attribute) {\n removeAttribute(this.el_, attribute);\n }\n /**\n * Get or set the width of the component based upon the CSS styles.\n * See {@link Component#dimension} for more detailed information.\n *\n * @param {number|string} [num]\n * The width that you want to set postfixed with '%', 'px' or nothing.\n *\n * @param {boolean} [skipListeners]\n * Skip the componentresize event trigger\n *\n * @return {number|string}\n * The width when getting, zero if there is no width. Can be a string\n * postpixed with '%' or 'px'.\n */\n ;\n\n _proto.width = function width(num, skipListeners) {\n return this.dimension('width', num, skipListeners);\n }\n /**\n * Get or set the height of the component based upon the CSS styles.\n * See {@link Component#dimension} for more detailed information.\n *\n * @param {number|string} [num]\n * The height that you want to set postfixed with '%', 'px' or nothing.\n *\n * @param {boolean} [skipListeners]\n * Skip the componentresize event trigger\n *\n * @return {number|string}\n * The width when getting, zero if there is no width. Can be a string\n * postpixed with '%' or 'px'.\n */\n ;\n\n _proto.height = function height(num, skipListeners) {\n return this.dimension('height', num, skipListeners);\n }\n /**\n * Set both the width and height of the `Component` element at the same time.\n *\n * @param {number|string} width\n * Width to set the `Component`s element to.\n *\n * @param {number|string} height\n * Height to set the `Component`s element to.\n */\n ;\n\n _proto.dimensions = function dimensions(width, height) {\n // Skip componentresize listeners on width for optimization\n this.width(width, true);\n this.height(height);\n }\n /**\n * Get or set width or height of the `Component` element. This is the shared code\n * for the {@link Component#width} and {@link Component#height}.\n *\n * Things to know:\n * - If the width or height in an number this will return the number postfixed with 'px'.\n * - If the width/height is a percent this will return the percent postfixed with '%'\n * - Hidden elements have a width of 0 with `window.getComputedStyle`. This function\n * defaults to the `Component`s `style.width` and falls back to `window.getComputedStyle`.\n * See [this]{@link http://www.foliotek.com/devblog/getting-the-width-of-a-hidden-element-with-jquery-using-width/}\n * for more information\n * - If you want the computed style of the component, use {@link Component#currentWidth}\n * and {@link {Component#currentHeight}\n *\n * @fires Component#componentresize\n *\n * @param {string} widthOrHeight\n 8 'width' or 'height'\n *\n * @param {number|string} [num]\n 8 New dimension\n *\n * @param {boolean} [skipListeners]\n * Skip componentresize event trigger\n *\n * @return {number}\n * The dimension when getting or 0 if unset\n */\n ;\n\n _proto.dimension = function dimension(widthOrHeight, num, skipListeners) {\n if (num !== undefined) {\n // Set to zero if null or literally NaN (NaN !== NaN)\n if (num === null || num !== num) {\n num = 0;\n } // Check if using css width/height (% or px) and adjust\n\n\n if (('' + num).indexOf('%') !== -1 || ('' + num).indexOf('px') !== -1) {\n this.el_.style[widthOrHeight] = num;\n } else if (num === 'auto') {\n this.el_.style[widthOrHeight] = '';\n } else {\n this.el_.style[widthOrHeight] = num + 'px';\n } // skipListeners allows us to avoid triggering the resize event when setting both width and height\n\n\n if (!skipListeners) {\n /**\n * Triggered when a component is resized.\n *\n * @event Component#componentresize\n * @type {EventTarget~Event}\n */\n this.trigger('componentresize');\n }\n\n return;\n } // Not setting a value, so getting it\n // Make sure element exists\n\n\n if (!this.el_) {\n return 0;\n } // Get dimension value from style\n\n\n var val = this.el_.style[widthOrHeight];\n var pxIndex = val.indexOf('px');\n\n if (pxIndex !== -1) {\n // Return the pixel value with no 'px'\n return parseInt(val.slice(0, pxIndex), 10);\n } // No px so using % or no style was set, so falling back to offsetWidth/height\n // If component has display:none, offset will return 0\n // TODO: handle display:none and no dimension style using px\n\n\n return parseInt(this.el_['offset' + toTitleCase$1(widthOrHeight)], 10);\n }\n /**\n * Get the computed width or the height of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @param {string} widthOrHeight\n * A string containing 'width' or 'height'. Whichever one you want to get.\n *\n * @return {number}\n * The dimension that gets asked for or 0 if nothing was set\n * for that dimension.\n */\n ;\n\n _proto.currentDimension = function currentDimension(widthOrHeight) {\n var computedWidthOrHeight = 0;\n\n if (widthOrHeight !== 'width' && widthOrHeight !== 'height') {\n throw new Error('currentDimension only accepts width or height value');\n }\n\n computedWidthOrHeight = computedStyle(this.el_, widthOrHeight); // remove 'px' from variable and parse as integer\n\n computedWidthOrHeight = parseFloat(computedWidthOrHeight); // if the computed value is still 0, it's possible that the browser is lying\n // and we want to check the offset values.\n // This code also runs wherever getComputedStyle doesn't exist.\n\n if (computedWidthOrHeight === 0 || isNaN(computedWidthOrHeight)) {\n var rule = \"offset\" + toTitleCase$1(widthOrHeight);\n computedWidthOrHeight = this.el_[rule];\n }\n\n return computedWidthOrHeight;\n }\n /**\n * An object that contains width and height values of the `Component`s\n * computed style. Uses `window.getComputedStyle`.\n *\n * @typedef {Object} Component~DimensionObject\n *\n * @property {number} width\n * The width of the `Component`s computed style.\n *\n * @property {number} height\n * The height of the `Component`s computed style.\n */\n\n /**\n * Get an object that contains computed width and height values of the\n * component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {Component~DimensionObject}\n * The computed dimensions of the component's element.\n */\n ;\n\n _proto.currentDimensions = function currentDimensions() {\n return {\n width: this.currentDimension('width'),\n height: this.currentDimension('height')\n };\n }\n /**\n * Get the computed width of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {number}\n * The computed width of the component's element.\n */\n ;\n\n _proto.currentWidth = function currentWidth() {\n return this.currentDimension('width');\n }\n /**\n * Get the computed height of the component's element.\n *\n * Uses `window.getComputedStyle`.\n *\n * @return {number}\n * The computed height of the component's element.\n */\n ;\n\n _proto.currentHeight = function currentHeight() {\n return this.currentDimension('height');\n }\n /**\n * Set the focus to this component\n */\n ;\n\n _proto.focus = function focus() {\n this.el_.focus();\n }\n /**\n * Remove the focus from this component\n */\n ;\n\n _proto.blur = function blur() {\n this.el_.blur();\n }\n /**\n * When this Component receives a `keydown` event which it does not process,\n * it passes the event to the Player for handling.\n *\n * @param {EventTarget~Event} event\n * The `keydown` event that caused this function to be called.\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n if (this.player_) {\n // We only stop propagation here because we want unhandled events to fall\n // back to the browser. Exclude Tab for focus trapping.\n if (!keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Tab')) {\n event.stopPropagation();\n }\n\n this.player_.handleKeyDown(event);\n }\n }\n /**\n * Many components used to have a `handleKeyPress` method, which was poorly\n * named because it listened to a `keydown` event. This method name now\n * delegates to `handleKeyDown`. This means anyone calling `handleKeyPress`\n * will not see their method calls stop working.\n *\n * @param {EventTarget~Event} event\n * The event that caused this function to be called.\n */\n ;\n\n _proto.handleKeyPress = function handleKeyPress(event) {\n this.handleKeyDown(event);\n }\n /**\n * Emit a 'tap' events when touch event support gets detected. This gets used to\n * support toggling the controls through a tap on the video. They get enabled\n * because every sub-component would have extra overhead otherwise.\n *\n * @private\n * @fires Component#tap\n * @listens Component#touchstart\n * @listens Component#touchmove\n * @listens Component#touchleave\n * @listens Component#touchcancel\n * @listens Component#touchend\n */\n ;\n\n _proto.emitTapEvents = function emitTapEvents() {\n // Track the start time so we can determine how long the touch lasted\n var touchStart = 0;\n var firstTouch = null; // Maximum movement allowed during a touch event to still be considered a tap\n // Other popular libs use anywhere from 2 (hammer.js) to 15,\n // so 10 seems like a nice, round number.\n\n var tapMovementThreshold = 10; // The maximum length a touch can be while still being considered a tap\n\n var touchTimeThreshold = 200;\n var couldBeTap;\n this.on('touchstart', function (event) {\n // If more than one finger, don't consider treating this as a click\n if (event.touches.length === 1) {\n // Copy pageX/pageY from the object\n firstTouch = {\n pageX: event.touches[0].pageX,\n pageY: event.touches[0].pageY\n }; // Record start time so we can detect a tap vs. \"touch and hold\"\n\n touchStart = global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now(); // Reset couldBeTap tracking\n\n couldBeTap = true;\n }\n });\n this.on('touchmove', function (event) {\n // If more than one finger, don't consider treating this as a click\n if (event.touches.length > 1) {\n couldBeTap = false;\n } else if (firstTouch) {\n // Some devices will throw touchmoves for all but the slightest of taps.\n // So, if we moved only a small distance, this could still be a tap\n var xdiff = event.touches[0].pageX - firstTouch.pageX;\n var ydiff = event.touches[0].pageY - firstTouch.pageY;\n var touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);\n\n if (touchDistance > tapMovementThreshold) {\n couldBeTap = false;\n }\n }\n });\n\n var noTap = function noTap() {\n couldBeTap = false;\n }; // TODO: Listen to the original target. http://youtu.be/DujfpXOKUp8?t=13m8s\n\n\n this.on('touchleave', noTap);\n this.on('touchcancel', noTap); // When the touch ends, measure how long it took and trigger the appropriate\n // event\n\n this.on('touchend', function (event) {\n firstTouch = null; // Proceed only if the touchmove/leave/cancel event didn't happen\n\n if (couldBeTap === true) {\n // Measure how long the touch lasted\n var touchTime = global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now() - touchStart; // Make sure the touch was less than the threshold to be considered a tap\n\n if (touchTime < touchTimeThreshold) {\n // Don't let browser turn this into a click\n event.preventDefault();\n /**\n * Triggered when a `Component` is tapped.\n *\n * @event Component#tap\n * @type {EventTarget~Event}\n */\n\n this.trigger('tap'); // It may be good to copy the touchend event object and change the\n // type to tap, if the other event properties aren't exact after\n // Events.fixEvent runs (e.g. event.target)\n }\n }\n });\n }\n /**\n * This function reports user activity whenever touch events happen. This can get\n * turned off by any sub-components that wants touch events to act another way.\n *\n * Report user touch activity when touch events occur. User activity gets used to\n * determine when controls should show/hide. It is simple when it comes to mouse\n * events, because any mouse event should show the controls. So we capture mouse\n * events that bubble up to the player and report activity when that happens.\n * With touch events it isn't as easy as `touchstart` and `touchend` toggle player\n * controls. So touch events can't help us at the player level either.\n *\n * User activity gets checked asynchronously. So what could happen is a tap event\n * on the video turns the controls off. Then the `touchend` event bubbles up to\n * the player. Which, if it reported user activity, would turn the controls right\n * back on. We also don't want to completely block touch events from bubbling up.\n * Furthermore a `touchmove` event and anything other than a tap, should not turn\n * controls back on.\n *\n * @listens Component#touchstart\n * @listens Component#touchmove\n * @listens Component#touchend\n * @listens Component#touchcancel\n */\n ;\n\n _proto.enableTouchActivity = function enableTouchActivity() {\n // Don't continue if the root player doesn't support reporting user activity\n if (!this.player() || !this.player().reportUserActivity) {\n return;\n } // listener for reporting that the user is active\n\n\n var report = bind(this.player(), this.player().reportUserActivity);\n var touchHolding;\n this.on('touchstart', function () {\n report(); // For as long as the they are touching the device or have their mouse down,\n // we consider them active even if they're not moving their finger or mouse.\n // So we want to continue to update that they are active\n\n this.clearInterval(touchHolding); // report at the same interval as activityCheck\n\n touchHolding = this.setInterval(report, 250);\n });\n\n var touchEnd = function touchEnd(event) {\n report(); // stop the interval that maintains activity if the touch is holding\n\n this.clearInterval(touchHolding);\n };\n\n this.on('touchmove', report);\n this.on('touchend', touchEnd);\n this.on('touchcancel', touchEnd);\n }\n /**\n * A callback that has no parameters and is bound into `Component`s context.\n *\n * @callback Component~GenericCallback\n * @this Component\n */\n\n /**\n * Creates a function that runs after an `x` millisecond timeout. This function is a\n * wrapper around `window.setTimeout`. There are a few reasons to use this one\n * instead though:\n * 1. It gets cleared via {@link Component#clearTimeout} when\n * {@link Component#dispose} gets called.\n * 2. The function callback will gets turned into a {@link Component~GenericCallback}\n *\n * > Note: You can't use `window.clearTimeout` on the id returned by this function. This\n * will cause its dispose listener not to get cleaned up! Please use\n * {@link Component#clearTimeout} or {@link Component#dispose} instead.\n *\n * @param {Component~GenericCallback} fn\n * The function that will be run after `timeout`.\n *\n * @param {number} timeout\n * Timeout in milliseconds to delay before executing the specified function.\n *\n * @return {number}\n * Returns a timeout ID that gets used to identify the timeout. It can also\n * get used in {@link Component#clearTimeout} to clear the timeout that\n * was set.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout}\n */\n ;\n\n _proto.setTimeout = function setTimeout(fn, timeout) {\n var _this3 = this;\n\n // declare as variables so they are properly available in timeout function\n // eslint-disable-next-line\n var timeoutId;\n fn = bind(this, fn);\n this.clearTimersOnDispose_();\n timeoutId = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n if (_this3.setTimeoutIds_.has(timeoutId)) {\n _this3.setTimeoutIds_[\"delete\"](timeoutId);\n }\n\n fn();\n }, timeout);\n this.setTimeoutIds_.add(timeoutId);\n return timeoutId;\n }\n /**\n * Clears a timeout that gets created via `window.setTimeout` or\n * {@link Component#setTimeout}. If you set a timeout via {@link Component#setTimeout}\n * use this function instead of `window.clearTimout`. If you don't your dispose\n * listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} timeoutId\n * The id of the timeout to clear. The return value of\n * {@link Component#setTimeout} or `window.setTimeout`.\n *\n * @return {number}\n * Returns the timeout id that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearTimeout}\n */\n ;\n\n _proto.clearTimeout = function clearTimeout(timeoutId) {\n if (this.setTimeoutIds_.has(timeoutId)) {\n this.setTimeoutIds_[\"delete\"](timeoutId);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(timeoutId);\n }\n\n return timeoutId;\n }\n /**\n * Creates a function that gets run every `x` milliseconds. This function is a wrapper\n * around `window.setInterval`. There are a few reasons to use this one instead though.\n * 1. It gets cleared via {@link Component#clearInterval} when\n * {@link Component#dispose} gets called.\n * 2. The function callback will be a {@link Component~GenericCallback}\n *\n * @param {Component~GenericCallback} fn\n * The function to run every `x` seconds.\n *\n * @param {number} interval\n * Execute the specified function every `x` milliseconds.\n *\n * @return {number}\n * Returns an id that can be used to identify the interval. It can also be be used in\n * {@link Component#clearInterval} to clear the interval.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setInterval}\n */\n ;\n\n _proto.setInterval = function setInterval(fn, interval) {\n fn = bind(this, fn);\n this.clearTimersOnDispose_();\n var intervalId = global_window__WEBPACK_IMPORTED_MODULE_0___default().setInterval(fn, interval);\n this.setIntervalIds_.add(intervalId);\n return intervalId;\n }\n /**\n * Clears an interval that gets created via `window.setInterval` or\n * {@link Component#setInterval}. If you set an inteval via {@link Component#setInterval}\n * use this function instead of `window.clearInterval`. If you don't your dispose\n * listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} intervalId\n * The id of the interval to clear. The return value of\n * {@link Component#setInterval} or `window.setInterval`.\n *\n * @return {number}\n * Returns the interval id that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/clearInterval}\n */\n ;\n\n _proto.clearInterval = function clearInterval(intervalId) {\n if (this.setIntervalIds_.has(intervalId)) {\n this.setIntervalIds_[\"delete\"](intervalId);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearInterval(intervalId);\n }\n\n return intervalId;\n }\n /**\n * Queues up a callback to be passed to requestAnimationFrame (rAF), but\n * with a few extra bonuses:\n *\n * - Supports browsers that do not support rAF by falling back to\n * {@link Component#setTimeout}.\n *\n * - The callback is turned into a {@link Component~GenericCallback} (i.e.\n * bound to the component).\n *\n * - Automatic cancellation of the rAF callback is handled if the component\n * is disposed before it is called.\n *\n * @param {Component~GenericCallback} fn\n * A function that will be bound to this component and executed just\n * before the browser's next repaint.\n *\n * @return {number}\n * Returns an rAF ID that gets used to identify the timeout. It can\n * also be used in {@link Component#cancelAnimationFrame} to cancel\n * the animation frame callback.\n *\n * @listens Component#dispose\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame}\n */\n ;\n\n _proto.requestAnimationFrame = function requestAnimationFrame(fn) {\n var _this4 = this;\n\n // Fall back to using a timer.\n if (!this.supportsRaf_) {\n return this.setTimeout(fn, 1000 / 60);\n }\n\n this.clearTimersOnDispose_(); // declare as variables so they are properly available in rAF function\n // eslint-disable-next-line\n\n var id;\n fn = bind(this, fn);\n id = global_window__WEBPACK_IMPORTED_MODULE_0___default().requestAnimationFrame(function () {\n if (_this4.rafIds_.has(id)) {\n _this4.rafIds_[\"delete\"](id);\n }\n\n fn();\n });\n this.rafIds_.add(id);\n return id;\n }\n /**\n * Request an animation frame, but only one named animation\n * frame will be queued. Another will never be added until\n * the previous one finishes.\n *\n * @param {string} name\n * The name to give this requestAnimationFrame\n *\n * @param {Component~GenericCallback} fn\n * A function that will be bound to this component and executed just\n * before the browser's next repaint.\n */\n ;\n\n _proto.requestNamedAnimationFrame = function requestNamedAnimationFrame(name, fn) {\n var _this5 = this;\n\n if (this.namedRafs_.has(name)) {\n return;\n }\n\n this.clearTimersOnDispose_();\n fn = bind(this, fn);\n var id = this.requestAnimationFrame(function () {\n fn();\n\n if (_this5.namedRafs_.has(name)) {\n _this5.namedRafs_[\"delete\"](name);\n }\n });\n this.namedRafs_.set(name, id);\n return name;\n }\n /**\n * Cancels a current named animation frame if it exists.\n *\n * @param {string} name\n * The name of the requestAnimationFrame to cancel.\n */\n ;\n\n _proto.cancelNamedAnimationFrame = function cancelNamedAnimationFrame(name) {\n if (!this.namedRafs_.has(name)) {\n return;\n }\n\n this.cancelAnimationFrame(this.namedRafs_.get(name));\n this.namedRafs_[\"delete\"](name);\n }\n /**\n * Cancels a queued callback passed to {@link Component#requestAnimationFrame}\n * (rAF).\n *\n * If you queue an rAF callback via {@link Component#requestAnimationFrame},\n * use this function instead of `window.cancelAnimationFrame`. If you don't,\n * your dispose listener will not get cleaned up until {@link Component#dispose}!\n *\n * @param {number} id\n * The rAF ID to clear. The return value of {@link Component#requestAnimationFrame}.\n *\n * @return {number}\n * Returns the rAF ID that was cleared.\n *\n * @see [Similar to]{@link https://developer.mozilla.org/en-US/docs/Web/API/window/cancelAnimationFrame}\n */\n ;\n\n _proto.cancelAnimationFrame = function cancelAnimationFrame(id) {\n // Fall back to using a timer.\n if (!this.supportsRaf_) {\n return this.clearTimeout(id);\n }\n\n if (this.rafIds_.has(id)) {\n this.rafIds_[\"delete\"](id);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().cancelAnimationFrame(id);\n }\n\n return id;\n }\n /**\n * A function to setup `requestAnimationFrame`, `setTimeout`,\n * and `setInterval`, clearing on dispose.\n *\n * > Previously each timer added and removed dispose listeners on it's own.\n * For better performance it was decided to batch them all, and use `Set`s\n * to track outstanding timer ids.\n *\n * @private\n */\n ;\n\n _proto.clearTimersOnDispose_ = function clearTimersOnDispose_() {\n var _this6 = this;\n\n if (this.clearingTimersOnDispose_) {\n return;\n }\n\n this.clearingTimersOnDispose_ = true;\n this.one('dispose', function () {\n [['namedRafs_', 'cancelNamedAnimationFrame'], ['rafIds_', 'cancelAnimationFrame'], ['setTimeoutIds_', 'clearTimeout'], ['setIntervalIds_', 'clearInterval']].forEach(function (_ref) {\n var idName = _ref[0],\n cancelName = _ref[1];\n\n // for a `Set` key will actually be the value again\n // so forEach((val, val) =>` but for maps we want to use\n // the key.\n _this6[idName].forEach(function (val, key) {\n return _this6[cancelName](key);\n });\n });\n _this6.clearingTimersOnDispose_ = false;\n });\n }\n /**\n * Register a `Component` with `videojs` given the name and the component.\n *\n * > NOTE: {@link Tech}s should not be registered as a `Component`. {@link Tech}s\n * should be registered using {@link Tech.registerTech} or\n * {@link videojs:videojs.registerTech}.\n *\n * > NOTE: This function can also be seen on videojs as\n * {@link videojs:videojs.registerComponent}.\n *\n * @param {string} name\n * The name of the `Component` to register.\n *\n * @param {Component} ComponentToRegister\n * The `Component` class to register.\n *\n * @return {Component}\n * The `Component` that was registered.\n */\n ;\n\n Component.registerComponent = function registerComponent(name, ComponentToRegister) {\n if (typeof name !== 'string' || !name) {\n throw new Error(\"Illegal component name, \\\"\" + name + \"\\\"; must be a non-empty string.\");\n }\n\n var Tech = Component.getComponent('Tech'); // We need to make sure this check is only done if Tech has been registered.\n\n var isTech = Tech && Tech.isTech(ComponentToRegister);\n var isComp = Component === ComponentToRegister || Component.prototype.isPrototypeOf(ComponentToRegister.prototype);\n\n if (isTech || !isComp) {\n var reason;\n\n if (isTech) {\n reason = 'techs must be registered using Tech.registerTech()';\n } else {\n reason = 'must be a Component subclass';\n }\n\n throw new Error(\"Illegal component, \\\"\" + name + \"\\\"; \" + reason + \".\");\n }\n\n name = toTitleCase$1(name);\n\n if (!Component.components_) {\n Component.components_ = {};\n }\n\n var Player = Component.getComponent('Player');\n\n if (name === 'Player' && Player && Player.players) {\n var players = Player.players;\n var playerNames = Object.keys(players); // If we have players that were disposed, then their name will still be\n // in Players.players. So, we must loop through and verify that the value\n // for each item is not null. This allows registration of the Player component\n // after all players have been disposed or before any were created.\n\n if (players && playerNames.length > 0 && playerNames.map(function (pname) {\n return players[pname];\n }).every(Boolean)) {\n throw new Error('Can not register Player component after player has been created.');\n }\n }\n\n Component.components_[name] = ComponentToRegister;\n Component.components_[toLowerCase(name)] = ComponentToRegister;\n return ComponentToRegister;\n }\n /**\n * Get a `Component` based on the name it was registered with.\n *\n * @param {string} name\n * The Name of the component to get.\n *\n * @return {Component}\n * The `Component` that got registered under the given name.\n */\n ;\n\n Component.getComponent = function getComponent(name) {\n if (!name || !Component.components_) {\n return;\n }\n\n return Component.components_[name];\n };\n\n return Component;\n}();\n/**\n * Whether or not this component supports `requestAnimationFrame`.\n *\n * This is exposed primarily for testing purposes.\n *\n * @private\n * @type {Boolean}\n */\n\n\nComponent$1.prototype.supportsRaf_ = typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().requestAnimationFrame) === 'function' && typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().cancelAnimationFrame) === 'function';\nComponent$1.registerComponent('Component', Component$1);\n\n/**\n * @file time-ranges.js\n * @module time-ranges\n */\n/**\n * Returns the time for the specified index at the start or end\n * of a TimeRange object.\n *\n * @typedef {Function} TimeRangeIndex\n *\n * @param {number} [index=0]\n * The range number to return the time for.\n *\n * @return {number}\n * The time offset at the specified index.\n *\n * @deprecated The index argument must be provided.\n * In the future, leaving it out will throw an error.\n */\n\n/**\n * An object that contains ranges of time.\n *\n * @typedef {Object} TimeRange\n *\n * @property {number} length\n * The number of time ranges represented by this object.\n *\n * @property {module:time-ranges~TimeRangeIndex} start\n * Returns the time offset at which a specified time range begins.\n *\n * @property {module:time-ranges~TimeRangeIndex} end\n * Returns the time offset at which a specified time range ends.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges\n */\n\n/**\n * Check if any of the time ranges are over the maximum index.\n *\n * @private\n * @param {string} fnName\n * The function name to use for logging\n *\n * @param {number} index\n * The index to check\n *\n * @param {number} maxIndex\n * The maximum possible index\n *\n * @throws {Error} if the timeRanges provided are over the maxIndex\n */\n\nfunction rangeCheck(fnName, index, maxIndex) {\n if (typeof index !== 'number' || index < 0 || index > maxIndex) {\n throw new Error(\"Failed to execute '\" + fnName + \"' on 'TimeRanges': The index provided (\" + index + \") is non-numeric or out of bounds (0-\" + maxIndex + \").\");\n }\n}\n/**\n * Get the time for the specified index at the start or end\n * of a TimeRange object.\n *\n * @private\n * @param {string} fnName\n * The function name to use for logging\n *\n * @param {string} valueIndex\n * The property that should be used to get the time. should be\n * 'start' or 'end'\n *\n * @param {Array} ranges\n * An array of time ranges\n *\n * @param {Array} [rangeIndex=0]\n * The index to start the search at\n *\n * @return {number}\n * The time that offset at the specified index.\n *\n * @deprecated rangeIndex must be set to a value, in the future this will throw an error.\n * @throws {Error} if rangeIndex is more than the length of ranges\n */\n\n\nfunction getRange(fnName, valueIndex, ranges, rangeIndex) {\n rangeCheck(fnName, rangeIndex, ranges.length - 1);\n return ranges[rangeIndex][valueIndex];\n}\n/**\n * Create a time range object given ranges of time.\n *\n * @private\n * @param {Array} [ranges]\n * An array of time ranges.\n */\n\n\nfunction createTimeRangesObj(ranges) {\n var timeRangesObj;\n\n if (ranges === undefined || ranges.length === 0) {\n timeRangesObj = {\n length: 0,\n start: function start() {\n throw new Error('This TimeRanges object is empty');\n },\n end: function end() {\n throw new Error('This TimeRanges object is empty');\n }\n };\n } else {\n timeRangesObj = {\n length: ranges.length,\n start: getRange.bind(null, 'start', 0, ranges),\n end: getRange.bind(null, 'end', 1, ranges)\n };\n }\n\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().Symbol) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().Symbol).iterator) {\n timeRangesObj[(global_window__WEBPACK_IMPORTED_MODULE_0___default().Symbol).iterator] = function () {\n return (ranges || []).values();\n };\n }\n\n return timeRangesObj;\n}\n/**\n * Create a `TimeRange` object which mimics an\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/TimeRanges|HTML5 TimeRanges instance}.\n *\n * @param {number|Array[]} start\n * The start of a single range (a number) or an array of ranges (an\n * array of arrays of two numbers each).\n *\n * @param {number} end\n * The end of a single range. Cannot be used with the array form of\n * the `start` argument.\n */\n\n\nfunction createTimeRanges(start, end) {\n if (Array.isArray(start)) {\n return createTimeRangesObj(start);\n } else if (start === undefined || end === undefined) {\n return createTimeRangesObj();\n }\n\n return createTimeRangesObj([[start, end]]);\n}\n\n/**\n * @file buffer.js\n * @module buffer\n */\n/**\n * Compute the percentage of the media that has been buffered.\n *\n * @param {TimeRange} buffered\n * The current `TimeRange` object representing buffered time ranges\n *\n * @param {number} duration\n * Total duration of the media\n *\n * @return {number}\n * Percent buffered of the total duration in decimal form.\n */\n\nfunction bufferedPercent(buffered, duration) {\n var bufferedDuration = 0;\n var start;\n var end;\n\n if (!duration) {\n return 0;\n }\n\n if (!buffered || !buffered.length) {\n buffered = createTimeRanges(0, 0);\n }\n\n for (var i = 0; i < buffered.length; i++) {\n start = buffered.start(i);\n end = buffered.end(i); // buffered end can be bigger than duration by a very small fraction\n\n if (end > duration) {\n end = duration;\n }\n\n bufferedDuration += end - start;\n }\n\n return bufferedDuration / duration;\n}\n\n/**\n * @file media-error.js\n */\n/**\n * A Custom `MediaError` class which mimics the standard HTML5 `MediaError` class.\n *\n * @param {number|string|Object|MediaError} value\n * This can be of multiple types:\n * - number: should be a standard error code\n * - string: an error message (the code will be 0)\n * - Object: arbitrary properties\n * - `MediaError` (native): used to populate a video.js `MediaError` object\n * - `MediaError` (video.js): will return itself if it's already a\n * video.js `MediaError` object.\n *\n * @see [MediaError Spec]{@link https://dev.w3.org/html5/spec-author-view/video.html#mediaerror}\n * @see [Encrypted MediaError Spec]{@link https://www.w3.org/TR/2013/WD-encrypted-media-20130510/#error-codes}\n *\n * @class MediaError\n */\n\nfunction MediaError(value) {\n // Allow redundant calls to this constructor to avoid having `instanceof`\n // checks peppered around the code.\n if (value instanceof MediaError) {\n return value;\n }\n\n if (typeof value === 'number') {\n this.code = value;\n } else if (typeof value === 'string') {\n // default code is zero, so this is a custom error\n this.message = value;\n } else if (isObject(value)) {\n // We assign the `code` property manually because native `MediaError` objects\n // do not expose it as an own/enumerable property of the object.\n if (typeof value.code === 'number') {\n this.code = value.code;\n }\n\n assign(this, value);\n }\n\n if (!this.message) {\n this.message = MediaError.defaultMessages[this.code] || '';\n }\n}\n/**\n * The error code that refers two one of the defined `MediaError` types\n *\n * @type {Number}\n */\n\n\nMediaError.prototype.code = 0;\n/**\n * An optional message that to show with the error. Message is not part of the HTML5\n * video spec but allows for more informative custom errors.\n *\n * @type {String}\n */\n\nMediaError.prototype.message = '';\n/**\n * An optional status code that can be set by plugins to allow even more detail about\n * the error. For example a plugin might provide a specific HTTP status code and an\n * error message for that code. Then when the plugin gets that error this class will\n * know how to display an error message for it. This allows a custom message to show\n * up on the `Player` error overlay.\n *\n * @type {Array}\n */\n\nMediaError.prototype.status = null;\n/**\n * Errors indexed by the W3C standard. The order **CANNOT CHANGE**! See the\n * specification listed under {@link MediaError} for more information.\n *\n * @enum {array}\n * @readonly\n * @property {string} 0 - MEDIA_ERR_CUSTOM\n * @property {string} 1 - MEDIA_ERR_ABORTED\n * @property {string} 2 - MEDIA_ERR_NETWORK\n * @property {string} 3 - MEDIA_ERR_DECODE\n * @property {string} 4 - MEDIA_ERR_SRC_NOT_SUPPORTED\n * @property {string} 5 - MEDIA_ERR_ENCRYPTED\n */\n\nMediaError.errorTypes = ['MEDIA_ERR_CUSTOM', 'MEDIA_ERR_ABORTED', 'MEDIA_ERR_NETWORK', 'MEDIA_ERR_DECODE', 'MEDIA_ERR_SRC_NOT_SUPPORTED', 'MEDIA_ERR_ENCRYPTED'];\n/**\n * The default `MediaError` messages based on the {@link MediaError.errorTypes}.\n *\n * @type {Array}\n * @constant\n */\n\nMediaError.defaultMessages = {\n 1: 'You aborted the media playback',\n 2: 'A network error caused the media download to fail part-way.',\n 3: 'The media playback was aborted due to a corruption problem or because the media used features your browser did not support.',\n 4: 'The media could not be loaded, either because the server or network failed or because the format is not supported.',\n 5: 'The media is encrypted and we do not have the keys to decrypt it.'\n}; // Add types as properties on MediaError\n// e.g. MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = 4;\n\nfor (var errNum = 0; errNum < MediaError.errorTypes.length; errNum++) {\n MediaError[MediaError.errorTypes[errNum]] = errNum; // values should be accessible on both the class and instance\n\n MediaError.prototype[MediaError.errorTypes[errNum]] = errNum;\n} // jsdocs for instance/static members added above\n\n/**\n * Returns whether an object is `Promise`-like (i.e. has a `then` method).\n *\n * @param {Object} value\n * An object that may or may not be `Promise`-like.\n *\n * @return {boolean}\n * Whether or not the object is `Promise`-like.\n */\nfunction isPromise(value) {\n return value !== undefined && value !== null && typeof value.then === 'function';\n}\n/**\n * Silence a Promise-like object.\n *\n * This is useful for avoiding non-harmful, but potentially confusing \"uncaught\n * play promise\" rejection error messages.\n *\n * @param {Object} value\n * An object that may or may not be `Promise`-like.\n */\n\nfunction silencePromise(value) {\n if (isPromise(value)) {\n value.then(null, function (e) {});\n }\n}\n\n/**\n * @file text-track-list-converter.js Utilities for capturing text track state and\n * re-creating tracks based on a capture.\n *\n * @module text-track-list-converter\n */\n\n/**\n * Examine a single {@link TextTrack} and return a JSON-compatible javascript object that\n * represents the {@link TextTrack}'s state.\n *\n * @param {TextTrack} track\n * The text track to query.\n *\n * @return {Object}\n * A serializable javascript representation of the TextTrack.\n * @private\n */\nvar trackToJson_ = function trackToJson_(track) {\n var ret = ['kind', 'label', 'language', 'id', 'inBandMetadataTrackDispatchType', 'mode', 'src'].reduce(function (acc, prop, i) {\n if (track[prop]) {\n acc[prop] = track[prop];\n }\n\n return acc;\n }, {\n cues: track.cues && Array.prototype.map.call(track.cues, function (cue) {\n return {\n startTime: cue.startTime,\n endTime: cue.endTime,\n text: cue.text,\n id: cue.id\n };\n })\n });\n return ret;\n};\n/**\n * Examine a {@link Tech} and return a JSON-compatible javascript array that represents the\n * state of all {@link TextTrack}s currently configured. The return array is compatible with\n * {@link text-track-list-converter:jsonToTextTracks}.\n *\n * @param {Tech} tech\n * The tech object to query\n *\n * @return {Array}\n * A serializable javascript representation of the {@link Tech}s\n * {@link TextTrackList}.\n */\n\n\nvar textTracksToJson = function textTracksToJson(tech) {\n var trackEls = tech.$$('track');\n var trackObjs = Array.prototype.map.call(trackEls, function (t) {\n return t.track;\n });\n var tracks = Array.prototype.map.call(trackEls, function (trackEl) {\n var json = trackToJson_(trackEl.track);\n\n if (trackEl.src) {\n json.src = trackEl.src;\n }\n\n return json;\n });\n return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function (track) {\n return trackObjs.indexOf(track) === -1;\n }).map(trackToJson_));\n};\n/**\n * Create a set of remote {@link TextTrack}s on a {@link Tech} based on an array of javascript\n * object {@link TextTrack} representations.\n *\n * @param {Array} json\n * An array of `TextTrack` representation objects, like those that would be\n * produced by `textTracksToJson`.\n *\n * @param {Tech} tech\n * The `Tech` to create the `TextTrack`s on.\n */\n\n\nvar jsonToTextTracks = function jsonToTextTracks(json, tech) {\n json.forEach(function (track) {\n var addedTrack = tech.addRemoteTextTrack(track).track;\n\n if (!track.src && track.cues) {\n track.cues.forEach(function (cue) {\n return addedTrack.addCue(cue);\n });\n }\n });\n return tech.textTracks();\n};\n\nvar textTrackConverter = {\n textTracksToJson: textTracksToJson,\n jsonToTextTracks: jsonToTextTracks,\n trackToJson_: trackToJson_\n};\n\nvar MODAL_CLASS_NAME = 'vjs-modal-dialog';\n/**\n * The `ModalDialog` displays over the video and its controls, which blocks\n * interaction with the player until it is closed.\n *\n * Modal dialogs include a \"Close\" button and will close when that button\n * is activated - or when ESC is pressed anywhere.\n *\n * @extends Component\n */\n\nvar ModalDialog = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(ModalDialog, _Component);\n\n /**\n * Create an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Mixed} [options.content=undefined]\n * Provide customized content for this modal.\n *\n * @param {string} [options.description]\n * A text description for the modal, primarily for accessibility.\n *\n * @param {boolean} [options.fillAlways=false]\n * Normally, modals are automatically filled only the first time\n * they open. This tells the modal to refresh its content\n * every time it opens.\n *\n * @param {string} [options.label]\n * A text label for the modal, primarily for accessibility.\n *\n * @param {boolean} [options.pauseOnOpen=true]\n * If `true`, playback will will be paused if playing when\n * the modal opens, and resumed when it closes.\n *\n * @param {boolean} [options.temporary=true]\n * If `true`, the modal can only be opened once; it will be\n * disposed as soon as it's closed.\n *\n * @param {boolean} [options.uncloseable=false]\n * If `true`, the user will not be able to close the modal\n * through the UI in the normal ways. Programmatic closing is\n * still possible.\n */\n function ModalDialog(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n\n _this.handleKeyDown_ = function (e) {\n return _this.handleKeyDown(e);\n };\n\n _this.close_ = function (e) {\n return _this.close(e);\n };\n\n _this.opened_ = _this.hasBeenOpened_ = _this.hasBeenFilled_ = false;\n\n _this.closeable(!_this.options_.uncloseable);\n\n _this.content(_this.options_.content); // Make sure the contentEl is defined AFTER any children are initialized\n // because we only want the contents of the modal in the contentEl\n // (not the UI elements like the close button).\n\n\n _this.contentEl_ = createEl('div', {\n className: MODAL_CLASS_NAME + \"-content\"\n }, {\n role: 'document'\n });\n _this.descEl_ = createEl('p', {\n className: MODAL_CLASS_NAME + \"-description vjs-control-text\",\n id: _this.el().getAttribute('aria-describedby')\n });\n textContent(_this.descEl_, _this.description());\n\n _this.el_.appendChild(_this.descEl_);\n\n _this.el_.appendChild(_this.contentEl_);\n\n return _this;\n }\n /**\n * Create the `ModalDialog`'s DOM element\n *\n * @return {Element}\n * The DOM element that gets created.\n */\n\n\n var _proto = ModalDialog.prototype;\n\n _proto.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: this.buildCSSClass(),\n tabIndex: -1\n }, {\n 'aria-describedby': this.id() + \"_description\",\n 'aria-hidden': 'true',\n 'aria-label': this.label(),\n 'role': 'dialog'\n });\n };\n\n _proto.dispose = function dispose() {\n this.contentEl_ = null;\n this.descEl_ = null;\n this.previouslyActiveEl_ = null;\n\n _Component.prototype.dispose.call(this);\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n ;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return MODAL_CLASS_NAME + \" vjs-hidden \" + _Component.prototype.buildCSSClass.call(this);\n }\n /**\n * Returns the label string for this modal. Primarily used for accessibility.\n *\n * @return {string}\n * the localized or raw label of this modal.\n */\n ;\n\n _proto.label = function label() {\n return this.localize(this.options_.label || 'Modal Window');\n }\n /**\n * Returns the description string for this modal. Primarily used for\n * accessibility.\n *\n * @return {string}\n * The localized or raw description of this modal.\n */\n ;\n\n _proto.description = function description() {\n var desc = this.options_.description || this.localize('This is a modal window.'); // Append a universal closeability message if the modal is closeable.\n\n if (this.closeable()) {\n desc += ' ' + this.localize('This modal can be closed by pressing the Escape key or activating the close button.');\n }\n\n return desc;\n }\n /**\n * Opens the modal.\n *\n * @fires ModalDialog#beforemodalopen\n * @fires ModalDialog#modalopen\n */\n ;\n\n _proto.open = function open() {\n if (!this.opened_) {\n var player = this.player();\n /**\n * Fired just before a `ModalDialog` is opened.\n *\n * @event ModalDialog#beforemodalopen\n * @type {EventTarget~Event}\n */\n\n this.trigger('beforemodalopen');\n this.opened_ = true; // Fill content if the modal has never opened before and\n // never been filled.\n\n if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {\n this.fill();\n } // If the player was playing, pause it and take note of its previously\n // playing state.\n\n\n this.wasPlaying_ = !player.paused();\n\n if (this.options_.pauseOnOpen && this.wasPlaying_) {\n player.pause();\n }\n\n this.on('keydown', this.handleKeyDown_); // Hide controls and note if they were enabled.\n\n this.hadControls_ = player.controls();\n player.controls(false);\n this.show();\n this.conditionalFocus_();\n this.el().setAttribute('aria-hidden', 'false');\n /**\n * Fired just after a `ModalDialog` is opened.\n *\n * @event ModalDialog#modalopen\n * @type {EventTarget~Event}\n */\n\n this.trigger('modalopen');\n this.hasBeenOpened_ = true;\n }\n }\n /**\n * If the `ModalDialog` is currently open or closed.\n *\n * @param {boolean} [value]\n * If given, it will open (`true`) or close (`false`) the modal.\n *\n * @return {boolean}\n * the current open state of the modaldialog\n */\n ;\n\n _proto.opened = function opened(value) {\n if (typeof value === 'boolean') {\n this[value ? 'open' : 'close']();\n }\n\n return this.opened_;\n }\n /**\n * Closes the modal, does nothing if the `ModalDialog` is\n * not open.\n *\n * @fires ModalDialog#beforemodalclose\n * @fires ModalDialog#modalclose\n */\n ;\n\n _proto.close = function close() {\n if (!this.opened_) {\n return;\n }\n\n var player = this.player();\n /**\n * Fired just before a `ModalDialog` is closed.\n *\n * @event ModalDialog#beforemodalclose\n * @type {EventTarget~Event}\n */\n\n this.trigger('beforemodalclose');\n this.opened_ = false;\n\n if (this.wasPlaying_ && this.options_.pauseOnOpen) {\n player.play();\n }\n\n this.off('keydown', this.handleKeyDown_);\n\n if (this.hadControls_) {\n player.controls(true);\n }\n\n this.hide();\n this.el().setAttribute('aria-hidden', 'true');\n /**\n * Fired just after a `ModalDialog` is closed.\n *\n * @event ModalDialog#modalclose\n * @type {EventTarget~Event}\n */\n\n this.trigger('modalclose');\n this.conditionalBlur_();\n\n if (this.options_.temporary) {\n this.dispose();\n }\n }\n /**\n * Check to see if the `ModalDialog` is closeable via the UI.\n *\n * @param {boolean} [value]\n * If given as a boolean, it will set the `closeable` option.\n *\n * @return {boolean}\n * Returns the final value of the closable option.\n */\n ;\n\n _proto.closeable = function closeable(value) {\n if (typeof value === 'boolean') {\n var closeable = this.closeable_ = !!value;\n var close = this.getChild('closeButton'); // If this is being made closeable and has no close button, add one.\n\n if (closeable && !close) {\n // The close button should be a child of the modal - not its\n // content element, so temporarily change the content element.\n var temp = this.contentEl_;\n this.contentEl_ = this.el_;\n close = this.addChild('closeButton', {\n controlText: 'Close Modal Dialog'\n });\n this.contentEl_ = temp;\n this.on(close, 'close', this.close_);\n } // If this is being made uncloseable and has a close button, remove it.\n\n\n if (!closeable && close) {\n this.off(close, 'close', this.close_);\n this.removeChild(close);\n close.dispose();\n }\n }\n\n return this.closeable_;\n }\n /**\n * Fill the modal's content element with the modal's \"content\" option.\n * The content element will be emptied before this change takes place.\n */\n ;\n\n _proto.fill = function fill() {\n this.fillWith(this.content());\n }\n /**\n * Fill the modal's content element with arbitrary content.\n * The content element will be emptied before this change takes place.\n *\n * @fires ModalDialog#beforemodalfill\n * @fires ModalDialog#modalfill\n *\n * @param {Mixed} [content]\n * The same rules apply to this as apply to the `content` option.\n */\n ;\n\n _proto.fillWith = function fillWith(content) {\n var contentEl = this.contentEl();\n var parentEl = contentEl.parentNode;\n var nextSiblingEl = contentEl.nextSibling;\n /**\n * Fired just before a `ModalDialog` is filled with content.\n *\n * @event ModalDialog#beforemodalfill\n * @type {EventTarget~Event}\n */\n\n this.trigger('beforemodalfill');\n this.hasBeenFilled_ = true; // Detach the content element from the DOM before performing\n // manipulation to avoid modifying the live DOM multiple times.\n\n parentEl.removeChild(contentEl);\n this.empty();\n insertContent(contentEl, content);\n /**\n * Fired just after a `ModalDialog` is filled with content.\n *\n * @event ModalDialog#modalfill\n * @type {EventTarget~Event}\n */\n\n this.trigger('modalfill'); // Re-inject the re-filled content element.\n\n if (nextSiblingEl) {\n parentEl.insertBefore(contentEl, nextSiblingEl);\n } else {\n parentEl.appendChild(contentEl);\n } // make sure that the close button is last in the dialog DOM\n\n\n var closeButton = this.getChild('closeButton');\n\n if (closeButton) {\n parentEl.appendChild(closeButton.el_);\n }\n }\n /**\n * Empties the content element. This happens anytime the modal is filled.\n *\n * @fires ModalDialog#beforemodalempty\n * @fires ModalDialog#modalempty\n */\n ;\n\n _proto.empty = function empty() {\n /**\n * Fired just before a `ModalDialog` is emptied.\n *\n * @event ModalDialog#beforemodalempty\n * @type {EventTarget~Event}\n */\n this.trigger('beforemodalempty');\n emptyEl(this.contentEl());\n /**\n * Fired just after a `ModalDialog` is emptied.\n *\n * @event ModalDialog#modalempty\n * @type {EventTarget~Event}\n */\n\n this.trigger('modalempty');\n }\n /**\n * Gets or sets the modal content, which gets normalized before being\n * rendered into the DOM.\n *\n * This does not update the DOM or fill the modal, but it is called during\n * that process.\n *\n * @param {Mixed} [value]\n * If defined, sets the internal content value to be used on the\n * next call(s) to `fill`. This value is normalized before being\n * inserted. To \"clear\" the internal content value, pass `null`.\n *\n * @return {Mixed}\n * The current content of the modal dialog\n */\n ;\n\n _proto.content = function content(value) {\n if (typeof value !== 'undefined') {\n this.content_ = value;\n }\n\n return this.content_;\n }\n /**\n * conditionally focus the modal dialog if focus was previously on the player.\n *\n * @private\n */\n ;\n\n _proto.conditionalFocus_ = function conditionalFocus_() {\n var activeEl = (global_document__WEBPACK_IMPORTED_MODULE_1___default().activeElement);\n var playerEl = this.player_.el_;\n this.previouslyActiveEl_ = null;\n\n if (playerEl.contains(activeEl) || playerEl === activeEl) {\n this.previouslyActiveEl_ = activeEl;\n this.focus();\n }\n }\n /**\n * conditionally blur the element and refocus the last focused element\n *\n * @private\n */\n ;\n\n _proto.conditionalBlur_ = function conditionalBlur_() {\n if (this.previouslyActiveEl_) {\n this.previouslyActiveEl_.focus();\n this.previouslyActiveEl_ = null;\n }\n }\n /**\n * Keydown handler. Attached when modal is focused.\n *\n * @listens keydown\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n // Do not allow keydowns to reach out of the modal dialog.\n event.stopPropagation();\n\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Escape') && this.closeable()) {\n event.preventDefault();\n this.close();\n return;\n } // exit early if it isn't a tab key\n\n\n if (!keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Tab')) {\n return;\n }\n\n var focusableEls = this.focusableEls_();\n var activeEl = this.el_.querySelector(':focus');\n var focusIndex;\n\n for (var i = 0; i < focusableEls.length; i++) {\n if (activeEl === focusableEls[i]) {\n focusIndex = i;\n break;\n }\n }\n\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default().activeElement) === this.el_) {\n focusIndex = 0;\n }\n\n if (event.shiftKey && focusIndex === 0) {\n focusableEls[focusableEls.length - 1].focus();\n event.preventDefault();\n } else if (!event.shiftKey && focusIndex === focusableEls.length - 1) {\n focusableEls[0].focus();\n event.preventDefault();\n }\n }\n /**\n * get all focusable elements\n *\n * @private\n */\n ;\n\n _proto.focusableEls_ = function focusableEls_() {\n var allChildren = this.el_.querySelectorAll('*');\n return Array.prototype.filter.call(allChildren, function (child) {\n return (child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLAnchorElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLAreaElement)) && child.hasAttribute('href') || (child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLInputElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLSelectElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLTextAreaElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLButtonElement)) && !child.hasAttribute('disabled') || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLIFrameElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLObjectElement) || child instanceof (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLEmbedElement) || child.hasAttribute('tabindex') && child.getAttribute('tabindex') !== -1 || child.hasAttribute('contenteditable');\n });\n };\n\n return ModalDialog;\n}(Component$1);\n/**\n * Default options for `ModalDialog` default options.\n *\n * @type {Object}\n * @private\n */\n\n\nModalDialog.prototype.options_ = {\n pauseOnOpen: true,\n temporary: true\n};\nComponent$1.registerComponent('ModalDialog', ModalDialog);\n\n/**\n * Common functionaliy between {@link TextTrackList}, {@link AudioTrackList}, and\n * {@link VideoTrackList}\n *\n * @extends EventTarget\n */\n\nvar TrackList = /*#__PURE__*/function (_EventTarget) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TrackList, _EventTarget);\n\n /**\n * Create an instance of this class\n *\n * @param {Track[]} tracks\n * A list of tracks to initialize the list with.\n *\n * @abstract\n */\n function TrackList(tracks) {\n var _this;\n\n if (tracks === void 0) {\n tracks = [];\n }\n\n _this = _EventTarget.call(this) || this;\n _this.tracks_ = [];\n /**\n * @memberof TrackList\n * @member {number} length\n * The current number of `Track`s in the this Trackist.\n * @instance\n */\n\n Object.defineProperty((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), 'length', {\n get: function get() {\n return this.tracks_.length;\n }\n });\n\n for (var i = 0; i < tracks.length; i++) {\n _this.addTrack(tracks[i]);\n }\n\n return _this;\n }\n /**\n * Add a {@link Track} to the `TrackList`\n *\n * @param {Track} track\n * The audio, video, or text track to add to the list.\n *\n * @fires TrackList#addtrack\n */\n\n\n var _proto = TrackList.prototype;\n\n _proto.addTrack = function addTrack(track) {\n var _this2 = this;\n\n var index = this.tracks_.length;\n\n if (!('' + index in this)) {\n Object.defineProperty(this, index, {\n get: function get() {\n return this.tracks_[index];\n }\n });\n } // Do not add duplicate tracks\n\n\n if (this.tracks_.indexOf(track) === -1) {\n this.tracks_.push(track);\n /**\n * Triggered when a track is added to a track list.\n *\n * @event TrackList#addtrack\n * @type {EventTarget~Event}\n * @property {Track} track\n * A reference to track that was added.\n */\n\n this.trigger({\n track: track,\n type: 'addtrack',\n target: this\n });\n }\n /**\n * Triggered when a track label is changed.\n *\n * @event TrackList#addtrack\n * @type {EventTarget~Event}\n * @property {Track} track\n * A reference to track that was added.\n */\n\n\n track.labelchange_ = function () {\n _this2.trigger({\n track: track,\n type: 'labelchange',\n target: _this2\n });\n };\n\n if (isEvented(track)) {\n track.addEventListener('labelchange', track.labelchange_);\n }\n }\n /**\n * Remove a {@link Track} from the `TrackList`\n *\n * @param {Track} rtrack\n * The audio, video, or text track to remove from the list.\n *\n * @fires TrackList#removetrack\n */\n ;\n\n _proto.removeTrack = function removeTrack(rtrack) {\n var track;\n\n for (var i = 0, l = this.length; i < l; i++) {\n if (this[i] === rtrack) {\n track = this[i];\n\n if (track.off) {\n track.off();\n }\n\n this.tracks_.splice(i, 1);\n break;\n }\n }\n\n if (!track) {\n return;\n }\n /**\n * Triggered when a track is removed from track list.\n *\n * @event TrackList#removetrack\n * @type {EventTarget~Event}\n * @property {Track} track\n * A reference to track that was removed.\n */\n\n\n this.trigger({\n track: track,\n type: 'removetrack',\n target: this\n });\n }\n /**\n * Get a Track from the TrackList by a tracks id\n *\n * @param {string} id - the id of the track to get\n * @method getTrackById\n * @return {Track}\n * @private\n */\n ;\n\n _proto.getTrackById = function getTrackById(id) {\n var result = null;\n\n for (var i = 0, l = this.length; i < l; i++) {\n var track = this[i];\n\n if (track.id === id) {\n result = track;\n break;\n }\n }\n\n return result;\n };\n\n return TrackList;\n}(EventTarget$2);\n/**\n * Triggered when a different track is selected/enabled.\n *\n * @event TrackList#change\n * @type {EventTarget~Event}\n */\n\n/**\n * Events that can be called with on + eventName. See {@link EventHandler}.\n *\n * @property {Object} TrackList#allowedEvents_\n * @private\n */\n\n\nTrackList.prototype.allowedEvents_ = {\n change: 'change',\n addtrack: 'addtrack',\n removetrack: 'removetrack',\n labelchange: 'labelchange'\n}; // emulate attribute EventHandler support to allow for feature detection\n\nfor (var event in TrackList.prototype.allowedEvents_) {\n TrackList.prototype['on' + event] = null;\n}\n\n/**\n * Anywhere we call this function we diverge from the spec\n * as we only support one enabled audiotrack at a time\n *\n * @param {AudioTrackList} list\n * list to work on\n *\n * @param {AudioTrack} track\n * The track to skip\n *\n * @private\n */\n\nvar disableOthers$1 = function disableOthers(list, track) {\n for (var i = 0; i < list.length; i++) {\n if (!Object.keys(list[i]).length || track.id === list[i].id) {\n continue;\n } // another audio track is enabled, disable it\n\n\n list[i].enabled = false;\n }\n};\n/**\n * The current list of {@link AudioTrack} for a media file.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist}\n * @extends TrackList\n */\n\n\nvar AudioTrackList = /*#__PURE__*/function (_TrackList) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(AudioTrackList, _TrackList);\n\n /**\n * Create an instance of this class.\n *\n * @param {AudioTrack[]} [tracks=[]]\n * A list of `AudioTrack` to instantiate the list with.\n */\n function AudioTrackList(tracks) {\n var _this;\n\n if (tracks === void 0) {\n tracks = [];\n }\n\n // make sure only 1 track is enabled\n // sorted from last index to first index\n for (var i = tracks.length - 1; i >= 0; i--) {\n if (tracks[i].enabled) {\n disableOthers$1(tracks, tracks[i]);\n break;\n }\n }\n\n _this = _TrackList.call(this, tracks) || this;\n _this.changing_ = false;\n return _this;\n }\n /**\n * Add an {@link AudioTrack} to the `AudioTrackList`.\n *\n * @param {AudioTrack} track\n * The AudioTrack to add to the list\n *\n * @fires TrackList#addtrack\n */\n\n\n var _proto = AudioTrackList.prototype;\n\n _proto.addTrack = function addTrack(track) {\n var _this2 = this;\n\n if (track.enabled) {\n disableOthers$1(this, track);\n }\n\n _TrackList.prototype.addTrack.call(this, track); // native tracks don't have this\n\n\n if (!track.addEventListener) {\n return;\n }\n\n track.enabledChange_ = function () {\n // when we are disabling other tracks (since we don't support\n // more than one track at a time) we will set changing_\n // to true so that we don't trigger additional change events\n if (_this2.changing_) {\n return;\n }\n\n _this2.changing_ = true;\n disableOthers$1(_this2, track);\n _this2.changing_ = false;\n\n _this2.trigger('change');\n };\n /**\n * @listens AudioTrack#enabledchange\n * @fires TrackList#change\n */\n\n\n track.addEventListener('enabledchange', track.enabledChange_);\n };\n\n _proto.removeTrack = function removeTrack(rtrack) {\n _TrackList.prototype.removeTrack.call(this, rtrack);\n\n if (rtrack.removeEventListener && rtrack.enabledChange_) {\n rtrack.removeEventListener('enabledchange', rtrack.enabledChange_);\n rtrack.enabledChange_ = null;\n }\n };\n\n return AudioTrackList;\n}(TrackList);\n\n/**\n * Un-select all other {@link VideoTrack}s that are selected.\n *\n * @param {VideoTrackList} list\n * list to work on\n *\n * @param {VideoTrack} track\n * The track to skip\n *\n * @private\n */\n\nvar disableOthers = function disableOthers(list, track) {\n for (var i = 0; i < list.length; i++) {\n if (!Object.keys(list[i]).length || track.id === list[i].id) {\n continue;\n } // another video track is enabled, disable it\n\n\n list[i].selected = false;\n }\n};\n/**\n * The current list of {@link VideoTrack} for a video.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist}\n * @extends TrackList\n */\n\n\nvar VideoTrackList = /*#__PURE__*/function (_TrackList) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(VideoTrackList, _TrackList);\n\n /**\n * Create an instance of this class.\n *\n * @param {VideoTrack[]} [tracks=[]]\n * A list of `VideoTrack` to instantiate the list with.\n */\n function VideoTrackList(tracks) {\n var _this;\n\n if (tracks === void 0) {\n tracks = [];\n }\n\n // make sure only 1 track is enabled\n // sorted from last index to first index\n for (var i = tracks.length - 1; i >= 0; i--) {\n if (tracks[i].selected) {\n disableOthers(tracks, tracks[i]);\n break;\n }\n }\n\n _this = _TrackList.call(this, tracks) || this;\n _this.changing_ = false;\n /**\n * @member {number} VideoTrackList#selectedIndex\n * The current index of the selected {@link VideoTrack`}.\n */\n\n Object.defineProperty((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), 'selectedIndex', {\n get: function get() {\n for (var _i = 0; _i < this.length; _i++) {\n if (this[_i].selected) {\n return _i;\n }\n }\n\n return -1;\n },\n set: function set() {}\n });\n return _this;\n }\n /**\n * Add a {@link VideoTrack} to the `VideoTrackList`.\n *\n * @param {VideoTrack} track\n * The VideoTrack to add to the list\n *\n * @fires TrackList#addtrack\n */\n\n\n var _proto = VideoTrackList.prototype;\n\n _proto.addTrack = function addTrack(track) {\n var _this2 = this;\n\n if (track.selected) {\n disableOthers(this, track);\n }\n\n _TrackList.prototype.addTrack.call(this, track); // native tracks don't have this\n\n\n if (!track.addEventListener) {\n return;\n }\n\n track.selectedChange_ = function () {\n if (_this2.changing_) {\n return;\n }\n\n _this2.changing_ = true;\n disableOthers(_this2, track);\n _this2.changing_ = false;\n\n _this2.trigger('change');\n };\n /**\n * @listens VideoTrack#selectedchange\n * @fires TrackList#change\n */\n\n\n track.addEventListener('selectedchange', track.selectedChange_);\n };\n\n _proto.removeTrack = function removeTrack(rtrack) {\n _TrackList.prototype.removeTrack.call(this, rtrack);\n\n if (rtrack.removeEventListener && rtrack.selectedChange_) {\n rtrack.removeEventListener('selectedchange', rtrack.selectedChange_);\n rtrack.selectedChange_ = null;\n }\n };\n\n return VideoTrackList;\n}(TrackList);\n\n/**\n * The current list of {@link TextTrack} for a media file.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttracklist}\n * @extends TrackList\n */\n\nvar TextTrackList = /*#__PURE__*/function (_TrackList) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TextTrackList, _TrackList);\n\n function TextTrackList() {\n return _TrackList.apply(this, arguments) || this;\n }\n\n var _proto = TextTrackList.prototype;\n\n /**\n * Add a {@link TextTrack} to the `TextTrackList`\n *\n * @param {TextTrack} track\n * The text track to add to the list.\n *\n * @fires TrackList#addtrack\n */\n _proto.addTrack = function addTrack(track) {\n var _this = this;\n\n _TrackList.prototype.addTrack.call(this, track);\n\n if (!this.queueChange_) {\n this.queueChange_ = function () {\n return _this.queueTrigger('change');\n };\n }\n\n if (!this.triggerSelectedlanguagechange) {\n this.triggerSelectedlanguagechange_ = function () {\n return _this.trigger('selectedlanguagechange');\n };\n }\n /**\n * @listens TextTrack#modechange\n * @fires TrackList#change\n */\n\n\n track.addEventListener('modechange', this.queueChange_);\n var nonLanguageTextTrackKind = ['metadata', 'chapters'];\n\n if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) {\n track.addEventListener('modechange', this.triggerSelectedlanguagechange_);\n }\n };\n\n _proto.removeTrack = function removeTrack(rtrack) {\n _TrackList.prototype.removeTrack.call(this, rtrack); // manually remove the event handlers we added\n\n\n if (rtrack.removeEventListener) {\n if (this.queueChange_) {\n rtrack.removeEventListener('modechange', this.queueChange_);\n }\n\n if (this.selectedlanguagechange_) {\n rtrack.removeEventListener('modechange', this.triggerSelectedlanguagechange_);\n }\n }\n };\n\n return TextTrackList;\n}(TrackList);\n\n/**\n * @file html-track-element-list.js\n */\n\n/**\n * The current list of {@link HtmlTrackElement}s.\n */\nvar HtmlTrackElementList = /*#__PURE__*/function () {\n /**\n * Create an instance of this class.\n *\n * @param {HtmlTrackElement[]} [tracks=[]]\n * A list of `HtmlTrackElement` to instantiate the list with.\n */\n function HtmlTrackElementList(trackElements) {\n if (trackElements === void 0) {\n trackElements = [];\n }\n\n this.trackElements_ = [];\n /**\n * @memberof HtmlTrackElementList\n * @member {number} length\n * The current number of `Track`s in the this Trackist.\n * @instance\n */\n\n Object.defineProperty(this, 'length', {\n get: function get() {\n return this.trackElements_.length;\n }\n });\n\n for (var i = 0, length = trackElements.length; i < length; i++) {\n this.addTrackElement_(trackElements[i]);\n }\n }\n /**\n * Add an {@link HtmlTrackElement} to the `HtmlTrackElementList`\n *\n * @param {HtmlTrackElement} trackElement\n * The track element to add to the list.\n *\n * @private\n */\n\n\n var _proto = HtmlTrackElementList.prototype;\n\n _proto.addTrackElement_ = function addTrackElement_(trackElement) {\n var index = this.trackElements_.length;\n\n if (!('' + index in this)) {\n Object.defineProperty(this, index, {\n get: function get() {\n return this.trackElements_[index];\n }\n });\n } // Do not add duplicate elements\n\n\n if (this.trackElements_.indexOf(trackElement) === -1) {\n this.trackElements_.push(trackElement);\n }\n }\n /**\n * Get an {@link HtmlTrackElement} from the `HtmlTrackElementList` given an\n * {@link TextTrack}.\n *\n * @param {TextTrack} track\n * The track associated with a track element.\n *\n * @return {HtmlTrackElement|undefined}\n * The track element that was found or undefined.\n *\n * @private\n */\n ;\n\n _proto.getTrackElementByTrack_ = function getTrackElementByTrack_(track) {\n var trackElement_;\n\n for (var i = 0, length = this.trackElements_.length; i < length; i++) {\n if (track === this.trackElements_[i].track) {\n trackElement_ = this.trackElements_[i];\n break;\n }\n }\n\n return trackElement_;\n }\n /**\n * Remove a {@link HtmlTrackElement} from the `HtmlTrackElementList`\n *\n * @param {HtmlTrackElement} trackElement\n * The track element to remove from the list.\n *\n * @private\n */\n ;\n\n _proto.removeTrackElement_ = function removeTrackElement_(trackElement) {\n for (var i = 0, length = this.trackElements_.length; i < length; i++) {\n if (trackElement === this.trackElements_[i]) {\n if (this.trackElements_[i].track && typeof this.trackElements_[i].track.off === 'function') {\n this.trackElements_[i].track.off();\n }\n\n if (typeof this.trackElements_[i].off === 'function') {\n this.trackElements_[i].off();\n }\n\n this.trackElements_.splice(i, 1);\n break;\n }\n }\n };\n\n return HtmlTrackElementList;\n}();\n\n/**\n * @file text-track-cue-list.js\n */\n\n/**\n * @typedef {Object} TextTrackCueList~TextTrackCue\n *\n * @property {string} id\n * The unique id for this text track cue\n *\n * @property {number} startTime\n * The start time for this text track cue\n *\n * @property {number} endTime\n * The end time for this text track cue\n *\n * @property {boolean} pauseOnExit\n * Pause when the end time is reached if true.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcue}\n */\n\n/**\n * A List of TextTrackCues.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackcuelist}\n */\nvar TextTrackCueList = /*#__PURE__*/function () {\n /**\n * Create an instance of this class..\n *\n * @param {Array} cues\n * A list of cues to be initialized with\n */\n function TextTrackCueList(cues) {\n TextTrackCueList.prototype.setCues_.call(this, cues);\n /**\n * @memberof TextTrackCueList\n * @member {number} length\n * The current number of `TextTrackCue`s in the TextTrackCueList.\n * @instance\n */\n\n Object.defineProperty(this, 'length', {\n get: function get() {\n return this.length_;\n }\n });\n }\n /**\n * A setter for cues in this list. Creates getters\n * an an index for the cues.\n *\n * @param {Array} cues\n * An array of cues to set\n *\n * @private\n */\n\n\n var _proto = TextTrackCueList.prototype;\n\n _proto.setCues_ = function setCues_(cues) {\n var oldLength = this.length || 0;\n var i = 0;\n var l = cues.length;\n this.cues_ = cues;\n this.length_ = cues.length;\n\n var defineProp = function defineProp(index) {\n if (!('' + index in this)) {\n Object.defineProperty(this, '' + index, {\n get: function get() {\n return this.cues_[index];\n }\n });\n }\n };\n\n if (oldLength < l) {\n i = oldLength;\n\n for (; i < l; i++) {\n defineProp.call(this, i);\n }\n }\n }\n /**\n * Get a `TextTrackCue` that is currently in the `TextTrackCueList` by id.\n *\n * @param {string} id\n * The id of the cue that should be searched for.\n *\n * @return {TextTrackCueList~TextTrackCue|null}\n * A single cue or null if none was found.\n */\n ;\n\n _proto.getCueById = function getCueById(id) {\n var result = null;\n\n for (var i = 0, l = this.length; i < l; i++) {\n var cue = this[i];\n\n if (cue.id === id) {\n result = cue;\n break;\n }\n }\n\n return result;\n };\n\n return TextTrackCueList;\n}();\n\n/**\n * @file track-kinds.js\n */\n\n/**\n * All possible `VideoTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-videotrack-kind\n * @typedef VideoTrack~Kind\n * @enum\n */\nvar VideoTrackKind = {\n alternative: 'alternative',\n captions: 'captions',\n main: 'main',\n sign: 'sign',\n subtitles: 'subtitles',\n commentary: 'commentary'\n};\n/**\n * All possible `AudioTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-audiotrack-kind\n * @typedef AudioTrack~Kind\n * @enum\n */\n\nvar AudioTrackKind = {\n 'alternative': 'alternative',\n 'descriptions': 'descriptions',\n 'main': 'main',\n 'main-desc': 'main-desc',\n 'translation': 'translation',\n 'commentary': 'commentary'\n};\n/**\n * All possible `TextTrackKind`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-kind\n * @typedef TextTrack~Kind\n * @enum\n */\n\nvar TextTrackKind = {\n subtitles: 'subtitles',\n captions: 'captions',\n descriptions: 'descriptions',\n chapters: 'chapters',\n metadata: 'metadata'\n};\n/**\n * All possible `TextTrackMode`s\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#texttrackmode\n * @typedef TextTrack~Mode\n * @enum\n */\n\nvar TextTrackMode = {\n disabled: 'disabled',\n hidden: 'hidden',\n showing: 'showing'\n};\n\n/**\n * A Track class that contains all of the common functionality for {@link AudioTrack},\n * {@link VideoTrack}, and {@link TextTrack}.\n *\n * > Note: This class should not be used directly\n *\n * @see {@link https://html.spec.whatwg.org/multipage/embedded-content.html}\n * @extends EventTarget\n * @abstract\n */\n\nvar Track = /*#__PURE__*/function (_EventTarget) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(Track, _EventTarget);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {string} [options.kind='']\n * A valid kind for the track type you are creating.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @abstract\n */\n function Track(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _EventTarget.call(this) || this;\n var trackProps = {\n id: options.id || 'vjs_track_' + newGUID(),\n kind: options.kind || '',\n language: options.language || ''\n };\n var label = options.label || '';\n /**\n * @memberof Track\n * @member {string} id\n * The id of this track. Cannot be changed after creation.\n * @instance\n *\n * @readonly\n */\n\n /**\n * @memberof Track\n * @member {string} kind\n * The kind of track that this is. Cannot be changed after creation.\n * @instance\n *\n * @readonly\n */\n\n /**\n * @memberof Track\n * @member {string} language\n * The two letter language code for this track. Cannot be changed after\n * creation.\n * @instance\n *\n * @readonly\n */\n\n var _loop = function _loop(key) {\n Object.defineProperty((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), key, {\n get: function get() {\n return trackProps[key];\n },\n set: function set() {}\n });\n };\n\n for (var key in trackProps) {\n _loop(key);\n }\n /**\n * @memberof Track\n * @member {string} label\n * The label of this track. Cannot be changed after creation.\n * @instance\n *\n * @fires Track#labelchange\n */\n\n\n Object.defineProperty((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), 'label', {\n get: function get() {\n return label;\n },\n set: function set(newLabel) {\n if (newLabel !== label) {\n label = newLabel;\n /**\n * An event that fires when label changes on this track.\n *\n * > Note: This is not part of the spec!\n *\n * @event Track#labelchange\n * @type {EventTarget~Event}\n */\n\n this.trigger('labelchange');\n }\n }\n });\n return _this;\n }\n\n return Track;\n}(EventTarget$2);\n\n/**\n * @file url.js\n * @module url\n */\n/**\n * @typedef {Object} url:URLObject\n *\n * @property {string} protocol\n * The protocol of the url that was parsed.\n *\n * @property {string} hostname\n * The hostname of the url that was parsed.\n *\n * @property {string} port\n * The port of the url that was parsed.\n *\n * @property {string} pathname\n * The pathname of the url that was parsed.\n *\n * @property {string} search\n * The search query of the url that was parsed.\n *\n * @property {string} hash\n * The hash of the url that was parsed.\n *\n * @property {string} host\n * The host of the url that was parsed.\n */\n\n/**\n * Resolve and parse the elements of a URL.\n *\n * @function\n * @param {String} url\n * The url to parse\n *\n * @return {url:URLObject}\n * An object of url details\n */\n\nvar parseUrl = function parseUrl(url) {\n // This entire method can be replace with URL once we are able to drop IE11\n var props = ['protocol', 'hostname', 'port', 'pathname', 'search', 'hash', 'host']; // add the url to an anchor and let the browser parse the URL\n\n var a = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('a');\n a.href = url; // Copy the specific URL properties to a new object\n // This is also needed for IE because the anchor loses its\n // properties when it's removed from the dom\n\n var details = {};\n\n for (var i = 0; i < props.length; i++) {\n details[props[i]] = a[props[i]];\n } // IE adds the port to the host property unlike everyone else. If\n // a port identifier is added for standard ports, strip it.\n\n\n if (details.protocol === 'http:') {\n details.host = details.host.replace(/:80$/, '');\n }\n\n if (details.protocol === 'https:') {\n details.host = details.host.replace(/:443$/, '');\n }\n\n if (!details.protocol) {\n details.protocol = (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).protocol;\n }\n /* istanbul ignore if */\n\n\n if (!details.host) {\n details.host = (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).host;\n }\n\n return details;\n};\n/**\n * Get absolute version of relative URL. Used to tell Flash the correct URL.\n *\n * @function\n * @param {string} url\n * URL to make absolute\n *\n * @return {string}\n * Absolute URL\n *\n * @see http://stackoverflow.com/questions/470832/getting-an-absolute-url-from-a-relative-one-ie6-issue\n */\n\nvar getAbsoluteURL = function getAbsoluteURL(url) {\n // Check if absolute URL\n if (!url.match(/^https?:\\/\\//)) {\n // Convert to absolute URL. Flash hosted off-site needs an absolute URL.\n // add the url to an anchor and let the browser parse the URL\n var a = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('a');\n a.href = url;\n url = a.href;\n }\n\n return url;\n};\n/**\n * Returns the extension of the passed file name. It will return an empty string\n * if passed an invalid path.\n *\n * @function\n * @param {string} path\n * The fileName path like '/path/to/file.mp4'\n *\n * @return {string}\n * The extension in lower case or an empty string if no\n * extension could be found.\n */\n\nvar getFileExtension = function getFileExtension(path) {\n if (typeof path === 'string') {\n var splitPathRe = /^(\\/?)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?)(\\.([^\\.\\/\\?]+)))(?:[\\/]*|[\\?].*)$/;\n var pathParts = splitPathRe.exec(path);\n\n if (pathParts) {\n return pathParts.pop().toLowerCase();\n }\n }\n\n return '';\n};\n/**\n * Returns whether the url passed is a cross domain request or not.\n *\n * @function\n * @param {string} url\n * The url to check.\n *\n * @param {Object} [winLoc]\n * the domain to check the url against, defaults to window.location\n *\n * @param {string} [winLoc.protocol]\n * The window location protocol defaults to window.location.protocol\n *\n * @param {string} [winLoc.host]\n * The window location host defaults to window.location.host\n *\n * @return {boolean}\n * Whether it is a cross domain request or not.\n */\n\nvar isCrossOrigin = function isCrossOrigin(url, winLoc) {\n if (winLoc === void 0) {\n winLoc = (global_window__WEBPACK_IMPORTED_MODULE_0___default().location);\n }\n\n var urlInfo = parseUrl(url); // IE8 protocol relative urls will return ':' for protocol\n\n var srcProtocol = urlInfo.protocol === ':' ? winLoc.protocol : urlInfo.protocol; // Check if url is for another domain/origin\n // IE8 doesn't know location.origin, so we won't rely on it here\n\n var crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;\n return crossOrigin;\n};\n\nvar Url = /*#__PURE__*/Object.freeze({\n __proto__: null,\n parseUrl: parseUrl,\n getAbsoluteURL: getAbsoluteURL,\n getFileExtension: getFileExtension,\n isCrossOrigin: isCrossOrigin\n});\n\n/**\n * Takes a webvtt file contents and parses it into cues\n *\n * @param {string} srcContent\n * webVTT file contents\n *\n * @param {TextTrack} track\n * TextTrack to add cues to. Cues come from the srcContent.\n *\n * @private\n */\n\nvar parseCues = function parseCues(srcContent, track) {\n var parser = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT).Parser((global_window__WEBPACK_IMPORTED_MODULE_0___default()), (global_window__WEBPACK_IMPORTED_MODULE_0___default().vttjs), global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT.StringDecoder());\n var errors = [];\n\n parser.oncue = function (cue) {\n track.addCue(cue);\n };\n\n parser.onparsingerror = function (error) {\n errors.push(error);\n };\n\n parser.onflush = function () {\n track.trigger({\n type: 'loadeddata',\n target: track\n });\n };\n\n parser.parse(srcContent);\n\n if (errors.length > 0) {\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().console) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().console).groupCollapsed) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().console.groupCollapsed(\"Text Track parsing errors for \" + track.src);\n }\n\n errors.forEach(function (error) {\n return log$1.error(error);\n });\n\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().console) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().console).groupEnd) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().console.groupEnd();\n }\n }\n\n parser.flush();\n};\n/**\n * Load a `TextTrack` from a specified url.\n *\n * @param {string} src\n * Url to load track from.\n *\n * @param {TextTrack} track\n * Track to add cues to. Comes from the content at the end of `url`.\n *\n * @private\n */\n\n\nvar loadTrack = function loadTrack(src, track) {\n var opts = {\n uri: src\n };\n var crossOrigin = isCrossOrigin(src);\n\n if (crossOrigin) {\n opts.cors = crossOrigin;\n }\n\n var withCredentials = track.tech_.crossOrigin() === 'use-credentials';\n\n if (withCredentials) {\n opts.withCredentials = withCredentials;\n }\n\n _videojs_xhr__WEBPACK_IMPORTED_MODULE_7___default()(opts, bind(this, function (err, response, responseBody) {\n if (err) {\n return log$1.error(err, response);\n }\n\n track.loaded_ = true; // Make sure that vttjs has loaded, otherwise, wait till it finished loading\n // NOTE: this is only used for the alt/video.novtt.js build\n\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) !== 'function') {\n if (track.tech_) {\n // to prevent use before define eslint error, we define loadHandler\n // as a let here\n track.tech_.any(['vttjsloaded', 'vttjserror'], function (event) {\n if (event.type === 'vttjserror') {\n log$1.error(\"vttjs failed to load, stopping trying to process \" + track.src);\n return;\n }\n\n return parseCues(responseBody, track);\n });\n }\n } else {\n parseCues(responseBody, track);\n }\n }));\n};\n/**\n * A representation of a single `TextTrack`.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#texttrack}\n * @extends Track\n */\n\n\nvar TextTrack = /*#__PURE__*/function (_Track) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TextTrack, _Track);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} options={}\n * Object of option names and values\n *\n * @param {Tech} options.tech\n * A reference to the tech that owns this TextTrack.\n *\n * @param {TextTrack~Kind} [options.kind='subtitles']\n * A valid text track kind.\n *\n * @param {TextTrack~Mode} [options.mode='disabled']\n * A valid text track mode.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this TextTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {string} [options.srclang='']\n * A valid two character language code. An alternative, but deprioritized\n * version of `options.language`\n *\n * @param {string} [options.src]\n * A url to TextTrack cues.\n *\n * @param {boolean} [options.default]\n * If this track should default to on or off.\n */\n function TextTrack(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n if (!options.tech) {\n throw new Error('A tech was not provided.');\n }\n\n var settings = mergeOptions$3(options, {\n kind: TextTrackKind[options.kind] || 'subtitles',\n language: options.language || options.srclang || ''\n });\n var mode = TextTrackMode[settings.mode] || 'disabled';\n var default_ = settings[\"default\"];\n\n if (settings.kind === 'metadata' || settings.kind === 'chapters') {\n mode = 'hidden';\n }\n\n _this = _Track.call(this, settings) || this;\n _this.tech_ = settings.tech;\n _this.cues_ = [];\n _this.activeCues_ = [];\n _this.preload_ = _this.tech_.preloadTextTracks !== false;\n var cues = new TextTrackCueList(_this.cues_);\n var activeCues = new TextTrackCueList(_this.activeCues_);\n var changed = false;\n _this.timeupdateHandler = bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), function (event) {\n if (event === void 0) {\n event = {};\n }\n\n if (this.tech_.isDisposed()) {\n return;\n }\n\n if (!this.tech_.isReady_) {\n if (event.type !== 'timeupdate') {\n this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);\n }\n\n return;\n } // Accessing this.activeCues for the side-effects of updating itself\n // due to its nature as a getter function. Do not remove or cues will\n // stop updating!\n // Use the setter to prevent deletion from uglify (pure_getters rule)\n\n\n this.activeCues = this.activeCues;\n\n if (changed) {\n this.trigger('cuechange');\n changed = false;\n }\n\n if (event.type !== 'timeupdate') {\n this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);\n }\n });\n\n var disposeHandler = function disposeHandler() {\n _this.stopTracking();\n };\n\n _this.tech_.one('dispose', disposeHandler);\n\n if (mode !== 'disabled') {\n _this.startTracking();\n }\n\n Object.defineProperties((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), {\n /**\n * @memberof TextTrack\n * @member {boolean} default\n * If this track was set to be on or off by default. Cannot be changed after\n * creation.\n * @instance\n *\n * @readonly\n */\n \"default\": {\n get: function get() {\n return default_;\n },\n set: function set() {}\n },\n\n /**\n * @memberof TextTrack\n * @member {string} mode\n * Set the mode of this TextTrack to a valid {@link TextTrack~Mode}. Will\n * not be set if setting to an invalid mode.\n * @instance\n *\n * @fires TextTrack#modechange\n */\n mode: {\n get: function get() {\n return mode;\n },\n set: function set(newMode) {\n if (!TextTrackMode[newMode]) {\n return;\n }\n\n if (mode === newMode) {\n return;\n }\n\n mode = newMode;\n\n if (!this.preload_ && mode !== 'disabled' && this.cues.length === 0) {\n // On-demand load.\n loadTrack(this.src, this);\n }\n\n this.stopTracking();\n\n if (mode !== 'disabled') {\n this.startTracking();\n }\n /**\n * An event that fires when mode changes on this track. This allows\n * the TextTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec!\n *\n * @event TextTrack#modechange\n * @type {EventTarget~Event}\n */\n\n\n this.trigger('modechange');\n }\n },\n\n /**\n * @memberof TextTrack\n * @member {TextTrackCueList} cues\n * The text track cue list for this TextTrack.\n * @instance\n */\n cues: {\n get: function get() {\n if (!this.loaded_) {\n return null;\n }\n\n return cues;\n },\n set: function set() {}\n },\n\n /**\n * @memberof TextTrack\n * @member {TextTrackCueList} activeCues\n * The list text track cues that are currently active for this TextTrack.\n * @instance\n */\n activeCues: {\n get: function get() {\n if (!this.loaded_) {\n return null;\n } // nothing to do\n\n\n if (this.cues.length === 0) {\n return activeCues;\n }\n\n var ct = this.tech_.currentTime();\n var active = [];\n\n for (var i = 0, l = this.cues.length; i < l; i++) {\n var cue = this.cues[i];\n\n if (cue.startTime <= ct && cue.endTime >= ct) {\n active.push(cue);\n } else if (cue.startTime === cue.endTime && cue.startTime <= ct && cue.startTime + 0.5 >= ct) {\n active.push(cue);\n }\n }\n\n changed = false;\n\n if (active.length !== this.activeCues_.length) {\n changed = true;\n } else {\n for (var _i = 0; _i < active.length; _i++) {\n if (this.activeCues_.indexOf(active[_i]) === -1) {\n changed = true;\n }\n }\n }\n\n this.activeCues_ = active;\n activeCues.setCues_(this.activeCues_);\n return activeCues;\n },\n // /!\\ Keep this setter empty (see the timeupdate handler above)\n set: function set() {}\n }\n });\n\n if (settings.src) {\n _this.src = settings.src;\n\n if (!_this.preload_) {\n // Tracks will load on-demand.\n // Act like we're loaded for other purposes.\n _this.loaded_ = true;\n }\n\n if (_this.preload_ || settings.kind !== 'subtitles' && settings.kind !== 'captions') {\n loadTrack(_this.src, (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this));\n }\n } else {\n _this.loaded_ = true;\n }\n\n return _this;\n }\n\n var _proto = TextTrack.prototype;\n\n _proto.startTracking = function startTracking() {\n // More precise cues based on requestVideoFrameCallback with a requestAnimationFram fallback\n this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler); // Also listen to timeupdate in case rVFC/rAF stops (window in background, audio in video el)\n\n this.tech_.on('timeupdate', this.timeupdateHandler);\n };\n\n _proto.stopTracking = function stopTracking() {\n if (this.rvf_) {\n this.tech_.cancelVideoFrameCallback(this.rvf_);\n this.rvf_ = undefined;\n }\n\n this.tech_.off('timeupdate', this.timeupdateHandler);\n }\n /**\n * Add a cue to the internal list of cues.\n *\n * @param {TextTrack~Cue} cue\n * The cue to add to our internal list\n */\n ;\n\n _proto.addCue = function addCue(originalCue) {\n var cue = originalCue;\n\n if (cue.constructor && cue.constructor.name !== 'VTTCue') {\n cue = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().vttjs).VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);\n\n for (var prop in originalCue) {\n if (!(prop in cue)) {\n cue[prop] = originalCue[prop];\n }\n } // make sure that `id` is copied over\n\n\n cue.id = originalCue.id;\n cue.originalCue_ = originalCue;\n }\n\n var tracks = this.tech_.textTracks();\n\n for (var i = 0; i < tracks.length; i++) {\n if (tracks[i] !== this) {\n tracks[i].removeCue(cue);\n }\n }\n\n this.cues_.push(cue);\n this.cues.setCues_(this.cues_);\n }\n /**\n * Remove a cue from our internal list\n *\n * @param {TextTrack~Cue} removeCue\n * The cue to remove from our internal list\n */\n ;\n\n _proto.removeCue = function removeCue(_removeCue) {\n var i = this.cues_.length;\n\n while (i--) {\n var cue = this.cues_[i];\n\n if (cue === _removeCue || cue.originalCue_ && cue.originalCue_ === _removeCue) {\n this.cues_.splice(i, 1);\n this.cues.setCues_(this.cues_);\n break;\n }\n }\n };\n\n return TextTrack;\n}(Track);\n/**\n * cuechange - One or more cues in the track have become active or stopped being active.\n */\n\n\nTextTrack.prototype.allowedEvents_ = {\n cuechange: 'cuechange'\n};\n\n/**\n * A representation of a single `AudioTrack`. If it is part of an {@link AudioTrackList}\n * only one `AudioTrack` in the list will be enabled at a time.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotrack}\n * @extends Track\n */\n\nvar AudioTrack = /*#__PURE__*/function (_Track) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(AudioTrack, _Track);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {AudioTrack~Kind} [options.kind='']\n * A valid audio track kind\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {boolean} [options.enabled]\n * If this track is the one that is currently playing. If this track is part of\n * an {@link AudioTrackList}, only one {@link AudioTrack} will be enabled.\n */\n function AudioTrack(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n var settings = mergeOptions$3(options, {\n kind: AudioTrackKind[options.kind] || ''\n });\n _this = _Track.call(this, settings) || this;\n var enabled = false;\n /**\n * @memberof AudioTrack\n * @member {boolean} enabled\n * If this `AudioTrack` is enabled or not. When setting this will\n * fire {@link AudioTrack#enabledchange} if the state of enabled is changed.\n * @instance\n *\n * @fires VideoTrack#selectedchange\n */\n\n Object.defineProperty((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), 'enabled', {\n get: function get() {\n return enabled;\n },\n set: function set(newEnabled) {\n // an invalid or unchanged value\n if (typeof newEnabled !== 'boolean' || newEnabled === enabled) {\n return;\n }\n\n enabled = newEnabled;\n /**\n * An event that fires when enabled changes on this track. This allows\n * the AudioTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec! Native tracks will do\n * this internally without an event.\n *\n * @event AudioTrack#enabledchange\n * @type {EventTarget~Event}\n */\n\n this.trigger('enabledchange');\n }\n }); // if the user sets this track to selected then\n // set selected to that true value otherwise\n // we keep it false\n\n if (settings.enabled) {\n _this.enabled = settings.enabled;\n }\n\n _this.loaded_ = true;\n return _this;\n }\n\n return AudioTrack;\n}(Track);\n\n/**\n * A representation of a single `VideoTrack`.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#videotrack}\n * @extends Track\n */\n\nvar VideoTrack = /*#__PURE__*/function (_Track) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(VideoTrack, _Track);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} [options={}]\n * Object of option names and values\n *\n * @param {string} [options.kind='']\n * A valid {@link VideoTrack~Kind}\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this AudioTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {boolean} [options.selected]\n * If this track is the one that is currently playing.\n */\n function VideoTrack(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n var settings = mergeOptions$3(options, {\n kind: VideoTrackKind[options.kind] || ''\n });\n _this = _Track.call(this, settings) || this;\n var selected = false;\n /**\n * @memberof VideoTrack\n * @member {boolean} selected\n * If this `VideoTrack` is selected or not. When setting this will\n * fire {@link VideoTrack#selectedchange} if the state of selected changed.\n * @instance\n *\n * @fires VideoTrack#selectedchange\n */\n\n Object.defineProperty((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), 'selected', {\n get: function get() {\n return selected;\n },\n set: function set(newSelected) {\n // an invalid or unchanged value\n if (typeof newSelected !== 'boolean' || newSelected === selected) {\n return;\n }\n\n selected = newSelected;\n /**\n * An event that fires when selected changes on this track. This allows\n * the VideoTrackList that holds this track to act accordingly.\n *\n * > Note: This is not part of the spec! Native tracks will do\n * this internally without an event.\n *\n * @event VideoTrack#selectedchange\n * @type {EventTarget~Event}\n */\n\n this.trigger('selectedchange');\n }\n }); // if the user sets this track to selected then\n // set selected to that true value otherwise\n // we keep it false\n\n if (settings.selected) {\n _this.selected = settings.selected;\n }\n\n return _this;\n }\n\n return VideoTrack;\n}(Track);\n\n/**\n * @memberof HTMLTrackElement\n * @typedef {HTMLTrackElement~ReadyState}\n * @enum {number}\n */\n\nvar NONE = 0;\nvar LOADING = 1;\nvar LOADED = 2;\nvar ERROR = 3;\n/**\n * A single track represented in the DOM.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#htmltrackelement}\n * @extends EventTarget\n */\n\nvar HTMLTrackElement = /*#__PURE__*/function (_EventTarget) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(HTMLTrackElement, _EventTarget);\n\n /**\n * Create an instance of this class.\n *\n * @param {Object} options={}\n * Object of option names and values\n *\n * @param {Tech} options.tech\n * A reference to the tech that owns this HTMLTrackElement.\n *\n * @param {TextTrack~Kind} [options.kind='subtitles']\n * A valid text track kind.\n *\n * @param {TextTrack~Mode} [options.mode='disabled']\n * A valid text track mode.\n *\n * @param {string} [options.id='vjs_track_' + Guid.newGUID()]\n * A unique id for this TextTrack.\n *\n * @param {string} [options.label='']\n * The menu label for this track.\n *\n * @param {string} [options.language='']\n * A valid two character language code.\n *\n * @param {string} [options.srclang='']\n * A valid two character language code. An alternative, but deprioritized\n * version of `options.language`\n *\n * @param {string} [options.src]\n * A url to TextTrack cues.\n *\n * @param {boolean} [options.default]\n * If this track should default to on or off.\n */\n function HTMLTrackElement(options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _EventTarget.call(this) || this;\n var readyState;\n var track = new TextTrack(options);\n _this.kind = track.kind;\n _this.src = track.src;\n _this.srclang = track.language;\n _this.label = track.label;\n _this[\"default\"] = track[\"default\"];\n Object.defineProperties((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), {\n /**\n * @memberof HTMLTrackElement\n * @member {HTMLTrackElement~ReadyState} readyState\n * The current ready state of the track element.\n * @instance\n */\n readyState: {\n get: function get() {\n return readyState;\n }\n },\n\n /**\n * @memberof HTMLTrackElement\n * @member {TextTrack} track\n * The underlying TextTrack object.\n * @instance\n *\n */\n track: {\n get: function get() {\n return track;\n }\n }\n });\n readyState = NONE;\n /**\n * @listens TextTrack#loadeddata\n * @fires HTMLTrackElement#load\n */\n\n track.addEventListener('loadeddata', function () {\n readyState = LOADED;\n\n _this.trigger({\n type: 'load',\n target: (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this)\n });\n });\n return _this;\n }\n\n return HTMLTrackElement;\n}(EventTarget$2);\n\nHTMLTrackElement.prototype.allowedEvents_ = {\n load: 'load'\n};\nHTMLTrackElement.NONE = NONE;\nHTMLTrackElement.LOADING = LOADING;\nHTMLTrackElement.LOADED = LOADED;\nHTMLTrackElement.ERROR = ERROR;\n\n/*\n * This file contains all track properties that are used in\n * player.js, tech.js, html5.js and possibly other techs in the future.\n */\n\nvar NORMAL = {\n audio: {\n ListClass: AudioTrackList,\n TrackClass: AudioTrack,\n capitalName: 'Audio'\n },\n video: {\n ListClass: VideoTrackList,\n TrackClass: VideoTrack,\n capitalName: 'Video'\n },\n text: {\n ListClass: TextTrackList,\n TrackClass: TextTrack,\n capitalName: 'Text'\n }\n};\nObject.keys(NORMAL).forEach(function (type) {\n NORMAL[type].getterName = type + \"Tracks\";\n NORMAL[type].privateName = type + \"Tracks_\";\n});\nvar REMOTE = {\n remoteText: {\n ListClass: TextTrackList,\n TrackClass: TextTrack,\n capitalName: 'RemoteText',\n getterName: 'remoteTextTracks',\n privateName: 'remoteTextTracks_'\n },\n remoteTextEl: {\n ListClass: HtmlTrackElementList,\n TrackClass: HTMLTrackElement,\n capitalName: 'RemoteTextTrackEls',\n getterName: 'remoteTextTrackEls',\n privateName: 'remoteTextTrackEls_'\n }\n};\n\nvar ALL = (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_2__[\"default\"])({}, NORMAL, REMOTE);\n\nREMOTE.names = Object.keys(REMOTE);\nNORMAL.names = Object.keys(NORMAL);\nALL.names = [].concat(REMOTE.names).concat(NORMAL.names);\n\n/**\n * An Object containing a structure like: `{src: 'url', type: 'mimetype'}` or string\n * that just contains the src url alone.\n * * `var SourceObject = {src: 'http://ex.com/video.mp4', type: 'video/mp4'};`\n * `var SourceString = 'http://example.com/some-video.mp4';`\n *\n * @typedef {Object|string} Tech~SourceObject\n *\n * @property {string} src\n * The url to the source\n *\n * @property {string} type\n * The mime type of the source\n */\n\n/**\n * A function used by {@link Tech} to create a new {@link TextTrack}.\n *\n * @private\n *\n * @param {Tech} self\n * An instance of the Tech class.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @param {Object} [options={}]\n * An object with additional text track options\n *\n * @return {TextTrack}\n * The text track that was created.\n */\n\nfunction createTrackHelper(self, kind, label, language, options) {\n if (options === void 0) {\n options = {};\n }\n\n var tracks = self.textTracks();\n options.kind = kind;\n\n if (label) {\n options.label = label;\n }\n\n if (language) {\n options.language = language;\n }\n\n options.tech = self;\n var track = new ALL.text.TrackClass(options);\n tracks.addTrack(track);\n return track;\n}\n/**\n * This is the base class for media playback technology controllers, such as\n * {@link HTML5}\n *\n * @extends Component\n */\n\n\nvar Tech = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(Tech, _Component);\n\n /**\n * Create an instance of this Tech.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} ready\n * Callback function to call when the `HTML5` Tech is ready.\n */\n function Tech(options, ready) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n if (ready === void 0) {\n ready = function ready() {};\n }\n\n // we don't want the tech to report user activity automatically.\n // This is done manually in addControlsListeners\n options.reportTouchActivity = false;\n _this = _Component.call(this, null, options, ready) || this;\n\n _this.onDurationChange_ = function (e) {\n return _this.onDurationChange(e);\n };\n\n _this.trackProgress_ = function (e) {\n return _this.trackProgress(e);\n };\n\n _this.trackCurrentTime_ = function (e) {\n return _this.trackCurrentTime(e);\n };\n\n _this.stopTrackingCurrentTime_ = function (e) {\n return _this.stopTrackingCurrentTime(e);\n };\n\n _this.disposeSourceHandler_ = function (e) {\n return _this.disposeSourceHandler(e);\n };\n\n _this.queuedHanders_ = new Set(); // keep track of whether the current source has played at all to\n // implement a very limited played()\n\n _this.hasStarted_ = false;\n\n _this.on('playing', function () {\n this.hasStarted_ = true;\n });\n\n _this.on('loadstart', function () {\n this.hasStarted_ = false;\n });\n\n ALL.names.forEach(function (name) {\n var props = ALL[name];\n\n if (options && options[props.getterName]) {\n _this[props.privateName] = options[props.getterName];\n }\n }); // Manually track progress in cases where the browser/tech doesn't report it.\n\n if (!_this.featuresProgressEvents) {\n _this.manualProgressOn();\n } // Manually track timeupdates in cases where the browser/tech doesn't report it.\n\n\n if (!_this.featuresTimeupdateEvents) {\n _this.manualTimeUpdatesOn();\n }\n\n ['Text', 'Audio', 'Video'].forEach(function (track) {\n if (options[\"native\" + track + \"Tracks\"] === false) {\n _this[\"featuresNative\" + track + \"Tracks\"] = false;\n }\n });\n\n if (options.nativeCaptions === false || options.nativeTextTracks === false) {\n _this.featuresNativeTextTracks = false;\n } else if (options.nativeCaptions === true || options.nativeTextTracks === true) {\n _this.featuresNativeTextTracks = true;\n }\n\n if (!_this.featuresNativeTextTracks) {\n _this.emulateTextTracks();\n }\n\n _this.preloadTextTracks = options.preloadTextTracks !== false;\n _this.autoRemoteTextTracks_ = new ALL.text.ListClass();\n\n _this.initTrackListeners(); // Turn on component tap events only if not using native controls\n\n\n if (!options.nativeControlsForTouch) {\n _this.emitTapEvents();\n }\n\n if (_this.constructor) {\n _this.name_ = _this.constructor.name || 'Unknown Tech';\n }\n\n return _this;\n }\n /**\n * A special function to trigger source set in a way that will allow player\n * to re-trigger if the player or tech are not ready yet.\n *\n * @fires Tech#sourceset\n * @param {string} src The source string at the time of the source changing.\n */\n\n\n var _proto = Tech.prototype;\n\n _proto.triggerSourceset = function triggerSourceset(src) {\n var _this2 = this;\n\n if (!this.isReady_) {\n // on initial ready we have to trigger source set\n // 1ms after ready so that player can watch for it.\n this.one('ready', function () {\n return _this2.setTimeout(function () {\n return _this2.triggerSourceset(src);\n }, 1);\n });\n }\n /**\n * Fired when the source is set on the tech causing the media element\n * to reload.\n *\n * @see {@link Player#event:sourceset}\n * @event Tech#sourceset\n * @type {EventTarget~Event}\n */\n\n\n this.trigger({\n src: src,\n type: 'sourceset'\n });\n }\n /* Fallbacks for unsupported event types\n ================================================================================ */\n\n /**\n * Polyfill the `progress` event for browsers that don't support it natively.\n *\n * @see {@link Tech#trackProgress}\n */\n ;\n\n _proto.manualProgressOn = function manualProgressOn() {\n this.on('durationchange', this.onDurationChange_);\n this.manualProgress = true; // Trigger progress watching when a source begins loading\n\n this.one('ready', this.trackProgress_);\n }\n /**\n * Turn off the polyfill for `progress` events that was created in\n * {@link Tech#manualProgressOn}\n */\n ;\n\n _proto.manualProgressOff = function manualProgressOff() {\n this.manualProgress = false;\n this.stopTrackingProgress();\n this.off('durationchange', this.onDurationChange_);\n }\n /**\n * This is used to trigger a `progress` event when the buffered percent changes. It\n * sets an interval function that will be called every 500 milliseconds to check if the\n * buffer end percent has changed.\n *\n * > This function is called by {@link Tech#manualProgressOn}\n *\n * @param {EventTarget~Event} event\n * The `ready` event that caused this to run.\n *\n * @listens Tech#ready\n * @fires Tech#progress\n */\n ;\n\n _proto.trackProgress = function trackProgress(event) {\n this.stopTrackingProgress();\n this.progressInterval = this.setInterval(bind(this, function () {\n // Don't trigger unless buffered amount is greater than last time\n var numBufferedPercent = this.bufferedPercent();\n\n if (this.bufferedPercent_ !== numBufferedPercent) {\n /**\n * See {@link Player#progress}\n *\n * @event Tech#progress\n * @type {EventTarget~Event}\n */\n this.trigger('progress');\n }\n\n this.bufferedPercent_ = numBufferedPercent;\n\n if (numBufferedPercent === 1) {\n this.stopTrackingProgress();\n }\n }), 500);\n }\n /**\n * Update our internal duration on a `durationchange` event by calling\n * {@link Tech#duration}.\n *\n * @param {EventTarget~Event} event\n * The `durationchange` event that caused this to run.\n *\n * @listens Tech#durationchange\n */\n ;\n\n _proto.onDurationChange = function onDurationChange(event) {\n this.duration_ = this.duration();\n }\n /**\n * Get and create a `TimeRange` object for buffering.\n *\n * @return {TimeRange}\n * The time range object that was created.\n */\n ;\n\n _proto.buffered = function buffered() {\n return createTimeRanges(0, 0);\n }\n /**\n * Get the percentage of the current video that is currently buffered.\n *\n * @return {number}\n * A number from 0 to 1 that represents the decimal percentage of the\n * video that is buffered.\n *\n */\n ;\n\n _proto.bufferedPercent = function bufferedPercent$1() {\n return bufferedPercent(this.buffered(), this.duration_);\n }\n /**\n * Turn off the polyfill for `progress` events that was created in\n * {@link Tech#manualProgressOn}\n * Stop manually tracking progress events by clearing the interval that was set in\n * {@link Tech#trackProgress}.\n */\n ;\n\n _proto.stopTrackingProgress = function stopTrackingProgress() {\n this.clearInterval(this.progressInterval);\n }\n /**\n * Polyfill the `timeupdate` event for browsers that don't support it.\n *\n * @see {@link Tech#trackCurrentTime}\n */\n ;\n\n _proto.manualTimeUpdatesOn = function manualTimeUpdatesOn() {\n this.manualTimeUpdates = true;\n this.on('play', this.trackCurrentTime_);\n this.on('pause', this.stopTrackingCurrentTime_);\n }\n /**\n * Turn off the polyfill for `timeupdate` events that was created in\n * {@link Tech#manualTimeUpdatesOn}\n */\n ;\n\n _proto.manualTimeUpdatesOff = function manualTimeUpdatesOff() {\n this.manualTimeUpdates = false;\n this.stopTrackingCurrentTime();\n this.off('play', this.trackCurrentTime_);\n this.off('pause', this.stopTrackingCurrentTime_);\n }\n /**\n * Sets up an interval function to track current time and trigger `timeupdate` every\n * 250 milliseconds.\n *\n * @listens Tech#play\n * @triggers Tech#timeupdate\n */\n ;\n\n _proto.trackCurrentTime = function trackCurrentTime() {\n if (this.currentTimeInterval) {\n this.stopTrackingCurrentTime();\n }\n\n this.currentTimeInterval = this.setInterval(function () {\n /**\n * Triggered at an interval of 250ms to indicated that time is passing in the video.\n *\n * @event Tech#timeupdate\n * @type {EventTarget~Event}\n */\n this.trigger({\n type: 'timeupdate',\n target: this,\n manuallyTriggered: true\n }); // 42 = 24 fps // 250 is what Webkit uses // FF uses 15\n }, 250);\n }\n /**\n * Stop the interval function created in {@link Tech#trackCurrentTime} so that the\n * `timeupdate` event is no longer triggered.\n *\n * @listens {Tech#pause}\n */\n ;\n\n _proto.stopTrackingCurrentTime = function stopTrackingCurrentTime() {\n this.clearInterval(this.currentTimeInterval); // #1002 - if the video ends right before the next timeupdate would happen,\n // the progress bar won't make it all the way to the end\n\n this.trigger({\n type: 'timeupdate',\n target: this,\n manuallyTriggered: true\n });\n }\n /**\n * Turn off all event polyfills, clear the `Tech`s {@link AudioTrackList},\n * {@link VideoTrackList}, and {@link TextTrackList}, and dispose of this Tech.\n *\n * @fires Component#dispose\n */\n ;\n\n _proto.dispose = function dispose() {\n // clear out all tracks because we can't reuse them between techs\n this.clearTracks(NORMAL.names); // Turn off any manual progress or timeupdate tracking\n\n if (this.manualProgress) {\n this.manualProgressOff();\n }\n\n if (this.manualTimeUpdates) {\n this.manualTimeUpdatesOff();\n }\n\n _Component.prototype.dispose.call(this);\n }\n /**\n * Clear out a single `TrackList` or an array of `TrackLists` given their names.\n *\n * > Note: Techs without source handlers should call this between sources for `video`\n * & `audio` tracks. You don't want to use them between tracks!\n *\n * @param {string[]|string} types\n * TrackList names to clear, valid names are `video`, `audio`, and\n * `text`.\n */\n ;\n\n _proto.clearTracks = function clearTracks(types) {\n var _this3 = this;\n\n types = [].concat(types); // clear out all tracks because we can't reuse them between techs\n\n types.forEach(function (type) {\n var list = _this3[type + \"Tracks\"]() || [];\n var i = list.length;\n\n while (i--) {\n var track = list[i];\n\n if (type === 'text') {\n _this3.removeRemoteTextTrack(track);\n }\n\n list.removeTrack(track);\n }\n });\n }\n /**\n * Remove any TextTracks added via addRemoteTextTrack that are\n * flagged for automatic garbage collection\n */\n ;\n\n _proto.cleanupAutoTextTracks = function cleanupAutoTextTracks() {\n var list = this.autoRemoteTextTracks_ || [];\n var i = list.length;\n\n while (i--) {\n var track = list[i];\n this.removeRemoteTextTrack(track);\n }\n }\n /**\n * Reset the tech, which will removes all sources and reset the internal readyState.\n *\n * @abstract\n */\n ;\n\n _proto.reset = function reset() {}\n /**\n * Get the value of `crossOrigin` from the tech.\n *\n * @abstract\n *\n * @see {Html5#crossOrigin}\n */\n ;\n\n _proto.crossOrigin = function crossOrigin() {}\n /**\n * Set the value of `crossOrigin` on the tech.\n *\n * @abstract\n *\n * @param {string} crossOrigin the crossOrigin value\n * @see {Html5#setCrossOrigin}\n */\n ;\n\n _proto.setCrossOrigin = function setCrossOrigin() {}\n /**\n * Get or set an error on the Tech.\n *\n * @param {MediaError} [err]\n * Error to set on the Tech\n *\n * @return {MediaError|null}\n * The current error object on the tech, or null if there isn't one.\n */\n ;\n\n _proto.error = function error(err) {\n if (err !== undefined) {\n this.error_ = new MediaError(err);\n this.trigger('error');\n }\n\n return this.error_;\n }\n /**\n * Returns the `TimeRange`s that have been played through for the current source.\n *\n * > NOTE: This implementation is incomplete. It does not track the played `TimeRange`.\n * It only checks whether the source has played at all or not.\n *\n * @return {TimeRange}\n * - A single time range if this video has played\n * - An empty set of ranges if not.\n */\n ;\n\n _proto.played = function played() {\n if (this.hasStarted_) {\n return createTimeRanges(0, 0);\n }\n\n return createTimeRanges();\n }\n /**\n * Start playback\n *\n * @abstract\n *\n * @see {Html5#play}\n */\n ;\n\n _proto.play = function play() {}\n /**\n * Set whether we are scrubbing or not\n *\n * @abstract\n *\n * @see {Html5#setScrubbing}\n */\n ;\n\n _proto.setScrubbing = function setScrubbing() {}\n /**\n * Get whether we are scrubbing or not\n *\n * @abstract\n *\n * @see {Html5#scrubbing}\n */\n ;\n\n _proto.scrubbing = function scrubbing() {}\n /**\n * Causes a manual time update to occur if {@link Tech#manualTimeUpdatesOn} was\n * previously called.\n *\n * @fires Tech#timeupdate\n */\n ;\n\n _proto.setCurrentTime = function setCurrentTime() {\n // improve the accuracy of manual timeupdates\n if (this.manualTimeUpdates) {\n /**\n * A manual `timeupdate` event.\n *\n * @event Tech#timeupdate\n * @type {EventTarget~Event}\n */\n this.trigger({\n type: 'timeupdate',\n target: this,\n manuallyTriggered: true\n });\n }\n }\n /**\n * Turn on listeners for {@link VideoTrackList}, {@link {AudioTrackList}, and\n * {@link TextTrackList} events.\n *\n * This adds {@link EventTarget~EventListeners} for `addtrack`, and `removetrack`.\n *\n * @fires Tech#audiotrackchange\n * @fires Tech#videotrackchange\n * @fires Tech#texttrackchange\n */\n ;\n\n _proto.initTrackListeners = function initTrackListeners() {\n var _this4 = this;\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link AudioTrackList}\n *\n * @event Tech#audiotrackchange\n * @type {EventTarget~Event}\n */\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link VideoTrackList}\n *\n * @event Tech#videotrackchange\n * @type {EventTarget~Event}\n */\n\n /**\n * Triggered when tracks are added or removed on the Tech {@link TextTrackList}\n *\n * @event Tech#texttrackchange\n * @type {EventTarget~Event}\n */\n NORMAL.names.forEach(function (name) {\n var props = NORMAL[name];\n\n var trackListChanges = function trackListChanges() {\n _this4.trigger(name + \"trackchange\");\n };\n\n var tracks = _this4[props.getterName]();\n\n tracks.addEventListener('removetrack', trackListChanges);\n tracks.addEventListener('addtrack', trackListChanges);\n\n _this4.on('dispose', function () {\n tracks.removeEventListener('removetrack', trackListChanges);\n tracks.removeEventListener('addtrack', trackListChanges);\n });\n });\n }\n /**\n * Emulate TextTracks using vtt.js if necessary\n *\n * @fires Tech#vttjsloaded\n * @fires Tech#vttjserror\n */\n ;\n\n _proto.addWebVttScript_ = function addWebVttScript_() {\n var _this5 = this;\n\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT)) {\n return;\n } // Initially, Tech.el_ is a child of a dummy-div wait until the Component system\n // signals that the Tech is ready at which point Tech.el_ is part of the DOM\n // before inserting the WebVTT script\n\n\n if (global_document__WEBPACK_IMPORTED_MODULE_1___default().body.contains(this.el())) {\n // load via require if available and vtt.js script location was not passed in\n // as an option. novtt builds will turn the above require call into an empty object\n // which will cause this if check to always fail.\n if (!this.options_['vtt.js'] && isPlain((videojs_vtt_js__WEBPACK_IMPORTED_MODULE_8___default())) && Object.keys((videojs_vtt_js__WEBPACK_IMPORTED_MODULE_8___default())).length > 0) {\n this.trigger('vttjsloaded');\n return;\n } // load vtt.js via the script location option or the cdn of no location was\n // passed in\n\n\n var script = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('script');\n script.src = this.options_['vtt.js'] || 'https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js';\n\n script.onload = function () {\n /**\n * Fired when vtt.js is loaded.\n *\n * @event Tech#vttjsloaded\n * @type {EventTarget~Event}\n */\n _this5.trigger('vttjsloaded');\n };\n\n script.onerror = function () {\n /**\n * Fired when vtt.js was not loaded due to an error\n *\n * @event Tech#vttjsloaded\n * @type {EventTarget~Event}\n */\n _this5.trigger('vttjserror');\n };\n\n this.on('dispose', function () {\n script.onload = null;\n script.onerror = null;\n }); // but have not loaded yet and we set it to true before the inject so that\n // we don't overwrite the injected window.WebVTT if it loads right away\n\n (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) = true;\n this.el().parentNode.appendChild(script);\n } else {\n this.ready(this.addWebVttScript_);\n }\n }\n /**\n * Emulate texttracks\n *\n */\n ;\n\n _proto.emulateTextTracks = function emulateTextTracks() {\n var _this6 = this;\n\n var tracks = this.textTracks();\n var remoteTracks = this.remoteTextTracks();\n\n var handleAddTrack = function handleAddTrack(e) {\n return tracks.addTrack(e.track);\n };\n\n var handleRemoveTrack = function handleRemoveTrack(e) {\n return tracks.removeTrack(e.track);\n };\n\n remoteTracks.on('addtrack', handleAddTrack);\n remoteTracks.on('removetrack', handleRemoveTrack);\n this.addWebVttScript_();\n\n var updateDisplay = function updateDisplay() {\n return _this6.trigger('texttrackchange');\n };\n\n var textTracksChanges = function textTracksChanges() {\n updateDisplay();\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i];\n track.removeEventListener('cuechange', updateDisplay);\n\n if (track.mode === 'showing') {\n track.addEventListener('cuechange', updateDisplay);\n }\n }\n };\n\n textTracksChanges();\n tracks.addEventListener('change', textTracksChanges);\n tracks.addEventListener('addtrack', textTracksChanges);\n tracks.addEventListener('removetrack', textTracksChanges);\n this.on('dispose', function () {\n remoteTracks.off('addtrack', handleAddTrack);\n remoteTracks.off('removetrack', handleRemoveTrack);\n tracks.removeEventListener('change', textTracksChanges);\n tracks.removeEventListener('addtrack', textTracksChanges);\n tracks.removeEventListener('removetrack', textTracksChanges);\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i];\n track.removeEventListener('cuechange', updateDisplay);\n }\n });\n }\n /**\n * Create and returns a remote {@link TextTrack} object.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @return {TextTrack}\n * The TextTrack that gets created.\n */\n ;\n\n _proto.addTextTrack = function addTextTrack(kind, label, language) {\n if (!kind) {\n throw new Error('TextTrack kind is required but was not provided');\n }\n\n return createTrackHelper(this, kind, label, language);\n }\n /**\n * Create an emulated TextTrack for use by addRemoteTextTrack\n *\n * This is intended to be overridden by classes that inherit from\n * Tech in order to create native or custom TextTracks.\n *\n * @param {Object} options\n * The object should contain the options to initialize the TextTrack with.\n *\n * @param {string} [options.kind]\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata).\n *\n * @param {string} [options.label].\n * Label to identify the text track\n *\n * @param {string} [options.language]\n * Two letter language abbreviation.\n *\n * @return {HTMLTrackElement}\n * The track element that gets created.\n */\n ;\n\n _proto.createRemoteTextTrack = function createRemoteTextTrack(options) {\n var track = mergeOptions$3(options, {\n tech: this\n });\n return new REMOTE.remoteTextEl.TrackClass(track);\n }\n /**\n * Creates a remote text track object and returns an html track element.\n *\n * > Note: This can be an emulated {@link HTMLTrackElement} or a native one.\n *\n * @param {Object} options\n * See {@link Tech#createRemoteTextTrack} for more detailed properties.\n *\n * @param {boolean} [manualCleanup=true]\n * - When false: the TextTrack will be automatically removed from the video\n * element whenever the source changes\n * - When True: The TextTrack will have to be cleaned up manually\n *\n * @return {HTMLTrackElement}\n * An Html Track Element.\n *\n * @deprecated The default functionality for this function will be equivalent\n * to \"manualCleanup=false\" in the future. The manualCleanup parameter will\n * also be removed.\n */\n ;\n\n _proto.addRemoteTextTrack = function addRemoteTextTrack(options, manualCleanup) {\n var _this7 = this;\n\n if (options === void 0) {\n options = {};\n }\n\n var htmlTrackElement = this.createRemoteTextTrack(options);\n\n if (manualCleanup !== true && manualCleanup !== false) {\n // deprecation warning\n log$1.warn('Calling addRemoteTextTrack without explicitly setting the \"manualCleanup\" parameter to `true` is deprecated and default to `false` in future version of video.js');\n manualCleanup = true;\n } // store HTMLTrackElement and TextTrack to remote list\n\n\n this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);\n this.remoteTextTracks().addTrack(htmlTrackElement.track);\n\n if (manualCleanup !== true) {\n // create the TextTrackList if it doesn't exist\n this.ready(function () {\n return _this7.autoRemoteTextTracks_.addTrack(htmlTrackElement.track);\n });\n }\n\n return htmlTrackElement;\n }\n /**\n * Remove a remote text track from the remote `TextTrackList`.\n *\n * @param {TextTrack} track\n * `TextTrack` to remove from the `TextTrackList`\n */\n ;\n\n _proto.removeRemoteTextTrack = function removeRemoteTextTrack(track) {\n var trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track); // remove HTMLTrackElement and TextTrack from remote list\n\n this.remoteTextTrackEls().removeTrackElement_(trackElement);\n this.remoteTextTracks().removeTrack(track);\n this.autoRemoteTextTracks_.removeTrack(track);\n }\n /**\n * Gets available media playback quality metrics as specified by the W3C's Media\n * Playback Quality API.\n *\n * @see [Spec]{@link https://wicg.github.io/media-playback-quality}\n *\n * @return {Object}\n * An object with supported media playback quality metrics\n *\n * @abstract\n */\n ;\n\n _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {\n return {};\n }\n /**\n * Attempt to create a floating video window always on top of other windows\n * so that users may continue consuming media while they interact with other\n * content sites, or applications on their device.\n *\n * @see [Spec]{@link https://wicg.github.io/picture-in-picture}\n *\n * @return {Promise|undefined}\n * A promise with a Picture-in-Picture window if the browser supports\n * Promises (or one was passed in as an option). It returns undefined\n * otherwise.\n *\n * @abstract\n */\n ;\n\n _proto.requestPictureInPicture = function requestPictureInPicture() {\n var PromiseClass = this.options_.Promise || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Promise);\n\n if (PromiseClass) {\n return PromiseClass.reject();\n }\n }\n /**\n * A method to check for the value of the 'disablePictureInPicture' <video> property.\n * Defaults to true, as it should be considered disabled if the tech does not support pip\n *\n * @abstract\n */\n ;\n\n _proto.disablePictureInPicture = function disablePictureInPicture() {\n return true;\n }\n /**\n * A method to set or unset the 'disablePictureInPicture' <video> property.\n *\n * @abstract\n */\n ;\n\n _proto.setDisablePictureInPicture = function setDisablePictureInPicture() {}\n /**\n * A fallback implementation of requestVideoFrameCallback using requestAnimationFrame\n *\n * @param {function} cb\n * @return {number} request id\n */\n ;\n\n _proto.requestVideoFrameCallback = function requestVideoFrameCallback(cb) {\n var _this8 = this;\n\n var id = newGUID();\n\n if (!this.isReady_ || this.paused()) {\n this.queuedHanders_.add(id);\n this.one('playing', function () {\n if (_this8.queuedHanders_.has(id)) {\n _this8.queuedHanders_[\"delete\"](id);\n\n cb();\n }\n });\n } else {\n this.requestNamedAnimationFrame(id, cb);\n }\n\n return id;\n }\n /**\n * A fallback implementation of cancelVideoFrameCallback\n *\n * @param {number} id id of callback to be cancelled\n */\n ;\n\n _proto.cancelVideoFrameCallback = function cancelVideoFrameCallback(id) {\n if (this.queuedHanders_.has(id)) {\n this.queuedHanders_[\"delete\"](id);\n } else {\n this.cancelNamedAnimationFrame(id);\n }\n }\n /**\n * A method to set a poster from a `Tech`.\n *\n * @abstract\n */\n ;\n\n _proto.setPoster = function setPoster() {}\n /**\n * A method to check for the presence of the 'playsinline' <video> attribute.\n *\n * @abstract\n */\n ;\n\n _proto.playsinline = function playsinline() {}\n /**\n * A method to set or unset the 'playsinline' <video> attribute.\n *\n * @abstract\n */\n ;\n\n _proto.setPlaysinline = function setPlaysinline() {}\n /**\n * Attempt to force override of native audio tracks.\n *\n * @param {boolean} override - If set to true native audio will be overridden,\n * otherwise native audio will potentially be used.\n *\n * @abstract\n */\n ;\n\n _proto.overrideNativeAudioTracks = function overrideNativeAudioTracks() {}\n /**\n * Attempt to force override of native video tracks.\n *\n * @param {boolean} override - If set to true native video will be overridden,\n * otherwise native video will potentially be used.\n *\n * @abstract\n */\n ;\n\n _proto.overrideNativeVideoTracks = function overrideNativeVideoTracks() {}\n /*\n * Check if the tech can support the given mime-type.\n *\n * The base tech does not support any type, but source handlers might\n * overwrite this.\n *\n * @param {string} type\n * The mimetype to check for support\n *\n * @return {string}\n * 'probably', 'maybe', or empty string\n *\n * @see [Spec]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canPlayType}\n *\n * @abstract\n */\n ;\n\n _proto.canPlayType = function canPlayType() {\n return '';\n }\n /**\n * Check if the type is supported by this tech.\n *\n * The base tech does not support any type, but source handlers might\n * overwrite this.\n *\n * @param {string} type\n * The media type to check\n * @return {string} Returns the native video element's response\n */\n ;\n\n Tech.canPlayType = function canPlayType() {\n return '';\n }\n /**\n * Check if the tech can support the given source\n *\n * @param {Object} srcObj\n * The source object\n * @param {Object} options\n * The options passed to the tech\n * @return {string} 'probably', 'maybe', or '' (empty string)\n */\n ;\n\n Tech.canPlaySource = function canPlaySource(srcObj, options) {\n return Tech.canPlayType(srcObj.type);\n }\n /*\n * Return whether the argument is a Tech or not.\n * Can be passed either a Class like `Html5` or a instance like `player.tech_`\n *\n * @param {Object} component\n * The item to check\n *\n * @return {boolean}\n * Whether it is a tech or not\n * - True if it is a tech\n * - False if it is not\n */\n ;\n\n Tech.isTech = function isTech(component) {\n return component.prototype instanceof Tech || component instanceof Tech || component === Tech;\n }\n /**\n * Registers a `Tech` into a shared list for videojs.\n *\n * @param {string} name\n * Name of the `Tech` to register.\n *\n * @param {Object} tech\n * The `Tech` class to register.\n */\n ;\n\n Tech.registerTech = function registerTech(name, tech) {\n if (!Tech.techs_) {\n Tech.techs_ = {};\n }\n\n if (!Tech.isTech(tech)) {\n throw new Error(\"Tech \" + name + \" must be a Tech\");\n }\n\n if (!Tech.canPlayType) {\n throw new Error('Techs must have a static canPlayType method on them');\n }\n\n if (!Tech.canPlaySource) {\n throw new Error('Techs must have a static canPlaySource method on them');\n }\n\n name = toTitleCase$1(name);\n Tech.techs_[name] = tech;\n Tech.techs_[toLowerCase(name)] = tech;\n\n if (name !== 'Tech') {\n // camel case the techName for use in techOrder\n Tech.defaultTechOrder_.push(name);\n }\n\n return tech;\n }\n /**\n * Get a `Tech` from the shared list by name.\n *\n * @param {string} name\n * `camelCase` or `TitleCase` name of the Tech to get\n *\n * @return {Tech|undefined}\n * The `Tech` or undefined if there was no tech with the name requested.\n */\n ;\n\n Tech.getTech = function getTech(name) {\n if (!name) {\n return;\n }\n\n if (Tech.techs_ && Tech.techs_[name]) {\n return Tech.techs_[name];\n }\n\n name = toTitleCase$1(name);\n\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default()) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().videojs) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().videojs)[name]) {\n log$1.warn(\"The \" + name + \" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)\");\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default().videojs)[name];\n }\n };\n\n return Tech;\n}(Component$1);\n/**\n * Get the {@link VideoTrackList}\n *\n * @returns {VideoTrackList}\n * @method Tech.prototype.videoTracks\n */\n\n/**\n * Get the {@link AudioTrackList}\n *\n * @returns {AudioTrackList}\n * @method Tech.prototype.audioTracks\n */\n\n/**\n * Get the {@link TextTrackList}\n *\n * @returns {TextTrackList}\n * @method Tech.prototype.textTracks\n */\n\n/**\n * Get the remote element {@link TextTrackList}\n *\n * @returns {TextTrackList}\n * @method Tech.prototype.remoteTextTracks\n */\n\n/**\n * Get the remote element {@link HtmlTrackElementList}\n *\n * @returns {HtmlTrackElementList}\n * @method Tech.prototype.remoteTextTrackEls\n */\n\n\nALL.names.forEach(function (name) {\n var props = ALL[name];\n\n Tech.prototype[props.getterName] = function () {\n this[props.privateName] = this[props.privateName] || new props.ListClass();\n return this[props.privateName];\n };\n});\n/**\n * List of associated text tracks\n *\n * @type {TextTrackList}\n * @private\n * @property Tech#textTracks_\n */\n\n/**\n * List of associated audio tracks.\n *\n * @type {AudioTrackList}\n * @private\n * @property Tech#audioTracks_\n */\n\n/**\n * List of associated video tracks.\n *\n * @type {VideoTrackList}\n * @private\n * @property Tech#videoTracks_\n */\n\n/**\n * Boolean indicating whether the `Tech` supports volume control.\n *\n * @type {boolean}\n * @default\n */\n\nTech.prototype.featuresVolumeControl = true;\n/**\n * Boolean indicating whether the `Tech` supports muting volume.\n *\n * @type {bolean}\n * @default\n */\n\nTech.prototype.featuresMuteControl = true;\n/**\n * Boolean indicating whether the `Tech` supports fullscreen resize control.\n * Resizing plugins using request fullscreen reloads the plugin\n *\n * @type {boolean}\n * @default\n */\n\nTech.prototype.featuresFullscreenResize = false;\n/**\n * Boolean indicating whether the `Tech` supports changing the speed at which the video\n * plays. Examples:\n * - Set player to play 2x (twice) as fast\n * - Set player to play 0.5x (half) as fast\n *\n * @type {boolean}\n * @default\n */\n\nTech.prototype.featuresPlaybackRate = false;\n/**\n * Boolean indicating whether the `Tech` supports the `progress` event. This is currently\n * not triggered by video-js-swf. This will be used to determine if\n * {@link Tech#manualProgressOn} should be called.\n *\n * @type {boolean}\n * @default\n */\n\nTech.prototype.featuresProgressEvents = false;\n/**\n * Boolean indicating whether the `Tech` supports the `sourceset` event.\n *\n * A tech should set this to `true` and then use {@link Tech#triggerSourceset}\n * to trigger a {@link Tech#event:sourceset} at the earliest time after getting\n * a new source.\n *\n * @type {boolean}\n * @default\n */\n\nTech.prototype.featuresSourceset = false;\n/**\n * Boolean indicating whether the `Tech` supports the `timeupdate` event. This is currently\n * not triggered by video-js-swf. This will be used to determine if\n * {@link Tech#manualTimeUpdates} should be called.\n *\n * @type {boolean}\n * @default\n */\n\nTech.prototype.featuresTimeupdateEvents = false;\n/**\n * Boolean indicating whether the `Tech` supports the native `TextTrack`s.\n * This will help us integrate with native `TextTrack`s if the browser supports them.\n *\n * @type {boolean}\n * @default\n */\n\nTech.prototype.featuresNativeTextTracks = false;\n/**\n * Boolean indicating whether the `Tech` supports `requestVideoFrameCallback`.\n *\n * @type {boolean}\n * @default\n */\n\nTech.prototype.featuresVideoFrameCallback = false;\n/**\n * A functional mixin for techs that want to use the Source Handler pattern.\n * Source handlers are scripts for handling specific formats.\n * The source handler pattern is used for adaptive formats (HLS, DASH) that\n * manually load video data and feed it into a Source Buffer (Media Source Extensions)\n * Example: `Tech.withSourceHandlers.call(MyTech);`\n *\n * @param {Tech} _Tech\n * The tech to add source handler functions to.\n *\n * @mixes Tech~SourceHandlerAdditions\n */\n\nTech.withSourceHandlers = function (_Tech) {\n /**\n * Register a source handler\n *\n * @param {Function} handler\n * The source handler class\n *\n * @param {number} [index]\n * Register it at the following index\n */\n _Tech.registerSourceHandler = function (handler, index) {\n var handlers = _Tech.sourceHandlers;\n\n if (!handlers) {\n handlers = _Tech.sourceHandlers = [];\n }\n\n if (index === undefined) {\n // add to the end of the list\n index = handlers.length;\n }\n\n handlers.splice(index, 0, handler);\n };\n /**\n * Check if the tech can support the given type. Also checks the\n * Techs sourceHandlers.\n *\n * @param {string} type\n * The mimetype to check.\n *\n * @return {string}\n * 'probably', 'maybe', or '' (empty string)\n */\n\n\n _Tech.canPlayType = function (type) {\n var handlers = _Tech.sourceHandlers || [];\n var can;\n\n for (var i = 0; i < handlers.length; i++) {\n can = handlers[i].canPlayType(type);\n\n if (can) {\n return can;\n }\n }\n\n return '';\n };\n /**\n * Returns the first source handler that supports the source.\n *\n * TODO: Answer question: should 'probably' be prioritized over 'maybe'\n *\n * @param {Tech~SourceObject} source\n * The source object\n *\n * @param {Object} options\n * The options passed to the tech\n *\n * @return {SourceHandler|null}\n * The first source handler that supports the source or null if\n * no SourceHandler supports the source\n */\n\n\n _Tech.selectSourceHandler = function (source, options) {\n var handlers = _Tech.sourceHandlers || [];\n var can;\n\n for (var i = 0; i < handlers.length; i++) {\n can = handlers[i].canHandleSource(source, options);\n\n if (can) {\n return handlers[i];\n }\n }\n\n return null;\n };\n /**\n * Check if the tech can support the given source.\n *\n * @param {Tech~SourceObject} srcObj\n * The source object\n *\n * @param {Object} options\n * The options passed to the tech\n *\n * @return {string}\n * 'probably', 'maybe', or '' (empty string)\n */\n\n\n _Tech.canPlaySource = function (srcObj, options) {\n var sh = _Tech.selectSourceHandler(srcObj, options);\n\n if (sh) {\n return sh.canHandleSource(srcObj, options);\n }\n\n return '';\n };\n /**\n * When using a source handler, prefer its implementation of\n * any function normally provided by the tech.\n */\n\n\n var deferrable = ['seekable', 'seeking', 'duration'];\n /**\n * A wrapper around {@link Tech#seekable} that will call a `SourceHandler`s seekable\n * function if it exists, with a fallback to the Techs seekable function.\n *\n * @method _Tech.seekable\n */\n\n /**\n * A wrapper around {@link Tech#duration} that will call a `SourceHandler`s duration\n * function if it exists, otherwise it will fallback to the techs duration function.\n *\n * @method _Tech.duration\n */\n\n deferrable.forEach(function (fnName) {\n var originalFn = this[fnName];\n\n if (typeof originalFn !== 'function') {\n return;\n }\n\n this[fnName] = function () {\n if (this.sourceHandler_ && this.sourceHandler_[fnName]) {\n return this.sourceHandler_[fnName].apply(this.sourceHandler_, arguments);\n }\n\n return originalFn.apply(this, arguments);\n };\n }, _Tech.prototype);\n /**\n * Create a function for setting the source using a source object\n * and source handlers.\n * Should never be called unless a source handler was found.\n *\n * @param {Tech~SourceObject} source\n * A source object with src and type keys\n */\n\n _Tech.prototype.setSource = function (source) {\n var sh = _Tech.selectSourceHandler(source, this.options_);\n\n if (!sh) {\n // Fall back to a native source hander when unsupported sources are\n // deliberately set\n if (_Tech.nativeSourceHandler) {\n sh = _Tech.nativeSourceHandler;\n } else {\n log$1.error('No source handler found for the current source.');\n }\n } // Dispose any existing source handler\n\n\n this.disposeSourceHandler();\n this.off('dispose', this.disposeSourceHandler_);\n\n if (sh !== _Tech.nativeSourceHandler) {\n this.currentSource_ = source;\n }\n\n this.sourceHandler_ = sh.handleSource(source, this, this.options_);\n this.one('dispose', this.disposeSourceHandler_);\n };\n /**\n * Clean up any existing SourceHandlers and listeners when the Tech is disposed.\n *\n * @listens Tech#dispose\n */\n\n\n _Tech.prototype.disposeSourceHandler = function () {\n // if we have a source and get another one\n // then we are loading something new\n // than clear all of our current tracks\n if (this.currentSource_) {\n this.clearTracks(['audio', 'video']);\n this.currentSource_ = null;\n } // always clean up auto-text tracks\n\n\n this.cleanupAutoTextTracks();\n\n if (this.sourceHandler_) {\n if (this.sourceHandler_.dispose) {\n this.sourceHandler_.dispose();\n }\n\n this.sourceHandler_ = null;\n }\n };\n}; // The base Tech class needs to be registered as a Component. It is the only\n// Tech that can be registered as a Component.\n\n\nComponent$1.registerComponent('Tech', Tech);\nTech.registerTech('Tech', Tech);\n/**\n * A list of techs that should be added to techOrder on Players\n *\n * @private\n */\n\nTech.defaultTechOrder_ = [];\n\n/**\n * @file middleware.js\n * @module middleware\n */\nvar middlewares = {};\nvar middlewareInstances = {};\nvar TERMINATOR = {};\n/**\n * A middleware object is a plain JavaScript object that has methods that\n * match the {@link Tech} methods found in the lists of allowed\n * {@link module:middleware.allowedGetters|getters},\n * {@link module:middleware.allowedSetters|setters}, and\n * {@link module:middleware.allowedMediators|mediators}.\n *\n * @typedef {Object} MiddlewareObject\n */\n\n/**\n * A middleware factory function that should return a\n * {@link module:middleware~MiddlewareObject|MiddlewareObject}.\n *\n * This factory will be called for each player when needed, with the player\n * passed in as an argument.\n *\n * @callback MiddlewareFactory\n * @param {Player} player\n * A Video.js player.\n */\n\n/**\n * Define a middleware that the player should use by way of a factory function\n * that returns a middleware object.\n *\n * @param {string} type\n * The MIME type to match or `\"*\"` for all MIME types.\n *\n * @param {MiddlewareFactory} middleware\n * A middleware factory function that will be executed for\n * matching types.\n */\n\nfunction use(type, middleware) {\n middlewares[type] = middlewares[type] || [];\n middlewares[type].push(middleware);\n}\n/**\n * Asynchronously sets a source using middleware by recursing through any\n * matching middlewares and calling `setSource` on each, passing along the\n * previous returned value each time.\n *\n * @param {Player} player\n * A {@link Player} instance.\n *\n * @param {Tech~SourceObject} src\n * A source object.\n *\n * @param {Function}\n * The next middleware to run.\n */\n\nfunction setSource(player, src, next) {\n player.setTimeout(function () {\n return setSourceHelper(src, middlewares[src.type], next, player);\n }, 1);\n}\n/**\n * When the tech is set, passes the tech to each middleware's `setTech` method.\n *\n * @param {Object[]} middleware\n * An array of middleware instances.\n *\n * @param {Tech} tech\n * A Video.js tech.\n */\n\nfunction setTech(middleware, tech) {\n middleware.forEach(function (mw) {\n return mw.setTech && mw.setTech(tech);\n });\n}\n/**\n * Calls a getter on the tech first, through each middleware\n * from right to left to the player.\n *\n * @param {Object[]} middleware\n * An array of middleware instances.\n *\n * @param {Tech} tech\n * The current tech.\n *\n * @param {string} method\n * A method name.\n *\n * @return {Mixed}\n * The final value from the tech after middleware has intercepted it.\n */\n\nfunction get(middleware, tech, method) {\n return middleware.reduceRight(middlewareIterator(method), tech[method]());\n}\n/**\n * Takes the argument given to the player and calls the setter method on each\n * middleware from left to right to the tech.\n *\n * @param {Object[]} middleware\n * An array of middleware instances.\n *\n * @param {Tech} tech\n * The current tech.\n *\n * @param {string} method\n * A method name.\n *\n * @param {Mixed} arg\n * The value to set on the tech.\n *\n * @return {Mixed}\n * The return value of the `method` of the `tech`.\n */\n\nfunction set(middleware, tech, method, arg) {\n return tech[method](middleware.reduce(middlewareIterator(method), arg));\n}\n/**\n * Takes the argument given to the player and calls the `call` version of the\n * method on each middleware from left to right.\n *\n * Then, call the passed in method on the tech and return the result unchanged\n * back to the player, through middleware, this time from right to left.\n *\n * @param {Object[]} middleware\n * An array of middleware instances.\n *\n * @param {Tech} tech\n * The current tech.\n *\n * @param {string} method\n * A method name.\n *\n * @param {Mixed} arg\n * The value to set on the tech.\n *\n * @return {Mixed}\n * The return value of the `method` of the `tech`, regardless of the\n * return values of middlewares.\n */\n\nfunction mediate(middleware, tech, method, arg) {\n if (arg === void 0) {\n arg = null;\n }\n\n var callMethod = 'call' + toTitleCase$1(method);\n var middlewareValue = middleware.reduce(middlewareIterator(callMethod), arg);\n var terminated = middlewareValue === TERMINATOR; // deprecated. The `null` return value should instead return TERMINATOR to\n // prevent confusion if a techs method actually returns null.\n\n var returnValue = terminated ? null : tech[method](middlewareValue);\n executeRight(middleware, method, returnValue, terminated);\n return returnValue;\n}\n/**\n * Enumeration of allowed getters where the keys are method names.\n *\n * @type {Object}\n */\n\nvar allowedGetters = {\n buffered: 1,\n currentTime: 1,\n duration: 1,\n muted: 1,\n played: 1,\n paused: 1,\n seekable: 1,\n volume: 1,\n ended: 1\n};\n/**\n * Enumeration of allowed setters where the keys are method names.\n *\n * @type {Object}\n */\n\nvar allowedSetters = {\n setCurrentTime: 1,\n setMuted: 1,\n setVolume: 1\n};\n/**\n * Enumeration of allowed mediators where the keys are method names.\n *\n * @type {Object}\n */\n\nvar allowedMediators = {\n play: 1,\n pause: 1\n};\n\nfunction middlewareIterator(method) {\n return function (value, mw) {\n // if the previous middleware terminated, pass along the termination\n if (value === TERMINATOR) {\n return TERMINATOR;\n }\n\n if (mw[method]) {\n return mw[method](value);\n }\n\n return value;\n };\n}\n\nfunction executeRight(mws, method, value, terminated) {\n for (var i = mws.length - 1; i >= 0; i--) {\n var mw = mws[i];\n\n if (mw[method]) {\n mw[method](terminated, value);\n }\n }\n}\n/**\n * Clear the middleware cache for a player.\n *\n * @param {Player} player\n * A {@link Player} instance.\n */\n\n\nfunction clearCacheForPlayer(player) {\n middlewareInstances[player.id()] = null;\n}\n/**\n * {\n * [playerId]: [[mwFactory, mwInstance], ...]\n * }\n *\n * @private\n */\n\nfunction getOrCreateFactory(player, mwFactory) {\n var mws = middlewareInstances[player.id()];\n var mw = null;\n\n if (mws === undefined || mws === null) {\n mw = mwFactory(player);\n middlewareInstances[player.id()] = [[mwFactory, mw]];\n return mw;\n }\n\n for (var i = 0; i < mws.length; i++) {\n var _mws$i = mws[i],\n mwf = _mws$i[0],\n mwi = _mws$i[1];\n\n if (mwf !== mwFactory) {\n continue;\n }\n\n mw = mwi;\n }\n\n if (mw === null) {\n mw = mwFactory(player);\n mws.push([mwFactory, mw]);\n }\n\n return mw;\n}\n\nfunction setSourceHelper(src, middleware, next, player, acc, lastRun) {\n if (src === void 0) {\n src = {};\n }\n\n if (middleware === void 0) {\n middleware = [];\n }\n\n if (acc === void 0) {\n acc = [];\n }\n\n if (lastRun === void 0) {\n lastRun = false;\n }\n\n var _middleware = middleware,\n mwFactory = _middleware[0],\n mwrest = _middleware.slice(1); // if mwFactory is a string, then we're at a fork in the road\n\n\n if (typeof mwFactory === 'string') {\n setSourceHelper(src, middlewares[mwFactory], next, player, acc, lastRun); // if we have an mwFactory, call it with the player to get the mw,\n // then call the mw's setSource method\n } else if (mwFactory) {\n var mw = getOrCreateFactory(player, mwFactory); // if setSource isn't present, implicitly select this middleware\n\n if (!mw.setSource) {\n acc.push(mw);\n return setSourceHelper(src, mwrest, next, player, acc, lastRun);\n }\n\n mw.setSource(assign({}, src), function (err, _src) {\n // something happened, try the next middleware on the current level\n // make sure to use the old src\n if (err) {\n return setSourceHelper(src, mwrest, next, player, acc, lastRun);\n } // we've succeeded, now we need to go deeper\n\n\n acc.push(mw); // if it's the same type, continue down the current chain\n // otherwise, we want to go down the new chain\n\n setSourceHelper(_src, src.type === _src.type ? mwrest : middlewares[_src.type], next, player, acc, lastRun);\n });\n } else if (mwrest.length) {\n setSourceHelper(src, mwrest, next, player, acc, lastRun);\n } else if (lastRun) {\n next(src, acc);\n } else {\n setSourceHelper(src, middlewares['*'], next, player, acc, true);\n }\n}\n\n/**\n * Mimetypes\n *\n * @see https://www.iana.org/assignments/media-types/media-types.xhtml\n * @typedef Mimetypes~Kind\n * @enum\n */\n\nvar MimetypesKind = {\n opus: 'video/ogg',\n ogv: 'video/ogg',\n mp4: 'video/mp4',\n mov: 'video/mp4',\n m4v: 'video/mp4',\n mkv: 'video/x-matroska',\n m4a: 'audio/mp4',\n mp3: 'audio/mpeg',\n aac: 'audio/aac',\n caf: 'audio/x-caf',\n flac: 'audio/flac',\n oga: 'audio/ogg',\n wav: 'audio/wav',\n m3u8: 'application/x-mpegURL',\n mpd: 'application/dash+xml',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n gif: 'image/gif',\n png: 'image/png',\n svg: 'image/svg+xml',\n webp: 'image/webp'\n};\n/**\n * Get the mimetype of a given src url if possible\n *\n * @param {string} src\n * The url to the src\n *\n * @return {string}\n * return the mimetype if it was known or empty string otherwise\n */\n\nvar getMimetype = function getMimetype(src) {\n if (src === void 0) {\n src = '';\n }\n\n var ext = getFileExtension(src);\n var mimetype = MimetypesKind[ext.toLowerCase()];\n return mimetype || '';\n};\n/**\n * Find the mime type of a given source string if possible. Uses the player\n * source cache.\n *\n * @param {Player} player\n * The player object\n *\n * @param {string} src\n * The source string\n *\n * @return {string}\n * The type that was found\n */\n\nvar findMimetype = function findMimetype(player, src) {\n if (!src) {\n return '';\n } // 1. check for the type in the `source` cache\n\n\n if (player.cache_.source.src === src && player.cache_.source.type) {\n return player.cache_.source.type;\n } // 2. see if we have this source in our `currentSources` cache\n\n\n var matchingSources = player.cache_.sources.filter(function (s) {\n return s.src === src;\n });\n\n if (matchingSources.length) {\n return matchingSources[0].type;\n } // 3. look for the src url in source elements and use the type there\n\n\n var sources = player.$$('source');\n\n for (var i = 0; i < sources.length; i++) {\n var s = sources[i];\n\n if (s.type && s.src && s.src === src) {\n return s.type;\n }\n } // 4. finally fallback to our list of mime types based on src url extension\n\n\n return getMimetype(src);\n};\n\n/**\n * @module filter-source\n */\n/**\n * Filter out single bad source objects or multiple source objects in an\n * array. Also flattens nested source object arrays into a 1 dimensional\n * array of source objects.\n *\n * @param {Tech~SourceObject|Tech~SourceObject[]} src\n * The src object to filter\n *\n * @return {Tech~SourceObject[]}\n * An array of sourceobjects containing only valid sources\n *\n * @private\n */\n\nvar filterSource = function filterSource(src) {\n // traverse array\n if (Array.isArray(src)) {\n var newsrc = [];\n src.forEach(function (srcobj) {\n srcobj = filterSource(srcobj);\n\n if (Array.isArray(srcobj)) {\n newsrc = newsrc.concat(srcobj);\n } else if (isObject(srcobj)) {\n newsrc.push(srcobj);\n }\n });\n src = newsrc;\n } else if (typeof src === 'string' && src.trim()) {\n // convert string into object\n src = [fixSource({\n src: src\n })];\n } else if (isObject(src) && typeof src.src === 'string' && src.src && src.src.trim()) {\n // src is already valid\n src = [fixSource(src)];\n } else {\n // invalid source, turn it into an empty array\n src = [];\n }\n\n return src;\n};\n/**\n * Checks src mimetype, adding it when possible\n *\n * @param {Tech~SourceObject} src\n * The src object to check\n * @return {Tech~SourceObject}\n * src Object with known type\n */\n\n\nfunction fixSource(src) {\n if (!src.type) {\n var mimetype = getMimetype(src.src);\n\n if (mimetype) {\n src.type = mimetype;\n }\n }\n\n return src;\n}\n\n/**\n * The `MediaLoader` is the `Component` that decides which playback technology to load\n * when a player is initialized.\n *\n * @extends Component\n */\n\nvar MediaLoader = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(MediaLoader, _Component);\n\n /**\n * Create an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should attach to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} [ready]\n * The function that is run when this component is ready.\n */\n function MediaLoader(player, options, ready) {\n var _this;\n\n // MediaLoader has no element\n var options_ = mergeOptions$3({\n createEl: false\n }, options);\n _this = _Component.call(this, player, options_, ready) || this; // If there are no sources when the player is initialized,\n // load the first supported playback technology.\n\n if (!options.playerOptions.sources || options.playerOptions.sources.length === 0) {\n for (var i = 0, j = options.playerOptions.techOrder; i < j.length; i++) {\n var techName = toTitleCase$1(j[i]);\n var tech = Tech.getTech(techName); // Support old behavior of techs being registered as components.\n // Remove once that deprecated behavior is removed.\n\n if (!techName) {\n tech = Component$1.getComponent(techName);\n } // Check if the browser supports this technology\n\n\n if (tech && tech.isSupported()) {\n player.loadTech_(techName);\n break;\n }\n }\n } else {\n // Loop through playback technologies (e.g. HTML5) and check for support.\n // Then load the best source.\n // A few assumptions here:\n // All playback technologies respect preload false.\n player.src(options.playerOptions.sources);\n }\n\n return _this;\n }\n\n return MediaLoader;\n}(Component$1);\n\nComponent$1.registerComponent('MediaLoader', MediaLoader);\n\n/**\n * Component which is clickable or keyboard actionable, but is not a\n * native HTML button.\n *\n * @extends Component\n */\n\nvar ClickableComponent = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(ClickableComponent, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of component options.\n *\n * @param {function} [options.clickHandler]\n * The function to call when the button is clicked / activated\n *\n * @param {string} [options.controlText]\n * The text to set on the button\n *\n * @param {string} [options.className]\n * A class or space separated list of classes to add the component\n *\n */\n function ClickableComponent(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n\n if (_this.options_.controlText) {\n _this.controlText(_this.options_.controlText);\n }\n\n _this.handleMouseOver_ = function (e) {\n return _this.handleMouseOver(e);\n };\n\n _this.handleMouseOut_ = function (e) {\n return _this.handleMouseOut(e);\n };\n\n _this.handleClick_ = function (e) {\n return _this.handleClick(e);\n };\n\n _this.handleKeyDown_ = function (e) {\n return _this.handleKeyDown(e);\n };\n\n _this.emitTapEvents();\n\n _this.enable();\n\n return _this;\n }\n /**\n * Create the `ClickableComponent`s DOM element.\n *\n * @param {string} [tag=div]\n * The element's node type.\n *\n * @param {Object} [props={}]\n * An object of properties that should be set on the element.\n *\n * @param {Object} [attributes={}]\n * An object of attributes that should be set on the element.\n *\n * @return {Element}\n * The element that gets created.\n */\n\n\n var _proto = ClickableComponent.prototype;\n\n _proto.createEl = function createEl$1(tag, props, attributes) {\n if (tag === void 0) {\n tag = 'div';\n }\n\n if (props === void 0) {\n props = {};\n }\n\n if (attributes === void 0) {\n attributes = {};\n }\n\n props = assign({\n className: this.buildCSSClass(),\n tabIndex: 0\n }, props);\n\n if (tag === 'button') {\n log$1.error(\"Creating a ClickableComponent with an HTML element of \" + tag + \" is not supported; use a Button instead.\");\n } // Add ARIA attributes for clickable element which is not a native HTML button\n\n\n attributes = assign({\n role: 'button'\n }, attributes);\n this.tabIndex_ = props.tabIndex;\n var el = createEl(tag, props, attributes);\n el.appendChild(createEl('span', {\n className: 'vjs-icon-placeholder'\n }, {\n 'aria-hidden': true\n }));\n this.createControlTextEl(el);\n return el;\n };\n\n _proto.dispose = function dispose() {\n // remove controlTextEl_ on dispose\n this.controlTextEl_ = null;\n\n _Component.prototype.dispose.call(this);\n }\n /**\n * Create a control text element on this `ClickableComponent`\n *\n * @param {Element} [el]\n * Parent element for the control text.\n *\n * @return {Element}\n * The control text element that gets created.\n */\n ;\n\n _proto.createControlTextEl = function createControlTextEl(el) {\n this.controlTextEl_ = createEl('span', {\n className: 'vjs-control-text'\n }, {\n // let the screen reader user know that the text of the element may change\n 'aria-live': 'polite'\n });\n\n if (el) {\n el.appendChild(this.controlTextEl_);\n }\n\n this.controlText(this.controlText_, el);\n return this.controlTextEl_;\n }\n /**\n * Get or set the localize text to use for the controls on the `ClickableComponent`.\n *\n * @param {string} [text]\n * Control text for element.\n *\n * @param {Element} [el=this.el()]\n * Element to set the title on.\n *\n * @return {string}\n * - The control text when getting\n */\n ;\n\n _proto.controlText = function controlText(text, el) {\n if (el === void 0) {\n el = this.el();\n }\n\n if (text === undefined) {\n return this.controlText_ || 'Need Text';\n }\n\n var localizedText = this.localize(text);\n this.controlText_ = text;\n textContent(this.controlTextEl_, localizedText);\n\n if (!this.nonIconControl && !this.player_.options_.noUITitleAttributes) {\n // Set title attribute if only an icon is shown\n el.setAttribute('title', localizedText);\n }\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n ;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-control vjs-button \" + _Component.prototype.buildCSSClass.call(this);\n }\n /**\n * Enable this `ClickableComponent`\n */\n ;\n\n _proto.enable = function enable() {\n if (!this.enabled_) {\n this.enabled_ = true;\n this.removeClass('vjs-disabled');\n this.el_.setAttribute('aria-disabled', 'false');\n\n if (typeof this.tabIndex_ !== 'undefined') {\n this.el_.setAttribute('tabIndex', this.tabIndex_);\n }\n\n this.on(['tap', 'click'], this.handleClick_);\n this.on('keydown', this.handleKeyDown_);\n }\n }\n /**\n * Disable this `ClickableComponent`\n */\n ;\n\n _proto.disable = function disable() {\n this.enabled_ = false;\n this.addClass('vjs-disabled');\n this.el_.setAttribute('aria-disabled', 'true');\n\n if (typeof this.tabIndex_ !== 'undefined') {\n this.el_.removeAttribute('tabIndex');\n }\n\n this.off('mouseover', this.handleMouseOver_);\n this.off('mouseout', this.handleMouseOut_);\n this.off(['tap', 'click'], this.handleClick_);\n this.off('keydown', this.handleKeyDown_);\n }\n /**\n * Handles language change in ClickableComponent for the player in components\n *\n *\n */\n ;\n\n _proto.handleLanguagechange = function handleLanguagechange() {\n this.controlText(this.controlText_);\n }\n /**\n * Event handler that is called when a `ClickableComponent` receives a\n * `click` or `tap` event.\n *\n * @param {EventTarget~Event} event\n * The `tap` or `click` event that caused this function to be called.\n *\n * @listens tap\n * @listens click\n * @abstract\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n if (this.options_.clickHandler) {\n this.options_.clickHandler.call(this, arguments);\n }\n }\n /**\n * Event handler that is called when a `ClickableComponent` receives a\n * `keydown` event.\n *\n * By default, if the key is Space or Enter, it will trigger a `click` event.\n *\n * @param {EventTarget~Event} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n // Support Space or Enter key operation to fire a click event. Also,\n // prevent the event from propagating through the DOM and triggering\n // Player hotkeys.\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Space') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Enter')) {\n event.preventDefault();\n event.stopPropagation();\n this.trigger('click');\n } else {\n // Pass keypress handling up for unsupported keys\n _Component.prototype.handleKeyDown.call(this, event);\n }\n };\n\n return ClickableComponent;\n}(Component$1);\n\nComponent$1.registerComponent('ClickableComponent', ClickableComponent);\n\n/**\n * A `ClickableComponent` that handles showing the poster image for the player.\n *\n * @extends ClickableComponent\n */\n\nvar PosterImage = /*#__PURE__*/function (_ClickableComponent) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(PosterImage, _ClickableComponent);\n\n /**\n * Create an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should attach to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function PosterImage(player, options) {\n var _this;\n\n _this = _ClickableComponent.call(this, player, options) || this;\n\n _this.update();\n\n _this.update_ = function (e) {\n return _this.update(e);\n };\n\n player.on('posterchange', _this.update_);\n return _this;\n }\n /**\n * Clean up and dispose of the `PosterImage`.\n */\n\n\n var _proto = PosterImage.prototype;\n\n _proto.dispose = function dispose() {\n this.player().off('posterchange', this.update_);\n\n _ClickableComponent.prototype.dispose.call(this);\n }\n /**\n * Create the `PosterImage`s DOM element.\n *\n * @return {Element}\n * The element that gets created.\n */\n ;\n\n _proto.createEl = function createEl$1() {\n var el = createEl('div', {\n className: 'vjs-poster',\n // Don't want poster to be tabbable.\n tabIndex: -1\n });\n return el;\n }\n /**\n * An {@link EventTarget~EventListener} for {@link Player#posterchange} events.\n *\n * @listens Player#posterchange\n *\n * @param {EventTarget~Event} [event]\n * The `Player#posterchange` event that triggered this function.\n */\n ;\n\n _proto.update = function update(event) {\n var url = this.player().poster();\n this.setSrc(url); // If there's no poster source we should display:none on this component\n // so it's not still clickable or right-clickable\n\n if (url) {\n this.show();\n } else {\n this.hide();\n }\n }\n /**\n * Set the source of the `PosterImage` depending on the display method.\n *\n * @param {string} url\n * The URL to the source for the `PosterImage`.\n */\n ;\n\n _proto.setSrc = function setSrc(url) {\n var backgroundImage = ''; // Any falsy value should stay as an empty string, otherwise\n // this will throw an extra error\n\n if (url) {\n backgroundImage = \"url(\\\"\" + url + \"\\\")\";\n }\n\n this.el_.style.backgroundImage = backgroundImage;\n }\n /**\n * An {@link EventTarget~EventListener} for clicks on the `PosterImage`. See\n * {@link ClickableComponent#handleClick} for instances where this will be triggered.\n *\n * @listens tap\n * @listens click\n * @listens keydown\n *\n * @param {EventTarget~Event} event\n + The `click`, `tap` or `keydown` event that caused this function to be called.\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n // We don't want a click to trigger playback when controls are disabled\n if (!this.player_.controls()) {\n return;\n }\n\n var sourceIsEncrypted = this.player_.usingPlugin('eme') && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;\n\n if (this.player_.tech(true) && // We've observed a bug in IE and Edge when playing back DRM content where\n // calling .focus() on the video element causes the video to go black,\n // so we avoid it in that specific case\n !((IE_VERSION || IS_EDGE) && sourceIsEncrypted)) {\n this.player_.tech(true).focus();\n }\n\n if (this.player_.paused()) {\n silencePromise(this.player_.play());\n } else {\n this.player_.pause();\n }\n };\n\n return PosterImage;\n}(ClickableComponent);\n\nComponent$1.registerComponent('PosterImage', PosterImage);\n\nvar darkGray = '#222';\nvar lightGray = '#ccc';\nvar fontMap = {\n monospace: 'monospace',\n sansSerif: 'sans-serif',\n serif: 'serif',\n monospaceSansSerif: '\"Andale Mono\", \"Lucida Console\", monospace',\n monospaceSerif: '\"Courier New\", monospace',\n proportionalSansSerif: 'sans-serif',\n proportionalSerif: 'serif',\n casual: '\"Comic Sans MS\", Impact, fantasy',\n script: '\"Monotype Corsiva\", cursive',\n smallcaps: '\"Andale Mono\", \"Lucida Console\", monospace, sans-serif'\n};\n/**\n * Construct an rgba color from a given hex color code.\n *\n * @param {number} color\n * Hex number for color, like #f0e or #f604e2.\n *\n * @param {number} opacity\n * Value for opacity, 0.0 - 1.0.\n *\n * @return {string}\n * The rgba color that was created, like 'rgba(255, 0, 0, 0.3)'.\n */\n\nfunction constructColor(color, opacity) {\n var hex;\n\n if (color.length === 4) {\n // color looks like \"#f0e\"\n hex = color[1] + color[1] + color[2] + color[2] + color[3] + color[3];\n } else if (color.length === 7) {\n // color looks like \"#f604e2\"\n hex = color.slice(1);\n } else {\n throw new Error('Invalid color code provided, ' + color + '; must be formatted as e.g. #f0e or #f604e2.');\n }\n\n return 'rgba(' + parseInt(hex.slice(0, 2), 16) + ',' + parseInt(hex.slice(2, 4), 16) + ',' + parseInt(hex.slice(4, 6), 16) + ',' + opacity + ')';\n}\n/**\n * Try to update the style of a DOM element. Some style changes will throw an error,\n * particularly in IE8. Those should be noops.\n *\n * @param {Element} el\n * The DOM element to be styled.\n *\n * @param {string} style\n * The CSS property on the element that should be styled.\n *\n * @param {string} rule\n * The style rule that should be applied to the property.\n *\n * @private\n */\n\nfunction tryUpdateStyle(el, style, rule) {\n try {\n el.style[style] = rule;\n } catch (e) {\n // Satisfies linter.\n return;\n }\n}\n/**\n * The component for displaying text track cues.\n *\n * @extends Component\n */\n\n\nvar TextTrackDisplay = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TextTrackDisplay, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} [ready]\n * The function to call when `TextTrackDisplay` is ready.\n */\n function TextTrackDisplay(player, options, ready) {\n var _this;\n\n _this = _Component.call(this, player, options, ready) || this;\n\n var updateDisplayHandler = function updateDisplayHandler(e) {\n return _this.updateDisplay(e);\n };\n\n player.on('loadstart', function (e) {\n return _this.toggleDisplay(e);\n });\n player.on('texttrackchange', updateDisplayHandler);\n player.on('loadedmetadata', function (e) {\n return _this.preselectTrack(e);\n }); // This used to be called during player init, but was causing an error\n // if a track should show by default and the display hadn't loaded yet.\n // Should probably be moved to an external track loader when we support\n // tracks that don't need a display.\n\n player.ready(bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), function () {\n if (player.tech_ && player.tech_.featuresNativeTextTracks) {\n this.hide();\n return;\n }\n\n player.on('fullscreenchange', updateDisplayHandler);\n player.on('playerresize', updateDisplayHandler);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().addEventListener('orientationchange', updateDisplayHandler);\n player.on('dispose', function () {\n return global_window__WEBPACK_IMPORTED_MODULE_0___default().removeEventListener('orientationchange', updateDisplayHandler);\n });\n var tracks = this.options_.playerOptions.tracks || [];\n\n for (var i = 0; i < tracks.length; i++) {\n this.player_.addRemoteTextTrack(tracks[i], true);\n }\n\n this.preselectTrack();\n }));\n return _this;\n }\n /**\n * Preselect a track following this precedence:\n * - matches the previously selected {@link TextTrack}'s language and kind\n * - matches the previously selected {@link TextTrack}'s language only\n * - is the first default captions track\n * - is the first default descriptions track\n *\n * @listens Player#loadstart\n */\n\n\n var _proto = TextTrackDisplay.prototype;\n\n _proto.preselectTrack = function preselectTrack() {\n var modes = {\n captions: 1,\n subtitles: 1\n };\n var trackList = this.player_.textTracks();\n var userPref = this.player_.cache_.selectedLanguage;\n var firstDesc;\n var firstCaptions;\n var preferredTrack;\n\n for (var i = 0; i < trackList.length; i++) {\n var track = trackList[i];\n\n if (userPref && userPref.enabled && userPref.language && userPref.language === track.language && track.kind in modes) {\n // Always choose the track that matches both language and kind\n if (track.kind === userPref.kind) {\n preferredTrack = track; // or choose the first track that matches language\n } else if (!preferredTrack) {\n preferredTrack = track;\n } // clear everything if offTextTrackMenuItem was clicked\n\n } else if (userPref && !userPref.enabled) {\n preferredTrack = null;\n firstDesc = null;\n firstCaptions = null;\n } else if (track[\"default\"]) {\n if (track.kind === 'descriptions' && !firstDesc) {\n firstDesc = track;\n } else if (track.kind in modes && !firstCaptions) {\n firstCaptions = track;\n }\n }\n } // The preferredTrack matches the user preference and takes\n // precedence over all the other tracks.\n // So, display the preferredTrack before the first default track\n // and the subtitles/captions track before the descriptions track\n\n\n if (preferredTrack) {\n preferredTrack.mode = 'showing';\n } else if (firstCaptions) {\n firstCaptions.mode = 'showing';\n } else if (firstDesc) {\n firstDesc.mode = 'showing';\n }\n }\n /**\n * Turn display of {@link TextTrack}'s from the current state into the other state.\n * There are only two states:\n * - 'shown'\n * - 'hidden'\n *\n * @listens Player#loadstart\n */\n ;\n\n _proto.toggleDisplay = function toggleDisplay() {\n if (this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks) {\n this.hide();\n } else {\n this.show();\n }\n }\n /**\n * Create the {@link Component}'s DOM element.\n *\n * @return {Element}\n * The element that was created.\n */\n ;\n\n _proto.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-text-track-display'\n }, {\n 'translate': 'yes',\n 'aria-live': 'off',\n 'aria-atomic': 'true'\n });\n }\n /**\n * Clear all displayed {@link TextTrack}s.\n */\n ;\n\n _proto.clearDisplay = function clearDisplay() {\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) === 'function') {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT.processCues((global_window__WEBPACK_IMPORTED_MODULE_0___default()), [], this.el_);\n }\n }\n /**\n * Update the displayed TextTrack when a either a {@link Player#texttrackchange} or\n * a {@link Player#fullscreenchange} is fired.\n *\n * @listens Player#texttrackchange\n * @listens Player#fullscreenchange\n */\n ;\n\n _proto.updateDisplay = function updateDisplay() {\n var tracks = this.player_.textTracks();\n var allowMultipleShowingTracks = this.options_.allowMultipleShowingTracks;\n this.clearDisplay();\n\n if (allowMultipleShowingTracks) {\n var showingTracks = [];\n\n for (var _i = 0; _i < tracks.length; ++_i) {\n var track = tracks[_i];\n\n if (track.mode !== 'showing') {\n continue;\n }\n\n showingTracks.push(track);\n }\n\n this.updateForTrack(showingTracks);\n return;\n } // Track display prioritization model: if multiple tracks are 'showing',\n // display the first 'subtitles' or 'captions' track which is 'showing',\n // otherwise display the first 'descriptions' track which is 'showing'\n\n\n var descriptionsTrack = null;\n var captionsSubtitlesTrack = null;\n var i = tracks.length;\n\n while (i--) {\n var _track = tracks[i];\n\n if (_track.mode === 'showing') {\n if (_track.kind === 'descriptions') {\n descriptionsTrack = _track;\n } else {\n captionsSubtitlesTrack = _track;\n }\n }\n }\n\n if (captionsSubtitlesTrack) {\n if (this.getAttribute('aria-live') !== 'off') {\n this.setAttribute('aria-live', 'off');\n }\n\n this.updateForTrack(captionsSubtitlesTrack);\n } else if (descriptionsTrack) {\n if (this.getAttribute('aria-live') !== 'assertive') {\n this.setAttribute('aria-live', 'assertive');\n }\n\n this.updateForTrack(descriptionsTrack);\n }\n }\n /**\n * Style {@Link TextTrack} activeCues according to {@Link TextTrackSettings}.\n *\n * @param {TextTrack} track\n * Text track object containing active cues to style.\n */\n ;\n\n _proto.updateDisplayState = function updateDisplayState(track) {\n var overrides = this.player_.textTrackSettings.getValues();\n var cues = track.activeCues;\n var i = cues.length;\n\n while (i--) {\n var cue = cues[i];\n\n if (!cue) {\n continue;\n }\n\n var cueDiv = cue.displayState;\n\n if (overrides.color) {\n cueDiv.firstChild.style.color = overrides.color;\n }\n\n if (overrides.textOpacity) {\n tryUpdateStyle(cueDiv.firstChild, 'color', constructColor(overrides.color || '#fff', overrides.textOpacity));\n }\n\n if (overrides.backgroundColor) {\n cueDiv.firstChild.style.backgroundColor = overrides.backgroundColor;\n }\n\n if (overrides.backgroundOpacity) {\n tryUpdateStyle(cueDiv.firstChild, 'backgroundColor', constructColor(overrides.backgroundColor || '#000', overrides.backgroundOpacity));\n }\n\n if (overrides.windowColor) {\n if (overrides.windowOpacity) {\n tryUpdateStyle(cueDiv, 'backgroundColor', constructColor(overrides.windowColor, overrides.windowOpacity));\n } else {\n cueDiv.style.backgroundColor = overrides.windowColor;\n }\n }\n\n if (overrides.edgeStyle) {\n if (overrides.edgeStyle === 'dropshadow') {\n cueDiv.firstChild.style.textShadow = \"2px 2px 3px \" + darkGray + \", 2px 2px 4px \" + darkGray + \", 2px 2px 5px \" + darkGray;\n } else if (overrides.edgeStyle === 'raised') {\n cueDiv.firstChild.style.textShadow = \"1px 1px \" + darkGray + \", 2px 2px \" + darkGray + \", 3px 3px \" + darkGray;\n } else if (overrides.edgeStyle === 'depressed') {\n cueDiv.firstChild.style.textShadow = \"1px 1px \" + lightGray + \", 0 1px \" + lightGray + \", -1px -1px \" + darkGray + \", 0 -1px \" + darkGray;\n } else if (overrides.edgeStyle === 'uniform') {\n cueDiv.firstChild.style.textShadow = \"0 0 4px \" + darkGray + \", 0 0 4px \" + darkGray + \", 0 0 4px \" + darkGray + \", 0 0 4px \" + darkGray;\n }\n }\n\n if (overrides.fontPercent && overrides.fontPercent !== 1) {\n var fontSize = global_window__WEBPACK_IMPORTED_MODULE_0___default().parseFloat(cueDiv.style.fontSize);\n cueDiv.style.fontSize = fontSize * overrides.fontPercent + 'px';\n cueDiv.style.height = 'auto';\n cueDiv.style.top = 'auto';\n }\n\n if (overrides.fontFamily && overrides.fontFamily !== 'default') {\n if (overrides.fontFamily === 'small-caps') {\n cueDiv.firstChild.style.fontVariant = 'small-caps';\n } else {\n cueDiv.firstChild.style.fontFamily = fontMap[overrides.fontFamily];\n }\n }\n }\n }\n /**\n * Add an {@link TextTrack} to to the {@link Tech}s {@link TextTrackList}.\n *\n * @param {TextTrack|TextTrack[]} tracks\n * Text track object or text track array to be added to the list.\n */\n ;\n\n _proto.updateForTrack = function updateForTrack(tracks) {\n if (!Array.isArray(tracks)) {\n tracks = [tracks];\n }\n\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) !== 'function' || tracks.every(function (track) {\n return !track.activeCues;\n })) {\n return;\n }\n\n var cues = []; // push all active track cues\n\n for (var i = 0; i < tracks.length; ++i) {\n var track = tracks[i];\n\n for (var j = 0; j < track.activeCues.length; ++j) {\n cues.push(track.activeCues[j]);\n }\n } // removes all cues before it processes new ones\n\n\n global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT.processCues((global_window__WEBPACK_IMPORTED_MODULE_0___default()), cues, this.el_); // add unique class to each language text track & add settings styling if necessary\n\n for (var _i2 = 0; _i2 < tracks.length; ++_i2) {\n var _track2 = tracks[_i2];\n\n for (var _j = 0; _j < _track2.activeCues.length; ++_j) {\n var cueEl = _track2.activeCues[_j].displayState;\n addClass(cueEl, 'vjs-text-track-cue');\n addClass(cueEl, 'vjs-text-track-cue-' + (_track2.language ? _track2.language : _i2));\n\n if (_track2.language) {\n setAttribute(cueEl, 'lang', _track2.language);\n }\n }\n\n if (this.player_.textTrackSettings) {\n this.updateDisplayState(_track2);\n }\n }\n };\n\n return TextTrackDisplay;\n}(Component$1);\n\nComponent$1.registerComponent('TextTrackDisplay', TextTrackDisplay);\n\n/**\n * A loading spinner for use during waiting/loading events.\n *\n * @extends Component\n */\n\nvar LoadingSpinner = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(LoadingSpinner, _Component);\n\n function LoadingSpinner() {\n return _Component.apply(this, arguments) || this;\n }\n\n var _proto = LoadingSpinner.prototype;\n\n /**\n * Create the `LoadingSpinner`s DOM element.\n *\n * @return {Element}\n * The dom element that gets created.\n */\n _proto.createEl = function createEl$1() {\n var isAudio = this.player_.isAudio();\n var playerType = this.localize(isAudio ? 'Audio Player' : 'Video Player');\n var controlText = createEl('span', {\n className: 'vjs-control-text',\n textContent: this.localize('{1} is loading.', [playerType])\n });\n\n var el = _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-loading-spinner',\n dir: 'ltr'\n });\n\n el.appendChild(controlText);\n return el;\n };\n\n return LoadingSpinner;\n}(Component$1);\n\nComponent$1.registerComponent('LoadingSpinner', LoadingSpinner);\n\n/**\n * Base class for all buttons.\n *\n * @extends ClickableComponent\n */\n\nvar Button = /*#__PURE__*/function (_ClickableComponent) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(Button, _ClickableComponent);\n\n function Button() {\n return _ClickableComponent.apply(this, arguments) || this;\n }\n\n var _proto = Button.prototype;\n\n /**\n * Create the `Button`s DOM element.\n *\n * @param {string} [tag=\"button\"]\n * The element's node type. This argument is IGNORED: no matter what\n * is passed, it will always create a `button` element.\n *\n * @param {Object} [props={}]\n * An object of properties that should be set on the element.\n *\n * @param {Object} [attributes={}]\n * An object of attributes that should be set on the element.\n *\n * @return {Element}\n * The element that gets created.\n */\n _proto.createEl = function createEl$1(tag, props, attributes) {\n if (props === void 0) {\n props = {};\n }\n\n if (attributes === void 0) {\n attributes = {};\n }\n\n tag = 'button';\n props = assign({\n className: this.buildCSSClass()\n }, props); // Add attributes for button element\n\n attributes = assign({\n // Necessary since the default button type is \"submit\"\n type: 'button'\n }, attributes);\n\n var el = createEl(tag, props, attributes);\n\n el.appendChild(createEl('span', {\n className: 'vjs-icon-placeholder'\n }, {\n 'aria-hidden': true\n }));\n this.createControlTextEl(el);\n return el;\n }\n /**\n * Add a child `Component` inside of this `Button`.\n *\n * @param {string|Component} child\n * The name or instance of a child to add.\n *\n * @param {Object} [options={}]\n * The key/value store of options that will get passed to children of\n * the child.\n *\n * @return {Component}\n * The `Component` that gets added as a child. When using a string the\n * `Component` will get created by this process.\n *\n * @deprecated since version 5\n */\n ;\n\n _proto.addChild = function addChild(child, options) {\n if (options === void 0) {\n options = {};\n }\n\n var className = this.constructor.name;\n log$1.warn(\"Adding an actionable (user controllable) child to a Button (\" + className + \") is not supported; use a ClickableComponent instead.\"); // Avoid the error message generated by ClickableComponent's addChild method\n\n return Component$1.prototype.addChild.call(this, child, options);\n }\n /**\n * Enable the `Button` element so that it can be activated or clicked. Use this with\n * {@link Button#disable}.\n */\n ;\n\n _proto.enable = function enable() {\n _ClickableComponent.prototype.enable.call(this);\n\n this.el_.removeAttribute('disabled');\n }\n /**\n * Disable the `Button` element so that it cannot be activated or clicked. Use this with\n * {@link Button#enable}.\n */\n ;\n\n _proto.disable = function disable() {\n _ClickableComponent.prototype.disable.call(this);\n\n this.el_.setAttribute('disabled', 'disabled');\n }\n /**\n * This gets called when a `Button` has focus and `keydown` is triggered via a key\n * press.\n *\n * @param {EventTarget~Event} event\n * The event that caused this function to get called.\n *\n * @listens keydown\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n // Ignore Space or Enter key operation, which is handled by the browser for\n // a button - though not for its super class, ClickableComponent. Also,\n // prevent the event from propagating through the DOM and triggering Player\n // hotkeys. We do not preventDefault here because we _want_ the browser to\n // handle it.\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Space') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Enter')) {\n event.stopPropagation();\n return;\n } // Pass keypress handling up for unsupported keys\n\n\n _ClickableComponent.prototype.handleKeyDown.call(this, event);\n };\n\n return Button;\n}(ClickableComponent);\n\nComponent$1.registerComponent('Button', Button);\n\n/**\n * The initial play button that shows before the video has played. The hiding of the\n * `BigPlayButton` get done via CSS and `Player` states.\n *\n * @extends Button\n */\n\nvar BigPlayButton = /*#__PURE__*/function (_Button) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(BigPlayButton, _Button);\n\n function BigPlayButton(player, options) {\n var _this;\n\n _this = _Button.call(this, player, options) || this;\n _this.mouseused_ = false;\n\n _this.on('mousedown', function (e) {\n return _this.handleMouseDown(e);\n });\n\n return _this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object. Always returns 'vjs-big-play-button'.\n */\n\n\n var _proto = BigPlayButton.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return 'vjs-big-play-button';\n }\n /**\n * This gets called when a `BigPlayButton` \"clicked\". See {@link ClickableComponent}\n * for more detailed information on what a click can be.\n *\n * @param {EventTarget~Event} event\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n var playPromise = this.player_.play(); // exit early if clicked via the mouse\n\n if (this.mouseused_ && event.clientX && event.clientY) {\n var sourceIsEncrypted = this.player_.usingPlugin('eme') && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;\n silencePromise(playPromise);\n\n if (this.player_.tech(true) && // We've observed a bug in IE and Edge when playing back DRM content where\n // calling .focus() on the video element causes the video to go black,\n // so we avoid it in that specific case\n !((IE_VERSION || IS_EDGE) && sourceIsEncrypted)) {\n this.player_.tech(true).focus();\n }\n\n return;\n }\n\n var cb = this.player_.getChild('controlBar');\n var playToggle = cb && cb.getChild('playToggle');\n\n if (!playToggle) {\n this.player_.tech(true).focus();\n return;\n }\n\n var playFocus = function playFocus() {\n return playToggle.focus();\n };\n\n if (isPromise(playPromise)) {\n playPromise.then(playFocus, function () {});\n } else {\n this.setTimeout(playFocus, 1);\n }\n };\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n this.mouseused_ = false;\n\n _Button.prototype.handleKeyDown.call(this, event);\n };\n\n _proto.handleMouseDown = function handleMouseDown(event) {\n this.mouseused_ = true;\n };\n\n return BigPlayButton;\n}(Button);\n/**\n * The text that should display over the `BigPlayButton`s controls. Added to for localization.\n *\n * @type {string}\n * @private\n */\n\n\nBigPlayButton.prototype.controlText_ = 'Play Video';\nComponent$1.registerComponent('BigPlayButton', BigPlayButton);\n\n/**\n * The `CloseButton` is a `{@link Button}` that fires a `close` event when\n * it gets clicked.\n *\n * @extends Button\n */\n\nvar CloseButton = /*#__PURE__*/function (_Button) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(CloseButton, _Button);\n\n /**\n * Creates an instance of the this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function CloseButton(player, options) {\n var _this;\n\n _this = _Button.call(this, player, options) || this;\n\n _this.controlText(options && options.controlText || _this.localize('Close'));\n\n return _this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = CloseButton.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-close-button \" + _Button.prototype.buildCSSClass.call(this);\n }\n /**\n * This gets called when a `CloseButton` gets clicked. See\n * {@link ClickableComponent#handleClick} for more information on when\n * this will be triggered\n *\n * @param {EventTarget~Event} event\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n * @fires CloseButton#close\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n /**\n * Triggered when the a `CloseButton` is clicked.\n *\n * @event CloseButton#close\n * @type {EventTarget~Event}\n *\n * @property {boolean} [bubbles=false]\n * set to false so that the close event does not\n * bubble up to parents if there is no listener\n */\n this.trigger({\n type: 'close',\n bubbles: false\n });\n }\n /**\n * Event handler that is called when a `CloseButton` receives a\n * `keydown` event.\n *\n * By default, if the key is Esc, it will trigger a `click` event.\n *\n * @param {EventTarget~Event} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n // Esc button will trigger `click` event\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Esc')) {\n event.preventDefault();\n event.stopPropagation();\n this.trigger('click');\n } else {\n // Pass keypress handling up for unsupported keys\n _Button.prototype.handleKeyDown.call(this, event);\n }\n };\n\n return CloseButton;\n}(Button);\n\nComponent$1.registerComponent('CloseButton', CloseButton);\n\n/**\n * Button to toggle between play and pause.\n *\n * @extends Button\n */\n\nvar PlayToggle = /*#__PURE__*/function (_Button) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(PlayToggle, _Button);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n function PlayToggle(player, options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Button.call(this, player, options) || this; // show or hide replay icon\n\n options.replay = options.replay === undefined || options.replay;\n\n _this.on(player, 'play', function (e) {\n return _this.handlePlay(e);\n });\n\n _this.on(player, 'pause', function (e) {\n return _this.handlePause(e);\n });\n\n if (options.replay) {\n _this.on(player, 'ended', function (e) {\n return _this.handleEnded(e);\n });\n }\n\n return _this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = PlayToggle.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-play-control \" + _Button.prototype.buildCSSClass.call(this);\n }\n /**\n * This gets called when an `PlayToggle` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {EventTarget~Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n if (this.player_.paused()) {\n silencePromise(this.player_.play());\n } else {\n this.player_.pause();\n }\n }\n /**\n * This gets called once after the video has ended and the user seeks so that\n * we can change the replay button back to a play button.\n *\n * @param {EventTarget~Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#seeked\n */\n ;\n\n _proto.handleSeeked = function handleSeeked(event) {\n this.removeClass('vjs-ended');\n\n if (this.player_.paused()) {\n this.handlePause(event);\n } else {\n this.handlePlay(event);\n }\n }\n /**\n * Add the vjs-playing class to the element so it can change appearance.\n *\n * @param {EventTarget~Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#play\n */\n ;\n\n _proto.handlePlay = function handlePlay(event) {\n this.removeClass('vjs-ended');\n this.removeClass('vjs-paused');\n this.addClass('vjs-playing'); // change the button text to \"Pause\"\n\n this.controlText('Pause');\n }\n /**\n * Add the vjs-paused class to the element so it can change appearance.\n *\n * @param {EventTarget~Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#pause\n */\n ;\n\n _proto.handlePause = function handlePause(event) {\n this.removeClass('vjs-playing');\n this.addClass('vjs-paused'); // change the button text to \"Play\"\n\n this.controlText('Play');\n }\n /**\n * Add the vjs-ended class to the element so it can change appearance\n *\n * @param {EventTarget~Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#ended\n */\n ;\n\n _proto.handleEnded = function handleEnded(event) {\n var _this2 = this;\n\n this.removeClass('vjs-playing');\n this.addClass('vjs-ended'); // change the button text to \"Replay\"\n\n this.controlText('Replay'); // on the next seek remove the replay button\n\n this.one(this.player_, 'seeked', function (e) {\n return _this2.handleSeeked(e);\n });\n };\n\n return PlayToggle;\n}(Button);\n/**\n * The text that should display over the `PlayToggle`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\n\n\nPlayToggle.prototype.controlText_ = 'Play';\nComponent$1.registerComponent('PlayToggle', PlayToggle);\n\n/**\n * @file format-time.js\n * @module format-time\n */\n\n/**\n * Format seconds as a time string, H:MM:SS or M:SS. Supplying a guide (in\n * seconds) will force a number of leading zeros to cover the length of the\n * guide.\n *\n * @private\n * @param {number} seconds\n * Number of seconds to be turned into a string\n *\n * @param {number} guide\n * Number (in seconds) to model the string after\n *\n * @return {string}\n * Time formatted as H:MM:SS or M:SS\n */\nvar defaultImplementation = function defaultImplementation(seconds, guide) {\n seconds = seconds < 0 ? 0 : seconds;\n var s = Math.floor(seconds % 60);\n var m = Math.floor(seconds / 60 % 60);\n var h = Math.floor(seconds / 3600);\n var gm = Math.floor(guide / 60 % 60);\n var gh = Math.floor(guide / 3600); // handle invalid times\n\n if (isNaN(seconds) || seconds === Infinity) {\n // '-' is false for all relational operators (e.g. <, >=) so this setting\n // will add the minimum number of fields specified by the guide\n h = m = s = '-';\n } // Check if we need to show hours\n\n\n h = h > 0 || gh > 0 ? h + ':' : ''; // If hours are showing, we may need to add a leading zero.\n // Always show at least one digit of minutes.\n\n m = ((h || gm >= 10) && m < 10 ? '0' + m : m) + ':'; // Check if leading zero is need for seconds\n\n s = s < 10 ? '0' + s : s;\n return h + m + s;\n}; // Internal pointer to the current implementation.\n\n\nvar implementation = defaultImplementation;\n/**\n * Replaces the default formatTime implementation with a custom implementation.\n *\n * @param {Function} customImplementation\n * A function which will be used in place of the default formatTime\n * implementation. Will receive the current time in seconds and the\n * guide (in seconds) as arguments.\n */\n\nfunction setFormatTime(customImplementation) {\n implementation = customImplementation;\n}\n/**\n * Resets formatTime to the default implementation.\n */\n\nfunction resetFormatTime() {\n implementation = defaultImplementation;\n}\n/**\n * Delegates to either the default time formatting function or a custom\n * function supplied via `setFormatTime`.\n *\n * Formats seconds as a time string (H:MM:SS or M:SS). Supplying a\n * guide (in seconds) will force a number of leading zeros to cover the\n * length of the guide.\n *\n * @static\n * @example formatTime(125, 600) === \"02:05\"\n * @param {number} seconds\n * Number of seconds to be turned into a string\n *\n * @param {number} guide\n * Number (in seconds) to model the string after\n *\n * @return {string}\n * Time formatted as H:MM:SS or M:SS\n */\n\nfunction formatTime(seconds, guide) {\n if (guide === void 0) {\n guide = seconds;\n }\n\n return implementation(seconds, guide);\n}\n\n/**\n * Displays time information about the video\n *\n * @extends Component\n */\n\nvar TimeDisplay = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TimeDisplay, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function TimeDisplay(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n\n _this.on(player, ['timeupdate', 'ended'], function (e) {\n return _this.updateContent(e);\n });\n\n _this.updateTextNode_();\n\n return _this;\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = TimeDisplay.prototype;\n\n _proto.createEl = function createEl$1() {\n var className = this.buildCSSClass();\n\n var el = _Component.prototype.createEl.call(this, 'div', {\n className: className + \" vjs-time-control vjs-control\"\n });\n\n var span = createEl('span', {\n className: 'vjs-control-text',\n textContent: this.localize(this.labelText_) + \"\\xA0\"\n }, {\n role: 'presentation'\n });\n el.appendChild(span);\n this.contentEl_ = createEl('span', {\n className: className + \"-display\"\n }, {\n // tell screen readers not to automatically read the time as it changes\n 'aria-live': 'off',\n // span elements have no implicit role, but some screen readers (notably VoiceOver)\n // treat them as a break between items in the DOM when using arrow keys\n // (or left-to-right swipes on iOS) to read contents of a page. Using\n // role='presentation' causes VoiceOver to NOT treat this span as a break.\n 'role': 'presentation'\n });\n el.appendChild(this.contentEl_);\n return el;\n };\n\n _proto.dispose = function dispose() {\n this.contentEl_ = null;\n this.textNode_ = null;\n\n _Component.prototype.dispose.call(this);\n }\n /**\n * Updates the time display text node with a new time\n *\n * @param {number} [time=0] the time to update to\n *\n * @private\n */\n ;\n\n _proto.updateTextNode_ = function updateTextNode_(time) {\n var _this2 = this;\n\n if (time === void 0) {\n time = 0;\n }\n\n time = formatTime(time);\n\n if (this.formattedTime_ === time) {\n return;\n }\n\n this.formattedTime_ = time;\n this.requestNamedAnimationFrame('TimeDisplay#updateTextNode_', function () {\n if (!_this2.contentEl_) {\n return;\n }\n\n var oldNode = _this2.textNode_;\n\n if (oldNode && _this2.contentEl_.firstChild !== oldNode) {\n oldNode = null;\n log$1.warn('TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.');\n }\n\n _this2.textNode_ = global_document__WEBPACK_IMPORTED_MODULE_1___default().createTextNode(_this2.formattedTime_);\n\n if (!_this2.textNode_) {\n return;\n }\n\n if (oldNode) {\n _this2.contentEl_.replaceChild(_this2.textNode_, oldNode);\n } else {\n _this2.contentEl_.appendChild(_this2.textNode_);\n }\n });\n }\n /**\n * To be filled out in the child class, should update the displayed time\n * in accordance with the fact that the current time has changed.\n *\n * @param {EventTarget~Event} [event]\n * The `timeupdate` event that caused this to run.\n *\n * @listens Player#timeupdate\n */\n ;\n\n _proto.updateContent = function updateContent(event) {};\n\n return TimeDisplay;\n}(Component$1);\n/**\n * The text that is added to the `TimeDisplay` for screen reader users.\n *\n * @type {string}\n * @private\n */\n\n\nTimeDisplay.prototype.labelText_ = 'Time';\n/**\n * The text that should display over the `TimeDisplay`s controls. Added to for localization.\n *\n * @type {string}\n * @private\n *\n * @deprecated in v7; controlText_ is not used in non-active display Components\n */\n\nTimeDisplay.prototype.controlText_ = 'Time';\nComponent$1.registerComponent('TimeDisplay', TimeDisplay);\n\n/**\n * Displays the current time\n *\n * @extends Component\n */\n\nvar CurrentTimeDisplay = /*#__PURE__*/function (_TimeDisplay) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(CurrentTimeDisplay, _TimeDisplay);\n\n function CurrentTimeDisplay() {\n return _TimeDisplay.apply(this, arguments) || this;\n }\n\n var _proto = CurrentTimeDisplay.prototype;\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n _proto.buildCSSClass = function buildCSSClass() {\n return 'vjs-current-time';\n }\n /**\n * Update current time display\n *\n * @param {EventTarget~Event} [event]\n * The `timeupdate` event that caused this function to run.\n *\n * @listens Player#timeupdate\n */\n ;\n\n _proto.updateContent = function updateContent(event) {\n // Allows for smooth scrubbing, when player can't keep up.\n var time;\n\n if (this.player_.ended()) {\n time = this.player_.duration();\n } else {\n time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();\n }\n\n this.updateTextNode_(time);\n };\n\n return CurrentTimeDisplay;\n}(TimeDisplay);\n/**\n * The text that is added to the `CurrentTimeDisplay` for screen reader users.\n *\n * @type {string}\n * @private\n */\n\n\nCurrentTimeDisplay.prototype.labelText_ = 'Current Time';\n/**\n * The text that should display over the `CurrentTimeDisplay`s controls. Added to for localization.\n *\n * @type {string}\n * @private\n *\n * @deprecated in v7; controlText_ is not used in non-active display Components\n */\n\nCurrentTimeDisplay.prototype.controlText_ = 'Current Time';\nComponent$1.registerComponent('CurrentTimeDisplay', CurrentTimeDisplay);\n\n/**\n * Displays the duration\n *\n * @extends Component\n */\n\nvar DurationDisplay = /*#__PURE__*/function (_TimeDisplay) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(DurationDisplay, _TimeDisplay);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function DurationDisplay(player, options) {\n var _this;\n\n _this = _TimeDisplay.call(this, player, options) || this;\n\n var updateContent = function updateContent(e) {\n return _this.updateContent(e);\n }; // we do not want to/need to throttle duration changes,\n // as they should always display the changed duration as\n // it has changed\n\n\n _this.on(player, 'durationchange', updateContent); // Listen to loadstart because the player duration is reset when a new media element is loaded,\n // but the durationchange on the user agent will not fire.\n // @see [Spec]{@link https://www.w3.org/TR/2011/WD-html5-20110113/video.html#media-element-load-algorithm}\n\n\n _this.on(player, 'loadstart', updateContent); // Also listen for timeupdate (in the parent) and loadedmetadata because removing those\n // listeners could have broken dependent applications/libraries. These\n // can likely be removed for 7.0.\n\n\n _this.on(player, 'loadedmetadata', updateContent);\n\n return _this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = DurationDisplay.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return 'vjs-duration';\n }\n /**\n * Update duration time display.\n *\n * @param {EventTarget~Event} [event]\n * The `durationchange`, `timeupdate`, or `loadedmetadata` event that caused\n * this function to be called.\n *\n * @listens Player#durationchange\n * @listens Player#timeupdate\n * @listens Player#loadedmetadata\n */\n ;\n\n _proto.updateContent = function updateContent(event) {\n var duration = this.player_.duration();\n this.updateTextNode_(duration);\n };\n\n return DurationDisplay;\n}(TimeDisplay);\n/**\n * The text that is added to the `DurationDisplay` for screen reader users.\n *\n * @type {string}\n * @private\n */\n\n\nDurationDisplay.prototype.labelText_ = 'Duration';\n/**\n * The text that should display over the `DurationDisplay`s controls. Added to for localization.\n *\n * @type {string}\n * @private\n *\n * @deprecated in v7; controlText_ is not used in non-active display Components\n */\n\nDurationDisplay.prototype.controlText_ = 'Duration';\nComponent$1.registerComponent('DurationDisplay', DurationDisplay);\n\n/**\n * The separator between the current time and duration.\n * Can be hidden if it's not needed in the design.\n *\n * @extends Component\n */\n\nvar TimeDivider = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TimeDivider, _Component);\n\n function TimeDivider() {\n return _Component.apply(this, arguments) || this;\n }\n\n var _proto = TimeDivider.prototype;\n\n /**\n * Create the component's DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n _proto.createEl = function createEl() {\n var el = _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-time-control vjs-time-divider'\n }, {\n // this element and its contents can be hidden from assistive techs since\n // it is made extraneous by the announcement of the control text\n // for the current time and duration displays\n 'aria-hidden': true\n });\n\n var div = _Component.prototype.createEl.call(this, 'div');\n\n var span = _Component.prototype.createEl.call(this, 'span', {\n textContent: '/'\n });\n\n div.appendChild(span);\n el.appendChild(div);\n return el;\n };\n\n return TimeDivider;\n}(Component$1);\n\nComponent$1.registerComponent('TimeDivider', TimeDivider);\n\n/**\n * Displays the time left in the video\n *\n * @extends Component\n */\n\nvar RemainingTimeDisplay = /*#__PURE__*/function (_TimeDisplay) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(RemainingTimeDisplay, _TimeDisplay);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function RemainingTimeDisplay(player, options) {\n var _this;\n\n _this = _TimeDisplay.call(this, player, options) || this;\n\n _this.on(player, 'durationchange', function (e) {\n return _this.updateContent(e);\n });\n\n return _this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = RemainingTimeDisplay.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return 'vjs-remaining-time';\n }\n /**\n * Create the `Component`'s DOM element with the \"minus\" characted prepend to the time\n *\n * @return {Element}\n * The element that was created.\n */\n ;\n\n _proto.createEl = function createEl$1() {\n var el = _TimeDisplay.prototype.createEl.call(this);\n\n if (this.options_.displayNegative !== false) {\n el.insertBefore(createEl('span', {}, {\n 'aria-hidden': true\n }, '-'), this.contentEl_);\n }\n\n return el;\n }\n /**\n * Update remaining time display.\n *\n * @param {EventTarget~Event} [event]\n * The `timeupdate` or `durationchange` event that caused this to run.\n *\n * @listens Player#timeupdate\n * @listens Player#durationchange\n */\n ;\n\n _proto.updateContent = function updateContent(event) {\n if (typeof this.player_.duration() !== 'number') {\n return;\n }\n\n var time; // @deprecated We should only use remainingTimeDisplay\n // as of video.js 7\n\n if (this.player_.ended()) {\n time = 0;\n } else if (this.player_.remainingTimeDisplay) {\n time = this.player_.remainingTimeDisplay();\n } else {\n time = this.player_.remainingTime();\n }\n\n this.updateTextNode_(time);\n };\n\n return RemainingTimeDisplay;\n}(TimeDisplay);\n/**\n * The text that is added to the `RemainingTimeDisplay` for screen reader users.\n *\n * @type {string}\n * @private\n */\n\n\nRemainingTimeDisplay.prototype.labelText_ = 'Remaining Time';\n/**\n * The text that should display over the `RemainingTimeDisplay`s controls. Added to for localization.\n *\n * @type {string}\n * @private\n *\n * @deprecated in v7; controlText_ is not used in non-active display Components\n */\n\nRemainingTimeDisplay.prototype.controlText_ = 'Remaining Time';\nComponent$1.registerComponent('RemainingTimeDisplay', RemainingTimeDisplay);\n\n/**\n * Displays the live indicator when duration is Infinity.\n *\n * @extends Component\n */\n\nvar LiveDisplay = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(LiveDisplay, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function LiveDisplay(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n\n _this.updateShowing();\n\n _this.on(_this.player(), 'durationchange', function (e) {\n return _this.updateShowing(e);\n });\n\n return _this;\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = LiveDisplay.prototype;\n\n _proto.createEl = function createEl$1() {\n var el = _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-live-control vjs-control'\n });\n\n this.contentEl_ = createEl('div', {\n className: 'vjs-live-display'\n }, {\n 'aria-live': 'off'\n });\n this.contentEl_.appendChild(createEl('span', {\n className: 'vjs-control-text',\n textContent: this.localize('Stream Type') + \"\\xA0\"\n }));\n this.contentEl_.appendChild(global_document__WEBPACK_IMPORTED_MODULE_1___default().createTextNode(this.localize('LIVE')));\n el.appendChild(this.contentEl_);\n return el;\n };\n\n _proto.dispose = function dispose() {\n this.contentEl_ = null;\n\n _Component.prototype.dispose.call(this);\n }\n /**\n * Check the duration to see if the LiveDisplay should be showing or not. Then show/hide\n * it accordingly\n *\n * @param {EventTarget~Event} [event]\n * The {@link Player#durationchange} event that caused this function to run.\n *\n * @listens Player#durationchange\n */\n ;\n\n _proto.updateShowing = function updateShowing(event) {\n if (this.player().duration() === Infinity) {\n this.show();\n } else {\n this.hide();\n }\n };\n\n return LiveDisplay;\n}(Component$1);\n\nComponent$1.registerComponent('LiveDisplay', LiveDisplay);\n\n/**\n * Displays the live indicator when duration is Infinity.\n *\n * @extends Component\n */\n\nvar SeekToLive = /*#__PURE__*/function (_Button) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(SeekToLive, _Button);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function SeekToLive(player, options) {\n var _this;\n\n _this = _Button.call(this, player, options) || this;\n\n _this.updateLiveEdgeStatus();\n\n if (_this.player_.liveTracker) {\n _this.updateLiveEdgeStatusHandler_ = function (e) {\n return _this.updateLiveEdgeStatus(e);\n };\n\n _this.on(_this.player_.liveTracker, 'liveedgechange', _this.updateLiveEdgeStatusHandler_);\n }\n\n return _this;\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = SeekToLive.prototype;\n\n _proto.createEl = function createEl$1() {\n var el = _Button.prototype.createEl.call(this, 'button', {\n className: 'vjs-seek-to-live-control vjs-control'\n });\n\n this.textEl_ = createEl('span', {\n className: 'vjs-seek-to-live-text',\n textContent: this.localize('LIVE')\n }, {\n 'aria-hidden': 'true'\n });\n el.appendChild(this.textEl_);\n return el;\n }\n /**\n * Update the state of this button if we are at the live edge\n * or not\n */\n ;\n\n _proto.updateLiveEdgeStatus = function updateLiveEdgeStatus() {\n // default to live edge\n if (!this.player_.liveTracker || this.player_.liveTracker.atLiveEdge()) {\n this.setAttribute('aria-disabled', true);\n this.addClass('vjs-at-live-edge');\n this.controlText('Seek to live, currently playing live');\n } else {\n this.setAttribute('aria-disabled', false);\n this.removeClass('vjs-at-live-edge');\n this.controlText('Seek to live, currently behind live');\n }\n }\n /**\n * On click bring us as near to the live point as possible.\n * This requires that we wait for the next `live-seekable-change`\n * event which will happen every segment length seconds.\n */\n ;\n\n _proto.handleClick = function handleClick() {\n this.player_.liveTracker.seekToLiveEdge();\n }\n /**\n * Dispose of the element and stop tracking\n */\n ;\n\n _proto.dispose = function dispose() {\n if (this.player_.liveTracker) {\n this.off(this.player_.liveTracker, 'liveedgechange', this.updateLiveEdgeStatusHandler_);\n }\n\n this.textEl_ = null;\n\n _Button.prototype.dispose.call(this);\n };\n\n return SeekToLive;\n}(Button);\n\nSeekToLive.prototype.controlText_ = 'Seek to live, currently playing live';\nComponent$1.registerComponent('SeekToLive', SeekToLive);\n\n/**\n * Keep a number between a min and a max value\n *\n * @param {number} number\n * The number to clamp\n *\n * @param {number} min\n * The minimum value\n * @param {number} max\n * The maximum value\n *\n * @return {number}\n * the clamped number\n */\nvar clamp = function clamp(number, min, max) {\n number = Number(number);\n return Math.min(max, Math.max(min, isNaN(number) ? min : number));\n};\n\n/**\n * The base functionality for a slider. Can be vertical or horizontal.\n * For instance the volume bar or the seek bar on a video is a slider.\n *\n * @extends Component\n */\n\nvar Slider = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(Slider, _Component);\n\n /**\n * Create an instance of this class\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function Slider(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n\n _this.handleMouseDown_ = function (e) {\n return _this.handleMouseDown(e);\n };\n\n _this.handleMouseUp_ = function (e) {\n return _this.handleMouseUp(e);\n };\n\n _this.handleKeyDown_ = function (e) {\n return _this.handleKeyDown(e);\n };\n\n _this.handleClick_ = function (e) {\n return _this.handleClick(e);\n };\n\n _this.handleMouseMove_ = function (e) {\n return _this.handleMouseMove(e);\n };\n\n _this.update_ = function (e) {\n return _this.update(e);\n }; // Set property names to bar to match with the child Slider class is looking for\n\n\n _this.bar = _this.getChild(_this.options_.barName); // Set a horizontal or vertical class on the slider depending on the slider type\n\n _this.vertical(!!_this.options_.vertical);\n\n _this.enable();\n\n return _this;\n }\n /**\n * Are controls are currently enabled for this slider or not.\n *\n * @return {boolean}\n * true if controls are enabled, false otherwise\n */\n\n\n var _proto = Slider.prototype;\n\n _proto.enabled = function enabled() {\n return this.enabled_;\n }\n /**\n * Enable controls for this slider if they are disabled\n */\n ;\n\n _proto.enable = function enable() {\n if (this.enabled()) {\n return;\n }\n\n this.on('mousedown', this.handleMouseDown_);\n this.on('touchstart', this.handleMouseDown_);\n this.on('keydown', this.handleKeyDown_);\n this.on('click', this.handleClick_); // TODO: deprecated, controlsvisible does not seem to be fired\n\n this.on(this.player_, 'controlsvisible', this.update);\n\n if (this.playerEvent) {\n this.on(this.player_, this.playerEvent, this.update);\n }\n\n this.removeClass('disabled');\n this.setAttribute('tabindex', 0);\n this.enabled_ = true;\n }\n /**\n * Disable controls for this slider if they are enabled\n */\n ;\n\n _proto.disable = function disable() {\n if (!this.enabled()) {\n return;\n }\n\n var doc = this.bar.el_.ownerDocument;\n this.off('mousedown', this.handleMouseDown_);\n this.off('touchstart', this.handleMouseDown_);\n this.off('keydown', this.handleKeyDown_);\n this.off('click', this.handleClick_);\n this.off(this.player_, 'controlsvisible', this.update_);\n this.off(doc, 'mousemove', this.handleMouseMove_);\n this.off(doc, 'mouseup', this.handleMouseUp_);\n this.off(doc, 'touchmove', this.handleMouseMove_);\n this.off(doc, 'touchend', this.handleMouseUp_);\n this.removeAttribute('tabindex');\n this.addClass('disabled');\n\n if (this.playerEvent) {\n this.off(this.player_, this.playerEvent, this.update);\n }\n\n this.enabled_ = false;\n }\n /**\n * Create the `Slider`s DOM element.\n *\n * @param {string} type\n * Type of element to create.\n *\n * @param {Object} [props={}]\n * List of properties in Object form.\n *\n * @param {Object} [attributes={}]\n * list of attributes in Object form.\n *\n * @return {Element}\n * The element that gets created.\n */\n ;\n\n _proto.createEl = function createEl(type, props, attributes) {\n if (props === void 0) {\n props = {};\n }\n\n if (attributes === void 0) {\n attributes = {};\n }\n\n // Add the slider element class to all sub classes\n props.className = props.className + ' vjs-slider';\n props = assign({\n tabIndex: 0\n }, props);\n attributes = assign({\n 'role': 'slider',\n 'aria-valuenow': 0,\n 'aria-valuemin': 0,\n 'aria-valuemax': 100,\n 'tabIndex': 0\n }, attributes);\n return _Component.prototype.createEl.call(this, type, props, attributes);\n }\n /**\n * Handle `mousedown` or `touchstart` events on the `Slider`.\n *\n * @param {EventTarget~Event} event\n * `mousedown` or `touchstart` event that triggered this function\n *\n * @listens mousedown\n * @listens touchstart\n * @fires Slider#slideractive\n */\n ;\n\n _proto.handleMouseDown = function handleMouseDown(event) {\n var doc = this.bar.el_.ownerDocument;\n\n if (event.type === 'mousedown') {\n event.preventDefault();\n } // Do not call preventDefault() on touchstart in Chrome\n // to avoid console warnings. Use a 'touch-action: none' style\n // instead to prevent unintented scrolling.\n // https://developers.google.com/web/updates/2017/01/scrolling-intervention\n\n\n if (event.type === 'touchstart' && !IS_CHROME) {\n event.preventDefault();\n }\n\n blockTextSelection();\n this.addClass('vjs-sliding');\n /**\n * Triggered when the slider is in an active state\n *\n * @event Slider#slideractive\n * @type {EventTarget~Event}\n */\n\n this.trigger('slideractive');\n this.on(doc, 'mousemove', this.handleMouseMove_);\n this.on(doc, 'mouseup', this.handleMouseUp_);\n this.on(doc, 'touchmove', this.handleMouseMove_);\n this.on(doc, 'touchend', this.handleMouseUp_);\n this.handleMouseMove(event, true);\n }\n /**\n * Handle the `mousemove`, `touchmove`, and `mousedown` events on this `Slider`.\n * The `mousemove` and `touchmove` events will only only trigger this function during\n * `mousedown` and `touchstart`. This is due to {@link Slider#handleMouseDown} and\n * {@link Slider#handleMouseUp}.\n *\n * @param {EventTarget~Event} event\n * `mousedown`, `mousemove`, `touchstart`, or `touchmove` event that triggered\n * this function\n * @param {boolean} mouseDown this is a flag that should be set to true if `handleMouseMove` is called directly. It allows us to skip things that should not happen if coming from mouse down but should happen on regular mouse move handler. Defaults to false.\n *\n * @listens mousemove\n * @listens touchmove\n */\n ;\n\n _proto.handleMouseMove = function handleMouseMove(event) {}\n /**\n * Handle `mouseup` or `touchend` events on the `Slider`.\n *\n * @param {EventTarget~Event} event\n * `mouseup` or `touchend` event that triggered this function.\n *\n * @listens touchend\n * @listens mouseup\n * @fires Slider#sliderinactive\n */\n ;\n\n _proto.handleMouseUp = function handleMouseUp() {\n var doc = this.bar.el_.ownerDocument;\n unblockTextSelection();\n this.removeClass('vjs-sliding');\n /**\n * Triggered when the slider is no longer in an active state.\n *\n * @event Slider#sliderinactive\n * @type {EventTarget~Event}\n */\n\n this.trigger('sliderinactive');\n this.off(doc, 'mousemove', this.handleMouseMove_);\n this.off(doc, 'mouseup', this.handleMouseUp_);\n this.off(doc, 'touchmove', this.handleMouseMove_);\n this.off(doc, 'touchend', this.handleMouseUp_);\n this.update();\n }\n /**\n * Update the progress bar of the `Slider`.\n *\n * @return {number}\n * The percentage of progress the progress bar represents as a\n * number from 0 to 1.\n */\n ;\n\n _proto.update = function update() {\n var _this2 = this;\n\n // In VolumeBar init we have a setTimeout for update that pops and update\n // to the end of the execution stack. The player is destroyed before then\n // update will cause an error\n // If there's no bar...\n if (!this.el_ || !this.bar) {\n return;\n } // clamp progress between 0 and 1\n // and only round to four decimal places, as we round to two below\n\n\n var progress = this.getProgress();\n\n if (progress === this.progress_) {\n return progress;\n }\n\n this.progress_ = progress;\n this.requestNamedAnimationFrame('Slider#update', function () {\n // Set the new bar width or height\n var sizeKey = _this2.vertical() ? 'height' : 'width'; // Convert to a percentage for css value\n\n _this2.bar.el().style[sizeKey] = (progress * 100).toFixed(2) + '%';\n });\n return progress;\n }\n /**\n * Get the percentage of the bar that should be filled\n * but clamped and rounded.\n *\n * @return {number}\n * percentage filled that the slider is\n */\n ;\n\n _proto.getProgress = function getProgress() {\n return Number(clamp(this.getPercent(), 0, 1).toFixed(4));\n }\n /**\n * Calculate distance for slider\n *\n * @param {EventTarget~Event} event\n * The event that caused this function to run.\n *\n * @return {number}\n * The current position of the Slider.\n * - position.x for vertical `Slider`s\n * - position.y for horizontal `Slider`s\n */\n ;\n\n _proto.calculateDistance = function calculateDistance(event) {\n var position = getPointerPosition(this.el_, event);\n\n if (this.vertical()) {\n return position.y;\n }\n\n return position.x;\n }\n /**\n * Handle a `keydown` event on the `Slider`. Watches for left, rigth, up, and down\n * arrow keys. This function will only be called when the slider has focus. See\n * {@link Slider#handleFocus} and {@link Slider#handleBlur}.\n *\n * @param {EventTarget~Event} event\n * the `keydown` event that caused this function to run.\n *\n * @listens keydown\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n // Left and Down Arrows\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Left') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Down')) {\n event.preventDefault();\n event.stopPropagation();\n this.stepBack(); // Up and Right Arrows\n } else if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Right') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Up')) {\n event.preventDefault();\n event.stopPropagation();\n this.stepForward();\n } else {\n // Pass keydown handling up for unsupported keys\n _Component.prototype.handleKeyDown.call(this, event);\n }\n }\n /**\n * Listener for click events on slider, used to prevent clicks\n * from bubbling up to parent elements like button menus.\n *\n * @param {Object} event\n * Event that caused this object to run\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n event.stopPropagation();\n event.preventDefault();\n }\n /**\n * Get/set if slider is horizontal for vertical\n *\n * @param {boolean} [bool]\n * - true if slider is vertical,\n * - false is horizontal\n *\n * @return {boolean}\n * - true if slider is vertical, and getting\n * - false if the slider is horizontal, and getting\n */\n ;\n\n _proto.vertical = function vertical(bool) {\n if (bool === undefined) {\n return this.vertical_ || false;\n }\n\n this.vertical_ = !!bool;\n\n if (this.vertical_) {\n this.addClass('vjs-slider-vertical');\n } else {\n this.addClass('vjs-slider-horizontal');\n }\n };\n\n return Slider;\n}(Component$1);\n\nComponent$1.registerComponent('Slider', Slider);\n\nvar percentify = function percentify(time, end) {\n return clamp(time / end * 100, 0, 100).toFixed(2) + '%';\n};\n/**\n * Shows loading progress\n *\n * @extends Component\n */\n\n\nvar LoadProgressBar = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(LoadProgressBar, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function LoadProgressBar(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n _this.partEls_ = [];\n\n _this.on(player, 'progress', function (e) {\n return _this.update(e);\n });\n\n return _this;\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = LoadProgressBar.prototype;\n\n _proto.createEl = function createEl$1() {\n var el = _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-load-progress'\n });\n\n var wrapper = createEl('span', {\n className: 'vjs-control-text'\n });\n var loadedText = createEl('span', {\n textContent: this.localize('Loaded')\n });\n var separator = global_document__WEBPACK_IMPORTED_MODULE_1___default().createTextNode(': ');\n this.percentageEl_ = createEl('span', {\n className: 'vjs-control-text-loaded-percentage',\n textContent: '0%'\n });\n el.appendChild(wrapper);\n wrapper.appendChild(loadedText);\n wrapper.appendChild(separator);\n wrapper.appendChild(this.percentageEl_);\n return el;\n };\n\n _proto.dispose = function dispose() {\n this.partEls_ = null;\n this.percentageEl_ = null;\n\n _Component.prototype.dispose.call(this);\n }\n /**\n * Update progress bar\n *\n * @param {EventTarget~Event} [event]\n * The `progress` event that caused this function to run.\n *\n * @listens Player#progress\n */\n ;\n\n _proto.update = function update(event) {\n var _this2 = this;\n\n this.requestNamedAnimationFrame('LoadProgressBar#update', function () {\n var liveTracker = _this2.player_.liveTracker;\n\n var buffered = _this2.player_.buffered();\n\n var duration = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : _this2.player_.duration();\n\n var bufferedEnd = _this2.player_.bufferedEnd();\n\n var children = _this2.partEls_;\n var percent = percentify(bufferedEnd, duration);\n\n if (_this2.percent_ !== percent) {\n // update the width of the progress bar\n _this2.el_.style.width = percent; // update the control-text\n\n textContent(_this2.percentageEl_, percent);\n _this2.percent_ = percent;\n } // add child elements to represent the individual buffered time ranges\n\n\n for (var i = 0; i < buffered.length; i++) {\n var start = buffered.start(i);\n var end = buffered.end(i);\n var part = children[i];\n\n if (!part) {\n part = _this2.el_.appendChild(createEl());\n children[i] = part;\n } // only update if changed\n\n\n if (part.dataset.start === start && part.dataset.end === end) {\n continue;\n }\n\n part.dataset.start = start;\n part.dataset.end = end; // set the percent based on the width of the progress bar (bufferedEnd)\n\n part.style.left = percentify(start, bufferedEnd);\n part.style.width = percentify(end - start, bufferedEnd);\n } // remove unused buffered range elements\n\n\n for (var _i = children.length; _i > buffered.length; _i--) {\n _this2.el_.removeChild(children[_i - 1]);\n }\n\n children.length = buffered.length;\n });\n };\n\n return LoadProgressBar;\n}(Component$1);\n\nComponent$1.registerComponent('LoadProgressBar', LoadProgressBar);\n\n/**\n * Time tooltips display a time above the progress bar.\n *\n * @extends Component\n */\n\nvar TimeTooltip = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TimeTooltip, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The {@link Player} that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function TimeTooltip(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n _this.update = throttle(bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), _this.update), UPDATE_REFRESH_INTERVAL);\n return _this;\n }\n /**\n * Create the time tooltip DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = TimeTooltip.prototype;\n\n _proto.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-time-tooltip'\n }, {\n 'aria-hidden': 'true'\n });\n }\n /**\n * Updates the position of the time tooltip relative to the `SeekBar`.\n *\n * @param {Object} seekBarRect\n * The `ClientRect` for the {@link SeekBar} element.\n *\n * @param {number} seekBarPoint\n * A number from 0 to 1, representing a horizontal reference point\n * from the left edge of the {@link SeekBar}\n */\n ;\n\n _proto.update = function update(seekBarRect, seekBarPoint, content) {\n var tooltipRect = findPosition(this.el_);\n var playerRect = getBoundingClientRect(this.player_.el());\n var seekBarPointPx = seekBarRect.width * seekBarPoint; // do nothing if either rect isn't available\n // for example, if the player isn't in the DOM for testing\n\n if (!playerRect || !tooltipRect) {\n return;\n } // This is the space left of the `seekBarPoint` available within the bounds\n // of the player. We calculate any gap between the left edge of the player\n // and the left edge of the `SeekBar` and add the number of pixels in the\n // `SeekBar` before hitting the `seekBarPoint`\n\n\n var spaceLeftOfPoint = seekBarRect.left - playerRect.left + seekBarPointPx; // This is the space right of the `seekBarPoint` available within the bounds\n // of the player. We calculate the number of pixels from the `seekBarPoint`\n // to the right edge of the `SeekBar` and add to that any gap between the\n // right edge of the `SeekBar` and the player.\n\n var spaceRightOfPoint = seekBarRect.width - seekBarPointPx + (playerRect.right - seekBarRect.right); // This is the number of pixels by which the tooltip will need to be pulled\n // further to the right to center it over the `seekBarPoint`.\n\n var pullTooltipBy = tooltipRect.width / 2; // Adjust the `pullTooltipBy` distance to the left or right depending on\n // the results of the space calculations above.\n\n if (spaceLeftOfPoint < pullTooltipBy) {\n pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;\n } else if (spaceRightOfPoint < pullTooltipBy) {\n pullTooltipBy = spaceRightOfPoint;\n } // Due to the imprecision of decimal/ratio based calculations and varying\n // rounding behaviors, there are cases where the spacing adjustment is off\n // by a pixel or two. This adds insurance to these calculations.\n\n\n if (pullTooltipBy < 0) {\n pullTooltipBy = 0;\n } else if (pullTooltipBy > tooltipRect.width) {\n pullTooltipBy = tooltipRect.width;\n } // prevent small width fluctuations within 0.4px from\n // changing the value below.\n // This really helps for live to prevent the play\n // progress time tooltip from jittering\n\n\n pullTooltipBy = Math.round(pullTooltipBy);\n this.el_.style.right = \"-\" + pullTooltipBy + \"px\";\n this.write(content);\n }\n /**\n * Write the time to the tooltip DOM element.\n *\n * @param {string} content\n * The formatted time for the tooltip.\n */\n ;\n\n _proto.write = function write(content) {\n textContent(this.el_, content);\n }\n /**\n * Updates the position of the time tooltip relative to the `SeekBar`.\n *\n * @param {Object} seekBarRect\n * The `ClientRect` for the {@link SeekBar} element.\n *\n * @param {number} seekBarPoint\n * A number from 0 to 1, representing a horizontal reference point\n * from the left edge of the {@link SeekBar}\n *\n * @param {number} time\n * The time to update the tooltip to, not used during live playback\n *\n * @param {Function} cb\n * A function that will be called during the request animation frame\n * for tooltips that need to do additional animations from the default\n */\n ;\n\n _proto.updateTime = function updateTime(seekBarRect, seekBarPoint, time, cb) {\n var _this2 = this;\n\n this.requestNamedAnimationFrame('TimeTooltip#updateTime', function () {\n var content;\n\n var duration = _this2.player_.duration();\n\n if (_this2.player_.liveTracker && _this2.player_.liveTracker.isLive()) {\n var liveWindow = _this2.player_.liveTracker.liveWindow();\n\n var secondsBehind = liveWindow - seekBarPoint * liveWindow;\n content = (secondsBehind < 1 ? '' : '-') + formatTime(secondsBehind, liveWindow);\n } else {\n content = formatTime(time, duration);\n }\n\n _this2.update(seekBarRect, seekBarPoint, content);\n\n if (cb) {\n cb();\n }\n });\n };\n\n return TimeTooltip;\n}(Component$1);\n\nComponent$1.registerComponent('TimeTooltip', TimeTooltip);\n\n/**\n * Used by {@link SeekBar} to display media playback progress as part of the\n * {@link ProgressControl}.\n *\n * @extends Component\n */\n\nvar PlayProgressBar = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(PlayProgressBar, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The {@link Player} that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function PlayProgressBar(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n _this.update = throttle(bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), _this.update), UPDATE_REFRESH_INTERVAL);\n return _this;\n }\n /**\n * Create the the DOM element for this class.\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = PlayProgressBar.prototype;\n\n _proto.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-play-progress vjs-slider-bar'\n }, {\n 'aria-hidden': 'true'\n });\n }\n /**\n * Enqueues updates to its own DOM as well as the DOM of its\n * {@link TimeTooltip} child.\n *\n * @param {Object} seekBarRect\n * The `ClientRect` for the {@link SeekBar} element.\n *\n * @param {number} seekBarPoint\n * A number from 0 to 1, representing a horizontal reference point\n * from the left edge of the {@link SeekBar}\n */\n ;\n\n _proto.update = function update(seekBarRect, seekBarPoint) {\n var timeTooltip = this.getChild('timeTooltip');\n\n if (!timeTooltip) {\n return;\n }\n\n var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();\n timeTooltip.updateTime(seekBarRect, seekBarPoint, time);\n };\n\n return PlayProgressBar;\n}(Component$1);\n/**\n * Default options for {@link PlayProgressBar}.\n *\n * @type {Object}\n * @private\n */\n\n\nPlayProgressBar.prototype.options_ = {\n children: []\n}; // Time tooltips should not be added to a player on mobile devices\n\nif (!IS_IOS && !IS_ANDROID) {\n PlayProgressBar.prototype.options_.children.push('timeTooltip');\n}\n\nComponent$1.registerComponent('PlayProgressBar', PlayProgressBar);\n\n/**\n * The {@link MouseTimeDisplay} component tracks mouse movement over the\n * {@link ProgressControl}. It displays an indicator and a {@link TimeTooltip}\n * indicating the time which is represented by a given point in the\n * {@link ProgressControl}.\n *\n * @extends Component\n */\n\nvar MouseTimeDisplay = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(MouseTimeDisplay, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The {@link Player} that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function MouseTimeDisplay(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n _this.update = throttle(bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), _this.update), UPDATE_REFRESH_INTERVAL);\n return _this;\n }\n /**\n * Create the DOM element for this class.\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = MouseTimeDisplay.prototype;\n\n _proto.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-mouse-display'\n });\n }\n /**\n * Enqueues updates to its own DOM as well as the DOM of its\n * {@link TimeTooltip} child.\n *\n * @param {Object} seekBarRect\n * The `ClientRect` for the {@link SeekBar} element.\n *\n * @param {number} seekBarPoint\n * A number from 0 to 1, representing a horizontal reference point\n * from the left edge of the {@link SeekBar}\n */\n ;\n\n _proto.update = function update(seekBarRect, seekBarPoint) {\n var _this2 = this;\n\n var time = seekBarPoint * this.player_.duration();\n this.getChild('timeTooltip').updateTime(seekBarRect, seekBarPoint, time, function () {\n _this2.el_.style.left = seekBarRect.width * seekBarPoint + \"px\";\n });\n };\n\n return MouseTimeDisplay;\n}(Component$1);\n/**\n * Default options for `MouseTimeDisplay`\n *\n * @type {Object}\n * @private\n */\n\n\nMouseTimeDisplay.prototype.options_ = {\n children: ['timeTooltip']\n};\nComponent$1.registerComponent('MouseTimeDisplay', MouseTimeDisplay);\n\nvar STEP_SECONDS = 5; // The multiplier of STEP_SECONDS that PgUp/PgDown move the timeline.\n\nvar PAGE_KEY_MULTIPLIER = 12;\n/**\n * Seek bar and container for the progress bars. Uses {@link PlayProgressBar}\n * as its `bar`.\n *\n * @extends Slider\n */\n\nvar SeekBar = /*#__PURE__*/function (_Slider) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(SeekBar, _Slider);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function SeekBar(player, options) {\n var _this;\n\n _this = _Slider.call(this, player, options) || this;\n\n _this.setEventHandlers_();\n\n return _this;\n }\n /**\n * Sets the event handlers\n *\n * @private\n */\n\n\n var _proto = SeekBar.prototype;\n\n _proto.setEventHandlers_ = function setEventHandlers_() {\n var _this2 = this;\n\n this.update_ = bind(this, this.update);\n this.update = throttle(this.update_, UPDATE_REFRESH_INTERVAL);\n this.on(this.player_, ['ended', 'durationchange', 'timeupdate'], this.update);\n\n if (this.player_.liveTracker) {\n this.on(this.player_.liveTracker, 'liveedgechange', this.update);\n } // when playing, let's ensure we smoothly update the play progress bar\n // via an interval\n\n\n this.updateInterval = null;\n\n this.enableIntervalHandler_ = function (e) {\n return _this2.enableInterval_(e);\n };\n\n this.disableIntervalHandler_ = function (e) {\n return _this2.disableInterval_(e);\n };\n\n this.on(this.player_, ['playing'], this.enableIntervalHandler_);\n this.on(this.player_, ['ended', 'pause', 'waiting'], this.disableIntervalHandler_); // we don't need to update the play progress if the document is hidden,\n // also, this causes the CPU to spike and eventually crash the page on IE11.\n\n if (\"hidden\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default()) && \"visibilityState\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default())) {\n this.on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'visibilitychange', this.toggleVisibility_);\n }\n };\n\n _proto.toggleVisibility_ = function toggleVisibility_(e) {\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default().visibilityState) === 'hidden') {\n this.cancelNamedAnimationFrame('SeekBar#update');\n this.cancelNamedAnimationFrame('Slider#update');\n this.disableInterval_(e);\n } else {\n if (!this.player_.ended() && !this.player_.paused()) {\n this.enableInterval_();\n } // we just switched back to the page and someone may be looking, so, update ASAP\n\n\n this.update();\n }\n };\n\n _proto.enableInterval_ = function enableInterval_() {\n if (this.updateInterval) {\n return;\n }\n\n this.updateInterval = this.setInterval(this.update, UPDATE_REFRESH_INTERVAL);\n };\n\n _proto.disableInterval_ = function disableInterval_(e) {\n if (this.player_.liveTracker && this.player_.liveTracker.isLive() && e && e.type !== 'ended') {\n return;\n }\n\n if (!this.updateInterval) {\n return;\n }\n\n this.clearInterval(this.updateInterval);\n this.updateInterval = null;\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n ;\n\n _proto.createEl = function createEl() {\n return _Slider.prototype.createEl.call(this, 'div', {\n className: 'vjs-progress-holder'\n }, {\n 'aria-label': this.localize('Progress Bar')\n });\n }\n /**\n * This function updates the play progress bar and accessibility\n * attributes to whatever is passed in.\n *\n * @param {EventTarget~Event} [event]\n * The `timeupdate` or `ended` event that caused this to run.\n *\n * @listens Player#timeupdate\n *\n * @return {number}\n * The current percent at a number from 0-1\n */\n ;\n\n _proto.update = function update(event) {\n var _this3 = this;\n\n // ignore updates while the tab is hidden\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default().visibilityState) === 'hidden') {\n return;\n }\n\n var percent = _Slider.prototype.update.call(this);\n\n this.requestNamedAnimationFrame('SeekBar#update', function () {\n var currentTime = _this3.player_.ended() ? _this3.player_.duration() : _this3.getCurrentTime_();\n var liveTracker = _this3.player_.liveTracker;\n\n var duration = _this3.player_.duration();\n\n if (liveTracker && liveTracker.isLive()) {\n duration = _this3.player_.liveTracker.liveCurrentTime();\n }\n\n if (_this3.percent_ !== percent) {\n // machine readable value of progress bar (percentage complete)\n _this3.el_.setAttribute('aria-valuenow', (percent * 100).toFixed(2));\n\n _this3.percent_ = percent;\n }\n\n if (_this3.currentTime_ !== currentTime || _this3.duration_ !== duration) {\n // human readable value of progress bar (time complete)\n _this3.el_.setAttribute('aria-valuetext', _this3.localize('progress bar timing: currentTime={1} duration={2}', [formatTime(currentTime, duration), formatTime(duration, duration)], '{1} of {2}'));\n\n _this3.currentTime_ = currentTime;\n _this3.duration_ = duration;\n } // update the progress bar time tooltip with the current time\n\n\n if (_this3.bar) {\n _this3.bar.update(getBoundingClientRect(_this3.el()), _this3.getProgress());\n }\n });\n return percent;\n }\n /**\n * Prevent liveThreshold from causing seeks to seem like they\n * are not happening from a user perspective.\n *\n * @param {number} ct\n * current time to seek to\n */\n ;\n\n _proto.userSeek_ = function userSeek_(ct) {\n if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {\n this.player_.liveTracker.nextSeekedFromUser();\n }\n\n this.player_.currentTime(ct);\n }\n /**\n * Get the value of current time but allows for smooth scrubbing,\n * when player can't keep up.\n *\n * @return {number}\n * The current time value to display\n *\n * @private\n */\n ;\n\n _proto.getCurrentTime_ = function getCurrentTime_() {\n return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();\n }\n /**\n * Get the percentage of media played so far.\n *\n * @return {number}\n * The percentage of media played so far (0 to 1).\n */\n ;\n\n _proto.getPercent = function getPercent() {\n var currentTime = this.getCurrentTime_();\n var percent;\n var liveTracker = this.player_.liveTracker;\n\n if (liveTracker && liveTracker.isLive()) {\n percent = (currentTime - liveTracker.seekableStart()) / liveTracker.liveWindow(); // prevent the percent from changing at the live edge\n\n if (liveTracker.atLiveEdge()) {\n percent = 1;\n }\n } else {\n percent = currentTime / this.player_.duration();\n }\n\n return percent;\n }\n /**\n * Handle mouse down on seek bar\n *\n * @param {EventTarget~Event} event\n * The `mousedown` event that caused this to run.\n *\n * @listens mousedown\n */\n ;\n\n _proto.handleMouseDown = function handleMouseDown(event) {\n if (!isSingleLeftClick(event)) {\n return;\n } // Stop event propagation to prevent double fire in progress-control.js\n\n\n event.stopPropagation();\n this.videoWasPlaying = !this.player_.paused();\n this.player_.pause();\n\n _Slider.prototype.handleMouseDown.call(this, event);\n }\n /**\n * Handle mouse move on seek bar\n *\n * @param {EventTarget~Event} event\n * The `mousemove` event that caused this to run.\n * @param {boolean} mouseDown this is a flag that should be set to true if `handleMouseMove` is called directly. It allows us to skip things that should not happen if coming from mouse down but should happen on regular mouse move handler. Defaults to false\n *\n * @listens mousemove\n */\n ;\n\n _proto.handleMouseMove = function handleMouseMove(event, mouseDown) {\n if (mouseDown === void 0) {\n mouseDown = false;\n }\n\n if (!isSingleLeftClick(event)) {\n return;\n }\n\n if (!mouseDown && !this.player_.scrubbing()) {\n this.player_.scrubbing(true);\n }\n\n var newTime;\n var distance = this.calculateDistance(event);\n var liveTracker = this.player_.liveTracker;\n\n if (!liveTracker || !liveTracker.isLive()) {\n newTime = distance * this.player_.duration(); // Don't let video end while scrubbing.\n\n if (newTime === this.player_.duration()) {\n newTime = newTime - 0.1;\n }\n } else {\n if (distance >= 0.99) {\n liveTracker.seekToLiveEdge();\n return;\n }\n\n var seekableStart = liveTracker.seekableStart();\n var seekableEnd = liveTracker.liveCurrentTime();\n newTime = seekableStart + distance * liveTracker.liveWindow(); // Don't let video end while scrubbing.\n\n if (newTime >= seekableEnd) {\n newTime = seekableEnd;\n } // Compensate for precision differences so that currentTime is not less\n // than seekable start\n\n\n if (newTime <= seekableStart) {\n newTime = seekableStart + 0.1;\n } // On android seekableEnd can be Infinity sometimes,\n // this will cause newTime to be Infinity, which is\n // not a valid currentTime.\n\n\n if (newTime === Infinity) {\n return;\n }\n } // Set new time (tell player to seek to new time)\n\n\n this.userSeek_(newTime);\n };\n\n _proto.enable = function enable() {\n _Slider.prototype.enable.call(this);\n\n var mouseTimeDisplay = this.getChild('mouseTimeDisplay');\n\n if (!mouseTimeDisplay) {\n return;\n }\n\n mouseTimeDisplay.show();\n };\n\n _proto.disable = function disable() {\n _Slider.prototype.disable.call(this);\n\n var mouseTimeDisplay = this.getChild('mouseTimeDisplay');\n\n if (!mouseTimeDisplay) {\n return;\n }\n\n mouseTimeDisplay.hide();\n }\n /**\n * Handle mouse up on seek bar\n *\n * @param {EventTarget~Event} event\n * The `mouseup` event that caused this to run.\n *\n * @listens mouseup\n */\n ;\n\n _proto.handleMouseUp = function handleMouseUp(event) {\n _Slider.prototype.handleMouseUp.call(this, event); // Stop event propagation to prevent double fire in progress-control.js\n\n\n if (event) {\n event.stopPropagation();\n }\n\n this.player_.scrubbing(false);\n /**\n * Trigger timeupdate because we're done seeking and the time has changed.\n * This is particularly useful for if the player is paused to time the time displays.\n *\n * @event Tech#timeupdate\n * @type {EventTarget~Event}\n */\n\n this.player_.trigger({\n type: 'timeupdate',\n target: this,\n manuallyTriggered: true\n });\n\n if (this.videoWasPlaying) {\n silencePromise(this.player_.play());\n } else {\n // We're done seeking and the time has changed.\n // If the player is paused, make sure we display the correct time on the seek bar.\n this.update_();\n }\n }\n /**\n * Move more quickly fast forward for keyboard-only users\n */\n ;\n\n _proto.stepForward = function stepForward() {\n this.userSeek_(this.player_.currentTime() + STEP_SECONDS);\n }\n /**\n * Move more quickly rewind for keyboard-only users\n */\n ;\n\n _proto.stepBack = function stepBack() {\n this.userSeek_(this.player_.currentTime() - STEP_SECONDS);\n }\n /**\n * Toggles the playback state of the player\n * This gets called when enter or space is used on the seekbar\n *\n * @param {EventTarget~Event} event\n * The `keydown` event that caused this function to be called\n *\n */\n ;\n\n _proto.handleAction = function handleAction(event) {\n if (this.player_.paused()) {\n this.player_.play();\n } else {\n this.player_.pause();\n }\n }\n /**\n * Called when this SeekBar has focus and a key gets pressed down.\n * Supports the following keys:\n *\n * Space or Enter key fire a click event\n * Home key moves to start of the timeline\n * End key moves to end of the timeline\n * Digit \"0\" through \"9\" keys move to 0%, 10% ... 80%, 90% of the timeline\n * PageDown key moves back a larger step than ArrowDown\n * PageUp key moves forward a large step\n *\n * @param {EventTarget~Event} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n var liveTracker = this.player_.liveTracker;\n\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Space') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Enter')) {\n event.preventDefault();\n event.stopPropagation();\n this.handleAction(event);\n } else if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Home')) {\n event.preventDefault();\n event.stopPropagation();\n this.userSeek_(0);\n } else if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'End')) {\n event.preventDefault();\n event.stopPropagation();\n\n if (liveTracker && liveTracker.isLive()) {\n this.userSeek_(liveTracker.liveCurrentTime());\n } else {\n this.userSeek_(this.player_.duration());\n }\n } else if (/^[0-9]$/.test(keycode__WEBPACK_IMPORTED_MODULE_3___default()(event))) {\n event.preventDefault();\n event.stopPropagation();\n var gotoFraction = ((keycode__WEBPACK_IMPORTED_MODULE_3___default().codes)[keycode__WEBPACK_IMPORTED_MODULE_3___default()(event)] - (keycode__WEBPACK_IMPORTED_MODULE_3___default().codes)['0']) * 10.0 / 100.0;\n\n if (liveTracker && liveTracker.isLive()) {\n this.userSeek_(liveTracker.seekableStart() + liveTracker.liveWindow() * gotoFraction);\n } else {\n this.userSeek_(this.player_.duration() * gotoFraction);\n }\n } else if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'PgDn')) {\n event.preventDefault();\n event.stopPropagation();\n this.userSeek_(this.player_.currentTime() - STEP_SECONDS * PAGE_KEY_MULTIPLIER);\n } else if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'PgUp')) {\n event.preventDefault();\n event.stopPropagation();\n this.userSeek_(this.player_.currentTime() + STEP_SECONDS * PAGE_KEY_MULTIPLIER);\n } else {\n // Pass keydown handling up for unsupported keys\n _Slider.prototype.handleKeyDown.call(this, event);\n }\n };\n\n _proto.dispose = function dispose() {\n this.disableInterval_();\n this.off(this.player_, ['ended', 'durationchange', 'timeupdate'], this.update);\n\n if (this.player_.liveTracker) {\n this.off(this.player_.liveTracker, 'liveedgechange', this.update);\n }\n\n this.off(this.player_, ['playing'], this.enableIntervalHandler_);\n this.off(this.player_, ['ended', 'pause', 'waiting'], this.disableIntervalHandler_); // we don't need to update the play progress if the document is hidden,\n // also, this causes the CPU to spike and eventually crash the page on IE11.\n\n if (\"hidden\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default()) && \"visibilityState\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default())) {\n this.off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'visibilitychange', this.toggleVisibility_);\n }\n\n _Slider.prototype.dispose.call(this);\n };\n\n return SeekBar;\n}(Slider);\n/**\n * Default options for the `SeekBar`\n *\n * @type {Object}\n * @private\n */\n\n\nSeekBar.prototype.options_ = {\n children: ['loadProgressBar', 'playProgressBar'],\n barName: 'playProgressBar'\n}; // MouseTimeDisplay tooltips should not be added to a player on mobile devices\n\nif (!IS_IOS && !IS_ANDROID) {\n SeekBar.prototype.options_.children.splice(1, 0, 'mouseTimeDisplay');\n}\n\nComponent$1.registerComponent('SeekBar', SeekBar);\n\n/**\n * The Progress Control component contains the seek bar, load progress,\n * and play progress.\n *\n * @extends Component\n */\n\nvar ProgressControl = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(ProgressControl, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function ProgressControl(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n _this.handleMouseMove = throttle(bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), _this.handleMouseMove), UPDATE_REFRESH_INTERVAL);\n _this.throttledHandleMouseSeek = throttle(bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), _this.handleMouseSeek), UPDATE_REFRESH_INTERVAL);\n\n _this.handleMouseUpHandler_ = function (e) {\n return _this.handleMouseUp(e);\n };\n\n _this.handleMouseDownHandler_ = function (e) {\n return _this.handleMouseDown(e);\n };\n\n _this.enable();\n\n return _this;\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = ProgressControl.prototype;\n\n _proto.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-progress-control vjs-control'\n });\n }\n /**\n * When the mouse moves over the `ProgressControl`, the pointer position\n * gets passed down to the `MouseTimeDisplay` component.\n *\n * @param {EventTarget~Event} event\n * The `mousemove` event that caused this function to run.\n *\n * @listen mousemove\n */\n ;\n\n _proto.handleMouseMove = function handleMouseMove(event) {\n var seekBar = this.getChild('seekBar');\n\n if (!seekBar) {\n return;\n }\n\n var playProgressBar = seekBar.getChild('playProgressBar');\n var mouseTimeDisplay = seekBar.getChild('mouseTimeDisplay');\n\n if (!playProgressBar && !mouseTimeDisplay) {\n return;\n }\n\n var seekBarEl = seekBar.el();\n var seekBarRect = findPosition(seekBarEl);\n var seekBarPoint = getPointerPosition(seekBarEl, event).x; // The default skin has a gap on either side of the `SeekBar`. This means\n // that it's possible to trigger this behavior outside the boundaries of\n // the `SeekBar`. This ensures we stay within it at all times.\n\n seekBarPoint = clamp(seekBarPoint, 0, 1);\n\n if (mouseTimeDisplay) {\n mouseTimeDisplay.update(seekBarRect, seekBarPoint);\n }\n\n if (playProgressBar) {\n playProgressBar.update(seekBarRect, seekBar.getProgress());\n }\n }\n /**\n * A throttled version of the {@link ProgressControl#handleMouseSeek} listener.\n *\n * @method ProgressControl#throttledHandleMouseSeek\n * @param {EventTarget~Event} event\n * The `mousemove` event that caused this function to run.\n *\n * @listen mousemove\n * @listen touchmove\n */\n\n /**\n * Handle `mousemove` or `touchmove` events on the `ProgressControl`.\n *\n * @param {EventTarget~Event} event\n * `mousedown` or `touchstart` event that triggered this function\n *\n * @listens mousemove\n * @listens touchmove\n */\n ;\n\n _proto.handleMouseSeek = function handleMouseSeek(event) {\n var seekBar = this.getChild('seekBar');\n\n if (seekBar) {\n seekBar.handleMouseMove(event);\n }\n }\n /**\n * Are controls are currently enabled for this progress control.\n *\n * @return {boolean}\n * true if controls are enabled, false otherwise\n */\n ;\n\n _proto.enabled = function enabled() {\n return this.enabled_;\n }\n /**\n * Disable all controls on the progress control and its children\n */\n ;\n\n _proto.disable = function disable() {\n this.children().forEach(function (child) {\n return child.disable && child.disable();\n });\n\n if (!this.enabled()) {\n return;\n }\n\n this.off(['mousedown', 'touchstart'], this.handleMouseDownHandler_);\n this.off(this.el_, 'mousemove', this.handleMouseMove);\n this.removeListenersAddedOnMousedownAndTouchstart();\n this.addClass('disabled');\n this.enabled_ = false; // Restore normal playback state if controls are disabled while scrubbing\n\n if (this.player_.scrubbing()) {\n var seekBar = this.getChild('seekBar');\n this.player_.scrubbing(false);\n\n if (seekBar.videoWasPlaying) {\n silencePromise(this.player_.play());\n }\n }\n }\n /**\n * Enable all controls on the progress control and its children\n */\n ;\n\n _proto.enable = function enable() {\n this.children().forEach(function (child) {\n return child.enable && child.enable();\n });\n\n if (this.enabled()) {\n return;\n }\n\n this.on(['mousedown', 'touchstart'], this.handleMouseDownHandler_);\n this.on(this.el_, 'mousemove', this.handleMouseMove);\n this.removeClass('disabled');\n this.enabled_ = true;\n }\n /**\n * Cleanup listeners after the user finishes interacting with the progress controls\n */\n ;\n\n _proto.removeListenersAddedOnMousedownAndTouchstart = function removeListenersAddedOnMousedownAndTouchstart() {\n var doc = this.el_.ownerDocument;\n this.off(doc, 'mousemove', this.throttledHandleMouseSeek);\n this.off(doc, 'touchmove', this.throttledHandleMouseSeek);\n this.off(doc, 'mouseup', this.handleMouseUpHandler_);\n this.off(doc, 'touchend', this.handleMouseUpHandler_);\n }\n /**\n * Handle `mousedown` or `touchstart` events on the `ProgressControl`.\n *\n * @param {EventTarget~Event} event\n * `mousedown` or `touchstart` event that triggered this function\n *\n * @listens mousedown\n * @listens touchstart\n */\n ;\n\n _proto.handleMouseDown = function handleMouseDown(event) {\n var doc = this.el_.ownerDocument;\n var seekBar = this.getChild('seekBar');\n\n if (seekBar) {\n seekBar.handleMouseDown(event);\n }\n\n this.on(doc, 'mousemove', this.throttledHandleMouseSeek);\n this.on(doc, 'touchmove', this.throttledHandleMouseSeek);\n this.on(doc, 'mouseup', this.handleMouseUpHandler_);\n this.on(doc, 'touchend', this.handleMouseUpHandler_);\n }\n /**\n * Handle `mouseup` or `touchend` events on the `ProgressControl`.\n *\n * @param {EventTarget~Event} event\n * `mouseup` or `touchend` event that triggered this function.\n *\n * @listens touchend\n * @listens mouseup\n */\n ;\n\n _proto.handleMouseUp = function handleMouseUp(event) {\n var seekBar = this.getChild('seekBar');\n\n if (seekBar) {\n seekBar.handleMouseUp(event);\n }\n\n this.removeListenersAddedOnMousedownAndTouchstart();\n };\n\n return ProgressControl;\n}(Component$1);\n/**\n * Default options for `ProgressControl`\n *\n * @type {Object}\n * @private\n */\n\n\nProgressControl.prototype.options_ = {\n children: ['seekBar']\n};\nComponent$1.registerComponent('ProgressControl', ProgressControl);\n\n/**\n * Toggle Picture-in-Picture mode\n *\n * @extends Button\n */\n\nvar PictureInPictureToggle = /*#__PURE__*/function (_Button) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(PictureInPictureToggle, _Button);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @listens Player#enterpictureinpicture\n * @listens Player#leavepictureinpicture\n */\n function PictureInPictureToggle(player, options) {\n var _this;\n\n _this = _Button.call(this, player, options) || this;\n\n _this.on(player, ['enterpictureinpicture', 'leavepictureinpicture'], function (e) {\n return _this.handlePictureInPictureChange(e);\n });\n\n _this.on(player, ['disablepictureinpicturechanged', 'loadedmetadata'], function (e) {\n return _this.handlePictureInPictureEnabledChange(e);\n });\n\n _this.on(player, ['loadedmetadata', 'audioonlymodechange', 'audiopostermodechange'], function () {\n // This audio detection will not detect HLS or DASH audio-only streams because there was no reliable way to detect them at the time\n var isSourceAudio = player.currentType().substring(0, 5) === 'audio';\n\n if (isSourceAudio || player.audioPosterMode() || player.audioOnlyMode()) {\n if (player.isInPictureInPicture()) {\n player.exitPictureInPicture();\n }\n\n _this.hide();\n } else {\n _this.show();\n }\n }); // TODO: Deactivate button on player emptied event.\n\n\n _this.disable();\n\n return _this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = PictureInPictureToggle.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-picture-in-picture-control \" + _Button.prototype.buildCSSClass.call(this);\n }\n /**\n * Enables or disables button based on document.pictureInPictureEnabled property value\n * or on value returned by player.disablePictureInPicture() method.\n */\n ;\n\n _proto.handlePictureInPictureEnabledChange = function handlePictureInPictureEnabledChange() {\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default().pictureInPictureEnabled) && this.player_.disablePictureInPicture() === false) {\n this.enable();\n } else {\n this.disable();\n }\n }\n /**\n * Handles enterpictureinpicture and leavepictureinpicture on the player and change control text accordingly.\n *\n * @param {EventTarget~Event} [event]\n * The {@link Player#enterpictureinpicture} or {@link Player#leavepictureinpicture} event that caused this function to be\n * called.\n *\n * @listens Player#enterpictureinpicture\n * @listens Player#leavepictureinpicture\n */\n ;\n\n _proto.handlePictureInPictureChange = function handlePictureInPictureChange(event) {\n if (this.player_.isInPictureInPicture()) {\n this.controlText('Exit Picture-in-Picture');\n } else {\n this.controlText('Picture-in-Picture');\n }\n\n this.handlePictureInPictureEnabledChange();\n }\n /**\n * This gets called when an `PictureInPictureToggle` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {EventTarget~Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n if (!this.player_.isInPictureInPicture()) {\n this.player_.requestPictureInPicture();\n } else {\n this.player_.exitPictureInPicture();\n }\n };\n\n return PictureInPictureToggle;\n}(Button);\n/**\n * The text that should display over the `PictureInPictureToggle`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\n\n\nPictureInPictureToggle.prototype.controlText_ = 'Picture-in-Picture';\nComponent$1.registerComponent('PictureInPictureToggle', PictureInPictureToggle);\n\n/**\n * Toggle fullscreen video\n *\n * @extends Button\n */\n\nvar FullscreenToggle = /*#__PURE__*/function (_Button) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(FullscreenToggle, _Button);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function FullscreenToggle(player, options) {\n var _this;\n\n _this = _Button.call(this, player, options) || this;\n\n _this.on(player, 'fullscreenchange', function (e) {\n return _this.handleFullscreenChange(e);\n });\n\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default())[player.fsApi_.fullscreenEnabled] === false) {\n _this.disable();\n }\n\n return _this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = FullscreenToggle.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-fullscreen-control \" + _Button.prototype.buildCSSClass.call(this);\n }\n /**\n * Handles fullscreenchange on the player and change control text accordingly.\n *\n * @param {EventTarget~Event} [event]\n * The {@link Player#fullscreenchange} event that caused this function to be\n * called.\n *\n * @listens Player#fullscreenchange\n */\n ;\n\n _proto.handleFullscreenChange = function handleFullscreenChange(event) {\n if (this.player_.isFullscreen()) {\n this.controlText('Non-Fullscreen');\n } else {\n this.controlText('Fullscreen');\n }\n }\n /**\n * This gets called when an `FullscreenToggle` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {EventTarget~Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n if (!this.player_.isFullscreen()) {\n this.player_.requestFullscreen();\n } else {\n this.player_.exitFullscreen();\n }\n };\n\n return FullscreenToggle;\n}(Button);\n/**\n * The text that should display over the `FullscreenToggle`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\n\n\nFullscreenToggle.prototype.controlText_ = 'Fullscreen';\nComponent$1.registerComponent('FullscreenToggle', FullscreenToggle);\n\n/**\n * Check if volume control is supported and if it isn't hide the\n * `Component` that was passed using the `vjs-hidden` class.\n *\n * @param {Component} self\n * The component that should be hidden if volume is unsupported\n *\n * @param {Player} player\n * A reference to the player\n *\n * @private\n */\nvar checkVolumeSupport = function checkVolumeSupport(self, player) {\n // hide volume controls when they're not supported by the current tech\n if (player.tech_ && !player.tech_.featuresVolumeControl) {\n self.addClass('vjs-hidden');\n }\n\n self.on(player, 'loadstart', function () {\n if (!player.tech_.featuresVolumeControl) {\n self.addClass('vjs-hidden');\n } else {\n self.removeClass('vjs-hidden');\n }\n });\n};\n\n/**\n * Shows volume level\n *\n * @extends Component\n */\n\nvar VolumeLevel = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(VolumeLevel, _Component);\n\n function VolumeLevel() {\n return _Component.apply(this, arguments) || this;\n }\n\n var _proto = VolumeLevel.prototype;\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n _proto.createEl = function createEl() {\n var el = _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-volume-level'\n });\n\n el.appendChild(_Component.prototype.createEl.call(this, 'span', {\n className: 'vjs-control-text'\n }));\n return el;\n };\n\n return VolumeLevel;\n}(Component$1);\n\nComponent$1.registerComponent('VolumeLevel', VolumeLevel);\n\n/**\n * Volume level tooltips display a volume above or side by side the volume bar.\n *\n * @extends Component\n */\n\nvar VolumeLevelTooltip = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(VolumeLevelTooltip, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The {@link Player} that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function VolumeLevelTooltip(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n _this.update = throttle(bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), _this.update), UPDATE_REFRESH_INTERVAL);\n return _this;\n }\n /**\n * Create the volume tooltip DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = VolumeLevelTooltip.prototype;\n\n _proto.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-volume-tooltip'\n }, {\n 'aria-hidden': 'true'\n });\n }\n /**\n * Updates the position of the tooltip relative to the `VolumeBar` and\n * its content text.\n *\n * @param {Object} rangeBarRect\n * The `ClientRect` for the {@link VolumeBar} element.\n *\n * @param {number} rangeBarPoint\n * A number from 0 to 1, representing a horizontal/vertical reference point\n * from the left edge of the {@link VolumeBar}\n *\n * @param {boolean} vertical\n * Referees to the Volume control position\n * in the control bar{@link VolumeControl}\n *\n */\n ;\n\n _proto.update = function update(rangeBarRect, rangeBarPoint, vertical, content) {\n if (!vertical) {\n var tooltipRect = getBoundingClientRect(this.el_);\n var playerRect = getBoundingClientRect(this.player_.el());\n var volumeBarPointPx = rangeBarRect.width * rangeBarPoint;\n\n if (!playerRect || !tooltipRect) {\n return;\n }\n\n var spaceLeftOfPoint = rangeBarRect.left - playerRect.left + volumeBarPointPx;\n var spaceRightOfPoint = rangeBarRect.width - volumeBarPointPx + (playerRect.right - rangeBarRect.right);\n var pullTooltipBy = tooltipRect.width / 2;\n\n if (spaceLeftOfPoint < pullTooltipBy) {\n pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;\n } else if (spaceRightOfPoint < pullTooltipBy) {\n pullTooltipBy = spaceRightOfPoint;\n }\n\n if (pullTooltipBy < 0) {\n pullTooltipBy = 0;\n } else if (pullTooltipBy > tooltipRect.width) {\n pullTooltipBy = tooltipRect.width;\n }\n\n this.el_.style.right = \"-\" + pullTooltipBy + \"px\";\n }\n\n this.write(content + \"%\");\n }\n /**\n * Write the volume to the tooltip DOM element.\n *\n * @param {string} content\n * The formatted volume for the tooltip.\n */\n ;\n\n _proto.write = function write(content) {\n textContent(this.el_, content);\n }\n /**\n * Updates the position of the volume tooltip relative to the `VolumeBar`.\n *\n * @param {Object} rangeBarRect\n * The `ClientRect` for the {@link VolumeBar} element.\n *\n * @param {number} rangeBarPoint\n * A number from 0 to 1, representing a horizontal/vertical reference point\n * from the left edge of the {@link VolumeBar}\n *\n * @param {boolean} vertical\n * Referees to the Volume control position\n * in the control bar{@link VolumeControl}\n *\n * @param {number} volume\n * The volume level to update the tooltip to\n *\n * @param {Function} cb\n * A function that will be called during the request animation frame\n * for tooltips that need to do additional animations from the default\n */\n ;\n\n _proto.updateVolume = function updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, cb) {\n var _this2 = this;\n\n this.requestNamedAnimationFrame('VolumeLevelTooltip#updateVolume', function () {\n _this2.update(rangeBarRect, rangeBarPoint, vertical, volume.toFixed(0));\n\n if (cb) {\n cb();\n }\n });\n };\n\n return VolumeLevelTooltip;\n}(Component$1);\n\nComponent$1.registerComponent('VolumeLevelTooltip', VolumeLevelTooltip);\n\n/**\n * The {@link MouseVolumeLevelDisplay} component tracks mouse movement over the\n * {@link VolumeControl}. It displays an indicator and a {@link VolumeLevelTooltip}\n * indicating the volume level which is represented by a given point in the\n * {@link VolumeBar}.\n *\n * @extends Component\n */\n\nvar MouseVolumeLevelDisplay = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(MouseVolumeLevelDisplay, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The {@link Player} that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function MouseVolumeLevelDisplay(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n _this.update = throttle(bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), _this.update), UPDATE_REFRESH_INTERVAL);\n return _this;\n }\n /**\n * Create the DOM element for this class.\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = MouseVolumeLevelDisplay.prototype;\n\n _proto.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-mouse-display'\n });\n }\n /**\n * Enquires updates to its own DOM as well as the DOM of its\n * {@link VolumeLevelTooltip} child.\n *\n * @param {Object} rangeBarRect\n * The `ClientRect` for the {@link VolumeBar} element.\n *\n * @param {number} rangeBarPoint\n * A number from 0 to 1, representing a horizontal/vertical reference point\n * from the left edge of the {@link VolumeBar}\n *\n * @param {boolean} vertical\n * Referees to the Volume control position\n * in the control bar{@link VolumeControl}\n *\n */\n ;\n\n _proto.update = function update(rangeBarRect, rangeBarPoint, vertical) {\n var _this2 = this;\n\n var volume = 100 * rangeBarPoint;\n this.getChild('volumeLevelTooltip').updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, function () {\n if (vertical) {\n _this2.el_.style.bottom = rangeBarRect.height * rangeBarPoint + \"px\";\n } else {\n _this2.el_.style.left = rangeBarRect.width * rangeBarPoint + \"px\";\n }\n });\n };\n\n return MouseVolumeLevelDisplay;\n}(Component$1);\n/**\n * Default options for `MouseVolumeLevelDisplay`\n *\n * @type {Object}\n * @private\n */\n\n\nMouseVolumeLevelDisplay.prototype.options_ = {\n children: ['volumeLevelTooltip']\n};\nComponent$1.registerComponent('MouseVolumeLevelDisplay', MouseVolumeLevelDisplay);\n\n/**\n * The bar that contains the volume level and can be clicked on to adjust the level\n *\n * @extends Slider\n */\n\nvar VolumeBar = /*#__PURE__*/function (_Slider) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(VolumeBar, _Slider);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function VolumeBar(player, options) {\n var _this;\n\n _this = _Slider.call(this, player, options) || this;\n\n _this.on('slideractive', function (e) {\n return _this.updateLastVolume_(e);\n });\n\n _this.on(player, 'volumechange', function (e) {\n return _this.updateARIAAttributes(e);\n });\n\n player.ready(function () {\n return _this.updateARIAAttributes();\n });\n return _this;\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = VolumeBar.prototype;\n\n _proto.createEl = function createEl() {\n return _Slider.prototype.createEl.call(this, 'div', {\n className: 'vjs-volume-bar vjs-slider-bar'\n }, {\n 'aria-label': this.localize('Volume Level'),\n 'aria-live': 'polite'\n });\n }\n /**\n * Handle mouse down on volume bar\n *\n * @param {EventTarget~Event} event\n * The `mousedown` event that caused this to run.\n *\n * @listens mousedown\n */\n ;\n\n _proto.handleMouseDown = function handleMouseDown(event) {\n if (!isSingleLeftClick(event)) {\n return;\n }\n\n _Slider.prototype.handleMouseDown.call(this, event);\n }\n /**\n * Handle movement events on the {@link VolumeMenuButton}.\n *\n * @param {EventTarget~Event} event\n * The event that caused this function to run.\n *\n * @listens mousemove\n */\n ;\n\n _proto.handleMouseMove = function handleMouseMove(event) {\n var mouseVolumeLevelDisplay = this.getChild('mouseVolumeLevelDisplay');\n\n if (mouseVolumeLevelDisplay) {\n var volumeBarEl = this.el();\n var volumeBarRect = getBoundingClientRect(volumeBarEl);\n var vertical = this.vertical();\n var volumeBarPoint = getPointerPosition(volumeBarEl, event);\n volumeBarPoint = vertical ? volumeBarPoint.y : volumeBarPoint.x; // The default skin has a gap on either side of the `VolumeBar`. This means\n // that it's possible to trigger this behavior outside the boundaries of\n // the `VolumeBar`. This ensures we stay within it at all times.\n\n volumeBarPoint = clamp(volumeBarPoint, 0, 1);\n mouseVolumeLevelDisplay.update(volumeBarRect, volumeBarPoint, vertical);\n }\n\n if (!isSingleLeftClick(event)) {\n return;\n }\n\n this.checkMuted();\n this.player_.volume(this.calculateDistance(event));\n }\n /**\n * If the player is muted unmute it.\n */\n ;\n\n _proto.checkMuted = function checkMuted() {\n if (this.player_.muted()) {\n this.player_.muted(false);\n }\n }\n /**\n * Get percent of volume level\n *\n * @return {number}\n * Volume level percent as a decimal number.\n */\n ;\n\n _proto.getPercent = function getPercent() {\n if (this.player_.muted()) {\n return 0;\n }\n\n return this.player_.volume();\n }\n /**\n * Increase volume level for keyboard users\n */\n ;\n\n _proto.stepForward = function stepForward() {\n this.checkMuted();\n this.player_.volume(this.player_.volume() + 0.1);\n }\n /**\n * Decrease volume level for keyboard users\n */\n ;\n\n _proto.stepBack = function stepBack() {\n this.checkMuted();\n this.player_.volume(this.player_.volume() - 0.1);\n }\n /**\n * Update ARIA accessibility attributes\n *\n * @param {EventTarget~Event} [event]\n * The `volumechange` event that caused this function to run.\n *\n * @listens Player#volumechange\n */\n ;\n\n _proto.updateARIAAttributes = function updateARIAAttributes(event) {\n var ariaValue = this.player_.muted() ? 0 : this.volumeAsPercentage_();\n this.el_.setAttribute('aria-valuenow', ariaValue);\n this.el_.setAttribute('aria-valuetext', ariaValue + '%');\n }\n /**\n * Returns the current value of the player volume as a percentage\n *\n * @private\n */\n ;\n\n _proto.volumeAsPercentage_ = function volumeAsPercentage_() {\n return Math.round(this.player_.volume() * 100);\n }\n /**\n * When user starts dragging the VolumeBar, store the volume and listen for\n * the end of the drag. When the drag ends, if the volume was set to zero,\n * set lastVolume to the stored volume.\n *\n * @listens slideractive\n * @private\n */\n ;\n\n _proto.updateLastVolume_ = function updateLastVolume_() {\n var _this2 = this;\n\n var volumeBeforeDrag = this.player_.volume();\n this.one('sliderinactive', function () {\n if (_this2.player_.volume() === 0) {\n _this2.player_.lastVolume_(volumeBeforeDrag);\n }\n });\n };\n\n return VolumeBar;\n}(Slider);\n/**\n * Default options for the `VolumeBar`\n *\n * @type {Object}\n * @private\n */\n\n\nVolumeBar.prototype.options_ = {\n children: ['volumeLevel'],\n barName: 'volumeLevel'\n}; // MouseVolumeLevelDisplay tooltip should not be added to a player on mobile devices\n\nif (!IS_IOS && !IS_ANDROID) {\n VolumeBar.prototype.options_.children.splice(0, 0, 'mouseVolumeLevelDisplay');\n}\n/**\n * Call the update event for this Slider when this event happens on the player.\n *\n * @type {string}\n */\n\n\nVolumeBar.prototype.playerEvent = 'volumechange';\nComponent$1.registerComponent('VolumeBar', VolumeBar);\n\n/**\n * The component for controlling the volume level\n *\n * @extends Component\n */\n\nvar VolumeControl = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(VolumeControl, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n function VolumeControl(player, options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n options.vertical = options.vertical || false; // Pass the vertical option down to the VolumeBar if\n // the VolumeBar is turned on.\n\n if (typeof options.volumeBar === 'undefined' || isPlain(options.volumeBar)) {\n options.volumeBar = options.volumeBar || {};\n options.volumeBar.vertical = options.vertical;\n }\n\n _this = _Component.call(this, player, options) || this; // hide this control if volume support is missing\n\n checkVolumeSupport((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), player);\n _this.throttledHandleMouseMove = throttle(bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), _this.handleMouseMove), UPDATE_REFRESH_INTERVAL);\n\n _this.handleMouseUpHandler_ = function (e) {\n return _this.handleMouseUp(e);\n };\n\n _this.on('mousedown', function (e) {\n return _this.handleMouseDown(e);\n });\n\n _this.on('touchstart', function (e) {\n return _this.handleMouseDown(e);\n });\n\n _this.on('mousemove', function (e) {\n return _this.handleMouseMove(e);\n }); // while the slider is active (the mouse has been pressed down and\n // is dragging) or in focus we do not want to hide the VolumeBar\n\n\n _this.on(_this.volumeBar, ['focus', 'slideractive'], function () {\n _this.volumeBar.addClass('vjs-slider-active');\n\n _this.addClass('vjs-slider-active');\n\n _this.trigger('slideractive');\n });\n\n _this.on(_this.volumeBar, ['blur', 'sliderinactive'], function () {\n _this.volumeBar.removeClass('vjs-slider-active');\n\n _this.removeClass('vjs-slider-active');\n\n _this.trigger('sliderinactive');\n });\n\n return _this;\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = VolumeControl.prototype;\n\n _proto.createEl = function createEl() {\n var orientationClass = 'vjs-volume-horizontal';\n\n if (this.options_.vertical) {\n orientationClass = 'vjs-volume-vertical';\n }\n\n return _Component.prototype.createEl.call(this, 'div', {\n className: \"vjs-volume-control vjs-control \" + orientationClass\n });\n }\n /**\n * Handle `mousedown` or `touchstart` events on the `VolumeControl`.\n *\n * @param {EventTarget~Event} event\n * `mousedown` or `touchstart` event that triggered this function\n *\n * @listens mousedown\n * @listens touchstart\n */\n ;\n\n _proto.handleMouseDown = function handleMouseDown(event) {\n var doc = this.el_.ownerDocument;\n this.on(doc, 'mousemove', this.throttledHandleMouseMove);\n this.on(doc, 'touchmove', this.throttledHandleMouseMove);\n this.on(doc, 'mouseup', this.handleMouseUpHandler_);\n this.on(doc, 'touchend', this.handleMouseUpHandler_);\n }\n /**\n * Handle `mouseup` or `touchend` events on the `VolumeControl`.\n *\n * @param {EventTarget~Event} event\n * `mouseup` or `touchend` event that triggered this function.\n *\n * @listens touchend\n * @listens mouseup\n */\n ;\n\n _proto.handleMouseUp = function handleMouseUp(event) {\n var doc = this.el_.ownerDocument;\n this.off(doc, 'mousemove', this.throttledHandleMouseMove);\n this.off(doc, 'touchmove', this.throttledHandleMouseMove);\n this.off(doc, 'mouseup', this.handleMouseUpHandler_);\n this.off(doc, 'touchend', this.handleMouseUpHandler_);\n }\n /**\n * Handle `mousedown` or `touchstart` events on the `VolumeControl`.\n *\n * @param {EventTarget~Event} event\n * `mousedown` or `touchstart` event that triggered this function\n *\n * @listens mousedown\n * @listens touchstart\n */\n ;\n\n _proto.handleMouseMove = function handleMouseMove(event) {\n this.volumeBar.handleMouseMove(event);\n };\n\n return VolumeControl;\n}(Component$1);\n/**\n * Default options for the `VolumeControl`\n *\n * @type {Object}\n * @private\n */\n\n\nVolumeControl.prototype.options_ = {\n children: ['volumeBar']\n};\nComponent$1.registerComponent('VolumeControl', VolumeControl);\n\n/**\n * Check if muting volume is supported and if it isn't hide the mute toggle\n * button.\n *\n * @param {Component} self\n * A reference to the mute toggle button\n *\n * @param {Player} player\n * A reference to the player\n *\n * @private\n */\nvar checkMuteSupport = function checkMuteSupport(self, player) {\n // hide mute toggle button if it's not supported by the current tech\n if (player.tech_ && !player.tech_.featuresMuteControl) {\n self.addClass('vjs-hidden');\n }\n\n self.on(player, 'loadstart', function () {\n if (!player.tech_.featuresMuteControl) {\n self.addClass('vjs-hidden');\n } else {\n self.removeClass('vjs-hidden');\n }\n });\n};\n\n/**\n * A button component for muting the audio.\n *\n * @extends Button\n */\n\nvar MuteToggle = /*#__PURE__*/function (_Button) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(MuteToggle, _Button);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function MuteToggle(player, options) {\n var _this;\n\n _this = _Button.call(this, player, options) || this; // hide this control if volume support is missing\n\n checkMuteSupport((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), player);\n\n _this.on(player, ['loadstart', 'volumechange'], function (e) {\n return _this.update(e);\n });\n\n return _this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = MuteToggle.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-mute-control \" + _Button.prototype.buildCSSClass.call(this);\n }\n /**\n * This gets called when an `MuteToggle` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {EventTarget~Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n var vol = this.player_.volume();\n var lastVolume = this.player_.lastVolume_();\n\n if (vol === 0) {\n var volumeToSet = lastVolume < 0.1 ? 0.1 : lastVolume;\n this.player_.volume(volumeToSet);\n this.player_.muted(false);\n } else {\n this.player_.muted(this.player_.muted() ? false : true);\n }\n }\n /**\n * Update the `MuteToggle` button based on the state of `volume` and `muted`\n * on the player.\n *\n * @param {EventTarget~Event} [event]\n * The {@link Player#loadstart} event if this function was called\n * through an event.\n *\n * @listens Player#loadstart\n * @listens Player#volumechange\n */\n ;\n\n _proto.update = function update(event) {\n this.updateIcon_();\n this.updateControlText_();\n }\n /**\n * Update the appearance of the `MuteToggle` icon.\n *\n * Possible states (given `level` variable below):\n * - 0: crossed out\n * - 1: zero bars of volume\n * - 2: one bar of volume\n * - 3: two bars of volume\n *\n * @private\n */\n ;\n\n _proto.updateIcon_ = function updateIcon_() {\n var vol = this.player_.volume();\n var level = 3; // in iOS when a player is loaded with muted attribute\n // and volume is changed with a native mute button\n // we want to make sure muted state is updated\n\n if (IS_IOS && this.player_.tech_ && this.player_.tech_.el_) {\n this.player_.muted(this.player_.tech_.el_.muted);\n }\n\n if (vol === 0 || this.player_.muted()) {\n level = 0;\n } else if (vol < 0.33) {\n level = 1;\n } else if (vol < 0.67) {\n level = 2;\n } // TODO improve muted icon classes\n\n\n for (var i = 0; i < 4; i++) {\n removeClass(this.el_, \"vjs-vol-\" + i);\n }\n\n addClass(this.el_, \"vjs-vol-\" + level);\n }\n /**\n * If `muted` has changed on the player, update the control text\n * (`title` attribute on `vjs-mute-control` element and content of\n * `vjs-control-text` element).\n *\n * @private\n */\n ;\n\n _proto.updateControlText_ = function updateControlText_() {\n var soundOff = this.player_.muted() || this.player_.volume() === 0;\n var text = soundOff ? 'Unmute' : 'Mute';\n\n if (this.controlText() !== text) {\n this.controlText(text);\n }\n };\n\n return MuteToggle;\n}(Button);\n/**\n * The text that should display over the `MuteToggle`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\n\n\nMuteToggle.prototype.controlText_ = 'Mute';\nComponent$1.registerComponent('MuteToggle', MuteToggle);\n\n/**\n * A Component to contain the MuteToggle and VolumeControl so that\n * they can work together.\n *\n * @extends Component\n */\n\nvar VolumePanel = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(VolumePanel, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n function VolumePanel(player, options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n if (typeof options.inline !== 'undefined') {\n options.inline = options.inline;\n } else {\n options.inline = true;\n } // pass the inline option down to the VolumeControl as vertical if\n // the VolumeControl is on.\n\n\n if (typeof options.volumeControl === 'undefined' || isPlain(options.volumeControl)) {\n options.volumeControl = options.volumeControl || {};\n options.volumeControl.vertical = !options.inline;\n }\n\n _this = _Component.call(this, player, options) || this; // this handler is used by mouse handler methods below\n\n _this.handleKeyPressHandler_ = function (e) {\n return _this.handleKeyPress(e);\n };\n\n _this.on(player, ['loadstart'], function (e) {\n return _this.volumePanelState_(e);\n });\n\n _this.on(_this.muteToggle, 'keyup', function (e) {\n return _this.handleKeyPress(e);\n });\n\n _this.on(_this.volumeControl, 'keyup', function (e) {\n return _this.handleVolumeControlKeyUp(e);\n });\n\n _this.on('keydown', function (e) {\n return _this.handleKeyPress(e);\n });\n\n _this.on('mouseover', function (e) {\n return _this.handleMouseOver(e);\n });\n\n _this.on('mouseout', function (e) {\n return _this.handleMouseOut(e);\n }); // while the slider is active (the mouse has been pressed down and\n // is dragging) we do not want to hide the VolumeBar\n\n\n _this.on(_this.volumeControl, ['slideractive'], _this.sliderActive_);\n\n _this.on(_this.volumeControl, ['sliderinactive'], _this.sliderInactive_);\n\n return _this;\n }\n /**\n * Add vjs-slider-active class to the VolumePanel\n *\n * @listens VolumeControl#slideractive\n * @private\n */\n\n\n var _proto = VolumePanel.prototype;\n\n _proto.sliderActive_ = function sliderActive_() {\n this.addClass('vjs-slider-active');\n }\n /**\n * Removes vjs-slider-active class to the VolumePanel\n *\n * @listens VolumeControl#sliderinactive\n * @private\n */\n ;\n\n _proto.sliderInactive_ = function sliderInactive_() {\n this.removeClass('vjs-slider-active');\n }\n /**\n * Adds vjs-hidden or vjs-mute-toggle-only to the VolumePanel\n * depending on MuteToggle and VolumeControl state\n *\n * @listens Player#loadstart\n * @private\n */\n ;\n\n _proto.volumePanelState_ = function volumePanelState_() {\n // hide volume panel if neither volume control or mute toggle\n // are displayed\n if (this.volumeControl.hasClass('vjs-hidden') && this.muteToggle.hasClass('vjs-hidden')) {\n this.addClass('vjs-hidden');\n } // if only mute toggle is visible we don't want\n // volume panel expanding when hovered or active\n\n\n if (this.volumeControl.hasClass('vjs-hidden') && !this.muteToggle.hasClass('vjs-hidden')) {\n this.addClass('vjs-mute-toggle-only');\n }\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n ;\n\n _proto.createEl = function createEl() {\n var orientationClass = 'vjs-volume-panel-horizontal';\n\n if (!this.options_.inline) {\n orientationClass = 'vjs-volume-panel-vertical';\n }\n\n return _Component.prototype.createEl.call(this, 'div', {\n className: \"vjs-volume-panel vjs-control \" + orientationClass\n });\n }\n /**\n * Dispose of the `volume-panel` and all child components.\n */\n ;\n\n _proto.dispose = function dispose() {\n this.handleMouseOut();\n\n _Component.prototype.dispose.call(this);\n }\n /**\n * Handles `keyup` events on the `VolumeControl`, looking for ESC, which closes\n * the volume panel and sets focus on `MuteToggle`.\n *\n * @param {EventTarget~Event} event\n * The `keyup` event that caused this function to be called.\n *\n * @listens keyup\n */\n ;\n\n _proto.handleVolumeControlKeyUp = function handleVolumeControlKeyUp(event) {\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Esc')) {\n this.muteToggle.focus();\n }\n }\n /**\n * This gets called when a `VolumePanel` gains hover via a `mouseover` event.\n * Turns on listening for `mouseover` event. When they happen it\n * calls `this.handleMouseOver`.\n *\n * @param {EventTarget~Event} event\n * The `mouseover` event that caused this function to be called.\n *\n * @listens mouseover\n */\n ;\n\n _proto.handleMouseOver = function handleMouseOver(event) {\n this.addClass('vjs-hover');\n on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keyup', this.handleKeyPressHandler_);\n }\n /**\n * This gets called when a `VolumePanel` gains hover via a `mouseout` event.\n * Turns on listening for `mouseout` event. When they happen it\n * calls `this.handleMouseOut`.\n *\n * @param {EventTarget~Event} event\n * The `mouseout` event that caused this function to be called.\n *\n * @listens mouseout\n */\n ;\n\n _proto.handleMouseOut = function handleMouseOut(event) {\n this.removeClass('vjs-hover');\n off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keyup', this.handleKeyPressHandler_);\n }\n /**\n * Handles `keyup` event on the document or `keydown` event on the `VolumePanel`,\n * looking for ESC, which hides the `VolumeControl`.\n *\n * @param {EventTarget~Event} event\n * The keypress that triggered this event.\n *\n * @listens keydown | keyup\n */\n ;\n\n _proto.handleKeyPress = function handleKeyPress(event) {\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Esc')) {\n this.handleMouseOut();\n }\n };\n\n return VolumePanel;\n}(Component$1);\n/**\n * Default options for the `VolumeControl`\n *\n * @type {Object}\n * @private\n */\n\n\nVolumePanel.prototype.options_ = {\n children: ['muteToggle', 'volumeControl']\n};\nComponent$1.registerComponent('VolumePanel', VolumePanel);\n\n/**\n * The Menu component is used to build popup menus, including subtitle and\n * captions selection menus.\n *\n * @extends Component\n */\n\nvar Menu = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(Menu, _Component);\n\n /**\n * Create an instance of this class.\n *\n * @param {Player} player\n * the player that this component should attach to\n *\n * @param {Object} [options]\n * Object of option names and values\n *\n */\n function Menu(player, options) {\n var _this;\n\n _this = _Component.call(this, player, options) || this;\n\n if (options) {\n _this.menuButton_ = options.menuButton;\n }\n\n _this.focusedChild_ = -1;\n\n _this.on('keydown', function (e) {\n return _this.handleKeyDown(e);\n }); // All the menu item instances share the same blur handler provided by the menu container.\n\n\n _this.boundHandleBlur_ = function (e) {\n return _this.handleBlur(e);\n };\n\n _this.boundHandleTapClick_ = function (e) {\n return _this.handleTapClick(e);\n };\n\n return _this;\n }\n /**\n * Add event listeners to the {@link MenuItem}.\n *\n * @param {Object} component\n * The instance of the `MenuItem` to add listeners to.\n *\n */\n\n\n var _proto = Menu.prototype;\n\n _proto.addEventListenerForItem = function addEventListenerForItem(component) {\n if (!(component instanceof Component$1)) {\n return;\n }\n\n this.on(component, 'blur', this.boundHandleBlur_);\n this.on(component, ['tap', 'click'], this.boundHandleTapClick_);\n }\n /**\n * Remove event listeners from the {@link MenuItem}.\n *\n * @param {Object} component\n * The instance of the `MenuItem` to remove listeners.\n *\n */\n ;\n\n _proto.removeEventListenerForItem = function removeEventListenerForItem(component) {\n if (!(component instanceof Component$1)) {\n return;\n }\n\n this.off(component, 'blur', this.boundHandleBlur_);\n this.off(component, ['tap', 'click'], this.boundHandleTapClick_);\n }\n /**\n * This method will be called indirectly when the component has been added\n * before the component adds to the new menu instance by `addItem`.\n * In this case, the original menu instance will remove the component\n * by calling `removeChild`.\n *\n * @param {Object} component\n * The instance of the `MenuItem`\n */\n ;\n\n _proto.removeChild = function removeChild(component) {\n if (typeof component === 'string') {\n component = this.getChild(component);\n }\n\n this.removeEventListenerForItem(component);\n\n _Component.prototype.removeChild.call(this, component);\n }\n /**\n * Add a {@link MenuItem} to the menu.\n *\n * @param {Object|string} component\n * The name or instance of the `MenuItem` to add.\n *\n */\n ;\n\n _proto.addItem = function addItem(component) {\n var childComponent = this.addChild(component);\n\n if (childComponent) {\n this.addEventListenerForItem(childComponent);\n }\n }\n /**\n * Create the `Menu`s DOM element.\n *\n * @return {Element}\n * the element that was created\n */\n ;\n\n _proto.createEl = function createEl$1() {\n var contentElType = this.options_.contentElType || 'ul';\n this.contentEl_ = createEl(contentElType, {\n className: 'vjs-menu-content'\n });\n this.contentEl_.setAttribute('role', 'menu');\n\n var el = _Component.prototype.createEl.call(this, 'div', {\n append: this.contentEl_,\n className: 'vjs-menu'\n });\n\n el.appendChild(this.contentEl_); // Prevent clicks from bubbling up. Needed for Menu Buttons,\n // where a click on the parent is significant\n\n on(el, 'click', function (event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n });\n return el;\n };\n\n _proto.dispose = function dispose() {\n this.contentEl_ = null;\n this.boundHandleBlur_ = null;\n this.boundHandleTapClick_ = null;\n\n _Component.prototype.dispose.call(this);\n }\n /**\n * Called when a `MenuItem` loses focus.\n *\n * @param {EventTarget~Event} event\n * The `blur` event that caused this function to be called.\n *\n * @listens blur\n */\n ;\n\n _proto.handleBlur = function handleBlur(event) {\n var relatedTarget = event.relatedTarget || (global_document__WEBPACK_IMPORTED_MODULE_1___default().activeElement); // Close menu popup when a user clicks outside the menu\n\n if (!this.children().some(function (element) {\n return element.el() === relatedTarget;\n })) {\n var btn = this.menuButton_;\n\n if (btn && btn.buttonPressed_ && relatedTarget !== btn.el().firstChild) {\n btn.unpressButton();\n }\n }\n }\n /**\n * Called when a `MenuItem` gets clicked or tapped.\n *\n * @param {EventTarget~Event} event\n * The `click` or `tap` event that caused this function to be called.\n *\n * @listens click,tap\n */\n ;\n\n _proto.handleTapClick = function handleTapClick(event) {\n // Unpress the associated MenuButton, and move focus back to it\n if (this.menuButton_) {\n this.menuButton_.unpressButton();\n var childComponents = this.children();\n\n if (!Array.isArray(childComponents)) {\n return;\n }\n\n var foundComponent = childComponents.filter(function (component) {\n return component.el() === event.target;\n })[0];\n\n if (!foundComponent) {\n return;\n } // don't focus menu button if item is a caption settings item\n // because focus will move elsewhere\n\n\n if (foundComponent.name() !== 'CaptionSettingsMenuItem') {\n this.menuButton_.focus();\n }\n }\n }\n /**\n * Handle a `keydown` event on this menu. This listener is added in the constructor.\n *\n * @param {EventTarget~Event} event\n * A `keydown` event that happened on the menu.\n *\n * @listens keydown\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n // Left and Down Arrows\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Left') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Down')) {\n event.preventDefault();\n event.stopPropagation();\n this.stepForward(); // Up and Right Arrows\n } else if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Right') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Up')) {\n event.preventDefault();\n event.stopPropagation();\n this.stepBack();\n }\n }\n /**\n * Move to next (lower) menu item for keyboard users.\n */\n ;\n\n _proto.stepForward = function stepForward() {\n var stepChild = 0;\n\n if (this.focusedChild_ !== undefined) {\n stepChild = this.focusedChild_ + 1;\n }\n\n this.focus(stepChild);\n }\n /**\n * Move to previous (higher) menu item for keyboard users.\n */\n ;\n\n _proto.stepBack = function stepBack() {\n var stepChild = 0;\n\n if (this.focusedChild_ !== undefined) {\n stepChild = this.focusedChild_ - 1;\n }\n\n this.focus(stepChild);\n }\n /**\n * Set focus on a {@link MenuItem} in the `Menu`.\n *\n * @param {Object|string} [item=0]\n * Index of child item set focus on.\n */\n ;\n\n _proto.focus = function focus(item) {\n if (item === void 0) {\n item = 0;\n }\n\n var children = this.children().slice();\n var haveTitle = children.length && children[0].hasClass('vjs-menu-title');\n\n if (haveTitle) {\n children.shift();\n }\n\n if (children.length > 0) {\n if (item < 0) {\n item = 0;\n } else if (item >= children.length) {\n item = children.length - 1;\n }\n\n this.focusedChild_ = item;\n children[item].el_.focus();\n }\n };\n\n return Menu;\n}(Component$1);\n\nComponent$1.registerComponent('Menu', Menu);\n\n/**\n * A `MenuButton` class for any popup {@link Menu}.\n *\n * @extends Component\n */\n\nvar MenuButton = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(MenuButton, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n function MenuButton(player, options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _Component.call(this, player, options) || this;\n _this.menuButton_ = new Button(player, options);\n\n _this.menuButton_.controlText(_this.controlText_);\n\n _this.menuButton_.el_.setAttribute('aria-haspopup', 'true'); // Add buildCSSClass values to the button, not the wrapper\n\n\n var buttonClass = Button.prototype.buildCSSClass();\n _this.menuButton_.el_.className = _this.buildCSSClass() + ' ' + buttonClass;\n\n _this.menuButton_.removeClass('vjs-control');\n\n _this.addChild(_this.menuButton_);\n\n _this.update();\n\n _this.enabled_ = true;\n\n var handleClick = function handleClick(e) {\n return _this.handleClick(e);\n };\n\n _this.handleMenuKeyUp_ = function (e) {\n return _this.handleMenuKeyUp(e);\n };\n\n _this.on(_this.menuButton_, 'tap', handleClick);\n\n _this.on(_this.menuButton_, 'click', handleClick);\n\n _this.on(_this.menuButton_, 'keydown', function (e) {\n return _this.handleKeyDown(e);\n });\n\n _this.on(_this.menuButton_, 'mouseenter', function () {\n _this.addClass('vjs-hover');\n\n _this.menu.show();\n\n on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keyup', _this.handleMenuKeyUp_);\n });\n\n _this.on('mouseleave', function (e) {\n return _this.handleMouseLeave(e);\n });\n\n _this.on('keydown', function (e) {\n return _this.handleSubmenuKeyDown(e);\n });\n\n return _this;\n }\n /**\n * Update the menu based on the current state of its items.\n */\n\n\n var _proto = MenuButton.prototype;\n\n _proto.update = function update() {\n var menu = this.createMenu();\n\n if (this.menu) {\n this.menu.dispose();\n this.removeChild(this.menu);\n }\n\n this.menu = menu;\n this.addChild(menu);\n /**\n * Track the state of the menu button\n *\n * @type {Boolean}\n * @private\n */\n\n this.buttonPressed_ = false;\n this.menuButton_.el_.setAttribute('aria-expanded', 'false');\n\n if (this.items && this.items.length <= this.hideThreshold_) {\n this.hide();\n this.menu.contentEl_.removeAttribute('role');\n } else {\n this.show();\n this.menu.contentEl_.setAttribute('role', 'menu');\n }\n }\n /**\n * Create the menu and add all items to it.\n *\n * @return {Menu}\n * The constructed menu\n */\n ;\n\n _proto.createMenu = function createMenu() {\n var menu = new Menu(this.player_, {\n menuButton: this\n });\n /**\n * Hide the menu if the number of items is less than or equal to this threshold. This defaults\n * to 0 and whenever we add items which can be hidden to the menu we'll increment it. We list\n * it here because every time we run `createMenu` we need to reset the value.\n *\n * @protected\n * @type {Number}\n */\n\n this.hideThreshold_ = 0; // Add a title list item to the top\n\n if (this.options_.title) {\n var titleEl = createEl('li', {\n className: 'vjs-menu-title',\n textContent: toTitleCase$1(this.options_.title),\n tabIndex: -1\n });\n var titleComponent = new Component$1(this.player_, {\n el: titleEl\n });\n menu.addItem(titleComponent);\n }\n\n this.items = this.createItems();\n\n if (this.items) {\n // Add menu items to the menu\n for (var i = 0; i < this.items.length; i++) {\n menu.addItem(this.items[i]);\n }\n }\n\n return menu;\n }\n /**\n * Create the list of menu items. Specific to each subclass.\n *\n * @abstract\n */\n ;\n\n _proto.createItems = function createItems() {}\n /**\n * Create the `MenuButtons`s DOM element.\n *\n * @return {Element}\n * The element that gets created.\n */\n ;\n\n _proto.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: this.buildWrapperCSSClass()\n }, {});\n }\n /**\n * Allow sub components to stack CSS class names for the wrapper element\n *\n * @return {string}\n * The constructed wrapper DOM `className`\n */\n ;\n\n _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {\n var menuButtonClass = 'vjs-menu-button'; // If the inline option is passed, we want to use different styles altogether.\n\n if (this.options_.inline === true) {\n menuButtonClass += '-inline';\n } else {\n menuButtonClass += '-popup';\n } // TODO: Fix the CSS so that this isn't necessary\n\n\n var buttonClass = Button.prototype.buildCSSClass();\n return \"vjs-menu-button \" + menuButtonClass + \" \" + buttonClass + \" \" + _Component.prototype.buildCSSClass.call(this);\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n ;\n\n _proto.buildCSSClass = function buildCSSClass() {\n var menuButtonClass = 'vjs-menu-button'; // If the inline option is passed, we want to use different styles altogether.\n\n if (this.options_.inline === true) {\n menuButtonClass += '-inline';\n } else {\n menuButtonClass += '-popup';\n }\n\n return \"vjs-menu-button \" + menuButtonClass + \" \" + _Component.prototype.buildCSSClass.call(this);\n }\n /**\n * Get or set the localized control text that will be used for accessibility.\n *\n * > NOTE: This will come from the internal `menuButton_` element.\n *\n * @param {string} [text]\n * Control text for element.\n *\n * @param {Element} [el=this.menuButton_.el()]\n * Element to set the title on.\n *\n * @return {string}\n * - The control text when getting\n */\n ;\n\n _proto.controlText = function controlText(text, el) {\n if (el === void 0) {\n el = this.menuButton_.el();\n }\n\n return this.menuButton_.controlText(text, el);\n }\n /**\n * Dispose of the `menu-button` and all child components.\n */\n ;\n\n _proto.dispose = function dispose() {\n this.handleMouseLeave();\n\n _Component.prototype.dispose.call(this);\n }\n /**\n * Handle a click on a `MenuButton`.\n * See {@link ClickableComponent#handleClick} for instances where this is called.\n *\n * @param {EventTarget~Event} event\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n if (this.buttonPressed_) {\n this.unpressButton();\n } else {\n this.pressButton();\n }\n }\n /**\n * Handle `mouseleave` for `MenuButton`.\n *\n * @param {EventTarget~Event} event\n * The `mouseleave` event that caused this function to be called.\n *\n * @listens mouseleave\n */\n ;\n\n _proto.handleMouseLeave = function handleMouseLeave(event) {\n this.removeClass('vjs-hover');\n off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keyup', this.handleMenuKeyUp_);\n }\n /**\n * Set the focus to the actual button, not to this element\n */\n ;\n\n _proto.focus = function focus() {\n this.menuButton_.focus();\n }\n /**\n * Remove the focus from the actual button, not this element\n */\n ;\n\n _proto.blur = function blur() {\n this.menuButton_.blur();\n }\n /**\n * Handle tab, escape, down arrow, and up arrow keys for `MenuButton`. See\n * {@link ClickableComponent#handleKeyDown} for instances where this is called.\n *\n * @param {EventTarget~Event} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n // Escape or Tab unpress the 'button'\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Esc') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Tab')) {\n if (this.buttonPressed_) {\n this.unpressButton();\n } // Don't preventDefault for Tab key - we still want to lose focus\n\n\n if (!keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Tab')) {\n event.preventDefault(); // Set focus back to the menu button's button\n\n this.menuButton_.focus();\n } // Up Arrow or Down Arrow also 'press' the button to open the menu\n\n } else if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Up') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Down')) {\n if (!this.buttonPressed_) {\n event.preventDefault();\n this.pressButton();\n }\n }\n }\n /**\n * Handle a `keyup` event on a `MenuButton`. The listener for this is added in\n * the constructor.\n *\n * @param {EventTarget~Event} event\n * Key press event\n *\n * @listens keyup\n */\n ;\n\n _proto.handleMenuKeyUp = function handleMenuKeyUp(event) {\n // Escape hides popup menu\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Esc') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Tab')) {\n this.removeClass('vjs-hover');\n }\n }\n /**\n * This method name now delegates to `handleSubmenuKeyDown`. This means\n * anyone calling `handleSubmenuKeyPress` will not see their method calls\n * stop working.\n *\n * @param {EventTarget~Event} event\n * The event that caused this function to be called.\n */\n ;\n\n _proto.handleSubmenuKeyPress = function handleSubmenuKeyPress(event) {\n this.handleSubmenuKeyDown(event);\n }\n /**\n * Handle a `keydown` event on a sub-menu. The listener for this is added in\n * the constructor.\n *\n * @param {EventTarget~Event} event\n * Key press event\n *\n * @listens keydown\n */\n ;\n\n _proto.handleSubmenuKeyDown = function handleSubmenuKeyDown(event) {\n // Escape or Tab unpress the 'button'\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Esc') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Tab')) {\n if (this.buttonPressed_) {\n this.unpressButton();\n } // Don't preventDefault for Tab key - we still want to lose focus\n\n\n if (!keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Tab')) {\n event.preventDefault(); // Set focus back to the menu button's button\n\n this.menuButton_.focus();\n }\n }\n }\n /**\n * Put the current `MenuButton` into a pressed state.\n */\n ;\n\n _proto.pressButton = function pressButton() {\n if (this.enabled_) {\n this.buttonPressed_ = true;\n this.menu.show();\n this.menu.lockShowing();\n this.menuButton_.el_.setAttribute('aria-expanded', 'true'); // set the focus into the submenu, except on iOS where it is resulting in\n // undesired scrolling behavior when the player is in an iframe\n\n if (IS_IOS && isInFrame()) {\n // Return early so that the menu isn't focused\n return;\n }\n\n this.menu.focus();\n }\n }\n /**\n * Take the current `MenuButton` out of a pressed state.\n */\n ;\n\n _proto.unpressButton = function unpressButton() {\n if (this.enabled_) {\n this.buttonPressed_ = false;\n this.menu.unlockShowing();\n this.menu.hide();\n this.menuButton_.el_.setAttribute('aria-expanded', 'false');\n }\n }\n /**\n * Disable the `MenuButton`. Don't allow it to be clicked.\n */\n ;\n\n _proto.disable = function disable() {\n this.unpressButton();\n this.enabled_ = false;\n this.addClass('vjs-disabled');\n this.menuButton_.disable();\n }\n /**\n * Enable the `MenuButton`. Allow it to be clicked.\n */\n ;\n\n _proto.enable = function enable() {\n this.enabled_ = true;\n this.removeClass('vjs-disabled');\n this.menuButton_.enable();\n };\n\n return MenuButton;\n}(Component$1);\n\nComponent$1.registerComponent('MenuButton', MenuButton);\n\n/**\n * The base class for buttons that toggle specific track types (e.g. subtitles).\n *\n * @extends MenuButton\n */\n\nvar TrackButton = /*#__PURE__*/function (_MenuButton) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TrackButton, _MenuButton);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function TrackButton(player, options) {\n var _this;\n\n var tracks = options.tracks;\n _this = _MenuButton.call(this, player, options) || this;\n\n if (_this.items.length <= 1) {\n _this.hide();\n }\n\n if (!tracks) {\n return (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this);\n }\n\n var updateHandler = bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), _this.update);\n tracks.addEventListener('removetrack', updateHandler);\n tracks.addEventListener('addtrack', updateHandler);\n tracks.addEventListener('labelchange', updateHandler);\n\n _this.player_.on('ready', updateHandler);\n\n _this.player_.on('dispose', function () {\n tracks.removeEventListener('removetrack', updateHandler);\n tracks.removeEventListener('addtrack', updateHandler);\n tracks.removeEventListener('labelchange', updateHandler);\n });\n\n return _this;\n }\n\n return TrackButton;\n}(MenuButton);\n\nComponent$1.registerComponent('TrackButton', TrackButton);\n\n/**\n * @file menu-keys.js\n */\n\n/**\n * All keys used for operation of a menu (`MenuButton`, `Menu`, and `MenuItem`)\n * Note that 'Enter' and 'Space' are not included here (otherwise they would\n * prevent the `MenuButton` and `MenuItem` from being keyboard-clickable)\n * @typedef MenuKeys\n * @array\n */\nvar MenuKeys = ['Tab', 'Esc', 'Up', 'Down', 'Right', 'Left'];\n\n/**\n * The component for a menu item. `<li>`\n *\n * @extends ClickableComponent\n */\n\nvar MenuItem = /*#__PURE__*/function (_ClickableComponent) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(MenuItem, _ClickableComponent);\n\n /**\n * Creates an instance of the this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n *\n */\n function MenuItem(player, options) {\n var _this;\n\n _this = _ClickableComponent.call(this, player, options) || this;\n _this.selectable = options.selectable;\n _this.isSelected_ = options.selected || false;\n _this.multiSelectable = options.multiSelectable;\n\n _this.selected(_this.isSelected_);\n\n if (_this.selectable) {\n if (_this.multiSelectable) {\n _this.el_.setAttribute('role', 'menuitemcheckbox');\n } else {\n _this.el_.setAttribute('role', 'menuitemradio');\n }\n } else {\n _this.el_.setAttribute('role', 'menuitem');\n }\n\n return _this;\n }\n /**\n * Create the `MenuItem's DOM element\n *\n * @param {string} [type=li]\n * Element's node type, not actually used, always set to `li`.\n *\n * @param {Object} [props={}]\n * An object of properties that should be set on the element\n *\n * @param {Object} [attrs={}]\n * An object of attributes that should be set on the element\n *\n * @return {Element}\n * The element that gets created.\n */\n\n\n var _proto = MenuItem.prototype;\n\n _proto.createEl = function createEl$1(type, props, attrs) {\n // The control is textual, not just an icon\n this.nonIconControl = true;\n\n var el = _ClickableComponent.prototype.createEl.call(this, 'li', assign({\n className: 'vjs-menu-item',\n tabIndex: -1\n }, props), attrs); // swap icon with menu item text.\n\n\n el.replaceChild(createEl('span', {\n className: 'vjs-menu-item-text',\n textContent: this.localize(this.options_.label)\n }), el.querySelector('.vjs-icon-placeholder'));\n return el;\n }\n /**\n * Ignore keys which are used by the menu, but pass any other ones up. See\n * {@link ClickableComponent#handleKeyDown} for instances where this is called.\n *\n * @param {EventTarget~Event} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n if (!MenuKeys.some(function (key) {\n return keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, key);\n })) {\n // Pass keydown handling up for unused keys\n _ClickableComponent.prototype.handleKeyDown.call(this, event);\n }\n }\n /**\n * Any click on a `MenuItem` puts it into the selected state.\n * See {@link ClickableComponent#handleClick} for instances where this is called.\n *\n * @param {EventTarget~Event} event\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n this.selected(true);\n }\n /**\n * Set the state for this menu item as selected or not.\n *\n * @param {boolean} selected\n * if the menu item is selected or not\n */\n ;\n\n _proto.selected = function selected(_selected) {\n if (this.selectable) {\n if (_selected) {\n this.addClass('vjs-selected');\n this.el_.setAttribute('aria-checked', 'true'); // aria-checked isn't fully supported by browsers/screen readers,\n // so indicate selected state to screen reader in the control text.\n\n this.controlText(', selected');\n this.isSelected_ = true;\n } else {\n this.removeClass('vjs-selected');\n this.el_.setAttribute('aria-checked', 'false'); // Indicate un-selected state to screen reader\n\n this.controlText('');\n this.isSelected_ = false;\n }\n }\n };\n\n return MenuItem;\n}(ClickableComponent);\n\nComponent$1.registerComponent('MenuItem', MenuItem);\n\n/**\n * The specific menu item type for selecting a language within a text track kind\n *\n * @extends MenuItem\n */\n\nvar TextTrackMenuItem = /*#__PURE__*/function (_MenuItem) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TextTrackMenuItem, _MenuItem);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function TextTrackMenuItem(player, options) {\n var _this;\n\n var track = options.track;\n var tracks = player.textTracks(); // Modify options for parent MenuItem class's init.\n\n options.label = track.label || track.language || 'Unknown';\n options.selected = track.mode === 'showing';\n _this = _MenuItem.call(this, player, options) || this;\n _this.track = track; // Determine the relevant kind(s) of tracks for this component and filter\n // out empty kinds.\n\n _this.kinds = (options.kinds || [options.kind || _this.track.kind]).filter(Boolean);\n\n var changeHandler = function changeHandler() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this.handleTracksChange.apply((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), args);\n };\n\n var selectedLanguageChangeHandler = function selectedLanguageChangeHandler() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n _this.handleSelectedLanguageChange.apply((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), args);\n };\n\n player.on(['loadstart', 'texttrackchange'], changeHandler);\n tracks.addEventListener('change', changeHandler);\n tracks.addEventListener('selectedlanguagechange', selectedLanguageChangeHandler);\n\n _this.on('dispose', function () {\n player.off(['loadstart', 'texttrackchange'], changeHandler);\n tracks.removeEventListener('change', changeHandler);\n tracks.removeEventListener('selectedlanguagechange', selectedLanguageChangeHandler);\n }); // iOS7 doesn't dispatch change events to TextTrackLists when an\n // associated track's mode changes. Without something like\n // Object.observe() (also not present on iOS7), it's not\n // possible to detect changes to the mode attribute and polyfill\n // the change event. As a poor substitute, we manually dispatch\n // change events whenever the controls modify the mode.\n\n\n if (tracks.onchange === undefined) {\n var event;\n\n _this.on(['tap', 'click'], function () {\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().Event) !== 'object') {\n // Android 2.3 throws an Illegal Constructor error for window.Event\n try {\n event = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().Event)('change');\n } catch (err) {// continue regardless of error\n }\n }\n\n if (!event) {\n event = global_document__WEBPACK_IMPORTED_MODULE_1___default().createEvent('Event');\n event.initEvent('change', true, true);\n }\n\n tracks.dispatchEvent(event);\n });\n } // set the default state based on current tracks\n\n\n _this.handleTracksChange();\n\n return _this;\n }\n /**\n * This gets called when an `TextTrackMenuItem` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {EventTarget~Event} event\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n\n\n var _proto = TextTrackMenuItem.prototype;\n\n _proto.handleClick = function handleClick(event) {\n var referenceTrack = this.track;\n var tracks = this.player_.textTracks();\n\n _MenuItem.prototype.handleClick.call(this, event);\n\n if (!tracks) {\n return;\n }\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i]; // If the track from the text tracks list is not of the right kind,\n // skip it. We do not want to affect tracks of incompatible kind(s).\n\n if (this.kinds.indexOf(track.kind) === -1) {\n continue;\n } // If this text track is the component's track and it is not showing,\n // set it to showing.\n\n\n if (track === referenceTrack) {\n if (track.mode !== 'showing') {\n track.mode = 'showing';\n } // If this text track is not the component's track and it is not\n // disabled, set it to disabled.\n\n } else if (track.mode !== 'disabled') {\n track.mode = 'disabled';\n }\n }\n }\n /**\n * Handle text track list change\n *\n * @param {EventTarget~Event} event\n * The `change` event that caused this function to be called.\n *\n * @listens TextTrackList#change\n */\n ;\n\n _proto.handleTracksChange = function handleTracksChange(event) {\n var shouldBeSelected = this.track.mode === 'showing'; // Prevent redundant selected() calls because they may cause\n // screen readers to read the appended control text unnecessarily\n\n if (shouldBeSelected !== this.isSelected_) {\n this.selected(shouldBeSelected);\n }\n };\n\n _proto.handleSelectedLanguageChange = function handleSelectedLanguageChange(event) {\n if (this.track.mode === 'showing') {\n var selectedLanguage = this.player_.cache_.selectedLanguage; // Don't replace the kind of track across the same language\n\n if (selectedLanguage && selectedLanguage.enabled && selectedLanguage.language === this.track.language && selectedLanguage.kind !== this.track.kind) {\n return;\n }\n\n this.player_.cache_.selectedLanguage = {\n enabled: true,\n language: this.track.language,\n kind: this.track.kind\n };\n }\n };\n\n _proto.dispose = function dispose() {\n // remove reference to track object on dispose\n this.track = null;\n\n _MenuItem.prototype.dispose.call(this);\n };\n\n return TextTrackMenuItem;\n}(MenuItem);\n\nComponent$1.registerComponent('TextTrackMenuItem', TextTrackMenuItem);\n\n/**\n * A special menu item for turning of a specific type of text track\n *\n * @extends TextTrackMenuItem\n */\n\nvar OffTextTrackMenuItem = /*#__PURE__*/function (_TextTrackMenuItem) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(OffTextTrackMenuItem, _TextTrackMenuItem);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function OffTextTrackMenuItem(player, options) {\n // Create pseudo track info\n // Requires options['kind']\n options.track = {\n player: player,\n // it is no longer necessary to store `kind` or `kinds` on the track itself\n // since they are now stored in the `kinds` property of all instances of\n // TextTrackMenuItem, but this will remain for backwards compatibility\n kind: options.kind,\n kinds: options.kinds,\n \"default\": false,\n mode: 'disabled'\n };\n\n if (!options.kinds) {\n options.kinds = [options.kind];\n }\n\n if (options.label) {\n options.track.label = options.label;\n } else {\n options.track.label = options.kinds.join(' and ') + ' off';\n } // MenuItem is selectable\n\n\n options.selectable = true; // MenuItem is NOT multiSelectable (i.e. only one can be marked \"selected\" at a time)\n\n options.multiSelectable = false;\n return _TextTrackMenuItem.call(this, player, options) || this;\n }\n /**\n * Handle text track change\n *\n * @param {EventTarget~Event} event\n * The event that caused this function to run\n */\n\n\n var _proto = OffTextTrackMenuItem.prototype;\n\n _proto.handleTracksChange = function handleTracksChange(event) {\n var tracks = this.player().textTracks();\n var shouldBeSelected = true;\n\n for (var i = 0, l = tracks.length; i < l; i++) {\n var track = tracks[i];\n\n if (this.options_.kinds.indexOf(track.kind) > -1 && track.mode === 'showing') {\n shouldBeSelected = false;\n break;\n }\n } // Prevent redundant selected() calls because they may cause\n // screen readers to read the appended control text unnecessarily\n\n\n if (shouldBeSelected !== this.isSelected_) {\n this.selected(shouldBeSelected);\n }\n };\n\n _proto.handleSelectedLanguageChange = function handleSelectedLanguageChange(event) {\n var tracks = this.player().textTracks();\n var allHidden = true;\n\n for (var i = 0, l = tracks.length; i < l; i++) {\n var track = tracks[i];\n\n if (['captions', 'descriptions', 'subtitles'].indexOf(track.kind) > -1 && track.mode === 'showing') {\n allHidden = false;\n break;\n }\n }\n\n if (allHidden) {\n this.player_.cache_.selectedLanguage = {\n enabled: false\n };\n }\n };\n\n return OffTextTrackMenuItem;\n}(TextTrackMenuItem);\n\nComponent$1.registerComponent('OffTextTrackMenuItem', OffTextTrackMenuItem);\n\n/**\n * The base class for buttons that toggle specific text track types (e.g. subtitles)\n *\n * @extends MenuButton\n */\n\nvar TextTrackButton = /*#__PURE__*/function (_TrackButton) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TextTrackButton, _TrackButton);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n function TextTrackButton(player, options) {\n if (options === void 0) {\n options = {};\n }\n\n options.tracks = player.textTracks();\n return _TrackButton.call(this, player, options) || this;\n }\n /**\n * Create a menu item for each text track\n *\n * @param {TextTrackMenuItem[]} [items=[]]\n * Existing array of items to use during creation\n *\n * @return {TextTrackMenuItem[]}\n * Array of menu items that were created\n */\n\n\n var _proto = TextTrackButton.prototype;\n\n _proto.createItems = function createItems(items, TrackMenuItem) {\n if (items === void 0) {\n items = [];\n }\n\n if (TrackMenuItem === void 0) {\n TrackMenuItem = TextTrackMenuItem;\n }\n\n // Label is an override for the [track] off label\n // USed to localise captions/subtitles\n var label;\n\n if (this.label_) {\n label = this.label_ + \" off\";\n } // Add an OFF menu item to turn all tracks off\n\n\n items.push(new OffTextTrackMenuItem(this.player_, {\n kinds: this.kinds_,\n kind: this.kind_,\n label: label\n }));\n this.hideThreshold_ += 1;\n var tracks = this.player_.textTracks();\n\n if (!Array.isArray(this.kinds_)) {\n this.kinds_ = [this.kind_];\n }\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i]; // only add tracks that are of an appropriate kind and have a label\n\n if (this.kinds_.indexOf(track.kind) > -1) {\n var item = new TrackMenuItem(this.player_, {\n track: track,\n kinds: this.kinds_,\n kind: this.kind_,\n // MenuItem is selectable\n selectable: true,\n // MenuItem is NOT multiSelectable (i.e. only one can be marked \"selected\" at a time)\n multiSelectable: false\n });\n item.addClass(\"vjs-\" + track.kind + \"-menu-item\");\n items.push(item);\n }\n }\n\n return items;\n };\n\n return TextTrackButton;\n}(TrackButton);\n\nComponent$1.registerComponent('TextTrackButton', TextTrackButton);\n\n/**\n * The chapter track menu item\n *\n * @extends MenuItem\n */\n\nvar ChaptersTrackMenuItem = /*#__PURE__*/function (_MenuItem) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(ChaptersTrackMenuItem, _MenuItem);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function ChaptersTrackMenuItem(player, options) {\n var _this;\n\n var track = options.track;\n var cue = options.cue;\n var currentTime = player.currentTime(); // Modify options for parent MenuItem class's init.\n\n options.selectable = true;\n options.multiSelectable = false;\n options.label = cue.text;\n options.selected = cue.startTime <= currentTime && currentTime < cue.endTime;\n _this = _MenuItem.call(this, player, options) || this;\n _this.track = track;\n _this.cue = cue;\n return _this;\n }\n /**\n * This gets called when an `ChaptersTrackMenuItem` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {EventTarget~Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n\n\n var _proto = ChaptersTrackMenuItem.prototype;\n\n _proto.handleClick = function handleClick(event) {\n _MenuItem.prototype.handleClick.call(this);\n\n this.player_.currentTime(this.cue.startTime);\n };\n\n return ChaptersTrackMenuItem;\n}(MenuItem);\n\nComponent$1.registerComponent('ChaptersTrackMenuItem', ChaptersTrackMenuItem);\n\n/**\n * The button component for toggling and selecting chapters\n * Chapters act much differently than other text tracks\n * Cues are navigation vs. other tracks of alternative languages\n *\n * @extends TextTrackButton\n */\n\nvar ChaptersButton = /*#__PURE__*/function (_TextTrackButton) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(ChaptersButton, _TextTrackButton);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} [ready]\n * The function to call when this function is ready.\n */\n function ChaptersButton(player, options, ready) {\n var _this;\n\n _this = _TextTrackButton.call(this, player, options, ready) || this;\n\n _this.selectCurrentItem_ = function () {\n _this.items.forEach(function (item) {\n item.selected(_this.track_.activeCues[0] === item.cue);\n });\n };\n\n return _this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = ChaptersButton.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-chapters-button \" + _TextTrackButton.prototype.buildCSSClass.call(this);\n };\n\n _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {\n return \"vjs-chapters-button \" + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);\n }\n /**\n * Update the menu based on the current state of its items.\n *\n * @param {EventTarget~Event} [event]\n * An event that triggered this function to run.\n *\n * @listens TextTrackList#addtrack\n * @listens TextTrackList#removetrack\n * @listens TextTrackList#change\n */\n ;\n\n _proto.update = function update(event) {\n if (event && event.track && event.track.kind !== 'chapters') {\n return;\n }\n\n var track = this.findChaptersTrack();\n\n if (track !== this.track_) {\n this.setTrack(track);\n\n _TextTrackButton.prototype.update.call(this);\n } else if (!this.items || track && track.cues && track.cues.length !== this.items.length) {\n // Update the menu initially or if the number of cues has changed since set\n _TextTrackButton.prototype.update.call(this);\n }\n }\n /**\n * Set the currently selected track for the chapters button.\n *\n * @param {TextTrack} track\n * The new track to select. Nothing will change if this is the currently selected\n * track.\n */\n ;\n\n _proto.setTrack = function setTrack(track) {\n if (this.track_ === track) {\n return;\n }\n\n if (!this.updateHandler_) {\n this.updateHandler_ = this.update.bind(this);\n } // here this.track_ refers to the old track instance\n\n\n if (this.track_) {\n var remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);\n\n if (remoteTextTrackEl) {\n remoteTextTrackEl.removeEventListener('load', this.updateHandler_);\n }\n\n this.track_.removeEventListener('cuechange', this.selectCurrentItem_);\n this.track_ = null;\n }\n\n this.track_ = track; // here this.track_ refers to the new track instance\n\n if (this.track_) {\n this.track_.mode = 'hidden';\n\n var _remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);\n\n if (_remoteTextTrackEl) {\n _remoteTextTrackEl.addEventListener('load', this.updateHandler_);\n }\n\n this.track_.addEventListener('cuechange', this.selectCurrentItem_);\n }\n }\n /**\n * Find the track object that is currently in use by this ChaptersButton\n *\n * @return {TextTrack|undefined}\n * The current track or undefined if none was found.\n */\n ;\n\n _proto.findChaptersTrack = function findChaptersTrack() {\n var tracks = this.player_.textTracks() || [];\n\n for (var i = tracks.length - 1; i >= 0; i--) {\n // We will always choose the last track as our chaptersTrack\n var track = tracks[i];\n\n if (track.kind === this.kind_) {\n return track;\n }\n }\n }\n /**\n * Get the caption for the ChaptersButton based on the track label. This will also\n * use the current tracks localized kind as a fallback if a label does not exist.\n *\n * @return {string}\n * The tracks current label or the localized track kind.\n */\n ;\n\n _proto.getMenuCaption = function getMenuCaption() {\n if (this.track_ && this.track_.label) {\n return this.track_.label;\n }\n\n return this.localize(toTitleCase$1(this.kind_));\n }\n /**\n * Create menu from chapter track\n *\n * @return {Menu}\n * New menu for the chapter buttons\n */\n ;\n\n _proto.createMenu = function createMenu() {\n this.options_.title = this.getMenuCaption();\n return _TextTrackButton.prototype.createMenu.call(this);\n }\n /**\n * Create a menu item for each text track\n *\n * @return {TextTrackMenuItem[]}\n * Array of menu items\n */\n ;\n\n _proto.createItems = function createItems() {\n var items = [];\n\n if (!this.track_) {\n return items;\n }\n\n var cues = this.track_.cues;\n\n if (!cues) {\n return items;\n }\n\n for (var i = 0, l = cues.length; i < l; i++) {\n var cue = cues[i];\n var mi = new ChaptersTrackMenuItem(this.player_, {\n track: this.track_,\n cue: cue\n });\n items.push(mi);\n }\n\n return items;\n };\n\n return ChaptersButton;\n}(TextTrackButton);\n/**\n * `kind` of TextTrack to look for to associate it with this menu.\n *\n * @type {string}\n * @private\n */\n\n\nChaptersButton.prototype.kind_ = 'chapters';\n/**\n * The text that should display over the `ChaptersButton`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\n\nChaptersButton.prototype.controlText_ = 'Chapters';\nComponent$1.registerComponent('ChaptersButton', ChaptersButton);\n\n/**\n * The button component for toggling and selecting descriptions\n *\n * @extends TextTrackButton\n */\n\nvar DescriptionsButton = /*#__PURE__*/function (_TextTrackButton) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(DescriptionsButton, _TextTrackButton);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} [ready]\n * The function to call when this component is ready.\n */\n function DescriptionsButton(player, options, ready) {\n var _this;\n\n _this = _TextTrackButton.call(this, player, options, ready) || this;\n var tracks = player.textTracks();\n var changeHandler = bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), _this.handleTracksChange);\n tracks.addEventListener('change', changeHandler);\n\n _this.on('dispose', function () {\n tracks.removeEventListener('change', changeHandler);\n });\n\n return _this;\n }\n /**\n * Handle text track change\n *\n * @param {EventTarget~Event} event\n * The event that caused this function to run\n *\n * @listens TextTrackList#change\n */\n\n\n var _proto = DescriptionsButton.prototype;\n\n _proto.handleTracksChange = function handleTracksChange(event) {\n var tracks = this.player().textTracks();\n var disabled = false; // Check whether a track of a different kind is showing\n\n for (var i = 0, l = tracks.length; i < l; i++) {\n var track = tracks[i];\n\n if (track.kind !== this.kind_ && track.mode === 'showing') {\n disabled = true;\n break;\n }\n } // If another track is showing, disable this menu button\n\n\n if (disabled) {\n this.disable();\n } else {\n this.enable();\n }\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n ;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-descriptions-button \" + _TextTrackButton.prototype.buildCSSClass.call(this);\n };\n\n _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {\n return \"vjs-descriptions-button \" + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);\n };\n\n return DescriptionsButton;\n}(TextTrackButton);\n/**\n * `kind` of TextTrack to look for to associate it with this menu.\n *\n * @type {string}\n * @private\n */\n\n\nDescriptionsButton.prototype.kind_ = 'descriptions';\n/**\n * The text that should display over the `DescriptionsButton`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\n\nDescriptionsButton.prototype.controlText_ = 'Descriptions';\nComponent$1.registerComponent('DescriptionsButton', DescriptionsButton);\n\n/**\n * The button component for toggling and selecting subtitles\n *\n * @extends TextTrackButton\n */\n\nvar SubtitlesButton = /*#__PURE__*/function (_TextTrackButton) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(SubtitlesButton, _TextTrackButton);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} [ready]\n * The function to call when this component is ready.\n */\n function SubtitlesButton(player, options, ready) {\n return _TextTrackButton.call(this, player, options, ready) || this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = SubtitlesButton.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-subtitles-button \" + _TextTrackButton.prototype.buildCSSClass.call(this);\n };\n\n _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {\n return \"vjs-subtitles-button \" + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);\n };\n\n return SubtitlesButton;\n}(TextTrackButton);\n/**\n * `kind` of TextTrack to look for to associate it with this menu.\n *\n * @type {string}\n * @private\n */\n\n\nSubtitlesButton.prototype.kind_ = 'subtitles';\n/**\n * The text that should display over the `SubtitlesButton`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\n\nSubtitlesButton.prototype.controlText_ = 'Subtitles';\nComponent$1.registerComponent('SubtitlesButton', SubtitlesButton);\n\n/**\n * The menu item for caption track settings menu\n *\n * @extends TextTrackMenuItem\n */\n\nvar CaptionSettingsMenuItem = /*#__PURE__*/function (_TextTrackMenuItem) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(CaptionSettingsMenuItem, _TextTrackMenuItem);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function CaptionSettingsMenuItem(player, options) {\n var _this;\n\n options.track = {\n player: player,\n kind: options.kind,\n label: options.kind + ' settings',\n selectable: false,\n \"default\": false,\n mode: 'disabled'\n }; // CaptionSettingsMenuItem has no concept of 'selected'\n\n options.selectable = false;\n options.name = 'CaptionSettingsMenuItem';\n _this = _TextTrackMenuItem.call(this, player, options) || this;\n\n _this.addClass('vjs-texttrack-settings');\n\n _this.controlText(', opens ' + options.kind + ' settings dialog');\n\n return _this;\n }\n /**\n * This gets called when an `CaptionSettingsMenuItem` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {EventTarget~Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n\n\n var _proto = CaptionSettingsMenuItem.prototype;\n\n _proto.handleClick = function handleClick(event) {\n this.player().getChild('textTrackSettings').open();\n };\n\n return CaptionSettingsMenuItem;\n}(TextTrackMenuItem);\n\nComponent$1.registerComponent('CaptionSettingsMenuItem', CaptionSettingsMenuItem);\n\n/**\n * The button component for toggling and selecting captions\n *\n * @extends TextTrackButton\n */\n\nvar CaptionsButton = /*#__PURE__*/function (_TextTrackButton) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(CaptionsButton, _TextTrackButton);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} [ready]\n * The function to call when this component is ready.\n */\n function CaptionsButton(player, options, ready) {\n return _TextTrackButton.call(this, player, options, ready) || this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = CaptionsButton.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-captions-button \" + _TextTrackButton.prototype.buildCSSClass.call(this);\n };\n\n _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {\n return \"vjs-captions-button \" + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);\n }\n /**\n * Create caption menu items\n *\n * @return {CaptionSettingsMenuItem[]}\n * The array of current menu items.\n */\n ;\n\n _proto.createItems = function createItems() {\n var items = [];\n\n if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild('textTrackSettings')) {\n items.push(new CaptionSettingsMenuItem(this.player_, {\n kind: this.kind_\n }));\n this.hideThreshold_ += 1;\n }\n\n return _TextTrackButton.prototype.createItems.call(this, items);\n };\n\n return CaptionsButton;\n}(TextTrackButton);\n/**\n * `kind` of TextTrack to look for to associate it with this menu.\n *\n * @type {string}\n * @private\n */\n\n\nCaptionsButton.prototype.kind_ = 'captions';\n/**\n * The text that should display over the `CaptionsButton`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\n\nCaptionsButton.prototype.controlText_ = 'Captions';\nComponent$1.registerComponent('CaptionsButton', CaptionsButton);\n\n/**\n * SubsCapsMenuItem has an [cc] icon to distinguish captions from subtitles\n * in the SubsCapsMenu.\n *\n * @extends TextTrackMenuItem\n */\n\nvar SubsCapsMenuItem = /*#__PURE__*/function (_TextTrackMenuItem) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(SubsCapsMenuItem, _TextTrackMenuItem);\n\n function SubsCapsMenuItem() {\n return _TextTrackMenuItem.apply(this, arguments) || this;\n }\n\n var _proto = SubsCapsMenuItem.prototype;\n\n _proto.createEl = function createEl$1(type, props, attrs) {\n var el = _TextTrackMenuItem.prototype.createEl.call(this, type, props, attrs);\n\n var parentSpan = el.querySelector('.vjs-menu-item-text');\n\n if (this.options_.track.kind === 'captions') {\n parentSpan.appendChild(createEl('span', {\n className: 'vjs-icon-placeholder'\n }, {\n 'aria-hidden': true\n }));\n parentSpan.appendChild(createEl('span', {\n className: 'vjs-control-text',\n // space added as the text will visually flow with the\n // label\n textContent: \" \" + this.localize('Captions')\n }));\n }\n\n return el;\n };\n\n return SubsCapsMenuItem;\n}(TextTrackMenuItem);\n\nComponent$1.registerComponent('SubsCapsMenuItem', SubsCapsMenuItem);\n\n/**\n * The button component for toggling and selecting captions and/or subtitles\n *\n * @extends TextTrackButton\n */\n\nvar SubsCapsButton = /*#__PURE__*/function (_TextTrackButton) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(SubsCapsButton, _TextTrackButton);\n\n function SubsCapsButton(player, options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _TextTrackButton.call(this, player, options) || this; // Although North America uses \"captions\" in most cases for\n // \"captions and subtitles\" other locales use \"subtitles\"\n\n _this.label_ = 'subtitles';\n\n if (['en', 'en-us', 'en-ca', 'fr-ca'].indexOf(_this.player_.language_) > -1) {\n _this.label_ = 'captions';\n }\n\n _this.menuButton_.controlText(toTitleCase$1(_this.label_));\n\n return _this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = SubsCapsButton.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-subs-caps-button \" + _TextTrackButton.prototype.buildCSSClass.call(this);\n };\n\n _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {\n return \"vjs-subs-caps-button \" + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);\n }\n /**\n * Create caption/subtitles menu items\n *\n * @return {CaptionSettingsMenuItem[]}\n * The array of current menu items.\n */\n ;\n\n _proto.createItems = function createItems() {\n var items = [];\n\n if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild('textTrackSettings')) {\n items.push(new CaptionSettingsMenuItem(this.player_, {\n kind: this.label_\n }));\n this.hideThreshold_ += 1;\n }\n\n items = _TextTrackButton.prototype.createItems.call(this, items, SubsCapsMenuItem);\n return items;\n };\n\n return SubsCapsButton;\n}(TextTrackButton);\n/**\n * `kind`s of TextTrack to look for to associate it with this menu.\n *\n * @type {array}\n * @private\n */\n\n\nSubsCapsButton.prototype.kinds_ = ['captions', 'subtitles'];\n/**\n * The text that should display over the `SubsCapsButton`s controls.\n *\n *\n * @type {string}\n * @private\n */\n\nSubsCapsButton.prototype.controlText_ = 'Subtitles';\nComponent$1.registerComponent('SubsCapsButton', SubsCapsButton);\n\n/**\n * An {@link AudioTrack} {@link MenuItem}\n *\n * @extends MenuItem\n */\n\nvar AudioTrackMenuItem = /*#__PURE__*/function (_MenuItem) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(AudioTrackMenuItem, _MenuItem);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function AudioTrackMenuItem(player, options) {\n var _this;\n\n var track = options.track;\n var tracks = player.audioTracks(); // Modify options for parent MenuItem class's init.\n\n options.label = track.label || track.language || 'Unknown';\n options.selected = track.enabled;\n _this = _MenuItem.call(this, player, options) || this;\n _this.track = track;\n\n _this.addClass(\"vjs-\" + track.kind + \"-menu-item\");\n\n var changeHandler = function changeHandler() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n _this.handleTracksChange.apply((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), args);\n };\n\n tracks.addEventListener('change', changeHandler);\n\n _this.on('dispose', function () {\n tracks.removeEventListener('change', changeHandler);\n });\n\n return _this;\n }\n\n var _proto = AudioTrackMenuItem.prototype;\n\n _proto.createEl = function createEl$1(type, props, attrs) {\n var el = _MenuItem.prototype.createEl.call(this, type, props, attrs);\n\n var parentSpan = el.querySelector('.vjs-menu-item-text');\n\n if (this.options_.track.kind === 'main-desc') {\n parentSpan.appendChild(createEl('span', {\n className: 'vjs-icon-placeholder'\n }, {\n 'aria-hidden': true\n }));\n parentSpan.appendChild(createEl('span', {\n className: 'vjs-control-text',\n textContent: ' ' + this.localize('Descriptions')\n }));\n }\n\n return el;\n }\n /**\n * This gets called when an `AudioTrackMenuItem is \"clicked\". See {@link ClickableComponent}\n * for more detailed information on what a click can be.\n *\n * @param {EventTarget~Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n _MenuItem.prototype.handleClick.call(this, event); // the audio track list will automatically toggle other tracks\n // off for us.\n\n\n this.track.enabled = true; // when native audio tracks are used, we want to make sure that other tracks are turned off\n\n if (this.player_.tech_.featuresNativeAudioTracks) {\n var tracks = this.player_.audioTracks();\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i]; // skip the current track since we enabled it above\n\n if (track === this.track) {\n continue;\n }\n\n track.enabled = track === this.track;\n }\n }\n }\n /**\n * Handle any {@link AudioTrack} change.\n *\n * @param {EventTarget~Event} [event]\n * The {@link AudioTrackList#change} event that caused this to run.\n *\n * @listens AudioTrackList#change\n */\n ;\n\n _proto.handleTracksChange = function handleTracksChange(event) {\n this.selected(this.track.enabled);\n };\n\n return AudioTrackMenuItem;\n}(MenuItem);\n\nComponent$1.registerComponent('AudioTrackMenuItem', AudioTrackMenuItem);\n\n/**\n * The base class for buttons that toggle specific {@link AudioTrack} types.\n *\n * @extends TrackButton\n */\n\nvar AudioTrackButton = /*#__PURE__*/function (_TrackButton) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(AudioTrackButton, _TrackButton);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options={}]\n * The key/value store of player options.\n */\n function AudioTrackButton(player, options) {\n if (options === void 0) {\n options = {};\n }\n\n options.tracks = player.audioTracks();\n return _TrackButton.call(this, player, options) || this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n\n\n var _proto = AudioTrackButton.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-audio-button \" + _TrackButton.prototype.buildCSSClass.call(this);\n };\n\n _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {\n return \"vjs-audio-button \" + _TrackButton.prototype.buildWrapperCSSClass.call(this);\n }\n /**\n * Create a menu item for each audio track\n *\n * @param {AudioTrackMenuItem[]} [items=[]]\n * An array of existing menu items to use.\n *\n * @return {AudioTrackMenuItem[]}\n * An array of menu items\n */\n ;\n\n _proto.createItems = function createItems(items) {\n if (items === void 0) {\n items = [];\n }\n\n // if there's only one audio track, there no point in showing it\n this.hideThreshold_ = 1;\n var tracks = this.player_.audioTracks();\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i];\n items.push(new AudioTrackMenuItem(this.player_, {\n track: track,\n // MenuItem is selectable\n selectable: true,\n // MenuItem is NOT multiSelectable (i.e. only one can be marked \"selected\" at a time)\n multiSelectable: false\n }));\n }\n\n return items;\n };\n\n return AudioTrackButton;\n}(TrackButton);\n/**\n * The text that should display over the `AudioTrackButton`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\n\n\nAudioTrackButton.prototype.controlText_ = 'Audio Track';\nComponent$1.registerComponent('AudioTrackButton', AudioTrackButton);\n\n/**\n * The specific menu item type for selecting a playback rate.\n *\n * @extends MenuItem\n */\n\nvar PlaybackRateMenuItem = /*#__PURE__*/function (_MenuItem) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(PlaybackRateMenuItem, _MenuItem);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function PlaybackRateMenuItem(player, options) {\n var _this;\n\n var label = options.rate;\n var rate = parseFloat(label, 10); // Modify options for parent MenuItem class's init.\n\n options.label = label;\n options.selected = rate === player.playbackRate();\n options.selectable = true;\n options.multiSelectable = false;\n _this = _MenuItem.call(this, player, options) || this;\n _this.label = label;\n _this.rate = rate;\n\n _this.on(player, 'ratechange', function (e) {\n return _this.update(e);\n });\n\n return _this;\n }\n /**\n * This gets called when an `PlaybackRateMenuItem` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {EventTarget~Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n\n\n var _proto = PlaybackRateMenuItem.prototype;\n\n _proto.handleClick = function handleClick(event) {\n _MenuItem.prototype.handleClick.call(this);\n\n this.player().playbackRate(this.rate);\n }\n /**\n * Update the PlaybackRateMenuItem when the playbackrate changes.\n *\n * @param {EventTarget~Event} [event]\n * The `ratechange` event that caused this function to run.\n *\n * @listens Player#ratechange\n */\n ;\n\n _proto.update = function update(event) {\n this.selected(this.player().playbackRate() === this.rate);\n };\n\n return PlaybackRateMenuItem;\n}(MenuItem);\n/**\n * The text that should display over the `PlaybackRateMenuItem`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\n\n\nPlaybackRateMenuItem.prototype.contentElType = 'button';\nComponent$1.registerComponent('PlaybackRateMenuItem', PlaybackRateMenuItem);\n\n/**\n * The component for controlling the playback rate.\n *\n * @extends MenuButton\n */\n\nvar PlaybackRateMenuButton = /*#__PURE__*/function (_MenuButton) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(PlaybackRateMenuButton, _MenuButton);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function PlaybackRateMenuButton(player, options) {\n var _this;\n\n _this = _MenuButton.call(this, player, options) || this;\n\n _this.menuButton_.el_.setAttribute('aria-describedby', _this.labelElId_);\n\n _this.updateVisibility();\n\n _this.updateLabel();\n\n _this.on(player, 'loadstart', function (e) {\n return _this.updateVisibility(e);\n });\n\n _this.on(player, 'ratechange', function (e) {\n return _this.updateLabel(e);\n });\n\n _this.on(player, 'playbackrateschange', function (e) {\n return _this.handlePlaybackRateschange(e);\n });\n\n return _this;\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n\n\n var _proto = PlaybackRateMenuButton.prototype;\n\n _proto.createEl = function createEl$1() {\n var el = _MenuButton.prototype.createEl.call(this);\n\n this.labelElId_ = 'vjs-playback-rate-value-label-' + this.id_;\n this.labelEl_ = createEl('div', {\n className: 'vjs-playback-rate-value',\n id: this.labelElId_,\n textContent: '1x'\n });\n el.appendChild(this.labelEl_);\n return el;\n };\n\n _proto.dispose = function dispose() {\n this.labelEl_ = null;\n\n _MenuButton.prototype.dispose.call(this);\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n ;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-playback-rate \" + _MenuButton.prototype.buildCSSClass.call(this);\n };\n\n _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {\n return \"vjs-playback-rate \" + _MenuButton.prototype.buildWrapperCSSClass.call(this);\n }\n /**\n * Create the list of menu items. Specific to each subclass.\n *\n */\n ;\n\n _proto.createItems = function createItems() {\n var rates = this.playbackRates();\n var items = [];\n\n for (var i = rates.length - 1; i >= 0; i--) {\n items.push(new PlaybackRateMenuItem(this.player(), {\n rate: rates[i] + 'x'\n }));\n }\n\n return items;\n }\n /**\n * Updates ARIA accessibility attributes\n */\n ;\n\n _proto.updateARIAAttributes = function updateARIAAttributes() {\n // Current playback rate\n this.el().setAttribute('aria-valuenow', this.player().playbackRate());\n }\n /**\n * This gets called when an `PlaybackRateMenuButton` is \"clicked\". See\n * {@link ClickableComponent} for more detailed information on what a click can be.\n *\n * @param {EventTarget~Event} [event]\n * The `keydown`, `tap`, or `click` event that caused this function to be\n * called.\n *\n * @listens tap\n * @listens click\n */\n ;\n\n _proto.handleClick = function handleClick(event) {\n // select next rate option\n var currentRate = this.player().playbackRate();\n var rates = this.playbackRates();\n var currentIndex = rates.indexOf(currentRate); // this get the next rate and it will select first one if the last one currently selected\n\n var newIndex = (currentIndex + 1) % rates.length;\n this.player().playbackRate(rates[newIndex]);\n }\n /**\n * On playbackrateschange, update the menu to account for the new items.\n *\n * @listens Player#playbackrateschange\n */\n ;\n\n _proto.handlePlaybackRateschange = function handlePlaybackRateschange(event) {\n this.update();\n }\n /**\n * Get possible playback rates\n *\n * @return {Array}\n * All possible playback rates\n */\n ;\n\n _proto.playbackRates = function playbackRates() {\n var player = this.player();\n return player.playbackRates && player.playbackRates() || [];\n }\n /**\n * Get whether playback rates is supported by the tech\n * and an array of playback rates exists\n *\n * @return {boolean}\n * Whether changing playback rate is supported\n */\n ;\n\n _proto.playbackRateSupported = function playbackRateSupported() {\n return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0;\n }\n /**\n * Hide playback rate controls when they're no playback rate options to select\n *\n * @param {EventTarget~Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#loadstart\n */\n ;\n\n _proto.updateVisibility = function updateVisibility(event) {\n if (this.playbackRateSupported()) {\n this.removeClass('vjs-hidden');\n } else {\n this.addClass('vjs-hidden');\n }\n }\n /**\n * Update button label when rate changed\n *\n * @param {EventTarget~Event} [event]\n * The event that caused this function to run.\n *\n * @listens Player#ratechange\n */\n ;\n\n _proto.updateLabel = function updateLabel(event) {\n if (this.playbackRateSupported()) {\n this.labelEl_.textContent = this.player().playbackRate() + 'x';\n }\n };\n\n return PlaybackRateMenuButton;\n}(MenuButton);\n/**\n * The text that should display over the `FullscreenToggle`s controls. Added for localization.\n *\n * @type {string}\n * @private\n */\n\n\nPlaybackRateMenuButton.prototype.controlText_ = 'Playback Rate';\nComponent$1.registerComponent('PlaybackRateMenuButton', PlaybackRateMenuButton);\n\n/**\n * Just an empty spacer element that can be used as an append point for plugins, etc.\n * Also can be used to create space between elements when necessary.\n *\n * @extends Component\n */\n\nvar Spacer = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(Spacer, _Component);\n\n function Spacer() {\n return _Component.apply(this, arguments) || this;\n }\n\n var _proto = Spacer.prototype;\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-spacer \" + _Component.prototype.buildCSSClass.call(this);\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n ;\n\n _proto.createEl = function createEl(tag, props, attributes) {\n if (tag === void 0) {\n tag = 'div';\n }\n\n if (props === void 0) {\n props = {};\n }\n\n if (attributes === void 0) {\n attributes = {};\n }\n\n if (!props.className) {\n props.className = this.buildCSSClass();\n }\n\n return _Component.prototype.createEl.call(this, tag, props, attributes);\n };\n\n return Spacer;\n}(Component$1);\n\nComponent$1.registerComponent('Spacer', Spacer);\n\n/**\n * Spacer specifically meant to be used as an insertion point for new plugins, etc.\n *\n * @extends Spacer\n */\n\nvar CustomControlSpacer = /*#__PURE__*/function (_Spacer) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(CustomControlSpacer, _Spacer);\n\n function CustomControlSpacer() {\n return _Spacer.apply(this, arguments) || this;\n }\n\n var _proto = CustomControlSpacer.prototype;\n\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n */\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-custom-control-spacer \" + _Spacer.prototype.buildCSSClass.call(this);\n }\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n ;\n\n _proto.createEl = function createEl() {\n return _Spacer.prototype.createEl.call(this, 'div', {\n className: this.buildCSSClass(),\n // No-flex/table-cell mode requires there be some content\n // in the cell to fill the remaining space of the table.\n textContent: \"\\xA0\"\n });\n };\n\n return CustomControlSpacer;\n}(Spacer);\n\nComponent$1.registerComponent('CustomControlSpacer', CustomControlSpacer);\n\n/**\n * Container of main controls.\n *\n * @extends Component\n */\n\nvar ControlBar = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(ControlBar, _Component);\n\n function ControlBar() {\n return _Component.apply(this, arguments) || this;\n }\n\n var _proto = ControlBar.prototype;\n\n /**\n * Create the `Component`'s DOM element\n *\n * @return {Element}\n * The element that was created.\n */\n _proto.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'div', {\n className: 'vjs-control-bar',\n dir: 'ltr'\n });\n };\n\n return ControlBar;\n}(Component$1);\n/**\n * Default options for `ControlBar`\n *\n * @type {Object}\n * @private\n */\n\n\nControlBar.prototype.options_ = {\n children: ['playToggle', 'volumePanel', 'currentTimeDisplay', 'timeDivider', 'durationDisplay', 'progressControl', 'liveDisplay', 'seekToLive', 'remainingTimeDisplay', 'customControlSpacer', 'playbackRateMenuButton', 'chaptersButton', 'descriptionsButton', 'subsCapsButton', 'audioTrackButton', 'fullscreenToggle']\n};\n\nif (\"exitPictureInPicture\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default())) {\n ControlBar.prototype.options_.children.splice(ControlBar.prototype.options_.children.length - 1, 0, 'pictureInPictureToggle');\n}\n\nComponent$1.registerComponent('ControlBar', ControlBar);\n\n/**\n * A display that indicates an error has occurred. This means that the video\n * is unplayable.\n *\n * @extends ModalDialog\n */\n\nvar ErrorDisplay = /*#__PURE__*/function (_ModalDialog) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(ErrorDisplay, _ModalDialog);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function ErrorDisplay(player, options) {\n var _this;\n\n _this = _ModalDialog.call(this, player, options) || this;\n\n _this.on(player, 'error', function (e) {\n return _this.open(e);\n });\n\n return _this;\n }\n /**\n * Builds the default DOM `className`.\n *\n * @return {string}\n * The DOM `className` for this object.\n *\n * @deprecated Since version 5.\n */\n\n\n var _proto = ErrorDisplay.prototype;\n\n _proto.buildCSSClass = function buildCSSClass() {\n return \"vjs-error-display \" + _ModalDialog.prototype.buildCSSClass.call(this);\n }\n /**\n * Gets the localized error message based on the `Player`s error.\n *\n * @return {string}\n * The `Player`s error message localized or an empty string.\n */\n ;\n\n _proto.content = function content() {\n var error = this.player().error();\n return error ? this.localize(error.message) : '';\n };\n\n return ErrorDisplay;\n}(ModalDialog);\n/**\n * The default options for an `ErrorDisplay`.\n *\n * @private\n */\n\n\nErrorDisplay.prototype.options_ = (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_2__[\"default\"])({}, ModalDialog.prototype.options_, {\n pauseOnOpen: false,\n fillAlways: true,\n temporary: false,\n uncloseable: true\n});\nComponent$1.registerComponent('ErrorDisplay', ErrorDisplay);\n\nvar LOCAL_STORAGE_KEY$1 = 'vjs-text-track-settings';\nvar COLOR_BLACK = ['#000', 'Black'];\nvar COLOR_BLUE = ['#00F', 'Blue'];\nvar COLOR_CYAN = ['#0FF', 'Cyan'];\nvar COLOR_GREEN = ['#0F0', 'Green'];\nvar COLOR_MAGENTA = ['#F0F', 'Magenta'];\nvar COLOR_RED = ['#F00', 'Red'];\nvar COLOR_WHITE = ['#FFF', 'White'];\nvar COLOR_YELLOW = ['#FF0', 'Yellow'];\nvar OPACITY_OPAQUE = ['1', 'Opaque'];\nvar OPACITY_SEMI = ['0.5', 'Semi-Transparent'];\nvar OPACITY_TRANS = ['0', 'Transparent']; // Configuration for the various <select> elements in the DOM of this component.\n//\n// Possible keys include:\n//\n// `default`:\n// The default option index. Only needs to be provided if not zero.\n// `parser`:\n// A function which is used to parse the value from the selected option in\n// a customized way.\n// `selector`:\n// The selector used to find the associated <select> element.\n\nvar selectConfigs = {\n backgroundColor: {\n selector: '.vjs-bg-color > select',\n id: 'captions-background-color-%s',\n label: 'Color',\n options: [COLOR_BLACK, COLOR_WHITE, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN]\n },\n backgroundOpacity: {\n selector: '.vjs-bg-opacity > select',\n id: 'captions-background-opacity-%s',\n label: 'Transparency',\n options: [OPACITY_OPAQUE, OPACITY_SEMI, OPACITY_TRANS]\n },\n color: {\n selector: '.vjs-fg-color > select',\n id: 'captions-foreground-color-%s',\n label: 'Color',\n options: [COLOR_WHITE, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN]\n },\n edgeStyle: {\n selector: '.vjs-edge-style > select',\n id: '%s',\n label: 'Text Edge Style',\n options: [['none', 'None'], ['raised', 'Raised'], ['depressed', 'Depressed'], ['uniform', 'Uniform'], ['dropshadow', 'Dropshadow']]\n },\n fontFamily: {\n selector: '.vjs-font-family > select',\n id: 'captions-font-family-%s',\n label: 'Font Family',\n options: [['proportionalSansSerif', 'Proportional Sans-Serif'], ['monospaceSansSerif', 'Monospace Sans-Serif'], ['proportionalSerif', 'Proportional Serif'], ['monospaceSerif', 'Monospace Serif'], ['casual', 'Casual'], ['script', 'Script'], ['small-caps', 'Small Caps']]\n },\n fontPercent: {\n selector: '.vjs-font-percent > select',\n id: 'captions-font-size-%s',\n label: 'Font Size',\n 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%']],\n \"default\": 2,\n parser: function parser(v) {\n return v === '1.00' ? null : Number(v);\n }\n },\n textOpacity: {\n selector: '.vjs-text-opacity > select',\n id: 'captions-foreground-opacity-%s',\n label: 'Transparency',\n options: [OPACITY_OPAQUE, OPACITY_SEMI]\n },\n // Options for this object are defined below.\n windowColor: {\n selector: '.vjs-window-color > select',\n id: 'captions-window-color-%s',\n label: 'Color'\n },\n // Options for this object are defined below.\n windowOpacity: {\n selector: '.vjs-window-opacity > select',\n id: 'captions-window-opacity-%s',\n label: 'Transparency',\n options: [OPACITY_TRANS, OPACITY_SEMI, OPACITY_OPAQUE]\n }\n};\nselectConfigs.windowColor.options = selectConfigs.backgroundColor.options;\n/**\n * Get the actual value of an option.\n *\n * @param {string} value\n * The value to get\n *\n * @param {Function} [parser]\n * Optional function to adjust the value.\n *\n * @return {Mixed}\n * - Will be `undefined` if no value exists\n * - Will be `undefined` if the given value is \"none\".\n * - Will be the actual value otherwise.\n *\n * @private\n */\n\nfunction parseOptionValue(value, parser) {\n if (parser) {\n value = parser(value);\n }\n\n if (value && value !== 'none') {\n return value;\n }\n}\n/**\n * Gets the value of the selected <option> element within a <select> element.\n *\n * @param {Element} el\n * the element to look in\n *\n * @param {Function} [parser]\n * Optional function to adjust the value.\n *\n * @return {Mixed}\n * - Will be `undefined` if no value exists\n * - Will be `undefined` if the given value is \"none\".\n * - Will be the actual value otherwise.\n *\n * @private\n */\n\n\nfunction getSelectedOptionValue(el, parser) {\n var value = el.options[el.options.selectedIndex].value;\n return parseOptionValue(value, parser);\n}\n/**\n * Sets the selected <option> element within a <select> element based on a\n * given value.\n *\n * @param {Element} el\n * The element to look in.\n *\n * @param {string} value\n * the property to look on.\n *\n * @param {Function} [parser]\n * Optional function to adjust the value before comparing.\n *\n * @private\n */\n\n\nfunction setSelectedOption(el, value, parser) {\n if (!value) {\n return;\n }\n\n for (var i = 0; i < el.options.length; i++) {\n if (parseOptionValue(el.options[i].value, parser) === value) {\n el.selectedIndex = i;\n break;\n }\n }\n}\n/**\n * Manipulate Text Tracks settings.\n *\n * @extends ModalDialog\n */\n\n\nvar TextTrackSettings = /*#__PURE__*/function (_ModalDialog) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TextTrackSettings, _ModalDialog);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n */\n function TextTrackSettings(player, options) {\n var _this;\n\n options.temporary = false;\n _this = _ModalDialog.call(this, player, options) || this;\n _this.updateDisplay = _this.updateDisplay.bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this)); // fill the modal and pretend we have opened it\n\n _this.fill();\n\n _this.hasBeenOpened_ = _this.hasBeenFilled_ = true;\n _this.endDialog = createEl('p', {\n className: 'vjs-control-text',\n textContent: _this.localize('End of dialog window.')\n });\n\n _this.el().appendChild(_this.endDialog);\n\n _this.setDefaults(); // Grab `persistTextTrackSettings` from the player options if not passed in child options\n\n\n if (options.persistTextTrackSettings === undefined) {\n _this.options_.persistTextTrackSettings = _this.options_.playerOptions.persistTextTrackSettings;\n }\n\n _this.on(_this.$('.vjs-done-button'), 'click', function () {\n _this.saveSettings();\n\n _this.close();\n });\n\n _this.on(_this.$('.vjs-default-button'), 'click', function () {\n _this.setDefaults();\n\n _this.updateDisplay();\n });\n\n each(selectConfigs, function (config) {\n _this.on(_this.$(config.selector), 'change', _this.updateDisplay);\n });\n\n if (_this.options_.persistTextTrackSettings) {\n _this.restoreSettings();\n }\n\n return _this;\n }\n\n var _proto = TextTrackSettings.prototype;\n\n _proto.dispose = function dispose() {\n this.endDialog = null;\n\n _ModalDialog.prototype.dispose.call(this);\n }\n /**\n * Create a <select> element with configured options.\n *\n * @param {string} key\n * Configuration key to use during creation.\n *\n * @return {string}\n * An HTML string.\n *\n * @private\n */\n ;\n\n _proto.createElSelect_ = function createElSelect_(key, legendId, type) {\n var _this2 = this;\n\n if (legendId === void 0) {\n legendId = '';\n }\n\n if (type === void 0) {\n type = 'label';\n }\n\n var config = selectConfigs[key];\n var id = config.id.replace('%s', this.id_);\n var selectLabelledbyIds = [legendId, id].join(' ').trim();\n return [\"<\" + type + \" id=\\\"\" + id + \"\\\" class=\\\"\" + (type === 'label' ? 'vjs-label' : '') + \"\\\">\", this.localize(config.label), \"</\" + type + \">\", \"<select aria-labelledby=\\\"\" + selectLabelledbyIds + \"\\\">\"].concat(config.options.map(function (o) {\n var optionId = id + '-' + o[1].replace(/\\W+/g, '');\n return [\"<option id=\\\"\" + optionId + \"\\\" value=\\\"\" + o[0] + \"\\\" \", \"aria-labelledby=\\\"\" + selectLabelledbyIds + \" \" + optionId + \"\\\">\", _this2.localize(o[1]), '</option>'].join('');\n })).concat('</select>').join('');\n }\n /**\n * Create foreground color element for the component\n *\n * @return {string}\n * An HTML string.\n *\n * @private\n */\n ;\n\n _proto.createElFgColor_ = function createElFgColor_() {\n var legendId = \"captions-text-legend-\" + this.id_;\n return ['<fieldset class=\"vjs-fg-color vjs-track-setting\">', \"<legend id=\\\"\" + legendId + \"\\\">\", this.localize('Text'), '</legend>', this.createElSelect_('color', legendId), '<span class=\"vjs-text-opacity vjs-opacity\">', this.createElSelect_('textOpacity', legendId), '</span>', '</fieldset>'].join('');\n }\n /**\n * Create background color element for the component\n *\n * @return {string}\n * An HTML string.\n *\n * @private\n */\n ;\n\n _proto.createElBgColor_ = function createElBgColor_() {\n var legendId = \"captions-background-\" + this.id_;\n return ['<fieldset class=\"vjs-bg-color vjs-track-setting\">', \"<legend id=\\\"\" + legendId + \"\\\">\", this.localize('Background'), '</legend>', this.createElSelect_('backgroundColor', legendId), '<span class=\"vjs-bg-opacity vjs-opacity\">', this.createElSelect_('backgroundOpacity', legendId), '</span>', '</fieldset>'].join('');\n }\n /**\n * Create window color element for the component\n *\n * @return {string}\n * An HTML string.\n *\n * @private\n */\n ;\n\n _proto.createElWinColor_ = function createElWinColor_() {\n var legendId = \"captions-window-\" + this.id_;\n return ['<fieldset class=\"vjs-window-color vjs-track-setting\">', \"<legend id=\\\"\" + legendId + \"\\\">\", this.localize('Window'), '</legend>', this.createElSelect_('windowColor', legendId), '<span class=\"vjs-window-opacity vjs-opacity\">', this.createElSelect_('windowOpacity', legendId), '</span>', '</fieldset>'].join('');\n }\n /**\n * Create color elements for the component\n *\n * @return {Element}\n * The element that was created\n *\n * @private\n */\n ;\n\n _proto.createElColors_ = function createElColors_() {\n return createEl('div', {\n className: 'vjs-track-settings-colors',\n innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join('')\n });\n }\n /**\n * Create font elements for the component\n *\n * @return {Element}\n * The element that was created.\n *\n * @private\n */\n ;\n\n _proto.createElFont_ = function createElFont_() {\n return createEl('div', {\n className: 'vjs-track-settings-font',\n 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('')\n });\n }\n /**\n * Create controls for the component\n *\n * @return {Element}\n * The element that was created.\n *\n * @private\n */\n ;\n\n _proto.createElControls_ = function createElControls_() {\n var defaultsDescription = this.localize('restore all settings to the default values');\n return createEl('div', {\n className: 'vjs-track-settings-controls',\n innerHTML: [\"<button type=\\\"button\\\" class=\\\"vjs-default-button\\\" title=\\\"\" + defaultsDescription + \"\\\">\", this.localize('Reset'), \"<span class=\\\"vjs-control-text\\\"> \" + defaultsDescription + \"</span>\", '</button>', \"<button type=\\\"button\\\" class=\\\"vjs-done-button\\\">\" + this.localize('Done') + \"</button>\"].join('')\n });\n };\n\n _proto.content = function content() {\n return [this.createElColors_(), this.createElFont_(), this.createElControls_()];\n };\n\n _proto.label = function label() {\n return this.localize('Caption Settings Dialog');\n };\n\n _proto.description = function description() {\n return this.localize('Beginning of dialog window. Escape will cancel and close the window.');\n };\n\n _proto.buildCSSClass = function buildCSSClass() {\n return _ModalDialog.prototype.buildCSSClass.call(this) + ' vjs-text-track-settings';\n }\n /**\n * Gets an object of text track settings (or null).\n *\n * @return {Object}\n * An object with config values parsed from the DOM or localStorage.\n */\n ;\n\n _proto.getValues = function getValues() {\n var _this3 = this;\n\n return reduce(selectConfigs, function (accum, config, key) {\n var value = getSelectedOptionValue(_this3.$(config.selector), config.parser);\n\n if (value !== undefined) {\n accum[key] = value;\n }\n\n return accum;\n }, {});\n }\n /**\n * Sets text track settings from an object of values.\n *\n * @param {Object} values\n * An object with config values parsed from the DOM or localStorage.\n */\n ;\n\n _proto.setValues = function setValues(values) {\n var _this4 = this;\n\n each(selectConfigs, function (config, key) {\n setSelectedOption(_this4.$(config.selector), values[key], config.parser);\n });\n }\n /**\n * Sets all `<select>` elements to their default values.\n */\n ;\n\n _proto.setDefaults = function setDefaults() {\n var _this5 = this;\n\n each(selectConfigs, function (config) {\n var index = config.hasOwnProperty('default') ? config[\"default\"] : 0;\n _this5.$(config.selector).selectedIndex = index;\n });\n }\n /**\n * Restore texttrack settings from localStorage\n */\n ;\n\n _proto.restoreSettings = function restoreSettings() {\n var values;\n\n try {\n values = JSON.parse(global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage.getItem(LOCAL_STORAGE_KEY$1));\n } catch (err) {\n log$1.warn(err);\n }\n\n if (values) {\n this.setValues(values);\n }\n }\n /**\n * Save text track settings to localStorage\n */\n ;\n\n _proto.saveSettings = function saveSettings() {\n if (!this.options_.persistTextTrackSettings) {\n return;\n }\n\n var values = this.getValues();\n\n try {\n if (Object.keys(values).length) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage.setItem(LOCAL_STORAGE_KEY$1, JSON.stringify(values));\n } else {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage.removeItem(LOCAL_STORAGE_KEY$1);\n }\n } catch (err) {\n log$1.warn(err);\n }\n }\n /**\n * Update display of text track settings\n */\n ;\n\n _proto.updateDisplay = function updateDisplay() {\n var ttDisplay = this.player_.getChild('textTrackDisplay');\n\n if (ttDisplay) {\n ttDisplay.updateDisplay();\n }\n }\n /**\n * conditionally blur the element and refocus the captions button\n *\n * @private\n */\n ;\n\n _proto.conditionalBlur_ = function conditionalBlur_() {\n this.previouslyActiveEl_ = null;\n var cb = this.player_.controlBar;\n var subsCapsBtn = cb && cb.subsCapsButton;\n var ccBtn = cb && cb.captionsButton;\n\n if (subsCapsBtn) {\n subsCapsBtn.focus();\n } else if (ccBtn) {\n ccBtn.focus();\n }\n };\n\n return TextTrackSettings;\n}(ModalDialog);\n\nComponent$1.registerComponent('TextTrackSettings', TextTrackSettings);\n\n/**\n * A Resize Manager. It is in charge of triggering `playerresize` on the player in the right conditions.\n *\n * It'll either create an iframe and use a debounced resize handler on it or use the new {@link https://wicg.github.io/ResizeObserver/|ResizeObserver}.\n *\n * If the ResizeObserver is available natively, it will be used. A polyfill can be passed in as an option.\n * If a `playerresize` event is not needed, the ResizeManager component can be removed from the player, see the example below.\n * @example <caption>How to disable the resize manager</caption>\n * const player = videojs('#vid', {\n * resizeManager: false\n * });\n *\n * @see {@link https://wicg.github.io/ResizeObserver/|ResizeObserver specification}\n *\n * @extends Component\n */\n\nvar ResizeManager = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(ResizeManager, _Component);\n\n /**\n * Create the ResizeManager.\n *\n * @param {Object} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of ResizeManager options.\n *\n * @param {Object} [options.ResizeObserver]\n * A polyfill for ResizeObserver can be passed in here.\n * If this is set to null it will ignore the native ResizeObserver and fall back to the iframe fallback.\n */\n function ResizeManager(player, options) {\n var _this;\n\n var RESIZE_OBSERVER_AVAILABLE = options.ResizeObserver || (global_window__WEBPACK_IMPORTED_MODULE_0___default().ResizeObserver); // if `null` was passed, we want to disable the ResizeObserver\n\n if (options.ResizeObserver === null) {\n RESIZE_OBSERVER_AVAILABLE = false;\n } // Only create an element when ResizeObserver isn't available\n\n\n var options_ = mergeOptions$3({\n createEl: !RESIZE_OBSERVER_AVAILABLE,\n reportTouchActivity: false\n }, options);\n _this = _Component.call(this, player, options_) || this;\n _this.ResizeObserver = options.ResizeObserver || (global_window__WEBPACK_IMPORTED_MODULE_0___default().ResizeObserver);\n _this.loadListener_ = null;\n _this.resizeObserver_ = null;\n _this.debouncedHandler_ = debounce(function () {\n _this.resizeHandler();\n }, 100, false, (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this));\n\n if (RESIZE_OBSERVER_AVAILABLE) {\n _this.resizeObserver_ = new _this.ResizeObserver(_this.debouncedHandler_);\n\n _this.resizeObserver_.observe(player.el());\n } else {\n _this.loadListener_ = function () {\n if (!_this.el_ || !_this.el_.contentWindow) {\n return;\n }\n\n var debouncedHandler_ = _this.debouncedHandler_;\n\n var unloadListener_ = _this.unloadListener_ = function () {\n off(this, 'resize', debouncedHandler_);\n off(this, 'unload', unloadListener_);\n unloadListener_ = null;\n }; // safari and edge can unload the iframe before resizemanager dispose\n // we have to dispose of event handlers correctly before that happens\n\n\n on(_this.el_.contentWindow, 'unload', unloadListener_);\n on(_this.el_.contentWindow, 'resize', debouncedHandler_);\n };\n\n _this.one('load', _this.loadListener_);\n }\n\n return _this;\n }\n\n var _proto = ResizeManager.prototype;\n\n _proto.createEl = function createEl() {\n return _Component.prototype.createEl.call(this, 'iframe', {\n className: 'vjs-resize-manager',\n tabIndex: -1,\n title: this.localize('No content')\n }, {\n 'aria-hidden': 'true'\n });\n }\n /**\n * Called when a resize is triggered on the iframe or a resize is observed via the ResizeObserver\n *\n * @fires Player#playerresize\n */\n ;\n\n _proto.resizeHandler = function resizeHandler() {\n /**\n * Called when the player size has changed\n *\n * @event Player#playerresize\n * @type {EventTarget~Event}\n */\n // make sure player is still around to trigger\n // prevents this from causing an error after dispose\n if (!this.player_ || !this.player_.trigger) {\n return;\n }\n\n this.player_.trigger('playerresize');\n };\n\n _proto.dispose = function dispose() {\n if (this.debouncedHandler_) {\n this.debouncedHandler_.cancel();\n }\n\n if (this.resizeObserver_) {\n if (this.player_.el()) {\n this.resizeObserver_.unobserve(this.player_.el());\n }\n\n this.resizeObserver_.disconnect();\n }\n\n if (this.loadListener_) {\n this.off('load', this.loadListener_);\n }\n\n if (this.el_ && this.el_.contentWindow && this.unloadListener_) {\n this.unloadListener_.call(this.el_.contentWindow);\n }\n\n this.ResizeObserver = null;\n this.resizeObserver = null;\n this.debouncedHandler_ = null;\n this.loadListener_ = null;\n\n _Component.prototype.dispose.call(this);\n };\n\n return ResizeManager;\n}(Component$1);\n\nComponent$1.registerComponent('ResizeManager', ResizeManager);\n\nvar defaults = {\n trackingThreshold: 20,\n liveTolerance: 15\n};\n/*\n track when we are at the live edge, and other helpers for live playback */\n\n/**\n * A class for checking live current time and determining when the player\n * is at or behind the live edge.\n */\n\nvar LiveTracker = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(LiveTracker, _Component);\n\n /**\n * Creates an instance of this class.\n *\n * @param {Player} player\n * The `Player` that this class should be attached to.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {number} [options.trackingThreshold=20]\n * Number of seconds of live window (seekableEnd - seekableStart) that\n * media needs to have before the liveui will be shown.\n *\n * @param {number} [options.liveTolerance=15]\n * Number of seconds behind live that we have to be\n * before we will be considered non-live. Note that this will only\n * be used when playing at the live edge. This allows large seekable end\n * changes to not effect wether we are live or not.\n */\n function LiveTracker(player, options) {\n var _this;\n\n // LiveTracker does not need an element\n var options_ = mergeOptions$3(defaults, options, {\n createEl: false\n });\n _this = _Component.call(this, player, options_) || this;\n\n _this.handleVisibilityChange_ = function (e) {\n return _this.handleVisibilityChange(e);\n };\n\n _this.trackLiveHandler_ = function () {\n return _this.trackLive_();\n };\n\n _this.handlePlay_ = function (e) {\n return _this.handlePlay(e);\n };\n\n _this.handleFirstTimeupdate_ = function (e) {\n return _this.handleFirstTimeupdate(e);\n };\n\n _this.handleSeeked_ = function (e) {\n return _this.handleSeeked(e);\n };\n\n _this.seekToLiveEdge_ = function (e) {\n return _this.seekToLiveEdge(e);\n };\n\n _this.reset_();\n\n _this.on(_this.player_, 'durationchange', function (e) {\n return _this.handleDurationchange(e);\n }); // we should try to toggle tracking on canplay as native playback engines, like Safari\n // may not have the proper values for things like seekableEnd until then\n\n\n _this.on(_this.player_, 'canplay', function () {\n return _this.toggleTracking();\n }); // we don't need to track live playback if the document is hidden,\n // also, tracking when the document is hidden can\n // cause the CPU to spike and eventually crash the page on IE11.\n\n\n if (IE_VERSION && \"hidden\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default()) && \"visibilityState\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default())) {\n _this.on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'visibilitychange', _this.handleVisibilityChange_);\n }\n\n return _this;\n }\n /**\n * toggle tracking based on document visiblility\n */\n\n\n var _proto = LiveTracker.prototype;\n\n _proto.handleVisibilityChange = function handleVisibilityChange() {\n if (this.player_.duration() !== Infinity) {\n return;\n }\n\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default().hidden)) {\n this.stopTracking();\n } else {\n this.startTracking();\n }\n }\n /**\n * all the functionality for tracking when seek end changes\n * and for tracking how far past seek end we should be\n */\n ;\n\n _proto.trackLive_ = function trackLive_() {\n var seekable = this.player_.seekable(); // skip undefined seekable\n\n if (!seekable || !seekable.length) {\n return;\n }\n\n var newTime = Number(global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now().toFixed(4));\n var deltaTime = this.lastTime_ === -1 ? 0 : (newTime - this.lastTime_) / 1000;\n this.lastTime_ = newTime;\n this.pastSeekEnd_ = this.pastSeekEnd() + deltaTime;\n var liveCurrentTime = this.liveCurrentTime();\n var currentTime = this.player_.currentTime(); // we are behind live if any are true\n // 1. the player is paused\n // 2. the user seeked to a location 2 seconds away from live\n // 3. the difference between live and current time is greater\n // liveTolerance which defaults to 15s\n\n var isBehind = this.player_.paused() || this.seekedBehindLive_ || Math.abs(liveCurrentTime - currentTime) > this.options_.liveTolerance; // we cannot be behind if\n // 1. until we have not seen a timeupdate yet\n // 2. liveCurrentTime is Infinity, which happens on Android and Native Safari\n\n if (!this.timeupdateSeen_ || liveCurrentTime === Infinity) {\n isBehind = false;\n }\n\n if (isBehind !== this.behindLiveEdge_) {\n this.behindLiveEdge_ = isBehind;\n this.trigger('liveedgechange');\n }\n }\n /**\n * handle a durationchange event on the player\n * and start/stop tracking accordingly.\n */\n ;\n\n _proto.handleDurationchange = function handleDurationchange() {\n this.toggleTracking();\n }\n /**\n * start/stop tracking\n */\n ;\n\n _proto.toggleTracking = function toggleTracking() {\n if (this.player_.duration() === Infinity && this.liveWindow() >= this.options_.trackingThreshold) {\n if (this.player_.options_.liveui) {\n this.player_.addClass('vjs-liveui');\n }\n\n this.startTracking();\n } else {\n this.player_.removeClass('vjs-liveui');\n this.stopTracking();\n }\n }\n /**\n * start tracking live playback\n */\n ;\n\n _proto.startTracking = function startTracking() {\n if (this.isTracking()) {\n return;\n } // If we haven't seen a timeupdate, we need to check whether playback\n // began before this component started tracking. This can happen commonly\n // when using autoplay.\n\n\n if (!this.timeupdateSeen_) {\n this.timeupdateSeen_ = this.player_.hasStarted();\n }\n\n this.trackingInterval_ = this.setInterval(this.trackLiveHandler_, UPDATE_REFRESH_INTERVAL);\n this.trackLive_();\n this.on(this.player_, ['play', 'pause'], this.trackLiveHandler_);\n\n if (!this.timeupdateSeen_) {\n this.one(this.player_, 'play', this.handlePlay_);\n this.one(this.player_, 'timeupdate', this.handleFirstTimeupdate_);\n } else {\n this.on(this.player_, 'seeked', this.handleSeeked_);\n }\n }\n /**\n * handle the first timeupdate on the player if it wasn't already playing\n * when live tracker started tracking.\n */\n ;\n\n _proto.handleFirstTimeupdate = function handleFirstTimeupdate() {\n this.timeupdateSeen_ = true;\n this.on(this.player_, 'seeked', this.handleSeeked_);\n }\n /**\n * Keep track of what time a seek starts, and listen for seeked\n * to find where a seek ends.\n */\n ;\n\n _proto.handleSeeked = function handleSeeked() {\n var timeDiff = Math.abs(this.liveCurrentTime() - this.player_.currentTime());\n this.seekedBehindLive_ = this.nextSeekedFromUser_ && timeDiff > 2;\n this.nextSeekedFromUser_ = false;\n this.trackLive_();\n }\n /**\n * handle the first play on the player, and make sure that we seek\n * right to the live edge.\n */\n ;\n\n _proto.handlePlay = function handlePlay() {\n this.one(this.player_, 'timeupdate', this.seekToLiveEdge_);\n }\n /**\n * Stop tracking, and set all internal variables to\n * their initial value.\n */\n ;\n\n _proto.reset_ = function reset_() {\n this.lastTime_ = -1;\n this.pastSeekEnd_ = 0;\n this.lastSeekEnd_ = -1;\n this.behindLiveEdge_ = true;\n this.timeupdateSeen_ = false;\n this.seekedBehindLive_ = false;\n this.nextSeekedFromUser_ = false;\n this.clearInterval(this.trackingInterval_);\n this.trackingInterval_ = null;\n this.off(this.player_, ['play', 'pause'], this.trackLiveHandler_);\n this.off(this.player_, 'seeked', this.handleSeeked_);\n this.off(this.player_, 'play', this.handlePlay_);\n this.off(this.player_, 'timeupdate', this.handleFirstTimeupdate_);\n this.off(this.player_, 'timeupdate', this.seekToLiveEdge_);\n }\n /**\n * The next seeked event is from the user. Meaning that any seek\n * > 2s behind live will be considered behind live for real and\n * liveTolerance will be ignored.\n */\n ;\n\n _proto.nextSeekedFromUser = function nextSeekedFromUser() {\n this.nextSeekedFromUser_ = true;\n }\n /**\n * stop tracking live playback\n */\n ;\n\n _proto.stopTracking = function stopTracking() {\n if (!this.isTracking()) {\n return;\n }\n\n this.reset_();\n this.trigger('liveedgechange');\n }\n /**\n * A helper to get the player seekable end\n * so that we don't have to null check everywhere\n *\n * @return {number}\n * The furthest seekable end or Infinity.\n */\n ;\n\n _proto.seekableEnd = function seekableEnd() {\n var seekable = this.player_.seekable();\n var seekableEnds = [];\n var i = seekable ? seekable.length : 0;\n\n while (i--) {\n seekableEnds.push(seekable.end(i));\n } // grab the furthest seekable end after sorting, or if there are none\n // default to Infinity\n\n\n return seekableEnds.length ? seekableEnds.sort()[seekableEnds.length - 1] : Infinity;\n }\n /**\n * A helper to get the player seekable start\n * so that we don't have to null check everywhere\n *\n * @return {number}\n * The earliest seekable start or 0.\n */\n ;\n\n _proto.seekableStart = function seekableStart() {\n var seekable = this.player_.seekable();\n var seekableStarts = [];\n var i = seekable ? seekable.length : 0;\n\n while (i--) {\n seekableStarts.push(seekable.start(i));\n } // grab the first seekable start after sorting, or if there are none\n // default to 0\n\n\n return seekableStarts.length ? seekableStarts.sort()[0] : 0;\n }\n /**\n * Get the live time window aka\n * the amount of time between seekable start and\n * live current time.\n *\n * @return {number}\n * The amount of seconds that are seekable in\n * the live video.\n */\n ;\n\n _proto.liveWindow = function liveWindow() {\n var liveCurrentTime = this.liveCurrentTime(); // if liveCurrenTime is Infinity then we don't have a liveWindow at all\n\n if (liveCurrentTime === Infinity) {\n return 0;\n }\n\n return liveCurrentTime - this.seekableStart();\n }\n /**\n * Determines if the player is live, only checks if this component\n * is tracking live playback or not\n *\n * @return {boolean}\n * Wether liveTracker is tracking\n */\n ;\n\n _proto.isLive = function isLive() {\n return this.isTracking();\n }\n /**\n * Determines if currentTime is at the live edge and won't fall behind\n * on each seekableendchange\n *\n * @return {boolean}\n * Wether playback is at the live edge\n */\n ;\n\n _proto.atLiveEdge = function atLiveEdge() {\n return !this.behindLiveEdge();\n }\n /**\n * get what we expect the live current time to be\n *\n * @return {number}\n * The expected live current time\n */\n ;\n\n _proto.liveCurrentTime = function liveCurrentTime() {\n return this.pastSeekEnd() + this.seekableEnd();\n }\n /**\n * The number of seconds that have occured after seekable end\n * changed. This will be reset to 0 once seekable end changes.\n *\n * @return {number}\n * Seconds past the current seekable end\n */\n ;\n\n _proto.pastSeekEnd = function pastSeekEnd() {\n var seekableEnd = this.seekableEnd();\n\n if (this.lastSeekEnd_ !== -1 && seekableEnd !== this.lastSeekEnd_) {\n this.pastSeekEnd_ = 0;\n }\n\n this.lastSeekEnd_ = seekableEnd;\n return this.pastSeekEnd_;\n }\n /**\n * If we are currently behind the live edge, aka currentTime will be\n * behind on a seekableendchange\n *\n * @return {boolean}\n * If we are behind the live edge\n */\n ;\n\n _proto.behindLiveEdge = function behindLiveEdge() {\n return this.behindLiveEdge_;\n }\n /**\n * Wether live tracker is currently tracking or not.\n */\n ;\n\n _proto.isTracking = function isTracking() {\n return typeof this.trackingInterval_ === 'number';\n }\n /**\n * Seek to the live edge if we are behind the live edge\n */\n ;\n\n _proto.seekToLiveEdge = function seekToLiveEdge() {\n this.seekedBehindLive_ = false;\n\n if (this.atLiveEdge()) {\n return;\n }\n\n this.nextSeekedFromUser_ = false;\n this.player_.currentTime(this.liveCurrentTime());\n }\n /**\n * Dispose of liveTracker\n */\n ;\n\n _proto.dispose = function dispose() {\n this.off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'visibilitychange', this.handleVisibilityChange_);\n this.stopTracking();\n\n _Component.prototype.dispose.call(this);\n };\n\n return LiveTracker;\n}(Component$1);\n\nComponent$1.registerComponent('LiveTracker', LiveTracker);\n\n/**\n * This function is used to fire a sourceset when there is something\n * similar to `mediaEl.load()` being called. It will try to find the source via\n * the `src` attribute and then the `<source>` elements. It will then fire `sourceset`\n * with the source that was found or empty string if we cannot know. If it cannot\n * find a source then `sourceset` will not be fired.\n *\n * @param {Html5} tech\n * The tech object that sourceset was setup on\n *\n * @return {boolean}\n * returns false if the sourceset was not fired and true otherwise.\n */\n\nvar sourcesetLoad = function sourcesetLoad(tech) {\n var el = tech.el(); // if `el.src` is set, that source will be loaded.\n\n if (el.hasAttribute('src')) {\n tech.triggerSourceset(el.src);\n return true;\n }\n /**\n * Since there isn't a src property on the media element, source elements will be used for\n * implementing the source selection algorithm. This happens asynchronously and\n * for most cases were there is more than one source we cannot tell what source will\n * be loaded, without re-implementing the source selection algorithm. At this time we are not\n * going to do that. There are three special cases that we do handle here though:\n *\n * 1. If there are no sources, do not fire `sourceset`.\n * 2. If there is only one `<source>` with a `src` property/attribute that is our `src`\n * 3. If there is more than one `<source>` but all of them have the same `src` url.\n * That will be our src.\n */\n\n\n var sources = tech.$$('source');\n var srcUrls = [];\n var src = ''; // if there are no sources, do not fire sourceset\n\n if (!sources.length) {\n return false;\n } // only count valid/non-duplicate source elements\n\n\n for (var i = 0; i < sources.length; i++) {\n var url = sources[i].src;\n\n if (url && srcUrls.indexOf(url) === -1) {\n srcUrls.push(url);\n }\n } // there were no valid sources\n\n\n if (!srcUrls.length) {\n return false;\n } // there is only one valid source element url\n // use that\n\n\n if (srcUrls.length === 1) {\n src = srcUrls[0];\n }\n\n tech.triggerSourceset(src);\n return true;\n};\n/**\n * our implementation of an `innerHTML` descriptor for browsers\n * that do not have one.\n */\n\n\nvar innerHTMLDescriptorPolyfill = Object.defineProperty({}, 'innerHTML', {\n get: function get() {\n return this.cloneNode(true).innerHTML;\n },\n set: function set(v) {\n // make a dummy node to use innerHTML on\n var dummy = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement(this.nodeName.toLowerCase()); // set innerHTML to the value provided\n\n dummy.innerHTML = v; // make a document fragment to hold the nodes from dummy\n\n var docFrag = global_document__WEBPACK_IMPORTED_MODULE_1___default().createDocumentFragment(); // copy all of the nodes created by the innerHTML on dummy\n // to the document fragment\n\n while (dummy.childNodes.length) {\n docFrag.appendChild(dummy.childNodes[0]);\n } // remove content\n\n\n this.innerText = ''; // now we add all of that html in one by appending the\n // document fragment. This is how innerHTML does it.\n\n global_window__WEBPACK_IMPORTED_MODULE_0___default().Element.prototype.appendChild.call(this, docFrag); // then return the result that innerHTML's setter would\n\n return this.innerHTML;\n }\n});\n/**\n * Get a property descriptor given a list of priorities and the\n * property to get.\n */\n\nvar getDescriptor = function getDescriptor(priority, prop) {\n var descriptor = {};\n\n for (var i = 0; i < priority.length; i++) {\n descriptor = Object.getOwnPropertyDescriptor(priority[i], prop);\n\n if (descriptor && descriptor.set && descriptor.get) {\n break;\n }\n }\n\n descriptor.enumerable = true;\n descriptor.configurable = true;\n return descriptor;\n};\n\nvar getInnerHTMLDescriptor = function getInnerHTMLDescriptor(tech) {\n return getDescriptor([tech.el(), (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLMediaElement).prototype, (global_window__WEBPACK_IMPORTED_MODULE_0___default().Element).prototype, innerHTMLDescriptorPolyfill], 'innerHTML');\n};\n/**\n * Patches browser internal functions so that we can tell synchronously\n * if a `<source>` was appended to the media element. For some reason this\n * causes a `sourceset` if the the media element is ready and has no source.\n * This happens when:\n * - The page has just loaded and the media element does not have a source.\n * - The media element was emptied of all sources, then `load()` was called.\n *\n * It does this by patching the following functions/properties when they are supported:\n *\n * - `append()` - can be used to add a `<source>` element to the media element\n * - `appendChild()` - can be used to add a `<source>` element to the media element\n * - `insertAdjacentHTML()` - can be used to add a `<source>` element to the media element\n * - `innerHTML` - can be used to add a `<source>` element to the media element\n *\n * @param {Html5} tech\n * The tech object that sourceset is being setup on.\n */\n\n\nvar firstSourceWatch = function firstSourceWatch(tech) {\n var el = tech.el(); // make sure firstSourceWatch isn't setup twice.\n\n if (el.resetSourceWatch_) {\n return;\n }\n\n var old = {};\n var innerDescriptor = getInnerHTMLDescriptor(tech);\n\n var appendWrapper = function appendWrapper(appendFn) {\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var retval = appendFn.apply(el, args);\n sourcesetLoad(tech);\n return retval;\n };\n };\n\n ['append', 'appendChild', 'insertAdjacentHTML'].forEach(function (k) {\n if (!el[k]) {\n return;\n } // store the old function\n\n\n old[k] = el[k]; // call the old function with a sourceset if a source\n // was loaded\n\n el[k] = appendWrapper(old[k]);\n });\n Object.defineProperty(el, 'innerHTML', mergeOptions$3(innerDescriptor, {\n set: appendWrapper(innerDescriptor.set)\n }));\n\n el.resetSourceWatch_ = function () {\n el.resetSourceWatch_ = null;\n Object.keys(old).forEach(function (k) {\n el[k] = old[k];\n });\n Object.defineProperty(el, 'innerHTML', innerDescriptor);\n }; // on the first sourceset, we need to revert our changes\n\n\n tech.one('sourceset', el.resetSourceWatch_);\n};\n/**\n * our implementation of a `src` descriptor for browsers\n * that do not have one.\n */\n\n\nvar srcDescriptorPolyfill = Object.defineProperty({}, 'src', {\n get: function get() {\n if (this.hasAttribute('src')) {\n return getAbsoluteURL(global_window__WEBPACK_IMPORTED_MODULE_0___default().Element.prototype.getAttribute.call(this, 'src'));\n }\n\n return '';\n },\n set: function set(v) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().Element.prototype.setAttribute.call(this, 'src', v);\n return v;\n }\n});\n\nvar getSrcDescriptor = function getSrcDescriptor(tech) {\n return getDescriptor([tech.el(), (global_window__WEBPACK_IMPORTED_MODULE_0___default().HTMLMediaElement).prototype, srcDescriptorPolyfill], 'src');\n};\n/**\n * setup `sourceset` handling on the `Html5` tech. This function\n * patches the following element properties/functions:\n *\n * - `src` - to determine when `src` is set\n * - `setAttribute()` - to determine when `src` is set\n * - `load()` - this re-triggers the source selection algorithm, and can\n * cause a sourceset.\n *\n * If there is no source when we are adding `sourceset` support or during a `load()`\n * we also patch the functions listed in `firstSourceWatch`.\n *\n * @param {Html5} tech\n * The tech to patch\n */\n\n\nvar setupSourceset = function setupSourceset(tech) {\n if (!tech.featuresSourceset) {\n return;\n }\n\n var el = tech.el(); // make sure sourceset isn't setup twice.\n\n if (el.resetSourceset_) {\n return;\n }\n\n var srcDescriptor = getSrcDescriptor(tech);\n var oldSetAttribute = el.setAttribute;\n var oldLoad = el.load;\n Object.defineProperty(el, 'src', mergeOptions$3(srcDescriptor, {\n set: function set(v) {\n var retval = srcDescriptor.set.call(el, v); // we use the getter here to get the actual value set on src\n\n tech.triggerSourceset(el.src);\n return retval;\n }\n }));\n\n el.setAttribute = function (n, v) {\n var retval = oldSetAttribute.call(el, n, v);\n\n if (/src/i.test(n)) {\n tech.triggerSourceset(el.src);\n }\n\n return retval;\n };\n\n el.load = function () {\n var retval = oldLoad.call(el); // if load was called, but there was no source to fire\n // sourceset on. We have to watch for a source append\n // as that can trigger a `sourceset` when the media element\n // has no source\n\n if (!sourcesetLoad(tech)) {\n tech.triggerSourceset('');\n firstSourceWatch(tech);\n }\n\n return retval;\n };\n\n if (el.currentSrc) {\n tech.triggerSourceset(el.currentSrc);\n } else if (!sourcesetLoad(tech)) {\n firstSourceWatch(tech);\n }\n\n el.resetSourceset_ = function () {\n el.resetSourceset_ = null;\n el.load = oldLoad;\n el.setAttribute = oldSetAttribute;\n Object.defineProperty(el, 'src', srcDescriptor);\n\n if (el.resetSourceWatch_) {\n el.resetSourceWatch_();\n }\n };\n};\n\n/**\n * Object.defineProperty but \"lazy\", which means that the value is only set after\n * it retrieved the first time, rather than being set right away.\n *\n * @param {Object} obj the object to set the property on\n * @param {string} key the key for the property to set\n * @param {Function} getValue the function used to get the value when it is needed.\n * @param {boolean} setter wether a setter shoould be allowed or not\n */\nvar defineLazyProperty = function defineLazyProperty(obj, key, getValue, setter) {\n if (setter === void 0) {\n setter = true;\n }\n\n var set = function set(value) {\n return Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n writable: true\n });\n };\n\n var options = {\n configurable: true,\n enumerable: true,\n get: function get() {\n var value = getValue();\n set(value);\n return value;\n }\n };\n\n if (setter) {\n options.set = set;\n }\n\n return Object.defineProperty(obj, key, options);\n};\n\n/**\n * HTML5 Media Controller - Wrapper for HTML5 Media API\n *\n * @mixes Tech~SourceHandlerAdditions\n * @extends Tech\n */\n\nvar Html5 = /*#__PURE__*/function (_Tech) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(Html5, _Tech);\n\n /**\n * Create an instance of this Tech.\n *\n * @param {Object} [options]\n * The key/value store of player options.\n *\n * @param {Component~ReadyCallback} ready\n * Callback function to call when the `HTML5` Tech is ready.\n */\n function Html5(options, ready) {\n var _this;\n\n _this = _Tech.call(this, options, ready) || this;\n var source = options.source;\n var crossoriginTracks = false;\n _this.featuresVideoFrameCallback = _this.featuresVideoFrameCallback && _this.el_.tagName === 'VIDEO'; // Set the source if one is provided\n // 1) Check if the source is new (if not, we want to keep the original so playback isn't interrupted)\n // 2) Check to see if the network state of the tag was failed at init, and if so, reset the source\n // anyway so the error gets fired.\n\n if (source && (_this.el_.currentSrc !== source.src || options.tag && options.tag.initNetworkState_ === 3)) {\n _this.setSource(source);\n } else {\n _this.handleLateInit_(_this.el_);\n } // setup sourceset after late sourceset/init\n\n\n if (options.enableSourceset) {\n _this.setupSourcesetHandling_();\n }\n\n _this.isScrubbing_ = false;\n\n if (_this.el_.hasChildNodes()) {\n var nodes = _this.el_.childNodes;\n var nodesLength = nodes.length;\n var removeNodes = [];\n\n while (nodesLength--) {\n var node = nodes[nodesLength];\n var nodeName = node.nodeName.toLowerCase();\n\n if (nodeName === 'track') {\n if (!_this.featuresNativeTextTracks) {\n // Empty video tag tracks so the built-in player doesn't use them also.\n // This may not be fast enough to stop HTML5 browsers from reading the tags\n // so we'll need to turn off any default tracks if we're manually doing\n // captions and subtitles. videoElement.textTracks\n removeNodes.push(node);\n } else {\n // store HTMLTrackElement and TextTrack to remote list\n _this.remoteTextTrackEls().addTrackElement_(node);\n\n _this.remoteTextTracks().addTrack(node.track);\n\n _this.textTracks().addTrack(node.track);\n\n if (!crossoriginTracks && !_this.el_.hasAttribute('crossorigin') && isCrossOrigin(node.src)) {\n crossoriginTracks = true;\n }\n }\n }\n }\n\n for (var i = 0; i < removeNodes.length; i++) {\n _this.el_.removeChild(removeNodes[i]);\n }\n }\n\n _this.proxyNativeTracks_();\n\n if (_this.featuresNativeTextTracks && crossoriginTracks) {\n log$1.warn('Text Tracks are being loaded from another origin but the crossorigin attribute isn\\'t used.\\n' + 'This may prevent text tracks from loading.');\n } // prevent iOS Safari from disabling metadata text tracks during native playback\n\n\n _this.restoreMetadataTracksInIOSNativePlayer_(); // Determine if native controls should be used\n // Our goal should be to get the custom controls on mobile solid everywhere\n // so we can remove this all together. Right now this will block custom\n // controls on touch enabled laptops like the Chrome Pixel\n\n\n if ((TOUCH_ENABLED || IS_IPHONE || IS_NATIVE_ANDROID) && options.nativeControlsForTouch === true) {\n _this.setControls(true);\n } // on iOS, we want to proxy `webkitbeginfullscreen` and `webkitendfullscreen`\n // into a `fullscreenchange` event\n\n\n _this.proxyWebkitFullscreen_();\n\n _this.triggerReady();\n\n return _this;\n }\n /**\n * Dispose of `HTML5` media element and remove all tracks.\n */\n\n\n var _proto = Html5.prototype;\n\n _proto.dispose = function dispose() {\n if (this.el_ && this.el_.resetSourceset_) {\n this.el_.resetSourceset_();\n }\n\n Html5.disposeMediaElement(this.el_);\n this.options_ = null; // tech will handle clearing of the emulated track list\n\n _Tech.prototype.dispose.call(this);\n }\n /**\n * Modify the media element so that we can detect when\n * the source is changed. Fires `sourceset` just after the source has changed\n */\n ;\n\n _proto.setupSourcesetHandling_ = function setupSourcesetHandling_() {\n setupSourceset(this);\n }\n /**\n * When a captions track is enabled in the iOS Safari native player, all other\n * tracks are disabled (including metadata tracks), which nulls all of their\n * associated cue points. This will restore metadata tracks to their pre-fullscreen\n * state in those cases so that cue points are not needlessly lost.\n *\n * @private\n */\n ;\n\n _proto.restoreMetadataTracksInIOSNativePlayer_ = function restoreMetadataTracksInIOSNativePlayer_() {\n var textTracks = this.textTracks();\n var metadataTracksPreFullscreenState; // captures a snapshot of every metadata track's current state\n\n var takeMetadataTrackSnapshot = function takeMetadataTrackSnapshot() {\n metadataTracksPreFullscreenState = [];\n\n for (var i = 0; i < textTracks.length; i++) {\n var track = textTracks[i];\n\n if (track.kind === 'metadata') {\n metadataTracksPreFullscreenState.push({\n track: track,\n storedMode: track.mode\n });\n }\n }\n }; // snapshot each metadata track's initial state, and update the snapshot\n // each time there is a track 'change' event\n\n\n takeMetadataTrackSnapshot();\n textTracks.addEventListener('change', takeMetadataTrackSnapshot);\n this.on('dispose', function () {\n return textTracks.removeEventListener('change', takeMetadataTrackSnapshot);\n });\n\n var restoreTrackMode = function restoreTrackMode() {\n for (var i = 0; i < metadataTracksPreFullscreenState.length; i++) {\n var storedTrack = metadataTracksPreFullscreenState[i];\n\n if (storedTrack.track.mode === 'disabled' && storedTrack.track.mode !== storedTrack.storedMode) {\n storedTrack.track.mode = storedTrack.storedMode;\n }\n } // we only want this handler to be executed on the first 'change' event\n\n\n textTracks.removeEventListener('change', restoreTrackMode);\n }; // when we enter fullscreen playback, stop updating the snapshot and\n // restore all track modes to their pre-fullscreen state\n\n\n this.on('webkitbeginfullscreen', function () {\n textTracks.removeEventListener('change', takeMetadataTrackSnapshot); // remove the listener before adding it just in case it wasn't previously removed\n\n textTracks.removeEventListener('change', restoreTrackMode);\n textTracks.addEventListener('change', restoreTrackMode);\n }); // start updating the snapshot again after leaving fullscreen\n\n this.on('webkitendfullscreen', function () {\n // remove the listener before adding it just in case it wasn't previously removed\n textTracks.removeEventListener('change', takeMetadataTrackSnapshot);\n textTracks.addEventListener('change', takeMetadataTrackSnapshot); // remove the restoreTrackMode handler in case it wasn't triggered during fullscreen playback\n\n textTracks.removeEventListener('change', restoreTrackMode);\n });\n }\n /**\n * Attempt to force override of tracks for the given type\n *\n * @param {string} type - Track type to override, possible values include 'Audio',\n * 'Video', and 'Text'.\n * @param {boolean} override - If set to true native audio/video will be overridden,\n * otherwise native audio/video will potentially be used.\n * @private\n */\n ;\n\n _proto.overrideNative_ = function overrideNative_(type, override) {\n var _this2 = this;\n\n // If there is no behavioral change don't add/remove listeners\n if (override !== this[\"featuresNative\" + type + \"Tracks\"]) {\n return;\n }\n\n var lowerCaseType = type.toLowerCase();\n\n if (this[lowerCaseType + \"TracksListeners_\"]) {\n Object.keys(this[lowerCaseType + \"TracksListeners_\"]).forEach(function (eventName) {\n var elTracks = _this2.el()[lowerCaseType + \"Tracks\"];\n\n elTracks.removeEventListener(eventName, _this2[lowerCaseType + \"TracksListeners_\"][eventName]);\n });\n }\n\n this[\"featuresNative\" + type + \"Tracks\"] = !override;\n this[lowerCaseType + \"TracksListeners_\"] = null;\n this.proxyNativeTracksForType_(lowerCaseType);\n }\n /**\n * Attempt to force override of native audio tracks.\n *\n * @param {boolean} override - If set to true native audio will be overridden,\n * otherwise native audio will potentially be used.\n */\n ;\n\n _proto.overrideNativeAudioTracks = function overrideNativeAudioTracks(override) {\n this.overrideNative_('Audio', override);\n }\n /**\n * Attempt to force override of native video tracks.\n *\n * @param {boolean} override - If set to true native video will be overridden,\n * otherwise native video will potentially be used.\n */\n ;\n\n _proto.overrideNativeVideoTracks = function overrideNativeVideoTracks(override) {\n this.overrideNative_('Video', override);\n }\n /**\n * Proxy native track list events for the given type to our track\n * lists if the browser we are playing in supports that type of track list.\n *\n * @param {string} name - Track type; values include 'audio', 'video', and 'text'\n * @private\n */\n ;\n\n _proto.proxyNativeTracksForType_ = function proxyNativeTracksForType_(name) {\n var _this3 = this;\n\n var props = NORMAL[name];\n var elTracks = this.el()[props.getterName];\n var techTracks = this[props.getterName]();\n\n if (!this[\"featuresNative\" + props.capitalName + \"Tracks\"] || !elTracks || !elTracks.addEventListener) {\n return;\n }\n\n var listeners = {\n change: function change(e) {\n var event = {\n type: 'change',\n target: techTracks,\n currentTarget: techTracks,\n srcElement: techTracks\n };\n techTracks.trigger(event); // if we are a text track change event, we should also notify the\n // remote text track list. This can potentially cause a false positive\n // if we were to get a change event on a non-remote track and\n // we triggered the event on the remote text track list which doesn't\n // contain that track. However, best practices mean looping through the\n // list of tracks and searching for the appropriate mode value, so,\n // this shouldn't pose an issue\n\n if (name === 'text') {\n _this3[REMOTE.remoteText.getterName]().trigger(event);\n }\n },\n addtrack: function addtrack(e) {\n techTracks.addTrack(e.track);\n },\n removetrack: function removetrack(e) {\n techTracks.removeTrack(e.track);\n }\n };\n\n var removeOldTracks = function removeOldTracks() {\n var removeTracks = [];\n\n for (var i = 0; i < techTracks.length; i++) {\n var found = false;\n\n for (var j = 0; j < elTracks.length; j++) {\n if (elTracks[j] === techTracks[i]) {\n found = true;\n break;\n }\n }\n\n if (!found) {\n removeTracks.push(techTracks[i]);\n }\n }\n\n while (removeTracks.length) {\n techTracks.removeTrack(removeTracks.shift());\n }\n };\n\n this[props.getterName + 'Listeners_'] = listeners;\n Object.keys(listeners).forEach(function (eventName) {\n var listener = listeners[eventName];\n elTracks.addEventListener(eventName, listener);\n\n _this3.on('dispose', function (e) {\n return elTracks.removeEventListener(eventName, listener);\n });\n }); // Remove (native) tracks that are not used anymore\n\n this.on('loadstart', removeOldTracks);\n this.on('dispose', function (e) {\n return _this3.off('loadstart', removeOldTracks);\n });\n }\n /**\n * Proxy all native track list events to our track lists if the browser we are playing\n * in supports that type of track list.\n *\n * @private\n */\n ;\n\n _proto.proxyNativeTracks_ = function proxyNativeTracks_() {\n var _this4 = this;\n\n NORMAL.names.forEach(function (name) {\n _this4.proxyNativeTracksForType_(name);\n });\n }\n /**\n * Create the `Html5` Tech's DOM element.\n *\n * @return {Element}\n * The element that gets created.\n */\n ;\n\n _proto.createEl = function createEl() {\n var el = this.options_.tag; // Check if this browser supports moving the element into the box.\n // On the iPhone video will break if you move the element,\n // So we have to create a brand new element.\n // If we ingested the player div, we do not need to move the media element.\n\n if (!el || !(this.options_.playerElIngest || this.movingMediaElementInDOM)) {\n // If the original tag is still there, clone and remove it.\n if (el) {\n var clone = el.cloneNode(true);\n\n if (el.parentNode) {\n el.parentNode.insertBefore(clone, el);\n }\n\n Html5.disposeMediaElement(el);\n el = clone;\n } else {\n el = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video'); // determine if native controls should be used\n\n var tagAttributes = this.options_.tag && getAttributes(this.options_.tag);\n var attributes = mergeOptions$3({}, tagAttributes);\n\n if (!TOUCH_ENABLED || this.options_.nativeControlsForTouch !== true) {\n delete attributes.controls;\n }\n\n setAttributes(el, assign(attributes, {\n id: this.options_.techId,\n \"class\": 'vjs-tech'\n }));\n }\n\n el.playerId = this.options_.playerId;\n }\n\n if (typeof this.options_.preload !== 'undefined') {\n setAttribute(el, 'preload', this.options_.preload);\n }\n\n if (this.options_.disablePictureInPicture !== undefined) {\n el.disablePictureInPicture = this.options_.disablePictureInPicture;\n } // Update specific tag settings, in case they were overridden\n // `autoplay` has to be *last* so that `muted` and `playsinline` are present\n // when iOS/Safari or other browsers attempt to autoplay.\n\n\n var settingsAttrs = ['loop', 'muted', 'playsinline', 'autoplay'];\n\n for (var i = 0; i < settingsAttrs.length; i++) {\n var attr = settingsAttrs[i];\n var value = this.options_[attr];\n\n if (typeof value !== 'undefined') {\n if (value) {\n setAttribute(el, attr, attr);\n } else {\n removeAttribute(el, attr);\n }\n\n el[attr] = value;\n }\n }\n\n return el;\n }\n /**\n * This will be triggered if the loadstart event has already fired, before videojs was\n * ready. Two known examples of when this can happen are:\n * 1. If we're loading the playback object after it has started loading\n * 2. The media is already playing the (often with autoplay on) then\n *\n * This function will fire another loadstart so that videojs can catchup.\n *\n * @fires Tech#loadstart\n *\n * @return {undefined}\n * returns nothing.\n */\n ;\n\n _proto.handleLateInit_ = function handleLateInit_(el) {\n if (el.networkState === 0 || el.networkState === 3) {\n // The video element hasn't started loading the source yet\n // or didn't find a source\n return;\n }\n\n if (el.readyState === 0) {\n // NetworkState is set synchronously BUT loadstart is fired at the\n // end of the current stack, usually before setInterval(fn, 0).\n // So at this point we know loadstart may have already fired or is\n // about to fire, and either way the player hasn't seen it yet.\n // We don't want to fire loadstart prematurely here and cause a\n // double loadstart so we'll wait and see if it happens between now\n // and the next loop, and fire it if not.\n // HOWEVER, we also want to make sure it fires before loadedmetadata\n // which could also happen between now and the next loop, so we'll\n // watch for that also.\n var loadstartFired = false;\n\n var setLoadstartFired = function setLoadstartFired() {\n loadstartFired = true;\n };\n\n this.on('loadstart', setLoadstartFired);\n\n var triggerLoadstart = function triggerLoadstart() {\n // We did miss the original loadstart. Make sure the player\n // sees loadstart before loadedmetadata\n if (!loadstartFired) {\n this.trigger('loadstart');\n }\n };\n\n this.on('loadedmetadata', triggerLoadstart);\n this.ready(function () {\n this.off('loadstart', setLoadstartFired);\n this.off('loadedmetadata', triggerLoadstart);\n\n if (!loadstartFired) {\n // We did miss the original native loadstart. Fire it now.\n this.trigger('loadstart');\n }\n });\n return;\n } // From here on we know that loadstart already fired and we missed it.\n // The other readyState events aren't as much of a problem if we double\n // them, so not going to go to as much trouble as loadstart to prevent\n // that unless we find reason to.\n\n\n var eventsToTrigger = ['loadstart']; // loadedmetadata: newly equal to HAVE_METADATA (1) or greater\n\n eventsToTrigger.push('loadedmetadata'); // loadeddata: newly increased to HAVE_CURRENT_DATA (2) or greater\n\n if (el.readyState >= 2) {\n eventsToTrigger.push('loadeddata');\n } // canplay: newly increased to HAVE_FUTURE_DATA (3) or greater\n\n\n if (el.readyState >= 3) {\n eventsToTrigger.push('canplay');\n } // canplaythrough: newly equal to HAVE_ENOUGH_DATA (4)\n\n\n if (el.readyState >= 4) {\n eventsToTrigger.push('canplaythrough');\n } // We still need to give the player time to add event listeners\n\n\n this.ready(function () {\n eventsToTrigger.forEach(function (type) {\n this.trigger(type);\n }, this);\n });\n }\n /**\n * Set whether we are scrubbing or not.\n * This is used to decide whether we should use `fastSeek` or not.\n * `fastSeek` is used to provide trick play on Safari browsers.\n *\n * @param {boolean} isScrubbing\n * - true for we are currently scrubbing\n * - false for we are no longer scrubbing\n */\n ;\n\n _proto.setScrubbing = function setScrubbing(isScrubbing) {\n this.isScrubbing_ = isScrubbing;\n }\n /**\n * Get whether we are scrubbing or not.\n *\n * @return {boolean} isScrubbing\n * - true for we are currently scrubbing\n * - false for we are no longer scrubbing\n */\n ;\n\n _proto.scrubbing = function scrubbing() {\n return this.isScrubbing_;\n }\n /**\n * Set current time for the `HTML5` tech.\n *\n * @param {number} seconds\n * Set the current time of the media to this.\n */\n ;\n\n _proto.setCurrentTime = function setCurrentTime(seconds) {\n try {\n if (this.isScrubbing_ && this.el_.fastSeek && IS_ANY_SAFARI) {\n this.el_.fastSeek(seconds);\n } else {\n this.el_.currentTime = seconds;\n }\n } catch (e) {\n log$1(e, 'Video is not ready. (Video.js)'); // this.warning(VideoJS.warnings.videoNotReady);\n }\n }\n /**\n * Get the current duration of the HTML5 media element.\n *\n * @return {number}\n * The duration of the media or 0 if there is no duration.\n */\n ;\n\n _proto.duration = function duration() {\n var _this5 = this;\n\n // Android Chrome will report duration as Infinity for VOD HLS until after\n // playback has started, which triggers the live display erroneously.\n // Return NaN if playback has not started and trigger a durationupdate once\n // the duration can be reliably known.\n if (this.el_.duration === Infinity && IS_ANDROID && IS_CHROME && this.el_.currentTime === 0) {\n // Wait for the first `timeupdate` with currentTime > 0 - there may be\n // several with 0\n var checkProgress = function checkProgress() {\n if (_this5.el_.currentTime > 0) {\n // Trigger durationchange for genuinely live video\n if (_this5.el_.duration === Infinity) {\n _this5.trigger('durationchange');\n }\n\n _this5.off('timeupdate', checkProgress);\n }\n };\n\n this.on('timeupdate', checkProgress);\n return NaN;\n }\n\n return this.el_.duration || NaN;\n }\n /**\n * Get the current width of the HTML5 media element.\n *\n * @return {number}\n * The width of the HTML5 media element.\n */\n ;\n\n _proto.width = function width() {\n return this.el_.offsetWidth;\n }\n /**\n * Get the current height of the HTML5 media element.\n *\n * @return {number}\n * The height of the HTML5 media element.\n */\n ;\n\n _proto.height = function height() {\n return this.el_.offsetHeight;\n }\n /**\n * Proxy iOS `webkitbeginfullscreen` and `webkitendfullscreen` into\n * `fullscreenchange` event.\n *\n * @private\n * @fires fullscreenchange\n * @listens webkitendfullscreen\n * @listens webkitbeginfullscreen\n * @listens webkitbeginfullscreen\n */\n ;\n\n _proto.proxyWebkitFullscreen_ = function proxyWebkitFullscreen_() {\n var _this6 = this;\n\n if (!('webkitDisplayingFullscreen' in this.el_)) {\n return;\n }\n\n var endFn = function endFn() {\n this.trigger('fullscreenchange', {\n isFullscreen: false\n }); // Safari will sometimes set contols on the videoelement when existing fullscreen.\n\n if (this.el_.controls && !this.options_.nativeControlsForTouch && this.controls()) {\n this.el_.controls = false;\n }\n };\n\n var beginFn = function beginFn() {\n if ('webkitPresentationMode' in this.el_ && this.el_.webkitPresentationMode !== 'picture-in-picture') {\n this.one('webkitendfullscreen', endFn);\n this.trigger('fullscreenchange', {\n isFullscreen: true,\n // set a flag in case another tech triggers fullscreenchange\n nativeIOSFullscreen: true\n });\n }\n };\n\n this.on('webkitbeginfullscreen', beginFn);\n this.on('dispose', function () {\n _this6.off('webkitbeginfullscreen', beginFn);\n\n _this6.off('webkitendfullscreen', endFn);\n });\n }\n /**\n * Check if fullscreen is supported on the current playback device.\n *\n * @return {boolean}\n * - True if fullscreen is supported.\n * - False if fullscreen is not supported.\n */\n ;\n\n _proto.supportsFullScreen = function supportsFullScreen() {\n if (typeof this.el_.webkitEnterFullScreen === 'function') {\n var userAgent = (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).userAgent || ''; // Seems to be broken in Chromium/Chrome && Safari in Leopard\n\n if (/Android/.test(userAgent) || !/Chrome|Mac OS X 10.5/.test(userAgent)) {\n return true;\n }\n }\n\n return false;\n }\n /**\n * Request that the `HTML5` Tech enter fullscreen.\n */\n ;\n\n _proto.enterFullScreen = function enterFullScreen() {\n var video = this.el_;\n\n if (video.paused && video.networkState <= video.HAVE_METADATA) {\n // attempt to prime the video element for programmatic access\n // this isn't necessary on the desktop but shouldn't hurt\n silencePromise(this.el_.play()); // playing and pausing synchronously during the transition to fullscreen\n // can get iOS ~6.1 devices into a play/pause loop\n\n this.setTimeout(function () {\n video.pause();\n\n try {\n video.webkitEnterFullScreen();\n } catch (e) {\n this.trigger('fullscreenerror', e);\n }\n }, 0);\n } else {\n try {\n video.webkitEnterFullScreen();\n } catch (e) {\n this.trigger('fullscreenerror', e);\n }\n }\n }\n /**\n * Request that the `HTML5` Tech exit fullscreen.\n */\n ;\n\n _proto.exitFullScreen = function exitFullScreen() {\n if (!this.el_.webkitDisplayingFullscreen) {\n this.trigger('fullscreenerror', new Error('The video is not fullscreen'));\n return;\n }\n\n this.el_.webkitExitFullScreen();\n }\n /**\n * Create a floating video window always on top of other windows so that users may\n * continue consuming media while they interact with other content sites, or\n * applications on their device.\n *\n * @see [Spec]{@link https://wicg.github.io/picture-in-picture}\n *\n * @return {Promise}\n * A promise with a Picture-in-Picture window.\n */\n ;\n\n _proto.requestPictureInPicture = function requestPictureInPicture() {\n return this.el_.requestPictureInPicture();\n }\n /**\n * Native requestVideoFrameCallback if supported by browser/tech, or fallback\n * Don't use rVCF on Safari when DRM is playing, as it doesn't fire\n * Needs to be checked later than the constructor\n * This will be a false positive for clear sources loaded after a Fairplay source\n *\n * @param {function} cb function to call\n * @return {number} id of request\n */\n ;\n\n _proto.requestVideoFrameCallback = function requestVideoFrameCallback(cb) {\n if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {\n return this.el_.requestVideoFrameCallback(cb);\n }\n\n return _Tech.prototype.requestVideoFrameCallback.call(this, cb);\n }\n /**\n * Native or fallback requestVideoFrameCallback\n *\n * @param {number} id request id to cancel\n */\n ;\n\n _proto.cancelVideoFrameCallback = function cancelVideoFrameCallback(id) {\n if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {\n this.el_.cancelVideoFrameCallback(id);\n } else {\n _Tech.prototype.cancelVideoFrameCallback.call(this, id);\n }\n }\n /**\n * A getter/setter for the `Html5` Tech's source object.\n * > Note: Please use {@link Html5#setSource}\n *\n * @param {Tech~SourceObject} [src]\n * The source object you want to set on the `HTML5` techs element.\n *\n * @return {Tech~SourceObject|undefined}\n * - The current source object when a source is not passed in.\n * - undefined when setting\n *\n * @deprecated Since version 5.\n */\n ;\n\n _proto.src = function src(_src) {\n if (_src === undefined) {\n return this.el_.src;\n } // Setting src through `src` instead of `setSrc` will be deprecated\n\n\n this.setSrc(_src);\n }\n /**\n * Reset the tech by removing all sources and then calling\n * {@link Html5.resetMediaElement}.\n */\n ;\n\n _proto.reset = function reset() {\n Html5.resetMediaElement(this.el_);\n }\n /**\n * Get the current source on the `HTML5` Tech. Falls back to returning the source from\n * the HTML5 media element.\n *\n * @return {Tech~SourceObject}\n * The current source object from the HTML5 tech. With a fallback to the\n * elements source.\n */\n ;\n\n _proto.currentSrc = function currentSrc() {\n if (this.currentSource_) {\n return this.currentSource_.src;\n }\n\n return this.el_.currentSrc;\n }\n /**\n * Set controls attribute for the HTML5 media Element.\n *\n * @param {string} val\n * Value to set the controls attribute to\n */\n ;\n\n _proto.setControls = function setControls(val) {\n this.el_.controls = !!val;\n }\n /**\n * Create and returns a remote {@link TextTrack} object.\n *\n * @param {string} kind\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata)\n *\n * @param {string} [label]\n * Label to identify the text track\n *\n * @param {string} [language]\n * Two letter language abbreviation\n *\n * @return {TextTrack}\n * The TextTrack that gets created.\n */\n ;\n\n _proto.addTextTrack = function addTextTrack(kind, label, language) {\n if (!this.featuresNativeTextTracks) {\n return _Tech.prototype.addTextTrack.call(this, kind, label, language);\n }\n\n return this.el_.addTextTrack(kind, label, language);\n }\n /**\n * Creates either native TextTrack or an emulated TextTrack depending\n * on the value of `featuresNativeTextTracks`\n *\n * @param {Object} options\n * The object should contain the options to initialize the TextTrack with.\n *\n * @param {string} [options.kind]\n * `TextTrack` kind (subtitles, captions, descriptions, chapters, or metadata).\n *\n * @param {string} [options.label]\n * Label to identify the text track\n *\n * @param {string} [options.language]\n * Two letter language abbreviation.\n *\n * @param {boolean} [options.default]\n * Default this track to on.\n *\n * @param {string} [options.id]\n * The internal id to assign this track.\n *\n * @param {string} [options.src]\n * A source url for the track.\n *\n * @return {HTMLTrackElement}\n * The track element that gets created.\n */\n ;\n\n _proto.createRemoteTextTrack = function createRemoteTextTrack(options) {\n if (!this.featuresNativeTextTracks) {\n return _Tech.prototype.createRemoteTextTrack.call(this, options);\n }\n\n var htmlTrackElement = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('track');\n\n if (options.kind) {\n htmlTrackElement.kind = options.kind;\n }\n\n if (options.label) {\n htmlTrackElement.label = options.label;\n }\n\n if (options.language || options.srclang) {\n htmlTrackElement.srclang = options.language || options.srclang;\n }\n\n if (options[\"default\"]) {\n htmlTrackElement[\"default\"] = options[\"default\"];\n }\n\n if (options.id) {\n htmlTrackElement.id = options.id;\n }\n\n if (options.src) {\n htmlTrackElement.src = options.src;\n }\n\n return htmlTrackElement;\n }\n /**\n * Creates a remote text track object and returns an html track element.\n *\n * @param {Object} options The object should contain values for\n * kind, language, label, and src (location of the WebVTT file)\n * @param {boolean} [manualCleanup=true] if set to false, the TextTrack will be\n * automatically removed from the video element whenever the source changes\n * @return {HTMLTrackElement} An Html Track Element.\n * This can be an emulated {@link HTMLTrackElement} or a native one.\n * @deprecated The default value of the \"manualCleanup\" parameter will default\n * to \"false\" in upcoming versions of Video.js\n */\n ;\n\n _proto.addRemoteTextTrack = function addRemoteTextTrack(options, manualCleanup) {\n var htmlTrackElement = _Tech.prototype.addRemoteTextTrack.call(this, options, manualCleanup);\n\n if (this.featuresNativeTextTracks) {\n this.el().appendChild(htmlTrackElement);\n }\n\n return htmlTrackElement;\n }\n /**\n * Remove remote `TextTrack` from `TextTrackList` object\n *\n * @param {TextTrack} track\n * `TextTrack` object to remove\n */\n ;\n\n _proto.removeRemoteTextTrack = function removeRemoteTextTrack(track) {\n _Tech.prototype.removeRemoteTextTrack.call(this, track);\n\n if (this.featuresNativeTextTracks) {\n var tracks = this.$$('track');\n var i = tracks.length;\n\n while (i--) {\n if (track === tracks[i] || track === tracks[i].track) {\n this.el().removeChild(tracks[i]);\n }\n }\n }\n }\n /**\n * Gets available media playback quality metrics as specified by the W3C's Media\n * Playback Quality API.\n *\n * @see [Spec]{@link https://wicg.github.io/media-playback-quality}\n *\n * @return {Object}\n * An object with supported media playback quality metrics\n */\n ;\n\n _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {\n if (typeof this.el().getVideoPlaybackQuality === 'function') {\n return this.el().getVideoPlaybackQuality();\n }\n\n var videoPlaybackQuality = {};\n\n if (typeof this.el().webkitDroppedFrameCount !== 'undefined' && typeof this.el().webkitDecodedFrameCount !== 'undefined') {\n videoPlaybackQuality.droppedVideoFrames = this.el().webkitDroppedFrameCount;\n videoPlaybackQuality.totalVideoFrames = this.el().webkitDecodedFrameCount;\n }\n\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().performance) && typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().performance).now === 'function') {\n videoPlaybackQuality.creationTime = global_window__WEBPACK_IMPORTED_MODULE_0___default().performance.now();\n } else if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().performance) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().performance).timing && typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().performance).timing.navigationStart === 'number') {\n videoPlaybackQuality.creationTime = global_window__WEBPACK_IMPORTED_MODULE_0___default().Date.now() - (global_window__WEBPACK_IMPORTED_MODULE_0___default().performance).timing.navigationStart;\n }\n\n return videoPlaybackQuality;\n };\n\n return Html5;\n}(Tech);\n/* HTML5 Support Testing ---------------------------------------------------- */\n\n/**\n * Element for testing browser HTML5 media capabilities\n *\n * @type {Element}\n * @constant\n * @private\n */\n\n\ndefineLazyProperty(Html5, 'TEST_VID', function () {\n if (!isReal()) {\n return;\n }\n\n var video = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video');\n var track = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('track');\n track.kind = 'captions';\n track.srclang = 'en';\n track.label = 'English';\n video.appendChild(track);\n return video;\n});\n/**\n * Check if HTML5 media is supported by this browser/device.\n *\n * @return {boolean}\n * - True if HTML5 media is supported.\n * - False if HTML5 media is not supported.\n */\n\nHtml5.isSupported = function () {\n // IE with no Media Player is a LIAR! (#984)\n try {\n Html5.TEST_VID.volume = 0.5;\n } catch (e) {\n return false;\n }\n\n return !!(Html5.TEST_VID && Html5.TEST_VID.canPlayType);\n};\n/**\n * Check if the tech can support the given type\n *\n * @param {string} type\n * The mimetype to check\n * @return {string} 'probably', 'maybe', or '' (empty string)\n */\n\n\nHtml5.canPlayType = function (type) {\n return Html5.TEST_VID.canPlayType(type);\n};\n/**\n * Check if the tech can support the given source\n *\n * @param {Object} srcObj\n * The source object\n * @param {Object} options\n * The options passed to the tech\n * @return {string} 'probably', 'maybe', or '' (empty string)\n */\n\n\nHtml5.canPlaySource = function (srcObj, options) {\n return Html5.canPlayType(srcObj.type);\n};\n/**\n * Check if the volume can be changed in this browser/device.\n * Volume cannot be changed in a lot of mobile devices.\n * Specifically, it can't be changed from 1 on iOS.\n *\n * @return {boolean}\n * - True if volume can be controlled\n * - False otherwise\n */\n\n\nHtml5.canControlVolume = function () {\n // IE will error if Windows Media Player not installed #3315\n try {\n var volume = Html5.TEST_VID.volume;\n Html5.TEST_VID.volume = volume / 2 + 0.1;\n var canControl = volume !== Html5.TEST_VID.volume; // With the introduction of iOS 15, there are cases where the volume is read as\n // changed but reverts back to its original state at the start of the next tick.\n // To determine whether volume can be controlled on iOS,\n // a timeout is set and the volume is checked asynchronously.\n // Since `features` doesn't currently work asynchronously, the value is manually set.\n\n if (canControl && IS_IOS) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n if (Html5 && Html5.prototype) {\n Html5.prototype.featuresVolumeControl = volume !== Html5.TEST_VID.volume;\n }\n }); // default iOS to false, which will be updated in the timeout above.\n\n return false;\n }\n\n return canControl;\n } catch (e) {\n return false;\n }\n};\n/**\n * Check if the volume can be muted in this browser/device.\n * Some devices, e.g. iOS, don't allow changing volume\n * but permits muting/unmuting.\n *\n * @return {bolean}\n * - True if volume can be muted\n * - False otherwise\n */\n\n\nHtml5.canMuteVolume = function () {\n try {\n var muted = Html5.TEST_VID.muted; // in some versions of iOS muted property doesn't always\n // work, so we want to set both property and attribute\n\n Html5.TEST_VID.muted = !muted;\n\n if (Html5.TEST_VID.muted) {\n setAttribute(Html5.TEST_VID, 'muted', 'muted');\n } else {\n removeAttribute(Html5.TEST_VID, 'muted', 'muted');\n }\n\n return muted !== Html5.TEST_VID.muted;\n } catch (e) {\n return false;\n }\n};\n/**\n * Check if the playback rate can be changed in this browser/device.\n *\n * @return {boolean}\n * - True if playback rate can be controlled\n * - False otherwise\n */\n\n\nHtml5.canControlPlaybackRate = function () {\n // Playback rate API is implemented in Android Chrome, but doesn't do anything\n // https://github.com/videojs/video.js/issues/3180\n if (IS_ANDROID && IS_CHROME && CHROME_VERSION < 58) {\n return false;\n } // IE will error if Windows Media Player not installed #3315\n\n\n try {\n var playbackRate = Html5.TEST_VID.playbackRate;\n Html5.TEST_VID.playbackRate = playbackRate / 2 + 0.1;\n return playbackRate !== Html5.TEST_VID.playbackRate;\n } catch (e) {\n return false;\n }\n};\n/**\n * Check if we can override a video/audio elements attributes, with\n * Object.defineProperty.\n *\n * @return {boolean}\n * - True if builtin attributes can be overridden\n * - False otherwise\n */\n\n\nHtml5.canOverrideAttributes = function () {\n // if we cannot overwrite the src/innerHTML property, there is no support\n // iOS 7 safari for instance cannot do this.\n try {\n var noop = function noop() {};\n\n Object.defineProperty(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video'), 'src', {\n get: noop,\n set: noop\n });\n Object.defineProperty(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('audio'), 'src', {\n get: noop,\n set: noop\n });\n Object.defineProperty(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video'), 'innerHTML', {\n get: noop,\n set: noop\n });\n Object.defineProperty(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('audio'), 'innerHTML', {\n get: noop,\n set: noop\n });\n } catch (e) {\n return false;\n }\n\n return true;\n};\n/**\n * Check to see if native `TextTrack`s are supported by this browser/device.\n *\n * @return {boolean}\n * - True if native `TextTrack`s are supported.\n * - False otherwise\n */\n\n\nHtml5.supportsNativeTextTracks = function () {\n return IS_ANY_SAFARI || IS_IOS && IS_CHROME;\n};\n/**\n * Check to see if native `VideoTrack`s are supported by this browser/device\n *\n * @return {boolean}\n * - True if native `VideoTrack`s are supported.\n * - False otherwise\n */\n\n\nHtml5.supportsNativeVideoTracks = function () {\n return !!(Html5.TEST_VID && Html5.TEST_VID.videoTracks);\n};\n/**\n * Check to see if native `AudioTrack`s are supported by this browser/device\n *\n * @return {boolean}\n * - True if native `AudioTrack`s are supported.\n * - False otherwise\n */\n\n\nHtml5.supportsNativeAudioTracks = function () {\n return !!(Html5.TEST_VID && Html5.TEST_VID.audioTracks);\n};\n/**\n * An array of events available on the Html5 tech.\n *\n * @private\n * @type {Array}\n */\n\n\nHtml5.Events = ['loadstart', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'loadedmetadata', 'loadeddata', 'canplay', 'canplaythrough', 'playing', 'waiting', 'seeking', 'seeked', 'ended', 'durationchange', 'timeupdate', 'progress', 'play', 'pause', 'ratechange', 'resize', 'volumechange'];\n/**\n * Boolean indicating whether the `Tech` supports volume control.\n *\n * @type {boolean}\n * @default {@link Html5.canControlVolume}\n */\n\n/**\n * Boolean indicating whether the `Tech` supports muting volume.\n *\n * @type {bolean}\n * @default {@link Html5.canMuteVolume}\n */\n\n/**\n * Boolean indicating whether the `Tech` supports changing the speed at which the media\n * plays. Examples:\n * - Set player to play 2x (twice) as fast\n * - Set player to play 0.5x (half) as fast\n *\n * @type {boolean}\n * @default {@link Html5.canControlPlaybackRate}\n */\n\n/**\n * Boolean indicating whether the `Tech` supports the `sourceset` event.\n *\n * @type {boolean}\n * @default\n */\n\n/**\n * Boolean indicating whether the `HTML5` tech currently supports native `TextTrack`s.\n *\n * @type {boolean}\n * @default {@link Html5.supportsNativeTextTracks}\n */\n\n/**\n * Boolean indicating whether the `HTML5` tech currently supports native `VideoTrack`s.\n *\n * @type {boolean}\n * @default {@link Html5.supportsNativeVideoTracks}\n */\n\n/**\n * Boolean indicating whether the `HTML5` tech currently supports native `AudioTrack`s.\n *\n * @type {boolean}\n * @default {@link Html5.supportsNativeAudioTracks}\n */\n\n[['featuresMuteControl', 'canMuteVolume'], ['featuresPlaybackRate', 'canControlPlaybackRate'], ['featuresSourceset', 'canOverrideAttributes'], ['featuresNativeTextTracks', 'supportsNativeTextTracks'], ['featuresNativeVideoTracks', 'supportsNativeVideoTracks'], ['featuresNativeAudioTracks', 'supportsNativeAudioTracks']].forEach(function (_ref) {\n var key = _ref[0],\n fn = _ref[1];\n defineLazyProperty(Html5.prototype, key, function () {\n return Html5[fn]();\n }, true);\n});\nHtml5.prototype.featuresVolumeControl = Html5.canControlVolume();\n/**\n * Boolean indicating whether the `HTML5` tech currently supports the media element\n * moving in the DOM. iOS breaks if you move the media element, so this is set this to\n * false there. Everywhere else this should be true.\n *\n * @type {boolean}\n * @default\n */\n\nHtml5.prototype.movingMediaElementInDOM = !IS_IOS; // TODO: Previous comment: No longer appears to be used. Can probably be removed.\n// Is this true?\n\n/**\n * Boolean indicating whether the `HTML5` tech currently supports automatic media resize\n * when going into fullscreen.\n *\n * @type {boolean}\n * @default\n */\n\nHtml5.prototype.featuresFullscreenResize = true;\n/**\n * Boolean indicating whether the `HTML5` tech currently supports the progress event.\n * If this is false, manual `progress` events will be triggered instead.\n *\n * @type {boolean}\n * @default\n */\n\nHtml5.prototype.featuresProgressEvents = true;\n/**\n * Boolean indicating whether the `HTML5` tech currently supports the timeupdate event.\n * If this is false, manual `timeupdate` events will be triggered instead.\n *\n * @default\n */\n\nHtml5.prototype.featuresTimeupdateEvents = true;\n/**\n * Whether the HTML5 el supports `requestVideoFrameCallback`\n *\n * @type {boolean}\n */\n\nHtml5.prototype.featuresVideoFrameCallback = !!(Html5.TEST_VID && Html5.TEST_VID.requestVideoFrameCallback); // HTML5 Feature detection and Device Fixes --------------------------------- //\n\nvar canPlayType;\n\nHtml5.patchCanPlayType = function () {\n // Android 4.0 and above can play HLS to some extent but it reports being unable to do so\n // Firefox and Chrome report correctly\n if (ANDROID_VERSION >= 4.0 && !IS_FIREFOX && !IS_CHROME) {\n canPlayType = Html5.TEST_VID && Html5.TEST_VID.constructor.prototype.canPlayType;\n\n Html5.TEST_VID.constructor.prototype.canPlayType = function (type) {\n var mpegurlRE = /^application\\/(?:x-|vnd\\.apple\\.)mpegurl/i;\n\n if (type && mpegurlRE.test(type)) {\n return 'maybe';\n }\n\n return canPlayType.call(this, type);\n };\n }\n};\n\nHtml5.unpatchCanPlayType = function () {\n var r = Html5.TEST_VID.constructor.prototype.canPlayType;\n\n if (canPlayType) {\n Html5.TEST_VID.constructor.prototype.canPlayType = canPlayType;\n }\n\n return r;\n}; // by default, patch the media element\n\n\nHtml5.patchCanPlayType();\n\nHtml5.disposeMediaElement = function (el) {\n if (!el) {\n return;\n }\n\n if (el.parentNode) {\n el.parentNode.removeChild(el);\n } // remove any child track or source nodes to prevent their loading\n\n\n while (el.hasChildNodes()) {\n el.removeChild(el.firstChild);\n } // remove any src reference. not setting `src=''` because that causes a warning\n // in firefox\n\n\n el.removeAttribute('src'); // force the media element to update its loading state by calling load()\n // however IE on Windows 7N has a bug that throws an error so need a try/catch (#793)\n\n if (typeof el.load === 'function') {\n // wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473)\n (function () {\n try {\n el.load();\n } catch (e) {// not supported\n }\n })();\n }\n};\n\nHtml5.resetMediaElement = function (el) {\n if (!el) {\n return;\n }\n\n var sources = el.querySelectorAll('source');\n var i = sources.length;\n\n while (i--) {\n el.removeChild(sources[i]);\n } // remove any src reference.\n // not setting `src=''` because that throws an error\n\n\n el.removeAttribute('src');\n\n if (typeof el.load === 'function') {\n // wrapping in an iife so it's not deoptimized (#1060#discussion_r10324473)\n (function () {\n try {\n el.load();\n } catch (e) {// satisfy linter\n }\n })();\n }\n};\n/* Native HTML5 element property wrapping ----------------------------------- */\n// Wrap native boolean attributes with getters that check both property and attribute\n// The list is as followed:\n// muted, defaultMuted, autoplay, controls, loop, playsinline\n\n\n[\n/**\n * Get the value of `muted` from the media element. `muted` indicates\n * that the volume for the media should be set to silent. This does not actually change\n * the `volume` attribute.\n *\n * @method Html5#muted\n * @return {boolean}\n * - True if the value of `volume` should be ignored and the audio set to silent.\n * - False if the value of `volume` should be used.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-muted}\n */\n'muted',\n/**\n * Get the value of `defaultMuted` from the media element. `defaultMuted` indicates\n * whether the media should start muted or not. Only changes the default state of the\n * media. `muted` and `defaultMuted` can have different values. {@link Html5#muted} indicates the\n * current state.\n *\n * @method Html5#defaultMuted\n * @return {boolean}\n * - The value of `defaultMuted` from the media element.\n * - True indicates that the media should start muted.\n * - False indicates that the media should not start muted\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultmuted}\n */\n'defaultMuted',\n/**\n * Get the value of `autoplay` from the media element. `autoplay` indicates\n * that the media should start to play as soon as the page is ready.\n *\n * @method Html5#autoplay\n * @return {boolean}\n * - The value of `autoplay` from the media element.\n * - True indicates that the media should start as soon as the page loads.\n * - False indicates that the media should not start as soon as the page loads.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-autoplay}\n */\n'autoplay',\n/**\n * Get the value of `controls` from the media element. `controls` indicates\n * whether the native media controls should be shown or hidden.\n *\n * @method Html5#controls\n * @return {boolean}\n * - The value of `controls` from the media element.\n * - True indicates that native controls should be showing.\n * - False indicates that native controls should be hidden.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-controls}\n */\n'controls',\n/**\n * Get the value of `loop` from the media element. `loop` indicates\n * that the media should return to the start of the media and continue playing once\n * it reaches the end.\n *\n * @method Html5#loop\n * @return {boolean}\n * - The value of `loop` from the media element.\n * - True indicates that playback should seek back to start once\n * the end of a media is reached.\n * - False indicates that playback should not loop back to the start when the\n * end of the media is reached.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-loop}\n */\n'loop',\n/**\n * Get the value of `playsinline` from the media element. `playsinline` indicates\n * to the browser that non-fullscreen playback is preferred when fullscreen\n * playback is the native default, such as in iOS Safari.\n *\n * @method Html5#playsinline\n * @return {boolean}\n * - The value of `playsinline` from the media element.\n * - True indicates that the media should play inline.\n * - False indicates that the media should not play inline.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline}\n */\n'playsinline'].forEach(function (prop) {\n Html5.prototype[prop] = function () {\n return this.el_[prop] || this.el_.hasAttribute(prop);\n };\n}); // Wrap native boolean attributes with setters that set both property and attribute\n// The list is as followed:\n// setMuted, setDefaultMuted, setAutoplay, setLoop, setPlaysinline\n// setControls is special-cased above\n\n[\n/**\n * Set the value of `muted` on the media element. `muted` indicates that the current\n * audio level should be silent.\n *\n * @method Html5#setMuted\n * @param {boolean} muted\n * - True if the audio should be set to silent\n * - False otherwise\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-muted}\n */\n'muted',\n/**\n * Set the value of `defaultMuted` on the media element. `defaultMuted` indicates that the current\n * audio level should be silent, but will only effect the muted level on initial playback..\n *\n * @method Html5.prototype.setDefaultMuted\n * @param {boolean} defaultMuted\n * - True if the audio should be set to silent\n * - False otherwise\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultmuted}\n */\n'defaultMuted',\n/**\n * Set the value of `autoplay` on the media element. `autoplay` indicates\n * that the media should start to play as soon as the page is ready.\n *\n * @method Html5#setAutoplay\n * @param {boolean} autoplay\n * - True indicates that the media should start as soon as the page loads.\n * - False indicates that the media should not start as soon as the page loads.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-autoplay}\n */\n'autoplay',\n/**\n * Set the value of `loop` on the media element. `loop` indicates\n * that the media should return to the start of the media and continue playing once\n * it reaches the end.\n *\n * @method Html5#setLoop\n * @param {boolean} loop\n * - True indicates that playback should seek back to start once\n * the end of a media is reached.\n * - False indicates that playback should not loop back to the start when the\n * end of the media is reached.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-loop}\n */\n'loop',\n/**\n * Set the value of `playsinline` from the media element. `playsinline` indicates\n * to the browser that non-fullscreen playback is preferred when fullscreen\n * playback is the native default, such as in iOS Safari.\n *\n * @method Html5#setPlaysinline\n * @param {boolean} playsinline\n * - True indicates that the media should play inline.\n * - False indicates that the media should not play inline.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline}\n */\n'playsinline'].forEach(function (prop) {\n Html5.prototype['set' + toTitleCase$1(prop)] = function (v) {\n this.el_[prop] = v;\n\n if (v) {\n this.el_.setAttribute(prop, prop);\n } else {\n this.el_.removeAttribute(prop);\n }\n };\n}); // Wrap native properties with a getter\n// The list is as followed\n// paused, currentTime, buffered, volume, poster, preload, error, seeking\n// seekable, ended, playbackRate, defaultPlaybackRate, disablePictureInPicture\n// played, networkState, readyState, videoWidth, videoHeight, crossOrigin\n\n[\n/**\n * Get the value of `paused` from the media element. `paused` indicates whether the media element\n * is currently paused or not.\n *\n * @method Html5#paused\n * @return {boolean}\n * The value of `paused` from the media element.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-paused}\n */\n'paused',\n/**\n * Get the value of `currentTime` from the media element. `currentTime` indicates\n * the current second that the media is at in playback.\n *\n * @method Html5#currentTime\n * @return {number}\n * The value of `currentTime` from the media element.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-currenttime}\n */\n'currentTime',\n/**\n * Get the value of `buffered` from the media element. `buffered` is a `TimeRange`\n * object that represents the parts of the media that are already downloaded and\n * available for playback.\n *\n * @method Html5#buffered\n * @return {TimeRange}\n * The value of `buffered` from the media element.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-buffered}\n */\n'buffered',\n/**\n * Get the value of `volume` from the media element. `volume` indicates\n * the current playback volume of audio for a media. `volume` will be a value from 0\n * (silent) to 1 (loudest and default).\n *\n * @method Html5#volume\n * @return {number}\n * The value of `volume` from the media element. Value will be between 0-1.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-a-volume}\n */\n'volume',\n/**\n * Get the value of `poster` from the media element. `poster` indicates\n * that the url of an image file that can/will be shown when no media data is available.\n *\n * @method Html5#poster\n * @return {string}\n * The value of `poster` from the media element. Value will be a url to an\n * image.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-video-poster}\n */\n'poster',\n/**\n * Get the value of `preload` from the media element. `preload` indicates\n * what should download before the media is interacted with. It can have the following\n * values:\n * - none: nothing should be downloaded\n * - metadata: poster and the first few frames of the media may be downloaded to get\n * media dimensions and other metadata\n * - auto: allow the media and metadata for the media to be downloaded before\n * interaction\n *\n * @method Html5#preload\n * @return {string}\n * The value of `preload` from the media element. Will be 'none', 'metadata',\n * or 'auto'.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-preload}\n */\n'preload',\n/**\n * Get the value of the `error` from the media element. `error` indicates any\n * MediaError that may have occurred during playback. If error returns null there is no\n * current error.\n *\n * @method Html5#error\n * @return {MediaError|null}\n * The value of `error` from the media element. Will be `MediaError` if there\n * is a current error and null otherwise.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-error}\n */\n'error',\n/**\n * Get the value of `seeking` from the media element. `seeking` indicates whether the\n * media is currently seeking to a new position or not.\n *\n * @method Html5#seeking\n * @return {boolean}\n * - The value of `seeking` from the media element.\n * - True indicates that the media is currently seeking to a new position.\n * - False indicates that the media is not seeking to a new position at this time.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seeking}\n */\n'seeking',\n/**\n * Get the value of `seekable` from the media element. `seekable` returns a\n * `TimeRange` object indicating ranges of time that can currently be `seeked` to.\n *\n * @method Html5#seekable\n * @return {TimeRange}\n * The value of `seekable` from the media element. A `TimeRange` object\n * indicating the current ranges of time that can be seeked to.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-seekable}\n */\n'seekable',\n/**\n * Get the value of `ended` from the media element. `ended` indicates whether\n * the media has reached the end or not.\n *\n * @method Html5#ended\n * @return {boolean}\n * - The value of `ended` from the media element.\n * - True indicates that the media has ended.\n * - False indicates that the media has not ended.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-ended}\n */\n'ended',\n/**\n * Get the value of `playbackRate` from the media element. `playbackRate` indicates\n * the rate at which the media is currently playing back. Examples:\n * - if playbackRate is set to 2, media will play twice as fast.\n * - if playbackRate is set to 0.5, media will play half as fast.\n *\n * @method Html5#playbackRate\n * @return {number}\n * The value of `playbackRate` from the media element. A number indicating\n * the current playback speed of the media, where 1 is normal speed.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate}\n */\n'playbackRate',\n/**\n * Get the value of `defaultPlaybackRate` from the media element. `defaultPlaybackRate` indicates\n * the rate at which the media is currently playing back. This value will not indicate the current\n * `playbackRate` after playback has started, use {@link Html5#playbackRate} for that.\n *\n * Examples:\n * - if defaultPlaybackRate is set to 2, media will play twice as fast.\n * - if defaultPlaybackRate is set to 0.5, media will play half as fast.\n *\n * @method Html5.prototype.defaultPlaybackRate\n * @return {number}\n * The value of `defaultPlaybackRate` from the media element. A number indicating\n * the current playback speed of the media, where 1 is normal speed.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate}\n */\n'defaultPlaybackRate',\n/**\n * Get the value of 'disablePictureInPicture' from the video element.\n *\n * @method Html5#disablePictureInPicture\n * @return {boolean} value\n * - The value of `disablePictureInPicture` from the video element.\n * - True indicates that the video can't be played in Picture-In-Picture mode\n * - False indicates that the video can be played in Picture-In-Picture mode\n *\n * @see [Spec]{@link https://w3c.github.io/picture-in-picture/#disable-pip}\n */\n'disablePictureInPicture',\n/**\n * Get the value of `played` from the media element. `played` returns a `TimeRange`\n * object representing points in the media timeline that have been played.\n *\n * @method Html5#played\n * @return {TimeRange}\n * The value of `played` from the media element. A `TimeRange` object indicating\n * the ranges of time that have been played.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-played}\n */\n'played',\n/**\n * Get the value of `networkState` from the media element. `networkState` indicates\n * the current network state. It returns an enumeration from the following list:\n * - 0: NETWORK_EMPTY\n * - 1: NETWORK_IDLE\n * - 2: NETWORK_LOADING\n * - 3: NETWORK_NO_SOURCE\n *\n * @method Html5#networkState\n * @return {number}\n * The value of `networkState` from the media element. This will be a number\n * from the list in the description.\n *\n * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-networkstate}\n */\n'networkState',\n/**\n * Get the value of `readyState` from the media element. `readyState` indicates\n * the current state of the media element. It returns an enumeration from the\n * following list:\n * - 0: HAVE_NOTHING\n * - 1: HAVE_METADATA\n * - 2: HAVE_CURRENT_DATA\n * - 3: HAVE_FUTURE_DATA\n * - 4: HAVE_ENOUGH_DATA\n *\n * @method Html5#readyState\n * @return {number}\n * The value of `readyState` from the media element. This will be a number\n * from the list in the description.\n *\n * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#ready-states}\n */\n'readyState',\n/**\n * Get the value of `videoWidth` from the video element. `videoWidth` indicates\n * the current width of the video in css pixels.\n *\n * @method Html5#videoWidth\n * @return {number}\n * The value of `videoWidth` from the video element. This will be a number\n * in css pixels.\n *\n * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth}\n */\n'videoWidth',\n/**\n * Get the value of `videoHeight` from the video element. `videoHeight` indicates\n * the current height of the video in css pixels.\n *\n * @method Html5#videoHeight\n * @return {number}\n * The value of `videoHeight` from the video element. This will be a number\n * in css pixels.\n *\n * @see [Spec] {@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-video-videowidth}\n */\n'videoHeight',\n/**\n * Get the value of `crossOrigin` from the media element. `crossOrigin` indicates\n * to the browser that should sent the cookies along with the requests for the\n * different assets/playlists\n *\n * @method Html5#crossOrigin\n * @return {string}\n * - anonymous indicates that the media should not sent cookies.\n * - use-credentials indicates that the media should sent cookies along the requests.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/#attr-media-crossorigin}\n */\n'crossOrigin'].forEach(function (prop) {\n Html5.prototype[prop] = function () {\n return this.el_[prop];\n };\n}); // Wrap native properties with a setter in this format:\n// set + toTitleCase(name)\n// The list is as follows:\n// setVolume, setSrc, setPoster, setPreload, setPlaybackRate, setDefaultPlaybackRate,\n// setDisablePictureInPicture, setCrossOrigin\n\n[\n/**\n * Set the value of `volume` on the media element. `volume` indicates the current\n * audio level as a percentage in decimal form. This means that 1 is 100%, 0.5 is 50%, and\n * so on.\n *\n * @method Html5#setVolume\n * @param {number} percentAsDecimal\n * The volume percent as a decimal. Valid range is from 0-1.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-a-volume}\n */\n'volume',\n/**\n * Set the value of `src` on the media element. `src` indicates the current\n * {@link Tech~SourceObject} for the media.\n *\n * @method Html5#setSrc\n * @param {Tech~SourceObject} src\n * The source object to set as the current source.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-src}\n */\n'src',\n/**\n * Set the value of `poster` on the media element. `poster` is the url to\n * an image file that can/will be shown when no media data is available.\n *\n * @method Html5#setPoster\n * @param {string} poster\n * The url to an image that should be used as the `poster` for the media\n * element.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-poster}\n */\n'poster',\n/**\n * Set the value of `preload` on the media element. `preload` indicates\n * what should download before the media is interacted with. It can have the following\n * values:\n * - none: nothing should be downloaded\n * - metadata: poster and the first few frames of the media may be downloaded to get\n * media dimensions and other metadata\n * - auto: allow the media and metadata for the media to be downloaded before\n * interaction\n *\n * @method Html5#setPreload\n * @param {string} preload\n * The value of `preload` to set on the media element. Must be 'none', 'metadata',\n * or 'auto'.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#attr-media-preload}\n */\n'preload',\n/**\n * Set the value of `playbackRate` on the media element. `playbackRate` indicates\n * the rate at which the media should play back. Examples:\n * - if playbackRate is set to 2, media will play twice as fast.\n * - if playbackRate is set to 0.5, media will play half as fast.\n *\n * @method Html5#setPlaybackRate\n * @return {number}\n * The value of `playbackRate` from the media element. A number indicating\n * the current playback speed of the media, where 1 is normal speed.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-playbackrate}\n */\n'playbackRate',\n/**\n * Set the value of `defaultPlaybackRate` on the media element. `defaultPlaybackRate` indicates\n * the rate at which the media should play back upon initial startup. Changing this value\n * after a video has started will do nothing. Instead you should used {@link Html5#setPlaybackRate}.\n *\n * Example Values:\n * - if playbackRate is set to 2, media will play twice as fast.\n * - if playbackRate is set to 0.5, media will play half as fast.\n *\n * @method Html5.prototype.setDefaultPlaybackRate\n * @return {number}\n * The value of `defaultPlaybackRate` from the media element. A number indicating\n * the current playback speed of the media, where 1 is normal speed.\n *\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-defaultplaybackrate}\n */\n'defaultPlaybackRate',\n/**\n * Prevents the browser from suggesting a Picture-in-Picture context menu\n * or to request Picture-in-Picture automatically in some cases.\n *\n * @method Html5#setDisablePictureInPicture\n * @param {boolean} value\n * The true value will disable Picture-in-Picture mode.\n *\n * @see [Spec]{@link https://w3c.github.io/picture-in-picture/#disable-pip}\n */\n'disablePictureInPicture',\n/**\n * Set the value of `crossOrigin` from the media element. `crossOrigin` indicates\n * to the browser that should sent the cookies along with the requests for the\n * different assets/playlists\n *\n * @method Html5#setCrossOrigin\n * @param {string} crossOrigin\n * - anonymous indicates that the media should not sent cookies.\n * - use-credentials indicates that the media should sent cookies along the requests.\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/#attr-media-crossorigin}\n */\n'crossOrigin'].forEach(function (prop) {\n Html5.prototype['set' + toTitleCase$1(prop)] = function (v) {\n this.el_[prop] = v;\n };\n}); // wrap native functions with a function\n// The list is as follows:\n// pause, load, play\n\n[\n/**\n * A wrapper around the media elements `pause` function. This will call the `HTML5`\n * media elements `pause` function.\n *\n * @method Html5#pause\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-pause}\n */\n'pause',\n/**\n * A wrapper around the media elements `load` function. This will call the `HTML5`s\n * media element `load` function.\n *\n * @method Html5#load\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-load}\n */\n'load',\n/**\n * A wrapper around the media elements `play` function. This will call the `HTML5`s\n * media element `play` function.\n *\n * @method Html5#play\n * @see [Spec]{@link https://www.w3.org/TR/html5/embedded-content-0.html#dom-media-play}\n */\n'play'].forEach(function (prop) {\n Html5.prototype[prop] = function () {\n return this.el_[prop]();\n };\n});\nTech.withSourceHandlers(Html5);\n/**\n * Native source handler for Html5, simply passes the source to the media element.\n *\n * @property {Tech~SourceObject} source\n * The source object\n *\n * @property {Html5} tech\n * The instance of the HTML5 tech.\n */\n\nHtml5.nativeSourceHandler = {};\n/**\n * Check if the media element can play the given mime type.\n *\n * @param {string} type\n * The mimetype to check\n *\n * @return {string}\n * 'probably', 'maybe', or '' (empty string)\n */\n\nHtml5.nativeSourceHandler.canPlayType = function (type) {\n // IE without MediaPlayer throws an error (#519)\n try {\n return Html5.TEST_VID.canPlayType(type);\n } catch (e) {\n return '';\n }\n};\n/**\n * Check if the media element can handle a source natively.\n *\n * @param {Tech~SourceObject} source\n * The source object\n *\n * @param {Object} [options]\n * Options to be passed to the tech.\n *\n * @return {string}\n * 'probably', 'maybe', or '' (empty string).\n */\n\n\nHtml5.nativeSourceHandler.canHandleSource = function (source, options) {\n // If a type was provided we should rely on that\n if (source.type) {\n return Html5.nativeSourceHandler.canPlayType(source.type); // If no type, fall back to checking 'video/[EXTENSION]'\n } else if (source.src) {\n var ext = getFileExtension(source.src);\n return Html5.nativeSourceHandler.canPlayType(\"video/\" + ext);\n }\n\n return '';\n};\n/**\n * Pass the source to the native media element.\n *\n * @param {Tech~SourceObject} source\n * The source object\n *\n * @param {Html5} tech\n * The instance of the Html5 tech\n *\n * @param {Object} [options]\n * The options to pass to the source\n */\n\n\nHtml5.nativeSourceHandler.handleSource = function (source, tech, options) {\n tech.setSrc(source.src);\n};\n/**\n * A noop for the native dispose function, as cleanup is not needed.\n */\n\n\nHtml5.nativeSourceHandler.dispose = function () {}; // Register the native source handler\n\n\nHtml5.registerSourceHandler(Html5.nativeSourceHandler);\nTech.registerTech('Html5', Html5);\n\n// on the player when they happen\n\nvar TECH_EVENTS_RETRIGGER = [\n/**\n * Fired while the user agent is downloading media data.\n *\n * @event Player#progress\n * @type {EventTarget~Event}\n */\n\n/**\n * Retrigger the `progress` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechProgress_\n * @fires Player#progress\n * @listens Tech#progress\n */\n'progress',\n/**\n * Fires when the loading of an audio/video is aborted.\n *\n * @event Player#abort\n * @type {EventTarget~Event}\n */\n\n/**\n * Retrigger the `abort` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechAbort_\n * @fires Player#abort\n * @listens Tech#abort\n */\n'abort',\n/**\n * Fires when the browser is intentionally not getting media data.\n *\n * @event Player#suspend\n * @type {EventTarget~Event}\n */\n\n/**\n * Retrigger the `suspend` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechSuspend_\n * @fires Player#suspend\n * @listens Tech#suspend\n */\n'suspend',\n/**\n * Fires when the current playlist is empty.\n *\n * @event Player#emptied\n * @type {EventTarget~Event}\n */\n\n/**\n * Retrigger the `emptied` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechEmptied_\n * @fires Player#emptied\n * @listens Tech#emptied\n */\n'emptied',\n/**\n * Fires when the browser is trying to get media data, but data is not available.\n *\n * @event Player#stalled\n * @type {EventTarget~Event}\n */\n\n/**\n * Retrigger the `stalled` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechStalled_\n * @fires Player#stalled\n * @listens Tech#stalled\n */\n'stalled',\n/**\n * Fires when the browser has loaded meta data for the audio/video.\n *\n * @event Player#loadedmetadata\n * @type {EventTarget~Event}\n */\n\n/**\n * Retrigger the `loadedmetadata` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechLoadedmetadata_\n * @fires Player#loadedmetadata\n * @listens Tech#loadedmetadata\n */\n'loadedmetadata',\n/**\n * Fires when the browser has loaded the current frame of the audio/video.\n *\n * @event Player#loadeddata\n * @type {event}\n */\n\n/**\n * Retrigger the `loadeddata` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechLoaddeddata_\n * @fires Player#loadeddata\n * @listens Tech#loadeddata\n */\n'loadeddata',\n/**\n * Fires when the current playback position has changed.\n *\n * @event Player#timeupdate\n * @type {event}\n */\n\n/**\n * Retrigger the `timeupdate` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechTimeUpdate_\n * @fires Player#timeupdate\n * @listens Tech#timeupdate\n */\n'timeupdate',\n/**\n * Fires when the video's intrinsic dimensions change\n *\n * @event Player#resize\n * @type {event}\n */\n\n/**\n * Retrigger the `resize` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechResize_\n * @fires Player#resize\n * @listens Tech#resize\n */\n'resize',\n/**\n * Fires when the volume has been changed\n *\n * @event Player#volumechange\n * @type {event}\n */\n\n/**\n * Retrigger the `volumechange` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechVolumechange_\n * @fires Player#volumechange\n * @listens Tech#volumechange\n */\n'volumechange',\n/**\n * Fires when the text track has been changed\n *\n * @event Player#texttrackchange\n * @type {event}\n */\n\n/**\n * Retrigger the `texttrackchange` event that was triggered by the {@link Tech}.\n *\n * @private\n * @method Player#handleTechTexttrackchange_\n * @fires Player#texttrackchange\n * @listens Tech#texttrackchange\n */\n'texttrackchange']; // events to queue when playback rate is zero\n// this is a hash for the sole purpose of mapping non-camel-cased event names\n// to camel-cased function names\n\nvar TECH_EVENTS_QUEUE = {\n canplay: 'CanPlay',\n canplaythrough: 'CanPlayThrough',\n playing: 'Playing',\n seeked: 'Seeked'\n};\nvar BREAKPOINT_ORDER = ['tiny', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'huge'];\nvar BREAKPOINT_CLASSES = {}; // grep: vjs-layout-tiny\n// grep: vjs-layout-x-small\n// grep: vjs-layout-small\n// grep: vjs-layout-medium\n// grep: vjs-layout-large\n// grep: vjs-layout-x-large\n// grep: vjs-layout-huge\n\nBREAKPOINT_ORDER.forEach(function (k) {\n var v = k.charAt(0) === 'x' ? \"x-\" + k.substring(1) : k;\n BREAKPOINT_CLASSES[k] = \"vjs-layout-\" + v;\n});\nvar DEFAULT_BREAKPOINTS = {\n tiny: 210,\n xsmall: 320,\n small: 425,\n medium: 768,\n large: 1440,\n xlarge: 2560,\n huge: Infinity\n};\n/**\n * An instance of the `Player` class is created when any of the Video.js setup methods\n * are used to initialize a video.\n *\n * After an instance has been created it can be accessed globally in two ways:\n * 1. By calling `videojs('example_video_1');`\n * 2. By using it directly via `videojs.players.example_video_1;`\n *\n * @extends Component\n */\n\nvar Player = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(Player, _Component);\n\n /**\n * Create an instance of this class.\n *\n * @param {Element} tag\n * The original video DOM element used for configuring options.\n *\n * @param {Object} [options]\n * Object of option names and values.\n *\n * @param {Component~ReadyCallback} [ready]\n * Ready callback function.\n */\n function Player(tag, options, ready) {\n var _this;\n\n // Make sure tag ID exists\n tag.id = tag.id || options.id || \"vjs_video_\" + newGUID(); // Set Options\n // The options argument overrides options set in the video tag\n // which overrides globally set options.\n // This latter part coincides with the load order\n // (tag must exist before Player)\n\n options = assign(Player.getTagSettings(tag), options); // Delay the initialization of children because we need to set up\n // player properties first, and can't use `this` before `super()`\n\n options.initChildren = false; // Same with creating the element\n\n options.createEl = false; // don't auto mixin the evented mixin\n\n options.evented = false; // we don't want the player to report touch activity on itself\n // see enableTouchActivity in Component\n\n options.reportTouchActivity = false; // If language is not set, get the closest lang attribute\n\n if (!options.language) {\n if (typeof tag.closest === 'function') {\n var closest = tag.closest('[lang]');\n\n if (closest && closest.getAttribute) {\n options.language = closest.getAttribute('lang');\n }\n } else {\n var element = tag;\n\n while (element && element.nodeType === 1) {\n if (getAttributes(element).hasOwnProperty('lang')) {\n options.language = element.getAttribute('lang');\n break;\n }\n\n element = element.parentNode;\n }\n }\n } // Run base component initializing with new options\n\n\n _this = _Component.call(this, null, options, ready) || this; // Create bound methods for document listeners.\n\n _this.boundDocumentFullscreenChange_ = function (e) {\n return _this.documentFullscreenChange_(e);\n };\n\n _this.boundFullWindowOnEscKey_ = function (e) {\n return _this.fullWindowOnEscKey(e);\n };\n\n _this.boundUpdateStyleEl_ = function (e) {\n return _this.updateStyleEl_(e);\n };\n\n _this.boundApplyInitTime_ = function (e) {\n return _this.applyInitTime_(e);\n };\n\n _this.boundUpdateCurrentBreakpoint_ = function (e) {\n return _this.updateCurrentBreakpoint_(e);\n };\n\n _this.boundHandleTechClick_ = function (e) {\n return _this.handleTechClick_(e);\n };\n\n _this.boundHandleTechDoubleClick_ = function (e) {\n return _this.handleTechDoubleClick_(e);\n };\n\n _this.boundHandleTechTouchStart_ = function (e) {\n return _this.handleTechTouchStart_(e);\n };\n\n _this.boundHandleTechTouchMove_ = function (e) {\n return _this.handleTechTouchMove_(e);\n };\n\n _this.boundHandleTechTouchEnd_ = function (e) {\n return _this.handleTechTouchEnd_(e);\n };\n\n _this.boundHandleTechTap_ = function (e) {\n return _this.handleTechTap_(e);\n }; // default isFullscreen_ to false\n\n\n _this.isFullscreen_ = false; // create logger\n\n _this.log = createLogger(_this.id_); // Hold our own reference to fullscreen api so it can be mocked in tests\n\n _this.fsApi_ = FullscreenApi; // Tracks when a tech changes the poster\n\n _this.isPosterFromTech_ = false; // Holds callback info that gets queued when playback rate is zero\n // and a seek is happening\n\n _this.queuedCallbacks_ = []; // Turn off API access because we're loading a new tech that might load asynchronously\n\n _this.isReady_ = false; // Init state hasStarted_\n\n _this.hasStarted_ = false; // Init state userActive_\n\n _this.userActive_ = false; // Init debugEnabled_\n\n _this.debugEnabled_ = false; // Init state audioOnlyMode_\n\n _this.audioOnlyMode_ = false; // Init state audioPosterMode_\n\n _this.audioPosterMode_ = false; // Init state audioOnlyCache_\n\n _this.audioOnlyCache_ = {\n playerHeight: null,\n hiddenChildren: []\n }; // if the global option object was accidentally blown away by\n // someone, bail early with an informative error\n\n if (!_this.options_ || !_this.options_.techOrder || !_this.options_.techOrder.length) {\n throw new Error('No techOrder specified. Did you overwrite ' + 'videojs.options instead of just changing the ' + 'properties you want to override?');\n } // Store the original tag used to set options\n\n\n _this.tag = tag; // Store the tag attributes used to restore html5 element\n\n _this.tagAttributes = tag && getAttributes(tag); // Update current language\n\n _this.language(_this.options_.language); // Update Supported Languages\n\n\n if (options.languages) {\n // Normalise player option languages to lowercase\n var languagesToLower = {};\n Object.getOwnPropertyNames(options.languages).forEach(function (name) {\n languagesToLower[name.toLowerCase()] = options.languages[name];\n });\n _this.languages_ = languagesToLower;\n } else {\n _this.languages_ = Player.prototype.options_.languages;\n }\n\n _this.resetCache_(); // Set poster\n\n\n _this.poster_ = options.poster || ''; // Set controls\n\n _this.controls_ = !!options.controls; // Original tag settings stored in options\n // now remove immediately so native controls don't flash.\n // May be turned back on by HTML5 tech if nativeControlsForTouch is true\n\n tag.controls = false;\n tag.removeAttribute('controls');\n _this.changingSrc_ = false;\n _this.playCallbacks_ = [];\n _this.playTerminatedQueue_ = []; // the attribute overrides the option\n\n if (tag.hasAttribute('autoplay')) {\n _this.autoplay(true);\n } else {\n // otherwise use the setter to validate and\n // set the correct value.\n _this.autoplay(_this.options_.autoplay);\n } // check plugins\n\n\n if (options.plugins) {\n Object.keys(options.plugins).forEach(function (name) {\n if (typeof _this[name] !== 'function') {\n throw new Error(\"plugin \\\"\" + name + \"\\\" does not exist\");\n }\n });\n }\n /*\n * Store the internal state of scrubbing\n *\n * @private\n * @return {Boolean} True if the user is scrubbing\n */\n\n\n _this.scrubbing_ = false;\n _this.el_ = _this.createEl(); // Make this an evented object and use `el_` as its event bus.\n\n evented((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), {\n eventBusKey: 'el_'\n }); // listen to document and player fullscreenchange handlers so we receive those events\n // before a user can receive them so we can update isFullscreen appropriately.\n // make sure that we listen to fullscreenchange events before everything else to make sure that\n // our isFullscreen method is updated properly for internal components as well as external.\n\n if (_this.fsApi_.requestFullscreen) {\n on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), _this.fsApi_.fullscreenchange, _this.boundDocumentFullscreenChange_);\n\n _this.on(_this.fsApi_.fullscreenchange, _this.boundDocumentFullscreenChange_);\n }\n\n if (_this.fluid_) {\n _this.on(['playerreset', 'resize'], _this.boundUpdateStyleEl_);\n } // We also want to pass the original player options to each component and plugin\n // as well so they don't need to reach back into the player for options later.\n // We also need to do another copy of this.options_ so we don't end up with\n // an infinite loop.\n\n\n var playerOptionsCopy = mergeOptions$3(_this.options_); // Load plugins\n\n if (options.plugins) {\n Object.keys(options.plugins).forEach(function (name) {\n _this[name](options.plugins[name]);\n });\n } // Enable debug mode to fire debugon event for all plugins.\n\n\n if (options.debug) {\n _this.debug(true);\n }\n\n _this.options_.playerOptions = playerOptionsCopy;\n _this.middleware_ = [];\n\n _this.playbackRates(options.playbackRates);\n\n _this.initChildren(); // Set isAudio based on whether or not an audio tag was used\n\n\n _this.isAudio(tag.nodeName.toLowerCase() === 'audio'); // Update controls className. Can't do this when the controls are initially\n // set because the element doesn't exist yet.\n\n\n if (_this.controls()) {\n _this.addClass('vjs-controls-enabled');\n } else {\n _this.addClass('vjs-controls-disabled');\n } // Set ARIA label and region role depending on player type\n\n\n _this.el_.setAttribute('role', 'region');\n\n if (_this.isAudio()) {\n _this.el_.setAttribute('aria-label', _this.localize('Audio Player'));\n } else {\n _this.el_.setAttribute('aria-label', _this.localize('Video Player'));\n }\n\n if (_this.isAudio()) {\n _this.addClass('vjs-audio');\n }\n\n if (_this.flexNotSupported_()) {\n _this.addClass('vjs-no-flex');\n } // TODO: Make this smarter. Toggle user state between touching/mousing\n // using events, since devices can have both touch and mouse events.\n // TODO: Make this check be performed again when the window switches between monitors\n // (See https://github.com/videojs/video.js/issues/5683)\n\n\n if (TOUCH_ENABLED) {\n _this.addClass('vjs-touch-enabled');\n } // iOS Safari has broken hover handling\n\n\n if (!IS_IOS) {\n _this.addClass('vjs-workinghover');\n } // Make player easily findable by ID\n\n\n Player.players[_this.id_] = (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this); // Add a major version class to aid css in plugins\n\n var majorVersion = version$5.split('.')[0];\n\n _this.addClass(\"vjs-v\" + majorVersion); // When the player is first initialized, trigger activity so components\n // like the control bar show themselves if needed\n\n\n _this.userActive(true);\n\n _this.reportUserActivity();\n\n _this.one('play', function (e) {\n return _this.listenForUserActivity_(e);\n });\n\n _this.on('stageclick', function (e) {\n return _this.handleStageClick_(e);\n });\n\n _this.on('keydown', function (e) {\n return _this.handleKeyDown(e);\n });\n\n _this.on('languagechange', function (e) {\n return _this.handleLanguagechange(e);\n });\n\n _this.breakpoints(_this.options_.breakpoints);\n\n _this.responsive(_this.options_.responsive); // Calling both the audio mode methods after the player is fully\n // setup to be able to listen to the events triggered by them\n\n\n _this.on('ready', function () {\n // Calling the audioPosterMode method first so that\n // the audioOnlyMode can take precedence when both options are set to true\n _this.audioPosterMode(_this.options_.audioPosterMode);\n\n _this.audioOnlyMode(_this.options_.audioOnlyMode);\n });\n\n return _this;\n }\n /**\n * Destroys the video player and does any necessary cleanup.\n *\n * This is especially helpful if you are dynamically adding and removing videos\n * to/from the DOM.\n *\n * @fires Player#dispose\n */\n\n\n var _proto = Player.prototype;\n\n _proto.dispose = function dispose() {\n var _this2 = this;\n\n /**\n * Called when the player is being disposed of.\n *\n * @event Player#dispose\n * @type {EventTarget~Event}\n */\n this.trigger('dispose'); // prevent dispose from being called twice\n\n this.off('dispose'); // Make sure all player-specific document listeners are unbound. This is\n\n off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);\n off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keydown', this.boundFullWindowOnEscKey_);\n\n if (this.styleEl_ && this.styleEl_.parentNode) {\n this.styleEl_.parentNode.removeChild(this.styleEl_);\n this.styleEl_ = null;\n } // Kill reference to this player\n\n\n Player.players[this.id_] = null;\n\n if (this.tag && this.tag.player) {\n this.tag.player = null;\n }\n\n if (this.el_ && this.el_.player) {\n this.el_.player = null;\n }\n\n if (this.tech_) {\n this.tech_.dispose();\n this.isPosterFromTech_ = false;\n this.poster_ = '';\n }\n\n if (this.playerElIngest_) {\n this.playerElIngest_ = null;\n }\n\n if (this.tag) {\n this.tag = null;\n }\n\n clearCacheForPlayer(this); // remove all event handlers for track lists\n // all tracks and track listeners are removed on\n // tech dispose\n\n ALL.names.forEach(function (name) {\n var props = ALL[name];\n\n var list = _this2[props.getterName](); // if it is not a native list\n // we have to manually remove event listeners\n\n\n if (list && list.off) {\n list.off();\n }\n }); // the actual .el_ is removed here, or replaced if\n\n _Component.prototype.dispose.call(this, {\n restoreEl: this.options_.restoreEl\n });\n }\n /**\n * Create the `Player`'s DOM element.\n *\n * @return {Element}\n * The DOM element that gets created.\n */\n ;\n\n _proto.createEl = function createEl() {\n var tag = this.tag;\n var el;\n var playerElIngest = this.playerElIngest_ = tag.parentNode && tag.parentNode.hasAttribute && tag.parentNode.hasAttribute('data-vjs-player');\n var divEmbed = this.tag.tagName.toLowerCase() === 'video-js';\n\n if (playerElIngest) {\n el = this.el_ = tag.parentNode;\n } else if (!divEmbed) {\n el = this.el_ = _Component.prototype.createEl.call(this, 'div');\n } // Copy over all the attributes from the tag, including ID and class\n // ID will now reference player box, not the video tag\n\n\n var attrs = getAttributes(tag);\n\n if (divEmbed) {\n el = this.el_ = tag;\n tag = this.tag = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video');\n\n while (el.children.length) {\n tag.appendChild(el.firstChild);\n }\n\n if (!hasClass(el, 'video-js')) {\n addClass(el, 'video-js');\n }\n\n el.appendChild(tag);\n playerElIngest = this.playerElIngest_ = el; // move properties over from our custom `video-js` element\n // to our new `video` element. This will move things like\n // `src` or `controls` that were set via js before the player\n // was initialized.\n\n Object.keys(el).forEach(function (k) {\n try {\n tag[k] = el[k];\n } catch (e) {// we got a a property like outerHTML which we can't actually copy, ignore it\n }\n });\n } // set tabindex to -1 to remove the video element from the focus order\n\n\n tag.setAttribute('tabindex', '-1');\n attrs.tabindex = '-1'; // Workaround for #4583 (JAWS+IE doesn't announce BPB or play button), and\n // for the same issue with Chrome (on Windows) with JAWS.\n // See https://github.com/FreedomScientific/VFO-standards-support/issues/78\n // Note that we can't detect if JAWS is being used, but this ARIA attribute\n // doesn't change behavior of IE11 or Chrome if JAWS is not being used\n\n if (IE_VERSION || IS_CHROME && IS_WINDOWS) {\n tag.setAttribute('role', 'application');\n attrs.role = 'application';\n } // Remove width/height attrs from tag so CSS can make it 100% width/height\n\n\n tag.removeAttribute('width');\n tag.removeAttribute('height');\n\n if ('width' in attrs) {\n delete attrs.width;\n }\n\n if ('height' in attrs) {\n delete attrs.height;\n }\n\n Object.getOwnPropertyNames(attrs).forEach(function (attr) {\n // don't copy over the class attribute to the player element when we're in a div embed\n // the class is already set up properly in the divEmbed case\n // and we want to make sure that the `video-js` class doesn't get lost\n if (!(divEmbed && attr === 'class')) {\n el.setAttribute(attr, attrs[attr]);\n }\n\n if (divEmbed) {\n tag.setAttribute(attr, attrs[attr]);\n }\n }); // Update tag id/class for use as HTML5 playback tech\n // Might think we should do this after embedding in container so .vjs-tech class\n // doesn't flash 100% width/height, but class only applies with .video-js parent\n\n tag.playerId = tag.id;\n tag.id += '_html5_api';\n tag.className = 'vjs-tech'; // Make player findable on elements\n\n tag.player = el.player = this; // Default state of video is paused\n\n this.addClass('vjs-paused'); // Add a style element in the player that we'll use to set the width/height\n // of the player in a way that's still overrideable by CSS, just like the\n // video element\n\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().VIDEOJS_NO_DYNAMIC_STYLE) !== true) {\n this.styleEl_ = createStyleElement('vjs-styles-dimensions');\n var defaultsStyleEl = $('.vjs-styles-defaults');\n var head = $('head');\n head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild);\n }\n\n this.fill_ = false;\n this.fluid_ = false; // Pass in the width/height/aspectRatio options which will update the style el\n\n this.width(this.options_.width);\n this.height(this.options_.height);\n this.fill(this.options_.fill);\n this.fluid(this.options_.fluid);\n this.aspectRatio(this.options_.aspectRatio); // support both crossOrigin and crossorigin to reduce confusion and issues around the name\n\n this.crossOrigin(this.options_.crossOrigin || this.options_.crossorigin); // Hide any links within the video/audio tag,\n // because IE doesn't hide them completely from screen readers.\n\n var links = tag.getElementsByTagName('a');\n\n for (var i = 0; i < links.length; i++) {\n var linkEl = links.item(i);\n addClass(linkEl, 'vjs-hidden');\n linkEl.setAttribute('hidden', 'hidden');\n } // insertElFirst seems to cause the networkState to flicker from 3 to 2, so\n // keep track of the original for later so we can know if the source originally failed\n\n\n tag.initNetworkState_ = tag.networkState; // Wrap video tag in div (el/box) container\n\n if (tag.parentNode && !playerElIngest) {\n tag.parentNode.insertBefore(el, tag);\n } // insert the tag as the first child of the player element\n // then manually add it to the children array so that this.addChild\n // will work properly for other components\n //\n // Breaks iPhone, fixed in HTML5 setup.\n\n\n prependTo(tag, el);\n this.children_.unshift(tag); // Set lang attr on player to ensure CSS :lang() in consistent with player\n // if it's been set to something different to the doc\n\n this.el_.setAttribute('lang', this.language_);\n this.el_.setAttribute('translate', 'no');\n this.el_ = el;\n return el;\n }\n /**\n * Get or set the `Player`'s crossOrigin option. For the HTML5 player, this\n * sets the `crossOrigin` property on the `<video>` tag to control the CORS\n * behavior.\n *\n * @see [Video Element Attributes]{@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-crossorigin}\n *\n * @param {string} [value]\n * The value to set the `Player`'s crossOrigin to. If an argument is\n * given, must be one of `anonymous` or `use-credentials`.\n *\n * @return {string|undefined}\n * - The current crossOrigin value of the `Player` when getting.\n * - undefined when setting\n */\n ;\n\n _proto.crossOrigin = function crossOrigin(value) {\n if (!value) {\n return this.techGet_('crossOrigin');\n }\n\n if (value !== 'anonymous' && value !== 'use-credentials') {\n log$1.warn(\"crossOrigin must be \\\"anonymous\\\" or \\\"use-credentials\\\", given \\\"\" + value + \"\\\"\");\n return;\n }\n\n this.techCall_('setCrossOrigin', value);\n return;\n }\n /**\n * A getter/setter for the `Player`'s width. Returns the player's configured value.\n * To get the current width use `currentWidth()`.\n *\n * @param {number} [value]\n * The value to set the `Player`'s width to.\n *\n * @return {number}\n * The current width of the `Player` when getting.\n */\n ;\n\n _proto.width = function width(value) {\n return this.dimension('width', value);\n }\n /**\n * A getter/setter for the `Player`'s height. Returns the player's configured value.\n * To get the current height use `currentheight()`.\n *\n * @param {number} [value]\n * The value to set the `Player`'s heigth to.\n *\n * @return {number}\n * The current height of the `Player` when getting.\n */\n ;\n\n _proto.height = function height(value) {\n return this.dimension('height', value);\n }\n /**\n * A getter/setter for the `Player`'s width & height.\n *\n * @param {string} dimension\n * This string can be:\n * - 'width'\n * - 'height'\n *\n * @param {number} [value]\n * Value for dimension specified in the first argument.\n *\n * @return {number}\n * The dimension arguments value when getting (width/height).\n */\n ;\n\n _proto.dimension = function dimension(_dimension, value) {\n var privDimension = _dimension + '_';\n\n if (value === undefined) {\n return this[privDimension] || 0;\n }\n\n if (value === '' || value === 'auto') {\n // If an empty string is given, reset the dimension to be automatic\n this[privDimension] = undefined;\n this.updateStyleEl_();\n return;\n }\n\n var parsedVal = parseFloat(value);\n\n if (isNaN(parsedVal)) {\n log$1.error(\"Improper value \\\"\" + value + \"\\\" supplied for for \" + _dimension);\n return;\n }\n\n this[privDimension] = parsedVal;\n this.updateStyleEl_();\n }\n /**\n * A getter/setter/toggler for the vjs-fluid `className` on the `Player`.\n *\n * Turning this on will turn off fill mode.\n *\n * @param {boolean} [bool]\n * - A value of true adds the class.\n * - A value of false removes the class.\n * - No value will be a getter.\n *\n * @return {boolean|undefined}\n * - The value of fluid when getting.\n * - `undefined` when setting.\n */\n ;\n\n _proto.fluid = function fluid(bool) {\n var _this3 = this;\n\n if (bool === undefined) {\n return !!this.fluid_;\n }\n\n this.fluid_ = !!bool;\n\n if (isEvented(this)) {\n this.off(['playerreset', 'resize'], this.boundUpdateStyleEl_);\n }\n\n if (bool) {\n this.addClass('vjs-fluid');\n this.fill(false);\n addEventedCallback(this, function () {\n _this3.on(['playerreset', 'resize'], _this3.boundUpdateStyleEl_);\n });\n } else {\n this.removeClass('vjs-fluid');\n }\n\n this.updateStyleEl_();\n }\n /**\n * A getter/setter/toggler for the vjs-fill `className` on the `Player`.\n *\n * Turning this on will turn off fluid mode.\n *\n * @param {boolean} [bool]\n * - A value of true adds the class.\n * - A value of false removes the class.\n * - No value will be a getter.\n *\n * @return {boolean|undefined}\n * - The value of fluid when getting.\n * - `undefined` when setting.\n */\n ;\n\n _proto.fill = function fill(bool) {\n if (bool === undefined) {\n return !!this.fill_;\n }\n\n this.fill_ = !!bool;\n\n if (bool) {\n this.addClass('vjs-fill');\n this.fluid(false);\n } else {\n this.removeClass('vjs-fill');\n }\n }\n /**\n * Get/Set the aspect ratio\n *\n * @param {string} [ratio]\n * Aspect ratio for player\n *\n * @return {string|undefined}\n * returns the current aspect ratio when getting\n */\n\n /**\n * A getter/setter for the `Player`'s aspect ratio.\n *\n * @param {string} [ratio]\n * The value to set the `Player`'s aspect ratio to.\n *\n * @return {string|undefined}\n * - The current aspect ratio of the `Player` when getting.\n * - undefined when setting\n */\n ;\n\n _proto.aspectRatio = function aspectRatio(ratio) {\n if (ratio === undefined) {\n return this.aspectRatio_;\n } // Check for width:height format\n\n\n if (!/^\\d+\\:\\d+$/.test(ratio)) {\n throw new Error('Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.');\n }\n\n this.aspectRatio_ = ratio; // We're assuming if you set an aspect ratio you want fluid mode,\n // because in fixed mode you could calculate width and height yourself.\n\n this.fluid(true);\n this.updateStyleEl_();\n }\n /**\n * Update styles of the `Player` element (height, width and aspect ratio).\n *\n * @private\n * @listens Tech#loadedmetadata\n */\n ;\n\n _proto.updateStyleEl_ = function updateStyleEl_() {\n if ((global_window__WEBPACK_IMPORTED_MODULE_0___default().VIDEOJS_NO_DYNAMIC_STYLE) === true) {\n var _width = typeof this.width_ === 'number' ? this.width_ : this.options_.width;\n\n var _height = typeof this.height_ === 'number' ? this.height_ : this.options_.height;\n\n var techEl = this.tech_ && this.tech_.el();\n\n if (techEl) {\n if (_width >= 0) {\n techEl.width = _width;\n }\n\n if (_height >= 0) {\n techEl.height = _height;\n }\n }\n\n return;\n }\n\n var width;\n var height;\n var aspectRatio;\n var idClass; // The aspect ratio is either used directly or to calculate width and height.\n\n if (this.aspectRatio_ !== undefined && this.aspectRatio_ !== 'auto') {\n // Use any aspectRatio that's been specifically set\n aspectRatio = this.aspectRatio_;\n } else if (this.videoWidth() > 0) {\n // Otherwise try to get the aspect ratio from the video metadata\n aspectRatio = this.videoWidth() + ':' + this.videoHeight();\n } else {\n // Or use a default. The video element's is 2:1, but 16:9 is more common.\n aspectRatio = '16:9';\n } // Get the ratio as a decimal we can use to calculate dimensions\n\n\n var ratioParts = aspectRatio.split(':');\n var ratioMultiplier = ratioParts[1] / ratioParts[0];\n\n if (this.width_ !== undefined) {\n // Use any width that's been specifically set\n width = this.width_;\n } else if (this.height_ !== undefined) {\n // Or calulate the width from the aspect ratio if a height has been set\n width = this.height_ / ratioMultiplier;\n } else {\n // Or use the video's metadata, or use the video el's default of 300\n width = this.videoWidth() || 300;\n }\n\n if (this.height_ !== undefined) {\n // Use any height that's been specifically set\n height = this.height_;\n } else {\n // Otherwise calculate the height from the ratio and the width\n height = width * ratioMultiplier;\n } // Ensure the CSS class is valid by starting with an alpha character\n\n\n if (/^[^a-zA-Z]/.test(this.id())) {\n idClass = 'dimensions-' + this.id();\n } else {\n idClass = this.id() + '-dimensions';\n } // Ensure the right class is still on the player for the style element\n\n\n this.addClass(idClass);\n setTextContent(this.styleEl_, \"\\n .\" + idClass + \" {\\n width: \" + width + \"px;\\n height: \" + height + \"px;\\n }\\n\\n .\" + idClass + \".vjs-fluid:not(.vjs-audio-only-mode) {\\n padding-top: \" + ratioMultiplier * 100 + \"%;\\n }\\n \");\n }\n /**\n * Load/Create an instance of playback {@link Tech} including element\n * and API methods. Then append the `Tech` element in `Player` as a child.\n *\n * @param {string} techName\n * name of the playback technology\n *\n * @param {string} source\n * video source\n *\n * @private\n */\n ;\n\n _proto.loadTech_ = function loadTech_(techName, source) {\n var _this4 = this;\n\n // Pause and remove current playback technology\n if (this.tech_) {\n this.unloadTech_();\n }\n\n var titleTechName = toTitleCase$1(techName);\n var camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1); // get rid of the HTML5 video tag as soon as we are using another tech\n\n if (titleTechName !== 'Html5' && this.tag) {\n Tech.getTech('Html5').disposeMediaElement(this.tag);\n this.tag.player = null;\n this.tag = null;\n }\n\n this.techName_ = titleTechName; // Turn off API access because we're loading a new tech that might load asynchronously\n\n this.isReady_ = false;\n var autoplay = this.autoplay(); // if autoplay is a string (or `true` with normalizeAutoplay: true) we pass false to the tech\n // because the player is going to handle autoplay on `loadstart`\n\n if (typeof this.autoplay() === 'string' || this.autoplay() === true && this.options_.normalizeAutoplay) {\n autoplay = false;\n } // Grab tech-specific options from player options and add source and parent element to use.\n\n\n var techOptions = {\n source: source,\n autoplay: autoplay,\n 'nativeControlsForTouch': this.options_.nativeControlsForTouch,\n 'playerId': this.id(),\n 'techId': this.id() + \"_\" + camelTechName + \"_api\",\n 'playsinline': this.options_.playsinline,\n 'preload': this.options_.preload,\n 'loop': this.options_.loop,\n 'disablePictureInPicture': this.options_.disablePictureInPicture,\n 'muted': this.options_.muted,\n 'poster': this.poster(),\n 'language': this.language(),\n 'playerElIngest': this.playerElIngest_ || false,\n 'vtt.js': this.options_['vtt.js'],\n 'canOverridePoster': !!this.options_.techCanOverridePoster,\n 'enableSourceset': this.options_.enableSourceset,\n 'Promise': this.options_.Promise\n };\n ALL.names.forEach(function (name) {\n var props = ALL[name];\n techOptions[props.getterName] = _this4[props.privateName];\n });\n assign(techOptions, this.options_[titleTechName]);\n assign(techOptions, this.options_[camelTechName]);\n assign(techOptions, this.options_[techName.toLowerCase()]);\n\n if (this.tag) {\n techOptions.tag = this.tag;\n }\n\n if (source && source.src === this.cache_.src && this.cache_.currentTime > 0) {\n techOptions.startTime = this.cache_.currentTime;\n } // Initialize tech instance\n\n\n var TechClass = Tech.getTech(techName);\n\n if (!TechClass) {\n throw new Error(\"No Tech named '\" + titleTechName + \"' exists! '\" + titleTechName + \"' should be registered using videojs.registerTech()'\");\n }\n\n this.tech_ = new TechClass(techOptions); // player.triggerReady is always async, so don't need this to be async\n\n this.tech_.ready(bind(this, this.handleTechReady_), true);\n textTrackConverter.jsonToTextTracks(this.textTracksJson_ || [], this.tech_); // Listen to all HTML5-defined events and trigger them on the player\n\n TECH_EVENTS_RETRIGGER.forEach(function (event) {\n _this4.on(_this4.tech_, event, function (e) {\n return _this4[\"handleTech\" + toTitleCase$1(event) + \"_\"](e);\n });\n });\n Object.keys(TECH_EVENTS_QUEUE).forEach(function (event) {\n _this4.on(_this4.tech_, event, function (eventObj) {\n if (_this4.tech_.playbackRate() === 0 && _this4.tech_.seeking()) {\n _this4.queuedCallbacks_.push({\n callback: _this4[\"handleTech\" + TECH_EVENTS_QUEUE[event] + \"_\"].bind(_this4),\n event: eventObj\n });\n\n return;\n }\n\n _this4[\"handleTech\" + TECH_EVENTS_QUEUE[event] + \"_\"](eventObj);\n });\n });\n this.on(this.tech_, 'loadstart', function (e) {\n return _this4.handleTechLoadStart_(e);\n });\n this.on(this.tech_, 'sourceset', function (e) {\n return _this4.handleTechSourceset_(e);\n });\n this.on(this.tech_, 'waiting', function (e) {\n return _this4.handleTechWaiting_(e);\n });\n this.on(this.tech_, 'ended', function (e) {\n return _this4.handleTechEnded_(e);\n });\n this.on(this.tech_, 'seeking', function (e) {\n return _this4.handleTechSeeking_(e);\n });\n this.on(this.tech_, 'play', function (e) {\n return _this4.handleTechPlay_(e);\n });\n this.on(this.tech_, 'firstplay', function (e) {\n return _this4.handleTechFirstPlay_(e);\n });\n this.on(this.tech_, 'pause', function (e) {\n return _this4.handleTechPause_(e);\n });\n this.on(this.tech_, 'durationchange', function (e) {\n return _this4.handleTechDurationChange_(e);\n });\n this.on(this.tech_, 'fullscreenchange', function (e, data) {\n return _this4.handleTechFullscreenChange_(e, data);\n });\n this.on(this.tech_, 'fullscreenerror', function (e, err) {\n return _this4.handleTechFullscreenError_(e, err);\n });\n this.on(this.tech_, 'enterpictureinpicture', function (e) {\n return _this4.handleTechEnterPictureInPicture_(e);\n });\n this.on(this.tech_, 'leavepictureinpicture', function (e) {\n return _this4.handleTechLeavePictureInPicture_(e);\n });\n this.on(this.tech_, 'error', function (e) {\n return _this4.handleTechError_(e);\n });\n this.on(this.tech_, 'posterchange', function (e) {\n return _this4.handleTechPosterChange_(e);\n });\n this.on(this.tech_, 'textdata', function (e) {\n return _this4.handleTechTextData_(e);\n });\n this.on(this.tech_, 'ratechange', function (e) {\n return _this4.handleTechRateChange_(e);\n });\n this.on(this.tech_, 'loadedmetadata', this.boundUpdateStyleEl_);\n this.usingNativeControls(this.techGet_('controls'));\n\n if (this.controls() && !this.usingNativeControls()) {\n this.addTechControlsListeners_();\n } // Add the tech element in the DOM if it was not already there\n // Make sure to not insert the original video element if using Html5\n\n\n if (this.tech_.el().parentNode !== this.el() && (titleTechName !== 'Html5' || !this.tag)) {\n prependTo(this.tech_.el(), this.el());\n } // Get rid of the original video tag reference after the first tech is loaded\n\n\n if (this.tag) {\n this.tag.player = null;\n this.tag = null;\n }\n }\n /**\n * Unload and dispose of the current playback {@link Tech}.\n *\n * @private\n */\n ;\n\n _proto.unloadTech_ = function unloadTech_() {\n var _this5 = this;\n\n // Save the current text tracks so that we can reuse the same text tracks with the next tech\n ALL.names.forEach(function (name) {\n var props = ALL[name];\n _this5[props.privateName] = _this5[props.getterName]();\n });\n this.textTracksJson_ = textTrackConverter.textTracksToJson(this.tech_);\n this.isReady_ = false;\n this.tech_.dispose();\n this.tech_ = false;\n\n if (this.isPosterFromTech_) {\n this.poster_ = '';\n this.trigger('posterchange');\n }\n\n this.isPosterFromTech_ = false;\n }\n /**\n * Return a reference to the current {@link Tech}.\n * It will print a warning by default about the danger of using the tech directly\n * but any argument that is passed in will silence the warning.\n *\n * @param {*} [safety]\n * Anything passed in to silence the warning\n *\n * @return {Tech}\n * The Tech\n */\n ;\n\n _proto.tech = function tech(safety) {\n if (safety === undefined) {\n log$1.warn('Using the tech directly can be dangerous. I hope you know what you\\'re doing.\\n' + 'See https://github.com/videojs/video.js/issues/2617 for more info.\\n');\n }\n\n return this.tech_;\n }\n /**\n * Set up click and touch listeners for the playback element\n *\n * - On desktops: a click on the video itself will toggle playback\n * - On mobile devices: a click on the video toggles controls\n * which is done by toggling the user state between active and\n * inactive\n * - A tap can signal that a user has become active or has become inactive\n * e.g. a quick tap on an iPhone movie should reveal the controls. Another\n * quick tap should hide them again (signaling the user is in an inactive\n * viewing state)\n * - In addition to this, we still want the user to be considered inactive after\n * a few seconds of inactivity.\n *\n * > Note: the only part of iOS interaction we can't mimic with this setup\n * is a touch and hold on the video element counting as activity in order to\n * keep the controls showing, but that shouldn't be an issue. A touch and hold\n * on any controls will still keep the user active\n *\n * @private\n */\n ;\n\n _proto.addTechControlsListeners_ = function addTechControlsListeners_() {\n // Make sure to remove all the previous listeners in case we are called multiple times.\n this.removeTechControlsListeners_();\n this.on(this.tech_, 'click', this.boundHandleTechClick_);\n this.on(this.tech_, 'dblclick', this.boundHandleTechDoubleClick_); // If the controls were hidden we don't want that to change without a tap event\n // so we'll check if the controls were already showing before reporting user\n // activity\n\n this.on(this.tech_, 'touchstart', this.boundHandleTechTouchStart_);\n this.on(this.tech_, 'touchmove', this.boundHandleTechTouchMove_);\n this.on(this.tech_, 'touchend', this.boundHandleTechTouchEnd_); // The tap listener needs to come after the touchend listener because the tap\n // listener cancels out any reportedUserActivity when setting userActive(false)\n\n this.on(this.tech_, 'tap', this.boundHandleTechTap_);\n }\n /**\n * Remove the listeners used for click and tap controls. This is needed for\n * toggling to controls disabled, where a tap/touch should do nothing.\n *\n * @private\n */\n ;\n\n _proto.removeTechControlsListeners_ = function removeTechControlsListeners_() {\n // We don't want to just use `this.off()` because there might be other needed\n // listeners added by techs that extend this.\n this.off(this.tech_, 'tap', this.boundHandleTechTap_);\n this.off(this.tech_, 'touchstart', this.boundHandleTechTouchStart_);\n this.off(this.tech_, 'touchmove', this.boundHandleTechTouchMove_);\n this.off(this.tech_, 'touchend', this.boundHandleTechTouchEnd_);\n this.off(this.tech_, 'click', this.boundHandleTechClick_);\n this.off(this.tech_, 'dblclick', this.boundHandleTechDoubleClick_);\n }\n /**\n * Player waits for the tech to be ready\n *\n * @private\n */\n ;\n\n _proto.handleTechReady_ = function handleTechReady_() {\n this.triggerReady(); // Keep the same volume as before\n\n if (this.cache_.volume) {\n this.techCall_('setVolume', this.cache_.volume);\n } // Look if the tech found a higher resolution poster while loading\n\n\n this.handleTechPosterChange_(); // Update the duration if available\n\n this.handleTechDurationChange_();\n }\n /**\n * Retrigger the `loadstart` event that was triggered by the {@link Tech}. This\n * function will also trigger {@link Player#firstplay} if it is the first loadstart\n * for a video.\n *\n * @fires Player#loadstart\n * @fires Player#firstplay\n * @listens Tech#loadstart\n * @private\n */\n ;\n\n _proto.handleTechLoadStart_ = function handleTechLoadStart_() {\n // TODO: Update to use `emptied` event instead. See #1277.\n this.removeClass('vjs-ended');\n this.removeClass('vjs-seeking'); // reset the error state\n\n this.error(null); // Update the duration\n\n this.handleTechDurationChange_(); // If it's already playing we want to trigger a firstplay event now.\n // The firstplay event relies on both the play and loadstart events\n // which can happen in any order for a new source\n\n if (!this.paused()) {\n /**\n * Fired when the user agent begins looking for media data\n *\n * @event Player#loadstart\n * @type {EventTarget~Event}\n */\n this.trigger('loadstart');\n this.trigger('firstplay');\n } else {\n // reset the hasStarted state\n this.hasStarted(false);\n this.trigger('loadstart');\n } // autoplay happens after loadstart for the browser,\n // so we mimic that behavior\n\n\n this.manualAutoplay_(this.autoplay() === true && this.options_.normalizeAutoplay ? 'play' : this.autoplay());\n }\n /**\n * Handle autoplay string values, rather than the typical boolean\n * values that should be handled by the tech. Note that this is not\n * part of any specification. Valid values and what they do can be\n * found on the autoplay getter at Player#autoplay()\n */\n ;\n\n _proto.manualAutoplay_ = function manualAutoplay_(type) {\n var _this6 = this;\n\n if (!this.tech_ || typeof type !== 'string') {\n return;\n } // Save original muted() value, set muted to true, and attempt to play().\n // On promise rejection, restore muted from saved value\n\n\n var resolveMuted = function resolveMuted() {\n var previouslyMuted = _this6.muted();\n\n _this6.muted(true);\n\n var restoreMuted = function restoreMuted() {\n _this6.muted(previouslyMuted);\n }; // restore muted on play terminatation\n\n\n _this6.playTerminatedQueue_.push(restoreMuted);\n\n var mutedPromise = _this6.play();\n\n if (!isPromise(mutedPromise)) {\n return;\n }\n\n return mutedPromise[\"catch\"](function (err) {\n restoreMuted();\n throw new Error(\"Rejection at manualAutoplay. Restoring muted value. \" + (err ? err : ''));\n });\n };\n\n var promise; // if muted defaults to true\n // the only thing we can do is call play\n\n if (type === 'any' && !this.muted()) {\n promise = this.play();\n\n if (isPromise(promise)) {\n promise = promise[\"catch\"](resolveMuted);\n }\n } else if (type === 'muted' && !this.muted()) {\n promise = resolveMuted();\n } else {\n promise = this.play();\n }\n\n if (!isPromise(promise)) {\n return;\n }\n\n return promise.then(function () {\n _this6.trigger({\n type: 'autoplay-success',\n autoplay: type\n });\n })[\"catch\"](function () {\n _this6.trigger({\n type: 'autoplay-failure',\n autoplay: type\n });\n });\n }\n /**\n * Update the internal source caches so that we return the correct source from\n * `src()`, `currentSource()`, and `currentSources()`.\n *\n * > Note: `currentSources` will not be updated if the source that is passed in exists\n * in the current `currentSources` cache.\n *\n *\n * @param {Tech~SourceObject} srcObj\n * A string or object source to update our caches to.\n */\n ;\n\n _proto.updateSourceCaches_ = function updateSourceCaches_(srcObj) {\n if (srcObj === void 0) {\n srcObj = '';\n }\n\n var src = srcObj;\n var type = '';\n\n if (typeof src !== 'string') {\n src = srcObj.src;\n type = srcObj.type;\n } // make sure all the caches are set to default values\n // to prevent null checking\n\n\n this.cache_.source = this.cache_.source || {};\n this.cache_.sources = this.cache_.sources || []; // try to get the type of the src that was passed in\n\n if (src && !type) {\n type = findMimetype(this, src);\n } // update `currentSource` cache always\n\n\n this.cache_.source = mergeOptions$3({}, srcObj, {\n src: src,\n type: type\n });\n var matchingSources = this.cache_.sources.filter(function (s) {\n return s.src && s.src === src;\n });\n var sourceElSources = [];\n var sourceEls = this.$$('source');\n var matchingSourceEls = [];\n\n for (var i = 0; i < sourceEls.length; i++) {\n var sourceObj = getAttributes(sourceEls[i]);\n sourceElSources.push(sourceObj);\n\n if (sourceObj.src && sourceObj.src === src) {\n matchingSourceEls.push(sourceObj.src);\n }\n } // if we have matching source els but not matching sources\n // the current source cache is not up to date\n\n\n if (matchingSourceEls.length && !matchingSources.length) {\n this.cache_.sources = sourceElSources; // if we don't have matching source or source els set the\n // sources cache to the `currentSource` cache\n } else if (!matchingSources.length) {\n this.cache_.sources = [this.cache_.source];\n } // update the tech `src` cache\n\n\n this.cache_.src = src;\n }\n /**\n * *EXPERIMENTAL* Fired when the source is set or changed on the {@link Tech}\n * causing the media element to reload.\n *\n * It will fire for the initial source and each subsequent source.\n * This event is a custom event from Video.js and is triggered by the {@link Tech}.\n *\n * The event object for this event contains a `src` property that will contain the source\n * that was available when the event was triggered. This is generally only necessary if Video.js\n * is switching techs while the source was being changed.\n *\n * It is also fired when `load` is called on the player (or media element)\n * because the {@link https://html.spec.whatwg.org/multipage/media.html#dom-media-load|specification for `load`}\n * says that the resource selection algorithm needs to be aborted and restarted.\n * In this case, it is very likely that the `src` property will be set to the\n * empty string `\"\"` to indicate we do not know what the source will be but\n * that it is changing.\n *\n * *This event is currently still experimental and may change in minor releases.*\n * __To use this, pass `enableSourceset` option to the player.__\n *\n * @event Player#sourceset\n * @type {EventTarget~Event}\n * @prop {string} src\n * The source url available when the `sourceset` was triggered.\n * It will be an empty string if we cannot know what the source is\n * but know that the source will change.\n */\n\n /**\n * Retrigger the `sourceset` event that was triggered by the {@link Tech}.\n *\n * @fires Player#sourceset\n * @listens Tech#sourceset\n * @private\n */\n ;\n\n _proto.handleTechSourceset_ = function handleTechSourceset_(event) {\n var _this7 = this;\n\n // only update the source cache when the source\n // was not updated using the player api\n if (!this.changingSrc_) {\n var updateSourceCaches = function updateSourceCaches(src) {\n return _this7.updateSourceCaches_(src);\n };\n\n var playerSrc = this.currentSource().src;\n var eventSrc = event.src; // if we have a playerSrc that is not a blob, and a tech src that is a blob\n\n if (playerSrc && !/^blob:/.test(playerSrc) && /^blob:/.test(eventSrc)) {\n // if both the tech source and the player source were updated we assume\n // something like @videojs/http-streaming did the sourceset and skip updating the source cache.\n if (!this.lastSource_ || this.lastSource_.tech !== eventSrc && this.lastSource_.player !== playerSrc) {\n updateSourceCaches = function updateSourceCaches() {};\n }\n } // update the source to the initial source right away\n // in some cases this will be empty string\n\n\n updateSourceCaches(eventSrc); // if the `sourceset` `src` was an empty string\n // wait for a `loadstart` to update the cache to `currentSrc`.\n // If a sourceset happens before a `loadstart`, we reset the state\n\n if (!event.src) {\n this.tech_.any(['sourceset', 'loadstart'], function (e) {\n // if a sourceset happens before a `loadstart` there\n // is nothing to do as this `handleTechSourceset_`\n // will be called again and this will be handled there.\n if (e.type === 'sourceset') {\n return;\n }\n\n var techSrc = _this7.techGet('currentSrc');\n\n _this7.lastSource_.tech = techSrc;\n\n _this7.updateSourceCaches_(techSrc);\n });\n }\n }\n\n this.lastSource_ = {\n player: this.currentSource().src,\n tech: event.src\n };\n this.trigger({\n src: event.src,\n type: 'sourceset'\n });\n }\n /**\n * Add/remove the vjs-has-started class\n *\n * @fires Player#firstplay\n *\n * @param {boolean} request\n * - true: adds the class\n * - false: remove the class\n *\n * @return {boolean}\n * the boolean value of hasStarted_\n */\n ;\n\n _proto.hasStarted = function hasStarted(request) {\n if (request === undefined) {\n // act as getter, if we have no request to change\n return this.hasStarted_;\n }\n\n if (request === this.hasStarted_) {\n return;\n }\n\n this.hasStarted_ = request;\n\n if (this.hasStarted_) {\n this.addClass('vjs-has-started');\n this.trigger('firstplay');\n } else {\n this.removeClass('vjs-has-started');\n }\n }\n /**\n * Fired whenever the media begins or resumes playback\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-play}\n * @fires Player#play\n * @listens Tech#play\n * @private\n */\n ;\n\n _proto.handleTechPlay_ = function handleTechPlay_() {\n this.removeClass('vjs-ended');\n this.removeClass('vjs-paused');\n this.addClass('vjs-playing'); // hide the poster when the user hits play\n\n this.hasStarted(true);\n /**\n * Triggered whenever an {@link Tech#play} event happens. Indicates that\n * playback has started or resumed.\n *\n * @event Player#play\n * @type {EventTarget~Event}\n */\n\n this.trigger('play');\n }\n /**\n * Retrigger the `ratechange` event that was triggered by the {@link Tech}.\n *\n * If there were any events queued while the playback rate was zero, fire\n * those events now.\n *\n * @private\n * @method Player#handleTechRateChange_\n * @fires Player#ratechange\n * @listens Tech#ratechange\n */\n ;\n\n _proto.handleTechRateChange_ = function handleTechRateChange_() {\n if (this.tech_.playbackRate() > 0 && this.cache_.lastPlaybackRate === 0) {\n this.queuedCallbacks_.forEach(function (queued) {\n return queued.callback(queued.event);\n });\n this.queuedCallbacks_ = [];\n }\n\n this.cache_.lastPlaybackRate = this.tech_.playbackRate();\n /**\n * Fires when the playing speed of the audio/video is changed\n *\n * @event Player#ratechange\n * @type {event}\n */\n\n this.trigger('ratechange');\n }\n /**\n * Retrigger the `waiting` event that was triggered by the {@link Tech}.\n *\n * @fires Player#waiting\n * @listens Tech#waiting\n * @private\n */\n ;\n\n _proto.handleTechWaiting_ = function handleTechWaiting_() {\n var _this8 = this;\n\n this.addClass('vjs-waiting');\n /**\n * A readyState change on the DOM element has caused playback to stop.\n *\n * @event Player#waiting\n * @type {EventTarget~Event}\n */\n\n this.trigger('waiting'); // Browsers may emit a timeupdate event after a waiting event. In order to prevent\n // premature removal of the waiting class, wait for the time to change.\n\n var timeWhenWaiting = this.currentTime();\n\n var timeUpdateListener = function timeUpdateListener() {\n if (timeWhenWaiting !== _this8.currentTime()) {\n _this8.removeClass('vjs-waiting');\n\n _this8.off('timeupdate', timeUpdateListener);\n }\n };\n\n this.on('timeupdate', timeUpdateListener);\n }\n /**\n * Retrigger the `canplay` event that was triggered by the {@link Tech}.\n * > Note: This is not consistent between browsers. See #1351\n *\n * @fires Player#canplay\n * @listens Tech#canplay\n * @private\n */\n ;\n\n _proto.handleTechCanPlay_ = function handleTechCanPlay_() {\n this.removeClass('vjs-waiting');\n /**\n * The media has a readyState of HAVE_FUTURE_DATA or greater.\n *\n * @event Player#canplay\n * @type {EventTarget~Event}\n */\n\n this.trigger('canplay');\n }\n /**\n * Retrigger the `canplaythrough` event that was triggered by the {@link Tech}.\n *\n * @fires Player#canplaythrough\n * @listens Tech#canplaythrough\n * @private\n */\n ;\n\n _proto.handleTechCanPlayThrough_ = function handleTechCanPlayThrough_() {\n this.removeClass('vjs-waiting');\n /**\n * The media has a readyState of HAVE_ENOUGH_DATA or greater. This means that the\n * entire media file can be played without buffering.\n *\n * @event Player#canplaythrough\n * @type {EventTarget~Event}\n */\n\n this.trigger('canplaythrough');\n }\n /**\n * Retrigger the `playing` event that was triggered by the {@link Tech}.\n *\n * @fires Player#playing\n * @listens Tech#playing\n * @private\n */\n ;\n\n _proto.handleTechPlaying_ = function handleTechPlaying_() {\n this.removeClass('vjs-waiting');\n /**\n * The media is no longer blocked from playback, and has started playing.\n *\n * @event Player#playing\n * @type {EventTarget~Event}\n */\n\n this.trigger('playing');\n }\n /**\n * Retrigger the `seeking` event that was triggered by the {@link Tech}.\n *\n * @fires Player#seeking\n * @listens Tech#seeking\n * @private\n */\n ;\n\n _proto.handleTechSeeking_ = function handleTechSeeking_() {\n this.addClass('vjs-seeking');\n /**\n * Fired whenever the player is jumping to a new time\n *\n * @event Player#seeking\n * @type {EventTarget~Event}\n */\n\n this.trigger('seeking');\n }\n /**\n * Retrigger the `seeked` event that was triggered by the {@link Tech}.\n *\n * @fires Player#seeked\n * @listens Tech#seeked\n * @private\n */\n ;\n\n _proto.handleTechSeeked_ = function handleTechSeeked_() {\n this.removeClass('vjs-seeking');\n this.removeClass('vjs-ended');\n /**\n * Fired when the player has finished jumping to a new time\n *\n * @event Player#seeked\n * @type {EventTarget~Event}\n */\n\n this.trigger('seeked');\n }\n /**\n * Retrigger the `firstplay` event that was triggered by the {@link Tech}.\n *\n * @fires Player#firstplay\n * @listens Tech#firstplay\n * @deprecated As of 6.0 firstplay event is deprecated.\n * As of 6.0 passing the `starttime` option to the player and the firstplay event are deprecated.\n * @private\n */\n ;\n\n _proto.handleTechFirstPlay_ = function handleTechFirstPlay_() {\n // If the first starttime attribute is specified\n // then we will start at the given offset in seconds\n if (this.options_.starttime) {\n log$1.warn('Passing the `starttime` option to the player will be deprecated in 6.0');\n this.currentTime(this.options_.starttime);\n }\n\n this.addClass('vjs-has-started');\n /**\n * Fired the first time a video is played. Not part of the HLS spec, and this is\n * probably not the best implementation yet, so use sparingly. If you don't have a\n * reason to prevent playback, use `myPlayer.one('play');` instead.\n *\n * @event Player#firstplay\n * @deprecated As of 6.0 firstplay event is deprecated.\n * @type {EventTarget~Event}\n */\n\n this.trigger('firstplay');\n }\n /**\n * Retrigger the `pause` event that was triggered by the {@link Tech}.\n *\n * @fires Player#pause\n * @listens Tech#pause\n * @private\n */\n ;\n\n _proto.handleTechPause_ = function handleTechPause_() {\n this.removeClass('vjs-playing');\n this.addClass('vjs-paused');\n /**\n * Fired whenever the media has been paused\n *\n * @event Player#pause\n * @type {EventTarget~Event}\n */\n\n this.trigger('pause');\n }\n /**\n * Retrigger the `ended` event that was triggered by the {@link Tech}.\n *\n * @fires Player#ended\n * @listens Tech#ended\n * @private\n */\n ;\n\n _proto.handleTechEnded_ = function handleTechEnded_() {\n this.addClass('vjs-ended');\n this.removeClass('vjs-waiting');\n\n if (this.options_.loop) {\n this.currentTime(0);\n this.play();\n } else if (!this.paused()) {\n this.pause();\n }\n /**\n * Fired when the end of the media resource is reached (currentTime == duration)\n *\n * @event Player#ended\n * @type {EventTarget~Event}\n */\n\n\n this.trigger('ended');\n }\n /**\n * Fired when the duration of the media resource is first known or changed\n *\n * @listens Tech#durationchange\n * @private\n */\n ;\n\n _proto.handleTechDurationChange_ = function handleTechDurationChange_() {\n this.duration(this.techGet_('duration'));\n }\n /**\n * Handle a click on the media element to play/pause\n *\n * @param {EventTarget~Event} event\n * the event that caused this function to trigger\n *\n * @listens Tech#click\n * @private\n */\n ;\n\n _proto.handleTechClick_ = function handleTechClick_(event) {\n // When controls are disabled a click should not toggle playback because\n // the click is considered a control\n if (!this.controls_) {\n return;\n }\n\n if (this.options_ === undefined || this.options_.userActions === undefined || this.options_.userActions.click === undefined || this.options_.userActions.click !== false) {\n if (this.options_ !== undefined && this.options_.userActions !== undefined && typeof this.options_.userActions.click === 'function') {\n this.options_.userActions.click.call(this, event);\n } else if (this.paused()) {\n silencePromise(this.play());\n } else {\n this.pause();\n }\n }\n }\n /**\n * Handle a double-click on the media element to enter/exit fullscreen\n *\n * @param {EventTarget~Event} event\n * the event that caused this function to trigger\n *\n * @listens Tech#dblclick\n * @private\n */\n ;\n\n _proto.handleTechDoubleClick_ = function handleTechDoubleClick_(event) {\n if (!this.controls_) {\n return;\n } // we do not want to toggle fullscreen state\n // when double-clicking inside a control bar or a modal\n\n\n var inAllowedEls = Array.prototype.some.call(this.$$('.vjs-control-bar, .vjs-modal-dialog'), function (el) {\n return el.contains(event.target);\n });\n\n if (!inAllowedEls) {\n /*\n * options.userActions.doubleClick\n *\n * If `undefined` or `true`, double-click toggles fullscreen if controls are present\n * Set to `false` to disable double-click handling\n * Set to a function to substitute an external double-click handler\n */\n if (this.options_ === undefined || this.options_.userActions === undefined || this.options_.userActions.doubleClick === undefined || this.options_.userActions.doubleClick !== false) {\n if (this.options_ !== undefined && this.options_.userActions !== undefined && typeof this.options_.userActions.doubleClick === 'function') {\n this.options_.userActions.doubleClick.call(this, event);\n } else if (this.isFullscreen()) {\n this.exitFullscreen();\n } else {\n this.requestFullscreen();\n }\n }\n }\n }\n /**\n * Handle a tap on the media element. It will toggle the user\n * activity state, which hides and shows the controls.\n *\n * @listens Tech#tap\n * @private\n */\n ;\n\n _proto.handleTechTap_ = function handleTechTap_() {\n this.userActive(!this.userActive());\n }\n /**\n * Handle touch to start\n *\n * @listens Tech#touchstart\n * @private\n */\n ;\n\n _proto.handleTechTouchStart_ = function handleTechTouchStart_() {\n this.userWasActive = this.userActive();\n }\n /**\n * Handle touch to move\n *\n * @listens Tech#touchmove\n * @private\n */\n ;\n\n _proto.handleTechTouchMove_ = function handleTechTouchMove_() {\n if (this.userWasActive) {\n this.reportUserActivity();\n }\n }\n /**\n * Handle touch to end\n *\n * @param {EventTarget~Event} event\n * the touchend event that triggered\n * this function\n *\n * @listens Tech#touchend\n * @private\n */\n ;\n\n _proto.handleTechTouchEnd_ = function handleTechTouchEnd_(event) {\n // Stop the mouse events from also happening\n if (event.cancelable) {\n event.preventDefault();\n }\n }\n /**\n * native click events on the SWF aren't triggered on IE11, Win8.1RT\n * use stageclick events triggered from inside the SWF instead\n *\n * @private\n * @listens stageclick\n */\n ;\n\n _proto.handleStageClick_ = function handleStageClick_() {\n this.reportUserActivity();\n }\n /**\n * @private\n */\n ;\n\n _proto.toggleFullscreenClass_ = function toggleFullscreenClass_() {\n if (this.isFullscreen()) {\n this.addClass('vjs-fullscreen');\n } else {\n this.removeClass('vjs-fullscreen');\n }\n }\n /**\n * when the document fschange event triggers it calls this\n */\n ;\n\n _proto.documentFullscreenChange_ = function documentFullscreenChange_(e) {\n var targetPlayer = e.target.player; // if another player was fullscreen\n // do a null check for targetPlayer because older firefox's would put document as e.target\n\n if (targetPlayer && targetPlayer !== this) {\n return;\n }\n\n var el = this.el();\n var isFs = (global_document__WEBPACK_IMPORTED_MODULE_1___default())[this.fsApi_.fullscreenElement] === el;\n\n if (!isFs && el.matches) {\n isFs = el.matches(':' + this.fsApi_.fullscreen);\n } else if (!isFs && el.msMatchesSelector) {\n isFs = el.msMatchesSelector(':' + this.fsApi_.fullscreen);\n }\n\n this.isFullscreen(isFs);\n }\n /**\n * Handle Tech Fullscreen Change\n *\n * @param {EventTarget~Event} event\n * the fullscreenchange event that triggered this function\n *\n * @param {Object} data\n * the data that was sent with the event\n *\n * @private\n * @listens Tech#fullscreenchange\n * @fires Player#fullscreenchange\n */\n ;\n\n _proto.handleTechFullscreenChange_ = function handleTechFullscreenChange_(event, data) {\n var _this9 = this;\n\n if (data) {\n if (data.nativeIOSFullscreen) {\n this.addClass('vjs-ios-native-fs');\n this.tech_.one('webkitendfullscreen', function () {\n _this9.removeClass('vjs-ios-native-fs');\n });\n }\n\n this.isFullscreen(data.isFullscreen);\n }\n };\n\n _proto.handleTechFullscreenError_ = function handleTechFullscreenError_(event, err) {\n this.trigger('fullscreenerror', err);\n }\n /**\n * @private\n */\n ;\n\n _proto.togglePictureInPictureClass_ = function togglePictureInPictureClass_() {\n if (this.isInPictureInPicture()) {\n this.addClass('vjs-picture-in-picture');\n } else {\n this.removeClass('vjs-picture-in-picture');\n }\n }\n /**\n * Handle Tech Enter Picture-in-Picture.\n *\n * @param {EventTarget~Event} event\n * the enterpictureinpicture event that triggered this function\n *\n * @private\n * @listens Tech#enterpictureinpicture\n */\n ;\n\n _proto.handleTechEnterPictureInPicture_ = function handleTechEnterPictureInPicture_(event) {\n this.isInPictureInPicture(true);\n }\n /**\n * Handle Tech Leave Picture-in-Picture.\n *\n * @param {EventTarget~Event} event\n * the leavepictureinpicture event that triggered this function\n *\n * @private\n * @listens Tech#leavepictureinpicture\n */\n ;\n\n _proto.handleTechLeavePictureInPicture_ = function handleTechLeavePictureInPicture_(event) {\n this.isInPictureInPicture(false);\n }\n /**\n * Fires when an error occurred during the loading of an audio/video.\n *\n * @private\n * @listens Tech#error\n */\n ;\n\n _proto.handleTechError_ = function handleTechError_() {\n var error = this.tech_.error();\n this.error(error);\n }\n /**\n * Retrigger the `textdata` event that was triggered by the {@link Tech}.\n *\n * @fires Player#textdata\n * @listens Tech#textdata\n * @private\n */\n ;\n\n _proto.handleTechTextData_ = function handleTechTextData_() {\n var data = null;\n\n if (arguments.length > 1) {\n data = arguments[1];\n }\n /**\n * Fires when we get a textdata event from tech\n *\n * @event Player#textdata\n * @type {EventTarget~Event}\n */\n\n\n this.trigger('textdata', data);\n }\n /**\n * Get object for cached values.\n *\n * @return {Object}\n * get the current object cache\n */\n ;\n\n _proto.getCache = function getCache() {\n return this.cache_;\n }\n /**\n * Resets the internal cache object.\n *\n * Using this function outside the player constructor or reset method may\n * have unintended side-effects.\n *\n * @private\n */\n ;\n\n _proto.resetCache_ = function resetCache_() {\n this.cache_ = {\n // Right now, the currentTime is not _really_ cached because it is always\n // retrieved from the tech (see: currentTime). However, for completeness,\n // we set it to zero here to ensure that if we do start actually caching\n // it, we reset it along with everything else.\n currentTime: 0,\n initTime: 0,\n inactivityTimeout: this.options_.inactivityTimeout,\n duration: NaN,\n lastVolume: 1,\n lastPlaybackRate: this.defaultPlaybackRate(),\n media: null,\n src: '',\n source: {},\n sources: [],\n playbackRates: [],\n volume: 1\n };\n }\n /**\n * Pass values to the playback tech\n *\n * @param {string} [method]\n * the method to call\n *\n * @param {Object} arg\n * the argument to pass\n *\n * @private\n */\n ;\n\n _proto.techCall_ = function techCall_(method, arg) {\n // If it's not ready yet, call method when it is\n this.ready(function () {\n if (method in allowedSetters) {\n return set(this.middleware_, this.tech_, method, arg);\n } else if (method in allowedMediators) {\n return mediate(this.middleware_, this.tech_, method, arg);\n }\n\n try {\n if (this.tech_) {\n this.tech_[method](arg);\n }\n } catch (e) {\n log$1(e);\n throw e;\n }\n }, true);\n }\n /**\n * Get calls can't wait for the tech, and sometimes don't need to.\n *\n * @param {string} method\n * Tech method\n *\n * @return {Function|undefined}\n * the method or undefined\n *\n * @private\n */\n ;\n\n _proto.techGet_ = function techGet_(method) {\n if (!this.tech_ || !this.tech_.isReady_) {\n return;\n }\n\n if (method in allowedGetters) {\n return get(this.middleware_, this.tech_, method);\n } else if (method in allowedMediators) {\n return mediate(this.middleware_, this.tech_, method);\n } // Flash likes to die and reload when you hide or reposition it.\n // In these cases the object methods go away and we get errors.\n // TODO: Is this needed for techs other than Flash?\n // When that happens we'll catch the errors and inform tech that it's not ready any more.\n\n\n try {\n return this.tech_[method]();\n } catch (e) {\n // When building additional tech libs, an expected method may not be defined yet\n if (this.tech_[method] === undefined) {\n log$1(\"Video.js: \" + method + \" method not defined for \" + this.techName_ + \" playback technology.\", e);\n throw e;\n } // When a method isn't available on the object it throws a TypeError\n\n\n if (e.name === 'TypeError') {\n log$1(\"Video.js: \" + method + \" unavailable on \" + this.techName_ + \" playback technology element.\", e);\n this.tech_.isReady_ = false;\n throw e;\n } // If error unknown, just log and throw\n\n\n log$1(e);\n throw e;\n }\n }\n /**\n * Attempt to begin playback at the first opportunity.\n *\n * @return {Promise|undefined}\n * Returns a promise if the browser supports Promises (or one\n * was passed in as an option). This promise will be resolved on\n * the return value of play. If this is undefined it will fulfill the\n * promise chain otherwise the promise chain will be fulfilled when\n * the promise from play is fulfilled.\n */\n ;\n\n _proto.play = function play() {\n var _this10 = this;\n\n var PromiseClass = this.options_.Promise || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Promise);\n\n if (PromiseClass) {\n return new PromiseClass(function (resolve) {\n _this10.play_(resolve);\n });\n }\n\n return this.play_();\n }\n /**\n * The actual logic for play, takes a callback that will be resolved on the\n * return value of play. This allows us to resolve to the play promise if there\n * is one on modern browsers.\n *\n * @private\n * @param {Function} [callback]\n * The callback that should be called when the techs play is actually called\n */\n ;\n\n _proto.play_ = function play_(callback) {\n var _this11 = this;\n\n if (callback === void 0) {\n callback = silencePromise;\n }\n\n this.playCallbacks_.push(callback);\n var isSrcReady = Boolean(!this.changingSrc_ && (this.src() || this.currentSrc()));\n var isSafariOrIOS = Boolean(IS_ANY_SAFARI || IS_IOS); // treat calls to play_ somewhat like the `one` event function\n\n if (this.waitToPlay_) {\n this.off(['ready', 'loadstart'], this.waitToPlay_);\n this.waitToPlay_ = null;\n } // if the player/tech is not ready or the src itself is not ready\n // queue up a call to play on `ready` or `loadstart`\n\n\n if (!this.isReady_ || !isSrcReady) {\n this.waitToPlay_ = function (e) {\n _this11.play_();\n };\n\n this.one(['ready', 'loadstart'], this.waitToPlay_); // if we are in Safari, there is a high chance that loadstart will trigger after the gesture timeperiod\n // in that case, we need to prime the video element by calling load so it'll be ready in time\n\n if (!isSrcReady && isSafariOrIOS) {\n this.load();\n }\n\n return;\n } // If the player/tech is ready and we have a source, we can attempt playback.\n\n\n var val = this.techGet_('play'); // For native playback, reset the progress bar if we get a play call from a replay.\n\n var isNativeReplay = isSafariOrIOS && this.hasClass('vjs-ended');\n\n if (isNativeReplay) {\n this.resetProgressBar_();\n } // play was terminated if the returned value is null\n\n\n if (val === null) {\n this.runPlayTerminatedQueue_();\n } else {\n this.runPlayCallbacks_(val);\n }\n }\n /**\n * These functions will be run when if play is terminated. If play\n * runPlayCallbacks_ is run these function will not be run. This allows us\n * to differenciate between a terminated play and an actual call to play.\n */\n ;\n\n _proto.runPlayTerminatedQueue_ = function runPlayTerminatedQueue_() {\n var queue = this.playTerminatedQueue_.slice(0);\n this.playTerminatedQueue_ = [];\n queue.forEach(function (q) {\n q();\n });\n }\n /**\n * When a callback to play is delayed we have to run these\n * callbacks when play is actually called on the tech. This function\n * runs the callbacks that were delayed and accepts the return value\n * from the tech.\n *\n * @param {undefined|Promise} val\n * The return value from the tech.\n */\n ;\n\n _proto.runPlayCallbacks_ = function runPlayCallbacks_(val) {\n var callbacks = this.playCallbacks_.slice(0);\n this.playCallbacks_ = []; // clear play terminatedQueue since we finished a real play\n\n this.playTerminatedQueue_ = [];\n callbacks.forEach(function (cb) {\n cb(val);\n });\n }\n /**\n * Pause the video playback\n *\n * @return {Player}\n * A reference to the player object this function was called on\n */\n ;\n\n _proto.pause = function pause() {\n this.techCall_('pause');\n }\n /**\n * Check if the player is paused or has yet to play\n *\n * @return {boolean}\n * - false: if the media is currently playing\n * - true: if media is not currently playing\n */\n ;\n\n _proto.paused = function paused() {\n // The initial state of paused should be true (in Safari it's actually false)\n return this.techGet_('paused') === false ? false : true;\n }\n /**\n * Get a TimeRange object representing the current ranges of time that the user\n * has played.\n *\n * @return {TimeRange}\n * A time range object that represents all the increments of time that have\n * been played.\n */\n ;\n\n _proto.played = function played() {\n return this.techGet_('played') || createTimeRanges(0, 0);\n }\n /**\n * Returns whether or not the user is \"scrubbing\". Scrubbing is\n * when the user has clicked the progress bar handle and is\n * dragging it along the progress bar.\n *\n * @param {boolean} [isScrubbing]\n * whether the user is or is not scrubbing\n *\n * @return {boolean}\n * The value of scrubbing when getting\n */\n ;\n\n _proto.scrubbing = function scrubbing(isScrubbing) {\n if (typeof isScrubbing === 'undefined') {\n return this.scrubbing_;\n }\n\n this.scrubbing_ = !!isScrubbing;\n this.techCall_('setScrubbing', this.scrubbing_);\n\n if (isScrubbing) {\n this.addClass('vjs-scrubbing');\n } else {\n this.removeClass('vjs-scrubbing');\n }\n }\n /**\n * Get or set the current time (in seconds)\n *\n * @param {number|string} [seconds]\n * The time to seek to in seconds\n *\n * @return {number}\n * - the current time in seconds when getting\n */\n ;\n\n _proto.currentTime = function currentTime(seconds) {\n if (typeof seconds !== 'undefined') {\n if (seconds < 0) {\n seconds = 0;\n }\n\n if (!this.isReady_ || this.changingSrc_ || !this.tech_ || !this.tech_.isReady_) {\n this.cache_.initTime = seconds;\n this.off('canplay', this.boundApplyInitTime_);\n this.one('canplay', this.boundApplyInitTime_);\n return;\n }\n\n this.techCall_('setCurrentTime', seconds);\n this.cache_.initTime = 0;\n return;\n } // cache last currentTime and return. default to 0 seconds\n //\n // Caching the currentTime is meant to prevent a massive amount of reads on the tech's\n // currentTime when scrubbing, but may not provide much performance benefit afterall.\n // Should be tested. Also something has to read the actual current time or the cache will\n // never get updated.\n\n\n this.cache_.currentTime = this.techGet_('currentTime') || 0;\n return this.cache_.currentTime;\n }\n /**\n * Apply the value of initTime stored in cache as currentTime.\n *\n * @private\n */\n ;\n\n _proto.applyInitTime_ = function applyInitTime_() {\n this.currentTime(this.cache_.initTime);\n }\n /**\n * Normally gets the length in time of the video in seconds;\n * in all but the rarest use cases an argument will NOT be passed to the method\n *\n * > **NOTE**: The video must have started loading before the duration can be\n * known, and depending on preload behaviour may not be known until the video starts\n * playing.\n *\n * @fires Player#durationchange\n *\n * @param {number} [seconds]\n * The duration of the video to set in seconds\n *\n * @return {number}\n * - The duration of the video in seconds when getting\n */\n ;\n\n _proto.duration = function duration(seconds) {\n if (seconds === undefined) {\n // return NaN if the duration is not known\n return this.cache_.duration !== undefined ? this.cache_.duration : NaN;\n }\n\n seconds = parseFloat(seconds); // Standardize on Infinity for signaling video is live\n\n if (seconds < 0) {\n seconds = Infinity;\n }\n\n if (seconds !== this.cache_.duration) {\n // Cache the last set value for optimized scrubbing (esp. Flash)\n // TODO: Required for techs other than Flash?\n this.cache_.duration = seconds;\n\n if (seconds === Infinity) {\n this.addClass('vjs-live');\n } else {\n this.removeClass('vjs-live');\n }\n\n if (!isNaN(seconds)) {\n // Do not fire durationchange unless the duration value is known.\n // @see [Spec]{@link https://www.w3.org/TR/2011/WD-html5-20110113/video.html#media-element-load-algorithm}\n\n /**\n * @event Player#durationchange\n * @type {EventTarget~Event}\n */\n this.trigger('durationchange');\n }\n }\n }\n /**\n * Calculates how much time is left in the video. Not part\n * of the native video API.\n *\n * @return {number}\n * The time remaining in seconds\n */\n ;\n\n _proto.remainingTime = function remainingTime() {\n return this.duration() - this.currentTime();\n }\n /**\n * A remaining time function that is intented to be used when\n * the time is to be displayed directly to the user.\n *\n * @return {number}\n * The rounded time remaining in seconds\n */\n ;\n\n _proto.remainingTimeDisplay = function remainingTimeDisplay() {\n return Math.floor(this.duration()) - Math.floor(this.currentTime());\n } //\n // Kind of like an array of portions of the video that have been downloaded.\n\n /**\n * Get a TimeRange object with an array of the times of the video\n * that have been downloaded. If you just want the percent of the\n * video that's been downloaded, use bufferedPercent.\n *\n * @see [Buffered Spec]{@link http://dev.w3.org/html5/spec/video.html#dom-media-buffered}\n *\n * @return {TimeRange}\n * A mock TimeRange object (following HTML spec)\n */\n ;\n\n _proto.buffered = function buffered() {\n var buffered = this.techGet_('buffered');\n\n if (!buffered || !buffered.length) {\n buffered = createTimeRanges(0, 0);\n }\n\n return buffered;\n }\n /**\n * Get the percent (as a decimal) of the video that's been downloaded.\n * This method is not a part of the native HTML video API.\n *\n * @return {number}\n * A decimal between 0 and 1 representing the percent\n * that is buffered 0 being 0% and 1 being 100%\n */\n ;\n\n _proto.bufferedPercent = function bufferedPercent$1() {\n return bufferedPercent(this.buffered(), this.duration());\n }\n /**\n * Get the ending time of the last buffered time range\n * This is used in the progress bar to encapsulate all time ranges.\n *\n * @return {number}\n * The end of the last buffered time range\n */\n ;\n\n _proto.bufferedEnd = function bufferedEnd() {\n var buffered = this.buffered();\n var duration = this.duration();\n var end = buffered.end(buffered.length - 1);\n\n if (end > duration) {\n end = duration;\n }\n\n return end;\n }\n /**\n * Get or set the current volume of the media\n *\n * @param {number} [percentAsDecimal]\n * The new volume as a decimal percent:\n * - 0 is muted/0%/off\n * - 1.0 is 100%/full\n * - 0.5 is half volume or 50%\n *\n * @return {number}\n * The current volume as a percent when getting\n */\n ;\n\n _proto.volume = function volume(percentAsDecimal) {\n var vol;\n\n if (percentAsDecimal !== undefined) {\n // Force value to between 0 and 1\n vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal)));\n this.cache_.volume = vol;\n this.techCall_('setVolume', vol);\n\n if (vol > 0) {\n this.lastVolume_(vol);\n }\n\n return;\n } // Default to 1 when returning current volume.\n\n\n vol = parseFloat(this.techGet_('volume'));\n return isNaN(vol) ? 1 : vol;\n }\n /**\n * Get the current muted state, or turn mute on or off\n *\n * @param {boolean} [muted]\n * - true to mute\n * - false to unmute\n *\n * @return {boolean}\n * - true if mute is on and getting\n * - false if mute is off and getting\n */\n ;\n\n _proto.muted = function muted(_muted) {\n if (_muted !== undefined) {\n this.techCall_('setMuted', _muted);\n return;\n }\n\n return this.techGet_('muted') || false;\n }\n /**\n * Get the current defaultMuted state, or turn defaultMuted on or off. defaultMuted\n * indicates the state of muted on initial playback.\n *\n * ```js\n * var myPlayer = videojs('some-player-id');\n *\n * myPlayer.src(\"http://www.example.com/path/to/video.mp4\");\n *\n * // get, should be false\n * console.log(myPlayer.defaultMuted());\n * // set to true\n * myPlayer.defaultMuted(true);\n * // get should be true\n * console.log(myPlayer.defaultMuted());\n * ```\n *\n * @param {boolean} [defaultMuted]\n * - true to mute\n * - false to unmute\n *\n * @return {boolean|Player}\n * - true if defaultMuted is on and getting\n * - false if defaultMuted is off and getting\n * - A reference to the current player when setting\n */\n ;\n\n _proto.defaultMuted = function defaultMuted(_defaultMuted) {\n if (_defaultMuted !== undefined) {\n return this.techCall_('setDefaultMuted', _defaultMuted);\n }\n\n return this.techGet_('defaultMuted') || false;\n }\n /**\n * Get the last volume, or set it\n *\n * @param {number} [percentAsDecimal]\n * The new last volume as a decimal percent:\n * - 0 is muted/0%/off\n * - 1.0 is 100%/full\n * - 0.5 is half volume or 50%\n *\n * @return {number}\n * the current value of lastVolume as a percent when getting\n *\n * @private\n */\n ;\n\n _proto.lastVolume_ = function lastVolume_(percentAsDecimal) {\n if (percentAsDecimal !== undefined && percentAsDecimal !== 0) {\n this.cache_.lastVolume = percentAsDecimal;\n return;\n }\n\n return this.cache_.lastVolume;\n }\n /**\n * Check if current tech can support native fullscreen\n * (e.g. with built in controls like iOS)\n *\n * @return {boolean}\n * if native fullscreen is supported\n */\n ;\n\n _proto.supportsFullScreen = function supportsFullScreen() {\n return this.techGet_('supportsFullScreen') || false;\n }\n /**\n * Check if the player is in fullscreen mode or tell the player that it\n * is or is not in fullscreen mode.\n *\n * > NOTE: As of the latest HTML5 spec, isFullscreen is no longer an official\n * property and instead document.fullscreenElement is used. But isFullscreen is\n * still a valuable property for internal player workings.\n *\n * @param {boolean} [isFS]\n * Set the players current fullscreen state\n *\n * @return {boolean}\n * - true if fullscreen is on and getting\n * - false if fullscreen is off and getting\n */\n ;\n\n _proto.isFullscreen = function isFullscreen(isFS) {\n if (isFS !== undefined) {\n var oldValue = this.isFullscreen_;\n this.isFullscreen_ = Boolean(isFS); // if we changed fullscreen state and we're in prefixed mode, trigger fullscreenchange\n // this is the only place where we trigger fullscreenchange events for older browsers\n // fullWindow mode is treated as a prefixed event and will get a fullscreenchange event as well\n\n if (this.isFullscreen_ !== oldValue && this.fsApi_.prefixed) {\n /**\n * @event Player#fullscreenchange\n * @type {EventTarget~Event}\n */\n this.trigger('fullscreenchange');\n }\n\n this.toggleFullscreenClass_();\n return;\n }\n\n return this.isFullscreen_;\n }\n /**\n * Increase the size of the video to full screen\n * In some browsers, full screen is not supported natively, so it enters\n * \"full window mode\", where the video fills the browser window.\n * In browsers and devices that support native full screen, sometimes the\n * browser's default controls will be shown, and not the Video.js custom skin.\n * This includes most mobile devices (iOS, Android) and older versions of\n * Safari.\n *\n * @param {Object} [fullscreenOptions]\n * Override the player fullscreen options\n *\n * @fires Player#fullscreenchange\n */\n ;\n\n _proto.requestFullscreen = function requestFullscreen(fullscreenOptions) {\n var PromiseClass = this.options_.Promise || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Promise);\n\n if (PromiseClass) {\n var self = this;\n return new PromiseClass(function (resolve, reject) {\n function offHandler() {\n self.off('fullscreenerror', errorHandler);\n self.off('fullscreenchange', changeHandler);\n }\n\n function changeHandler() {\n offHandler();\n resolve();\n }\n\n function errorHandler(e, err) {\n offHandler();\n reject(err);\n }\n\n self.one('fullscreenchange', changeHandler);\n self.one('fullscreenerror', errorHandler);\n var promise = self.requestFullscreenHelper_(fullscreenOptions);\n\n if (promise) {\n promise.then(offHandler, offHandler);\n promise.then(resolve, reject);\n }\n });\n }\n\n return this.requestFullscreenHelper_();\n };\n\n _proto.requestFullscreenHelper_ = function requestFullscreenHelper_(fullscreenOptions) {\n var _this12 = this;\n\n var fsOptions; // Only pass fullscreen options to requestFullscreen in spec-compliant browsers.\n // Use defaults or player configured option unless passed directly to this method.\n\n if (!this.fsApi_.prefixed) {\n fsOptions = this.options_.fullscreen && this.options_.fullscreen.options || {};\n\n if (fullscreenOptions !== undefined) {\n fsOptions = fullscreenOptions;\n }\n } // This method works as follows:\n // 1. if a fullscreen api is available, use it\n // 1. call requestFullscreen with potential options\n // 2. if we got a promise from above, use it to update isFullscreen()\n // 2. otherwise, if the tech supports fullscreen, call `enterFullScreen` on it.\n // This is particularly used for iPhone, older iPads, and non-safari browser on iOS.\n // 3. otherwise, use \"fullWindow\" mode\n\n\n if (this.fsApi_.requestFullscreen) {\n var promise = this.el_[this.fsApi_.requestFullscreen](fsOptions);\n\n if (promise) {\n promise.then(function () {\n return _this12.isFullscreen(true);\n }, function () {\n return _this12.isFullscreen(false);\n });\n }\n\n return promise;\n } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {\n // we can't take the video.js controls fullscreen but we can go fullscreen\n // with native controls\n this.techCall_('enterFullScreen');\n } else {\n // fullscreen isn't supported so we'll just stretch the video element to\n // fill the viewport\n this.enterFullWindow();\n }\n }\n /**\n * Return the video to its normal size after having been in full screen mode\n *\n * @fires Player#fullscreenchange\n */\n ;\n\n _proto.exitFullscreen = function exitFullscreen() {\n var PromiseClass = this.options_.Promise || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Promise);\n\n if (PromiseClass) {\n var self = this;\n return new PromiseClass(function (resolve, reject) {\n function offHandler() {\n self.off('fullscreenerror', errorHandler);\n self.off('fullscreenchange', changeHandler);\n }\n\n function changeHandler() {\n offHandler();\n resolve();\n }\n\n function errorHandler(e, err) {\n offHandler();\n reject(err);\n }\n\n self.one('fullscreenchange', changeHandler);\n self.one('fullscreenerror', errorHandler);\n var promise = self.exitFullscreenHelper_();\n\n if (promise) {\n promise.then(offHandler, offHandler); // map the promise to our resolve/reject methods\n\n promise.then(resolve, reject);\n }\n });\n }\n\n return this.exitFullscreenHelper_();\n };\n\n _proto.exitFullscreenHelper_ = function exitFullscreenHelper_() {\n var _this13 = this;\n\n if (this.fsApi_.requestFullscreen) {\n var promise = (global_document__WEBPACK_IMPORTED_MODULE_1___default())[this.fsApi_.exitFullscreen]();\n\n if (promise) {\n // we're splitting the promise here, so, we want to catch the\n // potential error so that this chain doesn't have unhandled errors\n silencePromise(promise.then(function () {\n return _this13.isFullscreen(false);\n }));\n }\n\n return promise;\n } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {\n this.techCall_('exitFullScreen');\n } else {\n this.exitFullWindow();\n }\n }\n /**\n * When fullscreen isn't supported we can stretch the\n * video container to as wide as the browser will let us.\n *\n * @fires Player#enterFullWindow\n */\n ;\n\n _proto.enterFullWindow = function enterFullWindow() {\n this.isFullscreen(true);\n this.isFullWindow = true; // Storing original doc overflow value to return to when fullscreen is off\n\n this.docOrigOverflow = (global_document__WEBPACK_IMPORTED_MODULE_1___default().documentElement).style.overflow; // Add listener for esc key to exit fullscreen\n\n on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keydown', this.boundFullWindowOnEscKey_); // Hide any scroll bars\n\n (global_document__WEBPACK_IMPORTED_MODULE_1___default().documentElement).style.overflow = 'hidden'; // Apply fullscreen styles\n\n addClass((global_document__WEBPACK_IMPORTED_MODULE_1___default().body), 'vjs-full-window');\n /**\n * @event Player#enterFullWindow\n * @type {EventTarget~Event}\n */\n\n this.trigger('enterFullWindow');\n }\n /**\n * Check for call to either exit full window or\n * full screen on ESC key\n *\n * @param {string} event\n * Event to check for key press\n */\n ;\n\n _proto.fullWindowOnEscKey = function fullWindowOnEscKey(event) {\n if (keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(event, 'Esc')) {\n if (this.isFullscreen() === true) {\n if (!this.isFullWindow) {\n this.exitFullscreen();\n } else {\n this.exitFullWindow();\n }\n }\n }\n }\n /**\n * Exit full window\n *\n * @fires Player#exitFullWindow\n */\n ;\n\n _proto.exitFullWindow = function exitFullWindow() {\n this.isFullscreen(false);\n this.isFullWindow = false;\n off((global_document__WEBPACK_IMPORTED_MODULE_1___default()), 'keydown', this.boundFullWindowOnEscKey_); // Unhide scroll bars.\n\n (global_document__WEBPACK_IMPORTED_MODULE_1___default().documentElement).style.overflow = this.docOrigOverflow; // Remove fullscreen styles\n\n removeClass((global_document__WEBPACK_IMPORTED_MODULE_1___default().body), 'vjs-full-window'); // Resize the box, controller, and poster to original sizes\n // this.positionAll();\n\n /**\n * @event Player#exitFullWindow\n * @type {EventTarget~Event}\n */\n\n this.trigger('exitFullWindow');\n }\n /**\n * Disable Picture-in-Picture mode.\n *\n * @param {boolean} value\n * - true will disable Picture-in-Picture mode\n * - false will enable Picture-in-Picture mode\n */\n ;\n\n _proto.disablePictureInPicture = function disablePictureInPicture(value) {\n if (value === undefined) {\n return this.techGet_('disablePictureInPicture');\n }\n\n this.techCall_('setDisablePictureInPicture', value);\n this.options_.disablePictureInPicture = value;\n this.trigger('disablepictureinpicturechanged');\n }\n /**\n * Check if the player is in Picture-in-Picture mode or tell the player that it\n * is or is not in Picture-in-Picture mode.\n *\n * @param {boolean} [isPiP]\n * Set the players current Picture-in-Picture state\n *\n * @return {boolean}\n * - true if Picture-in-Picture is on and getting\n * - false if Picture-in-Picture is off and getting\n */\n ;\n\n _proto.isInPictureInPicture = function isInPictureInPicture(isPiP) {\n if (isPiP !== undefined) {\n this.isInPictureInPicture_ = !!isPiP;\n this.togglePictureInPictureClass_();\n return;\n }\n\n return !!this.isInPictureInPicture_;\n }\n /**\n * Create a floating video window always on top of other windows so that users may\n * continue consuming media while they interact with other content sites, or\n * applications on their device.\n *\n * @see [Spec]{@link https://wicg.github.io/picture-in-picture}\n *\n * @fires Player#enterpictureinpicture\n *\n * @return {Promise}\n * A promise with a Picture-in-Picture window.\n */\n ;\n\n _proto.requestPictureInPicture = function requestPictureInPicture() {\n if (\"pictureInPictureEnabled\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default()) && this.disablePictureInPicture() === false) {\n /**\n * This event fires when the player enters picture in picture mode\n *\n * @event Player#enterpictureinpicture\n * @type {EventTarget~Event}\n */\n return this.techGet_('requestPictureInPicture');\n }\n }\n /**\n * Exit Picture-in-Picture mode.\n *\n * @see [Spec]{@link https://wicg.github.io/picture-in-picture}\n *\n * @fires Player#leavepictureinpicture\n *\n * @return {Promise}\n * A promise.\n */\n ;\n\n _proto.exitPictureInPicture = function exitPictureInPicture() {\n if (\"pictureInPictureEnabled\" in (global_document__WEBPACK_IMPORTED_MODULE_1___default())) {\n /**\n * This event fires when the player leaves picture in picture mode\n *\n * @event Player#leavepictureinpicture\n * @type {EventTarget~Event}\n */\n return global_document__WEBPACK_IMPORTED_MODULE_1___default().exitPictureInPicture();\n }\n }\n /**\n * Called when this Player has focus and a key gets pressed down, or when\n * any Component of this player receives a key press that it doesn't handle.\n * This allows player-wide hotkeys (either as defined below, or optionally\n * by an external function).\n *\n * @param {EventTarget~Event} event\n * The `keydown` event that caused this function to be called.\n *\n * @listens keydown\n */\n ;\n\n _proto.handleKeyDown = function handleKeyDown(event) {\n var userActions = this.options_.userActions; // Bail out if hotkeys are not configured.\n\n if (!userActions || !userActions.hotkeys) {\n return;\n } // Function that determines whether or not to exclude an element from\n // hotkeys handling.\n\n\n var excludeElement = function excludeElement(el) {\n var tagName = el.tagName.toLowerCase(); // The first and easiest test is for `contenteditable` elements.\n\n if (el.isContentEditable) {\n return true;\n } // Inputs matching these types will still trigger hotkey handling as\n // they are not text inputs.\n\n\n var allowedInputTypes = ['button', 'checkbox', 'hidden', 'radio', 'reset', 'submit'];\n\n if (tagName === 'input') {\n return allowedInputTypes.indexOf(el.type) === -1;\n } // The final test is by tag name. These tags will be excluded entirely.\n\n\n var excludedTags = ['textarea'];\n return excludedTags.indexOf(tagName) !== -1;\n }; // Bail out if the user is focused on an interactive form element.\n\n\n if (excludeElement(this.el_.ownerDocument.activeElement)) {\n return;\n }\n\n if (typeof userActions.hotkeys === 'function') {\n userActions.hotkeys.call(this, event);\n } else {\n this.handleHotkeys(event);\n }\n }\n /**\n * Called when this Player receives a hotkey keydown event.\n * Supported player-wide hotkeys are:\n *\n * f - toggle fullscreen\n * m - toggle mute\n * k or Space - toggle play/pause\n *\n * @param {EventTarget~Event} event\n * The `keydown` event that caused this function to be called.\n */\n ;\n\n _proto.handleHotkeys = function handleHotkeys(event) {\n var hotkeys = this.options_.userActions ? this.options_.userActions.hotkeys : {}; // set fullscreenKey, muteKey, playPauseKey from `hotkeys`, use defaults if not set\n\n var _hotkeys$fullscreenKe = hotkeys.fullscreenKey,\n fullscreenKey = _hotkeys$fullscreenKe === void 0 ? function (keydownEvent) {\n return keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(keydownEvent, 'f');\n } : _hotkeys$fullscreenKe,\n _hotkeys$muteKey = hotkeys.muteKey,\n muteKey = _hotkeys$muteKey === void 0 ? function (keydownEvent) {\n return keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(keydownEvent, 'm');\n } : _hotkeys$muteKey,\n _hotkeys$playPauseKey = hotkeys.playPauseKey,\n playPauseKey = _hotkeys$playPauseKey === void 0 ? function (keydownEvent) {\n return keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(keydownEvent, 'k') || keycode__WEBPACK_IMPORTED_MODULE_3___default().isEventKey(keydownEvent, 'Space');\n } : _hotkeys$playPauseKey;\n\n if (fullscreenKey.call(this, event)) {\n event.preventDefault();\n event.stopPropagation();\n var FSToggle = Component$1.getComponent('FullscreenToggle');\n\n if ((global_document__WEBPACK_IMPORTED_MODULE_1___default())[this.fsApi_.fullscreenEnabled] !== false) {\n FSToggle.prototype.handleClick.call(this, event);\n }\n } else if (muteKey.call(this, event)) {\n event.preventDefault();\n event.stopPropagation();\n var MuteToggle = Component$1.getComponent('MuteToggle');\n MuteToggle.prototype.handleClick.call(this, event);\n } else if (playPauseKey.call(this, event)) {\n event.preventDefault();\n event.stopPropagation();\n var PlayToggle = Component$1.getComponent('PlayToggle');\n PlayToggle.prototype.handleClick.call(this, event);\n }\n }\n /**\n * Check whether the player can play a given mimetype\n *\n * @see https://www.w3.org/TR/2011/WD-html5-20110113/video.html#dom-navigator-canplaytype\n *\n * @param {string} type\n * The mimetype to check\n *\n * @return {string}\n * 'probably', 'maybe', or '' (empty string)\n */\n ;\n\n _proto.canPlayType = function canPlayType(type) {\n var can; // Loop through each playback technology in the options order\n\n for (var i = 0, j = this.options_.techOrder; i < j.length; i++) {\n var techName = j[i];\n var tech = Tech.getTech(techName); // Support old behavior of techs being registered as components.\n // Remove once that deprecated behavior is removed.\n\n if (!tech) {\n tech = Component$1.getComponent(techName);\n } // Check if the current tech is defined before continuing\n\n\n if (!tech) {\n log$1.error(\"The \\\"\" + techName + \"\\\" tech is undefined. Skipped browser support check for that tech.\");\n continue;\n } // Check if the browser supports this technology\n\n\n if (tech.isSupported()) {\n can = tech.canPlayType(type);\n\n if (can) {\n return can;\n }\n }\n }\n\n return '';\n }\n /**\n * Select source based on tech-order or source-order\n * Uses source-order selection if `options.sourceOrder` is truthy. Otherwise,\n * defaults to tech-order selection\n *\n * @param {Array} sources\n * The sources for a media asset\n *\n * @return {Object|boolean}\n * Object of source and tech order or false\n */\n ;\n\n _proto.selectSource = function selectSource(sources) {\n var _this14 = this;\n\n // Get only the techs specified in `techOrder` that exist and are supported by the\n // current platform\n var techs = this.options_.techOrder.map(function (techName) {\n return [techName, Tech.getTech(techName)];\n }).filter(function (_ref) {\n var techName = _ref[0],\n tech = _ref[1];\n\n // Check if the current tech is defined before continuing\n if (tech) {\n // Check if the browser supports this technology\n return tech.isSupported();\n }\n\n log$1.error(\"The \\\"\" + techName + \"\\\" tech is undefined. Skipped browser support check for that tech.\");\n return false;\n }); // Iterate over each `innerArray` element once per `outerArray` element and execute\n // `tester` with both. If `tester` returns a non-falsy value, exit early and return\n // that value.\n\n var findFirstPassingTechSourcePair = function findFirstPassingTechSourcePair(outerArray, innerArray, tester) {\n var found;\n outerArray.some(function (outerChoice) {\n return innerArray.some(function (innerChoice) {\n found = tester(outerChoice, innerChoice);\n\n if (found) {\n return true;\n }\n });\n });\n return found;\n };\n\n var foundSourceAndTech;\n\n var flip = function flip(fn) {\n return function (a, b) {\n return fn(b, a);\n };\n };\n\n var finder = function finder(_ref2, source) {\n var techName = _ref2[0],\n tech = _ref2[1];\n\n if (tech.canPlaySource(source, _this14.options_[techName.toLowerCase()])) {\n return {\n source: source,\n tech: techName\n };\n }\n }; // Depending on the truthiness of `options.sourceOrder`, we swap the order of techs and sources\n // to select from them based on their priority.\n\n\n if (this.options_.sourceOrder) {\n // Source-first ordering\n foundSourceAndTech = findFirstPassingTechSourcePair(sources, techs, flip(finder));\n } else {\n // Tech-first ordering\n foundSourceAndTech = findFirstPassingTechSourcePair(techs, sources, finder);\n }\n\n return foundSourceAndTech || false;\n }\n /**\n * Executes source setting and getting logic\n *\n * @param {Tech~SourceObject|Tech~SourceObject[]|string} [source]\n * A SourceObject, an array of SourceObjects, or a string referencing\n * a URL to a media source. It is _highly recommended_ that an object\n * or array of objects is used here, so that source selection\n * algorithms can take the `type` into account.\n *\n * If not provided, this method acts as a getter.\n * @param {boolean} isRetry\n * Indicates whether this is being called internally as a result of a retry\n *\n * @return {string|undefined}\n * If the `source` argument is missing, returns the current source\n * URL. Otherwise, returns nothing/undefined.\n */\n ;\n\n _proto.handleSrc_ = function handleSrc_(source, isRetry) {\n var _this15 = this;\n\n // getter usage\n if (typeof source === 'undefined') {\n return this.cache_.src || '';\n } // Reset retry behavior for new source\n\n\n if (this.resetRetryOnError_) {\n this.resetRetryOnError_();\n } // filter out invalid sources and turn our source into\n // an array of source objects\n\n\n var sources = filterSource(source); // if a source was passed in then it is invalid because\n // it was filtered to a zero length Array. So we have to\n // show an error\n\n if (!sources.length) {\n this.setTimeout(function () {\n this.error({\n code: 4,\n message: this.options_.notSupportedMessage\n });\n }, 0);\n return;\n } // initial sources\n\n\n this.changingSrc_ = true; // Only update the cached source list if we are not retrying a new source after error,\n // since in that case we want to include the failed source(s) in the cache\n\n if (!isRetry) {\n this.cache_.sources = sources;\n }\n\n this.updateSourceCaches_(sources[0]); // middlewareSource is the source after it has been changed by middleware\n\n setSource(this, sources[0], function (middlewareSource, mws) {\n _this15.middleware_ = mws; // since sourceSet is async we have to update the cache again after we select a source since\n // the source that is selected could be out of order from the cache update above this callback.\n\n if (!isRetry) {\n _this15.cache_.sources = sources;\n }\n\n _this15.updateSourceCaches_(middlewareSource);\n\n var err = _this15.src_(middlewareSource);\n\n if (err) {\n if (sources.length > 1) {\n return _this15.handleSrc_(sources.slice(1));\n }\n\n _this15.changingSrc_ = false; // We need to wrap this in a timeout to give folks a chance to add error event handlers\n\n _this15.setTimeout(function () {\n this.error({\n code: 4,\n message: this.options_.notSupportedMessage\n });\n }, 0); // we could not find an appropriate tech, but let's still notify the delegate that this is it\n // this needs a better comment about why this is needed\n\n\n _this15.triggerReady();\n\n return;\n }\n\n setTech(mws, _this15.tech_);\n }); // Try another available source if this one fails before playback.\n\n if (this.options_.retryOnError && sources.length > 1) {\n var retry = function retry() {\n // Remove the error modal\n _this15.error(null);\n\n _this15.handleSrc_(sources.slice(1), true);\n };\n\n var stopListeningForErrors = function stopListeningForErrors() {\n _this15.off('error', retry);\n };\n\n this.one('error', retry);\n this.one('playing', stopListeningForErrors);\n\n this.resetRetryOnError_ = function () {\n _this15.off('error', retry);\n\n _this15.off('playing', stopListeningForErrors);\n };\n }\n }\n /**\n * Get or set the video source.\n *\n * @param {Tech~SourceObject|Tech~SourceObject[]|string} [source]\n * A SourceObject, an array of SourceObjects, or a string referencing\n * a URL to a media source. It is _highly recommended_ that an object\n * or array of objects is used here, so that source selection\n * algorithms can take the `type` into account.\n *\n * If not provided, this method acts as a getter.\n *\n * @return {string|undefined}\n * If the `source` argument is missing, returns the current source\n * URL. Otherwise, returns nothing/undefined.\n */\n ;\n\n _proto.src = function src(source) {\n return this.handleSrc_(source, false);\n }\n /**\n * Set the source object on the tech, returns a boolean that indicates whether\n * there is a tech that can play the source or not\n *\n * @param {Tech~SourceObject} source\n * The source object to set on the Tech\n *\n * @return {boolean}\n * - True if there is no Tech to playback this source\n * - False otherwise\n *\n * @private\n */\n ;\n\n _proto.src_ = function src_(source) {\n var _this16 = this;\n\n var sourceTech = this.selectSource([source]);\n\n if (!sourceTech) {\n return true;\n }\n\n if (!titleCaseEquals(sourceTech.tech, this.techName_)) {\n this.changingSrc_ = true; // load this technology with the chosen source\n\n this.loadTech_(sourceTech.tech, sourceTech.source);\n this.tech_.ready(function () {\n _this16.changingSrc_ = false;\n });\n return false;\n } // wait until the tech is ready to set the source\n // and set it synchronously if possible (#2326)\n\n\n this.ready(function () {\n // The setSource tech method was added with source handlers\n // so older techs won't support it\n // We need to check the direct prototype for the case where subclasses\n // of the tech do not support source handlers\n if (this.tech_.constructor.prototype.hasOwnProperty('setSource')) {\n this.techCall_('setSource', source);\n } else {\n this.techCall_('src', source.src);\n }\n\n this.changingSrc_ = false;\n }, true);\n return false;\n }\n /**\n * Begin loading the src data.\n */\n ;\n\n _proto.load = function load() {\n this.techCall_('load');\n }\n /**\n * Reset the player. Loads the first tech in the techOrder,\n * removes all the text tracks in the existing `tech`,\n * and calls `reset` on the `tech`.\n */\n ;\n\n _proto.reset = function reset() {\n var _this17 = this;\n\n var PromiseClass = this.options_.Promise || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Promise);\n\n if (this.paused() || !PromiseClass) {\n this.doReset_();\n } else {\n var playPromise = this.play();\n silencePromise(playPromise.then(function () {\n return _this17.doReset_();\n }));\n }\n };\n\n _proto.doReset_ = function doReset_() {\n if (this.tech_) {\n this.tech_.clearTracks('text');\n }\n\n this.resetCache_();\n this.poster('');\n this.loadTech_(this.options_.techOrder[0], null);\n this.techCall_('reset');\n this.resetControlBarUI_();\n\n if (isEvented(this)) {\n this.trigger('playerreset');\n }\n }\n /**\n * Reset Control Bar's UI by calling sub-methods that reset\n * all of Control Bar's components\n */\n ;\n\n _proto.resetControlBarUI_ = function resetControlBarUI_() {\n this.resetProgressBar_();\n this.resetPlaybackRate_();\n this.resetVolumeBar_();\n }\n /**\n * Reset tech's progress so progress bar is reset in the UI\n */\n ;\n\n _proto.resetProgressBar_ = function resetProgressBar_() {\n this.currentTime(0);\n\n var _ref3 = this.controlBar || {},\n durationDisplay = _ref3.durationDisplay,\n remainingTimeDisplay = _ref3.remainingTimeDisplay;\n\n if (durationDisplay) {\n durationDisplay.updateContent();\n }\n\n if (remainingTimeDisplay) {\n remainingTimeDisplay.updateContent();\n }\n }\n /**\n * Reset Playback ratio\n */\n ;\n\n _proto.resetPlaybackRate_ = function resetPlaybackRate_() {\n this.playbackRate(this.defaultPlaybackRate());\n this.handleTechRateChange_();\n }\n /**\n * Reset Volume bar\n */\n ;\n\n _proto.resetVolumeBar_ = function resetVolumeBar_() {\n this.volume(1.0);\n this.trigger('volumechange');\n }\n /**\n * Returns all of the current source objects.\n *\n * @return {Tech~SourceObject[]}\n * The current source objects\n */\n ;\n\n _proto.currentSources = function currentSources() {\n var source = this.currentSource();\n var sources = []; // assume `{}` or `{ src }`\n\n if (Object.keys(source).length !== 0) {\n sources.push(source);\n }\n\n return this.cache_.sources || sources;\n }\n /**\n * Returns the current source object.\n *\n * @return {Tech~SourceObject}\n * The current source object\n */\n ;\n\n _proto.currentSource = function currentSource() {\n return this.cache_.source || {};\n }\n /**\n * Returns the fully qualified URL of the current source value e.g. http://mysite.com/video.mp4\n * Can be used in conjunction with `currentType` to assist in rebuilding the current source object.\n *\n * @return {string}\n * The current source\n */\n ;\n\n _proto.currentSrc = function currentSrc() {\n return this.currentSource() && this.currentSource().src || '';\n }\n /**\n * Get the current source type e.g. video/mp4\n * This can allow you rebuild the current source object so that you could load the same\n * source and tech later\n *\n * @return {string}\n * The source MIME type\n */\n ;\n\n _proto.currentType = function currentType() {\n return this.currentSource() && this.currentSource().type || '';\n }\n /**\n * Get or set the preload attribute\n *\n * @param {boolean} [value]\n * - true means that we should preload\n * - false means that we should not preload\n *\n * @return {string}\n * The preload attribute value when getting\n */\n ;\n\n _proto.preload = function preload(value) {\n if (value !== undefined) {\n this.techCall_('setPreload', value);\n this.options_.preload = value;\n return;\n }\n\n return this.techGet_('preload');\n }\n /**\n * Get or set the autoplay option. When this is a boolean it will\n * modify the attribute on the tech. When this is a string the attribute on\n * the tech will be removed and `Player` will handle autoplay on loadstarts.\n *\n * @param {boolean|string} [value]\n * - true: autoplay using the browser behavior\n * - false: do not autoplay\n * - 'play': call play() on every loadstart\n * - 'muted': call muted() then play() on every loadstart\n * - 'any': call play() on every loadstart. if that fails call muted() then play().\n * - *: values other than those listed here will be set `autoplay` to true\n *\n * @return {boolean|string}\n * The current value of autoplay when getting\n */\n ;\n\n _proto.autoplay = function autoplay(value) {\n // getter usage\n if (value === undefined) {\n return this.options_.autoplay || false;\n }\n\n var techAutoplay; // if the value is a valid string set it to that, or normalize `true` to 'play', if need be\n\n if (typeof value === 'string' && /(any|play|muted)/.test(value) || value === true && this.options_.normalizeAutoplay) {\n this.options_.autoplay = value;\n this.manualAutoplay_(typeof value === 'string' ? value : 'play');\n techAutoplay = false; // any falsy value sets autoplay to false in the browser,\n // lets do the same\n } else if (!value) {\n this.options_.autoplay = false; // any other value (ie truthy) sets autoplay to true\n } else {\n this.options_.autoplay = true;\n }\n\n techAutoplay = typeof techAutoplay === 'undefined' ? this.options_.autoplay : techAutoplay; // if we don't have a tech then we do not queue up\n // a setAutoplay call on tech ready. We do this because the\n // autoplay option will be passed in the constructor and we\n // do not need to set it twice\n\n if (this.tech_) {\n this.techCall_('setAutoplay', techAutoplay);\n }\n }\n /**\n * Set or unset the playsinline attribute.\n * Playsinline tells the browser that non-fullscreen playback is preferred.\n *\n * @param {boolean} [value]\n * - true means that we should try to play inline by default\n * - false means that we should use the browser's default playback mode,\n * which in most cases is inline. iOS Safari is a notable exception\n * and plays fullscreen by default.\n *\n * @return {string|Player}\n * - the current value of playsinline\n * - the player when setting\n *\n * @see [Spec]{@link https://html.spec.whatwg.org/#attr-video-playsinline}\n */\n ;\n\n _proto.playsinline = function playsinline(value) {\n if (value !== undefined) {\n this.techCall_('setPlaysinline', value);\n this.options_.playsinline = value;\n return this;\n }\n\n return this.techGet_('playsinline');\n }\n /**\n * Get or set the loop attribute on the video element.\n *\n * @param {boolean} [value]\n * - true means that we should loop the video\n * - false means that we should not loop the video\n *\n * @return {boolean}\n * The current value of loop when getting\n */\n ;\n\n _proto.loop = function loop(value) {\n if (value !== undefined) {\n this.techCall_('setLoop', value);\n this.options_.loop = value;\n return;\n }\n\n return this.techGet_('loop');\n }\n /**\n * Get or set the poster image source url\n *\n * @fires Player#posterchange\n *\n * @param {string} [src]\n * Poster image source URL\n *\n * @return {string}\n * The current value of poster when getting\n */\n ;\n\n _proto.poster = function poster(src) {\n if (src === undefined) {\n return this.poster_;\n } // The correct way to remove a poster is to set as an empty string\n // other falsey values will throw errors\n\n\n if (!src) {\n src = '';\n }\n\n if (src === this.poster_) {\n return;\n } // update the internal poster variable\n\n\n this.poster_ = src; // update the tech's poster\n\n this.techCall_('setPoster', src);\n this.isPosterFromTech_ = false; // alert components that the poster has been set\n\n /**\n * This event fires when the poster image is changed on the player.\n *\n * @event Player#posterchange\n * @type {EventTarget~Event}\n */\n\n this.trigger('posterchange');\n }\n /**\n * Some techs (e.g. YouTube) can provide a poster source in an\n * asynchronous way. We want the poster component to use this\n * poster source so that it covers up the tech's controls.\n * (YouTube's play button). However we only want to use this\n * source if the player user hasn't set a poster through\n * the normal APIs.\n *\n * @fires Player#posterchange\n * @listens Tech#posterchange\n * @private\n */\n ;\n\n _proto.handleTechPosterChange_ = function handleTechPosterChange_() {\n if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) {\n var newPoster = this.tech_.poster() || '';\n\n if (newPoster !== this.poster_) {\n this.poster_ = newPoster;\n this.isPosterFromTech_ = true; // Let components know the poster has changed\n\n this.trigger('posterchange');\n }\n }\n }\n /**\n * Get or set whether or not the controls are showing.\n *\n * @fires Player#controlsenabled\n *\n * @param {boolean} [bool]\n * - true to turn controls on\n * - false to turn controls off\n *\n * @return {boolean}\n * The current value of controls when getting\n */\n ;\n\n _proto.controls = function controls(bool) {\n if (bool === undefined) {\n return !!this.controls_;\n }\n\n bool = !!bool; // Don't trigger a change event unless it actually changed\n\n if (this.controls_ === bool) {\n return;\n }\n\n this.controls_ = bool;\n\n if (this.usingNativeControls()) {\n this.techCall_('setControls', bool);\n }\n\n if (this.controls_) {\n this.removeClass('vjs-controls-disabled');\n this.addClass('vjs-controls-enabled');\n /**\n * @event Player#controlsenabled\n * @type {EventTarget~Event}\n */\n\n this.trigger('controlsenabled');\n\n if (!this.usingNativeControls()) {\n this.addTechControlsListeners_();\n }\n } else {\n this.removeClass('vjs-controls-enabled');\n this.addClass('vjs-controls-disabled');\n /**\n * @event Player#controlsdisabled\n * @type {EventTarget~Event}\n */\n\n this.trigger('controlsdisabled');\n\n if (!this.usingNativeControls()) {\n this.removeTechControlsListeners_();\n }\n }\n }\n /**\n * Toggle native controls on/off. Native controls are the controls built into\n * devices (e.g. default iPhone controls) or other techs\n * (e.g. Vimeo Controls)\n * **This should only be set by the current tech, because only the tech knows\n * if it can support native controls**\n *\n * @fires Player#usingnativecontrols\n * @fires Player#usingcustomcontrols\n *\n * @param {boolean} [bool]\n * - true to turn native controls on\n * - false to turn native controls off\n *\n * @return {boolean}\n * The current value of native controls when getting\n */\n ;\n\n _proto.usingNativeControls = function usingNativeControls(bool) {\n if (bool === undefined) {\n return !!this.usingNativeControls_;\n }\n\n bool = !!bool; // Don't trigger a change event unless it actually changed\n\n if (this.usingNativeControls_ === bool) {\n return;\n }\n\n this.usingNativeControls_ = bool;\n\n if (this.usingNativeControls_) {\n this.addClass('vjs-using-native-controls');\n /**\n * player is using the native device controls\n *\n * @event Player#usingnativecontrols\n * @type {EventTarget~Event}\n */\n\n this.trigger('usingnativecontrols');\n } else {\n this.removeClass('vjs-using-native-controls');\n /**\n * player is using the custom HTML controls\n *\n * @event Player#usingcustomcontrols\n * @type {EventTarget~Event}\n */\n\n this.trigger('usingcustomcontrols');\n }\n }\n /**\n * Set or get the current MediaError\n *\n * @fires Player#error\n *\n * @param {MediaError|string|number} [err]\n * A MediaError or a string/number to be turned\n * into a MediaError\n *\n * @return {MediaError|null}\n * The current MediaError when getting (or null)\n */\n ;\n\n _proto.error = function error(err) {\n var _this18 = this;\n\n if (err === undefined) {\n return this.error_ || null;\n } // allow hooks to modify error object\n\n\n hooks('beforeerror').forEach(function (hookFunction) {\n var newErr = hookFunction(_this18, err);\n\n if (!(isObject(newErr) && !Array.isArray(newErr) || typeof newErr === 'string' || typeof newErr === 'number' || newErr === null)) {\n _this18.log.error('please return a value that MediaError expects in beforeerror hooks');\n\n return;\n }\n\n err = newErr;\n }); // Suppress the first error message for no compatible source until\n // user interaction\n\n if (this.options_.suppressNotSupportedError && err && err.code === 4) {\n var triggerSuppressedError = function triggerSuppressedError() {\n this.error(err);\n };\n\n this.options_.suppressNotSupportedError = false;\n this.any(['click', 'touchstart'], triggerSuppressedError);\n this.one('loadstart', function () {\n this.off(['click', 'touchstart'], triggerSuppressedError);\n });\n return;\n } // restoring to default\n\n\n if (err === null) {\n this.error_ = err;\n this.removeClass('vjs-error');\n\n if (this.errorDisplay) {\n this.errorDisplay.close();\n }\n\n return;\n }\n\n this.error_ = new MediaError(err); // add the vjs-error classname to the player\n\n this.addClass('vjs-error'); // log the name of the error type and any message\n // IE11 logs \"[object object]\" and required you to expand message to see error object\n\n log$1.error(\"(CODE:\" + this.error_.code + \" \" + MediaError.errorTypes[this.error_.code] + \")\", this.error_.message, this.error_);\n /**\n * @event Player#error\n * @type {EventTarget~Event}\n */\n\n this.trigger('error'); // notify hooks of the per player error\n\n hooks('error').forEach(function (hookFunction) {\n return hookFunction(_this18, _this18.error_);\n });\n return;\n }\n /**\n * Report user activity\n *\n * @param {Object} event\n * Event object\n */\n ;\n\n _proto.reportUserActivity = function reportUserActivity(event) {\n this.userActivity_ = true;\n }\n /**\n * Get/set if user is active\n *\n * @fires Player#useractive\n * @fires Player#userinactive\n *\n * @param {boolean} [bool]\n * - true if the user is active\n * - false if the user is inactive\n *\n * @return {boolean}\n * The current value of userActive when getting\n */\n ;\n\n _proto.userActive = function userActive(bool) {\n if (bool === undefined) {\n return this.userActive_;\n }\n\n bool = !!bool;\n\n if (bool === this.userActive_) {\n return;\n }\n\n this.userActive_ = bool;\n\n if (this.userActive_) {\n this.userActivity_ = true;\n this.removeClass('vjs-user-inactive');\n this.addClass('vjs-user-active');\n /**\n * @event Player#useractive\n * @type {EventTarget~Event}\n */\n\n this.trigger('useractive');\n return;\n } // Chrome/Safari/IE have bugs where when you change the cursor it can\n // trigger a mousemove event. This causes an issue when you're hiding\n // the cursor when the user is inactive, and a mousemove signals user\n // activity. Making it impossible to go into inactive mode. Specifically\n // this happens in fullscreen when we really need to hide the cursor.\n //\n // When this gets resolved in ALL browsers it can be removed\n // https://code.google.com/p/chromium/issues/detail?id=103041\n\n\n if (this.tech_) {\n this.tech_.one('mousemove', function (e) {\n e.stopPropagation();\n e.preventDefault();\n });\n }\n\n this.userActivity_ = false;\n this.removeClass('vjs-user-active');\n this.addClass('vjs-user-inactive');\n /**\n * @event Player#userinactive\n * @type {EventTarget~Event}\n */\n\n this.trigger('userinactive');\n }\n /**\n * Listen for user activity based on timeout value\n *\n * @private\n */\n ;\n\n _proto.listenForUserActivity_ = function listenForUserActivity_() {\n var mouseInProgress;\n var lastMoveX;\n var lastMoveY;\n var handleActivity = bind(this, this.reportUserActivity);\n\n var handleMouseMove = function handleMouseMove(e) {\n // #1068 - Prevent mousemove spamming\n // Chrome Bug: https://code.google.com/p/chromium/issues/detail?id=366970\n if (e.screenX !== lastMoveX || e.screenY !== lastMoveY) {\n lastMoveX = e.screenX;\n lastMoveY = e.screenY;\n handleActivity();\n }\n };\n\n var handleMouseDown = function handleMouseDown() {\n handleActivity(); // For as long as the they are touching the device or have their mouse down,\n // we consider them active even if they're not moving their finger or mouse.\n // So we want to continue to update that they are active\n\n this.clearInterval(mouseInProgress); // Setting userActivity=true now and setting the interval to the same time\n // as the activityCheck interval (250) should ensure we never miss the\n // next activityCheck\n\n mouseInProgress = this.setInterval(handleActivity, 250);\n };\n\n var handleMouseUpAndMouseLeave = function handleMouseUpAndMouseLeave(event) {\n handleActivity(); // Stop the interval that maintains activity if the mouse/touch is down\n\n this.clearInterval(mouseInProgress);\n }; // Any mouse movement will be considered user activity\n\n\n this.on('mousedown', handleMouseDown);\n this.on('mousemove', handleMouseMove);\n this.on('mouseup', handleMouseUpAndMouseLeave);\n this.on('mouseleave', handleMouseUpAndMouseLeave);\n var controlBar = this.getChild('controlBar'); // Fixes bug on Android & iOS where when tapping progressBar (when control bar is displayed)\n // controlBar would no longer be hidden by default timeout.\n\n if (controlBar && !IS_IOS && !IS_ANDROID) {\n controlBar.on('mouseenter', function (event) {\n if (this.player().options_.inactivityTimeout !== 0) {\n this.player().cache_.inactivityTimeout = this.player().options_.inactivityTimeout;\n }\n\n this.player().options_.inactivityTimeout = 0;\n });\n controlBar.on('mouseleave', function (event) {\n this.player().options_.inactivityTimeout = this.player().cache_.inactivityTimeout;\n });\n } // Listen for keyboard navigation\n // Shouldn't need to use inProgress interval because of key repeat\n\n\n this.on('keydown', handleActivity);\n this.on('keyup', handleActivity); // Run an interval every 250 milliseconds instead of stuffing everything into\n // the mousemove/touchmove function itself, to prevent performance degradation.\n // `this.reportUserActivity` simply sets this.userActivity_ to true, which\n // then gets picked up by this loop\n // http://ejohn.org/blog/learning-from-twitter/\n\n var inactivityTimeout;\n this.setInterval(function () {\n // Check to see if mouse/touch activity has happened\n if (!this.userActivity_) {\n return;\n } // Reset the activity tracker\n\n\n this.userActivity_ = false; // If the user state was inactive, set the state to active\n\n this.userActive(true); // Clear any existing inactivity timeout to start the timer over\n\n this.clearTimeout(inactivityTimeout);\n var timeout = this.options_.inactivityTimeout;\n\n if (timeout <= 0) {\n return;\n } // In <timeout> milliseconds, if no more activity has occurred the\n // user will be considered inactive\n\n\n inactivityTimeout = this.setTimeout(function () {\n // Protect against the case where the inactivityTimeout can trigger just\n // before the next user activity is picked up by the activity check loop\n // causing a flicker\n if (!this.userActivity_) {\n this.userActive(false);\n }\n }, timeout);\n }, 250);\n }\n /**\n * Gets or sets the current playback rate. A playback rate of\n * 1.0 represents normal speed and 0.5 would indicate half-speed\n * playback, for instance.\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-playbackrate\n *\n * @param {number} [rate]\n * New playback rate to set.\n *\n * @return {number}\n * The current playback rate when getting or 1.0\n */\n ;\n\n _proto.playbackRate = function playbackRate(rate) {\n if (rate !== undefined) {\n // NOTE: this.cache_.lastPlaybackRate is set from the tech handler\n // that is registered above\n this.techCall_('setPlaybackRate', rate);\n return;\n }\n\n if (this.tech_ && this.tech_.featuresPlaybackRate) {\n return this.cache_.lastPlaybackRate || this.techGet_('playbackRate');\n }\n\n return 1.0;\n }\n /**\n * Gets or sets the current default playback rate. A default playback rate of\n * 1.0 represents normal speed and 0.5 would indicate half-speed playback, for instance.\n * defaultPlaybackRate will only represent what the initial playbackRate of a video was, not\n * not the current playbackRate.\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-defaultplaybackrate\n *\n * @param {number} [rate]\n * New default playback rate to set.\n *\n * @return {number|Player}\n * - The default playback rate when getting or 1.0\n * - the player when setting\n */\n ;\n\n _proto.defaultPlaybackRate = function defaultPlaybackRate(rate) {\n if (rate !== undefined) {\n return this.techCall_('setDefaultPlaybackRate', rate);\n }\n\n if (this.tech_ && this.tech_.featuresPlaybackRate) {\n return this.techGet_('defaultPlaybackRate');\n }\n\n return 1.0;\n }\n /**\n * Gets or sets the audio flag\n *\n * @param {boolean} bool\n * - true signals that this is an audio player\n * - false signals that this is not an audio player\n *\n * @return {boolean}\n * The current value of isAudio when getting\n */\n ;\n\n _proto.isAudio = function isAudio(bool) {\n if (bool !== undefined) {\n this.isAudio_ = !!bool;\n return;\n }\n\n return !!this.isAudio_;\n };\n\n _proto.enableAudioOnlyUI_ = function enableAudioOnlyUI_() {\n var _this19 = this;\n\n // Update styling immediately to show the control bar so we can get its height\n this.addClass('vjs-audio-only-mode');\n var playerChildren = this.children();\n var controlBar = this.getChild('ControlBar');\n var controlBarHeight = controlBar && controlBar.currentHeight(); // Hide all player components except the control bar. Control bar components\n // needed only for video are hidden with CSS\n\n playerChildren.forEach(function (child) {\n if (child === controlBar) {\n return;\n }\n\n if (child.el_ && !child.hasClass('vjs-hidden')) {\n child.hide();\n\n _this19.audioOnlyCache_.hiddenChildren.push(child);\n }\n });\n this.audioOnlyCache_.playerHeight = this.currentHeight(); // Set the player height the same as the control bar\n\n this.height(controlBarHeight);\n this.trigger('audioonlymodechange');\n };\n\n _proto.disableAudioOnlyUI_ = function disableAudioOnlyUI_() {\n this.removeClass('vjs-audio-only-mode'); // Show player components that were previously hidden\n\n this.audioOnlyCache_.hiddenChildren.forEach(function (child) {\n return child.show();\n }); // Reset player height\n\n this.height(this.audioOnlyCache_.playerHeight);\n this.trigger('audioonlymodechange');\n }\n /**\n * Get the current audioOnlyMode state or set audioOnlyMode to true or false.\n *\n * Setting this to `true` will hide all player components except the control bar,\n * as well as control bar components needed only for video.\n *\n * @param {boolean} [value]\n * The value to set audioOnlyMode to.\n *\n * @return {Promise|boolean}\n * A Promise is returned when setting the state, and a boolean when getting\n * the present state\n */\n ;\n\n _proto.audioOnlyMode = function audioOnlyMode(value) {\n var _this20 = this;\n\n if (typeof value !== 'boolean' || value === this.audioOnlyMode_) {\n return this.audioOnlyMode_;\n }\n\n this.audioOnlyMode_ = value;\n var PromiseClass = this.options_.Promise || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Promise);\n\n if (PromiseClass) {\n // Enable Audio Only Mode\n if (value) {\n var exitPromises = []; // Fullscreen and PiP are not supported in audioOnlyMode, so exit if we need to.\n\n if (this.isInPictureInPicture()) {\n exitPromises.push(this.exitPictureInPicture());\n }\n\n if (this.isFullscreen()) {\n exitPromises.push(this.exitFullscreen());\n }\n\n if (this.audioPosterMode()) {\n exitPromises.push(this.audioPosterMode(false));\n }\n\n return PromiseClass.all(exitPromises).then(function () {\n return _this20.enableAudioOnlyUI_();\n });\n } // Disable Audio Only Mode\n\n\n return PromiseClass.resolve().then(function () {\n return _this20.disableAudioOnlyUI_();\n });\n }\n\n if (value) {\n if (this.isInPictureInPicture()) {\n this.exitPictureInPicture();\n }\n\n if (this.isFullscreen()) {\n this.exitFullscreen();\n }\n\n this.enableAudioOnlyUI_();\n } else {\n this.disableAudioOnlyUI_();\n }\n };\n\n _proto.enablePosterModeUI_ = function enablePosterModeUI_() {\n // Hide the video element and show the poster image to enable posterModeUI\n var tech = this.tech_ && this.tech_;\n tech.hide();\n this.addClass('vjs-audio-poster-mode');\n this.trigger('audiopostermodechange');\n };\n\n _proto.disablePosterModeUI_ = function disablePosterModeUI_() {\n // Show the video element and hide the poster image to disable posterModeUI\n var tech = this.tech_ && this.tech_;\n tech.show();\n this.removeClass('vjs-audio-poster-mode');\n this.trigger('audiopostermodechange');\n }\n /**\n * Get the current audioPosterMode state or set audioPosterMode to true or false\n *\n * @param {boolean} [value]\n * The value to set audioPosterMode to.\n *\n * @return {Promise|boolean}\n * A Promise is returned when setting the state, and a boolean when getting\n * the present state\n */\n ;\n\n _proto.audioPosterMode = function audioPosterMode(value) {\n var _this21 = this;\n\n if (typeof value !== 'boolean' || value === this.audioPosterMode_) {\n return this.audioPosterMode_;\n }\n\n this.audioPosterMode_ = value;\n var PromiseClass = this.options_.Promise || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Promise);\n\n if (PromiseClass) {\n if (value) {\n if (this.audioOnlyMode()) {\n var audioOnlyModePromise = this.audioOnlyMode(false);\n return audioOnlyModePromise.then(function () {\n // enable audio poster mode after audio only mode is disabled\n _this21.enablePosterModeUI_();\n });\n }\n\n return PromiseClass.resolve().then(function () {\n // enable audio poster mode\n _this21.enablePosterModeUI_();\n });\n }\n\n return PromiseClass.resolve().then(function () {\n // disable audio poster mode\n _this21.disablePosterModeUI_();\n });\n }\n\n if (value) {\n if (this.audioOnlyMode()) {\n this.audioOnlyMode(false);\n }\n\n this.enablePosterModeUI_();\n return;\n }\n\n this.disablePosterModeUI_();\n }\n /**\n * A helper method for adding a {@link TextTrack} to our\n * {@link TextTrackList}.\n *\n * In addition to the W3C settings we allow adding additional info through options.\n *\n * @see http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-addtexttrack\n *\n * @param {string} [kind]\n * the kind of TextTrack you are adding\n *\n * @param {string} [label]\n * the label to give the TextTrack label\n *\n * @param {string} [language]\n * the language to set on the TextTrack\n *\n * @return {TextTrack|undefined}\n * the TextTrack that was added or undefined\n * if there is no tech\n */\n ;\n\n _proto.addTextTrack = function addTextTrack(kind, label, language) {\n if (this.tech_) {\n return this.tech_.addTextTrack(kind, label, language);\n }\n }\n /**\n * Create a remote {@link TextTrack} and an {@link HTMLTrackElement}.\n * When manualCleanup is set to false, the track will be automatically removed\n * on source changes.\n *\n * @param {Object} options\n * Options to pass to {@link HTMLTrackElement} during creation. See\n * {@link HTMLTrackElement} for object properties that you should use.\n *\n * @param {boolean} [manualCleanup=true] if set to false, the TextTrack will be\n * removed on a source change\n *\n * @return {HtmlTrackElement}\n * the HTMLTrackElement that was created and added\n * to the HtmlTrackElementList and the remote\n * TextTrackList\n *\n * @deprecated The default value of the \"manualCleanup\" parameter will default\n * to \"false\" in upcoming versions of Video.js\n */\n ;\n\n _proto.addRemoteTextTrack = function addRemoteTextTrack(options, manualCleanup) {\n if (this.tech_) {\n return this.tech_.addRemoteTextTrack(options, manualCleanup);\n }\n }\n /**\n * Remove a remote {@link TextTrack} from the respective\n * {@link TextTrackList} and {@link HtmlTrackElementList}.\n *\n * @param {Object} track\n * Remote {@link TextTrack} to remove\n *\n * @return {undefined}\n * does not return anything\n */\n ;\n\n _proto.removeRemoteTextTrack = function removeRemoteTextTrack(obj) {\n if (obj === void 0) {\n obj = {};\n }\n\n var _obj = obj,\n track = _obj.track;\n\n if (!track) {\n track = obj;\n } // destructure the input into an object with a track argument, defaulting to arguments[0]\n // default the whole argument to an empty object if nothing was passed in\n\n\n if (this.tech_) {\n return this.tech_.removeRemoteTextTrack(track);\n }\n }\n /**\n * Gets available media playback quality metrics as specified by the W3C's Media\n * Playback Quality API.\n *\n * @see [Spec]{@link https://wicg.github.io/media-playback-quality}\n *\n * @return {Object|undefined}\n * An object with supported media playback quality metrics or undefined if there\n * is no tech or the tech does not support it.\n */\n ;\n\n _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {\n return this.techGet_('getVideoPlaybackQuality');\n }\n /**\n * Get video width\n *\n * @return {number}\n * current video width\n */\n ;\n\n _proto.videoWidth = function videoWidth() {\n return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0;\n }\n /**\n * Get video height\n *\n * @return {number}\n * current video height\n */\n ;\n\n _proto.videoHeight = function videoHeight() {\n return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0;\n }\n /**\n * The player's language code.\n *\n * Changing the language will trigger\n * [languagechange]{@link Player#event:languagechange}\n * which Components can use to update control text.\n * ClickableComponent will update its control text by default on\n * [languagechange]{@link Player#event:languagechange}.\n *\n * @fires Player#languagechange\n *\n * @param {string} [code]\n * the language code to set the player to\n *\n * @return {string}\n * The current language code when getting\n */\n ;\n\n _proto.language = function language(code) {\n if (code === undefined) {\n return this.language_;\n }\n\n if (this.language_ !== String(code).toLowerCase()) {\n this.language_ = String(code).toLowerCase(); // during first init, it's possible some things won't be evented\n\n if (isEvented(this)) {\n /**\n * fires when the player language change\n *\n * @event Player#languagechange\n * @type {EventTarget~Event}\n */\n this.trigger('languagechange');\n }\n }\n }\n /**\n * Get the player's language dictionary\n * Merge every time, because a newly added plugin might call videojs.addLanguage() at any time\n * Languages specified directly in the player options have precedence\n *\n * @return {Array}\n * An array of of supported languages\n */\n ;\n\n _proto.languages = function languages() {\n return mergeOptions$3(Player.prototype.options_.languages, this.languages_);\n }\n /**\n * returns a JavaScript object reperesenting the current track\n * information. **DOES not return it as JSON**\n *\n * @return {Object}\n * Object representing the current of track info\n */\n ;\n\n _proto.toJSON = function toJSON() {\n var options = mergeOptions$3(this.options_);\n var tracks = options.tracks;\n options.tracks = [];\n\n for (var i = 0; i < tracks.length; i++) {\n var track = tracks[i]; // deep merge tracks and null out player so no circular references\n\n track = mergeOptions$3(track);\n track.player = undefined;\n options.tracks[i] = track;\n }\n\n return options;\n }\n /**\n * Creates a simple modal dialog (an instance of the {@link ModalDialog}\n * component) that immediately overlays the player with arbitrary\n * content and removes itself when closed.\n *\n * @param {string|Function|Element|Array|null} content\n * Same as {@link ModalDialog#content}'s param of the same name.\n * The most straight-forward usage is to provide a string or DOM\n * element.\n *\n * @param {Object} [options]\n * Extra options which will be passed on to the {@link ModalDialog}.\n *\n * @return {ModalDialog}\n * the {@link ModalDialog} that was created\n */\n ;\n\n _proto.createModal = function createModal(content, options) {\n var _this22 = this;\n\n options = options || {};\n options.content = content || '';\n var modal = new ModalDialog(this, options);\n this.addChild(modal);\n modal.on('dispose', function () {\n _this22.removeChild(modal);\n });\n modal.open();\n return modal;\n }\n /**\n * Change breakpoint classes when the player resizes.\n *\n * @private\n */\n ;\n\n _proto.updateCurrentBreakpoint_ = function updateCurrentBreakpoint_() {\n if (!this.responsive()) {\n return;\n }\n\n var currentBreakpoint = this.currentBreakpoint();\n var currentWidth = this.currentWidth();\n\n for (var i = 0; i < BREAKPOINT_ORDER.length; i++) {\n var candidateBreakpoint = BREAKPOINT_ORDER[i];\n var maxWidth = this.breakpoints_[candidateBreakpoint];\n\n if (currentWidth <= maxWidth) {\n // The current breakpoint did not change, nothing to do.\n if (currentBreakpoint === candidateBreakpoint) {\n return;\n } // Only remove a class if there is a current breakpoint.\n\n\n if (currentBreakpoint) {\n this.removeClass(BREAKPOINT_CLASSES[currentBreakpoint]);\n }\n\n this.addClass(BREAKPOINT_CLASSES[candidateBreakpoint]);\n this.breakpoint_ = candidateBreakpoint;\n break;\n }\n }\n }\n /**\n * Removes the current breakpoint.\n *\n * @private\n */\n ;\n\n _proto.removeCurrentBreakpoint_ = function removeCurrentBreakpoint_() {\n var className = this.currentBreakpointClass();\n this.breakpoint_ = '';\n\n if (className) {\n this.removeClass(className);\n }\n }\n /**\n * Get or set breakpoints on the player.\n *\n * Calling this method with an object or `true` will remove any previous\n * custom breakpoints and start from the defaults again.\n *\n * @param {Object|boolean} [breakpoints]\n * If an object is given, it can be used to provide custom\n * breakpoints. If `true` is given, will set default breakpoints.\n * If this argument is not given, will simply return the current\n * breakpoints.\n *\n * @param {number} [breakpoints.tiny]\n * The maximum width for the \"vjs-layout-tiny\" class.\n *\n * @param {number} [breakpoints.xsmall]\n * The maximum width for the \"vjs-layout-x-small\" class.\n *\n * @param {number} [breakpoints.small]\n * The maximum width for the \"vjs-layout-small\" class.\n *\n * @param {number} [breakpoints.medium]\n * The maximum width for the \"vjs-layout-medium\" class.\n *\n * @param {number} [breakpoints.large]\n * The maximum width for the \"vjs-layout-large\" class.\n *\n * @param {number} [breakpoints.xlarge]\n * The maximum width for the \"vjs-layout-x-large\" class.\n *\n * @param {number} [breakpoints.huge]\n * The maximum width for the \"vjs-layout-huge\" class.\n *\n * @return {Object}\n * An object mapping breakpoint names to maximum width values.\n */\n ;\n\n _proto.breakpoints = function breakpoints(_breakpoints) {\n // Used as a getter.\n if (_breakpoints === undefined) {\n return assign(this.breakpoints_);\n }\n\n this.breakpoint_ = '';\n this.breakpoints_ = assign({}, DEFAULT_BREAKPOINTS, _breakpoints); // When breakpoint definitions change, we need to update the currently\n // selected breakpoint.\n\n this.updateCurrentBreakpoint_(); // Clone the breakpoints before returning.\n\n return assign(this.breakpoints_);\n }\n /**\n * Get or set a flag indicating whether or not this player should adjust\n * its UI based on its dimensions.\n *\n * @param {boolean} value\n * Should be `true` if the player should adjust its UI based on its\n * dimensions; otherwise, should be `false`.\n *\n * @return {boolean}\n * Will be `true` if this player should adjust its UI based on its\n * dimensions; otherwise, will be `false`.\n */\n ;\n\n _proto.responsive = function responsive(value) {\n // Used as a getter.\n if (value === undefined) {\n return this.responsive_;\n }\n\n value = Boolean(value);\n var current = this.responsive_; // Nothing changed.\n\n if (value === current) {\n return;\n } // The value actually changed, set it.\n\n\n this.responsive_ = value; // Start listening for breakpoints and set the initial breakpoint if the\n // player is now responsive.\n\n if (value) {\n this.on('playerresize', this.boundUpdateCurrentBreakpoint_);\n this.updateCurrentBreakpoint_(); // Stop listening for breakpoints if the player is no longer responsive.\n } else {\n this.off('playerresize', this.boundUpdateCurrentBreakpoint_);\n this.removeCurrentBreakpoint_();\n }\n\n return value;\n }\n /**\n * Get current breakpoint name, if any.\n *\n * @return {string}\n * If there is currently a breakpoint set, returns a the key from the\n * breakpoints object matching it. Otherwise, returns an empty string.\n */\n ;\n\n _proto.currentBreakpoint = function currentBreakpoint() {\n return this.breakpoint_;\n }\n /**\n * Get the current breakpoint class name.\n *\n * @return {string}\n * The matching class name (e.g. `\"vjs-layout-tiny\"` or\n * `\"vjs-layout-large\"`) for the current breakpoint. Empty string if\n * there is no current breakpoint.\n */\n ;\n\n _proto.currentBreakpointClass = function currentBreakpointClass() {\n return BREAKPOINT_CLASSES[this.breakpoint_] || '';\n }\n /**\n * An object that describes a single piece of media.\n *\n * Properties that are not part of this type description will be retained; so,\n * this can be viewed as a generic metadata storage mechanism as well.\n *\n * @see {@link https://wicg.github.io/mediasession/#the-mediametadata-interface}\n * @typedef {Object} Player~MediaObject\n *\n * @property {string} [album]\n * Unused, except if this object is passed to the `MediaSession`\n * API.\n *\n * @property {string} [artist]\n * Unused, except if this object is passed to the `MediaSession`\n * API.\n *\n * @property {Object[]} [artwork]\n * Unused, except if this object is passed to the `MediaSession`\n * API. If not specified, will be populated via the `poster`, if\n * available.\n *\n * @property {string} [poster]\n * URL to an image that will display before playback.\n *\n * @property {Tech~SourceObject|Tech~SourceObject[]|string} [src]\n * A single source object, an array of source objects, or a string\n * referencing a URL to a media source. It is _highly recommended_\n * that an object or array of objects is used here, so that source\n * selection algorithms can take the `type` into account.\n *\n * @property {string} [title]\n * Unused, except if this object is passed to the `MediaSession`\n * API.\n *\n * @property {Object[]} [textTracks]\n * An array of objects to be used to create text tracks, following\n * the {@link https://www.w3.org/TR/html50/embedded-content-0.html#the-track-element|native track element format}.\n * For ease of removal, these will be created as \"remote\" text\n * tracks and set to automatically clean up on source changes.\n *\n * These objects may have properties like `src`, `kind`, `label`,\n * and `language`, see {@link Tech#createRemoteTextTrack}.\n */\n\n /**\n * Populate the player using a {@link Player~MediaObject|MediaObject}.\n *\n * @param {Player~MediaObject} media\n * A media object.\n *\n * @param {Function} ready\n * A callback to be called when the player is ready.\n */\n ;\n\n _proto.loadMedia = function loadMedia(media, ready) {\n var _this23 = this;\n\n if (!media || typeof media !== 'object') {\n return;\n }\n\n this.reset(); // Clone the media object so it cannot be mutated from outside.\n\n this.cache_.media = mergeOptions$3(media);\n var _this$cache_$media = this.cache_.media,\n artwork = _this$cache_$media.artwork,\n poster = _this$cache_$media.poster,\n src = _this$cache_$media.src,\n textTracks = _this$cache_$media.textTracks; // If `artwork` is not given, create it using `poster`.\n\n if (!artwork && poster) {\n this.cache_.media.artwork = [{\n src: poster,\n type: getMimetype(poster)\n }];\n }\n\n if (src) {\n this.src(src);\n }\n\n if (poster) {\n this.poster(poster);\n }\n\n if (Array.isArray(textTracks)) {\n textTracks.forEach(function (tt) {\n return _this23.addRemoteTextTrack(tt, false);\n });\n }\n\n this.ready(ready);\n }\n /**\n * Get a clone of the current {@link Player~MediaObject} for this player.\n *\n * If the `loadMedia` method has not been used, will attempt to return a\n * {@link Player~MediaObject} based on the current state of the player.\n *\n * @return {Player~MediaObject}\n */\n ;\n\n _proto.getMedia = function getMedia() {\n if (!this.cache_.media) {\n var poster = this.poster();\n var src = this.currentSources();\n var textTracks = Array.prototype.map.call(this.remoteTextTracks(), function (tt) {\n return {\n kind: tt.kind,\n label: tt.label,\n language: tt.language,\n src: tt.src\n };\n });\n var media = {\n src: src,\n textTracks: textTracks\n };\n\n if (poster) {\n media.poster = poster;\n media.artwork = [{\n src: media.poster,\n type: getMimetype(media.poster)\n }];\n }\n\n return media;\n }\n\n return mergeOptions$3(this.cache_.media);\n }\n /**\n * Gets tag settings\n *\n * @param {Element} tag\n * The player tag\n *\n * @return {Object}\n * An object containing all of the settings\n * for a player tag\n */\n ;\n\n Player.getTagSettings = function getTagSettings(tag) {\n var baseOptions = {\n sources: [],\n tracks: []\n };\n var tagOptions = getAttributes(tag);\n var dataSetup = tagOptions['data-setup'];\n\n if (hasClass(tag, 'vjs-fill')) {\n tagOptions.fill = true;\n }\n\n if (hasClass(tag, 'vjs-fluid')) {\n tagOptions.fluid = true;\n } // Check if data-setup attr exists.\n\n\n if (dataSetup !== null) {\n // Parse options JSON\n // If empty string, make it a parsable json object.\n var _safeParseTuple = safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_6___default()(dataSetup || '{}'),\n err = _safeParseTuple[0],\n data = _safeParseTuple[1];\n\n if (err) {\n log$1.error(err);\n }\n\n assign(tagOptions, data);\n }\n\n assign(baseOptions, tagOptions); // Get tag children settings\n\n if (tag.hasChildNodes()) {\n var children = tag.childNodes;\n\n for (var i = 0, j = children.length; i < j; i++) {\n var child = children[i]; // Change case needed: http://ejohn.org/blog/nodename-case-sensitivity/\n\n var childName = child.nodeName.toLowerCase();\n\n if (childName === 'source') {\n baseOptions.sources.push(getAttributes(child));\n } else if (childName === 'track') {\n baseOptions.tracks.push(getAttributes(child));\n }\n }\n }\n\n return baseOptions;\n }\n /**\n * Determine whether or not flexbox is supported\n *\n * @return {boolean}\n * - true if flexbox is supported\n * - false if flexbox is not supported\n */\n ;\n\n _proto.flexNotSupported_ = function flexNotSupported_() {\n var elem = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('i'); // Note: We don't actually use flexBasis (or flexOrder), but it's one of the more\n // common flex features that we can rely on when checking for flex support.\n\n return !('flexBasis' in elem.style || 'webkitFlexBasis' in elem.style || 'mozFlexBasis' in elem.style || 'msFlexBasis' in elem.style || // IE10-specific (2012 flex spec), available for completeness\n 'msFlexOrder' in elem.style);\n }\n /**\n * Set debug mode to enable/disable logs at info level.\n *\n * @param {boolean} enabled\n * @fires Player#debugon\n * @fires Player#debugoff\n */\n ;\n\n _proto.debug = function debug(enabled) {\n if (enabled === undefined) {\n return this.debugEnabled_;\n }\n\n if (enabled) {\n this.trigger('debugon');\n this.previousLogLevel_ = this.log.level;\n this.log.level('debug');\n this.debugEnabled_ = true;\n } else {\n this.trigger('debugoff');\n this.log.level(this.previousLogLevel_);\n this.previousLogLevel_ = undefined;\n this.debugEnabled_ = false;\n }\n }\n /**\n * Set or get current playback rates.\n * Takes an array and updates the playback rates menu with the new items.\n * Pass in an empty array to hide the menu.\n * Values other than arrays are ignored.\n *\n * @fires Player#playbackrateschange\n * @param {number[]} newRates\n * The new rates that the playback rates menu should update to.\n * An empty array will hide the menu\n * @return {number[]} When used as a getter will return the current playback rates\n */\n ;\n\n _proto.playbackRates = function playbackRates(newRates) {\n if (newRates === undefined) {\n return this.cache_.playbackRates;\n } // ignore any value that isn't an array\n\n\n if (!Array.isArray(newRates)) {\n return;\n } // ignore any arrays that don't only contain numbers\n\n\n if (!newRates.every(function (rate) {\n return typeof rate === 'number';\n })) {\n return;\n }\n\n this.cache_.playbackRates = newRates;\n /**\n * fires when the playback rates in a player are changed\n *\n * @event Player#playbackrateschange\n * @type {EventTarget~Event}\n */\n\n this.trigger('playbackrateschange');\n };\n\n return Player;\n}(Component$1);\n/**\n * Get the {@link VideoTrackList}\n * @link https://html.spec.whatwg.org/multipage/embedded-content.html#videotracklist\n *\n * @return {VideoTrackList}\n * the current video track list\n *\n * @method Player.prototype.videoTracks\n */\n\n/**\n * Get the {@link AudioTrackList}\n * @link https://html.spec.whatwg.org/multipage/embedded-content.html#audiotracklist\n *\n * @return {AudioTrackList}\n * the current audio track list\n *\n * @method Player.prototype.audioTracks\n */\n\n/**\n * Get the {@link TextTrackList}\n *\n * @link http://www.w3.org/html/wg/drafts/html/master/embedded-content-0.html#dom-media-texttracks\n *\n * @return {TextTrackList}\n * the current text track list\n *\n * @method Player.prototype.textTracks\n */\n\n/**\n * Get the remote {@link TextTrackList}\n *\n * @return {TextTrackList}\n * The current remote text track list\n *\n * @method Player.prototype.remoteTextTracks\n */\n\n/**\n * Get the remote {@link HtmlTrackElementList} tracks.\n *\n * @return {HtmlTrackElementList}\n * The current remote text track element list\n *\n * @method Player.prototype.remoteTextTrackEls\n */\n\n\nALL.names.forEach(function (name) {\n var props = ALL[name];\n\n Player.prototype[props.getterName] = function () {\n if (this.tech_) {\n return this.tech_[props.getterName]();\n } // if we have not yet loadTech_, we create {video,audio,text}Tracks_\n // these will be passed to the tech during loading\n\n\n this[props.privateName] = this[props.privateName] || new props.ListClass();\n return this[props.privateName];\n };\n});\n/**\n * Get or set the `Player`'s crossorigin option. For the HTML5 player, this\n * sets the `crossOrigin` property on the `<video>` tag to control the CORS\n * behavior.\n *\n * @see [Video Element Attributes]{@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#attr-crossorigin}\n *\n * @param {string} [value]\n * The value to set the `Player`'s crossorigin to. If an argument is\n * given, must be one of `anonymous` or `use-credentials`.\n *\n * @return {string|undefined}\n * - The current crossorigin value of the `Player` when getting.\n * - undefined when setting\n */\n\nPlayer.prototype.crossorigin = Player.prototype.crossOrigin;\n/**\n * Global enumeration of players.\n *\n * The keys are the player IDs and the values are either the {@link Player}\n * instance or `null` for disposed players.\n *\n * @type {Object}\n */\n\nPlayer.players = {};\nvar navigator = (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator);\n/*\n * Player instance options, surfaced using options\n * options = Player.prototype.options_\n * Make changes in options, not here.\n *\n * @type {Object}\n * @private\n */\n\nPlayer.prototype.options_ = {\n // Default order of fallback technology\n techOrder: Tech.defaultTechOrder_,\n html5: {},\n // default inactivity timeout\n inactivityTimeout: 2000,\n // default playback rates\n playbackRates: [],\n // Add playback rate selection by adding rates\n // 'playbackRates': [0.5, 1, 1.5, 2],\n liveui: false,\n // Included control sets\n children: ['mediaLoader', 'posterImage', 'textTrackDisplay', 'loadingSpinner', 'bigPlayButton', 'liveTracker', 'controlBar', 'errorDisplay', 'textTrackSettings', 'resizeManager'],\n language: navigator && (navigator.languages && navigator.languages[0] || navigator.userLanguage || navigator.language) || 'en',\n // locales and their language translations\n languages: {},\n // Default message to show when a video cannot be played.\n notSupportedMessage: 'No compatible source was found for this media.',\n normalizeAutoplay: false,\n fullscreen: {\n options: {\n navigationUI: 'hide'\n }\n },\n breakpoints: {},\n responsive: false,\n audioOnlyMode: false,\n audioPosterMode: false\n};\n[\n/**\n * Returns whether or not the player is in the \"ended\" state.\n *\n * @return {Boolean} True if the player is in the ended state, false if not.\n * @method Player#ended\n */\n'ended',\n/**\n * Returns whether or not the player is in the \"seeking\" state.\n *\n * @return {Boolean} True if the player is in the seeking state, false if not.\n * @method Player#seeking\n */\n'seeking',\n/**\n * Returns the TimeRanges of the media that are currently available\n * for seeking to.\n *\n * @return {TimeRanges} the seekable intervals of the media timeline\n * @method Player#seekable\n */\n'seekable',\n/**\n * Returns the current state of network activity for the element, from\n * the codes in the list below.\n * - NETWORK_EMPTY (numeric value 0)\n * The element has not yet been initialised. All attributes are in\n * their initial states.\n * - NETWORK_IDLE (numeric value 1)\n * The element's resource selection algorithm is active and has\n * selected a resource, but it is not actually using the network at\n * this time.\n * - NETWORK_LOADING (numeric value 2)\n * The user agent is actively trying to download data.\n * - NETWORK_NO_SOURCE (numeric value 3)\n * The element's resource selection algorithm is active, but it has\n * not yet found a resource to use.\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#network-states\n * @return {number} the current network activity state\n * @method Player#networkState\n */\n'networkState',\n/**\n * Returns a value that expresses the current state of the element\n * with respect to rendering the current playback position, from the\n * codes in the list below.\n * - HAVE_NOTHING (numeric value 0)\n * No information regarding the media resource is available.\n * - HAVE_METADATA (numeric value 1)\n * Enough of the resource has been obtained that the duration of the\n * resource is available.\n * - HAVE_CURRENT_DATA (numeric value 2)\n * Data for the immediate current playback position is available.\n * - HAVE_FUTURE_DATA (numeric value 3)\n * Data for the immediate current playback position is available, as\n * well as enough data for the user agent to advance the current\n * playback position in the direction of playback.\n * - HAVE_ENOUGH_DATA (numeric value 4)\n * The user agent estimates that enough data is available for\n * playback to proceed uninterrupted.\n *\n * @see https://html.spec.whatwg.org/multipage/embedded-content.html#dom-media-readystate\n * @return {number} the current playback rendering state\n * @method Player#readyState\n */\n'readyState'].forEach(function (fn) {\n Player.prototype[fn] = function () {\n return this.techGet_(fn);\n };\n});\nTECH_EVENTS_RETRIGGER.forEach(function (event) {\n Player.prototype[\"handleTech\" + toTitleCase$1(event) + \"_\"] = function () {\n return this.trigger(event);\n };\n});\n/**\n * Fired when the player has initial duration and dimension information\n *\n * @event Player#loadedmetadata\n * @type {EventTarget~Event}\n */\n\n/**\n * Fired when the player has downloaded data at the current playback position\n *\n * @event Player#loadeddata\n * @type {EventTarget~Event}\n */\n\n/**\n * Fired when the current playback position has changed *\n * During playback this is fired every 15-250 milliseconds, depending on the\n * playback technology in use.\n *\n * @event Player#timeupdate\n * @type {EventTarget~Event}\n */\n\n/**\n * Fired when the volume changes\n *\n * @event Player#volumechange\n * @type {EventTarget~Event}\n */\n\n/**\n * Reports whether or not a player has a plugin available.\n *\n * This does not report whether or not the plugin has ever been initialized\n * on this player. For that, [usingPlugin]{@link Player#usingPlugin}.\n *\n * @method Player#hasPlugin\n * @param {string} name\n * The name of a plugin.\n *\n * @return {boolean}\n * Whether or not this player has the requested plugin available.\n */\n\n/**\n * Reports whether or not a player is using a plugin by name.\n *\n * For basic plugins, this only reports whether the plugin has _ever_ been\n * initialized on this player.\n *\n * @method Player#usingPlugin\n * @param {string} name\n * The name of a plugin.\n *\n * @return {boolean}\n * Whether or not this player is using the requested plugin.\n */\n\nComponent$1.registerComponent('Player', Player);\n\n/**\n * The base plugin name.\n *\n * @private\n * @constant\n * @type {string}\n */\n\nvar BASE_PLUGIN_NAME = 'plugin';\n/**\n * The key on which a player's active plugins cache is stored.\n *\n * @private\n * @constant\n * @type {string}\n */\n\nvar PLUGIN_CACHE_KEY = 'activePlugins_';\n/**\n * Stores registered plugins in a private space.\n *\n * @private\n * @type {Object}\n */\n\nvar pluginStorage = {};\n/**\n * Reports whether or not a plugin has been registered.\n *\n * @private\n * @param {string} name\n * The name of a plugin.\n *\n * @return {boolean}\n * Whether or not the plugin has been registered.\n */\n\nvar pluginExists = function pluginExists(name) {\n return pluginStorage.hasOwnProperty(name);\n};\n/**\n * Get a single registered plugin by name.\n *\n * @private\n * @param {string} name\n * The name of a plugin.\n *\n * @return {Function|undefined}\n * The plugin (or undefined).\n */\n\n\nvar getPlugin = function getPlugin(name) {\n return pluginExists(name) ? pluginStorage[name] : undefined;\n};\n/**\n * Marks a plugin as \"active\" on a player.\n *\n * Also, ensures that the player has an object for tracking active plugins.\n *\n * @private\n * @param {Player} player\n * A Video.js player instance.\n *\n * @param {string} name\n * The name of a plugin.\n */\n\n\nvar markPluginAsActive = function markPluginAsActive(player, name) {\n player[PLUGIN_CACHE_KEY] = player[PLUGIN_CACHE_KEY] || {};\n player[PLUGIN_CACHE_KEY][name] = true;\n};\n/**\n * Triggers a pair of plugin setup events.\n *\n * @private\n * @param {Player} player\n * A Video.js player instance.\n *\n * @param {Plugin~PluginEventHash} hash\n * A plugin event hash.\n *\n * @param {boolean} [before]\n * If true, prefixes the event name with \"before\". In other words,\n * use this to trigger \"beforepluginsetup\" instead of \"pluginsetup\".\n */\n\n\nvar triggerSetupEvent = function triggerSetupEvent(player, hash, before) {\n var eventName = (before ? 'before' : '') + 'pluginsetup';\n player.trigger(eventName, hash);\n player.trigger(eventName + ':' + hash.name, hash);\n};\n/**\n * Takes a basic plugin function and returns a wrapper function which marks\n * on the player that the plugin has been activated.\n *\n * @private\n * @param {string} name\n * The name of the plugin.\n *\n * @param {Function} plugin\n * The basic plugin.\n *\n * @return {Function}\n * A wrapper function for the given plugin.\n */\n\n\nvar createBasicPlugin = function createBasicPlugin(name, plugin) {\n var basicPluginWrapper = function basicPluginWrapper() {\n // We trigger the \"beforepluginsetup\" and \"pluginsetup\" events on the player\n // regardless, but we want the hash to be consistent with the hash provided\n // for advanced plugins.\n //\n // The only potentially counter-intuitive thing here is the `instance` in\n // the \"pluginsetup\" event is the value returned by the `plugin` function.\n triggerSetupEvent(this, {\n name: name,\n plugin: plugin,\n instance: null\n }, true);\n var instance = plugin.apply(this, arguments);\n markPluginAsActive(this, name);\n triggerSetupEvent(this, {\n name: name,\n plugin: plugin,\n instance: instance\n });\n return instance;\n };\n\n Object.keys(plugin).forEach(function (prop) {\n basicPluginWrapper[prop] = plugin[prop];\n });\n return basicPluginWrapper;\n};\n/**\n * Takes a plugin sub-class and returns a factory function for generating\n * instances of it.\n *\n * This factory function will replace itself with an instance of the requested\n * sub-class of Plugin.\n *\n * @private\n * @param {string} name\n * The name of the plugin.\n *\n * @param {Plugin} PluginSubClass\n * The advanced plugin.\n *\n * @return {Function}\n */\n\n\nvar createPluginFactory = function createPluginFactory(name, PluginSubClass) {\n // Add a `name` property to the plugin prototype so that each plugin can\n // refer to itself by name.\n PluginSubClass.prototype.name = name;\n return function () {\n triggerSetupEvent(this, {\n name: name,\n plugin: PluginSubClass,\n instance: null\n }, true);\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var instance = (0,_babel_runtime_helpers_construct__WEBPACK_IMPORTED_MODULE_9__[\"default\"])(PluginSubClass, [this].concat(args)); // The plugin is replaced by a function that returns the current instance.\n\n\n this[name] = function () {\n return instance;\n };\n\n triggerSetupEvent(this, instance.getEventHash());\n return instance;\n };\n};\n/**\n * Parent class for all advanced plugins.\n *\n * @mixes module:evented~EventedMixin\n * @mixes module:stateful~StatefulMixin\n * @fires Player#beforepluginsetup\n * @fires Player#beforepluginsetup:$name\n * @fires Player#pluginsetup\n * @fires Player#pluginsetup:$name\n * @listens Player#dispose\n * @throws {Error}\n * If attempting to instantiate the base {@link Plugin} class\n * directly instead of via a sub-class.\n */\n\n\nvar Plugin = /*#__PURE__*/function () {\n /**\n * Creates an instance of this class.\n *\n * Sub-classes should call `super` to ensure plugins are properly initialized.\n *\n * @param {Player} player\n * A Video.js player instance.\n */\n function Plugin(player) {\n if (this.constructor === Plugin) {\n throw new Error('Plugin must be sub-classed; not directly instantiated.');\n }\n\n this.player = player;\n\n if (!this.log) {\n this.log = this.player.log.createLogger(this.name);\n } // Make this object evented, but remove the added `trigger` method so we\n // use the prototype version instead.\n\n\n evented(this);\n delete this.trigger;\n stateful(this, this.constructor.defaultState);\n markPluginAsActive(player, this.name); // Auto-bind the dispose method so we can use it as a listener and unbind\n // it later easily.\n\n this.dispose = this.dispose.bind(this); // If the player is disposed, dispose the plugin.\n\n player.on('dispose', this.dispose);\n }\n /**\n * Get the version of the plugin that was set on <pluginName>.VERSION\n */\n\n\n var _proto = Plugin.prototype;\n\n _proto.version = function version() {\n return this.constructor.VERSION;\n }\n /**\n * Each event triggered by plugins includes a hash of additional data with\n * conventional properties.\n *\n * This returns that object or mutates an existing hash.\n *\n * @param {Object} [hash={}]\n * An object to be used as event an event hash.\n *\n * @return {Plugin~PluginEventHash}\n * An event hash object with provided properties mixed-in.\n */\n ;\n\n _proto.getEventHash = function getEventHash(hash) {\n if (hash === void 0) {\n hash = {};\n }\n\n hash.name = this.name;\n hash.plugin = this.constructor;\n hash.instance = this;\n return hash;\n }\n /**\n * Triggers an event on the plugin object and overrides\n * {@link module:evented~EventedMixin.trigger|EventedMixin.trigger}.\n *\n * @param {string|Object} event\n * An event type or an object with a type property.\n *\n * @param {Object} [hash={}]\n * Additional data hash to merge with a\n * {@link Plugin~PluginEventHash|PluginEventHash}.\n *\n * @return {boolean}\n * Whether or not default was prevented.\n */\n ;\n\n _proto.trigger = function trigger$1(event, hash) {\n if (hash === void 0) {\n hash = {};\n }\n\n return trigger(this.eventBusEl_, event, this.getEventHash(hash));\n }\n /**\n * Handles \"statechanged\" events on the plugin. No-op by default, override by\n * subclassing.\n *\n * @abstract\n * @param {Event} e\n * An event object provided by a \"statechanged\" event.\n *\n * @param {Object} e.changes\n * An object describing changes that occurred with the \"statechanged\"\n * event.\n */\n ;\n\n _proto.handleStateChanged = function handleStateChanged(e) {}\n /**\n * Disposes a plugin.\n *\n * Subclasses can override this if they want, but for the sake of safety,\n * it's probably best to subscribe the \"dispose\" event.\n *\n * @fires Plugin#dispose\n */\n ;\n\n _proto.dispose = function dispose() {\n var name = this.name,\n player = this.player;\n /**\n * Signals that a advanced plugin is about to be disposed.\n *\n * @event Plugin#dispose\n * @type {EventTarget~Event}\n */\n\n this.trigger('dispose');\n this.off();\n player.off('dispose', this.dispose); // Eliminate any possible sources of leaking memory by clearing up\n // references between the player and the plugin instance and nulling out\n // the plugin's state and replacing methods with a function that throws.\n\n player[PLUGIN_CACHE_KEY][name] = false;\n this.player = this.state = null; // Finally, replace the plugin name on the player with a new factory\n // function, so that the plugin is ready to be set up again.\n\n player[name] = createPluginFactory(name, pluginStorage[name]);\n }\n /**\n * Determines if a plugin is a basic plugin (i.e. not a sub-class of `Plugin`).\n *\n * @param {string|Function} plugin\n * If a string, matches the name of a plugin. If a function, will be\n * tested directly.\n *\n * @return {boolean}\n * Whether or not a plugin is a basic plugin.\n */\n ;\n\n Plugin.isBasic = function isBasic(plugin) {\n var p = typeof plugin === 'string' ? getPlugin(plugin) : plugin;\n return typeof p === 'function' && !Plugin.prototype.isPrototypeOf(p.prototype);\n }\n /**\n * Register a Video.js plugin.\n *\n * @param {string} name\n * The name of the plugin to be registered. Must be a string and\n * must not match an existing plugin or a method on the `Player`\n * prototype.\n *\n * @param {Function} plugin\n * A sub-class of `Plugin` or a function for basic plugins.\n *\n * @return {Function}\n * For advanced plugins, a factory function for that plugin. For\n * basic plugins, a wrapper function that initializes the plugin.\n */\n ;\n\n Plugin.registerPlugin = function registerPlugin(name, plugin) {\n if (typeof name !== 'string') {\n throw new Error(\"Illegal plugin name, \\\"\" + name + \"\\\", must be a string, was \" + typeof name + \".\");\n }\n\n if (pluginExists(name)) {\n log$1.warn(\"A plugin named \\\"\" + name + \"\\\" already exists. You may want to avoid re-registering plugins!\");\n } else if (Player.prototype.hasOwnProperty(name)) {\n throw new Error(\"Illegal plugin name, \\\"\" + name + \"\\\", cannot share a name with an existing player method!\");\n }\n\n if (typeof plugin !== 'function') {\n throw new Error(\"Illegal plugin for \\\"\" + name + \"\\\", must be a function, was \" + typeof plugin + \".\");\n }\n\n pluginStorage[name] = plugin; // Add a player prototype method for all sub-classed plugins (but not for\n // the base Plugin class).\n\n if (name !== BASE_PLUGIN_NAME) {\n if (Plugin.isBasic(plugin)) {\n Player.prototype[name] = createBasicPlugin(name, plugin);\n } else {\n Player.prototype[name] = createPluginFactory(name, plugin);\n }\n }\n\n return plugin;\n }\n /**\n * De-register a Video.js plugin.\n *\n * @param {string} name\n * The name of the plugin to be de-registered. Must be a string that\n * matches an existing plugin.\n *\n * @throws {Error}\n * If an attempt is made to de-register the base plugin.\n */\n ;\n\n Plugin.deregisterPlugin = function deregisterPlugin(name) {\n if (name === BASE_PLUGIN_NAME) {\n throw new Error('Cannot de-register base plugin.');\n }\n\n if (pluginExists(name)) {\n delete pluginStorage[name];\n delete Player.prototype[name];\n }\n }\n /**\n * Gets an object containing multiple Video.js plugins.\n *\n * @param {Array} [names]\n * If provided, should be an array of plugin names. Defaults to _all_\n * plugin names.\n *\n * @return {Object|undefined}\n * An object containing plugin(s) associated with their name(s) or\n * `undefined` if no matching plugins exist).\n */\n ;\n\n Plugin.getPlugins = function getPlugins(names) {\n if (names === void 0) {\n names = Object.keys(pluginStorage);\n }\n\n var result;\n names.forEach(function (name) {\n var plugin = getPlugin(name);\n\n if (plugin) {\n result = result || {};\n result[name] = plugin;\n }\n });\n return result;\n }\n /**\n * Gets a plugin's version, if available\n *\n * @param {string} name\n * The name of a plugin.\n *\n * @return {string}\n * The plugin's version or an empty string.\n */\n ;\n\n Plugin.getPluginVersion = function getPluginVersion(name) {\n var plugin = getPlugin(name);\n return plugin && plugin.VERSION || '';\n };\n\n return Plugin;\n}();\n/**\n * Gets a plugin by name if it exists.\n *\n * @static\n * @method getPlugin\n * @memberOf Plugin\n * @param {string} name\n * The name of a plugin.\n *\n * @returns {Function|undefined}\n * The plugin (or `undefined`).\n */\n\n\nPlugin.getPlugin = getPlugin;\n/**\n * The name of the base plugin class as it is registered.\n *\n * @type {string}\n */\n\nPlugin.BASE_PLUGIN_NAME = BASE_PLUGIN_NAME;\nPlugin.registerPlugin(BASE_PLUGIN_NAME, Plugin);\n/**\n * Documented in player.js\n *\n * @ignore\n */\n\nPlayer.prototype.usingPlugin = function (name) {\n return !!this[PLUGIN_CACHE_KEY] && this[PLUGIN_CACHE_KEY][name] === true;\n};\n/**\n * Documented in player.js\n *\n * @ignore\n */\n\n\nPlayer.prototype.hasPlugin = function (name) {\n return !!pluginExists(name);\n};\n/**\n * Signals that a plugin is about to be set up on a player.\n *\n * @event Player#beforepluginsetup\n * @type {Plugin~PluginEventHash}\n */\n\n/**\n * Signals that a plugin is about to be set up on a player - by name. The name\n * is the name of the plugin.\n *\n * @event Player#beforepluginsetup:$name\n * @type {Plugin~PluginEventHash}\n */\n\n/**\n * Signals that a plugin has just been set up on a player.\n *\n * @event Player#pluginsetup\n * @type {Plugin~PluginEventHash}\n */\n\n/**\n * Signals that a plugin has just been set up on a player - by name. The name\n * is the name of the plugin.\n *\n * @event Player#pluginsetup:$name\n * @type {Plugin~PluginEventHash}\n */\n\n/**\n * @typedef {Object} Plugin~PluginEventHash\n *\n * @property {string} instance\n * For basic plugins, the return value of the plugin function. For\n * advanced plugins, the plugin instance on which the event is fired.\n *\n * @property {string} name\n * The name of the plugin.\n *\n * @property {string} plugin\n * For basic plugins, the plugin function. For advanced plugins, the\n * plugin class/constructor.\n */\n\n/**\n * @file extend.js\n * @module extend\n */\nvar hasLogged = false;\n/**\n * Used to subclass an existing class by emulating ES subclassing using the\n * `extends` keyword.\n *\n * @function\n * @deprecated\n * @example\n * var MyComponent = videojs.extend(videojs.getComponent('Component'), {\n * myCustomMethod: function() {\n * // Do things in my method.\n * }\n * });\n *\n * @param {Function} superClass\n * The class to inherit from\n *\n * @param {Object} [subClassMethods={}]\n * Methods of the new class\n *\n * @return {Function}\n * The new class with subClassMethods that inherited superClass.\n */\n\nvar extend = function extend(superClass, subClassMethods) {\n if (subClassMethods === void 0) {\n subClassMethods = {};\n }\n\n // Log a warning the first time extend is called to note that it is deprecated\n // It was previously deprecated in our documentation (guides, specifically),\n // but was never formally deprecated in code.\n if (!hasLogged) {\n log$1.warn('videojs.extend is deprecated as of Video.js 7.22.0 and will be removed in Video.js 8.0.0');\n hasLogged = true;\n }\n\n var subClass = function subClass() {\n superClass.apply(this, arguments);\n };\n\n var methods = {};\n\n if (typeof subClassMethods === 'object') {\n if (subClassMethods.constructor !== Object.prototype.constructor) {\n subClass = subClassMethods.constructor;\n }\n\n methods = subClassMethods;\n } else if (typeof subClassMethods === 'function') {\n subClass = subClassMethods;\n }\n\n (0,_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_10__[\"default\"])(subClass, superClass); // this is needed for backward-compatibility and node compatibility.\n\n\n if (superClass) {\n subClass.super_ = superClass;\n } // Extend subObj's prototype with functions and other properties from props\n\n\n for (var name in methods) {\n if (methods.hasOwnProperty(name)) {\n subClass.prototype[name] = methods[name];\n }\n }\n\n return subClass;\n};\n\n/**\n * @file video.js\n * @module videojs\n */\n/**\n * Normalize an `id` value by trimming off a leading `#`\n *\n * @private\n * @param {string} id\n * A string, maybe with a leading `#`.\n *\n * @return {string}\n * The string, without any leading `#`.\n */\n\nvar normalizeId = function normalizeId(id) {\n return id.indexOf('#') === 0 ? id.slice(1) : id;\n};\n/**\n * The `videojs()` function doubles as the main function for users to create a\n * {@link Player} instance as well as the main library namespace.\n *\n * It can also be used as a getter for a pre-existing {@link Player} instance.\n * However, we _strongly_ recommend using `videojs.getPlayer()` for this\n * purpose because it avoids any potential for unintended initialization.\n *\n * Due to [limitations](https://github.com/jsdoc3/jsdoc/issues/955#issuecomment-313829149)\n * of our JSDoc template, we cannot properly document this as both a function\n * and a namespace, so its function signature is documented here.\n *\n * #### Arguments\n * ##### id\n * string|Element, **required**\n *\n * Video element or video element ID.\n *\n * ##### options\n * Object, optional\n *\n * Options object for providing settings.\n * See: [Options Guide](https://docs.videojs.com/tutorial-options.html).\n *\n * ##### ready\n * {@link Component~ReadyCallback}, optional\n *\n * A function to be called when the {@link Player} and {@link Tech} are ready.\n *\n * #### Return Value\n *\n * The `videojs()` function returns a {@link Player} instance.\n *\n * @namespace\n *\n * @borrows AudioTrack as AudioTrack\n * @borrows Component.getComponent as getComponent\n * @borrows module:computed-style~computedStyle as computedStyle\n * @borrows module:events.on as on\n * @borrows module:events.one as one\n * @borrows module:events.off as off\n * @borrows module:events.trigger as trigger\n * @borrows EventTarget as EventTarget\n * @borrows module:extend~extend as extend\n * @borrows module:fn.bind as bind\n * @borrows module:format-time.formatTime as formatTime\n * @borrows module:format-time.resetFormatTime as resetFormatTime\n * @borrows module:format-time.setFormatTime as setFormatTime\n * @borrows module:merge-options.mergeOptions as mergeOptions\n * @borrows module:middleware.use as use\n * @borrows Player.players as players\n * @borrows Plugin.registerPlugin as registerPlugin\n * @borrows Plugin.deregisterPlugin as deregisterPlugin\n * @borrows Plugin.getPlugins as getPlugins\n * @borrows Plugin.getPlugin as getPlugin\n * @borrows Plugin.getPluginVersion as getPluginVersion\n * @borrows Tech.getTech as getTech\n * @borrows Tech.registerTech as registerTech\n * @borrows TextTrack as TextTrack\n * @borrows module:time-ranges.createTimeRanges as createTimeRange\n * @borrows module:time-ranges.createTimeRanges as createTimeRanges\n * @borrows module:url.isCrossOrigin as isCrossOrigin\n * @borrows module:url.parseUrl as parseUrl\n * @borrows VideoTrack as VideoTrack\n *\n * @param {string|Element} id\n * Video element or video element ID.\n *\n * @param {Object} [options]\n * Options object for providing settings.\n * See: [Options Guide](https://docs.videojs.com/tutorial-options.html).\n *\n * @param {Component~ReadyCallback} [ready]\n * A function to be called when the {@link Player} and {@link Tech} are\n * ready.\n *\n * @return {Player}\n * The `videojs()` function returns a {@link Player|Player} instance.\n */\n\n\nfunction videojs(id, options, ready) {\n var player = videojs.getPlayer(id);\n\n if (player) {\n if (options) {\n log$1.warn(\"Player \\\"\" + id + \"\\\" is already initialised. Options will not be applied.\");\n }\n\n if (ready) {\n player.ready(ready);\n }\n\n return player;\n }\n\n var el = typeof id === 'string' ? $('#' + normalizeId(id)) : id;\n\n if (!isEl(el)) {\n throw new TypeError('The element or ID supplied is not valid. (videojs)');\n } // document.body.contains(el) will only check if el is contained within that one document.\n // This causes problems for elements in iframes.\n // Instead, use the element's ownerDocument instead of the global document.\n // This will make sure that the element is indeed in the dom of that document.\n // Additionally, check that the document in question has a default view.\n // If the document is no longer attached to the dom, the defaultView of the document will be null.\n\n\n if (!el.ownerDocument.defaultView || !el.ownerDocument.body.contains(el)) {\n log$1.warn('The element supplied is not included in the DOM');\n }\n\n options = options || {}; // Store a copy of the el before modification, if it is to be restored in destroy()\n // If div ingest, store the parent div\n\n if (options.restoreEl === true) {\n options.restoreEl = (el.parentNode && el.parentNode.hasAttribute('data-vjs-player') ? el.parentNode : el).cloneNode(true);\n }\n\n hooks('beforesetup').forEach(function (hookFunction) {\n var opts = hookFunction(el, mergeOptions$3(options));\n\n if (!isObject(opts) || Array.isArray(opts)) {\n log$1.error('please return an object in beforesetup hooks');\n return;\n }\n\n options = mergeOptions$3(options, opts);\n }); // We get the current \"Player\" component here in case an integration has\n // replaced it with a custom player.\n\n var PlayerComponent = Component$1.getComponent('Player');\n player = new PlayerComponent(el, options, ready);\n hooks('setup').forEach(function (hookFunction) {\n return hookFunction(player);\n });\n return player;\n}\n\nvideojs.hooks_ = hooks_;\nvideojs.hooks = hooks;\nvideojs.hook = hook;\nvideojs.hookOnce = hookOnce;\nvideojs.removeHook = removeHook; // Add default styles\n\nif ((global_window__WEBPACK_IMPORTED_MODULE_0___default().VIDEOJS_NO_DYNAMIC_STYLE) !== true && isReal()) {\n var style = $('.vjs-styles-defaults');\n\n if (!style) {\n style = createStyleElement('vjs-styles-defaults');\n var head = $('head');\n\n if (head) {\n head.insertBefore(style, head.firstChild);\n }\n\n setTextContent(style, \"\\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 \");\n }\n} // Run Auto-load players\n// You have to wait at least once in case this script is loaded after your\n// video in the DOM (weird behavior only with minified version)\n\n\nautoSetupTimeout(1, videojs);\n/**\n * Current Video.js version. Follows [semantic versioning](https://semver.org/).\n *\n * @type {string}\n */\n\nvideojs.VERSION = version$5;\n/**\n * The global options object. These are the settings that take effect\n * if no overrides are specified when the player is created.\n *\n * @type {Object}\n */\n\nvideojs.options = Player.prototype.options_;\n/**\n * Get an object with the currently created players, keyed by player ID\n *\n * @return {Object}\n * The created players\n */\n\nvideojs.getPlayers = function () {\n return Player.players;\n};\n/**\n * Get a single player based on an ID or DOM element.\n *\n * This is useful if you want to check if an element or ID has an associated\n * Video.js player, but not create one if it doesn't.\n *\n * @param {string|Element} id\n * An HTML element - `<video>`, `<audio>`, or `<video-js>` -\n * or a string matching the `id` of such an element.\n *\n * @return {Player|undefined}\n * A player instance or `undefined` if there is no player instance\n * matching the argument.\n */\n\n\nvideojs.getPlayer = function (id) {\n var players = Player.players;\n var tag;\n\n if (typeof id === 'string') {\n var nId = normalizeId(id);\n var player = players[nId];\n\n if (player) {\n return player;\n }\n\n tag = $('#' + nId);\n } else {\n tag = id;\n }\n\n if (isEl(tag)) {\n var _tag = tag,\n _player = _tag.player,\n playerId = _tag.playerId; // Element may have a `player` property referring to an already created\n // player instance. If so, return that.\n\n if (_player || players[playerId]) {\n return _player || players[playerId];\n }\n }\n};\n/**\n * Returns an array of all current players.\n *\n * @return {Array}\n * An array of all players. The array will be in the order that\n * `Object.keys` provides, which could potentially vary between\n * JavaScript engines.\n *\n */\n\n\nvideojs.getAllPlayers = function () {\n return (// Disposed players leave a key with a `null` value, so we need to make sure\n // we filter those out.\n Object.keys(Player.players).map(function (k) {\n return Player.players[k];\n }).filter(Boolean)\n );\n};\n\nvideojs.players = Player.players;\nvideojs.getComponent = Component$1.getComponent;\n/**\n * Register a component so it can referred to by name. Used when adding to other\n * components, either through addChild `component.addChild('myComponent')` or through\n * default children options `{ children: ['myComponent'] }`.\n *\n * > NOTE: You could also just initialize the component before adding.\n * `component.addChild(new MyComponent());`\n *\n * @param {string} name\n * The class name of the component\n *\n * @param {Component} comp\n * The component class\n *\n * @return {Component}\n * The newly registered component\n */\n\nvideojs.registerComponent = function (name, comp) {\n if (Tech.isTech(comp)) {\n log$1.warn(\"The \" + name + \" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)\");\n }\n\n Component$1.registerComponent.call(Component$1, name, comp);\n};\n\nvideojs.getTech = Tech.getTech;\nvideojs.registerTech = Tech.registerTech;\nvideojs.use = use;\n/**\n * An object that can be returned by a middleware to signify\n * that the middleware is being terminated.\n *\n * @type {object}\n * @property {object} middleware.TERMINATOR\n */\n\nObject.defineProperty(videojs, 'middleware', {\n value: {},\n writeable: false,\n enumerable: true\n});\nObject.defineProperty(videojs.middleware, 'TERMINATOR', {\n value: TERMINATOR,\n writeable: false,\n enumerable: true\n});\n/**\n * A reference to the {@link module:browser|browser utility module} as an object.\n *\n * @type {Object}\n * @see {@link module:browser|browser}\n */\n\nvideojs.browser = browser;\n/**\n * Use {@link module:browser.TOUCH_ENABLED|browser.TOUCH_ENABLED} instead; only\n * included for backward-compatibility with 4.x.\n *\n * @deprecated Since version 5.0, use {@link module:browser.TOUCH_ENABLED|browser.TOUCH_ENABLED instead.\n * @type {boolean}\n */\n\nvideojs.TOUCH_ENABLED = TOUCH_ENABLED;\nvideojs.extend = extend;\nvideojs.mergeOptions = mergeOptions$3;\nvideojs.bind = bind;\nvideojs.registerPlugin = Plugin.registerPlugin;\nvideojs.deregisterPlugin = Plugin.deregisterPlugin;\n/**\n * Deprecated method to register a plugin with Video.js\n *\n * @deprecated videojs.plugin() is deprecated; use videojs.registerPlugin() instead\n *\n * @param {string} name\n * The plugin name\n *\n * @param {Plugin|Function} plugin\n * The plugin sub-class or function\n */\n\nvideojs.plugin = function (name, plugin) {\n log$1.warn('videojs.plugin() is deprecated; use videojs.registerPlugin() instead');\n return Plugin.registerPlugin(name, plugin);\n};\n\nvideojs.getPlugins = Plugin.getPlugins;\nvideojs.getPlugin = Plugin.getPlugin;\nvideojs.getPluginVersion = Plugin.getPluginVersion;\n/**\n * Adding languages so that they're available to all players.\n * Example: `videojs.addLanguage('es', { 'Hello': 'Hola' });`\n *\n * @param {string} code\n * The language code or dictionary property\n *\n * @param {Object} data\n * The data values to be translated\n *\n * @return {Object}\n * The resulting language dictionary object\n */\n\nvideojs.addLanguage = function (code, data) {\n var _mergeOptions;\n\n code = ('' + code).toLowerCase();\n videojs.options.languages = mergeOptions$3(videojs.options.languages, (_mergeOptions = {}, _mergeOptions[code] = data, _mergeOptions));\n return videojs.options.languages[code];\n};\n/**\n * A reference to the {@link module:log|log utility module} as an object.\n *\n * @type {Function}\n * @see {@link module:log|log}\n */\n\n\nvideojs.log = log$1;\nvideojs.createLogger = createLogger;\nvideojs.createTimeRange = videojs.createTimeRanges = createTimeRanges;\nvideojs.formatTime = formatTime;\nvideojs.setFormatTime = setFormatTime;\nvideojs.resetFormatTime = resetFormatTime;\nvideojs.parseUrl = parseUrl;\nvideojs.isCrossOrigin = isCrossOrigin;\nvideojs.EventTarget = EventTarget$2;\nvideojs.on = on;\nvideojs.one = one;\nvideojs.off = off;\nvideojs.trigger = trigger;\n/**\n * A cross-browser XMLHttpRequest wrapper.\n *\n * @function\n * @param {Object} options\n * Settings for the request.\n *\n * @return {XMLHttpRequest|XDomainRequest}\n * The request object.\n *\n * @see https://github.com/Raynos/xhr\n */\n\nvideojs.xhr = (_videojs_xhr__WEBPACK_IMPORTED_MODULE_7___default());\nvideojs.TextTrack = TextTrack;\nvideojs.AudioTrack = AudioTrack;\nvideojs.VideoTrack = VideoTrack;\n['isEl', 'isTextNode', 'createEl', 'hasClass', 'addClass', 'removeClass', 'toggleClass', 'setAttributes', 'getAttributes', 'emptyEl', 'appendContent', 'insertContent'].forEach(function (k) {\n videojs[k] = function () {\n log$1.warn(\"videojs.\" + k + \"() is deprecated; use videojs.dom.\" + k + \"() instead\");\n return Dom[k].apply(null, arguments);\n };\n});\nvideojs.computedStyle = computedStyle;\n/**\n * A reference to the {@link module:dom|DOM utility module} as an object.\n *\n * @type {Object}\n * @see {@link module:dom|dom}\n */\n\nvideojs.dom = Dom;\n/**\n * A reference to the {@link module:url|URL utility module} as an object.\n *\n * @type {Object}\n * @see {@link module:url|url}\n */\n\nvideojs.url = Url;\nvideojs.defineLazyProperty = defineLazyProperty; // Adding less ambiguous text for fullscreen button.\n// In a major update this could become the default text and key.\n\nvideojs.addLanguage('en', {\n 'Non-Fullscreen': 'Exit Fullscreen'\n});\n\n/*! @name @videojs/http-streaming @version 2.16.2 @license Apache-2.0 */\n/**\n * @file resolve-url.js - Handling how URLs are resolved and manipulated\n */\n\nvar resolveUrl = _videojs_vhs_utils_es_resolve_url_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"];\n/**\n * Checks whether xhr request was redirected and returns correct url depending\n * on `handleManifestRedirects` option\n *\n * @api private\n *\n * @param {string} url - an url being requested\n * @param {XMLHttpRequest} req - xhr request result\n *\n * @return {string}\n */\n\nvar resolveManifestRedirect = function resolveManifestRedirect(handleManifestRedirect, url, req) {\n // To understand how the responseURL below is set and generated:\n // - https://fetch.spec.whatwg.org/#concept-response-url\n // - https://fetch.spec.whatwg.org/#atomic-http-redirect-handling\n if (handleManifestRedirect && req && req.responseURL && url !== req.responseURL) {\n return req.responseURL;\n }\n\n return url;\n};\n\nvar logger = function logger(source) {\n if (videojs.log.debug) {\n return videojs.log.debug.bind(videojs, 'VHS:', source + \" >\");\n }\n\n return function () {};\n};\n/**\n * ranges\n *\n * Utilities for working with TimeRanges.\n *\n */\n\n\nvar TIME_FUDGE_FACTOR = 1 / 30; // Comparisons between time values such as current time and the end of the buffered range\n// can be misleading because of precision differences or when the current media has poorly\n// aligned audio and video, which can cause values to be slightly off from what you would\n// expect. This value is what we consider to be safe to use in such comparisons to account\n// for these scenarios.\n\nvar SAFE_TIME_DELTA = TIME_FUDGE_FACTOR * 3;\n\nvar filterRanges = function filterRanges(timeRanges, predicate) {\n var results = [];\n var i;\n\n if (timeRanges && timeRanges.length) {\n // Search for ranges that match the predicate\n for (i = 0; i < timeRanges.length; i++) {\n if (predicate(timeRanges.start(i), timeRanges.end(i))) {\n results.push([timeRanges.start(i), timeRanges.end(i)]);\n }\n }\n }\n\n return videojs.createTimeRanges(results);\n};\n/**\n * Attempts to find the buffered TimeRange that contains the specified\n * time.\n *\n * @param {TimeRanges} buffered - the TimeRanges object to query\n * @param {number} time - the time to filter on.\n * @return {TimeRanges} a new TimeRanges object\n */\n\n\nvar findRange = function findRange(buffered, time) {\n return filterRanges(buffered, function (start, end) {\n return start - SAFE_TIME_DELTA <= time && end + SAFE_TIME_DELTA >= time;\n });\n};\n/**\n * Returns the TimeRanges that begin later than the specified time.\n *\n * @param {TimeRanges} timeRanges - the TimeRanges object to query\n * @param {number} time - the time to filter on.\n * @return {TimeRanges} a new TimeRanges object.\n */\n\n\nvar findNextRange = function findNextRange(timeRanges, time) {\n return filterRanges(timeRanges, function (start) {\n return start - TIME_FUDGE_FACTOR >= time;\n });\n};\n/**\n * Returns gaps within a list of TimeRanges\n *\n * @param {TimeRanges} buffered - the TimeRanges object\n * @return {TimeRanges} a TimeRanges object of gaps\n */\n\n\nvar findGaps = function findGaps(buffered) {\n if (buffered.length < 2) {\n return videojs.createTimeRanges();\n }\n\n var ranges = [];\n\n for (var i = 1; i < buffered.length; i++) {\n var start = buffered.end(i - 1);\n var end = buffered.start(i);\n ranges.push([start, end]);\n }\n\n return videojs.createTimeRanges(ranges);\n};\n/**\n * Calculate the intersection of two TimeRanges\n *\n * @param {TimeRanges} bufferA\n * @param {TimeRanges} bufferB\n * @return {TimeRanges} The interesection of `bufferA` with `bufferB`\n */\n\n\nvar bufferIntersection = function bufferIntersection(bufferA, bufferB) {\n var start = null;\n var end = null;\n var arity = 0;\n var extents = [];\n var ranges = [];\n\n if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) {\n return videojs.createTimeRange();\n } // Handle the case where we have both buffers and create an\n // intersection of the two\n\n\n var count = bufferA.length; // A) Gather up all start and end times\n\n while (count--) {\n extents.push({\n time: bufferA.start(count),\n type: 'start'\n });\n extents.push({\n time: bufferA.end(count),\n type: 'end'\n });\n }\n\n count = bufferB.length;\n\n while (count--) {\n extents.push({\n time: bufferB.start(count),\n type: 'start'\n });\n extents.push({\n time: bufferB.end(count),\n type: 'end'\n });\n } // B) Sort them by time\n\n\n extents.sort(function (a, b) {\n return a.time - b.time;\n }); // C) Go along one by one incrementing arity for start and decrementing\n // arity for ends\n\n for (count = 0; count < extents.length; count++) {\n if (extents[count].type === 'start') {\n arity++; // D) If arity is ever incremented to 2 we are entering an\n // overlapping range\n\n if (arity === 2) {\n start = extents[count].time;\n }\n } else if (extents[count].type === 'end') {\n arity--; // E) If arity is ever decremented to 1 we leaving an\n // overlapping range\n\n if (arity === 1) {\n end = extents[count].time;\n }\n } // F) Record overlapping ranges\n\n\n if (start !== null && end !== null) {\n ranges.push([start, end]);\n start = null;\n end = null;\n }\n }\n\n return videojs.createTimeRanges(ranges);\n};\n/**\n * Gets a human readable string for a TimeRange\n *\n * @param {TimeRange} range\n * @return {string} a human readable string\n */\n\n\nvar printableRange = function printableRange(range) {\n var strArr = [];\n\n if (!range || !range.length) {\n return '';\n }\n\n for (var i = 0; i < range.length; i++) {\n strArr.push(range.start(i) + ' => ' + range.end(i));\n }\n\n return strArr.join(', ');\n};\n/**\n * Calculates the amount of time left in seconds until the player hits the end of the\n * buffer and causes a rebuffer\n *\n * @param {TimeRange} buffered\n * The state of the buffer\n * @param {Numnber} currentTime\n * The current time of the player\n * @param {number} playbackRate\n * The current playback rate of the player. Defaults to 1.\n * @return {number}\n * Time until the player has to start rebuffering in seconds.\n * @function timeUntilRebuffer\n */\n\n\nvar timeUntilRebuffer = function timeUntilRebuffer(buffered, currentTime, playbackRate) {\n if (playbackRate === void 0) {\n playbackRate = 1;\n }\n\n var bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0;\n return (bufferedEnd - currentTime) / playbackRate;\n};\n/**\n * Converts a TimeRanges object into an array representation\n *\n * @param {TimeRanges} timeRanges\n * @return {Array}\n */\n\n\nvar timeRangesToArray = function timeRangesToArray(timeRanges) {\n var timeRangesList = [];\n\n for (var i = 0; i < timeRanges.length; i++) {\n timeRangesList.push({\n start: timeRanges.start(i),\n end: timeRanges.end(i)\n });\n }\n\n return timeRangesList;\n};\n/**\n * Determines if two time range objects are different.\n *\n * @param {TimeRange} a\n * the first time range object to check\n *\n * @param {TimeRange} b\n * the second time range object to check\n *\n * @return {Boolean}\n * Whether the time range objects differ\n */\n\n\nvar isRangeDifferent = function isRangeDifferent(a, b) {\n // same object\n if (a === b) {\n return false;\n } // one or the other is undefined\n\n\n if (!a && b || !b && a) {\n return true;\n } // length is different\n\n\n if (a.length !== b.length) {\n return true;\n } // see if any start/end pair is different\n\n\n for (var i = 0; i < a.length; i++) {\n if (a.start(i) !== b.start(i) || a.end(i) !== b.end(i)) {\n return true;\n }\n } // if the length and every pair is the same\n // this is the same time range\n\n\n return false;\n};\n\nvar lastBufferedEnd = function lastBufferedEnd(a) {\n if (!a || !a.length || !a.end) {\n return;\n }\n\n return a.end(a.length - 1);\n};\n/**\n * A utility function to add up the amount of time in a timeRange\n * after a specified startTime.\n * ie:[[0, 10], [20, 40], [50, 60]] with a startTime 0\n * would return 40 as there are 40s seconds after 0 in the timeRange\n *\n * @param {TimeRange} range\n * The range to check against\n * @param {number} startTime\n * The time in the time range that you should start counting from\n *\n * @return {number}\n * The number of seconds in the buffer passed the specified time.\n */\n\n\nvar timeAheadOf = function timeAheadOf(range, startTime) {\n var time = 0;\n\n if (!range || !range.length) {\n return time;\n }\n\n for (var i = 0; i < range.length; i++) {\n var start = range.start(i);\n var end = range.end(i); // startTime is after this range entirely\n\n if (startTime > end) {\n continue;\n } // startTime is within this range\n\n\n if (startTime > start && startTime <= end) {\n time += end - startTime;\n continue;\n } // startTime is before this range.\n\n\n time += end - start;\n }\n\n return time;\n};\n/**\n * @file playlist.js\n *\n * Playlist related utilities.\n */\n\n\nvar createTimeRange = videojs.createTimeRange;\n/**\n * Get the duration of a segment, with special cases for\n * llhls segments that do not have a duration yet.\n *\n * @param {Object} playlist\n * the playlist that the segment belongs to.\n * @param {Object} segment\n * the segment to get a duration for.\n *\n * @return {number}\n * the segment duration\n */\n\nvar segmentDurationWithParts = function segmentDurationWithParts(playlist, segment) {\n // if this isn't a preload segment\n // then we will have a segment duration that is accurate.\n if (!segment.preload) {\n return segment.duration;\n } // otherwise we have to add up parts and preload hints\n // to get an up to date duration.\n\n\n var result = 0;\n (segment.parts || []).forEach(function (p) {\n result += p.duration;\n }); // for preload hints we have to use partTargetDuration\n // as they won't even have a duration yet.\n\n (segment.preloadHints || []).forEach(function (p) {\n if (p.type === 'PART') {\n result += playlist.partTargetDuration;\n }\n });\n return result;\n};\n/**\n * A function to get a combined list of parts and segments with durations\n * and indexes.\n *\n * @param {Playlist} playlist the playlist to get the list for.\n *\n * @return {Array} The part/segment list.\n */\n\n\nvar getPartsAndSegments = function getPartsAndSegments(playlist) {\n return (playlist.segments || []).reduce(function (acc, segment, si) {\n if (segment.parts) {\n segment.parts.forEach(function (part, pi) {\n acc.push({\n duration: part.duration,\n segmentIndex: si,\n partIndex: pi,\n part: part,\n segment: segment\n });\n });\n } else {\n acc.push({\n duration: segment.duration,\n segmentIndex: si,\n partIndex: null,\n segment: segment,\n part: null\n });\n }\n\n return acc;\n }, []);\n};\n\nvar getLastParts = function getLastParts(media) {\n var lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1];\n return lastSegment && lastSegment.parts || [];\n};\n\nvar getKnownPartCount = function getKnownPartCount(_ref) {\n var preloadSegment = _ref.preloadSegment;\n\n if (!preloadSegment) {\n return;\n }\n\n var parts = preloadSegment.parts,\n preloadHints = preloadSegment.preloadHints;\n var partCount = (preloadHints || []).reduce(function (count, hint) {\n return count + (hint.type === 'PART' ? 1 : 0);\n }, 0);\n partCount += parts && parts.length ? parts.length : 0;\n return partCount;\n};\n/**\n * Get the number of seconds to delay from the end of a\n * live playlist.\n *\n * @param {Playlist} master the master playlist\n * @param {Playlist} media the media playlist\n * @return {number} the hold back in seconds.\n */\n\n\nvar liveEdgeDelay = function liveEdgeDelay(master, media) {\n if (media.endList) {\n return 0;\n } // dash suggestedPresentationDelay trumps everything\n\n\n if (master && master.suggestedPresentationDelay) {\n return master.suggestedPresentationDelay;\n }\n\n var hasParts = getLastParts(media).length > 0; // look for \"part\" delays from ll-hls first\n\n if (hasParts && media.serverControl && media.serverControl.partHoldBack) {\n return media.serverControl.partHoldBack;\n } else if (hasParts && media.partTargetDuration) {\n return media.partTargetDuration * 3; // finally look for full segment delays\n } else if (media.serverControl && media.serverControl.holdBack) {\n return media.serverControl.holdBack;\n } else if (media.targetDuration) {\n return media.targetDuration * 3;\n }\n\n return 0;\n};\n/**\n * walk backward until we find a duration we can use\n * or return a failure\n *\n * @param {Playlist} playlist the playlist to walk through\n * @param {Number} endSequence the mediaSequence to stop walking on\n */\n\n\nvar backwardDuration = function backwardDuration(playlist, endSequence) {\n var result = 0;\n var i = endSequence - playlist.mediaSequence; // if a start time is available for segment immediately following\n // the interval, use it\n\n var segment = playlist.segments[i]; // Walk backward until we find the latest segment with timeline\n // information that is earlier than endSequence\n\n if (segment) {\n if (typeof segment.start !== 'undefined') {\n return {\n result: segment.start,\n precise: true\n };\n }\n\n if (typeof segment.end !== 'undefined') {\n return {\n result: segment.end - segment.duration,\n precise: true\n };\n }\n }\n\n while (i--) {\n segment = playlist.segments[i];\n\n if (typeof segment.end !== 'undefined') {\n return {\n result: result + segment.end,\n precise: true\n };\n }\n\n result += segmentDurationWithParts(playlist, segment);\n\n if (typeof segment.start !== 'undefined') {\n return {\n result: result + segment.start,\n precise: true\n };\n }\n }\n\n return {\n result: result,\n precise: false\n };\n};\n/**\n * walk forward until we find a duration we can use\n * or return a failure\n *\n * @param {Playlist} playlist the playlist to walk through\n * @param {number} endSequence the mediaSequence to stop walking on\n */\n\n\nvar forwardDuration = function forwardDuration(playlist, endSequence) {\n var result = 0;\n var segment;\n var i = endSequence - playlist.mediaSequence; // Walk forward until we find the earliest segment with timeline\n // information\n\n for (; i < playlist.segments.length; i++) {\n segment = playlist.segments[i];\n\n if (typeof segment.start !== 'undefined') {\n return {\n result: segment.start - result,\n precise: true\n };\n }\n\n result += segmentDurationWithParts(playlist, segment);\n\n if (typeof segment.end !== 'undefined') {\n return {\n result: segment.end - result,\n precise: true\n };\n }\n } // indicate we didn't find a useful duration estimate\n\n\n return {\n result: -1,\n precise: false\n };\n};\n/**\n * Calculate the media duration from the segments associated with a\n * playlist. The duration of a subinterval of the available segments\n * may be calculated by specifying an end index.\n *\n * @param {Object} playlist a media playlist object\n * @param {number=} endSequence an exclusive upper boundary\n * for the playlist. Defaults to playlist length.\n * @param {number} expired the amount of time that has dropped\n * off the front of the playlist in a live scenario\n * @return {number} the duration between the first available segment\n * and end index.\n */\n\n\nvar intervalDuration = function intervalDuration(playlist, endSequence, expired) {\n if (typeof endSequence === 'undefined') {\n endSequence = playlist.mediaSequence + playlist.segments.length;\n }\n\n if (endSequence < playlist.mediaSequence) {\n return 0;\n } // do a backward walk to estimate the duration\n\n\n var backward = backwardDuration(playlist, endSequence);\n\n if (backward.precise) {\n // if we were able to base our duration estimate on timing\n // information provided directly from the Media Source, return\n // it\n return backward.result;\n } // walk forward to see if a precise duration estimate can be made\n // that way\n\n\n var forward = forwardDuration(playlist, endSequence);\n\n if (forward.precise) {\n // we found a segment that has been buffered and so it's\n // position is known precisely\n return forward.result;\n } // return the less-precise, playlist-based duration estimate\n\n\n return backward.result + expired;\n};\n/**\n * Calculates the duration of a playlist. If a start and end index\n * are specified, the duration will be for the subset of the media\n * timeline between those two indices. The total duration for live\n * playlists is always Infinity.\n *\n * @param {Object} playlist a media playlist object\n * @param {number=} endSequence an exclusive upper\n * boundary for the playlist. Defaults to the playlist media\n * sequence number plus its length.\n * @param {number=} expired the amount of time that has\n * dropped off the front of the playlist in a live scenario\n * @return {number} the duration between the start index and end\n * index.\n */\n\n\nvar duration = function duration(playlist, endSequence, expired) {\n if (!playlist) {\n return 0;\n }\n\n if (typeof expired !== 'number') {\n expired = 0;\n } // if a slice of the total duration is not requested, use\n // playlist-level duration indicators when they're present\n\n\n if (typeof endSequence === 'undefined') {\n // if present, use the duration specified in the playlist\n if (playlist.totalDuration) {\n return playlist.totalDuration;\n } // duration should be Infinity for live playlists\n\n\n if (!playlist.endList) {\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default()[Infinity]);\n }\n } // calculate the total duration based on the segment durations\n\n\n return intervalDuration(playlist, endSequence, expired);\n};\n/**\n * Calculate the time between two indexes in the current playlist\n * neight the start- nor the end-index need to be within the current\n * playlist in which case, the targetDuration of the playlist is used\n * to approximate the durations of the segments\n *\n * @param {Array} options.durationList list to iterate over for durations.\n * @param {number} options.defaultDuration duration to use for elements before or after the durationList\n * @param {number} options.startIndex partsAndSegments index to start\n * @param {number} options.endIndex partsAndSegments index to end.\n * @return {number} the number of seconds between startIndex and endIndex\n */\n\n\nvar sumDurations = function sumDurations(_ref2) {\n var defaultDuration = _ref2.defaultDuration,\n durationList = _ref2.durationList,\n startIndex = _ref2.startIndex,\n endIndex = _ref2.endIndex;\n var durations = 0;\n\n if (startIndex > endIndex) {\n var _ref3 = [endIndex, startIndex];\n startIndex = _ref3[0];\n endIndex = _ref3[1];\n }\n\n if (startIndex < 0) {\n for (var i = startIndex; i < Math.min(0, endIndex); i++) {\n durations += defaultDuration;\n }\n\n startIndex = 0;\n }\n\n for (var _i = startIndex; _i < endIndex; _i++) {\n durations += durationList[_i].duration;\n }\n\n return durations;\n};\n/**\n * Calculates the playlist end time\n *\n * @param {Object} playlist a media playlist object\n * @param {number=} expired the amount of time that has\n * dropped off the front of the playlist in a live scenario\n * @param {boolean|false} useSafeLiveEnd a boolean value indicating whether or not the\n * playlist end calculation should consider the safe live end\n * (truncate the playlist end by three segments). This is normally\n * used for calculating the end of the playlist's seekable range.\n * This takes into account the value of liveEdgePadding.\n * Setting liveEdgePadding to 0 is equivalent to setting this to false.\n * @param {number} liveEdgePadding a number indicating how far from the end of the playlist we should be in seconds.\n * If this is provided, it is used in the safe live end calculation.\n * Setting useSafeLiveEnd=false or liveEdgePadding=0 are equivalent.\n * Corresponds to suggestedPresentationDelay in DASH manifests.\n * @return {number} the end time of playlist\n * @function playlistEnd\n */\n\n\nvar playlistEnd = function playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding) {\n if (!playlist || !playlist.segments) {\n return null;\n }\n\n if (playlist.endList) {\n return duration(playlist);\n }\n\n if (expired === null) {\n return null;\n }\n\n expired = expired || 0;\n var lastSegmentEndTime = intervalDuration(playlist, playlist.mediaSequence + playlist.segments.length, expired);\n\n if (useSafeLiveEnd) {\n liveEdgePadding = typeof liveEdgePadding === 'number' ? liveEdgePadding : liveEdgeDelay(null, playlist);\n lastSegmentEndTime -= liveEdgePadding;\n } // don't return a time less than zero\n\n\n return Math.max(0, lastSegmentEndTime);\n};\n/**\n * Calculates the interval of time that is currently seekable in a\n * playlist. The returned time ranges are relative to the earliest\n * moment in the specified playlist that is still available. A full\n * seekable implementation for live streams would need to offset\n * these values by the duration of content that has expired from the\n * stream.\n *\n * @param {Object} playlist a media playlist object\n * dropped off the front of the playlist in a live scenario\n * @param {number=} expired the amount of time that has\n * dropped off the front of the playlist in a live scenario\n * @param {number} liveEdgePadding how far from the end of the playlist we should be in seconds.\n * Corresponds to suggestedPresentationDelay in DASH manifests.\n * @return {TimeRanges} the periods of time that are valid targets\n * for seeking\n */\n\n\nvar seekable = function seekable(playlist, expired, liveEdgePadding) {\n var useSafeLiveEnd = true;\n var seekableStart = expired || 0;\n var seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding);\n\n if (seekableEnd === null) {\n return createTimeRange();\n }\n\n return createTimeRange(seekableStart, seekableEnd);\n};\n/**\n * Determine the index and estimated starting time of the segment that\n * contains a specified playback position in a media playlist.\n *\n * @param {Object} options.playlist the media playlist to query\n * @param {number} options.currentTime The number of seconds since the earliest\n * possible position to determine the containing segment for\n * @param {number} options.startTime the time when the segment/part starts\n * @param {number} options.startingSegmentIndex the segment index to start looking at.\n * @param {number?} [options.startingPartIndex] the part index to look at within the segment.\n *\n * @return {Object} an object with partIndex, segmentIndex, and startTime.\n */\n\n\nvar getMediaInfoForTime = function getMediaInfoForTime(_ref4) {\n var playlist = _ref4.playlist,\n currentTime = _ref4.currentTime,\n startingSegmentIndex = _ref4.startingSegmentIndex,\n startingPartIndex = _ref4.startingPartIndex,\n startTime = _ref4.startTime,\n experimentalExactManifestTimings = _ref4.experimentalExactManifestTimings;\n var time = currentTime - startTime;\n var partsAndSegments = getPartsAndSegments(playlist);\n var startIndex = 0;\n\n for (var i = 0; i < partsAndSegments.length; i++) {\n var partAndSegment = partsAndSegments[i];\n\n if (startingSegmentIndex !== partAndSegment.segmentIndex) {\n continue;\n } // skip this if part index does not match.\n\n\n if (typeof startingPartIndex === 'number' && typeof partAndSegment.partIndex === 'number' && startingPartIndex !== partAndSegment.partIndex) {\n continue;\n }\n\n startIndex = i;\n break;\n }\n\n if (time < 0) {\n // Walk backward from startIndex in the playlist, adding durations\n // until we find a segment that contains `time` and return it\n if (startIndex > 0) {\n for (var _i2 = startIndex - 1; _i2 >= 0; _i2--) {\n var _partAndSegment = partsAndSegments[_i2];\n time += _partAndSegment.duration;\n\n if (experimentalExactManifestTimings) {\n if (time < 0) {\n continue;\n }\n } else if (time + TIME_FUDGE_FACTOR <= 0) {\n continue;\n }\n\n return {\n partIndex: _partAndSegment.partIndex,\n segmentIndex: _partAndSegment.segmentIndex,\n startTime: startTime - sumDurations({\n defaultDuration: playlist.targetDuration,\n durationList: partsAndSegments,\n startIndex: startIndex,\n endIndex: _i2\n })\n };\n }\n } // We were unable to find a good segment within the playlist\n // so select the first segment\n\n\n return {\n partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,\n segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,\n startTime: currentTime\n };\n } // When startIndex is negative, we first walk forward to first segment\n // adding target durations. If we \"run out of time\" before getting to\n // the first segment, return the first segment\n\n\n if (startIndex < 0) {\n for (var _i3 = startIndex; _i3 < 0; _i3++) {\n time -= playlist.targetDuration;\n\n if (time < 0) {\n return {\n partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,\n segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,\n startTime: currentTime\n };\n }\n }\n\n startIndex = 0;\n } // Walk forward from startIndex in the playlist, subtracting durations\n // until we find a segment that contains `time` and return it\n\n\n for (var _i4 = startIndex; _i4 < partsAndSegments.length; _i4++) {\n var _partAndSegment2 = partsAndSegments[_i4];\n time -= _partAndSegment2.duration;\n\n if (experimentalExactManifestTimings) {\n if (time > 0) {\n continue;\n }\n } else if (time - TIME_FUDGE_FACTOR >= 0) {\n continue;\n }\n\n return {\n partIndex: _partAndSegment2.partIndex,\n segmentIndex: _partAndSegment2.segmentIndex,\n startTime: startTime + sumDurations({\n defaultDuration: playlist.targetDuration,\n durationList: partsAndSegments,\n startIndex: startIndex,\n endIndex: _i4\n })\n };\n } // We are out of possible candidates so load the last one...\n\n\n return {\n segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex,\n partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex,\n startTime: currentTime\n };\n};\n/**\n * Check whether the playlist is blacklisted or not.\n *\n * @param {Object} playlist the media playlist object\n * @return {boolean} whether the playlist is blacklisted or not\n * @function isBlacklisted\n */\n\n\nvar isBlacklisted = function isBlacklisted(playlist) {\n return playlist.excludeUntil && playlist.excludeUntil > Date.now();\n};\n/**\n * Check whether the playlist is compatible with current playback configuration or has\n * been blacklisted permanently for being incompatible.\n *\n * @param {Object} playlist the media playlist object\n * @return {boolean} whether the playlist is incompatible or not\n * @function isIncompatible\n */\n\n\nvar isIncompatible = function isIncompatible(playlist) {\n return playlist.excludeUntil && playlist.excludeUntil === Infinity;\n};\n/**\n * Check whether the playlist is enabled or not.\n *\n * @param {Object} playlist the media playlist object\n * @return {boolean} whether the playlist is enabled or not\n * @function isEnabled\n */\n\n\nvar isEnabled = function isEnabled(playlist) {\n var blacklisted = isBlacklisted(playlist);\n return !playlist.disabled && !blacklisted;\n};\n/**\n * Check whether the playlist has been manually disabled through the representations api.\n *\n * @param {Object} playlist the media playlist object\n * @return {boolean} whether the playlist is disabled manually or not\n * @function isDisabled\n */\n\n\nvar isDisabled = function isDisabled(playlist) {\n return playlist.disabled;\n};\n/**\n * Returns whether the current playlist is an AES encrypted HLS stream\n *\n * @return {boolean} true if it's an AES encrypted HLS stream\n */\n\n\nvar isAes = function isAes(media) {\n for (var i = 0; i < media.segments.length; i++) {\n if (media.segments[i].key) {\n return true;\n }\n }\n\n return false;\n};\n/**\n * Checks if the playlist has a value for the specified attribute\n *\n * @param {string} attr\n * Attribute to check for\n * @param {Object} playlist\n * The media playlist object\n * @return {boolean}\n * Whether the playlist contains a value for the attribute or not\n * @function hasAttribute\n */\n\n\nvar hasAttribute = function hasAttribute(attr, playlist) {\n return playlist.attributes && playlist.attributes[attr];\n};\n/**\n * Estimates the time required to complete a segment download from the specified playlist\n *\n * @param {number} segmentDuration\n * Duration of requested segment\n * @param {number} bandwidth\n * Current measured bandwidth of the player\n * @param {Object} playlist\n * The media playlist object\n * @param {number=} bytesReceived\n * Number of bytes already received for the request. Defaults to 0\n * @return {number|NaN}\n * The estimated time to request the segment. NaN if bandwidth information for\n * the given playlist is unavailable\n * @function estimateSegmentRequestTime\n */\n\n\nvar estimateSegmentRequestTime = function estimateSegmentRequestTime(segmentDuration, bandwidth, playlist, bytesReceived) {\n if (bytesReceived === void 0) {\n bytesReceived = 0;\n }\n\n if (!hasAttribute('BANDWIDTH', playlist)) {\n return NaN;\n }\n\n var size = segmentDuration * playlist.attributes.BANDWIDTH;\n return (size - bytesReceived * 8) / bandwidth;\n};\n/*\n * Returns whether the current playlist is the lowest rendition\n *\n * @return {Boolean} true if on lowest rendition\n */\n\n\nvar isLowestEnabledRendition = function isLowestEnabledRendition(master, media) {\n if (master.playlists.length === 1) {\n return true;\n }\n\n var currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE;\n return master.playlists.filter(function (playlist) {\n if (!isEnabled(playlist)) {\n return false;\n }\n\n return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth;\n }).length === 0;\n};\n\nvar playlistMatch = function playlistMatch(a, b) {\n // both playlits are null\n // or only one playlist is non-null\n // no match\n if (!a && !b || !a && b || a && !b) {\n return false;\n } // playlist objects are the same, match\n\n\n if (a === b) {\n return true;\n } // first try to use id as it should be the most\n // accurate\n\n\n if (a.id && b.id && a.id === b.id) {\n return true;\n } // next try to use reslovedUri as it should be the\n // second most accurate.\n\n\n if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) {\n return true;\n } // finally try to use uri as it should be accurate\n // but might miss a few cases for relative uris\n\n\n if (a.uri && b.uri && a.uri === b.uri) {\n return true;\n }\n\n return false;\n};\n\nvar someAudioVariant = function someAudioVariant(master, callback) {\n var AUDIO = master && master.mediaGroups && master.mediaGroups.AUDIO || {};\n var found = false;\n\n for (var groupName in AUDIO) {\n for (var label in AUDIO[groupName]) {\n found = callback(AUDIO[groupName][label]);\n\n if (found) {\n break;\n }\n }\n\n if (found) {\n break;\n }\n }\n\n return !!found;\n};\n\nvar isAudioOnly = function isAudioOnly(master) {\n // we are audio only if we have no main playlists but do\n // have media group playlists.\n if (!master || !master.playlists || !master.playlists.length) {\n // without audio variants or playlists this\n // is not an audio only master.\n var found = someAudioVariant(master, function (variant) {\n return variant.playlists && variant.playlists.length || variant.uri;\n });\n return found;\n } // if every playlist has only an audio codec it is audio only\n\n\n var _loop = function _loop(i) {\n var playlist = master.playlists[i];\n var CODECS = playlist.attributes && playlist.attributes.CODECS; // all codecs are audio, this is an audio playlist.\n\n if (CODECS && CODECS.split(',').every(function (c) {\n return (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.isAudioCodec)(c);\n })) {\n return \"continue\";\n } // playlist is in an audio group it is audio only\n\n\n var found = someAudioVariant(master, function (variant) {\n return playlistMatch(playlist, variant);\n });\n\n if (found) {\n return \"continue\";\n } // if we make it here this playlist isn't audio and we\n // are not audio only\n\n\n return {\n v: false\n };\n };\n\n for (var i = 0; i < master.playlists.length; i++) {\n var _ret = _loop(i);\n\n if (_ret === \"continue\") continue;\n if (typeof _ret === \"object\") return _ret.v;\n } // if we make it past every playlist without returning, then\n // this is an audio only playlist.\n\n\n return true;\n}; // exports\n\n\nvar Playlist = {\n liveEdgeDelay: liveEdgeDelay,\n duration: duration,\n seekable: seekable,\n getMediaInfoForTime: getMediaInfoForTime,\n isEnabled: isEnabled,\n isDisabled: isDisabled,\n isBlacklisted: isBlacklisted,\n isIncompatible: isIncompatible,\n playlistEnd: playlistEnd,\n isAes: isAes,\n hasAttribute: hasAttribute,\n estimateSegmentRequestTime: estimateSegmentRequestTime,\n isLowestEnabledRendition: isLowestEnabledRendition,\n isAudioOnly: isAudioOnly,\n playlistMatch: playlistMatch,\n segmentDurationWithParts: segmentDurationWithParts\n};\nvar log = videojs.log;\n\nvar createPlaylistID = function createPlaylistID(index, uri) {\n return index + \"-\" + uri;\n}; // default function for creating a group id\n\n\nvar groupID = function groupID(type, group, label) {\n return \"placeholder-uri-\" + type + \"-\" + group + \"-\" + label;\n};\n/**\n * Parses a given m3u8 playlist\n *\n * @param {Function} [onwarn]\n * a function to call when the parser triggers a warning event.\n * @param {Function} [oninfo]\n * a function to call when the parser triggers an info event.\n * @param {string} manifestString\n * The downloaded manifest string\n * @param {Object[]} [customTagParsers]\n * An array of custom tag parsers for the m3u8-parser instance\n * @param {Object[]} [customTagMappers]\n * An array of custom tag mappers for the m3u8-parser instance\n * @param {boolean} [experimentalLLHLS=false]\n * Whether to keep ll-hls features in the manifest after parsing.\n * @return {Object}\n * The manifest object\n */\n\n\nvar parseManifest = function parseManifest(_ref) {\n var onwarn = _ref.onwarn,\n oninfo = _ref.oninfo,\n manifestString = _ref.manifestString,\n _ref$customTagParsers = _ref.customTagParsers,\n customTagParsers = _ref$customTagParsers === void 0 ? [] : _ref$customTagParsers,\n _ref$customTagMappers = _ref.customTagMappers,\n customTagMappers = _ref$customTagMappers === void 0 ? [] : _ref$customTagMappers,\n experimentalLLHLS = _ref.experimentalLLHLS;\n var parser = new m3u8_parser__WEBPACK_IMPORTED_MODULE_12__.Parser();\n\n if (onwarn) {\n parser.on('warn', onwarn);\n }\n\n if (oninfo) {\n parser.on('info', oninfo);\n }\n\n customTagParsers.forEach(function (customParser) {\n return parser.addParser(customParser);\n });\n customTagMappers.forEach(function (mapper) {\n return parser.addTagMapper(mapper);\n });\n parser.push(manifestString);\n parser.end();\n var manifest = parser.manifest; // remove llhls features from the parsed manifest\n // if we don't want llhls support.\n\n if (!experimentalLLHLS) {\n ['preloadSegment', 'skip', 'serverControl', 'renditionReports', 'partInf', 'partTargetDuration'].forEach(function (k) {\n if (manifest.hasOwnProperty(k)) {\n delete manifest[k];\n }\n });\n\n if (manifest.segments) {\n manifest.segments.forEach(function (segment) {\n ['parts', 'preloadHints'].forEach(function (k) {\n if (segment.hasOwnProperty(k)) {\n delete segment[k];\n }\n });\n });\n }\n }\n\n if (!manifest.targetDuration) {\n var targetDuration = 10;\n\n if (manifest.segments && manifest.segments.length) {\n targetDuration = manifest.segments.reduce(function (acc, s) {\n return Math.max(acc, s.duration);\n }, 0);\n }\n\n if (onwarn) {\n onwarn(\"manifest has no targetDuration defaulting to \" + targetDuration);\n }\n\n manifest.targetDuration = targetDuration;\n }\n\n var parts = getLastParts(manifest);\n\n if (parts.length && !manifest.partTargetDuration) {\n var partTargetDuration = parts.reduce(function (acc, p) {\n return Math.max(acc, p.duration);\n }, 0);\n\n if (onwarn) {\n onwarn(\"manifest has no partTargetDuration defaulting to \" + partTargetDuration);\n log.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.');\n }\n\n manifest.partTargetDuration = partTargetDuration;\n }\n\n return manifest;\n};\n/**\n * Loops through all supported media groups in master and calls the provided\n * callback for each group\n *\n * @param {Object} master\n * The parsed master manifest object\n * @param {Function} callback\n * Callback to call for each media group\n */\n\n\nvar forEachMediaGroup = function forEachMediaGroup(master, callback) {\n if (!master.mediaGroups) {\n return;\n }\n\n ['AUDIO', 'SUBTITLES'].forEach(function (mediaType) {\n if (!master.mediaGroups[mediaType]) {\n return;\n }\n\n for (var groupKey in master.mediaGroups[mediaType]) {\n for (var labelKey in master.mediaGroups[mediaType][groupKey]) {\n var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];\n callback(mediaProperties, mediaType, groupKey, labelKey);\n }\n }\n });\n};\n/**\n * Adds properties and attributes to the playlist to keep consistent functionality for\n * playlists throughout VHS.\n *\n * @param {Object} config\n * Arguments object\n * @param {Object} config.playlist\n * The media playlist\n * @param {string} [config.uri]\n * The uri to the media playlist (if media playlist is not from within a master\n * playlist)\n * @param {string} id\n * ID to use for the playlist\n */\n\n\nvar setupMediaPlaylist = function setupMediaPlaylist(_ref2) {\n var playlist = _ref2.playlist,\n uri = _ref2.uri,\n id = _ref2.id;\n playlist.id = id;\n playlist.playlistErrors_ = 0;\n\n if (uri) {\n // For media playlists, m3u8-parser does not have access to a URI, as HLS media\n // playlists do not contain their own source URI, but one is needed for consistency in\n // VHS.\n playlist.uri = uri;\n } // For HLS master playlists, even though certain attributes MUST be defined, the\n // stream may still be played without them.\n // For HLS media playlists, m3u8-parser does not attach an attributes object to the\n // manifest.\n //\n // To avoid undefined reference errors through the project, and make the code easier\n // to write/read, add an empty attributes object for these cases.\n\n\n playlist.attributes = playlist.attributes || {};\n};\n/**\n * Adds ID, resolvedUri, and attributes properties to each playlist of the master, where\n * necessary. In addition, creates playlist IDs for each playlist and adds playlist ID to\n * playlist references to the playlists array.\n *\n * @param {Object} master\n * The master playlist\n */\n\n\nvar setupMediaPlaylists = function setupMediaPlaylists(master) {\n var i = master.playlists.length;\n\n while (i--) {\n var playlist = master.playlists[i];\n setupMediaPlaylist({\n playlist: playlist,\n id: createPlaylistID(i, playlist.uri)\n });\n playlist.resolvedUri = resolveUrl(master.uri, playlist.uri);\n master.playlists[playlist.id] = playlist; // URI reference added for backwards compatibility\n\n master.playlists[playlist.uri] = playlist; // Although the spec states an #EXT-X-STREAM-INF tag MUST have a BANDWIDTH attribute,\n // the stream can be played without it. Although an attributes property may have been\n // added to the playlist to prevent undefined references, issue a warning to fix the\n // manifest.\n\n if (!playlist.attributes.BANDWIDTH) {\n log.warn('Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.');\n }\n }\n};\n/**\n * Adds resolvedUri properties to each media group.\n *\n * @param {Object} master\n * The master playlist\n */\n\n\nvar resolveMediaGroupUris = function resolveMediaGroupUris(master) {\n forEachMediaGroup(master, function (properties) {\n if (properties.uri) {\n properties.resolvedUri = resolveUrl(master.uri, properties.uri);\n }\n });\n};\n/**\n * Creates a master playlist wrapper to insert a sole media playlist into.\n *\n * @param {Object} media\n * Media playlist\n * @param {string} uri\n * The media URI\n *\n * @return {Object}\n * Master playlist\n */\n\n\nvar masterForMedia = function masterForMedia(media, uri) {\n var id = createPlaylistID(0, uri);\n var master = {\n mediaGroups: {\n 'AUDIO': {},\n 'VIDEO': {},\n 'CLOSED-CAPTIONS': {},\n 'SUBTITLES': {}\n },\n uri: (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).href,\n resolvedUri: (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).href,\n playlists: [{\n uri: uri,\n id: id,\n resolvedUri: uri,\n // m3u8-parser does not attach an attributes property to media playlists so make\n // sure that the property is attached to avoid undefined reference errors\n attributes: {}\n }]\n }; // set up ID reference\n\n master.playlists[id] = master.playlists[0]; // URI reference added for backwards compatibility\n\n master.playlists[uri] = master.playlists[0];\n return master;\n};\n/**\n * Does an in-place update of the master manifest to add updated playlist URI references\n * as well as other properties needed by VHS that aren't included by the parser.\n *\n * @param {Object} master\n * Master manifest object\n * @param {string} uri\n * The source URI\n * @param {function} createGroupID\n * A function to determine how to create the groupID for mediaGroups\n */\n\n\nvar addPropertiesToMaster = function addPropertiesToMaster(master, uri, createGroupID) {\n if (createGroupID === void 0) {\n createGroupID = groupID;\n }\n\n master.uri = uri;\n\n for (var i = 0; i < master.playlists.length; i++) {\n if (!master.playlists[i].uri) {\n // Set up phony URIs for the playlists since playlists are referenced by their URIs\n // throughout VHS, but some formats (e.g., DASH) don't have external URIs\n // TODO: consider adding dummy URIs in mpd-parser\n var phonyUri = \"placeholder-uri-\" + i;\n master.playlists[i].uri = phonyUri;\n }\n }\n\n var audioOnlyMaster = isAudioOnly(master);\n forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) {\n // add a playlist array under properties\n if (!properties.playlists || !properties.playlists.length) {\n // If the manifest is audio only and this media group does not have a uri, check\n // if the media group is located in the main list of playlists. If it is, don't add\n // placeholder properties as it shouldn't be considered an alternate audio track.\n if (audioOnlyMaster && mediaType === 'AUDIO' && !properties.uri) {\n for (var _i = 0; _i < master.playlists.length; _i++) {\n var p = master.playlists[_i];\n\n if (p.attributes && p.attributes.AUDIO && p.attributes.AUDIO === groupKey) {\n return;\n }\n }\n }\n\n properties.playlists = [(0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_2__[\"default\"])({}, properties)];\n }\n\n properties.playlists.forEach(function (p, i) {\n var groupId = createGroupID(mediaType, groupKey, labelKey, p);\n var id = createPlaylistID(i, groupId);\n\n if (p.uri) {\n p.resolvedUri = p.resolvedUri || resolveUrl(master.uri, p.uri);\n } else {\n // DEPRECATED, this has been added to prevent a breaking change.\n // previously we only ever had a single media group playlist, so\n // we mark the first playlist uri without prepending the index as we used to\n // ideally we would do all of the playlists the same way.\n p.uri = i === 0 ? groupId : id; // don't resolve a placeholder uri to an absolute url, just use\n // the placeholder again\n\n p.resolvedUri = p.uri;\n }\n\n p.id = p.id || id; // add an empty attributes object, all playlists are\n // expected to have this.\n\n p.attributes = p.attributes || {}; // setup ID and URI references (URI for backwards compatibility)\n\n master.playlists[p.id] = p;\n master.playlists[p.uri] = p;\n });\n });\n setupMediaPlaylists(master);\n resolveMediaGroupUris(master);\n};\n\nvar mergeOptions$2 = videojs.mergeOptions,\n EventTarget$1 = videojs.EventTarget;\n\nvar addLLHLSQueryDirectives = function addLLHLSQueryDirectives(uri, media) {\n if (media.endList || !media.serverControl) {\n return uri;\n }\n\n var parameters = {};\n\n if (media.serverControl.canBlockReload) {\n var preloadSegment = media.preloadSegment; // next msn is a zero based value, length is not.\n\n var nextMSN = media.mediaSequence + media.segments.length; // If preload segment has parts then it is likely\n // that we are going to request a part of that preload segment.\n // the logic below is used to determine that.\n\n if (preloadSegment) {\n var parts = preloadSegment.parts || []; // _HLS_part is a zero based index\n\n var nextPart = getKnownPartCount(media) - 1; // if nextPart is > -1 and not equal to just the\n // length of parts, then we know we had part preload hints\n // and we need to add the _HLS_part= query\n\n if (nextPart > -1 && nextPart !== parts.length - 1) {\n // add existing parts to our preload hints\n // eslint-disable-next-line\n parameters._HLS_part = nextPart;\n } // this if statement makes sure that we request the msn\n // of the preload segment if:\n // 1. the preload segment had parts (and was not yet a full segment)\n // but was added to our segments array\n // 2. the preload segment had preload hints for parts that are not in\n // the manifest yet.\n // in all other cases we want the segment after the preload segment\n // which will be given by using media.segments.length because it is 1 based\n // rather than 0 based.\n\n\n if (nextPart > -1 || parts.length) {\n nextMSN--;\n }\n } // add _HLS_msn= in front of any _HLS_part query\n // eslint-disable-next-line\n\n\n parameters._HLS_msn = nextMSN;\n }\n\n if (media.serverControl && media.serverControl.canSkipUntil) {\n // add _HLS_skip= infront of all other queries.\n // eslint-disable-next-line\n parameters._HLS_skip = media.serverControl.canSkipDateranges ? 'v2' : 'YES';\n }\n\n if (Object.keys(parameters).length) {\n var parsedUri = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().URL)(uri);\n ['_HLS_skip', '_HLS_msn', '_HLS_part'].forEach(function (name) {\n if (!parameters.hasOwnProperty(name)) {\n return;\n }\n\n parsedUri.searchParams.set(name, parameters[name]);\n });\n uri = parsedUri.toString();\n }\n\n return uri;\n};\n/**\n * Returns a new segment object with properties and\n * the parts array merged.\n *\n * @param {Object} a the old segment\n * @param {Object} b the new segment\n *\n * @return {Object} the merged segment\n */\n\n\nvar updateSegment = function updateSegment(a, b) {\n if (!a) {\n return b;\n }\n\n var result = mergeOptions$2(a, b); // if only the old segment has preload hints\n // and the new one does not, remove preload hints.\n\n if (a.preloadHints && !b.preloadHints) {\n delete result.preloadHints;\n } // if only the old segment has parts\n // then the parts are no longer valid\n\n\n if (a.parts && !b.parts) {\n delete result.parts; // if both segments have parts\n // copy part propeties from the old segment\n // to the new one.\n } else if (a.parts && b.parts) {\n for (var i = 0; i < b.parts.length; i++) {\n if (a.parts && a.parts[i]) {\n result.parts[i] = mergeOptions$2(a.parts[i], b.parts[i]);\n }\n }\n } // set skipped to false for segments that have\n // have had information merged from the old segment.\n\n\n if (!a.skipped && b.skipped) {\n result.skipped = false;\n } // set preload to false for segments that have\n // had information added in the new segment.\n\n\n if (a.preload && !b.preload) {\n result.preload = false;\n }\n\n return result;\n};\n/**\n * Returns a new array of segments that is the result of merging\n * properties from an older list of segments onto an updated\n * list. No properties on the updated playlist will be ovewritten.\n *\n * @param {Array} original the outdated list of segments\n * @param {Array} update the updated list of segments\n * @param {number=} offset the index of the first update\n * segment in the original segment list. For non-live playlists,\n * this should always be zero and does not need to be\n * specified. For live playlists, it should be the difference\n * between the media sequence numbers in the original and updated\n * playlists.\n * @return {Array} a list of merged segment objects\n */\n\n\nvar updateSegments = function updateSegments(original, update, offset) {\n var oldSegments = original.slice();\n var newSegments = update.slice();\n offset = offset || 0;\n var result = [];\n var currentMap;\n\n for (var newIndex = 0; newIndex < newSegments.length; newIndex++) {\n var oldSegment = oldSegments[newIndex + offset];\n var newSegment = newSegments[newIndex];\n\n if (oldSegment) {\n currentMap = oldSegment.map || currentMap;\n result.push(updateSegment(oldSegment, newSegment));\n } else {\n // carry over map to new segment if it is missing\n if (currentMap && !newSegment.map) {\n newSegment.map = currentMap;\n }\n\n result.push(newSegment);\n }\n }\n\n return result;\n};\n\nvar resolveSegmentUris = function resolveSegmentUris(segment, baseUri) {\n // preloadSegment will not have a uri at all\n // as the segment isn't actually in the manifest yet, only parts\n if (!segment.resolvedUri && segment.uri) {\n segment.resolvedUri = resolveUrl(baseUri, segment.uri);\n }\n\n if (segment.key && !segment.key.resolvedUri) {\n segment.key.resolvedUri = resolveUrl(baseUri, segment.key.uri);\n }\n\n if (segment.map && !segment.map.resolvedUri) {\n segment.map.resolvedUri = resolveUrl(baseUri, segment.map.uri);\n }\n\n if (segment.map && segment.map.key && !segment.map.key.resolvedUri) {\n segment.map.key.resolvedUri = resolveUrl(baseUri, segment.map.key.uri);\n }\n\n if (segment.parts && segment.parts.length) {\n segment.parts.forEach(function (p) {\n if (p.resolvedUri) {\n return;\n }\n\n p.resolvedUri = resolveUrl(baseUri, p.uri);\n });\n }\n\n if (segment.preloadHints && segment.preloadHints.length) {\n segment.preloadHints.forEach(function (p) {\n if (p.resolvedUri) {\n return;\n }\n\n p.resolvedUri = resolveUrl(baseUri, p.uri);\n });\n }\n};\n\nvar getAllSegments = function getAllSegments(media) {\n var segments = media.segments || [];\n var preloadSegment = media.preloadSegment; // a preloadSegment with only preloadHints is not currently\n // a usable segment, only include a preloadSegment that has\n // parts.\n\n if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) {\n // if preloadHints has a MAP that means that the\n // init segment is going to change. We cannot use any of the parts\n // from this preload segment.\n if (preloadSegment.preloadHints) {\n for (var i = 0; i < preloadSegment.preloadHints.length; i++) {\n if (preloadSegment.preloadHints[i].type === 'MAP') {\n return segments;\n }\n }\n } // set the duration for our preload segment to target duration.\n\n\n preloadSegment.duration = media.targetDuration;\n preloadSegment.preload = true;\n segments.push(preloadSegment);\n }\n\n return segments;\n}; // consider the playlist unchanged if the playlist object is the same or\n// the number of segments is equal, the media sequence number is unchanged,\n// and this playlist hasn't become the end of the playlist\n\n\nvar isPlaylistUnchanged = function isPlaylistUnchanged(a, b) {\n return a === b || a.segments && b.segments && a.segments.length === b.segments.length && a.endList === b.endList && a.mediaSequence === b.mediaSequence && a.preloadSegment === b.preloadSegment;\n};\n/**\n * Returns a new master playlist that is the result of merging an\n * updated media playlist into the original version. If the\n * updated media playlist does not match any of the playlist\n * entries in the original master playlist, null is returned.\n *\n * @param {Object} master a parsed master M3U8 object\n * @param {Object} media a parsed media M3U8 object\n * @return {Object} a new object that represents the original\n * master playlist with the updated media playlist merged in, or\n * null if the merge produced no change.\n */\n\n\nvar updateMaster$1 = function updateMaster(master, newMedia, unchangedCheck) {\n if (unchangedCheck === void 0) {\n unchangedCheck = isPlaylistUnchanged;\n }\n\n var result = mergeOptions$2(master, {});\n var oldMedia = result.playlists[newMedia.id];\n\n if (!oldMedia) {\n return null;\n }\n\n if (unchangedCheck(oldMedia, newMedia)) {\n return null;\n }\n\n newMedia.segments = getAllSegments(newMedia);\n var mergedPlaylist = mergeOptions$2(oldMedia, newMedia); // always use the new media's preload segment\n\n if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) {\n delete mergedPlaylist.preloadSegment;\n } // if the update could overlap existing segment information, merge the two segment lists\n\n\n if (oldMedia.segments) {\n if (newMedia.skip) {\n newMedia.segments = newMedia.segments || []; // add back in objects for skipped segments, so that we merge\n // old properties into the new segments\n\n for (var i = 0; i < newMedia.skip.skippedSegments; i++) {\n newMedia.segments.unshift({\n skipped: true\n });\n }\n }\n\n mergedPlaylist.segments = updateSegments(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence);\n } // resolve any segment URIs to prevent us from having to do it later\n\n\n mergedPlaylist.segments.forEach(function (segment) {\n resolveSegmentUris(segment, mergedPlaylist.resolvedUri);\n }); // TODO Right now in the playlists array there are two references to each playlist, one\n // that is referenced by index, and one by URI. The index reference may no longer be\n // necessary.\n\n for (var _i = 0; _i < result.playlists.length; _i++) {\n if (result.playlists[_i].id === newMedia.id) {\n result.playlists[_i] = mergedPlaylist;\n }\n }\n\n result.playlists[newMedia.id] = mergedPlaylist; // URI reference added for backwards compatibility\n\n result.playlists[newMedia.uri] = mergedPlaylist; // update media group playlist references.\n\n forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) {\n if (!properties.playlists) {\n return;\n }\n\n for (var _i2 = 0; _i2 < properties.playlists.length; _i2++) {\n if (newMedia.id === properties.playlists[_i2].id) {\n properties.playlists[_i2] = mergedPlaylist;\n }\n }\n });\n return result;\n};\n/**\n * Calculates the time to wait before refreshing a live playlist\n *\n * @param {Object} media\n * The current media\n * @param {boolean} update\n * True if there were any updates from the last refresh, false otherwise\n * @return {number}\n * The time in ms to wait before refreshing the live playlist\n */\n\n\nvar refreshDelay = function refreshDelay(media, update) {\n var segments = media.segments || [];\n var lastSegment = segments[segments.length - 1];\n var lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1];\n var lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration;\n\n if (update && lastDuration) {\n return lastDuration * 1000;\n } // if the playlist is unchanged since the last reload or last segment duration\n // cannot be determined, try again after half the target duration\n\n\n return (media.partTargetDuration || media.targetDuration || 10) * 500;\n};\n/**\n * Load a playlist from a remote location\n *\n * @class PlaylistLoader\n * @extends Stream\n * @param {string|Object} src url or object of manifest\n * @param {boolean} withCredentials the withCredentials xhr option\n * @class\n */\n\n\nvar PlaylistLoader = /*#__PURE__*/function (_EventTarget) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(PlaylistLoader, _EventTarget);\n\n function PlaylistLoader(src, vhs, options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _EventTarget.call(this) || this;\n\n if (!src) {\n throw new Error('A non-empty playlist URL or object is required');\n }\n\n _this.logger_ = logger('PlaylistLoader');\n var _options = options,\n _options$withCredenti = _options.withCredentials,\n withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti,\n _options$handleManife = _options.handleManifestRedirects,\n handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife;\n _this.src = src;\n _this.vhs_ = vhs;\n _this.withCredentials = withCredentials;\n _this.handleManifestRedirects = handleManifestRedirects;\n var vhsOptions = vhs.options_;\n _this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || [];\n _this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || [];\n _this.experimentalLLHLS = vhsOptions && vhsOptions.experimentalLLHLS || false; // force experimentalLLHLS for IE 11\n\n if (videojs.browser.IE_VERSION) {\n _this.experimentalLLHLS = false;\n } // initialize the loader state\n\n\n _this.state = 'HAVE_NOTHING'; // live playlist staleness timeout\n\n _this.handleMediaupdatetimeout_ = _this.handleMediaupdatetimeout_.bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this));\n\n _this.on('mediaupdatetimeout', _this.handleMediaupdatetimeout_);\n\n return _this;\n }\n\n var _proto = PlaylistLoader.prototype;\n\n _proto.handleMediaupdatetimeout_ = function handleMediaupdatetimeout_() {\n var _this2 = this;\n\n if (this.state !== 'HAVE_METADATA') {\n // only refresh the media playlist if no other activity is going on\n return;\n }\n\n var media = this.media();\n var uri = resolveUrl(this.master.uri, media.uri);\n\n if (this.experimentalLLHLS) {\n uri = addLLHLSQueryDirectives(uri, media);\n }\n\n this.state = 'HAVE_CURRENT_METADATA';\n this.request = this.vhs_.xhr({\n uri: uri,\n withCredentials: this.withCredentials\n }, function (error, req) {\n // disposed\n if (!_this2.request) {\n return;\n }\n\n if (error) {\n return _this2.playlistRequestError(_this2.request, _this2.media(), 'HAVE_METADATA');\n }\n\n _this2.haveMetadata({\n playlistString: _this2.request.responseText,\n url: _this2.media().uri,\n id: _this2.media().id\n });\n });\n };\n\n _proto.playlistRequestError = function playlistRequestError(xhr, playlist, startingState) {\n var uri = playlist.uri,\n id = playlist.id; // any in-flight request is now finished\n\n this.request = null;\n\n if (startingState) {\n this.state = startingState;\n }\n\n this.error = {\n playlist: this.master.playlists[id],\n status: xhr.status,\n message: \"HLS playlist request error at URL: \" + uri + \".\",\n responseText: xhr.responseText,\n code: xhr.status >= 500 ? 4 : 2\n };\n this.trigger('error');\n };\n\n _proto.parseManifest_ = function parseManifest_(_ref) {\n var _this3 = this;\n\n var url = _ref.url,\n manifestString = _ref.manifestString;\n return parseManifest({\n onwarn: function onwarn(_ref2) {\n var message = _ref2.message;\n return _this3.logger_(\"m3u8-parser warn for \" + url + \": \" + message);\n },\n oninfo: function oninfo(_ref3) {\n var message = _ref3.message;\n return _this3.logger_(\"m3u8-parser info for \" + url + \": \" + message);\n },\n manifestString: manifestString,\n customTagParsers: this.customTagParsers,\n customTagMappers: this.customTagMappers,\n experimentalLLHLS: this.experimentalLLHLS\n });\n }\n /**\n * Update the playlist loader's state in response to a new or updated playlist.\n *\n * @param {string} [playlistString]\n * Playlist string (if playlistObject is not provided)\n * @param {Object} [playlistObject]\n * Playlist object (if playlistString is not provided)\n * @param {string} url\n * URL of playlist\n * @param {string} id\n * ID to use for playlist\n */\n ;\n\n _proto.haveMetadata = function haveMetadata(_ref4) {\n var playlistString = _ref4.playlistString,\n playlistObject = _ref4.playlistObject,\n url = _ref4.url,\n id = _ref4.id; // any in-flight request is now finished\n\n this.request = null;\n this.state = 'HAVE_METADATA';\n var playlist = playlistObject || this.parseManifest_({\n url: url,\n manifestString: playlistString\n });\n playlist.lastRequest = Date.now();\n setupMediaPlaylist({\n playlist: playlist,\n uri: url,\n id: id\n }); // merge this playlist into the master\n\n var update = updateMaster$1(this.master, playlist);\n this.targetDuration = playlist.partTargetDuration || playlist.targetDuration;\n this.pendingMedia_ = null;\n\n if (update) {\n this.master = update;\n this.media_ = this.master.playlists[id];\n } else {\n this.trigger('playlistunchanged');\n }\n\n this.updateMediaUpdateTimeout_(refreshDelay(this.media(), !!update));\n this.trigger('loadedplaylist');\n }\n /**\n * Abort any outstanding work and clean up.\n */\n ;\n\n _proto.dispose = function dispose() {\n this.trigger('dispose');\n this.stopRequest();\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.finalRenditionTimeout);\n this.off();\n };\n\n _proto.stopRequest = function stopRequest() {\n if (this.request) {\n var oldRequest = this.request;\n this.request = null;\n oldRequest.onreadystatechange = null;\n oldRequest.abort();\n }\n }\n /**\n * When called without any arguments, returns the currently\n * active media playlist. When called with a single argument,\n * triggers the playlist loader to asynchronously switch to the\n * specified media playlist. Calling this method while the\n * loader is in the HAVE_NOTHING causes an error to be emitted\n * but otherwise has no effect.\n *\n * @param {Object=} playlist the parsed media playlist\n * object to switch to\n * @param {boolean=} shouldDelay whether we should delay the request by half target duration\n *\n * @return {Playlist} the current loaded media\n */\n ;\n\n _proto.media = function media(playlist, shouldDelay) {\n var _this4 = this; // getter\n\n\n if (!playlist) {\n return this.media_;\n } // setter\n\n\n if (this.state === 'HAVE_NOTHING') {\n throw new Error('Cannot switch media playlist from ' + this.state);\n } // find the playlist object if the target playlist has been\n // specified by URI\n\n\n if (typeof playlist === 'string') {\n if (!this.master.playlists[playlist]) {\n throw new Error('Unknown playlist URI: ' + playlist);\n }\n\n playlist = this.master.playlists[playlist];\n }\n\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.finalRenditionTimeout);\n\n if (shouldDelay) {\n var delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1000 || 5 * 1000;\n this.finalRenditionTimeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(this.media.bind(this, playlist, false), delay);\n return;\n }\n\n var startingState = this.state;\n var mediaChange = !this.media_ || playlist.id !== this.media_.id;\n var masterPlaylistRef = this.master.playlists[playlist.id]; // switch to fully loaded playlists immediately\n\n if (masterPlaylistRef && masterPlaylistRef.endList || // handle the case of a playlist object (e.g., if using vhs-json with a resolved\n // media playlist or, for the case of demuxed audio, a resolved audio media group)\n playlist.endList && playlist.segments.length) {\n // abort outstanding playlist requests\n if (this.request) {\n this.request.onreadystatechange = null;\n this.request.abort();\n this.request = null;\n }\n\n this.state = 'HAVE_METADATA';\n this.media_ = playlist; // trigger media change if the active media has been updated\n\n if (mediaChange) {\n this.trigger('mediachanging');\n\n if (startingState === 'HAVE_MASTER') {\n // The initial playlist was a master manifest, and the first media selected was\n // also provided (in the form of a resolved playlist object) as part of the\n // source object (rather than just a URL). Therefore, since the media playlist\n // doesn't need to be requested, loadedmetadata won't trigger as part of the\n // normal flow, and needs an explicit trigger here.\n this.trigger('loadedmetadata');\n } else {\n this.trigger('mediachange');\n }\n }\n\n return;\n } // We update/set the timeout here so that live playlists\n // that are not a media change will \"start\" the loader as expected.\n // We expect that this function will start the media update timeout\n // cycle again. This also prevents a playlist switch failure from\n // causing us to stall during live.\n\n\n this.updateMediaUpdateTimeout_(refreshDelay(playlist, true)); // switching to the active playlist is a no-op\n\n if (!mediaChange) {\n return;\n }\n\n this.state = 'SWITCHING_MEDIA'; // there is already an outstanding playlist request\n\n if (this.request) {\n if (playlist.resolvedUri === this.request.url) {\n // requesting to switch to the same playlist multiple times\n // has no effect after the first\n return;\n }\n\n this.request.onreadystatechange = null;\n this.request.abort();\n this.request = null;\n } // request the new playlist\n\n\n if (this.media_) {\n this.trigger('mediachanging');\n }\n\n this.pendingMedia_ = playlist;\n this.request = this.vhs_.xhr({\n uri: playlist.resolvedUri,\n withCredentials: this.withCredentials\n }, function (error, req) {\n // disposed\n if (!_this4.request) {\n return;\n }\n\n playlist.lastRequest = Date.now();\n playlist.resolvedUri = resolveManifestRedirect(_this4.handleManifestRedirects, playlist.resolvedUri, req);\n\n if (error) {\n return _this4.playlistRequestError(_this4.request, playlist, startingState);\n }\n\n _this4.haveMetadata({\n playlistString: req.responseText,\n url: playlist.uri,\n id: playlist.id\n }); // fire loadedmetadata the first time a media playlist is loaded\n\n\n if (startingState === 'HAVE_MASTER') {\n _this4.trigger('loadedmetadata');\n } else {\n _this4.trigger('mediachange');\n }\n });\n }\n /**\n * pause loading of the playlist\n */\n ;\n\n _proto.pause = function pause() {\n if (this.mediaUpdateTimeout) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n }\n\n this.stopRequest();\n\n if (this.state === 'HAVE_NOTHING') {\n // If we pause the loader before any data has been retrieved, its as if we never\n // started, so reset to an unstarted state.\n this.started = false;\n } // Need to restore state now that no activity is happening\n\n\n if (this.state === 'SWITCHING_MEDIA') {\n // if the loader was in the process of switching media, it should either return to\n // HAVE_MASTER or HAVE_METADATA depending on if the loader has loaded a media\n // playlist yet. This is determined by the existence of loader.media_\n if (this.media_) {\n this.state = 'HAVE_METADATA';\n } else {\n this.state = 'HAVE_MASTER';\n }\n } else if (this.state === 'HAVE_CURRENT_METADATA') {\n this.state = 'HAVE_METADATA';\n }\n }\n /**\n * start loading of the playlist\n */\n ;\n\n _proto.load = function load(shouldDelay) {\n var _this5 = this;\n\n if (this.mediaUpdateTimeout) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n }\n\n var media = this.media();\n\n if (shouldDelay) {\n var delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1000 : 5 * 1000;\n this.mediaUpdateTimeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n _this5.mediaUpdateTimeout = null;\n\n _this5.load();\n }, delay);\n return;\n }\n\n if (!this.started) {\n this.start();\n return;\n }\n\n if (media && !media.endList) {\n this.trigger('mediaupdatetimeout');\n } else {\n this.trigger('loadedplaylist');\n }\n };\n\n _proto.updateMediaUpdateTimeout_ = function updateMediaUpdateTimeout_(delay) {\n var _this6 = this;\n\n if (this.mediaUpdateTimeout) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n } // we only have use mediaupdatetimeout for live playlists.\n\n\n if (!this.media() || this.media().endList) {\n return;\n }\n\n this.mediaUpdateTimeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n _this6.mediaUpdateTimeout = null;\n\n _this6.trigger('mediaupdatetimeout');\n\n _this6.updateMediaUpdateTimeout_(delay);\n }, delay);\n }\n /**\n * start loading of the playlist\n */\n ;\n\n _proto.start = function start() {\n var _this7 = this;\n\n this.started = true;\n\n if (typeof this.src === 'object') {\n // in the case of an entirely constructed manifest object (meaning there's no actual\n // manifest on a server), default the uri to the page's href\n if (!this.src.uri) {\n this.src.uri = (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).href;\n } // resolvedUri is added on internally after the initial request. Since there's no\n // request for pre-resolved manifests, add on resolvedUri here.\n\n\n this.src.resolvedUri = this.src.uri; // Since a manifest object was passed in as the source (instead of a URL), the first\n // request can be skipped (since the top level of the manifest, at a minimum, is\n // already available as a parsed manifest object). However, if the manifest object\n // represents a master playlist, some media playlists may need to be resolved before\n // the starting segment list is available. Therefore, go directly to setup of the\n // initial playlist, and let the normal flow continue from there.\n //\n // Note that the call to setup is asynchronous, as other sections of VHS may assume\n // that the first request is asynchronous.\n\n setTimeout(function () {\n _this7.setupInitialPlaylist(_this7.src);\n }, 0);\n return;\n } // request the specified URL\n\n\n this.request = this.vhs_.xhr({\n uri: this.src,\n withCredentials: this.withCredentials\n }, function (error, req) {\n // disposed\n if (!_this7.request) {\n return;\n } // clear the loader's request reference\n\n\n _this7.request = null;\n\n if (error) {\n _this7.error = {\n status: req.status,\n message: \"HLS playlist request error at URL: \" + _this7.src + \".\",\n responseText: req.responseText,\n // MEDIA_ERR_NETWORK\n code: 2\n };\n\n if (_this7.state === 'HAVE_NOTHING') {\n _this7.started = false;\n }\n\n return _this7.trigger('error');\n }\n\n _this7.src = resolveManifestRedirect(_this7.handleManifestRedirects, _this7.src, req);\n\n var manifest = _this7.parseManifest_({\n manifestString: req.responseText,\n url: _this7.src\n });\n\n _this7.setupInitialPlaylist(manifest);\n });\n };\n\n _proto.srcUri = function srcUri() {\n return typeof this.src === 'string' ? this.src : this.src.uri;\n }\n /**\n * Given a manifest object that's either a master or media playlist, trigger the proper\n * events and set the state of the playlist loader.\n *\n * If the manifest object represents a master playlist, `loadedplaylist` will be\n * triggered to allow listeners to select a playlist. If none is selected, the loader\n * will default to the first one in the playlists array.\n *\n * If the manifest object represents a media playlist, `loadedplaylist` will be\n * triggered followed by `loadedmetadata`, as the only available playlist is loaded.\n *\n * In the case of a media playlist, a master playlist object wrapper with one playlist\n * will be created so that all logic can handle playlists in the same fashion (as an\n * assumed manifest object schema).\n *\n * @param {Object} manifest\n * The parsed manifest object\n */\n ;\n\n _proto.setupInitialPlaylist = function setupInitialPlaylist(manifest) {\n this.state = 'HAVE_MASTER';\n\n if (manifest.playlists) {\n this.master = manifest;\n addPropertiesToMaster(this.master, this.srcUri()); // If the initial master playlist has playlists wtih segments already resolved,\n // then resolve URIs in advance, as they are usually done after a playlist request,\n // which may not happen if the playlist is resolved.\n\n manifest.playlists.forEach(function (playlist) {\n playlist.segments = getAllSegments(playlist);\n playlist.segments.forEach(function (segment) {\n resolveSegmentUris(segment, playlist.resolvedUri);\n });\n });\n this.trigger('loadedplaylist');\n\n if (!this.request) {\n // no media playlist was specifically selected so start\n // from the first listed one\n this.media(this.master.playlists[0]);\n }\n\n return;\n } // In order to support media playlists passed in as vhs-json, the case where the uri\n // is not provided as part of the manifest should be considered, and an appropriate\n // default used.\n\n\n var uri = this.srcUri() || (global_window__WEBPACK_IMPORTED_MODULE_0___default().location).href;\n this.master = masterForMedia(manifest, uri);\n this.haveMetadata({\n playlistObject: manifest,\n url: uri,\n id: this.master.playlists[0].id\n });\n this.trigger('loadedmetadata');\n };\n\n return PlaylistLoader;\n}(EventTarget$1);\n/**\n * @file xhr.js\n */\n\n\nvar videojsXHR = videojs.xhr,\n mergeOptions$1 = videojs.mergeOptions;\n\nvar callbackWrapper = function callbackWrapper(request, error, response, callback) {\n var reqResponse = request.responseType === 'arraybuffer' ? request.response : request.responseText;\n\n if (!error && reqResponse) {\n request.responseTime = Date.now();\n request.roundTripTime = request.responseTime - request.requestTime;\n request.bytesReceived = reqResponse.byteLength || reqResponse.length;\n\n if (!request.bandwidth) {\n request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1000);\n }\n }\n\n if (response.headers) {\n request.responseHeaders = response.headers;\n } // videojs.xhr now uses a specific code on the error\n // object to signal that a request has timed out instead\n // of setting a boolean on the request object\n\n\n if (error && error.code === 'ETIMEDOUT') {\n request.timedout = true;\n } // videojs.xhr no longer considers status codes outside of 200 and 0\n // (for file uris) to be errors, but the old XHR did, so emulate that\n // behavior. Status 206 may be used in response to byterange requests.\n\n\n if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) {\n error = new Error('XHR Failed with a response of: ' + (request && (reqResponse || request.responseText)));\n }\n\n callback(error, request);\n};\n\nvar xhrFactory = function xhrFactory() {\n var xhr = function XhrFunction(options, callback) {\n // Add a default timeout\n options = mergeOptions$1({\n timeout: 45e3\n }, options); // Allow an optional user-specified function to modify the option\n // object before we construct the xhr request\n\n var beforeRequest = XhrFunction.beforeRequest || videojs.Vhs.xhr.beforeRequest;\n\n if (beforeRequest && typeof beforeRequest === 'function') {\n var newOptions = beforeRequest(options);\n\n if (newOptions) {\n options = newOptions;\n }\n } // Use the standard videojs.xhr() method unless `videojs.Vhs.xhr` has been overriden\n // TODO: switch back to videojs.Vhs.xhr.name === 'XhrFunction' when we drop IE11\n\n\n var xhrMethod = videojs.Vhs.xhr.original === true ? videojsXHR : videojs.Vhs.xhr;\n var request = xhrMethod(options, function (error, response) {\n return callbackWrapper(request, error, response, callback);\n });\n var originalAbort = request.abort;\n\n request.abort = function () {\n request.aborted = true;\n return originalAbort.apply(request, arguments);\n };\n\n request.uri = options.uri;\n request.requestTime = Date.now();\n return request;\n };\n\n xhr.original = true;\n return xhr;\n};\n/**\n * Turns segment byterange into a string suitable for use in\n * HTTP Range requests\n *\n * @param {Object} byterange - an object with two values defining the start and end\n * of a byte-range\n */\n\n\nvar byterangeStr = function byterangeStr(byterange) {\n // `byterangeEnd` is one less than `offset + length` because the HTTP range\n // header uses inclusive ranges\n var byterangeEnd;\n var byterangeStart = byterange.offset;\n\n if (typeof byterange.offset === 'bigint' || typeof byterange.length === 'bigint') {\n byterangeEnd = global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt(byterange.offset) + global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt(byterange.length) - global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt(1);\n } else {\n byterangeEnd = byterange.offset + byterange.length - 1;\n }\n\n return 'bytes=' + byterangeStart + '-' + byterangeEnd;\n};\n/**\n * Defines headers for use in the xhr request for a particular segment.\n *\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n */\n\n\nvar segmentXhrHeaders = function segmentXhrHeaders(segment) {\n var headers = {};\n\n if (segment.byterange) {\n headers.Range = byterangeStr(segment.byterange);\n }\n\n return headers;\n};\n/**\n * @file bin-utils.js\n */\n\n/**\n * convert a TimeRange to text\n *\n * @param {TimeRange} range the timerange to use for conversion\n * @param {number} i the iterator on the range to convert\n * @return {string} the range in string format\n */\n\n\nvar textRange = function textRange(range, i) {\n return range.start(i) + '-' + range.end(i);\n};\n/**\n * format a number as hex string\n *\n * @param {number} e The number\n * @param {number} i the iterator\n * @return {string} the hex formatted number as a string\n */\n\n\nvar formatHexString = function formatHexString(e, i) {\n var value = e.toString(16);\n return '00'.substring(0, 2 - value.length) + value + (i % 2 ? ' ' : '');\n};\n\nvar formatAsciiString = function formatAsciiString(e) {\n if (e >= 0x20 && e < 0x7e) {\n return String.fromCharCode(e);\n }\n\n return '.';\n};\n/**\n * Creates an object for sending to a web worker modifying properties that are TypedArrays\n * into a new object with seperated properties for the buffer, byteOffset, and byteLength.\n *\n * @param {Object} message\n * Object of properties and values to send to the web worker\n * @return {Object}\n * Modified message with TypedArray values expanded\n * @function createTransferableMessage\n */\n\n\nvar createTransferableMessage = function createTransferableMessage(message) {\n var transferable = {};\n Object.keys(message).forEach(function (key) {\n var value = message[key];\n\n if ((0,_videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_15__.isArrayBufferView)(value)) {\n transferable[key] = {\n bytes: value.buffer,\n byteOffset: value.byteOffset,\n byteLength: value.byteLength\n };\n } else {\n transferable[key] = value;\n }\n });\n return transferable;\n};\n/**\n * Returns a unique string identifier for a media initialization\n * segment.\n *\n * @param {Object} initSegment\n * the init segment object.\n *\n * @return {string} the generated init segment id\n */\n\n\nvar initSegmentId = function initSegmentId(initSegment) {\n var byterange = initSegment.byterange || {\n length: Infinity,\n offset: 0\n };\n return [byterange.length, byterange.offset, initSegment.resolvedUri].join(',');\n};\n/**\n * Returns a unique string identifier for a media segment key.\n *\n * @param {Object} key the encryption key\n * @return {string} the unique id for the media segment key.\n */\n\n\nvar segmentKeyId = function segmentKeyId(key) {\n return key.resolvedUri;\n};\n/**\n * utils to help dump binary data to the console\n *\n * @param {Array|TypedArray} data\n * data to dump to a string\n *\n * @return {string} the data as a hex string.\n */\n\n\nvar hexDump = function hexDump(data) {\n var bytes = Array.prototype.slice.call(data);\n var step = 16;\n var result = '';\n var hex;\n var ascii;\n\n for (var j = 0; j < bytes.length / step; j++) {\n hex = bytes.slice(j * step, j * step + step).map(formatHexString).join('');\n ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join('');\n result += hex + ' ' + ascii + '\\n';\n }\n\n return result;\n};\n\nvar tagDump = function tagDump(_ref) {\n var bytes = _ref.bytes;\n return hexDump(bytes);\n};\n\nvar textRanges = function textRanges(ranges) {\n var result = '';\n var i;\n\n for (i = 0; i < ranges.length; i++) {\n result += textRange(ranges, i) + ' ';\n }\n\n return result;\n};\n\nvar utils = /*#__PURE__*/Object.freeze({\n __proto__: null,\n createTransferableMessage: createTransferableMessage,\n initSegmentId: initSegmentId,\n segmentKeyId: segmentKeyId,\n hexDump: hexDump,\n tagDump: tagDump,\n textRanges: textRanges\n}); // TODO handle fmp4 case where the timing info is accurate and doesn't involve transmux\n// 25% was arbitrarily chosen, and may need to be refined over time.\n\nvar SEGMENT_END_FUDGE_PERCENT = 0.25;\n/**\n * Converts a player time (any time that can be gotten/set from player.currentTime(),\n * e.g., any time within player.seekable().start(0) to player.seekable().end(0)) to a\n * program time (any time referencing the real world (e.g., EXT-X-PROGRAM-DATE-TIME)).\n *\n * The containing segment is required as the EXT-X-PROGRAM-DATE-TIME serves as an \"anchor\n * point\" (a point where we have a mapping from program time to player time, with player\n * time being the post transmux start of the segment).\n *\n * For more details, see [this doc](../../docs/program-time-from-player-time.md).\n *\n * @param {number} playerTime the player time\n * @param {Object} segment the segment which contains the player time\n * @return {Date} program time\n */\n\nvar playerTimeToProgramTime = function playerTimeToProgramTime(playerTime, segment) {\n if (!segment.dateTimeObject) {\n // Can't convert without an \"anchor point\" for the program time (i.e., a time that can\n // be used to map the start of a segment with a real world time).\n return null;\n }\n\n var transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds;\n var transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart; // get the start of the content from before old content is prepended\n\n var startOfSegment = transmuxedStart + transmuxerPrependedSeconds;\n var offsetFromSegmentStart = playerTime - startOfSegment;\n return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1000);\n};\n\nvar originalSegmentVideoDuration = function originalSegmentVideoDuration(videoTimingInfo) {\n return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds;\n};\n/**\n * Finds a segment that contains the time requested given as an ISO-8601 string. The\n * returned segment might be an estimate or an accurate match.\n *\n * @param {string} programTime The ISO-8601 programTime to find a match for\n * @param {Object} playlist A playlist object to search within\n */\n\n\nvar findSegmentForProgramTime = function findSegmentForProgramTime(programTime, playlist) {\n // Assumptions:\n // - verifyProgramDateTimeTags has already been run\n // - live streams have been started\n var dateTimeObject;\n\n try {\n dateTimeObject = new Date(programTime);\n } catch (e) {\n return null;\n }\n\n if (!playlist || !playlist.segments || playlist.segments.length === 0) {\n return null;\n }\n\n var segment = playlist.segments[0];\n\n if (dateTimeObject < segment.dateTimeObject) {\n // Requested time is before stream start.\n return null;\n }\n\n for (var i = 0; i < playlist.segments.length - 1; i++) {\n segment = playlist.segments[i];\n var nextSegmentStart = playlist.segments[i + 1].dateTimeObject;\n\n if (dateTimeObject < nextSegmentStart) {\n break;\n }\n }\n\n var lastSegment = playlist.segments[playlist.segments.length - 1];\n var lastSegmentStart = lastSegment.dateTimeObject;\n var lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT;\n var lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1000);\n\n if (dateTimeObject > lastSegmentEnd) {\n // Beyond the end of the stream, or our best guess of the end of the stream.\n return null;\n }\n\n if (dateTimeObject > lastSegmentStart) {\n segment = lastSegment;\n }\n\n return {\n segment: segment,\n estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)),\n // Although, given that all segments have accurate date time objects, the segment\n // selected should be accurate, unless the video has been transmuxed at some point\n // (determined by the presence of the videoTimingInfo object), the segment's \"player\n // time\" (the start time in the player) can't be considered accurate.\n type: segment.videoTimingInfo ? 'accurate' : 'estimate'\n };\n};\n/**\n * Finds a segment that contains the given player time(in seconds).\n *\n * @param {number} time The player time to find a match for\n * @param {Object} playlist A playlist object to search within\n */\n\n\nvar findSegmentForPlayerTime = function findSegmentForPlayerTime(time, playlist) {\n // Assumptions:\n // - there will always be a segment.duration\n // - we can start from zero\n // - segments are in time order\n if (!playlist || !playlist.segments || playlist.segments.length === 0) {\n return null;\n }\n\n var segmentEnd = 0;\n var segment;\n\n for (var i = 0; i < playlist.segments.length; i++) {\n segment = playlist.segments[i]; // videoTimingInfo is set after the segment is downloaded and transmuxed, and\n // should contain the most accurate values we have for the segment's player times.\n //\n // Use the accurate transmuxedPresentationEnd value if it is available, otherwise fall\n // back to an estimate based on the manifest derived (inaccurate) segment.duration, to\n // calculate an end value.\n\n segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration;\n\n if (time <= segmentEnd) {\n break;\n }\n }\n\n var lastSegment = playlist.segments[playlist.segments.length - 1];\n\n if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) {\n // The time requested is beyond the stream end.\n return null;\n }\n\n if (time > segmentEnd) {\n // The time is within or beyond the last segment.\n //\n // Check to see if the time is beyond a reasonable guess of the end of the stream.\n if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT) {\n // Technically, because the duration value is only an estimate, the time may still\n // exist in the last segment, however, there isn't enough information to make even\n // a reasonable estimate.\n return null;\n }\n\n segment = lastSegment;\n }\n\n return {\n segment: segment,\n estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration,\n // Because videoTimingInfo is only set after transmux, it is the only way to get\n // accurate timing values.\n type: segment.videoTimingInfo ? 'accurate' : 'estimate'\n };\n};\n/**\n * Gives the offset of the comparisonTimestamp from the programTime timestamp in seconds.\n * If the offset returned is positive, the programTime occurs after the\n * comparisonTimestamp.\n * If the offset is negative, the programTime occurs before the comparisonTimestamp.\n *\n * @param {string} comparisonTimeStamp An ISO-8601 timestamp to compare against\n * @param {string} programTime The programTime as an ISO-8601 string\n * @return {number} offset\n */\n\n\nvar getOffsetFromTimestamp = function getOffsetFromTimestamp(comparisonTimeStamp, programTime) {\n var segmentDateTime;\n var programDateTime;\n\n try {\n segmentDateTime = new Date(comparisonTimeStamp);\n programDateTime = new Date(programTime);\n } catch (e) {// TODO handle error\n }\n\n var segmentTimeEpoch = segmentDateTime.getTime();\n var programTimeEpoch = programDateTime.getTime();\n return (programTimeEpoch - segmentTimeEpoch) / 1000;\n};\n/**\n * Checks that all segments in this playlist have programDateTime tags.\n *\n * @param {Object} playlist A playlist object\n */\n\n\nvar verifyProgramDateTimeTags = function verifyProgramDateTimeTags(playlist) {\n if (!playlist.segments || playlist.segments.length === 0) {\n return false;\n }\n\n for (var i = 0; i < playlist.segments.length; i++) {\n var segment = playlist.segments[i];\n\n if (!segment.dateTimeObject) {\n return false;\n }\n }\n\n return true;\n};\n/**\n * Returns the programTime of the media given a playlist and a playerTime.\n * The playlist must have programDateTime tags for a programDateTime tag to be returned.\n * If the segments containing the time requested have not been buffered yet, an estimate\n * may be returned to the callback.\n *\n * @param {Object} args\n * @param {Object} args.playlist A playlist object to search within\n * @param {number} time A playerTime in seconds\n * @param {Function} callback(err, programTime)\n * @return {string} err.message A detailed error message\n * @return {Object} programTime\n * @return {number} programTime.mediaSeconds The streamTime in seconds\n * @return {string} programTime.programDateTime The programTime as an ISO-8601 String\n */\n\n\nvar getProgramTime = function getProgramTime(_ref) {\n var playlist = _ref.playlist,\n _ref$time = _ref.time,\n time = _ref$time === void 0 ? undefined : _ref$time,\n callback = _ref.callback;\n\n if (!callback) {\n throw new Error('getProgramTime: callback must be provided');\n }\n\n if (!playlist || time === undefined) {\n return callback({\n message: 'getProgramTime: playlist and time must be provided'\n });\n }\n\n var matchedSegment = findSegmentForPlayerTime(time, playlist);\n\n if (!matchedSegment) {\n return callback({\n message: 'valid programTime was not found'\n });\n }\n\n if (matchedSegment.type === 'estimate') {\n return callback({\n message: 'Accurate programTime could not be determined.' + ' Please seek to e.seekTime and try again',\n seekTime: matchedSegment.estimatedStart\n });\n }\n\n var programTimeObject = {\n mediaSeconds: time\n };\n var programTime = playerTimeToProgramTime(time, matchedSegment.segment);\n\n if (programTime) {\n programTimeObject.programDateTime = programTime.toISOString();\n }\n\n return callback(null, programTimeObject);\n};\n/**\n * Seeks in the player to a time that matches the given programTime ISO-8601 string.\n *\n * @param {Object} args\n * @param {string} args.programTime A programTime to seek to as an ISO-8601 String\n * @param {Object} args.playlist A playlist to look within\n * @param {number} args.retryCount The number of times to try for an accurate seek. Default is 2.\n * @param {Function} args.seekTo A method to perform a seek\n * @param {boolean} args.pauseAfterSeek Whether to end in a paused state after seeking. Default is true.\n * @param {Object} args.tech The tech to seek on\n * @param {Function} args.callback(err, newTime) A callback to return the new time to\n * @return {string} err.message A detailed error message\n * @return {number} newTime The exact time that was seeked to in seconds\n */\n\n\nvar seekToProgramTime = function seekToProgramTime(_ref2) {\n var programTime = _ref2.programTime,\n playlist = _ref2.playlist,\n _ref2$retryCount = _ref2.retryCount,\n retryCount = _ref2$retryCount === void 0 ? 2 : _ref2$retryCount,\n seekTo = _ref2.seekTo,\n _ref2$pauseAfterSeek = _ref2.pauseAfterSeek,\n pauseAfterSeek = _ref2$pauseAfterSeek === void 0 ? true : _ref2$pauseAfterSeek,\n tech = _ref2.tech,\n callback = _ref2.callback;\n\n if (!callback) {\n throw new Error('seekToProgramTime: callback must be provided');\n }\n\n if (typeof programTime === 'undefined' || !playlist || !seekTo) {\n return callback({\n message: 'seekToProgramTime: programTime, seekTo and playlist must be provided'\n });\n }\n\n if (!playlist.endList && !tech.hasStarted_) {\n return callback({\n message: 'player must be playing a live stream to start buffering'\n });\n }\n\n if (!verifyProgramDateTimeTags(playlist)) {\n return callback({\n message: 'programDateTime tags must be provided in the manifest ' + playlist.resolvedUri\n });\n }\n\n var matchedSegment = findSegmentForProgramTime(programTime, playlist); // no match\n\n if (!matchedSegment) {\n return callback({\n message: programTime + \" was not found in the stream\"\n });\n }\n\n var segment = matchedSegment.segment;\n var mediaOffset = getOffsetFromTimestamp(segment.dateTimeObject, programTime);\n\n if (matchedSegment.type === 'estimate') {\n // we've run out of retries\n if (retryCount === 0) {\n return callback({\n message: programTime + \" is not buffered yet. Try again\"\n });\n }\n\n seekTo(matchedSegment.estimatedStart + mediaOffset);\n tech.one('seeked', function () {\n seekToProgramTime({\n programTime: programTime,\n playlist: playlist,\n retryCount: retryCount - 1,\n seekTo: seekTo,\n pauseAfterSeek: pauseAfterSeek,\n tech: tech,\n callback: callback\n });\n });\n return;\n } // Since the segment.start value is determined from the buffered end or ending time\n // of the prior segment, the seekToTime doesn't need to account for any transmuxer\n // modifications.\n\n\n var seekToTime = segment.start + mediaOffset;\n\n var seekedCallback = function seekedCallback() {\n return callback(null, tech.currentTime());\n }; // listen for seeked event\n\n\n tech.one('seeked', seekedCallback); // pause before seeking as video.js will restore this state\n\n if (pauseAfterSeek) {\n tech.pause();\n }\n\n seekTo(seekToTime);\n}; // which will only happen if the request is complete.\n\n\nvar callbackOnCompleted = function callbackOnCompleted(request, cb) {\n if (request.readyState === 4) {\n return cb();\n }\n\n return;\n};\n\nvar containerRequest = function containerRequest(uri, xhr, cb) {\n var bytes = [];\n var id3Offset;\n var finished = false;\n\n var endRequestAndCallback = function endRequestAndCallback(err, req, type, _bytes) {\n req.abort();\n finished = true;\n return cb(err, req, type, _bytes);\n };\n\n var progressListener = function progressListener(error, request) {\n if (finished) {\n return;\n }\n\n if (error) {\n return endRequestAndCallback(error, request, '', bytes);\n } // grap the new part of content that was just downloaded\n\n\n var newPart = request.responseText.substring(bytes && bytes.byteLength || 0, request.responseText.length); // add that onto bytes\n\n bytes = (0,_videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_15__.concatTypedArrays)(bytes, (0,_videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_15__.stringToBytes)(newPart, true));\n id3Offset = id3Offset || (0,_videojs_vhs_utils_es_id3_helpers__WEBPACK_IMPORTED_MODULE_18__.getId3Offset)(bytes); // we need at least 10 bytes to determine a type\n // or we need at least two bytes after an id3Offset\n\n if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) {\n return callbackOnCompleted(request, function () {\n return endRequestAndCallback(error, request, '', bytes);\n });\n }\n\n var type = (0,_videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_19__.detectContainerForBytes)(bytes); // if this looks like a ts segment but we don't have enough data\n // to see the second sync byte, wait until we have enough data\n // before declaring it ts\n\n if (type === 'ts' && bytes.length < 188) {\n return callbackOnCompleted(request, function () {\n return endRequestAndCallback(error, request, '', bytes);\n });\n } // this may be an unsynced ts segment\n // wait for 376 bytes before detecting no container\n\n\n if (!type && bytes.length < 376) {\n return callbackOnCompleted(request, function () {\n return endRequestAndCallback(error, request, '', bytes);\n });\n }\n\n return endRequestAndCallback(null, request, type, bytes);\n };\n\n var options = {\n uri: uri,\n beforeSend: function beforeSend(request) {\n // this forces the browser to pass the bytes to us unprocessed\n request.overrideMimeType('text/plain; charset=x-user-defined');\n request.addEventListener('progress', function (_ref) {\n _ref.total;\n _ref.loaded;\n return callbackWrapper(request, null, {\n statusCode: request.status\n }, progressListener);\n });\n }\n };\n var request = xhr(options, function (error, response) {\n return callbackWrapper(request, error, response, progressListener);\n });\n return request;\n};\n\nvar EventTarget = videojs.EventTarget,\n mergeOptions = videojs.mergeOptions;\n\nvar dashPlaylistUnchanged = function dashPlaylistUnchanged(a, b) {\n if (!isPlaylistUnchanged(a, b)) {\n return false;\n } // for dash the above check will often return true in scenarios where\n // the playlist actually has changed because mediaSequence isn't a\n // dash thing, and we often set it to 1. So if the playlists have the same amount\n // of segments we return true.\n // So for dash we need to make sure that the underlying segments are different.\n // if sidx changed then the playlists are different.\n\n\n if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) {\n return false;\n } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) {\n return false;\n } // one or the other does not have segments\n // there was a change.\n\n\n if (a.segments && !b.segments || !a.segments && b.segments) {\n return false;\n } // neither has segments nothing changed\n\n\n if (!a.segments && !b.segments) {\n return true;\n } // check segments themselves\n\n\n for (var i = 0; i < a.segments.length; i++) {\n var aSegment = a.segments[i];\n var bSegment = b.segments[i]; // if uris are different between segments there was a change\n\n if (aSegment.uri !== bSegment.uri) {\n return false;\n } // neither segment has a byterange, there will be no byterange change.\n\n\n if (!aSegment.byterange && !bSegment.byterange) {\n continue;\n }\n\n var aByterange = aSegment.byterange;\n var bByterange = bSegment.byterange; // if byterange only exists on one of the segments, there was a change.\n\n if (aByterange && !bByterange || !aByterange && bByterange) {\n return false;\n } // if both segments have byterange with different offsets, there was a change.\n\n\n if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) {\n return false;\n }\n } // if everything was the same with segments, this is the same playlist.\n\n\n return true;\n};\n/**\n * Use the representation IDs from the mpd object to create groupIDs, the NAME is set to mandatory representation\n * ID in the parser. This allows for continuous playout across periods with the same representation IDs\n * (continuous periods as defined in DASH-IF 3.2.12). This is assumed in the mpd-parser as well. If we want to support\n * periods without continuous playback this function may need modification as well as the parser.\n */\n\n\nvar dashGroupId = function dashGroupId(type, group, label, playlist) {\n // If the manifest somehow does not have an ID (non-dash compliant), use the label.\n var playlistId = playlist.attributes.NAME || label;\n return \"placeholder-uri-\" + type + \"-\" + group + \"-\" + playlistId;\n};\n/**\n * Parses the master XML string and updates playlist URI references.\n *\n * @param {Object} config\n * Object of arguments\n * @param {string} config.masterXml\n * The mpd XML\n * @param {string} config.srcUrl\n * The mpd URL\n * @param {Date} config.clientOffset\n * A time difference between server and client\n * @param {Object} config.sidxMapping\n * SIDX mappings for moof/mdat URIs and byte ranges\n * @return {Object}\n * The parsed mpd manifest object\n */\n\n\nvar parseMasterXml = function parseMasterXml(_ref) {\n var masterXml = _ref.masterXml,\n srcUrl = _ref.srcUrl,\n clientOffset = _ref.clientOffset,\n sidxMapping = _ref.sidxMapping,\n previousManifest = _ref.previousManifest;\n var manifest = (0,mpd_parser__WEBPACK_IMPORTED_MODULE_16__.parse)(masterXml, {\n manifestUri: srcUrl,\n clientOffset: clientOffset,\n sidxMapping: sidxMapping,\n previousManifest: previousManifest\n });\n addPropertiesToMaster(manifest, srcUrl, dashGroupId);\n return manifest;\n};\n/**\n * Removes any mediaGroup labels that no longer exist in the newMaster\n *\n * @param {Object} update\n * The previous mpd object being updated\n * @param {Object} newMaster\n * The new mpd object\n */\n\n\nvar removeOldMediaGroupLabels = function removeOldMediaGroupLabels(update, newMaster) {\n forEachMediaGroup(update, function (properties, type, group, label) {\n if (!(label in newMaster.mediaGroups[type][group])) {\n delete update.mediaGroups[type][group][label];\n }\n });\n};\n/**\n * Returns a new master manifest that is the result of merging an updated master manifest\n * into the original version.\n *\n * @param {Object} oldMaster\n * The old parsed mpd object\n * @param {Object} newMaster\n * The updated parsed mpd object\n * @return {Object}\n * A new object representing the original master manifest with the updated media\n * playlists merged in\n */\n\n\nvar updateMaster = function updateMaster(oldMaster, newMaster, sidxMapping) {\n var noChanges = true;\n var update = mergeOptions(oldMaster, {\n // These are top level properties that can be updated\n duration: newMaster.duration,\n minimumUpdatePeriod: newMaster.minimumUpdatePeriod,\n timelineStarts: newMaster.timelineStarts\n }); // First update the playlists in playlist list\n\n for (var i = 0; i < newMaster.playlists.length; i++) {\n var playlist = newMaster.playlists[i];\n\n if (playlist.sidx) {\n var sidxKey = (0,mpd_parser__WEBPACK_IMPORTED_MODULE_16__.generateSidxKey)(playlist.sidx); // add sidx segments to the playlist if we have all the sidx info already\n\n if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) {\n (0,mpd_parser__WEBPACK_IMPORTED_MODULE_16__.addSidxSegmentsToPlaylist)(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri);\n }\n }\n\n var playlistUpdate = updateMaster$1(update, playlist, dashPlaylistUnchanged);\n\n if (playlistUpdate) {\n update = playlistUpdate;\n noChanges = false;\n }\n } // Then update media group playlists\n\n\n forEachMediaGroup(newMaster, function (properties, type, group, label) {\n if (properties.playlists && properties.playlists.length) {\n var id = properties.playlists[0].id;\n\n var _playlistUpdate = updateMaster$1(update, properties.playlists[0], dashPlaylistUnchanged);\n\n if (_playlistUpdate) {\n update = _playlistUpdate; // add new mediaGroup label if it doesn't exist and assign the new mediaGroup.\n\n if (!(label in update.mediaGroups[type][group])) {\n update.mediaGroups[type][group][label] = properties;\n } // update the playlist reference within media groups\n\n\n update.mediaGroups[type][group][label].playlists[0] = update.playlists[id];\n noChanges = false;\n }\n }\n }); // remove mediaGroup labels and references that no longer exist in the newMaster\n\n removeOldMediaGroupLabels(update, newMaster);\n\n if (newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) {\n noChanges = false;\n }\n\n if (noChanges) {\n return null;\n }\n\n return update;\n}; // SIDX should be equivalent if the URI and byteranges of the SIDX match.\n// If the SIDXs have maps, the two maps should match,\n// both `a` and `b` missing SIDXs is considered matching.\n// If `a` or `b` but not both have a map, they aren't matching.\n\n\nvar equivalentSidx = function equivalentSidx(a, b) {\n var neitherMap = Boolean(!a.map && !b.map);\n var equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length);\n return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length;\n}; // exported for testing\n\n\nvar compareSidxEntry = function compareSidxEntry(playlists, oldSidxMapping) {\n var newSidxMapping = {};\n\n for (var id in playlists) {\n var playlist = playlists[id];\n var currentSidxInfo = playlist.sidx;\n\n if (currentSidxInfo) {\n var key = (0,mpd_parser__WEBPACK_IMPORTED_MODULE_16__.generateSidxKey)(currentSidxInfo);\n\n if (!oldSidxMapping[key]) {\n break;\n }\n\n var savedSidxInfo = oldSidxMapping[key].sidxInfo;\n\n if (equivalentSidx(savedSidxInfo, currentSidxInfo)) {\n newSidxMapping[key] = oldSidxMapping[key];\n }\n }\n }\n\n return newSidxMapping;\n};\n/**\n * A function that filters out changed items as they need to be requested separately.\n *\n * The method is exported for testing\n *\n * @param {Object} master the parsed mpd XML returned via mpd-parser\n * @param {Object} oldSidxMapping the SIDX to compare against\n */\n\n\nvar filterChangedSidxMappings = function filterChangedSidxMappings(master, oldSidxMapping) {\n var videoSidx = compareSidxEntry(master.playlists, oldSidxMapping);\n var mediaGroupSidx = videoSidx;\n forEachMediaGroup(master, function (properties, mediaType, groupKey, labelKey) {\n if (properties.playlists && properties.playlists.length) {\n var playlists = properties.playlists;\n mediaGroupSidx = mergeOptions(mediaGroupSidx, compareSidxEntry(playlists, oldSidxMapping));\n }\n });\n return mediaGroupSidx;\n};\n\nvar DashPlaylistLoader = /*#__PURE__*/function (_EventTarget) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(DashPlaylistLoader, _EventTarget); // DashPlaylistLoader must accept either a src url or a playlist because subsequent\n // playlist loader setups from media groups will expect to be able to pass a playlist\n // (since there aren't external URLs to media playlists with DASH)\n\n\n function DashPlaylistLoader(srcUrlOrPlaylist, vhs, options, masterPlaylistLoader) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _EventTarget.call(this) || this;\n _this.masterPlaylistLoader_ = masterPlaylistLoader || (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this);\n\n if (!masterPlaylistLoader) {\n _this.isMaster_ = true;\n }\n\n var _options = options,\n _options$withCredenti = _options.withCredentials,\n withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti,\n _options$handleManife = _options.handleManifestRedirects,\n handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife;\n _this.vhs_ = vhs;\n _this.withCredentials = withCredentials;\n _this.handleManifestRedirects = handleManifestRedirects;\n\n if (!srcUrlOrPlaylist) {\n throw new Error('A non-empty playlist URL or object is required');\n } // event naming?\n\n\n _this.on('minimumUpdatePeriod', function () {\n _this.refreshXml_();\n }); // live playlist staleness timeout\n\n\n _this.on('mediaupdatetimeout', function () {\n _this.refreshMedia_(_this.media().id);\n });\n\n _this.state = 'HAVE_NOTHING';\n _this.loadedPlaylists_ = {};\n _this.logger_ = logger('DashPlaylistLoader'); // initialize the loader state\n // The masterPlaylistLoader will be created with a string\n\n if (_this.isMaster_) {\n _this.masterPlaylistLoader_.srcUrl = srcUrlOrPlaylist; // TODO: reset sidxMapping between period changes\n // once multi-period is refactored\n\n _this.masterPlaylistLoader_.sidxMapping_ = {};\n } else {\n _this.childPlaylist_ = srcUrlOrPlaylist;\n }\n\n return _this;\n }\n\n var _proto = DashPlaylistLoader.prototype;\n\n _proto.requestErrored_ = function requestErrored_(err, request, startingState) {\n // disposed\n if (!this.request) {\n return true;\n } // pending request is cleared\n\n\n this.request = null;\n\n if (err) {\n // use the provided error object or create one\n // based on the request/response\n this.error = typeof err === 'object' && !(err instanceof Error) ? err : {\n status: request.status,\n message: 'DASH request error at URL: ' + request.uri,\n response: request.response,\n // MEDIA_ERR_NETWORK\n code: 2\n };\n\n if (startingState) {\n this.state = startingState;\n }\n\n this.trigger('error');\n return true;\n }\n }\n /**\n * Verify that the container of the sidx segment can be parsed\n * and if it can, get and parse that segment.\n */\n ;\n\n _proto.addSidxSegments_ = function addSidxSegments_(playlist, startingState, cb) {\n var _this2 = this;\n\n var sidxKey = playlist.sidx && (0,mpd_parser__WEBPACK_IMPORTED_MODULE_16__.generateSidxKey)(playlist.sidx); // playlist lacks sidx or sidx segments were added to this playlist already.\n\n if (!playlist.sidx || !sidxKey || this.masterPlaylistLoader_.sidxMapping_[sidxKey]) {\n // keep this function async\n this.mediaRequest_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n return cb(false);\n }, 0);\n return;\n } // resolve the segment URL relative to the playlist\n\n\n var uri = resolveManifestRedirect(this.handleManifestRedirects, playlist.sidx.resolvedUri);\n\n var fin = function fin(err, request) {\n if (_this2.requestErrored_(err, request, startingState)) {\n return;\n }\n\n var sidxMapping = _this2.masterPlaylistLoader_.sidxMapping_;\n var sidx;\n\n try {\n sidx = mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_17___default()((0,_videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_15__.toUint8)(request.response).subarray(8));\n } catch (e) {\n // sidx parsing failed.\n _this2.requestErrored_(e, request, startingState);\n\n return;\n }\n\n sidxMapping[sidxKey] = {\n sidxInfo: playlist.sidx,\n sidx: sidx\n };\n (0,mpd_parser__WEBPACK_IMPORTED_MODULE_16__.addSidxSegmentsToPlaylist)(playlist, sidx, playlist.sidx.resolvedUri);\n return cb(true);\n };\n\n this.request = containerRequest(uri, this.vhs_.xhr, function (err, request, container, bytes) {\n if (err) {\n return fin(err, request);\n }\n\n if (!container || container !== 'mp4') {\n return fin({\n status: request.status,\n message: \"Unsupported \" + (container || 'unknown') + \" container type for sidx segment at URL: \" + uri,\n // response is just bytes in this case\n // but we really don't want to return that.\n response: '',\n playlist: playlist,\n internal: true,\n blacklistDuration: Infinity,\n // MEDIA_ERR_NETWORK\n code: 2\n }, request);\n } // if we already downloaded the sidx bytes in the container request, use them\n\n\n var _playlist$sidx$bytera = playlist.sidx.byterange,\n offset = _playlist$sidx$bytera.offset,\n length = _playlist$sidx$bytera.length;\n\n if (bytes.length >= length + offset) {\n return fin(err, {\n response: bytes.subarray(offset, offset + length),\n status: request.status,\n uri: request.uri\n });\n } // otherwise request sidx bytes\n\n\n _this2.request = _this2.vhs_.xhr({\n uri: uri,\n responseType: 'arraybuffer',\n headers: segmentXhrHeaders({\n byterange: playlist.sidx.byterange\n })\n }, fin);\n });\n };\n\n _proto.dispose = function dispose() {\n this.trigger('dispose');\n this.stopRequest();\n this.loadedPlaylists_ = {};\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.minimumUpdatePeriodTimeout_);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaRequest_);\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n this.mediaRequest_ = null;\n this.minimumUpdatePeriodTimeout_ = null;\n\n if (this.masterPlaylistLoader_.createMupOnMedia_) {\n this.off('loadedmetadata', this.masterPlaylistLoader_.createMupOnMedia_);\n this.masterPlaylistLoader_.createMupOnMedia_ = null;\n }\n\n this.off();\n };\n\n _proto.hasPendingRequest = function hasPendingRequest() {\n return this.request || this.mediaRequest_;\n };\n\n _proto.stopRequest = function stopRequest() {\n if (this.request) {\n var oldRequest = this.request;\n this.request = null;\n oldRequest.onreadystatechange = null;\n oldRequest.abort();\n }\n };\n\n _proto.media = function media(playlist) {\n var _this3 = this; // getter\n\n\n if (!playlist) {\n return this.media_;\n } // setter\n\n\n if (this.state === 'HAVE_NOTHING') {\n throw new Error('Cannot switch media playlist from ' + this.state);\n }\n\n var startingState = this.state; // find the playlist object if the target playlist has been specified by URI\n\n if (typeof playlist === 'string') {\n if (!this.masterPlaylistLoader_.master.playlists[playlist]) {\n throw new Error('Unknown playlist URI: ' + playlist);\n }\n\n playlist = this.masterPlaylistLoader_.master.playlists[playlist];\n }\n\n var mediaChange = !this.media_ || playlist.id !== this.media_.id; // switch to previously loaded playlists immediately\n\n if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) {\n this.state = 'HAVE_METADATA';\n this.media_ = playlist; // trigger media change if the active media has been updated\n\n if (mediaChange) {\n this.trigger('mediachanging');\n this.trigger('mediachange');\n }\n\n return;\n } // switching to the active playlist is a no-op\n\n\n if (!mediaChange) {\n return;\n } // switching from an already loaded playlist\n\n\n if (this.media_) {\n this.trigger('mediachanging');\n }\n\n this.addSidxSegments_(playlist, startingState, function (sidxChanged) {\n // everything is ready just continue to haveMetadata\n _this3.haveMetadata({\n startingState: startingState,\n playlist: playlist\n });\n });\n };\n\n _proto.haveMetadata = function haveMetadata(_ref2) {\n var startingState = _ref2.startingState,\n playlist = _ref2.playlist;\n this.state = 'HAVE_METADATA';\n this.loadedPlaylists_[playlist.id] = playlist;\n this.mediaRequest_ = null; // This will trigger loadedplaylist\n\n this.refreshMedia_(playlist.id); // fire loadedmetadata the first time a media playlist is loaded\n // to resolve setup of media groups\n\n if (startingState === 'HAVE_MASTER') {\n this.trigger('loadedmetadata');\n } else {\n // trigger media change if the active media has been updated\n this.trigger('mediachange');\n }\n };\n\n _proto.pause = function pause() {\n if (this.masterPlaylistLoader_.createMupOnMedia_) {\n this.off('loadedmetadata', this.masterPlaylistLoader_.createMupOnMedia_);\n this.masterPlaylistLoader_.createMupOnMedia_ = null;\n }\n\n this.stopRequest();\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n\n if (this.isMaster_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_);\n this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_ = null;\n }\n\n if (this.state === 'HAVE_NOTHING') {\n // If we pause the loader before any data has been retrieved, its as if we never\n // started, so reset to an unstarted state.\n this.started = false;\n }\n };\n\n _proto.load = function load(isFinalRendition) {\n var _this4 = this;\n\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.mediaUpdateTimeout);\n this.mediaUpdateTimeout = null;\n var media = this.media();\n\n if (isFinalRendition) {\n var delay = media ? media.targetDuration / 2 * 1000 : 5 * 1000;\n this.mediaUpdateTimeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n return _this4.load();\n }, delay);\n return;\n } // because the playlists are internal to the manifest, load should either load the\n // main manifest, or do nothing but trigger an event\n\n\n if (!this.started) {\n this.start();\n return;\n }\n\n if (media && !media.endList) {\n // Check to see if this is the master loader and the MUP was cleared (this happens\n // when the loader was paused). `media` should be set at this point since one is always\n // set during `start()`.\n if (this.isMaster_ && !this.minimumUpdatePeriodTimeout_) {\n // Trigger minimumUpdatePeriod to refresh the master manifest\n this.trigger('minimumUpdatePeriod'); // Since there was no prior minimumUpdatePeriodTimeout it should be recreated\n\n this.updateMinimumUpdatePeriodTimeout_();\n }\n\n this.trigger('mediaupdatetimeout');\n } else {\n this.trigger('loadedplaylist');\n }\n };\n\n _proto.start = function start() {\n var _this5 = this;\n\n this.started = true; // We don't need to request the master manifest again\n // Call this asynchronously to match the xhr request behavior below\n\n if (!this.isMaster_) {\n this.mediaRequest_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n return _this5.haveMaster_();\n }, 0);\n return;\n }\n\n this.requestMaster_(function (req, masterChanged) {\n _this5.haveMaster_();\n\n if (!_this5.hasPendingRequest() && !_this5.media_) {\n _this5.media(_this5.masterPlaylistLoader_.master.playlists[0]);\n }\n });\n };\n\n _proto.requestMaster_ = function requestMaster_(cb) {\n var _this6 = this;\n\n this.request = this.vhs_.xhr({\n uri: this.masterPlaylistLoader_.srcUrl,\n withCredentials: this.withCredentials\n }, function (error, req) {\n if (_this6.requestErrored_(error, req)) {\n if (_this6.state === 'HAVE_NOTHING') {\n _this6.started = false;\n }\n\n return;\n }\n\n var masterChanged = req.responseText !== _this6.masterPlaylistLoader_.masterXml_;\n _this6.masterPlaylistLoader_.masterXml_ = req.responseText;\n\n if (req.responseHeaders && req.responseHeaders.date) {\n _this6.masterLoaded_ = Date.parse(req.responseHeaders.date);\n } else {\n _this6.masterLoaded_ = Date.now();\n }\n\n _this6.masterPlaylistLoader_.srcUrl = resolveManifestRedirect(_this6.handleManifestRedirects, _this6.masterPlaylistLoader_.srcUrl, req);\n\n if (masterChanged) {\n _this6.handleMaster_();\n\n _this6.syncClientServerClock_(function () {\n return cb(req, masterChanged);\n });\n\n return;\n }\n\n return cb(req, masterChanged);\n });\n }\n /**\n * Parses the master xml for UTCTiming node to sync the client clock to the server\n * clock. If the UTCTiming node requires a HEAD or GET request, that request is made.\n *\n * @param {Function} done\n * Function to call when clock sync has completed\n */\n ;\n\n _proto.syncClientServerClock_ = function syncClientServerClock_(done) {\n var _this7 = this;\n\n var utcTiming = (0,mpd_parser__WEBPACK_IMPORTED_MODULE_16__.parseUTCTiming)(this.masterPlaylistLoader_.masterXml_); // No UTCTiming element found in the mpd. Use Date header from mpd request as the\n // server clock\n\n if (utcTiming === null) {\n this.masterPlaylistLoader_.clientOffset_ = this.masterLoaded_ - Date.now();\n return done();\n }\n\n if (utcTiming.method === 'DIRECT') {\n this.masterPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now();\n return done();\n }\n\n this.request = this.vhs_.xhr({\n uri: resolveUrl(this.masterPlaylistLoader_.srcUrl, utcTiming.value),\n method: utcTiming.method,\n withCredentials: this.withCredentials\n }, function (error, req) {\n // disposed\n if (!_this7.request) {\n return;\n }\n\n if (error) {\n // sync request failed, fall back to using date header from mpd\n // TODO: log warning\n _this7.masterPlaylistLoader_.clientOffset_ = _this7.masterLoaded_ - Date.now();\n return done();\n }\n\n var serverTime;\n\n if (utcTiming.method === 'HEAD') {\n if (!req.responseHeaders || !req.responseHeaders.date) {\n // expected date header not preset, fall back to using date header from mpd\n // TODO: log warning\n serverTime = _this7.masterLoaded_;\n } else {\n serverTime = Date.parse(req.responseHeaders.date);\n }\n } else {\n serverTime = Date.parse(req.responseText);\n }\n\n _this7.masterPlaylistLoader_.clientOffset_ = serverTime - Date.now();\n done();\n });\n };\n\n _proto.haveMaster_ = function haveMaster_() {\n this.state = 'HAVE_MASTER';\n\n if (this.isMaster_) {\n // We have the master playlist at this point, so\n // trigger this to allow MasterPlaylistController\n // to make an initial playlist selection\n this.trigger('loadedplaylist');\n } else if (!this.media_) {\n // no media playlist was specifically selected so select\n // the one the child playlist loader was created with\n this.media(this.childPlaylist_);\n }\n };\n\n _proto.handleMaster_ = function handleMaster_() {\n // clear media request\n this.mediaRequest_ = null;\n var oldMaster = this.masterPlaylistLoader_.master;\n var newMaster = parseMasterXml({\n masterXml: this.masterPlaylistLoader_.masterXml_,\n srcUrl: this.masterPlaylistLoader_.srcUrl,\n clientOffset: this.masterPlaylistLoader_.clientOffset_,\n sidxMapping: this.masterPlaylistLoader_.sidxMapping_,\n previousManifest: oldMaster\n }); // if we have an old master to compare the new master against\n\n if (oldMaster) {\n newMaster = updateMaster(oldMaster, newMaster, this.masterPlaylistLoader_.sidxMapping_);\n } // only update master if we have a new master\n\n\n this.masterPlaylistLoader_.master = newMaster ? newMaster : oldMaster;\n var location = this.masterPlaylistLoader_.master.locations && this.masterPlaylistLoader_.master.locations[0];\n\n if (location && location !== this.masterPlaylistLoader_.srcUrl) {\n this.masterPlaylistLoader_.srcUrl = location;\n }\n\n if (!oldMaster || newMaster && newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) {\n this.updateMinimumUpdatePeriodTimeout_();\n }\n\n return Boolean(newMaster);\n };\n\n _proto.updateMinimumUpdatePeriodTimeout_ = function updateMinimumUpdatePeriodTimeout_() {\n var mpl = this.masterPlaylistLoader_; // cancel any pending creation of mup on media\n // a new one will be added if needed.\n\n if (mpl.createMupOnMedia_) {\n mpl.off('loadedmetadata', mpl.createMupOnMedia_);\n mpl.createMupOnMedia_ = null;\n } // clear any pending timeouts\n\n\n if (mpl.minimumUpdatePeriodTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(mpl.minimumUpdatePeriodTimeout_);\n mpl.minimumUpdatePeriodTimeout_ = null;\n }\n\n var mup = mpl.master && mpl.master.minimumUpdatePeriod; // If the minimumUpdatePeriod has a value of 0, that indicates that the current\n // MPD has no future validity, so a new one will need to be acquired when new\n // media segments are to be made available. Thus, we use the target duration\n // in this case\n\n if (mup === 0) {\n if (mpl.media()) {\n mup = mpl.media().targetDuration * 1000;\n } else {\n mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_;\n mpl.one('loadedmetadata', mpl.createMupOnMedia_);\n }\n } // if minimumUpdatePeriod is invalid or <= zero, which\n // can happen when a live video becomes VOD. skip timeout\n // creation.\n\n\n if (typeof mup !== 'number' || mup <= 0) {\n if (mup < 0) {\n this.logger_(\"found invalid minimumUpdatePeriod of \" + mup + \", not setting a timeout\");\n }\n\n return;\n }\n\n this.createMUPTimeout_(mup);\n };\n\n _proto.createMUPTimeout_ = function createMUPTimeout_(mup) {\n var mpl = this.masterPlaylistLoader_;\n mpl.minimumUpdatePeriodTimeout_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n mpl.minimumUpdatePeriodTimeout_ = null;\n mpl.trigger('minimumUpdatePeriod');\n mpl.createMUPTimeout_(mup);\n }, mup);\n }\n /**\n * Sends request to refresh the master xml and updates the parsed master manifest\n */\n ;\n\n _proto.refreshXml_ = function refreshXml_() {\n var _this8 = this;\n\n this.requestMaster_(function (req, masterChanged) {\n if (!masterChanged) {\n return;\n }\n\n if (_this8.media_) {\n _this8.media_ = _this8.masterPlaylistLoader_.master.playlists[_this8.media_.id];\n } // This will filter out updated sidx info from the mapping\n\n\n _this8.masterPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings(_this8.masterPlaylistLoader_.master, _this8.masterPlaylistLoader_.sidxMapping_);\n\n _this8.addSidxSegments_(_this8.media(), _this8.state, function (sidxChanged) {\n // TODO: do we need to reload the current playlist?\n _this8.refreshMedia_(_this8.media().id);\n });\n });\n }\n /**\n * Refreshes the media playlist by re-parsing the master xml and updating playlist\n * references. If this is an alternate loader, the updated parsed manifest is retrieved\n * from the master loader.\n */\n ;\n\n _proto.refreshMedia_ = function refreshMedia_(mediaID) {\n var _this9 = this;\n\n if (!mediaID) {\n throw new Error('refreshMedia_ must take a media id');\n } // for master we have to reparse the master xml\n // to re-create segments based on current timing values\n // which may change media. We only skip updating master\n // if this is the first time this.media_ is being set.\n // as master was just parsed in that case.\n\n\n if (this.media_ && this.isMaster_) {\n this.handleMaster_();\n }\n\n var playlists = this.masterPlaylistLoader_.master.playlists;\n var mediaChanged = !this.media_ || this.media_ !== playlists[mediaID];\n\n if (mediaChanged) {\n this.media_ = playlists[mediaID];\n } else {\n this.trigger('playlistunchanged');\n }\n\n if (!this.mediaUpdateTimeout) {\n var createMediaUpdateTimeout = function createMediaUpdateTimeout() {\n if (_this9.media().endList) {\n return;\n }\n\n _this9.mediaUpdateTimeout = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n _this9.trigger('mediaupdatetimeout');\n\n createMediaUpdateTimeout();\n }, refreshDelay(_this9.media(), Boolean(mediaChanged)));\n };\n\n createMediaUpdateTimeout();\n }\n\n this.trigger('loadedplaylist');\n };\n\n return DashPlaylistLoader;\n}(EventTarget);\n\nvar Config = {\n GOAL_BUFFER_LENGTH: 30,\n MAX_GOAL_BUFFER_LENGTH: 60,\n BACK_BUFFER_LENGTH: 30,\n GOAL_BUFFER_LENGTH_RATE: 1,\n // 0.5 MB/s\n INITIAL_BANDWIDTH: 4194304,\n // A fudge factor to apply to advertised playlist bitrates to account for\n // temporary flucations in client bandwidth\n BANDWIDTH_VARIANCE: 1.2,\n // How much of the buffer must be filled before we consider upswitching\n BUFFER_LOW_WATER_LINE: 0,\n MAX_BUFFER_LOW_WATER_LINE: 30,\n // TODO: Remove this when experimentalBufferBasedABR is removed\n EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16,\n BUFFER_LOW_WATER_LINE_RATE: 1,\n // If the buffer is greater than the high water line, we won't switch down\n BUFFER_HIGH_WATER_LINE: 30\n};\n\nvar stringToArrayBuffer = function stringToArrayBuffer(string) {\n var view = new Uint8Array(new ArrayBuffer(string.length));\n\n for (var i = 0; i < string.length; i++) {\n view[i] = string.charCodeAt(i);\n }\n\n return view.buffer;\n};\n/* global Blob, BlobBuilder, Worker */\n// unify worker interface\n\n\nvar browserWorkerPolyFill = function browserWorkerPolyFill(workerObj) {\n // node only supports on/off\n workerObj.on = workerObj.addEventListener;\n workerObj.off = workerObj.removeEventListener;\n return workerObj;\n};\n\nvar createObjectURL = function createObjectURL(str) {\n try {\n return URL.createObjectURL(new Blob([str], {\n type: 'application/javascript'\n }));\n } catch (e) {\n var blob = new BlobBuilder();\n blob.append(str);\n return URL.createObjectURL(blob.getBlob());\n }\n};\n\nvar factory = function factory(code) {\n return function () {\n var objectUrl = createObjectURL(code);\n var worker = browserWorkerPolyFill(new Worker(objectUrl));\n worker.objURL = objectUrl;\n var terminate = worker.terminate;\n worker.on = worker.addEventListener;\n worker.off = worker.removeEventListener;\n\n worker.terminate = function () {\n URL.revokeObjectURL(objectUrl);\n return terminate.call(this);\n };\n\n return worker;\n };\n};\n\nvar transform = function transform(code) {\n return \"var browserWorkerPolyFill = \" + browserWorkerPolyFill.toString() + \";\\n\" + 'browserWorkerPolyFill(self);\\n' + code;\n};\n\nvar getWorkerString = function getWorkerString(fn) {\n return fn.toString().replace(/^function.+?{/, '').slice(0, -1);\n};\n/* rollup-plugin-worker-factory start for worker!/Users/ddashkevich/projects/http-streaming/src/transmuxer-worker.js */\n\n\nvar workerCode$1 = transform(getWorkerString(function () {\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * A lightweight readable stream implemention that handles event dispatching.\n * Objects that inherit from streams should call init in their constructors.\n */\n var Stream = function Stream() {\n this.init = function () {\n var listeners = {};\n /**\n * Add a listener for a specified event type.\n * @param type {string} the event name\n * @param listener {function} the callback to be invoked when an event of\n * the specified type occurs\n */\n\n this.on = function (type, listener) {\n if (!listeners[type]) {\n listeners[type] = [];\n }\n\n listeners[type] = listeners[type].concat(listener);\n };\n /**\n * Remove a listener for a specified event type.\n * @param type {string} the event name\n * @param listener {function} a function previously registered for this\n * type of event through `on`\n */\n\n\n this.off = function (type, listener) {\n var index;\n\n if (!listeners[type]) {\n return false;\n }\n\n index = listeners[type].indexOf(listener);\n listeners[type] = listeners[type].slice();\n listeners[type].splice(index, 1);\n return index > -1;\n };\n /**\n * Trigger an event of the specified type on this stream. Any additional\n * arguments to this function are passed as parameters to event listeners.\n * @param type {string} the event name\n */\n\n\n this.trigger = function (type) {\n var callbacks, i, length, args;\n callbacks = listeners[type];\n\n if (!callbacks) {\n return;\n } // Slicing the arguments on every invocation of this method\n // can add a significant amount of overhead. Avoid the\n // intermediate object creation for the common case of a\n // single callback argument\n\n\n if (arguments.length === 2) {\n length = callbacks.length;\n\n for (i = 0; i < length; ++i) {\n callbacks[i].call(this, arguments[1]);\n }\n } else {\n args = [];\n i = arguments.length;\n\n for (i = 1; i < arguments.length; ++i) {\n args.push(arguments[i]);\n }\n\n length = callbacks.length;\n\n for (i = 0; i < length; ++i) {\n callbacks[i].apply(this, args);\n }\n }\n };\n /**\n * Destroys the stream and cleans up.\n */\n\n\n this.dispose = function () {\n listeners = {};\n };\n };\n };\n /**\n * Forwards all `data` events on this stream to the destination stream. The\n * destination stream should provide a method `push` to receive the data\n * events as they arrive.\n * @param destination {stream} the stream that will receive all `data` events\n * @param autoFlush {boolean} if false, we will not call `flush` on the destination\n * when the current stream emits a 'done' event\n * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options\n */\n\n\n Stream.prototype.pipe = function (destination) {\n this.on('data', function (data) {\n destination.push(data);\n });\n this.on('done', function (flushSource) {\n destination.flush(flushSource);\n });\n this.on('partialdone', function (flushSource) {\n destination.partialFlush(flushSource);\n });\n this.on('endedtimeline', function (flushSource) {\n destination.endTimeline(flushSource);\n });\n this.on('reset', function (flushSource) {\n destination.reset(flushSource);\n });\n return destination;\n }; // Default stream functions that are expected to be overridden to perform\n // actual work. These are provided by the prototype as a sort of no-op\n // implementation so that we don't have to check for their existence in the\n // `pipe` function above.\n\n\n Stream.prototype.push = function (data) {\n this.trigger('data', data);\n };\n\n Stream.prototype.flush = function (flushSource) {\n this.trigger('done', flushSource);\n };\n\n Stream.prototype.partialFlush = function (flushSource) {\n this.trigger('partialdone', flushSource);\n };\n\n Stream.prototype.endTimeline = function (flushSource) {\n this.trigger('endedtimeline', flushSource);\n };\n\n Stream.prototype.reset = function (flushSource) {\n this.trigger('reset', flushSource);\n };\n\n var stream = Stream;\n var MAX_UINT32$1 = Math.pow(2, 32);\n\n var getUint64$2 = function getUint64(uint8) {\n var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);\n var value;\n\n if (dv.getBigUint64) {\n value = dv.getBigUint64(0);\n\n if (value < Number.MAX_SAFE_INTEGER) {\n return Number(value);\n }\n\n return value;\n }\n\n return dv.getUint32(0) * MAX_UINT32$1 + dv.getUint32(4);\n };\n\n var numbers = {\n getUint64: getUint64$2,\n MAX_UINT32: MAX_UINT32$1\n };\n var MAX_UINT32 = numbers.MAX_UINT32;\n var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS; // pre-calculate constants\n\n (function () {\n var i;\n types = {\n avc1: [],\n // codingname\n avcC: [],\n btrt: [],\n dinf: [],\n dref: [],\n esds: [],\n ftyp: [],\n hdlr: [],\n mdat: [],\n mdhd: [],\n mdia: [],\n mfhd: [],\n minf: [],\n moof: [],\n moov: [],\n mp4a: [],\n // codingname\n mvex: [],\n mvhd: [],\n pasp: [],\n sdtp: [],\n smhd: [],\n stbl: [],\n stco: [],\n stsc: [],\n stsd: [],\n stsz: [],\n stts: [],\n styp: [],\n tfdt: [],\n tfhd: [],\n traf: [],\n trak: [],\n trun: [],\n trex: [],\n tkhd: [],\n vmhd: []\n }; // In environments where Uint8Array is undefined (e.g., IE8), skip set up so that we\n // don't throw an error\n\n if (typeof Uint8Array === 'undefined') {\n return;\n }\n\n for (i in types) {\n if (types.hasOwnProperty(i)) {\n types[i] = [i.charCodeAt(0), i.charCodeAt(1), i.charCodeAt(2), i.charCodeAt(3)];\n }\n }\n\n MAJOR_BRAND = new Uint8Array(['i'.charCodeAt(0), 's'.charCodeAt(0), 'o'.charCodeAt(0), 'm'.charCodeAt(0)]);\n AVC1_BRAND = new Uint8Array(['a'.charCodeAt(0), 'v'.charCodeAt(0), 'c'.charCodeAt(0), '1'.charCodeAt(0)]);\n MINOR_VERSION = new Uint8Array([0, 0, 0, 1]);\n VIDEO_HDLR = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x76, 0x69, 0x64, 0x65, // handler_type: 'vide'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x56, 0x69, 0x64, 0x65, 0x6f, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'VideoHandler'\n ]);\n AUDIO_HDLR = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0x73, 0x6f, 0x75, 0x6e, // handler_type: 'soun'\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x53, 0x6f, 0x75, 0x6e, 0x64, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x00 // name: 'SoundHandler'\n ]);\n HDLR_TYPES = {\n video: VIDEO_HDLR,\n audio: AUDIO_HDLR\n };\n DREF = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01, // entry_count\n 0x00, 0x00, 0x00, 0x0c, // entry_size\n 0x75, 0x72, 0x6c, 0x20, // 'url' type\n 0x00, // version 0\n 0x00, 0x00, 0x01 // entry_flags\n ]);\n SMHD = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, // balance, 0 means centered\n 0x00, 0x00 // reserved\n ]);\n STCO = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00 // entry_count\n ]);\n STSC = STCO;\n STSZ = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x00, // sample_size\n 0x00, 0x00, 0x00, 0x00 // sample_count\n ]);\n STTS = STCO;\n VMHD = new Uint8Array([0x00, // version\n 0x00, 0x00, 0x01, // flags\n 0x00, 0x00, // graphicsmode\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // opcolor\n ]);\n })();\n\n box = function box(type) {\n var payload = [],\n size = 0,\n i,\n result,\n view;\n\n for (i = 1; i < arguments.length; i++) {\n payload.push(arguments[i]);\n }\n\n i = payload.length; // calculate the total size we need to allocate\n\n while (i--) {\n size += payload[i].byteLength;\n }\n\n result = new Uint8Array(size + 8);\n view = new DataView(result.buffer, result.byteOffset, result.byteLength);\n view.setUint32(0, result.byteLength);\n result.set(type, 4); // copy the payload into the result\n\n for (i = 0, size = 8; i < payload.length; i++) {\n result.set(payload[i], size);\n size += payload[i].byteLength;\n }\n\n return result;\n };\n\n dinf = function dinf() {\n return box(types.dinf, box(types.dref, DREF));\n };\n\n esds = function esds(track) {\n return box(types.esds, new Uint8Array([0x00, // version\n 0x00, 0x00, 0x00, // flags\n // ES_Descriptor\n 0x03, // tag, ES_DescrTag\n 0x19, // length\n 0x00, 0x00, // ES_ID\n 0x00, // streamDependenceFlag, URL_flag, reserved, streamPriority\n // DecoderConfigDescriptor\n 0x04, // tag, DecoderConfigDescrTag\n 0x11, // length\n 0x40, // object type\n 0x15, // streamType\n 0x00, 0x06, 0x00, // bufferSizeDB\n 0x00, 0x00, 0xda, 0xc0, // maxBitrate\n 0x00, 0x00, 0xda, 0xc0, // avgBitrate\n // DecoderSpecificInfo\n 0x05, // tag, DecoderSpecificInfoTag\n 0x02, // length\n // ISO/IEC 14496-3, AudioSpecificConfig\n // for samplingFrequencyIndex see ISO/IEC 13818-7:2006, 8.1.3.2.2, Table 35\n track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1, track.samplingfrequencyindex << 7 | track.channelcount << 3, 0x06, 0x01, 0x02 // GASpecificConfig\n ]));\n };\n\n ftyp = function ftyp() {\n return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND);\n };\n\n hdlr = function hdlr(type) {\n return box(types.hdlr, HDLR_TYPES[type]);\n };\n\n mdat = function mdat(data) {\n return box(types.mdat, data);\n };\n\n mdhd = function mdhd(track) {\n var result = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x02, // creation_time\n 0x00, 0x00, 0x00, 0x03, // modification_time\n 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 \"ticks\" per second\n track.duration >>> 24 & 0xFF, track.duration >>> 16 & 0xFF, track.duration >>> 8 & 0xFF, track.duration & 0xFF, // duration\n 0x55, 0xc4, // 'und' language (undetermined)\n 0x00, 0x00]); // Use the sample rate from the track metadata, when it is\n // defined. The sample rate can be parsed out of an ADTS header, for\n // instance.\n\n if (track.samplerate) {\n result[12] = track.samplerate >>> 24 & 0xFF;\n result[13] = track.samplerate >>> 16 & 0xFF;\n result[14] = track.samplerate >>> 8 & 0xFF;\n result[15] = track.samplerate & 0xFF;\n }\n\n return box(types.mdhd, result);\n };\n\n mdia = function mdia(track) {\n return box(types.mdia, mdhd(track), hdlr(track.type), minf(track));\n };\n\n mfhd = function mfhd(sequenceNumber) {\n return box(types.mfhd, new Uint8Array([0x00, 0x00, 0x00, 0x00, // flags\n (sequenceNumber & 0xFF000000) >> 24, (sequenceNumber & 0xFF0000) >> 16, (sequenceNumber & 0xFF00) >> 8, sequenceNumber & 0xFF // sequence_number\n ]));\n };\n\n minf = function minf(track) {\n return box(types.minf, track.type === 'video' ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track));\n };\n\n moof = function moof(sequenceNumber, tracks) {\n var trackFragments = [],\n i = tracks.length; // build traf boxes for each track fragment\n\n while (i--) {\n trackFragments[i] = traf(tracks[i]);\n }\n\n return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments));\n };\n /**\n * Returns a movie box.\n * @param tracks {array} the tracks associated with this movie\n * @see ISO/IEC 14496-12:2012(E), section 8.2.1\n */\n\n\n moov = function moov(tracks) {\n var i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = trak(tracks[i]);\n }\n\n return box.apply(null, [types.moov, mvhd(0xffffffff)].concat(boxes).concat(mvex(tracks)));\n };\n\n mvex = function mvex(tracks) {\n var i = tracks.length,\n boxes = [];\n\n while (i--) {\n boxes[i] = trex(tracks[i]);\n }\n\n return box.apply(null, [types.mvex].concat(boxes));\n };\n\n mvhd = function mvhd(duration) {\n var bytes = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01, // creation_time\n 0x00, 0x00, 0x00, 0x02, // modification_time\n 0x00, 0x01, 0x5f, 0x90, // timescale, 90,000 \"ticks\" per second\n (duration & 0xFF000000) >> 24, (duration & 0xFF0000) >> 16, (duration & 0xFF00) >> 8, duration & 0xFF, // duration\n 0x00, 0x01, 0x00, 0x00, // 1.0 rate\n 0x01, 0x00, // 1.0 volume\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined\n 0xff, 0xff, 0xff, 0xff // next_track_ID\n ]);\n return box(types.mvhd, bytes);\n };\n\n sdtp = function sdtp(track) {\n var samples = track.samples || [],\n bytes = new Uint8Array(4 + samples.length),\n flags,\n i; // leave the full box header (4 bytes) all zero\n // write the sample table\n\n for (i = 0; i < samples.length; i++) {\n flags = samples[i].flags;\n bytes[i + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;\n }\n\n return box(types.sdtp, bytes);\n };\n\n stbl = function stbl(track) {\n return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO));\n };\n\n (function () {\n var videoSample, audioSample;\n\n stsd = function stsd(track) {\n return box(types.stsd, new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n 0x00, 0x00, 0x00, 0x01]), track.type === 'video' ? videoSample(track) : audioSample(track));\n };\n\n videoSample = function videoSample(track) {\n var sps = track.sps || [],\n pps = track.pps || [],\n sequenceParameterSets = [],\n pictureParameterSets = [],\n i,\n avc1Box; // assemble the SPSs\n\n for (i = 0; i < sps.length; i++) {\n sequenceParameterSets.push((sps[i].byteLength & 0xFF00) >>> 8);\n sequenceParameterSets.push(sps[i].byteLength & 0xFF); // sequenceParameterSetLength\n\n sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i])); // SPS\n } // assemble the PPSs\n\n\n for (i = 0; i < pps.length; i++) {\n pictureParameterSets.push((pps[i].byteLength & 0xFF00) >>> 8);\n pictureParameterSets.push(pps[i].byteLength & 0xFF);\n pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i]));\n }\n\n avc1Box = [types.avc1, new Uint8Array([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // pre_defined\n (track.width & 0xff00) >> 8, track.width & 0xff, // width\n (track.height & 0xff00) >> 8, track.height & 0xff, // height\n 0x00, 0x48, 0x00, 0x00, // horizresolution\n 0x00, 0x48, 0x00, 0x00, // vertresolution\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // frame_count\n 0x13, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x6a, 0x73, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x2d, 0x68, 0x6c, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // compressorname\n 0x00, 0x18, // depth = 24\n 0x11, 0x11 // pre_defined = -1\n ]), box(types.avcC, new Uint8Array([0x01, // configurationVersion\n track.profileIdc, // AVCProfileIndication\n track.profileCompatibility, // profile_compatibility\n track.levelIdc, // AVCLevelIndication\n 0xff // lengthSizeMinusOne, hard-coded to 4 bytes\n ].concat([sps.length], // numOfSequenceParameterSets\n sequenceParameterSets, // \"SPS\"\n [pps.length], // numOfPictureParameterSets\n pictureParameterSets // \"PPS\"\n ))), box(types.btrt, new Uint8Array([0x00, 0x1c, 0x9c, 0x80, // bufferSizeDB\n 0x00, 0x2d, 0xc6, 0xc0, // maxBitrate\n 0x00, 0x2d, 0xc6, 0xc0 // avgBitrate\n ]))];\n\n if (track.sarRatio) {\n var hSpacing = track.sarRatio[0],\n vSpacing = track.sarRatio[1];\n avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 0xFF000000) >> 24, (hSpacing & 0xFF0000) >> 16, (hSpacing & 0xFF00) >> 8, hSpacing & 0xFF, (vSpacing & 0xFF000000) >> 24, (vSpacing & 0xFF0000) >> 16, (vSpacing & 0xFF00) >> 8, vSpacing & 0xFF])));\n }\n\n return box.apply(null, avc1Box);\n };\n\n audioSample = function audioSample(track) {\n return box(types.mp4a, new Uint8Array([// SampleEntry, ISO/IEC 14496-12\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x01, // data_reference_index\n // AudioSampleEntry, ISO/IEC 14496-12\n 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, 0x00, 0x00, // reserved\n (track.channelcount & 0xff00) >> 8, track.channelcount & 0xff, // channelcount\n (track.samplesize & 0xff00) >> 8, track.samplesize & 0xff, // samplesize\n 0x00, 0x00, // pre_defined\n 0x00, 0x00, // reserved\n (track.samplerate & 0xff00) >> 8, track.samplerate & 0xff, 0x00, 0x00 // samplerate, 16.16\n // MP4AudioSampleEntry, ISO/IEC 14496-14\n ]), esds(track));\n };\n })();\n\n tkhd = function tkhd(track) {\n var result = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x07, // flags\n 0x00, 0x00, 0x00, 0x00, // creation_time\n 0x00, 0x00, 0x00, 0x00, // modification_time\n (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x00, // reserved\n (track.duration & 0xFF000000) >> 24, (track.duration & 0xFF0000) >> 16, (track.duration & 0xFF00) >> 8, track.duration & 0xFF, // duration\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved\n 0x00, 0x00, // layer\n 0x00, 0x00, // alternate_group\n 0x01, 0x00, // non-audio track volume\n 0x00, 0x00, // reserved\n 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, // transformation: unity matrix\n (track.width & 0xFF00) >> 8, track.width & 0xFF, 0x00, 0x00, // width\n (track.height & 0xFF00) >> 8, track.height & 0xFF, 0x00, 0x00 // height\n ]);\n return box(types.tkhd, result);\n };\n /**\n * Generate a track fragment (traf) box. A traf box collects metadata\n * about tracks in a movie fragment (moof) box.\n */\n\n\n traf = function traf(track) {\n var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime;\n trackFragmentHeader = box(types.tfhd, new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x3a, // flags\n (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x01, // sample_description_index\n 0x00, 0x00, 0x00, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x00, 0x00, 0x00, 0x00 // default_sample_flags\n ]));\n upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT32);\n lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT32);\n trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([0x01, // version 1\n 0x00, 0x00, 0x00, // flags\n // baseMediaDecodeTime\n upperWordBaseMediaDecodeTime >>> 24 & 0xFF, upperWordBaseMediaDecodeTime >>> 16 & 0xFF, upperWordBaseMediaDecodeTime >>> 8 & 0xFF, upperWordBaseMediaDecodeTime & 0xFF, lowerWordBaseMediaDecodeTime >>> 24 & 0xFF, lowerWordBaseMediaDecodeTime >>> 16 & 0xFF, lowerWordBaseMediaDecodeTime >>> 8 & 0xFF, lowerWordBaseMediaDecodeTime & 0xFF])); // the data offset specifies the number of bytes from the start of\n // the containing moof to the first payload byte of the associated\n // mdat\n\n dataOffset = 32 + // tfhd\n 20 + // tfdt\n 8 + // traf header\n 16 + // mfhd\n 8 + // moof header\n 8; // mdat header\n // audio tracks require less metadata\n\n if (track.type === 'audio') {\n trackFragmentRun = trun$1(track, dataOffset);\n return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun);\n } // video tracks should contain an independent and disposable samples\n // box (sdtp)\n // generate one and adjust offsets to match\n\n\n sampleDependencyTable = sdtp(track);\n trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset);\n return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable);\n };\n /**\n * Generate a track box.\n * @param track {object} a track definition\n * @return {Uint8Array} the track box\n */\n\n\n trak = function trak(track) {\n track.duration = track.duration || 0xffffffff;\n return box(types.trak, tkhd(track), mdia(track));\n };\n\n trex = function trex(track) {\n var result = new Uint8Array([0x00, // version 0\n 0x00, 0x00, 0x00, // flags\n (track.id & 0xFF000000) >> 24, (track.id & 0xFF0000) >> 16, (track.id & 0xFF00) >> 8, track.id & 0xFF, // track_ID\n 0x00, 0x00, 0x00, 0x01, // default_sample_description_index\n 0x00, 0x00, 0x00, 0x00, // default_sample_duration\n 0x00, 0x00, 0x00, 0x00, // default_sample_size\n 0x00, 0x01, 0x00, 0x01 // default_sample_flags\n ]); // the last two bytes of default_sample_flags is the sample\n // degradation priority, a hint about the importance of this sample\n // relative to others. Lower the degradation priority for all sample\n // types other than video.\n\n if (track.type !== 'video') {\n result[result.length - 1] = 0x00;\n }\n\n return box(types.trex, result);\n };\n\n (function () {\n var audioTrun, videoTrun, trunHeader; // This method assumes all samples are uniform. That is, if a\n // duration is present for the first sample, it will be present for\n // all subsequent samples.\n // see ISO/IEC 14496-12:2012, Section 8.8.8.1\n\n trunHeader = function trunHeader(samples, offset) {\n var durationPresent = 0,\n sizePresent = 0,\n flagsPresent = 0,\n compositionTimeOffset = 0; // trun flag constants\n\n if (samples.length) {\n if (samples[0].duration !== undefined) {\n durationPresent = 0x1;\n }\n\n if (samples[0].size !== undefined) {\n sizePresent = 0x2;\n }\n\n if (samples[0].flags !== undefined) {\n flagsPresent = 0x4;\n }\n\n if (samples[0].compositionTimeOffset !== undefined) {\n compositionTimeOffset = 0x8;\n }\n }\n\n return [0x00, // version 0\n 0x00, durationPresent | sizePresent | flagsPresent | compositionTimeOffset, 0x01, // flags\n (samples.length & 0xFF000000) >>> 24, (samples.length & 0xFF0000) >>> 16, (samples.length & 0xFF00) >>> 8, samples.length & 0xFF, // sample_count\n (offset & 0xFF000000) >>> 24, (offset & 0xFF0000) >>> 16, (offset & 0xFF00) >>> 8, offset & 0xFF // data_offset\n ];\n };\n\n videoTrun = function videoTrun(track, offset) {\n var bytesOffest, bytes, header, samples, sample, i;\n samples = track.samples || [];\n offset += 8 + 12 + 16 * samples.length;\n header = trunHeader(samples, offset);\n bytes = new Uint8Array(header.length + samples.length * 16);\n bytes.set(header);\n bytesOffest = header.length;\n\n for (i = 0; i < samples.length; i++) {\n sample = samples[i];\n bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24;\n bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16;\n bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8;\n bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration\n\n bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24;\n bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16;\n bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8;\n bytes[bytesOffest++] = sample.size & 0xFF; // sample_size\n\n bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn;\n bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample;\n bytes[bytesOffest++] = sample.flags.degradationPriority & 0xF0 << 8;\n bytes[bytesOffest++] = sample.flags.degradationPriority & 0x0F; // sample_flags\n\n bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF000000) >>> 24;\n bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF0000) >>> 16;\n bytes[bytesOffest++] = (sample.compositionTimeOffset & 0xFF00) >>> 8;\n bytes[bytesOffest++] = sample.compositionTimeOffset & 0xFF; // sample_composition_time_offset\n }\n\n return box(types.trun, bytes);\n };\n\n audioTrun = function audioTrun(track, offset) {\n var bytes, bytesOffest, header, samples, sample, i;\n samples = track.samples || [];\n offset += 8 + 12 + 8 * samples.length;\n header = trunHeader(samples, offset);\n bytes = new Uint8Array(header.length + samples.length * 8);\n bytes.set(header);\n bytesOffest = header.length;\n\n for (i = 0; i < samples.length; i++) {\n sample = samples[i];\n bytes[bytesOffest++] = (sample.duration & 0xFF000000) >>> 24;\n bytes[bytesOffest++] = (sample.duration & 0xFF0000) >>> 16;\n bytes[bytesOffest++] = (sample.duration & 0xFF00) >>> 8;\n bytes[bytesOffest++] = sample.duration & 0xFF; // sample_duration\n\n bytes[bytesOffest++] = (sample.size & 0xFF000000) >>> 24;\n bytes[bytesOffest++] = (sample.size & 0xFF0000) >>> 16;\n bytes[bytesOffest++] = (sample.size & 0xFF00) >>> 8;\n bytes[bytesOffest++] = sample.size & 0xFF; // sample_size\n }\n\n return box(types.trun, bytes);\n };\n\n trun$1 = function trun(track, offset) {\n if (track.type === 'audio') {\n return audioTrun(track, offset);\n }\n\n return videoTrun(track, offset);\n };\n })();\n\n var mp4Generator = {\n ftyp: ftyp,\n mdat: mdat,\n moof: moof,\n moov: moov,\n initSegment: function initSegment(tracks) {\n var fileType = ftyp(),\n movie = moov(tracks),\n result;\n result = new Uint8Array(fileType.byteLength + movie.byteLength);\n result.set(fileType);\n result.set(movie, fileType.byteLength);\n return result;\n }\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n // Convert an array of nal units into an array of frames with each frame being\n // composed of the nal units that make up that frame\n // Also keep track of cummulative data about the frame from the nal units such\n // as the frame duration, starting pts, etc.\n\n var groupNalsIntoFrames = function groupNalsIntoFrames(nalUnits) {\n var i,\n currentNal,\n currentFrame = [],\n frames = []; // TODO added for LHLS, make sure this is OK\n\n frames.byteLength = 0;\n frames.nalCount = 0;\n frames.duration = 0;\n currentFrame.byteLength = 0;\n\n for (i = 0; i < nalUnits.length; i++) {\n currentNal = nalUnits[i]; // Split on 'aud'-type nal units\n\n if (currentNal.nalUnitType === 'access_unit_delimiter_rbsp') {\n // Since the very first nal unit is expected to be an AUD\n // only push to the frames array when currentFrame is not empty\n if (currentFrame.length) {\n currentFrame.duration = currentNal.dts - currentFrame.dts; // TODO added for LHLS, make sure this is OK\n\n frames.byteLength += currentFrame.byteLength;\n frames.nalCount += currentFrame.length;\n frames.duration += currentFrame.duration;\n frames.push(currentFrame);\n }\n\n currentFrame = [currentNal];\n currentFrame.byteLength = currentNal.data.byteLength;\n currentFrame.pts = currentNal.pts;\n currentFrame.dts = currentNal.dts;\n } else {\n // Specifically flag key frames for ease of use later\n if (currentNal.nalUnitType === 'slice_layer_without_partitioning_rbsp_idr') {\n currentFrame.keyFrame = true;\n }\n\n currentFrame.duration = currentNal.dts - currentFrame.dts;\n currentFrame.byteLength += currentNal.data.byteLength;\n currentFrame.push(currentNal);\n }\n } // For the last frame, use the duration of the previous frame if we\n // have nothing better to go on\n\n\n if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) {\n currentFrame.duration = frames[frames.length - 1].duration;\n } // Push the final frame\n // TODO added for LHLS, make sure this is OK\n\n\n frames.byteLength += currentFrame.byteLength;\n frames.nalCount += currentFrame.length;\n frames.duration += currentFrame.duration;\n frames.push(currentFrame);\n return frames;\n }; // Convert an array of frames into an array of Gop with each Gop being composed\n // of the frames that make up that Gop\n // Also keep track of cummulative data about the Gop from the frames such as the\n // Gop duration, starting pts, etc.\n\n\n var groupFramesIntoGops = function groupFramesIntoGops(frames) {\n var i,\n currentFrame,\n currentGop = [],\n gops = []; // We must pre-set some of the values on the Gop since we\n // keep running totals of these values\n\n currentGop.byteLength = 0;\n currentGop.nalCount = 0;\n currentGop.duration = 0;\n currentGop.pts = frames[0].pts;\n currentGop.dts = frames[0].dts; // store some metadata about all the Gops\n\n gops.byteLength = 0;\n gops.nalCount = 0;\n gops.duration = 0;\n gops.pts = frames[0].pts;\n gops.dts = frames[0].dts;\n\n for (i = 0; i < frames.length; i++) {\n currentFrame = frames[i];\n\n if (currentFrame.keyFrame) {\n // Since the very first frame is expected to be an keyframe\n // only push to the gops array when currentGop is not empty\n if (currentGop.length) {\n gops.push(currentGop);\n gops.byteLength += currentGop.byteLength;\n gops.nalCount += currentGop.nalCount;\n gops.duration += currentGop.duration;\n }\n\n currentGop = [currentFrame];\n currentGop.nalCount = currentFrame.length;\n currentGop.byteLength = currentFrame.byteLength;\n currentGop.pts = currentFrame.pts;\n currentGop.dts = currentFrame.dts;\n currentGop.duration = currentFrame.duration;\n } else {\n currentGop.duration += currentFrame.duration;\n currentGop.nalCount += currentFrame.length;\n currentGop.byteLength += currentFrame.byteLength;\n currentGop.push(currentFrame);\n }\n }\n\n if (gops.length && currentGop.duration <= 0) {\n currentGop.duration = gops[gops.length - 1].duration;\n }\n\n gops.byteLength += currentGop.byteLength;\n gops.nalCount += currentGop.nalCount;\n gops.duration += currentGop.duration; // push the final Gop\n\n gops.push(currentGop);\n return gops;\n };\n /*\n * Search for the first keyframe in the GOPs and throw away all frames\n * until that keyframe. Then extend the duration of the pulled keyframe\n * and pull the PTS and DTS of the keyframe so that it covers the time\n * range of the frames that were disposed.\n *\n * @param {Array} gops video GOPs\n * @returns {Array} modified video GOPs\n */\n\n\n var extendFirstKeyFrame = function extendFirstKeyFrame(gops) {\n var currentGop;\n\n if (!gops[0][0].keyFrame && gops.length > 1) {\n // Remove the first GOP\n currentGop = gops.shift();\n gops.byteLength -= currentGop.byteLength;\n gops.nalCount -= currentGop.nalCount; // Extend the first frame of what is now the\n // first gop to cover the time period of the\n // frames we just removed\n\n gops[0][0].dts = currentGop.dts;\n gops[0][0].pts = currentGop.pts;\n gops[0][0].duration += currentGop.duration;\n }\n\n return gops;\n };\n /**\n * Default sample object\n * see ISO/IEC 14496-12:2012, section 8.6.4.3\n */\n\n\n var createDefaultSample = function createDefaultSample() {\n return {\n size: 0,\n flags: {\n isLeading: 0,\n dependsOn: 1,\n isDependedOn: 0,\n hasRedundancy: 0,\n degradationPriority: 0,\n isNonSyncSample: 1\n }\n };\n };\n /*\n * Collates information from a video frame into an object for eventual\n * entry into an MP4 sample table.\n *\n * @param {Object} frame the video frame\n * @param {Number} dataOffset the byte offset to position the sample\n * @return {Object} object containing sample table info for a frame\n */\n\n\n var sampleForFrame = function sampleForFrame(frame, dataOffset) {\n var sample = createDefaultSample();\n sample.dataOffset = dataOffset;\n sample.compositionTimeOffset = frame.pts - frame.dts;\n sample.duration = frame.duration;\n sample.size = 4 * frame.length; // Space for nal unit size\n\n sample.size += frame.byteLength;\n\n if (frame.keyFrame) {\n sample.flags.dependsOn = 2;\n sample.flags.isNonSyncSample = 0;\n }\n\n return sample;\n }; // generate the track's sample table from an array of gops\n\n\n var generateSampleTable$1 = function generateSampleTable(gops, baseDataOffset) {\n var h,\n i,\n sample,\n currentGop,\n currentFrame,\n dataOffset = baseDataOffset || 0,\n samples = [];\n\n for (h = 0; h < gops.length; h++) {\n currentGop = gops[h];\n\n for (i = 0; i < currentGop.length; i++) {\n currentFrame = currentGop[i];\n sample = sampleForFrame(currentFrame, dataOffset);\n dataOffset += sample.size;\n samples.push(sample);\n }\n }\n\n return samples;\n }; // generate the track's raw mdat data from an array of gops\n\n\n var concatenateNalData = function concatenateNalData(gops) {\n var h,\n i,\n j,\n currentGop,\n currentFrame,\n currentNal,\n dataOffset = 0,\n nalsByteLength = gops.byteLength,\n numberOfNals = gops.nalCount,\n totalByteLength = nalsByteLength + 4 * numberOfNals,\n data = new Uint8Array(totalByteLength),\n view = new DataView(data.buffer); // For each Gop..\n\n for (h = 0; h < gops.length; h++) {\n currentGop = gops[h]; // For each Frame..\n\n for (i = 0; i < currentGop.length; i++) {\n currentFrame = currentGop[i]; // For each NAL..\n\n for (j = 0; j < currentFrame.length; j++) {\n currentNal = currentFrame[j];\n view.setUint32(dataOffset, currentNal.data.byteLength);\n dataOffset += 4;\n data.set(currentNal.data, dataOffset);\n dataOffset += currentNal.data.byteLength;\n }\n }\n }\n\n return data;\n }; // generate the track's sample table from a frame\n\n\n var generateSampleTableForFrame = function generateSampleTableForFrame(frame, baseDataOffset) {\n var sample,\n dataOffset = baseDataOffset || 0,\n samples = [];\n sample = sampleForFrame(frame, dataOffset);\n samples.push(sample);\n return samples;\n }; // generate the track's raw mdat data from a frame\n\n\n var concatenateNalDataForFrame = function concatenateNalDataForFrame(frame) {\n var i,\n currentNal,\n dataOffset = 0,\n nalsByteLength = frame.byteLength,\n numberOfNals = frame.length,\n totalByteLength = nalsByteLength + 4 * numberOfNals,\n data = new Uint8Array(totalByteLength),\n view = new DataView(data.buffer); // For each NAL..\n\n for (i = 0; i < frame.length; i++) {\n currentNal = frame[i];\n view.setUint32(dataOffset, currentNal.data.byteLength);\n dataOffset += 4;\n data.set(currentNal.data, dataOffset);\n dataOffset += currentNal.data.byteLength;\n }\n\n return data;\n };\n\n var frameUtils = {\n groupNalsIntoFrames: groupNalsIntoFrames,\n groupFramesIntoGops: groupFramesIntoGops,\n extendFirstKeyFrame: extendFirstKeyFrame,\n generateSampleTable: generateSampleTable$1,\n concatenateNalData: concatenateNalData,\n generateSampleTableForFrame: generateSampleTableForFrame,\n concatenateNalDataForFrame: concatenateNalDataForFrame\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var highPrefix = [33, 16, 5, 32, 164, 27];\n var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252];\n\n var zeroFill = function zeroFill(count) {\n var a = [];\n\n while (count--) {\n a.push(0);\n }\n\n return a;\n };\n\n var makeTable = function makeTable(metaTable) {\n return Object.keys(metaTable).reduce(function (obj, key) {\n obj[key] = new Uint8Array(metaTable[key].reduce(function (arr, part) {\n return arr.concat(part);\n }, []));\n return obj;\n }, {});\n };\n\n var silence;\n\n var silence_1 = function silence_1() {\n if (!silence) {\n // Frames-of-silence to use for filling in missing AAC frames\n var coneOfSilence = {\n 96000: [highPrefix, [227, 64], zeroFill(154), [56]],\n 88200: [highPrefix, [231], zeroFill(170), [56]],\n 64000: [highPrefix, [248, 192], zeroFill(240), [56]],\n 48000: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]],\n 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]],\n 32000: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]],\n 24000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]],\n 16000: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]],\n 12000: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]],\n 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]],\n 8000: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]]\n };\n silence = makeTable(coneOfSilence);\n }\n\n return silence;\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n\n var ONE_SECOND_IN_TS$4 = 90000,\n // 90kHz clock\n secondsToVideoTs,\n secondsToAudioTs,\n videoTsToSeconds,\n audioTsToSeconds,\n audioTsToVideoTs,\n videoTsToAudioTs,\n metadataTsToSeconds;\n\n secondsToVideoTs = function secondsToVideoTs(seconds) {\n return seconds * ONE_SECOND_IN_TS$4;\n };\n\n secondsToAudioTs = function secondsToAudioTs(seconds, sampleRate) {\n return seconds * sampleRate;\n };\n\n videoTsToSeconds = function videoTsToSeconds(timestamp) {\n return timestamp / ONE_SECOND_IN_TS$4;\n };\n\n audioTsToSeconds = function audioTsToSeconds(timestamp, sampleRate) {\n return timestamp / sampleRate;\n };\n\n audioTsToVideoTs = function audioTsToVideoTs(timestamp, sampleRate) {\n return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate));\n };\n\n videoTsToAudioTs = function videoTsToAudioTs(timestamp, sampleRate) {\n return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate);\n };\n /**\n * Adjust ID3 tag or caption timing information by the timeline pts values\n * (if keepOriginalTimestamps is false) and convert to seconds\n */\n\n\n metadataTsToSeconds = function metadataTsToSeconds(timestamp, timelineStartPts, keepOriginalTimestamps) {\n return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);\n };\n\n var clock = {\n ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4,\n secondsToVideoTs: secondsToVideoTs,\n secondsToAudioTs: secondsToAudioTs,\n videoTsToSeconds: videoTsToSeconds,\n audioTsToSeconds: audioTsToSeconds,\n audioTsToVideoTs: audioTsToVideoTs,\n videoTsToAudioTs: videoTsToAudioTs,\n metadataTsToSeconds: metadataTsToSeconds\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n /**\n * Sum the `byteLength` properties of the data in each AAC frame\n */\n\n var sumFrameByteLengths = function sumFrameByteLengths(array) {\n var i,\n currentObj,\n sum = 0; // sum the byteLength's all each nal unit in the frame\n\n for (i = 0; i < array.length; i++) {\n currentObj = array[i];\n sum += currentObj.data.byteLength;\n }\n\n return sum;\n }; // Possibly pad (prefix) the audio track with silence if appending this track\n // would lead to the introduction of a gap in the audio buffer\n\n\n var prefixWithSilence = function prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) {\n var baseMediaDecodeTimeTs,\n frameDuration = 0,\n audioGapDuration = 0,\n audioFillFrameCount = 0,\n audioFillDuration = 0,\n silentFrame,\n i,\n firstFrame;\n\n if (!frames.length) {\n return;\n }\n\n baseMediaDecodeTimeTs = clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate); // determine frame clock duration based on sample rate, round up to avoid overfills\n\n frameDuration = Math.ceil(clock.ONE_SECOND_IN_TS / (track.samplerate / 1024));\n\n if (audioAppendStartTs && videoBaseMediaDecodeTime) {\n // insert the shortest possible amount (audio gap or audio to video gap)\n audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime); // number of full frames in the audio gap\n\n audioFillFrameCount = Math.floor(audioGapDuration / frameDuration);\n audioFillDuration = audioFillFrameCount * frameDuration;\n } // don't attempt to fill gaps smaller than a single frame or larger\n // than a half second\n\n\n if (audioFillFrameCount < 1 || audioFillDuration > clock.ONE_SECOND_IN_TS / 2) {\n return;\n }\n\n silentFrame = silence_1()[track.samplerate];\n\n if (!silentFrame) {\n // we don't have a silent frame pregenerated for the sample rate, so use a frame\n // from the content instead\n silentFrame = frames[0].data;\n }\n\n for (i = 0; i < audioFillFrameCount; i++) {\n firstFrame = frames[0];\n frames.splice(0, 0, {\n data: silentFrame,\n dts: firstFrame.dts - frameDuration,\n pts: firstFrame.pts - frameDuration\n });\n }\n\n track.baseMediaDecodeTime -= Math.floor(clock.videoTsToAudioTs(audioFillDuration, track.samplerate));\n return audioFillDuration;\n }; // If the audio segment extends before the earliest allowed dts\n // value, remove AAC frames until starts at or after the earliest\n // allowed DTS so that we don't end up with a negative baseMedia-\n // DecodeTime for the audio track\n\n\n var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts) {\n if (track.minSegmentDts >= earliestAllowedDts) {\n return adtsFrames;\n } // We will need to recalculate the earliest segment Dts\n\n\n track.minSegmentDts = Infinity;\n return adtsFrames.filter(function (currentFrame) {\n // If this is an allowed frame, keep it and record it's Dts\n if (currentFrame.dts >= earliestAllowedDts) {\n track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts);\n track.minSegmentPts = track.minSegmentDts;\n return true;\n } // Otherwise, discard it\n\n\n return false;\n });\n }; // generate the track's raw mdat data from an array of frames\n\n\n var generateSampleTable = function generateSampleTable(frames) {\n var i,\n currentFrame,\n samples = [];\n\n for (i = 0; i < frames.length; i++) {\n currentFrame = frames[i];\n samples.push({\n size: currentFrame.data.byteLength,\n duration: 1024 // For AAC audio, all samples contain 1024 samples\n\n });\n }\n\n return samples;\n }; // generate the track's sample table from an array of frames\n\n\n var concatenateFrameData = function concatenateFrameData(frames) {\n var i,\n currentFrame,\n dataOffset = 0,\n data = new Uint8Array(sumFrameByteLengths(frames));\n\n for (i = 0; i < frames.length; i++) {\n currentFrame = frames[i];\n data.set(currentFrame.data, dataOffset);\n dataOffset += currentFrame.data.byteLength;\n }\n\n return data;\n };\n\n var audioFrameUtils = {\n prefixWithSilence: prefixWithSilence,\n trimAdtsFramesByEarliestDts: trimAdtsFramesByEarliestDts,\n generateSampleTable: generateSampleTable,\n concatenateFrameData: concatenateFrameData\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var ONE_SECOND_IN_TS$3 = clock.ONE_SECOND_IN_TS;\n /**\n * Store information about the start and end of the track and the\n * duration for each frame/sample we process in order to calculate\n * the baseMediaDecodeTime\n */\n\n var collectDtsInfo = function collectDtsInfo(track, data) {\n if (typeof data.pts === 'number') {\n if (track.timelineStartInfo.pts === undefined) {\n track.timelineStartInfo.pts = data.pts;\n }\n\n if (track.minSegmentPts === undefined) {\n track.minSegmentPts = data.pts;\n } else {\n track.minSegmentPts = Math.min(track.minSegmentPts, data.pts);\n }\n\n if (track.maxSegmentPts === undefined) {\n track.maxSegmentPts = data.pts;\n } else {\n track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts);\n }\n }\n\n if (typeof data.dts === 'number') {\n if (track.timelineStartInfo.dts === undefined) {\n track.timelineStartInfo.dts = data.dts;\n }\n\n if (track.minSegmentDts === undefined) {\n track.minSegmentDts = data.dts;\n } else {\n track.minSegmentDts = Math.min(track.minSegmentDts, data.dts);\n }\n\n if (track.maxSegmentDts === undefined) {\n track.maxSegmentDts = data.dts;\n } else {\n track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts);\n }\n }\n };\n /**\n * Clear values used to calculate the baseMediaDecodeTime between\n * tracks\n */\n\n\n var clearDtsInfo = function clearDtsInfo(track) {\n delete track.minSegmentDts;\n delete track.maxSegmentDts;\n delete track.minSegmentPts;\n delete track.maxSegmentPts;\n };\n /**\n * Calculate the track's baseMediaDecodeTime based on the earliest\n * DTS the transmuxer has ever seen and the minimum DTS for the\n * current track\n * @param track {object} track metadata configuration\n * @param keepOriginalTimestamps {boolean} If true, keep the timestamps\n * in the source; false to adjust the first segment to start at 0.\n */\n\n\n var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime(track, keepOriginalTimestamps) {\n var baseMediaDecodeTime,\n scale,\n minSegmentDts = track.minSegmentDts; // Optionally adjust the time so the first segment starts at zero.\n\n if (!keepOriginalTimestamps) {\n minSegmentDts -= track.timelineStartInfo.dts;\n } // track.timelineStartInfo.baseMediaDecodeTime is the location, in time, where\n // we want the start of the first segment to be placed\n\n\n baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime; // Add to that the distance this segment is from the very first\n\n baseMediaDecodeTime += minSegmentDts; // baseMediaDecodeTime must not become negative\n\n baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime);\n\n if (track.type === 'audio') {\n // Audio has a different clock equal to the sampling_rate so we need to\n // scale the PTS values into the clock rate of the track\n scale = track.samplerate / ONE_SECOND_IN_TS$3;\n baseMediaDecodeTime *= scale;\n baseMediaDecodeTime = Math.floor(baseMediaDecodeTime);\n }\n\n return baseMediaDecodeTime;\n };\n\n var trackDecodeInfo = {\n clearDtsInfo: clearDtsInfo,\n calculateTrackBaseMediaDecodeTime: calculateTrackBaseMediaDecodeTime,\n collectDtsInfo: collectDtsInfo\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Reads in-band caption information from a video elementary\n * stream. Captions must follow the CEA-708 standard for injection\n * into an MPEG-2 transport streams.\n * @see https://en.wikipedia.org/wiki/CEA-708\n * @see https://www.gpo.gov/fdsys/pkg/CFR-2007-title47-vol1/pdf/CFR-2007-title47-vol1-sec15-119.pdf\n */\n // payload type field to indicate how they are to be\n // interpreted. CEAS-708 caption content is always transmitted with\n // payload type 0x04.\n\n var USER_DATA_REGISTERED_ITU_T_T35 = 4,\n RBSP_TRAILING_BITS = 128;\n /**\n * Parse a supplemental enhancement information (SEI) NAL unit.\n * Stops parsing once a message of type ITU T T35 has been found.\n *\n * @param bytes {Uint8Array} the bytes of a SEI NAL unit\n * @return {object} the parsed SEI payload\n * @see Rec. ITU-T H.264, 7.3.2.3.1\n */\n\n var parseSei = function parseSei(bytes) {\n var i = 0,\n result = {\n payloadType: -1,\n payloadSize: 0\n },\n payloadType = 0,\n payloadSize = 0; // go through the sei_rbsp parsing each each individual sei_message\n\n while (i < bytes.byteLength) {\n // stop once we have hit the end of the sei_rbsp\n if (bytes[i] === RBSP_TRAILING_BITS) {\n break;\n } // Parse payload type\n\n\n while (bytes[i] === 0xFF) {\n payloadType += 255;\n i++;\n }\n\n payloadType += bytes[i++]; // Parse payload size\n\n while (bytes[i] === 0xFF) {\n payloadSize += 255;\n i++;\n }\n\n payloadSize += bytes[i++]; // this sei_message is a 608/708 caption so save it and break\n // there can only ever be one caption message in a frame's sei\n\n if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) {\n var userIdentifier = String.fromCharCode(bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6]);\n\n if (userIdentifier === 'GA94') {\n result.payloadType = payloadType;\n result.payloadSize = payloadSize;\n result.payload = bytes.subarray(i, i + payloadSize);\n break;\n } else {\n result.payload = void 0;\n }\n } // skip the payload and parse the next message\n\n\n i += payloadSize;\n payloadType = 0;\n payloadSize = 0;\n }\n\n return result;\n }; // see ANSI/SCTE 128-1 (2013), section 8.1\n\n\n var parseUserData = function parseUserData(sei) {\n // itu_t_t35_contry_code must be 181 (United States) for\n // captions\n if (sei.payload[0] !== 181) {\n return null;\n } // itu_t_t35_provider_code should be 49 (ATSC) for captions\n\n\n if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) {\n return null;\n } // the user_identifier should be \"GA94\" to indicate ATSC1 data\n\n\n if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== 'GA94') {\n return null;\n } // finally, user_data_type_code should be 0x03 for caption data\n\n\n if (sei.payload[7] !== 0x03) {\n return null;\n } // return the user_data_type_structure and strip the trailing\n // marker bits\n\n\n return sei.payload.subarray(8, sei.payload.length - 1);\n }; // see CEA-708-D, section 4.4\n\n\n var parseCaptionPackets = function parseCaptionPackets(pts, userData) {\n var results = [],\n i,\n count,\n offset,\n data; // if this is just filler, return immediately\n\n if (!(userData[0] & 0x40)) {\n return results;\n } // parse out the cc_data_1 and cc_data_2 fields\n\n\n count = userData[0] & 0x1f;\n\n for (i = 0; i < count; i++) {\n offset = i * 3;\n data = {\n type: userData[offset + 2] & 0x03,\n pts: pts\n }; // capture cc data when cc_valid is 1\n\n if (userData[offset + 2] & 0x04) {\n data.ccData = userData[offset + 3] << 8 | userData[offset + 4];\n results.push(data);\n }\n }\n\n return results;\n };\n\n var discardEmulationPreventionBytes$1 = function discardEmulationPreventionBytes(data) {\n var length = data.byteLength,\n emulationPreventionBytesPositions = [],\n i = 1,\n newLength,\n newData; // Find all `Emulation Prevention Bytes`\n\n while (i < length - 2) {\n if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) {\n emulationPreventionBytesPositions.push(i + 2);\n i += 2;\n } else {\n i++;\n }\n } // If no Emulation Prevention Bytes were found just return the original\n // array\n\n\n if (emulationPreventionBytesPositions.length === 0) {\n return data;\n } // Create a new array to hold the NAL unit data\n\n\n newLength = length - emulationPreventionBytesPositions.length;\n newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === emulationPreventionBytesPositions[0]) {\n // Skip this byte\n sourceIndex++; // Remove this position index\n\n emulationPreventionBytesPositions.shift();\n }\n\n newData[i] = data[sourceIndex];\n }\n\n return newData;\n }; // exports\n\n\n var captionPacketParser = {\n parseSei: parseSei,\n parseUserData: parseUserData,\n parseCaptionPackets: parseCaptionPackets,\n discardEmulationPreventionBytes: discardEmulationPreventionBytes$1,\n USER_DATA_REGISTERED_ITU_T_T35: USER_DATA_REGISTERED_ITU_T_T35\n }; // Link To Transport\n // -----------------\n\n var CaptionStream$1 = function CaptionStream(options) {\n options = options || {};\n CaptionStream.prototype.init.call(this); // parse708captions flag, default to true\n\n this.parse708captions_ = typeof options.parse708captions === 'boolean' ? options.parse708captions : true;\n this.captionPackets_ = [];\n this.ccStreams_ = [new Cea608Stream(0, 0), // eslint-disable-line no-use-before-define\n new Cea608Stream(0, 1), // eslint-disable-line no-use-before-define\n new Cea608Stream(1, 0), // eslint-disable-line no-use-before-define\n new Cea608Stream(1, 1) // eslint-disable-line no-use-before-define\n ];\n\n if (this.parse708captions_) {\n this.cc708Stream_ = new Cea708Stream({\n captionServices: options.captionServices\n }); // eslint-disable-line no-use-before-define\n }\n\n this.reset(); // forward data and done events from CCs to this CaptionStream\n\n this.ccStreams_.forEach(function (cc) {\n cc.on('data', this.trigger.bind(this, 'data'));\n cc.on('partialdone', this.trigger.bind(this, 'partialdone'));\n cc.on('done', this.trigger.bind(this, 'done'));\n }, this);\n\n if (this.parse708captions_) {\n this.cc708Stream_.on('data', this.trigger.bind(this, 'data'));\n this.cc708Stream_.on('partialdone', this.trigger.bind(this, 'partialdone'));\n this.cc708Stream_.on('done', this.trigger.bind(this, 'done'));\n }\n };\n\n CaptionStream$1.prototype = new stream();\n\n CaptionStream$1.prototype.push = function (event) {\n var sei, userData, newCaptionPackets; // only examine SEI NALs\n\n if (event.nalUnitType !== 'sei_rbsp') {\n return;\n } // parse the sei\n\n\n sei = captionPacketParser.parseSei(event.escapedRBSP); // no payload data, skip\n\n if (!sei.payload) {\n return;\n } // ignore everything but user_data_registered_itu_t_t35\n\n\n if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) {\n return;\n } // parse out the user data payload\n\n\n userData = captionPacketParser.parseUserData(sei); // ignore unrecognized userData\n\n if (!userData) {\n return;\n } // Sometimes, the same segment # will be downloaded twice. To stop the\n // caption data from being processed twice, we track the latest dts we've\n // received and ignore everything with a dts before that. However, since\n // data for a specific dts can be split across packets on either side of\n // a segment boundary, we need to make sure we *don't* ignore the packets\n // from the *next* segment that have dts === this.latestDts_. By constantly\n // tracking the number of packets received with dts === this.latestDts_, we\n // know how many should be ignored once we start receiving duplicates.\n\n\n if (event.dts < this.latestDts_) {\n // We've started getting older data, so set the flag.\n this.ignoreNextEqualDts_ = true;\n return;\n } else if (event.dts === this.latestDts_ && this.ignoreNextEqualDts_) {\n this.numSameDts_--;\n\n if (!this.numSameDts_) {\n // We've received the last duplicate packet, time to start processing again\n this.ignoreNextEqualDts_ = false;\n }\n\n return;\n } // parse out CC data packets and save them for later\n\n\n newCaptionPackets = captionPacketParser.parseCaptionPackets(event.pts, userData);\n this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets);\n\n if (this.latestDts_ !== event.dts) {\n this.numSameDts_ = 0;\n }\n\n this.numSameDts_++;\n this.latestDts_ = event.dts;\n };\n\n CaptionStream$1.prototype.flushCCStreams = function (flushType) {\n this.ccStreams_.forEach(function (cc) {\n return flushType === 'flush' ? cc.flush() : cc.partialFlush();\n }, this);\n };\n\n CaptionStream$1.prototype.flushStream = function (flushType) {\n // make sure we actually parsed captions before proceeding\n if (!this.captionPackets_.length) {\n this.flushCCStreams(flushType);\n return;\n } // In Chrome, the Array#sort function is not stable so add a\n // presortIndex that we can use to ensure we get a stable-sort\n\n\n this.captionPackets_.forEach(function (elem, idx) {\n elem.presortIndex = idx;\n }); // sort caption byte-pairs based on their PTS values\n\n this.captionPackets_.sort(function (a, b) {\n if (a.pts === b.pts) {\n return a.presortIndex - b.presortIndex;\n }\n\n return a.pts - b.pts;\n });\n this.captionPackets_.forEach(function (packet) {\n if (packet.type < 2) {\n // Dispatch packet to the right Cea608Stream\n this.dispatchCea608Packet(packet);\n } else {\n // Dispatch packet to the Cea708Stream\n this.dispatchCea708Packet(packet);\n }\n }, this);\n this.captionPackets_.length = 0;\n this.flushCCStreams(flushType);\n };\n\n CaptionStream$1.prototype.flush = function () {\n return this.flushStream('flush');\n }; // Only called if handling partial data\n\n\n CaptionStream$1.prototype.partialFlush = function () {\n return this.flushStream('partialFlush');\n };\n\n CaptionStream$1.prototype.reset = function () {\n this.latestDts_ = null;\n this.ignoreNextEqualDts_ = false;\n this.numSameDts_ = 0;\n this.activeCea608Channel_ = [null, null];\n this.ccStreams_.forEach(function (ccStream) {\n ccStream.reset();\n });\n }; // From the CEA-608 spec:\n\n /*\n * When XDS sub-packets are interleaved with other services, the end of each sub-packet shall be followed\n * by a control pair to change to a different service. When any of the control codes from 0x10 to 0x1F is\n * used to begin a control code pair, it indicates the return to captioning or Text data. The control code pair\n * and subsequent data should then be processed according to the FCC rules. It may be necessary for the\n * line 21 data encoder to automatically insert a control code pair (i.e. RCL, RU2, RU3, RU4, RDC, or RTD)\n * to switch to captioning or Text.\n */\n // With that in mind, we ignore any data between an XDS control code and a\n // subsequent closed-captioning control code.\n\n\n CaptionStream$1.prototype.dispatchCea608Packet = function (packet) {\n // NOTE: packet.type is the CEA608 field\n if (this.setsTextOrXDSActive(packet)) {\n this.activeCea608Channel_[packet.type] = null;\n } else if (this.setsChannel1Active(packet)) {\n this.activeCea608Channel_[packet.type] = 0;\n } else if (this.setsChannel2Active(packet)) {\n this.activeCea608Channel_[packet.type] = 1;\n }\n\n if (this.activeCea608Channel_[packet.type] === null) {\n // If we haven't received anything to set the active channel, or the\n // packets are Text/XDS data, discard the data; we don't want jumbled\n // captions\n return;\n }\n\n this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet);\n };\n\n CaptionStream$1.prototype.setsChannel1Active = function (packet) {\n return (packet.ccData & 0x7800) === 0x1000;\n };\n\n CaptionStream$1.prototype.setsChannel2Active = function (packet) {\n return (packet.ccData & 0x7800) === 0x1800;\n };\n\n CaptionStream$1.prototype.setsTextOrXDSActive = function (packet) {\n return (packet.ccData & 0x7100) === 0x0100 || (packet.ccData & 0x78fe) === 0x102a || (packet.ccData & 0x78fe) === 0x182a;\n };\n\n CaptionStream$1.prototype.dispatchCea708Packet = function (packet) {\n if (this.parse708captions_) {\n this.cc708Stream_.push(packet);\n }\n }; // ----------------------\n // Session to Application\n // ----------------------\n // This hash maps special and extended character codes to their\n // proper Unicode equivalent. The first one-byte key is just a\n // non-standard character code. The two-byte keys that follow are\n // the extended CEA708 character codes, along with the preceding\n // 0x10 extended character byte to distinguish these codes from\n // non-extended character codes. Every CEA708 character code that\n // is not in this object maps directly to a standard unicode\n // character code.\n // The transparent space and non-breaking transparent space are\n // technically not fully supported since there is no code to\n // make them transparent, so they have normal non-transparent\n // stand-ins.\n // The special closed caption (CC) character isn't a standard\n // unicode character, so a fairly similar unicode character was\n // chosen in it's place.\n\n\n var CHARACTER_TRANSLATION_708 = {\n 0x7f: 0x266a,\n // ♪\n 0x1020: 0x20,\n // Transparent Space\n 0x1021: 0xa0,\n // Nob-breaking Transparent Space\n 0x1025: 0x2026,\n // …\n 0x102a: 0x0160,\n // Š\n 0x102c: 0x0152,\n // Œ\n 0x1030: 0x2588,\n // █\n 0x1031: 0x2018,\n // ‘\n 0x1032: 0x2019,\n // ’\n 0x1033: 0x201c,\n // “\n 0x1034: 0x201d,\n // ”\n 0x1035: 0x2022,\n // •\n 0x1039: 0x2122,\n // ™\n 0x103a: 0x0161,\n // š\n 0x103c: 0x0153,\n // œ\n 0x103d: 0x2120,\n // ℠\n 0x103f: 0x0178,\n // Ÿ\n 0x1076: 0x215b,\n // ⅛\n 0x1077: 0x215c,\n // ⅜\n 0x1078: 0x215d,\n // ⅝\n 0x1079: 0x215e,\n // ⅞\n 0x107a: 0x23d0,\n // ⏐\n 0x107b: 0x23a4,\n // ⎤\n 0x107c: 0x23a3,\n // ⎣\n 0x107d: 0x23af,\n // ⎯\n 0x107e: 0x23a6,\n // ⎦\n 0x107f: 0x23a1,\n // ⎡\n 0x10a0: 0x3138 // ㄸ (CC char)\n\n };\n\n var get708CharFromCode = function get708CharFromCode(code) {\n var newCode = CHARACTER_TRANSLATION_708[code] || code;\n\n if (code & 0x1000 && code === newCode) {\n // Invalid extended code\n return '';\n }\n\n return String.fromCharCode(newCode);\n };\n\n var within708TextBlock = function within708TextBlock(b) {\n return 0x20 <= b && b <= 0x7f || 0xa0 <= b && b <= 0xff;\n };\n\n var Cea708Window = function Cea708Window(windowNum) {\n this.windowNum = windowNum;\n this.reset();\n };\n\n Cea708Window.prototype.reset = function () {\n this.clearText();\n this.pendingNewLine = false;\n this.winAttr = {};\n this.penAttr = {};\n this.penLoc = {};\n this.penColor = {}; // These default values are arbitrary,\n // defineWindow will usually override them\n\n this.visible = 0;\n this.rowLock = 0;\n this.columnLock = 0;\n this.priority = 0;\n this.relativePositioning = 0;\n this.anchorVertical = 0;\n this.anchorHorizontal = 0;\n this.anchorPoint = 0;\n this.rowCount = 1;\n this.virtualRowCount = this.rowCount + 1;\n this.columnCount = 41;\n this.windowStyle = 0;\n this.penStyle = 0;\n };\n\n Cea708Window.prototype.getText = function () {\n return this.rows.join('\\n');\n };\n\n Cea708Window.prototype.clearText = function () {\n this.rows = [''];\n this.rowIdx = 0;\n };\n\n Cea708Window.prototype.newLine = function (pts) {\n if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === 'function') {\n this.beforeRowOverflow(pts);\n }\n\n if (this.rows.length > 0) {\n this.rows.push('');\n this.rowIdx++;\n } // Show all virtual rows since there's no visible scrolling\n\n\n while (this.rows.length > this.virtualRowCount) {\n this.rows.shift();\n this.rowIdx--;\n }\n };\n\n Cea708Window.prototype.isEmpty = function () {\n if (this.rows.length === 0) {\n return true;\n } else if (this.rows.length === 1) {\n return this.rows[0] === '';\n }\n\n return false;\n };\n\n Cea708Window.prototype.addText = function (text) {\n this.rows[this.rowIdx] += text;\n };\n\n Cea708Window.prototype.backspace = function () {\n if (!this.isEmpty()) {\n var row = this.rows[this.rowIdx];\n this.rows[this.rowIdx] = row.substr(0, row.length - 1);\n }\n };\n\n var Cea708Service = function Cea708Service(serviceNum, encoding, stream) {\n this.serviceNum = serviceNum;\n this.text = '';\n this.currentWindow = new Cea708Window(-1);\n this.windows = [];\n this.stream = stream; // Try to setup a TextDecoder if an `encoding` value was provided\n\n if (typeof encoding === 'string') {\n this.createTextDecoder(encoding);\n }\n };\n /**\n * Initialize service windows\n * Must be run before service use\n *\n * @param {Integer} pts PTS value\n * @param {Function} beforeRowOverflow Function to execute before row overflow of a window\n */\n\n\n Cea708Service.prototype.init = function (pts, beforeRowOverflow) {\n this.startPts = pts;\n\n for (var win = 0; win < 8; win++) {\n this.windows[win] = new Cea708Window(win);\n\n if (typeof beforeRowOverflow === 'function') {\n this.windows[win].beforeRowOverflow = beforeRowOverflow;\n }\n }\n };\n /**\n * Set current window of service to be affected by commands\n *\n * @param {Integer} windowNum Window number\n */\n\n\n Cea708Service.prototype.setCurrentWindow = function (windowNum) {\n this.currentWindow = this.windows[windowNum];\n };\n /**\n * Try to create a TextDecoder if it is natively supported\n */\n\n\n Cea708Service.prototype.createTextDecoder = function (encoding) {\n if (typeof TextDecoder === 'undefined') {\n this.stream.trigger('log', {\n level: 'warn',\n message: 'The `encoding` option is unsupported without TextDecoder support'\n });\n } else {\n try {\n this.textDecoder_ = new TextDecoder(encoding);\n } catch (error) {\n this.stream.trigger('log', {\n level: 'warn',\n message: 'TextDecoder could not be created with ' + encoding + ' encoding. ' + error\n });\n }\n }\n };\n\n var Cea708Stream = function Cea708Stream(options) {\n options = options || {};\n Cea708Stream.prototype.init.call(this);\n var self = this;\n var captionServices = options.captionServices || {};\n var captionServiceEncodings = {};\n var serviceProps; // Get service encodings from captionServices option block\n\n Object.keys(captionServices).forEach(function (serviceName) {\n serviceProps = captionServices[serviceName];\n\n if (/^SERVICE/.test(serviceName)) {\n captionServiceEncodings[serviceName] = serviceProps.encoding;\n }\n });\n this.serviceEncodings = captionServiceEncodings;\n this.current708Packet = null;\n this.services = {};\n\n this.push = function (packet) {\n if (packet.type === 3) {\n // 708 packet start\n self.new708Packet();\n self.add708Bytes(packet);\n } else {\n if (self.current708Packet === null) {\n // This should only happen at the start of a file if there's no packet start.\n self.new708Packet();\n }\n\n self.add708Bytes(packet);\n }\n };\n };\n\n Cea708Stream.prototype = new stream();\n /**\n * Push current 708 packet, create new 708 packet.\n */\n\n Cea708Stream.prototype.new708Packet = function () {\n if (this.current708Packet !== null) {\n this.push708Packet();\n }\n\n this.current708Packet = {\n data: [],\n ptsVals: []\n };\n };\n /**\n * Add pts and both bytes from packet into current 708 packet.\n */\n\n\n Cea708Stream.prototype.add708Bytes = function (packet) {\n var data = packet.ccData;\n var byte0 = data >>> 8;\n var byte1 = data & 0xff; // I would just keep a list of packets instead of bytes, but it isn't clear in the spec\n // that service blocks will always line up with byte pairs.\n\n this.current708Packet.ptsVals.push(packet.pts);\n this.current708Packet.data.push(byte0);\n this.current708Packet.data.push(byte1);\n };\n /**\n * Parse completed 708 packet into service blocks and push each service block.\n */\n\n\n Cea708Stream.prototype.push708Packet = function () {\n var packet708 = this.current708Packet;\n var packetData = packet708.data;\n var serviceNum = null;\n var blockSize = null;\n var i = 0;\n var b = packetData[i++];\n packet708.seq = b >> 6;\n packet708.sizeCode = b & 0x3f; // 0b00111111;\n\n for (; i < packetData.length; i++) {\n b = packetData[i++];\n serviceNum = b >> 5;\n blockSize = b & 0x1f; // 0b00011111\n\n if (serviceNum === 7 && blockSize > 0) {\n // Extended service num\n b = packetData[i++];\n serviceNum = b;\n }\n\n this.pushServiceBlock(serviceNum, i, blockSize);\n\n if (blockSize > 0) {\n i += blockSize - 1;\n }\n }\n };\n /**\n * Parse service block, execute commands, read text.\n *\n * Note: While many of these commands serve important purposes,\n * many others just parse out the parameters or attributes, but\n * nothing is done with them because this is not a full and complete\n * implementation of the entire 708 spec.\n *\n * @param {Integer} serviceNum Service number\n * @param {Integer} start Start index of the 708 packet data\n * @param {Integer} size Block size\n */\n\n\n Cea708Stream.prototype.pushServiceBlock = function (serviceNum, start, size) {\n var b;\n var i = start;\n var packetData = this.current708Packet.data;\n var service = this.services[serviceNum];\n\n if (!service) {\n service = this.initService(serviceNum, i);\n }\n\n for (; i < start + size && i < packetData.length; i++) {\n b = packetData[i];\n\n if (within708TextBlock(b)) {\n i = this.handleText(i, service);\n } else if (b === 0x18) {\n i = this.multiByteCharacter(i, service);\n } else if (b === 0x10) {\n i = this.extendedCommands(i, service);\n } else if (0x80 <= b && b <= 0x87) {\n i = this.setCurrentWindow(i, service);\n } else if (0x98 <= b && b <= 0x9f) {\n i = this.defineWindow(i, service);\n } else if (b === 0x88) {\n i = this.clearWindows(i, service);\n } else if (b === 0x8c) {\n i = this.deleteWindows(i, service);\n } else if (b === 0x89) {\n i = this.displayWindows(i, service);\n } else if (b === 0x8a) {\n i = this.hideWindows(i, service);\n } else if (b === 0x8b) {\n i = this.toggleWindows(i, service);\n } else if (b === 0x97) {\n i = this.setWindowAttributes(i, service);\n } else if (b === 0x90) {\n i = this.setPenAttributes(i, service);\n } else if (b === 0x91) {\n i = this.setPenColor(i, service);\n } else if (b === 0x92) {\n i = this.setPenLocation(i, service);\n } else if (b === 0x8f) {\n service = this.reset(i, service);\n } else if (b === 0x08) {\n // BS: Backspace\n service.currentWindow.backspace();\n } else if (b === 0x0c) {\n // FF: Form feed\n service.currentWindow.clearText();\n } else if (b === 0x0d) {\n // CR: Carriage return\n service.currentWindow.pendingNewLine = true;\n } else if (b === 0x0e) {\n // HCR: Horizontal carriage return\n service.currentWindow.clearText();\n } else if (b === 0x8d) {\n // DLY: Delay, nothing to do\n i++;\n } else ;\n }\n };\n /**\n * Execute an extended command\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.extendedCommands = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n\n if (within708TextBlock(b)) {\n i = this.handleText(i, service, {\n isExtended: true\n });\n }\n\n return i;\n };\n /**\n * Get PTS value of a given byte index\n *\n * @param {Integer} byteIndex Index of the byte\n * @return {Integer} PTS\n */\n\n\n Cea708Stream.prototype.getPts = function (byteIndex) {\n // There's 1 pts value per 2 bytes\n return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)];\n };\n /**\n * Initializes a service\n *\n * @param {Integer} serviceNum Service number\n * @return {Service} Initialized service object\n */\n\n\n Cea708Stream.prototype.initService = function (serviceNum, i) {\n var serviceName = 'SERVICE' + serviceNum;\n var self = this;\n var serviceName;\n var encoding;\n\n if (serviceName in this.serviceEncodings) {\n encoding = this.serviceEncodings[serviceName];\n }\n\n this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self);\n this.services[serviceNum].init(this.getPts(i), function (pts) {\n self.flushDisplayed(pts, self.services[serviceNum]);\n });\n return this.services[serviceNum];\n };\n /**\n * Execute text writing to current window\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.handleText = function (i, service, options) {\n var isExtended = options && options.isExtended;\n var isMultiByte = options && options.isMultiByte;\n var packetData = this.current708Packet.data;\n var extended = isExtended ? 0x1000 : 0x0000;\n var currentByte = packetData[i];\n var nextByte = packetData[i + 1];\n var win = service.currentWindow;\n\n var _char;\n\n var charCodeArray; // Use the TextDecoder if one was created for this service\n\n if (service.textDecoder_ && !isExtended) {\n if (isMultiByte) {\n charCodeArray = [currentByte, nextByte];\n i++;\n } else {\n charCodeArray = [currentByte];\n }\n\n _char = service.textDecoder_.decode(new Uint8Array(charCodeArray));\n } else {\n _char = get708CharFromCode(extended | currentByte);\n }\n\n if (win.pendingNewLine && !win.isEmpty()) {\n win.newLine(this.getPts(i));\n }\n\n win.pendingNewLine = false;\n win.addText(_char);\n return i;\n };\n /**\n * Handle decoding of multibyte character\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.multiByteCharacter = function (i, service) {\n var packetData = this.current708Packet.data;\n var firstByte = packetData[i + 1];\n var secondByte = packetData[i + 2];\n\n if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) {\n i = this.handleText(++i, service, {\n isMultiByte: true\n });\n }\n\n return i;\n };\n /**\n * Parse and execute the CW# command.\n *\n * Set the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.setCurrentWindow = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var windowNum = b & 0x07;\n service.setCurrentWindow(windowNum);\n return i;\n };\n /**\n * Parse and execute the DF# command.\n *\n * Define a window and set it as the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.defineWindow = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var windowNum = b & 0x07;\n service.setCurrentWindow(windowNum);\n var win = service.currentWindow;\n b = packetData[++i];\n win.visible = (b & 0x20) >> 5; // v\n\n win.rowLock = (b & 0x10) >> 4; // rl\n\n win.columnLock = (b & 0x08) >> 3; // cl\n\n win.priority = b & 0x07; // p\n\n b = packetData[++i];\n win.relativePositioning = (b & 0x80) >> 7; // rp\n\n win.anchorVertical = b & 0x7f; // av\n\n b = packetData[++i];\n win.anchorHorizontal = b; // ah\n\n b = packetData[++i];\n win.anchorPoint = (b & 0xf0) >> 4; // ap\n\n win.rowCount = b & 0x0f; // rc\n\n b = packetData[++i];\n win.columnCount = b & 0x3f; // cc\n\n b = packetData[++i];\n win.windowStyle = (b & 0x38) >> 3; // ws\n\n win.penStyle = b & 0x07; // ps\n // The spec says there are (rowCount+1) \"virtual rows\"\n\n win.virtualRowCount = win.rowCount + 1;\n return i;\n };\n /**\n * Parse and execute the SWA command.\n *\n * Set attributes of the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.setWindowAttributes = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var winAttr = service.currentWindow.winAttr;\n b = packetData[++i];\n winAttr.fillOpacity = (b & 0xc0) >> 6; // fo\n\n winAttr.fillRed = (b & 0x30) >> 4; // fr\n\n winAttr.fillGreen = (b & 0x0c) >> 2; // fg\n\n winAttr.fillBlue = b & 0x03; // fb\n\n b = packetData[++i];\n winAttr.borderType = (b & 0xc0) >> 6; // bt\n\n winAttr.borderRed = (b & 0x30) >> 4; // br\n\n winAttr.borderGreen = (b & 0x0c) >> 2; // bg\n\n winAttr.borderBlue = b & 0x03; // bb\n\n b = packetData[++i];\n winAttr.borderType += (b & 0x80) >> 5; // bt\n\n winAttr.wordWrap = (b & 0x40) >> 6; // ww\n\n winAttr.printDirection = (b & 0x30) >> 4; // pd\n\n winAttr.scrollDirection = (b & 0x0c) >> 2; // sd\n\n winAttr.justify = b & 0x03; // j\n\n b = packetData[++i];\n winAttr.effectSpeed = (b & 0xf0) >> 4; // es\n\n winAttr.effectDirection = (b & 0x0c) >> 2; // ed\n\n winAttr.displayEffect = b & 0x03; // de\n\n return i;\n };\n /**\n * Gather text from all displayed windows and push a caption to output.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n */\n\n\n Cea708Stream.prototype.flushDisplayed = function (pts, service) {\n var displayedText = []; // TODO: Positioning not supported, displaying multiple windows will not necessarily\n // display text in the correct order, but sample files so far have not shown any issue.\n\n for (var winId = 0; winId < 8; winId++) {\n if (service.windows[winId].visible && !service.windows[winId].isEmpty()) {\n displayedText.push(service.windows[winId].getText());\n }\n }\n\n service.endPts = pts;\n service.text = displayedText.join('\\n\\n');\n this.pushCaption(service);\n service.startPts = pts;\n };\n /**\n * Push a caption to output if the caption contains text.\n *\n * @param {Service} service The service object to be affected\n */\n\n\n Cea708Stream.prototype.pushCaption = function (service) {\n if (service.text !== '') {\n this.trigger('data', {\n startPts: service.startPts,\n endPts: service.endPts,\n text: service.text,\n stream: 'cc708_' + service.serviceNum\n });\n service.text = '';\n service.startPts = service.endPts;\n }\n };\n /**\n * Parse and execute the DSW command.\n *\n * Set visible property of windows based on the parsed bitmask.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.displayWindows = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n\n for (var winId = 0; winId < 8; winId++) {\n if (b & 0x01 << winId) {\n service.windows[winId].visible = 1;\n }\n }\n\n return i;\n };\n /**\n * Parse and execute the HDW command.\n *\n * Set visible property of windows based on the parsed bitmask.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.hideWindows = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n\n for (var winId = 0; winId < 8; winId++) {\n if (b & 0x01 << winId) {\n service.windows[winId].visible = 0;\n }\n }\n\n return i;\n };\n /**\n * Parse and execute the TGW command.\n *\n * Set visible property of windows based on the parsed bitmask.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.toggleWindows = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n\n for (var winId = 0; winId < 8; winId++) {\n if (b & 0x01 << winId) {\n service.windows[winId].visible ^= 1;\n }\n }\n\n return i;\n };\n /**\n * Parse and execute the CLW command.\n *\n * Clear text of windows based on the parsed bitmask.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.clearWindows = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n\n for (var winId = 0; winId < 8; winId++) {\n if (b & 0x01 << winId) {\n service.windows[winId].clearText();\n }\n }\n\n return i;\n };\n /**\n * Parse and execute the DLW command.\n *\n * Re-initialize windows based on the parsed bitmask.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.deleteWindows = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[++i];\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n\n for (var winId = 0; winId < 8; winId++) {\n if (b & 0x01 << winId) {\n service.windows[winId].reset();\n }\n }\n\n return i;\n };\n /**\n * Parse and execute the SPA command.\n *\n * Set pen attributes of the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.setPenAttributes = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var penAttr = service.currentWindow.penAttr;\n b = packetData[++i];\n penAttr.textTag = (b & 0xf0) >> 4; // tt\n\n penAttr.offset = (b & 0x0c) >> 2; // o\n\n penAttr.penSize = b & 0x03; // s\n\n b = packetData[++i];\n penAttr.italics = (b & 0x80) >> 7; // i\n\n penAttr.underline = (b & 0x40) >> 6; // u\n\n penAttr.edgeType = (b & 0x38) >> 3; // et\n\n penAttr.fontStyle = b & 0x07; // fs\n\n return i;\n };\n /**\n * Parse and execute the SPC command.\n *\n * Set pen color of the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.setPenColor = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var penColor = service.currentWindow.penColor;\n b = packetData[++i];\n penColor.fgOpacity = (b & 0xc0) >> 6; // fo\n\n penColor.fgRed = (b & 0x30) >> 4; // fr\n\n penColor.fgGreen = (b & 0x0c) >> 2; // fg\n\n penColor.fgBlue = b & 0x03; // fb\n\n b = packetData[++i];\n penColor.bgOpacity = (b & 0xc0) >> 6; // bo\n\n penColor.bgRed = (b & 0x30) >> 4; // br\n\n penColor.bgGreen = (b & 0x0c) >> 2; // bg\n\n penColor.bgBlue = b & 0x03; // bb\n\n b = packetData[++i];\n penColor.edgeRed = (b & 0x30) >> 4; // er\n\n penColor.edgeGreen = (b & 0x0c) >> 2; // eg\n\n penColor.edgeBlue = b & 0x03; // eb\n\n return i;\n };\n /**\n * Parse and execute the SPL command.\n *\n * Set pen location of the current window.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Integer} New index after parsing\n */\n\n\n Cea708Stream.prototype.setPenLocation = function (i, service) {\n var packetData = this.current708Packet.data;\n var b = packetData[i];\n var penLoc = service.currentWindow.penLoc; // Positioning isn't really supported at the moment, so this essentially just inserts a linebreak\n\n service.currentWindow.pendingNewLine = true;\n b = packetData[++i];\n penLoc.row = b & 0x0f; // r\n\n b = packetData[++i];\n penLoc.column = b & 0x3f; // c\n\n return i;\n };\n /**\n * Execute the RST command.\n *\n * Reset service to a clean slate. Re-initialize.\n *\n * @param {Integer} i Current index in the 708 packet\n * @param {Service} service The service object to be affected\n * @return {Service} Re-initialized service\n */\n\n\n Cea708Stream.prototype.reset = function (i, service) {\n var pts = this.getPts(i);\n this.flushDisplayed(pts, service);\n return this.initService(service.serviceNum, i);\n }; // This hash maps non-ASCII, special, and extended character codes to their\n // proper Unicode equivalent. The first keys that are only a single byte\n // are the non-standard ASCII characters, which simply map the CEA608 byte\n // to the standard ASCII/Unicode. The two-byte keys that follow are the CEA608\n // character codes, but have their MSB bitmasked with 0x03 so that a lookup\n // can be performed regardless of the field and data channel on which the\n // character code was received.\n\n\n var CHARACTER_TRANSLATION = {\n 0x2a: 0xe1,\n // á\n 0x5c: 0xe9,\n // é\n 0x5e: 0xed,\n // í\n 0x5f: 0xf3,\n // ó\n 0x60: 0xfa,\n // ú\n 0x7b: 0xe7,\n // ç\n 0x7c: 0xf7,\n // ÷\n 0x7d: 0xd1,\n // Ñ\n 0x7e: 0xf1,\n // ñ\n 0x7f: 0x2588,\n // █\n 0x0130: 0xae,\n // ®\n 0x0131: 0xb0,\n // °\n 0x0132: 0xbd,\n // ½\n 0x0133: 0xbf,\n // ¿\n 0x0134: 0x2122,\n // ™\n 0x0135: 0xa2,\n // ¢\n 0x0136: 0xa3,\n // £\n 0x0137: 0x266a,\n // ♪\n 0x0138: 0xe0,\n // à\n 0x0139: 0xa0,\n //\n 0x013a: 0xe8,\n // è\n 0x013b: 0xe2,\n // â\n 0x013c: 0xea,\n // ê\n 0x013d: 0xee,\n // î\n 0x013e: 0xf4,\n // ô\n 0x013f: 0xfb,\n // û\n 0x0220: 0xc1,\n // Á\n 0x0221: 0xc9,\n // É\n 0x0222: 0xd3,\n // Ó\n 0x0223: 0xda,\n // Ú\n 0x0224: 0xdc,\n // Ü\n 0x0225: 0xfc,\n // ü\n 0x0226: 0x2018,\n // ‘\n 0x0227: 0xa1,\n // ¡\n 0x0228: 0x2a,\n // *\n 0x0229: 0x27,\n // '\n 0x022a: 0x2014,\n // —\n 0x022b: 0xa9,\n // ©\n 0x022c: 0x2120,\n // ℠\n 0x022d: 0x2022,\n // •\n 0x022e: 0x201c,\n // “\n 0x022f: 0x201d,\n // ”\n 0x0230: 0xc0,\n // À\n 0x0231: 0xc2,\n // Â\n 0x0232: 0xc7,\n // Ç\n 0x0233: 0xc8,\n // È\n 0x0234: 0xca,\n // Ê\n 0x0235: 0xcb,\n // Ë\n 0x0236: 0xeb,\n // ë\n 0x0237: 0xce,\n // Î\n 0x0238: 0xcf,\n // Ï\n 0x0239: 0xef,\n // ï\n 0x023a: 0xd4,\n // Ô\n 0x023b: 0xd9,\n // Ù\n 0x023c: 0xf9,\n // ù\n 0x023d: 0xdb,\n // Û\n 0x023e: 0xab,\n // «\n 0x023f: 0xbb,\n // »\n 0x0320: 0xc3,\n // Ã\n 0x0321: 0xe3,\n // ã\n 0x0322: 0xcd,\n // Í\n 0x0323: 0xcc,\n // Ì\n 0x0324: 0xec,\n // ì\n 0x0325: 0xd2,\n // Ò\n 0x0326: 0xf2,\n // ò\n 0x0327: 0xd5,\n // Õ\n 0x0328: 0xf5,\n // õ\n 0x0329: 0x7b,\n // {\n 0x032a: 0x7d,\n // }\n 0x032b: 0x5c,\n // \\\n 0x032c: 0x5e,\n // ^\n 0x032d: 0x5f,\n // _\n 0x032e: 0x7c,\n // |\n 0x032f: 0x7e,\n // ~\n 0x0330: 0xc4,\n // Ä\n 0x0331: 0xe4,\n // ä\n 0x0332: 0xd6,\n // Ö\n 0x0333: 0xf6,\n // ö\n 0x0334: 0xdf,\n // ß\n 0x0335: 0xa5,\n // ¥\n 0x0336: 0xa4,\n // ¤\n 0x0337: 0x2502,\n // │\n 0x0338: 0xc5,\n // Å\n 0x0339: 0xe5,\n // å\n 0x033a: 0xd8,\n // Ø\n 0x033b: 0xf8,\n // ø\n 0x033c: 0x250c,\n // ┌\n 0x033d: 0x2510,\n // ┐\n 0x033e: 0x2514,\n // └\n 0x033f: 0x2518 // ┘\n\n };\n\n var getCharFromCode = function getCharFromCode(code) {\n if (code === null) {\n return '';\n }\n\n code = CHARACTER_TRANSLATION[code] || code;\n return String.fromCharCode(code);\n }; // the index of the last row in a CEA-608 display buffer\n\n\n var BOTTOM_ROW = 14; // This array is used for mapping PACs -> row #, since there's no way of\n // getting it through bit logic.\n\n var ROWS = [0x1100, 0x1120, 0x1200, 0x1220, 0x1500, 0x1520, 0x1600, 0x1620, 0x1700, 0x1720, 0x1000, 0x1300, 0x1320, 0x1400, 0x1420]; // CEA-608 captions are rendered onto a 34x15 matrix of character\n // cells. The \"bottom\" row is the last element in the outer array.\n\n var createDisplayBuffer = function createDisplayBuffer() {\n var result = [],\n i = BOTTOM_ROW + 1;\n\n while (i--) {\n result.push('');\n }\n\n return result;\n };\n\n var Cea608Stream = function Cea608Stream(field, dataChannel) {\n Cea608Stream.prototype.init.call(this);\n this.field_ = field || 0;\n this.dataChannel_ = dataChannel || 0;\n this.name_ = 'CC' + ((this.field_ << 1 | this.dataChannel_) + 1);\n this.setConstants();\n this.reset();\n\n this.push = function (packet) {\n var data, swap, char0, char1, text; // remove the parity bits\n\n data = packet.ccData & 0x7f7f; // ignore duplicate control codes; the spec demands they're sent twice\n\n if (data === this.lastControlCode_) {\n this.lastControlCode_ = null;\n return;\n } // Store control codes\n\n\n if ((data & 0xf000) === 0x1000) {\n this.lastControlCode_ = data;\n } else if (data !== this.PADDING_) {\n this.lastControlCode_ = null;\n }\n\n char0 = data >>> 8;\n char1 = data & 0xff;\n\n if (data === this.PADDING_) {\n return;\n } else if (data === this.RESUME_CAPTION_LOADING_) {\n this.mode_ = 'popOn';\n } else if (data === this.END_OF_CAPTION_) {\n // If an EOC is received while in paint-on mode, the displayed caption\n // text should be swapped to non-displayed memory as if it was a pop-on\n // caption. Because of that, we should explicitly switch back to pop-on\n // mode\n this.mode_ = 'popOn';\n this.clearFormatting(packet.pts); // if a caption was being displayed, it's gone now\n\n this.flushDisplayed(packet.pts); // flip memory\n\n swap = this.displayed_;\n this.displayed_ = this.nonDisplayed_;\n this.nonDisplayed_ = swap; // start measuring the time to display the caption\n\n this.startPts_ = packet.pts;\n } else if (data === this.ROLL_UP_2_ROWS_) {\n this.rollUpRows_ = 2;\n this.setRollUp(packet.pts);\n } else if (data === this.ROLL_UP_3_ROWS_) {\n this.rollUpRows_ = 3;\n this.setRollUp(packet.pts);\n } else if (data === this.ROLL_UP_4_ROWS_) {\n this.rollUpRows_ = 4;\n this.setRollUp(packet.pts);\n } else if (data === this.CARRIAGE_RETURN_) {\n this.clearFormatting(packet.pts);\n this.flushDisplayed(packet.pts);\n this.shiftRowsUp_();\n this.startPts_ = packet.pts;\n } else if (data === this.BACKSPACE_) {\n if (this.mode_ === 'popOn') {\n this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);\n } else {\n this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);\n }\n } else if (data === this.ERASE_DISPLAYED_MEMORY_) {\n this.flushDisplayed(packet.pts);\n this.displayed_ = createDisplayBuffer();\n } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) {\n this.nonDisplayed_ = createDisplayBuffer();\n } else if (data === this.RESUME_DIRECT_CAPTIONING_) {\n if (this.mode_ !== 'paintOn') {\n // NOTE: This should be removed when proper caption positioning is\n // implemented\n this.flushDisplayed(packet.pts);\n this.displayed_ = createDisplayBuffer();\n }\n\n this.mode_ = 'paintOn';\n this.startPts_ = packet.pts; // Append special characters to caption text\n } else if (this.isSpecialCharacter(char0, char1)) {\n // Bitmask char0 so that we can apply character transformations\n // regardless of field and data channel.\n // Then byte-shift to the left and OR with char1 so we can pass the\n // entire character code to `getCharFromCode`.\n char0 = (char0 & 0x03) << 8;\n text = getCharFromCode(char0 | char1);\n this[this.mode_](packet.pts, text);\n this.column_++; // Append extended characters to caption text\n } else if (this.isExtCharacter(char0, char1)) {\n // Extended characters always follow their \"non-extended\" equivalents.\n // IE if a \"è\" is desired, you'll always receive \"eè\"; non-compliant\n // decoders are supposed to drop the \"è\", while compliant decoders\n // backspace the \"e\" and insert \"è\".\n // Delete the previous character\n if (this.mode_ === 'popOn') {\n this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);\n } else {\n this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);\n } // Bitmask char0 so that we can apply character transformations\n // regardless of field and data channel.\n // Then byte-shift to the left and OR with char1 so we can pass the\n // entire character code to `getCharFromCode`.\n\n\n char0 = (char0 & 0x03) << 8;\n text = getCharFromCode(char0 | char1);\n this[this.mode_](packet.pts, text);\n this.column_++; // Process mid-row codes\n } else if (this.isMidRowCode(char0, char1)) {\n // Attributes are not additive, so clear all formatting\n this.clearFormatting(packet.pts); // According to the standard, mid-row codes\n // should be replaced with spaces, so add one now\n\n this[this.mode_](packet.pts, ' ');\n this.column_++;\n\n if ((char1 & 0xe) === 0xe) {\n this.addFormatting(packet.pts, ['i']);\n }\n\n if ((char1 & 0x1) === 0x1) {\n this.addFormatting(packet.pts, ['u']);\n } // Detect offset control codes and adjust cursor\n\n } else if (this.isOffsetControlCode(char0, char1)) {\n // Cursor position is set by indent PAC (see below) in 4-column\n // increments, with an additional offset code of 1-3 to reach any\n // of the 32 columns specified by CEA-608. So all we need to do\n // here is increment the column cursor by the given offset.\n this.column_ += char1 & 0x03; // Detect PACs (Preamble Address Codes)\n } else if (this.isPAC(char0, char1)) {\n // There's no logic for PAC -> row mapping, so we have to just\n // find the row code in an array and use its index :(\n var row = ROWS.indexOf(data & 0x1f20); // Configure the caption window if we're in roll-up mode\n\n if (this.mode_ === 'rollUp') {\n // This implies that the base row is incorrectly set.\n // As per the recommendation in CEA-608(Base Row Implementation), defer to the number\n // of roll-up rows set.\n if (row - this.rollUpRows_ + 1 < 0) {\n row = this.rollUpRows_ - 1;\n }\n\n this.setRollUp(packet.pts, row);\n }\n\n if (row !== this.row_) {\n // formatting is only persistent for current row\n this.clearFormatting(packet.pts);\n this.row_ = row;\n } // All PACs can apply underline, so detect and apply\n // (All odd-numbered second bytes set underline)\n\n\n if (char1 & 0x1 && this.formatting_.indexOf('u') === -1) {\n this.addFormatting(packet.pts, ['u']);\n }\n\n if ((data & 0x10) === 0x10) {\n // We've got an indent level code. Each successive even number\n // increments the column cursor by 4, so we can get the desired\n // column position by bit-shifting to the right (to get n/2)\n // and multiplying by 4.\n this.column_ = ((data & 0xe) >> 1) * 4;\n }\n\n if (this.isColorPAC(char1)) {\n // it's a color code, though we only support white, which\n // can be either normal or italicized. white italics can be\n // either 0x4e or 0x6e depending on the row, so we just\n // bitwise-and with 0xe to see if italics should be turned on\n if ((char1 & 0xe) === 0xe) {\n this.addFormatting(packet.pts, ['i']);\n }\n } // We have a normal character in char0, and possibly one in char1\n\n } else if (this.isNormalChar(char0)) {\n if (char1 === 0x00) {\n char1 = null;\n }\n\n text = getCharFromCode(char0);\n text += getCharFromCode(char1);\n this[this.mode_](packet.pts, text);\n this.column_ += text.length;\n } // finish data processing\n\n };\n };\n\n Cea608Stream.prototype = new stream(); // Trigger a cue point that captures the current state of the\n // display buffer\n\n Cea608Stream.prototype.flushDisplayed = function (pts) {\n var content = this.displayed_ // remove spaces from the start and end of the string\n .map(function (row, index) {\n try {\n return row.trim();\n } catch (e) {\n // Ordinarily, this shouldn't happen. However, caption\n // parsing errors should not throw exceptions and\n // break playback.\n this.trigger('log', {\n level: 'warn',\n message: 'Skipping a malformed 608 caption at index ' + index + '.'\n });\n return '';\n }\n }, this) // combine all text rows to display in one cue\n .join('\\n') // and remove blank rows from the start and end, but not the middle\n .replace(/^\\n+|\\n+$/g, '');\n\n if (content.length) {\n this.trigger('data', {\n startPts: this.startPts_,\n endPts: pts,\n text: content,\n stream: this.name_\n });\n }\n };\n /**\n * Zero out the data, used for startup and on seek\n */\n\n\n Cea608Stream.prototype.reset = function () {\n this.mode_ = 'popOn'; // When in roll-up mode, the index of the last row that will\n // actually display captions. If a caption is shifted to a row\n // with a lower index than this, it is cleared from the display\n // buffer\n\n this.topRow_ = 0;\n this.startPts_ = 0;\n this.displayed_ = createDisplayBuffer();\n this.nonDisplayed_ = createDisplayBuffer();\n this.lastControlCode_ = null; // Track row and column for proper line-breaking and spacing\n\n this.column_ = 0;\n this.row_ = BOTTOM_ROW;\n this.rollUpRows_ = 2; // This variable holds currently-applied formatting\n\n this.formatting_ = [];\n };\n /**\n * Sets up control code and related constants for this instance\n */\n\n\n Cea608Stream.prototype.setConstants = function () {\n // The following attributes have these uses:\n // ext_ : char0 for mid-row codes, and the base for extended\n // chars (ext_+0, ext_+1, and ext_+2 are char0s for\n // extended codes)\n // control_: char0 for control codes, except byte-shifted to the\n // left so that we can do this.control_ | CONTROL_CODE\n // offset_: char0 for tab offset codes\n //\n // It's also worth noting that control codes, and _only_ control codes,\n // differ between field 1 and field2. Field 2 control codes are always\n // their field 1 value plus 1. That's why there's the \"| field\" on the\n // control value.\n if (this.dataChannel_ === 0) {\n this.BASE_ = 0x10;\n this.EXT_ = 0x11;\n this.CONTROL_ = (0x14 | this.field_) << 8;\n this.OFFSET_ = 0x17;\n } else if (this.dataChannel_ === 1) {\n this.BASE_ = 0x18;\n this.EXT_ = 0x19;\n this.CONTROL_ = (0x1c | this.field_) << 8;\n this.OFFSET_ = 0x1f;\n } // Constants for the LSByte command codes recognized by Cea608Stream. This\n // list is not exhaustive. For a more comprehensive listing and semantics see\n // http://www.gpo.gov/fdsys/pkg/CFR-2010-title47-vol1/pdf/CFR-2010-title47-vol1-sec15-119.pdf\n // Padding\n\n\n this.PADDING_ = 0x0000; // Pop-on Mode\n\n this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 0x20;\n this.END_OF_CAPTION_ = this.CONTROL_ | 0x2f; // Roll-up Mode\n\n this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 0x25;\n this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 0x26;\n this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 0x27;\n this.CARRIAGE_RETURN_ = this.CONTROL_ | 0x2d; // paint-on mode\n\n this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 0x29; // Erasure\n\n this.BACKSPACE_ = this.CONTROL_ | 0x21;\n this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2c;\n this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 0x2e;\n };\n /**\n * Detects if the 2-byte packet data is a special character\n *\n * Special characters have a second byte in the range 0x30 to 0x3f,\n * with the first byte being 0x11 (for data channel 1) or 0x19 (for\n * data channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are an special character\n */\n\n\n Cea608Stream.prototype.isSpecialCharacter = function (char0, char1) {\n return char0 === this.EXT_ && char1 >= 0x30 && char1 <= 0x3f;\n };\n /**\n * Detects if the 2-byte packet data is an extended character\n *\n * Extended characters have a second byte in the range 0x20 to 0x3f,\n * with the first byte being 0x12 or 0x13 (for data channel 1) or\n * 0x1a or 0x1b (for data channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are an extended character\n */\n\n\n Cea608Stream.prototype.isExtCharacter = function (char0, char1) {\n return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 0x20 && char1 <= 0x3f;\n };\n /**\n * Detects if the 2-byte packet is a mid-row code\n *\n * Mid-row codes have a second byte in the range 0x20 to 0x2f, with\n * the first byte being 0x11 (for data channel 1) or 0x19 (for data\n * channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are a mid-row code\n */\n\n\n Cea608Stream.prototype.isMidRowCode = function (char0, char1) {\n return char0 === this.EXT_ && char1 >= 0x20 && char1 <= 0x2f;\n };\n /**\n * Detects if the 2-byte packet is an offset control code\n *\n * Offset control codes have a second byte in the range 0x21 to 0x23,\n * with the first byte being 0x17 (for data channel 1) or 0x1f (for\n * data channel 2).\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are an offset control code\n */\n\n\n Cea608Stream.prototype.isOffsetControlCode = function (char0, char1) {\n return char0 === this.OFFSET_ && char1 >= 0x21 && char1 <= 0x23;\n };\n /**\n * Detects if the 2-byte packet is a Preamble Address Code\n *\n * PACs have a first byte in the range 0x10 to 0x17 (for data channel 1)\n * or 0x18 to 0x1f (for data channel 2), with the second byte in the\n * range 0x40 to 0x7f.\n *\n * @param {Integer} char0 The first byte\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the 2 bytes are a PAC\n */\n\n\n Cea608Stream.prototype.isPAC = function (char0, char1) {\n return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 0x40 && char1 <= 0x7f;\n };\n /**\n * Detects if a packet's second byte is in the range of a PAC color code\n *\n * PAC color codes have the second byte be in the range 0x40 to 0x4f, or\n * 0x60 to 0x6f.\n *\n * @param {Integer} char1 The second byte\n * @return {Boolean} Whether the byte is a color PAC\n */\n\n\n Cea608Stream.prototype.isColorPAC = function (char1) {\n return char1 >= 0x40 && char1 <= 0x4f || char1 >= 0x60 && char1 <= 0x7f;\n };\n /**\n * Detects if a single byte is in the range of a normal character\n *\n * Normal text bytes are in the range 0x20 to 0x7f.\n *\n * @param {Integer} char The byte\n * @return {Boolean} Whether the byte is a normal character\n */\n\n\n Cea608Stream.prototype.isNormalChar = function (_char2) {\n return _char2 >= 0x20 && _char2 <= 0x7f;\n };\n /**\n * Configures roll-up\n *\n * @param {Integer} pts Current PTS\n * @param {Integer} newBaseRow Used by PACs to slide the current window to\n * a new position\n */\n\n\n Cea608Stream.prototype.setRollUp = function (pts, newBaseRow) {\n // Reset the base row to the bottom row when switching modes\n if (this.mode_ !== 'rollUp') {\n this.row_ = BOTTOM_ROW;\n this.mode_ = 'rollUp'; // Spec says to wipe memories when switching to roll-up\n\n this.flushDisplayed(pts);\n this.nonDisplayed_ = createDisplayBuffer();\n this.displayed_ = createDisplayBuffer();\n }\n\n if (newBaseRow !== undefined && newBaseRow !== this.row_) {\n // move currently displayed captions (up or down) to the new base row\n for (var i = 0; i < this.rollUpRows_; i++) {\n this.displayed_[newBaseRow - i] = this.displayed_[this.row_ - i];\n this.displayed_[this.row_ - i] = '';\n }\n }\n\n if (newBaseRow === undefined) {\n newBaseRow = this.row_;\n }\n\n this.topRow_ = newBaseRow - this.rollUpRows_ + 1;\n }; // Adds the opening HTML tag for the passed character to the caption text,\n // and keeps track of it for later closing\n\n\n Cea608Stream.prototype.addFormatting = function (pts, format) {\n this.formatting_ = this.formatting_.concat(format);\n var text = format.reduce(function (text, format) {\n return text + '<' + format + '>';\n }, '');\n this[this.mode_](pts, text);\n }; // Adds HTML closing tags for current formatting to caption text and\n // clears remembered formatting\n\n\n Cea608Stream.prototype.clearFormatting = function (pts) {\n if (!this.formatting_.length) {\n return;\n }\n\n var text = this.formatting_.reverse().reduce(function (text, format) {\n return text + '</' + format + '>';\n }, '');\n this.formatting_ = [];\n this[this.mode_](pts, text);\n }; // Mode Implementations\n\n\n Cea608Stream.prototype.popOn = function (pts, text) {\n var baseRow = this.nonDisplayed_[this.row_]; // buffer characters\n\n baseRow += text;\n this.nonDisplayed_[this.row_] = baseRow;\n };\n\n Cea608Stream.prototype.rollUp = function (pts, text) {\n var baseRow = this.displayed_[this.row_];\n baseRow += text;\n this.displayed_[this.row_] = baseRow;\n };\n\n Cea608Stream.prototype.shiftRowsUp_ = function () {\n var i; // clear out inactive rows\n\n for (i = 0; i < this.topRow_; i++) {\n this.displayed_[i] = '';\n }\n\n for (i = this.row_ + 1; i < BOTTOM_ROW + 1; i++) {\n this.displayed_[i] = '';\n } // shift displayed rows up\n\n\n for (i = this.topRow_; i < this.row_; i++) {\n this.displayed_[i] = this.displayed_[i + 1];\n } // clear out the bottom row\n\n\n this.displayed_[this.row_] = '';\n };\n\n Cea608Stream.prototype.paintOn = function (pts, text) {\n var baseRow = this.displayed_[this.row_];\n baseRow += text;\n this.displayed_[this.row_] = baseRow;\n }; // exports\n\n\n var captionStream = {\n CaptionStream: CaptionStream$1,\n Cea608Stream: Cea608Stream,\n Cea708Stream: Cea708Stream\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var streamTypes = {\n H264_STREAM_TYPE: 0x1B,\n ADTS_STREAM_TYPE: 0x0F,\n METADATA_STREAM_TYPE: 0x15\n };\n var MAX_TS = 8589934592;\n var RO_THRESH = 4294967296;\n var TYPE_SHARED = 'shared';\n\n var handleRollover$1 = function handleRollover(value, reference) {\n var direction = 1;\n\n if (value > reference) {\n // If the current timestamp value is greater than our reference timestamp and we detect a\n // timestamp rollover, this means the roll over is happening in the opposite direction.\n // Example scenario: Enter a long stream/video just after a rollover occurred. The reference\n // point will be set to a small number, e.g. 1. The user then seeks backwards over the\n // rollover point. In loading this segment, the timestamp values will be very large,\n // e.g. 2^33 - 1. Since this comes before the data we loaded previously, we want to adjust\n // the time stamp to be `value - 2^33`.\n direction = -1;\n } // Note: A seek forwards or back that is greater than the RO_THRESH (2^32, ~13 hours) will\n // cause an incorrect adjustment.\n\n\n while (Math.abs(reference - value) > RO_THRESH) {\n value += direction * MAX_TS;\n }\n\n return value;\n };\n\n var TimestampRolloverStream$1 = function TimestampRolloverStream(type) {\n var lastDTS, referenceDTS;\n TimestampRolloverStream.prototype.init.call(this); // The \"shared\" type is used in cases where a stream will contain muxed\n // video and audio. We could use `undefined` here, but having a string\n // makes debugging a little clearer.\n\n this.type_ = type || TYPE_SHARED;\n\n this.push = function (data) {\n // Any \"shared\" rollover streams will accept _all_ data. Otherwise,\n // streams will only accept data that matches their type.\n if (this.type_ !== TYPE_SHARED && data.type !== this.type_) {\n return;\n }\n\n if (referenceDTS === undefined) {\n referenceDTS = data.dts;\n }\n\n data.dts = handleRollover$1(data.dts, referenceDTS);\n data.pts = handleRollover$1(data.pts, referenceDTS);\n lastDTS = data.dts;\n this.trigger('data', data);\n };\n\n this.flush = function () {\n referenceDTS = lastDTS;\n this.trigger('done');\n };\n\n this.endTimeline = function () {\n this.flush();\n this.trigger('endedtimeline');\n };\n\n this.discontinuity = function () {\n referenceDTS = void 0;\n lastDTS = void 0;\n };\n\n this.reset = function () {\n this.discontinuity();\n this.trigger('reset');\n };\n };\n\n TimestampRolloverStream$1.prototype = new stream();\n var timestampRolloverStream = {\n TimestampRolloverStream: TimestampRolloverStream$1,\n handleRollover: handleRollover$1\n };\n\n var percentEncode$1 = function percentEncode(bytes, start, end) {\n var i,\n result = '';\n\n for (i = start; i < end; i++) {\n result += '%' + ('00' + bytes[i].toString(16)).slice(-2);\n }\n\n return result;\n },\n // return the string representation of the specified byte range,\n // interpreted as UTf-8.\n parseUtf8 = function parseUtf8(bytes, start, end) {\n return decodeURIComponent(percentEncode$1(bytes, start, end));\n },\n // return the string representation of the specified byte range,\n // interpreted as ISO-8859-1.\n parseIso88591$1 = function parseIso88591(bytes, start, end) {\n return unescape(percentEncode$1(bytes, start, end)); // jshint ignore:line\n },\n parseSyncSafeInteger$1 = function parseSyncSafeInteger(data) {\n return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];\n },\n tagParsers = {\n TXXX: function TXXX(tag) {\n var i;\n\n if (tag.data[0] !== 3) {\n // ignore frames with unrecognized character encodings\n return;\n }\n\n for (i = 1; i < tag.data.length; i++) {\n if (tag.data[i] === 0) {\n // parse the text fields\n tag.description = parseUtf8(tag.data, 1, i); // do not include the null terminator in the tag value\n\n tag.value = parseUtf8(tag.data, i + 1, tag.data.length).replace(/\\0*$/, '');\n break;\n }\n }\n\n tag.data = tag.value;\n },\n WXXX: function WXXX(tag) {\n var i;\n\n if (tag.data[0] !== 3) {\n // ignore frames with unrecognized character encodings\n return;\n }\n\n for (i = 1; i < tag.data.length; i++) {\n if (tag.data[i] === 0) {\n // parse the description and URL fields\n tag.description = parseUtf8(tag.data, 1, i);\n tag.url = parseUtf8(tag.data, i + 1, tag.data.length);\n break;\n }\n }\n },\n PRIV: function PRIV(tag) {\n var i;\n\n for (i = 0; i < tag.data.length; i++) {\n if (tag.data[i] === 0) {\n // parse the description and URL fields\n tag.owner = parseIso88591$1(tag.data, 0, i);\n break;\n }\n }\n\n tag.privateData = tag.data.subarray(i + 1);\n tag.data = tag.privateData;\n }\n },\n _MetadataStream;\n\n _MetadataStream = function MetadataStream(options) {\n var settings = {\n // the bytes of the program-level descriptor field in MP2T\n // see ISO/IEC 13818-1:2013 (E), section 2.6 \"Program and\n // program element descriptors\"\n descriptor: options && options.descriptor\n },\n // the total size in bytes of the ID3 tag being parsed\n tagSize = 0,\n // tag data that is not complete enough to be parsed\n buffer = [],\n // the total number of bytes currently in the buffer\n bufferSize = 0,\n i;\n\n _MetadataStream.prototype.init.call(this); // calculate the text track in-band metadata track dispatch type\n // https://html.spec.whatwg.org/multipage/embedded-content.html#steps-to-expose-a-media-resource-specific-text-track\n\n\n this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16);\n\n if (settings.descriptor) {\n for (i = 0; i < settings.descriptor.length; i++) {\n this.dispatchType += ('00' + settings.descriptor[i].toString(16)).slice(-2);\n }\n }\n\n this.push = function (chunk) {\n var tag, frameStart, frameSize, frame, i, frameHeader;\n\n if (chunk.type !== 'timed-metadata') {\n return;\n } // if data_alignment_indicator is set in the PES header,\n // we must have the start of a new ID3 tag. Assume anything\n // remaining in the buffer was malformed and throw it out\n\n\n if (chunk.dataAlignmentIndicator) {\n bufferSize = 0;\n buffer.length = 0;\n } // ignore events that don't look like ID3 data\n\n\n if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== 'I'.charCodeAt(0) || chunk.data[1] !== 'D'.charCodeAt(0) || chunk.data[2] !== '3'.charCodeAt(0))) {\n this.trigger('log', {\n level: 'warn',\n message: 'Skipping unrecognized metadata packet'\n });\n return;\n } // add this chunk to the data we've collected so far\n\n\n buffer.push(chunk);\n bufferSize += chunk.data.byteLength; // grab the size of the entire frame from the ID3 header\n\n if (buffer.length === 1) {\n // the frame size is transmitted as a 28-bit integer in the\n // last four bytes of the ID3 header.\n // The most significant bit of each byte is dropped and the\n // results concatenated to recover the actual value.\n tagSize = parseSyncSafeInteger$1(chunk.data.subarray(6, 10)); // ID3 reports the tag size excluding the header but it's more\n // convenient for our comparisons to include it\n\n tagSize += 10;\n } // if the entire frame has not arrived, wait for more data\n\n\n if (bufferSize < tagSize) {\n return;\n } // collect the entire frame so it can be parsed\n\n\n tag = {\n data: new Uint8Array(tagSize),\n frames: [],\n pts: buffer[0].pts,\n dts: buffer[0].dts\n };\n\n for (i = 0; i < tagSize;) {\n tag.data.set(buffer[0].data.subarray(0, tagSize - i), i);\n i += buffer[0].data.byteLength;\n bufferSize -= buffer[0].data.byteLength;\n buffer.shift();\n } // find the start of the first frame and the end of the tag\n\n\n frameStart = 10;\n\n if (tag.data[5] & 0x40) {\n // advance the frame start past the extended header\n frameStart += 4; // header size field\n\n frameStart += parseSyncSafeInteger$1(tag.data.subarray(10, 14)); // clip any padding off the end\n\n tagSize -= parseSyncSafeInteger$1(tag.data.subarray(16, 20));\n } // parse one or more ID3 frames\n // http://id3.org/id3v2.3.0#ID3v2_frame_overview\n\n\n do {\n // determine the number of bytes in this frame\n frameSize = parseSyncSafeInteger$1(tag.data.subarray(frameStart + 4, frameStart + 8));\n\n if (frameSize < 1) {\n this.trigger('log', {\n level: 'warn',\n message: 'Malformed ID3 frame encountered. Skipping metadata parsing.'\n });\n return;\n }\n\n frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]);\n frame = {\n id: frameHeader,\n data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10)\n };\n frame.key = frame.id;\n\n if (tagParsers[frame.id]) {\n tagParsers[frame.id](frame); // handle the special PRIV frame used to indicate the start\n // time for raw AAC data\n\n if (frame.owner === 'com.apple.streaming.transportStreamTimestamp') {\n var d = frame.data,\n size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2;\n size *= 4;\n size += d[7] & 0x03;\n frame.timeStamp = size; // in raw AAC, all subsequent data will be timestamped based\n // on the value of this frame\n // we couldn't have known the appropriate pts and dts before\n // parsing this ID3 tag so set those values now\n\n if (tag.pts === undefined && tag.dts === undefined) {\n tag.pts = frame.timeStamp;\n tag.dts = frame.timeStamp;\n }\n\n this.trigger('timestamp', frame);\n }\n }\n\n tag.frames.push(frame);\n frameStart += 10; // advance past the frame header\n\n frameStart += frameSize; // advance past the frame body\n } while (frameStart < tagSize);\n\n this.trigger('data', tag);\n };\n };\n\n _MetadataStream.prototype = new stream();\n var metadataStream = _MetadataStream;\n var TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream; // object types\n\n var _TransportPacketStream, _TransportParseStream, _ElementaryStream; // constants\n\n\n var MP2T_PACKET_LENGTH$1 = 188,\n // bytes\n SYNC_BYTE$1 = 0x47;\n /**\n * Splits an incoming stream of binary data into MPEG-2 Transport\n * Stream packets.\n */\n\n _TransportPacketStream = function TransportPacketStream() {\n var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1),\n bytesInBuffer = 0;\n\n _TransportPacketStream.prototype.init.call(this); // Deliver new bytes to the stream.\n\n /**\n * Split a stream of data into M2TS packets\n **/\n\n\n this.push = function (bytes) {\n var startIndex = 0,\n endIndex = MP2T_PACKET_LENGTH$1,\n everything; // If there are bytes remaining from the last segment, prepend them to the\n // bytes that were pushed in\n\n if (bytesInBuffer) {\n everything = new Uint8Array(bytes.byteLength + bytesInBuffer);\n everything.set(buffer.subarray(0, bytesInBuffer));\n everything.set(bytes, bytesInBuffer);\n bytesInBuffer = 0;\n } else {\n everything = bytes;\n } // While we have enough data for a packet\n\n\n while (endIndex < everything.byteLength) {\n // Look for a pair of start and end sync bytes in the data..\n if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) {\n // We found a packet so emit it and jump one whole packet forward in\n // the stream\n this.trigger('data', everything.subarray(startIndex, endIndex));\n startIndex += MP2T_PACKET_LENGTH$1;\n endIndex += MP2T_PACKET_LENGTH$1;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n\n startIndex++;\n endIndex++;\n } // If there was some data left over at the end of the segment that couldn't\n // possibly be a whole packet, keep it because it might be the start of a packet\n // that continues in the next segment\n\n\n if (startIndex < everything.byteLength) {\n buffer.set(everything.subarray(startIndex), 0);\n bytesInBuffer = everything.byteLength - startIndex;\n }\n };\n /**\n * Passes identified M2TS packets to the TransportParseStream to be parsed\n **/\n\n\n this.flush = function () {\n // If the buffer contains a whole packet when we are being flushed, emit it\n // and empty the buffer. Otherwise hold onto the data because it may be\n // important for decoding the next segment\n if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) {\n this.trigger('data', buffer);\n bytesInBuffer = 0;\n }\n\n this.trigger('done');\n };\n\n this.endTimeline = function () {\n this.flush();\n this.trigger('endedtimeline');\n };\n\n this.reset = function () {\n bytesInBuffer = 0;\n this.trigger('reset');\n };\n };\n\n _TransportPacketStream.prototype = new stream();\n /**\n * Accepts an MP2T TransportPacketStream and emits data events with parsed\n * forms of the individual transport stream packets.\n */\n\n _TransportParseStream = function TransportParseStream() {\n var parsePsi, parsePat, parsePmt, self;\n\n _TransportParseStream.prototype.init.call(this);\n\n self = this;\n this.packetsWaitingForPmt = [];\n this.programMapTable = undefined;\n\n parsePsi = function parsePsi(payload, psi) {\n var offset = 0; // PSI packets may be split into multiple sections and those\n // sections may be split into multiple packets. If a PSI\n // section starts in this packet, the payload_unit_start_indicator\n // will be true and the first byte of the payload will indicate\n // the offset from the current position to the start of the\n // section.\n\n if (psi.payloadUnitStartIndicator) {\n offset += payload[offset] + 1;\n }\n\n if (psi.type === 'pat') {\n parsePat(payload.subarray(offset), psi);\n } else {\n parsePmt(payload.subarray(offset), psi);\n }\n };\n\n parsePat = function parsePat(payload, pat) {\n pat.section_number = payload[7]; // eslint-disable-line camelcase\n\n pat.last_section_number = payload[8]; // eslint-disable-line camelcase\n // skip the PSI header and parse the first PMT entry\n\n self.pmtPid = (payload[10] & 0x1F) << 8 | payload[11];\n pat.pmtPid = self.pmtPid;\n };\n /**\n * Parse out the relevant fields of a Program Map Table (PMT).\n * @param payload {Uint8Array} the PMT-specific portion of an MP2T\n * packet. The first byte in this array should be the table_id\n * field.\n * @param pmt {object} the object that should be decorated with\n * fields parsed from the PMT.\n */\n\n\n parsePmt = function parsePmt(payload, pmt) {\n var sectionLength, tableEnd, programInfoLength, offset; // PMTs can be sent ahead of the time when they should actually\n // take effect. We don't believe this should ever be the case\n // for HLS but we'll ignore \"forward\" PMT declarations if we see\n // them. Future PMT declarations have the current_next_indicator\n // set to zero.\n\n if (!(payload[5] & 0x01)) {\n return;\n } // overwrite any existing program map table\n\n\n self.programMapTable = {\n video: null,\n audio: null,\n 'timed-metadata': {}\n }; // the mapping table ends at the end of the current section\n\n sectionLength = (payload[1] & 0x0f) << 8 | payload[2];\n tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how\n // long the program info descriptors are\n\n programInfoLength = (payload[10] & 0x0f) << 8 | payload[11]; // advance the offset to the first entry in the mapping table\n\n offset = 12 + programInfoLength;\n\n while (offset < tableEnd) {\n var streamType = payload[offset];\n var pid = (payload[offset + 1] & 0x1F) << 8 | payload[offset + 2]; // only map a single elementary_pid for audio and video stream types\n // TODO: should this be done for metadata too? for now maintain behavior of\n // multiple metadata streams\n\n if (streamType === streamTypes.H264_STREAM_TYPE && self.programMapTable.video === null) {\n self.programMapTable.video = pid;\n } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self.programMapTable.audio === null) {\n self.programMapTable.audio = pid;\n } else if (streamType === streamTypes.METADATA_STREAM_TYPE) {\n // map pid to stream type for metadata streams\n self.programMapTable['timed-metadata'][pid] = streamType;\n } // move to the next table entry\n // skip past the elementary stream descriptors, if present\n\n\n offset += ((payload[offset + 3] & 0x0F) << 8 | payload[offset + 4]) + 5;\n } // record the map on the packet as well\n\n\n pmt.programMapTable = self.programMapTable;\n };\n /**\n * Deliver a new MP2T packet to the next stream in the pipeline.\n */\n\n\n this.push = function (packet) {\n var result = {},\n offset = 4;\n result.payloadUnitStartIndicator = !!(packet[1] & 0x40); // pid is a 13-bit field starting at the last bit of packet[1]\n\n result.pid = packet[1] & 0x1f;\n result.pid <<= 8;\n result.pid |= packet[2]; // if an adaption field is present, its length is specified by the\n // fifth byte of the TS packet header. The adaptation field is\n // used to add stuffing to PES packets that don't fill a complete\n // TS packet, and to specify some forms of timing and control data\n // that we do not currently use.\n\n if ((packet[3] & 0x30) >>> 4 > 0x01) {\n offset += packet[offset] + 1;\n } // parse the rest of the packet based on the type\n\n\n if (result.pid === 0) {\n result.type = 'pat';\n parsePsi(packet.subarray(offset), result);\n this.trigger('data', result);\n } else if (result.pid === this.pmtPid) {\n result.type = 'pmt';\n parsePsi(packet.subarray(offset), result);\n this.trigger('data', result); // if there are any packets waiting for a PMT to be found, process them now\n\n while (this.packetsWaitingForPmt.length) {\n this.processPes_.apply(this, this.packetsWaitingForPmt.shift());\n }\n } else if (this.programMapTable === undefined) {\n // When we have not seen a PMT yet, defer further processing of\n // PES packets until one has been parsed\n this.packetsWaitingForPmt.push([packet, offset, result]);\n } else {\n this.processPes_(packet, offset, result);\n }\n };\n\n this.processPes_ = function (packet, offset, result) {\n // set the appropriate stream type\n if (result.pid === this.programMapTable.video) {\n result.streamType = streamTypes.H264_STREAM_TYPE;\n } else if (result.pid === this.programMapTable.audio) {\n result.streamType = streamTypes.ADTS_STREAM_TYPE;\n } else {\n // if not video or audio, it is timed-metadata or unknown\n // if unknown, streamType will be undefined\n result.streamType = this.programMapTable['timed-metadata'][result.pid];\n }\n\n result.type = 'pes';\n result.data = packet.subarray(offset);\n this.trigger('data', result);\n };\n };\n\n _TransportParseStream.prototype = new stream();\n _TransportParseStream.STREAM_TYPES = {\n h264: 0x1b,\n adts: 0x0f\n };\n /**\n * Reconsistutes program elementary stream (PES) packets from parsed\n * transport stream packets. That is, if you pipe an\n * mp2t.TransportParseStream into a mp2t.ElementaryStream, the output\n * events will be events which capture the bytes for individual PES\n * packets plus relevant metadata that has been extracted from the\n * container.\n */\n\n _ElementaryStream = function ElementaryStream() {\n var self = this,\n segmentHadPmt = false,\n // PES packet fragments\n video = {\n data: [],\n size: 0\n },\n audio = {\n data: [],\n size: 0\n },\n timedMetadata = {\n data: [],\n size: 0\n },\n programMapTable,\n parsePes = function parsePes(payload, pes) {\n var ptsDtsFlags;\n var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2]; // default to an empty array\n\n pes.data = new Uint8Array(); // In certain live streams, the start of a TS fragment has ts packets\n // that are frame data that is continuing from the previous fragment. This\n // is to check that the pes data is the start of a new pes payload\n\n if (startPrefix !== 1) {\n return;\n } // get the packet length, this will be 0 for video\n\n\n pes.packetLength = 6 + (payload[4] << 8 | payload[5]); // find out if this packets starts a new keyframe\n\n pes.dataAlignmentIndicator = (payload[6] & 0x04) !== 0; // PES packets may be annotated with a PTS value, or a PTS value\n // and a DTS value. Determine what combination of values is\n // available to work with.\n\n ptsDtsFlags = payload[7]; // PTS and DTS are normally stored as a 33-bit number. Javascript\n // performs all bitwise operations on 32-bit integers but javascript\n // supports a much greater range (52-bits) of integer using standard\n // mathematical operations.\n // We construct a 31-bit value using bitwise operators over the 31\n // most significant bits and then multiply by 4 (equal to a left-shift\n // of 2) before we add the final 2 least significant bits of the\n // timestamp (equal to an OR.)\n\n if (ptsDtsFlags & 0xC0) {\n // the PTS and DTS are not written out directly. For information\n // on how they are encoded, see\n // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html\n pes.pts = (payload[9] & 0x0E) << 27 | (payload[10] & 0xFF) << 20 | (payload[11] & 0xFE) << 12 | (payload[12] & 0xFF) << 5 | (payload[13] & 0xFE) >>> 3;\n pes.pts *= 4; // Left shift by 2\n\n pes.pts += (payload[13] & 0x06) >>> 1; // OR by the two LSBs\n\n pes.dts = pes.pts;\n\n if (ptsDtsFlags & 0x40) {\n pes.dts = (payload[14] & 0x0E) << 27 | (payload[15] & 0xFF) << 20 | (payload[16] & 0xFE) << 12 | (payload[17] & 0xFF) << 5 | (payload[18] & 0xFE) >>> 3;\n pes.dts *= 4; // Left shift by 2\n\n pes.dts += (payload[18] & 0x06) >>> 1; // OR by the two LSBs\n }\n } // the data section starts immediately after the PES header.\n // pes_header_data_length specifies the number of header bytes\n // that follow the last byte of the field.\n\n\n pes.data = payload.subarray(9 + payload[8]);\n },\n\n /**\n * Pass completely parsed PES packets to the next stream in the pipeline\n **/\n flushStream = function flushStream(stream, type, forceFlush) {\n var packetData = new Uint8Array(stream.size),\n event = {\n type: type\n },\n i = 0,\n offset = 0,\n packetFlushable = false,\n fragment; // do nothing if there is not enough buffered data for a complete\n // PES header\n\n if (!stream.data.length || stream.size < 9) {\n return;\n }\n\n event.trackId = stream.data[0].pid; // reassemble the packet\n\n for (i = 0; i < stream.data.length; i++) {\n fragment = stream.data[i];\n packetData.set(fragment.data, offset);\n offset += fragment.data.byteLength;\n } // parse assembled packet's PES header\n\n\n parsePes(packetData, event); // non-video PES packets MUST have a non-zero PES_packet_length\n // check that there is enough stream data to fill the packet\n\n packetFlushable = type === 'video' || event.packetLength <= stream.size; // flush pending packets if the conditions are right\n\n if (forceFlush || packetFlushable) {\n stream.size = 0;\n stream.data.length = 0;\n } // only emit packets that are complete. this is to avoid assembling\n // incomplete PES packets due to poor segmentation\n\n\n if (packetFlushable) {\n self.trigger('data', event);\n }\n };\n\n _ElementaryStream.prototype.init.call(this);\n /**\n * Identifies M2TS packet types and parses PES packets using metadata\n * parsed from the PMT\n **/\n\n\n this.push = function (data) {\n ({\n pat: function pat() {// we have to wait for the PMT to arrive as well before we\n // have any meaningful metadata\n },\n pes: function pes() {\n var stream, streamType;\n\n switch (data.streamType) {\n case streamTypes.H264_STREAM_TYPE:\n stream = video;\n streamType = 'video';\n break;\n\n case streamTypes.ADTS_STREAM_TYPE:\n stream = audio;\n streamType = 'audio';\n break;\n\n case streamTypes.METADATA_STREAM_TYPE:\n stream = timedMetadata;\n streamType = 'timed-metadata';\n break;\n\n default:\n // ignore unknown stream types\n return;\n } // if a new packet is starting, we can flush the completed\n // packet\n\n\n if (data.payloadUnitStartIndicator) {\n flushStream(stream, streamType, true);\n } // buffer this fragment until we are sure we've received the\n // complete payload\n\n\n stream.data.push(data);\n stream.size += data.data.byteLength;\n },\n pmt: function pmt() {\n var event = {\n type: 'metadata',\n tracks: []\n };\n programMapTable = data.programMapTable; // translate audio and video streams to tracks\n\n if (programMapTable.video !== null) {\n event.tracks.push({\n timelineStartInfo: {\n baseMediaDecodeTime: 0\n },\n id: +programMapTable.video,\n codec: 'avc',\n type: 'video'\n });\n }\n\n if (programMapTable.audio !== null) {\n event.tracks.push({\n timelineStartInfo: {\n baseMediaDecodeTime: 0\n },\n id: +programMapTable.audio,\n codec: 'adts',\n type: 'audio'\n });\n }\n\n segmentHadPmt = true;\n self.trigger('data', event);\n }\n })[data.type]();\n };\n\n this.reset = function () {\n video.size = 0;\n video.data.length = 0;\n audio.size = 0;\n audio.data.length = 0;\n this.trigger('reset');\n };\n /**\n * Flush any remaining input. Video PES packets may be of variable\n * length. Normally, the start of a new video packet can trigger the\n * finalization of the previous packet. That is not possible if no\n * more video is forthcoming, however. In that case, some other\n * mechanism (like the end of the file) has to be employed. When it is\n * clear that no additional data is forthcoming, calling this method\n * will flush the buffered packets.\n */\n\n\n this.flushStreams_ = function () {\n // !!THIS ORDER IS IMPORTANT!!\n // video first then audio\n flushStream(video, 'video');\n flushStream(audio, 'audio');\n flushStream(timedMetadata, 'timed-metadata');\n };\n\n this.flush = function () {\n // if on flush we haven't had a pmt emitted\n // and we have a pmt to emit. emit the pmt\n // so that we trigger a trackinfo downstream.\n if (!segmentHadPmt && programMapTable) {\n var pmt = {\n type: 'metadata',\n tracks: []\n }; // translate audio and video streams to tracks\n\n if (programMapTable.video !== null) {\n pmt.tracks.push({\n timelineStartInfo: {\n baseMediaDecodeTime: 0\n },\n id: +programMapTable.video,\n codec: 'avc',\n type: 'video'\n });\n }\n\n if (programMapTable.audio !== null) {\n pmt.tracks.push({\n timelineStartInfo: {\n baseMediaDecodeTime: 0\n },\n id: +programMapTable.audio,\n codec: 'adts',\n type: 'audio'\n });\n }\n\n self.trigger('data', pmt);\n }\n\n segmentHadPmt = false;\n this.flushStreams_();\n this.trigger('done');\n };\n };\n\n _ElementaryStream.prototype = new stream();\n var m2ts = {\n PAT_PID: 0x0000,\n MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1,\n TransportPacketStream: _TransportPacketStream,\n TransportParseStream: _TransportParseStream,\n ElementaryStream: _ElementaryStream,\n TimestampRolloverStream: TimestampRolloverStream,\n CaptionStream: captionStream.CaptionStream,\n Cea608Stream: captionStream.Cea608Stream,\n Cea708Stream: captionStream.Cea708Stream,\n MetadataStream: metadataStream\n };\n\n for (var type in streamTypes) {\n if (streamTypes.hasOwnProperty(type)) {\n m2ts[type] = streamTypes[type];\n }\n }\n\n var m2ts_1 = m2ts;\n var ONE_SECOND_IN_TS$2 = clock.ONE_SECOND_IN_TS;\n\n var _AdtsStream;\n\n var ADTS_SAMPLING_FREQUENCIES$1 = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350];\n /*\n * Accepts a ElementaryStream and emits data events with parsed\n * AAC Audio Frames of the individual packets. Input audio in ADTS\n * format is unpacked and re-emitted as AAC frames.\n *\n * @see http://wiki.multimedia.cx/index.php?title=ADTS\n * @see http://wiki.multimedia.cx/?title=Understanding_AAC\n */\n\n _AdtsStream = function AdtsStream(handlePartialSegments) {\n var buffer,\n frameNum = 0;\n\n _AdtsStream.prototype.init.call(this);\n\n this.skipWarn_ = function (start, end) {\n this.trigger('log', {\n level: 'warn',\n message: \"adts skiping bytes \" + start + \" to \" + end + \" in frame \" + frameNum + \" outside syncword\"\n });\n };\n\n this.push = function (packet) {\n var i = 0,\n frameLength,\n protectionSkipBytes,\n oldBuffer,\n sampleCount,\n adtsFrameDuration;\n\n if (!handlePartialSegments) {\n frameNum = 0;\n }\n\n if (packet.type !== 'audio') {\n // ignore non-audio data\n return;\n } // Prepend any data in the buffer to the input data so that we can parse\n // aac frames the cross a PES packet boundary\n\n\n if (buffer && buffer.length) {\n oldBuffer = buffer;\n buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength);\n buffer.set(oldBuffer);\n buffer.set(packet.data, oldBuffer.byteLength);\n } else {\n buffer = packet.data;\n } // unpack any ADTS frames which have been fully received\n // for details on the ADTS header, see http://wiki.multimedia.cx/index.php?title=ADTS\n\n\n var skip; // We use i + 7 here because we want to be able to parse the entire header.\n // If we don't have enough bytes to do that, then we definitely won't have a full frame.\n\n while (i + 7 < buffer.length) {\n // Look for the start of an ADTS header..\n if (buffer[i] !== 0xFF || (buffer[i + 1] & 0xF6) !== 0xF0) {\n if (typeof skip !== 'number') {\n skip = i;\n } // If a valid header was not found, jump one forward and attempt to\n // find a valid ADTS header starting at the next byte\n\n\n i++;\n continue;\n }\n\n if (typeof skip === 'number') {\n this.skipWarn_(skip, i);\n skip = null;\n } // The protection skip bit tells us if we have 2 bytes of CRC data at the\n // end of the ADTS header\n\n\n protectionSkipBytes = (~buffer[i + 1] & 0x01) * 2; // Frame length is a 13 bit integer starting 16 bits from the\n // end of the sync sequence\n // NOTE: frame length includes the size of the header\n\n frameLength = (buffer[i + 3] & 0x03) << 11 | buffer[i + 4] << 3 | (buffer[i + 5] & 0xe0) >> 5;\n sampleCount = ((buffer[i + 6] & 0x03) + 1) * 1024;\n adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2]; // If we don't have enough data to actually finish this ADTS frame,\n // then we have to wait for more data\n\n if (buffer.byteLength - i < frameLength) {\n break;\n } // Otherwise, deliver the complete AAC frame\n\n\n this.trigger('data', {\n pts: packet.pts + frameNum * adtsFrameDuration,\n dts: packet.dts + frameNum * adtsFrameDuration,\n sampleCount: sampleCount,\n audioobjecttype: (buffer[i + 2] >>> 6 & 0x03) + 1,\n channelcount: (buffer[i + 2] & 1) << 2 | (buffer[i + 3] & 0xc0) >>> 6,\n samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i + 2] & 0x3c) >>> 2],\n samplingfrequencyindex: (buffer[i + 2] & 0x3c) >>> 2,\n // assume ISO/IEC 14496-12 AudioSampleEntry default of 16\n samplesize: 16,\n // data is the frame without it's header\n data: buffer.subarray(i + 7 + protectionSkipBytes, i + frameLength)\n });\n frameNum++;\n i += frameLength;\n }\n\n if (typeof skip === 'number') {\n this.skipWarn_(skip, i);\n skip = null;\n } // remove processed bytes from the buffer.\n\n\n buffer = buffer.subarray(i);\n };\n\n this.flush = function () {\n frameNum = 0;\n this.trigger('done');\n };\n\n this.reset = function () {\n buffer = void 0;\n this.trigger('reset');\n };\n\n this.endTimeline = function () {\n buffer = void 0;\n this.trigger('endedtimeline');\n };\n };\n\n _AdtsStream.prototype = new stream();\n var adts = _AdtsStream;\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var ExpGolomb;\n /**\n * Parser for exponential Golomb codes, a variable-bitwidth number encoding\n * scheme used by h264.\n */\n\n ExpGolomb = function ExpGolomb(workingData) {\n var // the number of bytes left to examine in workingData\n workingBytesAvailable = workingData.byteLength,\n // the current word being examined\n workingWord = 0,\n // :uint\n // the number of bits left to examine in the current word\n workingBitsAvailable = 0; // :uint;\n // ():uint\n\n this.length = function () {\n return 8 * workingBytesAvailable;\n }; // ():uint\n\n\n this.bitsAvailable = function () {\n return 8 * workingBytesAvailable + workingBitsAvailable;\n }; // ():void\n\n\n this.loadWord = function () {\n var position = workingData.byteLength - workingBytesAvailable,\n workingBytes = new Uint8Array(4),\n availableBytes = Math.min(4, workingBytesAvailable);\n\n if (availableBytes === 0) {\n throw new Error('no bytes available');\n }\n\n workingBytes.set(workingData.subarray(position, position + availableBytes));\n workingWord = new DataView(workingBytes.buffer).getUint32(0); // track the amount of workingData that has been processed\n\n workingBitsAvailable = availableBytes * 8;\n workingBytesAvailable -= availableBytes;\n }; // (count:int):void\n\n\n this.skipBits = function (count) {\n var skipBytes; // :int\n\n if (workingBitsAvailable > count) {\n workingWord <<= count;\n workingBitsAvailable -= count;\n } else {\n count -= workingBitsAvailable;\n skipBytes = Math.floor(count / 8);\n count -= skipBytes * 8;\n workingBytesAvailable -= skipBytes;\n this.loadWord();\n workingWord <<= count;\n workingBitsAvailable -= count;\n }\n }; // (size:int):uint\n\n\n this.readBits = function (size) {\n var bits = Math.min(workingBitsAvailable, size),\n // :uint\n valu = workingWord >>> 32 - bits; // :uint\n // if size > 31, handle error\n\n workingBitsAvailable -= bits;\n\n if (workingBitsAvailable > 0) {\n workingWord <<= bits;\n } else if (workingBytesAvailable > 0) {\n this.loadWord();\n }\n\n bits = size - bits;\n\n if (bits > 0) {\n return valu << bits | this.readBits(bits);\n }\n\n return valu;\n }; // ():uint\n\n\n this.skipLeadingZeros = function () {\n var leadingZeroCount; // :uint\n\n for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) {\n if ((workingWord & 0x80000000 >>> leadingZeroCount) !== 0) {\n // the first bit of working word is 1\n workingWord <<= leadingZeroCount;\n workingBitsAvailable -= leadingZeroCount;\n return leadingZeroCount;\n }\n } // we exhausted workingWord and still have not found a 1\n\n\n this.loadWord();\n return leadingZeroCount + this.skipLeadingZeros();\n }; // ():void\n\n\n this.skipUnsignedExpGolomb = function () {\n this.skipBits(1 + this.skipLeadingZeros());\n }; // ():void\n\n\n this.skipExpGolomb = function () {\n this.skipBits(1 + this.skipLeadingZeros());\n }; // ():uint\n\n\n this.readUnsignedExpGolomb = function () {\n var clz = this.skipLeadingZeros(); // :uint\n\n return this.readBits(clz + 1) - 1;\n }; // ():int\n\n\n this.readExpGolomb = function () {\n var valu = this.readUnsignedExpGolomb(); // :int\n\n if (0x01 & valu) {\n // the number is odd if the low order bit is set\n return 1 + valu >>> 1; // add 1 to make it even, and divide by 2\n }\n\n return -1 * (valu >>> 1); // divide by two then make it negative\n }; // Some convenience functions\n // :Boolean\n\n\n this.readBoolean = function () {\n return this.readBits(1) === 1;\n }; // ():int\n\n\n this.readUnsignedByte = function () {\n return this.readBits(8);\n };\n\n this.loadWord();\n };\n\n var expGolomb = ExpGolomb;\n\n var _H264Stream, _NalByteStream;\n\n var PROFILES_WITH_OPTIONAL_SPS_DATA;\n /**\n * Accepts a NAL unit byte stream and unpacks the embedded NAL units.\n */\n\n _NalByteStream = function NalByteStream() {\n var syncPoint = 0,\n i,\n buffer;\n\n _NalByteStream.prototype.init.call(this);\n /*\n * Scans a byte stream and triggers a data event with the NAL units found.\n * @param {Object} data Event received from H264Stream\n * @param {Uint8Array} data.data The h264 byte stream to be scanned\n *\n * @see H264Stream.push\n */\n\n\n this.push = function (data) {\n var swapBuffer;\n\n if (!buffer) {\n buffer = data.data;\n } else {\n swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength);\n swapBuffer.set(buffer);\n swapBuffer.set(data.data, buffer.byteLength);\n buffer = swapBuffer;\n }\n\n var len = buffer.byteLength; // Rec. ITU-T H.264, Annex B\n // scan for NAL unit boundaries\n // a match looks like this:\n // 0 0 1 .. NAL .. 0 0 1\n // ^ sync point ^ i\n // or this:\n // 0 0 1 .. NAL .. 0 0 0\n // ^ sync point ^ i\n // advance the sync point to a NAL start, if necessary\n\n for (; syncPoint < len - 3; syncPoint++) {\n if (buffer[syncPoint + 2] === 1) {\n // the sync point is properly aligned\n i = syncPoint + 5;\n break;\n }\n }\n\n while (i < len) {\n // look at the current byte to determine if we've hit the end of\n // a NAL unit boundary\n switch (buffer[i]) {\n case 0:\n // skip past non-sync sequences\n if (buffer[i - 1] !== 0) {\n i += 2;\n break;\n } else if (buffer[i - 2] !== 0) {\n i++;\n break;\n } // deliver the NAL unit if it isn't empty\n\n\n if (syncPoint + 3 !== i - 2) {\n this.trigger('data', buffer.subarray(syncPoint + 3, i - 2));\n } // drop trailing zeroes\n\n\n do {\n i++;\n } while (buffer[i] !== 1 && i < len);\n\n syncPoint = i - 2;\n i += 3;\n break;\n\n case 1:\n // skip past non-sync sequences\n if (buffer[i - 1] !== 0 || buffer[i - 2] !== 0) {\n i += 3;\n break;\n } // deliver the NAL unit\n\n\n this.trigger('data', buffer.subarray(syncPoint + 3, i - 2));\n syncPoint = i - 2;\n i += 3;\n break;\n\n default:\n // the current byte isn't a one or zero, so it cannot be part\n // of a sync sequence\n i += 3;\n break;\n }\n } // filter out the NAL units that were delivered\n\n\n buffer = buffer.subarray(syncPoint);\n i -= syncPoint;\n syncPoint = 0;\n };\n\n this.reset = function () {\n buffer = null;\n syncPoint = 0;\n this.trigger('reset');\n };\n\n this.flush = function () {\n // deliver the last buffered NAL unit\n if (buffer && buffer.byteLength > 3) {\n this.trigger('data', buffer.subarray(syncPoint + 3));\n } // reset the stream state\n\n\n buffer = null;\n syncPoint = 0;\n this.trigger('done');\n };\n\n this.endTimeline = function () {\n this.flush();\n this.trigger('endedtimeline');\n };\n };\n\n _NalByteStream.prototype = new stream(); // values of profile_idc that indicate additional fields are included in the SPS\n // see Recommendation ITU-T H.264 (4/2013),\n // 7.3.2.1.1 Sequence parameter set data syntax\n\n PROFILES_WITH_OPTIONAL_SPS_DATA = {\n 100: true,\n 110: true,\n 122: true,\n 244: true,\n 44: true,\n 83: true,\n 86: true,\n 118: true,\n 128: true,\n // TODO: the three profiles below don't\n // appear to have sps data in the specificiation anymore?\n 138: true,\n 139: true,\n 134: true\n };\n /**\n * Accepts input from a ElementaryStream and produces H.264 NAL unit data\n * events.\n */\n\n _H264Stream = function H264Stream() {\n var nalByteStream = new _NalByteStream(),\n self,\n trackId,\n currentPts,\n currentDts,\n discardEmulationPreventionBytes,\n readSequenceParameterSet,\n skipScalingList;\n\n _H264Stream.prototype.init.call(this);\n\n self = this;\n /*\n * Pushes a packet from a stream onto the NalByteStream\n *\n * @param {Object} packet - A packet received from a stream\n * @param {Uint8Array} packet.data - The raw bytes of the packet\n * @param {Number} packet.dts - Decode timestamp of the packet\n * @param {Number} packet.pts - Presentation timestamp of the packet\n * @param {Number} packet.trackId - The id of the h264 track this packet came from\n * @param {('video'|'audio')} packet.type - The type of packet\n *\n */\n\n this.push = function (packet) {\n if (packet.type !== 'video') {\n return;\n }\n\n trackId = packet.trackId;\n currentPts = packet.pts;\n currentDts = packet.dts;\n nalByteStream.push(packet);\n };\n /*\n * Identify NAL unit types and pass on the NALU, trackId, presentation and decode timestamps\n * for the NALUs to the next stream component.\n * Also, preprocess caption and sequence parameter NALUs.\n *\n * @param {Uint8Array} data - A NAL unit identified by `NalByteStream.push`\n * @see NalByteStream.push\n */\n\n\n nalByteStream.on('data', function (data) {\n var event = {\n trackId: trackId,\n pts: currentPts,\n dts: currentDts,\n data: data,\n nalUnitTypeCode: data[0] & 0x1f\n };\n\n switch (event.nalUnitTypeCode) {\n case 0x05:\n event.nalUnitType = 'slice_layer_without_partitioning_rbsp_idr';\n break;\n\n case 0x06:\n event.nalUnitType = 'sei_rbsp';\n event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1));\n break;\n\n case 0x07:\n event.nalUnitType = 'seq_parameter_set_rbsp';\n event.escapedRBSP = discardEmulationPreventionBytes(data.subarray(1));\n event.config = readSequenceParameterSet(event.escapedRBSP);\n break;\n\n case 0x08:\n event.nalUnitType = 'pic_parameter_set_rbsp';\n break;\n\n case 0x09:\n event.nalUnitType = 'access_unit_delimiter_rbsp';\n break;\n } // This triggers data on the H264Stream\n\n\n self.trigger('data', event);\n });\n nalByteStream.on('done', function () {\n self.trigger('done');\n });\n nalByteStream.on('partialdone', function () {\n self.trigger('partialdone');\n });\n nalByteStream.on('reset', function () {\n self.trigger('reset');\n });\n nalByteStream.on('endedtimeline', function () {\n self.trigger('endedtimeline');\n });\n\n this.flush = function () {\n nalByteStream.flush();\n };\n\n this.partialFlush = function () {\n nalByteStream.partialFlush();\n };\n\n this.reset = function () {\n nalByteStream.reset();\n };\n\n this.endTimeline = function () {\n nalByteStream.endTimeline();\n };\n /**\n * Advance the ExpGolomb decoder past a scaling list. The scaling\n * list is optionally transmitted as part of a sequence parameter\n * set and is not relevant to transmuxing.\n * @param count {number} the number of entries in this scaling list\n * @param expGolombDecoder {object} an ExpGolomb pointed to the\n * start of a scaling list\n * @see Recommendation ITU-T H.264, Section 7.3.2.1.1.1\n */\n\n\n skipScalingList = function skipScalingList(count, expGolombDecoder) {\n var lastScale = 8,\n nextScale = 8,\n j,\n deltaScale;\n\n for (j = 0; j < count; j++) {\n if (nextScale !== 0) {\n deltaScale = expGolombDecoder.readExpGolomb();\n nextScale = (lastScale + deltaScale + 256) % 256;\n }\n\n lastScale = nextScale === 0 ? lastScale : nextScale;\n }\n };\n /**\n * Expunge any \"Emulation Prevention\" bytes from a \"Raw Byte\n * Sequence Payload\"\n * @param data {Uint8Array} the bytes of a RBSP from a NAL\n * unit\n * @return {Uint8Array} the RBSP without any Emulation\n * Prevention Bytes\n */\n\n\n discardEmulationPreventionBytes = function discardEmulationPreventionBytes(data) {\n var length = data.byteLength,\n emulationPreventionBytesPositions = [],\n i = 1,\n newLength,\n newData; // Find all `Emulation Prevention Bytes`\n\n while (i < length - 2) {\n if (data[i] === 0 && data[i + 1] === 0 && data[i + 2] === 0x03) {\n emulationPreventionBytesPositions.push(i + 2);\n i += 2;\n } else {\n i++;\n }\n } // If no Emulation Prevention Bytes were found just return the original\n // array\n\n\n if (emulationPreventionBytesPositions.length === 0) {\n return data;\n } // Create a new array to hold the NAL unit data\n\n\n newLength = length - emulationPreventionBytesPositions.length;\n newData = new Uint8Array(newLength);\n var sourceIndex = 0;\n\n for (i = 0; i < newLength; sourceIndex++, i++) {\n if (sourceIndex === emulationPreventionBytesPositions[0]) {\n // Skip this byte\n sourceIndex++; // Remove this position index\n\n emulationPreventionBytesPositions.shift();\n }\n\n newData[i] = data[sourceIndex];\n }\n\n return newData;\n };\n /**\n * Read a sequence parameter set and return some interesting video\n * properties. A sequence parameter set is the H264 metadata that\n * describes the properties of upcoming video frames.\n * @param data {Uint8Array} the bytes of a sequence parameter set\n * @return {object} an object with configuration parsed from the\n * sequence parameter set, including the dimensions of the\n * associated video frames.\n */\n\n\n readSequenceParameterSet = function readSequenceParameterSet(data) {\n var frameCropLeftOffset = 0,\n frameCropRightOffset = 0,\n frameCropTopOffset = 0,\n frameCropBottomOffset = 0,\n expGolombDecoder,\n profileIdc,\n levelIdc,\n profileCompatibility,\n chromaFormatIdc,\n picOrderCntType,\n numRefFramesInPicOrderCntCycle,\n picWidthInMbsMinus1,\n picHeightInMapUnitsMinus1,\n frameMbsOnlyFlag,\n scalingListCount,\n sarRatio = [1, 1],\n aspectRatioIdc,\n i;\n expGolombDecoder = new expGolomb(data);\n profileIdc = expGolombDecoder.readUnsignedByte(); // profile_idc\n\n profileCompatibility = expGolombDecoder.readUnsignedByte(); // constraint_set[0-5]_flag\n\n levelIdc = expGolombDecoder.readUnsignedByte(); // level_idc u(8)\n\n expGolombDecoder.skipUnsignedExpGolomb(); // seq_parameter_set_id\n // some profiles have more optional data we don't need\n\n if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) {\n chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb();\n\n if (chromaFormatIdc === 3) {\n expGolombDecoder.skipBits(1); // separate_colour_plane_flag\n }\n\n expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_luma_minus8\n\n expGolombDecoder.skipUnsignedExpGolomb(); // bit_depth_chroma_minus8\n\n expGolombDecoder.skipBits(1); // qpprime_y_zero_transform_bypass_flag\n\n if (expGolombDecoder.readBoolean()) {\n // seq_scaling_matrix_present_flag\n scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;\n\n for (i = 0; i < scalingListCount; i++) {\n if (expGolombDecoder.readBoolean()) {\n // seq_scaling_list_present_flag[ i ]\n if (i < 6) {\n skipScalingList(16, expGolombDecoder);\n } else {\n skipScalingList(64, expGolombDecoder);\n }\n }\n }\n }\n }\n\n expGolombDecoder.skipUnsignedExpGolomb(); // log2_max_frame_num_minus4\n\n picOrderCntType = expGolombDecoder.readUnsignedExpGolomb();\n\n if (picOrderCntType === 0) {\n expGolombDecoder.readUnsignedExpGolomb(); // log2_max_pic_order_cnt_lsb_minus4\n } else if (picOrderCntType === 1) {\n expGolombDecoder.skipBits(1); // delta_pic_order_always_zero_flag\n\n expGolombDecoder.skipExpGolomb(); // offset_for_non_ref_pic\n\n expGolombDecoder.skipExpGolomb(); // offset_for_top_to_bottom_field\n\n numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb();\n\n for (i = 0; i < numRefFramesInPicOrderCntCycle; i++) {\n expGolombDecoder.skipExpGolomb(); // offset_for_ref_frame[ i ]\n }\n }\n\n expGolombDecoder.skipUnsignedExpGolomb(); // max_num_ref_frames\n\n expGolombDecoder.skipBits(1); // gaps_in_frame_num_value_allowed_flag\n\n picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb();\n picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb();\n frameMbsOnlyFlag = expGolombDecoder.readBits(1);\n\n if (frameMbsOnlyFlag === 0) {\n expGolombDecoder.skipBits(1); // mb_adaptive_frame_field_flag\n }\n\n expGolombDecoder.skipBits(1); // direct_8x8_inference_flag\n\n if (expGolombDecoder.readBoolean()) {\n // frame_cropping_flag\n frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb();\n frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb();\n frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb();\n frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb();\n }\n\n if (expGolombDecoder.readBoolean()) {\n // vui_parameters_present_flag\n if (expGolombDecoder.readBoolean()) {\n // aspect_ratio_info_present_flag\n aspectRatioIdc = expGolombDecoder.readUnsignedByte();\n\n switch (aspectRatioIdc) {\n case 1:\n sarRatio = [1, 1];\n break;\n\n case 2:\n sarRatio = [12, 11];\n break;\n\n case 3:\n sarRatio = [10, 11];\n break;\n\n case 4:\n sarRatio = [16, 11];\n break;\n\n case 5:\n sarRatio = [40, 33];\n break;\n\n case 6:\n sarRatio = [24, 11];\n break;\n\n case 7:\n sarRatio = [20, 11];\n break;\n\n case 8:\n sarRatio = [32, 11];\n break;\n\n case 9:\n sarRatio = [80, 33];\n break;\n\n case 10:\n sarRatio = [18, 11];\n break;\n\n case 11:\n sarRatio = [15, 11];\n break;\n\n case 12:\n sarRatio = [64, 33];\n break;\n\n case 13:\n sarRatio = [160, 99];\n break;\n\n case 14:\n sarRatio = [4, 3];\n break;\n\n case 15:\n sarRatio = [3, 2];\n break;\n\n case 16:\n sarRatio = [2, 1];\n break;\n\n case 255:\n {\n sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()];\n break;\n }\n }\n\n if (sarRatio) {\n sarRatio[0] / sarRatio[1];\n }\n }\n }\n\n return {\n profileIdc: profileIdc,\n levelIdc: levelIdc,\n profileCompatibility: profileCompatibility,\n width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2,\n height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2,\n // sar is sample aspect ratio\n sarRatio: sarRatio\n };\n };\n };\n\n _H264Stream.prototype = new stream();\n var h264 = {\n H264Stream: _H264Stream,\n NalByteStream: _NalByteStream\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n *\n * Utilities to detect basic properties and metadata about Aac data.\n */\n\n var ADTS_SAMPLING_FREQUENCIES = [96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350];\n\n var parseId3TagSize = function parseId3TagSize(header, byteIndex) {\n var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9],\n flags = header[byteIndex + 5],\n footerPresent = (flags & 16) >> 4; // if we get a negative returnSize clamp it to 0\n\n returnSize = returnSize >= 0 ? returnSize : 0;\n\n if (footerPresent) {\n return returnSize + 20;\n }\n\n return returnSize + 10;\n };\n\n var getId3Offset = function getId3Offset(data, offset) {\n if (data.length - offset < 10 || data[offset] !== 'I'.charCodeAt(0) || data[offset + 1] !== 'D'.charCodeAt(0) || data[offset + 2] !== '3'.charCodeAt(0)) {\n return offset;\n }\n\n offset += parseId3TagSize(data, offset);\n return getId3Offset(data, offset);\n }; // TODO: use vhs-utils\n\n\n var isLikelyAacData$1 = function isLikelyAacData(data) {\n var offset = getId3Offset(data, 0);\n return data.length >= offset + 2 && (data[offset] & 0xFF) === 0xFF && (data[offset + 1] & 0xF0) === 0xF0 && // verify that the 2 layer bits are 0, aka this\n // is not mp3 data but aac data.\n (data[offset + 1] & 0x16) === 0x10;\n };\n\n var parseSyncSafeInteger = function parseSyncSafeInteger(data) {\n return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];\n }; // return a percent-encoded representation of the specified byte range\n // @see http://en.wikipedia.org/wiki/Percent-encoding\n\n\n var percentEncode = function percentEncode(bytes, start, end) {\n var i,\n result = '';\n\n for (i = start; i < end; i++) {\n result += '%' + ('00' + bytes[i].toString(16)).slice(-2);\n }\n\n return result;\n }; // return the string representation of the specified byte range,\n // interpreted as ISO-8859-1.\n\n\n var parseIso88591 = function parseIso88591(bytes, start, end) {\n return unescape(percentEncode(bytes, start, end)); // jshint ignore:line\n };\n\n var parseAdtsSize = function parseAdtsSize(header, byteIndex) {\n var lowThree = (header[byteIndex + 5] & 0xE0) >> 5,\n middle = header[byteIndex + 4] << 3,\n highTwo = header[byteIndex + 3] & 0x3 << 11;\n return highTwo | middle | lowThree;\n };\n\n var parseType$2 = function parseType(header, byteIndex) {\n if (header[byteIndex] === 'I'.charCodeAt(0) && header[byteIndex + 1] === 'D'.charCodeAt(0) && header[byteIndex + 2] === '3'.charCodeAt(0)) {\n return 'timed-metadata';\n } else if (header[byteIndex] & 0xff === 0xff && (header[byteIndex + 1] & 0xf0) === 0xf0) {\n return 'audio';\n }\n\n return null;\n };\n\n var parseSampleRate = function parseSampleRate(packet) {\n var i = 0;\n\n while (i + 5 < packet.length) {\n if (packet[i] !== 0xFF || (packet[i + 1] & 0xF6) !== 0xF0) {\n // If a valid header was not found, jump one forward and attempt to\n // find a valid ADTS header starting at the next byte\n i++;\n continue;\n }\n\n return ADTS_SAMPLING_FREQUENCIES[(packet[i + 2] & 0x3c) >>> 2];\n }\n\n return null;\n };\n\n var parseAacTimestamp = function parseAacTimestamp(packet) {\n var frameStart, frameSize, frame, frameHeader; // find the start of the first frame and the end of the tag\n\n frameStart = 10;\n\n if (packet[5] & 0x40) {\n // advance the frame start past the extended header\n frameStart += 4; // header size field\n\n frameStart += parseSyncSafeInteger(packet.subarray(10, 14));\n } // parse one or more ID3 frames\n // http://id3.org/id3v2.3.0#ID3v2_frame_overview\n\n\n do {\n // determine the number of bytes in this frame\n frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8));\n\n if (frameSize < 1) {\n return null;\n }\n\n frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]);\n\n if (frameHeader === 'PRIV') {\n frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10);\n\n for (var i = 0; i < frame.byteLength; i++) {\n if (frame[i] === 0) {\n var owner = parseIso88591(frame, 0, i);\n\n if (owner === 'com.apple.streaming.transportStreamTimestamp') {\n var d = frame.subarray(i + 1);\n var size = (d[3] & 0x01) << 30 | d[4] << 22 | d[5] << 14 | d[6] << 6 | d[7] >>> 2;\n size *= 4;\n size += d[7] & 0x03;\n return size;\n }\n\n break;\n }\n }\n }\n\n frameStart += 10; // advance past the frame header\n\n frameStart += frameSize; // advance past the frame body\n } while (frameStart < packet.byteLength);\n\n return null;\n };\n\n var utils = {\n isLikelyAacData: isLikelyAacData$1,\n parseId3TagSize: parseId3TagSize,\n parseAdtsSize: parseAdtsSize,\n parseType: parseType$2,\n parseSampleRate: parseSampleRate,\n parseAacTimestamp: parseAacTimestamp\n };\n\n var _AacStream;\n /**\n * Splits an incoming stream of binary data into ADTS and ID3 Frames.\n */\n\n\n _AacStream = function AacStream() {\n var everything = new Uint8Array(),\n timeStamp = 0;\n\n _AacStream.prototype.init.call(this);\n\n this.setTimestamp = function (timestamp) {\n timeStamp = timestamp;\n };\n\n this.push = function (bytes) {\n var frameSize = 0,\n byteIndex = 0,\n bytesLeft,\n chunk,\n packet,\n tempLength; // If there are bytes remaining from the last segment, prepend them to the\n // bytes that were pushed in\n\n if (everything.length) {\n tempLength = everything.length;\n everything = new Uint8Array(bytes.byteLength + tempLength);\n everything.set(everything.subarray(0, tempLength));\n everything.set(bytes, tempLength);\n } else {\n everything = bytes;\n }\n\n while (everything.length - byteIndex >= 3) {\n if (everything[byteIndex] === 'I'.charCodeAt(0) && everything[byteIndex + 1] === 'D'.charCodeAt(0) && everything[byteIndex + 2] === '3'.charCodeAt(0)) {\n // Exit early because we don't have enough to parse\n // the ID3 tag header\n if (everything.length - byteIndex < 10) {\n break;\n } // check framesize\n\n\n frameSize = utils.parseId3TagSize(everything, byteIndex); // Exit early if we don't have enough in the buffer\n // to emit a full packet\n // Add to byteIndex to support multiple ID3 tags in sequence\n\n if (byteIndex + frameSize > everything.length) {\n break;\n }\n\n chunk = {\n type: 'timed-metadata',\n data: everything.subarray(byteIndex, byteIndex + frameSize)\n };\n this.trigger('data', chunk);\n byteIndex += frameSize;\n continue;\n } else if ((everything[byteIndex] & 0xff) === 0xff && (everything[byteIndex + 1] & 0xf0) === 0xf0) {\n // Exit early because we don't have enough to parse\n // the ADTS frame header\n if (everything.length - byteIndex < 7) {\n break;\n }\n\n frameSize = utils.parseAdtsSize(everything, byteIndex); // Exit early if we don't have enough in the buffer\n // to emit a full packet\n\n if (byteIndex + frameSize > everything.length) {\n break;\n }\n\n packet = {\n type: 'audio',\n data: everything.subarray(byteIndex, byteIndex + frameSize),\n pts: timeStamp,\n dts: timeStamp\n };\n this.trigger('data', packet);\n byteIndex += frameSize;\n continue;\n }\n\n byteIndex++;\n }\n\n bytesLeft = everything.length - byteIndex;\n\n if (bytesLeft > 0) {\n everything = everything.subarray(byteIndex);\n } else {\n everything = new Uint8Array();\n }\n };\n\n this.reset = function () {\n everything = new Uint8Array();\n this.trigger('reset');\n };\n\n this.endTimeline = function () {\n everything = new Uint8Array();\n this.trigger('endedtimeline');\n };\n };\n\n _AacStream.prototype = new stream();\n var aac = _AacStream; // constants\n\n var AUDIO_PROPERTIES = ['audioobjecttype', 'channelcount', 'samplerate', 'samplingfrequencyindex', 'samplesize'];\n var audioProperties = AUDIO_PROPERTIES;\n var VIDEO_PROPERTIES = ['width', 'height', 'profileIdc', 'levelIdc', 'profileCompatibility', 'sarRatio'];\n var videoProperties = VIDEO_PROPERTIES;\n var H264Stream = h264.H264Stream;\n var isLikelyAacData = utils.isLikelyAacData;\n var ONE_SECOND_IN_TS$1 = clock.ONE_SECOND_IN_TS; // object types\n\n var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream;\n\n var retriggerForStream = function retriggerForStream(key, event) {\n event.stream = key;\n this.trigger('log', event);\n };\n\n var addPipelineLogRetriggers = function addPipelineLogRetriggers(transmuxer, pipeline) {\n var keys = Object.keys(pipeline);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i]; // skip non-stream keys and headOfPipeline\n // which is just a duplicate\n\n if (key === 'headOfPipeline' || !pipeline[key].on) {\n continue;\n }\n\n pipeline[key].on('log', retriggerForStream.bind(transmuxer, key));\n }\n };\n /**\n * Compare two arrays (even typed) for same-ness\n */\n\n\n var arrayEquals = function arrayEquals(a, b) {\n var i;\n\n if (a.length !== b.length) {\n return false;\n } // compare the value of each element in the array\n\n\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n\n return true;\n };\n\n var generateSegmentTimingInfo = function generateSegmentTimingInfo(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) {\n var ptsOffsetFromDts = startPts - startDts,\n decodeDuration = endDts - startDts,\n presentationDuration = endPts - startPts; // The PTS and DTS values are based on the actual stream times from the segment,\n // however, the player time values will reflect a start from the baseMediaDecodeTime.\n // In order to provide relevant values for the player times, base timing info on the\n // baseMediaDecodeTime and the DTS and PTS durations of the segment.\n\n return {\n start: {\n dts: baseMediaDecodeTime,\n pts: baseMediaDecodeTime + ptsOffsetFromDts\n },\n end: {\n dts: baseMediaDecodeTime + decodeDuration,\n pts: baseMediaDecodeTime + presentationDuration\n },\n prependedContentDuration: prependedContentDuration,\n baseMediaDecodeTime: baseMediaDecodeTime\n };\n };\n /**\n * Constructs a single-track, ISO BMFF media segment from AAC data\n * events. The output of this stream can be fed to a SourceBuffer\n * configured with a suitable initialization segment.\n * @param track {object} track metadata configuration\n * @param options {object} transmuxer options object\n * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps\n * in the source; false to adjust the first segment to start at 0.\n */\n\n\n _AudioSegmentStream = function AudioSegmentStream(track, options) {\n var adtsFrames = [],\n sequenceNumber,\n earliestAllowedDts = 0,\n audioAppendStartTs = 0,\n videoBaseMediaDecodeTime = Infinity;\n options = options || {};\n sequenceNumber = options.firstSequenceNumber || 0;\n\n _AudioSegmentStream.prototype.init.call(this);\n\n this.push = function (data) {\n trackDecodeInfo.collectDtsInfo(track, data);\n\n if (track) {\n audioProperties.forEach(function (prop) {\n track[prop] = data[prop];\n });\n } // buffer audio data until end() is called\n\n\n adtsFrames.push(data);\n };\n\n this.setEarliestDts = function (earliestDts) {\n earliestAllowedDts = earliestDts;\n };\n\n this.setVideoBaseMediaDecodeTime = function (baseMediaDecodeTime) {\n videoBaseMediaDecodeTime = baseMediaDecodeTime;\n };\n\n this.setAudioAppendStart = function (timestamp) {\n audioAppendStartTs = timestamp;\n };\n\n this.flush = function () {\n var frames, moof, mdat, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed; // return early if no audio data has been observed\n\n if (adtsFrames.length === 0) {\n this.trigger('done', 'AudioSegmentStream');\n return;\n }\n\n frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts);\n track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps); // amount of audio filled but the value is in video clock rather than audio clock\n\n videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime); // we have to build the index from byte locations to\n // samples (that is, adts frames) in the audio data\n\n track.samples = audioFrameUtils.generateSampleTable(frames); // concatenate the audio data to constuct the mdat\n\n mdat = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames));\n adtsFrames = [];\n moof = mp4Generator.moof(sequenceNumber, [track]);\n boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // bump the sequence number for next time\n\n sequenceNumber++;\n boxes.set(moof);\n boxes.set(mdat, moof.byteLength);\n trackDecodeInfo.clearDtsInfo(track);\n frameDuration = Math.ceil(ONE_SECOND_IN_TS$1 * 1024 / track.samplerate); // TODO this check was added to maintain backwards compatibility (particularly with\n // tests) on adding the timingInfo event. However, it seems unlikely that there's a\n // valid use-case where an init segment/data should be triggered without associated\n // frames. Leaving for now, but should be looked into.\n\n if (frames.length) {\n segmentDuration = frames.length * frameDuration;\n this.trigger('segmentTimingInfo', generateSegmentTimingInfo( // The audio track's baseMediaDecodeTime is in audio clock cycles, but the\n // frame info is in video clock cycles. Convert to match expectation of\n // listeners (that all timestamps will be based on video clock cycles).\n clock.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate), // frame times are already in video clock, as is segment duration\n frames[0].dts, frames[0].pts, frames[0].dts + segmentDuration, frames[0].pts + segmentDuration, videoClockCyclesOfSilencePrefixed || 0));\n this.trigger('timingInfo', {\n start: frames[0].pts,\n end: frames[0].pts + segmentDuration\n });\n }\n\n this.trigger('data', {\n track: track,\n boxes: boxes\n });\n this.trigger('done', 'AudioSegmentStream');\n };\n\n this.reset = function () {\n trackDecodeInfo.clearDtsInfo(track);\n adtsFrames = [];\n this.trigger('reset');\n };\n };\n\n _AudioSegmentStream.prototype = new stream();\n /**\n * Constructs a single-track, ISO BMFF media segment from H264 data\n * events. The output of this stream can be fed to a SourceBuffer\n * configured with a suitable initialization segment.\n * @param track {object} track metadata configuration\n * @param options {object} transmuxer options object\n * @param options.alignGopsAtEnd {boolean} If true, start from the end of the\n * gopsToAlignWith list when attempting to align gop pts\n * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps\n * in the source; false to adjust the first segment to start at 0.\n */\n\n _VideoSegmentStream = function VideoSegmentStream(track, options) {\n var sequenceNumber,\n nalUnits = [],\n gopsToAlignWith = [],\n config,\n pps;\n options = options || {};\n sequenceNumber = options.firstSequenceNumber || 0;\n\n _VideoSegmentStream.prototype.init.call(this);\n\n delete track.minPTS;\n this.gopCache_ = [];\n /**\n * Constructs a ISO BMFF segment given H264 nalUnits\n * @param {Object} nalUnit A data event representing a nalUnit\n * @param {String} nalUnit.nalUnitType\n * @param {Object} nalUnit.config Properties for a mp4 track\n * @param {Uint8Array} nalUnit.data The nalUnit bytes\n * @see lib/codecs/h264.js\n **/\n\n this.push = function (nalUnit) {\n trackDecodeInfo.collectDtsInfo(track, nalUnit); // record the track config\n\n if (nalUnit.nalUnitType === 'seq_parameter_set_rbsp' && !config) {\n config = nalUnit.config;\n track.sps = [nalUnit.data];\n videoProperties.forEach(function (prop) {\n track[prop] = config[prop];\n }, this);\n }\n\n if (nalUnit.nalUnitType === 'pic_parameter_set_rbsp' && !pps) {\n pps = nalUnit.data;\n track.pps = [nalUnit.data];\n } // buffer video until flush() is called\n\n\n nalUnits.push(nalUnit);\n };\n /**\n * Pass constructed ISO BMFF track and boxes on to the\n * next stream in the pipeline\n **/\n\n\n this.flush = function () {\n var frames,\n gopForFusion,\n gops,\n moof,\n mdat,\n boxes,\n prependedContentDuration = 0,\n firstGop,\n lastGop; // Throw away nalUnits at the start of the byte stream until\n // we find the first AUD\n\n while (nalUnits.length) {\n if (nalUnits[0].nalUnitType === 'access_unit_delimiter_rbsp') {\n break;\n }\n\n nalUnits.shift();\n } // Return early if no video data has been observed\n\n\n if (nalUnits.length === 0) {\n this.resetStream_();\n this.trigger('done', 'VideoSegmentStream');\n return;\n } // Organize the raw nal-units into arrays that represent\n // higher-level constructs such as frames and gops\n // (group-of-pictures)\n\n\n frames = frameUtils.groupNalsIntoFrames(nalUnits);\n gops = frameUtils.groupFramesIntoGops(frames); // If the first frame of this fragment is not a keyframe we have\n // a problem since MSE (on Chrome) requires a leading keyframe.\n //\n // We have two approaches to repairing this situation:\n // 1) GOP-FUSION:\n // This is where we keep track of the GOPS (group-of-pictures)\n // from previous fragments and attempt to find one that we can\n // prepend to the current fragment in order to create a valid\n // fragment.\n // 2) KEYFRAME-PULLING:\n // Here we search for the first keyframe in the fragment and\n // throw away all the frames between the start of the fragment\n // and that keyframe. We then extend the duration and pull the\n // PTS of the keyframe forward so that it covers the time range\n // of the frames that were disposed of.\n //\n // #1 is far prefereable over #2 which can cause \"stuttering\" but\n // requires more things to be just right.\n\n if (!gops[0][0].keyFrame) {\n // Search for a gop for fusion from our gopCache\n gopForFusion = this.getGopForFusion_(nalUnits[0], track);\n\n if (gopForFusion) {\n // in order to provide more accurate timing information about the segment, save\n // the number of seconds prepended to the original segment due to GOP fusion\n prependedContentDuration = gopForFusion.duration;\n gops.unshift(gopForFusion); // Adjust Gops' metadata to account for the inclusion of the\n // new gop at the beginning\n\n gops.byteLength += gopForFusion.byteLength;\n gops.nalCount += gopForFusion.nalCount;\n gops.pts = gopForFusion.pts;\n gops.dts = gopForFusion.dts;\n gops.duration += gopForFusion.duration;\n } else {\n // If we didn't find a candidate gop fall back to keyframe-pulling\n gops = frameUtils.extendFirstKeyFrame(gops);\n }\n } // Trim gops to align with gopsToAlignWith\n\n\n if (gopsToAlignWith.length) {\n var alignedGops;\n\n if (options.alignGopsAtEnd) {\n alignedGops = this.alignGopsAtEnd_(gops);\n } else {\n alignedGops = this.alignGopsAtStart_(gops);\n }\n\n if (!alignedGops) {\n // save all the nals in the last GOP into the gop cache\n this.gopCache_.unshift({\n gop: gops.pop(),\n pps: track.pps,\n sps: track.sps\n }); // Keep a maximum of 6 GOPs in the cache\n\n this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits\n\n nalUnits = []; // return early no gops can be aligned with desired gopsToAlignWith\n\n this.resetStream_();\n this.trigger('done', 'VideoSegmentStream');\n return;\n } // Some gops were trimmed. clear dts info so minSegmentDts and pts are correct\n // when recalculated before sending off to CoalesceStream\n\n\n trackDecodeInfo.clearDtsInfo(track);\n gops = alignedGops;\n }\n\n trackDecodeInfo.collectDtsInfo(track, gops); // First, we have to build the index from byte locations to\n // samples (that is, frames) in the video data\n\n track.samples = frameUtils.generateSampleTable(gops); // Concatenate the video data and construct the mdat\n\n mdat = mp4Generator.mdat(frameUtils.concatenateNalData(gops));\n track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options.keepOriginalTimestamps);\n this.trigger('processedGopsInfo', gops.map(function (gop) {\n return {\n pts: gop.pts,\n dts: gop.dts,\n byteLength: gop.byteLength\n };\n }));\n firstGop = gops[0];\n lastGop = gops[gops.length - 1];\n this.trigger('segmentTimingInfo', generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration));\n this.trigger('timingInfo', {\n start: gops[0].pts,\n end: gops[gops.length - 1].pts + gops[gops.length - 1].duration\n }); // save all the nals in the last GOP into the gop cache\n\n this.gopCache_.unshift({\n gop: gops.pop(),\n pps: track.pps,\n sps: track.sps\n }); // Keep a maximum of 6 GOPs in the cache\n\n this.gopCache_.length = Math.min(6, this.gopCache_.length); // Clear nalUnits\n\n nalUnits = [];\n this.trigger('baseMediaDecodeTime', track.baseMediaDecodeTime);\n this.trigger('timelineStartInfo', track.timelineStartInfo);\n moof = mp4Generator.moof(sequenceNumber, [track]); // it would be great to allocate this array up front instead of\n // throwing away hundreds of media segment fragments\n\n boxes = new Uint8Array(moof.byteLength + mdat.byteLength); // Bump the sequence number for next time\n\n sequenceNumber++;\n boxes.set(moof);\n boxes.set(mdat, moof.byteLength);\n this.trigger('data', {\n track: track,\n boxes: boxes\n });\n this.resetStream_(); // Continue with the flush process now\n\n this.trigger('done', 'VideoSegmentStream');\n };\n\n this.reset = function () {\n this.resetStream_();\n nalUnits = [];\n this.gopCache_.length = 0;\n gopsToAlignWith.length = 0;\n this.trigger('reset');\n };\n\n this.resetStream_ = function () {\n trackDecodeInfo.clearDtsInfo(track); // reset config and pps because they may differ across segments\n // for instance, when we are rendition switching\n\n config = undefined;\n pps = undefined;\n }; // Search for a candidate Gop for gop-fusion from the gop cache and\n // return it or return null if no good candidate was found\n\n\n this.getGopForFusion_ = function (nalUnit) {\n var halfSecond = 45000,\n // Half-a-second in a 90khz clock\n allowableOverlap = 10000,\n // About 3 frames @ 30fps\n nearestDistance = Infinity,\n dtsDistance,\n nearestGopObj,\n currentGop,\n currentGopObj,\n i; // Search for the GOP nearest to the beginning of this nal unit\n\n for (i = 0; i < this.gopCache_.length; i++) {\n currentGopObj = this.gopCache_[i];\n currentGop = currentGopObj.gop; // Reject Gops with different SPS or PPS\n\n if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) {\n continue;\n } // Reject Gops that would require a negative baseMediaDecodeTime\n\n\n if (currentGop.dts < track.timelineStartInfo.dts) {\n continue;\n } // The distance between the end of the gop and the start of the nalUnit\n\n\n dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration; // Only consider GOPS that start before the nal unit and end within\n // a half-second of the nal unit\n\n if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) {\n // Always use the closest GOP we found if there is more than\n // one candidate\n if (!nearestGopObj || nearestDistance > dtsDistance) {\n nearestGopObj = currentGopObj;\n nearestDistance = dtsDistance;\n }\n }\n }\n\n if (nearestGopObj) {\n return nearestGopObj.gop;\n }\n\n return null;\n }; // trim gop list to the first gop found that has a matching pts with a gop in the list\n // of gopsToAlignWith starting from the START of the list\n\n\n this.alignGopsAtStart_ = function (gops) {\n var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration, alignedGops;\n byteLength = gops.byteLength;\n nalCount = gops.nalCount;\n duration = gops.duration;\n alignIndex = gopIndex = 0;\n\n while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) {\n align = gopsToAlignWith[alignIndex];\n gop = gops[gopIndex];\n\n if (align.pts === gop.pts) {\n break;\n }\n\n if (gop.pts > align.pts) {\n // this current gop starts after the current gop we want to align on, so increment\n // align index\n alignIndex++;\n continue;\n } // current gop starts before the current gop we want to align on. so increment gop\n // index\n\n\n gopIndex++;\n byteLength -= gop.byteLength;\n nalCount -= gop.nalCount;\n duration -= gop.duration;\n }\n\n if (gopIndex === 0) {\n // no gops to trim\n return gops;\n }\n\n if (gopIndex === gops.length) {\n // all gops trimmed, skip appending all gops\n return null;\n }\n\n alignedGops = gops.slice(gopIndex);\n alignedGops.byteLength = byteLength;\n alignedGops.duration = duration;\n alignedGops.nalCount = nalCount;\n alignedGops.pts = alignedGops[0].pts;\n alignedGops.dts = alignedGops[0].dts;\n return alignedGops;\n }; // trim gop list to the first gop found that has a matching pts with a gop in the list\n // of gopsToAlignWith starting from the END of the list\n\n\n this.alignGopsAtEnd_ = function (gops) {\n var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound;\n alignIndex = gopsToAlignWith.length - 1;\n gopIndex = gops.length - 1;\n alignEndIndex = null;\n matchFound = false;\n\n while (alignIndex >= 0 && gopIndex >= 0) {\n align = gopsToAlignWith[alignIndex];\n gop = gops[gopIndex];\n\n if (align.pts === gop.pts) {\n matchFound = true;\n break;\n }\n\n if (align.pts > gop.pts) {\n alignIndex--;\n continue;\n }\n\n if (alignIndex === gopsToAlignWith.length - 1) {\n // gop.pts is greater than the last alignment candidate. If no match is found\n // by the end of this loop, we still want to append gops that come after this\n // point\n alignEndIndex = gopIndex;\n }\n\n gopIndex--;\n }\n\n if (!matchFound && alignEndIndex === null) {\n return null;\n }\n\n var trimIndex;\n\n if (matchFound) {\n trimIndex = gopIndex;\n } else {\n trimIndex = alignEndIndex;\n }\n\n if (trimIndex === 0) {\n return gops;\n }\n\n var alignedGops = gops.slice(trimIndex);\n var metadata = alignedGops.reduce(function (total, gop) {\n total.byteLength += gop.byteLength;\n total.duration += gop.duration;\n total.nalCount += gop.nalCount;\n return total;\n }, {\n byteLength: 0,\n duration: 0,\n nalCount: 0\n });\n alignedGops.byteLength = metadata.byteLength;\n alignedGops.duration = metadata.duration;\n alignedGops.nalCount = metadata.nalCount;\n alignedGops.pts = alignedGops[0].pts;\n alignedGops.dts = alignedGops[0].dts;\n return alignedGops;\n };\n\n this.alignGopsWith = function (newGopsToAlignWith) {\n gopsToAlignWith = newGopsToAlignWith;\n };\n };\n\n _VideoSegmentStream.prototype = new stream();\n /**\n * A Stream that can combine multiple streams (ie. audio & video)\n * into a single output segment for MSE. Also supports audio-only\n * and video-only streams.\n * @param options {object} transmuxer options object\n * @param options.keepOriginalTimestamps {boolean} If true, keep the timestamps\n * in the source; false to adjust the first segment to start at media timeline start.\n */\n\n _CoalesceStream = function CoalesceStream(options, metadataStream) {\n // Number of Tracks per output segment\n // If greater than 1, we combine multiple\n // tracks into a single segment\n this.numberOfTracks = 0;\n this.metadataStream = metadataStream;\n options = options || {};\n\n if (typeof options.remux !== 'undefined') {\n this.remuxTracks = !!options.remux;\n } else {\n this.remuxTracks = true;\n }\n\n if (typeof options.keepOriginalTimestamps === 'boolean') {\n this.keepOriginalTimestamps = options.keepOriginalTimestamps;\n } else {\n this.keepOriginalTimestamps = false;\n }\n\n this.pendingTracks = [];\n this.videoTrack = null;\n this.pendingBoxes = [];\n this.pendingCaptions = [];\n this.pendingMetadata = [];\n this.pendingBytes = 0;\n this.emittedTracks = 0;\n\n _CoalesceStream.prototype.init.call(this); // Take output from multiple\n\n\n this.push = function (output) {\n // buffer incoming captions until the associated video segment\n // finishes\n if (output.text) {\n return this.pendingCaptions.push(output);\n } // buffer incoming id3 tags until the final flush\n\n\n if (output.frames) {\n return this.pendingMetadata.push(output);\n } // Add this track to the list of pending tracks and store\n // important information required for the construction of\n // the final segment\n\n\n this.pendingTracks.push(output.track);\n this.pendingBytes += output.boxes.byteLength; // TODO: is there an issue for this against chrome?\n // We unshift audio and push video because\n // as of Chrome 75 when switching from\n // one init segment to another if the video\n // mdat does not appear after the audio mdat\n // only audio will play for the duration of our transmux.\n\n if (output.track.type === 'video') {\n this.videoTrack = output.track;\n this.pendingBoxes.push(output.boxes);\n }\n\n if (output.track.type === 'audio') {\n this.audioTrack = output.track;\n this.pendingBoxes.unshift(output.boxes);\n }\n };\n };\n\n _CoalesceStream.prototype = new stream();\n\n _CoalesceStream.prototype.flush = function (flushSource) {\n var offset = 0,\n event = {\n captions: [],\n captionStreams: {},\n metadata: [],\n info: {}\n },\n caption,\n id3,\n initSegment,\n timelineStartPts = 0,\n i;\n\n if (this.pendingTracks.length < this.numberOfTracks) {\n if (flushSource !== 'VideoSegmentStream' && flushSource !== 'AudioSegmentStream') {\n // Return because we haven't received a flush from a data-generating\n // portion of the segment (meaning that we have only recieved meta-data\n // or captions.)\n return;\n } else if (this.remuxTracks) {\n // Return until we have enough tracks from the pipeline to remux (if we\n // are remuxing audio and video into a single MP4)\n return;\n } else if (this.pendingTracks.length === 0) {\n // In the case where we receive a flush without any data having been\n // received we consider it an emitted track for the purposes of coalescing\n // `done` events.\n // We do this for the case where there is an audio and video track in the\n // segment but no audio data. (seen in several playlists with alternate\n // audio tracks and no audio present in the main TS segments.)\n this.emittedTracks++;\n\n if (this.emittedTracks >= this.numberOfTracks) {\n this.trigger('done');\n this.emittedTracks = 0;\n }\n\n return;\n }\n }\n\n if (this.videoTrack) {\n timelineStartPts = this.videoTrack.timelineStartInfo.pts;\n videoProperties.forEach(function (prop) {\n event.info[prop] = this.videoTrack[prop];\n }, this);\n } else if (this.audioTrack) {\n timelineStartPts = this.audioTrack.timelineStartInfo.pts;\n audioProperties.forEach(function (prop) {\n event.info[prop] = this.audioTrack[prop];\n }, this);\n }\n\n if (this.videoTrack || this.audioTrack) {\n if (this.pendingTracks.length === 1) {\n event.type = this.pendingTracks[0].type;\n } else {\n event.type = 'combined';\n }\n\n this.emittedTracks += this.pendingTracks.length;\n initSegment = mp4Generator.initSegment(this.pendingTracks); // Create a new typed array to hold the init segment\n\n event.initSegment = new Uint8Array(initSegment.byteLength); // Create an init segment containing a moov\n // and track definitions\n\n event.initSegment.set(initSegment); // Create a new typed array to hold the moof+mdats\n\n event.data = new Uint8Array(this.pendingBytes); // Append each moof+mdat (one per track) together\n\n for (i = 0; i < this.pendingBoxes.length; i++) {\n event.data.set(this.pendingBoxes[i], offset);\n offset += this.pendingBoxes[i].byteLength;\n } // Translate caption PTS times into second offsets to match the\n // video timeline for the segment, and add track info\n\n\n for (i = 0; i < this.pendingCaptions.length; i++) {\n caption = this.pendingCaptions[i];\n caption.startTime = clock.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps);\n caption.endTime = clock.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps);\n event.captionStreams[caption.stream] = true;\n event.captions.push(caption);\n } // Translate ID3 frame PTS times into second offsets to match the\n // video timeline for the segment\n\n\n for (i = 0; i < this.pendingMetadata.length; i++) {\n id3 = this.pendingMetadata[i];\n id3.cueTime = clock.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps);\n event.metadata.push(id3);\n } // We add this to every single emitted segment even though we only need\n // it for the first\n\n\n event.metadata.dispatchType = this.metadataStream.dispatchType; // Reset stream state\n\n this.pendingTracks.length = 0;\n this.videoTrack = null;\n this.pendingBoxes.length = 0;\n this.pendingCaptions.length = 0;\n this.pendingBytes = 0;\n this.pendingMetadata.length = 0; // Emit the built segment\n // We include captions and ID3 tags for backwards compatibility,\n // ideally we should send only video and audio in the data event\n\n this.trigger('data', event); // Emit each caption to the outside world\n // Ideally, this would happen immediately on parsing captions,\n // but we need to ensure that video data is sent back first\n // so that caption timing can be adjusted to match video timing\n\n for (i = 0; i < event.captions.length; i++) {\n caption = event.captions[i];\n this.trigger('caption', caption);\n } // Emit each id3 tag to the outside world\n // Ideally, this would happen immediately on parsing the tag,\n // but we need to ensure that video data is sent back first\n // so that ID3 frame timing can be adjusted to match video timing\n\n\n for (i = 0; i < event.metadata.length; i++) {\n id3 = event.metadata[i];\n this.trigger('id3Frame', id3);\n }\n } // Only emit `done` if all tracks have been flushed and emitted\n\n\n if (this.emittedTracks >= this.numberOfTracks) {\n this.trigger('done');\n this.emittedTracks = 0;\n }\n };\n\n _CoalesceStream.prototype.setRemux = function (val) {\n this.remuxTracks = val;\n };\n /**\n * A Stream that expects MP2T binary data as input and produces\n * corresponding media segments, suitable for use with Media Source\n * Extension (MSE) implementations that support the ISO BMFF byte\n * stream format, like Chrome.\n */\n\n\n _Transmuxer = function Transmuxer(options) {\n var self = this,\n hasFlushed = true,\n videoTrack,\n audioTrack;\n\n _Transmuxer.prototype.init.call(this);\n\n options = options || {};\n this.baseMediaDecodeTime = options.baseMediaDecodeTime || 0;\n this.transmuxPipeline_ = {};\n\n this.setupAacPipeline = function () {\n var pipeline = {};\n this.transmuxPipeline_ = pipeline;\n pipeline.type = 'aac';\n pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline\n\n pipeline.aacStream = new aac();\n pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('audio');\n pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream('timed-metadata');\n pipeline.adtsStream = new adts();\n pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream);\n pipeline.headOfPipeline = pipeline.aacStream;\n pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream);\n pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);\n pipeline.metadataStream.on('timestamp', function (frame) {\n pipeline.aacStream.setTimestamp(frame.timeStamp);\n });\n pipeline.aacStream.on('data', function (data) {\n if (data.type !== 'timed-metadata' && data.type !== 'audio' || pipeline.audioSegmentStream) {\n return;\n }\n\n audioTrack = audioTrack || {\n timelineStartInfo: {\n baseMediaDecodeTime: self.baseMediaDecodeTime\n },\n codec: 'adts',\n type: 'audio'\n }; // hook up the audio segment stream to the first track with aac data\n\n pipeline.coalesceStream.numberOfTracks++;\n pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options);\n pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream'));\n pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo')); // Set up the final part of the audio pipeline\n\n pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream); // emit pmt info\n\n self.trigger('trackinfo', {\n hasAudio: !!audioTrack,\n hasVideo: !!videoTrack\n });\n }); // Re-emit any data coming from the coalesce stream to the outside world\n\n pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data')); // Let the consumer know we have finished flushing the entire pipeline\n\n pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done'));\n addPipelineLogRetriggers(this, pipeline);\n };\n\n this.setupTsPipeline = function () {\n var pipeline = {};\n this.transmuxPipeline_ = pipeline;\n pipeline.type = 'ts';\n pipeline.metadataStream = new m2ts_1.MetadataStream(); // set up the parsing pipeline\n\n pipeline.packetStream = new m2ts_1.TransportPacketStream();\n pipeline.parseStream = new m2ts_1.TransportParseStream();\n pipeline.elementaryStream = new m2ts_1.ElementaryStream();\n pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream();\n pipeline.adtsStream = new adts();\n pipeline.h264Stream = new H264Stream();\n pipeline.captionStream = new m2ts_1.CaptionStream(options);\n pipeline.coalesceStream = new _CoalesceStream(options, pipeline.metadataStream);\n pipeline.headOfPipeline = pipeline.packetStream; // disassemble MPEG2-TS packets into elementary streams\n\n pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream); // !!THIS ORDER IS IMPORTANT!!\n // demux the streams\n\n pipeline.timestampRolloverStream.pipe(pipeline.h264Stream);\n pipeline.timestampRolloverStream.pipe(pipeline.adtsStream);\n pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream); // Hook up CEA-608/708 caption stream\n\n pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream);\n pipeline.elementaryStream.on('data', function (data) {\n var i;\n\n if (data.type === 'metadata') {\n i = data.tracks.length; // scan the tracks listed in the metadata\n\n while (i--) {\n if (!videoTrack && data.tracks[i].type === 'video') {\n videoTrack = data.tracks[i];\n videoTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime;\n } else if (!audioTrack && data.tracks[i].type === 'audio') {\n audioTrack = data.tracks[i];\n audioTrack.timelineStartInfo.baseMediaDecodeTime = self.baseMediaDecodeTime;\n }\n } // hook up the video segment stream to the first track with h264 data\n\n\n if (videoTrack && !pipeline.videoSegmentStream) {\n pipeline.coalesceStream.numberOfTracks++;\n pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options);\n pipeline.videoSegmentStream.on('log', self.getLogTrigger_('videoSegmentStream'));\n pipeline.videoSegmentStream.on('timelineStartInfo', function (timelineStartInfo) {\n // When video emits timelineStartInfo data after a flush, we forward that\n // info to the AudioSegmentStream, if it exists, because video timeline\n // data takes precedence. Do not do this if keepOriginalTimestamps is set,\n // because this is a particularly subtle form of timestamp alteration.\n if (audioTrack && !options.keepOriginalTimestamps) {\n audioTrack.timelineStartInfo = timelineStartInfo; // On the first segment we trim AAC frames that exist before the\n // very earliest DTS we have seen in video because Chrome will\n // interpret any video track with a baseMediaDecodeTime that is\n // non-zero as a gap.\n\n pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self.baseMediaDecodeTime);\n }\n });\n pipeline.videoSegmentStream.on('processedGopsInfo', self.trigger.bind(self, 'gopInfo'));\n pipeline.videoSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'videoSegmentTimingInfo'));\n pipeline.videoSegmentStream.on('baseMediaDecodeTime', function (baseMediaDecodeTime) {\n if (audioTrack) {\n pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime);\n }\n });\n pipeline.videoSegmentStream.on('timingInfo', self.trigger.bind(self, 'videoTimingInfo')); // Set up the final part of the video pipeline\n\n pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream);\n }\n\n if (audioTrack && !pipeline.audioSegmentStream) {\n // hook up the audio segment stream to the first track with aac data\n pipeline.coalesceStream.numberOfTracks++;\n pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options);\n pipeline.audioSegmentStream.on('log', self.getLogTrigger_('audioSegmentStream'));\n pipeline.audioSegmentStream.on('timingInfo', self.trigger.bind(self, 'audioTimingInfo'));\n pipeline.audioSegmentStream.on('segmentTimingInfo', self.trigger.bind(self, 'audioSegmentTimingInfo')); // Set up the final part of the audio pipeline\n\n pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);\n } // emit pmt info\n\n\n self.trigger('trackinfo', {\n hasAudio: !!audioTrack,\n hasVideo: !!videoTrack\n });\n }\n }); // Re-emit any data coming from the coalesce stream to the outside world\n\n pipeline.coalesceStream.on('data', this.trigger.bind(this, 'data'));\n pipeline.coalesceStream.on('id3Frame', function (id3Frame) {\n id3Frame.dispatchType = pipeline.metadataStream.dispatchType;\n self.trigger('id3Frame', id3Frame);\n });\n pipeline.coalesceStream.on('caption', this.trigger.bind(this, 'caption')); // Let the consumer know we have finished flushing the entire pipeline\n\n pipeline.coalesceStream.on('done', this.trigger.bind(this, 'done'));\n addPipelineLogRetriggers(this, pipeline);\n }; // hook up the segment streams once track metadata is delivered\n\n\n this.setBaseMediaDecodeTime = function (baseMediaDecodeTime) {\n var pipeline = this.transmuxPipeline_;\n\n if (!options.keepOriginalTimestamps) {\n this.baseMediaDecodeTime = baseMediaDecodeTime;\n }\n\n if (audioTrack) {\n audioTrack.timelineStartInfo.dts = undefined;\n audioTrack.timelineStartInfo.pts = undefined;\n trackDecodeInfo.clearDtsInfo(audioTrack);\n\n if (pipeline.audioTimestampRolloverStream) {\n pipeline.audioTimestampRolloverStream.discontinuity();\n }\n }\n\n if (videoTrack) {\n if (pipeline.videoSegmentStream) {\n pipeline.videoSegmentStream.gopCache_ = [];\n }\n\n videoTrack.timelineStartInfo.dts = undefined;\n videoTrack.timelineStartInfo.pts = undefined;\n trackDecodeInfo.clearDtsInfo(videoTrack);\n pipeline.captionStream.reset();\n }\n\n if (pipeline.timestampRolloverStream) {\n pipeline.timestampRolloverStream.discontinuity();\n }\n };\n\n this.setAudioAppendStart = function (timestamp) {\n if (audioTrack) {\n this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp);\n }\n };\n\n this.setRemux = function (val) {\n var pipeline = this.transmuxPipeline_;\n options.remux = val;\n\n if (pipeline && pipeline.coalesceStream) {\n pipeline.coalesceStream.setRemux(val);\n }\n };\n\n this.alignGopsWith = function (gopsToAlignWith) {\n if (videoTrack && this.transmuxPipeline_.videoSegmentStream) {\n this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith);\n }\n };\n\n this.getLogTrigger_ = function (key) {\n var self = this;\n return function (event) {\n event.stream = key;\n self.trigger('log', event);\n };\n }; // feed incoming data to the front of the parsing pipeline\n\n\n this.push = function (data) {\n if (hasFlushed) {\n var isAac = isLikelyAacData(data);\n\n if (isAac && this.transmuxPipeline_.type !== 'aac') {\n this.setupAacPipeline();\n } else if (!isAac && this.transmuxPipeline_.type !== 'ts') {\n this.setupTsPipeline();\n }\n\n hasFlushed = false;\n }\n\n this.transmuxPipeline_.headOfPipeline.push(data);\n }; // flush any buffered data\n\n\n this.flush = function () {\n hasFlushed = true; // Start at the top of the pipeline and flush all pending work\n\n this.transmuxPipeline_.headOfPipeline.flush();\n };\n\n this.endTimeline = function () {\n this.transmuxPipeline_.headOfPipeline.endTimeline();\n };\n\n this.reset = function () {\n if (this.transmuxPipeline_.headOfPipeline) {\n this.transmuxPipeline_.headOfPipeline.reset();\n }\n }; // Caption data has to be reset when seeking outside buffered range\n\n\n this.resetCaptions = function () {\n if (this.transmuxPipeline_.captionStream) {\n this.transmuxPipeline_.captionStream.reset();\n }\n };\n };\n\n _Transmuxer.prototype = new stream();\n var transmuxer = {\n Transmuxer: _Transmuxer,\n VideoSegmentStream: _VideoSegmentStream,\n AudioSegmentStream: _AudioSegmentStream,\n AUDIO_PROPERTIES: audioProperties,\n VIDEO_PROPERTIES: videoProperties,\n // exported for testing\n generateSegmentTimingInfo: generateSegmentTimingInfo\n };\n /**\n * mux.js\n *\n * Copyright (c) Brightcove\n * Licensed Apache-2.0 https://github.com/videojs/mux.js/blob/master/LICENSE\n */\n\n var toUnsigned$3 = function toUnsigned(value) {\n return value >>> 0;\n };\n\n var toHexString$1 = function toHexString(value) {\n return ('00' + value.toString(16)).slice(-2);\n };\n\n var bin = {\n toUnsigned: toUnsigned$3,\n toHexString: toHexString$1\n };\n\n var parseType$1 = function parseType(buffer) {\n var result = '';\n result += String.fromCharCode(buffer[0]);\n result += String.fromCharCode(buffer[1]);\n result += String.fromCharCode(buffer[2]);\n result += String.fromCharCode(buffer[3]);\n return result;\n };\n\n var parseType_1 = parseType$1;\n var toUnsigned$2 = bin.toUnsigned;\n\n var findBox = function findBox(data, path) {\n var results = [],\n i,\n size,\n type,\n end,\n subresults;\n\n if (!path.length) {\n // short-circuit the search for empty paths\n return null;\n }\n\n for (i = 0; i < data.byteLength;) {\n size = toUnsigned$2(data[i] << 24 | data[i + 1] << 16 | data[i + 2] << 8 | data[i + 3]);\n type = parseType_1(data.subarray(i + 4, i + 8));\n end = size > 1 ? i + size : data.byteLength;\n\n if (type === path[0]) {\n if (path.length === 1) {\n // this is the end of the path and we've found the box we were\n // looking for\n results.push(data.subarray(i + 8, end));\n } else {\n // recursively search for the next box along the path\n subresults = findBox(data.subarray(i + 8, end), path.slice(1));\n\n if (subresults.length) {\n results = results.concat(subresults);\n }\n }\n }\n\n i = end;\n } // we've finished searching all of data\n\n\n return results;\n };\n\n var findBox_1 = findBox;\n var toUnsigned$1 = bin.toUnsigned;\n var getUint64$1 = numbers.getUint64;\n\n var tfdt = function tfdt(data) {\n var result = {\n version: data[0],\n flags: new Uint8Array(data.subarray(1, 4))\n };\n\n if (result.version === 1) {\n result.baseMediaDecodeTime = getUint64$1(data.subarray(4));\n } else {\n result.baseMediaDecodeTime = toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]);\n }\n\n return result;\n };\n\n var parseTfdt = tfdt;\n\n var parseSampleFlags = function parseSampleFlags(flags) {\n return {\n isLeading: (flags[0] & 0x0c) >>> 2,\n dependsOn: flags[0] & 0x03,\n isDependedOn: (flags[1] & 0xc0) >>> 6,\n hasRedundancy: (flags[1] & 0x30) >>> 4,\n paddingValue: (flags[1] & 0x0e) >>> 1,\n isNonSyncSample: flags[1] & 0x01,\n degradationPriority: flags[2] << 8 | flags[3]\n };\n };\n\n var parseSampleFlags_1 = parseSampleFlags;\n\n var trun = function trun(data) {\n var result = {\n version: data[0],\n flags: new Uint8Array(data.subarray(1, 4)),\n samples: []\n },\n view = new DataView(data.buffer, data.byteOffset, data.byteLength),\n // Flag interpretation\n dataOffsetPresent = result.flags[2] & 0x01,\n // compare with 2nd byte of 0x1\n firstSampleFlagsPresent = result.flags[2] & 0x04,\n // compare with 2nd byte of 0x4\n sampleDurationPresent = result.flags[1] & 0x01,\n // compare with 2nd byte of 0x100\n sampleSizePresent = result.flags[1] & 0x02,\n // compare with 2nd byte of 0x200\n sampleFlagsPresent = result.flags[1] & 0x04,\n // compare with 2nd byte of 0x400\n sampleCompositionTimeOffsetPresent = result.flags[1] & 0x08,\n // compare with 2nd byte of 0x800\n sampleCount = view.getUint32(4),\n offset = 8,\n sample;\n\n if (dataOffsetPresent) {\n // 32 bit signed integer\n result.dataOffset = view.getInt32(offset);\n offset += 4;\n } // Overrides the flags for the first sample only. The order of\n // optional values will be: duration, size, compositionTimeOffset\n\n\n if (firstSampleFlagsPresent && sampleCount) {\n sample = {\n flags: parseSampleFlags_1(data.subarray(offset, offset + 4))\n };\n offset += 4;\n\n if (sampleDurationPresent) {\n sample.duration = view.getUint32(offset);\n offset += 4;\n }\n\n if (sampleSizePresent) {\n sample.size = view.getUint32(offset);\n offset += 4;\n }\n\n if (sampleCompositionTimeOffsetPresent) {\n if (result.version === 1) {\n sample.compositionTimeOffset = view.getInt32(offset);\n } else {\n sample.compositionTimeOffset = view.getUint32(offset);\n }\n\n offset += 4;\n }\n\n result.samples.push(sample);\n sampleCount--;\n }\n\n while (sampleCount--) {\n sample = {};\n\n if (sampleDurationPresent) {\n sample.duration = view.getUint32(offset);\n offset += 4;\n }\n\n if (sampleSizePresent) {\n sample.size = view.getUint32(offset);\n offset += 4;\n }\n\n if (sampleFlagsPresent) {\n sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4));\n offset += 4;\n }\n\n if (sampleCompositionTimeOffsetPresent) {\n if (result.version === 1) {\n sample.compositionTimeOffset = view.getInt32(offset);\n } else {\n sample.compositionTimeOffset = view.getUint32(offset);\n }\n\n offset += 4;\n }\n\n result.samples.push(sample);\n }\n\n return result;\n };\n\n var parseTrun = trun;\n\n var tfhd = function tfhd(data) {\n var view = new DataView(data.buffer, data.byteOffset, data.byteLength),\n result = {\n version: data[0],\n flags: new Uint8Array(data.subarray(1, 4)),\n trackId: view.getUint32(4)\n },\n baseDataOffsetPresent = result.flags[2] & 0x01,\n sampleDescriptionIndexPresent = result.flags[2] & 0x02,\n defaultSampleDurationPresent = result.flags[2] & 0x08,\n defaultSampleSizePresent = result.flags[2] & 0x10,\n defaultSampleFlagsPresent = result.flags[2] & 0x20,\n durationIsEmpty = result.flags[0] & 0x010000,\n defaultBaseIsMoof = result.flags[0] & 0x020000,\n i;\n i = 8;\n\n if (baseDataOffsetPresent) {\n i += 4; // truncate top 4 bytes\n // FIXME: should we read the full 64 bits?\n\n result.baseDataOffset = view.getUint32(12);\n i += 4;\n }\n\n if (sampleDescriptionIndexPresent) {\n result.sampleDescriptionIndex = view.getUint32(i);\n i += 4;\n }\n\n if (defaultSampleDurationPresent) {\n result.defaultSampleDuration = view.getUint32(i);\n i += 4;\n }\n\n if (defaultSampleSizePresent) {\n result.defaultSampleSize = view.getUint32(i);\n i += 4;\n }\n\n if (defaultSampleFlagsPresent) {\n result.defaultSampleFlags = view.getUint32(i);\n }\n\n if (durationIsEmpty) {\n result.durationIsEmpty = true;\n }\n\n if (!baseDataOffsetPresent && defaultBaseIsMoof) {\n result.baseDataOffsetIsMoof = true;\n }\n\n return result;\n };\n\n var parseTfhd = tfhd;\n var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};\n var win;\n\n if (typeof window !== \"undefined\") {\n win = window;\n } else if (typeof commonjsGlobal !== \"undefined\") {\n win = commonjsGlobal;\n } else if (typeof self !== \"undefined\") {\n win = self;\n } else {\n win = {};\n }\n\n var window_1 = win;\n var discardEmulationPreventionBytes = captionPacketParser.discardEmulationPreventionBytes;\n var CaptionStream = captionStream.CaptionStream;\n /**\n * Maps an offset in the mdat to a sample based on the the size of the samples.\n * Assumes that `parseSamples` has been called first.\n *\n * @param {Number} offset - The offset into the mdat\n * @param {Object[]} samples - An array of samples, parsed using `parseSamples`\n * @return {?Object} The matching sample, or null if no match was found.\n *\n * @see ISO-BMFF-12/2015, Section 8.8.8\n **/\n\n var mapToSample = function mapToSample(offset, samples) {\n var approximateOffset = offset;\n\n for (var i = 0; i < samples.length; i++) {\n var sample = samples[i];\n\n if (approximateOffset < sample.size) {\n return sample;\n }\n\n approximateOffset -= sample.size;\n }\n\n return null;\n };\n /**\n * Finds SEI nal units contained in a Media Data Box.\n * Assumes that `parseSamples` has been called first.\n *\n * @param {Uint8Array} avcStream - The bytes of the mdat\n * @param {Object[]} samples - The samples parsed out by `parseSamples`\n * @param {Number} trackId - The trackId of this video track\n * @return {Object[]} seiNals - the parsed SEI NALUs found.\n * The contents of the seiNal should match what is expected by\n * CaptionStream.push (nalUnitType, size, data, escapedRBSP, pts, dts)\n *\n * @see ISO-BMFF-12/2015, Section 8.1.1\n * @see Rec. ITU-T H.264, 7.3.2.3.1\n **/\n\n\n var findSeiNals = function findSeiNals(avcStream, samples, trackId) {\n var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength),\n result = {\n logs: [],\n seiNals: []\n },\n seiNal,\n i,\n length,\n lastMatchedSample;\n\n for (i = 0; i + 4 < avcStream.length; i += length) {\n length = avcView.getUint32(i);\n i += 4; // Bail if this doesn't appear to be an H264 stream\n\n if (length <= 0) {\n continue;\n }\n\n switch (avcStream[i] & 0x1F) {\n case 0x06:\n var data = avcStream.subarray(i + 1, i + 1 + length);\n var matchingSample = mapToSample(i, samples);\n seiNal = {\n nalUnitType: 'sei_rbsp',\n size: length,\n data: data,\n escapedRBSP: discardEmulationPreventionBytes(data),\n trackId: trackId\n };\n\n if (matchingSample) {\n seiNal.pts = matchingSample.pts;\n seiNal.dts = matchingSample.dts;\n lastMatchedSample = matchingSample;\n } else if (lastMatchedSample) {\n // If a matching sample cannot be found, use the last\n // sample's values as they should be as close as possible\n seiNal.pts = lastMatchedSample.pts;\n seiNal.dts = lastMatchedSample.dts;\n } else {\n result.logs.push({\n level: 'warn',\n message: 'We\\'ve encountered a nal unit without data at ' + i + ' for trackId ' + trackId + '. See mux.js#223.'\n });\n break;\n }\n\n result.seiNals.push(seiNal);\n break;\n }\n }\n\n return result;\n };\n /**\n * Parses sample information out of Track Run Boxes and calculates\n * the absolute presentation and decode timestamps of each sample.\n *\n * @param {Array<Uint8Array>} truns - The Trun Run boxes to be parsed\n * @param {Number|BigInt} baseMediaDecodeTime - base media decode time from tfdt\n @see ISO-BMFF-12/2015, Section 8.8.12\n * @param {Object} tfhd - The parsed Track Fragment Header\n * @see inspect.parseTfhd\n * @return {Object[]} the parsed samples\n *\n * @see ISO-BMFF-12/2015, Section 8.8.8\n **/\n\n\n var parseSamples = function parseSamples(truns, baseMediaDecodeTime, tfhd) {\n var currentDts = baseMediaDecodeTime;\n var defaultSampleDuration = tfhd.defaultSampleDuration || 0;\n var defaultSampleSize = tfhd.defaultSampleSize || 0;\n var trackId = tfhd.trackId;\n var allSamples = [];\n truns.forEach(function (trun) {\n // Note: We currently do not parse the sample table as well\n // as the trun. It's possible some sources will require this.\n // moov > trak > mdia > minf > stbl\n var trackRun = parseTrun(trun);\n var samples = trackRun.samples;\n samples.forEach(function (sample) {\n if (sample.duration === undefined) {\n sample.duration = defaultSampleDuration;\n }\n\n if (sample.size === undefined) {\n sample.size = defaultSampleSize;\n }\n\n sample.trackId = trackId;\n sample.dts = currentDts;\n\n if (sample.compositionTimeOffset === undefined) {\n sample.compositionTimeOffset = 0;\n }\n\n if (typeof currentDts === 'bigint') {\n sample.pts = currentDts + window_1.BigInt(sample.compositionTimeOffset);\n currentDts += window_1.BigInt(sample.duration);\n } else {\n sample.pts = currentDts + sample.compositionTimeOffset;\n currentDts += sample.duration;\n }\n });\n allSamples = allSamples.concat(samples);\n });\n return allSamples;\n };\n /**\n * Parses out caption nals from an FMP4 segment's video tracks.\n *\n * @param {Uint8Array} segment - The bytes of a single segment\n * @param {Number} videoTrackId - The trackId of a video track in the segment\n * @return {Object.<Number, Object[]>} A mapping of video trackId to\n * a list of seiNals found in that track\n **/\n\n\n var parseCaptionNals = function parseCaptionNals(segment, videoTrackId) {\n // To get the samples\n var trafs = findBox_1(segment, ['moof', 'traf']); // To get SEI NAL units\n\n var mdats = findBox_1(segment, ['mdat']);\n var captionNals = {};\n var mdatTrafPairs = []; // Pair up each traf with a mdat as moofs and mdats are in pairs\n\n mdats.forEach(function (mdat, index) {\n var matchingTraf = trafs[index];\n mdatTrafPairs.push({\n mdat: mdat,\n traf: matchingTraf\n });\n });\n mdatTrafPairs.forEach(function (pair) {\n var mdat = pair.mdat;\n var traf = pair.traf;\n var tfhd = findBox_1(traf, ['tfhd']); // Exactly 1 tfhd per traf\n\n var headerInfo = parseTfhd(tfhd[0]);\n var trackId = headerInfo.trackId;\n var tfdt = findBox_1(traf, ['tfdt']); // Either 0 or 1 tfdt per traf\n\n var baseMediaDecodeTime = tfdt.length > 0 ? parseTfdt(tfdt[0]).baseMediaDecodeTime : 0;\n var truns = findBox_1(traf, ['trun']);\n var samples;\n var result; // Only parse video data for the chosen video track\n\n if (videoTrackId === trackId && truns.length > 0) {\n samples = parseSamples(truns, baseMediaDecodeTime, headerInfo);\n result = findSeiNals(mdat, samples, trackId);\n\n if (!captionNals[trackId]) {\n captionNals[trackId] = {\n seiNals: [],\n logs: []\n };\n }\n\n captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals);\n captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs);\n }\n });\n return captionNals;\n };\n /**\n * Parses out inband captions from an MP4 container and returns\n * caption objects that can be used by WebVTT and the TextTrack API.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/VTTCue\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TextTrack\n * Assumes that `probe.getVideoTrackIds` and `probe.timescale` have been called first\n *\n * @param {Uint8Array} segment - The fmp4 segment containing embedded captions\n * @param {Number} trackId - The id of the video track to parse\n * @param {Number} timescale - The timescale for the video track from the init segment\n *\n * @return {?Object[]} parsedCaptions - A list of captions or null if no video tracks\n * @return {Number} parsedCaptions[].startTime - The time to show the caption in seconds\n * @return {Number} parsedCaptions[].endTime - The time to stop showing the caption in seconds\n * @return {String} parsedCaptions[].text - The visible content of the caption\n **/\n\n\n var parseEmbeddedCaptions = function parseEmbeddedCaptions(segment, trackId, timescale) {\n var captionNals; // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there\n\n if (trackId === null) {\n return null;\n }\n\n captionNals = parseCaptionNals(segment, trackId);\n var trackNals = captionNals[trackId] || {};\n return {\n seiNals: trackNals.seiNals,\n logs: trackNals.logs,\n timescale: timescale\n };\n };\n /**\n * Converts SEI NALUs into captions that can be used by video.js\n **/\n\n\n var CaptionParser = function CaptionParser() {\n var isInitialized = false;\n var captionStream; // Stores segments seen before trackId and timescale are set\n\n var segmentCache; // Stores video track ID of the track being parsed\n\n var trackId; // Stores the timescale of the track being parsed\n\n var timescale; // Stores captions parsed so far\n\n var parsedCaptions; // Stores whether we are receiving partial data or not\n\n var parsingPartial;\n /**\n * A method to indicate whether a CaptionParser has been initalized\n * @returns {Boolean}\n **/\n\n this.isInitialized = function () {\n return isInitialized;\n };\n /**\n * Initializes the underlying CaptionStream, SEI NAL parsing\n * and management, and caption collection\n **/\n\n\n this.init = function (options) {\n captionStream = new CaptionStream();\n isInitialized = true;\n parsingPartial = options ? options.isPartial : false; // Collect dispatched captions\n\n captionStream.on('data', function (event) {\n // Convert to seconds in the source's timescale\n event.startTime = event.startPts / timescale;\n event.endTime = event.endPts / timescale;\n parsedCaptions.captions.push(event);\n parsedCaptions.captionStreams[event.stream] = true;\n });\n captionStream.on('log', function (log) {\n parsedCaptions.logs.push(log);\n });\n };\n /**\n * Determines if a new video track will be selected\n * or if the timescale changed\n * @return {Boolean}\n **/\n\n\n this.isNewInit = function (videoTrackIds, timescales) {\n if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === 'object' && Object.keys(timescales).length === 0) {\n return false;\n }\n\n return trackId !== videoTrackIds[0] || timescale !== timescales[trackId];\n };\n /**\n * Parses out SEI captions and interacts with underlying\n * CaptionStream to return dispatched captions\n *\n * @param {Uint8Array} segment - The fmp4 segment containing embedded captions\n * @param {Number[]} videoTrackIds - A list of video tracks found in the init segment\n * @param {Object.<Number, Number>} timescales - The timescales found in the init segment\n * @see parseEmbeddedCaptions\n * @see m2ts/caption-stream.js\n **/\n\n\n this.parse = function (segment, videoTrackIds, timescales) {\n var parsedData;\n\n if (!this.isInitialized()) {\n return null; // This is not likely to be a video segment\n } else if (!videoTrackIds || !timescales) {\n return null;\n } else if (this.isNewInit(videoTrackIds, timescales)) {\n // Use the first video track only as there is no\n // mechanism to switch to other video tracks\n trackId = videoTrackIds[0];\n timescale = timescales[trackId]; // If an init segment has not been seen yet, hold onto segment\n // data until we have one.\n // the ISO-BMFF spec says that trackId can't be zero, but there's some broken content out there\n } else if (trackId === null || !timescale) {\n segmentCache.push(segment);\n return null;\n } // Now that a timescale and trackId is set, parse cached segments\n\n\n while (segmentCache.length > 0) {\n var cachedSegment = segmentCache.shift();\n this.parse(cachedSegment, videoTrackIds, timescales);\n }\n\n parsedData = parseEmbeddedCaptions(segment, trackId, timescale);\n\n if (parsedData && parsedData.logs) {\n parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs);\n }\n\n if (parsedData === null || !parsedData.seiNals) {\n if (parsedCaptions.logs.length) {\n return {\n logs: parsedCaptions.logs,\n captions: [],\n captionStreams: []\n };\n }\n\n return null;\n }\n\n this.pushNals(parsedData.seiNals); // Force the parsed captions to be dispatched\n\n this.flushStream();\n return parsedCaptions;\n };\n /**\n * Pushes SEI NALUs onto CaptionStream\n * @param {Object[]} nals - A list of SEI nals parsed using `parseCaptionNals`\n * Assumes that `parseCaptionNals` has been called first\n * @see m2ts/caption-stream.js\n **/\n\n\n this.pushNals = function (nals) {\n if (!this.isInitialized() || !nals || nals.length === 0) {\n return null;\n }\n\n nals.forEach(function (nal) {\n captionStream.push(nal);\n });\n };\n /**\n * Flushes underlying CaptionStream to dispatch processed, displayable captions\n * @see m2ts/caption-stream.js\n **/\n\n\n this.flushStream = function () {\n if (!this.isInitialized()) {\n return null;\n }\n\n if (!parsingPartial) {\n captionStream.flush();\n } else {\n captionStream.partialFlush();\n }\n };\n /**\n * Reset caption buckets for new data\n **/\n\n\n this.clearParsedCaptions = function () {\n parsedCaptions.captions = [];\n parsedCaptions.captionStreams = {};\n parsedCaptions.logs = [];\n };\n /**\n * Resets underlying CaptionStream\n * @see m2ts/caption-stream.js\n **/\n\n\n this.resetCaptionStream = function () {\n if (!this.isInitialized()) {\n return null;\n }\n\n captionStream.reset();\n };\n /**\n * Convenience method to clear all captions flushed from the\n * CaptionStream and still being parsed\n * @see m2ts/caption-stream.js\n **/\n\n\n this.clearAllCaptions = function () {\n this.clearParsedCaptions();\n this.resetCaptionStream();\n };\n /**\n * Reset caption parser\n **/\n\n\n this.reset = function () {\n segmentCache = [];\n trackId = null;\n timescale = null;\n\n if (!parsedCaptions) {\n parsedCaptions = {\n captions: [],\n // CC1, CC2, CC3, CC4\n captionStreams: {},\n logs: []\n };\n } else {\n this.clearParsedCaptions();\n }\n\n this.resetCaptionStream();\n };\n\n this.reset();\n };\n\n var captionParser = CaptionParser;\n var toUnsigned = bin.toUnsigned;\n var toHexString = bin.toHexString;\n var getUint64 = numbers.getUint64;\n var timescale, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader;\n /**\n * Parses an MP4 initialization segment and extracts the timescale\n * values for any declared tracks. Timescale values indicate the\n * number of clock ticks per second to assume for time-based values\n * elsewhere in the MP4.\n *\n * To determine the start time of an MP4, you need two pieces of\n * information: the timescale unit and the earliest base media decode\n * time. Multiple timescales can be specified within an MP4 but the\n * base media decode time is always expressed in the timescale from\n * the media header box for the track:\n * ```\n * moov > trak > mdia > mdhd.timescale\n * ```\n * @param init {Uint8Array} the bytes of the init segment\n * @return {object} a hash of track ids to timescale values or null if\n * the init segment is malformed.\n */\n\n timescale = function timescale(init) {\n var result = {},\n traks = findBox_1(init, ['moov', 'trak']); // mdhd timescale\n\n return traks.reduce(function (result, trak) {\n var tkhd, version, index, id, mdhd;\n tkhd = findBox_1(trak, ['tkhd'])[0];\n\n if (!tkhd) {\n return null;\n }\n\n version = tkhd[0];\n index = version === 0 ? 12 : 20;\n id = toUnsigned(tkhd[index] << 24 | tkhd[index + 1] << 16 | tkhd[index + 2] << 8 | tkhd[index + 3]);\n mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0];\n\n if (!mdhd) {\n return null;\n }\n\n version = mdhd[0];\n index = version === 0 ? 12 : 20;\n result[id] = toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]);\n return result;\n }, result);\n };\n /**\n * Determine the base media decode start time, in seconds, for an MP4\n * fragment. If multiple fragments are specified, the earliest time is\n * returned.\n *\n * The base media decode time can be parsed from track fragment\n * metadata:\n * ```\n * moof > traf > tfdt.baseMediaDecodeTime\n * ```\n * It requires the timescale value from the mdhd to interpret.\n *\n * @param timescale {object} a hash of track ids to timescale values.\n * @return {number} the earliest base media decode start time for the\n * fragment, in seconds\n */\n\n\n startTime = function startTime(timescale, fragment) {\n var trafs; // we need info from two childrend of each track fragment box\n\n trafs = findBox_1(fragment, ['moof', 'traf']); // determine the start times for each track\n\n var lowestTime = trafs.reduce(function (acc, traf) {\n var tfhd = findBox_1(traf, ['tfhd'])[0]; // get the track id from the tfhd\n\n var id = toUnsigned(tfhd[4] << 24 | tfhd[5] << 16 | tfhd[6] << 8 | tfhd[7]); // assume a 90kHz clock if no timescale was specified\n\n var scale = timescale[id] || 90e3; // get the base media decode time from the tfdt\n\n var tfdt = findBox_1(traf, ['tfdt'])[0];\n var dv = new DataView(tfdt.buffer, tfdt.byteOffset, tfdt.byteLength);\n var baseTime; // version 1 is 64 bit\n\n if (tfdt[0] === 1) {\n baseTime = getUint64(tfdt.subarray(4, 12));\n } else {\n baseTime = dv.getUint32(4);\n } // convert base time to seconds if it is a valid number.\n\n\n var seconds;\n\n if (typeof baseTime === 'bigint') {\n seconds = baseTime / window_1.BigInt(scale);\n } else if (typeof baseTime === 'number' && !isNaN(baseTime)) {\n seconds = baseTime / scale;\n }\n\n if (seconds < Number.MAX_SAFE_INTEGER) {\n seconds = Number(seconds);\n }\n\n if (seconds < acc) {\n acc = seconds;\n }\n\n return acc;\n }, Infinity);\n return typeof lowestTime === 'bigint' || isFinite(lowestTime) ? lowestTime : 0;\n };\n /**\n * Determine the composition start, in seconds, for an MP4\n * fragment.\n *\n * The composition start time of a fragment can be calculated using the base\n * media decode time, composition time offset, and timescale, as follows:\n *\n * compositionStartTime = (baseMediaDecodeTime + compositionTimeOffset) / timescale\n *\n * All of the aforementioned information is contained within a media fragment's\n * `traf` box, except for timescale info, which comes from the initialization\n * segment, so a track id (also contained within a `traf`) is also necessary to\n * associate it with a timescale\n *\n *\n * @param timescales {object} - a hash of track ids to timescale values.\n * @param fragment {Unit8Array} - the bytes of a media segment\n * @return {number} the composition start time for the fragment, in seconds\n **/\n\n\n compositionStartTime = function compositionStartTime(timescales, fragment) {\n var trafBoxes = findBox_1(fragment, ['moof', 'traf']);\n var baseMediaDecodeTime = 0;\n var compositionTimeOffset = 0;\n var trackId;\n\n if (trafBoxes && trafBoxes.length) {\n // The spec states that track run samples contained within a `traf` box are contiguous, but\n // it does not explicitly state whether the `traf` boxes themselves are contiguous.\n // We will assume that they are, so we only need the first to calculate start time.\n var tfhd = findBox_1(trafBoxes[0], ['tfhd'])[0];\n var trun = findBox_1(trafBoxes[0], ['trun'])[0];\n var tfdt = findBox_1(trafBoxes[0], ['tfdt'])[0];\n\n if (tfhd) {\n var parsedTfhd = parseTfhd(tfhd);\n trackId = parsedTfhd.trackId;\n }\n\n if (tfdt) {\n var parsedTfdt = parseTfdt(tfdt);\n baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime;\n }\n\n if (trun) {\n var parsedTrun = parseTrun(trun);\n\n if (parsedTrun.samples && parsedTrun.samples.length) {\n compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0;\n }\n }\n } // Get timescale for this specific track. Assume a 90kHz clock if no timescale was\n // specified.\n\n\n var timescale = timescales[trackId] || 90e3; // return the composition start time, in seconds\n\n if (typeof baseMediaDecodeTime === 'bigint') {\n compositionTimeOffset = window_1.BigInt(compositionTimeOffset);\n timescale = window_1.BigInt(timescale);\n }\n\n var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale;\n\n if (typeof result === 'bigint' && result < Number.MAX_SAFE_INTEGER) {\n result = Number(result);\n }\n\n return result;\n };\n /**\n * Find the trackIds of the video tracks in this source.\n * Found by parsing the Handler Reference and Track Header Boxes:\n * moov > trak > mdia > hdlr\n * moov > trak > tkhd\n *\n * @param {Uint8Array} init - The bytes of the init segment for this source\n * @return {Number[]} A list of trackIds\n *\n * @see ISO-BMFF-12/2015, Section 8.4.3\n **/\n\n\n getVideoTrackIds = function getVideoTrackIds(init) {\n var traks = findBox_1(init, ['moov', 'trak']);\n var videoTrackIds = [];\n traks.forEach(function (trak) {\n var hdlrs = findBox_1(trak, ['mdia', 'hdlr']);\n var tkhds = findBox_1(trak, ['tkhd']);\n hdlrs.forEach(function (hdlr, index) {\n var handlerType = parseType_1(hdlr.subarray(8, 12));\n var tkhd = tkhds[index];\n var view;\n var version;\n var trackId;\n\n if (handlerType === 'vide') {\n view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength);\n version = view.getUint8(0);\n trackId = version === 0 ? view.getUint32(12) : view.getUint32(20);\n videoTrackIds.push(trackId);\n }\n });\n });\n return videoTrackIds;\n };\n\n getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader(mdhd) {\n // mdhd is a FullBox, meaning it will have its own version as the first byte\n var version = mdhd[0];\n var index = version === 0 ? 12 : 20;\n return toUnsigned(mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]);\n };\n /**\n * Get all the video, audio, and hint tracks from a non fragmented\n * mp4 segment\n */\n\n\n getTracks = function getTracks(init) {\n var traks = findBox_1(init, ['moov', 'trak']);\n var tracks = [];\n traks.forEach(function (trak) {\n var track = {};\n var tkhd = findBox_1(trak, ['tkhd'])[0];\n var view, tkhdVersion; // id\n\n if (tkhd) {\n view = new DataView(tkhd.buffer, tkhd.byteOffset, tkhd.byteLength);\n tkhdVersion = view.getUint8(0);\n track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20);\n }\n\n var hdlr = findBox_1(trak, ['mdia', 'hdlr'])[0]; // type\n\n if (hdlr) {\n var type = parseType_1(hdlr.subarray(8, 12));\n\n if (type === 'vide') {\n track.type = 'video';\n } else if (type === 'soun') {\n track.type = 'audio';\n } else {\n track.type = type;\n }\n } // codec\n\n\n var stsd = findBox_1(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];\n\n if (stsd) {\n var sampleDescriptions = stsd.subarray(8); // gives the codec type string\n\n track.codec = parseType_1(sampleDescriptions.subarray(4, 8));\n var codecBox = findBox_1(sampleDescriptions, [track.codec])[0];\n var codecConfig, codecConfigType;\n\n if (codecBox) {\n // https://tools.ietf.org/html/rfc6381#section-3.3\n if (/^[asm]vc[1-9]$/i.test(track.codec)) {\n // we don't need anything but the \"config\" parameter of the\n // avc1 codecBox\n codecConfig = codecBox.subarray(78);\n codecConfigType = parseType_1(codecConfig.subarray(4, 8));\n\n if (codecConfigType === 'avcC' && codecConfig.length > 11) {\n track.codec += '.'; // left padded with zeroes for single digit hex\n // profile idc\n\n track.codec += toHexString(codecConfig[9]); // the byte containing the constraint_set flags\n\n track.codec += toHexString(codecConfig[10]); // level idc\n\n track.codec += toHexString(codecConfig[11]);\n } else {\n // TODO: show a warning that we couldn't parse the codec\n // and are using the default\n track.codec = 'avc1.4d400d';\n }\n } else if (/^mp4[a,v]$/i.test(track.codec)) {\n // we do not need anything but the streamDescriptor of the mp4a codecBox\n codecConfig = codecBox.subarray(28);\n codecConfigType = parseType_1(codecConfig.subarray(4, 8));\n\n if (codecConfigType === 'esds' && codecConfig.length > 20 && codecConfig[19] !== 0) {\n track.codec += '.' + toHexString(codecConfig[19]); // this value is only a single digit\n\n track.codec += '.' + toHexString(codecConfig[20] >>> 2 & 0x3f).replace(/^0/, '');\n } else {\n // TODO: show a warning that we couldn't parse the codec\n // and are using the default\n track.codec = 'mp4a.40.2';\n }\n } else {\n // flac, opus, etc\n track.codec = track.codec.toLowerCase();\n }\n }\n }\n\n var mdhd = findBox_1(trak, ['mdia', 'mdhd'])[0];\n\n if (mdhd) {\n track.timescale = getTimescaleFromMediaHeader(mdhd);\n }\n\n tracks.push(track);\n });\n return tracks;\n };\n\n var probe$2 = {\n // export mp4 inspector's findBox and parseType for backwards compatibility\n findBox: findBox_1,\n parseType: parseType_1,\n timescale: timescale,\n startTime: startTime,\n compositionStartTime: compositionStartTime,\n videoTrackIds: getVideoTrackIds,\n tracks: getTracks,\n getTimescaleFromMediaHeader: getTimescaleFromMediaHeader\n };\n\n var parsePid = function parsePid(packet) {\n var pid = packet[1] & 0x1f;\n pid <<= 8;\n pid |= packet[2];\n return pid;\n };\n\n var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator(packet) {\n return !!(packet[1] & 0x40);\n };\n\n var parseAdaptionField = function parseAdaptionField(packet) {\n var offset = 0; // if an adaption field is present, its length is specified by the\n // fifth byte of the TS packet header. The adaptation field is\n // used to add stuffing to PES packets that don't fill a complete\n // TS packet, and to specify some forms of timing and control data\n // that we do not currently use.\n\n if ((packet[3] & 0x30) >>> 4 > 0x01) {\n offset += packet[4] + 1;\n }\n\n return offset;\n };\n\n var parseType = function parseType(packet, pmtPid) {\n var pid = parsePid(packet);\n\n if (pid === 0) {\n return 'pat';\n } else if (pid === pmtPid) {\n return 'pmt';\n } else if (pmtPid) {\n return 'pes';\n }\n\n return null;\n };\n\n var parsePat = function parsePat(packet) {\n var pusi = parsePayloadUnitStartIndicator(packet);\n var offset = 4 + parseAdaptionField(packet);\n\n if (pusi) {\n offset += packet[offset] + 1;\n }\n\n return (packet[offset + 10] & 0x1f) << 8 | packet[offset + 11];\n };\n\n var parsePmt = function parsePmt(packet) {\n var programMapTable = {};\n var pusi = parsePayloadUnitStartIndicator(packet);\n var payloadOffset = 4 + parseAdaptionField(packet);\n\n if (pusi) {\n payloadOffset += packet[payloadOffset] + 1;\n } // PMTs can be sent ahead of the time when they should actually\n // take effect. We don't believe this should ever be the case\n // for HLS but we'll ignore \"forward\" PMT declarations if we see\n // them. Future PMT declarations have the current_next_indicator\n // set to zero.\n\n\n if (!(packet[payloadOffset + 5] & 0x01)) {\n return;\n }\n\n var sectionLength, tableEnd, programInfoLength; // the mapping table ends at the end of the current section\n\n sectionLength = (packet[payloadOffset + 1] & 0x0f) << 8 | packet[payloadOffset + 2];\n tableEnd = 3 + sectionLength - 4; // to determine where the table is, we have to figure out how\n // long the program info descriptors are\n\n programInfoLength = (packet[payloadOffset + 10] & 0x0f) << 8 | packet[payloadOffset + 11]; // advance the offset to the first entry in the mapping table\n\n var offset = 12 + programInfoLength;\n\n while (offset < tableEnd) {\n var i = payloadOffset + offset; // add an entry that maps the elementary_pid to the stream_type\n\n programMapTable[(packet[i + 1] & 0x1F) << 8 | packet[i + 2]] = packet[i]; // move to the next table entry\n // skip past the elementary stream descriptors, if present\n\n offset += ((packet[i + 3] & 0x0F) << 8 | packet[i + 4]) + 5;\n }\n\n return programMapTable;\n };\n\n var parsePesType = function parsePesType(packet, programMapTable) {\n var pid = parsePid(packet);\n var type = programMapTable[pid];\n\n switch (type) {\n case streamTypes.H264_STREAM_TYPE:\n return 'video';\n\n case streamTypes.ADTS_STREAM_TYPE:\n return 'audio';\n\n case streamTypes.METADATA_STREAM_TYPE:\n return 'timed-metadata';\n\n default:\n return null;\n }\n };\n\n var parsePesTime = function parsePesTime(packet) {\n var pusi = parsePayloadUnitStartIndicator(packet);\n\n if (!pusi) {\n return null;\n }\n\n var offset = 4 + parseAdaptionField(packet);\n\n if (offset >= packet.byteLength) {\n // From the H 222.0 MPEG-TS spec\n // \"For transport stream packets carrying PES packets, stuffing is needed when there\n // is insufficient PES packet data to completely fill the transport stream packet\n // payload bytes. Stuffing is accomplished by defining an adaptation field longer than\n // the sum of the lengths of the data elements in it, so that the payload bytes\n // remaining after the adaptation field exactly accommodates the available PES packet\n // data.\"\n //\n // If the offset is >= the length of the packet, then the packet contains no data\n // and instead is just adaption field stuffing bytes\n return null;\n }\n\n var pes = null;\n var ptsDtsFlags; // PES packets may be annotated with a PTS value, or a PTS value\n // and a DTS value. Determine what combination of values is\n // available to work with.\n\n ptsDtsFlags = packet[offset + 7]; // PTS and DTS are normally stored as a 33-bit number. Javascript\n // performs all bitwise operations on 32-bit integers but javascript\n // supports a much greater range (52-bits) of integer using standard\n // mathematical operations.\n // We construct a 31-bit value using bitwise operators over the 31\n // most significant bits and then multiply by 4 (equal to a left-shift\n // of 2) before we add the final 2 least significant bits of the\n // timestamp (equal to an OR.)\n\n if (ptsDtsFlags & 0xC0) {\n pes = {}; // the PTS and DTS are not written out directly. For information\n // on how they are encoded, see\n // http://dvd.sourceforge.net/dvdinfo/pes-hdr.html\n\n pes.pts = (packet[offset + 9] & 0x0E) << 27 | (packet[offset + 10] & 0xFF) << 20 | (packet[offset + 11] & 0xFE) << 12 | (packet[offset + 12] & 0xFF) << 5 | (packet[offset + 13] & 0xFE) >>> 3;\n pes.pts *= 4; // Left shift by 2\n\n pes.pts += (packet[offset + 13] & 0x06) >>> 1; // OR by the two LSBs\n\n pes.dts = pes.pts;\n\n if (ptsDtsFlags & 0x40) {\n pes.dts = (packet[offset + 14] & 0x0E) << 27 | (packet[offset + 15] & 0xFF) << 20 | (packet[offset + 16] & 0xFE) << 12 | (packet[offset + 17] & 0xFF) << 5 | (packet[offset + 18] & 0xFE) >>> 3;\n pes.dts *= 4; // Left shift by 2\n\n pes.dts += (packet[offset + 18] & 0x06) >>> 1; // OR by the two LSBs\n }\n }\n\n return pes;\n };\n\n var parseNalUnitType = function parseNalUnitType(type) {\n switch (type) {\n case 0x05:\n return 'slice_layer_without_partitioning_rbsp_idr';\n\n case 0x06:\n return 'sei_rbsp';\n\n case 0x07:\n return 'seq_parameter_set_rbsp';\n\n case 0x08:\n return 'pic_parameter_set_rbsp';\n\n case 0x09:\n return 'access_unit_delimiter_rbsp';\n\n default:\n return null;\n }\n };\n\n var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame(packet) {\n var offset = 4 + parseAdaptionField(packet);\n var frameBuffer = packet.subarray(offset);\n var frameI = 0;\n var frameSyncPoint = 0;\n var foundKeyFrame = false;\n var nalType; // advance the sync point to a NAL start, if necessary\n\n for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) {\n if (frameBuffer[frameSyncPoint + 2] === 1) {\n // the sync point is properly aligned\n frameI = frameSyncPoint + 5;\n break;\n }\n }\n\n while (frameI < frameBuffer.byteLength) {\n // look at the current byte to determine if we've hit the end of\n // a NAL unit boundary\n switch (frameBuffer[frameI]) {\n case 0:\n // skip past non-sync sequences\n if (frameBuffer[frameI - 1] !== 0) {\n frameI += 2;\n break;\n } else if (frameBuffer[frameI - 2] !== 0) {\n frameI++;\n break;\n }\n\n if (frameSyncPoint + 3 !== frameI - 2) {\n nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f);\n\n if (nalType === 'slice_layer_without_partitioning_rbsp_idr') {\n foundKeyFrame = true;\n }\n } // drop trailing zeroes\n\n\n do {\n frameI++;\n } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length);\n\n frameSyncPoint = frameI - 2;\n frameI += 3;\n break;\n\n case 1:\n // skip past non-sync sequences\n if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) {\n frameI += 3;\n break;\n }\n\n nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f);\n\n if (nalType === 'slice_layer_without_partitioning_rbsp_idr') {\n foundKeyFrame = true;\n }\n\n frameSyncPoint = frameI - 2;\n frameI += 3;\n break;\n\n default:\n // the current byte isn't a one or zero, so it cannot be part\n // of a sync sequence\n frameI += 3;\n break;\n }\n }\n\n frameBuffer = frameBuffer.subarray(frameSyncPoint);\n frameI -= frameSyncPoint;\n frameSyncPoint = 0; // parse the final nal\n\n if (frameBuffer && frameBuffer.byteLength > 3) {\n nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 0x1f);\n\n if (nalType === 'slice_layer_without_partitioning_rbsp_idr') {\n foundKeyFrame = true;\n }\n }\n\n return foundKeyFrame;\n };\n\n var probe$1 = {\n parseType: parseType,\n parsePat: parsePat,\n parsePmt: parsePmt,\n parsePayloadUnitStartIndicator: parsePayloadUnitStartIndicator,\n parsePesType: parsePesType,\n parsePesTime: parsePesTime,\n videoPacketContainsKeyFrame: videoPacketContainsKeyFrame\n };\n var handleRollover = timestampRolloverStream.handleRollover;\n var probe = {};\n probe.ts = probe$1;\n probe.aac = utils;\n var ONE_SECOND_IN_TS = clock.ONE_SECOND_IN_TS;\n var MP2T_PACKET_LENGTH = 188,\n // bytes\n SYNC_BYTE = 0x47;\n /**\n * walks through segment data looking for pat and pmt packets to parse out\n * program map table information\n */\n\n var parsePsi_ = function parsePsi_(bytes, pmt) {\n var startIndex = 0,\n endIndex = MP2T_PACKET_LENGTH,\n packet,\n type;\n\n while (endIndex < bytes.byteLength) {\n // Look for a pair of start and end sync bytes in the data..\n if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {\n // We found a packet\n packet = bytes.subarray(startIndex, endIndex);\n type = probe.ts.parseType(packet, pmt.pid);\n\n switch (type) {\n case 'pat':\n pmt.pid = probe.ts.parsePat(packet);\n break;\n\n case 'pmt':\n var table = probe.ts.parsePmt(packet);\n pmt.table = pmt.table || {};\n Object.keys(table).forEach(function (key) {\n pmt.table[key] = table[key];\n });\n break;\n }\n\n startIndex += MP2T_PACKET_LENGTH;\n endIndex += MP2T_PACKET_LENGTH;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n\n startIndex++;\n endIndex++;\n }\n };\n /**\n * walks through the segment data from the start and end to get timing information\n * for the first and last audio pes packets\n */\n\n\n var parseAudioPes_ = function parseAudioPes_(bytes, pmt, result) {\n var startIndex = 0,\n endIndex = MP2T_PACKET_LENGTH,\n packet,\n type,\n pesType,\n pusi,\n parsed;\n var endLoop = false; // Start walking from start of segment to get first audio packet\n\n while (endIndex <= bytes.byteLength) {\n // Look for a pair of start and end sync bytes in the data..\n if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {\n // We found a packet\n packet = bytes.subarray(startIndex, endIndex);\n type = probe.ts.parseType(packet, pmt.pid);\n\n switch (type) {\n case 'pes':\n pesType = probe.ts.parsePesType(packet, pmt.table);\n pusi = probe.ts.parsePayloadUnitStartIndicator(packet);\n\n if (pesType === 'audio' && pusi) {\n parsed = probe.ts.parsePesTime(packet);\n\n if (parsed) {\n parsed.type = 'audio';\n result.audio.push(parsed);\n endLoop = true;\n }\n }\n\n break;\n }\n\n if (endLoop) {\n break;\n }\n\n startIndex += MP2T_PACKET_LENGTH;\n endIndex += MP2T_PACKET_LENGTH;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n\n startIndex++;\n endIndex++;\n } // Start walking from end of segment to get last audio packet\n\n\n endIndex = bytes.byteLength;\n startIndex = endIndex - MP2T_PACKET_LENGTH;\n endLoop = false;\n\n while (startIndex >= 0) {\n // Look for a pair of start and end sync bytes in the data..\n if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {\n // We found a packet\n packet = bytes.subarray(startIndex, endIndex);\n type = probe.ts.parseType(packet, pmt.pid);\n\n switch (type) {\n case 'pes':\n pesType = probe.ts.parsePesType(packet, pmt.table);\n pusi = probe.ts.parsePayloadUnitStartIndicator(packet);\n\n if (pesType === 'audio' && pusi) {\n parsed = probe.ts.parsePesTime(packet);\n\n if (parsed) {\n parsed.type = 'audio';\n result.audio.push(parsed);\n endLoop = true;\n }\n }\n\n break;\n }\n\n if (endLoop) {\n break;\n }\n\n startIndex -= MP2T_PACKET_LENGTH;\n endIndex -= MP2T_PACKET_LENGTH;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n\n startIndex--;\n endIndex--;\n }\n };\n /**\n * walks through the segment data from the start and end to get timing information\n * for the first and last video pes packets as well as timing information for the first\n * key frame.\n */\n\n\n var parseVideoPes_ = function parseVideoPes_(bytes, pmt, result) {\n var startIndex = 0,\n endIndex = MP2T_PACKET_LENGTH,\n packet,\n type,\n pesType,\n pusi,\n parsed,\n frame,\n i,\n pes;\n var endLoop = false;\n var currentFrame = {\n data: [],\n size: 0\n }; // Start walking from start of segment to get first video packet\n\n while (endIndex < bytes.byteLength) {\n // Look for a pair of start and end sync bytes in the data..\n if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {\n // We found a packet\n packet = bytes.subarray(startIndex, endIndex);\n type = probe.ts.parseType(packet, pmt.pid);\n\n switch (type) {\n case 'pes':\n pesType = probe.ts.parsePesType(packet, pmt.table);\n pusi = probe.ts.parsePayloadUnitStartIndicator(packet);\n\n if (pesType === 'video') {\n if (pusi && !endLoop) {\n parsed = probe.ts.parsePesTime(packet);\n\n if (parsed) {\n parsed.type = 'video';\n result.video.push(parsed);\n endLoop = true;\n }\n }\n\n if (!result.firstKeyFrame) {\n if (pusi) {\n if (currentFrame.size !== 0) {\n frame = new Uint8Array(currentFrame.size);\n i = 0;\n\n while (currentFrame.data.length) {\n pes = currentFrame.data.shift();\n frame.set(pes, i);\n i += pes.byteLength;\n }\n\n if (probe.ts.videoPacketContainsKeyFrame(frame)) {\n var firstKeyFrame = probe.ts.parsePesTime(frame); // PTS/DTS may not be available. Simply *not* setting\n // the keyframe seems to work fine with HLS playback\n // and definitely preferable to a crash with TypeError...\n\n if (firstKeyFrame) {\n result.firstKeyFrame = firstKeyFrame;\n result.firstKeyFrame.type = 'video';\n } else {\n // eslint-disable-next-line\n 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.');\n }\n }\n\n currentFrame.size = 0;\n }\n }\n\n currentFrame.data.push(packet);\n currentFrame.size += packet.byteLength;\n }\n }\n\n break;\n }\n\n if (endLoop && result.firstKeyFrame) {\n break;\n }\n\n startIndex += MP2T_PACKET_LENGTH;\n endIndex += MP2T_PACKET_LENGTH;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n\n startIndex++;\n endIndex++;\n } // Start walking from end of segment to get last video packet\n\n\n endIndex = bytes.byteLength;\n startIndex = endIndex - MP2T_PACKET_LENGTH;\n endLoop = false;\n\n while (startIndex >= 0) {\n // Look for a pair of start and end sync bytes in the data..\n if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {\n // We found a packet\n packet = bytes.subarray(startIndex, endIndex);\n type = probe.ts.parseType(packet, pmt.pid);\n\n switch (type) {\n case 'pes':\n pesType = probe.ts.parsePesType(packet, pmt.table);\n pusi = probe.ts.parsePayloadUnitStartIndicator(packet);\n\n if (pesType === 'video' && pusi) {\n parsed = probe.ts.parsePesTime(packet);\n\n if (parsed) {\n parsed.type = 'video';\n result.video.push(parsed);\n endLoop = true;\n }\n }\n\n break;\n }\n\n if (endLoop) {\n break;\n }\n\n startIndex -= MP2T_PACKET_LENGTH;\n endIndex -= MP2T_PACKET_LENGTH;\n continue;\n } // If we get here, we have somehow become de-synchronized and we need to step\n // forward one byte at a time until we find a pair of sync bytes that denote\n // a packet\n\n\n startIndex--;\n endIndex--;\n }\n };\n /**\n * Adjusts the timestamp information for the segment to account for\n * rollover and convert to seconds based on pes packet timescale (90khz clock)\n */\n\n\n var adjustTimestamp_ = function adjustTimestamp_(segmentInfo, baseTimestamp) {\n if (segmentInfo.audio && segmentInfo.audio.length) {\n var audioBaseTimestamp = baseTimestamp;\n\n if (typeof audioBaseTimestamp === 'undefined' || isNaN(audioBaseTimestamp)) {\n audioBaseTimestamp = segmentInfo.audio[0].dts;\n }\n\n segmentInfo.audio.forEach(function (info) {\n info.dts = handleRollover(info.dts, audioBaseTimestamp);\n info.pts = handleRollover(info.pts, audioBaseTimestamp); // time in seconds\n\n info.dtsTime = info.dts / ONE_SECOND_IN_TS;\n info.ptsTime = info.pts / ONE_SECOND_IN_TS;\n });\n }\n\n if (segmentInfo.video && segmentInfo.video.length) {\n var videoBaseTimestamp = baseTimestamp;\n\n if (typeof videoBaseTimestamp === 'undefined' || isNaN(videoBaseTimestamp)) {\n videoBaseTimestamp = segmentInfo.video[0].dts;\n }\n\n segmentInfo.video.forEach(function (info) {\n info.dts = handleRollover(info.dts, videoBaseTimestamp);\n info.pts = handleRollover(info.pts, videoBaseTimestamp); // time in seconds\n\n info.dtsTime = info.dts / ONE_SECOND_IN_TS;\n info.ptsTime = info.pts / ONE_SECOND_IN_TS;\n });\n\n if (segmentInfo.firstKeyFrame) {\n var frame = segmentInfo.firstKeyFrame;\n frame.dts = handleRollover(frame.dts, videoBaseTimestamp);\n frame.pts = handleRollover(frame.pts, videoBaseTimestamp); // time in seconds\n\n frame.dtsTime = frame.dts / ONE_SECOND_IN_TS;\n frame.ptsTime = frame.pts / ONE_SECOND_IN_TS;\n }\n }\n };\n /**\n * inspects the aac data stream for start and end time information\n */\n\n\n var inspectAac_ = function inspectAac_(bytes) {\n var endLoop = false,\n audioCount = 0,\n sampleRate = null,\n timestamp = null,\n frameSize = 0,\n byteIndex = 0,\n packet;\n\n while (bytes.length - byteIndex >= 3) {\n var type = probe.aac.parseType(bytes, byteIndex);\n\n switch (type) {\n case 'timed-metadata':\n // Exit early because we don't have enough to parse\n // the ID3 tag header\n if (bytes.length - byteIndex < 10) {\n endLoop = true;\n break;\n }\n\n frameSize = probe.aac.parseId3TagSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer\n // to emit a full packet\n\n if (frameSize > bytes.length) {\n endLoop = true;\n break;\n }\n\n if (timestamp === null) {\n packet = bytes.subarray(byteIndex, byteIndex + frameSize);\n timestamp = probe.aac.parseAacTimestamp(packet);\n }\n\n byteIndex += frameSize;\n break;\n\n case 'audio':\n // Exit early because we don't have enough to parse\n // the ADTS frame header\n if (bytes.length - byteIndex < 7) {\n endLoop = true;\n break;\n }\n\n frameSize = probe.aac.parseAdtsSize(bytes, byteIndex); // Exit early if we don't have enough in the buffer\n // to emit a full packet\n\n if (frameSize > bytes.length) {\n endLoop = true;\n break;\n }\n\n if (sampleRate === null) {\n packet = bytes.subarray(byteIndex, byteIndex + frameSize);\n sampleRate = probe.aac.parseSampleRate(packet);\n }\n\n audioCount++;\n byteIndex += frameSize;\n break;\n\n default:\n byteIndex++;\n break;\n }\n\n if (endLoop) {\n return null;\n }\n }\n\n if (sampleRate === null || timestamp === null) {\n return null;\n }\n\n var audioTimescale = ONE_SECOND_IN_TS / sampleRate;\n var result = {\n audio: [{\n type: 'audio',\n dts: timestamp,\n pts: timestamp\n }, {\n type: 'audio',\n dts: timestamp + audioCount * 1024 * audioTimescale,\n pts: timestamp + audioCount * 1024 * audioTimescale\n }]\n };\n return result;\n };\n /**\n * inspects the transport stream segment data for start and end time information\n * of the audio and video tracks (when present) as well as the first key frame's\n * start time.\n */\n\n\n var inspectTs_ = function inspectTs_(bytes) {\n var pmt = {\n pid: null,\n table: null\n };\n var result = {};\n parsePsi_(bytes, pmt);\n\n for (var pid in pmt.table) {\n if (pmt.table.hasOwnProperty(pid)) {\n var type = pmt.table[pid];\n\n switch (type) {\n case streamTypes.H264_STREAM_TYPE:\n result.video = [];\n parseVideoPes_(bytes, pmt, result);\n\n if (result.video.length === 0) {\n delete result.video;\n }\n\n break;\n\n case streamTypes.ADTS_STREAM_TYPE:\n result.audio = [];\n parseAudioPes_(bytes, pmt, result);\n\n if (result.audio.length === 0) {\n delete result.audio;\n }\n\n break;\n }\n }\n }\n\n return result;\n };\n /**\n * Inspects segment byte data and returns an object with start and end timing information\n *\n * @param {Uint8Array} bytes The segment byte data\n * @param {Number} baseTimestamp Relative reference timestamp used when adjusting frame\n * timestamps for rollover. This value must be in 90khz clock.\n * @return {Object} Object containing start and end frame timing info of segment.\n */\n\n\n var inspect = function inspect(bytes, baseTimestamp) {\n var isAacData = probe.aac.isLikelyAacData(bytes);\n var result;\n\n if (isAacData) {\n result = inspectAac_(bytes);\n } else {\n result = inspectTs_(bytes);\n }\n\n if (!result || !result.audio && !result.video) {\n return null;\n }\n\n adjustTimestamp_(result, baseTimestamp);\n return result;\n };\n\n var tsInspector = {\n inspect: inspect,\n parseAudioPes_: parseAudioPes_\n };\n /* global self */\n\n /**\n * Re-emits transmuxer events by converting them into messages to the\n * world outside the worker.\n *\n * @param {Object} transmuxer the transmuxer to wire events on\n * @private\n */\n\n var wireTransmuxerEvents = function wireTransmuxerEvents(self, transmuxer) {\n transmuxer.on('data', function (segment) {\n // transfer ownership of the underlying ArrayBuffer\n // instead of doing a copy to save memory\n // ArrayBuffers are transferable but generic TypedArrays are not\n // @link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers#Passing_data_by_transferring_ownership_(transferable_objects)\n var initArray = segment.initSegment;\n segment.initSegment = {\n data: initArray.buffer,\n byteOffset: initArray.byteOffset,\n byteLength: initArray.byteLength\n };\n var typedArray = segment.data;\n segment.data = typedArray.buffer;\n self.postMessage({\n action: 'data',\n segment: segment,\n byteOffset: typedArray.byteOffset,\n byteLength: typedArray.byteLength\n }, [segment.data]);\n });\n transmuxer.on('done', function (data) {\n self.postMessage({\n action: 'done'\n });\n });\n transmuxer.on('gopInfo', function (gopInfo) {\n self.postMessage({\n action: 'gopInfo',\n gopInfo: gopInfo\n });\n });\n transmuxer.on('videoSegmentTimingInfo', function (timingInfo) {\n var videoSegmentTimingInfo = {\n start: {\n decode: clock.videoTsToSeconds(timingInfo.start.dts),\n presentation: clock.videoTsToSeconds(timingInfo.start.pts)\n },\n end: {\n decode: clock.videoTsToSeconds(timingInfo.end.dts),\n presentation: clock.videoTsToSeconds(timingInfo.end.pts)\n },\n baseMediaDecodeTime: clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime)\n };\n\n if (timingInfo.prependedContentDuration) {\n videoSegmentTimingInfo.prependedContentDuration = clock.videoTsToSeconds(timingInfo.prependedContentDuration);\n }\n\n self.postMessage({\n action: 'videoSegmentTimingInfo',\n videoSegmentTimingInfo: videoSegmentTimingInfo\n });\n });\n transmuxer.on('audioSegmentTimingInfo', function (timingInfo) {\n // Note that all times for [audio/video]SegmentTimingInfo events are in video clock\n var audioSegmentTimingInfo = {\n start: {\n decode: clock.videoTsToSeconds(timingInfo.start.dts),\n presentation: clock.videoTsToSeconds(timingInfo.start.pts)\n },\n end: {\n decode: clock.videoTsToSeconds(timingInfo.end.dts),\n presentation: clock.videoTsToSeconds(timingInfo.end.pts)\n },\n baseMediaDecodeTime: clock.videoTsToSeconds(timingInfo.baseMediaDecodeTime)\n };\n\n if (timingInfo.prependedContentDuration) {\n audioSegmentTimingInfo.prependedContentDuration = clock.videoTsToSeconds(timingInfo.prependedContentDuration);\n }\n\n self.postMessage({\n action: 'audioSegmentTimingInfo',\n audioSegmentTimingInfo: audioSegmentTimingInfo\n });\n });\n transmuxer.on('id3Frame', function (id3Frame) {\n self.postMessage({\n action: 'id3Frame',\n id3Frame: id3Frame\n });\n });\n transmuxer.on('caption', function (caption) {\n self.postMessage({\n action: 'caption',\n caption: caption\n });\n });\n transmuxer.on('trackinfo', function (trackInfo) {\n self.postMessage({\n action: 'trackinfo',\n trackInfo: trackInfo\n });\n });\n transmuxer.on('audioTimingInfo', function (audioTimingInfo) {\n // convert to video TS since we prioritize video time over audio\n self.postMessage({\n action: 'audioTimingInfo',\n audioTimingInfo: {\n start: clock.videoTsToSeconds(audioTimingInfo.start),\n end: clock.videoTsToSeconds(audioTimingInfo.end)\n }\n });\n });\n transmuxer.on('videoTimingInfo', function (videoTimingInfo) {\n self.postMessage({\n action: 'videoTimingInfo',\n videoTimingInfo: {\n start: clock.videoTsToSeconds(videoTimingInfo.start),\n end: clock.videoTsToSeconds(videoTimingInfo.end)\n }\n });\n });\n transmuxer.on('log', function (log) {\n self.postMessage({\n action: 'log',\n log: log\n });\n });\n };\n /**\n * All incoming messages route through this hash. If no function exists\n * to handle an incoming message, then we ignore the message.\n *\n * @class MessageHandlers\n * @param {Object} options the options to initialize with\n */\n\n\n var MessageHandlers = /*#__PURE__*/function () {\n function MessageHandlers(self, options) {\n this.options = options || {};\n this.self = self;\n this.init();\n }\n /**\n * initialize our web worker and wire all the events.\n */\n\n\n var _proto = MessageHandlers.prototype;\n\n _proto.init = function init() {\n if (this.transmuxer) {\n this.transmuxer.dispose();\n }\n\n this.transmuxer = new transmuxer.Transmuxer(this.options);\n wireTransmuxerEvents(this.self, this.transmuxer);\n };\n\n _proto.pushMp4Captions = function pushMp4Captions(data) {\n if (!this.captionParser) {\n this.captionParser = new captionParser();\n this.captionParser.init();\n }\n\n var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);\n var parsed = this.captionParser.parse(segment, data.trackIds, data.timescales);\n this.self.postMessage({\n action: 'mp4Captions',\n captions: parsed && parsed.captions || [],\n logs: parsed && parsed.logs || [],\n data: segment.buffer\n }, [segment.buffer]);\n };\n\n _proto.probeMp4StartTime = function probeMp4StartTime(_ref) {\n var timescales = _ref.timescales,\n data = _ref.data;\n var startTime = probe$2.startTime(timescales, data);\n this.self.postMessage({\n action: 'probeMp4StartTime',\n startTime: startTime,\n data: data\n }, [data.buffer]);\n };\n\n _proto.probeMp4Tracks = function probeMp4Tracks(_ref2) {\n var data = _ref2.data;\n var tracks = probe$2.tracks(data);\n this.self.postMessage({\n action: 'probeMp4Tracks',\n tracks: tracks,\n data: data\n }, [data.buffer]);\n }\n /**\n * Probe an mpeg2-ts segment to determine the start time of the segment in it's\n * internal \"media time,\" as well as whether it contains video and/or audio.\n *\n * @private\n * @param {Uint8Array} bytes - segment bytes\n * @param {number} baseStartTime\n * Relative reference timestamp used when adjusting frame timestamps for rollover.\n * This value should be in seconds, as it's converted to a 90khz clock within the\n * function body.\n * @return {Object} The start time of the current segment in \"media time\" as well as\n * whether it contains video and/or audio\n */\n ;\n\n _proto.probeTs = function probeTs(_ref3) {\n var data = _ref3.data,\n baseStartTime = _ref3.baseStartTime;\n var tsStartTime = typeof baseStartTime === 'number' && !isNaN(baseStartTime) ? baseStartTime * clock.ONE_SECOND_IN_TS : void 0;\n var timeInfo = tsInspector.inspect(data, tsStartTime);\n var result = null;\n\n if (timeInfo) {\n result = {\n // each type's time info comes back as an array of 2 times, start and end\n hasVideo: timeInfo.video && timeInfo.video.length === 2 || false,\n hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false\n };\n\n if (result.hasVideo) {\n result.videoStart = timeInfo.video[0].ptsTime;\n }\n\n if (result.hasAudio) {\n result.audioStart = timeInfo.audio[0].ptsTime;\n }\n }\n\n this.self.postMessage({\n action: 'probeTs',\n result: result,\n data: data\n }, [data.buffer]);\n };\n\n _proto.clearAllMp4Captions = function clearAllMp4Captions() {\n if (this.captionParser) {\n this.captionParser.clearAllCaptions();\n }\n };\n\n _proto.clearParsedMp4Captions = function clearParsedMp4Captions() {\n if (this.captionParser) {\n this.captionParser.clearParsedCaptions();\n }\n }\n /**\n * Adds data (a ts segment) to the start of the transmuxer pipeline for\n * processing.\n *\n * @param {ArrayBuffer} data data to push into the muxer\n */\n ;\n\n _proto.push = function push(data) {\n // Cast array buffer to correct type for transmuxer\n var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);\n this.transmuxer.push(segment);\n }\n /**\n * Recreate the transmuxer so that the next segment added via `push`\n * start with a fresh transmuxer.\n */\n ;\n\n _proto.reset = function reset() {\n this.transmuxer.reset();\n }\n /**\n * Set the value that will be used as the `baseMediaDecodeTime` time for the\n * next segment pushed in. Subsequent segments will have their `baseMediaDecodeTime`\n * set relative to the first based on the PTS values.\n *\n * @param {Object} data used to set the timestamp offset in the muxer\n */\n ;\n\n _proto.setTimestampOffset = function setTimestampOffset(data) {\n var timestampOffset = data.timestampOffset || 0;\n this.transmuxer.setBaseMediaDecodeTime(Math.round(clock.secondsToVideoTs(timestampOffset)));\n };\n\n _proto.setAudioAppendStart = function setAudioAppendStart(data) {\n this.transmuxer.setAudioAppendStart(Math.ceil(clock.secondsToVideoTs(data.appendStart)));\n };\n\n _proto.setRemux = function setRemux(data) {\n this.transmuxer.setRemux(data.remux);\n }\n /**\n * Forces the pipeline to finish processing the last segment and emit it's\n * results.\n *\n * @param {Object} data event data, not really used\n */\n ;\n\n _proto.flush = function flush(data) {\n this.transmuxer.flush(); // transmuxed done action is fired after both audio/video pipelines are flushed\n\n self.postMessage({\n action: 'done',\n type: 'transmuxed'\n });\n };\n\n _proto.endTimeline = function endTimeline() {\n this.transmuxer.endTimeline(); // transmuxed endedtimeline action is fired after both audio/video pipelines end their\n // timelines\n\n self.postMessage({\n action: 'endedtimeline',\n type: 'transmuxed'\n });\n };\n\n _proto.alignGopsWith = function alignGopsWith(data) {\n this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice());\n };\n\n return MessageHandlers;\n }();\n /**\n * Our web worker interface so that things can talk to mux.js\n * that will be running in a web worker. the scope is passed to this by\n * webworkify.\n *\n * @param {Object} self the scope for the web worker\n */\n\n\n self.onmessage = function (event) {\n if (event.data.action === 'init' && event.data.options) {\n this.messageHandlers = new MessageHandlers(self, event.data.options);\n return;\n }\n\n if (!this.messageHandlers) {\n this.messageHandlers = new MessageHandlers(self);\n }\n\n if (event.data && event.data.action && event.data.action !== 'init') {\n if (this.messageHandlers[event.data.action]) {\n this.messageHandlers[event.data.action](event.data);\n }\n }\n };\n}));\nvar TransmuxWorker = factory(workerCode$1);\n/* rollup-plugin-worker-factory end for worker!/Users/ddashkevich/projects/http-streaming/src/transmuxer-worker.js */\n\nvar handleData_ = function handleData_(event, transmuxedData, callback) {\n var _event$data$segment = event.data.segment,\n type = _event$data$segment.type,\n initSegment = _event$data$segment.initSegment,\n captions = _event$data$segment.captions,\n captionStreams = _event$data$segment.captionStreams,\n metadata = _event$data$segment.metadata,\n videoFrameDtsTime = _event$data$segment.videoFrameDtsTime,\n videoFramePtsTime = _event$data$segment.videoFramePtsTime;\n transmuxedData.buffer.push({\n captions: captions,\n captionStreams: captionStreams,\n metadata: metadata\n });\n var boxes = event.data.segment.boxes || {\n data: event.data.segment.data\n };\n var result = {\n type: type,\n // cast ArrayBuffer to TypedArray\n data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength),\n initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength)\n };\n\n if (typeof videoFrameDtsTime !== 'undefined') {\n result.videoFrameDtsTime = videoFrameDtsTime;\n }\n\n if (typeof videoFramePtsTime !== 'undefined') {\n result.videoFramePtsTime = videoFramePtsTime;\n }\n\n callback(result);\n};\n\nvar handleDone_ = function handleDone_(_ref) {\n var transmuxedData = _ref.transmuxedData,\n callback = _ref.callback; // Previously we only returned data on data events,\n // not on done events. Clear out the buffer to keep that consistent.\n\n transmuxedData.buffer = []; // all buffers should have been flushed from the muxer, so start processing anything we\n // have received\n\n callback(transmuxedData);\n};\n\nvar handleGopInfo_ = function handleGopInfo_(event, transmuxedData) {\n transmuxedData.gopInfo = event.data.gopInfo;\n};\n\nvar processTransmux = function processTransmux(options) {\n var transmuxer = options.transmuxer,\n bytes = options.bytes,\n audioAppendStart = options.audioAppendStart,\n gopsToAlignWith = options.gopsToAlignWith,\n remux = options.remux,\n onData = options.onData,\n onTrackInfo = options.onTrackInfo,\n onAudioTimingInfo = options.onAudioTimingInfo,\n onVideoTimingInfo = options.onVideoTimingInfo,\n onVideoSegmentTimingInfo = options.onVideoSegmentTimingInfo,\n onAudioSegmentTimingInfo = options.onAudioSegmentTimingInfo,\n onId3 = options.onId3,\n onCaptions = options.onCaptions,\n onDone = options.onDone,\n onEndedTimeline = options.onEndedTimeline,\n onTransmuxerLog = options.onTransmuxerLog,\n isEndOfTimeline = options.isEndOfTimeline;\n var transmuxedData = {\n buffer: []\n };\n var waitForEndedTimelineEvent = isEndOfTimeline;\n\n var handleMessage = function handleMessage(event) {\n if (transmuxer.currentTransmux !== options) {\n // disposed\n return;\n }\n\n if (event.data.action === 'data') {\n handleData_(event, transmuxedData, onData);\n }\n\n if (event.data.action === 'trackinfo') {\n onTrackInfo(event.data.trackInfo);\n }\n\n if (event.data.action === 'gopInfo') {\n handleGopInfo_(event, transmuxedData);\n }\n\n if (event.data.action === 'audioTimingInfo') {\n onAudioTimingInfo(event.data.audioTimingInfo);\n }\n\n if (event.data.action === 'videoTimingInfo') {\n onVideoTimingInfo(event.data.videoTimingInfo);\n }\n\n if (event.data.action === 'videoSegmentTimingInfo') {\n onVideoSegmentTimingInfo(event.data.videoSegmentTimingInfo);\n }\n\n if (event.data.action === 'audioSegmentTimingInfo') {\n onAudioSegmentTimingInfo(event.data.audioSegmentTimingInfo);\n }\n\n if (event.data.action === 'id3Frame') {\n onId3([event.data.id3Frame], event.data.id3Frame.dispatchType);\n }\n\n if (event.data.action === 'caption') {\n onCaptions(event.data.caption);\n }\n\n if (event.data.action === 'endedtimeline') {\n waitForEndedTimelineEvent = false;\n onEndedTimeline();\n }\n\n if (event.data.action === 'log') {\n onTransmuxerLog(event.data.log);\n } // wait for the transmuxed event since we may have audio and video\n\n\n if (event.data.type !== 'transmuxed') {\n return;\n } // If the \"endedtimeline\" event has not yet fired, and this segment represents the end\n // of a timeline, that means there may still be data events before the segment\n // processing can be considerred complete. In that case, the final event should be\n // an \"endedtimeline\" event with the type \"transmuxed.\"\n\n\n if (waitForEndedTimelineEvent) {\n return;\n }\n\n transmuxer.onmessage = null;\n handleDone_({\n transmuxedData: transmuxedData,\n callback: onDone\n });\n /* eslint-disable no-use-before-define */\n\n dequeue(transmuxer);\n /* eslint-enable */\n };\n\n transmuxer.onmessage = handleMessage;\n\n if (audioAppendStart) {\n transmuxer.postMessage({\n action: 'setAudioAppendStart',\n appendStart: audioAppendStart\n });\n } // allow empty arrays to be passed to clear out GOPs\n\n\n if (Array.isArray(gopsToAlignWith)) {\n transmuxer.postMessage({\n action: 'alignGopsWith',\n gopsToAlignWith: gopsToAlignWith\n });\n }\n\n if (typeof remux !== 'undefined') {\n transmuxer.postMessage({\n action: 'setRemux',\n remux: remux\n });\n }\n\n if (bytes.byteLength) {\n var buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer;\n var byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset;\n transmuxer.postMessage({\n action: 'push',\n // Send the typed-array of data as an ArrayBuffer so that\n // it can be sent as a \"Transferable\" and avoid the costly\n // memory copy\n data: buffer,\n // To recreate the original typed-array, we need information\n // about what portion of the ArrayBuffer it was a view into\n byteOffset: byteOffset,\n byteLength: bytes.byteLength\n }, [buffer]);\n }\n\n if (isEndOfTimeline) {\n transmuxer.postMessage({\n action: 'endTimeline'\n });\n } // even if we didn't push any bytes, we have to make sure we flush in case we reached\n // the end of the segment\n\n\n transmuxer.postMessage({\n action: 'flush'\n });\n};\n\nvar dequeue = function dequeue(transmuxer) {\n transmuxer.currentTransmux = null;\n\n if (transmuxer.transmuxQueue.length) {\n transmuxer.currentTransmux = transmuxer.transmuxQueue.shift();\n\n if (typeof transmuxer.currentTransmux === 'function') {\n transmuxer.currentTransmux();\n } else {\n processTransmux(transmuxer.currentTransmux);\n }\n }\n};\n\nvar processAction = function processAction(transmuxer, action) {\n transmuxer.postMessage({\n action: action\n });\n dequeue(transmuxer);\n};\n\nvar enqueueAction = function enqueueAction(action, transmuxer) {\n if (!transmuxer.currentTransmux) {\n transmuxer.currentTransmux = action;\n processAction(transmuxer, action);\n return;\n }\n\n transmuxer.transmuxQueue.push(processAction.bind(null, transmuxer, action));\n};\n\nvar reset = function reset(transmuxer) {\n enqueueAction('reset', transmuxer);\n};\n\nvar endTimeline = function endTimeline(transmuxer) {\n enqueueAction('endTimeline', transmuxer);\n};\n\nvar transmux = function transmux(options) {\n if (!options.transmuxer.currentTransmux) {\n options.transmuxer.currentTransmux = options;\n processTransmux(options);\n return;\n }\n\n options.transmuxer.transmuxQueue.push(options);\n};\n\nvar createTransmuxer = function createTransmuxer(options) {\n var transmuxer = new TransmuxWorker();\n transmuxer.currentTransmux = null;\n transmuxer.transmuxQueue = [];\n var term = transmuxer.terminate;\n\n transmuxer.terminate = function () {\n transmuxer.currentTransmux = null;\n transmuxer.transmuxQueue.length = 0;\n return term.call(transmuxer);\n };\n\n transmuxer.postMessage({\n action: 'init',\n options: options\n });\n return transmuxer;\n};\n\nvar segmentTransmuxer = {\n reset: reset,\n endTimeline: endTimeline,\n transmux: transmux,\n createTransmuxer: createTransmuxer\n};\n\nvar workerCallback = function workerCallback(options) {\n var transmuxer = options.transmuxer;\n var endAction = options.endAction || options.action;\n var callback = options.callback;\n\n var message = (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_2__[\"default\"])({}, options, {\n endAction: null,\n transmuxer: null,\n callback: null\n });\n\n var listenForEndEvent = function listenForEndEvent(event) {\n if (event.data.action !== endAction) {\n return;\n }\n\n transmuxer.removeEventListener('message', listenForEndEvent); // transfer ownership of bytes back to us.\n\n if (event.data.data) {\n event.data.data = new Uint8Array(event.data.data, options.byteOffset || 0, options.byteLength || event.data.data.byteLength);\n\n if (options.data) {\n options.data = event.data.data;\n }\n }\n\n callback(event.data);\n };\n\n transmuxer.addEventListener('message', listenForEndEvent);\n\n if (options.data) {\n var isArrayBuffer = options.data instanceof ArrayBuffer;\n message.byteOffset = isArrayBuffer ? 0 : options.data.byteOffset;\n message.byteLength = options.data.byteLength;\n var transfers = [isArrayBuffer ? options.data : options.data.buffer];\n transmuxer.postMessage(message, transfers);\n } else {\n transmuxer.postMessage(message);\n }\n};\n\nvar REQUEST_ERRORS = {\n FAILURE: 2,\n TIMEOUT: -101,\n ABORTED: -102\n};\n/**\n * Abort all requests\n *\n * @param {Object} activeXhrs - an object that tracks all XHR requests\n */\n\nvar abortAll = function abortAll(activeXhrs) {\n activeXhrs.forEach(function (xhr) {\n xhr.abort();\n });\n};\n/**\n * Gather important bandwidth stats once a request has completed\n *\n * @param {Object} request - the XHR request from which to gather stats\n */\n\n\nvar getRequestStats = function getRequestStats(request) {\n return {\n bandwidth: request.bandwidth,\n bytesReceived: request.bytesReceived || 0,\n roundTripTime: request.roundTripTime || 0\n };\n};\n/**\n * If possible gather bandwidth stats as a request is in\n * progress\n *\n * @param {Event} progressEvent - an event object from an XHR's progress event\n */\n\n\nvar getProgressStats = function getProgressStats(progressEvent) {\n var request = progressEvent.target;\n var roundTripTime = Date.now() - request.requestTime;\n var stats = {\n bandwidth: Infinity,\n bytesReceived: 0,\n roundTripTime: roundTripTime || 0\n };\n stats.bytesReceived = progressEvent.loaded; // This can result in Infinity if stats.roundTripTime is 0 but that is ok\n // because we should only use bandwidth stats on progress to determine when\n // abort a request early due to insufficient bandwidth\n\n stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1000);\n return stats;\n};\n/**\n * Handle all error conditions in one place and return an object\n * with all the information\n *\n * @param {Error|null} error - if non-null signals an error occured with the XHR\n * @param {Object} request - the XHR request that possibly generated the error\n */\n\n\nvar handleErrors = function handleErrors(error, request) {\n if (request.timedout) {\n return {\n status: request.status,\n message: 'HLS request timed-out at URL: ' + request.uri,\n code: REQUEST_ERRORS.TIMEOUT,\n xhr: request\n };\n }\n\n if (request.aborted) {\n return {\n status: request.status,\n message: 'HLS request aborted at URL: ' + request.uri,\n code: REQUEST_ERRORS.ABORTED,\n xhr: request\n };\n }\n\n if (error) {\n return {\n status: request.status,\n message: 'HLS request errored at URL: ' + request.uri,\n code: REQUEST_ERRORS.FAILURE,\n xhr: request\n };\n }\n\n if (request.responseType === 'arraybuffer' && request.response.byteLength === 0) {\n return {\n status: request.status,\n message: 'Empty HLS response at URL: ' + request.uri,\n code: REQUEST_ERRORS.FAILURE,\n xhr: request\n };\n }\n\n return null;\n};\n/**\n * Handle responses for key data and convert the key data to the correct format\n * for the decryption step later\n *\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Array} objects - objects to add the key bytes to.\n * @param {Function} finishProcessingFn - a callback to execute to continue processing\n * this request\n */\n\n\nvar handleKeyResponse = function handleKeyResponse(segment, objects, finishProcessingFn) {\n return function (error, request) {\n var response = request.response;\n var errorObj = handleErrors(error, request);\n\n if (errorObj) {\n return finishProcessingFn(errorObj, segment);\n }\n\n if (response.byteLength !== 16) {\n return finishProcessingFn({\n status: request.status,\n message: 'Invalid HLS key at URL: ' + request.uri,\n code: REQUEST_ERRORS.FAILURE,\n xhr: request\n }, segment);\n }\n\n var view = new DataView(response);\n var bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]);\n\n for (var i = 0; i < objects.length; i++) {\n objects[i].bytes = bytes;\n }\n\n return finishProcessingFn(null, segment);\n };\n};\n\nvar parseInitSegment = function parseInitSegment(segment, _callback) {\n var type = (0,_videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_19__.detectContainerForBytes)(segment.map.bytes); // TODO: We should also handle ts init segments here, but we\n // only know how to parse mp4 init segments at the moment\n\n if (type !== 'mp4') {\n var uri = segment.map.resolvedUri || segment.map.uri;\n return _callback({\n internal: true,\n message: \"Found unsupported \" + (type || 'unknown') + \" container for initialization segment at URL: \" + uri,\n code: REQUEST_ERRORS.FAILURE\n });\n }\n\n workerCallback({\n action: 'probeMp4Tracks',\n data: segment.map.bytes,\n transmuxer: segment.transmuxer,\n callback: function callback(_ref) {\n var tracks = _ref.tracks,\n data = _ref.data; // transfer bytes back to us\n\n segment.map.bytes = data;\n tracks.forEach(function (track) {\n segment.map.tracks = segment.map.tracks || {}; // only support one track of each type for now\n\n if (segment.map.tracks[track.type]) {\n return;\n }\n\n segment.map.tracks[track.type] = track;\n\n if (typeof track.id === 'number' && track.timescale) {\n segment.map.timescales = segment.map.timescales || {};\n segment.map.timescales[track.id] = track.timescale;\n }\n });\n return _callback(null);\n }\n });\n};\n/**\n * Handle init-segment responses\n *\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Function} finishProcessingFn - a callback to execute to continue processing\n * this request\n */\n\n\nvar handleInitSegmentResponse = function handleInitSegmentResponse(_ref2) {\n var segment = _ref2.segment,\n finishProcessingFn = _ref2.finishProcessingFn;\n return function (error, request) {\n var errorObj = handleErrors(error, request);\n\n if (errorObj) {\n return finishProcessingFn(errorObj, segment);\n }\n\n var bytes = new Uint8Array(request.response); // init segment is encypted, we will have to wait\n // until the key request is done to decrypt.\n\n if (segment.map.key) {\n segment.map.encryptedBytes = bytes;\n return finishProcessingFn(null, segment);\n }\n\n segment.map.bytes = bytes;\n parseInitSegment(segment, function (parseError) {\n if (parseError) {\n parseError.xhr = request;\n parseError.status = request.status;\n return finishProcessingFn(parseError, segment);\n }\n\n finishProcessingFn(null, segment);\n });\n };\n};\n/**\n * Response handler for segment-requests being sure to set the correct\n * property depending on whether the segment is encryped or not\n * Also records and keeps track of stats that are used for ABR purposes\n *\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Function} finishProcessingFn - a callback to execute to continue processing\n * this request\n */\n\n\nvar handleSegmentResponse = function handleSegmentResponse(_ref3) {\n var segment = _ref3.segment,\n finishProcessingFn = _ref3.finishProcessingFn,\n responseType = _ref3.responseType;\n return function (error, request) {\n var errorObj = handleErrors(error, request);\n\n if (errorObj) {\n return finishProcessingFn(errorObj, segment);\n }\n\n var newBytes = // although responseText \"should\" exist, this guard serves to prevent an error being\n // thrown for two primary cases:\n // 1. the mime type override stops working, or is not implemented for a specific\n // browser\n // 2. when using mock XHR libraries like sinon that do not allow the override behavior\n responseType === 'arraybuffer' || !request.responseText ? request.response : stringToArrayBuffer(request.responseText.substring(segment.lastReachedChar || 0));\n segment.stats = getRequestStats(request);\n\n if (segment.key) {\n segment.encryptedBytes = new Uint8Array(newBytes);\n } else {\n segment.bytes = new Uint8Array(newBytes);\n }\n\n return finishProcessingFn(null, segment);\n };\n};\n\nvar transmuxAndNotify = function transmuxAndNotify(_ref4) {\n var segment = _ref4.segment,\n bytes = _ref4.bytes,\n trackInfoFn = _ref4.trackInfoFn,\n timingInfoFn = _ref4.timingInfoFn,\n videoSegmentTimingInfoFn = _ref4.videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn = _ref4.audioSegmentTimingInfoFn,\n id3Fn = _ref4.id3Fn,\n captionsFn = _ref4.captionsFn,\n isEndOfTimeline = _ref4.isEndOfTimeline,\n endedTimelineFn = _ref4.endedTimelineFn,\n dataFn = _ref4.dataFn,\n doneFn = _ref4.doneFn,\n onTransmuxerLog = _ref4.onTransmuxerLog;\n var fmp4Tracks = segment.map && segment.map.tracks || {};\n var isMuxed = Boolean(fmp4Tracks.audio && fmp4Tracks.video); // Keep references to each function so we can null them out after we're done with them.\n // One reason for this is that in the case of full segments, we want to trust start\n // times from the probe, rather than the transmuxer.\n\n var audioStartFn = timingInfoFn.bind(null, segment, 'audio', 'start');\n var audioEndFn = timingInfoFn.bind(null, segment, 'audio', 'end');\n var videoStartFn = timingInfoFn.bind(null, segment, 'video', 'start');\n var videoEndFn = timingInfoFn.bind(null, segment, 'video', 'end');\n\n var finish = function finish() {\n return transmux({\n bytes: bytes,\n transmuxer: segment.transmuxer,\n audioAppendStart: segment.audioAppendStart,\n gopsToAlignWith: segment.gopsToAlignWith,\n remux: isMuxed,\n onData: function onData(result) {\n result.type = result.type === 'combined' ? 'video' : result.type;\n dataFn(segment, result);\n },\n onTrackInfo: function onTrackInfo(trackInfo) {\n if (trackInfoFn) {\n if (isMuxed) {\n trackInfo.isMuxed = true;\n }\n\n trackInfoFn(segment, trackInfo);\n }\n },\n onAudioTimingInfo: function onAudioTimingInfo(audioTimingInfo) {\n // we only want the first start value we encounter\n if (audioStartFn && typeof audioTimingInfo.start !== 'undefined') {\n audioStartFn(audioTimingInfo.start);\n audioStartFn = null;\n } // we want to continually update the end time\n\n\n if (audioEndFn && typeof audioTimingInfo.end !== 'undefined') {\n audioEndFn(audioTimingInfo.end);\n }\n },\n onVideoTimingInfo: function onVideoTimingInfo(videoTimingInfo) {\n // we only want the first start value we encounter\n if (videoStartFn && typeof videoTimingInfo.start !== 'undefined') {\n videoStartFn(videoTimingInfo.start);\n videoStartFn = null;\n } // we want to continually update the end time\n\n\n if (videoEndFn && typeof videoTimingInfo.end !== 'undefined') {\n videoEndFn(videoTimingInfo.end);\n }\n },\n onVideoSegmentTimingInfo: function onVideoSegmentTimingInfo(videoSegmentTimingInfo) {\n videoSegmentTimingInfoFn(videoSegmentTimingInfo);\n },\n onAudioSegmentTimingInfo: function onAudioSegmentTimingInfo(audioSegmentTimingInfo) {\n audioSegmentTimingInfoFn(audioSegmentTimingInfo);\n },\n onId3: function onId3(id3Frames, dispatchType) {\n id3Fn(segment, id3Frames, dispatchType);\n },\n onCaptions: function onCaptions(captions) {\n captionsFn(segment, [captions]);\n },\n isEndOfTimeline: isEndOfTimeline,\n onEndedTimeline: function onEndedTimeline() {\n endedTimelineFn();\n },\n onTransmuxerLog: onTransmuxerLog,\n onDone: function onDone(result) {\n if (!doneFn) {\n return;\n }\n\n result.type = result.type === 'combined' ? 'video' : result.type;\n doneFn(null, segment, result);\n }\n });\n }; // In the transmuxer, we don't yet have the ability to extract a \"proper\" start time.\n // Meaning cached frame data may corrupt our notion of where this segment\n // really starts. To get around this, probe for the info needed.\n\n\n workerCallback({\n action: 'probeTs',\n transmuxer: segment.transmuxer,\n data: bytes,\n baseStartTime: segment.baseStartTime,\n callback: function callback(data) {\n segment.bytes = bytes = data.data;\n var probeResult = data.result;\n\n if (probeResult) {\n trackInfoFn(segment, {\n hasAudio: probeResult.hasAudio,\n hasVideo: probeResult.hasVideo,\n isMuxed: isMuxed\n });\n trackInfoFn = null;\n\n if (probeResult.hasAudio && !isMuxed) {\n audioStartFn(probeResult.audioStart);\n }\n\n if (probeResult.hasVideo) {\n videoStartFn(probeResult.videoStart);\n }\n\n audioStartFn = null;\n videoStartFn = null;\n }\n\n finish();\n }\n });\n};\n\nvar handleSegmentBytes = function handleSegmentBytes(_ref5) {\n var segment = _ref5.segment,\n bytes = _ref5.bytes,\n trackInfoFn = _ref5.trackInfoFn,\n timingInfoFn = _ref5.timingInfoFn,\n videoSegmentTimingInfoFn = _ref5.videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn = _ref5.audioSegmentTimingInfoFn,\n id3Fn = _ref5.id3Fn,\n captionsFn = _ref5.captionsFn,\n isEndOfTimeline = _ref5.isEndOfTimeline,\n endedTimelineFn = _ref5.endedTimelineFn,\n dataFn = _ref5.dataFn,\n doneFn = _ref5.doneFn,\n onTransmuxerLog = _ref5.onTransmuxerLog;\n var bytesAsUint8Array = new Uint8Array(bytes); // TODO:\n // We should have a handler that fetches the number of bytes required\n // to check if something is fmp4. This will allow us to save bandwidth\n // because we can only blacklist a playlist and abort requests\n // by codec after trackinfo triggers.\n\n if ((0,_videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_19__.isLikelyFmp4MediaSegment)(bytesAsUint8Array)) {\n segment.isFmp4 = true;\n var tracks = segment.map.tracks;\n var trackInfo = {\n isFmp4: true,\n hasVideo: !!tracks.video,\n hasAudio: !!tracks.audio\n }; // if we have a audio track, with a codec that is not set to\n // encrypted audio\n\n if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== 'enca') {\n trackInfo.audioCodec = tracks.audio.codec;\n } // if we have a video track, with a codec that is not set to\n // encrypted video\n\n\n if (tracks.video && tracks.video.codec && tracks.video.codec !== 'encv') {\n trackInfo.videoCodec = tracks.video.codec;\n }\n\n if (tracks.video && tracks.audio) {\n trackInfo.isMuxed = true;\n } // since we don't support appending fmp4 data on progress, we know we have the full\n // segment here\n\n\n trackInfoFn(segment, trackInfo); // The probe doesn't provide the segment end time, so only callback with the start\n // time. The end time can be roughly calculated by the receiver using the duration.\n //\n // Note that the start time returned by the probe reflects the baseMediaDecodeTime, as\n // that is the true start of the segment (where the playback engine should begin\n // decoding).\n\n var finishLoading = function finishLoading(captions) {\n // if the track still has audio at this point it is only possible\n // for it to be audio only. See `tracks.video && tracks.audio` if statement\n // above.\n // we make sure to use segment.bytes here as that\n dataFn(segment, {\n data: bytesAsUint8Array,\n type: trackInfo.hasAudio && !trackInfo.isMuxed ? 'audio' : 'video'\n });\n\n if (captions && captions.length) {\n captionsFn(segment, captions);\n }\n\n doneFn(null, segment, {});\n };\n\n workerCallback({\n action: 'probeMp4StartTime',\n timescales: segment.map.timescales,\n data: bytesAsUint8Array,\n transmuxer: segment.transmuxer,\n callback: function callback(_ref6) {\n var data = _ref6.data,\n startTime = _ref6.startTime; // transfer bytes back to us\n\n bytes = data.buffer;\n segment.bytes = bytesAsUint8Array = data;\n\n if (trackInfo.hasAudio && !trackInfo.isMuxed) {\n timingInfoFn(segment, 'audio', 'start', startTime);\n }\n\n if (trackInfo.hasVideo) {\n timingInfoFn(segment, 'video', 'start', startTime);\n } // Run through the CaptionParser in case there are captions.\n // Initialize CaptionParser if it hasn't been yet\n\n\n if (!tracks.video || !data.byteLength || !segment.transmuxer) {\n finishLoading();\n return;\n }\n\n workerCallback({\n action: 'pushMp4Captions',\n endAction: 'mp4Captions',\n transmuxer: segment.transmuxer,\n data: bytesAsUint8Array,\n timescales: segment.map.timescales,\n trackIds: [tracks.video.id],\n callback: function callback(message) {\n // transfer bytes back to us\n bytes = message.data.buffer;\n segment.bytes = bytesAsUint8Array = message.data;\n message.logs.forEach(function (log) {\n onTransmuxerLog(videojs.mergeOptions(log, {\n stream: 'mp4CaptionParser'\n }));\n });\n finishLoading(message.captions);\n }\n });\n }\n });\n return;\n } // VTT or other segments that don't need processing\n\n\n if (!segment.transmuxer) {\n doneFn(null, segment, {});\n return;\n }\n\n if (typeof segment.container === 'undefined') {\n segment.container = (0,_videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_19__.detectContainerForBytes)(bytesAsUint8Array);\n }\n\n if (segment.container !== 'ts' && segment.container !== 'aac') {\n trackInfoFn(segment, {\n hasAudio: false,\n hasVideo: false\n });\n doneFn(null, segment, {});\n return;\n } // ts or aac\n\n\n transmuxAndNotify({\n segment: segment,\n bytes: bytes,\n trackInfoFn: trackInfoFn,\n timingInfoFn: timingInfoFn,\n videoSegmentTimingInfoFn: videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn: audioSegmentTimingInfoFn,\n id3Fn: id3Fn,\n captionsFn: captionsFn,\n isEndOfTimeline: isEndOfTimeline,\n endedTimelineFn: endedTimelineFn,\n dataFn: dataFn,\n doneFn: doneFn,\n onTransmuxerLog: onTransmuxerLog\n });\n};\n\nvar decrypt = function decrypt(_ref7, callback) {\n var id = _ref7.id,\n key = _ref7.key,\n encryptedBytes = _ref7.encryptedBytes,\n decryptionWorker = _ref7.decryptionWorker;\n\n var decryptionHandler = function decryptionHandler(event) {\n if (event.data.source === id) {\n decryptionWorker.removeEventListener('message', decryptionHandler);\n var decrypted = event.data.decrypted;\n callback(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength));\n }\n };\n\n decryptionWorker.addEventListener('message', decryptionHandler);\n var keyBytes;\n\n if (key.bytes.slice) {\n keyBytes = key.bytes.slice();\n } else {\n keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes));\n } // incrementally decrypt the bytes\n\n\n decryptionWorker.postMessage(createTransferableMessage({\n source: id,\n encrypted: encryptedBytes,\n key: keyBytes,\n iv: key.iv\n }), [encryptedBytes.buffer, keyBytes.buffer]);\n};\n/**\n * Decrypt the segment via the decryption web worker\n *\n * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption\n * routines\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Function} trackInfoFn - a callback that receives track info\n * @param {Function} timingInfoFn - a callback that receives timing info\n * @param {Function} videoSegmentTimingInfoFn\n * a callback that receives video timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} audioSegmentTimingInfoFn\n * a callback that receives audio timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {boolean} isEndOfTimeline\n * true if this segment represents the last segment in a timeline\n * @param {Function} endedTimelineFn\n * a callback made when a timeline is ended, will only be called if\n * isEndOfTimeline is true\n * @param {Function} dataFn - a callback that is executed when segment bytes are available\n * and ready to use\n * @param {Function} doneFn - a callback that is executed after decryption has completed\n */\n\n\nvar decryptSegment = function decryptSegment(_ref8) {\n var decryptionWorker = _ref8.decryptionWorker,\n segment = _ref8.segment,\n trackInfoFn = _ref8.trackInfoFn,\n timingInfoFn = _ref8.timingInfoFn,\n videoSegmentTimingInfoFn = _ref8.videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn = _ref8.audioSegmentTimingInfoFn,\n id3Fn = _ref8.id3Fn,\n captionsFn = _ref8.captionsFn,\n isEndOfTimeline = _ref8.isEndOfTimeline,\n endedTimelineFn = _ref8.endedTimelineFn,\n dataFn = _ref8.dataFn,\n doneFn = _ref8.doneFn,\n onTransmuxerLog = _ref8.onTransmuxerLog;\n decrypt({\n id: segment.requestId,\n key: segment.key,\n encryptedBytes: segment.encryptedBytes,\n decryptionWorker: decryptionWorker\n }, function (decryptedBytes) {\n segment.bytes = decryptedBytes;\n handleSegmentBytes({\n segment: segment,\n bytes: segment.bytes,\n trackInfoFn: trackInfoFn,\n timingInfoFn: timingInfoFn,\n videoSegmentTimingInfoFn: videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn: audioSegmentTimingInfoFn,\n id3Fn: id3Fn,\n captionsFn: captionsFn,\n isEndOfTimeline: isEndOfTimeline,\n endedTimelineFn: endedTimelineFn,\n dataFn: dataFn,\n doneFn: doneFn,\n onTransmuxerLog: onTransmuxerLog\n });\n });\n};\n/**\n * This function waits for all XHRs to finish (with either success or failure)\n * before continueing processing via it's callback. The function gathers errors\n * from each request into a single errors array so that the error status for\n * each request can be examined later.\n *\n * @param {Object} activeXhrs - an object that tracks all XHR requests\n * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128 decryption\n * routines\n * @param {Function} trackInfoFn - a callback that receives track info\n * @param {Function} timingInfoFn - a callback that receives timing info\n * @param {Function} videoSegmentTimingInfoFn\n * a callback that receives video timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} audioSegmentTimingInfoFn\n * a callback that receives audio timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} id3Fn - a callback that receives ID3 metadata\n * @param {Function} captionsFn - a callback that receives captions\n * @param {boolean} isEndOfTimeline\n * true if this segment represents the last segment in a timeline\n * @param {Function} endedTimelineFn\n * a callback made when a timeline is ended, will only be called if\n * isEndOfTimeline is true\n * @param {Function} dataFn - a callback that is executed when segment bytes are available\n * and ready to use\n * @param {Function} doneFn - a callback that is executed after all resources have been\n * downloaded and any decryption completed\n */\n\n\nvar waitForCompletion = function waitForCompletion(_ref9) {\n var activeXhrs = _ref9.activeXhrs,\n decryptionWorker = _ref9.decryptionWorker,\n trackInfoFn = _ref9.trackInfoFn,\n timingInfoFn = _ref9.timingInfoFn,\n videoSegmentTimingInfoFn = _ref9.videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn = _ref9.audioSegmentTimingInfoFn,\n id3Fn = _ref9.id3Fn,\n captionsFn = _ref9.captionsFn,\n isEndOfTimeline = _ref9.isEndOfTimeline,\n endedTimelineFn = _ref9.endedTimelineFn,\n dataFn = _ref9.dataFn,\n doneFn = _ref9.doneFn,\n onTransmuxerLog = _ref9.onTransmuxerLog;\n var count = 0;\n var didError = false;\n return function (error, segment) {\n if (didError) {\n return;\n }\n\n if (error) {\n didError = true; // If there are errors, we have to abort any outstanding requests\n\n abortAll(activeXhrs); // Even though the requests above are aborted, and in theory we could wait until we\n // handle the aborted events from those requests, there are some cases where we may\n // never get an aborted event. For instance, if the network connection is lost and\n // there were two requests, the first may have triggered an error immediately, while\n // the second request remains unsent. In that case, the aborted algorithm will not\n // trigger an abort: see https://xhr.spec.whatwg.org/#the-abort()-method\n //\n // We also can't rely on the ready state of the XHR, since the request that\n // triggered the connection error may also show as a ready state of 0 (unsent).\n // Therefore, we have to finish this group of requests immediately after the first\n // seen error.\n\n return doneFn(error, segment);\n }\n\n count += 1;\n\n if (count === activeXhrs.length) {\n var segmentFinish = function segmentFinish() {\n if (segment.encryptedBytes) {\n return decryptSegment({\n decryptionWorker: decryptionWorker,\n segment: segment,\n trackInfoFn: trackInfoFn,\n timingInfoFn: timingInfoFn,\n videoSegmentTimingInfoFn: videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn: audioSegmentTimingInfoFn,\n id3Fn: id3Fn,\n captionsFn: captionsFn,\n isEndOfTimeline: isEndOfTimeline,\n endedTimelineFn: endedTimelineFn,\n dataFn: dataFn,\n doneFn: doneFn,\n onTransmuxerLog: onTransmuxerLog\n });\n } // Otherwise, everything is ready just continue\n\n\n handleSegmentBytes({\n segment: segment,\n bytes: segment.bytes,\n trackInfoFn: trackInfoFn,\n timingInfoFn: timingInfoFn,\n videoSegmentTimingInfoFn: videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn: audioSegmentTimingInfoFn,\n id3Fn: id3Fn,\n captionsFn: captionsFn,\n isEndOfTimeline: isEndOfTimeline,\n endedTimelineFn: endedTimelineFn,\n dataFn: dataFn,\n doneFn: doneFn,\n onTransmuxerLog: onTransmuxerLog\n });\n }; // Keep track of when *all* of the requests have completed\n\n\n segment.endOfAllRequests = Date.now();\n\n if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) {\n return decrypt({\n decryptionWorker: decryptionWorker,\n // add -init to the \"id\" to differentiate between segment\n // and init segment decryption, just in case they happen\n // at the same time at some point in the future.\n id: segment.requestId + '-init',\n encryptedBytes: segment.map.encryptedBytes,\n key: segment.map.key\n }, function (decryptedBytes) {\n segment.map.bytes = decryptedBytes;\n parseInitSegment(segment, function (parseError) {\n if (parseError) {\n abortAll(activeXhrs);\n return doneFn(parseError, segment);\n }\n\n segmentFinish();\n });\n });\n }\n\n segmentFinish();\n }\n };\n};\n/**\n * Calls the abort callback if any request within the batch was aborted. Will only call\n * the callback once per batch of requests, even if multiple were aborted.\n *\n * @param {Object} loadendState - state to check to see if the abort function was called\n * @param {Function} abortFn - callback to call for abort\n */\n\n\nvar handleLoadEnd = function handleLoadEnd(_ref10) {\n var loadendState = _ref10.loadendState,\n abortFn = _ref10.abortFn;\n return function (event) {\n var request = event.target;\n\n if (request.aborted && abortFn && !loadendState.calledAbortFn) {\n abortFn();\n loadendState.calledAbortFn = true;\n }\n };\n};\n/**\n * Simple progress event callback handler that gathers some stats before\n * executing a provided callback with the `segment` object\n *\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Function} progressFn - a callback that is executed each time a progress event\n * is received\n * @param {Function} trackInfoFn - a callback that receives track info\n * @param {Function} timingInfoFn - a callback that receives timing info\n * @param {Function} videoSegmentTimingInfoFn\n * a callback that receives video timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} audioSegmentTimingInfoFn\n * a callback that receives audio timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {boolean} isEndOfTimeline\n * true if this segment represents the last segment in a timeline\n * @param {Function} endedTimelineFn\n * a callback made when a timeline is ended, will only be called if\n * isEndOfTimeline is true\n * @param {Function} dataFn - a callback that is executed when segment bytes are available\n * and ready to use\n * @param {Event} event - the progress event object from XMLHttpRequest\n */\n\n\nvar handleProgress = function handleProgress(_ref11) {\n var segment = _ref11.segment,\n progressFn = _ref11.progressFn;\n _ref11.trackInfoFn;\n _ref11.timingInfoFn;\n _ref11.videoSegmentTimingInfoFn;\n _ref11.audioSegmentTimingInfoFn;\n _ref11.id3Fn;\n _ref11.captionsFn;\n _ref11.isEndOfTimeline;\n _ref11.endedTimelineFn;\n _ref11.dataFn;\n return function (event) {\n var request = event.target;\n\n if (request.aborted) {\n return;\n }\n\n segment.stats = videojs.mergeOptions(segment.stats, getProgressStats(event)); // record the time that we receive the first byte of data\n\n if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) {\n segment.stats.firstBytesReceivedAt = Date.now();\n }\n\n return progressFn(event, segment);\n };\n};\n/**\n * Load all resources and does any processing necessary for a media-segment\n *\n * Features:\n * decrypts the media-segment if it has a key uri and an iv\n * aborts *all* requests if *any* one request fails\n *\n * The segment object, at minimum, has the following format:\n * {\n * resolvedUri: String,\n * [transmuxer]: Object,\n * [byterange]: {\n * offset: Number,\n * length: Number\n * },\n * [key]: {\n * resolvedUri: String\n * [byterange]: {\n * offset: Number,\n * length: Number\n * },\n * iv: {\n * bytes: Uint32Array\n * }\n * },\n * [map]: {\n * resolvedUri: String,\n * [byterange]: {\n * offset: Number,\n * length: Number\n * },\n * [bytes]: Uint8Array\n * }\n * }\n * ...where [name] denotes optional properties\n *\n * @param {Function} xhr - an instance of the xhr wrapper in xhr.js\n * @param {Object} xhrOptions - the base options to provide to all xhr requests\n * @param {WebWorker} decryptionWorker - a WebWorker interface to AES-128\n * decryption routines\n * @param {Object} segment - a simplified copy of the segmentInfo object\n * from SegmentLoader\n * @param {Function} abortFn - a callback called (only once) if any piece of a request was\n * aborted\n * @param {Function} progressFn - a callback that receives progress events from the main\n * segment's xhr request\n * @param {Function} trackInfoFn - a callback that receives track info\n * @param {Function} timingInfoFn - a callback that receives timing info\n * @param {Function} videoSegmentTimingInfoFn\n * a callback that receives video timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} audioSegmentTimingInfoFn\n * a callback that receives audio timing info based on media times and\n * any adjustments made by the transmuxer\n * @param {Function} id3Fn - a callback that receives ID3 metadata\n * @param {Function} captionsFn - a callback that receives captions\n * @param {boolean} isEndOfTimeline\n * true if this segment represents the last segment in a timeline\n * @param {Function} endedTimelineFn\n * a callback made when a timeline is ended, will only be called if\n * isEndOfTimeline is true\n * @param {Function} dataFn - a callback that receives data from the main segment's xhr\n * request, transmuxed if needed\n * @param {Function} doneFn - a callback that is executed only once all requests have\n * succeeded or failed\n * @return {Function} a function that, when invoked, immediately aborts all\n * outstanding requests\n */\n\n\nvar mediaSegmentRequest = function mediaSegmentRequest(_ref12) {\n var xhr = _ref12.xhr,\n xhrOptions = _ref12.xhrOptions,\n decryptionWorker = _ref12.decryptionWorker,\n segment = _ref12.segment,\n abortFn = _ref12.abortFn,\n progressFn = _ref12.progressFn,\n trackInfoFn = _ref12.trackInfoFn,\n timingInfoFn = _ref12.timingInfoFn,\n videoSegmentTimingInfoFn = _ref12.videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn = _ref12.audioSegmentTimingInfoFn,\n id3Fn = _ref12.id3Fn,\n captionsFn = _ref12.captionsFn,\n isEndOfTimeline = _ref12.isEndOfTimeline,\n endedTimelineFn = _ref12.endedTimelineFn,\n dataFn = _ref12.dataFn,\n doneFn = _ref12.doneFn,\n onTransmuxerLog = _ref12.onTransmuxerLog;\n var activeXhrs = [];\n var finishProcessingFn = waitForCompletion({\n activeXhrs: activeXhrs,\n decryptionWorker: decryptionWorker,\n trackInfoFn: trackInfoFn,\n timingInfoFn: timingInfoFn,\n videoSegmentTimingInfoFn: videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn: audioSegmentTimingInfoFn,\n id3Fn: id3Fn,\n captionsFn: captionsFn,\n isEndOfTimeline: isEndOfTimeline,\n endedTimelineFn: endedTimelineFn,\n dataFn: dataFn,\n doneFn: doneFn,\n onTransmuxerLog: onTransmuxerLog\n }); // optionally, request the decryption key\n\n if (segment.key && !segment.key.bytes) {\n var objects = [segment.key];\n\n if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) {\n objects.push(segment.map.key);\n }\n\n var keyRequestOptions = videojs.mergeOptions(xhrOptions, {\n uri: segment.key.resolvedUri,\n responseType: 'arraybuffer'\n });\n var keyRequestCallback = handleKeyResponse(segment, objects, finishProcessingFn);\n var keyXhr = xhr(keyRequestOptions, keyRequestCallback);\n activeXhrs.push(keyXhr);\n } // optionally, request the associated media init segment\n\n\n if (segment.map && !segment.map.bytes) {\n var differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri);\n\n if (differentMapKey) {\n var mapKeyRequestOptions = videojs.mergeOptions(xhrOptions, {\n uri: segment.map.key.resolvedUri,\n responseType: 'arraybuffer'\n });\n var mapKeyRequestCallback = handleKeyResponse(segment, [segment.map.key], finishProcessingFn);\n var mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback);\n activeXhrs.push(mapKeyXhr);\n }\n\n var initSegmentOptions = videojs.mergeOptions(xhrOptions, {\n uri: segment.map.resolvedUri,\n responseType: 'arraybuffer',\n headers: segmentXhrHeaders(segment.map)\n });\n var initSegmentRequestCallback = handleInitSegmentResponse({\n segment: segment,\n finishProcessingFn: finishProcessingFn\n });\n var initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback);\n activeXhrs.push(initSegmentXhr);\n }\n\n var segmentRequestOptions = videojs.mergeOptions(xhrOptions, {\n uri: segment.part && segment.part.resolvedUri || segment.resolvedUri,\n responseType: 'arraybuffer',\n headers: segmentXhrHeaders(segment)\n });\n var segmentRequestCallback = handleSegmentResponse({\n segment: segment,\n finishProcessingFn: finishProcessingFn,\n responseType: segmentRequestOptions.responseType\n });\n var segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback);\n segmentXhr.addEventListener('progress', handleProgress({\n segment: segment,\n progressFn: progressFn,\n trackInfoFn: trackInfoFn,\n timingInfoFn: timingInfoFn,\n videoSegmentTimingInfoFn: videoSegmentTimingInfoFn,\n audioSegmentTimingInfoFn: audioSegmentTimingInfoFn,\n id3Fn: id3Fn,\n captionsFn: captionsFn,\n isEndOfTimeline: isEndOfTimeline,\n endedTimelineFn: endedTimelineFn,\n dataFn: dataFn\n }));\n activeXhrs.push(segmentXhr); // since all parts of the request must be considered, but should not make callbacks\n // multiple times, provide a shared state object\n\n var loadendState = {};\n activeXhrs.forEach(function (activeXhr) {\n activeXhr.addEventListener('loadend', handleLoadEnd({\n loadendState: loadendState,\n abortFn: abortFn\n }));\n });\n return function () {\n return abortAll(activeXhrs);\n };\n};\n/**\n * @file - codecs.js - Handles tasks regarding codec strings such as translating them to\n * codec strings, or translating codec strings into objects that can be examined.\n */\n\n\nvar logFn$1 = logger('CodecUtils');\n/**\n * Returns a set of codec strings parsed from the playlist or the default\n * codec strings if no codecs were specified in the playlist\n *\n * @param {Playlist} media the current media playlist\n * @return {Object} an object with the video and audio codecs\n */\n\nvar getCodecs = function getCodecs(media) {\n // if the codecs were explicitly specified, use them instead of the\n // defaults\n var mediaAttributes = media.attributes || {};\n\n if (mediaAttributes.CODECS) {\n return (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.parseCodecs)(mediaAttributes.CODECS);\n }\n};\n\nvar isMaat = function isMaat(master, media) {\n var mediaAttributes = media.attributes || {};\n return master && master.mediaGroups && master.mediaGroups.AUDIO && mediaAttributes.AUDIO && master.mediaGroups.AUDIO[mediaAttributes.AUDIO];\n};\n\nvar isMuxed = function isMuxed(master, media) {\n if (!isMaat(master, media)) {\n return true;\n }\n\n var mediaAttributes = media.attributes || {};\n var audioGroup = master.mediaGroups.AUDIO[mediaAttributes.AUDIO];\n\n for (var groupId in audioGroup) {\n // If an audio group has a URI (the case for HLS, as HLS will use external playlists),\n // or there are listed playlists (the case for DASH, as the manifest will have already\n // provided all of the details necessary to generate the audio playlist, as opposed to\n // HLS' externally requested playlists), then the content is demuxed.\n if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) {\n return true;\n }\n }\n\n return false;\n};\n\nvar unwrapCodecList = function unwrapCodecList(codecList) {\n var codecs = {};\n codecList.forEach(function (_ref) {\n var mediaType = _ref.mediaType,\n type = _ref.type,\n details = _ref.details;\n codecs[mediaType] = codecs[mediaType] || [];\n codecs[mediaType].push((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.translateLegacyCodec)(\"\" + type + details));\n });\n Object.keys(codecs).forEach(function (mediaType) {\n if (codecs[mediaType].length > 1) {\n logFn$1(\"multiple \" + mediaType + \" codecs found as attributes: \" + codecs[mediaType].join(', ') + \". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.\");\n codecs[mediaType] = null;\n return;\n }\n\n codecs[mediaType] = codecs[mediaType][0];\n });\n return codecs;\n};\n\nvar codecCount = function codecCount(codecObj) {\n var count = 0;\n\n if (codecObj.audio) {\n count++;\n }\n\n if (codecObj.video) {\n count++;\n }\n\n return count;\n};\n/**\n * Calculates the codec strings for a working configuration of\n * SourceBuffers to play variant streams in a master playlist. If\n * there is no possible working configuration, an empty object will be\n * returned.\n *\n * @param master {Object} the m3u8 object for the master playlist\n * @param media {Object} the m3u8 object for the variant playlist\n * @return {Object} the codec strings.\n *\n * @private\n */\n\n\nvar codecsForPlaylist = function codecsForPlaylist(master, media) {\n var mediaAttributes = media.attributes || {};\n var codecInfo = unwrapCodecList(getCodecs(media) || []); // HLS with multiple-audio tracks must always get an audio codec.\n // Put another way, there is no way to have a video-only multiple-audio HLS!\n\n if (isMaat(master, media) && !codecInfo.audio) {\n if (!isMuxed(master, media)) {\n // It is possible for codecs to be specified on the audio media group playlist but\n // not on the rendition playlist. This is mostly the case for DASH, where audio and\n // video are always separate (and separately specified).\n var defaultCodecs = unwrapCodecList((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.codecsFromDefault)(master, mediaAttributes.AUDIO) || []);\n\n if (defaultCodecs.audio) {\n codecInfo.audio = defaultCodecs.audio;\n }\n }\n }\n\n return codecInfo;\n};\n\nvar logFn = logger('PlaylistSelector');\n\nvar representationToString = function representationToString(representation) {\n if (!representation || !representation.playlist) {\n return;\n }\n\n var playlist = representation.playlist;\n return JSON.stringify({\n id: playlist.id,\n bandwidth: representation.bandwidth,\n width: representation.width,\n height: representation.height,\n codecs: playlist.attributes && playlist.attributes.CODECS || ''\n });\n}; // Utilities\n\n/**\n * Returns the CSS value for the specified property on an element\n * using `getComputedStyle`. Firefox has a long-standing issue where\n * getComputedStyle() may return null when running in an iframe with\n * `display: none`.\n *\n * @see https://bugzilla.mozilla.org/show_bug.cgi?id=548397\n * @param {HTMLElement} el the htmlelement to work on\n * @param {string} the proprety to get the style for\n */\n\n\nvar safeGetComputedStyle = function safeGetComputedStyle(el, property) {\n if (!el) {\n return '';\n }\n\n var result = global_window__WEBPACK_IMPORTED_MODULE_0___default().getComputedStyle(el);\n\n if (!result) {\n return '';\n }\n\n return result[property];\n};\n/**\n * Resuable stable sort function\n *\n * @param {Playlists} array\n * @param {Function} sortFn Different comparators\n * @function stableSort\n */\n\n\nvar stableSort = function stableSort(array, sortFn) {\n var newArray = array.slice();\n array.sort(function (left, right) {\n var cmp = sortFn(left, right);\n\n if (cmp === 0) {\n return newArray.indexOf(left) - newArray.indexOf(right);\n }\n\n return cmp;\n });\n};\n/**\n * A comparator function to sort two playlist object by bandwidth.\n *\n * @param {Object} left a media playlist object\n * @param {Object} right a media playlist object\n * @return {number} Greater than zero if the bandwidth attribute of\n * left is greater than the corresponding attribute of right. Less\n * than zero if the bandwidth of right is greater than left and\n * exactly zero if the two are equal.\n */\n\n\nvar comparePlaylistBandwidth = function comparePlaylistBandwidth(left, right) {\n var leftBandwidth;\n var rightBandwidth;\n\n if (left.attributes.BANDWIDTH) {\n leftBandwidth = left.attributes.BANDWIDTH;\n }\n\n leftBandwidth = leftBandwidth || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Number).MAX_VALUE;\n\n if (right.attributes.BANDWIDTH) {\n rightBandwidth = right.attributes.BANDWIDTH;\n }\n\n rightBandwidth = rightBandwidth || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Number).MAX_VALUE;\n return leftBandwidth - rightBandwidth;\n};\n/**\n * A comparator function to sort two playlist object by resolution (width).\n *\n * @param {Object} left a media playlist object\n * @param {Object} right a media playlist object\n * @return {number} Greater than zero if the resolution.width attribute of\n * left is greater than the corresponding attribute of right. Less\n * than zero if the resolution.width of right is greater than left and\n * exactly zero if the two are equal.\n */\n\n\nvar comparePlaylistResolution = function comparePlaylistResolution(left, right) {\n var leftWidth;\n var rightWidth;\n\n if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) {\n leftWidth = left.attributes.RESOLUTION.width;\n }\n\n leftWidth = leftWidth || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Number).MAX_VALUE;\n\n if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) {\n rightWidth = right.attributes.RESOLUTION.width;\n }\n\n rightWidth = rightWidth || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Number).MAX_VALUE; // NOTE - Fallback to bandwidth sort as appropriate in cases where multiple renditions\n // have the same media dimensions/ resolution\n\n if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) {\n return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH;\n }\n\n return leftWidth - rightWidth;\n};\n/**\n * Chooses the appropriate media playlist based on bandwidth and player size\n *\n * @param {Object} master\n * Object representation of the master manifest\n * @param {number} playerBandwidth\n * Current calculated bandwidth of the player\n * @param {number} playerWidth\n * Current width of the player element (should account for the device pixel ratio)\n * @param {number} playerHeight\n * Current height of the player element (should account for the device pixel ratio)\n * @param {boolean} limitRenditionByPlayerDimensions\n * True if the player width and height should be used during the selection, false otherwise\n * @param {Object} masterPlaylistController\n * the current masterPlaylistController object\n * @return {Playlist} the highest bitrate playlist less than the\n * currently detected bandwidth, accounting for some amount of\n * bandwidth variance\n */\n\n\nvar simpleSelector = function simpleSelector(master, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, masterPlaylistController) {\n // If we end up getting called before `master` is available, exit early\n if (!master) {\n return;\n }\n\n var options = {\n bandwidth: playerBandwidth,\n width: playerWidth,\n height: playerHeight,\n limitRenditionByPlayerDimensions: limitRenditionByPlayerDimensions\n };\n var playlists = master.playlists; // if playlist is audio only, select between currently active audio group playlists.\n\n if (Playlist.isAudioOnly(master)) {\n playlists = masterPlaylistController.getAudioTrackPlaylists_(); // add audioOnly to options so that we log audioOnly: true\n // at the buttom of this function for debugging.\n\n options.audioOnly = true;\n } // convert the playlists to an intermediary representation to make comparisons easier\n\n\n var sortedPlaylistReps = playlists.map(function (playlist) {\n var bandwidth;\n var width = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width;\n var height = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height;\n bandwidth = playlist.attributes && playlist.attributes.BANDWIDTH;\n bandwidth = bandwidth || (global_window__WEBPACK_IMPORTED_MODULE_0___default().Number).MAX_VALUE;\n return {\n bandwidth: bandwidth,\n width: width,\n height: height,\n playlist: playlist\n };\n });\n stableSort(sortedPlaylistReps, function (left, right) {\n return left.bandwidth - right.bandwidth;\n }); // filter out any playlists that have been excluded due to\n // incompatible configurations\n\n sortedPlaylistReps = sortedPlaylistReps.filter(function (rep) {\n return !Playlist.isIncompatible(rep.playlist);\n }); // filter out any playlists that have been disabled manually through the representations\n // api or blacklisted temporarily due to playback errors.\n\n var enabledPlaylistReps = sortedPlaylistReps.filter(function (rep) {\n return Playlist.isEnabled(rep.playlist);\n });\n\n if (!enabledPlaylistReps.length) {\n // if there are no enabled playlists, then they have all been blacklisted or disabled\n // by the user through the representations api. In this case, ignore blacklisting and\n // fallback to what the user wants by using playlists the user has not disabled.\n enabledPlaylistReps = sortedPlaylistReps.filter(function (rep) {\n return !Playlist.isDisabled(rep.playlist);\n });\n } // filter out any variant that has greater effective bitrate\n // than the current estimated bandwidth\n\n\n var bandwidthPlaylistReps = enabledPlaylistReps.filter(function (rep) {\n return rep.bandwidth * Config.BANDWIDTH_VARIANCE < playerBandwidth;\n });\n var highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1]; // get all of the renditions with the same (highest) bandwidth\n // and then taking the very first element\n\n var bandwidthBestRep = bandwidthPlaylistReps.filter(function (rep) {\n return rep.bandwidth === highestRemainingBandwidthRep.bandwidth;\n })[0]; // if we're not going to limit renditions by player size, make an early decision.\n\n if (limitRenditionByPlayerDimensions === false) {\n var _chosenRep = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];\n\n if (_chosenRep && _chosenRep.playlist) {\n var type = 'sortedPlaylistReps';\n\n if (bandwidthBestRep) {\n type = 'bandwidthBestRep';\n }\n\n if (enabledPlaylistReps[0]) {\n type = 'enabledPlaylistReps';\n }\n\n logFn(\"choosing \" + representationToString(_chosenRep) + \" using \" + type + \" with options\", options);\n return _chosenRep.playlist;\n }\n\n logFn('could not choose a playlist with options', options);\n return null;\n } // filter out playlists without resolution information\n\n\n var haveResolution = bandwidthPlaylistReps.filter(function (rep) {\n return rep.width && rep.height;\n }); // sort variants by resolution\n\n stableSort(haveResolution, function (left, right) {\n return left.width - right.width;\n }); // if we have the exact resolution as the player use it\n\n var resolutionBestRepList = haveResolution.filter(function (rep) {\n return rep.width === playerWidth && rep.height === playerHeight;\n });\n highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1]; // ensure that we pick the highest bandwidth variant that have exact resolution\n\n var resolutionBestRep = resolutionBestRepList.filter(function (rep) {\n return rep.bandwidth === highestRemainingBandwidthRep.bandwidth;\n })[0];\n var resolutionPlusOneList;\n var resolutionPlusOneSmallest;\n var resolutionPlusOneRep; // find the smallest variant that is larger than the player\n // if there is no match of exact resolution\n\n if (!resolutionBestRep) {\n resolutionPlusOneList = haveResolution.filter(function (rep) {\n return rep.width > playerWidth || rep.height > playerHeight;\n }); // find all the variants have the same smallest resolution\n\n resolutionPlusOneSmallest = resolutionPlusOneList.filter(function (rep) {\n return rep.width === resolutionPlusOneList[0].width && rep.height === resolutionPlusOneList[0].height;\n }); // ensure that we also pick the highest bandwidth variant that\n // is just-larger-than the video player\n\n highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1];\n resolutionPlusOneRep = resolutionPlusOneSmallest.filter(function (rep) {\n return rep.bandwidth === highestRemainingBandwidthRep.bandwidth;\n })[0];\n }\n\n var leastPixelDiffRep; // If this selector proves to be better than others,\n // resolutionPlusOneRep and resolutionBestRep and all\n // the code involving them should be removed.\n\n if (masterPlaylistController.experimentalLeastPixelDiffSelector) {\n // find the variant that is closest to the player's pixel size\n var leastPixelDiffList = haveResolution.map(function (rep) {\n rep.pixelDiff = Math.abs(rep.width - playerWidth) + Math.abs(rep.height - playerHeight);\n return rep;\n }); // get the highest bandwidth, closest resolution playlist\n\n stableSort(leastPixelDiffList, function (left, right) {\n // sort by highest bandwidth if pixelDiff is the same\n if (left.pixelDiff === right.pixelDiff) {\n return right.bandwidth - left.bandwidth;\n }\n\n return left.pixelDiff - right.pixelDiff;\n });\n leastPixelDiffRep = leastPixelDiffList[0];\n } // fallback chain of variants\n\n\n var chosenRep = leastPixelDiffRep || resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];\n\n if (chosenRep && chosenRep.playlist) {\n var _type = 'sortedPlaylistReps';\n\n if (leastPixelDiffRep) {\n _type = 'leastPixelDiffRep';\n } else if (resolutionPlusOneRep) {\n _type = 'resolutionPlusOneRep';\n } else if (resolutionBestRep) {\n _type = 'resolutionBestRep';\n } else if (bandwidthBestRep) {\n _type = 'bandwidthBestRep';\n } else if (enabledPlaylistReps[0]) {\n _type = 'enabledPlaylistReps';\n }\n\n logFn(\"choosing \" + representationToString(chosenRep) + \" using \" + _type + \" with options\", options);\n return chosenRep.playlist;\n }\n\n logFn('could not choose a playlist with options', options);\n return null;\n};\n/**\n * Chooses the appropriate media playlist based on the most recent\n * bandwidth estimate and the player size.\n *\n * Expects to be called within the context of an instance of VhsHandler\n *\n * @return {Playlist} the highest bitrate playlist less than the\n * currently detected bandwidth, accounting for some amount of\n * bandwidth variance\n */\n\n\nvar lastBandwidthSelector = function lastBandwidthSelector() {\n var pixelRatio = this.useDevicePixelRatio ? (global_window__WEBPACK_IMPORTED_MODULE_0___default().devicePixelRatio) || 1 : 1;\n return simpleSelector(this.playlists.master, this.systemBandwidth, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_);\n};\n/**\n * Chooses the appropriate media playlist based on an\n * exponential-weighted moving average of the bandwidth after\n * filtering for player size.\n *\n * Expects to be called within the context of an instance of VhsHandler\n *\n * @param {number} decay - a number between 0 and 1. Higher values of\n * this parameter will cause previous bandwidth estimates to lose\n * significance more quickly.\n * @return {Function} a function which can be invoked to create a new\n * playlist selector function.\n * @see https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average\n */\n\n\nvar movingAverageBandwidthSelector = function movingAverageBandwidthSelector(decay) {\n var average = -1;\n var lastSystemBandwidth = -1;\n\n if (decay < 0 || decay > 1) {\n throw new Error('Moving average bandwidth decay must be between 0 and 1.');\n }\n\n return function () {\n var pixelRatio = this.useDevicePixelRatio ? (global_window__WEBPACK_IMPORTED_MODULE_0___default().devicePixelRatio) || 1 : 1;\n\n if (average < 0) {\n average = this.systemBandwidth;\n lastSystemBandwidth = this.systemBandwidth;\n } // stop the average value from decaying for every 250ms\n // when the systemBandwidth is constant\n // and\n // stop average from setting to a very low value when the\n // systemBandwidth becomes 0 in case of chunk cancellation\n\n\n if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) {\n average = decay * this.systemBandwidth + (1 - decay) * average;\n lastSystemBandwidth = this.systemBandwidth;\n }\n\n return simpleSelector(this.playlists.master, average, parseInt(safeGetComputedStyle(this.tech_.el(), 'width'), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), 'height'), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_);\n };\n};\n/**\n * Chooses the appropriate media playlist based on the potential to rebuffer\n *\n * @param {Object} settings\n * Object of information required to use this selector\n * @param {Object} settings.master\n * Object representation of the master manifest\n * @param {number} settings.currentTime\n * The current time of the player\n * @param {number} settings.bandwidth\n * Current measured bandwidth\n * @param {number} settings.duration\n * Duration of the media\n * @param {number} settings.segmentDuration\n * Segment duration to be used in round trip time calculations\n * @param {number} settings.timeUntilRebuffer\n * Time left in seconds until the player has to rebuffer\n * @param {number} settings.currentTimeline\n * The current timeline segments are being loaded from\n * @param {SyncController} settings.syncController\n * SyncController for determining if we have a sync point for a given playlist\n * @return {Object|null}\n * {Object} return.playlist\n * The highest bandwidth playlist with the least amount of rebuffering\n * {Number} return.rebufferingImpact\n * The amount of time in seconds switching to this playlist will rebuffer. A\n * negative value means that switching will cause zero rebuffering.\n */\n\n\nvar minRebufferMaxBandwidthSelector = function minRebufferMaxBandwidthSelector(settings) {\n var master = settings.master,\n currentTime = settings.currentTime,\n bandwidth = settings.bandwidth,\n duration = settings.duration,\n segmentDuration = settings.segmentDuration,\n timeUntilRebuffer = settings.timeUntilRebuffer,\n currentTimeline = settings.currentTimeline,\n syncController = settings.syncController; // filter out any playlists that have been excluded due to\n // incompatible configurations\n\n var compatiblePlaylists = master.playlists.filter(function (playlist) {\n return !Playlist.isIncompatible(playlist);\n }); // filter out any playlists that have been disabled manually through the representations\n // api or blacklisted temporarily due to playback errors.\n\n var enabledPlaylists = compatiblePlaylists.filter(Playlist.isEnabled);\n\n if (!enabledPlaylists.length) {\n // if there are no enabled playlists, then they have all been blacklisted or disabled\n // by the user through the representations api. In this case, ignore blacklisting and\n // fallback to what the user wants by using playlists the user has not disabled.\n enabledPlaylists = compatiblePlaylists.filter(function (playlist) {\n return !Playlist.isDisabled(playlist);\n });\n }\n\n var bandwidthPlaylists = enabledPlaylists.filter(Playlist.hasAttribute.bind(null, 'BANDWIDTH'));\n var rebufferingEstimates = bandwidthPlaylists.map(function (playlist) {\n var syncPoint = syncController.getSyncPoint(playlist, duration, currentTimeline, currentTime); // If there is no sync point for this playlist, switching to it will require a\n // sync request first. This will double the request time\n\n var numRequests = syncPoint ? 1 : 2;\n var requestTimeEstimate = Playlist.estimateSegmentRequestTime(segmentDuration, bandwidth, playlist);\n var rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer;\n return {\n playlist: playlist,\n rebufferingImpact: rebufferingImpact\n };\n });\n var noRebufferingPlaylists = rebufferingEstimates.filter(function (estimate) {\n return estimate.rebufferingImpact <= 0;\n }); // Sort by bandwidth DESC\n\n stableSort(noRebufferingPlaylists, function (a, b) {\n return comparePlaylistBandwidth(b.playlist, a.playlist);\n });\n\n if (noRebufferingPlaylists.length) {\n return noRebufferingPlaylists[0];\n }\n\n stableSort(rebufferingEstimates, function (a, b) {\n return a.rebufferingImpact - b.rebufferingImpact;\n });\n return rebufferingEstimates[0] || null;\n};\n/**\n * Chooses the appropriate media playlist, which in this case is the lowest bitrate\n * one with video. If no renditions with video exist, return the lowest audio rendition.\n *\n * Expects to be called within the context of an instance of VhsHandler\n *\n * @return {Object|null}\n * {Object} return.playlist\n * The lowest bitrate playlist that contains a video codec. If no such rendition\n * exists pick the lowest audio rendition.\n */\n\n\nvar lowestBitrateCompatibleVariantSelector = function lowestBitrateCompatibleVariantSelector() {\n var _this = this; // filter out any playlists that have been excluded due to\n // incompatible configurations or playback errors\n\n\n var playlists = this.playlists.master.playlists.filter(Playlist.isEnabled); // Sort ascending by bitrate\n\n stableSort(playlists, function (a, b) {\n return comparePlaylistBandwidth(a, b);\n }); // Parse and assume that playlists with no video codec have no video\n // (this is not necessarily true, although it is generally true).\n //\n // If an entire manifest has no valid videos everything will get filtered\n // out.\n\n var playlistsWithVideo = playlists.filter(function (playlist) {\n return !!codecsForPlaylist(_this.playlists.master, playlist).video;\n });\n return playlistsWithVideo[0] || null;\n};\n/**\n * Combine all segments into a single Uint8Array\n *\n * @param {Object} segmentObj\n * @return {Uint8Array} concatenated bytes\n * @private\n */\n\n\nvar concatSegments = function concatSegments(segmentObj) {\n var offset = 0;\n var tempBuffer;\n\n if (segmentObj.bytes) {\n tempBuffer = new Uint8Array(segmentObj.bytes); // combine the individual segments into one large typed-array\n\n segmentObj.segments.forEach(function (segment) {\n tempBuffer.set(segment, offset);\n offset += segment.byteLength;\n });\n }\n\n return tempBuffer;\n};\n/**\n * @file text-tracks.js\n */\n\n/**\n * Create captions text tracks on video.js if they do not exist\n *\n * @param {Object} inbandTextTracks a reference to current inbandTextTracks\n * @param {Object} tech the video.js tech\n * @param {Object} captionStream the caption stream to create\n * @private\n */\n\n\nvar createCaptionsTrackIfNotExists = function createCaptionsTrackIfNotExists(inbandTextTracks, tech, captionStream) {\n if (!inbandTextTracks[captionStream]) {\n tech.trigger({\n type: 'usage',\n name: 'vhs-608'\n });\n tech.trigger({\n type: 'usage',\n name: 'hls-608'\n });\n var instreamId = captionStream; // we need to translate SERVICEn for 708 to how mux.js currently labels them\n\n if (/^cc708_/.test(captionStream)) {\n instreamId = 'SERVICE' + captionStream.split('_')[1];\n }\n\n var track = tech.textTracks().getTrackById(instreamId);\n\n if (track) {\n // Resuse an existing track with a CC# id because this was\n // very likely created by videojs-contrib-hls from information\n // in the m3u8 for us to use\n inbandTextTracks[captionStream] = track;\n } else {\n // This section gets called when we have caption services that aren't specified in the manifest.\n // Manifest level caption services are handled in media-groups.js under CLOSED-CAPTIONS.\n var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};\n var label = captionStream;\n var language = captionStream;\n var def = false;\n var captionService = captionServices[instreamId];\n\n if (captionService) {\n label = captionService.label;\n language = captionService.language;\n def = captionService[\"default\"];\n } // Otherwise, create a track with the default `CC#` label and\n // without a language\n\n\n inbandTextTracks[captionStream] = tech.addRemoteTextTrack({\n kind: 'captions',\n id: instreamId,\n // TODO: investigate why this doesn't seem to turn the caption on by default\n \"default\": def,\n label: label,\n language: language\n }, false).track;\n }\n }\n};\n/**\n * Add caption text track data to a source handler given an array of captions\n *\n * @param {Object}\n * @param {Object} inbandTextTracks the inband text tracks\n * @param {number} timestampOffset the timestamp offset of the source buffer\n * @param {Array} captionArray an array of caption data\n * @private\n */\n\n\nvar addCaptionData = function addCaptionData(_ref) {\n var inbandTextTracks = _ref.inbandTextTracks,\n captionArray = _ref.captionArray,\n timestampOffset = _ref.timestampOffset;\n\n if (!captionArray) {\n return;\n }\n\n var Cue = (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebKitDataCue) || (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue);\n captionArray.forEach(function (caption) {\n var track = caption.stream;\n inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset, caption.endTime + timestampOffset, caption.text));\n });\n};\n/**\n * Define properties on a cue for backwards compatability,\n * but warn the user that the way that they are using it\n * is depricated and will be removed at a later date.\n *\n * @param {Cue} cue the cue to add the properties on\n * @private\n */\n\n\nvar deprecateOldCue = function deprecateOldCue(cue) {\n Object.defineProperties(cue.frame, {\n id: {\n get: function get() {\n videojs.log.warn('cue.frame.id is deprecated. Use cue.value.key instead.');\n return cue.value.key;\n }\n },\n value: {\n get: function get() {\n videojs.log.warn('cue.frame.value is deprecated. Use cue.value.data instead.');\n return cue.value.data;\n }\n },\n privateData: {\n get: function get() {\n videojs.log.warn('cue.frame.privateData is deprecated. Use cue.value.data instead.');\n return cue.value.data;\n }\n }\n });\n};\n/**\n * Add metadata text track data to a source handler given an array of metadata\n *\n * @param {Object}\n * @param {Object} inbandTextTracks the inband text tracks\n * @param {Array} metadataArray an array of meta data\n * @param {number} timestampOffset the timestamp offset of the source buffer\n * @param {number} videoDuration the duration of the video\n * @private\n */\n\n\nvar addMetadata = function addMetadata(_ref2) {\n var inbandTextTracks = _ref2.inbandTextTracks,\n metadataArray = _ref2.metadataArray,\n timestampOffset = _ref2.timestampOffset,\n videoDuration = _ref2.videoDuration;\n\n if (!metadataArray) {\n return;\n }\n\n var Cue = (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebKitDataCue) || (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue);\n var metadataTrack = inbandTextTracks.metadataTrack_;\n\n if (!metadataTrack) {\n return;\n }\n\n metadataArray.forEach(function (metadata) {\n var time = metadata.cueTime + timestampOffset; // if time isn't a finite number between 0 and Infinity, like NaN,\n // ignore this bit of metadata.\n // This likely occurs when you have an non-timed ID3 tag like TIT2,\n // which is the \"Title/Songname/Content description\" frame\n\n if (typeof time !== 'number' || global_window__WEBPACK_IMPORTED_MODULE_0___default().isNaN(time) || time < 0 || !(time < Infinity)) {\n return;\n }\n\n metadata.frames.forEach(function (frame) {\n var cue = new Cue(time, time, frame.value || frame.url || frame.data || '');\n cue.frame = frame;\n cue.value = frame;\n deprecateOldCue(cue);\n metadataTrack.addCue(cue);\n });\n });\n\n if (!metadataTrack.cues || !metadataTrack.cues.length) {\n return;\n } // Updating the metadeta cues so that\n // the endTime of each cue is the startTime of the next cue\n // the endTime of last cue is the duration of the video\n\n\n var cues = metadataTrack.cues;\n var cuesArray = []; // Create a copy of the TextTrackCueList...\n // ...disregarding cues with a falsey value\n\n for (var i = 0; i < cues.length; i++) {\n if (cues[i]) {\n cuesArray.push(cues[i]);\n }\n } // Group cues by their startTime value\n\n\n var cuesGroupedByStartTime = cuesArray.reduce(function (obj, cue) {\n var timeSlot = obj[cue.startTime] || [];\n timeSlot.push(cue);\n obj[cue.startTime] = timeSlot;\n return obj;\n }, {}); // Sort startTimes by ascending order\n\n var sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort(function (a, b) {\n return Number(a) - Number(b);\n }); // Map each cue group's endTime to the next group's startTime\n\n sortedStartTimes.forEach(function (startTime, idx) {\n var cueGroup = cuesGroupedByStartTime[startTime];\n var nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration; // Map each cue's endTime the next group's startTime\n\n cueGroup.forEach(function (cue) {\n cue.endTime = nextTime;\n });\n });\n};\n/**\n * Create metadata text track on video.js if it does not exist\n *\n * @param {Object} inbandTextTracks a reference to current inbandTextTracks\n * @param {string} dispatchType the inband metadata track dispatch type\n * @param {Object} tech the video.js tech\n * @private\n */\n\n\nvar createMetadataTrackIfNotExists = function createMetadataTrackIfNotExists(inbandTextTracks, dispatchType, tech) {\n if (inbandTextTracks.metadataTrack_) {\n return;\n }\n\n inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({\n kind: 'metadata',\n label: 'Timed Metadata'\n }, false).track;\n inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType;\n};\n/**\n * Remove cues from a track on video.js.\n *\n * @param {Double} start start of where we should remove the cue\n * @param {Double} end end of where the we should remove the cue\n * @param {Object} track the text track to remove the cues from\n * @private\n */\n\n\nvar removeCuesFromTrack = function removeCuesFromTrack(start, end, track) {\n var i;\n var cue;\n\n if (!track) {\n return;\n }\n\n if (!track.cues) {\n return;\n }\n\n i = track.cues.length;\n\n while (i--) {\n cue = track.cues[i]; // Remove any cue within the provided start and end time\n\n if (cue.startTime >= start && cue.endTime <= end) {\n track.removeCue(cue);\n }\n }\n};\n/**\n * Remove duplicate cues from a track on video.js (a cue is considered a\n * duplicate if it has the same time interval and text as another)\n *\n * @param {Object} track the text track to remove the duplicate cues from\n * @private\n */\n\n\nvar removeDuplicateCuesFromTrack = function removeDuplicateCuesFromTrack(track) {\n var cues = track.cues;\n\n if (!cues) {\n return;\n }\n\n for (var i = 0; i < cues.length; i++) {\n var duplicates = [];\n var occurrences = 0;\n\n for (var j = 0; j < cues.length; j++) {\n if (cues[i].startTime === cues[j].startTime && cues[i].endTime === cues[j].endTime && cues[i].text === cues[j].text) {\n occurrences++;\n\n if (occurrences > 1) {\n duplicates.push(cues[j]);\n }\n }\n }\n\n if (duplicates.length) {\n duplicates.forEach(function (dupe) {\n return track.removeCue(dupe);\n });\n }\n }\n};\n/**\n * Returns a list of gops in the buffer that have a pts value of 3 seconds or more in\n * front of current time.\n *\n * @param {Array} buffer\n * The current buffer of gop information\n * @param {number} currentTime\n * The current time\n * @param {Double} mapping\n * Offset to map display time to stream presentation time\n * @return {Array}\n * List of gops considered safe to append over\n */\n\n\nvar gopsSafeToAlignWith = function gopsSafeToAlignWith(buffer, currentTime, mapping) {\n if (typeof currentTime === 'undefined' || currentTime === null || !buffer.length) {\n return [];\n } // pts value for current time + 3 seconds to give a bit more wiggle room\n\n\n var currentTimePts = Math.ceil((currentTime - mapping + 3) * mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_20__.ONE_SECOND_IN_TS);\n var i;\n\n for (i = 0; i < buffer.length; i++) {\n if (buffer[i].pts > currentTimePts) {\n break;\n }\n }\n\n return buffer.slice(i);\n};\n/**\n * Appends gop information (timing and byteLength) received by the transmuxer for the\n * gops appended in the last call to appendBuffer\n *\n * @param {Array} buffer\n * The current buffer of gop information\n * @param {Array} gops\n * List of new gop information\n * @param {boolean} replace\n * If true, replace the buffer with the new gop information. If false, append the\n * new gop information to the buffer in the right location of time.\n * @return {Array}\n * Updated list of gop information\n */\n\n\nvar updateGopBuffer = function updateGopBuffer(buffer, gops, replace) {\n if (!gops.length) {\n return buffer;\n }\n\n if (replace) {\n // If we are in safe append mode, then completely overwrite the gop buffer\n // with the most recent appeneded data. This will make sure that when appending\n // future segments, we only try to align with gops that are both ahead of current\n // time and in the last segment appended.\n return gops.slice();\n }\n\n var start = gops[0].pts;\n var i = 0;\n\n for (i; i < buffer.length; i++) {\n if (buffer[i].pts >= start) {\n break;\n }\n }\n\n return buffer.slice(0, i).concat(gops);\n};\n/**\n * Removes gop information in buffer that overlaps with provided start and end\n *\n * @param {Array} buffer\n * The current buffer of gop information\n * @param {Double} start\n * position to start the remove at\n * @param {Double} end\n * position to end the remove at\n * @param {Double} mapping\n * Offset to map display time to stream presentation time\n */\n\n\nvar removeGopBuffer = function removeGopBuffer(buffer, start, end, mapping) {\n var startPts = Math.ceil((start - mapping) * mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_20__.ONE_SECOND_IN_TS);\n var endPts = Math.ceil((end - mapping) * mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_20__.ONE_SECOND_IN_TS);\n var updatedBuffer = buffer.slice();\n var i = buffer.length;\n\n while (i--) {\n if (buffer[i].pts <= endPts) {\n break;\n }\n }\n\n if (i === -1) {\n // no removal because end of remove range is before start of buffer\n return updatedBuffer;\n }\n\n var j = i + 1;\n\n while (j--) {\n if (buffer[j].pts <= startPts) {\n break;\n }\n } // clamp remove range start to 0 index\n\n\n j = Math.max(j, 0);\n updatedBuffer.splice(j, i - j + 1);\n return updatedBuffer;\n};\n\nvar shallowEqual = function shallowEqual(a, b) {\n // if both are undefined\n // or one or the other is undefined\n // they are not equal\n if (!a && !b || !a && b || a && !b) {\n return false;\n } // they are the same object and thus, equal\n\n\n if (a === b) {\n return true;\n } // sort keys so we can make sure they have\n // all the same keys later.\n\n\n var akeys = Object.keys(a).sort();\n var bkeys = Object.keys(b).sort(); // different number of keys, not equal\n\n if (akeys.length !== bkeys.length) {\n return false;\n }\n\n for (var i = 0; i < akeys.length; i++) {\n var key = akeys[i]; // different sorted keys, not equal\n\n if (key !== bkeys[i]) {\n return false;\n } // different values, not equal\n\n\n if (a[key] !== b[key]) {\n return false;\n }\n }\n\n return true;\n}; // https://www.w3.org/TR/WebIDL-1/#quotaexceedederror\n\n\nvar QUOTA_EXCEEDED_ERR = 22;\n/**\n * The segment loader has no recourse except to fetch a segment in the\n * current playlist and use the internal timestamps in that segment to\n * generate a syncPoint. This function returns a good candidate index\n * for that process.\n *\n * @param {Array} segments - the segments array from a playlist.\n * @return {number} An index of a segment from the playlist to load\n */\n\nvar getSyncSegmentCandidate = function getSyncSegmentCandidate(currentTimeline, segments, targetTime) {\n segments = segments || [];\n var timelineSegments = [];\n var time = 0;\n\n for (var i = 0; i < segments.length; i++) {\n var segment = segments[i];\n\n if (currentTimeline === segment.timeline) {\n timelineSegments.push(i);\n time += segment.duration;\n\n if (time > targetTime) {\n return i;\n }\n }\n }\n\n if (timelineSegments.length === 0) {\n return 0;\n } // default to the last timeline segment\n\n\n return timelineSegments[timelineSegments.length - 1];\n}; // In the event of a quota exceeded error, keep at least one second of back buffer. This\n// number was arbitrarily chosen and may be updated in the future, but seemed reasonable\n// as a start to prevent any potential issues with removing content too close to the\n// playhead.\n\n\nvar MIN_BACK_BUFFER = 1; // in ms\n\nvar CHECK_BUFFER_DELAY = 500;\n\nvar finite = function finite(num) {\n return typeof num === 'number' && isFinite(num);\n}; // With most content hovering around 30fps, if a segment has a duration less than a half\n// frame at 30fps or one frame at 60fps, the bandwidth and throughput calculations will\n// not accurately reflect the rest of the content.\n\n\nvar MIN_SEGMENT_DURATION_TO_SAVE_STATS = 1 / 60;\n\nvar illegalMediaSwitch = function illegalMediaSwitch(loaderType, startingMedia, trackInfo) {\n // Although these checks should most likely cover non 'main' types, for now it narrows\n // the scope of our checks.\n if (loaderType !== 'main' || !startingMedia || !trackInfo) {\n return null;\n }\n\n if (!trackInfo.hasAudio && !trackInfo.hasVideo) {\n return 'Neither audio nor video found in segment.';\n }\n\n if (startingMedia.hasVideo && !trackInfo.hasVideo) {\n return '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.';\n }\n\n if (!startingMedia.hasVideo && trackInfo.hasVideo) {\n return '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.';\n }\n\n return null;\n};\n/**\n * Calculates a time value that is safe to remove from the back buffer without interrupting\n * playback.\n *\n * @param {TimeRange} seekable\n * The current seekable range\n * @param {number} currentTime\n * The current time of the player\n * @param {number} targetDuration\n * The target duration of the current playlist\n * @return {number}\n * Time that is safe to remove from the back buffer without interrupting playback\n */\n\n\nvar safeBackBufferTrimTime = function safeBackBufferTrimTime(seekable, currentTime, targetDuration) {\n // 30 seconds before the playhead provides a safe default for trimming.\n //\n // Choosing a reasonable default is particularly important for high bitrate content and\n // VOD videos/live streams with large windows, as the buffer may end up overfilled and\n // throw an APPEND_BUFFER_ERR.\n var trimTime = currentTime - Config.BACK_BUFFER_LENGTH;\n\n if (seekable.length) {\n // Some live playlists may have a shorter window of content than the full allowed back\n // buffer. For these playlists, don't save content that's no longer within the window.\n trimTime = Math.max(trimTime, seekable.start(0));\n } // Don't remove within target duration of the current time to avoid the possibility of\n // removing the GOP currently being played, as removing it can cause playback stalls.\n\n\n var maxTrimTime = currentTime - targetDuration;\n return Math.min(maxTrimTime, trimTime);\n};\n\nvar segmentInfoString = function segmentInfoString(segmentInfo) {\n var startOfSegment = segmentInfo.startOfSegment,\n duration = segmentInfo.duration,\n segment = segmentInfo.segment,\n part = segmentInfo.part,\n _segmentInfo$playlist = segmentInfo.playlist,\n seq = _segmentInfo$playlist.mediaSequence,\n id = _segmentInfo$playlist.id,\n _segmentInfo$playlist2 = _segmentInfo$playlist.segments,\n segments = _segmentInfo$playlist2 === void 0 ? [] : _segmentInfo$playlist2,\n index = segmentInfo.mediaIndex,\n partIndex = segmentInfo.partIndex,\n timeline = segmentInfo.timeline;\n var segmentLen = segments.length - 1;\n var selection = 'mediaIndex/partIndex increment';\n\n if (segmentInfo.getMediaInfoForTime) {\n selection = \"getMediaInfoForTime (\" + segmentInfo.getMediaInfoForTime + \")\";\n } else if (segmentInfo.isSyncRequest) {\n selection = 'getSyncSegmentCandidate (isSyncRequest)';\n }\n\n if (segmentInfo.independent) {\n selection += \" with independent \" + segmentInfo.independent;\n }\n\n var hasPartIndex = typeof partIndex === 'number';\n var name = segmentInfo.segment.uri ? 'segment' : 'pre-segment';\n var zeroBasedPartCount = hasPartIndex ? getKnownPartCount({\n preloadSegment: segment\n }) - 1 : 0;\n return name + \" [\" + (seq + index) + \"/\" + (seq + segmentLen) + \"]\" + (hasPartIndex ? \" part [\" + partIndex + \"/\" + zeroBasedPartCount + \"]\" : '') + (\" segment start/end [\" + segment.start + \" => \" + segment.end + \"]\") + (hasPartIndex ? \" part start/end [\" + part.start + \" => \" + part.end + \"]\" : '') + (\" startOfSegment [\" + startOfSegment + \"]\") + (\" duration [\" + duration + \"]\") + (\" timeline [\" + timeline + \"]\") + (\" selected by [\" + selection + \"]\") + (\" playlist [\" + id + \"]\");\n};\n\nvar timingInfoPropertyForMedia = function timingInfoPropertyForMedia(mediaType) {\n return mediaType + \"TimingInfo\";\n};\n/**\n * Returns the timestamp offset to use for the segment.\n *\n * @param {number} segmentTimeline\n * The timeline of the segment\n * @param {number} currentTimeline\n * The timeline currently being followed by the loader\n * @param {number} startOfSegment\n * The estimated segment start\n * @param {TimeRange[]} buffered\n * The loader's buffer\n * @param {boolean} overrideCheck\n * If true, no checks are made to see if the timestamp offset value should be set,\n * but sets it directly to a value.\n *\n * @return {number|null}\n * Either a number representing a new timestamp offset, or null if the segment is\n * part of the same timeline\n */\n\n\nvar timestampOffsetForSegment = function timestampOffsetForSegment(_ref) {\n var segmentTimeline = _ref.segmentTimeline,\n currentTimeline = _ref.currentTimeline,\n startOfSegment = _ref.startOfSegment,\n buffered = _ref.buffered,\n overrideCheck = _ref.overrideCheck; // Check to see if we are crossing a discontinuity to see if we need to set the\n // timestamp offset on the transmuxer and source buffer.\n //\n // Previously, we changed the timestampOffset if the start of this segment was less than\n // the currently set timestampOffset, but this isn't desirable as it can produce bad\n // behavior, especially around long running live streams.\n\n if (!overrideCheck && segmentTimeline === currentTimeline) {\n return null;\n } // When changing renditions, it's possible to request a segment on an older timeline. For\n // instance, given two renditions with the following:\n //\n // #EXTINF:10\n // segment1\n // #EXT-X-DISCONTINUITY\n // #EXTINF:10\n // segment2\n // #EXTINF:10\n // segment3\n //\n // And the current player state:\n //\n // current time: 8\n // buffer: 0 => 20\n //\n // The next segment on the current rendition would be segment3, filling the buffer from\n // 20s onwards. However, if a rendition switch happens after segment2 was requested,\n // then the next segment to be requested will be segment1 from the new rendition in\n // order to fill time 8 and onwards. Using the buffered end would result in repeated\n // content (since it would position segment1 of the new rendition starting at 20s). This\n // case can be identified when the new segment's timeline is a prior value. Instead of\n // using the buffered end, the startOfSegment can be used, which, hopefully, will be\n // more accurate to the actual start time of the segment.\n\n\n if (segmentTimeline < currentTimeline) {\n return startOfSegment;\n } // segmentInfo.startOfSegment used to be used as the timestamp offset, however, that\n // value uses the end of the last segment if it is available. While this value\n // should often be correct, it's better to rely on the buffered end, as the new\n // content post discontinuity should line up with the buffered end as if it were\n // time 0 for the new content.\n\n\n return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment;\n};\n/**\n * Returns whether or not the loader should wait for a timeline change from the timeline\n * change controller before processing the segment.\n *\n * Primary timing in VHS goes by video. This is different from most media players, as\n * audio is more often used as the primary timing source. For the foreseeable future, VHS\n * will continue to use video as the primary timing source, due to the current logic and\n * expectations built around it.\n\n * Since the timing follows video, in order to maintain sync, the video loader is\n * responsible for setting both audio and video source buffer timestamp offsets.\n *\n * Setting different values for audio and video source buffers could lead to\n * desyncing. The following examples demonstrate some of the situations where this\n * distinction is important. Note that all of these cases involve demuxed content. When\n * content is muxed, the audio and video are packaged together, therefore syncing\n * separate media playlists is not an issue.\n *\n * CASE 1: Audio prepares to load a new timeline before video:\n *\n * Timeline: 0 1\n * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Audio Loader: ^\n * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Video Loader ^\n *\n * In the above example, the audio loader is preparing to load the 6th segment, the first\n * after a discontinuity, while the video loader is still loading the 5th segment, before\n * the discontinuity.\n *\n * If the audio loader goes ahead and loads and appends the 6th segment before the video\n * loader crosses the discontinuity, then when appended, the 6th audio segment will use\n * the timestamp offset from timeline 0. This will likely lead to desyncing. In addition,\n * the audio loader must provide the audioAppendStart value to trim the content in the\n * transmuxer, and that value relies on the audio timestamp offset. Since the audio\n * timestamp offset is set by the video (main) loader, the audio loader shouldn't load the\n * segment until that value is provided.\n *\n * CASE 2: Video prepares to load a new timeline before audio:\n *\n * Timeline: 0 1\n * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Audio Loader: ^\n * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Video Loader ^\n *\n * In the above example, the video loader is preparing to load the 6th segment, the first\n * after a discontinuity, while the audio loader is still loading the 5th segment, before\n * the discontinuity.\n *\n * If the video loader goes ahead and loads and appends the 6th segment, then once the\n * segment is loaded and processed, both the video and audio timestamp offsets will be\n * set, since video is used as the primary timing source. This is to ensure content lines\n * up appropriately, as any modifications to the video timing are reflected by audio when\n * the video loader sets the audio and video timestamp offsets to the same value. However,\n * setting the timestamp offset for audio before audio has had a chance to change\n * timelines will likely lead to desyncing, as the audio loader will append segment 5 with\n * a timestamp intended to apply to segments from timeline 1 rather than timeline 0.\n *\n * CASE 3: When seeking, audio prepares to load a new timeline before video\n *\n * Timeline: 0 1\n * Audio Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Audio Loader: ^\n * Video Segments: 0 1 2 3 4 5 DISCO 6 7 8 9\n * Video Loader ^\n *\n * In the above example, both audio and video loaders are loading segments from timeline\n * 0, but imagine that the seek originated from timeline 1.\n *\n * When seeking to a new timeline, the timestamp offset will be set based on the expected\n * segment start of the loaded video segment. In order to maintain sync, the audio loader\n * must wait for the video loader to load its segment and update both the audio and video\n * timestamp offsets before it may load and append its own segment. This is the case\n * whether the seek results in a mismatched segment request (e.g., the audio loader\n * chooses to load segment 3 and the video loader chooses to load segment 4) or the\n * loaders choose to load the same segment index from each playlist, as the segments may\n * not be aligned perfectly, even for matching segment indexes.\n *\n * @param {Object} timelinechangeController\n * @param {number} currentTimeline\n * The timeline currently being followed by the loader\n * @param {number} segmentTimeline\n * The timeline of the segment being loaded\n * @param {('main'|'audio')} loaderType\n * The loader type\n * @param {boolean} audioDisabled\n * Whether the audio is disabled for the loader. This should only be true when the\n * loader may have muxed audio in its segment, but should not append it, e.g., for\n * the main loader when an alternate audio playlist is active.\n *\n * @return {boolean}\n * Whether the loader should wait for a timeline change from the timeline change\n * controller before processing the segment\n */\n\n\nvar shouldWaitForTimelineChange = function shouldWaitForTimelineChange(_ref2) {\n var timelineChangeController = _ref2.timelineChangeController,\n currentTimeline = _ref2.currentTimeline,\n segmentTimeline = _ref2.segmentTimeline,\n loaderType = _ref2.loaderType,\n audioDisabled = _ref2.audioDisabled;\n\n if (currentTimeline === segmentTimeline) {\n return false;\n }\n\n if (loaderType === 'audio') {\n var lastMainTimelineChange = timelineChangeController.lastTimelineChange({\n type: 'main'\n }); // Audio loader should wait if:\n //\n // * main hasn't had a timeline change yet (thus has not loaded its first segment)\n // * main hasn't yet changed to the timeline audio is looking to load\n\n return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline;\n } // The main loader only needs to wait for timeline changes if there's demuxed audio.\n // Otherwise, there's nothing to wait for, since audio would be muxed into the main\n // loader's segments (or the content is audio/video only and handled by the main\n // loader).\n\n\n if (loaderType === 'main' && audioDisabled) {\n var pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({\n type: 'audio'\n }); // Main loader should wait for the audio loader if audio is not pending a timeline\n // change to the current timeline.\n //\n // Since the main loader is responsible for setting the timestamp offset for both\n // audio and video, the main loader must wait for audio to be about to change to its\n // timeline before setting the offset, otherwise, if audio is behind in loading,\n // segments from the previous timeline would be adjusted by the new timestamp offset.\n //\n // This requirement means that video will not cross a timeline until the audio is\n // about to cross to it, so that way audio and video will always cross the timeline\n // together.\n //\n // In addition to normal timeline changes, these rules also apply to the start of a\n // stream (going from a non-existent timeline, -1, to timeline 0). It's important\n // that these rules apply to the first timeline change because if they did not, it's\n // possible that the main loader will cross two timelines before the audio loader has\n // crossed one. Logic may be implemented to handle the startup as a special case, but\n // it's easier to simply treat all timeline changes the same.\n\n if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) {\n return false;\n }\n\n return true;\n }\n\n return false;\n};\n\nvar mediaDuration = function mediaDuration(timingInfos) {\n var maxDuration = 0;\n ['video', 'audio'].forEach(function (type) {\n var typeTimingInfo = timingInfos[type + \"TimingInfo\"];\n\n if (!typeTimingInfo) {\n return;\n }\n\n var start = typeTimingInfo.start,\n end = typeTimingInfo.end;\n var duration;\n\n if (typeof start === 'bigint' || typeof end === 'bigint') {\n duration = global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt(end) - global_window__WEBPACK_IMPORTED_MODULE_0___default().BigInt(start);\n } else if (typeof start === 'number' && typeof end === 'number') {\n duration = end - start;\n }\n\n if (typeof duration !== 'undefined' && duration > maxDuration) {\n maxDuration = duration;\n }\n }); // convert back to a number if it is lower than MAX_SAFE_INTEGER\n // as we only need BigInt when we are above that.\n\n if (typeof maxDuration === 'bigint' && maxDuration < Number.MAX_SAFE_INTEGER) {\n maxDuration = Number(maxDuration);\n }\n\n return maxDuration;\n};\n\nvar segmentTooLong = function segmentTooLong(_ref3) {\n var segmentDuration = _ref3.segmentDuration,\n maxDuration = _ref3.maxDuration; // 0 duration segments are most likely due to metadata only segments or a lack of\n // information.\n\n if (!segmentDuration) {\n return false;\n } // For HLS:\n //\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1\n // The EXTINF duration of each Media Segment in the Playlist\n // file, when rounded to the nearest integer, MUST be less than or equal\n // to the target duration; longer segments can trigger playback stalls\n // or other errors.\n //\n // For DASH, the mpd-parser uses the largest reported segment duration as the target\n // duration. Although that reported duration is occasionally approximate (i.e., not\n // exact), a strict check may report that a segment is too long more often in DASH.\n\n\n return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR;\n};\n\nvar getTroublesomeSegmentDurationMessage = function getTroublesomeSegmentDurationMessage(segmentInfo, sourceType) {\n // Right now we aren't following DASH's timing model exactly, so only perform\n // this check for HLS content.\n if (sourceType !== 'hls') {\n return null;\n }\n\n var segmentDuration = mediaDuration({\n audioTimingInfo: segmentInfo.audioTimingInfo,\n videoTimingInfo: segmentInfo.videoTimingInfo\n }); // Don't report if we lack information.\n //\n // If the segment has a duration of 0 it is either a lack of information or a\n // metadata only segment and shouldn't be reported here.\n\n if (!segmentDuration) {\n return null;\n }\n\n var targetDuration = segmentInfo.playlist.targetDuration;\n var isSegmentWayTooLong = segmentTooLong({\n segmentDuration: segmentDuration,\n maxDuration: targetDuration * 2\n });\n var isSegmentSlightlyTooLong = segmentTooLong({\n segmentDuration: segmentDuration,\n maxDuration: targetDuration\n });\n var segmentTooLongMessage = \"Segment with index \" + segmentInfo.mediaIndex + \" \" + (\"from playlist \" + segmentInfo.playlist.id + \" \") + (\"has a duration of \" + segmentDuration + \" \") + (\"when the reported duration is \" + segmentInfo.duration + \" \") + (\"and the target duration is \" + targetDuration + \". \") + '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';\n\n if (isSegmentWayTooLong || isSegmentSlightlyTooLong) {\n return {\n severity: isSegmentWayTooLong ? 'warn' : 'info',\n message: segmentTooLongMessage\n };\n }\n\n return null;\n};\n/**\n * An object that manages segment loading and appending.\n *\n * @class SegmentLoader\n * @param {Object} options required and optional options\n * @extends videojs.EventTarget\n */\n\n\nvar SegmentLoader = /*#__PURE__*/function (_videojs$EventTarget) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(SegmentLoader, _videojs$EventTarget);\n\n function SegmentLoader(settings, options) {\n var _this;\n\n _this = _videojs$EventTarget.call(this) || this; // check pre-conditions\n\n if (!settings) {\n throw new TypeError('Initialization settings are required');\n }\n\n if (typeof settings.currentTime !== 'function') {\n throw new TypeError('No currentTime getter specified');\n }\n\n if (!settings.mediaSource) {\n throw new TypeError('No MediaSource specified');\n } // public properties\n\n\n _this.bandwidth = settings.bandwidth;\n _this.throughput = {\n rate: 0,\n count: 0\n };\n _this.roundTrip = NaN;\n\n _this.resetStats_();\n\n _this.mediaIndex = null;\n _this.partIndex = null; // private settings\n\n _this.hasPlayed_ = settings.hasPlayed;\n _this.currentTime_ = settings.currentTime;\n _this.seekable_ = settings.seekable;\n _this.seeking_ = settings.seeking;\n _this.duration_ = settings.duration;\n _this.mediaSource_ = settings.mediaSource;\n _this.vhs_ = settings.vhs;\n _this.loaderType_ = settings.loaderType;\n _this.currentMediaInfo_ = void 0;\n _this.startingMediaInfo_ = void 0;\n _this.segmentMetadataTrack_ = settings.segmentMetadataTrack;\n _this.goalBufferLength_ = settings.goalBufferLength;\n _this.sourceType_ = settings.sourceType;\n _this.sourceUpdater_ = settings.sourceUpdater;\n _this.inbandTextTracks_ = settings.inbandTextTracks;\n _this.state_ = 'INIT';\n _this.timelineChangeController_ = settings.timelineChangeController;\n _this.shouldSaveSegmentTimingInfo_ = true;\n _this.parse708captions_ = settings.parse708captions;\n _this.useDtsForTimestampOffset_ = settings.useDtsForTimestampOffset;\n _this.captionServices_ = settings.captionServices;\n _this.experimentalExactManifestTimings = settings.experimentalExactManifestTimings; // private instance variables\n\n _this.checkBufferTimeout_ = null;\n _this.error_ = void 0;\n _this.currentTimeline_ = -1;\n _this.pendingSegment_ = null;\n _this.xhrOptions_ = null;\n _this.pendingSegments_ = [];\n _this.audioDisabled_ = false;\n _this.isPendingTimestampOffset_ = false; // TODO possibly move gopBuffer and timeMapping info to a separate controller\n\n _this.gopBuffer_ = [];\n _this.timeMapping_ = 0;\n _this.safeAppend_ = videojs.browser.IE_VERSION >= 11;\n _this.appendInitSegment_ = {\n audio: true,\n video: true\n };\n _this.playlistOfLastInitSegment_ = {\n audio: null,\n video: null\n };\n _this.callQueue_ = []; // If the segment loader prepares to load a segment, but does not have enough\n // information yet to start the loading process (e.g., if the audio loader wants to\n // load a segment from the next timeline but the main loader hasn't yet crossed that\n // timeline), then the load call will be added to the queue until it is ready to be\n // processed.\n\n _this.loadQueue_ = [];\n _this.metadataQueue_ = {\n id3: [],\n caption: []\n };\n _this.waitingOnRemove_ = false;\n _this.quotaExceededErrorRetryTimeout_ = null; // Fragmented mp4 playback\n\n _this.activeInitSegmentId_ = null;\n _this.initSegments_ = {}; // HLSe playback\n\n _this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys;\n _this.keyCache_ = {};\n _this.decrypter_ = settings.decrypter; // Manages the tracking and generation of sync-points, mappings\n // between a time in the display time and a segment index within\n // a playlist\n\n _this.syncController_ = settings.syncController;\n _this.syncPoint_ = {\n segmentIndex: 0,\n time: 0\n };\n _this.transmuxer_ = _this.createTransmuxer_();\n\n _this.triggerSyncInfoUpdate_ = function () {\n return _this.trigger('syncinfoupdate');\n };\n\n _this.syncController_.on('syncinfoupdate', _this.triggerSyncInfoUpdate_);\n\n _this.mediaSource_.addEventListener('sourceopen', function () {\n if (!_this.isEndOfStream_()) {\n _this.ended_ = false;\n }\n }); // ...for determining the fetch location\n\n\n _this.fetchAtBuffer_ = false;\n _this.logger_ = logger(\"SegmentLoader[\" + _this.loaderType_ + \"]\");\n Object.defineProperty((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), 'state', {\n get: function get() {\n return this.state_;\n },\n set: function set(newState) {\n if (newState !== this.state_) {\n this.logger_(this.state_ + \" -> \" + newState);\n this.state_ = newState;\n this.trigger('statechange');\n }\n }\n });\n\n _this.sourceUpdater_.on('ready', function () {\n if (_this.hasEnoughInfoToAppend_()) {\n _this.processCallQueue_();\n }\n }); // Only the main loader needs to listen for pending timeline changes, as the main\n // loader should wait for audio to be ready to change its timeline so that both main\n // and audio timelines change together. For more details, see the\n // shouldWaitForTimelineChange function.\n\n\n if (_this.loaderType_ === 'main') {\n _this.timelineChangeController_.on('pendingtimelinechange', function () {\n if (_this.hasEnoughInfoToAppend_()) {\n _this.processCallQueue_();\n }\n });\n } // The main loader only listens on pending timeline changes, but the audio loader,\n // since its loads follow main, needs to listen on timeline changes. For more details,\n // see the shouldWaitForTimelineChange function.\n\n\n if (_this.loaderType_ === 'audio') {\n _this.timelineChangeController_.on('timelinechange', function () {\n if (_this.hasEnoughInfoToLoad_()) {\n _this.processLoadQueue_();\n }\n\n if (_this.hasEnoughInfoToAppend_()) {\n _this.processCallQueue_();\n }\n });\n }\n\n return _this;\n }\n\n var _proto = SegmentLoader.prototype;\n\n _proto.createTransmuxer_ = function createTransmuxer_() {\n return segmentTransmuxer.createTransmuxer({\n remux: false,\n alignGopsAtEnd: this.safeAppend_,\n keepOriginalTimestamps: true,\n parse708captions: this.parse708captions_,\n captionServices: this.captionServices_\n });\n }\n /**\n * reset all of our media stats\n *\n * @private\n */\n ;\n\n _proto.resetStats_ = function resetStats_() {\n this.mediaBytesTransferred = 0;\n this.mediaRequests = 0;\n this.mediaRequestsAborted = 0;\n this.mediaRequestsTimedout = 0;\n this.mediaRequestsErrored = 0;\n this.mediaTransferDuration = 0;\n this.mediaSecondsLoaded = 0;\n this.mediaAppends = 0;\n }\n /**\n * dispose of the SegmentLoader and reset to the default state\n */\n ;\n\n _proto.dispose = function dispose() {\n this.trigger('dispose');\n this.state = 'DISPOSED';\n this.pause();\n this.abort_();\n\n if (this.transmuxer_) {\n this.transmuxer_.terminate();\n }\n\n this.resetStats_();\n\n if (this.checkBufferTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.checkBufferTimeout_);\n }\n\n if (this.syncController_ && this.triggerSyncInfoUpdate_) {\n this.syncController_.off('syncinfoupdate', this.triggerSyncInfoUpdate_);\n }\n\n this.off();\n };\n\n _proto.setAudio = function setAudio(enable) {\n this.audioDisabled_ = !enable;\n\n if (enable) {\n this.appendInitSegment_.audio = true;\n } else {\n // remove current track audio if it gets disabled\n this.sourceUpdater_.removeAudio(0, this.duration_());\n }\n }\n /**\n * abort anything that is currently doing on with the SegmentLoader\n * and reset to a default state\n */\n ;\n\n _proto.abort = function abort() {\n if (this.state !== 'WAITING') {\n if (this.pendingSegment_) {\n this.pendingSegment_ = null;\n }\n\n return;\n }\n\n this.abort_(); // We aborted the requests we were waiting on, so reset the loader's state to READY\n // since we are no longer \"waiting\" on any requests. XHR callback is not always run\n // when the request is aborted. This will prevent the loader from being stuck in the\n // WAITING state indefinitely.\n\n this.state = 'READY'; // don't wait for buffer check timeouts to begin fetching the\n // next segment\n\n if (!this.paused()) {\n this.monitorBuffer_();\n }\n }\n /**\n * abort all pending xhr requests and null any pending segements\n *\n * @private\n */\n ;\n\n _proto.abort_ = function abort_() {\n if (this.pendingSegment_ && this.pendingSegment_.abortRequests) {\n this.pendingSegment_.abortRequests();\n } // clear out the segment being processed\n\n\n this.pendingSegment_ = null;\n this.callQueue_ = [];\n this.loadQueue_ = [];\n this.metadataQueue_.id3 = [];\n this.metadataQueue_.caption = [];\n this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);\n this.waitingOnRemove_ = false;\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.quotaExceededErrorRetryTimeout_);\n this.quotaExceededErrorRetryTimeout_ = null;\n };\n\n _proto.checkForAbort_ = function checkForAbort_(requestId) {\n // If the state is APPENDING, then aborts will not modify the state, meaning the first\n // callback that happens should reset the state to READY so that loading can continue.\n if (this.state === 'APPENDING' && !this.pendingSegment_) {\n this.state = 'READY';\n return true;\n }\n\n if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) {\n return true;\n }\n\n return false;\n }\n /**\n * set an error on the segment loader and null out any pending segements\n *\n * @param {Error} error the error to set on the SegmentLoader\n * @return {Error} the error that was set or that is currently set\n */\n ;\n\n _proto.error = function error(_error) {\n if (typeof _error !== 'undefined') {\n this.logger_('error occurred:', _error);\n this.error_ = _error;\n }\n\n this.pendingSegment_ = null;\n return this.error_;\n };\n\n _proto.endOfStream = function endOfStream() {\n this.ended_ = true;\n\n if (this.transmuxer_) {\n // need to clear out any cached data to prepare for the new segment\n segmentTransmuxer.reset(this.transmuxer_);\n }\n\n this.gopBuffer_.length = 0;\n this.pause();\n this.trigger('ended');\n }\n /**\n * Indicates which time ranges are buffered\n *\n * @return {TimeRange}\n * TimeRange object representing the current buffered ranges\n */\n ;\n\n _proto.buffered_ = function buffered_() {\n var trackInfo = this.getMediaInfo_();\n\n if (!this.sourceUpdater_ || !trackInfo) {\n return videojs.createTimeRanges();\n }\n\n if (this.loaderType_ === 'main') {\n var hasAudio = trackInfo.hasAudio,\n hasVideo = trackInfo.hasVideo,\n isMuxed = trackInfo.isMuxed;\n\n if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed) {\n return this.sourceUpdater_.buffered();\n }\n\n if (hasVideo) {\n return this.sourceUpdater_.videoBuffered();\n }\n } // One case that can be ignored for now is audio only with alt audio,\n // as we don't yet have proper support for that.\n\n\n return this.sourceUpdater_.audioBuffered();\n }\n /**\n * Gets and sets init segment for the provided map\n *\n * @param {Object} map\n * The map object representing the init segment to get or set\n * @param {boolean=} set\n * If true, the init segment for the provided map should be saved\n * @return {Object}\n * map object for desired init segment\n */\n ;\n\n _proto.initSegmentForMap = function initSegmentForMap(map, set) {\n if (set === void 0) {\n set = false;\n }\n\n if (!map) {\n return null;\n }\n\n var id = initSegmentId(map);\n var storedMap = this.initSegments_[id];\n\n if (set && !storedMap && map.bytes) {\n this.initSegments_[id] = storedMap = {\n resolvedUri: map.resolvedUri,\n byterange: map.byterange,\n bytes: map.bytes,\n tracks: map.tracks,\n timescales: map.timescales\n };\n }\n\n return storedMap || map;\n }\n /**\n * Gets and sets key for the provided key\n *\n * @param {Object} key\n * The key object representing the key to get or set\n * @param {boolean=} set\n * If true, the key for the provided key should be saved\n * @return {Object}\n * Key object for desired key\n */\n ;\n\n _proto.segmentKey = function segmentKey(key, set) {\n if (set === void 0) {\n set = false;\n }\n\n if (!key) {\n return null;\n }\n\n var id = segmentKeyId(key);\n var storedKey = this.keyCache_[id]; // TODO: We should use the HTTP Expires header to invalidate our cache per\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-6.2.3\n\n if (this.cacheEncryptionKeys_ && set && !storedKey && key.bytes) {\n this.keyCache_[id] = storedKey = {\n resolvedUri: key.resolvedUri,\n bytes: key.bytes\n };\n }\n\n var result = {\n resolvedUri: (storedKey || key).resolvedUri\n };\n\n if (storedKey) {\n result.bytes = storedKey.bytes;\n }\n\n return result;\n }\n /**\n * Returns true if all configuration required for loading is present, otherwise false.\n *\n * @return {boolean} True if the all configuration is ready for loading\n * @private\n */\n ;\n\n _proto.couldBeginLoading_ = function couldBeginLoading_() {\n return this.playlist_ && !this.paused();\n }\n /**\n * load a playlist and start to fill the buffer\n */\n ;\n\n _proto.load = function load() {\n // un-pause\n this.monitorBuffer_(); // if we don't have a playlist yet, keep waiting for one to be\n // specified\n\n if (!this.playlist_) {\n return;\n } // if all the configuration is ready, initialize and begin loading\n\n\n if (this.state === 'INIT' && this.couldBeginLoading_()) {\n return this.init_();\n } // if we're in the middle of processing a segment already, don't\n // kick off an additional segment request\n\n\n if (!this.couldBeginLoading_() || this.state !== 'READY' && this.state !== 'INIT') {\n return;\n }\n\n this.state = 'READY';\n }\n /**\n * Once all the starting parameters have been specified, begin\n * operation. This method should only be invoked from the INIT\n * state.\n *\n * @private\n */\n ;\n\n _proto.init_ = function init_() {\n this.state = 'READY'; // if this is the audio segment loader, and it hasn't been inited before, then any old\n // audio data from the muxed content should be removed\n\n this.resetEverything();\n return this.monitorBuffer_();\n }\n /**\n * set a playlist on the segment loader\n *\n * @param {PlaylistLoader} media the playlist to set on the segment loader\n */\n ;\n\n _proto.playlist = function playlist(newPlaylist, options) {\n if (options === void 0) {\n options = {};\n }\n\n if (!newPlaylist) {\n return;\n }\n\n var oldPlaylist = this.playlist_;\n var segmentInfo = this.pendingSegment_;\n this.playlist_ = newPlaylist;\n this.xhrOptions_ = options; // when we haven't started playing yet, the start of a live playlist\n // is always our zero-time so force a sync update each time the playlist\n // is refreshed from the server\n //\n // Use the INIT state to determine if playback has started, as the playlist sync info\n // should be fixed once requests begin (as sync points are generated based on sync\n // info), but not before then.\n\n if (this.state === 'INIT') {\n newPlaylist.syncInfo = {\n mediaSequence: newPlaylist.mediaSequence,\n time: 0\n }; // Setting the date time mapping means mapping the program date time (if available)\n // to time 0 on the player's timeline. The playlist's syncInfo serves a similar\n // purpose, mapping the initial mediaSequence to time zero. Since the syncInfo can\n // be updated as the playlist is refreshed before the loader starts loading, the\n // program date time mapping needs to be updated as well.\n //\n // This mapping is only done for the main loader because a program date time should\n // map equivalently between playlists.\n\n if (this.loaderType_ === 'main') {\n this.syncController_.setDateTimeMappingForStart(newPlaylist);\n }\n }\n\n var oldId = null;\n\n if (oldPlaylist) {\n if (oldPlaylist.id) {\n oldId = oldPlaylist.id;\n } else if (oldPlaylist.uri) {\n oldId = oldPlaylist.uri;\n }\n }\n\n this.logger_(\"playlist update [\" + oldId + \" => \" + (newPlaylist.id || newPlaylist.uri) + \"]\"); // in VOD, this is always a rendition switch (or we updated our syncInfo above)\n // in LIVE, we always want to update with new playlists (including refreshes)\n\n this.trigger('syncinfoupdate'); // if we were unpaused but waiting for a playlist, start\n // buffering now\n\n if (this.state === 'INIT' && this.couldBeginLoading_()) {\n return this.init_();\n }\n\n if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) {\n if (this.mediaIndex !== null) {\n // we must reset/resync the segment loader when we switch renditions and\n // the segment loader is already synced to the previous rendition\n // on playlist changes we want it to be possible to fetch\n // at the buffer for vod but not for live. So we use resetLoader\n // for live and resyncLoader for vod. We want this because\n // if a playlist uses independent and non-independent segments/parts the\n // buffer may not accurately reflect the next segment that we should try\n // downloading.\n if (!newPlaylist.endList) {\n this.resetLoader();\n } else {\n this.resyncLoader();\n }\n }\n\n this.currentMediaInfo_ = void 0;\n this.trigger('playlistupdate'); // the rest of this function depends on `oldPlaylist` being defined\n\n return;\n } // we reloaded the same playlist so we are in a live scenario\n // and we will likely need to adjust the mediaIndex\n\n\n var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;\n this.logger_(\"live window shift [\" + mediaSequenceDiff + \"]\"); // update the mediaIndex on the SegmentLoader\n // this is important because we can abort a request and this value must be\n // equal to the last appended mediaIndex\n\n if (this.mediaIndex !== null) {\n this.mediaIndex -= mediaSequenceDiff; // this can happen if we are going to load the first segment, but get a playlist\n // update during that. mediaIndex would go from 0 to -1 if mediaSequence in the\n // new playlist was incremented by 1.\n\n if (this.mediaIndex < 0) {\n this.mediaIndex = null;\n this.partIndex = null;\n } else {\n var segment = this.playlist_.segments[this.mediaIndex]; // partIndex should remain the same for the same segment\n // unless parts fell off of the playlist for this segment.\n // In that case we need to reset partIndex and resync\n\n if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) {\n var mediaIndex = this.mediaIndex;\n this.logger_(\"currently processing part (index \" + this.partIndex + \") no longer exists.\");\n this.resetLoader(); // We want to throw away the partIndex and the data associated with it,\n // as the part was dropped from our current playlists segment.\n // The mediaIndex will still be valid so keep that around.\n\n this.mediaIndex = mediaIndex;\n }\n }\n } // update the mediaIndex on the SegmentInfo object\n // this is important because we will update this.mediaIndex with this value\n // in `handleAppendsDone_` after the segment has been successfully appended\n\n\n if (segmentInfo) {\n segmentInfo.mediaIndex -= mediaSequenceDiff;\n\n if (segmentInfo.mediaIndex < 0) {\n segmentInfo.mediaIndex = null;\n segmentInfo.partIndex = null;\n } else {\n // we need to update the referenced segment so that timing information is\n // saved for the new playlist's segment, however, if the segment fell off the\n // playlist, we can leave the old reference and just lose the timing info\n if (segmentInfo.mediaIndex >= 0) {\n segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex];\n }\n\n if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) {\n segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex];\n }\n }\n }\n\n this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist);\n }\n /**\n * Prevent the loader from fetching additional segments. If there\n * is a segment request outstanding, it will finish processing\n * before the loader halts. A segment loader can be unpaused by\n * calling load().\n */\n ;\n\n _proto.pause = function pause() {\n if (this.checkBufferTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.checkBufferTimeout_);\n this.checkBufferTimeout_ = null;\n }\n }\n /**\n * Returns whether the segment loader is fetching additional\n * segments when given the opportunity. This property can be\n * modified through calls to pause() and load().\n */\n ;\n\n _proto.paused = function paused() {\n return this.checkBufferTimeout_ === null;\n }\n /**\n * Delete all the buffered data and reset the SegmentLoader\n *\n * @param {Function} [done] an optional callback to be executed when the remove\n * operation is complete\n */\n ;\n\n _proto.resetEverything = function resetEverything(done) {\n this.ended_ = false;\n this.activeInitSegmentId_ = null;\n this.appendInitSegment_ = {\n audio: true,\n video: true\n };\n this.resetLoader(); // remove from 0, the earliest point, to Infinity, to signify removal of everything.\n // VTT Segment Loader doesn't need to do anything but in the regular SegmentLoader,\n // we then clamp the value to duration if necessary.\n\n this.remove(0, Infinity, done); // clears fmp4 captions\n\n if (this.transmuxer_) {\n this.transmuxer_.postMessage({\n action: 'clearAllMp4Captions'\n }); // reset the cache in the transmuxer\n\n this.transmuxer_.postMessage({\n action: 'reset'\n });\n }\n }\n /**\n * Force the SegmentLoader to resync and start loading around the currentTime instead\n * of starting at the end of the buffer\n *\n * Useful for fast quality changes\n */\n ;\n\n _proto.resetLoader = function resetLoader() {\n this.fetchAtBuffer_ = false;\n this.resyncLoader();\n }\n /**\n * Force the SegmentLoader to restart synchronization and make a conservative guess\n * before returning to the simple walk-forward method\n */\n ;\n\n _proto.resyncLoader = function resyncLoader() {\n if (this.transmuxer_) {\n // need to clear out any cached data to prepare for the new segment\n segmentTransmuxer.reset(this.transmuxer_);\n }\n\n this.mediaIndex = null;\n this.partIndex = null;\n this.syncPoint_ = null;\n this.isPendingTimestampOffset_ = false;\n this.callQueue_ = [];\n this.loadQueue_ = [];\n this.metadataQueue_.id3 = [];\n this.metadataQueue_.caption = [];\n this.abort();\n\n if (this.transmuxer_) {\n this.transmuxer_.postMessage({\n action: 'clearParsedMp4Captions'\n });\n }\n }\n /**\n * Remove any data in the source buffer between start and end times\n *\n * @param {number} start - the start time of the region to remove from the buffer\n * @param {number} end - the end time of the region to remove from the buffer\n * @param {Function} [done] - an optional callback to be executed when the remove\n * @param {boolean} force - force all remove operations to happen\n * operation is complete\n */\n ;\n\n _proto.remove = function remove(start, end, done, force) {\n if (done === void 0) {\n done = function done() {};\n }\n\n if (force === void 0) {\n force = false;\n } // clamp end to duration if we need to remove everything.\n // This is due to a browser bug that causes issues if we remove to Infinity.\n // videojs/videojs-contrib-hls#1225\n\n\n if (end === Infinity) {\n end = this.duration_();\n } // skip removes that would throw an error\n // commonly happens during a rendition switch at the start of a video\n // from start 0 to end 0\n\n\n if (end <= start) {\n this.logger_('skipping remove because end ${end} is <= start ${start}');\n return;\n }\n\n if (!this.sourceUpdater_ || !this.getMediaInfo_()) {\n this.logger_('skipping remove because no source updater or starting media info'); // nothing to remove if we haven't processed any media\n\n return;\n } // set it to one to complete this function's removes\n\n\n var removesRemaining = 1;\n\n var removeFinished = function removeFinished() {\n removesRemaining--;\n\n if (removesRemaining === 0) {\n done();\n }\n };\n\n if (force || !this.audioDisabled_) {\n removesRemaining++;\n this.sourceUpdater_.removeAudio(start, end, removeFinished);\n } // While it would be better to only remove video if the main loader has video, this\n // should be safe with audio only as removeVideo will call back even if there's no\n // video buffer.\n //\n // In theory we can check to see if there's video before calling the remove, but in\n // the event that we're switching between renditions and from video to audio only\n // (when we add support for that), we may need to clear the video contents despite\n // what the new media will contain.\n\n\n if (force || this.loaderType_ === 'main') {\n this.gopBuffer_ = removeGopBuffer(this.gopBuffer_, start, end, this.timeMapping_);\n removesRemaining++;\n this.sourceUpdater_.removeVideo(start, end, removeFinished);\n } // remove any captions and ID3 tags\n\n\n for (var track in this.inbandTextTracks_) {\n removeCuesFromTrack(start, end, this.inbandTextTracks_[track]);\n }\n\n removeCuesFromTrack(start, end, this.segmentMetadataTrack_); // finished this function's removes\n\n removeFinished();\n }\n /**\n * (re-)schedule monitorBufferTick_ to run as soon as possible\n *\n * @private\n */\n ;\n\n _proto.monitorBuffer_ = function monitorBuffer_() {\n if (this.checkBufferTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.checkBufferTimeout_);\n }\n\n this.checkBufferTimeout_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(this.monitorBufferTick_.bind(this), 1);\n }\n /**\n * As long as the SegmentLoader is in the READY state, periodically\n * invoke fillBuffer_().\n *\n * @private\n */\n ;\n\n _proto.monitorBufferTick_ = function monitorBufferTick_() {\n if (this.state === 'READY') {\n this.fillBuffer_();\n }\n\n if (this.checkBufferTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.checkBufferTimeout_);\n }\n\n this.checkBufferTimeout_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY);\n }\n /**\n * fill the buffer with segements unless the sourceBuffers are\n * currently updating\n *\n * Note: this function should only ever be called by monitorBuffer_\n * and never directly\n *\n * @private\n */\n ;\n\n _proto.fillBuffer_ = function fillBuffer_() {\n // TODO since the source buffer maintains a queue, and we shouldn't call this function\n // except when we're ready for the next segment, this check can most likely be removed\n if (this.sourceUpdater_.updating()) {\n return;\n } // see if we need to begin loading immediately\n\n\n var segmentInfo = this.chooseNextRequest_();\n\n if (!segmentInfo) {\n return;\n }\n\n if (typeof segmentInfo.timestampOffset === 'number') {\n this.isPendingTimestampOffset_ = false;\n this.timelineChangeController_.pendingTimelineChange({\n type: this.loaderType_,\n from: this.currentTimeline_,\n to: segmentInfo.timeline\n });\n }\n\n this.loadSegment_(segmentInfo);\n }\n /**\n * Determines if we should call endOfStream on the media source based\n * on the state of the buffer or if appened segment was the final\n * segment in the playlist.\n *\n * @param {number} [mediaIndex] the media index of segment we last appended\n * @param {Object} [playlist] a media playlist object\n * @return {boolean} do we need to call endOfStream on the MediaSource\n */\n ;\n\n _proto.isEndOfStream_ = function isEndOfStream_(mediaIndex, playlist, partIndex) {\n if (mediaIndex === void 0) {\n mediaIndex = this.mediaIndex;\n }\n\n if (playlist === void 0) {\n playlist = this.playlist_;\n }\n\n if (partIndex === void 0) {\n partIndex = this.partIndex;\n }\n\n if (!playlist || !this.mediaSource_) {\n return false;\n }\n\n var segment = typeof mediaIndex === 'number' && playlist.segments[mediaIndex]; // mediaIndex is zero based but length is 1 based\n\n var appendedLastSegment = mediaIndex + 1 === playlist.segments.length; // true if there are no parts, or this is the last part.\n\n var appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length; // if we've buffered to the end of the video, we need to call endOfStream\n // so that MediaSources can trigger the `ended` event when it runs out of\n // buffered data instead of waiting for me\n\n return playlist.endList && this.mediaSource_.readyState === 'open' && appendedLastSegment && appendedLastPart;\n }\n /**\n * Determines what request should be made given current segment loader state.\n *\n * @return {Object} a request object that describes the segment/part to load\n */\n ;\n\n _proto.chooseNextRequest_ = function chooseNextRequest_() {\n var buffered = this.buffered_();\n var bufferedEnd = lastBufferedEnd(buffered) || 0;\n var bufferedTime = timeAheadOf(buffered, this.currentTime_());\n var preloaded = !this.hasPlayed_() && bufferedTime >= 1;\n var haveEnoughBuffer = bufferedTime >= this.goalBufferLength_();\n var segments = this.playlist_.segments; // return no segment if:\n // 1. we don't have segments\n // 2. The video has not yet played and we already downloaded a segment\n // 3. we already have enough buffered time\n\n if (!segments.length || preloaded || haveEnoughBuffer) {\n return null;\n }\n\n this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_());\n var next = {\n partIndex: null,\n mediaIndex: null,\n startOfSegment: null,\n playlist: this.playlist_,\n isSyncRequest: Boolean(!this.syncPoint_)\n };\n\n if (next.isSyncRequest) {\n next.mediaIndex = getSyncSegmentCandidate(this.currentTimeline_, segments, bufferedEnd);\n } else if (this.mediaIndex !== null) {\n var segment = segments[this.mediaIndex];\n var partIndex = typeof this.partIndex === 'number' ? this.partIndex : -1;\n next.startOfSegment = segment.end ? segment.end : bufferedEnd;\n\n if (segment.parts && segment.parts[partIndex + 1]) {\n next.mediaIndex = this.mediaIndex;\n next.partIndex = partIndex + 1;\n } else {\n next.mediaIndex = this.mediaIndex + 1;\n }\n } else {\n // Find the segment containing the end of the buffer or current time.\n var _Playlist$getMediaInf = Playlist.getMediaInfoForTime({\n experimentalExactManifestTimings: this.experimentalExactManifestTimings,\n playlist: this.playlist_,\n currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(),\n startingPartIndex: this.syncPoint_.partIndex,\n startingSegmentIndex: this.syncPoint_.segmentIndex,\n startTime: this.syncPoint_.time\n }),\n segmentIndex = _Playlist$getMediaInf.segmentIndex,\n startTime = _Playlist$getMediaInf.startTime,\n _partIndex = _Playlist$getMediaInf.partIndex;\n\n next.getMediaInfoForTime = this.fetchAtBuffer_ ? \"bufferedEnd \" + bufferedEnd : \"currentTime \" + this.currentTime_();\n next.mediaIndex = segmentIndex;\n next.startOfSegment = startTime;\n next.partIndex = _partIndex;\n }\n\n var nextSegment = segments[next.mediaIndex];\n var nextPart = nextSegment && typeof next.partIndex === 'number' && nextSegment.parts && nextSegment.parts[next.partIndex]; // if the next segment index is invalid or\n // the next partIndex is invalid do not choose a next segment.\n\n if (!nextSegment || typeof next.partIndex === 'number' && !nextPart) {\n return null;\n } // if the next segment has parts, and we don't have a partIndex.\n // Set partIndex to 0\n\n\n if (typeof next.partIndex !== 'number' && nextSegment.parts) {\n next.partIndex = 0;\n nextPart = nextSegment.parts[0];\n } // if we have no buffered data then we need to make sure\n // that the next part we append is \"independent\" if possible.\n // So we check if the previous part is independent, and request\n // it if it is.\n\n\n if (!bufferedTime && nextPart && !nextPart.independent) {\n if (next.partIndex === 0) {\n var lastSegment = segments[next.mediaIndex - 1];\n var lastSegmentLastPart = lastSegment.parts && lastSegment.parts.length && lastSegment.parts[lastSegment.parts.length - 1];\n\n if (lastSegmentLastPart && lastSegmentLastPart.independent) {\n next.mediaIndex -= 1;\n next.partIndex = lastSegment.parts.length - 1;\n next.independent = 'previous segment';\n }\n } else if (nextSegment.parts[next.partIndex - 1].independent) {\n next.partIndex -= 1;\n next.independent = 'previous part';\n }\n }\n\n var ended = this.mediaSource_ && this.mediaSource_.readyState === 'ended'; // do not choose a next segment if all of the following:\n // 1. this is the last segment in the playlist\n // 2. end of stream has been called on the media source already\n // 3. the player is not seeking\n\n if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) {\n return null;\n }\n\n return this.generateSegmentInfo_(next);\n };\n\n _proto.generateSegmentInfo_ = function generateSegmentInfo_(options) {\n var independent = options.independent,\n playlist = options.playlist,\n mediaIndex = options.mediaIndex,\n startOfSegment = options.startOfSegment,\n isSyncRequest = options.isSyncRequest,\n partIndex = options.partIndex,\n forceTimestampOffset = options.forceTimestampOffset,\n getMediaInfoForTime = options.getMediaInfoForTime;\n var segment = playlist.segments[mediaIndex];\n var part = typeof partIndex === 'number' && segment.parts[partIndex];\n var segmentInfo = {\n requestId: 'segment-loader-' + Math.random(),\n // resolve the segment URL relative to the playlist\n uri: part && part.resolvedUri || segment.resolvedUri,\n // the segment's mediaIndex at the time it was requested\n mediaIndex: mediaIndex,\n partIndex: part ? partIndex : null,\n // whether or not to update the SegmentLoader's state with this\n // segment's mediaIndex\n isSyncRequest: isSyncRequest,\n startOfSegment: startOfSegment,\n // the segment's playlist\n playlist: playlist,\n // unencrypted bytes of the segment\n bytes: null,\n // when a key is defined for this segment, the encrypted bytes\n encryptedBytes: null,\n // The target timestampOffset for this segment when we append it\n // to the source buffer\n timestampOffset: null,\n // The timeline that the segment is in\n timeline: segment.timeline,\n // The expected duration of the segment in seconds\n duration: part && part.duration || segment.duration,\n // retain the segment in case the playlist updates while doing an async process\n segment: segment,\n part: part,\n byteLength: 0,\n transmuxer: this.transmuxer_,\n // type of getMediaInfoForTime that was used to get this segment\n getMediaInfoForTime: getMediaInfoForTime,\n independent: independent\n };\n var overrideCheck = typeof forceTimestampOffset !== 'undefined' ? forceTimestampOffset : this.isPendingTimestampOffset_;\n segmentInfo.timestampOffset = this.timestampOffsetForSegment_({\n segmentTimeline: segment.timeline,\n currentTimeline: this.currentTimeline_,\n startOfSegment: startOfSegment,\n buffered: this.buffered_(),\n overrideCheck: overrideCheck\n });\n var audioBufferedEnd = lastBufferedEnd(this.sourceUpdater_.audioBuffered());\n\n if (typeof audioBufferedEnd === 'number') {\n // since the transmuxer is using the actual timing values, but the buffer is\n // adjusted by the timestamp offset, we must adjust the value here\n segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset();\n }\n\n if (this.sourceUpdater_.videoBuffered().length) {\n segmentInfo.gopsToAlignWith = gopsSafeToAlignWith(this.gopBuffer_, // since the transmuxer is using the actual timing values, but the time is\n // adjusted by the timestmap offset, we must adjust the value here\n this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(), this.timeMapping_);\n }\n\n return segmentInfo;\n } // get the timestampoffset for a segment,\n // added so that vtt segment loader can override and prevent\n // adding timestamp offsets.\n ;\n\n _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_(options) {\n return timestampOffsetForSegment(options);\n }\n /**\n * Determines if the network has enough bandwidth to complete the current segment\n * request in a timely manner. If not, the request will be aborted early and bandwidth\n * updated to trigger a playlist switch.\n *\n * @param {Object} stats\n * Object containing stats about the request timing and size\n * @private\n */\n ;\n\n _proto.earlyAbortWhenNeeded_ = function earlyAbortWhenNeeded_(stats) {\n if (this.vhs_.tech_.paused() || // Don't abort if the current playlist is on the lowestEnabledRendition\n // TODO: Replace using timeout with a boolean indicating whether this playlist is\n // the lowestEnabledRendition.\n !this.xhrOptions_.timeout || // Don't abort if we have no bandwidth information to estimate segment sizes\n !this.playlist_.attributes.BANDWIDTH) {\n return;\n } // Wait at least 1 second since the first byte of data has been received before\n // using the calculated bandwidth from the progress event to allow the bitrate\n // to stabilize\n\n\n if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1000) {\n return;\n }\n\n var currentTime = this.currentTime_();\n var measuredBandwidth = stats.bandwidth;\n var segmentDuration = this.pendingSegment_.duration;\n var requestTimeRemaining = Playlist.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived); // Subtract 1 from the timeUntilRebuffer so we still consider an early abort\n // if we are only left with less than 1 second when the request completes.\n // A negative timeUntilRebuffering indicates we are already rebuffering\n\n var timeUntilRebuffer$1 = timeUntilRebuffer(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1; // Only consider aborting early if the estimated time to finish the download\n // is larger than the estimated time until the player runs out of forward buffer\n\n if (requestTimeRemaining <= timeUntilRebuffer$1) {\n return;\n }\n\n var switchCandidate = minRebufferMaxBandwidthSelector({\n master: this.vhs_.playlists.master,\n currentTime: currentTime,\n bandwidth: measuredBandwidth,\n duration: this.duration_(),\n segmentDuration: segmentDuration,\n timeUntilRebuffer: timeUntilRebuffer$1,\n currentTimeline: this.currentTimeline_,\n syncController: this.syncController_\n });\n\n if (!switchCandidate) {\n return;\n }\n\n var rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$1;\n var timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact;\n var minimumTimeSaving = 0.5; // If we are already rebuffering, increase the amount of variance we add to the\n // potential round trip time of the new request so that we are not too aggressive\n // with switching to a playlist that might save us a fraction of a second.\n\n if (timeUntilRebuffer$1 <= TIME_FUDGE_FACTOR) {\n minimumTimeSaving = 1;\n }\n\n if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) {\n return;\n } // set the bandwidth to that of the desired playlist being sure to scale by\n // BANDWIDTH_VARIANCE and add one so the playlist selector does not exclude it\n // don't trigger a bandwidthupdate as the bandwidth is artifial\n\n\n this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config.BANDWIDTH_VARIANCE + 1;\n this.trigger('earlyabort');\n };\n\n _proto.handleAbort_ = function handleAbort_(segmentInfo) {\n this.logger_(\"Aborting \" + segmentInfoString(segmentInfo));\n this.mediaRequestsAborted += 1;\n }\n /**\n * XHR `progress` event handler\n *\n * @param {Event}\n * The XHR `progress` event\n * @param {Object} simpleSegment\n * A simplified segment object copy\n * @private\n */\n ;\n\n _proto.handleProgress_ = function handleProgress_(event, simpleSegment) {\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n }\n\n this.trigger('progress');\n };\n\n _proto.handleTrackInfo_ = function handleTrackInfo_(simpleSegment, trackInfo) {\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n }\n\n if (this.checkForIllegalMediaSwitch(trackInfo)) {\n return;\n }\n\n trackInfo = trackInfo || {}; // When we have track info, determine what media types this loader is dealing with.\n // Guard against cases where we're not getting track info at all until we are\n // certain that all streams will provide it.\n\n if (!shallowEqual(this.currentMediaInfo_, trackInfo)) {\n this.appendInitSegment_ = {\n audio: true,\n video: true\n };\n this.startingMediaInfo_ = trackInfo;\n this.currentMediaInfo_ = trackInfo;\n this.logger_('trackinfo update', trackInfo);\n this.trigger('trackinfo');\n } // trackinfo may cause an abort if the trackinfo\n // causes a codec change to an unsupported codec.\n\n\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n } // set trackinfo on the pending segment so that\n // it can append.\n\n\n this.pendingSegment_.trackInfo = trackInfo; // check if any calls were waiting on the track info\n\n if (this.hasEnoughInfoToAppend_()) {\n this.processCallQueue_();\n }\n };\n\n _proto.handleTimingInfo_ = function handleTimingInfo_(simpleSegment, mediaType, timeType, time) {\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n }\n\n var segmentInfo = this.pendingSegment_;\n var timingInfoProperty = timingInfoPropertyForMedia(mediaType);\n segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {};\n segmentInfo[timingInfoProperty][timeType] = time;\n this.logger_(\"timinginfo: \" + mediaType + \" - \" + timeType + \" - \" + time); // check if any calls were waiting on the timing info\n\n if (this.hasEnoughInfoToAppend_()) {\n this.processCallQueue_();\n }\n };\n\n _proto.handleCaptions_ = function handleCaptions_(simpleSegment, captionData) {\n var _this2 = this;\n\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n } // This could only happen with fmp4 segments, but\n // should still not happen in general\n\n\n if (captionData.length === 0) {\n this.logger_('SegmentLoader received no captions from a caption event');\n return;\n }\n\n var segmentInfo = this.pendingSegment_; // Wait until we have some video data so that caption timing\n // can be adjusted by the timestamp offset\n\n if (!segmentInfo.hasAppendedData_) {\n this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData));\n return;\n }\n\n var timestampOffset = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();\n var captionTracks = {}; // get total start/end and captions for each track/stream\n\n captionData.forEach(function (caption) {\n // caption.stream is actually a track name...\n // set to the existing values in tracks or default values\n captionTracks[caption.stream] = captionTracks[caption.stream] || {\n // Infinity, as any other value will be less than this\n startTime: Infinity,\n captions: [],\n // 0 as an other value will be more than this\n endTime: 0\n };\n var captionTrack = captionTracks[caption.stream];\n captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset);\n captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset);\n captionTrack.captions.push(caption);\n });\n Object.keys(captionTracks).forEach(function (trackName) {\n var _captionTracks$trackN = captionTracks[trackName],\n startTime = _captionTracks$trackN.startTime,\n endTime = _captionTracks$trackN.endTime,\n captions = _captionTracks$trackN.captions;\n var inbandTextTracks = _this2.inbandTextTracks_;\n\n _this2.logger_(\"adding cues from \" + startTime + \" -> \" + endTime + \" for \" + trackName);\n\n createCaptionsTrackIfNotExists(inbandTextTracks, _this2.vhs_.tech_, trackName); // clear out any cues that start and end at the same time period for the same track.\n // We do this because a rendition change that also changes the timescale for captions\n // will result in captions being re-parsed for certain segments. If we add them again\n // without clearing we will have two of the same captions visible.\n\n removeCuesFromTrack(startTime, endTime, inbandTextTracks[trackName]);\n addCaptionData({\n captionArray: captions,\n inbandTextTracks: inbandTextTracks,\n timestampOffset: timestampOffset\n });\n }); // Reset stored captions since we added parsed\n // captions to a text track at this point\n\n if (this.transmuxer_) {\n this.transmuxer_.postMessage({\n action: 'clearParsedMp4Captions'\n });\n }\n };\n\n _proto.handleId3_ = function handleId3_(simpleSegment, id3Frames, dispatchType) {\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n }\n\n var segmentInfo = this.pendingSegment_; // we need to have appended data in order for the timestamp offset to be set\n\n if (!segmentInfo.hasAppendedData_) {\n this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType));\n return;\n }\n\n var timestampOffset = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset(); // There's potentially an issue where we could double add metadata if there's a muxed\n // audio/video source with a metadata track, and an alt audio with a metadata track.\n // However, this probably won't happen, and if it does it can be handled then.\n\n createMetadataTrackIfNotExists(this.inbandTextTracks_, dispatchType, this.vhs_.tech_);\n addMetadata({\n inbandTextTracks: this.inbandTextTracks_,\n metadataArray: id3Frames,\n timestampOffset: timestampOffset,\n videoDuration: this.duration_()\n });\n };\n\n _proto.processMetadataQueue_ = function processMetadataQueue_() {\n this.metadataQueue_.id3.forEach(function (fn) {\n return fn();\n });\n this.metadataQueue_.caption.forEach(function (fn) {\n return fn();\n });\n this.metadataQueue_.id3 = [];\n this.metadataQueue_.caption = [];\n };\n\n _proto.processCallQueue_ = function processCallQueue_() {\n var callQueue = this.callQueue_; // Clear out the queue before the queued functions are run, since some of the\n // functions may check the length of the load queue and default to pushing themselves\n // back onto the queue.\n\n this.callQueue_ = [];\n callQueue.forEach(function (fun) {\n return fun();\n });\n };\n\n _proto.processLoadQueue_ = function processLoadQueue_() {\n var loadQueue = this.loadQueue_; // Clear out the queue before the queued functions are run, since some of the\n // functions may check the length of the load queue and default to pushing themselves\n // back onto the queue.\n\n this.loadQueue_ = [];\n loadQueue.forEach(function (fun) {\n return fun();\n });\n }\n /**\n * Determines whether the loader has enough info to load the next segment.\n *\n * @return {boolean}\n * Whether or not the loader has enough info to load the next segment\n */\n ;\n\n _proto.hasEnoughInfoToLoad_ = function hasEnoughInfoToLoad_() {\n // Since primary timing goes by video, only the audio loader potentially needs to wait\n // to load.\n if (this.loaderType_ !== 'audio') {\n return true;\n }\n\n var segmentInfo = this.pendingSegment_; // A fill buffer must have already run to establish a pending segment before there's\n // enough info to load.\n\n if (!segmentInfo) {\n return false;\n } // The first segment can and should be loaded immediately so that source buffers are\n // created together (before appending). Source buffer creation uses the presence of\n // audio and video data to determine whether to create audio/video source buffers, and\n // uses processed (transmuxed or parsed) media to determine the types required.\n\n\n if (!this.getCurrentMediaInfo_()) {\n return true;\n }\n\n if ( // Technically, instead of waiting to load a segment on timeline changes, a segment\n // can be requested and downloaded and only wait before it is transmuxed or parsed.\n // But in practice, there are a few reasons why it is better to wait until a loader\n // is ready to append that segment before requesting and downloading:\n //\n // 1. Because audio and main loaders cross discontinuities together, if this loader\n // is waiting for the other to catch up, then instead of requesting another\n // segment and using up more bandwidth, by not yet loading, more bandwidth is\n // allotted to the loader currently behind.\n // 2. media-segment-request doesn't have to have logic to consider whether a segment\n // is ready to be processed or not, isolating the queueing behavior to the loader.\n // 3. The audio loader bases some of its segment properties on timing information\n // provided by the main loader, meaning that, if the logic for waiting on\n // processing was in media-segment-request, then it would also need to know how\n // to re-generate the segment information after the main loader caught up.\n shouldWaitForTimelineChange({\n timelineChangeController: this.timelineChangeController_,\n currentTimeline: this.currentTimeline_,\n segmentTimeline: segmentInfo.timeline,\n loaderType: this.loaderType_,\n audioDisabled: this.audioDisabled_\n })) {\n return false;\n }\n\n return true;\n };\n\n _proto.getCurrentMediaInfo_ = function getCurrentMediaInfo_(segmentInfo) {\n if (segmentInfo === void 0) {\n segmentInfo = this.pendingSegment_;\n }\n\n return segmentInfo && segmentInfo.trackInfo || this.currentMediaInfo_;\n };\n\n _proto.getMediaInfo_ = function getMediaInfo_(segmentInfo) {\n if (segmentInfo === void 0) {\n segmentInfo = this.pendingSegment_;\n }\n\n return this.getCurrentMediaInfo_(segmentInfo) || this.startingMediaInfo_;\n };\n\n _proto.getPendingSegmentPlaylist = function getPendingSegmentPlaylist() {\n return this.pendingSegment_ ? this.pendingSegment_.playlist : null;\n };\n\n _proto.hasEnoughInfoToAppend_ = function hasEnoughInfoToAppend_() {\n if (!this.sourceUpdater_.ready()) {\n return false;\n } // If content needs to be removed or the loader is waiting on an append reattempt,\n // then no additional content should be appended until the prior append is resolved.\n\n\n if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) {\n return false;\n }\n\n var segmentInfo = this.pendingSegment_;\n var trackInfo = this.getCurrentMediaInfo_(); // no segment to append any data for or\n // we do not have information on this specific\n // segment yet\n\n if (!segmentInfo || !trackInfo) {\n return false;\n }\n\n var hasAudio = trackInfo.hasAudio,\n hasVideo = trackInfo.hasVideo,\n isMuxed = trackInfo.isMuxed;\n\n if (hasVideo && !segmentInfo.videoTimingInfo) {\n return false;\n } // muxed content only relies on video timing information for now.\n\n\n if (hasAudio && !this.audioDisabled_ && !isMuxed && !segmentInfo.audioTimingInfo) {\n return false;\n }\n\n if (shouldWaitForTimelineChange({\n timelineChangeController: this.timelineChangeController_,\n currentTimeline: this.currentTimeline_,\n segmentTimeline: segmentInfo.timeline,\n loaderType: this.loaderType_,\n audioDisabled: this.audioDisabled_\n })) {\n return false;\n }\n\n return true;\n };\n\n _proto.handleData_ = function handleData_(simpleSegment, result) {\n this.earlyAbortWhenNeeded_(simpleSegment.stats);\n\n if (this.checkForAbort_(simpleSegment.requestId)) {\n return;\n } // If there's anything in the call queue, then this data came later and should be\n // executed after the calls currently queued.\n\n\n if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) {\n this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result));\n return;\n }\n\n var segmentInfo = this.pendingSegment_; // update the time mapping so we can translate from display time to media time\n\n this.setTimeMapping_(segmentInfo.timeline); // for tracking overall stats\n\n this.updateMediaSecondsLoaded_(segmentInfo.part || segmentInfo.segment); // Note that the state isn't changed from loading to appending. This is because abort\n // logic may change behavior depending on the state, and changing state too early may\n // inflate our estimates of bandwidth. In the future this should be re-examined to\n // note more granular states.\n // don't process and append data if the mediaSource is closed\n\n if (this.mediaSource_.readyState === 'closed') {\n return;\n } // if this request included an initialization segment, save that data\n // to the initSegment cache\n\n\n if (simpleSegment.map) {\n simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true); // move over init segment properties to media request\n\n segmentInfo.segment.map = simpleSegment.map;\n } // if this request included a segment key, save that data in the cache\n\n\n if (simpleSegment.key) {\n this.segmentKey(simpleSegment.key, true);\n }\n\n segmentInfo.isFmp4 = simpleSegment.isFmp4;\n segmentInfo.timingInfo = segmentInfo.timingInfo || {};\n\n if (segmentInfo.isFmp4) {\n this.trigger('fmp4');\n segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia(result.type)].start;\n } else {\n var trackInfo = this.getCurrentMediaInfo_();\n var useVideoTimingInfo = this.loaderType_ === 'main' && trackInfo && trackInfo.hasVideo;\n var firstVideoFrameTimeForData;\n\n if (useVideoTimingInfo) {\n firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start;\n } // Segment loader knows more about segment timing than the transmuxer (in certain\n // aspects), so make any changes required for a more accurate start time.\n // Don't set the end time yet, as the segment may not be finished processing.\n\n\n segmentInfo.timingInfo.start = this.trueSegmentStart_({\n currentStart: segmentInfo.timingInfo.start,\n playlist: segmentInfo.playlist,\n mediaIndex: segmentInfo.mediaIndex,\n currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(),\n useVideoTimingInfo: useVideoTimingInfo,\n firstVideoFrameTimeForData: firstVideoFrameTimeForData,\n videoTimingInfo: segmentInfo.videoTimingInfo,\n audioTimingInfo: segmentInfo.audioTimingInfo\n });\n } // Init segments for audio and video only need to be appended in certain cases. Now\n // that data is about to be appended, we can check the final cases to determine\n // whether we should append an init segment.\n\n\n this.updateAppendInitSegmentStatus(segmentInfo, result.type); // Timestamp offset should be updated once we get new data and have its timing info,\n // as we use the start of the segment to offset the best guess (playlist provided)\n // timestamp offset.\n\n this.updateSourceBufferTimestampOffset_(segmentInfo); // if this is a sync request we need to determine whether it should\n // be appended or not.\n\n if (segmentInfo.isSyncRequest) {\n // first save/update our timing info for this segment.\n // this is what allows us to choose an accurate segment\n // and the main reason we make a sync request.\n this.updateTimingInfoEnd_(segmentInfo);\n this.syncController_.saveSegmentTimingInfo({\n segmentInfo: segmentInfo,\n shouldSaveTimelineMapping: this.loaderType_ === 'main'\n });\n var next = this.chooseNextRequest_(); // If the sync request isn't the segment that would be requested next\n // after taking into account its timing info, do not append it.\n\n if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) {\n this.logger_('sync segment was incorrect, not appending');\n return;\n } // otherwise append it like any other segment as our guess was correct.\n\n\n this.logger_('sync segment was correct, appending');\n } // Save some state so that in the future anything waiting on first append (and/or\n // timestamp offset(s)) can process immediately. While the extra state isn't optimal,\n // we need some notion of whether the timestamp offset or other relevant information\n // has had a chance to be set.\n\n\n segmentInfo.hasAppendedData_ = true; // Now that the timestamp offset should be set, we can append any waiting ID3 tags.\n\n this.processMetadataQueue_();\n this.appendData_(segmentInfo, result);\n };\n\n _proto.updateAppendInitSegmentStatus = function updateAppendInitSegmentStatus(segmentInfo, type) {\n // alt audio doesn't manage timestamp offset\n if (this.loaderType_ === 'main' && typeof segmentInfo.timestampOffset === 'number' && // in the case that we're handling partial data, we don't want to append an init\n // segment for each chunk\n !segmentInfo.changedTimestampOffset) {\n // if the timestamp offset changed, the timeline may have changed, so we have to re-\n // append init segments\n this.appendInitSegment_ = {\n audio: true,\n video: true\n };\n }\n\n if (this.playlistOfLastInitSegment_[type] !== segmentInfo.playlist) {\n // make sure we append init segment on playlist changes, in case the media config\n // changed\n this.appendInitSegment_[type] = true;\n }\n };\n\n _proto.getInitSegmentAndUpdateState_ = function getInitSegmentAndUpdateState_(_ref4) {\n var type = _ref4.type,\n initSegment = _ref4.initSegment,\n map = _ref4.map,\n playlist = _ref4.playlist; // \"The EXT-X-MAP tag specifies how to obtain the Media Initialization Section\n // (Section 3) required to parse the applicable Media Segments. It applies to every\n // Media Segment that appears after it in the Playlist until the next EXT-X-MAP tag\n // or until the end of the playlist.\"\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.2.5\n\n if (map) {\n var id = initSegmentId(map);\n\n if (this.activeInitSegmentId_ === id) {\n // don't need to re-append the init segment if the ID matches\n return null;\n } // a map-specified init segment takes priority over any transmuxed (or otherwise\n // obtained) init segment\n //\n // this also caches the init segment for later use\n\n\n initSegment = this.initSegmentForMap(map, true).bytes;\n this.activeInitSegmentId_ = id;\n } // We used to always prepend init segments for video, however, that shouldn't be\n // necessary. Instead, we should only append on changes, similar to what we've always\n // done for audio. This is more important (though may not be that important) for\n // frame-by-frame appending for LHLS, simply because of the increased quantity of\n // appends.\n\n\n if (initSegment && this.appendInitSegment_[type]) {\n // Make sure we track the playlist that we last used for the init segment, so that\n // we can re-append the init segment in the event that we get data from a new\n // playlist. Discontinuities and track changes are handled in other sections.\n this.playlistOfLastInitSegment_[type] = playlist; // Disable future init segment appends for this type. Until a change is necessary.\n\n this.appendInitSegment_[type] = false; // we need to clear out the fmp4 active init segment id, since\n // we are appending the muxer init segment\n\n this.activeInitSegmentId_ = null;\n return initSegment;\n }\n\n return null;\n };\n\n _proto.handleQuotaExceededError_ = function handleQuotaExceededError_(_ref5, error) {\n var _this3 = this;\n\n var segmentInfo = _ref5.segmentInfo,\n type = _ref5.type,\n bytes = _ref5.bytes;\n var audioBuffered = this.sourceUpdater_.audioBuffered();\n var videoBuffered = this.sourceUpdater_.videoBuffered(); // For now we're ignoring any notion of gaps in the buffer, but they, in theory,\n // should be cleared out during the buffer removals. However, log in case it helps\n // debug.\n\n if (audioBuffered.length > 1) {\n this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: ' + timeRangesToArray(audioBuffered).join(', '));\n }\n\n if (videoBuffered.length > 1) {\n this.logger_('On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: ' + timeRangesToArray(videoBuffered).join(', '));\n }\n\n var audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0;\n var audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0;\n var videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0;\n var videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0;\n\n if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER) {\n // Can't remove enough buffer to make room for new segment (or the browser doesn't\n // allow for appends of segments this size). In the future, it may be possible to\n // split up the segment and append in pieces, but for now, error out this playlist\n // in an attempt to switch to a more manageable rendition.\n this.logger_('On QUOTA_EXCEEDED_ERR, single segment too large to append to ' + 'buffer, triggering an error. ' + (\"Appended byte length: \" + bytes.byteLength + \", \") + (\"audio buffer: \" + timeRangesToArray(audioBuffered).join(', ') + \", \") + (\"video buffer: \" + timeRangesToArray(videoBuffered).join(', ') + \", \"));\n this.error({\n message: 'Quota exceeded error with append of a single segment of content',\n excludeUntil: Infinity\n });\n this.trigger('error');\n return;\n } // To try to resolve the quota exceeded error, clear back buffer and retry. This means\n // that the segment-loader should block on future events until this one is handled, so\n // that it doesn't keep moving onto further segments. Adding the call to the call\n // queue will prevent further appends until waitingOnRemove_ and\n // quotaExceededErrorRetryTimeout_ are cleared.\n //\n // Note that this will only block the current loader. In the case of demuxed content,\n // the other load may keep filling as fast as possible. In practice, this should be\n // OK, as it is a rare case when either audio has a high enough bitrate to fill up a\n // source buffer, or video fills without enough room for audio to append (and without\n // the availability of clearing out seconds of back buffer to make room for audio).\n // But it might still be good to handle this case in the future as a TODO.\n\n\n this.waitingOnRemove_ = true;\n this.callQueue_.push(this.appendToSourceBuffer_.bind(this, {\n segmentInfo: segmentInfo,\n type: type,\n bytes: bytes\n }));\n var currentTime = this.currentTime_(); // Try to remove as much audio and video as possible to make room for new content\n // before retrying.\n\n var timeToRemoveUntil = currentTime - MIN_BACK_BUFFER;\n this.logger_(\"On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to \" + timeToRemoveUntil);\n this.remove(0, timeToRemoveUntil, function () {\n _this3.logger_(\"On QUOTA_EXCEEDED_ERR, retrying append in \" + MIN_BACK_BUFFER + \"s\");\n\n _this3.waitingOnRemove_ = false; // wait the length of time alotted in the back buffer to prevent wasted\n // attempts (since we can't clear less than the minimum)\n\n _this3.quotaExceededErrorRetryTimeout_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(function () {\n _this3.logger_('On QUOTA_EXCEEDED_ERR, re-processing call queue');\n\n _this3.quotaExceededErrorRetryTimeout_ = null;\n\n _this3.processCallQueue_();\n }, MIN_BACK_BUFFER * 1000);\n }, true);\n };\n\n _proto.handleAppendError_ = function handleAppendError_(_ref6, error) {\n var segmentInfo = _ref6.segmentInfo,\n type = _ref6.type,\n bytes = _ref6.bytes; // if there's no error, nothing to do\n\n if (!error) {\n return;\n }\n\n if (error.code === QUOTA_EXCEEDED_ERR) {\n this.handleQuotaExceededError_({\n segmentInfo: segmentInfo,\n type: type,\n bytes: bytes\n }); // A quota exceeded error should be recoverable with a future re-append, so no need\n // to trigger an append error.\n\n return;\n }\n\n this.logger_('Received non QUOTA_EXCEEDED_ERR on append', error);\n this.error(type + \" append of \" + bytes.length + \"b failed for segment \" + (\"#\" + segmentInfo.mediaIndex + \" in playlist \" + segmentInfo.playlist.id)); // If an append errors, we often can't recover.\n // (see https://w3c.github.io/media-source/#sourcebuffer-append-error).\n //\n // Trigger a special error so that it can be handled separately from normal,\n // recoverable errors.\n\n this.trigger('appenderror');\n };\n\n _proto.appendToSourceBuffer_ = function appendToSourceBuffer_(_ref7) {\n var segmentInfo = _ref7.segmentInfo,\n type = _ref7.type,\n initSegment = _ref7.initSegment,\n data = _ref7.data,\n bytes = _ref7.bytes; // If this is a re-append, bytes were already created and don't need to be recreated\n\n if (!bytes) {\n var segments = [data];\n var byteLength = data.byteLength;\n\n if (initSegment) {\n // if the media initialization segment is changing, append it before the content\n // segment\n segments.unshift(initSegment);\n byteLength += initSegment.byteLength;\n } // Technically we should be OK appending the init segment separately, however, we\n // haven't yet tested that, and prepending is how we have always done things.\n\n\n bytes = concatSegments({\n bytes: byteLength,\n segments: segments\n });\n }\n\n this.sourceUpdater_.appendBuffer({\n segmentInfo: segmentInfo,\n type: type,\n bytes: bytes\n }, this.handleAppendError_.bind(this, {\n segmentInfo: segmentInfo,\n type: type,\n bytes: bytes\n }));\n };\n\n _proto.handleSegmentTimingInfo_ = function handleSegmentTimingInfo_(type, requestId, segmentTimingInfo) {\n if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) {\n return;\n }\n\n var segment = this.pendingSegment_.segment;\n var timingInfoProperty = type + \"TimingInfo\";\n\n if (!segment[timingInfoProperty]) {\n segment[timingInfoProperty] = {};\n }\n\n segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0;\n segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation;\n segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode;\n segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation;\n segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode; // mainly used as a reference for debugging\n\n segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime;\n };\n\n _proto.appendData_ = function appendData_(segmentInfo, result) {\n var type = result.type,\n data = result.data;\n\n if (!data || !data.byteLength) {\n return;\n }\n\n if (type === 'audio' && this.audioDisabled_) {\n return;\n }\n\n var initSegment = this.getInitSegmentAndUpdateState_({\n type: type,\n initSegment: result.initSegment,\n playlist: segmentInfo.playlist,\n map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null\n });\n this.appendToSourceBuffer_({\n segmentInfo: segmentInfo,\n type: type,\n initSegment: initSegment,\n data: data\n });\n }\n /**\n * load a specific segment from a request into the buffer\n *\n * @private\n */\n ;\n\n _proto.loadSegment_ = function loadSegment_(segmentInfo) {\n var _this4 = this;\n\n this.state = 'WAITING';\n this.pendingSegment_ = segmentInfo;\n this.trimBackBuffer_(segmentInfo);\n\n if (typeof segmentInfo.timestampOffset === 'number') {\n if (this.transmuxer_) {\n this.transmuxer_.postMessage({\n action: 'clearAllMp4Captions'\n });\n }\n }\n\n if (!this.hasEnoughInfoToLoad_()) {\n this.loadQueue_.push(function () {\n // regenerate the audioAppendStart, timestampOffset, etc as they\n // may have changed since this function was added to the queue.\n var options = (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_2__[\"default\"])({}, segmentInfo, {\n forceTimestampOffset: true\n });\n\n (0,_babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(segmentInfo, _this4.generateSegmentInfo_(options));\n\n _this4.isPendingTimestampOffset_ = false;\n\n _this4.updateTransmuxerAndRequestSegment_(segmentInfo);\n });\n return;\n }\n\n this.updateTransmuxerAndRequestSegment_(segmentInfo);\n };\n\n _proto.updateTransmuxerAndRequestSegment_ = function updateTransmuxerAndRequestSegment_(segmentInfo) {\n var _this5 = this; // We'll update the source buffer's timestamp offset once we have transmuxed data, but\n // the transmuxer still needs to be updated before then.\n //\n // Even though keepOriginalTimestamps is set to true for the transmuxer, timestamp\n // offset must be passed to the transmuxer for stream correcting adjustments.\n\n\n if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) {\n this.gopBuffer_.length = 0; // gopsToAlignWith was set before the GOP buffer was cleared\n\n segmentInfo.gopsToAlignWith = [];\n this.timeMapping_ = 0; // reset values in the transmuxer since a discontinuity should start fresh\n\n this.transmuxer_.postMessage({\n action: 'reset'\n });\n this.transmuxer_.postMessage({\n action: 'setTimestampOffset',\n timestampOffset: segmentInfo.timestampOffset\n });\n }\n\n var simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo);\n var isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex);\n var isWalkingForward = this.mediaIndex !== null;\n var isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ && // currentTimeline starts at -1, so we shouldn't end the timeline switching to 0,\n // the first timeline\n segmentInfo.timeline > 0;\n var isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity;\n this.logger_(\"Requesting \" + segmentInfoString(segmentInfo)); // If there's an init segment associated with this segment, but it is not cached (identified by a lack of bytes),\n // then this init segment has never been seen before and should be appended.\n //\n // At this point the content type (audio/video or both) is not yet known, but it should be safe to set\n // both to true and leave the decision of whether to append the init segment to append time.\n\n if (simpleSegment.map && !simpleSegment.map.bytes) {\n this.logger_('going to request init segment.');\n this.appendInitSegment_ = {\n video: true,\n audio: true\n };\n }\n\n segmentInfo.abortRequests = mediaSegmentRequest({\n xhr: this.vhs_.xhr,\n xhrOptions: this.xhrOptions_,\n decryptionWorker: this.decrypter_,\n segment: simpleSegment,\n abortFn: this.handleAbort_.bind(this, segmentInfo),\n progressFn: this.handleProgress_.bind(this),\n trackInfoFn: this.handleTrackInfo_.bind(this),\n timingInfoFn: this.handleTimingInfo_.bind(this),\n videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'video', segmentInfo.requestId),\n audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, 'audio', segmentInfo.requestId),\n captionsFn: this.handleCaptions_.bind(this),\n isEndOfTimeline: isEndOfTimeline,\n endedTimelineFn: function endedTimelineFn() {\n _this5.logger_('received endedtimeline callback');\n },\n id3Fn: this.handleId3_.bind(this),\n dataFn: this.handleData_.bind(this),\n doneFn: this.segmentRequestFinished_.bind(this),\n onTransmuxerLog: function onTransmuxerLog(_ref8) {\n var message = _ref8.message,\n level = _ref8.level,\n stream = _ref8.stream;\n\n _this5.logger_(segmentInfoString(segmentInfo) + \" logged from transmuxer stream \" + stream + \" as a \" + level + \": \" + message);\n }\n });\n }\n /**\n * trim the back buffer so that we don't have too much data\n * in the source buffer\n *\n * @private\n *\n * @param {Object} segmentInfo - the current segment\n */\n ;\n\n _proto.trimBackBuffer_ = function trimBackBuffer_(segmentInfo) {\n var removeToTime = safeBackBufferTrimTime(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10); // Chrome has a hard limit of 150MB of\n // buffer and a very conservative \"garbage collector\"\n // We manually clear out the old buffer to ensure\n // we don't trigger the QuotaExceeded error\n // on the source buffer during subsequent appends\n\n if (removeToTime > 0) {\n this.remove(0, removeToTime);\n }\n }\n /**\n * created a simplified copy of the segment object with just the\n * information necessary to perform the XHR and decryption\n *\n * @private\n *\n * @param {Object} segmentInfo - the current segment\n * @return {Object} a simplified segment object copy\n */\n ;\n\n _proto.createSimplifiedSegmentObj_ = function createSimplifiedSegmentObj_(segmentInfo) {\n var segment = segmentInfo.segment;\n var part = segmentInfo.part;\n var simpleSegment = {\n resolvedUri: part ? part.resolvedUri : segment.resolvedUri,\n byterange: part ? part.byterange : segment.byterange,\n requestId: segmentInfo.requestId,\n transmuxer: segmentInfo.transmuxer,\n audioAppendStart: segmentInfo.audioAppendStart,\n gopsToAlignWith: segmentInfo.gopsToAlignWith,\n part: segmentInfo.part\n };\n var previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1];\n\n if (previousSegment && previousSegment.timeline === segment.timeline) {\n // The baseStartTime of a segment is used to handle rollover when probing the TS\n // segment to retrieve timing information. Since the probe only looks at the media's\n // times (e.g., PTS and DTS values of the segment), and doesn't consider the\n // player's time (e.g., player.currentTime()), baseStartTime should reflect the\n // media time as well. transmuxedDecodeEnd represents the end time of a segment, in\n // seconds of media time, so should be used here. The previous segment is used since\n // the end of the previous segment should represent the beginning of the current\n // segment, so long as they are on the same timeline.\n if (previousSegment.videoTimingInfo) {\n simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd;\n } else if (previousSegment.audioTimingInfo) {\n simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd;\n }\n }\n\n if (segment.key) {\n // if the media sequence is greater than 2^32, the IV will be incorrect\n // assuming 10s segments, that would be about 1300 years\n var iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]);\n simpleSegment.key = this.segmentKey(segment.key);\n simpleSegment.key.iv = iv;\n }\n\n if (segment.map) {\n simpleSegment.map = this.initSegmentForMap(segment.map);\n }\n\n return simpleSegment;\n };\n\n _proto.saveTransferStats_ = function saveTransferStats_(stats) {\n // every request counts as a media request even if it has been aborted\n // or canceled due to a timeout\n this.mediaRequests += 1;\n\n if (stats) {\n this.mediaBytesTransferred += stats.bytesReceived;\n this.mediaTransferDuration += stats.roundTripTime;\n }\n };\n\n _proto.saveBandwidthRelatedStats_ = function saveBandwidthRelatedStats_(duration, stats) {\n // byteLength will be used for throughput, and should be based on bytes receieved,\n // which we only know at the end of the request and should reflect total bytes\n // downloaded rather than just bytes processed from components of the segment\n this.pendingSegment_.byteLength = stats.bytesReceived;\n\n if (duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) {\n this.logger_(\"Ignoring segment's bandwidth because its duration of \" + duration + (\" is less than the min to record \" + MIN_SEGMENT_DURATION_TO_SAVE_STATS));\n return;\n }\n\n this.bandwidth = stats.bandwidth;\n this.roundTrip = stats.roundTripTime;\n };\n\n _proto.handleTimeout_ = function handleTimeout_() {\n // although the VTT segment loader bandwidth isn't really used, it's good to\n // maintain functinality between segment loaders\n this.mediaRequestsTimedout += 1;\n this.bandwidth = 1;\n this.roundTrip = NaN;\n this.trigger('bandwidthupdate');\n this.trigger('timeout');\n }\n /**\n * Handle the callback from the segmentRequest function and set the\n * associated SegmentLoader state and errors if necessary\n *\n * @private\n */\n ;\n\n _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) {\n // TODO handle special cases, e.g., muxed audio/video but only audio in the segment\n // check the call queue directly since this function doesn't need to deal with any\n // data, and can continue even if the source buffers are not set up and we didn't get\n // any data from the segment\n if (this.callQueue_.length) {\n this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result));\n return;\n }\n\n this.saveTransferStats_(simpleSegment.stats); // The request was aborted and the SegmentLoader has already been reset\n\n if (!this.pendingSegment_) {\n return;\n } // the request was aborted and the SegmentLoader has already started\n // another request. this can happen when the timeout for an aborted\n // request triggers due to a limitation in the XHR library\n // do not count this as any sort of request or we risk double-counting\n\n\n if (simpleSegment.requestId !== this.pendingSegment_.requestId) {\n return;\n } // an error occurred from the active pendingSegment_ so reset everything\n\n\n if (error) {\n this.pendingSegment_ = null;\n this.state = 'READY'; // aborts are not a true error condition and nothing corrective needs to be done\n\n if (error.code === REQUEST_ERRORS.ABORTED) {\n return;\n }\n\n this.pause(); // the error is really just that at least one of the requests timed-out\n // set the bandwidth to a very low value and trigger an ABR switch to\n // take emergency action\n\n if (error.code === REQUEST_ERRORS.TIMEOUT) {\n this.handleTimeout_();\n return;\n } // if control-flow has arrived here, then the error is real\n // emit an error event to blacklist the current playlist\n\n\n this.mediaRequestsErrored += 1;\n this.error(error);\n this.trigger('error');\n return;\n }\n\n var segmentInfo = this.pendingSegment_; // the response was a success so set any bandwidth stats the request\n // generated for ABR purposes\n\n this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);\n segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests;\n\n if (result.gopInfo) {\n this.gopBuffer_ = updateGopBuffer(this.gopBuffer_, result.gopInfo, this.safeAppend_);\n } // Although we may have already started appending on progress, we shouldn't switch the\n // state away from loading until we are officially done loading the segment data.\n\n\n this.state = 'APPENDING'; // used for testing\n\n this.trigger('appending');\n this.waitForAppendsToComplete_(segmentInfo);\n };\n\n _proto.setTimeMapping_ = function setTimeMapping_(timeline) {\n var timelineMapping = this.syncController_.mappingForTimeline(timeline);\n\n if (timelineMapping !== null) {\n this.timeMapping_ = timelineMapping;\n }\n };\n\n _proto.updateMediaSecondsLoaded_ = function updateMediaSecondsLoaded_(segment) {\n if (typeof segment.start === 'number' && typeof segment.end === 'number') {\n this.mediaSecondsLoaded += segment.end - segment.start;\n } else {\n this.mediaSecondsLoaded += segment.duration;\n }\n };\n\n _proto.shouldUpdateTransmuxerTimestampOffset_ = function shouldUpdateTransmuxerTimestampOffset_(timestampOffset) {\n if (timestampOffset === null) {\n return false;\n } // note that we're potentially using the same timestamp offset for both video and\n // audio\n\n\n if (this.loaderType_ === 'main' && timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) {\n return true;\n }\n\n if (!this.audioDisabled_ && timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) {\n return true;\n }\n\n return false;\n };\n\n _proto.trueSegmentStart_ = function trueSegmentStart_(_ref9) {\n var currentStart = _ref9.currentStart,\n playlist = _ref9.playlist,\n mediaIndex = _ref9.mediaIndex,\n firstVideoFrameTimeForData = _ref9.firstVideoFrameTimeForData,\n currentVideoTimestampOffset = _ref9.currentVideoTimestampOffset,\n useVideoTimingInfo = _ref9.useVideoTimingInfo,\n videoTimingInfo = _ref9.videoTimingInfo,\n audioTimingInfo = _ref9.audioTimingInfo;\n\n if (typeof currentStart !== 'undefined') {\n // if start was set once, keep using it\n return currentStart;\n }\n\n if (!useVideoTimingInfo) {\n return audioTimingInfo.start;\n }\n\n var previousSegment = playlist.segments[mediaIndex - 1]; // The start of a segment should be the start of the first full frame contained\n // within that segment. Since the transmuxer maintains a cache of incomplete data\n // from and/or the last frame seen, the start time may reflect a frame that starts\n // in the previous segment. Check for that case and ensure the start time is\n // accurate for the segment.\n\n if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === 'undefined' || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) {\n return firstVideoFrameTimeForData;\n }\n\n return videoTimingInfo.start;\n };\n\n _proto.waitForAppendsToComplete_ = function waitForAppendsToComplete_(segmentInfo) {\n var trackInfo = this.getCurrentMediaInfo_(segmentInfo);\n\n if (!trackInfo) {\n this.error({\n message: 'No starting media returned, likely due to an unsupported media format.',\n blacklistDuration: Infinity\n });\n this.trigger('error');\n return;\n } // Although transmuxing is done, appends may not yet be finished. Throw a marker\n // on each queue this loader is responsible for to ensure that the appends are\n // complete.\n\n\n var hasAudio = trackInfo.hasAudio,\n hasVideo = trackInfo.hasVideo,\n isMuxed = trackInfo.isMuxed;\n var waitForVideo = this.loaderType_ === 'main' && hasVideo;\n var waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed;\n segmentInfo.waitingOnAppends = 0; // segments with no data\n\n if (!segmentInfo.hasAppendedData_) {\n if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === 'number') {\n // When there's no audio or video data in the segment, there's no audio or video\n // timing information.\n //\n // If there's no audio or video timing information, then the timestamp offset\n // can't be adjusted to the appropriate value for the transmuxer and source\n // buffers.\n //\n // Therefore, the next segment should be used to set the timestamp offset.\n this.isPendingTimestampOffset_ = true;\n } // override settings for metadata only segments\n\n\n segmentInfo.timingInfo = {\n start: 0\n };\n segmentInfo.waitingOnAppends++;\n\n if (!this.isPendingTimestampOffset_) {\n // update the timestampoffset\n this.updateSourceBufferTimestampOffset_(segmentInfo); // make sure the metadata queue is processed even though we have\n // no video/audio data.\n\n this.processMetadataQueue_();\n } // append is \"done\" instantly with no data.\n\n\n this.checkAppendsDone_(segmentInfo);\n return;\n } // Since source updater could call back synchronously, do the increments first.\n\n\n if (waitForVideo) {\n segmentInfo.waitingOnAppends++;\n }\n\n if (waitForAudio) {\n segmentInfo.waitingOnAppends++;\n }\n\n if (waitForVideo) {\n this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));\n }\n\n if (waitForAudio) {\n this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));\n }\n };\n\n _proto.checkAppendsDone_ = function checkAppendsDone_(segmentInfo) {\n if (this.checkForAbort_(segmentInfo.requestId)) {\n return;\n }\n\n segmentInfo.waitingOnAppends--;\n\n if (segmentInfo.waitingOnAppends === 0) {\n this.handleAppendsDone_();\n }\n };\n\n _proto.checkForIllegalMediaSwitch = function checkForIllegalMediaSwitch(trackInfo) {\n var illegalMediaSwitchError = illegalMediaSwitch(this.loaderType_, this.getCurrentMediaInfo_(), trackInfo);\n\n if (illegalMediaSwitchError) {\n this.error({\n message: illegalMediaSwitchError,\n blacklistDuration: Infinity\n });\n this.trigger('error');\n return true;\n }\n\n return false;\n };\n\n _proto.updateSourceBufferTimestampOffset_ = function updateSourceBufferTimestampOffset_(segmentInfo) {\n if (segmentInfo.timestampOffset === null || // we don't yet have the start for whatever media type (video or audio) has\n // priority, timing-wise, so we must wait\n typeof segmentInfo.timingInfo.start !== 'number' || // already updated the timestamp offset for this segment\n segmentInfo.changedTimestampOffset || // the alt audio loader should not be responsible for setting the timestamp offset\n this.loaderType_ !== 'main') {\n return;\n }\n\n var didChange = false; // Primary timing goes by video, and audio is trimmed in the transmuxer, meaning that\n // the timing info here comes from video. In the event that the audio is longer than\n // the video, this will trim the start of the audio.\n // This also trims any offset from 0 at the beginning of the media\n\n segmentInfo.timestampOffset -= this.getSegmentStartTimeForTimestampOffsetCalculation_({\n videoTimingInfo: segmentInfo.segment.videoTimingInfo,\n audioTimingInfo: segmentInfo.segment.audioTimingInfo,\n timingInfo: segmentInfo.timingInfo\n }); // In the event that there are part segment downloads, each will try to update the\n // timestamp offset. Retaining this bit of state prevents us from updating in the\n // future (within the same segment), however, there may be a better way to handle it.\n\n segmentInfo.changedTimestampOffset = true;\n\n if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) {\n this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset);\n didChange = true;\n }\n\n if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) {\n this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset);\n didChange = true;\n }\n\n if (didChange) {\n this.trigger('timestampoffset');\n }\n };\n\n _proto.getSegmentStartTimeForTimestampOffsetCalculation_ = function getSegmentStartTimeForTimestampOffsetCalculation_(_ref10) {\n var videoTimingInfo = _ref10.videoTimingInfo,\n audioTimingInfo = _ref10.audioTimingInfo,\n timingInfo = _ref10.timingInfo;\n\n if (!this.useDtsForTimestampOffset_) {\n return timingInfo.start;\n }\n\n if (videoTimingInfo && typeof videoTimingInfo.transmuxedDecodeStart === 'number') {\n return videoTimingInfo.transmuxedDecodeStart;\n } // handle audio only\n\n\n if (audioTimingInfo && typeof audioTimingInfo.transmuxedDecodeStart === 'number') {\n return audioTimingInfo.transmuxedDecodeStart;\n } // handle content not transmuxed (e.g., MP4)\n\n\n return timingInfo.start;\n };\n\n _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_(segmentInfo) {\n segmentInfo.timingInfo = segmentInfo.timingInfo || {};\n var trackInfo = this.getMediaInfo_();\n var useVideoTimingInfo = this.loaderType_ === 'main' && trackInfo && trackInfo.hasVideo;\n var prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo;\n\n if (!prioritizedTimingInfo) {\n return;\n }\n\n segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === 'number' ? // End time may not exist in a case where we aren't parsing the full segment (one\n // current example is the case of fmp4), so use the rough duration to calculate an\n // end time.\n prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration;\n }\n /**\n * callback to run when appendBuffer is finished. detects if we are\n * in a good state to do things with the data we got, or if we need\n * to wait for more\n *\n * @private\n */\n ;\n\n _proto.handleAppendsDone_ = function handleAppendsDone_() {\n // appendsdone can cause an abort\n if (this.pendingSegment_) {\n this.trigger('appendsdone');\n }\n\n if (!this.pendingSegment_) {\n this.state = 'READY'; // TODO should this move into this.checkForAbort to speed up requests post abort in\n // all appending cases?\n\n if (!this.paused()) {\n this.monitorBuffer_();\n }\n\n return;\n }\n\n var segmentInfo = this.pendingSegment_; // Now that the end of the segment has been reached, we can set the end time. It's\n // best to wait until all appends are done so we're sure that the primary media is\n // finished (and we have its end time).\n\n this.updateTimingInfoEnd_(segmentInfo);\n\n if (this.shouldSaveSegmentTimingInfo_) {\n // Timeline mappings should only be saved for the main loader. This is for multiple\n // reasons:\n //\n // 1) Only one mapping is saved per timeline, meaning that if both the audio loader\n // and the main loader try to save the timeline mapping, whichever comes later\n // will overwrite the first. In theory this is OK, as the mappings should be the\n // same, however, it breaks for (2)\n // 2) In the event of a live stream, the initial live point will make for a somewhat\n // arbitrary mapping. If audio and video streams are not perfectly in-sync, then\n // the mapping will be off for one of the streams, dependent on which one was\n // first saved (see (1)).\n // 3) Primary timing goes by video in VHS, so the mapping should be video.\n //\n // Since the audio loader will wait for the main loader to load the first segment,\n // the main loader will save the first timeline mapping, and ensure that there won't\n // be a case where audio loads two segments without saving a mapping (thus leading\n // to missing segment timing info).\n this.syncController_.saveSegmentTimingInfo({\n segmentInfo: segmentInfo,\n shouldSaveTimelineMapping: this.loaderType_ === 'main'\n });\n }\n\n var segmentDurationMessage = getTroublesomeSegmentDurationMessage(segmentInfo, this.sourceType_);\n\n if (segmentDurationMessage) {\n if (segmentDurationMessage.severity === 'warn') {\n videojs.log.warn(segmentDurationMessage.message);\n } else {\n this.logger_(segmentDurationMessage.message);\n }\n }\n\n this.recordThroughput_(segmentInfo);\n this.pendingSegment_ = null;\n this.state = 'READY';\n\n if (segmentInfo.isSyncRequest) {\n this.trigger('syncinfoupdate'); // if the sync request was not appended\n // then it was not the correct segment.\n // throw it away and use the data it gave us\n // to get the correct one.\n\n if (!segmentInfo.hasAppendedData_) {\n this.logger_(\"Throwing away un-appended sync request \" + segmentInfoString(segmentInfo));\n return;\n }\n }\n\n this.logger_(\"Appended \" + segmentInfoString(segmentInfo));\n this.addSegmentMetadataCue_(segmentInfo);\n this.fetchAtBuffer_ = true;\n\n if (this.currentTimeline_ !== segmentInfo.timeline) {\n this.timelineChangeController_.lastTimelineChange({\n type: this.loaderType_,\n from: this.currentTimeline_,\n to: segmentInfo.timeline\n }); // If audio is not disabled, the main segment loader is responsible for updating\n // the audio timeline as well. If the content is video only, this won't have any\n // impact.\n\n if (this.loaderType_ === 'main' && !this.audioDisabled_) {\n this.timelineChangeController_.lastTimelineChange({\n type: 'audio',\n from: this.currentTimeline_,\n to: segmentInfo.timeline\n });\n }\n }\n\n this.currentTimeline_ = segmentInfo.timeline; // We must update the syncinfo to recalculate the seekable range before\n // the following conditional otherwise it may consider this a bad \"guess\"\n // and attempt to resync when the post-update seekable window and live\n // point would mean that this was the perfect segment to fetch\n\n this.trigger('syncinfoupdate');\n var segment = segmentInfo.segment;\n var part = segmentInfo.part;\n var badSegmentGuess = segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3;\n var badPartGuess = part && part.end && this.currentTime_() - part.end > segmentInfo.playlist.partTargetDuration * 3; // If we previously appended a segment/part that ends more than 3 part/targetDurations before\n // the currentTime_ that means that our conservative guess was too conservative.\n // In that case, reset the loader state so that we try to use any information gained\n // from the previous request to create a new, more accurate, sync-point.\n\n if (badSegmentGuess || badPartGuess) {\n this.logger_(\"bad \" + (badSegmentGuess ? 'segment' : 'part') + \" \" + segmentInfoString(segmentInfo));\n this.resetEverything();\n return;\n }\n\n var isWalkingForward = this.mediaIndex !== null; // Don't do a rendition switch unless we have enough time to get a sync segment\n // and conservatively guess\n\n if (isWalkingForward) {\n this.trigger('bandwidthupdate');\n }\n\n this.trigger('progress');\n this.mediaIndex = segmentInfo.mediaIndex;\n this.partIndex = segmentInfo.partIndex; // any time an update finishes and the last segment is in the\n // buffer, end the stream. this ensures the \"ended\" event will\n // fire if playback reaches that point.\n\n if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) {\n this.endOfStream();\n } // used for testing\n\n\n this.trigger('appended');\n\n if (segmentInfo.hasAppendedData_) {\n this.mediaAppends++;\n }\n\n if (!this.paused()) {\n this.monitorBuffer_();\n }\n }\n /**\n * Records the current throughput of the decrypt, transmux, and append\n * portion of the semgment pipeline. `throughput.rate` is a the cumulative\n * moving average of the throughput. `throughput.count` is the number of\n * data points in the average.\n *\n * @private\n * @param {Object} segmentInfo the object returned by loadSegment\n */\n ;\n\n _proto.recordThroughput_ = function recordThroughput_(segmentInfo) {\n if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) {\n this.logger_(\"Ignoring segment's throughput because its duration of \" + segmentInfo.duration + (\" is less than the min to record \" + MIN_SEGMENT_DURATION_TO_SAVE_STATS));\n return;\n }\n\n var rate = this.throughput.rate; // Add one to the time to ensure that we don't accidentally attempt to divide\n // by zero in the case where the throughput is ridiculously high\n\n var segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1; // Multiply by 8000 to convert from bytes/millisecond to bits/second\n\n var segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1000); // This is just a cumulative moving average calculation:\n // newAvg = oldAvg + (sample - oldAvg) / (sampleCount + 1)\n\n this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count;\n }\n /**\n * Adds a cue to the segment-metadata track with some metadata information about the\n * segment\n *\n * @private\n * @param {Object} segmentInfo\n * the object returned by loadSegment\n * @method addSegmentMetadataCue_\n */\n ;\n\n _proto.addSegmentMetadataCue_ = function addSegmentMetadataCue_(segmentInfo) {\n if (!this.segmentMetadataTrack_) {\n return;\n }\n\n var segment = segmentInfo.segment;\n var start = segment.start;\n var end = segment.end; // Do not try adding the cue if the start and end times are invalid.\n\n if (!finite(start) || !finite(end)) {\n return;\n }\n\n removeCuesFromTrack(start, end, this.segmentMetadataTrack_);\n var Cue = (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebKitDataCue) || (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue);\n var value = {\n custom: segment.custom,\n dateTimeObject: segment.dateTimeObject,\n dateTimeString: segment.dateTimeString,\n bandwidth: segmentInfo.playlist.attributes.BANDWIDTH,\n resolution: segmentInfo.playlist.attributes.RESOLUTION,\n codecs: segmentInfo.playlist.attributes.CODECS,\n byteLength: segmentInfo.byteLength,\n uri: segmentInfo.uri,\n timeline: segmentInfo.timeline,\n playlist: segmentInfo.playlist.id,\n start: start,\n end: end\n };\n var data = JSON.stringify(value);\n var cue = new Cue(start, end, data); // Attach the metadata to the value property of the cue to keep consistency between\n // the differences of WebKitDataCue in safari and VTTCue in other browsers\n\n cue.value = value;\n this.segmentMetadataTrack_.addCue(cue);\n };\n\n return SegmentLoader;\n}(videojs.EventTarget);\n\nfunction noop() {}\n\nvar toTitleCase = function toTitleCase(string) {\n if (typeof string !== 'string') {\n return string;\n }\n\n return string.replace(/./, function (w) {\n return w.toUpperCase();\n });\n};\n\nvar bufferTypes = ['video', 'audio'];\n\nvar _updating = function updating(type, sourceUpdater) {\n var sourceBuffer = sourceUpdater[type + \"Buffer\"];\n return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type];\n};\n\nvar nextQueueIndexOfType = function nextQueueIndexOfType(type, queue) {\n for (var i = 0; i < queue.length; i++) {\n var queueEntry = queue[i];\n\n if (queueEntry.type === 'mediaSource') {\n // If the next entry is a media source entry (uses multiple source buffers), block\n // processing to allow it to go through first.\n return null;\n }\n\n if (queueEntry.type === type) {\n return i;\n }\n }\n\n return null;\n};\n\nvar shiftQueue = function shiftQueue(type, sourceUpdater) {\n if (sourceUpdater.queue.length === 0) {\n return;\n }\n\n var queueIndex = 0;\n var queueEntry = sourceUpdater.queue[queueIndex];\n\n if (queueEntry.type === 'mediaSource') {\n if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== 'closed') {\n sourceUpdater.queue.shift();\n queueEntry.action(sourceUpdater);\n\n if (queueEntry.doneFn) {\n queueEntry.doneFn();\n } // Only specific source buffer actions must wait for async updateend events. Media\n // Source actions process synchronously. Therefore, both audio and video source\n // buffers are now clear to process the next queue entries.\n\n\n shiftQueue('audio', sourceUpdater);\n shiftQueue('video', sourceUpdater);\n } // Media Source actions require both source buffers, so if the media source action\n // couldn't process yet (because one or both source buffers are busy), block other\n // queue actions until both are available and the media source action can process.\n\n\n return;\n }\n\n if (type === 'mediaSource') {\n // If the queue was shifted by a media source action (this happens when pushing a\n // media source action onto the queue), then it wasn't from an updateend event from an\n // audio or video source buffer, so there's no change from previous state, and no\n // processing should be done.\n return;\n } // Media source queue entries don't need to consider whether the source updater is\n // started (i.e., source buffers are created) as they don't need the source buffers, but\n // source buffer queue entries do.\n\n\n if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === 'closed' || _updating(type, sourceUpdater)) {\n return;\n }\n\n if (queueEntry.type !== type) {\n queueIndex = nextQueueIndexOfType(type, sourceUpdater.queue);\n\n if (queueIndex === null) {\n // Either there's no queue entry that uses this source buffer type in the queue, or\n // there's a media source queue entry before the next entry of this type, in which\n // case wait for that action to process first.\n return;\n }\n\n queueEntry = sourceUpdater.queue[queueIndex];\n }\n\n sourceUpdater.queue.splice(queueIndex, 1); // Keep a record that this source buffer type is in use.\n //\n // The queue pending operation must be set before the action is performed in the event\n // that the action results in a synchronous event that is acted upon. For instance, if\n // an exception is thrown that can be handled, it's possible that new actions will be\n // appended to an empty queue and immediately executed, but would not have the correct\n // pending information if this property was set after the action was performed.\n\n sourceUpdater.queuePending[type] = queueEntry;\n queueEntry.action(type, sourceUpdater);\n\n if (!queueEntry.doneFn) {\n // synchronous operation, process next entry\n sourceUpdater.queuePending[type] = null;\n shiftQueue(type, sourceUpdater);\n return;\n }\n};\n\nvar cleanupBuffer = function cleanupBuffer(type, sourceUpdater) {\n var buffer = sourceUpdater[type + \"Buffer\"];\n var titleType = toTitleCase(type);\n\n if (!buffer) {\n return;\n }\n\n buffer.removeEventListener('updateend', sourceUpdater[\"on\" + titleType + \"UpdateEnd_\"]);\n buffer.removeEventListener('error', sourceUpdater[\"on\" + titleType + \"Error_\"]);\n sourceUpdater.codecs[type] = null;\n sourceUpdater[type + \"Buffer\"] = null;\n};\n\nvar inSourceBuffers = function inSourceBuffers(mediaSource, sourceBuffer) {\n return mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1;\n};\n\nvar actions = {\n appendBuffer: function appendBuffer(bytes, segmentInfo, onError) {\n return function (type, sourceUpdater) {\n var sourceBuffer = sourceUpdater[type + \"Buffer\"]; // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n }\n\n sourceUpdater.logger_(\"Appending segment \" + segmentInfo.mediaIndex + \"'s \" + bytes.length + \" bytes to \" + type + \"Buffer\");\n\n try {\n sourceBuffer.appendBuffer(bytes);\n } catch (e) {\n sourceUpdater.logger_(\"Error with code \" + e.code + \" \" + (e.code === QUOTA_EXCEEDED_ERR ? '(QUOTA_EXCEEDED_ERR) ' : '') + (\"when appending segment \" + segmentInfo.mediaIndex + \" to \" + type + \"Buffer\"));\n sourceUpdater.queuePending[type] = null;\n onError(e);\n }\n };\n },\n remove: function remove(start, end) {\n return function (type, sourceUpdater) {\n var sourceBuffer = sourceUpdater[type + \"Buffer\"]; // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n }\n\n sourceUpdater.logger_(\"Removing \" + start + \" to \" + end + \" from \" + type + \"Buffer\");\n\n try {\n sourceBuffer.remove(start, end);\n } catch (e) {\n sourceUpdater.logger_(\"Remove \" + start + \" to \" + end + \" from \" + type + \"Buffer failed\");\n }\n };\n },\n timestampOffset: function timestampOffset(offset) {\n return function (type, sourceUpdater) {\n var sourceBuffer = sourceUpdater[type + \"Buffer\"]; // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n }\n\n sourceUpdater.logger_(\"Setting \" + type + \"timestampOffset to \" + offset);\n sourceBuffer.timestampOffset = offset;\n };\n },\n callback: function callback(_callback) {\n return function (type, sourceUpdater) {\n _callback();\n };\n },\n endOfStream: function endOfStream(error) {\n return function (sourceUpdater) {\n if (sourceUpdater.mediaSource.readyState !== 'open') {\n return;\n }\n\n sourceUpdater.logger_(\"Calling mediaSource endOfStream(\" + (error || '') + \")\");\n\n try {\n sourceUpdater.mediaSource.endOfStream(error);\n } catch (e) {\n videojs.log.warn('Failed to call media source endOfStream', e);\n }\n };\n },\n duration: function duration(_duration) {\n return function (sourceUpdater) {\n sourceUpdater.logger_(\"Setting mediaSource duration to \" + _duration);\n\n try {\n sourceUpdater.mediaSource.duration = _duration;\n } catch (e) {\n videojs.log.warn('Failed to set media source duration', e);\n }\n };\n },\n abort: function abort() {\n return function (type, sourceUpdater) {\n if (sourceUpdater.mediaSource.readyState !== 'open') {\n return;\n }\n\n var sourceBuffer = sourceUpdater[type + \"Buffer\"]; // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n }\n\n sourceUpdater.logger_(\"calling abort on \" + type + \"Buffer\");\n\n try {\n sourceBuffer.abort();\n } catch (e) {\n videojs.log.warn(\"Failed to abort on \" + type + \"Buffer\", e);\n }\n };\n },\n addSourceBuffer: function addSourceBuffer(type, codec) {\n return function (sourceUpdater) {\n var titleType = toTitleCase(type);\n var mime = (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.getMimeForCodec)(codec);\n sourceUpdater.logger_(\"Adding \" + type + \"Buffer with codec \" + codec + \" to mediaSource\");\n var sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime);\n sourceBuffer.addEventListener('updateend', sourceUpdater[\"on\" + titleType + \"UpdateEnd_\"]);\n sourceBuffer.addEventListener('error', sourceUpdater[\"on\" + titleType + \"Error_\"]);\n sourceUpdater.codecs[type] = codec;\n sourceUpdater[type + \"Buffer\"] = sourceBuffer;\n };\n },\n removeSourceBuffer: function removeSourceBuffer(type) {\n return function (sourceUpdater) {\n var sourceBuffer = sourceUpdater[type + \"Buffer\"];\n cleanupBuffer(type, sourceUpdater); // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n }\n\n sourceUpdater.logger_(\"Removing \" + type + \"Buffer with codec \" + sourceUpdater.codecs[type] + \" from mediaSource\");\n\n try {\n sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer);\n } catch (e) {\n videojs.log.warn(\"Failed to removeSourceBuffer \" + type + \"Buffer\", e);\n }\n };\n },\n changeType: function changeType(codec) {\n return function (type, sourceUpdater) {\n var sourceBuffer = sourceUpdater[type + \"Buffer\"];\n var mime = (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.getMimeForCodec)(codec); // can't do anything if the media source / source buffer is null\n // or the media source does not contain this source buffer.\n\n if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {\n return;\n } // do not update codec if we don't need to.\n\n\n if (sourceUpdater.codecs[type] === codec) {\n return;\n }\n\n sourceUpdater.logger_(\"changing \" + type + \"Buffer codec from \" + sourceUpdater.codecs[type] + \" to \" + codec);\n sourceBuffer.changeType(mime);\n sourceUpdater.codecs[type] = codec;\n };\n }\n};\n\nvar pushQueue = function pushQueue(_ref) {\n var type = _ref.type,\n sourceUpdater = _ref.sourceUpdater,\n action = _ref.action,\n doneFn = _ref.doneFn,\n name = _ref.name;\n sourceUpdater.queue.push({\n type: type,\n action: action,\n doneFn: doneFn,\n name: name\n });\n shiftQueue(type, sourceUpdater);\n};\n\nvar onUpdateend = function onUpdateend(type, sourceUpdater) {\n return function (e) {\n // Although there should, in theory, be a pending action for any updateend receieved,\n // there are some actions that may trigger updateend events without set definitions in\n // the w3c spec. For instance, setting the duration on the media source may trigger\n // updateend events on source buffers. This does not appear to be in the spec. As such,\n // if we encounter an updateend without a corresponding pending action from our queue\n // for that source buffer type, process the next action.\n if (sourceUpdater.queuePending[type]) {\n var doneFn = sourceUpdater.queuePending[type].doneFn;\n sourceUpdater.queuePending[type] = null;\n\n if (doneFn) {\n // if there's an error, report it\n doneFn(sourceUpdater[type + \"Error_\"]);\n }\n }\n\n shiftQueue(type, sourceUpdater);\n };\n};\n/**\n * A queue of callbacks to be serialized and applied when a\n * MediaSource and its associated SourceBuffers are not in the\n * updating state. It is used by the segment loader to update the\n * underlying SourceBuffers when new data is loaded, for instance.\n *\n * @class SourceUpdater\n * @param {MediaSource} mediaSource the MediaSource to create the SourceBuffer from\n * @param {string} mimeType the desired MIME type of the underlying SourceBuffer\n */\n\n\nvar SourceUpdater = /*#__PURE__*/function (_videojs$EventTarget) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(SourceUpdater, _videojs$EventTarget);\n\n function SourceUpdater(mediaSource) {\n var _this;\n\n _this = _videojs$EventTarget.call(this) || this;\n _this.mediaSource = mediaSource;\n\n _this.sourceopenListener_ = function () {\n return shiftQueue('mediaSource', (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this));\n };\n\n _this.mediaSource.addEventListener('sourceopen', _this.sourceopenListener_);\n\n _this.logger_ = logger('SourceUpdater'); // initial timestamp offset is 0\n\n _this.audioTimestampOffset_ = 0;\n _this.videoTimestampOffset_ = 0;\n _this.queue = [];\n _this.queuePending = {\n audio: null,\n video: null\n };\n _this.delayedAudioAppendQueue_ = [];\n _this.videoAppendQueued_ = false;\n _this.codecs = {};\n _this.onVideoUpdateEnd_ = onUpdateend('video', (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this));\n _this.onAudioUpdateEnd_ = onUpdateend('audio', (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this));\n\n _this.onVideoError_ = function (e) {\n // used for debugging\n _this.videoError_ = e;\n };\n\n _this.onAudioError_ = function (e) {\n // used for debugging\n _this.audioError_ = e;\n };\n\n _this.createdSourceBuffers_ = false;\n _this.initializedEme_ = false;\n _this.triggeredReady_ = false;\n return _this;\n }\n\n var _proto = SourceUpdater.prototype;\n\n _proto.initializedEme = function initializedEme() {\n this.initializedEme_ = true;\n this.triggerReady();\n };\n\n _proto.hasCreatedSourceBuffers = function hasCreatedSourceBuffers() {\n // if false, likely waiting on one of the segment loaders to get enough data to create\n // source buffers\n return this.createdSourceBuffers_;\n };\n\n _proto.hasInitializedAnyEme = function hasInitializedAnyEme() {\n return this.initializedEme_;\n };\n\n _proto.ready = function ready() {\n return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme();\n };\n\n _proto.createSourceBuffers = function createSourceBuffers(codecs) {\n if (this.hasCreatedSourceBuffers()) {\n // already created them before\n return;\n } // the intial addOrChangeSourceBuffers will always be\n // two add buffers.\n\n\n this.addOrChangeSourceBuffers(codecs);\n this.createdSourceBuffers_ = true;\n this.trigger('createdsourcebuffers');\n this.triggerReady();\n };\n\n _proto.triggerReady = function triggerReady() {\n // only allow ready to be triggered once, this prevents the case\n // where:\n // 1. we trigger createdsourcebuffers\n // 2. ie 11 synchronously initializates eme\n // 3. the synchronous initialization causes us to trigger ready\n // 4. We go back to the ready check in createSourceBuffers and ready is triggered again.\n if (this.ready() && !this.triggeredReady_) {\n this.triggeredReady_ = true;\n this.trigger('ready');\n }\n }\n /**\n * Add a type of source buffer to the media source.\n *\n * @param {string} type\n * The type of source buffer to add.\n *\n * @param {string} codec\n * The codec to add the source buffer with.\n */\n ;\n\n _proto.addSourceBuffer = function addSourceBuffer(type, codec) {\n pushQueue({\n type: 'mediaSource',\n sourceUpdater: this,\n action: actions.addSourceBuffer(type, codec),\n name: 'addSourceBuffer'\n });\n }\n /**\n * call abort on a source buffer.\n *\n * @param {string} type\n * The type of source buffer to call abort on.\n */\n ;\n\n _proto.abort = function abort(type) {\n pushQueue({\n type: type,\n sourceUpdater: this,\n action: actions.abort(type),\n name: 'abort'\n });\n }\n /**\n * Call removeSourceBuffer and remove a specific type\n * of source buffer on the mediaSource.\n *\n * @param {string} type\n * The type of source buffer to remove.\n */\n ;\n\n _proto.removeSourceBuffer = function removeSourceBuffer(type) {\n if (!this.canRemoveSourceBuffer()) {\n videojs.log.error('removeSourceBuffer is not supported!');\n return;\n }\n\n pushQueue({\n type: 'mediaSource',\n sourceUpdater: this,\n action: actions.removeSourceBuffer(type),\n name: 'removeSourceBuffer'\n });\n }\n /**\n * Whether or not the removeSourceBuffer function is supported\n * on the mediaSource.\n *\n * @return {boolean}\n * if removeSourceBuffer can be called.\n */\n ;\n\n _proto.canRemoveSourceBuffer = function canRemoveSourceBuffer() {\n // IE reports that it supports removeSourceBuffer, but often throws\n // errors when attempting to use the function. So we report that it\n // does not support removeSourceBuffer. As of Firefox 83 removeSourceBuffer\n // throws errors, so we report that it does not support this as well.\n return !videojs.browser.IE_VERSION && !videojs.browser.IS_FIREFOX && (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource).prototype && typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource).prototype.removeSourceBuffer === 'function';\n }\n /**\n * Whether or not the changeType function is supported\n * on our SourceBuffers.\n *\n * @return {boolean}\n * if changeType can be called.\n */\n ;\n\n SourceUpdater.canChangeType = function canChangeType() {\n return (global_window__WEBPACK_IMPORTED_MODULE_0___default().SourceBuffer) && (global_window__WEBPACK_IMPORTED_MODULE_0___default().SourceBuffer).prototype && typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().SourceBuffer).prototype.changeType === 'function';\n }\n /**\n * Whether or not the changeType function is supported\n * on our SourceBuffers.\n *\n * @return {boolean}\n * if changeType can be called.\n */\n ;\n\n _proto.canChangeType = function canChangeType() {\n return this.constructor.canChangeType();\n }\n /**\n * Call the changeType function on a source buffer, given the code and type.\n *\n * @param {string} type\n * The type of source buffer to call changeType on.\n *\n * @param {string} codec\n * The codec string to change type with on the source buffer.\n */\n ;\n\n _proto.changeType = function changeType(type, codec) {\n if (!this.canChangeType()) {\n videojs.log.error('changeType is not supported!');\n return;\n }\n\n pushQueue({\n type: type,\n sourceUpdater: this,\n action: actions.changeType(codec),\n name: 'changeType'\n });\n }\n /**\n * Add source buffers with a codec or, if they are already created,\n * call changeType on source buffers using changeType.\n *\n * @param {Object} codecs\n * Codecs to switch to\n */\n ;\n\n _proto.addOrChangeSourceBuffers = function addOrChangeSourceBuffers(codecs) {\n var _this2 = this;\n\n if (!codecs || typeof codecs !== 'object' || Object.keys(codecs).length === 0) {\n throw new Error('Cannot addOrChangeSourceBuffers to undefined codecs');\n }\n\n Object.keys(codecs).forEach(function (type) {\n var codec = codecs[type];\n\n if (!_this2.hasCreatedSourceBuffers()) {\n return _this2.addSourceBuffer(type, codec);\n }\n\n if (_this2.canChangeType()) {\n _this2.changeType(type, codec);\n }\n });\n }\n /**\n * Queue an update to append an ArrayBuffer.\n *\n * @param {MediaObject} object containing audioBytes and/or videoBytes\n * @param {Function} done the function to call when done\n * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-appendBuffer-void-ArrayBuffer-data\n */\n ;\n\n _proto.appendBuffer = function appendBuffer(options, doneFn) {\n var _this3 = this;\n\n var segmentInfo = options.segmentInfo,\n type = options.type,\n bytes = options.bytes;\n this.processedAppend_ = true;\n\n if (type === 'audio' && this.videoBuffer && !this.videoAppendQueued_) {\n this.delayedAudioAppendQueue_.push([options, doneFn]);\n this.logger_(\"delayed audio append of \" + bytes.length + \" until video append\");\n return;\n } // In the case of certain errors, for instance, QUOTA_EXCEEDED_ERR, updateend will\n // not be fired. This means that the queue will be blocked until the next action\n // taken by the segment-loader. Provide a mechanism for segment-loader to handle\n // these errors by calling the doneFn with the specific error.\n\n\n var onError = doneFn;\n pushQueue({\n type: type,\n sourceUpdater: this,\n action: actions.appendBuffer(bytes, segmentInfo || {\n mediaIndex: -1\n }, onError),\n doneFn: doneFn,\n name: 'appendBuffer'\n });\n\n if (type === 'video') {\n this.videoAppendQueued_ = true;\n\n if (!this.delayedAudioAppendQueue_.length) {\n return;\n }\n\n var queue = this.delayedAudioAppendQueue_.slice();\n this.logger_(\"queuing delayed audio \" + queue.length + \" appendBuffers\");\n this.delayedAudioAppendQueue_.length = 0;\n queue.forEach(function (que) {\n _this3.appendBuffer.apply(_this3, que);\n });\n }\n }\n /**\n * Get the audio buffer's buffered timerange.\n *\n * @return {TimeRange}\n * The audio buffer's buffered time range\n */\n ;\n\n _proto.audioBuffered = function audioBuffered() {\n // no media source/source buffer or it isn't in the media sources\n // source buffer list\n if (!inSourceBuffers(this.mediaSource, this.audioBuffer)) {\n return videojs.createTimeRange();\n }\n\n return this.audioBuffer.buffered ? this.audioBuffer.buffered : videojs.createTimeRange();\n }\n /**\n * Get the video buffer's buffered timerange.\n *\n * @return {TimeRange}\n * The video buffer's buffered time range\n */\n ;\n\n _proto.videoBuffered = function videoBuffered() {\n // no media source/source buffer or it isn't in the media sources\n // source buffer list\n if (!inSourceBuffers(this.mediaSource, this.videoBuffer)) {\n return videojs.createTimeRange();\n }\n\n return this.videoBuffer.buffered ? this.videoBuffer.buffered : videojs.createTimeRange();\n }\n /**\n * Get a combined video/audio buffer's buffered timerange.\n *\n * @return {TimeRange}\n * the combined time range\n */\n ;\n\n _proto.buffered = function buffered() {\n var video = inSourceBuffers(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null;\n var audio = inSourceBuffers(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null;\n\n if (audio && !video) {\n return this.audioBuffered();\n }\n\n if (video && !audio) {\n return this.videoBuffered();\n }\n\n return bufferIntersection(this.audioBuffered(), this.videoBuffered());\n }\n /**\n * Add a callback to the queue that will set duration on the mediaSource.\n *\n * @param {number} duration\n * The duration to set\n *\n * @param {Function} [doneFn]\n * function to run after duration has been set.\n */\n ;\n\n _proto.setDuration = function setDuration(duration, doneFn) {\n if (doneFn === void 0) {\n doneFn = noop;\n } // In order to set the duration on the media source, it's necessary to wait for all\n // source buffers to no longer be updating. \"If the updating attribute equals true on\n // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and\n // abort these steps.\" (source: https://www.w3.org/TR/media-source/#attributes).\n\n\n pushQueue({\n type: 'mediaSource',\n sourceUpdater: this,\n action: actions.duration(duration),\n name: 'duration',\n doneFn: doneFn\n });\n }\n /**\n * Add a mediaSource endOfStream call to the queue\n *\n * @param {Error} [error]\n * Call endOfStream with an error\n *\n * @param {Function} [doneFn]\n * A function that should be called when the\n * endOfStream call has finished.\n */\n ;\n\n _proto.endOfStream = function endOfStream(error, doneFn) {\n if (error === void 0) {\n error = null;\n }\n\n if (doneFn === void 0) {\n doneFn = noop;\n }\n\n if (typeof error !== 'string') {\n error = undefined;\n } // In order to set the duration on the media source, it's necessary to wait for all\n // source buffers to no longer be updating. \"If the updating attribute equals true on\n // any SourceBuffer in sourceBuffers, then throw an InvalidStateError exception and\n // abort these steps.\" (source: https://www.w3.org/TR/media-source/#attributes).\n\n\n pushQueue({\n type: 'mediaSource',\n sourceUpdater: this,\n action: actions.endOfStream(error),\n name: 'endOfStream',\n doneFn: doneFn\n });\n }\n /**\n * Queue an update to remove a time range from the buffer.\n *\n * @param {number} start where to start the removal\n * @param {number} end where to end the removal\n * @param {Function} [done=noop] optional callback to be executed when the remove\n * operation is complete\n * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end\n */\n ;\n\n _proto.removeAudio = function removeAudio(start, end, done) {\n if (done === void 0) {\n done = noop;\n }\n\n if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) {\n done();\n return;\n }\n\n pushQueue({\n type: 'audio',\n sourceUpdater: this,\n action: actions.remove(start, end),\n doneFn: done,\n name: 'remove'\n });\n }\n /**\n * Queue an update to remove a time range from the buffer.\n *\n * @param {number} start where to start the removal\n * @param {number} end where to end the removal\n * @param {Function} [done=noop] optional callback to be executed when the remove\n * operation is complete\n * @see http://www.w3.org/TR/media-source/#widl-SourceBuffer-remove-void-double-start-unrestricted-double-end\n */\n ;\n\n _proto.removeVideo = function removeVideo(start, end, done) {\n if (done === void 0) {\n done = noop;\n }\n\n if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) {\n done();\n return;\n }\n\n pushQueue({\n type: 'video',\n sourceUpdater: this,\n action: actions.remove(start, end),\n doneFn: done,\n name: 'remove'\n });\n }\n /**\n * Whether the underlying sourceBuffer is updating or not\n *\n * @return {boolean} the updating status of the SourceBuffer\n */\n ;\n\n _proto.updating = function updating() {\n // the audio/video source buffer is updating\n if (_updating('audio', this) || _updating('video', this)) {\n return true;\n }\n\n return false;\n }\n /**\n * Set/get the timestampoffset on the audio SourceBuffer\n *\n * @return {number} the timestamp offset\n */\n ;\n\n _proto.audioTimestampOffset = function audioTimestampOffset(offset) {\n if (typeof offset !== 'undefined' && this.audioBuffer && // no point in updating if it's the same\n this.audioTimestampOffset_ !== offset) {\n pushQueue({\n type: 'audio',\n sourceUpdater: this,\n action: actions.timestampOffset(offset),\n name: 'timestampOffset'\n });\n this.audioTimestampOffset_ = offset;\n }\n\n return this.audioTimestampOffset_;\n }\n /**\n * Set/get the timestampoffset on the video SourceBuffer\n *\n * @return {number} the timestamp offset\n */\n ;\n\n _proto.videoTimestampOffset = function videoTimestampOffset(offset) {\n if (typeof offset !== 'undefined' && this.videoBuffer && // no point in updating if it's the same\n this.videoTimestampOffset !== offset) {\n pushQueue({\n type: 'video',\n sourceUpdater: this,\n action: actions.timestampOffset(offset),\n name: 'timestampOffset'\n });\n this.videoTimestampOffset_ = offset;\n }\n\n return this.videoTimestampOffset_;\n }\n /**\n * Add a function to the queue that will be called\n * when it is its turn to run in the audio queue.\n *\n * @param {Function} callback\n * The callback to queue.\n */\n ;\n\n _proto.audioQueueCallback = function audioQueueCallback(callback) {\n if (!this.audioBuffer) {\n return;\n }\n\n pushQueue({\n type: 'audio',\n sourceUpdater: this,\n action: actions.callback(callback),\n name: 'callback'\n });\n }\n /**\n * Add a function to the queue that will be called\n * when it is its turn to run in the video queue.\n *\n * @param {Function} callback\n * The callback to queue.\n */\n ;\n\n _proto.videoQueueCallback = function videoQueueCallback(callback) {\n if (!this.videoBuffer) {\n return;\n }\n\n pushQueue({\n type: 'video',\n sourceUpdater: this,\n action: actions.callback(callback),\n name: 'callback'\n });\n }\n /**\n * dispose of the source updater and the underlying sourceBuffer\n */\n ;\n\n _proto.dispose = function dispose() {\n var _this4 = this;\n\n this.trigger('dispose');\n bufferTypes.forEach(function (type) {\n _this4.abort(type);\n\n if (_this4.canRemoveSourceBuffer()) {\n _this4.removeSourceBuffer(type);\n } else {\n _this4[type + \"QueueCallback\"](function () {\n return cleanupBuffer(type, _this4);\n });\n }\n });\n this.videoAppendQueued_ = false;\n this.delayedAudioAppendQueue_.length = 0;\n\n if (this.sourceopenListener_) {\n this.mediaSource.removeEventListener('sourceopen', this.sourceopenListener_);\n }\n\n this.off();\n };\n\n return SourceUpdater;\n}(videojs.EventTarget);\n\nvar uint8ToUtf8 = function uint8ToUtf8(uintArray) {\n return decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray)));\n};\n\nvar VTT_LINE_TERMINATORS = new Uint8Array('\\n\\n'.split('').map(function (_char3) {\n return _char3.charCodeAt(0);\n}));\n\nvar NoVttJsError = /*#__PURE__*/function (_Error) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(NoVttJsError, _Error);\n\n function NoVttJsError() {\n return _Error.call(this, 'Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.') || this;\n }\n\n return NoVttJsError;\n}( /*#__PURE__*/(0,_babel_runtime_helpers_wrapNativeSuper__WEBPACK_IMPORTED_MODULE_21__[\"default\"])(Error));\n/**\n * An object that manages segment loading and appending.\n *\n * @class VTTSegmentLoader\n * @param {Object} options required and optional options\n * @extends videojs.EventTarget\n */\n\n\nvar VTTSegmentLoader = /*#__PURE__*/function (_SegmentLoader) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(VTTSegmentLoader, _SegmentLoader);\n\n function VTTSegmentLoader(settings, options) {\n var _this;\n\n if (options === void 0) {\n options = {};\n }\n\n _this = _SegmentLoader.call(this, settings, options) || this; // SegmentLoader requires a MediaSource be specified or it will throw an error;\n // however, VTTSegmentLoader has no need of a media source, so delete the reference\n\n _this.mediaSource_ = null;\n _this.subtitlesTrack_ = null;\n _this.loaderType_ = 'subtitle';\n _this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks;\n _this.loadVttJs = settings.loadVttJs; // The VTT segment will have its own time mappings. Saving VTT segment timing info in\n // the sync controller leads to improper behavior.\n\n _this.shouldSaveSegmentTimingInfo_ = false;\n return _this;\n }\n\n var _proto = VTTSegmentLoader.prototype;\n\n _proto.createTransmuxer_ = function createTransmuxer_() {\n // don't need to transmux any subtitles\n return null;\n }\n /**\n * Indicates which time ranges are buffered\n *\n * @return {TimeRange}\n * TimeRange object representing the current buffered ranges\n */\n ;\n\n _proto.buffered_ = function buffered_() {\n if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) {\n return videojs.createTimeRanges();\n }\n\n var cues = this.subtitlesTrack_.cues;\n var start = cues[0].startTime;\n var end = cues[cues.length - 1].startTime;\n return videojs.createTimeRanges([[start, end]]);\n }\n /**\n * Gets and sets init segment for the provided map\n *\n * @param {Object} map\n * The map object representing the init segment to get or set\n * @param {boolean=} set\n * If true, the init segment for the provided map should be saved\n * @return {Object}\n * map object for desired init segment\n */\n ;\n\n _proto.initSegmentForMap = function initSegmentForMap(map, set) {\n if (set === void 0) {\n set = false;\n }\n\n if (!map) {\n return null;\n }\n\n var id = initSegmentId(map);\n var storedMap = this.initSegments_[id];\n\n if (set && !storedMap && map.bytes) {\n // append WebVTT line terminators to the media initialization segment if it exists\n // to follow the WebVTT spec (https://w3c.github.io/webvtt/#file-structure) that\n // requires two or more WebVTT line terminators between the WebVTT header and the\n // rest of the file\n var combinedByteLength = VTT_LINE_TERMINATORS.byteLength + map.bytes.byteLength;\n var combinedSegment = new Uint8Array(combinedByteLength);\n combinedSegment.set(map.bytes);\n combinedSegment.set(VTT_LINE_TERMINATORS, map.bytes.byteLength);\n this.initSegments_[id] = storedMap = {\n resolvedUri: map.resolvedUri,\n byterange: map.byterange,\n bytes: combinedSegment\n };\n }\n\n return storedMap || map;\n }\n /**\n * Returns true if all configuration required for loading is present, otherwise false.\n *\n * @return {boolean} True if the all configuration is ready for loading\n * @private\n */\n ;\n\n _proto.couldBeginLoading_ = function couldBeginLoading_() {\n return this.playlist_ && this.subtitlesTrack_ && !this.paused();\n }\n /**\n * Once all the starting parameters have been specified, begin\n * operation. This method should only be invoked from the INIT\n * state.\n *\n * @private\n */\n ;\n\n _proto.init_ = function init_() {\n this.state = 'READY';\n this.resetEverything();\n return this.monitorBuffer_();\n }\n /**\n * Set a subtitle track on the segment loader to add subtitles to\n *\n * @param {TextTrack=} track\n * The text track to add loaded subtitles to\n * @return {TextTrack}\n * Returns the subtitles track\n */\n ;\n\n _proto.track = function track(_track) {\n if (typeof _track === 'undefined') {\n return this.subtitlesTrack_;\n }\n\n this.subtitlesTrack_ = _track; // if we were unpaused but waiting for a sourceUpdater, start\n // buffering now\n\n if (this.state === 'INIT' && this.couldBeginLoading_()) {\n this.init_();\n }\n\n return this.subtitlesTrack_;\n }\n /**\n * Remove any data in the source buffer between start and end times\n *\n * @param {number} start - the start time of the region to remove from the buffer\n * @param {number} end - the end time of the region to remove from the buffer\n */\n ;\n\n _proto.remove = function remove(start, end) {\n removeCuesFromTrack(start, end, this.subtitlesTrack_);\n }\n /**\n * fill the buffer with segements unless the sourceBuffers are\n * currently updating\n *\n * Note: this function should only ever be called by monitorBuffer_\n * and never directly\n *\n * @private\n */\n ;\n\n _proto.fillBuffer_ = function fillBuffer_() {\n var _this2 = this; // see if we need to begin loading immediately\n\n\n var segmentInfo = this.chooseNextRequest_();\n\n if (!segmentInfo) {\n return;\n }\n\n if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) {\n // We don't have the timestamp offset that we need to sync subtitles.\n // Rerun on a timestamp offset or user interaction.\n var checkTimestampOffset = function checkTimestampOffset() {\n _this2.state = 'READY';\n\n if (!_this2.paused()) {\n // if not paused, queue a buffer check as soon as possible\n _this2.monitorBuffer_();\n }\n };\n\n this.syncController_.one('timestampoffset', checkTimestampOffset);\n this.state = 'WAITING_ON_TIMELINE';\n return;\n }\n\n this.loadSegment_(segmentInfo);\n } // never set a timestamp offset for vtt segments.\n ;\n\n _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_() {\n return null;\n };\n\n _proto.chooseNextRequest_ = function chooseNextRequest_() {\n return this.skipEmptySegments_(_SegmentLoader.prototype.chooseNextRequest_.call(this));\n }\n /**\n * Prevents the segment loader from requesting segments we know contain no subtitles\n * by walking forward until we find the next segment that we don't know whether it is\n * empty or not.\n *\n * @param {Object} segmentInfo\n * a segment info object that describes the current segment\n * @return {Object}\n * a segment info object that describes the current segment\n */\n ;\n\n _proto.skipEmptySegments_ = function skipEmptySegments_(segmentInfo) {\n while (segmentInfo && segmentInfo.segment.empty) {\n // stop at the last possible segmentInfo\n if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) {\n segmentInfo = null;\n break;\n }\n\n segmentInfo = this.generateSegmentInfo_({\n playlist: segmentInfo.playlist,\n mediaIndex: segmentInfo.mediaIndex + 1,\n startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration,\n isSyncRequest: segmentInfo.isSyncRequest\n });\n }\n\n return segmentInfo;\n };\n\n _proto.stopForError = function stopForError(error) {\n this.error(error);\n this.state = 'READY';\n this.pause();\n this.trigger('error');\n }\n /**\n * append a decrypted segement to the SourceBuffer through a SourceUpdater\n *\n * @private\n */\n ;\n\n _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) {\n var _this3 = this;\n\n if (!this.subtitlesTrack_) {\n this.state = 'READY';\n return;\n }\n\n this.saveTransferStats_(simpleSegment.stats); // the request was aborted\n\n if (!this.pendingSegment_) {\n this.state = 'READY';\n this.mediaRequestsAborted += 1;\n return;\n }\n\n if (error) {\n if (error.code === REQUEST_ERRORS.TIMEOUT) {\n this.handleTimeout_();\n }\n\n if (error.code === REQUEST_ERRORS.ABORTED) {\n this.mediaRequestsAborted += 1;\n } else {\n this.mediaRequestsErrored += 1;\n }\n\n this.stopForError(error);\n return;\n }\n\n var segmentInfo = this.pendingSegment_; // although the VTT segment loader bandwidth isn't really used, it's good to\n // maintain functionality between segment loaders\n\n this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats); // if this request included a segment key, save that data in the cache\n\n if (simpleSegment.key) {\n this.segmentKey(simpleSegment.key, true);\n }\n\n this.state = 'APPENDING'; // used for tests\n\n this.trigger('appending');\n var segment = segmentInfo.segment;\n\n if (segment.map) {\n segment.map.bytes = simpleSegment.map.bytes;\n }\n\n segmentInfo.bytes = simpleSegment.bytes; // Make sure that vttjs has loaded, otherwise, load it and wait till it finished loading\n\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) !== 'function' && typeof this.loadVttJs === 'function') {\n this.state = 'WAITING_ON_VTTJS'; // should be fine to call multiple times\n // script will be loaded once but multiple listeners will be added to the queue, which is expected.\n\n this.loadVttJs().then(function () {\n return _this3.segmentRequestFinished_(error, simpleSegment, result);\n }, function () {\n return _this3.stopForError({\n message: 'Error loading vtt.js'\n });\n });\n return;\n }\n\n segment.requested = true;\n\n try {\n this.parseVTTCues_(segmentInfo);\n } catch (e) {\n this.stopForError({\n message: e.message\n });\n return;\n }\n\n this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_);\n\n if (segmentInfo.cues.length) {\n segmentInfo.timingInfo = {\n start: segmentInfo.cues[0].startTime,\n end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime\n };\n } else {\n segmentInfo.timingInfo = {\n start: segmentInfo.startOfSegment,\n end: segmentInfo.startOfSegment + segmentInfo.duration\n };\n }\n\n if (segmentInfo.isSyncRequest) {\n this.trigger('syncinfoupdate');\n this.pendingSegment_ = null;\n this.state = 'READY';\n return;\n }\n\n segmentInfo.byteLength = segmentInfo.bytes.byteLength;\n this.mediaSecondsLoaded += segment.duration; // Create VTTCue instances for each cue in the new segment and add them to\n // the subtitle track\n\n segmentInfo.cues.forEach(function (cue) {\n _this3.subtitlesTrack_.addCue(_this3.featuresNativeTextTracks_ ? new (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue)(cue.startTime, cue.endTime, cue.text) : cue);\n }); // Remove any duplicate cues from the subtitle track. The WebVTT spec allows\n // cues to have identical time-intervals, but if the text is also identical\n // we can safely assume it is a duplicate that can be removed (ex. when a cue\n // \"overlaps\" VTT segments)\n\n removeDuplicateCuesFromTrack(this.subtitlesTrack_);\n this.handleAppendsDone_();\n };\n\n _proto.handleData_ = function handleData_() {// noop as we shouldn't be getting video/audio data captions\n // that we do not support here.\n };\n\n _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_() {// noop\n }\n /**\n * Uses the WebVTT parser to parse the segment response\n *\n * @throws NoVttJsError\n *\n * @param {Object} segmentInfo\n * a segment info object that describes the current segment\n * @private\n */\n ;\n\n _proto.parseVTTCues_ = function parseVTTCues_(segmentInfo) {\n var decoder;\n var decodeBytesToString = false;\n\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT) !== 'function') {\n // caller is responsible for exception handling.\n throw new NoVttJsError();\n }\n\n if (typeof (global_window__WEBPACK_IMPORTED_MODULE_0___default().TextDecoder) === 'function') {\n decoder = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().TextDecoder)('utf8');\n } else {\n decoder = global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT.StringDecoder();\n decodeBytesToString = true;\n }\n\n var parser = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().WebVTT).Parser((global_window__WEBPACK_IMPORTED_MODULE_0___default()), (global_window__WEBPACK_IMPORTED_MODULE_0___default().vttjs), decoder);\n segmentInfo.cues = [];\n segmentInfo.timestampmap = {\n MPEGTS: 0,\n LOCAL: 0\n };\n parser.oncue = segmentInfo.cues.push.bind(segmentInfo.cues);\n\n parser.ontimestampmap = function (map) {\n segmentInfo.timestampmap = map;\n };\n\n parser.onparsingerror = function (error) {\n videojs.log.warn('Error encountered when parsing cues: ' + error.message);\n };\n\n if (segmentInfo.segment.map) {\n var mapData = segmentInfo.segment.map.bytes;\n\n if (decodeBytesToString) {\n mapData = uint8ToUtf8(mapData);\n }\n\n parser.parse(mapData);\n }\n\n var segmentData = segmentInfo.bytes;\n\n if (decodeBytesToString) {\n segmentData = uint8ToUtf8(segmentData);\n }\n\n parser.parse(segmentData);\n parser.flush();\n }\n /**\n * Updates the start and end times of any cues parsed by the WebVTT parser using\n * the information parsed from the X-TIMESTAMP-MAP header and a TS to media time mapping\n * from the SyncController\n *\n * @param {Object} segmentInfo\n * a segment info object that describes the current segment\n * @param {Object} mappingObj\n * object containing a mapping from TS to media time\n * @param {Object} playlist\n * the playlist object containing the segment\n * @private\n */\n ;\n\n _proto.updateTimeMapping_ = function updateTimeMapping_(segmentInfo, mappingObj, playlist) {\n var segment = segmentInfo.segment;\n\n if (!mappingObj) {\n // If the sync controller does not have a mapping of TS to Media Time for the\n // timeline, then we don't have enough information to update the cue\n // start/end times\n return;\n }\n\n if (!segmentInfo.cues.length) {\n // If there are no cues, we also do not have enough information to figure out\n // segment timing. Mark that the segment contains no cues so we don't re-request\n // an empty segment.\n segment.empty = true;\n return;\n }\n\n var timestampmap = segmentInfo.timestampmap;\n var diff = timestampmap.MPEGTS / mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_20__.ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping;\n segmentInfo.cues.forEach(function (cue) {\n // First convert cue time to TS time using the timestamp-map provided within the vtt\n cue.startTime += diff;\n cue.endTime += diff;\n });\n\n if (!playlist.syncInfo) {\n var firstStart = segmentInfo.cues[0].startTime;\n var lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime;\n playlist.syncInfo = {\n mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex,\n time: Math.min(firstStart, lastStart - segment.duration)\n };\n }\n };\n\n return VTTSegmentLoader;\n}(SegmentLoader);\n/**\n * @file ad-cue-tags.js\n */\n\n/**\n * Searches for an ad cue that overlaps with the given mediaTime\n *\n * @param {Object} track\n * the track to find the cue for\n *\n * @param {number} mediaTime\n * the time to find the cue at\n *\n * @return {Object|null}\n * the found cue or null\n */\n\n\nvar findAdCue = function findAdCue(track, mediaTime) {\n var cues = track.cues;\n\n for (var i = 0; i < cues.length; i++) {\n var cue = cues[i];\n\n if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) {\n return cue;\n }\n }\n\n return null;\n};\n\nvar updateAdCues = function updateAdCues(media, track, offset) {\n if (offset === void 0) {\n offset = 0;\n }\n\n if (!media.segments) {\n return;\n }\n\n var mediaTime = offset;\n var cue;\n\n for (var i = 0; i < media.segments.length; i++) {\n var segment = media.segments[i];\n\n if (!cue) {\n // Since the cues will span for at least the segment duration, adding a fudge\n // factor of half segment duration will prevent duplicate cues from being\n // created when timing info is not exact (e.g. cue start time initialized\n // at 10.006677, but next call mediaTime is 10.003332 )\n cue = findAdCue(track, mediaTime + segment.duration / 2);\n }\n\n if (cue) {\n if ('cueIn' in segment) {\n // Found a CUE-IN so end the cue\n cue.endTime = mediaTime;\n cue.adEndTime = mediaTime;\n mediaTime += segment.duration;\n cue = null;\n continue;\n }\n\n if (mediaTime < cue.endTime) {\n // Already processed this mediaTime for this cue\n mediaTime += segment.duration;\n continue;\n } // otherwise extend cue until a CUE-IN is found\n\n\n cue.endTime += segment.duration;\n } else {\n if ('cueOut' in segment) {\n cue = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue)(mediaTime, mediaTime + segment.duration, segment.cueOut);\n cue.adStartTime = mediaTime; // Assumes tag format to be\n // #EXT-X-CUE-OUT:30\n\n cue.adEndTime = mediaTime + parseFloat(segment.cueOut);\n track.addCue(cue);\n }\n\n if ('cueOutCont' in segment) {\n // Entered into the middle of an ad cue\n // Assumes tag formate to be\n // #EXT-X-CUE-OUT-CONT:10/30\n var _segment$cueOutCont$s = segment.cueOutCont.split('/').map(parseFloat),\n adOffset = _segment$cueOutCont$s[0],\n adTotal = _segment$cueOutCont$s[1];\n\n cue = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().VTTCue)(mediaTime, mediaTime + segment.duration, '');\n cue.adStartTime = mediaTime - adOffset;\n cue.adEndTime = cue.adStartTime + adTotal;\n track.addCue(cue);\n }\n }\n\n mediaTime += segment.duration;\n }\n}; // synchronize expired playlist segments.\n// the max media sequence diff is 48 hours of live stream\n// content with two second segments. Anything larger than that\n// will likely be invalid.\n\n\nvar MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC = 86400;\nvar syncPointStrategies = [// Stategy \"VOD\": Handle the VOD-case where the sync-point is *always*\n// the equivalence display-time 0 === segment-index 0\n{\n name: 'VOD',\n run: function run(syncController, playlist, duration, currentTimeline, currentTime) {\n if (duration !== Infinity) {\n var syncPoint = {\n time: 0,\n segmentIndex: 0,\n partIndex: null\n };\n return syncPoint;\n }\n\n return null;\n }\n}, // Stategy \"ProgramDateTime\": We have a program-date-time tag in this playlist\n{\n name: 'ProgramDateTime',\n run: function run(syncController, playlist, duration, currentTimeline, currentTime) {\n if (!Object.keys(syncController.timelineToDatetimeMappings).length) {\n return null;\n }\n\n var syncPoint = null;\n var lastDistance = null;\n var partsAndSegments = getPartsAndSegments(playlist);\n currentTime = currentTime || 0;\n\n for (var i = 0; i < partsAndSegments.length; i++) {\n // start from the end and loop backwards for live\n // or start from the front and loop forwards for non-live\n var index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1);\n var partAndSegment = partsAndSegments[index];\n var segment = partAndSegment.segment;\n var datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline];\n\n if (!datetimeMapping || !segment.dateTimeObject) {\n continue;\n }\n\n var segmentTime = segment.dateTimeObject.getTime() / 1000;\n var start = segmentTime + datetimeMapping; // take part duration into account.\n\n if (segment.parts && typeof partAndSegment.partIndex === 'number') {\n for (var z = 0; z < partAndSegment.partIndex; z++) {\n start += segment.parts[z].duration;\n }\n }\n\n var distance = Math.abs(currentTime - start); // Once the distance begins to increase, or if distance is 0, we have passed\n // currentTime and can stop looking for better candidates\n\n if (lastDistance !== null && (distance === 0 || lastDistance < distance)) {\n break;\n }\n\n lastDistance = distance;\n syncPoint = {\n time: start,\n segmentIndex: partAndSegment.segmentIndex,\n partIndex: partAndSegment.partIndex\n };\n }\n\n return syncPoint;\n }\n}, // Stategy \"Segment\": We have a known time mapping for a timeline and a\n// segment in the current timeline with timing data\n{\n name: 'Segment',\n run: function run(syncController, playlist, duration, currentTimeline, currentTime) {\n var syncPoint = null;\n var lastDistance = null;\n currentTime = currentTime || 0;\n var partsAndSegments = getPartsAndSegments(playlist);\n\n for (var i = 0; i < partsAndSegments.length; i++) {\n // start from the end and loop backwards for live\n // or start from the front and loop forwards for non-live\n var index = playlist.endList || currentTime === 0 ? i : partsAndSegments.length - (i + 1);\n var partAndSegment = partsAndSegments[index];\n var segment = partAndSegment.segment;\n var start = partAndSegment.part && partAndSegment.part.start || segment && segment.start;\n\n if (segment.timeline === currentTimeline && typeof start !== 'undefined') {\n var distance = Math.abs(currentTime - start); // Once the distance begins to increase, we have passed\n // currentTime and can stop looking for better candidates\n\n if (lastDistance !== null && lastDistance < distance) {\n break;\n }\n\n if (!syncPoint || lastDistance === null || lastDistance >= distance) {\n lastDistance = distance;\n syncPoint = {\n time: start,\n segmentIndex: partAndSegment.segmentIndex,\n partIndex: partAndSegment.partIndex\n };\n }\n }\n }\n\n return syncPoint;\n }\n}, // Stategy \"Discontinuity\": We have a discontinuity with a known\n// display-time\n{\n name: 'Discontinuity',\n run: function run(syncController, playlist, duration, currentTimeline, currentTime) {\n var syncPoint = null;\n currentTime = currentTime || 0;\n\n if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {\n var lastDistance = null;\n\n for (var i = 0; i < playlist.discontinuityStarts.length; i++) {\n var segmentIndex = playlist.discontinuityStarts[i];\n var discontinuity = playlist.discontinuitySequence + i + 1;\n var discontinuitySync = syncController.discontinuities[discontinuity];\n\n if (discontinuitySync) {\n var distance = Math.abs(currentTime - discontinuitySync.time); // Once the distance begins to increase, we have passed\n // currentTime and can stop looking for better candidates\n\n if (lastDistance !== null && lastDistance < distance) {\n break;\n }\n\n if (!syncPoint || lastDistance === null || lastDistance >= distance) {\n lastDistance = distance;\n syncPoint = {\n time: discontinuitySync.time,\n segmentIndex: segmentIndex,\n partIndex: null\n };\n }\n }\n }\n }\n\n return syncPoint;\n }\n}, // Stategy \"Playlist\": We have a playlist with a known mapping of\n// segment index to display time\n{\n name: 'Playlist',\n run: function run(syncController, playlist, duration, currentTimeline, currentTime) {\n if (playlist.syncInfo) {\n var syncPoint = {\n time: playlist.syncInfo.time,\n segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence,\n partIndex: null\n };\n return syncPoint;\n }\n\n return null;\n }\n}];\n\nvar SyncController = /*#__PURE__*/function (_videojs$EventTarget) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(SyncController, _videojs$EventTarget);\n\n function SyncController(options) {\n var _this;\n\n _this = _videojs$EventTarget.call(this) || this; // ...for synching across variants\n\n _this.timelines = [];\n _this.discontinuities = [];\n _this.timelineToDatetimeMappings = {};\n _this.logger_ = logger('SyncController');\n return _this;\n }\n /**\n * Find a sync-point for the playlist specified\n *\n * A sync-point is defined as a known mapping from display-time to\n * a segment-index in the current playlist.\n *\n * @param {Playlist} playlist\n * The playlist that needs a sync-point\n * @param {number} duration\n * Duration of the MediaSource (Infinite if playing a live source)\n * @param {number} currentTimeline\n * The last timeline from which a segment was loaded\n * @return {Object}\n * A sync-point object\n */\n\n\n var _proto = SyncController.prototype;\n\n _proto.getSyncPoint = function getSyncPoint(playlist, duration, currentTimeline, currentTime) {\n var syncPoints = this.runStrategies_(playlist, duration, currentTimeline, currentTime);\n\n if (!syncPoints.length) {\n // Signal that we need to attempt to get a sync-point manually\n // by fetching a segment in the playlist and constructing\n // a sync-point from that information\n return null;\n } // Now find the sync-point that is closest to the currentTime because\n // that should result in the most accurate guess about which segment\n // to fetch\n\n\n return this.selectSyncPoint_(syncPoints, {\n key: 'time',\n value: currentTime\n });\n }\n /**\n * Calculate the amount of time that has expired off the playlist during playback\n *\n * @param {Playlist} playlist\n * Playlist object to calculate expired from\n * @param {number} duration\n * Duration of the MediaSource (Infinity if playling a live source)\n * @return {number|null}\n * The amount of time that has expired off the playlist during playback. Null\n * if no sync-points for the playlist can be found.\n */\n ;\n\n _proto.getExpiredTime = function getExpiredTime(playlist, duration) {\n if (!playlist || !playlist.segments) {\n return null;\n }\n\n var syncPoints = this.runStrategies_(playlist, duration, playlist.discontinuitySequence, 0); // Without sync-points, there is not enough information to determine the expired time\n\n if (!syncPoints.length) {\n return null;\n }\n\n var syncPoint = this.selectSyncPoint_(syncPoints, {\n key: 'segmentIndex',\n value: 0\n }); // If the sync-point is beyond the start of the playlist, we want to subtract the\n // duration from index 0 to syncPoint.segmentIndex instead of adding.\n\n if (syncPoint.segmentIndex > 0) {\n syncPoint.time *= -1;\n }\n\n return Math.abs(syncPoint.time + sumDurations({\n defaultDuration: playlist.targetDuration,\n durationList: playlist.segments,\n startIndex: syncPoint.segmentIndex,\n endIndex: 0\n }));\n }\n /**\n * Runs each sync-point strategy and returns a list of sync-points returned by the\n * strategies\n *\n * @private\n * @param {Playlist} playlist\n * The playlist that needs a sync-point\n * @param {number} duration\n * Duration of the MediaSource (Infinity if playing a live source)\n * @param {number} currentTimeline\n * The last timeline from which a segment was loaded\n * @return {Array}\n * A list of sync-point objects\n */\n ;\n\n _proto.runStrategies_ = function runStrategies_(playlist, duration, currentTimeline, currentTime) {\n var syncPoints = []; // Try to find a sync-point in by utilizing various strategies...\n\n for (var i = 0; i < syncPointStrategies.length; i++) {\n var strategy = syncPointStrategies[i];\n var syncPoint = strategy.run(this, playlist, duration, currentTimeline, currentTime);\n\n if (syncPoint) {\n syncPoint.strategy = strategy.name;\n syncPoints.push({\n strategy: strategy.name,\n syncPoint: syncPoint\n });\n }\n }\n\n return syncPoints;\n }\n /**\n * Selects the sync-point nearest the specified target\n *\n * @private\n * @param {Array} syncPoints\n * List of sync-points to select from\n * @param {Object} target\n * Object specifying the property and value we are targeting\n * @param {string} target.key\n * Specifies the property to target. Must be either 'time' or 'segmentIndex'\n * @param {number} target.value\n * The value to target for the specified key.\n * @return {Object}\n * The sync-point nearest the target\n */\n ;\n\n _proto.selectSyncPoint_ = function selectSyncPoint_(syncPoints, target) {\n var bestSyncPoint = syncPoints[0].syncPoint;\n var bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value);\n var bestStrategy = syncPoints[0].strategy;\n\n for (var i = 1; i < syncPoints.length; i++) {\n var newDistance = Math.abs(syncPoints[i].syncPoint[target.key] - target.value);\n\n if (newDistance < bestDistance) {\n bestDistance = newDistance;\n bestSyncPoint = syncPoints[i].syncPoint;\n bestStrategy = syncPoints[i].strategy;\n }\n }\n\n this.logger_(\"syncPoint for [\" + target.key + \": \" + target.value + \"] chosen with strategy\" + (\" [\" + bestStrategy + \"]: [time:\" + bestSyncPoint.time + \",\") + (\" segmentIndex:\" + bestSyncPoint.segmentIndex) + (typeof bestSyncPoint.partIndex === 'number' ? \",partIndex:\" + bestSyncPoint.partIndex : '') + ']');\n return bestSyncPoint;\n }\n /**\n * Save any meta-data present on the segments when segments leave\n * the live window to the playlist to allow for synchronization at the\n * playlist level later.\n *\n * @param {Playlist} oldPlaylist - The previous active playlist\n * @param {Playlist} newPlaylist - The updated and most current playlist\n */\n ;\n\n _proto.saveExpiredSegmentInfo = function saveExpiredSegmentInfo(oldPlaylist, newPlaylist) {\n var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence; // Ignore large media sequence gaps\n\n if (mediaSequenceDiff > MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC) {\n videojs.log.warn(\"Not saving expired segment info. Media sequence gap \" + mediaSequenceDiff + \" is too large.\");\n return;\n } // When a segment expires from the playlist and it has a start time\n // save that information as a possible sync-point reference in future\n\n\n for (var i = mediaSequenceDiff - 1; i >= 0; i--) {\n var lastRemovedSegment = oldPlaylist.segments[i];\n\n if (lastRemovedSegment && typeof lastRemovedSegment.start !== 'undefined') {\n newPlaylist.syncInfo = {\n mediaSequence: oldPlaylist.mediaSequence + i,\n time: lastRemovedSegment.start\n };\n this.logger_(\"playlist refresh sync: [time:\" + newPlaylist.syncInfo.time + \",\" + (\" mediaSequence: \" + newPlaylist.syncInfo.mediaSequence + \"]\"));\n this.trigger('syncinfoupdate');\n break;\n }\n }\n }\n /**\n * Save the mapping from playlist's ProgramDateTime to display. This should only happen\n * before segments start to load.\n *\n * @param {Playlist} playlist - The currently active playlist\n */\n ;\n\n _proto.setDateTimeMappingForStart = function setDateTimeMappingForStart(playlist) {\n // It's possible for the playlist to be updated before playback starts, meaning time\n // zero is not yet set. If, during these playlist refreshes, a discontinuity is\n // crossed, then the old time zero mapping (for the prior timeline) would be retained\n // unless the mappings are cleared.\n this.timelineToDatetimeMappings = {};\n\n if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) {\n var firstSegment = playlist.segments[0];\n var playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1000;\n this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp;\n }\n }\n /**\n * Calculates and saves timeline mappings, playlist sync info, and segment timing values\n * based on the latest timing information.\n *\n * @param {Object} options\n * Options object\n * @param {SegmentInfo} options.segmentInfo\n * The current active request information\n * @param {boolean} options.shouldSaveTimelineMapping\n * If there's a timeline change, determines if the timeline mapping should be\n * saved for timeline mapping and program date time mappings.\n */\n ;\n\n _proto.saveSegmentTimingInfo = function saveSegmentTimingInfo(_ref) {\n var segmentInfo = _ref.segmentInfo,\n shouldSaveTimelineMapping = _ref.shouldSaveTimelineMapping;\n var didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping);\n var segment = segmentInfo.segment;\n\n if (didCalculateSegmentTimeMapping) {\n this.saveDiscontinuitySyncInfo_(segmentInfo); // If the playlist does not have sync information yet, record that information\n // now with segment timing information\n\n if (!segmentInfo.playlist.syncInfo) {\n segmentInfo.playlist.syncInfo = {\n mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex,\n time: segment.start\n };\n }\n }\n\n var dateTime = segment.dateTimeObject;\n\n if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) {\n this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1000);\n }\n };\n\n _proto.timestampOffsetForTimeline = function timestampOffsetForTimeline(timeline) {\n if (typeof this.timelines[timeline] === 'undefined') {\n return null;\n }\n\n return this.timelines[timeline].time;\n };\n\n _proto.mappingForTimeline = function mappingForTimeline(timeline) {\n if (typeof this.timelines[timeline] === 'undefined') {\n return null;\n }\n\n return this.timelines[timeline].mapping;\n }\n /**\n * Use the \"media time\" for a segment to generate a mapping to \"display time\" and\n * save that display time to the segment.\n *\n * @private\n * @param {SegmentInfo} segmentInfo\n * The current active request information\n * @param {Object} timingInfo\n * The start and end time of the current segment in \"media time\"\n * @param {boolean} shouldSaveTimelineMapping\n * If there's a timeline change, determines if the timeline mapping should be\n * saved in timelines.\n * @return {boolean}\n * Returns false if segment time mapping could not be calculated\n */\n ;\n\n _proto.calculateSegmentTimeMapping_ = function calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) {\n // TODO: remove side effects\n var segment = segmentInfo.segment;\n var part = segmentInfo.part;\n var mappingObj = this.timelines[segmentInfo.timeline];\n var start;\n var end;\n\n if (typeof segmentInfo.timestampOffset === 'number') {\n mappingObj = {\n time: segmentInfo.startOfSegment,\n mapping: segmentInfo.startOfSegment - timingInfo.start\n };\n\n if (shouldSaveTimelineMapping) {\n this.timelines[segmentInfo.timeline] = mappingObj;\n this.trigger('timestampoffset');\n this.logger_(\"time mapping for timeline \" + segmentInfo.timeline + \": \" + (\"[time: \" + mappingObj.time + \"] [mapping: \" + mappingObj.mapping + \"]\"));\n }\n\n start = segmentInfo.startOfSegment;\n end = timingInfo.end + mappingObj.mapping;\n } else if (mappingObj) {\n start = timingInfo.start + mappingObj.mapping;\n end = timingInfo.end + mappingObj.mapping;\n } else {\n return false;\n }\n\n if (part) {\n part.start = start;\n part.end = end;\n } // If we don't have a segment start yet or the start value we got\n // is less than our current segment.start value, save a new start value.\n // We have to do this because parts will have segment timing info saved\n // multiple times and we want segment start to be the earliest part start\n // value for that segment.\n\n\n if (!segment.start || start < segment.start) {\n segment.start = start;\n }\n\n segment.end = end;\n return true;\n }\n /**\n * Each time we have discontinuity in the playlist, attempt to calculate the location\n * in display of the start of the discontinuity and save that. We also save an accuracy\n * value so that we save values with the most accuracy (closest to 0.)\n *\n * @private\n * @param {SegmentInfo} segmentInfo - The current active request information\n */\n ;\n\n _proto.saveDiscontinuitySyncInfo_ = function saveDiscontinuitySyncInfo_(segmentInfo) {\n var playlist = segmentInfo.playlist;\n var segment = segmentInfo.segment; // If the current segment is a discontinuity then we know exactly where\n // the start of the range and it's accuracy is 0 (greater accuracy values\n // mean more approximation)\n\n if (segment.discontinuity) {\n this.discontinuities[segment.timeline] = {\n time: segment.start,\n accuracy: 0\n };\n } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {\n // Search for future discontinuities that we can provide better timing\n // information for and save that information for sync purposes\n for (var i = 0; i < playlist.discontinuityStarts.length; i++) {\n var segmentIndex = playlist.discontinuityStarts[i];\n var discontinuity = playlist.discontinuitySequence + i + 1;\n var mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex;\n var accuracy = Math.abs(mediaIndexDiff);\n\n if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) {\n var time = void 0;\n\n if (mediaIndexDiff < 0) {\n time = segment.start - sumDurations({\n defaultDuration: playlist.targetDuration,\n durationList: playlist.segments,\n startIndex: segmentInfo.mediaIndex,\n endIndex: segmentIndex\n });\n } else {\n time = segment.end + sumDurations({\n defaultDuration: playlist.targetDuration,\n durationList: playlist.segments,\n startIndex: segmentInfo.mediaIndex + 1,\n endIndex: segmentIndex\n });\n }\n\n this.discontinuities[discontinuity] = {\n time: time,\n accuracy: accuracy\n };\n }\n }\n }\n };\n\n _proto.dispose = function dispose() {\n this.trigger('dispose');\n this.off();\n };\n\n return SyncController;\n}(videojs.EventTarget);\n/**\n * The TimelineChangeController acts as a source for segment loaders to listen for and\n * keep track of latest and pending timeline changes. This is useful to ensure proper\n * sync, as each loader may need to make a consideration for what timeline the other\n * loader is on before making changes which could impact the other loader's media.\n *\n * @class TimelineChangeController\n * @extends videojs.EventTarget\n */\n\n\nvar TimelineChangeController = /*#__PURE__*/function (_videojs$EventTarget) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(TimelineChangeController, _videojs$EventTarget);\n\n function TimelineChangeController() {\n var _this;\n\n _this = _videojs$EventTarget.call(this) || this;\n _this.pendingTimelineChanges_ = {};\n _this.lastTimelineChanges_ = {};\n return _this;\n }\n\n var _proto = TimelineChangeController.prototype;\n\n _proto.clearPendingTimelineChange = function clearPendingTimelineChange(type) {\n this.pendingTimelineChanges_[type] = null;\n this.trigger('pendingtimelinechange');\n };\n\n _proto.pendingTimelineChange = function pendingTimelineChange(_ref) {\n var type = _ref.type,\n from = _ref.from,\n to = _ref.to;\n\n if (typeof from === 'number' && typeof to === 'number') {\n this.pendingTimelineChanges_[type] = {\n type: type,\n from: from,\n to: to\n };\n this.trigger('pendingtimelinechange');\n }\n\n return this.pendingTimelineChanges_[type];\n };\n\n _proto.lastTimelineChange = function lastTimelineChange(_ref2) {\n var type = _ref2.type,\n from = _ref2.from,\n to = _ref2.to;\n\n if (typeof from === 'number' && typeof to === 'number') {\n this.lastTimelineChanges_[type] = {\n type: type,\n from: from,\n to: to\n };\n delete this.pendingTimelineChanges_[type];\n this.trigger('timelinechange');\n }\n\n return this.lastTimelineChanges_[type];\n };\n\n _proto.dispose = function dispose() {\n this.trigger('dispose');\n this.pendingTimelineChanges_ = {};\n this.lastTimelineChanges_ = {};\n this.off();\n };\n\n return TimelineChangeController;\n}(videojs.EventTarget);\n/* rollup-plugin-worker-factory start for worker!/Users/ddashkevich/projects/http-streaming/src/decrypter-worker.js */\n\n\nvar workerCode = transform(getWorkerString(function () {\n var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};\n\n function createCommonjsModule(fn, basedir, module) {\n return module = {\n path: basedir,\n exports: {},\n require: function require(path, base) {\n return commonjsRequire(path, base === undefined || base === null ? module.path : base);\n }\n }, fn(module, module.exports), module.exports;\n }\n\n function commonjsRequire() {\n throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');\n }\n\n var createClass = createCommonjsModule(function (module) {\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n }\n\n module.exports = _createClass;\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n });\n var setPrototypeOf = createCommonjsModule(function (module) {\n function _setPrototypeOf(o, p) {\n module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n return _setPrototypeOf(o, p);\n }\n\n module.exports = _setPrototypeOf;\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n });\n var inheritsLoose = createCommonjsModule(function (module) {\n function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n }\n\n module.exports = _inheritsLoose;\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n });\n /**\n * @file stream.js\n */\n\n /**\n * A lightweight readable stream implemention that handles event dispatching.\n *\n * @class Stream\n */\n\n var Stream = /*#__PURE__*/function () {\n function Stream() {\n this.listeners = {};\n }\n /**\n * Add a listener for a specified event type.\n *\n * @param {string} type the event name\n * @param {Function} listener the callback to be invoked when an event of\n * the specified type occurs\n */\n\n\n var _proto = Stream.prototype;\n\n _proto.on = function on(type, listener) {\n if (!this.listeners[type]) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push(listener);\n }\n /**\n * Remove a listener for a specified event type.\n *\n * @param {string} type the event name\n * @param {Function} listener a function previously registered for this\n * type of event through `on`\n * @return {boolean} if we could turn it off or not\n */\n ;\n\n _proto.off = function off(type, listener) {\n if (!this.listeners[type]) {\n return false;\n }\n\n var index = this.listeners[type].indexOf(listener); // TODO: which is better?\n // In Video.js we slice listener functions\n // on trigger so that it does not mess up the order\n // while we loop through.\n //\n // Here we slice on off so that the loop in trigger\n // can continue using it's old reference to loop without\n // messing up the order.\n\n this.listeners[type] = this.listeners[type].slice(0);\n this.listeners[type].splice(index, 1);\n return index > -1;\n }\n /**\n * Trigger an event of the specified type on this stream. Any additional\n * arguments to this function are passed as parameters to event listeners.\n *\n * @param {string} type the event name\n */\n ;\n\n _proto.trigger = function trigger(type) {\n var callbacks = this.listeners[type];\n\n if (!callbacks) {\n return;\n } // Slicing the arguments on every invocation of this method\n // can add a significant amount of overhead. Avoid the\n // intermediate object creation for the common case of a\n // single callback argument\n\n\n if (arguments.length === 2) {\n var length = callbacks.length;\n\n for (var i = 0; i < length; ++i) {\n callbacks[i].call(this, arguments[1]);\n }\n } else {\n var args = Array.prototype.slice.call(arguments, 1);\n var _length = callbacks.length;\n\n for (var _i = 0; _i < _length; ++_i) {\n callbacks[_i].apply(this, args);\n }\n }\n }\n /**\n * Destroys the stream and cleans up.\n */\n ;\n\n _proto.dispose = function dispose() {\n this.listeners = {};\n }\n /**\n * Forwards all `data` events on this stream to the destination stream. The\n * destination stream should provide a method `push` to receive the data\n * events as they arrive.\n *\n * @param {Stream} destination the stream that will receive all `data` events\n * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options\n */\n ;\n\n _proto.pipe = function pipe(destination) {\n this.on('data', function (data) {\n destination.push(data);\n });\n };\n\n return Stream;\n }();\n /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */\n\n /**\n * Returns the subarray of a Uint8Array without PKCS#7 padding.\n *\n * @param padded {Uint8Array} unencrypted bytes that have been padded\n * @return {Uint8Array} the unpadded bytes\n * @see http://tools.ietf.org/html/rfc5652\n */\n\n\n function unpad(padded) {\n return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);\n }\n /*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */\n\n /**\n * @file aes.js\n *\n * This file contains an adaptation of the AES decryption algorithm\n * from the Standford Javascript Cryptography Library. That work is\n * covered by the following copyright and permissions notice:\n *\n * Copyright 2009-2010 Emily Stark, Mike Hamburg, Dan Boneh.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR\n * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\n * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\n * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN\n * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n * The views and conclusions contained in the software and documentation\n * are those of the authors and should not be interpreted as representing\n * official policies, either expressed or implied, of the authors.\n */\n\n /**\n * Expand the S-box tables.\n *\n * @private\n */\n\n\n var precompute = function precompute() {\n var tables = [[[], [], [], [], []], [[], [], [], [], []]];\n var encTable = tables[0];\n var decTable = tables[1];\n var sbox = encTable[4];\n var sboxInv = decTable[4];\n var i;\n var x;\n var xInv;\n var d = [];\n var th = [];\n var x2;\n var x4;\n var x8;\n var s;\n var tEnc;\n var tDec; // Compute double and third tables\n\n for (i = 0; i < 256; i++) {\n th[(d[i] = i << 1 ^ (i >> 7) * 283) ^ i] = i;\n }\n\n for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {\n // Compute sbox\n s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;\n s = s >> 8 ^ s & 255 ^ 99;\n sbox[x] = s;\n sboxInv[s] = x; // Compute MixColumns\n\n x8 = d[x4 = d[x2 = d[x]]];\n tDec = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100;\n tEnc = d[s] * 0x101 ^ s * 0x1010100;\n\n for (i = 0; i < 4; i++) {\n encTable[i][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;\n decTable[i][s] = tDec = tDec << 24 ^ tDec >>> 8;\n }\n } // Compactify. Considerable speedup on Firefox.\n\n\n for (i = 0; i < 5; i++) {\n encTable[i] = encTable[i].slice(0);\n decTable[i] = decTable[i].slice(0);\n }\n\n return tables;\n };\n\n var aesTables = null;\n /**\n * Schedule out an AES key for both encryption and decryption. This\n * is a low-level class. Use a cipher mode to do bulk encryption.\n *\n * @class AES\n * @param key {Array} The key as an array of 4, 6 or 8 words.\n */\n\n var AES = /*#__PURE__*/function () {\n function AES(key) {\n /**\n * The expanded S-box and inverse S-box tables. These will be computed\n * on the client so that we don't have to send them down the wire.\n *\n * There are two tables, _tables[0] is for encryption and\n * _tables[1] is for decryption.\n *\n * The first 4 sub-tables are the expanded S-box with MixColumns. The\n * last (_tables[01][4]) is the S-box itself.\n *\n * @private\n */\n // if we have yet to precompute the S-box tables\n // do so now\n if (!aesTables) {\n aesTables = precompute();\n } // then make a copy of that object for use\n\n\n this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]];\n var i;\n var j;\n var tmp;\n var sbox = this._tables[0][4];\n var decTable = this._tables[1];\n var keyLen = key.length;\n var rcon = 1;\n\n if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {\n throw new Error('Invalid aes key size');\n }\n\n var encKey = key.slice(0);\n var decKey = [];\n this._key = [encKey, decKey]; // schedule encryption keys\n\n for (i = keyLen; i < 4 * keyLen + 28; i++) {\n tmp = encKey[i - 1]; // apply sbox\n\n if (i % keyLen === 0 || keyLen === 8 && i % keyLen === 4) {\n tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255]; // shift rows and add rcon\n\n if (i % keyLen === 0) {\n tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;\n rcon = rcon << 1 ^ (rcon >> 7) * 283;\n }\n }\n\n encKey[i] = encKey[i - keyLen] ^ tmp;\n } // schedule decryption keys\n\n\n for (j = 0; i; j++, i--) {\n tmp = encKey[j & 3 ? i : i - 4];\n\n if (i <= 4 || j < 4) {\n decKey[j] = tmp;\n } else {\n decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]];\n }\n }\n }\n /**\n * Decrypt 16 bytes, specified as four 32-bit words.\n *\n * @param {number} encrypted0 the first word to decrypt\n * @param {number} encrypted1 the second word to decrypt\n * @param {number} encrypted2 the third word to decrypt\n * @param {number} encrypted3 the fourth word to decrypt\n * @param {Int32Array} out the array to write the decrypted words\n * into\n * @param {number} offset the offset into the output array to start\n * writing results\n * @return {Array} The plaintext.\n */\n\n\n var _proto = AES.prototype;\n\n _proto.decrypt = function decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {\n var key = this._key[1]; // state variables a,b,c,d are loaded with pre-whitened data\n\n var a = encrypted0 ^ key[0];\n var b = encrypted3 ^ key[1];\n var c = encrypted2 ^ key[2];\n var d = encrypted1 ^ key[3];\n var a2;\n var b2;\n var c2; // key.length === 2 ?\n\n var nInnerRounds = key.length / 4 - 2;\n var i;\n var kIndex = 4;\n var table = this._tables[1]; // load up the tables\n\n var table0 = table[0];\n var table1 = table[1];\n var table2 = table[2];\n var table3 = table[3];\n var sbox = table[4]; // Inner rounds. Cribbed from OpenSSL.\n\n for (i = 0; i < nInnerRounds; i++) {\n a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d & 255] ^ key[kIndex];\n b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1];\n c2 = table0[c >>> 24] ^ table1[d >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2];\n d = table0[d >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3];\n kIndex += 4;\n a = a2;\n b = b2;\n c = c2;\n } // Last round.\n\n\n for (i = 0; i < 4; i++) {\n out[(3 & -i) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++];\n a2 = a;\n a = b;\n b = c;\n c = d;\n d = a2;\n }\n };\n\n return AES;\n }();\n /**\n * A wrapper around the Stream class to use setTimeout\n * and run stream \"jobs\" Asynchronously\n *\n * @class AsyncStream\n * @extends Stream\n */\n\n\n var AsyncStream = /*#__PURE__*/function (_Stream) {\n inheritsLoose(AsyncStream, _Stream);\n\n function AsyncStream() {\n var _this;\n\n _this = _Stream.call(this, Stream) || this;\n _this.jobs = [];\n _this.delay = 1;\n _this.timeout_ = null;\n return _this;\n }\n /**\n * process an async job\n *\n * @private\n */\n\n\n var _proto = AsyncStream.prototype;\n\n _proto.processJob_ = function processJob_() {\n this.jobs.shift()();\n\n if (this.jobs.length) {\n this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);\n } else {\n this.timeout_ = null;\n }\n }\n /**\n * push a job into the stream\n *\n * @param {Function} job the job to push into the stream\n */\n ;\n\n _proto.push = function push(job) {\n this.jobs.push(job);\n\n if (!this.timeout_) {\n this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);\n }\n };\n\n return AsyncStream;\n }(Stream);\n /**\n * Convert network-order (big-endian) bytes into their little-endian\n * representation.\n */\n\n\n var ntoh = function ntoh(word) {\n return word << 24 | (word & 0xff00) << 8 | (word & 0xff0000) >> 8 | word >>> 24;\n };\n /**\n * Decrypt bytes using AES-128 with CBC and PKCS#7 padding.\n *\n * @param {Uint8Array} encrypted the encrypted bytes\n * @param {Uint32Array} key the bytes of the decryption key\n * @param {Uint32Array} initVector the initialization vector (IV) to\n * use for the first round of CBC.\n * @return {Uint8Array} the decrypted bytes\n *\n * @see http://en.wikipedia.org/wiki/Advanced_Encryption_Standard\n * @see http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Cipher_Block_Chaining_.28CBC.29\n * @see https://tools.ietf.org/html/rfc2315\n */\n\n\n var decrypt = function decrypt(encrypted, key, initVector) {\n // word-level access to the encrypted bytes\n var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);\n var decipher = new AES(Array.prototype.slice.call(key)); // byte and word-level access for the decrypted output\n\n var decrypted = new Uint8Array(encrypted.byteLength);\n var decrypted32 = new Int32Array(decrypted.buffer); // temporary variables for working with the IV, encrypted, and\n // decrypted data\n\n var init0;\n var init1;\n var init2;\n var init3;\n var encrypted0;\n var encrypted1;\n var encrypted2;\n var encrypted3; // iteration variable\n\n var wordIx; // pull out the words of the IV to ensure we don't modify the\n // passed-in reference and easier access\n\n init0 = initVector[0];\n init1 = initVector[1];\n init2 = initVector[2];\n init3 = initVector[3]; // decrypt four word sequences, applying cipher-block chaining (CBC)\n // to each decrypted block\n\n for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) {\n // convert big-endian (network order) words into little-endian\n // (javascript order)\n encrypted0 = ntoh(encrypted32[wordIx]);\n encrypted1 = ntoh(encrypted32[wordIx + 1]);\n encrypted2 = ntoh(encrypted32[wordIx + 2]);\n encrypted3 = ntoh(encrypted32[wordIx + 3]); // decrypt the block\n\n decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx); // XOR with the IV, and restore network byte-order to obtain the\n // plaintext\n\n decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0);\n decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1);\n decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2);\n decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3); // setup the IV for the next round\n\n init0 = encrypted0;\n init1 = encrypted1;\n init2 = encrypted2;\n init3 = encrypted3;\n }\n\n return decrypted;\n };\n /**\n * The `Decrypter` class that manages decryption of AES\n * data through `AsyncStream` objects and the `decrypt`\n * function\n *\n * @param {Uint8Array} encrypted the encrypted bytes\n * @param {Uint32Array} key the bytes of the decryption key\n * @param {Uint32Array} initVector the initialization vector (IV) to\n * @param {Function} done the function to run when done\n * @class Decrypter\n */\n\n\n var Decrypter = /*#__PURE__*/function () {\n function Decrypter(encrypted, key, initVector, done) {\n var step = Decrypter.STEP;\n var encrypted32 = new Int32Array(encrypted.buffer);\n var decrypted = new Uint8Array(encrypted.byteLength);\n var i = 0;\n this.asyncStream_ = new AsyncStream(); // split up the encryption job and do the individual chunks asynchronously\n\n this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted));\n\n for (i = step; i < encrypted32.length; i += step) {\n initVector = new Uint32Array([ntoh(encrypted32[i - 4]), ntoh(encrypted32[i - 3]), ntoh(encrypted32[i - 2]), ntoh(encrypted32[i - 1])]);\n this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i, i + step), key, initVector, decrypted));\n } // invoke the done() callback when everything is finished\n\n\n this.asyncStream_.push(function () {\n // remove pkcs#7 padding from the decrypted bytes\n done(null, unpad(decrypted));\n });\n }\n /**\n * a getter for step the maximum number of bytes to process at one time\n *\n * @return {number} the value of step 32000\n */\n\n\n var _proto = Decrypter.prototype;\n /**\n * @private\n */\n\n _proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) {\n return function () {\n var bytes = decrypt(encrypted, key, initVector);\n decrypted.set(bytes, encrypted.byteOffset);\n };\n };\n\n createClass(Decrypter, null, [{\n key: \"STEP\",\n get: function get() {\n // 4 * 8000;\n return 32000;\n }\n }]);\n return Decrypter;\n }();\n\n var win;\n\n if (typeof window !== \"undefined\") {\n win = window;\n } else if (typeof commonjsGlobal !== \"undefined\") {\n win = commonjsGlobal;\n } else if (typeof self !== \"undefined\") {\n win = self;\n } else {\n win = {};\n }\n\n var window_1 = win;\n\n var isArrayBufferView = function isArrayBufferView(obj) {\n if (ArrayBuffer.isView === 'function') {\n return ArrayBuffer.isView(obj);\n }\n\n return obj && obj.buffer instanceof ArrayBuffer;\n };\n\n var BigInt = window_1.BigInt || Number;\n [BigInt('0x1'), BigInt('0x100'), BigInt('0x10000'), BigInt('0x1000000'), BigInt('0x100000000'), BigInt('0x10000000000'), BigInt('0x1000000000000'), BigInt('0x100000000000000'), BigInt('0x10000000000000000')];\n /**\n * Creates an object for sending to a web worker modifying properties that are TypedArrays\n * into a new object with seperated properties for the buffer, byteOffset, and byteLength.\n *\n * @param {Object} message\n * Object of properties and values to send to the web worker\n * @return {Object}\n * Modified message with TypedArray values expanded\n * @function createTransferableMessage\n */\n\n\n var createTransferableMessage = function createTransferableMessage(message) {\n var transferable = {};\n Object.keys(message).forEach(function (key) {\n var value = message[key];\n\n if (isArrayBufferView(value)) {\n transferable[key] = {\n bytes: value.buffer,\n byteOffset: value.byteOffset,\n byteLength: value.byteLength\n };\n } else {\n transferable[key] = value;\n }\n });\n return transferable;\n };\n /* global self */\n\n /**\n * Our web worker interface so that things can talk to aes-decrypter\n * that will be running in a web worker. the scope is passed to this by\n * webworkify.\n */\n\n\n self.onmessage = function (event) {\n var data = event.data;\n var encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength);\n var key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4);\n var iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4);\n /* eslint-disable no-new, handle-callback-err */\n\n new Decrypter(encrypted, key, iv, function (err, bytes) {\n self.postMessage(createTransferableMessage({\n source: data.source,\n decrypted: bytes\n }), [bytes.buffer]);\n });\n /* eslint-enable */\n };\n}));\nvar Decrypter = factory(workerCode);\n/* rollup-plugin-worker-factory end for worker!/Users/ddashkevich/projects/http-streaming/src/decrypter-worker.js */\n\n/**\n * Convert the properties of an HLS track into an audioTrackKind.\n *\n * @private\n */\n\nvar audioTrackKind_ = function audioTrackKind_(properties) {\n var kind = properties[\"default\"] ? 'main' : 'alternative';\n\n if (properties.characteristics && properties.characteristics.indexOf('public.accessibility.describes-video') >= 0) {\n kind = 'main-desc';\n }\n\n return kind;\n};\n/**\n * Pause provided segment loader and playlist loader if active\n *\n * @param {SegmentLoader} segmentLoader\n * SegmentLoader to pause\n * @param {Object} mediaType\n * Active media type\n * @function stopLoaders\n */\n\n\nvar stopLoaders = function stopLoaders(segmentLoader, mediaType) {\n segmentLoader.abort();\n segmentLoader.pause();\n\n if (mediaType && mediaType.activePlaylistLoader) {\n mediaType.activePlaylistLoader.pause();\n mediaType.activePlaylistLoader = null;\n }\n};\n/**\n * Start loading provided segment loader and playlist loader\n *\n * @param {PlaylistLoader} playlistLoader\n * PlaylistLoader to start loading\n * @param {Object} mediaType\n * Active media type\n * @function startLoaders\n */\n\n\nvar startLoaders = function startLoaders(playlistLoader, mediaType) {\n // Segment loader will be started after `loadedmetadata` or `loadedplaylist` from the\n // playlist loader\n mediaType.activePlaylistLoader = playlistLoader;\n playlistLoader.load();\n};\n/**\n * Returns a function to be called when the media group changes. It performs a\n * non-destructive (preserve the buffer) resync of the SegmentLoader. This is because a\n * change of group is merely a rendition switch of the same content at another encoding,\n * rather than a change of content, such as switching audio from English to Spanish.\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Handler for a non-destructive resync of SegmentLoader when the active media\n * group changes.\n * @function onGroupChanged\n */\n\n\nvar onGroupChanged = function onGroupChanged(type, settings) {\n return function () {\n var _settings$segmentLoad = settings.segmentLoaders,\n segmentLoader = _settings$segmentLoad[type],\n mainSegmentLoader = _settings$segmentLoad.main,\n mediaType = settings.mediaTypes[type];\n var activeTrack = mediaType.activeTrack();\n var activeGroup = mediaType.getActiveGroup();\n var previousActiveLoader = mediaType.activePlaylistLoader;\n var lastGroup = mediaType.lastGroup_; // the group did not change do nothing\n\n if (activeGroup && lastGroup && activeGroup.id === lastGroup.id) {\n return;\n }\n\n mediaType.lastGroup_ = activeGroup;\n mediaType.lastTrack_ = activeTrack;\n stopLoaders(segmentLoader, mediaType);\n\n if (!activeGroup || activeGroup.isMasterPlaylist) {\n // there is no group active or active group is a main playlist and won't change\n return;\n }\n\n if (!activeGroup.playlistLoader) {\n if (previousActiveLoader) {\n // The previous group had a playlist loader but the new active group does not\n // this means we are switching from demuxed to muxed audio. In this case we want to\n // do a destructive reset of the main segment loader and not restart the audio\n // loaders.\n mainSegmentLoader.resetEverything();\n }\n\n return;\n } // Non-destructive resync\n\n\n segmentLoader.resyncLoader();\n startLoaders(activeGroup.playlistLoader, mediaType);\n };\n};\n\nvar onGroupChanging = function onGroupChanging(type, settings) {\n return function () {\n var segmentLoader = settings.segmentLoaders[type],\n mediaType = settings.mediaTypes[type];\n mediaType.lastGroup_ = null;\n segmentLoader.abort();\n segmentLoader.pause();\n };\n};\n/**\n * Returns a function to be called when the media track changes. It performs a\n * destructive reset of the SegmentLoader to ensure we start loading as close to\n * currentTime as possible.\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Handler for a destructive reset of SegmentLoader when the active media\n * track changes.\n * @function onTrackChanged\n */\n\n\nvar onTrackChanged = function onTrackChanged(type, settings) {\n return function () {\n var masterPlaylistLoader = settings.masterPlaylistLoader,\n _settings$segmentLoad2 = settings.segmentLoaders,\n segmentLoader = _settings$segmentLoad2[type],\n mainSegmentLoader = _settings$segmentLoad2.main,\n mediaType = settings.mediaTypes[type];\n var activeTrack = mediaType.activeTrack();\n var activeGroup = mediaType.getActiveGroup();\n var previousActiveLoader = mediaType.activePlaylistLoader;\n var lastTrack = mediaType.lastTrack_; // track did not change, do nothing\n\n if (lastTrack && activeTrack && lastTrack.id === activeTrack.id) {\n return;\n }\n\n mediaType.lastGroup_ = activeGroup;\n mediaType.lastTrack_ = activeTrack;\n stopLoaders(segmentLoader, mediaType);\n\n if (!activeGroup) {\n // there is no group active so we do not want to restart loaders\n return;\n }\n\n if (activeGroup.isMasterPlaylist) {\n // track did not change, do nothing\n if (!activeTrack || !lastTrack || activeTrack.id === lastTrack.id) {\n return;\n }\n\n var mpc = settings.vhs.masterPlaylistController_;\n var newPlaylist = mpc.selectPlaylist(); // media will not change do nothing\n\n if (mpc.media() === newPlaylist) {\n return;\n }\n\n mediaType.logger_(\"track change. Switching master audio from \" + lastTrack.id + \" to \" + activeTrack.id);\n masterPlaylistLoader.pause();\n mainSegmentLoader.resetEverything();\n mpc.fastQualityChange_(newPlaylist);\n return;\n }\n\n if (type === 'AUDIO') {\n if (!activeGroup.playlistLoader) {\n // when switching from demuxed audio/video to muxed audio/video (noted by no\n // playlist loader for the audio group), we want to do a destructive reset of the\n // main segment loader and not restart the audio loaders\n mainSegmentLoader.setAudio(true); // don't have to worry about disabling the audio of the audio segment loader since\n // it should be stopped\n\n mainSegmentLoader.resetEverything();\n return;\n } // although the segment loader is an audio segment loader, call the setAudio\n // function to ensure it is prepared to re-append the init segment (or handle other\n // config changes)\n\n\n segmentLoader.setAudio(true);\n mainSegmentLoader.setAudio(false);\n }\n\n if (previousActiveLoader === activeGroup.playlistLoader) {\n // Nothing has actually changed. This can happen because track change events can fire\n // multiple times for a \"single\" change. One for enabling the new active track, and\n // one for disabling the track that was active\n startLoaders(activeGroup.playlistLoader, mediaType);\n return;\n }\n\n if (segmentLoader.track) {\n // For WebVTT, set the new text track in the segmentloader\n segmentLoader.track(activeTrack);\n } // destructive reset\n\n\n segmentLoader.resetEverything();\n startLoaders(activeGroup.playlistLoader, mediaType);\n };\n};\n\nvar onError = {\n /**\n * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters\n * an error.\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Error handler. Logs warning (or error if the playlist is blacklisted) to\n * console and switches back to default audio track.\n * @function onError.AUDIO\n */\n AUDIO: function AUDIO(type, settings) {\n return function () {\n var segmentLoader = settings.segmentLoaders[type],\n mediaType = settings.mediaTypes[type],\n blacklistCurrentPlaylist = settings.blacklistCurrentPlaylist;\n stopLoaders(segmentLoader, mediaType); // switch back to default audio track\n\n var activeTrack = mediaType.activeTrack();\n var activeGroup = mediaType.activeGroup();\n var id = (activeGroup.filter(function (group) {\n return group[\"default\"];\n })[0] || activeGroup[0]).id;\n var defaultTrack = mediaType.tracks[id];\n\n if (activeTrack === defaultTrack) {\n // Default track encountered an error. All we can do now is blacklist the current\n // rendition and hope another will switch audio groups\n blacklistCurrentPlaylist({\n message: 'Problem encountered loading the default audio track.'\n });\n return;\n }\n\n videojs.log.warn('Problem encountered loading the alternate audio track.' + 'Switching back to default.');\n\n for (var trackId in mediaType.tracks) {\n mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack;\n }\n\n mediaType.onTrackChanged();\n };\n },\n\n /**\n * Returns a function to be called when a SegmentLoader or PlaylistLoader encounters\n * an error.\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Error handler. Logs warning to console and disables the active subtitle track\n * @function onError.SUBTITLES\n */\n SUBTITLES: function SUBTITLES(type, settings) {\n return function () {\n var segmentLoader = settings.segmentLoaders[type],\n mediaType = settings.mediaTypes[type];\n videojs.log.warn('Problem encountered loading the subtitle track.' + 'Disabling subtitle track.');\n stopLoaders(segmentLoader, mediaType);\n var track = mediaType.activeTrack();\n\n if (track) {\n track.mode = 'disabled';\n }\n\n mediaType.onTrackChanged();\n };\n }\n};\nvar setupListeners = {\n /**\n * Setup event listeners for audio playlist loader\n *\n * @param {string} type\n * MediaGroup type\n * @param {PlaylistLoader|null} playlistLoader\n * PlaylistLoader to register listeners on\n * @param {Object} settings\n * Object containing required information for media groups\n * @function setupListeners.AUDIO\n */\n AUDIO: function AUDIO(type, playlistLoader, settings) {\n if (!playlistLoader) {\n // no playlist loader means audio will be muxed with the video\n return;\n }\n\n var tech = settings.tech,\n requestOptions = settings.requestOptions,\n segmentLoader = settings.segmentLoaders[type];\n playlistLoader.on('loadedmetadata', function () {\n var media = playlistLoader.media();\n segmentLoader.playlist(media, requestOptions); // if the video is already playing, or if this isn't a live video and preload\n // permits, start downloading segments\n\n if (!tech.paused() || media.endList && tech.preload() !== 'none') {\n segmentLoader.load();\n }\n });\n playlistLoader.on('loadedplaylist', function () {\n segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running\n\n if (!tech.paused()) {\n segmentLoader.load();\n }\n });\n playlistLoader.on('error', onError[type](type, settings));\n },\n\n /**\n * Setup event listeners for subtitle playlist loader\n *\n * @param {string} type\n * MediaGroup type\n * @param {PlaylistLoader|null} playlistLoader\n * PlaylistLoader to register listeners on\n * @param {Object} settings\n * Object containing required information for media groups\n * @function setupListeners.SUBTITLES\n */\n SUBTITLES: function SUBTITLES(type, playlistLoader, settings) {\n var tech = settings.tech,\n requestOptions = settings.requestOptions,\n segmentLoader = settings.segmentLoaders[type],\n mediaType = settings.mediaTypes[type];\n playlistLoader.on('loadedmetadata', function () {\n var media = playlistLoader.media();\n segmentLoader.playlist(media, requestOptions);\n segmentLoader.track(mediaType.activeTrack()); // if the video is already playing, or if this isn't a live video and preload\n // permits, start downloading segments\n\n if (!tech.paused() || media.endList && tech.preload() !== 'none') {\n segmentLoader.load();\n }\n });\n playlistLoader.on('loadedplaylist', function () {\n segmentLoader.playlist(playlistLoader.media(), requestOptions); // If the player isn't paused, ensure that the segment loader is running\n\n if (!tech.paused()) {\n segmentLoader.load();\n }\n });\n playlistLoader.on('error', onError[type](type, settings));\n }\n};\nvar initialize = {\n /**\n * Setup PlaylistLoaders and AudioTracks for the audio groups\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @function initialize.AUDIO\n */\n 'AUDIO': function AUDIO(type, settings) {\n var vhs = settings.vhs,\n sourceType = settings.sourceType,\n segmentLoader = settings.segmentLoaders[type],\n requestOptions = settings.requestOptions,\n mediaGroups = settings.master.mediaGroups,\n _settings$mediaTypes$ = settings.mediaTypes[type],\n groups = _settings$mediaTypes$.groups,\n tracks = _settings$mediaTypes$.tracks,\n logger_ = _settings$mediaTypes$.logger_,\n masterPlaylistLoader = settings.masterPlaylistLoader;\n var audioOnlyMaster = isAudioOnly(masterPlaylistLoader.master); // force a default if we have none\n\n if (!mediaGroups[type] || Object.keys(mediaGroups[type]).length === 0) {\n mediaGroups[type] = {\n main: {\n \"default\": {\n \"default\": true\n }\n }\n };\n\n if (audioOnlyMaster) {\n mediaGroups[type].main[\"default\"].playlists = masterPlaylistLoader.master.playlists;\n }\n }\n\n for (var groupId in mediaGroups[type]) {\n if (!groups[groupId]) {\n groups[groupId] = [];\n }\n\n for (var variantLabel in mediaGroups[type][groupId]) {\n var properties = mediaGroups[type][groupId][variantLabel];\n var playlistLoader = void 0;\n\n if (audioOnlyMaster) {\n logger_(\"AUDIO group '\" + groupId + \"' label '\" + variantLabel + \"' is a master playlist\");\n properties.isMasterPlaylist = true;\n playlistLoader = null; // if vhs-json was provided as the source, and the media playlist was resolved,\n // use the resolved media playlist object\n } else if (sourceType === 'vhs-json' && properties.playlists) {\n playlistLoader = new PlaylistLoader(properties.playlists[0], vhs, requestOptions);\n } else if (properties.resolvedUri) {\n playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions); // TODO: dash isn't the only type with properties.playlists\n // should we even have properties.playlists in this check.\n } else if (properties.playlists && sourceType === 'dash') {\n playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader);\n } else {\n // no resolvedUri means the audio is muxed with the video when using this\n // audio track\n playlistLoader = null;\n }\n\n properties = videojs.mergeOptions({\n id: variantLabel,\n playlistLoader: playlistLoader\n }, properties);\n setupListeners[type](type, properties.playlistLoader, settings);\n groups[groupId].push(properties);\n\n if (typeof tracks[variantLabel] === 'undefined') {\n var track = new videojs.AudioTrack({\n id: variantLabel,\n kind: audioTrackKind_(properties),\n enabled: false,\n language: properties.language,\n \"default\": properties[\"default\"],\n label: variantLabel\n });\n tracks[variantLabel] = track;\n }\n }\n } // setup single error event handler for the segment loader\n\n\n segmentLoader.on('error', onError[type](type, settings));\n },\n\n /**\n * Setup PlaylistLoaders and TextTracks for the subtitle groups\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @function initialize.SUBTITLES\n */\n 'SUBTITLES': function SUBTITLES(type, settings) {\n var tech = settings.tech,\n vhs = settings.vhs,\n sourceType = settings.sourceType,\n segmentLoader = settings.segmentLoaders[type],\n requestOptions = settings.requestOptions,\n mediaGroups = settings.master.mediaGroups,\n _settings$mediaTypes$2 = settings.mediaTypes[type],\n groups = _settings$mediaTypes$2.groups,\n tracks = _settings$mediaTypes$2.tracks,\n masterPlaylistLoader = settings.masterPlaylistLoader;\n\n for (var groupId in mediaGroups[type]) {\n if (!groups[groupId]) {\n groups[groupId] = [];\n }\n\n for (var variantLabel in mediaGroups[type][groupId]) {\n if (mediaGroups[type][groupId][variantLabel].forced) {\n // Subtitle playlists with the forced attribute are not selectable in Safari.\n // According to Apple's HLS Authoring Specification:\n // If content has forced subtitles and regular subtitles in a given language,\n // the regular subtitles track in that language MUST contain both the forced\n // subtitles and the regular subtitles for that language.\n // Because of this requirement and that Safari does not add forced subtitles,\n // forced subtitles are skipped here to maintain consistent experience across\n // all platforms\n continue;\n }\n\n var properties = mediaGroups[type][groupId][variantLabel];\n var playlistLoader = void 0;\n\n if (sourceType === 'hls') {\n playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions);\n } else if (sourceType === 'dash') {\n var playlists = properties.playlists.filter(function (p) {\n return p.excludeUntil !== Infinity;\n });\n\n if (!playlists.length) {\n return;\n }\n\n playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader);\n } else if (sourceType === 'vhs-json') {\n playlistLoader = new PlaylistLoader( // if the vhs-json object included the media playlist, use the media playlist\n // as provided, otherwise use the resolved URI to load the playlist\n properties.playlists ? properties.playlists[0] : properties.resolvedUri, vhs, requestOptions);\n }\n\n properties = videojs.mergeOptions({\n id: variantLabel,\n playlistLoader: playlistLoader\n }, properties);\n setupListeners[type](type, properties.playlistLoader, settings);\n groups[groupId].push(properties);\n\n if (typeof tracks[variantLabel] === 'undefined') {\n var track = tech.addRemoteTextTrack({\n id: variantLabel,\n kind: 'subtitles',\n \"default\": properties[\"default\"] && properties.autoselect,\n language: properties.language,\n label: variantLabel\n }, false).track;\n tracks[variantLabel] = track;\n }\n }\n } // setup single error event handler for the segment loader\n\n\n segmentLoader.on('error', onError[type](type, settings));\n },\n\n /**\n * Setup TextTracks for the closed-caption groups\n *\n * @param {String} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @function initialize['CLOSED-CAPTIONS']\n */\n 'CLOSED-CAPTIONS': function CLOSEDCAPTIONS(type, settings) {\n var tech = settings.tech,\n mediaGroups = settings.master.mediaGroups,\n _settings$mediaTypes$3 = settings.mediaTypes[type],\n groups = _settings$mediaTypes$3.groups,\n tracks = _settings$mediaTypes$3.tracks;\n\n for (var groupId in mediaGroups[type]) {\n if (!groups[groupId]) {\n groups[groupId] = [];\n }\n\n for (var variantLabel in mediaGroups[type][groupId]) {\n var properties = mediaGroups[type][groupId][variantLabel]; // Look for either 608 (CCn) or 708 (SERVICEn) caption services\n\n if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) {\n continue;\n }\n\n var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};\n var newProps = {\n label: variantLabel,\n language: properties.language,\n instreamId: properties.instreamId,\n \"default\": properties[\"default\"] && properties.autoselect\n };\n\n if (captionServices[newProps.instreamId]) {\n newProps = videojs.mergeOptions(newProps, captionServices[newProps.instreamId]);\n }\n\n if (newProps[\"default\"] === undefined) {\n delete newProps[\"default\"];\n } // No PlaylistLoader is required for Closed-Captions because the captions are\n // embedded within the video stream\n\n\n groups[groupId].push(videojs.mergeOptions({\n id: variantLabel\n }, properties));\n\n if (typeof tracks[variantLabel] === 'undefined') {\n var track = tech.addRemoteTextTrack({\n id: newProps.instreamId,\n kind: 'captions',\n \"default\": newProps[\"default\"],\n language: newProps.language,\n label: newProps.label\n }, false).track;\n tracks[variantLabel] = track;\n }\n }\n }\n }\n};\n\nvar groupMatch = function groupMatch(list, media) {\n for (var i = 0; i < list.length; i++) {\n if (playlistMatch(media, list[i])) {\n return true;\n }\n\n if (list[i].playlists && groupMatch(list[i].playlists, media)) {\n return true;\n }\n }\n\n return false;\n};\n/**\n * Returns a function used to get the active group of the provided type\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Function that returns the active media group for the provided type. Takes an\n * optional parameter {TextTrack} track. If no track is provided, a list of all\n * variants in the group, otherwise the variant corresponding to the provided\n * track is returned.\n * @function activeGroup\n */\n\n\nvar activeGroup = function activeGroup(type, settings) {\n return function (track) {\n var masterPlaylistLoader = settings.masterPlaylistLoader,\n groups = settings.mediaTypes[type].groups;\n var media = masterPlaylistLoader.media();\n\n if (!media) {\n return null;\n }\n\n var variants = null; // set to variants to main media active group\n\n if (media.attributes[type]) {\n variants = groups[media.attributes[type]];\n }\n\n var groupKeys = Object.keys(groups);\n\n if (!variants) {\n // find the masterPlaylistLoader media\n // that is in a media group if we are dealing\n // with audio only\n if (type === 'AUDIO' && groupKeys.length > 1 && isAudioOnly(settings.master)) {\n for (var i = 0; i < groupKeys.length; i++) {\n var groupPropertyList = groups[groupKeys[i]];\n\n if (groupMatch(groupPropertyList, media)) {\n variants = groupPropertyList;\n break;\n }\n } // use the main group if it exists\n\n } else if (groups.main) {\n variants = groups.main; // only one group, use that one\n } else if (groupKeys.length === 1) {\n variants = groups[groupKeys[0]];\n }\n }\n\n if (typeof track === 'undefined') {\n return variants;\n }\n\n if (track === null || !variants) {\n // An active track was specified so a corresponding group is expected. track === null\n // means no track is currently active so there is no corresponding group\n return null;\n }\n\n return variants.filter(function (props) {\n return props.id === track.id;\n })[0] || null;\n };\n};\n\nvar activeTrack = {\n /**\n * Returns a function used to get the active track of type provided\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Function that returns the active media track for the provided type. Returns\n * null if no track is active\n * @function activeTrack.AUDIO\n */\n AUDIO: function AUDIO(type, settings) {\n return function () {\n var tracks = settings.mediaTypes[type].tracks;\n\n for (var id in tracks) {\n if (tracks[id].enabled) {\n return tracks[id];\n }\n }\n\n return null;\n };\n },\n\n /**\n * Returns a function used to get the active track of type provided\n *\n * @param {string} type\n * MediaGroup type\n * @param {Object} settings\n * Object containing required information for media groups\n * @return {Function}\n * Function that returns the active media track for the provided type. Returns\n * null if no track is active\n * @function activeTrack.SUBTITLES\n */\n SUBTITLES: function SUBTITLES(type, settings) {\n return function () {\n var tracks = settings.mediaTypes[type].tracks;\n\n for (var id in tracks) {\n if (tracks[id].mode === 'showing' || tracks[id].mode === 'hidden') {\n return tracks[id];\n }\n }\n\n return null;\n };\n }\n};\n\nvar getActiveGroup = function getActiveGroup(type, _ref) {\n var mediaTypes = _ref.mediaTypes;\n return function () {\n var activeTrack_ = mediaTypes[type].activeTrack();\n\n if (!activeTrack_) {\n return null;\n }\n\n return mediaTypes[type].activeGroup(activeTrack_);\n };\n};\n/**\n * Setup PlaylistLoaders and Tracks for media groups (Audio, Subtitles,\n * Closed-Captions) specified in the master manifest.\n *\n * @param {Object} settings\n * Object containing required information for setting up the media groups\n * @param {Tech} settings.tech\n * The tech of the player\n * @param {Object} settings.requestOptions\n * XHR request options used by the segment loaders\n * @param {PlaylistLoader} settings.masterPlaylistLoader\n * PlaylistLoader for the master source\n * @param {VhsHandler} settings.vhs\n * VHS SourceHandler\n * @param {Object} settings.master\n * The parsed master manifest\n * @param {Object} settings.mediaTypes\n * Object to store the loaders, tracks, and utility methods for each media type\n * @param {Function} settings.blacklistCurrentPlaylist\n * Blacklists the current rendition and forces a rendition switch.\n * @function setupMediaGroups\n */\n\n\nvar setupMediaGroups = function setupMediaGroups(settings) {\n ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(function (type) {\n initialize[type](type, settings);\n });\n var mediaTypes = settings.mediaTypes,\n masterPlaylistLoader = settings.masterPlaylistLoader,\n tech = settings.tech,\n vhs = settings.vhs,\n _settings$segmentLoad3 = settings.segmentLoaders,\n audioSegmentLoader = _settings$segmentLoad3['AUDIO'],\n mainSegmentLoader = _settings$segmentLoad3.main; // setup active group and track getters and change event handlers\n\n ['AUDIO', 'SUBTITLES'].forEach(function (type) {\n mediaTypes[type].activeGroup = activeGroup(type, settings);\n mediaTypes[type].activeTrack = activeTrack[type](type, settings);\n mediaTypes[type].onGroupChanged = onGroupChanged(type, settings);\n mediaTypes[type].onGroupChanging = onGroupChanging(type, settings);\n mediaTypes[type].onTrackChanged = onTrackChanged(type, settings);\n mediaTypes[type].getActiveGroup = getActiveGroup(type, settings);\n }); // DO NOT enable the default subtitle or caption track.\n // DO enable the default audio track\n\n var audioGroup = mediaTypes.AUDIO.activeGroup();\n\n if (audioGroup) {\n var groupId = (audioGroup.filter(function (group) {\n return group[\"default\"];\n })[0] || audioGroup[0]).id;\n mediaTypes.AUDIO.tracks[groupId].enabled = true;\n mediaTypes.AUDIO.onGroupChanged();\n mediaTypes.AUDIO.onTrackChanged();\n var activeAudioGroup = mediaTypes.AUDIO.getActiveGroup(); // a similar check for handling setAudio on each loader is run again each time the\n // track is changed, but needs to be handled here since the track may not be considered\n // changed on the first call to onTrackChanged\n\n if (!activeAudioGroup.playlistLoader) {\n // either audio is muxed with video or the stream is audio only\n mainSegmentLoader.setAudio(true);\n } else {\n // audio is demuxed\n mainSegmentLoader.setAudio(false);\n audioSegmentLoader.setAudio(true);\n }\n }\n\n masterPlaylistLoader.on('mediachange', function () {\n ['AUDIO', 'SUBTITLES'].forEach(function (type) {\n return mediaTypes[type].onGroupChanged();\n });\n });\n masterPlaylistLoader.on('mediachanging', function () {\n ['AUDIO', 'SUBTITLES'].forEach(function (type) {\n return mediaTypes[type].onGroupChanging();\n });\n }); // custom audio track change event handler for usage event\n\n var onAudioTrackChanged = function onAudioTrackChanged() {\n mediaTypes.AUDIO.onTrackChanged();\n tech.trigger({\n type: 'usage',\n name: 'vhs-audio-change'\n });\n tech.trigger({\n type: 'usage',\n name: 'hls-audio-change'\n });\n };\n\n tech.audioTracks().addEventListener('change', onAudioTrackChanged);\n tech.remoteTextTracks().addEventListener('change', mediaTypes.SUBTITLES.onTrackChanged);\n vhs.on('dispose', function () {\n tech.audioTracks().removeEventListener('change', onAudioTrackChanged);\n tech.remoteTextTracks().removeEventListener('change', mediaTypes.SUBTITLES.onTrackChanged);\n }); // clear existing audio tracks and add the ones we just created\n\n tech.clearTracks('audio');\n\n for (var id in mediaTypes.AUDIO.tracks) {\n tech.audioTracks().addTrack(mediaTypes.AUDIO.tracks[id]);\n }\n};\n/**\n * Creates skeleton object used to store the loaders, tracks, and utility methods for each\n * media type\n *\n * @return {Object}\n * Object to store the loaders, tracks, and utility methods for each media type\n * @function createMediaTypes\n */\n\n\nvar createMediaTypes = function createMediaTypes() {\n var mediaTypes = {};\n ['AUDIO', 'SUBTITLES', 'CLOSED-CAPTIONS'].forEach(function (type) {\n mediaTypes[type] = {\n groups: {},\n tracks: {},\n activePlaylistLoader: null,\n activeGroup: noop,\n activeTrack: noop,\n getActiveGroup: noop,\n onGroupChanged: noop,\n onTrackChanged: noop,\n lastTrack_: null,\n logger_: logger(\"MediaGroups[\" + type + \"]\")\n };\n });\n return mediaTypes;\n};\n\nvar ABORT_EARLY_BLACKLIST_SECONDS = 60 * 2;\nvar Vhs$1; // SegmentLoader stats that need to have each loader's\n// values summed to calculate the final value\n\nvar loaderStats = ['mediaRequests', 'mediaRequestsAborted', 'mediaRequestsTimedout', 'mediaRequestsErrored', 'mediaTransferDuration', 'mediaBytesTransferred', 'mediaAppends'];\n\nvar sumLoaderStat = function sumLoaderStat(stat) {\n return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat];\n};\n\nvar shouldSwitchToMedia = function shouldSwitchToMedia(_ref) {\n var currentPlaylist = _ref.currentPlaylist,\n buffered = _ref.buffered,\n currentTime = _ref.currentTime,\n nextPlaylist = _ref.nextPlaylist,\n bufferLowWaterLine = _ref.bufferLowWaterLine,\n bufferHighWaterLine = _ref.bufferHighWaterLine,\n duration = _ref.duration,\n experimentalBufferBasedABR = _ref.experimentalBufferBasedABR,\n log = _ref.log; // we have no other playlist to switch to\n\n if (!nextPlaylist) {\n videojs.log.warn('We received no playlist to switch to. Please check your stream.');\n return false;\n }\n\n var sharedLogLine = \"allowing switch \" + (currentPlaylist && currentPlaylist.id || 'null') + \" -> \" + nextPlaylist.id;\n\n if (!currentPlaylist) {\n log(sharedLogLine + \" as current playlist is not set\");\n return true;\n } // no need to switch if playlist is the same\n\n\n if (nextPlaylist.id === currentPlaylist.id) {\n return false;\n } // determine if current time is in a buffered range.\n\n\n var isBuffered = Boolean(findRange(buffered, currentTime).length); // If the playlist is live, then we want to not take low water line into account.\n // This is because in LIVE, the player plays 3 segments from the end of the\n // playlist, and if `BUFFER_LOW_WATER_LINE` is greater than the duration availble\n // in those segments, a viewer will never experience a rendition upswitch.\n\n if (!currentPlaylist.endList) {\n // For LLHLS live streams, don't switch renditions before playback has started, as it almost\n // doubles the time to first playback.\n if (!isBuffered && typeof currentPlaylist.partTargetDuration === 'number') {\n log(\"not \" + sharedLogLine + \" as current playlist is live llhls, but currentTime isn't in buffered.\");\n return false;\n }\n\n log(sharedLogLine + \" as current playlist is live\");\n return true;\n }\n\n var forwardBuffer = timeAheadOf(buffered, currentTime);\n var maxBufferLowWaterLine = experimentalBufferBasedABR ? Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config.MAX_BUFFER_LOW_WATER_LINE; // For the same reason as LIVE, we ignore the low water line when the VOD\n // duration is below the max potential low water line\n\n if (duration < maxBufferLowWaterLine) {\n log(sharedLogLine + \" as duration < max low water line (\" + duration + \" < \" + maxBufferLowWaterLine + \")\");\n return true;\n }\n\n var nextBandwidth = nextPlaylist.attributes.BANDWIDTH;\n var currBandwidth = currentPlaylist.attributes.BANDWIDTH; // when switching down, if our buffer is lower than the high water line,\n // we can switch down\n\n if (nextBandwidth < currBandwidth && (!experimentalBufferBasedABR || forwardBuffer < bufferHighWaterLine)) {\n var logLine = sharedLogLine + \" as next bandwidth < current bandwidth (\" + nextBandwidth + \" < \" + currBandwidth + \")\";\n\n if (experimentalBufferBasedABR) {\n logLine += \" and forwardBuffer < bufferHighWaterLine (\" + forwardBuffer + \" < \" + bufferHighWaterLine + \")\";\n }\n\n log(logLine);\n return true;\n } // and if our buffer is higher than the low water line,\n // we can switch up\n\n\n if ((!experimentalBufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) {\n var _logLine = sharedLogLine + \" as forwardBuffer >= bufferLowWaterLine (\" + forwardBuffer + \" >= \" + bufferLowWaterLine + \")\";\n\n if (experimentalBufferBasedABR) {\n _logLine += \" and next bandwidth > current bandwidth (\" + nextBandwidth + \" > \" + currBandwidth + \")\";\n }\n\n log(_logLine);\n return true;\n }\n\n log(\"not \" + sharedLogLine + \" as no switching criteria met\");\n return false;\n};\n/**\n * the master playlist controller controller all interactons\n * between playlists and segmentloaders. At this time this mainly\n * involves a master playlist and a series of audio playlists\n * if they are available\n *\n * @class MasterPlaylistController\n * @extends videojs.EventTarget\n */\n\n\nvar MasterPlaylistController = /*#__PURE__*/function (_videojs$EventTarget) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(MasterPlaylistController, _videojs$EventTarget);\n\n function MasterPlaylistController(options) {\n var _this;\n\n _this = _videojs$EventTarget.call(this) || this;\n var src = options.src,\n handleManifestRedirects = options.handleManifestRedirects,\n withCredentials = options.withCredentials,\n tech = options.tech,\n bandwidth = options.bandwidth,\n externVhs = options.externVhs,\n useCueTags = options.useCueTags,\n blacklistDuration = options.blacklistDuration,\n enableLowInitialPlaylist = options.enableLowInitialPlaylist,\n sourceType = options.sourceType,\n cacheEncryptionKeys = options.cacheEncryptionKeys,\n experimentalBufferBasedABR = options.experimentalBufferBasedABR,\n experimentalLeastPixelDiffSelector = options.experimentalLeastPixelDiffSelector,\n captionServices = options.captionServices;\n\n if (!src) {\n throw new Error('A non-empty playlist URL or JSON manifest string is required');\n }\n\n var maxPlaylistRetries = options.maxPlaylistRetries;\n\n if (maxPlaylistRetries === null || typeof maxPlaylistRetries === 'undefined') {\n maxPlaylistRetries = Infinity;\n }\n\n Vhs$1 = externVhs;\n _this.experimentalBufferBasedABR = Boolean(experimentalBufferBasedABR);\n _this.experimentalLeastPixelDiffSelector = Boolean(experimentalLeastPixelDiffSelector);\n _this.withCredentials = withCredentials;\n _this.tech_ = tech;\n _this.vhs_ = tech.vhs;\n _this.sourceType_ = sourceType;\n _this.useCueTags_ = useCueTags;\n _this.blacklistDuration = blacklistDuration;\n _this.maxPlaylistRetries = maxPlaylistRetries;\n _this.enableLowInitialPlaylist = enableLowInitialPlaylist;\n\n if (_this.useCueTags_) {\n _this.cueTagsTrack_ = _this.tech_.addTextTrack('metadata', 'ad-cues');\n _this.cueTagsTrack_.inBandMetadataTrackDispatchType = '';\n }\n\n _this.requestOptions_ = {\n withCredentials: withCredentials,\n handleManifestRedirects: handleManifestRedirects,\n maxPlaylistRetries: maxPlaylistRetries,\n timeout: null\n };\n\n _this.on('error', _this.pauseLoading);\n\n _this.mediaTypes_ = createMediaTypes();\n _this.mediaSource = new (global_window__WEBPACK_IMPORTED_MODULE_0___default().MediaSource)();\n _this.handleDurationChange_ = _this.handleDurationChange_.bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this));\n _this.handleSourceOpen_ = _this.handleSourceOpen_.bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this));\n _this.handleSourceEnded_ = _this.handleSourceEnded_.bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this));\n\n _this.mediaSource.addEventListener('durationchange', _this.handleDurationChange_); // load the media source into the player\n\n\n _this.mediaSource.addEventListener('sourceopen', _this.handleSourceOpen_);\n\n _this.mediaSource.addEventListener('sourceended', _this.handleSourceEnded_); // we don't have to handle sourceclose since dispose will handle termination of\n // everything, and the MediaSource should not be detached without a proper disposal\n\n\n _this.seekable_ = videojs.createTimeRanges();\n _this.hasPlayed_ = false;\n _this.syncController_ = new SyncController(options);\n _this.segmentMetadataTrack_ = tech.addRemoteTextTrack({\n kind: 'metadata',\n label: 'segment-metadata'\n }, false).track;\n _this.decrypter_ = new Decrypter();\n _this.sourceUpdater_ = new SourceUpdater(_this.mediaSource);\n _this.inbandTextTracks_ = {};\n _this.timelineChangeController_ = new TimelineChangeController();\n var segmentLoaderSettings = {\n vhs: _this.vhs_,\n parse708captions: options.parse708captions,\n useDtsForTimestampOffset: options.useDtsForTimestampOffset,\n captionServices: captionServices,\n mediaSource: _this.mediaSource,\n currentTime: _this.tech_.currentTime.bind(_this.tech_),\n seekable: function seekable() {\n return _this.seekable();\n },\n seeking: function seeking() {\n return _this.tech_.seeking();\n },\n duration: function duration() {\n return _this.duration();\n },\n hasPlayed: function hasPlayed() {\n return _this.hasPlayed_;\n },\n goalBufferLength: function goalBufferLength() {\n return _this.goalBufferLength();\n },\n bandwidth: bandwidth,\n syncController: _this.syncController_,\n decrypter: _this.decrypter_,\n sourceType: _this.sourceType_,\n inbandTextTracks: _this.inbandTextTracks_,\n cacheEncryptionKeys: cacheEncryptionKeys,\n sourceUpdater: _this.sourceUpdater_,\n timelineChangeController: _this.timelineChangeController_,\n experimentalExactManifestTimings: options.experimentalExactManifestTimings\n }; // The source type check not only determines whether a special DASH playlist loader\n // should be used, but also covers the case where the provided src is a vhs-json\n // manifest object (instead of a URL). In the case of vhs-json, the default\n // PlaylistLoader should be used.\n\n _this.masterPlaylistLoader_ = _this.sourceType_ === 'dash' ? new DashPlaylistLoader(src, _this.vhs_, _this.requestOptions_) : new PlaylistLoader(src, _this.vhs_, _this.requestOptions_);\n\n _this.setupMasterPlaylistLoaderListeners_(); // setup segment loaders\n // combined audio/video or just video when alternate audio track is selected\n\n\n _this.mainSegmentLoader_ = new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {\n segmentMetadataTrack: _this.segmentMetadataTrack_,\n loaderType: 'main'\n }), options); // alternate audio track\n\n _this.audioSegmentLoader_ = new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {\n loaderType: 'audio'\n }), options);\n _this.subtitleSegmentLoader_ = new VTTSegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {\n loaderType: 'vtt',\n featuresNativeTextTracks: _this.tech_.featuresNativeTextTracks,\n loadVttJs: function loadVttJs() {\n return new Promise(function (resolve, reject) {\n function onLoad() {\n tech.off('vttjserror', onError);\n resolve();\n }\n\n function onError() {\n tech.off('vttjsloaded', onLoad);\n reject();\n }\n\n tech.one('vttjsloaded', onLoad);\n tech.one('vttjserror', onError); // safe to call multiple times, script will be loaded only once:\n\n tech.addWebVttScript_();\n });\n }\n }), options);\n\n _this.setupSegmentLoaderListeners_();\n\n if (_this.experimentalBufferBasedABR) {\n _this.masterPlaylistLoader_.one('loadedplaylist', function () {\n return _this.startABRTimer_();\n });\n\n _this.tech_.on('pause', function () {\n return _this.stopABRTimer_();\n });\n\n _this.tech_.on('play', function () {\n return _this.startABRTimer_();\n });\n } // Create SegmentLoader stat-getters\n // mediaRequests_\n // mediaRequestsAborted_\n // mediaRequestsTimedout_\n // mediaRequestsErrored_\n // mediaTransferDuration_\n // mediaBytesTransferred_\n // mediaAppends_\n\n\n loaderStats.forEach(function (stat) {\n _this[stat + '_'] = sumLoaderStat.bind((0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this), stat);\n });\n _this.logger_ = logger('MPC');\n _this.triggeredFmp4Usage = false;\n\n if (_this.tech_.preload() === 'none') {\n _this.loadOnPlay_ = function () {\n _this.loadOnPlay_ = null;\n\n _this.masterPlaylistLoader_.load();\n };\n\n _this.tech_.one('play', _this.loadOnPlay_);\n } else {\n _this.masterPlaylistLoader_.load();\n }\n\n _this.timeToLoadedData__ = -1;\n _this.mainAppendsToLoadedData__ = -1;\n _this.audioAppendsToLoadedData__ = -1;\n var event = _this.tech_.preload() === 'none' ? 'play' : 'loadstart'; // start the first frame timer on loadstart or play (for preload none)\n\n _this.tech_.one(event, function () {\n var timeToLoadedDataStart = Date.now();\n\n _this.tech_.one('loadeddata', function () {\n _this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart;\n _this.mainAppendsToLoadedData__ = _this.mainSegmentLoader_.mediaAppends;\n _this.audioAppendsToLoadedData__ = _this.audioSegmentLoader_.mediaAppends;\n });\n });\n\n return _this;\n }\n\n var _proto = MasterPlaylistController.prototype;\n\n _proto.mainAppendsToLoadedData_ = function mainAppendsToLoadedData_() {\n return this.mainAppendsToLoadedData__;\n };\n\n _proto.audioAppendsToLoadedData_ = function audioAppendsToLoadedData_() {\n return this.audioAppendsToLoadedData__;\n };\n\n _proto.appendsToLoadedData_ = function appendsToLoadedData_() {\n var main = this.mainAppendsToLoadedData_();\n var audio = this.audioAppendsToLoadedData_();\n\n if (main === -1 || audio === -1) {\n return -1;\n }\n\n return main + audio;\n };\n\n _proto.timeToLoadedData_ = function timeToLoadedData_() {\n return this.timeToLoadedData__;\n }\n /**\n * Run selectPlaylist and switch to the new playlist if we should\n *\n * @param {string} [reason=abr] a reason for why the ABR check is made\n * @private\n */\n ;\n\n _proto.checkABR_ = function checkABR_(reason) {\n if (reason === void 0) {\n reason = 'abr';\n }\n\n var nextPlaylist = this.selectPlaylist();\n\n if (nextPlaylist && this.shouldSwitchToMedia_(nextPlaylist)) {\n this.switchMedia_(nextPlaylist, reason);\n }\n };\n\n _proto.switchMedia_ = function switchMedia_(playlist, cause, delay) {\n var oldMedia = this.media();\n var oldId = oldMedia && (oldMedia.id || oldMedia.uri);\n var newId = playlist.id || playlist.uri;\n\n if (oldId && oldId !== newId) {\n this.logger_(\"switch media \" + oldId + \" -> \" + newId + \" from \" + cause);\n this.tech_.trigger({\n type: 'usage',\n name: \"vhs-rendition-change-\" + cause\n });\n }\n\n this.masterPlaylistLoader_.media(playlist, delay);\n }\n /**\n * Start a timer that periodically calls checkABR_\n *\n * @private\n */\n ;\n\n _proto.startABRTimer_ = function startABRTimer_() {\n var _this2 = this;\n\n this.stopABRTimer_();\n this.abrTimer_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setInterval(function () {\n return _this2.checkABR_();\n }, 250);\n }\n /**\n * Stop the timer that periodically calls checkABR_\n *\n * @private\n */\n ;\n\n _proto.stopABRTimer_ = function stopABRTimer_() {\n // if we're scrubbing, we don't need to pause.\n // This getter will be added to Video.js in version 7.11.\n if (this.tech_.scrubbing && this.tech_.scrubbing()) {\n return;\n }\n\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearInterval(this.abrTimer_);\n this.abrTimer_ = null;\n }\n /**\n * Get a list of playlists for the currently selected audio playlist\n *\n * @return {Array} the array of audio playlists\n */\n ;\n\n _proto.getAudioTrackPlaylists_ = function getAudioTrackPlaylists_() {\n var master = this.master();\n var defaultPlaylists = master && master.playlists || []; // if we don't have any audio groups then we can only\n // assume that the audio tracks are contained in masters\n // playlist array, use that or an empty array.\n\n if (!master || !master.mediaGroups || !master.mediaGroups.AUDIO) {\n return defaultPlaylists;\n }\n\n var AUDIO = master.mediaGroups.AUDIO;\n var groupKeys = Object.keys(AUDIO);\n var track; // get the current active track\n\n if (Object.keys(this.mediaTypes_.AUDIO.groups).length) {\n track = this.mediaTypes_.AUDIO.activeTrack(); // or get the default track from master if mediaTypes_ isn't setup yet\n } else {\n // default group is `main` or just the first group.\n var defaultGroup = AUDIO.main || groupKeys.length && AUDIO[groupKeys[0]];\n\n for (var label in defaultGroup) {\n if (defaultGroup[label][\"default\"]) {\n track = {\n label: label\n };\n break;\n }\n }\n } // no active track no playlists.\n\n\n if (!track) {\n return defaultPlaylists;\n }\n\n var playlists = []; // get all of the playlists that are possible for the\n // active track.\n\n for (var group in AUDIO) {\n if (AUDIO[group][track.label]) {\n var properties = AUDIO[group][track.label];\n\n if (properties.playlists && properties.playlists.length) {\n playlists.push.apply(playlists, properties.playlists);\n } else if (properties.uri) {\n playlists.push(properties);\n } else if (master.playlists.length) {\n // if an audio group does not have a uri\n // see if we have main playlists that use it as a group.\n // if we do then add those to the playlists list.\n for (var i = 0; i < master.playlists.length; i++) {\n var playlist = master.playlists[i];\n\n if (playlist.attributes && playlist.attributes.AUDIO && playlist.attributes.AUDIO === group) {\n playlists.push(playlist);\n }\n }\n }\n }\n }\n\n if (!playlists.length) {\n return defaultPlaylists;\n }\n\n return playlists;\n }\n /**\n * Register event handlers on the master playlist loader. A helper\n * function for construction time.\n *\n * @private\n */\n ;\n\n _proto.setupMasterPlaylistLoaderListeners_ = function setupMasterPlaylistLoaderListeners_() {\n var _this3 = this;\n\n this.masterPlaylistLoader_.on('loadedmetadata', function () {\n var media = _this3.masterPlaylistLoader_.media();\n\n var requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to\n // timeout the request.\n\n if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) {\n _this3.requestOptions_.timeout = 0;\n } else {\n _this3.requestOptions_.timeout = requestTimeout;\n } // if this isn't a live video and preload permits, start\n // downloading segments\n\n\n if (media.endList && _this3.tech_.preload() !== 'none') {\n _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_);\n\n _this3.mainSegmentLoader_.load();\n }\n\n setupMediaGroups({\n sourceType: _this3.sourceType_,\n segmentLoaders: {\n AUDIO: _this3.audioSegmentLoader_,\n SUBTITLES: _this3.subtitleSegmentLoader_,\n main: _this3.mainSegmentLoader_\n },\n tech: _this3.tech_,\n requestOptions: _this3.requestOptions_,\n masterPlaylistLoader: _this3.masterPlaylistLoader_,\n vhs: _this3.vhs_,\n master: _this3.master(),\n mediaTypes: _this3.mediaTypes_,\n blacklistCurrentPlaylist: _this3.blacklistCurrentPlaylist.bind(_this3)\n });\n\n _this3.triggerPresenceUsage_(_this3.master(), media);\n\n _this3.setupFirstPlay();\n\n if (!_this3.mediaTypes_.AUDIO.activePlaylistLoader || _this3.mediaTypes_.AUDIO.activePlaylistLoader.media()) {\n _this3.trigger('selectedinitialmedia');\n } else {\n // We must wait for the active audio playlist loader to\n // finish setting up before triggering this event so the\n // representations API and EME setup is correct\n _this3.mediaTypes_.AUDIO.activePlaylistLoader.one('loadedmetadata', function () {\n _this3.trigger('selectedinitialmedia');\n });\n }\n });\n this.masterPlaylistLoader_.on('loadedplaylist', function () {\n if (_this3.loadOnPlay_) {\n _this3.tech_.off('play', _this3.loadOnPlay_);\n }\n\n var updatedPlaylist = _this3.masterPlaylistLoader_.media();\n\n if (!updatedPlaylist) {\n // exclude any variants that are not supported by the browser before selecting\n // an initial media as the playlist selectors do not consider browser support\n _this3.excludeUnsupportedVariants_();\n\n var selectedMedia;\n\n if (_this3.enableLowInitialPlaylist) {\n selectedMedia = _this3.selectInitialPlaylist();\n }\n\n if (!selectedMedia) {\n selectedMedia = _this3.selectPlaylist();\n }\n\n if (!selectedMedia || !_this3.shouldSwitchToMedia_(selectedMedia)) {\n return;\n }\n\n _this3.initialMedia_ = selectedMedia;\n\n _this3.switchMedia_(_this3.initialMedia_, 'initial'); // Under the standard case where a source URL is provided, loadedplaylist will\n // fire again since the playlist will be requested. In the case of vhs-json\n // (where the manifest object is provided as the source), when the media\n // playlist's `segments` list is already available, a media playlist won't be\n // requested, and loadedplaylist won't fire again, so the playlist handler must be\n // called on its own here.\n\n\n var haveJsonSource = _this3.sourceType_ === 'vhs-json' && _this3.initialMedia_.segments;\n\n if (!haveJsonSource) {\n return;\n }\n\n updatedPlaylist = _this3.initialMedia_;\n }\n\n _this3.handleUpdatedMediaPlaylist(updatedPlaylist);\n });\n this.masterPlaylistLoader_.on('error', function () {\n _this3.blacklistCurrentPlaylist(_this3.masterPlaylistLoader_.error);\n });\n this.masterPlaylistLoader_.on('mediachanging', function () {\n _this3.mainSegmentLoader_.abort();\n\n _this3.mainSegmentLoader_.pause();\n });\n this.masterPlaylistLoader_.on('mediachange', function () {\n var media = _this3.masterPlaylistLoader_.media();\n\n var requestTimeout = media.targetDuration * 1.5 * 1000; // If we don't have any more available playlists, we don't want to\n // timeout the request.\n\n if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) {\n _this3.requestOptions_.timeout = 0;\n } else {\n _this3.requestOptions_.timeout = requestTimeout;\n }\n\n _this3.masterPlaylistLoader_.load(); // TODO: Create a new event on the PlaylistLoader that signals\n // that the segments have changed in some way and use that to\n // update the SegmentLoader instead of doing it twice here and\n // on `loadedplaylist`\n\n\n _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_);\n\n _this3.mainSegmentLoader_.load();\n\n _this3.tech_.trigger({\n type: 'mediachange',\n bubbles: true\n });\n });\n this.masterPlaylistLoader_.on('playlistunchanged', function () {\n var updatedPlaylist = _this3.masterPlaylistLoader_.media(); // ignore unchanged playlists that have already been\n // excluded for not-changing. We likely just have a really slowly updating\n // playlist.\n\n\n if (updatedPlaylist.lastExcludeReason_ === 'playlist-unchanged') {\n return;\n }\n\n var playlistOutdated = _this3.stuckAtPlaylistEnd_(updatedPlaylist);\n\n if (playlistOutdated) {\n // Playlist has stopped updating and we're stuck at its end. Try to\n // blacklist it and switch to another playlist in the hope that that\n // one is updating (and give the player a chance to re-adjust to the\n // safe live point).\n _this3.blacklistCurrentPlaylist({\n message: 'Playlist no longer updating.',\n reason: 'playlist-unchanged'\n }); // useful for monitoring QoS\n\n\n _this3.tech_.trigger('playliststuck');\n }\n });\n this.masterPlaylistLoader_.on('renditiondisabled', function () {\n _this3.tech_.trigger({\n type: 'usage',\n name: 'vhs-rendition-disabled'\n });\n\n _this3.tech_.trigger({\n type: 'usage',\n name: 'hls-rendition-disabled'\n });\n });\n this.masterPlaylistLoader_.on('renditionenabled', function () {\n _this3.tech_.trigger({\n type: 'usage',\n name: 'vhs-rendition-enabled'\n });\n\n _this3.tech_.trigger({\n type: 'usage',\n name: 'hls-rendition-enabled'\n });\n });\n }\n /**\n * Given an updated media playlist (whether it was loaded for the first time, or\n * refreshed for live playlists), update any relevant properties and state to reflect\n * changes in the media that should be accounted for (e.g., cues and duration).\n *\n * @param {Object} updatedPlaylist the updated media playlist object\n *\n * @private\n */\n ;\n\n _proto.handleUpdatedMediaPlaylist = function handleUpdatedMediaPlaylist(updatedPlaylist) {\n if (this.useCueTags_) {\n this.updateAdCues_(updatedPlaylist);\n } // TODO: Create a new event on the PlaylistLoader that signals\n // that the segments have changed in some way and use that to\n // update the SegmentLoader instead of doing it twice here and\n // on `mediachange`\n\n\n this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_);\n this.updateDuration(!updatedPlaylist.endList); // If the player isn't paused, ensure that the segment loader is running,\n // as it is possible that it was temporarily stopped while waiting for\n // a playlist (e.g., in case the playlist errored and we re-requested it).\n\n if (!this.tech_.paused()) {\n this.mainSegmentLoader_.load();\n\n if (this.audioSegmentLoader_) {\n this.audioSegmentLoader_.load();\n }\n }\n }\n /**\n * A helper function for triggerring presence usage events once per source\n *\n * @private\n */\n ;\n\n _proto.triggerPresenceUsage_ = function triggerPresenceUsage_(master, media) {\n var mediaGroups = master.mediaGroups || {};\n var defaultDemuxed = true;\n var audioGroupKeys = Object.keys(mediaGroups.AUDIO);\n\n for (var mediaGroup in mediaGroups.AUDIO) {\n for (var label in mediaGroups.AUDIO[mediaGroup]) {\n var properties = mediaGroups.AUDIO[mediaGroup][label];\n\n if (!properties.uri) {\n defaultDemuxed = false;\n }\n }\n }\n\n if (defaultDemuxed) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-demuxed'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-demuxed'\n });\n }\n\n if (Object.keys(mediaGroups.SUBTITLES).length) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-webvtt'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-webvtt'\n });\n }\n\n if (Vhs$1.Playlist.isAes(media)) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-aes'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-aes'\n });\n }\n\n if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-alternate-audio'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-alternate-audio'\n });\n }\n\n if (this.useCueTags_) {\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-playlist-cue-tags'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-playlist-cue-tags'\n });\n }\n };\n\n _proto.shouldSwitchToMedia_ = function shouldSwitchToMedia_(nextPlaylist) {\n var currentPlaylist = this.masterPlaylistLoader_.media() || this.masterPlaylistLoader_.pendingMedia_;\n var currentTime = this.tech_.currentTime();\n var bufferLowWaterLine = this.bufferLowWaterLine();\n var bufferHighWaterLine = this.bufferHighWaterLine();\n var buffered = this.tech_.buffered();\n return shouldSwitchToMedia({\n buffered: buffered,\n currentTime: currentTime,\n currentPlaylist: currentPlaylist,\n nextPlaylist: nextPlaylist,\n bufferLowWaterLine: bufferLowWaterLine,\n bufferHighWaterLine: bufferHighWaterLine,\n duration: this.duration(),\n experimentalBufferBasedABR: this.experimentalBufferBasedABR,\n log: this.logger_\n });\n }\n /**\n * Register event handlers on the segment loaders. A helper function\n * for construction time.\n *\n * @private\n */\n ;\n\n _proto.setupSegmentLoaderListeners_ = function setupSegmentLoaderListeners_() {\n var _this4 = this;\n\n this.mainSegmentLoader_.on('bandwidthupdate', function () {\n // Whether or not buffer based ABR or another ABR is used, on a bandwidth change it's\n // useful to check to see if a rendition switch should be made.\n _this4.checkABR_('bandwidthupdate');\n\n _this4.tech_.trigger('bandwidthupdate');\n });\n this.mainSegmentLoader_.on('timeout', function () {\n if (_this4.experimentalBufferBasedABR) {\n // If a rendition change is needed, then it would've be done on `bandwidthupdate`.\n // Here the only consideration is that for buffer based ABR there's no guarantee\n // of an immediate switch (since the bandwidth is averaged with a timeout\n // bandwidth value of 1), so force a load on the segment loader to keep it going.\n _this4.mainSegmentLoader_.load();\n }\n }); // `progress` events are not reliable enough of a bandwidth measure to trigger buffer\n // based ABR.\n\n if (!this.experimentalBufferBasedABR) {\n this.mainSegmentLoader_.on('progress', function () {\n _this4.trigger('progress');\n });\n }\n\n this.mainSegmentLoader_.on('error', function () {\n _this4.blacklistCurrentPlaylist(_this4.mainSegmentLoader_.error());\n });\n this.mainSegmentLoader_.on('appenderror', function () {\n _this4.error = _this4.mainSegmentLoader_.error_;\n\n _this4.trigger('error');\n });\n this.mainSegmentLoader_.on('syncinfoupdate', function () {\n _this4.onSyncInfoUpdate_();\n });\n this.mainSegmentLoader_.on('timestampoffset', function () {\n _this4.tech_.trigger({\n type: 'usage',\n name: 'vhs-timestamp-offset'\n });\n\n _this4.tech_.trigger({\n type: 'usage',\n name: 'hls-timestamp-offset'\n });\n });\n this.audioSegmentLoader_.on('syncinfoupdate', function () {\n _this4.onSyncInfoUpdate_();\n });\n this.audioSegmentLoader_.on('appenderror', function () {\n _this4.error = _this4.audioSegmentLoader_.error_;\n\n _this4.trigger('error');\n });\n this.mainSegmentLoader_.on('ended', function () {\n _this4.logger_('main segment loader ended');\n\n _this4.onEndOfStream();\n });\n this.mainSegmentLoader_.on('earlyabort', function (event) {\n // never try to early abort with the new ABR algorithm\n if (_this4.experimentalBufferBasedABR) {\n return;\n }\n\n _this4.delegateLoaders_('all', ['abort']);\n\n _this4.blacklistCurrentPlaylist({\n message: 'Aborted early because there isn\\'t enough bandwidth to complete the ' + 'request without rebuffering.'\n }, ABORT_EARLY_BLACKLIST_SECONDS);\n });\n\n var updateCodecs = function updateCodecs() {\n if (!_this4.sourceUpdater_.hasCreatedSourceBuffers()) {\n return _this4.tryToCreateSourceBuffers_();\n }\n\n var codecs = _this4.getCodecsOrExclude_(); // no codecs means that the playlist was excluded\n\n\n if (!codecs) {\n return;\n }\n\n _this4.sourceUpdater_.addOrChangeSourceBuffers(codecs);\n };\n\n this.mainSegmentLoader_.on('trackinfo', updateCodecs);\n this.audioSegmentLoader_.on('trackinfo', updateCodecs);\n this.mainSegmentLoader_.on('fmp4', function () {\n if (!_this4.triggeredFmp4Usage) {\n _this4.tech_.trigger({\n type: 'usage',\n name: 'vhs-fmp4'\n });\n\n _this4.tech_.trigger({\n type: 'usage',\n name: 'hls-fmp4'\n });\n\n _this4.triggeredFmp4Usage = true;\n }\n });\n this.audioSegmentLoader_.on('fmp4', function () {\n if (!_this4.triggeredFmp4Usage) {\n _this4.tech_.trigger({\n type: 'usage',\n name: 'vhs-fmp4'\n });\n\n _this4.tech_.trigger({\n type: 'usage',\n name: 'hls-fmp4'\n });\n\n _this4.triggeredFmp4Usage = true;\n }\n });\n this.audioSegmentLoader_.on('ended', function () {\n _this4.logger_('audioSegmentLoader ended');\n\n _this4.onEndOfStream();\n });\n };\n\n _proto.mediaSecondsLoaded_ = function mediaSecondsLoaded_() {\n return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded);\n }\n /**\n * Call load on our SegmentLoaders\n */\n ;\n\n _proto.load = function load() {\n this.mainSegmentLoader_.load();\n\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n this.audioSegmentLoader_.load();\n }\n\n if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {\n this.subtitleSegmentLoader_.load();\n }\n }\n /**\n * Re-tune playback quality level for the current player\n * conditions without performing destructive actions, like\n * removing already buffered content\n *\n * @private\n * @deprecated\n */\n ;\n\n _proto.smoothQualityChange_ = function smoothQualityChange_(media) {\n if (media === void 0) {\n media = this.selectPlaylist();\n }\n\n this.fastQualityChange_(media);\n }\n /**\n * Re-tune playback quality level for the current player\n * conditions. This method will perform destructive actions like removing\n * already buffered content in order to readjust the currently active\n * playlist quickly. This is good for manual quality changes\n *\n * @private\n */\n ;\n\n _proto.fastQualityChange_ = function fastQualityChange_(media) {\n var _this5 = this;\n\n if (media === void 0) {\n media = this.selectPlaylist();\n }\n\n if (media === this.masterPlaylistLoader_.media()) {\n this.logger_('skipping fastQualityChange because new media is same as old');\n return;\n }\n\n this.switchMedia_(media, 'fast-quality'); // Delete all buffered data to allow an immediate quality switch, then seek to give\n // the browser a kick to remove any cached frames from the previous rendtion (.04 seconds\n // ahead is roughly the minimum that will accomplish this across a variety of content\n // in IE and Edge, but seeking in place is sufficient on all other browsers)\n // Edge/IE bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/14600375/\n // Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=651904\n\n this.mainSegmentLoader_.resetEverything(function () {\n // Since this is not a typical seek, we avoid the seekTo method which can cause segments\n // from the previously enabled rendition to load before the new playlist has finished loading\n if (videojs.browser.IE_VERSION || videojs.browser.IS_EDGE) {\n _this5.tech_.setCurrentTime(_this5.tech_.currentTime() + 0.04);\n } else {\n _this5.tech_.setCurrentTime(_this5.tech_.currentTime());\n }\n }); // don't need to reset audio as it is reset when media changes\n }\n /**\n * Begin playback.\n */\n ;\n\n _proto.play = function play() {\n if (this.setupFirstPlay()) {\n return;\n }\n\n if (this.tech_.ended()) {\n this.tech_.setCurrentTime(0);\n }\n\n if (this.hasPlayed_) {\n this.load();\n }\n\n var seekable = this.tech_.seekable(); // if the viewer has paused and we fell out of the live window,\n // seek forward to the live point\n\n if (this.tech_.duration() === Infinity) {\n if (this.tech_.currentTime() < seekable.start(0)) {\n return this.tech_.setCurrentTime(seekable.end(seekable.length - 1));\n }\n }\n }\n /**\n * Seek to the latest media position if this is a live video and the\n * player and video are loaded and initialized.\n */\n ;\n\n _proto.setupFirstPlay = function setupFirstPlay() {\n var _this6 = this;\n\n var media = this.masterPlaylistLoader_.media(); // Check that everything is ready to begin buffering for the first call to play\n // If 1) there is no active media\n // 2) the player is paused\n // 3) the first play has already been setup\n // then exit early\n\n if (!media || this.tech_.paused() || this.hasPlayed_) {\n return false;\n } // when the video is a live stream\n\n\n if (!media.endList) {\n var seekable = this.seekable();\n\n if (!seekable.length) {\n // without a seekable range, the player cannot seek to begin buffering at the live\n // point\n return false;\n }\n\n if (videojs.browser.IE_VERSION && this.tech_.readyState() === 0) {\n // IE11 throws an InvalidStateError if you try to set currentTime while the\n // readyState is 0, so it must be delayed until the tech fires loadedmetadata.\n this.tech_.one('loadedmetadata', function () {\n _this6.trigger('firstplay');\n\n _this6.tech_.setCurrentTime(seekable.end(0));\n\n _this6.hasPlayed_ = true;\n });\n return false;\n } // trigger firstplay to inform the source handler to ignore the next seek event\n\n\n this.trigger('firstplay'); // seek to the live point\n\n this.tech_.setCurrentTime(seekable.end(0));\n }\n\n this.hasPlayed_ = true; // we can begin loading now that everything is ready\n\n this.load();\n return true;\n }\n /**\n * handle the sourceopen event on the MediaSource\n *\n * @private\n */\n ;\n\n _proto.handleSourceOpen_ = function handleSourceOpen_() {\n // Only attempt to create the source buffer if none already exist.\n // handleSourceOpen is also called when we are \"re-opening\" a source buffer\n // after `endOfStream` has been called (in response to a seek for instance)\n this.tryToCreateSourceBuffers_(); // if autoplay is enabled, begin playback. This is duplicative of\n // code in video.js but is required because play() must be invoked\n // *after* the media source has opened.\n\n if (this.tech_.autoplay()) {\n var playPromise = this.tech_.play(); // Catch/silence error when a pause interrupts a play request\n // on browsers which return a promise\n\n if (typeof playPromise !== 'undefined' && typeof playPromise.then === 'function') {\n playPromise.then(null, function (e) {});\n }\n }\n\n this.trigger('sourceopen');\n }\n /**\n * handle the sourceended event on the MediaSource\n *\n * @private\n */\n ;\n\n _proto.handleSourceEnded_ = function handleSourceEnded_() {\n if (!this.inbandTextTracks_.metadataTrack_) {\n return;\n }\n\n var cues = this.inbandTextTracks_.metadataTrack_.cues;\n\n if (!cues || !cues.length) {\n return;\n }\n\n var duration = this.duration();\n cues[cues.length - 1].endTime = isNaN(duration) || Math.abs(duration) === Infinity ? Number.MAX_VALUE : duration;\n }\n /**\n * handle the durationchange event on the MediaSource\n *\n * @private\n */\n ;\n\n _proto.handleDurationChange_ = function handleDurationChange_() {\n this.tech_.trigger('durationchange');\n }\n /**\n * Calls endOfStream on the media source when all active stream types have called\n * endOfStream\n *\n * @param {string} streamType\n * Stream type of the segment loader that called endOfStream\n * @private\n */\n ;\n\n _proto.onEndOfStream = function onEndOfStream() {\n var isEndOfStream = this.mainSegmentLoader_.ended_;\n\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n var mainMediaInfo = this.mainSegmentLoader_.getCurrentMediaInfo_(); // if the audio playlist loader exists, then alternate audio is active\n\n if (!mainMediaInfo || mainMediaInfo.hasVideo) {\n // if we do not know if the main segment loader contains video yet or if we\n // definitively know the main segment loader contains video, then we need to wait\n // for both main and audio segment loaders to call endOfStream\n isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_;\n } else {\n // otherwise just rely on the audio loader\n isEndOfStream = this.audioSegmentLoader_.ended_;\n }\n }\n\n if (!isEndOfStream) {\n return;\n }\n\n this.stopABRTimer_();\n this.sourceUpdater_.endOfStream();\n }\n /**\n * Check if a playlist has stopped being updated\n *\n * @param {Object} playlist the media playlist object\n * @return {boolean} whether the playlist has stopped being updated or not\n */\n ;\n\n _proto.stuckAtPlaylistEnd_ = function stuckAtPlaylistEnd_(playlist) {\n var seekable = this.seekable();\n\n if (!seekable.length) {\n // playlist doesn't have enough information to determine whether we are stuck\n return false;\n }\n\n var expired = this.syncController_.getExpiredTime(playlist, this.duration());\n\n if (expired === null) {\n return false;\n } // does not use the safe live end to calculate playlist end, since we\n // don't want to say we are stuck while there is still content\n\n\n var absolutePlaylistEnd = Vhs$1.Playlist.playlistEnd(playlist, expired);\n var currentTime = this.tech_.currentTime();\n var buffered = this.tech_.buffered();\n\n if (!buffered.length) {\n // return true if the playhead reached the absolute end of the playlist\n return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA;\n }\n\n var bufferedEnd = buffered.end(buffered.length - 1); // return true if there is too little buffer left and buffer has reached absolute\n // end of playlist\n\n return bufferedEnd - currentTime <= SAFE_TIME_DELTA && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA;\n }\n /**\n * Blacklists a playlist when an error occurs for a set amount of time\n * making it unavailable for selection by the rendition selection algorithm\n * and then forces a new playlist (rendition) selection.\n *\n * @param {Object=} error an optional error that may include the playlist\n * to blacklist\n * @param {number=} blacklistDuration an optional number of seconds to blacklist the\n * playlist\n */\n ;\n\n _proto.blacklistCurrentPlaylist = function blacklistCurrentPlaylist(error, blacklistDuration) {\n if (error === void 0) {\n error = {};\n } // If the `error` was generated by the playlist loader, it will contain\n // the playlist we were trying to load (but failed) and that should be\n // blacklisted instead of the currently selected playlist which is likely\n // out-of-date in this scenario\n\n\n var currentPlaylist = error.playlist || this.masterPlaylistLoader_.media();\n blacklistDuration = blacklistDuration || error.blacklistDuration || this.blacklistDuration; // If there is no current playlist, then an error occurred while we were\n // trying to load the master OR while we were disposing of the tech\n\n if (!currentPlaylist) {\n this.error = error;\n\n if (this.mediaSource.readyState !== 'open') {\n this.trigger('error');\n } else {\n this.sourceUpdater_.endOfStream('network');\n }\n\n return;\n }\n\n currentPlaylist.playlistErrors_++;\n var playlists = this.masterPlaylistLoader_.master.playlists;\n var enabledPlaylists = playlists.filter(isEnabled);\n var isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === currentPlaylist; // Don't blacklist the only playlist unless it was blacklisted\n // forever\n\n if (playlists.length === 1 && blacklistDuration !== Infinity) {\n videojs.log.warn(\"Problem encountered with playlist \" + currentPlaylist.id + \". \" + 'Trying again since it is the only playlist.');\n this.tech_.trigger('retryplaylist'); // if this is a final rendition, we should delay\n\n return this.masterPlaylistLoader_.load(isFinalRendition);\n }\n\n if (isFinalRendition) {\n // Since we're on the final non-blacklisted playlist, and we're about to blacklist\n // it, instead of erring the player or retrying this playlist, clear out the current\n // blacklist. This allows other playlists to be attempted in case any have been\n // fixed.\n var reincluded = false;\n playlists.forEach(function (playlist) {\n // skip current playlist which is about to be blacklisted\n if (playlist === currentPlaylist) {\n return;\n }\n\n var excludeUntil = playlist.excludeUntil; // a playlist cannot be reincluded if it wasn't excluded to begin with.\n\n if (typeof excludeUntil !== 'undefined' && excludeUntil !== Infinity) {\n reincluded = true;\n delete playlist.excludeUntil;\n }\n });\n\n if (reincluded) {\n videojs.log.warn('Removing other playlists from the exclusion list because the last ' + 'rendition is about to be excluded.'); // Technically we are retrying a playlist, in that we are simply retrying a previous\n // playlist. This is needed for users relying on the retryplaylist event to catch a\n // case where the player might be stuck and looping through \"dead\" playlists.\n\n this.tech_.trigger('retryplaylist');\n }\n } // Blacklist this playlist\n\n\n var excludeUntil;\n\n if (currentPlaylist.playlistErrors_ > this.maxPlaylistRetries) {\n excludeUntil = Infinity;\n } else {\n excludeUntil = Date.now() + blacklistDuration * 1000;\n }\n\n currentPlaylist.excludeUntil = excludeUntil;\n\n if (error.reason) {\n currentPlaylist.lastExcludeReason_ = error.reason;\n }\n\n this.tech_.trigger('blacklistplaylist');\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-rendition-blacklisted'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-rendition-blacklisted'\n }); // TODO: should we select a new playlist if this blacklist wasn't for the currentPlaylist?\n // Would be something like media().id !=== currentPlaylist.id and we would need something\n // like `pendingMedia` in playlist loaders to check against that too. This will prevent us\n // from loading a new playlist on any blacklist.\n // Select a new playlist\n\n var nextPlaylist = this.selectPlaylist();\n\n if (!nextPlaylist) {\n this.error = 'Playback cannot continue. No available working or supported playlists.';\n this.trigger('error');\n return;\n }\n\n var logFn = error.internal ? this.logger_ : videojs.log.warn;\n var errorMessage = error.message ? ' ' + error.message : '';\n logFn((error.internal ? 'Internal problem' : 'Problem') + \" encountered with playlist \" + currentPlaylist.id + \".\" + (errorMessage + \" Switching to playlist \" + nextPlaylist.id + \".\")); // if audio group changed reset audio loaders\n\n if (nextPlaylist.attributes.AUDIO !== currentPlaylist.attributes.AUDIO) {\n this.delegateLoaders_('audio', ['abort', 'pause']);\n } // if subtitle group changed reset subtitle loaders\n\n\n if (nextPlaylist.attributes.SUBTITLES !== currentPlaylist.attributes.SUBTITLES) {\n this.delegateLoaders_('subtitle', ['abort', 'pause']);\n }\n\n this.delegateLoaders_('main', ['abort', 'pause']);\n var delayDuration = nextPlaylist.targetDuration / 2 * 1000 || 5 * 1000;\n var shouldDelay = typeof nextPlaylist.lastRequest === 'number' && Date.now() - nextPlaylist.lastRequest <= delayDuration; // delay if it's a final rendition or if the last refresh is sooner than half targetDuration\n\n return this.switchMedia_(nextPlaylist, 'exclude', isFinalRendition || shouldDelay);\n }\n /**\n * Pause all segment/playlist loaders\n */\n ;\n\n _proto.pauseLoading = function pauseLoading() {\n this.delegateLoaders_('all', ['abort', 'pause']);\n this.stopABRTimer_();\n }\n /**\n * Call a set of functions in order on playlist loaders, segment loaders,\n * or both types of loaders.\n *\n * @param {string} filter\n * Filter loaders that should call fnNames using a string. Can be:\n * * all - run on all loaders\n * * audio - run on all audio loaders\n * * subtitle - run on all subtitle loaders\n * * main - run on the main/master loaders\n *\n * @param {Array|string} fnNames\n * A string or array of function names to call.\n */\n ;\n\n _proto.delegateLoaders_ = function delegateLoaders_(filter, fnNames) {\n var _this7 = this;\n\n var loaders = [];\n var dontFilterPlaylist = filter === 'all';\n\n if (dontFilterPlaylist || filter === 'main') {\n loaders.push(this.masterPlaylistLoader_);\n }\n\n var mediaTypes = [];\n\n if (dontFilterPlaylist || filter === 'audio') {\n mediaTypes.push('AUDIO');\n }\n\n if (dontFilterPlaylist || filter === 'subtitle') {\n mediaTypes.push('CLOSED-CAPTIONS');\n mediaTypes.push('SUBTITLES');\n }\n\n mediaTypes.forEach(function (mediaType) {\n var loader = _this7.mediaTypes_[mediaType] && _this7.mediaTypes_[mediaType].activePlaylistLoader;\n\n if (loader) {\n loaders.push(loader);\n }\n });\n ['main', 'audio', 'subtitle'].forEach(function (name) {\n var loader = _this7[name + \"SegmentLoader_\"];\n\n if (loader && (filter === name || filter === 'all')) {\n loaders.push(loader);\n }\n });\n loaders.forEach(function (loader) {\n return fnNames.forEach(function (fnName) {\n if (typeof loader[fnName] === 'function') {\n loader[fnName]();\n }\n });\n });\n }\n /**\n * set the current time on all segment loaders\n *\n * @param {TimeRange} currentTime the current time to set\n * @return {TimeRange} the current time\n */\n ;\n\n _proto.setCurrentTime = function setCurrentTime(currentTime) {\n var buffered = findRange(this.tech_.buffered(), currentTime);\n\n if (!(this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media())) {\n // return immediately if the metadata is not ready yet\n return 0;\n } // it's clearly an edge-case but don't thrown an error if asked to\n // seek within an empty playlist\n\n\n if (!this.masterPlaylistLoader_.media().segments) {\n return 0;\n } // if the seek location is already buffered, continue buffering as usual\n\n\n if (buffered && buffered.length) {\n return currentTime;\n } // cancel outstanding requests so we begin buffering at the new\n // location\n\n\n this.mainSegmentLoader_.resetEverything();\n this.mainSegmentLoader_.abort();\n\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n this.audioSegmentLoader_.resetEverything();\n this.audioSegmentLoader_.abort();\n }\n\n if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {\n this.subtitleSegmentLoader_.resetEverything();\n this.subtitleSegmentLoader_.abort();\n } // start segment loader loading in case they are paused\n\n\n this.load();\n }\n /**\n * get the current duration\n *\n * @return {TimeRange} the duration\n */\n ;\n\n _proto.duration = function duration() {\n if (!this.masterPlaylistLoader_) {\n return 0;\n }\n\n var media = this.masterPlaylistLoader_.media();\n\n if (!media) {\n // no playlists loaded yet, so can't determine a duration\n return 0;\n } // Don't rely on the media source for duration in the case of a live playlist since\n // setting the native MediaSource's duration to infinity ends up with consequences to\n // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details.\n //\n // This is resolved in the spec by https://github.com/w3c/media-source/pull/92,\n // however, few browsers have support for setLiveSeekableRange()\n // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange\n //\n // Until a time when the duration of the media source can be set to infinity, and a\n // seekable range specified across browsers, just return Infinity.\n\n\n if (!media.endList) {\n return Infinity;\n } // Since this is a VOD video, it is safe to rely on the media source's duration (if\n // available). If it's not available, fall back to a playlist-calculated estimate.\n\n\n if (this.mediaSource) {\n return this.mediaSource.duration;\n }\n\n return Vhs$1.Playlist.duration(media);\n }\n /**\n * check the seekable range\n *\n * @return {TimeRange} the seekable range\n */\n ;\n\n _proto.seekable = function seekable() {\n return this.seekable_;\n };\n\n _proto.onSyncInfoUpdate_ = function onSyncInfoUpdate_() {\n var audioSeekable; // TODO check for creation of both source buffers before updating seekable\n //\n // A fix was made to this function where a check for\n // this.sourceUpdater_.hasCreatedSourceBuffers\n // was added to ensure that both source buffers were created before seekable was\n // updated. However, it originally had a bug where it was checking for a true and\n // returning early instead of checking for false. Setting it to check for false to\n // return early though created other issues. A call to play() would check for seekable\n // end without verifying that a seekable range was present. In addition, even checking\n // for that didn't solve some issues, as handleFirstPlay is sometimes worked around\n // due to a media update calling load on the segment loaders, skipping a seek to live,\n // thereby starting live streams at the beginning of the stream rather than at the end.\n //\n // This conditional should be fixed to wait for the creation of two source buffers at\n // the same time as the other sections of code are fixed to properly seek to live and\n // not throw an error due to checking for a seekable end when no seekable range exists.\n //\n // For now, fall back to the older behavior, with the understanding that the seekable\n // range may not be completely correct, leading to a suboptimal initial live point.\n\n if (!this.masterPlaylistLoader_) {\n return;\n }\n\n var media = this.masterPlaylistLoader_.media();\n\n if (!media) {\n return;\n }\n\n var expired = this.syncController_.getExpiredTime(media, this.duration());\n\n if (expired === null) {\n // not enough information to update seekable\n return;\n }\n\n var master = this.masterPlaylistLoader_.master;\n var mainSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media));\n\n if (mainSeekable.length === 0) {\n return;\n }\n\n if (this.mediaTypes_.AUDIO.activePlaylistLoader) {\n media = this.mediaTypes_.AUDIO.activePlaylistLoader.media();\n expired = this.syncController_.getExpiredTime(media, this.duration());\n\n if (expired === null) {\n return;\n }\n\n audioSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media));\n\n if (audioSeekable.length === 0) {\n return;\n }\n }\n\n var oldEnd;\n var oldStart;\n\n if (this.seekable_ && this.seekable_.length) {\n oldEnd = this.seekable_.end(0);\n oldStart = this.seekable_.start(0);\n }\n\n if (!audioSeekable) {\n // seekable has been calculated based on buffering video data so it\n // can be returned directly\n this.seekable_ = mainSeekable;\n } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) {\n // seekables are pretty far off, rely on main\n this.seekable_ = mainSeekable;\n } else {\n this.seekable_ = videojs.createTimeRanges([[audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0)]]);\n } // seekable is the same as last time\n\n\n if (this.seekable_ && this.seekable_.length) {\n if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) {\n return;\n }\n }\n\n this.logger_(\"seekable updated [\" + printableRange(this.seekable_) + \"]\");\n this.tech_.trigger('seekablechanged');\n }\n /**\n * Update the player duration\n */\n ;\n\n _proto.updateDuration = function updateDuration(isLive) {\n if (this.updateDuration_) {\n this.mediaSource.removeEventListener('sourceopen', this.updateDuration_);\n this.updateDuration_ = null;\n }\n\n if (this.mediaSource.readyState !== 'open') {\n this.updateDuration_ = this.updateDuration.bind(this, isLive);\n this.mediaSource.addEventListener('sourceopen', this.updateDuration_);\n return;\n }\n\n if (isLive) {\n var seekable = this.seekable();\n\n if (!seekable.length) {\n return;\n } // Even in the case of a live playlist, the native MediaSource's duration should not\n // be set to Infinity (even though this would be expected for a live playlist), since\n // setting the native MediaSource's duration to infinity ends up with consequences to\n // seekable behavior. See https://github.com/w3c/media-source/issues/5 for details.\n //\n // This is resolved in the spec by https://github.com/w3c/media-source/pull/92,\n // however, few browsers have support for setLiveSeekableRange()\n // https://developer.mozilla.org/en-US/docs/Web/API/MediaSource/setLiveSeekableRange\n //\n // Until a time when the duration of the media source can be set to infinity, and a\n // seekable range specified across browsers, the duration should be greater than or\n // equal to the last possible seekable value.\n // MediaSource duration starts as NaN\n // It is possible (and probable) that this case will never be reached for many\n // sources, since the MediaSource reports duration as the highest value without\n // accounting for timestamp offset. For example, if the timestamp offset is -100 and\n // we buffered times 0 to 100 with real times of 100 to 200, even though current\n // time will be between 0 and 100, the native media source may report the duration\n // as 200. However, since we report duration separate from the media source (as\n // Infinity), and as long as the native media source duration value is greater than\n // our reported seekable range, seeks will work as expected. The large number as\n // duration for live is actually a strategy used by some players to work around the\n // issue of live seekable ranges cited above.\n\n\n if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable.end(seekable.length - 1)) {\n this.sourceUpdater_.setDuration(seekable.end(seekable.length - 1));\n }\n\n return;\n }\n\n var buffered = this.tech_.buffered();\n var duration = Vhs$1.Playlist.duration(this.masterPlaylistLoader_.media());\n\n if (buffered.length > 0) {\n duration = Math.max(duration, buffered.end(buffered.length - 1));\n }\n\n if (this.mediaSource.duration !== duration) {\n this.sourceUpdater_.setDuration(duration);\n }\n }\n /**\n * dispose of the MasterPlaylistController and everything\n * that it controls\n */\n ;\n\n _proto.dispose = function dispose() {\n var _this8 = this;\n\n this.trigger('dispose');\n this.decrypter_.terminate();\n this.masterPlaylistLoader_.dispose();\n this.mainSegmentLoader_.dispose();\n\n if (this.loadOnPlay_) {\n this.tech_.off('play', this.loadOnPlay_);\n }\n\n ['AUDIO', 'SUBTITLES'].forEach(function (type) {\n var groups = _this8.mediaTypes_[type].groups;\n\n for (var id in groups) {\n groups[id].forEach(function (group) {\n if (group.playlistLoader) {\n group.playlistLoader.dispose();\n }\n });\n }\n });\n this.audioSegmentLoader_.dispose();\n this.subtitleSegmentLoader_.dispose();\n this.sourceUpdater_.dispose();\n this.timelineChangeController_.dispose();\n this.stopABRTimer_();\n\n if (this.updateDuration_) {\n this.mediaSource.removeEventListener('sourceopen', this.updateDuration_);\n }\n\n this.mediaSource.removeEventListener('durationchange', this.handleDurationChange_); // load the media source into the player\n\n this.mediaSource.removeEventListener('sourceopen', this.handleSourceOpen_);\n this.mediaSource.removeEventListener('sourceended', this.handleSourceEnded_);\n this.off();\n }\n /**\n * return the master playlist object if we have one\n *\n * @return {Object} the master playlist object that we parsed\n */\n ;\n\n _proto.master = function master() {\n return this.masterPlaylistLoader_.master;\n }\n /**\n * return the currently selected playlist\n *\n * @return {Object} the currently selected playlist object that we parsed\n */\n ;\n\n _proto.media = function media() {\n // playlist loader will not return media if it has not been fully loaded\n return this.masterPlaylistLoader_.media() || this.initialMedia_;\n };\n\n _proto.areMediaTypesKnown_ = function areMediaTypesKnown_() {\n var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;\n var hasMainMediaInfo = !!this.mainSegmentLoader_.getCurrentMediaInfo_(); // if we are not using an audio loader, then we have audio media info\n // otherwise check on the segment loader.\n\n var hasAudioMediaInfo = !usingAudioLoader ? true : !!this.audioSegmentLoader_.getCurrentMediaInfo_(); // one or both loaders has not loaded sufficently to get codecs\n\n if (!hasMainMediaInfo || !hasAudioMediaInfo) {\n return false;\n }\n\n return true;\n };\n\n _proto.getCodecsOrExclude_ = function getCodecsOrExclude_() {\n var _this9 = this;\n\n var media = {\n main: this.mainSegmentLoader_.getCurrentMediaInfo_() || {},\n audio: this.audioSegmentLoader_.getCurrentMediaInfo_() || {}\n };\n var playlist = this.mainSegmentLoader_.getPendingSegmentPlaylist() || this.media(); // set \"main\" media equal to video\n\n media.video = media.main;\n var playlistCodecs = codecsForPlaylist(this.master(), playlist);\n var codecs = {};\n var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;\n\n if (media.main.hasVideo) {\n codecs.video = playlistCodecs.video || media.main.videoCodec || _videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.DEFAULT_VIDEO_CODEC;\n }\n\n if (media.main.isMuxed) {\n codecs.video += \",\" + (playlistCodecs.audio || media.main.audioCodec || _videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.DEFAULT_AUDIO_CODEC);\n }\n\n if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) {\n codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || _videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.DEFAULT_AUDIO_CODEC; // set audio isFmp4 so we use the correct \"supports\" function below\n\n media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4;\n } // no codecs, no playback.\n\n\n if (!codecs.audio && !codecs.video) {\n this.blacklistCurrentPlaylist({\n playlist: playlist,\n message: 'Could not determine codecs for playlist.',\n blacklistDuration: Infinity\n });\n return;\n } // fmp4 relies on browser support, while ts relies on muxer support\n\n\n var supportFunction = function supportFunction(isFmp4, codec) {\n return isFmp4 ? (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.browserSupportsCodec)(codec) : (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.muxerSupportsCodec)(codec);\n };\n\n var unsupportedCodecs = {};\n var unsupportedAudio;\n ['video', 'audio'].forEach(function (type) {\n if (codecs.hasOwnProperty(type) && !supportFunction(media[type].isFmp4, codecs[type])) {\n var supporter = media[type].isFmp4 ? 'browser' : 'muxer';\n unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || [];\n unsupportedCodecs[supporter].push(codecs[type]);\n\n if (type === 'audio') {\n unsupportedAudio = supporter;\n }\n }\n });\n\n if (usingAudioLoader && unsupportedAudio && playlist.attributes.AUDIO) {\n var audioGroup = playlist.attributes.AUDIO;\n this.master().playlists.forEach(function (variant) {\n var variantAudioGroup = variant.attributes && variant.attributes.AUDIO;\n\n if (variantAudioGroup === audioGroup && variant !== playlist) {\n variant.excludeUntil = Infinity;\n }\n });\n this.logger_(\"excluding audio group \" + audioGroup + \" as \" + unsupportedAudio + \" does not support codec(s): \\\"\" + codecs.audio + \"\\\"\");\n } // if we have any unsupported codecs blacklist this playlist.\n\n\n if (Object.keys(unsupportedCodecs).length) {\n var message = Object.keys(unsupportedCodecs).reduce(function (acc, supporter) {\n if (acc) {\n acc += ', ';\n }\n\n acc += supporter + \" does not support codec(s): \\\"\" + unsupportedCodecs[supporter].join(',') + \"\\\"\";\n return acc;\n }, '') + '.';\n this.blacklistCurrentPlaylist({\n playlist: playlist,\n internal: true,\n message: message,\n blacklistDuration: Infinity\n });\n return;\n } // check if codec switching is happening\n\n\n if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {\n var switchMessages = [];\n ['video', 'audio'].forEach(function (type) {\n var newCodec = ((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.parseCodecs)(_this9.sourceUpdater_.codecs[type] || '')[0] || {}).type;\n var oldCodec = ((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.parseCodecs)(codecs[type] || '')[0] || {}).type;\n\n if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) {\n switchMessages.push(\"\\\"\" + _this9.sourceUpdater_.codecs[type] + \"\\\" -> \\\"\" + codecs[type] + \"\\\"\");\n }\n });\n\n if (switchMessages.length) {\n this.blacklistCurrentPlaylist({\n playlist: playlist,\n message: \"Codec switching not supported: \" + switchMessages.join(', ') + \".\",\n blacklistDuration: Infinity,\n internal: true\n });\n return;\n }\n } // TODO: when using the muxer shouldn't we just return\n // the codecs that the muxer outputs?\n\n\n return codecs;\n }\n /**\n * Create source buffers and exlude any incompatible renditions.\n *\n * @private\n */\n ;\n\n _proto.tryToCreateSourceBuffers_ = function tryToCreateSourceBuffers_() {\n // media source is not ready yet or sourceBuffers are already\n // created.\n if (this.mediaSource.readyState !== 'open' || this.sourceUpdater_.hasCreatedSourceBuffers()) {\n return;\n }\n\n if (!this.areMediaTypesKnown_()) {\n return;\n }\n\n var codecs = this.getCodecsOrExclude_(); // no codecs means that the playlist was excluded\n\n if (!codecs) {\n return;\n }\n\n this.sourceUpdater_.createSourceBuffers(codecs);\n var codecString = [codecs.video, codecs.audio].filter(Boolean).join(',');\n this.excludeIncompatibleVariants_(codecString);\n }\n /**\n * Excludes playlists with codecs that are unsupported by the muxer and browser.\n */\n ;\n\n _proto.excludeUnsupportedVariants_ = function excludeUnsupportedVariants_() {\n var _this10 = this;\n\n var playlists = this.master().playlists;\n var ids = []; // TODO: why don't we have a property to loop through all\n // playlist? Why did we ever mix indexes and keys?\n\n Object.keys(playlists).forEach(function (key) {\n var variant = playlists[key]; // check if we already processed this playlist.\n\n if (ids.indexOf(variant.id) !== -1) {\n return;\n }\n\n ids.push(variant.id);\n var codecs = codecsForPlaylist(_this10.master, variant);\n var unsupported = [];\n\n if (codecs.audio && !(0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.muxerSupportsCodec)(codecs.audio) && !(0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.browserSupportsCodec)(codecs.audio)) {\n unsupported.push(\"audio codec \" + codecs.audio);\n }\n\n if (codecs.video && !(0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.muxerSupportsCodec)(codecs.video) && !(0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.browserSupportsCodec)(codecs.video)) {\n unsupported.push(\"video codec \" + codecs.video);\n }\n\n if (codecs.text && codecs.text === 'stpp.ttml.im1t') {\n unsupported.push(\"text codec \" + codecs.text);\n }\n\n if (unsupported.length) {\n variant.excludeUntil = Infinity;\n\n _this10.logger_(\"excluding \" + variant.id + \" for unsupported: \" + unsupported.join(', '));\n }\n });\n }\n /**\n * Blacklist playlists that are known to be codec or\n * stream-incompatible with the SourceBuffer configuration. For\n * instance, Media Source Extensions would cause the video element to\n * stall waiting for video data if you switched from a variant with\n * video and audio to an audio-only one.\n *\n * @param {Object} media a media playlist compatible with the current\n * set of SourceBuffers. Variants in the current master playlist that\n * do not appear to have compatible codec or stream configurations\n * will be excluded from the default playlist selection algorithm\n * indefinitely.\n * @private\n */\n ;\n\n _proto.excludeIncompatibleVariants_ = function excludeIncompatibleVariants_(codecString) {\n var _this11 = this;\n\n var ids = [];\n var playlists = this.master().playlists;\n var codecs = unwrapCodecList((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.parseCodecs)(codecString));\n var codecCount_ = codecCount(codecs);\n var videoDetails = codecs.video && (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.parseCodecs)(codecs.video)[0] || null;\n var audioDetails = codecs.audio && (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.parseCodecs)(codecs.audio)[0] || null;\n Object.keys(playlists).forEach(function (key) {\n var variant = playlists[key]; // check if we already processed this playlist.\n // or it if it is already excluded forever.\n\n if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) {\n return;\n }\n\n ids.push(variant.id);\n var blacklistReasons = []; // get codecs from the playlist for this variant\n\n var variantCodecs = codecsForPlaylist(_this11.masterPlaylistLoader_.master, variant);\n var variantCodecCount = codecCount(variantCodecs); // if no codecs are listed, we cannot determine that this\n // variant is incompatible. Wait for mux.js to probe\n\n if (!variantCodecs.audio && !variantCodecs.video) {\n return;\n } // TODO: we can support this by removing the\n // old media source and creating a new one, but it will take some work.\n // The number of streams cannot change\n\n\n if (variantCodecCount !== codecCount_) {\n blacklistReasons.push(\"codec count \\\"\" + variantCodecCount + \"\\\" !== \\\"\" + codecCount_ + \"\\\"\");\n } // only exclude playlists by codec change, if codecs cannot switch\n // during playback.\n\n\n if (!_this11.sourceUpdater_.canChangeType()) {\n var variantVideoDetails = variantCodecs.video && (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.parseCodecs)(variantCodecs.video)[0] || null;\n var variantAudioDetails = variantCodecs.audio && (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.parseCodecs)(variantCodecs.audio)[0] || null; // the video codec cannot change\n\n if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) {\n blacklistReasons.push(\"video codec \\\"\" + variantVideoDetails.type + \"\\\" !== \\\"\" + videoDetails.type + \"\\\"\");\n } // the audio codec cannot change\n\n\n if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) {\n blacklistReasons.push(\"audio codec \\\"\" + variantAudioDetails.type + \"\\\" !== \\\"\" + audioDetails.type + \"\\\"\");\n }\n }\n\n if (blacklistReasons.length) {\n variant.excludeUntil = Infinity;\n\n _this11.logger_(\"blacklisting \" + variant.id + \": \" + blacklistReasons.join(' && '));\n }\n });\n };\n\n _proto.updateAdCues_ = function updateAdCues_(media) {\n var offset = 0;\n var seekable = this.seekable();\n\n if (seekable.length) {\n offset = seekable.start(0);\n }\n\n updateAdCues(media, this.cueTagsTrack_, offset);\n }\n /**\n * Calculates the desired forward buffer length based on current time\n *\n * @return {number} Desired forward buffer length in seconds\n */\n ;\n\n _proto.goalBufferLength = function goalBufferLength() {\n var currentTime = this.tech_.currentTime();\n var initial = Config.GOAL_BUFFER_LENGTH;\n var rate = Config.GOAL_BUFFER_LENGTH_RATE;\n var max = Math.max(initial, Config.MAX_GOAL_BUFFER_LENGTH);\n return Math.min(initial + currentTime * rate, max);\n }\n /**\n * Calculates the desired buffer low water line based on current time\n *\n * @return {number} Desired buffer low water line in seconds\n */\n ;\n\n _proto.bufferLowWaterLine = function bufferLowWaterLine() {\n var currentTime = this.tech_.currentTime();\n var initial = Config.BUFFER_LOW_WATER_LINE;\n var rate = Config.BUFFER_LOW_WATER_LINE_RATE;\n var max = Math.max(initial, Config.MAX_BUFFER_LOW_WATER_LINE);\n var newMax = Math.max(initial, Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);\n return Math.min(initial + currentTime * rate, this.experimentalBufferBasedABR ? newMax : max);\n };\n\n _proto.bufferHighWaterLine = function bufferHighWaterLine() {\n return Config.BUFFER_HIGH_WATER_LINE;\n };\n\n return MasterPlaylistController;\n}(videojs.EventTarget);\n/**\n * Returns a function that acts as the Enable/disable playlist function.\n *\n * @param {PlaylistLoader} loader - The master playlist loader\n * @param {string} playlistID - id of the playlist\n * @param {Function} changePlaylistFn - A function to be called after a\n * playlist's enabled-state has been changed. Will NOT be called if a\n * playlist's enabled-state is unchanged\n * @param {boolean=} enable - Value to set the playlist enabled-state to\n * or if undefined returns the current enabled-state for the playlist\n * @return {Function} Function for setting/getting enabled\n */\n\n\nvar enableFunction = function enableFunction(loader, playlistID, changePlaylistFn) {\n return function (enable) {\n var playlist = loader.master.playlists[playlistID];\n var incompatible = isIncompatible(playlist);\n var currentlyEnabled = isEnabled(playlist);\n\n if (typeof enable === 'undefined') {\n return currentlyEnabled;\n }\n\n if (enable) {\n delete playlist.disabled;\n } else {\n playlist.disabled = true;\n }\n\n if (enable !== currentlyEnabled && !incompatible) {\n // Ensure the outside world knows about our changes\n changePlaylistFn();\n\n if (enable) {\n loader.trigger('renditionenabled');\n } else {\n loader.trigger('renditiondisabled');\n }\n }\n\n return enable;\n };\n};\n/**\n * The representation object encapsulates the publicly visible information\n * in a media playlist along with a setter/getter-type function (enabled)\n * for changing the enabled-state of a particular playlist entry\n *\n * @class Representation\n */\n\n\nvar Representation = function Representation(vhsHandler, playlist, id) {\n var mpc = vhsHandler.masterPlaylistController_,\n smoothQualityChange = vhsHandler.options_.smoothQualityChange; // Get a reference to a bound version of the quality change function\n\n var changeType = smoothQualityChange ? 'smooth' : 'fast';\n var qualityChangeFunction = mpc[changeType + \"QualityChange_\"].bind(mpc); // some playlist attributes are optional\n\n if (playlist.attributes) {\n var resolution = playlist.attributes.RESOLUTION;\n this.width = resolution && resolution.width;\n this.height = resolution && resolution.height;\n this.bandwidth = playlist.attributes.BANDWIDTH;\n this.frameRate = playlist.attributes['FRAME-RATE'];\n }\n\n this.codecs = codecsForPlaylist(mpc.master(), playlist);\n this.playlist = playlist; // The id is simply the ordinality of the media playlist\n // within the master playlist\n\n this.id = id; // Partially-apply the enableFunction to create a playlist-\n // specific variant\n\n this.enabled = enableFunction(vhsHandler.playlists, playlist.id, qualityChangeFunction);\n};\n/**\n * A mixin function that adds the `representations` api to an instance\n * of the VhsHandler class\n *\n * @param {VhsHandler} vhsHandler - An instance of VhsHandler to add the\n * representation API into\n */\n\n\nvar renditionSelectionMixin = function renditionSelectionMixin(vhsHandler) {\n // Add a single API-specific function to the VhsHandler instance\n vhsHandler.representations = function () {\n var master = vhsHandler.masterPlaylistController_.master();\n var playlists = isAudioOnly(master) ? vhsHandler.masterPlaylistController_.getAudioTrackPlaylists_() : master.playlists;\n\n if (!playlists) {\n return [];\n }\n\n return playlists.filter(function (media) {\n return !isIncompatible(media);\n }).map(function (e, i) {\n return new Representation(vhsHandler, e, e.id);\n });\n };\n};\n/**\n * @file playback-watcher.js\n *\n * Playback starts, and now my watch begins. It shall not end until my death. I shall\n * take no wait, hold no uncleared timeouts, father no bad seeks. I shall wear no crowns\n * and win no glory. I shall live and die at my post. I am the corrector of the underflow.\n * I am the watcher of gaps. I am the shield that guards the realms of seekable. I pledge\n * my life and honor to the Playback Watch, for this Player and all the Players to come.\n */\n\n\nvar timerCancelEvents = ['seeking', 'seeked', 'pause', 'playing', 'error'];\n/**\n * @class PlaybackWatcher\n */\n\nvar PlaybackWatcher = /*#__PURE__*/function () {\n /**\n * Represents an PlaybackWatcher object.\n *\n * @class\n * @param {Object} options an object that includes the tech and settings\n */\n function PlaybackWatcher(options) {\n var _this = this;\n\n this.masterPlaylistController_ = options.masterPlaylistController;\n this.tech_ = options.tech;\n this.seekable = options.seekable;\n this.allowSeeksWithinUnsafeLiveWindow = options.allowSeeksWithinUnsafeLiveWindow;\n this.liveRangeSafeTimeDelta = options.liveRangeSafeTimeDelta;\n this.media = options.media;\n this.consecutiveUpdates = 0;\n this.lastRecordedTime = null;\n this.timer_ = null;\n this.checkCurrentTimeTimeout_ = null;\n this.logger_ = logger('PlaybackWatcher');\n this.logger_('initialize');\n\n var playHandler = function playHandler() {\n return _this.monitorCurrentTime_();\n };\n\n var canPlayHandler = function canPlayHandler() {\n return _this.monitorCurrentTime_();\n };\n\n var waitingHandler = function waitingHandler() {\n return _this.techWaiting_();\n };\n\n var cancelTimerHandler = function cancelTimerHandler() {\n return _this.cancelTimer_();\n };\n\n var mpc = this.masterPlaylistController_;\n var loaderTypes = ['main', 'subtitle', 'audio'];\n var loaderChecks = {};\n loaderTypes.forEach(function (type) {\n loaderChecks[type] = {\n reset: function reset() {\n return _this.resetSegmentDownloads_(type);\n },\n updateend: function updateend() {\n return _this.checkSegmentDownloads_(type);\n }\n };\n mpc[type + \"SegmentLoader_\"].on('appendsdone', loaderChecks[type].updateend); // If a rendition switch happens during a playback stall where the buffer\n // isn't changing we want to reset. We cannot assume that the new rendition\n // will also be stalled, until after new appends.\n\n mpc[type + \"SegmentLoader_\"].on('playlistupdate', loaderChecks[type].reset); // Playback stalls should not be detected right after seeking.\n // This prevents one segment playlists (single vtt or single segment content)\n // from being detected as stalling. As the buffer will not change in those cases, since\n // the buffer is the entire video duration.\n\n _this.tech_.on(['seeked', 'seeking'], loaderChecks[type].reset);\n });\n /**\n * We check if a seek was into a gap through the following steps:\n * 1. We get a seeking event and we do not get a seeked event. This means that\n * a seek was attempted but not completed.\n * 2. We run `fixesBadSeeks_` on segment loader appends. This means that we already\n * removed everything from our buffer and appended a segment, and should be ready\n * to check for gaps.\n */\n\n var setSeekingHandlers = function setSeekingHandlers(fn) {\n ['main', 'audio'].forEach(function (type) {\n mpc[type + \"SegmentLoader_\"][fn]('appended', _this.seekingAppendCheck_);\n });\n };\n\n this.seekingAppendCheck_ = function () {\n if (_this.fixesBadSeeks_()) {\n _this.consecutiveUpdates = 0;\n _this.lastRecordedTime = _this.tech_.currentTime();\n setSeekingHandlers('off');\n }\n };\n\n this.clearSeekingAppendCheck_ = function () {\n return setSeekingHandlers('off');\n };\n\n this.watchForBadSeeking_ = function () {\n _this.clearSeekingAppendCheck_();\n\n setSeekingHandlers('on');\n };\n\n this.tech_.on('seeked', this.clearSeekingAppendCheck_);\n this.tech_.on('seeking', this.watchForBadSeeking_);\n this.tech_.on('waiting', waitingHandler);\n this.tech_.on(timerCancelEvents, cancelTimerHandler);\n this.tech_.on('canplay', canPlayHandler);\n /*\n An edge case exists that results in gaps not being skipped when they exist at the beginning of a stream. This case\n is surfaced in one of two ways:\n 1) The `waiting` event is fired before the player has buffered content, making it impossible\n to find or skip the gap. The `waiting` event is followed by a `play` event. On first play\n we can check if playback is stalled due to a gap, and skip the gap if necessary.\n 2) A source with a gap at the beginning of the stream is loaded programatically while the player\n is in a playing state. To catch this case, it's important that our one-time play listener is setup\n even if the player is in a playing state\n */\n\n this.tech_.one('play', playHandler); // Define the dispose function to clean up our events\n\n this.dispose = function () {\n _this.clearSeekingAppendCheck_();\n\n _this.logger_('dispose');\n\n _this.tech_.off('waiting', waitingHandler);\n\n _this.tech_.off(timerCancelEvents, cancelTimerHandler);\n\n _this.tech_.off('canplay', canPlayHandler);\n\n _this.tech_.off('play', playHandler);\n\n _this.tech_.off('seeking', _this.watchForBadSeeking_);\n\n _this.tech_.off('seeked', _this.clearSeekingAppendCheck_);\n\n loaderTypes.forEach(function (type) {\n mpc[type + \"SegmentLoader_\"].off('appendsdone', loaderChecks[type].updateend);\n mpc[type + \"SegmentLoader_\"].off('playlistupdate', loaderChecks[type].reset);\n\n _this.tech_.off(['seeked', 'seeking'], loaderChecks[type].reset);\n });\n\n if (_this.checkCurrentTimeTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(_this.checkCurrentTimeTimeout_);\n }\n\n _this.cancelTimer_();\n };\n }\n /**\n * Periodically check current time to see if playback stopped\n *\n * @private\n */\n\n\n var _proto = PlaybackWatcher.prototype;\n\n _proto.monitorCurrentTime_ = function monitorCurrentTime_() {\n this.checkCurrentTime_();\n\n if (this.checkCurrentTimeTimeout_) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().clearTimeout(this.checkCurrentTimeTimeout_);\n } // 42 = 24 fps // 250 is what Webkit uses // FF uses 15\n\n\n this.checkCurrentTimeTimeout_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().setTimeout(this.monitorCurrentTime_.bind(this), 250);\n }\n /**\n * Reset stalled download stats for a specific type of loader\n *\n * @param {string} type\n * The segment loader type to check.\n *\n * @listens SegmentLoader#playlistupdate\n * @listens Tech#seeking\n * @listens Tech#seeked\n */\n ;\n\n _proto.resetSegmentDownloads_ = function resetSegmentDownloads_(type) {\n var loader = this.masterPlaylistController_[type + \"SegmentLoader_\"];\n\n if (this[type + \"StalledDownloads_\"] > 0) {\n this.logger_(\"resetting possible stalled download count for \" + type + \" loader\");\n }\n\n this[type + \"StalledDownloads_\"] = 0;\n this[type + \"Buffered_\"] = loader.buffered_();\n }\n /**\n * Checks on every segment `appendsdone` to see\n * if segment appends are making progress. If they are not\n * and we are still downloading bytes. We blacklist the playlist.\n *\n * @param {string} type\n * The segment loader type to check.\n *\n * @listens SegmentLoader#appendsdone\n */\n ;\n\n _proto.checkSegmentDownloads_ = function checkSegmentDownloads_(type) {\n var mpc = this.masterPlaylistController_;\n var loader = mpc[type + \"SegmentLoader_\"];\n var buffered = loader.buffered_();\n var isBufferedDifferent = isRangeDifferent(this[type + \"Buffered_\"], buffered);\n this[type + \"Buffered_\"] = buffered; // if another watcher is going to fix the issue or\n // the buffered value for this loader changed\n // appends are working\n\n if (isBufferedDifferent) {\n this.resetSegmentDownloads_(type);\n return;\n }\n\n this[type + \"StalledDownloads_\"]++;\n this.logger_(\"found #\" + this[type + \"StalledDownloads_\"] + \" \" + type + \" appends that did not increase buffer (possible stalled download)\", {\n playlistId: loader.playlist_ && loader.playlist_.id,\n buffered: timeRangesToArray(buffered)\n }); // after 10 possibly stalled appends with no reset, exclude\n\n if (this[type + \"StalledDownloads_\"] < 10) {\n return;\n }\n\n this.logger_(type + \" loader stalled download exclusion\");\n this.resetSegmentDownloads_(type);\n this.tech_.trigger({\n type: 'usage',\n name: \"vhs-\" + type + \"-download-exclusion\"\n });\n\n if (type === 'subtitle') {\n return;\n } // TODO: should we exclude audio tracks rather than main tracks\n // when type is audio?\n\n\n mpc.blacklistCurrentPlaylist({\n message: \"Excessive \" + type + \" segment downloading detected.\"\n }, Infinity);\n }\n /**\n * The purpose of this function is to emulate the \"waiting\" event on\n * browsers that do not emit it when they are waiting for more\n * data to continue playback\n *\n * @private\n */\n ;\n\n _proto.checkCurrentTime_ = function checkCurrentTime_() {\n if (this.tech_.paused() || this.tech_.seeking()) {\n return;\n }\n\n var currentTime = this.tech_.currentTime();\n var buffered = this.tech_.buffered();\n\n if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA >= buffered.end(buffered.length - 1))) {\n // If current time is at the end of the final buffered region, then any playback\n // stall is most likely caused by buffering in a low bandwidth environment. The tech\n // should fire a `waiting` event in this scenario, but due to browser and tech\n // inconsistencies. Calling `techWaiting_` here allows us to simulate\n // responding to a native `waiting` event when the tech fails to emit one.\n return this.techWaiting_();\n }\n\n if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) {\n this.consecutiveUpdates++;\n this.waiting_();\n } else if (currentTime === this.lastRecordedTime) {\n this.consecutiveUpdates++;\n } else {\n this.consecutiveUpdates = 0;\n this.lastRecordedTime = currentTime;\n }\n }\n /**\n * Cancels any pending timers and resets the 'timeupdate' mechanism\n * designed to detect that we are stalled\n *\n * @private\n */\n ;\n\n _proto.cancelTimer_ = function cancelTimer_() {\n this.consecutiveUpdates = 0;\n\n if (this.timer_) {\n this.logger_('cancelTimer_');\n clearTimeout(this.timer_);\n }\n\n this.timer_ = null;\n }\n /**\n * Fixes situations where there's a bad seek\n *\n * @return {boolean} whether an action was taken to fix the seek\n * @private\n */\n ;\n\n _proto.fixesBadSeeks_ = function fixesBadSeeks_() {\n var seeking = this.tech_.seeking();\n\n if (!seeking) {\n return false;\n } // TODO: It's possible that these seekable checks should be moved out of this function\n // and into a function that runs on seekablechange. It's also possible that we only need\n // afterSeekableWindow as the buffered check at the bottom is good enough to handle before\n // seekable range.\n\n\n var seekable = this.seekable();\n var currentTime = this.tech_.currentTime();\n var isAfterSeekableRange = this.afterSeekableWindow_(seekable, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow);\n var seekTo;\n\n if (isAfterSeekableRange) {\n var seekableEnd = seekable.end(seekable.length - 1); // sync to live point (if VOD, our seekable was updated and we're simply adjusting)\n\n seekTo = seekableEnd;\n }\n\n if (this.beforeSeekableWindow_(seekable, currentTime)) {\n var seekableStart = seekable.start(0); // sync to the beginning of the live window\n // provide a buffer of .1 seconds to handle rounding/imprecise numbers\n\n seekTo = seekableStart + ( // if the playlist is too short and the seekable range is an exact time (can\n // happen in live with a 3 segment playlist), then don't use a time delta\n seekableStart === seekable.end(0) ? 0 : SAFE_TIME_DELTA);\n }\n\n if (typeof seekTo !== 'undefined') {\n this.logger_(\"Trying to seek outside of seekable at time \" + currentTime + \" with \" + (\"seekable range \" + printableRange(seekable) + \". Seeking to \") + (seekTo + \".\"));\n this.tech_.setCurrentTime(seekTo);\n return true;\n }\n\n var sourceUpdater = this.masterPlaylistController_.sourceUpdater_;\n var buffered = this.tech_.buffered();\n var audioBuffered = sourceUpdater.audioBuffer ? sourceUpdater.audioBuffered() : null;\n var videoBuffered = sourceUpdater.videoBuffer ? sourceUpdater.videoBuffered() : null;\n var media = this.media(); // verify that at least two segment durations or one part duration have been\n // appended before checking for a gap.\n\n var minAppendedDuration = media.partTargetDuration ? media.partTargetDuration : (media.targetDuration - TIME_FUDGE_FACTOR) * 2; // verify that at least two segment durations have been\n // appended before checking for a gap.\n\n var bufferedToCheck = [audioBuffered, videoBuffered];\n\n for (var i = 0; i < bufferedToCheck.length; i++) {\n // skip null buffered\n if (!bufferedToCheck[i]) {\n continue;\n }\n\n var timeAhead = timeAheadOf(bufferedToCheck[i], currentTime); // if we are less than two video/audio segment durations or one part\n // duration behind we haven't appended enough to call this a bad seek.\n\n if (timeAhead < minAppendedDuration) {\n return false;\n }\n }\n\n var nextRange = findNextRange(buffered, currentTime); // we have appended enough content, but we don't have anything buffered\n // to seek over the gap\n\n if (nextRange.length === 0) {\n return false;\n }\n\n seekTo = nextRange.start(0) + SAFE_TIME_DELTA;\n this.logger_(\"Buffered region starts (\" + nextRange.start(0) + \") \" + (\" just beyond seek point (\" + currentTime + \"). Seeking to \" + seekTo + \".\"));\n this.tech_.setCurrentTime(seekTo);\n return true;\n }\n /**\n * Handler for situations when we determine the player is waiting.\n *\n * @private\n */\n ;\n\n _proto.waiting_ = function waiting_() {\n if (this.techWaiting_()) {\n return;\n } // All tech waiting checks failed. Use last resort correction\n\n\n var currentTime = this.tech_.currentTime();\n var buffered = this.tech_.buffered();\n var currentRange = findRange(buffered, currentTime); // Sometimes the player can stall for unknown reasons within a contiguous buffered\n // region with no indication that anything is amiss (seen in Firefox). Seeking to\n // currentTime is usually enough to kickstart the player. This checks that the player\n // is currently within a buffered region before attempting a corrective seek.\n // Chrome does not appear to continue `timeupdate` events after a `waiting` event\n // until there is ~ 3 seconds of forward buffer available. PlaybackWatcher should also\n // make sure there is ~3 seconds of forward buffer before taking any corrective action\n // to avoid triggering an `unknownwaiting` event when the network is slow.\n\n if (currentRange.length && currentTime + 3 <= currentRange.end(0)) {\n this.cancelTimer_();\n this.tech_.setCurrentTime(currentTime);\n this.logger_(\"Stopped at \" + currentTime + \" while inside a buffered region \" + (\"[\" + currentRange.start(0) + \" -> \" + currentRange.end(0) + \"]. Attempting to resume \") + 'playback by seeking to the current time.'); // unknown waiting corrections may be useful for monitoring QoS\n\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-unknown-waiting'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-unknown-waiting'\n });\n return;\n }\n }\n /**\n * Handler for situations when the tech fires a `waiting` event\n *\n * @return {boolean}\n * True if an action (or none) was needed to correct the waiting. False if no\n * checks passed\n * @private\n */\n ;\n\n _proto.techWaiting_ = function techWaiting_() {\n var seekable = this.seekable();\n var currentTime = this.tech_.currentTime();\n\n if (this.tech_.seeking() || this.timer_ !== null) {\n // Tech is seeking or already waiting on another action, no action needed\n return true;\n }\n\n if (this.beforeSeekableWindow_(seekable, currentTime)) {\n var livePoint = seekable.end(seekable.length - 1);\n this.logger_(\"Fell out of live window at time \" + currentTime + \". Seeking to \" + (\"live point (seekable end) \" + livePoint));\n this.cancelTimer_();\n this.tech_.setCurrentTime(livePoint); // live window resyncs may be useful for monitoring QoS\n\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-live-resync'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-live-resync'\n });\n return true;\n }\n\n var sourceUpdater = this.tech_.vhs.masterPlaylistController_.sourceUpdater_;\n var buffered = this.tech_.buffered();\n var videoUnderflow = this.videoUnderflow_({\n audioBuffered: sourceUpdater.audioBuffered(),\n videoBuffered: sourceUpdater.videoBuffered(),\n currentTime: currentTime\n });\n\n if (videoUnderflow) {\n // Even though the video underflowed and was stuck in a gap, the audio overplayed\n // the gap, leading currentTime into a buffered range. Seeking to currentTime\n // allows the video to catch up to the audio position without losing any audio\n // (only suffering ~3 seconds of frozen video and a pause in audio playback).\n this.cancelTimer_();\n this.tech_.setCurrentTime(currentTime); // video underflow may be useful for monitoring QoS\n\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-video-underflow'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-video-underflow'\n });\n return true;\n }\n\n var nextRange = findNextRange(buffered, currentTime); // check for gap\n\n if (nextRange.length > 0) {\n var difference = nextRange.start(0) - currentTime;\n this.logger_(\"Stopped at \" + currentTime + \", setting timer for \" + difference + \", seeking \" + (\"to \" + nextRange.start(0)));\n this.cancelTimer_();\n this.timer_ = setTimeout(this.skipTheGap_.bind(this), difference * 1000, currentTime);\n return true;\n } // All checks failed. Returning false to indicate failure to correct waiting\n\n\n return false;\n };\n\n _proto.afterSeekableWindow_ = function afterSeekableWindow_(seekable, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow) {\n if (allowSeeksWithinUnsafeLiveWindow === void 0) {\n allowSeeksWithinUnsafeLiveWindow = false;\n }\n\n if (!seekable.length) {\n // we can't make a solid case if there's no seekable, default to false\n return false;\n }\n\n var allowedEnd = seekable.end(seekable.length - 1) + SAFE_TIME_DELTA;\n var isLive = !playlist.endList;\n\n if (isLive && allowSeeksWithinUnsafeLiveWindow) {\n allowedEnd = seekable.end(seekable.length - 1) + playlist.targetDuration * 3;\n }\n\n if (currentTime > allowedEnd) {\n return true;\n }\n\n return false;\n };\n\n _proto.beforeSeekableWindow_ = function beforeSeekableWindow_(seekable, currentTime) {\n if (seekable.length && // can't fall before 0 and 0 seekable start identifies VOD stream\n seekable.start(0) > 0 && currentTime < seekable.start(0) - this.liveRangeSafeTimeDelta) {\n return true;\n }\n\n return false;\n };\n\n _proto.videoUnderflow_ = function videoUnderflow_(_ref) {\n var videoBuffered = _ref.videoBuffered,\n audioBuffered = _ref.audioBuffered,\n currentTime = _ref.currentTime; // audio only content will not have video underflow :)\n\n if (!videoBuffered) {\n return;\n }\n\n var gap; // find a gap in demuxed content.\n\n if (videoBuffered.length && audioBuffered.length) {\n // in Chrome audio will continue to play for ~3s when we run out of video\n // so we have to check that the video buffer did have some buffer in the\n // past.\n var lastVideoRange = findRange(videoBuffered, currentTime - 3);\n var videoRange = findRange(videoBuffered, currentTime);\n var audioRange = findRange(audioBuffered, currentTime);\n\n if (audioRange.length && !videoRange.length && lastVideoRange.length) {\n gap = {\n start: lastVideoRange.end(0),\n end: audioRange.end(0)\n };\n } // find a gap in muxed content.\n\n } else {\n var nextRange = findNextRange(videoBuffered, currentTime); // Even if there is no available next range, there is still a possibility we are\n // stuck in a gap due to video underflow.\n\n if (!nextRange.length) {\n gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime);\n }\n }\n\n if (gap) {\n this.logger_(\"Encountered a gap in video from \" + gap.start + \" to \" + gap.end + \". \" + (\"Seeking to current time \" + currentTime));\n return true;\n }\n\n return false;\n }\n /**\n * Timer callback. If playback still has not proceeded, then we seek\n * to the start of the next buffered region.\n *\n * @private\n */\n ;\n\n _proto.skipTheGap_ = function skipTheGap_(scheduledCurrentTime) {\n var buffered = this.tech_.buffered();\n var currentTime = this.tech_.currentTime();\n var nextRange = findNextRange(buffered, currentTime);\n this.cancelTimer_();\n\n if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) {\n return;\n }\n\n this.logger_('skipTheGap_:', 'currentTime:', currentTime, 'scheduled currentTime:', scheduledCurrentTime, 'nextRange start:', nextRange.start(0)); // only seek if we still have not played\n\n this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR);\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-gap-skip'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-gap-skip'\n });\n };\n\n _proto.gapFromVideoUnderflow_ = function gapFromVideoUnderflow_(buffered, currentTime) {\n // At least in Chrome, if there is a gap in the video buffer, the audio will continue\n // playing for ~3 seconds after the video gap starts. This is done to account for\n // video buffer underflow/underrun (note that this is not done when there is audio\n // buffer underflow/underrun -- in that case the video will stop as soon as it\n // encounters the gap, as audio stalls are more noticeable/jarring to a user than\n // video stalls). The player's time will reflect the playthrough of audio, so the\n // time will appear as if we are in a buffered region, even if we are stuck in a\n // \"gap.\"\n //\n // Example:\n // video buffer: 0 => 10.1, 10.2 => 20\n // audio buffer: 0 => 20\n // overall buffer: 0 => 10.1, 10.2 => 20\n // current time: 13\n //\n // Chrome's video froze at 10 seconds, where the video buffer encountered the gap,\n // however, the audio continued playing until it reached ~3 seconds past the gap\n // (13 seconds), at which point it stops as well. Since current time is past the\n // gap, findNextRange will return no ranges.\n //\n // To check for this issue, we see if there is a gap that starts somewhere within\n // a 3 second range (3 seconds +/- 1 second) back from our current time.\n var gaps = findGaps(buffered);\n\n for (var i = 0; i < gaps.length; i++) {\n var start = gaps.start(i);\n var end = gaps.end(i); // gap is starts no more than 4 seconds back\n\n if (currentTime - start < 4 && currentTime - start > 2) {\n return {\n start: start,\n end: end\n };\n }\n }\n\n return null;\n };\n\n return PlaybackWatcher;\n}();\n\nvar defaultOptions = {\n errorInterval: 30,\n getSource: function getSource(next) {\n var tech = this.tech({\n IWillNotUseThisInPlugins: true\n });\n var sourceObj = tech.currentSource_ || this.currentSource();\n return next(sourceObj);\n }\n};\n/**\n * Main entry point for the plugin\n *\n * @param {Player} player a reference to a videojs Player instance\n * @param {Object} [options] an object with plugin options\n * @private\n */\n\nvar initPlugin = function initPlugin(player, options) {\n var lastCalled = 0;\n var seekTo = 0;\n var localOptions = videojs.mergeOptions(defaultOptions, options);\n player.ready(function () {\n player.trigger({\n type: 'usage',\n name: 'vhs-error-reload-initialized'\n });\n player.trigger({\n type: 'usage',\n name: 'hls-error-reload-initialized'\n });\n });\n /**\n * Player modifications to perform that must wait until `loadedmetadata`\n * has been triggered\n *\n * @private\n */\n\n var loadedMetadataHandler = function loadedMetadataHandler() {\n if (seekTo) {\n player.currentTime(seekTo);\n }\n };\n /**\n * Set the source on the player element, play, and seek if necessary\n *\n * @param {Object} sourceObj An object specifying the source url and mime-type to play\n * @private\n */\n\n\n var setSource = function setSource(sourceObj) {\n if (sourceObj === null || sourceObj === undefined) {\n return;\n }\n\n seekTo = player.duration() !== Infinity && player.currentTime() || 0;\n player.one('loadedmetadata', loadedMetadataHandler);\n player.src(sourceObj);\n player.trigger({\n type: 'usage',\n name: 'vhs-error-reload'\n });\n player.trigger({\n type: 'usage',\n name: 'hls-error-reload'\n });\n player.play();\n };\n /**\n * Attempt to get a source from either the built-in getSource function\n * or a custom function provided via the options\n *\n * @private\n */\n\n\n var errorHandler = function errorHandler() {\n // Do not attempt to reload the source if a source-reload occurred before\n // 'errorInterval' time has elapsed since the last source-reload\n if (Date.now() - lastCalled < localOptions.errorInterval * 1000) {\n player.trigger({\n type: 'usage',\n name: 'vhs-error-reload-canceled'\n });\n player.trigger({\n type: 'usage',\n name: 'hls-error-reload-canceled'\n });\n return;\n }\n\n if (!localOptions.getSource || typeof localOptions.getSource !== 'function') {\n videojs.log.error('ERROR: reloadSourceOnError - The option getSource must be a function!');\n return;\n }\n\n lastCalled = Date.now();\n return localOptions.getSource.call(player, setSource);\n };\n /**\n * Unbind any event handlers that were bound by the plugin\n *\n * @private\n */\n\n\n var cleanupEvents = function cleanupEvents() {\n player.off('loadedmetadata', loadedMetadataHandler);\n player.off('error', errorHandler);\n player.off('dispose', cleanupEvents);\n };\n /**\n * Cleanup before re-initializing the plugin\n *\n * @param {Object} [newOptions] an object with plugin options\n * @private\n */\n\n\n var reinitPlugin = function reinitPlugin(newOptions) {\n cleanupEvents();\n initPlugin(player, newOptions);\n };\n\n player.on('error', errorHandler);\n player.on('dispose', cleanupEvents); // Overwrite the plugin function so that we can correctly cleanup before\n // initializing the plugin\n\n player.reloadSourceOnError = reinitPlugin;\n};\n/**\n * Reload the source when an error is detected as long as there\n * wasn't an error previously within the last 30 seconds\n *\n * @param {Object} [options] an object with plugin options\n */\n\n\nvar reloadSourceOnError = function reloadSourceOnError(options) {\n initPlugin(this, options);\n};\n\nvar version$4 = \"2.16.2\";\nvar version$3 = \"6.0.1\";\nvar version$2 = \"0.22.1\";\nvar version$1 = \"4.8.0\";\nvar version = \"3.1.3\";\nvar Vhs = {\n PlaylistLoader: PlaylistLoader,\n Playlist: Playlist,\n utils: utils,\n STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector,\n INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector,\n lastBandwidthSelector: lastBandwidthSelector,\n movingAverageBandwidthSelector: movingAverageBandwidthSelector,\n comparePlaylistBandwidth: comparePlaylistBandwidth,\n comparePlaylistResolution: comparePlaylistResolution,\n xhr: xhrFactory()\n}; // Define getter/setters for config properties\n\nObject.keys(Config).forEach(function (prop) {\n Object.defineProperty(Vhs, prop, {\n get: function get() {\n videojs.log.warn(\"using Vhs.\" + prop + \" is UNSAFE be sure you know what you are doing\");\n return Config[prop];\n },\n set: function set(value) {\n videojs.log.warn(\"using Vhs.\" + prop + \" is UNSAFE be sure you know what you are doing\");\n\n if (typeof value !== 'number' || value < 0) {\n videojs.log.warn(\"value of Vhs.\" + prop + \" must be greater than or equal to 0\");\n return;\n }\n\n Config[prop] = value;\n }\n });\n});\nvar LOCAL_STORAGE_KEY = 'videojs-vhs';\n/**\n * Updates the selectedIndex of the QualityLevelList when a mediachange happens in vhs.\n *\n * @param {QualityLevelList} qualityLevels The QualityLevelList to update.\n * @param {PlaylistLoader} playlistLoader PlaylistLoader containing the new media info.\n * @function handleVhsMediaChange\n */\n\nvar handleVhsMediaChange = function handleVhsMediaChange(qualityLevels, playlistLoader) {\n var newPlaylist = playlistLoader.media();\n var selectedIndex = -1;\n\n for (var i = 0; i < qualityLevels.length; i++) {\n if (qualityLevels[i].id === newPlaylist.id) {\n selectedIndex = i;\n break;\n }\n }\n\n qualityLevels.selectedIndex_ = selectedIndex;\n qualityLevels.trigger({\n selectedIndex: selectedIndex,\n type: 'change'\n });\n};\n/**\n * Adds quality levels to list once playlist metadata is available\n *\n * @param {QualityLevelList} qualityLevels The QualityLevelList to attach events to.\n * @param {Object} vhs Vhs object to listen to for media events.\n * @function handleVhsLoadedMetadata\n */\n\n\nvar handleVhsLoadedMetadata = function handleVhsLoadedMetadata(qualityLevels, vhs) {\n vhs.representations().forEach(function (rep) {\n qualityLevels.addQualityLevel(rep);\n });\n handleVhsMediaChange(qualityLevels, vhs.playlists);\n}; // HLS is a source handler, not a tech. Make sure attempts to use it\n// as one do not cause exceptions.\n\n\nVhs.canPlaySource = function () {\n return videojs.log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\\'s techOrder.');\n};\n\nvar emeKeySystems = function emeKeySystems(keySystemOptions, mainPlaylist, audioPlaylist) {\n if (!keySystemOptions) {\n return keySystemOptions;\n }\n\n var codecs = {};\n\n if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) {\n codecs = unwrapCodecList((0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.parseCodecs)(mainPlaylist.attributes.CODECS));\n }\n\n if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) {\n codecs.audio = audioPlaylist.attributes.CODECS;\n }\n\n var videoContentType = (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.getMimeForCodec)(codecs.video);\n var audioContentType = (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.getMimeForCodec)(codecs.audio); // upsert the content types based on the selected playlist\n\n var keySystemContentTypes = {};\n\n for (var keySystem in keySystemOptions) {\n keySystemContentTypes[keySystem] = {};\n\n if (audioContentType) {\n keySystemContentTypes[keySystem].audioContentType = audioContentType;\n }\n\n if (videoContentType) {\n keySystemContentTypes[keySystem].videoContentType = videoContentType;\n } // Default to using the video playlist's PSSH even though they may be different, as\n // videojs-contrib-eme will only accept one in the options.\n //\n // This shouldn't be an issue for most cases as early intialization will handle all\n // unique PSSH values, and if they aren't, then encrypted events should have the\n // specific information needed for the unique license.\n\n\n if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) {\n keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh;\n } // videojs-contrib-eme accepts the option of specifying: 'com.some.cdm': 'url'\n // so we need to prevent overwriting the URL entirely\n\n\n if (typeof keySystemOptions[keySystem] === 'string') {\n keySystemContentTypes[keySystem].url = keySystemOptions[keySystem];\n }\n }\n\n return videojs.mergeOptions(keySystemOptions, keySystemContentTypes);\n};\n/**\n * @typedef {Object} KeySystems\n *\n * keySystems configuration for https://github.com/videojs/videojs-contrib-eme\n * Note: not all options are listed here.\n *\n * @property {Uint8Array} [pssh]\n * Protection System Specific Header\n */\n\n/**\n * Goes through all the playlists and collects an array of KeySystems options objects\n * containing each playlist's keySystems and their pssh values, if available.\n *\n * @param {Object[]} playlists\n * The playlists to look through\n * @param {string[]} keySystems\n * The keySystems to collect pssh values for\n *\n * @return {KeySystems[]}\n * An array of KeySystems objects containing available key systems and their\n * pssh values\n */\n\n\nvar getAllPsshKeySystemsOptions = function getAllPsshKeySystemsOptions(playlists, keySystems) {\n return playlists.reduce(function (keySystemsArr, playlist) {\n if (!playlist.contentProtection) {\n return keySystemsArr;\n }\n\n var keySystemsOptions = keySystems.reduce(function (keySystemsObj, keySystem) {\n var keySystemOptions = playlist.contentProtection[keySystem];\n\n if (keySystemOptions && keySystemOptions.pssh) {\n keySystemsObj[keySystem] = {\n pssh: keySystemOptions.pssh\n };\n }\n\n return keySystemsObj;\n }, {});\n\n if (Object.keys(keySystemsOptions).length) {\n keySystemsArr.push(keySystemsOptions);\n }\n\n return keySystemsArr;\n }, []);\n};\n/**\n * Returns a promise that waits for the\n * [eme plugin](https://github.com/videojs/videojs-contrib-eme) to create a key session.\n *\n * Works around https://bugs.chromium.org/p/chromium/issues/detail?id=895449 in non-IE11\n * browsers.\n *\n * As per the above ticket, this is particularly important for Chrome, where, if\n * unencrypted content is appended before encrypted content and the key session has not\n * been created, a MEDIA_ERR_DECODE will be thrown once the encrypted content is reached\n * during playback.\n *\n * @param {Object} player\n * The player instance\n * @param {Object[]} sourceKeySystems\n * The key systems options from the player source\n * @param {Object} [audioMedia]\n * The active audio media playlist (optional)\n * @param {Object[]} mainPlaylists\n * The playlists found on the master playlist object\n *\n * @return {Object}\n * Promise that resolves when the key session has been created\n */\n\n\nvar waitForKeySessionCreation = function waitForKeySessionCreation(_ref) {\n var player = _ref.player,\n sourceKeySystems = _ref.sourceKeySystems,\n audioMedia = _ref.audioMedia,\n mainPlaylists = _ref.mainPlaylists;\n\n if (!player.eme.initializeMediaKeys) {\n return Promise.resolve();\n } // TODO should all audio PSSH values be initialized for DRM?\n //\n // All unique video rendition pssh values are initialized for DRM, but here only\n // the initial audio playlist license is initialized. In theory, an encrypted\n // event should be fired if the user switches to an alternative audio playlist\n // where a license is required, but this case hasn't yet been tested. In addition, there\n // may be many alternate audio playlists unlikely to be used (e.g., multiple different\n // languages).\n\n\n var playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists;\n var keySystemsOptionsArr = getAllPsshKeySystemsOptions(playlists, Object.keys(sourceKeySystems));\n var initializationFinishedPromises = [];\n var keySessionCreatedPromises = []; // Since PSSH values are interpreted as initData, EME will dedupe any duplicates. The\n // only place where it should not be deduped is for ms-prefixed APIs, but the early\n // return for IE11 above, and the existence of modern EME APIs in addition to\n // ms-prefixed APIs on Edge should prevent this from being a concern.\n // initializeMediaKeys also won't use the webkit-prefixed APIs.\n\n keySystemsOptionsArr.forEach(function (keySystemsOptions) {\n keySessionCreatedPromises.push(new Promise(function (resolve, reject) {\n player.tech_.one('keysessioncreated', resolve);\n }));\n initializationFinishedPromises.push(new Promise(function (resolve, reject) {\n player.eme.initializeMediaKeys({\n keySystems: keySystemsOptions\n }, function (err) {\n if (err) {\n reject(err);\n return;\n }\n\n resolve();\n });\n }));\n }); // The reasons Promise.race is chosen over Promise.any:\n //\n // * Promise.any is only available in Safari 14+.\n // * None of these promises are expected to reject. If they do reject, it might be\n // better here for the race to surface the rejection, rather than mask it by using\n // Promise.any.\n\n return Promise.race([// If a session was previously created, these will all finish resolving without\n // creating a new session, otherwise it will take until the end of all license\n // requests, which is why the key session check is used (to make setup much faster).\n Promise.all(initializationFinishedPromises), // Once a single session is created, the browser knows DRM will be used.\n Promise.race(keySessionCreatedPromises)]);\n};\n/**\n * If the [eme](https://github.com/videojs/videojs-contrib-eme) plugin is available, and\n * there are keySystems on the source, sets up source options to prepare the source for\n * eme.\n *\n * @param {Object} player\n * The player instance\n * @param {Object[]} sourceKeySystems\n * The key systems options from the player source\n * @param {Object} media\n * The active media playlist\n * @param {Object} [audioMedia]\n * The active audio media playlist (optional)\n *\n * @return {boolean}\n * Whether or not options were configured and EME is available\n */\n\n\nvar setupEmeOptions = function setupEmeOptions(_ref2) {\n var player = _ref2.player,\n sourceKeySystems = _ref2.sourceKeySystems,\n media = _ref2.media,\n audioMedia = _ref2.audioMedia;\n var sourceOptions = emeKeySystems(sourceKeySystems, media, audioMedia);\n\n if (!sourceOptions) {\n return false;\n }\n\n player.currentSource().keySystems = sourceOptions; // eme handles the rest of the setup, so if it is missing\n // do nothing.\n\n if (sourceOptions && !player.eme) {\n videojs.log.warn('DRM encrypted source cannot be decrypted without a DRM plugin');\n return false;\n }\n\n return true;\n};\n\nvar getVhsLocalStorage = function getVhsLocalStorage() {\n if (!(global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage)) {\n return null;\n }\n\n var storedObject = global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage.getItem(LOCAL_STORAGE_KEY);\n\n if (!storedObject) {\n return null;\n }\n\n try {\n return JSON.parse(storedObject);\n } catch (e) {\n // someone may have tampered with the value\n return null;\n }\n};\n\nvar updateVhsLocalStorage = function updateVhsLocalStorage(options) {\n if (!(global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage)) {\n return false;\n }\n\n var objectToStore = getVhsLocalStorage();\n objectToStore = objectToStore ? videojs.mergeOptions(objectToStore, options) : options;\n\n try {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(objectToStore));\n } catch (e) {\n // Throws if storage is full (e.g., always on iOS 5+ Safari private mode, where\n // storage is set to 0).\n // https://developer.mozilla.org/en-US/docs/Web/API/Storage/setItem#Exceptions\n // No need to perform any operation.\n return false;\n }\n\n return objectToStore;\n};\n/**\n * Parses VHS-supported media types from data URIs. See\n * https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs\n * for information on data URIs.\n *\n * @param {string} dataUri\n * The data URI\n *\n * @return {string|Object}\n * The parsed object/string, or the original string if no supported media type\n * was found\n */\n\n\nvar expandDataUri = function expandDataUri(dataUri) {\n if (dataUri.toLowerCase().indexOf('data:application/vnd.videojs.vhs+json,') === 0) {\n return JSON.parse(dataUri.substring(dataUri.indexOf(',') + 1));\n } // no known case for this data URI, return the string as-is\n\n\n return dataUri;\n};\n/**\n * Whether the browser has built-in HLS support.\n */\n\n\nVhs.supportsNativeHls = function () {\n if (!(global_document__WEBPACK_IMPORTED_MODULE_1___default()) || !(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement)) {\n return false;\n }\n\n var video = global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video'); // native HLS is definitely not supported if HTML5 video isn't\n\n if (!videojs.getTech('Html5').isSupported()) {\n return false;\n } // HLS manifests can go by many mime-types\n\n\n var canPlay = [// Apple santioned\n 'application/vnd.apple.mpegurl', // Apple sanctioned for backwards compatibility\n 'audio/mpegurl', // Very common\n 'audio/x-mpegurl', // Very common\n 'application/x-mpegurl', // Included for completeness\n 'video/x-mpegurl', 'video/mpegurl', 'application/mpegurl'];\n return canPlay.some(function (canItPlay) {\n return /maybe|probably/i.test(video.canPlayType(canItPlay));\n });\n}();\n\nVhs.supportsNativeDash = function () {\n if (!(global_document__WEBPACK_IMPORTED_MODULE_1___default()) || !(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement) || !videojs.getTech('Html5').isSupported()) {\n return false;\n }\n\n return /maybe|probably/i.test(global_document__WEBPACK_IMPORTED_MODULE_1___default().createElement('video').canPlayType('application/dash+xml'));\n}();\n\nVhs.supportsTypeNatively = function (type) {\n if (type === 'hls') {\n return Vhs.supportsNativeHls;\n }\n\n if (type === 'dash') {\n return Vhs.supportsNativeDash;\n }\n\n return false;\n};\n/**\n * HLS is a source handler, not a tech. Make sure attempts to use it\n * as one do not cause exceptions.\n */\n\n\nVhs.isSupported = function () {\n return videojs.log.warn('HLS is no longer a tech. Please remove it from ' + 'your player\\'s techOrder.');\n};\n\nvar Component = videojs.getComponent('Component');\n/**\n * The Vhs Handler object, where we orchestrate all of the parts\n * of HLS to interact with video.js\n *\n * @class VhsHandler\n * @extends videojs.Component\n * @param {Object} source the soruce object\n * @param {Tech} tech the parent tech object\n * @param {Object} options optional and required options\n */\n\nvar VhsHandler = /*#__PURE__*/function (_Component) {\n (0,_babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_5__[\"default\"])(VhsHandler, _Component);\n\n function VhsHandler(source, tech, options) {\n var _this;\n\n _this = _Component.call(this, tech, videojs.mergeOptions(options.hls, options.vhs)) || this;\n\n if (options.hls && Object.keys(options.hls).length) {\n videojs.log.warn('Using hls options is deprecated. Please rename `hls` to `vhs` in your options object.');\n } // if a tech level `initialBandwidth` option was passed\n // use that over the VHS level `bandwidth` option\n\n\n if (typeof options.initialBandwidth === 'number') {\n _this.options_.bandwidth = options.initialBandwidth;\n }\n\n _this.logger_ = logger('VhsHandler'); // tech.player() is deprecated but setup a reference to HLS for\n // backwards-compatibility\n\n if (tech.options_ && tech.options_.playerId) {\n var _player = videojs(tech.options_.playerId);\n\n if (!_player.hasOwnProperty('hls')) {\n Object.defineProperty(_player, 'hls', {\n get: function get() {\n videojs.log.warn('player.hls is deprecated. Use player.tech().vhs instead.');\n tech.trigger({\n type: 'usage',\n name: 'hls-player-access'\n });\n return (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this);\n },\n configurable: true\n });\n }\n\n if (!_player.hasOwnProperty('vhs')) {\n Object.defineProperty(_player, 'vhs', {\n get: function get() {\n videojs.log.warn('player.vhs is deprecated. Use player.tech().vhs instead.');\n tech.trigger({\n type: 'usage',\n name: 'vhs-player-access'\n });\n return (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this);\n },\n configurable: true\n });\n }\n\n if (!_player.hasOwnProperty('dash')) {\n Object.defineProperty(_player, 'dash', {\n get: function get() {\n videojs.log.warn('player.dash is deprecated. Use player.tech().vhs instead.');\n return (0,_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_4__[\"default\"])(_this);\n },\n configurable: true\n });\n }\n\n _this.player_ = _player;\n }\n\n _this.tech_ = tech;\n _this.source_ = source;\n _this.stats = {};\n _this.ignoreNextSeekingEvent_ = false;\n\n _this.setOptions_();\n\n if (_this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) {\n tech.overrideNativeAudioTracks(true);\n tech.overrideNativeVideoTracks(true);\n } else if (_this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) {\n // overriding native HLS only works if audio tracks have been emulated\n // error early if we're misconfigured\n throw new Error('Overriding native HLS requires emulated tracks. ' + 'See https://git.io/vMpjB');\n } // listen for fullscreenchange events for this player so that we\n // can adjust our quality selection quickly\n\n\n _this.on((global_document__WEBPACK_IMPORTED_MODULE_1___default()), ['fullscreenchange', 'webkitfullscreenchange', 'mozfullscreenchange', 'MSFullscreenChange'], function (event) {\n var fullscreenElement = (global_document__WEBPACK_IMPORTED_MODULE_1___default().fullscreenElement) || (global_document__WEBPACK_IMPORTED_MODULE_1___default().webkitFullscreenElement) || (global_document__WEBPACK_IMPORTED_MODULE_1___default().mozFullScreenElement) || (global_document__WEBPACK_IMPORTED_MODULE_1___default().msFullscreenElement);\n\n if (fullscreenElement && fullscreenElement.contains(_this.tech_.el())) {\n _this.masterPlaylistController_.fastQualityChange_();\n } else {\n // When leaving fullscreen, since the in page pixel dimensions should be smaller\n // than full screen, see if there should be a rendition switch down to preserve\n // bandwidth.\n _this.masterPlaylistController_.checkABR_();\n }\n });\n\n _this.on(_this.tech_, 'seeking', function () {\n if (this.ignoreNextSeekingEvent_) {\n this.ignoreNextSeekingEvent_ = false;\n return;\n }\n\n this.setCurrentTime(this.tech_.currentTime());\n });\n\n _this.on(_this.tech_, 'error', function () {\n // verify that the error was real and we are loaded\n // enough to have mpc loaded.\n if (this.tech_.error() && this.masterPlaylistController_) {\n this.masterPlaylistController_.pauseLoading();\n }\n });\n\n _this.on(_this.tech_, 'play', _this.play);\n\n return _this;\n }\n\n var _proto = VhsHandler.prototype;\n\n _proto.setOptions_ = function setOptions_() {\n var _this2 = this; // defaults\n\n\n this.options_.withCredentials = this.options_.withCredentials || false;\n this.options_.handleManifestRedirects = this.options_.handleManifestRedirects === false ? false : true;\n this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true;\n this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false;\n this.options_.smoothQualityChange = this.options_.smoothQualityChange || false;\n this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== 'undefined' ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false;\n this.options_.useNetworkInformationApi = this.options_.useNetworkInformationApi || false;\n this.options_.useDtsForTimestampOffset = this.options_.useDtsForTimestampOffset || false;\n this.options_.customTagParsers = this.options_.customTagParsers || [];\n this.options_.customTagMappers = this.options_.customTagMappers || [];\n this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false;\n\n if (typeof this.options_.blacklistDuration !== 'number') {\n this.options_.blacklistDuration = 5 * 60;\n }\n\n if (typeof this.options_.bandwidth !== 'number') {\n if (this.options_.useBandwidthFromLocalStorage) {\n var storedObject = getVhsLocalStorage();\n\n if (storedObject && storedObject.bandwidth) {\n this.options_.bandwidth = storedObject.bandwidth;\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-bandwidth-from-local-storage'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-bandwidth-from-local-storage'\n });\n }\n\n if (storedObject && storedObject.throughput) {\n this.options_.throughput = storedObject.throughput;\n this.tech_.trigger({\n type: 'usage',\n name: 'vhs-throughput-from-local-storage'\n });\n this.tech_.trigger({\n type: 'usage',\n name: 'hls-throughput-from-local-storage'\n });\n }\n }\n } // if bandwidth was not set by options or pulled from local storage, start playlist\n // selection at a reasonable bandwidth\n\n\n if (typeof this.options_.bandwidth !== 'number') {\n this.options_.bandwidth = Config.INITIAL_BANDWIDTH;\n } // If the bandwidth number is unchanged from the initial setting\n // then this takes precedence over the enableLowInitialPlaylist option\n\n\n this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config.INITIAL_BANDWIDTH; // grab options passed to player.src\n\n ['withCredentials', 'useDevicePixelRatio', 'limitRenditionByPlayerDimensions', 'bandwidth', 'smoothQualityChange', 'customTagParsers', 'customTagMappers', 'handleManifestRedirects', 'cacheEncryptionKeys', 'playlistSelector', 'initialPlaylistSelector', 'experimentalBufferBasedABR', 'liveRangeSafeTimeDelta', 'experimentalLLHLS', 'useNetworkInformationApi', 'useDtsForTimestampOffset', 'experimentalExactManifestTimings', 'experimentalLeastPixelDiffSelector'].forEach(function (option) {\n if (typeof _this2.source_[option] !== 'undefined') {\n _this2.options_[option] = _this2.source_[option];\n }\n });\n this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions;\n this.useDevicePixelRatio = this.options_.useDevicePixelRatio;\n }\n /**\n * called when player.src gets called, handle a new source\n *\n * @param {Object} src the source object to handle\n */\n ;\n\n _proto.src = function src(_src, type) {\n var _this3 = this; // do nothing if the src is falsey\n\n\n if (!_src) {\n return;\n }\n\n this.setOptions_(); // add master playlist controller options\n\n this.options_.src = expandDataUri(this.source_.src);\n this.options_.tech = this.tech_;\n this.options_.externVhs = Vhs;\n this.options_.sourceType = (0,_videojs_vhs_utils_es_media_types_js__WEBPACK_IMPORTED_MODULE_14__.simpleTypeFromSourceType)(type); // Whenever we seek internally, we should update the tech\n\n this.options_.seekTo = function (time) {\n _this3.tech_.setCurrentTime(time);\n };\n\n if (this.options_.smoothQualityChange) {\n videojs.log.warn('smoothQualityChange is deprecated and will be removed in the next major version');\n }\n\n this.masterPlaylistController_ = new MasterPlaylistController(this.options_);\n var playbackWatcherOptions = videojs.mergeOptions({\n liveRangeSafeTimeDelta: SAFE_TIME_DELTA\n }, this.options_, {\n seekable: function seekable() {\n return _this3.seekable();\n },\n media: function media() {\n return _this3.masterPlaylistController_.media();\n },\n masterPlaylistController: this.masterPlaylistController_\n });\n this.playbackWatcher_ = new PlaybackWatcher(playbackWatcherOptions);\n this.masterPlaylistController_.on('error', function () {\n var player = videojs.players[_this3.tech_.options_.playerId];\n var error = _this3.masterPlaylistController_.error;\n\n if (typeof error === 'object' && !error.code) {\n error.code = 3;\n } else if (typeof error === 'string') {\n error = {\n message: error,\n code: 3\n };\n }\n\n player.error(error);\n });\n var defaultSelector = this.options_.experimentalBufferBasedABR ? Vhs.movingAverageBandwidthSelector(0.55) : Vhs.STANDARD_PLAYLIST_SELECTOR; // `this` in selectPlaylist should be the VhsHandler for backwards\n // compatibility with < v2\n\n this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this);\n this.masterPlaylistController_.selectInitialPlaylist = Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this); // re-expose some internal objects for backwards compatibility with < v2\n\n this.playlists = this.masterPlaylistController_.masterPlaylistLoader_;\n this.mediaSource = this.masterPlaylistController_.mediaSource; // Proxy assignment of some properties to the master playlist\n // controller. Using a custom property for backwards compatibility\n // with < v2\n\n Object.defineProperties(this, {\n selectPlaylist: {\n get: function get() {\n return this.masterPlaylistController_.selectPlaylist;\n },\n set: function set(selectPlaylist) {\n this.masterPlaylistController_.selectPlaylist = selectPlaylist.bind(this);\n }\n },\n throughput: {\n get: function get() {\n return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate;\n },\n set: function set(throughput) {\n this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = throughput; // By setting `count` to 1 the throughput value becomes the starting value\n // for the cumulative average\n\n this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1;\n }\n },\n bandwidth: {\n get: function get() {\n var playerBandwidthEst = this.masterPlaylistController_.mainSegmentLoader_.bandwidth;\n var networkInformation = (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).connection || (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).mozConnection || (global_window__WEBPACK_IMPORTED_MODULE_0___default().navigator).webkitConnection;\n var tenMbpsAsBitsPerSecond = 10e6;\n\n if (this.options_.useNetworkInformationApi && networkInformation) {\n // downlink returns Mbps\n // https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/downlink\n var networkInfoBandwidthEstBitsPerSec = networkInformation.downlink * 1000 * 1000; // downlink maxes out at 10 Mbps. In the event that both networkInformationApi and the player\n // estimate a bandwidth greater than 10 Mbps, use the larger of the two estimates to ensure that\n // high quality streams are not filtered out.\n\n if (networkInfoBandwidthEstBitsPerSec >= tenMbpsAsBitsPerSecond && playerBandwidthEst >= tenMbpsAsBitsPerSecond) {\n playerBandwidthEst = Math.max(playerBandwidthEst, networkInfoBandwidthEstBitsPerSec);\n } else {\n playerBandwidthEst = networkInfoBandwidthEstBitsPerSec;\n }\n }\n\n return playerBandwidthEst;\n },\n set: function set(bandwidth) {\n this.masterPlaylistController_.mainSegmentLoader_.bandwidth = bandwidth; // setting the bandwidth manually resets the throughput counter\n // `count` is set to zero that current value of `rate` isn't included\n // in the cumulative average\n\n this.masterPlaylistController_.mainSegmentLoader_.throughput = {\n rate: 0,\n count: 0\n };\n }\n },\n\n /**\n * `systemBandwidth` is a combination of two serial processes bit-rates. The first\n * is the network bitrate provided by `bandwidth` and the second is the bitrate of\n * the entire process after that - decryption, transmuxing, and appending - provided\n * by `throughput`.\n *\n * Since the two process are serial, the overall system bandwidth is given by:\n * sysBandwidth = 1 / (1 / bandwidth + 1 / throughput)\n */\n systemBandwidth: {\n get: function get() {\n var invBandwidth = 1 / (this.bandwidth || 1);\n var invThroughput;\n\n if (this.throughput > 0) {\n invThroughput = 1 / this.throughput;\n } else {\n invThroughput = 0;\n }\n\n var systemBitrate = Math.floor(1 / (invBandwidth + invThroughput));\n return systemBitrate;\n },\n set: function set() {\n videojs.log.error('The \"systemBandwidth\" property is read-only');\n }\n }\n });\n\n if (this.options_.bandwidth) {\n this.bandwidth = this.options_.bandwidth;\n }\n\n if (this.options_.throughput) {\n this.throughput = this.options_.throughput;\n }\n\n Object.defineProperties(this.stats, {\n bandwidth: {\n get: function get() {\n return _this3.bandwidth || 0;\n },\n enumerable: true\n },\n mediaRequests: {\n get: function get() {\n return _this3.masterPlaylistController_.mediaRequests_() || 0;\n },\n enumerable: true\n },\n mediaRequestsAborted: {\n get: function get() {\n return _this3.masterPlaylistController_.mediaRequestsAborted_() || 0;\n },\n enumerable: true\n },\n mediaRequestsTimedout: {\n get: function get() {\n return _this3.masterPlaylistController_.mediaRequestsTimedout_() || 0;\n },\n enumerable: true\n },\n mediaRequestsErrored: {\n get: function get() {\n return _this3.masterPlaylistController_.mediaRequestsErrored_() || 0;\n },\n enumerable: true\n },\n mediaTransferDuration: {\n get: function get() {\n return _this3.masterPlaylistController_.mediaTransferDuration_() || 0;\n },\n enumerable: true\n },\n mediaBytesTransferred: {\n get: function get() {\n return _this3.masterPlaylistController_.mediaBytesTransferred_() || 0;\n },\n enumerable: true\n },\n mediaSecondsLoaded: {\n get: function get() {\n return _this3.masterPlaylistController_.mediaSecondsLoaded_() || 0;\n },\n enumerable: true\n },\n mediaAppends: {\n get: function get() {\n return _this3.masterPlaylistController_.mediaAppends_() || 0;\n },\n enumerable: true\n },\n mainAppendsToLoadedData: {\n get: function get() {\n return _this3.masterPlaylistController_.mainAppendsToLoadedData_() || 0;\n },\n enumerable: true\n },\n audioAppendsToLoadedData: {\n get: function get() {\n return _this3.masterPlaylistController_.audioAppendsToLoadedData_() || 0;\n },\n enumerable: true\n },\n appendsToLoadedData: {\n get: function get() {\n return _this3.masterPlaylistController_.appendsToLoadedData_() || 0;\n },\n enumerable: true\n },\n timeToLoadedData: {\n get: function get() {\n return _this3.masterPlaylistController_.timeToLoadedData_() || 0;\n },\n enumerable: true\n },\n buffered: {\n get: function get() {\n return timeRangesToArray(_this3.tech_.buffered());\n },\n enumerable: true\n },\n currentTime: {\n get: function get() {\n return _this3.tech_.currentTime();\n },\n enumerable: true\n },\n currentSource: {\n get: function get() {\n return _this3.tech_.currentSource_;\n },\n enumerable: true\n },\n currentTech: {\n get: function get() {\n return _this3.tech_.name_;\n },\n enumerable: true\n },\n duration: {\n get: function get() {\n return _this3.tech_.duration();\n },\n enumerable: true\n },\n master: {\n get: function get() {\n return _this3.playlists.master;\n },\n enumerable: true\n },\n playerDimensions: {\n get: function get() {\n return _this3.tech_.currentDimensions();\n },\n enumerable: true\n },\n seekable: {\n get: function get() {\n return timeRangesToArray(_this3.tech_.seekable());\n },\n enumerable: true\n },\n timestamp: {\n get: function get() {\n return Date.now();\n },\n enumerable: true\n },\n videoPlaybackQuality: {\n get: function get() {\n return _this3.tech_.getVideoPlaybackQuality();\n },\n enumerable: true\n }\n });\n this.tech_.one('canplay', this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_));\n this.tech_.on('bandwidthupdate', function () {\n if (_this3.options_.useBandwidthFromLocalStorage) {\n updateVhsLocalStorage({\n bandwidth: _this3.bandwidth,\n throughput: Math.round(_this3.throughput)\n });\n }\n });\n this.masterPlaylistController_.on('selectedinitialmedia', function () {\n // Add the manual rendition mix-in to VhsHandler\n renditionSelectionMixin(_this3);\n });\n this.masterPlaylistController_.sourceUpdater_.on('createdsourcebuffers', function () {\n _this3.setupEme_();\n }); // the bandwidth of the primary segment loader is our best\n // estimate of overall bandwidth\n\n this.on(this.masterPlaylistController_, 'progress', function () {\n this.tech_.trigger('progress');\n }); // In the live case, we need to ignore the very first `seeking` event since\n // that will be the result of the seek-to-live behavior\n\n this.on(this.masterPlaylistController_, 'firstplay', function () {\n this.ignoreNextSeekingEvent_ = true;\n });\n this.setupQualityLevels_(); // do nothing if the tech has been disposed already\n // this can occur if someone sets the src in player.ready(), for instance\n\n if (!this.tech_.el()) {\n return;\n }\n\n this.mediaSourceUrl_ = global_window__WEBPACK_IMPORTED_MODULE_0___default().URL.createObjectURL(this.masterPlaylistController_.mediaSource);\n this.tech_.src(this.mediaSourceUrl_);\n };\n\n _proto.createKeySessions_ = function createKeySessions_() {\n var _this4 = this;\n\n var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;\n this.logger_('waiting for EME key session creation');\n waitForKeySessionCreation({\n player: this.player_,\n sourceKeySystems: this.source_.keySystems,\n audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(),\n mainPlaylists: this.playlists.master.playlists\n }).then(function () {\n _this4.logger_('created EME key session');\n\n _this4.masterPlaylistController_.sourceUpdater_.initializedEme();\n })[\"catch\"](function (err) {\n _this4.logger_('error while creating EME key session', err);\n\n _this4.player_.error({\n message: 'Failed to initialize media keys for EME',\n code: 3\n });\n });\n };\n\n _proto.handleWaitingForKey_ = function handleWaitingForKey_() {\n // If waitingforkey is fired, it's possible that the data that's necessary to retrieve\n // the key is in the manifest. While this should've happened on initial source load, it\n // may happen again in live streams where the keys change, and the manifest info\n // reflects the update.\n //\n // Because videojs-contrib-eme compares the PSSH data we send to that of PSSH data it's\n // already requested keys for, we don't have to worry about this generating extraneous\n // requests.\n this.logger_('waitingforkey fired, attempting to create any new key sessions');\n this.createKeySessions_();\n }\n /**\n * If necessary and EME is available, sets up EME options and waits for key session\n * creation.\n *\n * This function also updates the source updater so taht it can be used, as for some\n * browsers, EME must be configured before content is appended (if appending unencrypted\n * content before encrypted content).\n */\n ;\n\n _proto.setupEme_ = function setupEme_() {\n var _this5 = this;\n\n var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;\n var didSetupEmeOptions = setupEmeOptions({\n player: this.player_,\n sourceKeySystems: this.source_.keySystems,\n media: this.playlists.media(),\n audioMedia: audioPlaylistLoader && audioPlaylistLoader.media()\n });\n this.player_.tech_.on('keystatuschange', function (e) {\n if (e.status !== 'output-restricted') {\n return;\n }\n\n var masterPlaylist = _this5.masterPlaylistController_.master();\n\n if (!masterPlaylist || !masterPlaylist.playlists) {\n return;\n }\n\n var excludedHDPlaylists = []; // Assume all HD streams are unplayable and exclude them from ABR selection\n\n masterPlaylist.playlists.forEach(function (playlist) {\n if (playlist && playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height >= 720) {\n if (!playlist.excludeUntil || playlist.excludeUntil < Infinity) {\n playlist.excludeUntil = Infinity;\n excludedHDPlaylists.push(playlist);\n }\n }\n });\n\n if (excludedHDPlaylists.length) {\n var _videojs$log;\n\n (_videojs$log = videojs.log).warn.apply(_videojs$log, ['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.'].concat(excludedHDPlaylists)); // Clear the buffer before switching playlists, since it may already contain unplayable segments\n\n\n _this5.masterPlaylistController_.fastQualityChange_();\n }\n });\n this.handleWaitingForKey_ = this.handleWaitingForKey_.bind(this);\n this.player_.tech_.on('waitingforkey', this.handleWaitingForKey_); // In IE11 this is too early to initialize media keys, and IE11 does not support\n // promises.\n\n if (videojs.browser.IE_VERSION === 11 || !didSetupEmeOptions) {\n // If EME options were not set up, we've done all we could to initialize EME.\n this.masterPlaylistController_.sourceUpdater_.initializedEme();\n return;\n }\n\n this.createKeySessions_();\n }\n /**\n * Initializes the quality levels and sets listeners to update them.\n *\n * @method setupQualityLevels_\n * @private\n */\n ;\n\n _proto.setupQualityLevels_ = function setupQualityLevels_() {\n var _this6 = this;\n\n var player = videojs.players[this.tech_.options_.playerId]; // if there isn't a player or there isn't a qualityLevels plugin\n // or qualityLevels_ listeners have already been setup, do nothing.\n\n if (!player || !player.qualityLevels || this.qualityLevels_) {\n return;\n }\n\n this.qualityLevels_ = player.qualityLevels();\n this.masterPlaylistController_.on('selectedinitialmedia', function () {\n handleVhsLoadedMetadata(_this6.qualityLevels_, _this6);\n });\n this.playlists.on('mediachange', function () {\n handleVhsMediaChange(_this6.qualityLevels_, _this6.playlists);\n });\n }\n /**\n * return the version\n */\n ;\n\n VhsHandler.version = function version$5() {\n return {\n '@videojs/http-streaming': version$4,\n 'mux.js': version$3,\n 'mpd-parser': version$2,\n 'm3u8-parser': version$1,\n 'aes-decrypter': version\n };\n }\n /**\n * return the version\n */\n ;\n\n _proto.version = function version() {\n return this.constructor.version();\n };\n\n _proto.canChangeType = function canChangeType() {\n return SourceUpdater.canChangeType();\n }\n /**\n * Begin playing the video.\n */\n ;\n\n _proto.play = function play() {\n this.masterPlaylistController_.play();\n }\n /**\n * a wrapper around the function in MasterPlaylistController\n */\n ;\n\n _proto.setCurrentTime = function setCurrentTime(currentTime) {\n this.masterPlaylistController_.setCurrentTime(currentTime);\n }\n /**\n * a wrapper around the function in MasterPlaylistController\n */\n ;\n\n _proto.duration = function duration() {\n return this.masterPlaylistController_.duration();\n }\n /**\n * a wrapper around the function in MasterPlaylistController\n */\n ;\n\n _proto.seekable = function seekable() {\n return this.masterPlaylistController_.seekable();\n }\n /**\n * Abort all outstanding work and cleanup.\n */\n ;\n\n _proto.dispose = function dispose() {\n if (this.playbackWatcher_) {\n this.playbackWatcher_.dispose();\n }\n\n if (this.masterPlaylistController_) {\n this.masterPlaylistController_.dispose();\n }\n\n if (this.qualityLevels_) {\n this.qualityLevels_.dispose();\n }\n\n if (this.player_) {\n delete this.player_.vhs;\n delete this.player_.dash;\n delete this.player_.hls;\n }\n\n if (this.tech_ && this.tech_.vhs) {\n delete this.tech_.vhs;\n } // don't check this.tech_.hls as it will log a deprecated warning\n\n\n if (this.tech_) {\n delete this.tech_.hls;\n }\n\n if (this.mediaSourceUrl_ && (global_window__WEBPACK_IMPORTED_MODULE_0___default().URL).revokeObjectURL) {\n global_window__WEBPACK_IMPORTED_MODULE_0___default().URL.revokeObjectURL(this.mediaSourceUrl_);\n this.mediaSourceUrl_ = null;\n }\n\n if (this.tech_) {\n this.tech_.off('waitingforkey', this.handleWaitingForKey_);\n }\n\n _Component.prototype.dispose.call(this);\n };\n\n _proto.convertToProgramTime = function convertToProgramTime(time, callback) {\n return getProgramTime({\n playlist: this.masterPlaylistController_.media(),\n time: time,\n callback: callback\n });\n } // the player must be playing before calling this\n ;\n\n _proto.seekToProgramTime = function seekToProgramTime$1(programTime, callback, pauseAfterSeek, retryCount) {\n if (pauseAfterSeek === void 0) {\n pauseAfterSeek = true;\n }\n\n if (retryCount === void 0) {\n retryCount = 2;\n }\n\n return seekToProgramTime({\n programTime: programTime,\n playlist: this.masterPlaylistController_.media(),\n retryCount: retryCount,\n pauseAfterSeek: pauseAfterSeek,\n seekTo: this.options_.seekTo,\n tech: this.options_.tech,\n callback: callback\n });\n };\n\n return VhsHandler;\n}(Component);\n/**\n * The Source Handler object, which informs video.js what additional\n * MIME types are supported and sets up playback. It is registered\n * automatically to the appropriate tech based on the capabilities of\n * the browser it is running in. It is not necessary to use or modify\n * this object in normal usage.\n */\n\n\nvar VhsSourceHandler = {\n name: 'videojs-http-streaming',\n VERSION: version$4,\n canHandleSource: function canHandleSource(srcObj, options) {\n if (options === void 0) {\n options = {};\n }\n\n var localOptions = videojs.mergeOptions(videojs.options, options);\n return VhsSourceHandler.canPlayType(srcObj.type, localOptions);\n },\n handleSource: function handleSource(source, tech, options) {\n if (options === void 0) {\n options = {};\n }\n\n var localOptions = videojs.mergeOptions(videojs.options, options);\n tech.vhs = new VhsHandler(source, tech, localOptions);\n\n if (!videojs.hasOwnProperty('hls')) {\n Object.defineProperty(tech, 'hls', {\n get: function get() {\n videojs.log.warn('player.tech().hls is deprecated. Use player.tech().vhs instead.');\n return tech.vhs;\n },\n configurable: true\n });\n }\n\n tech.vhs.xhr = xhrFactory();\n tech.vhs.src(source.src, source.type);\n return tech.vhs;\n },\n canPlayType: function canPlayType(type, options) {\n var simpleType = (0,_videojs_vhs_utils_es_media_types_js__WEBPACK_IMPORTED_MODULE_14__.simpleTypeFromSourceType)(type);\n\n if (!simpleType) {\n return '';\n }\n\n var overrideNative = VhsSourceHandler.getOverrideNative(options);\n var supportsTypeNatively = Vhs.supportsTypeNatively(simpleType);\n var canUseMsePlayback = !supportsTypeNatively || overrideNative;\n return canUseMsePlayback ? 'maybe' : '';\n },\n getOverrideNative: function getOverrideNative(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$vhs = _options.vhs,\n vhs = _options$vhs === void 0 ? {} : _options$vhs,\n _options$hls = _options.hls,\n hls = _options$hls === void 0 ? {} : _options$hls;\n var defaultOverrideNative = !(videojs.browser.IS_ANY_SAFARI || videojs.browser.IS_IOS);\n var _vhs$overrideNative = vhs.overrideNative,\n overrideNative = _vhs$overrideNative === void 0 ? defaultOverrideNative : _vhs$overrideNative;\n var _hls$overrideNative = hls.overrideNative,\n legacyOverrideNative = _hls$overrideNative === void 0 ? false : _hls$overrideNative;\n return legacyOverrideNative || overrideNative;\n }\n};\n/**\n * Check to see if the native MediaSource object exists and supports\n * an MP4 container with both H.264 video and AAC-LC audio.\n *\n * @return {boolean} if native media sources are supported\n */\n\nvar supportsNativeMediaSources = function supportsNativeMediaSources() {\n return (0,_videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_13__.browserSupportsCodec)('avc1.4d400d,mp4a.40.2');\n}; // register source handlers with the appropriate techs\n\n\nif (supportsNativeMediaSources()) {\n videojs.getTech('Html5').registerSourceHandler(VhsSourceHandler, 0);\n}\n\nvideojs.VhsHandler = VhsHandler;\nObject.defineProperty(videojs, 'HlsHandler', {\n get: function get() {\n videojs.log.warn('videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead.');\n return VhsHandler;\n },\n configurable: true\n});\nvideojs.VhsSourceHandler = VhsSourceHandler;\nObject.defineProperty(videojs, 'HlsSourceHandler', {\n get: function get() {\n videojs.log.warn('videojs.HlsSourceHandler is deprecated. ' + 'Use videojs.VhsSourceHandler instead.');\n return VhsSourceHandler;\n },\n configurable: true\n});\nvideojs.Vhs = Vhs;\nObject.defineProperty(videojs, 'Hls', {\n get: function get() {\n videojs.log.warn('videojs.Hls is deprecated. Use videojs.Vhs instead.');\n return Vhs;\n },\n configurable: true\n});\n\nif (!videojs.use) {\n videojs.registerComponent('Hls', Vhs);\n videojs.registerComponent('Vhs', Vhs);\n}\n\nvideojs.options.vhs = videojs.options.vhs || {};\nvideojs.options.hls = videojs.options.hls || {};\n\nif (!videojs.getPlugin || !videojs.getPlugin('reloadSourceOnError')) {\n var registerPlugin = videojs.registerPlugin || videojs.plugin;\n registerPlugin('reloadSourceOnError', reloadSourceOnError);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (videojs);\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-contrib-dash/node_modules/video.js/dist/video.es.js?")},"./node_modules/videojs-vtt.js/lib/browser-index.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Default exports for Node. Export the extended versions of VTTCue and\n// VTTRegion in Node since we likely want the capability to convert back and\n// forth between JSON. If we don\'t then it\'s not that big of a deal since we\'re\n// off browser.\n\nvar window = __webpack_require__(/*! global/window */ "./node_modules/global/window.js");\n\nvar vttjs = module.exports = {\n WebVTT: __webpack_require__(/*! ./vtt.js */ "./node_modules/videojs-vtt.js/lib/vtt.js"),\n VTTCue: __webpack_require__(/*! ./vttcue.js */ "./node_modules/videojs-vtt.js/lib/vttcue.js"),\n VTTRegion: __webpack_require__(/*! ./vttregion.js */ "./node_modules/videojs-vtt.js/lib/vttregion.js")\n};\n\nwindow.vttjs = vttjs;\nwindow.WebVTT = vttjs.WebVTT;\n\nvar cueShim = vttjs.VTTCue;\nvar regionShim = vttjs.VTTRegion;\nvar nativeVTTCue = window.VTTCue;\nvar nativeVTTRegion = window.VTTRegion;\n\nvttjs.shim = function() {\n window.VTTCue = cueShim;\n window.VTTRegion = regionShim;\n};\n\nvttjs.restore = function() {\n window.VTTCue = nativeVTTCue;\n window.VTTRegion = nativeVTTRegion;\n};\n\nif (!window.VTTCue) {\n vttjs.shim();\n}\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-vtt.js/lib/browser-index.js?')},"./node_modules/videojs-vtt.js/lib/vtt.js":(module,__unused_webpack_exports,__webpack_require__)=>{eval('/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */\n/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */\nvar document = __webpack_require__(/*! global/document */ "./node_modules/global/document.js");\n\nvar _objCreate = Object.create || (function() {\n function F() {}\n return function(o) {\n if (arguments.length !== 1) {\n throw new Error(\'Object.create shim only accepts one parameter.\');\n }\n F.prototype = o;\n return new F();\n };\n})();\n\n// Creates a new ParserError object from an errorData object. The errorData\n// object should have default code and message properties. The default message\n// property can be overriden by passing in a message parameter.\n// See ParsingError.Errors below for acceptable errors.\nfunction ParsingError(errorData, message) {\n this.name = "ParsingError";\n this.code = errorData.code;\n this.message = message || errorData.message;\n}\nParsingError.prototype = _objCreate(Error.prototype);\nParsingError.prototype.constructor = ParsingError;\n\n// ParsingError metadata for acceptable ParsingErrors.\nParsingError.Errors = {\n BadSignature: {\n code: 0,\n message: "Malformed WebVTT signature."\n },\n BadTimeStamp: {\n code: 1,\n message: "Malformed time stamp."\n }\n};\n\n// Try to parse input as a time stamp.\nfunction parseTimeStamp(input) {\n\n function computeSeconds(h, m, s, f) {\n return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;\n }\n\n var m = input.match(/^(\\d+):(\\d{1,2})(:\\d{1,2})?\\.(\\d{3})/);\n if (!m) {\n return null;\n }\n\n if (m[3]) {\n // Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds]\n return computeSeconds(m[1], m[2], m[3].replace(":", ""), m[4]);\n } else if (m[1] > 59) {\n // Timestamp takes the form of [hours]:[minutes].[milliseconds]\n // First position is hours as it\'s over 59.\n return computeSeconds(m[1], m[2], 0, m[4]);\n } else {\n // Timestamp takes the form of [minutes]:[seconds].[milliseconds]\n return computeSeconds(0, m[1], m[2], m[4]);\n }\n}\n\n// A settings object holds key/value pairs and will ignore anything but the first\n// assignment to a specific key.\nfunction Settings() {\n this.values = _objCreate(null);\n}\n\nSettings.prototype = {\n // Only accept the first assignment to any key.\n set: function(k, v) {\n if (!this.get(k) && v !== "") {\n this.values[k] = v;\n }\n },\n // Return the value for a key, or a default value.\n // If \'defaultKey\' is passed then \'dflt\' is assumed to be an object with\n // a number of possible default values as properties where \'defaultKey\' is\n // the key of the property that will be chosen; otherwise it\'s assumed to be\n // a single value.\n get: function(k, dflt, defaultKey) {\n if (defaultKey) {\n return this.has(k) ? this.values[k] : dflt[defaultKey];\n }\n return this.has(k) ? this.values[k] : dflt;\n },\n // Check whether we have a value for a key.\n has: function(k) {\n return k in this.values;\n },\n // Accept a setting if its one of the given alternatives.\n alt: function(k, v, a) {\n for (var n = 0; n < a.length; ++n) {\n if (v === a[n]) {\n this.set(k, v);\n break;\n }\n }\n },\n // Accept a setting if its a valid (signed) integer.\n integer: function(k, v) {\n if (/^-?\\d+$/.test(v)) { // integer\n this.set(k, parseInt(v, 10));\n }\n },\n // Accept a setting if its a valid percentage.\n percent: function(k, v) {\n var m;\n if ((m = v.match(/^([\\d]{1,3})(\\.[\\d]*)?%$/))) {\n v = parseFloat(v);\n if (v >= 0 && v <= 100) {\n this.set(k, v);\n return true;\n }\n }\n return false;\n }\n};\n\n// Helper function to parse input into groups separated by \'groupDelim\', and\n// interprete each group as a key/value pair separated by \'keyValueDelim\'.\nfunction parseOptions(input, callback, keyValueDelim, groupDelim) {\n var groups = groupDelim ? input.split(groupDelim) : [input];\n for (var i in groups) {\n if (typeof groups[i] !== "string") {\n continue;\n }\n var kv = groups[i].split(keyValueDelim);\n if (kv.length !== 2) {\n continue;\n }\n var k = kv[0].trim();\n var v = kv[1].trim();\n callback(k, v);\n }\n}\n\nfunction parseCue(input, cue, regionList) {\n // Remember the original input if we need to throw an error.\n var oInput = input;\n // 4.1 WebVTT timestamp\n function consumeTimeStamp() {\n var ts = parseTimeStamp(input);\n if (ts === null) {\n throw new ParsingError(ParsingError.Errors.BadTimeStamp,\n "Malformed timestamp: " + oInput);\n }\n // Remove time stamp from input.\n input = input.replace(/^[^\\sa-zA-Z-]+/, "");\n return ts;\n }\n\n // 4.4.2 WebVTT cue settings\n function consumeCueSettings(input, cue) {\n var settings = new Settings();\n\n parseOptions(input, function (k, v) {\n switch (k) {\n case "region":\n // Find the last region we parsed with the same region id.\n for (var i = regionList.length - 1; i >= 0; i--) {\n if (regionList[i].id === v) {\n settings.set(k, regionList[i].region);\n break;\n }\n }\n break;\n case "vertical":\n settings.alt(k, v, ["rl", "lr"]);\n break;\n case "line":\n var vals = v.split(","),\n vals0 = vals[0];\n settings.integer(k, vals0);\n settings.percent(k, vals0) ? settings.set("snapToLines", false) : null;\n settings.alt(k, vals0, ["auto"]);\n if (vals.length === 2) {\n settings.alt("lineAlign", vals[1], ["start", "center", "end"]);\n }\n break;\n case "position":\n vals = v.split(",");\n settings.percent(k, vals[0]);\n if (vals.length === 2) {\n settings.alt("positionAlign", vals[1], ["start", "center", "end"]);\n }\n break;\n case "size":\n settings.percent(k, v);\n break;\n case "align":\n settings.alt(k, v, ["start", "center", "end", "left", "right"]);\n break;\n }\n }, /:/, /\\s/);\n\n // Apply default values for any missing fields.\n cue.region = settings.get("region", null);\n cue.vertical = settings.get("vertical", "");\n try {\n cue.line = settings.get("line", "auto");\n } catch (e) {}\n cue.lineAlign = settings.get("lineAlign", "start");\n cue.snapToLines = settings.get("snapToLines", true);\n cue.size = settings.get("size", 100);\n // Safari still uses the old middle value and won\'t accept center\n try {\n cue.align = settings.get("align", "center");\n } catch (e) {\n cue.align = settings.get("align", "middle");\n }\n try {\n cue.position = settings.get("position", "auto");\n } catch (e) {\n cue.position = settings.get("position", {\n start: 0,\n left: 0,\n center: 50,\n middle: 50,\n end: 100,\n right: 100\n }, cue.align);\n }\n\n\n cue.positionAlign = settings.get("positionAlign", {\n start: "start",\n left: "start",\n center: "center",\n middle: "center",\n end: "end",\n right: "end"\n }, cue.align);\n }\n\n function skipWhitespace() {\n input = input.replace(/^\\s+/, "");\n }\n\n // 4.1 WebVTT cue timings.\n skipWhitespace();\n cue.startTime = consumeTimeStamp(); // (1) collect cue start time\n skipWhitespace();\n if (input.substr(0, 3) !== "--\x3e") { // (3) next characters must match "--\x3e"\n throw new ParsingError(ParsingError.Errors.BadTimeStamp,\n "Malformed time stamp (time stamps must be separated by \'--\x3e\'): " +\n oInput);\n }\n input = input.substr(3);\n skipWhitespace();\n cue.endTime = consumeTimeStamp(); // (5) collect cue end time\n\n // 4.1 WebVTT cue settings list.\n skipWhitespace();\n consumeCueSettings(input, cue);\n}\n\n// When evaluating this file as part of a Webpack bundle for server\n// side rendering, `document` is an empty object.\nvar TEXTAREA_ELEMENT = document.createElement && document.createElement("textarea");\n\nvar TAG_NAME = {\n c: "span",\n i: "i",\n b: "b",\n u: "u",\n ruby: "ruby",\n rt: "rt",\n v: "span",\n lang: "span"\n};\n\n// 5.1 default text color\n// 5.2 default text background color is equivalent to text color with bg_ prefix\nvar DEFAULT_COLOR_CLASS = {\n white: \'rgba(255,255,255,1)\',\n lime: \'rgba(0,255,0,1)\',\n cyan: \'rgba(0,255,255,1)\',\n red: \'rgba(255,0,0,1)\',\n yellow: \'rgba(255,255,0,1)\',\n magenta: \'rgba(255,0,255,1)\',\n blue: \'rgba(0,0,255,1)\',\n black: \'rgba(0,0,0,1)\'\n};\n\nvar TAG_ANNOTATION = {\n v: "title",\n lang: "lang"\n};\n\nvar NEEDS_PARENT = {\n rt: "ruby"\n};\n\n// Parse content into a document fragment.\nfunction parseContent(window, input) {\n function nextToken() {\n // Check for end-of-string.\n if (!input) {\n return null;\n }\n\n // Consume \'n\' characters from the input.\n function consume(result) {\n input = input.substr(result.length);\n return result;\n }\n\n var m = input.match(/^([^<]*)(<[^>]*>?)?/);\n // If there is some text before the next tag, return it, otherwise return\n // the tag.\n return consume(m[1] ? m[1] : m[2]);\n }\n\n function unescape(s) {\n TEXTAREA_ELEMENT.innerHTML = s;\n s = TEXTAREA_ELEMENT.textContent;\n TEXTAREA_ELEMENT.textContent = "";\n return s;\n }\n\n function shouldAdd(current, element) {\n return !NEEDS_PARENT[element.localName] ||\n NEEDS_PARENT[element.localName] === current.localName;\n }\n\n // Create an element for this tag.\n function createElement(type, annotation) {\n var tagName = TAG_NAME[type];\n if (!tagName) {\n return null;\n }\n var element = window.document.createElement(tagName);\n var name = TAG_ANNOTATION[type];\n if (name && annotation) {\n element[name] = annotation.trim();\n }\n return element;\n }\n\n var rootDiv = window.document.createElement("div"),\n current = rootDiv,\n t,\n tagStack = [];\n\n while ((t = nextToken()) !== null) {\n if (t[0] === \'<\') {\n if (t[1] === "/") {\n // If the closing tag matches, move back up to the parent node.\n if (tagStack.length &&\n tagStack[tagStack.length - 1] === t.substr(2).replace(">", "")) {\n tagStack.pop();\n current = current.parentNode;\n }\n // Otherwise just ignore the end tag.\n continue;\n }\n var ts = parseTimeStamp(t.substr(1, t.length - 2));\n var node;\n if (ts) {\n // Timestamps are lead nodes as well.\n node = window.document.createProcessingInstruction("timestamp", ts);\n current.appendChild(node);\n continue;\n }\n var m = t.match(/^<([^.\\s/0-9>]+)(\\.[^\\s\\\\>]+)?([^>\\\\]+)?(\\\\?)>?$/);\n // If we can\'t parse the tag, skip to the next tag.\n if (!m) {\n continue;\n }\n // Try to construct an element, and ignore the tag if we couldn\'t.\n node = createElement(m[1], m[3]);\n if (!node) {\n continue;\n }\n // Determine if the tag should be added based on the context of where it\n // is placed in the cuetext.\n if (!shouldAdd(current, node)) {\n continue;\n }\n // Set the class list (as a list of classes, separated by space).\n if (m[2]) {\n var classes = m[2].split(\'.\');\n\n classes.forEach(function(cl) {\n var bgColor = /^bg_/.test(cl);\n // slice out `bg_` if it\'s a background color\n var colorName = bgColor ? cl.slice(3) : cl;\n\n if (DEFAULT_COLOR_CLASS.hasOwnProperty(colorName)) {\n var propName = bgColor ? \'background-color\' : \'color\';\n var propValue = DEFAULT_COLOR_CLASS[colorName];\n\n node.style[propName] = propValue;\n }\n });\n\n node.className = classes.join(\' \');\n }\n // Append the node to the current node, and enter the scope of the new\n // node.\n tagStack.push(m[1]);\n current.appendChild(node);\n current = node;\n continue;\n }\n\n // Text nodes are leaf nodes.\n current.appendChild(window.document.createTextNode(unescape(t)));\n }\n\n return rootDiv;\n}\n\n// This is a list of all the Unicode characters that have a strong\n// right-to-left category. What this means is that these characters are\n// written right-to-left for sure. It was generated by pulling all the strong\n// right-to-left characters out of the Unicode data table. That table can\n// found at: http://www.unicode.org/Public/UNIDATA/UnicodeData.txt\nvar strongRTLRanges = [[0x5be, 0x5be], [0x5c0, 0x5c0], [0x5c3, 0x5c3], [0x5c6, 0x5c6],\n [0x5d0, 0x5ea], [0x5f0, 0x5f4], [0x608, 0x608], [0x60b, 0x60b], [0x60d, 0x60d],\n [0x61b, 0x61b], [0x61e, 0x64a], [0x66d, 0x66f], [0x671, 0x6d5], [0x6e5, 0x6e6],\n [0x6ee, 0x6ef], [0x6fa, 0x70d], [0x70f, 0x710], [0x712, 0x72f], [0x74d, 0x7a5],\n [0x7b1, 0x7b1], [0x7c0, 0x7ea], [0x7f4, 0x7f5], [0x7fa, 0x7fa], [0x800, 0x815],\n [0x81a, 0x81a], [0x824, 0x824], [0x828, 0x828], [0x830, 0x83e], [0x840, 0x858],\n [0x85e, 0x85e], [0x8a0, 0x8a0], [0x8a2, 0x8ac], [0x200f, 0x200f],\n [0xfb1d, 0xfb1d], [0xfb1f, 0xfb28], [0xfb2a, 0xfb36], [0xfb38, 0xfb3c],\n [0xfb3e, 0xfb3e], [0xfb40, 0xfb41], [0xfb43, 0xfb44], [0xfb46, 0xfbc1],\n [0xfbd3, 0xfd3d], [0xfd50, 0xfd8f], [0xfd92, 0xfdc7], [0xfdf0, 0xfdfc],\n [0xfe70, 0xfe74], [0xfe76, 0xfefc], [0x10800, 0x10805], [0x10808, 0x10808],\n [0x1080a, 0x10835], [0x10837, 0x10838], [0x1083c, 0x1083c], [0x1083f, 0x10855],\n [0x10857, 0x1085f], [0x10900, 0x1091b], [0x10920, 0x10939], [0x1093f, 0x1093f],\n [0x10980, 0x109b7], [0x109be, 0x109bf], [0x10a00, 0x10a00], [0x10a10, 0x10a13],\n [0x10a15, 0x10a17], [0x10a19, 0x10a33], [0x10a40, 0x10a47], [0x10a50, 0x10a58],\n [0x10a60, 0x10a7f], [0x10b00, 0x10b35], [0x10b40, 0x10b55], [0x10b58, 0x10b72],\n [0x10b78, 0x10b7f], [0x10c00, 0x10c48], [0x1ee00, 0x1ee03], [0x1ee05, 0x1ee1f],\n [0x1ee21, 0x1ee22], [0x1ee24, 0x1ee24], [0x1ee27, 0x1ee27], [0x1ee29, 0x1ee32],\n [0x1ee34, 0x1ee37], [0x1ee39, 0x1ee39], [0x1ee3b, 0x1ee3b], [0x1ee42, 0x1ee42],\n [0x1ee47, 0x1ee47], [0x1ee49, 0x1ee49], [0x1ee4b, 0x1ee4b], [0x1ee4d, 0x1ee4f],\n [0x1ee51, 0x1ee52], [0x1ee54, 0x1ee54], [0x1ee57, 0x1ee57], [0x1ee59, 0x1ee59],\n [0x1ee5b, 0x1ee5b], [0x1ee5d, 0x1ee5d], [0x1ee5f, 0x1ee5f], [0x1ee61, 0x1ee62],\n [0x1ee64, 0x1ee64], [0x1ee67, 0x1ee6a], [0x1ee6c, 0x1ee72], [0x1ee74, 0x1ee77],\n [0x1ee79, 0x1ee7c], [0x1ee7e, 0x1ee7e], [0x1ee80, 0x1ee89], [0x1ee8b, 0x1ee9b],\n [0x1eea1, 0x1eea3], [0x1eea5, 0x1eea9], [0x1eeab, 0x1eebb], [0x10fffd, 0x10fffd]];\n\nfunction isStrongRTLChar(charCode) {\n for (var i = 0; i < strongRTLRanges.length; i++) {\n var currentRange = strongRTLRanges[i];\n if (charCode >= currentRange[0] && charCode <= currentRange[1]) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction determineBidi(cueDiv) {\n var nodeStack = [],\n text = "",\n charCode;\n\n if (!cueDiv || !cueDiv.childNodes) {\n return "ltr";\n }\n\n function pushNodes(nodeStack, node) {\n for (var i = node.childNodes.length - 1; i >= 0; i--) {\n nodeStack.push(node.childNodes[i]);\n }\n }\n\n function nextTextNode(nodeStack) {\n if (!nodeStack || !nodeStack.length) {\n return null;\n }\n\n var node = nodeStack.pop(),\n text = node.textContent || node.innerText;\n if (text) {\n // TODO: This should match all unicode type B characters (paragraph\n // separator characters). See issue #115.\n var m = text.match(/^.*(\\n|\\r)/);\n if (m) {\n nodeStack.length = 0;\n return m[0];\n }\n return text;\n }\n if (node.tagName === "ruby") {\n return nextTextNode(nodeStack);\n }\n if (node.childNodes) {\n pushNodes(nodeStack, node);\n return nextTextNode(nodeStack);\n }\n }\n\n pushNodes(nodeStack, cueDiv);\n while ((text = nextTextNode(nodeStack))) {\n for (var i = 0; i < text.length; i++) {\n charCode = text.charCodeAt(i);\n if (isStrongRTLChar(charCode)) {\n return "rtl";\n }\n }\n }\n return "ltr";\n}\n\nfunction computeLinePos(cue) {\n if (typeof cue.line === "number" &&\n (cue.snapToLines || (cue.line >= 0 && cue.line <= 100))) {\n return cue.line;\n }\n if (!cue.track || !cue.track.textTrackList ||\n !cue.track.textTrackList.mediaElement) {\n return -1;\n }\n var track = cue.track,\n trackList = track.textTrackList,\n count = 0;\n for (var i = 0; i < trackList.length && trackList[i] !== track; i++) {\n if (trackList[i].mode === "showing") {\n count++;\n }\n }\n return ++count * -1;\n}\n\nfunction StyleBox() {\n}\n\n// Apply styles to a div. If there is no div passed then it defaults to the\n// div on \'this\'.\nStyleBox.prototype.applyStyles = function(styles, div) {\n div = div || this.div;\n for (var prop in styles) {\n if (styles.hasOwnProperty(prop)) {\n div.style[prop] = styles[prop];\n }\n }\n};\n\nStyleBox.prototype.formatStyle = function(val, unit) {\n return val === 0 ? 0 : val + unit;\n};\n\n// Constructs the computed display state of the cue (a div). Places the div\n// into the overlay which should be a block level element (usually a div).\nfunction CueStyleBox(window, cue, styleOptions) {\n StyleBox.call(this);\n this.cue = cue;\n\n // Parse our cue\'s text into a DOM tree rooted at \'cueDiv\'. This div will\n // have inline positioning and will function as the cue background box.\n this.cueDiv = parseContent(window, cue.text);\n var styles = {\n color: "rgba(255, 255, 255, 1)",\n backgroundColor: "rgba(0, 0, 0, 0.8)",\n position: "relative",\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n display: "inline",\n writingMode: cue.vertical === "" ? "horizontal-tb"\n : cue.vertical === "lr" ? "vertical-lr"\n : "vertical-rl",\n unicodeBidi: "plaintext"\n };\n\n this.applyStyles(styles, this.cueDiv);\n\n // Create an absolutely positioned div that will be used to position the cue\n // div. Note, all WebVTT cue-setting alignments are equivalent to the CSS\n // mirrors of them except middle instead of center on Safari.\n this.div = window.document.createElement("div");\n styles = {\n direction: determineBidi(this.cueDiv),\n writingMode: cue.vertical === "" ? "horizontal-tb"\n : cue.vertical === "lr" ? "vertical-lr"\n : "vertical-rl",\n unicodeBidi: "plaintext",\n textAlign: cue.align === "middle" ? "center" : cue.align,\n font: styleOptions.font,\n whiteSpace: "pre-line",\n position: "absolute"\n };\n\n this.applyStyles(styles);\n this.div.appendChild(this.cueDiv);\n\n // Calculate the distance from the reference edge of the viewport to the text\n // position of the cue box. The reference edge will be resolved later when\n // the box orientation styles are applied.\n var textPos = 0;\n switch (cue.positionAlign) {\n case "start":\n case "line-left":\n textPos = cue.position;\n break;\n case "center":\n textPos = cue.position - (cue.size / 2);\n break;\n case "end":\n case "line-right":\n textPos = cue.position - cue.size;\n break;\n }\n\n // Horizontal box orientation; textPos is the distance from the left edge of the\n // area to the left edge of the box and cue.size is the distance extending to\n // the right from there.\n if (cue.vertical === "") {\n this.applyStyles({\n left: this.formatStyle(textPos, "%"),\n width: this.formatStyle(cue.size, "%")\n });\n // Vertical box orientation; textPos is the distance from the top edge of the\n // area to the top edge of the box and cue.size is the height extending\n // downwards from there.\n } else {\n this.applyStyles({\n top: this.formatStyle(textPos, "%"),\n height: this.formatStyle(cue.size, "%")\n });\n }\n\n this.move = function(box) {\n this.applyStyles({\n top: this.formatStyle(box.top, "px"),\n bottom: this.formatStyle(box.bottom, "px"),\n left: this.formatStyle(box.left, "px"),\n right: this.formatStyle(box.right, "px"),\n height: this.formatStyle(box.height, "px"),\n width: this.formatStyle(box.width, "px")\n });\n };\n}\nCueStyleBox.prototype = _objCreate(StyleBox.prototype);\nCueStyleBox.prototype.constructor = CueStyleBox;\n\n// Represents the co-ordinates of an Element in a way that we can easily\n// compute things with such as if it overlaps or intersects with another Element.\n// Can initialize it with either a StyleBox or another BoxPosition.\nfunction BoxPosition(obj) {\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of \'getBoundingClientRect\'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) &&\n rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div\'s lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max((rects[0] && rects[0].height) || 0, obj.height / rects.length)\n : 0;\n\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || (top + (obj.height || height));\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n}\n\n// Move the box along a particular axis. Optionally pass in an amount to move\n// the box. If no amount is passed then the default is the line height of the\n// box.\nBoxPosition.prototype.move = function(axis, toMove) {\n toMove = toMove !== undefined ? toMove : this.lineHeight;\n switch (axis) {\n case "+x":\n this.left += toMove;\n this.right += toMove;\n break;\n case "-x":\n this.left -= toMove;\n this.right -= toMove;\n break;\n case "+y":\n this.top += toMove;\n this.bottom += toMove;\n break;\n case "-y":\n this.top -= toMove;\n this.bottom -= toMove;\n break;\n }\n};\n\n// Check if this box overlaps another box, b2.\nBoxPosition.prototype.overlaps = function(b2) {\n return this.left < b2.right &&\n this.right > b2.left &&\n this.top < b2.bottom &&\n this.bottom > b2.top;\n};\n\n// Check if this box overlaps any other boxes in boxes.\nBoxPosition.prototype.overlapsAny = function(boxes) {\n for (var i = 0; i < boxes.length; i++) {\n if (this.overlaps(boxes[i])) {\n return true;\n }\n }\n return false;\n};\n\n// Check if this box is within another box.\nBoxPosition.prototype.within = function(container) {\n return this.top >= container.top &&\n this.bottom <= container.bottom &&\n this.left >= container.left &&\n this.right <= container.right;\n};\n\n// Check if this box is entirely within the container or it is overlapping\n// on the edge opposite of the axis direction passed. For example, if "+x" is\n// passed and the box is overlapping on the left edge of the container, then\n// return true.\nBoxPosition.prototype.overlapsOppositeAxis = function(container, axis) {\n switch (axis) {\n case "+x":\n return this.left < container.left;\n case "-x":\n return this.right > container.right;\n case "+y":\n return this.top < container.top;\n case "-y":\n return this.bottom > container.bottom;\n }\n};\n\n// Find the percentage of the area that this box is overlapping with another\n// box.\nBoxPosition.prototype.intersectPercentage = function(b2) {\n var x = Math.max(0, Math.min(this.right, b2.right) - Math.max(this.left, b2.left)),\n y = Math.max(0, Math.min(this.bottom, b2.bottom) - Math.max(this.top, b2.top)),\n intersectArea = x * y;\n return intersectArea / (this.height * this.width);\n};\n\n// Convert the positions from this box to CSS compatible positions using\n// the reference container\'s positions. This has to be done because this\n// box\'s positions are in reference to the viewport origin, whereas, CSS\n// values are in referecne to their respective edges.\nBoxPosition.prototype.toCSSCompatValues = function(reference) {\n return {\n top: this.top - reference.top,\n bottom: reference.bottom - this.bottom,\n left: this.left - reference.left,\n right: reference.right - this.right,\n height: this.height,\n width: this.width\n };\n};\n\n// Get an object that represents the box\'s position without anything extra.\n// Can pass a StyleBox, HTMLElement, or another BoxPositon.\nBoxPosition.getSimpleBoxPosition = function(obj) {\n var height = obj.div ? obj.div.offsetHeight : obj.tagName ? obj.offsetHeight : 0;\n var width = obj.div ? obj.div.offsetWidth : obj.tagName ? obj.offsetWidth : 0;\n var top = obj.div ? obj.div.offsetTop : obj.tagName ? obj.offsetTop : 0;\n\n obj = obj.div ? obj.div.getBoundingClientRect() :\n obj.tagName ? obj.getBoundingClientRect() : obj;\n var ret = {\n left: obj.left,\n right: obj.right,\n top: obj.top || top,\n height: obj.height || height,\n bottom: obj.bottom || (top + (obj.height || height)),\n width: obj.width || width\n };\n return ret;\n};\n\n// Move a StyleBox to its specified, or next best, position. The containerBox\n// is the box that contains the StyleBox, such as a div. boxPositions are\n// a list of other boxes that the styleBox can\'t overlap with.\nfunction moveBoxToLinePosition(window, styleBox, containerBox, boxPositions) {\n\n // Find the best position for a cue box, b, on the video. The axis parameter\n // is a list of axis, the order of which, it will move the box along. For example:\n // Passing ["+x", "-x"] will move the box first along the x axis in the positive\n // direction. If it doesn\'t find a good position for it there it will then move\n // it along the x axis in the negative direction.\n function findBestPosition(b, axis) {\n var bestPosition,\n specifiedPosition = new BoxPosition(b),\n percentage = 1; // Highest possible so the first thing we get is better.\n\n for (var i = 0; i < axis.length; i++) {\n while (b.overlapsOppositeAxis(containerBox, axis[i]) ||\n (b.within(containerBox) && b.overlapsAny(boxPositions))) {\n b.move(axis[i]);\n }\n // We found a spot where we aren\'t overlapping anything. This is our\n // best position.\n if (b.within(containerBox)) {\n return b;\n }\n var p = b.intersectPercentage(containerBox);\n // If we\'re outside the container box less then we were on our last try\n // then remember this position as the best position.\n if (percentage > p) {\n bestPosition = new BoxPosition(b);\n percentage = p;\n }\n // Reset the box position to the specified position.\n b = new BoxPosition(specifiedPosition);\n }\n return bestPosition || specifiedPosition;\n }\n\n var boxPosition = new BoxPosition(styleBox),\n cue = styleBox.cue,\n linePos = computeLinePos(cue),\n axis = [];\n\n // If we have a line number to align the cue to.\n if (cue.snapToLines) {\n var size;\n switch (cue.vertical) {\n case "":\n axis = [ "+y", "-y" ];\n size = "height";\n break;\n case "rl":\n axis = [ "+x", "-x" ];\n size = "width";\n break;\n case "lr":\n axis = [ "-x", "+x" ];\n size = "width";\n break;\n }\n\n var step = boxPosition.lineHeight,\n position = step * Math.round(linePos),\n maxPosition = containerBox[size] + step,\n initialAxis = axis[0];\n\n // If the specified intial position is greater then the max position then\n // clamp the box to the amount of steps it would take for the box to\n // reach the max position.\n if (Math.abs(position) > maxPosition) {\n position = position < 0 ? -1 : 1;\n position *= Math.ceil(maxPosition / step) * step;\n }\n\n // If computed line position returns negative then line numbers are\n // relative to the bottom of the video instead of the top. Therefore, we\n // need to increase our initial position by the length or width of the\n // video, depending on the writing direction, and reverse our axis directions.\n if (linePos < 0) {\n position += cue.vertical === "" ? containerBox.height : containerBox.width;\n axis = axis.reverse();\n }\n\n // Move the box to the specified position. This may not be its best\n // position.\n boxPosition.move(initialAxis, position);\n\n } else {\n // If we have a percentage line value for the cue.\n var calculatedPercentage = (boxPosition.lineHeight / containerBox.height) * 100;\n\n switch (cue.lineAlign) {\n case "center":\n linePos -= (calculatedPercentage / 2);\n break;\n case "end":\n linePos -= calculatedPercentage;\n break;\n }\n\n // Apply initial line position to the cue box.\n switch (cue.vertical) {\n case "":\n styleBox.applyStyles({\n top: styleBox.formatStyle(linePos, "%")\n });\n break;\n case "rl":\n styleBox.applyStyles({\n left: styleBox.formatStyle(linePos, "%")\n });\n break;\n case "lr":\n styleBox.applyStyles({\n right: styleBox.formatStyle(linePos, "%")\n });\n break;\n }\n\n axis = [ "+y", "-x", "+x", "-y" ];\n\n // Get the box position again after we\'ve applied the specified positioning\n // to it.\n boxPosition = new BoxPosition(styleBox);\n }\n\n var bestPosition = findBestPosition(boxPosition, axis);\n styleBox.move(bestPosition.toCSSCompatValues(containerBox));\n}\n\nfunction WebVTT() {\n // Nothing\n}\n\n// Helper to allow strings to be decoded instead of the default binary utf8 data.\nWebVTT.StringDecoder = function() {\n return {\n decode: function(data) {\n if (!data) {\n return "";\n }\n if (typeof data !== "string") {\n throw new Error("Error - expected string data.");\n }\n return decodeURIComponent(encodeURIComponent(data));\n }\n };\n};\n\nWebVTT.convertCueToDOMTree = function(window, cuetext) {\n if (!window || !cuetext) {\n return null;\n }\n return parseContent(window, cuetext);\n};\n\nvar FONT_SIZE_PERCENT = 0.05;\nvar FONT_STYLE = "sans-serif";\nvar CUE_BACKGROUND_PADDING = "1.5%";\n\n// Runs the processing model over the cues and regions passed to it.\n// @param overlay A block level element (usually a div) that the computed cues\n// and regions will be placed into.\nWebVTT.processCues = function(window, cues, overlay) {\n if (!window || !cues || !overlay) {\n return null;\n }\n\n // Remove all previous children.\n while (overlay.firstChild) {\n overlay.removeChild(overlay.firstChild);\n }\n\n var paddedOverlay = window.document.createElement("div");\n paddedOverlay.style.position = "absolute";\n paddedOverlay.style.left = "0";\n paddedOverlay.style.right = "0";\n paddedOverlay.style.top = "0";\n paddedOverlay.style.bottom = "0";\n paddedOverlay.style.margin = CUE_BACKGROUND_PADDING;\n overlay.appendChild(paddedOverlay);\n\n // Determine if we need to compute the display states of the cues. This could\n // be the case if a cue\'s state has been changed since the last computation or\n // if it has not been computed yet.\n function shouldCompute(cues) {\n for (var i = 0; i < cues.length; i++) {\n if (cues[i].hasBeenReset || !cues[i].displayState) {\n return true;\n }\n }\n return false;\n }\n\n // We don\'t need to recompute the cues\' display states. Just reuse them.\n if (!shouldCompute(cues)) {\n for (var i = 0; i < cues.length; i++) {\n paddedOverlay.appendChild(cues[i].displayState);\n }\n return;\n }\n\n var boxPositions = [],\n containerBox = BoxPosition.getSimpleBoxPosition(paddedOverlay),\n fontSize = Math.round(containerBox.height * FONT_SIZE_PERCENT * 100) / 100;\n var styleOptions = {\n font: fontSize + "px " + FONT_STYLE\n };\n\n (function() {\n var styleBox, cue;\n\n for (var i = 0; i < cues.length; i++) {\n cue = cues[i];\n\n // Compute the intial position and styles of the cue div.\n styleBox = new CueStyleBox(window, cue, styleOptions);\n paddedOverlay.appendChild(styleBox.div);\n\n // Move the cue div to it\'s correct line position.\n moveBoxToLinePosition(window, styleBox, containerBox, boxPositions);\n\n // Remember the computed div so that we don\'t have to recompute it later\n // if we don\'t have too.\n cue.displayState = styleBox.div;\n\n boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox));\n }\n })();\n};\n\nWebVTT.Parser = function(window, vttjs, decoder) {\n if (!decoder) {\n decoder = vttjs;\n vttjs = {};\n }\n if (!vttjs) {\n vttjs = {};\n }\n\n this.window = window;\n this.vttjs = vttjs;\n this.state = "INITIAL";\n this.buffer = "";\n this.decoder = decoder || new TextDecoder("utf8");\n this.regionList = [];\n};\n\nWebVTT.Parser.prototype = {\n // If the error is a ParsingError then report it to the consumer if\n // possible. If it\'s not a ParsingError then throw it like normal.\n reportOrThrowError: function(e) {\n if (e instanceof ParsingError) {\n this.onparsingerror && this.onparsingerror(e);\n } else {\n throw e;\n }\n },\n parse: function (data) {\n var self = this;\n\n // If there is no data then we won\'t decode it, but will just try to parse\n // whatever is in buffer already. This may occur in circumstances, for\n // example when flush() is called.\n if (data) {\n // Try to decode the data that we received.\n self.buffer += self.decoder.decode(data, {stream: true});\n }\n\n function collectNextLine() {\n var buffer = self.buffer;\n var pos = 0;\n while (pos < buffer.length && buffer[pos] !== \'\\r\' && buffer[pos] !== \'\\n\') {\n ++pos;\n }\n var line = buffer.substr(0, pos);\n // Advance the buffer early in case we fail below.\n if (buffer[pos] === \'\\r\') {\n ++pos;\n }\n if (buffer[pos] === \'\\n\') {\n ++pos;\n }\n self.buffer = buffer.substr(pos);\n return line;\n }\n\n // 3.4 WebVTT region and WebVTT region settings syntax\n function parseRegion(input) {\n var settings = new Settings();\n\n parseOptions(input, function (k, v) {\n switch (k) {\n case "id":\n settings.set(k, v);\n break;\n case "width":\n settings.percent(k, v);\n break;\n case "lines":\n settings.integer(k, v);\n break;\n case "regionanchor":\n case "viewportanchor":\n var xy = v.split(\',\');\n if (xy.length !== 2) {\n break;\n }\n // We have to make sure both x and y parse, so use a temporary\n // settings object here.\n var anchor = new Settings();\n anchor.percent("x", xy[0]);\n anchor.percent("y", xy[1]);\n if (!anchor.has("x") || !anchor.has("y")) {\n break;\n }\n settings.set(k + "X", anchor.get("x"));\n settings.set(k + "Y", anchor.get("y"));\n break;\n case "scroll":\n settings.alt(k, v, ["up"]);\n break;\n }\n }, /=/, /\\s/);\n\n // Create the region, using default values for any values that were not\n // specified.\n if (settings.has("id")) {\n var region = new (self.vttjs.VTTRegion || self.window.VTTRegion)();\n region.width = settings.get("width", 100);\n region.lines = settings.get("lines", 3);\n region.regionAnchorX = settings.get("regionanchorX", 0);\n region.regionAnchorY = settings.get("regionanchorY", 100);\n region.viewportAnchorX = settings.get("viewportanchorX", 0);\n region.viewportAnchorY = settings.get("viewportanchorY", 100);\n region.scroll = settings.get("scroll", "");\n // Register the region.\n self.onregion && self.onregion(region);\n // Remember the VTTRegion for later in case we parse any VTTCues that\n // reference it.\n self.regionList.push({\n id: settings.get("id"),\n region: region\n });\n }\n }\n\n // draft-pantos-http-live-streaming-20\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-3.5\n // 3.5 WebVTT\n function parseTimestampMap(input) {\n var settings = new Settings();\n\n parseOptions(input, function(k, v) {\n switch(k) {\n case "MPEGT":\n settings.integer(k + \'S\', v);\n break;\n case "LOCA":\n settings.set(k + \'L\', parseTimeStamp(v));\n break;\n }\n }, /[^\\d]:/, /,/);\n\n self.ontimestampmap && self.ontimestampmap({\n "MPEGTS": settings.get("MPEGTS"),\n "LOCAL": settings.get("LOCAL")\n });\n }\n\n // 3.2 WebVTT metadata header syntax\n function parseHeader(input) {\n if (input.match(/X-TIMESTAMP-MAP/)) {\n // This line contains HLS X-TIMESTAMP-MAP metadata\n parseOptions(input, function(k, v) {\n switch(k) {\n case "X-TIMESTAMP-MAP":\n parseTimestampMap(v);\n break;\n }\n }, /=/);\n } else {\n parseOptions(input, function (k, v) {\n switch (k) {\n case "Region":\n // 3.3 WebVTT region metadata header syntax\n parseRegion(v);\n break;\n }\n }, /:/);\n }\n\n }\n\n // 5.1 WebVTT file parsing.\n try {\n var line;\n if (self.state === "INITIAL") {\n // We can\'t start parsing until we have the first line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n line = collectNextLine();\n\n var m = line.match(/^WEBVTT([ \\t].*)?$/);\n if (!m || !m[0]) {\n throw new ParsingError(ParsingError.Errors.BadSignature);\n }\n\n self.state = "HEADER";\n }\n\n var alreadyCollectedLine = false;\n while (self.buffer) {\n // We can\'t parse a line until we have the full line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n\n if (!alreadyCollectedLine) {\n line = collectNextLine();\n } else {\n alreadyCollectedLine = false;\n }\n\n switch (self.state) {\n case "HEADER":\n // 13-18 - Allow a header (metadata) under the WEBVTT line.\n if (/:/.test(line)) {\n parseHeader(line);\n } else if (!line) {\n // An empty line terminates the header and starts the body (cues).\n self.state = "ID";\n }\n continue;\n case "NOTE":\n // Ignore NOTE blocks.\n if (!line) {\n self.state = "ID";\n }\n continue;\n case "ID":\n // Check for the start of NOTE blocks.\n if (/^NOTE($|[ \\t])/.test(line)) {\n self.state = "NOTE";\n break;\n }\n // 19-29 - Allow any number of line terminators, then initialize new cue values.\n if (!line) {\n continue;\n }\n self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, "");\n // Safari still uses the old middle value and won\'t accept center\n try {\n self.cue.align = "center";\n } catch (e) {\n self.cue.align = "middle";\n }\n self.state = "CUE";\n // 30-39 - Check if self line contains an optional identifier or timing data.\n if (line.indexOf("--\x3e") === -1) {\n self.cue.id = line;\n continue;\n }\n // Process line as start of a cue.\n /*falls through*/\n case "CUE":\n // 40 - Collect cue timings and settings.\n try {\n parseCue(line, self.cue, self.regionList);\n } catch (e) {\n self.reportOrThrowError(e);\n // In case of an error ignore rest of the cue.\n self.cue = null;\n self.state = "BADCUE";\n continue;\n }\n self.state = "CUETEXT";\n continue;\n case "CUETEXT":\n var hasSubstring = line.indexOf("--\x3e") !== -1;\n // 34 - If we have an empty line then report the cue.\n // 35 - If we have the special substring \'--\x3e\' then report the cue,\n // but do not collect the line as we need to process the current\n // one as a new cue.\n if (!line || hasSubstring && (alreadyCollectedLine = true)) {\n // We are done parsing self cue.\n self.oncue && self.oncue(self.cue);\n self.cue = null;\n self.state = "ID";\n continue;\n }\n if (self.cue.text) {\n self.cue.text += "\\n";\n }\n self.cue.text += line.replace(/\\u2028/g, \'\\n\').replace(/u2029/g, \'\\n\');\n continue;\n case "BADCUE": // BADCUE\n // 54-62 - Collect and discard the remaining cue.\n if (!line) {\n self.state = "ID";\n }\n continue;\n }\n }\n } catch (e) {\n self.reportOrThrowError(e);\n\n // If we are currently parsing a cue, report what we have.\n if (self.state === "CUETEXT" && self.cue && self.oncue) {\n self.oncue(self.cue);\n }\n self.cue = null;\n // Enter BADWEBVTT state if header was not parsed correctly otherwise\n // another exception occurred so enter BADCUE state.\n self.state = self.state === "INITIAL" ? "BADWEBVTT" : "BADCUE";\n }\n return this;\n },\n flush: function () {\n var self = this;\n try {\n // Finish decoding the stream.\n self.buffer += self.decoder.decode();\n // Synthesize the end of the current cue or region.\n if (self.cue || self.state === "HEADER") {\n self.buffer += "\\n\\n";\n self.parse();\n }\n // If we\'ve flushed, parsed, and we\'re still on the INITIAL state then\n // that means we don\'t have enough of the stream to parse the first\n // line.\n if (self.state === "INITIAL") {\n throw new ParsingError(ParsingError.Errors.BadSignature);\n }\n } catch(e) {\n self.reportOrThrowError(e);\n }\n self.onflush && self.onflush();\n return this;\n }\n};\n\nmodule.exports = WebVTT;\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-vtt.js/lib/vtt.js?')},"./node_modules/videojs-vtt.js/lib/vttcue.js":module=>{eval('/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar autoKeyword = "auto";\nvar directionSetting = {\n "": 1,\n "lr": 1,\n "rl": 1\n};\nvar alignSetting = {\n "start": 1,\n "center": 1,\n "end": 1,\n "left": 1,\n "right": 1,\n "auto": 1,\n "line-left": 1,\n "line-right": 1\n};\n\nfunction findDirectionSetting(value) {\n if (typeof value !== "string") {\n return false;\n }\n var dir = directionSetting[value.toLowerCase()];\n return dir ? value.toLowerCase() : false;\n}\n\nfunction findAlignSetting(value) {\n if (typeof value !== "string") {\n return false;\n }\n var align = alignSetting[value.toLowerCase()];\n return align ? value.toLowerCase() : false;\n}\n\nfunction VTTCue(startTime, endTime, text) {\n /**\n * Shim implementation specific properties. These properties are not in\n * the spec.\n */\n\n // Lets us know when the VTTCue\'s data has changed in such a way that we need\n // to recompute its display state. This lets us compute its display state\n // lazily.\n this.hasBeenReset = false;\n\n /**\n * VTTCue and TextTrackCue properties\n * http://dev.w3.org/html5/webvtt/#vttcue-interface\n */\n\n var _id = "";\n var _pauseOnExit = false;\n var _startTime = startTime;\n var _endTime = endTime;\n var _text = text;\n var _region = null;\n var _vertical = "";\n var _snapToLines = true;\n var _line = "auto";\n var _lineAlign = "start";\n var _position = "auto";\n var _positionAlign = "auto";\n var _size = 100;\n var _align = "center";\n\n Object.defineProperties(this, {\n "id": {\n enumerable: true,\n get: function() {\n return _id;\n },\n set: function(value) {\n _id = "" + value;\n }\n },\n\n "pauseOnExit": {\n enumerable: true,\n get: function() {\n return _pauseOnExit;\n },\n set: function(value) {\n _pauseOnExit = !!value;\n }\n },\n\n "startTime": {\n enumerable: true,\n get: function() {\n return _startTime;\n },\n set: function(value) {\n if (typeof value !== "number") {\n throw new TypeError("Start time must be set to a number.");\n }\n _startTime = value;\n this.hasBeenReset = true;\n }\n },\n\n "endTime": {\n enumerable: true,\n get: function() {\n return _endTime;\n },\n set: function(value) {\n if (typeof value !== "number") {\n throw new TypeError("End time must be set to a number.");\n }\n _endTime = value;\n this.hasBeenReset = true;\n }\n },\n\n "text": {\n enumerable: true,\n get: function() {\n return _text;\n },\n set: function(value) {\n _text = "" + value;\n this.hasBeenReset = true;\n }\n },\n\n "region": {\n enumerable: true,\n get: function() {\n return _region;\n },\n set: function(value) {\n _region = value;\n this.hasBeenReset = true;\n }\n },\n\n "vertical": {\n enumerable: true,\n get: function() {\n return _vertical;\n },\n set: function(value) {\n var setting = findDirectionSetting(value);\n // Have to check for false because the setting an be an empty string.\n if (setting === false) {\n throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");\n }\n _vertical = setting;\n this.hasBeenReset = true;\n }\n },\n\n "snapToLines": {\n enumerable: true,\n get: function() {\n return _snapToLines;\n },\n set: function(value) {\n _snapToLines = !!value;\n this.hasBeenReset = true;\n }\n },\n\n "line": {\n enumerable: true,\n get: function() {\n return _line;\n },\n set: function(value) {\n if (typeof value !== "number" && value !== autoKeyword) {\n throw new SyntaxError("Line: an invalid number or illegal string was specified.");\n }\n _line = value;\n this.hasBeenReset = true;\n }\n },\n\n "lineAlign": {\n enumerable: true,\n get: function() {\n return _lineAlign;\n },\n set: function(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n console.warn("lineAlign: an invalid or illegal string was specified.");\n } else {\n _lineAlign = setting;\n this.hasBeenReset = true;\n }\n }\n },\n\n "position": {\n enumerable: true,\n get: function() {\n return _position;\n },\n set: function(value) {\n if (value < 0 || value > 100) {\n throw new Error("Position must be between 0 and 100.");\n }\n _position = value;\n this.hasBeenReset = true;\n }\n },\n\n "positionAlign": {\n enumerable: true,\n get: function() {\n return _positionAlign;\n },\n set: function(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n console.warn("positionAlign: an invalid or illegal string was specified.");\n } else {\n _positionAlign = setting;\n this.hasBeenReset = true;\n }\n }\n },\n\n "size": {\n enumerable: true,\n get: function() {\n return _size;\n },\n set: function(value) {\n if (value < 0 || value > 100) {\n throw new Error("Size must be between 0 and 100.");\n }\n _size = value;\n this.hasBeenReset = true;\n }\n },\n\n "align": {\n enumerable: true,\n get: function() {\n return _align;\n },\n set: function(value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError("align: an invalid or illegal alignment string was specified.");\n }\n _align = setting;\n this.hasBeenReset = true;\n }\n }\n });\n\n /**\n * Other <track> spec defined properties\n */\n\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state\n this.displayState = undefined;\n}\n\n/**\n * VTTCue methods\n */\n\nVTTCue.prototype.getCueAsHTML = function() {\n // Assume WebVTT.convertCueToDOMTree is on the global.\n return WebVTT.convertCueToDOMTree(window, this.text);\n};\n\nmodule.exports = VTTCue;\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-vtt.js/lib/vttcue.js?')},"./node_modules/videojs-vtt.js/lib/vttregion.js":module=>{eval('/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar scrollSetting = {\n "": true,\n "up": true\n};\n\nfunction findScrollSetting(value) {\n if (typeof value !== "string") {\n return false;\n }\n var scroll = scrollSetting[value.toLowerCase()];\n return scroll ? value.toLowerCase() : false;\n}\n\nfunction isValidPercentValue(value) {\n return typeof value === "number" && (value >= 0 && value <= 100);\n}\n\n// VTTRegion shim http://dev.w3.org/html5/webvtt/#vttregion-interface\nfunction VTTRegion() {\n var _width = 100;\n var _lines = 3;\n var _regionAnchorX = 0;\n var _regionAnchorY = 100;\n var _viewportAnchorX = 0;\n var _viewportAnchorY = 100;\n var _scroll = "";\n\n Object.defineProperties(this, {\n "width": {\n enumerable: true,\n get: function() {\n return _width;\n },\n set: function(value) {\n if (!isValidPercentValue(value)) {\n throw new Error("Width must be between 0 and 100.");\n }\n _width = value;\n }\n },\n "lines": {\n enumerable: true,\n get: function() {\n return _lines;\n },\n set: function(value) {\n if (typeof value !== "number") {\n throw new TypeError("Lines must be set to a number.");\n }\n _lines = value;\n }\n },\n "regionAnchorY": {\n enumerable: true,\n get: function() {\n return _regionAnchorY;\n },\n set: function(value) {\n if (!isValidPercentValue(value)) {\n throw new Error("RegionAnchorX must be between 0 and 100.");\n }\n _regionAnchorY = value;\n }\n },\n "regionAnchorX": {\n enumerable: true,\n get: function() {\n return _regionAnchorX;\n },\n set: function(value) {\n if(!isValidPercentValue(value)) {\n throw new Error("RegionAnchorY must be between 0 and 100.");\n }\n _regionAnchorX = value;\n }\n },\n "viewportAnchorY": {\n enumerable: true,\n get: function() {\n return _viewportAnchorY;\n },\n set: function(value) {\n if (!isValidPercentValue(value)) {\n throw new Error("ViewportAnchorY must be between 0 and 100.");\n }\n _viewportAnchorY = value;\n }\n },\n "viewportAnchorX": {\n enumerable: true,\n get: function() {\n return _viewportAnchorX;\n },\n set: function(value) {\n if (!isValidPercentValue(value)) {\n throw new Error("ViewportAnchorX must be between 0 and 100.");\n }\n _viewportAnchorX = value;\n }\n },\n "scroll": {\n enumerable: true,\n get: function() {\n return _scroll;\n },\n set: function(value) {\n var setting = findScrollSetting(value);\n // Have to check for false as an empty string is a legal value.\n if (setting === false) {\n console.warn("Scroll: an invalid or illegal string was specified.");\n } else {\n _scroll = setting;\n }\n }\n }\n });\n}\n\nmodule.exports = VTTRegion;\n\n\n//# sourceURL=webpack://web/./node_modules/videojs-vtt.js/lib/vttregion.js?')},"./src/js/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _live_polemic__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./live-polemic */ "./src/js/live-polemic.js");\n/* harmony import */ var twitter_text__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! twitter-text */ "./node_modules/twitter-text/dist/esm/index.js");\nvar $ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"),\n jQuery = $;\n__webpack_require__(/*! jquery-ui */ "./node_modules/jquery-ui/ui/widget.js");\n__webpack_require__(/*! jquery.mousewheel */ "./node_modules/jquery.mousewheel/jquery.mousewheel.js");\n__webpack_require__(/*! jquery.scrollto */ "./node_modules/jquery.scrollto/jquery.scrollTo.js");\n__webpack_require__(/*! jquery.fancybox */ "./node_modules/jquery.fancybox/source/jquery.fancybox.pack.js");\n__webpack_require__(/*! video.js */ "./node_modules/video.js/dist/video.es.js");\n__webpack_require__(/*! dashjs */ "./node_modules/dashjs/dist/dash.all.min.js");\n__webpack_require__(/*! videojs-contrib-dash */ "./node_modules/videojs-contrib-dash/dist/videojs-dash.es.js");\n\n\n\n__webpack_require__.g.$ = $;\n__webpack_require__.g.jQuery = jQuery;\n__webpack_require__.g.twitter = twitter_text__WEBPACK_IMPORTED_MODULE_1__["default"];\n\n__webpack_require__.g.rolloverTweet = _live_polemic__WEBPACK_IMPORTED_MODULE_0__.rolloverTweet;\n__webpack_require__.g.selectTweet = _live_polemic__WEBPACK_IMPORTED_MODULE_0__.selectTweet;\n__webpack_require__.g.filtrerTexte = _live_polemic__WEBPACK_IMPORTED_MODULE_0__.filtrerTexte;\n__webpack_require__.g.tweetPopup = _live_polemic__WEBPACK_IMPORTED_MODULE_0__.tweetPopup;\n\n//# sourceURL=webpack://web/./src/js/index.js?')},"./src/js/live-polemic.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ filtrerTexte: () => (/* binding */ filtrerTexte),\n/* harmony export */ rolloverTweet: () => (/* binding */ rolloverTweet),\n/* harmony export */ selectTweet: () => (/* binding */ selectTweet),\n/* harmony export */ tweetPopup: () => (/* binding */ tweetPopup)\n/* harmony export */ });\n/* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! underscore */ "./node_modules/underscore/modules/index-all.js");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");\n/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var raphael__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! raphael */ "./node_modules/raphael/raphael.min.js");\n/* harmony import */ var raphael__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(raphael__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! dayjs */ "./node_modules/dayjs/dayjs.min.js");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_3__);\n\r\n\r\n\r\n\r\n\r\nfunction rejectUser(username) {\r\n return (/^[A-Z][a-z]{2,8}[0-9]{4,6}$/.test(username))\r\n}\r\n\r\nif (typeof annotations == "undefined" || !annotations) {\r\n var annotations = {\r\n "default" : {\r\n "colors" : {\r\n "h" : 0,\r\n "s" : 0\r\n }\r\n },\r\n "positive" : {\r\n "display_name" : "++ | accord",\r\n "keywords" : [ /\\+\\+/ ],\r\n "colors" : {\r\n "h" : .3,\r\n "s" : .65\r\n }\r\n },\r\n "negative" : {\r\n "display_name" : "-- | désaccord",\r\n "keywords" : [ /\\-\\-/ ],\r\n "colors" : {\r\n "h" : 0,\r\n "s" : .8\r\n }\r\n },\r\n "reference" : {\r\n "display_name" : "== | référence",\r\n "keywords" : [ /\\=\\=/ ],\r\n "colors" : {\r\n "h" : .16,\r\n "s" : .8\r\n }\r\n },\r\n "question" : {\r\n "display_name" : "?? | question",\r\n "keywords" : [ /\\?\\?/ ],\r\n "colors" : {\r\n "h" : .6,\r\n "s" : .8\r\n }\r\n }\r\n } \r\n}\r\n\r\nfunction getGlobal(varkey, defaultValue) {\r\n return typeof(__webpack_require__.g[varkey]) == "undefined" ? defaultValue : __webpack_require__.g[varkey];\r\n}\r\n\r\n//var i10n = getGlobal(\'i10n\', { "rechercher" : "Rechercher" });\r\n\r\nvar suggested_keywords = getGlobal(\'suggested_keywords\',[]);\r\n\r\nvar max_pages = getGlobal(\'max_pages\', 5);\r\n\r\nvar social_network = getGlobal(\'social_network\', \'Twitter\');\r\n\r\ntracking_keywords = (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(getGlobal(\'tracking_keywords\', [])).map(function(_w) {\r\n return _w.toLowerCase();\r\n});\r\n\r\nvar twCx = {\r\n tlPaper : null,\r\n followLast : true,\r\n position : "0",\r\n currentIdIndex: 0,\r\n date_levels : [\r\n 3600 * 1000,\r\n 15 * 60 * 1000,\r\n 5 * 60 * 1000,\r\n 60 * 1000\r\n ],\r\n timeLevel : 1,\r\n deltaX : 40,\r\n tlWidth : 150,\r\n tlHeight : 480,\r\n globalWords : {},\r\n suggestCount : (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(suggested_keywords).map(function(_w) {\r\n return {\r\n "word" : _w,\r\n "rgxp" : new RegExp(_w.replace(/(\\W)/g, \'\\\\$1\'), "im"),\r\n "freq" : 0,\r\n "annotations" : {}\r\n }\r\n }),\r\n refMouse : { x : 0, y : 0},\r\n refPosTl : { x : 0, y : 0},\r\n tlMouseMoved : false,\r\n tlMouseClicked : false,\r\n filtre : null,\r\n tlBuffer : \'\',\r\n relHover : [],\r\n wheelDelta : 0,\r\n scrollEnabled : false,\r\n scrollExtent : 8000 - 480,\r\n lastScrollPos : 0,\r\n urlRegExp : /https?:\\/\\/[0-9a-zA-Z\\.%\\/-_]+/g,\r\n wordRegExp : /[^ \\.&;,\'"!\\?\\d\\(\\)\\+\\[\\]\\\\\\…\\-«»:\\/]{3,}/g,\r\n stopWords : [\r\n \'aussi\', \'and\', \'avec\', \'aux\', \'bien\', \'car\', \'cette\', \'comme\', \'dans\', \'donc\', \'des\', \'elle\', \'encore\', \'est\',\r\n \'être\', \'eux\', \'faire\', \'fait\', \'http\', \'ici\', \'ils\', \'les\', \'leur\', \'leurs\', \'mais\', \'mes\', \'même\', \'mon\', \'notre\',\r\n \'non\', \'nos\', \'nous\', \'ont\', \'oui\', \'par\', \'pas\', \'peu\', \'peut\', \'plus\', \'pour\', \'que\', \'qui\', \'ses\' ,\'son\', \'sont\', \'sur\',\r\n \'tes\', \'très\', \'the\', \'ton\', \'tous\', \'tout\', \'une\', \'votre\', \'vos\', \'vous\'\r\n ]\r\n }\r\n\r\nfunction getTweets(options) {\r\n \r\n function getTweetUrl(url) {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default().getJSON(url, function(data) {\r\n options.tweets = options.tweets.concat(data.statuses);\r\n options.currentPage++;\r\n if (options.cbData) {\r\n options.cbData();\r\n }\r\n var _isLast = true;\r\n if (data.results && data.results.length) {\r\n var _oldestTweetId = data.results[data.results.length - 1].id_str,\r\n _maxId = _oldestTweetId;\r\n if (options.currentPage < options.pages) {\r\n _isLast = false;\r\n getTweetUrl(baseurl + firstparams + \'&max_id=\' + _maxId + lastparams);\r\n }\r\n }\r\n if (_isLast) {\r\n options.tweets.sort(function(a,b) {\r\n return a.id.localeCompare(b.id); \r\n });\r\n if (options.cbEnd) {\r\n options.cbEnd();\r\n }\r\n }\r\n });\r\n }\r\n \r\n options.tweets = [];\r\n options.pages || (options.pages = 1);\r\n options.rpp || (options.rpp = 100);\r\n options.currentPage = 0;\r\n\r\n var urlParams = {\r\n tweet_mode: \'extended\',\r\n q: options.keyword,\r\n count: options.rpp\r\n };\r\n if ( options.lang ) {\r\n urlParams.lang = options.lang;\r\n }\r\n if ( options.since_id ) {\r\n urlParams.since_id = options.since_id;\r\n }\r\n urlParams.social_network = options.social_network?options.social_network:"Twitter";\r\n\r\n var jsonurl = "search_tweets.php?"+jquery__WEBPACK_IMPORTED_MODULE_1___default().param(urlParams);\r\n getTweetUrl(jsonurl);\r\n}\r\n\r\nfunction getColor(annotation, lum) {\r\n return raphael__WEBPACK_IMPORTED_MODULE_2___default().hsl2rgb(annotations[annotation].colors.h, annotations[annotation].colors.s, lum);\r\n}\r\n\r\nfunction tweetPopup(url) {\r\n var popW = 550,\r\n popH = 350,\r\n scrW = screen.width,\r\n scrH = screen.height,\r\n posX = Math.round((scrW/2)-(popW/2)),\r\n posY = (scrH > popH ? Math.round((scrH/2)-(popH/2)) : 0);\r\n window.open(url,\r\n \'\',\r\n \'left=\' + posX + \',top=\' + posY + \',width=\' + popW + \',height=\' + popH + \',personalbar=0,toolbar=0,scrollbars=1,resizable=1\');\r\n}\r\n\r\nfunction arc(source, target) {\r\n var x3 = .3 * target.y - .3 * source.y + .8 * source.x + .2 * target.x;\r\n var y3 = .8 * source.y + .2 * target.y - .3 * target.x + .3 * source.x;\r\n var x4 = .3 * target.y - .3 * source.y + .2 * source.x + .8 * target.x;\r\n var y4 = .2 * source.y + .8 * target.y - .3 * target.x + .3 * source.x;\r\n return "M" + source.x + " " + source.y + "C" + [x3, y3, x4, y4, target.x, target.y].join(" ");\r\n}\r\n\r\nfunction addTweet(tweet) {\r\n if (!tweet) {\r\n console.log(tweet);\r\n return;\r\n }\r\n \r\n if (rejectUser(tweet.from_user)) {\r\n return;\r\n }\r\n \r\n function backRef(source_id, target_id, type) {\r\n var target = tweetById(target_id);\r\n if (target) {\r\n var brobj = {\r\n "referenced_by_id" : source_id,\r\n "type" : type\r\n }\r\n if (target.backRefs) {\r\n target.backRefs.push(brobj);\r\n } else {\r\n target.backRefs = [ brobj ]\r\n }\r\n }\r\n }\r\n \r\n (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])([\'id\', \'from_user_id\', \'in_reply_to_status_id\']).each(function(_i) {\r\n if(typeof(tweet[_i + \'_str\']) == \'undefined\') return;\r\n tweet[_i] = tweet[_i + \'_str\'];\r\n delete tweet[_i + \'_str\']; \r\n });\r\n \r\n if ((0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(twCx.idIndex).indexOf(tweet.id) != -1) {\r\n return;\r\n }\r\n \r\n tweet.html_parts = []\r\n \r\n if (tweet.entities && tweet.entities.user_mentions) {\r\n for (var _i = 0; _i < tweet.entities.user_mentions.length; _i++) {\r\n var _m = tweet.entities.user_mentions[_i];\r\n tweet.html_parts.push({\r\n "text" : "@" + _m.screen_name,\r\n "start" : _m.indices[0],\r\n "end" : _m.indices[1],\r\n "link" :\'<a href="http://twitter.com/\' + _m.screen_name + \'" onclick="filtrerTexte(\\\'\' + _m.screen_name + \'\\\'); return false;" target="_blank">\'\r\n });\r\n }\r\n }\r\n \r\n if (tweet.entities && tweet.entities.hashtags) {\r\n for (var _i = 0; _i < tweet.entities.hashtags.length; _i++) {\r\n var _m = tweet.entities.hashtags[_i],\r\n _h = "#" + _m.text;\r\n tweet.html_parts.push({\r\n "text" : _h,\r\n "start" : _m.indices[0],\r\n "end" : _m.indices[1],\r\n "link" :\'<a href="http://twitter.com/search?q=\' + encodeURIComponent(_h) + \'" onclick="filtrerTexte(\\\'\' + underscore__WEBPACK_IMPORTED_MODULE_0__["default"].escape(_h) + \'\\\'); return false;" target="_blank">\'\r\n });\r\n }\r\n }\r\n \r\n if (tweet.entities && tweet.entities.urls) {\r\n for (var _i = 0; _i < tweet.entities.urls.length; _i++) {\r\n var _m = tweet.entities.urls[_i];\r\n tweet.html_parts.push({\r\n "text" : _m.display_url || _m.url,\r\n "start" : _m.indices[0],\r\n "end" : _m.indices[1],\r\n "link" :\'<a href="\' + _m.url + \'" target="_blank">\'\r\n });\r\n }\r\n }\r\n tweet.date_value = dayjs__WEBPACK_IMPORTED_MODULE_3___default()(tweet.created_at).valueOf();\r\n \r\n var ann = [];\r\n for (var j in annotations) {\r\n if (j != "default") {\r\n for (var k in annotations[j].keywords) {\r\n var tweetText = tweet.full_text;\r\n if (tweetText.search(annotations[j].keywords[k]) != -1) {\r\n ann.push(j);\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n tweet.annotations = ann;\r\n\r\n if (tweet.in_reply_to_status_id) {\r\n backRef( tweet.id, tweet.in_reply_to_status_id, "reply" );\r\n }\r\n \r\n if (tweet.retweeted_status && tweet.retweeted_status.id_str) {\r\n \ttweet.retweeted_status_id = tweet.retweeted_status.id_str;\r\n backRef( tweet.id, tweet.retweeted_status_id, "retweet" );\r\n }\r\n \r\n \r\n var tab = tweet.full_text.replace(twCx.urlRegExp,\'\').match(twCx.wordRegExp);\r\n (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(tab).each(function(w) {\r\n var word = w.toLowerCase();\r\n if ((0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(twCx.stopWords).indexOf(word) == -1 && (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(tracking_keywords).indexOf(word) == -1 && word[0] != \'@\') {\r\n if (twCx.globalWords[word]) {\r\n twCx.globalWords[word].freq++;\r\n } else {\r\n twCx.globalWords[word] = {\r\n "freq" : 1,\r\n "annotations" : {}\r\n }\r\n for (var j in annotations) {\r\n if (j != \'default\') {\r\n twCx.globalWords[word].annotations[j] = 0;\r\n }\r\n }\r\n }\r\n for (var j in ann) {\r\n if (typeof twCx.globalWords[word].annotations != "undefined") {\r\n twCx.globalWords[word].annotations[ann[j]]++;\r\n }\r\n }\r\n }\r\n });\r\n \r\n (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(twCx.suggestCount).each(function(_k) {\r\n if (tweet.full_text.search(_k.rgxp) != -1) {\r\n _k.freq++;\r\n (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(ann).each(function(_a) {\r\n _k.annotations[_a] = 1 + ( _k.annotations[_a] || 0 )\r\n })\r\n }\r\n });\r\n \r\n \r\n var p = twCx.idIndex.length;\r\n while (p && tweet.id < twCx.idIndex[p-1]) {\r\n p--;\r\n }\r\n twCx.tweets.splice(p, 0, tweet);\r\n twCx.idIndex.splice(p, 0, tweet.id);\r\n \r\n if (!twCx.timeline.length) {\r\n twCx.timeline = [ populateDateStruct(0, twCx.date_levels[0] * parseInt(tweet.date_value / twCx.date_levels[0])) ]\r\n }\r\n while (tweet.date_value > twCx.timeline[twCx.timeline.length - 1].end) {\r\n twCx.timeline.push( populateDateStruct(0, twCx.timeline[twCx.timeline.length - 1].end) );\r\n }\r\n \r\n insertIntoDateStruct(twCx.timeline, tweet);\r\n}\r\n\r\nfunction getSliceContent(slice) {\r\n if (slice.slices) {\r\n var result = [];\r\n for (var i in slice.slices) {\r\n result = result.concat(getSliceContent(slice.slices[i]));\r\n }\r\n } else {\r\n var result = slice.tweets;\r\n }\r\n return result;\r\n}\r\n\r\nfunction flattenDateStruct(slices, target_level) {\r\n\tif (!slices || !slices.length) {\r\n\t\treturn [];\r\n\t}\r\n var current_level = slices[0].level,\r\n result = [];\r\n if (current_level < target_level) {\r\n if (slices[0].slices) {\r\n for (var i in slices) {\r\n result = result.concat(flattenDateStruct(slices[i].slices, target_level));\r\n }\r\n }\r\n }\r\n else {\r\n for (var i in slices) {\r\n result.push({\r\n "start" : slices[i].start,\r\n "end" : slices[i].end,\r\n "tweets" : getSliceContent(slices[i])\r\n });\r\n }\r\n }\r\n return result;\r\n}\r\n\r\nfunction trimFDS() {\r\n var slices = flattenDateStruct(twCx.timeline, twCx.timeLevel);\r\n if (!slices.length) { return []; }\r\n while (slices[0].tweets.length == 0) {\r\n slices.splice(0,1);\r\n }\r\n while (slices[slices.length - 1].tweets.length == 0) {\r\n slices.pop();\r\n } \r\n var centralTweet = ( twCx.centralTweet ? twCx.centralTweet : twCx.tweets[twCx.tweets.length - 1] ),\r\n delta = 30 * twCx.date_levels[twCx.timeLevel],\r\n centre = Math.min(slices[slices.length - 1].end - delta , Math.max(slices[0].start + delta, centralTweet.date_value)),\r\n min = centre - delta,\r\n max = centre + delta;\r\n while (slices[0].start < min) {\r\n slices.splice(0,1);\r\n }\r\n while (slices[slices.length - 1].end > max) {\r\n slices.pop();\r\n }\r\n return slices;\r\n}\r\n\r\nfunction populateDateStruct(level, start) {\r\n var end = start + twCx.date_levels[level],\r\n struct = {\r\n "level" : level,\r\n "start" : start,\r\n "end" : end\r\n };\r\n if (level < twCx.date_levels.length - 1) {\r\n struct.slices = [];\r\n var newstart = start;\r\n while (newstart < end) {\r\n struct.slices.push(populateDateStruct(level + 1, newstart));\r\n newstart += twCx.date_levels[level + 1];\r\n }\r\n } else {\r\n struct.tweets = [];\r\n }\r\n return struct;\r\n}\r\n\r\nfunction insertIntoDateStruct(slices, tweet) {\r\n var creadate = tweet.date_value;\r\n for (var i in slices) {\r\n if (creadate < slices[i].end) {\r\n if (slices[i].slices) {\r\n insertIntoDateStruct(slices[i].slices, tweet);\r\n } else {\r\n slices[i].tweets.push(tweet.id);\r\n }\r\n break;\r\n }\r\n }\r\n}\r\n\r\nfunction placeHolder(className) {\r\n return \'<li class="placeholder \' + className + \'"></li>\';\r\n}\r\n\r\nfunction tweetById(tweetid) {\r\n var pos = (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(twCx.idIndex).indexOf(tweetid);\r\n return (pos == -1) ? false : twCx.tweets[pos];\r\n}\r\n\r\nfunction selectTweet(tweetid) {\r\n twCx.position = tweetid;\r\n twCx.followLast = (twCx.position == twCx.idIndex[twCx.tweets.length - 1]);\r\n updateDisplay();\r\n}\r\n\r\nfunction goToPos(nPos) {\r\n twCx.position = twCx.currentIdIndex[Math.min( twCx.currentIdIndex.length - 1, Math.max(0, nPos ) )];\r\n twCx.followLast = (!twCx.filtre && nPos == twCx.tweets.length - 1);\r\n updateDisplay();\r\n}\r\n\r\nfunction movePos(delta) {\r\n goToPos( delta + (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(twCx.currentIdIndex).indexOf(twCx.position) );\r\n}\r\n\r\n// getMsgUrl\r\n// getUserScreenName\r\n// getDescription\r\n//\r\n\r\nfunction getMsgHtmlAdapter(msg) {\r\n return {\r\n Twitter: {\r\n \r\n getMsgUrl: function() {\r\n return \'https://twitter.com/\'\r\n + msg.user.screen_name\r\n + \'/status/\'\r\n + msg.id;\r\n },\r\n\r\n getMsgUri: function() {\r\n return \'https://twitter.com/\'\r\n + msg.user.screen_name\r\n + \'/status/\'\r\n + msg.id;\r\n },\r\n\r\n getMsgId: function() {\r\n return \'tweet_\' + msg.id;\r\n },\r\n \r\n getMsgTitle: function() {\r\n return \'Tweet by \' + (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(msg.user.name).escape();\r\n },\r\n\r\n getMsgDescription: function() {\r\n return (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(msg.full_text).escape();\r\n },\r\n\r\n getMsgUserUrl: function() {\r\n return \'https://twitter.com/\' + msg.user.screen_name;\r\n },\r\n\r\n getMsgReplyUrl: function() {\r\n return \'https://twitter.com/intent/tweet?in_reply_to=\' + msg.id;\r\n },\r\n getMsgRetweetUrl: function() {\r\n return \'https://twitter.com/intent/retweet?tweet_id=\' + msg.id;\r\n },\r\n getMsgFavoriteUrl: function() {\r\n return \'https://twitter.com/intent/favorite?tweet_id=\' + msg.id;\r\n }\r\n\r\n },\r\n Mastodon: {\r\n\r\n getMsgUrl: function() {\r\n return msg.url;\r\n },\r\n\r\n getMsgUri: function() {\r\n return msg.uri;\r\n },\r\n \r\n getMsgId: function() {\r\n return \'toot_\' + msg.id;\r\n },\r\n \r\n getMsgTitle: function() {\r\n return \'Toot by \' + (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(msg.user.name).escape();\r\n },\r\n\r\n getMsgDescription: function() {\r\n return (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(jquery__WEBPACK_IMPORTED_MODULE_1___default()(msg.full_text).text()).escape();\r\n },\r\n\r\n getMsgUserUrl: function() {\r\n return msg.user.url;\r\n },\r\n\r\n getMsgReplyUrl: function() {\r\n return \'\';\r\n },\r\n getMsgRetweetUrl: function() {\r\n return \'\';\r\n },\r\n getMsgFavoriteUrl: function() {\r\n return \'\';\r\n }\r\n\r\n }\r\n }[msg.type];\r\n}\r\n\r\nfunction tweetToHtml(tweet, className, elName) {\r\n\r\n function highlight(texte) {\r\n return ( twCx.filtre ? texte.replace(twCx.filtre, \'<span class="highlight">$1</span>\' ) : texte );\r\n }\r\n \r\n if (!tweet) {\r\n return placeHolder(className);\r\n }\r\n\r\n const htmlAdapter = getMsgHtmlAdapter(tweet);\r\n\r\n var el = (elName ? elName : \'li\');\r\n var html = \'<\'\r\n \t+ el\r\n \t+ \' draggable="true" class="tweet \'\r\n \t+ className\r\n \t+ \'" id="tweet_\'\r\n \t+ tweet.id\r\n \t+ \'" data-title="\'\r\n \t+ htmlAdapter.getMsgTitle()\r\n \t+ \'" data-description="\'\r\n \t+ htmlAdapter.getMsgDescription()\r\n \t+ \'" data-uri="\'\r\n \t+ htmlAdapter.getMsgUri()\r\n \t+ \'"\';\r\n if (className != \'full\') {\r\n html += \' onclick="selectTweet(\\\'\' + tweet.id + \'\\\'); return false;"\';\r\n }\r\n html += \' onmouseover="rolloverTweet(\\\'\' + tweet.id + "\', " + ( className == \'icons\' ) + \');"\';\r\n if (twCx.followLast && className == \'full\' && el == \'li\') {\r\n html += \' style="display: none"\';\r\n }\r\n html += \'>\';\r\n if (tweet.annotations && tweet.annotations.length) {\r\n html += \'<div class="annotations">\';\r\n for (var i in tweet.annotations) {\r\n html += \'<div class="annotation" style="width:\' + (100/tweet.annotations.length) + \'%; background:\' + getColor(tweet.annotations[i], (className == \'icons\' ? .4 : .85)).hex + \'"></div>\';\r\n }\r\n html += \'</div>\';\r\n }\r\n html += \'<div class="twmain">\';\r\n var a_user = \'<a href="\' + htmlAdapter.getMsgUserUrl() + \'" onclick="filtrerTexte(\\\'@\' + tweet.user.screen_name + \'\\\'); return false;" target="_blank">\';\r\n html += \'<div class="around_img"><img class="profile_image" src="\' + tweet.user.profile_image_url_https + \'" />\';\r\n if (className == \'full\') {\r\n html += \'<p class="created_at">\' + new Date(tweet.date_value).toTimeString().substr(0,8) + \'</a></p>\';\r\n }\r\n html += \'</div>\';\r\n if (className != \'icons\') {\r\n let lastend = 0;\r\n var txt = \'\';\r\n const full_text = jquery__WEBPACK_IMPORTED_MODULE_1___default()(tweet.full_text).text();\r\n tweet.html_parts.sort(function(a, b) { return a.start - b.start });\r\n (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(tweet.html_parts).each(function(_e) {\r\n txt += highlight( full_text.substring(lastend, _e.start) ) + _e.link + highlight( _e.text ) + \'</a>\';\r\n lastend = _e.end;\r\n });\r\n //lastend = Math.max(120, lastend);\r\n txt += highlight( full_text.substring(lastend) );\r\n html += \'<p class="tweet_text"><b>\' + a_user + \'<span title="\'+tweet.user.screen_name+ \'">\' +highlight(\'@\' + tweet.user.name) + \'</span></a>\' + ( className == \'full\' ? \' (\' + tweet.user.name + \')</b><br />\' : \'</b> : \') + txt + \'</p>\';\r\n if (className == \'full\' && el == \'li\') {\r\n html += \'<div class="tweet_actions"><a href="\' + htmlAdapter.getMsgUrl() + \'" onclick="tweetPopup(this.href); return false;" target="_blank">afficher tweet</a>\';\r\n const replyUrl = htmlAdapter.getMsgReplyUrl();\r\n if (replyUrl) { html += \'<a href="\' + replyUrl + \'" onclick="tweetPopup(this.href); return false;" target="_blank">répondre</a> · \'; }\r\n const retweetUrl = htmlAdapter.getMsgRetweetUrl();\r\n if (retweetUrl) { html += \'<a href="\' + retweetUrl + \'" onclick="tweetPopup(this.href); return false;" target="_blank">retweeter</a> · \'; }\r\n const favoriteUrl = htmlAdapter.getMsgFavoriteUrl();\r\n if (favoriteUrl) { html += \'<a href="\' + favoriteUrl + \'" onclick="tweetPopup(this.href); return false;" target="_blank">favori</a>\'; }\r\n html += \'</div>\';\r\n }\r\n }\r\n html += \'</div></\' + el + \'>\';\r\n return html;\r\n}\r\n\r\nfunction tlIdFromPos(x, y, outside) {\r\n if (!twCx.tlOnDisplay || !twCx.tlOnDisplay.length) {\r\n return;\r\n }\r\n var ligne = Math.min( twCx.tlOnDisplay.length - 1, Math.max( 0, Math.floor(( twCx.tlHeight - y ) / twCx.scaleY) ) ),\r\n colonne = Math.floor(( x - twCx.deltaX ) / twCx.scaleX ),\r\n l = 0;\r\n if (colonne >= twCx.tlOnDisplay[ligne].totalTweets || colonne < 0 ) {\r\n if (outside) {\r\n colonne = Math.min( twCx.tlOnDisplay[ligne].totalTweets - 1, Math.max( 0, colonne ));\r\n } else {\r\n return null;\r\n }\r\n }\r\n for (var i in twCx.tlOnDisplay[ligne].displayData) {\r\n var nl = l + twCx.tlOnDisplay[ligne].displayData[i].length;\r\n if (colonne < nl) {\r\n return {\r\n "id" : twCx.tlOnDisplay[ligne].displayData[i][colonne - l],\r\n "annotation" : i\r\n }\r\n }\r\n l = nl;\r\n }\r\n}\r\n\r\nfunction tlPosTweet(tweet, annotation) {\r\n if (!twCx.tweets) {\r\n return;\r\n }\r\n var x,\r\n y,\r\n dt = tweet.date_value,\r\n ann = ( annotation ? annotation : ( tweet.annotations && tweet.annotations.length ? tweet.annotations[0] : \'default\' ) );\r\n for (var i = 0; i < twCx.tlOnDisplay.length; i++) {\r\n if (twCx.tlOnDisplay[i].end > dt) {\r\n y = twCx.tlHeight - (i + .5) * twCx.scaleY;\r\n var l = 0;\r\n for (var j in twCx.tlOnDisplay[i].displayData) {\r\n if (j == ann) {\r\n var p = (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(twCx.tlOnDisplay[i].displayData[j]).indexOf(tweet.id);\r\n if (p != -1) {\r\n x = twCx.deltaX + twCx.scaleX * ( p + l + .5 );\r\n }\r\n break;\r\n }\r\n l += twCx.tlOnDisplay[i].displayData[j].length;\r\n }\r\n break;\r\n }\r\n }\r\n return ( x && y ? { "x" : x, "y" : y } : null);\r\n}\r\n\r\nfunction rolloverTweet(tweetid, showPopup, annotation) {\r\n var t = tweetById(tweetid);\r\n if (!t) {\r\n return;\r\n }\r\n var p = tlPosTweet(t, annotation);\r\n if (!p) {\r\n return;\r\n }\r\n var ptl = jquery__WEBPACK_IMPORTED_MODULE_1___default()("#timeline").offset();\r\n if (showPopup) {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hovercontent").html(tweetToHtml(t, \'full\', \'div\'));\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hovertweet").css({\r\n "left" : parseInt(ptl.left + p.x) + "px",\r\n "top" : parseInt(ptl.top + p.y),\r\n "display" : "block"});\r\n } else {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hovertweet").hide();\r\n }\r\n for (var i in twCx.relHover) {\r\n twCx.relHover[i].remove();\r\n }\r\n twCx.relHover = drawTweetArcs(t, p, \'#303030\');\r\n twCx.relHover.push(drawTweetPos(p, \'#ffffff\'));\r\n}\r\n\r\nfunction drawTweetPos(pos, color) {\r\n var rel = twCx.tlPaper.rect(pos.x - .5 * twCx.scaleX, pos.y - .5 * twCx.scaleY, twCx.scaleX, twCx.scaleY);\r\n rel.attr({ "stroke" : color, "fill" : color, "fill-opacity" : .25 });\r\n return rel;\r\n}\r\n\r\nfunction drawTweetArcs(tweet, pos, color) {\r\n \r\n var res = [];\r\n\r\n function tweetAndArc(a, b, aorb) {\r\n if (a && b) {\r\n res.push(drawTweetPos(aorb ? a : b, color));\r\n var aa = twCx.tlPaper.path(arc(a,b))\r\n .attr({ "stroke" : color, "stroke-width" : 1.5, "stroke-opacity" : .8 });\r\n res.push(aa);\r\n }\r\n }\r\n \r\n if (tweet.retweeted_status_id) {\r\n var t = tweetById(tweet.retweeted_status_id);\r\n if (t) {\r\n tweetAndArc(pos, tlPosTweet(t));\r\n }\r\n }\r\n \r\n if (tweet.in_reply_to_status_id) {\r\n var t = tweetById(tweet.in_reply_to_status_id);\r\n if (t) {\r\n tweetAndArc(pos, tlPosTweet(t));\r\n }\r\n }\r\n \r\n if (tweet.backRefs) {\r\n for (var i in tweet.backRefs) {\r\n var t = tweetById(tweet.backRefs[i].referenced_by_id);\r\n if (t) {\r\n tweetAndArc(tlPosTweet(t), pos, true);\r\n }\r\n }\r\n }\r\n \r\n return res;\r\n}\r\n\r\nfunction mouseoverkw() {\r\n var _jel = jquery__WEBPACK_IMPORTED_MODULE_1___default()(this),\r\n _off = _jel.offset();\r\n _jel.css({\r\n color: "#0099ff"\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hoverkw")\r\n .css({\r\n "left" : _off.left + "px",\r\n "top" : ( parseInt(_off.top) + ~~ (_jel.height() / 2) ) + "px",\r\n "display" : "block"\r\n })\r\n .attr("kw", _jel.text());\r\n}\r\n\r\nfunction mouseoutkw() {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hoverkw").hide();\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).css({\r\n color: "#000000"\r\n });\r\n}\r\n\r\nfunction makeTagCloud(tab, div) {\r\n var minfreq = (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(tab).min( function(a) { return a.freq} ).freq,\r\n maxfreq = Math.max(minfreq + .1, (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(tab).max( function(a) { return a.freq} ).freq),\r\n echfreq = 8 / Math.sqrt( maxfreq - minfreq ),\r\n html = \'\';\r\n (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(tab).each(function(_j) {\r\n var maxann = 0,\r\n ann = "default";\r\n for (var k in _j.annotations) {\r\n if (_j.annotations[k] == maxann) {\r\n ann = "default";\r\n }\r\n if (_j.annotations[k] > maxann) {\r\n ann = k;\r\n maxann = _j.annotations[k];\r\n }\r\n }\r\n if (ann == "default") {\r\n var coul = \'\';\r\n } else {\r\n var c = getColor(ann, .6),\r\n coul = "background: rgba(" + [ Math.floor(c.r), Math.floor(c.g), Math.floor(c.b), ( _j.annotations[ann] / _j.freq )].join(\',\') + ")";\r\n }\r\n var fontsize = Math.floor( ( 12 + Math.sqrt( _j.freq - minfreq ) * echfreq ) );\r\n html += \'<span style="line-height: \' + (8 + fontsize) + \'px; font-size: \' + fontsize + \'px;\' + coul + \'">\' + _j.word + \'</span> \';\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(div).html(html);\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(div + " span")\r\n .mouseover(mouseoverkw)\r\n .mouseout(mouseoutkw)\r\n .click(function() {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hoverkw").toggle();\r\n });\r\n}\r\n\r\nfunction updateDisplay() {\r\n if (!twCx.tweets) {\r\n return;\r\n }\r\n if (twCx.filtre) {\r\n var tweets = (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(twCx.tweets).filter(function(tweet) {\r\n var mention = \'@\' + tweet.user.screen_name;\r\n return ( tweet.full_text.search(twCx.filtre) != -1 ) || ( mention.search(twCx.filtre) != -1 );\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#inp_q").val(twCx.filtreTexte + \' (\' + tweets.length + \' tweets)\');\r\n if (tweets.length) {\r\n var idIndex = (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(tweets).map(function(tweet) {\r\n return tweet.id;\r\n });\r\n var p = (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(idIndex).indexOf(twCx.position);\r\n if (p == -1) {\r\n for (p = idIndex.length - 1; p > 0 && idIndex[p] > twCx.position; p--) {\r\n }\r\n }\r\n twCx.position = idIndex[p];\r\n twCx.currentIdIndex = idIndex;\r\n }\r\n \r\n } else {\r\n twCx.currentIdIndex = twCx.idIndex;\r\n var tweets = twCx.tweets;\r\n var p = (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(twCx.idIndex).indexOf(twCx.position);\r\n if (p == -1) {\r\n p = (twCx.followLast ? twCx.idIndex.length - 1 : 0);\r\n }\r\n }\r\n \r\n \r\n var l = tweets.length,\r\n lines = 0,\r\n ppy = 0,\r\n html = \'\',\r\n tweetsOnDisplay = [];\r\n \r\n function pushTweet(tp, className) {\r\n \r\n if (tp < l && tp >= 0) {\r\n \r\n html += tweetToHtml(tweets[tp], className);\r\n \r\n tweetsOnDisplay.push(tp);\r\n \r\n } else {\r\n html += placeHolder(className);\r\n }\r\n }\r\n \r\n if (l) {\r\n \r\n twCx.lastScrollPos = Math.floor( twCx.scrollExtent * ( 1 - ( p / l ) ) );\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#scrollcont").scrollTop(twCx.lastScrollPos);\r\n \r\n if (l > p + 18) {\r\n lines++;\r\n ppy += 20;\r\n for (var i = p + 31; i >= p + 18; i--) {\r\n pushTweet(i, \'icons\');\r\n }\r\n }\r\n if (l > p + 4) {\r\n lines++;\r\n ppy += 20;\r\n for (var i = p + 17; i >= p + 4; i--) {\r\n pushTweet(i, \'icons\');\r\n }\r\n }\r\n for (var k = 3; k >= 1; k--) {\r\n if (l > p + k) {\r\n ppy += 47;\r\n lines++;\r\n pushTweet(p + k, \'half\');\r\n }\r\n }\r\n pushTweet(p, \'full\');\r\n var n = p - 1;\r\n for (var i = 0; i < Math.min(6, Math.max(3, 6 - lines)); i++) {\r\n if (n < 0) {\r\n break;\r\n }\r\n pushTweet(n, \'half\');\r\n n--;\r\n }\r\n for (var i = 0; i < 14 * Math.min(4, Math.max(2, 7 - lines)); i++) {\r\n if (n < 0) {\r\n break;\r\n }\r\n pushTweet(n, \'icons\');\r\n n--;\r\n }\r\n if (html != twCx.tlBuffer) {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#tweetlist").html(html);\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(".tweet.full").fadeIn();\r\n twCx.tlBuffer = html;\r\n }\r\n \r\n if (twCx.suggestCount.length) {\r\n makeTagCloud(twCx.suggestCount, "#suggkw");\r\n }\r\n \r\n var tab = (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(twCx.globalWords).chain()\r\n .map(function(v, k) {\r\n return {\r\n "word": k,\r\n "freq" : v.freq,\r\n "annotations" : v.annotations\r\n };\r\n }).filter(function(v) {\r\n return v.freq > 3;\r\n }).value();\r\n \r\n if (tab.length) {\r\n \r\n tab = (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(tab).sortBy( function(a) { return ( - a.freq ) }).slice(0,40);\r\n makeTagCloud(tab,"#motscles");\r\n } else {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#motscles").html(\'\');\r\n }\r\n twCx.centralTweet = tweets[p];\r\n } else {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#tweetlist").html(\'\');\r\n twCx.tlBuffer = \'\';\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#motscles").html(\'\');\r\n }\r\n \r\n twCx.tlOnDisplay = trimFDS();\r\n if (!twCx.tlOnDisplay || !twCx.tlOnDisplay.length) {\r\n \treturn;\r\n }\r\n twCx.scaleY = twCx.tlHeight / twCx.tlOnDisplay.length;\r\n var maxTweets = 0,\r\n startTl = 0,\r\n endTl = twCx.tlOnDisplay.length - 1;\r\n if (l) {\r\n var startTw = tweets[tweetsOnDisplay[tweetsOnDisplay.length - 1]].date_value,\r\n endTw = tweets[tweetsOnDisplay[0]].date_value;\r\n }\r\n for (var i = 0; i < twCx.tlOnDisplay.length; i++) {\r\n if (l) {\r\n if (startTw >= twCx.tlOnDisplay[i].start && startTw < twCx.tlOnDisplay[i].end) {\r\n startTl = i;\r\n }\r\n if (endTw >= twCx.tlOnDisplay[i].start && endTw < twCx.tlOnDisplay[i].end) {\r\n endTl = i;\r\n }\r\n }\r\n var displayData = {};\r\n for (var j in annotations) {\r\n displayData[j] = [];\r\n }\r\n for (var j in twCx.tlOnDisplay[i].tweets) {\r\n var tweetid = twCx.tlOnDisplay[i].tweets[j],\r\n tweet = tweetById(tweetid);\r\n if (tweet) {\r\n if (tweet.annotations && tweet.annotations.length) {\r\n for (var k in tweet.annotations) {\r\n displayData[tweet.annotations[k]].push(tweetid);\r\n }\r\n } else {\r\n displayData[\'default\'].push(tweetid);\r\n }\r\n }\r\n }\r\n var nbT = 0;\r\n for (var j in displayData) {\r\n nbT += displayData[j].length;\r\n }\r\n maxTweets = Math.max(maxTweets, nbT);\r\n twCx.tlOnDisplay[i].displayData = displayData;\r\n twCx.tlOnDisplay[i].totalTweets = nbT;\r\n }\r\n twCx.scaleX = ( twCx.tlWidth - twCx.deltaX ) / maxTweets;\r\n twCx.tlPaper.clear();\r\n twCx.relHover = null;\r\n \r\n // Dessin de la correspondance liste-timeline\r\n if (l) {\r\n var startY = twCx.tlHeight - startTl * twCx.scaleY,\r\n endY = twCx.tlHeight - ( endTl + 1 ) * twCx.scaleY,\r\n path = "M0 " + twCx.tlHeight + "C" + .7*twCx.deltaX + " " + twCx.tlHeight + " " + .3*twCx.deltaX + " " + startY + " " + twCx.deltaX + " " + startY + "L" + twCx.tlWidth + " " + startY + "L" + twCx.tlWidth + " " + endY + "L" + twCx.deltaX + " " + endY + "C" + .3*twCx.deltaX + " " + endY + " " + .7*twCx.deltaX + " 0 0 0";\r\n twCx.tlPaper.path( path ).attr({ "stroke" : "none", "fill" : "#000080", "opacity" : .2 });\r\n } \r\n // dessin de la date de début\r\n \r\n twCx.tlPaper.text(twCx.deltaX / 2, twCx.tlHeight - 7, new Date(twCx.tlOnDisplay[0].start).toTimeString().substr(0,5))\r\n .attr({ "text-anchor" : "middle", "font-size": "9px" });\r\n \r\n // dessin de la date de fin\r\n \r\n twCx.tlPaper.text(twCx.deltaX / 2, 7, new Date(twCx.tlOnDisplay[twCx.tlOnDisplay.length - 1].end).toTimeString().substr(0,5))\r\n .attr({ "text-anchor" : "middle", "font-size": "9px" });\r\n \r\n for (var i = 0; i < twCx.tlOnDisplay.length; i++) {\r\n var n = 0,\r\n posY = twCx.tlHeight - ( i + 1 ) * twCx.scaleY;\r\n for (var j in twCx.tlOnDisplay[i].displayData) {\r\n var ll = twCx.tlOnDisplay[i].displayData[j].length;\r\n if (ll > 0) {\r\n twCx.tlPaper.rect( twCx.deltaX + n * twCx.scaleX, posY, ll * twCx.scaleX, twCx.scaleY )\r\n .attr({"stroke" : "none", "fill" : getColor(j, .4).hex });\r\n n += ll;\r\n }\r\n }\r\n \r\n // Si on est à une demi-heure, on trace un axe secondaire + heure\r\n \r\n if (i < twCx.tlOnDisplay.length - 1 && !(twCx.tlOnDisplay[i].end % 1800000)) {\r\n twCx.tlPaper.path("M0 "+posY+"L" + twCx.tlWidth +" "+posY).attr({"stroke":"#ccc"});\r\n twCx.tlPaper.text(twCx.deltaX / 2, posY, new Date(twCx.tlOnDisplay[i].end).toTimeString().substr(0,5)).attr({ "text-anchor" : "middle", "font-size": "9px" });\r\n }\r\n }\r\n \r\n // dessin du tweet courant\r\n \r\n if (l) {\r\n \r\n if (twCx.filtre) {\r\n for (var i = 0; i < tweets.length; i++) {\r\n if (i != p) {\r\n var pos = tlPosTweet(tweets[i]);\r\n if (pos) {\r\n drawTweetPos(pos, "#ffccff");\r\n }\r\n }\r\n }\r\n \r\n }\r\n \r\n var posp = tlPosTweet(tweets[p]);\r\n if (posp) {\r\n \r\n drawTweetPos(posp, "#ffff00");\r\n var yy = posp.y - .5 * twCx.scaleY,\r\n path = "M0 " + ppy + "C" + ( .7 * twCx.deltaX ) + " " + ppy + " " + ( .2 * twCx.deltaX ) + " " + yy + " " + ( twCx.deltaX ) + " " + yy + "L" + ( posp.x - .5 * twCx.scaleX ) + " " + yy;\r\n yy = posp.y + .5 * twCx.scaleY;\r\n ppy += 117;\r\n path += "L" + ( posp.x - .5 * twCx.scaleX ) + " " + yy + "L" + twCx.deltaX + " " + yy + "C" + ( .2 * twCx.deltaX ) + " " + yy + " " + ( .7 * twCx.deltaX ) + " " + ppy + " 0 " + ppy;\r\n twCx.tlPaper.path( path ).attr({"stroke":"#ffff00", "fill" : "#ffff00", "fill-opacity" : .15});\r\n \r\n drawTweetArcs(tweets[p], posp, \'#800080\');\r\n }\r\n }\r\n}\r\n\r\nfunction filtrerAnnotation(annotation) {\r\n if (annotations[annotation]) {\r\n effectuerFiltrage(annotations[annotation].display_name,\r\n new RegExp( "(" + (0,underscore__WEBPACK_IMPORTED_MODULE_0__["default"])(annotations[annotation].keywords).map(function(a) { return a.source }).join("|") + ")", "gim" ) );\r\n } else {\r\n effectuerFiltrage(\'\', null)\r\n }\r\n}\r\n\r\nfunction filtrerTexte(valeur) {\r\n effectuerFiltrage( valeur, valeur ? new RegExp("(" + valeur.replace(/(\\W)/g, \'\\\\$1\') + ")" ,\'gim\') : null );\r\n}\r\n\r\nfunction effectuerFiltrage(filtreTexte, tabRegexp) {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#recherche_annot").slideUp();\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#inp_q").val(filtreTexte).attr("class","rechercheCourante");\r\n twCx.filtreTexte = filtreTexte;\r\n twCx.filtre = tabRegexp;\r\n twCx.followLast = !tabRegexp && (twCx.position == twCx.idIndex[twCx.idIndex.length - 1]);\r\n updateDisplay();\r\n}\r\n\r\nfunction clicTl(evt) {\r\n var o = jquery__WEBPACK_IMPORTED_MODULE_1___default()("#timeline").offset();\r\n if (twCx.tlMouseClicked && twCx.tlMouseMoved) {\r\n var twid = tlIdFromPos(evt.pageX - o.left + twCx.refPosTl.x - twCx.refMouse.x, evt.pageY - o.top + twCx.refPosTl.y - twCx.refMouse.y, true);\r\n if (twid) {\r\n selectTweet(twid.id);\r\n }\r\n } else {\r\n var twid = tlIdFromPos(evt.pageX - o.left, evt.pageY - o.top, twCx.tlMouseClicked);\r\n if (twCx.tlMouseMoved && !twCx.tlMouseClicked) { \r\n if (twid) {\r\n rolloverTweet(twid.id, true, twid.annotation);\r\n } else {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hovertweet").hide();\r\n }\r\n }\r\n if (twCx.tlMouseClicked && !twCx.tlMouseMoved) {\r\n if (twid) {\r\n selectTweet(twid.id);\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction loadTweets(tweets, append) {\r\n if (!append) {\r\n twCx.timeline = [];\r\n twCx.idIndex = [];\r\n twCx.tweets = [];\r\n }\r\n for (var i in tweets) {\r\n addTweet(tweets[i]);\r\n }\r\n if (twCx.followLast) {\r\n twCx.position = twCx.idIndex[twCx.tweets.length - 1];\r\n }\r\n updateDisplay();\r\n}\r\n\r\nfunction focusOutRecherche() {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#recherche_annot").slideUp();\r\n var inpq = jquery__WEBPACK_IMPORTED_MODULE_1___default()("#inp_q"),\r\n val = inpq.val();\r\n if (val == \'\' || val == twCx.filtreTexte) {\r\n if (twCx.filtre) {\r\n inpq.attr("class", "rechercheCourante").val(twCx.filtreTexte);\r\n } else {\r\n inpq.attr("class", "greyed").val(l10n.rechercher);\r\n }\r\n }\r\n}\r\n\r\nfunction chaineTimeZoom() {\r\n var chaine = "",\r\n t = twCx.date_levels[twCx.timeLevel],\r\n h = 3600*1000,\r\n m = 60*1000,\r\n s = 1000,\r\n heures = Math.floor(t/h);\r\n if (heures) { chaine += heures + \' h. \' };\r\n t -= (heures * h);\r\n var minutes = Math.floor(t/m);\r\n if (minutes) { chaine += minutes + \' min. \' };\r\n t -= (minutes * m);\r\n if (t) { chaine += Math.floor(t/s) + \' sec.\' }\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#time_scale").html(chaine);\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#time_zoomout").attr("class",(twCx.timeLevel == 0 ? "inactive" : ""));\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#time_zoomin").attr("class",(twCx.timeLevel == twCx.date_levels.length - 1 ? "inactive" : ""));\r\n}\r\n\r\nfunction saveJSON() {\r\n var _txt = JSON.stringify(twCx.tweets),\r\n _buf = \'\';\r\n for (var i = 0; i < _txt.length; i++) {\r\n var _n = _txt.charCodeAt(i);\r\n if (_n > 127) {\r\n var _h = _n.toString(16);\r\n while (_h.length < 4) {\r\n _h = \'0\' + _h;\r\n }\r\n _buf += \'\\\\u\' + _h;\r\n } else {\r\n _buf += _txt.charAt(i);\r\n }\r\n }\r\n document.location.href = "data:text/json;base64," + btoa(_buf);\r\n}\r\n\r\njquery__WEBPACK_IMPORTED_MODULE_1___default()(document).ready(function() {\r\n twCx.tlWidth = jquery__WEBPACK_IMPORTED_MODULE_1___default()("#timeline").width();\r\n twCx.tlHeight = jquery__WEBPACK_IMPORTED_MODULE_1___default()("#timeline").height();\r\n twCx.tlPaper = raphael__WEBPACK_IMPORTED_MODULE_2___default()("timeline", twCx.tlWidth, twCx.tlHeight);\r\n \r\n connectTweets();\r\n \r\n var html = \'\';\r\n for (var j in annotations) {\r\n if (j != "default") {\r\n html += \'<a href="#" style="background: \' + getColor(j, .7).hex + \';" onclick=filtrerAnnotation(\\\'\' + j + \'\\\'); return false;">\' + annotations[j].display_name + \'</a> \'\r\n }\r\n }\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#rech_list_annot").html(html);\r\n \r\n chaineTimeZoom();\r\n \r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#tweetlist").mousewheel(function(e, d) {\r\n twCx.wheelDelta += d;\r\n if (Math.abs(twCx.wheelDelta) >= 1) {\r\n movePos( parseInt(twCx.wheelDelta) );\r\n twCx.wheelDelta = 0;\r\n }\r\n return false;\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#tweetlist").delegate(".tweet", "dragstart", function(e) {\r\n \tvar div = document.createElement(\'div\');\r\n \tdiv.appendChild(this.cloneNode(true));\r\n\t\ttry {\r\n\t\t\te.originalEvent.dataTransfer.setData("text/html",div.innerHTML);\r\n\t\t}\r\n\t\tcatch(err) {\r\n\t\t\te.originalEvent.dataTransfer.setData("text",div.innerHTML);\r\n\t\t}\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#timeline").mousewheel(function(e, d) {\r\n twCx.wheelDelta += d;\r\n let tl = 0;\r\n if (Math.abs(twCx.wheelDelta) >= 1) {\r\n if (twCx.wheelDelta > 0) {\r\n tl = Math.min(twCx.date_levels.length - 1, twCx.timeLevel + 1);\r\n } else {\r\n tl = Math.max(0, twCx.timeLevel - 1);\r\n }\r\n if (tl != twCx.timeLevel) {\r\n twCx.timeLevel = tl;\r\n chaineTimeZoom();\r\n updateDisplay();\r\n }\r\n twCx.wheelDelta = 0;\r\n }\r\n return false;\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#time_zoomin").click(function() {\r\n if (twCx.timeLevel < twCx.date_levels.length - 1) {\r\n twCx.timeLevel++;\r\n chaineTimeZoom();\r\n updateDisplay();\r\n }\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#time_zoomout").click(function() {\r\n if (twCx.timeLevel > 0) {\r\n twCx.timeLevel--;\r\n chaineTimeZoom();\r\n updateDisplay();\r\n }\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#timeline, #tweetlist").mouseout(function() {\r\n twCx.tlMouseClicked = false;\r\n twCx.tlMouseMoved = false;\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hovertweet").hide();\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#timeline").mousemove(function(evt) {\r\n twCx.tlMouseMoved = true;\r\n clicTl(evt);\r\n }).mousedown(function(evt) {\r\n twCx.tlMouseClicked = true;\r\n twCx.tlMouseMoved = false;\r\n var o = jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).offset();\r\n twCx.refMouse = { x : evt.pageX - o.left, y : evt.pageY - o.top };\r\n twCx.refPosTl = tlPosTweet(tweetById(twCx.position)) || twCx.refMouse;\r\n }).mouseup(function(evt) {\r\n clicTl(evt);\r\n twCx.tlMouseClicked = false;\r\n twCx.tlMouseMoved = false;\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#inp_q").focus(function() {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#recherche_annot").slideDown();\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).val(jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).val().replace(/ \\(.+\\)$/, \'\'))\r\n if (jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).hasClass("greyed")) {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).val("");\r\n }\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).attr("class","");\r\n }).focusout(function() {\r\n focusOutRecherche();\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#inp_reset").click(function() {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#inp_q").val(\'\');\r\n if (twCx.filtre) {\r\n twCx.filtre = null;\r\n updateDisplay();\r\n }\r\n twCx.filtreTexte = \'\';\r\n focusOutRecherche();\r\n return false;\r\n })\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#recherche").submit(function(evt) {\r\n evt.preventDefault();\r\n if (!jquery__WEBPACK_IMPORTED_MODULE_1___default()("#inp_q").hasClass("greyed")) {\r\n var valeur = jquery__WEBPACK_IMPORTED_MODULE_1___default()("#inp_q").val();\r\n filtrerTexte(valeur);\r\n }\r\n return false;\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hoverkw").mouseover(function() {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).dequeue().show();\r\n }).mouseout(function() {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).hide();\r\n });\r\n \r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hkwsearch").click(function() {\r\n var _hkw = jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hoverkw");\r\n filtrerTexte(_hkw.attr("kw"));\r\n _hkw.hide();\r\n return false;\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hkwtweet").click(function() {\r\n var _hkw = jquery__WEBPACK_IMPORTED_MODULE_1___default()("#hoverkw");\r\n add_grammar(_hkw.attr("kw"));\r\n _hkw.hide();\r\n return false;\r\n });\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(".acctitre").click(function() {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()(this).next().slideToggle();\r\n return false;\r\n })\r\n \r\n if (!suggested_keywords.length) {\r\n jquery__WEBPACK_IMPORTED_MODULE_1___default()("#suggkw").parent().hide();\r\n }\r\n \r\n setInterval(function() {\r\n var sc = jquery__WEBPACK_IMPORTED_MODULE_1___default()("#scrollcont");\r\n if (sc.scrollTop() != twCx.lastScrollPos && twCx.tweets && twCx.currentIdIndex) {\r\n var p = Math.floor( twCx.currentIdIndex.length * ( 1 - sc.scrollTop() / twCx.scrollExtent ) );\r\n goToPos(p);\r\n }\r\n }, 100)\r\n});\r\n\r\nfunction connectTweets() {\r\n twCx.tlPaper.clear();\r\n var _sq = twCx.tlPaper.rect(0, twCx.tlHeight, twCx.tlWidth, 0)\r\n .attr({\r\n "stroke" : "none",\r\n "fill" : "#8080cc"\r\n });\r\n var _lb = twCx.tlPaper.text(twCx.tlWidth / 2, twCx.tlHeight / 2, "0 tweet")\r\n .attr({\r\n "font-size" : "20px",\r\n "text-anchor" : "middle"\r\n });\r\n \r\n getTweets({\r\n "social_network" : social_network,\r\n "keyword" : tracking_keywords.join(" OR "),\r\n "pages" : max_pages,\r\n "rpp" : 100,\r\n "cbData" : function() {\r\n _lb.attr("text", (this.tweets.length - this.currentPage + 1) + " tweets");\r\n var _h = twCx.tlHeight * this.currentPage / this.pages;\r\n _sq.animate({\r\n "y" : twCx.tlHeight - _h,\r\n "height" : _h\r\n })\r\n },\r\n "cbEnd" : function() {\r\n console.log(this.tweets);\r\n loadTweets(this.tweets);\r\n setInterval(function() {\r\n getTweets({\r\n "social_network" : social_network,\r\n "keyword" : tracking_keywords.join(" OR "),\r\n "pages" : 1,\r\n "since_id" : twCx.idIndex[twCx.idIndex.length - 1],\r\n "rpp" : 100,\r\n "cbEnd" : function() {\r\n loadTweets(this.tweets, true);\r\n }\r\n });\r\n }, 20000)\r\n }\r\n });\r\n}\r\n\r\n\n\n//# sourceURL=webpack://web/./src/js/live-polemic.js?')},"./src/css/common.scss":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('module.exports = __webpack_require__.p + "../css/common.css";\n\n//# sourceURL=webpack://web/./src/css/common.scss?')},"./src/css/main.scss":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('module.exports = __webpack_require__.p + "../css/main.css";\n\n//# sourceURL=webpack://web/./src/css/main.scss?')},"./src/css/vendors.scss":(module,__unused_webpack_exports,__webpack_require__)=>{"use strict";eval('module.exports = __webpack_require__.p + "../css/vendors.css";\n\n//# sourceURL=webpack://web/./src/css/vendors.scss?')},"?34aa":()=>{eval("/* (ignored) */\n\n//# sourceURL=webpack://web/min-document_(ignored)?")},"./node_modules/@babel/runtime/helpers/extends.js":module=>{eval('function _extends() {\n module.exports = _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n }, module.exports.__esModule = true, module.exports["default"] = module.exports;\n return _extends.apply(this, arguments);\n}\nmodule.exports = _extends, module.exports.__esModule = true, module.exports["default"] = module.exports;\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/extends.js?')},"./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _assertThisInitialized)\n/* harmony export */ });\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError("this hasn\'t been initialised - super() hasn\'t been called");\n }\n return self;\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js?')},"./node_modules/@babel/runtime/helpers/esm/construct.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _construct)\n/* harmony export */ });\n/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");\n/* harmony import */ var _isNativeReflectConstruct_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isNativeReflectConstruct.js */ "./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js");\n\n\nfunction _construct(Parent, args, Class) {\n if ((0,_isNativeReflectConstruct_js__WEBPACK_IMPORTED_MODULE_1__["default"])()) {\n _construct = Reflect.construct.bind();\n } else {\n _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(instance, Class.prototype);\n return instance;\n };\n }\n return _construct.apply(null, arguments);\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/construct.js?')},"./node_modules/@babel/runtime/helpers/esm/defineProperty.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _defineProperty)\n/* harmony export */ });\n/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");\n\nfunction _defineProperty(obj, key, value) {\n key = (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/defineProperty.js?')},"./node_modules/@babel/runtime/helpers/esm/extends.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _extends)\n/* harmony export */ });\nfunction _extends() {\n _extends = Object.assign ? Object.assign.bind() : function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/extends.js?')},"./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _getPrototypeOf)\n/* harmony export */ });\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js?')},"./node_modules/@babel/runtime/helpers/esm/inherits.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _inherits)\n/* harmony export */ });\n/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== "function" && superClass !== null) {\n throw new TypeError("Super expression must either be null or a function");\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, "prototype", {\n writable: false\n });\n if (superClass) (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(subClass, superClass);\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/inherits.js?')},"./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _inheritsLoose)\n/* harmony export */ });\n/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");\n\nfunction _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(subClass, superClass);\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js?')},"./node_modules/@babel/runtime/helpers/esm/isNativeFunction.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _isNativeFunction)\n/* harmony export */ });\nfunction _isNativeFunction(fn) {\n try {\n return Function.toString.call(fn).indexOf("[native code]") !== -1;\n } catch (e) {\n return typeof fn === "function";\n }\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/isNativeFunction.js?')},"./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _isNativeReflectConstruct)\n/* harmony export */ });\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === "undefined" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === "function") return true;\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js?')},"./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _setPrototypeOf)\n/* harmony export */ });\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js?')},"./node_modules/@babel/runtime/helpers/esm/toPrimitive.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _toPrimitive)\n/* harmony export */ });\n/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");\n\nfunction _toPrimitive(input, hint) {\n if ((0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(input) !== "object" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || "default");\n if ((0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(res) !== "object") return res;\n throw new TypeError("@@toPrimitive must return a primitive value.");\n }\n return (hint === "string" ? String : Number)(input);\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/toPrimitive.js?')},"./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _toPropertyKey)\n/* harmony export */ });\n/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js");\n/* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js");\n\n\nfunction _toPropertyKey(arg) {\n var key = (0,_toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__["default"])(arg, "string");\n return (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(key) === "symbol" ? key : String(key);\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js?')},"./node_modules/@babel/runtime/helpers/esm/typeof.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _typeof)\n/* harmony export */ });\nfunction _typeof(o) {\n "@babel/helpers - typeof";\n\n return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;\n }, _typeof(o);\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/typeof.js?')},"./node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _wrapNativeSuper)\n/* harmony export */ });\n/* harmony import */ var _getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./getPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js");\n/* harmony import */ var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./setPrototypeOf.js */ "./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");\n/* harmony import */ var _isNativeFunction_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isNativeFunction.js */ "./node_modules/@babel/runtime/helpers/esm/isNativeFunction.js");\n/* harmony import */ var _construct_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./construct.js */ "./node_modules/@babel/runtime/helpers/esm/construct.js");\n\n\n\n\nfunction _wrapNativeSuper(Class) {\n var _cache = typeof Map === "function" ? new Map() : undefined;\n _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !(0,_isNativeFunction_js__WEBPACK_IMPORTED_MODULE_2__["default"])(Class)) return Class;\n if (typeof Class !== "function") {\n throw new TypeError("Super expression must either be null or a function");\n }\n if (typeof _cache !== "undefined") {\n if (_cache.has(Class)) return _cache.get(Class);\n _cache.set(Class, Wrapper);\n }\n function Wrapper() {\n return (0,_construct_js__WEBPACK_IMPORTED_MODULE_3__["default"])(Class, arguments, (0,_getPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this).constructor);\n }\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return (0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_1__["default"])(Wrapper, Class);\n };\n return _wrapNativeSuper(Class);\n}\n\n//# sourceURL=webpack://web/./node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js?')},"./node_modules/underscore/modules/_baseCreate.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ baseCreate)\n/* harmony export */ });\n/* harmony import */ var _isObject_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isObject.js */ "./node_modules/underscore/modules/isObject.js");\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n\n\n\n// Create a naked function reference for surrogate-prototype-swapping.\nfunction ctor() {\n return function(){};\n}\n\n// An internal function for creating a new object that inherits from another.\nfunction baseCreate(prototype) {\n if (!(0,_isObject_js__WEBPACK_IMPORTED_MODULE_0__["default"])(prototype)) return {};\n if (_setup_js__WEBPACK_IMPORTED_MODULE_1__.nativeCreate) return (0,_setup_js__WEBPACK_IMPORTED_MODULE_1__.nativeCreate)(prototype);\n var Ctor = ctor();\n Ctor.prototype = prototype;\n var result = new Ctor;\n Ctor.prototype = null;\n return result;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_baseCreate.js?')},"./node_modules/underscore/modules/_baseIteratee.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ baseIteratee)\n/* harmony export */ });\n/* harmony import */ var _identity_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./identity.js */ "./node_modules/underscore/modules/identity.js");\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isFunction.js */ "./node_modules/underscore/modules/isFunction.js");\n/* harmony import */ var _isObject_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isObject.js */ "./node_modules/underscore/modules/isObject.js");\n/* harmony import */ var _isArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./isArray.js */ "./node_modules/underscore/modules/isArray.js");\n/* harmony import */ var _matcher_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./matcher.js */ "./node_modules/underscore/modules/matcher.js");\n/* harmony import */ var _property_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./property.js */ "./node_modules/underscore/modules/property.js");\n/* harmony import */ var _optimizeCb_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./_optimizeCb.js */ "./node_modules/underscore/modules/_optimizeCb.js");\n\n\n\n\n\n\n\n\n// An internal function to generate callbacks that can be applied to each\n// element in a collection, returning the desired result — either `_.identity`,\n// an arbitrary callback, a property matcher, or a property accessor.\nfunction baseIteratee(value, context, argCount) {\n if (value == null) return _identity_js__WEBPACK_IMPORTED_MODULE_0__["default"];\n if ((0,_isFunction_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value)) return (0,_optimizeCb_js__WEBPACK_IMPORTED_MODULE_6__["default"])(value, context, argCount);\n if ((0,_isObject_js__WEBPACK_IMPORTED_MODULE_2__["default"])(value) && !(0,_isArray_js__WEBPACK_IMPORTED_MODULE_3__["default"])(value)) return (0,_matcher_js__WEBPACK_IMPORTED_MODULE_4__["default"])(value);\n return (0,_property_js__WEBPACK_IMPORTED_MODULE_5__["default"])(value);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_baseIteratee.js?')},"./node_modules/underscore/modules/_cb.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ cb)\n/* harmony export */ });\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./underscore.js */ "./node_modules/underscore/modules/underscore.js");\n/* harmony import */ var _baseIteratee_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_baseIteratee.js */ "./node_modules/underscore/modules/_baseIteratee.js");\n/* harmony import */ var _iteratee_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./iteratee.js */ "./node_modules/underscore/modules/iteratee.js");\n\n\n\n\n// The function we call internally to generate a callback. It invokes\n// `_.iteratee` if overridden, otherwise `baseIteratee`.\nfunction cb(value, context, argCount) {\n if (_underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"].iteratee !== _iteratee_js__WEBPACK_IMPORTED_MODULE_2__["default"]) return _underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"].iteratee(value, context);\n return (0,_baseIteratee_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, context, argCount);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_cb.js?')},"./node_modules/underscore/modules/_chainResult.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ chainResult)\n/* harmony export */ });\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./underscore.js */ "./node_modules/underscore/modules/underscore.js");\n\n\n// Helper function to continue chaining intermediate results.\nfunction chainResult(instance, obj) {\n return instance._chain ? (0,_underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj).chain() : obj;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_chainResult.js?')},"./node_modules/underscore/modules/_collectNonEnumProps.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ collectNonEnumProps)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isFunction.js */ "./node_modules/underscore/modules/isFunction.js");\n/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_has.js */ "./node_modules/underscore/modules/_has.js");\n\n\n\n\n// Internal helper to create a simple lookup structure.\n// `collectNonEnumProps` used to depend on `_.contains`, but this led to\n// circular imports. `emulatedSet` is a one-off solution that only works for\n// arrays of strings.\nfunction emulatedSet(keys) {\n var hash = {};\n for (var l = keys.length, i = 0; i < l; ++i) hash[keys[i]] = true;\n return {\n contains: function(key) { return hash[key] === true; },\n push: function(key) {\n hash[key] = true;\n return keys.push(key);\n }\n };\n}\n\n// Internal helper. Checks `keys` for the presence of keys in IE < 9 that won\'t\n// be iterated by `for key in ...` and thus missed. Extends `keys` in place if\n// needed.\nfunction collectNonEnumProps(obj, keys) {\n keys = emulatedSet(keys);\n var nonEnumIdx = _setup_js__WEBPACK_IMPORTED_MODULE_0__.nonEnumerableProps.length;\n var constructor = obj.constructor;\n var proto = ((0,_isFunction_js__WEBPACK_IMPORTED_MODULE_1__["default"])(constructor) && constructor.prototype) || _setup_js__WEBPACK_IMPORTED_MODULE_0__.ObjProto;\n\n // Constructor is a special case.\n var prop = \'constructor\';\n if ((0,_has_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj, prop) && !keys.contains(prop)) keys.push(prop);\n\n while (nonEnumIdx--) {\n prop = _setup_js__WEBPACK_IMPORTED_MODULE_0__.nonEnumerableProps[nonEnumIdx];\n if (prop in obj && obj[prop] !== proto[prop] && !keys.contains(prop)) {\n keys.push(prop);\n }\n }\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_collectNonEnumProps.js?')},"./node_modules/underscore/modules/_createAssigner.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ createAssigner)\n/* harmony export */ });\n// An internal function for creating assigner functions.\nfunction createAssigner(keysFunc, defaults) {\n return function(obj) {\n var length = arguments.length;\n if (defaults) obj = Object(obj);\n if (length < 2 || obj == null) return obj;\n for (var index = 1; index < length; index++) {\n var source = arguments[index],\n keys = keysFunc(source),\n l = keys.length;\n for (var i = 0; i < l; i++) {\n var key = keys[i];\n if (!defaults || obj[key] === void 0) obj[key] = source[key];\n }\n }\n return obj;\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_createAssigner.js?')},"./node_modules/underscore/modules/_createEscaper.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ createEscaper)\n/* harmony export */ });\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keys.js */ \"./node_modules/underscore/modules/keys.js\");\n\n\n// Internal helper to generate functions for escaping and unescaping strings\n// to/from HTML interpolation.\nfunction createEscaper(map) {\n var escaper = function(match) {\n return map[match];\n };\n // Regexes for identifying a key that needs to be escaped.\n var source = '(?:' + (0,_keys_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(map).join('|') + ')';\n var testRegexp = RegExp(source);\n var replaceRegexp = RegExp(source, 'g');\n return function(string) {\n string = string == null ? '' : '' + string;\n return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_createEscaper.js?")},"./node_modules/underscore/modules/_createIndexFinder.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ createIndexFinder)\n/* harmony export */ });\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_getLength.js */ "./node_modules/underscore/modules/_getLength.js");\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _isNaN_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isNaN.js */ "./node_modules/underscore/modules/isNaN.js");\n\n\n\n\n// Internal function to generate the `_.indexOf` and `_.lastIndexOf` functions.\nfunction createIndexFinder(dir, predicateFind, sortedIndex) {\n return function(array, item, idx) {\n var i = 0, length = (0,_getLength_js__WEBPACK_IMPORTED_MODULE_0__["default"])(array);\n if (typeof idx == \'number\') {\n if (dir > 0) {\n i = idx >= 0 ? idx : Math.max(idx + length, i);\n } else {\n length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;\n }\n } else if (sortedIndex && idx && length) {\n idx = sortedIndex(array, item);\n return array[idx] === item ? idx : -1;\n }\n if (item !== item) {\n idx = predicateFind(_setup_js__WEBPACK_IMPORTED_MODULE_1__.slice.call(array, i, length), _isNaN_js__WEBPACK_IMPORTED_MODULE_2__["default"]);\n return idx >= 0 ? idx + i : -1;\n }\n for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {\n if (array[idx] === item) return idx;\n }\n return -1;\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_createIndexFinder.js?')},"./node_modules/underscore/modules/_createPredicateIndexFinder.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ createPredicateIndexFinder)\n/* harmony export */ });\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_getLength.js */ "./node_modules/underscore/modules/_getLength.js");\n\n\n\n// Internal function to generate `_.findIndex` and `_.findLastIndex`.\nfunction createPredicateIndexFinder(dir) {\n return function(array, predicate, context) {\n predicate = (0,_cb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(predicate, context);\n var length = (0,_getLength_js__WEBPACK_IMPORTED_MODULE_1__["default"])(array);\n var index = dir > 0 ? 0 : length - 1;\n for (; index >= 0 && index < length; index += dir) {\n if (predicate(array[index], index, array)) return index;\n }\n return -1;\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_createPredicateIndexFinder.js?')},"./node_modules/underscore/modules/_createReduce.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ createReduce)\n/* harmony export */ });\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n/* harmony import */ var _optimizeCb_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_optimizeCb.js */ "./node_modules/underscore/modules/_optimizeCb.js");\n\n\n\n\n// Internal helper to create a reducing function, iterating left or right.\nfunction createReduce(dir) {\n // Wrap code that reassigns argument variables in a separate function than\n // the one that accesses `arguments.length` to avoid a perf hit. (#1991)\n var reducer = function(obj, iteratee, memo, initial) {\n var _keys = !(0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj) && (0,_keys_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj),\n length = (_keys || obj).length,\n index = dir > 0 ? 0 : length - 1;\n if (!initial) {\n memo = obj[_keys ? _keys[index] : index];\n index += dir;\n }\n for (; index >= 0 && index < length; index += dir) {\n var currentKey = _keys ? _keys[index] : index;\n memo = iteratee(memo, obj[currentKey], currentKey, obj);\n }\n return memo;\n };\n\n return function(obj, iteratee, memo, context) {\n var initial = arguments.length >= 3;\n return reducer(obj, (0,_optimizeCb_js__WEBPACK_IMPORTED_MODULE_2__["default"])(iteratee, context, 4), memo, initial);\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_createReduce.js?')},"./node_modules/underscore/modules/_createSizePropertyCheck.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ createSizePropertyCheck)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n\n\n// Common internal logic for `isArrayLike` and `isBufferLike`.\nfunction createSizePropertyCheck(getSizeProperty) {\n return function(collection) {\n var sizeProperty = getSizeProperty(collection);\n return typeof sizeProperty == \'number\' && sizeProperty >= 0 && sizeProperty <= _setup_js__WEBPACK_IMPORTED_MODULE_0__.MAX_ARRAY_INDEX;\n }\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_createSizePropertyCheck.js?')},"./node_modules/underscore/modules/_deepGet.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ deepGet)\n/* harmony export */ });\n// Internal function to obtain a nested property in `obj` along `path`.\nfunction deepGet(obj, path) {\n var length = path.length;\n for (var i = 0; i < length; i++) {\n if (obj == null) return void 0;\n obj = obj[path[i]];\n }\n return length ? obj : void 0;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_deepGet.js?')},"./node_modules/underscore/modules/_escapeMap.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// Internal list of HTML entities for escaping.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '`': '`'\n});\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_escapeMap.js?")},"./node_modules/underscore/modules/_executeBound.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ executeBound)\n/* harmony export */ });\n/* harmony import */ var _baseCreate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_baseCreate.js */ "./node_modules/underscore/modules/_baseCreate.js");\n/* harmony import */ var _isObject_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isObject.js */ "./node_modules/underscore/modules/isObject.js");\n\n\n\n// Internal function to execute `sourceFunc` bound to `context` with optional\n// `args`. Determines whether to execute a function as a constructor or as a\n// normal function.\nfunction executeBound(sourceFunc, boundFunc, context, callingContext, args) {\n if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);\n var self = (0,_baseCreate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(sourceFunc.prototype);\n var result = sourceFunc.apply(self, args);\n if ((0,_isObject_js__WEBPACK_IMPORTED_MODULE_1__["default"])(result)) return result;\n return self;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_executeBound.js?')},"./node_modules/underscore/modules/_flatten.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ flatten)\n/* harmony export */ });\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_getLength.js */ "./node_modules/underscore/modules/_getLength.js");\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _isArray_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isArray.js */ "./node_modules/underscore/modules/isArray.js");\n/* harmony import */ var _isArguments_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./isArguments.js */ "./node_modules/underscore/modules/isArguments.js");\n\n\n\n\n\n// Internal implementation of a recursive `flatten` function.\nfunction flatten(input, depth, strict, output) {\n output = output || [];\n if (!depth && depth !== 0) {\n depth = Infinity;\n } else if (depth <= 0) {\n return output.concat(input);\n }\n var idx = output.length;\n for (var i = 0, length = (0,_getLength_js__WEBPACK_IMPORTED_MODULE_0__["default"])(input); i < length; i++) {\n var value = input[i];\n if ((0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value) && ((0,_isArray_js__WEBPACK_IMPORTED_MODULE_2__["default"])(value) || (0,_isArguments_js__WEBPACK_IMPORTED_MODULE_3__["default"])(value))) {\n // Flatten current level of array or arguments object.\n if (depth > 1) {\n flatten(value, depth - 1, strict, output);\n idx = output.length;\n } else {\n var j = 0, len = value.length;\n while (j < len) output[idx++] = value[j++];\n }\n } else if (!strict) {\n output[idx++] = value;\n }\n }\n return output;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_flatten.js?')},"./node_modules/underscore/modules/_getByteLength.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _shallowProperty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_shallowProperty.js */ "./node_modules/underscore/modules/_shallowProperty.js");\n\n\n// Internal helper to obtain the `byteLength` property of an object.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_shallowProperty_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'byteLength\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_getByteLength.js?')},"./node_modules/underscore/modules/_getLength.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _shallowProperty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_shallowProperty.js */ "./node_modules/underscore/modules/_shallowProperty.js");\n\n\n// Internal helper to obtain the `length` property of an object.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_shallowProperty_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'length\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_getLength.js?')},"./node_modules/underscore/modules/_group.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ group)\n/* harmony export */ });\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _each_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./each.js */ "./node_modules/underscore/modules/each.js");\n\n\n\n// An internal function used for aggregate "group by" operations.\nfunction group(behavior, partition) {\n return function(obj, iteratee, context) {\n var result = partition ? [[], []] : {};\n iteratee = (0,_cb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(iteratee, context);\n (0,_each_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj, function(value, index) {\n var key = iteratee(value, index, obj);\n behavior(result, value, key);\n });\n return result;\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_group.js?')},"./node_modules/underscore/modules/_has.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ has)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n\n\n// Internal function to check whether `key` is an own property name of `obj`.\nfunction has(obj, key) {\n return obj != null && _setup_js__WEBPACK_IMPORTED_MODULE_0__.hasOwnProperty.call(obj, key);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_has.js?')},"./node_modules/underscore/modules/_hasObjectTag.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'Object\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_hasObjectTag.js?')},"./node_modules/underscore/modules/_isArrayLike.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _createSizePropertyCheck_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_createSizePropertyCheck.js */ "./node_modules/underscore/modules/_createSizePropertyCheck.js");\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_getLength.js */ "./node_modules/underscore/modules/_getLength.js");\n\n\n\n// Internal helper for collection methods to determine whether a collection\n// should be iterated as an array or as an object.\n// Related: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength\n// Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createSizePropertyCheck_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_getLength_js__WEBPACK_IMPORTED_MODULE_1__["default"]));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_isArrayLike.js?')},"./node_modules/underscore/modules/_isBufferLike.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _createSizePropertyCheck_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_createSizePropertyCheck.js */ "./node_modules/underscore/modules/_createSizePropertyCheck.js");\n/* harmony import */ var _getByteLength_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_getByteLength.js */ "./node_modules/underscore/modules/_getByteLength.js");\n\n\n\n// Internal helper to determine whether we should spend extensive checks against\n// `ArrayBuffer` et al.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createSizePropertyCheck_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_getByteLength_js__WEBPACK_IMPORTED_MODULE_1__["default"]));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_isBufferLike.js?')},"./node_modules/underscore/modules/_keyInObj.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ keyInObj)\n/* harmony export */ });\n// Internal `_.pick` helper function to determine whether `key` is an enumerable\n// property name of `obj`.\nfunction keyInObj(value, key, obj) {\n return key in obj;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_keyInObj.js?')},"./node_modules/underscore/modules/_methodFingerprint.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ie11fingerprint: () => (/* binding */ ie11fingerprint),\n/* harmony export */ mapMethods: () => (/* binding */ mapMethods),\n/* harmony export */ setMethods: () => (/* binding */ setMethods),\n/* harmony export */ weakMapMethods: () => (/* binding */ weakMapMethods)\n/* harmony export */ });\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_getLength.js */ \"./node_modules/underscore/modules/_getLength.js\");\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isFunction.js */ \"./node_modules/underscore/modules/isFunction.js\");\n/* harmony import */ var _allKeys_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./allKeys.js */ \"./node_modules/underscore/modules/allKeys.js\");\n\n\n\n\n// Since the regular `Object.prototype.toString` type tests don't work for\n// some types in IE 11, we use a fingerprinting heuristic instead, based\n// on the methods. It's not great, but it's the best we got.\n// The fingerprint method lists are defined below.\nfunction ie11fingerprint(methods) {\n var length = (0,_getLength_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(methods);\n return function(obj) {\n if (obj == null) return false;\n // `Map`, `WeakMap` and `Set` have no enumerable keys.\n var keys = (0,_allKeys_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(obj);\n if ((0,_getLength_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])(keys)) return false;\n for (var i = 0; i < length; i++) {\n if (!(0,_isFunction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(obj[methods[i]])) return false;\n }\n // If we are testing against `WeakMap`, we need to ensure that\n // `obj` doesn't have a `forEach` method in order to distinguish\n // it from a regular `Map`.\n return methods !== weakMapMethods || !(0,_isFunction_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(obj[forEachName]);\n };\n}\n\n// In the interest of compact minification, we write\n// each string in the fingerprints only once.\nvar forEachName = 'forEach',\n hasName = 'has',\n commonInit = ['clear', 'delete'],\n mapTail = ['get', hasName, 'set'];\n\n// `Map`, `WeakMap` and `Set` each have slightly different\n// combinations of the above sublists.\nvar mapMethods = commonInit.concat(forEachName, mapTail),\n weakMapMethods = commonInit.concat(mapTail),\n setMethods = ['add'].concat(commonInit, forEachName, hasName);\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_methodFingerprint.js?")},"./node_modules/underscore/modules/_optimizeCb.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ optimizeCb)\n/* harmony export */ });\n// Internal function that returns an efficient (for current engines) version\n// of the passed-in callback, to be repeatedly applied in other Underscore\n// functions.\nfunction optimizeCb(func, context, argCount) {\n if (context === void 0) return func;\n switch (argCount == null ? 3 : argCount) {\n case 1: return function(value) {\n return func.call(context, value);\n };\n // The 2-argument case is omitted because we’re not using it.\n case 3: return function(value, index, collection) {\n return func.call(context, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(context, accumulator, value, index, collection);\n };\n }\n return function() {\n return func.apply(context, arguments);\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_optimizeCb.js?')},"./node_modules/underscore/modules/_setup.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ArrayProto: () => (/* binding */ ArrayProto),\n/* harmony export */ MAX_ARRAY_INDEX: () => (/* binding */ MAX_ARRAY_INDEX),\n/* harmony export */ ObjProto: () => (/* binding */ ObjProto),\n/* harmony export */ SymbolProto: () => (/* binding */ SymbolProto),\n/* harmony export */ VERSION: () => (/* binding */ VERSION),\n/* harmony export */ _isFinite: () => (/* binding */ _isFinite),\n/* harmony export */ _isNaN: () => (/* binding */ _isNaN),\n/* harmony export */ hasEnumBug: () => (/* binding */ hasEnumBug),\n/* harmony export */ hasOwnProperty: () => (/* binding */ hasOwnProperty),\n/* harmony export */ nativeCreate: () => (/* binding */ nativeCreate),\n/* harmony export */ nativeIsArray: () => (/* binding */ nativeIsArray),\n/* harmony export */ nativeIsView: () => (/* binding */ nativeIsView),\n/* harmony export */ nativeKeys: () => (/* binding */ nativeKeys),\n/* harmony export */ nonEnumerableProps: () => (/* binding */ nonEnumerableProps),\n/* harmony export */ push: () => (/* binding */ push),\n/* harmony export */ root: () => (/* binding */ root),\n/* harmony export */ slice: () => (/* binding */ slice),\n/* harmony export */ supportsArrayBuffer: () => (/* binding */ supportsArrayBuffer),\n/* harmony export */ supportsDataView: () => (/* binding */ supportsDataView),\n/* harmony export */ toString: () => (/* binding */ toString)\n/* harmony export */ });\n// Current version.\nvar VERSION = '1.13.6';\n\n// Establish the root object, `window` (`self`) in the browser, `global`\n// on the server, or `this` in some virtual machines. We use `self`\n// instead of `window` for `WebWorker` support.\nvar root = (typeof self == 'object' && self.self === self && self) ||\n (typeof global == 'object' && global.global === global && global) ||\n Function('return this')() ||\n {};\n\n// Save bytes in the minified (but not gzipped) version:\nvar ArrayProto = Array.prototype, ObjProto = Object.prototype;\nvar SymbolProto = typeof Symbol !== 'undefined' ? Symbol.prototype : null;\n\n// Create quick reference variables for speed access to core prototypes.\nvar push = ArrayProto.push,\n slice = ArrayProto.slice,\n toString = ObjProto.toString,\n hasOwnProperty = ObjProto.hasOwnProperty;\n\n// Modern feature detection.\nvar supportsArrayBuffer = typeof ArrayBuffer !== 'undefined',\n supportsDataView = typeof DataView !== 'undefined';\n\n// All **ECMAScript 5+** native function implementations that we hope to use\n// are declared here.\nvar nativeIsArray = Array.isArray,\n nativeKeys = Object.keys,\n nativeCreate = Object.create,\n nativeIsView = supportsArrayBuffer && ArrayBuffer.isView;\n\n// Create references to these builtin functions because we override them.\nvar _isNaN = isNaN,\n _isFinite = isFinite;\n\n// Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.\nvar hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');\nvar nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',\n 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];\n\n// The largest integer that can be represented exactly.\nvar MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_setup.js?")},"./node_modules/underscore/modules/_shallowProperty.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ shallowProperty)\n/* harmony export */ });\n// Internal helper to generate a function to obtain property `key` from `obj`.\nfunction shallowProperty(key) {\n return function(obj) {\n return obj == null ? void 0 : obj[key];\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_shallowProperty.js?')},"./node_modules/underscore/modules/_stringTagBug.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hasStringTagBug: () => (/* binding */ hasStringTagBug),\n/* harmony export */ isIE11: () => (/* binding */ isIE11)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _hasObjectTag_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_hasObjectTag.js */ "./node_modules/underscore/modules/_hasObjectTag.js");\n\n\n\n// In IE 10 - Edge 13, `DataView` has string tag `\'[object Object]\'`.\n// In IE 11, the most common among them, this problem also applies to\n// `Map`, `WeakMap` and `Set`.\nvar hasStringTagBug = (\n _setup_js__WEBPACK_IMPORTED_MODULE_0__.supportsDataView && (0,_hasObjectTag_js__WEBPACK_IMPORTED_MODULE_1__["default"])(new DataView(new ArrayBuffer(8)))\n ),\n isIE11 = (typeof Map !== \'undefined\' && (0,_hasObjectTag_js__WEBPACK_IMPORTED_MODULE_1__["default"])(new Map));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_stringTagBug.js?')},"./node_modules/underscore/modules/_tagTester.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ tagTester)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ \"./node_modules/underscore/modules/_setup.js\");\n\n\n// Internal function for creating a `toString`-based type tester.\nfunction tagTester(name) {\n var tag = '[object ' + name + ']';\n return function(obj) {\n return _setup_js__WEBPACK_IMPORTED_MODULE_0__.toString.call(obj) === tag;\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_tagTester.js?")},"./node_modules/underscore/modules/_toBufferView.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ toBufferView)\n/* harmony export */ });\n/* harmony import */ var _getByteLength_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_getByteLength.js */ "./node_modules/underscore/modules/_getByteLength.js");\n\n\n// Internal function to wrap or shallow-copy an ArrayBuffer,\n// typed array or DataView to a new view, reusing the buffer.\nfunction toBufferView(bufferSource) {\n return new Uint8Array(\n bufferSource.buffer || bufferSource,\n bufferSource.byteOffset || 0,\n (0,_getByteLength_js__WEBPACK_IMPORTED_MODULE_0__["default"])(bufferSource)\n );\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_toBufferView.js?')},"./node_modules/underscore/modules/_toPath.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ toPath)\n/* harmony export */ });\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./underscore.js */ "./node_modules/underscore/modules/underscore.js");\n/* harmony import */ var _toPath_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPath.js */ "./node_modules/underscore/modules/toPath.js");\n\n\n\n// Internal wrapper for `_.toPath` to enable minification.\n// Similar to `cb` for `_.iteratee`.\nfunction toPath(path) {\n return _underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"].toPath(path);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_toPath.js?')},"./node_modules/underscore/modules/_unescapeMap.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _invert_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./invert.js */ "./node_modules/underscore/modules/invert.js");\n/* harmony import */ var _escapeMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_escapeMap.js */ "./node_modules/underscore/modules/_escapeMap.js");\n\n\n\n// Internal list of HTML entities for unescaping.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_invert_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_escapeMap_js__WEBPACK_IMPORTED_MODULE_1__["default"]));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/_unescapeMap.js?')},"./node_modules/underscore/modules/after.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ after)\n/* harmony export */ });\n// Returns a function that will only be executed on and after the Nth call.\nfunction after(times, func) {\n return function() {\n if (--times < 1) {\n return func.apply(this, arguments);\n }\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/after.js?')},"./node_modules/underscore/modules/allKeys.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ allKeys)\n/* harmony export */ });\n/* harmony import */ var _isObject_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isObject.js */ "./node_modules/underscore/modules/isObject.js");\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _collectNonEnumProps_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_collectNonEnumProps.js */ "./node_modules/underscore/modules/_collectNonEnumProps.js");\n\n\n\n\n// Retrieve all the enumerable property names of an object.\nfunction allKeys(obj) {\n if (!(0,_isObject_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (_setup_js__WEBPACK_IMPORTED_MODULE_1__.hasEnumBug) (0,_collectNonEnumProps_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj, keys);\n return keys;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/allKeys.js?')},"./node_modules/underscore/modules/before.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ before)\n/* harmony export */ });\n// Returns a function that will only be executed up to (but not including) the\n// Nth call.\nfunction before(times, func) {\n var memo;\n return function() {\n if (--times > 0) {\n memo = func.apply(this, arguments);\n }\n if (times <= 1) func = null;\n return memo;\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/before.js?')},"./node_modules/underscore/modules/bind.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isFunction.js */ "./node_modules/underscore/modules/isFunction.js");\n/* harmony import */ var _executeBound_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_executeBound.js */ "./node_modules/underscore/modules/_executeBound.js");\n\n\n\n\n// Create a function bound to a given object (assigning `this`, and arguments,\n// optionally).\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(func, context, args) {\n if (!(0,_isFunction_js__WEBPACK_IMPORTED_MODULE_1__["default"])(func)) throw new TypeError(\'Bind must be called on a function\');\n var bound = (0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(callArgs) {\n return (0,_executeBound_js__WEBPACK_IMPORTED_MODULE_2__["default"])(func, bound, context, this, args.concat(callArgs));\n });\n return bound;\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/bind.js?')},"./node_modules/underscore/modules/bindAll.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _flatten_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_flatten.js */ "./node_modules/underscore/modules/_flatten.js");\n/* harmony import */ var _bind_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bind.js */ "./node_modules/underscore/modules/bind.js");\n\n\n\n\n// Bind a number of an object\'s methods to that object. Remaining arguments\n// are the method names to be bound. Useful for ensuring that all callbacks\n// defined on an object belong to it.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(obj, keys) {\n keys = (0,_flatten_js__WEBPACK_IMPORTED_MODULE_1__["default"])(keys, false, false);\n var index = keys.length;\n if (index < 1) throw new Error(\'bindAll must be passed function names\');\n while (index--) {\n var key = keys[index];\n obj[key] = (0,_bind_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj[key], obj);\n }\n return obj;\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/bindAll.js?')},"./node_modules/underscore/modules/chain.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ chain)\n/* harmony export */ });\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./underscore.js */ "./node_modules/underscore/modules/underscore.js");\n\n\n// Start chaining a wrapped Underscore object.\nfunction chain(obj) {\n var instance = (0,_underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj);\n instance._chain = true;\n return instance;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/chain.js?')},"./node_modules/underscore/modules/chunk.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ chunk)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n\n\n// Chunk a single array into multiple arrays, each containing `count` or fewer\n// items.\nfunction chunk(array, count) {\n if (count == null || count < 1) return [];\n var result = [];\n var i = 0, length = array.length;\n while (i < length) {\n result.push(_setup_js__WEBPACK_IMPORTED_MODULE_0__.slice.call(array, i, i += count));\n }\n return result;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/chunk.js?')},"./node_modules/underscore/modules/clone.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ clone)\n/* harmony export */ });\n/* harmony import */ var _isObject_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isObject.js */ "./node_modules/underscore/modules/isObject.js");\n/* harmony import */ var _isArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isArray.js */ "./node_modules/underscore/modules/isArray.js");\n/* harmony import */ var _extend_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./extend.js */ "./node_modules/underscore/modules/extend.js");\n\n\n\n\n// Create a (shallow-cloned) duplicate of an object.\nfunction clone(obj) {\n if (!(0,_isObject_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj)) return obj;\n return (0,_isArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj) ? obj.slice() : (0,_extend_js__WEBPACK_IMPORTED_MODULE_2__["default"])({}, obj);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/clone.js?')},"./node_modules/underscore/modules/compact.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ compact)\n/* harmony export */ });\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filter.js */ "./node_modules/underscore/modules/filter.js");\n\n\n// Trim out all falsy values from an array.\nfunction compact(array) {\n return (0,_filter_js__WEBPACK_IMPORTED_MODULE_0__["default"])(array, Boolean);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/compact.js?')},"./node_modules/underscore/modules/compose.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ compose)\n/* harmony export */ });\n// Returns a function that is the composition of a list of functions, each\n// consuming the return value of the function that follows.\nfunction compose() {\n var args = arguments;\n var start = args.length - 1;\n return function() {\n var i = start;\n var result = args[start].apply(this, arguments);\n while (i--) result = args[i].call(this, result);\n return result;\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/compose.js?')},"./node_modules/underscore/modules/constant.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ constant)\n/* harmony export */ });\n// Predicate-generating function. Often useful outside of Underscore.\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/constant.js?')},"./node_modules/underscore/modules/contains.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ contains)\n/* harmony export */ });\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _values_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./values.js */ "./node_modules/underscore/modules/values.js");\n/* harmony import */ var _indexOf_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./indexOf.js */ "./node_modules/underscore/modules/indexOf.js");\n\n\n\n\n// Determine if the array or object contains a given item (using `===`).\nfunction contains(obj, item, fromIndex, guard) {\n if (!(0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj)) obj = (0,_values_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj);\n if (typeof fromIndex != \'number\' || guard) fromIndex = 0;\n return (0,_indexOf_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj, item, fromIndex) >= 0;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/contains.js?')},"./node_modules/underscore/modules/countBy.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _group_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_group.js */ "./node_modules/underscore/modules/_group.js");\n/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_has.js */ "./node_modules/underscore/modules/_has.js");\n\n\n\n// Counts instances of an object that group by a certain criterion. Pass\n// either a string attribute to count by, or a function that returns the\n// criterion.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_group_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(result, value, key) {\n if ((0,_has_js__WEBPACK_IMPORTED_MODULE_1__["default"])(result, key)) result[key]++; else result[key] = 1;\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/countBy.js?')},"./node_modules/underscore/modules/create.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ create)\n/* harmony export */ });\n/* harmony import */ var _baseCreate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_baseCreate.js */ "./node_modules/underscore/modules/_baseCreate.js");\n/* harmony import */ var _extendOwn_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./extendOwn.js */ "./node_modules/underscore/modules/extendOwn.js");\n\n\n\n// Creates an object that inherits from the given prototype object.\n// If additional properties are provided then they will be added to the\n// created object.\nfunction create(prototype, props) {\n var result = (0,_baseCreate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(prototype);\n if (props) (0,_extendOwn_js__WEBPACK_IMPORTED_MODULE_1__["default"])(result, props);\n return result;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/create.js?')},"./node_modules/underscore/modules/debounce.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ debounce)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _now_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./now.js */ "./node_modules/underscore/modules/now.js");\n\n\n\n// When a sequence of calls of the returned function ends, the argument\n// function is triggered. The end of a sequence is defined by the `wait`\n// parameter. If `immediate` is passed, the argument function will be\n// triggered at the beginning of the sequence instead of at the end.\nfunction debounce(func, wait, immediate) {\n var timeout, previous, args, result, context;\n\n var later = function() {\n var passed = (0,_now_js__WEBPACK_IMPORTED_MODULE_1__["default"])() - previous;\n if (wait > passed) {\n timeout = setTimeout(later, wait - passed);\n } else {\n timeout = null;\n if (!immediate) result = func.apply(context, args);\n // This check is needed because `func` can recursively invoke `debounced`.\n if (!timeout) args = context = null;\n }\n };\n\n var debounced = (0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(_args) {\n context = this;\n args = _args;\n previous = (0,_now_js__WEBPACK_IMPORTED_MODULE_1__["default"])();\n if (!timeout) {\n timeout = setTimeout(later, wait);\n if (immediate) result = func.apply(context, args);\n }\n return result;\n });\n\n debounced.cancel = function() {\n clearTimeout(timeout);\n timeout = args = context = null;\n };\n\n return debounced;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/debounce.js?')},"./node_modules/underscore/modules/defaults.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _createAssigner_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_createAssigner.js */ "./node_modules/underscore/modules/_createAssigner.js");\n/* harmony import */ var _allKeys_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./allKeys.js */ "./node_modules/underscore/modules/allKeys.js");\n\n\n\n// Fill in a given object with default properties.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createAssigner_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_allKeys_js__WEBPACK_IMPORTED_MODULE_1__["default"], true));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/defaults.js?')},"./node_modules/underscore/modules/defer.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _partial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./partial.js */ "./node_modules/underscore/modules/partial.js");\n/* harmony import */ var _delay_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./delay.js */ "./node_modules/underscore/modules/delay.js");\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./underscore.js */ "./node_modules/underscore/modules/underscore.js");\n\n\n\n\n// Defers a function, scheduling it to run after the current call stack has\n// cleared.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_partial_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_delay_js__WEBPACK_IMPORTED_MODULE_1__["default"], _underscore_js__WEBPACK_IMPORTED_MODULE_2__["default"], 1));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/defer.js?')},"./node_modules/underscore/modules/delay.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n\n\n// Delays a function for the given number of milliseconds, and then calls\n// it with the arguments supplied.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(func, wait, args) {\n return setTimeout(function() {\n return func.apply(null, args);\n }, wait);\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/delay.js?')},"./node_modules/underscore/modules/difference.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _flatten_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_flatten.js */ "./node_modules/underscore/modules/_flatten.js");\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./filter.js */ "./node_modules/underscore/modules/filter.js");\n/* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./contains.js */ "./node_modules/underscore/modules/contains.js");\n\n\n\n\n\n// Take the difference between one array and a number of other arrays.\n// Only the elements present in just the first array will remain.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(array, rest) {\n rest = (0,_flatten_js__WEBPACK_IMPORTED_MODULE_1__["default"])(rest, true, true);\n return (0,_filter_js__WEBPACK_IMPORTED_MODULE_2__["default"])(array, function(value){\n return !(0,_contains_js__WEBPACK_IMPORTED_MODULE_3__["default"])(rest, value);\n });\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/difference.js?')},"./node_modules/underscore/modules/each.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ each)\n/* harmony export */ });\n/* harmony import */ var _optimizeCb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_optimizeCb.js */ "./node_modules/underscore/modules/_optimizeCb.js");\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n\n\n// The cornerstone for collection functions, an `each`\n// implementation, aka `forEach`.\n// Handles raw objects in addition to array-likes. Treats all\n// sparse array-likes as if they were dense.\nfunction each(obj, iteratee, context) {\n iteratee = (0,_optimizeCb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(iteratee, context);\n var i, length;\n if ((0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj)) {\n for (i = 0, length = obj.length; i < length; i++) {\n iteratee(obj[i], i, obj);\n }\n } else {\n var _keys = (0,_keys_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj);\n for (i = 0, length = _keys.length; i < length; i++) {\n iteratee(obj[_keys[i]], _keys[i], obj);\n }\n }\n return obj;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/each.js?')},"./node_modules/underscore/modules/escape.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _createEscaper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_createEscaper.js */ "./node_modules/underscore/modules/_createEscaper.js");\n/* harmony import */ var _escapeMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_escapeMap.js */ "./node_modules/underscore/modules/_escapeMap.js");\n\n\n\n// Function for escaping strings to HTML interpolation.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createEscaper_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_escapeMap_js__WEBPACK_IMPORTED_MODULE_1__["default"]));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/escape.js?')},"./node_modules/underscore/modules/every.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ every)\n/* harmony export */ });\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n\n\n// Determine whether all of the elements pass a truth test.\nfunction every(obj, predicate, context) {\n predicate = (0,_cb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(predicate, context);\n var _keys = !(0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj) && (0,_keys_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj),\n length = (_keys || obj).length;\n for (var index = 0; index < length; index++) {\n var currentKey = _keys ? _keys[index] : index;\n if (!predicate(obj[currentKey], currentKey, obj)) return false;\n }\n return true;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/every.js?')},"./node_modules/underscore/modules/extend.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _createAssigner_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_createAssigner.js */ "./node_modules/underscore/modules/_createAssigner.js");\n/* harmony import */ var _allKeys_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./allKeys.js */ "./node_modules/underscore/modules/allKeys.js");\n\n\n\n// Extend a given object with all the properties in passed-in object(s).\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createAssigner_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_allKeys_js__WEBPACK_IMPORTED_MODULE_1__["default"]));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/extend.js?')},"./node_modules/underscore/modules/extendOwn.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _createAssigner_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_createAssigner.js */ "./node_modules/underscore/modules/_createAssigner.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n\n// Assigns a given object with all the own properties in the passed-in\n// object(s).\n// (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createAssigner_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_keys_js__WEBPACK_IMPORTED_MODULE_1__["default"]));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/extendOwn.js?')},"./node_modules/underscore/modules/filter.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ filter)\n/* harmony export */ });\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _each_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./each.js */ "./node_modules/underscore/modules/each.js");\n\n\n\n// Return all the elements that pass a truth test.\nfunction filter(obj, predicate, context) {\n var results = [];\n predicate = (0,_cb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(predicate, context);\n (0,_each_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/filter.js?')},"./node_modules/underscore/modules/find.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ find)\n/* harmony export */ });\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _findIndex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./findIndex.js */ "./node_modules/underscore/modules/findIndex.js");\n/* harmony import */ var _findKey_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./findKey.js */ "./node_modules/underscore/modules/findKey.js");\n\n\n\n\n// Return the first value which passes a truth test.\nfunction find(obj, predicate, context) {\n var keyFinder = (0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj) ? _findIndex_js__WEBPACK_IMPORTED_MODULE_1__["default"] : _findKey_js__WEBPACK_IMPORTED_MODULE_2__["default"];\n var key = keyFinder(obj, predicate, context);\n if (key !== void 0 && key !== -1) return obj[key];\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/find.js?')},"./node_modules/underscore/modules/findIndex.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _createPredicateIndexFinder_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_createPredicateIndexFinder.js */ "./node_modules/underscore/modules/_createPredicateIndexFinder.js");\n\n\n// Returns the first index on an array-like that passes a truth test.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createPredicateIndexFinder_js__WEBPACK_IMPORTED_MODULE_0__["default"])(1));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/findIndex.js?')},"./node_modules/underscore/modules/findKey.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ findKey)\n/* harmony export */ });\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n\n// Returns the first key on an object that passes a truth test.\nfunction findKey(obj, predicate, context) {\n predicate = (0,_cb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(predicate, context);\n var _keys = (0,_keys_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj), key;\n for (var i = 0, length = _keys.length; i < length; i++) {\n key = _keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/findKey.js?')},"./node_modules/underscore/modules/findLastIndex.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _createPredicateIndexFinder_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_createPredicateIndexFinder.js */ "./node_modules/underscore/modules/_createPredicateIndexFinder.js");\n\n\n// Returns the last index on an array-like that passes a truth test.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createPredicateIndexFinder_js__WEBPACK_IMPORTED_MODULE_0__["default"])(-1));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/findLastIndex.js?')},"./node_modules/underscore/modules/findWhere.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ findWhere)\n/* harmony export */ });\n/* harmony import */ var _find_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./find.js */ "./node_modules/underscore/modules/find.js");\n/* harmony import */ var _matcher_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./matcher.js */ "./node_modules/underscore/modules/matcher.js");\n\n\n\n// Convenience version of a common use case of `_.find`: getting the first\n// object containing specific `key:value` pairs.\nfunction findWhere(obj, attrs) {\n return (0,_find_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj, (0,_matcher_js__WEBPACK_IMPORTED_MODULE_1__["default"])(attrs));\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/findWhere.js?')},"./node_modules/underscore/modules/first.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ first)\n/* harmony export */ });\n/* harmony import */ var _initial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./initial.js */ "./node_modules/underscore/modules/initial.js");\n\n\n// Get the first element of an array. Passing **n** will return the first N\n// values in the array. The **guard** check allows it to work with `_.map`.\nfunction first(array, n, guard) {\n if (array == null || array.length < 1) return n == null || guard ? void 0 : [];\n if (n == null || guard) return array[0];\n return (0,_initial_js__WEBPACK_IMPORTED_MODULE_0__["default"])(array, array.length - n);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/first.js?')},"./node_modules/underscore/modules/flatten.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ flatten)\n/* harmony export */ });\n/* harmony import */ var _flatten_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_flatten.js */ "./node_modules/underscore/modules/_flatten.js");\n\n\n// Flatten out an array, either recursively (by default), or up to `depth`.\n// Passing `true` or `false` as `depth` means `1` or `Infinity`, respectively.\nfunction flatten(array, depth) {\n return (0,_flatten_js__WEBPACK_IMPORTED_MODULE_0__["default"])(array, depth, false);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/flatten.js?')},"./node_modules/underscore/modules/functions.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ functions)\n/* harmony export */ });\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isFunction.js */ "./node_modules/underscore/modules/isFunction.js");\n\n\n// Return a sorted list of the function names available on the object.\nfunction functions(obj) {\n var names = [];\n for (var key in obj) {\n if ((0,_isFunction_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj[key])) names.push(key);\n }\n return names.sort();\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/functions.js?')},"./node_modules/underscore/modules/get.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ get)\n/* harmony export */ });\n/* harmony import */ var _toPath_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_toPath.js */ "./node_modules/underscore/modules/_toPath.js");\n/* harmony import */ var _deepGet_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_deepGet.js */ "./node_modules/underscore/modules/_deepGet.js");\n/* harmony import */ var _isUndefined_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isUndefined.js */ "./node_modules/underscore/modules/isUndefined.js");\n\n\n\n\n// Get the value of the (deep) property on `path` from `object`.\n// If any property in `path` does not exist or if the value is\n// `undefined`, return `defaultValue` instead.\n// The `path` is normalized through `_.toPath`.\nfunction get(object, path, defaultValue) {\n var value = (0,_deepGet_js__WEBPACK_IMPORTED_MODULE_1__["default"])(object, (0,_toPath_js__WEBPACK_IMPORTED_MODULE_0__["default"])(path));\n return (0,_isUndefined_js__WEBPACK_IMPORTED_MODULE_2__["default"])(value) ? defaultValue : value;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/get.js?')},"./node_modules/underscore/modules/groupBy.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _group_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_group.js */ "./node_modules/underscore/modules/_group.js");\n/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_has.js */ "./node_modules/underscore/modules/_has.js");\n\n\n\n// Groups the object\'s values by a criterion. Pass either a string attribute\n// to group by, or a function that returns the criterion.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_group_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(result, value, key) {\n if ((0,_has_js__WEBPACK_IMPORTED_MODULE_1__["default"])(result, key)) result[key].push(value); else result[key] = [value];\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/groupBy.js?')},"./node_modules/underscore/modules/has.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ has)\n/* harmony export */ });\n/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_has.js */ "./node_modules/underscore/modules/_has.js");\n/* harmony import */ var _toPath_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_toPath.js */ "./node_modules/underscore/modules/_toPath.js");\n\n\n\n// Shortcut function for checking if an object has a given property directly on\n// itself (in other words, not on a prototype). Unlike the internal `has`\n// function, this public version can also traverse nested properties.\nfunction has(obj, path) {\n path = (0,_toPath_js__WEBPACK_IMPORTED_MODULE_1__["default"])(path);\n var length = path.length;\n for (var i = 0; i < length; i++) {\n var key = path[i];\n if (!(0,_has_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj, key)) return false;\n obj = obj[key];\n }\n return !!length;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/has.js?')},"./node_modules/underscore/modules/identity.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ identity)\n/* harmony export */ });\n// Keep the identity function around for default iteratees.\nfunction identity(value) {\n return value;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/identity.js?')},"./node_modules/underscore/modules/index-all.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ VERSION: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.VERSION),\n/* harmony export */ after: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.after),\n/* harmony export */ all: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.all),\n/* harmony export */ allKeys: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.allKeys),\n/* harmony export */ any: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.any),\n/* harmony export */ assign: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.assign),\n/* harmony export */ before: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.before),\n/* harmony export */ bind: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.bind),\n/* harmony export */ bindAll: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.bindAll),\n/* harmony export */ chain: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.chain),\n/* harmony export */ chunk: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.chunk),\n/* harmony export */ clone: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.clone),\n/* harmony export */ collect: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.collect),\n/* harmony export */ compact: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.compact),\n/* harmony export */ compose: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.compose),\n/* harmony export */ constant: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.constant),\n/* harmony export */ contains: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.contains),\n/* harmony export */ countBy: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.countBy),\n/* harmony export */ create: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.create),\n/* harmony export */ debounce: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.debounce),\n/* harmony export */ "default": () => (/* reexport safe */ _index_default_js__WEBPACK_IMPORTED_MODULE_0__["default"]),\n/* harmony export */ defaults: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.defaults),\n/* harmony export */ defer: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.defer),\n/* harmony export */ delay: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.delay),\n/* harmony export */ detect: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.detect),\n/* harmony export */ difference: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.difference),\n/* harmony export */ drop: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.drop),\n/* harmony export */ each: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.each),\n/* harmony export */ escape: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.escape),\n/* harmony export */ every: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.every),\n/* harmony export */ extend: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.extend),\n/* harmony export */ extendOwn: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.extendOwn),\n/* harmony export */ filter: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.filter),\n/* harmony export */ find: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.find),\n/* harmony export */ findIndex: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.findIndex),\n/* harmony export */ findKey: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.findKey),\n/* harmony export */ findLastIndex: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.findLastIndex),\n/* harmony export */ findWhere: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.findWhere),\n/* harmony export */ first: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.first),\n/* harmony export */ flatten: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.flatten),\n/* harmony export */ foldl: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.foldl),\n/* harmony export */ foldr: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.foldr),\n/* harmony export */ forEach: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.forEach),\n/* harmony export */ functions: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.functions),\n/* harmony export */ get: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.get),\n/* harmony export */ groupBy: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.groupBy),\n/* harmony export */ has: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.has),\n/* harmony export */ head: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.head),\n/* harmony export */ identity: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.identity),\n/* harmony export */ include: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.include),\n/* harmony export */ includes: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.includes),\n/* harmony export */ indexBy: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.indexBy),\n/* harmony export */ indexOf: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.indexOf),\n/* harmony export */ initial: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.initial),\n/* harmony export */ inject: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.inject),\n/* harmony export */ intersection: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.intersection),\n/* harmony export */ invert: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.invert),\n/* harmony export */ invoke: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.invoke),\n/* harmony export */ isArguments: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isArguments),\n/* harmony export */ isArray: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isArray),\n/* harmony export */ isArrayBuffer: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isArrayBuffer),\n/* harmony export */ isBoolean: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isBoolean),\n/* harmony export */ isDataView: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isDataView),\n/* harmony export */ isDate: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isDate),\n/* harmony export */ isElement: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isElement),\n/* harmony export */ isEmpty: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isEmpty),\n/* harmony export */ isEqual: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isEqual),\n/* harmony export */ isError: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isError),\n/* harmony export */ isFinite: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isFinite),\n/* harmony export */ isFunction: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isFunction),\n/* harmony export */ isMap: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isMap),\n/* harmony export */ isMatch: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isMatch),\n/* harmony export */ isNaN: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isNaN),\n/* harmony export */ isNull: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isNull),\n/* harmony export */ isNumber: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isNumber),\n/* harmony export */ isObject: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isObject),\n/* harmony export */ isRegExp: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isRegExp),\n/* harmony export */ isSet: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isSet),\n/* harmony export */ isString: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isString),\n/* harmony export */ isSymbol: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isSymbol),\n/* harmony export */ isTypedArray: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isTypedArray),\n/* harmony export */ isUndefined: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isUndefined),\n/* harmony export */ isWeakMap: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isWeakMap),\n/* harmony export */ isWeakSet: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.isWeakSet),\n/* harmony export */ iteratee: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.iteratee),\n/* harmony export */ keys: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.keys),\n/* harmony export */ last: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.last),\n/* harmony export */ lastIndexOf: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.lastIndexOf),\n/* harmony export */ map: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.map),\n/* harmony export */ mapObject: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.mapObject),\n/* harmony export */ matcher: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.matcher),\n/* harmony export */ matches: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.matches),\n/* harmony export */ max: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.max),\n/* harmony export */ memoize: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.memoize),\n/* harmony export */ methods: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.methods),\n/* harmony export */ min: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.min),\n/* harmony export */ mixin: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.mixin),\n/* harmony export */ negate: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.negate),\n/* harmony export */ noop: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.noop),\n/* harmony export */ now: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.now),\n/* harmony export */ object: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.object),\n/* harmony export */ omit: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.omit),\n/* harmony export */ once: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.once),\n/* harmony export */ pairs: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.pairs),\n/* harmony export */ partial: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.partial),\n/* harmony export */ partition: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.partition),\n/* harmony export */ pick: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.pick),\n/* harmony export */ pluck: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.pluck),\n/* harmony export */ property: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.property),\n/* harmony export */ propertyOf: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.propertyOf),\n/* harmony export */ random: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.random),\n/* harmony export */ range: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.range),\n/* harmony export */ reduce: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.reduce),\n/* harmony export */ reduceRight: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.reduceRight),\n/* harmony export */ reject: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.reject),\n/* harmony export */ rest: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.rest),\n/* harmony export */ restArguments: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.restArguments),\n/* harmony export */ result: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.result),\n/* harmony export */ sample: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.sample),\n/* harmony export */ select: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.select),\n/* harmony export */ shuffle: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.shuffle),\n/* harmony export */ size: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.size),\n/* harmony export */ some: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.some),\n/* harmony export */ sortBy: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.sortBy),\n/* harmony export */ sortedIndex: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.sortedIndex),\n/* harmony export */ tail: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.tail),\n/* harmony export */ take: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.take),\n/* harmony export */ tap: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.tap),\n/* harmony export */ template: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.template),\n/* harmony export */ templateSettings: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.templateSettings),\n/* harmony export */ throttle: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.throttle),\n/* harmony export */ times: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.times),\n/* harmony export */ toArray: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.toArray),\n/* harmony export */ toPath: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.toPath),\n/* harmony export */ transpose: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.transpose),\n/* harmony export */ unescape: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.unescape),\n/* harmony export */ union: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.union),\n/* harmony export */ uniq: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.uniq),\n/* harmony export */ unique: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.unique),\n/* harmony export */ uniqueId: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.uniqueId),\n/* harmony export */ unzip: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.unzip),\n/* harmony export */ values: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.values),\n/* harmony export */ where: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.where),\n/* harmony export */ without: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.without),\n/* harmony export */ wrap: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.wrap),\n/* harmony export */ zip: () => (/* reexport safe */ _index_js__WEBPACK_IMPORTED_MODULE_1__.zip)\n/* harmony export */ });\n/* harmony import */ var _index_default_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index-default.js */ "./node_modules/underscore/modules/index-default.js");\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./index.js */ "./node_modules/underscore/modules/index.js");\n// ESM Exports\n// ===========\n// This module is the package entry point for ES module users. In other words,\n// it is the module they are interfacing with when they import from the whole\n// package instead of from a submodule, like this:\n//\n// ```js\n// import { map } from \'underscore\';\n// ```\n//\n// The difference with `./index-default`, which is the package entry point for\n// CommonJS, AMD and UMD users, is purely technical. In ES modules, named and\n// default exports are considered to be siblings, so when you have a default\n// export, its properties are not automatically available as named exports. For\n// this reason, we re-export the named exports in addition to providing the same\n// default export as in `./index-default`.\n\n\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/index-all.js?')},"./node_modules/underscore/modules/index-default.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ \"./node_modules/underscore/modules/index.js\");\n// Default Export\n// ==============\n// In this module, we mix our bundled exports into the `_` object and export\n// the result. This is analogous to setting `module.exports = _` in CommonJS.\n// Hence, this module is also the entry point of our UMD bundle and the package\n// entry point for CommonJS and AMD users. In other words, this is (the source\n// of) the module you are interfacing with when you do any of the following:\n//\n// ```js\n// // CommonJS\n// var _ = require('underscore');\n//\n// // AMD\n// define(['underscore'], function(_) {...});\n//\n// // UMD in the browser\n// // _ is available as a global variable\n// ```\n\n\n\n// Add all of the Underscore functions to the wrapper object.\nvar _ = (0,_index_js__WEBPACK_IMPORTED_MODULE_0__.mixin)(_index_js__WEBPACK_IMPORTED_MODULE_0__);\n// Legacy Node.js API.\n_._ = _;\n// Export the Underscore API.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_);\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/index-default.js?")},"./node_modules/underscore/modules/index.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ VERSION: () => (/* reexport safe */ _setup_js__WEBPACK_IMPORTED_MODULE_0__.VERSION),\n/* harmony export */ after: () => (/* reexport safe */ _after_js__WEBPACK_IMPORTED_MODULE_72__["default"]),\n/* harmony export */ all: () => (/* reexport safe */ _every_js__WEBPACK_IMPORTED_MODULE_89__["default"]),\n/* harmony export */ allKeys: () => (/* reexport safe */ _allKeys_js__WEBPACK_IMPORTED_MODULE_29__["default"]),\n/* harmony export */ any: () => (/* reexport safe */ _some_js__WEBPACK_IMPORTED_MODULE_90__["default"]),\n/* harmony export */ assign: () => (/* reexport safe */ _extendOwn_js__WEBPACK_IMPORTED_MODULE_35__["default"]),\n/* harmony export */ before: () => (/* reexport safe */ _before_js__WEBPACK_IMPORTED_MODULE_73__["default"]),\n/* harmony export */ bind: () => (/* reexport safe */ _bind_js__WEBPACK_IMPORTED_MODULE_62__["default"]),\n/* harmony export */ bindAll: () => (/* reexport safe */ _bindAll_js__WEBPACK_IMPORTED_MODULE_63__["default"]),\n/* harmony export */ chain: () => (/* reexport safe */ _chain_js__WEBPACK_IMPORTED_MODULE_59__["default"]),\n/* harmony export */ chunk: () => (/* reexport safe */ _chunk_js__WEBPACK_IMPORTED_MODULE_123__["default"]),\n/* harmony export */ clone: () => (/* reexport safe */ _clone_js__WEBPACK_IMPORTED_MODULE_38__["default"]),\n/* harmony export */ collect: () => (/* reexport safe */ _map_js__WEBPACK_IMPORTED_MODULE_84__["default"]),\n/* harmony export */ compact: () => (/* reexport safe */ _compact_js__WEBPACK_IMPORTED_MODULE_112__["default"]),\n/* harmony export */ compose: () => (/* reexport safe */ _compose_js__WEBPACK_IMPORTED_MODULE_71__["default"]),\n/* harmony export */ constant: () => (/* reexport safe */ _constant_js__WEBPACK_IMPORTED_MODULE_44__["default"]),\n/* harmony export */ contains: () => (/* reexport safe */ _contains_js__WEBPACK_IMPORTED_MODULE_91__["default"]),\n/* harmony export */ countBy: () => (/* reexport safe */ _countBy_js__WEBPACK_IMPORTED_MODULE_102__["default"]),\n/* harmony export */ create: () => (/* reexport safe */ _create_js__WEBPACK_IMPORTED_MODULE_37__["default"]),\n/* harmony export */ debounce: () => (/* reexport safe */ _debounce_js__WEBPACK_IMPORTED_MODULE_68__["default"]),\n/* harmony export */ "default": () => (/* reexport safe */ _underscore_array_methods_js__WEBPACK_IMPORTED_MODULE_125__["default"]),\n/* harmony export */ defaults: () => (/* reexport safe */ _defaults_js__WEBPACK_IMPORTED_MODULE_36__["default"]),\n/* harmony export */ defer: () => (/* reexport safe */ _defer_js__WEBPACK_IMPORTED_MODULE_66__["default"]),\n/* harmony export */ delay: () => (/* reexport safe */ _delay_js__WEBPACK_IMPORTED_MODULE_65__["default"]),\n/* harmony export */ detect: () => (/* reexport safe */ _find_js__WEBPACK_IMPORTED_MODULE_81__["default"]),\n/* harmony export */ difference: () => (/* reexport safe */ _difference_js__WEBPACK_IMPORTED_MODULE_118__["default"]),\n/* harmony export */ drop: () => (/* reexport safe */ _rest_js__WEBPACK_IMPORTED_MODULE_111__["default"]),\n/* harmony export */ each: () => (/* reexport safe */ _each_js__WEBPACK_IMPORTED_MODULE_83__["default"]),\n/* harmony export */ escape: () => (/* reexport safe */ _escape_js__WEBPACK_IMPORTED_MODULE_53__["default"]),\n/* harmony export */ every: () => (/* reexport safe */ _every_js__WEBPACK_IMPORTED_MODULE_89__["default"]),\n/* harmony export */ extend: () => (/* reexport safe */ _extend_js__WEBPACK_IMPORTED_MODULE_34__["default"]),\n/* harmony export */ extendOwn: () => (/* reexport safe */ _extendOwn_js__WEBPACK_IMPORTED_MODULE_35__["default"]),\n/* harmony export */ filter: () => (/* reexport safe */ _filter_js__WEBPACK_IMPORTED_MODULE_87__["default"]),\n/* harmony export */ find: () => (/* reexport safe */ _find_js__WEBPACK_IMPORTED_MODULE_81__["default"]),\n/* harmony export */ findIndex: () => (/* reexport safe */ _findIndex_js__WEBPACK_IMPORTED_MODULE_76__["default"]),\n/* harmony export */ findKey: () => (/* reexport safe */ _findKey_js__WEBPACK_IMPORTED_MODULE_75__["default"]),\n/* harmony export */ findLastIndex: () => (/* reexport safe */ _findLastIndex_js__WEBPACK_IMPORTED_MODULE_77__["default"]),\n/* harmony export */ findWhere: () => (/* reexport safe */ _findWhere_js__WEBPACK_IMPORTED_MODULE_82__["default"]),\n/* harmony export */ first: () => (/* reexport safe */ _first_js__WEBPACK_IMPORTED_MODULE_108__["default"]),\n/* harmony export */ flatten: () => (/* reexport safe */ _flatten_js__WEBPACK_IMPORTED_MODULE_113__["default"]),\n/* harmony export */ foldl: () => (/* reexport safe */ _reduce_js__WEBPACK_IMPORTED_MODULE_85__["default"]),\n/* harmony export */ foldr: () => (/* reexport safe */ _reduceRight_js__WEBPACK_IMPORTED_MODULE_86__["default"]),\n/* harmony export */ forEach: () => (/* reexport safe */ _each_js__WEBPACK_IMPORTED_MODULE_83__["default"]),\n/* harmony export */ functions: () => (/* reexport safe */ _functions_js__WEBPACK_IMPORTED_MODULE_33__["default"]),\n/* harmony export */ get: () => (/* reexport safe */ _get_js__WEBPACK_IMPORTED_MODULE_40__["default"]),\n/* harmony export */ groupBy: () => (/* reexport safe */ _groupBy_js__WEBPACK_IMPORTED_MODULE_100__["default"]),\n/* harmony export */ has: () => (/* reexport safe */ _has_js__WEBPACK_IMPORTED_MODULE_41__["default"]),\n/* harmony export */ head: () => (/* reexport safe */ _first_js__WEBPACK_IMPORTED_MODULE_108__["default"]),\n/* harmony export */ identity: () => (/* reexport safe */ _identity_js__WEBPACK_IMPORTED_MODULE_43__["default"]),\n/* harmony export */ include: () => (/* reexport safe */ _contains_js__WEBPACK_IMPORTED_MODULE_91__["default"]),\n/* harmony export */ includes: () => (/* reexport safe */ _contains_js__WEBPACK_IMPORTED_MODULE_91__["default"]),\n/* harmony export */ indexBy: () => (/* reexport safe */ _indexBy_js__WEBPACK_IMPORTED_MODULE_101__["default"]),\n/* harmony export */ indexOf: () => (/* reexport safe */ _indexOf_js__WEBPACK_IMPORTED_MODULE_79__["default"]),\n/* harmony export */ initial: () => (/* reexport safe */ _initial_js__WEBPACK_IMPORTED_MODULE_109__["default"]),\n/* harmony export */ inject: () => (/* reexport safe */ _reduce_js__WEBPACK_IMPORTED_MODULE_85__["default"]),\n/* harmony export */ intersection: () => (/* reexport safe */ _intersection_js__WEBPACK_IMPORTED_MODULE_117__["default"]),\n/* harmony export */ invert: () => (/* reexport safe */ _invert_js__WEBPACK_IMPORTED_MODULE_32__["default"]),\n/* harmony export */ invoke: () => (/* reexport safe */ _invoke_js__WEBPACK_IMPORTED_MODULE_92__["default"]),\n/* harmony export */ isArguments: () => (/* reexport safe */ _isArguments_js__WEBPACK_IMPORTED_MODULE_17__["default"]),\n/* harmony export */ isArray: () => (/* reexport safe */ _isArray_js__WEBPACK_IMPORTED_MODULE_15__["default"]),\n/* harmony export */ isArrayBuffer: () => (/* reexport safe */ _isArrayBuffer_js__WEBPACK_IMPORTED_MODULE_13__["default"]),\n/* harmony export */ isBoolean: () => (/* reexport safe */ _isBoolean_js__WEBPACK_IMPORTED_MODULE_5__["default"]),\n/* harmony export */ isDataView: () => (/* reexport safe */ _isDataView_js__WEBPACK_IMPORTED_MODULE_14__["default"]),\n/* harmony export */ isDate: () => (/* reexport safe */ _isDate_js__WEBPACK_IMPORTED_MODULE_9__["default"]),\n/* harmony export */ isElement: () => (/* reexport safe */ _isElement_js__WEBPACK_IMPORTED_MODULE_6__["default"]),\n/* harmony export */ isEmpty: () => (/* reexport safe */ _isEmpty_js__WEBPACK_IMPORTED_MODULE_21__["default"]),\n/* harmony export */ isEqual: () => (/* reexport safe */ _isEqual_js__WEBPACK_IMPORTED_MODULE_23__["default"]),\n/* harmony export */ isError: () => (/* reexport safe */ _isError_js__WEBPACK_IMPORTED_MODULE_11__["default"]),\n/* harmony export */ isFinite: () => (/* reexport safe */ _isFinite_js__WEBPACK_IMPORTED_MODULE_18__["default"]),\n/* harmony export */ isFunction: () => (/* reexport safe */ _isFunction_js__WEBPACK_IMPORTED_MODULE_16__["default"]),\n/* harmony export */ isMap: () => (/* reexport safe */ _isMap_js__WEBPACK_IMPORTED_MODULE_24__["default"]),\n/* harmony export */ isMatch: () => (/* reexport safe */ _isMatch_js__WEBPACK_IMPORTED_MODULE_22__["default"]),\n/* harmony export */ isNaN: () => (/* reexport safe */ _isNaN_js__WEBPACK_IMPORTED_MODULE_19__["default"]),\n/* harmony export */ isNull: () => (/* reexport safe */ _isNull_js__WEBPACK_IMPORTED_MODULE_3__["default"]),\n/* harmony export */ isNumber: () => (/* reexport safe */ _isNumber_js__WEBPACK_IMPORTED_MODULE_8__["default"]),\n/* harmony export */ isObject: () => (/* reexport safe */ _isObject_js__WEBPACK_IMPORTED_MODULE_2__["default"]),\n/* harmony export */ isRegExp: () => (/* reexport safe */ _isRegExp_js__WEBPACK_IMPORTED_MODULE_10__["default"]),\n/* harmony export */ isSet: () => (/* reexport safe */ _isSet_js__WEBPACK_IMPORTED_MODULE_26__["default"]),\n/* harmony export */ isString: () => (/* reexport safe */ _isString_js__WEBPACK_IMPORTED_MODULE_7__["default"]),\n/* harmony export */ isSymbol: () => (/* reexport safe */ _isSymbol_js__WEBPACK_IMPORTED_MODULE_12__["default"]),\n/* harmony export */ isTypedArray: () => (/* reexport safe */ _isTypedArray_js__WEBPACK_IMPORTED_MODULE_20__["default"]),\n/* harmony export */ isUndefined: () => (/* reexport safe */ _isUndefined_js__WEBPACK_IMPORTED_MODULE_4__["default"]),\n/* harmony export */ isWeakMap: () => (/* reexport safe */ _isWeakMap_js__WEBPACK_IMPORTED_MODULE_25__["default"]),\n/* harmony export */ isWeakSet: () => (/* reexport safe */ _isWeakSet_js__WEBPACK_IMPORTED_MODULE_27__["default"]),\n/* harmony export */ iteratee: () => (/* reexport safe */ _iteratee_js__WEBPACK_IMPORTED_MODULE_60__["default"]),\n/* harmony export */ keys: () => (/* reexport safe */ _keys_js__WEBPACK_IMPORTED_MODULE_28__["default"]),\n/* harmony export */ last: () => (/* reexport safe */ _last_js__WEBPACK_IMPORTED_MODULE_110__["default"]),\n/* harmony export */ lastIndexOf: () => (/* reexport safe */ _lastIndexOf_js__WEBPACK_IMPORTED_MODULE_80__["default"]),\n/* harmony export */ map: () => (/* reexport safe */ _map_js__WEBPACK_IMPORTED_MODULE_84__["default"]),\n/* harmony export */ mapObject: () => (/* reexport safe */ _mapObject_js__WEBPACK_IMPORTED_MODULE_42__["default"]),\n/* harmony export */ matcher: () => (/* reexport safe */ _matcher_js__WEBPACK_IMPORTED_MODULE_49__["default"]),\n/* harmony export */ matches: () => (/* reexport safe */ _matcher_js__WEBPACK_IMPORTED_MODULE_49__["default"]),\n/* harmony export */ max: () => (/* reexport safe */ _max_js__WEBPACK_IMPORTED_MODULE_95__["default"]),\n/* harmony export */ memoize: () => (/* reexport safe */ _memoize_js__WEBPACK_IMPORTED_MODULE_64__["default"]),\n/* harmony export */ methods: () => (/* reexport safe */ _functions_js__WEBPACK_IMPORTED_MODULE_33__["default"]),\n/* harmony export */ min: () => (/* reexport safe */ _min_js__WEBPACK_IMPORTED_MODULE_96__["default"]),\n/* harmony export */ mixin: () => (/* reexport safe */ _mixin_js__WEBPACK_IMPORTED_MODULE_124__["default"]),\n/* harmony export */ negate: () => (/* reexport safe */ _negate_js__WEBPACK_IMPORTED_MODULE_70__["default"]),\n/* harmony export */ noop: () => (/* reexport safe */ _noop_js__WEBPACK_IMPORTED_MODULE_45__["default"]),\n/* harmony export */ now: () => (/* reexport safe */ _now_js__WEBPACK_IMPORTED_MODULE_52__["default"]),\n/* harmony export */ object: () => (/* reexport safe */ _object_js__WEBPACK_IMPORTED_MODULE_121__["default"]),\n/* harmony export */ omit: () => (/* reexport safe */ _omit_js__WEBPACK_IMPORTED_MODULE_107__["default"]),\n/* harmony export */ once: () => (/* reexport safe */ _once_js__WEBPACK_IMPORTED_MODULE_74__["default"]),\n/* harmony export */ pairs: () => (/* reexport safe */ _pairs_js__WEBPACK_IMPORTED_MODULE_31__["default"]),\n/* harmony export */ partial: () => (/* reexport safe */ _partial_js__WEBPACK_IMPORTED_MODULE_61__["default"]),\n/* harmony export */ partition: () => (/* reexport safe */ _partition_js__WEBPACK_IMPORTED_MODULE_103__["default"]),\n/* harmony export */ pick: () => (/* reexport safe */ _pick_js__WEBPACK_IMPORTED_MODULE_106__["default"]),\n/* harmony export */ pluck: () => (/* reexport safe */ _pluck_js__WEBPACK_IMPORTED_MODULE_93__["default"]),\n/* harmony export */ property: () => (/* reexport safe */ _property_js__WEBPACK_IMPORTED_MODULE_47__["default"]),\n/* harmony export */ propertyOf: () => (/* reexport safe */ _propertyOf_js__WEBPACK_IMPORTED_MODULE_48__["default"]),\n/* harmony export */ random: () => (/* reexport safe */ _random_js__WEBPACK_IMPORTED_MODULE_51__["default"]),\n/* harmony export */ range: () => (/* reexport safe */ _range_js__WEBPACK_IMPORTED_MODULE_122__["default"]),\n/* harmony export */ reduce: () => (/* reexport safe */ _reduce_js__WEBPACK_IMPORTED_MODULE_85__["default"]),\n/* harmony export */ reduceRight: () => (/* reexport safe */ _reduceRight_js__WEBPACK_IMPORTED_MODULE_86__["default"]),\n/* harmony export */ reject: () => (/* reexport safe */ _reject_js__WEBPACK_IMPORTED_MODULE_88__["default"]),\n/* harmony export */ rest: () => (/* reexport safe */ _rest_js__WEBPACK_IMPORTED_MODULE_111__["default"]),\n/* harmony export */ restArguments: () => (/* reexport safe */ _restArguments_js__WEBPACK_IMPORTED_MODULE_1__["default"]),\n/* harmony export */ result: () => (/* reexport safe */ _result_js__WEBPACK_IMPORTED_MODULE_57__["default"]),\n/* harmony export */ sample: () => (/* reexport safe */ _sample_js__WEBPACK_IMPORTED_MODULE_98__["default"]),\n/* harmony export */ select: () => (/* reexport safe */ _filter_js__WEBPACK_IMPORTED_MODULE_87__["default"]),\n/* harmony export */ shuffle: () => (/* reexport safe */ _shuffle_js__WEBPACK_IMPORTED_MODULE_97__["default"]),\n/* harmony export */ size: () => (/* reexport safe */ _size_js__WEBPACK_IMPORTED_MODULE_105__["default"]),\n/* harmony export */ some: () => (/* reexport safe */ _some_js__WEBPACK_IMPORTED_MODULE_90__["default"]),\n/* harmony export */ sortBy: () => (/* reexport safe */ _sortBy_js__WEBPACK_IMPORTED_MODULE_99__["default"]),\n/* harmony export */ sortedIndex: () => (/* reexport safe */ _sortedIndex_js__WEBPACK_IMPORTED_MODULE_78__["default"]),\n/* harmony export */ tail: () => (/* reexport safe */ _rest_js__WEBPACK_IMPORTED_MODULE_111__["default"]),\n/* harmony export */ take: () => (/* reexport safe */ _first_js__WEBPACK_IMPORTED_MODULE_108__["default"]),\n/* harmony export */ tap: () => (/* reexport safe */ _tap_js__WEBPACK_IMPORTED_MODULE_39__["default"]),\n/* harmony export */ template: () => (/* reexport safe */ _template_js__WEBPACK_IMPORTED_MODULE_56__["default"]),\n/* harmony export */ templateSettings: () => (/* reexport safe */ _templateSettings_js__WEBPACK_IMPORTED_MODULE_55__["default"]),\n/* harmony export */ throttle: () => (/* reexport safe */ _throttle_js__WEBPACK_IMPORTED_MODULE_67__["default"]),\n/* harmony export */ times: () => (/* reexport safe */ _times_js__WEBPACK_IMPORTED_MODULE_50__["default"]),\n/* harmony export */ toArray: () => (/* reexport safe */ _toArray_js__WEBPACK_IMPORTED_MODULE_104__["default"]),\n/* harmony export */ toPath: () => (/* reexport safe */ _toPath_js__WEBPACK_IMPORTED_MODULE_46__["default"]),\n/* harmony export */ transpose: () => (/* reexport safe */ _unzip_js__WEBPACK_IMPORTED_MODULE_119__["default"]),\n/* harmony export */ unescape: () => (/* reexport safe */ _unescape_js__WEBPACK_IMPORTED_MODULE_54__["default"]),\n/* harmony export */ union: () => (/* reexport safe */ _union_js__WEBPACK_IMPORTED_MODULE_116__["default"]),\n/* harmony export */ uniq: () => (/* reexport safe */ _uniq_js__WEBPACK_IMPORTED_MODULE_115__["default"]),\n/* harmony export */ unique: () => (/* reexport safe */ _uniq_js__WEBPACK_IMPORTED_MODULE_115__["default"]),\n/* harmony export */ uniqueId: () => (/* reexport safe */ _uniqueId_js__WEBPACK_IMPORTED_MODULE_58__["default"]),\n/* harmony export */ unzip: () => (/* reexport safe */ _unzip_js__WEBPACK_IMPORTED_MODULE_119__["default"]),\n/* harmony export */ values: () => (/* reexport safe */ _values_js__WEBPACK_IMPORTED_MODULE_30__["default"]),\n/* harmony export */ where: () => (/* reexport safe */ _where_js__WEBPACK_IMPORTED_MODULE_94__["default"]),\n/* harmony export */ without: () => (/* reexport safe */ _without_js__WEBPACK_IMPORTED_MODULE_114__["default"]),\n/* harmony export */ wrap: () => (/* reexport safe */ _wrap_js__WEBPACK_IMPORTED_MODULE_69__["default"]),\n/* harmony export */ zip: () => (/* reexport safe */ _zip_js__WEBPACK_IMPORTED_MODULE_120__["default"])\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _isObject_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isObject.js */ "./node_modules/underscore/modules/isObject.js");\n/* harmony import */ var _isNull_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./isNull.js */ "./node_modules/underscore/modules/isNull.js");\n/* harmony import */ var _isUndefined_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./isUndefined.js */ "./node_modules/underscore/modules/isUndefined.js");\n/* harmony import */ var _isBoolean_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./isBoolean.js */ "./node_modules/underscore/modules/isBoolean.js");\n/* harmony import */ var _isElement_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isElement.js */ "./node_modules/underscore/modules/isElement.js");\n/* harmony import */ var _isString_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./isString.js */ "./node_modules/underscore/modules/isString.js");\n/* harmony import */ var _isNumber_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./isNumber.js */ "./node_modules/underscore/modules/isNumber.js");\n/* harmony import */ var _isDate_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./isDate.js */ "./node_modules/underscore/modules/isDate.js");\n/* harmony import */ var _isRegExp_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./isRegExp.js */ "./node_modules/underscore/modules/isRegExp.js");\n/* harmony import */ var _isError_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./isError.js */ "./node_modules/underscore/modules/isError.js");\n/* harmony import */ var _isSymbol_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./isSymbol.js */ "./node_modules/underscore/modules/isSymbol.js");\n/* harmony import */ var _isArrayBuffer_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./isArrayBuffer.js */ "./node_modules/underscore/modules/isArrayBuffer.js");\n/* harmony import */ var _isDataView_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./isDataView.js */ "./node_modules/underscore/modules/isDataView.js");\n/* harmony import */ var _isArray_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./isArray.js */ "./node_modules/underscore/modules/isArray.js");\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./isFunction.js */ "./node_modules/underscore/modules/isFunction.js");\n/* harmony import */ var _isArguments_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./isArguments.js */ "./node_modules/underscore/modules/isArguments.js");\n/* harmony import */ var _isFinite_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./isFinite.js */ "./node_modules/underscore/modules/isFinite.js");\n/* harmony import */ var _isNaN_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./isNaN.js */ "./node_modules/underscore/modules/isNaN.js");\n/* harmony import */ var _isTypedArray_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./isTypedArray.js */ "./node_modules/underscore/modules/isTypedArray.js");\n/* harmony import */ var _isEmpty_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./isEmpty.js */ "./node_modules/underscore/modules/isEmpty.js");\n/* harmony import */ var _isMatch_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./isMatch.js */ "./node_modules/underscore/modules/isMatch.js");\n/* harmony import */ var _isEqual_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./isEqual.js */ "./node_modules/underscore/modules/isEqual.js");\n/* harmony import */ var _isMap_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./isMap.js */ "./node_modules/underscore/modules/isMap.js");\n/* harmony import */ var _isWeakMap_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./isWeakMap.js */ "./node_modules/underscore/modules/isWeakMap.js");\n/* harmony import */ var _isSet_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./isSet.js */ "./node_modules/underscore/modules/isSet.js");\n/* harmony import */ var _isWeakSet_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./isWeakSet.js */ "./node_modules/underscore/modules/isWeakSet.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n/* harmony import */ var _allKeys_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./allKeys.js */ "./node_modules/underscore/modules/allKeys.js");\n/* harmony import */ var _values_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./values.js */ "./node_modules/underscore/modules/values.js");\n/* harmony import */ var _pairs_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./pairs.js */ "./node_modules/underscore/modules/pairs.js");\n/* harmony import */ var _invert_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./invert.js */ "./node_modules/underscore/modules/invert.js");\n/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./functions.js */ "./node_modules/underscore/modules/functions.js");\n/* harmony import */ var _extend_js__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./extend.js */ "./node_modules/underscore/modules/extend.js");\n/* harmony import */ var _extendOwn_js__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./extendOwn.js */ "./node_modules/underscore/modules/extendOwn.js");\n/* harmony import */ var _defaults_js__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./defaults.js */ "./node_modules/underscore/modules/defaults.js");\n/* harmony import */ var _create_js__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./create.js */ "./node_modules/underscore/modules/create.js");\n/* harmony import */ var _clone_js__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./clone.js */ "./node_modules/underscore/modules/clone.js");\n/* harmony import */ var _tap_js__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./tap.js */ "./node_modules/underscore/modules/tap.js");\n/* harmony import */ var _get_js__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./get.js */ "./node_modules/underscore/modules/get.js");\n/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./has.js */ "./node_modules/underscore/modules/has.js");\n/* harmony import */ var _mapObject_js__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./mapObject.js */ "./node_modules/underscore/modules/mapObject.js");\n/* harmony import */ var _identity_js__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./identity.js */ "./node_modules/underscore/modules/identity.js");\n/* harmony import */ var _constant_js__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./constant.js */ "./node_modules/underscore/modules/constant.js");\n/* harmony import */ var _noop_js__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./noop.js */ "./node_modules/underscore/modules/noop.js");\n/* harmony import */ var _toPath_js__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./toPath.js */ "./node_modules/underscore/modules/toPath.js");\n/* harmony import */ var _property_js__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./property.js */ "./node_modules/underscore/modules/property.js");\n/* harmony import */ var _propertyOf_js__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./propertyOf.js */ "./node_modules/underscore/modules/propertyOf.js");\n/* harmony import */ var _matcher_js__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./matcher.js */ "./node_modules/underscore/modules/matcher.js");\n/* harmony import */ var _times_js__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./times.js */ "./node_modules/underscore/modules/times.js");\n/* harmony import */ var _random_js__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./random.js */ "./node_modules/underscore/modules/random.js");\n/* harmony import */ var _now_js__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./now.js */ "./node_modules/underscore/modules/now.js");\n/* harmony import */ var _escape_js__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./escape.js */ "./node_modules/underscore/modules/escape.js");\n/* harmony import */ var _unescape_js__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./unescape.js */ "./node_modules/underscore/modules/unescape.js");\n/* harmony import */ var _templateSettings_js__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./templateSettings.js */ "./node_modules/underscore/modules/templateSettings.js");\n/* harmony import */ var _template_js__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ./template.js */ "./node_modules/underscore/modules/template.js");\n/* harmony import */ var _result_js__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ./result.js */ "./node_modules/underscore/modules/result.js");\n/* harmony import */ var _uniqueId_js__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ./uniqueId.js */ "./node_modules/underscore/modules/uniqueId.js");\n/* harmony import */ var _chain_js__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ./chain.js */ "./node_modules/underscore/modules/chain.js");\n/* harmony import */ var _iteratee_js__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ./iteratee.js */ "./node_modules/underscore/modules/iteratee.js");\n/* harmony import */ var _partial_js__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ./partial.js */ "./node_modules/underscore/modules/partial.js");\n/* harmony import */ var _bind_js__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ./bind.js */ "./node_modules/underscore/modules/bind.js");\n/* harmony import */ var _bindAll_js__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ./bindAll.js */ "./node_modules/underscore/modules/bindAll.js");\n/* harmony import */ var _memoize_js__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ./memoize.js */ "./node_modules/underscore/modules/memoize.js");\n/* harmony import */ var _delay_js__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! ./delay.js */ "./node_modules/underscore/modules/delay.js");\n/* harmony import */ var _defer_js__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! ./defer.js */ "./node_modules/underscore/modules/defer.js");\n/* harmony import */ var _throttle_js__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(/*! ./throttle.js */ "./node_modules/underscore/modules/throttle.js");\n/* harmony import */ var _debounce_js__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(/*! ./debounce.js */ "./node_modules/underscore/modules/debounce.js");\n/* harmony import */ var _wrap_js__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(/*! ./wrap.js */ "./node_modules/underscore/modules/wrap.js");\n/* harmony import */ var _negate_js__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! ./negate.js */ "./node_modules/underscore/modules/negate.js");\n/* harmony import */ var _compose_js__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(/*! ./compose.js */ "./node_modules/underscore/modules/compose.js");\n/* harmony import */ var _after_js__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(/*! ./after.js */ "./node_modules/underscore/modules/after.js");\n/* harmony import */ var _before_js__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(/*! ./before.js */ "./node_modules/underscore/modules/before.js");\n/* harmony import */ var _once_js__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(/*! ./once.js */ "./node_modules/underscore/modules/once.js");\n/* harmony import */ var _findKey_js__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(/*! ./findKey.js */ "./node_modules/underscore/modules/findKey.js");\n/* harmony import */ var _findIndex_js__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(/*! ./findIndex.js */ "./node_modules/underscore/modules/findIndex.js");\n/* harmony import */ var _findLastIndex_js__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(/*! ./findLastIndex.js */ "./node_modules/underscore/modules/findLastIndex.js");\n/* harmony import */ var _sortedIndex_js__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(/*! ./sortedIndex.js */ "./node_modules/underscore/modules/sortedIndex.js");\n/* harmony import */ var _indexOf_js__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(/*! ./indexOf.js */ "./node_modules/underscore/modules/indexOf.js");\n/* harmony import */ var _lastIndexOf_js__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(/*! ./lastIndexOf.js */ "./node_modules/underscore/modules/lastIndexOf.js");\n/* harmony import */ var _find_js__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(/*! ./find.js */ "./node_modules/underscore/modules/find.js");\n/* harmony import */ var _findWhere_js__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(/*! ./findWhere.js */ "./node_modules/underscore/modules/findWhere.js");\n/* harmony import */ var _each_js__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(/*! ./each.js */ "./node_modules/underscore/modules/each.js");\n/* harmony import */ var _map_js__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(/*! ./map.js */ "./node_modules/underscore/modules/map.js");\n/* harmony import */ var _reduce_js__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(/*! ./reduce.js */ "./node_modules/underscore/modules/reduce.js");\n/* harmony import */ var _reduceRight_js__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(/*! ./reduceRight.js */ "./node_modules/underscore/modules/reduceRight.js");\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(/*! ./filter.js */ "./node_modules/underscore/modules/filter.js");\n/* harmony import */ var _reject_js__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(/*! ./reject.js */ "./node_modules/underscore/modules/reject.js");\n/* harmony import */ var _every_js__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(/*! ./every.js */ "./node_modules/underscore/modules/every.js");\n/* harmony import */ var _some_js__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(/*! ./some.js */ "./node_modules/underscore/modules/some.js");\n/* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(/*! ./contains.js */ "./node_modules/underscore/modules/contains.js");\n/* harmony import */ var _invoke_js__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(/*! ./invoke.js */ "./node_modules/underscore/modules/invoke.js");\n/* harmony import */ var _pluck_js__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(/*! ./pluck.js */ "./node_modules/underscore/modules/pluck.js");\n/* harmony import */ var _where_js__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(/*! ./where.js */ "./node_modules/underscore/modules/where.js");\n/* harmony import */ var _max_js__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(/*! ./max.js */ "./node_modules/underscore/modules/max.js");\n/* harmony import */ var _min_js__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(/*! ./min.js */ "./node_modules/underscore/modules/min.js");\n/* harmony import */ var _shuffle_js__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(/*! ./shuffle.js */ "./node_modules/underscore/modules/shuffle.js");\n/* harmony import */ var _sample_js__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(/*! ./sample.js */ "./node_modules/underscore/modules/sample.js");\n/* harmony import */ var _sortBy_js__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(/*! ./sortBy.js */ "./node_modules/underscore/modules/sortBy.js");\n/* harmony import */ var _groupBy_js__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(/*! ./groupBy.js */ "./node_modules/underscore/modules/groupBy.js");\n/* harmony import */ var _indexBy_js__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(/*! ./indexBy.js */ "./node_modules/underscore/modules/indexBy.js");\n/* harmony import */ var _countBy_js__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(/*! ./countBy.js */ "./node_modules/underscore/modules/countBy.js");\n/* harmony import */ var _partition_js__WEBPACK_IMPORTED_MODULE_103__ = __webpack_require__(/*! ./partition.js */ "./node_modules/underscore/modules/partition.js");\n/* harmony import */ var _toArray_js__WEBPACK_IMPORTED_MODULE_104__ = __webpack_require__(/*! ./toArray.js */ "./node_modules/underscore/modules/toArray.js");\n/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_105__ = __webpack_require__(/*! ./size.js */ "./node_modules/underscore/modules/size.js");\n/* harmony import */ var _pick_js__WEBPACK_IMPORTED_MODULE_106__ = __webpack_require__(/*! ./pick.js */ "./node_modules/underscore/modules/pick.js");\n/* harmony import */ var _omit_js__WEBPACK_IMPORTED_MODULE_107__ = __webpack_require__(/*! ./omit.js */ "./node_modules/underscore/modules/omit.js");\n/* harmony import */ var _first_js__WEBPACK_IMPORTED_MODULE_108__ = __webpack_require__(/*! ./first.js */ "./node_modules/underscore/modules/first.js");\n/* harmony import */ var _initial_js__WEBPACK_IMPORTED_MODULE_109__ = __webpack_require__(/*! ./initial.js */ "./node_modules/underscore/modules/initial.js");\n/* harmony import */ var _last_js__WEBPACK_IMPORTED_MODULE_110__ = __webpack_require__(/*! ./last.js */ "./node_modules/underscore/modules/last.js");\n/* harmony import */ var _rest_js__WEBPACK_IMPORTED_MODULE_111__ = __webpack_require__(/*! ./rest.js */ "./node_modules/underscore/modules/rest.js");\n/* harmony import */ var _compact_js__WEBPACK_IMPORTED_MODULE_112__ = __webpack_require__(/*! ./compact.js */ "./node_modules/underscore/modules/compact.js");\n/* harmony import */ var _flatten_js__WEBPACK_IMPORTED_MODULE_113__ = __webpack_require__(/*! ./flatten.js */ "./node_modules/underscore/modules/flatten.js");\n/* harmony import */ var _without_js__WEBPACK_IMPORTED_MODULE_114__ = __webpack_require__(/*! ./without.js */ "./node_modules/underscore/modules/without.js");\n/* harmony import */ var _uniq_js__WEBPACK_IMPORTED_MODULE_115__ = __webpack_require__(/*! ./uniq.js */ "./node_modules/underscore/modules/uniq.js");\n/* harmony import */ var _union_js__WEBPACK_IMPORTED_MODULE_116__ = __webpack_require__(/*! ./union.js */ "./node_modules/underscore/modules/union.js");\n/* harmony import */ var _intersection_js__WEBPACK_IMPORTED_MODULE_117__ = __webpack_require__(/*! ./intersection.js */ "./node_modules/underscore/modules/intersection.js");\n/* harmony import */ var _difference_js__WEBPACK_IMPORTED_MODULE_118__ = __webpack_require__(/*! ./difference.js */ "./node_modules/underscore/modules/difference.js");\n/* harmony import */ var _unzip_js__WEBPACK_IMPORTED_MODULE_119__ = __webpack_require__(/*! ./unzip.js */ "./node_modules/underscore/modules/unzip.js");\n/* harmony import */ var _zip_js__WEBPACK_IMPORTED_MODULE_120__ = __webpack_require__(/*! ./zip.js */ "./node_modules/underscore/modules/zip.js");\n/* harmony import */ var _object_js__WEBPACK_IMPORTED_MODULE_121__ = __webpack_require__(/*! ./object.js */ "./node_modules/underscore/modules/object.js");\n/* harmony import */ var _range_js__WEBPACK_IMPORTED_MODULE_122__ = __webpack_require__(/*! ./range.js */ "./node_modules/underscore/modules/range.js");\n/* harmony import */ var _chunk_js__WEBPACK_IMPORTED_MODULE_123__ = __webpack_require__(/*! ./chunk.js */ "./node_modules/underscore/modules/chunk.js");\n/* harmony import */ var _mixin_js__WEBPACK_IMPORTED_MODULE_124__ = __webpack_require__(/*! ./mixin.js */ "./node_modules/underscore/modules/mixin.js");\n/* harmony import */ var _underscore_array_methods_js__WEBPACK_IMPORTED_MODULE_125__ = __webpack_require__(/*! ./underscore-array-methods.js */ "./node_modules/underscore/modules/underscore-array-methods.js");\n// Named Exports\n// =============\n\n// Underscore.js 1.13.6\n// https://underscorejs.org\n// (c) 2009-2022 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors\n// Underscore may be freely distributed under the MIT license.\n\n// Baseline setup.\n\n\n\n// Object Functions\n// ----------------\n// Our most fundamental functions operate on any JavaScript object.\n// Most functions in Underscore depend on at least one function in this section.\n\n// A group of functions that check the types of core JavaScript values.\n// These are often informally referred to as the "isType" functions.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// Functions that treat an object as a dictionary of key-value pairs.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// Utility Functions\n// -----------------\n// A bit of a grab bag: Predicate-generating functions for use with filters and\n// loops, string escaping and templating, create random numbers and unique ids,\n// and functions that facilitate Underscore\'s chaining and iteration conventions.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// Function (ahem) Functions\n// -------------------------\n// These functions take a function as an argument and return a new function\n// as the result. Also known as higher-order functions.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// Finders\n// -------\n// Functions that extract (the position of) a single element from an object\n// or array based on some criterion.\n\n\n\n\n\n\n\n\n\n// Collection Functions\n// --------------------\n// Functions that work on any collection of elements: either an array, or\n// an object of key-value pairs.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// `_.pick` and `_.omit` are actually object functions, but we put\n// them here in order to create a more natural reading order in the\n// monolithic build as they depend on `_.contains`.\n\n\n\n// Array Functions\n// ---------------\n// Functions that operate on arrays (and array-likes) only, because they’re\n// expressed in terms of operations on an ordered list of values.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n// OOP\n// ---\n// These modules support the "object-oriented" calling style. See also\n// `underscore.js` and `index-default.js`.\n\n\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/index.js?')},"./node_modules/underscore/modules/indexBy.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _group_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_group.js */ "./node_modules/underscore/modules/_group.js");\n\n\n// Indexes the object\'s values by a criterion, similar to `_.groupBy`, but for\n// when you know that your index values will be unique.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_group_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(result, value, key) {\n result[key] = value;\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/indexBy.js?')},"./node_modules/underscore/modules/indexOf.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _sortedIndex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sortedIndex.js */ "./node_modules/underscore/modules/sortedIndex.js");\n/* harmony import */ var _findIndex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./findIndex.js */ "./node_modules/underscore/modules/findIndex.js");\n/* harmony import */ var _createIndexFinder_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_createIndexFinder.js */ "./node_modules/underscore/modules/_createIndexFinder.js");\n\n\n\n\n// Return the position of the first occurrence of an item in an array,\n// or -1 if the item is not included in the array.\n// If the array is large and already in sort order, pass `true`\n// for **isSorted** to use binary search.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createIndexFinder_js__WEBPACK_IMPORTED_MODULE_2__["default"])(1, _findIndex_js__WEBPACK_IMPORTED_MODULE_1__["default"], _sortedIndex_js__WEBPACK_IMPORTED_MODULE_0__["default"]));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/indexOf.js?')},"./node_modules/underscore/modules/initial.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ initial)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n\n\n// Returns everything but the last entry of the array. Especially useful on\n// the arguments object. Passing **n** will return all the values in\n// the array, excluding the last N.\nfunction initial(array, n, guard) {\n return _setup_js__WEBPACK_IMPORTED_MODULE_0__.slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/initial.js?')},"./node_modules/underscore/modules/intersection.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ intersection)\n/* harmony export */ });\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_getLength.js */ "./node_modules/underscore/modules/_getLength.js");\n/* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./contains.js */ "./node_modules/underscore/modules/contains.js");\n\n\n\n// Produce an array that contains every item shared between all the\n// passed-in arrays.\nfunction intersection(array) {\n var result = [];\n var argsLength = arguments.length;\n for (var i = 0, length = (0,_getLength_js__WEBPACK_IMPORTED_MODULE_0__["default"])(array); i < length; i++) {\n var item = array[i];\n if ((0,_contains_js__WEBPACK_IMPORTED_MODULE_1__["default"])(result, item)) continue;\n var j;\n for (j = 1; j < argsLength; j++) {\n if (!(0,_contains_js__WEBPACK_IMPORTED_MODULE_1__["default"])(arguments[j], item)) break;\n }\n if (j === argsLength) result.push(item);\n }\n return result;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/intersection.js?')},"./node_modules/underscore/modules/invert.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ invert)\n/* harmony export */ });\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n// Invert the keys and values of an object. The values must be serializable.\nfunction invert(obj) {\n var result = {};\n var _keys = (0,_keys_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj);\n for (var i = 0, length = _keys.length; i < length; i++) {\n result[obj[_keys[i]]] = _keys[i];\n }\n return result;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/invert.js?')},"./node_modules/underscore/modules/invoke.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isFunction.js */ "./node_modules/underscore/modules/isFunction.js");\n/* harmony import */ var _map_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./map.js */ "./node_modules/underscore/modules/map.js");\n/* harmony import */ var _deepGet_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_deepGet.js */ "./node_modules/underscore/modules/_deepGet.js");\n/* harmony import */ var _toPath_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_toPath.js */ "./node_modules/underscore/modules/_toPath.js");\n\n\n\n\n\n\n// Invoke a method (with arguments) on every item in a collection.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(obj, path, args) {\n var contextPath, func;\n if ((0,_isFunction_js__WEBPACK_IMPORTED_MODULE_1__["default"])(path)) {\n func = path;\n } else {\n path = (0,_toPath_js__WEBPACK_IMPORTED_MODULE_4__["default"])(path);\n contextPath = path.slice(0, -1);\n path = path[path.length - 1];\n }\n return (0,_map_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj, function(context) {\n var method = func;\n if (!method) {\n if (contextPath && contextPath.length) {\n context = (0,_deepGet_js__WEBPACK_IMPORTED_MODULE_3__["default"])(context, contextPath);\n }\n if (context == null) return void 0;\n method = context[path];\n }\n return method == null ? method : method.apply(context, args);\n });\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/invoke.js?')},"./node_modules/underscore/modules/isArguments.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_has.js */ "./node_modules/underscore/modules/_has.js");\n\n\n\nvar isArguments = (0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'Arguments\');\n\n// Define a fallback version of the method in browsers (ahem, IE < 9), where\n// there isn\'t any inspectable "Arguments" type.\n(function() {\n if (!isArguments(arguments)) {\n isArguments = function(obj) {\n return (0,_has_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj, \'callee\');\n };\n }\n}());\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (isArguments);\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isArguments.js?')},"./node_modules/underscore/modules/isArray.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n\n\n\n// Is a given value an array?\n// Delegates to ECMA5\'s native `Array.isArray`.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_setup_js__WEBPACK_IMPORTED_MODULE_0__.nativeIsArray || (0,_tagTester_js__WEBPACK_IMPORTED_MODULE_1__["default"])(\'Array\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isArray.js?')},"./node_modules/underscore/modules/isArrayBuffer.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'ArrayBuffer\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isArrayBuffer.js?')},"./node_modules/underscore/modules/isBoolean.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ isBoolean)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n\n\n// Is a given value a boolean?\nfunction isBoolean(obj) {\n return obj === true || obj === false || _setup_js__WEBPACK_IMPORTED_MODULE_0__.toString.call(obj) === \'[object Boolean]\';\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isBoolean.js?')},"./node_modules/underscore/modules/isDataView.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isFunction.js */ "./node_modules/underscore/modules/isFunction.js");\n/* harmony import */ var _isArrayBuffer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isArrayBuffer.js */ "./node_modules/underscore/modules/isArrayBuffer.js");\n/* harmony import */ var _stringTagBug_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_stringTagBug.js */ "./node_modules/underscore/modules/_stringTagBug.js");\n\n\n\n\n\nvar isDataView = (0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'DataView\');\n\n// In IE 10 - Edge 13, we need a different heuristic\n// to determine whether an object is a `DataView`.\nfunction ie10IsDataView(obj) {\n return obj != null && (0,_isFunction_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj.getInt8) && (0,_isArrayBuffer_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj.buffer);\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_stringTagBug_js__WEBPACK_IMPORTED_MODULE_3__.hasStringTagBug ? ie10IsDataView : isDataView);\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isDataView.js?')},"./node_modules/underscore/modules/isDate.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'Date\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isDate.js?')},"./node_modules/underscore/modules/isElement.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ isElement)\n/* harmony export */ });\n// Is a given value a DOM element?\nfunction isElement(obj) {\n return !!(obj && obj.nodeType === 1);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isElement.js?')},"./node_modules/underscore/modules/isEmpty.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ isEmpty)\n/* harmony export */ });\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_getLength.js */ "./node_modules/underscore/modules/_getLength.js");\n/* harmony import */ var _isArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isArray.js */ "./node_modules/underscore/modules/isArray.js");\n/* harmony import */ var _isString_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isString.js */ "./node_modules/underscore/modules/isString.js");\n/* harmony import */ var _isArguments_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./isArguments.js */ "./node_modules/underscore/modules/isArguments.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n\n\n\n\n// Is a given array, string, or object empty?\n// An "empty" object has no enumerable own-properties.\nfunction isEmpty(obj) {\n if (obj == null) return true;\n // Skip the more expensive `toString`-based type checks if `obj` has no\n // `.length`.\n var length = (0,_getLength_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj);\n if (typeof length == \'number\' && (\n (0,_isArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj) || (0,_isString_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj) || (0,_isArguments_js__WEBPACK_IMPORTED_MODULE_3__["default"])(obj)\n )) return length === 0;\n return (0,_getLength_js__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_keys_js__WEBPACK_IMPORTED_MODULE_4__["default"])(obj)) === 0;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isEmpty.js?')},"./node_modules/underscore/modules/isEqual.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ isEqual)\n/* harmony export */ });\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./underscore.js */ "./node_modules/underscore/modules/underscore.js");\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _getByteLength_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_getByteLength.js */ "./node_modules/underscore/modules/_getByteLength.js");\n/* harmony import */ var _isTypedArray_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./isTypedArray.js */ "./node_modules/underscore/modules/isTypedArray.js");\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./isFunction.js */ "./node_modules/underscore/modules/isFunction.js");\n/* harmony import */ var _stringTagBug_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./_stringTagBug.js */ "./node_modules/underscore/modules/_stringTagBug.js");\n/* harmony import */ var _isDataView_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isDataView.js */ "./node_modules/underscore/modules/isDataView.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./_has.js */ "./node_modules/underscore/modules/_has.js");\n/* harmony import */ var _toBufferView_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./_toBufferView.js */ "./node_modules/underscore/modules/_toBufferView.js");\n\n\n\n\n\n\n\n\n\n\n\n// We use this string twice, so give it a name for minification.\nvar tagDataView = \'[object DataView]\';\n\n// Internal recursive comparison function for `_.isEqual`.\nfunction eq(a, b, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren\'t identical.\n // See the [Harmony `egal` proposal](https://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) return a !== 0 || 1 / a === 1 / b;\n // `null` or `undefined` only equal to itself (strict comparison).\n if (a == null || b == null) return false;\n // `NaN`s are equivalent, but non-reflexive.\n if (a !== a) return b !== b;\n // Exhaust primitive checks\n var type = typeof a;\n if (type !== \'function\' && type !== \'object\' && typeof b != \'object\') return false;\n return deepEq(a, b, aStack, bStack);\n}\n\n// Internal recursive comparison function for `_.isEqual`.\nfunction deepEq(a, b, aStack, bStack) {\n // Unwrap any wrapped objects.\n if (a instanceof _underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"]) a = a._wrapped;\n if (b instanceof _underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"]) b = b._wrapped;\n // Compare `[[Class]]` names.\n var className = _setup_js__WEBPACK_IMPORTED_MODULE_1__.toString.call(a);\n if (className !== _setup_js__WEBPACK_IMPORTED_MODULE_1__.toString.call(b)) return false;\n // Work around a bug in IE 10 - Edge 13.\n if (_stringTagBug_js__WEBPACK_IMPORTED_MODULE_5__.hasStringTagBug && className == \'[object Object]\' && (0,_isDataView_js__WEBPACK_IMPORTED_MODULE_6__["default"])(a)) {\n if (!(0,_isDataView_js__WEBPACK_IMPORTED_MODULE_6__["default"])(b)) return false;\n className = tagDataView;\n }\n switch (className) {\n // These types are compared by value.\n case \'[object RegExp]\':\n // RegExps are coerced to strings for comparison (Note: \'\' + /a/i === \'/a/i\')\n case \'[object String]\':\n // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is\n // equivalent to `new String("5")`.\n return \'\' + a === \'\' + b;\n case \'[object Number]\':\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN.\n if (+a !== +a) return +b !== +b;\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case \'[object Date]\':\n case \'[object Boolean]\':\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n case \'[object Symbol]\':\n return _setup_js__WEBPACK_IMPORTED_MODULE_1__.SymbolProto.valueOf.call(a) === _setup_js__WEBPACK_IMPORTED_MODULE_1__.SymbolProto.valueOf.call(b);\n case \'[object ArrayBuffer]\':\n case tagDataView:\n // Coerce to typed array so we can fall through.\n return deepEq((0,_toBufferView_js__WEBPACK_IMPORTED_MODULE_9__["default"])(a), (0,_toBufferView_js__WEBPACK_IMPORTED_MODULE_9__["default"])(b), aStack, bStack);\n }\n\n var areArrays = className === \'[object Array]\';\n if (!areArrays && (0,_isTypedArray_js__WEBPACK_IMPORTED_MODULE_3__["default"])(a)) {\n var byteLength = (0,_getByteLength_js__WEBPACK_IMPORTED_MODULE_2__["default"])(a);\n if (byteLength !== (0,_getByteLength_js__WEBPACK_IMPORTED_MODULE_2__["default"])(b)) return false;\n if (a.buffer === b.buffer && a.byteOffset === b.byteOffset) return true;\n areArrays = true;\n }\n if (!areArrays) {\n if (typeof a != \'object\' || typeof b != \'object\') return false;\n\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor, bCtor = b.constructor;\n if (aCtor !== bCtor && !((0,_isFunction_js__WEBPACK_IMPORTED_MODULE_4__["default"])(aCtor) && aCtor instanceof aCtor &&\n (0,_isFunction_js__WEBPACK_IMPORTED_MODULE_4__["default"])(bCtor) && bCtor instanceof bCtor)\n && (\'constructor\' in a && \'constructor\' in b)) {\n return false;\n }\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n\n // Initializing stack of traversed objects.\n // It\'s done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) return bStack[length] === b;\n }\n\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) return false;\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], aStack, bStack)) return false;\n }\n } else {\n // Deep compare objects.\n var _keys = (0,_keys_js__WEBPACK_IMPORTED_MODULE_7__["default"])(a), key;\n length = _keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if ((0,_keys_js__WEBPACK_IMPORTED_MODULE_7__["default"])(b).length !== length) return false;\n while (length--) {\n // Deep compare each member\n key = _keys[length];\n if (!((0,_has_js__WEBPACK_IMPORTED_MODULE_8__["default"])(b, key) && eq(a[key], b[key], aStack, bStack))) return false;\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n}\n\n// Perform a deep comparison to check if two objects are equal.\nfunction isEqual(a, b) {\n return eq(a, b);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isEqual.js?')},"./node_modules/underscore/modules/isError.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'Error\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isError.js?')},"./node_modules/underscore/modules/isFinite.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ isFinite)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _isSymbol_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isSymbol.js */ "./node_modules/underscore/modules/isSymbol.js");\n\n\n\n// Is a given object a finite number?\nfunction isFinite(obj) {\n return !(0,_isSymbol_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj) && (0,_setup_js__WEBPACK_IMPORTED_MODULE_0__._isFinite)(obj) && !isNaN(parseFloat(obj));\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isFinite.js?')},"./node_modules/underscore/modules/isFunction.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ \"./node_modules/underscore/modules/_tagTester.js\");\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_setup.js */ \"./node_modules/underscore/modules/_setup.js\");\n\n\n\nvar isFunction = (0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])('Function');\n\n// Optimize `isFunction` if appropriate. Work around some `typeof` bugs in old\n// v8, IE 11 (#1621), Safari 8 (#1929), and PhantomJS (#2236).\nvar nodelist = _setup_js__WEBPACK_IMPORTED_MODULE_1__.root.document && _setup_js__WEBPACK_IMPORTED_MODULE_1__.root.document.childNodes;\nif ( true && typeof Int8Array != 'object' && typeof nodelist != 'function') {\n isFunction = function(obj) {\n return typeof obj == 'function' || false;\n };\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (isFunction);\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isFunction.js?")},"./node_modules/underscore/modules/isMap.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n/* harmony import */ var _stringTagBug_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_stringTagBug.js */ "./node_modules/underscore/modules/_stringTagBug.js");\n/* harmony import */ var _methodFingerprint_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_methodFingerprint.js */ "./node_modules/underscore/modules/_methodFingerprint.js");\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_stringTagBug_js__WEBPACK_IMPORTED_MODULE_1__.isIE11 ? (0,_methodFingerprint_js__WEBPACK_IMPORTED_MODULE_2__.ie11fingerprint)(_methodFingerprint_js__WEBPACK_IMPORTED_MODULE_2__.mapMethods) : (0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'Map\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isMap.js?')},"./node_modules/underscore/modules/isMatch.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ isMatch)\n/* harmony export */ });\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n// Returns whether an object has a given set of `key:value` pairs.\nfunction isMatch(object, attrs) {\n var _keys = (0,_keys_js__WEBPACK_IMPORTED_MODULE_0__["default"])(attrs), length = _keys.length;\n if (object == null) return !length;\n var obj = Object(object);\n for (var i = 0; i < length; i++) {\n var key = _keys[i];\n if (attrs[key] !== obj[key] || !(key in obj)) return false;\n }\n return true;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isMatch.js?')},"./node_modules/underscore/modules/isNaN.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ isNaN)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _isNumber_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isNumber.js */ "./node_modules/underscore/modules/isNumber.js");\n\n\n\n// Is the given value `NaN`?\nfunction isNaN(obj) {\n return (0,_isNumber_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj) && (0,_setup_js__WEBPACK_IMPORTED_MODULE_0__._isNaN)(obj);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isNaN.js?')},"./node_modules/underscore/modules/isNull.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ isNull)\n/* harmony export */ });\n// Is a given value equal to null?\nfunction isNull(obj) {\n return obj === null;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isNull.js?')},"./node_modules/underscore/modules/isNumber.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'Number\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isNumber.js?')},"./node_modules/underscore/modules/isObject.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ isObject)\n/* harmony export */ });\n// Is a given variable an object?\nfunction isObject(obj) {\n var type = typeof obj;\n return type === 'function' || (type === 'object' && !!obj);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isObject.js?")},"./node_modules/underscore/modules/isRegExp.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'RegExp\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isRegExp.js?')},"./node_modules/underscore/modules/isSet.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n/* harmony import */ var _stringTagBug_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_stringTagBug.js */ "./node_modules/underscore/modules/_stringTagBug.js");\n/* harmony import */ var _methodFingerprint_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_methodFingerprint.js */ "./node_modules/underscore/modules/_methodFingerprint.js");\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_stringTagBug_js__WEBPACK_IMPORTED_MODULE_1__.isIE11 ? (0,_methodFingerprint_js__WEBPACK_IMPORTED_MODULE_2__.ie11fingerprint)(_methodFingerprint_js__WEBPACK_IMPORTED_MODULE_2__.setMethods) : (0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'Set\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isSet.js?')},"./node_modules/underscore/modules/isString.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'String\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isString.js?')},"./node_modules/underscore/modules/isSymbol.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'Symbol\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isSymbol.js?')},"./node_modules/underscore/modules/isTypedArray.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _isDataView_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isDataView.js */ "./node_modules/underscore/modules/isDataView.js");\n/* harmony import */ var _constant_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constant.js */ "./node_modules/underscore/modules/constant.js");\n/* harmony import */ var _isBufferLike_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_isBufferLike.js */ "./node_modules/underscore/modules/_isBufferLike.js");\n\n\n\n\n\n// Is a given value a typed array?\nvar typedArrayPattern = /\\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\\]/;\nfunction isTypedArray(obj) {\n // `ArrayBuffer.isView` is the most future-proof, so use it when available.\n // Otherwise, fall back on the above regular expression.\n return _setup_js__WEBPACK_IMPORTED_MODULE_0__.nativeIsView ? ((0,_setup_js__WEBPACK_IMPORTED_MODULE_0__.nativeIsView)(obj) && !(0,_isDataView_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj)) :\n (0,_isBufferLike_js__WEBPACK_IMPORTED_MODULE_3__["default"])(obj) && typedArrayPattern.test(_setup_js__WEBPACK_IMPORTED_MODULE_0__.toString.call(obj));\n}\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_setup_js__WEBPACK_IMPORTED_MODULE_0__.supportsArrayBuffer ? isTypedArray : (0,_constant_js__WEBPACK_IMPORTED_MODULE_2__["default"])(false));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isTypedArray.js?')},"./node_modules/underscore/modules/isUndefined.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ isUndefined)\n/* harmony export */ });\n// Is a given variable undefined?\nfunction isUndefined(obj) {\n return obj === void 0;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isUndefined.js?')},"./node_modules/underscore/modules/isWeakMap.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n/* harmony import */ var _stringTagBug_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_stringTagBug.js */ "./node_modules/underscore/modules/_stringTagBug.js");\n/* harmony import */ var _methodFingerprint_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_methodFingerprint.js */ "./node_modules/underscore/modules/_methodFingerprint.js");\n\n\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_stringTagBug_js__WEBPACK_IMPORTED_MODULE_1__.isIE11 ? (0,_methodFingerprint_js__WEBPACK_IMPORTED_MODULE_2__.ie11fingerprint)(_methodFingerprint_js__WEBPACK_IMPORTED_MODULE_2__.weakMapMethods) : (0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'WeakMap\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isWeakMap.js?')},"./node_modules/underscore/modules/isWeakSet.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _tagTester_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_tagTester.js */ "./node_modules/underscore/modules/_tagTester.js");\n\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_tagTester_js__WEBPACK_IMPORTED_MODULE_0__["default"])(\'WeakSet\'));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/isWeakSet.js?')},"./node_modules/underscore/modules/iteratee.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ iteratee)\n/* harmony export */ });\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./underscore.js */ "./node_modules/underscore/modules/underscore.js");\n/* harmony import */ var _baseIteratee_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_baseIteratee.js */ "./node_modules/underscore/modules/_baseIteratee.js");\n\n\n\n// External wrapper for our callback generator. Users may customize\n// `_.iteratee` if they want additional predicate/iteratee shorthand styles.\n// This abstraction hides the internal-only `argCount` argument.\nfunction iteratee(value, context) {\n return (0,_baseIteratee_js__WEBPACK_IMPORTED_MODULE_1__["default"])(value, context, Infinity);\n}\n_underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"].iteratee = iteratee;\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/iteratee.js?')},"./node_modules/underscore/modules/keys.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ keys)\n/* harmony export */ });\n/* harmony import */ var _isObject_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isObject.js */ "./node_modules/underscore/modules/isObject.js");\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_has.js */ "./node_modules/underscore/modules/_has.js");\n/* harmony import */ var _collectNonEnumProps_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_collectNonEnumProps.js */ "./node_modules/underscore/modules/_collectNonEnumProps.js");\n\n\n\n\n\n// Retrieve the names of an object\'s own properties.\n// Delegates to **ECMAScript 5**\'s native `Object.keys`.\nfunction keys(obj) {\n if (!(0,_isObject_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj)) return [];\n if (_setup_js__WEBPACK_IMPORTED_MODULE_1__.nativeKeys) return (0,_setup_js__WEBPACK_IMPORTED_MODULE_1__.nativeKeys)(obj);\n var keys = [];\n for (var key in obj) if ((0,_has_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (_setup_js__WEBPACK_IMPORTED_MODULE_1__.hasEnumBug) (0,_collectNonEnumProps_js__WEBPACK_IMPORTED_MODULE_3__["default"])(obj, keys);\n return keys;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/keys.js?')},"./node_modules/underscore/modules/last.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ last)\n/* harmony export */ });\n/* harmony import */ var _rest_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rest.js */ "./node_modules/underscore/modules/rest.js");\n\n\n// Get the last element of an array. Passing **n** will return the last N\n// values in the array.\nfunction last(array, n, guard) {\n if (array == null || array.length < 1) return n == null || guard ? void 0 : [];\n if (n == null || guard) return array[array.length - 1];\n return (0,_rest_js__WEBPACK_IMPORTED_MODULE_0__["default"])(array, Math.max(0, array.length - n));\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/last.js?')},"./node_modules/underscore/modules/lastIndexOf.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _findLastIndex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./findLastIndex.js */ "./node_modules/underscore/modules/findLastIndex.js");\n/* harmony import */ var _createIndexFinder_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_createIndexFinder.js */ "./node_modules/underscore/modules/_createIndexFinder.js");\n\n\n\n// Return the position of the last occurrence of an item in an array,\n// or -1 if the item is not included in the array.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createIndexFinder_js__WEBPACK_IMPORTED_MODULE_1__["default"])(-1, _findLastIndex_js__WEBPACK_IMPORTED_MODULE_0__["default"]));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/lastIndexOf.js?')},"./node_modules/underscore/modules/map.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ map)\n/* harmony export */ });\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n\n\n// Return the results of applying the iteratee to each element.\nfunction map(obj, iteratee, context) {\n iteratee = (0,_cb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(iteratee, context);\n var _keys = !(0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj) && (0,_keys_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj),\n length = (_keys || obj).length,\n results = Array(length);\n for (var index = 0; index < length; index++) {\n var currentKey = _keys ? _keys[index] : index;\n results[index] = iteratee(obj[currentKey], currentKey, obj);\n }\n return results;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/map.js?')},"./node_modules/underscore/modules/mapObject.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ mapObject)\n/* harmony export */ });\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n\n// Returns the results of applying the `iteratee` to each element of `obj`.\n// In contrast to `_.map` it returns an object.\nfunction mapObject(obj, iteratee, context) {\n iteratee = (0,_cb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(iteratee, context);\n var _keys = (0,_keys_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj),\n length = _keys.length,\n results = {};\n for (var index = 0; index < length; index++) {\n var currentKey = _keys[index];\n results[currentKey] = iteratee(obj[currentKey], currentKey, obj);\n }\n return results;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/mapObject.js?')},"./node_modules/underscore/modules/matcher.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ matcher)\n/* harmony export */ });\n/* harmony import */ var _extendOwn_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extendOwn.js */ "./node_modules/underscore/modules/extendOwn.js");\n/* harmony import */ var _isMatch_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isMatch.js */ "./node_modules/underscore/modules/isMatch.js");\n\n\n\n// Returns a predicate for checking whether an object has a given set of\n// `key:value` pairs.\nfunction matcher(attrs) {\n attrs = (0,_extendOwn_js__WEBPACK_IMPORTED_MODULE_0__["default"])({}, attrs);\n return function(obj) {\n return (0,_isMatch_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj, attrs);\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/matcher.js?')},"./node_modules/underscore/modules/max.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ max)\n/* harmony export */ });\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _values_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./values.js */ "./node_modules/underscore/modules/values.js");\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _each_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./each.js */ "./node_modules/underscore/modules/each.js");\n\n\n\n\n\n// Return the maximum element (or element-based computation).\nfunction max(obj, iteratee, context) {\n var result = -Infinity, lastComputed = -Infinity,\n value, computed;\n if (iteratee == null || (typeof iteratee == \'number\' && typeof obj[0] != \'object\' && obj != null)) {\n obj = (0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj) ? obj : (0,_values_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj);\n for (var i = 0, length = obj.length; i < length; i++) {\n value = obj[i];\n if (value != null && value > result) {\n result = value;\n }\n }\n } else {\n iteratee = (0,_cb_js__WEBPACK_IMPORTED_MODULE_2__["default"])(iteratee, context);\n (0,_each_js__WEBPACK_IMPORTED_MODULE_3__["default"])(obj, function(v, index, list) {\n computed = iteratee(v, index, list);\n if (computed > lastComputed || (computed === -Infinity && result === -Infinity)) {\n result = v;\n lastComputed = computed;\n }\n });\n }\n return result;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/max.js?')},"./node_modules/underscore/modules/memoize.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ memoize)\n/* harmony export */ });\n/* harmony import */ var _has_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_has.js */ "./node_modules/underscore/modules/_has.js");\n\n\n// Memoize an expensive function by storing its results.\nfunction memoize(func, hasher) {\n var memoize = function(key) {\n var cache = memoize.cache;\n var address = \'\' + (hasher ? hasher.apply(this, arguments) : key);\n if (!(0,_has_js__WEBPACK_IMPORTED_MODULE_0__["default"])(cache, address)) cache[address] = func.apply(this, arguments);\n return cache[address];\n };\n memoize.cache = {};\n return memoize;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/memoize.js?')},"./node_modules/underscore/modules/min.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ min)\n/* harmony export */ });\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _values_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./values.js */ "./node_modules/underscore/modules/values.js");\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _each_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./each.js */ "./node_modules/underscore/modules/each.js");\n\n\n\n\n\n// Return the minimum element (or element-based computation).\nfunction min(obj, iteratee, context) {\n var result = Infinity, lastComputed = Infinity,\n value, computed;\n if (iteratee == null || (typeof iteratee == \'number\' && typeof obj[0] != \'object\' && obj != null)) {\n obj = (0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj) ? obj : (0,_values_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj);\n for (var i = 0, length = obj.length; i < length; i++) {\n value = obj[i];\n if (value != null && value < result) {\n result = value;\n }\n }\n } else {\n iteratee = (0,_cb_js__WEBPACK_IMPORTED_MODULE_2__["default"])(iteratee, context);\n (0,_each_js__WEBPACK_IMPORTED_MODULE_3__["default"])(obj, function(v, index, list) {\n computed = iteratee(v, index, list);\n if (computed < lastComputed || (computed === Infinity && result === Infinity)) {\n result = v;\n lastComputed = computed;\n }\n });\n }\n return result;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/min.js?')},"./node_modules/underscore/modules/mixin.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ mixin)\n/* harmony export */ });\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./underscore.js */ "./node_modules/underscore/modules/underscore.js");\n/* harmony import */ var _each_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./each.js */ "./node_modules/underscore/modules/each.js");\n/* harmony import */ var _functions_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./functions.js */ "./node_modules/underscore/modules/functions.js");\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _chainResult_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_chainResult.js */ "./node_modules/underscore/modules/_chainResult.js");\n\n\n\n\n\n\n// Add your own custom functions to the Underscore object.\nfunction mixin(obj) {\n (0,_each_js__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_functions_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj), function(name) {\n var func = _underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"][name] = obj[name];\n _underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"].prototype[name] = function() {\n var args = [this._wrapped];\n _setup_js__WEBPACK_IMPORTED_MODULE_3__.push.apply(args, arguments);\n return (0,_chainResult_js__WEBPACK_IMPORTED_MODULE_4__["default"])(this, func.apply(_underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"], args));\n };\n });\n return _underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"];\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/mixin.js?')},"./node_modules/underscore/modules/negate.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ negate)\n/* harmony export */ });\n// Returns a negated version of the passed-in predicate.\nfunction negate(predicate) {\n return function() {\n return !predicate.apply(this, arguments);\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/negate.js?')},"./node_modules/underscore/modules/noop.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ noop)\n/* harmony export */ });\n// Predicate-generating function. Often useful outside of Underscore.\nfunction noop(){}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/noop.js?')},"./node_modules/underscore/modules/now.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n// A (possibly faster) way to get the current timestamp as an integer.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Date.now || function() {\n return new Date().getTime();\n});\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/now.js?')},"./node_modules/underscore/modules/object.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ object)\n/* harmony export */ });\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_getLength.js */ "./node_modules/underscore/modules/_getLength.js");\n\n\n// Converts lists into objects. Pass either a single array of `[key, value]`\n// pairs, or two parallel arrays of the same length -- one of keys, and one of\n// the corresponding values. Passing by pairs is the reverse of `_.pairs`.\nfunction object(list, values) {\n var result = {};\n for (var i = 0, length = (0,_getLength_js__WEBPACK_IMPORTED_MODULE_0__["default"])(list); i < length; i++) {\n if (values) {\n result[list[i]] = values[i];\n } else {\n result[list[i][0]] = list[i][1];\n }\n }\n return result;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/object.js?')},"./node_modules/underscore/modules/omit.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isFunction.js */ "./node_modules/underscore/modules/isFunction.js");\n/* harmony import */ var _negate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./negate.js */ "./node_modules/underscore/modules/negate.js");\n/* harmony import */ var _map_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./map.js */ "./node_modules/underscore/modules/map.js");\n/* harmony import */ var _flatten_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_flatten.js */ "./node_modules/underscore/modules/_flatten.js");\n/* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./contains.js */ "./node_modules/underscore/modules/contains.js");\n/* harmony import */ var _pick_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./pick.js */ "./node_modules/underscore/modules/pick.js");\n\n\n\n\n\n\n\n\n// Return a copy of the object without the disallowed properties.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(obj, keys) {\n var iteratee = keys[0], context;\n if ((0,_isFunction_js__WEBPACK_IMPORTED_MODULE_1__["default"])(iteratee)) {\n iteratee = (0,_negate_js__WEBPACK_IMPORTED_MODULE_2__["default"])(iteratee);\n if (keys.length > 1) context = keys[1];\n } else {\n keys = (0,_map_js__WEBPACK_IMPORTED_MODULE_3__["default"])((0,_flatten_js__WEBPACK_IMPORTED_MODULE_4__["default"])(keys, false, false), String);\n iteratee = function(value, key) {\n return !(0,_contains_js__WEBPACK_IMPORTED_MODULE_5__["default"])(keys, key);\n };\n }\n return (0,_pick_js__WEBPACK_IMPORTED_MODULE_6__["default"])(obj, iteratee, context);\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/omit.js?')},"./node_modules/underscore/modules/once.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _partial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./partial.js */ "./node_modules/underscore/modules/partial.js");\n/* harmony import */ var _before_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./before.js */ "./node_modules/underscore/modules/before.js");\n\n\n\n// Returns a function that will be executed at most one time, no matter how\n// often you call it. Useful for lazy initialization.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_partial_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_before_js__WEBPACK_IMPORTED_MODULE_1__["default"], 2));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/once.js?')},"./node_modules/underscore/modules/pairs.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ pairs)\n/* harmony export */ });\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n// Convert an object into a list of `[key, value]` pairs.\n// The opposite of `_.object` with one argument.\nfunction pairs(obj) {\n var _keys = (0,_keys_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj);\n var length = _keys.length;\n var pairs = Array(length);\n for (var i = 0; i < length; i++) {\n pairs[i] = [_keys[i], obj[_keys[i]]];\n }\n return pairs;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/pairs.js?')},"./node_modules/underscore/modules/partial.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _executeBound_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_executeBound.js */ "./node_modules/underscore/modules/_executeBound.js");\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./underscore.js */ "./node_modules/underscore/modules/underscore.js");\n\n\n\n\n// Partially apply a function by creating a version that has had some of its\n// arguments pre-filled, without changing its dynamic `this` context. `_` acts\n// as a placeholder by default, allowing any combination of arguments to be\n// pre-filled. Set `_.partial.placeholder` for a custom placeholder argument.\nvar partial = (0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(func, boundArgs) {\n var placeholder = partial.placeholder;\n var bound = function() {\n var position = 0, length = boundArgs.length;\n var args = Array(length);\n for (var i = 0; i < length; i++) {\n args[i] = boundArgs[i] === placeholder ? arguments[position++] : boundArgs[i];\n }\n while (position < arguments.length) args.push(arguments[position++]);\n return (0,_executeBound_js__WEBPACK_IMPORTED_MODULE_1__["default"])(func, bound, this, this, args);\n };\n return bound;\n});\n\npartial.placeholder = _underscore_js__WEBPACK_IMPORTED_MODULE_2__["default"];\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (partial);\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/partial.js?')},"./node_modules/underscore/modules/partition.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _group_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_group.js */ "./node_modules/underscore/modules/_group.js");\n\n\n// Split a collection into two arrays: one whose elements all pass the given\n// truth test, and one whose elements all do not pass the truth test.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_group_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(result, value, pass) {\n result[pass ? 0 : 1].push(value);\n}, true));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/partition.js?')},"./node_modules/underscore/modules/pick.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isFunction.js */ "./node_modules/underscore/modules/isFunction.js");\n/* harmony import */ var _optimizeCb_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_optimizeCb.js */ "./node_modules/underscore/modules/_optimizeCb.js");\n/* harmony import */ var _allKeys_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./allKeys.js */ "./node_modules/underscore/modules/allKeys.js");\n/* harmony import */ var _keyInObj_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./_keyInObj.js */ "./node_modules/underscore/modules/_keyInObj.js");\n/* harmony import */ var _flatten_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./_flatten.js */ "./node_modules/underscore/modules/_flatten.js");\n\n\n\n\n\n\n\n// Return a copy of the object only containing the allowed properties.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(obj, keys) {\n var result = {}, iteratee = keys[0];\n if (obj == null) return result;\n if ((0,_isFunction_js__WEBPACK_IMPORTED_MODULE_1__["default"])(iteratee)) {\n if (keys.length > 1) iteratee = (0,_optimizeCb_js__WEBPACK_IMPORTED_MODULE_2__["default"])(iteratee, keys[1]);\n keys = (0,_allKeys_js__WEBPACK_IMPORTED_MODULE_3__["default"])(obj);\n } else {\n iteratee = _keyInObj_js__WEBPACK_IMPORTED_MODULE_4__["default"];\n keys = (0,_flatten_js__WEBPACK_IMPORTED_MODULE_5__["default"])(keys, false, false);\n obj = Object(obj);\n }\n for (var i = 0, length = keys.length; i < length; i++) {\n var key = keys[i];\n var value = obj[key];\n if (iteratee(value, key, obj)) result[key] = value;\n }\n return result;\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/pick.js?')},"./node_modules/underscore/modules/pluck.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ pluck)\n/* harmony export */ });\n/* harmony import */ var _map_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./map.js */ "./node_modules/underscore/modules/map.js");\n/* harmony import */ var _property_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./property.js */ "./node_modules/underscore/modules/property.js");\n\n\n\n// Convenience version of a common use case of `_.map`: fetching a property.\nfunction pluck(obj, key) {\n return (0,_map_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj, (0,_property_js__WEBPACK_IMPORTED_MODULE_1__["default"])(key));\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/pluck.js?')},"./node_modules/underscore/modules/property.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ property)\n/* harmony export */ });\n/* harmony import */ var _deepGet_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_deepGet.js */ "./node_modules/underscore/modules/_deepGet.js");\n/* harmony import */ var _toPath_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_toPath.js */ "./node_modules/underscore/modules/_toPath.js");\n\n\n\n// Creates a function that, when passed an object, will traverse that object’s\n// properties down the given `path`, specified as an array of keys or indices.\nfunction property(path) {\n path = (0,_toPath_js__WEBPACK_IMPORTED_MODULE_1__["default"])(path);\n return function(obj) {\n return (0,_deepGet_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj, path);\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/property.js?')},"./node_modules/underscore/modules/propertyOf.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ propertyOf)\n/* harmony export */ });\n/* harmony import */ var _noop_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./noop.js */ "./node_modules/underscore/modules/noop.js");\n/* harmony import */ var _get_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./get.js */ "./node_modules/underscore/modules/get.js");\n\n\n\n// Generates a function for a given object that returns a given property.\nfunction propertyOf(obj) {\n if (obj == null) return _noop_js__WEBPACK_IMPORTED_MODULE_0__["default"];\n return function(path) {\n return (0,_get_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj, path);\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/propertyOf.js?')},"./node_modules/underscore/modules/random.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ random)\n/* harmony export */ });\n// Return a random integer between `min` and `max` (inclusive).\nfunction random(min, max) {\n if (max == null) {\n max = min;\n min = 0;\n }\n return min + Math.floor(Math.random() * (max - min + 1));\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/random.js?')},"./node_modules/underscore/modules/range.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ range)\n/* harmony export */ });\n// Generate an integer Array containing an arithmetic progression. A port of\n// the native Python `range()` function. See\n// [the Python documentation](https://docs.python.org/library/functions.html#range).\nfunction range(start, stop, step) {\n if (stop == null) {\n stop = start || 0;\n start = 0;\n }\n if (!step) {\n step = stop < start ? -1 : 1;\n }\n\n var length = Math.max(Math.ceil((stop - start) / step), 0);\n var range = Array(length);\n\n for (var idx = 0; idx < length; idx++, start += step) {\n range[idx] = start;\n }\n\n return range;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/range.js?')},"./node_modules/underscore/modules/reduce.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _createReduce_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_createReduce.js */ "./node_modules/underscore/modules/_createReduce.js");\n\n\n// **Reduce** builds up a single result from a list of values, aka `inject`,\n// or `foldl`.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createReduce_js__WEBPACK_IMPORTED_MODULE_0__["default"])(1));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/reduce.js?')},"./node_modules/underscore/modules/reduceRight.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _createReduce_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_createReduce.js */ "./node_modules/underscore/modules/_createReduce.js");\n\n\n// The right-associative version of reduce, also known as `foldr`.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createReduce_js__WEBPACK_IMPORTED_MODULE_0__["default"])(-1));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/reduceRight.js?')},"./node_modules/underscore/modules/reject.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ reject)\n/* harmony export */ });\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filter.js */ "./node_modules/underscore/modules/filter.js");\n/* harmony import */ var _negate_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./negate.js */ "./node_modules/underscore/modules/negate.js");\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n\n\n\n\n// Return all the elements for which a truth test fails.\nfunction reject(obj, predicate, context) {\n return (0,_filter_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj, (0,_negate_js__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_cb_js__WEBPACK_IMPORTED_MODULE_2__["default"])(predicate)), context);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/reject.js?')},"./node_modules/underscore/modules/rest.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ rest)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n\n\n// Returns everything but the first entry of the `array`. Especially useful on\n// the `arguments` object. Passing an **n** will return the rest N values in the\n// `array`.\nfunction rest(array, n, guard) {\n return _setup_js__WEBPACK_IMPORTED_MODULE_0__.slice.call(array, n == null || guard ? 1 : n);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/rest.js?')},"./node_modules/underscore/modules/restArguments.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ restArguments)\n/* harmony export */ });\n// Some functions take a variable number of arguments, or a few expected\n// arguments at the beginning and then a variable number of values to operate\n// on. This helper accumulates all remaining arguments past the function’s\n// argument length (or an explicit `startIndex`), into an array that becomes\n// the last argument. Similar to ES6’s "rest parameter".\nfunction restArguments(func, startIndex) {\n startIndex = startIndex == null ? func.length - 1 : +startIndex;\n return function() {\n var length = Math.max(arguments.length - startIndex, 0),\n rest = Array(length),\n index = 0;\n for (; index < length; index++) {\n rest[index] = arguments[index + startIndex];\n }\n switch (startIndex) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, arguments[0], rest);\n case 2: return func.call(this, arguments[0], arguments[1], rest);\n }\n var args = Array(startIndex + 1);\n for (index = 0; index < startIndex; index++) {\n args[index] = arguments[index];\n }\n args[startIndex] = rest;\n return func.apply(this, args);\n };\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/restArguments.js?')},"./node_modules/underscore/modules/result.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ result)\n/* harmony export */ });\n/* harmony import */ var _isFunction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isFunction.js */ "./node_modules/underscore/modules/isFunction.js");\n/* harmony import */ var _toPath_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_toPath.js */ "./node_modules/underscore/modules/_toPath.js");\n\n\n\n// Traverses the children of `obj` along `path`. If a child is a function, it\n// is invoked with its parent as context. Returns the value of the final\n// child, or `fallback` if any child is undefined.\nfunction result(obj, path, fallback) {\n path = (0,_toPath_js__WEBPACK_IMPORTED_MODULE_1__["default"])(path);\n var length = path.length;\n if (!length) {\n return (0,_isFunction_js__WEBPACK_IMPORTED_MODULE_0__["default"])(fallback) ? fallback.call(obj) : fallback;\n }\n for (var i = 0; i < length; i++) {\n var prop = obj == null ? void 0 : obj[path[i]];\n if (prop === void 0) {\n prop = fallback;\n i = length; // Ensure we don\'t continue iterating.\n }\n obj = (0,_isFunction_js__WEBPACK_IMPORTED_MODULE_0__["default"])(prop) ? prop.call(obj) : prop;\n }\n return obj;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/result.js?')},"./node_modules/underscore/modules/sample.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ sample)\n/* harmony export */ });\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _values_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./values.js */ "./node_modules/underscore/modules/values.js");\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_getLength.js */ "./node_modules/underscore/modules/_getLength.js");\n/* harmony import */ var _random_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./random.js */ "./node_modules/underscore/modules/random.js");\n/* harmony import */ var _toArray_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./toArray.js */ "./node_modules/underscore/modules/toArray.js");\n\n\n\n\n\n\n// Sample **n** random values from a collection using the modern version of the\n// [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher–Yates_shuffle).\n// If **n** is not specified, returns a single random element.\n// The internal `guard` argument allows it to work with `_.map`.\nfunction sample(obj, n, guard) {\n if (n == null || guard) {\n if (!(0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj)) obj = (0,_values_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj);\n return obj[(0,_random_js__WEBPACK_IMPORTED_MODULE_3__["default"])(obj.length - 1)];\n }\n var sample = (0,_toArray_js__WEBPACK_IMPORTED_MODULE_4__["default"])(obj);\n var length = (0,_getLength_js__WEBPACK_IMPORTED_MODULE_2__["default"])(sample);\n n = Math.max(Math.min(n, length), 0);\n var last = length - 1;\n for (var index = 0; index < n; index++) {\n var rand = (0,_random_js__WEBPACK_IMPORTED_MODULE_3__["default"])(index, last);\n var temp = sample[index];\n sample[index] = sample[rand];\n sample[rand] = temp;\n }\n return sample.slice(0, n);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/sample.js?')},"./node_modules/underscore/modules/shuffle.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ shuffle)\n/* harmony export */ });\n/* harmony import */ var _sample_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sample.js */ "./node_modules/underscore/modules/sample.js");\n\n\n// Shuffle a collection.\nfunction shuffle(obj) {\n return (0,_sample_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj, Infinity);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/shuffle.js?')},"./node_modules/underscore/modules/size.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ size)\n/* harmony export */ });\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n\n// Return the number of elements in a collection.\nfunction size(obj) {\n if (obj == null) return 0;\n return (0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj) ? obj.length : (0,_keys_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj).length;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/size.js?')},"./node_modules/underscore/modules/some.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ some)\n/* harmony export */ });\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n\n\n// Determine if at least one element in the object passes a truth test.\nfunction some(obj, predicate, context) {\n predicate = (0,_cb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(predicate, context);\n var _keys = !(0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_1__["default"])(obj) && (0,_keys_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj),\n length = (_keys || obj).length;\n for (var index = 0; index < length; index++) {\n var currentKey = _keys ? _keys[index] : index;\n if (predicate(obj[currentKey], currentKey, obj)) return true;\n }\n return false;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/some.js?')},"./node_modules/underscore/modules/sortBy.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ sortBy)\n/* harmony export */ });\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _pluck_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pluck.js */ "./node_modules/underscore/modules/pluck.js");\n/* harmony import */ var _map_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./map.js */ "./node_modules/underscore/modules/map.js");\n\n\n\n\n// Sort the object\'s values by a criterion produced by an iteratee.\nfunction sortBy(obj, iteratee, context) {\n var index = 0;\n iteratee = (0,_cb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(iteratee, context);\n return (0,_pluck_js__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_map_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj, function(value, key, list) {\n return {\n value: value,\n index: index++,\n criteria: iteratee(value, key, list)\n };\n }).sort(function(left, right) {\n var a = left.criteria;\n var b = right.criteria;\n if (a !== b) {\n if (a > b || a === void 0) return 1;\n if (a < b || b === void 0) return -1;\n }\n return left.index - right.index;\n }), \'value\');\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/sortBy.js?')},"./node_modules/underscore/modules/sortedIndex.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ sortedIndex)\n/* harmony export */ });\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_getLength.js */ "./node_modules/underscore/modules/_getLength.js");\n\n\n\n// Use a comparator function to figure out the smallest index at which\n// an object should be inserted so as to maintain order. Uses binary search.\nfunction sortedIndex(array, obj, iteratee, context) {\n iteratee = (0,_cb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(iteratee, context, 1);\n var value = iteratee(obj);\n var low = 0, high = (0,_getLength_js__WEBPACK_IMPORTED_MODULE_1__["default"])(array);\n while (low < high) {\n var mid = Math.floor((low + high) / 2);\n if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;\n }\n return low;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/sortedIndex.js?')},"./node_modules/underscore/modules/tap.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ tap)\n/* harmony export */ });\n// Invokes `interceptor` with the `obj` and then returns `obj`.\n// The primary purpose of this method is to "tap into" a method chain, in\n// order to perform operations on intermediate results within the chain.\nfunction tap(obj, interceptor) {\n interceptor(obj);\n return obj;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/tap.js?')},"./node_modules/underscore/modules/template.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ template)\n/* harmony export */ });\n/* harmony import */ var _defaults_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaults.js */ \"./node_modules/underscore/modules/defaults.js\");\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./underscore.js */ \"./node_modules/underscore/modules/underscore.js\");\n/* harmony import */ var _templateSettings_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./templateSettings.js */ \"./node_modules/underscore/modules/templateSettings.js\");\n\n\n\n\n// When customizing `_.templateSettings`, if you don't want to define an\n// interpolation, evaluation or escaping regex, we need one that is\n// guaranteed not to match.\nvar noMatch = /(.)^/;\n\n// Certain characters need to be escaped so that they can be put into a\n// string literal.\nvar escapes = {\n \"'\": \"'\",\n '\\\\': '\\\\',\n '\\r': 'r',\n '\\n': 'n',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n};\n\nvar escapeRegExp = /\\\\|'|\\r|\\n|\\u2028|\\u2029/g;\n\nfunction escapeChar(match) {\n return '\\\\' + escapes[match];\n}\n\n// In order to prevent third-party code injection through\n// `_.templateSettings.variable`, we test it against the following regular\n// expression. It is intentionally a bit more liberal than just matching valid\n// identifiers, but still prevents possible loopholes through defaults or\n// destructuring assignment.\nvar bareIdentifier = /^\\s*(\\w|\\$)+\\s*$/;\n\n// JavaScript micro-templating, similar to John Resig's implementation.\n// Underscore templating handles arbitrary delimiters, preserves whitespace,\n// and correctly escapes quotes within interpolated code.\n// NB: `oldSettings` only exists for backwards compatibility.\nfunction template(text, settings, oldSettings) {\n if (!settings && oldSettings) settings = oldSettings;\n settings = (0,_defaults_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"])({}, settings, _underscore_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"].templateSettings);\n\n // Combine delimiters into one regular expression via alternation.\n var matcher = RegExp([\n (settings.escape || noMatch).source,\n (settings.interpolate || noMatch).source,\n (settings.evaluate || noMatch).source\n ].join('|') + '|$', 'g');\n\n // Compile the template source, escaping string literals appropriately.\n var index = 0;\n var source = \"__p+='\";\n text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {\n source += text.slice(index, offset).replace(escapeRegExp, escapeChar);\n index = offset + match.length;\n\n if (escape) {\n source += \"'+\\n((__t=(\" + escape + \"))==null?'':_.escape(__t))+\\n'\";\n } else if (interpolate) {\n source += \"'+\\n((__t=(\" + interpolate + \"))==null?'':__t)+\\n'\";\n } else if (evaluate) {\n source += \"';\\n\" + evaluate + \"\\n__p+='\";\n }\n\n // Adobe VMs need the match returned to produce the correct offset.\n return match;\n });\n source += \"';\\n\";\n\n var argument = settings.variable;\n if (argument) {\n // Insure against third-party code injection. (CVE-2021-23358)\n if (!bareIdentifier.test(argument)) throw new Error(\n 'variable is not a bare identifier: ' + argument\n );\n } else {\n // If a variable is not specified, place data values in local scope.\n source = 'with(obj||{}){\\n' + source + '}\\n';\n argument = 'obj';\n }\n\n source = \"var __t,__p='',__j=Array.prototype.join,\" +\n \"print=function(){__p+=__j.call(arguments,'');};\\n\" +\n source + 'return __p;\\n';\n\n var render;\n try {\n render = new Function(argument, '_', source);\n } catch (e) {\n e.source = source;\n throw e;\n }\n\n var template = function(data) {\n return render.call(this, data, _underscore_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n };\n\n // Provide the compiled source as a convenience for precompilation.\n template.source = 'function(' + argument + '){\\n' + source + '}';\n\n return template;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/template.js?")},"./node_modules/underscore/modules/templateSettings.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./underscore.js */ "./node_modules/underscore/modules/underscore.js");\n\n\n// By default, Underscore uses ERB-style template delimiters. Change the\n// following template settings to use alternative delimiters.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"].templateSettings = {\n evaluate: /<%([\\s\\S]+?)%>/g,\n interpolate: /<%=([\\s\\S]+?)%>/g,\n escape: /<%-([\\s\\S]+?)%>/g\n});\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/templateSettings.js?')},"./node_modules/underscore/modules/throttle.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ throttle)\n/* harmony export */ });\n/* harmony import */ var _now_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./now.js */ "./node_modules/underscore/modules/now.js");\n\n\n// Returns a function, that, when invoked, will only be triggered at most once\n// during a given window of time. Normally, the throttled function will run\n// as much as it can, without ever going more than once per `wait` duration;\n// but if you\'d like to disable the execution on the leading edge, pass\n// `{leading: false}`. To disable execution on the trailing edge, ditto.\nfunction throttle(func, wait, options) {\n var timeout, context, args, result;\n var previous = 0;\n if (!options) options = {};\n\n var later = function() {\n previous = options.leading === false ? 0 : (0,_now_js__WEBPACK_IMPORTED_MODULE_0__["default"])();\n timeout = null;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n };\n\n var throttled = function() {\n var _now = (0,_now_js__WEBPACK_IMPORTED_MODULE_0__["default"])();\n if (!previous && options.leading === false) previous = _now;\n var remaining = wait - (_now - previous);\n context = this;\n args = arguments;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = _now;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(later, remaining);\n }\n return result;\n };\n\n throttled.cancel = function() {\n clearTimeout(timeout);\n previous = 0;\n timeout = context = args = null;\n };\n\n return throttled;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/throttle.js?')},"./node_modules/underscore/modules/times.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ times)\n/* harmony export */ });\n/* harmony import */ var _optimizeCb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_optimizeCb.js */ "./node_modules/underscore/modules/_optimizeCb.js");\n\n\n// Run a function **n** times.\nfunction times(n, iteratee, context) {\n var accum = Array(Math.max(0, n));\n iteratee = (0,_optimizeCb_js__WEBPACK_IMPORTED_MODULE_0__["default"])(iteratee, context, 1);\n for (var i = 0; i < n; i++) accum[i] = iteratee(i);\n return accum;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/times.js?')},"./node_modules/underscore/modules/toArray.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ toArray)\n/* harmony export */ });\n/* harmony import */ var _isArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isArray.js */ "./node_modules/underscore/modules/isArray.js");\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n/* harmony import */ var _isString_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./isString.js */ "./node_modules/underscore/modules/isString.js");\n/* harmony import */ var _isArrayLike_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_isArrayLike.js */ "./node_modules/underscore/modules/_isArrayLike.js");\n/* harmony import */ var _map_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./map.js */ "./node_modules/underscore/modules/map.js");\n/* harmony import */ var _identity_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./identity.js */ "./node_modules/underscore/modules/identity.js");\n/* harmony import */ var _values_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./values.js */ "./node_modules/underscore/modules/values.js");\n\n\n\n\n\n\n\n\n// Safely create a real, live array from anything iterable.\nvar reStrSymbol = /[^\\ud800-\\udfff]|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff]/g;\nfunction toArray(obj) {\n if (!obj) return [];\n if ((0,_isArray_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj)) return _setup_js__WEBPACK_IMPORTED_MODULE_1__.slice.call(obj);\n if ((0,_isString_js__WEBPACK_IMPORTED_MODULE_2__["default"])(obj)) {\n // Keep surrogate pair characters together.\n return obj.match(reStrSymbol);\n }\n if ((0,_isArrayLike_js__WEBPACK_IMPORTED_MODULE_3__["default"])(obj)) return (0,_map_js__WEBPACK_IMPORTED_MODULE_4__["default"])(obj, _identity_js__WEBPACK_IMPORTED_MODULE_5__["default"]);\n return (0,_values_js__WEBPACK_IMPORTED_MODULE_6__["default"])(obj);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/toArray.js?')},"./node_modules/underscore/modules/toPath.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ toPath)\n/* harmony export */ });\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./underscore.js */ "./node_modules/underscore/modules/underscore.js");\n/* harmony import */ var _isArray_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isArray.js */ "./node_modules/underscore/modules/isArray.js");\n\n\n\n// Normalize a (deep) property `path` to array.\n// Like `_.iteratee`, this function can be customized.\nfunction toPath(path) {\n return (0,_isArray_js__WEBPACK_IMPORTED_MODULE_1__["default"])(path) ? path : [path];\n}\n_underscore_js__WEBPACK_IMPORTED_MODULE_0__["default"].toPath = toPath;\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/toPath.js?')},"./node_modules/underscore/modules/underscore-array-methods.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _underscore_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./underscore.js */ \"./node_modules/underscore/modules/underscore.js\");\n/* harmony import */ var _each_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./each.js */ \"./node_modules/underscore/modules/each.js\");\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_setup.js */ \"./node_modules/underscore/modules/_setup.js\");\n/* harmony import */ var _chainResult_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./_chainResult.js */ \"./node_modules/underscore/modules/_chainResult.js\");\n\n\n\n\n\n// Add all mutator `Array` functions to the wrapper.\n(0,_each_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {\n var method = _setup_js__WEBPACK_IMPORTED_MODULE_2__.ArrayProto[name];\n _underscore_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].prototype[name] = function() {\n var obj = this._wrapped;\n if (obj != null) {\n method.apply(obj, arguments);\n if ((name === 'shift' || name === 'splice') && obj.length === 0) {\n delete obj[0];\n }\n }\n return (0,_chainResult_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this, obj);\n };\n});\n\n// Add all accessor `Array` functions to the wrapper.\n(0,_each_js__WEBPACK_IMPORTED_MODULE_1__[\"default\"])(['concat', 'join', 'slice'], function(name) {\n var method = _setup_js__WEBPACK_IMPORTED_MODULE_2__.ArrayProto[name];\n _underscore_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"].prototype[name] = function() {\n var obj = this._wrapped;\n if (obj != null) obj = method.apply(obj, arguments);\n return (0,_chainResult_js__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(this, obj);\n };\n});\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_underscore_js__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/underscore-array-methods.js?")},"./node_modules/underscore/modules/underscore.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ _)\n/* harmony export */ });\n/* harmony import */ var _setup_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_setup.js */ "./node_modules/underscore/modules/_setup.js");\n\n\n// If Underscore is called as a function, it returns a wrapped object that can\n// be used OO-style. This wrapper holds altered versions of all functions added\n// through `_.mixin`. Wrapped objects may be chained.\nfunction _(obj) {\n if (obj instanceof _) return obj;\n if (!(this instanceof _)) return new _(obj);\n this._wrapped = obj;\n}\n\n_.VERSION = _setup_js__WEBPACK_IMPORTED_MODULE_0__.VERSION;\n\n// Extracts the result from a wrapped and chained object.\n_.prototype.value = function() {\n return this._wrapped;\n};\n\n// Provide unwrapping proxies for some methods used in engine operations\n// such as arithmetic and JSON stringification.\n_.prototype.valueOf = _.prototype.toJSON = _.prototype.value;\n\n_.prototype.toString = function() {\n return String(this._wrapped);\n};\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/underscore.js?')},"./node_modules/underscore/modules/unescape.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _createEscaper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_createEscaper.js */ "./node_modules/underscore/modules/_createEscaper.js");\n/* harmony import */ var _unescapeMap_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_unescapeMap.js */ "./node_modules/underscore/modules/_unescapeMap.js");\n\n\n\n// Function for unescaping strings from HTML interpolation.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_createEscaper_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_unescapeMap_js__WEBPACK_IMPORTED_MODULE_1__["default"]));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/unescape.js?')},"./node_modules/underscore/modules/union.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _uniq_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./uniq.js */ "./node_modules/underscore/modules/uniq.js");\n/* harmony import */ var _flatten_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_flatten.js */ "./node_modules/underscore/modules/_flatten.js");\n\n\n\n\n// Produce an array that contains the union: each distinct element from all of\n// the passed-in arrays.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(arrays) {\n return (0,_uniq_js__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_flatten_js__WEBPACK_IMPORTED_MODULE_2__["default"])(arrays, true, true));\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/union.js?')},"./node_modules/underscore/modules/uniq.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ uniq)\n/* harmony export */ });\n/* harmony import */ var _isBoolean_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isBoolean.js */ "./node_modules/underscore/modules/isBoolean.js");\n/* harmony import */ var _cb_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_cb.js */ "./node_modules/underscore/modules/_cb.js");\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_getLength.js */ "./node_modules/underscore/modules/_getLength.js");\n/* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./contains.js */ "./node_modules/underscore/modules/contains.js");\n\n\n\n\n\n// Produce a duplicate-free version of the array. If the array has already\n// been sorted, you have the option of using a faster algorithm.\n// The faster algorithm will not work with an iteratee if the iteratee\n// is not a one-to-one function, so providing an iteratee will disable\n// the faster algorithm.\nfunction uniq(array, isSorted, iteratee, context) {\n if (!(0,_isBoolean_js__WEBPACK_IMPORTED_MODULE_0__["default"])(isSorted)) {\n context = iteratee;\n iteratee = isSorted;\n isSorted = false;\n }\n if (iteratee != null) iteratee = (0,_cb_js__WEBPACK_IMPORTED_MODULE_1__["default"])(iteratee, context);\n var result = [];\n var seen = [];\n for (var i = 0, length = (0,_getLength_js__WEBPACK_IMPORTED_MODULE_2__["default"])(array); i < length; i++) {\n var value = array[i],\n computed = iteratee ? iteratee(value, i, array) : value;\n if (isSorted && !iteratee) {\n if (!i || seen !== computed) result.push(value);\n seen = computed;\n } else if (iteratee) {\n if (!(0,_contains_js__WEBPACK_IMPORTED_MODULE_3__["default"])(seen, computed)) {\n seen.push(computed);\n result.push(value);\n }\n } else if (!(0,_contains_js__WEBPACK_IMPORTED_MODULE_3__["default"])(result, value)) {\n result.push(value);\n }\n }\n return result;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/uniq.js?')},"./node_modules/underscore/modules/uniqueId.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ uniqueId)\n/* harmony export */ });\n// Generate a unique integer id (unique within the entire client session).\n// Useful for temporary DOM ids.\nvar idCounter = 0;\nfunction uniqueId(prefix) {\n var id = ++idCounter + '';\n return prefix ? prefix + id : id;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/uniqueId.js?")},"./node_modules/underscore/modules/unzip.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ unzip)\n/* harmony export */ });\n/* harmony import */ var _max_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./max.js */ "./node_modules/underscore/modules/max.js");\n/* harmony import */ var _getLength_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_getLength.js */ "./node_modules/underscore/modules/_getLength.js");\n/* harmony import */ var _pluck_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pluck.js */ "./node_modules/underscore/modules/pluck.js");\n\n\n\n\n// Complement of zip. Unzip accepts an array of arrays and groups\n// each array\'s elements on shared indices.\nfunction unzip(array) {\n var length = (array && (0,_max_js__WEBPACK_IMPORTED_MODULE_0__["default"])(array, _getLength_js__WEBPACK_IMPORTED_MODULE_1__["default"]).length) || 0;\n var result = Array(length);\n\n for (var index = 0; index < length; index++) {\n result[index] = (0,_pluck_js__WEBPACK_IMPORTED_MODULE_2__["default"])(array, index);\n }\n return result;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/unzip.js?')},"./node_modules/underscore/modules/values.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ values)\n/* harmony export */ });\n/* harmony import */ var _keys_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./keys.js */ "./node_modules/underscore/modules/keys.js");\n\n\n// Retrieve the values of an object\'s properties.\nfunction values(obj) {\n var _keys = (0,_keys_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj);\n var length = _keys.length;\n var values = Array(length);\n for (var i = 0; i < length; i++) {\n values[i] = obj[_keys[i]];\n }\n return values;\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/values.js?')},"./node_modules/underscore/modules/where.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ where)\n/* harmony export */ });\n/* harmony import */ var _filter_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./filter.js */ "./node_modules/underscore/modules/filter.js");\n/* harmony import */ var _matcher_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./matcher.js */ "./node_modules/underscore/modules/matcher.js");\n\n\n\n// Convenience version of a common use case of `_.filter`: selecting only\n// objects containing specific `key:value` pairs.\nfunction where(obj, attrs) {\n return (0,_filter_js__WEBPACK_IMPORTED_MODULE_0__["default"])(obj, (0,_matcher_js__WEBPACK_IMPORTED_MODULE_1__["default"])(attrs));\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/where.js?')},"./node_modules/underscore/modules/without.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _difference_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./difference.js */ "./node_modules/underscore/modules/difference.js");\n\n\n\n// Return a version of the array that does not contain the specified value(s).\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(function(array, otherArrays) {\n return (0,_difference_js__WEBPACK_IMPORTED_MODULE_1__["default"])(array, otherArrays);\n}));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/without.js?')},"./node_modules/underscore/modules/wrap.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (/* binding */ wrap)\n/* harmony export */ });\n/* harmony import */ var _partial_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./partial.js */ "./node_modules/underscore/modules/partial.js");\n\n\n// Returns the first function passed as an argument to the second,\n// allowing you to adjust arguments, run code before and after, and\n// conditionally execute the original function.\nfunction wrap(func, wrapper) {\n return (0,_partial_js__WEBPACK_IMPORTED_MODULE_0__["default"])(wrapper, func);\n}\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/wrap.js?')},"./node_modules/underscore/modules/zip.js":(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _restArguments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./restArguments.js */ "./node_modules/underscore/modules/restArguments.js");\n/* harmony import */ var _unzip_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./unzip.js */ "./node_modules/underscore/modules/unzip.js");\n\n\n\n// Zip together multiple lists into a single array -- elements that share\n// an index go together.\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_restArguments_js__WEBPACK_IMPORTED_MODULE_0__["default"])(_unzip_js__WEBPACK_IMPORTED_MODULE_1__["default"]));\n\n\n//# sourceURL=webpack://web/./node_modules/underscore/modules/zip.js?')}},__webpack_module_cache__={};function __webpack_require__(e){var n=__webpack_module_cache__[e];if(void 0!==n)return n.exports;var t=__webpack_module_cache__[e]={id:e,loaded:!1,exports:{}};return __webpack_modules__[e].call(t.exports,t,t.exports,__webpack_require__),t.loaded=!0,t.exports}__webpack_require__.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(n,{a:n}),n},__webpack_require__.d=(e,n)=>{for(var t in n)__webpack_require__.o(n,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},__webpack_require__.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;__webpack_require__.g.importScripts&&(e=__webpack_require__.g.location+"");var n=__webpack_require__.g.document;if(!e&&n&&(n.currentScript&&(e=n.currentScript.src),!e)){var t=n.getElementsByTagName("script");if(t.length)for(var r=t.length-1;r>-1&&!e;)e=t[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),__webpack_require__.p=e})(),__webpack_require__("./src/js/index.js"),__webpack_require__("./src/css/main.scss"),__webpack_require__("./src/css/common.scss");var __webpack_exports__=__webpack_require__("./src/css/vendors.scss")})(); |