h&&(h=parseFloat(t[f][0])),parseFloat(t[f][1])h&&(h=parseFloat(t[f][0])),parseFloat(t[f][1])
0)for(var v in c)g.style[v]=c[v];g.value=e,g.className=this.props.listId?this.props.listId+"":m+"",g.oninput=function(e){var t=o.split(/\n/);t[i]=e.target.value,r.setState({title:t.join("\n")}),r.props.wenziChange(t.join("\n"))},y.appendChild(g)}},{key:"clickMove",value:function(){var e=this,t=this.state,n=t.id,i=t.serviceData;document.getElementById(n).onclick=function(t){var n=t.layerX,r=t.layerY;e.selectedIndex||0===e.selectedIndex?(i[e.selectedIndex]=[n,r],e.selectedIndex=null,e.setData({serviceData:i}),e.sendFather(i)):(e.selectBox(n,r),e.setData({serviceData:i}))}}},{key:"mouseMove",value:function(){var e=this,t=this.state.id,n=document.getElementById(t);n.onmousedown=function(t){var i=e.state.serviceData,r=t.layerX,a=t.layerY;e.selectBox(r,a)&&(n.onmousemove=function(t){i[e.selectedIndex]=[t.layerX,t.layerY],e.setData({serviceData:i})})},n.onmouseup=function(t){n.onmousemove=null,e.selectedIndex=null,e.setData({serviceData:e.state.serviceData});var i=t.layerX,r=t.layerY;e.selectBox(i,r)&&e.sendFather(e.state.serviceData)}}},{key:"touchMove",value:function(){var e=this,t=this.state,n=t.id,i=t.serviceData,r=document.getElementById(n),a=r.parentNode,o=a.getBoundingClientRect().top,s=a.getBoundingClientRect().left;r.ontouchstart=function(t){var n=t.touches[0].pageX-s,a=t.touches[0].pageY-o;e.selectBox(n,a)&&(r.ontouchmove=function(t){i[e.selectedIndex]=[t.touches[0].pageX-s,t.touches[0].pageY-o],e.setData({serviceData:i})})},r.ontouchend=function(t){e.selectedIndex=null,r.ontouchmove=null,e.setData({serviceData:i});var n=t.changedTouches[0].pageX-s,a=t.changedTouches[0].pageY-o;e.selectBox(n,a)&&e.sendFather(i)}}},{key:"selectBox",value:function(e,t){var n=this.state,i=n.serviceData,r=n.circleRadius+n.circleBorderWidth;this.selectedIndex=null;for(var a=0;a0?n:null}}],(n=[{key:"componentDidMount",value:function(){var e=this.state.mode;"react"===e?this.setReact():this.setPolygon()}},{key:"isNull",value:function(){var e=this.state.id,t=document.getElementById(this[e].state.id),n=document.createElement("canvas");return n.width=t.width,n.height=t.height,t.toDataURL()==n.toDataURL()}},{key:"setReact",value:function(){var e=this,t=this.state.id;this.count=0;var n=document.getElementById(this[t].state.id),i=function(n){var i=e.state.serviceData,r=n.layerX,a=n.layerY;if(0===e.count)i[1][1]=a,i[2]=[r,a],i[3][0]=r;else if(e[t].selectedIndex||0===e[t].selectedIndex){switch(i[e[t].selectedIndex]=[r,a],e[t].selectedIndex){case 0:i[1][0]=r,i[3][1]=a;break;case 1:i[0][0]=r,i[2][1]=a;break;case 2:i[1][1]=a,i[3][0]=r;break;case 3:i[0][1]=a,i[2][0]=r}e.props.change(i)}e.setState({serviceData:i},(function(){e[t].draw()}))};n.addEventListener("mousedown",(function(r){if(2!==r.button){var a=r.layerX,o=r.layerY,s=[a,o];if(0===e.state.serviceData.length){e.count++;var l=[[].concat(s),[].concat(s),[].concat(s),[].concat(s)];e.setState({serviceData:l},(function(){e[t].draw()})),n.addEventListener("mousemove",i)}else e[t].selectBox(a,o)&&(e.count++,n.addEventListener("mousemove",i))}})),n.addEventListener("mouseup",(function(e){n.removeEventListener("mousemove",i)})),n.oncontextmenu=function(e){e.preventDefault()}}},{key:"setPolygon",value:function(){var e=this,t=this.state.id;this.state.serviceData.length>1?this.serviceDataFlag=!0:this.polygonCount=0;var n=document.getElementById(this[t].state.id),i=function(n){var i=n.layerX,r=n.layerY,a=e.state.serviceData;a.push([i,r]),e.setState({serviceData:a},(function(){e[t].draw()}))};this.serviceDataFlag||n.addEventListener("click",i),n.oncontextmenu=function(t){t.preventDefault(),2===t.button&&(0==e.polygonCount&&(e.polygonCount++,e.sendFather(e.state.serviceData)),n.removeEventListener("click",i))}}},{key:"isInPolygon",value:function(e,t,n){var i,r,a,o=0,s=t.length;r=t[0];for(var l=1;l<=s;l++)a=t[l%s],e[0]>Math.min(r[0],a[0])&&e[0]<=Math.max(r[0],a[0])&&e[1]<=Math.max(r[1],a[1])&&r[0]!=a[0]&&(i=(e[0]-r[0])*(a[1]-r[1])/(a[0]-r[0])+r[1],(r[1]==a[1]||e[1]<=i)&&o++),r=a;return o%2!=0||!!n.selectBox(e[0],e[1])}},{key:"wenziChange",value:function(e){this.setState({title:e}),this.props.wenziChange(e)}},{key:"change",value:function(e){this.sendFather(e)}},{key:"sendFather",value:function(e){"true"!==this.state.disabled&&this.props.change(e)}},{key:"render",value:function(){var e=this,t=this.state,n=t.serviceData,i=t.disabled,a=t.circleRadius,o=t.circleBorderWidth,s=t.circleBorderColor,l=t.circleInColor,d=t.circleSelectColor,c=t.lineColor,u=t.lineWidth,h=t.areaColor,p=t.title,f=t.titleColor,m=t.titleFont,y=t.titleLineHeight,g=t.titleBackgroundColor,v=t.titlePadding,_=t.titleTextAlign,b=t.titleWidth,w=t.titleFillColor,k=t.inputStyle,S=t.position,A=t.id;return r.a.createElement(dt,{serviceData:n,disabled:i,circleRadius:a,circleBorderWidth:o,circleBorderColor:s,circleSelectColor:d,circleInColor:l,lineColor:c,lineWidth:u,areaColor:h,title:p,titleColor:f,titleFont:m,titleLineHeight:y,titleBackgroundColor:g,titlePadding:v,titleTextAlign:_,titleWidth:b,titleFillColor:w,position:S,inputStyle:k,listId:this.props.listId,ref:function(t){e[A]=t},wenziChange:function(t){return e.wenziChange(t)},change:function(t){return e.change(t)}})}}])&&ht(t.prototype,n),i&&ht(t,i),o}(i.Component),vt=n(11),_t={insert:"head",singleton:!1};fe()(vt.a,_t),vt.a.locals;function bt(e){return(bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function wt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function kt(e,t){for(var n=0;n0?n:null}}],(n=[{key:"componentDidMount",value:function(){var e=this.props.list;e&&e.length>0&&(this.selectIndex=e[e.length-1].id),this.selectArea()}},{key:"clickIt",value:function(e){var t=this.props.list,n=(new Date).getTime();t&&0!==t.length?this[t[t.length-1].id+t[t.length-1].mode].isNull()?this.props.err(!1,"画布为空,请先绘制在添加。"):t[t.length-1].serviceData?(t.push({id:n+"",title:this.props.placeholder?this.props.placeholder:"请输入",mode:e}),this.selectIndex=n+""):this.props.err(!1,"画布没有保存,请先绘制完成在添加"):((t=[]).push({id:n,title:this.props.placeholder?this.props.placeholder:"请输入",mode:e}),this.selectIndex=n),this.props.change(t)}},{key:"delete",value:function(){var e=this,t=this.state.list.filter((function(t){return t.id===e.selectIndex})),n=this[t[0].id+t[0].mode];n[n.state.id].removeTags("input",n.props.listId),this.props.delete(this.selectIndex,"发出删除指令")}},{key:"change",value:function(e){var t=this,n=this.props.list;n=n.map((function(n){return n.id===t.selectIndex&&(n.serviceData=JSON.parse(JSON.stringify(e))),n})),this.props.change(n)}},{key:"selectArea",value:function(){var e=this,t=this.state.id;document.getElementById(t).onclick=function(t){var n=e.props.list,i=t.layerX,r=t.layerY;if(e.indexflag=!1,n)for(var a=0;ar!=u>r&&i<(c-l)*(r-d)/(u-d)+l;h&&(a=!a)}return!(h||!n.selectBox(e[0],e[1]))||a}},{key:"wenziChange",value:function(e,t){this.props.wenziChange(e,t)}},{key:"render",value:function(){var e=this,t=this.state,n=t.id,i=t.disabled,a=t.circleRadius,o=t.circleBorderWidth,s=t.circleBorderColor,l=t.circleInColor,d=t.circleSelectColor,c=t.lineColor,u=t.lineWidth,h=t.areaColor,p=t.title,f=t.titleColor,m=t.titleFont,y=t.titleLineHeight,g=t.titleBackgroundColor,v=t.titlePadding,_=t.titleTextAlign,b=t.titleWidth,w=t.titleFillColor,k=t.position,S=this.props.list;return r.a.createElement("div",{id:n,style:{width:"100%",height:"100%",position:"relative"}},S&&S.map((function(t,n){return r.a.createElement(gt,{disabled:i,circleRadius:a,circleBorderWidth:o,circleBorderColor:s,circleSelectColor:d,circleInColor:l,lineColor:c,lineWidth:u,areaColor:h,title:t.title?t.title:p,titleColor:t.titleColor?t.titleColor:f,titleFont:t.titleFont?t.titleFont:m,titleLineHeight:t.titleLineHeight?t.titleLineHeight:y,titleBackgroundColor:t.titleBackgroundColor?t.titleBackgroundColor:g,titlePadding:t.titlePadding?t.titlePadding:v,titleTextAlign:t.titleTextAlign?t.titleTextAlign:_,titleWidth:t.titleWidth?t.titleWidth:b,titleFillColor:t.titleFillColor?t.titleFillColor:w,position:k,key:t.id,listId:t.id,serviceData:t.serviceData,ref:function(n){e[t.id+t.mode]=n},mode:t.mode,wenziChange:function(t){return e.wenziChange(t,n)},change:function(t){return e.change(t)}})})))}}])&&kt(t.prototype,n),i&&kt(t,i),o}(i.Component);console.log("%c中科视语-组件库","text-shadow: 0 1px 0 #ccc,0 2px 0 #c9c9c9,0 3px 0 #bbb,0 4px 0 #b9b9b9,0 5px 0 #aaa,0 6px 1px rgba(0,0,0,.1),0 0 5px rgba(0,0,0,.1),0 1px 3px rgba(0,0,0,.3),0 3px 5px rgba(0,0,0,.2),0 5px 10px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.2),0 20px 20px rgba(0,0,0,.15);font-size:35px")}])}));
\ No newline at end of file
+ */var r;r=function(){"use strict";function e(e){return"function"==typeof e}var r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,o=void 0,a=void 0,s=function(e,t){f[i]=e,f[i+1]=t,2===(i+=2)&&(a?a(m):b())},l="undefined"!=typeof window?window:void 0,c=l||{},u=c.MutationObserver||c.WebKitMutationObserver,d="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),h="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(m,1)}}var f=new Array(1e3);function m(){for(var e=0;ethis.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket)_(this,d({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){h("!!connectTimeout hit!! Calling _cleanUp with force `true`"),t._cleanUp(!0)}),this.options.connectTimeout)},S.prototype._handlePacket=function(e,t){var n=this.options;if(5===n.protocolVersion&&n.properties&&n.properties.maximumPacketSize&&n.properties.maximumPacketSizeo.properties.topicAliasMaximum||!o.properties.topicAliasMaximum&&n.properties.topicAlias))&&delete i.properties.topicAlias),h("publish :: qos",n.qos),n.qos){case 1:case 2:this.outgoing[i.messageId]={volatile:!1,cb:r||w},this._storeProcessing?(h("_storeProcessing enabled"),this._packetIdsDuringStoreProcessing[i.messageId]=!1,this._storePacket(i,void 0,n.cbStorePut)):(h("MqttClient:publish: packet cmd: %s",i.cmd),this._sendPacket(i,void 0,n.cbStorePut));break;default:this._storeProcessing?(h("_storeProcessing enabled"),this._storePacket(i,r,n.cbStorePut)):(h("MqttClient:publish: packet cmd: %s",i.cmd),this._sendPacket(i,r,n.cbStorePut))}return this},S.prototype.subscribe=function(){for(var e,t=new Array(arguments.length),n=0;n0){var t={qos:e.qos};5===p&&(t.nl=e.nl||!1,t.rap=e.rap||!1,t.rh=e.rh||0,t.properties=e.properties),c._resubscribeTopics[e.topic]=t,y.push(e.topic)}})),c.messageIdToTopic[e.messageId]=y}return this.outgoing[e.messageId]={volatile:!0,cb:function(e,t){if(!e)for(var n=t.granted,r=0;r{h("end :: finish :: calling process.nextTick on closeStores"),p(i.bind(r))},t)}return h("end :: (%s)",this.options.clientId),null!=e&&"boolean"==typeof e||(n=t||w,t=e,e=!1,"object"!=typeof t&&(n=t,t=null,"function"!=typeof n&&(n=w))),"object"!=typeof t&&(n=t,t=null),h("end :: cb? %s",!!n),n=n||w,this.disconnecting?(n(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(h("end :: (%s) :: calling finish in 10ms once outgoing is empty",r.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,o,10))):(h("end :: (%s) :: immediately calling finish",r.options.clientId),o()),this)},S.prototype.removeOutgoingMessage=function(e){var t=this.outgoing[e]?this.outgoing[e].cb:null;return delete this.outgoing[e],this.outgoingStore.del({messageId:e},(function(){t(new Error("Message removed"))})),this},S.prototype.reconnect=function(e){h("client reconnect");var t=this,n=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new o,t.outgoingStore=t.options.outgoingStore||new o,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=n:n(),this},S.prototype._reconnect=function(){h("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),h("client already connected. disconnecting first.")):(h("_reconnect: calling _setupStream"),this._setupStream())},S.prototype._setupReconnect=function(){var e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0?(this.reconnecting||(h("_setupReconnect :: emit `offline` state"),this.emit("offline"),h("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),h("_setupReconnect :: setting reconnectTimer for %d ms",e.options.reconnectPeriod),e.reconnectTimer=setInterval((function(){h("reconnectTimer :: reconnect triggered!"),e._reconnect()}),e.options.reconnectPeriod)):h("_setupReconnect :: doing nothing...")},S.prototype._clearReconnect=function(){h("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},S.prototype._cleanUp=function(e,t){var n=arguments[2];if(t&&(h("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",t)),h("_cleanUp :: forced? %s",e),e)0===this.options.reconnectPeriod&&this.options.clean&&v(this.outgoing),h("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{var r=d({cmd:"disconnect"},n);h("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(r,f.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(h("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(h("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(h("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",t),t())},S.prototype._sendPacket=function(e,t,n){if(h("_sendPacket :: (%s) :: start",this.options.clientId),n=n||w,!this.connected)return h("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(e,t,n);switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void b(this,e,t,n);default:return void _(this,e,t)}switch(e.qos){case 2:case 1:b(this,e,t,n);break;case 0:default:_(this,e,t)}h("_sendPacket :: (%s) :: end",this.options.clientId)},S.prototype._storePacket=function(e,t,n){h("_storePacket :: packet: %o",e),h("_storePacket :: cb? %s",!!t),n=n||w,0===(e.qos||0)&&this.queueQoSZero||"publish"!==e.cmd?this.queue.push({packet:e,cb:t}):e.qos>0?(t=this.outgoing[e.messageId]?this.outgoing[e.messageId].cb:null,this.outgoingStore.put(e,(function(e){if(e)return t&&t(e);n()}))):t&&t(new Error("No connection to broker"))},S.prototype._setupPingTimer=function(){h("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);var e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=c((function(){e._checkPing()}),1e3*this.options.keepalive))},S.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},S.prototype._checkPing=function(){h("_checkPing :: checking ping..."),this.pingResp?(h("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(h("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},S.prototype._handlePingresp=function(){this.pingResp=!0},S.prototype._handleConnack=function(e){h("_handleConnack");var t=this.options,n=5===t.protocolVersion?e.reasonCode:e.returnCode;if(clearTimeout(this.connackTimer),e.properties&&(e.properties.topicAliasMaximum&&(t.properties||(t.properties={}),t.properties.topicAliasMaximum=e.properties.topicAliasMaximum),e.properties.serverKeepAlive&&t.keepalive&&(t.keepalive=e.properties.serverKeepAlive,this._shiftPingInterval()),e.properties.maximumPacketSize&&(t.properties||(t.properties={}),t.properties.maximumPacketSize=e.properties.maximumPacketSize)),0===n)this.reconnecting=!1,this._onConnect(e);else if(n>0){var r=new Error("Connection refused: "+g[n]);r.code=n,this.emit("error",r)}},S.prototype._handlePublish=function(e,t){h("_handlePublish: packet %o",e),t=void 0!==t?t:w;var n=e.topic.toString(),r=e.payload,i=e.qos,o=e.messageId,a=this,s=this.options,l=[0,16,128,131,135,144,145,151,153];switch(h("_handlePublish: qos %d",i),i){case 2:s.customHandleAcks(n,r,e,(function(n,r){return n instanceof Error||(r=n,n=null),n?a.emit("error",n):-1===l.indexOf(r)?a.emit("error",new Error("Wrong reason code for pubrec")):void(r?a._sendPacket({cmd:"pubrec",messageId:o,reasonCode:r},t):a.incomingStore.put(e,(function(){a._sendPacket({cmd:"pubrec",messageId:o},t)})))}));break;case 1:s.customHandleAcks(n,r,e,(function(i,s){return i instanceof Error||(s=i,i=null),i?a.emit("error",i):-1===l.indexOf(s)?a.emit("error",new Error("Wrong reason code for puback")):(s||a.emit("message",n,r,e),void a.handleMessage(e,(function(e){if(e)return t&&t(e);a._sendPacket({cmd:"puback",messageId:o,reasonCode:s},t)})))}));break;case 0:this.emit("message",n,r,e),this.handleMessage(e,t);break;default:h("_handlePublish: unknown QoS. Doing nothing.")}},S.prototype.handleMessage=function(e,t){t()},S.prototype._handleAck=function(e){var t,n=e.messageId,r=e.cmd,i=null,o=this.outgoing[n]?this.outgoing[n].cb:null,a=this;if(o){switch(h("_handleAck :: packet type",r),r){case"pubcomp":case"puback":var s=e.reasonCode;s&&s>0&&16!==s&&((t=new Error("Publish error: "+g[s])).code=s,o(t,e)),delete this.outgoing[n],this.outgoingStore.del(e,o);break;case"pubrec":i={cmd:"pubrel",qos:2,messageId:n};var l=e.reasonCode;l&&l>0&&16!==l?((t=new Error("Publish error: "+g[l])).code=l,o(t,e)):this._sendPacket(i);break;case"suback":delete this.outgoing[n];for(var c=0;c0)if(this.options.resubscribe)if(5===this.options.protocolVersion){h("_resubscribe: protocolVersion 5");for(var n=0;n0?a-4:a;for(n=0;n>16&255,l[u++]=t>>8&255,l[u++]=255&t;2===s&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,l[u++]=255&t);1===s&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t);return l},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,s=n-i;as?s:a+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function u(e,t,n){for(var i,o,a=[],s=t;s>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
+/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */
+t.read=function(e,t,n,r,i){var o,a,s=8*i-r-1,l=(1<>1,u=-7,d=n?i-1:0,h=n?-1:1,p=e[t+d];for(d+=h,o=p&(1<<-u)-1,p>>=-u,u+=s;u>0;o=256*o+e[t+d],d+=h,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=r;u>0;a=256*a+e[t+d],d+=h,u-=8);if(0===o)o=1-c;else{if(o===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=c}return(p?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,s,l,c=8*o-i-1,u=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(a++,l/=2),a+d>=u?(s=0,a=u):a+d>=1?(s=(t*l-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[n+p]=255&s,p+=f,s/=256,i-=8);for(a=a<0;e[n+p]=255&a,p+=f,a/=256,c-=8);e[n+p-f]|=128*m}},function(e,t){},function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){for(var n=0;n0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return a.alloc(0);for(var t,n,r,i=a.allocUnsafe(e>>>0),o=this.head,s=0;o;)t=o.data,n=i,r=s,a.prototype.copy.call(t,n,r),s+=o.data.length,o=o.next;return i}},{key:"consume",value:function(e,t){var n;return ei.length?i.length:e;if(o===i.length?r+=i:r+=i.slice(0,e),0==(e-=o)){o===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0==(e-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,t}},{key:l,value:function(e,t){return s(this,function(e){for(var t=1;t */
+var r=n(3),i=r.Buffer;function o(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return i(e,t,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=a),a.prototype=Object.create(i.prototype),o(i,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=i(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},function(e,t,n){"use strict";(function(t){var r;function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var o=n(20),a=Symbol("lastResolve"),s=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),u=Symbol("lastPromise"),d=Symbol("handlePromise"),h=Symbol("stream");function p(e,t){return{value:e,done:t}}function f(e){var t=e[a];if(null!==t){var n=e[h].read();null!==n&&(e[u]=null,e[a]=null,e[s]=null,t(p(n,!1)))}}function m(e){t.nextTick(f,e)}var y=Object.getPrototypeOf((function(){})),g=Object.setPrototypeOf((i(r={get stream(){return this[h]},next:function(){var e=this,n=this[l];if(null!==n)return Promise.reject(n);if(this[c])return Promise.resolve(p(void 0,!0));if(this[h].destroyed)return new Promise((function(n,r){t.nextTick((function(){e[l]?r(e[l]):n(p(void 0,!0))}))}));var r,i=this[u];if(i)r=new Promise(function(e,t){return function(n,r){e.then((function(){t[c]?n(p(void 0,!0)):t[d](n,r)}),r)}}(i,this));else{var o=this[h].read();if(null!==o)return Promise.resolve(p(o,!1));r=new Promise(this[d])}return this[u]=r,r}},Symbol.asyncIterator,(function(){return this})),i(r,"return",(function(){var e=this;return new Promise((function(t,n){e[h].destroy(null,(function(e){e?n(e):t(p(void 0,!0))}))}))})),r),y);e.exports=function(e){var t,n=Object.create(g,(i(t={},h,{value:e,writable:!0}),i(t,a,{value:null,writable:!0}),i(t,s,{value:null,writable:!0}),i(t,l,{value:null,writable:!0}),i(t,c,{value:e._readableState.endEmitted,writable:!0}),i(t,d,{value:function(e,t){var r=n[h].read();r?(n[u]=null,n[a]=null,n[s]=null,e(p(r,!1))):(n[a]=e,n[s]=t)},writable:!0}),t));return n[u]=null,o(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=n[s];return null!==t&&(n[u]=null,n[a]=null,n[s]=null,t(e)),void(n[l]=e)}var r=n[a];null!==r&&(n[u]=null,n[a]=null,n[s]=null,r(p(void 0,!0))),n[c]=!0})),e.on("readable",m.bind(null,n)),n}}).call(this,n(2))},function(e,t){e.exports=function(){throw new Error("Readable.from is not available in the browser")}},function(e,t,n){"use strict";e.exports=i;var r=n(38);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e)}n(7)(i,r),i.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){"use strict";var r;var i=n(10).codes,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function s(e){if(e)throw e}function l(e,t,i,o){o=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(o);var s=!1;e.on("close",(function(){s=!0})),void 0===r&&(r=n(20)),r(e,{readable:t,writable:i},(function(e){if(e)return o(e);s=!0,o()}));var l=!1;return function(t){if(!s&&!l)return l=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(e)?e.abort():"function"==typeof e.destroy?e.destroy():void o(t||new a("pipe"))}}function c(e){e()}function u(e,t){return e.pipe(t)}function d(e){return e.length?"function"!=typeof e[e.length-1]?s:e.pop():s}e.exports=function(){for(var e=arguments.length,t=new Array(e),n=0;n0,(function(e){r||(r=e),e&&a.forEach(c),o||(a.forEach(c),i(r))}))}));return t.reduce(u)}},function(e,t,n){t.parser=n(73).parser,t.generate=n(79),t.writeToStream=n(40)},function(e,t,n){const r=n(74),i=n(1),o=n(76),a=n(39),s=n(8)("mqtt-packet:parser");class l extends i{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof l?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new l).parser(e)}_resetState(){s("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new o,this.error=null,this._list=r(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),s("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,s("parse: state complete. _stateCounter is now: %d",this._stateCounter),s("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return s("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const e=this._list.readUInt8(0);return this.packet.cmd=a.types[e>>a.CMD_SHIFT],this.packet.retain=0!=(e&a.RETAIN_MASK),this.packet.qos=e>>a.QOS_SHIFT&a.QOS_MASK,this.packet.dup=0!=(e&a.DUP_MASK),s("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),s("_parseLength %d",e.value),!!e}_parsePayload(){s("_parsePayload: payload %O",this._list);let e=!1;if(0===this.packet.length||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}e=!0}return s("_parsePayload complete result: %s",e),e}_parseConnect(){let e,t,n,r;s("_parseConnect");const i={},o=this.packet,l=this._parseString();if(null===l)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==l&&"MQIsdp"!==l)return this._emitError(new Error("Invalid protocolId"));if(o.protocolId=l,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(o.protocolVersion=this._list.readUInt8(this._pos),3!==o.protocolVersion&&4!==o.protocolVersion&&5!==o.protocolVersion)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(i.username=this._list.readUInt8(this._pos)&a.USERNAME_MASK,i.password=this._list.readUInt8(this._pos)&a.PASSWORD_MASK,i.will=this._list.readUInt8(this._pos)&a.WILL_FLAG_MASK,i.will&&(o.will={},o.will.retain=0!=(this._list.readUInt8(this._pos)&a.WILL_RETAIN_MASK),o.will.qos=(this._list.readUInt8(this._pos)&a.WILL_QOS_MASK)>>a.WILL_QOS_SHIFT),o.clean=0!=(this._list.readUInt8(this._pos)&a.CLEAN_SESSION_MASK),this._pos++,o.keepalive=this._parseNum(),-1===o.keepalive)return this._emitError(new Error("Packet too short"));if(5===o.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(o.properties=e)}const c=this._parseString();if(null===c)return this._emitError(new Error("Packet too short"));if(o.clientId=c,s("_parseConnect: packet.clientId: %s",o.clientId),i.will){if(5===o.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(o.will.properties=e)}if(e=this._parseString(),null===e)return this._emitError(new Error("Cannot parse will topic"));if(o.will.topic=e,s("_parseConnect: packet.will.topic: %s",o.will.topic),t=this._parseBuffer(),null===t)return this._emitError(new Error("Cannot parse will payload"));o.will.payload=t,s("_parseConnect: packet.will.paylaod: %s",o.will.payload)}if(i.username){if(r=this._parseString(),null===r)return this._emitError(new Error("Cannot parse username"));o.username=r,s("_parseConnect: packet.username: %s",o.username)}if(i.password){if(n=this._parseBuffer(),null===n)return this._emitError(new Error("Cannot parse password"));o.password=n}return this.settings=o,s("_parseConnect: complete"),o}_parseConnack(){s("_parseConnack");const e=this.packet;if(this._list.length<2)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&a.SESSIONPRESENT_MASK),5===this.settings.protocolVersion?e.reasonCode=this._list.readUInt8(this._pos++):e.returnCode=this._list.readUInt8(this._pos++),-1===e.returnCode||-1===e.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}s("_parseConnack: complete")}_parsePublish(){s("_parsePublish");const e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),s("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){s("_parseSubscribe");const e=this.packet;let t,n,r,i,o,l,c;if(1!==e.qos)return this._emitError(new Error("Wrong subscribe header"));if(e.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));n=this._parseByte(),r=n&a.SUBSCRIBE_OPTIONS_QOS_MASK,l=0!=(n>>a.SUBSCRIBE_OPTIONS_NL_SHIFT&a.SUBSCRIBE_OPTIONS_NL_MASK),o=0!=(n>>a.SUBSCRIBE_OPTIONS_RAP_SHIFT&a.SUBSCRIBE_OPTIONS_RAP_MASK),i=n>>a.SUBSCRIBE_OPTIONS_RH_SHIFT&a.SUBSCRIBE_OPTIONS_RH_MASK,c={topic:t,qos:r},5===this.settings.protocolVersion&&(c.nl=l,c.rap=o,c.rh=i),s("_parseSubscribe: push subscription `%s` to subscription",c),e.subscriptions.push(c)}}}_parseSuback(){s("_parseSuback");const e=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos2&&(e.reasonCode=this._parseByte(),s("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)),e.length>3)){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return!0}_parseDisconnect(){const e=this.packet;if(s("_parseDisconnect"),5===this.settings.protocolVersion){e.reasonCode=this._parseByte();const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return s("_parseDisconnect result: true"),!0}_parseAuth(){s("_parseAuth");const e=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));e.reasonCode=this._parseByte();const t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),s("_parseAuth: result: true"),!0}_parseMessageId(){const e=this.packet;return e.messageId=this._parseNum(),null===e.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(s("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){const t=this._parseNum(),n=t+this._pos;if(-1===t||n>this._list.length||n>this.packet.length)return null;const r=this._list.toString("utf8",this._pos,n);return this._pos+=t,s("_parseString: result: %s",r),r}_parseStringPair(){return s("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const e=this._parseNum(),t=e+this._pos;if(-1===e||t>this._list.length||t>this.packet.length)return null;const n=this._list.slice(this._pos,t);return this._pos+=e,s("_parseBuffer: result: %o",n),n}_parseNum(){if(this._list.length-this._pos<2)return-1;const e=this._list.readUInt16BE(this._pos);return this._pos+=2,s("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const e=this._list.readUInt32BE(this._pos);return this._pos+=4,s("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){s("_parseVarByteNum");let t,n=0,r=1,i=0,o=!1;const l=this._pos?this._pos:0;for(;n<4;){if(t=this._list.readUInt8(l+n++),i+=r*(t&a.VARBYTEINT_MASK),r*=128,0==(t&a.VARBYTEINT_FIN_MASK)){o=!0;break}if(this._list.length<=n)break}return!o&&4===n&&this._list.length>=n&&this._emitError(new Error("Invalid variable byte integer")),l&&(this._pos+=n),o=!!o&&(e?{bytes:n,value:i}:i),s("_parseVarByteNum: result: %o",o),o}_parseByte(){const e=this._list.readUInt8(this._pos);return this._pos++,s("_parseByte: result: %o",e),e}_parseByType(e){switch(s("_parseByType: type: %s",e),e){case"byte":return 0!==this._parseByte();case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){s("_parseProperties");const e=this._parseVarByteNum(),t=this._pos+e,n={};for(;this._posthis.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},o.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},o.prototype.copy=function(e,t,n,i){if(("number"!=typeof n||n<0)&&(n=0),("number"!=typeof i||i>this.length)&&(i=this.length),n>=this.length)return e||r.alloc(0);if(i<=0)return e||r.alloc(0);const o=!!e,a=this._offset(n),s=i-n;let l=s,c=o&&t||0,u=a[1];if(0===n&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:r.concat(this._bufs,this.length);for(let t=0;tn)){this._bufs[t].copy(e,c,u,u+l),c+=n;break}this._bufs[t].copy(e,c,u),c+=n,l-=n,u&&(u=0)}return e.length>c?e.slice(0,c):e},o.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const n=this._offset(e),r=this._offset(t),i=this._bufs.slice(n[0],r[0]+1);return 0===r[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,r[1]),0!==n[1]&&(i[0]=i[0].slice(n[1])),this._new(i)},o.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},o.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const e=this._new();for(let t=0;tthis.length?this.length:t;const i=this._offset(t);let o=i[0],a=i[1];for(;o=e.length){const n=t.indexOf(e,a);if(-1!==n)return this._reverseOffset([o,n]);a=t.length-e.length+1}else{const t=this._reverseOffset([o,a]);if(this._match(t,e))return t;a++}}a=0}return-1},o.prototype._match=function(e,t){if(this.length-e{if("%%"===n)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];n=o.call(r,t),e.splice(s,1),s--}return n}),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return o.namespace=e,o.useColors=t.useColors(),o.color=t.selectColor(e),o.extend=r,o.destroy=t.destroy,Object.defineProperty(o,"enabled",{enumerable:!0,configurable:!1,get:()=>null===i?t.enabled(e):i,set:e=>{i=e}}),"function"==typeof t.init&&t.init(o),o}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map(e=>"-"+e)].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n{t[n]=e[n]}),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}e.exports=function(e,t){t=t||{};var s=typeof e;if("string"===s&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var a=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return 6048e5*a;case"days":case"day":case"d":return a*o;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*r;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(e);if("number"===s&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=o)return a(e,t,o,"day");if(t>=i)return a(e,t,i,"hour");if(t>=r)return a(e,t,r,"minute");if(t>=n)return a(e,t,n,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=o)return Math.round(e/o)+"d";if(t>=i)return Math.round(e/i)+"h";if(t>=r)return Math.round(e/r)+"m";if(t>=n)return Math.round(e/n)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,n){(function(t){const r=n(40),i=n(1);class o extends i{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0;const n=new Array(this._array.length),r=this._array;let i,o=0;for(i=0;i>8,0),n.writeUInt8(255&e,1),n}e.exports={cache:n,generateCache:function(){for(let e=0;e<65536;e++)n[e]=i(e)},generateNumber:i,genBufVariableByteInt:function(e){let n=0,i=0;const o=t.allocUnsafe(4);do{n=e%128|0,(e=e/128|0)>0&&(n|=128),o.writeUInt8(n,i++)}while(e>0&&i<4);return e>0&&(i=0),r?o.subarray(0,i):o.slice(0,i)},generate4ByteBuffer:function(e){const n=t.allocUnsafe(4);return n.writeUInt32BE(e,0),n}}}).call(this,n(3).Buffer)},function(e,t,n){"use strict";(function(t){void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,n,r,i){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,n)}));case 3:return t.nextTick((function(){e.call(null,n,r)}));case 4:return t.nextTick((function(){e.call(null,n,r,i)}));default:for(o=new Array(s-1),a=0;a0){e=new Array(arguments.length-2);for(var t=0;t",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(c),d=["%","/","?",";","#"].concat(u),h=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},_=n(88);function v(e,t,n){if(e&&i.isObject(e)&&e instanceof o)return e;var r=new o;return r.parse(e,t,n),r}o.prototype.parse=function(e,t,n){if(!i.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),s=-1!==o&&o127?I+="x":I+=O[D];if(!I.match(p)){var B=M.slice(0,T),U=M.slice(T+1),N=O.match(f);N&&(B.push(N[1]),U.unshift(N[2])),U.length&&(v="/"+U.join(".")+v),this.hostname=B.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),C||(this.hostname=r.toASCII(this.hostname));var F=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+F,this.href+=this.host,C&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!m[S])for(T=0,L=u.length;T0)&&n.host.split("@"))&&(n.auth=C.shift(),n.host=n.hostname=C.shift());return n.search=e.search,n.query=e.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!k.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var A=k.slice(-1)[0],x=(n.host||e.host||k.length>1)&&("."===A||".."===A)||""===A,T=0,R=k.length;R>=0;R--)"."===(A=k[R])?k.splice(R,1):".."===A?(k.splice(R,1),T++):T&&(k.splice(R,1),T--);if(!w&&!S)for(;T--;T)k.unshift("..");!w||""===k[0]||k[0]&&"/"===k[0].charAt(0)||k.unshift(""),x&&"/"!==k.join("/").substr(-1)&&k.push("");var C,M=""===k[0]||k[0]&&"/"===k[0].charAt(0);E&&(n.hostname=n.host=M?"":k.length?k.shift():"",(C=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=C.shift(),n.host=n.hostname=C.shift()));return(w=w||n.host&&k.length)&&!M&&k.unshift(""),k.length?n.pathname=k.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},o.prototype.parseHost=function(){var e=this.host,t=s.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){(function(e,r){var i;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(o){t&&t.nodeType,e&&e.nodeType;var a="object"==typeof r&&r;a.global!==a&&a.window!==a&&a.self;var s,l=2147483647,c=/^xn--/,u=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,h={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,f=String.fromCharCode;function m(e){throw new RangeError(h[e])}function y(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function g(e,t){var n=e.split("@"),r="";return n.length>1&&(r=n[0]+"@",e=n[1]),r+y((e=e.replace(d,".")).split("."),t).join(".")}function _(e){for(var t,n,r=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=f((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=f(e)})).join("")}function b(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function w(e,t,n){var r=0;for(e=n?p(e/700):e>>1,e+=p(e/t);e>455;r+=36)e=p(e/35);return p(r+36*e/(e+38))}function S(e){var t,n,r,i,o,a,s,c,u,d,h,f=[],y=e.length,g=0,_=128,b=72;for((n=e.lastIndexOf("-"))<0&&(n=0),r=0;r=128&&m("not-basic"),f.push(e.charCodeAt(r));for(i=n>0?n+1:0;i=y&&m("invalid-input"),((c=(h=e.charCodeAt(i++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:36)>=36||c>p((l-g)/a))&&m("overflow"),g+=c*a,!(c<(u=s<=b?1:s>=b+26?26:s-b));s+=36)a>p(l/(d=36-u))&&m("overflow"),a*=d;b=w(g-o,t=f.length+1,0==o),p(g/t)>l-_&&m("overflow"),_+=p(g/t),g%=t,f.splice(g++,0,_)}return v(f)}function k(e){var t,n,r,i,o,a,s,c,u,d,h,y,g,v,S,k=[];for(y=(e=_(e)).length,t=128,n=0,o=72,a=0;a=t&&hp((l-n)/(g=r+1))&&m("overflow"),n+=(s-t)*g,t=s,a=0;al&&m("overflow"),h==t){for(c=n,u=36;!(c<(d=u<=o?1:u>=o+26?26:u-o));u+=36)S=c-d,v=36-d,k.push(f(b(d+S%v,0))),c=p(S/v);k.push(f(b(c,0))),o=w(n,g,r==i),n=0,++r}++n,++t}return k.join("")}s={version:"1.4.1",ucs2:{decode:_,encode:v},decode:S,encode:k,toASCII:function(e){return g(e,(function(e){return u.test(e)?"xn--"+k(e):e}))},toUnicode:function(e){return g(e,(function(e){return c.test(e)?S(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return s}.call(t,n,t,e))||(e.exports=i)}()}).call(this,n(86)(e),n(4))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){"use strict";t.decode=t.parse=n(89),t.encode=t.stringify=n(90)},function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,o){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var l=1e3;o&&"number"==typeof o.maxKeys&&(l=o.maxKeys);var c=e.length;l>0&&c>l&&(c=l);for(var u=0;u=0?(d=m.substr(0,y),h=m.substr(y+1)):(d=m,h=""),p=decodeURIComponent(d),f=decodeURIComponent(h),r(a,p)?i(a[p])?a[p].push(f):a[p]=[a[p],f]:a[p]=f}return a};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?o(a(e),(function(a){var s=encodeURIComponent(r(a))+n;return i(e[a])?o(e[a],(function(e){return s+encodeURIComponent(r(e))})).join(t):s+encodeURIComponent(r(e[a]))})).join(t):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function o(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var t,n,i,o=r.allocUnsafe(e>>>0),a=this.head,s=0;a;)t=a.data,n=o,i=s,t.copy(n,i),s+=a.data.length,a=a.next;return o},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+" "+e})},function(e,t){},function(e,t,n){(function(t){function n(e){try{if(!t.localStorage)return!1}catch(e){return!1}var n=t.localStorage[e];return null!=n&&"true"===String(n).toLowerCase()}e.exports=function(e,t){if(n("noDeprecation"))return e;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}}}).call(this,n(4))},function(e,t,n){"use strict";e.exports=o;var r=n(47),i=Object.create(n(14));function o(e){if(!(this instanceof o))return new o(e);r.call(this,e)}i.inherits=n(12),i.inherits(o,r),o.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){(function(t){var r=n(100),i=function(){},o=function(e,n,a){if("function"==typeof n)return o(e,null,n);n||(n={}),a=r(a||i);var s=e._writableState,l=e._readableState,c=n.readable||!1!==n.readable&&e.readable,u=n.writable||!1!==n.writable&&e.writable,d=!1,h=function(){e.writable||p()},p=function(){u=!1,c||a.call(e)},f=function(){c=!1,u||a.call(e)},m=function(t){a.call(e,t?new Error("exited with error code: "+t):null)},y=function(t){a.call(e,t)},g=function(){t.nextTick(_)},_=function(){if(!d)return(!c||l&&l.ended&&!l.destroyed)&&(!u||s&&s.ended&&!s.destroyed)?void 0:a.call(e,new Error("premature close"))},v=function(){e.req.on("finish",p)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(e)?u&&!s&&(e.on("end",h),e.on("close",h)):(e.on("complete",p),e.on("abort",g),e.req?v():e.on("request",v)),function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length}(e)&&e.on("exit",m),e.on("end",f),e.on("finish",p),!1!==n.error&&e.on("error",y),e.on("close",g),function(){d=!0,e.removeListener("complete",p),e.removeListener("abort",g),e.removeListener("request",v),e.req&&e.req.removeListener("finish",p),e.removeListener("end",h),e.removeListener("close",h),e.removeListener("finish",p),e.removeListener("exit",m),e.removeListener("end",f),e.removeListener("error",y),e.removeListener("close",g)}};e.exports=o}).call(this,n(2))},function(e,t,n){var r=n(101);function i(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}e.exports=r(i),e.exports.strict=r(o),i.proto=i((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return i(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return o(this)},configurable:!0})}))},function(e,t){e.exports=function e(t,n){if(t&&n)return e(t)(n);if("function"!=typeof t)throw new TypeError("need wrapper function");return Object.keys(t).forEach((function(e){r[e]=t[e]})),r;function r(){for(var e=new Array(arguments.length),n=0;n ${t}`;c.ENABLE_CALLBACK&&c.emitter.emit("log","error",n),c.ENABLE_ERROR&&(console.error?console.error(n):console.warn?console.warn(n):console.log(n))}static i(e,t){e&&!c.FORCE_GLOBAL_TAG||(e=c.GLOBAL_TAG);let n=`[${e}] > ${t}`;c.ENABLE_CALLBACK&&c.emitter.emit("log","info",n),c.ENABLE_INFO&&(console.info?console.info(n):console.log(n))}static w(e,t){e&&!c.FORCE_GLOBAL_TAG||(e=c.GLOBAL_TAG);let n=`[${e}] > ${t}`;c.ENABLE_CALLBACK&&c.emitter.emit("log","warn",n),c.ENABLE_WARN&&(console.warn?console.warn(n):console.log(n))}static d(e,t){e&&!c.FORCE_GLOBAL_TAG||(e=c.GLOBAL_TAG);let n=`[${e}] > ${t}`;c.ENABLE_CALLBACK&&c.emitter.emit("log","debug",n),c.ENABLE_DEBUG&&(console.debug?console.debug(n):console.log(n))}static v(e,t){e&&!c.FORCE_GLOBAL_TAG||(e=c.GLOBAL_TAG);let n=`[${e}] > ${t}`;c.ENABLE_CALLBACK&&c.emitter.emit("log","verbose",n),c.ENABLE_VERBOSE&&console.log(n)}}c.GLOBAL_TAG="flv.js",c.FORCE_GLOBAL_TAG=!1,c.ENABLE_ERROR=!0,c.ENABLE_INFO=!0,c.ENABLE_WARN=!0,c.ENABLE_DEBUG=!0,c.ENABLE_VERBOSE=!0,c.ENABLE_CALLBACK=!1,c.emitter=new l.a;var u=c;var d=class{constructor(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}reset(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0}addBytes(e){0===this._firstCheckpoint?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=e,this._totalBytes+=e):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=e,this._totalBytes+=e):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=e,this._totalBytes+=e,this._lastCheckpoint=this._now())}get currentKBps(){this.addBytes(0);let e=(this._now()-this._lastCheckpoint)/1e3;return 0==e&&(e=1),this._intervalBytes/e/1024}get lastSecondKBps(){return this.addBytes(0),0!==this._lastSecondBytes?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0}get averageKBps(){let e=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/e/1024}};class h{constructor(e){this._message=e}get name(){return"RuntimeException"}get message(){return this._message}toString(){return this.name+": "+this.message}}class p extends h{constructor(e){super(e)}get name(){return"IllegalStateException"}}class f extends h{constructor(e){super(e)}get name(){return"InvalidArgumentException"}}class m extends h{constructor(e){super(e)}get name(){return"NotImplementedException"}}const y={kIdle:0,kConnecting:1,kBuffering:2,kError:3,kComplete:4},g={OK:"OK",EXCEPTION:"Exception",HTTP_STATUS_CODE_INVALID:"HttpStatusCodeInvalid",CONNECTING_TIMEOUT:"ConnectingTimeout",EARLY_EOF:"EarlyEof",UNRECOVERABLE_EARLY_EOF:"UnrecoverableEarlyEof"};class _{constructor(e){this._type=e||"undefined",this._status=y.kIdle,this._needStash=!1,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}destroy(){this._status=y.kIdle,this._onContentLengthKnown=null,this._onURLRedirect=null,this._onDataArrival=null,this._onError=null,this._onComplete=null}isWorking(){return this._status===y.kConnecting||this._status===y.kBuffering}get type(){return this._type}get status(){return this._status}get needStashBuffer(){return this._needStash}get onContentLengthKnown(){return this._onContentLengthKnown}set onContentLengthKnown(e){this._onContentLengthKnown=e}get onURLRedirect(){return this._onURLRedirect}set onURLRedirect(e){this._onURLRedirect=e}get onDataArrival(){return this._onDataArrival}set onDataArrival(e){this._onDataArrival=e}get onError(){return this._onError}set onError(e){this._onError=e}get onComplete(){return this._onComplete}set onComplete(e){this._onComplete=e}open(e,t){throw new m("Unimplemented abstract function!")}abort(){throw new m("Unimplemented abstract function!")}}let v={};!function(){let e=self.navigator.userAgent.toLowerCase(),t=/(edge)\/([\w.]+)/.exec(e)||/(opr)[\/]([\w.]+)/.exec(e)||/(chrome)[ \/]([\w.]+)/.exec(e)||/(iemobile)[\/]([\w.]+)/.exec(e)||/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("trident")>=0&&/(rv)(?::| )([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(e)||[],n=/(ipad)/.exec(e)||/(ipod)/.exec(e)||/(windows phone)/.exec(e)||/(iphone)/.exec(e)||/(kindle)/.exec(e)||/(android)/.exec(e)||/(windows)/.exec(e)||/(mac)/.exec(e)||/(linux)/.exec(e)||/(cros)/.exec(e)||[],r={browser:t[5]||t[3]||t[1]||"",version:t[2]||t[4]||"0",majorVersion:t[4]||t[2]||"0",platform:n[0]||""},i={};if(r.browser){i[r.browser]=!0;let e=r.majorVersion.split(".");i.version={major:parseInt(r.majorVersion,10),string:r.version},e.length>1&&(i.version.minor=parseInt(e[1],10)),e.length>2&&(i.version.build=parseInt(e[2],10))}if(r.platform&&(i[r.platform]=!0),(i.chrome||i.opr||i.safari)&&(i.webkit=!0),i.rv||i.iemobile){i.rv&&delete i.rv;let e="msie";r.browser=e,i[e]=!0}if(i.edge){delete i.edge;let e="msedge";r.browser=e,i[e]=!0}if(i.opr){let e="opera";r.browser=e,i[e]=!0}if(i.safari&&i.android){let e="android";r.browser=e,i[e]=!0}i.name=r.browser,i.platform=r.platform;for(let e in v)v.hasOwnProperty(e)&&delete v[e];Object.assign(v,i)}();var b=v;var w=class extends _{static isSupported(){try{let e=b.msedge&&b.version.minor>=15048,t=!b.msedge||e;return self.fetch&&self.ReadableStream&&t}catch(e){return!1}}constructor(e,t){super("fetch-stream-loader"),this.TAG="FetchStreamLoader",this._seekHandler=e,this._config=t,this._needStash=!0,this._requestAbort=!1,this._contentLength=null,this._receivedLength=0}destroy(){this.isWorking()&&this.abort(),super.destroy()}open(e,t){this._dataSource=e,this._range=t;let n=e.url;this._config.reuseRedirectedURL&&null!=e.redirectedURL&&(n=e.redirectedURL);let r=this._seekHandler.getConfig(n,t),i=new self.Headers;if("object"==typeof r.headers){let e=r.headers;for(let t in e)e.hasOwnProperty(t)&&i.append(t,e[t])}let o={method:"GET",headers:i,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if("object"==typeof this._config.headers)for(let e in this._config.headers)i.append(e,this._config.headers[e]);!1===e.cors&&(o.mode="same-origin"),e.withCredentials&&(o.credentials="include"),e.referrerPolicy&&(o.referrerPolicy=e.referrerPolicy),this._status=y.kConnecting,self.fetch(r.url,o).then(e=>{if(this._requestAbort)return this._requestAbort=!1,void(this._status=y.kIdle);if(e.ok&&e.status>=200&&e.status<=299){if(e.url!==r.url&&this._onURLRedirect){let t=this._seekHandler.removeURLParameters(e.url);this._onURLRedirect(t)}let t=e.headers.get("Content-Length");return null!=t&&(this._contentLength=parseInt(t),0!==this._contentLength&&this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)),this._pump.call(this,e.body.getReader())}if(this._status=y.kError,!this._onError)throw new h("FetchStreamLoader: Http code invalid, "+e.status+" "+e.statusText);this._onError(g.HTTP_STATUS_CODE_INVALID,{code:e.status,msg:e.statusText})}).catch(e=>{if(this._status=y.kError,!this._onError)throw e;this._onError(g.EXCEPTION,{code:-1,msg:e.message})})}abort(){this._requestAbort=!0}_pump(e){return e.read().then(t=>{if(t.done)if(null!==this._contentLength&&this._receivedLength{if(11===e.code&&b.msedge)return;this._status=y.kError;let t=0,n=null;if(19!==e.code&&"network error"!==e.message||!(null===this._contentLength||null!==this._contentLength&&this._receivedLength299)){if(this._status=y.kError,!this._onError)throw new h("MozChunkedLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(g.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}else this._status=y.kBuffering}}_onProgress(e){if(this._status===y.kError)return;null===this._contentLength&&null!==e.total&&0!==e.total&&(this._contentLength=e.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));let t=e.target.response,n=this._range.from+this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,n,this._receivedLength)}_onLoadEnd(e){!0!==this._requestAbort?this._status!==y.kError&&(this._status=y.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)):this._requestAbort=!1}_onXhrError(e){this._status=y.kError;let t=0,n=null;if(this._contentLength&&e.loaded=this._contentLength&&(n=this._range.from+this._contentLength-1),this._currentRequestRange={from:t,to:n},this._internalOpen(this._dataSource,this._currentRequestRange)}_internalOpen(e,t){this._lastTimeLoaded=0;let n=e.url;this._config.reuseRedirectedURL&&(null!=this._currentRedirectedURL?n=this._currentRedirectedURL:null!=e.redirectedURL&&(n=e.redirectedURL));let r=this._seekHandler.getConfig(n,t);this._currentRequestURL=r.url;let i=this._xhr=new XMLHttpRequest;if(i.open("GET",r.url,!0),i.responseType="arraybuffer",i.onreadystatechange=this._onReadyStateChange.bind(this),i.onprogress=this._onProgress.bind(this),i.onload=this._onLoad.bind(this),i.onerror=this._onXhrError.bind(this),e.withCredentials&&(i.withCredentials=!0),"object"==typeof r.headers){let e=r.headers;for(let t in e)e.hasOwnProperty(t)&&i.setRequestHeader(t,e[t])}if("object"==typeof this._config.headers){let e=this._config.headers;for(let t in e)e.hasOwnProperty(t)&&i.setRequestHeader(t,e[t])}i.send()}abort(){this._requestAbort=!0,this._internalAbort(),this._status=y.kComplete}_internalAbort(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)}_onReadyStateChange(e){let t=e.target;if(2===t.readyState){if(null!=t.responseURL){let e=this._seekHandler.removeURLParameters(t.responseURL);t.responseURL!==this._currentRequestURL&&e!==this._currentRedirectedURL&&(this._currentRedirectedURL=e,this._onURLRedirect&&this._onURLRedirect(e))}if(t.status>=200&&t.status<=299){if(this._waitForTotalLength)return;this._status=y.kBuffering}else{if(this._status=y.kError,!this._onError)throw new h("RangeLoader: Http code invalid, "+t.status+" "+t.statusText);this._onError(g.HTTP_STATUS_CODE_INVALID,{code:t.status,msg:t.statusText})}}}_onProgress(e){if(this._status===y.kError)return;if(null===this._contentLength){let t=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,t=!0;let n=e.total;this._internalAbort(),null!=n&0!==n&&(this._totalLength=n)}if(-1===this._range.to?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,t)return void this._openSubRange();this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}let t=e.loaded-this._lastTimeLoaded;this._lastTimeLoaded=e.loaded,this._speedSampler.addBytes(t)}_normalizeSpeed(e){let t=this._chunkSizeKBList,n=t.length-1,r=0,i=0,o=n;if(e=t[r]&&e=3&&(t=this._speedSampler.currentKBps)),0!==t){let e=this._normalizeSpeed(t);this._currentSpeedNormalized!==e&&(this._currentSpeedNormalized=e,this._currentChunkSizeKB=e)}let n=e.target.response,r=this._range.from+this._receivedLength;this._receivedLength+=n.byteLength;let i=!1;null!=this._contentLength&&this._receivedLength0&&this._receivedLength{this._dispatchArrayBuffer(t.result)},t.readAsArrayBuffer(e.data)}else{this._status=y.kError;let t={code:-1,msg:"Unsupported WebSocket message type: "+e.data.constructor.name};if(!this._onError)throw new h(t.msg);this._onError(g.EXCEPTION,t)}}_dispatchArrayBuffer(e){let t=e,n=this._receivedLength;this._receivedLength+=t.byteLength,this._onDataArrival&&this._onDataArrival(t,n,this._receivedLength)}_onWebSocketError(e){this._status=y.kError;let t={code:e.code,msg:e.message};if(!this._onError)throw new h(t.msg);this._onError(g.EXCEPTION,t)}};var A=class{constructor(e){this._zeroStart=e||!1}getConfig(e,t){let n={};if(0!==t.from||-1!==t.to){let e;e=-1!==t.to?`bytes=${t.from.toString()}-${t.to.toString()}`:`bytes=${t.from.toString()}-`,n.Range=e}else this._zeroStart&&(n.Range="bytes=0-");return{url:e,headers:n}}removeURLParameters(e){return e}};var x=class{constructor(e,t){this._startName=e,this._endName=t}getConfig(e,t){let n=e;if(0!==t.from||-1!==t.to){let e=!0;-1===n.indexOf("?")&&(n+="?",e=!1),e&&(n+="&"),n+=`${this._startName}=${t.from.toString()}`,-1!==t.to&&(n+=`&${this._endName}=${t.to.toString()}`)}return{url:n,headers:{}}}removeURLParameters(e){let t=e.split("?")[0],n=void 0,r=e.indexOf("?");-1!==r&&(n=e.substring(r+1));let i="";if(null!=n&&n.length>0){let e=n.split("&");for(let t=0;t0;n[0]!==this._startName&&n[0]!==this._endName&&(r&&(i+="&"),i+=e[t])}}return 0===i.length?t:t+"?"+i}};var T=class{constructor(e,t,n){this.TAG="IOController",this._config=t,this._extraData=n,this._stashInitialSize=393216,null!=t.stashInitialSize&&t.stashInitialSize>0&&(this._stashInitialSize=t.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=3145728,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,!1===t.enableStashBuffer&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=e,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(e.url),this._refTotalLength=e.filesize?e.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new d,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}destroy(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null}isWorking(){return this._loader&&this._loader.isWorking()&&!this._paused}isPaused(){return this._paused}get status(){return this._loader.status}get extraData(){return this._extraData}set extraData(e){this._extraData=e}get onDataArrival(){return this._onDataArrival}set onDataArrival(e){this._onDataArrival=e}get onSeeked(){return this._onSeeked}set onSeeked(e){this._onSeeked=e}get onError(){return this._onError}set onError(e){this._onError=e}get onComplete(){return this._onComplete}set onComplete(e){this._onComplete=e}get onRedirect(){return this._onRedirect}set onRedirect(e){this._onRedirect=e}get onRecoveredEarlyEof(){return this._onRecoveredEarlyEof}set onRecoveredEarlyEof(e){this._onRecoveredEarlyEof=e}get currentURL(){return this._dataSource.url}get hasRedirect(){return null!=this._redirectedURL||null!=this._dataSource.redirectedURL}get currentRedirectedURL(){return this._redirectedURL||this._dataSource.redirectedURL}get currentSpeed(){return this._loaderClass===k?this._loader.currentSpeed:this._speedSampler.lastSecondKBps}get loaderType(){return this._loader.type}_selectSeekHandler(){let e=this._config;if("range"===e.seekType)this._seekHandler=new A(this._config.rangeLoadZeroStart);else if("param"===e.seekType){let t=e.seekParamStart||"bstart",n=e.seekParamEnd||"bend";this._seekHandler=new x(t,n)}else{if("custom"!==e.seekType)throw new f("Invalid seekType in config: "+e.seekType);if("function"!=typeof e.customSeekHandler)throw new f("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new e.customSeekHandler}}_selectLoader(){if(null!=this._config.customLoader)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=E;else if(w.isSupported())this._loaderClass=w;else if(S.isSupported())this._loaderClass=S;else{if(!k.isSupported())throw new h("Your browser doesn't support xhr with arraybuffer responseType!");this._loaderClass=k}}_createLoader(){this._loader=new this._loaderClass(this._seekHandler,this._config),!1===this._loader.needStashBuffer&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)}open(e){this._currentRange={from:0,to:-1},e&&(this._currentRange.from=e),this._speedSampler.reset(),e||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))}abort(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)}pause(){this.isWorking()&&(this._loader.abort(),0!==this._stashUsed?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)}resume(){if(this._paused){this._paused=!1;let e=this._resumeFrom;this._resumeFrom=0,this._internalSeek(e,!0)}}seek(e){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(e,!0)}_internalSeek(e,t){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(t),this._loader.destroy(),this._loader=null;let n={from:e,to:-1};this._currentRange={from:n.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,n),this._onSeeked&&this._onSeeked()}updateUrl(e){if(!e||"string"!=typeof e||0===e.length)throw new f("Url must be a non-empty string!");this._dataSource.url=e}_expandBuffer(e){let t=this._stashSize;for(;t+10485760){let e=new Uint8Array(this._stashBuffer,0,this._stashUsed);new Uint8Array(n,0,t).set(e,0)}this._stashBuffer=n,this._bufferSize=t}_normalizeSpeed(e){let t=this._speedNormalizeList,n=t.length-1,r=0,i=0,o=n;if(e=t[r]&&e=512&&e<=1024?Math.floor(1.5*e):2*e,t>8192&&(t=8192);let n=1024*t+1048576;this._bufferSize0){let t=this._stashBuffer.slice(0,this._stashUsed),r=this._dispatchChunks(t,this._stashByteStart);if(r0){let e=new Uint8Array(t,r);n.set(e,0),this._stashUsed=e.byteLength,this._stashByteStart+=r}}else this._stashUsed=0,this._stashByteStart+=r;this._stashUsed+e.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+e.byteLength),n=new Uint8Array(this._stashBuffer,0,this._bufferSize)),n.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength}else{let r=this._dispatchChunks(e,t);if(rthis._bufferSize&&(this._expandBuffer(i),n=new Uint8Array(this._stashBuffer,0,this._bufferSize)),n.set(new Uint8Array(e,r),0),this._stashUsed+=i,this._stashByteStart=t+r}}}else if(0===this._stashUsed){let n=this._dispatchChunks(e,t);if(nthis._bufferSize&&this._expandBuffer(r),new Uint8Array(this._stashBuffer,0,this._bufferSize).set(new Uint8Array(e,n),0),this._stashUsed+=r,this._stashByteStart=t+n}}else{this._stashUsed+e.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+e.byteLength);let t=new Uint8Array(this._stashBuffer,0,this._bufferSize);t.set(new Uint8Array(e),this._stashUsed),this._stashUsed+=e.byteLength;let n=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(n0){let e=new Uint8Array(this._stashBuffer,n);t.set(e,0)}this._stashUsed-=n,this._stashByteStart+=n}}_flushStashBuffer(e){if(this._stashUsed>0){let t=this._stashBuffer.slice(0,this._stashUsed),n=this._dispatchChunks(t,this._stashByteStart),r=t.byteLength-n;if(n0){let e=new Uint8Array(this._stashBuffer,0,this._bufferSize),r=new Uint8Array(t,n);e.set(r,0),this._stashUsed=r.byteLength,this._stashByteStart+=n}return 0}u.w(this.TAG,r+" bytes unconsumed data remain when flush buffer, dropped")}return this._stashUsed=0,this._stashByteStart=0,r}return 0}_onLoaderComplete(e,t){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)}_onLoaderError(e,t){switch(u.e(this.TAG,`Loader error, code = ${t.code}, msg = ${t.msg}`),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,e=g.UNRECOVERABLE_EARLY_EOF),e){case g.EARLY_EOF:if(!this._config.isLive&&this._totalLength){let e=this._currentRange.to+1;return void(e0){let t=I.getConfig();e.emit("change",t)}}static registerListener(e){I.emitter.addListener("change",e)}static removeListener(e){I.emitter.removeListener("change",e)}static addLogListener(e){u.emitter.addListener("log",e),u.emitter.listenerCount("log")>0&&(u.ENABLE_CALLBACK=!0,I._notifyChange())}static removeLogListener(e){u.emitter.removeListener("log",e),0===u.emitter.listenerCount("log")&&(u.ENABLE_CALLBACK=!1,I._notifyChange())}}I.emitter=new l.a;var D=I;var P=class{constructor(){this.mimeType=null,this.duration=null,this.hasAudio=null,this.hasVideo=null,this.audioCodec=null,this.videoCodec=null,this.audioDataRate=null,this.videoDataRate=null,this.audioSampleRate=null,this.audioChannelCount=null,this.width=null,this.height=null,this.fps=null,this.profile=null,this.level=null,this.refFrames=null,this.chromaFormat=null,this.sarNum=null,this.sarDen=null,this.metadata=null,this.segments=null,this.segmentCount=null,this.hasKeyframesIndex=null,this.keyframesIndex=null}isComplete(){let e=!1===this.hasAudio||!0===this.hasAudio&&null!=this.audioCodec&&null!=this.audioSampleRate&&null!=this.audioChannelCount,t=!1===this.hasVideo||!0===this.hasVideo&&null!=this.videoCodec&&null!=this.width&&null!=this.height&&null!=this.fps&&null!=this.profile&&null!=this.level&&null!=this.refFrames&&null!=this.chromaFormat&&null!=this.sarNum&&null!=this.sarDen;return null!=this.mimeType&&null!=this.duration&&null!=this.metadata&&null!=this.hasKeyframesIndex&&e&&t}isSeekable(){return!0===this.hasKeyframesIndex}getNearestKeyframe(e){if(null==this.keyframesIndex)return null;let t=this.keyframesIndex,n=this._search(t.times,e);return{index:n,milliseconds:t.times[n],fileposition:t.filepositions[n]}}_search(e,t){let n=0,r=e.length-1,i=0,o=0,a=r;for(t=e[i]&&t=128){t.push(String.fromCharCode(65535&e)),r+=2;continue}}}else if(n[r]<240){if(B(n,r,2)){let e=(15&n[r])<<12|(63&n[r+1])<<6|63&n[r+2];if(e>=2048&&55296!=(63488&e)){t.push(String.fromCharCode(65535&e)),r+=3;continue}}}else if(n[r]<248&&B(n,r,3)){let e=(7&n[r])<<18|(63&n[r+1])<<12|(63&n[r+2])<<6|63&n[r+3];if(e>65536&&e<1114112){e-=65536,t.push(String.fromCharCode(e>>>10|55296)),t.push(String.fromCharCode(1023&e|56320)),r+=4;continue}}t.push(String.fromCharCode(65533)),++r}return t.join("")};let N=function(){let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),256===new Int16Array(e)[0]}();class F{static parseScriptData(e,t,n){let r={};try{let i=F.parseValue(e,t,n),o=F.parseValue(e,t+i.size,n-i.size);r[i.data]=o.data}catch(e){u.e("AMF",e.toString())}return r}static parseObject(e,t,n){if(n<3)throw new p("Data not enough when parse ScriptDataObject");let r=F.parseString(e,t,n),i=F.parseValue(e,t+r.size,n-r.size),o=i.objectEnd;return{data:{name:r.data,value:i.data},size:r.size+i.size,objectEnd:o}}static parseVariable(e,t,n){return F.parseObject(e,t,n)}static parseString(e,t,n){if(n<2)throw new p("Data not enough when parse String");let r,i=new DataView(e,t,n).getUint16(0,!N);return r=i>0?U(new Uint8Array(e,t+2,i)):"",{data:r,size:2+i}}static parseLongString(e,t,n){if(n<4)throw new p("Data not enough when parse LongString");let r,i=new DataView(e,t,n).getUint32(0,!N);return r=i>0?U(new Uint8Array(e,t+4,i)):"",{data:r,size:4+i}}static parseDate(e,t,n){if(n<10)throw new p("Data size invalid when parse Date");let r=new DataView(e,t,n),i=r.getFloat64(0,!N);return i+=60*r.getInt16(8,!N)*1e3,{data:new Date(i),size:10}}static parseValue(e,t,n){if(n<1)throw new p("Data not enough when parse Value");let r,i=new DataView(e,t,n),o=1,a=i.getUint8(0),s=!1;try{switch(a){case 0:r=i.getFloat64(1,!N),o+=8;break;case 1:r=!!i.getUint8(1),o+=1;break;case 2:{let i=F.parseString(e,t+1,n-1);r=i.data,o+=i.size;break}case 3:{r={};let a=0;for(9==(16777215&i.getUint32(n-4,!N))&&(a=3);o