From 2cf0fedc65c8a3100f03794c09a6028f7bf60694 Mon Sep 17 00:00:00 2001 From: Siddharth Gabu Date: Mon, 26 Aug 2024 22:13:27 +0530 Subject: [PATCH] Initial commit --- 404.html | 306 ++++++++++++++++++++++++++ EBML.min.js | 1 + icons/browserconfig.xml | 12 + icons/favicon-114x114.png | Bin 0 -> 6668 bytes icons/favicon-120x120.png | Bin 0 -> 6972 bytes icons/favicon-128x128.png | Bin 0 -> 7661 bytes icons/favicon-144x144.png | Bin 0 -> 8728 bytes icons/favicon-150x150.png | Bin 0 -> 9048 bytes icons/favicon-152x152.png | Bin 0 -> 9245 bytes icons/favicon-16x16.png | Bin 0 -> 628 bytes icons/favicon-180x180.png | Bin 0 -> 11208 bytes icons/favicon-192x192.png | Bin 0 -> 12039 bytes icons/favicon-310x310.png | Bin 0 -> 20648 bytes icons/favicon-32x32.png | Bin 0 -> 1558 bytes icons/favicon-384x384.png | Bin 0 -> 26575 bytes icons/favicon-512x512.png | Bin 0 -> 38178 bytes icons/favicon-57x57.png | Bin 0 -> 3138 bytes icons/favicon-60x60.png | Bin 0 -> 3372 bytes icons/favicon-70x70.png | Bin 0 -> 3943 bytes icons/favicon-72x72.png | Bin 0 -> 4110 bytes icons/favicon-76x76.png | Bin 0 -> 4349 bytes icons/favicon-96x96.png | Bin 0 -> 5463 bytes icons/favicon.ico | Bin 0 -> 372526 bytes icons/manifest.json | 60 +++++ images/camera-solid.svg | 1 + images/display-solid.svg | 1 + images/favicon-512x512.png | Bin 0 -> 38178 bytes images/microphone-solid.svg | 1 + images/screen-capture-svgrepo-com.svg | 4 + images/screen-svgrepo-com.svg | 4 + images/video-solid.svg | 1 + index.html | 117 ++++++++++ recorder.js | 225 +++++++++++++++++++ style.css | 278 +++++++++++++++++++++++ 34 files changed, 1011 insertions(+) create mode 100644 404.html create mode 100644 EBML.min.js create mode 100644 icons/browserconfig.xml create mode 100644 icons/favicon-114x114.png create mode 100644 icons/favicon-120x120.png create mode 100644 icons/favicon-128x128.png create mode 100644 icons/favicon-144x144.png create mode 100644 icons/favicon-150x150.png create mode 100644 icons/favicon-152x152.png create mode 100644 icons/favicon-16x16.png create mode 100644 icons/favicon-180x180.png create mode 100644 icons/favicon-192x192.png create mode 100644 icons/favicon-310x310.png create mode 100644 icons/favicon-32x32.png create mode 100644 icons/favicon-384x384.png create mode 100644 icons/favicon-512x512.png create mode 100644 icons/favicon-57x57.png create mode 100644 icons/favicon-60x60.png create mode 100644 icons/favicon-70x70.png create mode 100644 icons/favicon-72x72.png create mode 100644 icons/favicon-76x76.png create mode 100644 icons/favicon-96x96.png create mode 100644 icons/favicon.ico create mode 100644 icons/manifest.json create mode 100644 images/camera-solid.svg create mode 100644 images/display-solid.svg create mode 100644 images/favicon-512x512.png create mode 100644 images/microphone-solid.svg create mode 100644 images/screen-capture-svgrepo-com.svg create mode 100644 images/screen-svgrepo-com.svg create mode 100644 images/video-solid.svg create mode 100644 index.html create mode 100644 recorder.js create mode 100644 style.css diff --git a/404.html b/404.html new file mode 100644 index 0000000..3eb2f3c --- /dev/null +++ b/404.html @@ -0,0 +1,306 @@ + + + + Oops! Page Not Found + + + + + + + + + + + + + + + + + +
+ +
+

404

+

Uh-oh! Looks like you've hit a black hole in cyberspace.

+

Either this page got lost in the intergalactic space or the aliens abducted it!

+ This Content Is Not Available +

When you realize you don't know where you are.

+

But no worries, you can always return to Earth.

+
+ +
+
+
+
+
+

About Us

+

Collegeek is online learning platform. It contains well written, well thought and well explained articles and tools. While creating the site, we have tried to be thorough and we continually put our efforts to improve the quality of the content.

+
    +
  • +
+
+ +
+

Contact Info

+ +
+
+
+
+

+ © Copyright 2020- by Collegeek. All Rights Reserved. +

+
+
+ + diff --git a/EBML.min.js b/EBML.min.js new file mode 100644 index 0000000..e9d9aa8 --- /dev/null +++ b/EBML.min.js @@ -0,0 +1 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.EBML=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i=this._buffer.length){return false}const tag=(0,tools_1.readVint)(this._buffer,this._cursor);if(tag==null){return false}const buf=this._buffer.subarray(this._cursor,this._cursor+tag.length);const tagNum=buf.reduce((o,v,i,arr)=>o+v*Math.pow(16,2*(arr.length-1-i)),0);const schema=this.getSchemaInfo(tagNum);const tagObj={EBML_ID:tagNum.toString(16),schema:schema,type:schema.type,name:schema.name,level:schema.level,tagStart:this._total,tagEnd:this._total+tag.length,sizeStart:this._total+tag.length,sizeEnd:null,dataStart:null,dataEnd:null,dataSize:null,data:null};this._tag_stack.push(tagObj);this._cursor+=tag.length;this._total+=tag.length;this._state=State.STATE_SIZE;return true}readSize(){if(this._cursor>=this._buffer.length){return false}const size=(0,tools_1.readVint)(this._buffer,this._cursor);if(size==null){return false}const tagObj=this._tag_stack[this._tag_stack.length-1];if(tagObj==null){return false}tagObj.sizeEnd=tagObj.sizeStart+size.length;tagObj.dataStart=tagObj.sizeEnd;tagObj.dataSize=size.value;if(size.value===-1){tagObj.dataEnd=-1;if(tagObj.type==="m"){tagObj.unknownSize=true}}else{tagObj.dataEnd=tagObj.sizeEnd+size.value}this._cursor+=size.length;this._total+=size.length;this._state=State.STATE_CONTENT;return true}readContent(){const tagObj=this._tag_stack[this._tag_stack.length-1];if(tagObj==null){return false}if(tagObj.type==="m"){tagObj.isEnd=false;this._result.push(tagObj);this._state=State.STATE_TAG;if(tagObj.dataSize===0){const elm=Object.assign({},tagObj,{isEnd:true});this._result.push(elm);this._tag_stack.pop()}return true}if(this._buffer.length6){tagObj.value=Number((0,bigint_buffer_1.toBigIntBE)(data))}else{tagObj.value=data.readUIntBE(0,data.length)}break}case"i":{tagObj.value=data.readIntBE(0,data.length);break}case"f":{if(tagObj.dataSize===4){tagObj.value=data.readFloatBE(0)}else if(tagObj.dataSize===8){tagObj.value=data.readDoubleBE(0)}else{console.warn(`cannot read ${tagObj.dataSize} octets float. failback to 0`);tagObj.value=0}break}case"s":{tagObj.value=data.toString("ascii");break}case"8":{tagObj.value=data.toString("utf8");break}case"b":{tagObj.value=data;break}case"d":{tagObj.value=(0,tools_1.convertEBMLDateToJSDate)(Number((0,bigint_buffer_1.toBigIntBE)(data)));break}}if(tagObj.value===null){throw new Error("unknown tag type:"+tagObj.type)}this._result.push(tagObj);this._total+=tagObj.dataSize;this._state=State.STATE_TAG;this._cursor=0;this._tag_stack.pop();while(this._tag_stack.length>0){const topEle=this._tag_stack[this._tag_stack.length-1];if(topEle==null){return false}if(topEle.dataEnd<0){this._tag_stack.pop();return true}if(this._totallst.concat(this.encodeChunk(elm)),[])).buffer}encodeChunk(elm){if(elm.type==="m"){if(!elm.isEnd){this.startTag(elm)}else{this.endTag(elm)}}else{elm.data=Buffer.from(elm.data);this.writeTag(elm)}return this.flush()}flush(){const ret=this._buffers;this._buffers=[];return ret}getSchemaInfo(tagName){for(const[tagNum,tagVal]of Object.entries(this._schema)){if(tagVal.name===tagName){return Buffer.from(Number(tagNum).toString(16),"hex")}}return null}writeTag(elm){const tagName=elm.name;const tagId=this.getSchemaInfo(tagName);const tagData=elm.data;if(tagId==null){throw new Error("No schema entry found for "+tagName)}const data=tools.encodeTag(tagId,tagData);if(this._stack.length>0){const last=this._stack[this._stack.length-1];last.children.push({tagId:tagId,elm:elm,children:[],data:data});return}this._buffers=this._buffers.concat(data);return}startTag(elm){const tagName=elm.name;const tagId=this.getSchemaInfo(tagName);if(tagId==null){throw new Error("No schema entry found for "+tagName)}if(elm.unknownSize){const data=tools.encodeTag(tagId,Buffer.alloc(0),elm.unknownSize);this._buffers=this._buffers.concat(data);return}const tag={tagId:tagId,elm:elm,children:[],data:null};if(this._stack.length>0){this._stack[this._stack.length-1].children.push(tag)}this._stack.push(tag)}endTag(elm){const tag=this._stack.pop();if(tag==null){throw new Error("EBML structure is broken")}if(tag.elm.name!==elm.name){throw new Error("EBML structure is broken")}const childTagDataBuffers=tag.children.reduce((lst,child)=>{if(child.data===null){throw new Error("EBML structure is broken")}return lst.concat(child.data)},[]);const childTagDataBuffer=tools.concat(childTagDataBuffers);if(tag.elm.type==="m"){tag.data=tools.encodeTag(tag.tagId,childTagDataBuffer,tag.elm.unknownSize)}else{tag.data=tools.encodeTag(tag.tagId,childTagDataBuffer)}if(this._stack.length<1){this._buffers=this._buffers.concat(tag.data)}}}exports.default=EBMLEncoder}).call(this)}).call(this,require("buffer").Buffer)},{"./tools":6,buffer:9,"matroska-schema":20}],4:[function(require,module,exports){"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){if(k2===undefined)k2=k;var desc=Object.getOwnPropertyDescriptor(m,k);if(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable)){desc={enumerable:true,get:function(){return m[k]}}}Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){if(k2===undefined)k2=k;o[k2]=m[k]});var __setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:true,value:v})}:function(o,v){o["default"]=v});var __importStar=this&&this.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)if(k!=="default"&&Object.prototype.hasOwnProperty.call(mod,k))__createBinding(result,mod,k);__setModuleDefault(result,mod);return result};Object.defineProperty(exports,"__esModule",{value:true});const events_1=require("events");const tools=__importStar(require("./tools"));class EBMLReader extends events_1.EventEmitter{constructor(){super();this.logGroup="";this.hasLoggingStarted=false;this.metadataloaded=false;this.chunks=[];this.stack=[];this.segmentOffset=0;this.last2SimpleBlockVideoTrackTimestamp=[0,0];this.last2SimpleBlockAudioTrackTimestamp=[0,0];this.lastClusterTimestamp=0;this.lastClusterPosition=0;this.timestampScale=1e6;this.metadataSize=0;this.metadatas=[];this.cues=[];this.firstVideoBlockRead=false;this.firstAudioBlockRead=false;this.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null};this.trackTypes=[];this.trackDefaultDuration=[];this.trackCodecDelay=[];this.trackInfo={type:"nothing"};this.ended=false;this.logging=false;this.use_duration_every_simpleblock=false;this.use_webp=false;this.use_segment_info=true;this.drop_default_duration=true}stop(){this.ended=true;this.emit_segment_info();while(this.stack.length){this.stack.pop();if(this.logging){console.groupEnd()}}if(this.logging&&this.hasLoggingStarted&&this.logGroup){console.groupEnd()}}emit_segment_info(){const data=this.chunks;this.chunks=[];if(!this.metadataloaded){this.metadataloaded=true;this.metadatas=data;const videoTrackNum=this.trackTypes.indexOf(1);const audioTrackNum=this.trackTypes.indexOf(2);this.trackInfo=videoTrackNum>=0&&audioTrackNum>=0?{type:"both",trackNumber:videoTrackNum}:videoTrackNum>=0?{type:"video",trackNumber:videoTrackNum}:audioTrackNum>=0?{type:"audio",trackNumber:audioTrackNum}:{type:"nothing"};if(!this.use_segment_info){return}this.emit("metadata",{data:data,metadataSize:this.metadataSize})}else{if(!this.use_segment_info){return}const timestamp=this.lastClusterTimestamp;const duration=this.duration;const timestampScale=this.timestampScale;this.emit("cluster",{timestamp:timestamp,data:data});this.emit("duration",{timestampScale:timestampScale,duration:duration})}}read(elm){let drop=false;if(this.ended){return}if(elm.type==="m"){if(elm.isEnd){this.stack.pop()}else{const parent=this.stack[this.stack.length-1];if(parent!=null&&parent.level>=elm.level){this.stack.pop();if(this.logging){console.groupEnd()}parent.dataEnd=elm.dataEnd;parent.dataSize=elm.dataEnd-parent.dataStart;parent.unknownSize=false;const o=Object.assign({},parent,{name:parent.name,type:parent.type,isEnd:true});this.chunks.push(o)}this.stack.push(elm)}}if(elm.type==="m"&&elm.name==="Segment"){if(this.segmentOffset!==0){console.warn("Multiple segments detected!")}this.segmentOffset=elm.dataStart;this.emit("segment_offset",this.segmentOffset)}else if(elm.type==="b"&&elm.name==="SimpleBlock"){const{timecode:timestamp,trackNumber,frames}=tools.ebmlBlock(elm.data);if(this.trackTypes[trackNumber]===1){if(!this.firstVideoBlockRead){this.firstVideoBlockRead=true;if(this.trackInfo.type==="both"||this.trackInfo.type==="video"){const CueTime=this.lastClusterTimestamp+timestamp;this.cues.push({CueTrack:trackNumber,CueClusterPosition:this.lastClusterPosition,CueTime:CueTime});this.emit("cue_info",{CueTrack:trackNumber,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimestamp});this.emit("cue",{CueTrack:trackNumber,CueClusterPosition:this.lastClusterPosition,CueTime:CueTime})}}this.last2SimpleBlockVideoTrackTimestamp=[this.last2SimpleBlockVideoTrackTimestamp[1],timestamp]}else if(this.trackTypes[trackNumber]===2){if(!this.firstAudioBlockRead){this.firstAudioBlockRead=true;if(this.trackInfo.type==="audio"){const CueTime=this.lastClusterTimestamp+timestamp;this.cues.push({CueTrack:trackNumber,CueClusterPosition:this.lastClusterPosition,CueTime:CueTime});this.emit("cue_info",{CueTrack:trackNumber,CueClusterPosition:this.lastClusterPosition,CueTime:this.lastClusterTimestamp});this.emit("cue",{CueTrack:trackNumber,CueClusterPosition:this.lastClusterPosition,CueTime:CueTime})}}this.last2SimpleBlockAudioTrackTimestamp=[this.last2SimpleBlockAudioTrackTimestamp[1],timestamp]}if(this.use_duration_every_simpleblock){this.emit("duration",{timestampScale:this.timestampScale,duration:this.duration})}if(this.use_webp){for(const frame of frames){const startcode=frame.subarray(3,6).toString("hex");if(startcode!=="9d012a"){break}const webpBuf=tools.VP8BitStreamToRiffWebPBuffer(frame);const webp=new Blob([webpBuf],{type:"image/webp"});const currentTime=this.duration;this.emit("webp",{currentTime:currentTime,webp:webp})}}}else if(elm.type==="m"&&elm.name==="Cluster"&&!elm.isEnd){this.firstVideoBlockRead=false;this.firstAudioBlockRead=false;this.emit_segment_info();this.emit("cluster_ptr",elm.tagStart);this.lastClusterPosition=elm.tagStart}else if(elm.type==="u"&&elm.name==="Timestamp"){this.lastClusterTimestamp=elm.value}else if(elm.type==="u"&&elm.name==="TimestampScale"){this.timestampScale=elm.value}else if(elm.type==="m"&&elm.name==="TrackEntry"){if(elm.isEnd){this.trackTypes[this.currentTrack.TrackNumber]=this.currentTrack.TrackType;this.trackDefaultDuration[this.currentTrack.TrackNumber]=this.currentTrack.DefaultDuration;this.trackCodecDelay[this.currentTrack.TrackNumber]=this.currentTrack.CodecDelay}else{this.currentTrack={TrackNumber:-1,TrackType:-1,DefaultDuration:null,CodecDelay:null}}}else if(elm.type==="u"&&elm.name==="TrackType"){this.currentTrack.TrackType=elm.value}else if(elm.type==="u"&&elm.name==="TrackNumber"){this.currentTrack.TrackNumber=elm.value}else if(elm.type==="u"&&elm.name==="CodecDelay"){this.currentTrack.CodecDelay=elm.value}else if(elm.type==="u"&&elm.name==="DefaultDuration"){if(this.drop_default_duration){console.warn("DefaultDuration detected!, remove it");drop=true}else{this.currentTrack.DefaultDuration=elm.value}}else if(elm.name==="unknown"){console.warn(elm)}if(!this.metadataloaded&&elm.dataEnd>0){this.metadataSize=elm.dataEnd}if(!drop){this.chunks.push(elm)}if(this.logging){this.put(elm)}}get duration(){if(this.trackInfo.type==="nothing"){console.warn("no video, no audio track");return 0}let defaultDuration=0;let codecDelay=0;let lastTimestamp=0;const _defaultDuration=this.trackDefaultDuration[this.trackInfo.trackNumber];if(typeof _defaultDuration==="number"){defaultDuration=_defaultDuration}else{if(this.trackInfo.type==="both"){if(this.last2SimpleBlockAudioTrackTimestamp[1]>this.last2SimpleBlockVideoTrackTimestamp[1]){defaultDuration=(this.last2SimpleBlockAudioTrackTimestamp[1]-this.last2SimpleBlockAudioTrackTimestamp[0])*this.timestampScale;const delay=this.trackCodecDelay[this.trackTypes.indexOf(2)];if(typeof delay==="number"){codecDelay=delay}lastTimestamp=this.last2SimpleBlockAudioTrackTimestamp[1]}else{defaultDuration=(this.last2SimpleBlockVideoTrackTimestamp[1]-this.last2SimpleBlockVideoTrackTimestamp[0])*this.timestampScale;const delay=this.trackCodecDelay[this.trackTypes.indexOf(1)];if(typeof delay==="number"){codecDelay=delay}lastTimestamp=this.last2SimpleBlockVideoTrackTimestamp[1]}}else if(this.trackInfo.type==="video"){defaultDuration=(this.last2SimpleBlockVideoTrackTimestamp[1]-this.last2SimpleBlockVideoTrackTimestamp[0])*this.timestampScale;const delay=this.trackCodecDelay[this.trackInfo.trackNumber];if(typeof delay==="number"){codecDelay=delay}lastTimestamp=this.last2SimpleBlockVideoTrackTimestamp[1]}else if(this.trackInfo.type==="audio"){defaultDuration=(this.last2SimpleBlockAudioTrackTimestamp[1]-this.last2SimpleBlockAudioTrackTimestamp[0])*this.timestampScale;const delay=this.trackCodecDelay[this.trackInfo.trackNumber];if(typeof delay==="number"){codecDelay=delay}lastTimestamp=this.last2SimpleBlockAudioTrackTimestamp[1]}}const duration_nanosec=(this.lastClusterTimestamp+lastTimestamp)*this.timestampScale+defaultDuration-codecDelay;const duration=duration_nanosec/this.timestampScale;return Math.floor(duration)}addListener(event,listener){return super.addListener(event,listener)}put(elm){if(!this.hasLoggingStarted){this.hasLoggingStarted=true;if(this.logging&&this.logGroup){console.groupCollapsed(this.logGroup)}}if(elm.type==="m"){if(elm.isEnd){console.groupEnd()}else{console.group(elm.name+":"+elm.tagStart)}}else if(elm.type==="b"){console.log(elm.name,elm.type)}else{console.log(elm.name,elm.tagStart,elm.type,elm.value)}}}exports.default=EBMLReader},{"./tools":6,events:17}],5:[function(require,module,exports){"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(o,m,k,k2){if(k2===undefined)k2=k;var desc=Object.getOwnPropertyDescriptor(m,k);if(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable)){desc={enumerable:true,get:function(){return m[k]}}}Object.defineProperty(o,k2,desc)}:function(o,m,k,k2){if(k2===undefined)k2=k;o[k2]=m[k]});var __setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:true,value:v})}:function(o,v){o["default"]=v});var __exportStar=this&&this.__exportStar||function(m,exports){for(var p in m)if(p!=="default"&&!Object.prototype.hasOwnProperty.call(exports,p))__createBinding(exports,m,p)};var __importStar=this&&this.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)if(k!=="default"&&Object.prototype.hasOwnProperty.call(mod,k))__createBinding(result,mod,k);__setModuleDefault(result,mod);return result};var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:true});exports.tools=exports.Reader=exports.Encoder=exports.Decoder=exports.version=void 0;__exportStar(require("./EBML"),exports);const EBMLDecoder_1=__importDefault(require("./EBMLDecoder"));exports.Decoder=EBMLDecoder_1.default;const EBMLEncoder_1=__importDefault(require("./EBMLEncoder"));exports.Encoder=EBMLEncoder_1.default;const EBMLReader_1=__importDefault(require("./EBMLReader"));exports.Reader=EBMLReader_1.default;const tools=__importStar(require("./tools"));exports.tools=tools;const version=require("../package.json").version;exports.version=version},{"../package.json":22,"./EBML":1,"./EBMLDecoder":2,"./EBMLEncoder":3,"./EBMLReader":4,"./tools":6}],6:[function(require,module,exports){(function(Buffer){(function(){"use strict";var __importDefault=this&&this.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports,"__esModule",{value:true});exports.convertEBMLDateToJSDate=exports.createFloatBuffer=exports.createIntBuffer=exports.createUIntBuffer=exports.encodeValueToBuffer=exports.concat=exports.putRefinedMetaData=exports.extractElement=exports.removeElement=exports.makeMetadataSeekable=exports.createRIFFChunk=exports.VP8BitStreamToRiffWebPBuffer=exports.WebPBlockFilter=exports.WebPFrameFilter=exports.encodeTag=exports.readBlock=exports.ebmlBlock=exports.writeVint=exports.readVint=void 0;const int64_buffer_1=require("int64-buffer");const EBMLEncoder_1=__importDefault(require("./EBMLEncoder"));const{tools:_tools}=require("ebml/lib/ebml.js");const _block=require("ebml-block");exports.readVint=_tools.readVint;exports.writeVint=_tools.writeVint;exports.ebmlBlock=_block;function readBlock(buf){return(0,exports.ebmlBlock)(Buffer.from(buf))}exports.readBlock=readBlock;function encodeTag(tagId,tagData,unknownSize=false){return concat([tagId,unknownSize?Buffer.from("01ffffffffffffff","hex"):(0,exports.writeVint)(tagData.length),tagData])}exports.encodeTag=encodeTag;function WebPFrameFilter(elms){return WebPBlockFilter(elms).reduce((lst,elm)=>{const o=(0,exports.ebmlBlock)(elm.data);return o.frames.reduce((lst,frame)=>{const webpBuf=VP8BitStreamToRiffWebPBuffer(frame);const webp=new Blob([webpBuf],{type:"image/webp"});return lst.concat(webp)},lst)},[])}exports.WebPFrameFilter=WebPFrameFilter;function WebPBlockFilter(elms){return elms.reduce((lst,elm)=>{if(elm.type!=="b"){return lst}if(elm.name!=="SimpleBlock"){return lst}const o=(0,exports.ebmlBlock)(elm.data);const hasWebP=o.frames.some(frame=>{const startcode=frame.subarray(3,6).toString("hex");return startcode==="9d012a"});if(!hasWebP){return lst}return lst.concat(elm)},[])}exports.WebPBlockFilter=WebPBlockFilter;function VP8BitStreamToRiffWebPBuffer(frame){const VP8Chunk=createRIFFChunk("VP8 ",frame);const WebPChunk=concat([Buffer.from("WEBP","ascii"),VP8Chunk]);return createRIFFChunk("RIFF",WebPChunk)}exports.VP8BitStreamToRiffWebPBuffer=VP8BitStreamToRiffWebPBuffer;function createRIFFChunk(FourCC,chunk){const chunkSize=Buffer.alloc(4);chunkSize.writeUInt32LE(chunk.byteLength,0);return concat([Buffer.from(FourCC.substring(0,4),"ascii"),chunkSize,chunk,Buffer.alloc(chunk.byteLength%2===0?0:1)])}exports.createRIFFChunk=createRIFFChunk;function makeMetadataSeekable(originalMetadata,duration,cuesInfo,cuesOffset=0,cuesPosition=0){const header=extractElement("EBML",originalMetadata);const headerSize=encodedSizeOfEbml(header);const segmentContentStartPos=headerSize+12;const originalMetadataSize=originalMetadata[originalMetadata.length-1].dataEnd-segmentContentStartPos;const info=extractElement("Info",originalMetadata);removeElement("Duration",info);info.splice(1,0,{name:"Duration",type:"f",data:createFloatBuffer(duration,8)});const infoSize=encodedSizeOfEbml(info);const tracks=extractElement("Tracks",originalMetadata);const tracksSize=encodedSizeOfEbml(tracks);let seekHeadSize=47;let seekHead=[];let cuesSize=5+cuesInfo.length*15;let cues=[];let lastSizeDifference=-1;const maxIterations=10;for(let i=0;i0)){throw new Error("metadata dataEnd has wrong number")}const originalPayloadOffsetEnd=payload[payload.length-1].dataEnd;const ebmlSize=ebml[ebml.length-1].dataEnd;const refinedEBMLSize=(new EBMLEncoder_1.default).encode(ebml).byteLength;const offsetDiff=refinedEBMLSize-ebmlSize;const payloadSize=originalPayloadOffsetEnd-payload[0].tagStart;const segmentTagBuf=Buffer.from([24,83,128,103]);const segmentSizeBuf=Buffer.from("01ffffffffffffff","hex");const _segmentSize=segmentTagBuf.byteLength+segmentSizeBuf.byteLength;let newPayloadSize=payloadSize;const count=20;for(let i=1;ilst.concat(encorder.encode([elm])),[]).reduce((o,buf)=>o+buf.byteLength,0)}function refineMetadata(mesetadata,sizeDiff,info){const{duration,clusterPtrs,cues}=info;const _metadata=mesetadata.slice(0);if(typeof duration==="number"){let overwrited=false;for(const elm of _metadata){if(elm.type==="f"&&elm.name==="Duration"){overwrited=true;elm.data=createFloatBuffer(duration,8)}}if(!overwrited){insertTag(_metadata,"Info",[{name:"Duration",type:"f",data:createFloatBuffer(duration,8)}])}}if(Array.isArray(cues)){insertTag(_metadata,"Cues",create_cue(cues,sizeDiff))}let seekhead_children=[];if(Array.isArray(clusterPtrs)){console.warn("append cluster pointers to seekhead is deprecated. please use cues");seekhead_children=create_seek_from_clusters(clusterPtrs,sizeDiff)}insertTag(_metadata,"SeekHead",seekhead_children,true);return _metadata}function create_seek_from_clusters(clusterPtrs,sizeDiff){const seeks=[];for(const start of clusterPtrs){seeks.push({name:"Seek",type:"m",isEnd:false});seeks.push({name:"SeekID",type:"b",data:Buffer.from([31,67,182,117])});seeks.push({name:"SeekPosition",type:"u",data:createUIntBuffer(start+sizeDiff)});seeks.push({name:"Seek",type:"m",isEnd:true})}return seeks}function create_cue(cueInfos,sizeDiff){const cues=[];for(const{CueTrack,CueClusterPosition,CueTime}of cueInfos){cues.push({name:"CuePoint",type:"m",isEnd:false});cues.push({name:"CueTime",type:"u",data:createUIntBuffer(CueTime)});cues.push({name:"CueTrackPositions",type:"m",isEnd:false});cues.push({name:"CueTrack",type:"u",data:createUIntBuffer(CueTrack)});cues.push({name:"CueClusterPosition",type:"u",data:createUIntBuffer(CueClusterPosition+sizeDiff)});cues.push({name:"CueTrackPositions",type:"m",isEnd:true});cues.push({name:"CuePoint",type:"m",isEnd:true})}return cues}function insertTag(_metadata,tagName,children,insertHead=false){let idx=-1;for(let i=0;i<_metadata.length;i++){const elm=_metadata[i];if(elm.type==="m"&&elm.name===tagName&&!elm.isEnd){idx=i;break}}if(idx>=0){Array.prototype.splice.apply(_metadata,[idx+1,0].concat(children))}else if(insertHead){const elms=[].concat([{name:tagName,type:"m",isEnd:false}],children,[{name:tagName,type:"m",isEnd:true}]);elms.reverse();for(const elm of elms){_metadata.unshift(elm)}}else{_metadata.push({name:tagName,type:"m",isEnd:false});for(const elm of children){_metadata.push(elm)}_metadata.push({name:tagName,type:"m",isEnd:true})}}function concat(list){return Buffer.concat(list)}exports.concat=concat;function encodeValueToBuffer(elm){let data=Buffer.alloc(0);if(elm.type==="m"){return elm}switch(elm.type){case"u":data=createUIntBuffer(elm.value);break;case"i":data=createIntBuffer(elm.value);break;case"f":data=createFloatBuffer(elm.value);break;case"s":data=Buffer.from(elm.value,"ascii");break;case"8":data=Buffer.from(elm.value,"utf8");break;case"b":data=elm.value;break;case"d":data=new int64_buffer_1.Int64BE(elm.value.getTime().toString()).toBuffer();break}return Object.assign({},elm,{data:data})}exports.encodeValueToBuffer=encodeValueToBuffer;function createUIntBuffer(value){let bytes=1;for(;value>=Math.pow(2,8*bytes);bytes++){void 0}if(bytes>=7){console.warn("7bit or more bigger uint not supported.");return new int64_buffer_1.Uint64BE(value).toBuffer()}const data=Buffer.alloc(bytes);data.writeUIntBE(value,0,bytes);return data}exports.createUIntBuffer=createUIntBuffer;function createIntBuffer(value){let bytes=1;for(;value>=Math.pow(2,8*bytes);bytes++){}if(bytes>=7){console.warn("7bit or more bigger uint not supported.");return new int64_buffer_1.Int64BE(value).toBuffer()}const data=Buffer.alloc(bytes);data.writeIntBE(value,0,bytes);return data}exports.createIntBuffer=createIntBuffer;function createFloatBuffer(value,bytes=8){if(bytes===8){const data=Buffer.alloc(8);data.writeDoubleBE(value,0);return data}else if(bytes===4){const data=Buffer.alloc(4);data.writeFloatBE(value,0);return data}else{throw new Error("float type bits must 4bytes or 8bytes")}}exports.createFloatBuffer=createFloatBuffer;function convertEBMLDateToJSDate(int64str){if(int64str instanceof Date){return int64str}return new Date(new Date("2001-01-01T00:00:00.000Z").getTime()+Number(int64str)/1e3/1e3)}exports.convertEBMLDateToJSDate=convertEBMLDateToJSDate}).call(this)}).call(this,require("buffer").Buffer)},{"./EBMLEncoder":3,buffer:9,"ebml-block":10,"ebml/lib/ebml.js":13,"int64-buffer":19}],7:[function(require,module,exports){"use strict";exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i0){throw new Error("Invalid string. Length must be a multiple of 4")}var validLen=b64.indexOf("=");if(validLen===-1)validLen=len;var placeHoldersLen=validLen===len?0:4-validLen%4;return[validLen,placeHoldersLen]}function byteLength(b64){var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function _byteLength(b64,validLen,placeHoldersLen){return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function toByteArray(b64){var tmp;var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];var arr=new Arr(_byteLength(b64,validLen,placeHoldersLen));var curByte=0;var len=placeHoldersLen>0?validLen-4:validLen;var i;for(i=0;i>16&255;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}if(placeHoldersLen===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[curByte++]=tmp&255}if(placeHoldersLen===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;ilen2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"=")}return parts.join("")}},{}],8:[function(require,module,exports){(function(Buffer){(function(){"use strict";Object.defineProperty(exports,"__esModule",{value:true});let converter;function toBigIntLE(buf){{const reversed=Buffer.from(buf);reversed.reverse();const hex=reversed.toString("hex");if(hex.length===0){return BigInt(0)}return BigInt(`0x${hex}`)}return converter.toBigInt(buf,false)}exports.toBigIntLE=toBigIntLE;function toBigIntBE(buf){{const hex=buf.toString("hex");if(hex.length===0){return BigInt(0)}return BigInt(`0x${hex}`)}return converter.toBigInt(buf,true)}exports.toBigIntBE=toBigIntBE;function toBufferLE(num,width){{const hex=num.toString(16);const buffer=Buffer.from(hex.padStart(width*2,"0").slice(0,width*2),"hex");buffer.reverse();return buffer}return converter.fromBigInt(num,Buffer.allocUnsafe(width),false)}exports.toBufferLE=toBufferLE;function toBufferBE(num,width){{const hex=num.toString(16);return Buffer.from(hex.padStart(width*2,"0").slice(0,width*2),"hex")}return converter.fromBigInt(num,Buffer.allocUnsafe(width),true)}exports.toBufferBE=toBufferBE}).call(this)}).call(this,require("buffer").Buffer)},{buffer:9}],9:[function(require,module,exports){(function(Buffer){(function(){"use strict";var base64=require("base64-js");var ieee754=require("ieee754");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=2147483647;exports.kMaxLength=K_MAX_LENGTH;Buffer.TYPED_ARRAY_SUPPORT=typedArraySupport();if(!Buffer.TYPED_ARRAY_SUPPORT&&typeof console!=="undefined"&&typeof console.error==="function"){console.error("This browser lacks typed array (Uint8Array) support which is required by "+"`buffer` v5.x. Use `buffer` v4.x if you require old browser support.")}function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return arr.foo()===42}catch(e){return false}}Object.defineProperty(Buffer.prototype,"parent",{enumerable:true,get:function(){if(!Buffer.isBuffer(this))return undefined;return this.buffer}});Object.defineProperty(Buffer.prototype,"offset",{enumerable:true,get:function(){if(!Buffer.isBuffer(this))return undefined;return this.byteOffset}});function createBuffer(length){if(length>K_MAX_LENGTH){throw new RangeError('The value "'+length+'" is invalid for option "size"')}var buf=new Uint8Array(length);buf.__proto__=Buffer.prototype;return buf}function Buffer(arg,encodingOrOffset,length){if(typeof arg==="number"){if(typeof encodingOrOffset==="string"){throw new TypeError('The "string" argument must be of type string. Received type number')}return allocUnsafe(arg)}return from(arg,encodingOrOffset,length)}if(typeof Symbol!=="undefined"&&Symbol.species!=null&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true,enumerable:false,writable:false})}Buffer.poolSize=8192;function from(value,encodingOrOffset,length){if(typeof value==="string"){return fromString(value,encodingOrOffset)}if(ArrayBuffer.isView(value)){return fromArrayLike(value)}if(value==null){throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof value)}if(isInstance(value,ArrayBuffer)||value&&isInstance(value.buffer,ArrayBuffer)){return fromArrayBuffer(value,encodingOrOffset,length)}if(typeof value==="number"){throw new TypeError('The "value" argument must not be of type number. Received type number')}var valueOf=value.valueOf&&value.valueOf();if(valueOf!=null&&valueOf!==value){return Buffer.from(valueOf,encodingOrOffset,length)}var b=fromObject(value);if(b)return b;if(typeof Symbol!=="undefined"&&Symbol.toPrimitive!=null&&typeof value[Symbol.toPrimitive]==="function"){return Buffer.from(value[Symbol.toPrimitive]("string"),encodingOrOffset,length)}throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof value)}Buffer.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)};Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;function assertSize(size){if(typeof size!=="number"){throw new TypeError('"size" argument must be of type number')}else if(size<0){throw new RangeError('The value "'+size+'" is invalid for option "size"')}}function alloc(size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(size)}if(fill!==undefined){return typeof encoding==="string"?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill)}return createBuffer(size)}Buffer.alloc=function(size,fill,encoding){return alloc(size,fill,encoding)};function allocUnsafe(size){assertSize(size);return createBuffer(size<0?0:checked(size)|0)}Buffer.allocUnsafe=function(size){return allocUnsafe(size)};Buffer.allocUnsafeSlow=function(size){return allocUnsafe(size)};function fromString(string,encoding){if(typeof encoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}var length=byteLength(string,encoding)|0;var buf=createBuffer(length);var actual=buf.write(string,encoding);if(actual!==length){buf=buf.slice(0,actual)}return buf}function fromArrayLike(array){var length=array.length<0?0:checked(array.length)|0;var buf=createBuffer(length);for(var i=0;i=K_MAX_LENGTH){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+K_MAX_LENGTH.toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return b!=null&&b._isBuffer===true&&b!==Buffer.prototype};Buffer.compare=function compare(a,b){if(isInstance(a,Uint8Array))a=Buffer.from(a,a.offset,a.byteLength);if(isInstance(b,Uint8Array))b=Buffer.from(b,b.offset,b.byteLength);if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array')}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i2&&arguments[2]===true;if(!mustMatch&&len===0)return 0;var loweredCase=false;for(;;){switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return len*2;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase){return mustMatch?-1:utf8ToBytes(string).length}encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;imax)str+=" ... ";return""};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(isInstance(target,Uint8Array)){target=Buffer.from(target,target.offset,target.byteLength)}if(!Buffer.isBuffer(target)){throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. '+"Received type "+typeof target)}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(numberIsNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;jremaining){length=remaining}}var strLen=string.length;if(length>strLen/2){length=strLen/2}for(var i=0;i>>0;if(isFinite(length)){length=length>>>0;if(encoding===undefined)encoding="utf8"}else{encoding=length;length=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var remaining=this.length-offset;if(length===undefined||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(ilen)end=len;var out="";for(var i=start;ilen){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(endlength)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i>>0;byteLength=byteLength>>>0;if(!noAssert){checkOffset(offset,byteLength,this.length)}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);this[offset]=value&255;return offset+1};Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255;return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24;return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,4,34028234663852886e22,-34028234663852886e22)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,8,17976931348623157e292,-17976931348623157e292)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!Buffer.isBuffer(target))throw new TypeError("argument should be a Buffer");if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end=this.length)throw new RangeError("Index out of range");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart=0;--i){target[i+targetStart]=this[i+start]}}else{Uint8Array.prototype.set.call(target,this.subarray(start,end),targetStart)}return len};Buffer.prototype.fill=function fill(val,start,end,encoding){if(typeof val==="string"){if(typeof start==="string"){encoding=start;start=0;end=this.length}else if(typeof end==="string"){encoding=end;end=this.length}if(encoding!==undefined&&typeof encoding!=="string"){throw new TypeError("encoding must be a string")}if(typeof encoding==="string"&&!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}if(val.length===1){var code=val.charCodeAt(0);if(encoding==="utf8"&&code<128||encoding==="latin1"){val=code}}}else if(typeof val==="number"){val=val&255}if(start<0||this.length>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isInstance(obj,type){return obj instanceof type||obj!=null&&obj.constructor!=null&&obj.constructor.name!=null&&obj.constructor.name===type.name}function numberIsNaN(obj){return obj!==obj}}).call(this)}).call(this,require("buffer").Buffer)},{"base64-js":7,buffer:9,ieee754:18}],10:[function(require,module,exports){var BufferReader=require("./lib/buffer-reader");var XIPH_LACING=1;var EBML_LACING=3;var FIXED_SIZE_LACING=2;module.exports=function(buffer){var block={};var reader=new BufferReader(buffer);block.trackNumber=reader.nextUIntV();block.timecode=reader.nextInt16BE();var flags=reader.nextUInt8();block.invisible=!!(flags&8);block.keyframe=!!(flags&128);block.discardable=!!(flags&1);var lacing=(flags&6)>>1;block.frames=readLacedData(reader,lacing);return block};function readLacedData(reader,lacing){if(!lacing)return[reader.nextBuffer()];var i,frameSize;var frames=[];var framesNum=reader.nextUInt8()+1;if(lacing===FIXED_SIZE_LACING){if(reader.length%framesNum!==0)throw new Error("Fixed-Size Lacing Error");frameSize=reader.length/framesNum;for(i=0;i=Math.pow(2,8-length)){break}}if(length>8){throw new Error("Unrepresentable length: "+length+" "+buffer.toString("hex",start,start+length))}if(start+length>buffer.length){return null}var i;var value=buffer[start]&(1<<8-length)-1;for(i=1;i=Math.pow(2,53-8)&&buffer[start+7]>0){return{length:length,value:-1}}}value*=Math.pow(2,8);value+=buffer[start+i]}if(signed){value-=Math.pow(2,length*7-1)-1}return{length:length,value:value}}},{}],13:[function(require,module,exports){(function(global,Buffer){(function(){"use strict";Object.defineProperty(exports,"__esModule",{value:true});var global$1=typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{};var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var inited=false;function init(){inited=true;var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i0){throw new Error("Invalid string. Length must be a multiple of 4")}placeHolders=b64[len-2]==="="?2:b64[len-1]==="="?1:0;arr=new Arr(len*3/4-placeHolders);l=placeHolders>0?len-4:len;var L=0;for(i=0,j=0;i>16&255;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}if(placeHolders===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[L++]=tmp&255}else if(placeHolders===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[L++]=tmp>>8&255;arr[L++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;ilen2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];output+=lookup[tmp>>2];output+=lookup[tmp<<4&63];output+="=="}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];output+=lookup[tmp>>10];output+=lookup[tmp>>4&63];output+=lookup[tmp<<2&63];output+="="}parts.push(output);return parts.join("")}function read(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)}function write(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}var toString={}.toString;var isArray=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"};var INSPECT_MAX_BYTES=50;Buffer.TYPED_ARRAY_SUPPORT=global$1.TYPED_ARRAY_SUPPORT!==undefined?global$1.TYPED_ARRAY_SUPPORT:true;function kMaxLength(){return Buffer.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function createBuffer(that,length){if(kMaxLength()=kMaxLength()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+kMaxLength().toString(16)+" bytes")}return length|0}Buffer.isBuffer=isBuffer;function internalIsBuffer(b){return!!(b!=null&&b._isBuffer)}Buffer.compare=function compare(a,b){if(!internalIsBuffer(a)||!internalIsBuffer(b)){throw new TypeError("Arguments must be Buffers")}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase)return utf8ToBytes(string).length;encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;i0){str=this.toString("hex",0,max).match(/.{2}/g).join(" ");if(this.length>max)str+=" ... "}return""};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(!internalIsBuffer(target)){throw new TypeError("Argument must be a Buffer")}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(isNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(internalIsBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(Buffer.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read$$1(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;iarrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;jremaining){length=remaining}}var strLen=string.length;if(strLen%2!==0)throw new TypeError("Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;iremaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return fromByteArray(buf)}else{return fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(ilen)end=len;var out="";for(var i=start;ilen){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(endlength)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset|0;byteLength=byteLength|0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){if(!noAssert)checkOffset(offset,4,this.length);return read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){if(!noAssert)checkOffset(offset,8,this.length);return read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!internalIsBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||valuebuf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;byteLength=byteLength|0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,255,0);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);this[offset]=value&255;return offset+1};function objectWriteUInt16(buf,value,offset,littleEndian){if(value<0)value=65535+value+1;for(var i=0,j=Math.min(buf.length-offset,2);i>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,65535,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};function objectWriteUInt32(buf,value,offset,littleEndian){if(value<0)value=4294967295+value+1;for(var i=0,j=Math.min(buf.length-offset,4);i>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset|0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(!Buffer.TYPED_ARRAY_SUPPORT)value=Math.floor(value);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8}else{objectWriteUInt16(this,value,offset,true)}return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>8;this[offset+1]=value&255}else{objectWriteUInt16(this,value,offset,false)}return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24}else{objectWriteUInt32(this,value,offset,true)}return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset|0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;if(Buffer.TYPED_ARRAY_SUPPORT){this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255}else{objectWriteUInt32(this,value,offset,false)}return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,4,34028234663852886e22,-34028234663852886e22)}write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){checkIEEE754(buf,value,offset,8,17976931348623157e292,-17976931348623157e292)}write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end=this.length)throw new RangeError("sourceStart out of bounds");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart=0;--i){target[i+targetStart]=this[i+start]}}else if(len<1e3||!Buffer.TYPED_ARRAY_SUPPORT){for(i=0;i>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isnan(val){return val!==val}function isBuffer(obj){return obj!=null&&(!!obj._isBuffer||isFastBuffer(obj)||isSlowBuffer(obj))}function isFastBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE==="function"&&typeof obj.slice==="function"&&isFastBuffer(obj.slice(0,0))}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i=0)continue;target[key]=source[key]}return target}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key]}}return target}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return self}function _possibleConstructorReturn(self,call){if(call&&(typeof call==="object"||typeof call==="function")){return call}return _assertThisInitialized(self)}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest()}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_nonIterableSpread()}function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i0?floor:ceil)(it)};var min=Math.min;var _toLength=function(it){return it>0?min(_toInteger(it),9007199254740991):0};var _defined=function(it){if(it==undefined)throw TypeError("Can't call method on "+it);return it};var _stringRepeat=function repeat(count){var str=String(_defined(this));var res="";var n=_toInteger(count);if(n<0||n==Infinity)throw RangeError("Count can't be negative");for(;n>0;(n>>>=1)&&(str+=str))if(n&1)res+=str;return res};var _stringPad=function(that,maxLength,fillString,left){var S=String(_defined(that));var stringLength=S.length;var fillStr=fillString===undefined?" ":String(fillString);var intMaxLength=_toLength(maxLength);if(intMaxLength<=stringLength||fillStr=="")return S;var fillLen=intMaxLength-stringLength;var stringFiller=_stringRepeat.call(fillStr,Math.ceil(fillLen/fillStr.length));if(stringFiller.length>fillLen)stringFiller=stringFiller.slice(0,fillLen);return left?stringFiller+S:S+stringFiller};var navigator=_global.navigator;var _userAgent=navigator&&navigator.userAgent||"";_export(_export.P+_export.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(_userAgent),"String",{padStart:function padStart(maxLength){return _stringPad(this,maxLength,arguments.length>1?arguments[1]:undefined,true)}});var toString$1={}.toString;var _cof=function(it){return toString$1.call(it).slice(8,-1)};var f$1={}.propertyIsEnumerable;var _objectPie={f:f$1};var _iobject=Object("z").propertyIsEnumerable(0)?Object:function(it){return _cof(it)=="String"?it.split(""):Object(it)};var _toIobject=function(it){return _iobject(_defined(it))};var gOPD=Object.getOwnPropertyDescriptor;var f$2=_descriptors?gOPD:function getOwnPropertyDescriptor(O,P){O=_toIobject(O);P=_toPrimitive(P,true);if(_ie8DomDefine)try{return gOPD(O,P)}catch(e){}if(_has(O,P))return _propertyDesc(!_objectPie.f.call(O,P),O[P])};var _objectGopd={f:f$2};var check=function(O,proto){_anObject(O);if(!_isObject(proto)&&proto!==null)throw TypeError(proto+": can't set as prototype!")};var _setProto={set:Object.setPrototypeOf||("__proto__"in{}?function(test,buggy,set){try{set=_ctx(Function.call,_objectGopd.f(Object.prototype,"__proto__").set,2);set(test,[]);buggy=!(test instanceof Array)}catch(e){buggy=true}return function setPrototypeOf(O,proto){check(O,proto);if(buggy)O.__proto__=proto;else set(O,proto);return O}}({},false):undefined),check:check};var setPrototypeOf=_setProto.set;var _inheritIfRequired=function(that,target,C){var S=target.constructor;var P;if(S!==C&&typeof S=="function"&&(P=S.prototype)!==C.prototype&&_isObject(P)&&setPrototypeOf){setPrototypeOf(that,P)}return that};var max=Math.max;var min$1=Math.min;var _toAbsoluteIndex=function(index,length){index=_toInteger(index);return index<0?max(index+length,0):min$1(index,length)};var _arrayIncludes=function(IS_INCLUDES){return function($this,el,fromIndex){var O=_toIobject($this);var length=_toLength(O.length);var index=_toAbsoluteIndex(fromIndex,length);var value;if(IS_INCLUDES&&el!=el)while(length>index){value=O[index++];if(value!=value)return true}else for(;length>index;index++)if(IS_INCLUDES||index in O){if(O[index]===el)return IS_INCLUDES||index||0}return!IS_INCLUDES&&-1}};var _library=false;var _shared=createCommonjsModule(function(module){var SHARED="__core-js_shared__";var store=_global[SHARED]||(_global[SHARED]={});(module.exports=function(key,value){return store[key]||(store[key]=value!==undefined?value:{})})("versions",[]).push({version:_core.version,mode:_library?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})});var shared=_shared("keys");var _sharedKey=function(key){return shared[key]||(shared[key]=_uid(key))};var arrayIndexOf$1=_arrayIncludes(false);var IE_PROTO=_sharedKey("IE_PROTO");var _objectKeysInternal=function(object,names){var O=_toIobject(object);var i=0;var result=[];var key;for(key in O)if(key!=IE_PROTO)_has(O,key)&&result.push(key);while(names.length>i)if(_has(O,key=names[i++])){~arrayIndexOf$1(result,key)||result.push(key)}return result};var _enumBugKeys="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");var hiddenKeys=_enumBugKeys.concat("length","prototype");var f$3=Object.getOwnPropertyNames||function getOwnPropertyNames(O){return _objectKeysInternal(O,hiddenKeys)};var _objectGopn={f:f$3};var _stringWs="\t\n\v\f\r   ᠎    "+"          \u2028\u2029\ufeff";var space="["+_stringWs+"]";var non="​…";var ltrim=RegExp("^"+space+space+"*");var rtrim=RegExp(space+space+"*$");var exporter=function(KEY,exec,ALIAS){var exp={};var FORCE=_fails(function(){return!!_stringWs[KEY]()||non[KEY]()!=non});var fn=exp[KEY]=FORCE?exec(trim):_stringWs[KEY];if(ALIAS)exp[ALIAS]=fn;_export(_export.P+_export.F*FORCE,"String",exp)};var trim=exporter.trim=function(string,TYPE){string=String(_defined(string));if(TYPE&1)string=string.replace(ltrim,"");if(TYPE&2)string=string.replace(rtrim,"");return string};var _stringTrim=exporter;var _objectKeys=Object.keys||function keys(O){return _objectKeysInternal(O,_enumBugKeys)};var _objectDps=_descriptors?Object.defineProperties:function defineProperties(O,Properties){_anObject(O);var keys=_objectKeys(Properties);var length=keys.length;var i=0;var P;while(length>i)_objectDp.f(O,P=keys[i++],Properties[P]);return O};var document$1=_global.document;var _html=document$1&&document$1.documentElement;var IE_PROTO$1=_sharedKey("IE_PROTO");var Empty=function(){};var PROTOTYPE$1="prototype";var createDict=function(){var iframe=_domCreate("iframe");var i=_enumBugKeys.length;var lt="<";var gt=">";var iframeDocument;iframe.style.display="none";_html.appendChild(iframe);iframe.src="javascript:";iframeDocument=iframe.contentWindow.document;iframeDocument.open();iframeDocument.write(lt+"script"+gt+"document.F=Object"+lt+"/script"+gt);iframeDocument.close();createDict=iframeDocument.F;while(i--)delete createDict[PROTOTYPE$1][_enumBugKeys[i]];return createDict()};var _objectCreate=Object.create||function create(O,Properties){var result;if(O!==null){Empty[PROTOTYPE$1]=_anObject(O);result=new Empty;Empty[PROTOTYPE$1]=null;result[IE_PROTO$1]=O}else result=createDict();return Properties===undefined?result:_objectDps(result,Properties)};var gOPN=_objectGopn.f;var gOPD$1=_objectGopd.f;var dP$2=_objectDp.f;var $trim=_stringTrim.trim;var NUMBER="Number";var $Number=_global[NUMBER];var Base=$Number;var proto=$Number.prototype;var BROKEN_COF=_cof(_objectCreate(proto))==NUMBER;var TRIM="trim"in String.prototype;var toNumber=function(argument){var it=_toPrimitive(argument,false);if(typeof it=="string"&&it.length>2){it=TRIM?it.trim():$trim(it,3);var first=it.charCodeAt(0);var third,radix,maxCode;if(first===43||first===45){third=it.charCodeAt(2);if(third===88||third===120)return NaN}else if(first===48){switch(it.charCodeAt(1)){case 66:case 98:radix=2;maxCode=49;break;case 79:case 111:radix=8;maxCode=55;break;default:return+it}for(var digits=it.slice(2),i=0,l=digits.length,code;imaxCode)return NaN}return parseInt(digits,radix)}}return+it};if(!$Number(" 0o1")||!$Number("0b1")||$Number("+0x1")){$Number=function Number(value){var it=arguments.length<1?0:value;var that=this;return that instanceof $Number&&(BROKEN_COF?_fails(function(){proto.valueOf.call(that)}):_cof(that)!=NUMBER)?_inheritIfRequired(new Base(toNumber(it)),that,$Number):toNumber(it)};for(var keys=_descriptors?gOPN(Base):("MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,"+"EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,"+"MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger").split(","),j=0,key;keys.length>j;j++){if(_has(Base,key=keys[j])&&!_has($Number,key)){dP$2($Number,key,gOPD$1(Base,key))}}$Number.prototype=proto;proto.constructor=$Number;_redefine(_global,NUMBER,$Number)}var _flags=function(){var that=_anObject(this);var result="";if(that.global)result+="g";if(that.ignoreCase)result+="i";if(that.multiline)result+="m";if(that.unicode)result+="u";if(that.sticky)result+="y";return result};if(_descriptors&&/./g.flags!="g")_objectDp.f(RegExp.prototype,"flags",{configurable:true,get:_flags});var TO_STRING="toString";var $toString=/./[TO_STRING];var define=function(fn){_redefine(RegExp.prototype,TO_STRING,fn,true)};if(_fails(function(){return $toString.call({source:"a",flags:"b"})!="/a/b"})){define(function toString(){var R=_anObject(this);return"/".concat(R.source,"/","flags"in R?R.flags:!_descriptors&&R instanceof RegExp?_flags.call(R):undefined)})}else if($toString.name!=TO_STRING){define(function toString(){return $toString.call(this)})}var _toObject=function(it){return Object(_defined(it))};var _iterCall=function(iterator,fn,value,entries){try{return entries?fn(_anObject(value)[0],value[1]):fn(value)}catch(e){var ret=iterator["return"];if(ret!==undefined)_anObject(ret.call(iterator));throw e}};var _iterators={};var _wks=createCommonjsModule(function(module){var store=_shared("wks");var Symbol=_global.Symbol;var USE_SYMBOL=typeof Symbol=="function";var $exports=module.exports=function(name){return store[name]||(store[name]=USE_SYMBOL&&Symbol[name]||(USE_SYMBOL?Symbol:_uid)("Symbol."+name))};$exports.store=store});var ITERATOR=_wks("iterator");var ArrayProto=Array.prototype;var _isArrayIter=function(it){return it!==undefined&&(_iterators.Array===it||ArrayProto[ITERATOR]===it)};var _createProperty=function(object,index,value){if(index in object)_objectDp.f(object,index,_propertyDesc(0,value));else object[index]=value};var TAG=_wks("toStringTag");var ARG=_cof(function(){return arguments}())=="Arguments";var tryGet=function(it,key){try{return it[key]}catch(e){}};var _classof=function(it){var O,T,B;return it===undefined?"Undefined":it===null?"Null":typeof(T=tryGet(O=Object(it),TAG))=="string"?T:ARG?_cof(O):(B=_cof(O))=="Object"&&typeof O.callee=="function"?"Arguments":B};var ITERATOR$1=_wks("iterator");var core_getIteratorMethod=_core.getIteratorMethod=function(it){if(it!=undefined)return it[ITERATOR$1]||it["@@iterator"]||_iterators[_classof(it)]};var ITERATOR$2=_wks("iterator");var SAFE_CLOSING=false;try{var riter=[7][ITERATOR$2]();riter["return"]=function(){SAFE_CLOSING=true}}catch(e){}var _iterDetect=function(exec,skipClosing){if(!skipClosing&&!SAFE_CLOSING)return false;var safe=false;try{var arr=[7];var iter=arr[ITERATOR$2]();iter.next=function(){return{done:safe=true}};arr[ITERATOR$2]=function(){return iter};exec(arr)}catch(e){}return safe};_export(_export.S+_export.F*!_iterDetect(function(iter){}),"Array",{from:function from(arrayLike){var O=_toObject(arrayLike);var C=typeof this=="function"?this:Array;var aLen=arguments.length;var mapfn=aLen>1?arguments[1]:undefined;var mapping=mapfn!==undefined;var index=0;var iterFn=core_getIteratorMethod(O);var length,result,step,iterator;if(mapping)mapfn=_ctx(mapfn,aLen>2?arguments[2]:undefined,2);if(iterFn!=undefined&&!(C==Array&&_isArrayIter(iterFn))){for(iterator=iterFn.call(O),result=new C;!(step=iterator.next()).done;index++){_createProperty(result,index,mapping?_iterCall(iterator,mapfn,[step.value,index],true):step.value)}}else{length=_toLength(O.length);for(result=new C(length);length>index;index++){_createProperty(result,index,mapping?mapfn(O[index],index):O[index])}}result.length=index;return result}});_export(_export.S,"Math",{log2:function log2(x){return Math.log(x)/Math.LN2}});var Tools=function(){function Tools(){_classCallCheck(this,Tools)}_createClass(Tools,null,[{key:"readVint",value:function readVint(buffer){var start=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var length=8-Math.floor(Math.log2(buffer[start]));if(length>8){var number=Tools.readHexString(buffer,start,start+length);throw new Error("Unrepresentable length: ".concat(length," ").concat(number))}if(start+length>buffer.length){return null}var value=buffer[start]&(1<<8-length)-1;for(var i=1;i=Math.pow(2,8)&&buffer[start+7]>0){return{length:length,value:-1}}}value*=Math.pow(2,8);value+=buffer[start+i]}return{length:length,value:value}}},{key:"writeVint",value:function writeVint(value){if(value<0||value>Math.pow(2,53)){throw new Error("Unrepresentable value: ".concat(value))}var length=1;for(length=1;length<=8;length+=1){if(value1&&arguments[1]!==undefined?arguments[1]:0;var end=arguments.length>2&&arguments[2]!==undefined?arguments[2]:buff.byteLength;return Array.from(buff.slice(start,end)).map(function(q){return Number(q).toString(16)}).reduce(function(acc,current){return"".concat(acc).concat(current.padStart(2,"0"))},"")}},{key:"readUtf8",value:function readUtf8(buff){try{return Buffer.from(buff).toString("utf8")}catch(exception){return null}}},{key:"readUnsigned",value:function readUnsigned(buff){var b=new DataView(buff.buffer,buff.byteOffset,buff.byteLength);switch(buff.byteLength){case 1:return b.getUint8(0);case 2:return b.getUint16(0);case 4:return b.getUint32(0);default:break}if(buff.byteLength<=6){return buff.reduce(function(acc,current){return acc*256+current},0)}return Tools.readHexString(buff,0,buff.byteLength)}},{key:"readSigned",value:function readSigned(buff){var b=new DataView(buff.buffer,buff.byteOffset,buff.byteLength);switch(buff.byteLength){case 1:return b.getInt8(0);case 2:return b.getInt16(0);case 4:return b.getInt32(0);default:return NaN}}},{key:"readFloat",value:function readFloat(buff){var b=new DataView(buff.buffer,buff.byteOffset,buff.byteLength);switch(buff.byteLength){case 4:return b.getFloat32(0);case 8:return b.getFloat64(0);default:return NaN}}},{key:"readDataFromTag",value:function readDataFromTag(tagObj,data){var type=tagObj.type,name=tagObj.name;var track=tagObj.track;var discardable=tagObj.discardable||false;var keyframe=tagObj.keyframe||false;var payload=null;var value;switch(type){case"u":value=Tools.readUnsigned(data);break;case"f":value=Tools.readFloat(data);break;case"i":value=Tools.readSigned(data);break;case"s":value=String.fromCharCode.apply(String,_toConsumableArray(data));break;case"8":value=Tools.readUtf8(data);break;default:break}if(name==="SimpleBlock"||name==="Block"){var p=0;var _Tools$readVint=Tools.readVint(data,p),length=_Tools$readVint.length,trak=_Tools$readVint.value;p+=length;track=trak;value=Tools.readSigned(data.subarray(p,p+2));p+=2;if(name==="SimpleBlock"){keyframe=Boolean(data[length+2]&128);discardable=Boolean(data[length+2]&1)}p+=1;payload=data.subarray(p)}return _objectSpread({},tagObj,{data:data,discardable:discardable,keyframe:keyframe,payload:payload,track:track,value:value})}}]);return Tools}();var UNSCOPABLES=_wks("unscopables");var ArrayProto$1=Array.prototype;if(ArrayProto$1[UNSCOPABLES]==undefined)_hide(ArrayProto$1,UNSCOPABLES,{});var _addToUnscopables=function(key){ArrayProto$1[UNSCOPABLES][key]=true};var _iterStep=function(done,value){return{value:value,done:!!done}};var def=_objectDp.f;var TAG$1=_wks("toStringTag");var _setToStringTag=function(it,tag,stat){if(it&&!_has(it=stat?it:it.prototype,TAG$1))def(it,TAG$1,{configurable:true,value:tag})};var IteratorPrototype={};_hide(IteratorPrototype,_wks("iterator"),function(){return this});var _iterCreate=function(Constructor,NAME,next){Constructor.prototype=_objectCreate(IteratorPrototype,{next:_propertyDesc(1,next)});_setToStringTag(Constructor,NAME+" Iterator")};var IE_PROTO$2=_sharedKey("IE_PROTO");var ObjectProto=Object.prototype;var _objectGpo=Object.getPrototypeOf||function(O){O=_toObject(O);if(_has(O,IE_PROTO$2))return O[IE_PROTO$2];if(typeof O.constructor=="function"&&O instanceof O.constructor){return O.constructor.prototype}return O instanceof Object?ObjectProto:null};var ITERATOR$3=_wks("iterator");var BUGGY=!([].keys&&"next"in[].keys());var FF_ITERATOR="@@iterator";var KEYS="keys";var VALUES="values";var returnThis=function(){return this};var _iterDefine=function(Base,NAME,Constructor,next,DEFAULT,IS_SET,FORCED){_iterCreate(Constructor,NAME,next);var getMethod=function(kind){if(!BUGGY&&kind in proto)return proto[kind];switch(kind){case KEYS:return function keys(){return new Constructor(this,kind)};case VALUES:return function values(){return new Constructor(this,kind)}}return function entries(){return new Constructor(this,kind)}};var TAG=NAME+" Iterator";var DEF_VALUES=DEFAULT==VALUES;var VALUES_BUG=false;var proto=Base.prototype;var $native=proto[ITERATOR$3]||proto[FF_ITERATOR]||DEFAULT&&proto[DEFAULT];var $default=$native||getMethod(DEFAULT);var $entries=DEFAULT?!DEF_VALUES?$default:getMethod("entries"):undefined;var $anyNative=NAME=="Array"?proto.entries||$native:$native;var methods,key,IteratorPrototype;if($anyNative){IteratorPrototype=_objectGpo($anyNative.call(new Base));if(IteratorPrototype!==Object.prototype&&IteratorPrototype.next){_setToStringTag(IteratorPrototype,TAG,true);if(!_library&&typeof IteratorPrototype[ITERATOR$3]!="function")_hide(IteratorPrototype,ITERATOR$3,returnThis)}}if(DEF_VALUES&&$native&&$native.name!==VALUES){VALUES_BUG=true;$default=function values(){return $native.call(this)}}if((!_library||FORCED)&&(BUGGY||VALUES_BUG||!proto[ITERATOR$3])){_hide(proto,ITERATOR$3,$default)}_iterators[NAME]=$default;_iterators[TAG]=returnThis;if(DEFAULT){methods={values:DEF_VALUES?$default:getMethod(VALUES),keys:IS_SET?$default:getMethod(KEYS),entries:$entries};if(FORCED)for(key in methods){if(!(key in proto))_redefine(proto,key,methods[key])}else _export(_export.P+_export.F*(BUGGY||VALUES_BUG),NAME,methods)}return methods};var es6_array_iterator=_iterDefine(Array,"Array",function(iterated,kind){this._t=_toIobject(iterated);this._i=0;this._k=kind},function(){var O=this._t;var kind=this._k;var index=this._i++;if(!O||index>=O.length){this._t=undefined;return _iterStep(1)}if(kind=="keys")return _iterStep(0,index);if(kind=="values")return _iterStep(0,O[index]);return _iterStep(0,[index,O[index]])},"values");_iterators.Arguments=_iterators.Array;_addToUnscopables("keys");_addToUnscopables("values");_addToUnscopables("entries");var ITERATOR$4=_wks("iterator");var TO_STRING_TAG=_wks("toStringTag");var ArrayValues=_iterators.Array;var DOMIterables={CSSRuleList:true,CSSStyleDeclaration:false,CSSValueList:false,ClientRectList:false,DOMRectList:false,DOMStringList:false,DOMTokenList:true,DataTransferItemList:false,FileList:false,HTMLAllCollection:false,HTMLCollection:false,HTMLFormElement:false,HTMLSelectElement:false,MediaList:true,MimeTypeArray:false,NamedNodeMap:false,NodeList:true,PaintRequestList:false,Plugin:false,PluginArray:false,SVGLengthList:false,SVGNumberList:false,SVGPathSegList:false,SVGPointList:false,SVGStringList:false,SVGTransformList:false,SourceBufferList:false,StyleSheetList:true,TextTrackCueList:false,TextTrackList:false,TouchList:false};for(var collections=_objectKeys(DOMIterables),i=0;iindex;index++){result=entries?f(_anObject(step=iterable[index])[0],step[1]):f(iterable[index]);if(result===BREAK||result===RETURN)return result}else for(iterator=iterFn.call(iterable);!(step=iterator.next()).done;){result=_iterCall(iterator,f,step.value,entries);if(result===BREAK||result===RETURN)return result}};exports.BREAK=BREAK;exports.RETURN=RETURN});var SPECIES=_wks("species");var _setSpecies=function(KEY){var C=_global[KEY];if(_descriptors&&C&&!C[SPECIES])_objectDp.f(C,SPECIES,{configurable:true,get:function(){return this}})};var _meta=createCommonjsModule(function(module){var META=_uid("meta");var setDesc=_objectDp.f;var id=0;var isExtensible=Object.isExtensible||function(){return true};var FREEZE=!_fails(function(){return isExtensible(Object.preventExtensions({}))});var setMeta=function(it){setDesc(it,META,{value:{i:"O"+ ++id,w:{}}})};var fastKey=function(it,create){if(!_isObject(it))return typeof it=="symbol"?it:(typeof it=="string"?"S":"P")+it;if(!_has(it,META)){if(!isExtensible(it))return"F";if(!create)return"E";setMeta(it)}return it[META].i};var getWeak=function(it,create){if(!_has(it,META)){if(!isExtensible(it))return true;if(!create)return false;setMeta(it)}return it[META].w};var onFreeze=function(it){if(FREEZE&&meta.NEED&&isExtensible(it)&&!_has(it,META))setMeta(it);return it};var meta=module.exports={KEY:META,NEED:false,fastKey:fastKey,getWeak:getWeak,onFreeze:onFreeze}});var _meta_1=_meta.KEY;var _meta_2=_meta.NEED;var _meta_3=_meta.fastKey;var _meta_4=_meta.getWeak;var _meta_5=_meta.onFreeze;var _validateCollection=function(it,TYPE){if(!_isObject(it)||it._t!==TYPE)throw TypeError("Incompatible receiver, "+TYPE+" required!");return it};var dP$3=_objectDp.f;var fastKey=_meta.fastKey;var SIZE=_descriptors?"_s":"size";var getEntry=function(that,key){var index=fastKey(key);var entry;if(index!=="F")return that._i[index];for(entry=that._f;entry;entry=entry.n){if(entry.k==key)return entry}};var _collectionStrong={getConstructor:function(wrapper,NAME,IS_MAP,ADDER){var C=wrapper(function(that,iterable){_anInstance(that,C,NAME,"_i");that._t=NAME;that._i=_objectCreate(null);that._f=undefined;that._l=undefined;that[SIZE]=0;if(iterable!=undefined)_forOf(iterable,IS_MAP,that[ADDER],that)});_redefineAll(C.prototype,{clear:function clear(){for(var that=_validateCollection(this,NAME),data=that._i,entry=that._f;entry;entry=entry.n){entry.r=true;if(entry.p)entry.p=entry.p.n=undefined;delete data[entry.i]}that._f=that._l=undefined;that[SIZE]=0},delete:function(key){var that=_validateCollection(this,NAME);var entry=getEntry(that,key);if(entry){var next=entry.n;var prev=entry.p;delete that._i[entry.i];entry.r=true;if(prev)prev.n=next;if(next)next.p=prev;if(that._f==entry)that._f=next;if(that._l==entry)that._l=prev;that[SIZE]--}return!!entry},forEach:function forEach(callbackfn){_validateCollection(this,NAME);var f=_ctx(callbackfn,arguments.length>1?arguments[1]:undefined,3);var entry;while(entry=entry?entry.n:this._f){f(entry.v,entry.k,this);while(entry&&entry.r)entry=entry.p}},has:function has(key){return!!getEntry(_validateCollection(this,NAME),key)}});if(_descriptors)dP$3(C.prototype,"size",{get:function(){return _validateCollection(this,NAME)[SIZE]}});return C},def:function(that,key,value){var entry=getEntry(that,key);var prev,index;if(entry){entry.v=value}else{that._l=entry={i:index=fastKey(key,true),k:key,v:value,p:prev=that._l,n:undefined,r:false};if(!that._f)that._f=entry;if(prev)prev.n=entry;that[SIZE]++;if(index!=="F")that._i[index]=entry}return that},getEntry:getEntry,setStrong:function(C,NAME,IS_MAP){_iterDefine(C,NAME,function(iterated,kind){this._t=_validateCollection(iterated,NAME);this._k=kind;this._l=undefined},function(){var that=this;var kind=that._k;var entry=that._l;while(entry&&entry.r)entry=entry.p;if(!that._t||!(that._l=entry=entry?entry.n:that._t._f)){that._t=undefined;return _iterStep(1)}if(kind=="keys")return _iterStep(0,entry.k);if(kind=="values")return _iterStep(0,entry.v);return _iterStep(0,[entry.k,entry.v])},IS_MAP?"entries":"values",!IS_MAP,true);_setSpecies(NAME)}};var _collection=function(NAME,wrapper,methods,common,IS_MAP,IS_WEAK){var Base=_global[NAME];var C=Base;var ADDER=IS_MAP?"set":"add";var proto=C&&C.prototype;var O={};var fixMethod=function(KEY){var fn=proto[KEY];_redefine(proto,KEY,KEY=="delete"?function(a){return IS_WEAK&&!_isObject(a)?false:fn.call(this,a===0?0:a)}:KEY=="has"?function has(a){return IS_WEAK&&!_isObject(a)?false:fn.call(this,a===0?0:a)}:KEY=="get"?function get(a){return IS_WEAK&&!_isObject(a)?undefined:fn.call(this,a===0?0:a)}:KEY=="add"?function add(a){fn.call(this,a===0?0:a);return this}:function set(a,b){fn.call(this,a===0?0:a,b);return this})};if(typeof C!="function"||!(IS_WEAK||proto.forEach&&!_fails(function(){(new C).entries().next()}))){C=common.getConstructor(wrapper,NAME,IS_MAP,ADDER);_redefineAll(C.prototype,methods);_meta.NEED=true}else{var instance=new C;var HASNT_CHAINING=instance[ADDER](IS_WEAK?{}:-0,1)!=instance;var THROWS_ON_PRIMITIVES=_fails(function(){instance.has(1)});var ACCEPT_ITERABLES=_iterDetect(function(iter){new C(iter)});var BUGGY_ZERO=!IS_WEAK&&_fails(function(){var $instance=new C;var index=5;while(index--)$instance[ADDER](index,index);return!$instance.has(-0)});if(!ACCEPT_ITERABLES){C=wrapper(function(target,iterable){_anInstance(target,C,NAME);var that=_inheritIfRequired(new Base,target,C);if(iterable!=undefined)_forOf(iterable,IS_MAP,that[ADDER],that);return that});C.prototype=proto;proto.constructor=C}if(THROWS_ON_PRIMITIVES||BUGGY_ZERO){fixMethod("delete");fixMethod("has");IS_MAP&&fixMethod("get")}if(BUGGY_ZERO||HASNT_CHAINING)fixMethod(ADDER);if(IS_WEAK&&proto.clear)delete proto.clear}_setToStringTag(C,NAME);O[NAME]=C;_export(_export.G+_export.W+_export.F*(C!=Base),O);if(!IS_WEAK)common.setStrong(C,NAME,IS_MAP);return C};var MAP="Map";var es6_map=_collection(MAP,function(get){return function Map(){return get(this,arguments.length>0?arguments[0]:undefined)}},{get:function get(key){var entry=_collectionStrong.getEntry(_validateCollection(this,MAP),key);return entry&&entry.v},set:function set(key,value){return _collectionStrong.def(_validateCollection(this,MAP),key===0?0:key,value)}},_collectionStrong,true);var schema=new Map([[128,{name:"ChapterDisplay",level:4,type:"m",multiple:true,minver:1,webm:true,description:"Contains all possible strings to use for the chapter display."}],[131,{name:"TrackType",level:3,type:"u",multiple:false,mandatory:true,minver:1,range:"1-254",description:"A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control).",webm:false}],[133,{name:"ChapString",cppname:"ChapterString",level:5,type:"8",multiple:false,mandatory:true,minver:1,webm:true,description:"Contains the string to use as the chapter atom."}],[134,{name:"CodecID",level:3,type:"s",mandatory:true,minver:1,description:"An ID corresponding to the codec, see the codec page for more info.",multiple:false,webm:false}],[136,{name:"FlagDefault",cppname:"TrackFlagDefault",level:3,type:"u",mandatory:true,minver:1,default:1,range:"0-1",description:"Set if that track (audio, video or subs) SHOULD be active if no language found matches the user preference. (1 bit)",multiple:false,webm:false}],[137,{name:"ChapterTrackNumber",level:5,type:"u",mandatory:true,multiple:true,minver:1,webm:false,range:"not 0",description:"UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks."}],[145,{name:"ChapterTimeStart",level:4,type:"u",mandatory:true,minver:1,webm:true,description:"Timestamp of the start of Chapter (not scaled).",multiple:false}],[146,{name:"ChapterTimeEnd",level:4,type:"u",minver:1,webm:false,description:"Timestamp of the end of Chapter (timestamp excluded, not scaled).",multiple:false}],[150,{name:"CueRefTime",level:5,type:"u",mandatory:true,minver:2,webm:false,description:"Timestamp of the referenced Block.",multiple:false}],[151,{name:"CueRefCluster",level:5,type:"u",mandatory:true,webm:false,description:"The Position of the Cluster containing the referenced Block.",minver:0,multiple:false}],[152,{name:"ChapterFlagHidden",level:4,type:"u",mandatory:true,minver:1,webm:false,default:0,range:"0-1",description:"If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)",multiple:false}],[16980,{name:"ContentCompAlgo",level:6,type:"u",mandatory:true,minver:1,webm:false,default:0,br:["","","",""],del:["1 - bzlib,","2 - lzo1x"],description:"The compression algorithm used. Algorithms that have been specified so far are: 0 - zlib, 3 - Header Stripping",multiple:false}],[16981,{name:"ContentCompSettings",level:6,type:"b",minver:1,webm:false,description:"Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track.",multiple:false}],[17026,{name:"DocType",level:1,type:"s",mandatory:true,default:"matroska",minver:1,description:"A string that describes the type of document that follows this EBML header. 'matroska' in our case or 'webm' for webm files.",multiple:false,webm:false}],[17029,{name:"DocTypeReadVersion",level:1,type:"u",mandatory:true,default:1,minver:1,description:"The minimum DocType version an interpreter has to support to read this file.",multiple:false,webm:false}],[17030,{name:"EBMLVersion",level:1,type:"u",mandatory:true,default:1,minver:1,description:"The version of EBML parser used to create the file.",multiple:false,webm:false}],[17031,{name:"DocTypeVersion",level:1,type:"u",mandatory:true,default:1,minver:1,description:"The version of DocType interpreter used to create the file.",multiple:false,webm:false}],[17476,{name:"SegmentFamily",level:2,type:"b",multiple:true,minver:1,webm:false,bytesize:16,description:"A randomly generated unique ID that all segments related to each other must use (128 bits)."}],[17505,{name:"DateUTC",level:2,type:"d",minver:1,description:"Date of the origin of timestamp (value 0), i.e. production date.",multiple:false,webm:false}],[17540,{name:"TagDefault",level:4,type:"u",mandatory:true,minver:1,webm:false,default:1,range:"0-1",description:"Indication to know if this is the default/original language to use for the given tag. (1 bit)",multiple:false}],[17541,{name:"TagBinary",level:4,type:"b",minver:1,webm:false,description:"The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString.",multiple:false}],[17543,{name:"TagString",level:4,type:"8",minver:1,webm:false,description:"The value of the Tag.",multiple:false}],[17545,{name:"Duration",level:2,type:"f",minver:1,range:"> 0",description:"Duration of the segment (based on TimecodeScale).",multiple:false,webm:false}],[17816,{name:"ChapterFlagEnabled",level:4,type:"u",mandatory:true,minver:1,webm:false,default:1,range:"0-1",description:"Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter (see flag notes). (1 bit)",multiple:false}],[18016,{name:"FileMimeType",level:3,type:"s",mandatory:true,minver:1,webm:false,description:"MIME type of the file.",multiple:false}],[18017,{name:"FileUsedStartTime",level:3,type:"u",divx:true,description:"DivX font extension",multiple:false}],[18018,{name:"FileUsedEndTime",level:3,type:"u",divx:true,multiple:false,description:"DivX font extension"}],[18037,{name:"FileReferral",level:3,type:"b",webm:false,description:"A binary value that a track/codec can refer to when the attachment is needed.",multiple:false}],[20529,{name:"ContentEncodingOrder",level:5,type:"u",mandatory:true,minver:1,webm:false,default:0,multiple:false,description:"Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment."}],[20530,{name:"ContentEncodingScope",level:5,type:"u",mandatory:true,minver:1,webm:false,default:1,range:"not 0",br:["","",""],description:"A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: 1 - all frame contents, 2 - the track's private data, 4 - the next ContentEncoding (next ContentEncodingOrder. Either the data inside ContentCompression and/or ContentEncryption)",multiple:false}],[20531,{name:"ContentEncodingType",level:5,type:"u",mandatory:true,minver:1,webm:false,default:0,br:["",""],description:"A value describing what kind of transformation has been done. Possible values: 0 - compression, 1 - encryption",multiple:false}],[20532,{name:"ContentCompression",level:5,type:"m",minver:1,webm:false,description:"Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking.",multiple:false}],[20533,{name:"ContentEncryption",level:5,type:"m",minver:1,webm:false,description:"Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise.",multiple:false}],[21368,{name:"CueBlockNumber",level:4,type:"u",minver:1,default:1,range:"not 0",description:"Number of the Block in the specified Cluster.",multiple:false}],[22100,{name:"ChapterStringUID",level:4,type:"8",mandatory:false,minver:3,webm:true,description:"A unique string ID to identify the Chapter. Use for WebVTT cue identifier storage.",multiple:false}],[22337,{name:"WritingApp",level:2,type:"8",mandatory:true,minver:1,multiple:false,description:'Writing application ("mkvmerge-0.3.3").'}],[22612,{name:"SilentTracks",cppname:"ClusterSilentTracks",level:2,type:"m",minver:1,multiple:false,webm:false,description:"The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use."}],[25152,{name:"ContentEncoding",level:4,type:"m",mandatory:true,multiple:true,minver:1,webm:false,description:"Settings for one content encoding like compression or encryption."}],[25188,{name:"BitDepth",cppname:"AudioBitDepth",level:4,type:"u",minver:1,range:"not 0",multiple:false,description:"Bits per sample, mostly used for PCM."}],[25906,{name:"SignedElement",level:3,type:"b",multiple:true,webm:false,description:"An element ID whose data will be used to compute the signature."}],[26148,{name:"TrackTranslate",level:3,type:"m",multiple:true,minver:1,webm:false,description:"The track identification for the given Chapter Codec."}],[26897,{name:"ChapProcessCommand",cppname:"ChapterProcessCommand",level:5,type:"m",multiple:true,minver:1,webm:false,description:"Contains all the commands associated to the Atom."}],[26914,{name:"ChapProcessTime",cppname:"ChapterProcessTime",level:6,type:"u",mandatory:true,minver:1,webm:false,description:"Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter)."}],[26916,{name:"ChapterTranslate",level:2,type:"m",multiple:true,minver:1,webm:false,description:"A tuple of corresponding ID used by chapter codecs to represent this segment."}],[26931,{name:"ChapProcessData",cppname:"ChapterProcessData",level:6,type:"b",mandatory:true,minver:1,webm:false,description:"Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands."}],[26948,{name:"ChapProcess",cppname:"ChapterProcess",level:4,type:"m",multiple:true,minver:1,webm:false,description:"Contains all the commands associated to the Atom."}],[26965,{name:"ChapProcessCodecID",cppname:"ChapterProcessCodecID",level:5,type:"u",mandatory:true,minver:1,webm:false,default:0,description:"Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later."}],[29555,{name:"Tag",level:2,type:"m",mandatory:true,multiple:true,minver:1,webm:false,description:"Element containing elements specific to Tracks/Chapters."}],[29572,{name:"SegmentFilename",level:2,type:"8",minver:1,webm:false,description:"A filename corresponding to this segment."}],[29766,{name:"AttachmentLink",cppname:"TrackAttachmentLink",level:3,type:"u",minver:1,webm:false,range:"not 0",description:"The UID of an attachment that is used by this codec."}],[2459272,{name:"CodecName",level:3,type:"8",minver:1,description:"A human-readable string specifying the codec."}],[408125543,{name:"Segment",level:0,type:"m",mandatory:true,multiple:true,minver:1,description:"This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment."}],[17530,{name:"TagLanguage",level:4,type:"s",mandatory:true,minver:1,webm:false,default:"und",description:"Specifies the language of the tag specified, in the Matroska languages form."}],[17827,{name:"TagName",level:4,type:"8",mandatory:true,minver:1,webm:false,description:"The name of the Tag that is going to be stored."}],[26568,{name:"SimpleTag",cppname:"TagSimple",level:3,recursive:true,type:"m",mandatory:true,multiple:true,minver:1,webm:false,description:"Contains general information about the target."}],[25542,{name:"TagAttachmentUID",level:4,type:"u",multiple:true,minver:1,webm:false,default:0,description:"A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment."}],[25540,{name:"TagChapterUID",level:4,type:"u",multiple:true,minver:1,webm:false,default:0,description:"A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment."}],[25545,{name:"TagEditionUID",level:4,type:"u",multiple:true,minver:1,webm:false,default:0,description:"A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment."}],[25541,{name:"TagTrackUID",level:4,type:"u",multiple:true,minver:1,webm:false,default:0,description:"A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment."}],[25546,{name:"TargetType",cppname:"TagTargetType",level:4,type:"s",minver:1,webm:false,strong:"informational",description:'An string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType).'}],[26826,{name:"TargetTypeValue",cppname:"TagTargetTypeValue",level:4,type:"u",minver:1,webm:false,default:50,description:"A number to indicate the logical level of the target (see TargetType)."}],[25536,{name:"Targets",cppname:"TagTargets",level:3,type:"m",mandatory:true,minver:1,webm:false,description:"Contain all UIDs where the specified meta data apply. It is empty to describe everything in the segment."}],[307544935,{name:"Tags",level:1,type:"m",multiple:true,minver:1,webm:false,description:"Element containing elements specific to Tracks/Chapters. A list of valid tags can be found here."}],[17677,{name:"ChapProcessPrivate",cppname:"ChapterProcessPrivate",level:5,type:"b",minver:1,webm:false,description:'Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent.'}],[17278,{name:"ChapCountry",cppname:"ChapterCountry",level:5,type:"s",multiple:true,minver:1,webm:false,description:"The countries corresponding to the string, same 2 octets as in Internet domains."}],[17276,{name:"ChapLanguage",cppname:"ChapterLanguage",level:5,type:"s",mandatory:true,multiple:true,minver:1,webm:true,default:"eng",description:"The languages corresponding to the string, in the bibliographic ISO-639-2 form."}],[143,{name:"ChapterTrack",level:4,type:"m",minver:1,webm:false,description:"List of tracks on which the chapter applies. If this element is not present, all tracks apply"}],[25539,{name:"ChapterPhysicalEquiv",level:4,type:"u",minver:1,webm:false,description:'Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values.'}],[28348,{name:"ChapterSegmentEditionUID",level:4,type:"u",minver:1,webm:false,range:"not 0",description:"The EditionUID to play from the segment linked in ChapterSegmentUID."}],[28263,{name:"ChapterSegmentUID",level:4,type:"b",minver:1,webm:false,range:">0",bytesize:16,description:"A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used."}],[29636,{name:"ChapterUID",level:4,type:"u",mandatory:true,minver:1,webm:true,range:"not 0",description:"A unique ID to identify the Chapter."}],[182,{name:"ChapterAtom",level:3,recursive:true,type:"m",mandatory:true,multiple:true,minver:1,webm:true,description:"Contains the atom information to use as the chapter atom (apply to all tracks)."}],[17885,{name:"EditionFlagOrdered",level:3,type:"u",minver:1,webm:false,default:0,range:"0-1",description:"Specify if the chapters can be defined multiple times and the order to play them is enforced. (1 bit)"}],[17883,{name:"EditionFlagDefault",level:3,type:"u",mandatory:true,minver:1,webm:false,default:0,range:"0-1",description:"If a flag is set (1) the edition should be used as the default one. (1 bit)"}],[17853,{name:"EditionFlagHidden",level:3,type:"u",mandatory:true,minver:1,webm:false,default:0,range:"0-1",description:"If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks; see flag notes). (1 bit)"}],[17852,{name:"EditionUID",level:3,type:"u",minver:1,webm:false,range:"not 0",description:"A unique ID to identify the edition. It's useful for tagging an edition."}],[17849,{name:"EditionEntry",level:2,type:"m",mandatory:true,multiple:true,minver:1,webm:true,description:"Contains all information about a segment edition."}],[272869232,{name:"Chapters",level:1,type:"m",minver:1,webm:true,description:"A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation."}],[18094,{name:"FileUID",level:3,type:"u",mandatory:true,minver:1,webm:false,range:"not 0",description:"Unique ID representing the file, as random as possible."}],[18012,{name:"FileData",level:3,type:"b",mandatory:true,minver:1,webm:false,description:"The data of the file."}],[18030,{name:"FileName",level:3,type:"8",mandatory:true,minver:1,webm:false,description:"Filename of the attached file."}],[18046,{name:"FileDescription",level:3,type:"8",minver:1,webm:false,description:"A human-friendly name for the attached file."}],[24999,{name:"AttachedFile",level:2,type:"m",mandatory:true,multiple:true,minver:1,webm:false,description:"An attached file."}],[423732329,{name:"Attachments",level:1,type:"m",minver:1,webm:false,description:"Contain attached files."}],[235,{name:"CueRefCodecState",level:5,type:"u",webm:false,default:0,description:"The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry."}],[21343,{name:"CueRefNumber",level:5,type:"u",webm:false,default:1,range:"not 0",description:"Number of the referenced Block of Track X in the specified Cluster."}],[219,{name:"CueReference",level:4,type:"m",multiple:true,minver:2,webm:false,description:"The Clusters containing the required referenced Blocks."}],[234,{name:"CueCodecState",level:4,type:"u",minver:2,webm:false,default:0,description:"The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry."}],[178,{name:"CueDuration",level:4,type:"u",mandatory:false,minver:4,webm:false,description:"The duration of the block according to the segment time base. If missing the track's DefaultDuration does not apply and no duration information is available in terms of the cues."}],[240,{name:"CueRelativePosition",level:4,type:"u",mandatory:false,minver:4,webm:false,description:"The relative position of the referenced block inside the cluster with 0 being the first possible position for an element inside that cluster."}],[241,{name:"CueClusterPosition",level:4,type:"u",mandatory:true,minver:1,description:"The position of the Cluster containing the required Block."}],[247,{name:"CueTrack",level:4,type:"u",mandatory:true,minver:1,range:"not 0",description:"The track for which a position is given."}],[183,{name:"CueTrackPositions",level:3,type:"m",mandatory:true,multiple:true,minver:1,description:"Contain positions for different tracks corresponding to the timestamp."}],[179,{name:"CueTime",level:3,type:"u",mandatory:true,minver:1,description:"Absolute timestamp according to the segment time base."}],[187,{name:"CuePoint",level:2,type:"m",mandatory:true,multiple:true,minver:1,description:"Contains all information relative to a seek point in the segment."}],[475249515,{name:"Cues",level:1,type:"m",minver:1,description:'A top-level element to speed seeking access. All entries are local to the segment. Should be mandatory for non "live" streams.'}],[18406,{name:"ContentSigHashAlgo",level:6,type:"u",minver:1,webm:false,default:0,br:["",""],description:"The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: 1 - SHA1-160 2 - MD5"}],[18405,{name:"ContentSigAlgo",level:6,type:"u",minver:1,webm:false,default:0,br:"",description:"The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: 1 - RSA"}],[18404,{name:"ContentSigKeyID",level:6,type:"b",minver:1,webm:false,description:"This is the ID of the private key the data was signed with."}],[18403,{name:"ContentSignature",level:6,type:"b",minver:1,webm:false,description:"A cryptographic signature of the contents."}],[18402,{name:"ContentEncKeyID",level:6,type:"b",minver:1,webm:false,description:"For public key algorithms this is the ID of the public key the the data was encrypted with."}],[18401,{name:"ContentEncAlgo",level:6,type:"u",minver:1,webm:false,default:0,br:"",description:"The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: 1 - DES, 2 - 3DES, 3 - Twofish, 4 - Blowfish, 5 - AES"}],[28032,{name:"ContentEncodings",level:3,type:"m",minver:1,webm:false,description:"Settings for several content encoding mechanisms like compression or encryption."}],[196,{name:"TrickMasterTrackSegmentUID",level:3,type:"b",divx:true,bytesize:16,description:"DivX trick track extenstions"}],[199,{name:"TrickMasterTrackUID",level:3,type:"u",divx:true,description:"DivX trick track extenstions"}],[198,{name:"TrickTrackFlag",level:3,type:"u",divx:true,default:0,description:"DivX trick track extenstions"}],[193,{name:"TrickTrackSegmentUID",level:3,type:"b",divx:true,bytesize:16,description:"DivX trick track extenstions"}],[192,{name:"TrickTrackUID",level:3,type:"u",divx:true,description:"DivX trick track extenstions"}],[237,{name:"TrackJoinUID",level:5,type:"u",mandatory:true,multiple:true,minver:3,webm:false,range:"not 0",description:"The trackUID number of a track whose blocks are used to create this virtual track."}],[233,{name:"TrackJoinBlocks",level:4,type:"m",minver:3,webm:false,description:"Contains the list of all tracks whose Blocks need to be combined to create this virtual track"}],[230,{name:"TrackPlaneType",level:6,type:"u",mandatory:true,minver:3,webm:false,description:"The kind of plane this track corresponds to (0: left eye, 1: right eye, 2: background)."}],[229,{name:"TrackPlaneUID",level:6,type:"u",mandatory:true,minver:3,webm:false,range:"not 0",description:"The trackUID number of the track representing the plane."}],[228,{name:"TrackPlane",level:5,type:"m",mandatory:true,multiple:true,minver:3,webm:false,description:"Contains a video plane track that need to be combined to create this 3D track"}],[227,{name:"TrackCombinePlanes",level:4,type:"m",minver:3,webm:false,description:"Contains the list of all video plane tracks that need to be combined to create this 3D track"}],[226,{name:"TrackOperation",level:3,type:"m",minver:3,webm:false,description:"Operation that needs to be applied on tracks to create this virtual track. For more details look at the Specification Notes on the subject."}],[32123,{name:"ChannelPositions",cppname:"AudioPosition",level:4,type:"b",webm:false,description:"Table of horizontal angles for each successive channel, see appendix."}],[159,{name:"Channels",cppname:"AudioChannels",level:4,type:"u",mandatory:true,minver:1,default:1,range:"not 0",description:"Numbers of channels in the track."}],[30901,{name:"OutputSamplingFrequency",cppname:"AudioOutputSamplingFreq",level:4,type:"f",minver:1,default:"Sampling Frequency",range:"> 0",description:"Real output sampling frequency in Hz (used for SBR techniques)."}],[181,{name:"SamplingFrequency",cppname:"AudioSamplingFreq",level:4,type:"f",mandatory:true,minver:1,default:"8000.0",range:"> 0",description:"Sampling frequency in Hz."}],[225,{name:"Audio",cppname:"TrackAudio",level:3,type:"m",minver:1,description:"Audio settings."}],[2327523,{name:"FrameRate",cppname:"VideoFrameRate",level:4,type:"f",range:"> 0",strong:"Informational",description:"Number of frames per second. only."}],[3126563,{name:"GammaValue",cppname:"VideoGamma",level:4,type:"f",webm:false,range:"> 0",description:"Gamma Value."}],[3061028,{name:"ColourSpace",cppname:"VideoColourSpace",level:4,type:"b",minver:1,webm:false,bytesize:4,description:"Same value as in AVI (32 bits)."}],[21683,{name:"AspectRatioType",cppname:"VideoAspectRatio",level:4,type:"u",minver:1,default:0,description:"Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed)."}],[21682,{name:"DisplayUnit",cppname:"VideoDisplayUnit",level:4,type:"u",minver:1,default:0,description:"How DisplayWidth & DisplayHeight should be interpreted (0: pixels, 1: centimeters, 2: inches, 3: Display Aspect Ratio)."}],[21690,{name:"DisplayHeight",cppname:"VideoDisplayHeight",level:4,type:"u",minver:1,default:"PixelHeight",range:"not 0",description:"Height of the video frames to display. The default value is only valid when DisplayUnit is 0."}],[21680,{name:"DisplayWidth",cppname:"VideoDisplayWidth",level:4,type:"u",minver:1,default:"PixelWidth",range:"not 0",description:"Width of the video frames to display. The default value is only valid when DisplayUnit is 0."}],[21725,{name:"PixelCropRight",cppname:"VideoPixelCropRight",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove on the right of the image."}],[21708,{name:"PixelCropLeft",cppname:"VideoPixelCropLeft",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove on the left of the image."}],[21691,{name:"PixelCropTop",cppname:"VideoPixelCropTop",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove at the top of the image."}],[21674,{name:"PixelCropBottom",cppname:"VideoPixelCropBottom",level:4,type:"u",minver:1,default:0,description:"The number of video pixels to remove at the bottom of the image (for HDTV content)."}],[186,{name:"PixelHeight",cppname:"VideoPixelHeight",level:4,type:"u",mandatory:true,minver:1,range:"not 0",description:"Height of the encoded video frames in pixels."}],[176,{name:"PixelWidth",cppname:"VideoPixelWidth",level:4,type:"u",mandatory:true,minver:1,range:"not 0",description:"Width of the encoded video frames in pixels."}],[21433,{name:"OldStereoMode",level:4,type:"u",maxver:"0",webm:false,divx:false,description:"DEPRECATED, DO NOT USE. Bogus StereoMode value used in old versions of libmatroska. (0: mono, 1: right eye, 2: left eye, 3: both eyes)."}],[21440,{name:"AlphaMode",cppname:"VideoAlphaMode",level:4,type:"u",minver:3,webm:true,default:0,description:"Alpha Video Mode. Presence of this element indicates that the BlockAdditional element could contain Alpha data."}],[21432,{name:"StereoMode",cppname:"VideoStereoMode",level:4,type:"u",minver:3,webm:true,default:0,description:"Stereo-3D video mode (0: mono, 1: side by side (left eye is first), 2: top-bottom (right eye is first), 3: top-bottom (left eye is first), 4: checkboard (right is first), 5: checkboard (left is first), 6: row interleaved (right is first), 7: row interleaved (left is first), 8: column interleaved (right is first), 9: column interleaved (left is first), 10: anaglyph (cyan/red), 11: side by side (right eye is first), 12: anaglyph (green/magenta), 13 both eyes laced in one Block (left eye is first), 14 both eyes laced in one Block (right eye is first)) . There are some more details on 3D support in the Specification Notes."}],[154,{name:"FlagInterlaced",cppname:"VideoFlagInterlaced",level:4,type:"u",mandatory:true,minver:2,webm:true,default:0,range:"0-1",description:"Set if the video is interlaced. (1 bit)"}],[224,{name:"Video",cppname:"TrackVideo",level:3,type:"m",minver:1,description:"Video settings."}],[26277,{name:"TrackTranslateTrackID",level:4,type:"b",mandatory:true,minver:1,webm:false,description:"The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used."}],[26303,{name:"TrackTranslateCodec",level:4,type:"u",mandatory:true,minver:1,webm:false,description:"The chapter codec using this ID (0: Matroska Script, 1: DVD-menu)."}],[26364,{name:"TrackTranslateEditionUID",level:4,type:"u",multiple:true,minver:1,webm:false,description:"Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment."}],[22203,{name:"SeekPreRoll",level:3,type:"u",mandatory:true,multiple:false,default:0,minver:4,webm:true,description:"After a discontinuity, SeekPreRoll is the duration in nanoseconds of the data the decoder must decode before the decoded data is valid."}],[22186,{name:"CodecDelay",level:3,type:"u",multiple:false,default:0,minver:4,webm:true,description:"CodecDelay is The codec-built-in delay in nanoseconds. This value must be subtracted from each block timestamp in order to get the actual timestamp. The value should be small so the muxing of tracks with the same actual timestamp are in the same Cluster."}],[28587,{name:"TrackOverlay",level:3,type:"u",multiple:true,minver:1,webm:false,description:"Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc."}],[170,{name:"CodecDecodeAll",level:3,type:"u",mandatory:true,minver:2,webm:false,default:1,range:"0-1",description:"The codec can decode potentially damaged data (1 bit)."}],[2536e3,{name:"CodecDownloadURL",level:3,type:"s",multiple:true,webm:false,description:"A URL to download about the codec used."}],[3883072,{name:"CodecInfoURL",level:3,type:"s",multiple:true,webm:false,description:"A URL to find information about the codec used."}],[3839639,{name:"CodecSettings",level:3,type:"8",webm:false,description:"A string describing the encoding setting used."}],[25506,{name:"CodecPrivate",level:3,type:"b",minver:1,description:"Private data only known to the codec."}],[2274716,{name:"Language",cppname:"TrackLanguage",level:3,type:"s",minver:1,default:"eng",description:"Specifies the language of the track in the Matroska languages form."}],[21358,{name:"Name",cppname:"TrackName",level:3,type:"8",minver:1,description:"A human-readable track name."}],[21998,{name:"MaxBlockAdditionID",level:3,type:"u",mandatory:true,minver:1,webm:false,default:0,description:"The maximum value of BlockAdditions for this track."}],[21375,{name:"TrackOffset",level:3,type:"i",webm:false,default:0,description:"A value to add to the Block's Timestamp. This can be used to adjust the playback offset of a track."}],[2306383,{name:"TrackTimecodeScale",level:3,type:"f",mandatory:true,minver:1,maxver:"3",webm:false,default:"1.0",range:"> 0",description:"DEPRECATED, DO NOT USE. The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs)."}],[2313850,{name:"DefaultDecodedFieldDuration",cppname:"TrackDefaultDecodedFieldDuration",level:3,type:"u",minver:4,range:"not 0",description:"The period in nanoseconds (not scaled by TimcodeScale)\nbetween two successive fields at the output of the decoding process (see the notes)"}],[2352003,{name:"DefaultDuration",cppname:"TrackDefaultDuration",level:3,type:"u",minver:1,range:"not 0",description:"Number of nanoseconds (not scaled via TimecodeScale) per frame ('frame' in the Matroska sense -- one element put into a (Simple)Block)."}],[28152,{name:"MaxCache",cppname:"TrackMaxCache",level:3,type:"u",minver:1,webm:false,description:"The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed."}],[28135,{name:"MinCache",cppname:"TrackMinCache",level:3,type:"u",mandatory:true,minver:1,webm:false,default:0,description:"The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used."}],[156,{name:"FlagLacing",cppname:"TrackFlagLacing",level:3,type:"u",mandatory:true,minver:1,default:1,range:"0-1",description:"Set if the track may contain blocks using lacing. (1 bit)"}],[21930,{name:"FlagForced",cppname:"TrackFlagForced",level:3,type:"u",mandatory:true,minver:1,default:0,range:"0-1",description:"Set if that track MUST be active during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. (1 bit)"}],[185,{name:"FlagEnabled",cppname:"TrackFlagEnabled",level:3,type:"u",mandatory:true,minver:2,webm:true,default:1,range:"0-1",description:"Set if the track is usable. (1 bit)"}],[29637,{name:"TrackUID",level:3,type:"u",mandatory:true,minver:1,range:"not 0",description:"A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file."}],[215,{name:"TrackNumber",level:3,type:"u",mandatory:true,minver:1,range:"not 0",description:"The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number)."}],[174,{name:"TrackEntry",level:2,type:"m",mandatory:true,multiple:true,minver:1,description:"Describes a track with all elements."}],[374648427,{name:"Tracks",level:1,type:"m",multiple:true,minver:1,description:"A top-level block of information with many tracks described."}],[175,{name:"EncryptedBlock",level:2,type:"b",multiple:true,webm:false,description:"Similar to EncryptedBlock Structure)"}],[202,{name:"ReferenceTimeCode",level:4,type:"u",multiple:false,mandatory:true,minver:0,webm:false,divx:true,description:"DivX trick track extenstions"}],[201,{name:"ReferenceOffset",level:4,type:"u",multiple:false,mandatory:true,minver:0,webm:false,divx:true,description:"DivX trick track extenstions"}],[200,{name:"ReferenceFrame",level:3,type:"m",multiple:false,minver:0,webm:false,divx:true,description:"DivX trick track extenstions"}],[207,{name:"SliceDuration",level:5,type:"u",default:0,description:"The (scaled) duration to apply to the element."}],[206,{name:"Delay",cppname:"SliceDelay",level:5,type:"u",default:0,description:"The (scaled) delay to apply to the element."}],[203,{name:"BlockAdditionID",cppname:"SliceBlockAddID",level:5,type:"u",default:0,description:"The ID of the BlockAdditional element (0 is the main Block)."}],[205,{name:"FrameNumber",cppname:"SliceFrameNumber",level:5,type:"u",default:0,description:"The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame)."}],[204,{name:"LaceNumber",cppname:"SliceLaceNumber",level:5,type:"u",minver:1,default:0,divx:false,description:"The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback."}],[232,{name:"TimeSlice",level:4,type:"m",multiple:true,minver:1,divx:false,description:"Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback."}],[142,{name:"Slices",level:3,type:"m",minver:1,divx:false,description:"Contains slices description."}],[30114,{name:"DiscardPadding",level:3,type:"i",minver:4,webm:true,description:"Duration in nanoseconds of the silent data added to the Block (padding at the end of the Block for positive value, at the beginning of the Block for negative value). The duration of DiscardPadding is not calculated in the duration of the TrackEntry and should be discarded during playback."}],[164,{name:"CodecState",level:3,type:"b",minver:2,webm:false,description:"The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry."}],[253,{name:"ReferenceVirtual",level:3,type:"i",webm:false,description:"Relative position of the data that should be in position of the virtual block."}],[251,{name:"ReferenceBlock",level:3,type:"i",multiple:true,minver:1,description:"Timestamp of another frame used as a reference (ie: B or P frame). The timestamp is relative to the block it's attached to."}],[250,{name:"ReferencePriority",cppname:"FlagReferenced",level:3,type:"u",mandatory:true,minver:1,webm:false,default:0,description:"This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced."}],[155,{name:"BlockDuration",level:3,type:"u",minver:1,default:"TrackDuration",description:'The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track (but can be omitted as other default values). When not written and with no DefaultDuration, the value is assumed to be the difference between the timestamp of this Block and the timestamp of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. When set to 0 that means the frame is not a keyframe.'}],[165,{name:"BlockAdditional",level:5,type:"b",mandatory:true,minver:1,webm:false,description:"Interpreted by the codec as it wishes (using the BlockAddID)."}],[238,{name:"BlockAddID",level:5,type:"u",mandatory:true,minver:1,webm:false,default:1,range:"not 0",description:"An ID to identify the BlockAdditional level."}],[166,{name:"BlockMore",level:4,type:"m",mandatory:true,multiple:true,minver:1,webm:false,description:"Contain the BlockAdditional and some parameters."}],[30113,{name:"BlockAdditions",level:3,type:"m",minver:1,webm:false,description:"Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data."}],[162,{name:"BlockVirtual",level:3,type:"b",webm:false,description:"A Block with no data. It must be stored in the stream at the place the real Block should be in display order. (see Block Virtual)"}],[161,{name:"Block",level:3,type:"b",mandatory:true,minver:1,description:"Block containing the actual data to be rendered and a timestamp relative to the Cluster Timecode. (see Block Structure)"}],[160,{name:"BlockGroup",level:2,type:"m",multiple:true,minver:1,description:"Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock."}],[163,{name:"SimpleBlock",level:2,type:"b",multiple:true,minver:2,webm:true,divx:true,description:"Similar to SimpleBlock Structure)"}],[171,{name:"PrevSize",cppname:"ClusterPrevSize",level:2,type:"u",minver:1,description:"Size of the previous Cluster, in octets. Can be useful for backward playing."}],[167,{name:"Position",cppname:"ClusterPosition",level:2,type:"u",minver:1,webm:false,description:"The Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams."}],[22743,{name:"SilentTrackNumber",cppname:"ClusterSilentTrackNumber",level:3,type:"u",multiple:true,minver:1,webm:false,description:"One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster."}],[231,{name:"Timecode",cppname:"ClusterTimecode",level:2,type:"u",mandatory:true,minver:1,description:"Absolute timestamp of the cluster (based on TimecodeScale)."}],[524531317,{name:"Cluster",level:1,type:"m",multiple:true,minver:1,description:"The lower level element containing the (monolithic) Block structure."}],[19840,{name:"MuxingApp",level:2,type:"8",mandatory:true,minver:1,description:'Muxing application or library ("libmatroska-0.4.3").'}],[31657,{name:"Title",level:2,type:"8",minver:1,webm:false,description:"General name of the segment."}],[2807730,{name:"TimecodeScaleDenominator",level:2,type:"u",mandatory:true,minver:4,default:1e9,description:"Timestamp scale numerator, see TimecodeScale."}],[2807729,{name:"TimecodeScale",level:2,type:"u",mandatory:true,minver:1,default:1e6,description:"Timestamp scale in nanoseconds (1.000.000 means all timestamps in the segment are expressed in milliseconds)."}],[27045,{name:"ChapterTranslateID",level:3,type:"b",mandatory:true,minver:1,webm:false,description:"The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used."}],[27071,{name:"ChapterTranslateCodec",level:3,type:"u",mandatory:true,minver:1,webm:false,description:"The chapter codec using this ID (0: Matroska Script, 1: DVD-menu)."}],[27132,{name:"ChapterTranslateEditionUID",level:3,type:"u",multiple:true,minver:1,webm:false,description:"Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment."}],[4096955,{name:"NextFilename",level:2,type:"8",minver:1,webm:false,description:"An escaped filename corresponding to the next segment."}],[4110627,{name:"NextUID",level:2,type:"b",minver:1,webm:false,bytesize:16,description:"A unique ID to identify the next chained segment (128 bits)."}],[3965867,{name:"PrevFilename",level:2,type:"8",minver:1,webm:false,description:"An escaped filename corresponding to the previous segment."}],[3979555,{name:"PrevUID",level:2,type:"b",minver:1,webm:false,bytesize:16,description:"A unique ID to identify the previous chained segment (128 bits)."}],[29604,{name:"SegmentUID",level:2,type:"b",minver:1,webm:false,range:"not 0",bytesize:16,description:"A randomly generated unique ID to identify the current segment between many others (128 bits)."}],[357149030,{name:"Info",level:1,type:"m",mandatory:true,multiple:true,minver:1,description:"Contains miscellaneous general information and statistics on the file."}],[21420,{name:"SeekPosition",level:3,type:"u",mandatory:true,minver:1,description:"The position of the element in the segment in octets (0 = first level 1 element)."}],[21419,{name:"SeekID",level:3,type:"b",mandatory:true,minver:1,description:"The binary ID corresponding to the element name."}],[19899,{name:"Seek",cppname:"SeekPoint",level:2,type:"m",mandatory:true,multiple:true,minver:1,description:"Contains a single seek entry to an EBML element."}],[290298740,{name:"SeekHead",cppname:"SeekHeader",level:1,type:"m",multiple:true,minver:1,description:"Contains the position of other level 1 elements."}],[32379,{name:"SignatureElementList",level:2,type:"m",multiple:true,webm:false,i:"Cluster|Block|BlockAdditional",description:"A list consists of a number of consecutive elements that represent one case where data is used in signature. Ex: means that the BlockAdditional of all Blocks in all Clusters is used for encryption."}],[32347,{name:"SignatureElements",level:1,type:"m",webm:false,description:"Contains elements that will be used to compute the signature."}],[32437,{name:"Signature",level:1,type:"b",webm:false,description:"The signature of the data (until a new."}],[32421,{name:"SignaturePublicKey",level:1,type:"b",webm:false,description:"The public key to use with the algorithm (in the case of a PKI-based signature)."}],[32410,{name:"SignatureHash",level:1,type:"u",webm:false,description:"Hash algorithm used (1=SHA1-160, 2=MD5)."}],[32394,{name:"SignatureAlgo",level:1,type:"u",webm:false,description:"Signature algorithm used (1=RSA, 2=elliptic)."}],[458458727,{name:"SignatureSlot",level:-1,type:"m",multiple:true,webm:false,description:"Contain signature of some (coming) elements in the stream."}],[191,{name:"CRC-32",level:-1,type:"b",minver:1,webm:false,description:"The CRC is computed on all the data of the Master element it's in. The CRC element should be the first in it's parent master for easier reading. All level 1 elements should include a CRC-32. The CRC in use is the IEEE CRC32 Little Endian"}],[236,{name:"Void",level:-1,type:"b",minver:1,description:"Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use."}],[17139,{name:"EBMLMaxSizeLength",level:1,type:"u",mandatory:true,default:8,minver:1,description:"The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid."}],[17138,{name:"EBMLMaxIDLength",level:1,type:"u",mandatory:true,default:4,minver:1,description:"The maximum length of the IDs you'll find in this file (4 or less in Matroska)."}],[17143,{name:"EBMLReadVersion",level:1,type:"u",mandatory:true,default:1,minver:1,description:"The minimum EBML version a parser has to support to read this file."}],[440786851,{name:"EBML",level:0,type:"m",mandatory:true,multiple:true,minver:1,description:"Set the EBML characteristics of the data to follow. Each EBML document has to start with this."}]]);var floor$1=Math.floor;var _isInteger=function isInteger(it){return!_isObject(it)&&isFinite(it)&&floor$1(it)===it};_export(_export.S,"Number",{isInteger:_isInteger});var $parseInt=_global.parseInt;var $trim$1=_stringTrim.trim;var hex=/^[-+]?0[xX]/;var _parseInt=$parseInt(_stringWs+"08")!==8||$parseInt(_stringWs+"0x16")!==22?function parseInt(str,radix){var string=$trim$1(String(str),3);return $parseInt(string,radix>>>0||(hex.test(string)?16:10))}:$parseInt;_export(_export.S+_export.F*(Number.parseInt!=_parseInt),"Number",{parseInt:_parseInt});var domain;function EventHandlers(){}EventHandlers.prototype=Object.create(null);function EventEmitter(){EventEmitter.init.call(this)}EventEmitter.EventEmitter=EventEmitter;EventEmitter.usingDomains=false;EventEmitter.prototype.domain=undefined;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.init=function(){this.domain=null;if(EventEmitter.usingDomains){if(domain.active&&!(this instanceof domain.Domain));}if(!this._events||this._events===Object.getPrototypeOf(this)._events){this._events=new EventHandlers;this._eventsCount=0}this._maxListeners=this._maxListeners||undefined};EventEmitter.prototype.setMaxListeners=function setMaxListeners(n){if(typeof n!=="number"||n<0||isNaN(n))throw new TypeError('"n" argument must be a positive number');this._maxListeners=n;return this};function $getMaxListeners(that){if(that._maxListeners===undefined)return EventEmitter.defaultMaxListeners;return that._maxListeners}EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return $getMaxListeners(this)};function emitNone(handler,isFn,self){if(isFn)handler.call(self);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i0&&existing.length>m){existing.warned=true;var w=new Error("Possible EventEmitter memory leak detected. "+existing.length+" "+type+" listeners added. "+"Use emitter.setMaxListeners() to increase limit");w.name="MaxListenersExceededWarning";w.emitter=target;w.type=type;w.count=existing.length;emitWarning(w)}}}return target}function emitWarning(e){typeof console.warn==="function"?console.warn(e):console.log(e)}EventEmitter.prototype.addListener=function addListener(type,listener){return _addListener(this,type,listener,false)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function prependListener(type,listener){return _addListener(this,type,listener,true)};function _onceWrap(target,type,listener){var fired=false;function g(){target.removeListener(type,g);if(!fired){fired=true;listener.apply(target,arguments)}}g.listener=listener;return g}EventEmitter.prototype.once=function once(type,listener){if(typeof listener!=="function")throw new TypeError('"listener" argument must be a function');this.on(type,_onceWrap(this,type,listener));return this};EventEmitter.prototype.prependOnceListener=function prependOnceListener(type,listener){if(typeof listener!=="function")throw new TypeError('"listener" argument must be a function');this.prependListener(type,_onceWrap(this,type,listener));return this};EventEmitter.prototype.removeListener=function removeListener(type,listener){var list,events,position,i,originalListener;if(typeof listener!=="function")throw new TypeError('"listener" argument must be a function');events=this._events;if(!events)return this;list=events[type];if(!list)return this;if(list===listener||list.listener&&list.listener===listener){if(--this._eventsCount===0)this._events=new EventHandlers;else{delete events[type];if(events.removeListener)this.emit("removeListener",type,list.listener||listener)}}else if(typeof list!=="function"){position=-1;for(i=list.length;i-- >0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){originalListener=list[i].listener;position=i;break}}if(position<0)return this;if(list.length===1){list[0]=undefined;if(--this._eventsCount===0){this._events=new EventHandlers;return this}else{delete events[type]}}else{spliceOne(list,position)}if(events.removeListener)this.emit("removeListener",type,originalListener||listener)}return this};EventEmitter.prototype.removeAllListeners=function removeAllListeners(type){var listeners,events;events=this._events;if(!events)return this;if(!events.removeListener){if(arguments.length===0){this._events=new EventHandlers;this._eventsCount=0}else if(events[type]){if(--this._eventsCount===0)this._events=new EventHandlers;else delete events[type]}return this}if(arguments.length===0){var keys=Object.keys(events);for(var i=0,key;i0?Reflect.ownKeys(this._events):[]};function spliceOne(list,index){for(var i=index,k=i+1,n=list.length;k1){for(var i=1;i=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){_extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray$1(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var length=output.reduce(function(prev,cur){if(cur.indexOf("\n")>=0);return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray$1(ar){return Array.isArray(ar)}function isBoolean(arg){return typeof arg==="boolean"}function isNull(arg){return arg===null}function isNumber(arg){return typeof arg==="number"}function isString(arg){return typeof arg==="string"}function isUndefined(arg){return arg===void 0}function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}function isFunction(arg){return typeof arg==="function"}function objectToString(o){return Object.prototype.toString.call(o)}function _extend(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin}function hasOwnProperty$1(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}function BufferList(){this.head=null;this.tail=null;this.length=0}BufferList.prototype.push=function(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length};BufferList.prototype.unshift=function(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length};BufferList.prototype.shift=function(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret};BufferList.prototype.clear=function(){this.head=this.tail=null;this.length=0};BufferList.prototype.join=function(s){if(this.length===0)return"";var p=this.head;var ret=""+p.data;while(p=p.next){ret+=s+p.data}return ret};BufferList.prototype.concat=function(n){if(this.length===0)return Buffer.alloc(0);if(this.length===1)return this.head.data;var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){p.data.copy(ret,i);i+=p.data.length;p=p.next}return ret};var isBufferEncoding=Buffer.isEncoding||function(encoding){switch(encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function assertEncoding(encoding){if(encoding&&!isBufferEncoding(encoding)){throw new Error("Unknown encoding: "+encoding)}}function StringDecoder(encoding){this.encoding=(encoding||"utf8").toLowerCase().replace(/[-_]/,"");assertEncoding(encoding);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2;this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3;this.detectIncompleteChar=base64DetectIncompleteChar;break;default:this.write=passThroughWrite;return}this.charBuffer=new Buffer(6);this.charReceived=0;this.charLength=0}StringDecoder.prototype.write=function(buffer){var charStr="";while(this.charLength){var available=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;buffer.copy(this.charBuffer,this.charReceived,0,available);this.charReceived+=available;if(this.charReceived=55296&&charCode<=56319){this.charLength+=this.surrogateSize;charStr="";continue}this.charReceived=this.charLength=0;if(buffer.length===0){return charStr}break}this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){buffer.copy(this.charBuffer,0,buffer.length-this.charReceived,end);end-=this.charReceived}charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1;var charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;this.charLength+=size;this.charReceived+=size;this.charBuffer.copy(this.charBuffer,size,0,size);buffer.copy(this.charBuffer,0,0,size);return charStr.substring(0,end)}return charStr};StringDecoder.prototype.detectIncompleteChar=function(buffer){var i=buffer.length>=3?3:buffer.length;for(;i>0;i--){var c=buffer[buffer.length-i];if(i==1&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}this.charReceived=i};StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length)res=this.write(buffer);if(this.charReceived){var cr=this.charReceived;var buf=this.charBuffer;var enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res};function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){this.charReceived=buffer.length%2;this.charLength=this.charReceived?2:0}function base64DetectIncompleteChar(buffer){this.charReceived=buffer.length%3;this.charLength=this.charReceived?3:0}Readable.ReadableState=ReadableState;var debug=debuglog("stream");inherits$1(Readable,EventEmitter);function prependListener(emitter,event,fn){if(typeof emitter.prependListener==="function"){return emitter.prependListener(event,fn)}else{if(!emitter._events||!emitter._events[event])emitter.on(event,fn);else if(Array.isArray(emitter._events[event]))emitter._events[event].unshift(fn);else emitter._events[event]=[fn,emitter._events[event]]}}function listenerCount$1(emitter,type){return emitter.listeners(type).length}function ReadableState(options,stream){options=options||{};this.objectMode=!!options.objectMode;if(stream instanceof Duplex)this.objectMode=this.objectMode||!!options.readableObjectMode;var hwm=options.highWaterMark;var defaultHwm=this.objectMode?16:16*1024;this.highWaterMark=hwm||hwm===0?hwm:defaultHwm;this.highWaterMark=~~this.highWaterMark;this.buffer=new BufferList;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;this.defaultEncoding=options.defaultEncoding||"utf8";this.ranOut=false;this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding}}function Readable(options){if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);this.readable=true;if(options&&typeof options.read==="function")this._read=options.read;EventEmitter.call(this)}Readable.prototype.push=function(chunk,encoding){var state=this._readableState;if(!state.objectMode&&typeof chunk==="string"){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=Buffer.from(chunk,encoding);encoding=""}}return readableAddChunk(this,state,chunk,encoding,false)};Readable.prototype.unshift=function(chunk){var state=this._readableState;return readableAddChunk(this,state,chunk,"",true)};Readable.prototype.isPaused=function(){return this._readableState.flowing===false};function readableAddChunk(stream,state,chunk,encoding,addToFront){var er=chunkInvalid(state,chunk);if(er){stream.emit("error",er)}else if(chunk===null){state.reading=false;onEofChunk(stream,state)}else if(state.objectMode||chunk&&chunk.length>0){if(state.ended&&!addToFront){var e=new Error("stream.push() after EOF");stream.emit("error",e)}else if(state.endEmitted&&addToFront){var _e=new Error("stream.unshift() after end event");stream.emit("error",_e)}else{var skipAdd;if(state.decoder&&!addToFront&&!encoding){chunk=state.decoder.write(chunk);skipAdd=!state.objectMode&&chunk.length===0}if(!addToFront)state.reading=false;if(!skipAdd){if(state.flowing&&state.length===0&&!state.sync){stream.emit("data",chunk);stream.read(0)}else{state.length+=state.objectMode?1:chunk.length;if(addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if(state.needReadable)emitReadable(stream)}}maybeReadMore(stream,state)}}else if(!addToFront){state.reading=false}return needMoreData(state)}function needMoreData(state){return!state.ended&&(state.needReadable||state.length=MAX_HWM){n=MAX_HWM}else{n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++}return n}function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length}if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;if(!state.ended){state.needReadable=true;return 0}return state.length}Readable.prototype.read=function(n){debug("read",n);n=parseInt(n,10);var state=this._readableState;var nOrig=n;if(n!==0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){debug("read: emitReadable",state.length,state.ended);if(state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){if(state.length===0)endReadable(this);return null}var doRead=state.needReadable;debug("need readable",doRead);if(state.length===0||state.length-n0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}else{state.length-=n}if(state.length===0){if(!state.ended)state.needReadable=true;if(nOrig!==n&&state.ended)endReadable(this)}if(ret!==null)this.emit("data",ret);return ret};function chunkInvalid(state,chunk){var er=null;if(!isBuffer(chunk)&&typeof chunk!=="string"&&chunk!==null&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function onEofChunk(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;emitReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug("emitReadable",state.flowing);state.emittedReadable=true;if(state.sync)nextTick(emitReadable_,stream);else emitReadable_(stream)}}function emitReadable_(stream){debug("emit readable");stream.emit("readable");flow(stream)}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;nextTick(maybeReadMore_,stream,state)}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp){debug("false write response, pause",src._readableState.awaitDrain);src._readableState.awaitDrain++;increasedAwaitDrain=true}src.pause()}}function onerror(er){debug("onerror",er);unpipe();dest.removeListener("error",onerror);if(listenerCount$1(dest,"error")===0)dest.emit("error",er)}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish");dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe");src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){debug("pipe resume");src.resume()}return dest};function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain);if(state.awaitDrain)state.awaitDrain--;if(state.awaitDrain===0&&src.listeners("data").length){state.flowing=true;flow(src)}}}Readable.prototype.unpipe=function(dest){var state=this._readableState;if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit("unpipe",this);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;state.flowing=false;for(var _i=0;_i=state.length){if(state.decoder)ret=state.buffer.join("");else if(state.buffer.length===1)ret=state.buffer.head.data;else ret=state.buffer.concat(state.length);state.buffer.clear()}else{ret=fromListPartial(n,state.buffer,state.decoder)}return ret}function fromListPartial(n,list,hasStrings){var ret;if(nstr.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=str.slice(nb)}break}++c}list.length-=c;return ret}function copyFromBuffer(n,list){var ret=Buffer.allocUnsafe(n);var p=list.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=buf.slice(nb)}break}++c}list.length-=c;return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!state.endEmitted){state.ended=true;nextTick(endReadableNT,state,stream)}}function endReadableNT(state,stream){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}}function forEach(xs,f){for(var i=0,l=xs.length;i-1))throw new TypeError("Unknown encoding: "+encoding);this._writableState.defaultEncoding=encoding;return this};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=Buffer.from(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,chunk,encoding,cb){chunk=decodeChunk(state,chunk,encoding);if(Buffer.isBuffer(chunk))encoding="buffer";var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,EbmlDecoder);_this=_possibleConstructorReturn(this,_getPrototypeOf(EbmlDecoder).call(this,_objectSpread({},options,{readableObjectMode:true})));_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"mBuffer",null);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"mTagStack",[]);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"mState",STATE_TAG);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"mCursor",0);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"mTotal",0);return _this}_createClass(EbmlDecoder,[{key:"_transform",value:function _transform(chunk,enc,done){if(!this.buffer){this.buffer=Buffer.from(chunk)}else{this.buffer=Tools.concatenate(this.buffer,Buffer.from(chunk))}while(this.cursor=this.buffer.length){if(debug$1.enabled){debug$1("waiting for more data")}return false}var start=this.total;var tag=Tools.readVint(this.buffer,this.cursor);if(tag==null){if(debug$1.enabled){debug$1("waiting for more data")}return false}var tagStr=Tools.readHexString(this.buffer,this.cursor,this.cursor+tag.length);var tagNum=Number.parseInt(tagStr,16);this.cursor+=tag.length;this.total+=tag.length;this.state=STATE_SIZE;var tagObj={tag:tag.value,tagStr:tagStr,type:EbmlDecoder.getSchemaInfo(tagNum).type,name:EbmlDecoder.getSchemaInfo(tagNum).name,start:start,end:start+tag.length};this.tagStack.push(tagObj);if(debug$1.enabled){debug$1("read tag: ".concat(tagStr))}return true}},{key:"readSize",value:function readSize(){var tagObj=this.tagStack[this.tagStack.length-1];if(debug$1.enabled){debug$1("parsing size for tag: ".concat(tagObj.tagStr))}if(this.cursor>=this.buffer.length){if(debug$1.enabled){debug$1("waiting for more data")}return false}var size=Tools.readVint(this.buffer,this.cursor);if(size==null){if(debug$1.enabled){debug$1("waiting for more data")}return false}this.cursor+=size.length;this.total+=size.length;this.state=STATE_CONTENT;tagObj.dataSize=size.value;if(size.value===-1){tagObj.end=-1}else{tagObj.end+=size.value+size.length}if(debug$1.enabled){debug$1("read size: ".concat(size.value))}return true}},{key:"readContent",value:function readContent(){var _this$tagStack=this.tagStack[this.tagStack.length-1],tagStr=_this$tagStack.tagStr,type=_this$tagStack.type,dataSize=_this$tagStack.dataSize,rest=_objectWithoutProperties(_this$tagStack,["tagStr","type","dataSize"]);if(debug$1.enabled){debug$1("parsing content for tag: ".concat(tagStr))}if(type==="m"){if(debug$1.enabled){debug$1("content should be tags")}this.push(["start",_objectSpread({tagStr:tagStr,type:type,dataSize:dataSize},rest)]);this.state=STATE_TAG;return true}if(this.buffer.length0){var topEle=this.tagStack[this.tagStack.length-1];if(this.totalindex;index++)if(NO_HOLES||index in self){val=self[index];res=f(val,index,O);if(TYPE){if(IS_MAP)result[index]=res;else if(res)switch(TYPE){case 3:return true;case 5:return val;case 6:return index;case 2:result.push(val)}else if(IS_EVERY)return false}}return IS_FIND_INDEX?-1:IS_SOME||IS_EVERY?IS_EVERY:result}};var $find=_arrayMethods(5);var KEY="find";var forced=true;if(KEY in[])Array(1)[KEY](function(){forced=false});_export(_export.P+_export.F*forced,"Array",{find:function find(callbackfn){return $find(this,callbackfn,arguments.length>1?arguments[1]:undefined)}});_addToUnscopables(KEY);var buffers=Buffers;function Buffers(bufs){if(!(this instanceof Buffers))return new Buffers(bufs);this.buffers=bufs||[];this.length=this.buffers.reduce(function(size,buf){return size+buf.length},0)}Buffers.prototype.push=function(){for(var i=0;i=0?i:this.length-i;var reps=[].slice.call(arguments,2);if(howMany===undefined){howMany=this.length-index}else if(howMany>this.length-index){howMany=this.length-index}for(var i=0;i0){var start=index-startBytes;if(start+howMany0){var reps_=reps.slice();reps_.unshift(buf0);reps_.push(buf1);buffers.splice.apply(buffers,[ii,1].concat(reps_));ii+=reps_.length;reps=[]}else{buffers.splice(ii,1,buf0,buf1);ii+=2}}else{removed.push(buffers[ii].slice(start));buffers[ii]=buffers[ii].slice(0,start);ii++}}if(reps.length>0){buffers.splice.apply(buffers,[ii,0].concat(reps));ii+=reps.length}while(removed.lengththis.length)j=this.length;var startBytes=0;for(var si=0;si=j-i?Math.min(start+(j-i)-ti,len):len;buffers[ii].copy(target,ti,start,end);ti+=end-start}return target};Buffers.prototype.pos=function(i){if(i<0||i>=this.length)throw new Error("oob");var l=i,bi=0,bu=null;for(;;){bu=this.buffers[bi];if(l=this.buffers[i].length){j=0;i++;if(i>=this.buffers.length){return-1}}var char=this.buffers[i][j];if(char==needle[match]){if(match==0){mstart={i:i,j:j,pos:pos}}match++;if(match==needle.length){return mstart.pos}}else if(match!=0){i=mstart.i;j=mstart.j;pos=mstart.pos;match=0}j++;pos++}};Buffers.prototype.toBuffer=function(){return this.slice()};Buffers.prototype.toString=function(encoding,start,end){return this.slice(start,end).toString(encoding)};var debug$2=require("debug")("ebml:encoder");function encodeTag(tagId,tagData,end){if(end===-1){return buffers([tagId,Buffer.from("01ffffffffffffff","hex"),tagData])}return buffers([tagId,Tools.writeVint(tagData.length),tagData])}var EbmlEncoder=function(_Transform){_inherits(EbmlEncoder,_Transform);function EbmlEncoder(){var _this;var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,EbmlEncoder);_this=_possibleConstructorReturn(this,_getPrototypeOf(EbmlEncoder).call(this,_objectSpread({},options,{writableObjectMode:true})));_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"mBuffer",null);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"mCorked",false);_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)),"mStack",[]);return _this}_createClass(EbmlEncoder,[{key:"_transform",value:function _transform(chunk,enc,done){var _chunk=_slicedToArray(chunk,2),tag=_chunk[0],_chunk$=_chunk[1],data=_chunk$.data,name=_chunk$.name,rest=_objectWithoutProperties(_chunk$,["data","name"]);if(debug$2.enabled){debug$2("encode ".concat(tag," ").concat(name))}switch(tag){case"start":this.startTag(name,_objectSpread({name:name,data:data},rest));break;case"tag":this.writeTag(name,data);break;case"end":this.endTag();break;default:break}done()}},{key:"flush",value:function flush(){var done=arguments.length>0&&arguments[0]!==undefined?arguments[0]:function(){};if(!this.buffer||this.corked){if(debug$2.enabled){debug$2("no buffer/nothing pending")}done();return}if(debug$2.enabled){debug$2("writing ".concat(this.buffer.length," bytes"))}var chunk=Buffer.from(this.buffer);this.buffer=null;this.push(chunk);done()}},{key:"bufferAndFlush",value:function bufferAndFlush(buffer){if(this.buffer){this.buffer=Tools.concatenate(this.buffer,buffer)}else{this.buffer=buffers(buffer)}this.flush()}},{key:"_flush",value:function _flush(){var done=arguments.length>0&&arguments[0]!==undefined?arguments[0]:function(){};this.flush(done)}},{key:"_bufferAndFlush",value:function _bufferAndFlush(buffer){this.bufferAndFlush(buffer)}},{key:"cork",value:function cork(){this.corked=true}},{key:"uncork",value:function uncork(){this.corked=false;this.flush()}},{key:"writeTag",value:function writeTag(tagName,tagData){var tagId=EbmlEncoder.getSchemaInfo(tagName);if(!tagId){throw new Error("No schema entry found for ".concat(tagName))}if(tagData){var data=encodeTag(tagId,tagData);if(this.stack.length>0){this.stack[this.stack.length-1].children.push({data:data})}else{this.bufferAndFlush(data.buffer)}}}},{key:"startTag",value:function startTag(tagName,_ref){var end=_ref.end;var tagId=EbmlEncoder.getSchemaInfo(tagName);if(!tagId){throw new Error("No schema entry found for ".concat(tagName))}var tag={data:null,id:tagId,name:tagName,end:end,children:[]};if(this.stack.length>0){this.stack[this.stack.length-1].children.push(tag)}this.stack.push(tag)}},{key:"endTag",value:function endTag(){var tag=this.stack.pop();var childTagDataBuffers=tag.children.map(function(child){return child.data});tag.data=encodeTag(tag.id,buffers(childTagDataBuffers),tag.end);if(this.stack.length<1){this.bufferAndFlush(tag.data.buffer)}this.end()}},{key:"buffer",get:function get(){return this.mBuffer},set:function set(buffer){this.mBuffer=buffer}},{key:"corked",get:function get(){return this.mCorked},set:function set(corked){this.mCorked=corked}},{key:"stack",get:function get(){return this.mStack},set:function set(stak){this.mStack=stak}}],[{key:"getSchemaInfo",value:function getSchemaInfo(tagName){var tagId=Array.from(schema.keys()).find(function(str){return schema.get(str).name===tagName});if(tagId){return tagId}return null}}]);return EbmlEncoder}(Transform);exports.tools=Tools;exports.schema=schema;exports.Decoder=EbmlDecoder;exports.Encoder=EbmlEncoder}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer)},{buffer:9,debug:14}],14:[function(require,module,exports){(function(process){(function(){exports=module.exports=require("./debug");exports.log=log;exports.formatArgs=formatArgs;exports.save=save;exports.load=load;exports.useColors=useColors;exports.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:localstorage();exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function useColors(){if(typeof window!=="undefined"&&window.process&&window.process.type==="renderer"){return true}if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)){return false}return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}exports.formatters.j=function(v){try{return JSON.stringify(v)}catch(err){return"[UnexpectedJSONParseError]: "+err.message}};function formatArgs(args){var useColors=this.useColors;args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff);if(!useColors)return;var c="color: "+this.color;args.splice(1,0,c,"color: inherit");var index=0;var lastC=0;args[0].replace(/%[a-zA-Z%]/g,function(match){if("%%"===match)return;index++;if("%c"===match){lastC=index}});args.splice(lastC,0,c)}function log(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{if(null==namespaces){exports.storage.removeItem("debug")}else{exports.storage.debug=namespaces}}catch(e){}}function load(){var r;try{r=exports.storage.debug}catch(e){}if(!r&&typeof process!=="undefined"&&"env"in process){r=process.env.DEBUG}return r}exports.enable(load());function localstorage(){try{return window.localStorage}catch(e){}}}).call(this)}).call(this,require("_process"))},{"./debug":15,_process:21}],15:[function(require,module,exports){exports=module.exports=createDebug.debug=createDebug["default"]=createDebug;exports.coerce=coerce;exports.disable=disable;exports.enable=enable;exports.enabled=enabled;exports.humanize=require("ms");exports.instances=[];exports.names=[];exports.skips=[];exports.formatters={};function selectColor(namespace){var hash=0,i;for(i in namespace){hash=(hash<<5)-hash+namespace.charCodeAt(i);hash|=0}return exports.colors[Math.abs(hash)%exports.colors.length]}function createDebug(namespace){var prevTime;function debug(){if(!debug.enabled)return;var self=debug;var curr=+new Date;var ms=curr-(prevTime||curr);self.diff=ms;self.prev=prevTime;self.curr=curr;prevTime=curr;var args=new Array(arguments.length);for(var i=0;i0){return parse(val)}else if(type==="number"&&isNaN(val)===false){return options.long?fmtLong(val):fmtShort(val)}throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(val))};function parse(str){str=String(str);if(str.length>100){return}var match=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);if(!match){return}var n=parseFloat(match[1]);var type=(match[2]||"ms").toLowerCase();switch(type){case"years":case"year":case"yrs":case"yr":case"y":return n*y;case"days":case"day":case"d":return n*d;case"hours":case"hour":case"hrs":case"hr":case"h":return n*h;case"minutes":case"minute":case"mins":case"min":case"m":return n*m;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return undefined}}function fmtShort(ms){if(ms>=d){return Math.round(ms/d)+"d"}if(ms>=h){return Math.round(ms/h)+"h"}if(ms>=m){return Math.round(ms/m)+"m"}if(ms>=s){return Math.round(ms/s)+"s"}return ms+"ms"}function fmtLong(ms){return plural(ms,d,"day")||plural(ms,h,"hour")||plural(ms,m,"minute")||plural(ms,s,"second")||ms+" ms"}function plural(ms,n,name){if(ms0)er=args[0];if(er instanceof Error){throw er}var err=new Error("Unhandled error."+(er?" ("+er.message+")":""));err.context=er;throw err}var handler=events[type];if(handler===undefined)return false;if(typeof handler==="function"){ReflectApply(handler,this,args)}else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i0&&existing.length>m&&!existing.warned){existing.warned=true;var w=new Error("Possible EventEmitter memory leak detected. "+existing.length+" "+String(type)+" listeners "+"added. Use emitter.setMaxListeners() to "+"increase limit");w.name="MaxListenersExceededWarning";w.emitter=target;w.type=type;w.count=existing.length;ProcessEmitWarning(w)}}return target}EventEmitter.prototype.addListener=function addListener(type,listener){return _addListener(this,type,listener,false)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function prependListener(type,listener){return _addListener(this,type,listener,true)};function onceWrapper(){if(!this.fired){this.target.removeListener(this.type,this.wrapFn);this.fired=true;if(arguments.length===0)return this.listener.call(this.target);return this.listener.apply(this.target,arguments)}}function _onceWrap(target,type,listener){var state={fired:false,wrapFn:undefined,target:target,type:type,listener:listener};var wrapped=onceWrapper.bind(state);wrapped.listener=listener;state.wrapFn=wrapped;return wrapped}EventEmitter.prototype.once=function once(type,listener){checkListener(listener);this.on(type,_onceWrap(this,type,listener));return this};EventEmitter.prototype.prependOnceListener=function prependOnceListener(type,listener){checkListener(listener);this.prependListener(type,_onceWrap(this,type,listener));return this};EventEmitter.prototype.removeListener=function removeListener(type,listener){var list,events,position,i,originalListener;checkListener(listener);events=this._events;if(events===undefined)return this;list=events[type];if(list===undefined)return this;if(list===listener||list.listener===listener){if(--this._eventsCount===0)this._events=Object.create(null);else{delete events[type];if(events.removeListener)this.emit("removeListener",type,list.listener||listener)}}else if(typeof list!=="function"){position=-1;for(i=list.length-1;i>=0;i--){if(list[i]===listener||list[i].listener===listener){originalListener=list[i].listener;position=i;break}}if(position<0)return this;if(position===0)list.shift();else{spliceOne(list,position)}if(list.length===1)events[type]=list[0];if(events.removeListener!==undefined)this.emit("removeListener",type,originalListener||listener)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function removeAllListeners(type){var listeners,events,i;events=this._events;if(events===undefined)return this;if(events.removeListener===undefined){if(arguments.length===0){this._events=Object.create(null);this._eventsCount=0}else if(events[type]!==undefined){if(--this._eventsCount===0)this._events=Object.create(null);else delete events[type]}return this}if(arguments.length===0){var keys=Object.keys(events);var key;for(i=0;i=0;i--){this.removeListener(type,listeners[i])}}return this};function _listeners(target,type,unwrap){var events=target._events;if(events===undefined)return[];var evlistener=events[type];if(evlistener===undefined)return[];if(typeof evlistener==="function")return unwrap?[evlistener.listener||evlistener]:[evlistener];return unwrap?unwrapListeners(evlistener):arrayClone(evlistener,evlistener.length)}EventEmitter.prototype.listeners=function listeners(type){return _listeners(this,type,true)};EventEmitter.prototype.rawListeners=function rawListeners(type){return _listeners(this,type,false)};EventEmitter.listenerCount=function(emitter,type){if(typeof emitter.listenerCount==="function"){return emitter.listenerCount(type)}else{return listenerCount.call(emitter,type)}};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(type){var events=this._events;if(events!==undefined){var evlistener=events[type];if(typeof evlistener==="function"){return 1}else if(evlistener!==undefined){return evlistener.length}}return 0}EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(arr,n){var copy=new Array(n);for(var i=0;i>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],19:[function(require,module,exports){(function(Buffer){(function(){var Uint64BE,Int64BE,Uint64LE,Int64LE;!function(exports){var UNDEFINED="undefined";var BUFFER=UNDEFINED!==typeof Buffer&&Buffer;var UINT8ARRAY=UNDEFINED!==typeof Uint8Array&&Uint8Array;var ARRAYBUFFER=UNDEFINED!==typeof ArrayBuffer&&ArrayBuffer;var ZERO=[0,0,0,0,0,0,0,0];var isArray=Array.isArray||_isArray;var BIT32=4294967296;var BIT24=16777216;var storage;Uint64BE=factory("Uint64BE",true,true);Int64BE=factory("Int64BE",true,false);Uint64LE=factory("Uint64LE",false,true);Int64LE=factory("Int64LE",false,false);function factory(name,bigendian,unsigned){var posH=bigendian?0:4;var posL=bigendian?4:0;var pos0=bigendian?0:3;var pos1=bigendian?1:2;var pos2=bigendian?2:1;var pos3=bigendian?3:0;var fromPositive=bigendian?fromPositiveBE:fromPositiveLE;var fromNegative=bigendian?fromNegativeBE:fromNegativeLE;var proto=Int64.prototype;var isName="is"+name;var _isInt64="_"+isName;proto.buffer=void 0;proto.offset=0;proto[_isInt64]=true;proto.toNumber=toNumber;proto.toString=toString;proto.toJSON=toNumber;proto.toArray=toArray;if(BUFFER)proto.toBuffer=toBuffer;if(UINT8ARRAY)proto.toArrayBuffer=toArrayBuffer;Int64[isName]=isInt64;exports[name]=Int64;return Int64;function Int64(buffer,offset,value,raddix){if(!(this instanceof Int64))return new Int64(buffer,offset,value,raddix);return init(this,buffer,offset,value,raddix)}function isInt64(b){return!!(b&&b[_isInt64])}function init(that,buffer,offset,value,raddix){if(UINT8ARRAY&&ARRAYBUFFER){if(buffer instanceof ARRAYBUFFER)buffer=new UINT8ARRAY(buffer);if(value instanceof ARRAYBUFFER)value=new UINT8ARRAY(value)}if(!buffer&&!offset&&!value&&!storage){that.buffer=newArray(ZERO,0);return}if(!isValidBuffer(buffer,offset)){var _storage=storage||Array;raddix=offset;value=buffer;offset=0;buffer=storage===BUFFER?BUFFER.alloc(8):new _storage(8)}that.buffer=buffer;that.offset=offset|=0;if(UNDEFINED===typeof value)return;if("string"===typeof value){fromString(buffer,offset,value,raddix||10)}else if(isValidBuffer(value,raddix)){fromArray(buffer,offset,value,raddix)}else if("number"===typeof raddix){writeInt32(buffer,offset+posH,value);writeInt32(buffer,offset+posL,raddix)}else if(value>0){fromPositive(buffer,offset,value)}else if(value<0){fromNegative(buffer,offset,value)}else{fromArray(buffer,offset,ZERO,0)}}function fromString(buffer,offset,str,raddix){var pos=0;var len=str.length;var high=0;var low=0;if(str[0]==="-")pos++;var sign=pos;while(pos=0))break;low=low*raddix+chr;high=high*raddix+Math.floor(low/BIT32);low%=BIT32}if(sign){high=~high;if(low){low=BIT32-low}else{high++}}writeInt32(buffer,offset+posH,high);writeInt32(buffer,offset+posL,low)}function toNumber(){var buffer=this.buffer;var offset=this.offset;var high=readInt32(buffer,offset+posH);var low=readInt32(buffer,offset+posL);if(!unsigned)high|=0;return high?high*BIT32+low:low}function toString(radix){var buffer=this.buffer;var offset=this.offset;var high=readInt32(buffer,offset+posH);var low=readInt32(buffer,offset+posL);var str="";var sign=!unsigned&&high&2147483648;if(sign){high=~high;low=BIT32-low}radix=radix||10;while(1){var mod=high%radix*BIT32+low;high=Math.floor(high/radix);low=Math.floor(mod/radix);str=(mod%radix).toString(radix)+str;if(!high&&!low)break}if(sign){str="-"+str}return str}function writeInt32(buffer,offset,value){buffer[offset+pos3]=value&255;value=value>>8;buffer[offset+pos2]=value&255;value=value>>8;buffer[offset+pos1]=value&255;value=value>>8;buffer[offset+pos0]=value&255}function readInt32(buffer,offset){return buffer[offset+pos0]*BIT24+(buffer[offset+pos1]<<16)+(buffer[offset+pos2]<<8)+buffer[offset+pos3]}}function toArray(raw){var buffer=this.buffer;var offset=this.offset;storage=null;if(raw!==false&&isArray(buffer)){return buffer.length===8?buffer:buffer.slice(offset,offset+8)}return newArray(buffer,offset)}function toBuffer(raw){var buffer=this.buffer;var offset=this.offset;storage=BUFFER;if(raw!==false&&BUFFER.isBuffer(buffer)){return buffer.length===8?buffer:buffer.slice(offset,offset+8)}return BUFFER.from(toArrayBuffer.call(this,raw))}function toArrayBuffer(raw){var buffer=this.buffer;var offset=this.offset;var arrbuf=buffer.buffer;storage=UINT8ARRAY;if(raw!==false&&!buffer.offset&&arrbuf instanceof ARRAYBUFFER){return arrbuf.byteLength===8?arrbuf:arrbuf.slice(offset,offset+8)}var dest=new UINT8ARRAY(8);fromArray(dest,0,buffer,offset);return dest.buffer}function isValidBuffer(buffer,offset){var len=buffer&&buffer.length;offset|=0;return len&&offset+8<=len&&"string"!==typeof buffer[offset]}function fromArray(destbuf,destoff,srcbuf,srcoff){destoff|=0;srcoff|=0;for(var i=0;i<8;i++){destbuf[destoff++]=srcbuf[srcoff++]&255}}function newArray(buffer,offset){return Array.prototype.slice.call(buffer,offset,offset+8)}function fromPositiveBE(buffer,offset,value){var pos=offset+8;while(pos>offset){buffer[--pos]=value&255;value/=256}}function fromNegativeBE(buffer,offset,value){var pos=offset+8;value++;while(pos>offset){buffer[--pos]=-value&255^255;value/=256}}function fromPositiveLE(buffer,offset,value){var end=offset+8;while(offset