text: (function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e['default']}:function(){return e};return t.d(n,'a',n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p='',t(t.s=28)})([function(e){function t(){throw new Error('setTimeout has not been defined')}function n(){throw new Error('clearTimeout has not been defined')}function r(e){if(p===setTimeout)return setTimeout(e,0);if((p===t||!p)&&setTimeout)return p=setTimeout,setTimeout(e,0);try{return p(e,0)}catch(t){try{return p.call(null,e,0)}catch(t){return p.call(this,e,0)}}}function o(e){if(c===clearTimeout)return clearTimeout(e);if((c===n||!c)&&clearTimeout)return c=clearTimeout,clearTimeout(e);try{return c(e)}catch(t){try{return c.call(null,e)}catch(t){return c.call(this,e)}}}function i(){h&&g&&(h=!1,g.length?u=g.concat(u):f=-1,u.length&&s())}function s(){if(!h){var e=r(i);h=!0;for(var t=u.length;t;){for(g=u,u=[];++f<t;)g&&g[f].run();f=-1,t=u.length}g=null,h=!1,o(e)}}function a(e,t){this.fun=e,this.array=t}function d(){}var l=e.exports={},p,c;(function(){try{p='function'==typeof setTimeout?setTimeout:t}catch(n){p=t}try{c='function'==typeof clearTimeout?clearTimeout:n}catch(t){c=n}})();var u=[],h=!1,f=-1,g;l.nextTick=function(e){var t=Array(arguments.length-1);if(1<arguments.length)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new a(e,t)),1!==u.length||h||r(s)},a.prototype.run=function(){this.fun.apply(null,this.array)},l.title='browser',l.browser=!0,l.env={},l.argv=[],l.version='',l.versions={},l.on=d,l.addListener=d,l.once=d,l.off=d,l.removeListener=d,l.removeAllListeners=d,l.emit=d,l.prependListener=d,l.prependOnceListener=d,l.listeners=function(){return[]},l.binding=function(){throw new Error('process.binding is not supported')},l.cwd=function(){return'/'},l.chdir=function(){throw new Error('process.chdir is not supported')},l.umask=function(){return 0}},function(e){var t=function(){return this}();try{t=t||Function('return this')()||(1,eval)('this')}catch(n){'object'==typeof window&&(t=window)}e.exports=t},function(e,t,n){function r(e,t){for(var n in e)t[n]=e[n]}function o(e,t,n){return s(e,t,n)}var i=n(10),s=i.Buffer;s.from&&s.alloc&&s.allocUnsafe&&s.allocUnsafeSlow?e.exports=i:(r(i,t),t.Buffer=o),r(s,o),o.from=function(e,t,n){if('number'==typeof e)throw new TypeError('Argument must not be a number');return s(e,t,n)},o.alloc=function(e,t,n){if('number'!=typeof e)throw new TypeError('Argument must be a number');var r=s(e);return void 0===t?r.fill(0):'string'==typeof n?r.fill(t,n):r.fill(t),r},o.allocUnsafe=function(e){if('number'!=typeof e)throw new TypeError('Argument must be a number');return s(e)},o.allocUnsafeSlow=function(e){if('number'!=typeof e)throw new TypeError('Argument must be a number');return i.SlowBuffer(e)}},function(e){e.exports='function'==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){'use strict';function r(e){return this instanceof r?void(l.call(this,e),p.call(this,e),e&&!1===e.readable&&(this.readable=!1),e&&!1===e.writable&&(this.writable=!1),this.allowHalfOpen=!0,e&&!1===e.allowHalfOpen&&(this.allowHalfOpen=!1),this.once('end',o)):new r(e)}function o(){this.allowHalfOpen||this._writableState.ended||s.nextTick(i,this)}function i(e){e.end()}var s=n(6),a=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};e.exports=r;var d=n(7);d.inherits=n(3);var l=n(14),p=n(18);d.inherits(r,l);for(var c=a(p.prototype),u=0,h;u<c.length;u++)h=c[u],r.prototype[h]||(r.prototype[h]=p.prototype[h]);Object.defineProperty(r.prototype,'writableHighWaterMark',{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(r.prototype,'destroyed',{get:function(){return void 0===this._readableState||void 0===this._writableState?!1: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)}}),r.prototype._destroy=function(e,t){this.push(null),this.end(),s.nextTick(t,e)}},function(e){function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return'function'==typeof e}function r(e){return'number'==typeof e}function o(e){return'object'==typeof e&&null!==e}function s(e){return void 0===e}e.exports=t,t.EventEmitter=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if(!r(e)||0>e||isNaN(e))throw TypeError('n must be a positive number');return this._maxListeners=e,this},t.prototype.emit=function(e){var t,r,a,d,l,i;if(this._events||(this._events={}),'error'===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length))if(t=arguments[1],t instanceof Error)throw t;else{var p=new Error('Uncaught, unspecified "error" event. ('+t+')');throw p.context=t,p}if(r=this._events[e],s(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:d=Array.prototype.slice.call(arguments,1),r.apply(this,d);}else if(o(r))for(d=Array.prototype.slice.call(arguments,1),i=r.slice(),a=i.length,l=0;l<a;l++)i[l].apply(this,d);return!0},t.prototype.addListener=function(e,r){var i;if(!n(r))throw TypeError('listener must be a function');return this._events||(this._events={}),this._events.newListener&&this.emit('newListener',e,n(r.listener)?r.listener:r),this._events[e]?o(this._events[e])?this._events[e].push(r):this._events[e]=[this._events[e],r]:this._events[e]=r,o(this._events[e])&&!this._events[e].warned&&(i=s(this._maxListeners)?t.defaultMaxListeners:this._maxListeners,i&&0<i&&this._events[e].length>i&&(this._events[e].warned=!0,console.error('(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.',this._events[e].length),'function'==typeof console.trace&&console.trace())),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){function r(){this.removeListener(e,r),o||(o=!0,t.apply(this,arguments))}if(!n(t))throw TypeError('listener must be a function');var o=!1;return r.listener=t,this.on(e,r),this},t.prototype.removeListener=function(e,t){var r,s,a,d;if(!n(t))throw TypeError('listener must be a function');if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,s=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit('removeListener',e,t);else if(o(r)){for(d=a;0<d--;)if(r[d]===t||r[d].listener&&r[d].listener===t){s=d;break}if(0>s)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(s,1),this._events.removeListener&&this.emit('removeListener',e,t)}return this},t.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)'removeListener'!==t&&this.removeAllListeners(t);return this.removeAllListeners('removeListener'),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[],t},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){'use strict';(function(t){e.exports=t.version&&0!==t.version.indexOf('v0.')&&(0!==t.version.indexOf('v1.')||0===t.version.indexOf('v1.8.'))?t:{nextTick:function(e,n,r,o){if('function'!=typeof e)throw new TypeError('"callback" argument must be a function');var s=arguments.length,a,d;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick(function(){e.call(null,n)});case 3:return t.nextTick(function(){e.call(null,n,r)});case 4:return t.nextTick(function(){e.call(null,n,r,o)});default:for(a=Array(s-1),d=0;d<a.length;)a[d++]=arguments[d];return t.nextTick(function(){e.apply(null,a)});}}}}).call(t,n(0))},function(e,t,n){(function(e){function n(e){return Object.prototype.toString.call(e)}t.isArray=function(e){return Array.isArray?Array.isArray(e):'[object Array]'===n(e)},t.isBoolean=function(e){return'boolean'==typeof e},t.isNull=function(e){return null===e},t.isNullOrUndefined=function(e){return null==e},t.isNumber=function(e){return'number'==typeof e},t.isString=function(e){return'string'==typeof e},t.isSymbol=function(e){return'symbol'==typeof e},t.isUndefined=function(e){return void 0===e},t.isRegExp=function(e){return'[object RegExp]'===n(e)},t.isObject=function(e){return'object'==typeof e&&null!==e},t.isDate=function(e){return'[object Date]'===n(e)},t.isError=function(t){return'[object Error]'===n(t)||t instanceof Error},t.isFunction=function(e){return'function'==typeof e},t.isPrimitive=function(e){return null===e||'boolean'==typeof e||'number'==typeof e||'string'==typeof e||'symbol'==typeof e||'undefined'==typeof e},t.isBuffer=e.isBuffer}).call(t,n(10).Buffer)},function(e,t,n){t=e.exports=n(14),t.Stream=t,t.Readable=t,t.Writable=n(18),t.Duplex=n(4),t.Transform=n(20),t.PassThrough=n(40)},function(e){e.exports=function(){for(var e={},n=0,r;n<arguments.length;n++)for(var o in r=arguments[n],r)t.call(r,o)&&(e[o]=r[o]);return e};var t=Object.prototype.hasOwnProperty},function(e,t,n){'use strict';var r=Math.floor,o=Math.pow,s=String.fromCharCode,d=Math.min;(function(e){function i(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(i()<t)throw new RangeError('Invalid typed array length');return l.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=l.prototype):(null===e&&(e=new l(t)),e.length=t),e}function l(e,t,n){if(!l.TYPED_ARRAY_SUPPORT&&!(this instanceof l))return new l(e,t,n);if('number'==typeof e){if('string'==typeof t)throw new Error('If encoding is specified then the first argument must be a string');return h(this,e)}return p(this,e,t,n)}function p(e,t,n,r){if('number'==typeof t)throw new TypeError('"value" argument must not be a number');return'undefined'!=typeof ArrayBuffer&&t instanceof ArrayBuffer?m(e,t,n,r):'string'==typeof t?f(e,t,n):b(e,t)}function c(e){if('number'!=typeof e)throw new TypeError('"size" argument must be a number');else if(0>e)throw new RangeError('"size" argument must not be negative')}function u(e,t,n,r){return c(t),0>=t?a(e,t):void 0===n?a(e,t):'string'==typeof r?a(e,t).fill(n,r):a(e,t).fill(n)}function h(e,t){if(c(t),e=a(e,0>t?0:0|_(t)),!l.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function f(e,t,n){if(('string'!=typeof n||''===n)&&(n='utf8'),!l.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|y(t,n);e=a(e,r);var o=e.write(t,n);return o!==r&&(e=e.slice(0,o)),e}function g(e,t){var n=0>t.length?0:0|_(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function m(e,t,n,r){if(t.byteLength,0>n||t.byteLength<n)throw new RangeError('\'offset\' is out of bounds');if(t.byteLength<n+(r||0))throw new RangeError('\'length\' is out of bounds');return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),l.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=l.prototype):e=g(e,t),e}function b(e,t){if(l.isBuffer(t)){var n=0|_(t.length);return(e=a(e,n),0===e.length)?e:(t.copy(e,0,0,n),e)}if(t){if('undefined'!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||'length'in t)return'number'!=typeof t.length||X(t.length)?a(e,0):g(e,t);if('Buffer'===t.type&&te(t.data))return g(e,t.data)}throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')}function _(e){if(e>=i())throw new RangeError('Attempt to allocate Buffer larger than maximum size: 0x'+i().toString(16)+' bytes');return 0|e}function y(e,t){if(l.isBuffer(e))return e.length;if('undefined'!=typeof ArrayBuffer&&'function'==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;'string'!=typeof e&&(e=''+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case'ascii':case'latin1':case'binary':return n;case'utf8':case'utf-8':case void 0:return Q(e).length;case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return 2*n;case'hex':return n>>>1;case'base64':return J(e).length;default:if(r)return Q(e).length;t=(''+t).toLowerCase(),r=!0;}}function S(e,t,n){var r=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return'';if((void 0===n||n>this.length)&&(n=this.length),0>=n)return'';if(n>>>=0,t>>>=0,n<=t)return'';for(e||(e='utf8');;)switch(e){case'hex':return N(this,t,n);case'utf8':case'utf-8':return P(this,t,n);case'ascii':return O(this,t,n);case'latin1':case'binary':return M(this,t,n);case'base64':return A(this,t,n);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return U(this,t,n);default:if(r)throw new TypeError('Unknown encoding: '+e);e=(e+'').toLowerCase(),r=!0;}}function w(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function I(e,t,n,r,o){if(0===e.length)return-1;if('string'==typeof n?(r=n,n=0):2147483647<n?n=2147483647:-2147483648>n&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),0>n&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(0>n)if(o)n=0;else return-1;if('string'==typeof t&&(t=l.from(t,r)),l.isBuffer(t))return 0===t.length?-1:k(e,t,n,r,o);if('number'==typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&'function'==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):k(e,[t],n,r,o);throw new TypeError('val must be string, number or Buffer')}function k(e,t,n,r,o){function s(e,t){return 1==a?e[t]:e.readUInt16BE(t*a)}var a=1,d=e.length,l=t.length;if(void 0!==r&&(r=(r+'').toLowerCase(),'ucs2'===r||'ucs-2'===r||'utf16le'===r||'utf-16le'===r)){if(2>e.length||2>t.length)return-1;a=2,d/=2,l/=2,n/=2}var p;if(o){var i=-1;for(p=n;p<d;p++)if(s(e,p)!==s(t,-1==i?0:p-i))-1!=i&&(p-=p-i),i=-1;else if(-1==i&&(i=p),p-i+1===l)return i*a}else for(n+l>d&&(n=d-l),p=n;0<=p;p--){for(var c=!0,u=0;u<l;u++)if(s(e,p+u)!==s(t,u)){c=!1;break}if(c)return p}return-1}function E(e,t,n,r){n=+n||0;var o=e.length-n;r?(r=+r,r>o&&(r=o)):r=o;var s=t.length;if(0!=s%2)throw new TypeError('Invalid hex string');r>s/2&&(r=s/2);for(var a=0,i;a<r;++a){if(i=parseInt(t.substr(2*a,2),16),isNaN(i))return a;e[n+a]=i}return a}function T(e,t,n,r){return Z(Q(t,e.length-n),e,n,r)}function v(e,t,n,r){return Z(G(t),e,n,r)}function x(e,t,n,r){return v(e,t,n,r)}function C(e,t,n,r){return Z(J(t),e,n,r)}function R(e,t,n,r){return Z(V(t,e.length-n),e,n,r)}function A(e,t,n){return 0===t&&n===e.length?$.fromByteArray(e):$.fromByteArray(e.slice(t,n))}function P(e,t,n){n=d(e.length,n);for(var r=[],o=t;o<n;){var i=e[o],s=null,a=239<i?4:223<i?3:191<i?2:1;if(o+a<=n){var l,p,c,u;1==a?128>i&&(s=i):2==a?(l=e[o+1],128==(192&l)&&(u=(31&i)<<6|63&l,127<u&&(s=u))):3==a?(l=e[o+1],p=e[o+2],128==(192&l)&&128==(192&p)&&(u=(15&i)<<12|(63&l)<<6|63&p,2047<u&&(55296>u||57343<u)&&(s=u))):4==a?(l=e[o+1],p=e[o+2],c=e[o+3],128==(192&l)&&128==(192&p)&&128==(192&c)&&(u=(15&i)<<18|(63&l)<<12|(63&p)<<6|63&c,65535<u&&1114112>u&&(s=u))):void 0}null===s?(s=65533,a=1):65535<s&&(s-=65536,r.push(55296|1023&s>>>10),s=56320|1023&s),r.push(s),o+=a}return L(r)}function L(e){var t=e.length;if(t<=ne)return s.apply(String,e);for(var n='',r=0;r<t;)n+=s.apply(String,e.slice(r,r+=ne));return n}function O(e,t,n){var r='';n=d(e.length,n);for(var o=t;o<n;++o)r+=s(127&e[o]);return r}function M(e,t,n){var r='';n=d(e.length,n);for(var o=t;o<n;++o)r+=s(e[o]);return r}function N(e,t,n){var r=e.length;(!t||0>t)&&(t=0),(!n||0>n||n>r)&&(n=r);for(var o='',s=t;s<n;++s)o+=z(e[s]);return o}function U(e,t,n){for(var r=e.slice(t,n),o='',a=0;a<r.length;a+=2)o+=s(r[a]+256*r[a+1]);return o}function D(e,t,n){if(0!=e%1||0>e)throw new RangeError('offset is not uint');if(e+t>n)throw new RangeError('Trying to access beyond buffer length')}function B(e,t,n,r,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError('Index out of range')}function j(e,t,n,r){0>t&&(t=65535+t+1);for(var o=0,i=d(e.length-n,2);o<i;++o)e[n+o]=(t&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function q(e,t,n,r){0>t&&(t=4294967295+t+1);for(var o=0,i=d(e.length-n,4);o<i;++o)e[n+o]=255&t>>>8*(r?o:3-o)}function W(e,t,n,r){if(n+r>e.length)throw new RangeError('Index out of range');if(0>n)throw new RangeError('Index out of range')}function H(e,t,n,r,o){return o||W(e,t,n,4,3.4028234663852886e38,-3.4028234663852886e38),ee.write(e,t,n,r,23,4),n+4}function Y(e,t,n,r,o){return o||W(e,t,n,8,1.7976931348623157e308,-1.7976931348623157e308),ee.write(e,t,n,r,52,8),n+8}function K(e){if(e=F(e).replace(re,''),2>e.length)return'';for(;0!=e.length%4;)e+='=';return e}function F(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,'')}function z(e){return 16>e?'0'+e.toString(16):e.toString(16)}function Q(e,t){t=t||Infinity;for(var n=e.length,r=null,o=[],s=0,i;s<n;++s){if(i=e.charCodeAt(s),55295<i&&57344>i){if(!r){if(56319<i){-1<(t-=3)&&o.push(239,191,189);continue}else if(s+1===n){-1<(t-=3)&&o.push(239,191,189);continue}r=i;continue}if(56320>i){-1<(t-=3)&&o.push(239,191,189),r=i;continue}i=(r-55296<<10|i-56320)+65536}else r&&-1<(t-=3)&&o.push(239,191,189);if(r=null,128>i){if(0>(t-=1))break;o.push(i)}else if(2048>i){if(0>(t-=2))break;o.push(192|i>>6,128|63&i)}else if(65536>i){if(0>(t-=3))break;o.push(224|i>>12,128|63&i>>6,128|63&i)}else if(1114112>i){if(0>(t-=4))break;o.push(240|i>>18,128|63&i>>12,128|63&i>>6,128|63&i)}else throw new Error('Invalid code point')}return o}function G(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}function V(e,t){for(var n=[],r=0,o,i,s;r<e.length&&!(0>(t-=2));++r)o=e.charCodeAt(r),i=o>>8,s=o%256,n.push(s),n.push(i);return n}function J(e){return $.toByteArray(K(e))}function Z(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function X(e){return e!==e}/*!
   * The buffer module from node.js, for the browser.
   *
   * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
   * @license  MIT
   */var $=n(32),ee=n(33),te=n(15);t.Buffer=l,t.SlowBuffer=function(e){return+e!=e&&(e=0),l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=e.TYPED_ARRAY_SUPPORT===void 0?function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&'function'==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}():e.TYPED_ARRAY_SUPPORT,t.kMaxLength=i(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,n){return p(null,e,t,n)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,'undefined'!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,n){return u(null,e,t,n)},l.allocUnsafe=function(e){return h(null,e)},l.allocUnsafeSlow=function(e){return h(null,e)},l.isBuffer=function(e){return!!(null!=e&&e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('Arguments must be Buffers');if(e===t)return 0;for(var n=e.length,r=t.length,o=0,i=d(n,r);o<i;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},l.isEncoding=function(e){switch((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;}},l.concat=function(e,t){if(!te(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=l.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var i=e[n];if(!l.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,o),o+=i.length}return r},l.byteLength=y,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(0!=e%2)throw new RangeError('Buffer size must be a multiple of 16-bits');for(var t=0;t<e;t+=2)w(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(0!=e%4)throw new RangeError('Buffer size must be a multiple of 32-bits');for(var t=0;t<e;t+=4)w(this,t,t+3),w(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(0!=e%8)throw new RangeError('Buffer size must be a multiple of 64-bits');for(var t=0;t<e;t+=8)w(this,t,t+7),w(this,t+1,t+6),w(this,t+2,t+5),w(this,t+3,t+4);return this},l.prototype.toString=function(){var e=0|this.length;return 0==e?'':0===arguments.length?P(this,0,e):S.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError('Argument must be a Buffer');return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e='',n=t.INSPECT_MAX_BYTES;return 0<this.length&&(e=this.toString('hex',0,n).match(/.{2}/g).join(' '),this.length>n&&(e+=' ... ')),'<Buffer '+e+'>'},l.prototype.compare=function(e,t,n,r,o){if(!l.isBuffer(e))throw new TypeError('Argument must be a Buffer');if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),0>t||n>e.length||0>r||o>this.length)throw new RangeError('out of range index');if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,o>>>=0,this===e)return 0;for(var s=o-r,a=n-t,p=d(s,a),c=this.slice(r,o),u=e.slice(t,n),h=0;h<p;++h)if(c[h]!==u[h]){s=c[h],a=u[h];break}return s<a?-1:a<s?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return I(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return I(this,e,t,n,!1)},l.prototype.write=function(e,t,n,r){if(void 0===t)r='utf8',n=this.length,t=0;else if(void 0===n&&'string'==typeof t)r=t,n=this.length,t=0;else if(isFinite(t))t|=0,isFinite(n)?(n|=0,void 0===r&&(r='utf8')):(r=n,n=void 0);else throw new Error('Buffer.write(string, encoding, offset[, length]) is no longer supported');var o=this.length-t;if((void 0===n||n>o)&&(n=o),0<e.length&&(0>n||0>t)||t>this.length)throw new RangeError('Attempt to write outside buffer bounds');r||(r='utf8');for(var i=!1;;)switch(r){case'hex':return E(this,e,t,n);case'utf8':case'utf-8':return T(this,e,t,n);case'ascii':return v(this,e,t,n);case'latin1':case'binary':return x(this,e,t,n);case'base64':return C(this,e,t,n);case'ucs2':case'ucs-2':case'utf16le':case'utf-16le':return R(this,e,t,n);default:if(i)throw new TypeError('Unknown encoding: '+r);r=(''+r).toLowerCase(),i=!0;}},l.prototype.toJSON=function(){return{type:'Buffer',data:Array.prototype.slice.call(this._arr||this,0)}};var ne=4096;l.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),t<e&&(t=e);var r;if(l.TYPED_ARRAY_SUPPORT)r=this.subarray(e,t),r.__proto__=l.prototype;else{var o=t-e;r=new l(o,void 0);for(var s=0;s<o;++s)r[s]=this[s+e]}return r},l.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||D(e,t,this.length);for(var r=this[e],o=1,s=0;++s<t&&(o*=256);)r+=this[e+s]*o;return r},l.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||D(e,t,this.length);for(var r=this[e+--t],o=1;0<t&&(o*=256);)r+=this[e+--t]*o;return r},l.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||D(e,t,this.length);for(var r=this[e],s=1,a=0;++a<t&&(s*=256);)r+=this[e+a]*s;return s*=128,r>=s&&(r-=o(2,8*t)),r},l.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||D(e,t,this.length);for(var r=t,i=1,s=this[e+--r];0<r&&(i*=256);)s+=this[e+--r]*i;return i*=128,s>=i&&(s-=o(2,8*t)),s},l.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),ee.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),ee.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),ee.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),ee.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var s=o(2,8*n)-1;B(this,e,t,n,s,0)}var a=1,d=0;for(this[t]=255&e;++d<n&&(a*=256);)this[t+d]=255&e/a;return t+n},l.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t|=0,n|=0,!r){var s=o(2,8*n)-1;B(this,e,t,n,s,0)}var a=n-1,i=1;for(this[t+a]=255&e;0<=--a&&(i*=256);)this[t+a]=255&e/i;return t+n},l.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=r(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):q(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var s=o(2,8*n-1);B(this,e,t,n,s-1,-s)}var a=0,i=1,d=0;for(this[t]=255&e;++a<n&&(i*=256);)0>e&&0==d&&0!==this[t+a-1]&&(d=1),this[t+a]=255&(e/i>>0)-d;return t+n},l.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var s=o(2,8*n-1);B(this,e,t,n,s-1,-s)}var a=n-1,i=1,d=0;for(this[t+a]=255&e;0<=--a&&(i*=256);)0>e&&0==d&&0!==this[t+a+1]&&(d=1),this[t+a]=255&(e/i>>0)-d;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=r(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):q(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||B(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):q(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,n){return H(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return H(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return Y(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return Y(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),0<r&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError('targetStart out of bounds');if(0>n||n>=this.length)throw new RangeError('sourceStart out of bounds');if(0>r)throw new RangeError('sourceEnd out of bounds');r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var o=r-n,s;if(this===e&&n<t&&t<r)for(s=o-1;0<=s;--s)e[s+t]=this[s+n];else if(1e3>o||!l.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)e[s+t]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},l.prototype.fill=function(e,t,n,r){if('string'==typeof e){if('string'==typeof t?(r=t,t=0,n=this.length):'string'==typeof n&&(r=n,n=this.length),1===e.length){var o=e.charCodeAt(0);256>o&&(e=o)}if(void 0!==r&&'string'!=typeof r)throw new TypeError('encoding must be a string');if('string'==typeof r&&!l.isEncoding(r))throw new TypeError('Unknown encoding: '+r)}else'number'==typeof e&&(e&=255);if(0>t||this.length<t||this.length<n)throw new RangeError('Out of range index');if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||(e=0);var s;if('number'==typeof e)for(s=t;s<n;++s)this[s]=e;else{var i=l.isBuffer(e)?e:Q(new l(e,r).toString()),a=i.length;for(s=0;s<n-t;++s)this[s+t]=i[s%a]}return this};var re=/[^+\/0-9A-Za-z-_]/g}).call(t,n(1))},function(e,t,n){'use strict';function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(e,t,n){if(e&&a.isObject(e)&&e instanceof r)return e;var o=new r;return o.parse(e,t,n),o}var s=n(54),a=n(56);t.parse=o,t.resolve=function(e,t){return o(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?o(e,!1,!0).resolveObject(t):t},t.format=function(e){return a.isString(e)&&(e=o(e)),e instanceof r?e.format():r.prototype.format.call(e)},t.Url=r;var d=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,l=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,p=['{','}','|','\\','^','`'].concat(['<','>','"','`',' ','\r','\n','\t']),c=['\''].concat(p),u=['%','/','?',';','#'].concat(c),h=['/','?','#'],f=/^[+a-z0-9A-Z_-]{0,63}$/,g=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},b={javascript:!0,"javascript:":!0},_={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=n(57);r.prototype.parse=function(e,t,n){if(!a.isString(e))throw new TypeError('Parameter \'url\' must be a string, not '+typeof e);var r=e.indexOf('?'),o=-1!==r&&r<e.indexOf('#')?'?':'#',S=e.split(o),w=/\\/g;S[0]=S[0].replace(w,'/'),e=S.join(o);var I=e;if(I=I.trim(),!n&&1===e.split('#').length){var E=l.exec(I);if(E)return this.path=I,this.href=I,this.pathname=E[1],E[2]?(this.search=E[2],this.query=t?y.parse(this.search.substr(1)):this.search.substr(1)):t&&(this.search='',this.query={}),this}var T=d.exec(I);if(T){T=T[0];var v=T.toLowerCase();this.protocol=v,I=I.substr(T.length)}if(n||T||I.match(/^\/\/[^@\/]+@[^@\/]+/)){var x='//'===I.substr(0,2);x&&!(T&&b[T])&&(I=I.substr(2),this.slashes=!0)}if(!b[T]&&(x||T&&!_[T])){for(var C=-1,R=0,i;R<h.length;R++)i=I.indexOf(h[R]),-1!==i&&(-1==C||i<C)&&(C=i);var A,P;P=-1===C?I.lastIndexOf('@'):I.lastIndexOf('@',C),-1!==P&&(A=I.slice(0,P),I=I.slice(P+1),this.auth=decodeURIComponent(A)),C=-1;for(var R=0,i;R<u.length;R++)i=I.indexOf(u[R]),-1!==i&&(-1===C||i<C)&&(C=i);-1===C&&(C=I.length),this.host=I.slice(0,C),I=I.slice(C),this.parseHost(),this.hostname=this.hostname||'';var L='['===this.hostname[0]&&']'===this.hostname[this.hostname.length-1];if(!L)for(var O=this.hostname.split(/\./),R=0,M=O.length,N;R<M;R++)if(N=O[R],N&&!N.match(f)){for(var U='',D=0,B=N.length;D<B;D++)U+=127<N.charCodeAt(D)?'x':N[D];if(!U.match(f)){var k=O.slice(0,R),j=O.slice(R+1),q=N.match(g);q&&(k.push(q[1]),j.unshift(q[2])),j.length&&(I='/'+j.join('.')+I),this.hostname=k.join('.');break}}this.hostname=this.hostname.length>255?'':this.hostname.toLowerCase(),L||(this.hostname=s.toASCII(this.hostname));var W=this.port?':'+this.port:'',p=this.hostname||'';this.host=p+W,this.href+=this.host,L&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),'/'!==I[0]&&(I='/'+I))}if(!m[v])for(var R=0,M=c.length,H;R<M;R++)if(H=c[R],-1!==I.indexOf(H)){var Y=encodeURIComponent(H);Y===H&&(Y=escape(H)),I=I.split(H).join(Y)}var K=I.indexOf('#');-1!==K&&(this.hash=I.substr(K),I=I.slice(0,K));var F=I.indexOf('?');if(-1===F?t&&(this.search='',this.query={}):(this.search=I.substr(F),this.query=I.substr(F+1),t&&(this.query=y.parse(this.query)),I=I.slice(0,F)),I&&(this.pathname=I),_[v]&&this.hostname&&!this.pathname&&(this.pathname='/'),this.pathname||this.search){var W=this.pathname||'',z=this.search||'';this.path=W+z}return this.href=this.format(),this},r.prototype.format=function(){var e=this.auth||'';e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,':'),e+='@');var t=this.protocol||'',n=this.pathname||'',r=this.hash||'',o=!1,i='';this.host?o=e+this.host:this.hostname&&(o=e+(-1===this.hostname.indexOf(':')?this.hostname:'['+this.hostname+']'),this.port&&(o+=':'+this.port)),this.query&&a.isObject(this.query)&&Object.keys(this.query).length&&(i=y.stringify(this.query));var s=this.search||i&&'?'+i||'';return t&&':'!==t.substr(-1)&&(t+=':'),this.slashes||(!t||_[t])&&!1!==o?(o='//'+(o||''),n&&'/'!==n.charAt(0)&&(n='/'+n)):!o&&(o=''),r&&'#'!==r.charAt(0)&&(r='#'+r),s&&'?'!==s.charAt(0)&&(s='?'+s),n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),s=s.replace('#','%23'),t+o+n+s+r},r.prototype.resolve=function(e){return this.resolveObject(o(e,!1,!0)).format()},r.prototype.resolveObject=function(e){if(a.isString(e)){var t=new r;t.parse(e,!1,!0),e=t}for(var n=new r,o=Object.keys(this),d=0,l;d<o.length;d++)l=o[d],n[l]=this[l];if(n.hash=e.hash,''===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var c=Object.keys(e),u=0,h;u<c.length;u++)h=c[u],'protocol'!==h&&(n[h]=e[h]);return _[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname='/'),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!_[e.protocol]){for(var f=Object.keys(e),g=0,m;g<f.length;g++)m=f[g],n[m]=e[m];return n.href=n.format(),n}if(n.protocol=e.protocol,!e.host&&!b[e.protocol]){for(var y=(e.pathname||'').split('/');y.length&&!(e.host=y.shift()););e.host||(e.host=''),e.hostname||(e.hostname=''),''!==y[0]&&y.unshift(''),2>y.length&&y.unshift(''),n.pathname=y.join('/')}else n.pathname=e.pathname;if(n.search=e.search,n.query=e.query,n.host=e.host||'',n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var S=n.pathname||'',p=n.search||'';n.path=S+p}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var s=n.pathname&&'/'===n.pathname.charAt(0),w=e.host||e.pathname&&'/'===e.pathname.charAt(0),I=w||s||n.host&&e.pathname,k=I,E=n.pathname&&n.pathname.split('/')||[],y=e.pathname&&e.pathname.split('/')||[],T=n.protocol&&!_[n.protocol];if(T&&(n.hostname='',n.port=null,n.host&&(''===E[0]?E[0]=n.host:E.unshift(n.host)),n.host='',e.protocol&&(e.hostname=null,e.port=null,e.host&&(''===y[0]?y[0]=e.host:y.unshift(e.host)),e.host=null),I=I&&(''===y[0]||''===E[0])),w)n.host=e.host||''===e.host?e.host:n.host,n.hostname=e.hostname||''===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,E=y;else if(y.length)E||(E=[]),E.pop(),E=E.concat(y),n.search=e.search,n.query=e.query;else if(!a.isNullOrUndefined(e.search)){if(T){n.hostname=n.host=E.shift();var v=n.host&&0<n.host.indexOf('@')&&n.host.split('@');v&&(n.auth=v.shift(),n.host=n.hostname=v.shift())}return n.search=e.search,n.query=e.query,a.isNull(n.pathname)&&a.isNull(n.search)||(n.path=(n.pathname?n.pathname:'')+(n.search?n.search:'')),n.href=n.format(),n}if(!E.length)return n.pathname=null,n.path=n.search?'/'+n.search:null,n.href=n.format(),n;for(var x=E.slice(-1)[0],C=(n.host||e.host||1<E.length)&&('.'===x||'..'===x)||''===x,R=0,A=E.length;0<=A;A--)x=E[A],'.'===x?E.splice(A,1):'..'===x?(E.splice(A,1),R++):R&&(E.splice(A,1),R--);if(!I&&!k)for(;R--;R)E.unshift('..');I&&''!==E[0]&&(!E[0]||'/'!==E[0].charAt(0))&&E.unshift(''),C&&'/'!==E.join('/').substr(-1)&&E.push('');var i=''===E[0]||E[0]&&'/'===E[0].charAt(0);if(T){n.hostname=n.host=i?'':E.length?E.shift():'';var v=n.host&&0<n.host.indexOf('@')&&n.host.split('@');v&&(n.auth=v.shift(),n.host=n.hostname=v.shift())}return I=I||n.host&&E.length,I&&!i&&E.unshift(''),E.length?n.pathname=E.join('/'):(n.pathname=null,n.path=null),a.isNull(n.pathname)&&a.isNull(n.search)||(n.path=(n.pathname?n.pathname:'')+(n.search?n.search:'')),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var e=this.host,t=i.exec(e);t&&(t=t[0],':'!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,n){'use strict';var r=n(61);e.exports=function(e,t){function n(n){t.rejectUnauthorized&&e.emit('error',n),o.end()}var o;return t.port=t.port||8883,t.host=t.hostname||t.host||'localhost',t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,o=r.connect(t),o.on('secureConnect',function(){t.rejectUnauthorized&&!o.authorized?o.emit('error',new Error('TLS not authorized')):o.removeListener('error',n)}),o.on('error',n),o}},function(e,t,n){'use strict';(function(t){function r(e){return this instanceof r?void(this.options=e||{},this.options=o(i,e),this._inflights={}):new r(e)}var o=n(9),s=n(8).Readable,a={objectMode:!0},i={clean:!0};r.prototype.put=function(e,t){return this._inflights[e.messageId]=e,t&&t(),this},r.prototype.createStream=function(){var e=new s(a),n=this._inflights,r=Object.keys(this._inflights),o=!1,d=0;return e._read=function(){!o&&d<r.length?this.push(n[r[d++]]):this.push(null)},e.destroy=function(){if(!o){var e=this;o=!0,t.nextTick(function(){e.emit('close')})}},e},r.prototype.del=function(e,t){return e=this._inflights[e.messageId],e?(delete this._inflights[e.messageId],t(null,e)):t&&t(new Error('missing packet')),this},r.prototype.get=function(e,t){return e=this._inflights[e.messageId],e?t(null,e):t&&t(new Error('missing packet')),this},r.prototype.close=function(e){this.options.clean&&(this._inflights=null),e&&e()},e.exports=r}).call(t,n(0))},function(e,t,n){'use strict';(function(t,r){function o(e){return B.from(e)}function i(e){return B.isBuffer(e)||e instanceof j}function s(e,t,n){return'function'==typeof e.prependListener?e.prependListener(t,n):void(e._events&&e._events[t]?O(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n))}function a(e,t){M=M||n(4),e=e||{};var r=t instanceof M;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var o=e.highWaterMark,i=e.readableHighWaterMark,s=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(i||0===i)?i:s,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new Y,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.destroyed=!1,this.defaultEncoding=e.defaultEncoding||'utf8',this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(!F&&(F=n(19).StringDecoder),this.decoder=new F(e.encoding),this.encoding=e.encoding)}function d(e){return M=M||n(4),this instanceof d?void(this._readableState=new a(e,this),this.readable=!0,e&&('function'==typeof e.read&&(this._read=e.read),'function'==typeof e.destroy&&(this._destroy=e.destroy)),D.call(this)):new d(e)}function l(e,t,n,r,i){var s=e._readableState;if(null===t)s.reading=!1,g(e,s);else{var a;i||(a=c(s,t)),a?e.emit('error',a):s.objectMode||t&&0<t.length?('string'!=typeof t&&!s.objectMode&&Object.getPrototypeOf(t)!==B.prototype&&(t=o(t)),r?s.endEmitted?e.emit('error',new Error('stream.unshift() after end event')):p(e,s,t,!0):s.ended?e.emit('error',new Error('stream.push() after EOF')):(s.reading=!1,s.decoder&&!n?(t=s.decoder.write(t),s.objectMode||0!==t.length?p(e,s,t,!1):_(e,s)):p(e,s,t,!1))):!r&&(s.reading=!1)}return u(s)}function p(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(e.emit('data',n),e.read(0)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&m(e)),_(e,t)}function c(e,t){var n;return i(t)||'string'==typeof t||void 0===t||e.objectMode||(n=new TypeError('Invalid non-string/buffer chunk')),n}function u(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function h(e){return e>=Q?e=Q:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function f(e,t){return 0>=e||0===t.length&&t.ended?0:t.objectMode?1:e===e?(e>t.highWaterMark&&(t.highWaterMark=h(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0)):t.flowing&&t.length?t.buffer.head.data.length:t.length}function g(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,m(e)}}function m(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(H('emitReadable',t.flowing),t.emittedReadable=!0,t.sync?L.nextTick(b,e):b(e))}function b(e){H('emit readable'),e.emit('readable'),E(e)}function _(e,t){t.readingMore||(t.readingMore=!0,L.nextTick(y,e,t))}function y(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(H('maybeReadMore read 0'),e.read(0),n!==t.length);)n=t.length;t.readingMore=!1}function S(e){return function(){var t=e._readableState;H('pipeOnDrain',t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&U(e,'data')&&(t.flowing=!0,E(e))}}function w(e){H('readable nexttick read 0'),e.read(0)}function I(e,t){t.resumeScheduled||(t.resumeScheduled=!0,L.nextTick(k,e,t))}function k(e,t){t.reading||(H('resume read 0'),e.read(0)),t.resumeScheduled=!1,t.awaitDrain=0,e.emit('resume'),E(e),t.flowing&&!t.reading&&e.read(0)}function E(e){var t=e._readableState;for(H('flow',t.flowing);t.flowing&&null!==e.read(););}function T(e,t){if(0===t.length)return null;var r;return t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(''):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):r=v(e,t.buffer,t.decoder),r}function v(e,t,n){var r;return e<t.head.data.length?(r=t.head.data.slice(0,e),t.head.data=t.head.data.slice(e)):e===t.head.data.length?r=t.shift():r=n?x(e,t):C(e,t),r}function x(e,t){var n=t.head,r=1,o=n.data;for(e-=o.length;n=n.next;){var i=n.data,s=e>i.length?i.length:e;if(o+=s===i.length?i:i.slice(0,e),e-=s,0===e){s===i.length?(++r,t.head=n.next?n.next:t.tail=null):(t.head=n,n.data=i.slice(s));break}++r}return t.length-=r,o}function C(e,t){var n=B.allocUnsafe(e),r=t.head,o=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var i=r.data,s=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,s),e-=s,0===e){s===i.length?(++o,t.head=r.next?r.next:t.tail=null):(t.head=r,r.data=i.slice(s));break}++o}return t.length-=o,n}function R(e){var t=e._readableState;if(0<t.length)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,L.nextTick(A,t,e))}function A(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit('end'))}function P(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}var L=n(6);e.exports=d;var O=n(15),M;d.ReadableState=a;var N=n(5).EventEmitter,U=function(e,t){return e.listeners(t).length},D=n(16),B=n(2).Buffer,j=t.Uint8Array||function(){},q=n(7);q.inherits=n(3);var W=n(34),H=void 0;H=W&&W.debuglog?W.debuglog('stream'):function(){};var Y=n(35),K=n(17),F;q.inherits(d,D);var z=['error','close','destroy','pause','resume'];Object.defineProperty(d.prototype,'destroyed',{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),d.prototype.destroy=K.destroy,d.prototype._undestroy=K.undestroy,d.prototype._destroy=function(e,t){this.push(null),t(e)},d.prototype.push=function(e,t){var n=this._readableState,r;return n.objectMode?r=!0:'string'==typeof e&&(t=t||n.defaultEncoding,t!==n.encoding&&(e=B.from(e,t),t=''),r=!0),l(this,e,t,!1,r)},d.prototype.unshift=function(e){return l(this,e,null,!0,!1)},d.prototype.isPaused=function(){return!1===this._readableState.flowing},d.prototype.setEncoding=function(e){return F||(F=n(19).StringDecoder),this._readableState.decoder=new F(e),this._readableState.encoding=e,this};var Q=8388608;d.prototype.read=function(e){H('read',e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return H('read: emitReadable',t.length,t.ended),0===t.length&&t.ended?R(this):m(this),null;if(e=f(e,t),0===e&&t.ended)return 0===t.length&&R(this),null;var r=t.needReadable;H('need readable',r),(0===t.length||t.length-e<t.highWaterMark)&&(r=!0,H('length less than watermark',r)),t.ended||t.reading?(r=!1,H('reading or ended',r)):r&&(H('do read'),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,!t.reading&&(e=f(n,t)));var o;return o=0<e?T(e,t):null,null===o?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(!t.ended&&(t.needReadable=!0),n!==e&&t.ended&&R(this)),null!==o&&this.emit('data',o),o},d.prototype._read=function(){this.emit('error',new Error('_read() is not implemented'))},d.prototype.pipe=function(e,t){function n(e,t){H('onunpipe'),e===u&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,i())}function o(){H('onend'),e.end()}function i(){H('cleanup'),e.removeListener('close',l),e.removeListener('finish',p),e.removeListener('drain',m),e.removeListener('error',d),e.removeListener('unpipe',n),u.removeListener('end',o),u.removeListener('end',c),u.removeListener('data',a),b=!0,h.awaitDrain&&(!e._writableState||e._writableState.needDrain)&&m()}function a(t){H('ondata'),_=!1;var n=e.write(t);!1!==n||_||((1===h.pipesCount&&h.pipes===e||1<h.pipesCount&&-1!==P(h.pipes,e))&&!b&&(H('false write response, pause',u._readableState.awaitDrain),u._readableState.awaitDrain++,_=!0),u.pause())}function d(t){H('onerror',t),c(),e.removeListener('error',d),0===U(e,'error')&&e.emit('error',t)}function l(){e.removeListener('finish',p),c()}function p(){H('onfinish'),e.removeListener('close',l),c()}function c(){H('unpipe'),u.unpipe(e)}var u=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e);}h.pipesCount+=1,H('pipe count=%d opts=%j',h.pipesCount,t);var f=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr,g=f?o:c;h.endEmitted?L.nextTick(g):u.once('end',g),e.on('unpipe',n);var m=S(u);e.on('drain',m);var b=!1,_=!1;return u.on('data',a),s(e,'error',d),e.once('close',l),e.once('finish',p),e.emit('pipe',u),h.flowing||(H('pipe resume'),u.resume()),e},d.prototype.unpipe=function(e){var t=this._readableState,n={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,n),this);if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var s=0;s<o;s++)r[s].emit('unpipe',this,n);return this}var i=P(t.pipes,e);return-1===i?this:(t.pipes.splice(i,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit('unpipe',this,n),this)},d.prototype.on=function(e,t){var n=D.prototype.on.call(this,e,t);if('data'===e)!1!==this._readableState.flowing&&this.resume();else if('readable'===e){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&m(this):L.nextTick(w,this))}return n},d.prototype.addListener=d.prototype.on,d.prototype.resume=function(){var e=this._readableState;return e.flowing||(H('resume'),e.flowing=!0,I(this,e)),this},d.prototype.pause=function(){return H('call pause flowing=%j',this._readableState.flowing),!1!==this._readableState.flowing&&(H('pause'),this._readableState.flowing=!1,this.emit('pause')),this},d.prototype.wrap=function(e){var t=this,r=this._readableState,o=!1;for(var s in e.on('end',function(){if(H('wrapped end'),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on('data',function(n){if((H('wrapped data'),r.decoder&&(n=r.decoder.write(n)),!(r.objectMode&&(null===n||void 0===n)))&&(r.objectMode||n&&n.length)){var i=t.push(n);i||(o=!0,e.pause())}}),e)void 0===this[s]&&'function'==typeof e[s]&&(this[s]=function(t){return function(){return e[t].apply(e,arguments)}}(s));for(var i=0;i<z.length;i++)e.on(z[i],this.emit.bind(this,z[i]));return this._read=function(t){H('wrapped _read',t),o&&(o=!1,e.resume())},this},Object.defineProperty(d.prototype,'readableHighWaterMark',{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),d._fromList=T}).call(t,n(1),n(0))},function(e){var t={}.toString;e.exports=Array.isArray||function(e){return'[object Array]'==t.call(e)}},function(e,t,n){e.exports=n(5).EventEmitter},function(e,t,n){'use strict';function r(e,t){e.emit('error',t)}var o=n(6);e.exports={destroy:function(e,t){var n=this,i=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return i||s?(t?t(e):e&&(!this._writableState||!this._writableState.errorEmitted)&&o.nextTick(r,this,e),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(e){!t&&e?(o.nextTick(r,n,e),n._writableState&&(n._writableState.errorEmitted=!0)):t&&t(e)}),this)},undestroy:function(){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.finished=!1,this._writableState.errorEmitted=!1)}}},function(e,t,n){'use strict';(function(t,r,o){function i(e){var t=this;this.next=null,this.entry=null,this.finish=function(){x(t,e)}}function s(e){return M.from(e)}function a(e){return M.isBuffer(e)||e instanceof N}function d(){}function l(e,t){A=A||n(4),e=e||{};var r=t instanceof A;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var o=e.highWaterMark,s=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(s||0===s)?s:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var d=!1===e.decodeStrings;this.decodeStrings=!d,this.defaultEncoding=e.defaultEncoding||'utf8',this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){_(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new i(this)}function p(e){return A=A||n(4),D.call(p,this)||this instanceof A?void(this._writableState=new l(e,this),this.writable=!0,e&&('function'==typeof e.write&&(this._write=e.write),'function'==typeof e.writev&&(this._writev=e.writev),'function'==typeof e.destroy&&(this._destroy=e.destroy),'function'==typeof e.final&&(this._final=e.final)),O.call(this)):new p(e)}function c(e,t){var n=new Error('write after end');e.emit('error',n),C.nextTick(t,n)}function u(e,t,n,r){var o=!0,i=!1;return null===n?i=new TypeError('May not write null values to stream'):'string'!=typeof n&&void 0!==n&&!t.objectMode&&(i=new TypeError('Invalid non-string/buffer chunk')),i&&(e.emit('error',i),C.nextTick(r,i),o=!1),o}function h(e,t,n){return e.objectMode||!1===e.decodeStrings||'string'!=typeof t||(t=M.from(t,n)),t}function f(e,t,n,r,o,i){if(!n){var s=h(t,r,o);r!==s&&(n=!0,o='buffer',r=s)}var a=t.objectMode?1:r.length;t.length+=a;var d=t.length<t.highWaterMark;if(d||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:o,isBuf:n,callback:i,next:null},l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else g(e,t,!1,a,r,o,i);return d}function g(e,t,n,r,o,i,s){t.writelen=r,t.writecb=s,t.writing=!0,t.sync=!0,n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function m(e,t,n,r,o){--t.pendingcb,n?(C.nextTick(o,r),C.nextTick(T,e,t),e._writableState.errorEmitted=!0,e.emit('error',r)):(o(r),e._writableState.errorEmitted=!0,e.emit('error',r),T(e,t))}function b(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function _(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if(b(n),t)m(e,n,r,t,o);else{var i=I(n);i||n.corked||n.bufferProcessing||!n.bufferedRequest||w(e,n),r?R(y,e,n,i,o):y(e,n,i,o)}}function y(e,t,n,r){n||S(e,t),t.pendingcb--,r(),T(e,t)}function S(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit('drain'))}function w(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=Array(r),s=t.corkedRequestsFree;s.entry=n;for(var a=0,d=!0;n;)o[a]=n,n.isBuf||(d=!1),n=n.next,a+=1;o.allBuffers=d,g(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(;n;){var l=n.chunk,p=n.encoding,c=n.callback,u=t.objectMode?1:l.length;if(g(e,t,!1,u,l,p,c),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function I(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function k(e,t){e._final(function(n){t.pendingcb--,n&&e.emit('error',n),t.prefinished=!0,e.emit('prefinish'),T(e,t)})}function E(e,t){t.prefinished||t.finalCalled||('function'==typeof e._final?(t.pendingcb++,t.finalCalled=!0,C.nextTick(k,e,t)):(t.prefinished=!0,e.emit('prefinish')))}function T(e,t){var n=I(t);return n&&(E(e,t),0===t.pendingcb&&(t.finished=!0,e.emit('finish'))),n}function v(e,t,n){t.ending=!0,T(e,t),n&&(t.finished?C.nextTick(n):e.once('finish',n)),t.ended=!0,e.writable=!1}function x(e,t,n){var r=e.entry;for(e.entry=null;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}var C=n(6);e.exports=p;var R=!t.browser&&-1<['v0.10','v0.9.'].indexOf(t.version.slice(0,5))?r:C.nextTick,A;p.WritableState=l;var P=n(7);P.inherits=n(3);var L={deprecate:n(39)},O=n(16),M=n(2).Buffer,N=o.Uint8Array||function(){},U=n(17);P.inherits(p,O),l.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(l.prototype,'buffer',{get:L.deprecate(function(){return this.getBuffer()},'_writableState.buffer is deprecated. Use _writableState.getBuffer instead.','DEP0003')})}catch(e){}}();var D;'function'==typeof Symbol&&Symbol.hasInstance&&'function'==typeof Function.prototype[Symbol.hasInstance]?(D=Function.prototype[Symbol.hasInstance],Object.defineProperty(p,Symbol.hasInstance,{value:function(e){return!!D.call(this,e)||!(this!==p)&&e&&e._writableState instanceof l}})):D=function(e){return e instanceof this},p.prototype.pipe=function(){this.emit('error',new Error('Cannot pipe, not readable'))},p.prototype.write=function(e,t,n){var r=this._writableState,o=!1,i=!r.objectMode&&a(e);return i&&!M.isBuffer(e)&&(e=s(e)),'function'==typeof t&&(n=t,t=null),i?t='buffer':!t&&(t=r.defaultEncoding),'function'!=typeof n&&(n=d),r.ended?c(this,n):(i||u(this,r,e,n))&&(r.pendingcb++,o=f(this,r,i,e,t,n)),o},p.prototype.cork=function(){var e=this._writableState;e.corked++},p.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,!e.writing&&!e.corked&&!e.finished&&!e.bufferProcessing&&e.bufferedRequest&&w(this,e))},p.prototype.setDefaultEncoding=function(e){if('string'==typeof e&&(e=e.toLowerCase()),!(-1<['hex','utf8','utf-8','ascii','binary','base64','ucs2','ucs-2','utf16le','utf-16le','raw'].indexOf((e+'').toLowerCase())))throw new TypeError('Unknown encoding: '+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(p.prototype,'writableHighWaterMark',{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),p.prototype._write=function(e,t,n){n(new Error('_write() is not implemented'))},p.prototype._writev=null,p.prototype.end=function(e,t,n){var r=this._writableState;'function'==typeof e?(n=e,e=null,t=null):'function'==typeof t&&(n=t,t=null),null!==e&&e!==void 0&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||v(this,r,n)},Object.defineProperty(p.prototype,'destroyed',{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),p.prototype.destroy=U.destroy,p.prototype._undestroy=U.undestroy,p.prototype._destroy=function(e,t){this.end(),t(e)}}).call(t,n(0),n(37).setImmediate,n(1))},function(e,t,n){'use strict';function r(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 o(e){var t=r(e);if('string'!=typeof t&&(m.isEncoding===b||!b(e)))throw new Error('Unknown encoding: '+e);return t||e}function i(e){this.encoding=o(e);var t;switch(this.encoding){case'utf16le':this.text=p,this.end=c,t=4;break;case'utf8':this.fillLast=l,t=4;break;case'base64':this.text=u,this.end=h,t=3;break;default:return this.write=f,void(this.end=g);}this.lastNeed=0,this.lastTotal=0,this.lastChar=m.allocUnsafe(t)}function s(e){if(127>=e)return 0;return 6==e>>5?2:14==e>>4?3:30==e>>3?4:2==e>>6?-1:-2}function a(e,t,n){var r=t.length-1;if(r<n)return 0;var o=s(t[r]);return 0<=o?(0<o&&(e.lastNeed=o-1),o):--r<n||-2===o?0:(o=s(t[r]),0<=o)?(0<o&&(e.lastNeed=o-2),o):--r<n||-2===o?0:(o=s(t[r]),0<=o?(0<o&&(2===o?o=0:e.lastNeed=o-3),o):0)}function d(e,t){if(128!=(192&t[0]))return e.lastNeed=0,'\uFFFD';if(1<e.lastNeed&&1<t.length){if(128!=(192&t[1]))return e.lastNeed=1,'\uFFFD';if(2<e.lastNeed&&2<t.length&&128!=(192&t[2]))return e.lastNeed=2,'\uFFFD'}}function l(e){var t=this.lastTotal-this.lastNeed,n=d(this,e,t);return void 0===n?this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length):n}function p(e,t){if(0==(e.length-t)%2){var n=e.toString('utf16le',t);if(n){var r=n.charCodeAt(n.length-1);if(55296<=r&&56319>=r)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString('utf16le',t,e.length-1)}function c(e){var t=e&&e.length?this.write(e):'';if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString('utf16le',0,n)}return t}function u(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 h(e){var t=e&&e.length?this.write(e):'';return this.lastNeed?t+this.lastChar.toString('base64',0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function g(e){return e&&e.length?this.write(e):''}var m=n(2).Buffer,b=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;}};t.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return'';var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return'';n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||''},i.prototype.end=function(e){var t=e&&e.length?this.write(e):'';return this.lastNeed?t+'\uFFFD':t},i.prototype.text=function(e,t){var n=a(this,e,t);if(!this.lastNeed)return e.toString('utf8',t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString('utf8',t,r)},i.prototype.fillLast=function(e){return this.lastNeed<=e.length?(e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):void(e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length)}},function(e,t,n){'use strict';function r(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit('error',new Error('write callback called multiple times'));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function o(e){return this instanceof o?void(a.call(this,e),this._transformState={afterTransform:r.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',i)):new o(e)}function i(){var e=this;'function'==typeof this._flush?this._flush(function(t,n){s(e,t,n)}):s(this,null,null)}function s(e,t,n){if(t)return e.emit('error',t);if(null!=n&&e.push(n),e._writableState.length)throw new Error('Calling transform done when ws.length != 0');if(e._transformState.transforming)throw new Error('Calling transform done when still transforming');return e.push(null)}e.exports=o;var a=n(4),d=n(7);d.inherits=n(3),d.inherits(o,a),o.prototype.push=function(e,t){return this._transformState.needTransform=!1,a.prototype.push.call(this,e,t)},o.prototype._transform=function(){throw new Error('_transform() is not implemented')},o.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var o=this._readableState;(r.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},o.prototype._read=function(){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},o.prototype._destroy=function(e,t){var n=this;a.prototype._destroy.call(this,e,function(e){t(e),n.emit('close')})}},function(e,t,n){var r=n(41),o=function(){},i=function(e){return e.setHeader&&'function'==typeof e.abort},s=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},a=function(e,t,n){if('function'==typeof t)return a(e,null,t);t||(t={}),n=r(n||o);var d=e._writableState,l=e._readableState,p=t.readable||!1!==t.readable&&e.readable,c=t.writable||!1!==t.writable&&e.writable,u=function(){e.writable||h()},h=function(){c=!1,p||n.call(e)},f=function(){p=!1,c||n.call(e)},g=function(t){n.call(e,t?new Error('exited with error code: '+t):null)},m=function(t){n.call(e,t)},b=function(){return p&&!(l&&l.ended)?n.call(e,new Error('premature close')):c&&!(d&&d.ended)?n.call(e,new Error('premature close')):void 0},_=function(){e.req.on('finish',h)};return i(e)?(e.on('complete',h),e.on('abort',b),e.req?_():e.on('request',_)):c&&!d&&(e.on('end',u),e.on('close',u)),s(e)&&e.on('exit',g),e.on('end',f),e.on('finish',h),!1!==t.error&&e.on('error',m),e.on('close',b),function(){e.removeListener('complete',h),e.removeListener('abort',b),e.removeListener('request',_),e.req&&e.req.removeListener('finish',h),e.removeListener('end',u),e.removeListener('close',u),e.removeListener('finish',h),e.removeListener('exit',g),e.removeListener('end',f),e.removeListener('error',m),e.removeListener('close',b)}};e.exports=a},function(e,t,n){'use strict';function r(e){return[0,1,2].map(function(t){return[0,1].map(function(n){return[0,1].map(function(r){var s=new o(1);return s.writeUInt8(i.codes[e]<<i.CMD_SHIFT|(n?i.DUP_MASK:0)|t<<i.QOS_SHIFT|r,0,!0),s})})})}var o=n(2).Buffer,i=e.exports;for(var s in i.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:'reserved'},i.codes={},i.types){var a=i.types[s];i.codes[a]=s}i.CMD_SHIFT=4,i.CMD_MASK=240,i.DUP_MASK=8,i.QOS_MASK=3,i.QOS_SHIFT=1,i.RETAIN_MASK=1,i.LENGTH_MASK=127,i.LENGTH_FIN_MASK=128,i.SESSIONPRESENT_MASK=1,i.SESSIONPRESENT_HEADER=o.from([i.SESSIONPRESENT_MASK]),i.CONNACK_HEADER=o.from([i.codes.connack<<i.CMD_SHIFT]),i.USERNAME_MASK=128,i.PASSWORD_MASK=64,i.WILL_RETAIN_MASK=32,i.WILL_QOS_MASK=24,i.WILL_QOS_SHIFT=3,i.WILL_FLAG_MASK=4,i.CLEAN_SESSION_MASK=2,i.CONNECT_HEADER=o.from([i.codes.connect<<i.CMD_SHIFT]),i.PUBLISH_HEADER=r('publish'),i.SUBSCRIBE_HEADER=r('subscribe'),i.UNSUBSCRIBE_HEADER=r('unsubscribe'),i.ACKS={unsuback:r('unsuback'),puback:r('puback'),pubcomp:r('pubcomp'),pubrel:r('pubrel'),pubrec:r('pubrec')},i.SUBACK_HEADER=o.from([i.codes.suback<<i.CMD_SHIFT]),i.VERSION3=o.from([3]),i.VERSION4=o.from([4]),i.QOS=[0,1,2].map(function(e){return o.from([e])}),i.EMPTY={pingreq:o.from([i.codes.pingreq<<4,0]),pingresp:o.from([i.codes.pingresp<<4,0]),disconnect:o.from([i.codes.disconnect<<4,0])}},function(e,t,n){'use strict';function r(e,t){switch(t.cork&&(t.cork(),x(o,t)),L&&(L=!1,A()),e.cmd){case'connect':return i(e,t);case'connack':return s(e,t);case'publish':return a(e,t);case'puback':case'pubrec':case'pubrel':case'pubcomp':case'unsuback':return d(e,t);case'subscribe':return l(e,t);case'suback':return p(e,t);case'unsubscribe':return c(e,t);case'pingreq':case'pingresp':case'disconnect':return u(e,t);default:return t.emit('error',new Error('Unknown command')),!1;}}function o(e){e.uncork()}function i(e,t){var n=e||{},r=n.protocolId||'MQTT',o=n.protocolVersion||4,i=n.will,s=n.clean,a=n.keepalive||0,d=n.clientId||'',l=n.username,p=n.password;void 0===s&&(s=!0);var c=0;if(!r||'string'!=typeof r&&!k.isBuffer(r))return t.emit('error',new Error('Invalid protocolId')),!1;if(c+=r.length+2,3!==o&&4!==o)return t.emit('error',new Error('Invalid protocol version')),!1;if(c+=1,('string'==typeof d||k.isBuffer(d))&&(d||4===o)&&(d||s))c+=d.length+2;else{if(4>o)return t.emit('error',new Error('clientId must be supplied before 3.1.1')),!1;if(0==1*s)return t.emit('error',new Error('clientId must be given if cleanSession set to 0')),!1}if('number'!=typeof a||0>a||65535<a||0!=a%1)return t.emit('error',new Error('Invalid keepalive')),!1;if(c+=2,c+=1,i){if('object'!=typeof i)return t.emit('error',new Error('Invalid will')),!1;if(!i.topic||'string'!=typeof i.topic)return t.emit('error',new Error('Invalid will topic')),!1;if(c+=k.byteLength(i.topic)+2,!(i.payload&&i.payload))c+=2;else if(0<=i.payload.length)c+='string'==typeof i.payload?k.byteLength(i.payload)+2:i.payload.length+2;else return t.emit('error',new Error('Invalid will payload')),!1}var u=!1;if(null!=l)if(w(l))u=!0,c+=k.byteLength(l)+2;else return t.emit('error',new Error('Invalid username')),!1;if(null!=p){if(!u)return t.emit('error',new Error('Username is required to use password')),!1;if(w(p))c+=S(p)+2;else return t.emit('error',new Error('Invalid password')),!1}t.write(I.CONNECT_HEADER),g(t,c),y(t,r),t.write(4===o?I.VERSION4:I.VERSION3);var h=0;return h|=null==l?0:I.USERNAME_MASK,h|=null==p?0:I.PASSWORD_MASK,h|=i&&i.retain?I.WILL_RETAIN_MASK:0,h|=i&&i.qos?i.qos<<I.WILL_QOS_SHIFT:0,h|=i?I.WILL_FLAG_MASK:0,h|=s?I.CLEAN_SESSION_MASK:0,t.write(k.from([h])),P(t,a),y(t,d),i&&(m(t,i.topic),y(t,i.payload)),null!=l&&y(t,l),null!=p&&y(t,p),!0}function s(e,t){var n=(e||{}).returnCode;return'number'==typeof n?(t.write(I.CONNACK_HEADER),g(t,2),t.write(e.sessionPresent?I.SESSIONPRESENT_HEADER:T),t.write(k.from([n]))):(t.emit('error',new Error('Invalid return code')),!1)}function a(e,t){var n=e||{},r=n.qos||0,o=n.retain?I.RETAIN_MASK:0,i=n.topic,s=n.payload||E,a=n.messageId,d=0;if('string'==typeof i)d+=k.byteLength(i)+2;else if(k.isBuffer(i))d+=i.length+2;else return t.emit('error',new Error('Invalid topic')),!1;return(d+=k.isBuffer(s)?s.length:k.byteLength(s),r&&'number'!=typeof a)?(t.emit('error',new Error('Invalid messageId')),!1):(r&&(d+=2),t.write(I.PUBLISH_HEADER[r][e.dup?1:0][o?1:0]),g(t,d),P(t,S(i)),t.write(i),0<r&&P(t,a),t.write(s))}function d(e,t){var n=e||{},r=n.cmd||'puback',o=n.messageId,i=n.dup&&'pubrel'===r?I.DUP_MASK:0,s=0;return('pubrel'===r&&(s=1),'number'!=typeof o)?(t.emit('error',new Error('Invalid messageId')),!1):(t.write(I.ACKS[r][s][i][0]),g(t,2),P(t,o))}function l(e,t){var n=e||{},r=n.dup?I.DUP_MASK:0,o=n.messageId,s=n.subscriptions,a=0;if('number'!=typeof o)return t.emit('error',new Error('Invalid messageId')),!1;if(a+=2,'object'==typeof s&&s.length)for(var d=0;d<s.length;d+=1){var i=s[d].topic,l=s[d].qos;if('string'!=typeof i)return t.emit('error',new Error('Invalid subscriptions - invalid topic')),!1;if('number'!=typeof l)return t.emit('error',new Error('Invalid subscriptions - invalid qos')),!1;a+=k.byteLength(i)+2+1}else return t.emit('error',new Error('Invalid subscriptions')),!1;t.write(I.SUBSCRIBE_HEADER[1][r?1:0][0]),g(t,a),P(t,o);for(var p=!0,c=0;c<s.length;c++){var u=s[c],h=u.topic,f=u.qos;m(t,h),p=t.write(I.QOS[f])}return p}function p(e,t){var n=e||{},r=n.messageId,o=n.granted,s=0;if('number'!=typeof r)return t.emit('error',new Error('Invalid messageId')),!1;if(s+=2,'object'==typeof o&&o.length)for(var a=0;a<o.length;a+=1){if('number'!=typeof o[a])return t.emit('error',new Error('Invalid qos vector')),!1;s+=1}else return t.emit('error',new Error('Invalid qos vector')),!1;return t.write(I.SUBACK_HEADER),g(t,s),P(t,r),t.write(k.from(o))}function c(e,t){var n=e||{},r=n.messageId,o=n.dup?I.DUP_MASK:0,s=n.unsubscriptions,a=0;if('number'!=typeof r)return t.emit('error',new Error('Invalid messageId')),!1;if(a+=2,'object'==typeof s&&s.length)for(var d=0;d<s.length;d+=1){if('string'!=typeof s[d])return t.emit('error',new Error('Invalid unsubscriptions')),!1;a+=k.byteLength(s[d])+2}else return t.emit('error',new Error('Invalid unsubscriptions')),!1;t.write(I.UNSUBSCRIBE_HEADER[1][o?1:0][0]),g(t,a),P(t,r);for(var i=!0,l=0;l<s.length;l++)i=m(t,s[l]);return i}function u(e,t){return t.write(I.EMPTY[e.cmd])}function h(e){return 0<=e&&128>e?1:128<=e&&16384>e?2:16384<=e&&2097152>e?3:2097152<=e&&268435456>e?4:0}function f(e){var t=0,n=0,r=k.allocUnsafe(h(e));do t=0|e%128,e=0|e/128,0<e&&(t|=128),r.writeUInt8(t,n++);while(0<e);return r}function g(e,t){var n=O[t];n||(n=f(t),16384>t&&(O[t]=n)),e.write(n)}function m(e,t){var n=k.byteLength(t);P(e,n),e.write(t,'utf8')}function b(e,t){return e.write(C[t])}function _(e,t){return e.write(R(t))}function y(e,t){'string'==typeof t?m(e,t):t?(P(e,t.length),e.write(t)):P(e,0)}function S(e){return e?e instanceof k?e.length:k.byteLength(e):0}function w(e){return'string'==typeof e||e instanceof k}var I=n(22),k=n(2).Buffer,E=k.allocUnsafe(0),T=k.from([0]),v=n(51),x=n(6).nextTick,C=v.cache,R=v.generateNumber,A=v.generateCache,P=b,L=!0;Object.defineProperty(r,'cacheNumbers',{get:function(){return P===b},set:function(e){e?((!C||0===Object.keys(C).length)&&(L=!0),P=b):(L=!1,P=_)}});var O={};e.exports=r},function(e,t,n){'use strict';var r=n(60);e.exports=function(e,t){var n,o;return t.port=t.port||1883,t.hostname=t.hostname||t.host||'localhost',n=t.port,o=t.hostname,r.createConnection(n,o)}},function(e,t,n){'use strict';function r(e){d?wx.sendSocketMessage({data:e.buffer||e}):l.push(e)}function o(e,t){var n={OPEN:1,CLOSING:2,CLOSED:3,readyState:d?1:0,send:r,close:wx.closeSocket,onopen:null,onmessage:null,onclose:null,onerror:null};return wx.connectSocket({url:e,protocols:t}),wx.onSocketOpen(function(){n.readyState=n.OPEN,d=!0;for(var e=0;e<l.length;e++)r(l[e]);l=[],n.onopen&&n.onopen.apply(n,arguments)}),wx.onSocketMessage(function(){n.onmessage&&n.onmessage.apply(n,arguments)}),wx.onSocketClose(function(){n.onclose&&n.onclose.apply(n,arguments),n.readyState=n.CLOSED,d=!1}),wx.onSocketError(function(){n.onerror&&n.onerror.apply(n,arguments),n.readyState=n.CLOSED,d=!1}),n}function i(e,t){var n='wxs'===e.protocol?'wss':'ws',r=n+'://'+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(r=n+'://'+e.hostname+':'+e.port+e.path),'function'==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}function s(e){e.hostname||(e.hostname='localhost'),e.path||(e.path='/'),e.wsOptions||(e.wsOptions={})}function a(e,t){var n='MQIsdp'===t.protocolId&&3===t.protocolVersion?'mqttv3.1':'mqtt';s(t);var r=i(t,e);return p(o(r,[n]))}var d=!1,l=[],p=n(26),c=n(11);e.exports=function(e,t){if(t.hostname||(t.hostname=t.host),!t.hostname){if('undefined'==typeof document)throw new Error('Could not determine host. Specify host manually.');var n=c.parse(document.URL);t.hostname=n.hostname,t.port||(t.port=n.port)}return a(e,t)}},function(e,t,n){'use strict';(function(t,r){function o(e,t,n){var r=new i({objectMode:e.objectMode});return r._write=t,r._flush=n,r}var i=n(8).Transform,s=n(62),a=n(64),d=n(2).Buffer;e.exports=function(e,n,i){function l(e,t,n){if(f.bufferedAmount>m)return void setTimeout(l,b,e,t,n);_&&'string'==typeof e&&(e=d.from(e,'utf8'));try{f.send(e)}catch(e){return n(e)}n()}var p='browser'===t.title,c=!!r.WebSocket,u=p?l:function(e,t,n){return f.readyState===f.OPEN?void(_&&'string'==typeof e&&(e=d.from(e,'utf8')),f.send(e,n)):void n()},h,f;n&&!Array.isArray(n)&&'object'==typeof n&&(i=n,n=null,('string'==typeof i.protocol||Array.isArray(i.protocol))&&(n=i.protocol)),i||(i={}),i.objectMode===void 0&&(i.objectMode=!0!==i.binary&&i.binary!==void 0);var g=o(i,u,function(e){f.close(),e()});i.objectMode||(g._writev=function(e,t){for(var n=Array(e.length),r=0;r<e.length;r++)n[r]='string'==typeof e[r].chunk?d.from(e[r],'utf8'):e[r].chunk;this._write(d.concat(n),'binary',t)});var m=i.browserBufferSize||524288,b=i.browserBufferTimeout||1e3;'object'==typeof e?f=e:(f=c&&p?new a(e,n):new a(e,n,i),f.binaryType='arraybuffer'),f.readyState===f.OPEN?h=g:(h=s.obj(),f.onopen=function(){h.setReadable(g),h.setWritable(g),h.emit('connect')}),h.socket=f,f.onclose=function(){h.end(),h.destroy()},f.onerror=function(e){h.destroy(e)},f.onmessage=function(e){var t=e.data;t=t instanceof ArrayBuffer?d.from(t):d.from(t,'utf8'),g.push(t)},g.on('close',function(){f.close()});var _=!i.objectMode;return h}}).call(t,n(0),n(1))},function(e,t,n){'use strict';(function(t){function r(e,t){var n=e.protocol+'://'+e.hostname+':'+e.port+e.path;return'function'==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}function o(e){e.hostname||(e.hostname='localhost'),e.port||('wss'===e.protocol?e.port=443:e.port=80),e.path||(e.path='/'),e.wsOptions||(e.wsOptions={}),l||'wss'!==e.protocol||d.forEach(function(t){e.hasOwnProperty(t)&&!e.wsOptions.hasOwnProperty(t)&&(e.wsOptions[t]=e[t])})}function i(e,t){var n='MQIsdp'===t.protocolId&&3===t.protocolVersion?'mqttv3.1':'mqtt';o(t);var i=r(t,e);return s(i,[n],t.wsOptions)}var s=n(26),a=n(11),d=['rejectUnauthorized','ca','cert','key','pfx','passphrase'],l='browser'===t.title;e.exports=l?function(e,t){if(t.hostname||(t.hostname=t.host),!t.hostname){if('undefined'==typeof document)throw new Error('Could not determine host. Specify host manually.');var n=a.parse(document.URL);t.hostname=n.hostname,t.port||(t.port=n.port)}return i(e,t)}:function(e,t){return i(e,t)}}).call(t,n(0))},function(e,t,n){const r=n(29),o=n(30);class i{constructor(e){if(this.rootPath='networked-aframe',this.config=e||{},this.config=e||window.nafAWSIotconfig||{},this.AWS=this.config.AWS||window.AWS,void 0===this.AWS)throw new Error('No AWS SDK in config!');this.config.endpointPrefix=this.config.endpointPrefix||'data',this.config.region=this.config.region||AWS.config.region||'us-east-1',this.localId=null,this.appId=null,this.roomId=null,this.peers={},this.occupants={},this.topicListeners={},this.config.endpoint=this.config.endpoint||`https://${this.config.endpointPrefix}.iot.${this.config.region}.amazonaws.com`}setServerUrl(){}setApp(e){this.appId=e}setRoom(e){this.roomId=e}getMediaStream(){return Promise.reject('Interface method not implemented: getMediaStream')}setWebRtcOptions(e){!1===e.datachannel&&console.warn('AWSIotWebRtcAdapter.setWebRtcOptions: datachannel must be true.'),!0===e.audio&&console.warn('AWSIotWebRtcAdapter does not support audio yet.'),!0===e.video&&console.warn('AWSIotWebRtcAdapter does not support video yet.')}setServerConnectListeners(e,t){this.connectSuccess=e,this.connectFailure=t}setRoomOccupantListener(e){this.occupantListener=e}setDataChannelListeners(e,t,n){this.openListener=e,this.closedListener=t,this.messageListener=function(e,t,r){n(e,t,r)}}connect(){this.initIoT(()=>{this._subscribeToIoTTopic(this.getRoomPath(),(e)=>{const t=e.clientId,n=e.timestamp;if(t===this.localId||void 0!==this.peers[t])return;const o=new r(this.localId,t,(e)=>this._publishIoTMessage(this.getSignalPath(this.localId),e));o.setDatachannelListeners(this.openListener,this.closedListener,this.messageListener),this.peers[t]=o,this.occupants[t]=n,this._subscribeToIoTTopic(this.getSignalPath(t),(e)=>{null===e||''===e||o.handleSignal(e)}),this._subscribeToIoTTopic(this.getDataPath(t),(e)=>{null===e||''===e||e.to!==this.localId||this.messageListener(t,e.type,e.data)}),this._subscribeToIoTTopic(this.getClientDisconnectedTopic(t),()=>{t===this.localId||void 0===this.peers[t]||(delete this.peers[t],delete this.occupants[t],this.occupantListener(this.occupants))}),(this.localTimestamp>n||this.localTimestamp===n&&self.localId>t)&&o.offer(),this.occupantListener(this.occupants);const i={clientId:this.localId,timestamp:this.localTimestamp};this._publishIoTMessage(this.getRoomPath(),i)});const e={clientId:this.localId,timestamp:this.localTimestamp};this._publishIoTMessage(this.getRoomPath(),e),this.connectSuccess(this.localId)})}shouldStartConnectionTo(e){return(this.myRoomJoinTime||0)<=(e?e.roomJoinTime:0)}startStreamConnection(){}closeStreamConnection(){}sendData(e,t,n){this.peers[e].send(t,n)}sendDataGuaranteed(e,t,n){const r=JSON.parse(JSON.stringify({to:e,type:t,data:n}));this._publishIoTMessage(this.getDataPath(this.localId),r)}broadcastData(e,t){for(const n in this.peers)this.peers.hasOwnProperty(n)&&this.sendData(n,e,t)}broadcastDataGuaranteed(e,t){for(const n in this.peers)this.peers.hasOwnProperty(n)&&this.sendDataGuaranteed(n,e,t)}getConnectStatus(e){const t=this.peers[e];if(t===void 0)return NAF.adapters.NOT_CONNECTED;switch(t.getStatus()){case r.IS_CONNECTED:return NAF.adapters.IS_CONNECTED;case r.CONNECTING:return NAF.adapters.CONNECTING;case r.NOT_CONNECTED:default:return NAF.adapters.NOT_CONNECTED;}}getClientId(){return this.config.clientId?this.config.clientId:this.AWS.config.credentials instanceof this.AWS.CognitoIdentityCredentials?this.AWS.config.credentials.identityId:this.randomString()}_presignIOTMQTTConnection(e,t){var n=new this.AWS.IotData({endpoint:e,credentials:t,paramValidation:!1});n.api.signingName='iotdevicegateway';var r=n.getThingShadow({}),o=n.config.credentials.sessionToken;delete r.service.config.credentials.sessionToken,r.on('afterBuild',function(e){e.httpRequest.path='/mqtt'});var i=r.presign().replace('https:','wss:');return r.service.config.credentials.sessionToken=o,i+='&X-Amz-Security-Token='+encodeURIComponent(t.sessionToken),i}initIoT(e){this.AWS.config.credentials.refresh(()=>{this.AWS.config.update({region:this.config.region});const t=this._presignIOTMQTTConnection(this.config.endpoint,this.AWS.config.credentials);this.localId=this.getClientId(),this.localTimestamp=NAF.utils.now(),this.wss=new o.connect(t,{clientId:this.localId}),this.wss.on('connect',e),this.wss.on('message',(e,t)=>this._onIoTMessageArrived(e,t))})}_subscribeToIoTTopic(e,t){this.topicListeners[e]=t,this.wss.subscribe(e)}_onIoTMessageArrived(e,t){if(!this.topicListeners[e])return console.warn(`Could not find listener for ${this.topic}`);const n=JSON.parse(t.toString());this.topicListeners[e](n)}_publishIoTMessage(e,t){this.wss.publish(e,JSON.stringify(t))}getRootPath(){return this.rootPath}getAppPath(){return this.getRootPath()+'/'+this.appId}getRoomPath(){return this.getAppPath()+'/'+this.roomId}getUserPath(e){return this.getRoomPath()+'/'+e}getSignalPath(e){return this.getUserPath(e)+'/signal'}getDataPath(e){return this.getUserPath(e)+'/data'}getClientDisconnectedTopic(e){return'$aws/events/subscriptions/unsubscribed/'+e}randomString(){const e='ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz0123456789';let t='';for(let n=0;n<16;n++){const n=Math.floor(Math.random()*e.length);t+=e.substring(n,n+1)}return t}}NAF.adapters.register('awsiot',i),e.exports=i},function(e){class t{constructor(e,t,n){this.localId=e,this.remoteId=t,this.sendSignalFunc=n,this.open=!1,this.channelLabel='networked-aframe-channel',this.pc=this.createPeerConnection(),this.channel=null}setDatachannelListeners(e,t,n){this.openListener=e,this.closedListener=t,this.messageListener=n}offer(){var e=this;this.setupChannel(this.pc.createDataChannel(this.channelLabel,{reliable:!1})),this.pc.createOffer(function(t){e.handleSessionDescription(t)},function(e){console.error('WebRtcPeer.offer: '+e)})}handleSignal(e){if(this.localId===e.to&&this.remoteId===e.from)switch(e.type){case'offer':this.handleOffer(e);break;case'answer':this.handleAnswer(e);break;case'candidate':this.handleCandidate(e);break;default:console.error('WebRtcPeer.handleSignal: Unknown signal type '+e.type);}}send(e,t){null===this.channel||'open'!==this.channel.readyState||this.channel.send(JSON.stringify({type:e,data:t}))}getStatus(){if(null===this.channel)return t.NOT_CONNECTED;switch(this.channel.readyState){case'open':return t.IS_CONNECTED;case'connecting':return t.CONNECTING;case'closing':case'closed':default:return t.NOT_CONNECTED;}}createPeerConnection(){var e=this,n=window.RTCPeerConnection||window.webkitRTCPeerConnection||window.mozRTCPeerConnection||window.msRTCPeerConnection;if(void 0===n)throw new Error('WebRtcPeer.createPeerConnection: This browser does not seem to support WebRTC.');var r=new n({iceServers:t.ICE_SERVERS});return r.onicecandidate=function(t){t.candidate&&e.sendSignalFunc({from:e.localId,to:e.remoteId,type:'candidate',sdpMLineIndex:t.candidate.sdpMLineIndex,candidate:t.candidate.candidate})},r.oniceconnectionstatechange=function(){e.open&&'disconnected'===r.iceConnectionState&&(e.open=!1,e.closedListener(e.remoteId))},r}setupChannel(e){var t=this;this.channel=e,this.channel.onmessage=function(e){var n=JSON.parse(e.data);t.messageListener(t.remoteId,n.type,n.data)},this.channel.onopen=function(){t.open=!0,t.openListener(t.remoteId)},this.channel.onclose=function(){t.open&&(t.open=!1,t.closedListener(t.remoteId))},this.channel.onerror=function(e){console.error('WebRtcPeer.channel.onerror: '+e)}}handleOffer(e){var t=this;this.pc.ondatachannel=function(e){t.setupChannel(e.channel)},this.setRemoteDescription(e),this.pc.createAnswer(function(e){t.handleSessionDescription(e)},function(e){console.error('WebRtcPeer.handleOffer: '+e)})}handleAnswer(e){this.setRemoteDescription(e)}handleCandidate(e){var t=this,n=window.RTCIceCandidate||window.webkitRTCIceCandidate||window.mozRTCIceCandidate;this.pc.addIceCandidate(new n(e),function(){},function(e){console.error('WebRtcPeer.handleCandidate: '+e)})}handleSessionDescription(e){this;this.pc.setLocalDescription(e,function(){},function(e){console.error('WebRtcPeer.handleSessionDescription: '+e)}),this.sendSignalFunc({from:this.localId,to:this.remoteId,type:e.type,sdp:e.sdp})}setRemoteDescription(e){var t=this,n=window.RTCSessionDescription||window.webkitRTCSessionDescription||window.mozRTCSessionDescription||window.msRTCSessionDescription;this.pc.setRemoteDescription(new n(e),function(){},function(e){console.error('WebRtcPeer.setRemoteDescription: '+e)})}}t.IS_CONNECTED='IS_CONNECTED',t.CONNECTING='CONNECTING',t.NOT_CONNECTED='NOT_CONNECTED',t.ICE_SERVERS=[{urls:'stun:stun1.l.google.com:19302'},{urls:'stun:stun2.l.google.com:19302'},{urls:'stun:stun3.l.google.com:19302'},{urls:'stun:stun4.l.google.com:19302'}],e.exports=t},function(e,t,n){'use strict';(function(t){function r(e){var t;e.auth&&(t=e.auth.match(/^(.+):(.+)$/),t?(e.username=t[1],e.password=t[2]):e.username=e.auth)}function o(e,t){if('object'!=typeof e||t||(t=e,e=null),t=t||{},e){var n=a.parse(e,!0);if(null!=n.port&&(n.port=+n.port),t=d(n,t),null===t.protocol)throw new Error('Missing protocol');t.protocol=t.protocol.replace(/:$/,'')}if(r(t),t.query&&'string'==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key)if(!t.protocol)throw new Error('Missing secure protocol key');else if(-1===['mqtts','wss','wxs'].indexOf(t.protocol))switch(t.protocol){case'mqtt':t.protocol='mqtts';break;case'ws':t.protocol='wss';break;case'wx':t.protocol='wxs';break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!');}if(!l[t.protocol]){var o=-1!==['mqtts','wss'].indexOf(t.protocol);t.protocol=['mqtt','mqtts','ws','wss','wx','wxs'].filter(function(e,t){return o&&0==t%2?!1:'function'==typeof l[e]})[0]}if(!1===t.clean&&!t.clientId)throw new Error('Missing clientId for unclean clients');return new i(function(e){return t.servers&&((!e._reconnectCount||e._reconnectCount===t.servers.length)&&(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.hostname=t.host,e._reconnectCount++),l[t.protocol](e,t)},t)}var i=n(31),s=n(13),a=n(11),d=n(9),l={};'browser'===t.title?(l.wx=n(25),l.wxs=n(25)):(l.mqtt=n(24),l.tcp=n(24),l.ssl=n(12),l.tls=n(12),l.mqtts=n(12)),l.ws=n(27),l.wss=n(27),e.exports=o,e.exports.connect=o,e.exports.MqttClient=i,e.exports.Store=s}).call(t,n(0))},function(e,t,n){'use strict';(function(t,r){function o(){return'mqttjs_'+Math.random().toString(16).substr(2,8)}function i(e,t,n){e.emit('packetsend',t);var r=h.writeToStream(t,e.stream);!r&&n?e.stream.once('drain',n):n&&n()}function s(e){e&&Object.keys(e).forEach(function(t){'function'==typeof e[t]&&(e[t](new Error('Connection closed')),delete e[t])})}function a(e,t,n){e.outgoingStore.put(t,function(r){return r?n&&n(r):void i(e,t,n)})}function d(){}function l(e,t){var n=this,r;if(!(this instanceof l))return new l(e,t);for(r in this.options=t||{},S)this.options[r]='undefined'==typeof this.options[r]?S[r]:t[r];this.options.clientId='string'==typeof this.options.clientId?this.options.clientId:o(),this.streamBuilder=e,this.outgoingStore=this.options.outgoingStore||new c,this.incomingStore=this.options.incomingStore||new c,this.queueQoSZero=void 0===this.options.queueQoSZero||this.options.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this.nextId=Math.floor(65535*Math.random()),this.outgoing={},this.on('connect',function(){if(!this.disconnected){this.connected=!0;var e=null;e=this.outgoingStore.createStream(),e.once('readable',function(){function t(){var r=e.read(1),o;r&&(n.disconnecting||n.reconnectTimer||!(0<n.options.reconnectPeriod)?e.destroy&&e.destroy():(e.read(0),o=n.outgoing[r.messageId],n.outgoing[r.messageId]=function(e,n){o&&o(e,n),t()},n._sendPacket(r)))}t()}).on('error',this.emit.bind(this,'error'))}}),this.on('close',function(){this.connected=!1,clearTimeout(this.connackTimer)}),this.on('connect',this._setupPingTimer),this.on('connect',function(){function e(){var r=t.shift(),o=null;r&&(o=r.packet,n._sendPacket(o,function(t){r.cb&&r.cb(t),e()}))}var t=this.queue;e()});var i=!0;this.on('connect',function(){!i&&this.options.clean&&0<Object.keys(this._resubscribeTopics).length&&(this.options.resubscribe?(this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics)):this._resubscribeTopics={}),i=!1}),this.on('close',function(){null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null)}),this.on('close',this._setupReconnect),p.EventEmitter.call(this),this._setupStream()}var p=n(5),c=n(13),u=n(21),h=n(43),f=n(8).Writable,g=n(3),m=n(52),b=n(53),_=n(9),y=t.setImmediate||function(e){r.nextTick(e)},S={keepalive:60,reschedulePings:!0,protocolId:'MQTT',protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30000,clean:!0,resubscribe:!0};g(l,p.EventEmitter),l.prototype._setupStream=function(){function e(){r.nextTick(t)}function t(){var t=l.shift(),r=a;t?n._handlePacket(t,e):(a=null,r())}var n=this,o=new f,s=h.parser(this.options),a=null,l=[],p;this._clearReconnect(),this.stream=this.streamBuilder(this),s.on('packet',function(e){l.push(e)}),o._write=function(e,n,r){a=r,s.parse(e),t()},this.stream.pipe(o),this.stream.on('error',d),u(this.stream,this.emit.bind(this,'close')),p=Object.create(this.options),p.cmd='connect',i(this,p),s.on('error',this.emit.bind(this,'error')),this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){n._cleanUp(!0)},this.options.connectTimeout)},l.prototype._handlePacket=function(e,t){switch(this.emit('packetreceive',e),e.cmd){case'publish':this._handlePublish(e,t);break;case'puback':case'pubrec':case'pubcomp':case'suback':case'unsuback':this._handleAck(e),t();break;case'pubrel':this._handlePubrel(e,t);break;case'connack':this._handleConnack(e),t();break;case'pingresp':this._handlePingresp(e),t();break;default:}},l.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e?e(new Error('client disconnecting')):this.emit('error',new Error('client disconnecting'))),this.disconnecting},l.prototype.publish=function(e,t,n,r){var o;'function'==typeof n&&(r=n,n=null);if(n=_({qos:0,retain:!1,dup:!1},n),this._checkDisconnecting(r))return this;switch(o={cmd:'publish',topic:e,payload:t,qos:n.qos,retain:n.retain,messageId:this._nextId(),dup:n.dup},n.qos){case 1:case 2:this.outgoing[o.messageId]=r||d,this._sendPacket(o);break;default:this._sendPacket(o,r);}return this},l.prototype.subscribe=function(){var e=Array.prototype.slice.call(arguments),t=[],n=e.shift(),r=n.resubscribe,o=e.pop()||d,i=e.pop(),s=this,a,l;if(delete n.resubscribe,'string'==typeof n&&(n=[n]),'function'!=typeof o&&(i=o,o=d),l=b.validateTopics(n),null!==l)return y(o,new Error('Invalid topic '+l)),this;if(this._checkDisconnecting(o))return this;if(i=_({qos:0},i),Array.isArray(n)?n.forEach(function(e){(s._resubscribeTopics[e]<i.qos||!s._resubscribeTopics.hasOwnProperty(e)||r)&&t.push({topic:e,qos:i.qos})}):Object.keys(n).forEach(function(e){(s._resubscribeTopics[e]<n[e]||!s._resubscribeTopics.hasOwnProperty(e)||r)&&t.push({topic:e,qos:n[e]})}),a={cmd:'subscribe',subscriptions:t,qos:1,retain:!1,dup:!1,messageId:this._nextId()},!t.length)return void o(null,[]);if(this.options.resubscribe){var p=[];t.forEach(function(e){0<s.options.reconnectPeriod&&(s._resubscribeTopics[e.topic]=e.qos,p.push(e.topic))}),s.messageIdToTopic[a.messageId]=p}return this.outgoing[a.messageId]=function(e,n){if(!e)for(var r=n.granted,s=0;s<r.length;s+=1)t[s].qos=r[s];o(e,t)},this._sendPacket(a),this},l.prototype.unsubscribe=function(e,t){var n={cmd:'unsubscribe',qos:1,messageId:this._nextId()},r=this;return(t=t||d,this._checkDisconnecting(t))?this:('string'==typeof e?n.unsubscriptions=[e]:'object'==typeof e&&e.length&&(n.unsubscriptions=e),this.options.resubscribe&&n.unsubscriptions.forEach(function(e){delete r._resubscribeTopics[e]}),this.outgoing[n.messageId]=t,this._sendPacket(n),this)},l.prototype.end=function(e,t){function n(){o.disconnected=!0,o.incomingStore.close(function(){o.outgoingStore.close(function(){t&&t.apply(null,arguments),o.emit('end')})}),o._deferredReconnect&&o._deferredReconnect()}function r(){o._cleanUp(e,y.bind(null,n))}var o=this;return('function'==typeof e&&(t=e,e=!1),this.disconnecting)?this:(this._clearReconnect(),this.disconnecting=!0,!e&&0<Object.keys(this.outgoing).length?this.once('outgoingEmpty',setTimeout.bind(null,r,10)):r(),this)},l.prototype.removeOutgoingMessage=function(e){var t=this.outgoing[e];return delete this.outgoing[e],this.outgoingStore.del({messageId:e},function(){t(new Error('Message removed'))}),this},l.prototype.reconnect=function(e){var t=this,n=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new c,t.outgoingStore=t.options.outgoingStore||new c,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=n:n(),this},l.prototype._reconnect=function(){this.emit('reconnect'),this._setupStream()},l.prototype._setupReconnect=function(){var e=this;e.disconnecting||e.reconnectTimer||!(0<e.options.reconnectPeriod)||(!this.reconnecting&&(this.emit('offline'),this.reconnecting=!0),e.reconnectTimer=setInterval(function(){e._reconnect()},e.options.reconnectPeriod))},l.prototype._clearReconnect=function(){this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},l.prototype._cleanUp=function(e,t){t&&this.stream.on('close',t),e?(0===this.options.reconnectPeriod&&this.options.clean&&s(this.outgoing),this.stream.destroy()):this._sendPacket({cmd:'disconnect'},y.bind(null,this.stream.end.bind(this.stream))),this.disconnecting||(this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(this.stream.removeListener('close',t),t())},l.prototype._sendPacket=function(e,t){if(!this.connected)return void(0===(e.qos||0)&&this.queueQoSZero||'publish'!==e.cmd?this.queue.push({packet:e,cb:t}):0<e.qos?(t=this.outgoing[e.messageId],this.outgoingStore.put(e,function(e){if(e)return t&&t(e)})):t&&t(new Error('No connection to broker')));if(this._shiftPingInterval(),'publish'!==e.cmd)return void i(this,e,t);switch(e.qos){case 2:case 1:a(this,e,t);break;case 0:default:i(this,e,t);}},l.prototype._setupPingTimer=function(){var e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=m(function(){e._checkPing()},1e3*this.options.keepalive))},l.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},l.prototype._checkPing=function(){this.pingResp?(this.pingResp=!1,this._sendPacket({cmd:'pingreq'})):this._cleanUp(!0)},l.prototype._handlePingresp=function(){this.pingResp=!0},l.prototype._handleConnack=function(e){var t=e.returnCode;if(clearTimeout(this.connackTimer),0===t)this.reconnecting=!1,this.emit('connect',e);else if(0<t){var n=new Error('Connection refused: '+['','Unacceptable protocol version','Identifier rejected','Server unavailable','Bad username or password','Not authorized'][t]);n.code=t,this.emit('error',n)}},l.prototype._handlePublish=function(e,t){var n=e.topic.toString(),r=e.payload,o=e.qos,i=e.messageId,s=this;switch(o){case 2:this.incomingStore.put(e,function(){s._sendPacket({cmd:'pubrec',messageId:i},t)});break;case 1:this.emit('message',n,r,e),this.handleMessage(e,function(e){return e?t&&t(e):void s._sendPacket({cmd:'puback',messageId:i},t)});break;case 0:this.emit('message',n,r,e),this.handleMessage(e,t);break;default:}},l.prototype.handleMessage=function(e,t){t()},l.prototype._handleAck=function(e){var t=e.messageId,n=e.cmd,r=null,o=this.outgoing[t],i=this;if(o){switch(n){case'pubcomp':case'puback':delete this.outgoing[t],this.outgoingStore.del(e,o);break;case'pubrec':r={cmd:'pubrel',qos:2,messageId:t},this._sendPacket(r);break;case'suback':if(delete this.outgoing[t],1===e.granted.length&&0!=(128&e.granted[0])){var s=this.messageIdToTopic[t];s&&s.forEach(function(e){delete i._resubscribeTopics[e]})}o(null,e);break;case'unsuback':delete this.outgoing[t],o(null);break;default:i.emit('error',new Error('unrecognized packet type'));}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit('outgoingEmpty')}},l.prototype._handlePubrel=function(e,t){var n=e.messageId,r=this,o={cmd:'pubcomp',messageId:n};r.incomingStore.get(e,function(n,i){n||'pubrel'===i.cmd?r._sendPacket(o,t):(r.emit('message',i.topic,i.payload,i),r.incomingStore.put(e),r.handleMessage(i,function(e){return e?t&&t(e):void r._sendPacket(o,t)}))})},l.prototype._nextId=function(){var e=this.nextId++;return 65535==e&&(this.nextId=1),e},l.prototype.getLastMessageId=function(){return 1===this.nextId?65535:this.nextId-1},e.exports=l}).call(t,n(1),n(0))},function(e,t){'use strict';function n(e){var t=e.length;if(0<t%4)throw new Error('Invalid string. Length must be a multiple of 4');var n=e.indexOf('=');-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function r(e,t,n){return 3*(t+n)/4-n}function o(e){return a[63&e>>18]+a[63&e>>12]+a[63&e>>6]+a[63&e]}function s(e,t,n){for(var r=[],s=t,i;s<n;s+=3)i=(16711680&e[s]<<16)+(65280&e[s+1]<<8)+(255&e[s+2]),r.push(o(i));return r.join('')}t.byteLength=function(e){var t=n(e),r=t[0],o=t[1];return 3*(r+o)/4-o},t.toByteArray=function(e){for(var t=n(e),o=t[0],s=t[1],a=new l(r(e,o,s)),p=0,c=0<s?o-4:o,u=0,i;u<c;u+=4)i=d[e.charCodeAt(u)]<<18|d[e.charCodeAt(u+1)]<<12|d[e.charCodeAt(u+2)]<<6|d[e.charCodeAt(u+3)],a[p++]=255&i>>16,a[p++]=255&i>>8,a[p++]=255&i;return 2===s&&(i=d[e.charCodeAt(u)]<<2|d[e.charCodeAt(u+1)]>>4,a[p++]=255&i),1===s&&(i=d[e.charCodeAt(u)]<<10|d[e.charCodeAt(u+1)]<<4|d[e.charCodeAt(u+2)]>>2,a[p++]=255&i>>8,a[p++]=255&i),a},t.fromByteArray=function(e){for(var t=e.length,n=t%3,r=[],o=16383,d=0,i=t-n,l;d<i;d+=o)r.push(s(e,d,d+o>i?i:d+o));return 1==n?(l=e[t-1],r.push(a[l>>2]+a[63&l<<4]+'==')):2==n&&(l=(e[t-2]<<8)+e[t-1],r.push(a[l>>10]+a[63&l>>4]+a[63&l<<2]+'=')),r.join('')};for(var a=[],d=[],l='undefined'==typeof Uint8Array?Array:Uint8Array,p='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',c=0,i=p.length;c<i;++c)a[c]=p[c],d[p.charCodeAt(c)]=c;d[45]=62,d[95]=63},function(e,t){var n=Math.pow;t.read=function(t,r,o,a,l){var p=8*l-a-1,c=(1<<p)-1,u=c>>1,h=-7,f=o?l-1:0,i=o?-1:1,d=t[r+f],s,e;for(f+=i,s=d&(1<<-h)-1,d>>=-h,h+=p;0<h;s=256*s+t[r+f],f+=i,h-=8);for(e=s&(1<<-h)-1,s>>=-h,h+=a;0<h;e=256*e+t[r+f],f+=i,h-=8);if(0===s)s=1-u;else{if(s===c)return e?NaN:(d?-1:1)*Infinity;e+=n(2,a),s-=u}return(d?-1:1)*e*n(2,s-a)},t.write=function(t,r,o,a,l,p){var u=8*p-l-1,h=(1<<u)-1,f=h>>1,g=23===l?5.960464477539063e-8-6.617444900424222e-24:0,b=a?0:p-1,i=a?1:-1,d=0>r||0===r&&0>1/r?1:0,s,_,m;for(r=Math.abs(r),isNaN(r)||r===Infinity?(_=isNaN(r)?1:0,s=h):(s=Math.floor(Math.log(r)/Math.LN2),1>r*(m=n(2,-s))&&(s--,m*=2),r+=1<=s+f?g/m:g*n(2,1-f),2<=r*m&&(s++,m/=2),s+f>=h?(_=0,s=h):1<=s+f?(_=(r*m-1)*n(2,l),s+=f):(_=r*n(2,f-1)*n(2,l),s=0));8<=l;t[o+b]=255&_,b+=i,_/=256,l-=8);for(s=s<<l|_,u+=l;0<u;t[o+b]=255&s,b+=i,s/=256,u-=8);t[o+b-i]|=128*d}},function(){},function(e,t,n){'use strict';function r(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')}function o(e,t,n){e.copy(t,n)}var s=n(2).Buffer,i=n(36);e.exports=function(){function e(){r(this,e),this.head=null,this.tail=null,this.length=0}return e.prototype.push=function(e){var t={data:e,next:null};0<this.length?this.tail.next=t:this.head=t,this.tail=t,++this.length},e.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},e.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return this.head=1===this.length?this.tail=null:this.head.next,--this.length,e}},e.prototype.clear=function(){this.head=this.tail=null,this.length=0},e.prototype.join=function(e){if(0===this.length)return'';for(var t=this.head,n=''+t.data;t=t.next;)n+=e+t.data;return n},e.prototype.concat=function(e){if(0===this.length)return s.alloc(0);if(1===this.length)return this.head.data;for(var t=s.allocUnsafe(e>>>0),n=this.head,r=0;n;)o(n.data,t,r),r+=n.data.length,n=n.next;return t},e}(),i&&i.inspect&&i.inspect.custom&&(e.exports.prototype[i.inspect.custom]=function(){var e=i.inspect({length:this.length});return this.constructor.name+' '+e})},function(){},function(e,t,n){(function(e){function r(e,t){this._id=e,this._clearFn=t}var o='undefined'!=typeof e&&e||'undefined'!=typeof self&&self||window,i=Function.prototype.apply;t.setTimeout=function(){return new r(i.call(setTimeout,o,arguments),clearTimeout)},t.setInterval=function(){return new r(i.call(setInterval,o,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(o,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;0<=t&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(38),t.setImmediate='undefined'!=typeof self&&self.setImmediate||'undefined'!=typeof e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate='undefined'!=typeof self&&self.clearImmediate||'undefined'!=typeof e&&e.clearImmediate||this&&this.clearImmediate}).call(t,n(1))},function(e,t,n){(function(e,t){(function(e){'use strict';function n(e){'function'!=typeof e&&(e=new Function(''+e));for(var t=Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var r={callback:e,args:t};return h[u]=r,b(u),u++}function r(e){delete h[e]}function o(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n);}}function i(e){if(f)setTimeout(i,0,e);else{var t=h[e];if(t){f=!0;try{o(t)}finally{r(e),f=!1}}}}function s(){b=function(e){t.nextTick(function(){i(e)})}}function a(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage('','*'),e.onmessage=n,t}}function d(){var t='setImmediate$'+Math.random()+'$',n=function(n){n.source===e&&'string'==typeof n.data&&0===n.data.indexOf(t)&&i(+n.data.slice(t.length))};e.addEventListener?e.addEventListener('message',n,!1):e.attachEvent('onmessage',n),b=function(n){e.postMessage(t+n,'*')}}function l(){var e=new MessageChannel;e.port1.onmessage=function(e){var t=e.data;i(t)},b=function(t){e.port2.postMessage(t)}}function p(){var e=g.documentElement;b=function(t){var n=g.createElement('script');n.onreadystatechange=function(){i(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}function c(){b=function(e){setTimeout(i,0,e)}}if(!e.setImmediate){var u=1,h={},f=!1,g=e.document,m=Object.getPrototypeOf&&Object.getPrototypeOf(e),b;m=m&&m.setTimeout?m:e,'[object process]'==={}.toString.call(e.process)?s():a()?d():e.MessageChannel?l():g&&'onreadystatechange'in g.createElement('script')?p():c(),m.setImmediate=n,m.clearImmediate=r}})('undefined'==typeof self?'undefined'==typeof e?this:e:self)}).call(t,n(1),n(0))},function(e,t,n){(function(t){function n(e){try{if(!t.localStorage)return!1}catch(e){return!1}var n=t.localStorage[e];return null!=n&&'true'===(n+'').toLowerCase()}e.exports=function(e,t){if(n('noDeprecation'))return e;var r=!1;return function(){if(!r){if(n('throwDeprecation'))throw new Error(t);else n('traceDeprecation')?console.trace(t):console.warn(t);r=!0}return e.apply(this,arguments)}}}).call(t,n(1))},function(e,t,n){'use strict';function r(e){return this instanceof r?void o.call(this,e):new r(e)}e.exports=r;var o=n(20),i=n(7);i.inherits=n(3),i.inherits(r,o),r.prototype._transform=function(e,t,n){n(null,e)}},function(e,t,n){function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function o(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||'Function wrapped with `once`';return t.onceError=n+' shouldn\'t be called more than once',t.called=!1,t}var i=n(42);e.exports=i(r),e.exports.strict=i(o),r.proto=r(function(){Object.defineProperty(Function.prototype,'once',{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,'onceStrict',{value:function(){return o(this)},configurable:!0})})},function(e){function t(e,n){function r(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),o=t[t.length-1];return'function'==typeof r&&r!==o&&Object.keys(o).forEach(function(e){r[e]=o[e]}),r}if(e&&n)return t(e)(n);if('function'!=typeof e)throw new TypeError('need wrapper function');return Object.keys(e).forEach(function(t){r[t]=e[t]}),r}e.exports=t},function(e,t,n){'use strict';t.parser=n(44),t.generate=n(50),t.writeToStream=n(23)},function(e,t,n){'use strict';function r(){return this instanceof r?void(this._states=['_parseHeader','_parseLength','_parsePayload','_newPacket'],this._resetState()):new r}var o=n(45),i=n(3),s=n(5).EventEmitter,a=n(49),d=n(22);i(r,s),r.prototype._resetState=function(){this.packet=new a,this.error=null,this._list=o(),this._stateCounter=0},r.prototype.parse=function(e){for(this.error&&this._resetState(),this._list.append(e);(-1!==this.packet.length||0<this._list.length)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,this._stateCounter>=this._states.length&&(this._stateCounter=0);return this._list.length},r.prototype._parseHeader=function(){var e=this._list.readUInt8(0);return this.packet.cmd=d.types[e>>d.CMD_SHIFT],this.packet.retain=0!=(e&d.RETAIN_MASK),this.packet.qos=e>>d.QOS_SHIFT&d.QOS_MASK,this.packet.dup=0!=(e&d.DUP_MASK),this._list.consume(1),!0},r.prototype._parseLength=function(){for(var e=0,t=1,n=0,r=!0,o;5>e&&(o=this._list.readUInt8(e++),n+=t*(o&d.LENGTH_MASK),t*=128,0!=(o&d.LENGTH_FIN_MASK));)if(this._list.length<=e){r=!1;break}return r&&(this.packet.length=n,this._list.consume(e)),r},r.prototype._parsePayload=function(){var 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._parseMessageId();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':case'disconnect':break;default:this._emitError(new Error('Not supported'));}e=!0}return e},r.prototype._parseConnect=function(){var e={},t=this.packet,n,r,o,i,s,a;if(n=this._parseString(),null===n)return this._emitError(new Error('Cannot parse protocolId'));if('MQTT'!==n&&'MQIsdp'!==n)return this._emitError(new Error('Invalid protocolId'));if(t.protocolId=n,this._pos>=this._list.length)return this._emitError(new Error('Packet too short'));if(t.protocolVersion=this._list.readUInt8(this._pos),3!==t.protocolVersion&&4!==t.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(e.username=this._list.readUInt8(this._pos)&d.USERNAME_MASK,e.password=this._list.readUInt8(this._pos)&d.PASSWORD_MASK,e.will=this._list.readUInt8(this._pos)&d.WILL_FLAG_MASK,e.will&&(t.will={},t.will.retain=0!=(this._list.readUInt8(this._pos)&d.WILL_RETAIN_MASK),t.will.qos=(this._list.readUInt8(this._pos)&d.WILL_QOS_MASK)>>d.WILL_QOS_SHIFT),t.clean=0!=(this._list.readUInt8(this._pos)&d.CLEAN_SESSION_MASK),this._pos++,t.keepalive=this._parseNum(),-1===t.keepalive)return this._emitError(new Error('Packet too short'));if(r=this._parseString(),null===r)return this._emitError(new Error('Packet too short'));if(t.clientId=r,e.will){if(o=this._parseString(),null===o)return this._emitError(new Error('Cannot parse will topic'));if(t.will.topic=o,i=this._parseBuffer(),null===i)return this._emitError(new Error('Cannot parse will payload'));t.will.payload=i}if(e.username){if(a=this._parseString(),null===a)return this._emitError(new Error('Cannot parse username'));t.username=a}if(e.password){if(s=this._parseBuffer(),null===s)return this._emitError(new Error('Cannot parse password'));t.password=s}return t},r.prototype._parseConnack=function(){var e=this.packet;return 2>this._list.length?null:(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&d.SESSIONPRESENT_MASK),e.returnCode=this._list.readUInt8(this._pos),-1===e.returnCode)?this._emitError(new Error('Cannot parse return code')):void 0},r.prototype._parsePublish=function(){var e=this.packet;return e.topic=this._parseString(),null===e.topic?this._emitError(new Error('Cannot parse topic')):void(0<e.qos&&!this._parseMessageId()||(e.payload=this._list.slice(this._pos,e.length)))},r.prototype._parseSubscribe=function(){var e=this.packet,t,n;if(1!==e.qos)return this._emitError(new Error('Wrong subscribe header'));if(e.subscriptions=[],!!this._parseMessageId())for(;this._pos<e.length;){if(t=this._parseString(),null===t)return this._emitError(new Error('Cannot parse topic'));n=this._list.readUInt8(this._pos++),e.subscriptions.push({topic:t,qos:n})}},r.prototype._parseSuback=function(){if(this.packet.granted=[],!!this._parseMessageId())for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))},r.prototype._parseUnsubscribe=function(){var e=this.packet;if(e.unsubscriptions=[],!!this._parseMessageId())for(;this._pos<e.length;){var t;if(t=this._parseString(),null===t)return this._emitError(new Error('Cannot parse topic'));e.unsubscriptions.push(t)}},r.prototype._parseUnsuback=function(){if(!this._parseMessageId())return this._emitError(new Error('Cannot parse messageId'))},r.prototype._parseMessageId=function(){var e=this.packet;return e.messageId=this._parseNum(),null!==e.messageId||(this._emitError(new Error('Cannot parse messageId')),!1)},r.prototype._parseString=function(){var e=this._parseNum(),t=e+this._pos,n;return-1===e||t>this._list.length||t>this.packet.length?null:(n=this._list.toString('utf8',this._pos,t),this._pos+=e,n)},r.prototype._parseBuffer=function(){var e=this._parseNum(),t=e+this._pos,n;return-1===e||t>this._list.length||t>this.packet.length?null:(n=this._list.slice(this._pos,t),this._pos+=e,n)},r.prototype._parseNum=function(){if(2>this._list.length-this._pos)return-1;var e=this._list.readUInt16BE(this._pos);return this._pos+=2,e},r.prototype._newPacket=function(){return this.packet&&(this._list.consume(this.packet.length),this.emit('packet',this.packet)),this.packet=new a,!0},r.prototype._emitError=function(e){this.error=e,this.emit('error',e)},e.exports=r},function(e,t,n){function r(e){if(!(this instanceof r))return new r(e);if(this._bufs=[],this.length=0,'function'==typeof e){this._callback=e;var 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)})}else this.append(e);o.call(this)}var o=n(46),i=n(47),s=n(2).Buffer;i.inherits(r,o),r.prototype._offset=function(e){var t=0,n=0,r;if(0===e)return[0,0];for(;n<this._bufs.length;n++){if(r=t+this._bufs[n].length,e<r||n==this._bufs.length-1)return[n,e-t];t=r}},r.prototype.append=function(e){var t=0;if(s.isBuffer(e))this._appendBuffer(e);else if(Array.isArray(e))for(;t<e.length;t++)this.append(e[t]);else if(e instanceof r)for(;t<e._bufs.length;t++)this.append(e._bufs[t]);else null!=e&&('number'==typeof e&&(e=e.toString()),this._appendBuffer(s.from(e)));return this},r.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},r.prototype._write=function(e,t,n){this._appendBuffer(e),'function'==typeof n&&n()},r.prototype._read=function(e){return this.length?void(e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)):this.push(null)},r.prototype.end=function(e){o.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},r.prototype.get=function(e){return this.slice(e,e+1)[0]},r.prototype.slice=function(e,t){return'number'==typeof e&&0>e&&(e+=this.length),'number'==typeof t&&0>t&&(t+=this.length),this.copy(null,0,e,t)},r.prototype.copy=function(e,t,n,r){if(('number'!=typeof n||0>n)&&(n=0),('number'!=typeof r||r>this.length)&&(r=this.length),n>=this.length)return e||s.alloc(0);if(0>=r)return e||s.alloc(0);var o=!!e,a=this._offset(n),d=r-n,p=d,c=o&&t||0,u=a[1],h,l;if(0===n&&r==this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:s.concat(this._bufs,this.length);for(l=0;l<this._bufs.length;l++)this._bufs[l].copy(e,c),c+=this._bufs[l].length;return e}if(p<=this._bufs[a[0]].length-u)return o?this._bufs[a[0]].copy(e,t,u,u+p):this._bufs[a[0]].slice(u,u+p);for(o||(e=s.allocUnsafe(d)),l=a[0];l<this._bufs.length;l++){if(h=this._bufs[l].length-u,p>h)this._bufs[l].copy(e,c,u);else{this._bufs[l].copy(e,c,u,u+p);break}c+=h,p-=h,u&&(u=0)}return e},r.prototype.shallowSlice=function(e,t){e=e||0,t=t||this.length,0>e&&(e+=this.length),0>t&&(t+=this.length);var n=this._offset(e),o=this._offset(t),i=this._bufs.slice(n[0],o[0]+1);return 0==o[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,o[1]),0!=n[1]&&(i[0]=i[0].slice(n[1])),new r(i)},r.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},r.prototype.consume=function(e){for(;this._bufs.length;)if(e>=this._bufs[0].length)e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}return this},r.prototype.duplicate=function(){for(var e=0,t=new r;e<this._bufs.length;e++)t.append(this._bufs[e]);return t},r.prototype.destroy=function(){this._bufs.length=0,this.length=0,this.push(null)},function(){var 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};for(var t in e)(function(t){r.prototype[t]=function(n){return this.slice(n,n+e[t])[t](0)}})(t)}(),e.exports=r},function(e,t,n){e.exports=n(4)},function(e,t,n){(function(e,r){function o(e,n){var r={seen:[],stylize:s};return 3<=arguments.length&&(r.depth=arguments[2]),4<=arguments.length&&(r.colors=arguments[3]),g(n)?r.showHidden=n:n&&t._extend(r,n),y(r.showHidden)&&(r.showHidden=!1),y(r.depth)&&(r.depth=2),y(r.colors)&&(r.colors=!1),y(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=i),d(r,e,r.depth)}function i(e,t){var n=o.styles[t];return n?'\x1B['+o.colors[n][0]+'m'+e+'\x1B['+o.colors[n][1]+'m':e}function s(e){return e}function a(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function d(e,r,o){if(e.customInspect&&r&&E(r.inspect)&&r.inspect!==t.inspect&&!(r.constructor&&r.constructor.prototype===r)){var i=r.inspect(o,e);return _(i)||(i=d(e,i,o)),i}var s=l(e,r);if(s)return s;var g=Object.keys(r),m=a(g);if(e.showHidden&&(g=Object.getOwnPropertyNames(r)),k(r)&&(0<=g.indexOf('message')||0<=g.indexOf('description')))return p(r);if(0===g.length){if(E(r)){var b=r.name?': '+r.name:'';return e.stylize('[Function'+b+']','special')}if(S(r))return e.stylize(RegExp.prototype.toString.call(r),'regexp');if(I(r))return e.stylize(Date.prototype.toString.call(r),'date');if(k(r))return p(r)}var y='',w=!1,T=['{','}'];if(f(r)&&(w=!0,T=['[',']']),E(r)){var v=r.name?': '+r.name:'';y=' [Function'+v+']'}if(S(r)&&(y=' '+RegExp.prototype.toString.call(r)),I(r)&&(y=' '+Date.prototype.toUTCString.call(r)),k(r)&&(y=' '+p(r)),0===g.length&&(!w||0==r.length))return T[0]+y+T[1];if(0>o)return S(r)?e.stylize(RegExp.prototype.toString.call(r),'regexp'):e.stylize('[Object]','special');e.seen.push(r);var n;return n=w?c(e,r,o,m,g):g.map(function(t){return u(e,r,o,m,t,w)}),e.seen.pop(),h(n,y,T)}function l(e,t){if(y(t))return e.stylize('undefined','undefined');if(_(t)){var n='\''+JSON.stringify(t).replace(/^"|"$/g,'').replace(/'/g,'\\\'').replace(/\\"/g,'"')+'\'';return e.stylize(n,'string')}return b(t)?e.stylize(''+t,'number'):g(t)?e.stylize(''+t,'boolean'):m(t)?e.stylize('null','null'):void 0}function p(e){return'['+Error.prototype.toString.call(e)+']'}function c(e,t,n,r,o){for(var s=[],a=0,i=t.length;a<i;++a)C(t,a+'')?s.push(u(e,t,n,r,a+'',!0)):s.push('');return o.forEach(function(o){o.match(/^\d+$/)||s.push(u(e,t,n,r,o,!0))}),s}function u(e,t,n,r,o,i){var s,a,l;if(l=Object.getOwnPropertyDescriptor(t,o)||{value:t[o]},l.get?l.set?a=e.stylize('[Getter/Setter]','special'):a=e.stylize('[Getter]','special'):l.set&&(a=e.stylize('[Setter]','special')),C(r,o)||(s='['+o+']'),a||(0>e.seen.indexOf(l.value)?(a=m(n)?d(e,l.value,null):d(e,l.value,n-1),-1<a.indexOf('\n')&&(i?a=a.split('\n').map(function(e){return'  '+e}).join('\n').substr(2):a='\n'+a.split('\n').map(function(e){return'   '+e}).join('\n'))):a=e.stylize('[Circular]','special')),y(s)){if(i&&o.match(/^\d+$/))return a;s=JSON.stringify(''+o),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,'name')):(s=s.replace(/'/g,'\\\'').replace(/\\"/g,'"').replace(/(^"|"$)/g,'\''),s=e.stylize(s,'string'))}return s+': '+a}function h(e,t,n){var r=0,o=e.reduce(function(e,t){return r++,0<=t.indexOf('\n')&&r++,e+t.replace(/\u001b\[\d\d?m/g,'').length+1},0);return 60<o?n[0]+(''===t?'':t+'\n ')+' '+e.join(',\n  ')+' '+n[1]:n[0]+t+' '+e.join(', ')+' '+n[1]}function f(e){return Array.isArray(e)}function g(e){return'boolean'==typeof e}function m(e){return null===e}function b(e){return'number'==typeof e}function _(e){return'string'==typeof e}function y(e){return void 0===e}function S(e){return w(e)&&'[object RegExp]'===T(e)}function w(e){return'object'==typeof e&&null!==e}function I(e){return w(e)&&'[object Date]'===T(e)}function k(t){return w(t)&&('[object Error]'===T(t)||t instanceof Error)}function E(e){return'function'==typeof e}function T(e){return Object.prototype.toString.call(e)}function v(e){return 10>e?'0'+e.toString(10):e.toString(10)}function x(){var e=new Date,t=[v(e.getHours()),v(e.getMinutes()),v(e.getSeconds())].join(':');return[e.getDate(),L[e.getMonth()],t].join(' ')}function C(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var R=/%[sdj%]/g;t.format=function(e){if(!_(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(o(arguments[n]));return t.join(' ')}for(var n=1,r=arguments,i=r.length,s=(e+'').replace(R,function(e){if('%%'===e)return'%';if(n>=i)return e;switch(e){case'%s':return r[n++]+'';case'%d':return+r[n++];case'%j':try{return JSON.stringify(r[n++])}catch(e){return'[Circular]'}default:return e;}}),a=r[n];n<i;a=r[++n])s+=m(a)||!w(a)?' '+a:' '+o(a);return s},t.deprecate=function(n,o){if(y(e.process))return function(){return t.deprecate(n,o).apply(this,arguments)};if(!0===r.noDeprecation)return n;var i=!1;return function(){if(!i){if(r.throwDeprecation)throw new Error(o);else r.traceDeprecation?console.trace(o):console.error(o);i=!0}return n.apply(this,arguments)}};var A={},P;t.debuglog=function(e){if(y(P)&&(P=r.env.NODE_DEBUG||''),e=e.toUpperCase(),!A[e])if(new RegExp('\\b'+e+'\\b','i').test(P)){var n=r.pid;A[e]=function(){var r=t.format.apply(t,arguments);console.error('%s %d: %s',e,n,r)}}else A[e]=function(){};return A[e]},t.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:'cyan',number:'yellow',boolean:'yellow',undefined:'grey',null:'bold',string:'green',date:'magenta',regexp:'red'},t.isArray=f,t.isBoolean=g,t.isNull=m,t.isNullOrUndefined=function(e){return null==e},t.isNumber=b,t.isString=_,t.isSymbol=function(e){return'symbol'==typeof e},t.isUndefined=y,t.isRegExp=S,t.isObject=w,t.isDate=I,t.isError=k,t.isFunction=E,t.isPrimitive=function(e){return null===e||'boolean'==typeof e||'number'==typeof e||'string'==typeof e||'symbol'==typeof e||'undefined'==typeof e},t.isBuffer=n(48);var L=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];t.log=function(){console.log('%s - %s',x(),t.format.apply(t,arguments))},t.inherits=n(3),t._extend=function(e,t){if(!t||!w(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(t,n(1),n(0))},function(e){e.exports=function(e){return e&&'object'==typeof e&&'function'==typeof e.copy&&'function'==typeof e.fill&&'function'==typeof e.readUInt8}},function(e){e.exports=function(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}},function(e,t,n){'use strict';function r(){this._array=Array(20),this._i=0}var o=n(2).Buffer,i=n(23),s=n(5).EventEmitter,a=n(3);a(r,s),r.prototype.write=function(e){return this._array[this._i++]=e,!0},r.prototype.concat=function(){var e=0,t=Array(this._array.length),n=this._array,r=0,s,i;for(s=0;s<n.length&&n[s]!==void 0;s++)t[s]='string'==typeof n[s]?o.byteLength(n[s]):n[s].length,e+=t[s];for(i=o.allocUnsafe(e),s=0;s<n.length&&n[s]!==void 0;s++)'string'==typeof n[s]?(i.write(n[s],r),r+=t[s]):(n[s].copy(i,r),r+=t[s]);return i},e.exports=function(e){var t=new r;return i(e,t),t.concat()}},function(e,t,n){'use strict';function r(e){var t=o.allocUnsafe(2);return t.writeUInt8(e>>8,0),t.writeUInt8(255&e,1),t}var o=n(2).Buffer,s={};e.exports={cache:s,generateCache:function(){for(var e=0;e<65536;e++)s[e]=r(e)},generateNumber:r}},function(e){'use strict';function t(e,t,n){var r=this;this._callback=e,this._args=n,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=r._interval),r._interval&&clearInterval(r._interval),r._interval=setInterval(r._callback,e,r._args)},this.clear=function(){r._interval&&(clearInterval(r._interval),r._interval=void 0)},this.destroy=function(){r._interval&&clearInterval(r._interval),r._callback=void 0,r._interval=void 0,r._args=void 0}}e.exports=function(){if('function'!=typeof arguments[0])throw new Error('callback needed');if('number'!=typeof arguments[1])throw new Error('interval needed');var e;if(0<arguments.length){e=Array(arguments.length-2);for(var n=0;n<e.length;n++)e[n]=arguments[n+2]}return new t(arguments[0],arguments[1],e)}},function(e){'use strict';function t(e){for(var t=e.split('/'),n=0;n<t.length;n++)if('+'!==t[n]){if('#'===t[n])return n===t.length-1;if(-1!==t[n].indexOf('+')||-1!==t[n].indexOf('#'))return!1}return!0}e.exports={validateTopics:function(e){if(0===e.length)return'empty_topic_list';for(var n=0;n<e.length;n++)if(!t(e[n]))return e[n];return null}}},function(e,t,n){(function(e,r){var o;/*! https://mths.be/punycode v1.4.1 by @mathias */(function(i){function s(e){throw new RangeError(P[e])}function a(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function d(e,t){var n=e.split('@'),r='';1<n.length&&(r=n[0]+'@',e=n[1]),e=e.replace(A,'.');var o=e.split('.'),i=a(o,t).join('.');return r+i}function l(e){for(var t=[],n=0,r=e.length,o,i;n<r;)o=e.charCodeAt(n++),55296<=o&&56319>=o&&n<r?(i=e.charCodeAt(n++),56320==(64512&i)?t.push(((1023&o)<<10)+(1023&i)+65536):(t.push(o),n--)):t.push(o);return t}function p(e){return a(e,function(e){var t='';return 65535<e&&(e-=65536,t+=M(55296|1023&e>>>10),e=56320|1023&e),t+=M(e),t}).join('')}function c(e){return 10>e-48?e-22:26>e-65?e-65:26>e-97?e-97:S}function u(e,t){return e+22+75*(26>e)-((0!=t)<<5)}function h(e,t,n){var r=0;for(e=n?O(e/T):e>>1,e+=O(e/t);e>L*E>>1;r+=S)e=O(e/L);return O(r+(L+1)*e/(e+w))}function f(e){var r=[],o=e.length,a=0,i=x,n=v,d,l,u,f,g,m,b,_,w,t;for(l=e.lastIndexOf(C),0>l&&(l=0),u=0;u<l;++u)128<=e.charCodeAt(u)&&s('not-basic'),r.push(e.charCodeAt(u));for(f=0<l?l+1:0;f<o;){for(g=a,m=1,b=S;;b+=S){if(f>=o&&s('invalid-input'),_=c(e.charCodeAt(f++)),(_>=S||_>O((y-a)/m))&&s('overflow'),a+=_*m,w=b<=n?I:b>=n+E?E:b-n,_<w)break;t=S-w,m>O(y/t)&&s('overflow'),m*=t}d=r.length+1,n=h(a-g,d,0==g),O(a/d)>y-i&&s('overflow'),i+=O(a/d),a%=d,r.splice(a++,0,i)}return p(r)}function g(e){var r=[],o,n,i,a,d,p,c,f,g,m,t,b,_,w,k;for(e=l(e),b=e.length,o=x,n=0,d=v,p=0;p<b;++p)t=e[p],128>t&&r.push(M(t));for(i=a=r.length,a&&r.push(C);i<b;){for(c=y,p=0;p<b;++p)t=e[p],t>=o&&t<c&&(c=t);for(_=i+1,c-o>O((y-n)/_)&&s('overflow'),n+=(c-o)*_,o=c,p=0;p<b;++p)if(t=e[p],t<o&&++n>y&&s('overflow'),t==o){for(f=n,g=S;;g+=S){if(m=g<=d?I:g>=d+E?E:g-d,f<m)break;k=f-m,w=S-m,r.push(M(u(m+k%w,0))),f=O(k/w)}r.push(M(u(f,0))),d=h(n,_,i==a),n=0,++i}++n,++o}return r.join('')}var m='object'==typeof t&&t&&!t.nodeType&&t,b='object'==typeof e&&e&&!e.nodeType&&e,_='object'==typeof r&&r;(_.global===_||_.window===_||_.self===_)&&(i=_);var y=2147483647,S=36,I=1,E=26,w=38,T=700,v=72,x=128,C='-',k=/^xn--/,R=/[^\x20-\x7E]/,A=/[\x2E\u3002\uFF0E\uFF61]/g,P={overflow:'Overflow: input needs wider integers to process',"not-basic":'Illegal input >= 0x80 (not a basic code point)',"invalid-input":'Invalid input'},L=S-I,O=Math.floor,M=String.fromCharCode,N;N={version:'1.4.1',ucs2:{decode:l,encode:p},decode:f,encode:g,toASCII:function(e){return d(e,function(e){return R.test(e)?'xn--'+g(e):e})},toUnicode:function(e){return d(e,function(e){return k.test(e)?f(e.slice(4).toLowerCase()):e})}};o=function(){return N}.call(t,n,t,e),!(void 0!==o&&(e.exports=o))})(this)}).call(t,n(55)(e),n(1))},function(e){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],!e.children&&(e.children=[]),Object.defineProperty(e,'loaded',{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,'id',{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e){'use strict';e.exports={isString:function(e){return'string'==typeof e},isObject:function(e){return'object'==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},function(e,t,n){'use strict';t.decode=t.parse=n(58),t.encode=t.stringify=n(59)},function(e){'use strict';function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,r,o,s){r=r||'&',o=o||'=';var a={};if('string'!=typeof e||0===e.length)return a;var d=/\+/g;e=e.split(r);var l=1e3;s&&'number'==typeof s.maxKeys&&(l=s.maxKeys);var p=e.length;0<l&&p>l&&(p=l);for(var c=0;c<p;++c){var i=e[c].replace(d,'%20'),u=i.indexOf(o),h,f,g,m;0<=u?(h=i.substr(0,u),f=i.substr(u+1)):(h=i,f=''),g=decodeURIComponent(h),m=decodeURIComponent(f),t(a,g)?n(a[g])?a[g].push(m):a[g]=[a[g],m]:a[g]=m}return a};var n=Array.isArray||function(e){return'[object Array]'===Object.prototype.toString.call(e)}},function(e){'use strict';function t(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var n=function(e){switch(typeof e){case'string':return e;case'boolean':return e?'true':'false';case'number':return isFinite(e)?e:'';default:return'';}};e.exports=function(e,i,s,a){return i=i||'&',s=s||'=',null===e&&(e=void 0),'object'==typeof e?t(o(e),function(o){var a=encodeURIComponent(n(o))+s;return r(e[o])?t(e[o],function(e){return a+encodeURIComponent(n(e))}).join(i):a+encodeURIComponent(n(e[o]))}).join(i):a?encodeURIComponent(n(a))+s+encodeURIComponent(n(e)):''};var r=Array.isArray||function(e){return'[object Array]'===Object.prototype.toString.call(e)},o=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},function(){},function(){},function(e,t,n){(function(t,r){var o=n(8),i=n(21),s=n(3),a=n(63),d=t.from&&t.from!==Uint8Array.from?t.from([0]):new t([0]),l=function(e,t){e._corked?e.once('uncork',t):t()},p=function(e,t){e._autoDestroy&&e.destroy(t)},c=function(e,t){return function(n){n?p(e,'premature close'===n.message?null:n):t&&!e._ended&&e.end()}},u=function(e,t){return e?e._writableState&&e._writableState.finished?t():e._writableState?e.end(t):void(e.end(),t()):t()},h=function(e){return new o.Readable({objectMode:!0,highWaterMark:16}).wrap(e)},f=function(e,t,n){return this instanceof f?void(o.Duplex.call(this,n),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!n||!1!==n.autoDestroy,this._forwardDestroy=!n||!1!==n.destroy,this._forwardEnd=!n||!1!==n.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)):new f(e,t,n)};s(f,o.Duplex),f.obj=function(e,t,n){return n||(n={}),n.objectMode=!0,n.highWaterMark=16,new f(e,t,n)},f.prototype.cork=function(){1==++this._corked&&this.emit('cork')},f.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit('uncork')},f.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed)return void(e&&e.destroy&&e.destroy());if(null===e||!1===e)return void this.end();var t=this,n=i(e,{writable:!0,readable:!1},c(this,this._forwardEnd)),o=function(){var e=t._ondrain;t._ondrain=null,e&&e()};this._unwrite&&r.nextTick(o),this._writable=e,this._writable.on('drain',o),this._unwrite=function(){t._writable.removeListener('drain',o),n()},this.uncork()},f.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed)return void(e&&e.destroy&&e.destroy());if(null===e||!1===e)return this.push(null),void this.resume();var t=this,n=i(e,{writable:!1,readable:!0},c(this)),r=function(){t._forward()},o=function(){t.push(null)};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:h(e),this._readable2.on('readable',r),this._readable2.on('end',o),this._unread=function(){t._readable2.removeListener('readable',r),t._readable2.removeListener('end',o),n()},this._forward()},f.prototype._read=function(){this._drained=!0,this._forward()},f.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){this._forwarding=!0;for(var e;this._drained&&null!==(e=a(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},f.prototype.destroy=function(e){if(!this.destroyed){this.destroyed=!0;var t=this;r.nextTick(function(){t._destroy(e)})}},f.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit('error',e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit('close')},f.prototype._write=function(e,t,n){return this.destroyed?n():this._corked?l(this,this._write.bind(this,e,t,n)):e===d?this._finish(n):this._writable?void(!1===this._writable.write(e)?this._ondrain=n:n()):n()},f.prototype._finish=function(e){var t=this;this.emit('preend'),l(this,function(){u(t._forwardEnd&&t._writable,function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit('prefinish'),l(t,e)})})},f.prototype.end=function(e,t,n){return'function'==typeof e?this.end(null,null,e):'function'==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this.write(d),o.Writable.prototype.end.call(this,n))},e.exports=f}).call(t,n(10).Buffer,n(0))},function(e){function t(e){return e.buffer.length?e.buffer.head?e.buffer.head.data.length:e.buffer[0].length:e.length}e.exports=function(e){var n=e._readableState;return n?n.objectMode?e.read():e.read(t(n)):null}},function(e){var t=null;'undefined'==typeof WebSocket?'undefined'==typeof MozWebSocket?'undefined'!=typeof window&&(t=window.WebSocket||window.MozWebSocket):t=MozWebSocket:t=WebSocket,e.exports=t}]);
  //# sourceMappingURL=naf-aws-iot-adapter.min.js.map