(window["webpackjsonp"] = window["webpackjsonp"] || []).push([[65],{ /***/ 1: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export countbits */ /* unused harmony export countbytes */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return padstart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isarraybufferview; }); /* unused harmony export istypedarray */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return touint8; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return tohexstring; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return tobinarystring; }); /* unused harmony export endianness */ /* unused harmony export is_big_endian */ /* unused harmony export is_little_endian */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return bytestonumber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return numbertobytes; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return bytestostring; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return stringtobytes; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return concattypedarrays; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return bytesmatch; }); /* unused harmony export slicebytes */ /* unused harmony export reversebytes */ /* harmony import */ var global_window__webpack_imported_module_0__ = __webpack_require__(0); /* harmony import */ var global_window__webpack_imported_module_0___default = /*#__pure__*/__webpack_require__.n(global_window__webpack_imported_module_0__); // const log2 = math.log2 ? math.log2 : (x) => (math.log(x) / math.log(2)); var repeat = function repeat(str, len) { var acc = ''; while (len--) { acc += str; } return acc; }; // count the number of bits it would take to represent a number // we used to do this with log2 but bigint does not support builtin math // math.ceil(log2(x)); var countbits = function countbits(x) { return x.tostring(2).length; }; // count the number of whole bytes it would take to represent a number var countbytes = function countbytes(x) { return math.ceil(countbits(x) / 8); }; var padstart = function padstart(b, len, str) { if (str === void 0) { str = ' '; } return (repeat(str, len) + b.tostring()).slice(-len); }; var isarraybufferview = function isarraybufferview(obj) { if (arraybuffer.isview === 'function') { return arraybuffer.isview(obj); } return obj && obj.buffer instanceof arraybuffer; }; var istypedarray = function istypedarray(obj) { return isarraybufferview(obj); }; var touint8 = function touint8(bytes) { if (bytes instanceof uint8array) { return bytes; } if (!array.isarray(bytes) && !istypedarray(bytes) && !(bytes instanceof arraybuffer)) { // any non-number or nan leads to empty uint8array // eslint-disable-next-line if (typeof bytes !== 'number' || typeof bytes === 'number' && bytes !== bytes) { bytes = 0; } else { bytes = [bytes]; } } return new uint8array(bytes && bytes.buffer || bytes, bytes && bytes.byteoffset || 0, bytes && bytes.bytelength || 0); }; var tohexstring = function tohexstring(bytes) { bytes = touint8(bytes); var str = ''; for (var i = 0; i < bytes.length; i++) { str += padstart(bytes[i].tostring(16), 2, '0'); } return str; }; var tobinarystring = function tobinarystring(bytes) { bytes = touint8(bytes); var str = ''; for (var i = 0; i < bytes.length; i++) { str += padstart(bytes[i].tostring(2), 8, '0'); } return str; }; var bigint = global_window__webpack_imported_module_0___default.a.bigint || number; var byte_table = [bigint('0x1'), bigint('0x100'), bigint('0x10000'), bigint('0x1000000'), bigint('0x100000000'), bigint('0x10000000000'), bigint('0x1000000000000'), bigint('0x100000000000000'), bigint('0x10000000000000000')]; var endianness = function () { var a = new uint16array([0xffcc]); var b = new uint8array(a.buffer, a.byteoffset, a.bytelength); if (b[0] === 0xff) { return 'big'; } if (b[0] === 0xcc) { return 'little'; } return 'unknown'; }(); var is_big_endian = endianness === 'big'; var is_little_endian = endianness === 'little'; var bytestonumber = function bytestonumber(bytes, _temp) { var _ref = _temp === void 0 ? {} : _temp, _ref$signed = _ref.signed, signed = _ref$signed === void 0 ? false : _ref$signed, _ref$le = _ref.le, le = _ref$le === void 0 ? false : _ref$le; bytes = touint8(bytes); var fn = le ? 'reduce' : 'reduceright'; var obj = bytes[fn] ? bytes[fn] : array.prototype[fn]; var number = obj.call(bytes, function (total, byte, i) { var exponent = le ? i : math.abs(i + 1 - bytes.length); return total + bigint(byte) * byte_table[exponent]; }, bigint(0)); if (signed) { var max = byte_table[bytes.length] / bigint(2) - bigint(1); number = bigint(number); if (number > max) { number -= max; number -= max; number -= bigint(2); } } return number(number); }; var numbertobytes = function numbertobytes(number, _temp2) { var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$le = _ref2.le, le = _ref2$le === void 0 ? false : _ref2$le; // eslint-disable-next-line if (typeof number !== 'bigint' && typeof number !== 'number' || typeof number === 'number' && number !== number) { number = 0; } number = bigint(number); var bytecount = countbytes(number); var bytes = new uint8array(new arraybuffer(bytecount)); for (var i = 0; i < bytecount; i++) { var byteindex = le ? i : math.abs(i + 1 - bytes.length); bytes[byteindex] = number(number / byte_table[i] & bigint(0xff)); if (number < 0) { bytes[byteindex] = math.abs(~bytes[byteindex]); bytes[byteindex] -= i === 0 ? 1 : 2; } } return bytes; }; var bytestostring = function bytestostring(bytes) { if (!bytes) { return ''; } // todo: should touint8 handle cases where we only have 8 bytes // but report more since this is a uint16+ array? bytes = array.prototype.slice.call(bytes); var string = string.fromcharcode.apply(null, touint8(bytes)); try { return decodeuricomponent(escape(string)); } catch (e) {// if decodeuricomponent/escape fails, we are dealing with partial // or full non string data. just return the potentially garbled string. } return string; }; var stringtobytes = function stringtobytes(string, stringisbytes) { if (typeof string !== 'string' && string && typeof string.tostring === 'function') { string = string.tostring(); } if (typeof string !== 'string') { return new uint8array(); } // if the string already is bytes, we don't have to do this // otherwise we do this so that we split multi length characters // into individual bytes if (!stringisbytes) { string = unescape(encodeuricomponent(string)); } var view = new uint8array(string.length); for (var i = 0; i < string.length; i++) { view[i] = string.charcodeat(i); } return view; }; var concattypedarrays = function concattypedarrays() { for (var _len = arguments.length, buffers = new array(_len), _key = 0; _key < _len; _key++) { buffers[_key] = arguments[_key]; } buffers = buffers.filter(function (b) { return b && (b.bytelength || b.length) && typeof b !== 'string'; }); if (buffers.length <= 1) { // for 0 length we will return empty uint8 // for 1 length we return the first uint8 return touint8(buffers[0]); } var totallen = buffers.reduce(function (total, buf, i) { return total + (buf.bytelength || buf.length); }, 0); var tempbuffer = new uint8array(totallen); var offset = 0; buffers.foreach(function (buf) { buf = touint8(buf); tempbuffer.set(buf, offset); offset += buf.bytelength; }); return tempbuffer; }; /** * check if the bytes "b" are contained within bytes "a". * * @param {uint8array|array} a * bytes to check in * * @param {uint8array|array} b * bytes to check for * * @param {object} options * options * * @param {array|uint8array} [offset=0] * offset to use when looking at bytes in a * * @param {array|uint8array} [mask=[]] * mask to use on bytes before comparison. * * @return {boolean} * if all bytes in b are inside of a, taking into account * bit masks. */ var bytesmatch = function bytesmatch(a, b, _temp3) { var _ref3 = _temp3 === void 0 ? {} : _temp3, _ref3$offset = _ref3.offset, offset = _ref3$offset === void 0 ? 0 : _ref3$offset, _ref3$mask = _ref3.mask, mask = _ref3$mask === void 0 ? [] : _ref3$mask; a = touint8(a); b = touint8(b); // ie 11 does not support uint8 every var fn = b.every ? b.every : array.prototype.every; return b.length && a.length - offset >= b.length && // ie 11 doesn't support every on uin8 fn.call(b, function (bbyte, i) { var abyte = mask[i] ? mask[i] & a[offset + i] : a[offset + i]; return bbyte === abyte; }); }; var slicebytes = function slicebytes(src, start, end) { if (uint8array.prototype.slice) { return uint8array.prototype.slice.call(src, start, end); } return new uint8array(array.prototype.slice.call(src, start, end)); }; var reversebytes = function reversebytes(src) { if (src.reverse) { return src.reverse(); } return array.prototype.reverse.call(src); }; /***/ }), /***/ 101: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // exports __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ containers_detectcontainerforbytes; }); __webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ containers_islikelyfmp4mediasegment; }); // unused exports: islikely // external module: ./node_modules/@videojs/vhs-utils/es/byte-helpers.js var byte_helpers = __webpack_require__(1); // concatenated module: ./node_modules/@videojs/vhs-utils/es/codec-helpers.js // https://aomediacodec.github.io/av1-isobmff/#av1codecconfigurationbox-syntax // https://developer.mozilla.org/en-us/docs/web/media/formats/codecs_parameter#av1 var codec_helpers_getav1codec = function getav1codec(bytes) { var codec = ''; var profile = bytes[1] >>> 3; var level = bytes[1] & 0x1f; var tier = bytes[2] >>> 7; var highbitdepth = (bytes[2] & 0x40) >> 6; var twelvebit = (bytes[2] & 0x20) >> 5; var monochrome = (bytes[2] & 0x10) >> 4; var chromasubsamplingx = (bytes[2] & 0x08) >> 3; var chromasubsamplingy = (bytes[2] & 0x04) >> 2; var chromasampleposition = bytes[2] & 0x03; codec += profile + "." + object(byte_helpers["g" /* padstart */])(level, 2, '0'); if (tier === 0) { codec += 'm'; } else if (tier === 1) { codec += 'h'; } var bitdepth; if (profile === 2 && highbitdepth) { bitdepth = twelvebit ? 12 : 10; } else { bitdepth = highbitdepth ? 10 : 8; } codec += "." + object(byte_helpers["g" /* padstart */])(bitdepth, 2, '0'); // todo: can we parse color range?? codec += "." + monochrome; codec += "." + chromasubsamplingx + chromasubsamplingy + chromasampleposition; return codec; }; var codec_helpers_getavccodec = function getavccodec(bytes) { var profileid = object(byte_helpers["j" /* tohexstring */])(bytes[1]); var constraintflags = object(byte_helpers["j" /* tohexstring */])(bytes[2] & 0xfc); var levelid = object(byte_helpers["j" /* tohexstring */])(bytes[3]); return "" + profileid + constraintflags + levelid; }; var codec_helpers_gethvccodec = function gethvccodec(bytes) { var codec = ''; var profilespace = bytes[1] >> 6; var profileid = bytes[1] & 0x1f; var tierflag = (bytes[1] & 0x20) >> 5; var profilecompat = bytes.subarray(2, 6); var constraintids = bytes.subarray(6, 12); var levelid = bytes[12]; if (profilespace === 1) { codec += 'a'; } else if (profilespace === 2) { codec += 'b'; } else if (profilespace === 3) { codec += 'c'; } codec += profileid + "."; // ffmpeg does this in big endian var profilecompatval = parseint(object(byte_helpers["i" /* tobinarystring */])(profilecompat).split('').reverse().join(''), 2); // apple does this in little endian... if (profilecompatval > 255) { profilecompatval = parseint(object(byte_helpers["i" /* tobinarystring */])(profilecompat), 2); } codec += profilecompatval.tostring(16) + "."; if (tierflag === 0) { codec += 'l'; } else { codec += 'h'; } codec += levelid; var constraints = ''; for (var i = 0; i < constraintids.length; i++) { var v = constraintids[i]; if (v) { if (constraints) { constraints += '.'; } constraints += v.tostring(16); } } if (constraints) { codec += "." + constraints; } return codec; }; // concatenated module: ./node_modules/@videojs/vhs-utils/es/opus-helpers.js var opus_head = new uint8array([// o, p, u, s 0x4f, 0x70, 0x75, 0x73, // h, e, a, d 0x48, 0x65, 0x61, 0x64]); // https://wiki.xiph.org/oggopus // https://vfrmaniac.fushizen.eu/contents/opus_in_isobmff.html // https://opus-codec.org/docs/opusfile_api-0.7/structopushead.html var parseopushead = function parseopushead(bytes) { var view = new dataview(bytes.buffer, bytes.byteoffset, bytes.bytelength); var version = view.getuint8(0); // version 0, from mp4, does not use littleendian. var littleendian = version !== 0; var config = { version: version, channels: view.getuint8(1), preskip: view.getuint16(2, littleendian), samplerate: view.getuint32(4, littleendian), outputgain: view.getuint16(8, littleendian), channelmappingfamily: view.getuint8(10) }; if (config.channelmappingfamily > 0 && bytes.length > 10) { config.streamcount = view.getuint8(11); config.twochannelstreamcount = view.getuint8(12); config.channelmapping = []; for (var c = 0; c < config.channels; c++) { config.channelmapping.push(view.getuint8(13 + c)); } } return config; }; var setopushead = function setopushead(config) { var size = config.channelmappingfamily <= 0 ? 11 : 12 + config.channels; var view = new dataview(new arraybuffer(size)); var littleendian = config.version !== 0; view.setuint8(0, config.version); view.setuint8(1, config.channels); view.setuint16(2, config.preskip, littleendian); view.setuint32(4, config.samplerate, littleendian); view.setuint16(8, config.outputgain, littleendian); view.setuint8(10, config.channelmappingfamily); if (config.channelmappingfamily > 0) { view.setuint8(11, config.streamcount); config.channelmapping.foreach(function (cm, i) { view.setuint8(12 + i, cm); }); } return new uint8array(view.buffer); }; // concatenated module: ./node_modules/@videojs/vhs-utils/es/mp4-helpers.js var mp4_helpers_normalizepath = function normalizepath(path) { if (typeof path === 'string') { return object(byte_helpers["h" /* stringtobytes */])(path); } if (typeof path === 'number') { return path; } return path; }; var normalizepaths = function normalizepaths(paths) { if (!array.isarray(paths)) { return [mp4_helpers_normalizepath(paths)]; } return paths.map(function (p) { return mp4_helpers_normalizepath(p); }); }; var descriptors; var mp4_helpers_parsedescriptors = function parsedescriptors(bytes) { bytes = object(byte_helpers["k" /* touint8 */])(bytes); var results = []; var i = 0; while (bytes.length > i) { var tag = bytes[i]; var size = 0; var headersize = 0; // tag headersize++; var byte = bytes[headersize]; // first byte headersize++; while (byte & 0x80) { size = (byte & 0x7f) << 7; byte = bytes[headersize]; headersize++; } size += byte & 0x7f; for (var z = 0; z < descriptors.length; z++) { var _descriptors$z = descriptors[z], id = _descriptors$z.id, parser = _descriptors$z.parser; if (tag === id) { results.push(parser(bytes.subarray(headersize, headersize + size))); break; } } i += size + headersize; } return results; }; descriptors = [{ id: 0x03, parser: function parser(bytes) { var desc = { tag: 0x03, id: bytes[0] << 8 | bytes[1], flags: bytes[2], size: 3, dependsonesid: 0, ocresid: 0, descriptors: [], url: '' }; // depends on es id if (desc.flags & 0x80) { desc.dependsonesid = bytes[desc.size] << 8 | bytes[desc.size + 1]; desc.size += 2; } // url if (desc.flags & 0x40) { var len = bytes[desc.size]; desc.url = object(byte_helpers["c" /* bytestostring */])(bytes.subarray(desc.size + 1, desc.size + 1 + len)); desc.size += len; } // ocr es id if (desc.flags & 0x20) { desc.ocresid = bytes[desc.size] << 8 | bytes[desc.size + 1]; desc.size += 2; } desc.descriptors = mp4_helpers_parsedescriptors(bytes.subarray(desc.size)) || []; return desc; } }, { id: 0x04, parser: function parser(bytes) { // decoderconfigdescriptor var desc = { tag: 0x04, oti: bytes[0], streamtype: bytes[1], buffersize: bytes[2] << 16 | bytes[3] << 8 | bytes[4], maxbitrate: bytes[5] << 24 | bytes[6] << 16 | bytes[7] << 8 | bytes[8], avgbitrate: bytes[9] << 24 | bytes[10] << 16 | bytes[11] << 8 | bytes[12], descriptors: mp4_helpers_parsedescriptors(bytes.subarray(13)) }; return desc; } }, { id: 0x05, parser: function parser(bytes) { // decoderspecificinfo return { tag: 0x05, bytes: bytes }; } }, { id: 0x06, parser: function parser(bytes) { // slconfigdescriptor return { tag: 0x06, bytes: bytes }; } }]; /** * find any number of boxes by name given a path to it in an iso bmff * such as mp4. * * @param {typedarray} bytes * bytes for the iso bmff to search for boxes in * * @param {uint8array[]|string[]|string|uint8array} name * an array of paths or a single path representing the name * of boxes to search through in bytes. paths may be * uint8 (character codes) or strings. * * @param {boolean} [complete=false] * should we search only for complete boxes on the final path. * this is very useful when you do not want to get back partial boxes * in the case of streaming files. * * @return {uint8array[]} * an array of the end paths that we found. */ var mp4_helpers_findbox = function findbox(bytes, paths, complete) { if (complete === void 0) { complete = false; } paths = normalizepaths(paths); bytes = object(byte_helpers["k" /* touint8 */])(bytes); var results = []; if (!paths.length) { // short-circuit the search for empty paths return results; } var i = 0; while (i < bytes.length) { var size = (bytes[i] << 24 | bytes[i + 1] << 16 | bytes[i + 2] << 8 | bytes[i + 3]) >>> 0; var type = bytes.subarray(i + 4, i + 8); // invalid box format. if (size === 0) { break; } var end = i + size; if (end > bytes.length) { // this box is bigger than the number of bytes we have // and complete is set, we cannot find any more boxes. if (complete) { break; } end = bytes.length; } var data = bytes.subarray(i + 8, end); if (object(byte_helpers["a" /* bytesmatch */])(type, paths[0])) { if (paths.length === 1) { // this is the end of the path and we've found the box we were // looking for results.push(data); } else { // recursively search for the next box along the path results.push.apply(results, findbox(data, paths.slice(1), complete)); } } i = end; } // we've finished searching all of bytes return results; }; /** * search for a single matching box by name in an iso bmff format like * mp4. this function is useful for finding codec boxes which * can be placed arbitrarily in sample descriptions depending * on the version of the file or file type. * * @param {typedarray} bytes * bytes for the iso bmff to search for boxes in * * @param {string|uint8array} name * the name of the box to find. * * @return {uint8array[]} * a subarray of bytes representing the name boxed we found. */ var mp4_helpers_findnamedbox = function findnamedbox(bytes, name) { name = mp4_helpers_normalizepath(name); if (!name.length) { // short-circuit the search for empty paths return bytes.subarray(bytes.length); } var i = 0; while (i < bytes.length) { if (object(byte_helpers["a" /* bytesmatch */])(bytes.subarray(i, i + name.length), name)) { var size = (bytes[i - 4] << 24 | bytes[i - 3] << 16 | bytes[i - 2] << 8 | bytes[i - 1]) >>> 0; var end = size > 1 ? i + size : bytes.bytelength; return bytes.subarray(i + 4, end); } i++; } // we've finished searching all of bytes return bytes.subarray(bytes.length); }; var mp4_helpers_parsesamples = function parsesamples(data, entrysize, parseentry) { if (entrysize === void 0) { entrysize = 4; } if (parseentry === void 0) { parseentry = function parseentry(d) { return object(byte_helpers["b" /* bytestonumber */])(d); }; } var entries = []; if (!data || !data.length) { return entries; } var entrycount = object(byte_helpers["b" /* bytestonumber */])(data.subarray(4, 8)); for (var i = 8; entrycount; i += entrysize, entrycount--) { entries.push(parseentry(data.subarray(i, i + entrysize))); } return entries; }; var mp4_helpers_buildframetable = function buildframetable(stbl, timescale) { var keysamples = mp4_helpers_parsesamples(mp4_helpers_findbox(stbl, ['stss'])[0]); var chunkoffsets = mp4_helpers_parsesamples(mp4_helpers_findbox(stbl, ['stco'])[0]); var timetosamples = mp4_helpers_parsesamples(mp4_helpers_findbox(stbl, ['stts'])[0], 8, function (entry) { return { samplecount: object(byte_helpers["b" /* bytestonumber */])(entry.subarray(0, 4)), sampledelta: object(byte_helpers["b" /* bytestonumber */])(entry.subarray(4, 8)) }; }); var samplestochunks = mp4_helpers_parsesamples(mp4_helpers_findbox(stbl, ['stsc'])[0], 12, function (entry) { return { firstchunk: object(byte_helpers["b" /* bytestonumber */])(entry.subarray(0, 4)), samplesperchunk: object(byte_helpers["b" /* bytestonumber */])(entry.subarray(4, 8)), sampledescriptionindex: object(byte_helpers["b" /* bytestonumber */])(entry.subarray(8, 12)) }; }); var stsz = mp4_helpers_findbox(stbl, ['stsz'])[0]; // stsz starts with a 4 byte samplesize which we don't need var samplesizes = mp4_helpers_parsesamples(stsz && stsz.length && stsz.subarray(4) || null); var frames = []; for (var chunkindex = 0; chunkindex < chunkoffsets.length; chunkindex++) { var samplesinchunk = void 0; for (var i = 0; i < samplestochunks.length; i++) { var sampletochunk = samplestochunks[i]; var isthisone = chunkindex + 1 >= sampletochunk.firstchunk && (i + 1 >= samplestochunks.length || chunkindex + 1 < samplestochunks[i + 1].firstchunk); if (isthisone) { samplesinchunk = sampletochunk.samplesperchunk; break; } } var chunkoffset = chunkoffsets[chunkindex]; for (var _i = 0; _i < samplesinchunk; _i++) { var frameend = samplesizes[frames.length]; // if we don't have key samples every frame is a keyframe var keyframe = !keysamples.length; if (keysamples.length && keysamples.indexof(frames.length + 1) !== -1) { keyframe = true; } var frame = { keyframe: keyframe, start: chunkoffset, end: chunkoffset + frameend }; for (var k = 0; k < timetosamples.length; k++) { var _timetosamples$k = timetosamples[k], samplecount = _timetosamples$k.samplecount, sampledelta = _timetosamples$k.sampledelta; if (frames.length <= samplecount) { // ms to ns var lasttimestamp = frames.length ? frames[frames.length - 1].timestamp : 0; frame.timestamp = lasttimestamp + sampledelta / timescale * 1000; frame.duration = sampledelta; break; } } frames.push(frame); chunkoffset += frameend; } } return frames; }; var mp4_helpers_addsampledescription = function addsampledescription(track, bytes) { var codec = object(byte_helpers["c" /* bytestostring */])(bytes.subarray(0, 4)); if (track.type === 'video') { track.info = track.info || {}; track.info.width = bytes[28] << 8 | bytes[29]; track.info.height = bytes[30] << 8 | bytes[31]; } else if (track.type === 'audio') { track.info = track.info || {}; track.info.channels = bytes[20] << 8 | bytes[21]; track.info.bitdepth = bytes[22] << 8 | bytes[23]; track.info.samplerate = bytes[28] << 8 | bytes[29]; } if (codec === 'avc1') { var avcc = mp4_helpers_findnamedbox(bytes, 'avcc'); // avcdecoderconfigurationrecord codec += "." + codec_helpers_getavccodec(avcc); track.info.avcc = avcc; // todo: do we need to parse all this? /* { configurationversion: avcc[0], profile: avcc[1], profilecompatibility: avcc[2], level: avcc[3], lengthsizeminusone: avcc[4] & 0x3 }; let spsnalunitcount = avcc[5] & 0x1f; const spsnalunits = track.info.avc.spsnalunits = []; // past spsnalunitcount let offset = 6; while (spsnalunitcount--) { const nallen = avcc[offset] << 8 | avcc[offset + 1]; spsnalunits.push(avcc.subarray(offset + 2, offset + 2 + nallen)); offset += nallen + 2; } let ppsnalunitcount = avcc[offset]; const ppsnalunits = track.info.avc.ppsnalunits = []; // past ppsnalunitcount offset += 1; while (ppsnalunitcount--) { const nallen = avcc[offset] << 8 | avcc[offset + 1]; ppsnalunits.push(avcc.subarray(offset + 2, offset + 2 + nallen)); offset += nallen + 2; }*/ // hevcdecoderconfigurationrecord } else if (codec === 'hvc1' || codec === 'hev1') { codec += "." + codec_helpers_gethvccodec(mp4_helpers_findnamedbox(bytes, 'hvcc')); } else if (codec === 'mp4a' || codec === 'mp4v') { var esds = mp4_helpers_findnamedbox(bytes, 'esds'); var esdescriptor = mp4_helpers_parsedescriptors(esds.subarray(4))[0]; var decoderconfig = esdescriptor && esdescriptor.descriptors.filter(function (_ref) { var tag = _ref.tag; return tag === 0x04; })[0]; if (decoderconfig) { // most codecs do not have a further '.' // such as 0xa5 for ac-3 and 0xa6 for e-ac-3 codec += '.' + object(byte_helpers["j" /* tohexstring */])(decoderconfig.oti); if (decoderconfig.oti === 0x40) { codec += '.' + (decoderconfig.descriptors[0].bytes[0] >> 3).tostring(); } else if (decoderconfig.oti === 0x20) { codec += '.' + decoderconfig.descriptors[0].bytes[4].tostring(); } else if (decoderconfig.oti === 0xdd) { codec = 'vorbis'; } } else if (track.type === 'audio') { codec += '.40.2'; } else { codec += '.20.9'; } } else if (codec === 'av01') { // av1decoderconfigurationrecord codec += "." + codec_helpers_getav1codec(mp4_helpers_findnamedbox(bytes, 'av1c')); } else if (codec === 'vp09') { // vpcodecconfigurationrecord var vpcc = mp4_helpers_findnamedbox(bytes, 'vpcc'); // https://www.webmproject.org/vp9/mp4/ var profile = vpcc[0]; var level = vpcc[1]; var bitdepth = vpcc[2] >> 4; var chromasubsampling = (vpcc[2] & 0x0f) >> 1; var videofullrangeflag = (vpcc[2] & 0x0f) >> 3; var colourprimaries = vpcc[3]; var transfercharacteristics = vpcc[4]; var matrixcoefficients = vpcc[5]; codec += "." + object(byte_helpers["g" /* padstart */])(profile, 2, '0'); codec += "." + object(byte_helpers["g" /* padstart */])(level, 2, '0'); codec += "." + object(byte_helpers["g" /* padstart */])(bitdepth, 2, '0'); codec += "." + object(byte_helpers["g" /* padstart */])(chromasubsampling, 2, '0'); codec += "." + object(byte_helpers["g" /* padstart */])(colourprimaries, 2, '0'); codec += "." + object(byte_helpers["g" /* padstart */])(transfercharacteristics, 2, '0'); codec += "." + object(byte_helpers["g" /* padstart */])(matrixcoefficients, 2, '0'); codec += "." + object(byte_helpers["g" /* padstart */])(videofullrangeflag, 2, '0'); } else if (codec === 'theo') { codec = 'theora'; } else if (codec === 'spex') { codec = 'speex'; } else if (codec === '.mp3') { codec = 'mp4a.40.34'; } else if (codec === 'msvo') { codec = 'vorbis'; } else if (codec === 'opus') { codec = 'opus'; var dops = mp4_helpers_findnamedbox(bytes, 'dops'); track.info.opus = parseopushead(dops); // todo: should this go into the webm code?? // firefox requires a codecdelay for opus playback // see https://bugzilla.mozilla.org/show_bug.cgi?id=1276238 track.info.codecdelay = 6500000; } else { codec = codec.tolowercase(); } /* eslint-enable */ // flac, ac-3, ec-3, opus track.codec = codec; }; var mp4_helpers_parsetracks = function parsetracks(bytes, frametable) { if (frametable === void 0) { frametable = true; } bytes = object(byte_helpers["k" /* touint8 */])(bytes); var traks = mp4_helpers_findbox(bytes, ['moov', 'trak'], true); var tracks = []; traks.foreach(function (trak) { var track = { bytes: trak }; var mdia = mp4_helpers_findbox(trak, ['mdia'])[0]; var hdlr = mp4_helpers_findbox(mdia, ['hdlr'])[0]; var traktype = object(byte_helpers["c" /* bytestostring */])(hdlr.subarray(8, 12)); if (traktype === 'soun') { track.type = 'audio'; } else if (traktype === 'vide') { track.type = 'video'; } else { track.type = traktype; } var tkhd = mp4_helpers_findbox(trak, ['tkhd'])[0]; if (tkhd) { var view = new dataview(tkhd.buffer, tkhd.byteoffset, tkhd.bytelength); var tkhdversion = view.getuint8(0); track.number = tkhdversion === 0 ? view.getuint32(12) : view.getuint32(20); } var mdhd = mp4_helpers_findbox(mdia, ['mdhd'])[0]; if (mdhd) { // mdhd is a fullbox, meaning it will have its own version as the first byte var version = mdhd[0]; var index = version === 0 ? 12 : 20; track.timescale = (mdhd[index] << 24 | mdhd[index + 1] << 16 | mdhd[index + 2] << 8 | mdhd[index + 3]) >>> 0; } var stbl = mp4_helpers_findbox(mdia, ['minf', 'stbl'])[0]; var stsd = mp4_helpers_findbox(stbl, ['stsd'])[0]; var descriptioncount = object(byte_helpers["b" /* bytestonumber */])(stsd.subarray(4, 8)); var offset = 8; // add codec and codec info while (descriptioncount--) { var len = object(byte_helpers["b" /* bytestonumber */])(stsd.subarray(offset, offset + 4)); var sampledescriptor = stsd.subarray(offset + 4, offset + 4 + len); mp4_helpers_addsampledescription(track, sampledescriptor); offset += 4 + len; } if (frametable) { track.frametable = mp4_helpers_buildframetable(stbl, track.timescale); } // codec has no sub parameters tracks.push(track); }); return tracks; }; var mp4_helpers_parsemediainfo = function parsemediainfo(bytes) { var mvhd = mp4_helpers_findbox(bytes, ['moov', 'mvhd'], true)[0]; if (!mvhd || !mvhd.length) { return; } var info = {}; // ms to ns // mvhd v1 has 8 byte duration and other fields too if (mvhd[0] === 1) { info.timestampscale = object(byte_helpers["b" /* bytestonumber */])(mvhd.subarray(20, 24)); info.duration = object(byte_helpers["b" /* bytestonumber */])(mvhd.subarray(24, 32)); } else { info.timestampscale = object(byte_helpers["b" /* bytestonumber */])(mvhd.subarray(12, 16)); info.duration = object(byte_helpers["b" /* bytestonumber */])(mvhd.subarray(16, 20)); } info.bytes = mvhd; return info; }; // concatenated module: ./node_modules/@videojs/vhs-utils/es/ebml-helpers.js // relevant specs for this parser: // https://matroska-org.github.io/libebml/specs.html // https://www.matroska.org/technical/elements.html // https://www.webmproject.org/docs/container/ var ebml_tags = { ebml: object(byte_helpers["k" /* touint8 */])([0x1a, 0x45, 0xdf, 0xa3]), doctype: object(byte_helpers["k" /* touint8 */])([0x42, 0x82]), segment: object(byte_helpers["k" /* touint8 */])([0x18, 0x53, 0x80, 0x67]), segmentinfo: object(byte_helpers["k" /* touint8 */])([0x15, 0x49, 0xa9, 0x66]), tracks: object(byte_helpers["k" /* touint8 */])([0x16, 0x54, 0xae, 0x6b]), track: object(byte_helpers["k" /* touint8 */])([0xae]), tracknumber: object(byte_helpers["k" /* touint8 */])([0xd7]), defaultduration: object(byte_helpers["k" /* touint8 */])([0x23, 0xe3, 0x83]), trackentry: object(byte_helpers["k" /* touint8 */])([0xae]), tracktype: object(byte_helpers["k" /* touint8 */])([0x83]), flagdefault: object(byte_helpers["k" /* touint8 */])([0x88]), codecid: object(byte_helpers["k" /* touint8 */])([0x86]), codecprivate: object(byte_helpers["k" /* touint8 */])([0x63, 0xa2]), videotrack: object(byte_helpers["k" /* touint8 */])([0xe0]), audiotrack: object(byte_helpers["k" /* touint8 */])([0xe1]), // not used yet, but will be used for live webm/mkv // see https://www.matroska.org/technical/basics.html#block-structure // see https://www.matroska.org/technical/basics.html#simpleblock-structure cluster: object(byte_helpers["k" /* touint8 */])([0x1f, 0x43, 0xb6, 0x75]), timestamp: object(byte_helpers["k" /* touint8 */])([0xe7]), timestampscale: object(byte_helpers["k" /* touint8 */])([0x2a, 0xd7, 0xb1]), blockgroup: object(byte_helpers["k" /* touint8 */])([0xa0]), blockduration: object(byte_helpers["k" /* touint8 */])([0x9b]), block: object(byte_helpers["k" /* touint8 */])([0xa1]), simpleblock: object(byte_helpers["k" /* touint8 */])([0xa3]) }; /** * this is a simple table to determine the length * of things in ebml. the length is one based (starts at 1, * rather than zero) and for every zero bit before a one bit * we add one to length. we also need this table because in some * case we have to xor all the length bits from another value. */ var length_table = [128, 64, 32, 16, 8, 4, 2, 1]; var getlength = function getlength(byte) { var len = 1; for (var i = 0; i < length_table.length; i++) { if (byte & length_table[i]) { break; } len++; } return len; }; // length in ebml is stored in the first 4 to 8 bits // of the first byte. 4 for the id length and 8 for the // data size length. length is measured by converting the number to binary // then 1 + the number of zeros before a 1 is encountered starting // from the left. var ebml_helpers_getvint = function getvint(bytes, offset, removelength, signed) { if (removelength === void 0) { removelength = true; } if (signed === void 0) { signed = false; } var length = getlength(bytes[offset]); var valuebytes = bytes.subarray(offset, offset + length); // note that we do **not** subarray here because we need to copy these bytes // as they will be modified below to remove the datasizelen bits and we do not // want to modify the original data. normally we could just call slice on // uint8array but ie 11 does not support that... if (removelength) { valuebytes = array.prototype.slice.call(bytes, offset, offset + length); valuebytes[0] ^= length_table[length - 1]; } return { length: length, value: object(byte_helpers["b" /* bytestonumber */])(valuebytes, { signed: signed }), bytes: valuebytes }; }; var ebml_helpers_normalizepath = function normalizepath(path) { if (typeof path === 'string') { return path.match(/.{1,2}/g).map(function (p) { return normalizepath(p); }); } if (typeof path === 'number') { return object(byte_helpers["f" /* numbertobytes */])(path); } return path; }; var ebml_helpers_normalizepaths = function normalizepaths(paths) { if (!array.isarray(paths)) { return [ebml_helpers_normalizepath(paths)]; } return paths.map(function (p) { return ebml_helpers_normalizepath(p); }); }; var ebml_helpers_getinfinitydatasize = function getinfinitydatasize(id, bytes, offset) { if (offset >= bytes.length) { return bytes.length; } var innerid = ebml_helpers_getvint(bytes, offset, false); if (object(byte_helpers["a" /* bytesmatch */])(id.bytes, innerid.bytes)) { return offset; } var dataheader = ebml_helpers_getvint(bytes, offset + innerid.length); return getinfinitydatasize(id, bytes, offset + dataheader.length + dataheader.value + innerid.length); }; /** * notes on the eblm format. * * eblm uses "vints" tags. every vint tag contains * two parts * * 1. the length from the first byte. you get this by * converting the byte to binary and counting the zeros * before a 1. then you add 1 to that. examples * 00011111 = length 4 because there are 3 zeros before a 1. * 00100000 = length 3 because there are 2 zeros before a 1. * 00000011 = length 7 because there are 6 zeros before a 1. * * 2. the bits used for length are removed from the first byte * then all the bytes are merged into a value. note: this * is not the case for id ebml tags as there id includes * length bits. * */ var ebml_helpers_findebml = function findebml(bytes, paths) { paths = ebml_helpers_normalizepaths(paths); bytes = object(byte_helpers["k" /* touint8 */])(bytes); var results = []; if (!paths.length) { return results; } var i = 0; while (i < bytes.length) { var id = ebml_helpers_getvint(bytes, i, false); var dataheader = ebml_helpers_getvint(bytes, i + id.length); var datastart = i + id.length + dataheader.length; // datasize is unknown or this is a live stream if (dataheader.value === 0x7f) { dataheader.value = ebml_helpers_getinfinitydatasize(id, bytes, datastart); if (dataheader.value !== bytes.length) { dataheader.value -= datastart; } } var dataend = datastart + dataheader.value > bytes.length ? bytes.length : datastart + dataheader.value; var data = bytes.subarray(datastart, dataend); if (object(byte_helpers["a" /* bytesmatch */])(paths[0], id.bytes)) { if (paths.length === 1) { // this is the end of the paths and we've found the tag we were // looking for results.push(data); } else { // recursively search for the next tag inside of the data // of this one results = results.concat(findebml(data, paths.slice(1))); } } var totallength = id.length + dataheader.length + data.length; // move past this tag entirely, we are not looking for it i += totallength; } return results; }; // see https://www.matroska.org/technical/basics.html#block-structure var ebml_helpers_decodeblock = function decodeblock(block, type, timestampscale, clustertimestamp) { var duration; if (type === 'group') { duration = ebml_helpers_findebml(block, [ebml_tags.blockduration])[0]; if (duration) { duration = object(byte_helpers["b" /* bytestonumber */])(duration); duration = 1 / timestampscale * duration * timestampscale / 1000; } block = ebml_helpers_findebml(block, [ebml_tags.block])[0]; type = 'block'; // treat data as a block after this point } var dv = new dataview(block.buffer, block.byteoffset, block.bytelength); var tracknumber = ebml_helpers_getvint(block, 0); var timestamp = dv.getint16(tracknumber.length, false); var flags = block[tracknumber.length + 2]; var data = block.subarray(tracknumber.length + 3); // pts/dts in seconds var ptsdts = 1 / timestampscale * (clustertimestamp + timestamp) * timestampscale / 1000; // return the frame var parsed = { duration: duration, tracknumber: tracknumber.value, keyframe: type === 'simple' && flags >> 7 === 1, invisible: (flags & 0x08) >> 3 === 1, lacing: (flags & 0x06) >> 1, discardable: type === 'simple' && (flags & 0x01) === 1, frames: [], pts: ptsdts, dts: ptsdts, timestamp: timestamp }; if (!parsed.lacing) { parsed.frames.push(data); return parsed; } var numberofframes = data[0] + 1; var framesizes = []; var offset = 1; // fixed if (parsed.lacing === 2) { var sizeofframe = (data.length - offset) / numberofframes; for (var i = 0; i < numberofframes; i++) { framesizes.push(sizeofframe); } } // xiph if (parsed.lacing === 1) { for (var _i = 0; _i < numberofframes - 1; _i++) { var size = 0; do { size += data[offset]; offset++; } while (data[offset - 1] === 0xff); framesizes.push(size); } } // ebml if (parsed.lacing === 3) { // first vint is unsinged // after that vints are singed and // based on a compounding size var _size = 0; for (var _i2 = 0; _i2 < numberofframes - 1; _i2++) { var vint = _i2 === 0 ? ebml_helpers_getvint(data, offset) : ebml_helpers_getvint(data, offset, true, true); _size += vint.value; framesizes.push(_size); offset += vint.length; } } framesizes.foreach(function (size) { parsed.frames.push(data.subarray(offset, offset + size)); offset += size; }); return parsed; }; // vp9 codec feature metadata (codecprivate) // https://www.webmproject.org/docs/container/ var parsevp9private = function parsevp9private(bytes) { var i = 0; var params = {}; while (i < bytes.length) { var id = bytes[i] & 0x7f; var len = bytes[i + 1]; var val = void 0; if (len === 1) { val = bytes[i + 2]; } else { val = bytes.subarray(i + 2, i + 2 + len); } if (id === 1) { params.profile = val; } else if (id === 2) { params.level = val; } else if (id === 3) { params.bitdepth = val; } else if (id === 4) { params.chromasubsampling = val; } else { params[id] = val; } i += 2 + len; } return params; }; var ebml_helpers_parsetracks = function parsetracks(bytes) { bytes = object(byte_helpers["k" /* touint8 */])(bytes); var decodedtracks = []; var tracks = ebml_helpers_findebml(bytes, [ebml_tags.segment, ebml_tags.tracks, ebml_tags.track]); if (!tracks.length) { tracks = ebml_helpers_findebml(bytes, [ebml_tags.tracks, ebml_tags.track]); } if (!tracks.length) { tracks = ebml_helpers_findebml(bytes, [ebml_tags.track]); } if (!tracks.length) { return decodedtracks; } tracks.foreach(function (track) { var tracktype = ebml_helpers_findebml(track, ebml_tags.tracktype)[0]; if (!tracktype || !tracktype.length) { return; } // 1 is video, 2 is audio, 17 is subtitle // other values are unimportant in this context if (tracktype[0] === 1) { tracktype = 'video'; } else if (tracktype[0] === 2) { tracktype = 'audio'; } else if (tracktype[0] === 17) { tracktype = 'subtitle'; } else { return; } // todo parse language var decodedtrack = { rawcodec: object(byte_helpers["c" /* bytestostring */])(ebml_helpers_findebml(track, [ebml_tags.codecid])[0]), type: tracktype, codecprivate: ebml_helpers_findebml(track, [ebml_tags.codecprivate])[0], number: object(byte_helpers["b" /* bytestonumber */])(ebml_helpers_findebml(track, [ebml_tags.tracknumber])[0]), defaultduration: object(byte_helpers["b" /* bytestonumber */])(ebml_helpers_findebml(track, [ebml_tags.defaultduration])[0]), default: ebml_helpers_findebml(track, [ebml_tags.flagdefault])[0], rawdata: track }; var codec = ''; if (/v_mpeg4\/iso\/avc/.test(decodedtrack.rawcodec)) { codec = "avc1." + codec_helpers_getavccodec(decodedtrack.codecprivate); } else if (/v_mpegh\/iso\/hevc/.test(decodedtrack.rawcodec)) { codec = "hev1." + codec_helpers_gethvccodec(decodedtrack.codecprivate); } else if (/v_mpeg4\/iso\/asp/.test(decodedtrack.rawcodec)) { if (decodedtrack.codecprivate) { codec = 'mp4v.20.' + decodedtrack.codecprivate[4].tostring(); } else { codec = 'mp4v.20.9'; } } else if (/^v_theora/.test(decodedtrack.rawcodec)) { codec = 'theora'; } else if (/^v_vp8/.test(decodedtrack.rawcodec)) { codec = 'vp8'; } else if (/^v_vp9/.test(decodedtrack.rawcodec)) { if (decodedtrack.codecprivate) { var _parsevp9private = parsevp9private(decodedtrack.codecprivate), profile = _parsevp9private.profile, level = _parsevp9private.level, bitdepth = _parsevp9private.bitdepth, chromasubsampling = _parsevp9private.chromasubsampling; codec = 'vp09.'; codec += object(byte_helpers["g" /* padstart */])(profile, 2, '0') + "."; codec += object(byte_helpers["g" /* padstart */])(level, 2, '0') + "."; codec += object(byte_helpers["g" /* padstart */])(bitdepth, 2, '0') + "."; codec += "" + object(byte_helpers["g" /* padstart */])(chromasubsampling, 2, '0'); // video -> colour -> ebml name var matrixcoefficients = ebml_helpers_findebml(track, [0xe0, [0x55, 0xb0], [0x55, 0xb1]])[0] || []; var videofullrangeflag = ebml_helpers_findebml(track, [0xe0, [0x55, 0xb0], [0x55, 0xb9]])[0] || []; var transfercharacteristics = ebml_helpers_findebml(track, [0xe0, [0x55, 0xb0], [0x55, 0xba]])[0] || []; var colourprimaries = ebml_helpers_findebml(track, [0xe0, [0x55, 0xb0], [0x55, 0xbb]])[0] || []; // if we find any optional codec parameter specify them all. if (matrixcoefficients.length || videofullrangeflag.length || transfercharacteristics.length || colourprimaries.length) { codec += "." + object(byte_helpers["g" /* padstart */])(colourprimaries[0], 2, '0'); codec += "." + object(byte_helpers["g" /* padstart */])(transfercharacteristics[0], 2, '0'); codec += "." + object(byte_helpers["g" /* padstart */])(matrixcoefficients[0], 2, '0'); codec += "." + object(byte_helpers["g" /* padstart */])(videofullrangeflag[0], 2, '0'); } } else { codec = 'vp9'; } } else if (/^v_av1/.test(decodedtrack.rawcodec)) { codec = "av01." + codec_helpers_getav1codec(decodedtrack.codecprivate); } else if (/a_alac/.test(decodedtrack.rawcodec)) { codec = 'alac'; } else if (/a_mpeg\/l2/.test(decodedtrack.rawcodec)) { codec = 'mp2'; } else if (/a_mpeg\/l3/.test(decodedtrack.rawcodec)) { codec = 'mp3'; } else if (/^a_aac/.test(decodedtrack.rawcodec)) { if (decodedtrack.codecprivate) { codec = 'mp4a.40.' + (decodedtrack.codecprivate[0] >>> 3).tostring(); } else { codec = 'mp4a.40.2'; } } else if (/^a_ac3/.test(decodedtrack.rawcodec)) { codec = 'ac-3'; } else if (/^a_pcm/.test(decodedtrack.rawcodec)) { codec = 'pcm'; } else if (/^a_ms\/acm/.test(decodedtrack.rawcodec)) { codec = 'speex'; } else if (/^a_eac3/.test(decodedtrack.rawcodec)) { codec = 'ec-3'; } else if (/^a_vorbis/.test(decodedtrack.rawcodec)) { codec = 'vorbis'; } else if (/^a_flac/.test(decodedtrack.rawcodec)) { codec = 'flac'; } else if (/^a_opus/.test(decodedtrack.rawcodec)) { codec = 'opus'; } decodedtrack.codec = codec; decodedtracks.push(decodedtrack); }); return decodedtracks.sort(function (a, b) { return a.number - b.number; }); }; var ebml_helpers_parsedata = function parsedata(data, tracks) { var allblocks = []; var segment = ebml_helpers_findebml(data, [ebml_tags.segment])[0]; var timestampscale = ebml_helpers_findebml(segment, [ebml_tags.segmentinfo, ebml_tags.timestampscale])[0]; // in nanoseconds, defaults to 1ms if (timestampscale && timestampscale.length) { timestampscale = object(byte_helpers["b" /* bytestonumber */])(timestampscale); } else { timestampscale = 1000000; } var clusters = ebml_helpers_findebml(segment, [ebml_tags.cluster]); if (!tracks) { tracks = ebml_helpers_parsetracks(segment); } clusters.foreach(function (cluster, ci) { var simpleblocks = ebml_helpers_findebml(cluster, [ebml_tags.simpleblock]).map(function (b) { return { type: 'simple', data: b }; }); var blockgroups = ebml_helpers_findebml(cluster, [ebml_tags.blockgroup]).map(function (b) { return { type: 'group', data: b }; }); var timestamp = ebml_helpers_findebml(cluster, [ebml_tags.timestamp])[0] || 0; if (timestamp && timestamp.length) { timestamp = object(byte_helpers["b" /* bytestonumber */])(timestamp); } // get all blocks then sort them into the correct order var blocks = simpleblocks.concat(blockgroups).sort(function (a, b) { return a.data.byteoffset - b.data.byteoffset; }); blocks.foreach(function (block, bi) { var decoded = ebml_helpers_decodeblock(block.data, block.type, timestampscale, timestamp); allblocks.push(decoded); }); }); return { tracks: tracks, blocks: allblocks }; }; // external module: ./node_modules/@videojs/vhs-utils/es/id3-helpers.js var id3_helpers = __webpack_require__(59); // concatenated module: ./node_modules/@videojs/vhs-utils/es/nal-helpers.js var nal_type_one = object(byte_helpers["k" /* touint8 */])([0x00, 0x00, 0x00, 0x01]); var nal_type_two = object(byte_helpers["k" /* touint8 */])([0x00, 0x00, 0x01]); var emulation_prevention = object(byte_helpers["k" /* touint8 */])([0x00, 0x00, 0x03]); /** * expunge any "emulation prevention" bytes from a "raw byte * sequence payload" * * @param data {uint8array} the bytes of a rbsp from a nal * unit * @return {uint8array} the rbsp without any emulation * prevention bytes */ var nal_helpers_discardemulationpreventionbytes = function discardemulationpreventionbytes(bytes) { var positions = []; var i = 1; // find all `emulation prevention bytes` while (i < bytes.length - 2) { if (object(byte_helpers["a" /* bytesmatch */])(bytes.subarray(i, i + 3), emulation_prevention)) { positions.push(i + 2); i++; } i++; } // if no emulation prevention bytes were found just return the original // array if (positions.length === 0) { return bytes; } // create a new array to hold the nal unit data var newlength = bytes.length - positions.length; var newdata = new uint8array(newlength); var sourceindex = 0; for (i = 0; i < newlength; sourceindex++, i++) { if (sourceindex === positions[0]) { // skip this byte sourceindex++; // remove this position index positions.shift(); } newdata[i] = bytes[sourceindex]; } return newdata; }; var nal_helpers_findnal = function findnal(bytes, datatype, types, nallimit) { if (nallimit === void 0) { nallimit = infinity; } bytes = object(byte_helpers["k" /* touint8 */])(bytes); types = [].concat(types); var i = 0; var nalstart; var nalsfound = 0; // keep searching until: // we reach the end of bytes // we reach the maximum number of nals they want to seach // note: that we disregard nallimit when we have found the start // of the nal we want so that we can find the end of the nal we want. while (i < bytes.length && (nalsfound < nallimit || nalstart)) { var naloffset = void 0; if (object(byte_helpers["a" /* bytesmatch */])(bytes.subarray(i), nal_type_one)) { naloffset = 4; } else if (object(byte_helpers["a" /* bytesmatch */])(bytes.subarray(i), nal_type_two)) { naloffset = 3; } // we are unsynced, // find the next nal unit if (!naloffset) { i++; continue; } nalsfound++; if (nalstart) { return nal_helpers_discardemulationpreventionbytes(bytes.subarray(nalstart, i)); } var naltype = void 0; if (datatype === 'h264') { naltype = bytes[i + naloffset] & 0x1f; } else if (datatype === 'h265') { naltype = bytes[i + naloffset] >> 1 & 0x3f; } if (types.indexof(naltype) !== -1) { nalstart = i + naloffset; } // nal header is 1 length for h264, and 2 for h265 i += naloffset + (datatype === 'h264' ? 1 : 2); } return bytes.subarray(0, 0); }; var findh264nal = function findh264nal(bytes, type, nallimit) { return nal_helpers_findnal(bytes, 'h264', type, nallimit); }; var findh265nal = function findh265nal(bytes, type, nallimit) { return nal_helpers_findnal(bytes, 'h265', type, nallimit); }; // concatenated module: ./node_modules/@videojs/vhs-utils/es/containers.js var constants = { // "webm" string literal in hex 'webm': object(byte_helpers["k" /* touint8 */])([0x77, 0x65, 0x62, 0x6d]), // "matroska" string literal in hex 'matroska': object(byte_helpers["k" /* touint8 */])([0x6d, 0x61, 0x74, 0x72, 0x6f, 0x73, 0x6b, 0x61]), // "flac" string literal in hex 'flac': object(byte_helpers["k" /* touint8 */])([0x66, 0x4c, 0x61, 0x43]), // "oggs" string literal in hex 'ogg': object(byte_helpers["k" /* touint8 */])([0x4f, 0x67, 0x67, 0x53]), // ac-3 sync byte, also works for ec-3 as that is simply a codec // of ac-3 'ac3': object(byte_helpers["k" /* touint8 */])([0x0b, 0x77]), // "riff" string literal in hex used for wav and avi 'riff': object(byte_helpers["k" /* touint8 */])([0x52, 0x49, 0x46, 0x46]), // "avi" string literal in hex 'avi': object(byte_helpers["k" /* touint8 */])([0x41, 0x56, 0x49]), // "wave" string literal in hex 'wav': object(byte_helpers["k" /* touint8 */])([0x57, 0x41, 0x56, 0x45]), // "ftyp3g" string literal in hex '3gp': object(byte_helpers["k" /* touint8 */])([0x66, 0x74, 0x79, 0x70, 0x33, 0x67]), // "ftyp" string literal in hex 'mp4': object(byte_helpers["k" /* touint8 */])([0x66, 0x74, 0x79, 0x70]), // "styp" string literal in hex 'fmp4': object(byte_helpers["k" /* touint8 */])([0x73, 0x74, 0x79, 0x70]), // "ftypqt" string literal in hex 'mov': object(byte_helpers["k" /* touint8 */])([0x66, 0x74, 0x79, 0x70, 0x71, 0x74]), // moov string literal in hex 'moov': object(byte_helpers["k" /* touint8 */])([0x6d, 0x6f, 0x6f, 0x76]), // moof string literal in hex 'moof': object(byte_helpers["k" /* touint8 */])([0x6d, 0x6f, 0x6f, 0x66]) }; var _islikely = { aac: function aac(bytes) { var offset = object(id3_helpers["a" /* getid3offset */])(bytes); return object(byte_helpers["a" /* bytesmatch */])(bytes, [0xff, 0x10], { offset: offset, mask: [0xff, 0x16] }); }, mp3: function mp3(bytes) { var offset = object(id3_helpers["a" /* getid3offset */])(bytes); return object(byte_helpers["a" /* bytesmatch */])(bytes, [0xff, 0x02], { offset: offset, mask: [0xff, 0x06] }); }, webm: function webm(bytes) { var doctype = ebml_helpers_findebml(bytes, [ebml_tags.ebml, ebml_tags.doctype])[0]; // check if doctype ebml tag is webm return object(byte_helpers["a" /* bytesmatch */])(doctype, constants.webm); }, mkv: function mkv(bytes) { var doctype = ebml_helpers_findebml(bytes, [ebml_tags.ebml, ebml_tags.doctype])[0]; // check if doctype ebml tag is matroska return object(byte_helpers["a" /* bytesmatch */])(doctype, constants.matroska); }, mp4: function mp4(bytes) { // if this file is another base media file format, it is not mp4 if (_islikely['3gp'](bytes) || _islikely.mov(bytes)) { return false; } // if this file starts with a ftyp or styp box its mp4 if (object(byte_helpers["a" /* bytesmatch */])(bytes, constants.mp4, { offset: 4 }) || object(byte_helpers["a" /* bytesmatch */])(bytes, constants.fmp4, { offset: 4 })) { return true; } // if this file starts with a moof/moov box its mp4 if (object(byte_helpers["a" /* bytesmatch */])(bytes, constants.moof, { offset: 4 }) || object(byte_helpers["a" /* bytesmatch */])(bytes, constants.moov, { offset: 4 })) { return true; } }, mov: function mov(bytes) { return object(byte_helpers["a" /* bytesmatch */])(bytes, constants.mov, { offset: 4 }); }, '3gp': function gp(bytes) { return object(byte_helpers["a" /* bytesmatch */])(bytes, constants['3gp'], { offset: 4 }); }, ac3: function ac3(bytes) { var offset = object(id3_helpers["a" /* getid3offset */])(bytes); return object(byte_helpers["a" /* bytesmatch */])(bytes, constants.ac3, { offset: offset }); }, ts: function ts(bytes) { if (bytes.length < 189 && bytes.length >= 1) { return bytes[0] === 0x47; } var i = 0; // check the first 376 bytes for two matching sync bytes while (i + 188 < bytes.length && i < 188) { if (bytes[i] === 0x47 && bytes[i + 188] === 0x47) { return true; } i += 1; } return false; }, flac: function flac(bytes) { var offset = object(id3_helpers["a" /* getid3offset */])(bytes); return object(byte_helpers["a" /* bytesmatch */])(bytes, constants.flac, { offset: offset }); }, ogg: function ogg(bytes) { return object(byte_helpers["a" /* bytesmatch */])(bytes, constants.ogg); }, avi: function avi(bytes) { return object(byte_helpers["a" /* bytesmatch */])(bytes, constants.riff) && object(byte_helpers["a" /* bytesmatch */])(bytes, constants.avi, { offset: 8 }); }, wav: function wav(bytes) { return object(byte_helpers["a" /* bytesmatch */])(bytes, constants.riff) && object(byte_helpers["a" /* bytesmatch */])(bytes, constants.wav, { offset: 8 }); }, 'h264': function h264(bytes) { // find seq_parameter_set_rbsp return findh264nal(bytes, 7, 3).length; }, 'h265': function h265(bytes) { // find video_parameter_set_rbsp or seq_parameter_set_rbsp return findh265nal(bytes, [32, 33], 3).length; } }; // get all the islikely functions // but make sure 'ts' is above h264 and h265 // but below everything else as it is the least specific var islikelytypes = object.keys(_islikely) // remove ts, h264, h265 .filter(function (t) { return t !== 'ts' && t !== 'h264' && t !== 'h265'; }) // add it back to the bottom .concat(['ts', 'h264', 'h265']); // make sure we are dealing with uint8 data. islikelytypes.foreach(function (type) { var islikelyfn = _islikely[type]; _islikely[type] = function (bytes) { return islikelyfn(object(byte_helpers["k" /* touint8 */])(bytes)); }; }); // export after wrapping var islikely = _islikely; // a useful list of file signatures can be found here // https://en.wikipedia.org/wiki/list_of_file_signatures var containers_detectcontainerforbytes = function detectcontainerforbytes(bytes) { bytes = object(byte_helpers["k" /* touint8 */])(bytes); for (var i = 0; i < islikelytypes.length; i++) { var type = islikelytypes[i]; if (islikely[type](bytes)) { return type; } } return ''; }; // fmp4 is not a container var containers_islikelyfmp4mediasegment = function islikelyfmp4mediasegment(bytes) { return mp4_helpers_findbox(bytes, ['moof']).length > 0; }; /***/ }), /***/ 124: /***/ (function(module, exports) { function _setprototypeof(o, p) { module.exports = _setprototypeof = object.setprototypeof ? object.setprototypeof.bind() : function _setprototypeof(o, p) { o.__proto__ = p; return o; }, module.exports.__esmodule = true, module.exports["default"] = module.exports; return _setprototypeof(o, p); } module.exports = _setprototypeof, module.exports.__esmodule = true, module.exports["default"] = module.exports; /***/ }), /***/ 125: /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * ponyfill for `array.prototype.find` which is only available in es6 runtimes. * * works with anything that has a `length` property and index access properties, including nodelist. * * @template {unknown} t * @param {array | ({length:number, [number]: t})} list * @param {function (item: t, index: number, list:array | ({length:number, [number]: t})):boolean} predicate * @param {partial>?} ac `array.prototype` by default, * allows injecting a custom implementation in tests * @returns {t | undefined} * * @see https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/find * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find */ function find(list, predicate, ac) { if (ac === undefined) { ac = array.prototype; } if (list && typeof ac.find === 'function') { return ac.find.call(list, predicate); } for (var i = 0; i < list.length; i++) { if (object.prototype.hasownproperty.call(list, i)) { var item = list[i]; if (predicate.call(undefined, item, i, list)) { return item; } } } } /** * "shallow freezes" an object to render it immutable. * uses `object.freeze` if available, * otherwise the immutability is only in the type. * * is used to create "enum like" objects. * * @template t * @param {t} object the object to freeze * @param {pick = object} oc `object` by default, * allows to inject custom object constructor for tests * @returns {readonly} * * @see https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/object/freeze */ function freeze(object, oc) { if (oc === undefined) { oc = object } return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object } /** * since we can not rely on `object.assign` we provide a simplified version * that is sufficient for our needs. * * @param {object} target * @param {object | null | undefined} source * * @returns {object} target * @throws typeerror if target is not an object * * @see https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/object/assign * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign */ function assign(target, source) { if (target === null || typeof target !== 'object') { throw new typeerror('target is not an object') } for (var key in source) { if (object.prototype.hasownproperty.call(source, key)) { target[key] = source[key] } } return target } /** * all mime types that are allowed as input to `domparser.parsefromstring` * * @see https://developer.mozilla.org/en-us/docs/web/api/domparser/parsefromstring#argument02 mdn * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype whatwg html spec * @see domparser.prototype.parsefromstring */ var mime_type = freeze({ /** * `text/html`, the only mime type that triggers treating an xml document as html. * * @see domparser.supportedtype.ishtml * @see https://www.iana.org/assignments/media-types/text/html iana mimetype registration * @see https://en.wikipedia.org/wiki/html wikipedia * @see https://developer.mozilla.org/en-us/docs/web/api/domparser/parsefromstring mdn * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring whatwg html spec */ html: 'text/html', /** * helper method to check a mime type if it indicates an html document * * @param {string} [value] * @returns {boolean} * * @see https://www.iana.org/assignments/media-types/text/html iana mimetype registration * @see https://en.wikipedia.org/wiki/html wikipedia * @see https://developer.mozilla.org/en-us/docs/web/api/domparser/parsefromstring mdn * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring */ ishtml: function (value) { return value === mime_type.html }, /** * `application/xml`, the standard mime type for xml documents. * * @see https://www.iana.org/assignments/media-types/application/xml iana mimetype registration * @see https://tools.ietf.org/html/rfc7303#section-9.1 rfc 7303 * @see https://en.wikipedia.org/wiki/xml_and_mime wikipedia */ xml_application: 'application/xml', /** * `text/html`, an alias for `application/xml`. * * @see https://tools.ietf.org/html/rfc7303#section-9.2 rfc 7303 * @see https://www.iana.org/assignments/media-types/text/xml iana mimetype registration * @see https://en.wikipedia.org/wiki/xml_and_mime wikipedia */ xml_text: 'text/xml', /** * `application/xhtml+xml`, indicates an xml document that has the default html namespace, * but is parsed as an xml document. * * @see https://www.iana.org/assignments/media-types/application/xhtml+xml iana mimetype registration * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument whatwg dom spec * @see https://en.wikipedia.org/wiki/xhtml wikipedia */ xml_xhtml_application: 'application/xhtml+xml', /** * `image/svg+xml`, * * @see https://www.iana.org/assignments/media-types/image/svg+xml iana mimetype registration * @see https://www.w3.org/tr/svg11/ w3c svg 1.1 * @see https://en.wikipedia.org/wiki/scalable_vector_graphics wikipedia */ xml_svg_image: 'image/svg+xml', }) /** * namespaces that are used in this code base. * * @see http://www.w3.org/tr/rec-xml-names */ var namespace = freeze({ /** * the xhtml namespace. * * @see http://www.w3.org/1999/xhtml */ html: 'http://www.w3.org/1999/xhtml', /** * checks if `uri` equals `namespace.html`. * * @param {string} [uri] * * @see namespace.html */ ishtml: function (uri) { return uri === namespace.html }, /** * the svg namespace. * * @see http://www.w3.org/2000/svg */ svg: 'http://www.w3.org/2000/svg', /** * the `xml:` namespace. * * @see http://www.w3.org/xml/1998/namespace */ xml: 'http://www.w3.org/xml/1998/namespace', /** * the `xmlns:` namespace * * @see https://www.w3.org/2000/xmlns/ */ xmlns: 'http://www.w3.org/2000/xmlns/', }) exports.assign = assign; exports.find = find; exports.freeze = freeze; exports.mime_type = mime_type; exports.namespace = namespace; /***/ }), /***/ 126: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _arraywithholes; }); function _arraywithholes(arr) { if (array.isarray(arr)) return arr; } /***/ }), /***/ 127: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _noniterablerest; }); function _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."); } /***/ }), /***/ 128: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _iterabletoarray; }); function _iterabletoarray(iter) { if (typeof symbol !== "undefined" && iter[symbol.iterator] != null || iter["@@iterator"] != null) return array.from(iter); } /***/ }), /***/ 130: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* webpack var injection */(function(buffer) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return decodeb64touint8array; }); /* harmony import */ var global_window__webpack_imported_module_0__ = __webpack_require__(0); /* harmony import */ var global_window__webpack_imported_module_0___default = /*#__pure__*/__webpack_require__.n(global_window__webpack_imported_module_0__); var atob = function atob(s) { return global_window__webpack_imported_module_0___default.a.atob ? global_window__webpack_imported_module_0___default.a.atob(s) : buffer.from(s, 'base64').tostring('binary'); }; function decodeb64touint8array(b64text) { var decodedstring = atob(b64text); var array = new uint8array(decodedstring.length); for (var i = 0; i < decodedstring.length; i++) { array[i] = decodedstring.charcodeat(i); } return array; } /* webpack var injection */}.call(this, __webpack_require__(414).buffer)) /***/ }), /***/ 131: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // exports __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _topropertykey; }); // external module: ./node_modules/@babel/runtime/helpers/esm/typeof.js var esm_typeof = __webpack_require__(22); // concatenated module: ./node_modules/@babel/runtime/helpers/esm/toprimitive.js function _toprimitive(input, hint) { if (object(esm_typeof["a" /* default */])(input) !== "object" || input === null) return input; var prim = input[symbol.toprimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (object(esm_typeof["a" /* default */])(res) !== "object") return res; throw new typeerror("@@toprimitive must return a primitive value."); } return (hint === "string" ? string : number)(input); } // concatenated module: ./node_modules/@babel/runtime/helpers/esm/topropertykey.js function _topropertykey(arg) { var key = _toprimitive(arg, "string"); return object(esm_typeof["a" /* default */])(key) === "symbol" ? key : string(key); } /***/ }), /***/ 132: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return stream; }); /** * @file stream.js */ /** * a lightweight readable stream implemention that handles event dispatching. * * @class stream */ var stream = /*#__pure__*/function () { function stream() { this.listeners = {}; } /** * add a listener for a specified event type. * * @param {string} type the event name * @param {function} listener the callback to be invoked when an event of * the specified type occurs */ var _proto = stream.prototype; _proto.on = function on(type, listener) { if (!this.listeners[type]) { this.listeners[type] = []; } this.listeners[type].push(listener); } /** * remove a listener for a specified event type. * * @param {string} type the event name * @param {function} listener a function previously registered for this * type of event through `on` * @return {boolean} if we could turn it off or not */ ; _proto.off = function off(type, listener) { if (!this.listeners[type]) { return false; } var index = this.listeners[type].indexof(listener); // todo: which is better? // in video.js we slice listener functions // on trigger so that it does not mess up the order // while we loop through. // // here we slice on off so that the loop in trigger // can continue using it's old reference to loop without // messing up the order. this.listeners[type] = this.listeners[type].slice(0); this.listeners[type].splice(index, 1); return index > -1; } /** * trigger an event of the specified type on this stream. any additional * arguments to this function are passed as parameters to event listeners. * * @param {string} type the event name */ ; _proto.trigger = function trigger(type) { var callbacks = this.listeners[type]; if (!callbacks) { return; } // slicing the arguments on every invocation of this method // can add a significant amount of overhead. avoid the // intermediate object creation for the common case of a // single callback argument if (arguments.length === 2) { var length = callbacks.length; for (var i = 0; i < length; ++i) { callbacks[i].call(this, arguments[1]); } } else { var args = array.prototype.slice.call(arguments, 1); var _length = callbacks.length; for (var _i = 0; _i < _length; ++_i) { callbacks[_i].apply(this, args); } } } /** * destroys the stream and cleans up. */ ; _proto.dispose = function dispose() { this.listeners = {}; } /** * forwards all `data` events on this stream to the destination stream. the * destination stream should provide a method `push` to receive the data * events as they arrive. * * @param {stream} destination the stream that will receive all `data` events * @see http://nodejs.org/api/stream.html#stream_readable_pipe_destination_options */ ; _proto.pipe = function pipe(destination) { this.on('data', function (data) { destination.push(data); }); }; return stream; }(); /***/ }), /***/ 14: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return translatelegacycodec; }); /* unused harmony export translatelegacycodecs */ /* unused harmony export maplegacyavccodecs */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return parsecodecs; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return codecsfromdefault; }); /* unused harmony export isvideocodec */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isaudiocodec; }); /* unused harmony export istextcodec */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getmimeforcodec; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return browsersupportscodec; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return muxersupportscodec; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return default_audio_codec; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return default_video_codec; }); /* harmony import */ var global_window__webpack_imported_module_0__ = __webpack_require__(0); /* harmony import */ var global_window__webpack_imported_module_0___default = /*#__pure__*/__webpack_require__.n(global_window__webpack_imported_module_0__); var regexs = { // to determine mime types mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/, webm: /^(vp0?[89]|av0?1|opus|vorbis)/, ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/, // to determine if a codec is audio or video video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/, audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/, text: /^(stpp.ttml.im1t)/, // mux.js support regex muxervideo: /^(avc0?1)/, muxeraudio: /^(mp4a)/, // match nothing as muxer does not support text right now. // there cannot never be a character before the start of a string // so this matches nothing. muxertext: /a^/ }; var mediatypes = ['video', 'audio', 'text']; var uppermediatypes = ['video', 'audio', 'text']; /** * replace the old apple-style `avc1.
.
` codec string with the standard * `avc1.` * * @param {string} codec * codec string to translate * @return {string} * the translated codec string */ var translatelegacycodec = function translatelegacycodec(codec) { if (!codec) { return codec; } return codec.replace(/avc1\.(\d+)\.(\d+)/i, function (orig, profile, avclevel) { var profilehex = ('00' + number(profile).tostring(16)).slice(-2); var avclevelhex = ('00' + number(avclevel).tostring(16)).slice(-2); return 'avc1.' + profilehex + '00' + avclevelhex; }); }; /** * replace the old apple-style `avc1.
.
` codec strings with the standard * `avc1.` * * @param {string[]} codecs * an array of codec strings to translate * @return {string[]} * the translated array of codec strings */ var translatelegacycodecs = function translatelegacycodecs(codecs) { return codecs.map(translatelegacycodec); }; /** * replace codecs in the codec string with the old apple-style `avc1.
.
` to the * standard `avc1.`. * * @param {string} codecstring * the codec string * @return {string} * the codec string with old apple-style codecs replaced * * @private */ var maplegacyavccodecs = function maplegacyavccodecs(codecstring) { return codecstring.replace(/avc1\.(\d+)\.(\d+)/i, function (match) { return translatelegacycodecs([match])[0]; }); }; /** * @typedef {object} parsedcodecinfo * @property {number} codeccount * number of codecs parsed * @property {string} [videocodec] * parsed video codec (if found) * @property {string} [videoobjecttypeindicator] * video object type indicator (if found) * @property {string|null} audioprofile * audio profile */ /** * parses a codec string to retrieve the number of codecs specified, the video codec and * object type indicator, and the audio profile. * * @param {string} [codecstring] * the codec string to parse * @return {parsedcodecinfo} * parsed codec info */ var parsecodecs = function parsecodecs(codecstring) { if (codecstring === void 0) { codecstring = ''; } var codecs = codecstring.split(','); var result = []; codecs.foreach(function (codec) { codec = codec.trim(); var codectype; mediatypes.foreach(function (name) { var match = regexs[name].exec(codec.tolowercase()); if (!match || match.length <= 1) { return; } codectype = name; // maintain codec case var type = codec.substring(0, match[1].length); var details = codec.replace(type, ''); result.push({ type: type, details: details, mediatype: name }); }); if (!codectype) { result.push({ type: codec, details: '', mediatype: 'unknown' }); } }); return result; }; /** * returns a parsedcodecinfo object for the default alternate audio playlist if there is * a default alternate audio playlist for the provided audio group. * * @param {object} master * the master playlist * @param {string} audiogroupid * id of the audio group for which to find the default codec info * @return {parsedcodecinfo} * parsed codec info */ var codecsfromdefault = function codecsfromdefault(master, audiogroupid) { if (!master.mediagroups.audio || !audiogroupid) { return null; } var audiogroup = master.mediagroups.audio[audiogroupid]; if (!audiogroup) { return null; } for (var name in audiogroup) { var audiotype = audiogroup[name]; if (audiotype.default && audiotype.playlists) { // codec should be the same for all playlists within the audio type return parsecodecs(audiotype.playlists[0].attributes.codecs); } } return null; }; var isvideocodec = function isvideocodec(codec) { if (codec === void 0) { codec = ''; } return regexs.video.test(codec.trim().tolowercase()); }; var isaudiocodec = function isaudiocodec(codec) { if (codec === void 0) { codec = ''; } return regexs.audio.test(codec.trim().tolowercase()); }; var istextcodec = function istextcodec(codec) { if (codec === void 0) { codec = ''; } return regexs.text.test(codec.trim().tolowercase()); }; var getmimeforcodec = function getmimeforcodec(codecstring) { if (!codecstring || typeof codecstring !== 'string') { return; } var codecs = codecstring.tolowercase().split(',').map(function (c) { return translatelegacycodec(c.trim()); }); // default to video type var type = 'video'; // only change to audio type if the only codec we have is // audio if (codecs.length === 1 && isaudiocodec(codecs[0])) { type = 'audio'; } else if (codecs.length === 1 && istextcodec(codecs[0])) { // text uses application/ for now type = 'application'; } // default the container to mp4 var container = 'mp4'; // every codec must be able to go into the container // for that container to be the correct one if (codecs.every(function (c) { return regexs.mp4.test(c); })) { container = 'mp4'; } else if (codecs.every(function (c) { return regexs.webm.test(c); })) { container = 'webm'; } else if (codecs.every(function (c) { return regexs.ogg.test(c); })) { container = 'ogg'; } return type + "/" + container + ";codecs=\"" + codecstring + "\""; }; var browsersupportscodec = function browsersupportscodec(codecstring) { if (codecstring === void 0) { codecstring = ''; } return global_window__webpack_imported_module_0___default.a.mediasource && global_window__webpack_imported_module_0___default.a.mediasource.istypesupported && global_window__webpack_imported_module_0___default.a.mediasource.istypesupported(getmimeforcodec(codecstring)) || false; }; var muxersupportscodec = function muxersupportscodec(codecstring) { if (codecstring === void 0) { codecstring = ''; } return codecstring.tolowercase().split(',').every(function (codec) { codec = codec.trim(); // any match is supported. for (var i = 0; i < uppermediatypes.length; i++) { var type = uppermediatypes[i]; if (regexs["muxer" + type].test(codec)) { return true; } } return false; }); }; var default_audio_codec = 'mp4a.40.2'; var default_video_codec = 'avc1.4d400d'; /***/ }), /***/ 160: /***/ (function(module, exports, __webpack_require__) { var setprototypeof = __webpack_require__(124); var isnativereflectconstruct = __webpack_require__(413); function _construct(parent, args, class) { if (isnativereflectconstruct()) { module.exports = _construct = reflect.construct.bind(), module.exports.__esmodule = true, module.exports["default"] = module.exports; } else { module.exports = _construct = function _construct(parent, args, class) { var a = [null]; a.push.apply(a, args); var constructor = function.bind.apply(parent, a); var instance = new constructor(); if (class) setprototypeof(instance, class.prototype); return instance; }, module.exports.__esmodule = true, module.exports["default"] = module.exports; } return _construct.apply(null, arguments); } module.exports = _construct, module.exports.__esmodule = true, module.exports["default"] = module.exports; /***/ }), /***/ 161: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // exports __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _toconsumablearray; }); // external module: ./node_modules/@babel/runtime/helpers/esm/arrayliketoarray.js var arrayliketoarray = __webpack_require__(97); // concatenated module: ./node_modules/@babel/runtime/helpers/esm/arraywithoutholes.js function _arraywithoutholes(arr) { if (array.isarray(arr)) return object(arrayliketoarray["a" /* default */])(arr); } // external module: ./node_modules/@babel/runtime/helpers/esm/iterabletoarray.js var iterabletoarray = __webpack_require__(128); // external module: ./node_modules/@babel/runtime/helpers/esm/unsupportediterabletoarray.js var unsupportediterabletoarray = __webpack_require__(80); // concatenated module: ./node_modules/@babel/runtime/helpers/esm/noniterablespread.js function _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."); } // concatenated module: ./node_modules/@babel/runtime/helpers/esm/toconsumablearray.js function _toconsumablearray(arr) { return _arraywithoutholes(arr) || object(iterabletoarray["a" /* default */])(arr) || object(unsupportediterabletoarray["a" /* default */])(arr) || _noniterablespread(); } /***/ }), /***/ 163: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _toarray; }); /* harmony import */ var _arraywithholes_js__webpack_imported_module_0__ = __webpack_require__(126); /* harmony import */ var _iterabletoarray_js__webpack_imported_module_1__ = __webpack_require__(128); /* harmony import */ var _unsupportediterabletoarray_js__webpack_imported_module_2__ = __webpack_require__(80); /* harmony import */ var _noniterablerest_js__webpack_imported_module_3__ = __webpack_require__(127); function _toarray(arr) { return object(_arraywithholes_js__webpack_imported_module_0__[/* default */ "a"])(arr) || object(_iterabletoarray_js__webpack_imported_module_1__[/* default */ "a"])(arr) || object(_unsupportediterabletoarray_js__webpack_imported_module_2__[/* default */ "a"])(arr) || object(_noniterablerest_js__webpack_imported_module_3__[/* default */ "a"])(); } /***/ }), /***/ 169: /***/ (function(module, exports, __webpack_require__) { "use strict"; var window = __webpack_require__(0); var _extends = __webpack_require__(35); var isfunction = __webpack_require__(408); createxhr.httphandler = __webpack_require__(409); /** * @license * slighly modified parse-headers 2.0.2 * copyright (c) 2014 david björklund * available under the mit license * */ var parseheaders = function parseheaders(headers) { var result = {}; if (!headers) { return result; } headers.trim().split('\n').foreach(function (row) { var index = row.indexof(':'); var key = row.slice(0, index).trim().tolowercase(); var value = row.slice(index + 1).trim(); if (typeof result[key] === 'undefined') { result[key] = value; } else if (array.isarray(result[key])) { result[key].push(value); } else { result[key] = [result[key], value]; } }); return result; }; module.exports = createxhr; // allow use of default import syntax in typescript module.exports.default = createxhr; createxhr.xmlhttprequest = window.xmlhttprequest || noop; createxhr.xdomainrequest = "withcredentials" in new createxhr.xmlhttprequest() ? createxhr.xmlhttprequest : window.xdomainrequest; foreacharray(["get", "put", "post", "patch", "head", "delete"], function (method) { createxhr[method === "delete" ? "del" : method] = function (uri, options, callback) { options = initparams(uri, options, callback); options.method = method.touppercase(); return _createxhr(options); }; }); function foreacharray(array, iterator) { for (var i = 0; i < array.length; i++) { iterator(array[i]); } } function isempty(obj) { for (var i in obj) { if (obj.hasownproperty(i)) return false; } return true; } function initparams(uri, options, callback) { var params = uri; if (isfunction(options)) { callback = options; if (typeof uri === "string") { params = { uri: uri }; } } else { params = _extends({}, options, { uri: uri }); } params.callback = callback; return params; } function createxhr(uri, options, callback) { options = initparams(uri, options, callback); return _createxhr(options); } function _createxhr(options) { if (typeof options.callback === "undefined") { throw new error("callback argument missing"); } var called = false; var callback = function cbonce(err, response, body) { if (!called) { called = true; options.callback(err, response, body); } }; function readystatechange() { if (xhr.readystate === 4) { settimeout(loadfunc, 0); } } function getbody() { // chrome with requesttype=blob throws errors arround when even testing access to responsetext var body = undefined; if (xhr.response) { body = xhr.response; } else { body = xhr.responsetext || getxml(xhr); } if (isjson) { try { body = json.parse(body); } catch (e) {} } return body; } function errorfunc(evt) { cleartimeout(timeouttimer); if (!(evt instanceof error)) { evt = new error("" + (evt || "unknown xmlhttprequest error")); } evt.statuscode = 0; return callback(evt, failureresponse); } // will load the data & process the response in a special response object function loadfunc() { if (aborted) return; var status; cleartimeout(timeouttimer); if (options.usexdr && xhr.status === undefined) { //ie8 cors get successful response doesn't have a status field, but body is fine status = 200; } else { status = xhr.status === 1223 ? 204 : xhr.status; } var response = failureresponse; var err = null; if (status !== 0) { response = { body: getbody(), statuscode: status, method: method, headers: {}, url: uri, rawrequest: xhr }; if (xhr.getallresponseheaders) { //remember xhr can in fact be xdr for cors in ie response.headers = parseheaders(xhr.getallresponseheaders()); } } else { err = new error("internal xmlhttprequest error"); } return callback(err, response, response.body); } var xhr = options.xhr || null; if (!xhr) { if (options.cors || options.usexdr) { xhr = new createxhr.xdomainrequest(); } else { xhr = new createxhr.xmlhttprequest(); } } var key; var aborted; var uri = xhr.url = options.uri || options.url; var method = xhr.method = options.method || "get"; var body = options.body || options.data; var headers = xhr.headers = options.headers || {}; var sync = !!options.sync; var isjson = false; var timeouttimer; var failureresponse = { body: undefined, headers: {}, statuscode: 0, method: method, url: uri, rawrequest: xhr }; if ("json" in options && options.json !== false) { isjson = true; headers["accept"] || headers["accept"] || (headers["accept"] = "application/json"); //don't override existing accept header declared by user if (method !== "get" && method !== "head") { headers["content-type"] || headers["content-type"] || (headers["content-type"] = "application/json"); //don't override existing accept header declared by user body = json.stringify(options.json === true ? body : options.json); } } xhr.onreadystatechange = readystatechange; xhr.onload = loadfunc; xhr.onerror = errorfunc; // ie9 must have onprogress be set to a unique function. xhr.onprogress = function () {// ie must die }; xhr.onabort = function () { aborted = true; }; xhr.ontimeout = errorfunc; xhr.open(method, uri, !sync, options.username, options.password); //has to be after open if (!sync) { xhr.withcredentials = !!options.withcredentials; } // cannot set timeout with sync request // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly // both npm's request and jquery 1.x use this kind of timeout, so this is being consistent if (!sync && options.timeout > 0) { timeouttimer = settimeout(function () { if (aborted) return; aborted = true; //ie9 may still call readystatechange xhr.abort("timeout"); var e = new error("xmlhttprequest timeout"); e.code = "etimedout"; errorfunc(e); }, options.timeout); } if (xhr.setrequestheader) { for (key in headers) { if (headers.hasownproperty(key)) { xhr.setrequestheader(key, headers[key]); } } } else if (options.headers && !isempty(options.headers)) { throw new error("headers cannot be set on an xdomainrequest object"); } if ("responsetype" in options) { xhr.responsetype = options.responsetype; } if ("beforesend" in options && typeof options.beforesend === "function") { options.beforesend(xhr); } // microsoft edge browser sends "undefined" when send is called with undefined value. // xmlhttprequest spec says to pass null as body to indicate no body // see https://github.com/naugtur/xhr/issues/100. xhr.send(body || null); return xhr; } function getxml(xhr) { // xhr.responsexml will throw exception "invalidstateerror" or "domexception" // see https://developer.mozilla.org/en-us/docs/web/api/xmlhttprequest/responsexml. try { if (xhr.responsetype === "document") { return xhr.responsexml; } var firefoxbugtakeneffect = xhr.responsexml && xhr.responsexml.documentelement.nodename === "parsererror"; if (xhr.responsetype === "" && !firefoxbugtakeneffect) { return xhr.responsexml; } } catch (e) {} return null; } function noop() {} /***/ }), /***/ 17: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _asynctogenerator; }); function asyncgeneratorstep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { promise.resolve(value).then(_next, _throw); } } function _asynctogenerator(fn) { return function () { var self = this, args = arguments; return new promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncgeneratorstep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncgeneratorstep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } /***/ }), /***/ 172: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return simpletypefromsourcetype; }); var mpegurl_regex = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i; var dash_regex = /^application\/dash\+xml/i; /** * returns a string that describes the type of source based on a video source object's * media type. * * @see {@link https://dev.w3.org/html5/pf-summary/video.html#dom-source-type|source type} * * @param {string} type * video source object media type * @return {('hls'|'dash'|'vhs-json'|null)} * vhs source type string */ var simpletypefromsourcetype = function simpletypefromsourcetype(type) { if (mpegurl_regex.test(type)) { return 'hls'; } if (dash_regex.test(type)) { return 'dash'; } // denotes the special case of a manifest object passed to http-streaming instead of a // source url. // // see https://en.wikipedia.org/wiki/media_type for details on specifying media types. // // in this case, vnd stands for vendor, video.js for the organization, vhs for this // project, and the +json suffix identifies the structure of the media type. if (type === 'application/vnd.videojs.vhs+json') { return 'vhs-json'; } return null; }; /***/ }), /***/ 22: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _typeof; }); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof symbol && "symbol" == typeof symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof symbol && o.constructor === symbol && o !== symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } /***/ }), /***/ 254: /***/ (function(module, exports, __webpack_require__) { var conventions = __webpack_require__(125); var find = conventions.find; var namespace = conventions.namespace; /** * a prerequisite for `[].filter`, to drop elements that are empty * @param {string} input * @returns {boolean} */ function notemptystring (input) { return input !== '' } /** * @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace * @see https://infra.spec.whatwg.org/#ascii-whitespace * * @param {string} input * @returns {string[]} (can be empty) */ function splitonasciiwhitespace(input) { // u+0009 tab, u+000a lf, u+000c ff, u+000d cr, u+0020 space return input ? input.split(/[\t\n\f\r ]+/).filter(notemptystring) : [] } /** * adds element as a key to current if it is not already present. * * @param {record} current * @param {string} element * @returns {record} */ function orderedsetreducer (current, element) { if (!current.hasownproperty(element)) { current[element] = true; } return current; } /** * @see https://infra.spec.whatwg.org/#ordered-set * @param {string} input * @returns {string[]} */ function toorderedset(input) { if (!input) return []; var list = splitonasciiwhitespace(input); return object.keys(list.reduce(orderedsetreducer, {})) } /** * uses `list.indexof` to implement something like `array.prototype.includes`, * which we can not rely on being available. * * @param {any[]} list * @returns {function(any): boolean} */ function arrayincludes (list) { return function(element) { return list && list.indexof(element) !== -1; } } function copy(src,dest){ for(var p in src){ if (object.prototype.hasownproperty.call(src, p)) { dest[p] = src[p]; } } } /** ^\w+\.prototype\.([_\w]+)\s*=\s*((?:.*\{\s*?[\r\n][\s\s]*?^})|\s.*?(?=[;\r\n]));? ^\w+\.prototype\.([_\w]+)\s*=\s*(\s.*?(?=[;\r\n]));? */ function _extends(class,super){ var pt = class.prototype; if(!(pt instanceof super)){ function t(){}; t.prototype = super.prototype; t = new t(); copy(pt,t); class.prototype = pt = t; } if(pt.constructor != class){ if(typeof class != 'function'){ console.error("unknown class:"+class) } pt.constructor = class } } // node types var nodetype = {} var element_node = nodetype.element_node = 1; var attribute_node = nodetype.attribute_node = 2; var text_node = nodetype.text_node = 3; var cdata_section_node = nodetype.cdata_section_node = 4; var entity_reference_node = nodetype.entity_reference_node = 5; var entity_node = nodetype.entity_node = 6; var processing_instruction_node = nodetype.processing_instruction_node = 7; var comment_node = nodetype.comment_node = 8; var document_node = nodetype.document_node = 9; var document_type_node = nodetype.document_type_node = 10; var document_fragment_node = nodetype.document_fragment_node = 11; var notation_node = nodetype.notation_node = 12; // exceptioncode var exceptioncode = {} var exceptionmessage = {}; var index_size_err = exceptioncode.index_size_err = ((exceptionmessage[1]="index size error"),1); var domstring_size_err = exceptioncode.domstring_size_err = ((exceptionmessage[2]="domstring size error"),2); var hierarchy_request_err = exceptioncode.hierarchy_request_err = ((exceptionmessage[3]="hierarchy request error"),3); var wrong_document_err = exceptioncode.wrong_document_err = ((exceptionmessage[4]="wrong document"),4); var invalid_character_err = exceptioncode.invalid_character_err = ((exceptionmessage[5]="invalid character"),5); var no_data_allowed_err = exceptioncode.no_data_allowed_err = ((exceptionmessage[6]="no data allowed"),6); var no_modification_allowed_err = exceptioncode.no_modification_allowed_err = ((exceptionmessage[7]="no modification allowed"),7); var not_found_err = exceptioncode.not_found_err = ((exceptionmessage[8]="not found"),8); var not_supported_err = exceptioncode.not_supported_err = ((exceptionmessage[9]="not supported"),9); var inuse_attribute_err = exceptioncode.inuse_attribute_err = ((exceptionmessage[10]="attribute in use"),10); //level2 var invalid_state_err = exceptioncode.invalid_state_err = ((exceptionmessage[11]="invalid state"),11); var syntax_err = exceptioncode.syntax_err = ((exceptionmessage[12]="syntax error"),12); var invalid_modification_err = exceptioncode.invalid_modification_err = ((exceptionmessage[13]="invalid modification"),13); var namespace_err = exceptioncode.namespace_err = ((exceptionmessage[14]="invalid namespace"),14); var invalid_access_err = exceptioncode.invalid_access_err = ((exceptionmessage[15]="invalid access"),15); /** * dom level 2 * object domexception * @see http://www.w3.org/tr/2000/rec-dom-level-2-core-20001113/ecma-script-binding.html * @see http://www.w3.org/tr/rec-dom-level-1/ecma-script-language-binding.html */ function domexception(code, message) { if(message instanceof error){ var error = message; }else{ error = this; error.call(this, exceptionmessage[code]); this.message = exceptionmessage[code]; if(error.capturestacktrace) error.capturestacktrace(this, domexception); } error.code = code; if(message) this.message = this.message + ": " + message; return error; }; domexception.prototype = error.prototype; copy(exceptioncode,domexception) /** * @see http://www.w3.org/tr/2000/rec-dom-level-2-core-20001113/core.html#id-536297177 * 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. * the items in the nodelist are accessible via an integral index, starting from 0. */ function nodelist() { }; nodelist.prototype = { /** * the number of nodes in the list. the range of valid child node indices is 0 to length-1 inclusive. * @standard level1 */ length:0, /** * 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. * @standard level1 * @param index unsigned long * index into the collection. * @return node * the node at the indexth position in the nodelist, or null if that is not a valid index. */ item: function(index) { return index >= 0 && index < this.length ? this[index] : null; }, tostring:function(ishtml,nodefilter){ for(var buf = [], i = 0;i=0){ var lastindex = list.length-1 while(i0 || key == 'xmlns'){ // return null; // } //console.log() var i = this.length; while(i--){ var attr = this[i]; //console.log(attr.nodename,key) if(attr.nodename == key){ return attr; } } }, setnameditem: function(attr) { var el = attr.ownerelement; if(el && el!=this._ownerelement){ throw new domexception(inuse_attribute_err); } var oldattr = this.getnameditem(attr.nodename); _addnamednode(this._ownerelement,this,attr,oldattr); return oldattr; }, /* returns node */ setnameditemns: function(attr) {// raises: wrong_document_err,no_modification_allowed_err,inuse_attribute_err var el = attr.ownerelement, oldattr; if(el && el!=this._ownerelement){ throw new domexception(inuse_attribute_err); } oldattr = this.getnameditemns(attr.namespaceuri,attr.localname); _addnamednode(this._ownerelement,this,attr,oldattr); return oldattr; }, /* returns node */ removenameditem: function(key) { var attr = this.getnameditem(key); _removenamednode(this._ownerelement,this,attr); return attr; },// raises: not_found_err,no_modification_allowed_err //for level2 removenameditemns:function(namespaceuri,localname){ var attr = this.getnameditemns(namespaceuri,localname); _removenamednode(this._ownerelement,this,attr); return attr; }, getnameditemns: function(namespaceuri, localname) { var i = this.length; while(i--){ var node = this[i]; if(node.localname == localname && node.namespaceuri == namespaceuri){ return node; } } return null; } }; /** * the domimplementation interface represents an object providing methods * which are not dependent on any particular document. * such an object is returned by the `document.implementation` property. * * __the individual methods describe the differences compared to the specs.__ * * @constructor * * @see https://developer.mozilla.org/en-us/docs/web/api/domimplementation mdn * @see https://www.w3.org/tr/rec-dom-level-1/level-one-core.html#id-102161490 dom level 1 core (initial) * @see https://www.w3.org/tr/dom-level-2-core/core.html#id-102161490 dom level 2 core * @see https://www.w3.org/tr/dom-level-3-core/core.html#id-102161490 dom level 3 core * @see https://dom.spec.whatwg.org/#domimplementation dom living standard */ function domimplementation() { } domimplementation.prototype = { /** * the domimplementation.hasfeature() method returns a boolean flag indicating if a given feature is supported. * the different implementations fairly diverged in what kind of features were reported. * the latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use. * * @deprecated it is deprecated and modern browsers return true in all cases. * * @param {string} feature * @param {string} [version] * @returns {boolean} always true * * @see https://developer.mozilla.org/en-us/docs/web/api/domimplementation/hasfeature mdn * @see https://www.w3.org/tr/rec-dom-level-1/level-one-core.html#id-5ced94d7 dom level 1 core * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature dom living standard */ hasfeature: function(feature, version) { return true; }, /** * creates an xml document object of the specified type with its document element. * * __it behaves slightly different from the description in the living standard__: * - there is no interface/class `xmldocument`, it returns a `document` instance. * - `contenttype`, `encoding`, `mode`, `origin`, `url` fields are currently not declared. * - this implementation is not validating names or qualified names * (when parsing xml strings, the sax parser takes care of that) * * @param {string|null} namespaceuri * @param {string} qualifiedname * @param {documenttype=null} doctype * @returns {document} * * @see https://developer.mozilla.org/en-us/docs/web/api/domimplementation/createdocument mdn * @see https://www.w3.org/tr/dom-level-2-core/core.html#level-2-core-dom-createdocument dom level 2 core (initial) * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument dom level 2 core * * @see https://dom.spec.whatwg.org/#validate-and-extract dom: validate and extract * @see https://www.w3.org/tr/xml/#nt-namestartchar xml spec: names * @see https://www.w3.org/tr/xml-names/#ns-qualnames xml namespaces: qualified names */ createdocument: function(namespaceuri, qualifiedname, doctype){ var doc = new document(); doc.implementation = this; doc.childnodes = new nodelist(); doc.doctype = doctype || null; if (doctype){ doc.appendchild(doctype); } if (qualifiedname){ var root = doc.createelementns(namespaceuri, qualifiedname); doc.appendchild(root); } return doc; }, /** * returns a doctype, with the given `qualifiedname`, `publicid`, and `systemid`. * * __this behavior is slightly different from the in the specs__: * - this implementation is not validating names or qualified names * (when parsing xml strings, the sax parser takes care of that) * * @param {string} qualifiedname * @param {string} [publicid] * @param {string} [systemid] * @returns {documenttype} which can either be used with `domimplementation.createdocument` upon document creation * or can be put into the document via methods like `node.insertbefore()` or `node.replacechild()` * * @see https://developer.mozilla.org/en-us/docs/web/api/domimplementation/createdocumenttype mdn * @see https://www.w3.org/tr/dom-level-2-core/core.html#level-2-core-dom-createdoctype dom level 2 core * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype dom living standard * * @see https://dom.spec.whatwg.org/#validate-and-extract dom: validate and extract * @see https://www.w3.org/tr/xml/#nt-namestartchar xml spec: names * @see https://www.w3.org/tr/xml-names/#ns-qualnames xml namespaces: qualified names */ createdocumenttype: function(qualifiedname, publicid, systemid){ var node = new documenttype(); node.name = qualifiedname; node.nodename = qualifiedname; node.publicid = publicid || ''; node.systemid = systemid || ''; return node; } }; /** * @see http://www.w3.org/tr/2000/rec-dom-level-2-core-20001113/core.html#id-1950641247 */ function node() { }; node.prototype = { firstchild : null, lastchild : null, previoussibling : null, nextsibling : null, attributes : null, parentnode : null, childnodes : null, ownerdocument : null, nodevalue : null, namespaceuri : null, prefix : null, localname : null, // modified in dom level 2: insertbefore:function(newchild, refchild){//raises return _insertbefore(this,newchild,refchild); }, replacechild:function(newchild, oldchild){//raises _insertbefore(this, newchild,oldchild, assertprereplacementvalidityindocument); if(oldchild){ this.removechild(oldchild); } }, removechild:function(oldchild){ return _removechild(this,oldchild); }, appendchild:function(newchild){ return this.insertbefore(newchild,null); }, haschildnodes:function(){ return this.firstchild != null; }, clonenode:function(deep){ return clonenode(this.ownerdocument||this,this,deep); }, // modified in dom level 2: normalize:function(){ var child = this.firstchild; while(child){ var next = child.nextsibling; if(next && next.nodetype == text_node && child.nodetype == text_node){ this.removechild(next); child.appenddata(next.data); }else{ child.normalize(); child = next; } } }, // introduced in dom level 2: issupported:function(feature, version){ return this.ownerdocument.implementation.hasfeature(feature,version); }, // introduced in dom level 2: hasattributes:function(){ return this.attributes.length>0; }, /** * look up the prefix associated to the given namespace uri, starting from this node. * **the default namespace declarations are ignored by this method.** * see namespace prefix lookup for details on the algorithm used by this method. * * _note: the implementation seems to be incomplete when compared to the algorithm described in the specs._ * * @param {string | null} namespaceuri * @returns {string | null} * @see https://www.w3.org/tr/dom-level-3-core/core.html#node3-lookupnamespaceprefix * @see https://www.w3.org/tr/dom-level-3-core/namespaces-algorithms.html#lookupnamespaceprefixalgo * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix * @see https://github.com/xmldom/xmldom/issues/322 */ lookupprefix:function(namespaceuri){ var el = this; while(el){ var map = el._nsmap; //console.dir(map) if(map){ for(var n in map){ if (object.prototype.hasownproperty.call(map, n) && map[n] === namespaceuri) { return n; } } } el = el.nodetype == attribute_node?el.ownerdocument : el.parentnode; } return null; }, // introduced in dom level 3: lookupnamespaceuri:function(prefix){ var el = this; while(el){ var map = el._nsmap; //console.dir(map) if(map){ if(object.prototype.hasownproperty.call(map, prefix)){ return map[prefix] ; } } el = el.nodetype == attribute_node?el.ownerdocument : el.parentnode; } return null; }, // introduced in dom level 3: isdefaultnamespace:function(namespaceuri){ var prefix = this.lookupprefix(namespaceuri); return prefix == null; } }; function _xmlencoder(c){ return c == '<' && '<' || c == '>' && '>' || c == '&' && '&' || c == '"' && '"' || '&#'+c.charcodeat()+';' } copy(nodetype,node); copy(nodetype,node.prototype); /** * @param callback return true for continue,false for break * @return boolean true: break visit; */ function _visitnode(node,callback){ if(callback(node)){ return true; } if(node = node.firstchild){ do{ if(_visitnode(node,callback)){return true} }while(node=node.nextsibling) } } function document(){ this.ownerdocument = this; } function _onaddattribute(doc,el,newattr){ doc && doc._inc++; var ns = newattr.namespaceuri ; if(ns === namespace.xmlns){ //update namespace el._nsmap[newattr.prefix?newattr.localname:''] = newattr.value } } function _onremoveattribute(doc,el,newattr,remove){ doc && doc._inc++; var ns = newattr.namespaceuri ; if(ns === namespace.xmlns){ //update namespace delete el._nsmap[newattr.prefix?newattr.localname:''] } } /** * updates `el.childnodes`, updating the indexed items and it's `length`. * passing `newchild` means it will be appended. * otherwise it's assumed that an item has been removed, * and `el.firstnode` and it's `.nextsibling` are used * to walk the current list of child nodes. * * @param {document} doc * @param {node} el * @param {node} [newchild] * @private */ function _onupdatechild (doc, el, newchild) { if(doc && doc._inc){ doc._inc++; //update childnodes var cs = el.childnodes; if (newchild) { cs[cs.length++] = newchild; } else { var child = el.firstchild; var i = 0; while (child) { cs[i++] = child; child = child.nextsibling; } cs.length = i; delete cs[cs.length]; } } } /** * removes the connections between `parentnode` and `child` * and any existing `child.previoussibling` or `child.nextsibling`. * * @see https://github.com/xmldom/xmldom/issues/135 * @see https://github.com/xmldom/xmldom/issues/145 * * @param {node} parentnode * @param {node} child * @returns {node} the child that was removed. * @private */ function _removechild (parentnode, child) { var previous = child.previoussibling; var next = child.nextsibling; if (previous) { previous.nextsibling = next; } else { parentnode.firstchild = next; } if (next) { next.previoussibling = previous; } else { parentnode.lastchild = previous; } child.parentnode = null; child.previoussibling = null; child.nextsibling = null; _onupdatechild(parentnode.ownerdocument, parentnode); return child; } /** * returns `true` if `node` can be a parent for insertion. * @param {node} node * @returns {boolean} */ function hasvalidparentnodetype(node) { return ( node && (node.nodetype === node.document_node || node.nodetype === node.document_fragment_node || node.nodetype === node.element_node) ); } /** * returns `true` if `node` can be inserted according to it's `nodetype`. * @param {node} node * @returns {boolean} */ function hasinsertablenodetype(node) { return ( node && (iselementnode(node) || istextnode(node) || isdoctypenode(node) || node.nodetype === node.document_fragment_node || node.nodetype === node.comment_node || node.nodetype === node.processing_instruction_node) ); } /** * returns true if `node` is a doctype node * @param {node} node * @returns {boolean} */ function isdoctypenode(node) { return node && node.nodetype === node.document_type_node; } /** * returns true if the node is an element * @param {node} node * @returns {boolean} */ function iselementnode(node) { return node && node.nodetype === node.element_node; } /** * returns true if `node` is a text node * @param {node} node * @returns {boolean} */ function istextnode(node) { return node && node.nodetype === node.text_node; } /** * check if en element node can be inserted before `child`, or at the end if child is falsy, * according to the presence and position of a doctype node on the same level. * * @param {document} doc the document node * @param {node} child the node that would become the nextsibling if the element would be inserted * @returns {boolean} `true` if an element can be inserted before child * @private * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity */ function iselementinsertionpossible(doc, child) { var parentchildnodes = doc.childnodes || []; if (find(parentchildnodes, iselementnode) || isdoctypenode(child)) { return false; } var doctypenode = find(parentchildnodes, isdoctypenode); return !(child && doctypenode && parentchildnodes.indexof(doctypenode) > parentchildnodes.indexof(child)); } /** * check if en element node can be inserted before `child`, or at the end if child is falsy, * according to the presence and position of a doctype node on the same level. * * @param {node} doc the document node * @param {node} child the node that would become the nextsibling if the element would be inserted * @returns {boolean} `true` if an element can be inserted before child * @private * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity */ function iselementreplacementpossible(doc, child) { var parentchildnodes = doc.childnodes || []; function haselementchildthatisnotchild(node) { return iselementnode(node) && node !== child; } if (find(parentchildnodes, haselementchildthatisnotchild)) { return false; } var doctypenode = find(parentchildnodes, isdoctypenode); return !(child && doctypenode && parentchildnodes.indexof(doctypenode) > parentchildnodes.indexof(child)); } /** * @private * steps 1-5 of the checks before inserting and before replacing a child are the same. * * @param {node} parent the parent node to insert `node` into * @param {node} node the node to insert * @param {node=} child the node that should become the `nextsibling` of `node` * @returns {node} * @throws domexception for several node combinations that would create a dom that is not well-formed. * @throws domexception if `child` is provided but is not a child of `parent`. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity * @see https://dom.spec.whatwg.org/#concept-node-replace */ function assertpreinsertionvalidity1to5(parent, node, child) { // 1. if `parent` is not a document, documentfragment, or element node, then throw a "hierarchyrequesterror" domexception. if (!hasvalidparentnodetype(parent)) { throw new domexception(hierarchy_request_err, 'unexpected parent node type ' + parent.nodetype); } // 2. if `node` is a host-including inclusive ancestor of `parent`, then throw a "hierarchyrequesterror" domexception. // not implemented! // 3. if `child` is non-null and its parent is not `parent`, then throw a "notfounderror" domexception. if (child && child.parentnode !== parent) { throw new domexception(not_found_err, 'child not in parent'); } if ( // 4. if `node` is not a documentfragment, documenttype, element, or characterdata node, then throw a "hierarchyrequesterror" domexception. !hasinsertablenodetype(node) || // 5. if either `node` is a text node and `parent` is a document, // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0 // || (node.nodetype === node.text_node && parent.nodetype === node.document_node) // or `node` is a doctype and `parent` is not a document, then throw a "hierarchyrequesterror" domexception. (isdoctypenode(node) && parent.nodetype !== node.document_node) ) { throw new domexception( hierarchy_request_err, 'unexpected node type ' + node.nodetype + ' for parent node type ' + parent.nodetype ); } } /** * @private * step 6 of the checks before inserting and before replacing a child are different. * * @param {document} parent the parent node to insert `node` into * @param {node} node the node to insert * @param {node | undefined} child the node that should become the `nextsibling` of `node` * @returns {node} * @throws domexception for several node combinations that would create a dom that is not well-formed. * @throws domexception if `child` is provided but is not a child of `parent`. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity * @see https://dom.spec.whatwg.org/#concept-node-replace */ function assertpreinsertionvalidityindocument(parent, node, child) { var parentchildnodes = parent.childnodes || []; var nodechildnodes = node.childnodes || []; // documentfragment if (node.nodetype === node.document_fragment_node) { var nodechildelements = nodechildnodes.filter(iselementnode); // if node has more than one element child or has a text node child. if (nodechildelements.length > 1 || find(nodechildnodes, istextnode)) { throw new domexception(hierarchy_request_err, 'more than one element or text in fragment'); } // otherwise, if `node` has one element child and either `parent` has an element child, // `child` is a doctype, or `child` is non-null and a doctype is following `child`. if (nodechildelements.length === 1 && !iselementinsertionpossible(parent, child)) { throw new domexception(hierarchy_request_err, 'element in fragment can not be inserted before doctype'); } } // element if (iselementnode(node)) { // `parent` has an element child, `child` is a doctype, // or `child` is non-null and a doctype is following `child`. if (!iselementinsertionpossible(parent, child)) { throw new domexception(hierarchy_request_err, 'only one element can be added and only after doctype'); } } // documenttype if (isdoctypenode(node)) { // `parent` has a doctype child, if (find(parentchildnodes, isdoctypenode)) { throw new domexception(hierarchy_request_err, 'only one doctype is allowed'); } var parentelementchild = find(parentchildnodes, iselementnode); // `child` is non-null and an element is preceding `child`, if (child && parentchildnodes.indexof(parentelementchild) < parentchildnodes.indexof(child)) { throw new domexception(hierarchy_request_err, 'doctype can only be inserted before an element'); } // or `child` is null and `parent` has an element child. if (!child && parentelementchild) { throw new domexception(hierarchy_request_err, 'doctype can not be appended since element is present'); } } } /** * @private * step 6 of the checks before inserting and before replacing a child are different. * * @param {document} parent the parent node to insert `node` into * @param {node} node the node to insert * @param {node | undefined} child the node that should become the `nextsibling` of `node` * @returns {node} * @throws domexception for several node combinations that would create a dom that is not well-formed. * @throws domexception if `child` is provided but is not a child of `parent`. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity * @see https://dom.spec.whatwg.org/#concept-node-replace */ function assertprereplacementvalidityindocument(parent, node, child) { var parentchildnodes = parent.childnodes || []; var nodechildnodes = node.childnodes || []; // documentfragment if (node.nodetype === node.document_fragment_node) { var nodechildelements = nodechildnodes.filter(iselementnode); // if `node` has more than one element child or has a text node child. if (nodechildelements.length > 1 || find(nodechildnodes, istextnode)) { throw new domexception(hierarchy_request_err, 'more than one element or text in fragment'); } // otherwise, if `node` has one element child and either `parent` has an element child that is not `child` or a doctype is following `child`. if (nodechildelements.length === 1 && !iselementreplacementpossible(parent, child)) { throw new domexception(hierarchy_request_err, 'element in fragment can not be inserted before doctype'); } } // element if (iselementnode(node)) { // `parent` has an element child that is not `child` or a doctype is following `child`. if (!iselementreplacementpossible(parent, child)) { throw new domexception(hierarchy_request_err, 'only one element can be added and only after doctype'); } } // documenttype if (isdoctypenode(node)) { function hasdoctypechildthatisnotchild(node) { return isdoctypenode(node) && node !== child; } // `parent` has a doctype child that is not `child`, if (find(parentchildnodes, hasdoctypechildthatisnotchild)) { throw new domexception(hierarchy_request_err, 'only one doctype is allowed'); } var parentelementchild = find(parentchildnodes, iselementnode); // or an element is preceding `child`. if (child && parentchildnodes.indexof(parentelementchild) < parentchildnodes.indexof(child)) { throw new domexception(hierarchy_request_err, 'doctype can only be inserted before an element'); } } } /** * @private * @param {node} parent the parent node to insert `node` into * @param {node} node the node to insert * @param {node=} child the node that should become the `nextsibling` of `node` * @returns {node} * @throws domexception for several node combinations that would create a dom that is not well-formed. * @throws domexception if `child` is provided but is not a child of `parent`. * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity */ function _insertbefore(parent, node, child, _indocumentassertion) { // to ensure pre-insertion validity of a node into a parent before a child, run these steps: assertpreinsertionvalidity1to5(parent, node, child); // if parent is a document, and any of the statements below, switched on the interface node implements, // are true, then throw a "hierarchyrequesterror" domexception. if (parent.nodetype === node.document_node) { (_indocumentassertion || assertpreinsertionvalidityindocument)(parent, node, child); } var cp = node.parentnode; if(cp){ cp.removechild(node);//remove and update } if(node.nodetype === document_fragment_node){ var newfirst = node.firstchild; if (newfirst == null) { return node; } var newlast = node.lastchild; }else{ newfirst = newlast = node; } var pre = child ? child.previoussibling : parent.lastchild; newfirst.previoussibling = pre; newlast.nextsibling = child; if(pre){ pre.nextsibling = newfirst; }else{ parent.firstchild = newfirst; } if(child == null){ parent.lastchild = newlast; }else{ child.previoussibling = newlast; } do{ newfirst.parentnode = parent; }while(newfirst !== newlast && (newfirst= newfirst.nextsibling)) _onupdatechild(parent.ownerdocument||parent, parent); //console.log(parent.lastchild.nextsibling == null) if (node.nodetype == document_fragment_node) { node.firstchild = node.lastchild = null; } return node; } /** * appends `newchild` to `parentnode`. * if `newchild` is already connected to a `parentnode` it is first removed from it. * * @see https://github.com/xmldom/xmldom/issues/135 * @see https://github.com/xmldom/xmldom/issues/145 * @param {node} parentnode * @param {node} newchild * @returns {node} * @private */ function _appendsinglechild (parentnode, newchild) { if (newchild.parentnode) { newchild.parentnode.removechild(newchild); } newchild.parentnode = parentnode; newchild.previoussibling = parentnode.lastchild; newchild.nextsibling = null; if (newchild.previoussibling) { newchild.previoussibling.nextsibling = newchild; } else { parentnode.firstchild = newchild; } parentnode.lastchild = newchild; _onupdatechild(parentnode.ownerdocument, parentnode, newchild); return newchild; } document.prototype = { //implementation : null, nodename : '#document', nodetype : document_node, /** * the documenttype node of the document. * * @readonly * @type documenttype */ doctype : null, documentelement : null, _inc : 1, insertbefore : function(newchild, refchild){//raises if(newchild.nodetype == document_fragment_node){ var child = newchild.firstchild; while(child){ var next = child.nextsibling; this.insertbefore(child,refchild); child = next; } return newchild; } _insertbefore(this, newchild, refchild); newchild.ownerdocument = this; if (this.documentelement === null && newchild.nodetype === element_node) { this.documentelement = newchild; } return newchild; }, removechild : function(oldchild){ if(this.documentelement == oldchild){ this.documentelement = null; } return _removechild(this,oldchild); }, replacechild: function (newchild, oldchild) { //raises _insertbefore(this, newchild, oldchild, assertprereplacementvalidityindocument); newchild.ownerdocument = this; if (oldchild) { this.removechild(oldchild); } if (iselementnode(newchild)) { this.documentelement = newchild; } }, // introduced in dom level 2: importnode : function(importednode,deep){ return importnode(this,importednode,deep); }, // introduced in dom level 2: getelementbyid : function(id){ var rtv = null; _visitnode(this.documentelement,function(node){ if(node.nodetype == element_node){ if(node.getattribute('id') == id){ rtv = node; return true; } } }) return rtv; }, /** * the `getelementsbyclassname` method of `document` interface returns an array-like object * of all child elements which have **all** of the given class name(s). * * returns an empty list if `classenames` is an empty string or only contains html white space characters. * * * warning: this is a live livenodelist. * changes in the dom will reflect in the array as the changes occur. * if an element selected by this array no longer qualifies for the selector, * it will automatically be removed. be aware of this for iteration purposes. * * @param {string} classnames is a string representing the class name(s) to match; multiple class names are separated by (ascii-)whitespace * * @see https://developer.mozilla.org/en-us/docs/web/api/document/getelementsbyclassname * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname */ getelementsbyclassname: function(classnames) { var classnamesset = toorderedset(classnames) return new livenodelist(this, function(base) { var ls = []; if (classnamesset.length > 0) { _visitnode(base.documentelement, function(node) { if(node !== base && node.nodetype === element_node) { var nodeclassnames = node.getattribute('class') // can be null if the attribute does not exist if (nodeclassnames) { // before splitting and iterating just compare them for the most common case var matches = classnames === nodeclassnames; if (!matches) { var nodeclassnamesset = toorderedset(nodeclassnames) matches = classnamesset.every(arrayincludes(nodeclassnamesset)) } if(matches) { ls.push(node); } } } }); } return ls; }); }, //document factory method: createelement : function(tagname){ var node = new element(); node.ownerdocument = this; node.nodename = tagname; node.tagname = tagname; node.localname = tagname; node.childnodes = new nodelist(); var attrs = node.attributes = new namednodemap(); attrs._ownerelement = node; return node; }, createdocumentfragment : function(){ var node = new documentfragment(); node.ownerdocument = this; node.childnodes = new nodelist(); return node; }, createtextnode : function(data){ var node = new text(); node.ownerdocument = this; node.appenddata(data) return node; }, createcomment : function(data){ var node = new comment(); node.ownerdocument = this; node.appenddata(data) return node; }, createcdatasection : function(data){ var node = new cdatasection(); node.ownerdocument = this; node.appenddata(data) return node; }, createprocessinginstruction : function(target,data){ var node = new processinginstruction(); node.ownerdocument = this; node.tagname = node.nodename = node.target = target; node.nodevalue = node.data = data; return node; }, createattribute : function(name){ var node = new attr(); node.ownerdocument = this; node.name = name; node.nodename = name; node.localname = name; node.specified = true; return node; }, createentityreference : function(name){ var node = new entityreference(); node.ownerdocument = this; node.nodename = name; return node; }, // introduced in dom level 2: createelementns : function(namespaceuri,qualifiedname){ var node = new element(); var pl = qualifiedname.split(':'); var attrs = node.attributes = new namednodemap(); node.childnodes = new nodelist(); node.ownerdocument = this; node.nodename = qualifiedname; node.tagname = qualifiedname; node.namespaceuri = namespaceuri; if(pl.length == 2){ node.prefix = pl[0]; node.localname = pl[1]; }else{ //el.prefix = null; node.localname = qualifiedname; } attrs._ownerelement = node; return node; }, // introduced in dom level 2: createattributens : function(namespaceuri,qualifiedname){ var node = new attr(); var pl = qualifiedname.split(':'); node.ownerdocument = this; node.nodename = qualifiedname; node.name = qualifiedname; node.namespaceuri = namespaceuri; node.specified = true; if(pl.length == 2){ node.prefix = pl[0]; node.localname = pl[1]; }else{ //el.prefix = null; node.localname = qualifiedname; } return node; } }; _extends(document,node); function element() { this._nsmap = {}; }; element.prototype = { nodetype : element_node, hasattribute : function(name){ return this.getattributenode(name)!=null; }, getattribute : function(name){ var attr = this.getattributenode(name); return attr && attr.value || ''; }, getattributenode : function(name){ return this.attributes.getnameditem(name); }, setattribute : function(name, value){ var attr = this.ownerdocument.createattribute(name); attr.value = attr.nodevalue = "" + value; this.setattributenode(attr) }, removeattribute : function(name){ var attr = this.getattributenode(name) attr && this.removeattributenode(attr); }, //four real opeartion method appendchild:function(newchild){ if(newchild.nodetype === document_fragment_node){ return this.insertbefore(newchild,null); }else{ return _appendsinglechild(this,newchild); } }, setattributenode : function(newattr){ return this.attributes.setnameditem(newattr); }, setattributenodens : function(newattr){ return this.attributes.setnameditemns(newattr); }, removeattributenode : function(oldattr){ //console.log(this == oldattr.ownerelement) return this.attributes.removenameditem(oldattr.nodename); }, //get real attribute name,and remove it by removeattributenode removeattributens : function(namespaceuri, localname){ var old = this.getattributenodens(namespaceuri, localname); old && this.removeattributenode(old); }, hasattributens : function(namespaceuri, localname){ return this.getattributenodens(namespaceuri, localname)!=null; }, getattributens : function(namespaceuri, localname){ var attr = this.getattributenodens(namespaceuri, localname); return attr && attr.value || ''; }, setattributens : function(namespaceuri, qualifiedname, value){ var attr = this.ownerdocument.createattributens(namespaceuri, qualifiedname); attr.value = attr.nodevalue = "" + value; this.setattributenode(attr) }, getattributenodens : function(namespaceuri, localname){ return this.attributes.getnameditemns(namespaceuri, localname); }, getelementsbytagname : function(tagname){ return new livenodelist(this,function(base){ var ls = []; _visitnode(base,function(node){ if(node !== base && node.nodetype == element_node && (tagname === '*' || node.tagname == tagname)){ ls.push(node); } }); return ls; }); }, getelementsbytagnamens : function(namespaceuri, localname){ return new livenodelist(this,function(base){ var ls = []; _visitnode(base,function(node){ if(node !== base && node.nodetype === element_node && (namespaceuri === '*' || node.namespaceuri === namespaceuri) && (localname === '*' || node.localname == localname)){ ls.push(node); } }); return ls; }); } }; document.prototype.getelementsbytagname = element.prototype.getelementsbytagname; document.prototype.getelementsbytagnamens = element.prototype.getelementsbytagnamens; _extends(element,node); function attr() { }; attr.prototype.nodetype = attribute_node; _extends(attr,node); function characterdata() { }; characterdata.prototype = { data : '', substringdata : function(offset, count) { return this.data.substring(offset, offset+count); }, appenddata: function(text) { text = this.data+text; this.nodevalue = this.data = text; this.length = text.length; }, insertdata: function(offset,text) { this.replacedata(offset,0,text); }, appendchild:function(newchild){ throw new error(exceptionmessage[hierarchy_request_err]) }, deletedata: function(offset, count) { this.replacedata(offset,count,""); }, replacedata: function(offset, count, text) { var start = this.data.substring(0,offset); var end = this.data.substring(offset+count); text = start + text + end; this.nodevalue = this.data = text; this.length = text.length; } } _extends(characterdata,node); function text() { }; text.prototype = { nodename : "#text", nodetype : text_node, splittext : function(offset) { var text = this.data; var newtext = text.substring(offset); text = text.substring(0, offset); this.data = this.nodevalue = text; this.length = text.length; var newnode = this.ownerdocument.createtextnode(newtext); if(this.parentnode){ this.parentnode.insertbefore(newnode, this.nextsibling); } return newnode; } } _extends(text,characterdata); function comment() { }; comment.prototype = { nodename : "#comment", nodetype : comment_node } _extends(comment,characterdata); function cdatasection() { }; cdatasection.prototype = { nodename : "#cdata-section", nodetype : cdata_section_node } _extends(cdatasection,characterdata); function documenttype() { }; documenttype.prototype.nodetype = document_type_node; _extends(documenttype,node); function notation() { }; notation.prototype.nodetype = notation_node; _extends(notation,node); function entity() { }; entity.prototype.nodetype = entity_node; _extends(entity,node); function entityreference() { }; entityreference.prototype.nodetype = entity_reference_node; _extends(entityreference,node); function documentfragment() { }; documentfragment.prototype.nodename = "#document-fragment"; documentfragment.prototype.nodetype = document_fragment_node; _extends(documentfragment,node); function processinginstruction() { } processinginstruction.prototype.nodetype = processing_instruction_node; _extends(processinginstruction,node); function xmlserializer(){} xmlserializer.prototype.serializetostring = function(node,ishtml,nodefilter){ return nodeserializetostring.call(node,ishtml,nodefilter); } node.prototype.tostring = nodeserializetostring; function nodeserializetostring(ishtml,nodefilter){ var buf = []; var refnode = this.nodetype == 9 && this.documentelement || this; var prefix = refnode.prefix; var uri = refnode.namespaceuri; if(uri && prefix == null){ //console.log(prefix) var prefix = refnode.lookupprefix(uri); if(prefix == null){ //ishtml = true; var visiblenamespaces=[ {namespace:uri,prefix:null} //{namespace:uri,prefix:''} ] } } serializetostring(this,buf,ishtml,nodefilter,visiblenamespaces); //console.log('###',this.nodetype,uri,prefix,buf.join('')) return buf.join(''); } function neednamespacedefine(node, ishtml, visiblenamespaces) { var prefix = node.prefix || ''; var uri = node.namespaceuri; // according to [namespaces in xml 1.0](https://www.w3.org/tr/rec-xml-names/#ns-using) , // and more specifically https://www.w3.org/tr/rec-xml-names/#nsc-noprefixundecl : // > in a namespace declaration for a prefix [...], the attribute value must not be empty. // in a similar manner [namespaces in xml 1.1](https://www.w3.org/tr/xml-names11/#ns-using) // and more specifically https://www.w3.org/tr/xml-names11/#nsc-nsdeclared : // > [...] furthermore, the attribute value [...] must not be an empty string. // so serializing empty namespace value like xmlns:ds="" would produce an invalid xml document. if (!uri) { return false; } if (prefix === "xml" && uri === namespace.xml || uri === namespace.xmlns) { return false; } var i = visiblenamespaces.length while (i--) { var ns = visiblenamespaces[i]; // get namespace prefix if (ns.prefix === prefix) { return ns.namespace !== uri; } } return true; } /** * well-formed constraint: no < in attribute values * > the replacement text of any entity referred to directly or indirectly * > in an attribute value must not contain a <. * @see https://www.w3.org/tr/xml11/#cleanattrvals * @see https://www.w3.org/tr/xml11/#nt-attvalue * * literal whitespace other than space that appear in attribute values * are serialized as their entity references, so they will be preserved. * (in contrast to whitespace literals in the input which are normalized to spaces) * @see https://www.w3.org/tr/xml11/#avnormalize * @see https://w3c.github.io/dom-parsing/#serializing-an-element-s-attributes */ function addserializedattribute(buf, qualifiedname, value) { buf.push(' ', qualifiedname, '="', value.replace(/[<>&"\t\n\r]/g, _xmlencoder), '"') } function serializetostring(node,buf,ishtml,nodefilter,visiblenamespaces){ if (!visiblenamespaces) { visiblenamespaces = []; } if(nodefilter){ node = nodefilter(node); if(node){ if(typeof node == 'string'){ buf.push(node); return; } }else{ return; } //buf.sort.apply(attrs, attributesorter); } switch(node.nodetype){ case element_node: var attrs = node.attributes; var len = attrs.length; var child = node.firstchild; var nodename = node.tagname; ishtml = namespace.ishtml(node.namespaceuri) || ishtml var prefixednodename = nodename if (!ishtml && !node.prefix && node.namespaceuri) { var defaultns // lookup current default ns from `xmlns` attribute for (var ai = 0; ai < attrs.length; ai++) { if (attrs.item(ai).name === 'xmlns') { defaultns = attrs.item(ai).value break } } if (!defaultns) { // lookup current default ns in visiblenamespaces for (var nsi = visiblenamespaces.length - 1; nsi >= 0; nsi--) { var namespace = visiblenamespaces[nsi] if (namespace.prefix === '' && namespace.namespace === node.namespaceuri) { defaultns = namespace.namespace break } } } if (defaultns !== node.namespaceuri) { for (var nsi = visiblenamespaces.length - 1; nsi >= 0; nsi--) { var namespace = visiblenamespaces[nsi] if (namespace.namespace === node.namespaceuri) { if (namespace.prefix) { prefixednodename = namespace.prefix + ':' + nodename } break } } } } buf.push('<', prefixednodename); for(var i=0;i'); //if is cdata child node if(ishtml && /^script$/i.test(nodename)){ while(child){ if(child.data){ buf.push(child.data); }else{ serializetostring(child, buf, ishtml, nodefilter, visiblenamespaces.slice()); } child = child.nextsibling; } }else { while(child){ serializetostring(child, buf, ishtml, nodefilter, visiblenamespaces.slice()); child = child.nextsibling; } } buf.push(''); }else{ buf.push('/>'); } // remove added visible namespaces //visiblenamespaces.length = startvisiblenamespaces; return; case document_node: case document_fragment_node: var child = node.firstchild; while(child){ serializetostring(child, buf, ishtml, nodefilter, visiblenamespaces.slice()); child = child.nextsibling; } return; case attribute_node: return addserializedattribute(buf, node.name, node.value); case text_node: /** * the ampersand character (&) and the left angle bracket (<) must not appear in their literal form, * except when used as markup delimiters, or within a comment, a processing instruction, or a cdata section. * if they are needed elsewhere, they must be escaped using either numeric character references or the strings * `&` and `<` respectively. * the right angle bracket (>) may be represented using the string " > ", and must, for compatibility, * be escaped using either `>` or a character reference when it appears in the string `]]>` in content, * when that string is not marking the end of a cdata section. * * in the content of elements, character data is any string of characters * which does not contain the start-delimiter of any markup * and does not include the cdata-section-close delimiter, `]]>`. * * @see https://www.w3.org/tr/xml/#nt-chardata * @see https://w3c.github.io/dom-parsing/#xml-serializing-a-text-node */ return buf.push(node.data .replace(/[<&>]/g,_xmlencoder) ); case cdata_section_node: return buf.push( ''); case comment_node: return buf.push( ""); case document_type_node: var pubid = node.publicid; var sysid = node.systemid; buf.push(''); }else if(sysid && sysid!='.'){ buf.push(' system ', sysid, '>'); }else{ var sub = node.internalsubset; if(sub){ buf.push(" [",sub,"]"); } buf.push(">"); } return; case processing_instruction_node: return buf.push( ""); case entity_reference_node: return buf.push( '&',node.nodename,';'); //case entity_node: //case notation_node: default: buf.push('??',node.nodename); } } function importnode(doc,node,deep){ var node2; switch (node.nodetype) { case element_node: node2 = node.clonenode(false); node2.ownerdocument = doc; //var attrs = node2.attributes; //var len = attrs.length; //for(var i=0;i= 500 && error.response.status <= 599); } /** * @param {error} error * @return {boolean} */ function issaferequesterror(error) { if (!error.config) { // cannot determine if the request can be retried return false; } return isretryableerror(error) && safe_http_methods.indexof(error.config.method) !== -1; } /** * @param {error} error * @return {boolean} */ function isidempotentrequesterror(error) { if (!error.config) { // cannot determine if the request can be retried return false; } return isretryableerror(error) && idempotent_http_methods.indexof(error.config.method) !== -1; } /** * @param {error} error * @return {boolean} */ function isnetworkoridempotentrequesterror(error) { return isnetworkerror(error) || isidempotentrequesterror(error); } /** * @return {number} - delay in milliseconds, always 0 */ function nodelay() { return 0; } /** * set delayfactor 1000 for an exponential delay to occur on the order * of seconds * @param {number} [retrynumber=0] * @param {error} error - unused; for existing api of retrydelay callback * @param {number} [delayfactor=100] milliseconds * @return {number} - delay in milliseconds */ function exponentialdelay() { var retrynumber = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var error = arguments.length > 1 ? arguments[1] : undefined; var delayfactor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100; var delay = math.pow(2, retrynumber) * delayfactor; var randomsum = delay * 0.2 * math.random(); // 0-20% of the delay return delay + randomsum; } /** * initializes and returns the retry state for the given request/config * @param {axiosrequestconfig} config * @return {object} */ function getcurrentstate(config) { var currentstate = config[namespace] || {}; currentstate.retrycount = currentstate.retrycount || 0; config[namespace] = currentstate; return currentstate; } /** * returns the axios-retry options for the current request * @param {axiosrequestconfig} config * @param {axiosretryconfig} defaultoptions * @return {axiosretryconfig} */ function getrequestoptions(config, defaultoptions) { return _objectspread(_objectspread({}, defaultoptions), config[namespace]); } /** * @param {axios} axios * @param {axiosrequestconfig} config */ function fixconfig(axios, config) { if (axios.defaults.agent === config.agent) { delete config.agent; } if (axios.defaults.httpagent === config.httpagent) { delete config.httpagent; } if (axios.defaults.httpsagent === config.httpsagent) { delete config.httpsagent; } } /** * checks retrycondition if request can be retried. handles it's retruning value or promise. * @param {number} retries * @param {function} retrycondition * @param {object} currentstate * @param {error} error * @return {boolean} */ function shouldretry(_x, _x2, _x3, _x4) { return _shouldretry.apply(this, arguments); } /** * adds response interceptors to an axios instance to retry requests failed due to network issues * * @example * * import axios from 'axios'; * * axiosretry(axios, { retries: 3 }); * * axios.get('http://example.com/test') // the first request fails and the second returns 'ok' * .then(result => { * result.data; // 'ok' * }); * * // exponential back-off retry delay between requests * axiosretry(axios, { retrydelay : axiosretry.exponentialdelay}); * * // custom retry delay * axiosretry(axios, { retrydelay : (retrycount) => { * return retrycount * 1000; * }}); * * // also works with custom axios instances * const client = axios.create({ baseurl: 'http://example.com' }); * axiosretry(client, { retries: 3 }); * * client.get('/test') // the first request fails and the second returns 'ok' * .then(result => { * result.data; // 'ok' * }); * * // allows request-specific configuration * client * .get('/test', { * 'axios-retry': { * retries: 0 * } * }) * .catch(error => { // the first request fails * error !== undefined * }); * * @param {axios} axios an axios instance (the axios object or one created from axios.create) * @param {object} [defaultoptions] * @param {number} [defaultoptions.retries=3] number of retries * @param {boolean} [defaultoptions.shouldresettimeout=false] * defines if the timeout should be reset between retries * @param {function} [defaultoptions.retrycondition=isnetworkoridempotentrequesterror] * a function to determine if the error can be retried * @param {function} [defaultoptions.retrydelay=nodelay] * a function to determine the delay between retry requests * @param {function} [defaultoptions.onretry=()=>{}] * a function to get notified when a retry occurs * @return {{ requestinterceptorid: number, responseinterceptorid: number }} * the ids of the interceptors added to the request and to the response (so they can be ejected at a later time) */ function _shouldretry() { _shouldretry = _asynctogenerator(function* (retries, retrycondition, currentstate, error) { var shouldretryorpromise = currentstate.retrycount < retries && retrycondition(error); // this could be a promise if (typeof shouldretryorpromise === 'object') { try { var shouldretrypromiseresult = yield shouldretryorpromise; // keep return true unless shouldretrypromiseresult return false for compatibility return shouldretrypromiseresult !== false; } catch (_err) { return false; } } return shouldretryorpromise; }); return _shouldretry.apply(this, arguments); } function axiosretry(axios, defaultoptions) { var requestinterceptorid = axios.interceptors.request.use(config => { var currentstate = getcurrentstate(config); currentstate.lastrequesttime = date.now(); return config; }); var responseinterceptorid = axios.interceptors.response.use(null, /*#__pure__*/function () { var _ref = _asynctogenerator(function* (error) { var { config } = error; // if we have no information to retry the request if (!config) { return promise.reject(error); } var { retries = 3, retrycondition = isnetworkoridempotentrequesterror, retrydelay = nodelay, shouldresettimeout = false, onretry = () => {} } = getrequestoptions(config, defaultoptions); var currentstate = getcurrentstate(config); if (yield shouldretry(retries, retrycondition, currentstate, error)) { currentstate.retrycount += 1; var delay = retrydelay(currentstate.retrycount, error); // axios fails merging this configuration to the default configuration because it has an issue // with circular structures: https://github.com/mzabriskie/axios/issues/370 fixconfig(axios, config); if (!shouldresettimeout && config.timeout && currentstate.lastrequesttime) { var lastrequestduration = date.now() - currentstate.lastrequesttime; var timeout = config.timeout - lastrequestduration - delay; if (timeout <= 0) { return promise.reject(error); } config.timeout = timeout; } config.transformrequest = [data => data]; onretry(currentstate.retrycount, error, config); return new promise(resolve => settimeout(() => resolve(axios(config)), delay)); } return promise.reject(error); }); return function (_x5) { return _ref.apply(this, arguments); }; }()); return { requestinterceptorid, responseinterceptorid }; } // compatibility with commonjs axiosretry.isnetworkerror = isnetworkerror; axiosretry.issaferequesterror = issaferequesterror; axiosretry.isidempotentrequesterror = isidempotentrequesterror; axiosretry.isnetworkoridempotentrequesterror = isnetworkoridempotentrequesterror; axiosretry.exponentialdelay = exponentialdelay; axiosretry.isretryableerror = isretryableerror; //# sourcemappingurl=index.js.map /***/ }), /***/ 267: /***/ (function(module, exports, __webpack_require__) { var setprototypeof = __webpack_require__(124); function _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 } }); object.defineproperty(subclass, "prototype", { writable: false }); if (superclass) setprototypeof(subclass, superclass); } module.exports = _inherits, module.exports.__esmodule = true, module.exports["default"] = module.exports; /***/ }), /***/ 269: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return foreachmediagroup; }); /** * loops through all supported media groups in master and calls the provided * callback for each group * * @param {object} master * the parsed master manifest object * @param {string[]} groups * the media groups to call the callback for * @param {function} callback * callback to call for each media group */ var foreachmediagroup = function foreachmediagroup(master, groups, callback) { groups.foreach(function (mediatype) { for (var groupkey in master.mediagroups[mediatype]) { for (var labelkey in master.mediagroups[mediatype][groupkey]) { var mediaproperties = master.mediagroups[mediatype][groupkey][labelkey]; callback(mediaproperties, mediatype, groupkey, labelkey); } } }); }; /***/ }), /***/ 270: /***/ (function(module, exports, __webpack_require__) { var dom = __webpack_require__(254) exports.domimplementation = dom.domimplementation exports.xmlserializer = dom.xmlserializer exports.domparser = __webpack_require__(418).domparser /***/ }), /***/ 272: /***/ (function(module, exports, __webpack_require__) { var getprototypeof = __webpack_require__(422); var setprototypeof = __webpack_require__(124); var isnativefunction = __webpack_require__(423); var construct = __webpack_require__(160); function _wrapnativesuper(class) { var _cache = typeof map === "function" ? new map() : undefined; module.exports = _wrapnativesuper = function _wrapnativesuper(class) { if (class === null || !isnativefunction(class)) return class; if (typeof class !== "function") { throw new typeerror("super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(class)) return _cache.get(class); _cache.set(class, wrapper); } function wrapper() { return construct(class, arguments, getprototypeof(this).constructor); } wrapper.prototype = object.create(class.prototype, { constructor: { value: wrapper, enumerable: false, writable: true, configurable: true } }); return setprototypeof(wrapper, class); }, module.exports.__esmodule = true, module.exports["default"] = module.exports; return _wrapnativesuper(class); } module.exports = _wrapnativesuper, module.exports.__esmodule = true, module.exports["default"] = module.exports; /***/ }), /***/ 30: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // exports __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ _slicedtoarray; }); // external module: ./node_modules/@babel/runtime/helpers/esm/arraywithholes.js var arraywithholes = __webpack_require__(126); // concatenated module: ./node_modules/@babel/runtime/helpers/esm/iterabletoarraylimit.js function _iterabletoarraylimit(r, l) { var t = null == r ? null : "undefined" != typeof symbol && r[symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } // external module: ./node_modules/@babel/runtime/helpers/esm/unsupportediterabletoarray.js var unsupportediterabletoarray = __webpack_require__(80); // external module: ./node_modules/@babel/runtime/helpers/esm/noniterablerest.js var noniterablerest = __webpack_require__(127); // concatenated module: ./node_modules/@babel/runtime/helpers/esm/slicedtoarray.js function _slicedtoarray(arr, i) { return object(arraywithholes["a" /* default */])(arr) || _iterabletoarraylimit(arr, i) || object(unsupportediterabletoarray["a" /* default */])(arr, i) || object(noniterablerest["a" /* default */])(); } /***/ }), /***/ 34: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineproperty; }); /* harmony import */ var _topropertykey_js__webpack_imported_module_0__ = __webpack_require__(131); function _defineproperty(obj, key, value) { key = object(_topropertykey_js__webpack_imported_module_0__[/* default */ "a"])(key); if (key in obj) { object.defineproperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /***/ }), /***/ 35: /***/ (function(module, exports) { function _extends() { module.exports = _extends = object.assign ? object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (object.prototype.hasownproperty.call(source, key)) { target[key] = source[key]; } } } return target; }, module.exports.__esmodule = true, module.exports["default"] = module.exports; return _extends.apply(this, arguments); } module.exports = _extends, module.exports.__esmodule = true, module.exports["default"] = module.exports; /***/ }), /***/ 4: /***/ (function(module, exports, __webpack_require__) { var setprototypeof = __webpack_require__(124); function _inheritsloose(subclass, superclass) { subclass.prototype = object.create(superclass.prototype); subclass.prototype.constructor = subclass; setprototypeof(subclass, superclass); } module.exports = _inheritsloose, module.exports.__esmodule = true, module.exports["default"] = module.exports; /***/ }), /***/ 409: /***/ (function(module, exports, __webpack_require__) { "use strict"; var window = __webpack_require__(0); var httpresponsehandler = function httpresponsehandler(callback, decoderesponsebody) { if (decoderesponsebody === void 0) { decoderesponsebody = false; } return function (err, response, responsebody) { // if the xhr failed, return that error if (err) { callback(err); return; } // if the http status code is 4xx or 5xx, the request also failed if (response.statuscode >= 400 && response.statuscode <= 599) { var cause = responsebody; if (decoderesponsebody) { if (window.textdecoder) { var charset = getcharset(response.headers && response.headers['content-type']); try { cause = new textdecoder(charset).decode(responsebody); } catch (e) {} } else { cause = string.fromcharcode.apply(null, new uint8array(responsebody)); } } callback({ cause: cause }); return; } // otherwise, request succeeded callback(null, responsebody); }; }; function getcharset(contenttypeheader) { if (contenttypeheader === void 0) { contenttypeheader = ''; } return contenttypeheader.tolowercase().split(';').reduce(function (charset, contenttype) { var _contenttype$split = contenttype.split('='), type = _contenttype$split[0], value = _contenttype$split[1]; if (type.trim() === 'charset') { return value.trim(); } return charset; }, 'utf-8'); } module.exports = httpresponsehandler; /***/ }), /***/ 413: /***/ (function(module, exports) { function _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; } } module.exports = _isnativereflectconstruct, module.exports.__esmodule = true, module.exports["default"] = module.exports; /***/ }), /***/ 418: /***/ (function(module, exports, __webpack_require__) { var conventions = __webpack_require__(125); var dom = __webpack_require__(254) var entities = __webpack_require__(419); var sax = __webpack_require__(420); var domimplementation = dom.domimplementation; var namespace = conventions.namespace; var parseerror = sax.parseerror; var xmlreader = sax.xmlreader; /** * normalizes line ending according to https://www.w3.org/tr/xml11/#sec-line-ends: * * > xml parsed entities are often stored in computer files which, * > for editing convenience, are organized into lines. * > these lines are typically separated by some combination * > of the characters carriage return (#xd) and line feed (#xa). * > * > to simplify the tasks of applications, the xml processor must behave * > as if it normalized all line breaks in external parsed entities (including the document entity) * > on input, before parsing, by translating all of the following to a single #xa character: * > * > 1. the two-character sequence #xd #xa * > 2. the two-character sequence #xd #x85 * > 3. the single character #x85 * > 4. the single character #x2028 * > 5. any #xd character that is not immediately followed by #xa or #x85. * * @param {string} input * @returns {string} */ function normalizelineendings(input) { return input .replace(/\r[\n\u0085]/g, '\n') .replace(/[\r\u0085\u2028]/g, '\n') } /** * @typedef locator * @property {number} [columnnumber] * @property {number} [linenumber] */ /** * @typedef domparseroptions * @property {domhandler} [dombuilder] * @property {function} [errorhandler] * @property {(string) => string} [normalizelineendings] used to replace line endings before parsing * defaults to `normalizelineendings` * @property {locator} [locator] * @property {record} [xmlns] * * @see normalizelineendings */ /** * the domparser interface provides the ability to parse xml or html source code * from a string into a dom `document`. * * _xmldom is different from the spec in that it allows an `options` parameter, * to override the default behavior._ * * @param {domparseroptions} [options] * @constructor * * @see https://developer.mozilla.org/en-us/docs/web/api/domparser * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-parsing-and-serialization */ function domparser(options){ this.options = options ||{locator:{}}; } domparser.prototype.parsefromstring = function(source,mimetype){ var options = this.options; var sax = new xmlreader(); var dombuilder = options.dombuilder || new domhandler();//contenthandler and lexicalhandler var errorhandler = options.errorhandler; var locator = options.locator; var defaultnsmap = options.xmlns||{}; var ishtml = /\/x?html?$/.test(mimetype);//mimetype.tolowercase().indexof('html') > -1; var entitymap = ishtml ? entities.html_entities : entities.xml_entities; if(locator){ dombuilder.setdocumentlocator(locator) } sax.errorhandler = builderrorhandler(errorhandler,dombuilder,locator); sax.dombuilder = options.dombuilder || dombuilder; if(ishtml){ defaultnsmap[''] = namespace.html; } defaultnsmap.xml = defaultnsmap.xml || namespace.xml; var normalize = options.normalizelineendings || normalizelineendings; if (source && typeof source === 'string') { sax.parse( normalize(source), defaultnsmap, entitymap ) } else { sax.errorhandler.error('invalid doc source') } return dombuilder.doc; } function builderrorhandler(errorimpl,dombuilder,locator){ if(!errorimpl){ if(dombuilder instanceof domhandler){ return dombuilder; } errorimpl = dombuilder ; } var errorhandler = {} var iscallback = errorimpl instanceof function; locator = locator||{} function build(key){ var fn = errorimpl[key]; if(!fn && iscallback){ fn = errorimpl.length == 2?function(msg){errorimpl(key,msg)}:errorimpl; } errorhandler[key] = fn && function(msg){ fn('[xmldom '+key+']\t'+msg+_locator(locator)); }||function(){}; } build('warning'); build('error'); build('fatalerror'); return errorhandler; } //console.log('#\n\n\n\n\n\n\n####') /** * +contenthandler+errorhandler * +lexicalhandler+entityresolver2 * -declhandler-dtdhandler * * defaulthandler:entityresolver, dtdhandler, contenthandler, errorhandler * defaulthandler2:defaulthandler,lexicalhandler, declhandler, entityresolver2 * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/defaulthandler.html */ function domhandler() { this.cdata = false; } function position(locator,node){ node.linenumber = locator.linenumber; node.columnnumber = locator.columnnumber; } /** * @see org.xml.sax.contenthandler#startdocument * @link http://www.saxproject.org/apidoc/org/xml/sax/contenthandler.html */ domhandler.prototype = { startdocument : function() { this.doc = new domimplementation().createdocument(null, null, null); if (this.locator) { this.doc.documenturi = this.locator.systemid; } }, startelement:function(namespaceuri, localname, qname, attrs) { var doc = this.doc; var el = doc.createelementns(namespaceuri, qname||localname); var len = attrs.length; appendelement(this, el); this.currentelement = el; this.locator && position(this.locator,el) for (var i = 0 ; i < len; i++) { var namespaceuri = attrs.geturi(i); var value = attrs.getvalue(i); var qname = attrs.getqname(i); var attr = doc.createattributens(namespaceuri, qname); this.locator &&position(attrs.getlocator(i),attr); attr.value = attr.nodevalue = value; el.setattributenode(attr) } }, endelement:function(namespaceuri, localname, qname) { var current = this.currentelement var tagname = current.tagname; this.currentelement = current.parentnode; }, startprefixmapping:function(prefix, uri) { }, endprefixmapping:function(prefix) { }, processinginstruction:function(target, data) { var ins = this.doc.createprocessinginstruction(target, data); this.locator && position(this.locator,ins) appendelement(this, ins); }, ignorablewhitespace:function(ch, start, length) { }, characters:function(chars, start, length) { chars = _tostring.apply(this,arguments) //console.log(chars) if(chars){ if (this.cdata) { var charnode = this.doc.createcdatasection(chars); } else { var charnode = this.doc.createtextnode(chars); } if(this.currentelement){ this.currentelement.appendchild(charnode); }else if(/^\s*$/.test(chars)){ this.doc.appendchild(charnode); //process xml } this.locator && position(this.locator,charnode) } }, skippedentity:function(name) { }, enddocument:function() { this.doc.normalize(); }, setdocumentlocator:function (locator) { if(this.locator = locator){// && !('linenumber' in locator)){ locator.linenumber = 0; } }, //lexicalhandler comment:function(chars, start, length) { chars = _tostring.apply(this,arguments) var comm = this.doc.createcomment(chars); this.locator && position(this.locator,comm) appendelement(this, comm); }, startcdata:function() { //used in characters() methods this.cdata = true; }, endcdata:function() { this.cdata = false; }, startdtd:function(name, publicid, systemid) { var impl = this.doc.implementation; if (impl && impl.createdocumenttype) { var dt = impl.createdocumenttype(name, publicid, systemid); this.locator && position(this.locator,dt) appendelement(this, dt); this.doc.doctype = dt; } }, /** * @see org.xml.sax.errorhandler * @link http://www.saxproject.org/apidoc/org/xml/sax/errorhandler.html */ warning:function(error) { console.warn('[xmldom warning]\t'+error,_locator(this.locator)); }, error:function(error) { console.error('[xmldom error]\t'+error,_locator(this.locator)); }, fatalerror:function(error) { throw new parseerror(error, this.locator); } } function _locator(l){ if(l){ return '\n@'+(l.systemid ||'')+'#[line:'+l.linenumber+',col:'+l.columnnumber+']' } } function _tostring(chars,start,length){ if(typeof chars == 'string'){ return chars.substr(start,length) }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof string)") if(chars.length >= start+length || start){ return new java.lang.string(chars,start,length)+''; } return chars; } } /* * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/lexicalhandler.html * used method of org.xml.sax.ext.lexicalhandler: * #comment(chars, start, length) * #startcdata() * #endcdata() * #startdtd(name, publicid, systemid) * * * ignored method of org.xml.sax.ext.lexicalhandler: * #enddtd() * #startentity(name) * #endentity(name) * * * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/declhandler.html * ignored method of org.xml.sax.ext.declhandler * #attributedecl(ename, aname, type, mode, value) * #elementdecl(name, model) * #externalentitydecl(name, publicid, systemid) * #internalentitydecl(name, value) * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/entityresolver2.html * ignored method of org.xml.sax.entityresolver2 * #resolveentity(string name,string publicid,string baseuri,string systemid) * #resolveentity(publicid, systemid) * #getexternalsubset(name, baseuri) * @link http://www.saxproject.org/apidoc/org/xml/sax/dtdhandler.html * ignored method of org.xml.sax.dtdhandler * #notationdecl(name, publicid, systemid) {}; * #unparsedentitydecl(name, publicid, systemid, notationname) {}; */ "enddtd,startentity,endentity,attributedecl,elementdecl,externalentitydecl,internalentitydecl,resolveentity,getexternalsubset,notationdecl,unparsedentitydecl".replace(/\w+/g,function(key){ domhandler.prototype[key] = function(){return null} }) /* 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 */ function appendelement (hander,node) { if (!hander.currentelement) { hander.doc.appendchild(node); } else { hander.currentelement.appendchild(node); } }//appendchild and setattributens are preformance key exports.__domhandler = domhandler; exports.normalizelineendings = normalizelineendings; exports.domparser = domparser; /***/ }), /***/ 419: /***/ (function(module, exports, __webpack_require__) { "use strict"; var freeze = __webpack_require__(125).freeze; /** * the entities that are predefined in every xml document. * * @see https://www.w3.org/tr/2006/rec-xml11-20060816/#sec-predefined-ent w3c xml 1.1 * @see https://www.w3.org/tr/2008/rec-xml-20081126/#sec-predefined-ent w3c xml 1.0 * @see https://en.wikipedia.org/wiki/list_of_xml_and_html_character_entity_references#predefined_entities_in_xml wikipedia */ exports.xml_entities = freeze({ amp: '&', apos: "'", gt: '>', lt: '<', quot: '"', }); /** * a map of all entities that are detected in an html document. * they contain all entries from `xml_entities`. * * @see xml_entities * @see domparser.parsefromstring * @see domimplementation.prototype.createhtmldocument * @see https://html.spec.whatwg.org/#named-character-references whatwg html(5) spec * @see https://html.spec.whatwg.org/entities.json json * @see https://www.w3.org/tr/xml-entity-names/ w3c xml entity names * @see https://www.w3.org/tr/html4/sgml/entities.html w3c html4/sgml * @see https://en.wikipedia.org/wiki/list_of_xml_and_html_character_entity_references#character_entity_references_in_html wikipedia (html) * @see https://en.wikipedia.org/wiki/list_of_xml_and_html_character_entity_references#entities_representing_special_characters_in_xhtml wikpedia (xhtml) */ exports.html_entities = freeze({ aacute: '\u00c1', aacute: '\u00e1', abreve: '\u0102', abreve: '\u0103', ac: '\u223e', acd: '\u223f', ace: '\u223e\u0333', acirc: '\u00c2', acirc: '\u00e2', acute: '\u00b4', acy: '\u0410', acy: '\u0430', aelig: '\u00c6', aelig: '\u00e6', af: '\u2061', afr: '\ud835\udd04', afr: '\ud835\udd1e', agrave: '\u00c0', agrave: '\u00e0', alefsym: '\u2135', aleph: '\u2135', alpha: '\u0391', alpha: '\u03b1', amacr: '\u0100', amacr: '\u0101', amalg: '\u2a3f', amp: '\u0026', amp: '\u0026', and: '\u2a53', and: '\u2227', andand: '\u2a55', andd: '\u2a5c', andslope: '\u2a58', andv: '\u2a5a', ang: '\u2220', ange: '\u29a4', angle: '\u2220', angmsd: '\u2221', angmsdaa: '\u29a8', angmsdab: '\u29a9', angmsdac: '\u29aa', angmsdad: '\u29ab', angmsdae: '\u29ac', angmsdaf: '\u29ad', angmsdag: '\u29ae', angmsdah: '\u29af', angrt: '\u221f', angrtvb: '\u22be', angrtvbd: '\u299d', angsph: '\u2222', angst: '\u00c5', angzarr: '\u237c', aogon: '\u0104', aogon: '\u0105', aopf: '\ud835\udd38', aopf: '\ud835\udd52', ap: '\u2248', apacir: '\u2a6f', ape: '\u2a70', ape: '\u224a', apid: '\u224b', apos: '\u0027', applyfunction: '\u2061', approx: '\u2248', approxeq: '\u224a', aring: '\u00c5', aring: '\u00e5', ascr: '\ud835\udc9c', ascr: '\ud835\udcb6', assign: '\u2254', ast: '\u002a', asymp: '\u2248', asympeq: '\u224d', atilde: '\u00c3', atilde: '\u00e3', auml: '\u00c4', auml: '\u00e4', awconint: '\u2233', awint: '\u2a11', backcong: '\u224c', backepsilon: '\u03f6', backprime: '\u2035', backsim: '\u223d', backsimeq: '\u22cd', backslash: '\u2216', barv: '\u2ae7', barvee: '\u22bd', barwed: '\u2306', barwed: '\u2305', barwedge: '\u2305', bbrk: '\u23b5', bbrktbrk: '\u23b6', bcong: '\u224c', bcy: '\u0411', bcy: '\u0431', bdquo: '\u201e', becaus: '\u2235', because: '\u2235', because: '\u2235', bemptyv: '\u29b0', bepsi: '\u03f6', bernou: '\u212c', bernoullis: '\u212c', beta: '\u0392', beta: '\u03b2', beth: '\u2136', between: '\u226c', bfr: '\ud835\udd05', bfr: '\ud835\udd1f', bigcap: '\u22c2', bigcirc: '\u25ef', bigcup: '\u22c3', bigodot: '\u2a00', bigoplus: '\u2a01', bigotimes: '\u2a02', bigsqcup: '\u2a06', bigstar: '\u2605', bigtriangledown: '\u25bd', bigtriangleup: '\u25b3', biguplus: '\u2a04', bigvee: '\u22c1', bigwedge: '\u22c0', bkarow: '\u290d', blacklozenge: '\u29eb', blacksquare: '\u25aa', blacktriangle: '\u25b4', blacktriangledown: '\u25be', blacktriangleleft: '\u25c2', blacktriangleright: '\u25b8', blank: '\u2423', blk12: '\u2592', blk14: '\u2591', blk34: '\u2593', block: '\u2588', bne: '\u003d\u20e5', bnequiv: '\u2261\u20e5', bnot: '\u2aed', bnot: '\u2310', bopf: '\ud835\udd39', bopf: '\ud835\udd53', bot: '\u22a5', bottom: '\u22a5', bowtie: '\u22c8', boxbox: '\u29c9', boxdl: '\u2557', boxdl: '\u2556', boxdl: '\u2555', boxdl: '\u2510', boxdr: '\u2554', boxdr: '\u2553', boxdr: '\u2552', boxdr: '\u250c', boxh: '\u2550', boxh: '\u2500', boxhd: '\u2566', boxhd: '\u2564', boxhd: '\u2565', boxhd: '\u252c', boxhu: '\u2569', boxhu: '\u2567', boxhu: '\u2568', boxhu: '\u2534', boxminus: '\u229f', boxplus: '\u229e', boxtimes: '\u22a0', boxul: '\u255d', boxul: '\u255c', boxul: '\u255b', boxul: '\u2518', boxur: '\u255a', boxur: '\u2559', boxur: '\u2558', boxur: '\u2514', boxv: '\u2551', boxv: '\u2502', boxvh: '\u256c', boxvh: '\u256b', boxvh: '\u256a', boxvh: '\u253c', boxvl: '\u2563', boxvl: '\u2562', boxvl: '\u2561', boxvl: '\u2524', boxvr: '\u2560', boxvr: '\u255f', boxvr: '\u255e', boxvr: '\u251c', bprime: '\u2035', breve: '\u02d8', breve: '\u02d8', brvbar: '\u00a6', bscr: '\u212c', bscr: '\ud835\udcb7', bsemi: '\u204f', bsim: '\u223d', bsime: '\u22cd', bsol: '\u005c', bsolb: '\u29c5', bsolhsub: '\u27c8', bull: '\u2022', bullet: '\u2022', bump: '\u224e', bumpe: '\u2aae', bumpe: '\u224f', bumpeq: '\u224e', bumpeq: '\u224f', cacute: '\u0106', cacute: '\u0107', cap: '\u22d2', cap: '\u2229', capand: '\u2a44', capbrcup: '\u2a49', capcap: '\u2a4b', capcup: '\u2a47', capdot: '\u2a40', capitaldifferentiald: '\u2145', caps: '\u2229\ufe00', caret: '\u2041', caron: '\u02c7', cayleys: '\u212d', ccaps: '\u2a4d', ccaron: '\u010c', ccaron: '\u010d', ccedil: '\u00c7', ccedil: '\u00e7', ccirc: '\u0108', ccirc: '\u0109', cconint: '\u2230', ccups: '\u2a4c', ccupssm: '\u2a50', cdot: '\u010a', cdot: '\u010b', cedil: '\u00b8', cedilla: '\u00b8', cemptyv: '\u29b2', cent: '\u00a2', centerdot: '\u00b7', centerdot: '\u00b7', cfr: '\u212d', cfr: '\ud835\udd20', chcy: '\u0427', chcy: '\u0447', check: '\u2713', checkmark: '\u2713', chi: '\u03a7', chi: '\u03c7', cir: '\u25cb', circ: '\u02c6', circeq: '\u2257', circlearrowleft: '\u21ba', circlearrowright: '\u21bb', circledast: '\u229b', circledcirc: '\u229a', circleddash: '\u229d', circledot: '\u2299', circledr: '\u00ae', circleds: '\u24c8', circleminus: '\u2296', circleplus: '\u2295', circletimes: '\u2297', cire: '\u29c3', cire: '\u2257', cirfnint: '\u2a10', cirmid: '\u2aef', cirscir: '\u29c2', clockwisecontourintegral: '\u2232', closecurlydoublequote: '\u201d', closecurlyquote: '\u2019', clubs: '\u2663', clubsuit: '\u2663', colon: '\u2237', colon: '\u003a', colone: '\u2a74', colone: '\u2254', coloneq: '\u2254', comma: '\u002c', commat: '\u0040', comp: '\u2201', compfn: '\u2218', complement: '\u2201', complexes: '\u2102', cong: '\u2245', congdot: '\u2a6d', congruent: '\u2261', conint: '\u222f', conint: '\u222e', contourintegral: '\u222e', copf: '\u2102', copf: '\ud835\udd54', coprod: '\u2210', coproduct: '\u2210', copy: '\u00a9', copy: '\u00a9', copysr: '\u2117', counterclockwisecontourintegral: '\u2233', crarr: '\u21b5', cross: '\u2a2f', cross: '\u2717', cscr: '\ud835\udc9e', cscr: '\ud835\udcb8', csub: '\u2acf', csube: '\u2ad1', csup: '\u2ad0', csupe: '\u2ad2', ctdot: '\u22ef', cudarrl: '\u2938', cudarrr: '\u2935', cuepr: '\u22de', cuesc: '\u22df', cularr: '\u21b6', cularrp: '\u293d', cup: '\u22d3', cup: '\u222a', cupbrcap: '\u2a48', cupcap: '\u224d', cupcap: '\u2a46', cupcup: '\u2a4a', cupdot: '\u228d', cupor: '\u2a45', cups: '\u222a\ufe00', curarr: '\u21b7', curarrm: '\u293c', curlyeqprec: '\u22de', curlyeqsucc: '\u22df', curlyvee: '\u22ce', curlywedge: '\u22cf', curren: '\u00a4', curvearrowleft: '\u21b6', curvearrowright: '\u21b7', cuvee: '\u22ce', cuwed: '\u22cf', cwconint: '\u2232', cwint: '\u2231', cylcty: '\u232d', dagger: '\u2021', dagger: '\u2020', daleth: '\u2138', darr: '\u21a1', darr: '\u21d3', darr: '\u2193', dash: '\u2010', dashv: '\u2ae4', dashv: '\u22a3', dbkarow: '\u290f', dblac: '\u02dd', dcaron: '\u010e', dcaron: '\u010f', dcy: '\u0414', dcy: '\u0434', dd: '\u2145', dd: '\u2146', ddagger: '\u2021', ddarr: '\u21ca', ddotrahd: '\u2911', ddotseq: '\u2a77', deg: '\u00b0', del: '\u2207', delta: '\u0394', delta: '\u03b4', demptyv: '\u29b1', dfisht: '\u297f', dfr: '\ud835\udd07', dfr: '\ud835\udd21', dhar: '\u2965', dharl: '\u21c3', dharr: '\u21c2', diacriticalacute: '\u00b4', diacriticaldot: '\u02d9', diacriticaldoubleacute: '\u02dd', diacriticalgrave: '\u0060', diacriticaltilde: '\u02dc', diam: '\u22c4', diamond: '\u22c4', diamond: '\u22c4', diamondsuit: '\u2666', diams: '\u2666', die: '\u00a8', differentiald: '\u2146', digamma: '\u03dd', disin: '\u22f2', div: '\u00f7', divide: '\u00f7', divideontimes: '\u22c7', divonx: '\u22c7', djcy: '\u0402', djcy: '\u0452', dlcorn: '\u231e', dlcrop: '\u230d', dollar: '\u0024', dopf: '\ud835\udd3b', dopf: '\ud835\udd55', dot: '\u00a8', dot: '\u02d9', dotdot: '\u20dc', doteq: '\u2250', doteqdot: '\u2251', dotequal: '\u2250', dotminus: '\u2238', dotplus: '\u2214', dotsquare: '\u22a1', doublebarwedge: '\u2306', doublecontourintegral: '\u222f', doubledot: '\u00a8', doubledownarrow: '\u21d3', doubleleftarrow: '\u21d0', doubleleftrightarrow: '\u21d4', doublelefttee: '\u2ae4', doublelongleftarrow: '\u27f8', doublelongleftrightarrow: '\u27fa', doublelongrightarrow: '\u27f9', doublerightarrow: '\u21d2', doublerighttee: '\u22a8', doubleuparrow: '\u21d1', doubleupdownarrow: '\u21d5', doubleverticalbar: '\u2225', downarrow: '\u2193', downarrow: '\u21d3', downarrow: '\u2193', downarrowbar: '\u2913', downarrowuparrow: '\u21f5', downbreve: '\u0311', downdownarrows: '\u21ca', downharpoonleft: '\u21c3', downharpoonright: '\u21c2', downleftrightvector: '\u2950', downleftteevector: '\u295e', downleftvector: '\u21bd', downleftvectorbar: '\u2956', downrightteevector: '\u295f', downrightvector: '\u21c1', downrightvectorbar: '\u2957', downtee: '\u22a4', downteearrow: '\u21a7', drbkarow: '\u2910', drcorn: '\u231f', drcrop: '\u230c', dscr: '\ud835\udc9f', dscr: '\ud835\udcb9', dscy: '\u0405', dscy: '\u0455', dsol: '\u29f6', dstrok: '\u0110', dstrok: '\u0111', dtdot: '\u22f1', dtri: '\u25bf', dtrif: '\u25be', duarr: '\u21f5', duhar: '\u296f', dwangle: '\u29a6', dzcy: '\u040f', dzcy: '\u045f', dzigrarr: '\u27ff', eacute: '\u00c9', eacute: '\u00e9', easter: '\u2a6e', ecaron: '\u011a', ecaron: '\u011b', ecir: '\u2256', ecirc: '\u00ca', ecirc: '\u00ea', ecolon: '\u2255', ecy: '\u042d', ecy: '\u044d', eddot: '\u2a77', edot: '\u0116', edot: '\u2251', edot: '\u0117', ee: '\u2147', efdot: '\u2252', efr: '\ud835\udd08', efr: '\ud835\udd22', eg: '\u2a9a', egrave: '\u00c8', egrave: '\u00e8', egs: '\u2a96', egsdot: '\u2a98', el: '\u2a99', element: '\u2208', elinters: '\u23e7', ell: '\u2113', els: '\u2a95', elsdot: '\u2a97', emacr: '\u0112', emacr: '\u0113', empty: '\u2205', emptyset: '\u2205', emptysmallsquare: '\u25fb', emptyv: '\u2205', emptyverysmallsquare: '\u25ab', emsp: '\u2003', emsp13: '\u2004', emsp14: '\u2005', eng: '\u014a', eng: '\u014b', ensp: '\u2002', eogon: '\u0118', eogon: '\u0119', eopf: '\ud835\udd3c', eopf: '\ud835\udd56', epar: '\u22d5', eparsl: '\u29e3', eplus: '\u2a71', epsi: '\u03b5', epsilon: '\u0395', epsilon: '\u03b5', epsiv: '\u03f5', eqcirc: '\u2256', eqcolon: '\u2255', eqsim: '\u2242', eqslantgtr: '\u2a96', eqslantless: '\u2a95', equal: '\u2a75', equals: '\u003d', equaltilde: '\u2242', equest: '\u225f', equilibrium: '\u21cc', equiv: '\u2261', equivdd: '\u2a78', eqvparsl: '\u29e5', erarr: '\u2971', erdot: '\u2253', escr: '\u2130', escr: '\u212f', esdot: '\u2250', esim: '\u2a73', esim: '\u2242', eta: '\u0397', eta: '\u03b7', eth: '\u00d0', eth: '\u00f0', euml: '\u00cb', euml: '\u00eb', euro: '\u20ac', excl: '\u0021', exist: '\u2203', exists: '\u2203', expectation: '\u2130', exponentiale: '\u2147', exponentiale: '\u2147', fallingdotseq: '\u2252', fcy: '\u0424', fcy: '\u0444', female: '\u2640', ffilig: '\ufb03', fflig: '\ufb00', ffllig: '\ufb04', ffr: '\ud835\udd09', ffr: '\ud835\udd23', filig: '\ufb01', filledsmallsquare: '\u25fc', filledverysmallsquare: '\u25aa', fjlig: '\u0066\u006a', flat: '\u266d', fllig: '\ufb02', fltns: '\u25b1', fnof: '\u0192', fopf: '\ud835\udd3d', fopf: '\ud835\udd57', forall: '\u2200', forall: '\u2200', fork: '\u22d4', forkv: '\u2ad9', fouriertrf: '\u2131', fpartint: '\u2a0d', frac12: '\u00bd', frac13: '\u2153', frac14: '\u00bc', frac15: '\u2155', frac16: '\u2159', frac18: '\u215b', frac23: '\u2154', frac25: '\u2156', frac34: '\u00be', frac35: '\u2157', frac38: '\u215c', frac45: '\u2158', frac56: '\u215a', frac58: '\u215d', frac78: '\u215e', frasl: '\u2044', frown: '\u2322', fscr: '\u2131', fscr: '\ud835\udcbb', gacute: '\u01f5', gamma: '\u0393', gamma: '\u03b3', gammad: '\u03dc', gammad: '\u03dd', gap: '\u2a86', gbreve: '\u011e', gbreve: '\u011f', gcedil: '\u0122', gcirc: '\u011c', gcirc: '\u011d', gcy: '\u0413', gcy: '\u0433', gdot: '\u0120', gdot: '\u0121', ge: '\u2267', ge: '\u2265', gel: '\u2a8c', gel: '\u22db', geq: '\u2265', geqq: '\u2267', geqslant: '\u2a7e', ges: '\u2a7e', gescc: '\u2aa9', gesdot: '\u2a80', gesdoto: '\u2a82', gesdotol: '\u2a84', gesl: '\u22db\ufe00', gesles: '\u2a94', gfr: '\ud835\udd0a', gfr: '\ud835\udd24', gg: '\u22d9', gg: '\u226b', ggg: '\u22d9', gimel: '\u2137', gjcy: '\u0403', gjcy: '\u0453', gl: '\u2277', gla: '\u2aa5', gle: '\u2a92', glj: '\u2aa4', gnap: '\u2a8a', gnapprox: '\u2a8a', gne: '\u2269', gne: '\u2a88', gneq: '\u2a88', gneqq: '\u2269', gnsim: '\u22e7', gopf: '\ud835\udd3e', gopf: '\ud835\udd58', grave: '\u0060', greaterequal: '\u2265', greaterequalless: '\u22db', greaterfullequal: '\u2267', greatergreater: '\u2aa2', greaterless: '\u2277', greaterslantequal: '\u2a7e', greatertilde: '\u2273', gscr: '\ud835\udca2', gscr: '\u210a', gsim: '\u2273', gsime: '\u2a8e', gsiml: '\u2a90', gt: '\u226b', gt: '\u003e', gt: '\u003e', gtcc: '\u2aa7', gtcir: '\u2a7a', gtdot: '\u22d7', gtlpar: '\u2995', gtquest: '\u2a7c', gtrapprox: '\u2a86', gtrarr: '\u2978', gtrdot: '\u22d7', gtreqless: '\u22db', gtreqqless: '\u2a8c', gtrless: '\u2277', gtrsim: '\u2273', gvertneqq: '\u2269\ufe00', gvne: '\u2269\ufe00', hacek: '\u02c7', hairsp: '\u200a', half: '\u00bd', hamilt: '\u210b', hardcy: '\u042a', hardcy: '\u044a', harr: '\u21d4', harr: '\u2194', harrcir: '\u2948', harrw: '\u21ad', hat: '\u005e', hbar: '\u210f', hcirc: '\u0124', hcirc: '\u0125', hearts: '\u2665', heartsuit: '\u2665', hellip: '\u2026', hercon: '\u22b9', hfr: '\u210c', hfr: '\ud835\udd25', hilbertspace: '\u210b', hksearow: '\u2925', hkswarow: '\u2926', hoarr: '\u21ff', homtht: '\u223b', hookleftarrow: '\u21a9', hookrightarrow: '\u21aa', hopf: '\u210d', hopf: '\ud835\udd59', horbar: '\u2015', horizontalline: '\u2500', hscr: '\u210b', hscr: '\ud835\udcbd', hslash: '\u210f', hstrok: '\u0126', hstrok: '\u0127', humpdownhump: '\u224e', humpequal: '\u224f', hybull: '\u2043', hyphen: '\u2010', iacute: '\u00cd', iacute: '\u00ed', ic: '\u2063', icirc: '\u00ce', icirc: '\u00ee', icy: '\u0418', icy: '\u0438', idot: '\u0130', iecy: '\u0415', iecy: '\u0435', iexcl: '\u00a1', iff: '\u21d4', ifr: '\u2111', ifr: '\ud835\udd26', igrave: '\u00cc', igrave: '\u00ec', ii: '\u2148', iiiint: '\u2a0c', iiint: '\u222d', iinfin: '\u29dc', iiota: '\u2129', ijlig: '\u0132', ijlig: '\u0133', im: '\u2111', imacr: '\u012a', imacr: '\u012b', image: '\u2111', imaginaryi: '\u2148', imagline: '\u2110', imagpart: '\u2111', imath: '\u0131', imof: '\u22b7', imped: '\u01b5', implies: '\u21d2', in: '\u2208', incare: '\u2105', infin: '\u221e', infintie: '\u29dd', inodot: '\u0131', int: '\u222c', int: '\u222b', intcal: '\u22ba', integers: '\u2124', integral: '\u222b', intercal: '\u22ba', intersection: '\u22c2', intlarhk: '\u2a17', intprod: '\u2a3c', invisiblecomma: '\u2063', invisibletimes: '\u2062', iocy: '\u0401', iocy: '\u0451', iogon: '\u012e', iogon: '\u012f', iopf: '\ud835\udd40', iopf: '\ud835\udd5a', iota: '\u0399', iota: '\u03b9', iprod: '\u2a3c', iquest: '\u00bf', iscr: '\u2110', iscr: '\ud835\udcbe', isin: '\u2208', isindot: '\u22f5', isine: '\u22f9', isins: '\u22f4', isinsv: '\u22f3', isinv: '\u2208', it: '\u2062', itilde: '\u0128', itilde: '\u0129', iukcy: '\u0406', iukcy: '\u0456', iuml: '\u00cf', iuml: '\u00ef', jcirc: '\u0134', jcirc: '\u0135', jcy: '\u0419', jcy: '\u0439', jfr: '\ud835\udd0d', jfr: '\ud835\udd27', jmath: '\u0237', jopf: '\ud835\udd41', jopf: '\ud835\udd5b', jscr: '\ud835\udca5', jscr: '\ud835\udcbf', jsercy: '\u0408', jsercy: '\u0458', jukcy: '\u0404', jukcy: '\u0454', kappa: '\u039a', kappa: '\u03ba', kappav: '\u03f0', kcedil: '\u0136', kcedil: '\u0137', kcy: '\u041a', kcy: '\u043a', kfr: '\ud835\udd0e', kfr: '\ud835\udd28', kgreen: '\u0138', khcy: '\u0425', khcy: '\u0445', kjcy: '\u040c', kjcy: '\u045c', kopf: '\ud835\udd42', kopf: '\ud835\udd5c', kscr: '\ud835\udca6', kscr: '\ud835\udcc0', laarr: '\u21da', lacute: '\u0139', lacute: '\u013a', laemptyv: '\u29b4', lagran: '\u2112', lambda: '\u039b', lambda: '\u03bb', lang: '\u27ea', lang: '\u27e8', langd: '\u2991', langle: '\u27e8', lap: '\u2a85', laplacetrf: '\u2112', laquo: '\u00ab', larr: '\u219e', larr: '\u21d0', larr: '\u2190', larrb: '\u21e4', larrbfs: '\u291f', larrfs: '\u291d', larrhk: '\u21a9', larrlp: '\u21ab', larrpl: '\u2939', larrsim: '\u2973', larrtl: '\u21a2', lat: '\u2aab', latail: '\u291b', latail: '\u2919', late: '\u2aad', lates: '\u2aad\ufe00', lbarr: '\u290e', lbarr: '\u290c', lbbrk: '\u2772', lbrace: '\u007b', lbrack: '\u005b', lbrke: '\u298b', lbrksld: '\u298f', lbrkslu: '\u298d', lcaron: '\u013d', lcaron: '\u013e', lcedil: '\u013b', lcedil: '\u013c', lceil: '\u2308', lcub: '\u007b', lcy: '\u041b', lcy: '\u043b', ldca: '\u2936', ldquo: '\u201c', ldquor: '\u201e', ldrdhar: '\u2967', ldrushar: '\u294b', ldsh: '\u21b2', le: '\u2266', le: '\u2264', leftanglebracket: '\u27e8', leftarrow: '\u2190', leftarrow: '\u21d0', leftarrow: '\u2190', leftarrowbar: '\u21e4', leftarrowrightarrow: '\u21c6', leftarrowtail: '\u21a2', leftceiling: '\u2308', leftdoublebracket: '\u27e6', leftdownteevector: '\u2961', leftdownvector: '\u21c3', leftdownvectorbar: '\u2959', leftfloor: '\u230a', leftharpoondown: '\u21bd', leftharpoonup: '\u21bc', leftleftarrows: '\u21c7', leftrightarrow: '\u2194', leftrightarrow: '\u21d4', leftrightarrow: '\u2194', leftrightarrows: '\u21c6', leftrightharpoons: '\u21cb', leftrightsquigarrow: '\u21ad', leftrightvector: '\u294e', lefttee: '\u22a3', leftteearrow: '\u21a4', leftteevector: '\u295a', leftthreetimes: '\u22cb', lefttriangle: '\u22b2', lefttrianglebar: '\u29cf', lefttriangleequal: '\u22b4', leftupdownvector: '\u2951', leftupteevector: '\u2960', leftupvector: '\u21bf', leftupvectorbar: '\u2958', leftvector: '\u21bc', leftvectorbar: '\u2952', leg: '\u2a8b', leg: '\u22da', leq: '\u2264', leqq: '\u2266', leqslant: '\u2a7d', les: '\u2a7d', lescc: '\u2aa8', lesdot: '\u2a7f', lesdoto: '\u2a81', lesdotor: '\u2a83', lesg: '\u22da\ufe00', lesges: '\u2a93', lessapprox: '\u2a85', lessdot: '\u22d6', lesseqgtr: '\u22da', lesseqqgtr: '\u2a8b', lessequalgreater: '\u22da', lessfullequal: '\u2266', lessgreater: '\u2276', lessgtr: '\u2276', lessless: '\u2aa1', lesssim: '\u2272', lessslantequal: '\u2a7d', lesstilde: '\u2272', lfisht: '\u297c', lfloor: '\u230a', lfr: '\ud835\udd0f', lfr: '\ud835\udd29', lg: '\u2276', lge: '\u2a91', lhar: '\u2962', lhard: '\u21bd', lharu: '\u21bc', lharul: '\u296a', lhblk: '\u2584', ljcy: '\u0409', ljcy: '\u0459', ll: '\u22d8', ll: '\u226a', llarr: '\u21c7', llcorner: '\u231e', lleftarrow: '\u21da', llhard: '\u296b', lltri: '\u25fa', lmidot: '\u013f', lmidot: '\u0140', lmoust: '\u23b0', lmoustache: '\u23b0', lnap: '\u2a89', lnapprox: '\u2a89', lne: '\u2268', lne: '\u2a87', lneq: '\u2a87', lneqq: '\u2268', lnsim: '\u22e6', loang: '\u27ec', loarr: '\u21fd', lobrk: '\u27e6', longleftarrow: '\u27f5', longleftarrow: '\u27f8', longleftarrow: '\u27f5', longleftrightarrow: '\u27f7', longleftrightarrow: '\u27fa', longleftrightarrow: '\u27f7', longmapsto: '\u27fc', longrightarrow: '\u27f6', longrightarrow: '\u27f9', longrightarrow: '\u27f6', looparrowleft: '\u21ab', looparrowright: '\u21ac', lopar: '\u2985', lopf: '\ud835\udd43', lopf: '\ud835\udd5d', loplus: '\u2a2d', lotimes: '\u2a34', lowast: '\u2217', lowbar: '\u005f', lowerleftarrow: '\u2199', lowerrightarrow: '\u2198', loz: '\u25ca', lozenge: '\u25ca', lozf: '\u29eb', lpar: '\u0028', lparlt: '\u2993', lrarr: '\u21c6', lrcorner: '\u231f', lrhar: '\u21cb', lrhard: '\u296d', lrm: '\u200e', lrtri: '\u22bf', lsaquo: '\u2039', lscr: '\u2112', lscr: '\ud835\udcc1', lsh: '\u21b0', lsh: '\u21b0', lsim: '\u2272', lsime: '\u2a8d', lsimg: '\u2a8f', lsqb: '\u005b', lsquo: '\u2018', lsquor: '\u201a', lstrok: '\u0141', lstrok: '\u0142', lt: '\u226a', lt: '\u003c', lt: '\u003c', ltcc: '\u2aa6', ltcir: '\u2a79', ltdot: '\u22d6', lthree: '\u22cb', ltimes: '\u22c9', ltlarr: '\u2976', ltquest: '\u2a7b', ltri: '\u25c3', ltrie: '\u22b4', ltrif: '\u25c2', ltrpar: '\u2996', lurdshar: '\u294a', luruhar: '\u2966', lvertneqq: '\u2268\ufe00', lvne: '\u2268\ufe00', macr: '\u00af', male: '\u2642', malt: '\u2720', maltese: '\u2720', map: '\u2905', map: '\u21a6', mapsto: '\u21a6', mapstodown: '\u21a7', mapstoleft: '\u21a4', mapstoup: '\u21a5', marker: '\u25ae', mcomma: '\u2a29', mcy: '\u041c', mcy: '\u043c', mdash: '\u2014', mddot: '\u223a', measuredangle: '\u2221', mediumspace: '\u205f', mellintrf: '\u2133', mfr: '\ud835\udd10', mfr: '\ud835\udd2a', mho: '\u2127', micro: '\u00b5', mid: '\u2223', midast: '\u002a', midcir: '\u2af0', middot: '\u00b7', minus: '\u2212', minusb: '\u229f', minusd: '\u2238', minusdu: '\u2a2a', minusplus: '\u2213', mlcp: '\u2adb', mldr: '\u2026', mnplus: '\u2213', models: '\u22a7', mopf: '\ud835\udd44', mopf: '\ud835\udd5e', mp: '\u2213', mscr: '\u2133', mscr: '\ud835\udcc2', mstpos: '\u223e', mu: '\u039c', mu: '\u03bc', multimap: '\u22b8', mumap: '\u22b8', nabla: '\u2207', nacute: '\u0143', nacute: '\u0144', nang: '\u2220\u20d2', nap: '\u2249', nape: '\u2a70\u0338', napid: '\u224b\u0338', napos: '\u0149', napprox: '\u2249', natur: '\u266e', natural: '\u266e', naturals: '\u2115', nbsp: '\u00a0', nbump: '\u224e\u0338', nbumpe: '\u224f\u0338', ncap: '\u2a43', ncaron: '\u0147', ncaron: '\u0148', ncedil: '\u0145', ncedil: '\u0146', ncong: '\u2247', ncongdot: '\u2a6d\u0338', ncup: '\u2a42', ncy: '\u041d', ncy: '\u043d', ndash: '\u2013', ne: '\u2260', nearhk: '\u2924', nearr: '\u21d7', nearr: '\u2197', nearrow: '\u2197', nedot: '\u2250\u0338', negativemediumspace: '\u200b', negativethickspace: '\u200b', negativethinspace: '\u200b', negativeverythinspace: '\u200b', nequiv: '\u2262', nesear: '\u2928', nesim: '\u2242\u0338', nestedgreatergreater: '\u226b', nestedlessless: '\u226a', newline: '\u000a', nexist: '\u2204', nexists: '\u2204', nfr: '\ud835\udd11', nfr: '\ud835\udd2b', nge: '\u2267\u0338', nge: '\u2271', ngeq: '\u2271', ngeqq: '\u2267\u0338', ngeqslant: '\u2a7e\u0338', nges: '\u2a7e\u0338', ngg: '\u22d9\u0338', ngsim: '\u2275', ngt: '\u226b\u20d2', ngt: '\u226f', ngtr: '\u226f', ngtv: '\u226b\u0338', nharr: '\u21ce', nharr: '\u21ae', nhpar: '\u2af2', ni: '\u220b', nis: '\u22fc', nisd: '\u22fa', niv: '\u220b', njcy: '\u040a', njcy: '\u045a', nlarr: '\u21cd', nlarr: '\u219a', nldr: '\u2025', nle: '\u2266\u0338', nle: '\u2270', nleftarrow: '\u21cd', nleftarrow: '\u219a', nleftrightarrow: '\u21ce', nleftrightarrow: '\u21ae', nleq: '\u2270', nleqq: '\u2266\u0338', nleqslant: '\u2a7d\u0338', nles: '\u2a7d\u0338', nless: '\u226e', nll: '\u22d8\u0338', nlsim: '\u2274', nlt: '\u226a\u20d2', nlt: '\u226e', nltri: '\u22ea', nltrie: '\u22ec', nltv: '\u226a\u0338', nmid: '\u2224', nobreak: '\u2060', nonbreakingspace: '\u00a0', nopf: '\u2115', nopf: '\ud835\udd5f', not: '\u2aec', not: '\u00ac', notcongruent: '\u2262', notcupcap: '\u226d', notdoubleverticalbar: '\u2226', notelement: '\u2209', notequal: '\u2260', notequaltilde: '\u2242\u0338', notexists: '\u2204', notgreater: '\u226f', notgreaterequal: '\u2271', notgreaterfullequal: '\u2267\u0338', notgreatergreater: '\u226b\u0338', notgreaterless: '\u2279', notgreaterslantequal: '\u2a7e\u0338', notgreatertilde: '\u2275', nothumpdownhump: '\u224e\u0338', nothumpequal: '\u224f\u0338', notin: '\u2209', notindot: '\u22f5\u0338', notine: '\u22f9\u0338', notinva: '\u2209', notinvb: '\u22f7', notinvc: '\u22f6', notlefttriangle: '\u22ea', notlefttrianglebar: '\u29cf\u0338', notlefttriangleequal: '\u22ec', notless: '\u226e', notlessequal: '\u2270', notlessgreater: '\u2278', notlessless: '\u226a\u0338', notlessslantequal: '\u2a7d\u0338', notlesstilde: '\u2274', notnestedgreatergreater: '\u2aa2\u0338', notnestedlessless: '\u2aa1\u0338', notni: '\u220c', notniva: '\u220c', notnivb: '\u22fe', notnivc: '\u22fd', notprecedes: '\u2280', notprecedesequal: '\u2aaf\u0338', notprecedesslantequal: '\u22e0', notreverseelement: '\u220c', notrighttriangle: '\u22eb', notrighttrianglebar: '\u29d0\u0338', notrighttriangleequal: '\u22ed', notsquaresubset: '\u228f\u0338', notsquaresubsetequal: '\u22e2', notsquaresuperset: '\u2290\u0338', notsquaresupersetequal: '\u22e3', notsubset: '\u2282\u20d2', notsubsetequal: '\u2288', notsucceeds: '\u2281', notsucceedsequal: '\u2ab0\u0338', notsucceedsslantequal: '\u22e1', notsucceedstilde: '\u227f\u0338', notsuperset: '\u2283\u20d2', notsupersetequal: '\u2289', nottilde: '\u2241', nottildeequal: '\u2244', nottildefullequal: '\u2247', nottildetilde: '\u2249', notverticalbar: '\u2224', npar: '\u2226', nparallel: '\u2226', nparsl: '\u2afd\u20e5', npart: '\u2202\u0338', npolint: '\u2a14', npr: '\u2280', nprcue: '\u22e0', npre: '\u2aaf\u0338', nprec: '\u2280', npreceq: '\u2aaf\u0338', nrarr: '\u21cf', nrarr: '\u219b', nrarrc: '\u2933\u0338', nrarrw: '\u219d\u0338', nrightarrow: '\u21cf', nrightarrow: '\u219b', nrtri: '\u22eb', nrtrie: '\u22ed', nsc: '\u2281', nsccue: '\u22e1', nsce: '\u2ab0\u0338', nscr: '\ud835\udca9', nscr: '\ud835\udcc3', nshortmid: '\u2224', nshortparallel: '\u2226', nsim: '\u2241', nsime: '\u2244', nsimeq: '\u2244', nsmid: '\u2224', nspar: '\u2226', nsqsube: '\u22e2', nsqsupe: '\u22e3', nsub: '\u2284', nsube: '\u2ac5\u0338', nsube: '\u2288', nsubset: '\u2282\u20d2', nsubseteq: '\u2288', nsubseteqq: '\u2ac5\u0338', nsucc: '\u2281', nsucceq: '\u2ab0\u0338', nsup: '\u2285', nsupe: '\u2ac6\u0338', nsupe: '\u2289', nsupset: '\u2283\u20d2', nsupseteq: '\u2289', nsupseteqq: '\u2ac6\u0338', ntgl: '\u2279', ntilde: '\u00d1', ntilde: '\u00f1', ntlg: '\u2278', ntriangleleft: '\u22ea', ntrianglelefteq: '\u22ec', ntriangleright: '\u22eb', ntrianglerighteq: '\u22ed', nu: '\u039d', nu: '\u03bd', num: '\u0023', numero: '\u2116', numsp: '\u2007', nvap: '\u224d\u20d2', nvdash: '\u22af', nvdash: '\u22ae', nvdash: '\u22ad', nvdash: '\u22ac', nvge: '\u2265\u20d2', nvgt: '\u003e\u20d2', nvharr: '\u2904', nvinfin: '\u29de', nvlarr: '\u2902', nvle: '\u2264\u20d2', nvlt: '\u003c\u20d2', nvltrie: '\u22b4\u20d2', nvrarr: '\u2903', nvrtrie: '\u22b5\u20d2', nvsim: '\u223c\u20d2', nwarhk: '\u2923', nwarr: '\u21d6', nwarr: '\u2196', nwarrow: '\u2196', nwnear: '\u2927', oacute: '\u00d3', oacute: '\u00f3', oast: '\u229b', ocir: '\u229a', ocirc: '\u00d4', ocirc: '\u00f4', ocy: '\u041e', ocy: '\u043e', odash: '\u229d', odblac: '\u0150', odblac: '\u0151', odiv: '\u2a38', odot: '\u2299', odsold: '\u29bc', oelig: '\u0152', oelig: '\u0153', ofcir: '\u29bf', ofr: '\ud835\udd12', ofr: '\ud835\udd2c', ogon: '\u02db', ograve: '\u00d2', ograve: '\u00f2', ogt: '\u29c1', ohbar: '\u29b5', ohm: '\u03a9', oint: '\u222e', olarr: '\u21ba', olcir: '\u29be', olcross: '\u29bb', oline: '\u203e', olt: '\u29c0', omacr: '\u014c', omacr: '\u014d', omega: '\u03a9', omega: '\u03c9', omicron: '\u039f', omicron: '\u03bf', omid: '\u29b6', ominus: '\u2296', oopf: '\ud835\udd46', oopf: '\ud835\udd60', opar: '\u29b7', opencurlydoublequote: '\u201c', opencurlyquote: '\u2018', operp: '\u29b9', oplus: '\u2295', or: '\u2a54', or: '\u2228', orarr: '\u21bb', ord: '\u2a5d', order: '\u2134', orderof: '\u2134', ordf: '\u00aa', ordm: '\u00ba', origof: '\u22b6', oror: '\u2a56', orslope: '\u2a57', orv: '\u2a5b', os: '\u24c8', oscr: '\ud835\udcaa', oscr: '\u2134', oslash: '\u00d8', oslash: '\u00f8', osol: '\u2298', otilde: '\u00d5', otilde: '\u00f5', otimes: '\u2a37', otimes: '\u2297', otimesas: '\u2a36', ouml: '\u00d6', ouml: '\u00f6', ovbar: '\u233d', overbar: '\u203e', overbrace: '\u23de', overbracket: '\u23b4', overparenthesis: '\u23dc', par: '\u2225', para: '\u00b6', parallel: '\u2225', parsim: '\u2af3', parsl: '\u2afd', part: '\u2202', partiald: '\u2202', pcy: '\u041f', pcy: '\u043f', percnt: '\u0025', period: '\u002e', permil: '\u2030', perp: '\u22a5', pertenk: '\u2031', pfr: '\ud835\udd13', pfr: '\ud835\udd2d', phi: '\u03a6', phi: '\u03c6', phiv: '\u03d5', phmmat: '\u2133', phone: '\u260e', pi: '\u03a0', pi: '\u03c0', pitchfork: '\u22d4', piv: '\u03d6', planck: '\u210f', planckh: '\u210e', plankv: '\u210f', plus: '\u002b', plusacir: '\u2a23', plusb: '\u229e', pluscir: '\u2a22', plusdo: '\u2214', plusdu: '\u2a25', pluse: '\u2a72', plusminus: '\u00b1', plusmn: '\u00b1', plussim: '\u2a26', plustwo: '\u2a27', pm: '\u00b1', poincareplane: '\u210c', pointint: '\u2a15', popf: '\u2119', popf: '\ud835\udd61', pound: '\u00a3', pr: '\u2abb', pr: '\u227a', prap: '\u2ab7', prcue: '\u227c', pre: '\u2ab3', pre: '\u2aaf', prec: '\u227a', precapprox: '\u2ab7', preccurlyeq: '\u227c', precedes: '\u227a', precedesequal: '\u2aaf', precedesslantequal: '\u227c', precedestilde: '\u227e', preceq: '\u2aaf', precnapprox: '\u2ab9', precneqq: '\u2ab5', precnsim: '\u22e8', precsim: '\u227e', prime: '\u2033', prime: '\u2032', primes: '\u2119', prnap: '\u2ab9', prne: '\u2ab5', prnsim: '\u22e8', prod: '\u220f', product: '\u220f', profalar: '\u232e', profline: '\u2312', profsurf: '\u2313', prop: '\u221d', proportion: '\u2237', proportional: '\u221d', propto: '\u221d', prsim: '\u227e', prurel: '\u22b0', pscr: '\ud835\udcab', pscr: '\ud835\udcc5', psi: '\u03a8', psi: '\u03c8', puncsp: '\u2008', qfr: '\ud835\udd14', qfr: '\ud835\udd2e', qint: '\u2a0c', qopf: '\u211a', qopf: '\ud835\udd62', qprime: '\u2057', qscr: '\ud835\udcac', qscr: '\ud835\udcc6', quaternions: '\u210d', quatint: '\u2a16', quest: '\u003f', questeq: '\u225f', quot: '\u0022', quot: '\u0022', raarr: '\u21db', race: '\u223d\u0331', racute: '\u0154', racute: '\u0155', radic: '\u221a', raemptyv: '\u29b3', rang: '\u27eb', rang: '\u27e9', rangd: '\u2992', range: '\u29a5', rangle: '\u27e9', raquo: '\u00bb', rarr: '\u21a0', rarr: '\u21d2', rarr: '\u2192', rarrap: '\u2975', rarrb: '\u21e5', rarrbfs: '\u2920', rarrc: '\u2933', rarrfs: '\u291e', rarrhk: '\u21aa', rarrlp: '\u21ac', rarrpl: '\u2945', rarrsim: '\u2974', rarrtl: '\u2916', rarrtl: '\u21a3', rarrw: '\u219d', ratail: '\u291c', ratail: '\u291a', ratio: '\u2236', rationals: '\u211a', rbarr: '\u2910', rbarr: '\u290f', rbarr: '\u290d', rbbrk: '\u2773', rbrace: '\u007d', rbrack: '\u005d', rbrke: '\u298c', rbrksld: '\u298e', rbrkslu: '\u2990', rcaron: '\u0158', rcaron: '\u0159', rcedil: '\u0156', rcedil: '\u0157', rceil: '\u2309', rcub: '\u007d', rcy: '\u0420', rcy: '\u0440', rdca: '\u2937', rdldhar: '\u2969', rdquo: '\u201d', rdquor: '\u201d', rdsh: '\u21b3', re: '\u211c', real: '\u211c', realine: '\u211b', realpart: '\u211c', reals: '\u211d', rect: '\u25ad', reg: '\u00ae', reg: '\u00ae', reverseelement: '\u220b', reverseequilibrium: '\u21cb', reverseupequilibrium: '\u296f', rfisht: '\u297d', rfloor: '\u230b', rfr: '\u211c', rfr: '\ud835\udd2f', rhar: '\u2964', rhard: '\u21c1', rharu: '\u21c0', rharul: '\u296c', rho: '\u03a1', rho: '\u03c1', rhov: '\u03f1', rightanglebracket: '\u27e9', rightarrow: '\u2192', rightarrow: '\u21d2', rightarrow: '\u2192', rightarrowbar: '\u21e5', rightarrowleftarrow: '\u21c4', rightarrowtail: '\u21a3', rightceiling: '\u2309', rightdoublebracket: '\u27e7', rightdownteevector: '\u295d', rightdownvector: '\u21c2', rightdownvectorbar: '\u2955', rightfloor: '\u230b', rightharpoondown: '\u21c1', rightharpoonup: '\u21c0', rightleftarrows: '\u21c4', rightleftharpoons: '\u21cc', rightrightarrows: '\u21c9', rightsquigarrow: '\u219d', righttee: '\u22a2', rightteearrow: '\u21a6', rightteevector: '\u295b', rightthreetimes: '\u22cc', righttriangle: '\u22b3', righttrianglebar: '\u29d0', righttriangleequal: '\u22b5', rightupdownvector: '\u294f', rightupteevector: '\u295c', rightupvector: '\u21be', rightupvectorbar: '\u2954', rightvector: '\u21c0', rightvectorbar: '\u2953', ring: '\u02da', risingdotseq: '\u2253', rlarr: '\u21c4', rlhar: '\u21cc', rlm: '\u200f', rmoust: '\u23b1', rmoustache: '\u23b1', rnmid: '\u2aee', roang: '\u27ed', roarr: '\u21fe', robrk: '\u27e7', ropar: '\u2986', ropf: '\u211d', ropf: '\ud835\udd63', roplus: '\u2a2e', rotimes: '\u2a35', roundimplies: '\u2970', rpar: '\u0029', rpargt: '\u2994', rppolint: '\u2a12', rrarr: '\u21c9', rrightarrow: '\u21db', rsaquo: '\u203a', rscr: '\u211b', rscr: '\ud835\udcc7', rsh: '\u21b1', rsh: '\u21b1', rsqb: '\u005d', rsquo: '\u2019', rsquor: '\u2019', rthree: '\u22cc', rtimes: '\u22ca', rtri: '\u25b9', rtrie: '\u22b5', rtrif: '\u25b8', rtriltri: '\u29ce', ruledelayed: '\u29f4', ruluhar: '\u2968', rx: '\u211e', sacute: '\u015a', sacute: '\u015b', sbquo: '\u201a', sc: '\u2abc', sc: '\u227b', scap: '\u2ab8', scaron: '\u0160', scaron: '\u0161', sccue: '\u227d', sce: '\u2ab4', sce: '\u2ab0', scedil: '\u015e', scedil: '\u015f', scirc: '\u015c', scirc: '\u015d', scnap: '\u2aba', scne: '\u2ab6', scnsim: '\u22e9', scpolint: '\u2a13', scsim: '\u227f', scy: '\u0421', scy: '\u0441', sdot: '\u22c5', sdotb: '\u22a1', sdote: '\u2a66', searhk: '\u2925', searr: '\u21d8', searr: '\u2198', searrow: '\u2198', sect: '\u00a7', semi: '\u003b', seswar: '\u2929', setminus: '\u2216', setmn: '\u2216', sext: '\u2736', sfr: '\ud835\udd16', sfr: '\ud835\udd30', sfrown: '\u2322', sharp: '\u266f', shchcy: '\u0429', shchcy: '\u0449', shcy: '\u0428', shcy: '\u0448', shortdownarrow: '\u2193', shortleftarrow: '\u2190', shortmid: '\u2223', shortparallel: '\u2225', shortrightarrow: '\u2192', shortuparrow: '\u2191', shy: '\u00ad', sigma: '\u03a3', sigma: '\u03c3', sigmaf: '\u03c2', sigmav: '\u03c2', sim: '\u223c', simdot: '\u2a6a', sime: '\u2243', simeq: '\u2243', simg: '\u2a9e', simge: '\u2aa0', siml: '\u2a9d', simle: '\u2a9f', simne: '\u2246', simplus: '\u2a24', simrarr: '\u2972', slarr: '\u2190', smallcircle: '\u2218', smallsetminus: '\u2216', smashp: '\u2a33', smeparsl: '\u29e4', smid: '\u2223', smile: '\u2323', smt: '\u2aaa', smte: '\u2aac', smtes: '\u2aac\ufe00', softcy: '\u042c', softcy: '\u044c', sol: '\u002f', solb: '\u29c4', solbar: '\u233f', sopf: '\ud835\udd4a', sopf: '\ud835\udd64', spades: '\u2660', spadesuit: '\u2660', spar: '\u2225', sqcap: '\u2293', sqcaps: '\u2293\ufe00', sqcup: '\u2294', sqcups: '\u2294\ufe00', sqrt: '\u221a', sqsub: '\u228f', sqsube: '\u2291', sqsubset: '\u228f', sqsubseteq: '\u2291', sqsup: '\u2290', sqsupe: '\u2292', sqsupset: '\u2290', sqsupseteq: '\u2292', squ: '\u25a1', square: '\u25a1', square: '\u25a1', squareintersection: '\u2293', squaresubset: '\u228f', squaresubsetequal: '\u2291', squaresuperset: '\u2290', squaresupersetequal: '\u2292', squareunion: '\u2294', squarf: '\u25aa', squf: '\u25aa', srarr: '\u2192', sscr: '\ud835\udcae', sscr: '\ud835\udcc8', ssetmn: '\u2216', ssmile: '\u2323', sstarf: '\u22c6', star: '\u22c6', star: '\u2606', starf: '\u2605', straightepsilon: '\u03f5', straightphi: '\u03d5', strns: '\u00af', sub: '\u22d0', sub: '\u2282', subdot: '\u2abd', sube: '\u2ac5', sube: '\u2286', subedot: '\u2ac3', submult: '\u2ac1', subne: '\u2acb', subne: '\u228a', subplus: '\u2abf', subrarr: '\u2979', subset: '\u22d0', subset: '\u2282', subseteq: '\u2286', subseteqq: '\u2ac5', subsetequal: '\u2286', subsetneq: '\u228a', subsetneqq: '\u2acb', subsim: '\u2ac7', subsub: '\u2ad5', subsup: '\u2ad3', succ: '\u227b', succapprox: '\u2ab8', succcurlyeq: '\u227d', succeeds: '\u227b', succeedsequal: '\u2ab0', succeedsslantequal: '\u227d', succeedstilde: '\u227f', succeq: '\u2ab0', succnapprox: '\u2aba', succneqq: '\u2ab6', succnsim: '\u22e9', succsim: '\u227f', suchthat: '\u220b', sum: '\u2211', sum: '\u2211', sung: '\u266a', sup: '\u22d1', sup: '\u2283', sup1: '\u00b9', sup2: '\u00b2', sup3: '\u00b3', supdot: '\u2abe', supdsub: '\u2ad8', supe: '\u2ac6', supe: '\u2287', supedot: '\u2ac4', superset: '\u2283', supersetequal: '\u2287', suphsol: '\u27c9', suphsub: '\u2ad7', suplarr: '\u297b', supmult: '\u2ac2', supne: '\u2acc', supne: '\u228b', supplus: '\u2ac0', supset: '\u22d1', supset: '\u2283', supseteq: '\u2287', supseteqq: '\u2ac6', supsetneq: '\u228b', supsetneqq: '\u2acc', supsim: '\u2ac8', supsub: '\u2ad4', supsup: '\u2ad6', swarhk: '\u2926', swarr: '\u21d9', swarr: '\u2199', swarrow: '\u2199', swnwar: '\u292a', szlig: '\u00df', tab: '\u0009', target: '\u2316', tau: '\u03a4', tau: '\u03c4', tbrk: '\u23b4', tcaron: '\u0164', tcaron: '\u0165', tcedil: '\u0162', tcedil: '\u0163', tcy: '\u0422', tcy: '\u0442', tdot: '\u20db', telrec: '\u2315', tfr: '\ud835\udd17', tfr: '\ud835\udd31', there4: '\u2234', therefore: '\u2234', therefore: '\u2234', theta: '\u0398', theta: '\u03b8', thetasym: '\u03d1', thetav: '\u03d1', thickapprox: '\u2248', thicksim: '\u223c', thickspace: '\u205f\u200a', thinsp: '\u2009', thinspace: '\u2009', thkap: '\u2248', thksim: '\u223c', thorn: '\u00de', thorn: '\u00fe', tilde: '\u223c', tilde: '\u02dc', tildeequal: '\u2243', tildefullequal: '\u2245', tildetilde: '\u2248', times: '\u00d7', timesb: '\u22a0', timesbar: '\u2a31', timesd: '\u2a30', tint: '\u222d', toea: '\u2928', top: '\u22a4', topbot: '\u2336', topcir: '\u2af1', topf: '\ud835\udd4b', topf: '\ud835\udd65', topfork: '\u2ada', tosa: '\u2929', tprime: '\u2034', trade: '\u2122', trade: '\u2122', triangle: '\u25b5', triangledown: '\u25bf', triangleleft: '\u25c3', trianglelefteq: '\u22b4', triangleq: '\u225c', triangleright: '\u25b9', trianglerighteq: '\u22b5', tridot: '\u25ec', trie: '\u225c', triminus: '\u2a3a', tripledot: '\u20db', triplus: '\u2a39', trisb: '\u29cd', tritime: '\u2a3b', trpezium: '\u23e2', tscr: '\ud835\udcaf', tscr: '\ud835\udcc9', tscy: '\u0426', tscy: '\u0446', tshcy: '\u040b', tshcy: '\u045b', tstrok: '\u0166', tstrok: '\u0167', twixt: '\u226c', twoheadleftarrow: '\u219e', twoheadrightarrow: '\u21a0', uacute: '\u00da', uacute: '\u00fa', uarr: '\u219f', uarr: '\u21d1', uarr: '\u2191', uarrocir: '\u2949', ubrcy: '\u040e', ubrcy: '\u045e', ubreve: '\u016c', ubreve: '\u016d', ucirc: '\u00db', ucirc: '\u00fb', ucy: '\u0423', ucy: '\u0443', udarr: '\u21c5', udblac: '\u0170', udblac: '\u0171', udhar: '\u296e', ufisht: '\u297e', ufr: '\ud835\udd18', ufr: '\ud835\udd32', ugrave: '\u00d9', ugrave: '\u00f9', uhar: '\u2963', uharl: '\u21bf', uharr: '\u21be', uhblk: '\u2580', ulcorn: '\u231c', ulcorner: '\u231c', ulcrop: '\u230f', ultri: '\u25f8', umacr: '\u016a', umacr: '\u016b', uml: '\u00a8', underbar: '\u005f', underbrace: '\u23df', underbracket: '\u23b5', underparenthesis: '\u23dd', union: '\u22c3', unionplus: '\u228e', uogon: '\u0172', uogon: '\u0173', uopf: '\ud835\udd4c', uopf: '\ud835\udd66', uparrow: '\u2191', uparrow: '\u21d1', uparrow: '\u2191', uparrowbar: '\u2912', uparrowdownarrow: '\u21c5', updownarrow: '\u2195', updownarrow: '\u21d5', updownarrow: '\u2195', upequilibrium: '\u296e', upharpoonleft: '\u21bf', upharpoonright: '\u21be', uplus: '\u228e', upperleftarrow: '\u2196', upperrightarrow: '\u2197', upsi: '\u03d2', upsi: '\u03c5', upsih: '\u03d2', upsilon: '\u03a5', upsilon: '\u03c5', uptee: '\u22a5', upteearrow: '\u21a5', upuparrows: '\u21c8', urcorn: '\u231d', urcorner: '\u231d', urcrop: '\u230e', uring: '\u016e', uring: '\u016f', urtri: '\u25f9', uscr: '\ud835\udcb0', uscr: '\ud835\udcca', utdot: '\u22f0', utilde: '\u0168', utilde: '\u0169', utri: '\u25b5', utrif: '\u25b4', uuarr: '\u21c8', uuml: '\u00dc', uuml: '\u00fc', uwangle: '\u29a7', vangrt: '\u299c', varepsilon: '\u03f5', varkappa: '\u03f0', varnothing: '\u2205', varphi: '\u03d5', varpi: '\u03d6', varpropto: '\u221d', varr: '\u21d5', varr: '\u2195', varrho: '\u03f1', varsigma: '\u03c2', varsubsetneq: '\u228a\ufe00', varsubsetneqq: '\u2acb\ufe00', varsupsetneq: '\u228b\ufe00', varsupsetneqq: '\u2acc\ufe00', vartheta: '\u03d1', vartriangleleft: '\u22b2', vartriangleright: '\u22b3', vbar: '\u2aeb', vbar: '\u2ae8', vbarv: '\u2ae9', vcy: '\u0412', vcy: '\u0432', vdash: '\u22ab', vdash: '\u22a9', vdash: '\u22a8', vdash: '\u22a2', vdashl: '\u2ae6', vee: '\u22c1', vee: '\u2228', veebar: '\u22bb', veeeq: '\u225a', vellip: '\u22ee', verbar: '\u2016', verbar: '\u007c', vert: '\u2016', vert: '\u007c', verticalbar: '\u2223', verticalline: '\u007c', verticalseparator: '\u2758', verticaltilde: '\u2240', verythinspace: '\u200a', vfr: '\ud835\udd19', vfr: '\ud835\udd33', vltri: '\u22b2', vnsub: '\u2282\u20d2', vnsup: '\u2283\u20d2', vopf: '\ud835\udd4d', vopf: '\ud835\udd67', vprop: '\u221d', vrtri: '\u22b3', vscr: '\ud835\udcb1', vscr: '\ud835\udccb', vsubne: '\u2acb\ufe00', vsubne: '\u228a\ufe00', vsupne: '\u2acc\ufe00', vsupne: '\u228b\ufe00', vvdash: '\u22aa', vzigzag: '\u299a', wcirc: '\u0174', wcirc: '\u0175', wedbar: '\u2a5f', wedge: '\u22c0', wedge: '\u2227', wedgeq: '\u2259', weierp: '\u2118', wfr: '\ud835\udd1a', wfr: '\ud835\udd34', wopf: '\ud835\udd4e', wopf: '\ud835\udd68', wp: '\u2118', wr: '\u2240', wreath: '\u2240', wscr: '\ud835\udcb2', wscr: '\ud835\udccc', xcap: '\u22c2', xcirc: '\u25ef', xcup: '\u22c3', xdtri: '\u25bd', xfr: '\ud835\udd1b', xfr: '\ud835\udd35', xharr: '\u27fa', xharr: '\u27f7', xi: '\u039e', xi: '\u03be', xlarr: '\u27f8', xlarr: '\u27f5', xmap: '\u27fc', xnis: '\u22fb', xodot: '\u2a00', xopf: '\ud835\udd4f', xopf: '\ud835\udd69', xoplus: '\u2a01', xotime: '\u2a02', xrarr: '\u27f9', xrarr: '\u27f6', xscr: '\ud835\udcb3', xscr: '\ud835\udccd', xsqcup: '\u2a06', xuplus: '\u2a04', xutri: '\u25b3', xvee: '\u22c1', xwedge: '\u22c0', yacute: '\u00dd', yacute: '\u00fd', yacy: '\u042f', yacy: '\u044f', ycirc: '\u0176', ycirc: '\u0177', ycy: '\u042b', ycy: '\u044b', yen: '\u00a5', yfr: '\ud835\udd1c', yfr: '\ud835\udd36', yicy: '\u0407', yicy: '\u0457', yopf: '\ud835\udd50', yopf: '\ud835\udd6a', yscr: '\ud835\udcb4', yscr: '\ud835\udcce', yucy: '\u042e', yucy: '\u044e', yuml: '\u0178', yuml: '\u00ff', zacute: '\u0179', zacute: '\u017a', zcaron: '\u017d', zcaron: '\u017e', zcy: '\u0417', zcy: '\u0437', zdot: '\u017b', zdot: '\u017c', zeetrf: '\u2128', zerowidthspace: '\u200b', zeta: '\u0396', zeta: '\u03b6', zfr: '\u2128', zfr: '\ud835\udd37', zhcy: '\u0416', zhcy: '\u0436', zigrarr: '\u21dd', zopf: '\u2124', zopf: '\ud835\udd6b', zscr: '\ud835\udcb5', zscr: '\ud835\udccf', zwj: '\u200d', zwnj: '\u200c', }); /** * @deprecated use `html_entities` instead * @see html_entities */ exports.entitymap = exports.html_entities; /***/ }), /***/ 420: /***/ (function(module, exports, __webpack_require__) { var namespace = __webpack_require__(125).namespace; //[4] namestartchar ::= ":" | [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] //[4a] namechar ::= namestartchar | "-" | "." | [0-9] | #xb7 | [#x0300-#x036f] | [#x203f-#x2040] //[5] name ::= namestartchar (namechar)* var 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 var namechar = new regexp("[\\-\\.0-9"+namestartchar.source.slice(1,-1)+"\\u00b7\\u0300-\\u036f\\u203f-\\u2040]"); var tagnamepattern = new regexp('^'+namestartchar.source+namechar.source+'*(?:\:'+namestartchar.source+namechar.source+'*)?$'); //var tagnamepattern = /^[a-za-z_][\w\-\.]*(?:\:[a-za-z_][\w\-\.]*)?$/ //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(',') //s_tag, s_attr, s_eq, s_attr_noquot_value //s_attr_space, s_attr_end, s_tag_space, s_tag_close var s_tag = 0;//tag name offerring var s_attr = 1;//attr name offerring var s_attr_space=2;//attr name end and space offer var s_eq = 3;//=space? var s_attr_noquot_value = 4;//attr value(no quot value only) var s_attr_end = 5;//attr value end and no space(quot end) var s_tag_space = 6;//(attr value end || tag end ) && (space offer) var s_tag_close = 7;//closed el /** * creates an error that will not be caught by xmlreader aka the sax parser. * * @param {string} message * @param {any?} locator optional, can provide details about the location in the source * @constructor */ function parseerror(message, locator) { this.message = message this.locator = locator if(error.capturestacktrace) error.capturestacktrace(this, parseerror); } parseerror.prototype = new error(); parseerror.prototype.name = parseerror.name function xmlreader(){ } xmlreader.prototype = { parse:function(source,defaultnsmap,entitymap){ var dombuilder = this.dombuilder; dombuilder.startdocument(); _copy(defaultnsmap ,defaultnsmap = {}) parse(source,defaultnsmap,entitymap, dombuilder,this.errorhandler); dombuilder.enddocument(); } } function parse(source,defaultnsmapcopy,entitymap,dombuilder,errorhandler){ function fixedfromcharcode(code) { // string.prototype.fromcharcode does not supports // > 2 bytes unicode chars directly if (code > 0xffff) { code -= 0x10000; var surrogate1 = 0xd800 + (code >> 10) , surrogate2 = 0xdc00 + (code & 0x3ff); return string.fromcharcode(surrogate1, surrogate2); } else { return string.fromcharcode(code); } } function entityreplacer(a){ var k = a.slice(1,-1); if (object.hasownproperty.call(entitymap, k)) { return entitymap[k]; }else if(k.charat(0) === '#'){ return fixedfromcharcode(parseint(k.substr(1).replace('x','0x'))) }else{ errorhandler.error('entity not found:'+a); return a; } } function appendtext(end){//has some bugs if(end>start){ var xt = source.substring(start,end).replace(/&#?\w+;/g,entityreplacer); locator&&position(start); dombuilder.characters(xt,0,end-start); start = end } } function position(p,m){ while(p>=lineend && (m = linepattern.exec(source))){ linestart = m.index; lineend = linestart + m[0].length; locator.linenumber++; //console.log('line++:',locator,startpos,endpos) } locator.columnnumber = p-linestart+1; } var linestart = 0; var lineend = 0; var linepattern = /.*(?:\r\n?|\n)|.*$/g var locator = dombuilder.locator; var parsestack = [{currentnsmap:defaultnsmapcopy}] var closemap = {}; var start = 0; while(true){ try{ var tagstart = source.indexof('<',start); if(tagstart<0){ if(!source.substr(start).match(/^\s*$/)){ var doc = dombuilder.doc; var text = doc.createtextnode(source.substr(start)); doc.appendchild(text); dombuilder.currentelement = text; } return; } if(tagstart>start){ appendtext(tagstart); } switch(source.charat(tagstart+1)){ case '/': var end = source.indexof('>',tagstart+3); var tagname = source.substring(tagstart + 2, end).replace(/[ \t\n\r]+$/g, ''); var config = parsestack.pop(); if(end<0){ tagname = source.substring(tagstart+2).replace(/[\s<].*/,''); errorhandler.error("end tag name: "+tagname+' is not complete:'+config.tagname); end = tagstart+1+tagname.length; }else if(tagname.match(/\s locator&&position(tagstart); end = parseinstruction(source,tagstart,dombuilder); break; case '!':// start){ start = end; }else{ //todo: 这里有可能sax回退,有位置错误风险 appendtext(math.max(tagstart,start)+1); } } } function copylocator(f,t){ t.linenumber = f.linenumber; t.columnnumber = f.columnnumber; return t; } /** * @see #appendelement(source,elstartend,el,selfclosed,entityreplacer,dombuilder,parsestack); * @return end of the elementstartpart(end of elementendpart for selfclosed el) */ function parseelementstartpart(source,start,el,currentnsmap,entityreplacer,errorhandler){ /** * @param {string} qname * @param {string} value * @param {number} startindex */ function addattribute(qname, value, startindex) { if (el.attributenames.hasownproperty(qname)) { errorhandler.fatalerror('attribute ' + qname + ' redefined') } el.addvalue( qname, // @see https://www.w3.org/tr/xml/#avnormalize // since the xmldom sax parser does not "interpret" dtd the following is not implemented: // - recursive replacement of (dtd) entity references // - trimming and collapsing multiple spaces into a single one for attributes that are not of type cdata value.replace(/[\t\n\r]/g, ' ').replace(/&#?\w+;/g, entityreplacer), startindex ) } var attrname; var value; var p = ++start; var s = s_tag;//status while(true){ var c = source.charat(p); switch(c){ case '=': if(s === s_attr){//attrname attrname = source.slice(start,p); s = s_eq; }else if(s === s_attr_space){ s = s_eq; }else{ //fatalerror: equal must after attrname or space after attrname throw new error('attribute equal must after attrname'); // no known test case } break; case '\'': case '"': if(s === s_eq || s === s_attr //|| s == s_attr_space ){//equal if(s === s_attr){ errorhandler.warning('attribute value must after "="') attrname = source.slice(start,p) } start = p+1; p = source.indexof(c,start) if(p>0){ value = source.slice(start, p); addattribute(attrname, value, start-1); s = s_attr_end; }else{ //fatalerror: no end quot match throw new error('attribute value no end \''+c+'\' match'); } }else if(s == s_attr_noquot_value){ value = source.slice(start, p); addattribute(attrname, value, start); errorhandler.warning('attribute "'+attrname+'" missed start quot('+c+')!!'); start = p+1; s = s_attr_end }else{ //fatalerror: no equal before throw new error('attribute value must after "="'); // no known test case } break; case '/': switch(s){ case s_tag: el.settagname(source.slice(start,p)); case s_attr_end: case s_tag_space: case s_tag_close: s =s_tag_close; el.closed = true; case s_attr_noquot_value: case s_attr: break; case s_attr_space: el.closed = true; break; //case s_eq: default: throw new error("attribute invalid close char('/')") // no known test case } break; case ''://end document errorhandler.error('unexpected end of input'); if(s == s_tag){ el.settagname(source.slice(start,p)); } return p; case '>': switch(s){ case s_tag: el.settagname(source.slice(start,p)); case s_attr_end: case s_tag_space: case s_tag_close: break;//normal case s_attr_noquot_value://compatible state case s_attr: value = source.slice(start,p); if(value.slice(-1) === '/'){ el.closed = true; value = value.slice(0,-1) } case s_attr_space: if(s === s_attr_space){ value = attrname; } if(s == s_attr_noquot_value){ errorhandler.warning('attribute "'+value+'" missed quot(")!'); addattribute(attrname, value, start) }else{ if(!namespace.ishtml(currentnsmap['']) || !value.match(/^(?:disabled|checked|selected)$/i)){ errorhandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!') } addattribute(value, value, start) } break; case s_eq: throw new error('attribute value missed!!'); } // console.log(tagname,tagnamepattern,tagnamepattern.test(tagname)) return p; /*xml space '\x20' | #x9 | #xd | #xa; */ case '\u0080': c = ' '; default: if(c<= ' '){//space switch(s){ case s_tag: el.settagname(source.slice(start,p));//tagname s = s_tag_space; break; case s_attr: attrname = source.slice(start,p) s = s_attr_space; break; case s_attr_noquot_value: var value = source.slice(start, p); errorhandler.warning('attribute "'+value+'" missed quot(")!!'); addattribute(attrname, value, start) case s_attr_end: s = s_tag_space; break; //case s_tag_space: //case s_eq: //case s_attr_space: // void();break; //case s_tag_close: //ignore warning } }else{//not space //s_tag, s_attr, s_eq, s_attr_noquot_value //s_attr_space, s_attr_end, s_tag_space, s_tag_close switch(s){ //case s_tag:void();break; //case s_attr:void();break; //case s_attr_noquot_value:void();break; case s_attr_space: var tagname = el.tagname; if (!namespace.ishtml(currentnsmap['']) || !attrname.match(/^(?:disabled|checked|selected)$/i)) { errorhandler.warning('attribute "'+attrname+'" missed value!! "'+attrname+'" instead2!!') } addattribute(attrname, attrname, start); start = p; s = s_attr; break; case s_attr_end: errorhandler.warning('attribute space is required"'+attrname+'"!!') case s_tag_space: s = s_attr; start = p; break; case s_eq: s = s_attr_noquot_value; start = p; break; case s_tag_close: throw new error("elements closed character '/' and '>' must be connected to"); } } }//end outer switch //console.log('p++',p) p++; } } /** * @return true if has new namespace define */ function appendelement(el,dombuilder,currentnsmap){ var tagname = el.tagname; var localnsmap = null; //var currentnsmap = parsestack[parsestack.length-1].currentnsmap; var i = el.length; while(i--){ var a = el[i]; var qname = a.qname; var value = a.value; var nsp = qname.indexof(':'); if(nsp>0){ var prefix = a.prefix = qname.slice(0,nsp); var localname = qname.slice(nsp+1); var nsprefix = prefix === 'xmlns' && localname }else{ localname = qname; prefix = null nsprefix = qname === 'xmlns' && '' } //can not set prefix,because prefix !== '' a.localname = localname ; //prefix == null for no ns prefix attribute if(nsprefix !== false){//hack!! if(localnsmap == null){ localnsmap = {} //console.log(currentnsmap,0) _copy(currentnsmap,currentnsmap={}) //console.log(currentnsmap,1) } currentnsmap[nsprefix] = localnsmap[nsprefix] = value; a.uri = namespace.xmlns dombuilder.startprefixmapping(nsprefix, value) } } var i = el.length; while(i--){ a = el[i]; var prefix = a.prefix; if(prefix){//no prefix attribute has no namespace if(prefix === 'xml'){ a.uri = namespace.xml; }if(prefix !== 'xmlns'){ a.uri = currentnsmap[prefix || ''] //{console.log('###'+a.qname,dombuilder.locator.systemid+'',currentnsmap,a.uri)} } } } var nsp = tagname.indexof(':'); if(nsp>0){ prefix = el.prefix = tagname.slice(0,nsp); localname = el.localname = tagname.slice(nsp+1); }else{ prefix = null;//important!! localname = el.localname = tagname; } //no prefix element has default namespace var ns = el.uri = currentnsmap[prefix || '']; dombuilder.startelement(ns,localname,tagname,el); //endprefixmapping and startprefixmapping have not any help for dom builder //localnsmap = null if(el.closed){ dombuilder.endelement(ns,localname,tagname); if(localnsmap){ for (prefix in localnsmap) { if (object.prototype.hasownproperty.call(localnsmap, prefix)) { dombuilder.endprefixmapping(prefix); } } } }else{ el.currentnsmap = currentnsmap; el.localnsmap = localnsmap; //parsestack.push(el); return true; } } function parsehtmlspecialcontent(source,elstartend,tagname,entityreplacer,dombuilder){ if(/^(?:script|textarea)$/i.test(tagname)){ var elendstart = source.indexof('',elstartend); var text = source.substring(elstartend+1,elendstart); if(/[&<]/.test(text)){ if(/^script$/i.test(tagname)){ //if(!/\]\]>/.test(text)){ //lexhandler.startcdata(); dombuilder.characters(text,0,text.length); //lexhandler.endcdata(); return elendstart; //} }//}else{//text area text = text.replace(/&#?\w+;/g,entityreplacer); dombuilder.characters(text,0,text.length); return elendstart; //} } } return elstartend+1; } function fixselfclosed(source,elstartend,tagname,closemap){ //if(tagname in closemap){ var pos = closemap[tagname]; if(pos == null){ //console.log(tagname) pos = source.lastindexof('') if(pos',start+4); //append comment source.substring(4,end)//