/*! GoldPlay built @2023/6/27 14:15:19 */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.GoldPlay=t():e.GoldPlay=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=166)}([function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,n(t)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){function n(e,t){for(var n=0;n2&&"error"!==e)return;for(var n=(new Date).toLocaleString(),r=arguments.length,i=new Array(r>2?r-2:0),a=2;a1&&void 0!==arguments[1]?arguments[1]:{};i()(this,e),u()(this,"prefix",l.c.projectName),u()(this,"joiner",">"),u()(this,"left","["),u()(this,"right","]"),u()(this,"disabled",!1),u()(this,"level",0),Object.assign(this,n),"string"==typeof t?this.file=t:t&&t.constructor&&(this.file=t.constructor.name)}return o()(e,[{key:"setDisabled",value:function(e){this.disabled=e}},{key:"setLevel",value:function(e){this.level=e}}],[{key:"get",value:function(t,n){return new e(t,n)}}]),e}();["info","log","debug","warn","error"].forEach((function(e){h.prototype[e]=function(t,n){n=void 0===n?"":this.joiner+n;for(var r=this.left+t+n+this.right,i=this.left+this.prefix+" "+this.file+this.right+r,a=arguments.length,o=new Array(a>2?a-2:0),s=2;s1&&(n=arguments[1]),n instanceof Error)throw n;var l=new Error('Unhandled "error" event. ('+n+")");throw l.context=n,l}if(!(r=s[e]))return!1;var c="function"==typeof r;switch(i=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,i=y(e,r),a=0;a0&&o.length>r){o.warned=!0;class n extends Error{}let r=new n("Possible Dispatcher memory leak detected. "+o.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');r.name="MaxListenersExceededWarning",r.emitter=e,r.type=t,r.count=o.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",r.name,r.message)}}else o=a[t]=n,++e._eventsCount;var s;return e}(this,e,t)}once(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,function(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=o.call(h,r);return i.listener=n,r.wrapFn=i,i}(this,e,t)),this}off(e,t){return f.call(this,e,t)}removeAllListeners(e){var t,n,r;if(!(n=this._events))return this;if(!n.off)return 0===arguments.length?(this._events=i(null),this._eventsCount=0):n[e]&&(0==--this._eventsCount?this._events=i(null):delete n[e]),this;if(0===arguments.length){var o,s=a(n);for(r=0;r=0;r--)this.off(e,t[r]);return this}listeners(e){return d(this,e,!0)}rawListeners(e){return d(this,e,!1)}listenerCount(){return l.listenerCount.apply(this,arguments)}}try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),s=0===c.x}catch(e){s=!1}function f(e,t){var n,r,a,o,s;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(r=this._events))return this;if(!(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=i(null):(delete r[e],r.off&&this.emit("off",e,n.listener||t));else if("function"!=typeof n){for(a=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){s=n[o].listener,a=o;break}if(a<0)return this;0===a?n.shift():function(e,t){for(var n=t,r=n+1,i=e.length;r0&&(t=0===e.length?e[0]:this.toNewBytes()),t}get empty(){return 0===this.list_.length}get bufferList(){return this.list_}clear(){let e=this.list_.length;e>0&&this.list_.splice(0,e),this.byteLength_=null}toNewBytes(){let e=null,t=0;for(;null===e;)try{t++,e=new Uint8Array(this.byteLength)}catch(e){if(t>50)throw e}for(let t=0,n=0;t0&&!this.empty){let r=this.list_,i=0,a=0;for(;r.length>0;){let o=r.shift();if(0!==a){let a=e-i;if(o.byteLength>=a){t&&n.set(o.subarray(0,a),i),o=o.subarray(a),o.byteLength>0&&r.unshift(o);break}t&&n.set(o,i),i+=o.byteLength;break}if(o.byteLength>=e){t&&(n=o.subarray(0,e)),o.byteLength>e&&(o=o.subarray(e),r.unshift(o));break}if(t){try{n=new Uint8Array(e)}catch(t){throw`alloc_memory_error@ cache buffer: ${e} ${t.message}`}n.set(o,0)}i+=o.byteLength,a++}this.byteLength_=null}return n}}class x{constructor(){this.map_={}}push(e,t){Object.prototype.hasOwnProperty.call(this.map_,e)?this.map_[e].push(t):this.map_[e]=[t]}get(e){let t=this.map_[e];return t?t.slice():null}getAll(){let e=[];for(let t in this.map_)e.push.apply(e,this.map_[t]);return e}remove(e,t){let n=this.map_[e];if(n)for(let e=0;e>>",...e)}debug(...e){S?E.emit(this.MSG_NAME,"debug",[...e].join("")):this._enable&&_.debug&&_.debug.call(_,">>>",...e)}assert(...e){if(this._enable&&_.assert){let t=e[0],n=Array.prototype.slice.call(e,1);n.unshift(">>>"),_.assert.call(_,t,...n)}}warn(...e){S?E.emit(this.MSG_NAME,"warn",[...e].join("")):this._enable&&_.warn.call(_,">>>",...e)}error(...e){S?E.emit(this.MSG_NAME,"error",[...e].join("")):this._enable&&_.error.call(_,">>>",...e)}};class R extends l{constructor(){super()}pipe(e){return this.on("reset",(function(){e.reset()})),this.on("data",(function(t){e.push(t)})),this.on("done",(function(t){e.flush(t)})),e}unpipe(){return this.removeAllListeners("reset"),this.removeAllListeners("data"),this.removeAllListeners("done"),this}push(e,t){this.emit("data",e)}flush(e){this.emit("done",e)}reset(){this.emit("reset")}}class L extends R{constructor(e={}){super(),e.debug&&(E.enable=!0),this.ctx_=new v,this.options_=e,this.cache_buffer_=new P}listenEndStream_(){this.eventManager_=new B,this.eventManager_.on(this.endStream,"data",e=>{this.emit(r.DEMUX_DATA,e)}).on(this.endStream,"done",e=>{this.emit(r.DONE,e)}).on(this.ctx_,"error",e=>{this.emit(r.ERROR,e)})}constraintPushData_(e){let t=null;return k(e)||m(n=e)&&"[object uint8array]"===g.call(n).toLowerCase()?(t=k(e)?new Uint8Array(e):e,t):(E.error("Data pushed is not an ArrayBuffer or Uint8Array: "+e),t);var n}reset(){}destroy(){this.unpipe(),this.endStream.unpipe(),this.eventManager_.removeAll()}}var C;!function(e){e[e.WORKER_EXCEPTION=0]="WORKER_EXCEPTION",e[e.WORKER_MSG_EXCEPTION=1]="WORKER_MSG_EXCEPTION",e[e.TS_SYNC_BYTE=2]="TS_SYNC_BYTE",e[e.FLV_HEAD_SIGNATURE=3]="FLV_HEAD_SIGNATURE",e[e.FLV_NOT_EXPECTED_ADJACENT_DATA=4]="FLV_NOT_EXPECTED_ADJACENT_DATA"}(C||(C={}));var A=C;class D{constructor(e){var t,n=0,r=((15&e[1])<<8|e[2])-4-5;for(this.pmtTable=[];nnetwork_PID %0x /n/n",t)}else this.pmtTable.push({programNum:t,program_map_PID:(31&e[10+n])<<8|e[11+n]})}}class O{constructor(e){let t=(15&e[1])<<8|e[2];const n=(15&e[10])<<8|e[11];if(n<0)return;if(n>2){let t=0;for(;t=a)return void E.warn(`es_section_pos < es_section_end ${r}, ${a}`);this.pes_table=[];let o=0;for(;o0?e[0]:-1}get tracks(){return this.pes_streams}reset(){this.pat_table.splice(0,this.pat_table.length),this.pes_streams.splice(0,this.pes_streams.length)}parse(e){0===e.PID?this._parsePat(e):1===e.PID||2===e.PID||3<=e.PID&&e.PID<=15||17===e.PID||e.PID===this.currentProgramPID&&this._parsePmt(e)}findTrack(e){let t=null,n=this.pes_streams;for(let r=0;r=0&&/(rv)(?::| )([\w.]+)/.exec(H)||H.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(H)||[],j=/(ipad)/.exec(H)||/(ipod)/.exec(H)||/(windows phone)/.exec(H)||/(iphone)/.exec(H)||/(kindle)/.exec(H)||/(silk)/.exec(H)||/(android)/.exec(H)||/(win)/.exec(H)||/(mac)/.exec(H)||/(linux)/.exec(H)||/(cros)/.exec(H)||/(playbook)/.exec(H)||/(bb)/.exec(H)||/(blackberry)/.exec(H)||[],V={version:void 0},W={browser:F[5]||F[3]||F[1]||"",version:F[2]||F[4]||"0",versionNumber:F[4]||F[2]||"0",platform:j[0]||""};if(W.browser){V[W.browser]=!0;let e=W.versionNumber.split(".");V.version={major:parseInt(W.versionNumber,10),string:W.version},e.length>1&&(V.version.minor=parseInt(e[1],10)),e.length>2&&(V.version.build=parseInt(e[2],10))}I.version=V.version,I.CHROME=!!V.chrome,I.SAFARI=!!V.safari&&!I.CHROME,I.FIREFOX=!!V.firefox,I.IE11=/rv:11/.test(H),I.IE=!!V.msie||I.IE11,I.EDGE=!!V.edge,I.WECHAT=/(wechat)|(micromessenger)/.test(H),N.mac=!!W.platform.mac,N.iphone=!!W.platform.iphone,N.android=!!W.platform.android;var z=I,X=N;const G=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];const Y=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];class $ extends l{constructor(){super()}push(e){let t,n,r,i,a,{pts:o,dts:s,payload:u}=e,l=u,c=0,f=0;for(;c+5>5,i=1024*(1+(3&l[c+6])),a=9e4*i/Y[(60&l[c+2])>>>2],r=c+t,l.byteLength>>6&3),channelCount:(1&l[c+2])<<2|(192&l[c+3])>>>6,sampleRate:Y[(60&l[c+2])>>>2],samplingFrequencyIndex:(60&l[c+2])>>>2,sampleSize:16,data:l.subarray(c+7+n,r)};if(this.emit("frame",e),l.byteLength===r)return l=void 0,void this.emit("done");f++,l=l.subarray(r)}}}class q extends R{constructor(e){super(),this.PSI=e,this.trackId=null,this.codec=new $,this.codec.on("frame",e=>{this.frames.push(e),this.frames.byteLength+=e.data.byteLength,this.frames.trackId=this.trackId}),this._newFrames()}push(e){15===e.stream_type&&(this.trackId=e.pid,this.codec.push({dts:e.pes.DTS,pts:e.pes.PTS,payload:e.pes.data_byte}))}flush(){if(this.frames.length>0){let e=this.frames.length,t=this.frames[0],n=this.frames[e-1],r=n.sampleRate*n.sampleCount/9e4;this.frames.firstDTS=t.dts,this.frames.firstPTS=t.pts,this.frames.duration=1===e?r:r+(n.pts-t.pts),this._updateTrackMeta(t),this.emit("data",this.frames),this.reset(),this.emit("done")}}reset(){this.trackId=null,this._newFrames()}_newFrames(){this.frames=[],this.frames.type="audio",this.frames.byteLength=0,this.frames.duration=0,this.frames.firstDTS=0,this.frames.firstPTS=0}_updateTrackMeta(e){let t=this.PSI.findTrack(this.trackId),n=((e,t,n)=>{let r,i,a=e;if(!(t>G.length-1))return z.FIREFOX?t>=6?(e=5,i=new Array(4),r=t-3):(e=2,i=new Array(2),r=t):X.android?(e=2,i=new Array(2),r=t):(e=5,i=new Array(4),t>=6?r=t-3:(1===n&&(e=2,i=new Array(2)),r=t)),i[0]=e<<3,i[0]|=(14&t)>>1,i[1]|=(1&t)<<7,i[1]|=n<<3,5===e&&(i[1]|=(14&r)>>1,i[2]=(1&r)<<7,i[2]|=8,i[3]=0),{config:i,sampleRate:G[t],channelCount:n,codec:"mp4a.40."+e,realCodec:"mp4a.40."+a};E.error("invalid sampling index:"+t)})(e.audioObjectType,e.samplingFrequencyIndex,e.channelCount);t.config=n.config,t.sampleRate=n.sampleRate,t.inputTimeScale=t.inputTimeScale||t.timescale,t.timescale=n.sampleRate,t.channelCount=n.channelCount,t.codec=n.codec,t.realCodec=n.realCodec,t.isAAC=!0}}function K(e){let t=0;return ArrayBuffer.isView(e)&&(t=e.byteOffset,e=e.buffer),new DataView(e,t)}class Q{constructor(){}readUint8(e,t){return K(e).getUint8(t)}readUint16(e,t,n=!1){return K(e).getUint16(t,n)}readUint32(e,t,n=!1){return K(e).getUint32(t,n)}}function Z(e,t=0,n=1){let r=0,i=0,a=0,o="",s=0;for(let a=t;a>i&1,o+=s;return a=parseInt(o,2),a}function J(e,t=0){let n=[],r=8*e.byteLength,i=!1,a=0,o=0,s=0,u="";for(let u=t;u>o&1,!i){if(0!==s){i=!0,t=u;break}n.push(0)}let l=n.length+1;for(let n=t;n>o&1,u+=s;return{bitLength:n.length+l,value:parseInt(u,2)-1}}var ee={readUEV:J,readSEV:function(e,t=0){let n=J(e,t),r=n.value,i=Math.pow(-1,r+1)*Math.ceil(r/2);return{bitLength:n.bitLength,value:i}},readBit:Z,readByte:function(e,t=0){return Z(e,t,8)}};let te=0;function ne(e,t){let n,r=8,i=8;for(var a=0;a>7,this.ref_idc=e[0]>>5&3,this.unit_type=31&e[0],this.data=function(e){let t,n=e.byteLength,r=[],i=1,a=new Uint8Array(0);for(;i0){let e=ee.readUEV(i,r);r+=e.bitLength;let u,l=0;switch(e.value){case 0:for(l=0;l<=e.value;l++)u=ee.readUEV(i,r),r+=u.bitLength;break;case 2:for(l=0;l<=e.value;l++)u=ee.readUEV(i,r),r+=u.bitLength,u=ee.readUEV(i,r),r+=u.bitLength;break;case 3:case 4:case 5:r+=1,t=ee.readUEV(i,r),r+=t.bitLength;break;case 6:{n=ee.readUEV(i,r),r+=n.bitLength;let e=Math.ceil(Math.log2(s.value+1));for(o=0;o<=n.value;o++)a.push(ee.readBit(i,r,e)),r+=e}}}return r+=ee.readUEV(i,r).bitLength,r+=ee.readUEV(i,r).bitLength,r+=1,r+=1,r+=ee.readSEV(i,r).bitLength,r+=ee.readSEV(i,r).bitLength,r+=ee.readSEV(i,r).bitLength,r+=1,r+=1,r+=1,{sliceGroupNum:s.value+1}}(this.data);break;case 6:this.sei=(this.data,{});break;case 9:this.primary_pic_type=this.data[0]>>5}}}class ie extends l{constructor(){super(...arguments),this.lastState=null,this.lastNALu=null,this.lastNALuState=null}spitNalu_(e,t,n){let r=new re(e);r.pts=t,r.dts=n,this.lastNALu=r,this.emit("nalu",r)}push(e){const{lastState:t,lastNALuState:n}=this;let r=0,i=-1,{pts:a,dts:o,payload:s,naluSizeLength:u}=e;if(u){let e=0,t=0,n=0,r=s.length;do{t=0;for(let n=0;nr&&(n=r),this.spitNalu_(s.subarray(e,n),a,o),e=n}while(e0);u>=3&&(s=s.subarray(0,e+1));const l=s.length;let c=0;do{let e=s[r++];if(0!==c)if(1!==c)if(e)if(1===e){if(i>=0)this.lastNALuState=c,this.spitNalu_(s.subarray(i,r-1-c),a,o);else{const e=this.lastNALu;if(e){t&&r<=4-t&&n&&(e.rawData=e.rawData.subarray(0,e.rawData.byteLength-t));let i=r-c-1;if(i>0){E.log(`overflow NALU found: ${i}/${a}/${o}`);let t=new P;t.append(e.rawData),t.append(s.subarray(0,i));let n=t.toNewBytes();t.clear(),e.rawData=n}}}r=0&&c>=0&&(this.lastNALuState=c,this.spitNalu_(s.subarray(i,l),a,o)),this.lastState=c}this.emit("done")}reset(){this.lastState=null,this.lastNALu=null,this.lastNALuState=null}}class ae extends R{constructor(e){super(),this.PSI=e,this.trackId=null,this.currentFrame=[],this.codec=new ie,this._newGop(),this._newGops(),this.codec.on("nalu",e=>{if(7===e.unit_type){let t=this.PSI.findTrack(this.trackId),n=(e=>{let t="avc1.",n=[e.profile_idc,e.profile_compatibility,e.level_idc];for(let e=0;e0&&((!this.currentFrame.duration||this.currentFrame.duration<=0)&&(this.currentFrame.duration=this.prevFrame.duration||0),this._pushFrameIntoGop(),this.currentFrame=[]),this.gop.length>0&&this._pushGopIntoGroup()}reset(){this.codec.reset(),this.currentFrame=[],this._newGop(),this._newGops()}_grouping(e){9===e.unit_type?(this.currentFrame.length>0&&(this.currentFrame.duration=e.dts-this.currentFrame.dts,this.gop.length>0&&this.currentFrame.keyframe&&(this.gop.trackId=this.trackId,this._pushGopIntoGroup()),this.currentFrame.keyframe||this.gop.length>0?this._pushFrameIntoGop():E.warn("h264 codec drop frame")),this.prevFrame=this.currentFrame,this.currentFrame=[],this.currentFrame.keyframe=!1,this.currentFrame.byteLength=0,this.currentFrame.naluCount=0,this.currentFrame.pts=e.pts,this.currentFrame.dts=e.dts):(5===e.unit_type&&(this.currentFrame.keyframe=!0),this.currentFrame.byteLength+=e.rawData.byteLength,this.currentFrame.naluCount++,this.currentFrame.push(e)),this.currentFrame.duration=e.dts-this.currentFrame.dts}_newGop(){this.gop=[],this.gop.duration=0,this.gop.naluCount=0,this.gop.byteLength=0}_pushFrameIntoGop(){this.gop.push(this.currentFrame),this.gop.duration+=this.currentFrame.duration,this.gop.byteLength+=this.currentFrame.byteLength,this.gop.naluCount+=this.currentFrame.naluCount}_newGops(){this.gops=[],this.gops.type="video",this.gops.duration=0,this.gops.naluCount=0,this.gops.byteLength=0,this.gops.frameLength=0,this.gops.firstDTS=0}_pushGopIntoGroup(){let e=this.gop[0];this.gops.trackId=this.trackId,this.gops.duration+=this.gop.duration,this.gops.byteLength+=this.gop.byteLength,this.gops.naluCount+=this.gop.naluCount,this.gops.frameLength+=this.gop.length,this.gops.firstDTS=e.dts,this.gops.firstPTS=e.pts,this.gops.push(this.gop),this.emit("data",this.gops),this._newGop(),this._newGops(),this.emit("done")}}class oe extends R{constructor(e,t,n={}){super(),this.context=e,this.PSI=t,this.options=n,this.tracks=[],this.adtsStream=new q(t),this.avcStream=new ae(t),this.streams=[this.adtsStream,this.avcStream],n.decodeCodec&&(this.avcStream.on("data",e=>{let t=n.config.stubTime;if(b(t)){let n=(e.firstPTS+e.duration)/9e4;if(n{let t=n.config.stubTime;if(b(t)){let n=(e.firstPTS+e.duration)/9e4;if(n0&&this.emit("data",t),this.emit("done"),t.splice(0,t.length)}reset(){this.tracks=[];for(let e=0;e>6,n=e[8];this.PTS=0,2==(2&t)&&(this.PTS=this.calcTimestamp_(e,9)),this.DTS=this.PTS,1==(1&t)&&(this.DTS=this.calcTimestamp_(e,14)),this.data_byte=e.subarray(9+n)}calcTimestamp_(e,t){return 536870912*(14&e[t])+(e[t+1]<<22)+(e[t+2]>>1<<15)+(e[t+3]<<7)+(e[t+4]>>1)}}class ue extends R{constructor(e,t){super(),this.context=e,this.PSI=t,this.PID=null,this.cache_buffer=new P}push(e){const t=this;e.PID>31&&e.PID<8191&&(-1==this.PSI.currentProgramPID?t._pushPacket(e):this.PSI.currentProgramPID!==e.PID&&(1===e.payload_unit_start_indicator&&t._assembleOnePES(),t._pushPacket(e)))}flush(){this._assembleOnePES(),this.emit("done")}reset(){this._clearCached(),this.emit("reset")}_clearCached(){this.PID=null,this.cache_buffer.clear()}_pushPacket(e){let t=this.cache_buffer.empty;t&&0===e.payload_unit_start_indicator||(t&&(this.PID=e.PID),this.cache_buffer.append(e.payload))}_assembleOnePES(){const e=this;if(!this.cache_buffer.empty){let t;try{t=this.cache_buffer.toNewBytes()}catch(e){throw"pes alloc mem err "+this.cache_buffer.byteLength}let n=new se(t),r=this.PSI.findTrack(this.PID);if(r){let t={pid:r.id,stream_type:r.stream_type,pes:n};e.emit("data",t)}e._clearCached()}}}class le{constructor(e){if(this.sync_byte=e[0],this.payload_unit_start_indicator=e[1]>>6&1,this.PID=8191&(e[1]<<8|e[2]),this.afc=e[3]>>4&3,this.has_payload=1&this.afc,this.has_adaptation=2&this.afc,this.has_payload)if(this.has_adaptation){let t=e[4];this.payload=e.subarray(5+t)}else this.payload=e.subarray(4)}valid(){return 71===this.sync_byte&&1===this.has_payload}}class ce extends L{constructor(e={}){super(e),this.psi_=new M(this.ctx_),this.pesStream_=new ue(this.ctx_,this.psi_),this.elementaryStream_=new oe(this.ctx_,this.psi_,e),this.complexStream_=new U(this.ctx_,this.psi_),this.pipe(this.pesStream_),this.pesStream_.pipe(this.elementaryStream_),this.elementaryStream_.pipe(this.complexStream_),super.listenEndStream_()}get endStream(){let e=this.elementaryStream_;return this.options_.decodeCodec&&(e=this.complexStream_),e}push(e,t){const{done:n}=t,{options_:r,ctx_:i,cache_buffer_:a,psi_:o}=this;let s=super.constraintPushData_(e),u=a.byteLength,l=null;for(r.config=t,E.log(`hls demux received ${s.byteLength} bytes, cache ${u} bytes. ${n?"chunk done":""}`),a.append(s);a.byteLength>=188;){let e=a.cut(188);if(e){let t=new le(e);if(!t.valid()){let n=`Encounter invalid ts packet, packet_length(${e.length}), cache_length(${this.cache_buffer_.byteLength}), has_payload(${t.has_payload}), data(${e})`;E.error(n),this.reset(),i.emit("error",A.TS_SYNC_BYTE,n,{startByte:l,endByte:l+e.byteLength});break}o.parse(t),this.emit("data",t),l+=e.byteLength}}a.empty&&n&&this.emit("done")}reset(){this.cache_buffer_.clear(),this.emit("reset")}}let fe=function(e){let t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3]),t},he=function(e){return new Date(1e3*e-20828448e5)},de=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},pe={avc1:function(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:ye(e.subarray(78,e.byteLength))}},avcC:function(e){let t,n,r,i,a=new DataView(e.buffer,e.byteOffset,e.byteLength),o={configurationVersion:e[0],avcProfileIndication:e[1],profileCompatibility:e[2],avcLevelIndication:e[3],lengthSizeMinusOne:3&e[4],sps:[],pps:[]},s=31&e[5];for(r=6,i=0;i>>2&63,bufferSize:e[13]<<16|e[14]<<8|e[15],maxBitrate:e[16]<<24|e[17]<<16|e[18]<<8|e[19],avgBitrate:e[20]<<24|e[21]<<16|e[22]<<8|e[23],decoderConfigDescriptor:{tag:e[24],length:e[25],audioObjectType:e[35]>>>3&31,samplingFrequencyIndex:(7&e[35])<<8+(128&e[36])>>7,channelConfiguration:(120&e[36])>>3}}}},ftyp:function(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n={majorBrand:fe(e.subarray(0,4)),minorVersion:t.getUint32(4),compatibleBrands:[]},r=8;for(;r>10)),i.language+=String.fromCharCode(96+((960&t)>>5)),i.language+=String.fromCharCode(96+(31&t)),i},mdia:function(e){return{boxes:ye(e)}},mfhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),sequenceNumber:e[4]<<24|e[5]<<16|e[6]<<8|e[7]}},minf:function(e){return{boxes:ye(e)}},mp4a:function(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536,streamDescriptor:void 0};return e.byteLength>28&&(n.streamDescriptor=ye(e.subarray(28))[0]),n},moof:function(e){return{boxes:ye(e)}},moov:function(e){return{boxes:ye(e)}},mvex:function(e){return{boxes:ye(e)}},mvhd:function(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=4,r={version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),creationTime:new Date,modificationTime:new Date,timescale:0,duration:0,rate:0,volume:0,matrix:new Uint32Array(0),nextTrackId:0};return 1===r.version?(n+=4,r.creationTime=he(t.getUint32(n)),n+=8,r.modificationTime=he(t.getUint32(n)),n+=4,r.timescale=t.getUint32(n),n+=8,r.duration=t.getUint32(n)):(r.creationTime=he(t.getUint32(n)),n+=4,r.modificationTime=he(t.getUint32(n)),n+=4,r.timescale=t.getUint32(n),n+=4,r.duration=t.getUint32(n)),n+=4,r.rate=t.getUint16(n)+t.getUint16(n+2)/16,n+=4,r.volume=t.getUint8(n)+t.getUint8(n+1)/8,n+=2,n+=2,n+=8,r.matrix=new Uint32Array(e.subarray(n,n+36)),n+=36,n+=24,r.nextTrackId=t.getUint32(n),r},pdin:function(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(e.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(e){let t,n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]};for(t=4;t>4,isDependedOn:(12&e[t])>>2,hasRedundancy:3&e[t]});return n},sidx:function(e){let t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),references:[],referenceId:n.getUint32(4),timescale:n.getUint32(8),earliestPresentationTime:n.getUint32(12),firstOffset:n.getUint32(16)},i=n.getUint16(22);for(t=24;i;t+=12,i--)r.references.push({referenceType:(128&e[t])>>>7,referencedSize:2147483647&n.getUint32(t),subsegmentDuration:n.getUint32(t+4),startsWithSap:!!(128&e[t+8]),sapType:(112&e[t+8])>>>4,sapDeltaTime:268435455&n.getUint32(t+8)});return r},stbl:function(e){return{boxes:ye(e)}},stco:function(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=t.getUint32(4),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),entryCount:n,chunkOffsets:[]};for(let e=8;n;e+=4,n--)r.chunkOffsets.push(t.getUint32(e));return r},stsc:function(e){let t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=n.getUint32(4),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleToChunks:[]};for(t=8;r;t+=12,r--)i.sampleToChunks.push({firstChunk:n.getUint32(t),samplesPerChunk:n.getUint32(t+4),sampleDescriptionIndex:n.getUint32(t+8)});return i},stsd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4)),boxes:ye(e.subarray(8))}},stsz:function(e){let t,n=new DataView(e.buffer,e.byteOffset,e.byteLength),r={version:e[0],flags:new Uint8Array(e.subarray(1,4)),sampleSize:n.getUint32(4),entries:[]};for(t=12;t>6,sampleHasRedundancy:(48&e[21])>>4,samplePaddingValue:(14&e[21])>>1,sampleIsDifferenceSample:!!(1&e[21]),sampleDegradationPriority:t.getUint16(22)}},trun:function(e){let t,n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=1&n.flags[2],a=4&n.flags[2],o=1&n.flags[1],s=2&n.flags[1],u=4&n.flags[1],l=8&n.flags[1],c=r.getUint32(4),f=8;for(i&&(n.dataOffset=r.getUint32(f),f+=4),a&&c&&(t={flags:de(e.subarray(f,f+4))},f+=4,o&&(t.duration=r.getUint32(f),f+=4),s&&(t.size=r.getUint32(f),f+=4),l&&(t.compositionTimeOffset=r.getUint32(f),f+=4),n.samples.push(t),c--);c--;)t={},o&&(t.duration=r.getUint32(f),f+=4),s&&(t.size=r.getUint32(f),f+=4),u&&(t.flags=de(e.subarray(f,f+4)),f+=4),l&&(t.compositionTimeOffset=r.getUint32(f),f+=4),n.samples.push(t);return n},"url ":function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}},vmhd:function(e){return{version:e[0],flags:new Uint8Array(e.subarray(1,4))}}},ye=function(e){let t,n,r,i,a=0,o=[],s=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;a1?a+t:e.byteLength,i=(pe[n]||function(e){return{data:e}})(e.subarray(a+8,r)),i.size=t,i.type=n,o.push(i),a=r;return o};const ve={mp4toJSON:ye};class ge extends L{constructor(e={}){super(e),super.listenEndStream_()}get endStream(){return this}push(e){let t=super.constraintPushData_(e);E.log(`mp4 demux received ${t.byteLength} bytes`);let n=ve.mp4toJSON(t);this.emit("data",n)}}var me,be;!function(e){e[e.HEAD=0]="HEAD",e[e.BODY=1]="BODY"}(me||(me={})),function(e){e[e.SCRIPT_DATA=18]="SCRIPT_DATA",e[e.VIDEO=9]="VIDEO",e[e.AUDIO=8]="AUDIO"}(be||(be={}));var ke,Pe,xe,we;!function(e){e[e.AAC=10]="AAC"}(ke||(ke={})),function(e){e[e.MONO=0]="MONO",e[e.STEREO=1]="STEREO"}(Pe||(Pe={}));!function(e){e[e.SEQUENCE_HEAD=0]="SEQUENCE_HEAD",e[e.AAC_RAW=1]="AAC_RAW"}(xe||(xe={}));!function(e){e[e.SEQUENCE_HEAD=0]="SEQUENCE_HEAD",e[e.NALU=1]="NALU",e[e.SEQUENCE_END=2]="SEQUENCE_END"}(we||(we={}));const Be=new ie,Te=[];Be.on("nalu",e=>{Te.push(e)});var _e;!function(e){e[e.AVC=7]="AVC"}(_e||(_e={}))},,function(e,t,n){var r=n(49),i=n(90);function a(t,n,o){return i()?(e.exports=a=Reflect.construct.bind(),e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=a=function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&r(a,n.prototype),a},e.exports.__esModule=!0,e.exports.default=e.exports),a.apply(null,arguments)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){"use strict";n.d(t,"a",(function(){return h}));var r=n(3),i=n.n(r),a=n(4),o=n.n(a),s=n(0),u=n.n(s),l=n(9),c={eval:EvalError,range:RangeError,reference:ReferenceError,syntax:SyntaxError,type:TypeError,uri:URIError,default:Error},f=null,h=(f||(f=new(function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1001;return i()(this,e),u()(this,"type",""),u()(this,"errorName","DefaultError"),u()(this,"code",null),u()(this,"message",""),u()(this,"stack",""),this.type=t,this.code=n,this.throws.bind(this)}return o()(e,[{key:"throws",value:function(e){for(var t="",n=Error,r=arguments.length,i=new Array(r>1?r-1:0),a=1;a0}),!1)}e.exports=function(e,t){t=t||{};var i={main:n.m},s=t.all?{main:Object.keys(i.main)}:function(e,t){for(var n={main:[t]},r={main:[]},i={main:{}};o(n);)for(var s=Object.keys(n),u=0;u=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,i=x(t);try{for(i.s();!(e=i.n()).done;){var a=e.value;this.on(a,n,r)}}catch(e){i.e(e)}finally{i.f()}}},{key:"on",value:function(e,t,n){if(void 0===this.eventsQueue[e]&&(this.eventsQueue[e]={methods:[],once:!1}),"function"==typeof t){if(!this.disallowRepeat||!this.eventsQueue[e].methods.includes(t))return this.eventsQueue[e].methods.push(t),void 0!==n&&(this.eventsQueue[e].once=n),this.target}else B.error("on","the argument is not function.",t)}},{key:"once",value:function(e,t){this.on(e,t,!0)}},{key:"off",value:function(e,t){var n=this.eventsQueue[e];if(n){var r=n.methods;if(t)for(var i=r.length;i--;)r[i]===t&&r.splice(i,1);else delete this.eventsQueue[e];return this.target}}},{key:"emit",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i0&&void 0!==arguments[0]?arguments[0]:"div",t=arguments.length>1?arguments[1]:void 0;if("string"!=typeof e)return R.error("please input element name"),null;var n=document.createElement(e,t);return n}},{key:"registerElement",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:HTMLElement,n=arguments.length>2?arguments[2]:void 0,r=document.registerElement(e,{prototype:Object.create(t.prototype),extends:n});return r}},{key:"addEl",value:function(e,t){if(e&&t)try{t.appendChild(e)}catch(e){R.error(e)}}},{key:"removeEl",value:function(e){try{var t=e.parentNode;t&&t.removeChild(e)}catch(e){R.error(e)}}},{key:"addClass",value:function(e){try{for(var t,n=arguments.length,r=new Array(n>1?n-1:0),i=1;il?l:c,a.style.top=i.offsetTop+(i.offsetHeight-s*u)/2+"px",a.style.left=i.offsetLeft+(i.offsetWidth-o*u)/2+"px",a.style.transform="scale(".concat(u,", ").concat(u,")"),a.style["transform-origin"]="top left",a.style.display="inline-block"}}]),e}(),C=n(24),A=n.n(C),D=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i()(this,e),v()(this,"logger",null),v()(this,"__instance__",null),v()(this,"__singleton__",null),this.options=t,this.setLogger(this.constructor.name+".js")}return o()(e,[{key:"setLogger",value:function(e){this.logger=new P.a(e)}},{key:"getLogger",value:function(){return this.logger}},{key:"setOptions",value:function(e){Object.assign(this.options,e)}},{key:"events",get:function(){return this.options&&this.options.events?this.options.events(this):_(this)}},{key:"toString",value:function(){return JSON.stringify(this)}}],[{key:"getInstance",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:"";this.component.data.content=e,"default"!==this.component.data.display&&""!==this.component.data.display||this.component.showBox(),"show"!==this.component.data.display&&this.component.show()}},{key:"hide",value:function(){this.component.hide()}}]),n}(D),U=n(25),N=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i()(this,e),v()(this,"logger",null),this.options=t,this.debug=t.debug||!1,this.setLogger(this.constructor.name+".js")}return o()(e,[{key:"setLogger",value:function(e){this.logger=new P.a(e)}},{key:"getLogger",value:function(){return this.logger}},{key:"setOptions",value:function(e){Object.assign(this.options,e)}},{key:"events",get:function(){return this.options&&this.options.events?this.options.events(this):_(this)}},{key:"alert",get:function(){var e="";return this.options&&this.options.alertError&&(e=this.options.alertError),e}},{key:"toString",value:function(){return JSON.stringify(this)}}]),e}(),I=n(9);function H(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var F=function(e){c()(n,e);var t=H(n);function n(){var e;return i()(this,n),e=t.call(this),v()(u()(e),"dataManage",null),v()(u()(e),"sourceURL",""),e}return o()(n,[{key:"init",value:function(){}},{key:"setDataManage",value:function(e){this.dataManage=e}},{key:"setSourceURL",value:function(e){this.sourceURL=e}},{key:"getDataManage",value:function(){return this.getDataManage}},{key:"getSourceURL",value:function(){return this.getSourceURL}}]),n}(N),j={LOAD_PLAYLIST:10,get 10(){return"loading playlist"},LOADED_PLAYLIST:11,get 11(){return"playlist is loaded"},IDLE:0,get 0(){return"is free"},LOADING:1,get 1(){return"loading segment"},DONE:2,get 2(){return"segment is loaded"},ERROR:3,get 3(){return"load get error"}},V=P.a.get("M3U8Parser.js",{level:2}),W={lineDelimiter:/\r?\n/,extensionHeader:"#EXTM3U",tagPrefix:"#EXT",segmentPrefix:"#EXTINF",segmentParse:/^#EXTINF: *([0-9.]+)(, *(.+?)?)?$/,tagParse:/^#EXT-X-([A-Z-]+)(:(.+))?$/,version:"VERSION",allowCache:"ALLOW-CACHE",combined:"COMBINED",endList:"ENDLIST",targetDuration:"TARGETDURATION",mediaSequence:"MEDIA-SEQUENCE",discontinuity:"DISCONTINUITY",streamInf:"STREAM-INF",isComment:function(e){return e&&"#"===e[0]&&!e.startsWith(W.tagPrefix)},isBlank:function(e){return""===e},canStrip:function(e){return W.isBlank(e)||W.isComment(e)}},z=0,X=1,G={file:void 0,name:void 0,start:0,end:0,discontinuity:void 0,duration:void 0},Y=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i()(this,e),v()(this,"source",""),v()(this,"segments",[]),v()(this,"_currentSegment",null),v()(this,"discontinuous",null),v()(this,"tags",{VERSION:void 0,TARGETDURATION:void 0}),v()(this,"_state",null),this.source=t,this.options=n,this.parse(this.source)}return o()(e,[{key:"readSegment",value:function(e){var t=W.segmentParse.exec(e);if(null!==t){var n=parseFloat(t[1],10),r=t[3];n%1!=0&&this.tags.VERSION>=3&&V.info("readsegment","Version must be 3 or higher to support floating.","duration:",n),n=0){this._currentSegment.start=t,this._currentSegment.end=t+this._currentSegment.duration;var n=this.segments[this.segments.length-1]||{sd:0,start:0,end:0};n.duration=t-n.start,n.end=t}this._currentSegment.name||(this._currentSegment.name=e.substr(Math.max(0,e.lastIndexOf("/")),e.lastIndexOf("."))),this.segments.push(this._currentSegment),this._state=z}else{var r=this.readTag(e);switch(r.name){case"PROGRAM-DATE-TIME":var i=new Date(r.value);this._currentSegment.time=i;break;default:V.warn("addFile","Invalid tag.","tag.name:",r.name)}}}},{key:"parseSDParam",value:function(e){var t=-1;try{var n=new URL(e).searchParams.get("sd");n&&(t=parseInt(n,10))}catch(e){}return t}},{key:"parse",value:function(e){var t=this;if("string"==typeof(e=e||this.source)){this._state=z,this.discontinuous=!1;var n=e.split(W.lineDelimiter);if(n[0]==W.extensionHeader)return n.forEach((function(e){if(!W.canStrip(e))switch(t._state){case z:t.readLine(e);break;case X:t.addFile(e);break;default:Object(U.a)("parsing m3u8 get an error, it is unknow state.")}})),this;V.error("parse","it is not a valid m3u8 header","header:",n[0])}else Object(U.a)("m3u8 file is not text.",e)}},{key:"version",get:function(){return this.tags.VERSION}},{key:"duration",get:function(){return this.segments.length?this.segments.reduce((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0,n="number"==typeof e?e:e.duration;return n+t.duration})):0}},{key:"targetDuration",get:function(){return this.tags.TARGETDURATION}},{key:"mediaSequence",get:function(){return this.tags.MEDIA_SEQUENCE}},{key:"allowCache",get:function(){return this.tags.ALLOW_CACHE}},{key:"length",get:function(){return this.segments.length}}]),e}(),$=n(46),q=n.n($);function K(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Object";return function(t){var n="[object "+e+"]";return Object.prototype.toString.call(t)==n}}var Q=function(){function e(){i()(this,e)}return o()(e,null,[{key:"importScripts",value:function(e,t,n){var r="ready"+Date.now();e instanceof Array?q()(e,r):q()([e],r),q.a.ready(r,{success:t,error:n})}},{key:"blobData",value:function(e){var t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}},{key:"escapeHTML",value:function(t){if(e.isString(t))return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}},{key:"getInnerWidthHeight",value:function(){return{width:window.innerWidth,height:window.innerHeight}}},{key:"Fullscreen",value:function(){var e=document.documentElement;e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullScreen&&(e.webkitRequestFullScreen(),setTimeout((function(){console.error("fullscreen success"),document.dispatchEvent(new Event("fullscreenchange"))}),0))}},{key:"exitFullscreen",value:function(){var e=document;e.exitFullscreen?e.exitFullscreen():e.mozCancelFullScreen?e.mozCancelFullScreen():e.webkitExitFullscreen&&(e.webkitExitFullscreen(),setTimeout((function(){console.error("exitfullscreen success"),document.dispatchEvent(new Event("fullscreenchange"))}),0))}},{key:"buildFilePath",value:function(e,t){return e.map((function(e){return t+e}))}},{key:"insertSort",value:function(e,t,n){var r,i,a=e.length;if(0!==a)if(n){var o=n(t);r=o.key,i=o.value;for(var s=0;ss;)e[u]=e[u-1],u--;return void(e[s]=t)}e.push(t)}else{i=t;for(var l=0;ll;)e[c]=e[c-1],c--;return void(e[l]=i)}e.push(i)}else e.push(t)}},{key:"isSafari",value:function(){var e=navigator.userAgent;return/Safari/.test(e)&&!/Chrome/.test(e)}},{key:"msec2sec",value:function(e){var t=(e/1e3).toFixed(3);return parseFloat(t,10)}}]),e}();v()(Q,"isObject",(function(){return K("Object")})),v()(Q,"isString",(function(){return K("String")})),v()(Q,"isFunction",(function(){return K("Function")}));var Z=n(35),J=n.n(Z);function ee(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var te=function(e){c()(n,e);var t=ee(n);function n(){return i()(this,n),t.call(this)}return o()(n,[{key:"size",get:function(){return this.length}},{key:"add",value:function(e){this.push(Object.freeze(e))}},{key:"addAll",value:function(e){var t=this;e.forEach((function(e){t.add(e)}))}},{key:"get",value:function(e){return this[e]}},{key:"getLast",value:function(){return this[this.length-1]}},{key:"getBy",value:function(e){var t=this;if("function"==typeof e){var n=new this.constructor;return this.every((function(r,i){return!0===e.call(t,r,i,t)&&n.add(r),!0})),n}}},{key:"indexOfByTime",value:function(e,t){t||(t=function(t){return e>=t.start&&ee?n=i-1:r=i+1}return-1}},{key:"getByTime",value:function(e){var t=this.indexOfByTime(e);if(t>=0)return this[t]}},{key:"getByKey",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:"";return e="["+e+"]loader is not free. please wait.",this.state!==j.IDLE&&this.state!==j.DONE&&(this.logger.warn("isNotFree","check status for loader","notice:",e),!0)}},{key:"getBaseUrl",value:function(e){var t=this.options.sourceURL;if(!(e.indexOf("//")>-1)){var n=t.lastIndexOf("/");return t.substr(0,n+1)}return""}},{key:"checkLoadCondition",value:function(e){return!(e.no>this.segmentPool.length)&&(!(this.dataController.getHLSBufferPool().bufferDuration>this.maxBufferDuration)||(this.logger.info("checkLoadCondition","stop load next segment.","bufferDuration:",this.dataController.getHLSBufferPool().bufferDuration,"maxBufferDuration:",this.maxBufferDuration),!1))}},{key:"loadFile",value:function(e,t,n){var r=this;if(e instanceof ie)if(this.isNotFree()&&"seek"!==t&&"start"!==t)this.logger.warn("loadFile","is loading","segment:",e,"type:",t);else{if(!this.checkLoadCondition(e))return this.state=j.IDLE,void this.logger.warn("loadFile","checkLoadCondition failed","segment:",e,"type:",t);this.currentNo=e.no;var i=this.getBaseUrl(e.file)+e.file,a=1,o=function(e,t){return"function"==typeof r.options.processURL?r.options.processURL(e,t):e},s=function(){r.httpWorker.postMessage({type:"invoke",fileType:"ts",method:"get",name:e.no,url:o(i,e)})};this.state=j.LOADING,this.events.emit(se.LoaderLoading,e,t,n),this.httpWorker.onmessage=function(i){r.state=j.DONE;var o=i.data;if(r.logger.info("loadfile","httpWorker","onmessage get data"),o&&"error"!==o.type)"notice"===o.type?"speed"===o.noticeType&&r.events.emit(se.LoaderUpdateSpeed,o.data):"ts"===o.fileType&&o.name===e.no?(r.logger.info("loadFile","read success","data no:",o.name),r.state=j.IDLE,r.events.emit(se.LoaderLoaded,o,e,t,n)):r.logger.warn("loadFile","is not ts file or the segment'no is not equal.","fileType:",o.fileType,"data:",o);else if(r.state=j.ERROR,a<=r.maxRetryCount)r.logger.warn("loadFile","retry to load","count:",a,"segment:",e),s(),a+=1;else{r.events.emit(se.LoaderError,e,t,n);r.events.emit(se.PlayerAlert,"Load file error, please concat administrator.");var u=[r.state,"Load File error.","load count:",a,"segment:",e];r.events.emit(se.PlayerThrowError,u)}},s()}}},{key:"destroy",value:function(){this.httpWorker&&this.httpWorker.terminate()}}]),n}(F),ce=n(22);function fe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}function he(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function de(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"";return e="["+e+"]loader is not free. please wait.",this.state!==j.IDLE&&this.state!==j.DONE&&(this.logger.warn("isNotFree","check status for loader","notice:",e),!0)}},{key:"getBaseUrl",value:function(e){var t=this.options.sourceURL;if(!(e.indexOf("//")>-1)){var n=t.lastIndexOf("/");return t.substr(0,n+1)}return""}},{key:"checkLoadCondition",value:function(e){return!(e.no>this.segmentPool.length)&&(!(this.dataController.getMP4BufferPool().bufferDuration>this.maxBufferDuration)||(this.logger.info("checkLoadCondition","stop load next segment.","bufferDuration:",this.dataController.getMP4BufferPool().bufferDuration,"maxBufferDuration:",this.maxBufferDuration),!1))}},{key:"loadFragment",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{start:0,end:1048576},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"play",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=t;if(this.isNotFree()&&"seek"!==n&&"start"!==n)this.logger.warn("loadFile","is loading","segment:",i,"type:",n);else{if(!this.checkLoadCondition(i))return this.state=j.IDLE,void this.logger.warn("loadFile","checkLoadCondition failed","segment:",i,"type:",n);var a=1,o=function(t,n){return"function"==typeof e.options.processURL?e.options.processURL(t,n):t},s=function(){e.httpWorker.postMessage({type:"invoke",fileType:"mp4",method:"get",name:i.no,url:o(url,i)})};this.state=j.LOADING,this.events.emit(se.LoaderLoading,i,n,r),this.httpWorker.onmessage=function(t){e.state=j.DONE;var o=t.data;if(e.logger.info("loadfile","httpWorker","onmessage get data"),o&&"error"!==o.type)"notice"===o.type?"speed"===o.noticeType&&e.events.emit(se.LoaderUpdateSpeed,o.data):"mp4"===o.fileType&&o.name===i.no?(e.logger.info("loadFile","read success","data no:",o.name),e.state=j.IDLE,e.events.emit(se.LoaderLoaded,o,i,n,r)):e.logger.warn("loadFile","is not mp4 file or the segment'no is not equal.","fileType:",o.fileType,"data:",o);else if(e.state=j.ERROR,a<=e.maxRetryCount)e.logger.warn("loadFile","retry to load","count:",a,"segment:",i),s(),a+=1;else{e.events.emit(se.LoaderError,i,n,r);e.events.emit(se.PlayerAlert,"Load file error, please concat administrator.");var u=[e.state,"Load File error.","load count:",a,"segment:",i];e.events.emit(se.PlayerThrowError,u)}},s()}}},{key:"destroy",value:function(){this.httpWorker&&this.httpWorker.terminate()}}]),n}(F)},ve=function(e){c()(n,e);var t=pe(n);function n(e,r){var a;return i()(this,n),a=t.call(this),v()(u()(a),"state",null),v()(u()(a),"exeLoader",null),v()(u()(a),"dataManage",null),v()(u()(a),"type","HLS"),v()(u()(a),"options",null),v()(u()(a),"dataController",null),a.type=e||a.type,a.player=r.player,a.options=r.player.options,a.dataController=a.player.dataController,a.init(a.type,a.options),a}return o()(n,[{key:"init",value:function(e,t){this.bindEvent(),this.setExeLoader(new ye[e](de(de({},t),{},{player:this.player,loaderController:this}))),this.setSourceURL(t.sourceURL),this.player.dataManage?this.setDataManage(this.player.dataManage):this.setDataManage(this.dataController.getDataManage(e,t)),this.exeLoader.setDataManage(this.dataManage)}},{key:"run",value:function(){switch(this.state=j.LOAD_PLAYLIST,this.events.emit(se.LoaderPlayListStart,this),this.logger.info("run",j[this.state],"url:",this.options.sourceURL),this.type.toUpperCase()){case"HLS":this.loadHLS();break;case"MP4":this.loadMP4();break;default:this.logger.erro("run","this ".concat(this.type," is not valid."),this.type)}}},{key:"bindEvent",value:function(){var e=this;this.events.on(se.LoaderLoadFile,(function(t,n,r){e.exeLoader.loadFile(t,n,r)}))}},{key:"loadMP4",value:function(e){var t=this;this.exeLoader.preload((function(n){n?("function"==typeof e&&(console.info("mp4Preload data:",n),e.call(t,n)),t.state=j.PRELOADED_MP4,t.events.emit(se.LoaderMP4Loaded,t),"function"==typeof e&&e.call(t,n)):t.logger.error("run","start preload mp4","data:",n)}))}},{key:"loadHLS",value:function(e){var t=this;this.exeLoader.loadPlaylist((function(n){n?(t.dataController.setHLSSourceData(t.exeLoader.getSourceData()),t.dataController.setHLSSegmentPool(t.exeLoader.getSegmentPool()),t.state=j.LOADED_PLAYLIST,t.events.emit(se.LoaderPlayListLoaded,t),"function"==typeof e&&e.call(t,n)):t.logger.error("run","start load m3u8","data:",n)}))}},{key:"switchPlaylist",value:function(e,t){this.setSourceURL(e),this.dataController.clearDataManage(),this.state=j.LOAD_PLAYLIST,this.events.emit(se.LoaderPlayListStart,this),this.logger.info("switchPlaylist",j[this.state],"url:",e),this.loadHLS(t)}},{key:"setExeLoader",value:function(e){this.exeLoader=e}},{key:"getExeLoader",value:function(){return this.exeLoader}},{key:"setSourceURL",value:function(e){this.exeLoader.setSourceURL(e)}},{key:"getSourceURL",value:function(){return this.exeLoader.getSourceURL()}},{key:"setDataManage",value:function(e){this.dataManage=e}},{key:"getDataManage",value:function(){return this.dataManage}},{key:"getSourceData",value:function(){return this.exeLoader.getSourceData()}},{key:"destroy",value:function(){this.exeLoader.destroy()}}]),n}(D);function ge(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var me=function(e){c()(n,e);var t=ge(n);function n(e){var r;return i()(this,n),r=t.call(this,e),v()(u()(r),"no",0),v()(u()(r),"start",0),v()(u()(r),"end",0),v()(u()(r),"blob",null),v()(u()(r),"arrayBuffer",null),v()(u()(r),"duration",0),Object.assign(u()(r),e),r}return o()(n,[{key:"size",get:function(){return this.blob.size}}]),n}(ne);function be(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var ke=function(e){c()(n,e);var t=be(n);function n(e){return i()(this,n),t.call(this,e)}return o()(n,[{key:"add",value:function(e){e instanceof me||(e=new me(e));var t=this.length;if(0!==t){for(;t--;)if(e.no<=this[t].no)return void this.splice(t,1,e);return this.push(e),this}this.push(e)}},{key:"getBufferSize",value:function(){return this.length<=0?0:this.reduce((function(e,t){return isNaN(e)&&(e=e.blob.size),e+t.blob.size}))}},{key:"bufferSize",get:function(){return this.getBufferSize()}},{key:"getBufferDuration",value:function(){return this.length<=0?0:this.reduce((function(e,t){return isNaN(e)&&(e=e.end-e.start),e+(t.end-t.start)}))}},{key:"bufferDuration",get:function(){return this.getBufferDuration()}}]),n}(te);function Pe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var xe=function(e){c()(n,e);var t=Pe(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this),v()(u()(e),"bufferPool",[]),v()(u()(e),"sourceData",{}),v()(u()(e),"options",{}),v()(u()(e),"segmentPool",[]),v()(u()(e),"readBufferNo",null),v()(u()(e),"startLoadTime",null),v()(u()(e),"currentSeekTime",null),e.options=r,e.init(),e}return o()(n,[{key:"init",value:function(){var e=this;this.setBufferPool(new ke),this.events.on(se.DataManageReadBufferByNo,(function(t,n){e.readBufferByNo(t,n)})),this.events.on(se.DataManageReadBuffer,(function(t,n){e.readBuffer(t,n)})),this.events.on(se.LoaderLoaded,(function(t,n,r,i){var a=e.createBuffer({arrayBuffer:t.arrayBuffer},n);if(e.segmentLoaded(n,a),"seek"===r&&i===e.currentSeekTime)return e.events.emit(se.DataManageSeek,a,i),void e.removeBufferByNo(a.no);i===e.startLoadTime&&e.events.emit(se.DataManageFirstLoaded,a,i)}))}},{key:"setOptions",value:function(e){Object.assign(this.options,e)}},{key:"startLoad",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.logger.info("startLoad","begin to load ts data","time:",e),isNaN(e)?this.logger.error("seekTime","seek","time:",e):(this.startLoadTime=e,this.loadSegmentByTime(e,"start"))}},{key:"readBuffer",value:function(e,t){var n=this.getSegmentByTime(e);n&&this.readBufferByNo(n.no,t)}},{key:"segmentLoaded",value:function(e,t){t&&this.addBufferPool(t),e.no===this.options.player.currentIndex&&this.readBufferByNo(e.no),e.no-1?(t=this.bufferPool[n],this.events.emit(se.DataManageSeek,t,e)):(this.removeBufferPool(this.bufferPool.length),this.loadSegmentByTime(e,"seek"))}}},{key:"loadSegmentByTime",value:function(e,t){if(!isNaN(e)){var n=this.segmentPool.indexOfByTime(e);if(n>=0){var r=this.segmentPool[n];this.events.emit(se.LoaderLoadFile,r,t,e)}else this.logger.error("loadSegmentByTime","time over","time:",e,"type:",t)}}},{key:"createBuffer",value:function(e,t){if(e){var n={start:t.start,end:t.end,no:t.no,duration:t.end-t.start,arrayBuffer:e.arrayBuffer};return new me(n)}}},{key:"isValidSegmentNo",value:function(e){return!isNaN(e)&&e>0&&e<=this.segmentPool.length}},{key:"loadSegmentByNo",value:function(e){var t=e-1,n=this.segmentPool.get(t);n&&this.events.emit(se.LoaderLoadFile,n,"play")}},{key:"readBufferByNo",value:function(e,t){this.isValidSegmentNo(e)?(this.readBufferNo=e,t=t||function(e){this.events.emit(se.DataManageRead,e)},this.getBlobByNo(e,t)):this.logger.error("readBufferByNo","check buffer no","is not valid no",e)}},{key:"getSegmentByTime",value:function(e){var t=this.segmentPool.indexOfByTime(e);return this.segmentPool[t]}},{key:"getBlobByNo",value:function(e,t){if(isNaN(e))this.logger.error("getBlobByNo","isNaN","no:",e);else{var n;if(!this.isBufferReading)return this.isBufferReading=!0,n=this.bufferPool.getByKeyValue("no",e)[0],"function"==typeof t&&(t.call(this,n),n&&this.removeBufferByNo(n.no)),this.isBufferReading=!1,n;this.logger.warn("getBlobByNo","isBufferReading","no:",e)}}},{key:"addBufferPool",value:function(e){if(this.bufferPool.length){if(this.bufferPool[0].no===e.no+1)return this.bufferPool.unshift(e),!0;var t=this.bufferPool.getLast();if(e.no-t.no==1)return this.bufferPool.push(e),!0;if(this.bufferPool.indexOfByKey("no",e.no))return!0;this.bufferPool.splice(0,this.bufferPool.length)}this.bufferPool.push(e)}},{key:"removeBufferPool",value:function(e){this.bufferPool.splice(0,e+1)}},{key:"removeBufferByNo",value:function(e){var t=this.bufferPool.indexOfByKey("no",e);if(!(t<=-1))return this.removeBufferPool(t),this.bufferPool.length?this.bufferPool.getLast().no0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this),v()(u()(e),"bufferPool",[]),v()(u()(e),"sourceData",{}),v()(u()(e),"options",{}),v()(u()(e),"segmentPool",[]),v()(u()(e),"readBufferNo",null),v()(u()(e),"startLoadTime",null),v()(u()(e),"currentSeekTime",null),e.options=r,e.init(),e}return o()(n,[{key:"init",value:function(){var e=this;this.setBufferPool(new ke),this.events.on(se.DataManageReadBufferByNo,(function(t,n){e.readBufferByNo(t,n)})),this.events.on(se.DataManageReadBuffer,(function(t,n){e.readBuffer(t,n)})),this.events.on(se.LoaderLoaded,(function(t,n,r,i){var a=e.createBuffer({arrayBuffer:t.arrayBuffer},n);if(e.segmentLoaded(n,a),"seek"===r&&i===e.currentSeekTime)return e.events.emit(se.DataManageSeek,a,i),void e.removeBufferByNo(a.no);i===e.startLoadTime&&e.events.emit(se.DataManageFirstLoaded,a,i)}))}},{key:"setOptions",value:function(e){Object.assign(this.options,e)}},{key:"startLoad",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.logger.info("startLoad","begin to load ts data","time:",e),isNaN(e)?this.logger.error("seekTime","seek","time:",e):(this.startLoadTime=e,this.loadSegmentByTime(e,"start"))}},{key:"readBuffer",value:function(e,t){var n=this.getSegmentByTime(e);n&&this.readBufferByNo(n.no,t)}},{key:"segmentLoaded",value:function(e,t){t&&this.addBufferPool(t),e.no===this.options.player.currentIndex&&this.readBufferByNo(e.no),e.no-1?(t=this.bufferPool[n],this.events.emit(se.DataManageSeek,t,e)):(this.removeBufferPool(this.bufferPool.length),this.loadSegmentByTime(e,"seek"))}}},{key:"loadSegmentByTime",value:function(e,t){if(!isNaN(e)){var n=this.segmentPool.indexOfByTime(e);if(n>=0){var r=this.segmentPool[n];this.events.emit(se.LoaderLoadFile,r,t,e)}else this.logger.error("loadSegmentByTime","time over","time:",e,"type:",t)}}},{key:"createBuffer",value:function(e,t){if(e){var n={start:t.start,end:t.end,no:t.no,duration:t.end-t.start,arrayBuffer:e.arrayBuffer};return new me(n)}}},{key:"isValidSegmentNo",value:function(e){return!isNaN(e)&&e>0&&e<=this.segmentPool.length}},{key:"loadSegmentByNo",value:function(e){var t=e-1,n=this.segmentPool.get(t);n&&this.events.emit(se.LoaderLoadFile,n,"play")}},{key:"readBufferByNo",value:function(e,t){this.isValidSegmentNo(e)?(this.readBufferNo=e,t=t||function(e){this.events.emit(se.DataManageRead,e)},this.getBlobByNo(e,t)):this.logger.error("readBufferByNo","check buffer no","is not valid no",e)}},{key:"getSegmentByTime",value:function(e){var t=this.segmentPool.indexOfByTime(e);return this.segmentPool[t]}},{key:"getBlobByNo",value:function(e,t){if(isNaN(e))this.logger.error("getBlobByNo","isNaN","no:",e);else{var n;if(!this.isBufferReading)return this.isBufferReading=!0,n=this.bufferPool.getByKeyValue("no",e)[0],"function"==typeof t&&(t.call(this,n),n&&this.removeBufferByNo(n.no)),this.isBufferReading=!1,n;this.logger.warn("getBlobByNo","isBufferReading","no:",e)}}},{key:"addBufferPool",value:function(e){if(this.bufferPool.length){if(this.bufferPool[0].no===e.no+1)return this.bufferPool.unshift(e),!0;var t=this.bufferPool.getLast();if(e.no-t.no==1)return this.bufferPool.push(e),!0;if(this.bufferPool.indexOfByKey("no",e.no))return!0;this.bufferPool.splice(0,this.bufferPool.length)}this.bufferPool.push(e)}},{key:"removeBufferPool",value:function(e){this.bufferPool.splice(0,e+1)}},{key:"removeBufferByNo",value:function(e){var t=this.bufferPool.indexOfByKey("no",e);if(!(t<=-1))return this.removeBufferPool(t),this.bufferPool.length?this.bufferPool.getLast().no=i&&e<=a?(this.events.once(se.AudioPlayerPlaySuccess,(function(){r.render(a)})),n.playbackRate=u,void n.play()):void(e>=a&&(!n.need||e<=i)?r.render(e):e>s&&(this.audioPlayer.playbackRate=u,this.audioPlayer.play(),r.render(e)));this.sync(o)}else n.paused||n.pause()}},{key:"setCurrentTime",value:function(e){this.player.currentTime=e,this.events.emit(se.PlayerTimeUpdate,e)}},{key:"pause",value:function(){this.audioPlayer.pause(),this.clearDrawHanlder()}},{key:"seek",value:function(e){var t=this,n=this.imagePlayer.isBuffered(e),r=this.audioPlayer.isBuffered(e);this.player.pause(),n&&r?(this.logger.warn("seek","seek in buffer, time: ".concat(e,", buffer: ").concat(this.player.buffer()[0],", ").concat(this.player.buffer()[1])),this.audioPlayer.onSeekedHandler=function(){t.player.play()},this.audioPlayer.currentTime=e):this.reset()}},{key:"reset",value:function(e){this.logger.info("reset","reset start"),this.player.reseting=!0,this.events.emit(se.PlayerReset,e),this.resetStatus={processor:!1,audioPlayer:!1},this.player.processController.reset(),this.player.streamController.reset(),this.player.audioPlayer.reset(e),this.player.imagePlayer.reset(),this.player.currentIndex=null}},{key:"checkResetReady",value:function(e){var t=this.resetStatus;if(e&&"string"==typeof e){t[e]=!0;for(var n=Object.keys(t),r=0;r0&&l>u?u=(c=o+Math.ceil(l/u+i)*u)-a:(c=o+u*i,u-=l),this.drawNext(c,u)):this.drawNext(e+t,Math.ceil(t/i))}},{key:"drawNext",value:function(e,t){var n=this;this.drawFrameHanlder&&this.clearDrawHanlder(),this.drawFrameHanlder=setTimeout((function(){n.sync(e)}),t)}}]),n}(N);function Ce(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Ae(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ae(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function Ae(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?t-1:0),r=1;r1?t-1:0),r=1;r>5,this.ntype=31&this.payload[0]}return o()(e,[{key:"toString",value:function(){return"".concat(e.type(this),": NRI: ").concat(this.getNri())}},{key:"getNri",value:function(){return this.nri>>6}},{key:"type",value:function(){return this.ntype}},{key:"isKeyframe",value:function(){return this.ntype==e.IDR}},{key:"getSize",value:function(){return 4+this.payload.byteLength}},{key:"getData",value:function(){var e=new Uint8Array(this.getSize());return new DataView(e.buffer).setUint32(0,this.getSize()-4),e.set(this.payload,4),e}}],[{key:"NDR",get:function(){return 1}},{key:"IDR",get:function(){return 5}},{key:"SEI",get:function(){return 6}},{key:"SPS",get:function(){return 7}},{key:"PPS",get:function(){return 8}},{key:"AUD",get:function(){return 9}},{key:"TYPES",get:function(){var t;return t={},v()(t,e.IDR,"IDR"),v()(t,e.SEI,"SEI"),v()(t,e.SPS,"SPS"),v()(t,e.PPS,"PPS"),v()(t,e.NDR,"NDR"),v()(t,e.AUD,"AUD"),t}},{key:"type",value:function(t){return t.ntype in e.TYPES?e.TYPES[t.ntype]:"UNKNOWN"}}]),e}(),Ne=function(){function e(t){i()(this,e),this.data=t,this.index=0,this.bitLength=8*t.byteLength}return o()(e,[{key:"bitsAvailable",get:function(){return this.bitLength-this.index}},{key:"skipBits",value:function(e){if(this.bitsAvailable1&&void 0!==arguments[1])||arguments[1],n=this.getBits(e,this.index,t);return n}},{key:"getBits",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.bitsAvailable>>r,a=8-r;if(a>=e)return n&&(this.index+=e),i>>a-e;n&&(this.index+=a);var o=e-a;return i<>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.readBits(8*e)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}}]),e}(),Ie=function(){function e(t){i()(this,e),this.remuxer=t,this.track=t.mp4track}return o()(e,[{key:"parseSPS",value:function(t){var n=e.readSPS(new Uint8Array(t));this.track.width=n.width,this.track.height=n.height,this.track.sps=[new Uint8Array(t)],this.track.codec="avc1.";for(var r=new DataView(t.buffer,t.byteOffset+1,4),i=0;i<3;++i){var a=r.getUint8(i).toString(16);a.length<2&&(a="0"+a),this.track.codec+=a}}},{key:"parsePPS",value:function(e){this.track.pps=[new Uint8Array(e)]}},{key:"parseNAL",value:function(e){if(!e)return!1;var t=!1;switch(e.type()){case Ue.NDR:case Ue.IDR:t=!0;break;case Ue.PPS:this.track.pps||(this.parsePPS(e.getData().subarray(4)),!this.remuxer.readyToDecode&&this.track.pps&&this.track.sps&&(this.remuxer.readyToDecode=!0)),t=!0;break;case Ue.SPS:this.track.sps||(this.parseSPS(e.getData().subarray(4)),!this.remuxer.readyToDecode&&this.track.pps&&this.track.sps&&(this.remuxer.readyToDecode=!0)),t=!0;break;case Ue.AUD:Oe("AUD - ignoing and disable HD mode for live channel"),this.remuxer.isHDAvail&&(this.remuxer.isHDAvail=!1);break;case Ue.SEI:Oe("SEI - ignoing")}return t}}],[{key:"extractNALu",value:function(e){for(var t,n,r=0,i=e.byteLength,a=0,o=[];r-1&&this.listener[e].splice(n,1),!0}return!1}},{key:"offAll",value:function(){this.listener={}}},{key:"dispatch",value:function(e,t){return!!this.listener[e]&&(this.listener[e].map((function(e){e.apply(null,[t])})),!0)}}]),e}(),Fe=Math.pow(2,32)-1,je=function(){function e(){i()(this,e)}return o()(e,null,[{key:"init",value:function(){var t;for(t in e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var n=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:n,audio:r};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=a,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var o=new Uint8Array([105,115,111,109]),s=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,o,u,o,s),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,i))}},{key:"box",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r>24&255,i[1]=a>>16&255,i[2]=a>>8&255,i[3]=255&a,i.set(e,4),o=0,a=8;o>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,n,r){return e.box(e.types.moof,e.mfhd(t),e.traf(r,n))}},{key:"moov",value:function(t,n,r){for(var i=t.length,a=[];i--;)a[i]=e.trak(t[i]);return e.box.apply(null,[e.types.moov,e.mvhd(r,n)].concat(a).concat(e.mvex(t)))}},{key:"mvex",value:function(t){for(var n=t.length,r=[];n--;)r[n]=e.trex(t[n]);return e.box.apply(null,[e.types.mvex].concat(r))}},{key:"mvhd",value:function(t,n){n*=t;var r=Math.floor(n/(Fe+1)),i=Math.floor(n%(Fe+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,i>>24,i>>16&255,i>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,a)}},{key:"sdtp",value:function(t){var n,r,i=t.samples||[],a=new Uint8Array(4+i.length);for(r=0;r>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(r));for(n=0;n>>8&255),o.push(255&i),o=o.concat(Array.prototype.slice.call(r));var s=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(o))),u=t.width,l=t.height;return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,255&u,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,98,105,110,101,108,112,114,111,46,114,117,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(e){var t=e.config.byteLength,n=new Uint8Array(26+t+3);return n.set([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5,t]),n.set(e.config,26),n.set([6,1,2],26+t),n}},{key:"mp4a",value:function(t){var n=t.audiosamplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var n=t.id,r=t.duration*t.timescale,i=t.width,a=t.height,o=Math.floor(r/(Fe+1)),s=Math.floor(r%(Fe+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,s>>24,s>>16&255,s>>8&255,255&s,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,a>>8&255,255&a,0,0]))}},{key:"traf",value:function(t,n){var r=e.sdtp(t),i=t.id,a=Math.floor(n/(Fe+1)),o=Math.floor(n%(Fe+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,o>>24,o>>16&255,o>>8&255,255&o])),e.trun(t,r.length+16+20+8+16+8+8),r)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(t){var n=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(t,n){var r,i,a,o,s,u,l=t.samples||[],c=l.length,f=12+16*c,h=new Uint8Array(f);for(n+=8+f,h.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0),r=0;r>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*r);return e.box(e.types.trun,h)}},{key:"initSegment",value:function(t,n,r){e.types||e.init();var i,a=e.moov(t,n,r);return(i=new Uint8Array(e.FTYP.byteLength+a.byteLength)).set(e.FTYP),i.set(a,e.FTYP.byteLength),i}}]),e}(),Ve=function(){function e(t){i()(this,e),this.remuxer=t,this.track=t.mp4track,this.aacHeader=null}return o()(e,[{key:"samplingRateMap",get:function(){return[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350]}},{key:"getAACHeaderData",get:function(){return this.aacHeader}},{key:"setAACHeaderData",set:function(e){void 0===e&&(e=null),this.aacHeader=e}},{key:"getHeaderLength",value:function(e){return 1&e[1]?7:9}},{key:"getFrameLength",value:function(e){return(3&e[3])<<11|e[4]<<3|(224&e[5])>>>5}},{key:"isAACPattern",value:function(e){return 255===e[0]&&240==(240&e[1])&&0==(6&e[1])}},{key:"extractAAC",value:function(e){var t,n,r=0,i=e.byteLength,a=[];if(!this.isAACPattern(e))return Me("Invalid ADTS audio format"),a;for(t=this.getHeaderLength(e),this.aacHeader||(this.aacHeader=e.subarray(0,t));r>>6),t=(60&i[2])>>>2,n=(1&i[2])<<2,n|=(192&i[3])>>>6,r[0]=e<<3,r[0]|=(14&t)>>1,r[1]|=(1&t)<<7,r[1]|=n<<3,this.track.codec="mp4a.40."+e,this.track.channelCount=n,this.track.config=r,this.remuxer.readyToDecode=!0)}}]),e}(),We=1,ze=function(){function e(){i()(this,e),this.seq=1}return o()(e,[{key:"flush",value:function(){this.seq++,this.mp4track.len=0,this.mp4track.samples=[]}},{key:"isReady",value:function(){return!(!this.readyToDecode||!this.samples.length)||null}}],[{key:"getTrackID",value:function(){return We++}}]),e}(),Xe=function(e){c()(n,e);var t=De(n);function n(){var e;return i()(this,n),(e=t.call(this)).readyToDecode=!1,e.nextDts=0,e.dts=0,e.timescale=1e3,e.mp4track={id:ze.getTrackID(),type:"audio",channelCount:0,len:0,fragmented:!0,timescale:e.timescale,duration:e.timescale,samples:[],config:"",codec:""},e.samples=[],e.aac=new Ve(u()(e)),e}return o()(n,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.codec="",this.mp4track.channelCount="",this.mp4track.config="",this.mp4track.timescale=this.timescale}},{key:"remux",value:function(e){var t,n,r,i=Ce(e);try{for(i.s();!(r=i.n()).done;){var a=r.value;t=(n=a.units).byteLength,this.samples.push({units:n,size:t,duration:a.duration}),this.mp4track.len+=t,this.readyToDecode||this.aac.setAACConfig()}}catch(e){i.e(e)}finally{i.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var e,t,n=new Uint8Array(this.mp4track.len),r=0,i=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var a=this.samples.shift();(t=a.duration)<=0?(Oe("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(t)),this.mp4track.len-=a.size):(this.nextDts+=t,e={size:a.size,duration:t,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},n.set(a.units,r),r+=a.size,i.push(e))}return i.length?new Uint8Array(n.buffer,0,this.mp4track.len):null}}]),n}(ze),Ge=function(e){c()(n,e);var t=De(n);function n(){var e;return i()(this,n),(e=t.call(this)).readyToDecode=!1,e.nextDts=0,e.dts=0,e.timescale=1e3,e.mp4track={id:ze.getTrackID(),type:"video",len:0,fragmented:!0,sps:"",pps:"",width:0,height:0,timescale:e.timescale,duration:e.timescale,samples:[]},e.samples=[],e.h264=new Ie(u()(e)),e}return o()(n,[{key:"resetTrack",value:function(){this.readyToDecode=!1,this.mp4track.sps="",this.mp4track.pps=""}},{key:"remux",value:function(e){var t,n,r,i,a,o,s=Ce(e);try{for(s.s();!(o=s.n()).done;){t=o.value,n=[],i=0,a=!1;var u,l=Ce(t.units);try{for(l.s();!(u=l.n()).done;)r=u.value,this.h264.parseNAL(r)&&(n.push(r),i+=r.getSize(),a||(a=r.isKeyframe()))}catch(e){l.e(e)}finally{l.f()}n.length>0&&this.readyToDecode&&(this.mp4track.len+=i,this.samples.push({units:n,size:i,keyFrame:a,duration:t.duration}))}}catch(e){s.e(e)}finally{s.f()}}},{key:"getPayload",value:function(){if(!this.isReady())return null;var e,t,n=new Uint8Array(this.mp4track.len),r=0,i=this.mp4track.samples;for(this.dts=this.nextDts;this.samples.length;){var a=this.samples.shift(),o=a.units;if((t=a.duration)<=0)Oe("remuxer: invalid sample duration at DTS: ".concat(this.nextDts," :").concat(t)),this.mp4track.len-=a.size;else{this.nextDts+=t,e={size:a.size,duration:t,cts:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,isNonSync:a.keyFrame?0:1,dependsOn:a.keyFrame?2:1}};var s,u=Ce(o);try{for(u.s();!(s=u.n()).done;){var l=s.value;n.set(l.getData(),r),r+=l.getSize()}}catch(e){u.e(e)}finally{u.f()}i.push(e)}}return i.length?new Uint8Array(n.buffer,0,this.mp4track.len):null}}]),n}(ze);function Ye(e,t){var n=new Uint8Array((0|e.byteLength)+(0|t.byteLength));return n.set(e,0),n.set(t,0|e.byteLength),n}var $e=function(e){c()(n,e);var t=De(n);function n(e){var r;return i()(this,n),(r=t.call(this,"remuxer")).initialized=!1,r.trackTypes=[],r.tracks={},r.mediaDuration=e?1/0:1e3,r}return o()(n,[{key:"addTrack",value:function(e){"video"!==e&&"both"!==e||(this.tracks.video=new Ge,this.trackTypes.push("video")),"audio"!==e&&"both"!==e||(this.tracks.audio=new Xe,this.trackTypes.push("audio"))}},{key:"reset",value:function(){var e,t=Ce(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var n=e.value;this.tracks[n].resetTrack()}}catch(e){t.e(e)}finally{t.f()}this.initialized=!1}},{key:"destroy",value:function(){this.tracks={},this.offAll()}},{key:"flush",value:function(){if(this.initialized){var e,t=Ce(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var n=e.value,r=this.tracks[n],i=r.getPayload();if(i&&i.byteLength){var a={type:n,payload:Ye(je.moof(r.seq,r.dts,r.mp4track),je.mdat(i)),dts:r.dts};this.dispatch("buffer",a);var o=(h=r.dts/1e3,d=void 0,p=void 0,y=void 0,v=void 0,v="",d=Math.floor(h),(p=parseInt(d/3600,10)%24)>0&&(v+=(p<10?"0"+p:p)+":"),v+=((y=parseInt(d/60,10)%60)<10?"0"+y:y)+":"+((d=d<0?0:d%60)<10?"0"+d:d));Oe("put segment (".concat(n,"): ").concat(r.seq," dts: ").concat(r.dts," samples: ").concat(r.mp4track.samples.length," second: ").concat(o)),r.flush()}}}catch(e){t.e(e)}finally{t.f()}}else if(this.isReady()){this.dispatch("ready");var s,u=Ce(this.trackTypes);try{for(u.s();!(s=u.n()).done;){var l=s.value,c=this.tracks[l],f={type:l,payload:je.initSegment([c.mp4track],this.mediaDuration,c.mp4track.timescale)};this.dispatch("buffer",f)}}catch(e){u.e(e)}finally{u.f()}Oe("Initial segment generated."),this.initialized=!0}var h,d,p,y,v}},{key:"isReady",value:function(){var e,t=Ce(this.trackTypes);try{for(t.s();!(e=t.n()).done;){var n=e.value;if(!this.tracks[n].readyToDecode||!this.tracks[n].samples.length)return!1}}catch(e){t.e(e)}finally{t.f()}return!0}},{key:"remux",value:function(e){var t,n=Ce(this.trackTypes);try{for(n.s();!(t=n.n()).done;){var r=t.value,i=e[r];"audio"===r&&this.tracks.video&&!this.tracks.video.readyToDecode||i.length>0&&this.tracks[r].remux(i)}}catch(e){n.e(e)}finally{n.f()}this.flush()}}]),n}(He),qe=function(e){c()(n,e);var t=De(n);function n(e,r){var a;return i()(this,n),(a=t.call(this,"buffer")).type=r,a.queue=new Uint8Array,a.cleaning=!1,a.pendingCleaning=0,a.cleanOffset=30,a.cleanRanges=[],a.sourceBuffer=e,a.sourceBuffer.addEventListener("updateend",(function(){a.dispatch("updateend",Date.now()),a.pendingCleaning>0&&(a.initCleanup(a.pendingCleaning),a.pendingCleaning=0),a.cleaning=!1,a.cleanRanges.length&&a.doCleanup()})),a.sourceBuffer.addEventListener("error",(function(e){a.dispatch("error",{type:a.type,name:"buffer",error:e})})),a}return o()(n,[{key:"destroy",value:function(){this.queue=null,this.sourceBuffer=null,this.offAll()}},{key:"doCleanup",value:function(){if(this.cleanRanges.length){var e=this.cleanRanges.shift();Oe("".concat(this.type," remove range [").concat(e[0]," - ").concat(e[1],")")),this.cleaning=!0,this.sourceBuffer.remove(e[0],e[1]),this.dispatch("clearBuffer")}else this.cleaning=!1}},{key:"initCleanup",value:function(e){if(this.sourceBuffer.updating)this.pendingCleaning=e;else if(this.sourceBuffer.buffered&&this.sourceBuffer.buffered.length&&!this.cleaning){for(var t=0;tthis.cleanOffset&&n<(r=e-this.cleanOffset)&&this.cleanRanges.push([n,r])}this.doCleanup()}}},{key:"doAppend",value:function(){if(this.queue.length&&!this.sourceBuffer.updating)try{this.sourceBuffer.appendBuffer(this.queue),this.queue=new Uint8Array}catch(e){if("QuotaExceededError"===e.name)return Oe("".concat(this.type," buffer quota full")),void this.dispatch("error",{type:this.type,name:"QuotaExceeded",error:"buffer error"});Me("Error occured while appending ".concat(this.type," buffer - ").concat(e.name,": ").concat(e.message)),this.dispatch("error",{type:this.type,name:"unexpectedError",error:"buffer error"})}}},{key:"feed",value:function(e){this.queue=Ye(this.queue,e)}}]),n}(He);window.MediaSource=window.MediaSource||window.WebKitMediaSource;var Ke=function(e){c()(n,e);var t=De(n);function n(e){var r;i()(this,n),r=t.call(this,"jmuxer"),window.MediaSource=window.MediaSource||window.WebKitMediaSource;if(r.options=Object.assign({},{node:"",mode:"both",flushingTime:1500,clearBuffer:!0,onReady:null,fps:30,debug:!1,onClearBuffer:null},e),r.options.debug&&(Ee=console.log,Re=console.error),"string"==typeof r.options.node&&""==r.options.node&&Me("no video element were found to render, provide a valid video element"),r.options.fps||(r.options.fps=30),r.frameDuration=1e3/r.options.fps|0,r.node="string"==typeof r.options.node?document.getElementById(r.options.node):r.options.node,r.sourceBuffers={},r.isMSESupported=!!window.MediaSource,!r.isMSESupported)throw"Oops! Browser does not support media source extension.";return r.setupMSE(),r.remuxController=new $e(r.options.clearBuffer),r.remuxController.addTrack(r.options.mode),"audio"===r.options.mode&&(r.aacParser=r.remuxController.tracks.audio.aac),r.mseReady=!1,r.lastCleaningTime=Date.now(),r.keyframeCache=[],r.frameCounter=0,r.remuxController.on("buffer",r.onBuffer.bind(u()(r))),r.remuxController.on("ready",r.createBuffer.bind(u()(r))),r.startInterval(),r}return o()(n,[{key:"setupMSE",value:function(){this.mediaSource=new MediaSource,this.node.src=URL.createObjectURL(this.mediaSource),this.mediaSource.addEventListener("sourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("sourceclose",this.onMSEClose.bind(this)),this.mediaSource.addEventListener("webkitsourceopen",this.onMSEOpen.bind(this)),this.mediaSource.addEventListener("webkitsourceclose",this.onMSEClose.bind(this))}},{key:"feed",value:function(e){var t,n,r,i=!1,a={video:[],audio:[]};e&&this.remuxController&&(r=e.duration?parseInt(e.duration):0,e.video&&(t=Ie.extractNALu(e.video)).length>0&&(a.video=this.getVideoFrames(t,r),i=!0),e.audio&&(n=this.aacParser.extractAAC(e.audio)).length>0&&(a.audio=this.getAudioFrames(n,r),i=!0),i?this.remuxController.remux(a):Me("Input object must have video and/or audio property. Make sure it is not empty and valid typed array"))}},{key:"getVideoFrames",value:function(e,t){var n,r,i,a,o=[],s=[],u=0,l=[],c=Ce(e);try{for(c.s();!(a=c.n()).done;)n=a.value,r=new Ue(n),o.push(r),r.type()!==Ue.IDR&&r.type()!==Ue.NDR||(s.push({units:o}),o=[],this.options.clearBuffer&&(r.type()===Ue.IDR&&l.push(this.frameCounter),this.frameCounter++))}catch(e){c.e(e)}finally{c.f()}return t?(i=t/s.length|0,u=t-i*s.length):i=this.frameDuration,s.map((function(e){e.duration=u>0?i+1:i,0!==u&&u--})),this.options.clearBuffer&&(l=l.map((function(e){return e*i/1e3})),this.keyframeCache=this.keyframeCache.concat(l)),s}},{key:"getAudioFrames",value:function(e,t){var n,r,i,a=[],o=0,s=Ce(e);try{for(s.s();!(i=s.n()).done;)n=i.value,a.push({units:n})}catch(e){s.e(e)}finally{s.f()}return t?(r=t/a.length|0,o=t-r*a.length):r=this.frameDuration,a.map((function(e){e.duration=o>0?r+1:r,0!==o&&o--})),a}},{key:"destroy",value:function(){if(this.aacParser=null,this.stopInterval(),this.mediaSource){try{this.bufferControllers&&(this.mediaSource.endOfStream(),this.removeSourceBuffer())}catch(e){Me("mediasource is not available to end ".concat(e.message))}this.mediaSource=null}if(this.remuxController&&(this.remuxController.destroy(),this.remuxController=null),this.bufferControllers){for(var e in this.bufferControllers)this.bufferControllers[e].destroy();this.bufferControllers=null}this.node=!1,this.mseReady=!1,this.videoStarted=!1}},{key:"createBuffer",value:function(){if(this.mseReady&&this.remuxController&&this.remuxController.isReady()&&!this.bufferControllers)for(var e in this.bufferControllers={},this.remuxController.tracks){var t=this.remuxController.tracks[e];if(!n.isSupported("".concat(e,'/mp4; codecs="').concat(t.mp4track.codec,'"')))return Me("Browser does not support codec"),!1;var r=this.mediaSource.addSourceBuffer("".concat(e,'/mp4; codecs="').concat(t.mp4track.codec,'"'));this.bufferControllers[e]=new qe(r,e),this.sourceBuffers[e]=r,this.bufferControllers[e].on("error",this.onBufferError.bind(this)),this.bufferControllers[e].on("clearBuffer",this.onClearBuffer.bind(this)),this.bufferControllers[e].on("updateend",this.onUpdateEnd.bind(this))}}},{key:"onUpdateEnd",value:function(e){"function"==typeof this.options.onUpdateEnd&&this.options.onUpdateEnd(e)}},{key:"startInterval",value:function(){var e=this;this.interval=setInterval((function(){e.bufferControllers&&(e.releaseBuffer(),e.clearBuffer())}),this.options.flushingTime)}},{key:"stopInterval",value:function(){this.interval&&clearInterval(this.interval)}},{key:"releaseBuffer",value:function(){for(var e in this.bufferControllers)this.bufferControllers[e].doAppend()}},{key:"getSafeBufferClearLimit",value:function(e){for(var t,n="audio"===this.options.mode&&e||0,r=0;r=e);r++)t=this.keyframeCache[r];return t&&(this.keyframeCache=this.keyframeCache.filter((function(e){return e=t}))),n}},{key:"clearBuffer",value:function(){if(this.options.clearBuffer&&Date.now()-this.lastCleaningTime>1e4){for(var e in this.bufferControllers){var t=this.getSafeBufferClearLimit(this.node.currentTime);this.bufferControllers[e].initCleanup(t)}this.lastCleaningTime=Date.now()}}},{key:"onBuffer",value:function(e){this.bufferControllers&&this.bufferControllers[e.type]&&this.bufferControllers[e.type].feed(e.payload)}},{key:"onClearBuffer",value:function(){"function"==typeof this.options.onClearBuffer&&this.options.onClearBuffer()}},{key:"removeSourceBuffer",value:function(){if(this.mediaSource){var e=this.sourceBuffers;for(var t in e)this.mediaSource.removeSourceBuffer(e[t])}}},{key:"onMSEOpen",value:function(){this.mseReady=!0,this.createBuffer(),"function"==typeof this.options.onReady&&(this.options.onReady(),this.options.onReady=null)}},{key:"onMSEClose",value:function(){this.mseReady=!1,this.videoStarted=!1}},{key:"onBufferError",value:function(e){if("QuotaExceeded"!=e.name){if(this.mediaSource.sourceBuffers.length>0&&this.sourceBuffers[e.type]&&this.mediaSource.removeSourceBuffer(this.sourceBuffers[e.type]),0==this.mediaSource.sourceBuffers.length)try{this.mediaSource.endOfStream()}catch(e){Me("mediasource is not available to end")}}else this.bufferControllers[e.type].initCleanup(this.node.currentTime)}}],[{key:"isSupported",value:function(e){return window.MediaSource&&window.MediaSource.isTypeSupported(e)}}]),n}(He);function Qe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Ze=function(e){c()(n,e);var t=Qe(n);function n(e){var r;return i()(this,n),r=t.call(this,e),v()(u()(r),"source",[]),v()(u()(r),"onPlay",void 0),r.source=e.source,r.onPlay=e.onPlay,r.init(),r}return o()(n,[{key:"init",value:function(){}},{key:"extract",value:function(e,t){for(var n=this.provide(t),r=0;r0;){var s=this.source.shift(),u=s.loadedPosition||0;a=s.startTime+s.duration*u/s.length;var l=Math.min(s.length-u,t-i),c=s.getChannelData(0),f=s.numberOfChannels>1?s.getChannelData(1):s.getChannelData(0);if(n.set(c.slice(u,u+l),i),r.set(f.slice(u,u+l),i),o+=l,i+=l,(u+=l)2&&void 0!==arguments[2]?arguments[2]:0,r=2*(t=t||0);n>=0||(n=(e.length-r)/2);var i=2*n;this.ensureCapacity(n+this._frameCount);var a=this.endIndex;this.vector.set(e.subarray(r,r+i),a),this._frameCount+=n}},{key:"putBuffer",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=t||0,n>=0||(n=e.frameCount-t),this.putSamples(e.vector,e.position+t,n)}},{key:"receive",value:function(e){e>=0&&!(e>this._frameCount)||(e=this.frameCount),this._frameCount-=e,this._position+=e}},{key:"receiveSamples",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=2*t,r=this.startIndex;e.set(this._vector.subarray(r,r+n)),this.receive(t)}},{key:"extract",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=this.startIndex+2*t,i=2*n;e.set(this._vector.subarray(r,r+i))}},{key:"ensureCapacity",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=parseInt(2*e);if(this._vector.length0&&void 0!==arguments[0]?arguments[0]:0;this.ensureCapacity(this._frameCount+e)}},{key:"rewind",value:function(){this._position>0&&(this._vector.set(this._vector.subarray(this.startIndex,this.endIndex)),this._position=0)}},{key:"vector",get:function(){return this._vector}},{key:"position",get:function(){return this._position}},{key:"startIndex",get:function(){return 2*this._position}},{key:"frameCount",get:function(){return this._frameCount}},{key:"endIndex",get:function(){return 2*(this._position+this._frameCount)}}]),e}(),ut=function(){function e(t){Je(this,e),t?(this._inputBuffer=new st,this._outputBuffer=new st):this._inputBuffer=this._outputBuffer=null}return tt(e,[{key:"clear",value:function(){this._inputBuffer.clear(),this._outputBuffer.clear()}},{key:"inputBuffer",get:function(){return this._inputBuffer},set:function(e){this._inputBuffer=e}},{key:"outputBuffer",get:function(){return this._outputBuffer},set:function(e){this._outputBuffer=e}}]),e}(),lt=function(e){function t(e){var n;return Je(this,t),(n=at(this,rt(t).call(this,e))).reset(),n._rate=1,n}return nt(t,e),tt(t,[{key:"reset",value:function(){this.slopeCount=0,this.prevSampleL=0,this.prevSampleR=0}},{key:"clone",value:function(){var e=new t;return e.rate=this._rate,e}},{key:"process",value:function(){var e=this._inputBuffer.frameCount;this._outputBuffer.ensureAdditionalCapacity(e/this._rate+1);var t=this.transpose(e);this._inputBuffer.receive(),this._outputBuffer.put(t)}},{key:"transpose",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(0===e)return 0;for(var t=this._inputBuffer.vector,n=this._inputBuffer.startIndex,r=this._outputBuffer.vector,i=this._outputBuffer.endIndex,a=0,o=0;this.slopeCount<1;)r[i+2*o]=(1-this.slopeCount)*this.prevSampleL+this.slopeCount*t[n],r[i+2*o+1]=(1-this.slopeCount)*this.prevSampleR+this.slopeCount*t[n+1],o+=1,this.slopeCount+=this._rate;if(this.slopeCount-=1,1!==e)e:for(;;){for(;this.slopeCount>1;)if(this.slopeCount-=1,(a+=1)>=e-1)break e;var s=n+2*a;r[i+2*o]=(1-this.slopeCount)*t[s]+this.slopeCount*t[s+2],r[i+2*o+1]=(1-this.slopeCount)*t[s+1]+this.slopeCount*t[s+3],o+=1,this.slopeCount+=this._rate}return this.prevSampleL=t[n+2*e-2],this.prevSampleR=t[n+2*e-1],o}},{key:"rate",set:function(e){this._rate=e}}]),t}(ut),ct=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024;Je(this,e),this._pipe=t,this.inputSize=n}return tt(e,[{key:"fillInputBuffer",value:function(){throw new Error("fillInputBuffer() not overridden")}},{key:"fillOutputBuffer",value:function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.inputSize;this.outputBuffer.frameCount2&&void 0!==arguments[2]?arguments[2]:1024,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ft;return Je(this,t),(r=at(this,rt(t).call(this,n,i))).callback=a,r.sourceSound=e,r.historyBufferSize=22050,r._sourcePosition=0,r.outputBufferPosition=0,r._position=0,r}return nt(t,e),tt(t,[{key:"onEnd",value:function(){this.callback()}},{key:"fillInputBuffer",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=new Float32Array(2*e),n=this.sourceSound.extract(t,e,this._sourcePosition);this._sourcePosition+=n,this.inputBuffer.putSamples(t,0,n)}},{key:"extract",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.fillOutputBuffer(this.outputBufferPosition+t);var n=Math.min(t,this.outputBuffer.frameCount-this.outputBufferPosition);this.outputBuffer.extract(e,this.outputBufferPosition,n);var r=this.outputBufferPosition+n;return this.outputBufferPosition=Math.min(this.historyBufferSize,r),this.outputBuffer.receive(Math.max(r-this.historyBufferSize,0)),this._position+=n,n}},{key:"handleSampleData",value:function(e){this.extract(e.data,4096)}},{key:"clear",value:function(){ot(rt(t.prototype),"clear",this).call(this),this.outputBufferPosition=0}},{key:"position",get:function(){return this._position},set:function(e){if(e>this._position)throw new RangeError("New position may not be greater than current position");var t=this.outputBufferPosition-(this._position-e);if(t<0)throw new RangeError("New position falls outside of history buffer");this.outputBufferPosition=t,this._position=e}},{key:"sourcePosition",get:function(){return this._sourcePosition},set:function(e){this.clear(),this._sourcePosition=e}}]),t}(ct),dt=[[124,186,248,310,372,434,496,558,620,682,744,806,868,930,992,1054,1116,1178,1240,1302,1364,1426,1488,0],[-100,-75,-50,-25,25,50,75,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-20,-15,-10,-5,5,10,15,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[-4,-3,-2,-1,1,2,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],pt=function(e){function t(e){var n;return Je(this,t),(n=at(this,rt(t).call(this,e)))._quickSeek=!0,n.midBufferDirty=!1,n.midBuffer=null,n.overlapLength=0,n.autoSeqSetting=!0,n.autoSeekSetting=!0,n._tempo=1,n.setParameters(44100,0,0,8),n}return nt(t,e),tt(t,[{key:"clear",value:function(){ot(rt(t.prototype),"clear",this).call(this),this.clearMidBuffer()}},{key:"clearMidBuffer",value:function(){this.midBufferDirty&&(this.midBufferDirty=!1,this.midBuffer=null)}},{key:"setParameters",value:function(e,t,n,r){e>0&&(this.sampleRate=e),r>0&&(this.overlapMs=r),t>0?(this.sequenceMs=t,this.autoSeqSetting=!1):this.autoSeqSetting=!0,n>0?(this.seekWindowMs=n,this.autoSeekSetting=!1):this.autoSeekSetting=!0,this.calculateSequenceParameters(),this.calculateOverlapLength(this.overlapMs),this.tempo=this._tempo}},{key:"calculateOverlapLength",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;e=(e=this.sampleRate*t/1e3)<16?16:e,e-=e%8,this.overlapLength=e,this.refMidBuffer=new Float32Array(2*this.overlapLength),this.midBuffer=new Float32Array(2*this.overlapLength)}},{key:"checkLimits",value:function(e,t,n){return en?n:e}},{key:"calculateSequenceParameters",value:function(){var e,t;this.autoSeqSetting&&(e=150+-50*this._tempo,e=this.checkLimits(e,50,125),this.sequenceMs=Math.floor(e+.5)),this.autoSeekSetting&&(t=25- -10/1.5*.5+-10/1.5*this._tempo,t=this.checkLimits(t,15,25),this.seekWindowMs=Math.floor(t+.5)),this.seekWindowLength=Math.floor(this.sampleRate*this.sequenceMs/1e3),this.seekLength=Math.floor(this.sampleRate*this.seekWindowMs/1e3)}},{key:"clone",value:function(){var e=new t;return e.tempo=this._tempo,e.setParameters(this.sampleRate,this.sequenceMs,this.seekWindowMs,this.overlapMs),e}},{key:"seekBestOverlapPosition",value:function(){return this._quickSeek?this.seekBestOverlapPositionStereoQuick():this.seekBestOverlapPositionStereo()}},{key:"seekBestOverlapPositionStereo",value:function(){var e,t,n,r=0;for(this.preCalculateCorrelationReferenceStereo(),e=0,t=Number.MIN_VALUE;rt&&(t=n,e=r);return e}},{key:"seekBestOverlapPositionStereoQuick",value:function(){var e,t,n,r,i,a=0;for(this.preCalculateCorrelationReferenceStereo(),t=Number.MIN_VALUE,e=0,r=0,i=0;a<4;a+=1){for(var o=0;dt[a][o]&&!((i=r+dt[a][o])>=this.seekLength);)(n=this.calculateCrossCorrelationStereo(2*i,this.refMidBuffer))>t&&(t=n,e=i),o+=1;r=e}return e}},{key:"preCalculateCorrelationReferenceStereo",value:function(){for(var e,t,n=0;n=this.sampleReq;){e=this.seekBestOverlapPosition(),this._outputBuffer.ensureAdditionalCapacity(this.overlapLength),this.overlap(Math.floor(e)),this._outputBuffer.put(this.overlapLength),(t=this.seekWindowLength-2*this.overlapLength)>0&&this._outputBuffer.putBuffer(this._inputBuffer,e+this.overlapLength,t);var r=this._inputBuffer.startIndex+2*(e+this.seekWindowLength-this.overlapLength);this.midBuffer.set(this._inputBuffer.vector.subarray(r,r+2*this.overlapLength)),this.skipFract+=this.nominalSkip,n=Math.floor(this.skipFract),this.skipFract-=n,this._inputBuffer.receive(n)}}},{key:"tempo",set:function(e){var t;this._tempo=e,this.calculateSequenceParameters(),this.nominalSkip=this._tempo*(this.seekWindowLength-this.overlapLength),this.skipFract=0,t=Math.floor(this.nominalSkip+.5),this.sampleReq=Math.max(t+this.overlapLength,this.seekWindowLength)+this.seekLength},get:function(){return this._tempo}},{key:"inputChunkSize",get:function(){return this.sampleReq}},{key:"outputChunkSize",get:function(){return this.overlapLength+Math.max(0,this.seekWindowLength-2*this.overlapLength)}},{key:"quickSeek",set:function(e){this._quickSeek=e}}]),t}(ut),yt=function(e,t){return(e>t?e-t:t-e)>1e-10},vt=function(){function e(){Je(this,e),this.transposer=new lt(!1),this.stretch=new pt(!1),this._inputBuffer=new st,this._intermediateBuffer=new st,this._outputBuffer=new st,this._rate=0,this._tempo=0,this.virtualPitch=1,this.virtualRate=1,this.virtualTempo=1,this.calculateEffectiveRateAndTempo()}return tt(e,[{key:"clear",value:function(){this.transposer.clear(),this.stretch.clear()}},{key:"clone",value:function(){var t=new e;return t.rate=this.rate,t.tempo=this.tempo,t}},{key:"calculateEffectiveRateAndTempo",value:function(){var e=this._tempo,t=this._rate;this._tempo=this.virtualTempo/this.virtualPitch,this._rate=this.virtualRate*this.virtualPitch,yt(this._tempo,e)&&(this.stretch.tempo=this._tempo),yt(this._rate,t)&&(this.transposer.rate=this._rate),this._rate>1?this._outputBuffer!=this.transposer.outputBuffer&&(this.stretch.inputBuffer=this._inputBuffer,this.stretch.outputBuffer=this._intermediateBuffer,this.transposer.inputBuffer=this._intermediateBuffer,this.transposer.outputBuffer=this._outputBuffer):this._outputBuffer!=this.stretch.outputBuffer&&(this.transposer.inputBuffer=this._inputBuffer,this.transposer.outputBuffer=this._intermediateBuffer,this.stretch.inputBuffer=this._intermediateBuffer,this.stretch.outputBuffer=this._outputBuffer)}},{key:"process",value:function(){this._rate>1?(this.stretch.process(),this.transposer.process()):(this.transposer.process(),this.stretch.process())}},{key:"rate",get:function(){return this._rate},set:function(e){this.virtualRate=e,this.calculateEffectiveRateAndTempo()}},{key:"rateChange",set:function(e){this._rate=1+.01*e}},{key:"tempo",get:function(){return this._tempo},set:function(e){this.virtualTempo=e,this.calculateEffectiveRateAndTempo()}},{key:"tempoChange",set:function(e){this.tempo=1+.01*e}},{key:"pitch",set:function(e){this.virtualPitch=e,this.calculateEffectiveRateAndTempo()}},{key:"pitchOctaves",set:function(e){this.pitch=Math.exp(.69314718056*e),this.calculateEffectiveRateAndTempo()}},{key:"pitchSemitones",set:function(e){this.pitchOctaves=e/12}},{key:"inputBuffer",get:function(){return this._inputBuffer}},{key:"outputBuffer",get:function(){return this._outputBuffer}}]),e}(),gt=function(){function e(t){Je(this,e),this.buffer=t,this._position=0}return tt(e,[{key:"extract",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.position=n;for(var r=this.buffer.getChannelData(0),i=this.dualChannel?this.buffer.getChannelData(1):this.buffer.getChannelData(0),a=0;a1}},{key:"position",get:function(){return this._position},set:function(e){this._position=e}}]),e}(),mt=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ft,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4096,i=e.createScriptProcessor(r,2,2),a=new Float32Array(2*r);return i.onaudioprocess=function(e){var i=e.outputBuffer.getChannelData(0),o=e.outputBuffer.getChannelData(1),s=t.extract(a,r);n(t.sourcePosition),0===s&&t.onEnd();for(var u=0;u=(n=2)?t:new Array(n-t.length+1).join(r)+t))},kt=function(e){var t=this.timePlayed,n=this.sampleRate;if(this.sourcePosition=e,this.timePlayed=e/n,t!==this.timePlayed){var r=new CustomEvent("play",{detail:{timePlayed:this.timePlayed,formattedTimePlayed:this.formattedTimePlayed,percentagePlayed:this.percentagePlayed}});this._node.dispatchEvent(r)}};!function(){function e(t,n,r){var i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ft;Je(this,e),this._soundtouch=new vt;var o=new gt(n);this.timePlayed=0,this.sourcePosition=0,this._filter=new ht(o,this._soundtouch,a),this._node=mt(t,this._filter,(function(e){return kt.call(i,e)})),this.tempo=1,this.rate=1,this.duration=n.duration,this.sampleRate=t.sampleRate,this.listeners=[]}tt(e,[{key:"connect",value:function(e){this._node.connect(e)}},{key:"disconnect",value:function(){this._node.disconnect()}},{key:"on",value:function(e,t){this.listeners.push({name:e,cb:t}),this._node.addEventListener(e,(function(e){return t(e.detail)}))}},{key:"off",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=this.listeners;t&&(n=n.filter((function(e){return e.name===t}))),n.forEach((function(t){e._node.removeEventListener(t.name,(function(e){return t.cb(e.detail)}))}))}},{key:"formattedDuration",get:function(){return bt(this.duration)}},{key:"formattedTimePlayed",get:function(){return bt(this.timePlayed)}},{key:"percentagePlayed",get:function(){return 100*this._filter.sourcePosition/(this.duration*this.sampleRate)},set:function(e){this._filter.sourcePosition=parseInt(e*this.duration*this.sampleRate)}},{key:"node",get:function(){return this._node}},{key:"pitch",set:function(e){this._soundtouch.pitch=e}},{key:"pitchSemitones",set:function(e){this._soundtouch.pitchSemitones=e}},{key:"rate",set:function(e){this._soundtouch.rate=e}},{key:"tempo",set:function(e){this._soundtouch.tempo=e}}])}();function Pt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var xt=function(e){c()(n,e);var t=Pt(n);function n(e){var r;return i()(this,n),r=t.call(this,e),v()(u()(r),"soundTouch",void 0),v()(u()(r),"filter",void 0),r.init(e.source),r}return o()(n,[{key:"init",value:function(e){this.soundTouch=new vt,this.soundTouch.tempo=1,this.soundTouch.rate=1,this.filter=new ht(e,this.soundTouch,2048)}},{key:"rate",set:function(e){this.soundTouch.tempo=e}},{key:"provide",value:function(e){for(var t=new Float32Array(2*e),n=this.filter.extract(t,e),r=new Float32Array(n),i=new Float32Array(n),a=0;a0&&(this.audioContext.decodeAudioData(this.audioBuffer,(function(n){n.startTime=t.delay,t.delay+=n.duration,t.decodedBuffer.push(n),e&&e.call()}),(function(e){t.logger.error("decodeAudioData",e)})),this.audioBuffer=new ArrayBuffer(0))}},{key:"play",value:function(){var e=this;return new Promise((function(t,n){e.isFirstPlay?(e.isFirstPlay=!1,e.logger.info("startPlay"),e.audioContext=new(window.AudioContext||window.webkitAudioContext),e.gainNode=e.audioContext.createGain(),e.gainNode.gain.value=e.defaultVolume,e.scriptNode=e.audioContext.createScriptProcessor(2048,2,2),e.scriptNode.onaudioprocess=function(t){var n=t.outputBuffer,r=n.length,i=e.audioProvider.provide(r);if(0!==i.size){e.isWaiting&&(e.isWaiting=!1,e.triggerEvent(_t));var a=n.getChannelData(0),o=n.getChannelData(1);if(0!=i.audioTime&&(e.audioTime=i.audioTime),a.set(i.left),o.set(i.right),i.size0;){var n=this.decodedBuffer.shift();if(n.startTime<=e&&n.startTime+n.duration>e){n.loadedPosition=parseInt(n.length*(e-n.startTime)/n.duration),this.decodedBuffer.unshift(n);break}}setTimeout((function(){t.triggerEvent(St)}),0)}},{key:"pause",value:function(){var e=this;this.audioContext&&this.audioContext.suspend().then((function(){e.logger.info("pause","Audio is paused")}))}},{key:"addEventListener",value:function(e,t){this.eventListeners[e]=t}},{key:"triggerEvent",value:function(e){var t=this.eventListeners[e];t&&t.call()}},{key:"buffer",value:function(){var e=0;this.decodedBuffer.length>0&&(e=this.decodedBuffer[0].startTime);return{start:1e3*e,end:parseInt(1e3*this.delay)}}},{key:"volume",get:function(){return this.gainNode.gain.value},set:function(e){this.gainNode?this.gainNode.gain.value=e:this.defaultVolume=e}},{key:"destroy",value:function(){this.delay=0,this.audioContext&&(clearInterval(this.interval),this.scriptNode.disconnect(),this.scriptNode=null,this.audioContext.close(),this.audioContext=null),this.gainNode=null,this.audioBuffer=new ArrayBuffer(0),this.canPlay=!1,this.isFirstPlay=!0,this.decodedBuffer.length=0,this.seekTimeDelta=0,this.audioTime=0}},{key:"playbackRate",set:function(e){e!==this.currentRate&&(this.currentRate=e,this.audioProvider.rate=e)}},{key:"testAutoplay",value:function(e,t){var n=L.createEl("audio"),r=n.play();n=null;var i=!1;void 0!==r?(r.catch((function(){i=!0})),setTimeout((function(){r=null,i?t("Autoplay is prevented"):e()}),100)):t("Promise is undefined")}}]),n}(N);function Lt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Ct=function(e){c()(n,e);var t=Lt(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"need",!0),v()(u()(e),"first",!1),v()(u()(e),"offset",0),v()(u()(e),"currentPTS",0),v()(u()(e),"ready",!1),v()(u()(e),"end",!1),v()(u()(e),"lastData",null),v()(u()(e),"nodeParent",null),v()(u()(e),"useJMuxer",!1),e.player=r.audioNode,e.createAudioMuxer(),e.bindEvent(),e.logger.info("audioDecoder",e.useJMuxer?"JMuxer":"AudioContext"),e}return o()(n,[{key:"bindEvent",value:function(){var e=this;this.bindNodeEvent(),this.events.on(se.PlayerMaxPTS,(function(t){e.currentPTS===t&&(e.end=!0)}))}},{key:"bindNodeEvent",value:function(){var e=this;this.addEventListener("seeked",(function(){e.onSeekedHandler&&e.onSeekedHandler(),e.events.emit("AudioPlayer.seeked")})),this.addEventListener("canplaythrough",(function(){e.logger.info("canplaythrough"),e.ready||(e.ready=!0,e.status="ready",e.logger.info("constructor","canplaythrough","ready"),e.events.emit(se.AudioPlayerDataReady))})),this.addEventListener("waiting",(function(){e.ready=!1,e.end?(e.useJMuxer||e.player.destroy(),e.status="end",e.events.emit(se.AudioPlayerEnd,"audio"),e.logger.info("audioPlayer end")):(e.logger.warn("audioPlayer waiting",e.player.currentTime,e.currentPTS),e.status="waiting",e.events.emit(se.AudioPlayerWait,"audio"))}))}},{key:"reset",value:function(){this.lastData=null,this.first=!1,this.offset=0,this.currentPTS=0,this.ready=!1,this.end=!1,this.clear(),this.createAudioMuxer(),this.bindNodeEvent(),this.stime=null}},{key:"createNode",value:function(){this.player=document.createElement("audio"),this.player.classList.add("goldplay__audio--player"),this.parentNode.appendChild(this.player)}},{key:"createAudioMuxer",value:function(){this.useJMuxer?this.audioDecoder=new Ke({node:this.player,mode:"audio",debug:!1,clearBuffer:!0,flushingTime:10,onReady:this.onMSEReady.bind(this)}):(this.audioDecoder=new Rt({flushTime:100,onReady:this.onMSEReady.bind(this)}),this.player=this.audioDecoder)}},{key:"onMSEReady",value:function(){this.logger.info("onMSEReady","AudioPlayerReady"),this.events.emit(se.AudioPlayerReady)}},{key:"clear",value:function(){this.audioDecoder.destroy(),this.audioDecoder=null}},{key:"play",value:function(){var e=this;"playing"!==this.status&&(this.status="playing",this.player.play().then((function(){e.events.emit(se.AudioPlayerPlaySuccess)})).catch((function(t){e.logger.error("play","errorInfo:",t),e.events.emit(se.AudioPlayerPlayFail)})))}},{key:"muted",set:function(e){this.player.muted=!!e}},{key:"playbackRate",set:function(e){this.player.playbackRate=e}},{key:"pause",value:function(){"pause"!==this.status&&(this.status="pause",this.player.pause())}},{key:"volume",get:function(){return this.player.volume},set:function(e){this.player.volume=e,this.muted=0===e}},{key:"currentTime",get:function(){return parseInt(1e3*this.player.currentTime+this.offset)},set:function(e){this.player.currentTime=(e-this.offset)/1e3}},{key:"paused",get:function(){return this.player.paused}},{key:"send",value:function(e){if(!e.PTS)return this.need=!1,void this.events.emit(se.AudioPlayerDataReady);if(this.need=!0,this.audioDecoder){if(this.stime||(this.stime=Date.now()),(e=this.format(e)).audioEnd)return this.logger.info("push","audioEnd"),this.feed(this.lastData),void(this.lastData=null);if(this.first||(this.first=!0,this.offset=e.start),e.PTS>this.currentPTS){if(!this.lastData)return void(this.lastData=e);this.lastData.duration=e.PTS-this.lastData.PTS,this.feed(this.lastData),e.duration=this.lastData.duration,this.lastData=e}}else this.logger.error("send","audioDecoder is:",this.audioDecoder)}},{key:"feed",value:function(e){this.audioDecoder.feed({audio:e.data_byte,duration:e.duration}),this.currentPTS=e.PTS}},{key:"format",value:function(e){return e&&e.data_byte&&(e.start=e.PTS),e}},{key:"addEventListener",value:function(e,t){this.player.addEventListener(e,t)}},{key:"isBuffered",value:function(e){return-1!==[this.buffer()].findIndex((function(t){return e>=t.start&&e0;)n.start=1e3*e.start(t-1)+this.offset,n.end=1e3*e.end(t-1)+this.offset,t--;return n}var r=this.player.buffer();return{start:r.start+this.offset,end:r.end+this.offset}}},{key:"offset",set:function(e){this.offset=e}}]),n}(N),At={playerContainer:"goldplay__container",screenContainer:"goldplay__screen--container",screenCanvas:"goldplay__screen--canvas",audioContainer:"goldplay__audio--container",audioPlayer:"goldplay__audio--player",controlContainer:"goldplay__control--container",containerFullPage:"goldplay__container-fullpage",containerFullScreen:"goldplay__container-fullscreen",controlContainerFloat:"goldplay__control--container-float",bigPlayButton:"goldplay__screen--bigplay",poster:"goldplay__screen--poster",nearside:"goldplay__control--nearside",sidebar:"goldplay__control--sidebar",buttonBlock:"goldplay__control--button-block",playButton:"goldplay__control--play",pauseButton:"goldplay__control--pause",replayButton:"goldplay__control--replay",speedBar:"goldplay__speed-bar",speedBarBox:"goldplay__speed-bar--box",rateBar:"goldplay__rate-bar",rateBarBox:"goldplay__rate-bar--box",fullPage:"goldplay__control--fullpage",fullScreen:"goldplay__control--fullscreen",waitingBar:"goldplay__waiting-bar",progressBar:"goldplay__progress-bar",progressBarHover:"goldplay__progress-bar-hover",progressBarPlay:"goldplay__progressbar--play",progressBarPlayHover:"goldplay__progressbar--play-hover",progressBarLoad:"goldplay__progressbar--load",progressBarLoadHover:"goldplay__progressbar--load-hover",progressBarDot:"goldplay__progressbar--dot",progressBarDotHover:"goldplay__progressbar--dot-hover",volumeBar:"goldplay__volume-bar",volumeBarAudio:"goldplay__volume-bar--audio",volumeBarAudioOn:"goldplay__volume-bar--audio-on",volumeBarAudioOff:"goldplay__volume-bar--audio-off",volumeBarHandle:"goldplay__volume-bar--handle",volumeBarRod:"goldplay__volume-bar--rod",volumeBarRodHover:"goldplay__volume-bar--rod-hover",volumeBarSize:"goldplay__volume-bar--size",volumeBarColumn:"goldplay__volume-bar--column",alertBox:"goldplay__alter-box",alertClose:"goldplay__alter--close"};function Dt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Ot=At,Mt=function(){function e(){i()(this,e)}return o()(e,null,[{key:"createContainer",value:function(e){var t=function(e){c()(n,e);var t=Dt(n);function n(){return i()(this,n),t.apply(this,arguments)}return o()(n)}(J()(HTMLDivElement));customElements.get("gp-container")||customElements.define("gp-container",t,{extends:"div"});var n=L.createEl("gp-container","div");return n.className=Ot.playerContainer,n.style.width=(e.options.width?e.options.width:e.el.offsetWidth)+"px",n.style.height=(e.options.height?e.options.height:e.el.offsetHeight)+"px",n}},{key:"createScreenContainer",value:function(e){var t=e.$container,n=function(e){c()(n,e);var t=Dt(n);function n(){return i()(this,n),t.apply(this,arguments)}return o()(n)}(J()(HTMLDivElement));customElements.get("gp-screen")||customElements.define("gp-screen",n,{extends:"div"});var r,a=L.createEl("gp-screen","div");return a.classList.add(Ot.screenContainer),r=e.controlBarAutoHide?t.offsetHeight:t.offsetHeight-e.controlBarHeight,a.style.height=r+"px",a}},{key:"createAudioContainer",value:function(){var e=L.createEl("gp-audio");return e.classList.add(Ot.audioContainer),e.style.display="none",e}},{key:"createAudio",value:function(){var e=L.createEl("audio");return e.classList.add(Ot.audioPlayer),e.controls=!0,e}},{key:"clearCavans",value:function(e){var t=e.getContext("webgl");t.clear(t.COLOR_BUFFER_BIT)}}]),e}();v()(Mt,"createCanvas",(function(e){var t=L.createEl("canvas");return t.style.display="none",t.classList.add(Ot.screenCanvas),t.width=e.options.screenWidth||e.screenWidth,t.height=e.options.screenHeight||e.screenHeight,t}));var Ut=P.a.get("Template.js"),Nt=function(){function e(){i()(this,e)}return o()(e,null,[{key:"mergeVar",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"!=typeof e||""===e)return e;try{var n=new RegExp("\\${'?\"?\\s*([.:a-z0-9_s]+?)\\s*'?\"?}","ig");return e.replace(n,(function(e,n){n=n.trim();var r=t[n];return r=(r=void 0===(r=null===r?"":r)?"":r)||""}))}catch(t){return Ut.error("mergeVar","replace variable","error:",t),e}}},{key:"makeValue",value:function(t,n,r){if("string"!=typeof n&&"function"!=typeof n)return n;if("function"==typeof n&&(n=n.call(this,this.data)),!r)return e.escapeHTML.call(this,n);var i,a=function(t){var n="";return t&&(n=" ".concat(e.slotReplaceName,'="true"')),'")};if(e.isSoltType(r)){if("function"!=typeof this.getComponent)return Ut.error("makeValue","the object is not support slot mode.",this.getComponent,n),n;switch(r){case e.slotTypeMap.component:i=n;var o=this.getComponent(i);"object"===E()(o)&&o.element?(o.element.setAttribute(e.slotReplaceName,"true"),n=o.element.outerHTML):n=a(i);break;case e.slotTypeMap.html:n=e.mergeVar.call(this,n,this.data)}var s="";void 0!==i&&(s=" ".concat(e.slotComName,'="').concat(i,'" '));var u="$1 "+e.slotTypeName+'="'+r+'" '+e.slotKeyName+'="'+t+'"'+s+"$2";return"string"==typeof n&&(n=(n=""===n?a():n).replace(/^\s*(<\s?[\w-]*)(.*[\r|\n|>])/,u)),n}if("string"==typeof r){var l=It[r];return"function"==typeof l&&(n=l.call(this,n)),n}return e.escapeHTML.call(this,n)}},{key:"escapeHTML",value:function(e){return"string"!=typeof e?e:e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}},{key:"generate",value:function(t,n,r){var i=this,a=r[r.length-1]||{},o=[t[0]];return n.forEach((function(n,s){if(n){var u,l,c=n.split(e.pipSeparator);c.length>1&&(n=c[0],l=c[1]),u=Number.isInteger(n)?r[n]:a[n],void 0!==(u=e.makeValue.bind(i)(n,u,l))&&o.push(u),void 0!==t[s+1]&&o.push(t[s+1])}})),o.join("")}},{key:"create",value:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i1&&void 0!==arguments[1]?arguments[1]:{},n=this,r=t.set,i=t.get;e=e||n.data;var a=n.object,o={set:function(e,t,i){return"function"==typeof r?r.call(n,e,t,i):(e[t]!==i&&(e[t]=i,a.__template__&&Object.prototype.hasOwnProperty.call(a.__template__.dict,t)&&n.watch(e,t,i)),!0)},get:function(e,t){return"function"==typeof i?i.call(n,e,t):"object"===E()(e[t])&&null!==e[t]?new Proxy(e[t],o):Reflect.get(e,t)}};return new Proxy(e,o)}}]),e}(),Gt=function(e){return"object"!==E()(e)&&zt.error("observer","this is not an object."),new Xt(e)};function Yt(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return $t(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $t(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function $t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"createTemplate",null),v()(u()(e),"template",""),v()(u()(e),"element",null),v()(u()(e),"eventsList",{}),v()(u()(e),"data",{}),v()(u()(e),"id",""),e.id=r.id||e.constructor.name,e.options=r,e.createTemplate=Ht.create.bind(u()(e)),e}return o()(n,[{key:"getTemplate",value:function(){return this.template}},{key:"setTemplate",value:function(e){this.template=e}},{key:"init",value:function(){this.data=Gt(this).create(this.data),this.render(),"function"==typeof this.afterInit&&this.afterInit()}},{key:"afterInit",value:function(){}},{key:"initProps",value:function(){}},{key:"bindEvent",value:function(){}},{key:"watch",value:function(){}},{key:"render",value:function(){var e="";e="function"==typeof this.template?this.template(this.data):this.template;var t=L.createEl("div");if("string"==typeof e){t.innerHTML=e;var n,r=t.firstElementChild,i=Yt(r.querySelectorAll("["+Ht.slotReplaceName+"]"));try{for(i.s();!(n=i.n()).done;){var a=n.value;if("true"===a.getAttribute(Ht.slotReplaceName)){var o=a.getAttribute(Ht.slotComName),s=this.getComponent(o);if(!s)continue;var u=s.element;L.isElement(this.element)?a.replaceWith(u.cloneNode(!0)):a.replaceWith(u),s.element.removeAttribute(Ht.slotReplaceName)}}}catch(e){i.e(e)}finally{i.f()}L.isElement(this.element)?this.replaceNode(this.element,r):this.element=r}else this.logger.error("render:","this template is not html string","html:",e)}},{key:"replaceNode",value:function(e,t){if(e&&t){var n=Kt(e),r=Kt(t),i=n.length,a=r.length,o=Math.max(i,a);if(o<=0||e.tagName!==t.tagName)return e.replaceWith(t),void(this.element=t);for(;o--;){var s=n[o],u=r[o];if(s)if(u){if(s.tagName===u.tagName&&L.syncAttributes(s,u),!s.isEqualNode(u)){var l=Math.max(s.childNodes.length,u.childNodes.length);if(l<=0)en(s,u,s.parentNode);else for(var c=0,f=l;c3&&void 0!==arguments[3]&&arguments[3];return e.addEventListener(t,n,r),{destroy:function(){e.removeEventListener(t,n)}}}},{key:"removeEventListenerAll",value:function(){var e=this;Object.keys(this.eventsList).forEach((function(t){e.eventsList[t].destroy()}))}},{key:"getComponent",value:function(e){if(void 0!==e)return this.options.componentsController?this.options.componentsController.getComponent(e):void 0}},{key:"getHTMLString",value:function(){return this.element.outerHTML}},{key:"destroy",value:function(){this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.events.emit("Component_"+this.id+".destroy",this),this.removeEventListenerAll()}}]),n}(N),nn=n(8),rn=n.n(nn),an={formatHHMMSS:function(e){var t=parseInt(e,10),n=Math.floor(t/3600),r=Math.floor((t-3600*n)/60),i=t-3600*n-60*r;n<10&&(n="0"+n),r<10&&(r="0"+r),i<10&&(i="0"+i);var a="";return"00"!==n&&(a=n+":"),a+r+":"+i}},on={formatBytes:function(e,t){if(0==e)return"0 Bytes";var n=t<=0?0:t||2,r=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,r)).toFixed(n))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][r]}};function sn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var un,ln="data:img/jpg;base64,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\nrkJggg==",cn=function(e){c()(n,e);var t=sn(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(Qt||(Qt=rn()(['\n \n \n ',"\n \n "])),"poster","width","display","height","speed")),v()(u()(e),"data",{poster:"",status:"",display:"show",speed:"",width:"",height:""}),v()(u()(e),"options",{}),e.options=r,r.player.poster?e.data.poster=r.player.poster:e.data.poster=ln,Object.assign(e.data,r.data),e.init(),e}return o()(n,[{key:"resetPosition",value:function(){if(this.element)this.element.parentNode.offsetWidth,this.element.parentNode.offsetHeight}},{key:"bindEvent",value:function(){var e=this;this.events.on(se.LoaderUpdateSpeed,(function(t){"show"===e.data.display&&(e.data.speed=on.formatBytes(t.speed)+" /s")}))}},{key:"hide",value:function(){"hide"!==this.data.display&&(this.element.style.opacity=0,this.element.style.display="none",this.data.display="hide")}}]),n}(tn);function fn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var hn=function(e){c()(n,e);var t=fn(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(un||(un=rn()(['\n \n ',"\n ","\n ","\n \n "])),"containerFloatCss","width","height","opacity","status","progressBarName|component","sideControlBarName|component","nearControlBarName|component")),v()(u()(e),"hideDelayTime",void 0),v()(u()(e),"hideTimeCount",void 0),v()(u()(e),"data",{progressBarName:"progressBar",sideControlBarName:"sideControlBar",nearControlBarName:"nearControlBar",width:"",height:"",opacity:1,containerFloatCss:"",display:"show",status:""}),v()(u()(e),"options",{}),e.options=r,e.hideDelayTime=e.options.player.controlBarAutoHideTime||3,r.player.controlBarAutoHide&&(e.data.containerFloatCss=e.options.cssName.controlContainerFloat,e.resetPosition()),Object.assign(e.data,r.data),e.init(),e}return o()(n,[{key:"initProps",value:function(){this.hideTimeCount=this.hideDelayTime}},{key:"bindEvent",value:function(){var e=this,t=this.options;t.player.controlBarAutoHide&&(t.$container.addEventListener("mousemove",(function(){e.hideTimeCount<=0&&(e.data.display="show",e.show()),e.hideTimeCount=e.hideDelayTime})),setInterval((function(){e.hideTimeCount>0?e.hideTimeCount-=1:"hide"!==e.data.display&&(e.data.display="hide",e.hide())}),100))}},{key:"setSize",value:function(e,t){void 0!==e&&(this.data.width=e),void 0!==t&&(this.data.height=t)}},{key:"show",value:function(){var e,t=this;this.options.player.controlBarAutoHide?(clearTimeout(e),e=setTimeout((function(){t.data.opacity=1}),1)):this.data.opacity=1}},{key:"hide",value:function(){this.data.opacity=0}},{key:"resetPosition",value:function(){this.setSize(this.options.$container.offsetWidth,this.options.player.controlBarHeight)}}]),n}(tn),dn=P.a.get("Delegator.js");function pn(e){return"undefined"!=typeof HTMLElement?e instanceof HTMLElement:"object"===E()(e)&&(1===e.nodeType&&"string"==typeof e.nodeName)}function yn(e){e.preventDefault(),e.stopPropagation()}function vn(e,t,n,r,i){var a=function(e,t){if(e&&e.matches){if(!Array.isArray(t))return e.matches(t);for(var n=0,r=t.length;n3&&void 0!==arguments[3]&&arguments[3];return e.addEventListener(t,n,r),{destroy:function(){e.removeEventListener(t,n)}}}},{key:"removeEventListenerAll",value:function(){var e=this;Object.keys(this.eventsList).forEach((function(t){e.eventsList[t].destroy()}))}},{key:"bindEvent",value:function(){var e=this;this.eventsList.mousedown=this.addEventListener(this.$container,"mousedown",(function(t){e.start(t)}),!1),this.eventsList.mouseup=this.addEventListener(this.$container,"mouseup",(function(t){e.release(t)}),!1),this.eventsList.mousemove=this.addEventListener(this.$container,"mousemove",(function(t){e.drag(t)}),!1)}},{key:"start",value:function(e){e.target===this.$ele&&(void 0===this.scope&&void 0!==this.$container&&(this.scope={left:this.$container.offsetLeft,right:this.$container.offsetLeft+this.$container.offsetWidth,top:this.$container.offsetTop,bottom:this.$container.offsetTop+this.$container.offsetHeight}),this.offsetLeft=this.$ele.offsetLeft,this.offsetTop=this.$ele.offsetTop,this.active=!0,this.initialX=e.clientX,this.initialY=e.clientY,this.orginOffsetLeft=this.$ele.offsetLeft,this.orginOffsetTop=this.$ele.offsetTop,this.orginOffsetWidth=this.$ele.offsetWidth,this.orginOffsetHeight=this.$ele.offsetHeight,"function"==typeof this.onStart&&this.onStart.call(this,this.offsetX,this.offsetY,e,this))}},{key:"release",value:function(e){this.active=!1,"function"==typeof this.onRelease&&this.onRelease.call(this,this.offsetX,this.offsetY,e,this)}},{key:"drag",value:function(e){this.active&&(e.preventDefault(),e.stopPropagation(),this.offsetX=e.clientX-this.initialX+this.offsetLeft,this.offsetY=e.clientY-this.initialY+this.offsetTop,this.setPosition(e))}},{key:"setPosition",value:function(e){switch(this.type){case"vertical":this.offsetX=this.orginOffsetLeft,this.offsetYthis.scope.bottom-this.orginOffsetHeight&&(this.offsetY=this.scope.bottom-this.orginOffsetHeight);break;case"level":this.offsetY=this.orginOffsetTop,this.offsetX>this.scope.right-this.orginOffsetWidth&&(this.offsetX=this.scope.right-this.orginOffsetWidth),this.offsetXthis.scope.right-this.orginOffsetWidth&&(this.offsetX=this.scope.right-this.orginOffsetWidth),isNaN(this.scope.left)||this.offsetXthis.scope.bottom-this.orginOffsetHeight&&(this.offsetY=this.scope.bottom-this.orginOffsetHeight)}this.$ele.style.left=this.offsetX+"px",this.$ele.style.top=this.offsetY+"px","function"==typeof this.onDrag&&this.onDrag.call(this,this.offsetX,this.offsetY,e,this)}},{key:"destroy",value:function(){this.$ele.parentNode.removeChild(this.$ele),this.removeEventListenerAll()}}]),e}(),xn=function(e,t){return new Pn(e,t)};function wn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Bn,Tn=function(e){c()(n,e);var t=wn(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(gn||(gn=rn()(['\n \n
\n
\n
\n
\n \n
\n '])),"progressBarHoverCss","status","progressBarLoadHoverCss","progressBarPlayHoverCss","progressBarDotHoverCss","time")),v()(u()(e),"options",{}),v()(u()(e),"data",{playWidth:"",dot:"",time:"",status:""}),v()(u()(e),"setProgressBarSize",(function(t){e.$progressBarPlay.style.width=t+"px"})),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n,[{key:"watch",value:function(){var e=this.options.cssName;"dragstart"===this.data.status?(this.data.progressBarHoverCss=e.progressBarHover,this.data.progressBarLoadHoverCss=e.progressBarLoadHover,this.data.progressBarPlayHoverCss=e.progressBarPlayHover,this.data.progressBarDotHoverCss=e.progressBarDotHover):"dragend"===this.data.status&&(this.data.progressBarHoverCss="",this.data.progressBarLoadHoverCss="",this.data.progressBarPlayHoverCss="",this.data.progressBarDotHoverCss="")}},{key:"afterInit",value:function(){}},{key:"initProps",value:function(){var e=this.element,t=this.options.cssName;this.$progressDragDot=e.querySelector("."+t.progressBarDot),this.$progressBarPlay=e.querySelector("."+t.progressBarPlay),this.$progressBarLoad=e.querySelector("."+t.progressBarLoad),this.timer=this.getComponent("timer"),this.pauseButton=this.getComponent("pauseButton")}},{key:"bindEvent",value:function(){var e=this,t=this.options.cssName,n=!1;this.events.on(se.PlayerTimeUpdate,(function(t){var r=e.options.dataManage.sourceData.duration;if(!n&&t&&r){var i=t/1e3/r*e.progressBarWidth;e.setProgressPosition(i),e.timer.data.time=an.formatHHMMSS(t/1e3)}})),this.events.on(se.PlayerbufferUpdate,(function(t){!n&&t&&e.updateProgressLoad(t)})),kn(this.options.$controlBarContainer).on("click","."+t.progressBar,(function(n){if(n.target!==e.$progressDragDot){var r=(e.options.dataManage.sourceData.duration||0)/e.progressBarWidth,i=0;n.target.classList.contains(t.progressBarLoad)&&(i=n.target.offsetLeft-n.target.parentNode.offsetLeft);var a=i+n.offsetX,o=a*r*1e3;return e.setProgressPosition(a),e.logger.info("bindEvent","click to seek","seekTime:",o,"offsetX:",a),n.target!==e.$progressBarLoad&&e.clearLoadBar(n.offsetX),e.timer.data.time=an.formatHHMMSS(o/1e3),e.events.emit(se.PlayerOnSeek,o),!1}})),this.progressDragEvent=xn(this.$progressDragDot,{$container:document.body,type:"level",scope:{left:this.progressBarLeft,right:this.progressBarLeft+this.progressBarWidth,top:this.$progressDragDot.offsetTop,bottom:this.$progressDragDot.offsetTop+this.$progressDragDot.offsetHeight},onStart:function(){n=!0,e.data.status="dragstart"},onDrag:function(t){var n;n=e.options.player.controlBarAutoHide?t:t-e.options.$controlBarContainer.offsetLeft;var r=0,i=e.$progressDragDot.offsetWidth;e.progressBarWidth-n<=i&&(r=i),e.setProgressBarSize(n),e.data.status="draging";var a=e.getSeekTime(e.progressBarWidth-r);e.timer.data.time=an.formatHHMMSS(a/1e3),e.data.time=e.timer.data.time},onRelease:function(t,r,i){if(n){var a=e.getSeekTime();i.target!==e.$progressBarLoad&&e.clearLoadBar(t),e.events.emit(se.PlayerOnSeek,a),e.logger.info("bindEvent","onDrag release seek","seekTime:",a),e.data.status="dragend",n=!1}}})}},{key:"setProgressPosition",value:function(e){var t=Math.min(e,this.progressBarWidth),n=this.$progressDragDot,r=this.progressBarWidth,i=0,a=n.offsetWidth/2;t>r||r-t<=a?i=a-(r-t):t<=a&&(i=-(a-t));var o=t-i-n.offsetWidth/2;this.setProgressPlayWidth(t),this.setProgressDragDotLeft(o+this.progressBarLeft)}},{key:"setProgressPlayWidth",value:function(e){this.$progressBarPlay.style.width=e+"px"}},{key:"setProgressDragDotLeft",value:function(e){this.$progressDragDot.style.left=e+"px"}},{key:"getProgressPlayLeftWidth",value:function(){return{offsetLeft:this.$progressBarPlay.offsetLeft,offsetWidth:this.$progressBarPlay.offsetWidth}}},{key:"getProgressLoadLeftWidth",value:function(){return{offsetLeft:this.$progressBarLoad.offsetLeft,offsetWidth:this.$progressBarLoad.offsetWidth}}},{key:"setProgressLoadLeftWidth",value:function(e,t){var n=this.progressBarLeft+this.progressBarWidth;(e=Math.min(e,n))+t>n&&(t=n-e),this.$progressBarLoad.style.left=e+"px",this.$progressBarLoad.style.width=t+"px"}},{key:"updateProgressLoad",value:function(e){var t=this.options.dataManage.sourceData.duration;if(t){var n=this.progressBarWidth,r=this.progressBarLeft,i=e[0]/1e3/t*n,a=e[1]/1e3/t*n,o=Math.floor(r+i),s=Math.floor(a-i);this.setProgressLoadLeftWidth(o,s)}}},{key:"getSeekTime",value:function(e,t){var n=this.progressBarWidth,r=(t=t||this.options.dataManage.sourceData.duration||0)/(e||n);return this.$progressBarPlay.offsetWidth*r*1e3}},{key:"clearLoadBar",value:function(e){e0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(Bn||(Bn=rn()(['\n \n \n \n \n \n \n \n '])),"status","title")),v()(u()(e),"data",{title:"play",play:">"}),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n)}(tn);function Ln(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Cn,An=Ht.create(Sn||(Sn=rn()(['\n\n\n\n\n\n'])),"pauseHide"),Dn=function(e){c()(n,e);var t=Ln(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate((function(e,t){return t(En||(En=rn()(['\n \n ',"\n \n "])),"title","status","icon|html")}))),v()(u()(e),"data",{title:"pause",pauseHide:"",pauseLoadingHide:"none",icon:An,status:"",display:""}),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n,[{key:"watch",value:function(){"pauseloading"===this.data.status?(this.data.pauseHide="none",this.data.pauseLoadingHide="inline-block",this.data.title="loading",this.data.icon='\n\n\n \n \n \n\n\n \n\n\n \n \n \n \n \n \n \n \n\n\n'):"pause"===this.data.status&&(this.data.pauseHide="inline-block",this.data.pauseLoadingHide="none",this.data.title="pause",this.data.icon=An)}}]),n}(tn);function On(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Mn,Un,Nn,In=function(e){c()(n,e);var t=On(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(Cn||(Cn=rn()(['\n \n \n \n \n \n \n \n \n '])),"title","display")),v()(u()(e),"data",{title:"replay",display:"",replay:"->"}),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n)}(tn);function Hn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Fn,jn=Ht.create(Mn||(Mn=rn()(['\n\n\n\n'])),"audioOnHide"),Vn=Ht.create(Un||(Un=rn()(['\n\n\n\n'])),"audioOffHide"),Wn=function(e){c()(n,e);var t=Hn(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(Nn||(Nn=rn()(['\n \n \n ','\n \n  \n  \n \n \n ',"\n \n \n "])),"dataPrecent","volumeBarRodHoverCss","audioOffClass","title","dataMute","dataVolumeSize","dataLastVolume","icon|html")),v()(u()(e),"options",{}),v()(u()(e),"data",{audioONHide:"",audioOffHide:"",audioOffClass:"",dataVolumeSize:"",dataPrecent:"",dataLastVolume:"",dataMute:"",volumeBarRodHoverCss:"",icon:jn,title:"turn off"}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n,[{key:"watch",value:function(){this.data.dataPrecent=Math.floor(100*this.data.dataVolumeSize),""!==this.data.audioOffClass?(this.data.dataMute="true",this.data.audioOffHide="inline-block",this.data.audioOnHide="none",this.data.icon=Vn,this.data.title="turn on"):(this.data.dataMute="",this.data.audioOffHide="none",this.data.audioOnHide="inline-block",this.data.icon=jn,this.data.title="turn off")}},{key:"initProps",value:function(){var e=this.element,t=this.options.cssName;this.INIT_VOLUME_SIZE=void 0===this.options.player.defaultVolumeSize?.5:this.options.player.defaultVolumeSize,this.$volumeBarHandle=e.querySelector("."+t.volumeBarHandle),this.$volumeBarRod=e.querySelector("."+t.volumeBarRod),this.$volumeBarAudio=e.querySelector("."+t.volumeBarAudio),this.$volumeBarSize=e.querySelector("."+t.volumeBarSize),this.$volumeBarColumn=e.querySelector("."+t.volumeBarColumn),this.volumeBarColumnHeight=this.$volumeBarColumn.offsetHeight,this.volumeBarColumnTop=this.$volumeBarColumn.offsetTop,this.volumeBarRodHeight=this.$volumeBarRod.offsetHeight,this.volumeBarRodHeightHalf=this.volumeBarRodHeight/2,this.volumeBarColumnRealTop=this.volumeBarColumnTop+this.volumeBarRodHeightHalf,this.volumeBarColumnMaxHeight=this.volumeBarColumnHeight-this.volumeBarRodHeight}},{key:"bindEvent",value:function(){var e,t=this,n=this.options.$controlBarContainer,r=this.options.cssName;kn(n).on("mouseover","."+r.volumeBar,(function(){clearTimeout(e),t.showVolumeBarHandle()})),kn(n).on("mousewheel","."+r.volumeBarHandle,(function(e){var n=e.wheelDelta/500;n=t.data.dataVolumeSize+n,t.setVolumeSize(n),e.preventDefault(),e.stopPropagation()})),kn(n).on("click",["."+r.volumeBarColumn,"."+r.volumeBarSize],(function(e){var n=0;return e.target===t.$volumeBarColumn?n=(t.$volumeBarColumn.offsetHeight-e.offsetY)/e.target.offsetHeight:e.target===t.$volumeBarSize&&(n=t.$volumeBarColumn.offsetHeight-e.target.offsetHeight+e.offsetY,n=t.$volumeBarColumn.offsetHeight-n,n/=t.$volumeBarColumn.offsetHeight),t.setVolumeSize(n),!1})),kn(n).on("click","."+r.volumeBarAudio,(function(e){return t.$volumeBarAudio.classList.contains(r.volumeBarAudioOff)?t.setAudioOn(e.offsetY):t.setAudioOff(e.offsetY),!1}));kn(n).on("mouseout","."+r.volumeBar,(function(n){e=setTimeout((function(){!function(e){var n=t.element,r={y:n.offsetTop+t.$volumeBarHandle.offsetTop,x:n.offsetLeft};return r.width=n.offsetWidth,r.height=t.$volumeBarHandle.offsetHeight,e.pageX>r.x&&e.pageXr.y&&e.pageY0&&(this.data.dataLastVolume=e),this.$volumeBarSize.style.height=this.volumeBarRodHeight+"px",this.$volumeBarSize.style.marginTop=this.volumeBarColumnRealTop-this.volumeBarRodHeightHalf+this.volumeBarColumnMaxHeight+"px",this.$volumeBarRod.style.top=this.volumeBarColumnRealTop+this.volumeBarColumnMaxHeight-this.volumeBarRodHeightHalf+"px"}},{key:"dragHandle",value:function(e){this.$volumeBarSize.style.marginTop=e+1+"px",this.$volumeBarSize.style.height=this.volumeBarColumnHeight-e+this.volumeBarRodHeight+"px";var t=this.getVolume();t<=0?this.setAudioOff(e):"true"==this.data.dataMute&&this.setAudioOn(e),this.setVolume(t)}},{key:"setVolumeSize",value:function(e){if((e=e.toFixed(2))>=1?e=1:e<.001&&(e=0),e!==this.data.dataVolumeSize){this.setVolume(e);var t=this.volumeBarColumnMaxHeight,n=t-e*t+this.volumeBarColumnTop;this.$volumeBarSize.style.marginTop=n+"px",this.$volumeBarSize.style.height=e*t+this.volumeBarRodHeight+"px",this.$volumeBarRod.style.top=n+"px",e<=0?this.data.audioOffClass=this.options.cssName.volumeBarAudioOff:"true"==this.data.dataMute&&(this.data.audioOffClass="")}}}]),n}(tn);function zn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Xn,Gn=function(e){c()(n,e);var t=zn(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(Fn||(Fn=rn()(['\n \n \n \n \n \n \n \n \n \n ',"\n \n "])),"title","status","speed")),v()(u()(e),"data",{title:"waiting",speed:"",status:"",display:"show"}),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n,[{key:"initProps",value:function(){}},{key:"bindEvent",value:function(){var e=this;this.events.on(se.LoaderUpdateSpeed,(function(t){"show"===e.data.display&&(e.data.speed=on.formatBytes(t.speed)+" /s")}))}},{key:"showWaiting",value:function(){var e=this.options.cssName,t=this.options.$screenContainer;t.querySelector("."+e.waitingBar)||t.prepend(this.element),this.data.display="show",this.show(),this.resetPosition()}},{key:"hideWaiting",value:function(){var e=this.options.cssName;this.options.$screenContainer.querySelector("."+e.waitingBar)&&(this.data.display="hide",this.data.speed="Loading...",this.hide())}}]),n}(tn);function Yn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var $n,qn=function(e){c()(n,e);var t=Yn(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(Xn||(Xn=rn()(['\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n ',"\n \n "])),"title","display","content|trim")),v()(u()(e),"data",{title:"alert",display:"default",content:""}),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n,[{key:"bindEvent",value:function(){var e=this,t=this.options.$screenContainer,n=this.options.cssName;kn(t).on("click","."+n.alertClose,(function(){e.hide()}))}},{key:"afterWatch",value:function(){"show"===this.data.display&&this.resetPosition()}},{key:"showBox",value:function(){var e=this.options.cssName,t=this.options.$screenContainer;t.querySelector("."+e.alertBox)||t.prepend(this.element),this.data.display="show",this.show()}},{key:"hideBox",value:function(){var e=this.options.cssName;this.options.$screenContainer.querySelector("."+e.alertBox)&&(this.data.display="hide",this.hide())}},{key:"show",value:function(){this.element.style.opacity=1,this.element.style.display="inline-block",this.resetPosition()}},{key:"hide",value:function(){this.element.style.opacity=0,this.element.style.display="none"}}]),n}(tn);function Kn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Qn,Zn=function(e){c()(n,e);var t=Kn(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate($n||($n=rn()(['\n \n ','\n ','\n ',"\n \n "])),"time","slash","totalTime")),v()(u()(e),"data",{time:"00:00",totalTime:"",slash:"/"}),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n,[{key:"setTotalTime",value:function(e){var t=e.sourceData;this.data.totalTime=an.formatHHMMSS(t.duration)}},{key:"bindEvent",value:function(){var e=this;this.events.on(se.LoaderPlayListLoaded,(function(t){e.setTotalTime(t.dataManage)}))}},{key:"updateTime",value:function(e){this.element.querySelector('[gid="time"]').innerHTML=e}},{key:"updateTotalTime",value:function(e){this.element.querySelector('[gid="total-time"]').innerHTML=e}}]),n}(tn);function Jn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}function er(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return tr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tr(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function tr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(Qn||(Qn=rn()(['\n \n \n ','\n \n \n ',"\n \n \n "])),"title","speedListHTML|html","currentSpeedName")),v()(u()(e),"data",{title:"speed",currentSpeed:1,speedList:null,currentSpeedName:"倍速",speedListHTML:""}),v()(u()(e),"options",{}),e.options=r,e.speedList=e.options.player.options.speedList||I.c.speedList,e.updateSpeedListHTML(),Object.assign(e.data,r.data),e.init(),e.initProps(),e.showHideBar(),e}return o()(n,[{key:"initProps",value:function(){var e=this.options.cssName;this.$barBox=this.element.querySelector("."+e.speedBarBox)}},{key:"bindEvent",value:function(){var e=this,t=this.options.cssName,n=this.options.$controlBarContainer;kn(n).on("mouseover","."+t.speedBar,(function(){clearTimeout(r),e.showBarBoxHandle()}));var r;kn(n).on("mouseout","."+t.speedBar,(function(t){r=setTimeout((function(){!function(t){var n=e.element,r={y:e.$barBox.offsetTop,x:n.offsetLeft};return r.width=n.offsetWidth,r.height=e.$barBox.offsetHeight,t.pageX>r.x&&t.pageXr.y&&t.pageY"],r=er(e);try{for(r.s();!(t=r.n()).done;){var i=t.value,a="",o="";i.selected&&(a="gp-selected",o=" selected=".concat(i.selected)),n.push('\n
  • ").concat(i.name,"
  • \n "))}}catch(e){r.e(e)}finally{r.f()}return n.push(""),n.join("")}}(r)}}}]),n}(tn);function ir(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var ar,or=function(e){c()(n,e);var t=ir(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(nr||(nr=rn()(['\n \n \n '])))),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n)}(tn);function sr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}function ur(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return lr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lr(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function lr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"rateList",[]),v()(u()(e),"defaultRate",{value:"600",name:"高清"}),v()(u()(e),"template",e.createTemplate(ar||(ar=rn()(['\n \n \n ','\n \n \n ',"\n \n \n "])),"title","rateListHTML|html","currentRateName")),v()(u()(e),"data",{title:"stream rate",currentRate:"600",currentRateName:"高清",rateListHTML:""}),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.rateList=e.options.player.options.rateList||e.rateList,e.defaultRate=e.options.player.options.defaultRate||e.defaultRate,e.setDefaultRate(),e.updateRateListHTML(),e.init(),e.initProps(),e.showHideBar(),e}return o()(n,[{key:"initProps",value:function(){var e=this.options.cssName;this.$barBox=this.element.querySelector("."+e.rateBarBox)}},{key:"setDefaultRate",value:function(){var e=this;if(!(this.rateList.length<=0)){var t=this.rateList.find((function(t){return String(t.value)===String(e.defaultRate.value)}));t?(this.data.currentRateName=t.name,this.data.currentRate=t.value):(this.data.currentRateName=this.rateList[0].name,this.data.currentRate=this.rateList[0].value)}}},{key:"bindEvent",value:function(){var e=this,t=this.options.cssName,n=this.options.$controlBarContainer;kn(n).on("mouseover","."+t.rateBar,(function(){clearTimeout(r),e.showBarBoxHandle()}));var r;kn(n).on("mouseout","."+t.rateBar,(function(t){r=setTimeout((function(){!function(t){var n=e.element,r={y:e.$barBox.offsetTop,x:n.offsetLeft};return r.width=n.offsetWidth,r.height=e.$barBox.offsetHeight,t.pageX>r.x&&t.pageXr.y&&t.pageY"],r=ur(e);try{for(r.s();!(t=r.n()).done;){var i=t.value,a="",o="";i.selected&&(a="gp-selected",o=" selected=".concat(i.selected)),n.push('\n
  • ").concat(i.name,"
  • \n "))}}catch(e){r.e(e)}finally{r.f()}return n.push(""),n.join("")}}(r)}}}]),n}(tn);function hr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var dr,pr,yr,vr=function(e){c()(n,e);var t=hr(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(cr||(cr=rn()(['\n \n \n '])))),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n)}(tn);function gr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var mr,br=Ht.create(dr||(dr=rn()(['\n\n \n\n'])),"fullpageHide"),kr=Ht.create(pr||(pr=rn()(['\n\n\n\n'])),"fullpageExitHide"),Pr=function(e){c()(n,e);var t=gr(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"containerOriginStyle",""),v()(u()(e),"template",e.createTemplate(yr||(yr=rn()(['\n \n ',"\n \n "])),"title","status","icon|html")),v()(u()(e),"data",{fullpageHide:"",fullpageExitHide:"none",status:"",icon:br,title:"fullpage"}),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n,[{key:"watch",value:function(){"fullpage"===this.data.status?(this.data.fullpageHide="none",this.data.fullpageExitHide="inline-block",this.data.title="exit fullspage",this.data.icon=kr):(this.data.fullpageHide="inline-block",this.data.fullpageExitHide="none",this.data.title="fullpage",this.data.icon=br)}},{key:"initProps",value:function(){var e=this.options;this.$container=this.options.$container,this.$screenContainer=e.$screenContainer,this.$controlBarContainer=this.getComponent("controlBarContainer").element,this.originWidth=e.$container.offsetWidth,this.originHeight=e.$container.offsetHeight,this.containerOriginStyle=e.$container.getAttribute("style"),this.screenContainerOrginStyle=this.$screenContainer.getAttribute("style"),this.controlContainerOrginWidth=this.$controlBarContainer.style.width}},{key:"bindEvent",value:function(){var e=this,t=this.options.cssName,n=document,r=window;kn(this.$controlBarContainer).on("click","."+t.fullPage,(function(){var t=e.data.status;"fullscreen"===e.getComponent("fullScreen").data.status&&Q.exitFullscreen(),"fullpage"===t?e.exitFullPage():e.fullPage()})),this.eventsList.esckeyup=this.addEventListener(n,"keyup",(function(t){27===t.keyCode&&"fullpage"===e.data.status&&e.exitFullPage()})),this.eventsList.windowresize=this.addEventListener(r,"resize",(function(){if("fullpage"===e.data.status){var t=Q.getInnerWidthHeight();e.resizeTo(t.width,t.height),e.resetPosition()}}))}},{key:"fullPage",value:function(){this.data.status="fullpage";var e=this.options,t=this.options.cssName,n=Q.getInnerWidthHeight();this.saveOriginPosition(),e.$container.classList.add(t.containerFullPage),this.resizeTo(n.width,n.height),this.resetPosition(),scrollTo(0,0)}},{key:"saveOriginPosition",value:function(){var e=this.getComponent("progressBar");this.posterOriginStyle=this.getComponent("poster").element.getAttribute("style"),this.originScroll={scrollX:scrollX,scrollY:scrollY},this.progressBarOriginLeft=e.progressBarLeft,this.progressBarOriginWidth=e.progressBarWidth,this.progressBarPlayWidthRate=e.getProgressPlayLeftWidth().offsetWidth/this.progressBarOriginWidth,this.progressBarLoadWidthRate=e.getProgressLoadLeftWidth().offsetWidth/this.progressBarOriginWidth,this.progressBarLoadLeftRate=(e.getProgressLoadLeftWidth().offsetLeft-this.progressBarOriginLeft)/this.progressBarOriginWidth}},{key:"setProgressBarPosition",value:function(){var e=this.getComponent("progressBar"),t=e.progressBarWidth,n=e.progressBarLeft,r=t*this.progressBarPlayWidthRate,i=t*this.progressBarLoadWidthRate,a=t*this.progressBarLoadLeftRate;e.setProgressPosition(r),e.setProgressLoadLeftWidth(a+n,i),this.getComponent("progressBar").clearDragDotTop()}},{key:"resizeTo",value:function(e,t){var n=this.options,r=n.player,i=r.controlBarAutoHide?t:t-r.controlBarHeight;r.$screenContainer.style.width=e+"px",r.$screenContainer.style.height=i+"px",n.$container.style.width=e+"px",n.$container.style.height=t+"px"}},{key:"resetPosition",value:function(){var e=this.options;this.setProgressBarPosition(),e.player.resizeScreen(),this.getComponent("bigPlayButton").resetPosition(),this.getComponent("poster").resetPosition(),this.getComponent("waitingBar").resetPosition(),this.getComponent("controlBarContainer").resetPosition()}},{key:"exitFullPage",value:function(){this.data.status="exitfullpage";var e=this.options.cssName;this.saveOriginPosition(),this.$container.classList.remove(e.containerFullPage),this.resetScreen()}},{key:"resetScreen",value:function(){this.$container.setAttribute("style",this.containerOriginStyle),this.$screenContainer.setAttribute("style",this.screenContainerOrginStyle),this.$controlBarContainer.style.width=this.controlContainerOrginWidth,this.getComponent("poster").element.setAttribute("style",this.posterOriginStyle),scrollTo(this.originScroll.scrollX,this.originScroll.scrollY),this.resetPosition()}}]),n}(tn);function xr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var wr,Br,Tr='\n\n\n\n',_r=function(e){c()(n,e);var t=xr(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(mr||(mr=rn()(['\n \n ',"\n \n "])),"title","status","icon|html")),v()(u()(e),"data",{fullscreenHide:"inline-block",fullscreenExitHide:"none",status:"",icon:Tr,title:"fullscreen"}),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n,[{key:"watch",value:function(){"fullscreen"===this.data.status?(this.data.fullscreenHide="none",this.data.fullscreenExitHide="inline-block",this.data.title="exit fullscreen",this.data.icon='\n\n\n\n'):(this.data.fullscreenHide="inline-block",this.data.fullscreenExitHide="none",this.data.title="fullscreen",this.data.icon=Tr)}},{key:"initProps",value:function(){this.getComponent("fullPage").initProps.call(this)}},{key:"bindEvent",value:function(){var e=this,t=this.options.$container,n=this.options.cssName,r=document,i=window;this.eventsList.fullscreenchange=this.addEventListener(r,"fullscreenchange",(function(){if(document.fullscreenElement||document.webkitFullscreenElement)e.fullScreen();else{var r=e.getComponent("fullPage");"fullpage"===r.data.status?(t.classList.remove(n.containerFullScreen),e.data.status="exitfullscreen",r.fullPage()):e.exitFullScreen()}})),this.eventsList.windowresize=this.addEventListener(i,"resize",(function(){document.fullscreenElement&&(e.resizeTo(screen.width,screen.height-(window.outerHeight-window.innerHeight)),e.resetPosition())})),kn(this.$controlBarContainer).on("click","."+n.fullScreen,(function(){var t=e.data.status;e.saveOriginPosition(),"fullscreen"===t?Q.exitFullscreen():Q.Fullscreen()}))}},{key:"fullScreen",value:function(){this.data.status="fullscreen";var e=this.options,t=this.options.cssName,n={width:screen.width,height:screen.height-(outerHeight-innerHeight)};Q.isSafari()&&(n.height=n.height+38),e.$container.classList.add(t.containerFullScreen),this.resizeTo(n.width,n.height),this.resetPosition(),scrollTo(0,0)}},{key:"saveOriginPosition",value:function(){this.getComponent("fullPage").saveOriginPosition.call(this)}},{key:"resizeTo",value:function(e,t){this.getComponent("fullPage").resizeTo.call(this,e,t)}},{key:"resetPosition",value:function(){this.getComponent("fullPage").resetPosition.call(this)}},{key:"setProgressBarPosition",value:function(){this.getComponent("fullPage").setProgressBarPosition.call(this)}},{key:"exitFullScreen",value:function(){this.data.status="exitfullscreen";var e=this.options.cssName;this.saveOriginPosition(),this.options.$container.classList.remove(e.containerFullScreen),this.resetScreen(),this.saveOriginPosition()}},{key:"resetScreen",value:function(){this.getComponent("fullPage").resetScreen.call(this)}}]),n}(tn);function Sr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Er=Ht.create(wr||(wr=rn()(['\n\n\n\n\n'])),"width","height","iconStyle","fillColor"),Rr=function(e){c()(n,e);var t=Sr(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"template",e.createTemplate(Br||(Br=rn()(['\n \n ',"\n \n "])),"title","status","icon|html")),v()(u()(e),"data",{titie:"click to play",iconStyle:"opacity:0.5",display:"hide",status:"",width:100,height:100,fillColor:"#999",icon:Er}),v()(u()(e),"options",{}),e.options=r,Object.assign(e.data,r.data),e.init(),e}return o()(n,[{key:"watch",value:function(){if("show"===this.data.display){var e=(this.element.parentNode.offsetHeight-this.data.height)/2;this.data.iconStyle="opacity:0.7;margin-top:".concat(e,"px")}}},{key:"resetPosition",value:function(){if("show"===this.data.display){var e=this.element.parentNode,t=e.offsetWidth,n=e.offsetHeight;!0===this.options.player.controlBarAutoHide&&(n-=this.options.player.controlBarHeight);var r=e.offsetTop,i=e.offsetLeft;this.element.style.width=t+"px",this.element.style.height=n+"px",this.element.style.top=r+"px",this.element.style.left=i+"px"}}},{key:"bindEvent",value:function(){var e=this,t=this.options.$screenContainer,n=this.options.cssName;kn(t).on("click","."+n.bigPlayButton,(function(){e.events.emit(se.PlayerOnPlay,e),e.events.emit(se.ControlBarPlay,e),e.hide()})),kn(t).on("mouseover","."+n.bigPlayButton,(function(){e.data.fillColor=e.options.bigPlayButtonColor||"#fff"})),kn(t).on("mouseout","."+n.bigPlayButton,(function(t){var n=e.element,r={y:n.offsetTop,x:n.offsetLeft};r.width=n.offsetWidth,r.height=n.offsetHeight,t.pageX>r.x&&t.pageXr.y&&t.pageY0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),(e=t.call(this,r)).options=Object.assign(e.options,r),e.componentsController=e.options.componentsController,e.init(),e}return o()(n,[{key:"render",value:function(){var e=this,t=L.createEl("gp-button-block");t.classList.add("goldplay__control--button-block"),n.componentList.forEach((function(n){var r=e.componentsController.getComponent(n);t.appendChild(r.element)})),this.element=t}}],[{key:"addCustomControl",value:function(e){n.componentList.push(e)}}]),n}(tn);v()(Cr,"componentList",["playButton","pauseButton","replayButton"]);var Ar=Cr;function Dr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Or=function(e){c()(n,e);var t=Dr(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),(e=t.call(this,r)).options=Object.assign(e.options,r),e.componentsController=e.options.componentsController,e.init(),e}return o()(n,[{key:"render",value:function(){var e=this,t=L.createEl("gp-control-sidebar");t.classList.add("goldplay__control--sidebar"),n.componentList.forEach((function(n){var r=e.componentsController.getComponent(n);t.appendChild(r.element)})),this.element=t}}],[{key:"addCustomControl",value:function(e,t){(t<0||t>n.componentList.length)&&(t=n.componentList.length),n.componentList.splice(t,0,e)}}]),n}(tn);v()(Or,"componentList",["speedBar","rateBar","volumeBar","fullPage","fullScreen"]);var Mr=Or;function Ur(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Nr=function(e){c()(n,e);var t=Ur(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),(e=t.call(this,r)).options=Object.assign(e.options,r),e.componentsController=e.options.componentsController,e.init(),e}return o()(n,[{key:"render",value:function(){var e=this,t=L.createEl("gp-control-nearside");t.classList.add("goldplay__control--button-block"),n.componentList.forEach((function(n){var r=e.componentsController.getComponent(n);t.appendChild(r.element)})),this.element=t}}],[{key:"addCustomControl",value:function(e,t){(t<0||t>n.componentList.length)&&(t=n.componentList.length),n.componentList.splice(t,0,e)}}]),n}(tn);v()(Nr,"componentList",["playControl","timer"]);var Ir=Nr,Hr={BaseComponent:tn,controlBarContainer:hn,bigPlayButton:Rr,poster:cn,progressBar:Tn,playButton:Rn,pauseButton:Dn,replayButton:In,volumeBar:Wn,waitingBar:Gn,alertBox:qn,timer:Zn,speedBar:rr,subtitle:or,rateBar:fr,settingBar:vr,fullPage:Pr,fullScreen:_r,playControl:Ar,sideControlBar:Mr,nearControlBar:Ir};function Fr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var jr=At,Vr=function(e){return e.substr(0,1).toUpperCase()+e.substr(1)},Wr=function(e){c()(n,e);var t=Fr(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"allComponents",{}),v()(u()(e),"controlBarController",null),v()(u()(e),"options",{cssName:jr}),e.options=Object.assign(e.options,r),e.options.componentsController=u()(e),e.initComponents(),e.$container=e.options.$container,e.$screenContainer=e.options.$screenContainer,e.$canvas=e.options.$canvas,e.$audioContainer=e.options.$audioContainer,e.$audio=e.options.$audio,e.options.$controlBarContainer=e.controlBarContainer.element,e.bindEvent(),e}return o()(n,[{key:"run",value:function(){for(var e in this.controlBarController.run(),Hr)this[e]&&"function"==typeof this[e].registerMethod&&this[e].registerMethod()}},{key:"initComponents",value:function(){for(var e in Hr){var t=Hr[e];this.allComponents[e]||this.createComponent(t,e)}}},{key:"bindEvent",value:function(){var e=this;this.events.on(se.PlayerLoadedMetaData,(function(){e.poster.hide()})),this.events.on(se.AudioPlayerPlayFail,(function(){e.drawBigPlayButton(),e.getComponent("poster").hide(),e.events.emit(se.PlayerOnPause,e),e.events.emit(se.ControlBarPause,e)})),this.bindAlertBoxEvent(),this.bindWaitingBarEvent()}},{key:"bindWaitingBarEvent",value:function(){this.waitingBar.initProps(),this.waitingBar.bindEvent()}},{key:"drawBigPlayButton",value:function(){this.$screenContainer.prepend(this.bigPlayButton.element),this.bigPlayButton.show(),this.bigPlayButton.bindEvent(),this.bigPlayButton.resetPosition()}},{key:"setControlBarController",value:function(e){this.controlBarController=e}},{key:"getControlBarController",value:function(){return this.controlBarController||this.options.player.controlBarContainer}},{key:"bindAlertBoxEvent",value:function(){this.alertBox.initProps(),this.alertBox.bindEvent()}},{key:"drawPoster",value:function(){this.$screenContainer.prepend(this.poster.element),this.poster.data.display="show",this.poster.bindEvent(),this.poster.resetPosition()}},{key:"createComponent",value:function(e,t){var n=Vr(t);this["set"+n](new e(this.options)),this[t]=this["get"+n](),this.allComponents[t]||(this.allComponents[t]=this[t])}},{key:"getComponent",value:function(e){return this.allComponents[e]||Hr[e]&&this.createComponent(Hr[e],e),this.allComponents[e]}},{key:"resetAllComponents",value:function(){var e=this,t=Object.getOwnPropertyNames(this),n={};t.forEach((function(t){Hr[t]&&(n[t]=e[t])})),this.allComponents=n}},{key:"getAllComponents",value:function(){return this.allComponents}}]),n}(D);for(var zr in Wr.addComponet=function(e){var t=Vr(e);Wr.prototype["set"+t]=function(t){this[e]=t},Wr.prototype["get"+t]=function(){return this[e]}},Hr)Wr.addComponet(zr);var Xr=Wr;function Gr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Yr=At,$r=function(e){c()(n,e);var t=Gr(n);function n(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i()(this,n),e=t.call(this,r),v()(u()(e),"player",null),v()(u()(e),"dataManage",null),v()(u()(e),"options",{cssName:Yr}),e.options=Object.assign(e.options,r),e.player=e.options.player,e.dataManage=e.player.dataManage,e.componentsController=e.player.componentsController,e.$screenContainer=e.player.$screenContainer,e.initComponents(),e}return o()(n,[{key:"initComponents",value:function(){var e=this.componentsController;Object.assign(this,e.getAllComponents()),this.container=this.controlBarContainer}},{key:"run",value:function(){this.timer.setTotalTime(this.dataManage),this.drawLayout(),this.bindEvent(),this.player.autoPlay?this.events.emit(se.ControlBarPlay):this.events.emit(se.ControlBarPause)}},{key:"bindEvent",value:function(){this.bindContainerEvent(),this.bindTimerEvent(),this.bindPlayEvent(),this.bindProgressEvent(),this.bindSpeedEvent(),this.bindRateEvent(),this.bindVolumeEvent(),this.bindFullPage(),this.bindFullScreen()}},{key:"bindContainerEvent",value:function(){this.container.initProps(),this.container.bindEvent()}},{key:"bindTimerEvent",value:function(){this.timer.initProps(),this.timer.bindEvent()}},{key:"bindSpeedEvent",value:function(){this.speedBar.bindEvent(),this.speedBar.resetBoxPosition()}},{key:"bindRateEvent",value:function(){this.rateBar.bindEvent(),this.rateBar.resetBoxPosition()}},{key:"bindFullPage",value:function(){this.fullPage.initProps(),this.fullPage.bindEvent()}},{key:"bindFullScreen",value:function(){this.fullScreen.initProps(),this.fullScreen.bindEvent()}},{key:"bindPlayEvent",value:function(){var e=this;this.events.on(se.ControlBarPlay,(function(){"pause"!==e.pauseButton.data.status&&(e.pauseButton.data.status="pause"),e.replayButton.hide(),e.playButton.hide(),e.pauseButton.show(),e.bigPlayButton.hide()})),this.events.on(se.ControlBarPause,(function(){"pause"!==e.player.status&&(e.pauseButton.data.status="pause"),e.playButton.show(),e.pauseButton.hide()})),this.events.on(se.PlayerEnd,(function(){e.replayButton.show(),e.pauseButton.hide(),e.playButton.hide()})),[se.PlayerWait,se.PlayerSeeking,se.PlayerReset,se.PlayerChangeRate,se.PlayerChangeSrc].forEach((function(t){e.events.on(t,(function(){e.waitingBar.showWaiting()}))})),this.events.on(se.PlayerSeekEnd,(function(){e.waitingBar.hideWaiting()})),this.events.on(se.PlayerPlay,(function(){e.waitingBar.hideWaiting(),e.events.emit(se.ControlBarPlay,e)})),this.events.on(se.PlayerPause,(function(){e.events.emit(se.ControlBarPause,e)})),this.events.on(se.PlayerPlaying,(function(){e.waitingBar.hideWaiting()})),this.events.on(se.PlayerOnSeek,(function(t){t<1e3*e.dataManage.sourceData.duration&&e.events.emit(se.ControlBarPauseLoading)})),this.events.on(se.ControlBarPauseLoading,(function(){"pauseloading"!==e.pauseButton.data.status&&(e.pauseButton.data.status="pauseloading"),e.replayButton.hide(),e.playButton.hide(),e.pauseButton.show()})),kn(this.options.$container).on("click","."+Yr.playButton,(function(){"play"!==e.player.status&&e.events.emit(se.PlayerOnPlay,e)})),kn(this.options.$container).on("click","."+Yr.pauseButton,(function(){"pause"!==e.player.status&&e.events.emit(se.PlayerOnPause,e)})),kn(this.options.$container).on("click","."+Yr.replayButton,(function(){e.events.emit(se.PlayerOnSeek,e.player.startTime)}))}},{key:"bindProgressEvent",value:function(){this.progressBar.initProps(),this.progressBar.bindEvent()}},{key:"bindVolumeEvent",value:function(){this.volumeBar.initProps(),this.volumeBar.initVolumeSize(),this.volumeBar.bindEvent()}},{key:"drawLayout",value:function(){var e=this.options.$container,t=this.container.element;e.append(t)}},{key:"destroy",value:function(){this.removeEventListenerGlobal(),this.container.destroy()}},{key:"removeEventListenerGlobal",value:function(){this.progressBar.progressDragEvent&&this.progressBar.progressDragEvent.removeEventListenerAll(),this.volumeBar.volumeDragEvent&&this.volumeBar.volumeDragEvent.removeEventListenerAll(),this.fullPage.removeEventListenerAll(),this.fullScreen.removeEventListenerAll()}}]),n}(D),qr=n(45),Kr=n.n(qr);function Qr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var Zr=function(e){c()(n,e);var t=Qr(n);function n(e){var r;return i()(this,n),r=t.call(this,e),v()(u()(r),"isLast",!1),r.type=e.type,r.libPath=e.libPath,r.player=e.player,r.init(),r}return o()(n,[{key:"init",value:function(){"ts"==this.type&&this.initNornalWorker(),this.bindEvent(),this.loadjs()}},{key:"initNornalWorker",value:function(){this.processor=this.initWorker()}},{key:"initWorker",value:function(){var e=this,t=Kr()(132);return t.onmessage=function(t){var n=t.data,r=n.type,i=n.data;switch(r){case"dataProcessorReady":e.onDataProcessorReady();break;case"decoded":e.onDecoded(i);break;case"demuxedAAC":e.onDemuxedAAC(i);break;case"partEnd":e.onPartEnd(i);break;case"resetEnd":e.onResetEnd();break;case"maxPTS":e.onMaxPTS(i);break;case"flushEnd":e.onFlushEnd(i)}},t}},{key:"bindEvent",value:function(){var e=this;this.events.on(se.DemuxStartDemux,this.onStartDemux.bind(this)),this.events.on(se.DemuxLast,(function(){e.isLast=!0})),this.events.on(se.DecodeFlush,(function(){e.flush()}))}},{key:"flush",value:function(){this.processor.postMessage({type:"flush"})}},{key:"loadjs",value:function(){this.processor.postMessage({type:"loadwasm",libPath:this.libPath})}},{key:"reset",value:function(){this.isLast=!1,this.processor.terminate(),this.initNornalWorker(),this.loadjs()}},{key:"onFlushEnd",value:function(e){this.events.emit(se.DecodeFlushEnd,e)}},{key:"onMaxPTS",value:function(e){this.events.emit(se.PlayerMaxPTS,e.maxAudioPTS,e.maxVideoPTS)}},{key:"onDemuxedAAC",value:function(e){this.events.emit(se.DemuxAAC,e)}},{key:"onDataProcessorReady",value:function(){this.player.seeking||this.player.reseting?this.events.emit(se.ProcessorResetEnd):this.events.emit(se.DataProcessorReady)}},{key:"onStartDemux",value:function(e){this.player.reseting||(this.logger.info("onStartDemux","postMessage to demux"),e&&e.arrayBuffer?this.processor.postMessage({type:"startDemux",data:e.arrayBuffer,isLast:this.isLast},[e.arrayBuffer.buffer]):this.logger.error("onStartDemux","data is null","data:",e))}},{key:"onDecoded",value:function(e){this.player.reseting||this.events.emit(se.DecodeDecoded,e)}},{key:"onPartEnd",value:function(e){this.events.emit(se.DecodeApppendEnd,e)}},{key:"onResetEnd",value:function(){this.events.emit(se.ProcessorResetEnd)}},{key:"destroy",value:function(){this.processor&&this.processor.terminate()}}]),n}(N);function Jr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var ei=function(e){c()(n,e);var t=Jr(n);function n(e){var r;return i()(this,n),r=t.call(this,e),v()(u()(r),"currentIndex",null),v()(u()(r),"retryTime",0),v()(u()(r),"dataReady",{audioReady:!1,imageReady:!1}),v()(u()(r),"hasInit",!1),v()(u()(r),"dataManageStatus","loading"),v()(u()(r),"duration",0),v()(u()(r),"tsNumber",0),r.dataManage=e.dataManage,r.imagePlayer=e.imagePlayer,r.audioPlayer=e.audioPlayer,r.player=e.player,r.bindEvent(),r}return o()(n,[{key:"bindEvent",value:function(){var e=this;this.events.on(se.DataManageRead,(function(t){e.onRead(t)})),this.events.on(se.DemuxVideo,(function(t,n){e.onVideoDemuxed(t,n)})),this.events.on(se.DemuxAAC,(function(t){e.onAACDemuxed(t)})),this.events.on(se.DecodeDecoded,(function(t){e.onDecoded(t)})),this.events.on(se.DecodeApppendEnd,(function(t){e.onAppendEnd(t)})),this.events.on(se.ImagePlayerReady,(function(){e.logger.info("bindevent","Events.ImagePlayerReady"),e.checkDataReady("imageReady")})),this.events.on(se.AudioPlayerDataReady,(function(){e.logger.info("bindevent","Events.AudioPlayerDataReady"),e.player.receiveAACTime=null,e.checkDataReady("audioReady")})),this.events.on(se.AudioPlayerWait,(function(){e.dataReady.audioReady=!1,e.events.emit(se.PlayerWait,"audioPlayer")})),this.events.on(se.ImagePlayerWait,(function(){e.dataReady.imageReady=!1,e.events.emit(se.PlayerWait,"imagePlayer")})),this.events.on(se.ImagePlayerEnd,(function(){e.logger.info("bindevent","........imageplayer end"),e.events.emit(se.PlayerEnd)})),this.events.on(se.PlayerWait,(function(){e.logger.warn("player status wait"),e.player.status="wait","loadend"===e.dataManageStatus&&(e.dataManageStatus="loading",e.loadNext())})),this.events.on(se.PlayerLoadNext,(function(){"loadend"===e.dataManageStatus&&(e.dataManageStatus="loading",e.loadNext())})),this.events.on(se.DecodeFlushEnd,(function(t){e.logger.info("flushend>>>>>>>>>>>>>>>",t),e.imagePlayer.maxPTS=t}))}},{key:"checkDataReady",value:function(e){var t=this.dataReady;t[e]=!0;for(var n=Object.keys(t),r=0,i=0;i=this.tsNumber?this.logger.info("loadNext","load end","currentIndex",this.currentIndex,"tsNumber:",this.tsNumber):(this.currentIndex+=1,this.player.currentIndex=this.currentIndex,this.logger.info("loadNext","load next ts","tsno:",this.currentIndex),this.events.emit(se.DataManageReadBufferByNo,this.currentIndex)))}},{key:"onDecoded",value:function(e){var t=this;e.forEach((function(e){t.player.reseting||e.pts>=t.player.currentTime&&t.imagePlayer.push(e)}))}},{key:"onAppendEnd",value:function(e){return e?(this.logger.info("onAppendEnd","events.decodeFlush",e),void this.events.emit(se.DecodeFlush)):(this.logger.info("onAppendEnd","start load next ts condition",this.checkBuffer(),this.currentIndex),this.checkBuffer()&&null!==this.currentIndex?(this.logger.info("onAppendEnd","load next ts. currentIndex:",this.currentIndex),void this.loadNext()):(this.dataManageStatus="loadend",void this.logger.info("onAppendEnd","load ts stop")))}},{key:"onAACDemuxed",value:function(e){var t=this;this.player.reseting||(e.length||this.audioPlayer.send({}),e.forEach((function(e){(e.PTS>=t.player.currentTime||e.audioEnd)&&(!t.player.receiveAACTime&&t.player.seeking&&(t.player.receiveAACTime=Date.now()),t.audioPlayer.send(e))})))}},{key:"onVideoDemuxed",value:function(e){this.player.reseting||this.events.emit(se.DecodeStartDecode,e)}},{key:"checkBuffer",value:function(){var e=this.player,t=e.currentTime;return!((e.buffer()[1]||0)-t>=e.maxBufferLength)}},{key:"onRead",value:function(e){this.player.reseting?console.error("onRead reseting"):e&&e.arrayBuffer&&e.no===this.currentIndex?(this.retryTime=0,this.logger.warn("onRead","get stream data"),e.no===this.tsNumber&&(this.logger.info("onRead","the last ts"),this.events.emit(se.DemuxLast)),this.events.emit(se.DemuxStartDemux,e)):this.logger.error("onRead","load ts failred","tsno:",this.currentIndex)}}]),n}(N);function ti(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var ni=function(e){c()(n,e);var t=ti(n);function n(e){var r;return i()(this,n),r=t.call(this,e),v()(u()(r),"maxBufferLength",0),v()(u()(r),"duration",0),v()(u()(r),"pool",[]),v()(u()(r),"start",0),v()(u()(r),"end",0),v()(u()(r),"offset",0),v()(u()(r),"fps",25),r.maxBufferLength=e.maxBufferLength,r}return o()(n,[{key:"push",value:function(e){var t=this.pool,n=t.length;0===n&&(this.offset=e.pts,this.start=e.pts,this.fps=e.fps);var r=this.insertSort(t,e);t[r-1]&&(t[r-1].duration=t[r].pts-t[r-1].pts),t[r+1]&&(t[r].duration=t[r+1].pts-t[r].pts),this.end=this.pool[n].pts+this.pool[n].duration,this.duration=this.end-this.start}},{key:"insertSort",value:function(e,t){var n=e.length;if(0===n)return e.push(t),0;for(var r=0;rr;)e[i]=e[i-1],i--;return e[r]=t,r}return e.push(t),e.length-1}},{key:"reset",value:function(){this.duration=0,this.pool=[],this.start=0,this.end=0,this.offset=0}},{key:"findByIndex",value:function(e){var t=this.buffer.length;return e=n&&e=this.start&&ethis.maxBufferLength){if(e>this.start){var t=this.findIndex(e),n=this.pool.splice(0,t);n.forEach((function(e){null})),n=null,this.start=this.pool[0].pts,this.duration=this.end-this.start}return!1}return this.events.emit(se.PlayerLoadNext),!0}},{key:"buffer",value:function(){return{start:this.start,end:this.end}}}]),n}(N),ri=n(74),ii=n.n(ri),ai=n(61),oi=n.n(ai);function si(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var ui=function(e){c()(n,e);var t=si(n);function n(e){var r;return i()(this,n),r=t.call(this),v()(u()(r),"canvas",null),r.setCanvas(e.canvas),r.setRender(),r}return o()(n,[{key:"setCanvas",value:function(e){this.canvas=e}},{key:"setRender",value:function(e){this.render=ii.a.attach(e||this.canvas)}},{key:"clear",value:function(){this.render.clear()}},{key:"drawFrame",value:function(e){var t,n,r,i,a,o=Date.now(),s=e.buf_y,u=e.buf_u,l=e.buf_v,c=e.width,f=e.height,h=c/2,d=f/2;t={bytes:s,stride:e.stride_y},n={bytes:u,stride:e.stride_u},r={bytes:l,stride:e.stride_v},i=oi.a.format({width:c,height:f,chromaWidth:h,chromaHeight:d}),a=oi.a.frame(i,t,n,r),this.render.drawFrame(a);var p=Date.now();p-o>10&&this.logger.warn("drawFrame","reandertime:",p-o)}}]),n}(N);function li(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var ci=function(e){c()(n,e);var t=li(n);function n(e){var r;return i()(this,n),r=t.call(this,e),v()(u()(r),"status","pause"),v()(u()(r),"_currentTime",0),v()(u()(r),"maxPTS",null),v()(u()(r),"ready",!1),v()(u()(r),"firstRender",!1),r.imageData=new ni({events:e.events,maxBufferLength:e.maxBufferLength}),r.screen=new ui({canvas:e.canvas}),r.playHandler=null,r.player=e.player,r.debug=e.debug||!1,r}return o()(n,[{key:"setScreenRender",value:function(e){this.screen.setCanvas(e),this.screen.setRender(e)}},{key:"clear",value:function(){this.screen.clear()}},{key:"play",value:function(e){"play"!==this.status&&(this.status="play",this.render(e))}},{key:"pause",value:function(){"pause"!==this.status&&(this.status="pause",clearTimeout(this.playHandler),this.playHandler=null)}},{key:"checkBuffer",value:function(){return this.imageData.checkBuffer(this.currentTime)}},{key:"push",value:function(e){this.player.reseting||(this.imageData.push(e),this.end-this.player.currentTime>I.d.READYBUFFERLENGTH&&!this.ready&&(this.ready=!0,this.status="ready",this.events.emit(se.ImagePlayerReady)),this.events.emit(se.ImagePlayerBuffeUpdate))}},{key:"find",value:function(e){return this.imageData.find(e)}},{key:"buffer",value:function(){return this.imageData.buffer()}},{key:"isBuffered",value:function(e){return this.imageData.isBuffered(e)}},{key:"render",value:function(e){if(!(e=this.maxPTS+this.fragDuration?(this.status="end",void this.events.emit(se.ImagePlayerEnd,this.maxPTS)):(this.logger.warn("Events.ImagePlayerWait",e,this.start,this.end,this.maxPTS),this.logger.warn("render","not yuv data"),this.status="wait",this.ready=!1,this.events.emit(se.ImagePlayerWait,"image","this"),!1)}}},{key:"reset",value:function(){this.status="pause",this.ready=!1,this.imageData.reset(),this.maxPTS=null,this.currentTime=0}},{key:"currentTime",get:function(){return this._currentTime},set:function(e){this._currentTime=e}},{key:"offset",get:function(){return this.imageData.offset}},{key:"fragDuration",get:function(){return Math.ceil(1e3/this.imageData.fps)}},{key:"start",get:function(){return this.imageData.start}},{key:"end",get:function(){return this.imageData.end}},{key:"duration",get:function(){return this.imageData.duration}}]),n}(N);function fi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}function hi(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}var di=new WeakMap,pi=new WeakMap,yi=new WeakMap,vi=new WeakMap,gi=new WeakMap;function mi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var i=p()(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h()(this,n)}}var bi=function(e){c()(n,e);var t=mi(n);function n(e,r){var a;return i()(this,n),a=t.call(this,e,r),v()(u()(a),"libPath",null),a.options.processURL=r.processURL,a.libPath=r.libPath,a.poster=r.poster,!1!==a.options.needInit&&a.init(),a}return o()(n,null,[{key:"getComponent",value:function(e){return Hr[e]}},{key:"registerComponent",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"right",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1;if("string"!=typeof e||!e)throw new Error('Illegal component name, "'.concat(e,'"; must be a non-empty string.'));var i=Object.prototype.isPrototypeOf.call(tn,t.prototype);if(!i)throw new Error('Illegal component, "'.concat(e,'"; must be a BaseComponent subclass.'));Hr[e]=t,Xr.addComponet(e),"left"===n?Ir.addCustomControl(e,r):Mr.addCustomControl(e,r)}}]),n}(function(e){c()(n,e);var t=fi(n);function n(e){var r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return i()(this,n),r=t.call(this),v()(u()(r),"mode",I.c.mode),v()(u()(r),"$container",null),v()(u()(r),"componentsController",null),v()(u()(r),"controlBarController",null),v()(u()(r),"controlBarHeight",50),v()(u()(r),"alertError",null),v()(u()(r),"dataController",null),v()(u()(r),"demuxer",null),v()(u()(r),"decoder",null),v()(u()(r),"preload",!0),v()(u()(r),"startTime",0),v()(u()(r),"screenWidth",null),v()(u()(r),"screenHeight",null),v()(u()(r),"options",{}),hi(u()(r),di,{writable:!0,value:I.c.libPath}),v()(u()(r),"readyStatus",{dataProcessor:!1,firstData:!1,audioPlayer:!1}),v()(u()(r),"reseting",!1),hi(u()(r),pi,{writable:!0,value:0}),hi(u()(r),yi,{writable:!0,value:!1}),hi(u()(r),vi,{writable:!0,value:1}),hi(u()(r),gi,{writable:!0,value:!1}),v()(u()(r),"maxBufferLength",I.d.MAXBUFFERLENGTH),v()(u()(r),"seekSegmentNo",-1),v()(u()(r),"status","init"),v()(u()(r),"loader",null),v()(u()(r),"currentIndex",null),v()(u()(r),"startIndex",1),v()(u()(r),"dataManage",null),v()(u()(r),"paused",!1),v()(u()(r),"autoPlay",!0),v()(u()(r),"duration",0),v()(u()(r),"tsNumber",0),e||r.logger.error("Please pass in a dom object as the display container"),r.el=e,Object.assign(r.options,a),r.options.sourceURL=r.options.sourceURL||r.options.source,r.options.streamList=r.options.streamList||[],r.options.events=_(),r.maxBufferLength=void 0!==a.maxBufferLength?a.maxBufferLength:r.maxBufferLength,r.autoPlay=void 0!==a.autoPlay?a.autoPlay:r.autoPlay,r.controlBarAutoHide=void 0!==a.controlBarAutoHide?a.controlBarAutoHide:r.controlBarAutoHide,k()(u()(r),di,void 0!==a.libPath?a.libPath:m()(u()(r),di)),r.preload=void 0===a.preload?r.preload:a.preload,r.startTime=void 0===a.startTime?r.startTime:a.startTime,r.originStartTime=r.startTime,r.playbackRate=void 0===a.playbackRate?r.playbackRate:a.playbackRate,r}return o()(n,[{key:"setAlertError",value:function(){this.options.alertError=this.alertError=M.getInstance({player:this,component:this.componentsController.alertBox,events:this.options.events})}},{key:"setDataController",value:function(){this.dataController=_e.getInstance({player:this,events:this.options.events})}},{key:"setDataManage",value:function(){this.dataController.setDataManage({player:this,type:this.options.type,events:this.options.events}),this.dataManage=this.dataController.dataManage}},{key:"setComponentsController",value:function(){this.componentsController=Xr.getInstance({$container:this.$container,$screenContainer:this.$screenContainer,$canvas:this.$canvas,$audioContainer:this.$audioContainer,$audio:this.$audio,dataManage:this.dataManage,bigPlayButtonColor:this.bigPlayButtonColor,player:this,events:this.options.events})}},{key:"setControlBarController",value:function(){var e=Object.assign({},this.options,{$container:this.$container,$screenContainer:this.$screenContainer,controlBarAutoHide:this.controlBarAutoHide,player:this});this.controlBarController=$r.getInstance(e)}},{key:"setLoadController",value:function(){this.loaderController=ve.getInstance(this.options.type,{player:this,events:this.options.events})}},{key:"setProcessorController",value:function(){this.processController=new Zr({type:"ts",libPath:m()(this,di),events:this.options.events,player:this})}},{key:"setStreamController",value:function(){this.streamController=new ei({events:this.options.events,dataManage:this.dataManage,imagePlayer:this.imagePlayer,audioPlayer:this.audioPlayer,player:this})}},{key:"setImagerPlayer",value:function(){this.imagePlayer=new ci({events:this.options.events,canvas:this.$canvas,maxBufferLength:this.maxBufferLength,player:this})}},{key:"setAudioPlayer",value:function(){this.audioPlayer=new Ct({player:this,events:this.options.events,audioNode:this.$audio})}},{key:"setAction",value:function(){this.action=new Le({player:this,screen:this.screen,imagePlayer:this.imagePlayer,dataManage:this.dataManage,audioPlayer:this.audioPlayer,events:this.options.events})}},{key:"init",value:function(){this.controlBarHeight=this.options.controlBarHeight||this.controlBarHeight,this.options.httpWorker=Kr()(98,{name:"httpWorker"}),this.currentTime=this.startTime,this.addEl(),this.setDataController(),this.setDataManage(),this.setComponentsController(),this.setLoadController(),this.setControlBarController(),this.componentsController.setControlBarController(this.controlBarController),this.setAlertError(),this.setProcessorController(),this.setImagerPlayer(),this.setAudioPlayer(),this.setAction(),this.setStreamController(),this.componentsController.drawPoster(),this.preload&&this.run(),this.bindEvent()}},{key:"bindEvent",value:function(){var e=this;this.events.on(se.PlayerOnPlay,(function(){e.play()})),this.events.on(se.PlayerOnPause,(function(){e.pause()})),this.events.on(se.PlayerOnVolume,(function(t){e.volume=t})),this.events.on(se.DataProcessorReady,(function(){e.logger.info("bindEvent","decoder ready"),e.checkReady("dataProcessor")})),this.events.on(se.AudioPlayerReady,(function(){e.logger.info("bindEvent","audioPlayer ready"),e.seeking||e.checkReady("audioPlayer")})),this.events.on(se.PlayerReady,(function(){e.logger.info("bindEvent","player ready"),e.onReady()})),this.events.on(se.PlayerSpeedTo,(function(t){e.changeSpeed(t)})),this.events.on(se.PlayerChangeRate,(function(t){e.changeRate(t)})),this.events.on(se.PlayerWait,(function(){e.onWait()})),this.events.on(se.PlayerPlay,(function(){e.onPlay()})),this.events.on(se.LoaderPlayListLoaded,(function(t){"function"==typeof e.options.afterLoadPlaylist&&e.options.afterLoadPlaylist(e.laodData.sourceData);var n=t.dataManage.sourceData;e.duration=n.duration,e.tsNumber=n.length,e.streamController.setBaseInfo({duration:e.duration,tsNumber:e.tsNumber}),e.dataController.startLoad(e.startTime),e.setStartTime(e.originStartTime)})),this.events.on(se.DataManageFirstLoaded,(function(t){e.logger.info("bindEvent","first data ready"),e.startIndex=t.no,e.streamController.currentIndex=t.no,e.checkReady("firstData")})),this.events.on(se.StreamDataReady,(function(){e.logger.info("bindEvent","dataReady"),e.onDataReady()})),this.events.on(se.PlayerLoadedMetaData,(function(t,n){e.setCanvas(),e.resizeScreen(t,n)})),this.events.on(se.PlayerEnd,(function(){e.status="end"})),this.events.on(se.ImagePlayerBuffeUpdate,(function(){var t=e.buffer();e.events.emit(se.PlayerbufferUpdate,t)})),this.events.on(se.PlayerOnSeek,(function(t){e.seek(Math.floor(t))})),this.events.on(se.PlayerAlert,(function(t){e.alertError.show(t)})),this.events.on(se.PlayerThrowError,(function(t){U.a.apply(e,t)}))}},{key:"reset",value:function(e){this.action&&this.action.reset(e)}},{key:"switchPlaylist",value:function(e,t){this.loaderController.switchPlaylist(e,t)}},{key:"changeSpeed",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.playbackRate=e.value||1}},{key:"setStartTime",value:function(e){this.startTime=e}},{key:"changeRate",value:function(e){this.pause(),this.events.emit(se.ControlBarPauseLoading,this),this.setStartTime((this.currentTime-5e3)/1e3),this.changing=!0,this.seeking=!1,this.imagePlayer.firstRender=!1,this.readyStatus={dataProcessor:!1,firstData:!1,audioPlayer:!1},this.reset(!0),this.switchPlaylist(e.url)}},{key:"changeSrc",value:function(e,t){this.pause(),this.events.emit(se.ControlBarPauseLoading,this),this.events.emit(se.PlayerChangeSrc,this),this.changing=!0,this.seeking=!1,this.imagePlayer.firstRender=!1,this.readyStatus={dataProcessor:!1,firstData:!1,audioPlayer:!1},this.currentTime=this.startTime,this.imagePlayer.clear(),this.reset(!0),this.switchPlaylist(e,t)}},{key:"setCanvas",value:function(){var e=Mt.createCanvas(this);if(L.isElement(this.$canvas)){if(this.$canvas.width&&this.$canvas.height)return this.imagePlayer.setScreenRender(e),this.$canvas.replaceWith(e),void(this.$canvas=e)}else this.$screen.appendChild(e),this.$canvas=e}},{key:"destroy",value:function(){this.controlBarController&&(this.controlBarController.destroy(),delete this.controlBarController),this.$container&&(this.el.removeChild(this.$container),delete this.$container),this.processController.destroy(),this.loaderController.destroy()}},{key:"run",value:function(){this.loaderController.run()}},{key:"checkReady",value:function(e){var t=this.readyStatus;if(e&&"string"==typeof e){t[e]=!0;for(var n=Object.keys(t),r=0;r=1e3*this.duration?this.logger.info("seek","seek to time:",e):(this.seekTime=Date.now(),this.seeking=!0,this.currentTime=e,this.action.seek(e)))}},{key:"muted",get:function(){return m()(this,gi)},set:function(e){k()(this,gi,!!e)}},{key:"playbackRate",get:function(){return m()(this,vi)},set:function(e){k()(this,vi,e)}},{key:"seeking",get:function(){return m()(this,yi)},set:function(e){k()(this,yi,e),e?this.events.emit(se.PlayerSeeking):this.events.emit(se.PlayerSeekEnd)}},{key:"currentTime",get:function(){return m()(this,pi)},set:function(e){k()(this,pi,e)}},{key:"volume",get:function(){return this.audioPlayer.volume},set:function(e){this.audioPlayer.volume=e}},{key:"resizeScreen",value:function(e,t){L.adaptSizeElement(e,t,this.$screenContainer,this.$canvas)}}]),n}(N));t.default=bi},function(e,t){e.exports=function(e,t){return t.get?t.get.call(e):t.value},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var r=n(10).default;function i(){"use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e.exports=i=function(){return t},e.exports.__esModule=!0,e.exports.default=e.exports;var t={},n=Object.prototype,a=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function f(e,t,n,r){var i=t&&t.prototype instanceof p?t:p,a=Object.create(i.prototype),o=new _(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return E()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var s=w(o,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=h(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,o),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var d={};function p(){}function y(){}function v(){}var g={};c(g,s,(function(){return this}));var m=Object.getPrototypeOf,b=m&&m(m(S([])));b&&b!==n&&a.call(b,s)&&(g=b);var k=v.prototype=p.prototype=Object.create(g);function P(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function x(e,t){var n;this._invoke=function(i,o){function s(){return new t((function(n,s){!function n(i,o,s,u){var l=h(e[i],e,o);if("throw"!==l.type){var c=l.arg,f=c.value;return f&&"object"==r(f)&&a.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,s,u)}),(function(e){n("throw",e,s,u)})):t.resolve(f).then((function(e){c.value=e,s(c)}),(function(e){return n("throw",e,s,u)}))}u(l.arg)}(i,o,n,s)}))}return n=n?n.then(s,s):s()}}function w(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,w(e,t),"throw"===t.method))return d;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var r=h(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,d;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,d):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,d)}function B(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(B,this),this.reset(!0)}function S(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=a.call(i,"catchLoc"),u=a.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&a.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),d}},t}e.exports=i,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){!function(){"use strict";var t=n(50),r=n(94);function i(e){var t=e.getContext("2d"),n=null,i=null,a=null;return this.drawFrame=function(o){var s=o.format;e.width===s.displayWidth&&e.height===s.displayHeight||(e.width=s.displayWidth,e.height=s.displayHeight),null!==n&&n.width==s.width&&n.height==s.height||function(e,r){for(var i=(n=t.createImageData(e,r)).data,a=e*r*4,o=0;oRGB conversion * * @author Brion Vibber * @copyright 2014-2019 * @license MIT-style * * @param {YUVFrame} buffer - input frame buffer * @param {Uint8ClampedArray} output - array to draw RGBA into * Assumes that the output array already has alpha channel set to opaque. */e.exports={convertYCbCr:function(e,n){var r=0|e.format.width,i=0|e.format.height,a=0|t(e.format.width/e.format.chromaWidth),o=0|t(e.format.height/e.format.chromaHeight),s=e.y.bytes,u=e.u.bytes,l=e.v.bytes,c=0|e.y.stride,f=0|e.u.stride,h=0|e.v.stride,d=r<<2,p=0,y=0,v=0,g=0,m=0,b=0,k=0,P=0,x=0,w=0,B=0,T=0,_=0,S=0,E=0,R=0,L=0,C=0;if(1==a&&1==o)for(k=0,P=d,C=0,R=0;R>8,n[k+1]=B-_>>8,n[k+2]=B+S>>8,k+=4,B=298*s[y++]|0,n[k]=B+T>>8,n[k+1]=B-_>>8,n[k+2]=B+S>>8,k+=4,B=298*s[v++]|0,n[P]=B+T>>8,n[P+1]=B-_>>8,n[P+2]=B+S>>8,P+=4,B=298*s[v++]|0,n[P]=B+T>>8,n[P+1]=B-_>>8,n[P+2]=B+S>>8,P+=4;k+=d,P+=d,C++}else for(b=0,R=0;R>o)*f|0,m=C*h|0,E=0;E>a)],T=(409*(w=0|l[m+L])|0)-57088|0,_=(100*x|0)+(208*w|0)-34816|0,S=(516*x|0)-70912|0,B=298*s[p++]|0,n[b]=B+T>>8,n[b+1]=B-_>>8,n[b+2]=B+S>>8,b+=4}}}()},function(e,t){!function(){"use strict"; /** * Convert a ratio into a bit-shift count; for instance a ratio of 2 * becomes a bit-shift of 1, while a ratio of 1 is a bit-shift of 0. * * @author Brion Vibber * @copyright 2016 * @license MIT-style * * @param {number} ratio - the integer ratio to convert. * @returns {number} - number of bits to shift to multiply/divide by the ratio. * @throws exception if given a non-power-of-two */e.exports=function(e){for(var t=0,n=e>>1;0!=n;)n>>=1,t++;if(e!==1<=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nhandleResponse","".concat(a," | ").concat(i),"".concat(e.toFixed(2)," Bytes/s")),self.postMessage({type:"notice",method:"fetch",noticeType:"speed",data:{speed:e,intervalValue:20,lastReceived:a,bytesReceived:i}}),a=i)}),20);return r.read().then((function a(s){return s.done?(clearInterval(o),function(){if("ts"===t||"video"===t)return B(e,"blob");if(n.includes("json"))return B(e,"json");if(n.includes("text"))return B(e,"text");if(n.includes("form"))return B(e,"formData");if(n.includes("video")||n.includes("image")||n.includes("octet-stream"))return B(e,"blob");try{return B(e,"text")}catch(t){return Object(m.a)(t,"[HTTP>handleResponse:unknow content-type]",n,e),Promise.resolve(e)}}()):(i+=s.value.length,r.read().then(a))}))}var _=null,S=(_||(_=new(function(){function e(t){i()(this,e),u()(this,"options",{"content-type":"application/json;charset=UTF-8",mode:"cors",referrer:"about:client",referrerPolicy:"no-referrer-when-downgrade"}),Object.assign(this.options,t)}var t;return o()(e,[{key:"setOptions",value:function(e){var t=Object.assign(this.options,e);t.url=function(e){var t=e.url,n=e.params;return n?t+"?"+w(n):t}(t),t.method=t.method||"get",t.headers=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.headers,n=void 0===t?{}:t,r=e.method,i=void 0===r?"get":r,a=e.username,o=e.password,s=e.token,u=new Headers(n);if(a||o){if(!a)throw new TypeError("username required for basic authentication");if(!o)throw new TypeError("password required for basic authentication");var l="object"===("undefined"==typeof win?"undefined":h()(win))&&win.btoa?btoa:function(e){return e};u.set("Authorization","Basic "+l(a+":"+o))}return s&&u.set("Authorization","Bearer "+s),"get"===i||u.get("content-type")||u.set("content-type","application/json"),u}(t),t.body=function(e){var t=e.headers.get("content-type");if(t)return t.includes("json")?JSON.stringify(e.body):t.includes("x-www-form-urlencoded")?w(e.body):e.body}(t),delete t.username,delete t.password,delete t.token,this.options=t}},{key:"request",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;if(e)return this.setOptions(Object.assign({url:e},t)),console.error("request",this.options),fetch(this.options.url,this.options).then((function(e){return T(e,n)}));P.error("[HTTP>request]","url is undefined","url:",e,"options:",t)}},{key:"fetch",value:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){var e=p()(v.a.mark((function e(t){var n,r,i,a,o=arguments;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.length>1&&void 0!==o[1]?o[1]:{},r=o.length>2?o[2]:void 0,i=o.length>3?o[3]:void 0,t){e.next=6;break}return P.wran("[HTTP>fetch]","url is undefined","url:",t,"options:",n),e.abrupt("return");case 6:return this.setOptions(Object.assign({url:t},n)),P.info("[HTTP>fetch]","http fetch","url:",t,"options:",n),e.next=10,fetch(t,n);case 10:(a=e.sent).ok?a.text().then((function(e){self.postMessage({type:"invoke",method:"fetch",fileType:i,name:r,data:e})})):self.postMessage({result:"failed"});case 12:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}())},{key:"get",value:(t=p()(v.a.mark((function e(t){var n,r,i,a,o,s=arguments;return v.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>1&&void 0!==s[1]?s[1]:{},r=s.length>2?s[2]:void 0,i=s.length>3?s[3]:void 0,n.method="get",P.info("[HTTP>get]","http get","url:",t,"options:",n,"name:",r,"fileType:",i),o={type:"invoke",method:"get",fileType:i,name:r,url:t},e.prev=6,e.next=9,this.request.call(this,t,n,i);case 9:a=e.sent,e.next=15;break;case 12:e.prev=12,e.t0=e.catch(6),P.error("[HTTP>get]","networks error","url:",t,"options:",n,"name:",r,"fileType:",i,"ex:",e.t0);case 15:if(!a||!a.body){e.next=24;break}if(o.data=a.body,"ts"!==i&&"video"!==i){e.next=21;break}return e.next=20,x(o.data);case 20:o.arrayBuffer=e.sent;case 21:o.arrayBuffer?self.postMessage(o,[o.arrayBuffer.buffer]):self.postMessage(o),e.next=27;break;case 24:o.type="error",o.data=a,self.postMessage(o);case 27:case"end":return e.stop()}}),e,this,[[6,12]])}))),function(e){return t.apply(this,arguments)})}]),e}())({})),_);t.default=function(e){e.onmessage=function(e){var t=e.data,n=t.type,r=t.method;switch(n){case"invoke":S[r].call(S,t.url,t.options,t.name,t.fileType)}}}},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,s=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){s=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(s)throw i}}return a}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){var r=n(102);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(e=this.result.shift()),e}},{key:"checkData",value:function(){return this.result.length>0}}]),e}(),l=function(){function e(t){i()(this,e),this.decode=t}return o()(e,[{key:"openDecode",value:function(){return _web_decoder_open()}},{key:"closeDecode",value:function(e){_web_decoder_close(e)}},{key:"decodeData",value:function(e,t,n){var r=e.length||0;Module.ccall("web_decoder_decode_frame","number",["number","array","number","number"],[n,e,r,t])}},{key:"flush",value:function(e){var t=this.decode;if(_web_decoder_decode_frame)for(;;){if(_web_decoder_decode_frame(e,null,0,0)<0||!_web_got_frame(e))break;t.getDecodeYUV(e)}}},{key:"getYUV",value:function(e){var t=_web_get_stride_y(e),n=_web_get_stride_u(e),r=_web_get_stride_v(e),i=_web_get_width(e),a=_web_get_height(e),o=_web_get_frame_y(e),u=_web_get_frame_u(e),l=_web_get_frame_v(e),c=parseInt(_web_got_frame_pts(e)*s.a*1e3),f=HEAPU8.subarray(o,o+t*a),h=HEAPU8.subarray(u,u+n*a/2),d=HEAPU8.subarray(l,l+r*a/2);return{stride_y:t,stride_u:n,stride_v:r,width:i,height:a,buf_y:new Uint8Array(f),buf_u:new Uint8Array(h),buf_v:new Uint8Array(d),pts:c}}},{key:"checkData",value:function(e){return _web_got_frame(e)}}]),e}(),c=function(){function e(){i()(this,e),this.p=null,this.ptsList=[],this.ptsOffset=0,this.fps=0,this.lastDuration=0,this.previousPTS=0,this.status=!1,this.yuvArray=[],this.decodeTool=null}return o()(e,[{key:"loadWASM",value:function(e){var t=e.data.libPath;self.Module={locateFile:function(e){return t+e}},self.importScripts(t+"libffmpeg.js"),self.Module.onRuntimeInitialized=function(){console.log("wasm loaded"),Module._web_decoder_open?self.decode.decodeTool=new l(self.decode,this.event):self.decode.decodeTool=new u(self.decode,this.event),self.decode.openDecode(),self.decode.onWasmLoaded()}}},{key:"openDecode",value:function(){try{this.status||(this.p=this.decodeTool.openDecode(),this.status=!0),console.log("opendecode")}catch(e){console.error(e)}}},{key:"closeDecode",value:function(){this.status&&(this.decodeTool.closeDecode(this.p),this.status=!1)}},{key:"push",value:function(e){var t=this;e.forEach((function(e){var n=e.PTS,r=e.data_byte,i=e.partEnd,a=e.lastTS,o=t.ptsList;t.insertSort(o,parseInt(n*s.a*1e3)),t.decodeTool.decodeData(r,n,t.p),t.decodeTool.checkData(t.p)&&t.getDecodeYUV(t.p,i,a)}))}},{key:"getDecodeYUV",value:function(e,t,n){if(!this.reseting){var r=0;this.fps||(this.fps=this.getFPS());var i=this.decodeTool.getYUV(e),a=this.ptsList.shift();if(i.pts=a,this.previousPTS&&a?(r=parseInt(a-this.previousPTS),this.lastDuration=r):r=this.lastDuration,i.duration=r,i.fps=this.fps,a)this.previousPTS=a,this.yuvArray.push(i),this.yuvArray.length>10&&(self.postMessage({type:"decoded",data:this.yuvArray}),this.yuvArray=[]);t&&(this.yuvArray.length&&(self.postMessage({type:"decoded",data:this.yuvArray}),this.yuvArray=[]),self.postMessage({type:"partEnd",data:n}))}}},{key:"reset",value:function(){this.reseting=!0,this.ptsList=[],this.ptsOffset=0,this.previousPTS=0,this.fps=0,this.yuvArray=[],this.closeDecode(),this.openDecode(),self.postMessage({type:"resetEnd",data:Date.now()}),this.reseting=!1}},{key:"flush",value:function(){this.decodeTool.flush(this.p),this.yuvArray.length&&(self.postMessage({type:"decoded",data:this.yuvArray}),this.yuvArray=[]),this.closeDecode(),self.postMessage({type:"flushEnd",data:this.previousPTS})}},{key:"getFPS",value:function(){var e=this.ptsList;return e.length>=2?Math.round(1e3/(e[1]-e[0])):null}},{key:"onWasmLoaded",value:function(){self.postMessage({type:"dataProcessorReady"})}},{key:"insertSort",value:function(e,t){var n=e.length;if(0!==n){for(var r=0;rr;)e[i]=e[i-1],i--;return void(e[r]=t)}e.push(t)}else e.push(t)}}]),e}(),f=n(0),h=n.n(f),d=n(22),p=function(){function e(t){i()(this,e),h()(this,"previousPes",{}),h()(this,"maxAudioPTS",0),h()(this,"maxVideoPTS",0),h()(this,"offset",0),t?(this.init(),this.dataArray=[],this.videoArray=[],this.audioArray=[],this.decode=t):console.error("class TsDemux need pass decode parmas")}return o()(e,[{key:"init",value:function(){var e=this;try{this.demuxer=new d.c({enableWorker:!1,debug:!1,onlyDemuxElementary:!0}),this.demuxer.on(d.a.DEMUX_DATA,(function(t){t instanceof Array?(console.log("data"),e.dataArray.push(t),e.demuxed(e.dataArray),e.dataArray=[]):e.dataArray.push(t)})),this.demuxer.on(d.a.DONE,(function(t){var n={};e.demuxed(e.dataArray),e.dataArray=[],e.previousPes.partEnd=!0,e.previousPes.lastTS=e.isLast,e.isLast?(e.maxPTS=Math.min(e.maxAudioPTS,e.maxVideoPTS),n.audioEnd=!0,e.audioQueue(n),self.postMessage({type:"demuxedAAC",data:e.audioArray}),e.audioArray=[],self.postMessage({type:"maxPTS",data:{maxAudioPTS:e.maxAudioPTS,maxVideoPTS:e.maxVideoPTS}})):(self.postMessage({type:"demuxedAAC",data:e.audioArray}),e.audioArray=[]),e.decode.push(e.videoArray),e.videoArray=[],e.previousPes=null}))}catch(e){console.error("init demuxer failed.")}}},{key:"push",value:function(e){this.demuxer.push(e,{done:!0})}},{key:"demuxed",value:function(e){var t=this;e.forEach((function(e){t.tsDemuxed(e)}))}},{key:"tsDemuxed",value:function(e){var t=e.stream_type,n=e.pes||{};switch(t){case 36:this.videoQueue(n);break;case 3:case 15:case 17:n.PTS=Math.round(n.PTS*s.a*1e3),this.maxAudioPTS=Math.max(n.PTS,this.maxAudioPTS),this.audioQueue(n)}}},{key:"audioQueue",value:function(e){this.audioArray.push(e)}},{key:"videoQueue",value:function(e){this.previousPes=e,this.maxVideoPTS=Math.max(this.maxVideoPTS,e.PTS),this.videoArray.push(e)}},{key:"destroy",value:function(){this.demuxer.destroy()}}]),e}();self.decode=new c,self.demuxer=new p(self.decode);t.default=function(e){e.onmessage=function(t){var n=t.data,r=n.type,i=n.data,a=n.isLast;switch(r){case"startDemux":e.demuxer.isLast=a,e.demuxer.push(i);break;case"loadwasm":e.decode.loadWASM(t);break;case"flush":e.decode.flush()}}}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(167)},function(e,t,n){e.exports=n(87).default}])}));