| 1 | (function(){function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var l=new Error("Cannot find module '"+s+"'");throw l.code="MODULE_NOT_FOUND",l}var f=r[s]={exports:{}};t[s][0].call(f.exports,function(e){var r=t[s][1][e];return i(r||e)},f,f.exports,e,t,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}return e})()({1:[function(e,t,r){"use strict";function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function i(e){var t=n(e),r=t[0],i=t[1];return 3*(r+i)/4-i}function o(e,t,r){return 3*(t+r)/4-r}function s(e){var t,r,i=n(e),s=i[0],a=i[1],u=new h(o(e,s,a)),l=0,f=a>0?s-4:s;for(r=0;r<f;r+=4)t=c[e.charCodeAt(r)]<<18|c[e.charCodeAt(r+1)]<<12|c[e.charCodeAt(r+2)]<<6|c[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===a&&(t=c[e.charCodeAt(r)]<<2|c[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===a&&(t=c[e.charCodeAt(r)]<<10|c[e.charCodeAt(r+1)]<<4|c[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u}function a(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function u(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(a(n));return i.join("")}function l(e){for(var t,r=e.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(u(e,s,s+o>a?a:s+o));return 1===n?(t=e[r-1],i.push(f[t>>2]+f[t<<4&63]+"==")):2===n&&(t=(e[r-2]<<8)+e[r-1],i.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"=")),i.join("")}r.byteLength=i,r.toByteArray=s,r.fromByteArray=l;for(var f=[],c=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=0,g=p.length;d<g;++d)f[d]=p[d],c[p.charCodeAt(d)]=d;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63},{}],2:[function(e,t,r){},{}],3:[function(e,t,r){(function(t){(function(){"use strict";function t(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}function n(e){if(e>z)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=i.prototype,t}function i(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return o(e,t,r)}function o(e,t,r){if("string"==typeof e)return l(e,t);if(ArrayBuffer.isView(e))return f(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(W(e,ArrayBuffer)||e&&W(e.buffer,ArrayBuffer))return c(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return i.from(n,t,r);var o=h(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return i.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function a(e,t,r){return s(e),e<=0?n(e):void 0!==t?"string"==typeof r?n(e).fill(t,r):n(e).fill(t):n(e)}function u(e){return s(e),n(e<0?0:0|p(e))}function l(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!i.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|g(e,t),o=n(r),s=o.write(e,t);return s!==r&&(o=o.slice(0,s)),o}function f(e){for(var t=e.length<0?0:0|p(e.length),r=n(t),i=0;i<t;i+=1)r[i]=255&e[i];return r}function c(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),n.__proto__=i.prototype,n}function h(e){if(i.isBuffer(e)){var t=0|p(e.length),r=n(t);return 0===r.length?r:(e.copy(r,0,0,t),r)}return void 0!==e.length?"number"!=typeof e.length||$(e.length)?n(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}function p(e){if(e>=z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+z.toString(16)+" bytes");return 0|e}function d(e){return+e!=e&&(e=0),i.alloc(+e)}function g(e,t){if(i.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||W(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return K(e).length;default:if(o)return n?-1:D(e).length;t=(""+t).toLowerCase(),o=!0}}function b(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,t>>>=0,r<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return B(this,t,r);case"utf8":case"utf-8":return R(this,t,r);case"ascii":return T(this,t,r);case"latin1":case"binary":return O(this,t,r);case"base64":return k(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function _(e,t,r,n,o){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,$(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"==typeof t&&(t=i.from(t,n)),i.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,i){function o(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var s,a=1,u=e.length,l=t.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,u/=2,l/=2,r/=2}if(i){var f=-1;for(s=r;s<u;s++)if(o(e,s)===o(t,-1===f?0:s-f)){if(-1===f&&(f=s),s-f+1===l)return f*a}else-1!==f&&(s-=s-f),f=-1}else for(r+l>u&&(r=u-l),s=r;s>=0;s--){for(var c=!0,h=0;h<l;h++)if(o(e,s+h)!==o(t,h)){c=!1;break}if(c)return s}return-1}function w(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var o=t.length;n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if($(a))return s;e[r+s]=a}return s}function v(e,t,r,n){return V(D(t,e.length-r),e,r,n)}function S(e,t,r,n){return V(H(t),e,r,n)}function E(e,t,r,n){return S(e,t,r,n)}function C(e,t,r,n){return V(K(t),e,r,n)}function I(e,t,r,n){return V(q(t,e.length-r),e,r,n)}function k(e,t,r){return 0===t&&r===e.length?Q.fromByteArray(e):Q.fromByteArray(e.slice(t,r))}function R(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,u,l=e[i],f=null,c=l>239?4:l>223?3:l>191?2:1;if(i+c<=r)switch(c){case 1:l<128&&(f=l);break;case 2:o=e[i+1],128==(192&o)&&(u=(31&l)<<6|63&o,u>127&&(f=u));break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(u=(15&l)<<12|(63&o)<<6|63&s,u>2047&&(u<55296||u>57343)&&(f=u));break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&l)<<18|(63&o)<<12|(63&s)<<6|63&a,u>65535&&u<1114112&&(f=u))}null===f?(f=65533,c=1):f>65535&&(f-=65536,n.push(f>>>10&1023|55296),f=56320|1023&f),n.push(f),i+=c}return A(n)}function A(e){var t=e.length;if(t<=G)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=G));return r}function T(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function O(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function B(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=F(e[o]);return i}function L(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function M(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,o,s){if(!i.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<s)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function P(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function x(e,t,r,n,i){return t=+t,r>>>=0,i||P(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),Y.write(e,t,r,n,23,4),r+4}function U(e,t,r,n,i){return t=+t,r>>>=0,i||P(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),Y.write(e,t,r,n,52,8),r+8}function j(e){if(e=e.split("=")[0],e=e.trim().replace(J,""),e.length<2)return"";for(;e.length%4!=0;)e+="=";return e}function F(e){return e<16?"0"+e.toString(16):e.toString(16)}function D(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if(r=e.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function H(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function q(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)r=e.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function K(e){return Q.toByteArray(j(e))}function V(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function W(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function $(e){return e!=e}var Q=e("base64-js"),Y=e("ieee754");r.Buffer=i,window.Buffer=i,r.SlowBuffer=d,r.INSPECT_MAX_BYTES=50;var z=2147483647;r.kMaxLength=z,i.TYPED_ARRAY_SUPPORT=t(),i.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(i.prototype,"parent",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.buffer}}),Object.defineProperty(i.prototype,"offset",{enumerable:!0,get:function(){if(i.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(e,t,r){return o(e,t,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(e,t,r){return a(e,t,r)},i.allocUnsafe=function(e){return u(e)},i.allocUnsafeSlow=function(e){return u(e)},i.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==i.prototype},i.compare=function(e,t){if(W(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),W(t,Uint8Array)&&(t=i.from(t,t.offset,t.byteLength)),!i.isBuffer(e)||!i.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,o=0,s=Math.min(r,n);o<s;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},i.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return i.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=i.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var s=e[r];if(W(s,Uint8Array)&&(s=i.from(s)),!i.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,o),o+=s.length}return n},i.byteLength=g,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},i.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},i.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},i.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?R(this,0,e):b.apply(this,arguments)},i.prototype.toLocaleString=i.prototype.toString,i.prototype.equals=function(e){if(!i.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===i.compare(this,e)},i.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},i.prototype.compare=function(e,t,r,n,o){if(W(e,Uint8Array)&&(e=i.from(e,e.offset,e.byteLength)),!i.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,o>>>=0,this===e)return 0;for(var s=o-n,a=r-t,u=Math.min(s,a),l=this.slice(n,o),f=e.slice(t,r),c=0;c<u;++c)if(l[c]!==f[c]){s=l[c],a=f[c];break}return s<a?-1:a<s?1:0},i.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},i.prototype.indexOf=function(e,t,r){return _(this,e,t,r,!0)},i.prototype.lastIndexOf=function(e,t,r){return _(this,e,t,r,!1)},i.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return v(this,e,t,r);case"ascii":return S(this,e,t,r);case"latin1":case"binary":return E(this,e,t,r);case"base64":return C(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var G=4096;i.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=i.prototype,n},i.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},i.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},i.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},i.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},i.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},i.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},i.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},i.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},i.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},i.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},i.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},i.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},i.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},i.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),Y.read(this,e,!0,23,4)},i.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),Y.read(this,e,!1,23,4)},i.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),Y.read(this,e,!0,52,8)},i.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),Y.read(this,e,!1,52,8)},i.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;N(this,e,t,r,i,0)}var o=1,s=0;for(this[t]=255&e;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r},i.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;N(this,e,t,r,i,0)}var o=r-1,s=1;for(this[t+o]=255&e;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+r},i.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,255,0),this[t]=255&e,t+1},i.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},i.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},i.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);N(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},i.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},i.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},i.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},i.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},i.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},i.prototype.writeFloatLE=function(e,t,r){return x(this,e,t,!0,r)},i.prototype.writeFloatBE=function(e,t,r){return x(this,e,t,!1,r)},i.prototype.writeDoubleLE=function(e,t,r){return U(this,e,t,!0,r)},i.prototype.writeDoubleBE=function(e,t,r){return U(this,e,t,!1,r)},i.prototype.copy=function(e,t,r,n){if(!i.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var s=o-1;s>=0;--s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return o},i.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!i.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var o=e.charCodeAt(0);("utf8"===n&&o<128||"latin1"===n)&&(e=o)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var s;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(s=t;s<r;++s)this[s]=e;else{var a=i.isBuffer(e)?e:i.from(e,n),u=a.length;if(0===u)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<r-t;++s)this[s+t]=a[s%u]}return this};var J=/[^+/0-9A-Za-z-_]/g}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:5}],4:[function(e,t,r){"use strict";function n(e){console&&console.warn&&console.warn(e)}function i(){i.init.call(this)}function o(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function a(e,t,r,i){var a,u,l;if(o(r),u=e._events,void 0===u?(u=e._events=Object.create(null),e._eventsCount=0):(void 0!==u.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),u=e._events),l=u[t]),void 0===l)l=u[t]=r,++e._eventsCount;else if("function"==typeof l?l=u[t]=i?[r,l]:[l,r]:i?l.unshift(r):l.push(r),a=s(e),a>0&&l.length>a&&!l.warned){l.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+l.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=l.length,n(f)}return e}function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function l(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(n);return i.listener=r,n.wrapFn=i,i}function f(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?d(i):h(i,i.length)}function c(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function h(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function p(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function d(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function g(e,t){return new Promise(function(r,n){function i(){void 0!==o&&e.removeListener("error",o),r([].slice.call(arguments))}var o;"error"!==t&&(o=function(r){e.removeListener(t,i),n(r)},e.once("error",o)),e.once(t,i)})}var b,y="object"==typeof Reflect?Reflect:null,_=y&&"function"==typeof y.apply?y.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};b=y&&"function"==typeof y.ownKeys?y.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var m=Number.isNaN||function(e){return e!=e};t.exports=i,t.exports.once=g,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var w=10;Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return w},set:function(e){if("number"!=typeof e||e<0||m(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");w=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||m(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return s(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)_(a,this,t);else{var u=a.length,l=h(a,u);for(r=0;r<u;++r)_(l[r],this,t)}return!0},i.prototype.addListener=function(e,t){return a(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return a(this,e,t,!0)},i.prototype.once=function(e,t){return o(t),this.on(e,l(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return o(t),this.prependListener(e,l(this,e,t)),this},i.prototype.removeListener=function(e,t){var r,n,i,s,a;if(o(t),n=this._events,void 0===n)return this;if(r=n[e],void 0===r)return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){a=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():p(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,r,n;if(r=this._events,void 0===r)return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)i=o[n],"removeListener"!==i&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=r[e],"function"==typeof t)this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},i.prototype.listeners=function(e){return f(this,e,!0)},i.prototype.rawListeners=function(e){return f(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):c.call(e,t)},i.prototype.listenerCount=c,i.prototype.eventNames=function(){return this._eventsCount>0?b(this._events):[]}},{}],5:[function(e,t,r){r.read=function(e,t,r,n,i){var o,s,a=8*i-n-1,u=(1<<a)-1,l=u>>1,f=-7,c=r?i-1:0,h=r?-1:1,p=e[t+c];for(c+=h,o=p&(1<<-f)-1,p>>=-f,f+=a;f>0;o=256*o+e[t+c],c+=h,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=256*s+e[t+c],c+=h,f-=8);if(0===o)o=1-l;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=l}return(p?-1:1)*s*Math.pow(2,o-n)},r.write=function(e,t,r,n,i,o){var s,a,u,l=8*o-i-1,f=(1<<l)-1,c=f>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,d=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+c>=1?h/u:h*Math.pow(2,1-c),t*u>=2&&(s++,u/=2),s+c>=f?(a=0,s=f):s+c>=1?(a=(t*u-1)*Math.pow(2,i),s+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;e[r+p]=255&a,p+=d,a/=256,i-=8);for(s=s<<i|a,l+=i;l>0;e[r+p]=255&s,p+=d,s/=256,l-=8);e[r+p-d]|=128*g}},{}],6:[function(e,t,r){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function s(e){if(h===clearTimeout)return clearTimeout(e);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(e);try{return h(e)}catch(t){try{return h.call(null,e)}catch(t){return h.call(this,e)}}}function a(){b&&d&&(b=!1,d.length?g=d.concat(g):y=-1,g.length&&u())}function u(){if(!b){var e=o(a);b=!0;for(var t=g.length;t;){for(d=g,g=[];++y<t;)d&&d[y].run();y=-1,t=g.length}d=null,b=!1,s(e)}}function l(e,t){this.fun=e,this.array=t}function f(){}var c,h,p=t.exports={};(function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(e){c=n}try{h="function"==typeof clearTimeout?clearTimeout:i}catch(e){h=i}})();var d,g=[],b=!1,y=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];g.push(new l(e,t)),1!==g.length||b||o(u)},l.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=f,p.addListener=f,p.once=f,p.off=f,p.removeListener=f,p.removeAllListeners=f,p.emit=f,p.prependListener=f,p.prependOnceListener=f,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},{}],7:[function(e,t,r){(function(e){(function(){function r(t){return[0,1,2].map(r=>[0,1].map(i=>[0,1].map(o=>{const s=e.alloc(1);return s.writeUInt8(n.codes[t]<<n.CMD_SHIFT|(i?n.DUP_MASK:0)|r<<n.QOS_SHIFT|o,0,!0),s})))}const n=t.exports;n.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},n.codes={};for(const e in n.types){const t=n.types[e];n.codes[t]=e}n.CMD_SHIFT=4,n.CMD_MASK=240,n.DUP_MASK=8,n.QOS_MASK=3,n.QOS_SHIFT=1,n.RETAIN_MASK=1,n.VARBYTEINT_MASK=127,n.VARBYTEINT_FIN_MASK=128,n.VARBYTEINT_MAX=268435455,n.SESSIONPRESENT_MASK=1,n.SESSIONPRESENT_HEADER=e.from([n.SESSIONPRESENT_MASK]),n.CONNACK_HEADER=e.from([n.codes.connack<<n.CMD_SHIFT]),n.USERNAME_MASK=128,n.PASSWORD_MASK=64,n.WILL_RETAIN_MASK=32,n.WILL_QOS_MASK=24,n.WILL_QOS_SHIFT=3,n.WILL_FLAG_MASK=4,n.CLEAN_SESSION_MASK=2,n.CONNECT_HEADER=e.from([n.codes.connect<<n.CMD_SHIFT]),n.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8, |
| 2 | correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},n.propertiesCodes={};for(const e in n.properties){const t=n.properties[e];n.propertiesCodes[t]=e}n.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"},n.PUBLISH_HEADER=r("publish"),n.SUBSCRIBE_HEADER=r("subscribe"),n.SUBSCRIBE_OPTIONS_QOS_MASK=3,n.SUBSCRIBE_OPTIONS_NL_MASK=1,n.SUBSCRIBE_OPTIONS_NL_SHIFT=2,n.SUBSCRIBE_OPTIONS_RAP_MASK=1,n.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,n.SUBSCRIBE_OPTIONS_RH_MASK=3,n.SUBSCRIBE_OPTIONS_RH_SHIFT=4,n.SUBSCRIBE_OPTIONS_RH=[0,16,32],n.SUBSCRIBE_OPTIONS_NL=4,n.SUBSCRIBE_OPTIONS_RAP=8,n.SUBSCRIBE_OPTIONS_QOS=[0,1,2],n.UNSUBSCRIBE_HEADER=r("unsubscribe"),n.ACKS={unsuback:r("unsuback"),puback:r("puback"),pubcomp:r("pubcomp"),pubrel:r("pubrel"),pubrec:r("pubrec")},n.SUBACK_HEADER=e.from([n.codes.suback<<n.CMD_SHIFT]),n.VERSION3=e.from([3]),n.VERSION4=e.from([4]),n.VERSION5=e.from([5]),n.QOS=[0,1,2].map(t=>e.from([t])),n.EMPTY={pingreq:e.from([n.codes.pingreq<<4,0]),pingresp:e.from([n.codes.pingresp<<4,0]),disconnect:e.from([n.codes.disconnect<<4,0])}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:3}],8:[function(e,t,r){(function(r){(function(){function n(e,t){const r=new s;return i(e,r,t),r.concat()}const i=e("./writeToStream"),o=e("events");class s extends o{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0;const t=new Array(this._array.length),n=this._array;let i,o=0;for(i=0;i<n.length&&void 0!==n[i];i++)"string"!=typeof n[i]?t[i]=n[i].length:t[i]=r.byteLength(n[i]),e+=t[i];const s=r.allocUnsafe(e);for(i=0;i<n.length&&void 0!==n[i];i++)"string"!=typeof n[i]?(n[i].copy(s,o),o+=t[i]):(s.write(n[i],o),o+=t[i]);return s}}t.exports=n}).call(this)}).call(this,e("buffer").Buffer)},{"./writeToStream":38,buffer:3,events:4}],9:[function(e,t,r){window.parser=e("./parser").parser,window.generate=e("./generate"),window.writeToStream=e("./writeToStream")},{"./generate":8,"./parser":37,"./writeToStream":38}],10:[function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);n._init.call(this,e)}const{Buffer:i}=e("buffer"),o=Symbol.for("BufferList");n._init=function(e){Object.defineProperty(this,o,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},n.prototype._new=function(e){return new n(e)},n.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;r<this._bufs.length;r++){const n=t+this._bufs[r].length;if(e<n||r===this._bufs.length-1)return[r,e-t];t=n}},n.prototype._reverseOffset=function(e){const t=e[0];let r=e[1];for(let e=0;e<t;e++)r+=this._bufs[e].length;return r},n.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},n.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)},n.prototype.copy=function(e,t,r,n){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof n||n>this.length)&&(n=this.length),r>=this.length)return e||i.alloc(0);if(n<=0)return e||i.alloc(0);const o=!!e,s=this._offset(r),a=n-r;let u=a,l=o&&t||0,f=s[1];if(0===r&&n===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:i.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,l),l+=this._bufs[t].length;return e}if(u<=this._bufs[s[0]].length-f)return o?this._bufs[s[0]].copy(e,t,f,f+u):this._bufs[s[0]].slice(f,f+u);o||(e=i.allocUnsafe(a));for(let t=s[0];t<this._bufs.length;t++){const r=this._bufs[t].length-f;if(!(u>r)){this._bufs[t].copy(e,l,f,f+u),l+=r;break}this._bufs[t].copy(e,l,f),l+=r,u-=r,f&&(f=0)}return e.length>l?e.slice(0,l):e},n.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 r=this._offset(e),n=this._offset(t),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},n.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},n.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},n.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},n.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(i.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(i.from(e));return this},n.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},n.prototype.indexOf=function(e,t,r){if(void 0===r&&"string"==typeof t&&(r=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=i.from([e]):"string"==typeof e?e=i.from(e,r):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=i.from(e.buffer,e.byteOffset,e.byteLength):i.isBuffer(e)||(e=i.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const n=this._offset(t);let o=n[0],s=n[1];for(;o<this._bufs.length;o++){const t=this._bufs[o];for(;s<t.length;){const r=t.length-s;if(r>=e.length){const r=t.indexOf(e,s);if(-1!==r)return this._reverseOffset([o,r]);s=t.length-e.length+1}else{const t=this._reverseOffset([o,s]);if(this._match(t,e))return t;s++}}s=0}return-1},n.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)(function(t){null===e[t]?n.prototype[t]=function(e,r){return this.slice(e,e+r)[t](0,r)}:n.prototype[t]=function(r){return this.slice(r,r+e[t])[t](0)}})(t)}(),n.prototype._isBufferList=function(e){return e instanceof n||n.isBufferList(e)},n.isBufferList=function(e){return null!=e&&e[o]},t.exports=n},{buffer:3}],11:[function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);if("function"==typeof e){this._callback=e;const t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(e){e.on("error",t)}),this.on("unpipe",function(e){e.removeListener("error",t)}),e=null}s._init.call(this,e),i.call(this)}const i=e("readable-stream").Duplex,o=e("inherits"),s=e("./BufferList");o(n,i),Object.assign(n.prototype,s.prototype),n.prototype._new=function(e){return new n(e)},n.prototype._write=function(e,t,r){this._appendBuffer(e),"function"==typeof r&&r()},n.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},n.prototype.end=function(e){i.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},n.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},n.prototype._isBufferList=function(e){return e instanceof n||e instanceof s||n.isBufferList(e)},n.isBufferList=s.isBufferList,t.exports=n,t.exports.BufferListStream=n,t.exports.BufferList=s},{"./BufferList":10,inherits:14,"readable-stream":31}],12:[function(e,t,r){(function(n){(function(){function i(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function o(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{"%%"!==e&&(n++,"%c"===e&&(i=n))}),e.splice(i,0,r)}function s(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}}function a(){let e;try{e=r.storage.getItem("debug")}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}function u(){try{return localStorage}catch(e){}}r.formatArgs=o,r.save=s,r.load=a,r.useColors=i,r.storage=u(),r.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),r.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],r.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(r);const{formatters:l}=t.exports;l.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":13,_process:6}],13:[function(e,t,r){function n(t){function r(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return n.colors[Math.abs(t)%n.colors.length]}function n(e){function t(...e){if(!t.enabled)return;const i=t,o=Number(new Date),s=o-(r||o);i.diff=s,i.prev=r,i.curr=o,r=o,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,r)=>{if("%%"===t)return"%";a++;const o=n.formatters[r];if("function"==typeof o){const r=e[a];t=o.call(i,r),e.splice(a,1),a--}return t}),n.formatArgs.call(i,e);const u=i.log||n.log;u.apply(i,e)}let r,o=null;return t.namespace=e,t.useColors=n.useColors(),t.color=n.selectColor(e),t.extend=i,t.destroy=n.destroy,Object.defineProperty(t,"enabled",{enumerable:!0,configurable:!1,get:()=>null===o?n.enabled(e):o,set:e=>{o=e}}),"function"==typeof n.init&&n.init(t),t}function i(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function o(e){let t;n.save(e),n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(t=0;t<i;t++)r[t]&&(e=r[t].replace(/\*/g,".*?"),"-"===e[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function s(){const e=[...n.names.map(u),...n.skips.map(u).map(e=>"-"+e)].join(",");return n.enable(""),e}function a(e){if("*"===e[e.length-1])return!0;let t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1}function u(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}function l(e){return e instanceof Error?e.stack||e.message:e}function f(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.debug=n,n.default=n,n.coerce=l,n.disable=s,n.enable=o,n.enabled=a,n.humanize=e("ms"),n.destroy=f,Object.keys(t).forEach(e=>{n[e]=t[e]}),n.names=[],n.skips=[],n.formatters={},n.selectColor=r,n.enable(n.load()),n}t.exports=n},{ms:15}],14:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],15:[function(e,t,r){function n(e){if(e=String(e),!(e.length>100)){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){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*h;case"weeks":case"week":case"w":return r*c;case"days":case"day":case"d":return r*f;case"hours":case"hour":case"hrs":case"hr":case"h":return r*l;case"minutes":case"minute":case"mins":case"min":case"m":return r*u;case"seconds":case"second":case"secs":case"sec":case"s":return r*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function i(e){var t=Math.abs(e);return t>=f?Math.round(e/f)+"d":t>=l?Math.round(e/l)+"h":t>=u?Math.round(e/u)+"m":t>=a?Math.round(e/a)+"s":e+"ms"}function o(e){var t=Math.abs(e);return t>=f?s(e,t,f,"day"):t>=l?s(e,t,l,"hour"):t>=u?s(e,t,u,"minute"):t>=a?s(e,t,a,"second"):e+" ms"}function s(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}var a=1e3,u=60*a,l=60*u,f=24*l,c=7*f,h=365.25*f;t.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return n(e);if("number"===r&&isFinite(e))return t.long?o(e):i(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],16:[function(e,t,r){(function(e){(function(){"use strict";function r(t,r,n,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,s,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,r)});case 3:return e.nextTick(function(){t.call(null,r,n)});case 4:return e.nextTick(function(){t.call(null,r,n,i)});default:for(o=new Array(a-1),s=0;s<o.length;)o[s++]=arguments[s];return e.nextTick(function(){t.apply(null,o)})}}void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:r}:t.exports=e}).call(this)}).call(this,e("_process"))},{_process:6}],17:[function(e,t,r){"use strict";function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function i(e,t,r){function i(e,r,n){return"string"==typeof t?t:t(e,r,n)}r||(r=Error);var o=function(e){function t(t,r,n){return e.call(this,i(t,r,n))||this}return n(t,e),t}(r);o.prototype.name=r.name,o.prototype.code=e,l[e]=o}function o(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(e){return String(e)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function s(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function a(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function u(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}var l={};i("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),i("ERR_INVALID_ARG_TYPE",function(e,t,r){var n,i;if("string"==typeof t&&s(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be",a(e," argument"))i="The ".concat(e," ").concat(n," ").concat(o(t,"type"));else{var l=u(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(l," ").concat(n," ").concat(o(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=l},{}],18:[function(e,t,r){(function(r){(function(){"use strict";function n(e){if(!(this instanceof n))return new n(e);a.call(this,e),u.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",i)))}function i(){this._writableState.ended||r.nextTick(o,this)}function o(e){e.end()}var s=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=n;var a=e("./_stream_readable"),u=e("./_stream_writable");e("inherits")(n,a);for(var l=s(u.prototype),f=0;f<l.length;f++){var c=l[f];n.prototype[c]||(n.prototype[c]=u.prototype[c])}Object.defineProperty(n.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(n.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(n.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(n.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this)}).call(this,e("_process"))},{"./_stream_readable":20,"./_stream_writable":22,_process:6,inherits:14}],19:[function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);i.call(this,e)}t.exports=n;var i=e("./_stream_transform");e("inherits")(n,i),n.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":21,inherits:14}],20:[function(e,t,r){(function(r,n){(function(){"use strict";function i(e){return M.from(e)}function o(e){return M.isBuffer(e)||e instanceof N}function s(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function a(t,r,n){T=T||e("./_stream_duplex"),t=t||{},"boolean"!=typeof n&&(n=r instanceof T),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=q(this,t,"readableHighWaterMark",n),this.buffer=new F,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(x||(x=e("string_decoder/").StringDecoder),this.decoder=new x(t.encoding),this.encoding=t.encoding)}function u(t){if(T=T||e("./_stream_duplex"),!(this instanceof u))return new u(t);var r=this instanceof T;this._readableState=new a(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),L.call(this)}function l(e,t,r,n,o){O("readableAddChunk",t);var s,a=e._readableState;if(null===t)a.reading=!1,d(e,a);else if(o||(s=c(a,t)),s)Y(e,s);else if(a.objectMode||t&&t.length>0)if("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===M.prototype||(t=i(t)),n)a.endEmitted?Y(e,new Q):f(e,a,t,!0);else if(a.ended)Y(e,new W);else{if(a.destroyed)return!1;a.reading=!1,a.decoder&&!r?(t=a.decoder.write(t),a.objectMode||0!==t.length?f(e,a,t,!1):y(e,a)):f(e,a,t,!1)}else n||(a.reading=!1,y(e,a));return!a.ended&&(a.length<a.highWaterMark||0===a.length)}function f(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&g(e)),y(e,t)}function c(e,t){var r;return o(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new V("chunk",["string","Buffer","Uint8Array"],t)),r}function h(e){return e>=G?e=G:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function p(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=h(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function d(e,t){if(O("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?g(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,b(e)))}}function g(e){var t=e._readableState;O("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(O("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(b,e))}function b(e){var t=e._readableState;O("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,C(e)}function y(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(_,e,t))}function _(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(O("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function m(e){return function(){var t=e._readableState;O("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&B(e,"data")&&(t.flowing=!0,C(e))}}function w(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function v(e){O("readable nexttick read 0"),e.read(0)}function S(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(E,e,t))}function E(e,t){O("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),C(e),t.flowing&&!t.reading&&e.read(0)}function C(e){var t=e._readableState;for(O("flow",t.flowing);t.flowing&&null!==e.read(););}function I(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function k(e){var t=e._readableState;O("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(R,t,e))}function R(e,t){if(O("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function A(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}var T;t.exports=u,u.ReadableState=a;e("events").EventEmitter;var O,B=function(e,t){return e.listeners(t).length},L=e("./internal/streams/stream"),M=e("buffer").Buffer,N=n.Uint8Array||function(){},P=e("util");O=P&&P.debuglog?P.debuglog("stream"):function(){};var x,U,j,F=e("./internal/streams/buffer_list"),D=e("./internal/streams/destroy"),H=e("./internal/streams/state"),q=H.getHighWaterMark,K=e("../errors").codes,V=K.ERR_INVALID_ARG_TYPE,W=K.ERR_STREAM_PUSH_AFTER_EOF,$=K.ERR_METHOD_NOT_IMPLEMENTED,Q=K.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e("inherits")(u,L);var Y=D.errorOrDestroy,z=["error","close","destroy","pause","resume"];Object.defineProperty(u.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),u.prototype.destroy=D.destroy,u.prototype._undestroy=D.undestroy,u.prototype._destroy=function(e,t){t(e)},u.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&(t=t||n.defaultEncoding,t!==n.encoding&&(e=M.from(e,t),t=""),r=!0),l(this,e,t,!1,r)},u.prototype.unshift=function(e){return l(this,e,null,!0,!1)},u.prototype.isPaused=function(){return!1===this._readableState.flowing},u.prototype.setEncoding=function(t){x||(x=e("string_decoder/").StringDecoder);var r=new x(t);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,i="";null!==n;)i+=r.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var G=1073741824;u.prototype.read=function(e){O("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return O("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?k(this):g(this),null;if(e=p(e,t),0===e&&t.ended)return 0===t.length&&k(this),null;var n,i=t.needReadable;return O("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&(i=!0,O("length less than watermark",i)),t.ended||t.reading?(i=!1,O("reading or ended",i)):i&&(O("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=p(r,t))),n=e>0?I(e,t):null,null===n?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&k(this)),null!==n&&this.emit("data",n),n},u.prototype._read=function(e){Y(this,new $("_read()"))},u.prototype.pipe=function(e,t){function n(e,t){O("onunpipe"),e===h&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,o())}function i(){O("onend"),e.end()}function o(){O("cleanup"),e.removeListener("close",l),e.removeListener("finish",f),e.removeListener("drain",b),e.removeListener("error",u),e.removeListener("unpipe",n),h.removeListener("end",i),h.removeListener("end",c),h.removeListener("data",a),y=!0,!p.awaitDrain||e._writableState&&!e._writableState.needDrain||b()}function a(t){O("ondata");var r=e.write(t);O("dest.write",r),!1===r&&((1===p.pipesCount&&p.pipes===e||p.pipesCount>1&&-1!==A(p.pipes,e))&&!y&&(O("false write response, pause",p.awaitDrain),p.awaitDrain++),h.pause())}function u(t){O("onerror",t),c(),e.removeListener("error",u),0===B(e,"error")&&Y(e,t)}function l(){e.removeListener("finish",f),c()}function f(){O("onfinish"),e.removeListener("close",l),c()}function c(){O("unpipe"),h.unpipe(e)}var h=this,p=this._readableState;switch(p.pipesCount){case 0:p.pipes=e;break;case 1:p.pipes=[p.pipes,e];break;default:p.pipes.push(e)}p.pipesCount+=1,O("pipe count=%d opts=%j",p.pipesCount,t);var d=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,g=d?i:c;p.endEmitted?r.nextTick(g):h.once("end",g),e.on("unpipe",n);var b=m(h);e.on("drain",b);var y=!1;return h.on("data",a),s(e,"error",u),e.once("close",l),e.once("finish",f),e.emit("pipe",h),p.flowing||(O("pipe resume"),h.resume()),e},u.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r),this);if(!e){var n=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o<i;o++)n[o].emit("unpipe",this,{hasUnpiped:!1});return this}var s=A(t.pipes,e);return-1===s?this:(t.pipes.splice(s,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r),this)},u.prototype.on=function(e,t){var n=L.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,O("on readable",i.length,i.reading),i.length?g(this):i.reading||r.nextTick(v,this))),n},u.prototype.addListener=u.prototype.on,u.prototype.removeListener=function(e,t){var n=L.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick(w,this),n},u.prototype.removeAllListeners=function(e){var t=L.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick(w,this),t},u.prototype.resume=function(){var e=this._readableState;return e.flowing||(O("resume"),e.flowing=!e.readableListening,S(this,e)),e.paused=!1,this},u.prototype.pause=function(){return O("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(O("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},u.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var i in e.on("end",function(){if(O("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){if(O("wrapped data"),r.decoder&&(i=r.decoder.write(i)),(!r.objectMode||null!=i)&&(r.objectMode||i&&i.length)){var o=t.push(i);o||(n=!0,e.pause())}}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<z.length;o++)e.on(z[o],this.emit.bind(this,z[o]));return this._read=function(t){O("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(u.prototype[Symbol.asyncIterator]=function(){return void 0===U&&(U=e("./internal/streams/async_iterator")),U(this)}),Object.defineProperty(u.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(u.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(u.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),u._fromList=I,Object.defineProperty(u.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(u.from=function(t,r){return void 0===j&&(j=e("./internal/streams/from")),j(u,t,r)})}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":17,"./_stream_duplex":18,"./internal/streams/async_iterator":23, |
| 3 | "./internal/streams/buffer_list":24,"./internal/streams/destroy":25,"./internal/streams/from":27,"./internal/streams/state":29,"./internal/streams/stream":30,_process:6,buffer:3,events:4,inherits:14,"string_decoder/":33,util:2}],21:[function(e,t,r){"use strict";function n(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new l);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function i(e){if(!(this instanceof i))return new i(e);h.call(this,e),this._transformState={afterTransform:n.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",o)}function o(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?s(this,null,null):this._flush(function(t,r){s(e,t,r)})}function s(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new c;if(e._transformState.transforming)throw new f;return e.push(null)}t.exports=i;var a=e("../errors").codes,u=a.ERR_METHOD_NOT_IMPLEMENTED,l=a.ERR_MULTIPLE_CALLBACK,f=a.ERR_TRANSFORM_ALREADY_TRANSFORMING,c=a.ERR_TRANSFORM_WITH_LENGTH_0,h=e("./_stream_duplex");e("inherits")(i,h),i.prototype.push=function(e,t){return this._transformState.needTransform=!1,h.prototype.push.call(this,e,t)},i.prototype._transform=function(e,t,r){r(new u("_transform()"))},i.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},i.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},i.prototype._destroy=function(e,t){h.prototype._destroy.call(this,e,function(e){t(e)})}},{"../errors":17,"./_stream_duplex":18,inherits:14}],22:[function(e,t,r){(function(r,n){(function(){"use strict";function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){k(t,e)}}function o(e){return B.from(e)}function s(e){return B.isBuffer(e)||e instanceof L}function a(){}function u(t,r,n){R=R||e("./_stream_duplex"),t=t||{},"boolean"!=typeof n&&(n=r instanceof R),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=P(this,t,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===t.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){y(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function l(t){R=R||e("./_stream_duplex");var r=this instanceof R;if(!r&&!A.call(l,this))return new l(t);this._writableState=new u(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),O.call(this)}function f(e,t){var n=new K;W(e,n),r.nextTick(t,n)}function c(e,t,n,i){var o;return null===n?o=new q:"string"==typeof n||t.objectMode||(o=new U("chunk",["string","Buffer"],n)),!o||(W(e,o),r.nextTick(i,o),!1)}function h(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=B.from(t,r)),t}function p(e,t,r,n,i,o){if(!r){var s=h(t,n,i);n!==s&&(r=!0,i="buffer",n=s)}var a=t.objectMode?1:n.length;t.length+=a;var u=t.length<t.highWaterMark;if(u||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:i,isBuf:r,callback:o,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else d(e,t,!1,a,n,i,o);return u}function d(e,t,r,n,i,o,s){t.writelen=n,t.writecb=s,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new H("write")):r?e._writev(i,t.onwrite):e._write(i,o,t.onwrite),t.sync=!1}function g(e,t,n,i,o){--t.pendingcb,n?(r.nextTick(o,i),r.nextTick(C,e,t),e._writableState.errorEmitted=!0,W(e,i)):(o(i),e._writableState.errorEmitted=!0,W(e,i),C(e,t))}function b(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function y(e,t){var n=e._writableState,i=n.sync,o=n.writecb;if("function"!=typeof o)throw new F;if(b(n),t)g(e,n,i,t,o);else{var s=v(n)||e.destroyed;s||n.corked||n.bufferProcessing||!n.bufferedRequest||w(e,n),i?r.nextTick(_,e,n,s,o):_(e,n,s,o)}}function _(e,t,r,n){r||m(e,t),t.pendingcb--,n(),C(e,t)}function m(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function w(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,o=new Array(n),s=t.corkedRequestsFree;s.entry=r;for(var a=0,u=!0;r;)o[a]=r,r.isBuf||(u=!1),r=r.next,a+=1;o.allBuffers=u,d(e,t,!0,t.length,o,"",s.finish),t.pendingcb++,t.lastBufferedRequest=null,s.next?(t.corkedRequestsFree=s.next,s.next=null):t.corkedRequestsFree=new i(t),t.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,f=r.encoding,c=r.callback,h=t.objectMode?1:l.length;if(d(e,t,!1,h,l,f,c),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function v(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function S(e,t){e._final(function(r){t.pendingcb--,r&&W(e,r),t.prefinished=!0,e.emit("prefinish"),C(e,t)})}function E(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,r.nextTick(S,e,t)))}function C(e,t){var r=v(t);if(r&&(E(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}function I(e,t,n){t.ending=!0,C(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}function k(e,t,r){var n=e.entry;for(e.entry=null;n;){var i=n.callback;t.pendingcb--,i(r),n=n.next}t.corkedRequestsFree.next=e}var R;t.exports=l,l.WritableState=u;var A,T={deprecate:e("util-deprecate")},O=e("./internal/streams/stream"),B=e("buffer").Buffer,L=n.Uint8Array||function(){},M=e("./internal/streams/destroy"),N=e("./internal/streams/state"),P=N.getHighWaterMark,x=e("../errors").codes,U=x.ERR_INVALID_ARG_TYPE,j=x.ERR_METHOD_NOT_IMPLEMENTED,F=x.ERR_MULTIPLE_CALLBACK,D=x.ERR_STREAM_CANNOT_PIPE,H=x.ERR_STREAM_DESTROYED,q=x.ERR_STREAM_NULL_VALUES,K=x.ERR_STREAM_WRITE_AFTER_END,V=x.ERR_UNKNOWN_ENCODING,W=M.errorOrDestroy;e("inherits")(l,O),u.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(u.prototype,"buffer",{get:T.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(A=Function.prototype[Symbol.hasInstance],Object.defineProperty(l,Symbol.hasInstance,{value:function(e){return!!A.call(this,e)||this===l&&(e&&e._writableState instanceof u)}})):A=function(e){return e instanceof this},l.prototype.pipe=function(){W(this,new D)},l.prototype.write=function(e,t,r){var n=this._writableState,i=!1,u=!n.objectMode&&s(e);return u&&!B.isBuffer(e)&&(e=o(e)),"function"==typeof t&&(r=t,t=null),u?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=a),n.ending?f(this,r):(u||c(this,n,e,r))&&(n.pendingcb++,i=p(this,n,u,e,t,r)),i},l.prototype.cork=function(){this._writableState.corked++},l.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||w(this,e))},l.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new V(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),l.prototype._write=function(e,t,r){r(new j("_write()"))},l.prototype._writev=null,l.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||I(this,n,r),this},Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),l.prototype.destroy=M.destroy,l.prototype._undestroy=M.undestroy,l.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":17,"./_stream_duplex":18,"./internal/streams/destroy":25,"./internal/streams/state":29,"./internal/streams/stream":30,_process:6,buffer:3,inherits:14,"util-deprecate":34}],23:[function(e,t,r){(function(r){(function(){"use strict";function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){return{value:e,done:t}}function o(e){var t=e[f];if(null!==t){var r=e[b].read();null!==r&&(e[d]=null,e[f]=null,e[c]=null,t(i(r,!1)))}}function s(e){r.nextTick(o,e)}function a(e,t){return function(r,n){e.then(function(){t[p]?r(i(void 0,!0)):t[g](r,n)},n)}}var u,l=e("./end-of-stream"),f=Symbol("lastResolve"),c=Symbol("lastReject"),h=Symbol("error"),p=Symbol("ended"),d=Symbol("lastPromise"),g=Symbol("handlePromise"),b=Symbol("stream"),y=Object.getPrototypeOf(function(){}),_=Object.setPrototypeOf((u={get stream(){return this[b]},next:function(){var e=this,t=this[h];if(null!==t)return Promise.reject(t);if(this[p])return Promise.resolve(i(void 0,!0));if(this[b].destroyed)return new Promise(function(t,n){r.nextTick(function(){e[h]?n(e[h]):t(i(void 0,!0))})});var n,o=this[d];if(o)n=new Promise(a(o,this));else{var s=this[b].read();if(null!==s)return Promise.resolve(i(s,!1));n=new Promise(this[g])}return this[d]=n,n}},n(u,Symbol.asyncIterator,function(){return this}),n(u,"return",function(){var e=this;return new Promise(function(t,r){e[b].destroy(null,function(e){e?r(e):t(i(void 0,!0))})})}),u),y),m=function(e){var t,r=Object.create(_,(t={},n(t,b,{value:e,writable:!0}),n(t,f,{value:null,writable:!0}),n(t,c,{value:null,writable:!0}),n(t,h,{value:null,writable:!0}),n(t,p,{value:e._readableState.endEmitted,writable:!0}),n(t,g,{value:function(e,t){var n=r[b].read();n?(r[d]=null,r[f]=null,r[c]=null,e(i(n,!1))):(r[f]=e,r[c]=t)},writable:!0}),t));return r[d]=null,l(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[c];return null!==t&&(r[d]=null,r[f]=null,r[c]=null,t(e)),void(r[h]=e)}var n=r[f];null!==n&&(r[d]=null,r[f]=null,r[c]=null,n(i(void 0,!0))),r[p]=!0}),e.on("readable",s.bind(null,r)),r};t.exports=m}).call(this)}).call(this,e("_process"))},{"./end-of-stream":26,_process:6}],24:[function(e,t,r){"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){o(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function u(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}function l(e,t,r){c.prototype.copy.call(e,t,r)}var f=e("buffer"),c=f.Buffer,h=e("util"),p=h.inspect,d=p&&p.custom||"inspect";t.exports=function(){function e(){s(this,e),this.head=null,this.tail=null,this.length=0}return u(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return c.alloc(0);for(var t=c.allocUnsafe(e>>>0),r=this.head,n=0;r;)l(r.data,t,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var i=t.data,o=e>i.length?i.length:e;if(o===i.length?n+=i:n+=i.slice(0,e),e-=o,0===e){o===i.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(o));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=c.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var i=r.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),e-=o,0===e){o===i.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=i.slice(o));break}++n}return this.length-=n,t}},{key:d,value:function(e,t){return p(this,i({},t,{depth:0,customInspect:!1}))}}]),e}()},{buffer:3,util:2}],25:[function(e,t,r){(function(e){(function(){"use strict";function r(t,r){var o=this,a=this._readableState&&this._readableState.destroyed,u=this._writableState&&this._writableState.destroyed;return a||u?(r?r(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(s,this,t)):e.nextTick(s,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,function(t){!r&&t?o._writableState?o._writableState.errorEmitted?e.nextTick(i,o):(o._writableState.errorEmitted=!0,e.nextTick(n,o,t)):e.nextTick(n,o,t):r?(e.nextTick(i,o),r(t)):e.nextTick(i,o)}),this)}function n(e,t){s(e,t),i(e)}function i(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function s(e,t){e.emit("error",t)}function a(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}t.exports={destroy:r,undestroy:o,errorOrDestroy:a}}).call(this)}).call(this,e("_process"))},{_process:6}],26:[function(e,t,r){"use strict";function n(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];e.apply(this,n)}}}function i(){}function o(e){return e.setHeader&&"function"==typeof e.abort}function s(e,t,r){if("function"==typeof t)return s(e,null,t);t||(t={}),r=n(r||i);var u=t.readable||!1!==t.readable&&e.readable,l=t.writable||!1!==t.writable&&e.writable,f=function(){e.writable||h()},c=e._writableState&&e._writableState.finished,h=function(){l=!1,c=!0,u||r.call(e)},p=e._readableState&&e._readableState.endEmitted,d=function(){u=!1,p=!0,l||r.call(e)},g=function(t){r.call(e,t)},b=function(){var t;return u&&!p?(e._readableState&&e._readableState.ended||(t=new a),r.call(e,t)):l&&!c?(e._writableState&&e._writableState.ended||(t=new a),r.call(e,t)):void 0},y=function(){e.req.on("finish",h)};return o(e)?(e.on("complete",h),e.on("abort",b),e.req?y():e.on("request",y)):l&&!e._writableState&&(e.on("end",f),e.on("close",f)),e.on("end",d),e.on("finish",h),!1!==t.error&&e.on("error",g),e.on("close",b),function(){e.removeListener("complete",h),e.removeListener("abort",b),e.removeListener("request",y),e.req&&e.req.removeListener("finish",h),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",h),e.removeListener("end",d),e.removeListener("error",g),e.removeListener("close",b)}}var a=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;t.exports=s},{"../../../errors":17}],27:[function(e,t,r){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],28:[function(e,t,r){"use strict";function n(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}function i(e){if(e)throw e}function o(e){return e.setHeader&&"function"==typeof e.abort}function s(t,r,i,s){s=n(s);var a=!1;t.on("close",function(){a=!0}),void 0===c&&(c=e("./end-of-stream")),c(t,{readable:r,writable:i},function(e){if(e)return s(e);a=!0,s()});var u=!1;return function(e){if(!a&&!u)return u=!0,o(t)?t.abort():"function"==typeof t.destroy?t.destroy():void s(e||new d("pipe"))}}function a(e){e()}function u(e,t){return e.pipe(t)}function l(e){return e.length?"function"!=typeof e[e.length-1]?i:e.pop():i}function f(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,i=l(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new p("streams");var o=t.map(function(e,r){var u=r<t.length-1,l=r>0;return s(e,u,l,function(e){n||(n=e),e&&o.forEach(a),u||(o.forEach(a),i(n))})});return t.reduce(u)}var c,h=e("../../../errors").codes,p=h.ERR_MISSING_ARGS,d=h.ERR_STREAM_DESTROYED;t.exports=f},{"../../../errors":17,"./end-of-stream":26}],29:[function(e,t,r){"use strict";function n(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}function i(e,t,r,i){var s=n(t,i,r);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0){var a=i?r:"highWaterMark";throw new o(a,s)}return Math.floor(s)}return e.objectMode?16:16384}var o=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:i}},{"../../../errors":17}],30:[function(e,t,r){t.exports=e("events").EventEmitter},{events:4}],31:[function(e,t,r){r=t.exports=e("./lib/_stream_readable.js"),r.Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":18,"./lib/_stream_passthrough.js":19,"./lib/_stream_readable.js":20,"./lib/_stream_transform.js":21,"./lib/_stream_writable.js":22,"./lib/internal/streams/end-of-stream.js":26,"./lib/internal/streams/pipeline.js":28}],32:[function(e,t,r){function n(e,t){for(var r in e)t[r]=e[r]}function i(e,t,r){return s(e,t,r)}var o=e("buffer"),s=o.Buffer;s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?t.exports=o:(n(o,r),r.Buffer=i),i.prototype=Object.create(s.prototype),n(s,i),i.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return s(e,t,r)},i.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=s(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},i.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return s(e)},i.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o.SlowBuffer(e)}},{buffer:3}],33:[function(e,t,r){"use strict";function n(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function i(e){var t=n(e);if("string"!=typeof t&&(_.isEncoding===m||!m(e)))throw new Error("Unknown encoding: "+e);return t||e}function o(e){var t;switch(this.encoding=i(e),this.encoding){case"utf16le":this.text=h,this.end=p,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=d,this.end=g,t=3;break;default:return this.write=b,void(this.end=y)}this.lastNeed=0,this.lastTotal=0,this.lastChar=_.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e,t,r){var n=t.length-1;if(n<r)return 0;var i=s(t[n]);return i>=0?(i>0&&(e.lastNeed=i-1),i):--n<r||-2===i?0:(i=s(t[n]),i>=0?(i>0&&(e.lastNeed=i-2),i):--n<r||-2===i?0:(i=s(t[n]),i>=0?(i>0&&(2===i?i=0:e.lastNeed=i-3),i):0))}function u(e,t,r){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}function l(e){var t=this.lastTotal-this.lastNeed,r=u(this,e,t);return void 0!==r?r:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function f(e,t){var r=a(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t}function h(e,t){if((e.length-t)%2==0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function p(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function d(e,t){var r=(e.length-t)%3;return 0===r?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,1===r?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function g(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function b(e){return e.toString(this.encoding)}function y(e){return e&&e.length?this.write(e):""}var _=e("safe-buffer").Buffer,m=_.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};r.StringDecoder=o,o.prototype.write=function(e){if(0===e.length)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<e.length?t?t+this.text(e,r):this.text(e,r):t||""},o.prototype.end=c,o.prototype.text=f,o.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},{"safe-buffer":32}],34:[function(e,t,r){(function(e){(function(){function r(e,t){function r(){if(!i){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}if(n("noDeprecation"))return e;var i=!1;return r}function n(t){try{if(!e.localStorage)return!1}catch(e){return!1}var r=e.localStorage[t];return null!=r&&"true"===String(r).toLowerCase()}t.exports=r}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],35:[function(e,t,r){(function(e){(function(){function r(t){const r=e.allocUnsafe(2);return r.writeUInt8(t>>8,0),r.writeUInt8(255&t,1),r}function n(){for(let e=0;e<s;e++)a[e]=r(e)}function i(t){const r=4;let n=0,i=0;const o=e.allocUnsafe(r);do{n=t%128|0,t=t/128|0,t>0&&(n|=128),o.writeUInt8(n,i++)}while(t>0&&i<r);return t>0&&(i=0),u?o.subarray(0,i):o.slice(0,i)}function o(t){const r=e.allocUnsafe(4);return r.writeUInt32BE(t,0),r}const s=65536,a={},u=e.isBuffer(e.from([1,2]).subarray(0,1));t.exports={cache:a,generateCache:n,generateNumber:r,genBufVariableByteInt:i,generate4ByteBuffer:o}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:3}],36:[function(e,t,r){class n{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}t.exports=n},{}],37:[function(e,t,r){const n=e("bl"),i=e("events"),o=e("./packet"),s=e("./constants"),a=e("debug")("mqtt-packet:parser");class u extends i{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof u?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new u).parser(e)}_resetState(){a("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new o,this.error=null,this._list=n(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),a("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++,a("parse: state complete. _stateCounter is now: %d",this._stateCounter),a("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return a("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=s.types[e>>s.CMD_SHIFT],this.packet.retain=0!=(e&s.RETAIN_MASK),this.packet.qos=e>>s.QOS_SHIFT&s.QOS_MASK,this.packet.dup=0!=(e&s.DUP_MASK),a("_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)),a("_parseLength %d",e.value),!!e}_parsePayload(){a("_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 a("_parsePayload complete result: %s",e),e}_parseConnect(){let e,t,r,n;a("_parseConnect");const i={},o=this.packet,u=this._parseString();if(null===u)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==u&&"MQIsdp"!==u)return this._emitError(new Error("Invalid protocolId"));if(o.protocolId=u,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)&s.USERNAME_MASK,i.password=this._list.readUInt8(this._pos)&s.PASSWORD_MASK,i.will=this._list.readUInt8(this._pos)&s.WILL_FLAG_MASK,i.will&&(o.will={},o.will.retain=0!=(this._list.readUInt8(this._pos)&s.WILL_RETAIN_MASK),o.will.qos=(this._list.readUInt8(this._pos)&s.WILL_QOS_MASK)>>s.WILL_QOS_SHIFT),o.clean=0!=(this._list.readUInt8(this._pos)&s.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 l=this._parseString();if(null===l)return this._emitError(new Error("Packet too short"));if(o.clientId=l,a("_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,a("_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,a("_parseConnect: packet.will.paylaod: %s",o.will.payload)}if(i.username){if(n=this._parseString(),null===n)return this._emitError(new Error("Cannot parse username"));o.username=n,a("_parseConnect: packet.username: %s",o.username)}if(i.password){if(r=this._parseBuffer(),null===r)return this._emitError(new Error("Cannot parse password"));o.password=r}return this.settings=o,a("_parseConnect: complete"),o}_parseConnack(){a("_parseConnack");const e=this.packet;if(this._list.length<2)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&s.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)}a("_parseConnack: complete")}_parsePublish(){a("_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),a("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){a("_parseSubscribe");const e=this.packet;let t,r,n,i,o,u,l;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)} |
| 4 | for(;this._pos<e.length;){if(t=this._parseString(),null===t)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));r=this._parseByte(),n=r&s.SUBSCRIBE_OPTIONS_QOS_MASK,u=0!=(r>>s.SUBSCRIBE_OPTIONS_NL_SHIFT&s.SUBSCRIBE_OPTIONS_NL_MASK),o=0!=(r>>s.SUBSCRIBE_OPTIONS_RAP_SHIFT&s.SUBSCRIBE_OPTIONS_RAP_MASK),i=r>>s.SUBSCRIBE_OPTIONS_RH_SHIFT&s.SUBSCRIBE_OPTIONS_RH_MASK,l={topic:t,qos:n},5===this.settings.protocolVersion&&(l.nl=u,l.rap=o,l.rh=i),a("_parseSubscribe: push subscription `%s` to subscription",l),e.subscriptions.push(l)}}}_parseSuback(){a("_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._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){a("_parseUnsubscribe");const e=this.packet;if(e.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){const t=this._parseString();if(null===t)return this._emitError(new Error("Cannot parse topic"));a("_parseUnsubscribe: push topic `%s` to unsubscriptions",t),e.unsubscriptions.push(t)}}}_parseUnsuback(){a("_parseUnsuback");const e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(e.properties=t),e.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){a("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const e=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(e.length>2&&(e.reasonCode=this._parseByte(),a("_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(a("_parseDisconnect"),5===this.settings.protocolVersion){e.reasonCode=this._parseByte();const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return a("_parseDisconnect result: true"),!0}_parseAuth(){a("_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),a("_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):(a("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){const t=this._parseNum(),r=t+this._pos;if(-1===t||r>this._list.length||r>this.packet.length)return null;const n=this._list.toString("utf8",this._pos,r);return this._pos+=t,a("_parseString: result: %s",n),n}_parseStringPair(){return a("_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 r=this._list.slice(this._pos,t);return this._pos+=e,a("_parseBuffer: result: %o",r),r}_parseNum(){if(this._list.length-this._pos<2)return-1;const e=this._list.readUInt16BE(this._pos);return this._pos+=2,a("_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,a("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){a("_parseVarByteNum");const t=4;let r,n=0,i=1,o=0,u=!1;const l=this._pos?this._pos:0;for(;n<t;){if(r=this._list.readUInt8(l+n++),o+=i*(r&s.VARBYTEINT_MASK),i*=128,0==(r&s.VARBYTEINT_FIN_MASK)){u=!0;break}if(this._list.length<=n)break}return!u&&n===t&&this._list.length>=n&&this._emitError(new Error("Invalid variable byte integer")),l&&(this._pos+=n),u=!!u&&(e?{bytes:n,value:o}:o),a("_parseVarByteNum: result: %o",u),u}_parseByte(){const e=this._list.readUInt8(this._pos);return this._pos++,a("_parseByte: result: %o",e),e}_parseByType(e){switch(a("_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(){a("_parseProperties");const e=this._parseVarByteNum(),t=this._pos,r=t+e,n={};for(;this._pos<r;){const e=this._parseByte(),t=s.propertiesCodes[e];if(!t)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==t)n[t]?Array.isArray(n[t])?n[t].push(this._parseByType(s.propertiesTypes[t])):(n[t]=[n[t]],n[t].push(this._parseByType(s.propertiesTypes[t]))):n[t]=this._parseByType(s.propertiesTypes[t]);else{n[t]||(n[t]=Object.create(null));const e=this._parseByType(s.propertiesTypes[t]);if(n[t][e.name])if(Array.isArray(n[t][e.name]))n[t][e.name].push(e.value);else{const r=n[t][e.name];n[t][e.name]=[r],n[t][e.name].push(e.value)}else n[t][e.name]=e.value}}return n}_newPacket(){return a("_newPacket"),this.packet&&(this._list.consume(this.packet.length),a("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),a("_newPacket: new packet"),this.packet=new o,this._pos=0,!0}_emitError(e){a("_emitError"),this.error=e,this.emit("error",e)}}t.exports=u},{"./constants":7,"./packet":36,bl:11,debug:12,events:4}],38:[function(e,t,r){(function(r){(function(){function n(e,t,r){switch(N("generate called"),t.cork&&(t.cork(),M(i,t)),H&&(H=!1,U()),N("generate: packet.cmd: %s",e.cmd),e.cmd){case"connect":return o(e,t,r);case"connack":return s(e,t,r);case"publish":return a(e,t,r);case"puback":case"pubrec":case"pubrel":case"pubcomp":return u(e,t,r);case"subscribe":return l(e,t,r);case"suback":return f(e,t,r);case"unsubscribe":return c(e,t,r);case"unsuback":return h(e,t,r);case"pingreq":case"pingresp":return p(e,t,r);case"disconnect":return d(e,t,r);case"auth":return g(e,t,r);default:return t.emit("error",new Error("Unknown command")),!1}}function i(e){e.uncork()}function o(e,t,n){const i=e||{},o=i.protocolId||"MQTT",s=i.protocolVersion||4,a=i.will;let u=i.clean;const l=i.keepalive||0,f=i.clientId||"",c=i.username,h=i.password,p=i.properties;void 0===u&&(u=!0);let d=0;if(!o||"string"!=typeof o&&!r.isBuffer(o))return t.emit("error",new Error("Invalid protocolId")),!1;if(d+=o.length+2,3!==s&&4!==s&&5!==s)return t.emit("error",new Error("Invalid protocol version")),!1;if(d+=1,"string"!=typeof f&&!r.isBuffer(f)||!f&&4!==s||!f&&!u){if(s<4)return t.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*u==0)return t.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}else d+=f.length+2;if("number"!=typeof l||l<0||l>65535||l%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;if(d+=2,d+=1,5===s){var g=E(t,p);if(!g)return!1;d+=g.length}if(a){if("object"!=typeof a)return t.emit("error",new Error("Invalid will")),!1;if(!a.topic||"string"!=typeof a.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(d+=r.byteLength(a.topic)+2,d+=2,a.payload){if(!(a.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof a.payload?d+=r.byteLength(a.payload):d+=a.payload.length}var _={};if(5===s){if(_=E(t,a.properties),!_)return!1;d+=_.length}}let m=!1;if(null!=c){if(!A(c))return t.emit("error",new Error("Invalid username")),!1;m=!0,d+=r.byteLength(c)+2}if(null!=h){if(!m)return t.emit("error",new Error("Username is required to use password")),!1;if(!A(h))return t.emit("error",new Error("Invalid password")),!1;d+=R(h)+2}t.write(T.CONNECT_HEADER),b(t,d),S(t,o),t.write(4===s?T.VERSION4:5===s?T.VERSION5:T.VERSION3);let w=0;return w|=null!=c?T.USERNAME_MASK:0,w|=null!=h?T.PASSWORD_MASK:0,w|=a&&a.retain?T.WILL_RETAIN_MASK:0,w|=a&&a.qos?a.qos<<T.WILL_QOS_SHIFT:0,w|=a?T.WILL_FLAG_MASK:0,w|=u?T.CLEAN_SESSION_MASK:0,t.write(r.from([w])),D(t,l),5===s&&g.write(),S(t,f),a&&(5===s&&_.write(),y(t,a.topic),S(t,a.payload)),null!=c&&S(t,c),null!=h&&S(t,h),!0}function s(e,t,n){const i=n?n.protocolVersion:4,o=e||{},s=5===i?o.reasonCode:o.returnCode,a=o.properties;let u=2;if("number"!=typeof s)return t.emit("error",new Error("Invalid return code")),!1;let l=null;if(5===i){if(l=E(t,a),!l)return!1;u+=l.length}return t.write(T.CONNACK_HEADER),b(t,u),t.write(o.sessionPresent?T.SESSIONPRESENT_HEADER:B),t.write(r.from([s])),null!=l&&l.write(),!0}function a(e,t,n){N("publish: packet: %o",e);const i=n?n.protocolVersion:4,o=e||{},s=o.qos||0,a=o.retain?T.RETAIN_MASK:0,u=o.topic,l=o.payload||O,f=o.messageId,c=o.properties;let h=0;if("string"==typeof u)h+=r.byteLength(u)+2;else{if(!r.isBuffer(u))return t.emit("error",new Error("Invalid topic")),!1;h+=u.length+2}if(r.isBuffer(l)?h+=l.length:h+=r.byteLength(l),s&&"number"!=typeof f)return t.emit("error",new Error("Invalid messageId")),!1;s&&(h+=2);let p=null;if(5===i){if(p=E(t,c),!p)return!1;h+=p.length}return t.write(T.PUBLISH_HEADER[s][o.dup?1:0][a?1:0]),b(t,h),D(t,R(u)),t.write(u),s>0&&D(t,f),null!=p&&p.write(),N("publish: payload: %o",l),t.write(l)}function u(e,t,n){const i=n?n.protocolVersion:4,o=e||{},s=o.cmd||"puback",a=o.messageId,u=o.dup&&"pubrel"===s?T.DUP_MASK:0;let l=0;const f=o.reasonCode,c=o.properties;let h=5===i?3:2;if("pubrel"===s&&(l=1),"number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;let p=null;if(5===i&&"object"==typeof c){if(p=C(t,c,n,h),!p)return!1;h+=p.length}return t.write(T.ACKS[s][l][u][0]),b(t,h),D(t,a),5===i&&t.write(r.from([f])),null!==p&&p.write(),!0}function l(e,t,n){N("subscribe: packet: ");const i=n?n.protocolVersion:4,o=e||{},s=o.dup?T.DUP_MASK:0,a=o.messageId,u=o.subscriptions,l=o.properties;let f=0;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;f+=2;let c=null;if(5===i){if(c=E(t,l),!c)return!1;f+=c.length}if("object"!=typeof u||!u.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(let e=0;e<u.length;e+=1){const n=u[e].topic,o=u[e].qos;if("string"!=typeof n)return t.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof o)return t.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===i){const r=u[e].nl||!1;if("boolean"!=typeof r)return t.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;const n=u[e].rap||!1;if("boolean"!=typeof n)return t.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const i=u[e].rh||0;if("number"!=typeof i||i>2)return t.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}f+=r.byteLength(n)+2+1}N("subscribe: writing to stream: %o",T.SUBSCRIBE_HEADER),t.write(T.SUBSCRIBE_HEADER[1][s?1:0][0]),b(t,f),D(t,a),null!==c&&c.write();let h=!0;for(const e of u){const n=e.topic,o=e.qos,s=+e.nl,a=+e.rap,u=e.rh;let l;y(t,n),l=T.SUBSCRIBE_OPTIONS_QOS[o],5===i&&(l|=s?T.SUBSCRIBE_OPTIONS_NL:0,l|=a?T.SUBSCRIBE_OPTIONS_RAP:0,l|=u?T.SUBSCRIBE_OPTIONS_RH[u]:0),h=t.write(r.from([l]))}return h}function f(e,t,n){const i=n?n.protocolVersion:4,o=e||{},s=o.messageId,a=o.granted,u=o.properties;let l=0;if("number"!=typeof s)return t.emit("error",new Error("Invalid messageId")),!1;if(l+=2,"object"!=typeof a||!a.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<a.length;e+=1){if("number"!=typeof a[e])return t.emit("error",new Error("Invalid qos vector")),!1;l+=1}let f=null;if(5===i){if(f=C(t,u,n,l),!f)return!1;l+=f.length}return t.write(T.SUBACK_HEADER),b(t,l),D(t,s),null!==f&&f.write(),t.write(r.from(a))}function c(e,t,n){const i=n?n.protocolVersion:4,o=e||{},s=o.messageId,a=o.dup?T.DUP_MASK:0,u=o.unsubscriptions,l=o.properties;let f=0;if("number"!=typeof s)return t.emit("error",new Error("Invalid messageId")),!1;if(f+=2,"object"!=typeof u||!u.length)return t.emit("error",new Error("Invalid unsubscriptions")),!1;for(let e=0;e<u.length;e+=1){if("string"!=typeof u[e])return t.emit("error",new Error("Invalid unsubscriptions")),!1;f+=r.byteLength(u[e])+2}let c=null;if(5===i){if(c=E(t,l),!c)return!1;f+=c.length}t.write(T.UNSUBSCRIBE_HEADER[1][a?1:0][0]),b(t,f),D(t,s),null!==c&&c.write();let h=!0;for(let e=0;e<u.length;e++)h=y(t,u[e]);return h}function h(e,t,n){const i=n?n.protocolVersion:4,o=e||{},s=o.messageId,a=o.dup?T.DUP_MASK:0,u=o.granted,l=o.properties,f=o.cmd,c=0;let h=2;if("number"!=typeof s)return t.emit("error",new Error("Invalid messageId")),!1;if(5===i){if("object"!=typeof u||!u.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<u.length;e+=1){if("number"!=typeof u[e])return t.emit("error",new Error("Invalid qos vector")),!1;h+=1}}let p=null;if(5===i){if(p=C(t,l,n,h),!p)return!1;h+=p.length}return t.write(T.ACKS[f][c][a][0]),b(t,h),D(t,s),null!==p&&p.write(),5===i&&t.write(r.from(u)),!0}function p(e,t,r){return t.write(T.EMPTY[e.cmd])}function d(e,t,n){const i=n?n.protocolVersion:4,o=e||{},s=o.reasonCode,a=o.properties;let u=5===i?1:0,l=null;if(5===i){if(l=C(t,a,n,u),!l)return!1;u+=l.length}return t.write(r.from([T.codes.disconnect<<4])),b(t,u),5===i&&t.write(r.from([s])),null!==l&&l.write(),!0}function g(e,t,n){const i=n?n.protocolVersion:4,o=e||{},s=o.reasonCode,a=o.properties;let u=5===i?1:0;5!==i&&t.emit("error",new Error("Invalid mqtt version for auth packet"));const l=C(t,a,n,u);return!!l&&(u+=l.length,t.write(r.from([T.codes.auth<<4])),b(t,u),t.write(r.from([s])),null!==l&&l.write(),!0)}function b(e,t){if(t>T.VARBYTEINT_MAX)return e.emit("error",new Error(`Invalid variable byte integer: ${t}`)),!1;let r=q[t];return r||(r=j(t),t<16384&&(q[t]=r)),N("writeVarByteInt: writing to stream: %o",r),e.write(r)}function y(e,t){const n=r.byteLength(t);return D(e,n),N("writeString: %s",t),e.write(t,"utf8")}function _(e,t,r){y(e,t),y(e,r)}function m(e,t){return N("writeNumberCached: number: %d",t),N("writeNumberCached: %o",P[t]),e.write(P[t])}function w(e,t){const r=x(t);return N("writeNumberGenerated: %o",r),e.write(r)}function v(e,t){const r=F(t);return N("write4ByteNumber: %o",r),e.write(r)}function S(e,t){"string"==typeof t?y(e,t):t?(D(e,t.length),e.write(t)):D(e,0)}function E(e,t){function n(t,n){const i=T.propertiesTypes[t];let o=0;switch(i){case"byte":if("boolean"!=typeof n)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;o+=2;break;case"int8":if("number"!=typeof n||n<0||n>255)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;o+=2;break;case"binary":if(n&&null===n)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;o+=1+r.byteLength(n)+2;break;case"int16":if("number"!=typeof n||n<0||n>65535)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;o+=3;break;case"int32":if("number"!=typeof n||n<0||n>4294967295)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;o+=5;break;case"var":if("number"!=typeof n||n<0||n>268435455)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;o+=1+r.byteLength(j(n));break;case"string":if("string"!=typeof n)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;o+=3+r.byteLength(n.toString());break;case"pair":if("object"!=typeof n)return e.emit("error",new Error(`Invalid ${t}: ${n}`)),!1;o+=Object.getOwnPropertyNames(n).reduce((e,t)=>{const i=n[t];return Array.isArray(i)?e+=i.reduce((e,n)=>(e+=3+r.byteLength(t.toString())+2+r.byteLength(n.toString()),e),0):e+=3+r.byteLength(t.toString())+2+r.byteLength(n[t].toString()),e},0);break;default:return e.emit("error",new Error(`Invalid property ${t}: ${n}`)),!1}return o}if("object"!=typeof t||null!=t.length)return{length:1,write(){k(e,{},0)}};let i=0;if(t)for(const e in t){let r=0,o=0;const s=t[e];if(Array.isArray(s))for(let t=0;t<s.length;t++){if(o=n(e,s[t]),!o)return!1;r+=o}else{if(o=n(e,s),!o)return!1;r=o}if(!r)return!1;i+=r}const o=r.byteLength(j(i));return{length:o+i,write(){k(e,t,i)}}}function C(e,t,r,n){const i=["reasonString","userProperties"],o=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0;let s=E(e,t);if(o)for(;n+s.length>o;){const r=i.shift();if(!r||!t[r])return!1;delete t[r],s=E(e,t)}return s}function I(e,t,n){const i=T.propertiesTypes[t];switch(i){case"byte":e.write(r.from([T.properties[t]])),e.write(r.from([+n]));break;case"int8":e.write(r.from([T.properties[t]])),e.write(r.from([n]));break;case"binary":e.write(r.from([T.properties[t]])),S(e,n);break;case"int16":e.write(r.from([T.properties[t]])),D(e,n);break;case"int32":e.write(r.from([T.properties[t]])),v(e,n);break;case"var":e.write(r.from([T.properties[t]])),b(e,n);break;case"string":e.write(r.from([T.properties[t]])),y(e,n);break;case"pair":Object.getOwnPropertyNames(n).forEach(i=>{const o=n[i];Array.isArray(o)?o.forEach(n=>{e.write(r.from([T.properties[t]])),_(e,i.toString(),n.toString())}):(e.write(r.from([T.properties[t]])),_(e,i.toString(),o.toString()))});break;default:return e.emit("error",new Error(`Invalid property ${t} value: ${n}`)),!1}}function k(e,t,r){b(e,r);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&null!==t[r]){const n=t[r];if(Array.isArray(n))for(let t=0;t<n.length;t++)I(e,r,n[t]);else I(e,r,n)}}function R(e){return e?e instanceof r?e.length:r.byteLength(e):0}function A(e){return"string"==typeof e||e instanceof r}const T=e("./constants"),O=r.allocUnsafe(0),B=r.from([0]),L=e("./numbers"),M=e("process-nextick-args").nextTick,N=e("debug")("mqtt-packet:writeToStream"),P=L.cache,x=L.generateNumber,U=L.generateCache,j=L.genBufVariableByteInt,F=L.generate4ByteBuffer;let D=m,H=!0;Object.defineProperty(n,"cacheNumbers",{get:()=>D===m,set(e){e?(P&&0!==Object.keys(P).length||(H=!0),D=m):(H=!1,D=w)}});const q={};t.exports=n}).call(this)}).call(this,e("buffer").Buffer)},{"./constants":7,"./numbers":35,buffer:3,debug:12,"process-nextick-args":16}]},{},[9]); |