New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

it-handshake

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

it-handshake - npm Package Compare versions

Comparing version 1.0.2 to 2.0.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# [2.0.0](https://github.com/jacobheun/it-handshake/compare/v1.0.2...v2.0.0) (2021-04-08)
<a name="1.0.2"></a>

@@ -2,0 +6,0 @@ ## [1.0.2](https://github.com/jacobheun/it-handshake/compare/v1.0.1...v1.0.2) (2020-08-12)

@@ -1,2 +0,10 @@

/*! For license information please see index.min.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ItHandshake=e():t.ItHandshake=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){t.exports=r(1)},function(t,e,r){"use strict";const n=r(2),i=r(9),o=r(12);t.exports=t=>{const e=i(),r=n(t.source),s=o();let f;const u=t.sink(async function*(){yield*e;const t=await s.promise;yield*t}());u.catch(t=>{f=t});return{reader:r,writer:e,stream:{sink:t=>f?Promise.reject(f):(s.resolve(t),u),source:r},rest:()=>e.end(),write:e.push,read:async()=>(await r.next()).value}}},function(t,e,r){"use strict";const n=r(3);t.exports=t=>{const e=async function*(){let e=yield,r=new n;for await(const i of t)if(e)for(r.append(i);r.length>=e;){const t=r.shallowSlice(0,e);if(r.consume(e),e=yield t,!e){r.length&&(e=yield r,r=new n);break}}else e=yield r.append(i),r=new n;if(e)throw Object.assign(new Error(`stream ended before ${e} bytes became available`),{code:"ERR_UNDER_READ",buffer:r})}();return e.next(),e}},function(t,e,r){"use strict";const{Buffer:n}=r(4),i=Symbol.for("BufferList");function o(t){if(!(this instanceof o))return new o(t);o._init.call(this,t)}o._init=function(t){Object.defineProperty(this,i,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)},o.prototype._new=function(t){return new o(t)},o.prototype._offset=function(t){if(0===t)return[0,0];let e=0;for(let r=0;r<this._bufs.length;r++){const n=e+this._bufs[r].length;if(t<n||r===this._bufs.length-1)return[r,t-e];e=n}},o.prototype._reverseOffset=function(t){const e=t[0];let r=t[1];for(let n=0;n<e;n++)r+=this._bufs[n].length;return r},o.prototype.get=function(t){if(t>this.length||t<0)return;const e=this._offset(t);return this._bufs[e[0]][e[1]]},o.prototype.slice=function(t,e){return"number"==typeof t&&t<0&&(t+=this.length),"number"==typeof e&&e<0&&(e+=this.length),this.copy(null,0,t,e)},o.prototype.copy=function(t,e,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return t||n.alloc(0);if(i<=0)return t||n.alloc(0);const o=!!t,s=this._offset(r),f=i-r;let u=f,h=o&&e||0,a=s[1];if(0===r&&i===this.length){if(!o)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let e=0;e<this._bufs.length;e++)this._bufs[e].copy(t,h),h+=this._bufs[e].length;return t}if(u<=this._bufs[s[0]].length-a)return o?this._bufs[s[0]].copy(t,e,a,a+u):this._bufs[s[0]].slice(a,a+u);o||(t=n.allocUnsafe(f));for(let n=s[0];n<this._bufs.length;n++){const e=this._bufs[n].length-a;if(!(u>e)){this._bufs[n].copy(t,h,a,a+u);break}this._bufs[n].copy(t,h,a),h+=e,u-=e,a&&(a=0)}return t},o.prototype.shallowSlice=function(t,e){if(t=t||0,e="number"!=typeof e?this.length:e,t<0&&(t+=this.length),e<0&&(e+=this.length),t===e)return this._new();const r=this._offset(t),n=this._offset(e),i=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,n[1]),0!==r[1]&&(i[0]=i[0].slice(r[1])),this._new(i)},o.prototype.toString=function(t,e,r){return this.slice(e,r).toString(t)},o.prototype.consume=function(t){for(;this._bufs.length;){if(!(t>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},o.prototype.duplicate=function(){const t=this._new();for(let e=0;e<this._bufs.length;e++)t.append(this._bufs[e]);return t},o.prototype.append=function(t){if(null==t)return this;if(t.buffer)this._appendBuffer(n.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let e=0;e<t.length;e++)this.append(t[e]);else if(this._isBufferList(t))for(let e=0;e<t._bufs.length;e++)this.append(t._bufs[e]);else"number"==typeof t&&(t=t.toString()),this._appendBuffer(n.from(t));return this},o.prototype._appendBuffer=function(t){this._bufs.push(t),this.length+=t.length},o.prototype.indexOf=function(t,e,r){if(void 0===r&&"string"==typeof e&&(r=e,e=void 0),"function"==typeof t||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof t?t=n.from([t]):"string"==typeof t?t=n.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=n.from(t.buffer,t.byteOffset,t.byteLength):n.isBuffer(t)||(t=n.from(t)),e=Number(e||0),isNaN(e)&&(e=0),e<0&&(e=this.length+e),e<0&&(e=0),0===t.length)return e>this.length?this.length:e;const i=this._offset(e);let o=i[0],s=i[1];for(;o<this._bufs.length;o++){const e=this._bufs[o];for(;s<e.length;){if(e.length-s>=t.length){const r=e.indexOf(t,s);if(-1!==r)return this._reverseOffset([o,r]);s=e.length-t.length+1}else{const e=this._reverseOffset([o,s]);if(this._match(e,t))return e;s++}}s=0}return-1},o.prototype._match=function(t,e){if(this.length-t<e.length)return!1;for(let r=0;r<e.length;r++)if(this.get(t+r)!==e[r])return!1;return!0},function(){const t={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const e in t)!function(e){o.prototype[e]=null===t[e]?function(t,r){return this.slice(t,t+r)[e](0,r)}:function(r){return this.slice(r,r+t[e])[e](0)}}(e)}(),o.prototype._isBufferList=function(t){return t instanceof o||o.isBufferList(t)},o.isBufferList=function(t){return null!=t&&t[i]},t.exports=o},function(t,e,r){"use strict";(function(t){var n=r(6),i=r(7),o=r(8);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,r);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return h(this,t,e,r)}function h(t,e,r,n){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,r,n){if(e.byteLength,r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");e=void 0===r&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,r):new Uint8Array(e,r,n);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=c(t,e);return t}(t,e,r,n):"string"==typeof e?function(t,e,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|g(e,r),i=(t=f(t,n)).write(e,r);i!==n&&(t=t.slice(0,i));return t}(t,e,r):function(t,e){if(u.isBuffer(e)){var r=0|p(e.length);return 0===(t=f(t,r)).length||e.copy(t,0,0,r),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(n=e.length)!=n?f(t,0):c(t,e);if("Buffer"===e.type&&o(e.data))return c(t,e.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function a(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(a(e),t=f(t,e<0?0:0|p(e)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<e;++r)t[r]=0;return t}function c(t,e){var r=e.length<0?0:0|p(e.length);t=f(t,r);for(var n=0;n<r;n+=1)t[n]=255&e[n];return t}function p(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return N(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return F(t).length;default:if(n)return N(t).length;e=(""+e).toLowerCase(),n=!0}}function y(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,r);case"utf8":case"utf-8":return P(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return U(this,e,r);case"base64":return B(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function w(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:b(t,e,r,n,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):b(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(t,e,r,n,i){var o,s=1,f=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,f/=2,u/=2,r/=2}function h(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var a=-1;for(o=r;o<f;o++)if(h(t,o)===h(e,-1===a?0:o-a)){if(-1===a&&(a=o),o-a+1===u)return a*s}else-1!==a&&(o-=o-a),a=-1}else for(r+u>f&&(r=f-u),o=r;o>=0;o--){for(var l=!0,c=0;c<u;c++)if(h(t,o+c)!==h(e,c)){l=!1;break}if(l)return o}return-1}function _(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var f=parseInt(e.substr(2*s,2),16);if(isNaN(f))return s;t[r+s]=f}return s}function v(t,e,r,n){return z(N(e,t.length-r),t,r,n)}function m(t,e,r,n){return z(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function E(t,e,r,n){return m(t,e,r,n)}function A(t,e,r,n){return z(F(e),t,r,n)}function R(t,e,r,n){return z(function(t,e){for(var r,n,i,o=[],s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function B(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function P(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var o,s,f,u,h=t[i],a=null,l=h>239?4:h>223?3:h>191?2:1;if(i+l<=r)switch(l){case 1:h<128&&(a=h);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&h)<<6|63&o)>127&&(a=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&h)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(a=u);break;case 4:o=t[i+1],s=t[i+2],f=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&f)&&(u=(15&h)<<18|(63&o)<<12|(63&s)<<6|63&f)>65535&&u<1114112&&(a=u)}null===a?(a=65533,l=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=l}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=4096));return r}(n)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}(),e.kMaxLength=s(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,r){return h(null,t,e,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,r){return function(t,e,r,n){return a(e),e<=0?f(t,e):void 0!==r?"string"==typeof n?f(t,e).fill(r,n):f(t,e).fill(r):f(t,e)}(null,t,e,r)},u.allocUnsafe=function(t){return l(null,t)},u.allocUnsafeSlow=function(t){return l(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,i=0,o=Math.min(r,n);i<o;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).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}},u.concat=function(t,e){if(!o(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=u.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var s=t[r];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)d(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)d(this,e,e+3),d(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)d(this,e,e+7),d(this,e+1,e+6),d(this,e+2,e+5),d(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?P(this,0,t):y.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",r=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,r,n,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(e>>>=0),f=Math.min(o,s),h=this.slice(n,i),a=t.slice(e,r),l=0;l<f;++l)if(h[l]!==a[l]){o=h[l],s=a[l];break}return o<s?-1:s<o?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return w(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return w(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return v(this,t,e,r);case"ascii":return m(this,t,e,r);case"latin1":case"binary":return E(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function U(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function S(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=e;o<r;++o)i+=j(t[o]);return i}function I(t,e,r){for(var n=t.slice(e,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function x(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function L(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i<o;++i)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Y(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i<o;++i)t[r+i]=e>>>8*(n?i:3-i)&255}function M(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function C(t,e,r,n,o){return o||M(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function D(t,e,r,n,o){return o||M(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){var r,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;r=new u(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+t]}return r},u.prototype.readUIntLE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n},u.prototype.readUIntBE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUInt8=function(t,e){return e||x(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||x(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||x(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||x(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||x(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var n=this[t],i=1,o=0;++o<e&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t|=0,e|=0,r||x(t,e,this.length);for(var n=e,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},u.prototype.readInt8=function(t,e){return e||x(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||x(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){e||x(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return e||x(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||x(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||x(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||x(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||x(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||x(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[e]=255&t;++o<r&&(i*=256);)this[e+o]=t/i&255;return e+r},u.prototype.writeUIntBE=function(t,e,r,n){(t=+t,e|=0,r|=0,n)||O(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[e+i]=255&t;--i>=0&&(o*=256);)this[e+i]=t/o&255;return e+r},u.prototype.writeUInt8=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):Y(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Y(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=0,s=1,f=0;for(this[e]=255&t;++o<r&&(s*=256);)t<0&&0===f&&0!==this[e+o-1]&&(f=1),this[e+o]=(t/s>>0)-f&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e|=0,!n){var i=Math.pow(2,8*r-1);O(this,t,e,r,i-1,-i)}var o=r-1,s=1,f=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===f&&0!==this[e+o+1]&&(f=1),this[e+o]=(t/s>>0)-f&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):L(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):L(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Y(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e|=0,r||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Y(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,r){return C(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return C(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return D(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return D(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,o=n-r;if(this===t&&r<e&&e<n)for(i=o-1;i>=0;--i)t[i+e]=this[i+r];else if(o<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+o),e);return o},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var o;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=u.isBuffer(t)?t:N(new u(t,n).toString()),f=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%f]}return this};var k=/[^+\/0-9A-Za-z-_]/g;function j(t){return t<16?"0"+t.toString(16):t.toString(16)}function N(t,e){var r;e=e||1/0;for(var n=t.length,i=null,o=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function F(t){return n.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(k,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function z(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(5))},function(t,e,r){"use strict";var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(i){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,r){"use strict";e.byteLength=function(t){var e=h(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,n=h(t),s=n[0],f=n[1],u=new o(function(t,e,r){return 3*(e+r)/4-r}(0,s,f)),a=0,l=f>0?s-4:s;for(r=0;r<l;r+=4)e=i[t.charCodeAt(r)]<<18|i[t.charCodeAt(r+1)]<<12|i[t.charCodeAt(r+2)]<<6|i[t.charCodeAt(r+3)],u[a++]=e>>16&255,u[a++]=e>>8&255,u[a++]=255&e;2===f&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[a++]=255&e);1===f&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[a++]=e>>8&255,u[a++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,o=[],s=0,f=r-i;s<f;s+=16383)o.push(a(t,s,s+16383>f?f:s+16383));1===i?(e=t[r-1],o.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],o.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return o.join("")};for(var n=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,u=s.length;f<u;++f)n[f]=s[f],i[s.charCodeAt(f)]=f;function h(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function a(t,e,r){for(var i,o,s=[],f=e;f<r;f+=3)i=(t[f]<<16&16711680)+(t[f+1]<<8&65280)+(255&t[f+2]),s.push(n[(o=i)>>18&63]+n[o>>12&63]+n[o>>6&63]+n[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(t,e,r){"use strict";e.read=function(t,e,r,n,i){var o,s,f=8*i-n-1,u=(1<<f)-1,h=u>>1,a=-7,l=r?i-1:0,c=r?-1:1,p=t[e+l];for(l+=c,o=p&(1<<-a)-1,p>>=-a,a+=f;a>0;o=256*o+t[e+l],l+=c,a-=8);for(s=o&(1<<-a)-1,o>>=-a,a+=n;a>0;s=256*s+t[e+l],l+=c,a-=8);if(0===o)o=1-h;else{if(o===u)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),o-=h}return(p?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,f,u,h=8*o-i-1,a=(1<<h)-1,l=a>>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,g=n?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(f=isNaN(e)?1:0,s=a):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?c/u:c*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=a?(f=0,s=a):s+l>=1?(f=(e*u-1)*Math.pow(2,i),s+=l):(f=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+p]=255&f,p+=g,f/=256,i-=8);for(s=s<<i|f,h+=i;h>0;t[r+p]=255&s,p+=g,s/=256,h-=8);t[r+p-g]|=128*y}},function(t,e,r){"use strict";var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,r){"use strict";const n=r(10);t.exports=t=>{let e;"function"==typeof(t=t||{})?(e=t,t={}):e=t.onEnd;let r,i,o,s=new n;const f=t=>i?i(t):(s.push(t),r),u=t=>o?r:f({done:!1,value:t}),h=t=>o?r:(o=!0,t?(t=>(s=new n,i?i({error:t}):(s.push({error:t}),r)))(t):f({done:!0}));if(r={[Symbol.asyncIterator](){return this},next:()=>{if(!s.isEmpty()){if(t.writev){let t;const e=[];for(;!s.isEmpty();){if(t=s.shift(),t.error)throw t.error;e.push(t.value)}return{done:t.done,value:e}}const e=s.shift();if(e.error)throw e.error;return e}return o?{done:!0}:new Promise((e,n)=>{i=o=>(i=null,o.error?n(o.error):t.writev&&!o.done?e({done:o.done,value:[o.value]}):e(o),r)})},return:()=>(s=new n,h(),{done:!0}),throw:t=>(h(t),{done:!0}),push:u,end:h},!e)return r;const a=r;return r={[Symbol.asyncIterator](){return this},next:()=>a.next(),throw:t=>(a.throw(t),e&&(e(t),e=null),{done:!0}),return:()=>(a.return(),e&&(e(),e=null),{done:!0}),push:u,end:t=>(a.end(t),e&&(e(t),e=null),r)},r}},function(t,e,r){"use strict";const n=r(11);t.exports=class{constructor(t){this.hwm=t||16,this.head=new n(this.hwm),this.tail=this.head}push(t){if(!this.head.push(t)){const e=this.head;this.head=e.next=new n(2*this.head.buffer.length),this.head.push(t)}}shift(){const t=this.tail.shift();if(void 0===t&&this.tail.next){const t=this.tail.next;return this.tail.next=null,this.tail=t,this.tail.shift()}return t}isEmpty(){return this.head.isEmpty()}}},function(t,e,r){"use strict";t.exports=class{constructor(t){if(!(t>0)||0!=(t-1&t))throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null}push(t){return void 0===this.buffer[this.top]&&(this.buffer[this.top]=t,this.top=this.top+1&this.mask,!0)}shift(){const t=this.buffer[this.btm];if(void 0!==t)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,t}isEmpty(){return void 0===this.buffer[this.btm]}}},function(t,e,r){"use strict";t.exports=()=>{const t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}}])}));
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.ItHandshake = factory()}(typeof self !== 'undefined' ? self : this, function () {
var ItHandshake=(()=>{var m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Z=m(M=>{"use strict";M.byteLength=Ct;M.toByteArray=St;M.fromByteArray=Nt;var I=[],g=[],kt=typeof Uint8Array!="undefined"?Uint8Array:Array,P="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var T=0,Mt=P.length;T<Mt;++T)I[T]=P[T],g[P.charCodeAt(T)]=T;g["-".charCodeAt(0)]=62;g["_".charCodeAt(0)]=63;function K(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var i=r===t?0:4-r%4;return[r,i]}function Ct(e){var t=K(e),r=t[0],i=t[1];return(r+i)*3/4-i}function Dt(e,t,r){return(t+r)*3/4-r}function St(e){var t,r=K(e),i=r[0],n=r[1],o=new kt(Dt(e,i,n)),u=0,h=n>0?i-4:i,s;for(s=0;s<h;s+=4)t=g[e.charCodeAt(s)]<<18|g[e.charCodeAt(s+1)]<<12|g[e.charCodeAt(s+2)]<<6|g[e.charCodeAt(s+3)],o[u++]=t>>16&255,o[u++]=t>>8&255,o[u++]=t&255;return n===2&&(t=g[e.charCodeAt(s)]<<2|g[e.charCodeAt(s+1)]>>4,o[u++]=t&255),n===1&&(t=g[e.charCodeAt(s)]<<10|g[e.charCodeAt(s+1)]<<4|g[e.charCodeAt(s+2)]>>2,o[u++]=t>>8&255,o[u++]=t&255),o}function Ot(e){return I[e>>18&63]+I[e>>12&63]+I[e>>6&63]+I[e&63]}function Pt(e,t,r){for(var i,n=[],o=t;o<r;o+=3)i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(e[o+2]&255),n.push(Ot(i));return n.join("")}function Nt(e){for(var t,r=e.length,i=r%3,n=[],o=16383,u=0,h=r-i;u<h;u+=o)n.push(Pt(e,u,u+o>h?h:u+o));return i===1?(t=e[r-1],n.push(I[t>>2]+I[t<<4&63]+"==")):i===2&&(t=(e[r-2]<<8)+e[r-1],n.push(I[t>>10]+I[t>>4&63]+I[t<<2&63]+"=")),n.join("")}});var Q=m($=>{$.read=function(e,t,r,i,n){var o,u,h=n*8-i-1,s=(1<<h)-1,p=s>>1,l=-7,c=r?n-1:0,B=r?-1:1,x=e[t+c];for(c+=B,o=x&(1<<-l)-1,x>>=-l,l+=h;l>0;o=o*256+e[t+c],c+=B,l-=8);for(u=o&(1<<-l)-1,o>>=-l,l+=i;l>0;u=u*256+e[t+c],c+=B,l-=8);if(o===0)o=1-p;else{if(o===s)return u?NaN:(x?-1:1)*Infinity;u=u+Math.pow(2,i),o=o-p}return(x?-1:1)*u*Math.pow(2,o-i)};$.write=function(e,t,r,i,n,o){var u,h,s,p=o*8-n-1,l=(1<<p)-1,c=l>>1,B=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=i?0:o-1,a=i?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===Infinity?(h=isNaN(t)?1:0,u=l):(u=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-u))<1&&(u--,s*=2),u+c>=1?t+=B/s:t+=B*Math.pow(2,1-c),t*s>=2&&(u++,s/=2),u+c>=l?(h=0,u=l):u+c>=1?(h=(t*s-1)*Math.pow(2,n),u=u+c):(h=t*Math.pow(2,c-1)*Math.pow(2,n),u=0));n>=8;e[r+x]=h&255,x+=a,h/=256,n-=8);for(u=u<<n|h,p+=n;p>0;e[r+x]=u&255,x+=a,u/=256,p-=8);e[r+x-a]|=A*128}});var wt=m(L=>{"use strict";var q=Z(),C=Q(),v=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;L.Buffer=f;L.SlowBuffer=$t;L.INSPECT_MAX_BYTES=50;var D=2147483647;L.kMaxLength=D;f.TYPED_ARRAY_SUPPORT=qt();!f.TYPED_ARRAY_SUPPORT&&typeof console!="undefined"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function qt(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch(e){return!1}}Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(!!f.isBuffer(this))return this.buffer}});Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(!!f.isBuffer(this))return this.byteOffset}});function U(e){if(e>D)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,f.prototype),t}function f(e,t,r){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return j(e)}return tt(e,t,r)}f.poolSize=8192;function tt(e,t,r){if(typeof e=="string")return jt(e,t);if(ArrayBuffer.isView(e))return Wt(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(F(e,ArrayBuffer)||e&&F(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer!="undefined"&&(F(e,SharedArrayBuffer)||e&&F(e.buffer,SharedArrayBuffer)))return W(e,t,r);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=e.valueOf&&e.valueOf();if(i!=null&&i!==e)return f.from(i,t,r);let n=Gt(e);if(n)return n;if(typeof Symbol!="undefined"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return f.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}f.from=function(e,t,r){return tt(e,t,r)};Object.setPrototypeOf(f.prototype,Uint8Array.prototype);Object.setPrototypeOf(f,Uint8Array);function rt(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function Yt(e,t,r){return rt(e),e<=0?U(e):t!==void 0?typeof r=="string"?U(e).fill(t,r):U(e).fill(t):U(e)}f.alloc=function(e,t,r){return Yt(e,t,r)};function j(e){return rt(e),U(e<0?0:G(e)|0)}f.allocUnsafe=function(e){return j(e)};f.allocUnsafeSlow=function(e){return j(e)};function jt(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!f.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=et(e,t)|0,i=U(r),n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),i}function Y(e){let t=e.length<0?0:G(e.length)|0,r=U(t);for(let i=0;i<t;i+=1)r[i]=e[i]&255;return r}function Wt(e){if(F(e,Uint8Array)){let t=new Uint8Array(e);return W(t.buffer,t.byteOffset,t.byteLength)}return Y(e)}function W(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return t===void 0&&r===void 0?i=new Uint8Array(e):r===void 0?i=new Uint8Array(e,t):i=new Uint8Array(e,t,r),Object.setPrototypeOf(i,f.prototype),i}function Gt(e){if(f.isBuffer(e)){let t=G(e.length)|0,r=U(t);return r.length===0||e.copy(r,0,0,t),r}if(e.length!==void 0)return typeof e.length!="number"||z(e.length)?U(0):Y(e);if(e.type==="Buffer"&&Array.isArray(e.data))return Y(e.data)}function G(e){if(e>=D)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+D.toString(16)+" bytes");return e|0}function $t(e){return+e!=e&&(e=0),f.alloc(+e)}f.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==f.prototype};f.compare=function(t,r){if(F(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),F(r,Uint8Array)&&(r=f.from(r,r.offset,r.byteLength)),!f.isBuffer(t)||!f.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===r)return 0;let i=t.length,n=r.length;for(let o=0,u=Math.min(i,n);o<u;++o)if(t[o]!==r[o]){i=t[o],n=r[o];break}return i<n?-1:n<i?1:0};f.isEncoding=function(t){switch(String(t).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}};f.concat=function(t,r){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return f.alloc(0);let i;if(r===void 0)for(r=0,i=0;i<t.length;++i)r+=t[i].length;let n=f.allocUnsafe(r),o=0;for(i=0;i<t.length;++i){let u=t[i];if(F(u,Uint8Array))o+u.length>n.length?(f.isBuffer(u)||(u=f.from(u)),u.copy(n,o)):Uint8Array.prototype.set.call(n,u,o);else if(f.isBuffer(u))u.copy(n,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=u.length}return n};function et(e,t){if(f.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||F(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&r===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return it(e).length;default:if(n)return i?-1:H(e).length;t=(""+t).toLowerCase(),n=!0}}f.byteLength=et;function Kt(e,t,r){let i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return Xt(this,t,r);case"utf8":case"utf-8":return nt(this,t,r);case"ascii":return Ht(this,t,r);case"latin1":case"binary":return Vt(this,t,r);case"base64":return zt(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Jt(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}f.prototype._isBuffer=!0;function R(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}f.prototype.swap16=function(){let t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<t;r+=2)R(this,r,r+1);return this};f.prototype.swap32=function(){let t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<t;r+=4)R(this,r,r+3),R(this,r+1,r+2);return this};f.prototype.swap64=function(){let t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<t;r+=8)R(this,r,r+7),R(this,r+1,r+6),R(this,r+2,r+5),R(this,r+3,r+4);return this};f.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?nt(this,0,t):Kt.apply(this,arguments)};f.prototype.toLocaleString=f.prototype.toString;f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:f.compare(this,t)===0};f.prototype.inspect=function(){let t="",r=L.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"};v&&(f.prototype[v]=f.prototype.inspect);f.prototype.compare=function(t,r,i,n,o){if(F(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),!f.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(r===void 0&&(r=0),i===void 0&&(i=t?t.length:0),n===void 0&&(n=0),o===void 0&&(o=this.length),r<0||i>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=i)return 0;if(n>=o)return-1;if(r>=i)return 1;if(r>>>=0,i>>>=0,n>>>=0,o>>>=0,this===t)return 0;let u=o-n,h=i-r,s=Math.min(u,h),p=this.slice(n,o),l=t.slice(r,i);for(let c=0;c<s;++c)if(p[c]!==l[c]){u=p[c],h=l[c];break}return u<h?-1:h<u?1:0};function ut(e,t,r,i,n){if(e.length===0)return-1;if(typeof r=="string"?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,z(r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0)if(n)r=0;else return-1;if(typeof t=="string"&&(t=f.from(t,i)),f.isBuffer(t))return t.length===0?-1:ot(e,t,r,i,n);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):ot(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function ot(e,t,r,i,n){let o=1,u=e.length,h=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(e.length<2||t.length<2)return-1;o=2,u/=2,h/=2,r/=2}function s(l,c){return o===1?l[c]:l.readUInt16BE(c*o)}let p;if(n){let l=-1;for(p=r;p<u;p++)if(s(e,p)===s(t,l===-1?0:p-l)){if(l===-1&&(l=p),p-l+1===h)return l*o}else l!==-1&&(p-=p-l),l=-1}else for(r+h>u&&(r=u-h),p=r;p>=0;p--){let l=!0;for(let c=0;c<h;c++)if(s(e,p+c)!==s(t,c)){l=!1;break}if(l)return p}return-1}f.prototype.includes=function(t,r,i){return this.indexOf(t,r,i)!==-1};f.prototype.indexOf=function(t,r,i){return ut(this,t,r,i,!0)};f.prototype.lastIndexOf=function(t,r,i){return ut(this,t,r,i,!1)};function Zt(e,t,r,i){r=Number(r)||0;let n=e.length-r;i?(i=Number(i),i>n&&(i=n)):i=n;let o=t.length;i>o/2&&(i=o/2);let u;for(u=0;u<i;++u){let h=parseInt(t.substr(u*2,2),16);if(z(h))return u;e[r+u]=h}return u}function Qt(e,t,r,i){return O(H(t,e.length-r),e,r,i)}function tr(e,t,r,i){return O(vt(t),e,r,i)}function rr(e,t,r,i){return O(it(t),e,r,i)}function ir(e,t,r,i){return O(er(t,e.length-r),e,r,i)}f.prototype.write=function(t,r,i,n){if(r===void 0)n="utf8",i=this.length,r=0;else if(i===void 0&&typeof r=="string")n=r,i=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-r;if((i===void 0||i>o)&&(i=o),t.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let u=!1;for(;;)switch(n){case"hex":return Zt(this,t,r,i);case"utf8":case"utf-8":return Qt(this,t,r,i);case"ascii":case"latin1":case"binary":return tr(this,t,r,i);case"base64":return rr(this,t,r,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ir(this,t,r,i);default:if(u)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),u=!0}};f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function zt(e,t,r){return t===0&&r===e.length?q.fromByteArray(e):q.fromByteArray(e.slice(t,r))}function nt(e,t,r){r=Math.min(e.length,r);let i=[],n=t;for(;n<r;){let o=e[n],u=null,h=o>239?4:o>223?3:o>191?2:1;if(n+h<=r){let s,p,l,c;switch(h){case 1:o<128&&(u=o);break;case 2:s=e[n+1],(s&192)==128&&(c=(o&31)<<6|s&63,c>127&&(u=c));break;case 3:s=e[n+1],p=e[n+2],(s&192)==128&&(p&192)==128&&(c=(o&15)<<12|(s&63)<<6|p&63,c>2047&&(c<55296||c>57343)&&(u=c));break;case 4:s=e[n+1],p=e[n+2],l=e[n+3],(s&192)==128&&(p&192)==128&&(l&192)==128&&(c=(o&15)<<18|(s&63)<<12|(p&63)<<6|l&63,c>65535&&c<1114112&&(u=c))}}u===null?(u=65533,h=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|u&1023),i.push(u),n+=h}return nr(i)}var ft=4096;function nr(e){let t=e.length;if(t<=ft)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=ft));return r}function Ht(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]&127);return i}function Vt(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function Xt(e,t,r){let i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let o=t;o<r;++o)n+=or[e[o]];return n}function Jt(e,t,r){let i=e.slice(t,r),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}f.prototype.slice=function(t,r){let i=this.length;t=~~t,r=r===void 0?i:~~r,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<t&&(r=t);let n=this.subarray(t,r);return Object.setPrototypeOf(n,f.prototype),n};function w(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUintLE=f.prototype.readUIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||w(t,r,this.length);let n=this[t],o=1,u=0;for(;++u<r&&(o*=256);)n+=this[t+u]*o;return n};f.prototype.readUintBE=f.prototype.readUIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||w(t,r,this.length);let n=this[t+--r],o=1;for(;r>0&&(o*=256);)n+=this[t+--r]*o;return n};f.prototype.readUint8=f.prototype.readUInt8=function(t,r){return t=t>>>0,r||w(t,1,this.length),this[t]};f.prototype.readUint16LE=f.prototype.readUInt16LE=function(t,r){return t=t>>>0,r||w(t,2,this.length),this[t]|this[t+1]<<8};f.prototype.readUint16BE=f.prototype.readUInt16BE=function(t,r){return t=t>>>0,r||w(t,2,this.length),this[t]<<8|this[t+1]};f.prototype.readUint32LE=f.prototype.readUInt32LE=function(t,r){return t=t>>>0,r||w(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};f.prototype.readUint32BE=f.prototype.readUInt32BE=function(t,r){return t=t>>>0,r||w(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};f.prototype.readBigUInt64LE=b(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&k(t,this.length-8);let n=r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,o=this[++t]+this[++t]*2**8+this[++t]*2**16+i*2**24;return BigInt(n)+(BigInt(o)<<BigInt(32))});f.prototype.readBigUInt64BE=b(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&k(t,this.length-8);let n=r*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],o=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(o)});f.prototype.readIntLE=function(t,r,i){t=t>>>0,r=r>>>0,i||w(t,r,this.length);let n=this[t],o=1,u=0;for(;++u<r&&(o*=256);)n+=this[t+u]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*r)),n};f.prototype.readIntBE=function(t,r,i){t=t>>>0,r=r>>>0,i||w(t,r,this.length);let n=r,o=1,u=this[t+--n];for(;n>0&&(o*=256);)u+=this[t+--n]*o;return o*=128,u>=o&&(u-=Math.pow(2,8*r)),u};f.prototype.readInt8=function(t,r){return t=t>>>0,r||w(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};f.prototype.readInt16LE=function(t,r){t=t>>>0,r||w(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};f.prototype.readInt16BE=function(t,r){t=t>>>0,r||w(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};f.prototype.readInt32LE=function(t,r){return t=t>>>0,r||w(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};f.prototype.readInt32BE=function(t,r){return t=t>>>0,r||w(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};f.prototype.readBigInt64LE=b(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&k(t,this.length-8);let n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(r+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});f.prototype.readBigInt64BE=b(function(t){t=t>>>0,S(t,"offset");let r=this[t],i=this[t+7];(r===void 0||i===void 0)&&k(t,this.length-8);let n=(r<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i)});f.prototype.readFloatLE=function(t,r){return t=t>>>0,r||w(t,4,this.length),C.read(this,t,!0,23,4)};f.prototype.readFloatBE=function(t,r){return t=t>>>0,r||w(t,4,this.length),C.read(this,t,!1,23,4)};f.prototype.readDoubleLE=function(t,r){return t=t>>>0,r||w(t,8,this.length),C.read(this,t,!0,52,8)};f.prototype.readDoubleBE=function(t,r){return t=t>>>0,r||w(t,8,this.length),C.read(this,t,!1,52,8)};function d(e,t,r,i,n,o){if(!f.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}f.prototype.writeUintLE=f.prototype.writeUIntLE=function(t,r,i,n){if(t=+t,r=r>>>0,i=i>>>0,!n){let h=Math.pow(2,8*i)-1;d(this,t,r,i,h,0)}let o=1,u=0;for(this[r]=t&255;++u<i&&(o*=256);)this[r+u]=t/o&255;return r+i};f.prototype.writeUintBE=f.prototype.writeUIntBE=function(t,r,i,n){if(t=+t,r=r>>>0,i=i>>>0,!n){let h=Math.pow(2,8*i)-1;d(this,t,r,i,h,0)}let o=i-1,u=1;for(this[r+o]=t&255;--o>=0&&(u*=256);)this[r+o]=t/u&255;return r+i};f.prototype.writeUint8=f.prototype.writeUInt8=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,1,255,0),this[r]=t&255,r+1};f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,2,65535,0),this[r]=t&255,this[r+1]=t>>>8,r+2};f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,2,65535,0),this[r]=t>>>8,this[r+1]=t&255,r+2};f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,4,4294967295,0),this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255,r+4};f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,4,4294967295,0),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};function st(e,t,r,i,n){ht(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o,o=o>>8,e[r++]=o;let u=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=u,u=u>>8,e[r++]=u,u=u>>8,e[r++]=u,u=u>>8,e[r++]=u,r}function lt(e,t,r,i,n){ht(t,i,n,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o=o>>8,e[r+6]=o,o=o>>8,e[r+5]=o,o=o>>8,e[r+4]=o;let u=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=u,u=u>>8,e[r+2]=u,u=u>>8,e[r+1]=u,u=u>>8,e[r]=u,r+8}f.prototype.writeBigUInt64LE=b(function(t,r=0){return st(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});f.prototype.writeBigUInt64BE=b(function(t,r=0){return lt(this,t,r,BigInt(0),BigInt("0xffffffffffffffff"))});f.prototype.writeIntLE=function(t,r,i,n){if(t=+t,r=r>>>0,!n){let s=Math.pow(2,8*i-1);d(this,t,r,i,s-1,-s)}let o=0,u=1,h=0;for(this[r]=t&255;++o<i&&(u*=256);)t<0&&h===0&&this[r+o-1]!==0&&(h=1),this[r+o]=(t/u>>0)-h&255;return r+i};f.prototype.writeIntBE=function(t,r,i,n){if(t=+t,r=r>>>0,!n){let s=Math.pow(2,8*i-1);d(this,t,r,i,s-1,-s)}let o=i-1,u=1,h=0;for(this[r+o]=t&255;--o>=0&&(u*=256);)t<0&&h===0&&this[r+o+1]!==0&&(h=1),this[r+o]=(t/u>>0)-h&255;return r+i};f.prototype.writeInt8=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,1,127,-128),t<0&&(t=255+t+1),this[r]=t&255,r+1};f.prototype.writeInt16LE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,2,32767,-32768),this[r]=t&255,this[r+1]=t>>>8,r+2};f.prototype.writeInt16BE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,2,32767,-32768),this[r]=t>>>8,this[r+1]=t&255,r+2};f.prototype.writeInt32LE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,4,2147483647,-2147483648),this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24,r+4};f.prototype.writeInt32BE=function(t,r,i){return t=+t,r=r>>>0,i||d(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255,r+4};f.prototype.writeBigInt64LE=b(function(t,r=0){return st(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});f.prototype.writeBigInt64BE=b(function(t,r=0){return lt(this,t,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ct(e,t,r,i,n,o){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function pt(e,t,r,i,n){return t=+t,r=r>>>0,n||ct(e,t,r,4,34028234663852886e22,-34028234663852886e22),C.write(e,t,r,i,23,4),r+4}f.prototype.writeFloatLE=function(t,r,i){return pt(this,t,r,!0,i)};f.prototype.writeFloatBE=function(t,r,i){return pt(this,t,r,!1,i)};function at(e,t,r,i,n){return t=+t,r=r>>>0,n||ct(e,t,r,8,17976931348623157e292,-17976931348623157e292),C.write(e,t,r,i,52,8),r+8}f.prototype.writeDoubleLE=function(t,r,i){return at(this,t,r,!0,i)};f.prototype.writeDoubleBE=function(t,r,i){return at(this,t,r,!1,i)};f.prototype.copy=function(t,r,i,n){if(!f.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<i&&(n=i),n===i||t.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-i&&(n=t.length-r+i);let o=n-i;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,i,n):Uint8Array.prototype.set.call(t,this.subarray(i,n),r),o};f.prototype.fill=function(t,r,i,n){if(typeof t=="string"){if(typeof r=="string"?(n=r,r=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(t.length===1){let u=t.charCodeAt(0);(n==="utf8"&&u<128||n==="latin1")&&(t=u)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let o;if(typeof t=="number")for(o=r;o<i;++o)this[o]=t;else{let u=f.isBuffer(t)?t:f.from(t,n),h=u.length;if(h===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(o=0;o<i-r;++o)this[o+r]=u[o%h]}return this};var N={};function V(e,t,r){N[e]=class extends r{constructor(){super();Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}V("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);V("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);V("ERR_OUT_OF_RANGE",function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=yt(String(r)):typeof r=="bigint"&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=yt(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i},RangeError);function yt(e){let t="",r=e.length,i=e[0]==="-"?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function ur(e,t,r){S(t,"offset"),(e[t]===void 0||e[t+r]===void 0)&&k(t,e.length-(r+1))}function ht(e,t,r,i,n,o){if(e>r||e<t){let u=typeof t=="bigint"?"n":"",h;throw o>3?t===0||t===BigInt(0)?h=`>= 0${u} and < 2${u} ** ${(o+1)*8}${u}`:h=`>= -(2${u} ** ${(o+1)*8-1}${u}) and < 2 ** ${(o+1)*8-1}${u}`:h=`>= ${t}${u} and <= ${r}${u}`,new N.ERR_OUT_OF_RANGE("value",h,e)}ur(i,n,o)}function S(e,t){if(typeof e!="number")throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function k(e,t,r){throw Math.floor(e)!==e?(S(e,r),new N.ERR_OUT_OF_RANGE(r||"offset","an integer",e)):t<0?new N.ERR_BUFFER_OUT_OF_BOUNDS:new N.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}var fr=/[^+/0-9A-Za-z-_]/g;function hr(e){if(e=e.split("=")[0],e=e.trim().replace(fr,""),e.length<2)return"";for(;e.length%4!=0;)e=e+"=";return e}function H(e,t){t=t||Infinity;let r,i=e.length,n=null,o=[];for(let u=0;u<i;++u){if(r=e.charCodeAt(u),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(u+1===i){(t-=3)>-1&&o.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(t-=3)>-1&&o.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function vt(e){let t=[];for(let r=0;r<e.length;++r)t.push(e.charCodeAt(r)&255);return t}function er(e,t){let r,i,n,o=[];for(let u=0;u<e.length&&!((t-=2)<0);++u)r=e.charCodeAt(u),i=r>>8,n=r%256,o.push(n),o.push(i);return o}function it(e){return q.toByteArray(hr(e))}function O(e,t,r,i){let n;for(n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function F(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function z(e){return e!==e}var or=function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let i=r*16;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t}();function b(e){return typeof BigInt=="undefined"?sr:e}function sr(){throw new Error("BigInt not supported")}});var Bt=m((Er,xt)=>{"use strict";var{Buffer:E}=wt(),dt=Symbol.for("BufferList");function y(e){if(!(this instanceof y))return new y(e);y._init.call(this,e)}y._init=function(t){Object.defineProperty(this,dt,{value:!0}),this._bufs=[],this.length=0,t&&this.append(t)};y.prototype._new=function(t){return new y(t)};y.prototype._offset=function(t){if(t===0)return[0,0];let r=0;for(let i=0;i<this._bufs.length;i++){let n=r+this._bufs[i].length;if(t<n||i===this._bufs.length-1)return[i,t-r];r=n}};y.prototype._reverseOffset=function(e){let t=e[0],r=e[1];for(let i=0;i<t;i++)r+=this._bufs[i].length;return r};y.prototype.get=function(t){if(t>this.length||t<0)return;let r=this._offset(t);return this._bufs[r[0]][r[1]]};y.prototype.slice=function(t,r){return typeof t=="number"&&t<0&&(t+=this.length),typeof r=="number"&&r<0&&(r+=this.length),this.copy(null,0,t,r)};y.prototype.copy=function(t,r,i,n){if((typeof i!="number"||i<0)&&(i=0),(typeof n!="number"||n>this.length)&&(n=this.length),i>=this.length||n<=0)return t||E.alloc(0);let o=!!t,u=this._offset(i),h=n-i,s=h,p=o&&r||0,l=u[1];if(i===0&&n===this.length){if(!o)return this._bufs.length===1?this._bufs[0]:E.concat(this._bufs,this.length);for(let c=0;c<this._bufs.length;c++)this._bufs[c].copy(t,p),p+=this._bufs[c].length;return t}if(s<=this._bufs[u[0]].length-l)return o?this._bufs[u[0]].copy(t,r,l,l+s):this._bufs[u[0]].slice(l,l+s);o||(t=E.allocUnsafe(h));for(let c=u[0];c<this._bufs.length;c++){let B=this._bufs[c].length-l;if(s>B)this._bufs[c].copy(t,p,l),p+=B;else{this._bufs[c].copy(t,p,l,l+s),p+=B;break}s-=B,l&&(l=0)}return t.length>p?t.slice(0,p):t};y.prototype.shallowSlice=function(t,r){if(t=t||0,r=typeof r!="number"?this.length:r,t<0&&(t+=this.length),r<0&&(r+=this.length),t===r)return this._new();let i=this._offset(t),n=this._offset(r),o=this._bufs.slice(i[0],n[0]+1);return n[1]===0?o.pop():o[o.length-1]=o[o.length-1].slice(0,n[1]),i[1]!==0&&(o[0]=o[0].slice(i[1])),this._new(o)};y.prototype.toString=function(t,r,i){return this.slice(r,i).toString(t)};y.prototype.consume=function(t){if(t=Math.trunc(t),Number.isNaN(t)||t<=0)return this;for(;this._bufs.length;)if(t>=this._bufs[0].length)t-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(t),this.length-=t;break}return this};y.prototype.duplicate=function(){let t=this._new();for(let r=0;r<this._bufs.length;r++)t.append(this._bufs[r]);return t};y.prototype.append=function(t){if(t==null)return this;if(t.buffer)this._appendBuffer(E.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let r=0;r<t.length;r++)this.append(t[r]);else if(this._isBufferList(t))for(let r=0;r<t._bufs.length;r++)this.append(t._bufs[r]);else typeof t=="number"&&(t=t.toString()),this._appendBuffer(E.from(t));return this};y.prototype._appendBuffer=function(t){this._bufs.push(t),this.length+=t.length};y.prototype.indexOf=function(e,t,r){if(r===void 0&&typeof t=="string"&&(r=t,t=void 0),typeof e=="function"||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof e=="number"?e=E.from([e]):typeof e=="string"?e=E.from(e,r):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=E.from(e.buffer,e.byteOffset,e.byteLength):E.isBuffer(e)||(e=E.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),e.length===0)return t>this.length?this.length:t;let i=this._offset(t),n=i[0],o=i[1];for(;n<this._bufs.length;n++){let u=this._bufs[n];for(;o<u.length;)if(u.length-o>=e.length){let s=u.indexOf(e,o);if(s!==-1)return this._reverseOffset([n,s]);o=u.length-e.length+1}else{let s=this._reverseOffset([n,o]);if(this._match(s,e))return s;o++}o=0}return-1};y.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0};(function(){let e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let t in e)(function(r){e[r]===null?y.prototype[r]=function(i,n){return this.slice(i,i+n)[r](0,n)}:y.prototype[r]=function(i=0){return this.slice(i,i+e[r])[r](0)}})(t)})();y.prototype._isBufferList=function(t){return t instanceof y||y.isBufferList(t)};y.isBufferList=function(t){return t!=null&&t[dt]};xt.exports=y});var Et=m((mr,gt)=>{var X=Bt();gt.exports=e=>{let t=async function*(){let r=yield,i=new X;for await(let n of e){if(!r){r=yield i.append(n),i=new X;continue}for(i.append(n);i.length>=r;){let o=i.shallowSlice(0,r);if(i.consume(r),r=yield o,!r){i.length&&(r=yield i,i=new X);break}}}if(r)throw Object.assign(new Error(`stream ended before ${r} bytes became available`),{code:"ERR_UNDER_READ",buffer:i})}();return t.next(),t}});var It=m((Fr,mt)=>{mt.exports=class{constructor(t){if(!(t>0)||(t-1&t)!=0)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(t),this.mask=t-1,this.top=0,this.btm=0,this.next=null}push(t){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=t,this.top=this.top+1&this.mask,!0)}shift(){let t=this.buffer[this.btm];if(t!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,t}isEmpty(){return this.buffer[this.btm]===void 0}}});var _t=m((_r,Ft)=>{var At=It();Ft.exports=class{constructor(t){this.hwm=t||16,this.head=new At(this.hwm),this.tail=this.head}push(t){if(!this.head.push(t)){let r=this.head;this.head=r.next=new At(2*this.head.buffer.length),this.head.push(t)}}shift(){let t=this.tail.shift();if(t===void 0&&this.tail.next){let r=this.tail.next;return this.tail.next=null,this.tail=r,this.tail.shift()}return t}isEmpty(){return this.head.isEmpty()}}});var bt=m((Ur,Ut)=>{var J=_t();Ut.exports=e=>{e=e||{};let t;typeof e=="function"?(t=e,e={}):t=e.onEnd;let r=new J,i,n,o,u=()=>{if(!r.isEmpty()){if(e.writev){let A,_=[];for(;!r.isEmpty();){if(A=r.shift(),A.error)throw A.error;_.push(A.value)}return{done:A.done,value:_}}let a=r.shift();if(a.error)throw a.error;return a}return o?{done:!0}:new Promise((a,A)=>{n=_=>(n=null,_.error?A(_.error):e.writev&&!_.done?a({done:_.done,value:[_.value]}):a(_),i)})},h=a=>n?n(a):(r.push(a),i),s=a=>(r=new J,n?n({error:a}):(r.push({error:a}),i)),p=a=>o?i:h({done:!1,value:a}),l=a=>o?i:(o=!0,a?s(a):h({done:!0})),c=()=>(r=new J,l(),{done:!0}),B=a=>(l(a),{done:!0});if(i={[Symbol.asyncIterator](){return this},next:u,return:c,throw:B,push:p,end:l},!t)return i;let x=i;return i={[Symbol.asyncIterator](){return this},next(){return x.next()},throw(a){return x.throw(a),t&&(t(a),t=null),{done:!0}},return(){return x.return(),t&&(t(),t=null),{done:!0}},push:p,end(a){return x.end(a),t&&(t(a),t=null),i}},i}});var Tt=m((br,Rt)=>{"use strict";var lr=()=>{let e={};return e.promise=new Promise((t,r)=>{e.resolve=t,e.reject=r}),e};Rt.exports=lr});var yr=m((Rr,Lt)=>{"use strict";var cr=Et(),pr=bt(),ar=Tt();Lt.exports=e=>{let t=pr(),r=cr(e.source),i=ar(),n,o=e.sink(async function*(){yield*t,yield*await i.promise}());return o.catch(h=>{n=h}),{reader:r,writer:t,stream:{sink:h=>n?Promise.reject(n):(i.resolve(h),o),source:r},rest:()=>t.end(),write:t.push,read:async()=>(await r.next()).value}}});return yr();})();
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
return ItHandshake}));

8

package.json
{
"name": "it-handshake",
"version": "1.0.2",
"version": "2.0.0",
"description": "Create handshakes for binary protocols with iterable streams.",

@@ -38,11 +38,11 @@ "main": "./src/index.js",

"it-pushable": "^1.4.0",
"it-reader": "^2.0.0",
"it-reader": "^3.0.0",
"p-defer": "^3.0.0"
},
"devDependencies": {
"aegir": "^25.1.0",
"aegir": "^33.0.0",
"it-pair": "^1.0.0",
"it-pipe": "^1.1.0",
"streaming-iterables": "^5.0.2",
"uint8arrays": "^1.1.0"
"uint8arrays": "^2.1.4"
},

@@ -49,0 +49,0 @@ "contributors": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc